Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Keep WASM type exports before loaders

Manav Rathi21d23d805e11
diff --git a/web/packages/wasm/auth/index.ts b/web/packages/wasm/auth/index.ts
index 62f6e7e1c7..9b10e8901f 100644
--- a/web/packages/wasm/auth/index.ts
+++ b/web/packages/wasm/auth/index.ts
@@ -5,10 +5,10 @@ import type {
Session,
} from "./pkg/ente_auth_wasm";
-const wasm = () => import("./pkg/ente_auth_wasm");
-
export type { Session } from "./pkg/ente_auth_wasm";
+const wasm = () => import("./pkg/ente_auth_wasm");
+
export const openSession = async (input: OpenSessionInput): Promise<Session> =>
(await wasm()).openSession(input);
diff --git a/web/packages/wasm/cast/index.ts b/web/packages/wasm/cast/index.ts
index 8468130e52..eea5e4481c 100644
--- a/web/packages/wasm/cast/index.ts
+++ b/web/packages/wasm/cast/index.ts
@@ -1,9 +1,9 @@
import type { CastReceiver } from "./pkg/ente_cast_wasm";
-const wasm = () => import("./pkg/ente_cast_wasm");
-
export type { CastReceiver } from "./pkg/ente_cast_wasm";
+const wasm = () => import("./pkg/ente_cast_wasm");
+
export const createCastReceiver = async (): Promise<CastReceiver> =>
new (await wasm()).CastReceiver();
diff --git a/web/packages/wasm/legacy/index.ts b/web/packages/wasm/legacy/index.ts
index 5ca979eccf..d51f8628b5 100644
--- a/web/packages/wasm/legacy/index.ts
+++ b/web/packages/wasm/legacy/index.ts
@@ -6,6 +6,8 @@ export type {
LegacyKitShare,
} from "./pkg/ente_legacy_wasm";
+export type LegacyKitParser = Awaited<ReturnType<typeof loadLegacyKitParser>>;
+
const wasm = () => import("./pkg/ente_legacy_wasm");
export const loadLegacyKitParser = async () => {
@@ -13,7 +15,5 @@ export const loadLegacyKitParser = async () => {
return { parseLegacyKitShare, validateLegacyKitSharePair };
};
-export type LegacyKitParser = Awaited<ReturnType<typeof loadLegacyKitParser>>;
-
export const openKitRecovery = async (input: OpenKitRecoveryInput) =>
(await wasm()).openKitRecovery(input);
diff --git a/web/packages/wasm/locker/index.ts b/web/packages/wasm/locker/index.ts
index eaf2e6a7f1..4550d72f08 100644
--- a/web/packages/wasm/locker/index.ts
+++ b/web/packages/wasm/locker/index.ts
@@ -9,10 +9,10 @@ import type {
WrappedRootContactKey,
} from "./pkg/ente_locker_wasm";
-const wasm = () => import("./pkg/ente_locker_wasm");
-
export type { OpenSessionInput, Session } from "./pkg/ente_locker_wasm";
+const wasm = () => import("./pkg/ente_locker_wasm");
+
export const openSession = async (input: OpenSessionInput): Promise<Session> =>
(await wasm()).openSession(input);
diff --git a/web/packages/wasm/photos/index.ts b/web/packages/wasm/photos/index.ts
index 1018e58382..df3525129c 100644
--- a/web/packages/wasm/photos/index.ts
+++ b/web/packages/wasm/photos/index.ts
@@ -5,10 +5,10 @@ import type {
WrappedRootContactKey,
} from "./pkg/ente_photos_wasm";
-const wasm = () => import("./pkg/ente_photos_wasm");
-
export type { OpenSessionInput, Session } from "./pkg/ente_photos_wasm";
+const wasm = () => import("./pkg/ente_photos_wasm");
+
export const openSession = async (input: OpenSessionInput): Promise<Session> =>
(await wasm()).openSession(input);
diff --git a/web/packages/wasm/space/index.ts b/web/packages/wasm/space/index.ts
index 500ed0320f..2a5b0a52cd 100644
--- a/web/packages/wasm/space/index.ts
+++ b/web/packages/wasm/space/index.ts
@@ -3,8 +3,6 @@ import type {
OpenSpaceLinkCtxJsInput,
} from "./pkg/ente_space_wasm";
-const wasm = () => import("./pkg/ente_space_wasm");
-
export type { DecryptedSpaceProfile } from "./pkg/ente_space_wasm";
export type SpaceAccountCtxHandle =
@@ -12,6 +10,8 @@ export type SpaceAccountCtxHandle =
export type SpaceLinkCtxHandle =
import("./pkg/ente_space_wasm").SpaceLinkCtxHandle;
+const wasm = () => import("./pkg/ente_space_wasm");
+
export const encryptSpaceRootEntityKey = async (
spaceRootKeyB64: string,
masterKeyB64: string,