@fctc/interface-logic 2.0.5 → 2.0.7

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/hooks.js CHANGED
@@ -2942,15 +2942,21 @@ function useActionService() {
2942
2942
  const loadAction = (0, import_react6.useCallback)(
2943
2943
  async ({
2944
2944
  idAction,
2945
- context
2945
+ context,
2946
+ service
2946
2947
  }) => {
2947
2948
  const jsonData = {
2948
2949
  action_id: idAction,
2949
2950
  with_context: { ...context }
2950
2951
  };
2951
- return env.requests.post("/load_action" /* LOAD_ACTION */, jsonData, {
2952
- headers: { "Content-Type": "application/json" }
2953
- });
2952
+ return env.requests.post(
2953
+ "/load_action" /* LOAD_ACTION */,
2954
+ jsonData,
2955
+ {
2956
+ headers: { "Content-Type": "application/json" }
2957
+ },
2958
+ service
2959
+ );
2954
2960
  },
2955
2961
  [env]
2956
2962
  );
@@ -2959,7 +2965,8 @@ function useActionService() {
2959
2965
  model,
2960
2966
  ids = [],
2961
2967
  context,
2962
- method
2968
+ method,
2969
+ service
2963
2970
  }) => {
2964
2971
  try {
2965
2972
  const jsonData = {
@@ -2968,9 +2975,14 @@ function useActionService() {
2968
2975
  ids,
2969
2976
  with_context: context
2970
2977
  };
2971
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2972
- headers: { "Content-Type": "application/json" }
2973
- });
2978
+ return env.requests.post(
2979
+ "/call" /* CALL_PATH */,
2980
+ jsonData,
2981
+ {
2982
+ headers: { "Content-Type": "application/json" }
2983
+ },
2984
+ service
2985
+ );
2974
2986
  } catch (error) {
2975
2987
  console.error("Error when calling button action:", error);
2976
2988
  throw error;
@@ -2982,7 +2994,8 @@ function useActionService() {
2982
2994
  async ({
2983
2995
  model,
2984
2996
  ids,
2985
- context
2997
+ context,
2998
+ service
2986
2999
  }) => {
2987
3000
  const jsonData = {
2988
3001
  model,
@@ -2990,9 +3003,14 @@ function useActionService() {
2990
3003
  ids,
2991
3004
  with_context: context
2992
3005
  };
2993
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2994
- headers: { "Content-Type": "application/json" }
2995
- });
3006
+ return env.requests.post(
3007
+ "/call" /* CALL_PATH */,
3008
+ jsonData,
3009
+ {
3010
+ headers: { "Content-Type": "application/json" }
3011
+ },
3012
+ service
3013
+ );
2996
3014
  },
2997
3015
  [env]
2998
3016
  );
@@ -3000,7 +3018,8 @@ function useActionService() {
3000
3018
  async ({
3001
3019
  model,
3002
3020
  id,
3003
- context
3021
+ context,
3022
+ service
3004
3023
  }) => {
3005
3024
  const jsonData = {
3006
3025
  model,
@@ -3008,9 +3027,14 @@ function useActionService() {
3008
3027
  ids: id,
3009
3028
  with_context: context
3010
3029
  };
3011
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3012
- headers: { "Content-Type": "application/json" }
3013
- });
3030
+ return env.requests.post(
3031
+ "/call" /* CALL_PATH */,
3032
+ jsonData,
3033
+ {
3034
+ headers: { "Content-Type": "application/json" }
3035
+ },
3036
+ service
3037
+ );
3014
3038
  },
3015
3039
  [env]
3016
3040
  );
@@ -3053,15 +3077,21 @@ function useActionService() {
3053
3077
  const runAction = (0, import_react6.useCallback)(
3054
3078
  async ({
3055
3079
  idAction,
3056
- context
3080
+ context,
3081
+ service
3057
3082
  }) => {
3058
3083
  const jsonData = {
3059
3084
  action_id: idAction,
3060
3085
  with_context: { ...context }
3061
3086
  };
3062
- return env.requests.post("/run_action" /* RUN_ACTION_PATH */, jsonData, {
3063
- headers: { "Content-Type": "application/json" }
3064
- });
3087
+ return env.requests.post(
3088
+ "/run_action" /* RUN_ACTION_PATH */,
3089
+ jsonData,
3090
+ {
3091
+ headers: { "Content-Type": "application/json" }
3092
+ },
3093
+ service
3094
+ );
3065
3095
  },
3066
3096
  [env]
3067
3097
  );
@@ -3776,7 +3806,7 @@ function useModelService() {
3776
3806
  });
3777
3807
  }, [env]);
3778
3808
  const getAll = (0, import_react12.useCallback)(
3779
- async ({ data }) => {
3809
+ async ({ data, service }) => {
3780
3810
  const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3781
3811
  fields: data.fields,
3782
3812
  groupby: data.groupby
@@ -3797,11 +3827,16 @@ function useModelService() {
3797
3827
  ...jsonReadGroup
3798
3828
  }
3799
3829
  };
3800
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3801
- headers: {
3802
- "Content-Type": "application/json"
3803
- }
3804
- });
3830
+ return env.requests.post(
3831
+ "/call" /* CALL_PATH */,
3832
+ jsonData,
3833
+ {
3834
+ headers: {
3835
+ "Content-Type": "application/json"
3836
+ }
3837
+ },
3838
+ service
3839
+ );
3805
3840
  },
3806
3841
  [env]
3807
3842
  );
@@ -3869,7 +3904,13 @@ function useModelService() {
3869
3904
  [env]
3870
3905
  );
3871
3906
  const getDetail = (0, import_react12.useCallback)(
3872
- async ({ ids = [], model, specification, context }) => {
3907
+ async ({
3908
+ ids = [],
3909
+ model,
3910
+ specification,
3911
+ context,
3912
+ service
3913
+ }) => {
3873
3914
  const jsonData = {
3874
3915
  model,
3875
3916
  method: "web_read" /* WEB_READ */,
@@ -3879,11 +3920,16 @@ function useModelService() {
3879
3920
  specification
3880
3921
  }
3881
3922
  };
3882
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3883
- headers: {
3884
- "Content-Type": "application/json"
3885
- }
3886
- });
3923
+ return env.requests.post(
3924
+ "/call" /* CALL_PATH */,
3925
+ jsonData,
3926
+ {
3927
+ headers: {
3928
+ "Content-Type": "application/json"
3929
+ }
3930
+ },
3931
+ service
3932
+ );
3887
3933
  },
3888
3934
  [env]
3889
3935
  );
@@ -3894,7 +3940,8 @@ function useModelService() {
3894
3940
  data = {},
3895
3941
  specification = {},
3896
3942
  context = {},
3897
- path
3943
+ path,
3944
+ service
3898
3945
  }) => {
3899
3946
  const jsonData = {
3900
3947
  model,
@@ -3906,26 +3953,36 @@ function useModelService() {
3906
3953
  specification
3907
3954
  }
3908
3955
  };
3909
- return env.requests.post(path ?? "/call" /* CALL_PATH */, jsonData, {
3910
- headers: {
3911
- "Content-Type": "application/json"
3912
- }
3913
- });
3956
+ return env.requests.post(
3957
+ path ?? "/call" /* CALL_PATH */,
3958
+ jsonData,
3959
+ {
3960
+ headers: {
3961
+ "Content-Type": "application/json"
3962
+ }
3963
+ },
3964
+ service
3965
+ );
3914
3966
  },
3915
3967
  [env]
3916
3968
  );
3917
3969
  const deleteApi = (0, import_react12.useCallback)(
3918
- async ({ ids = [], model }) => {
3970
+ async ({ ids = [], model, service }) => {
3919
3971
  const jsonData = {
3920
3972
  model,
3921
3973
  method: "unlink" /* UNLINK */,
3922
3974
  ids
3923
3975
  };
3924
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3925
- headers: {
3926
- "Content-Type": "application/json"
3927
- }
3928
- });
3976
+ return env.requests.post(
3977
+ "/call" /* CALL_PATH */,
3978
+ jsonData,
3979
+ {
3980
+ headers: {
3981
+ "Content-Type": "application/json"
3982
+ }
3983
+ },
3984
+ service
3985
+ );
3929
3986
  },
3930
3987
  [env]
3931
3988
  );
