@fctc/interface-logic 2.2.1 → 2.2.2

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
@@ -128,6 +128,7 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
128
128
  UriConstants2["IMAGE_PATH"] = `/web/image`;
129
129
  UriConstants2["LOAD_MESSAGE"] = `/load_message_failures`;
130
130
  UriConstants2["TOKEN"] = `/check_token`;
131
+ UriConstants2["VALIDATE_ACTION_TOKEN"] = `/action-token/validate`;
131
132
  UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
132
133
  UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
133
134
  UriConstants2["SIGNIN_SSO"] = `/signin-sso/oauth`;
@@ -2942,21 +2943,15 @@ function useActionService() {
2942
2943
  const loadAction = (0, import_react6.useCallback)(
2943
2944
  async ({
2944
2945
  idAction,
2945
- context,
2946
- service
2946
+ context
2947
2947
  }) => {
2948
2948
  const jsonData = {
2949
2949
  action_id: idAction,
2950
2950
  with_context: { ...context }
2951
2951
  };
2952
- return env.requests.post(
2953
- "/load_action" /* LOAD_ACTION */,
2954
- jsonData,
2955
- {
2956
- headers: { "Content-Type": "application/json" }
2957
- },
2958
- service
2959
- );
2952
+ return env.requests.post("/load_action" /* LOAD_ACTION */, jsonData, {
2953
+ headers: { "Content-Type": "application/json" }
2954
+ });
2960
2955
  },
2961
2956
  [env]
2962
2957
  );
@@ -2965,8 +2960,7 @@ function useActionService() {
2965
2960
  model,
2966
2961
  ids = [],
2967
2962
  context,
2968
- method,
2969
- service
2963
+ method
2970
2964
  }) => {
2971
2965
  try {
2972
2966
  const jsonData = {
@@ -2975,14 +2969,9 @@ function useActionService() {
2975
2969
  ids,
2976
2970
  with_context: context
2977
2971
  };
2978
- return env.requests.post(
2979
- "/call" /* CALL_PATH */,
2980
- jsonData,
2981
- {
2982
- headers: { "Content-Type": "application/json" }
2983
- },
2984
- service
2985
- );
2972
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2973
+ headers: { "Content-Type": "application/json" }
2974
+ });
2986
2975
  } catch (error) {
2987
2976
  console.error("Error when calling button action:", error);
2988
2977
  throw error;
@@ -2994,8 +2983,7 @@ function useActionService() {
2994
2983
  async ({
2995
2984
  model,
2996
2985
  ids,
2997
- context,
2998
- service
2986
+ context
2999
2987
  }) => {
3000
2988
  const jsonData = {
3001
2989
  model,
@@ -3003,14 +2991,9 @@ function useActionService() {
3003
2991
  ids,
3004
2992
  with_context: context
3005
2993
  };
3006
- return env.requests.post(
3007
- "/call" /* CALL_PATH */,
3008
- jsonData,
3009
- {
3010
- headers: { "Content-Type": "application/json" }
3011
- },
3012
- service
3013
- );
2994
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2995
+ headers: { "Content-Type": "application/json" }
2996
+ });
3014
2997
  },
3015
2998
  [env]
3016
2999
  );
@@ -3018,8 +3001,7 @@ function useActionService() {
3018
3001
  async ({
3019
3002
  model,
3020
3003
  id,
3021
- context,
3022
- service
3004
+ context
3023
3005
  }) => {
3024
3006
  const jsonData = {
3025
3007
  model,
@@ -3027,14 +3009,9 @@ function useActionService() {
3027
3009
  ids: id,
3028
3010
  with_context: context
3029
3011
  };
3030
- return env.requests.post(
3031
- "/call" /* CALL_PATH */,
3032
- jsonData,
3033
- {
3034
- headers: { "Content-Type": "application/json" }
3035
- },
3036
- service
3037
- );
3012
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3013
+ headers: { "Content-Type": "application/json" }
3014
+ });
3038
3015
  },
3039
3016
  [env]
