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

Function exportFiles

packages/sdk/src/import-export/exportFiles.ts:10–36  ·  view source on GitHub ↗
(opts: {
	readonly pluginKey: string;
	readonly settings: ProjectSettings;
	readonly plugins: readonly InlangPlugin[];
	readonly db: Kysely<InlangDatabaseSchema>;
})

Source from the content-addressed store, hash-verified

8import type { InlangPlugin } from "../plugin/schema.js";
9
10export async function exportFiles(opts: {
11 readonly pluginKey: string;
12 readonly settings: ProjectSettings;
13 readonly plugins: readonly InlangPlugin[];
14 readonly db: Kysely<InlangDatabaseSchema>;
15}) {
16 const plugin = opts.plugins.find((p) => p.key === opts.pluginKey);
17 if (!plugin) throw new PluginMissingError({ plugin: opts.pluginKey });
18 if (!plugin.exportFiles) {
19 throw new PluginDoesNotImplementFunctionError({
20 plugin: opts.pluginKey,
21 function: "exportFiles",
22 });
23 }
24
25 const bundles = await opts.db.selectFrom("bundle").selectAll().execute();
26 const messages = await opts.db.selectFrom("message").selectAll().execute();
27 const variants = await opts.db.selectFrom("variant").selectAll().execute();
28
29 const files = await plugin.exportFiles({
30 settings: structuredClone(opts.settings),
31 bundles,
32 messages,
33 variants,
34 });
35 return files;
36}

Callers 2

roundtrip.test.tsFile · 0.70
loadProjectFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected