@apia/util 4.0.43 → 4.0.45
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 +114 -3
- package/dist/index.js +27 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -887,6 +887,115 @@ interface TNotificationMessage {
|
|
|
887
887
|
};
|
|
888
888
|
}
|
|
889
889
|
|
|
890
|
+
type TAttribute = {
|
|
891
|
+
name: string;
|
|
892
|
+
value: string;
|
|
893
|
+
};
|
|
894
|
+
type TOption = {
|
|
895
|
+
label: string;
|
|
896
|
+
value: string;
|
|
897
|
+
};
|
|
898
|
+
type TWithAttributes = {
|
|
899
|
+
attributes: Record<string, string>;
|
|
900
|
+
};
|
|
901
|
+
type TWithOptions = {
|
|
902
|
+
options: TOption | TOption[];
|
|
903
|
+
};
|
|
904
|
+
type TBehavior = TWithAttributes & {
|
|
905
|
+
allowEdition: boolean;
|
|
906
|
+
allowSelection: boolean;
|
|
907
|
+
isMultipleSelection: boolean;
|
|
908
|
+
hasDynamicStructure: boolean;
|
|
909
|
+
showAdditionalInfo: boolean;
|
|
910
|
+
};
|
|
911
|
+
type TColumn = TWithAttributes & TWithStylesModifiers & {
|
|
912
|
+
className: string;
|
|
913
|
+
hideFromAccordion: boolean;
|
|
914
|
+
isHidden: boolean;
|
|
915
|
+
isHtml: boolean;
|
|
916
|
+
isSortable: boolean;
|
|
917
|
+
name: string;
|
|
918
|
+
showAsAdditional: boolean;
|
|
919
|
+
showInAccordionTitle: boolean;
|
|
920
|
+
sortType: 'ASC' | 'DESC' | 'NONE';
|
|
921
|
+
title: string;
|
|
922
|
+
tooltip: string;
|
|
923
|
+
width: string;
|
|
924
|
+
};
|
|
925
|
+
type TFilter = TWithAttributes & TWithOptions & {
|
|
926
|
+
asAdditional: boolean;
|
|
927
|
+
name: string;
|
|
928
|
+
columnName: string;
|
|
929
|
+
isRequired: boolean;
|
|
930
|
+
initialValue: string;
|
|
931
|
+
runAutomatically: boolean;
|
|
932
|
+
title: string;
|
|
933
|
+
tooltip: string;
|
|
934
|
+
type: 'DATE' | 'INPUT' | 'COMBO' | 'DATERANGE' | 'SIZE' | 'SIZERANGE' | 'DATEHOUR' | 'DATEHOURRANGE';
|
|
935
|
+
};
|
|
936
|
+
type TLoadStructure = {
|
|
937
|
+
behavior: TBehavior;
|
|
938
|
+
columns: TColumn | TColumn[];
|
|
939
|
+
filters: TFilter | TFilter[];
|
|
940
|
+
rows?: TRow | TRow[];
|
|
941
|
+
};
|
|
942
|
+
type TStateIcon = 'ALERT' | 'DISALLOWED' | 'LOCKED' | 'PRIORITY_LOW' | 'PRIORITY_NORMAL' | 'PRIORITY_HIGH' | 'PRIORITY_URGENT';
|
|
943
|
+
type TWithAlignment = {
|
|
944
|
+
horizontalAlign?: 'Left' | 'Center' | 'Right' | 'Justify';
|
|
945
|
+
verticalAlign?: 'Top' | 'Middle' | 'Bottom';
|
|
946
|
+
};
|
|
947
|
+
type TWithStylesModifiers = {
|
|
948
|
+
background: string;
|
|
949
|
+
color: string;
|
|
950
|
+
isBold: boolean;
|
|
951
|
+
isHtml: boolean;
|
|
952
|
+
isLight: boolean;
|
|
953
|
+
};
|
|
954
|
+
type TCell = TWithAttributes & TWithStylesModifiers & TWithAlignment & {
|
|
955
|
+
className: string;
|
|
956
|
+
colspan: number;
|
|
957
|
+
renderer?: string;
|
|
958
|
+
text: string;
|
|
959
|
+
title: string;
|
|
960
|
+
};
|
|
961
|
+
type TActionBehavior = 'DO_NOTHING' | 'NAVIGATE_URL' | 'CALL_AJAX_URL' | 'RUN_ACTION' | 'OPEN_TAB' | 'FIRE_EVENT' | 'DOWNLOAD';
|
|
962
|
+
type TActionSource = 'CLICK' | 'DOUBLE_CLICK';
|
|
963
|
+
type TBasicAction = {
|
|
964
|
+
action: string;
|
|
965
|
+
actionBehavior: TActionBehavior;
|
|
966
|
+
actionSource: TActionSource;
|
|
967
|
+
additionalData: string;
|
|
968
|
+
text: string;
|
|
969
|
+
};
|
|
970
|
+
type TRow = TWithAttributes & TWithStylesModifiers & {
|
|
971
|
+
action: TBasicAction;
|
|
972
|
+
} & TWithAlignment & {
|
|
973
|
+
cells: TCell | TCell[];
|
|
974
|
+
className: string;
|
|
975
|
+
id: string;
|
|
976
|
+
isDisabled: boolean;
|
|
977
|
+
isHidden: boolean;
|
|
978
|
+
isSelected: boolean;
|
|
979
|
+
isSeparator: boolean;
|
|
980
|
+
states: TState | TState[];
|
|
981
|
+
title: string;
|
|
982
|
+
};
|
|
983
|
+
type TState = {
|
|
984
|
+
color: string;
|
|
985
|
+
tooltip: string;
|
|
986
|
+
className: string;
|
|
987
|
+
Icon: TStateIcon;
|
|
988
|
+
};
|
|
989
|
+
type TRefresh = {
|
|
990
|
+
rows: TRow | TRow[];
|
|
991
|
+
};
|
|
992
|
+
interface IStatesSource {
|
|
993
|
+
background: string;
|
|
994
|
+
color: string;
|
|
995
|
+
isBold: boolean;
|
|
996
|
+
isLight: boolean;
|
|
997
|
+
}
|
|
998
|
+
|
|
890
999
|
type TId = string | number;
|
|
891
1000
|
type TModify<T, R> = Omit<T, keyof R> & R;
|
|
892
1001
|
type TMap$1<T> = Record<string | number, T>;
|
|
@@ -1944,6 +2053,7 @@ declare class Semaphore {
|
|
|
1944
2053
|
* @returns A promise that resolves when the permit has been acquired.
|
|
1945
2054
|
*/
|
|
1946
2055
|
acquire(): Promise<void>;
|
|
2056
|
+
clear(): void;
|
|
1947
2057
|
/**
|
|
1948
2058
|
* Releases a previously acquired permit.
|
|
1949
2059
|
*
|
|
@@ -1954,15 +2064,16 @@ declare class Semaphore {
|
|
|
1954
2064
|
|
|
1955
2065
|
declare class Mutex extends Semaphore {
|
|
1956
2066
|
constructor();
|
|
1957
|
-
runExclusive(cb: () =>
|
|
2067
|
+
runExclusive<T>(cb: () => Promise<T>): Promise<T | undefined>;
|
|
1958
2068
|
}
|
|
1959
2069
|
|
|
1960
2070
|
type Task<T> = () => Promise<T>;
|
|
1961
2071
|
declare class TasksQueue {
|
|
1962
2072
|
private mutex;
|
|
1963
2073
|
get isBusy(): boolean;
|
|
1964
|
-
|
|
2074
|
+
clear(): void;
|
|
2075
|
+
run<T>(task: Task<T>): Promise<T | undefined>;
|
|
1965
2076
|
}
|
|
1966
2077
|
|
|
1967
|
-
export { AudioRecorder, type AudioRecorderState, BasicStoredElement, BouncingEmitter, type Callback, ClassNameBuilder, type DebounceOptions, type DeepReadonly, type DownloadStringAsDocProps, EventEmitter, History, type IOnFocusConfiguration, type IParameter, type ISetBoundary, Locker, type Map, Mutex, PropsSelectorUndefinedObject, PropsStore, ScrollLocker, Semaphore, StatefulEmitter, type StatefulStoreUpdateProps, type StatefulStoreUpdater, type TApiaAction, type TApiaActions, type TApiaCellDefinition, type TApiaComplexCell, type TApiaFieldPropsObj, type TApiaFilter, type TApiaFilterOption, type TApiaFilterValue, type TApiaFormButton, type TApiaFormElement, type TApiaFormElementOption, type TApiaFunction, type TApiaFunctionPageInfo, type TApiaLoad, type TApiaLoadForm, type TApiaLoadText, type TApiaMessage, type TApiaMultiplePossibleValue, type TApiaPossibleValue, type TApiaRadioPossibleValue, type TApiaRowDefinition, type TApiaSelectPossibleValue, type TApiaSystemMessageObj, type TApiaTableFunction, type TCallback, type TDateFormat, type TDispatchCallback, type TDownloadUrlOptions, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFncParams, type TFocusRetriever, type THistoryCount, type THistoryStep, type THistoryStepChange, type TId, type TKey, type TMap$1 as TMap, type TMessage, type TModify, type TNotificationMessage, type TPropsComparator, type TPropsConfiguration, type TPropsSelector, type TRequireOnlyOne, type TShortcutBranch, type TUpdateFieldConfiguration, type Task, TasksQueue, type ThrottleOptions, type UnSubscriber, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, uniqueId, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, useMountTransition, usePanAndZoom, usePrevious, usePropsSelector, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
|
|
2078
|
+
export { AudioRecorder, type AudioRecorderState, BasicStoredElement, BouncingEmitter, type Callback, ClassNameBuilder, type DebounceOptions, type DeepReadonly, type DownloadStringAsDocProps, EventEmitter, History, type IOnFocusConfiguration, type IParameter, type ISetBoundary, type IStatesSource, Locker, type Map, Mutex, PropsSelectorUndefinedObject, PropsStore, ScrollLocker, Semaphore, StatefulEmitter, type StatefulStoreUpdateProps, type StatefulStoreUpdater, type TActionBehavior, type TActionSource, type TApiaAction, type TApiaActions, type TApiaCellDefinition, type TApiaComplexCell, type TApiaFieldPropsObj, type TApiaFilter, type TApiaFilterOption, type TApiaFilterValue, type TApiaFormButton, type TApiaFormElement, type TApiaFormElementOption, type TApiaFunction, type TApiaFunctionPageInfo, type TApiaLoad, type TApiaLoadForm, type TApiaLoadText, type TApiaMessage, type TApiaMultiplePossibleValue, type TApiaPossibleValue, type TApiaRadioPossibleValue, type TApiaRowDefinition, type TApiaSelectPossibleValue, type TApiaSystemMessageObj, type TApiaTableFunction, type TAttribute, type TBasicAction, type TBehavior, type TCallback, type TCell, type TColumn, type TDateFormat, type TDispatchCallback, type TDownloadUrlOptions, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFilter, type TFncParams, type TFocusRetriever, type THistoryCount, type THistoryStep, type THistoryStepChange, type TId, type TKey, type TLoadStructure, type TMap$1 as TMap, type TMessage, type TModify, type TNotificationMessage, type TOption, type TPropsComparator, type TPropsConfiguration, type TPropsSelector, type TRefresh, type TRequireOnlyOne, type TRow, type TShortcutBranch, type TState, type TStateIcon, type TUpdateFieldConfiguration, type TWithAlignment, type TWithAttributes, type TWithOptions, type TWithStylesModifiers, type Task, TasksQueue, type ThrottleOptions, type UnSubscriber, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, uniqueId, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, useMountTransition, usePanAndZoom, usePrevious, usePropsSelector, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
|
|
1968
2079
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1821,6 +1821,7 @@ class CancellablePromise extends Promise {
|
|
|
1821
1821
|
this.cancel = cancel;
|
|
1822
1822
|
}
|
|
1823
1823
|
}
|
|
1824
|
+
const cancellingToken = Symbol();
|
|
1824
1825
|
class Semaphore {
|
|
1825
1826
|
/**
|
|
1826
1827
|
* Creates a new instance of the Semaphore.
|
|
@@ -1853,16 +1854,23 @@ class Semaphore {
|
|
|
1853
1854
|
return Promise.resolve();
|
|
1854
1855
|
}
|
|
1855
1856
|
let resolver = null;
|
|
1857
|
+
let rejecter = null;
|
|
1856
1858
|
return new CancellablePromise(
|
|
1857
|
-
(resolve) => {
|
|
1859
|
+
(resolve, reject) => {
|
|
1858
1860
|
resolver = resolve;
|
|
1859
|
-
|
|
1861
|
+
rejecter = reject;
|
|
1862
|
+
this.queue.push({ resolve, reject });
|
|
1860
1863
|
},
|
|
1861
1864
|
() => {
|
|
1862
|
-
this.queue = this.queue.filter((c) => c !== resolver);
|
|
1865
|
+
this.queue = this.queue.filter((c) => c.resolve !== resolver);
|
|
1866
|
+
rejecter(cancellingToken);
|
|
1863
1867
|
}
|
|
1864
1868
|
);
|
|
1865
1869
|
}
|
|
1870
|
+
clear() {
|
|
1871
|
+
this.queue.forEach((c) => c.reject());
|
|
1872
|
+
this.queue.splice(0);
|
|
1873
|
+
}
|
|
1866
1874
|
/**
|
|
1867
1875
|
* Releases a previously acquired permit.
|
|
1868
1876
|
*
|
|
@@ -1870,7 +1878,7 @@ class Semaphore {
|
|
|
1870
1878
|
*/
|
|
1871
1879
|
release() {
|
|
1872
1880
|
this.current = Math.max(0, this.current - 1);
|
|
1873
|
-
this.queue.shift()?.();
|
|
1881
|
+
this.queue.shift()?.resolve();
|
|
1874
1882
|
}
|
|
1875
1883
|
}
|
|
1876
1884
|
|
|
@@ -1879,9 +1887,16 @@ class Mutex extends Semaphore {
|
|
|
1879
1887
|
super(1);
|
|
1880
1888
|
}
|
|
1881
1889
|
async runExclusive(cb) {
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1890
|
+
try {
|
|
1891
|
+
await this.acquire();
|
|
1892
|
+
const result = await cb();
|
|
1893
|
+
this.release();
|
|
1894
|
+
return result;
|
|
1895
|
+
} catch (t) {
|
|
1896
|
+
if (t !== cancellingToken) {
|
|
1897
|
+
throw t;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1885
1900
|
}
|
|
1886
1901
|
}
|
|
1887
1902
|
|
|
@@ -1892,13 +1907,13 @@ class TasksQueue {
|
|
|
1892
1907
|
get isBusy() {
|
|
1893
1908
|
return this.mutex.isBusy;
|
|
1894
1909
|
}
|
|
1910
|
+
clear() {
|
|
1911
|
+
this.mutex.clear();
|
|
1912
|
+
}
|
|
1895
1913
|
async run(task) {
|
|
1896
|
-
await this.mutex.
|
|
1897
|
-
try {
|
|
1914
|
+
return await this.mutex.runExclusive(async () => {
|
|
1898
1915
|
return await task();
|
|
1899
|
-
}
|
|
1900
|
-
this.mutex.release();
|
|
1901
|
-
}
|
|
1916
|
+
});
|
|
1902
1917
|
}
|
|
1903
1918
|
}
|
|
1904
1919
|
|