3040
3017
  );
@@ -3077,21 +3054,15 @@ function useActionService() {
3077
3054
  const runAction = (0, import_react6.useCallback)(
3078
3055
  async ({
3079
3056
  idAction,
3080
- context,
3081
- service
3057
+ context
3082
3058
  }) => {
3083
3059
  const jsonData = {
3084
3060
  action_id: idAction,
3085
3061
  with_context: { ...context }
3086
3062
  };
3087
- return env.requests.post(
3088
- "/run_action" /* RUN_ACTION_PATH */,
3089
- jsonData,
3090
- {
3091
- headers: { "Content-Type": "application/json" }
3092
- },
3093
- service
3094
- );
3063
+ return env.requests.post("/run_action" /* RUN_ACTION_PATH */, jsonData, {
3064
+ headers: { "Content-Type": "application/json" }
3065
+ });
3095
3066
  },
3096
3067
  [env]
3097
3068
  );
@@ -3234,18 +3205,15 @@ function useAuthService() {
3234
3205
  [env]
3235
3206
  );
3236
3207
  const isValidActionToken = (0, import_react7.useCallback)(
3237
- async (actionToken, path) => {
3238
- return env?.requests?.post(
3239
- path,
3240
- {},
3241
- {
3242
- headers: {
3243
- "Content-Type": "application/json"
3244
- },
3245
- useActionToken: true,
3246
- actionToken
3247
- }
3248
- );
3208
+ async (actionToken) => {
3209
+ const bodyData = {};
3210
+ return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3211
+ headers: {
3212
+ "Content-Type": "application/json"
3213
+ },
3214
+ useActionToken: true,
3215
+ actionToken
3216
+ });
3249
3217
  },
3250
3218
  [env]
3251
3219
  );
@@ -3806,7 +3774,7 @@ function useModelService() {
3806
3774
  });
3807
3775
  }, [env]);
3808
3776
  const getAll = (0, import_react12.useCallback)(
3809
- async ({ data, service }) => {
3777
+ async ({ data }) => {
3810
3778
  const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3811
3779
  fields: data.fields,
3812
3780
  groupby: data.groupby
@@ -3827,16 +3795,11 @@ function useModelService() {
3827
3795
  ...jsonReadGroup
3828
3796
  }
3829
3797
  };
3830
- return env.requests.post(
3831
- "/call" /* CALL_PATH */,
3832
- jsonData,
3833
- {
3834
- headers: {
3835
- "Content-Type": "application/json"
3836
- }
3837
- },
3838
- service
3839
- );
3798
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3799
+ headers: {
3800
+ "Content-Type": "application/json"
3801
+ }
3802
+ });
3840
3803
  },
3841
3804
  [env]
3842
3805
  );
@@ -3904,13 +3867,7 @@ function useModelService() {
3904
3867
  [env]
3905
3868
  );
3906
3869
  const getDetail = (0, import_react12.useCallback)(
3907
- async ({
3908
- ids = [],
3909
- model,
3910
- specification,
3911
- context,
3912
- service
3913
- }) => {
3870
+ async ({ ids = [], model, specification, context }) => {
3914
3871
  const jsonData = {
3915
3872
  model,
3916
3873
  method: "web_read" /* WEB_READ */,
@@ -3920,16 +3877,11 @@ function useModelService() {
3920
3877
  specification
3921
3878
  }
3922
3879
  };
3923
- return env.requests.post(
3924
- "/call" /* CALL_PATH */,
3925
- jsonData,
3926
- {
3927
- headers: {
3928
- "Content-Type": "application/json"
3929
- }
3930
- },
3931
- service
3932
- );
3880
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3881
+ headers: {
3882
+ "Content-Type": "application/json"
3883
+ }
3884
+ });
3933
3885
  },
3934
3886
  [env]
3935
3887
  );
