@etsoo/appscript 1.6.42 → 1.6.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.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Place location
3
+ * 地点位置
4
+ */
5
+ export type PlaceLocation = {
6
+ /**
7
+ * Latitude, 纬度
8
+ */
9
+ Lat: number;
10
+ /**
11
+ * Longitude, 经度
12
+ */
13
+ Lng: number;
14
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -50,4 +50,12 @@ export declare namespace BusinessUtils {
50
50
  * @param target Target collection to restore resources to, null to clear cache
51
51
  */
52
52
  function restoreResources(target?: DataTypes.StringRecord): void;
53
+ /**
54
+ * Setup paging keysets
55
+ * @param data Paging data
56
+ * @param lastItem Last item of the query
57
+ * @param idField Id field in data
58
+ * @param fields Fields map
59
+ */
60
+ function setupPagingKeysets<T, K extends IdType = number>(data: QueryRQ<K>, lastItem: T | undefined, idField: keyof T & string, fields?: Record<string, string | null | undefined>): QueryRQ<K>;
53
61
  }
@@ -123,4 +123,38 @@ var BusinessUtils;
123
123
  }
124
124
  }
125
125
  BusinessUtils.restoreResources = restoreResources;
126
+ /**
127
+ * Setup paging keysets
128
+ * @param data Paging data
129
+ * @param lastItem Last item of the query
130
+ * @param idField Id field in data
131
+ * @param fields Fields map
132
+ */
133
+ function setupPagingKeysets(data, lastItem, idField, fields) {
134
+ var _a;
135
+ // If the id field is not set for ordering, add it with descending
136
+ if (typeof data.queryPaging === "object") {
137
+ const orderBy = ((_a = data.queryPaging).orderBy ?? (_a.orderBy = []));
138
+ const idUpper = idField.toUpperCase();
139
+ if (!orderBy.find((o) => o.field.toUpperCase() === idUpper)) {
140
+ orderBy.push({ field: idField, desc: true, unique: true });
141
+ }
142
+ // Format order fields, like 'name' to 'Contact.Name' when 'Contact' is a reference table name in Entity Framework
143
+ if (fields) {
144
+ data.queryPaging.orderBy?.forEach((f) => {
145
+ f.field = fields[f.field] ?? f.field;
146
+ });
147
+ }
148
+ // Set the paging keysets
149
+ if (lastItem) {
150
+ const keysets = orderBy.map((o) => Reflect.get(lastItem, o.field));
151
+ data.queryPaging.keysets = keysets;
152
+ }
153
+ else {
154
+ data.queryPaging.keysets = undefined;
155
+ }
156
+ }
157
+ return data;
158
+ }
159
+ BusinessUtils.setupPagingKeysets = setupPagingKeysets;
126
160
  })(BusinessUtils || (exports.BusinessUtils = BusinessUtils = {}));
@@ -16,6 +16,7 @@ export * from "./api/dto/IdLabelDto";
16
16
  export * from "./api/dto/IdLabelPrimaryDto";
17
17
  export * from "./api/dto/InitCallDto";
18
18
  export * from "./api/dto/PinDto";
19
+ export * from "./api/dto/PlaceLocation";
19
20
  export * from "./api/dto/ResultPayload";
20
21
  export * from "./api/dto/UserIdentifierType";
21
22
  export * from "./api/rq/AdminSupportRQ";
package/lib/cjs/index.js CHANGED
@@ -35,6 +35,7 @@ __exportStar(require("./api/dto/IdLabelDto"), exports);
35
35
  __exportStar(require("./api/dto/IdLabelPrimaryDto"), exports);
36
36
  __exportStar(require("./api/dto/InitCallDto"), exports);
37
37
  __exportStar(require("./api/dto/PinDto"), exports);
38
+ __exportStar(require("./api/dto/PlaceLocation"), exports);
38
39
  __exportStar(require("./api/dto/ResultPayload"), exports);
39
40
  __exportStar(require("./api/dto/UserIdentifierType"), exports);
40
41
  __exportStar(require("./api/rq/AdminSupportRQ"), exports);
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Place location
3
+ * 地点位置
4
+ */
5
+ export type PlaceLocation = {
6
+ /**
7
+ * Latitude, 纬度
8
+ */
9
+ Lat: number;
10
+ /**
11
+ * Longitude, 经度
12
+ */
13
+ Lng: number;
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -50,4 +50,12 @@ export declare namespace BusinessUtils {
50
50
  * @param target Target collection to restore resources to, null to clear cache
51
51
  */
52
52
  function restoreResources(target?: DataTypes.StringRecord): void;
53
+ /**
54
+ * Setup paging keysets
55
+ * @param data Paging data
56
+ * @param lastItem Last item of the query
57
+ * @param idField Id field in data
58
+ * @param fields Fields map
59
+ */
60
+ function setupPagingKeysets<T, K extends IdType = number>(data: QueryRQ<K>, lastItem: T | undefined, idField: keyof T & string, fields?: Record<string, string | null | undefined>): QueryRQ<K>;
53
61
  }
@@ -120,4 +120,38 @@ export var BusinessUtils;
120
120
  }
121
121
  }
122
122
  BusinessUtils.restoreResources = restoreResources;
