MCPcopy
hub / github.com/opral/inlang / loadProjectInMemory

Function loadProjectInMemory

packages/sdk/src/project/loadProjectInMemory.ts:8–38  ·  view source on GitHub ↗
(
	args: {
		blob: Blob;
		lixKeyValues?: NewKeyValue[];
	} & Omit<Parameters<typeof loadProject>[0], "sqlite" | "lix">
)

Source from the content-addressed store, hash-verified

6 * Load a project from a blob in memory.
7 */
8export async function loadProjectInMemory(
9 args: {
10 blob: Blob;
11 lixKeyValues?: NewKeyValue[];
12 } & Omit<Parameters<typeof loadProject>[0], "sqlite" | "lix">
13) {
14 const lix = await openLixInMemory({
15 blob: args.blob,
16 account: args.account,
17 keyValues: args.lixKeyValues,
18 providePlugins: [
19 // inlangLixPluginV1
20 ],
21 });
22
23 const dbFile = await lix.db
24 .selectFrom("file")
25 .select("data")
26 .where("path", "=", "/db.sqlite")
27 .executeTakeFirstOrThrow();
28
29 const sqlite = await createInMemoryDatabase({});
30 importDatabase({ db: sqlite, content: new Uint8Array(dbFile.data) });
31
32 return await loadProject({
33 // pass common arguments to loadProject
34 ...args,
35 sqlite,
36 lix,
37 });
38}

Callers 15

state.tsFile · 0.90
handleMergeFunction · 0.90
plugin.test.tsFile · 0.90
translate.test.tsFile · 0.90
roundtrip.test.tsFile · 0.85
loadProjectFromDirectoryFunction · 0.85
newProject.test.tsFile · 0.85
merge.test.tsFile · 0.85

Calls 1

loadProjectFunction · 0.85

Tested by

no test coverage detected