tauri-kargo-tools 0.2.4 → 0.2.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tauri-kargo-tools",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "",
5
5
  "files": ["src"],
6
6
  "exports": { "./*": "./src/*" },
package/src/api.ts CHANGED
@@ -95,6 +95,10 @@ export class TauriKargoClient {
95
95
  createDirectory(path: string): Promise<T.CreateDirResp> {
96
96
  return this.postJson<T.CreateDirResp>("/api/directory/create", { path: path });
97
97
  }
98
+
99
+ typescriptTranspile(src: string): Promise<T.TypeScriptTranspileResponse> {
100
+ return this.postJson<T.TypeScriptTranspileResponse>("/api/typescript/transpile", { src: src });
101
+ }
98
102
  /**
99
103
  * Lire un fichier texte relatif au répertoire courant.
100
104
  * (POST sans corps ⇒ READ ; renvoie text/plain ou octet-stream)
package/src/test/index.ts CHANGED
@@ -90,6 +90,14 @@ test.test("Test schema simple avec deux type", async () => {
90
90
 
91
91
 
92
92
 
93
+ })
94
+ test.test("Test transpile ", async()=> {
95
+ const client = api.createClient();
96
+ const src = ` function m( n:number) { return n+1}`
97
+ const r = await client.typescriptTranspile(src)
98
+ console.log(JSON.stringify(r))
99
+
100
+
93
101
  })
94
102
  test.test("Test read file", async () => {
95
103
 
package/src/types.ts CHANGED
@@ -104,7 +104,14 @@ export interface StopAllResp {
104
104
  ok: boolean;
105
105
  message: string;
106
106
  }
107
+ export type TypeScriptTranspileInput = { src: string };
107
108
 
109
+ export type TypeScriptTranspileSuccess = { ok: true; src: string };
110
+
111
+ export type TypeScriptTranspileError = { ok: false; message: string };
112
+
113
+ export type TypeScriptTranspileResponse = TypeScriptTranspileSuccess | TypeScriptTranspileError;
114
+
108
115
  export interface ExplorerReq {
109
116
  path?: string;
110
117
  }