@fctc/interface-logic 2.2.2 → 2.2.4

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
@@ -2943,15 +2943,21 @@ function useActionService() {
2943
2943
  const loadAction = (0, import_react6.useCallback)(
2944
2944
  async ({
2945
2945
  idAction,
2946
- context
2946
+ context,
2947
+ service
2947
2948
  }) => {
2948
2949
  const jsonData = {
2949
2950
  action_id: idAction,
2950
2951
  with_context: { ...context }
2951
2952
  };
2952
- return env.requests.post("/load_action" /* LOAD_ACTION */, jsonData, {
2953
- headers: { "Content-Type": "application/json" }
2954
- });
2953
+ return env.requests.post(
2954
+ "/load_action" /* LOAD_ACTION */,
2955
+ jsonData,
2956
+ {
2957
+ headers: { "Content-Type": "application/json" }
2958
+ },
2959
+ service
2960
+ );
2955
2961
  },
2956
2962
  [env]
2957
2963
  );
@@ -2960,7 +2966,8 @@ function useActionService() {
2960
2966
  model,
2961
2967
  ids = [],
2962
2968
  context,
2963
- method
2969
+ method,
2970
+ service
2964
2971
  }) => {
2965
2972
  try {
2966
2973
  const jsonData = {
@@ -2969,9 +2976,14 @@ function useActionService() {
2969
2976
  ids,
2970
2977
  with_context: context
2971
2978
  };
2972
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2973
- headers: { "Content-Type": "application/json" }
2974
- });
2979
+ return env.requests.post(
2980
+ "/call" /* CALL_PATH */,
2981
+ jsonData,
2982
+ {
2983
+ headers: { "Content-Type": "application/json" }
2984
+ },
2985
+ service
2986
+ );
2975
2987
  } catch (error) {
2976
2988
  console.error("Error when calling button action:", error);
2977
2989
  throw error;
@@ -2983,7 +2995,8 @@ function useActionService() {
2983
2995
  async ({
2984
2996
  model,
2985
2997
  ids,
2986
- context
2998
+ context,
2999
+ service
2987
3000
  }) => {
2988
3001
  const jsonData = {
2989
3002
  model,
@@ -2991,9 +3004,14 @@ function useActionService() {
2991
3004
  ids,
2992
3005
  with_context: context
2993
3006
  };
2994
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2995
- headers: { "Content-Type": "application/json" }
2996
- });
3007
+ return env.requests.post(
3008
+ "/call" /* CALL_PATH */,
3009
+ jsonData,
3010
+ {
3011
+ headers: { "Content-Type": "application/json" }
3012
+ },
3013
+ service
3014
+ );
2997
3015
  },
2998
3016
  [env]
2999
3017
  );
@@ -3001,7 +3019,8 @@ function useActionService() {
3001
3019
  async ({
3002
3020
  model,
3003
3021
  id,
3004
- context
3022
+ context,
3023
+ service
3005
3024
  }) => {
3006
3025
  const jsonData = {
3007
3026
  model,
@@ -3009,9 +3028,14 @@ function useActionService() {
3009
3028
  ids: id,
3010
3029
  with_context: context
3011
3030
  };
3012
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3013
- headers: { "Content-Type": "application/json" }
3014
- });
3031
+ return env.requests.post(
3032
+ "/call" /* CALL_PATH */,
3033
+ jsonData,
3034
+ {
3035
+ headers: { "Content-Type": "application/json" }
3036
+ },
3037
+ service
3038
+ );
3015
3039
  },
3016
3040
  [env]
3017
3041
  );
