@cytario/web 2.1.7 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/app/.server/auth/README.md +0 -1
  3. package/app/.server/auth/authMiddleware.ts +6 -28
  4. package/app/.server/auth/getSessionCredentials.ts +11 -1
  5. package/app/.server/auth/sessionPolicy.ts +69 -0
  6. package/app/.server/corsPreflight.ts +136 -0
  7. package/app/.server/csp.ts +34 -0
  8. package/app/components/.client/ImageViewer/README.md +2 -2
  9. package/app/components/DirectoryView/DirectoryViewGrid.tsx +2 -11
  10. package/app/components/DirectoryView/DirectoryViewTree.tsx +18 -26
  11. package/app/components/DirectoryView/buildDirectoryTree.ts +89 -42
  12. package/app/components/DirectoryView/filterNodes.ts +4 -19
  13. package/app/components/DirectoryView/useLazyTreeNodes.ts +120 -0
  14. package/app/components/GlobalSearch/GlobalSearch.tsx +8 -3
  15. package/app/components/GlobalSearch/Suggestions.tsx +21 -3
  16. package/app/config.ts +0 -7
  17. package/app/entry.server.tsx +9 -4
  18. package/app/hooks/useInitConnections.ts +3 -3
  19. package/app/root.tsx +11 -6
  20. package/app/routes/connections/connection.form.tsx +9 -3
  21. package/app/routes/connections/connection.schema.ts +60 -11
  22. package/app/routes/connections/connections.clientLoader.ts +91 -0
  23. package/app/routes/connections/connections.loader.ts +19 -39
  24. package/app/routes/connections/connections.route.tsx +5 -0
  25. package/app/routes/connections/createConnection.action.ts +39 -13
  26. package/app/routes/connections/deleteConnection.action.ts +5 -1
  27. package/app/routes/connections/updateConnection.action.ts +50 -13
  28. package/app/routes/home/home.route.tsx +5 -1
  29. package/app/routes/layouts/protected.layout.tsx +15 -1
  30. package/app/routes/objects/objects.clientLoader.ts +73 -0
  31. package/app/routes/objects/objects.loader.ts +58 -92
  32. package/app/routes/objects/objects.route.tsx +41 -40
  33. package/app/routes/search.route.tsx +133 -28
  34. package/app/routes.ts +0 -4
  35. package/app/utils/connectionsStore/useConnectionsStore.ts +25 -62
  36. package/app/utils/credentialsRefresh.ts +53 -0
  37. package/app/utils/db/convertCsvToParquet.ts +24 -16
  38. package/app/utils/db/createDatabase.ts +25 -33
  39. package/app/utils/db/duckdbBundles.ts +42 -0
  40. package/app/utils/db/ensureSpatialLoaded.ts +28 -0
  41. package/app/utils/db/escapeSqlString.ts +4 -0
  42. package/app/utils/db/getBlobFromObjectNode.ts +15 -36
  43. package/app/utils/db/getTileDataWasm.ts +4 -5
  44. package/app/utils/db/sqlQueries.ts +6 -1
  45. package/app/utils/filterObjects.ts +2 -18
  46. package/app/utils/limitConcurrency.ts +28 -0
  47. package/app/utils/listObjectsClient.ts +318 -0
  48. package/app/utils/listingLimits.ts +7 -0
  49. package/app/utils/loadConnectionLevel.ts +50 -0
  50. package/app/utils/localFilesStore/useFileStore.ts +1 -6
  51. package/app/utils/pathUtils.ts +65 -0
  52. package/app/utils/resourceId.ts +14 -29
  53. package/app/utils/s3HostAllowlist.ts +116 -0
  54. package/app/utils/signedFetch.ts +159 -24
  55. package/package.json +2 -2
  56. package/prisma/seed.ts +3 -3
  57. package/public/duckdb-extensions/checksums.json +12 -0
  58. package/scripts/download-duckdb-extensions.mjs +188 -0
  59. package/scripts/prebuild.mjs +18 -10
  60. package/app/.server/auth/getPresignedUrl.ts +0 -21
  61. package/app/.server/auth/getS3Client.ts +0 -93
  62. package/app/routes/presign.route.tsx +0 -42
  63. package/app/utils/getObjects.ts +0 -24
@@ -1,42 +0,0 @@
1
- import { ActionFunctionArgs } from "react-router";
2
-
3
- import { authContext, authMiddleware } from "~/.server/auth/authMiddleware";
4
- import { getPresignedUrl } from "~/.server/auth/getPresignedUrl";
5
- import { getS3Client } from "~/.server/auth/getS3Client";
6
- import { createLabel } from "~/.server/logging";
7
- import { requestDurationMiddleware } from "~/.server/requestDurationMiddleware";
8
- import { getConnection } from "~/routes/connections/connections.server";
9
-
10
- export const middleware = [requestDurationMiddleware, authMiddleware];
11
-
12
- const label = createLabel("presign", "gray");
13
-
14
- export const loader = async ({ params, context }: ActionFunctionArgs): Promise<Response> => {
15
- const { user, credentials: connectionsCredentials } = context.get(authContext);
16
- const { name: connectionName } = params;
17
- const pathName = params["*"] ?? "";
18
-
19
- if (!connectionName) throw new Error("Connection name is required");
20
-
21
- const connectionConfig = await getConnection(user, connectionName);
22
- if (!connectionConfig) {
23
- throw new Error("Connection configuration not found");
24
- }
25
-
26
- const { provider, bucketName, prefix: connPrefix } = connectionConfig;
27
- const s3Key = connPrefix ? `${connPrefix.replace(/\/$/, "")}/${pathName}` : pathName;
28
- console.info(`${label} Presign route: ${provider}/${bucketName}/${s3Key}`);
29
-
30
- const credentials = connectionsCredentials[connectionName];
31
- if (!credentials) throw new Error(`No credentials for connection: ${connectionName}`);
32
-
33
- try {
34
- const s3Client = await getS3Client(connectionConfig, credentials, user.sub);
35
- const presignedUrl = await getPresignedUrl(connectionConfig, s3Client, s3Key);
36
-
37
- return Response.json({ url: presignedUrl });
38
- } catch (error) {
39
- console.error("Error presigning url", error);
40
- return Response.json({ error: "Failed to generate presigned URL" }, { status: 500 });
41
- }
42
- };
@@ -1,24 +0,0 @@
1
- import { _Object, ListObjectsV2Command, S3Client } from "@aws-sdk/client-s3";
2
-
3
- import { filterObjects } from "./filterObjects";
4
- import { ConnectionConfig } from "~/.generated/client";
5
-
6
- export const getObjects = async (
7
- connectionConfig: ConnectionConfig,
8
- s3Client: S3Client,
9
- query?: string | null,
10
- prefix?: string,
11
- maxKeys?: number,
12
- ): Promise<_Object[]> => {
13
- const listObjectsCommand = new ListObjectsV2Command({
14
- Bucket: connectionConfig.bucketName,
15
- Prefix: prefix,
16
- ...(maxKeys ? { MaxKeys: maxKeys } : {}),
17
- });
18
-
19
- const { Contents } = await s3Client.send(listObjectsCommand);
20
-
21
- const filteredFiles = filterObjects(Contents, { query });
22
-
23
- return filteredFiles;
24
- };