@apia/execution 4.0.50 → 4.0.58

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/LICENSE.md ADDED
@@ -0,0 +1,6 @@
1
+ All Rights Reserved.
2
+
3
+ Copyright (c) 2026 Statum
4
+
5
+ This software and associated documentation files are proprietary and confidential.
6
+ Unauthorized copying, distribution, modification, or use is strictly prohibited.
package/dist/index.d.ts CHANGED
@@ -311,6 +311,7 @@ type TApiaImageProperties = TApiaFieldCommonProperties & TApiaGroupableFieldProp
311
311
  url?: string;
312
312
  };
313
313
  type TApiaInputProperties = TApiaFieldCommonProperties & TApiaTranslatableFieldProperties & TApiaGroupableFieldProperties & TApiaFieldWithAttributeProperties & TApiaFieldSizableFieldProperties & {
314
+ autoComplete?: string;
314
315
  regExpMessage?: string;
315
316
  placeHolder?: string;
316
317
  autoFocus?: string;
@@ -359,6 +360,7 @@ type TApiaSelectProperties = TApiaFieldCommonProperties & TApiaGroupableFieldPro
359
360
  title?: string;
360
361
  };
361
362
  type TApiaTextareaProperties = TApiaFieldCommonProperties & TApiaTranslatableFieldProperties & TApiaFieldWithAttributeProperties & TApiaFieldSizableFieldProperties & {
363
+ autoComplete?: string;
362
364
  autoFocus?: string;
363
365
  placeHolder?: string;
364
366
  title?: string;
@@ -1050,6 +1052,7 @@ declare class ApiaForm implements IApiaForm {
1050
1052
  clearForm(clearReadonlyFields: boolean, deleteGridsRows: boolean): void;
1051
1053
  hideModal(): void;
1052
1054
  showAsModal(size?: TModalSize): void;
1055
+ renderComponent(componentName: string, el: HTMLElement): void;
1053
1056
  }
1054
1057
 
1055
1058
  declare abstract class ApiaField<Props extends typeof FieldConstants = typeof FieldConstants> implements IApiaField<Props> {
@@ -1893,6 +1896,54 @@ declare class CustomComponent {
1893
1896
  setState<K extends keyof TCustomComponentState>(prop: K, value: TCustomComponentState[K]): void;
1894
1897
  }
1895
1898
 
1899
+ declare enum ExecutionState {
1900
+ RUNNING = 0,
1901
+ LOADING = 1,
1902
+ FINISHED = 2,
1903
+ RENDERING = 3,
1904
+ CONFIRMING = 4,
1905
+ FINISHED_WITH_ERROR = 5
1906
+ }
1907
+ type TOnClose = 'clearEvalPath' | 'confirmOkOnClose' | 'confirmOkOnCloseSplash' | 'confirmOkOnSaveSplash' | 'releaseOkOnClose' | null;
1908
+ type TErrMessage = {
1909
+ message: {
1910
+ text: string;
1911
+ label?: string;
1912
+ };
1913
+ };
1914
+ type TFetchTaskActionResponse = {
1915
+ onClose?: TOnClose;
1916
+ sysMessages?: TErrMessage;
1917
+ sysExceptions?: TErrMessage;
1918
+ type?: string;
1919
+ actions?: {
1920
+ action: {
1921
+ param: string[];
1922
+ toDo: string;
1923
+ };
1924
+ };
1925
+ load?: {
1926
+ canClose: boolean;
1927
+ type: string;
1928
+ text: {
1929
+ label: string;
1930
+ closeAll: boolean;
1931
+ addClass?: string;
1932
+ title?: string;
1933
+ };
1934
+ };
1935
+ text?: {
1936
+ title?: string;
1937
+ label?: string;
1938
+ };
1939
+ };
1940
+ type FieldError = {
1941
+ id: string;
1942
+ errorMessage: string;
1943
+ title: string;
1944
+ focus: string;
1945
+ };
1946
+
1896
1947
  declare class Form extends WithProperties<TApiaFormProperties> {
1897
1948
  execution: Execution;
1898
1949
  fields: TApiaFieldBaseDefinition<Record<string, any>>[];
@@ -1957,6 +2008,7 @@ declare class Form extends WithProperties<TApiaFormProperties> {
1957
2008
  fireScriptEvent(eventName: TFormEventName): Promise<boolean>;
1958
2009
  validate(): Promise<true | Field>;
1959
2010
  getProperty<K extends keyof TApiaFormProperties>(propName: K | 'readOnly'): TApiaFormProperties[K];
2011
+ getErrorsList(): FieldError[];
1960
2012
  }
1961
2013
 
1962
2014
  type TTranslationState = {
@@ -2502,48 +2554,6 @@ declare abstract class FlowModal<T extends {
2502
2554
  abstract confirm(result: T): Promise<Status | FlowModal<any>>;
2503
2555
  }
2504
2556
 
2505
- declare enum ExecutionState {
2506
- RUNNING = 0,
2507
- LOADING = 1,
2508
- FINISHED = 2,
2509
- RENDERING = 3,
2510
- CONFIRMING = 4,
2511
- FINISHED_WITH_ERROR = 5
2512
- }
2513
- type TOnClose = 'clearEvalPath' | 'confirmOkOnClose' | 'confirmOkOnCloseSplash' | 'confirmOkOnSaveSplash' | 'releaseOkOnClose' | null;
2514
- type TErrMessage = {
2515
- message: {
2516
- text: string;
2517
- label?: string;
2518
- };
2519
- };
2520
- type TFetchTaskActionResponse = {
2521
- onClose?: TOnClose;
2522
- sysMessages?: TErrMessage;
2523
- sysExceptions?: TErrMessage;
2524
- type?: string;
2525
- actions?: {
2526
- action: {
2527
- param: string[];
2528
- toDo: string;
2529
- };
2530
- };
2531
- load?: {
2532
- canClose: boolean;
2533
- type: string;
2534
- text: {
2535
- label: string;
2536
- closeAll: boolean;
2537
- addClass?: string;
2538
- title?: string;
2539
- };
2540
- };
2541
- text?: {
2542
- title?: string;
2543
- label?: string;
2544
- };
2545
- };
2546
-
2547
2557
  type TCheckWizardResponse = {
2548
2558
  url: string;
2549
2559
  };
@@ -2692,6 +2702,11 @@ declare class Execution extends EventEmitter$1<{
2692
2702
  form: Form;
2693
2703
  size?: TModalSize;
2694
2704
  };
2705
+ renderComponent: {
2706
+ form: Form;
2707
+ componentName: string;
2708
+ el: HTMLElement;
2709
+ };
2695
2710
  }> {
2696
2711
  environment: TExecutionEnvironment;
2697
2712
  renderers?: TModalConfig['renderers'];
@@ -2723,6 +2738,7 @@ declare class Execution extends EventEmitter$1<{
2723
2738
  hasChangedAnything: boolean;
2724
2739
  };
2725
2740
  addPendingPromise(promise: Promise<boolean>): void;
2741
+ getErrorsList(): FieldError[];
2726
2742
  getAllForms(): Form[];
2727
2743
  private hasInitializedFormsTabs;
2728
2744
  initializeFormsTabs(frmParent: TFrmParent, cb: () => unknown): void;
package/dist/index.js CHANGED
@@ -1164,6 +1164,9 @@ const setAjaxFormResponse = async (execution, response) => {
1164
1164
  }
1165
1165
  }
1166
1166
  }
1167
+ } else if (ajaxFields[f]?.field) {
1168
+ const ajaxProps = ajaxFields[f]?.field?.properties;
1169
+ apiField.properties = ajaxProps;
1167
1170
  }
1168
1171
  }