@@ -3940,8 +3892,7 @@ function useModelService() {
3940
3892
  data = {},
3941
3893
  specification = {},
3942
3894
  context = {},
3943
- path,
3944
- service
3895
+ path
3945
3896
  }) => {
3946
3897
  const jsonData = {
3947
3898
  model,
@@ -3953,36 +3904,26 @@ function useModelService() {
3953
3904
  specification
3954
3905
  }
3955
3906
  };
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
- );
3907
+ return env.requests.post(path ?? "/call" /* CALL_PATH */, jsonData, {
3908
+ headers: {
3909
+ "Content-Type": "application/json"
3910
+ }
3911
+ });
3966
3912
  },
3967
3913
  [env]
3968
3914
  );
3969
3915
  const deleteApi = (0, import_react12.useCallback)(
3970
- async ({ ids = [], model, service }) => {
3916
+ async ({ ids = [], model }) => {
3971
3917
  const jsonData = {
3972
3918
  model,
3973
3919
  method: "unlink" /* UNLINK */,
3974
3920
  ids
3975
3921
  };
3976
- return env.requests.post(
3977
- "/call" /* CALL_PATH */,
3978
- jsonData,
3979
- {
3980
- headers: {
3981
- "Content-Type": "application/json"
3982
- }
3983
- },
3984
- service
3985
- );
3922
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3923
+ headers: {
3924
+ "Content-Type": "application/json"
3925
+ }
3926
+ });
3986
3927
  },
3987
3928
  [env]
3988
3929
  );
@@ -3993,8 +3934,7 @@ function useModelService() {
3993
3934
  object,
3994
3935
  specification,
3995
3936
  context,
3996
- fieldChange,
3997
- service
3937
+ fieldChange
3998
3938
  }) => {
3999
3939
  const jsonData = {
4000
3940
  model,
@@ -4007,36 +3947,25 @@ function useModelService() {
4007
3947
  specification
4008
3948
  ]
4009
3949
  };
4010
- return env.requests.post(
4011
- "/call" /* CALL_PATH */,
4012
- jsonData,
4013
- {
4014
- headers: {
4015
- "Content-Type": "application/json"
4016
- }
4017
- },
4018
- service
4019
- );
3950
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3951
+ headers: {
3952
+ "Content-Type": "application/json"
3953
+ }
3954
+ });
4020
3955
  },
4021
3956
  [env]
4022
3957
  );
4023
3958
  const getListFieldsOnchange = (0, import_react12.useCallback)(
4024
- async ({ model, service }) => {
4025
- console.log("service", service);
3959
+ async ({ model }) => {
4026
3960
  const jsonData = {
4027
3961
  model,
4028
3962
  method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4029
3963
  };
4030
- return env.requests.post(
4031
- "/call" /* CALL_PATH */,
4032
- jsonData,
4033
- {
4034
- headers: {
4035
- "Content-Type": "application/json"
4036
- }
4037
- },
4038
- service
4039
- );
3964
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3965
+ headers: {
3966
+ "Content-Type": "application/json"
3967
+ }
3968
+ });
4040
3969
  },
4041
3970
  [env]
4042
3971
  );
@@ -4196,8 +4125,7 @@ function useViewService() {
4196
4125
  views,
4197
4126
  context = {},
4198
4127
  options = {},
4199
- aid,
4200
- service
4128
+ aid
4201
4129
  }) => {
4202
4130
  const defaultOptions = {
4203
4131
  load_filters: true,
@@ -4213,16 +4141,11 @@ function useViewService() {
4213
4141
  },
4214
4142
  with_context: context
4215
4143
  };
4216
- return env?.requests?.post(
4217
- "/call" /* CALL_PATH */,
4218
- jsonDataView,
4219
- {
4220
- headers: {
4221
- "Content-Type": "application/json"
4222
- }
4223
- },
4224
- service
4225
- );
4144
+ return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4145
+ headers: {
4146
+ "Content-Type": "application/json"
4147
+ }
4148
+ });
4226
4149
  },
4227
4150
  [env]
4228
4151
  );
@@ -4305,7 +4228,7 @@ function useViewService() {
4305
4228
  [env]
4306
4229
  );
