triangulum 0.12.2 → 0.13.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64ab7d369510b37b5b461ae229858d8344623c68be22a3df5afc3a2b698c32f6
4
- data.tar.gz: 819b0931a8fd8fac76a0c80246dc9aa66219ab99b2a34a86da3f026932a49fdf
3
+ metadata.gz: f48f709a21641318362670a528250e30d7cb9df30ea05559f162095b384a7e91
4
+ data.tar.gz: 808535f87b35cba48d38a9462a365ad8aa456b150d056b8b0a5a4047d6a1fa1b
5
5
  SHA512:
6
- metadata.gz: 2576ceff5fc9f086ee488eb140e35c2a86dedfc5028782fd31f3cba3d95f0a1516af2bf9e31d8d6ed69e3c2d579c3d0baca56eefab960630c7d2efcfddf62be7
7
- data.tar.gz: 01f8d5ed621cb4b017e473291e5d2566bd6fe03fa94e38cbafe5d054e0d5c9014f84111f26dd7d84fcccbd3cb82e84e3bf2d428d6020bc6959bfea5745ad3e5a
6
+ metadata.gz: 46eb36f1feb52eb5177aaeee0ba048e8b15476519b00f310b0b795f46eba54255563900a30ae98c03bdd9613f4541d502dc880a0ea1847fd5e7c63eb36160bec
7
+ data.tar.gz: f29a78a1431e4e33dabaab229493c7effbe88c2711e3c893e6ffc60eab4eb9d29112a84ecbe96c9fd3b37a6e47e10d8ef46d1f1aa9b6105a6ae1d7edae5310d4
@@ -174493,71 +174493,65 @@ ${i3}`;
174493
174493
  }
174494
174494
  var T2 = (e6) => e6.replace(/[^a-zA-Z0-9]/g, "_");
174495
174495
  function E2(e6, t3, n3, r3 = false) {
174496
- let i3 = e6?.nodes?.nodes || [], a3 = new Map(t3?.map((e7) => [e7.identifier, e7])), o4 = /* @__PURE__ */ new Set, s4 = (e7, t4, n4) => {
174497
- let a4 = i3.find((t5) => t5?.id === e7);
174498
- if (!a4 || !a4.functionDefinition?.identifier)
174496
+ let i3 = e6?.nodes?.nodes || [], a3 = new Map(t3?.map((e7) => [e7.identifier, e7])), o4 = /* @__PURE__ */ new Set, s4 = (t4, n4, a4) => {
174497
+ let o5 = i3.find((e7) => e7?.id === t4);
174498
+ if (!o5 || !o5.functionDefinition?.identifier)
174499
174499
  return "undefined";
174500
- let o5 = (a4.parameters?.nodes || []).map((t5, n5) => {
174501
- let i4 = t5.value;
174502
- if (!i4)
174503
- return r3 ? `/* @pos ${e7} ${n5} */ {}` : `/* @pos ${e7} ${n5} */ undefined`;
174504
- if (i4.__typename === "ReferenceValue") {
174505
- let t6 = i4;
174506
- if (!t6.nodeFunctionId)
174507
- return `/* @pos ${e7} ${n5} */ undefined`;
174508
- let r4 = typeof t6.inputIndex == "number" ? `p_${T2(t6.nodeFunctionId)}_${t6.parameterIndex}[${t6.inputIndex}]` : `node_${T2(t6.nodeFunctionId)}`;
174509
- return t6.referencePath?.forEach((e8) => {
174510
- r4 += `?.${e8.path}`;
174511
- }), `/* @pos ${e7} ${n5} */ ${r4}`;
174512
- }
174513
- return i4.__typename === "LiteralValue" ? `/* @pos ${e7} ${n5} */ ${y2(i4?.value)}` : i4.__typename === "NodeFunctionIdWrapper" ? s4(i4.id, e7, n5) : r3 ? `/* @pos ${e7} ${n5} */ ({} as any)` : `/* @pos ${e7} ${n5} */ undefined`;
174514
- }).join(", "), c5 = `${`fn_${a4.functionDefinition.identifier.replace(/::/g, "_")}`}(${o5})`;
174515
- return t4 !== undefined && n4 !== undefined ? `${c5}` : c5;
174516
- }, c4 = (e7, t4 = "") => {
174517
- if (o4.has(e7))
174500
+ let c5 = (o5.parameters?.nodes || []).map((n5, i4) => {
174501
+ let a5 = n5.value;
174502
+ if (!a5)
174503
+ return r3 ? `/* @pos ${t4} ${i4} */ {}` : `/* @pos ${t4} ${i4} */ undefined`;
174504
+ if (a5.__typename === "ReferenceValue") {
174505
+ let n6 = a5, r4 = typeof n6.inputIndex == "number" ? `p_${T2(n6.nodeFunctionId ?? "undefined")}_${n6.parameterIndex}[${n6.inputIndex}]` : n6.nodeFunctionId ? `node_${T2(n6.nodeFunctionId)}` : `flow_${T2(e6?.id ?? "undefined")}`;
174506
+ return n6.referencePath?.forEach((e7) => {
174507
+ r4 += `?.${e7.path}`;
174508
+ }), `/* @pos ${t4} ${i4} */ ${r4}`;
174509
+ }
174510
+ return a5.__typename === "LiteralValue" ? `/* @pos ${t4} ${i4} */ ${y2(a5?.value)}` : a5.__typename === "NodeFunctionIdWrapper" ? s4(a5.id, t4, i4) : r3 ? `/* @pos ${t4} ${i4} */ ({} as any)` : `/* @pos ${t4} ${i4} */ undefined`;
174511
+ }).join(", "), l5 = `${`/* @pos ${t4} null */ fn_${o5.functionDefinition.identifier.replace(/::/g, "_")}`}(${c5})`;
174512
+ return n4 !== undefined && a4 !== undefined ? `${l5}` : l5;
174513
+ }, c4 = (t4, l5 = "") => {
174514
+ if (o4.has(t4))
174518
174515
  return "";
174519
- let l5 = i3.find((t5) => t5?.id === e7);
174520
- if (!l5 || !l5.functionDefinition)
174516
+ let u5 = i3.find((e7) => e7?.id === t4);
174517
+ if (!u5 || !u5.functionDefinition)
174521
174518
  return "";
174522
- o4.add(e7);
174523
- let u5 = a3.get(l5.functionDefinition.identifier);
174524
- if (!u5)
174525
- return `${t4}// Error: Function ${l5.functionDefinition.identifier} not found
174519
+ o4.add(t4);
174520
+ let d5 = a3.get(u5.functionDefinition.identifier);
174521
+ if (!d5)
174522
+ return `${l5}// Error: Function ${u5.functionDefinition.identifier} not found
174526
174523
  `;
