@juhuu/sdk-ts 1.2.269 → 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
  }
@@ -3751,14 +3753,8 @@ var FlowsService = class extends Service {
3751
3753
  }
3752
3754
  execInput[key] = value;
3753
3755
  }
3754
- const response = await this.execute({
3755
- flowId: finalFlowId,
3756
- input: execInput
3757
- });
3758
- if (!response.ok) {
3759
- throw new Error(`Failed to execute flow: ${response.data?.message || "Unknown error"}`);
3760
- }
3761
- return { output: response.data.output };
3756
+ const { output } = await this.executeLocally(finalFlowId, execInput);
3757
+ return { output };
3762
3758
  },
3763
3759
  "end.custom": async (inputs) => {
3764
3760
  return { output: { ...inputs } };
@@ -3870,20 +3866,16 @@ var FlowsService = class extends Service {
3870
3866
  throw new Error("Block type not implemented in executeLocally");
3871
3867
  }
3872
3868
  };
3873
- async executeLocally(FlowExecuteLocallyParams, FlowExecuteLocallyOptions) {
3869
+ async executeLocally(flowId, context = {}) {
3874
3870
  const logArray = [];
3875
3871
  logArray.push({
3876
3872
  createdAt: /* @__PURE__ */ new Date(),
3877
- message: `Starting local execution of flow '${FlowExecuteLocallyParams.flowId}'`,
3873
+ message: `Starting local execution of flow '${flowId}'`,
3878
3874
  severity: "info"
3879
3875
  });
3880
- const flowResponse = await this.retrieve({
3881
- flowId: FlowExecuteLocallyParams.flowId
3882
- });
3876
+ const flowResponse = await this.retrieve({ flowId });
3883
3877
  if (!flowResponse.ok) {
3884
- throw new Error(
3885
- `Failed to retrieve flow: ${flowResponse.data?.message || "Unknown error"}`
3886
- );
3878
+ throw new Error(`Failed to retrieve flow: ${flowResponse.data?.message || "Unknown error"}`);
3887
3879
  }
3888
3880
  const flow = flowResponse.data.flow;
3889
3881
  const blocksById = new Map(
@@ -3903,11 +3895,7 @@ var FlowsService = class extends Service {
3903
3895
  if (executor === void 0 || executor === null) {
3904
3896
  throw new Error(`No executor for ${block.type}`);
3905
3897
  }
3906
- const raw = await executor(
3907
- inputs,
3908
- block,
3909
- FlowExecuteLocallyParams.input ?? {}
3910
- );
3898
+ const raw = await executor(inputs, block, context);
3911
3899
  const { flowBranch, output } = raw;
3912
3900
  outputStore[block.id] = output;
3913
3901
  if (raw.logArray !== void 0) {
@@ -3936,7 +3924,7 @@ var FlowsService = class extends Service {
3936
3924
  };
3937
3925
  if (flow.startNode.type.startsWith("start.") === false) {
3938
3926
  throw new Error(
3939
- `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.'`
3940
3928
  );
3941
3929
  }
3942
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
  }
@@ -3707,14 +3709,8 @@ var FlowsService = class extends Service {
3707
3709
  }
3708
3710
  execInput[key] = value;
3709
3711
  }
3710
- const response = await this.execute({
3711
- flowId: finalFlowId,
3712
- input: execInput
3713
- });
3714
- if (!response.ok) {
3715
- throw new Error(`Failed to execute flow: ${response.data?.message || "Unknown error"}`);
3716
- }
3717
- return { output: response.data.output };
3712
+ const { output } = await this.executeLocally(finalFlowId, execInput);
3713
+ return { output };
3718
3714
  },
3719
3715
  "end.custom": async (inputs) => {
3720
3716
  return { output: { ...inputs } };
@@ -3826,20 +3822,16 @@ var FlowsService = class extends Service {
3826
3822
  throw new Error("Block type not implemented in executeLocally");
3827
3823
  }
3828
3824
  };
3829
- async executeLocally(FlowExecuteLocallyParams, FlowExecuteLocallyOptions) {
3825
+ async executeLocally(flowId, context = {}) {
3830
3826
  const logArray = [];
3831
3827
  logArray.push({
3832
3828
  createdAt: /* @__PURE__ */ new Date(),
3833
- message: `Starting local execution of flow '${FlowExecuteLocallyParams.flowId}'`,
3829
+ message: `Starting local execution of flow '${flowId}'`,
3834
3830
  severity: "info"
3835
3831
  });
3836
- const flowResponse = await this.retrieve({
3837
- flowId: FlowExecuteLocallyParams.flowId
3838
- });
3832
+ const flowResponse = await this.retrieve({ flowId });
3839
3833
  if (!flowResponse.ok) {
3840
- throw new Error(
3841
- `Failed to retrieve flow: ${flowResponse.data?.message || "Unknown error"}`
3842
- );
3834
+ throw new Error(`Failed to retrieve flow: ${flowResponse.data?.message || "Unknown error"}`);
3843
3835
  }
3844
3836
  const flow = flowResponse.data.flow;
3845
3837
  const blocksById = new Map(
@@ -3859,11 +3851,7 @@ var FlowsService = class extends Service {
3859
3851
  if (executor === void 0 || executor === null) {
3860
3852
  throw new Error(`No executor for ${block.type}`);
3861
3853
  }
3862
- const raw = await executor(
3863
- inputs,
3864
- block,
3865
- FlowExecuteLocallyParams.input ?? {}
3866
- );
3854
+ const raw = await executor(inputs, block, context);
3867
3855
  const { flowBranch, output } = raw;
3868
3856
  outputStore[block.id] = output;
3869
3857
  if (raw.logArray !== void 0) {
@@ -3892,7 +3880,7 @@ var FlowsService = class extends Service {
3892
3880
  };
3893
3881
  if (flow.startNode.type.startsWith("start.") === false) {
3894
3882
  throw new Error(
3895
- `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.'`
3896
3884
  );
3897
3885
  }
3898
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.269",
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",