@etsoo/appscript 1.2.80 → 1.2.83

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.
@@ -1,6 +1,6 @@
1
1
  import { INotifier, NotificationAlign, NotificationCallProps, NotificationContent, NotificationReturn } from '@etsoo/notificationbase';
2
2
  import { ApiDataError, IApi, IPData } from '@etsoo/restclient';
3
- import { DataTypes, DateUtils, IStorage } from '@etsoo/shared';
3
+ import { DataTypes, DateUtils, IStorage, ListType, ListType1 } from '@etsoo/shared';
4
4
  import { AddressRegion } from '../address/AddressRegion';
5
5
  import { ProductUnit } from '../business/ProductUnit';
6
6
  import { InitCallDto } from '../dto/InitCallDto';
@@ -24,7 +24,7 @@ export declare type RefreshTokenResult = boolean | string | ApiDataError | IActi
24
24
  /**
25
25
  * Refresh token props
26
26
  */
27
- export interface RefreshTokenProps<D extends {}> {
27
+ export interface RefreshTokenProps<D extends object> {
28
28
  /**
29
29
  * Callback
30
30
  */
@@ -269,7 +269,7 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
269
269
  * Get roles
270
270
  * @param role Combination role value
271
271
  */
272
- getRoles(role: number): DataTypes.IdLabelItem[];
272
+ getRoles(role: number): ListType[];
273
273
  /**
274
274
  * Get status label
275
275
  * @param status Status value
@@ -279,7 +279,7 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
279
279
  * Get status list
280
280
  * @returns list
281
281
  */
282
- getStatusList(): DataTypes.IdLabelItem[];
282
+ getStatusList(): ListType[];
283
283
  /**
284
284
  * Get refresh token from response headers
285
285
  * @param rawResponse Raw response from API call
@@ -337,7 +337,7 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
337
337
  * Refresh token
338
338
  * @param props Props
339
339
  */
340
- refreshToken<D extends {} = {}>(props?: RefreshTokenProps<D>): Promise<boolean>;
340
+ refreshToken<D extends object = {}>(props?: RefreshTokenProps<D>): Promise<boolean>;
341
341
  /**
342
342
  * Signout
343
343
  */
@@ -348,7 +348,7 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
348
348
  * @param serviceId Service id
349
349
  * @returns Result
350
350
  */
351
- orgList(items?: number, serviceId?: number): Promise<DataTypes.IdLabelItem[] | undefined>;
351
+ orgList(items?: number, serviceId?: number): Promise<ListType[] | undefined>;
352
352
  /**
353
353
  * Persist settings to source when application exit
354
354
  */
@@ -380,7 +380,7 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
380
380
  * UI get involved while refreshToken not intended
381
381
  * @param data Additional request data
382
382
  */
383
- tryLogin<D extends {} = {}>(data?: D): Promise<boolean>;
383
+ tryLogin<D extends object = {}>(data?: D): Promise<boolean>;
384
384
  /**
385
385
  * User login
386
386
  * @param user User data
@@ -717,7 +717,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
717
717
  * @param filter Filter
718
718
  * @returns List
719
719
  */
720
- protected getEnumList<E extends DataTypes.EnumBase = DataTypes.EnumBase>(em: E, prefix: string, filter?: (id: E[keyof E], key: keyof E & string) => E[keyof E] | undefined): DataTypes.IdLabelItem[];
720
+ protected getEnumList<E extends DataTypes.EnumBase = DataTypes.EnumBase>(em: E, prefix: string, filter?: (id: E[keyof E], key: keyof E & string) => E[keyof E] | undefined): ListType[];
721
721
  /**
722
722
  * Get enum item string id list
723
723
  * @param em Enum
@@ -725,7 +725,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
725
725
  * @param filter Filter
726
726
  * @returns List
727
727
  */
728
- protected getEnumStrList<E extends DataTypes.EnumBase = DataTypes.EnumBase>(em: E, prefix: string, filter?: (id: E[keyof E], key: keyof E & string) => E[keyof E] | undefined): DataTypes.IdLabelItem<string>[];
728
+ protected getEnumStrList<E extends DataTypes.EnumBase = DataTypes.EnumBase>(em: E, prefix: string, filter?: (id: E[keyof E], key: keyof E & string) => E[keyof E] | undefined): ListType1[];
729
729
  /**
730
730
  * Get all regions
731
731
  * @returns Regions
@@ -735,12 +735,12 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
735
735
  * Get roles
736
736
  * @param role Combination role value
737
737
  */
738
- getRoles(role: number): DataTypes.IdLabelItem<number>[];
738
+ getRoles(role: number): ListType[];
739
739
  /**
740
740
  * Get status list
741
741
  * @returns list
742
742
  */
743
- getStatusList(): DataTypes.IdLabelItem<number>[];
743
+ getStatusList(): ListType[];
744
744
  /**
745
745
  * Get status label
746
746
  * @param status Status value
@@ -807,7 +807,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
807
807
  * Refresh token
808
808
  * @param props Props
809
809
  */
810
- refreshToken<D extends {} = {}>(props?: RefreshTokenProps<D>): Promise<boolean>;
810
+ refreshToken<D extends object = {}>(props?: RefreshTokenProps<D>): Promise<boolean>;
811
811
  /**
812
812
  * Setup callback
813
813
  */
@@ -823,7 +823,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
823
823
  * @param serviceId Service id
824
824
  * @returns Result
825
825
  */
826
- orgList(items?: number, serviceId?: number): Promise<DataTypes.IdLabelItem<number>[] | undefined>;
826
+ orgList(items?: number, serviceId?: number): Promise<ListType[] | undefined>;
827
827
  /**
828
828
  * Switch organization
829
829
  * @param id Organization id
@@ -847,7 +847,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
847
847
  * @param data Additional request data
848
848
  * @param showLoading Show loading bar or not during call
849
849
  */
850
- tryLogin<D extends {} = {}>(_data?: D, _showLoading?: boolean): Promise<boolean>;
850
+ tryLogin<D extends object = {}>(_data?: D, _showLoading?: boolean): Promise<boolean>;
851
851
  /**
852
852
  * User login
853
853
  * @param user User data
@@ -1,5 +1,6 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { IBridgeHost } from './IBridgeHost';
2
- declare type CallHandlerType = (name: string, ...args: unknown[]) => PromiseLike<Record<string, unknown> | void>;
3
+ declare type CallHandlerType = (name: string, ...args: unknown[]) => PromiseLike<DataTypes.StringRecord | void>;
3
4
  /**
4
5
  * Flutter JavaScript Host
5
6
  * https://inappwebview.dev/docs/javascript/communication/
@@ -1,4 +1,4 @@
1
- import { DataTypes } from '@etsoo/shared';
1
+ import { DataTypes, ListType, ListType1 } from '@etsoo/shared';
2
2
  import { ICultureGet } from '../state/Culture';
3
3
  import { ProductUnit } from './ProductUnit';
4
4
  /**
@@ -19,14 +19,14 @@ export declare namespace BusinessUtils {
19
19
  * @param func Label delegate
20
20
  * @returns Collection
21
21
  */
22
- function getCurrencies(currencyNames: string[], func: ICultureGet): DataTypes.IdLabelItem<string>[];
22
+ function getCurrencies(currencyNames: string[], func: ICultureGet): ListType1[];
23
23
  /**
24
24
  * Get 12-month items
25
25
  * @param monthLabels Month labels
26
26
  * @param startMonth Start month, 0 as Jan.
27
27
  * @returns 12 months
28
28
  */
29
- function getMonths(monthLabels: string[], startMonth?: number): DataTypes.IdLabelItem<number>[];
29
+ function getMonths(monthLabels: string[], startMonth?: number): ListType[];
30
30
  /**
31
31
  * Get product unit's label
32
32
  * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
@@ -41,7 +41,7 @@ export declare namespace BusinessUtils {
41
41
  * @param func Label delegate
42
42
  * @returns Units
43
43
  */
44
- function getUnits(func: ICultureGet): DataTypes.IdLabelItem[];
44
+ function getUnits(func: ICultureGet): ListType[];
45
45
  /**
46
46
  *
47
47
  * Get all product units
@@ -50,7 +50,7 @@ export declare namespace BusinessUtils {
50
50
  * @param isJoined Add the join label like 'per Kg' for Kg
51
51
  * @returns Units
52
52
  */
53
- function getUnits(func: ICultureGet, options?: string[], isJoined?: boolean): DataTypes.IdLabelItem[];
53
+ function getUnits(func: ICultureGet, options?: string[], isJoined?: boolean): ListType[];
54
54
  /**
55
55
  *
56
56
  * Get all repeat options
@@ -59,7 +59,7 @@ export declare namespace BusinessUtils {
59
59
  * @param isJoined Add the join label like 'per Kg' for Kg
60
60
  * @returns Units
61
61
  */
62
- function getRepeatOptions(func: ICultureGet, options?: string[], isJoined?: boolean): DataTypes.IdLabelItem[];
62
+ function getRepeatOptions(func: ICultureGet, options?: string[], isJoined?: boolean): ListType[];
63
63
  /**
64
64
  * Set id value
65
65
  * @param item QueryRQ or TiplistRQ or similiar item
@@ -1,5 +1,5 @@
1
- import { DataTypes } from '@etsoo/shared';
1
+ import { ListType, ListType1 } from '@etsoo/shared';
2
2
  /**
3
3
  * Conditional IdLabel type
4
4
  */
5
- export declare type IdLabelConditional<T extends boolean> = T extends true ? DataTypes.IdLabelItem<number>[] : DataTypes.IdLabelItem<string>[];
5
+ export declare type IdLabelConditional<T extends boolean> = T extends true ? ListType[] : ListType1[];
@@ -4,4 +4,4 @@ import { DataTypes } from '@etsoo/shared';
4
4
  * @param localResources Local resources
5
5
  * @returns Full culture
6
6
  */
7
- export declare const enUS: (localResources: {}) => DataTypes.CultureDefinition;
7
+ export declare const enUS: (localResources: object) => DataTypes.CultureDefinition;
@@ -4,4 +4,4 @@ import { DataTypes } from '@etsoo/shared';
4
4
  * @param localResources Local resources
5
5
  * @returns Full culture
6
6
  */
7
- export declare const zhHK: (localResources: {}) => DataTypes.CultureDefinition;
7
+ export declare const zhHK: (localResources: object) => DataTypes.CultureDefinition;
@@ -7,5 +7,5 @@ export declare class ActionResult {
7
7
  * Create a result from error
8
8
  * @returns Action result interface
9
9
  */
10
- static create<D extends {} = {}>(error: Error): IActionResult<D>;
10
+ static create<D extends object = {}>(error: Error): IActionResult<D>;
11
11
  }
@@ -9,7 +9,7 @@ export interface IResultErrors {
9
9
  /**
10
10
  * Operation result interface
11
11
  */
12
- export interface IActionResult<D extends {} = {}> {
12
+ export interface IActionResult<D extends object = {}> {
13
13
  /**
14
14
  * Status code
15
15
  */
@@ -1,6 +1,6 @@
1
1
  import { INotifier, NotificationAlign, NotificationCallProps, NotificationContent, NotificationReturn } from '@etsoo/notificationbase';
2
2
  import { ApiDataError, IApi, IPData } from '@etsoo/restclient';
3
- import { DataTypes, DateUtils, IStorage } from '@etsoo/shared';
3
+ import { DataTypes, DateUtils, IStorage, ListType, ListType1 } from '@etsoo/shared';
4
4
  import { AddressRegion } from '../address/AddressRegion';
5
5
  import { ProductUnit } from '../business/ProductUnit';
6
6
  import { InitCallDto } from '../dto/InitCallDto';
@@ -24,7 +24,7 @@ export declare type RefreshTokenResult = boolean | string | ApiDataError | IActi
24
24
  /**
25
25
  * Refresh token props
26
26
  */
27
- export interface RefreshTokenProps<D extends {}> {
27
+ export interface RefreshTokenProps<D extends object> {
28
28
  /**
29
29
  * Callback
30
30
  */
@@ -269,7 +269,7 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
269
269
  * Get roles
270
270
  * @param role Combination role value
271
271
  */
272
- getRoles(role: number): DataTypes.IdLabelItem[];
272
+ getRoles(role: number): ListType[];
273
273
  /**
274
274
  * Get status label
275
275
  * @param status Status value
@@ -279,7 +279,7 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
279
279
  * Get status list
280
280
  * @returns list
281
281
  */
282
- getStatusList(): DataTypes.IdLabelItem[];
282
+ getStatusList(): ListType[];
283
283
  /**
284
284
  * Get refresh token from response headers
285
285
  * @param rawResponse Raw response from API call
@@ -337,7 +337,7 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
337
337
  * Refresh token
338
338
  * @param props Props
339
339
  */
340
- refreshToken<D extends {} = {}>(props?: RefreshTokenProps<D>): Promise<boolean>;
340
+ refreshToken<D extends object = {}>(props?: RefreshTokenProps<D>): Promise<boolean>;
341
341
  /**
342
342
  * Signout
343
343
  */
@@ -348,7 +348,7 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
348
348
  * @param serviceId Service id
349
349
  * @returns Result
350
350
  */
351
- orgList(items?: number, serviceId?: number): Promise<DataTypes.IdLabelItem[] | undefined>;
351
+ orgList(items?: number, serviceId?: number): Promise<ListType[] | undefined>;
352
352
  /**
353
353
  * Persist settings to source when application exit
354
354
  */
@@ -380,7 +380,7 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
380
380
  * UI get involved while refreshToken not intended
381
381
  * @param data Additional request data
382
382
  */
383
- tryLogin<D extends {} = {}>(data?: D): Promise<boolean>;
383
+ tryLogin<D extends object = {}>(data?: D): Promise<boolean>;
384
384
  /**
385
385
  * User login
386
386
  * @param user User data
@@ -717,7 +717,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
717
717
  * @param filter Filter
718
718
  * @returns List
719
719
  */
720
- protected getEnumList<E extends DataTypes.EnumBase = DataTypes.EnumBase>(em: E, prefix: string, filter?: (id: E[keyof E], key: keyof E & string) => E[keyof E] | undefined): DataTypes.IdLabelItem[];
720
+ protected getEnumList<E extends DataTypes.EnumBase = DataTypes.EnumBase>(em: E, prefix: string, filter?: (id: E[keyof E], key: keyof E & string) => E[keyof E] | undefined): ListType[];
721
721
  /**
722
722
  * Get enum item string id list
723
723
  * @param em Enum
@@ -725,7 +725,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
725
725
  * @param filter Filter
726
726
  * @returns List
727
727
  */
728
- protected getEnumStrList<E extends DataTypes.EnumBase = DataTypes.EnumBase>(em: E, prefix: string, filter?: (id: E[keyof E], key: keyof E & string) => E[keyof E] | undefined): DataTypes.IdLabelItem<string>[];
728
+ protected getEnumStrList<E extends DataTypes.EnumBase = DataTypes.EnumBase>(em: E, prefix: string, filter?: (id: E[keyof E], key: keyof E & string) => E[keyof E] | undefined): ListType1[];
729
729
  /**
730
730
  * Get all regions
731
731
  * @returns Regions
@@ -735,12 +735,12 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
735
735
  * Get roles
736
736
  * @param role Combination role value
737
737
  */
738
- getRoles(role: number): DataTypes.IdLabelItem<number>[];
738
+ getRoles(role: number): ListType[];
739
739
  /**
740
740
  * Get status list
741
741
  * @returns list
742
742
  */
743
- getStatusList(): DataTypes.IdLabelItem<number>[];
743
+ getStatusList(): ListType[];
744
744
  /**
745
745
  * Get status label
746
746
  * @param status Status value
@@ -807,7 +807,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
807
807
  * Refresh token
808
808
  * @param props Props
809
809
  */
810
- refreshToken<D extends {} = {}>(props?: RefreshTokenProps<D>): Promise<boolean>;
810
+ refreshToken<D extends object = {}>(props?: RefreshTokenProps<D>): Promise<boolean>;
811
811
  /**
812
812
  * Setup callback
813
813
  */
@@ -823,7 +823,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
823
823
  * @param serviceId Service id
824
824
  * @returns Result
825
825
  */
826
- orgList(items?: number, serviceId?: number): Promise<DataTypes.IdLabelItem<number>[] | undefined>;
826
+ orgList(items?: number, serviceId?: number): Promise<ListType[] | undefined>;
827
827
  /**
828
828
  * Switch organization
829
829
  * @param id Organization id
@@ -847,7 +847,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
847
847
  * @param data Additional request data
848
848
  * @param showLoading Show loading bar or not during call
849
849
  */
850
- tryLogin<D extends {} = {}>(_data?: D, _showLoading?: boolean): Promise<boolean>;
850
+ tryLogin<D extends object = {}>(_data?: D, _showLoading?: boolean): Promise<boolean>;
851
851
  /**
852
852
  * User login
853
853
  * @param user User data
@@ -1,5 +1,6 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { IBridgeHost } from './IBridgeHost';
2
- declare type CallHandlerType = (name: string, ...args: unknown[]) => PromiseLike<Record<string, unknown> | void>;
3
+ declare type CallHandlerType = (name: string, ...args: unknown[]) => PromiseLike<DataTypes.StringRecord | void>;
3
4
  /**
4
5
  * Flutter JavaScript Host
5
6
  * https://inappwebview.dev/docs/javascript/communication/
@@ -1,4 +1,4 @@
1
- import { DataTypes } from '@etsoo/shared';
1
+ import { DataTypes, ListType, ListType1 } from '@etsoo/shared';
2
2
  import { ICultureGet } from '../state/Culture';
3
3
  import { ProductUnit } from './ProductUnit';
4
4
  /**
@@ -19,14 +19,14 @@ export declare namespace BusinessUtils {
19
19
  * @param func Label delegate
20
20
  * @returns Collection
21
21
  */
22
- function getCurrencies(currencyNames: string[], func: ICultureGet): DataTypes.IdLabelItem<string>[];
22
+ function getCurrencies(currencyNames: string[], func: ICultureGet): ListType1[];
23
23
  /**
24
24
  * Get 12-month items
25
25
  * @param monthLabels Month labels
26
26
  * @param startMonth Start month, 0 as Jan.
27
27
  * @returns 12 months
28
28
  */
29
- function getMonths(monthLabels: string[], startMonth?: number): DataTypes.IdLabelItem<number>[];
29
+ function getMonths(monthLabels: string[], startMonth?: number): ListType[];
30
30
  /**
31
31
  * Get product unit's label
32
32
  * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
@@ -41,7 +41,7 @@ export declare namespace BusinessUtils {
41
41
  * @param func Label delegate
42
42
  * @returns Units
43
43
  */
44
- function getUnits(func: ICultureGet): DataTypes.IdLabelItem[];
44
+ function getUnits(func: ICultureGet): ListType[];
45
45
  /**
46
46
  *
47
47
  * Get all product units
@@ -50,7 +50,7 @@ export declare namespace BusinessUtils {
50
50
  * @param isJoined Add the join label like 'per Kg' for Kg
51
51
  * @returns Units
52
52
  */
53
- function getUnits(func: ICultureGet, options?: string[], isJoined?: boolean): DataTypes.IdLabelItem[];
53
+ function getUnits(func: ICultureGet, options?: string[], isJoined?: boolean): ListType[];
54
54
  /**
55
55
  *
56
56
  * Get all repeat options
@@ -59,7 +59,7 @@ export declare namespace BusinessUtils {
59
59
  * @param isJoined Add the join label like 'per Kg' for Kg
60
60
  * @returns Units
61
61
  */
62
- function getRepeatOptions(func: ICultureGet, options?: string[], isJoined?: boolean): DataTypes.IdLabelItem[];
62
+ function getRepeatOptions(func: ICultureGet, options?: string[], isJoined?: boolean): ListType[];
63
63
  /**
64
64
  * Set id value
65
65
  * @param item QueryRQ or TiplistRQ or similiar item
@@ -1,5 +1,5 @@
1
- import { DataTypes } from '@etsoo/shared';
1
+ import { ListType, ListType1 } from '@etsoo/shared';
2
2
  /**
3
3
  * Conditional IdLabel type
4
4
  */
5
- export declare type IdLabelConditional<T extends boolean> = T extends true ? DataTypes.IdLabelItem<number>[] : DataTypes.IdLabelItem<string>[];
5
+ export declare type IdLabelConditional<T extends boolean> = T extends true ? ListType[] : ListType1[];
@@ -4,4 +4,4 @@ import { DataTypes } from '@etsoo/shared';
4
4
  * @param localResources Local resources
5
5
  * @returns Full culture
6
6
  */
7
- export declare const enUS: (localResources: {}) => DataTypes.CultureDefinition;
7
+ export declare const enUS: (localResources: object) => DataTypes.CultureDefinition;
@@ -4,4 +4,4 @@ import { DataTypes } from '@etsoo/shared';
4
4
  * @param localResources Local resources
5
5
  * @returns Full culture
6
6
  */
7
- export declare const zhHK: (localResources: {}) => DataTypes.CultureDefinition;
7
+ export declare const zhHK: (localResources: object) => DataTypes.CultureDefinition;
@@ -7,5 +7,5 @@ export declare class ActionResult {
7
7
  * Create a result from error
8
8
  * @returns Action result interface
9
9
  */
10
- static create<D extends {} = {}>(error: Error): IActionResult<D>;
10
+ static create<D extends object = {}>(error: Error): IActionResult<D>;
11
11
  }
@@ -9,7 +9,7 @@ export interface IResultErrors {
9
9
  /**
10
10
  * Operation result interface
11
11
  */
12
- export interface IActionResult<D extends {} = {}> {
12
+ export interface IActionResult<D extends object = {}> {
13
13
  /**
14
14
  * Status code
15
15
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.2.80",
3
+ "version": "1.2.83",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -52,9 +52,9 @@
52
52
  },
53
53
  "homepage": "https://github.com/ETSOO/AppScript#readme",
54
54
  "dependencies": {
55
- "@etsoo/notificationbase": "^1.1.6",
56
- "@etsoo/restclient": "^1.0.70",
57
- "@etsoo/shared": "^1.1.46",
55
+ "@etsoo/notificationbase": "^1.1.7",
56
+ "@etsoo/restclient": "^1.0.71",
57
+ "@etsoo/shared": "^1.1.48",
58
58
  "@types/crypto-js": "^4.1.1",
59
59
  "crypto-js": "^4.1.1"
60
60
  },
@@ -64,15 +64,15 @@
64
64
  "@babel/plugin-transform-runtime": "^7.18.10",
65
65
  "@babel/preset-env": "^7.18.10",
66
66
  "@babel/runtime-corejs3": "^7.18.9",
67
- "@types/jest": "^28.1.7",
68
- "@typescript-eslint/eslint-plugin": "^5.34.0",
69
- "@typescript-eslint/parser": "^5.34.0",
67
+ "@types/jest": "^28.1.8",
68
+ "@typescript-eslint/eslint-plugin": "^5.35.1",
69
+ "@typescript-eslint/parser": "^5.35.1",
70
70
  "eslint": "^8.22.0",
71
71
  "eslint-config-airbnb-base": "^15.0.0",
72
72
  "eslint-plugin-import": "^2.26.0",
73
73
  "jest": "^28.1.3",
74
74
  "jest-environment-jsdom": "^28.1.3",
75
75
  "ts-jest": "^28.0.8",
76
- "typescript": "^4.7.4"
76
+ "typescript": "^4.8.2"
77
77
  }
78
78
  }
@@ -13,6 +13,8 @@ import {
13
13
  DateUtils,
14
14
  DomUtils,
15
15
  IStorage,
16
+ ListType,
17
+ ListType1,
16
18
  NumberUtils,
17
19
  Utils
18
20
  } from '@etsoo/shared';
@@ -62,7 +64,7 @@ export type RefreshTokenResult =
62
64
  /**
63
65
  * Refresh token props
64
66
  */
65
- export interface RefreshTokenProps<D extends {}> {
67
+ export interface RefreshTokenProps<D extends object> {
66
68
  /**
67
69
  * Callback
68
70
  */
@@ -385,7 +387,7 @@ export interface ICoreApp<
385
387
  * Get roles
386
388
  * @param role Combination role value
387
389
  */
388
- getRoles(role: number): DataTypes.IdLabelItem[];
390
+ getRoles(role: number): ListType[];
389
391
 
390
392
  /**
391
393
  * Get status label
@@ -397,7 +399,7 @@ export interface ICoreApp<
397
399
  * Get status list
398
400
  * @returns list
399
401
  */
400
- getStatusList(): DataTypes.IdLabelItem[];
402
+ getStatusList(): ListType[];
401
403
 
402
404
  /**
403
405
  * Get refresh token from response headers
@@ -468,7 +470,7 @@ export interface ICoreApp<
468
470
  * Refresh token
469
471
  * @param props Props
470
472
  */
471
- refreshToken<D extends {} = {}>(
473
+ refreshToken<D extends object = {}>(
472
474
  props?: RefreshTokenProps<D>
473
475
  ): Promise<boolean>;
474
476
 
@@ -486,7 +488,7 @@ export interface ICoreApp<
486
488
  orgList(
487
489
  items?: number,
488
490
  serviceId?: number
489
- ): Promise<DataTypes.IdLabelItem[] | undefined>;
491
+ ): Promise<ListType[] | undefined>;
490
492
 
491
493
  /**
492
494
  * Persist settings to source when application exit
@@ -524,7 +526,7 @@ export interface ICoreApp<
524
526
  * UI get involved while refreshToken not intended
525
527
  * @param data Additional request data
526
528
  */
527
- tryLogin<D extends {} = {}>(data?: D): Promise<boolean>;
529
+ tryLogin<D extends object = {}>(data?: D): Promise<boolean>;
528
530
 
529
531
  /**
530
532
  * User login
@@ -1620,8 +1622,8 @@ export abstract class CoreApp<
1620
1622
  id: E[keyof E],
1621
1623
  key: keyof E & string
1622
1624
  ) => E[keyof E] | undefined
1623
- ): DataTypes.IdLabelItem[] {
1624
- const list: DataTypes.IdLabelItem<number>[] = [];
1625
+ ): ListType[] {
1626
+ const list: ListType[] = [];
1625
1627
  const keys = DataTypes.getEnumKeys(em);
1626
1628
  for (const key of keys) {
1627
1629
  let id = em[key as keyof E];
@@ -1651,8 +1653,8 @@ export abstract class CoreApp<
1651
1653
  id: E[keyof E],
1652
1654
  key: keyof E & string
1653
1655
  ) => E[keyof E] | undefined
1654
- ): DataTypes.IdLabelItem<string>[] {
1655
- const list: DataTypes.IdLabelItem<string>[] = [];
1656
+ ): ListType1[] {
1657
+ const list: ListType1[] = [];
1656
1658
  const keys = DataTypes.getEnumKeys(em);
1657
1659
  for (const key of keys) {
1658
1660
  let id = em[key as keyof E];
@@ -1842,7 +1844,7 @@ export abstract class CoreApp<
1842
1844
  * Refresh token
1843
1845
  * @param props Props
1844
1846
  */
1845
- async refreshToken<D extends {} = {}>(props?: RefreshTokenProps<D>) {
1847
+ async refreshToken<D extends object = {}>(props?: RefreshTokenProps<D>) {
1846
1848
  if (props && props.callback) props.callback(true, undefined);
1847
1849
  return true;
1848
1850
  }
@@ -1883,7 +1885,7 @@ export abstract class CoreApp<
1883
1885
  * @returns Result
1884
1886
  */
1885
1887
  async orgList(items?: number, serviceId?: number) {
1886
- return await this.api.post<DataTypes.IdLabelItem[]>(
1888
+ return await this.api.post<ListType[]>(
1887
1889
  'Organization/List',
1888
1890
  {
1889
1891
  items,
@@ -1951,7 +1953,7 @@ export abstract class CoreApp<
1951
1953
  * @param data Additional request data
1952
1954
  * @param showLoading Show loading bar or not during call
1953
1955
  */
1954
- async tryLogin<D extends {} = {}>(_data?: D, _showLoading?: boolean) {
1956
+ async tryLogin<D extends object = {}>(_data?: D, _showLoading?: boolean) {
1955
1957
  if (this._isTryingLogin) return false;
1956
1958
  this._isTryingLogin = true;
1957
1959
  return true;
@@ -1,11 +1,11 @@
1
- import { ExtendUtils } from '@etsoo/shared';
1
+ import { DataTypes, ExtendUtils } from '@etsoo/shared';
2
2
  import { IBridgeHost } from './IBridgeHost';
3
3
 
4
4
  // Call handler type
5
5
  type CallHandlerType = (
6
6
  name: string,
7
7
  ...args: unknown[]
8
- ) => PromiseLike<Record<string, unknown> | void>;
8
+ ) => PromiseLike<DataTypes.StringRecord | void>;
9
9
 
10
10
  /**
11
11
  * Flutter JavaScript Host
@@ -1,4 +1,4 @@
1
- import { DataTypes } from '@etsoo/shared';
1
+ import { DataTypes, ListType, ListType1 } from '@etsoo/shared';
2
2
  import { ICultureGet } from '../state/Culture';
3
3
  import { ProductUnit } from './ProductUnit';
4
4
  import { RepeatOption } from './RepeatOption';
@@ -55,7 +55,7 @@ export namespace BusinessUtils {
55
55
  export function getCurrencies(
56
56
  currencyNames: string[],
57
57
  func: ICultureGet
58
- ): DataTypes.IdLabelItem<string>[] {
58
+ ): ListType1[] {
59
59
  return currencyNames.map((name) => ({
60
60
  id: name,
61
61
  label: func(`currency${name}`) ?? name
@@ -69,7 +69,7 @@ export namespace BusinessUtils {
69
69
  * @returns 12 months
70
70
  */
71
71
  export function getMonths(monthLabels: string[], startMonth: number = 0) {
72
- const months: DataTypes.IdLabelItem[] = [];
72
+ const months: ListType[] = [];
73
73
 
74
74
  for (let i = 0; i < 12; i++) {
75
75
  if (startMonth >= 12) startMonth = 0;
@@ -109,7 +109,7 @@ export namespace BusinessUtils {
109
109
  * @param func Label delegate
110
110
  * @returns Units
111
111
  */
112
- export function getUnits(func: ICultureGet): DataTypes.IdLabelItem[];
112
+ export function getUnits(func: ICultureGet): ListType[];
113
113
 
114
114
  /**
115
115
  *
@@ -123,7 +123,7 @@ export namespace BusinessUtils {
123
123
  func: ICultureGet,
124
124
  options?: string[],
125
125
  isJoined?: boolean
126
- ): DataTypes.IdLabelItem[];
126
+ ): ListType[];
127
127
 
128
128
  /**
129
129
  *
@@ -137,7 +137,7 @@ export namespace BusinessUtils {
137
137
  func: ICultureGet,
138
138
  options?: string[],
139
139
  isJoined?: boolean
140
- ): DataTypes.IdLabelItem[] {
140
+ ): ListType[] {
141
141
  options ??= DataTypes.getEnumKeys(ProductUnit);
142
142
  return options.map((key) => {
143
143
  const id = DataTypes.getEnumByKey(ProductUnit, key)! as number;
@@ -160,7 +160,7 @@ export namespace BusinessUtils {
160
160
  func: ICultureGet,
161
161
  options?: string[],
162
162
  isJoined: boolean = true
163
- ): DataTypes.IdLabelItem[] {
163
+ ): ListType[] {
164
164
  options ??= DataTypes.getEnumKeys(RepeatOption);
165
165
  isJoined ??= true;
166
166
 
@@ -1,8 +1,8 @@
1
- import { DataTypes } from '@etsoo/shared';
1
+ import { ListType, ListType1 } from '@etsoo/shared';
2
2
 
3
3
  /**
4
4
  * Conditional IdLabel type
5
5
  */
6
6
  export type IdLabelConditional<T extends boolean> = T extends true
7
- ? DataTypes.IdLabelItem<number>[]
8
- : DataTypes.IdLabelItem<string>[];
7
+ ? ListType[]
8
+ : ListType1[];
package/src/i18n/enUS.ts CHANGED
@@ -6,7 +6,7 @@ import enUSResources from './en-US.json';
6
6
  * @param localResources Local resources
7
7
  * @returns Full culture
8
8
  */
9
- export const enUS = (localResources: {}): DataTypes.CultureDefinition => ({
9
+ export const enUS = (localResources: object): DataTypes.CultureDefinition => ({
10
10
  name: 'en-US',
11
11
  label: 'English',
12
12
  resources: { ...enUSResources, ...localResources },
package/src/i18n/zhHK.ts CHANGED
@@ -6,7 +6,7 @@ import zhHKResources from './zh-HK.json';
6
6
  * @param localResources Local resources
7
7
  * @returns Full culture
8
8
  */
9
- export const zhHK = (localResources: {}): DataTypes.CultureDefinition => ({
9
+ export const zhHK = (localResources: object): DataTypes.CultureDefinition => ({
10
10
  name: 'zh-HK',
11
11
  label: '繁體中文',
12
12
  resources: { ...zhHKResources, ...localResources },
@@ -9,7 +9,7 @@ export class ActionResult {
9
9
  * Create a result from error
10
10
  * @returns Action result interface
11
11
  */
12
- static create<D extends {} = {}>(error: Error) {
12
+ static create<D extends object = {}>(error: Error) {
13
13
  // If the error is ApiError, hold the status
14
14
  const status = error instanceof ApiError ? error.status : undefined;
15
15
 
@@ -11,7 +11,7 @@ export interface IResultErrors {
11
11
  /**
12
12
  * Operation result interface
13
13
  */
14
- export interface IActionResult<D extends {} = {}> {
14
+ export interface IActionResult<D extends object = {}> {
15
15
  /**
16
16
  * Status code
17
17
  */