1169
1172
  if (form.v === "t" && String(apiaForm.properties[IProperty$1.PROPERTY_FORM_HIDDEN]) !== "true") {
@@ -4892,7 +4895,7 @@ class SelectField extends ApiaFieldWithAttribute {
4892
4895
  if (__privateGet$f(this, _field$b).definition.id) {
4893
4896
  return arrayOrArray(__privateGet$f(this, _field$b).properties.possibleValue).find(
4894
4897
  (c) => c.selected
4895
- )?.label ?? "Not option selected";
4898
+ )?.label ?? "";
4896
4899
  }
4897
4900
  return null;
4898
4901
  }
@@ -5809,6 +5812,13 @@ class ApiaForm {
5809
5812
  showAsModal(size = "finder") {
5810
5813
  __privateGet$3(this, _execution$1).emit("showFormAsModal", { form: __privateGet$3(this, _form), size });
5811
5814
  }
5815
+ renderComponent(componentName, el) {
5816
+ __privateGet$3(this, _execution$1).emit("renderComponent", {
5817
+ form: __privateGet$3(this, _form),
5818
+ componentName,
5819
+ el
5820
+ });
5821
+ }
5812
5822
  }
5813
5823
  _form = new WeakMap();
5814
5824
  _execution$1 = new WeakMap();
