@apia/execution 4.0.43 → 4.0.44

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.ts CHANGED
@@ -1,10 +1,12 @@
1
+ import * as _apia_scheduler_controller from '@apia/scheduler-controller';
2
+ import { TScheduleResult, Scheduler } from '@apia/scheduler-controller';
3
+ export { Scheduler } from '@apia/scheduler-controller';
1
4
  import { AxiosRequestConfig, AxiosResponse } from 'axios';
2
5
  import { IStringifyOptions } from 'qs';
3
6
  import { TableController, Row, Cell, CellState } from '@apia/table2-controller';
4
- import { DeepReadonly, EventEmitter as EventEmitter$1, TApiaLoad, TApiaFunction, TApiaLoadForm, Mutex } from '@apia/util';
7
+ import * as _apia_util from '@apia/util';
8
+ import { DeepReadonly, NotificationDefinition, EventEmitter as EventEmitter$1, T__LEGACY_SERVER__ApiaLoad, T__LEGACY_SERVER__ApiaFunction, TApiaLoadForm, Mutex } from '@apia/util';
5
9
  import { MobXTree } from '@apia/tree2-controller';
6
- import * as _apia_scheduler_controller from '@apia/scheduler-controller';
7
- import { TScheduleResult, Scheduler } from '@apia/scheduler-controller';
8
10
 
9
11
  type TApiaButtonDefinition = TApiaFieldBaseDefinition<TApiaButtonProperties> & {
10
12
  fieldType: 'button';
@@ -375,11 +377,13 @@ type TApiaTreeProperties = TApiaFieldCommonProperties & TApiaFieldWithAttributeP
375
377
  autoFocus?: string;
376
378
  };
377
379
 
