@flywheel-io/fw-file-rs 0.8.0 → 0.9.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/dcm/dcm.d.ts CHANGED
@@ -32,12 +32,33 @@ export class DeidProfile {
32
32
  private constructor();
33
33
  free(): void;
34
34
  [Symbol.dispose](): void;
35
+ /**
36
+ * @deprecated Use `deid_file(filename, bytes)`, which picks the profile
37
+ * section by file type. Unlike this method it throws for a profile with
38
+ * no `dicom` section instead of returning the input unchanged.
39
+ */
35
40
  deid_dcm(dcm_bytes: Uint8Array): Uint8Array;
36
41
  /**
37
42
  * Apply the profile and return `[bytes, report]` — see
38
43
  * [`deid_result_to_js_array`] for the shape.
44
+ *
45
+ * @deprecated Use `deid_file_with_report(filename, bytes)`, which picks
46
+ * the profile section by file type. Unlike this method it throws for a
47
+ * profile with no `dicom` section instead of returning the input
48
+ * unchanged.
39
49
  */
40
50
  deid_dcm_with_report(dcm_bytes: Uint8Array): Array<any>;
51
+ /**
52
+ * De-identify a file of any supported type, detected from its content
53
+ * and then `filename`. Throws for an unrecognized type or one the
54
+ * profile has no section for.
55
+ */
56
+ deid_file(filename: string, bytes: Uint8Array): Uint8Array;
57
+ /**
58
+ * `deid_file`, returning `[bytes, report, section]` where `section`
59
+ * names the profile section applied (`"dicom"`, `"json"`).
60
+ */
61
+ deid_file_with_report(filename: string, bytes: Uint8Array): Array<any>;
41
62
  static from_yaml(yaml: string): DeidProfile;
42
63
  static schema(): any;
43
64
  }
