@juhuu/sdk-ts 1.2.268 → 1.2.2656

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/dist/index.d.mts CHANGED
@@ -1701,7 +1701,7 @@ declare class FlowsService extends Service {
1701
1701
  private resolveInputs;
1702
1702
  private isInputConnected;
1703
1703
  private blockExecutors;
1704
- executeLocally(FlowExecuteLocallyParams: JUHUU.Flow.ExecuteLocally.Params, FlowExecuteLocallyOptions?: JUHUU.Flow.Execute.Options): Promise<{
1704
+ executeLocally(flowId: string, context?: Record<string, any>): Promise<{
1705
1705
  output: Record<string, any>;
1706
1706
  logArray: FlowLog[];
1707
1707
  }>;
@@ -4824,17 +4824,6 @@ declare namespace JUHUU {
4824
4824
  output: Record<string, any>;
4825
4825
  };
4826
4826
  }
4827
- namespace ExecuteLocally {
4828
- type Params = {
4829
- flowId: string;
4830
- input?: Record<string, any>;
4831
- };
4832
- type Options = JUHUU.RequestOptions;
4833
- type Response = {
4834
- output: Record<string, any>;
4835
- logArray: FlowLog[];
4836
- };
4837
- }
4838
4827
  }
4839
4828
  namespace FlowTrace {
4840
4829
  type Object = {
package/dist/index.d.ts CHANGED
@@ -1701,7 +1701,7 @@ declare class FlowsService extends Service {
1701
1701
  private resolveInputs;
1702
1702
  private isInputConnected;
1703
1703
  private blockExecutors;
1704
- executeLocally(FlowExecuteLocallyParams: JUHUU.Flow.ExecuteLocally.Params, FlowExecuteLocallyOptions?: JUHUU.Flow.Execute.Options): Promise<{
1704
+ executeLocally(flowId: string, context?: Record<string, any>): Promise<{
1705
1705
  output: Record<string, any>;
1706
1706
  logArray: FlowLog[];
1707
1707
  }>;
@@ -4824,17 +4824,6 @@ declare namespace JUHUU {
4824
4824
  output: Record<string, any>;
4825
4825
  };
4826
4826
  }
4827
- namespace ExecuteLocally {
4828
- type Params = {
4829
- flowId: string;
4830
- input?: Record<string, any>;
4831
- };
4832
- type Options = JUHUU.RequestOptions;
4833
- type Response = {
4834
- output: Record<string, any>;
4835
- logArray: FlowLog[];
4836
- };
4837
- }
4838
4827
  }
4839
4828
  namespace FlowTrace {
4840
4829
  type Object = {
package/dist/index.js CHANGED
@@ -3718,7 +3718,9 @@ var FlowsService = class extends Service {
3718
3718
  for (const param of defs) {
3719
3719
  const value = context[param.name];
3720
3720
  if (value === void 0 && param.required) {
3721
- throw new Error(`Missing required input parameter '${param.name}'`);
3721
+ throw new Error(
3722
+ `Missing required input parameter '${param.name}'`
3723
+ );
3722
3724
  }
3723
3725
  outputs[param.name] = value;
3724
3726
  }
@@ -3864,20 +3866,16 @@ var FlowsService = class extends Service {
3864
3866
  throw new Error("Block type not implemented in executeLocally");
3865
3867
  }
3866
3868
  };
3867
- async executeLocally(FlowExecuteLocallyParams, FlowExecuteLocallyOptions) {
3869
+ async executeLocally(flowId, context = {}) {
3868
3870
  const logArray = [];
3869
3871
  logArray.push({
3870
3872
  createdAt: /* @__PURE__ */ new Date(),
3871
- message: `Starting local execution of flow '${FlowExecuteLocallyParams.flowId}'`,
3873
+ message: `Starting local execution of flow '${flowId}'`,
3872
3874
  severity: "info"
3873
3875
  });
3874
- const flowResponse = await this.retrieve({
3875
- flowId: FlowExecuteLocallyParams.flowId
3876
- });
3876
+ const flowResponse = await this.retrieve({ flowId });
3877
3877
  if (!flowResponse.ok) {
3878
- throw new Error(
3879
- `Failed to retrieve flow: ${flowResponse.data?.message || "Unknown error"}`
3880
- );
3878
+ throw new Error(`Failed to retrieve flow: ${flowResponse.data?.message || "Unknown error"}`);
3881
3879
  }
3882
3880
  const flow = flowResponse.data.flow;
3883
3881
  const blocksById = new Map(
@@ -3897,11 +3895,7 @@ var FlowsService = class extends Service {
3897
3895
  if (executor === void 0 || executor === null) {
3898
3896
  throw new Error(`No executor for ${block.type}`);
3899
3897
  }
3900
- const raw = await executor(
3901
- inputs,
3902
- block,
3903
- FlowExecuteLocallyParams.input ?? {}
3904
- );
3898
+ const raw = await executor(inputs, block, context);
3905
3899
  const { flowBranch, output } = raw;
3906
3900
  outputStore[block.id] = output;
3907
3901
  if (raw.logArray !== void 0) {
@@ -3930,7 +3924,7 @@ var FlowsService = class extends Service {
3930
3924
  };
3931
3925
  if (flow.startNode.type.startsWith("start.") === false) {
3932
3926
  throw new Error(
3933
- `Flow ${FlowExecuteLocallyParams.flowId} has an invalid start block that is not of type 'start.'`
3927
+ `Flow ${flowId} has an invalid start block that is not of type 'start.'`
3934
3928
  );
3935
3929
  }
3936
3930
  let current = flow.startNode;
package/dist/index.mjs CHANGED
@@ -3674,7 +3674,9 @@ var FlowsService = class extends Service {
3674
3674
  for (const param of defs) {
3675
3675
  const value = context[param.name];
3676
3676
  if (value === void 0 && param.required) {
3677
- throw new Error(`Missing required input parameter '${param.name}'`);
3677
+ throw new Error(
3678
+ `Missing required input parameter '${param.name}'`
3679
+ );
3678
3680
  }
3679
3681
  outputs[param.name] = value;
3680
3682
  }
@@ -3820,20 +3822,16 @@ var FlowsService = class extends Service {
3820
3822
  throw new Error("Block type not implemented in executeLocally");
3821
3823
  }
3822
3824
  };
3823
- async executeLocally(FlowExecuteLocallyParams, FlowExecuteLocallyOptions) {
3825
+ async executeLocally(flowId, context = {}) {
3824
3826
  const logArray = [];
3825
3827
  logArray.push({
3826
3828
  createdAt: /* @__PURE__ */ new Date(),
3827
- message: `Starting local execution of flow '${FlowExecuteLocallyParams.flowId}'`,
3829
+ message: `Starting local execution of flow '${flowId}'`,
3828
3830
  severity: "info"
3829
3831
  });
3830
- const flowResponse = await this.retrieve({
3831
- flowId: FlowExecuteLocallyParams.flowId
3832
- });
3832
+ const flowResponse = await this.retrieve({ flowId });
3833
3833
  if (!flowResponse.ok) {
3834
- throw new Error(
3835
- `Failed to retrieve flow: ${flowResponse.data?.message || "Unknown error"}`
3836
- );
3834
+ throw new Error(`Failed to retrieve flow: ${flowResponse.data?.message || "Unknown error"}`);
3837
3835
  }
3838
3836
  const flow = flowResponse.data.flow;
3839
3837
  const blocksById = new Map(
@@ -3853,11 +3851,7 @@ var FlowsService = class extends Service {
3853
3851
  if (executor === void 0 || executor === null) {
3854
3852
  throw new Error(`No executor for ${block.type}`);
3855
3853
  }
3856
- const raw = await executor(
3857
- inputs,
3858
- block,
3859
- FlowExecuteLocallyParams.input ?? {}
3860
- );
3854
+ const raw = await executor(inputs, block, context);
3861
3855
  const { flowBranch, output } = raw;
3862
3856
  outputStore[block.id] = output;
3863
3857
  if (raw.logArray !== void 0) {
@@ -3886,7 +3880,7 @@ var FlowsService = class extends Service {
3886
3880
  };
3887
3881
  if (flow.startNode.type.startsWith("start.") === false) {
3888
3882
  throw new Error(
3889
- `Flow ${FlowExecuteLocallyParams.flowId} has an invalid start block that is not of type 'start.'`
3883
+ `Flow ${flowId} has an invalid start block that is not of type 'start.'`
3890
3884
  );
3891
3885
  }
3892
3886
  let current = flow.startNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juhuu/sdk-ts",
3
- "version": "1.2.268",
3
+ "version": "1.2.2656",
4
4
  "description": "Typescript wrapper for JUHUU services",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",