@etsoo/appscript 1.3.92 → 1.3.94

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.
@@ -110,9 +110,10 @@ export declare class ShoppingCart<T extends ShoppingCartItem> {
110
110
  * Create identifier key
111
111
  * 创建识别键
112
112
  * @param currency Currency
113
+ * @param key Additional key
113
114
  * @returns Result
114
115
  */
115
- static createKey(currency: string): string;
116
+ static createKey(currency: string, key?: string): string;
116
117
  /**
117
118
  * Clear shopping cart
118
119
  * 清除购物篮
@@ -197,15 +198,17 @@ export declare class ShoppingCart<T extends ShoppingCartItem> {
197
198
  * 构造函数
198
199
  * @param currency Currency ISO code
199
200
  * @param storage Data storage
201
+ * @param key Additional key
200
202
  */
201
- constructor(currency: string, storage?: IStorage);
203
+ constructor(currency: string, storage?: IStorage, key?: string);
202
204
  /**
203
205
  * Constructor
204
206
  * 构造函数
205
207
  * @param state Initialization state
206
208
  * @param storage Data storage
209
+ * @param key Additional key
207
210
  */
208
- constructor(state: ShoppingCartData<T>, storage?: IStorage);
211
+ constructor(state: ShoppingCartData<T>, storage?: IStorage, key?: string);
209
212
  private doChange;
210
213
  /**
211
214
  * Add item
@@ -11,10 +11,11 @@ class ShoppingCart {
11
11
  * Create identifier key
12
12
  * 创建识别键
13
13
  * @param currency Currency
14
+ * @param key Additional key
14
15
  * @returns Result
15
16
  */
16
- static createKey(currency) {
17
- return `ETSOO-CART-${currency}`;
17
+ static createKey(currency, key = 'KEY') {
18
+ return `ETSOO-CART-${key}-${currency}`;
18
19
  }
19
20
  /**
20
21
  * Clear shopping cart
@@ -78,9 +79,9 @@ class ShoppingCart {
78
79
  * 构造函数
79
80
  * @param currency Currency ISO code
80
81
  * @param storage Data storage
81
- * @param state Initialization state
82
+ * @param key Additional key
82
83
  */
83
- constructor(currencyOrState, storage = new shared_1.WindowStorage()) {
84
+ constructor(currencyOrState, storage = new shared_1.WindowStorage(), key) {
84
85
  var _a;
85
86
  this.storage = storage;
86
87
  /**
@@ -90,14 +91,14 @@ class ShoppingCart {
90
91
  this.prices = {};
91
92
  const isCurrency = typeof currencyOrState === 'string';
92
93
  this.currency = isCurrency ? currencyOrState : currencyOrState.currency;
93
- const key = ShoppingCart.createKey(this.currency);
94
- this.identifier = key;
94
+ const id = ShoppingCart.createKey(this.currency, key);
95
+ this.identifier = id;
95
96
  this.symbol = shared_1.NumberUtils.getCurrencySymbol(this.currency);
96
97
  let state;
97
98
  if (isCurrency) {
98
99
  try {
99
100
  state =
100
- (_a = storage.getPersistedObject(key)) !== null && _a !== void 0 ? _a : storage.getObject(key);
101
+ (_a = storage.getPersistedObject(id)) !== null && _a !== void 0 ? _a : storage.getObject(id);
101
102
  }
102
103
  catch (error) {
103
104
  console.log('ShoppingCart constructor', error);
@@ -3,11 +3,12 @@ import { DataTypes } from '@etsoo/shared';
3
3
  import { IApp } from '../app/IApp';
4
4
  import { IActionResult } from '../result/IActionResult';
5
5
  import { BaseApi } from './BaseApi';
6
- import { AuditLineDto, AuditLinePayload } from './dto/AuditLineDto';
6
+ import { AuditLinePayload } from './dto/AuditLineDto';
7
7
  import { ResultPayload } from './dto/ResultPayload';
8
8
  import { MergeRQ } from './rq/MergeRQ';
9
9
  import { QueryRQ } from './rq/QueryRQ';
10
10
  import { TiplistRQ } from './rq/TiplistRQ';
11
+ import { UpdateStatusRQ } from './rq/UpdateStatusRQ';
11
12
  /**
12
13
  * Entity API
13
14
  * Follow com.etsoo.CoreFramework.Services.EntityServiceBase
@@ -62,7 +63,7 @@ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
62
63
  * @param payload Payload
63
64
  * @returns Result
64
65
  */
65
- protected queryAuditBase<T extends DataTypes.IdType, R extends QueryRQ<T>>(rq: R, payload?: AuditLinePayload): Promise<AuditLineDto[] | undefined>;
66
+ protected queryAuditBase<T extends DataTypes.IdType, R extends QueryRQ<T>>(rq: R, payload?: AuditLinePayload): Promise<import("./dto/AuditLineDto").AuditLineDto[] | undefined>;
66
67
  /**
67
68
  * Query favored country ids
68
69
  * @returns Result
@@ -98,4 +99,11 @@ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
98
99
  * @returns Result
99
100
  */
100
101
  protected updateReadBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R>): Promise<R | undefined>;
102
+ /**
103
+ * Update status
104
+ * @param rq Request data
105
+ * @param payload Payload
106
+ * @returns Result
107
+ */
108
+ protected updateStatusBase(rq: UpdateStatusRQ, payload?: ResultPayload): Promise<IActionResult<{}> | undefined>;
101
109
  }
@@ -119,5 +119,14 @@ class EntityApi extends BaseApi_1.BaseApi {
119
119
  updateReadBase(id, payload) {
120
120
  return this.api.get(`${this.flag}/UpdateRead/${id}`, undefined, payload);
121
121
  }
122
+ /**
123
+ * Update status
124
+ * @param rq Request data
125
+ * @param payload Payload
126
+ * @returns Result
127
+ */
128
+ updateStatusBase(rq, payload) {
129
+ return this.api.put(`${this.flag}/UpdateStatus`, rq, payload);
130
+ }
122
131
  }
123
132
  exports.EntityApi = EntityApi;
@@ -0,0 +1,15 @@
1
+ import { DataTypes } from '@etsoo/shared';
2
+ import { EntityStatus } from '../../business/EntityStatus';
3
+ /**
4
+ * Update status request data
5
+ */
6
+ export type UpdateStatusRQ = {
7
+ /**
8
+ * Id
9
+ */
10
+ id: DataTypes.IdType;
11
+ /**
12
+ * New status
13
+ */
14
+ status: EntityStatus;
15
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -52,6 +52,7 @@ export * from './erp/rq/RefreshTokenRQ';
52
52
  export * from './erp/rq/RegionsRQ';
53
53
  export * from './erp/rq/ResetPasswordRQ';
54
54
  export * from './erp/rq/TiplistRQ';
55
+ export * from './erp/rq/UpdateStatusRQ';
55
56
  export * from './erp/AddressApi';
56
57
  export * from './erp/AuthApi';
57
58
  export * from './erp/BaseApi';
package/lib/cjs/index.js CHANGED
@@ -76,6 +76,7 @@ __exportStar(require("./erp/rq/RefreshTokenRQ"), exports);
76
76
  __exportStar(require("./erp/rq/RegionsRQ"), exports);
77
77
  __exportStar(require("./erp/rq/ResetPasswordRQ"), exports);
78
78
  __exportStar(require("./erp/rq/TiplistRQ"), exports);
79
+ __exportStar(require("./erp/rq/UpdateStatusRQ"), exports);
79
80
  // erp api
80
81
  __exportStar(require("./erp/AddressApi"), exports);
81
82
  __exportStar(require("./erp/AuthApi"), exports);
@@ -110,9 +110,10 @@ export declare class ShoppingCart<T extends ShoppingCartItem> {
110
110
  * Create identifier key
111
111
  * 创建识别键
112
112
  * @param currency Currency
113
+ * @param key Additional key
113
114
  * @returns Result
114
115
  */
115
- static createKey(currency: string): string;
116
+ static createKey(currency: string, key?: string): string;
116
117
  /**
117
118
  * Clear shopping cart
118
119
  * 清除购物篮
@@ -197,15 +198,17 @@ export declare class ShoppingCart<T extends ShoppingCartItem> {
197
198
  * 构造函数
198
199
  * @param currency Currency ISO code
199
200
  * @param storage Data storage
201
+ * @param key Additional key
200
202
  */
201
- constructor(currency: string, storage?: IStorage);
203
+ constructor(currency: string, storage?: IStorage, key?: string);
202
204
  /**
203
205
  * Constructor
204
206
  * 构造函数
205
207
  * @param state Initialization state
206
208
  * @param storage Data storage
209
+ * @param key Additional key
207
210
  */
208
- constructor(state: ShoppingCartData<T>, storage?: IStorage);
211
+ constructor(state: ShoppingCartData<T>, storage?: IStorage, key?: string);
209
212
  private doChange;
210
213
  /**
211
214
  * Add item
@@ -8,10 +8,11 @@ export class ShoppingCart {
8
8
  * Create identifier key
9
9
  * 创建识别键
10
10
  * @param currency Currency
11
+ * @param key Additional key
11
12
  * @returns Result
12
13
  */
13
- static createKey(currency) {
14
- return `ETSOO-CART-${currency}`;
14
+ static createKey(currency, key = 'KEY') {
15
+ return `ETSOO-CART-${key}-${currency}`;
15
16
  }
16
17
  /**
17
18
  * Clear shopping cart
@@ -75,9 +76,9 @@ export class ShoppingCart {
75
76
  * 构造函数
76
77
  * @param currency Currency ISO code
77
78
  * @param storage Data storage
78
- * @param state Initialization state
79
+ * @param key Additional key
79
80
  */
80
- constructor(currencyOrState, storage = new WindowStorage()) {
81
+ constructor(currencyOrState, storage = new WindowStorage(), key) {
81
82
  var _a;
82
83
  this.storage = storage;
83
84
  /**
@@ -87,14 +88,14 @@ export class ShoppingCart {
87
88
  this.prices = {};
88
89
  const isCurrency = typeof currencyOrState === 'string';
89
90
  this.currency = isCurrency ? currencyOrState : currencyOrState.currency;
90
- const key = ShoppingCart.createKey(this.currency);
91
- this.identifier = key;
91
+ const id = ShoppingCart.createKey(this.currency, key);
92
+ this.identifier = id;
92
93
  this.symbol = NumberUtils.getCurrencySymbol(this.currency);
93
94
  let state;
94
95
  if (isCurrency) {
95
96
  try {
96
97
  state =
97
- (_a = storage.getPersistedObject(key)) !== null && _a !== void 0 ? _a : storage.getObject(key);
98
+ (_a = storage.getPersistedObject(id)) !== null && _a !== void 0 ? _a : storage.getObject(id);
98
99
  }
99
100
  catch (error) {
100
101
  console.log('ShoppingCart constructor', error);
@@ -3,11 +3,12 @@ import { DataTypes } from '@etsoo/shared';
3
3
  import { IApp } from '../app/IApp';
4
4
  import { IActionResult } from '../result/IActionResult';
5
5
  import { BaseApi } from './BaseApi';
6
- import { AuditLineDto, AuditLinePayload } from './dto/AuditLineDto';
6
+ import { AuditLinePayload } from './dto/AuditLineDto';
7
7
  import { ResultPayload } from './dto/ResultPayload';
8
8
  import { MergeRQ } from './rq/MergeRQ';
9
9
  import { QueryRQ } from './rq/QueryRQ';
10
10
  import { TiplistRQ } from './rq/TiplistRQ';
11
+ import { UpdateStatusRQ } from './rq/UpdateStatusRQ';
11
12
  /**
12
13
  * Entity API
13
14
  * Follow com.etsoo.CoreFramework.Services.EntityServiceBase
@@ -62,7 +63,7 @@ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
62
63
  * @param payload Payload
63
64
  * @returns Result
64
65
  */
65
- protected queryAuditBase<T extends DataTypes.IdType, R extends QueryRQ<T>>(rq: R, payload?: AuditLinePayload): Promise<AuditLineDto[] | undefined>;
66
+ protected queryAuditBase<T extends DataTypes.IdType, R extends QueryRQ<T>>(rq: R, payload?: AuditLinePayload): Promise<import("./dto/AuditLineDto").AuditLineDto[] | undefined>;
66
67
  /**
67
68
  * Query favored country ids
68
69
  * @returns Result
@@ -98,4 +99,11 @@ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
98
99
  * @returns Result
99
100
  */
100
101
  protected updateReadBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R>): Promise<R | undefined>;
102
+ /**
103
+ * Update status
104
+ * @param rq Request data
105
+ * @param payload Payload
106
+ * @returns Result
107
+ */
108
+ protected updateStatusBase(rq: UpdateStatusRQ, payload?: ResultPayload): Promise<IActionResult<{}> | undefined>;
101
109
  }
@@ -116,4 +116,13 @@ export class EntityApi extends BaseApi {
116
116
  updateReadBase(id, payload) {
117
117
  return this.api.get(`${this.flag}/UpdateRead/${id}`, undefined, payload);
118
118
  }
119
+ /**
120
+ * Update status
121
+ * @param rq Request data
122
+ * @param payload Payload
123
+ * @returns Result
124
+ */
125
+ updateStatusBase(rq, payload) {
126
+ return this.api.put(`${this.flag}/UpdateStatus`, rq, payload);
127
+ }
119
128
  }
@@ -0,0 +1,15 @@
1
+ import { DataTypes } from '@etsoo/shared';
2
+ import { EntityStatus } from '../../business/EntityStatus';
3
+ /**
4
+ * Update status request data
5
+ */
6
+ export type UpdateStatusRQ = {
7
+ /**
8
+ * Id
9
+ */
10
+ id: DataTypes.IdType;
11
+ /**
12
+ * New status
13
+ */
14
+ status: EntityStatus;
15
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -52,6 +52,7 @@ export * from './erp/rq/RefreshTokenRQ';
52
52
  export * from './erp/rq/RegionsRQ';
53
53
  export * from './erp/rq/ResetPasswordRQ';
54
54
  export * from './erp/rq/TiplistRQ';
55
+ export * from './erp/rq/UpdateStatusRQ';
55
56
  export * from './erp/AddressApi';
56
57
  export * from './erp/AuthApi';
57
58
  export * from './erp/BaseApi';
package/lib/mjs/index.js CHANGED
@@ -59,6 +59,7 @@ export * from './erp/rq/RefreshTokenRQ';
59
59
  export * from './erp/rq/RegionsRQ';
60
60
  export * from './erp/rq/ResetPasswordRQ';
61
61
  export * from './erp/rq/TiplistRQ';
62
+ export * from './erp/rq/UpdateStatusRQ';
62
63
  // erp api
63
64
  export * from './erp/AddressApi';
64
65
  export * from './erp/AuthApi';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.3.92",
3
+ "version": "1.3.94",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -130,10 +130,11 @@ export class ShoppingCart<T extends ShoppingCartItem> {
130
130
  * Create identifier key
131
131
  * 创建识别键
132
132
  * @param currency Currency
133
+ * @param key Additional key
133
134
  * @returns Result
134
135
  */
135
- static createKey(currency: string) {
136
- return `ETSOO-CART-${currency}`;
136
+ static createKey(currency: string, key: string = 'KEY') {
137
+ return `ETSOO-CART-${key}-${currency}`;
137
138
  }
138
139
 
139
140
  /**
@@ -262,41 +263,44 @@ export class ShoppingCart<T extends ShoppingCartItem> {
262
263
  * 构造函数
263
264
  * @param currency Currency ISO code
264
265
  * @param storage Data storage
266
+ * @param key Additional key
265
267
  */
266
- constructor(currency: string, storage?: IStorage);
268
+ constructor(currency: string, storage?: IStorage, key?: string);
267
269
 
268
270
  /**
269
271
  * Constructor
270
272
  * 构造函数
271
273
  * @param state Initialization state
272
274
  * @param storage Data storage
275
+ * @param key Additional key
273
276
  */
274
- constructor(state: ShoppingCartData<T>, storage?: IStorage);
277
+ constructor(state: ShoppingCartData<T>, storage?: IStorage, key?: string);
275
278
 
276
279
  /**
277
280
  * Constructor
278
281
  * 构造函数
279
282
  * @param currency Currency ISO code
280
283
  * @param storage Data storage
281
- * @param state Initialization state
284
+ * @param key Additional key
282
285
  */
283
286
  constructor(
284
287
  currencyOrState: string | ShoppingCartData<T>,
285
- private readonly storage: IStorage = new WindowStorage()
288
+ private readonly storage: IStorage = new WindowStorage(),
289
+ key?: string
286
290
  ) {
287
291
  const isCurrency = typeof currencyOrState === 'string';
288
292
  this.currency = isCurrency ? currencyOrState : currencyOrState.currency;
289
293
 
290
- const key = ShoppingCart.createKey(this.currency);
291
- this.identifier = key;
294
+ const id = ShoppingCart.createKey(this.currency, key);
295
+ this.identifier = id;
292
296
  this.symbol = NumberUtils.getCurrencySymbol(this.currency);
293
297
 
294
298
  let state: ShoppingCartData<T> | undefined;
295
299
  if (isCurrency) {
296
300
  try {
297
301
  state =
298
- storage.getPersistedObject<ShoppingCartData<T>>(key) ??
299
- storage.getObject<ShoppingCartData<T>>(key);
302
+ storage.getPersistedObject<ShoppingCartData<T>>(id) ??
303
+ storage.getObject<ShoppingCartData<T>>(id);
300
304
  } catch (error) {
301
305
  console.log('ShoppingCart constructor', error);
302
306
  }
@@ -3,11 +3,12 @@ import { DataTypes } from '@etsoo/shared';
3
3
  import { IApp } from '../app/IApp';
4
4
  import { IActionResult } from '../result/IActionResult';
5
5
  import { BaseApi } from './BaseApi';
6
- import { AuditLineDto, AuditLinePayload } from './dto/AuditLineDto';
6
+ import { AuditLinePayload } from './dto/AuditLineDto';
7
7
  import { ResultPayload } from './dto/ResultPayload';
8
8
  import { MergeRQ } from './rq/MergeRQ';
9
9
  import { QueryRQ } from './rq/QueryRQ';
10
10
  import { TiplistRQ } from './rq/TiplistRQ';
11
+ import { UpdateStatusRQ } from './rq/UpdateStatusRQ';
11
12
 
12
13
  /**
13
14
  * Entity API
@@ -188,4 +189,14 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
188
189
  payload
189
190
  );
190
191
  }
192
+
193
+ /**
194
+ * Update status
195
+ * @param rq Request data
196
+ * @param payload Payload
197
+ * @returns Result
198
+ */
199
+ protected updateStatusBase(rq: UpdateStatusRQ, payload?: ResultPayload) {
200
+ return this.api.put(`${this.flag}/UpdateStatus`, rq, payload);
201
+ }
191
202
  }
@@ -0,0 +1,17 @@
1
+ import { DataTypes } from '@etsoo/shared';
2
+ import { EntityStatus } from '../../business/EntityStatus';
3
+
4
+ /**
5
+ * Update status request data
6
+ */
7
+ export type UpdateStatusRQ = {
8
+ /**
9
+ * Id
10
+ */
11
+ id: DataTypes.IdType;
12
+
13
+ /**
14
+ * New status
15
+ */
16
+ status: EntityStatus;
17
+ };
package/src/index.ts CHANGED
@@ -65,6 +65,7 @@ export * from './erp/rq/RefreshTokenRQ';
65
65
  export * from './erp/rq/RegionsRQ';
66
66
  export * from './erp/rq/ResetPasswordRQ';
67
67
  export * from './erp/rq/TiplistRQ';
68
+ export * from './erp/rq/UpdateStatusRQ';
68
69
 
69
70
  // erp api
70
71
  export * from './erp/AddressApi';