Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat: remove legacy gql rpc (#1065)
teoe0f96a87dd12
diff --git a/.github/actions/setup-reqs-web/action.yml b/.github/actions/setup-reqs-web/action.ymlindex c46a01caa7..bf7a337b23 100644--- a/.github/actions/setup-reqs-web/action.yml+++ b/.github/actions/setup-reqs-web/action.yml@@ -26,11 +26,6 @@ runs:- name: Install justuses: extractions/setup-just@v2- - name: Build auth_service_rpc WASM- shell: bash- working-directory: rust/cloud-storage/rpc-interface/auth_service- run: just generate-- name: Setup bunfig.tomlworking-directory: js/appshell: bashdiff --git a/js/app/packages/app/component/EmailAuth.tsx b/js/app/packages/app/component/EmailAuth.tsxindex d9d5cc8ad9..3ee1a1f2c6 100644--- a/js/app/packages/app/component/EmailAuth.tsx+++ b/js/app/packages/app/component/EmailAuth.tsx@@ -4,7 +4,7 @@ import { LoadingBlock } from '@core/component/LoadingBlock';import { toast } from '@core/component/Toast/Toast';import { useEmailLinks } from '@core/email-link';import { whenSettled } from '@core/util/whenSettled';-import { updateUserInfo } from '@service-gql/client';+import { updateUserInfo } from '@queries/auth/user-info';import { useNavigate } from '@solidjs/router';import { onMount, Suspense } from 'solid-js';diff --git a/js/app/packages/app/component/FileDropZoneModal.tsx b/js/app/packages/app/component/FileDropZoneModal.tsxindex f065d50d17..0f63e04a7e 100644--- a/js/app/packages/app/component/FileDropZoneModal.tsx+++ b/js/app/packages/app/component/FileDropZoneModal.tsx@@ -6,7 +6,7 @@ import {} from '@core/constant/allBlocks';import { uploadFiles } from '@core/util/upload';import Dialog from '@corvu/dialog';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { Show } from 'solid-js';export const FILE_DROP_ZONE_DIALOG_CONTEXT_NAME = 'file-drop-zone-modal';diff --git a/js/app/packages/app/component/Onboarding.tsx b/js/app/packages/app/component/Onboarding.tsxindex 1907be4be9..6adab576bd 100644--- a/js/app/packages/app/component/Onboarding.tsx+++ b/js/app/packages/app/component/Onboarding.tsx@@ -6,7 +6,7 @@ import { ActionSequence } from '@core/component/FormControls/ActionSequence';import MacroLogo from '@core/component/MacroLogo';import { useEmailLinks, useEmailLinksStatus } from '@core/email-link';import { licenseChannel } from '@core/util/licenseUpdateBroadcastChannel';-import { updateUserInfo } from '@service-gql/client';+import { updateUserInfo } from '@queries/auth/user-info';import { stripeServiceClient } from '@service-stripe/client';import { useNavigate, useSearchParams } from '@solidjs/router';import { createEffect, onCleanup, Show } from 'solid-js';diff --git a/js/app/packages/app/component/Root.tsx b/js/app/packages/app/component/Root.tsxindex 266993681e..d04fd2d93c 100644--- a/js/app/packages/app/component/Root.tsx+++ b/js/app/packages/app/component/Root.tsx@@ -17,7 +17,6 @@ import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';import { createBlockOrchestrator } from '@core/orchestrator';import { formatTabTitle, tabTitleSignal } from '@core/signal/tabTitle';import { licenseChannel } from '@core/util/licenseUpdateBroadcastChannel';-import { isErr } from '@core/util/maybeResult';import { isTauri } from '@core/util/platform';import { transformShortIdInUrlPathname } from '@core/util/url';import { MaybeTauriProvider } from '@macro/tauri';@@ -31,7 +30,7 @@ import { maybeHandlePlatformNotification } from '@notifications/notification-plaimport { setUser, useObserveRouting } from '@observability';import { fetchAndCacheHistory } from '@queries/history/history';import { ws as connectionGatewayWebsocket } from '@service-connection/websocket';-import { gqlServiceClient } from '@service-gql/client';+import { invalidateUserInfo, prefetchUserInfo } from '@queries/auth/user-info';import { MetaProvider, Title } from '@solidjs/meta';import {HashRouter,@@ -46,6 +45,7 @@ import { useHotKeyRoot } from 'core/hotkey/hotkeys';import { detect } from 'detect-browser';import {createEffect,+ createResource,type JSX,lazy,onCleanup,@@ -114,34 +114,51 @@ const rootPreload: RoutePreloadFunc = async (args) => {window.history.replaceState(args.location.state, '', url);}track(TrackingEvents.AUTH.START);- // TODO: load general data like sidepanel, etc.- const userInfoResult = await gqlServiceClient.getUserInfo();- if (isErr(userInfoResult)) return;-- const [, { id, email, hasChromeExt, ...userInfo }] = userInfoResult;- const platform = detect(navigator.userAgent);- const os = `${platform?.os?.replaceAll(' ', '')}`;-- if (id) {- if (email) {- setUser({- ...userInfo,- id,- email,- hasChromeExt,- // ...utmObj,- });- }+ // User info fetch moved to UserInfoPreloader component (inside QueryClientProvider)+};++/**+ * Component that preloads user info and populates the TanStack Query cache.+ * Uses createResource with prefetchUserInfo so it works outside QueryClientProvider context.+ */+function UserInfoPreloader(props: ParentProps) {+ const [userInfoResource] = createResource(prefetchUserInfo);++ // Run side effects when user data is available+ createEffect(() => {+ const data = userInfoResource();+ if (!data) return;++ const { id, email, hasChromeExt, ...userInfo } = data;+ const platform = detect(navigator.userAgent);+ const os = `${platform?.os?.replaceAll(' ', '')}`;++ if (id) {+ if (email) {+ setUser({+ ...userInfo,+ id,+ email,+ hasChromeExt,+ });+ }++ if (PROD_MODE_ENV) {+ identify(id, { email, os, hasChromeExt });+ }- if (PROD_MODE_ENV) {- identify(id, { email, os, hasChromeExt });+ fetchAndCacheHistory().catch(() => {+ // Non-blocking - command menu will still work without prefetch+ });}+ });- fetchAndCacheHistory().catch(() => {- // Non-blocking - command menu will still work without prefetch- });- }-};+ return (+ <Show when={!userInfoResource.loading} fallback={null}>+ {props.children}+ </Show>+ );+}function BasePathComponent() {const [searchParams] = useSearchParams();@@ -343,7 +360,7 @@ export function Root() {createEffect(() => {const cleanup = licenseChannel.subscribe(() => {- gqlServiceClient.getUserInfo.invalidate();+ invalidateUserInfo();});onCleanup(() => cleanup());@@ -386,34 +403,36 @@ export function Root() {<MaybeTauriProvider><MetaProvider><EntityProvider>- <ConfiguredGlobalAppStateProvider>- <ChannelsContextProvider>- <Title>{tabTitle()}</Title>- <MacroJump />- <Visor />- <Show when={ENABLE_WHICHKEY_OVERLAY}>- <WhichKey />- </Show>- <SuspenseContextComp fallback={<RootSuspenseFallback />}>- <IsomorphicRouter- transformUrl={transformShortIdInUrlPathname}- root={Layout}- rootPreload={rootPreload}- base={routerBase}- >- {{- path: '/',- component: TauriRouteListener,- children: ROUTES,- }}- </IsomorphicRouter>- </SuspenseContextComp>- <ToastRegion />- <Show when={ENABLE_WEBSOCKET_DEBUGGER}>- <WebsocketDebugger />- </Show>- </ChannelsContextProvider>- </ConfiguredGlobalAppStateProvider>+ <UserInfoPreloader>+ <ConfiguredGlobalAppStateProvider>+ <ChannelsContextProvider>+ <Title>{tabTitle()}</Title>+ <MacroJump />+ <Visor />+ <Show when={ENABLE_WHICHKEY_OVERLAY}>+ <WhichKey />+ </Show>+ <SuspenseContextComp fallback={<RootSuspenseFallback />}>+ <IsomorphicRouter+ transformUrl={transformShortIdInUrlPathname}+ root={Layout}+ rootPreload={rootPreload}+ base={routerBase}+ >+ {{+ path: '/',+ component: TauriRouteListener,+ children: ROUTES,+ }}+ </IsomorphicRouter>+ </SuspenseContextComp>+ <ToastRegion />+ <Show when={ENABLE_WEBSOCKET_DEBUGGER}>+ <WebsocketDebugger />+ </Show>+ </ChannelsContextProvider>+ </ConfiguredGlobalAppStateProvider>+ </UserInfoPreloader></EntityProvider></MetaProvider></MaybeTauriProvider>diff --git a/js/app/packages/app/component/auth/Login.tsx b/js/app/packages/app/component/auth/Login.tsxindex fb932260b2..639b1e1849 100644--- a/js/app/packages/app/component/auth/Login.tsx+++ b/js/app/packages/app/component/auth/Login.tsx@@ -1,15 +1,11 @@-import {- updateUserAuth,- useAuthUserInfo,- useIsAuthenticated,-} from '@core/auth';+import { useIsAuthenticated } from '@core/auth';import { ENABLE_NAME_IN_LOGIN } from '@core/constant/featureFlags';import { setActiveModal } from '@core/signal/activeModal';import type { RedirectLocation } from '@core/util/authRedirect';import { unsetTokenPromise } from '@core/util/fetchWithToken';import { isOk } from '@core/util/maybeResult';import { authServiceClient } from '@service-auth/client';-import { gqlServiceClient, updateUserInfo } from '@service-gql/client';+import { invalidateUserInfo, prefetchUserInfo } from '@queries/auth/user-info';import { Navigate, useLocation, useSearchParams } from '@solidjs/router';import {createEffect,@@ -27,7 +23,6 @@ import ThreeWireframe from './ThreeWireframe';import { VerifyForm } from './VerifyForm';export function Login() {- const [, { refetch: refetchAuthUserInfo }] = useAuthUserInfo();const [stage, setStage] = createSignal(Stage.None);const location = useLocation<RedirectLocation>();const authenticated = useIsAuthenticated();@@ -52,12 +47,11 @@ export function Login() {console.log({ session_code });unsetTokenPromise();authServiceClient.getUserInfo.invalidate();- gqlServiceClient.getUserInfo.invalidate();+ invalidateUserInfo();authServiceClient.sessionLogin({ session_code }).then((res) => {console.log({ res });if (isOk(res)) {- updateUserAuth();- updateUserInfo();+ invalidateUserInfo();}});}@@ -70,11 +64,10 @@ export function Login() {);setActiveModal();unsetTokenPromise();- gqlServiceClient.getUserInfo.invalidate();+ invalidateUserInfo();authServiceClient.getUserInfo.invalidate();- const [err, userInfo] = (await refetchAuthUserInfo()) ?? [];+ const userInfo = await prefetchUserInfo();if (- !err &&userInfo?.authenticated &&location.state?.originalLocation &&location.state.originalLocation.pathname !== location.pathnamediff --git a/js/app/packages/app/component/auth/Shared.tsx b/js/app/packages/app/component/auth/Shared.tsxindex a9ac67a9be..ae3d10f4f4 100644--- a/js/app/packages/app/component/auth/Shared.tsx+++ b/js/app/packages/app/component/auth/Shared.tsx@@ -1,7 +1,8 @@import { withAnalytics } from '@coparse/analytics';import { useOrganization } from '@core/user';import { isErr } from '@core/util/maybeResult';-import { gqlServiceClient, updateUserInfo } from '@service-gql/client';+import { authServiceClient } from '@service-auth/client';+import { invalidateUserInfo } from '@queries/auth/user-info';import { detect } from 'detect-browser';import type { JSX } from 'solid-js';import { createSignal, onMount, Show } from 'solid-js';@@ -22,7 +23,8 @@ export const identifyUser = async () => {const [, { refetch: refetchOrganization }] = useOrganization();await refetchOrganization();- const userInfoResult = await updateUserInfo();+ await invalidateUserInfo();+ const userInfoResult = await authServiceClient.getLegacyUserPermissions();if (userInfoResult && isErr(userInfoResult)) return;const userInfo = userInfoResult ? userInfoResult[1] : null;@@ -42,7 +44,7 @@ export const identifyUser = async () => {export const assignABGroup = async () => {const randomGroup = Math.random() < 0.5 ? 'A' : 'B';- gqlServiceClient.setGroup({ group: randomGroup });+ await authServiceClient.setGroup({ group: randomGroup });return randomGroup;};diff --git a/js/app/packages/app/component/command/KonsoleItem.tsx b/js/app/packages/app/component/command/KonsoleItem.tsxindex 0ff8722595..f31319ba04 100644--- a/js/app/packages/app/component/command/KonsoleItem.tsx+++ b/js/app/packages/app/component/command/KonsoleItem.tsx@@ -26,7 +26,7 @@ import PushPin from '@phosphor-icons/core/regular/push-pin.svg?component-solid';import Terminal from '@phosphor-icons/core/regular/terminal.svg?component-solid';import type { Channel } from '@service-comms/generated/models/channel';import type { Attachment } from '@service-email/generated/schemas';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import type { BasicDocumentSubTypeProperty } from '@service-storage/generated/schemas';import type { BasicDocumentFileType } from '@service-storage/generated/schemas/basicDocumentFileType';import type { Item } from '@service-storage/generated/schemas/item';diff --git a/js/app/packages/app/component/dock/QuickAccess.tsx b/js/app/packages/app/component/dock/QuickAccess.tsxindex 5461a7087b..69b3692f7b 100644--- a/js/app/packages/app/component/dock/QuickAccess.tsx+++ b/js/app/packages/app/component/dock/QuickAccess.tsx@@ -14,7 +14,7 @@ import {type UnifiedNotification,} from '@notifications';import type { ApiChannelWithLatest as ChannelWithLatest } from '@service-comms/generated/models';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { NotificationEventType } from '@service-notification/generated/schemas';import { createMemo, createSignal, For, Show } from 'solid-js';diff --git a/js/app/packages/app/component/paywall/PaywallComponent.tsx b/js/app/packages/app/component/paywall/PaywallComponent.tsxindex 4768d2bd4d..94d55dc5ec 100644--- a/js/app/packages/app/component/paywall/PaywallComponent.tsx+++ b/js/app/packages/app/component/paywall/PaywallComponent.tsx@@ -3,7 +3,7 @@ import { type PaywallKey, PaywallMessages } from '@core/constant/PaywallState';import IconCheck from '@icon/regular/check-circle.svg';import IconX from '@icon/regular/x.svg';import Dot from '@phosphor-icons/core/regular/dot.svg?component-solid';-import { useUserInfo } from '@service-gql/client';+import { useHasTrialed } from '@queries/auth/user-info';import { stripeServiceClient } from '@service-stripe/client';import { createSignal, For, onMount, Show } from 'solid-js';@@ -30,7 +30,7 @@ interface PaywallComponent {}const PaywallComponent = (props: PaywallComponent) => {- const [userInfo] = useUserInfo();+ const hasTrialedQuery = useHasTrialed();const [hasTrialed, setHasTrialed] = createSignal(false);const [selectedPlan, setSelectedPlan] = createSignal<'guest' | 'member'>('member'@@ -38,7 +38,7 @@ const PaywallComponent = (props: PaywallComponent) => {const hasPaid = useHasPaidAccess();onMount(() => {- if (userInfo()[1]?.hasTrialed) {+ if (hasTrialedQuery()) {setHasTrialed(true);}});diff --git a/js/app/packages/app/component/settings/Account.tsx b/js/app/packages/app/component/settings/Account.tsxindex 6057bd0b34..6cd0c2a037 100644--- a/js/app/packages/app/component/settings/Account.tsx+++ b/js/app/packages/app/component/settings/Account.tsx@@ -26,7 +26,7 @@ import Logout from '@icon/regular/sign-out.svg';import { Popover } from '@kobalte/core';import IconUpload from '@macro-icons/macro-upload.svg';import { authServiceClient } from '@service-auth/client';-import { useEmail, useLicenseStatus, useUserId } from '@service-gql/client';+import { useEmail, useLicenseStatus, useUserId } from '@queries/auth/user-info';import { createMemo, createResource, createSignal, Show } from 'solid-js';import {useEmailLinks,diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsxindex ec0c50c1d5..8c6c788d2a 100644--- a/js/app/packages/app/component/settings/Settings.tsx+++ b/js/app/packages/app/component/settings/Settings.tsx@@ -3,7 +3,7 @@ import { type SettingsTab, useSettingsState } from '@core/constant/SettingsStateimport { SplitlikeContainer } from '../split-layout/components/SplitContainer';import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';import CloseIcon from '@phosphor-icons/core/regular/x.svg?component-solid';-import { MacroPermissions, usePermissions } from '@service-gql/client';+import { usePermissions } from '@queries/auth/user-info';import { DEV_MODE_ENV } from '@core/constant/featureFlags';import { DeprecatedIconButton } from '@core/component/DeprecatedIconButton';import ContractIcon from '@icon/regular/arrows-in.svg';@@ -120,7 +120,7 @@ export function SettingsPanel(props: SettingsPanelProps) {];if(!orgName() && !isNativeMobilePlatform()){tabs.push({value: 'Subscription', label: 'Subscription'})}- if(orgName() && permissions()?.includes(MacroPermissions.WriteItPanel)){tabs.push({value: 'Organization', label: 'Organization'})}+ if(orgName() && permissions()?.includes('WriteItPanel')){tabs.push({value: 'Organization', label: 'Organization'})}if(isNativeMobilePlatform() && DEV_MODE_ENV){tabs.push({ value: 'Mobile', label: 'Mobile Dev Tools' })}if(DEV_MODE_ENV){tabs.push({ value: 'Inbox', label: 'Inbox' })}@@ -260,7 +260,7 @@ export function SettingsPanel(props: SettingsPanelProps) {<Subscription /></Tabs.Content></Show>- <Show when={ orgName() && permissions()?.includes(MacroPermissions.WriteItPanel)}>+ <Show when={ orgName() && permissions()?.includes('WriteItPanel')}><Tabs.Content value="Organization" class="absolute inset-0"><Organization /></Tabs.Content>diff --git a/js/app/packages/block-channel/component/Block.tsx b/js/app/packages/block-channel/component/Block.tsxindex 51ac453aae..a29ed14c0e 100644--- a/js/app/packages/block-channel/component/Block.tsx+++ b/js/app/packages/block-channel/component/Block.tsx@@ -8,7 +8,7 @@ import { useChannelName } from '@core/context/channels';import { DocumentBlockContainer } from '@core/component/DocumentBlockContainer';import { useChannelQuery } from '@queries/channel/channel';import { commsServiceClient } from '@service-comms/client';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import {createSignal,type JSXElement,diff --git a/js/app/packages/block-channel/component/Message/MessageContainer.tsx b/js/app/packages/block-channel/component/Message/MessageContainer.tsxindex 24c0d8d728..61d854a605 100644--- a/js/app/packages/block-channel/component/Message/MessageContainer.tsx+++ b/js/app/packages/block-channel/component/Message/MessageContainer.tsx@@ -25,7 +25,7 @@ import { formatRelativeDate, isSameDay } from '@core/util/time';import { ContextMenu } from '@kobalte/core/context-menu';import { usePatchMessageMutation } from '@queries/channel/message';import type { Message as MessageType } from '@service-comms/generated/models/message';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { createCallback } from '@solid-primitives/rootless';import { activeElement } from 'app/signal/focus';import { registerHotkey, useHotkeyDOMScope } from 'core/hotkey/hotkeys';diff --git a/js/app/packages/block-channel/component/Message/MessageReactions.tsx b/js/app/packages/block-channel/component/Message/MessageReactions.tsxindex 2479c31728..1b3cab6bdf 100644--- a/js/app/packages/block-channel/component/Message/MessageReactions.tsx+++ b/js/app/packages/block-channel/component/Message/MessageReactions.tsx@@ -9,7 +9,7 @@ import { touchHandler } from '@core/directive/touchHandler';import { idToDisplayName } from '@core/user';import Tooltip from '@corvu/tooltip';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { createCallback } from '@solid-primitives/rootless';import { createMemo, createSignal, For, Show } from 'solid-js';import { ReactionSelector } from '../ReactionSelector';diff --git a/js/app/packages/block-channel/component/Message/actions.ts b/js/app/packages/block-channel/component/Message/actions.tsindex 3d316cfa54..fb5ac845e4 100644--- a/js/app/packages/block-channel/component/Message/actions.ts+++ b/js/app/packages/block-channel/component/Message/actions.ts@@ -7,7 +7,7 @@ import LinkIcon from '@phosphor-icons/core/regular/link.svg?component-solid';import Pencil from '@phosphor-icons/core/regular/pencil.svg?component-solid';import Trash from '@phosphor-icons/core/regular/trash.svg?component-solid';import { useDeleteMessageMutation } from '@queries/channel/message';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { toast } from 'core/component/Toast/Toast';import type { Accessor, Component } from 'solid-js';import { createMemo } from 'solid-js';diff --git a/js/app/packages/block-channel/component/MessageList/MessageList.tsx b/js/app/packages/block-channel/component/MessageList/MessageList.tsxindex 24e8c1e706..d68f700323 100644--- a/js/app/packages/block-channel/component/MessageList/MessageList.tsx+++ b/js/app/packages/block-channel/component/MessageList/MessageList.tsx@@ -27,7 +27,7 @@ import ArrowDownIcon from '@icon/regular/arrow-down.svg';import XIcon from '@icon/regular/x.svg';import type { Activity as ChannelActivity } from '@service-comms/generated/models/activity';import type { Message } from '@service-comms/generated/models/message';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { debounce } from '@solid-primitives/scheduled';import { activeElement } from 'app/signal/focus';import {diff --git a/js/app/packages/block-channel/component/ParticipantManager.tsx b/js/app/packages/block-channel/component/ParticipantManager.tsxindex 21df44d1e2..3f94fa7f1a 100644--- a/js/app/packages/block-channel/component/ParticipantManager.tsx+++ b/js/app/packages/block-channel/component/ParticipantManager.tsx@@ -23,7 +23,7 @@ import { Dialog } from '@kobalte/core/dialog';import BracketLeft from '@macro-icons/macro-group-bracket-left.svg';import type { ChannelParticipant } from '@service-comms/generated/models/channelParticipant';import { ChannelType } from '@service-comms/generated/models/channelType';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { createMemo, createSignal, Show } from 'solid-js';import { VList } from 'virtua/solid';import { beveledCorners } from '../../block-theme/signals/themeSignals';diff --git a/js/app/packages/block-channel/component/Top.tsx b/js/app/packages/block-channel/component/Top.tsxindex 07b7eb335c..8273d85959 100644--- a/js/app/packages/block-channel/component/Top.tsx+++ b/js/app/packages/block-channel/component/Top.tsx@@ -18,7 +18,7 @@ import LinkIcon from '@icon/regular/link.svg';import { useChannelQuery } from '@queries/channel/channel';import type { ChannelParticipant } from '@service-comms/generated/models/channelParticipant';import type { ChannelType } from '@service-comms/generated/models/channelType';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { Show } from 'solid-js';import { AttachmentsModal } from './AttachmentsModal';import { ParticipantManager } from './ParticipantManager';diff --git a/js/app/packages/block-channel/signal/attachment.ts b/js/app/packages/block-channel/signal/attachment.tsindex baf65af13b..1cc17a48b8 100644--- a/js/app/packages/block-channel/signal/attachment.ts+++ b/js/app/packages/block-channel/signal/attachment.ts@@ -2,7 +2,7 @@ import { createBlockSignal, createBlockStore } from '@core/block';import { isStaticAttachmentType } from '@core/store/cacheChannelInput';import type { Attachment } from '@service-comms/generated/models/attachment';import { createConnectionBlockWebsocketEffect } from '@service-connection/websocket';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { isItemType } from '@service-storage/client';import { channelStore } from './channel';diff --git a/js/app/packages/block-channel/signal/channel.ts b/js/app/packages/block-channel/signal/channel.tsindex 3b3e3d284a..b95b8b32c2 100644--- a/js/app/packages/block-channel/signal/channel.ts+++ b/js/app/packages/block-channel/signal/channel.ts@@ -19,7 +19,7 @@ import type { Message } from '@service-comms/generated/models/message';import type { ParticipantAccess } from '@service-comms/generated/models/participantAccess';import type { SimpleMention } from '@service-comms/generated/models/simpleMention';import { createConnectionBlockWebsocketEffect } from '@service-connection/websocket';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { blockNameToItemType } from '@service-storage/client';import { createCallback } from '@solid-primitives/rootless';import { toast } from 'core/component/Toast/Toast';diff --git a/js/app/packages/block-channel/signal/reactions.ts b/js/app/packages/block-channel/signal/reactions.tsindex b64470a900..de7f7b4482 100644--- a/js/app/packages/block-channel/signal/reactions.ts+++ b/js/app/packages/block-channel/signal/reactions.ts@@ -3,7 +3,7 @@ import { TrackingEvents } from '@coparse/analytics/src/types/TrackingEvents';import { createBlockStore } from '@core/block';import { commsServiceClient } from '@service-comms/client';import { createConnectionBlockWebsocketEffect } from '@service-connection/websocket';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { channelStore } from './channel';type CountedReaction = {diff --git a/js/app/packages/block-channel/signal/typing.ts b/js/app/packages/block-channel/signal/typing.tsindex 18f4521d09..07f38b7798 100644--- a/js/app/packages/block-channel/signal/typing.ts+++ b/js/app/packages/block-channel/signal/typing.ts@@ -1,7 +1,7 @@import { createBlockSignal } from '@core/block';import { commsServiceClient } from '@service-comms/client';import { createConnectionBlockWebsocketEffect } from '@service-connection/websocket';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { channelStore } from './channel';export const usersTypingSignal = createBlockSignal<diff --git a/js/app/packages/block-chat/component/NameMenu.tsx b/js/app/packages/block-chat/component/NameMenu.tsxindex 8d667998b8..b0c503a033 100644--- a/js/app/packages/block-chat/component/NameMenu.tsx+++ b/js/app/packages/block-chat/component/NameMenu.tsx@@ -25,7 +25,7 @@ import ShareFat from '@icon/regular/share-fat.svg';import TrashSimple from '@icon/regular/trash-simple.svg';import { DropdownMenu } from '@kobalte/core/dropdown-menu';import { cognitionApiServiceClient } from '@service-cognition/client';-import { useEmail } from '@service-gql/client';+import { useEmail } from '@queries/auth/user-info';import {refetchHistory,useUpdatedDssItemName,diff --git a/js/app/packages/block-email/component/BaseInput.tsx b/js/app/packages/block-email/component/BaseInput.tsxindex 581da84f93..8fccd92168 100644--- a/js/app/packages/block-email/component/BaseInput.tsx+++ b/js/app/packages/block-email/component/BaseInput.tsx@@ -47,7 +47,7 @@ import type {MessageToSendDbId,MessageWithBodyReplyless,} from '@service-email/generated/schemas';-import { useEmail, useUserId } from '@service-gql/client';+import { useEmail, useUserId } from '@queries/auth/user-info';import { Button } from '@ui/components/Button';import {defaultSelectionData,diff --git a/js/app/packages/block-email/component/CollapsedMessage.tsx b/js/app/packages/block-email/component/CollapsedMessage.tsxindex cbc9bded4e..1e2cf99c54 100644--- a/js/app/packages/block-email/component/CollapsedMessage.tsx+++ b/js/app/packages/block-email/component/CollapsedMessage.tsx@@ -1,7 +1,7 @@import { BozzyBracket } from '@core/component/BozzyBracket';import { UserIcon } from '@core/component/UserIcon';import type { MessageWithBodyReplyless } from '@service-email/generated/schemas';-import { useEmail, useUserId } from '@service-gql/client';+import { useEmail, useUserId } from '@queries/auth/user-info';import { createMemo, createSignal } from 'solid-js';import {getSenderDisplayName,diff --git a/js/app/packages/block-email/component/ComposeEmailInput.tsx b/js/app/packages/block-email/component/ComposeEmailInput.tsxindex 2f9c67bced..4c78614f1f 100644--- a/js/app/packages/block-email/component/ComposeEmailInput.tsx+++ b/js/app/packages/block-email/component/ComposeEmailInput.tsx@@ -14,7 +14,7 @@ import TextAa from '@icon/regular/text-aa.svg';import Spinner from '@phosphor-icons/core/bold/spinner-gap-bold.svg?component-solid';import ArrowFatLineUp from '@phosphor-icons/core/fill/arrow-fat-line-up-fill.svg?component-solid';import PaperclipIcon from '@phosphor-icons/core/regular/paperclip.svg?component-solid';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { defaultSelectionData } from 'core/component/LexicalMarkdown/plugins';import {NODE_TRANSFORM,diff --git a/js/app/packages/block-email/component/EmailMessageBody.tsx b/js/app/packages/block-email/component/EmailMessageBody.tsxindex 763f5fde7b..8a0bc06926 100644--- a/js/app/packages/block-email/component/EmailMessageBody.tsx+++ b/js/app/packages/block-email/component/EmailMessageBody.tsx@@ -10,7 +10,7 @@ import {} from '@core/email';import DotsThree from '@icon/regular/dots-three.svg';import type { MessageWithBodyReplyless } from '@service-email/generated/schemas';-import { useEmail } from '@service-gql/client';+import { useEmail } from '@queries/auth/user-info';import {type Accessor,createEffect,diff --git a/js/app/packages/block-email/component/EmailMessageTopBar.tsx b/js/app/packages/block-email/component/EmailMessageTopBar.tsxindex 4c85f3a9d9..a78903cb9e 100644--- a/js/app/packages/block-email/component/EmailMessageTopBar.tsx+++ b/js/app/packages/block-email/component/EmailMessageTopBar.tsx@@ -3,7 +3,7 @@ import { Tooltip } from '@core/component/Tooltip';import CaretDown from '@icon/regular/caret-down.svg';import X from '@icon/regular/x.svg';import type { MessageWithBodyReplyless } from '@service-email/generated/schemas';-import { useEmail } from '@service-gql/client';+import { useEmail } from '@queries/auth/user-info';import {type Accessor,createMemo,diff --git a/js/app/packages/block-email/component/MessageActions.tsx b/js/app/packages/block-email/component/MessageActions.tsxindex 0f62e6369b..458118a580 100644--- a/js/app/packages/block-email/component/MessageActions.tsx+++ b/js/app/packages/block-email/component/MessageActions.tsx@@ -2,7 +2,7 @@ import ArrowBendDoubleUpLeft from '@icon/regular/arrow-bend-double-up-left.svg';import ArrowBendUpLeft from '@icon/regular/arrow-bend-up-left.svg';import ArrowBendUpRight from '@icon/regular/arrow-bend-up-right.svg';import type { MessageWithBodyReplyless } from '@service-email/generated/schemas';-import { useEmail } from '@service-gql/client';+import { useEmail } from '@queries/auth/user-info';import { Button } from '@ui/components/Button';import { type Setter, Show } from 'solid-js';import { getEmailFormRegistry } from './EmailFormContext';diff --git a/js/app/packages/block-email/component/MessageContainer.tsx b/js/app/packages/block-email/component/MessageContainer.tsxindex 632577e01c..9497c8218c 100644--- a/js/app/packages/block-email/component/MessageContainer.tsx+++ b/js/app/packages/block-email/component/MessageContainer.tsx@@ -21,7 +21,7 @@ import type {Attachment,MessageWithBodyReplyless,} from '@service-email/generated/schemas';-import { useEmail, useUserId } from '@service-gql/client';+import { useEmail, useUserId } from '@queries/auth/user-info';import { storageServiceClient } from '@service-storage/client';import type { FileType } from '@service-storage/generated/schemas/fileType';import {diff --git a/js/app/packages/block-email/component/createEmailFormState.ts b/js/app/packages/block-email/component/createEmailFormState.tsindex 758fc4cc26..4cace3b16f 100644--- a/js/app/packages/block-email/component/createEmailFormState.ts+++ b/js/app/packages/block-email/component/createEmailFormState.ts@@ -1,4 +1,4 @@-import { useEmail } from '@service-gql/client';+import { useEmail } from '@queries/auth/user-info';import type { LexicalEditor } from 'lexical';import { createSignal, type Setter } from 'solid-js';import { createStore, reconcile, unwrap } from 'solid-js/store';diff --git a/js/app/packages/block-md/comments/CommentMargin.tsx b/js/app/packages/block-md/comments/CommentMargin.tsxindex 627e154a7e..3dc933f33f 100644--- a/js/app/packages/block-md/comments/CommentMargin.tsx+++ b/js/app/packages/block-md/comments/CommentMargin.tsx@@ -15,7 +15,7 @@ import {} from '@core/collab/comments/Thread';import { useCanComment, useIsDocumentOwner } from '@core/signal/permissions';import { autoUpdate, computePosition } from '@floating-ui/dom';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import {createEffect,createMemo,diff --git a/js/app/packages/block-md/comments/commentStore.ts b/js/app/packages/block-md/comments/commentStore.tsindex a96310154b..28a49661dd 100644--- a/js/app/packages/block-md/comments/commentStore.ts+++ b/js/app/packages/block-md/comments/commentStore.ts@@ -11,7 +11,7 @@ import {type Root,} from '@core/collab/comments/commentType';import { MARK_SELECTED_COMMENT_COMMAND } from '@core/component/LexicalMarkdown/plugins/comments/commentPlugin';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { makePersisted } from '@solid-primitives/storage';import type { NodeKey } from 'lexical';import { createSignal, untrack } from 'solid-js';diff --git a/js/app/packages/block-md/component/ComposeTask.tsx b/js/app/packages/block-md/component/ComposeTask.tsxindex 6b6b311cc7..8e5fc21572 100644--- a/js/app/packages/block-md/component/ComposeTask.tsx+++ b/js/app/packages/block-md/component/ComposeTask.tsx@@ -42,7 +42,7 @@ import {useQueryClient as useEntityQueryClient,} from '@macro-entity';import { useUpsertToHistoryMutation } from '@queries/history/history';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { propertiesServiceClient } from '@service-properties/client';import type { PropertyDefinition } from '@service-properties/generated/schemas/propertyDefinition';import { debounce } from '@solid-primitives/scheduled';diff --git a/js/app/packages/block-md/component/MarkdownCollabProvider.tsx b/js/app/packages/block-md/component/MarkdownCollabProvider.tsxindex 39c7f731ce..fb1c56c435 100644--- a/js/app/packages/block-md/component/MarkdownCollabProvider.tsx+++ b/js/app/packages/block-md/component/MarkdownCollabProvider.tsx@@ -44,7 +44,7 @@ import {SKIP_DOM_SELECTION_TAG,SKIP_SCROLL_INTO_VIEW_TAG,} from '@lexical-core';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import type { NodeKey, UpdateListenerPayload } from 'lexical';import {$addUpdateTag,diff --git a/js/app/packages/block-md/component/MarkdownEditor.tsx b/js/app/packages/block-md/component/MarkdownEditor.tsxindex fd719f8e92..0280a17fdf 100644--- a/js/app/packages/block-md/component/MarkdownEditor.tsx+++ b/js/app/packages/block-md/component/MarkdownEditor.tsx@@ -3,7 +3,7 @@ import { keyNavigationPlugin } from '@block-md/plugins/keyboardNavigation';import { markdownBlockErrorSignal } from '@block-md/signal/error';import { FindAndReplaceStore } from '@block-md/signal/findAndReplaceStore';import { revisionsSignal, rewriteSignal } from '@block-md/signal/rewriteSignal';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import {type BlockName,useBlockId,diff --git a/js/app/packages/block-md/component/MarkdownPopup.tsx b/js/app/packages/block-md/component/MarkdownPopup.tsxindex b25bc61f79..a156b3a55f 100644--- a/js/app/packages/block-md/component/MarkdownPopup.tsx+++ b/js/app/packages/block-md/component/MarkdownPopup.tsx@@ -42,7 +42,7 @@ import { debouncedDependent } from '@core/util/debounce';import { createFromMarkdownText } from '@core/util/md';import { getScrollParentElement } from '@core/util/scrollParent';import type { NodeIdMappings } from '@lexical-core';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import MacroGridLoader from '@macro-icons/macro-grid-noise-loader-4.svg';import CheckIcon from '@phosphor-icons/core/bold/check-bold.svg?component-solid';import ClipboardIcon from '@phosphor-icons/core/bold/clipboard-bold.svg?component-solid';diff --git a/js/app/packages/block-md/component/TemplateSelector.tsx b/js/app/packages/block-md/component/TemplateSelector.tsxindex 89acf58b6c..1845068fcc 100644--- a/js/app/packages/block-md/component/TemplateSelector.tsx+++ b/js/app/packages/block-md/component/TemplateSelector.tsx@@ -2,7 +2,7 @@ import { TEMPLATES, type Template } from '@block-md/component/templates';import { createBlockSignal } from '@core/block';import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';import { setEditorStateFromMarkdown } from '@core/component/LexicalMarkdown/utils';-import { useEmail } from '@service-gql/client';+import { useEmail } from '@queries/auth/user-info';import { createCallback } from '@solid-primitives/rootless';import { debounce } from '@solid-primitives/scheduled';import type { LexicalEditor } from 'lexical';diff --git a/js/app/packages/block-pdf/signal/permissions.ts b/js/app/packages/block-pdf/signal/permissions.tsindex 256f11de21..9f3aeb0ee8 100644--- a/js/app/packages/block-pdf/signal/permissions.ts+++ b/js/app/packages/block-pdf/signal/permissions.ts@@ -3,7 +3,7 @@ import { commentPlaceables } from '@block-pdf/store/comments/freeComments';import { highlightsUuidMap } from '@block-pdf/store/highlight';import { createBlockMemo } from '@core/block';import { useCanEdit } from '@core/signal/permissions';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { createSelector } from 'solid-js';export const useCanEditModificationData = useCanEdit;diff --git a/js/app/packages/block-pdf/signal/save.ts b/js/app/packages/block-pdf/signal/save.tsindex d060b8536e..f2142a5388 100644--- a/js/app/packages/block-pdf/signal/save.ts+++ b/js/app/packages/block-pdf/signal/save.ts@@ -1,7 +1,7 @@import type { IModificationDataOnServer } from '@block-pdf/type/coParse';import { createBlockSignal, useBlockId } from '@core/block';import { ENABLE_PDF_MODIFICATION_DATA_AUTOSAVE } from '@core/constant/featureFlags';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { storageServiceClient } from '@service-storage/client';import { refetchHistory } from '@service-storage/history';import { createMemo } from 'solid-js';diff --git a/js/app/packages/block-pdf/store/comments/freeComments.ts b/js/app/packages/block-pdf/store/comments/freeComments.tsindex 2cb622cb75..d4a2b13ad6 100644--- a/js/app/packages/block-pdf/store/comments/freeComments.ts+++ b/js/app/packages/block-pdf/store/comments/freeComments.ts@@ -14,7 +14,7 @@ import type {} from '@block-pdf/type/comments';import type { IPlaceable, IThreadPlaceable } from '@block-pdf/type/placeables';import { createBlockMemo } from '@core/block';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import {anchorsResource,commentThreadsResource,diff --git a/js/app/packages/block-pdf/store/comments/highlightComments.ts b/js/app/packages/block-pdf/store/comments/highlightComments.tsindex 9bef2162a5..76fbcff116 100644--- a/js/app/packages/block-pdf/store/comments/highlightComments.ts+++ b/js/app/packages/block-pdf/store/comments/highlightComments.ts@@ -14,7 +14,7 @@ import type {} from '@block-pdf/type/comments';import { getHighlightsFromSelection } from '@block-pdf/util/pdfjsUtils';import { createBlockMemo, createBlockSignal } from '@core/block';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { createCallback } from '@solid-primitives/rootless';import { batch } from 'solid-js';import { produce } from 'solid-js/store';diff --git a/js/app/packages/block-pdf/store/commentsResource.ts b/js/app/packages/block-pdf/store/commentsResource.tsindex e556e81925..ba399aa7c5 100644--- a/js/app/packages/block-pdf/store/commentsResource.ts+++ b/js/app/packages/block-pdf/store/commentsResource.ts@@ -8,7 +8,7 @@ import {} from '@core/block';import { isErr } from '@core/util/maybeResult';import { createConnectionBlockWebsocketEffect } from '@service-connection/websocket';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { storageServiceClient } from '@service-storage/client';import type { AnnotationIncrementalUpdate } from '@service-storage/generated/schemas/annotationIncrementalUpdate';import type { Comment } from '@service-storage/generated/schemas/comment';diff --git a/js/app/packages/block-pdf/store/placeables.ts b/js/app/packages/block-pdf/store/placeables.tsindex 1c606ffc7b..d4d9dd1316 100644--- a/js/app/packages/block-pdf/store/placeables.ts+++ b/js/app/packages/block-pdf/store/placeables.ts@@ -38,7 +38,7 @@ import {createBlockMemo,createBlockSignal,} from '@core/block';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { createCallback } from '@solid-primitives/rootless';import type { PageViewport } from 'pdfjs-dist';import { batch } from 'solid-js';diff --git a/js/app/packages/core/auth/license.ts b/js/app/packages/core/auth/license.tsindex e1b2b8e018..9323d516db 100644--- a/js/app/packages/core/auth/license.ts+++ b/js/app/packages/core/auth/license.ts@@ -1,20 +1,15 @@import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';import { useOrganizationId } from '@core/user';-import { useUserInfo } from '@service-gql/client';+import { useLicenseStatus } from '@queries/auth/user-info';import { createMemo } from 'solid-js';export function useHasPaidAccess() {- const [userInfo] = useUserInfo();+ const licenseStatus = useLicenseStatus();const organizationId = useOrganizationId();return createMemo((): boolean => {if (isNativeMobilePlatform()) return true;- const [erru, info] = userInfo();- if (erru) return false;- return (- !!organizationId() ||- info.licenseStatus === 'trialing' ||- info.licenseStatus === 'active'- );+ const status = licenseStatus();+ return !!organizationId() || status === 'trialing' || status === 'active';});}diff --git a/js/app/packages/core/auth/logout.ts b/js/app/packages/core/auth/logout.tsindex 6b82fc5c8f..e4885f58dd 100644--- a/js/app/packages/core/auth/logout.ts+++ b/js/app/packages/core/auth/logout.ts@@ -1,54 +1,41 @@import { withAnalytics } from '@coparse/analytics';-import { useAuthUserInfo } from '@core/auth';import { useOrganization } from '@core/user';import { authServiceClient } from '@service-auth/client';-import { useUserInfo } from '@service-gql/client';+import { invalidateUserInfo, authKeys } from '@queries/auth/user-info';+import { queryClient } from '@queries/client';import { createCallback } from '@solid-primitives/rootless';const { track, TrackingEvents } = withAnalytics();export function useLogout() {- const [, { mutate: mutateAuthUserInfo }] = useAuthUserInfo();- const [, { mutate: mutateUserInfo }] = useUserInfo();const [, { mutate: mutateOrganization }] = useOrganization();return createCallback(async (redirectUrl?: string) => {document.cookie ='login=false; expires=Thu, 01 Jan 1970 00:00:00 UTC; max-age=0; path=/; SameSite=Lax';- // Reset authenticated user permissions- mutateAuthUserInfo(() => [- null,- {- userId: undefined,- authenticated: false,- permissions: [],- organizationId: undefined,- },- ]);- // GQL reset- mutateUserInfo(() => [- null,- {- id: '',- permissions: [],- email: '',- name: null,- licenseStatus: 'inactive',- tutorialComplete: false,- group: null,- hasChromeExt: false,- authenticated: false,- userId: '',- hasTrialed: false,- },- ]);+ // Reset user info query cache to unauthenticated state+ queryClient.setQueryData(authKeys.userInfo.queryKey, {+ id: '',+ permissions: [],+ email: '',+ name: null,+ licenseStatus: 'inactive',+ tutorialComplete: false,+ group: null,+ hasChromeExt: false,+ authenticated: false,+ userId: '',+ hasTrialed: false,+ });+mutateOrganization(() => ({organizationId: undefined,organizationName: undefined,}));await authServiceClient.logout();+ invalidateUserInfo();track(TrackingEvents.AUTH.LOGOUT);if (redirectUrl) window.location.href = redirectUrl;diff --git a/js/app/packages/core/auth/persist.ts b/js/app/packages/core/auth/persist.tsindex 17c2458c72..bb34a35cd2 100644--- a/js/app/packages/core/auth/persist.ts+++ b/js/app/packages/core/auth/persist.ts@@ -4,10 +4,17 @@ import { createSignal } from 'solid-js';import { AuthState, type AuthUserInfo, type MaybeAuthUserInfo } from './types';const defaultUserInfo: AuthUserInfo = {- userId: undefined,+ id: '',+ userId: '',authenticated: false,permissions: [],- organizationId: undefined,+ email: '',+ name: null,+ licenseStatus: '',+ tutorialComplete: false,+ group: null,+ hasChromeExt: false,+ hasTrialed: false,};export const persistedUserInfo = makePersisted(diff --git a/js/app/packages/core/auth/types.ts b/js/app/packages/core/auth/types.tsindex fb38eddc12..6b24dbaf0e 100644--- a/js/app/packages/core/auth/types.ts+++ b/js/app/packages/core/auth/types.ts@@ -2,7 +2,7 @@ import type { ResultType } from '@core/util/maybeResult';import type { authServiceClient } from '@service-auth/client';export type MaybeAuthUserInfo = Awaited<- ReturnType<typeof authServiceClient.getUserInfo>+ ReturnType<typeof authServiceClient.getLegacyUserPermissions>>;export type AuthUserInfo = ResultType<MaybeAuthUserInfo>;diff --git a/js/app/packages/core/auth/useAuth.ts b/js/app/packages/core/auth/useAuth.tsindex 3bc968407a..1e62b4af5d 100644--- a/js/app/packages/core/auth/useAuth.ts+++ b/js/app/packages/core/auth/useAuth.ts@@ -17,7 +17,7 @@ function matchChange(}export const useAuthUserInfo = createSingletonRoot(() =>- createResource(authServiceClient.getUserInfo, {+ createResource(authServiceClient.getLegacyUserPermissions, {initialValue: persistedUserInfo[0](),storage: () => persistedUserInfo as any,})@@ -32,10 +32,11 @@ export function useIsAuthenticated() {}export function useIsOrganizationMember() {- const [u] = useAuthUserInfo();+ // Import dynamically to avoid circular dependency+ const { useOrganizationId } = require('@core/user');+ const organizationId = useOrganizationId();return createMemo((): boolean | undefined => {- const [errs, user] = u.latest;- return !errs && user.organizationId !== undefined;+ return organizationId() !== undefined;});}diff --git a/js/app/packages/core/collab/comments/Comment.tsx b/js/app/packages/core/collab/comments/Comment.tsxindex 9caa4bf163..d29e590fea 100644--- a/js/app/packages/core/collab/comments/Comment.tsx+++ b/js/app/packages/core/collab/comments/Comment.tsx@@ -1,5 +1,5 @@import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';-import { useAuthor } from '@service-gql/client';+import { useAuthor } from '@queries/auth/user-info';import {createEffect,createMemo,diff --git a/js/app/packages/core/component/AI/constant/fileType.ts b/js/app/packages/core/component/AI/constant/fileType.tsindex 557b810593..89a93f8336 100644--- a/js/app/packages/core/component/AI/constant/fileType.ts+++ b/js/app/packages/core/component/AI/constant/fileType.ts@@ -1,309 +1,38 @@import type { BlockAlias, BlockName } from '@core/block';import type { FileType } from '@service-cognition/generated/schemas/fileType';+// Code file extensions from the Rust FileType enumconst codeFileExtensions: (keyof typeof FileType)[] = [- 'ascx',- 'asp',- 'aspx',- 'atom',- 'axaml',- 'axml',- 'babelrc',- 'bash',- 'bashaliases',- 'bashlogin',- 'bashlogout',- 'bashprofile',- 'bashrc',- 'bbx',- 'bib',- 'bowerrc',- 'bpmn',- 'c',- 'cpp',- 'cppm',- 'cake',- 'cbx',- 'cc',- 'ccm',- 'cff',- 'cfg',- 'cginc',- 'cjs',- 'cls',- 'codesnippets',- 'coffee',- 'compute',- 'conf',- 'containerfile',- 'cpp',- 'cppm',- 'cpt',- 'cpy',- 'cs',- 'csh',- 'cshrc',- 'cshtml',- 'csl',- 'cson',- 'csproj',- 'csprojuser',- 'css',- 'cssmap',- 'csv',- 'csx',- 'ctp',- 'cts',- 'ctx',- 'cu',- 'cuh',- 'cxx',- 'cxxm',- 'dart',- 'diff',- 'directory',- 'dita',- 'ditamap',- 'dockerfile',- 'dsql',- 'dtd',- 'dtml',- 'ebuild',- 'eclass',- 'editorconfig',- 'ejs',- 'ent',- 'erb',- 'es6',- 'eslintrc',- 'eslintrcjson',- 'eyaml',- 'eyml',- 'fish',- 'fsproj',- 'fx',- 'fxh',- 'fxml',- 'gemspec',- 'geojson',- 'gitattributes',- 'gitconfig',- 'gitmodules',- 'go',- 'gyp',- 'gypi',- 'h',- 'hpp',- 'hin',- 'handlebars',- 'har',- 'hbs',- 'hh',- 'hintrc',- 'hjs',- 'hlsl',- 'hlsli',- 'hpp',- 'hppin',- 'htm',- 'html',- 'hxx',- 'i',- 'iced',- 'ii',- 'iml',- 'ini',- 'inl',- 'ino',- 'ipp',- 'ipy',- 'ipynb',- 'isml',- 'ixx',- 'jav',- 'java',- 'jl',- 'jmd',- 'jmx',- 'js',- 'jsmap',- 'jscsrc',- 'jsfmtrc',- 'jshintrc',- 'jshtm',- 'jslintrc',- 'json',- 'jsonc',- 'jsonl',- 'jsonld',- 'jsp',- 'jsx',- 'ksh',- 'launch',- 'less',- 'log',- 'ltx',- 'lua',- 'm',- 'mak',- 'markdn',- 'markdown',- 'mdoc',- 'mdown',- 'mdtext',- 'mdtxt',- 'mdwn',- 'menu',- 'mjs',- 'mk',- 'mkd',- 'mm',- 'mod',- 'mts',- 'mxml',- 'ndjson',- 'nqp',- 'nuspec',- 'opml',- 'owl',- 'p6',- 'pac',- 'patch',- 'php',- 'php4',- 'php5',- 'phtml',- 'pl',- 'pl6',- 'pm',- 'pm6',- 'pod',- 'podspec',- 'profile',- 'proj',- 'properties',- 'props',- 'ps1',- 'psd1',- 'psgi',- 'psh',- 'psm1',- 'psrc',- 'pssc',- 'pt',- 'publishsettings',- 'pubxml',- 'pubxmluser','py',- 'pyi',- 'pyt',- 'pyw',- 'r',- 'rake',- 'raku',- 'rakudoc',- 'rakumod',- 'rakutest',- 'razor',- 'rb',- 'rbi',- 'rbx',- 'rbxlx',- 'rbxmx',- 'rdf',- 'rej',- 'repo',- 'rhistory',- 'rhtml',- 'rjs',- 'rng',- 'rprofile',- 'rpy',- 'rs',- 'rss',- 'rt',- 'ru',- 'scss',- 'sh',- 'shader',- 'shproj',- 'shtml',- 'sql',- 'storyboard',- 'sty',- 'swcrc',- 'swift',- 't',- 'targets',- 'tcshrc',- 'tex',- 'tld',- 'tmx',- 'tpp',+ 'js','ts',- 'tsmap',- 'tsbuildinfo',- 'tsv',+ 'jsx','tsx',- 'txt',- 'txx',- 'vbproj',- 'vbprojuser',- 'vcxproj',- 'vcxprojfilters',- 'volt',- 'vsh',- 'vuerc',- 'webmanifest',- 'winget',- 'workbook',- 'wsdl',- 'wxi',- 'wxl',- 'wxs',- 'xaml',- 'xbl',- 'xht',- 'xhtml',- 'xib',- 'xlf',- 'xliff',+ 'json',+ 'html',+ 'css','xml',- 'xoml',- 'xpdl',- 'xprofile',- 'xsd',- 'xsession',- 'xsessionrc',- 'xsl',- 'xslt',- 'xul','yaml',- 'yamltmlanguage',- 'yamltmpreferences',- 'yamltmtheme',- 'yashprofile',- 'yashrc','yml',- 'zlogin',- 'zlogout',- 'zprofile',- 'zsh',- 'zshtheme',- 'zshenv',- 'zshrc',+ 'sql',+ 'sh',+ 'bash',+ 'markdown',+ 'txt',+ 'csv',] as const;// these will be converted to a supported format before uploadconst CONVERSION_SUPPORTED_IMAGE_EXTENSIONS = ['heic', 'heif'] as const;-// openai supported extensions+// Image extensions from the Rust FileType enumexport const SUPPORTED_IMAGE_ATTACHMENT_EXTENSIONS = ['jpg','jpeg',- 'webp','png','gif',+ 'svg',+ 'webp',...CONVERSION_SUPPORTED_IMAGE_EXTENSIONS,];diff --git a/js/app/packages/core/component/AccessErrorViews/Unauthorized.tsx b/js/app/packages/core/component/AccessErrorViews/Unauthorized.tsxindex a1ea4d8b65..3b6e4a4f15 100644--- a/js/app/packages/core/component/AccessErrorViews/Unauthorized.tsx+++ b/js/app/packages/core/component/AccessErrorViews/Unauthorized.tsx@@ -1,6 +1,6 @@import { useIsAuthenticated } from '@core/auth';import Lock from '@phosphor-icons/core/regular/lock.svg?component-solid';-import { useEmail } from '@service-gql/client';+import { useEmail } from '@queries/auth/user-info';import { onMount } from 'solid-js';import { openLoginModal } from '../TopBar/LoginButton';diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DiffInsert.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DiffInsert.tsxindex 7c216357d7..5584cb4f46 100644--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DiffInsert.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DiffInsert.tsx@@ -1,6 +1,6 @@import type { DiffInsertDecoratorProps } from '@lexical-core';import { $isDiffNode } from '@lexical-core';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { $getNodeByKey } from 'lexical';import { createMemo, Show, useContext } from 'solid-js';import { LexicalWrapperContext } from '../../context/LexicalWrapperContext';diff --git a/js/app/packages/core/component/LexicalMarkdown/component/dom-factory/diff-factory.tsx b/js/app/packages/core/component/LexicalMarkdown/component/dom-factory/diff-factory.tsxindex e5bfe0ed10..772f3c8694 100644--- a/js/app/packages/core/component/LexicalMarkdown/component/dom-factory/diff-factory.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/component/dom-factory/diff-factory.tsx@@ -1,7 +1,7 @@import CheckIcon from '@icon/regular/check.svg';import XIcon from '@icon/regular/x.svg';import { DiffNode, setDOMFactory } from '@lexical-core';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { render } from 'solid-js/web';export function registerDiffNodeFactory() {diff --git a/js/app/packages/core/component/LexicalMarkdown/plugins/diff/diffPlugin.ts b/js/app/packages/core/component/LexicalMarkdown/plugins/diff/diffPlugin.tsindex eff4aa2af6..d8cde02c03 100644--- a/js/app/packages/core/component/LexicalMarkdown/plugins/diff/diffPlugin.ts+++ b/js/app/packages/core/component/LexicalMarkdown/plugins/diff/diffPlugin.ts@@ -10,7 +10,7 @@ import {$isDiffNode,} from '@lexical-core';import type { NamedTool } from '@service-cognition/generated/tools/tool';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import type { LexicalEditor } from 'lexical';import {COMMAND_PRIORITY_CRITICAL,diff --git a/js/app/packages/core/component/LiveIndicators.tsx b/js/app/packages/core/component/LiveIndicators.tsxindex 9d12975958..4ccbd87eee 100644--- a/js/app/packages/core/component/LiveIndicators.tsx+++ b/js/app/packages/core/component/LiveIndicators.tsx@@ -1,5 +1,5 @@import { ENABLE_LIVE_INDICATORS } from '@core/constant/featureFlags';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { createMemo, For, Show } from 'solid-js';import { useUserIndicators } from '../state/liveIndicators';import { Tooltip } from './Tooltip';diff --git a/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx b/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsxindex 1f5fe2876f..6741478be1 100644--- a/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx+++ b/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx@@ -4,7 +4,7 @@ import { MODAL_VIEWPORT_CLASSES } from '@core/util/modalUtils';import LoadingSpinner from '@icon/regular/spinner.svg';import XIcon from '@icon/regular/x.svg';import { useCreatePropertyDefinitionMutation } from '@queries/properties/definitions';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import type { EntityType } from '@service-properties/generated/schemas/entityType';import type { PropertyDataType } from '@service-properties/generated/schemas/propertyDataType';import {diff --git a/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx b/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsxindex a7d135ab0b..96422605b7 100644--- a/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx+++ b/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx@@ -19,7 +19,7 @@ import {createUnifiedSearchInfiniteQuery,type EmailEntity,} from '@macro-entity';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import type { EntityType } from '@service-properties/generated/schemas/entityType';import { useHistory } from '@service-storage/history';import { debounce } from '@solid-primitives/scheduled';diff --git a/js/app/packages/core/component/RecipientSelector.tsx b/js/app/packages/core/component/RecipientSelector.tsxindex 49ebe0f6c2..83412dfcaf 100644--- a/js/app/packages/core/component/RecipientSelector.tsx+++ b/js/app/packages/core/component/RecipientSelector.tsx@@ -25,7 +25,7 @@ import {useComboboxContext,} from '@kobalte/core/combobox';import type { Channel } from '@service-comms/generated/models/channel';-import { useEmail, useUserId } from '@service-gql/client';+import { useEmail, useUserId } from '@queries/auth/user-info';import { debounce } from '@solid-primitives/scheduled';import * as EmailValidator from 'email-validator';import {diff --git a/js/app/packages/core/component/TopBar/ShareButton.tsx b/js/app/packages/core/component/TopBar/ShareButton.tsxindex 527c983f61..36c7d95ad4 100644--- a/js/app/packages/core/component/TopBar/ShareButton.tsx+++ b/js/app/packages/core/component/TopBar/ShareButton.tsx@@ -37,7 +37,7 @@ import { Dialog } from '@kobalte/core/dialog';import { DropdownMenu } from '@kobalte/core/dropdown-menu';import { cognitionApiServiceClient } from '@service-cognition/client';import { commsServiceClient } from '@service-comms/client';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import {blockNameToItemType,type ItemType,diff --git a/js/app/packages/core/component/UserTooltip.tsx b/js/app/packages/core/component/UserTooltip.tsxindex 93c9f6b2bd..73b1a59036 100644--- a/js/app/packages/core/component/UserTooltip.tsx+++ b/js/app/packages/core/component/UserTooltip.tsx@@ -8,7 +8,7 @@ import WideCopy from '@macro-icons/wide/copy.svg';import WideChat from '@macro-icons/wide/chat.svg';import Trash from '@phosphor-icons/core/regular/trash.svg?component-solid';import { commsServiceClient } from '@service-comms/client';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { Button } from '@ui/components/Button';import { Match, Show, Switch } from 'solid-js';import { ProfilePicture } from './ProfilePicture';diff --git a/js/app/packages/core/constant/ABTest.tsx b/js/app/packages/core/constant/ABTest.tsxindex 262d848fc8..c56ef92cb5 100644--- a/js/app/packages/core/constant/ABTest.tsx+++ b/js/app/packages/core/constant/ABTest.tsx@@ -1,45 +1,40 @@import { withAnalytics } from '@coparse/analytics';import { useIsAuthenticated } from '@core/auth';-import { isErr } from '@core/util/maybeResult';+import { authServiceClient } from '@service-auth/client';import {- gqlServiceClient,- updateUserInfo,- useUserInfo,-} from '@service-gql/client';+ invalidateUserInfo,+ useGroup,+ useUserId,+} from '@queries/auth/user-info';import { createSingletonRoot } from '@solid-primitives/rootless';import { type Component, createEffect, createSignal, Show } from 'solid-js';const { identify } = withAnalytics();const useABTestInternal = () => {const [ABGroup, setABGroup] = createSignal<'A' | 'B' | undefined>(undefined);- const [userInfo] = useUserInfo();+ const userGroup = useGroup();+ const userId = useUserId();const authenticated = useIsAuthenticated();const setGroup = async (group: 'A' | 'B') => {setABGroup(group);- await gqlServiceClient.setGroup({ group });- gqlServiceClient.getUserInfo.invalidate();- const userInfoResult = await updateUserInfo();- if (!userInfoResult || isErr(userInfoResult)) return;- const userInfo = userInfoResult[1];- if (userInfo.id) {- identify(userInfo.id, {+ await authServiceClient.setGroup({ group });+ await invalidateUserInfo();+ const id = userId();+ if (id) {+ identify(id, {group,});}};createEffect(() => {- if (- !authenticated() ||- (userInfo() && isErr(userInfo())) ||- ABGroup() !== undefined- ) {+ if (!authenticated() || ABGroup() !== undefined) {return;}- const userInfoResult = userInfo()[1];- if (userInfoResult?.group) {- setABGroup(userInfoResult?.group);+ const existingGroup = userGroup();+ if (existingGroup) {+ setABGroup(existingGroup);} else {const randomGroup = Math.random() < 0.5 ? 'A' : 'B';setGroup(randomGroup);diff --git a/js/app/packages/core/email-link/index.ts b/js/app/packages/core/email-link/index.tsindex 3c4c0016d3..2a5450112f 100644--- a/js/app/packages/core/email-link/index.ts+++ b/js/app/packages/core/email-link/index.ts@@ -8,7 +8,7 @@ import { isErr } from '@core/util/maybeResult';import { invalidateEmailLinks, useEmailLinksQuery } from '@queries/email/link';import { emailClient } from '@service-email/client';import type { ListLinksResponse } from '@service-email/generated/schemas';-import { updateUserInfo } from '@service-gql/client';+import { invalidateUserInfo } from '@queries/auth/user-info';import type { UseQueryResult } from '@tanstack/solid-query';import { err, okAsync, ResultAsync } from 'neverthrow';import { createMemo, createSignal } from 'solid-js';@@ -128,7 +128,7 @@ export function useEmailLinks() {const invalidations = async () => {invalidateEmailLinks();await updateUserAuth();- await updateUserInfo();+ await invalidateUserInfo();};const query = useEmailLinksQuery();diff --git a/js/app/packages/core/user/organization.ts b/js/app/packages/core/user/organization.tsindex 176c9d49cd..82ef93d8da 100644--- a/js/app/packages/core/user/organization.ts+++ b/js/app/packages/core/user/organization.ts@@ -5,7 +5,7 @@ import {idToDisplayName,} from '@core/user';import { isErr } from '@core/util/maybeResult';-import { gqlServiceClient } from '@service-gql/client';+import { authServiceClient } from '@service-auth/client';import { organizationServiceClient } from '@service-organization/client';import { createSingletonRoot } from '@solid-primitives/rootless';import { makePersisted } from '@solid-primitives/storage';@@ -79,18 +79,27 @@ export const useOrganization = createSingletonRoot(() => {return createResource<{organizationId?: string | undefined;organizationName?: string | undefined;- }>(gqlServiceClient.getOrganization, {- initialValue: {- organizationId: undefined,- organizationName: undefined,+ }>(+ async () => {+ const result = await authServiceClient.getOrganization();+ if (result[0] === null) {+ return result[1];+ }+ return { organizationId: undefined, organizationName: undefined };},- storage: (init) => {- const [get, set] = makePersisted(createSignal(init), {- name: 'organization',- });- return [get, set];- },- });+ {+ initialValue: {+ organizationId: undefined,+ organizationName: undefined,+ },+ storage: (init) => {+ const [get, set] = makePersisted(createSignal(init), {+ name: 'organization',+ });+ return [get, set];+ },+ }+ );});export function useOrganizationName() {diff --git a/js/app/packages/core/util/sort.ts b/js/app/packages/core/util/sort.tsindex 852b5391e5..a21d26a9d2 100644--- a/js/app/packages/core/util/sort.ts+++ b/js/app/packages/core/util/sort.ts@@ -1,4 +1,4 @@-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import type { Item } from '@service-storage/generated/schemas/item';export type SortType =diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsxindex 8cf63aa5cf..ebf0b047db 100644--- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx+++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx@@ -7,7 +7,7 @@ import { isTouchDevice } from '@core/mobile/isTouchDevice';import { matches } from '@core/util/match';import CheckIcon from '@icon/regular/check.svg';import { tryToTypedNotification } from '@notifications';-import { useEmail, useUserId } from '@service-gql/client';+import { useEmail, useUserId } from '@queries/auth/user-info';import { syncServiceClient } from '@service-sync/client';import { mergeRefs } from '@solid-primitives/refs';import { createDraggable } from '@thisbeyond/solid-dnd';diff --git a/js/app/packages/queries/auth/index.ts b/js/app/packages/queries/auth/index.tsnew file mode 100644index 0000000000..4c155863fd--- /dev/null+++ b/js/app/packages/queries/auth/index.ts@@ -0,0 +1,27 @@+export { authKeys } from './keys';+export {+ useUserInfoQuery,+ invalidateUserInfo,+ updateUserInfo,+ useUserId,+ useEmail,+ usePermissions,+ useAuthor,+ useLicenseStatus,+ useTutorialCompleted,+ useGroup,+ useHasChromeExt,+ useHasTrialed,+ useUserInfo,+} from './user-info';+export {+ useOrganizationQuery,+ invalidateOrganization,+ useIsInOrganization,+ useOrganizationId,+ useOrganizationName,+} from './organization';+export {+ useCompleteOnboardingMutation,+ useSetGroupMutation,+} from './mutations';diff --git a/js/app/packages/queries/auth/keys.ts b/js/app/packages/queries/auth/keys.tsnew file mode 100644index 0000000000..8e6e262358--- /dev/null+++ b/js/app/packages/queries/auth/keys.ts@@ -0,0 +1,6 @@+import { createQueryKeys } from '@lukemorales/query-key-factory';++export const authKeys = createQueryKeys('auth', {+ userInfo: null,+ organization: null,+});diff --git a/js/app/packages/queries/auth/mutations.ts b/js/app/packages/queries/auth/mutations.tsnew file mode 100644index 0000000000..4e1f43d1c0--- /dev/null+++ b/js/app/packages/queries/auth/mutations.ts@@ -0,0 +1,57 @@+import { throwOnErr } from '@core/util/maybeResult';+import { authServiceClient } from '@service-auth/client';+import type { PatchUserOnboardingRequest } from '@service-auth/generated/schemas/patchUserOnboardingRequest';+import { useMutation } from '@tanstack/solid-query';+import { type MutationCallbacks, withCallbacks } from '../utils';+import { queryClient } from '../client';+import { authKeys } from './keys';++type CompleteOnboardingCallbacks = MutationCallbacks<+ void,+ Error,+ PatchUserOnboardingRequest+>;++/** Mutation for completing user onboarding. */+export function useCompleteOnboardingMutation(+ callbacks?: CompleteOnboardingCallbacks+) {+ return useMutation(() => ({+ mutationFn: async (args: PatchUserOnboardingRequest) => {+ await throwOnErr(+ async () => await authServiceClient.completeOnboarding(args)+ );+ },+ ...withCallbacks<void, Error, PatchUserOnboardingRequest>(+ {+ onSuccess: () => {+ queryClient.invalidateQueries({+ queryKey: authKeys.userInfo.queryKey,+ });+ },+ },+ callbacks+ ),+ }));+}++type SetGroupCallbacks = MutationCallbacks<void, Error, { group: string }>;++/** Mutation for setting the user's group (for A/B testing). */+export function useSetGroupMutation(callbacks?: SetGroupCallbacks) {+ return useMutation(() => ({+ mutationFn: async (args: { group: string }) => {+ await throwOnErr(async () => await authServiceClient.setGroup(args));+ },+ ...withCallbacks<void, Error, { group: string }>(+ {+ onSuccess: () => {+ queryClient.invalidateQueries({+ queryKey: authKeys.userInfo.queryKey,+ });+ },+ },+ callbacks+ ),+ }));+}diff --git a/js/app/packages/queries/auth/organization.ts b/js/app/packages/queries/auth/organization.tsnew file mode 100644index 0000000000..8486f90f8e--- /dev/null+++ b/js/app/packages/queries/auth/organization.ts@@ -0,0 +1,46 @@+import { throwOnErr } from '@core/util/maybeResult';+import { authServiceClient } from '@service-auth/client';+import { useQuery } from '@tanstack/solid-query';+import { createMemo } from 'solid-js';+import { queryClient } from '../client';+import { authKeys } from './keys';++const ORGANIZATION_STALE_TIME = 15_000; // 15 seconds, consistent with user info++function organizationQueryOptions() {+ return {+ queryKey: authKeys.organization.queryKey,+ queryFn: async () => throwOnErr(authServiceClient.getOrganization),+ staleTime: ORGANIZATION_STALE_TIME,+ };+}++/** Query for the current user's organization. */+export function useOrganizationQuery() {+ return useQuery(() => organizationQueryOptions());+}++/** Invalidate the organization query to trigger a refetch. */+export function invalidateOrganization() {+ return queryClient.invalidateQueries({+ queryKey: authKeys.organization.queryKey,+ });+}++/** Returns whether the current user is in an organization. */+export function useIsInOrganization() {+ const query = useOrganizationQuery();+ return createMemo(() => !!query.data?.organizationId);+}++/** Returns the current user's organization ID. */+export function useOrganizationId() {+ const query = useOrganizationQuery();+ return createMemo(() => query.data?.organizationId);+}++/** Returns the current user's organization name. */+export function useOrganizationName() {+ const query = useOrganizationQuery();+ return createMemo(() => query.data?.organizationName);+}diff --git a/js/app/packages/queries/auth/user-info.ts b/js/app/packages/queries/auth/user-info.tsnew file mode 100644index 0000000000..1b7b516925--- /dev/null+++ b/js/app/packages/queries/auth/user-info.ts@@ -0,0 +1,137 @@+import { useAuthUserInfo } from '@core/auth';+import { throwOnErr } from '@core/util/maybeResult';+import { authServiceClient } from '@service-auth/client';+import { useQuery } from '@tanstack/solid-query';+import { createMemo } from 'solid-js';+import { queryClient } from '../client';+import { authKeys } from './keys';++export { authKeys } from './keys';++const USER_INFO_STALE_TIME = 15_000; // 15 seconds (matches previous cache)++type UserInfoData = Awaited<+ ReturnType<typeof authServiceClient.getLegacyUserPermissions>+>[1];++function userInfoQueryOptions() {+ return {+ queryKey: authKeys.userInfo.queryKey,+ queryFn: async () => throwOnErr(authServiceClient.getLegacyUserPermissions),+ staleTime: USER_INFO_STALE_TIME,+ };+}++/** Query for the current user's info and permissions. Use this when you need TanStack Query features. */+export function useUserInfoQuery() {+ return useQuery(() => userInfoQueryOptions());+}++/** Invalidate the user info query to trigger a refetch. */+export function invalidateUserInfo() {+ return queryClient.invalidateQueries({+ queryKey: authKeys.userInfo.queryKey,+ });+}++/** Prefetch user info and populate the query cache. Can be used outside QueryClientProvider. */+export async function prefetchUserInfo() {+ return queryClient.fetchQuery(userInfoQueryOptions());+}++/**+ * @deprecated Use invalidateUserInfo() instead+ */+export const updateUserInfo = invalidateUserInfo;++// Derived state hooks - these use the singleton resource (works outside QueryClientProvider)++/** Returns the current user's ID. */+export function useUserId() {+ const [resource] = useAuthUserInfo();+ return createMemo(() => {+ const [, data] = resource.latest;+ return data?.id;+ });+}++/** Returns the current user's email. */+export function useEmail() {+ const [resource] = useAuthUserInfo();+ return createMemo(() => {+ const [, data] = resource.latest;+ return data?.email;+ });+}++/** Returns the current user's permissions. */+export function usePermissions() {+ const [resource] = useAuthUserInfo();+ return createMemo(() => {+ const [, data] = resource.latest;+ return data?.permissions ?? [];+ });+}++/** Returns the current user's display name for authoring. */+export function useAuthor() {+ const [resource] = useAuthUserInfo();+ return createMemo(() => {+ const [, data] = resource.latest;+ return data?.name || data?.email || 'Macro User';+ });+}++/** Returns the current user's license status. */+export function useLicenseStatus() {+ const [resource] = useAuthUserInfo();+ return createMemo(() => {+ const [, data] = resource.latest;+ return data?.licenseStatus;+ });+}++/** Returns whether the user has completed the tutorial. */+export function useTutorialCompleted() {+ const [resource] = useAuthUserInfo();+ return createMemo(() => {+ const [, data] = resource.latest;+ return data?.tutorialComplete;+ });+}++/** Returns the user's group for A/B testing. */+export function useGroup() {+ const [resource] = useAuthUserInfo();+ return createMemo(() => {+ const [, data] = resource.latest;+ return data?.group;+ });+}++/** Returns whether the user has the Chrome extension. */+export function useHasChromeExt() {+ const [resource] = useAuthUserInfo();+ return createMemo(() => {+ const [, data] = resource.latest;+ return data?.hasChromeExt;+ });+}++/** Returns whether the user has trialed. */+export function useHasTrialed() {+ const [resource] = useAuthUserInfo();+ return createMemo(() => {+ const [, data] = resource.latest;+ return data?.hasTrialed;+ });+}++/** Returns the full user info data. */+export function useUserInfo() {+ const [resource] = useAuthUserInfo();+ return createMemo((): UserInfoData | undefined => {+ const [, data] = resource.latest;+ return data;+ });+}diff --git a/js/app/packages/service-clients/service-auth/client.ts b/js/app/packages/service-clients/service-auth/client.tsindex 9ad447de8f..8f941581c7 100644--- a/js/app/packages/service-clients/service-auth/client.ts+++ b/js/app/packages/service-clients/service-auth/client.ts@@ -6,6 +6,7 @@ import {isOk,mapOk,type ObjectLike,+ ok,resultError,} from '@core/util/maybeResult';import { registerClient } from '@core/util/mockClient';@@ -18,10 +19,13 @@ import type { PatchUserTutorialRequest, UserQuota } from './generated/schemas';import type { AppleLoginRequest } from './generated/schemas/appleLoginRequest';import type { EmptyResponse } from './generated/schemas/emptyResponse';import type { GenericSuccessResponse } from './generated/schemas/genericSuccessResponse';+import type { GetLegacyUserPermissionsResponse } from './generated/schemas/getLegacyUserPermissionsResponse';import type { GetProfilePicturesRequestBody } from './generated/schemas/getProfilePicturesRequestBody';import type { GetUserInfo } from './generated/schemas/getUserInfo';import type { MacroApiTokenResponse } from './generated/schemas/macroApiTokenResponse';import type { PasswordRequest } from './generated/schemas/passwordRequest';+import type { PatchUserGroupRequest } from './generated/schemas/patchUserGroupRequest';+import type { PatchUserOnboardingRequest } from './generated/schemas/patchUserOnboardingRequest';import type { PostGetNamesRequestBody } from './generated/schemas/postGetNamesRequestBody';import type { ProfilePictures } from './generated/schemas/profilePictures';import type { PutProfilePictureParams } from './generated/schemas/putProfilePictureParams';@@ -29,6 +33,7 @@ import type { PutUserNameQueryParams } from './generated/schemas/putUserNameQuerimport type { UserLinkResponse } from './generated/schemas/userLinkResponse';import type { UserName } from './generated/schemas/userName';import type { UserNames } from './generated/schemas/userNames';+import type { UserOrganizationResponse } from './generated/schemas/userOrganizationResponse';import type { UserTokensResponse } from './generated/schemas/userTokensResponse';const authHost = SERVER_HOSTS['auth-service'];@@ -117,6 +122,8 @@ export async function getAccessToken(): Promise<string | null> {return accessToken;}+export type { GetLegacyUserPermissionsResponse, UserOrganizationResponse };+export const authServiceClient = {async logout() {setAccessTokenData(null);@@ -291,7 +298,7 @@ export const authServiceClient = {async macroApiToken() {const accessToken = await getAccessToken();if (!accessToken) {- console.warn('No access token found, fetching with cookies');+ logger.warn('No access token found, fetching with cookies');return authApiFetch<MacroApiTokenResponse>('/jwt/macro_api_token');}@@ -320,6 +327,99 @@ export const authServiceClient = {(result) => result);},++ // HTTP methods (migrated from RPC)+ async getLegacyUserPermissions() {+ const result = await fetchWithAuth<GetLegacyUserPermissionsResponse>(+ `${authHost}/user/legacy_user_permissions`,+ { method: 'GET' }+ );++ return mapOk(result, (data) => ({+ id: data.userId,+ permissions: data.permissions,+ email: data.email,+ name: data.name,+ licenseStatus: data.licenseStatus,+ tutorialComplete: data.tutorialComplete,+ group: data.group,+ hasChromeExt: data.hasChromeExt,+ authenticated: !!data.userId,+ userId: data.userId,+ hasTrialed: data.hasTrialed,+ }));+ },++ async getOrganization() {+ const response = await fetchWithAuth<UserOrganizationResponse>(+ `${authHost}/user/organization`,+ { method: 'GET' }+ );++ // If the response is an error, treat as no organization (204 No Content or other errors)+ if (!isOk(response)) {+ return ok({+ organizationId: undefined as string | undefined,+ organizationName: undefined as string | undefined,+ });+ }++ return ok({+ organizationId: String(response[1].organizationId) as string | undefined,+ organizationName: response[1].organizationName as string | undefined,+ });+ },++ async completeOnboarding(args: PatchUserOnboardingRequest) {+ return mapOk(+ await fetchWithAuth<EmptyResponse>(`${authHost}/user/onboarding`, {+ method: 'PATCH',+ body: JSON.stringify(args),+ }),+ () => undefined+ );+ },++ async setGroup(args: PatchUserGroupRequest) {+ return mapOk(+ await fetchWithAuth<EmptyResponse>(`${authHost}/user/group`, {+ method: 'PATCH',+ body: JSON.stringify(args),+ }),+ () => undefined+ );+ },++ // Stripe HTTP methods (replacing RPC calls)+ async createCheckoutSession(args: {+ successUrl: string;+ cancelUrl: string;+ discount?: string | null;+ }) {+ return mapOk(+ await fetchWithAuth<{ url: string }>(`${authHost}/user/stripe/checkout`, {+ method: 'POST',+ body: JSON.stringify({+ successUrl: args.successUrl,+ cancelUrl: args.cancelUrl,+ discount: args.discount ?? undefined,+ }),+ }),+ (result) => result.url+ );+ },++ async createPortalSession(args: { returnUrl: string }) {+ return mapOk(+ await fetchWithAuth<{ url: string }>(`${authHost}/user/stripe/portal`, {+ method: 'POST',+ body: JSON.stringify({+ returnUrl: args.returnUrl,+ }),+ }),+ (result) => result.url+ );+ },};registerClient('auth', authServiceClient);diff --git a/js/app/packages/service-clients/service-auth/generated/client.ts b/js/app/packages/service-clients/service-auth/generated/client.tsindex 054a840c53..f9a80bb0c8 100644--- a/js/app/packages/service-clients/service-auth/generated/client.ts+++ b/js/app/packages/service-clients/service-auth/generated/client.ts@@ -7,7 +7,9 @@import type {AppleLoginRequest,CreateAccountMergeRequest,+ CreateCheckoutSessionRequest,CreateInProgressLinkResponse,+ CreatePortalSessionRequest,CreateTeamRequest,CreateUserRequest,EmptyResponse,@@ -37,6 +39,7 @@ import type {ResendFusionauthVerifyUserEmailRequest,SsoLoginParams,SsoRequiredResponse,+ StripeSessionResponse,Team,TeamInvitesResponse,TeamWithUsers,@@ -3043,6 +3046,132 @@ export const getUserQuota = async (} as getUserQuotaResponse;};+/**+ * @summary Creates a Stripe checkout session for the user to subscribe.+ */+export type createCheckoutSessionResponse200 = {+ data: StripeSessionResponse;+ status: 200;+};++export type createCheckoutSessionResponse400 = {+ data: string;+ status: 400;+};++export type createCheckoutSessionResponse404 = {+ data: string;+ status: 404;+};++export type createCheckoutSessionResponse500 = {+ data: string;+ status: 500;+};++export type createCheckoutSessionResponseSuccess =+ createCheckoutSessionResponse200 & {+ headers: Headers;+ };+export type createCheckoutSessionResponseError = (+ | createCheckoutSessionResponse400+ | createCheckoutSessionResponse404+ | createCheckoutSessionResponse500+) & {+ headers: Headers;+};++export type createCheckoutSessionResponse =+ | createCheckoutSessionResponseSuccess+ | createCheckoutSessionResponseError;++export const getCreateCheckoutSessionUrl = () => {+ return `/user/stripe/checkout`;+};++export const createCheckoutSession = async (+ createCheckoutSessionRequest: CreateCheckoutSessionRequest,+ options?: RequestInit+): Promise<createCheckoutSessionResponse> => {+ const res = await fetch(getCreateCheckoutSessionUrl(), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(createCheckoutSessionRequest),+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: createCheckoutSessionResponse['data'] = body+ ? JSON.parse(body)+ : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as createCheckoutSessionResponse;+};++/**+ * @summary Creates a Stripe billing portal session.+ */+export type createPortalSessionResponse200 = {+ data: StripeSessionResponse;+ status: 200;+};++export type createPortalSessionResponse400 = {+ data: string;+ status: 400;+};++export type createPortalSessionResponse500 = {+ data: string;+ status: 500;+};++export type createPortalSessionResponseSuccess =+ createPortalSessionResponse200 & {+ headers: Headers;+ };+export type createPortalSessionResponseError = (+ | createPortalSessionResponse400+ | createPortalSessionResponse500+) & {+ headers: Headers;+};++export type createPortalSessionResponse =+ | createPortalSessionResponseSuccess+ | createPortalSessionResponseError;++export const getCreatePortalSessionUrl = () => {+ return `/user/stripe/portal`;+};++export const createPortalSession = async (+ createPortalSessionRequest: CreatePortalSessionRequest,+ options?: RequestInit+): Promise<createPortalSessionResponse> => {+ const res = await fetch(getCreatePortalSessionUrl(), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(createPortalSessionRequest),+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: createPortalSessionResponse['data'] = body+ ? JSON.parse(body)+ : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as createPortalSessionResponse;+};+/*** @summary Updates the user's tutorialComplete flag.*/diff --git a/js/app/packages/service-clients/service-auth/generated/schemas/createCheckoutSessionRequest.ts b/js/app/packages/service-clients/service-auth/generated/schemas/createCheckoutSessionRequest.tsnew file mode 100644index 0000000000..138c0d7fee--- /dev/null+++ b/js/app/packages/service-clients/service-auth/generated/schemas/createCheckoutSessionRequest.ts@@ -0,0 +1,19 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */+import type { CreateCheckoutSessionRequestDiscount } from './createCheckoutSessionRequestDiscount';++/**+ * Request body for creating a Stripe checkout session+ */+export interface CreateCheckoutSessionRequest {+ /** The URL to redirect to if checkout is cancelled */+ cancelUrl: string;+ /** Optional discount/promo code to apply */+ discount?: CreateCheckoutSessionRequestDiscount;+ /** The URL to redirect to on successful checkout */+ successUrl: string;+}diff --git a/js/app/packages/service-clients/service-auth/generated/schemas/createCheckoutSessionRequestDiscount.ts b/js/app/packages/service-clients/service-auth/generated/schemas/createCheckoutSessionRequestDiscount.tsnew file mode 100644index 0000000000..e3f2d80988--- /dev/null+++ b/js/app/packages/service-clients/service-auth/generated/schemas/createCheckoutSessionRequestDiscount.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Optional discount/promo code to apply+ */+export type CreateCheckoutSessionRequestDiscount = string | null;diff --git a/js/app/packages/service-clients/service-auth/generated/schemas/createPortalSessionRequest.ts b/js/app/packages/service-clients/service-auth/generated/schemas/createPortalSessionRequest.tsnew file mode 100644index 0000000000..bbfdf1417e--- /dev/null+++ b/js/app/packages/service-clients/service-auth/generated/schemas/createPortalSessionRequest.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Request body for creating a Stripe portal session+ */+export interface CreatePortalSessionRequest {+ /** The URL to redirect to after leaving the portal */+ returnUrl: string;+}diff --git a/js/app/packages/service-clients/service-auth/generated/schemas/index.ts b/js/app/packages/service-clients/service-auth/generated/schemas/index.tsindex 569be63f61..1af6fe6e27 100644--- a/js/app/packages/service-clients/service-auth/generated/schemas/index.ts+++ b/js/app/packages/service-clients/service-auth/generated/schemas/index.ts@@ -8,7 +8,10 @@export * from './aBGroup';export * from './appleLoginRequest';export * from './createAccountMergeRequest';+export * from './createCheckoutSessionRequest';+export * from './createCheckoutSessionRequestDiscount';export * from './createInProgressLinkResponse';+export * from './createPortalSessionRequest';export * from './createTeamRequest';export * from './createUserRequest';export * from './emptyResponse';@@ -46,6 +49,7 @@ export * from './putUserNameQueryParamsLastName';export * from './resendFusionauthVerifyUserEmailRequest';export * from './ssoLoginParams';export * from './ssoRequiredResponse';+export * from './stripeSessionResponse';export * from './team';export * from './teamInvite';export * from './teamInvitesResponse';diff --git a/js/app/packages/service-clients/service-auth/generated/schemas/stripeSessionResponse.ts b/js/app/packages/service-clients/service-auth/generated/schemas/stripeSessionResponse.tsnew file mode 100644index 0000000000..c873703f49--- /dev/null+++ b/js/app/packages/service-clients/service-auth/generated/schemas/stripeSessionResponse.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * authentication_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Response containing the Stripe session URL+ */+export interface StripeSessionResponse {+ /** The URL to redirect the user to */+ url: string;+}diff --git a/js/app/packages/service-clients/service-auth/openapi.json b/js/app/packages/service-clients/service-auth/openapi.jsonindex 100a86c134..230168588d 100644--- a/js/app/packages/service-clients/service-auth/openapi.json+++ b/js/app/packages/service-clients/service-auth/openapi.json@@ -2635,6 +2635,114 @@}}},+ "/user/stripe/checkout": {+ "post": {+ "tags": ["user::stripe"],+ "summary": "Creates a Stripe checkout session for the user to subscribe.",+ "operationId": "create_checkout_session",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CreateCheckoutSessionRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/StripeSessionResponse"+ }+ }+ }+ },+ "400": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "404": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ }+ }+ },+ "/user/stripe/portal": {+ "post": {+ "tags": ["user::stripe"],+ "summary": "Creates a Stripe billing portal session.",+ "operationId": "create_portal_session",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CreatePortalSessionRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/StripeSessionResponse"+ }+ }+ }+ },+ "400": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ }+ }+ },"/user/tutorial": {"patch": {"tags": ["user::patch_tutorial"],@@ -2723,6 +2831,25 @@}}},+ "CreateCheckoutSessionRequest": {+ "type": "object",+ "description": "Request body for creating a Stripe checkout session",+ "required": ["successUrl", "cancelUrl"],+ "properties": {+ "cancelUrl": {+ "type": "string",+ "description": "The URL to redirect to if checkout is cancelled"+ },+ "discount": {+ "type": ["string", "null"],+ "description": "Optional discount/promo code to apply"+ },+ "successUrl": {+ "type": "string",+ "description": "The URL to redirect to on successful checkout"+ }+ }+ },"CreateInProgressLinkResponse": {"type": "object","required": ["link_id"],@@ -2733,6 +2860,17 @@}}},+ "CreatePortalSessionRequest": {+ "type": "object",+ "description": "Request body for creating a Stripe portal session",+ "required": ["returnUrl"],+ "properties": {+ "returnUrl": {+ "type": "string",+ "description": "The URL to redirect to after leaving the portal"+ }+ }+ },"CreateTeamRequest": {"type": "object","description": "The request body to create a new team",@@ -3087,6 +3225,17 @@}}},+ "StripeSessionResponse": {+ "type": "object",+ "description": "Response containing the Stripe session URL",+ "required": ["url"],+ "properties": {+ "url": {+ "type": "string",+ "description": "The URL to redirect the user to"+ }+ }+ },"Team": {"type": "object","required": ["id", "name", "owner_id"],diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/fileType.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/fileType.tsindex 4e284c29d9..75e7cc5f1a 100644--- a/js/app/packages/service-clients/service-cognition/generated/schemas/fileType.ts+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/fileType.ts@@ -29,422 +29,39 @@ export const FileType = {pdf: 'pdf',md: 'md',canvas: 'canvas',- coffee: 'coffee',- cson: 'cson',- iced: 'iced',- c: 'c',- i: 'i',- cpp: 'cpp',- cppm: 'cppm',- cc: 'cc',- ccm: 'ccm',- cxx: 'cxx',- cxxm: 'cxxm',- cplusplus: 'cplusplus',- cplusplusm: 'cplusplusm',- hpp: 'hpp',- hh: 'hh',- hxx: 'hxx',- hplusplus: 'hplusplus',- h: 'h',- ii: 'ii',- ino: 'ino',- inl: 'inl',- ipp: 'ipp',- ixx: 'ixx',- tpp: 'tpp',- txx: 'txx',- hppin: 'hppin',- hin: 'hin',- cu: 'cu',- cuh: 'cuh',- cs: 'cs',- csx: 'csx',- cake: 'cake',- css: 'css',- dart: 'dart',- diff: 'diff',- patch: 'patch',- rej: 'rej',- dockerfile: 'dockerfile',- containerfile: 'containerfile',- go: 'go',- handlebars: 'handlebars',- hbs: 'hbs',- hjs: 'hjs',- hlsl: 'hlsl',- hlsli: 'hlsli',- fx: 'fx',- fxh: 'fxh',- vsh: 'vsh',- psh: 'psh',- cginc: 'cginc',- compute: 'compute',- html: 'html',- htm: 'htm',- shtml: 'shtml',- xhtml: 'xhtml',- xht: 'xht',- mdoc: 'mdoc',- jsp: 'jsp',- asp: 'asp',- aspx: 'aspx',- jshtm: 'jshtm',- volt: 'volt',- ejs: 'ejs',- rhtml: 'rhtml',- ini: 'ini',- conf: 'conf',- properties: 'properties',- cfg: 'cfg',- directory: 'directory',- gitattributes: 'gitattributes',- gitconfig: 'gitconfig',- gitmodules: 'gitmodules',- editorconfig: 'editorconfig',- repo: 'repo',- java: 'java',- jav: 'jav',- jsx: 'jsx',- js: 'js',- es6: 'es6',- mjs: 'mjs',- cjs: 'cjs',- pac: 'pac',- json: 'json',- bowerrc: 'bowerrc',- jscsrc: 'jscsrc',- webmanifest: 'webmanifest',- jsmap: 'jsmap',- cssmap: 'cssmap',- tsmap: 'tsmap',- har: 'har',- jslintrc: 'jslintrc',- jsonld: 'jsonld',- geojson: 'geojson',- ipynb: 'ipynb',- vuerc: 'vuerc',- jsonc: 'jsonc',- eslintrc: 'eslintrc',- eslintrcjson: 'eslintrcjson',- jsfmtrc: 'jsfmtrc',- jshintrc: 'jshintrc',- swcrc: 'swcrc',- hintrc: 'hintrc',- babelrc: 'babelrc',- jsonl: 'jsonl',- ndjson: 'ndjson',- codesnippets: 'codesnippets',- jl: 'jl',- jmd: 'jmd',- sty: 'sty',- cls: 'cls',- bbx: 'bbx',- cbx: 'cbx',- tex: 'tex',- ltx: 'ltx',- ctx: 'ctx',- bib: 'bib',- less: 'less',- log: 'log',- lua: 'lua',- mak: 'mak',- mk: 'mk',- mkd: 'mkd',- mdwn: 'mdwn',- mdown: 'mdown',- markdown: 'markdown',- markdn: 'markdn',- mdtxt: 'mdtxt',- mdtext: 'mdtext',- workbook: 'workbook',- m: 'm',- mm: 'mm',- pl: 'pl',- pm: 'pm',- pod: 'pod',- t: 't',- psgi: 'psgi',- raku: 'raku',- rakumod: 'rakumod',- rakutest: 'rakutest',- rakudoc: 'rakudoc',- nqp: 'nqp',- p6: 'p6',- pl6: 'pl6',- pm6: 'pm6',- php: 'php',- php4: 'php4',- php5: 'php5',- phtml: 'phtml',- ctp: 'ctp',- ps1: 'ps1',- psm1: 'psm1',- psd1: 'psd1',- pssc: 'pssc',- psrc: 'psrc',py: 'py',- rpy: 'rpy',- pyw: 'pyw',- cpy: 'cpy',- gyp: 'gyp',- gypi: 'gypi',- pyi: 'pyi',- ipy: 'ipy',- pyt: 'pyt',- r: 'r',- rhistory: 'rhistory',- rprofile: 'rprofile',- rt: 'rt',- cshtml: 'cshtml',- razor: 'razor',- rb: 'rb',- rbx: 'rbx',- rjs: 'rjs',- gemspec: 'gemspec',- rake: 'rake',- ru: 'ru',- erb: 'erb',- podspec: 'podspec',- rbi: 'rbi',- rs: 'rs',- scss: 'scss',- sass: 'sass',- shader: 'shader',- sh: 'sh',- bash: 'bash',- bashrc: 'bashrc',- bashaliases: 'bashaliases',- bashprofile: 'bashprofile',- bashlogin: 'bashlogin',- ebuild: 'ebuild',- eclass: 'eclass',- profile: 'profile',- bashlogout: 'bashlogout',- xprofile: 'xprofile',- xsession: 'xsession',- xsessionrc: 'xsessionrc',- zsh: 'zsh',- zshrc: 'zshrc',- zprofile: 'zprofile',- zlogin: 'zlogin',- zlogout: 'zlogout',- zshenv: 'zshenv',- zshtheme: 'zshtheme',- fish: 'fish',- ksh: 'ksh',- csh: 'csh',- cshrc: 'cshrc',- tcshrc: 'tcshrc',- yashrc: 'yashrc',- yashprofile: 'yashprofile',- sql: 'sql',- dsql: 'dsql',- swift: 'swift',+ js: 'js',ts: 'ts',- cts: 'cts',- mts: 'mts',+ jsx: 'jsx',tsx: 'tsx',- tsbuildinfo: 'tsbuildinfo',+ json: 'json',+ html: 'html',+ css: 'css',xml: 'xml',- xsd: 'xsd',- ascx: 'ascx',- atom: 'atom',- axml: 'axml',- axaml: 'axaml',- bpmn: 'bpmn',- cpt: 'cpt',- csl: 'csl',- csproj: 'csproj',- csprojuser: 'csprojuser',- dita: 'dita',- ditamap: 'ditamap',- dtd: 'dtd',- ent: 'ent',- mod: 'mod',- dtml: 'dtml',- fsproj: 'fsproj',- fxml: 'fxml',- iml: 'iml',- isml: 'isml',- jmx: 'jmx',- launch: 'launch',- menu: 'menu',- mxml: 'mxml',- nuspec: 'nuspec',- opml: 'opml',- owl: 'owl',- proj: 'proj',- props: 'props',- pt: 'pt',- publishsettings: 'publishsettings',- pubxml: 'pubxml',- pubxmluser: 'pubxmluser',- rbxlx: 'rbxlx',- rbxmx: 'rbxmx',- rdf: 'rdf',- rng: 'rng',- rss: 'rss',- shproj: 'shproj',- storyboard: 'storyboard',- targets: 'targets',- tld: 'tld',- tmx: 'tmx',- vbproj: 'vbproj',- vbprojuser: 'vbprojuser',- vcxproj: 'vcxproj',- vcxprojfilters: 'vcxprojfilters',- wsdl: 'wsdl',- wxi: 'wxi',- wxl: 'wxl',- wxs: 'wxs',- xaml: 'xaml',- xbl: 'xbl',- xib: 'xib',- xlf: 'xlf',- xliff: 'xliff',- xpdl: 'xpdl',- xul: 'xul',- xoml: 'xoml',- xsl: 'xsl',- xslt: 'xslt',yaml: 'yaml',yml: 'yml',- eyaml: 'eyaml',- eyml: 'eyml',- cff: 'cff',- yamltmlanguage: 'yamltmlanguage',- yamltmpreferences: 'yamltmpreferences',- yamltmtheme: 'yamltmtheme',- winget: 'winget',+ sql: 'sql',+ sh: 'sh',+ bash: 'bash',+ markdown: 'markdown',txt: 'txt',csv: 'csv',- tsv: 'tsv',jpeg: 'jpeg',jpg: 'jpg',png: 'png',gif: 'gif',svg: 'svg',webp: 'webp',- avif: 'avif',- bmp: 'bmp',- ico: 'ico',- tiff: 'tiff',- tif: 'tif',heic: 'heic',heif: 'heif',+ zip: 'zip',tar: 'tar',targz: 'targz',tgz: 'tgz',gz: 'gz',- bz2: 'bz2',- tarbz2: 'tarbz2',- tbz2: 'tbz2',- z: 'z',- tarz: 'tarz',- lz: 'lz',- tarlz: 'tarlz',- xz: 'xz',- tarxz: 'tarxz',- txz: 'txz',- lzma: 'lzma',- tarlzma: 'tarlzma',- rar: 'rar',- sevenz: 'sevenz',- zst: 'zst',- tarzst: 'tarzst',- tzst: 'tzst',- zip: 'zip',- exe: 'exe',- msi: 'msi',- dll: 'dll',- bat: 'bat',- cmd: 'cmd',- com: 'com',- appimage: 'appimage',- app: 'app',- bin: 'bin',- deb: 'deb',- rpm: 'rpm',- apk: 'apk',- dmg: 'dmg',- pkg: 'pkg',- crx: 'crx',- xpi: 'xpi',- mp3: 'mp3',- wav: 'wav',- ogg: 'ogg',- flac: 'flac',- aac: 'aac',- m4a: 'm4a',- wma: 'wma',- mid: 'mid',- midi: 'midi',mp4: 'mp4',- mkv: 'mkv',- webm: 'webm',- avi: 'avi',- mov: 'mov',- wmv: 'wmv',- mpg: 'mpg',- mpeg: 'mpeg',- m4v: 'm4v',- flv: 'flv',- f4v: 'f4v',- threegp: 'threegp',- ttf: 'ttf',- otf: 'otf',- woff: 'woff',- woff2: 'woff2',- eot: 'eot',- rtf: 'rtf',- odt: 'odt',- ods: 'ods',- odp: 'odp',- odg: 'odg',- odf: 'odf',- epub: 'epub',- mobi: 'mobi',- azw: 'azw',- azw3: 'azw3',- djvu: 'djvu',xls: 'xls',ppt: 'ppt',pptx: 'pptx',xlsx: 'xlsx',- db: 'db',- sqlite: 'sqlite',- sqlite3: 'sqlite3',- mdb: 'mdb',- accdb: 'accdb',- dbf: 'dbf',- plist: 'plist',- toml: 'toml',- env: 'env',- dot: 'dot',- gv: 'gv',- torrent: 'torrent',- ics: 'ics',- vcf: 'vcf',- ai: 'ai',- eps: 'eps',- ps: 'ps',- dxf: 'dxf',- dwg: 'dwg',- stl: 'stl',- obj: 'obj',- fbx: 'fbx',- blend: 'blend',- dae: 'dae',- threeds: 'threeds',- gltf: 'gltf',- glb: 'glb',- vhd: 'vhd',- vhdx: 'vhdx',- vmdk: 'vmdk',- ova: 'ova',- ovf: 'ovf',- iso: 'iso',- img: 'img',- swf: 'swf',} as const;diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/toolSchema.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/toolSchema.tsindex 8d10b87e06..034e60473e 100644--- a/js/app/packages/service-clients/service-cognition/generated/schemas/toolSchema.ts+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/toolSchema.ts@@ -5,8 +5,14 @@* OpenAPI spec version: 1.0.0*/+/**+ * Schema information for a single tool, serializable for API responses.+ */export interface ToolSchema {+ /** The JSON schema for the tool's input parameters. */inputSchema: unknown;+ /** The name of the tool. */name: string;+ /** The JSON schema for the tool's output. */outputSchema: unknown;}diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/toolSchemas.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/toolSchemas.tsindex f7f052bb1f..28eb700bdf 100644--- a/js/app/packages/service-clients/service-cognition/generated/schemas/toolSchemas.ts+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/toolSchemas.ts@@ -6,6 +6,10 @@*/import type { ToolSchema } from './toolSchema';+/**+ * A collection of tool schemas, typically used for API responses.+ */export interface ToolSchemas {+ /** The list of tool schemas. */schemas: ToolSchema[];}diff --git a/js/app/packages/service-clients/service-cognition/openapi.json b/js/app/packages/service-clients/service-cognition/openapi.jsonindex 499f81d8d2..bf2f361613 100644--- a/js/app/packages/service-clients/service-cognition/openapi.json+++ b/js/app/packages/service-clients/service-cognition/openapi.json@@ -2225,424 +2225,41 @@"pdf","md","canvas",- "coffee",- "cson",- "iced",- "c",- "i",- "cpp",- "cppm",- "cc",- "ccm",- "cxx",- "cxxm",- "cplusplus",- "cplusplusm",- "hpp",- "hh",- "hxx",- "hplusplus",- "h",- "ii",- "ino",- "inl",- "ipp",- "ixx",- "tpp",- "txx",- "hppin",- "hin",- "cu",- "cuh",- "cs",- "csx",- "cake",- "css",- "dart",- "diff",- "patch",- "rej",- "dockerfile",- "containerfile",- "go",- "handlebars",- "hbs",- "hjs",- "hlsl",- "hlsli",- "fx",- "fxh",- "vsh",- "psh",- "cginc",- "compute",- "html",- "htm",- "shtml",- "xhtml",- "xht",- "mdoc",- "jsp",- "asp",- "aspx",- "jshtm",- "volt",- "ejs",- "rhtml",- "ini",- "conf",- "properties",- "cfg",- "directory",- "gitattributes",- "gitconfig",- "gitmodules",- "editorconfig",- "repo",- "java",- "jav",- "jsx",- "js",- "es6",- "mjs",- "cjs",- "pac",- "json",- "bowerrc",- "jscsrc",- "webmanifest",- "jsmap",- "cssmap",- "tsmap",- "har",- "jslintrc",- "jsonld",- "geojson",- "ipynb",- "vuerc",- "jsonc",- "eslintrc",- "eslintrcjson",- "jsfmtrc",- "jshintrc",- "swcrc",- "hintrc",- "babelrc",- "jsonl",- "ndjson",- "codesnippets",- "jl",- "jmd",- "sty",- "cls",- "bbx",- "cbx",- "tex",- "ltx",- "ctx",- "bib",- "less",- "log",- "lua",- "mak",- "mk",- "mkd",- "mdwn",- "mdown",- "markdown",- "markdn",- "mdtxt",- "mdtext",- "workbook",- "m",- "mm",- "pl",- "pm",- "pod",- "t",- "psgi",- "raku",- "rakumod",- "rakutest",- "rakudoc",- "nqp",- "p6",- "pl6",- "pm6",- "php",- "php4",- "php5",- "phtml",- "ctp",- "ps1",- "psm1",- "psd1",- "pssc",- "psrc","py",- "rpy",- "pyw",- "cpy",- "gyp",- "gypi",- "pyi",- "ipy",- "pyt",- "r",- "rhistory",- "rprofile",- "rt",- "cshtml",- "razor",- "rb",- "rbx",- "rjs",- "gemspec",- "rake",- "ru",- "erb",- "podspec",- "rbi",- "rs",- "scss",- "sass",- "shader",- "sh",- "bash",- "bashrc",- "bashaliases",- "bashprofile",- "bashlogin",- "ebuild",- "eclass",- "profile",- "bashlogout",- "xprofile",- "xsession",- "xsessionrc",- "zsh",- "zshrc",- "zprofile",- "zlogin",- "zlogout",- "zshenv",- "zshtheme",- "fish",- "ksh",- "csh",- "cshrc",- "tcshrc",- "yashrc",- "yashprofile",- "sql",- "dsql",- "swift",+ "js","ts",- "cts",- "mts",+ "jsx","tsx",- "tsbuildinfo",+ "json",+ "html",+ "css","xml",- "xsd",- "ascx",- "atom",- "axml",- "axaml",- "bpmn",- "cpt",- "csl",- "csproj",- "csprojuser",- "dita",- "ditamap",- "dtd",- "ent",- "mod",- "dtml",- "fsproj",- "fxml",- "iml",- "isml",- "jmx",- "launch",- "menu",- "mxml",- "nuspec",- "opml",- "owl",- "proj",- "props",- "pt",- "publishsettings",- "pubxml",- "pubxmluser",- "rbxlx",- "rbxmx",- "rdf",- "rng",- "rss",- "shproj",- "storyboard",- "targets",- "tld",- "tmx",- "vbproj",- "vbprojuser",- "vcxproj",- "vcxprojfilters",- "wsdl",- "wxi",- "wxl",- "wxs",- "xaml",- "xbl",- "xib",- "xlf",- "xliff",- "xpdl",- "xul",- "xoml",- "xsl",- "xslt","yaml","yml",- "eyaml",- "eyml",- "cff",- "yamltmlanguage",- "yamltmpreferences",- "yamltmtheme",- "winget",+ "sql",+ "sh",+ "bash",+ "markdown","txt","csv",- "tsv","jpeg","jpg","png","gif","svg","webp",- "avif",- "bmp",- "ico",- "tiff",- "tif","heic","heif",+ "zip","tar","targz","tgz","gz",- "bz2",- "tarbz2",- "tbz2",- "z",- "tarz",- "lz",- "tarlz",- "xz",- "tarxz",- "txz",- "lzma",- "tarlzma",- "rar",- "sevenz",- "zst",- "tarzst",- "tzst",- "zip",- "exe",- "msi",- "dll",- "bat",- "cmd",- "com",- "appimage",- "app",- "bin",- "deb",- "rpm",- "apk",- "dmg",- "pkg",- "crx",- "xpi",- "mp3",- "wav",- "ogg",- "flac",- "aac",- "m4a",- "wma",- "mid",- "midi","mp4",- "mkv",- "webm",- "avi",- "mov",- "wmv",- "mpg",- "mpeg",- "m4v",- "flv",- "f4v",- "threegp",- "ttf",- "otf",- "woff",- "woff2",- "eot",- "rtf",- "odt",- "ods",- "odp",- "odg",- "odf",- "epub",- "mobi",- "azw",- "azw3",- "djvu","xls","ppt","pptx",- "xlsx",- "db",- "sqlite",- "sqlite3",- "mdb",- "accdb",- "dbf",- "plist",- "toml",- "env",- "dot",- "gv",- "torrent",- "ics",- "vcf",- "ai",- "eps",- "ps",- "dxf",- "dwg",- "stl",- "obj",- "fbx",- "blend",- "dae",- "threeds",- "gltf",- "glb",- "vhd",- "vhdx",- "vmdk",- "ova",- "ovf",- "iso",- "img",- "swf"+ "xlsx"]},"FromWebSocketMessage": {@@ -3859,24 +3476,32 @@},"ToolSchema": {"type": "object",+ "description": "Schema information for a single tool, serializable for API responses.","required": ["name", "inputSchema", "outputSchema"],"properties": {- "inputSchema": {},+ "inputSchema": {+ "description": "The JSON schema for the tool's input parameters."+ },"name": {- "type": "string"+ "type": "string",+ "description": "The name of the tool."},- "outputSchema": {}+ "outputSchema": {+ "description": "The JSON schema for the tool's output."+ }}},"ToolSchemas": {"type": "object",+ "description": "A collection of tool schemas, typically used for API responses.","required": ["schemas"],"properties": {"schemas": {"type": "array","items": {"$ref": "#/components/schemas/ToolSchema"- }+ },+ "description": "The list of tool schemas."}}},diff --git a/js/app/packages/service-clients/service-email/generated/client.ts b/js/app/packages/service-clients/service-email/generated/client.tsindex 6f492520f8..982333a744 100644--- a/js/app/packages/service-clients/service-email/generated/client.ts+++ b/js/app/packages/service-clients/service-email/generated/client.ts@@ -20,6 +20,8 @@ import type {GetAttachmentDocumentIDResponse,GetAttachmentResponse,GetBackfillJobResponse,+ GetScheduledMessagesParams,+ GetScheduledResponse,GetThreadMessagesHandlerParams,GetThreadParams,GetThreadResponse,@@ -36,6 +38,8 @@ import type {SendMessageResponse,UpdateLabelBatchRequest,UpdateLabelBatchResponse,+ UpsertScheduledRequest,+ UpsertScheduledResponse,} from './schemas';/**@@ -489,6 +493,221 @@ export const createDraft = async (} as createDraftResponse;};+/**+ * @summary List scheduled drafts.+ */+export type getScheduledMessagesResponse200 = {+ data: GetScheduledResponse;+ status: 200;+};++export type getScheduledMessagesResponse400 = {+ data: ErrorResponse;+ status: 400;+};++export type getScheduledMessagesResponse401 = {+ data: ErrorResponse;+ status: 401;+};++export type getScheduledMessagesResponse500 = {+ data: ErrorResponse;+ status: 500;+};++export type getScheduledMessagesResponseSuccess =+ getScheduledMessagesResponse200 & {+ headers: Headers;+ };+export type getScheduledMessagesResponseError = (+ | getScheduledMessagesResponse400+ | getScheduledMessagesResponse401+ | getScheduledMessagesResponse500+) & {+ headers: Headers;+};++export type getScheduledMessagesResponse =+ | getScheduledMessagesResponseSuccess+ | getScheduledMessagesResponseError;++export const getGetScheduledMessagesUrl = (+ params?: GetScheduledMessagesParams+) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/email/drafts/scheduled?${stringifiedParams}`+ : `/email/drafts/scheduled`;+};++export const getScheduledMessages = async (+ params?: GetScheduledMessagesParams,+ options?: RequestInit+): Promise<getScheduledMessagesResponse> => {+ const res = await fetch(getGetScheduledMessagesUrl(params), {+ ...options,+ method: 'GET',+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: getScheduledMessagesResponse['data'] = body+ ? JSON.parse(body)+ : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as getScheduledMessagesResponse;+};++/**+ * @summary Schedule or update a scheduled draft.+ */+export type upsertScheduledMessageResponse200 = {+ data: UpsertScheduledResponse;+ status: 200;+};++export type upsertScheduledMessageResponse401 = {+ data: ErrorResponse;+ status: 401;+};++export type upsertScheduledMessageResponse404 = {+ data: ErrorResponse;+ status: 404;+};++export type upsertScheduledMessageResponse500 = {+ data: ErrorResponse;+ status: 500;+};++export type upsertScheduledMessageResponseSuccess =+ upsertScheduledMessageResponse200 & {+ headers: Headers;+ };+export type upsertScheduledMessageResponseError = (+ | upsertScheduledMessageResponse401+ | upsertScheduledMessageResponse404+ | upsertScheduledMessageResponse500+) & {+ headers: Headers;+};++export type upsertScheduledMessageResponse =+ | upsertScheduledMessageResponseSuccess+ | upsertScheduledMessageResponseError;++export const getUpsertScheduledMessageUrl = (id: string) => {+ return `/email/drafts/scheduled/${id}`;+};++export const upsertScheduledMessage = async (+ id: string,+ upsertScheduledRequest: UpsertScheduledRequest,+ options?: RequestInit+): Promise<upsertScheduledMessageResponse> => {+ const res = await fetch(getUpsertScheduledMessageUrl(id), {+ ...options,+ method: 'PUT',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(upsertScheduledRequest),+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: upsertScheduledMessageResponse['data'] = body+ ? JSON.parse(body)+ : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as upsertScheduledMessageResponse;+};++/**+ * @summary Remove the scheduled send from a draft.+ */+export type deleteScheduledDraftResponse204 = {+ data: void;+ status: 204;+};++export type deleteScheduledDraftResponse400 = {+ data: ErrorResponse;+ status: 400;+};++export type deleteScheduledDraftResponse401 = {+ data: ErrorResponse;+ status: 401;+};++export type deleteScheduledDraftResponse404 = {+ data: ErrorResponse;+ status: 404;+};++export type deleteScheduledDraftResponse500 = {+ data: ErrorResponse;+ status: 500;+};++export type deleteScheduledDraftResponseSuccess =+ deleteScheduledDraftResponse204 & {+ headers: Headers;+ };+export type deleteScheduledDraftResponseError = (+ | deleteScheduledDraftResponse400+ | deleteScheduledDraftResponse401+ | deleteScheduledDraftResponse404+ | deleteScheduledDraftResponse500+) & {+ headers: Headers;+};++export type deleteScheduledDraftResponse =+ | deleteScheduledDraftResponseSuccess+ | deleteScheduledDraftResponseError;++export const getDeleteScheduledDraftUrl = (messageId: string) => {+ return `/email/drafts/scheduled/${messageId}`;+};++export const deleteScheduledDraft = async (+ messageId: string,+ options?: RequestInit+): Promise<deleteScheduledDraftResponse> => {+ const res = await fetch(getDeleteScheduledDraftUrl(messageId), {+ ...options,+ method: 'DELETE',+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: deleteScheduledDraftResponse['data'] = body+ ? JSON.parse(body)+ : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as deleteScheduledDraftResponse;+};+/*** @summary Delete a draft.*/diff --git a/js/app/packages/service-clients/service-email/generated/schemas/getScheduledMessagesParams.ts b/js/app/packages/service-clients/service-email/generated/schemas/getScheduledMessagesParams.tsnew file mode 100644index 0000000000..0be1f524e8--- /dev/null+++ b/js/app/packages/service-clients/service-email/generated/schemas/getScheduledMessagesParams.ts@@ -0,0 +1,19 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type GetScheduledMessagesParams = {+ /**+ * The number of scheduled messages to skip.+ * @minimum 0+ */+ offset?: number;+ /**+ * The maximum number of scheduled messages to return.+ * @minimum 0+ */+ limit?: number;+};diff --git a/js/app/packages/service-clients/service-email/generated/schemas/getScheduledResponse.ts b/js/app/packages/service-clients/service-email/generated/schemas/getScheduledResponse.tsnew file mode 100644index 0000000000..8643a937e9--- /dev/null+++ b/js/app/packages/service-clients/service-email/generated/schemas/getScheduledResponse.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */+import type { Message } from './message';++export interface GetScheduledResponse {+ messages: Message[];+}diff --git a/js/app/packages/service-clients/service-email/generated/schemas/index.ts b/js/app/packages/service-clients/service-email/generated/schemas/index.tsindex b5c721d979..dafda980e3 100644--- a/js/app/packages/service-clients/service-email/generated/schemas/index.ts+++ b/js/app/packages/service-clients/service-email/generated/schemas/index.ts@@ -91,6 +91,8 @@ export * from './getBackfillJobResponse';export * from './getPreviewsCursorParams';export * from './getPreviewsCursorParamsLimit';export * from './getPreviewsCursorParamsSortMethod';+export * from './getScheduledMessagesParams';+export * from './getScheduledResponse';export * from './getThreadMessagesHandlerParams';export * from './getThreadParams';export * from './getThreadResponse';@@ -183,5 +185,7 @@ export * from './threadProviderId';export * from './threadSummary';export * from './updateLabelBatchRequest';export * from './updateLabelBatchResponse';+export * from './upsertScheduledRequest';+export * from './upsertScheduledResponse';export * from './userProvider';export * from './value';diff --git a/js/app/packages/service-clients/service-email/generated/schemas/upsertScheduledRequest.ts b/js/app/packages/service-clients/service-email/generated/schemas/upsertScheduledRequest.tsnew file mode 100644index 0000000000..117cf1b73a--- /dev/null+++ b/js/app/packages/service-clients/service-email/generated/schemas/upsertScheduledRequest.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export interface UpsertScheduledRequest {+ /** The time to send the message (ISO 8601 format) */+ send_time: string;+}diff --git a/js/app/packages/service-clients/service-email/generated/schemas/upsertScheduledResponse.ts b/js/app/packages/service-clients/service-email/generated/schemas/upsertScheduledResponse.tsnew file mode 100644index 0000000000..8350537b57--- /dev/null+++ b/js/app/packages/service-clients/service-email/generated/schemas/upsertScheduledResponse.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export interface UpsertScheduledResponse {+ message_id: string;+ send_time: string;+}diff --git a/js/app/packages/service-clients/service-email/openapi.json b/js/app/packages/service-clients/service-email/openapi.jsonindex ffa7d943b7..0892472180 100644--- a/js/app/packages/service-clients/service-email/openapi.json+++ b/js/app/packages/service-clients/service-email/openapi.json@@ -429,6 +429,214 @@}}},+ "/email/drafts/scheduled": {+ "get": {+ "tags": ["Draft Scheduling"],+ "summary": "List scheduled drafts.",+ "operationId": "get_scheduled_messages",+ "parameters": [+ {+ "name": "offset",+ "in": "query",+ "description": "The number of scheduled messages to skip.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32",+ "minimum": 0+ }+ },+ {+ "name": "limit",+ "in": "query",+ "description": "The maximum number of scheduled messages to return.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32",+ "minimum": 0+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GetScheduledResponse"+ }+ }+ }+ },+ "400": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ }+ },+ "/email/drafts/scheduled/{id}": {+ "put": {+ "tags": ["Draft Scheduling"],+ "summary": "Schedule or update a scheduled draft.",+ "operationId": "upsert_scheduled_message",+ "parameters": [+ {+ "name": "id",+ "in": "path",+ "description": "The ID of the draft message to schedule",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UpsertScheduledRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UpsertScheduledResponse"+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "404": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ }+ },+ "/email/drafts/scheduled/{message_id}": {+ "delete": {+ "tags": ["Draft Scheduling"],+ "summary": "Remove the scheduled send from a draft.",+ "operationId": "delete_scheduled_draft",+ "parameters": [+ {+ "name": "message_id",+ "in": "path",+ "description": "The ID of the draft",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "responses": {+ "204": {+ "description": "Scheduled send deleted successfully"+ },+ "400": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "404": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ }+ },"/email/drafts/{id}": {"delete": {"tags": ["Drafts"],@@ -2604,6 +2812,18 @@}}},+ "GetScheduledResponse": {+ "type": "object",+ "required": ["messages"],+ "properties": {+ "messages": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Message"+ }+ }+ }+ },"GetThreadResponse": {"type": "object","description": "The response returned from the get thread endpoint",@@ -3436,6 +3656,31 @@}}},+ "UpsertScheduledRequest": {+ "type": "object",+ "required": ["send_time"],+ "properties": {+ "send_time": {+ "type": "string",+ "format": "date-time",+ "description": "The time to send the message (ISO 8601 format)"+ }+ }+ },+ "UpsertScheduledResponse": {+ "type": "object",+ "required": ["message_id", "send_time"],+ "properties": {+ "message_id": {+ "type": "string",+ "format": "uuid"+ },+ "send_time": {+ "type": "string",+ "format": "date-time"+ }+ }+ },"UserProvider": {"type": "string","enum": ["GMAIL"]diff --git a/js/app/packages/service-clients/service-gql/client.ts b/js/app/packages/service-clients/service-gql/client.tsdeleted file mode 100644index 434e264b48..0000000000--- a/js/app/packages/service-clients/service-gql/client.ts+++ /dev/null@@ -1,356 +0,0 @@-import { ENABLE_BEARER_TOKEN_AUTH } from '@core/constant/featureFlags';-import { SERVER_HOSTS } from '@core/constant/servers';-import { cache } from '@core/util/cache';-import { err, ok } from '@core/util/maybeResult';-import { registerClient } from '@core/util/mockClient';-import { getAccessToken } from '@service-auth/client';-import { createSingletonRoot } from '@solid-primitives/rootless';-import { makePersisted } from '@solid-primitives/storage';-import { createMemo, createResource, createSignal } from 'solid-js';-import { LegacyApiRpcClient } from '../../codegen/auth_service/auth_service_rpc';--// Create a singleton instance of the RPC client-let rpcClientInstance: LegacyApiRpcClient | null = null;-let headers: Headers | null = null;--async function getRpcClient(): Promise<LegacyApiRpcClient> {- if (headers == null) {- headers = new Headers();-- if (ENABLE_BEARER_TOKEN_AUTH) {- const token = await getAccessToken();- if (token) headers.set('Authorization', `Bearer ${token}`);- }- }-- if (!rpcClientInstance) {- rpcClientInstance = LegacyApiRpcClient.construct_with_headers(- `${SERVER_HOSTS['auth-service']}/user`,- () => headers- );- }- return rpcClientInstance;-}--// TODO: bake this as middleware in the generated client-async function withRetryOn401<T>(- fn: () => Promise<T>,- maxRetries = 3-): Promise<T> {- let lastError: any;-- for (let attempt = 0; attempt <= maxRetries; attempt++) {- try {- return await fn();- } catch (error: any) {- lastError = error;-- // NOTE: this is the response from the generated client for a 401 error- const is401 = typeof error === 'string' && error.includes('401');-- if (!is401 || attempt === maxRetries) {- throw error;- }-- headers = null;-- const backoffMs = (attempt + 1) * 100;- await new Promise((resolve) => setTimeout(resolve, backoffMs));- }- }-- throw lastError;-}--export enum MacroPermissions {- /** Able to use editor feature */- ReadDocxEditor = 'ReadDocxEditor',- /** Use the premium (paywalled) features in the client app */- ReadProfessionalFeatures = 'ReadProfessionalFeatures',- /** Modify and make changes to the admin panel */- WriteAdminPanel = 'WriteAdminPanel',- /** Able to use Macro AI features */- WriteAiFeatures = 'WriteAiFeatures',- /** Access hosted parsing API */- WriteApiOnline = 'WriteApiOnline',- /** Able to generate discount codes */- WriteDiscount = 'WriteDiscount',- /** Load any file into the online CoParse viewer */- WriteDocOnline = 'WriteDocOnline',- /** Able to use the email compare tool */- WriteEmailTool = 'WriteEmailTool',- /** Modify a stripe subscription for an enterprise organization */- WriteEnterpriseSubscription = 'WriteEnterpriseSubscription',- /** Able to access the IT Panel for an organization */- WriteItPanel = 'WriteItPanel',- /** Ability for User to Access and send out release notifications */- WriteReleaseEmail = 'WriteReleaseEmail',- /** Allows the user to modify and create stripe subscriptions */- WriteStripeSubscription = 'WriteStripeSubscription',-}--type CompleteOnboardingRequest = {- firstName: string;- lastName: string;- title: string;- industry: string;-};--type SetGroupRequest = {- group: string;-};--export const gqlServiceClient = {- getUserInfo: cache(- async function getUserPermissions() {- try {- const data = await withRetryOn401(async () => {- const client = await getRpcClient();- return await client.get_legacy_user_permissions();- });-- return ok({- id: data.userId,- permissions: data.permissions as MacroPermissions[],- email: data.email,- name: data.name,- licenseStatus: data.licenseStatus,- tutorialComplete: data.tutorialComplete,- group: data.group,- hasChromeExt: data.hasChromeExt,- authenticated: !!data.userId,- userId: data.userId,- hasTrialed: data.hasTrialed,- });- } catch (error) {- return err('NETWORK_ERROR', String(error));- }- },- {- seconds: 15,- }- ),- async getOrganization() {- try {- const result = await withRetryOn401(async () => {- const client = await getRpcClient();- return await client.get_user_organization();- });-- if (!result) {- return {- organizationId: undefined,- organizationName: undefined,- };- }-- return {- organizationId: String(result.organizationId),- organizationName: result.organizationName,- };- } catch (_error) {- return {- organizationId: undefined,- organizationName: undefined,- };- }- },-- async isUserInOrg() {- try {- const result = await withRetryOn401(async () => {- const client = await getRpcClient();- return await client.get_user_organization();- });-- return ok({- isInOrg: !!result,- organizationId: result ? String(result.organizationId) : undefined,- });- } catch (error) {- return err('NETWORK_ERROR', String(error));- }- },-- async completeOnboarding(args: CompleteOnboardingRequest) {- try {- await withRetryOn401(async () => {- const client = await getRpcClient();- return await client.patch_user_onboarding(args);- });- return ok(undefined);- } catch (error) {- return err('NETWORK_ERROR', String(error));- }- },- async setGroup(args: SetGroupRequest) {- try {- await withRetryOn401(async () => {- const client = await getRpcClient();- return await client.patch_user_group(args);- });- return ok(undefined);- } catch (error) {- return err('NETWORK_ERROR', String(error));- }- },-};--registerClient('gql', gqlServiceClient);--/**- * Checks if a given permission constraint is satisfied by the user's permissions.- *- * @param constraint - A string or function that returns a string representing the required permission.- * @param permissions - An array of the user's permissions.- * @returns A boolean indicating whether the user has the required permission.- *- * @example- * const hasPermission = checkConstraintInPermissions('READ', userPermissions);- */-function checkConstraintInPermissions(- constraint: string | (() => string),- permissions: MacroPermissions[] | undefined-): boolean {- const required = typeof constraint === 'function' ? constraint() : constraint;- return (- permissions?.includes(- MacroPermissions[required as keyof typeof MacroPermissions]- ) ?? false- );-}--/**- * @deprecated Use `useIsAuthenticated` hook instead.- *- * A higher-order function that wraps a function with permission checking.- *- * @param constraint - A string or function that returns a string representing the required permission.- * @param next - The function to be executed if the user has the required permission.- * @param fallback - An optional function to be executed if the user doesn't have the required permission.- * @returns A new function that checks permissions before executing the original function.- *- * @example- * const protectedFunction = withAuthentication(- * 'READ',- * () => console.log('Access granted'),- * () => console.log('Access denied')- * );- * protectedFunction();- *- */-export function withAuthentication<T extends Array<any>, U>(- constraint: string | (() => string),- next: (...args: T) => U,- fallback?: () => U-): (...args: T) => Promise<U> {- return async (...args: T) => {- const result = await gqlServiceClient.getUserInfo();- if (result[0]) {- throw new Error('Failed to fetch user permissions');- }- const { permissions } = result[1];-- const isValid = checkConstraintInPermissions(constraint, permissions);-- if (!isValid) {- if (fallback) {- return fallback();- }- throw new Error(- "You don't have permission to do this, please check your license"- );- }-- return next(...args);- };-}--const persistedUserInfo = makePersisted(- createSignal<Awaited<ReturnType<typeof gqlServiceClient.getUserInfo>>>([- null,- {- userId: '',- authenticated: false,- hasTrialed: false,- group: null,- hasChromeExt: false,- id: '',- permissions: [],- email: '',- name: null,- licenseStatus: '',- tutorialComplete: false,- },- ]),- {- name: 'userInfo',- }-);--// TODO: reconcile with auth service useUserInfo?-export const useUserInfo = createSingletonRoot(() =>- createResource(gqlServiceClient.getUserInfo, {- initialValue: persistedUserInfo[0](),- storage: () => persistedUserInfo as any,- })-);--export function updateUserInfo() {- const [, { refetch }] = useUserInfo();- return refetch();-}--export function useTutorialCompleted() {- const [userInfo] = useUserInfo();- return createMemo((): boolean | undefined => {- const [err, info] = userInfo.latest;- if (err) return;- return info.tutorialComplete;- });-}--export function useAuthor() {- const [userInfo] = useUserInfo();- return createMemo((): string | undefined => {- const [err, info] = userInfo.latest;- if (err) return;- return info.name || info.email || 'Macro User';- });-}--export function usePermissions() {- const [userInfo] = useUserInfo();- return createMemo((): MacroPermissions[] | undefined => {- const [err, info] = userInfo.latest;- if (err) return;- return info.permissions || [];- });-}--export function useEmail() {- const [userInfo] = useUserInfo();- return createMemo((): string | undefined => {- const [err, info] = userInfo.latest;- if (err) return;- return info.email;- });-}--export function useUserId() {- const [userInfo] = useUserInfo();- return createMemo((): string | undefined => {- const [err, info] = userInfo.latest;- if (err) return;- return info.userId;- });-}--export function useLicenseStatus() {- const [userInfo] = useUserInfo();- return createMemo((): string | undefined => {- const [err, info] = userInfo.latest;- if (err) return;- return info.licenseStatus;- });-}diff --git a/js/app/packages/service-clients/service-search/generated/models/fileType.ts b/js/app/packages/service-clients/service-search/generated/models/fileType.tsindex c25be98748..ec761d5163 100644--- a/js/app/packages/service-clients/service-search/generated/models/fileType.ts+++ b/js/app/packages/service-clients/service-search/generated/models/fileType.ts@@ -29,422 +29,39 @@ export const FileType = {pdf: 'pdf',md: 'md',canvas: 'canvas',- coffee: 'coffee',- cson: 'cson',- iced: 'iced',- c: 'c',- i: 'i',- cpp: 'cpp',- cppm: 'cppm',- cc: 'cc',- ccm: 'ccm',- cxx: 'cxx',- cxxm: 'cxxm',- cplusplus: 'cplusplus',- cplusplusm: 'cplusplusm',- hpp: 'hpp',- hh: 'hh',- hxx: 'hxx',- hplusplus: 'hplusplus',- h: 'h',- ii: 'ii',- ino: 'ino',- inl: 'inl',- ipp: 'ipp',- ixx: 'ixx',- tpp: 'tpp',- txx: 'txx',- hppin: 'hppin',- hin: 'hin',- cu: 'cu',- cuh: 'cuh',- cs: 'cs',- csx: 'csx',- cake: 'cake',- css: 'css',- dart: 'dart',- diff: 'diff',- patch: 'patch',- rej: 'rej',- dockerfile: 'dockerfile',- containerfile: 'containerfile',- go: 'go',- handlebars: 'handlebars',- hbs: 'hbs',- hjs: 'hjs',- hlsl: 'hlsl',- hlsli: 'hlsli',- fx: 'fx',- fxh: 'fxh',- vsh: 'vsh',- psh: 'psh',- cginc: 'cginc',- compute: 'compute',- html: 'html',- htm: 'htm',- shtml: 'shtml',- xhtml: 'xhtml',- xht: 'xht',- mdoc: 'mdoc',- jsp: 'jsp',- asp: 'asp',- aspx: 'aspx',- jshtm: 'jshtm',- volt: 'volt',- ejs: 'ejs',- rhtml: 'rhtml',- ini: 'ini',- conf: 'conf',- properties: 'properties',- cfg: 'cfg',- directory: 'directory',- gitattributes: 'gitattributes',- gitconfig: 'gitconfig',- gitmodules: 'gitmodules',- editorconfig: 'editorconfig',- repo: 'repo',- java: 'java',- jav: 'jav',- jsx: 'jsx',- js: 'js',- es6: 'es6',- mjs: 'mjs',- cjs: 'cjs',- pac: 'pac',- json: 'json',- bowerrc: 'bowerrc',- jscsrc: 'jscsrc',- webmanifest: 'webmanifest',- jsmap: 'jsmap',- cssmap: 'cssmap',- tsmap: 'tsmap',- har: 'har',- jslintrc: 'jslintrc',- jsonld: 'jsonld',- geojson: 'geojson',- ipynb: 'ipynb',- vuerc: 'vuerc',- jsonc: 'jsonc',- eslintrc: 'eslintrc',- eslintrcjson: 'eslintrcjson',- jsfmtrc: 'jsfmtrc',- jshintrc: 'jshintrc',- swcrc: 'swcrc',- hintrc: 'hintrc',- babelrc: 'babelrc',- jsonl: 'jsonl',- ndjson: 'ndjson',- codesnippets: 'codesnippets',- jl: 'jl',- jmd: 'jmd',- sty: 'sty',- cls: 'cls',- bbx: 'bbx',- cbx: 'cbx',- tex: 'tex',- ltx: 'ltx',- ctx: 'ctx',- bib: 'bib',- less: 'less',- log: 'log',- lua: 'lua',- mak: 'mak',- mk: 'mk',- mkd: 'mkd',- mdwn: 'mdwn',- mdown: 'mdown',- markdown: 'markdown',- markdn: 'markdn',- mdtxt: 'mdtxt',- mdtext: 'mdtext',- workbook: 'workbook',- m: 'm',- mm: 'mm',- pl: 'pl',- pm: 'pm',- pod: 'pod',- t: 't',- psgi: 'psgi',- raku: 'raku',- rakumod: 'rakumod',- rakutest: 'rakutest',- rakudoc: 'rakudoc',- nqp: 'nqp',- p6: 'p6',- pl6: 'pl6',- pm6: 'pm6',- php: 'php',- php4: 'php4',- php5: 'php5',- phtml: 'phtml',- ctp: 'ctp',- ps1: 'ps1',- psm1: 'psm1',- psd1: 'psd1',- pssc: 'pssc',- psrc: 'psrc',py: 'py',- rpy: 'rpy',- pyw: 'pyw',- cpy: 'cpy',- gyp: 'gyp',- gypi: 'gypi',- pyi: 'pyi',- ipy: 'ipy',- pyt: 'pyt',- r: 'r',- rhistory: 'rhistory',- rprofile: 'rprofile',- rt: 'rt',- cshtml: 'cshtml',- razor: 'razor',- rb: 'rb',- rbx: 'rbx',- rjs: 'rjs',- gemspec: 'gemspec',- rake: 'rake',- ru: 'ru',- erb: 'erb',- podspec: 'podspec',- rbi: 'rbi',- rs: 'rs',- scss: 'scss',- sass: 'sass',- shader: 'shader',- sh: 'sh',- bash: 'bash',- bashrc: 'bashrc',- bashaliases: 'bashaliases',- bashprofile: 'bashprofile',- bashlogin: 'bashlogin',- ebuild: 'ebuild',- eclass: 'eclass',- profile: 'profile',- bashlogout: 'bashlogout',- xprofile: 'xprofile',- xsession: 'xsession',- xsessionrc: 'xsessionrc',- zsh: 'zsh',- zshrc: 'zshrc',- zprofile: 'zprofile',- zlogin: 'zlogin',- zlogout: 'zlogout',- zshenv: 'zshenv',- zshtheme: 'zshtheme',- fish: 'fish',- ksh: 'ksh',- csh: 'csh',- cshrc: 'cshrc',- tcshrc: 'tcshrc',- yashrc: 'yashrc',- yashprofile: 'yashprofile',- sql: 'sql',- dsql: 'dsql',- swift: 'swift',+ js: 'js',ts: 'ts',- cts: 'cts',- mts: 'mts',+ jsx: 'jsx',tsx: 'tsx',- tsbuildinfo: 'tsbuildinfo',+ json: 'json',+ html: 'html',+ css: 'css',xml: 'xml',- xsd: 'xsd',- ascx: 'ascx',- atom: 'atom',- axml: 'axml',- axaml: 'axaml',- bpmn: 'bpmn',- cpt: 'cpt',- csl: 'csl',- csproj: 'csproj',- csprojuser: 'csprojuser',- dita: 'dita',- ditamap: 'ditamap',- dtd: 'dtd',- ent: 'ent',- mod: 'mod',- dtml: 'dtml',- fsproj: 'fsproj',- fxml: 'fxml',- iml: 'iml',- isml: 'isml',- jmx: 'jmx',- launch: 'launch',- menu: 'menu',- mxml: 'mxml',- nuspec: 'nuspec',- opml: 'opml',- owl: 'owl',- proj: 'proj',- props: 'props',- pt: 'pt',- publishsettings: 'publishsettings',- pubxml: 'pubxml',- pubxmluser: 'pubxmluser',- rbxlx: 'rbxlx',- rbxmx: 'rbxmx',- rdf: 'rdf',- rng: 'rng',- rss: 'rss',- shproj: 'shproj',- storyboard: 'storyboard',- targets: 'targets',- tld: 'tld',- tmx: 'tmx',- vbproj: 'vbproj',- vbprojuser: 'vbprojuser',- vcxproj: 'vcxproj',- vcxprojfilters: 'vcxprojfilters',- wsdl: 'wsdl',- wxi: 'wxi',- wxl: 'wxl',- wxs: 'wxs',- xaml: 'xaml',- xbl: 'xbl',- xib: 'xib',- xlf: 'xlf',- xliff: 'xliff',- xpdl: 'xpdl',- xul: 'xul',- xoml: 'xoml',- xsl: 'xsl',- xslt: 'xslt',yaml: 'yaml',yml: 'yml',- eyaml: 'eyaml',- eyml: 'eyml',- cff: 'cff',- yamltmlanguage: 'yamltmlanguage',- yamltmpreferences: 'yamltmpreferences',- yamltmtheme: 'yamltmtheme',- winget: 'winget',+ sql: 'sql',+ sh: 'sh',+ bash: 'bash',+ markdown: 'markdown',txt: 'txt',csv: 'csv',- tsv: 'tsv',jpeg: 'jpeg',jpg: 'jpg',png: 'png',gif: 'gif',svg: 'svg',webp: 'webp',- avif: 'avif',- bmp: 'bmp',- ico: 'ico',- tiff: 'tiff',- tif: 'tif',heic: 'heic',heif: 'heif',+ zip: 'zip',tar: 'tar',targz: 'targz',tgz: 'tgz',gz: 'gz',- bz2: 'bz2',- tarbz2: 'tarbz2',- tbz2: 'tbz2',- z: 'z',- tarz: 'tarz',- lz: 'lz',- tarlz: 'tarlz',- xz: 'xz',- tarxz: 'tarxz',- txz: 'txz',- lzma: 'lzma',- tarlzma: 'tarlzma',- rar: 'rar',- sevenz: 'sevenz',- zst: 'zst',- tarzst: 'tarzst',- tzst: 'tzst',- zip: 'zip',- exe: 'exe',- msi: 'msi',- dll: 'dll',- bat: 'bat',- cmd: 'cmd',- com: 'com',- appimage: 'appimage',- app: 'app',- bin: 'bin',- deb: 'deb',- rpm: 'rpm',- apk: 'apk',- dmg: 'dmg',- pkg: 'pkg',- crx: 'crx',- xpi: 'xpi',- mp3: 'mp3',- wav: 'wav',- ogg: 'ogg',- flac: 'flac',- aac: 'aac',- m4a: 'm4a',- wma: 'wma',- mid: 'mid',- midi: 'midi',mp4: 'mp4',- mkv: 'mkv',- webm: 'webm',- avi: 'avi',- mov: 'mov',- wmv: 'wmv',- mpg: 'mpg',- mpeg: 'mpeg',- m4v: 'm4v',- flv: 'flv',- f4v: 'f4v',- threegp: 'threegp',- ttf: 'ttf',- otf: 'otf',- woff: 'woff',- woff2: 'woff2',- eot: 'eot',- rtf: 'rtf',- odt: 'odt',- ods: 'ods',- odp: 'odp',- odg: 'odg',- odf: 'odf',- epub: 'epub',- mobi: 'mobi',- azw: 'azw',- azw3: 'azw3',- djvu: 'djvu',xls: 'xls',ppt: 'ppt',pptx: 'pptx',xlsx: 'xlsx',- db: 'db',- sqlite: 'sqlite',- sqlite3: 'sqlite3',- mdb: 'mdb',- accdb: 'accdb',- dbf: 'dbf',- plist: 'plist',- toml: 'toml',- env: 'env',- dot: 'dot',- gv: 'gv',- torrent: 'torrent',- ics: 'ics',- vcf: 'vcf',- ai: 'ai',- eps: 'eps',- ps: 'ps',- dxf: 'dxf',- dwg: 'dwg',- stl: 'stl',- obj: 'obj',- fbx: 'fbx',- blend: 'blend',- dae: 'dae',- threeds: 'threeds',- gltf: 'gltf',- glb: 'glb',- vhd: 'vhd',- vhdx: 'vhdx',- vmdk: 'vmdk',- ova: 'ova',- ovf: 'ovf',- iso: 'iso',- img: 'img',- swf: 'swf',} as const;diff --git a/js/app/packages/service-clients/service-search/openapi.json b/js/app/packages/service-clients/service-search/openapi.jsonindex af0934556b..4333e3a4d4 100644--- a/js/app/packages/service-clients/service-search/openapi.json+++ b/js/app/packages/service-clients/service-search/openapi.json@@ -1123,424 +1123,41 @@"pdf","md","canvas",- "coffee",- "cson",- "iced",- "c",- "i",- "cpp",- "cppm",- "cc",- "ccm",- "cxx",- "cxxm",- "cplusplus",- "cplusplusm",- "hpp",- "hh",- "hxx",- "hplusplus",- "h",- "ii",- "ino",- "inl",- "ipp",- "ixx",- "tpp",- "txx",- "hppin",- "hin",- "cu",- "cuh",- "cs",- "csx",- "cake",- "css",- "dart",- "diff",- "patch",- "rej",- "dockerfile",- "containerfile",- "go",- "handlebars",- "hbs",- "hjs",- "hlsl",- "hlsli",- "fx",- "fxh",- "vsh",- "psh",- "cginc",- "compute",- "html",- "htm",- "shtml",- "xhtml",- "xht",- "mdoc",- "jsp",- "asp",- "aspx",- "jshtm",- "volt",- "ejs",- "rhtml",- "ini",- "conf",- "properties",- "cfg",- "directory",- "gitattributes",- "gitconfig",- "gitmodules",- "editorconfig",- "repo",- "java",- "jav",- "jsx",- "js",- "es6",- "mjs",- "cjs",- "pac",- "json",- "bowerrc",- "jscsrc",- "webmanifest",- "jsmap",- "cssmap",- "tsmap",- "har",- "jslintrc",- "jsonld",- "geojson",- "ipynb",- "vuerc",- "jsonc",- "eslintrc",- "eslintrcjson",- "jsfmtrc",- "jshintrc",- "swcrc",- "hintrc",- "babelrc",- "jsonl",- "ndjson",- "codesnippets",- "jl",- "jmd",- "sty",- "cls",- "bbx",- "cbx",- "tex",- "ltx",- "ctx",- "bib",- "less",- "log",- "lua",- "mak",- "mk",- "mkd",- "mdwn",- "mdown",- "markdown",- "markdn",- "mdtxt",- "mdtext",- "workbook",- "m",- "mm",- "pl",- "pm",- "pod",- "t",- "psgi",- "raku",- "rakumod",- "rakutest",- "rakudoc",- "nqp",- "p6",- "pl6",- "pm6",- "php",- "php4",- "php5",- "phtml",- "ctp",- "ps1",- "psm1",- "psd1",- "pssc",- "psrc","py",- "rpy",- "pyw",- "cpy",- "gyp",- "gypi",- "pyi",- "ipy",- "pyt",- "r",- "rhistory",- "rprofile",- "rt",- "cshtml",- "razor",- "rb",- "rbx",- "rjs",- "gemspec",- "rake",- "ru",- "erb",- "podspec",- "rbi",- "rs",- "scss",- "sass",- "shader",- "sh",- "bash",- "bashrc",- "bashaliases",- "bashprofile",- "bashlogin",- "ebuild",- "eclass",- "profile",- "bashlogout",- "xprofile",- "xsession",- "xsessionrc",- "zsh",- "zshrc",- "zprofile",- "zlogin",- "zlogout",- "zshenv",- "zshtheme",- "fish",- "ksh",- "csh",- "cshrc",- "tcshrc",- "yashrc",- "yashprofile",- "sql",- "dsql",- "swift",+ "js","ts",- "cts",- "mts",+ "jsx","tsx",- "tsbuildinfo",+ "json",+ "html",+ "css","xml",- "xsd",- "ascx",- "atom",- "axml",- "axaml",- "bpmn",- "cpt",- "csl",- "csproj",- "csprojuser",- "dita",- "ditamap",- "dtd",- "ent",- "mod",- "dtml",- "fsproj",- "fxml",- "iml",- "isml",- "jmx",- "launch",- "menu",- "mxml",- "nuspec",- "opml",- "owl",- "proj",- "props",- "pt",- "publishsettings",- "pubxml",- "pubxmluser",- "rbxlx",- "rbxmx",- "rdf",- "rng",- "rss",- "shproj",- "storyboard",- "targets",- "tld",- "tmx",- "vbproj",- "vbprojuser",- "vcxproj",- "vcxprojfilters",- "wsdl",- "wxi",- "wxl",- "wxs",- "xaml",- "xbl",- "xib",- "xlf",- "xliff",- "xpdl",- "xul",- "xoml",- "xsl",- "xslt","yaml","yml",- "eyaml",- "eyml",- "cff",- "yamltmlanguage",- "yamltmpreferences",- "yamltmtheme",- "winget",+ "sql",+ "sh",+ "bash",+ "markdown","txt","csv",- "tsv","jpeg","jpg","png","gif","svg","webp",- "avif",- "bmp",- "ico",- "tiff",- "tif","heic","heif",+ "zip","tar","targz","tgz","gz",- "bz2",- "tarbz2",- "tbz2",- "z",- "tarz",- "lz",- "tarlz",- "xz",- "tarxz",- "txz",- "lzma",- "tarlzma",- "rar",- "sevenz",- "zst",- "tarzst",- "tzst",- "zip",- "exe",- "msi",- "dll",- "bat",- "cmd",- "com",- "appimage",- "app",- "bin",- "deb",- "rpm",- "apk",- "dmg",- "pkg",- "crx",- "xpi",- "mp3",- "wav",- "ogg",- "flac",- "aac",- "m4a",- "wma",- "mid",- "midi","mp4",- "mkv",- "webm",- "avi",- "mov",- "wmv",- "mpg",- "mpeg",- "m4v",- "flv",- "f4v",- "threegp",- "ttf",- "otf",- "woff",- "woff2",- "eot",- "rtf",- "odt",- "ods",- "odp",- "odg",- "odf",- "epub",- "mobi",- "azw",- "azw3",- "djvu","xls","ppt","pptx",- "xlsx",- "db",- "sqlite",- "sqlite3",- "mdb",- "accdb",- "dbf",- "plist",- "toml",- "env",- "dot",- "gv",- "torrent",- "ics",- "vcf",- "ai",- "eps",- "ps",- "dxf",- "dwg",- "stl",- "obj",- "fbx",- "blend",- "dae",- "threeds",- "gltf",- "glb",- "vhd",- "vhdx",- "vmdk",- "ova",- "ovf",- "iso",- "img",- "swf"+ "xlsx"]},"MatchType": {diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/fileType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/fileType.tsindex abda6c0513..3a7fa7a4a6 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/fileType.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/fileType.ts@@ -29,422 +29,39 @@ export const FileType = {pdf: 'pdf',md: 'md',canvas: 'canvas',- coffee: 'coffee',- cson: 'cson',- iced: 'iced',- c: 'c',- i: 'i',- cpp: 'cpp',- cppm: 'cppm',- cc: 'cc',- ccm: 'ccm',- cxx: 'cxx',- cxxm: 'cxxm',- cplusplus: 'cplusplus',- cplusplusm: 'cplusplusm',- hpp: 'hpp',- hh: 'hh',- hxx: 'hxx',- hplusplus: 'hplusplus',- h: 'h',- ii: 'ii',- ino: 'ino',- inl: 'inl',- ipp: 'ipp',- ixx: 'ixx',- tpp: 'tpp',- txx: 'txx',- hppin: 'hppin',- hin: 'hin',- cu: 'cu',- cuh: 'cuh',- cs: 'cs',- csx: 'csx',- cake: 'cake',- css: 'css',- dart: 'dart',- diff: 'diff',- patch: 'patch',- rej: 'rej',- dockerfile: 'dockerfile',- containerfile: 'containerfile',- go: 'go',- handlebars: 'handlebars',- hbs: 'hbs',- hjs: 'hjs',- hlsl: 'hlsl',- hlsli: 'hlsli',- fx: 'fx',- fxh: 'fxh',- vsh: 'vsh',- psh: 'psh',- cginc: 'cginc',- compute: 'compute',- html: 'html',- htm: 'htm',- shtml: 'shtml',- xhtml: 'xhtml',- xht: 'xht',- mdoc: 'mdoc',- jsp: 'jsp',- asp: 'asp',- aspx: 'aspx',- jshtm: 'jshtm',- volt: 'volt',- ejs: 'ejs',- rhtml: 'rhtml',- ini: 'ini',- conf: 'conf',- properties: 'properties',- cfg: 'cfg',- directory: 'directory',- gitattributes: 'gitattributes',- gitconfig: 'gitconfig',- gitmodules: 'gitmodules',- editorconfig: 'editorconfig',- repo: 'repo',- java: 'java',- jav: 'jav',- jsx: 'jsx',- js: 'js',- es6: 'es6',- mjs: 'mjs',- cjs: 'cjs',- pac: 'pac',- json: 'json',- bowerrc: 'bowerrc',- jscsrc: 'jscsrc',- webmanifest: 'webmanifest',- jsmap: 'jsmap',- cssmap: 'cssmap',- tsmap: 'tsmap',- har: 'har',- jslintrc: 'jslintrc',- jsonld: 'jsonld',- geojson: 'geojson',- ipynb: 'ipynb',- vuerc: 'vuerc',- jsonc: 'jsonc',- eslintrc: 'eslintrc',- eslintrcjson: 'eslintrcjson',- jsfmtrc: 'jsfmtrc',- jshintrc: 'jshintrc',- swcrc: 'swcrc',- hintrc: 'hintrc',- babelrc: 'babelrc',- jsonl: 'jsonl',- ndjson: 'ndjson',- codesnippets: 'codesnippets',- jl: 'jl',- jmd: 'jmd',- sty: 'sty',- cls: 'cls',- bbx: 'bbx',- cbx: 'cbx',- tex: 'tex',- ltx: 'ltx',- ctx: 'ctx',- bib: 'bib',- less: 'less',- log: 'log',- lua: 'lua',- mak: 'mak',- mk: 'mk',- mkd: 'mkd',- mdwn: 'mdwn',- mdown: 'mdown',- markdown: 'markdown',- markdn: 'markdn',- mdtxt: 'mdtxt',- mdtext: 'mdtext',- workbook: 'workbook',- m: 'm',- mm: 'mm',- pl: 'pl',- pm: 'pm',- pod: 'pod',- t: 't',- psgi: 'psgi',- raku: 'raku',- rakumod: 'rakumod',- rakutest: 'rakutest',- rakudoc: 'rakudoc',- nqp: 'nqp',- p6: 'p6',- pl6: 'pl6',- pm6: 'pm6',- php: 'php',- php4: 'php4',- php5: 'php5',- phtml: 'phtml',- ctp: 'ctp',- ps1: 'ps1',- psm1: 'psm1',- psd1: 'psd1',- pssc: 'pssc',- psrc: 'psrc',py: 'py',- rpy: 'rpy',- pyw: 'pyw',- cpy: 'cpy',- gyp: 'gyp',- gypi: 'gypi',- pyi: 'pyi',- ipy: 'ipy',- pyt: 'pyt',- r: 'r',- rhistory: 'rhistory',- rprofile: 'rprofile',- rt: 'rt',- cshtml: 'cshtml',- razor: 'razor',- rb: 'rb',- rbx: 'rbx',- rjs: 'rjs',- gemspec: 'gemspec',- rake: 'rake',- ru: 'ru',- erb: 'erb',- podspec: 'podspec',- rbi: 'rbi',- rs: 'rs',- scss: 'scss',- sass: 'sass',- shader: 'shader',- sh: 'sh',- bash: 'bash',- bashrc: 'bashrc',- bashaliases: 'bashaliases',- bashprofile: 'bashprofile',- bashlogin: 'bashlogin',- ebuild: 'ebuild',- eclass: 'eclass',- profile: 'profile',- bashlogout: 'bashlogout',- xprofile: 'xprofile',- xsession: 'xsession',- xsessionrc: 'xsessionrc',- zsh: 'zsh',- zshrc: 'zshrc',- zprofile: 'zprofile',- zlogin: 'zlogin',- zlogout: 'zlogout',- zshenv: 'zshenv',- zshtheme: 'zshtheme',- fish: 'fish',- ksh: 'ksh',- csh: 'csh',- cshrc: 'cshrc',- tcshrc: 'tcshrc',- yashrc: 'yashrc',- yashprofile: 'yashprofile',- sql: 'sql',- dsql: 'dsql',- swift: 'swift',+ js: 'js',ts: 'ts',- cts: 'cts',- mts: 'mts',+ jsx: 'jsx',tsx: 'tsx',- tsbuildinfo: 'tsbuildinfo',+ json: 'json',+ html: 'html',+ css: 'css',xml: 'xml',- xsd: 'xsd',- ascx: 'ascx',- atom: 'atom',- axml: 'axml',- axaml: 'axaml',- bpmn: 'bpmn',- cpt: 'cpt',- csl: 'csl',- csproj: 'csproj',- csprojuser: 'csprojuser',- dita: 'dita',- ditamap: 'ditamap',- dtd: 'dtd',- ent: 'ent',- mod: 'mod',- dtml: 'dtml',- fsproj: 'fsproj',- fxml: 'fxml',- iml: 'iml',- isml: 'isml',- jmx: 'jmx',- launch: 'launch',- menu: 'menu',- mxml: 'mxml',- nuspec: 'nuspec',- opml: 'opml',- owl: 'owl',- proj: 'proj',- props: 'props',- pt: 'pt',- publishsettings: 'publishsettings',- pubxml: 'pubxml',- pubxmluser: 'pubxmluser',- rbxlx: 'rbxlx',- rbxmx: 'rbxmx',- rdf: 'rdf',- rng: 'rng',- rss: 'rss',- shproj: 'shproj',- storyboard: 'storyboard',- targets: 'targets',- tld: 'tld',- tmx: 'tmx',- vbproj: 'vbproj',- vbprojuser: 'vbprojuser',- vcxproj: 'vcxproj',- vcxprojfilters: 'vcxprojfilters',- wsdl: 'wsdl',- wxi: 'wxi',- wxl: 'wxl',- wxs: 'wxs',- xaml: 'xaml',- xbl: 'xbl',- xib: 'xib',- xlf: 'xlf',- xliff: 'xliff',- xpdl: 'xpdl',- xul: 'xul',- xoml: 'xoml',- xsl: 'xsl',- xslt: 'xslt',yaml: 'yaml',yml: 'yml',- eyaml: 'eyaml',- eyml: 'eyml',- cff: 'cff',- yamltmlanguage: 'yamltmlanguage',- yamltmpreferences: 'yamltmpreferences',- yamltmtheme: 'yamltmtheme',- winget: 'winget',+ sql: 'sql',+ sh: 'sh',+ bash: 'bash',+ markdown: 'markdown',txt: 'txt',csv: 'csv',- tsv: 'tsv',jpeg: 'jpeg',jpg: 'jpg',png: 'png',gif: 'gif',svg: 'svg',webp: 'webp',- avif: 'avif',- bmp: 'bmp',- ico: 'ico',- tiff: 'tiff',- tif: 'tif',heic: 'heic',heif: 'heif',+ zip: 'zip',tar: 'tar',targz: 'targz',tgz: 'tgz',gz: 'gz',- bz2: 'bz2',- tarbz2: 'tarbz2',- tbz2: 'tbz2',- z: 'z',- tarz: 'tarz',- lz: 'lz',- tarlz: 'tarlz',- xz: 'xz',- tarxz: 'tarxz',- txz: 'txz',- lzma: 'lzma',- tarlzma: 'tarlzma',- rar: 'rar',- sevenz: 'sevenz',- zst: 'zst',- tarzst: 'tarzst',- tzst: 'tzst',- zip: 'zip',- exe: 'exe',- msi: 'msi',- dll: 'dll',- bat: 'bat',- cmd: 'cmd',- com: 'com',- appimage: 'appimage',- app: 'app',- bin: 'bin',- deb: 'deb',- rpm: 'rpm',- apk: 'apk',- dmg: 'dmg',- pkg: 'pkg',- crx: 'crx',- xpi: 'xpi',- mp3: 'mp3',- wav: 'wav',- ogg: 'ogg',- flac: 'flac',- aac: 'aac',- m4a: 'm4a',- wma: 'wma',- mid: 'mid',- midi: 'midi',mp4: 'mp4',- mkv: 'mkv',- webm: 'webm',- avi: 'avi',- mov: 'mov',- wmv: 'wmv',- mpg: 'mpg',- mpeg: 'mpeg',- m4v: 'm4v',- flv: 'flv',- f4v: 'f4v',- threegp: 'threegp',- ttf: 'ttf',- otf: 'otf',- woff: 'woff',- woff2: 'woff2',- eot: 'eot',- rtf: 'rtf',- odt: 'odt',- ods: 'ods',- odp: 'odp',- odg: 'odg',- odf: 'odf',- epub: 'epub',- mobi: 'mobi',- azw: 'azw',- azw3: 'azw3',- djvu: 'djvu',xls: 'xls',ppt: 'ppt',pptx: 'pptx',xlsx: 'xlsx',- db: 'db',- sqlite: 'sqlite',- sqlite3: 'sqlite3',- mdb: 'mdb',- accdb: 'accdb',- dbf: 'dbf',- plist: 'plist',- toml: 'toml',- env: 'env',- dot: 'dot',- gv: 'gv',- torrent: 'torrent',- ics: 'ics',- vcf: 'vcf',- ai: 'ai',- eps: 'eps',- ps: 'ps',- dxf: 'dxf',- dwg: 'dwg',- stl: 'stl',- obj: 'obj',- fbx: 'fbx',- blend: 'blend',- dae: 'dae',- threeds: 'threeds',- gltf: 'gltf',- glb: 'glb',- vhd: 'vhd',- vhdx: 'vhdx',- vmdk: 'vmdk',- ova: 'ova',- ovf: 'ovf',- iso: 'iso',- img: 'img',- swf: 'swf',} as const;diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.tsindex 360b1044cc..8e8f831cf6 100644--- a/js/app/packages/service-clients/service-storage/generated/zod.ts+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts@@ -3587,424 +3587,41 @@ export const uploadFolderHandlerBody = zod.object({'pdf','md','canvas',- 'coffee',- 'cson',- 'iced',- 'c',- 'i',- 'cpp',- 'cppm',- 'cc',- 'ccm',- 'cxx',- 'cxxm',- 'cplusplus',- 'cplusplusm',- 'hpp',- 'hh',- 'hxx',- 'hplusplus',- 'h',- 'ii',- 'ino',- 'inl',- 'ipp',- 'ixx',- 'tpp',- 'txx',- 'hppin',- 'hin',- 'cu',- 'cuh',- 'cs',- 'csx',- 'cake',- 'css',- 'dart',- 'diff',- 'patch',- 'rej',- 'dockerfile',- 'containerfile',- 'go',- 'handlebars',- 'hbs',- 'hjs',- 'hlsl',- 'hlsli',- 'fx',- 'fxh',- 'vsh',- 'psh',- 'cginc',- 'compute',- 'html',- 'htm',- 'shtml',- 'xhtml',- 'xht',- 'mdoc',- 'jsp',- 'asp',- 'aspx',- 'jshtm',- 'volt',- 'ejs',- 'rhtml',- 'ini',- 'conf',- 'properties',- 'cfg',- 'directory',- 'gitattributes',- 'gitconfig',- 'gitmodules',- 'editorconfig',- 'repo',- 'java',- 'jav',- 'jsx',- 'js',- 'es6',- 'mjs',- 'cjs',- 'pac',- 'json',- 'bowerrc',- 'jscsrc',- 'webmanifest',- 'jsmap',- 'cssmap',- 'tsmap',- 'har',- 'jslintrc',- 'jsonld',- 'geojson',- 'ipynb',- 'vuerc',- 'jsonc',- 'eslintrc',- 'eslintrcjson',- 'jsfmtrc',- 'jshintrc',- 'swcrc',- 'hintrc',- 'babelrc',- 'jsonl',- 'ndjson',- 'codesnippets',- 'jl',- 'jmd',- 'sty',- 'cls',- 'bbx',- 'cbx',- 'tex',- 'ltx',- 'ctx',- 'bib',- 'less',- 'log',- 'lua',- 'mak',- 'mk',- 'mkd',- 'mdwn',- 'mdown',- 'markdown',- 'markdn',- 'mdtxt',- 'mdtext',- 'workbook',- 'm',- 'mm',- 'pl',- 'pm',- 'pod',- 't',- 'psgi',- 'raku',- 'rakumod',- 'rakutest',- 'rakudoc',- 'nqp',- 'p6',- 'pl6',- 'pm6',- 'php',- 'php4',- 'php5',- 'phtml',- 'ctp',- 'ps1',- 'psm1',- 'psd1',- 'pssc',- 'psrc','py',- 'rpy',- 'pyw',- 'cpy',- 'gyp',- 'gypi',- 'pyi',- 'ipy',- 'pyt',- 'r',- 'rhistory',- 'rprofile',- 'rt',- 'cshtml',- 'razor',- 'rb',- 'rbx',- 'rjs',- 'gemspec',- 'rake',- 'ru',- 'erb',- 'podspec',- 'rbi',- 'rs',- 'scss',- 'sass',- 'shader',- 'sh',- 'bash',- 'bashrc',- 'bashaliases',- 'bashprofile',- 'bashlogin',- 'ebuild',- 'eclass',- 'profile',- 'bashlogout',- 'xprofile',- 'xsession',- 'xsessionrc',- 'zsh',- 'zshrc',- 'zprofile',- 'zlogin',- 'zlogout',- 'zshenv',- 'zshtheme',- 'fish',- 'ksh',- 'csh',- 'cshrc',- 'tcshrc',- 'yashrc',- 'yashprofile',- 'sql',- 'dsql',- 'swift',+ 'js','ts',- 'cts',- 'mts',+ 'jsx','tsx',- 'tsbuildinfo',+ 'json',+ 'html',+ 'css','xml',- 'xsd',- 'ascx',- 'atom',- 'axml',- 'axaml',- 'bpmn',- 'cpt',- 'csl',- 'csproj',- 'csprojuser',- 'dita',- 'ditamap',- 'dtd',- 'ent',- 'mod',- 'dtml',- 'fsproj',- 'fxml',- 'iml',- 'isml',- 'jmx',- 'launch',- 'menu',- 'mxml',- 'nuspec',- 'opml',- 'owl',- 'proj',- 'props',- 'pt',- 'publishsettings',- 'pubxml',- 'pubxmluser',- 'rbxlx',- 'rbxmx',- 'rdf',- 'rng',- 'rss',- 'shproj',- 'storyboard',- 'targets',- 'tld',- 'tmx',- 'vbproj',- 'vbprojuser',- 'vcxproj',- 'vcxprojfilters',- 'wsdl',- 'wxi',- 'wxl',- 'wxs',- 'xaml',- 'xbl',- 'xib',- 'xlf',- 'xliff',- 'xpdl',- 'xul',- 'xoml',- 'xsl',- 'xslt','yaml','yml',- 'eyaml',- 'eyml',- 'cff',- 'yamltmlanguage',- 'yamltmpreferences',- 'yamltmtheme',- 'winget',+ 'sql',+ 'sh',+ 'bash',+ 'markdown','txt','csv',- 'tsv','jpeg','jpg','png','gif','svg','webp',- 'avif',- 'bmp',- 'ico',- 'tiff',- 'tif','heic','heif',+ 'zip','tar','targz','tgz','gz',- 'bz2',- 'tarbz2',- 'tbz2',- 'z',- 'tarz',- 'lz',- 'tarlz',- 'xz',- 'tarxz',- 'txz',- 'lzma',- 'tarlzma',- 'rar',- 'sevenz',- 'zst',- 'tarzst',- 'tzst',- 'zip',- 'exe',- 'msi',- 'dll',- 'bat',- 'cmd',- 'com',- 'appimage',- 'app',- 'bin',- 'deb',- 'rpm',- 'apk',- 'dmg',- 'pkg',- 'crx',- 'xpi',- 'mp3',- 'wav',- 'ogg',- 'flac',- 'aac',- 'm4a',- 'wma',- 'mid',- 'midi','mp4',- 'mkv',- 'webm',- 'avi',- 'mov',- 'wmv',- 'mpg',- 'mpeg',- 'm4v',- 'flv',- 'f4v',- 'threegp',- 'ttf',- 'otf',- 'woff',- 'woff2',- 'eot',- 'rtf',- 'odt',- 'ods',- 'odp',- 'odg',- 'odf',- 'epub',- 'mobi',- 'azw',- 'azw3',- 'djvu','xls','ppt','pptx','xlsx',- 'db',- 'sqlite',- 'sqlite3',- 'mdb',- 'accdb',- 'dbf',- 'plist',- 'toml',- 'env',- 'dot',- 'gv',- 'torrent',- 'ics',- 'vcf',- 'ai',- 'eps',- 'ps',- 'dxf',- 'dwg',- 'stl',- 'obj',- 'fbx',- 'blend',- 'dae',- 'threeds',- 'gltf',- 'glb',- 'vhd',- 'vhdx',- 'vmdk',- 'ova',- 'ovf',- 'iso',- 'img',- 'swf',]).describe('Generates a FileType enum and associated ContentType enum with their implementations.\n\nThis macro takes a list of tuples in the format:\n(Variant, \"extension\", \"mime_type\", CONTENT_TYPE_VARIANT)\n\nFor each tuple it generates:\n- A variant in the FileType enum\n- A variant in the ContentType enum\n- Implementations for:\n - FileType::to_str() - Converts FileType to extension string\n - FileType::from_str() - Converts extension string to FileType\n - From<FileType> for ContentType - Maps FileType to ContentType\n - ContentType::mime_type() - Gets MIME type for ContentType\n'@@ -4081,424 +3698,41 @@ export const uploadFolderHandlerResponse = zod.object({'pdf','md','canvas',- 'coffee',- 'cson',- 'iced',- 'c',- 'i',- 'cpp',- 'cppm',- 'cc',- 'ccm',- 'cxx',- 'cxxm',- 'cplusplus',- 'cplusplusm',- 'hpp',- 'hh',- 'hxx',- 'hplusplus',- 'h',- 'ii',- 'ino',- 'inl',- 'ipp',- 'ixx',- 'tpp',- 'txx',- 'hppin',- 'hin',- 'cu',- 'cuh',- 'cs',- 'csx',- 'cake',- 'css',- 'dart',- 'diff',- 'patch',- 'rej',- 'dockerfile',- 'containerfile',- 'go',- 'handlebars',- 'hbs',- 'hjs',- 'hlsl',- 'hlsli',- 'fx',- 'fxh',- 'vsh',- 'psh',- 'cginc',- 'compute',- 'html',- 'htm',- 'shtml',- 'xhtml',- 'xht',- 'mdoc',- 'jsp',- 'asp',- 'aspx',- 'jshtm',- 'volt',- 'ejs',- 'rhtml',- 'ini',- 'conf',- 'properties',- 'cfg',- 'directory',- 'gitattributes',- 'gitconfig',- 'gitmodules',- 'editorconfig',- 'repo',- 'java',- 'jav',- 'jsx',- 'js',- 'es6',- 'mjs',- 'cjs',- 'pac',- 'json',- 'bowerrc',- 'jscsrc',- 'webmanifest',- 'jsmap',- 'cssmap',- 'tsmap',- 'har',- 'jslintrc',- 'jsonld',- 'geojson',- 'ipynb',- 'vuerc',- 'jsonc',- 'eslintrc',- 'eslintrcjson',- 'jsfmtrc',- 'jshintrc',- 'swcrc',- 'hintrc',- 'babelrc',- 'jsonl',- 'ndjson',- 'codesnippets',- 'jl',- 'jmd',- 'sty',- 'cls',- 'bbx',- 'cbx',- 'tex',- 'ltx',- 'ctx',- 'bib',- 'less',- 'log',- 'lua',- 'mak',- 'mk',- 'mkd',- 'mdwn',- 'mdown',- 'markdown',- 'markdn',- 'mdtxt',- 'mdtext',- 'workbook',- 'm',- 'mm',- 'pl',- 'pm',- 'pod',- 't',- 'psgi',- 'raku',- 'rakumod',- 'rakutest',- 'rakudoc',- 'nqp',- 'p6',- 'pl6',- 'pm6',- 'php',- 'php4',- 'php5',- 'phtml',- 'ctp',- 'ps1',- 'psm1',- 'psd1',- 'pssc',- 'psrc','py',- 'rpy',- 'pyw',- 'cpy',- 'gyp',- 'gypi',- 'pyi',- 'ipy',- 'pyt',- 'r',- 'rhistory',- 'rprofile',- 'rt',- 'cshtml',- 'razor',- 'rb',- 'rbx',- 'rjs',- 'gemspec',- 'rake',- 'ru',- 'erb',- 'podspec',- 'rbi',- 'rs',- 'scss',- 'sass',- 'shader',- 'sh',- 'bash',- 'bashrc',- 'bashaliases',- 'bashprofile',- 'bashlogin',- 'ebuild',- 'eclass',- 'profile',- 'bashlogout',- 'xprofile',- 'xsession',- 'xsessionrc',- 'zsh',- 'zshrc',- 'zprofile',- 'zlogin',- 'zlogout',- 'zshenv',- 'zshtheme',- 'fish',- 'ksh',- 'csh',- 'cshrc',- 'tcshrc',- 'yashrc',- 'yashprofile',- 'sql',- 'dsql',- 'swift',+ 'js','ts',- 'cts',- 'mts',+ 'jsx','tsx',- 'tsbuildinfo',+ 'json',+ 'html',+ 'css','xml',- 'xsd',- 'ascx',- 'atom',- 'axml',- 'axaml',- 'bpmn',- 'cpt',- 'csl',- 'csproj',- 'csprojuser',- 'dita',- 'ditamap',- 'dtd',- 'ent',- 'mod',- 'dtml',- 'fsproj',- 'fxml',- 'iml',- 'isml',- 'jmx',- 'launch',- 'menu',- 'mxml',- 'nuspec',- 'opml',- 'owl',- 'proj',- 'props',- 'pt',- 'publishsettings',- 'pubxml',- 'pubxmluser',- 'rbxlx',- 'rbxmx',- 'rdf',- 'rng',- 'rss',- 'shproj',- 'storyboard',- 'targets',- 'tld',- 'tmx',- 'vbproj',- 'vbprojuser',- 'vcxproj',- 'vcxprojfilters',- 'wsdl',- 'wxi',- 'wxl',- 'wxs',- 'xaml',- 'xbl',- 'xib',- 'xlf',- 'xliff',- 'xpdl',- 'xul',- 'xoml',- 'xsl',- 'xslt','yaml','yml',- 'eyaml',- 'eyml',- 'cff',- 'yamltmlanguage',- 'yamltmpreferences',- 'yamltmtheme',- 'winget',+ 'sql',+ 'sh',+ 'bash',+ 'markdown','txt','csv',- 'tsv','jpeg','jpg','png','gif','svg','webp',- 'avif',- 'bmp',- 'ico',- 'tiff',- 'tif','heic','heif',+ 'zip','tar','targz','tgz','gz',- 'bz2',- 'tarbz2',- 'tbz2',- 'z',- 'tarz',- 'lz',- 'tarlz',- 'xz',- 'tarxz',- 'txz',- 'lzma',- 'tarlzma',- 'rar',- 'sevenz',- 'zst',- 'tarzst',- 'tzst',- 'zip',- 'exe',- 'msi',- 'dll',- 'bat',- 'cmd',- 'com',- 'appimage',- 'app',- 'bin',- 'deb',- 'rpm',- 'apk',- 'dmg',- 'pkg',- 'crx',- 'xpi',- 'mp3',- 'wav',- 'ogg',- 'flac',- 'aac',- 'm4a',- 'wma',- 'mid',- 'midi','mp4',- 'mkv',- 'webm',- 'avi',- 'mov',- 'wmv',- 'mpg',- 'mpeg',- 'm4v',- 'flv',- 'f4v',- 'threegp',- 'ttf',- 'otf',- 'woff',- 'woff2',- 'eot',- 'rtf',- 'odt',- 'ods',- 'odp',- 'odg',- 'odf',- 'epub',- 'mobi',- 'azw',- 'azw3',- 'djvu','xls','ppt','pptx','xlsx',- 'db',- 'sqlite',- 'sqlite3',- 'mdb',- 'accdb',- 'dbf',- 'plist',- 'toml',- 'env',- 'dot',- 'gv',- 'torrent',- 'ics',- 'vcf',- 'ai',- 'eps',- 'ps',- 'dxf',- 'dwg',- 'stl',- 'obj',- 'fbx',- 'blend',- 'dae',- 'threeds',- 'gltf',- 'glb',- 'vhd',- 'vhdx',- 'vmdk',- 'ova',- 'ovf',- 'iso',- 'img',- 'swf',]).describe('Generates a FileType enum and associated ContentType enum with their implementations.\n\nThis macro takes a list of tuples in the format:\n(Variant, \"extension\", \"mime_type\", CONTENT_TYPE_VARIANT)\n\nFor each tuple it generates:\n- A variant in the FileType enum\n- A variant in the ContentType enum\n- Implementations for:\n - FileType::to_str() - Converts FileType to extension string\n - FileType::from_str() - Converts extension string to FileType\n - From<FileType> for ContentType - Maps FileType to ContentType\n - ContentType::mime_type() - Gets MIME type for ContentType\n'diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.jsonindex cc96cb3731..f6b8729f0e 100644--- a/js/app/packages/service-clients/service-storage/openapi.json+++ b/js/app/packages/service-clients/service-storage/openapi.json@@ -6178,424 +6178,41 @@"pdf","md","canvas",- "coffee",- "cson",- "iced",- "c",- "i",- "cpp",- "cppm",- "cc",- "ccm",- "cxx",- "cxxm",- "cplusplus",- "cplusplusm",- "hpp",- "hh",- "hxx",- "hplusplus",- "h",- "ii",- "ino",- "inl",- "ipp",- "ixx",- "tpp",- "txx",- "hppin",- "hin",- "cu",- "cuh",- "cs",- "csx",- "cake",- "css",- "dart",- "diff",- "patch",- "rej",- "dockerfile",- "containerfile",- "go",- "handlebars",- "hbs",- "hjs",- "hlsl",- "hlsli",- "fx",- "fxh",- "vsh",- "psh",- "cginc",- "compute",- "html",- "htm",- "shtml",- "xhtml",- "xht",- "mdoc",- "jsp",- "asp",- "aspx",- "jshtm",- "volt",- "ejs",- "rhtml",- "ini",- "conf",- "properties",- "cfg",- "directory",- "gitattributes",- "gitconfig",- "gitmodules",- "editorconfig",- "repo",- "java",- "jav",- "jsx",- "js",- "es6",- "mjs",- "cjs",- "pac",- "json",- "bowerrc",- "jscsrc",- "webmanifest",- "jsmap",- "cssmap",- "tsmap",- "har",- "jslintrc",- "jsonld",- "geojson",- "ipynb",- "vuerc",- "jsonc",- "eslintrc",- "eslintrcjson",- "jsfmtrc",- "jshintrc",- "swcrc",- "hintrc",- "babelrc",- "jsonl",- "ndjson",- "codesnippets",- "jl",- "jmd",- "sty",- "cls",- "bbx",- "cbx",- "tex",- "ltx",- "ctx",- "bib",- "less",- "log",- "lua",- "mak",- "mk",- "mkd",- "mdwn",- "mdown",- "markdown",- "markdn",- "mdtxt",- "mdtext",- "workbook",- "m",- "mm",- "pl",- "pm",- "pod",- "t",- "psgi",- "raku",- "rakumod",- "rakutest",- "rakudoc",- "nqp",- "p6",- "pl6",- "pm6",- "php",- "php4",- "php5",- "phtml",- "ctp",- "ps1",- "psm1",- "psd1",- "pssc",- "psrc","py",- "rpy",- "pyw",- "cpy",- "gyp",- "gypi",- "pyi",- "ipy",- "pyt",- "r",- "rhistory",- "rprofile",- "rt",- "cshtml",- "razor",- "rb",- "rbx",- "rjs",- "gemspec",- "rake",- "ru",- "erb",- "podspec",- "rbi",- "rs",- "scss",- "sass",- "shader",- "sh",- "bash",- "bashrc",- "bashaliases",- "bashprofile",- "bashlogin",- "ebuild",- "eclass",- "profile",- "bashlogout",- "xprofile",- "xsession",- "xsessionrc",- "zsh",- "zshrc",- "zprofile",- "zlogin",- "zlogout",- "zshenv",- "zshtheme",- "fish",- "ksh",- "csh",- "cshrc",- "tcshrc",- "yashrc",- "yashprofile",- "sql",- "dsql",- "swift",+ "js","ts",- "cts",- "mts",+ "jsx","tsx",- "tsbuildinfo",+ "json",+ "html",+ "css","xml",- "xsd",- "ascx",- "atom",- "axml",- "axaml",- "bpmn",- "cpt",- "csl",- "csproj",- "csprojuser",- "dita",- "ditamap",- "dtd",- "ent",- "mod",- "dtml",- "fsproj",- "fxml",- "iml",- "isml",- "jmx",- "launch",- "menu",- "mxml",- "nuspec",- "opml",- "owl",- "proj",- "props",- "pt",- "publishsettings",- "pubxml",- "pubxmluser",- "rbxlx",- "rbxmx",- "rdf",- "rng",- "rss",- "shproj",- "storyboard",- "targets",- "tld",- "tmx",- "vbproj",- "vbprojuser",- "vcxproj",- "vcxprojfilters",- "wsdl",- "wxi",- "wxl",- "wxs",- "xaml",- "xbl",- "xib",- "xlf",- "xliff",- "xpdl",- "xul",- "xoml",- "xsl",- "xslt","yaml","yml",- "eyaml",- "eyml",- "cff",- "yamltmlanguage",- "yamltmpreferences",- "yamltmtheme",- "winget",+ "sql",+ "sh",+ "bash",+ "markdown","txt","csv",- "tsv","jpeg","jpg","png","gif","svg","webp",- "avif",- "bmp",- "ico",- "tiff",- "tif","heic","heif",+ "zip","tar","targz","tgz","gz",- "bz2",- "tarbz2",- "tbz2",- "z",- "tarz",- "lz",- "tarlz",- "xz",- "tarxz",- "txz",- "lzma",- "tarlzma",- "rar",- "sevenz",- "zst",- "tarzst",- "tzst",- "zip",- "exe",- "msi",- "dll",- "bat",- "cmd",- "com",- "appimage",- "app",- "bin",- "deb",- "rpm",- "apk",- "dmg",- "pkg",- "crx",- "xpi",- "mp3",- "wav",- "ogg",- "flac",- "aac",- "m4a",- "wma",- "mid",- "midi","mp4",- "mkv",- "webm",- "avi",- "mov",- "wmv",- "mpg",- "mpeg",- "m4v",- "flv",- "f4v",- "threegp",- "ttf",- "otf",- "woff",- "woff2",- "eot",- "rtf",- "odt",- "ods",- "odp",- "odg",- "odf",- "epub",- "mobi",- "azw",- "azw3",- "djvu","xls","ppt","pptx",- "xlsx",- "db",- "sqlite",- "sqlite3",- "mdb",- "accdb",- "dbf",- "plist",- "toml",- "env",- "dot",- "gv",- "torrent",- "ics",- "vcf",- "ai",- "eps",- "ps",- "dxf",- "dwg",- "stl",- "obj",- "fbx",- "blend",- "dae",- "threeds",- "gltf",- "glb",- "vhd",- "vhdx",- "vmdk",- "ova",- "ovf",- "iso",- "img",- "swf"+ "xlsx"]},"FolderItem": {diff --git a/js/app/packages/service-clients/service-storage/projects.ts b/js/app/packages/service-clients/service-storage/projects.tsindex 561c510a93..ef6a88d83b 100644--- a/js/app/packages/service-clients/service-storage/projects.ts+++ b/js/app/packages/service-clients/service-storage/projects.ts@@ -1,6 +1,6 @@import { ENABLE_PROJECT_SHARING } from '@core/constant/featureFlags';import { isOk, ok } from '@core/util/maybeResult';-import { useUserId } from '@service-gql/client';+import { useUserId } from '@queries/auth/user-info';import { createSingletonRoot } from '@solid-primitives/rootless';import { createMemo, createResource } from 'solid-js';import { v4 as uuidv4 } from 'uuid';diff --git a/js/app/packages/service-clients/service-stripe/client.ts b/js/app/packages/service-clients/service-stripe/client.tsindex 2f66195bfd..325e33bc6e 100644--- a/js/app/packages/service-clients/service-stripe/client.ts+++ b/js/app/packages/service-clients/service-stripe/client.ts@@ -1,28 +1,6 @@-import { ENABLE_BEARER_TOKEN_AUTH } from '@core/constant/featureFlags';-import { SERVER_HOSTS } from '@core/constant/servers';+import { isOk } from '@core/util/maybeResult';import { registerClient } from '@core/util/mockClient';-import { getAccessToken } from '@service-auth/client';-import { LegacyApiRpcClient } from '../../codegen/auth_service/auth_service_rpc';--// Create a singleton instance of the RPC client-let rpcClientInstance: LegacyApiRpcClient | null = null;--async function getRpcClient(): Promise<LegacyApiRpcClient> {- if (!rpcClientInstance) {- const headers = new Headers();-- if (ENABLE_BEARER_TOKEN_AUTH) {- const token = await getAccessToken();- if (token) headers.set('Authorization', `Bearer ${token}`);- }-- rpcClientInstance = LegacyApiRpcClient.construct_with_headers(- `${SERVER_HOSTS['auth-service']}/user`,- () => headers- );- }- return rpcClientInstance;-}+import { authServiceClient } from '@service-auth/client';export const stripeServiceClient = {/**@@ -30,30 +8,36 @@ export const stripeServiceClient = {* @returns The URL of the checkout session*/createCheckoutSession: async (type: string = '', discount?: string) => {- const variables = {+ const result = await authServiceClient.createCheckoutSession({successUrl: `${window.location.origin}/app/?subscriptionSuccess=true${type ? `&type=${type}` : ''}`,cancelUrl: `${window.location.origin}/app`,discount: discount ?? null,- };+ });- const client = await getRpcClient();- const data = await client.create_checkout_session(variables);+ if (!isOk(result)) {+ throw new Error(+ result[0]?.[0]?.message ?? 'Failed to create checkout session'+ );+ }- return data.url;+ return result[1];},/*** Creates a portal session- * @returns+ * @returns The URL of the portal session*/createPortalSession: async () => {- const variables = {+ const result = await authServiceClient.createPortalSession({returnUrl: `${window.location.origin}/app`,- };+ });- const client = await getRpcClient();- const res = await client.create_portal_session(variables);+ if (!isOk(result)) {+ throw new Error(+ result[0]?.[0]?.message ?? 'Failed to create portal session'+ );+ }- return res.url;+ return result[1];},};diff --git a/js/app/tsconfig.json b/js/app/tsconfig.jsonindex 8802b84cf6..0de400168c 100644--- a/js/app/tsconfig.json+++ b/js/app/tsconfig.json@@ -73,9 +73,6 @@"@block-project/*": ["./packages/block-project/*"],- "@service-gql/*": [- "./packages/service-clients/service-gql/*"- ],"@service-auth/*": ["./packages/service-clients/service-auth/*"],diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex 100fd318eb..49e6692435 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -504,23 +504,6 @@ version = "1.1.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"-[[package]]-name = "auth_service_rpc"-version = "0.1.0"-dependencies = [- "axum",- "axum_rpc",- "js-sys",- "reqwest",- "reqwest-middleware",- "serde",- "serde-wasm-bindgen",- "tsify",- "url",- "wasm-bindgen",- "wasm-bindgen-futures",-]-[[package]]name = "authentication_service"version = "0.1.0"@@ -528,7 +511,6 @@ dependencies = ["anyhow","async-stripe","async-stripe-webhook",- "auth_service_rpc","aws-config","aws-sdk-secretsmanager","aws-sdk-sesv2",@@ -3870,19 +3852,6 @@ version = "0.3.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"-[[package]]-name = "gloo-utils"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa"-dependencies = [- "js-sys",- "serde",- "serde_json",- "wasm-bindgen",- "web-sys",-]-[[package]]name = "gmail_client"version = "0.1.0"@@ -7879,17 +7848,6 @@ dependencies = ["serde_derive",]-[[package]]-name = "serde-wasm-bindgen"-version = "0.6.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b"-dependencies = [- "js-sys",- "serde",- "wasm-bindgen",-]-[[package]]name = "serde_core"version = "1.0.228"@@ -9301,31 +9259,6 @@ version = "0.2.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"-[[package]]-name = "tsify"-version = "0.5.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8ec5505497c87f1c050b4392d3f11b49a04537fcb9dc0da57bc0af168a6331f2"-dependencies = [- "gloo-utils",- "serde",- "serde_json",- "tsify-macros",- "wasm-bindgen",-]--[[package]]-name = "tsify-macros"-version = "0.5.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9fc2c44dc9fe4baf55b88e032621b7a11b215a1f0a7de8d0aa04367207d915bc"-dependencies = [- "proc-macro2",- "quote",- "serde_derive_internals",- "syn 2.0.98",-]-[[package]]name = "tungstenite"version = "0.24.0"diff --git a/rust/cloud-storage/authentication_service/Cargo.toml b/rust/cloud-storage/authentication_service/Cargo.tomlindex 6c405baa7e..9eeaeef7fc 100644--- a/rust/cloud-storage/authentication_service/Cargo.toml+++ b/rust/cloud-storage/authentication_service/Cargo.toml@@ -34,9 +34,6 @@ async-stripe = { workspace = true, default-features = false, features = ["runtime-tokio-hyper",] }async-stripe-webhook = { version = "1.0.0-alpha.4", default-features = false }-auth_service_rpc = { path = "../rpc-interface/auth_service", features = [- "server",-] }aws-config = { workspace = true }aws-sdk-secretsmanager = { workspace = true }aws-sdk-sesv2 = { workspace = true }diff --git a/rust/cloud-storage/authentication_service/src/api/swagger.rs b/rust/cloud-storage/authentication_service/src/api/swagger.rsindex 409ffa2c6f..a20021fca1 100644--- a/rust/cloud-storage/authentication_service/src/api/swagger.rs+++ b/rust/cloud-storage/authentication_service/src/api/swagger.rs@@ -22,6 +22,9 @@ use crate::api::user::patch_user_group::PatchUserGroupRequest;use crate::api::user::patch_user_onboarding::PatchUserOnboardingRequest;use crate::api::user::post_get_names::PostGetNamesRequestBody;use crate::api::user::post_get_names_with_email::GetNamesWithEmailRequestBody;+use crate::api::user::stripe::{+ CreateCheckoutSessionRequest, CreatePortalSessionRequest, StripeSessionResponse,+};use crate::api::{email, health, jwt, link, login, logout, merge, oauth, oauth2, permissions, session, team, user,};@@ -87,6 +90,8 @@ use model::user::{user::get_user_quota::handler,user::get_legacy_user_permissions::handler,user::patch_tutorial::handler,+ user::stripe::create_checkout_session,+ user::stripe::create_portal_session,/// /sessionsession::session_login::handler,@@ -146,6 +151,11 @@ use model::user::{GetLegacyUserPermissionsResponse,PatchUserTutorialRequest,+ // Stripe+ CreateCheckoutSessionRequest,+ CreatePortalSessionRequest,+ StripeSessionResponse,+// User onboardingPatchUserGroupRequest,PatchUserOnboardingRequest,diff --git a/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs b/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rsindex a0cbb57066..e42411c9dd 100644--- a/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs+++ b/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs@@ -6,7 +6,6 @@ use axum::{http::StatusCode,response::{IntoResponse, Response},};-use doppleganger::Doppleganger;use macro_middleware::user_permissions::attach_user_permissions::PermissionsExtractor;use macro_user_id::user_id::MacroUserId;use roles_and_permissions::domain::model::PermissionId;@@ -16,8 +15,7 @@ use crate::api::context::ApiContext;use model::response::ErrorResponse;use model::user::UserContext;-#[derive(serde::Serialize, Debug, utoipa::ToSchema, Doppleganger)]-#[dg(forward = auth_service_rpc::GetLegacyUserPermissionsResponse)]+#[derive(serde::Serialize, Debug, utoipa::ToSchema)]#[serde(rename_all = "camelCase")]pub struct GetLegacyUserPermissionsResponse {/// The user id@@ -40,13 +38,18 @@ pub struct GetLegacyUserPermissionsResponse {has_trialed: bool,}-#[derive(serde::Serialize, Debug, utoipa::ToSchema, Doppleganger)]-#[dg(forward = auth_service_rpc::ABGroup)]+#[derive(serde::Serialize, Debug, utoipa::ToSchema)]enum ABGroup {A,B,}+impl IntoResponse for GetLegacyUserPermissionsResponse {+ fn into_response(self) -> Response {+ Json(self).into_response()+ }+}+#[derive(thiserror::Error, Debug)]pub enum GetLegacyUserPermissionsError {#[error("Internal error")]diff --git a/rust/cloud-storage/authentication_service/src/api/user/get_user_organization.rs b/rust/cloud-storage/authentication_service/src/api/user/get_user_organization.rsindex d529ffcfd8..b00fbdda0c 100644--- a/rust/cloud-storage/authentication_service/src/api/user/get_user_organization.rs+++ b/rust/cloud-storage/authentication_service/src/api/user/get_user_organization.rs@@ -5,12 +5,10 @@ use axum::{http::StatusCode,response::{IntoResponse, Response},};-use doppleganger::Doppleganger;use model::response::ErrorResponse;use model::user::UserContext;-#[derive(Debug, serde::Serialize, utoipa::ToSchema, Doppleganger)]-#[dg(forward = auth_service_rpc::UserOrganizationResponse)]+#[derive(Debug, serde::Serialize, utoipa::ToSchema)]#[serde(rename_all = "camelCase")]pub struct UserOrganizationResponse {/// The id of the organizationdiff --git a/rust/cloud-storage/authentication_service/src/api/user/legacy_rpc.rs b/rust/cloud-storage/authentication_service/src/api/user/legacy_rpc.rsdeleted file mode 100644index 5490fe414c..0000000000--- a/rust/cloud-storage/authentication_service/src/api/user/legacy_rpc.rs+++ /dev/null@@ -1,258 +0,0 @@-use std::sync::LazyLock;--use auth_service_rpc::{CreatePortalRequest, LegacyApiErr, LegacyApiRpc, StripeUrlResponse};-use axum::{- Extension, Json,- extract::{FromRef, State},- http::StatusCode,- response::IntoResponse,-};-use doppleganger::Mirror;-use macro_env_var::env_var;-use macro_middleware::user_permissions::attach_user_permissions::PermissionsExtractor;-use model::user::UserContext;-use sqlx::PgPool;-use stripe::{ParseIdError, StripeError};-use thiserror::Error;--use crate::api::{- context::ApiContext,- user::{- get_legacy_user_permissions::{self, GetLegacyUserPermissionsResponse},- get_user_organization,- patch_user_group::{self, PatchUserGroupRequest},- patch_user_onboarding::{self, PatchUserOnboardingRequest},- },-};--#[derive(Clone)]-pub(super) struct AuthRpcState(pub(super) ApiContext);--impl FromRef<AuthRpcState> for PgPool {- fn from_ref(input: &AuthRpcState) -> Self {- input.0.db.clone()- }-}--impl LegacyApiRpc for AuthRpcState {- type GetPermsExtractor = (Extension<UserContext>, PermissionsExtractor);-- async fn get_legacy_user_permissions(- &self,- ctx: Self::GetPermsExtractor,- ) -> Result<auth_service_rpc::GetLegacyUserPermissionsResponse, LegacyApiErr> {- get_legacy_user_permissions::handler(State(self.0.clone()), ctx.0, ctx.1)- .await- .map_err(IntoResponse::into_response)- .map(GetLegacyUserPermissionsResponse::mirror)- }-- type UserExtractor = Extension<UserContext>;-- async fn get_user_organization(- &self,- ctx: Self::UserExtractor,- ) -> Result<Option<auth_service_rpc::UserOrganizationResponse>, LegacyApiErr> {- get_user_organization::handler(State(self.0.clone()), ctx)- .await- .map_err(IntoResponse::into_response)- .map(|r| match r {- get_user_organization::GetUserOrganizationResponse::NoOrganization => None,- get_user_organization::GetUserOrganizationResponse::Organization(- user_organization_response,- ) => Some(get_user_organization::UserOrganizationResponse::mirror(- user_organization_response,- )),- })- }-- async fn patch_user_group(- &self,- ctx: Self::UserExtractor,- req: auth_service_rpc::PatchUserGroupRequest,- ) -> Result<(), LegacyApiErr> {- patch_user_group::handler(- State(self.0.clone()),- ctx,- Json(PatchUserGroupRequest::mirror(req)),- )- .await- .map_err(IntoResponse::into_response)- .map(|_| ())- }-- async fn patch_user_onboarding(- &self,- ctx: Self::UserExtractor,- req: auth_service_rpc::PatchUserOnboardingRequest,- ) -> Result<(), LegacyApiErr> {- patch_user_onboarding::handler(- State(self.0.clone()),- ctx,- Json(PatchUserOnboardingRequest::mirror(req)),- )- .await- .map_err(IntoResponse::into_response)- .map(|_| ())- }-- async fn create_checkout_session(- &self,- ctx: Self::UserExtractor,- req: auth_service_rpc::CreateCheckoutRequest,- ) -> Result<auth_service_rpc::StripeUrlResponse, LegacyApiErr> {- inner_create_checkout(&self.0, ctx, req)- .await- .map_err(IntoResponse::into_response)- }-- async fn create_portal_session(- &self,- ctx: Self::UserExtractor,- req: auth_service_rpc::CreatePortalRequest,- ) -> Result<auth_service_rpc::StripeUrlResponse, LegacyApiErr> {- inner_create_portal(&self.0, ctx, req)- .await- .map_err(IntoResponse::into_response)- }-}--#[derive(Debug, Error)]-enum InnerStripeErr {- #[error("Failed to parse user id")]- ParseId(#[from] macro_user_id::error::ParseErr),- #[error("Internal server error")]- DbErr(#[from] sqlx::Error),- #[error("User does not have a stripe id")]- MissingStripeId,- #[error("Invalid stripe id")]- StripeIdParse(#[from] ParseIdError),- #[error("Internal stripe error")]- StripeErr(#[from] StripeError),- #[error("Invalid promo code")]- PromoCodeNotFound,- #[error("Internal server error")]- UnExpectedStripeResponse,-}--impl IntoResponse for InnerStripeErr {- fn into_response(self) -> axum::response::Response {- let status = match &self {- InnerStripeErr::ParseId(_parse_err) => StatusCode::BAD_REQUEST,- InnerStripeErr::DbErr(_error) => StatusCode::INTERNAL_SERVER_ERROR,- InnerStripeErr::MissingStripeId => StatusCode::BAD_REQUEST,- InnerStripeErr::StripeIdParse(_parse_id_error) => StatusCode::BAD_REQUEST,- InnerStripeErr::StripeErr(_stripe_error) => StatusCode::INTERNAL_SERVER_ERROR,- InnerStripeErr::PromoCodeNotFound => StatusCode::NOT_FOUND,- InnerStripeErr::UnExpectedStripeResponse => StatusCode::INTERNAL_SERVER_ERROR,- };- (status, self.to_string()).into_response()- }-}--env_var!(- struct StripePremiumPriceId;-);--static STRIPE_PRICE_ID: LazyLock<StripePremiumPriceId> = LazyLock::new(|| {- match StripePremiumPriceId::new() {- Ok(var) => var,- // just use this non secret value if the value doesn't exist- Err(_) => StripePremiumPriceId::Comptime("price_1PnSgXJaD7zvQeOBfSYgOmZc"),- }-});--async fn inner_create_checkout(- state: &ApiContext,- ctx: Extension<UserContext>,- req: auth_service_rpc::CreateCheckoutRequest,-) -> Result<auth_service_rpc::StripeUrlResponse, InnerStripeErr> {- let user_id = macro_user_id::user_id::MacroUserId::parse_from_str(&ctx.user_id)?.lowercase();-- // Get the stripe customer ID from the database- let stripe_customer_id =- macro_db_client::user::get::get_stripe_customer_id_by_user_id(&state.db, &user_id)- .await?- .ok_or_else(|| InnerStripeErr::MissingStripeId)?;-- let customer_id: stripe::CustomerId = stripe_customer_id.parse()?;-- // If a discount code is provided, look up the promotion code ID- let promo_code_id = if let Some(ref discount) = req.discount {- let mut list_params = stripe::ListPromotionCodes::new();- list_params.code = Some(discount);- list_params.active = Some(true);- list_params.limit = Some(1);-- let promo_codes = stripe::PromotionCode::list(&state.stripe_client, &list_params).await?;-- let promo_code = promo_codes- .data- .into_iter()- .next()- .ok_or_else(|| InnerStripeErr::PromoCodeNotFound)?;-- Some(promo_code.id)- } else {- None- };-- // Create the checkout session- let params = stripe::CreateCheckoutSession {- customer: Some(customer_id),- mode: Some(stripe::CheckoutSessionMode::Subscription),- success_url: Some(req.success_url.as_str()),- cancel_url: Some(req.cancel_url.as_str()),- allow_promotion_codes: promo_code_id.is_none().then_some(true),- discounts: promo_code_id.map(|id| {- vec![stripe::CreateCheckoutSessionDiscounts {- promotion_code: Some(id.to_string()),- ..Default::default()- }]- }),- // Set up line items- line_items: Some(vec![stripe::CreateCheckoutSessionLineItems {- price: Some(STRIPE_PRICE_ID.as_ref().to_string()),- quantity: Some(1),- ..Default::default()- }]),- ..Default::default()- };-- let session = stripe::CheckoutSession::create(&state.stripe_client, params).await?;-- let url = session- .url- .ok_or_else(|| InnerStripeErr::UnExpectedStripeResponse)?;-- let url = url::Url::parse(&url).map_err(|_| InnerStripeErr::UnExpectedStripeResponse)?;-- Ok(auth_service_rpc::StripeUrlResponse { url })-}--async fn inner_create_portal(- state: &ApiContext,- ctx: Extension<UserContext>,- req: CreatePortalRequest,-) -> Result<StripeUrlResponse, InnerStripeErr> {- let user_id = macro_user_id::user_id::MacroUserId::parse_from_str(&ctx.user_id)?.lowercase();-- // Get the stripe customer ID from the database- let stripe_customer_id =- macro_db_client::user::get::get_stripe_customer_id_by_user_id(&state.db, &user_id)- .await?- .ok_or_else(|| InnerStripeErr::MissingStripeId)?;-- let customer_id: stripe::CustomerId = stripe_customer_id.parse()?;-- // Create the billing portal session- let mut params = stripe::CreateBillingPortalSession::new(customer_id);- params.return_url = Some(req.return_url.as_str());-- let session = stripe::BillingPortalSession::create(&state.stripe_client, params).await?;-- let url =- url::Url::parse(&session.url).map_err(|_| InnerStripeErr::UnExpectedStripeResponse)?;-- Ok(auth_service_rpc::StripeUrlResponse { url })-}diff --git a/rust/cloud-storage/authentication_service/src/api/user/mod.rs b/rust/cloud-storage/authentication_service/src/api/user/mod.rsindex 5dfca2f5a4..f5956c19ef 100644--- a/rust/cloud-storage/authentication_service/src/api/user/mod.rs+++ b/rust/cloud-storage/authentication_service/src/api/user/mod.rs@@ -1,4 +1,3 @@-use auth_service_rpc::LegacyApiRpcRouterBuilder;use axum::{Router,routing::{delete, get, patch, post, put},@@ -7,7 +6,7 @@ use macro_auth::middleware::decode_jwt::JwtValidationArgs;use tower::ServiceBuilder;use tower_cookies::CookieManagerLayer;-use crate::api::{ApiContext, user::legacy_rpc::AuthRpcState};+use crate::api::ApiContext;// needs to be public in api crate for swaggerpub(in crate::api) mod create_user;@@ -18,7 +17,6 @@ pub(in crate::api) mod get_user_info;pub(in crate::api) mod get_user_link_exists;pub(in crate::api) mod get_user_organization;pub(in crate::api) mod get_user_quota;-pub(in crate::api) mod legacy_rpc;pub(in crate::api) mod patch_tutorial;pub(in crate::api) mod patch_user_group;pub(in crate::api) mod patch_user_onboarding;@@ -27,6 +25,7 @@ pub(in crate::api) mod post_get_names_with_email;pub(in crate::api) mod post_profile_pictures;pub(in crate::api) mod put_name;pub(in crate::api) mod put_profile_picture;+pub(in crate::api) mod stripe;pub fn router(state: ApiContext, jwt_args: JwtValidationArgs) -> Router<ApiContext> {Router::new()@@ -38,10 +37,7 @@ pub fn router(state: ApiContext, jwt_args: JwtValidationArgs) -> Router<ApiConte}fn router_with_auth(state: ApiContext, jwt_args: JwtValidationArgs) -> Router<ApiContext> {- let rpc_router = LegacyApiRpcRouterBuilder::new(AuthRpcState(state.clone())).build();-Router::new()- .merge(rpc_router).route("/me", get(get_user_info::handler)).route("/me", delete(delete_user::handler)).route("/profile_pictures", post(post_profile_pictures::handler))@@ -62,6 +58,15 @@ fn router_with_auth(state: ApiContext, jwt_args: JwtValidationArgs) -> Router<Apmacro_middleware::user_permissions::attach_user_permissions::handler,)),)+ .route("/stripe/checkout", post(stripe::create_checkout_session))+ .route("/stripe/portal", post(stripe::create_portal_session))+ .route(+ "/legacy_user_permissions",+ get(get_legacy_user_permissions::handler),+ )+ .route("/organization", get(get_user_organization::handler))+ .route("/group", patch(patch_user_group::handler))+ .route("/onboarding", patch(patch_user_onboarding::handler)).layer(ServiceBuilder::new().layer(CookieManagerLayer::new())diff --git a/rust/cloud-storage/authentication_service/src/api/user/patch_user_group.rs b/rust/cloud-storage/authentication_service/src/api/user/patch_user_group.rsindex 24d4a94639..30501f7035 100644--- a/rust/cloud-storage/authentication_service/src/api/user/patch_user_group.rs+++ b/rust/cloud-storage/authentication_service/src/api/user/patch_user_group.rs@@ -4,7 +4,6 @@ use axum::{http::StatusCode,response::{IntoResponse, Response},};-use doppleganger::Doppleganger;use macro_user_id::user_id::MacroUserId;use crate::api::context::ApiContext;@@ -15,8 +14,7 @@ use model::{};use utoipa::ToSchema;-#[derive(Default, Debug, serde::Serialize, serde::Deserialize, ToSchema, Doppleganger)]-#[dg(backward = auth_service_rpc::PatchUserGroupRequest)]+#[derive(Default, Debug, serde::Serialize, serde::Deserialize, ToSchema)]pub struct PatchUserGroupRequest {/// The group to add the user topub group: String,diff --git a/rust/cloud-storage/authentication_service/src/api/user/patch_user_onboarding.rs b/rust/cloud-storage/authentication_service/src/api/user/patch_user_onboarding.rsindex cd4d8d41e9..4273179fee 100644--- a/rust/cloud-storage/authentication_service/src/api/user/patch_user_onboarding.rs+++ b/rust/cloud-storage/authentication_service/src/api/user/patch_user_onboarding.rs@@ -4,7 +4,6 @@ use axum::{http::StatusCode,response::{IntoResponse, Response},};-use doppleganger::Doppleganger;use macro_user_id::user_id::MacroUserId;use crate::api::context::ApiContext;@@ -15,8 +14,7 @@ use model::{};use utoipa::ToSchema;-#[derive(Default, Debug, serde::Serialize, serde::Deserialize, ToSchema, Doppleganger)]-#[dg(backward = auth_service_rpc::PatchUserOnboardingRequest)]+#[derive(Default, Debug, serde::Serialize, serde::Deserialize, ToSchema)]#[serde(rename_all = "camelCase")]pub struct PatchUserOnboardingRequest {/// The first name of the userdiff --git a/rust/cloud-storage/authentication_service/src/api/user/stripe.rs b/rust/cloud-storage/authentication_service/src/api/user/stripe.rsnew file mode 100644index 0000000000..ac005668c4--- /dev/null+++ b/rust/cloud-storage/authentication_service/src/api/user/stripe.rs@@ -0,0 +1,217 @@+use std::sync::LazyLock;++use axum::{+ Extension, Json,+ extract::State,+ http::StatusCode,+ response::{IntoResponse, Response},+};+use macro_env_var::env_var;+use serde::{Deserialize, Serialize};+use stripe::{ParseIdError, StripeError};+use thiserror::Error;+use utoipa::ToSchema;++use crate::api::context::ApiContext;+use model::user::UserContext;++// Shared error type for Stripe operations+#[derive(Debug, Error)]+pub enum StripeOperationError {+ #[error("Failed to parse user id")]+ ParseId(#[from] macro_user_id::error::ParseErr),+ #[error("Internal server error")]+ DbErr(#[from] sqlx::Error),+ #[error("User does not have a stripe id")]+ MissingStripeId,+ #[error("Invalid stripe id")]+ StripeIdParse(#[from] ParseIdError),+ #[error("Internal stripe error")]+ StripeErr(#[from] StripeError),+ #[error("Invalid promo code")]+ PromoCodeNotFound,+ #[error("Internal server error")]+ UnexpectedStripeResponse,+}++impl IntoResponse for StripeOperationError {+ fn into_response(self) -> Response {+ let status = match &self {+ StripeOperationError::ParseId(_) => StatusCode::BAD_REQUEST,+ StripeOperationError::DbErr(_) => StatusCode::INTERNAL_SERVER_ERROR,+ StripeOperationError::MissingStripeId => StatusCode::BAD_REQUEST,+ StripeOperationError::StripeIdParse(_) => StatusCode::BAD_REQUEST,+ StripeOperationError::StripeErr(_) => StatusCode::INTERNAL_SERVER_ERROR,+ StripeOperationError::PromoCodeNotFound => StatusCode::NOT_FOUND,+ StripeOperationError::UnexpectedStripeResponse => StatusCode::INTERNAL_SERVER_ERROR,+ };+ (status, self.to_string()).into_response()+ }+}++env_var!(+ struct StripePremiumPriceId;+);++static STRIPE_PRICE_ID: LazyLock<StripePremiumPriceId> = LazyLock::new(|| {+ match StripePremiumPriceId::new() {+ Ok(var) => var,+ // just use this non secret value if the value doesn't exist+ Err(_) => StripePremiumPriceId::Comptime("price_1PnSgXJaD7zvQeOBfSYgOmZc"),+ }+});++/// Request body for creating a Stripe checkout session+#[derive(Debug, Deserialize, ToSchema)]+#[serde(rename_all = "camelCase")]+pub struct CreateCheckoutSessionRequest {+ /// The URL to redirect to on successful checkout+ pub success_url: String,+ /// The URL to redirect to if checkout is cancelled+ pub cancel_url: String,+ /// Optional discount/promo code to apply+ pub discount: Option<String>,+}++/// Response containing the Stripe session URL+#[derive(Debug, Serialize, ToSchema)]+#[serde(rename_all = "camelCase")]+pub struct StripeSessionResponse {+ /// The URL to redirect the user to+ pub url: String,+}++/// Request body for creating a Stripe portal session+#[derive(Debug, Deserialize, ToSchema)]+#[serde(rename_all = "camelCase")]+pub struct CreatePortalSessionRequest {+ /// The URL to redirect to after leaving the portal+ pub return_url: String,+}++/// Creates a Stripe checkout session for the user to subscribe.+#[utoipa::path(+ post,+ path = "/user/stripe/checkout",+ operation_id = "create_checkout_session",+ request_body = CreateCheckoutSessionRequest,+ responses(+ (status = 200, body = StripeSessionResponse),+ (status = 400, body = String),+ (status = 404, body = String),+ (status = 500, body = String),+ )+)]+#[tracing::instrument(skip(ctx, user_context), err, fields(user_id = %user_context.user_id))]+pub async fn create_checkout_session(+ State(ctx): State<ApiContext>,+ user_context: Extension<UserContext>,+ Json(req): Json<CreateCheckoutSessionRequest>,+) -> Result<Json<StripeSessionResponse>, StripeOperationError> {+ let user_id =+ macro_user_id::user_id::MacroUserId::parse_from_str(&user_context.user_id)?.lowercase();++ // Get the stripe customer ID from the database+ let stripe_customer_id =+ macro_db_client::user::get::get_stripe_customer_id_by_user_id(&ctx.db, &user_id)+ .await?+ .ok_or(StripeOperationError::MissingStripeId)?;++ let customer_id: stripe::CustomerId = stripe_customer_id.parse()?;++ // If a discount code is provided, look up the promotion code ID+ let promo_code_id = if let Some(ref discount) = req.discount {+ let mut list_params = stripe::ListPromotionCodes::new();+ list_params.code = Some(discount);+ list_params.active = Some(true);+ list_params.limit = Some(1);++ let promo_codes = stripe::PromotionCode::list(&ctx.stripe_client, &list_params).await?;++ let promo_code = promo_codes+ .data+ .into_iter()+ .next()+ .ok_or(StripeOperationError::PromoCodeNotFound)?;++ Some(promo_code.id)+ } else {+ None+ };++ // Create the checkout session+ let params = stripe::CreateCheckoutSession {+ customer: Some(customer_id),+ mode: Some(stripe::CheckoutSessionMode::Subscription),+ success_url: Some(req.success_url.as_str()),+ cancel_url: Some(req.cancel_url.as_str()),+ allow_promotion_codes: promo_code_id.is_none().then_some(true),+ discounts: promo_code_id.map(|id| {+ vec![stripe::CreateCheckoutSessionDiscounts {+ promotion_code: Some(id.to_string()),+ ..Default::default()+ }]+ }),+ line_items: Some(vec![stripe::CreateCheckoutSessionLineItems {+ price: Some(STRIPE_PRICE_ID.as_ref().to_string()),+ quantity: Some(1),+ ..Default::default()+ }]),+ ..Default::default()+ };++ let session = stripe::CheckoutSession::create(&ctx.stripe_client, params).await?;++ let url = session+ .url+ .ok_or(StripeOperationError::UnexpectedStripeResponse)?;++ let url = url::Url::parse(&url).map_err(|_| StripeOperationError::UnexpectedStripeResponse)?;++ Ok(Json(StripeSessionResponse {+ url: url.to_string(),+ }))+}++/// Creates a Stripe billing portal session.+#[utoipa::path(+ post,+ path = "/user/stripe/portal",+ operation_id = "create_portal_session",+ request_body = CreatePortalSessionRequest,+ responses(+ (status = 200, body = StripeSessionResponse),+ (status = 400, body = String),+ (status = 500, body = String),+ )+)]+#[tracing::instrument(skip(ctx, user_context), err, fields(user_id = %user_context.user_id))]+pub async fn create_portal_session(+ State(ctx): State<ApiContext>,+ user_context: Extension<UserContext>,+ Json(req): Json<CreatePortalSessionRequest>,+) -> Result<Json<StripeSessionResponse>, StripeOperationError> {+ let user_id =+ macro_user_id::user_id::MacroUserId::parse_from_str(&user_context.user_id)?.lowercase();++ // Get the stripe customer ID from the database+ let stripe_customer_id =+ macro_db_client::user::get::get_stripe_customer_id_by_user_id(&ctx.db, &user_id)+ .await?+ .ok_or(StripeOperationError::MissingStripeId)?;++ let customer_id: stripe::CustomerId = stripe_customer_id.parse()?;++ // Create the billing portal session+ let mut params = stripe::CreateBillingPortalSession::new(customer_id);+ params.return_url = Some(req.return_url.as_str());++ let session = stripe::BillingPortalSession::create(&ctx.stripe_client, params).await?;++ let url = url::Url::parse(&session.url)+ .map_err(|_| StripeOperationError::UnexpectedStripeResponse)?;++ Ok(Json(StripeSessionResponse {+ url: url.to_string(),+ }))+}diff --git a/rust/cloud-storage/rpc-interface/auth_service/Cargo.toml b/rust/cloud-storage/rpc-interface/auth_service/Cargo.tomldeleted file mode 100644index 8390305499..0000000000--- a/rust/cloud-storage/rpc-interface/auth_service/Cargo.toml+++ /dev/null@@ -1,34 +0,0 @@-[package]-edition = "2024"-name = "auth_service_rpc"-publish = false-version = "0.1.0"--[lib]-crate-type = ["cdylib", "rlib"]--[features]-client = [- "dep:reqwest",- "dep:reqwest-middleware",- "dep:serde-wasm-bindgen",- "dep:tsify",- "dep:wasm-bindgen",- "dep:wasm-bindgen-futures",-]-server = ["axum"]--[dependencies]-axum = { workspace = true, optional = true }-axum_rpc = { path = "../../rpc/axum_rpc" }-serde = { workspace = true }-url = { workspace = true, features = ["serde"] }--# WASM dependencies-js-sys = { workspace = true }-reqwest = { workspace = true, optional = true, features = ["json"] }-reqwest-middleware = { workspace = true, optional = true, features = ["json"] }-serde-wasm-bindgen = { version = "0.6", optional = true }-tsify = { version = "0.5", optional = true }-wasm-bindgen = { version = "0.2", optional = true }-wasm-bindgen-futures = { version = "0.4", optional = true }diff --git a/rust/cloud-storage/rpc-interface/auth_service/README.md b/rust/cloud-storage/rpc-interface/auth_service/README.mddeleted file mode 100644index d2de54fb6e..0000000000--- a/rust/cloud-storage/rpc-interface/auth_service/README.md+++ /dev/null@@ -1,67 +0,0 @@-# auth_service_rpc--RPC interface for the authentication service, supporting both server and client modes.--## Features--- `server`: Enable server-side router generation (Axum)-- `client`: Enable client-side implementation with WASM support--## Building for WASM (Vite)--To build the WASM module for use with Vite:--```bash-wasm-pack build --target bundler --features client-```--This will generate a `pkg/` directory containing the WASM module and JavaScript bindings.--### Development Build--For faster builds during development:--```bash-wasm-pack build --target bundler --features client --dev-```--### Using in Vite--In your Vite project, you can import the generated package:--```javascript-import init, { LegacyGqlRpcClient } from './path/to/pkg/auth_service_rpc.js';--await init();--const client = LegacyGqlRpcClient.construct('https://api.example.com');-const permissions = await client.get_legacy_user_permissions();-```--## Usage--### Server--```rust-use auth_service_rpc::LegacyGqlRpc;--// Implement the trait for your service-impl LegacyGqlRpc for MyService {- // ... implementation-}--// Build the router-let router = LegacyGqlRpcRouterBuilder::new(my_service).build();-```--### Client (Rust)--```rust-use auth_service_rpc::{LegacyGqlRpc, LegacyGqlRpcClient};--let client = LegacyGqlRpcClient::builder()- .build("https://api.example.com".parse().unwrap())- .unwrap();--let permissions = client.get_legacy_user_permissions(()).await?;-```diff --git a/rust/cloud-storage/rpc-interface/auth_service/justfile b/rust/cloud-storage/rpc-interface/auth_service/justfiledeleted file mode 100644index 09bd06ab36..0000000000--- a/rust/cloud-storage/rpc-interface/auth_service/justfile+++ /dev/null@@ -1,7 +0,0 @@-out_dir := "../../../../js/app/packages/codegen/" + file_name(justfile_directory())--generate:- wasm-pack build --target bundler --features client- rm -rf {{ out_dir }}- mkdir -p ../../../../js/app/packages/codegen- mv pkg {{ out_dir }}diff --git a/rust/cloud-storage/rpc-interface/auth_service/src/lib.rs b/rust/cloud-storage/rpc-interface/auth_service/src/lib.rsdeleted file mode 100644index 2d6646828d..0000000000--- a/rust/cloud-storage/rpc-interface/auth_service/src/lib.rs+++ /dev/null@@ -1,171 +0,0 @@-use axum_rpc::{MaybeSend, MaybeSync, attr_macros};-use serde::{Deserialize, Serialize};-use url::Url;--#[derive(Debug, Serialize, Deserialize)]-#[cfg_attr(- feature = "client",- derive(tsify::Tsify),- tsify(into_wasm_abi, from_wasm_abi)-)]-#[serde(rename_all = "camelCase")]-pub struct GetLegacyUserPermissionsResponse {- /// The user id- pub user_id: String,- /// The permissions the user has- pub permissions: Vec<String>,- /// The user's email- pub email: String,- /// The user's name- pub name: Option<String>,- /// The user's license status- pub license_status: String,- /// Whether the user has completed the tutorial- pub tutorial_complete: bool,- /// The user's group- pub group: Option<ABGroup>,- /// Whether the user has the chrome extension- pub has_chrome_ext: bool,- /// Whether the user has trialed through stripe- pub has_trialed: bool,-}--#[derive(Debug, Serialize, Deserialize)]-#[cfg_attr(- feature = "client",- derive(tsify::Tsify),- tsify(into_wasm_abi, from_wasm_abi)-)]-pub enum ABGroup {- A,- B,-}--#[derive(Debug, Serialize, Deserialize)]-#[cfg_attr(- feature = "client",- derive(tsify::Tsify),- tsify(into_wasm_abi, from_wasm_abi)-)]-#[serde(rename_all = "camelCase")]-pub struct UserOrganizationResponse {- /// The id of the organization- pub organization_id: i32,- /// The name of the organization- pub organization_name: String,-}--#[derive(Debug, Serialize, Deserialize)]-#[cfg_attr(- feature = "client",- derive(tsify::Tsify),- tsify(into_wasm_abi, from_wasm_abi)-)]-#[serde(rename_all = "camelCase")]-pub struct PatchUserOnboardingRequest {- /// The first name of the user- pub first_name: String,- /// The last name of the user- pub last_name: String,- /// The title of the user- pub title: String,- /// The industry of the user- pub industry: String,-}--#[derive(Debug, Serialize, Deserialize)]-#[cfg_attr(- feature = "client",- derive(tsify::Tsify),- tsify(into_wasm_abi, from_wasm_abi)-)]-#[serde(rename_all = "camelCase")]-pub struct CreateCheckoutRequest {- pub success_url: Url,- pub cancel_url: Url,- pub discount: Option<String>,-}--#[derive(Debug, Serialize, Deserialize)]-#[cfg_attr(- feature = "client",- derive(tsify::Tsify),- tsify(into_wasm_abi, from_wasm_abi)-)]-#[serde(rename_all = "camelCase")]-pub struct CreatePortalRequest {- pub return_url: Url,-}--#[derive(Debug, Serialize, Deserialize)]-#[cfg_attr(- feature = "client",- derive(tsify::Tsify),- tsify(into_wasm_abi, from_wasm_abi)-)]-#[serde(rename_all = "camelCase")]-pub struct StripeUrlResponse {- pub url: Url,-}--#[cfg(all(feature = "client", not(feature = "server")))]-pub type LegacyApiErr = axum_rpc::anyhow::Error;-#[cfg(feature = "server")]-pub type LegacyApiErr = axum::response::Response;--#[derive(Debug, Serialize, Deserialize)]-#[cfg_attr(- feature = "client",- derive(tsify::Tsify),- tsify(into_wasm_abi, from_wasm_abi)-)]-pub struct PatchUserGroupRequest {- /// The group to add the user to- pub group: String,-}--/// this rpc trait replaces the parts we still need to support from the legacy gql service-#[cfg_attr(- all(feature = "client", not(feature = "server")),- attr_macros(client(bindgen))-)]-#[cfg_attr(feature = "server", attr_macros(router))]-pub trait LegacyApiRpc: MaybeSend + MaybeSync + 'static {- type GetPermsExtractor: 'static;-- fn get_legacy_user_permissions(- &self,- ctx: Self::GetPermsExtractor,- ) -> impl Future<Output = Result<GetLegacyUserPermissionsResponse, LegacyApiErr>> + MaybeSend;-- type UserExtractor: 'static;-- fn get_user_organization(- &self,- ctx: Self::UserExtractor,- ) -> impl Future<Output = Result<Option<UserOrganizationResponse>, LegacyApiErr>> + MaybeSend;-- fn patch_user_group(- &self,- ctx: Self::UserExtractor,- req: PatchUserGroupRequest,- ) -> impl Future<Output = Result<(), LegacyApiErr>> + MaybeSend;-- fn patch_user_onboarding(- &self,- ctx: Self::UserExtractor,- req: PatchUserOnboardingRequest,- ) -> impl Future<Output = Result<(), LegacyApiErr>> + MaybeSend;-- fn create_checkout_session(- &self,- ctx: Self::UserExtractor,- req: CreateCheckoutRequest,- ) -> impl Future<Output = Result<StripeUrlResponse, LegacyApiErr>> + MaybeSend;-- fn create_portal_session(- &self,- ctx: Self::UserExtractor,- req: CreatePortalRequest,- ) -> impl Future<Output = Result<StripeUrlResponse, LegacyApiErr>> + MaybeSend;-}