@@ -3936,7 +3993,8 @@ function useModelService() {
3936
3993
  object,
3937
3994
  specification,
3938
3995
  context,
3939
- fieldChange
3996
+ fieldChange,
3997
+ service
3940
3998
  }) => {
3941
3999
  const jsonData = {
3942
4000
  model,
@@ -3949,11 +4007,16 @@ function useModelService() {
3949
4007
  specification
3950
4008
  ]
3951
4009
  };
3952
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3953
- headers: {
3954
- "Content-Type": "application/json"
3955
- }
3956
- });
4010
+ return env.requests.post(
4011
+ "/call" /* CALL_PATH */,
4012
+ jsonData,
4013
+ {
4014
+ headers: {
4015
+ "Content-Type": "application/json"
4016
+ }
4017
+ },
4018
+ service
4019
+ );
3957
4020
  },
3958
4021
  [env]
3959
4022
  );
@@ -4127,7 +4190,8 @@ function useViewService() {
4127
4190
  views,
4128
4191
  context = {},
4129
4192
  options = {},
4130
- aid
4193
+ aid,
4194
+ service
4131
4195
  }) => {
4132
4196
  const defaultOptions = {
4133
4197
  load_filters: true,
@@ -4143,11 +4207,16 @@ function useViewService() {
4143
4207
  },
4144
4208
  with_context: context
4145
4209
  };
4146
- return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4147
- headers: {
4148
- "Content-Type": "application/json"
4149
- }
4150
- });
4210
+ return env?.requests?.post(
4211
+ "/call" /* CALL_PATH */,
4212
+ jsonDataView,
4213
+ {
4214
+ headers: {
4215
+ "Content-Type": "application/json"
4216
+ }
4217
+ },
4218
+ service
4219
+ );
4151
4220
  },
4152
4221
  [env]
4153
4222
  );
@@ -4230,7 +4299,7 @@ function useViewService() {
4230
4299
  [env]
4231
4300
  );
4232
4301
  const getSelectionItem = (0, import_react14.useCallback)(
4233
- async ({ data }) => {
4302
+ async ({ data, service }) => {
4234
4303
  const jsonData = {
4235
4304
  model: data.model,
4236
4305
  ids: [],
@@ -4248,11 +4317,16 @@ function useViewService() {
4248
4317
  }
4249
4318
  }
4250
4319
  };
4251
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
4252
- headers: {
4253
- "Content-Type": "application/json"
4254
- }
4255
- });
4320
+ return env?.requests.post(
4321
+ "/call" /* CALL_PATH */,
4322
+ jsonData,
4323
+ {
4324
+ headers: {
4325
+ "Content-Type": "application/json"
4326
+ }
4327
+ },
4328
+ service
4329
+ );
4256
4330
  },
4257
4331
  [env]
4258
4332
  );
@@ -4923,7 +4997,7 @@ var import_react_query32 = require("@tanstack/react-query");
4923
4997
  var useDelete = () => {
4924
4998
  const { deleteApi } = useModelService();
4925
4999
  return (0, import_react_query32.useMutation)({
4926
- mutationFn: ({ ids, model }) => deleteApi({ ids, model })
5000
+ mutationFn: ({ ids, model, service }) => deleteApi({ ids, model, service })
4927
5001
  });
4928
5002
  };
4929
5003
  var use_delete_default = useDelete;
@@ -4986,12 +5060,14 @@ var useGetDetail = () => {
4986
5060
  model,
4987
5061
  ids,
4988
5062
  specification,
4989
- context
5063
+ context,
5064
+ service
4990
5065
  }) => getDetail({
4991
5066
  model,
4992
5067
  ids,
4993
5068
  specification,
4994
- context
5069
+ context,
5070
+ service
4995
5071
  })
4996
5072
  });
4997
5073
  };
@@ -5187,14 +5263,16 @@ var useOnChangeForm = () => {
5187
5263
  specification,
5188
5264
  context,
5189
5265
  object,
5190
- fieldChange
5266
+ fieldChange,
5267
+ service
5191
5268
  }) => onChange({
5192
5269
  ids,
5193
5270
  model,
5194
5271
  specification,
5195
5272
  context,
5196
5273
  object,
5197
- fieldChange
5274
+ fieldChange,
5275
+ service
5198
5276
  })