123
+ /**
124
+ * Setup paging keysets
125
+ * @param data Paging data
126
+ * @param lastItem Last item of the query
127
+ * @param idField Id field in data
128
+ * @param fields Fields map
129
+ */
130
+ function setupPagingKeysets(data, lastItem, idField, fields) {
131
+ var _a;
132
+ // If the id field is not set for ordering, add it with descending
133
+ if (typeof data.queryPaging === "object") {
134
+ const orderBy = ((_a = data.queryPaging).orderBy ?? (_a.orderBy = []));
135
+ const idUpper = idField.toUpperCase();
136
+ if (!orderBy.find((o) => o.field.toUpperCase() === idUpper)) {
137
+ orderBy.push({ field: idField, desc: true, unique: true });
138
+ }
139
+ // Format order fields, like 'name' to 'Contact.Name' when 'Contact' is a reference table name in Entity Framework
140
+ if (fields) {
141
+ data.queryPaging.orderBy?.forEach((f) => {
142
+ f.field = fields[f.field] ?? f.field;
143
+ });
144
+ }
145
+ // Set the paging keysets
146
+ if (lastItem) {
147
+ const keysets = orderBy.map((o) => Reflect.get(lastItem, o.field));
148
+ data.queryPaging.keysets = keysets;
149
+ }
150
+ else {
151
+ data.queryPaging.keysets = undefined;
152
+ }
153
+ }
154
+ return data;
155
+ }
156
+ BusinessUtils.setupPagingKeysets = setupPagingKeysets;
123
157
  })(BusinessUtils || (BusinessUtils = {}));
@@ -16,6 +16,7 @@ export * from "./api/dto/IdLabelDto";
16
16
  export * from "./api/dto/IdLabelPrimaryDto";
17
17
  export * from "./api/dto/InitCallDto";
18
18
  export * from "./api/dto/PinDto";
19
+ export * from "./api/dto/PlaceLocation";
19
20
  export * from "./api/dto/ResultPayload";
20
21
  export * from "./api/dto/UserIdentifierType";
21
22
  export * from "./api/rq/AdminSupportRQ";
package/lib/mjs/index.js CHANGED
@@ -18,6 +18,7 @@ export * from "./api/dto/IdLabelDto";
18
18
  export * from "./api/dto/IdLabelPrimaryDto";
19
19
  export * from "./api/dto/InitCallDto";
20
20
  export * from "./api/dto/PinDto";
21
+ export * from "./api/dto/PlaceLocation";
21
22
  export * from "./api/dto/ResultPayload";
22
23
  export * from "./api/dto/UserIdentifierType";
23
24
  export * from "./api/rq/AdminSupportRQ";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.6.42",
3
+ "version": "1.6.44",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -41,15 +41,15 @@
41
41
  "crypto-js": "^4.2.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@babel/cli": "^7.28.0",
45
- "@babel/core": "^7.28.0",
46
- "@babel/plugin-transform-runtime": "^7.28.0",
47
- "@babel/preset-env": "^7.28.0",
48
- "@babel/runtime-corejs3": "^7.28.0",
44
+ "@babel/cli": "^7.28.3",
45
+ "@babel/core": "^7.28.3",
46
+ "@babel/plugin-transform-runtime": "^7.28.3",
47
+ "@babel/preset-env": "^7.28.3",
48
+ "@babel/runtime-corejs3": "^7.28.3",
49
49
  "@types/crypto-js": "^4.2.2",
50
- "@vitejs/plugin-react": "^4.6.0",
50
+ "@vitejs/plugin-react": "^5.0.2",
51
51
  "jsdom": "^26.1.0",
52
- "typescript": "^5.8.3",
52
+ "typescript": "^5.9.2",
53
53
  "vitest": "^3.2.4"
54
54
  }
55
55
  }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Place location
3
+ * 地点位置
4
+ */
5
+ export type PlaceLocation = {
6
+ /**
7
+ * Latitude, 纬度
8
+ */
9
+ Lat: number;
10
+
11
+ /**
12
+ * Longitude, 经度
13
+ */
14
+ Lng: number;
15
+ };
@@ -142,4 +142,44 @@ export namespace BusinessUtils {
142
142
  target[key] = resourcesCache[key];
143
143
  }
144
144
  }
145
+
146
+ /**
147
+ * Setup paging keysets
148
+ * @param data Paging data
149
+ * @param lastItem Last item of the query
150
+ * @param idField Id field in data
151
+ * @param fields Fields map
152
+ */
153
+ export function setupPagingKeysets<T, K extends IdType = number>(
154
+ data: QueryRQ<K>,
155
+ lastItem: T | undefined,
156
+ idField: keyof T & string,
157
+ fields?: Record<string, string | null | undefined>
158
+ ) {
159
+ // If the id field is not set for ordering, add it with descending
160
+ if (typeof data.queryPaging === "object") {
161
+ const orderBy = (data.queryPaging.orderBy ??= []);
162
+ const idUpper = idField.toUpperCase();
163
+ if (!orderBy.find((o) => o.field.toUpperCase() === idUpper)) {
164
+ orderBy.push({ field: idField, desc: true, unique: true });
165
+ }
166
+
167
+ // Format order fields, like 'name' to 'Contact.Name' when 'Contact' is a reference table name in Entity Framework
168
+ if (fields) {
169
+ data.queryPaging.orderBy?.forEach((f) => {
170
+ f.field = fields[f.field] ?? f.field;
171
+ });
172
+ }
173
+
174
+ // Set the paging keysets
175
+ if (lastItem) {
176
+ const keysets = orderBy.map((o) => Reflect.get(lastItem, o.field));
177
+ data.queryPaging.keysets = keysets;
178
+ } else {
179
+ data.queryPaging.keysets = undefined;
180
+ }
181
+ }
182
+
183
+ return data;
184
+ }
145
185
  }
package/src/index.ts CHANGED
@@ -19,6 +19,7 @@ export * from "./api/dto/IdLabelDto";
19
19
  export * from "./api/dto/IdLabelPrimaryDto";
20
20
  export * from "./api/dto/InitCallDto";
21
21
  export * from "./api/dto/PinDto";
22
+ export * from "./api/dto/PlaceLocation";
22
23
  export * from "./api/dto/ResultPayload";
23
24
  export * from "./api/dto/UserIdentifierType";
24
25