@typerighter/rpc-client 0.4.3 → 0.5.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@typerighter/rpc-client",
4
- "version": "0.4.3",
4
+ "version": "0.5.0",
5
5
  "description": "WASM RPC client for Typedown.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,5 +1,35 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * A single diagnostic item with location and message
5
+ */
6
+ export interface TdDiagnosticItem {
7
+ /**
8
+ * File path relative to the content directory
9
+ */
10
+ filepath: string;
11
+ /**
12
+ * 1-based line number
13
+ */
14
+ line: number;
15
+ /**
16
+ * 1-based column number
17
+ */
18
+ column: number;
19
+ /**
20
+ * \"error\" or \"warning\
21
+ */
22
+ severity: string;
23
+ /**
24
+ * Kebab-case diagnostic code (e.g. \"duplicate-key\", \"missing-required-field\")
25
+ */
26
+ code: string;
27
+ /**
28
+ * Human-readable message
29
+ */
30
+ message: string;
31
+ }
32
+
3
33
  /**
4
34
  * Asset directory configuration
5
35
  */
@@ -57,6 +87,30 @@ export interface TdContentSummary {
57
87
  metadata: TdFileMetadata;
58
88
  }
59
89
 
90
+ /**
91
+ * Result of checking all vault files for diagnostics
92
+ */
93
+ export interface TdDiagnosticReport {
94
+ diagnostics: TdDiagnosticItem[];
95
+ fileCount: number;
96
+ errorCount: number;
97
+ warningCount: number;
98
+ }
99
+
100
+ /**
101
+ * Result of formatting a single file
102
+ */
103
+ export interface TdFormatResult {
104
+ /**
105
+ * Full formatted file content (frontmatter + body)
106
+ */
107
+ content: string;
108
+ /**
109
+ * Whether the content changed
110
+ */
111
+ changed: boolean;
112
+ }
113
+
60
114
  /**
61
115
  * Schema file event: A schema file was created, changed, or deleted
62
116
  */
@@ -116,8 +170,10 @@ export class RpcClient {
116
170
  private constructor();
117
171
  free(): void;
118
172
  [Symbol.dispose](): void;
173
+ checkVault(): Promise<TdDiagnosticReport>;
119
174
  close(): void;
120
175
  static connect(addr: string, port: number): Promise<RpcClient>;
176
+ formatFile(path: string): Promise<TdFormatResult>;
121
177
  getConfig(): Promise<TdSiteConfig>;
122
178
  getSchema(schema: string): Promise<TdSchemaInfo>;
123
179
  listFilesGroupedBySchema(): Promise<any>;
@@ -15,6 +15,13 @@ export class RpcClient {
15
15
  const ptr = this.__destroy_into_raw();
16
16
  wasm.__wbg_rpcclient_free(ptr, 0);
17
17
  }
18
+ /**
19
+ * @returns {Promise<TdDiagnosticReport>}
20
+ */
21
+ checkVault() {
22
+ const ret = wasm.rpcclient_checkVault(this.__wbg_ptr);
23
+ return ret;
24
+ }
18
25
  close() {
19
26
  wasm.rpcclient_close(this.__wbg_ptr);
20
27
  }
@@ -29,6 +36,16 @@ export class RpcClient {
29
36
  const ret = wasm.rpcclient_connect(ptr0, len0, port);
30
37
  return ret;
31
38
  }
39
+ /**
40
+ * @param {string} path
41
+ * @returns {Promise<TdFormatResult>}
42
+ */
43
+ formatFile(path) {
44
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
45
+ const len0 = WASM_VECTOR_LEN;
46
+ const ret = wasm.rpcclient_formatFile(this.__wbg_ptr, ptr0, len0);
47
+ return ret;
48
+ }
32
49
  /**
33
50
  * @returns {Promise<TdSiteConfig>}
34
51
  */
@@ -273,7 +290,7 @@ export function __wbg_new_typed_1824d93f294193e5(arg0, arg1) {
273
290
  const a = state0.a;
274
291
  state0.a = 0;
275
292
  try {
276
- return wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___js_sys_369f260317a9271e___Function_fn_wasm_bindgen_1cb3149d3324cc5b___JsValue_____wasm_bindgen_1cb3149d3324cc5b___sys__Undefined___js_sys_369f260317a9271e___Function_fn_wasm_bindgen_1cb3149d3324cc5b___JsValue_____wasm_bindgen_1cb3149d3324cc5b___sys__Undefined_______true_(a, state0.b, arg0, arg1);
293
+ return wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___js_sys_c7698ef05fc2061a___Function_fn_wasm_bindgen_150412fee6d99fbf___JsValue_____wasm_bindgen_150412fee6d99fbf___sys__Undefined___js_sys_c7698ef05fc2061a___Function_fn_wasm_bindgen_150412fee6d99fbf___JsValue_____wasm_bindgen_150412fee6d99fbf___sys__Undefined_______true_(a, state0.b, arg0, arg1);
277
294
  } finally {
278
295
  state0.a = a;
279
296
  }
@@ -385,33 +402,33 @@ export function __wbg_wasClean_3c7aa2335da09e74(arg0) {
385
402
  return ret;
386
403
  }
387
404
  export function __wbindgen_cast_0000000000000001(arg0, arg1) {
388
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 257, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
389
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___wasm_bindgen_1cb3149d3324cc5b___JsValue__core_f92d3014a3b48e14___result__Result_____wasm_bindgen_1cb3149d3324cc5b___JsError___true_);
405
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 262, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
406
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___wasm_bindgen_150412fee6d99fbf___JsValue__core_b89b965b131b2c99___result__Result_____wasm_bindgen_150412fee6d99fbf___JsError___true_);
390
407
  return ret;
391
408
  }
