Skip to content

Commit 5204fa8

Browse files
committed
chore: update trive-ts-sdk to version 0.0.92 and refactor component imports for consistency
1 parent 7b1606a commit 5204fa8

11 files changed

Lines changed: 113 additions & 92 deletions

File tree

clients/search-component/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@
8484
"react-scan": "^0.3.2",
8585
"react-snap-carousel": "^0.5.0",
8686
"tailwind-merge": "^3.0.2",
87-
"trieve-ts-sdk": "^0.0.90"
87+
"trieve-ts-sdk": "^0.0.92"
8888
},
8989
"peerDependencies": {
9090
"react": "^18.3.1 || ^19.0.0-rc",
9191
"react-dom": "^18.3.1 || ^19.0.0-rc"
9292
}
93-
}
93+
}

frontends/chat/vite.config.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,4 @@ import runtimeEnv from "vite-plugin-runtime-env";
44

55
export default defineConfig({
66
plugins: [solid(), runtimeEnv()],
7-
optimizeDeps: {
8-
include: ['debug', 'extend']
9-
},
10-
build: {
11-
commonjsOptions: {
12-
transformMixedEsModules: true,
13-
include: [/extend/]
14-
}
15-
}
167
});

frontends/dashboard/src/components/EditUserModal.tsx

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import { Show, createEffect, createMemo, useContext } from "solid-js";
22
import { createSignal } from "solid-js";
3-
import { Dialog, DialogOverlay, DialogPanel, DialogTitle, DisclosurePanel, DisclosureStateProperties, DisclosureButton, Disclosure } from "terracotta";
3+
import {
4+
Dialog,
5+
DialogOverlay,
6+
DialogPanel,
7+
DialogTitle,
8+
DisclosurePanel,
9+
DisclosureStateProperties,
10+
DisclosureButton,
11+
Disclosure,
12+
} from "terracotta";
413
import { UserContext } from "../contexts/UserContext";
514
import { DefaultError, fromI32ToUserRole } from "shared/types";
615
import { UserRole, fromUserRoleToI32, stringToUserRole } from "shared/types";
@@ -12,7 +21,6 @@ import { MultiSelect } from "./MultiSelect";
1221
import { FaRegularCircleQuestion } from "solid-icons/fa";
1322
import { Tooltip } from "shared/ui";
1423
import { ApiRoutes, RouteScope } from "./Routes";
15-
import { g } from "shiki/dist/types/wasm-dynamic.mjs";
1624

1725
export interface InviteUserModalProps {
1826
editingUser: SlimUser | null;
@@ -31,9 +39,9 @@ export const EditUserModal = (props: InviteUserModalProps) => {
3139
}));
3240

3341
const getScopePresets = (scopes: (string | null)[]) => {
34-
return Object.keys(ApiRoutes).filter(presetName => {
42+
return Object.keys(ApiRoutes).filter((presetName) => {
3543
const presetRoutes = ApiRoutes[presetName as RouteScope];
36-
return presetRoutes.every(route => scopes.includes(route));
44+
return presetRoutes.every((route) => scopes.includes(route));
3745
});
3846
};
3947

@@ -42,10 +50,12 @@ export const EditUserModal = (props: InviteUserModalProps) => {
4250

4351
const matchedPresets = getScopePresets(editingUserScopes() ?? []);
4452

45-
setScopes(matchedPresets.map((name) => ({
46-
id: name,
47-
name,
48-
})));
53+
setScopes(
54+
matchedPresets.map((name) => ({
55+
id: name,
56+
name,
57+
})),
58+
);
4959
});
5060

5161
const currentUserRole = createMemo(() => {
@@ -60,10 +70,12 @@ export const EditUserModal = (props: InviteUserModalProps) => {
6070
})?.role;
6171
});
6272