@@ -6759,6 +6769,23 @@ class Form extends WithProperties {
6759
6769
  }
6760
6770
  return super.getProperty(propName);
6761
6771
  }
6772
+ getErrorsList() {
6773
+ const errors = [];
6774
+ this.allFields.forEach((f) => {
6775
+ if (f instanceof FieldWithAttribute) {
6776
+ const fieldErrors = f.state.validation.errorMessage;
6777
+ if (fieldErrors) {
6778
+ errors.push({
6779
+ id: `${f.getForm().definition.frmParent}_${f.getForm().definition.id}_${f.definition.id}`,
6780
+ errorMessage: fieldErrors,
6781
+ title: f.attribute.title,
6782
+ focus: getFocusIdentifier(f)
6783
+ });
6784
+ }
6785
+ }
6786
+ });
6787
+ return errors;
6788
+ }
6762
6789
  }
6763
6790
 
6764
6791
  function decodeBase64ToUtf8(base64String) {
@@ -7259,10 +7286,10 @@ class Observations {
7259
7286
  }
7260
7287
  }
7261
7288
 
7262
- let FlowModal$1 = class FlowModal {
7263
- };
7289
+ class FlowModal {
7290
+ }
7264
7291
 
7265
- class ShowPoolSelection extends FlowModal$1 {
7292
+ class ShowPoolSelection extends FlowModal {
7266
7293
  constructor(fetchResult, confirm) {
7267
7294
  super();
7268
7295
  this.fetchResult = fetchResult;
@@ -7280,7 +7307,7 @@ const initialState = {
7280
7307
  disabledParents: [],
7281
7308
  groupSelectionObj: null
7282
7309
  };
7283
- class ShowPathSelection extends FlowModal$1 {
7310
+ class ShowPathSelection extends FlowModal {
7284
7311
  constructor(fetchResult, confirm) {
7285
7312
  super();
7286
7313
  this.fetchResult = fetchResult;
@@ -7315,15 +7342,15 @@ class ShowPathSelection extends FlowModal$1 {
7315
7342
  }
7316
7343
  }
7317
7344
 
7318
- let ShowSignSelection$1 = class ShowSignSelection extends FlowModal$1 {
7345
+ class ShowSignSelection extends FlowModal {
7319
7346
  constructor(fetchResult, confirm) {
7320
7347
  super();
7321
7348
  this.fetchResult = fetchResult;
7322
7349
  this.confirm = confirm;
7323
7350
  }
7324
- };
7351
+ }
7325
7352
 
7326
- class ShowConfirmMessage extends FlowModal$1 {
7353
+ class ShowConfirmMessage extends FlowModal {
7327
7354
  constructor(fetchResult, confirm) {
7328
7355
  super();
7329
7356
  this.fetchResult = fetchResult;
@@ -7331,17 +7358,18 @@ class ShowConfirmMessage extends FlowModal$1 {
7331
7358
  }
7332
7359
  }
7333
7360
 
7334
- let ShowSign$1 = class ShowSign extends FlowModal$1 {
7361
+ class ShowSign extends FlowModal {
7335
7362
  constructor(fetchResult, confirm) {
7336
7363
  super();
7337
7364
  this.fetchResult = fetchResult;
7338
7365
  this.confirm = confirm;
7339
7366
  }
7340
- };
7367
+ }
7341
7368
 
7342
7369
  function buildPoolSelection(execution, status, poolForm) {
7343
7370
  return new ShowPoolSelection(poolForm, async (result) => {
7344
7371
  if (result.confirmed) {
7372
+ const unLock = execution.lock();
7345
7373
  const confirmPoolResult = await axios.post(
7346
7374
  makeApiaUrl(execution, {
7347
7375
  action: "confirmPool",
@@ -7353,6 +7381,8 @@ function buildPoolSelection(execution, status, poolForm) {
7353
7381
  const parsedRes = parseXMLRequestResponse(
7354
7382
  confirmPoolResult
7355
7383
  );
7384
+ if (parsedRes)
7385
+ unLock();
7356
7386
  if (parsedRes?.actions?.action?.param[1] === "confirmOkOnClose" || parsedRes?.onClose === "confirmOkOnClose") {
7357
7387
  if (parsedRes?.load?.text?.content) {
7358
7388
  execution.notifications.add(
@@ -7364,6 +7394,14 @@ function buildPoolSelection(execution, status, poolForm) {
7364
7394
  }
7365
7395
  return { ...status, step: "CHECK_WIZARD" };
7366
7396
  } else {
7397
+ if (parsedRes?.sysMessages?.message) {
7398
+ execution.notifications.add(
7399
+ new MessageNotification({
7400
+ message: parsedRes?.sysMessages?.message?.text,
7401
+ type: "warning"
7402
+ })
7403
+ );
7404
+ }
7367
7405
  throw Error("Failed to confirm pool");
7368
7406
  }
7369
7407
  }
@@ -7429,7 +7467,7 @@ async function checkSign$1(execution, status) {
7429
7467
  );
7430
7468
  const mustShowSignModal = checkSignableFormsResponse?.data?.sign;
7431
7469
  if (mustShowSignModal) {
7432
- return new ShowSignSelection$1(
7470
+ return new ShowSignSelection(
7433
7471
  checkSignableFormsResponse?.data,
7434
7472
  async (result) => {
7435
7473
  if (result.confirmed && result.signed) {
@@ -7460,7 +7498,7 @@ async function sign$1(execution, status) {
7460
7498
  );
7461
7499
  const mustShowSignModal = signResponse?.data?.actions.action[1].param[1] === "showAppletModal";
7462
7500
  if (mustShowSignModal) {
7463
- return new ShowSign$1(signResponse?.data, async (result) => {
7501
+ return new ShowSign(signResponse?.data, async (result) => {
7464
7502
  if (result.confirmed) {
7465
7503
  return { ...status, step: "CONFIRM" };
7466
7504
  }
@@ -7555,7 +7593,18 @@ async function defaultConfirm$1(execution, status) {
7555
7593
  Captcha.reload();
7556
7594
  return {
7557
7595
  step: void 0,
7558
- finishedWithError: true
7596
+ finishedWithError: true,
7597
+ error: `Errors found: ${[
7598
+ ...arrayOrArray(confirmResponse?.data?.sysMessages?.message).map(
7599
+ (c) => c.text || c.label
7600
+ ),
7601
+ ...arrayOrArray(confirmResponse?.data?.sysExceptions?.exception).map(
7602
+ (c) => c.text || c.label
7603
+ ),
7604
+ ...arrayOrArray(confirmResponse?.data?.exceptions?.exception).map(
7605
+ (c) => c.text || c.label
7606
+ )
7607
+ ].filter(Boolean).join("\n")}`
7559
7608
  };
7560
7609
  }
7561
7610
  if (confirmResponse?.data?.onClose === "confirmOkOnClose") {
@@ -7683,7 +7732,7 @@ async function confirm(execution, status) {
7683
7732
  while (result.step) {
7684
7733
  const checker = checkers$1[result.step];
7685
7734
  const checkerResult = await checker(execution, result);
7686
- if (checkerResult instanceof FlowModal$1) {
7735
+ if (checkerResult instanceof FlowModal) {
7687
7736
  return checkerResult;
7688
7737
  }
7689
7738
  result = checkerResult;
@@ -7699,25 +7748,6 @@ async function confirm(execution, status) {
7699
7748
  return true;
7700
7749
  }
7701
7750
 
7702
- class FlowModal {
7703
- }
7704
-
7705
- class ShowSignSelection extends FlowModal {
7706
- constructor(fetchResult, confirm) {
7707
- super();
7708
- this.fetchResult = fetchResult;
7709
- this.confirm = confirm;
7710
- }
7711
- }
7712
-
7713
- class ShowSign extends FlowModal {
7714
- constructor(fetchResult, confirm) {
7715
- super();
7716
- this.fetchResult = fetchResult;
7717
- this.confirm = confirm;
7718
- }
7719
- }
7720
-
7721
7751
  async function checkSign(execution, status) {
7722
7752
  const checkSignableFormsResponse = await post(
7723
7753
  execution,
@@ -7766,7 +7796,7 @@ async function sign(execution, status) {
7766
7796
  }
7767
7797
  }
7768
7798
  );
7769
- const mustShowSignModal = signResponse?.data?.actions.action[1].param[1].text === "showAppletModal";
7799
+ const mustShowSignModal = signResponse?.data?.actions.action[1].param[1] === "showAppletModal";
7770
7800
  if (mustShowSignModal) {
7771
7801
  return new ShowSign(signResponse?.data, async (result) => {
7772
7802
  if (result.confirmed) {
@@ -7876,7 +7906,17 @@ const checkers = {
7876
7906
  async function confirmEntity(execution, status) {
7877
7907
  let result = status;
7878
7908
  while (result.step) {
7879
- const checker = checkers[result.step];
7909
+ const step = result.step;
7910
+ const checker = checkers[step];
7911
+ if (!checker) {
7912
+ execution.notifications.add(
7913
+ new MessageNotification({
7914
+ message: `Invalid confirm step: ${String(result.step)}`,
7915
+ type: "error"
7916
+ })
7917
+ );
7918
+ return false;
7919
+ }
7880
7920
  const checkerResult = await checker(execution, result);
7881
7921
  if (checkerResult instanceof FlowModal) {
7882
7922
  return checkerResult;
@@ -8007,6 +8047,17 @@ class Execution extends EventEmitter$1 {
8007
8047
  this._pendingPromises.delete(promise);
8008
8048
  });
8009
8049
  }
8050
+ getErrorsList() {
8051
+ const entityErrors = [];
8052
+ this.forms.E.forEach((form) => {
8053
+ entityErrors.push(...form.getErrorsList());
8054
+ });
8055
+ const processErrors = [];
8056
+ this.forms.P.forEach((form) => {
8057
+ processErrors.push(...form.getErrorsList());
8058
+ });
8059
+ return [...entityErrors, ...processErrors];
8060
+ }
8010
8061
  getAllForms() {
8011
8062
  return [...this.forms.E.values(), ...this.forms.P.values()];
8012
8063
  }
@@ -8232,7 +8283,7 @@ class Execution extends EventEmitter$1 {
8232
8283
  step: "CHECK_LOCK"
8233
8284
  }
8234
8285
  );
8235
- if (result instanceof FlowModal$1) {
8286
+ if (result instanceof FlowModal) {
8236
8287
  return result;
8237
8288
  }
8238
8289
  return result;
@@ -8327,7 +8378,7 @@ class Execution extends EventEmitter$1 {
8327
8378
  }
8328
8379
  const mustShowSignModal = checkSignableFormsRes?.data?.sign;
8329
8380
  if (mustShowSignModal && !result?.signed) {
8330
- return new ShowSignSelection$1(
8381
+ return new ShowSignSelection(
8331
8382
  checkSignableFormsRes?.data,
8332
8383
  async () => {
8333
8384
  return "";
@@ -8474,5 +8525,5 @@ class Execution extends EventEmitter$1 {
8474
8525
  }
8475
8526
  }
8476
8527
 
8477
- export { ActionsController, AdditionalCell, ApiaAttribute, ApiaField, ApiaFieldWithAttribute, ApiaForm, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field, FieldWithAttribute, File, FileUploaderField, FlowModal$1 as FlowModal, Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, IProperty, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, ModalInputField, Multiple, MultipleField, Notifications, Password, PasswordField, Radio, RadioField, SchedulerField, Select, SelectField, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign$1 as ShowSign, ShowSignSelection$1 as ShowSignSelection, StatefulEmitter, StatusNotification, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, createNewField, deepEqual, get, getFocusIdentifier, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseSuccessfulResponse, parseXml, post, shallowEqual };
8528
+ export { ActionsController, AdditionalCell, ApiaAttribute, ApiaField, ApiaFieldWithAttribute, ApiaForm, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field, FieldWithAttribute, File, FileUploaderField, FlowModal, Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, IProperty, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, ModalInputField, Multiple, MultipleField, Notifications, Password, PasswordField, Radio, RadioField, SchedulerField, Select, SelectField, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign, ShowSignSelection, StatefulEmitter, StatusNotification, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, createNewField, deepEqual, get, getFocusIdentifier, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseSuccessfulResponse, parseXml, post, shallowEqual };
8478
8529
  //# sourceMappingURL=index.js.map