Merge pull request #2965 from appwrite/chore-upgrade-sdk

Chore: Upgrade SDK to new platforms API
This commit is contained in:
Harsh Mahajan
2026-04-08 22:01:02 +05:30
committed by GitHub
40 changed files with 443 additions and 748 deletions
+3 -3
View File
@@ -1,12 +1,11 @@
{
"lockfileVersion": 1,
"configVersion": 0,
"workspaces": {
"": {
"name": "@appwrite/console",
"dependencies": {
"@ai-sdk/svelte": "^1.1.24",
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@24e07fc",
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@67539a6",
"@appwrite.io/pink-icons": "0.25.0",
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3",
"@appwrite.io/pink-legacy": "^1.0.3",
@@ -25,6 +24,7 @@
"deep-equal": "^2.2.3",
"echarts": "^5.6.0",
"flatted": "^3.4.2",
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@67539a6",
"ignore": "^6.0.2",
"nanoid": "^5.1.7",
"nanotar": "^0.3.0",
@@ -113,7 +113,7 @@
"@analytics/type-utils": ["@analytics/type-utils@0.6.4", "", {}, "sha512-Ou1gQxFakOWLcPnbFVsrPb8g1wLLUZYYJXDPjHkG07+5mustGs5yqACx42UAu4A6NszNN6Z5gGxhyH45zPWRxw=="],
"@appwrite.io/console": ["@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@24e07fc", { "dependencies": { "json-bigint": "1.0.0" } }],
"@appwrite.io/console": ["@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@67539a6", { "dependencies": { "json-bigint": "1.0.0" } }],
"@appwrite.io/pink-icons": ["@appwrite.io/pink-icons@0.25.0", "", {}, "sha512-0O3i2oEuh5mWvjO80i+X6rbzrWLJ1m5wmv2/M3a1p2PyBJsFxN8xQMTEmTn3Wl/D26SsM7SpzbdW6gmfgoVU9Q=="],
+1 -1
View File
@@ -20,7 +20,7 @@
},
"dependencies": {
"@ai-sdk/svelte": "^1.1.24",
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@24e07fc",
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@67539a6",
"@appwrite.io/pink-icons": "0.25.0",
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3",
"@appwrite.io/pink-legacy": "^1.0.3",
+12 -11
View File
@@ -12,8 +12,8 @@ importers:
specifier: ^1.1.24
version: 1.1.24(svelte@5.55.0)(zod@3.25.76)
'@appwrite.io/console':
specifier: https://pkg.vc/-/@appwrite/@appwrite.io/console@83fd10c
version: https://pkg.vc/-/@appwrite/@appwrite.io/console@83fd10c
specifier: https://pkg.vc/-/@appwrite/@appwrite.io/console@67539a6
version: https://pkg.vc/-/@appwrite/@appwrite.io/console@67539a6
'@appwrite.io/pink-icons':
specifier: 0.25.0
version: 0.25.0
@@ -75,8 +75,8 @@ importers:
specifier: ^5.1.7
version: 5.1.7
nanotar:
specifier: ^0.1.1
version: 0.1.1
specifier: ^0.3.0
version: 0.3.0
pretty-bytes:
specifier: ^6.1.1
version: 6.1.1
@@ -281,9 +281,10 @@ packages:
'@analytics/type-utils@0.6.4':
resolution: {integrity: sha512-Ou1gQxFakOWLcPnbFVsrPb8g1wLLUZYYJXDPjHkG07+5mustGs5yqACx42UAu4A6NszNN6Z5gGxhyH45zPWRxw==}
'@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@83fd10c':
resolution: {integrity: sha512-Mlq0dfJrcqUNFt+QUmrieHrJSScOUniigt1PL5Xum7QEDgT8Z/mMhG/xUcVfZqXtlF5gS4Sq7n72EB6P/3+kmQ==, tarball: https://pkg.vc/-/@appwrite/@appwrite.io/console@83fd10c}
version: 7.0.0
'@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@67539a6':
resolution: {integrity: sha512-IV+eVqF6tzL/voA1vqNtn5hL9lgJL78MVZkP4ABYwyaDRaXFyLQbPiRlJJesN4m7PYlCztyfAqcOn3QdCCjwIQ==, tarball: https://pkg.vc/-/@appwrite/@appwrite.io/console@67539a6}
version: 8.2.0
engines: {node: '>=18.0.0'}
'@appwrite.io/pink-icons-svelte@2.0.0-RC.1':
resolution: {integrity: sha512-iLFlV55hj8mGuAbmxJGenxN5RaZMmVT4GJb9dv/MP1xBAtYibFq7JvBcxm18qV2KU8c31Rntf+Ub4GL7HwqTYg==}
@@ -2675,8 +2676,8 @@ packages:
engines: {node: ^18 || >=20}
hasBin: true
nanotar@0.1.1:
resolution: {integrity: sha512-AiJsGsSF3O0havL1BydvI4+wR76sKT+okKRwWIaK96cZUnXqH0uNBOsHlbwZq3+m2BR1VKqHDVudl3gO4mYjpQ==}
nanotar@0.3.0:
resolution: {integrity: sha512-Kv2JYYiCzt16Kt5QwAc9BFG89xfPNBx+oQL4GQXD9nLqPkZBiNaqaCWtwnbk/q7UVsTYevvM1b0UF8zmEI4pCg==}
natural-compare@1.4.0:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
@@ -3631,7 +3632,7 @@ snapshots:
'@analytics/type-utils@0.6.4': {}
'@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@83fd10c':
'@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@67539a6':
dependencies:
json-bigint: 1.0.0
@@ -6160,7 +6161,7 @@ snapshots:
nanoid@5.1.7: {}
nanotar@0.1.1: {}
nanotar@0.3.0: {}
natural-compare@1.4.0: {}
+50 -21
View File
@@ -1,30 +1,59 @@
import type { Models } from '@appwrite.io/console';
export type AnyPlatform =
| Models.PlatformWeb
| Models.PlatformApple
| Models.PlatformAndroid
| Models.PlatformWindows
| Models.PlatformLinux;
export function isMac(): boolean {
return window.navigator.platform.toUpperCase().indexOf('MAC') >= 0;
}
export const getPlatformInfo = (platform: string) => {
let name: string, icon: string;
if (platform.includes('flutter')) {
name = 'Flutter';
icon = 'flutter';
} else if (platform.includes('react-native')) {
name = 'React Native';
icon = 'react-native';
} else if (platform.includes('apple')) {
name = 'Apple';
icon = 'apple';
} else if (platform.includes('android')) {
name = 'Android';
icon = 'android';
} else if (platform.includes('unity')) {
name = 'Unity';
icon = 'unity';
} else if (platform.includes('web')) {
name = 'Web';
icon = 'code';
} else {
name = 'Unknown';
icon = 'unknown';
switch (platform) {
case 'apple':
name = 'Apple';
icon = 'apple';
break;
case 'android':
name = 'Android';
icon = 'android';
break;
case 'web':
name = 'Web';
icon = 'code';
break;
case 'windows':
name = 'Windows';
icon = 'windows';
break;
case 'linux':
name = 'Linux';
icon = 'linux';
break;
default:
name = 'Unknown';
icon = 'unknown';
}
return { name, icon };
};
export function getPlatformIdentifier(platform: AnyPlatform): string {
switch (platform.type) {
case 'web':
return (platform as Models.PlatformWeb).hostname;
case 'android':
return (platform as Models.PlatformAndroid).applicationId;
case 'apple':
return (platform as Models.PlatformApple).bundleIdentifier;
case 'windows':
return (platform as Models.PlatformWindows).packageIdentifierName;
case 'linux':
return (platform as Models.PlatformLinux).packageName;
default:
return '';
}
}
@@ -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) {
@@ -30,8 +30,11 @@
import PlatformSdkImgSourceDark from './assets/platform-sdk-dark.png';
import { resolve } from '$app/paths';
import { isSmallViewport } from '$lib/stores/viewport';
import type { Models } from '@appwrite.io/console';
import { getPlatformInfo } from '$lib/helpers/platform';
import {
getPlatformInfo,
getPlatformIdentifier,
type AnyPlatform
} from '$lib/helpers/platform';
import { Click, trackEvent } from '$lib/actions/analytics';
import { goto } from '$app/navigation';
import { page } from '$app/state';
@@ -42,11 +45,11 @@
platforms = []
}: {
pingCount: number;
platforms: Array<Models.Platform>;
platforms: Array<AnyPlatform>;
} = $props();
const platformMap = $derived.by(() => {
const map = new Map<string, Models.Platform>();
const map = new Map<string, AnyPlatform>();
platforms.forEach((platform) => {
const platformInfo = getPlatformInfo(platform.type);
map.set(platformInfo.name, platform);
@@ -68,9 +71,9 @@
goto(`${projectRoute}/overview/api-keys/create`, { replaceState: true });
}
function openPlatformWizard(type: Platform, platform?: Models.Platform) {
function openPlatformWizard(type: Platform, platform?: AnyPlatform) {
if (platform) {
continuePlatform(type, platform.name, platform.key, platform.type);
continuePlatform(type, platform.name, getPlatformIdentifier(platform), platform.type);
} else {
trackEvent(Click.PlatformCreateClick, { source: 'onboarding' });
addPlatform(type);
@@ -8,7 +8,6 @@
import CreateWeb from './createWeb.svelte';
import { createPlatform } from './wizard/store';
import { Click, trackEvent } from '$lib/actions/analytics';
import type { PlatformType } from '@appwrite.io/console';
export enum Platform {
Web,
@@ -31,11 +30,12 @@
platform: Platform,
name: string,
key: string,
type: PlatformType
type: string
) {
createPlatform.set({
name: name,
key: key,
hostname: null,
type: type
});
@@ -79,15 +79,17 @@
IconAndroid,
IconApple,
IconCode,
IconDesktopComputer,
IconFlutter,
IconLinux,
IconReact
} from '@appwrite.io/pink-icons-svelte';
import type { ComponentType } from 'svelte';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import type { AnyPlatform } from '$lib/helpers/platform';
import { page } from '$app/state';
import type { PageProps } from './$types';
import type { Models } from '@appwrite.io/console';
import {
type DeleteOperationState,
type DeleteOperation,
@@ -97,41 +99,35 @@
import { Submit, trackError } from '$lib/actions/analytics';
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { getPlatformIdentifier } from '$lib/helpers/platform';
const { data }: PageProps = $props();
const PlatformTypes = {
'apple-ios': 'iOS',
'apple-macos': 'macOS',
'apple-watchos': 'watchOS',
'apple-tvos': 'tvOS',
android: 'Android',
'flutter-android': 'Android',
'flutter-ios': 'iOS',
'flutter-linux': 'Linux',
'flutter-macos': 'macOS',
'flutter-windows': 'Windows',
'flutter-web': 'Web',
'react-native-android': 'Android',
'react-native-ios': 'iOS',
web: 'Web'
apple: 'Apple',
web: 'Web',
windows: 'Windows',
linux: 'Linux'
} as const;
function getPlatformInfo(platform: string): ComponentType {
if (platform.includes('flutter')) {
return IconFlutter;
} else if (platform.includes('react-native')) {
return IconReact;
} else if (platform.includes('apple')) {
return IconApple;
} else if (platform.includes('android')) {
return IconAndroid;
} else {
return IconCode;
function getPlatformIcon(platform: string): ComponentType {
switch (platform) {
case 'apple':
return IconApple;
case 'android':
return IconAndroid;
case 'linux':
return IconLinux;
case 'windows':
return IconDesktopComputer;
case 'web':
default:
return IconCode;
}
}
function getPlatformPath(platform: Models.Platform) {
function getPlatformPath(platform: AnyPlatform) {
return resolve('/(console)/project-[region]-[project]/overview/platforms/[platform]', {
region: page.params.region,
project: page.params.project,
@@ -143,8 +139,7 @@
batchDelete: DeleteOperation
): Promise<DeleteOperationState> {
const result = await batchDelete((platformId) =>
sdk.forConsole.projects.deletePlatform({
projectId: page.params.project,
sdk.forProject(page.params.region, page.params.project).project.deletePlatform({
platformId
})
);
@@ -187,16 +182,12 @@
</Table.Cell>
<Table.Cell {root}>
<Layout.Stack direction="row" gap="s" alignItems="center">
<Icon icon={getPlatformInfo(platform.type)} />
<Icon icon={getPlatformIcon(platform.type)} />
{PlatformTypes[platform.type]}
</Layout.Stack>
</Table.Cell>
<Table.Cell {root}>
{#if platform.type.includes('web') || platform.type === 'web'}
{platform.hostname || '—'}
{:else}
{platform.key || platform.hostname || '—'}
{/if}
{getPlatformIdentifier(platform) || '—'}
</Table.Cell>
<Table.Cell {root}>
{#if platform.$updatedAt}
@@ -10,8 +10,7 @@ export const load: PageLoad = async ({ params, depends }) => {
return {
header: Header,
breadcrumbs: Breadcrumbs,
platform: await sdk.forConsole.projects.getPlatform({
projectId: params.project,
platform: await sdk.forProject(params.region, params.project).project.getPlatform({
platformId: params.platform
})
};
@@ -1,16 +1,11 @@
<script lang="ts">
import type { Models } from '@appwrite.io/console';
import Delete from './delete.svelte';
import Web from './web.svelte';
import FlutterIos from './flutterIOS.svelte';
import FlutterAndroid from './flutterAndroid.svelte';
import FlutterLinux from './flutterLinux.svelte';
import FlutterMacOs from './flutterMacOS.svelte';
import FlutterWindows from './flutterWindows.svelte';
import AppleiOs from './appleIOS.svelte';
import AppleMacOs from './appleMacOS.svelte';
import AppleWatchOs from './appleWatchOS.svelte';
import AppleTvos from './appleTvOS.svelte';
import Android from './android.svelte';
import FlutterLinux from './flutterLinux.svelte';
import FlutterWindows from './flutterWindows.svelte';
import { Box, CardGrid } from '$lib/components';
import { Button, Form, InputText } from '$lib/elements/forms';
import { Container } from '$lib/layout';
@@ -21,20 +16,14 @@
import { platform } from './store';
import { Dependencies } from '$lib/constants';
import { invalidate } from '$app/navigation';
import { getPlatformIdentifier } from '$lib/helpers/platform';
const types: Record<string, Component> = {
web: Web,
android: Android,
'apple-ios': AppleiOs,
'apple-macos': AppleMacOs,
'apple-watchos': AppleWatchOs,
'apple-tvos': AppleTvos,
'flutter-ios': FlutterIos,
'flutter-android': FlutterAndroid,
'flutter-linux': FlutterLinux,
'flutter-macos': FlutterMacOs,
'flutter-windows': FlutterWindows,
'flutter-web': Web
apple: AppleiOs,
windows: FlutterWindows,
linux: FlutterLinux
};
let showDelete = false;
@@ -46,14 +35,48 @@
async function updateName() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
platformId: $platform.$id,
name,
key: $platform.key || undefined,
store: $platform.store || undefined,
hostname: $platform.hostname || undefined
});
const projectSdk = sdk.forProject($project.region, $project.$id).project;
const platformId = $platform.$id;
switch ($platform.type) {
case 'web':
await projectSdk.updateWebPlatform({
platformId,
name,
hostname: ($platform as Models.PlatformWeb).hostname || undefined
});
break;
case 'android':
await projectSdk.updateAndroidPlatform({
platformId,
name,
applicationId: ($platform as Models.PlatformAndroid).applicationId
});
break;
case 'apple':
await projectSdk.updateApplePlatform({
platformId,
name,
bundleIdentifier: ($platform as Models.PlatformApple).bundleIdentifier
});
break;
case 'windows':
await projectSdk.updateWindowsPlatform({
platformId,
name,
packageIdentifierName: ($platform as Models.PlatformWindows)
.packageIdentifierName
});
break;
case 'linux':
await projectSdk.updateLinuxPlatform({
platformId,
name,
packageName: ($platform as Models.PlatformLinux).packageName
});
break;
default:
throw new Error(`Unknown platform type: ${$platform.type}`);
}
await invalidate(Dependencies.PLATFORM);
addNotification({
type: 'success',
@@ -98,7 +121,7 @@
<div class="u-flex u-gap-16">
<div class="u-cross-child-center u-line-height-1-5">
<h6 class="u-bold">{$platform.name}</h6>
<p>{$platform.hostname || $platform.key}</p>
<p>{getPlatformIdentifier($platform)}</p>
</div>
</div>
</Box>
@@ -10,21 +10,20 @@
import { project } from '../../../store';
import { platform } from './store';
let key: string = null;
import type { Models } from '@appwrite.io/console';
let applicationId: string = null;
onMount(() => {
key ??= $platform.key;
applicationId ??= ($platform as Models.PlatformAndroid).applicationId;
});
async function updateHostname() {
async function updateApplicationId() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
await sdk.forProject($project.region, $project.$id).project.updateAndroidPlatform({
platformId: $platform.$id,
name: $platform.name,
key,
store: $platform.store || undefined,
hostname: $platform.hostname || undefined
applicationId
});
await invalidate(Dependencies.PLATFORM);
trackEvent(Submit.PlatformUpdate, {
@@ -44,21 +43,23 @@
}
</script>
<Form onSubmit={updateHostname}>
<Form onSubmit={updateApplicationId}>
<CardGrid>
<svelte:fragment slot="title">Package name</svelte:fragment>
Your package name is generally the applicationId in your app-level build.gradle file.
<svelte:fragment slot="aside">
<InputText
id="key"
id="applicationId"
label="Package name"
bind:value={key}
bind:value={applicationId}
required
placeholder="com.company.appname" />
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={key === $platform.hostname} submit>Update</Button>
<Button
disabled={applicationId === ($platform as Models.PlatformAndroid).applicationId}
submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -10,25 +10,24 @@
import { project } from '../../../store';
import { platform } from './store';
let key: string = null;
import type { Models } from '@appwrite.io/console';
let bundleIdentifier: string = null;
onMount(() => {
key ??= $platform.key;
bundleIdentifier ??= ($platform as Models.PlatformApple).bundleIdentifier;
});
async function updateHostname() {
async function updateBundleIdentifier() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
await sdk.forProject($project.region, $project.$id).project.updateApplePlatform({
platformId: $platform.$id,
name: $platform.name,
key,
store: $platform.store || undefined,
hostname: $platform.hostname || undefined
bundleIdentifier
});
await invalidate(Dependencies.PLATFORM);
trackEvent(Submit.PlatformUpdate, {
type: 'apple-ios'
type: 'apple'
});
addNotification({
type: 'success',
@@ -44,7 +43,7 @@
}
</script>
<Form onSubmit={updateHostname}>
<Form onSubmit={updateBundleIdentifier}>
<CardGrid>
<svelte:fragment slot="title">Bundle ID</svelte:fragment>
You can find your Bundle Identifier in the General tab for your app's primary target in Xcode.
@@ -52,13 +51,15 @@
<InputText
id="bundle-id"
label="Bundle ID"
bind:value={key}
bind:value={bundleIdentifier}
required
placeholder="com.company.appname" />
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={key === $platform.key} submit>Update</Button>
<Button
disabled={bundleIdentifier === ($platform as Models.PlatformApple).bundleIdentifier}
submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -1,64 +0,0 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { CardGrid } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form, InputText } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { project } from '../../../store';
import { platform } from './store';
let key: string = null;
onMount(() => {
key ??= $platform.key;
});
async function updateHostname() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
platformId: $platform.$id,
name: $platform.name,
key,
store: $platform.store || undefined,
hostname: $platform.hostname || undefined
});
await invalidate(Dependencies.PLATFORM);
trackEvent(Submit.PlatformUpdate, {
type: 'apple-macos'
});
addNotification({
type: 'success',
message: 'Platform Bundle ID has been updated'
});
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
trackError(error, Submit.PlatformUpdate);
}
}
</script>
<Form onSubmit={updateHostname}>
<CardGrid>
<svelte:fragment slot="title">Bundle ID</svelte:fragment>
You can find your Bundle Identifier in the General tab for your app's primary target in Xcode.
<svelte:fragment slot="aside">
<InputText
id="bundle-id"
label="Bundle ID"
bind:value={key}
required
placeholder="com.company.appname" />
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={key === $platform.key} submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -1,64 +0,0 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { CardGrid } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form, InputText } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { project } from '../../../store';
import { platform } from './store';
let key: string = null;
onMount(() => {
key ??= $platform.key;
});
async function updateHostname() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
platformId: $platform.$id,
name: $platform.name,
key,
store: $platform.store,
hostname: $platform.hostname
});
await invalidate(Dependencies.PLATFORM);
trackEvent(Submit.PlatformUpdate, {
type: 'apple-tvos'
});
addNotification({
type: 'success',
message: 'Platform Bundle ID has been updated'
});
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
trackError(error, Submit.PlatformUpdate);
}
}
</script>
<Form onSubmit={updateHostname}>
<CardGrid>
<svelte:fragment slot="title">Bundle ID</svelte:fragment>
You can find your Bundle Identifier in the General tab for your app's primary target in Xcode.
<svelte:fragment slot="aside">
<InputText
id="bundle-id"
label="Bundle ID"
bind:value={key}
required
placeholder="com.company.appname" />
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={key === $platform.key} submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -1,64 +0,0 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { CardGrid } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form, InputText } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { project } from '../../../store';
import { platform } from './store';
let key: string = null;
onMount(() => {
key ??= $platform.key;
});
async function updateHostname() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
platformId: $platform.$id,
name: $platform.name,
key,
store: $platform.store || undefined,
hostname: $platform.hostname || undefined
});
await invalidate(Dependencies.PLATFORM);
trackEvent(Submit.PlatformUpdate, {
type: 'apple-watchos'
});
addNotification({
type: 'success',
message: 'Platform Bundle ID has been updated'
});
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
trackError(error, Submit.PlatformUpdate);
}
}
</script>
<Form onSubmit={updateHostname}>
<CardGrid>
<svelte:fragment slot="title">Bundle ID</svelte:fragment>
You can find your Bundle Identifier in the General tab for your app's primary target in Xcode.
<svelte:fragment slot="aside">
<InputText
id="bundle-id"
label="Bundle ID"
bind:value={key}
required
placeholder="com.company.appname" />
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={key === $platform.key} submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -13,8 +13,7 @@
let error: string;
async function handleDelete() {
try {
await sdk.forConsole.projects.deletePlatform({
projectId: $project.$id,
await sdk.forProject($project.region, $project.$id).project.deletePlatform({
platformId: $platform.$id
});
await invalidate(Dependencies.PROJECT);
@@ -1,65 +0,0 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { CardGrid } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form, InputText } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { project } from '../../../store';
import { platform } from './store';
let key: string = null;
onMount(() => {
key ??= $platform.key;
});
const updateHostname = async () => {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
platformId: $platform.$id,
name: $platform.name,
key,
store: $platform.store || undefined,
hostname: $platform.hostname || undefined
});
await invalidate(Dependencies.PLATFORM);
trackEvent(Submit.PlatformUpdate, {
type: 'flutter-android'
});
addNotification({
type: 'success',
message: 'Platform Package Name has been updated'
});
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
trackError(error, Submit.PlatformUpdate);
}
};
</script>
<Form onSubmit={updateHostname}>
<CardGrid>
<svelte:fragment slot="title">Package name</svelte:fragment>
Your package name is generally the applicationId in your app-level build.gradle file.
<svelte:fragment slot="aside">
<InputText
id="package-name"
label="Package name"
bind:value={key}
required
placeholder="com.company.appname" />
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={key === $platform.key} submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -1,64 +0,0 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { CardGrid } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form, InputText } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { project } from '../../../store';
import { platform } from './store';
let key: string = null;
onMount(() => {
key ??= $platform.key;
});
async function updateHostname() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
platformId: $platform.$id,
name: $platform.name,
key,
store: $platform.store || undefined,
hostname: $platform.hostname || undefined
});
await invalidate(Dependencies.PLATFORM);
trackEvent(Submit.PlatformUpdate, {
type: 'flutter-ios'
});
addNotification({
type: 'success',
message: 'Platform Bundle ID has been updated'
});
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
trackError(error, Submit.PlatformUpdate);
}
}
</script>
<Form onSubmit={updateHostname}>
<CardGrid>
<svelte:fragment slot="title">Bundle ID</svelte:fragment>
You can find your Bundle Identifier in the General tab for your app's primary target in Xcode.
<svelte:fragment slot="aside">
<InputText
id="bundle-id"
label="Bundle ID"
bind:value={key}
required
placeholder="com.company.appname" />
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={key === $platform.key} submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -10,26 +10,25 @@
import { project } from '../../../store';
import { platform } from './store';
let key: string = null;
import type { Models } from '@appwrite.io/console';
let packageName: string = null;
onMount(() => {
key ??= $platform.key;
packageName ??= ($platform as Models.PlatformLinux).packageName;
});
async function updateHostname() {
async function updatePackageName() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
await sdk.forProject($project.region, $project.$id).project.updateLinuxPlatform({
platformId: $platform.$id,
name: $platform.name,
key,
store: $platform.store || undefined,
hostname: $platform.hostname || undefined
packageName
});
await invalidate(Dependencies.PLATFORM);
trackEvent(Submit.PlatformUpdate, {
type: 'flutter-linux'
type: 'linux'
});
addNotification({
type: 'success',
@@ -45,7 +44,7 @@
}
</script>
<Form onSubmit={updateHostname}>
<Form onSubmit={updatePackageName}>
<CardGrid>
<svelte:fragment slot="title">Package name</svelte:fragment>
Your application name.
@@ -53,13 +52,15 @@
<InputText
id="package-name"
label="Package Name"
bind:value={key}
bind:value={packageName}
required
placeholder="appname" />
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={key === $platform.key} submit>Update</Button>
<Button
disabled={packageName === ($platform as Models.PlatformLinux).packageName}
submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -1,65 +0,0 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { CardGrid } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form, InputText } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { project } from '../../../store';
import { platform } from './store';
let key: string = null;
onMount(() => {
key ??= $platform.key;
});
async function updateHostname() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
platformId: $platform.$id,
name: $platform.name,
key,
store: $platform.store || undefined,
hostname: $platform.hostname || undefined
});
await invalidate(Dependencies.PLATFORM);
trackEvent(Submit.PlatformUpdate, {
type: 'flutter-macos'
});
addNotification({
type: 'success',
message: 'Platform Bundle ID has been updated'
});
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
trackError(error, Submit.PlatformUpdate);
}
}
</script>
<Form onSubmit={updateHostname}>
<CardGrid>
<svelte:fragment slot="title">Bundle ID</svelte:fragment>
You can find your Bundle Identifier in the General tab for your app's primary target in Xcode.
<svelte:fragment slot="aside">
<InputText
id="bundle-id"
label="Bundle ID"
bind:value={key}
required
placeholder="com.company.appname" />
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={key === $platform.key} submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -10,26 +10,25 @@
import { project } from '../../../store';
import { platform } from './store';
let key: string = null;
import type { Models } from '@appwrite.io/console';
let packageIdentifierName: string = null;
onMount(() => {
key ??= $platform.key;
packageIdentifierName ??= ($platform as Models.PlatformWindows).packageIdentifierName;
});
async function updateHostname() {
async function updatePackageIdentifierName() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
await sdk.forProject($project.region, $project.$id).project.updateWindowsPlatform({
platformId: $platform.$id,
name: $platform.name,
key,
store: $platform.store || undefined,
hostname: $platform.hostname || undefined
packageIdentifierName
});
await invalidate(Dependencies.PLATFORM);
trackEvent(Submit.PlatformUpdate, {
type: 'flutter-windows'
type: 'windows'
});
addNotification({
type: 'success',
@@ -45,7 +44,7 @@
}
</script>
<Form onSubmit={updateHostname}>
<Form onSubmit={updatePackageIdentifierName}>
<CardGrid>
<svelte:fragment slot="title">Package name</svelte:fragment>
Your application name.
@@ -53,13 +52,16 @@
<InputText
id="package-name"
label="Package Name"
bind:value={key}
bind:value={packageIdentifierName}
required
placeholder="appname" />
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={key === $platform.key} submit>Update</Button>
<Button
disabled={packageIdentifierName ===
($platform as Models.PlatformWindows).packageIdentifierName}
submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -1,5 +1,5 @@
import { derived } from 'svelte/store';
import { page } from '$app/stores';
import type { Models } from '@appwrite.io/console';
import type { AnyPlatform } from '$lib/helpers/platform';
export const platform = derived(page, ($page) => $page.data.platform as Models.Platform);
export const platform = derived(page, ($page) => $page.data.platform as AnyPlatform);
@@ -9,21 +9,19 @@
import { project } from '../../../store';
import { platform } from './store';
import { extendedHostnameRegex } from '$lib/helpers/string';
import type { Models } from '@appwrite.io/console';
let hostname: string = null;
onMount(() => {
hostname ??= $platform.hostname;
hostname ??= ($platform as Models.PlatformWeb).hostname;
});
async function updateHostname() {
try {
await sdk.forConsole.projects.updatePlatform({
projectId: $project.$id,
await sdk.forProject($project.region, $project.$id).project.updateWebPlatform({
platformId: $platform.$id,
name: $platform.name,
key: $platform.key || undefined,
store: $platform.store || undefined,
hostname
});
await invalidate(Dependencies.PLATFORM);
@@ -56,7 +54,8 @@
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={hostname === $platform.hostname} submit>Update</Button>
<Button disabled={hostname === ($platform as Models.PlatformWeb).hostname} submit
>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -23,7 +23,7 @@
import { fade } from 'svelte/transition';
import ConnectionLine from './components/ConnectionLine.svelte';
import OnboardingPlatformCard from './components/OnboardingPlatformCard.svelte';
import { PlatformType } from '@appwrite.io/console';
import { ID } from '@appwrite.io/console';
import { project } from '../../store';
import { getCorrectTitle, type PlatformProps } from './store';
import LlmBanner from './llmBanner.svelte';
@@ -117,12 +117,13 @@ const val APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject(page.params.region, page.
async function createAndroidPlatform() {
try {
isCreatingPlatform = true;
await sdk.forConsole.projects.createPlatform({
projectId,
type: PlatformType.Android,
name: $createPlatform.name,
key: $createPlatform.key || undefined
});
await sdk
.forProject(page.params.region, page.params.project)
.project.createAndroidPlatform({
platformId: ID.unique(),
name: $createPlatform.name,
applicationId: $createPlatform.key
});
isPlatformCreated = true;
trackEvent(Submit.PlatformCreate, {
@@ -24,13 +24,13 @@
import { fade } from 'svelte/transition';
import ConnectionLine from './components/ConnectionLine.svelte';
import OnboardingPlatformCard from './components/OnboardingPlatformCard.svelte';
import { PlatformType } from '@appwrite.io/console';
import { ID } from '@appwrite.io/console';
import { app } from '$lib/stores/app';
import { project } from '../../store';
import { getCorrectTitle, type PlatformProps } from './store';
import LlmBanner from './llmBanner.svelte';
let { isConnectPlatform = false, platform = PlatformType.Appleios }: PlatformProps = $props();
let { isConnectPlatform = false, platform = 'apple-ios' }: PlatformProps = $props();
let showExitModal = $state(false);
let isCreatingPlatform = $state(false);
@@ -70,22 +70,23 @@ client.ping()
APPWRITE_PROJECT_NAME: "${$project.name}"
APPWRITE_PUBLIC_ENDPOINT: "${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}"`;
const platforms: { [key: string]: PlatformType } = {
iOS: PlatformType.Appleios,
macOS: PlatformType.Applemacos,
watchOS: PlatformType.Applewatchos,
tvOS: PlatformType.Appletvos
const platforms: { [key: string]: string } = {
iOS: 'apple-ios',
macOS: 'apple-macos',
watchOS: 'apple-watchos',
tvOS: 'apple-tvos'
};
async function createApplePlatform() {
try {
isCreatingPlatform = true;
await sdk.forConsole.projects.createPlatform({
projectId,
type: platform,
name: $createPlatform.name,
key: $createPlatform.key || undefined
});
await sdk
.forProject(page.params.region, page.params.project)
.project.createApplePlatform({
platformId: ID.unique(),
name: $createPlatform.name,
bundleIdentifier: $createPlatform.key
});
isPlatformCreated = true;
trackEvent(Submit.PlatformCreate, {
@@ -24,13 +24,12 @@
import { fade } from 'svelte/transition';
import ConnectionLine from './components/ConnectionLine.svelte';
import OnboardingPlatformCard from './components/OnboardingPlatformCard.svelte';
import { PlatformType } from '@appwrite.io/console';
import { ID } from '@appwrite.io/console';
import { project } from '../../store';
import { getCorrectTitle, type PlatformProps } from './store';
import LlmBanner from './llmBanner.svelte';
let { isConnectPlatform = false, platform = PlatformType.Flutterandroid }: PlatformProps =
$props();
let { isConnectPlatform = false, platform = 'flutter-android' }: PlatformProps = $props();
let showExitModal = $state(false);
let isCreatingPlatform = $state(false);
@@ -80,54 +79,52 @@ client.ping();
static const String appwritePublicEndpoint = '${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}';
}`;
let platforms: { [key: string]: PlatformType } = {
Android: PlatformType.Flutterandroid,
iOS: PlatformType.Flutterios,
Linux: PlatformType.Flutterlinux,
macOS: PlatformType.Fluttermacos,
Windows: PlatformType.Flutterwindows,
Web: PlatformType.Flutterweb
let platforms: { [key: string]: string } = {
Android: 'flutter-android',
iOS: 'flutter-ios',
Linux: 'flutter-linux',
macOS: 'flutter-macos',
Windows: 'flutter-windows',
Web: 'flutter-web'
};
const placeholder: Partial<
Record<
PlatformType,
{
name: string;
hostname: string;
tooltip: string;
}
>
const placeholder: Record<
string,
{
name: string;
hostname: string;
tooltip: string;
}
> = {
[PlatformType.Flutterandroid]: {
'flutter-android': {
name: 'My Android app',
hostname: 'com.company.appname',
tooltip:
'Your package name is generally the applicationId in your app-level build.gradle file.'
},
[PlatformType.Flutterios]: {
'flutter-ios': {
name: 'My iOS app',
hostname: 'com.company.appname',
tooltip:
"You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."
},
[PlatformType.Flutterlinux]: {
'flutter-linux': {
name: 'My Linux app',
hostname: 'appname',
tooltip: 'Your application name'
},
[PlatformType.Fluttermacos]: {
'flutter-macos': {
name: 'My mac OS app',
hostname: 'com.company.appname',
tooltip:
"You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."
},
[PlatformType.Flutterwindows]: {
'flutter-windows': {
name: 'My Windows app',
hostname: 'appname',
tooltip: 'Your application name'
},
[PlatformType.Flutterweb]: {
'flutter-web': {
name: 'My Web app',
hostname: 'localhost',
tooltip:
@@ -135,13 +132,13 @@ client.ping();
}
};
const hostname: Partial<Record<PlatformType, string>> = {
[PlatformType.Flutterandroid]: 'Package name',
[PlatformType.Flutterios]: 'Bundle ID',
[PlatformType.Flutterlinux]: 'Package name',
[PlatformType.Fluttermacos]: 'Bundle ID',
[PlatformType.Flutterweb]: 'Hostname',
[PlatformType.Flutterwindows]: 'Package name'
const hostnameLabel: Record<string, string> = {
'flutter-android': 'Package name',
'flutter-ios': 'Bundle ID',
'flutter-linux': 'Package name',
'flutter-macos': 'Bundle ID',
'flutter-web': 'Hostname',
'flutter-windows': 'Package name'
};
async function fetchFlutterSdkVersion() {
@@ -163,19 +160,48 @@ client.ping();
async function createFlutterPlatform() {
try {
isCreatingPlatform = true;
await sdk.forConsole.projects.createPlatform({
projectId,
type: platform,
name: $createPlatform.name,
key:
platform === PlatformType.Flutterweb
? undefined
: $createPlatform.key || undefined,
hostname:
platform === PlatformType.Flutterweb
? $createPlatform.hostname || undefined
: undefined
});
const projectSdk = sdk.forProject(page.params.region, page.params.project).project;
const platformId = ID.unique();
switch (platform) {
case 'flutter-android':
await projectSdk.createAndroidPlatform({
platformId,
name: $createPlatform.name,
applicationId: $createPlatform.key
});
break;
case 'flutter-ios':
case 'flutter-macos':
await projectSdk.createApplePlatform({
platformId,
name: $createPlatform.name,
bundleIdentifier: $createPlatform.key
});
break;
case 'flutter-linux':
await projectSdk.createLinuxPlatform({
platformId,
name: $createPlatform.name,
packageName: $createPlatform.key
});
break;
case 'flutter-windows':
await projectSdk.createWindowsPlatform({
platformId,
name: $createPlatform.name,
packageIdentifierName: $createPlatform.key
});
break;
case 'flutter-web':
await projectSdk.createWebPlatform({
platformId,
name: $createPlatform.name,
hostname: $createPlatform.hostname || undefined
});
break;
default:
throw new Error(`Unknown platform type: ${platform}`);
}
isPlatformCreated = true;
trackEvent(Submit.PlatformCreate, {
@@ -255,10 +281,10 @@ client.ping();
bind:value={$createPlatform.name} />
<!-- Tooltips on InputText don't work as of now -->
{#if platform === PlatformType.Flutterweb}
{#if platform === 'flutter-web'}
<InputText
id="hostname"
label={hostname[platform]}
label={hostnameLabel[platform]}
placeholder={placeholder[platform].hostname}
required
bind:value={$createPlatform.hostname}>
@@ -272,7 +298,7 @@ client.ping();
{:else}
<InputText
id="key"
label={hostname[platform]}
label={hostnameLabel[platform]}
placeholder={placeholder[platform].hostname}
required
bind:value={$createPlatform.key}>
@@ -24,13 +24,12 @@
import { fade } from 'svelte/transition';
import ConnectionLine from './components/ConnectionLine.svelte';
import OnboardingPlatformCard from './components/OnboardingPlatformCard.svelte';
import { PlatformType } from '@appwrite.io/console';
import { ID } from '@appwrite.io/console';
import { project } from '../../store';
import { getCorrectTitle, type PlatformProps } from './store';
import LlmBanner from './llmBanner.svelte';
let { isConnectPlatform = false, platform = PlatformType.Reactnativeandroid }: PlatformProps =
$props();
let { isConnectPlatform = false, platform = 'react-native-android' }: PlatformProps = $props();
let showExitModal = $state(false);
let isCreatingPlatform = $state(false);
@@ -74,28 +73,26 @@ EXPO_PUBLIC_APPWRITE_ENDPOINT=${sdk.forProject(page.params.region, page.params.p
.setEndpoint("${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}")
`;
let platforms: { [key: string]: PlatformType } = {
Android: PlatformType.Reactnativeandroid,
iOS: PlatformType.Reactnativeios
let platforms: { [key: string]: string } = {
Android: 'react-native-android',
iOS: 'react-native-ios'
};
const placeholder: Partial<
Record<
PlatformType,
{
name: string;
hostname: string;
tooltip: string;
}
>
const placeholder: Record<
string,
{
name: string;
hostname: string;
tooltip: string;
}
> = {
[PlatformType.Reactnativeandroid]: {
'react-native-android': {
name: 'My Android App',
hostname: 'com.company.appname',
tooltip:
'Your package name is generally the applicationId in your app-level build.gradle file.'
},
[PlatformType.Reactnativeios]: {
'react-native-ios': {
name: 'My iOS App',
hostname: 'com.company.appname',
tooltip:
@@ -103,20 +100,28 @@ EXPO_PUBLIC_APPWRITE_ENDPOINT=${sdk.forProject(page.params.region, page.params.p
}
};
const hostname: Partial<Record<PlatformType, string>> = {
[PlatformType.Reactnativeandroid]: 'Package name',
[PlatformType.Reactnativeios]: 'Bundle ID'
const hostnameLabel: Record<string, string> = {
'react-native-android': 'Package name',
'react-native-ios': 'Bundle ID'
};
async function createReactNativePlatform() {
try {
isCreatingPlatform = true;
await sdk.forConsole.projects.createPlatform({
projectId,
type: platform,
name: $createPlatform.name,
key: $createPlatform.key || undefined
});
const projectSdk = sdk.forProject(page.params.region, page.params.project).project;
if (platform === 'react-native-android') {
await projectSdk.createAndroidPlatform({
platformId: ID.unique(),
name: $createPlatform.name,
applicationId: $createPlatform.key
});
} else {
await projectSdk.createApplePlatform({
platformId: ID.unique(),
name: $createPlatform.name,
bundleIdentifier: $createPlatform.key
});
}
isPlatformCreated = true;
trackEvent(Submit.PlatformCreate, {
@@ -197,7 +202,7 @@ EXPO_PUBLIC_APPWRITE_ENDPOINT=${sdk.forProject(page.params.region, page.params.p
<!-- Tooltips on InputText don't work as of now -->
<InputText
id="hostname"
label={hostname[platform]}
label={hostnameLabel[platform]}
placeholder={placeholder[platform].hostname}
required
bind:value={$createPlatform.key}>
@@ -284,7 +289,7 @@ EXPO_PUBLIC_APPWRITE_ENDPOINT=${sdk.forProject(page.params.region, page.params.p
size="s"
code="npm install" /> followed by <InlineCode
size="s"
code={platform === PlatformType.Reactnativeios
code={platform === 'react-native-ios'
? 'npm run ios'
: 'npm run android'} />, then click the <InlineCode
size="s"
@@ -13,6 +13,7 @@
Card,
Tooltip
} from '@appwrite.io/pink-svelte';
import { ID } from '@appwrite.io/console';
import { Button, Form, InputText } from '$lib/elements/forms';
import {
IconVue,
@@ -34,7 +35,6 @@
import { fade } from 'svelte/transition';
import ConnectionLine from './components/ConnectionLine.svelte';
import OnboardingPlatformCard from './components/OnboardingPlatformCard.svelte';
import { PlatformType } from '@appwrite.io/console';
import {
ReactFrameworkIcon,
SvelteFrameworkIcon,
@@ -56,7 +56,7 @@
} from './store';
import LlmBanner from './llmBanner.svelte';
let { key, isConnectPlatform = false, platform = PlatformType.Web }: PlatformProps = $props();
let { key, isConnectPlatform = false, platform = 'web' }: PlatformProps = $props();
let showExitModal = $state(false);
let isCreatingPlatform = $state(false);
@@ -225,13 +225,13 @@ APPWRITE_ENDPOINT = "${sdk.forProject(page.params.region, page.params.project).c
try {
isCreatingPlatform = true;
await sdk.forConsole.projects.createPlatform({
projectId,
type: PlatformType.Web,
name: `${selectedFramework.label} app`,
key: key,
hostname: finalHostname
});
await sdk
.forProject(page.params.region, page.params.project)
.project.createWebPlatform({
platformId: ID.unique(),
name: `${selectedFramework.label} app`,
hostname: finalHostname
});
isPlatformCreated = true;
trackEvent(Submit.PlatformCreate, {
@@ -1,5 +1,4 @@
import type { ComponentType } from 'svelte';
import { PlatformType } from '@appwrite.io/console';
import { writable } from 'svelte/store';
import type { Column } from '$lib/helpers/types';
@@ -12,7 +11,7 @@ export const columns = writable<Column[]>([
export type PlatformProps = {
key?: string;
platform?: PlatformType;
platform?: string;
isConnectPlatform: boolean;
};
@@ -1,12 +1,17 @@
import { writable } from 'svelte/store';
import type { Models } from '@appwrite.io/console';
type PlatformFormData = {
name: string | null;
key: string | null;
hostname: string | null;
type: string | null;
};
function createPlatformStore() {
const { subscribe, update, set } = writable<Partial<Models.Platform>>({
$id: null,
const { subscribe, update, set } = writable<PlatformFormData>({
name: null,
key: null,
hostname: null,
store: null,
type: null
});
@@ -16,10 +21,9 @@ function createPlatformStore() {
set,
reset() {
set({
$id: null,
name: null,
key: null,
hostname: null,
store: null,
type: null
});
}
@@ -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({