@superatomai/sdk-node 0.0.55-dsp → 0.0.56-dsp

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.
@@ -382,7 +382,7 @@ function handleMessage(msg) {
382
382
  if (initResolve) {
383
383
  const now = new Date(msg.now || (/* @__PURE__ */ new Date()).toISOString());
384
384
  const params = restoreParamTypes(msg.params || {}, msg.paramSchema);
385
- initResolve({ params, now, mode: msg.mode, data: msg.data, datasets: msg.datasets, fmt: msg.fmt });
385
+ initResolve({ params, now, mode: msg.mode, data: msg.data, datasets: msg.datasets, fmt: msg.fmt, entities: msg.entities });
386
386
  initResolve = null;
387
387
  }
388
388
  break;
@@ -398,11 +398,11 @@ function collectDatasets(queries) {
398
398
  }
399
399
  return out;
400
400
  }
401
- async function runComponents(mod, data, params, fmtCfg, datasets = {}) {
401
+ async function runComponents(mod, data, params, fmtCfg, datasets = {}, entities = []) {
402
402
  const getComponents = mod?.getComponents ?? mod?.default?.getComponents;
403
403
  if (typeof getComponents !== "function") return {};
404
404
  try {
405
- const out = await getComponents(data, params, makeFmt(fmtCfg), datasets);
405
+ const out = await getComponents(data, params, makeFmt(fmtCfg), datasets, entities);
406
406
  if (!Array.isArray(out)) {
407
407
  return { componentsError: "getComponents must return an ARRAY of component specs" };
408
408
  }
@@ -415,11 +415,11 @@ async function runComponents(mod, data, params, fmtCfg, datasets = {}) {
415
415
  return { componentsError: e?.message || String(err) };
416
416
  }
417
417
  }
418
- async function runAnalysis(mod, data, params, fmtCfg, datasets = {}) {
418
+ async function runAnalysis(mod, data, params, fmtCfg, datasets = {}, entities = []) {
419
419
  const getAnalysis = mod?.getAnalysis ?? mod?.default?.getAnalysis;
420
420
  if (typeof getAnalysis !== "function") return {};
421
421
  try {
422
- const out = await getAnalysis(data, params, makeFmt(fmtCfg), datasets);
422
+ const out = await getAnalysis(data, params, makeFmt(fmtCfg), datasets, entities);
423
423
  if (!out || typeof out !== "object") {
424
424
  return { analysisError: "getAnalysis must return an object with { analysis, summary, method }" };
425
425
  }
@@ -452,7 +452,7 @@ async function runAnalysis(mod, data, params, fmtCfg, datasets = {}) {
452
452
  const started = Date.now();
453
453
  const rows = Array.isArray(init.data) ? init.data : [];
454
454
  const ds = init.datasets ?? {};
455
- const authored = init.mode === "analysis" ? await runAnalysis(mod, rows, init.params, init.fmt, ds) : await runComponents(mod, rows, init.params, init.fmt, ds);
455
+ const authored = init.mode === "analysis" ? await runAnalysis(mod, rows, init.params, init.fmt, ds, init.entities) : await runComponents(mod, rows, init.params, init.fmt, ds, init.entities);
456
456
  const flushedAuthored = send({
457
457
  type: "result",
458
458
  data: [],
@@ -483,8 +483,8 @@ async function runAnalysis(mod, data, params, fmtCfg, datasets = {}) {
483
483
  const count = typeof raw?.count === "number" ? raw.count : data.length;
484
484
  const sampleRows = data.slice(0, 5);
485
485
  const ds = collectDatasets(executedQueries);
486
- const { analysis, analysisError } = await runAnalysis(mod, data, init.params, init.fmt, ds);
487
- const { components, componentsError } = await runComponents(mod, data, init.params, init.fmt, ds);
486
+ const { analysis, analysisError } = await runAnalysis(mod, data, init.params, init.fmt, ds, init.entities);
487
+ const { components, componentsError } = await runComponents(mod, data, init.params, init.fmt, ds, init.entities);
488
488
  const result = {
489
489
  type: "result",
490
490
  data,
@@ -380,7 +380,7 @@ function handleMessage(msg) {
380
380
  if (initResolve) {
381
381
  const now = new Date(msg.now || (/* @__PURE__ */ new Date()).toISOString());
382
382
  const params = restoreParamTypes(msg.params || {}, msg.paramSchema);
383
- initResolve({ params, now, mode: msg.mode, data: msg.data, datasets: msg.datasets, fmt: msg.fmt });
383
+ initResolve({ params, now, mode: msg.mode, data: msg.data, datasets: msg.datasets, fmt: msg.fmt, entities: msg.entities });
384
384
  initResolve = null;
385
385
  }
386
386
  break;
@@ -396,11 +396,11 @@ function collectDatasets(queries) {
396
396
  }
397
397
  return out;
398
398
  }
399
- async function runComponents(mod, data, params, fmtCfg, datasets = {}) {
399
+ async function runComponents(mod, data, params, fmtCfg, datasets = {}, entities = []) {
400
400
  const getComponents = mod?.getComponents ?? mod?.default?.getComponents;
401
401
  if (typeof getComponents !== "function") return {};
402
402
  try {
403
- const out = await getComponents(data, params, makeFmt(fmtCfg), datasets);
403
+ const out = await getComponents(data, params, makeFmt(fmtCfg), datasets, entities);
404
404
  if (!Array.isArray(out)) {
405
405
  return { componentsError: "getComponents must return an ARRAY of component specs" };
406
406
  }
@@ -413,11 +413,11 @@ async function runComponents(mod, data, params, fmtCfg, datasets = {}) {
413
413
  return { componentsError: e?.message || String(err) };
414
414
  }
415
415
  }
416
- async function runAnalysis(mod, data, params, fmtCfg, datasets = {}) {
416
+ async function runAnalysis(mod, data, params, fmtCfg, datasets = {}, entities = []) {
417
417
  const getAnalysis = mod?.getAnalysis ?? mod?.default?.getAnalysis;
418
418
  if (typeof getAnalysis !== "function") return {};
419
419
  try {
420
- const out = await getAnalysis(data, params, makeFmt(fmtCfg), datasets);
420
+ const out = await getAnalysis(data, params, makeFmt(fmtCfg), datasets, entities);
421
421
  if (!out || typeof out !== "object") {
422
422
  return { analysisError: "getAnalysis must return an object with { analysis, summary, method }" };
423
423
  }
@@ -450,7 +450,7 @@ async function runAnalysis(mod, data, params, fmtCfg, datasets = {}) {
450
450
  const started = Date.now();
451
451
  const rows = Array.isArray(init.data) ? init.data : [];
452
452
  const ds = init.datasets ?? {};
453
- const authored = init.mode === "analysis" ? await runAnalysis(mod, rows, init.params, init.fmt, ds) : await runComponents(mod, rows, init.params, init.fmt, ds);
453
+ const authored = init.mode === "analysis" ? await runAnalysis(mod, rows, init.params, init.fmt, ds, init.entities) : await runComponents(mod, rows, init.params, init.fmt, ds, init.entities);
454
454
  const flushedAuthored = send({
455
455
  type: "result",
456
456
  data: [],
@@ -481,8 +481,8 @@ async function runAnalysis(mod, data, params, fmtCfg, datasets = {}) {
481
481
  const count = typeof raw?.count === "number" ? raw.count : data.length;
482
482
  const sampleRows = data.slice(0, 5);
483
483
  const ds = collectDatasets(executedQueries);
484
- const { analysis, analysisError } = await runAnalysis(mod, data, init.params, init.fmt, ds);
485
- const { components, componentsError } = await runComponents(mod, data, init.params, init.fmt, ds);
484
+ const { analysis, analysisError } = await runAnalysis(mod, data, init.params, init.fmt, ds, init.entities);
485
+ const { components, componentsError } = await runComponents(mod, data, init.params, init.fmt, ds, init.entities);
486
486
  const result = {
487
487
  type: "result",
488
488
  data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superatomai/sdk-node",
3
- "version": "0.0.55-dsp",
3
+ "version": "0.0.56-dsp",
4
4
  "description": "Node.js TypeScript SDK for Superatom",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",