From a6901fc5a290ffdb19a9c79c35399377f83ec717 Mon Sep 17 00:00:00 2001 From: Darshan Date: Sun, 16 Mar 2025 17:26:58 +0530 Subject: [PATCH 1/3] fix: org/team api usage. --- src/lib/commandCenter/searchers/organizations.ts | 6 +++++- src/routes/(console)/account/organizations/+page.ts | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/lib/commandCenter/searchers/organizations.ts b/src/lib/commandCenter/searchers/organizations.ts index 98302e96f..1d959e992 100644 --- a/src/lib/commandCenter/searchers/organizations.ts +++ b/src/lib/commandCenter/searchers/organizations.ts @@ -2,9 +2,13 @@ import { goto } from '$app/navigation'; import { base } from '$app/paths'; import { sdk } from '$lib/stores/sdk'; import type { Searcher } from '../commands'; +import { isCloud } from '$lib/system'; export const orgSearcher = (async (query: string) => { - const { teams } = await sdk.forConsole.teams.list(); + const { teams } = !isCloud + ? await sdk.forConsole.teams.list() + : await sdk.forConsole.billing.listOrganization(); + return teams .filter((organization) => organization.name.toLowerCase().includes(query.toLowerCase())) .map((organization) => { diff --git a/src/routes/(console)/account/organizations/+page.ts b/src/routes/(console)/account/organizations/+page.ts index cafa665eb..159e2a6e2 100644 --- a/src/routes/(console)/account/organizations/+page.ts +++ b/src/routes/(console)/account/organizations/+page.ts @@ -3,19 +3,22 @@ import { sdk } from '$lib/stores/sdk'; import { getLimit, getPage, pageToOffset } from '$lib/helpers/load'; import { CARD_LIMIT } from '$lib/constants'; import type { PageLoad } from './$types'; +import { isCloud } from '$lib/system'; export const load: PageLoad = async ({ url, route }) => { const page = getPage(url); const limit = getLimit('console', url, route, CARD_LIMIT); const offset = pageToOffset(page, limit); + const queries = [Query.offset(offset), Query.limit(limit), Query.orderDesc('')]; + + const organizations = !isCloud + ? await sdk.forConsole.teams.list(queries) + : await sdk.forConsole.billing.listOrganization(queries); + return { offset, limit, - organizations: await sdk.forConsole.teams.list([ - Query.offset(offset), - Query.limit(limit), - Query.orderDesc('') - ]) + organizations }; }; From 1b724792eb70609baf70ef0309e5776886e382d8 Mon Sep 17 00:00:00 2001 From: Darshan Date: Sat, 22 Mar 2025 14:08:58 +0530 Subject: [PATCH 2/3] fix: realtime endpoint issue. --- src/lib/stores/sdk.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/stores/sdk.ts b/src/lib/stores/sdk.ts index c90d48168..25972a299 100644 --- a/src/lib/stores/sdk.ts +++ b/src/lib/stores/sdk.ts @@ -94,6 +94,14 @@ export const realtime = { const endpoint = getApiEndpoint(region); if (endpoint !== clientRealtime.config.endpoint) { clientRealtime.setEndpoint(endpoint); + + /** + * Workaround: the SDK doesn't update the realtime in `setEndpoint`. + * Until that's fixed, we manually set the realtime endpoint like this: + */ + clientRealtime.setEndpointRealtime( + endpoint.replace('https://', 'wss://').replace('http://', 'ws://') + ); } return clientRealtime; } From 403ae5c6e6abc9255b9eda6238674c99221bef6d Mon Sep 17 00:00:00 2001 From: Darshan Date: Sat, 22 Mar 2025 14:09:25 +0530 Subject: [PATCH 3/3] fix: invalid calls. --- .../organization-[organization]/settings/BAAModal.svelte | 9 ++++----- .../settings/Soc2Modal.svelte | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/settings/BAAModal.svelte b/src/routes/(console)/organization-[organization]/settings/BAAModal.svelte index 0cf4ef245..9c189d7f9 100644 --- a/src/routes/(console)/organization-[organization]/settings/BAAModal.svelte +++ b/src/routes/(console)/organization-[organization]/settings/BAAModal.svelte @@ -1,5 +1,4 @@