4307
4230
  const getSelectionItem = (0, import_react14.useCallback)(
4308
- async ({ data, service }) => {
4231
+ async ({ data }) => {
4309
4232
  const jsonData = {
4310
4233
  model: data.model,
4311
4234
  ids: [],
@@ -4323,16 +4246,11 @@ function useViewService() {
4323
4246
  }
4324
4247
  }
4325
4248
  };
4326
- return env?.requests.post(
4327
- "/call" /* CALL_PATH */,
4328
- jsonData,
4329
- {
4330
- headers: {
4331
- "Content-Type": "application/json"
4332
- }
4333
- },
4334
- service
4335
- );
4249
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
4250
+ headers: {
4251
+ "Content-Type": "application/json"
4252
+ }
4253
+ });
4336
4254
  },
4337
4255
  [env]
4338
4256
  );
@@ -4691,11 +4609,8 @@ var import_react_query14 = require("@tanstack/react-query");
4691
4609
  var useValidateActionToken = () => {
4692
4610
  const { isValidActionToken } = useAuthService();
4693
4611
  return (0, import_react_query14.useMutation)({
4694
- mutationFn: ({
4695
- actionToken,
4696
- path
4697
- }) => {
4698
- return isValidActionToken(actionToken, path);
4612
+ mutationFn: ({ actionToken }) => {
4613
+ return isValidActionToken(actionToken);
4699
4614
  }
4700
4615
  });
4701
4616
  };
@@ -5003,7 +4918,7 @@ var import_react_query32 = require("@tanstack/react-query");
5003
4918
  var useDelete = () => {
5004
4919
  const { deleteApi } = useModelService();
5005
4920
  return (0, import_react_query32.useMutation)({
5006
- mutationFn: ({ ids, model, service }) => deleteApi({ ids, model, service })
4921
+ mutationFn: ({ ids, model }) => deleteApi({ ids, model })
5007
4922
  });
5008
4923
  };
5009
4924
  var use_delete_default = useDelete;
@@ -5066,14 +4981,12 @@ var useGetDetail = () => {
5066
4981
  model,
5067
4982
  ids,
5068
4983
  specification,
5069
- context,
5070
- service
4984
+ context
5071
4985
  }) => getDetail({
5072
4986
  model,
5073
4987
  ids,
5074
4988
  specification,
5075
- context,
5076
- service
4989
+ context
5077
4990
  })
5078
4991
  });
5079
4992
  };
@@ -5081,17 +4994,12 @@ var use_get_detail_default = useGetDetail;
5081
4994
 
5082
4995
  // src/hooks/model/use-get-field-onchange.ts
5083
4996
  var import_react_query37 = require("@tanstack/react-query");
5084
- var useGetFieldOnChange = ({
5085
- model,
5086
- service
5087
- }) => {
4997
+ var useGetFieldOnChange = ({ model }) => {
5088
4998
  const { getListFieldsOnchange } = useModelService();
5089
- console.log("service", service);
5090
4999
  return (0, import_react_query37.useQuery)({
5091
5000
  queryKey: [`field-onchange-${model}`, model],
5092
5001
  queryFn: () => getListFieldsOnchange({
5093
- model,
5094
- service
5002
+ model
5095
5003
  }).then((res) => {
5096
5004
  if (res) {
5097
5005
  return res;
@@ -5274,16 +5182,14 @@ var useOnChangeForm = () => {
5274
5182
  specification,
5275
5183
  context,
5276
5184
  object,
5277
- fieldChange,
5278
- service
5185
+ fieldChange
5279
5186
  }) => onChange({
5280
5187
  ids,
5281
5188
  model,
5282
5189
  specification,
5283
5190
  context,
5284
5191
  object,
5285
- fieldChange,
5286
- service
5192
+ fieldChange
5287
5193
  })
5288
5194
  });
5289
5195
  };
@@ -5300,9 +5206,8 @@ var useSave = () => {
5300
5206
  data,
5301
5207
  specification,
5302
5208
  context,
5303
- path,
5304
- service
5305
- }) => save({ ids, model, data, specification, context, path, service })
5209
+ path
5210
+ }) => save({ ids, model, data, specification, context, path })
5306
5211
  });