63-
const editingUserScopes = createMemo(() => {
64-
return props.editingUser?.user_orgs.find((val) => {
65-
return val.organization_id === userContext.selectedOrg().id;
66-
})?.scopes;
73+
const editingUserScopes = createMemo((): string[] => {
74+
return (
75+
(props.editingUser?.user_orgs.find((val) => {
76+
return val.organization_id === userContext.selectedOrg().id;
77+
})?.scopes as string[]) ?? []
78+
);
6779
});
6880

6981
const inviteUser = () => {
@@ -78,7 +90,12 @@ export const EditUserModal = (props: InviteUserModalProps) => {
7890
organization_id: userContext.selectedOrg().id,
7991
user_id: props.editingUser?.id,
8092
role: fromUserRoleToI32(role()),
81-
scopes: scopes().length > 0 ? scopes().map((val) => ApiRoutes[val.name as RouteScope]).flat() : undefined,
93+
scopes:
94+
scopes().length > 0
95+
? scopes()
96+
.map((val) => ApiRoutes[val.name as RouteScope])
97+
.flat()
98+
: undefined,
8299
}),
83100
}).then((res) => {
84101
createEffect(() => {
@@ -201,8 +218,9 @@ export const EditUserModal = (props: InviteUserModalProps) => {
201218
/>
202219
</div>
203220
<FaSolidChevronDown
204-
class={`${isOpen() ? "rotate-180 transform" : ""
205-
} h-4 w-4`}
221+
class={`${
222+
isOpen() ? "rotate-180 transform" : ""
223+
} h-4 w-4`}
206224
title={isOpen() ? "Close" : "Open"}
207225
/>
208226
</>
@@ -239,7 +257,12 @@ export const EditUserModal = (props: InviteUserModalProps) => {
239257
</button>
240258
<button
241259
disabled={
242-
role() === fromI32ToUserRole(editingUserRole() ?? 0) && scopes().every(scope => getScopePresets(editingUserScopes() ?? []).includes(scope.id))
260+
role() === fromI32ToUserRole(editingUserRole() ?? 0) &&
261+
scopes().every((scope) =>
262+
getScopePresets(editingUserScopes() ?? []).includes(
263+
scope.id,
264+
),
265+
)
243266
}
244267
type="submit"
245268
class="inline-flex justify-center rounded-md bg-magenta-500 px-3 py-2 font-semibold text-white shadow-sm hover:bg-magenta-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-magenta-600 disabled:bg-magenta-200"

frontends/dashboard/src/components/InviteUserModal.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import { Accessor, createMemo, onMount, Show, useContext } from "solid-js";
22
import { createSignal } from "solid-js";
3-
import { Dialog, DialogOverlay, DialogPanel, DialogTitle, DisclosurePanel, DisclosureButton, Disclosure, DisclosureStateProperties } from "terracotta";
3+
import {
4+
Dialog,
5+
DialogOverlay,
6+
DialogPanel,
7+
DialogTitle,
8+
DisclosurePanel,
9+
DisclosureButton,
10+
Disclosure,
11+
DisclosureStateProperties,
12+
} from "terracotta";
413
import { UserContext } from "../contexts/UserContext";
514
import { DefaultError, fromI32ToUserRole } from "shared/types";
615
import { UserRole, fromUserRoleToI32, stringToUserRole } from "shared/types";
@@ -69,12 +78,13 @@ export const InviteUserModal = (props: InviteUserModalProps) => {
6978
scopes:
7079
scopes().length > 0
7180
? scopes()
72-
.map((route) => ApiRoutes[route.name as RouteScope])
73-
.flat()
81+
.map((route) => ApiRoutes[route.name as RouteScope])
82+
.flat()
7483
: undefined,
7584
app_url: apiHost,
76-
redirect_uri: `${window.location.origin}/?org=${userContext.selectedOrg().id
77-
}`,
85+
redirect_uri: `${window.location.origin}/?org=${
86+
userContext.selectedOrg().id
87+
}`,
7888
}),
7989
}).then((res) => {
8090
setSendingEmail(false);
@@ -195,8 +205,9 @@ export const InviteUserModal = (props: InviteUserModalProps) => {
195205
/>
196206
</div>
197207
<FaSolidChevronDown
198-
class={`${isOpen() ? "rotate-180 transform" : ""
199-
} h-4 w-4`}
208+
class={`${
209+
isOpen() ? "rotate-180 transform" : ""
210+
} h-4 w-4`}
200211
title={isOpen() ? "Close" : "Open"}
201212
/>
202213
</>

frontends/dashboard/src/components/PlansTable.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,8 @@ export const PlansTable = (props: PlansTableProps) => {
539539
</td>
540540
<td class="whitespace-nowrap px-3 py-4 text-sm text-neutral-800">
541541
{numberFormatter.format(
542-
// @ts-expect-error Typecheck done above
543-
plan.message_count as unknown as number,
542+
(plan as StripePlan)
543+
.message_count as unknown as number,
544544
)}
545545
</td>
546546
<td class="whitespace-nowrap px-3 py-4">
@@ -552,15 +552,13 @@ export const PlansTable = (props: PlansTableProps) => {
552552
<>
553553
<td class="whitespace-nowrap px-3 py-4 text-sm text-neutral-800">
554554
**
555-
{
556-
// @ts-expect-error Typecheck done above
557-
plan.platform_price_amount != null
558-
? usdFormatter.format(
559-
// @ts-expect-error Typecheck done above
560-
plan.platform_price_amount as unknown as number,
561-
)
562-
: "Usage Based"
563-
}
555+
{(plan as StripeUsageBasedPlan)
556+
.platform_price_amount != null
557+
? usdFormatter.format(
558+
(plan as StripeUsageBasedPlan)
559+
.platform_price_amount as unknown as number,
560+
)
561+
: "Usage Based"}
564562
</td>
565563
<td class="whitespace-nowrap px-3 py-4 text-sm text-neutral-800">
566564
Charged on usage

frontends/dashboard/src/components/PricingTable.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,8 @@ export const PricingTable = (props: PricingTableProps) => {
4343
},
4444
body: JSON.stringify({
4545
date_range: {
46-
gte: formatDateForApi(
47-
startOfBill,
48-
),
49-
lte: formatDateForApi(
50-
addMonths(startOfBill, 1),
51-
),
46+
gte: formatDateForApi(startOfBill),
47+
lte: formatDateForApi(addMonths(startOfBill, 1)),
5248
},
5349
}),
5450
signal: availablePlansAbortController.signal,

frontends/search/src/components/GroupPage.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ export const GroupPage = (props: GroupPageProps) => {
108108
const [deleteChunksInGroup, setDeleteChunksInGroup] = createSignal(false);
109109
const [totalGroupPages, setTotalGroupPages] = createSignal(1);
110110
// eslint-disable-next-line @typescript-eslint/no-empty-function
111-
const [onDelete, setOnDelete] = createSignal(() => { });
111+
const [onDelete, setOnDelete] = createSignal(() => {});
112112
// eslint-disable-next-line @typescript-eslint/no-empty-function
113113
const [onGroupDelete, setOnGroupDelete] = createSignal<
114114
(delete_chunks: boolean) => void
115-
>(() => { });
115+
>(() => {});
116116
const [openChat, setOpenChat] = createSignal(false);
117117
const [selectedIds, setSelectedIds] = createSignal<string[]>([]);
118118
const [groupRecommendations, setGroupRecommendations] = createSignal(false);
@@ -1065,8 +1065,9 @@ export const GroupPage = (props: GroupPageProps) => {
10651065
</div>
10661066
<a
10671067
title="Open group to edit, view its chunks, or test group recommendations"
1068-
href={`/group/${groupResult.group.id
1069-
}?dataset=${dataset()?.dataset.id}`}
1068+
href={`/group/${
1069+
groupResult.group.id
1070+
}?dataset=${dataset()?.dataset.id}`}
10701071
>
10711072
<FiEye class="h-5 w-5" />
10721073
</a>

frontends/search/src/components/OrgGroupPageView.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ export const GroupUserPageView = (props: GroupUserPageViewProps) => {
175175
setLoading(true);
176176

177177
void fetch(
178-
`${apiHost}/dataset/groups/${currentDataset.dataset.id
178+
`${apiHost}/dataset/groups/${
179+
currentDataset.dataset.id
179180
}/?use_cursor=true&cursor=${groupOffset()}`,
180181
{
181182
method: "GET",
@@ -231,7 +232,8 @@ export const GroupUserPageView = (props: GroupUserPageViewProps) => {
231232
return (delete_chunks: boolean) => {
232233
setDeleting(true);
233234
void fetch(
234-
`${apiHost}/chunk_group/${group.id
235+
`${apiHost}/chunk_group/${
236+
group.id
235237
}?delete_chunks=${delete_chunks.toString()}`,
236238
{
237239
method: "DELETE",
@@ -366,9 +368,9 @@ export const GroupUserPageView = (props: GroupUserPageViewProps) => {
366368
each={
367369
searchQuery()
368370
? searchResults().slice(
369-
(groupPage() - 1) * 10,
370-
groupPage() * 10,
371-
)
371+
(groupPage() - 1) * 10,
372+
groupPage() * 10,
373+
)
372374
: groups()
373375
}
374376
>
@@ -410,7 +412,7 @@ export const GroupUserPageView = (props: GroupUserPageViewProps) => {
410412
<Show
411413
when={
412414
serverConfig()?.["DOCUMENT_DOWNLOAD_FEATURE"] !=
413-
false && group.file_id
415+
false && group.file_id
414416
}
415417
>
416418
<button

0 commit comments

Comments
 (0)