Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:cables-gl/cables into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pandrr committed Jan 15, 2025
2 parents 83b453a + a6ebec9 commit d9ca0cb
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 72 deletions.
16 changes: 12 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function _core_libs_copy(done)
const source = "build/libs/";
const target = "../cables_api/public/libs_core/";

if (!process.env.cables_standalone || process.env.cables_standalone === "false")
if (!process.env.cables_electron || process.env.cables_electron === "false")
{
if (!fs.existsSync(target)) fs.mkdirSync(target, { "recursive": true });
if (!fs.existsSync(source)) fs.mkdirSync(source, { "recursive": true });
Expand Down Expand Up @@ -111,12 +111,20 @@ function _core_libs(done)
getBuildInfo((buildInfo) =>
{
webpack(webpackLibsConfig(isLiveBuild, buildInfo, false, analyze),
(err, stats) =>
(err, multiStats) =>
{
if (err) throw err;
if (stats && stats.hasErrors() && stats.compilation && stats.compilation.errors)
if (multiStats && multiStats.hasErrors())
{
done(Error(stats.compilation.errors.join("\n")));
const allErrors = [];
multiStats.stats.forEach((stat) =>
{
if (stat.hasErrors() && stat.compilation && stat.compilation.errors)
{
allErrors.push(stat.compilation.errors.join("\n"));
}
});
done(Error(allErrors.join("\n\n")));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/core_op.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const Op = function ()

Op.prototype.require = function (name)
{
if (CABLES.platform && CABLES.StandaloneElectron && !CABLES.platform.frontendOptions.isStandalone)
if (CABLES.platform && CABLES.StandaloneElectron && !CABLES.platform.frontendOptions.isElectron)
this.setUiError("notstandalone", "This op will only work in cables standalone version", 3);

return null;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/cables/standalone_electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const StandaloneElectron = class

op.isElectron = () =>
{
return CABLES.platform.frontendOptions.isStandalone;
return CABLES.platform.frontendOptions.isElectron;
};
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/ops/base/Ops.Cables.UIMode/Ops.Cables.UIMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const
outUI = op.outBoolNum("UI", op.patch.isEditorMode()),
outOverlay = op.outBoolNum("Overlay Mode", false),
outRemoteViewer = op.outBoolNum("Remote Viewer", window.gui ? window.gui.isRemoteClient : false),
outStandalone = op.outBoolNum("Is Standalone", (CABLES.platform && CABLES.platform.frontendOptions.isStandalone )),
outStandalone = op.outBoolNum("Is Standalone", (CABLES.platform && CABLES.platform.frontendOptions.isElectron)),
outCanvasMode = op.outNumber("Canvas Mode"),
outPatchVisible = op.outBoolNum("Patch Field Visible");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ const foundOut = op.outBool("Found");
objectIn.onChange = update;
pathIn.onChange = update;

op.toWorkPortsNeedsString(pathIn);

function update()
{
const data = objectIn.get();
const path = pathIn.get();
op.setUiError("missing", null);
op.setUiError("notiterable", null);

if (data && path)
{
if (!Array.isArray(data) && !(typeof data === "object"))
{
foundOut.set(false);
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not travesable by path");
op.setUiError("notiterable", "input of type " + (typeof data) + " is not traversable by path");
}
else
{
op.setUiError("notiterable", null);
const parts = path.split(".");
op.setUiAttrib({ "extendTitle": parts[parts.length - 1] + "" });
let result = resolve(path, data);
Expand All @@ -29,14 +32,14 @@ function update()
const errorMsg = "could not find element at path " + path;
foundOut.set(false);
result = null;
op.setUiError("missing", errorMsg, 2);
op.setUiError("missing", errorMsg, 1);
}
else if (!Array.isArray(result))
{
const errorMsg = "element at path " + path + " is not an array";
foundOut.set(false);
result = null;
op.setUiError("missing", errorMsg, 2);
op.setUiError("missing", errorMsg, 1);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ const foundOut = op.outBool("Found");
objectIn.onChange = update;
pathIn.onChange = update;

op.toWorkPortsNeedsString(pathIn);

function update()
{
const data = objectIn.get();
const path = pathIn.get();
op.setUiError("missing", null);
op.setUiError("notiterable", null);

if (data && path)
{
if (!Array.isArray(data) && !(typeof data === "object"))
{
foundOut.set(false);
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not travesable by path");
op.setUiError("notiterable", "input of type " + (typeof data) + " is not traversable by path");
}
else
{
op.setUiError("notiterable", null);
const parts = path.split(".");
op.setUiAttrib({ "extendTitle": parts[parts.length - 1] + "" });
let result = resolve(path, data);
Expand All @@ -29,14 +32,14 @@ function update()
const errorMsg = "could not find element at path " + path;
foundOut.set(false);
result = null;
op.setUiError("missing", errorMsg, 2);
op.setUiError("missing", errorMsg, 1);
}
else if (typeof result !== "number")
{
const errorMsg = "element at path " + path + " is not a number";
foundOut.set(false);
result = null;
op.setUiError("missing", errorMsg, 2);
op.setUiError("missing", errorMsg, 1);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@ objectIn.onChange = update;
pathIn.onChange = update;
pathIn.setUiAttribs({ "stringTrim": true });

op.toWorkPortsNeedsString(pathIn);

function update()
{
const data = objectIn.get();
const path = pathIn.get();
op.setUiError("missing", null);
op.setUiError("notiterable", null);

if (data && path)
{
if (!Array.isArray(data) && !(typeof data === "object"))
{
foundOut.set(false);
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not travesable by path");
op.setUiError("notiterable", "input of type " + (typeof data) + " is not traversable by path");
}
else
{
op.setUiError("notiterable", null);
const parts = path.split(".");
op.setUiAttrib({ "extendTitle": parts[parts.length - 1] + "" });
let result = resolve(path, data);
Expand All @@ -30,14 +33,14 @@ function update()
const errorMsg = "could not find element at path " + path;
foundOut.set(false);
result = null;
op.setUiError("missing", errorMsg, 2);
op.setUiError("missing", errorMsg, 1);
}
else if (Array.isArray(result) || result === null || typeof result !== "object")
{
const errorMsg = "element at path " + path + " is not an object";
foundOut.set(false);
result = null;
op.setUiError("missing", errorMsg, 2);
op.setUiError("missing", errorMsg, 1);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,41 @@ objectIn.onChange = update;
pathIn.onChange = update;
returnPathIn.onChange = update;

op.toWorkPortsNeedsString(pathIn);

function update()
{
const data = objectIn.get();
const path = pathIn.get();
op.setUiError("missing", null);
op.setUiError("notiterable", null);

if (data && path)
{
if (!Array.isArray(data) && !(typeof data === "object"))
{
foundOut.set(false);
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not travesable by path");
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not traversable by path");
}
else
{
op.setUiError("notiterable", null);
const parts = path.split(".");
op.setUiAttrib({ "extendTitle": parts[parts.length - 1] + "" });
let result = resolve(path, data);
if (result === undefined)
{
const errorMsg = "could not find element at path " + path;
let errorLevel = 2;
result = null;
foundOut.set(false);
if (returnPathIn.get())
{
result = path;
errorLevel = 1;
}
else
{
result = null;
}
op.setUiError("missing", errorMsg, errorLevel);
op.setUiError("missing", errorMsg, 1);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,26 @@ const

objectIn.onChange =
pathIn.onChange = update;
pathIn.setUiAttribs({ "stringTrim": true });

pathIn.on("change", updateUi);
updateUi();
function updateUi()
{
if (!pathIn.get())op.setUiError("nokey", "Missing Key Value");
else op.setUiError("nokey", null);
}
op.toWorkPortsNeedsString(pathIn);
pathIn.setUiAttribs({ "stringTrim": true });

function update()
{
const data = objectIn.get();
const path = pathIn.get();
op.setUiError("missing", null);
op.setUiError("notiterable", null);

if (data && path)
{
if (!Array.isArray(data) && !(typeof data === "object"))
{
foundOut.set(false);
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not travesable by path");
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not traversable by path");
}
else
{
op.setUiError("notiterable", null);
const parts = path.split(".");
op.setUiAttrib({ "extendTitle": parts[parts.length - 1] + "" });
let result = resolve(path, data);
Expand All @@ -39,14 +34,14 @@ function update()
const errorMsg = "could not find element at path " + path;
foundOut.set(false);
result = null;
op.setUiError("missing", errorMsg, 2);
op.setUiError("missing", errorMsg, 1);
}
else if (!Array.isArray(result))
{
const errorMsg = "element at path " + path + " is not an array";
foundOut.set(false);
result = null;
op.setUiError("missing", errorMsg, 2);
op.setUiError("missing", errorMsg, 1);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,26 @@ const

objectIn.onChange = update;
pathIn.onChange = update;
pathIn.setUiAttribs({ "stringTrim": true });

pathIn.on("change", updateUi);
updateUi();
function updateUi()
{
if (!pathIn.get())op.setUiError("nokey", "Missing Key Value");
else op.setUiError("nokey", null);
}
op.toWorkPortsNeedsString(pathIn);
pathIn.setUiAttribs({ "stringTrim": true });

function update()
{
const data = objectIn.get();
const path = pathIn.get();
op.setUiError("missing", null);
op.setUiError("notiterable", null);

if (data && path)
{
if (!Array.isArray(data) && !(typeof data === "object"))
{
foundOut.set(false);
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not travesable by path");
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not traversable by path");
}
else
{
op.setUiError("notiterable", null);
const parts = path.split(".");
op.setUiAttrib({ "extendTitle": parts[parts.length - 1] + "" });
let result = resolve(path, data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,27 @@ const
resultOut = op.outObject("Output"),
foundOut = op.outBool("Found");

objectIn.onChange =
pathIn.onChange = update;
objectIn.onChange = pathIn.onChange = update;

op.toWorkPortsNeedsString(pathIn);
pathIn.setUiAttribs({ "stringTrim": true });
pathIn.on("change", updateUi);

updateUi();
function updateUi()
{
if (!pathIn.get())op.setUiError("nokey", "Missing Key Value");
else op.setUiError("nokey", null);
}

function update()
{
const data = objectIn.get();
const path = pathIn.get();
op.setUiError("missing", null);
op.setUiError("notiterable", null);

if (data && path)
{
if (!Array.isArray(data) && !(typeof data === "object"))
{
foundOut.set(false);
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not travesable by path");
op.setUiError("notiterable", "input object of type " + (typeof data) + " is not traversable by path");
}
else
{
op.setUiError("notiterable", null);
const parts = path.split(".");
op.setUiAttrib({ "extendTitle": parts[parts.length - 1] + "" });
let result = resolve(path, data);
Expand All @@ -40,14 +33,14 @@ function update()
const errorMsg = "could not find element at path " + path;
foundOut.set(false);
result = null;
op.setUiError("missing", errorMsg, 2);
op.setUiError("missing", errorMsg, 1);
}
else if (Array.isArray(result) || result === null || typeof result !== "object")
{
const errorMsg = "element at path " + path + " is not an object";
foundOut.set(false);
result = null;
op.setUiError("missing", errorMsg, 2);
op.setUiError("missing", errorMsg, 1);
}
else
{
Expand Down
Loading

0 comments on commit d9ca0cb

Please sign in to comment.