mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Run Linter
This commit is contained in:
+115
-95
@@ -3,7 +3,7 @@ import { AppwriteException, Runtime, type Client, type Payload } from '@appwrite
|
||||
export type Specs = {
|
||||
cpus: number[];
|
||||
memory: number[];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Variable
|
||||
@@ -136,7 +136,7 @@ export type Function = {
|
||||
* Memory limit
|
||||
*/
|
||||
memory: number;
|
||||
}
|
||||
};
|
||||
|
||||
export class SpecsFunctions {
|
||||
client: Client;
|
||||
@@ -149,13 +149,9 @@ export class SpecsFunctions {
|
||||
const path = '/functions/specs';
|
||||
|
||||
const uri = new URL(this.client.config.endpoint + path);
|
||||
return await this.client.call(
|
||||
'GET',
|
||||
uri,
|
||||
{
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
);
|
||||
return await this.client.call('GET', uri, {
|
||||
'content-type': 'application/json'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,90 +179,114 @@ export class SpecsFunctions {
|
||||
* @param {number} memory
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
async update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, cpus?: number, memory?: number): Promise<Function> {
|
||||
if (typeof functionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "functionId"');
|
||||
}
|
||||
|
||||
if (typeof name === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "name"');
|
||||
}
|
||||
|
||||
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
||||
const payload: Payload = {};
|
||||
|
||||
if (typeof name !== 'undefined') {
|
||||
payload['name'] = name;
|
||||
}
|
||||
|
||||
if (typeof runtime !== 'undefined') {
|
||||
payload['runtime'] = runtime;
|
||||
}
|
||||
|
||||
if (typeof execute !== 'undefined') {
|
||||
payload['execute'] = execute;
|
||||
}
|
||||
|
||||
if (typeof events !== 'undefined') {
|
||||
payload['events'] = events;
|
||||
}
|
||||
|
||||
if (typeof schedule !== 'undefined') {
|
||||
payload['schedule'] = schedule;
|
||||
}
|
||||
|
||||
if (typeof timeout !== 'undefined') {
|
||||
payload['timeout'] = timeout;
|
||||
}
|
||||
|
||||
if (typeof enabled !== 'undefined') {
|
||||
payload['enabled'] = enabled;
|
||||
}
|
||||
|
||||
if (typeof logging !== 'undefined') {
|
||||
payload['logging'] = logging;
|
||||
}
|
||||
|
||||
if (typeof entrypoint !== 'undefined') {
|
||||
payload['entrypoint'] = entrypoint;
|
||||
}
|
||||
|
||||
if (typeof commands !== 'undefined') {
|
||||
payload['commands'] = commands;
|
||||
}
|
||||
|
||||
if (typeof installationId !== 'undefined') {
|
||||
payload['installationId'] = installationId;
|
||||
}
|
||||
|
||||
if (typeof providerRepositoryId !== 'undefined') {
|
||||
payload['providerRepositoryId'] = providerRepositoryId;
|
||||
}
|
||||
|
||||
if (typeof providerBranch !== 'undefined') {
|
||||
payload['providerBranch'] = providerBranch;
|
||||
}
|
||||
|
||||
if (typeof providerSilentMode !== 'undefined') {
|
||||
payload['providerSilentMode'] = providerSilentMode;
|
||||
}
|
||||
|
||||
if (typeof providerRootDirectory !== 'undefined') {
|
||||
payload['providerRootDirectory'] = providerRootDirectory;
|
||||
}
|
||||
|
||||
if (typeof cpus !== 'undefined') {
|
||||
payload['cpus'] = cpus;
|
||||
}
|
||||
|
||||
if (typeof memory !== 'undefined') {
|
||||
payload['memory'] = memory;
|
||||
}
|
||||
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
return await this.client.call('put', uri, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
*/
|
||||
async update(
|
||||
functionId: string,
|
||||
name: string,
|
||||
runtime?: Runtime,
|
||||
execute?: string[],
|
||||
events?: string[],
|
||||
schedule?: string,
|
||||
timeout?: number,
|
||||
enabled?: boolean,
|
||||
logging?: boolean,
|
||||
entrypoint?: string,
|
||||
commands?: string,
|
||||
installationId?: string,
|
||||
providerRepositoryId?: string,
|
||||
providerBranch?: string,
|
||||
providerSilentMode?: boolean,
|
||||
providerRootDirectory?: string,
|
||||
cpus?: number,
|
||||
memory?: number
|
||||
): Promise<Function> {
|
||||
if (typeof functionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "functionId"');
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof name === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "name"');
|
||||
}
|
||||
|
||||
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
||||
const payload: Payload = {};
|
||||
|
||||
if (typeof name !== 'undefined') {
|
||||
payload['name'] = name;
|
||||
}
|
||||
|
||||
if (typeof runtime !== 'undefined') {
|
||||
payload['runtime'] = runtime;
|
||||
}
|
||||
|
||||
if (typeof execute !== 'undefined') {
|
||||
payload['execute'] = execute;
|
||||
}
|
||||
|
||||
if (typeof events !== 'undefined') {
|
||||
payload['events'] = events;
|
||||
}
|
||||
|
||||
if (typeof schedule !== 'undefined') {
|
||||
payload['schedule'] = schedule;
|
||||
}
|
||||
|
||||
if (typeof timeout !== 'undefined') {
|
||||
payload['timeout'] = timeout;
|
||||
}
|
||||
|
||||
if (typeof enabled !== 'undefined') {
|
||||
payload['enabled'] = enabled;
|
||||
}
|
||||
|
||||
if (typeof logging !== 'undefined') {
|
||||
payload['logging'] = logging;
|
||||
}
|
||||
|
||||
if (typeof entrypoint !== 'undefined') {
|
||||
payload['entrypoint'] = entrypoint;
|
||||
}
|
||||
|
||||
if (typeof commands !== 'undefined') {
|
||||
payload['commands'] = commands;
|
||||
}
|
||||
|
||||
if (typeof installationId !== 'undefined') {
|
||||
payload['installationId'] = installationId;
|
||||
}
|
||||
|
||||
if (typeof providerRepositoryId !== 'undefined') {
|
||||
payload['providerRepositoryId'] = providerRepositoryId;
|
||||
}
|
||||
|
||||
if (typeof providerBranch !== 'undefined') {
|
||||
payload['providerBranch'] = providerBranch;
|
||||
}
|
||||
|
||||
if (typeof providerSilentMode !== 'undefined') {
|
||||
payload['providerSilentMode'] = providerSilentMode;
|
||||
}
|
||||
|
||||
if (typeof providerRootDirectory !== 'undefined') {
|
||||
payload['providerRootDirectory'] = providerRootDirectory;
|
||||
}
|
||||
|
||||
if (typeof cpus !== 'undefined') {
|
||||
payload['cpus'] = cpus;
|
||||
}
|
||||
|
||||
if (typeof memory !== 'undefined') {
|
||||
payload['memory'] = memory;
|
||||
}
|
||||
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
return await this.client.call(
|
||||
'put',
|
||||
uri,
|
||||
{
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
payload
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
options = runtimes.runtimes.map((runtime) => ({
|
||||
label: `${runtime.name} - ${runtime.version}`,
|
||||
value: runtime.$id
|
||||
}));
|
||||
}));
|
||||
|
||||
memoryOptions = allowedSpecs.memory.map((memory) =>
|
||||
memory > 1024
|
||||
|
||||
@@ -8,10 +8,7 @@ export const runtimesList = derived(
|
||||
async ($page) => (await $page.data.runtimesList) as Models.RuntimeList
|
||||
);
|
||||
|
||||
export const specs = derived(
|
||||
page,
|
||||
async ($page) => (await $page.data.specs) as Specs
|
||||
);
|
||||
export const specs = derived(page, async ($page) => (await $page.data.specs) as Specs);
|
||||
|
||||
export const baseRuntimesList = derived(runtimesList, async ($runtimesList) => {
|
||||
const baseRuntimes = new Map<string, Models.Runtime>();
|
||||
|
||||
Reference in New Issue
Block a user