@@ -3054,15 +3078,21 @@ function useActionService() {
3054
3078
  const runAction = (0, import_react6.useCallback)(
3055
3079
  async ({
3056
3080
  idAction,
3057
- context
3081
+ context,
3082
+ service
3058
3083
  }) => {
3059
3084
  const jsonData = {
3060
3085
  action_id: idAction,
3061
3086
  with_context: { ...context }
3062
3087
  };
3063
- return env.requests.post("/run_action" /* RUN_ACTION_PATH */, jsonData, {
3064
- headers: { "Content-Type": "application/json" }
3065
- });
3088
+ return env.requests.post(
3089
+ "/run_action" /* RUN_ACTION_PATH */,
3090
+ jsonData,
3091
+ {
3092
+ headers: { "Content-Type": "application/json" }
3093
+ },
3094
+ service
3095
+ );
3066
3096
  },
3067
3097
  [env]
3068
3098
  );
@@ -3249,13 +3279,14 @@ function useAuthService() {
3249
3279
  data.append("client_id", env?.config?.clientId || "");
3250
3280
  data.append("redirect_uri", env?.config?.redirectUri || "");
3251
3281
  return env?.requests?.post(
3252
- `${env?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3282
+ "/token" /* TOKEN_BY_CODE */,
3253
3283
  data,
3254
3284
  {
3255
3285
  headers: {
3256
3286
  "Content-Type": "application/x-www-form-urlencoded"
3257
3287
  }
3258
- }
3288
+ },
3289
+ "id"
3259
3290
  );
3260
3291
  },
3261
3292
  [env]
@@ -3774,7 +3805,7 @@ function useModelService() {
3774
3805
  });
3775
3806
  }, [env]);
3776
3807
  const getAll = (0, import_react12.useCallback)(
3777
- async ({ data }) => {
3808
+ async ({ data, service }) => {
3778
3809
  const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3779
3810
  fields: data.fields,
3780
3811
  groupby: data.groupby
@@ -3795,11 +3826,16 @@ function useModelService() {
3795
3826
  ...jsonReadGroup
3796
3827
  }
3797
3828
  };
3798
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3799
- headers: {
3800
- "Content-Type": "application/json"
3801
- }
3802
- });
3829
+ return env.requests.post(
3830
+ "/call" /* CALL_PATH */,
3831
+ jsonData,
3832
+ {
3833
+ headers: {
3834
+ "Content-Type": "application/json"
3835
+ }
3836
+ },
3837
+ service
3838
+ );
3803
3839
  },
3804
3840
  [env]
3805
3841
  );
@@ -3867,7 +3903,13 @@ function useModelService() {
3867
3903
  [env]
3868
3904
  );
3869
3905
  const getDetail = (0, import_react12.useCallback)(
3870
- async ({ ids = [], model, specification, context }) => {
3906
+ async ({
3907
+ ids = [],
3908
+ model,
3909
+ specification,
3910
+ context,
3911
+ service
3912
+ }) => {
3871
3913
  const jsonData = {
3872
3914
  model,
3873
3915
  method: "web_read" /* WEB_READ */,
@@ -3877,11 +3919,16 @@ function useModelService() {
3877
3919
  specification
3878
3920
  }
3879
3921
  };
3880
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3881
- headers: {
3882
- "Content-Type": "application/json"
3883
- }
3884
- });
3922
+ return env.requests.post(
3923
+ "/call" /* CALL_PATH */,
3924
+ jsonData,
3925
+ {
3926
+ headers: {
3927
+ "Content-Type": "application/json"
3928
+ }
3929
+ },
3930
+ service
3931
+ );
3885
3932
  },
3886
3933
  [env]
3887
3934
  );
@@ -3892,7 +3939,8 @@ function useModelService() {
3892
3939
  data = {},
3893
3940
  specification = {},
3894
3941
  context = {},
3895
- path
3942
+ path,
3943
+ service
3896
3944
  }) => {
3897
3945
  const jsonData = {
3898
3946
  model,
@@ -3904,26 +3952,36 @@ function useModelService() {
3904
3952
  specification
3905
3953
  }
3906
3954
  };
3907
- return env.requests.post(path ?? "/call" /* CALL_PATH */, jsonData, {
3908
- headers: {
3909
- "Content-Type": "application/json"
3910
- }
3911
- });
3955
+ return env.requests.post(
3956
+ path ?? "/call" /* CALL_PATH */,
3957
+ jsonData,
3958
+ {
3959
+ headers: {
3960
+ "Content-Type": "application/json"
3961
+ }
3962
+ },
3963
+ service
3964
+ );
3912
3965
  },
3913
3966
  [env]
3914
3967
  );
3915
3968
  const deleteApi = (0, import_react12.useCallback)(
3916
- async ({ ids = [], model }) => {
3969
+ async ({ ids = [], model, service }) => {
3917
3970
  const jsonData = {
3918
3971
  model,
3919
3972
  method: "unlink" /* UNLINK */,
3920
3973
  ids
3921
3974
  };
3922
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3923
- headers: {
3924
- "Content-Type": "application/json"
3925
- }
3926
- });
3975
+ return env.requests.post(
3976
+ "/call" /* CALL_PATH */,
3977
+ jsonData,
3978
+ {
3979
+ headers: {
3980
+ "Content-Type": "application/json"
3981
+ }
3982
+ },
3983
+ service
3984
+ );
3927
3985
  },
3928
3986
  [env]
3929
3987
  );
@@ -3934,7 +3992,8 @@ function useModelService() {
3934
3992
  object,
3935
3993
  specification,
3936
3994
  context,
3937
- fieldChange
3995
+ fieldChange,
3996
+ service
3938
3997
  }) => {
3939
3998
  const jsonData = {
3940
3999
  model,
@@ -3947,25 +4006,35 @@ function useModelService() {
3947
4006
  specification
3948
4007
  ]
3949
4008
  };
3950
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3951
- headers: {
3952
- "Content-Type": "application/json"
3953
- }
3954
- });
4009
+ return env.requests.post(
4010
+ "/call" /* CALL_PATH */,
4011
+ jsonData,
4012
+ {
4013
+ headers: {
4014
+ "Content-Type": "application/json"
4015
+ }
4016
+ },
4017
+ service
4018
+ );
3955
4019
  },
3956
4020
  [env]
3957
4021
  );
3958
4022
  const getListFieldsOnchange = (0, import_react12.useCallback)(
3959
- async ({ model }) => {
4023
+ async ({ model, service }) => {
3960
4024
  const jsonData = {
3961
4025
  model,
3962
4026
  method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
3963
4027
  };
3964
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3965
- headers: {
3966
- "Content-Type": "application/json"
3967
- }
3968
- });
4028
+ return env.requests.post(
4029
+ "/call" /* CALL_PATH */,
4030
+ jsonData,
4031
+ {
4032
+ headers: {
4033
+ "Content-Type": "application/json"
4034
+ }
4035
+ },
4036
+ service
4037
+ );
3969
4038
  },
3970
4039
  [env]
3971
4040
  );
@@ -4125,7 +4194,8 @@ function useViewService() {
4125
4194
  views,
4126
4195
  context = {},
4127
4196
  options = {},
4128
- aid
4197
+ aid,
4198
+ service
4129
4199
  }) => {
4130
4200
  const defaultOptions = {
4131
4201
  load_filters: true,
@@ -4141,11 +4211,16 @@ function useViewService() {
4141
4211
  },
4142
4212
  with_context: context
4143
4213
  };
4144
- return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4145
- headers: {
4146
- "Content-Type": "application/json"
4147
- }
4148
- });
4214
+ return env?.requests?.post(
4215
+ "/call" /* CALL_PATH */,
4216
+ jsonDataView,
4217
+ {
4218
+ headers: {
4219
+ "Content-Type": "application/json"
4220
+ }
4221
+ },
4222
+ service
4223
+ );
4149
4224
  },
4150
4225
  [env]
4151
4226
  );
@@ -4228,7 +4303,7 @@ function useViewService() {
4228
4303
  [env]
4229
4304
  );
4230
4305
  const getSelectionItem = (0, import_react14.useCallback)(
4231
- async ({ data }) => {
4306
+ async ({ data, service }) => {
4232
4307
  const jsonData = {
4233
4308
  model: data.model,
4234
4309
  ids: [],
@@ -4246,11 +4321,16 @@ function useViewService() {
4246
4321
  }
4247
4322
  }
4248
4323
  };
4249
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
4250
- headers: {
4251
- "Content-Type": "application/json"
4252
- }
4253
- });
4324
+ return env?.requests.post(
4325
+ "/call" /* CALL_PATH */,
4326
+ jsonData,
4327
+ {
4328
+ headers: {
4329
+ "Content-Type": "application/json"
4330
+ }
4331
+ },
4332
+ service
4333
+ );
4254
4334
  },
4255
4335
  [env]
4256
4336
  );
@@ -4918,7 +4998,7 @@ var import_react_query32 = require("@tanstack/react-query");
4918
4998
  var useDelete = () => {
4919
4999
  const { deleteApi } = useModelService();
4920
5000
  return (0, import_react_query32.useMutation)({
4921
- mutationFn: ({ ids, model }) => deleteApi({ ids, model })
5001
+ mutationFn: ({ ids, model, service }) => deleteApi({ ids, model, service })
4922
5002
  });
4923
5003
  };
4924
5004
  var use_delete_default = useDelete;
@@ -4981,12 +5061,14 @@ var useGetDetail = () => {
4981
5061
  model,
4982
5062
  ids,
4983
5063
  specification,
4984
- context
5064
+ context,
5065
+ service
4985
5066
  }) => getDetail({
4986
5067
  model,
4987
5068
  ids,
4988
5069
  specification,
4989
- context
5070
+ context,
5071
+ service
4990
5072
  })
4991
5073
  });
4992
5074
  };
@@ -4994,12 +5076,16 @@ var use_get_detail_default = useGetDetail;
4994
5076
 
4995
5077
  // src/hooks/model/use-get-field-onchange.ts
4996
5078
  var import_react_query37 = require("@tanstack/react-query");
4997
- var useGetFieldOnChange = ({ model }) => {
5079
+ var useGetFieldOnChange = ({
5080
+ model,
5081
+ service
5082
+ }) => {
4998
5083
  const { getListFieldsOnchange } = useModelService();
4999
5084
  return (0, import_react_query37.useQuery)({
5000
5085
  queryKey: [`field-onchange-${model}`, model],
5001
5086
  queryFn: () => getListFieldsOnchange({
5002
- model
5087
+ model,
5088
+ service
5003
5089
  }).then((res) => {
5004
5090
  if (res) {
5005
5091
  return res;
@@ -5182,14 +5268,16 @@ var useOnChangeForm = () => {
5182
5268
  specification,
5183
5269
  context,
5184
5270
  object,
5185
- fieldChange
5271
+ fieldChange,
5272
+ service
5186
5273
  }) => onChange({
5187
5274
  ids,
5188
5275
  model,
5189
5276
  specification,
5190
5277
  context,
5191
5278
  object,
5192
- fieldChange
5279
+ fieldChange,
5280
+ service
5193
5281
  })
5194
5282
  });
5195
5283
  };
@@ -5206,8 +5294,9 @@ var useSave = () => {
5206
5294
  data,
5207
5295
  specification,
5208
5296
  context,
5209
- path
5210
- }) => save({ ids, model, data, specification, context, path })
5297
+ path,
5298
+ service
5299
+ }) => save({ ids, model, data, specification, context, path, service })
5211
5300
  });
5212
5301
  };
5213
5302
  var use_save_default = useSave;
@@ -5259,12 +5348,14 @@ var useButton = () => {
5259
5348
  model,
5260
5349
  ids,
5261
5350
  context,
5262
- method
5351
+ method,
5352
+ service
5263
5353
  }) => callButton({
5264
5354
  model,
5265
5355
  ids,
5266
5356
  context,
5267
- method
5357
+ method,
5358
+ service
5268
5359
  }),
5269
5360
  onSuccess: (response) => {
5270
5361
  return response;
@@ -5281,11 +5372,13 @@ var useDuplicateRecord = () => {
5281
5372
  mutationFn: ({
5282
5373
  id,
5283
5374
  model,
5284
- context
5375
+ context,
5376
+ service
5285
5377
  }) => duplicateRecord({
5286
5378
  id,
5287
5379
  model,
5288
- context
5380
+ context,
5381
+ service
5289
5382
  })
5290
5383
  });
5291
5384
  };
@@ -5368,11 +5461,11 @@ var use_get_groups_default = useGetGroups;
5368
5461
 
5369
5462
  // src/hooks/view/use-get-list-data.ts
5370
5463
  var import_react_query49 = require("@tanstack/react-query");
5371
- var useGetListData = (listDataProps, queryKey, enabled) => {
5464
+ var useGetListData = (listDataProps, queryKey, enabled, service) => {
5372
5465
  const { getAll } = useModelService();
5373
5466
  return (0, import_react_query49.useQuery)({
5374
5467
  queryKey,
5375
- queryFn: () => getAll({ data: listDataProps }).then((res) => {
5468
+ queryFn: () => getAll({ data: listDataProps, service }).then((res) => {
5376
5469
  if (res) {
5377
5470
  return res;
5378
5471
  }
@@ -5448,12 +5541,13 @@ var import_react_query53 = require("@tanstack/react-query");
5448
5541
  var useGetSelection = ({
5449
5542
  data,
5450
5543
  queryKey,
5451
- enabled
5544
+ enabled,
5545
+ service
5452
5546
  }) => {
5453
5547
  const { getSelectionItem } = useViewService();
5454
5548
  return (0, import_react_query53.useQuery)({
5455
5549
  queryKey,
5456
- queryFn: () => getSelectionItem({ data }),
5550
+ queryFn: () => getSelectionItem({ data, service }),
5457
5551
  enabled,
5458
5552
  refetchOnWindowFocus: false
5459
5553
  });
@@ -5481,11 +5575,13 @@ var useLoadAction = () => {
5481
5575
  return (0, import_react_query55.useMutation)({
5482
5576
  mutationFn: ({
5483
5577
  idAction,
5484
- context
5578
+ context,
5579
+ service
5485
5580
  }) => {
5486
5581
  return loadAction({
5487
5582
  idAction,
5488
- context
5583
+ context,
5584
+ service
5489
5585
  });
5490
5586
  }
5491
5587
  });
@@ -5526,11 +5622,13 @@ var useRemoveRow = () => {
5526
5622
  mutationFn: ({
5527
5623
  model,
5528
5624
  ids,
5529
- context
5625
+ context,
5626
+ service
5530
5627
  }) => removeRows({
5531
5628
  model,
5532
5629
  ids,
5533
- context
5630
+ context,
5631
+ service
5534
5632
  })
5535
5633
  });
5536
5634
  };
@@ -5561,10 +5659,12 @@ var useRunAction = () => {
5561
5659
  return (0, import_react_query60.useMutation)({
5562
5660
  mutationFn: ({
5563
5661
  idAction,
5564
- context
5662
+ context,
5663
+ service
5565
5664
  }) => runAction({
5566
5665
  idAction,
5567
- context
5666
+ context,
5667
+ service
5568
5668
  })
5569
5669
  });
5570
5670
  };