5199
5277
  });
5200
5278
  };
@@ -5211,8 +5289,9 @@ var useSave = () => {
5211
5289
  data,
5212
5290
  specification,
5213
5291
  context,
5214
- path
5215
- }) => save({ ids, model, data, specification, context, path })
5292
+ path,
5293
+ service
5294
+ }) => save({ ids, model, data, specification, context, path, service })
5216
5295
  });
5217
5296
  };
5218
5297
  var use_save_default = useSave;
@@ -5264,12 +5343,14 @@ var useButton = () => {
5264
5343
  model,
5265
5344
  ids,
5266
5345
  context,
5267
- method
5346
+ method,
5347
+ service
5268
5348
  }) => callButton({
5269
5349
  model,
5270
5350
  ids,
5271
5351
  context,
5272
- method
5352
+ method,
5353
+ service
5273
5354
  }),
5274
5355
  onSuccess: (response) => {
5275
5356
  return response;
@@ -5286,11 +5367,13 @@ var useDuplicateRecord = () => {
5286
5367
  mutationFn: ({
5287
5368
  id,
5288
5369
  model,
5289
- context
5370
+ context,
5371
+ service
5290
5372
  }) => duplicateRecord({
5291
5373
  id,
5292
5374
  model,
5293
- context
5375
+ context,
5376
+ service
5294
5377
  })
5295
5378
  });
5296
5379
  };
@@ -5373,11 +5456,11 @@ var use_get_groups_default = useGetGroups;
5373
5456
 
5374
5457
  // src/hooks/view/use-get-list-data.ts
5375
5458
  var import_react_query49 = require("@tanstack/react-query");
5376
- var useGetListData = (listDataProps, queryKey, enabled) => {
5459
+ var useGetListData = (listDataProps, queryKey, enabled, service) => {
5377
5460
  const { getAll } = useModelService();
5378
5461
  return (0, import_react_query49.useQuery)({
5379
5462
  queryKey,
5380
- queryFn: () => getAll({ data: listDataProps }).then((res) => {
5463
+ queryFn: () => getAll({ data: listDataProps, service }).then((res) => {
5381
5464
  if (res) {
5382
5465
  return res;
5383
5466
  }
@@ -5453,12 +5536,13 @@ var import_react_query53 = require("@tanstack/react-query");
5453
5536
  var useGetSelection = ({
5454
5537
  data,
5455
5538
  queryKey,
5456
- enabled
5539
+ enabled,
5540
+ service
5457
5541
  }) => {
5458
5542
  const { getSelectionItem } = useViewService();
5459
5543
  return (0, import_react_query53.useQuery)({
5460
5544
  queryKey,
5461
- queryFn: () => getSelectionItem({ data }),
5545
+ queryFn: () => getSelectionItem({ data, service }),
5462
5546
  enabled,
5463
5547
  refetchOnWindowFocus: false
5464
5548
  });
@@ -5486,11 +5570,13 @@ var useLoadAction = () => {
5486
5570
  return (0, import_react_query55.useMutation)({
5487
5571
  mutationFn: ({
5488
5572
  idAction,
5489
- context
5573
+ context,
5574
+ service
5490
5575
  }) => {
5491
5576
  return loadAction({
5492
5577
  idAction,
5493
- context
5578
+ context,
5579
+ service
5494
5580
  });
5495
5581
  }
5496
5582
  });
@@ -5531,11 +5617,13 @@ var useRemoveRow = () => {
5531
5617
  mutationFn: ({
5532
5618
  model,
5533
5619
  ids,
5534
- context
5620
+ context,
5621
+ service
5535
5622
  }) => removeRows({
5536
5623
  model,
5537
5624
  ids,
5538
- context
5625
+ context,
5626
+ service
5539
5627
  })
5540
5628
  });
5541
5629
  };
@@ -5566,10 +5654,12 @@ var useRunAction = () => {
5566
5654
  return (0, import_react_query60.useMutation)({
5567
5655
  mutationFn: ({
5568
5656
  idAction,
5569
- context
5657
+ context,
5658
+ service
5570
5659
  }) => runAction({
5571
5660
  idAction,
5572
- context
5661
+ context,
5662
+ service
5573
5663
  })
5574
5664
  });
5575
5665
  };