mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge remote-tracking branch 'origin/feat-documentsdb' into feat-vectordb
This commit is contained in:
@@ -26,7 +26,8 @@ import {
|
||||
DocumentsDB,
|
||||
Realtime,
|
||||
Organizations,
|
||||
VectorsDB
|
||||
VectorsDB,
|
||||
Webhooks
|
||||
} from '@appwrite.io/console';
|
||||
import { Sources } from '$lib/sdk/sources';
|
||||
import {
|
||||
@@ -139,6 +140,7 @@ const sdkForProject = {
|
||||
tablesDB: new TablesDB(clientProject),
|
||||
documentsDB: new DocumentsDB(clientProject),
|
||||
vectorsDB: new VectorsDB(clientProject),
|
||||
webhooks: new Webhooks(clientProject),
|
||||
console: new Console(clientProject) // for suggestions API
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@ export const load: PageLoad = async ({ params, url, depends }) => {
|
||||
|
||||
return {
|
||||
page,
|
||||
webhooks: await sdk.forConsole.projects.listWebhooks({ projectId: params.project })
|
||||
webhooks: await sdk.forProject(params.region, params.project).webhooks.list()
|
||||
};
|
||||
};
|
||||
|
||||
+1
-2
@@ -10,8 +10,7 @@ export const load: LayoutLoad = async ({ params, depends }) => {
|
||||
return {
|
||||
header: Header,
|
||||
breadcrumbs: Breadcrumbs,
|
||||
webhook: await sdk.forConsole.projects.getWebhook({
|
||||
projectId: params.project,
|
||||
webhook: await sdk.forProject(params.region, params.project).webhooks.get({
|
||||
webhookId: params.webhook
|
||||
})
|
||||
};
|
||||
|
||||
+3
-3
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { page } from '$app/state';
|
||||
import { base } from '$app/paths';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import Confirm from '$lib/components/confirm.svelte';
|
||||
@@ -14,8 +15,7 @@
|
||||
let error: string;
|
||||
async function handleDelete() {
|
||||
try {
|
||||
await sdk.forConsole.projects.deleteWebhook({
|
||||
projectId: $project.$id,
|
||||
await sdk.forProject(page.params.region, $project.$id).webhooks.delete({
|
||||
webhookId: $webhook.$id
|
||||
});
|
||||
await invalidate(Dependencies.WEBHOOKS);
|
||||
@@ -25,7 +25,7 @@
|
||||
message: `${$webhook.name} has been deleted`
|
||||
});
|
||||
trackEvent(Submit.WebhookDelete);
|
||||
await goto(`${base}/project-${$project.region}-${$project.$id}/settings/webhooks`);
|
||||
await goto(`${base}/project-${page.params.region}-${$project.$id}/settings/webhooks`);
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.WebhookDelete);
|
||||
|
||||
+1
-2
@@ -25,8 +25,7 @@
|
||||
|
||||
async function setEnabled() {
|
||||
try {
|
||||
await sdk.forConsole.projects.updateWebhook({
|
||||
projectId,
|
||||
await sdk.forProject(page.params.region, projectId).webhooks.update({
|
||||
webhookId: $webhook.$id,
|
||||
name: $webhook.name,
|
||||
events: $webhook.events,
|
||||
|
||||
+1
-2
@@ -13,8 +13,7 @@
|
||||
|
||||
async function regenerate() {
|
||||
try {
|
||||
await sdk.forConsole.projects.updateWebhookSignature({
|
||||
projectId,
|
||||
await sdk.forProject(page.params.region, projectId).webhooks.updateSignature({
|
||||
webhookId: $webhook.$id
|
||||
});
|
||||
await invalidate(Dependencies.WEBHOOK);
|
||||
|
||||
+1
-2
@@ -26,8 +26,7 @@
|
||||
|
||||
async function updateEvents() {
|
||||
try {
|
||||
await sdk.forConsole.projects.updateWebhook({
|
||||
projectId,
|
||||
await sdk.forProject(page.params.region, projectId).webhooks.update({
|
||||
webhookId: $webhook.$id,
|
||||
name: $webhook.name,
|
||||
events: Array.from($eventSet),
|
||||
|
||||
+1
-2
@@ -19,8 +19,7 @@
|
||||
|
||||
async function updateName() {
|
||||
try {
|
||||
await sdk.forConsole.projects.updateWebhook({
|
||||
projectId,
|
||||
await sdk.forProject(page.params.region, projectId).webhooks.update({
|
||||
webhookId: $webhook.$id,
|
||||
name,
|
||||
events: $webhook.events,
|
||||
|
||||
+1
-2
@@ -24,8 +24,7 @@
|
||||
|
||||
async function updateSecurity() {
|
||||
try {
|
||||
await sdk.forConsole.projects.updateWebhook({
|
||||
projectId,
|
||||
await sdk.forProject(page.params.region, projectId).webhooks.update({
|
||||
webhookId: $webhook.$id,
|
||||
name: $webhook.name,
|
||||
events: $webhook.events,
|
||||
|
||||
+1
-2
@@ -19,8 +19,7 @@
|
||||
|
||||
async function updateUrl() {
|
||||
try {
|
||||
await sdk.forConsole.projects.updateWebhook({
|
||||
projectId,
|
||||
await sdk.forProject(page.params.region, projectId).webhooks.update({
|
||||
webhookId: $webhook.$id,
|
||||
name: $webhook.name,
|
||||
events: $webhook.events,
|
||||
|
||||
+13
-10
@@ -5,6 +5,7 @@
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
import Form from '$lib/elements/forms/form.svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { ID } from '@appwrite.io/console';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -25,16 +26,18 @@
|
||||
export let data;
|
||||
async function create() {
|
||||
try {
|
||||
const webhook = await sdk.forConsole.projects.createWebhook({
|
||||
projectId: data.project.$id,
|
||||
name,
|
||||
events,
|
||||
url,
|
||||
security,
|
||||
enabled: true,
|
||||
httpUser: httpUser || undefined,
|
||||
httpPass: httpPass || undefined
|
||||
});
|
||||
const webhook = await sdk
|
||||
.forProject(page.params.region, data.project.$id)
|
||||
.webhooks.create({
|
||||
webhookId: ID.unique(),
|
||||
name,
|
||||
events,
|
||||
url,
|
||||
security,
|
||||
enabled: true,
|
||||
httpUser: httpUser || undefined,
|
||||
httpPass: httpPass || undefined
|
||||
});
|
||||
addNotification({
|
||||
message: 'Webhook has been created',
|
||||
type: 'success'
|
||||
|
||||
Reference in New Issue
Block a user