rete-graph 0.5.2 → 0.5.3

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/README.md CHANGED
@@ -28,7 +28,7 @@ for (const row of g.query("SELECT ?s ?label WHERE { ?s rdfs:label ?label } LIMIT
28
28
  One self-contained file, engine included — via any npm CDN:
29
29
 
30
30
  ```html
31
- <script src="https://cdn.jsdelivr.net/npm/rete-graph@0.5.2/dist/rete-graph.min.js"></script>
31
+ <script src="https://cdn.jsdelivr.net/npm/rete-graph@0.5.3/dist/rete-graph.min.js"></script>
32
32
  <script>
33
33
  (async () => {
34
34
  const g = await rete.open(await rete.build("<urn:a> <urn:knows> <urn:b> ."));
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! rete-graph v0.5.2 | Apache-2.0 | https://github.com/caviri/rete */
1
+ /*! rete-graph v0.5.3 | Apache-2.0 | https://github.com/caviri/rete */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __esm = (fn, res) => function __init() {
@@ -236,6 +236,7 @@ __export(rete_wasm_exports, {
236
236
  RemoteGraph: () => RemoteGraph,
237
237
  __start: () => __start,
238
238
  build: () => build,
239
+ build_bytes: () => build_bytes,
239
240
  build_with_card: () => build_with_card,
240
241
  build_with_card_syntax: () => build_with_card_syntax,
241
242
  build_with_derived_card: () => build_with_derived_card,
@@ -1596,6 +1597,23 @@ function build(text, format) {
1596
1597
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1597
1598
  return v3;
1598
1599
  }
1600
+ function build_bytes(bytes, format, card_json, quoted_triple_syntax) {
1601
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
1602
+ const len0 = WASM_VECTOR_LEN;
1603
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1604
+ const len1 = WASM_VECTOR_LEN;
1605
+ const ptr2 = passStringToWasm0(card_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1606
+ const len2 = WASM_VECTOR_LEN;
1607
+ const ptr3 = passStringToWasm0(quoted_triple_syntax, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1608
+ const len3 = WASM_VECTOR_LEN;
1609
+ const ret = wasm.build_bytes(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
1610
+ if (ret[3]) {
1611
+ throw takeFromExternrefTable0(ret[2]);
1612
+ }
1613
+ var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1614
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1615
+ return v5;
1616
+ }
1599
1617
  function build_with_card(text, format, card_json) {
1600
1618
  const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1601
1619
  const len0 = WASM_VECTOR_LEN;
@@ -3741,6 +3759,13 @@ async function open(source, { headers } = {}) {
3741
3759
  }
3742
3760
  async function build2(text, format = "nt", { quotedTripleSyntax = "rdf-star" } = {}) {
3743
3761
  await init();
3762
+ if (typeof text !== "string") {
3763
+ if (!isBytes(text)) {
3764
+ throw new TypeError("build() takes a string, or bytes (a Uint8Array/ArrayBuffer) for Jelly");
3765
+ }
3766
+ const bytes = text instanceof Uint8Array ? text : new Uint8Array(text instanceof ArrayBuffer ? text : text.buffer);
3767
+ return build_bytes(bytes, format, "", quotedTripleSyntax);
3768
+ }
3744
3769
  return build_with_card_syntax(text, format, "", quotedTripleSyntax);
3745
3770
  }
3746
3771
  function heapBytes() {