378
- type TParseXmlBehavior = {
380
+ type XMLParser<T = Record<string, unknown>> = (xml: XMLDocument | string, behaveConfig?: TParseXmlBehavior<T>) => T;
381
+ type TParseXmlBehavior<T> = {
379
382
  avoidTrimXml?: boolean;
380
383
  avoidNormalize?: boolean;
384
+ xmlParser?: XMLParser<T>;
381
385
  };
382
- declare const parseXml: <T = Record<string, unknown>>(xml: XMLDocument | string, behaveConfig?: TParseXmlBehavior) => T;
386
+ declare const parseXml: <T = Record<string, unknown>>(xml: XMLDocument | string, behaveConfig?: TParseXmlBehavior<T>) => T;
383
387
 
384
388
  interface TApiaMessage {
385
389
  label?: string;
@@ -407,11 +411,11 @@ interface IApiaApiRequestConfig {
407
411
  axiosConfig?: AxiosRequestConfig;
408
412
  stringifyOptions?: IStringifyOptions;
409
413
  }
410
- interface IApiaApiPostConfig<DataType> extends IApiaApiRequestConfig, TParseXmlBehavior {
411
- postData?: DataType;
414
+ type IApiaApiPostConfig<PostDataType, ResponseType = any> = IApiaApiRequestConfig & TParseXmlBehavior<ResponseType> & {
415
+ postData?: PostDataType;
412
416
  postDataTreatment?: 'stringify';
413
417
  allowAfterFinish?: boolean;
414
- }
418
+ };
415
419
 
416
420
  type TFormEventName = 'onLoad' | 'onSubmit' | 'onReload' | 'onBeforePrint' | 'onAfterPrint';
417
421
  type TFrmParent = 'E' | 'P';
@@ -517,6 +521,7 @@ type SetValueOptions = Partial<{
517
521
  markAsDirty: boolean;
518
522
  synchronize: boolean;
519
523
  force: boolean;
524
+ fireEvents: boolean;
520
525
  }>;
521
526
  type FireEventParameters = Record<string, unknown>;
522
527
  type FieldValidationState = {
@@ -625,7 +630,6 @@ declare abstract class FieldWithAttribute<FieldProps extends TApiaFieldWithAttri
625
630
  protected processSynchronizeError(e: unknown): void;
626
631
  protected synchronize(newValue: ValueType): Promise<boolean>;
627
632
  protected hasValue(): boolean;
628
- protected isValidValue(): boolean;
629
633
  validate(): Promise<boolean>;
630
634
  setError(err: string): void;
631
635
  protected getServerEventParams(evtId: number, additionalParams?: Record<string, any>): MakeApiaUrlProps;
@@ -871,6 +875,7 @@ declare class ApiaFunctions implements IApiaFunctions {
871
875
  setStepTitle(stepNumber: number, stepTitle: string): void;
872
876
  showActionButton(id: number): void;
873
877
  viewAdmEntity(entName: string, entNum?: number): void;
878
+ changeTab(index: number[]): void;
874
879
  }
875
880
 
876
881
  declare class ActionsController {
@@ -1086,6 +1091,7 @@ declare class ApiaFieldWithAttribute<T = string | boolean> extends ApiaField {
1086
1091
  clearValue(): void;
1087
1092
  getValue(): any;
1088
1093
  setValue(v: T): void;
1094
+ protected _setValue(v: T, options: SetValueOptions): void;
1089
1095
  getLabel(): string | null | void;
1090
1096
  getProperty<K extends keyof TApiaFieldWithAttributeProperties>(name: TApiaFieldWithAttributeProperties[K]): unknown;
1091
1097
  }
@@ -1204,6 +1210,7 @@ declare class GridField extends ApiaField {
1204
1210
  deletePage(): void;
1205
1211
  deleteRow(index: number): Promise<void>;
1206
1212
  editRow(index: number): void;
1213
+ getSelectedIndexes(useAbsoluteIndex?: boolean): number[];
1207
1214
  getAllColumns(): (IApiaField<Readonly<{
1208
1215
  TYPE_INPUT: "input";
1209
1216
  TYPE_SELECT: "select";
@@ -1814,6 +1821,7 @@ declare class FileUploaderField extends ApiaFieldWithAttribute {
1814
1821
  constructor(execution: Execution, field: File$1);
1815
1822
  onChange(cb: (newValue: unknown) => unknown): void;
1816
1823
  setValue(): null;
1824
+ downloadDocument(): Promise<void>;
1817
1825
  }
1818
1826
 
1819
1827
  declare class PasswordField extends ApiaField {
@@ -1881,6 +1889,52 @@ declare class CustomComponent {
1881
1889
  setState<K extends keyof TCustomComponentState>(prop: K, value: TCustomComponentState[K]): void;
1882
1890
  }
1883
1891
 
1892
+ declare enum ExecutionState {
1893
+ RUNNING = 0,
1894
+ LOADING = 1,
1895
+ FINISHED = 2,
1896
+ RENDERING = 3,
1897
+ CONFIRMING = 4,
1898
+ FINISHED_WITH_ERROR = 5
1899
+ }
1900
+ type TOnClose = 'clearEvalPath' | 'confirmOkOnClose' | 'confirmOkOnCloseSplash' | 'confirmOkOnSaveSplash' | 'releaseOkOnClose' | null;
1901
+ type TErrMessage = {
1902
+ message: {
1903
+ text: string;
1904
+ label?: string;
1905
+ };
1906
+ };
1907
+ type TFetchTaskActionResponse = {
1908
+ onClose?: TOnClose;
1909
+ sysMessages?: TErrMessage;
1910
+ sysExceptions?: TErrMessage;
1911
+ type?: string;
1912
+ actions?: {
1913
+ action: {
1914
+ param: string[];
1915
+ toDo: string;
1916
+ };
1917
+ };
1918
+ load?: {
1919
+ canClose: boolean;
1920
+ type: string;
1921
+ text: {
1922
+ label: string;
1923
+ closeAll: boolean;
1924
+ addClass?: string;
1925
+ title?: string;
1926
+ };
1927
+ };
1928
+ text?: {
1929
+ title?: string;
1930
+ label?: string;
1931
+ };
1932
+ };
1933
+ type FieldError = {
1934
+ id: string;
1935
+ errorMessage: string;
1936
+ };
1937
+
1884
1938
  declare class Form extends WithProperties<TApiaFormProperties> {
1885
1939
  execution: Execution;
1886
1940
  fields: TApiaFieldBaseDefinition<Record<string, any>>[];
@@ -1945,6 +1999,7 @@ declare class Form extends WithProperties<TApiaFormProperties> {
1945
1999
  fireScriptEvent(eventName: TFormEventName): Promise<boolean>;
1946
2000
  validate(): Promise<true | Field>;
1947
2001
  getProperty<K extends keyof TApiaFormProperties>(propName: K | 'readOnly'): TApiaFormProperties[K];
2002
+ getErrorsList(): FieldError[];
1948
2003
  }
1949
2004
 
1950
2005
  type TTranslationState = {
@@ -2002,17 +2057,6 @@ declare abstract class TranslatableField<FieldProps extends TApiaTranslatableFie
2002
2057
  type FieldConstructor = new (definition: any) => Field<any, any, any> | FieldWithAttribute<any, any, any> | TranslatableField<any, any, any>;
2003
2058
  type FieldsMapping = Record<string, (definition: any) => FieldConstructor>;
2004
2059
 
2005
- type NotificationIcon = string;
2006
- type NotificationType = 'info' | 'error' | 'success' | 'warning';
2007
- type NotificationDefinition = {
2008
- icon?: NotificationIcon;
2009
- id?: string | number;
2010
- isOpen?: boolean;
2011
- message: string;
2012
- stackTrace?: string;
2013
- title?: string;
2014
- type?: NotificationType;
2015
- };
2016
2060
  declare abstract class Notification<State extends NotificationDefinition = NotificationDefinition> {
2017
2061
  readonly props: State;
2018
2062
  protected state: State;
@@ -2023,7 +2067,7 @@ declare abstract class Notification<State extends NotificationDefinition = Notif
2023
2067
  get message(): string;
2024
2068
  get stackTrace(): string | undefined;
2025
2069
  get title(): string | undefined;
2026
- get type(): NotificationType | undefined;
2070
+ get type(): _apia_util.NotificationType | undefined;
2027
2071
  }
2028
2072
 
2029
2073
  declare class Notifications {
@@ -2033,8 +2077,8 @@ declare class Notifications {
2033
2077
  protected notifications: Notification[];
2034
2078
  add(notification: Notification): void;
2035
2079
  closeTab(): void;
2036
- getAll(): Notification<NotificationDefinition>[];
2037
- getById(id: string | number): Notification<NotificationDefinition> | undefined;
2080
+ getAll(): Notification<_apia_util.NotificationDefinition>[];
2081
+ getById(id: string | number): Notification<_apia_util.NotificationDefinition> | undefined;
2038
2082
  kill(): void;
2039
2083
  remove(notification: string | number | Notification): void;
2040
2084
  on: <K extends "closeTab" | "kill" | "notification">(event: K, cb: Callback<{
@@ -2264,6 +2308,7 @@ declare class UploaderApi extends EventEmitter$1<{
2264
2308
  lockDocument(id: string): Promise<void>;
2265
2309
  protected evaluateDeleteDocumentResult(result: unknown): boolean;
2266
2310
  setTranslationFile(file: TUploaderFileInfo, docId: string, langId: number): void;
2311
+ protected getCheckSignatureParameters: typeof returnExactlyTheSame;
2267
2312
  protected getAjaxUploadFileStatusParameters: typeof returnExactlyTheSame;
2268
2313
  protected getAjaxUploadStartParameters: typeof returnExactlyTheSame;
2269
2314
  protected getConfirmDropModalParameters: typeof returnExactlyTheSame;
@@ -2434,7 +2479,7 @@ type TFileUploaded = {
2434
2479
  virtualDoc?: boolean;
2435
2480
  locked?: boolean;
2436
2481
  };
2437
- type TAjaxUploadStart = TApiaLoad<TApiaFunction<{
2482
+ type TAjaxUploadStart = T__LEGACY_SERVER__ApiaLoad<T__LEGACY_SERVER__ApiaFunction<{
2438
2483
  general: {
2439
2484
  isDocTypeDisabled: boolean;
2440
2485
  useDocTypePermitted: boolean;
@@ -2496,13 +2541,13 @@ type TSaveDroppedFilesConf = {
2496
2541
  translatingFile?: TUploaderFileInfo;
2497
2542
  shouldReset?: boolean;
2498
2543
  };
2499
- type TAjaxUploadFileStatus = TApiaLoad<TApiaFunction<{
2544
+ type TAjaxUploadFileStatus = T__LEGACY_SERVER__ApiaLoad<T__LEGACY_SERVER__ApiaFunction<{
2500
2545
  message: {
2501
2546
  label: string;
2502
2547
  name: string;
2503
2548
  }[];
2504
2549
  }>>;
2505
- type TProcessDroppedFiles = TApiaLoad<TApiaFunction<{
2550
+ type TProcessDroppedFiles = T__LEGACY_SERVER__ApiaLoad<T__LEGACY_SERVER__ApiaFunction<{
2506
2551
  principal: {
2507
2552
  docInfo: TDocInfo | TDocInfo[];
2508
2553
  docTypes: {
@@ -2524,7 +2569,7 @@ type TDocInfo = {
2524
2569
  docInfoTmpId: string;
2525
2570
  docInfoType: string;
2526
2571
  };
2527
- type TConfirmDropModal = TApiaLoad<TApiaFunction<{
2572
+ type TConfirmDropModal = T__LEGACY_SERVER__ApiaLoad<T__LEGACY_SERVER__ApiaFunction<{
2528
2573
  general: TFileUploaded | TFileUploaded[];
2529
2574
  fromForm: {
2530
2575
  fromForm: {
@@ -2562,7 +2607,7 @@ type TUploaderLoadCurrentFunction = {
2562
2607
  }[];
2563
2608
  };
2564
2609
  };
2565
- type TDocumentInformation = TApiaLoad<TApiaFunction<{
2610
+ type TDocumentInformation = T__LEGACY_SERVER__ApiaLoad<T__LEGACY_SERVER__ApiaFunction<{
2566
2611
  data: {
2567
2612
  onClose: string;
2568
2613
  general: TApiaDocumentDefinition;
@@ -2885,13 +2930,9 @@ declare class Observations {
2885
2930
  constructor(execution: Execution);
2886
2931
  private hasInited;
2887
2932
  init(): Promise<void>;
2888
- getConfirmParams(): {
2889
- txtComment: string | undefined;
2890
- chkAddAlert: string | undefined;
2891
- chkAddAllAlert: string | undefined;
2892
- chkRemAlert: string | undefined;
2893
- };
2933
+ getConfirmParams(): Record<string, unknown>;
2894
2934
  setPriority(newPriority: string): void;
2935
+ areObservationsChecked(): boolean;
2895
2936
  }
2896
2937
 
2897
2938
  type ConfirmStep = 'CHECK_LOCK' | 'CONFIRM' | 'CHECK_SIGN' | 'CHECK_WIZARD' | 'SIGN';
@@ -2906,48 +2947,6 @@ declare abstract class FlowModal<T extends {
2906
2947
  abstract confirm(result: T): Promise<Status | FlowModal<any>>;
2907
2948
  }
2908
2949
 
2909
- declare enum ExecutionState {
2910
- RUNNING = 0,
2911
- LOADING = 1,
2912
- FINISHED = 2,
2913
- RENDERING = 3,
2914
- CONFIRMING = 4,
2915
- FINISHED_WITH_ERROR = 5
2916
- }
2917
- type TOnClose = 'clearEvalPath' | 'confirmOkOnClose' | 'confirmOkOnCloseSplash' | 'confirmOkOnSaveSplash' | 'releaseOkOnClose' | null;
2918
- type TErrMessage = {
2919
- message: {
2920
- text: string;
2921
- label?: string;
2922
- };
2923
- };
2924
- type TFetchTaskActionResponse = {
2925
- onClose?: TOnClose;
2926
- sysMessages?: TErrMessage;
2927
- sysExceptions?: TErrMessage;
2928
- type?: string;
2929
- actions?: {
2930
- action: {
2931
- param: string[];
2932
- toDo: string;
2933
- };
2934
- };
2935
- load?: {
2936
- canClose: boolean;
2937
- type: string;
2938
- text: {
2939
- label: string;
2940
- closeAll: boolean;
2941
- addClass?: string;
2942
- title?: string;
2943
- };
2944
- };
2945
- text?: {
2946
- title?: string;
2947
- label?: string;
2948
- };
2949
- };
2950
-
2951
2950
  type TCheckWizardResponse = {
2952
2951
  url: string;
2953
2952
  };
@@ -3108,6 +3107,7 @@ declare class Execution extends EventEmitter$1<{
3108
3107
  private _stepCount;
3109
3108
  readonly notifications: Notifications;
3110
3109
  private lastModalReturn;
3110
+ private _pendingPromises;
3111
3111
  constructor(environment: TExecutionEnvironment);
3112
3112
  protected formsById: {
3113
3113
  E: Map<string, Form>;
@@ -3122,6 +3122,8 @@ declare class Execution extends EventEmitter$1<{
3122
3122
  locked: number;
3123
3123
  hasChangedAnything: boolean;
3124
3124
  };
3125
+ addPendingPromise(promise: Promise<boolean>): void;
3126
+ getErrorsList(): FieldError[];
3125
3127
  getAllForms(): Form[];
3126
3128
  private hasInitializedFormsTabs;
3127
3129
  initializeFormsTabs(frmParent: TFrmParent, cb: () => unknown): void;
@@ -3185,6 +3187,7 @@ declare class Execution extends EventEmitter$1<{
3185
3187
  setLastModalReturn(value: string[]): void;
3186
3188
  getLastModalReturn(): string[];
3187
3189
  private fireEvents;
3190
+ waitForPendingSyncs(): Promise<void>;
3188
3191
  }
3189
3192
 
3190
3193
  declare global {
@@ -3200,10 +3203,10 @@ declare function isXmlResponse(response: AxiosResponse<unknown>): RegExpMatchArr
3200
3203
  declare function isHtmlResponse(response: AxiosResponse<unknown>): RegExpMatchArray | null;
3201
3204
  declare class InvalidSessionException extends Error {
3202
3205
  }
3203
- declare const parseSuccessfulResponse: <LoadType extends Record<string, unknown>, DataType = unknown>(execution: Execution, response: AxiosResponse<string>, behaveConfig?: IApiaApiPostConfig<DataType>) => Promise<(ResponseSysMessages & LoadType & {
3206
+ declare const parseSuccessfulResponse: <ResponseType extends Record<string, unknown>, PostDataType = unknown>(execution: Execution, response: AxiosResponse<string>, behaveConfig?: IApiaApiPostConfig<PostDataType, ResponseType>) => Promise<(ResponseSysMessages & ResponseType & {
3204
3207
  onClose?: string;
3205
3208
  code?: unknown;
3206
- load?: LoadType | undefined;
3209
+ load?: ResponseType | undefined;
3207
3210
  }) | ({
3208
3211
  actions: unknown;
3209
3212
  onClose: string | undefined;
@@ -3216,7 +3219,7 @@ declare const parseSuccessfulResponse: <LoadType extends Record<string, unknown>
3216
3219
  sysMessages: {
3217
3220
  message: TApiaMessage | TApiaMessage[];
3218
3221
  } | undefined;
3219
- } & LoadType) | null>;
3222
+ } & ResponseType) | null>;
3220
3223
  /**
3221
3224
  * IMPORTANT!! The ApiaApi is programmed under the slogan that
3222
3225
  * **should never throw an exception**. **Errors** coming from
@@ -3265,7 +3268,7 @@ declare const parseSuccessfulResponse: <LoadType extends Record<string, unknown>
3265
3268
  }
3266
3269
  * @returns The type of the return value depends on the type passed when calling the function. If there was an error it returns null.
3267
3270
  */
3268
- declare function post<LoadType extends Record<string, unknown> = Record<string, unknown>, DataType = unknown, T = unknown>(execution: Execution, actualUrl: string, behaveConfig?: IApiaApiPostConfig<DataType>): TApiaApiResult<LoadType>;
3271
+ declare function post<LoadType extends Record<string, unknown> = Record<string, unknown>, DataType = unknown, T = unknown>(execution: Execution, actualUrl: string, behaveConfig?: IApiaApiPostConfig<DataType, LoadType>): TApiaApiResult<LoadType>;
3269
3272
  /**
3270
3273
  * IMPORTANTE!! El ApiaApi está programado bajo la consigna de que
3271
3274
  * **no debe tirar núnca una excepción**. **Los errores** provenientes
@@ -3407,7 +3410,7 @@ declare class Checkbox extends FieldWithAttribute<TApiaCheckboxProperties, boole
3407
3410
  type EditorEvents = 'onChange';
3408
3411
  declare class Editor extends TranslatableField<TApiaEditorProperties, string> {
3409
3412
  fireEvent(eventName: EditorEvents, options?: TFireEventOptions): Promise<boolean>;
3410
- protected isValidValue(): boolean;
3413
+ protected hasValue(): boolean;
3411
3414
  protected getSynchronizePostConfiguration(value: string): IApiaApiPostConfig<any>;
3412
3415
  }
3413
3416
 
@@ -3420,6 +3423,7 @@ declare class File$1 extends FieldWithAttribute<TApiaFileProperties> {
3420
3423
  synchronize: boolean;
3421
3424
  }> | undefined): Promise<boolean>;
3422
3425
  loadFromDefinition(def: string): void;
3426
+ downloadDocument(): Promise<void>;
3423
3427
  }
3424
3428
 
3425
3429
  type GridEvents = 'gridAdd' | 'gridDelete' | 'gridSort' | 'gridColumnSelect';
@@ -3616,6 +3620,11 @@ declare class GridPaginated extends Grid {
3616
3620
  */
3617
3621
  get finalIndex(): number;
3618
3622
  addRow(): Promise<boolean>;
3623
+ protected actualDeleteRows(props: {
3624
+ index?: number | number[];
3625
+ action?: string;
3626
+ }): Promise<boolean>;
3627
+ deleteAllRows(): Promise<boolean>;
3619
3628
  deleteRows(index?: number | number[]): Promise<boolean>;
3620
3629
  gotoPage(page: number): Promise<boolean>;
3621
3630
  sortDown(index?: number | number[]): Promise<boolean>;
@@ -3656,7 +3665,7 @@ declare class Input extends TranslatableField<TApiaInputProperties, string, TApi
3656
3665
  setValue(newValue: string | Date | number, options?: SetValueOptions): Promise<boolean>;
3657
3666
  private validateRegex;
3658
3667
  validate(): Promise<boolean>;
3659
- protected isValidValue(): boolean;
3668
+ protected hasValue(): boolean;
3660
3669
  }
3661
3670
 
3662
3671
  declare class Label extends Field<TApiaLabelProperties, TApiaLabelDefinition> {
@@ -3714,7 +3723,7 @@ declare class Multiple extends FieldWithAttribute<TApiaMultipleProperties, strin
3714
3723
  }
3715
3724
 
3716
3725
  declare class Password extends FieldWithAttribute<TApiaPasswordProperties, string> {
3717
- protected isValidValue(): boolean;
3726
+ protected hasValue(): boolean;
3718
3727
  }
3719
3728
 
3720
3729
  type RadioEvents = 'onPopulate' | 'onChange' | 'onClick';
@@ -3733,7 +3742,7 @@ declare class Select extends FieldWithAttribute<TApiaSelectProperties, string, T
3733
3742
  }
3734
3743
 
3735
3744
  declare class Textarea extends TranslatableField<TApiaTextareaProperties, string> {
3736
- protected isValidValue(): boolean;
3745
+ protected hasValue(): boolean;
3737
3746
  protected getSynchronizePostConfiguration(value: string): IApiaApiPostConfig<any>;
3738
3747
  }
3739
3748
 
@@ -3751,7 +3760,6 @@ declare class Tree extends FieldWithAttribute<TApiaTreeProperties, TTreeValue[],
3751
3760
  protected hasValue(): boolean;
3752
3761
  setProperty<K extends keyof TApiaTreeProperties>(propName: K, propValue: TApiaTreeProperties[K]): void;
3753
3762
  init(form: Form): Promise<void>;
3754
- protected isValidValue(): boolean;
3755
3763
  setValue(newValue: TTreeValue[], options?: Partial<{
3756
3764
  comparator: Comparator$1<any>;
3757
3765
  format: 'd/m/Y' | 'apia';