@@ -95,6 +116,8 @@ export interface InitOutput {
95
116
  readonly create_dcm_as_bytes: (a: any) => [number, number, number, number];
96
117
  readonly deidprofile_deid_dcm: (a: number, b: number, c: number) => [number, number, number, number];
97
118
  readonly deidprofile_deid_dcm_with_report: (a: number, b: number, c: number) => [number, number, number];
119
+ readonly deidprofile_deid_file: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
120
+ readonly deidprofile_deid_file_with_report: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
98
121
  readonly deidprofile_from_yaml: (a: number, b: number) => [number, number, number];
99
122
  readonly deidprofile_schema: () => [number, number, number];
100
123
  readonly get_fw_meta: (a: any, b: any) => [number, number, number];
@@ -103,8 +126,8 @@ export interface InitOutput {
103
126
  readonly parse_header: (a: number, b: number, c: number, d: number) => [number, number, number];
104
127
  readonly parse_header_full: (a: number, b: number) => [number, number, number];
105
128
  readonly read_until_pixels: (a: any, b: any, c: number) => any;
106
- readonly wasm_bindgen_46acc7fd244e2d4a___convert__closures_____invoke___js_sys_e24e7246c4058216___Function_fn_wasm_bindgen_46acc7fd244e2d4a___JsValue_____wasm_bindgen_46acc7fd244e2d4a___sys__Undefined___js_sys_e24e7246c4058216___Function_fn_wasm_bindgen_46acc7fd244e2d4a___JsValue_____wasm_bindgen_46acc7fd244e2d4a___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
107
- readonly wasm_bindgen_46acc7fd244e2d4a___convert__closures_____invoke___wasm_bindgen_46acc7fd244e2d4a___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_46acc7fd244e2d4a___JsError___true_: (a: number, b: number, c: any) => [number, number];
129
+ readonly wasm_bindgen_100bdf2efd44f6b0___convert__closures_____invoke___js_sys_2beb89f55c1fda4c___Function_fn_wasm_bindgen_100bdf2efd44f6b0___JsValue_____wasm_bindgen_100bdf2efd44f6b0___sys__Undefined___js_sys_2beb89f55c1fda4c___Function_fn_wasm_bindgen_100bdf2efd44f6b0___JsValue_____wasm_bindgen_100bdf2efd44f6b0___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
130
+ readonly wasm_bindgen_100bdf2efd44f6b0___convert__closures_____invoke___wasm_bindgen_100bdf2efd44f6b0___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_100bdf2efd44f6b0___JsError___true_: (a: number, b: number, c: any) => [number, number];
108
131
  readonly __wbindgen_malloc: (a: number, b: number) => number;
109
132
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
110
133
  readonly __wbindgen_exn_store: (a: number) => void;
package/dcm/dcm.js CHANGED
@@ -235,6 +235,9 @@ export class DeidProfile {
235
235
  wasm.__wbg_deidprofile_free(ptr, 0);
236
236
  }
237
237
  /**
238
+ * @deprecated Use `deid_file(filename, bytes)`, which picks the profile
239
+ * section by file type. Unlike this method it throws for a profile with
240
+ * no `dicom` section instead of returning the input unchanged.
238
241
  * @param {Uint8Array} dcm_bytes
239
242
  * @returns {Uint8Array}
240
243
  */
@@ -252,6 +255,11 @@ export class DeidProfile {
252
255
  /**
253
256
  * Apply the profile and return `[bytes, report]` — see
254
257
  * [`deid_result_to_js_array`] for the shape.
258
+ *
259
+ * @deprecated Use `deid_file_with_report(filename, bytes)`, which picks
260
+ * the profile section by file type. Unlike this method it throws for a
261
+ * profile with no `dicom` section instead of returning the input
262
+ * unchanged.
255
263
  * @param {Uint8Array} dcm_bytes
256
264
  * @returns {Array<any>}
257
265
  */
@@ -264,6 +272,45 @@ export class DeidProfile {
264
272
  }
265
273
  return takeFromExternrefTable0(ret[0]);
266
274
  }
275
+ /**
276
+ * De-identify a file of any supported type, detected from its content
277
+ * and then `filename`. Throws for an unrecognized type or one the
278
+ * profile has no section for.
279
+ * @param {string} filename
280
+ * @param {Uint8Array} bytes
281
+ * @returns {Uint8Array}
282
+ */
283
+ deid_file(filename, bytes) {
284
+ const ptr0 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
285
+ const len0 = WASM_VECTOR_LEN;
286
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
287
+ const len1 = WASM_VECTOR_LEN;
288
+ const ret = wasm.deidprofile_deid_file(this.__wbg_ptr, ptr0, len0, ptr1, len1);
289
+ if (ret[3]) {
290
+ throw takeFromExternrefTable0(ret[2]);
291
+ }
292
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
293
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
294
+ return v3;
295
+ }
296
+ /**
297
+ * `deid_file`, returning `[bytes, report, section]` where `section`
298
+ * names the profile section applied (`"dicom"`, `"json"`).
299
+ * @param {string} filename
300
+ * @param {Uint8Array} bytes
301
+ * @returns {Array<any>}
302
+ */
303
+ deid_file_with_report(filename, bytes) {
304
+ const ptr0 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
305
+ const len0 = WASM_VECTOR_LEN;
306
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
307
+ const len1 = WASM_VECTOR_LEN;
308
+ const ret = wasm.deidprofile_deid_file_with_report(this.__wbg_ptr, ptr0, len0, ptr1, len1);
309
+ if (ret[2]) {
310
+ throw takeFromExternrefTable0(ret[1]);
311
+ }
312
+ return takeFromExternrefTable0(ret[0]);
313
+ }
267
314
  /**
268
315
  * @param {string} yaml
269
316
  * @returns {DeidProfile}
@@ -402,10 +449,6 @@ function __wbg_get_imports() {
402
449
  const ret = Error(getStringFromWasm0(arg0, arg1));
403
450
  return ret;
404
451
  },
405
- __wbg_Number_14af1003b8dd5ead: function(arg0) {
406
- const ret = Number(arg0);
407
- return ret;
408
- },
409
452
  __wbg_String_8564e559799eccda: function(arg0, arg1) {
410
453
  const ret = String(arg1);
411
454
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -616,7 +659,7 @@ function __wbg_get_imports() {
616
659
  const a = state0.a;
617
660
  state0.a = 0;
618
661
  try {
619
- return wasm_bindgen_46acc7fd244e2d4a___convert__closures_____invoke___js_sys_e24e7246c4058216___Function_fn_wasm_bindgen_46acc7fd244e2d4a___JsValue_____wasm_bindgen_46acc7fd244e2d4a___sys__Undefined___js_sys_e24e7246c4058216___Function_fn_wasm_bindgen_46acc7fd244e2d4a___JsValue_____wasm_bindgen_46acc7fd244e2d4a___sys__Undefined_______true_(a, state0.b, arg0, arg1);
662
+ return wasm_bindgen_100bdf2efd44f6b0___convert__closures_____invoke___js_sys_2beb89f55c1fda4c___Function_fn_wasm_bindgen_100bdf2efd44f6b0___JsValue_____wasm_bindgen_100bdf2efd44f6b0___sys__Undefined___js_sys_2beb89f55c1fda4c___Function_fn_wasm_bindgen_100bdf2efd44f6b0___JsValue_____wasm_bindgen_100bdf2efd44f6b0___sys__Undefined_______true_(a, state0.b, arg0, arg1);
620
663
  } finally {
621
664
  state0.a = a;
622
665
  }
@@ -700,8 +743,8 @@ function __wbg_get_imports() {
700
743
  return ret;
701
744
  },
702
745
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
703
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1346, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
704
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_46acc7fd244e2d4a___convert__closures_____invoke___wasm_bindgen_46acc7fd244e2d4a___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_46acc7fd244e2d4a___JsError___true_);
746
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1345, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
747
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_100bdf2efd44f6b0___convert__closures_____invoke___wasm_bindgen_100bdf2efd44f6b0___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_100bdf2efd44f6b0___JsError___true_);
705
748
  return ret;
706
749
  },
707
750
  __wbindgen_generic_0000000000000002: function(arg0) {
@@ -740,15 +783,15 @@ function __wbg_get_imports() {
740
783
  };
741
784
  }
742
785
 
743
- function wasm_bindgen_46acc7fd244e2d4a___convert__closures_____invoke___wasm_bindgen_46acc7fd244e2d4a___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_46acc7fd244e2d4a___JsError___true_(arg0, arg1, arg2) {
744
- const ret = wasm.wasm_bindgen_46acc7fd244e2d4a___convert__closures_____invoke___wasm_bindgen_46acc7fd244e2d4a___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_46acc7fd244e2d4a___JsError___true_(arg0, arg1, arg2);
786
+ function wasm_bindgen_100bdf2efd44f6b0___convert__closures_____invoke___wasm_bindgen_100bdf2efd44f6b0___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_100bdf2efd44f6b0___JsError___true_(arg0, arg1, arg2) {
787
+ const ret = wasm.wasm_bindgen_100bdf2efd44f6b0___convert__closures_____invoke___wasm_bindgen_100bdf2efd44f6b0___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_100bdf2efd44f6b0___JsError___true_(arg0, arg1, arg2);
745
788
  if (ret[1]) {
746
789
  throw takeFromExternrefTable0(ret[0]);
747
790
  }
748
791
  }
749
792
 
750
- function wasm_bindgen_46acc7fd244e2d4a___convert__closures_____invoke___js_sys_e24e7246c4058216___Function_fn_wasm_bindgen_46acc7fd244e2d4a___JsValue_____wasm_bindgen_46acc7fd244e2d4a___sys__Undefined___js_sys_e24e7246c4058216___Function_fn_wasm_bindgen_46acc7fd244e2d4a___JsValue_____wasm_bindgen_46acc7fd244e2d4a___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
751
- wasm.wasm_bindgen_46acc7fd244e2d4a___convert__closures_____invoke___js_sys_e24e7246c4058216___Function_fn_wasm_bindgen_46acc7fd244e2d4a___JsValue_____wasm_bindgen_46acc7fd244e2d4a___sys__Undefined___js_sys_e24e7246c4058216___Function_fn_wasm_bindgen_46acc7fd244e2d4a___JsValue_____wasm_bindgen_46acc7fd244e2d4a___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
793
+ function wasm_bindgen_100bdf2efd44f6b0___convert__closures_____invoke___js_sys_2beb89f55c1fda4c___Function_fn_wasm_bindgen_100bdf2efd44f6b0___JsValue_____wasm_bindgen_100bdf2efd44f6b0___sys__Undefined___js_sys_2beb89f55c1fda4c___Function_fn_wasm_bindgen_100bdf2efd44f6b0___JsValue_____wasm_bindgen_100bdf2efd44f6b0___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
794
+ wasm.wasm_bindgen_100bdf2efd44f6b0___convert__closures_____invoke___js_sys_2beb89f55c1fda4c___Function_fn_wasm_bindgen_100bdf2efd44f6b0___JsValue_____wasm_bindgen_100bdf2efd44f6b0___sys__Undefined___js_sys_2beb89f55c1fda4c___Function_fn_wasm_bindgen_100bdf2efd44f6b0___JsValue_____wasm_bindgen_100bdf2efd44f6b0___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
752
795
  }
753
796
 
754
797
  const ContextFinalization = (typeof FinalizationRegistry === 'undefined')
package/dcm/dcm_bg.wasm CHANGED
Binary file
@@ -25,6 +25,8 @@ export const context_stop_at_tags: (a: number, b: any) => [number, number, numbe
25
25
  export const create_dcm_as_bytes: (a: any) => [number, number, number, number];
26
26
  export const deidprofile_deid_dcm: (a: number, b: number, c: number) => [number, number, number, number];
27
27
  export const deidprofile_deid_dcm_with_report: (a: number, b: number, c: number) => [number, number, number];
28
+ export const deidprofile_deid_file: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
29
+ export const deidprofile_deid_file_with_report: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
28
30
  export const deidprofile_from_yaml: (a: number, b: number) => [number, number, number];
29
31
  export const deidprofile_schema: () => [number, number, number];
30
32
  export const get_fw_meta: (a: any, b: any) => [number, number, number];
@@ -33,8 +35,8 @@ export const is_dicom_part10: (a: any) => any;
33
35
  export const parse_header: (a: number, b: number, c: number, d: number) => [number, number, number];
34
36
  export const parse_header_full: (a: number, b: number) => [number, number, number];
35
37
  export const read_until_pixels: (a: any, b: any, c: number) => any;
36
- export const wasm_bindgen_46acc7fd244e2d4a___convert__closures_____invoke___js_sys_e24e7246c4058216___Function_fn_wasm_bindgen_46acc7fd244e2d4a___JsValue_____wasm_bindgen_46acc7fd244e2d4a___sys__Undefined___js_sys_e24e7246c4058216___Function_fn_wasm_bindgen_46acc7fd244e2d4a___JsValue_____wasm_bindgen_46acc7fd244e2d4a___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
37
- export const wasm_bindgen_46acc7fd244e2d4a___convert__closures_____invoke___wasm_bindgen_46acc7fd244e2d4a___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_46acc7fd244e2d4a___JsError___true_: (a: number, b: number, c: any) => [number, number];
38
+ export const wasm_bindgen_100bdf2efd44f6b0___convert__closures_____invoke___js_sys_2beb89f55c1fda4c___Function_fn_wasm_bindgen_100bdf2efd44f6b0___JsValue_____wasm_bindgen_100bdf2efd44f6b0___sys__Undefined___js_sys_2beb89f55c1fda4c___Function_fn_wasm_bindgen_100bdf2efd44f6b0___JsValue_____wasm_bindgen_100bdf2efd44f6b0___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
39
+ export const wasm_bindgen_100bdf2efd44f6b0___convert__closures_____invoke___wasm_bindgen_100bdf2efd44f6b0___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_100bdf2efd44f6b0___JsError___true_: (a: number, b: number, c: any) => [number, number];
38
40
  export const __wbindgen_malloc: (a: number, b: number) => number;
39
41
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
40
42
  export const __wbindgen_exn_store: (a: number) => void;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Flywheel <support@flywheel.io>"
6
6
  ],
7
7
  "description": "JavaScript/WebAssembly bindings for fw-file rust crate",
8
- "version": "0.8.0",
8
+ "version": "0.9.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",