@etsoo/appscript 1.1.58 → 1.1.59
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/lib/cjs/app/CoreApp.d.ts +18 -0
- package/lib/cjs/app/CoreApp.js +16 -0
- package/lib/mjs/app/CoreApp.d.ts +18 -0
- package/lib/mjs/app/CoreApp.js +16 -0
- package/package.json +1 -1
- package/src/app/CoreApp.ts +30 -0
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -126,6 +126,12 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
126
126
|
* @returns string
|
|
127
127
|
*/
|
|
128
128
|
formatDate(input?: Date | string, options?: DateUtils.FormatOptions, timeZone?: string): string | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Format error
|
|
131
|
+
* @param error Error
|
|
132
|
+
* @returns Error message
|
|
133
|
+
*/
|
|
134
|
+
formatError(error: ApiDataError): string;
|
|
129
135
|
/**
|
|
130
136
|
* Format money number
|
|
131
137
|
* @param input Input money number
|
|
@@ -141,6 +147,12 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
141
147
|
* @returns Result
|
|
142
148
|
*/
|
|
143
149
|
formatNumber(input?: number | bigint, options?: Intl.NumberFormatOptions): string | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Format refresh token result
|
|
152
|
+
* @param result Refresh token result
|
|
153
|
+
* @returns Message
|
|
154
|
+
*/
|
|
155
|
+
formatRefreshTokenResult(result: RefreshTokenResult): string | undefined;
|
|
144
156
|
/**
|
|
145
157
|
* Format result text
|
|
146
158
|
* @param result Action result
|
|
@@ -387,6 +399,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
387
399
|
* @returns Error message
|
|
388
400
|
*/
|
|
389
401
|
formatError(error: ApiDataError): string;
|
|
402
|
+
/**
|
|
403
|
+
* Format refresh token result
|
|
404
|
+
* @param result Refresh token result
|
|
405
|
+
* @returns Message
|
|
406
|
+
*/
|
|
407
|
+
formatRefreshTokenResult(result: RefreshTokenResult): string | undefined;
|
|
390
408
|
/**
|
|
391
409
|
* Format result text
|
|
392
410
|
* @param result Action result
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoreApp = void 0;
|
|
4
4
|
const notificationbase_1 = require("@etsoo/notificationbase");
|
|
5
|
+
const restclient_1 = require("@etsoo/restclient");
|
|
5
6
|
const shared_1 = require("@etsoo/shared");
|
|
6
7
|
const AddressRegion_1 = require("../address/AddressRegion");
|
|
7
8
|
const AddressUtils_1 = require("../address/AddressUtils");
|
|
@@ -266,6 +267,21 @@ class CoreApp {
|
|
|
266
267
|
formatError(error) {
|
|
267
268
|
return error.toString();
|
|
268
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Format refresh token result
|
|
272
|
+
* @param result Refresh token result
|
|
273
|
+
* @returns Message
|
|
274
|
+
*/
|
|
275
|
+
formatRefreshTokenResult(result) {
|
|
276
|
+
// Undefined for boolean
|
|
277
|
+
if (typeof result === 'boolean')
|
|
278
|
+
return undefined;
|
|
279
|
+
return result instanceof restclient_1.ApiDataError
|
|
280
|
+
? this.formatError(result)
|
|
281
|
+
: typeof result !== 'string'
|
|
282
|
+
? ActionResultError_1.ActionResultError.format(result)
|
|
283
|
+
: result;
|
|
284
|
+
}
|
|
269
285
|
/**
|
|
270
286
|
* Format result text
|
|
271
287
|
* @param result Action result
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -126,6 +126,12 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
126
126
|
* @returns string
|
|
127
127
|
*/
|
|
128
128
|
formatDate(input?: Date | string, options?: DateUtils.FormatOptions, timeZone?: string): string | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Format error
|
|
131
|
+
* @param error Error
|
|
132
|
+
* @returns Error message
|
|
133
|
+
*/
|
|
134
|
+
formatError(error: ApiDataError): string;
|
|
129
135
|
/**
|
|
130
136
|
* Format money number
|
|
131
137
|
* @param input Input money number
|
|
@@ -141,6 +147,12 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
141
147
|
* @returns Result
|
|
142
148
|
*/
|
|
143
149
|
formatNumber(input?: number | bigint, options?: Intl.NumberFormatOptions): string | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Format refresh token result
|
|
152
|
+
* @param result Refresh token result
|
|
153
|
+
* @returns Message
|
|
154
|
+
*/
|
|
155
|
+
formatRefreshTokenResult(result: RefreshTokenResult): string | undefined;
|
|
144
156
|
/**
|
|
145
157
|
* Format result text
|
|
146
158
|
* @param result Action result
|
|
@@ -387,6 +399,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
387
399
|
* @returns Error message
|
|
388
400
|
*/
|
|
389
401
|
formatError(error: ApiDataError): string;
|
|
402
|
+
/**
|
|
403
|
+
* Format refresh token result
|
|
404
|
+
* @param result Refresh token result
|
|
405
|
+
* @returns Message
|
|
406
|
+
*/
|
|
407
|
+
formatRefreshTokenResult(result: RefreshTokenResult): string | undefined;
|
|
390
408
|
/**
|
|
391
409
|
* Format result text
|
|
392
410
|
* @param result Action result
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NotificationAlign, NotificationMessageType } from '@etsoo/notificationbase';
|
|
2
|
+
import { ApiDataError } from '@etsoo/restclient';
|
|
2
3
|
import { DateUtils, DomUtils, NumberUtils, StorageUtils } from '@etsoo/shared';
|
|
3
4
|
import { AddressRegion } from '../address/AddressRegion';
|
|
4
5
|
import { AddressUtils } from '../address/AddressUtils';
|
|
@@ -263,6 +264,21 @@ export class CoreApp {
|
|
|
263
264
|
formatError(error) {
|
|
264
265
|
return error.toString();
|
|
265
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* Format refresh token result
|
|
269
|
+
* @param result Refresh token result
|
|
270
|
+
* @returns Message
|
|
271
|
+
*/
|
|
272
|
+
formatRefreshTokenResult(result) {
|
|
273
|
+
// Undefined for boolean
|
|
274
|
+
if (typeof result === 'boolean')
|
|
275
|
+
return undefined;
|
|
276
|
+
return result instanceof ApiDataError
|
|
277
|
+
? this.formatError(result)
|
|
278
|
+
: typeof result !== 'string'
|
|
279
|
+
? ActionResultError.format(result)
|
|
280
|
+
: result;
|
|
281
|
+
}
|
|
266
282
|
/**
|
|
267
283
|
* Format result text
|
|
268
284
|
* @param result Action result
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -178,6 +178,13 @@ export interface ICoreApp<
|
|
|
178
178
|
timeZone?: string
|
|
179
179
|
): string | undefined;
|
|
180
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Format error
|
|
183
|
+
* @param error Error
|
|
184
|
+
* @returns Error message
|
|
185
|
+
*/
|
|
186
|
+
formatError(error: ApiDataError): string;
|
|
187
|
+
|
|
181
188
|
/**
|
|
182
189
|
* Format money number
|
|
183
190
|
* @param input Input money number
|
|
@@ -202,6 +209,13 @@ export interface ICoreApp<
|
|
|
202
209
|
options?: Intl.NumberFormatOptions
|
|
203
210
|
): string | undefined;
|
|
204
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Format refresh token result
|
|
214
|
+
* @param result Refresh token result
|
|
215
|
+
* @returns Message
|
|
216
|
+
*/
|
|
217
|
+
formatRefreshTokenResult(result: RefreshTokenResult): string | undefined;
|
|
218
|
+
|
|
205
219
|
/**
|
|
206
220
|
* Format result text
|
|
207
221
|
* @param result Action result
|
|
@@ -708,6 +722,22 @@ export abstract class CoreApp<
|
|
|
708
722
|
return error.toString();
|
|
709
723
|
}
|
|
710
724
|
|
|
725
|
+
/**
|
|
726
|
+
* Format refresh token result
|
|
727
|
+
* @param result Refresh token result
|
|
728
|
+
* @returns Message
|
|
729
|
+
*/
|
|
730
|
+
formatRefreshTokenResult(result: RefreshTokenResult) {
|
|
731
|
+
// Undefined for boolean
|
|
732
|
+
if (typeof result === 'boolean') return undefined;
|
|
733
|
+
|
|
734
|
+
return result instanceof ApiDataError
|
|
735
|
+
? this.formatError(result)
|
|
736
|
+
: typeof result !== 'string'
|
|
737
|
+
? ActionResultError.format(result)
|
|
738
|
+
: result;
|
|
739
|
+
}
|
|
740
|
+
|
|
711
741
|
/**
|
|
712
742
|
* Format result text
|
|
713
743
|
* @param result Action result
|