174527
- let d5 = { parameters: [] };
174528
- r3 || (d5 = g3(u5));
174529
- let f5 = (l5.parameters?.nodes || []).map((i4, a4) => {
174524
+ let f5 = { parameters: [] };
174525
+ r3 || (f5 = g3(d5));
174526
+ let p5 = (u5.parameters?.nodes || []).map((i4, a4) => {
174530
174527
  let o5 = i4.value;
174531
174528
  if (!o5)
174532
- return r3 ? `/* @pos ${e7} ${a4} */ {}` : `/* @pos ${e7} ${a4} */ undefined`;
174529
+ return r3 ? `/* @pos ${t4} ${a4} */ {}` : `/* @pos ${t4} ${a4} */ undefined`;
174533
174530
  if (o5.__typename === "ReferenceValue") {
174534
- let t5 = o5;
174535
- if (!t5.nodeFunctionId)
174536
- return `/* @pos ${e7} ${a4} */ undefined`;
174537
- let n4 = typeof t5.inputIndex == "number" ? `p_${T2(t5.nodeFunctionId)}_${t5.parameterIndex}[${t5.inputIndex}]` : `node_${T2(t5.nodeFunctionId)}`;
174538
- return t5.referencePath?.forEach((e8) => {
174539
- n4 += `?.${e8.path}`;
174540
- }), `/* @pos ${e7} ${a4} */ ${n4}`;
174531
+ let n4 = o5, r4 = typeof n4.inputIndex == "number" ? `p_${T2(n4.nodeFunctionId ?? "undefined")}_${n4.parameterIndex}[${n4.inputIndex}]` : n4.nodeFunctionId ? `node_${T2(n4.nodeFunctionId)}` : `flow_${T2(e6?.id ?? "undefined")}`;
174532
+ return n4.referencePath?.forEach((e7) => {
174533
+ r4 += `?.${e7.path}`;
174534
+ }), `/* @pos ${t4} ${a4} */ ${r4}`;
174541
174535
  }
174542
174536
  if (o5.__typename === "LiteralValue")
174543
- return `/* @pos ${e7} ${a4} */ ${y2(o5?.value)}`;
174537
+ return `/* @pos ${t4} ${a4} */ ${y2(o5?.value)}`;
174544
174538
  if (o5.__typename === "NodeFunctionIdWrapper") {
174545
- let i5 = o5;
174539
+ let e7 = o5;
174546
174540
  if (r3)
174547
- return `/* @pos ${e7} ${a4} */ (...${`p_${T2(e7)}_${a4}`}) => {
174548
- ${c4(i5.id, t4 + " ")}${t4}}`;
174541
+ return `/* @pos ${t4} ${a4} */ (...${`p_${T2(t4)}_${a4}`}) => {
174542
+ ${c4(e7.id, l5 + " ")}${l5}}`;
174549
174543
  {
174550
- let r4 = d5.parameters[a4];
174551
- return r4 && h3(r4, n3)[0].variant === m3.NODE ? `/* @pos ${e7} ${a4} */ (...${`p_${T2(e7)}_${a4}`}) => {
174552
- ${c4(i5.id, t4 + " ")}${t4}}` : `/* @pos ${e7} ${a4} */ ${s4(i5.id, e7, a4)}`;
174544
+ let r4 = f5.parameters[a4];
174545
+ return r4 && h3(r4, n3)[0].variant === m3.NODE ? `/* @pos ${t4} ${a4} */ (...${`p_${T2(t4)}_${a4}`}) => {
174546
+ ${c4(e7.id, l5 + " ")}${l5}}` : `/* @pos ${t4} ${a4} */ ${s4(e7.id, t4, a4)}`;
174553
174547
  }
174554
174548
  }
174555
- return r3 ? `/* @pos ${e7} ${a4} */ {}` : `/* @pos ${e7} ${a4} */ undefined`;
174556
- }).join(", "), p5 = `node_${T2(l5.id)}`, _3 = `fn_${l5?.functionDefinition?.identifier?.replace(/::/g, "_")}`;
174557
- f5.includes("undefined");
174558
- let v3 = `${t4}${l5.functionDefinition.identifier === "std::control::return" ? "return " : `const ${p5} = `}${_3}(${f5}) ;
174549
+ return r3 ? `/* @pos ${t4} ${a4} */ {}` : `/* @pos ${t4} ${a4} */ undefined`;
174550
+ }).join(", "), _3 = `node_${T2(u5.id)}`, v3 = `fn_${u5?.functionDefinition?.identifier?.replace(/::/g, "_")}`;
174551
+ p5.includes("undefined");
174552
+ let b3 = `${l5}${u5.functionDefinition.identifier === "std::control::return" ? "return " : `const ${_3} = `}/* @pos ${t4} null */ ${v3}(${p5}) ;
174559
174553
  `;
174560
- return l5.nextNodeId && (v3 += c4(l5.nextNodeId, t4)), v3;
174554
+ return u5.nextNodeId && (b3 += c4(u5.nextNodeId, l5)), b3;
174561
174555
  }, l4 = w2(n3), u4 = `declare function flow${e6?.signature ?? "(): void"}`, d4 = t3?.map((e7) => `declare function fn_${e7.identifier?.replace(/::/g, "_")}${e7.signature}`).join(`
174562
174556
  `), f4 = new Set(i3.map((e7) => e7?.nextNodeId).filter((e7) => !!e7)), p4 = /* @__PURE__ */ new Set;
174563
174557
  return i3.forEach((e7) => e7?.parameters?.nodes?.forEach((e8) => {
@@ -174570,30 +174564,54 @@ ${c4(i5.id, t4 + " ")}${t4}}` : `/* @pos ${e7} ${a4} */ ${s4(i5.id, e7, a4)}`
174570
174564
  ${d4}
174571
174565
 
174572
174566
  (() =>
174573
- ${e6 ? `const flow_${T2(e6.id ?? "")} = flow(${e6.settings?.nodes?.map((e7, t4) => `/* @pos undefined ${t4} */ ${y2(e7?.value)}`).join(", ") ?? ""});` : ""}
174567
+ ${e6 ? `const flow_${T2(e6.id ?? "")} = /* @pos null null */ flow(${e6.settings?.nodes?.map((e7, t4) => `/* @pos null ${t4} */ ${y2(e7?.value)}`).join(", ") ?? ""});` : ""}
174574
174568
  ${i3.filter((e7) => e7?.id && !f4.has(e7.id) && !p4.has(e7.id)).map((e7) => c4(e7.id)).join(`
174575
174569
  `)}
174576
174570
  )();
174577
174571
  `;
174578
174572
  }
174579
174573
  var I2 = (e6, n3, r3) => {
174574
+ if (!e6?.startingNodeId)
174575
+ return {
174576
+ isValid: false,
174577
+ returnType: "void",
174578
+ diagnostics: [{
174579
+ nodeId: null,
174580
+ parameterIndex: null,
174581
+ code: 0,
174582
+ message: "You need to provide a starting node to be able to execute this flow.",
174583
+ severity: "error"
174584
+ }]
174585
+ };
174586
+ if (!e6.nodes?.nodes?.find((t3) => t3?.id == e6.startingNodeId))
174587
+ return {
174588
+ isValid: false,
174589
+ returnType: "void",
174590
+ diagnostics: [{
174591
+ nodeId: null,
174592
+ parameterIndex: null,
174593
+ code: 0,
174594
+ message: "The starting node is not linked within the flow. Please make sure the starting node is connected to the rest of the flow.",
174595
+ severity: "error"
174596
+ }]
174597
+ };
174580
174598
  let i3 = E2(e6, n3, r3), a3 = "index.ts", o4 = S2(a3, i3), s4 = o4.getSourceFile(a3), c4 = o4.languageService.getProgram().getSemanticDiagnostics(s4).map((e7) => {
174581
174599
  let n4 = import_typescript.flattenDiagnosticMessageText(e7.messageText, `
174582
- `), r4, i4;
174600
+ `), r4, i4 = null;
174583
174601
  if (e7.start !== undefined) {
174584
- let t3 = s4.getFullText(), n5 = Math.max(0, e7.start - 300), a4 = Math.min(t3.length, e7.start), o5 = t3.substring(n5, a4), c5 = /\/\* @pos ([^ ]+) (\d+) \*\//g, l4, u4 = null, d4 = -1;
174602
+ let t3 = s4.getFullText(), n5 = Math.max(0, e7.start - 300), a4 = Math.min(t3.length, e7.start), o5 = t3.substring(n5, a4), c5 = /\/\* @pos ([^ ]+) (\d+|null) \*\//g, l4, u4 = null, d4 = -1;
174585
174603
  for (;(l4 = c5.exec(o5)) !== null; ) {
174586
174604
  let t4 = n5 + l4.index + l4[0].length;
174587
174605
  t4 <= e7.start && t4 > d4 && (d4 = t4, u4 = l4);
174588
174606
  }
174589
- u4 && (r4 = u4[1] === "undefined" ? undefined : u4[1], i4 = parseInt(u4[2], 10));
174607
+ u4 && (r4 = u4[1] === "null" ? null : u4[1], i4 = parseInt(u4[2], 10));
174590
174608
  }
174591
174609
  return {
174592
174610
  message: n4,
174593
174611
  code: e7.code,
174594
174612
  severity: "error",
174595
174613
  nodeId: r4,
174596
- parameterIndex: i4
174614
+ parameterIndex: typeof i4 == "number" && Number.isSafeInteger(i4) ? i4 : null
174597
174615
  };
174598
174616
  }).filter((e7) => e7 !== null);
174599
174617
  return {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Triangulum
4
- VERSION = '0.12.2'
4
+ VERSION = '0.13.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: triangulum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niklas van Schrick