5307
5212
  };
5308
5213
  var use_save_default = useSave;
@@ -5354,14 +5259,12 @@ var useButton = () => {
5354
5259
  model,
5355
5260
  ids,
5356
5261
  context,
5357
- method,
5358
- service
5262
+ method
5359
5263
  }) => callButton({
5360
5264
  model,
5361
5265
  ids,
5362
5266
  context,
5363
- method,
5364
- service
5267
+ method
5365
5268
  }),
5366
5269
  onSuccess: (response) => {
5367
5270
  return response;
@@ -5378,13 +5281,11 @@ var useDuplicateRecord = () => {
5378
5281
  mutationFn: ({
5379
5282
  id,
5380
5283
  model,
5381
- context,
5382
- service
5284
+ context
5383
5285
  }) => duplicateRecord({
5384
5286
  id,
5385
5287
  model,
5386
- context,
5387
- service
5288
+ context
5388
5289
  })
5389
5290
  });
5390
5291
  };
@@ -5467,11 +5368,11 @@ var use_get_groups_default = useGetGroups;
5467
5368
 
5468
5369
  // src/hooks/view/use-get-list-data.ts
5469
5370
  var import_react_query49 = require("@tanstack/react-query");
5470
- var useGetListData = (listDataProps, queryKey, enabled, service) => {
5371
+ var useGetListData = (listDataProps, queryKey, enabled) => {
5471
5372
  const { getAll } = useModelService();
5472
5373
  return (0, import_react_query49.useQuery)({
5473
5374
  queryKey,
5474
- queryFn: () => getAll({ data: listDataProps, service }).then((res) => {
5375
+ queryFn: () => getAll({ data: listDataProps }).then((res) => {
5475
5376
  if (res) {
5476
5377
  return res;
5477
5378
  }
@@ -5547,13 +5448,12 @@ var import_react_query53 = require("@tanstack/react-query");
5547
5448
  var useGetSelection = ({
5548
5449
  data,
5549
5450
  queryKey,
5550
- enabled,
5551
- service
5451
+ enabled
5552
5452
  }) => {
5553
5453
  const { getSelectionItem } = useViewService();
5554
5454
  return (0, import_react_query53.useQuery)({
5555
5455
  queryKey,
5556
- queryFn: () => getSelectionItem({ data, service }),
5456
+ queryFn: () => getSelectionItem({ data }),
5557
5457
  enabled,
5558
5458
  refetchOnWindowFocus: false
5559
5459
  });
@@ -5581,13 +5481,11 @@ var useLoadAction = () => {
5581
5481
  return (0, import_react_query55.useMutation)({
5582
5482
  mutationFn: ({
5583
5483
  idAction,
5584
- context,
5585
- service
5484
+ context
5586
5485
  }) => {
5587
5486
  return loadAction({
5588
5487
  idAction,
5589
- context,
5590
- service
5488
+ context
5591
5489
  });
5592
5490
  }
5593
5491
  });
@@ -5628,13 +5526,11 @@ var useRemoveRow = () => {
5628
5526
  mutationFn: ({
5629
5527
  model,
5630
5528
  ids,
5631
- context,
5632
- service
5529
+ context
5633
5530
  }) => removeRows({
5634
5531
  model,
5635
5532
  ids,
5636
- context,
5637
- service
5533
+ context
5638
5534
  })
5639
5535
  });
5640
5536
  };
@@ -5665,12 +5561,10 @@ var useRunAction = () => {
5665
5561
  return (0, import_react_query60.useMutation)({
5666
5562
  mutationFn: ({
5667
5563
  idAction,
5668
- context,
5669
- service
5564
+ context
5670
5565
  }) => runAction({
5671
5566
  idAction,
5672
- context,
5673
- service
5567
+ context
5674
5568
  })
5675
5569
  });
5676
5570
  };