392
409
  export function __wbindgen_cast_0000000000000002(arg0, arg1) {
393
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 161, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
394
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true_);
410
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 166, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
411
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true_);
395
412
  return ret;
396
413
  }
397
414
  export function __wbindgen_cast_0000000000000003(arg0, arg1) {
398
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 161, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
399
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true__2);
415
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 166, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
416
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true__2);
400
417
  return ret;
401
418
  }
402
419
  export function __wbindgen_cast_0000000000000004(arg0, arg1) {
403
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 161, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
404
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true__3);
420
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 166, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
421
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true__3);
405
422
  return ret;
406
423
  }
407
424
  export function __wbindgen_cast_0000000000000005(arg0, arg1) {
408
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 165, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
409
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke_______true_);
425
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 170, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
426
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke_______true_);
410
427
  return ret;
411
428
  }
412
429
  export function __wbindgen_cast_0000000000000006(arg0, arg1) {
413
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 236, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
414
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke_______true__1_);
430
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 241, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
431
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke_______true__1_);
415
432
  return ret;
416
433
  }
417
434
  export function __wbindgen_cast_0000000000000007(arg0) {
@@ -457,35 +474,35 @@ export function __wbindgen_init_externref_table() {
457
474
  table.set(offset + 2, true);
458
475
  table.set(offset + 3, false);
459
476
  }
460
- function wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke_______true_(arg0, arg1) {
461
- wasm.wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke_______true_(arg0, arg1);
477
+ function wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke_______true_(arg0, arg1) {
478
+ wasm.wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke_______true_(arg0, arg1);
462
479
  }
463
480
 
464
- function wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke_______true__1_(arg0, arg1) {
465
- wasm.wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke_______true__1_(arg0, arg1);
481
+ function wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke_______true__1_(arg0, arg1) {
482
+ wasm.wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke_______true__1_(arg0, arg1);
466
483
  }
467
484
 
468
- function wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true_(arg0, arg1, arg2) {
469
- wasm.wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true_(arg0, arg1, arg2);
485
+ function wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true_(arg0, arg1, arg2) {
486
+ wasm.wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true_(arg0, arg1, arg2);
470
487
  }
471
488
 
472
- function wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true__2(arg0, arg1, arg2) {
473
- wasm.wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true__2(arg0, arg1, arg2);
489
+ function wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true__2(arg0, arg1, arg2) {
490
+ wasm.wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true__2(arg0, arg1, arg2);
474
491
  }
475
492
 
476
- function wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true__3(arg0, arg1, arg2) {
477
- wasm.wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true__3(arg0, arg1, arg2);
493
+ function wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true__3(arg0, arg1, arg2) {
494
+ wasm.wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true__3(arg0, arg1, arg2);
478
495
  }
479
496
 
480
- function wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___wasm_bindgen_1cb3149d3324cc5b___JsValue__core_f92d3014a3b48e14___result__Result_____wasm_bindgen_1cb3149d3324cc5b___JsError___true_(arg0, arg1, arg2) {
481
- const ret = wasm.wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___wasm_bindgen_1cb3149d3324cc5b___JsValue__core_f92d3014a3b48e14___result__Result_____wasm_bindgen_1cb3149d3324cc5b___JsError___true_(arg0, arg1, arg2);
497
+ function wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___wasm_bindgen_150412fee6d99fbf___JsValue__core_b89b965b131b2c99___result__Result_____wasm_bindgen_150412fee6d99fbf___JsError___true_(arg0, arg1, arg2) {
498
+ const ret = wasm.wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___wasm_bindgen_150412fee6d99fbf___JsValue__core_b89b965b131b2c99___result__Result_____wasm_bindgen_150412fee6d99fbf___JsError___true_(arg0, arg1, arg2);
482
499
  if (ret[1]) {
483
500
  throw takeFromExternrefTable0(ret[0]);
484
501
  }
485
502
  }
486
503
 
487
- function wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___js_sys_369f260317a9271e___Function_fn_wasm_bindgen_1cb3149d3324cc5b___JsValue_____wasm_bindgen_1cb3149d3324cc5b___sys__Undefined___js_sys_369f260317a9271e___Function_fn_wasm_bindgen_1cb3149d3324cc5b___JsValue_____wasm_bindgen_1cb3149d3324cc5b___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
488
- wasm.wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___js_sys_369f260317a9271e___Function_fn_wasm_bindgen_1cb3149d3324cc5b___JsValue_____wasm_bindgen_1cb3149d3324cc5b___sys__Undefined___js_sys_369f260317a9271e___Function_fn_wasm_bindgen_1cb3149d3324cc5b___JsValue_____wasm_bindgen_1cb3149d3324cc5b___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
504
+ function wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___js_sys_c7698ef05fc2061a___Function_fn_wasm_bindgen_150412fee6d99fbf___JsValue_____wasm_bindgen_150412fee6d99fbf___sys__Undefined___js_sys_c7698ef05fc2061a___Function_fn_wasm_bindgen_150412fee6d99fbf___JsValue_____wasm_bindgen_150412fee6d99fbf___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
505
+ wasm.wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___js_sys_c7698ef05fc2061a___Function_fn_wasm_bindgen_150412fee6d99fbf___JsValue_____wasm_bindgen_150412fee6d99fbf___sys__Undefined___js_sys_c7698ef05fc2061a___Function_fn_wasm_bindgen_150412fee6d99fbf___JsValue_____wasm_bindgen_150412fee6d99fbf___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
489
506
  }
490
507
 
491
508
 
Binary file
@@ -2,8 +2,10 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_rpcclient_free: (a: number, b: number) => void;
5
+ export const rpcclient_checkVault: (a: number) => any;
5
6
  export const rpcclient_close: (a: number) => void;
6
7
  export const rpcclient_connect: (a: number, b: number, c: number) => any;
8
+ export const rpcclient_formatFile: (a: number, b: number, c: number) => any;
7
9
  export const rpcclient_getConfig: (a: number) => any;
8
10
  export const rpcclient_getSchema: (a: number, b: number, c: number) => any;
9
11
  export const rpcclient_listFilesGroupedBySchema: (a: number) => any;
@@ -19,13 +21,13 @@ export const rpcclient_onSchemaCreated: (a: number, b: any) => void;
19
21
  export const rpcclient_onSchemaDeleted: (a: number, b: any) => void;
20
22
  export const rpcclient_requestFile: (a: number, b: number, c: number) => any;
21
23
  export const rpcclient_requestFiles: (a: number, b: number, c: number) => any;
22
- export const wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___wasm_bindgen_1cb3149d3324cc5b___JsValue__core_f92d3014a3b48e14___result__Result_____wasm_bindgen_1cb3149d3324cc5b___JsError___true_: (a: number, b: number, c: any) => [number, number];
23
- export const wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___js_sys_369f260317a9271e___Function_fn_wasm_bindgen_1cb3149d3324cc5b___JsValue_____wasm_bindgen_1cb3149d3324cc5b___sys__Undefined___js_sys_369f260317a9271e___Function_fn_wasm_bindgen_1cb3149d3324cc5b___JsValue_____wasm_bindgen_1cb3149d3324cc5b___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
24
- export const wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true_: (a: number, b: number, c: any) => void;
25
- export const wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true__2: (a: number, b: number, c: any) => void;
26
- export const wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke___web_sys_ce9d43a04a5b187d___features__gen_CloseEvent__CloseEvent______true__3: (a: number, b: number, c: any) => void;
27
- export const wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke_______true_: (a: number, b: number) => void;
28
- export const wasm_bindgen_1cb3149d3324cc5b___convert__closures_____invoke_______true__1_: (a: number, b: number) => void;
24
+ export const wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___wasm_bindgen_150412fee6d99fbf___JsValue__core_b89b965b131b2c99___result__Result_____wasm_bindgen_150412fee6d99fbf___JsError___true_: (a: number, b: number, c: any) => [number, number];
25
+ export const wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___js_sys_c7698ef05fc2061a___Function_fn_wasm_bindgen_150412fee6d99fbf___JsValue_____wasm_bindgen_150412fee6d99fbf___sys__Undefined___js_sys_c7698ef05fc2061a___Function_fn_wasm_bindgen_150412fee6d99fbf___JsValue_____wasm_bindgen_150412fee6d99fbf___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
26
+ export const wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true_: (a: number, b: number, c: any) => void;
27
+ export const wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true__2: (a: number, b: number, c: any) => void;
28
+ export const wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke___web_sys_35278d4b9dbc1a84___features__gen_CloseEvent__CloseEvent______true__3: (a: number, b: number, c: any) => void;
29
+ export const wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke_______true_: (a: number, b: number) => void;
30
+ export const wasm_bindgen_150412fee6d99fbf___convert__closures_____invoke_______true__1_: (a: number, b: number) => void;
29
31
  export const __wbindgen_malloc: (a: number, b: number) => number;
30
32
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
31
33
  export const __wbindgen_exn_store: (a: number) => void;