@edgenets/utils 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +67 -4
- package/dist/array/unique.d.ts +2 -0
- package/dist/array/unique.d.ts.map +1 -0
- package/dist/array/unique.js +4 -0
- package/dist/array/unique.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -20
- package/dist/index.js.map +1 -1
- package/dist/types/logger.d.ts +2 -0
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/logger.js +2 -2
- package/dist/types/logger.js.map +1 -1
- package/dist/types/order.js +12 -15
- package/dist/types/order.js.map +1 -1
- package/dist/types/product.js +1 -2
- package/dist/types/user.js +1 -2
- package/dist/utils/generate.util.d.ts +7 -0
- package/dist/utils/generate.util.d.ts.map +1 -0
- package/dist/utils/generate.util.js +30 -0
- package/dist/utils/generate.util.js.map +1 -0
- package/dist/utils/generate.utils.d.ts +7 -0
- package/dist/utils/generate.utils.d.ts.map +1 -0
- package/dist/utils/generate.utils.js +30 -0
- package/dist/utils/generate.utils.js.map +1 -0
- package/dist/utils/logger.util.d.ts +8 -0
- package/dist/utils/logger.util.d.ts.map +1 -0
- package/dist/utils/logger.util.js +15 -0
- package/dist/utils/logger.util.js.map +1 -0
- package/dist/utils/scheduler.util.d.ts +19 -0
- package/dist/utils/scheduler.util.d.ts.map +1 -0
- package/dist/utils/scheduler.util.js +82 -0
- package/dist/utils/scheduler.util.js.map +1 -0
- package/dist/utils/string.util.d.ts +6 -0
- package/dist/utils/string.util.d.ts.map +1 -0
- package/dist/utils/string.util.js +16 -0
- package/dist/utils/string.util.js.map +1 -0
- package/dist/utils/string.utils.d.ts +6 -0
- package/dist/utils/string.utils.d.ts.map +1 -0
- package/dist/utils/string.utils.js +16 -0
- package/dist/utils/string.utils.js.map +1 -0
- package/package.json +9 -2
- package/eslint.config.js +0 -16
- package/tsconfig.json +0 -13
package/README.md
CHANGED
@@ -1,13 +1,76 @@
|
|
1
|
-
|
1
|
+
# @edgenets/utils
|
2
2
|
|
3
|
-
|
3
|
+
Edgenets utilities package containing common types and utilities.
|
4
4
|
|
5
|
-
|
5
|
+
---
|
6
6
|
|
7
|
+
用于存放各种实用工具函数、类型定义和常用的工具方法,如字符串处理、数组操作、日期格式化等。
|
8
|
+
|
9
|
+
---
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
```bash
|
14
|
+
npm install @edgenets/utils
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
### Import utilities
|
20
|
+
|
21
|
+
```typescript
|
22
|
+
import { capitalize, trim, unique, User } from "@edgenets/utils";
|
23
|
+
|
24
|
+
// 使用工具函数
|
25
|
+
console.log(capitalize("hello")); // "Hello"
|
26
|
+
console.log(trim(" hello ")); // "hello"
|
27
|
+
console.log(unique([1, 2, 2, 3])); // [1, 2, 3]
|
28
|
+
|
29
|
+
// 使用 User 类型定义
|
30
|
+
const newUser: User.Profile = {
|
31
|
+
id: 1,
|
32
|
+
name: "John Doe",
|
33
|
+
email: "john.doe@example.com",
|
34
|
+
createdAt: new Date(),
|
35
|
+
updatedAt: new Date(),
|
36
|
+
};
|
7
37
|
```
|
38
|
+
|
39
|
+
### 构建和发布
|
40
|
+
|
41
|
+
1. **构建**:运行 `npm run build`,会生成 `dist` 文件夹,包含编译后的 JavaScript 和类型定义文件。
|
42
|
+
|
43
|
+
2. **发布**:发布包到 npm,可以使用以下命令:
|
44
|
+
|
45
|
+
```bash
|
46
|
+
npm publish --access public
|
47
|
+
```
|
48
|
+
|
49
|
+
##### 包含内容
|
50
|
+
|
51
|
+
```text
|
52
|
+
@edgenets/utils
|
53
|
+
├── src
|
54
|
+
│ ├── types // 类型定义(如 User、Order 等)
|
55
|
+
│ │ ├── logger.ts
|
56
|
+
│ │ ├── product.ts
|
57
|
+
│ │ ├── order.ts
|
58
|
+
│ │ └── user.ts
|
59
|
+
│ ├── string
|
60
|
+
│ │ ├── capitalize.ts
|
61
|
+
│ │ └── trim.ts
|
62
|
+
│ ├── array
|
63
|
+
│ │ └── unique.ts
|
64
|
+
│ └── index.ts
|
65
|
+
├── package.json
|
66
|
+
├── tsconfig.json
|
67
|
+
└── README.md
|
68
|
+
```
|
69
|
+
|
70
|
+
```text
|
8
71
|
• 字符串处理函数
|
9
72
|
• 数组处理函数
|
10
73
|
• 日期处理函数
|
11
74
|
• 通用工具函数(如 debounce、throttle)
|
12
|
-
•
|
75
|
+
•
|
13
76
|
```
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unique.d.ts","sourceRoot":"","sources":["../../src/array/unique.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEvC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unique.js","sourceRoot":"","sources":["../../src/array/unique.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CAAI,GAAQ;IAChC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3B,CAAC"}
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
export * from "./types/user";
|
2
|
-
export * from "./types/product";
|
3
|
-
export * from "./types/logger";
|
4
|
-
export * from "./types/order";
|
1
|
+
export * from "./types/user.js";
|
2
|
+
export * from "./types/product.js";
|
3
|
+
export * from "./types/logger.js";
|
4
|
+
export * from "./types/order.js";
|
5
|
+
export { StringUtils } from "./utils/string.util.js";
|
6
|
+
export * from "./utils/generate.util.js";
|
7
|
+
export * from "./array/unique.js";
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,cAAc,0BAA0B,CAAC;AAGzC,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
@@ -1,21 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./types/user"), exports);
|
18
|
-
__exportStar(require("./types/product"), exports);
|
19
|
-
__exportStar(require("./types/logger"), exports);
|
20
|
-
__exportStar(require("./types/order"), exports);
|
1
|
+
// 导出类型定义
|
2
|
+
export * from "./types/user.js";
|
3
|
+
export * from "./types/product.js";
|
4
|
+
export * from "./types/logger.js";
|
5
|
+
export * from "./types/order.js";
|
6
|
+
// 导出字符串处理函数
|
7
|
+
export { StringUtils } from "./utils/string.util.js";
|
8
|
+
// 导出字符串处理函数
|
9
|
+
export * from "./utils/generate.util.js";
|
10
|
+
// 导出数组处理函数
|
11
|
+
export * from "./array/unique.js";
|
21
12
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AAEjC,YAAY;AACZ,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,YAAY;AACZ,cAAc,0BAA0B,CAAC;AAEzC,WAAW;AACX,cAAc,mBAAmB,CAAC"}
|
package/dist/types/logger.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAE9B"}
|
package/dist/types/logger.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
// src/interfaces/Logger.ts
|
2
|
+
export {};
|
3
3
|
//# sourceMappingURL=logger.js.map
|
package/dist/types/logger.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":""}
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA,2BAA2B"}
|
package/dist/types/order.js
CHANGED
@@ -1,50 +1,47 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ShippingStatus = exports.ShippingMethod = exports.RefundStatus = exports.PaymentStatus = exports.PaymentMethod = exports.OrderStatus = void 0;
|
4
1
|
// 订单状态枚举
|
5
|
-
var OrderStatus;
|
2
|
+
export var OrderStatus;
|
6
3
|
(function (OrderStatus) {
|
7
4
|
OrderStatus["Pending"] = "pending";
|
8
5
|
OrderStatus["Confirmed"] = "confirmed";
|
9
6
|
OrderStatus["Completed"] = "completed";
|
10
7
|
OrderStatus["Canceled"] = "canceled";
|
11
8
|
OrderStatus["Refunded"] = "refunded";
|
12
|
-
})(OrderStatus || (
|
9
|
+
})(OrderStatus || (OrderStatus = {}));
|
13
10
|
// 支付方式枚举
|
14
|
-
var PaymentMethod;
|
11
|
+
export var PaymentMethod;
|
15
12
|
(function (PaymentMethod) {
|
16
13
|
PaymentMethod["Online"] = "Online";
|
17
14
|
PaymentMethod["Credit"] = "Credit";
|
18
15
|
PaymentMethod["Points"] = "Points";
|
19
16
|
PaymentMethod["Crypto"] = "Crypto";
|
20
|
-
})(PaymentMethod || (
|
17
|
+
})(PaymentMethod || (PaymentMethod = {}));
|
21
18
|
// 支付状态枚举
|
22
|
-
var PaymentStatus;
|
19
|
+
export var PaymentStatus;
|
23
20
|
(function (PaymentStatus) {
|
24
21
|
PaymentStatus["Pending"] = "pending";
|
25
22
|
PaymentStatus["Paid"] = "paid";
|
26
23
|
PaymentStatus["Failed"] = "failed";
|
27
|
-
})(PaymentStatus || (
|
24
|
+
})(PaymentStatus || (PaymentStatus = {}));
|
28
25
|
// 退款状态枚举
|
29
|
-
var RefundStatus;
|
26
|
+
export var RefundStatus;
|
30
27
|
(function (RefundStatus) {
|
31
28
|
RefundStatus["Requested"] = "requested";
|
32
29
|
RefundStatus["Processing"] = "processing";
|
33
30
|
RefundStatus["Completed"] = "completed";
|
34
31
|
RefundStatus["Rejected"] = "rejected";
|
35
|
-
})(RefundStatus || (
|
32
|
+
})(RefundStatus || (RefundStatus = {}));
|
36
33
|
// 配送方式枚举
|
37
|
-
var ShippingMethod;
|
34
|
+
export var ShippingMethod;
|
38
35
|
(function (ShippingMethod) {
|
39
36
|
ShippingMethod["Standard"] = "standard";
|
40
37
|
ShippingMethod["Express"] = "express";
|
41
38
|
ShippingMethod["Pickup"] = "pickup";
|
42
|
-
})(ShippingMethod || (
|
39
|
+
})(ShippingMethod || (ShippingMethod = {}));
|
43
40
|
// 配送状态枚举
|
44
|
-
var ShippingStatus;
|
41
|
+
export var ShippingStatus;
|
45
42
|
(function (ShippingStatus) {
|
46
43
|
ShippingStatus["NotShipped"] = "not_shipped";
|
47
44
|
ShippingStatus["Shipped"] = "shipped";
|
48
45
|
ShippingStatus["Delivered"] = "delivered";
|
49
|
-
})(ShippingStatus || (
|
46
|
+
})(ShippingStatus || (ShippingStatus = {}));
|
50
47
|
//# sourceMappingURL=order.js.map
|
package/dist/types/order.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../src/types/order.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../src/types/order.ts"],"names":[],"mappings":"AAsBA,SAAS;AACT,MAAM,CAAN,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;IACvB,sCAAuB,CAAA;IACvB,oCAAqB,CAAA;IACrB,oCAAqB,CAAA;AACvB,CAAC,EANW,WAAW,KAAX,WAAW,QAMtB;AA+BD,SAAS;AACT,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;AACnB,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAED,SAAS;AACT,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,8BAAa,CAAA;IACb,kCAAiB,CAAA;AACnB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAED,SAAS;AACT,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,yCAAyB,CAAA;IACzB,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;AACvB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAoBD,SAAS;AACT,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,uCAAqB,CAAA;IACrB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;AACnB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED,SAAS;AACT,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,4CAA0B,CAAA;IAC1B,qCAAmB,CAAA;IACnB,yCAAuB,CAAA;AACzB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB"}
|
package/dist/types/product.js
CHANGED
package/dist/types/user.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"generate.util.d.ts","sourceRoot":"","sources":["../../src/utils/generate.util.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,GAAE,MAAU,GAAG,MAAM,CAqBrE"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/**
|
2
|
+
* 生成一个随机且安全的 orderNumber
|
3
|
+
* @param length - orderNumber 的位数
|
4
|
+
* @returns 生成的随机数字字符串
|
5
|
+
*/
|
6
|
+
export function generateOrderNumber(orderSequence = 0) {
|
7
|
+
const now = new Date();
|
8
|
+
// 获取年份的后两位
|
9
|
+
const year = now.getFullYear().toString().slice(-2);
|
10
|
+
// 获取今年第几天
|
11
|
+
const start = new Date(now.getFullYear(), 0, 0);
|
12
|
+
const diff = now.getTime() - start.getTime();
|
13
|
+
const dayOfYear = Math.floor(diff / (1000 * 60 * 60 * 24))
|
14
|
+
.toString()
|
15
|
+
.padStart(3, "0");
|
16
|
+
// 序列号递增,并重置为三位
|
17
|
+
if (orderSequence === 0)
|
18
|
+
orderSequence = generateRandomNumber(3);
|
19
|
+
orderSequence = (orderSequence + 1) % 1000;
|
20
|
+
const sequence = orderSequence.toString().padStart(3, "0");
|
21
|
+
// 生成 8 位的随机数,保证不重复
|
22
|
+
const randomPart = Math.random().toString().slice(2, 10); // 生成8位随机数字
|
23
|
+
return Number(`${year}${dayOfYear}${sequence}${randomPart}`);
|
24
|
+
}
|
25
|
+
function generateRandomNumber(length) {
|
26
|
+
const min = Math.pow(10, length - 1); // 最小值,例如:6位数的最小值为100000
|
27
|
+
const max = Math.pow(10, length) - 1; // 最大值,例如:6位数的最大值为999999
|
28
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
29
|
+
}
|
30
|
+
//# sourceMappingURL=generate.util.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"generate.util.js","sourceRoot":"","sources":["../../src/utils/generate.util.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,gBAAwB,CAAC;IAC3D,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,WAAW;IACX,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD,UAAU;IACV,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;IAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;SACvD,QAAQ,EAAE;SACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEpB,eAAe;IACf,IAAI,aAAa,KAAK,CAAC;QAAE,aAAa,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACjE,aAAa,GAAG,CAAC,aAAa,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;IAC3C,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAE3D,mBAAmB;IACnB,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW;IAErE,OAAO,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAc;IAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB;IAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,wBAAwB;IAC9D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AAC3D,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"generate.utils.d.ts","sourceRoot":"","sources":["../../src/utils/generate.utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,GAAE,MAAU,GAAG,MAAM,CAqBrE"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/**
|
2
|
+
* 生成一个随机且安全的 orderNumber
|
3
|
+
* @param length - orderNumber 的位数
|
4
|
+
* @returns 生成的随机数字字符串
|
5
|
+
*/
|
6
|
+
export function generateOrderNumber(orderSequence = 0) {
|
7
|
+
const now = new Date();
|
8
|
+
// 获取年份的后两位
|
9
|
+
const year = now.getFullYear().toString().slice(-2);
|
10
|
+
// 获取今年第几天
|
11
|
+
const start = new Date(now.getFullYear(), 0, 0);
|
12
|
+
const diff = now.getTime() - start.getTime();
|
13
|
+
const dayOfYear = Math.floor(diff / (1000 * 60 * 60 * 24))
|
14
|
+
.toString()
|
15
|
+
.padStart(3, "0");
|
16
|
+
// 序列号递增,并重置为三位
|
17
|
+
if (orderSequence === 0)
|
18
|
+
orderSequence = generateRandomNumber(3);
|
19
|
+
orderSequence = (orderSequence + 1) % 1000;
|
20
|
+
const sequence = orderSequence.toString().padStart(3, "0");
|
21
|
+
// 生成 8 位的随机数,保证不重复
|
22
|
+
const randomPart = Math.random().toString().slice(2, 10); // 生成8位随机数字
|
23
|
+
return Number(`${year}${dayOfYear}${sequence}${randomPart}`);
|
24
|
+
}
|
25
|
+
function generateRandomNumber(length) {
|
26
|
+
const min = Math.pow(10, length - 1); // 最小值,例如:6位数的最小值为100000
|
27
|
+
const max = Math.pow(10, length) - 1; // 最大值,例如:6位数的最大值为999999
|
28
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
29
|
+
}
|
30
|
+
//# sourceMappingURL=generate.utils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"generate.utils.js","sourceRoot":"","sources":["../../src/utils/generate.utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,gBAAwB,CAAC;IAC3D,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,WAAW;IACX,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD,UAAU;IACV,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;IAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;SACvD,QAAQ,EAAE;SACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEpB,eAAe;IACf,IAAI,aAAa,KAAK,CAAC;QAAE,aAAa,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACjE,aAAa,GAAG,CAAC,aAAa,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;IAC3C,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAE3D,mBAAmB;IACnB,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW;IAErE,OAAO,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAc;IAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB;IAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,wBAAwB;IAC9D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AAC3D,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { Logger } from "../types/logger.js";
|
2
|
+
export declare class ConsoleLogger implements Logger {
|
3
|
+
debug(message: string): void;
|
4
|
+
warn(message: string): void;
|
5
|
+
info(message: string): void;
|
6
|
+
error(message: string): void;
|
7
|
+
}
|
8
|
+
//# sourceMappingURL=logger.util.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logger.util.d.ts","sourceRoot":"","sources":["../../src/utils/logger.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,qBAAa,aAAc,YAAW,MAAM;IAC1C,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAG5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAG3B,IAAI,CAAC,OAAO,EAAE,MAAM;IAGpB,KAAK,CAAC,OAAO,EAAE,MAAM;CAGtB"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export class ConsoleLogger {
|
2
|
+
debug(message) {
|
3
|
+
console.debug(`[DEBUG] ${message}`);
|
4
|
+
}
|
5
|
+
warn(message) {
|
6
|
+
console.warn(`[WARN] ${message}`);
|
7
|
+
}
|
8
|
+
info(message) {
|
9
|
+
console.log(`[INFO] ${message}`);
|
10
|
+
}
|
11
|
+
error(message) {
|
12
|
+
console.error(`[ERROR] ${message}`);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
//# sourceMappingURL=logger.util.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logger.util.js","sourceRoot":"","sources":["../../src/utils/logger.util.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IACxB,KAAK,CAAC,OAAe;QACnB,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,CAAC,OAAe;QAClB,OAAO,CAAC,IAAI,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,CAAC,OAAe;QAClB,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;IACnC,CAAC;IACD,KAAK,CAAC,OAAe;QACnB,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC;IACtC,CAAC;CACF"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
type Task = () => Promise<boolean>;
|
2
|
+
export interface SchedulerOptions {
|
3
|
+
interval?: number;
|
4
|
+
taskTimeout?: number;
|
5
|
+
logInterval?: number;
|
6
|
+
maxRecursions: number;
|
7
|
+
maxRetries?: number;
|
8
|
+
maxTotalTime?: number;
|
9
|
+
}
|
10
|
+
export declare class Scheduler {
|
11
|
+
private tasks;
|
12
|
+
schedule(task: Task, options: SchedulerOptions): void;
|
13
|
+
private handleTaskError;
|
14
|
+
private timeout;
|
15
|
+
private delay;
|
16
|
+
cancelAll(): void;
|
17
|
+
}
|
18
|
+
export {};
|
19
|
+
//# sourceMappingURL=scheduler.util.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scheduler.util.d.ts","sourceRoot":"","sources":["../../src/utils/scheduler.util.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;AAEnC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,KAAK,CAA2D;IAEjE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI;YA0D9C,eAAe;IAmB7B,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,KAAK;IAIN,SAAS,IAAI,IAAI;CAMzB"}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
10
|
+
export class Scheduler {
|
11
|
+
constructor() {
|
12
|
+
this.tasks = new Map();
|
13
|
+
}
|
14
|
+
schedule(task, options) {
|
15
|
+
const { interval = 1000, // 默认 1000 毫秒
|
16
|
+
maxRecursions = 0, // 默认 不 迭代
|
17
|
+
maxRetries = 0, // 默认 不 重试
|
18
|
+
logInterval = 1, // 默认 完整输出 Log
|
19
|
+
taskTimeout = 30000, // 默认 单次执行时间30秒
|
20
|
+
maxTotalTime = 60000, // 默认 最大执行时间60秒
|
21
|
+
} = options || {};
|
22
|
+
let counter = 0;
|
23
|
+
let retries = 0;
|
24
|
+
const startTime = Date.now();
|
25
|
+
const executeTask = () => __awaiter(this, void 0, void 0, function* () {
|
26
|
+
try {
|
27
|
+
if (maxTotalTime && Date.now() - startTime > maxTotalTime) {
|
28
|
+
console.log("达到总的最大执行时间,停止任务。");
|
29
|
+
this.cancelAll();
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
const shouldContinue = yield Promise.race([
|
33
|
+
task(),
|
34
|
+
this.timeout(taskTimeout),
|
35
|
+
]);
|
36
|
+
counter++;
|
37
|
+
if (shouldContinue && counter < maxRecursions) {
|
38
|
+
if (counter % logInterval === 0) {
|
39
|
+
console.log(`递归执行, 第 ${counter} 次, 已执行 ${(Date.now() - startTime) / 1000} 秒`);
|
40
|
+
}
|
41
|
+
this.tasks.set(setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
42
|
+
yield executeTask();
|
43
|
+
}), interval), setTimeout(() => { }, interval));
|
44
|
+
}
|
45
|
+
else {
|
46
|
+
this.cancelAll();
|
47
|
+
}
|
48
|
+
}
|
49
|
+
catch (error) {
|
50
|
+
yield this.handleTaskError(error, retries, maxRetries, executeTask, interval);
|
51
|
+
retries++;
|
52
|
+
}
|
53
|
+
});
|
54
|
+
executeTask();
|
55
|
+
}
|
56
|
+
handleTaskError(error, retries, maxRetries, retryTask, interval) {
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
58
|
+
if (retries < maxRetries) {
|
59
|
+
console.error(`Retry attempt ${retries + 1} due to error: ${error}`);
|
60
|
+
yield this.delay(interval * (retries + 1)); // 指数退避
|
61
|
+
yield retryTask(); // 重新执行任务
|
62
|
+
}
|
63
|
+
else {
|
64
|
+
console.error("Max retries reached. Task execution stopped due to persistent errors.");
|
65
|
+
this.cancelAll();
|
66
|
+
}
|
67
|
+
});
|
68
|
+
}
|
69
|
+
timeout(ms) {
|
70
|
+
return new Promise((_, reject) => setTimeout(() => reject("Task timed out"), ms));
|
71
|
+
}
|
72
|
+
delay(ms) {
|
73
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
74
|
+
}
|
75
|
+
cancelAll() {
|
76
|
+
this.tasks.forEach((_, taskId) => {
|
77
|
+
clearTimeout(taskId);
|
78
|
+
});
|
79
|
+
this.tasks.clear();
|
80
|
+
}
|
81
|
+
}
|
82
|
+
//# sourceMappingURL=scheduler.util.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scheduler.util.js","sourceRoot":"","sources":["../../src/utils/scheduler.util.ts"],"names":[],"mappings":"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"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"string.util.d.ts","sourceRoot":"","sources":["../../src/utils/string.util.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;IAEtB,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKtC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKhC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAI9C"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export class StringUtils {
|
2
|
+
// 首字母大写
|
3
|
+
static capitalize(str) {
|
4
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
5
|
+
}
|
6
|
+
// 去除空白字符
|
7
|
+
static trim(str) {
|
8
|
+
return str.trim();
|
9
|
+
}
|
10
|
+
// 将字符串转换为数字
|
11
|
+
static toNumber(value) {
|
12
|
+
const num = Number(value);
|
13
|
+
return isNaN(num) ? null : num;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=string.util.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"string.util.js","sourceRoot":"","sources":["../../src/utils/string.util.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;IACtB,QAAQ;IACR,MAAM,CAAC,UAAU,CAAC,GAAW;QAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,SAAS;IACT,MAAM,CAAC,IAAI,CAAC,GAAW;QACrB,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAED,YAAY;IACZ,MAAM,CAAC,QAAQ,CAAC,KAAa;QAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;IACjC,CAAC;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"string.utils.d.ts","sourceRoot":"","sources":["../../src/utils/string.utils.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;IAEtB,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKtC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKhC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAI9C"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export class StringUtils {
|
2
|
+
// 首字母大写
|
3
|
+
static capitalize(str) {
|
4
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
5
|
+
}
|
6
|
+
// 去除空白字符
|
7
|
+
static trim(str) {
|
8
|
+
return str.trim();
|
9
|
+
}
|
10
|
+
// 将字符串转换为数字
|
11
|
+
static toNumber(value) {
|
12
|
+
const num = Number(value);
|
13
|
+
return isNaN(num) ? null : num;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=string.utils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"string.utils.js","sourceRoot":"","sources":["../../src/utils/string.utils.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;IACtB,QAAQ;IACR,MAAM,CAAC,UAAU,CAAC,GAAW;QAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,SAAS;IACT,MAAM,CAAC,IAAI,CAAC,GAAW;QACrB,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAED,YAAY;IACZ,MAAM,CAAC,QAAQ,CAAC,KAAa;QAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;IACjC,CAAC;CACF"}
|
package/package.json
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
{
|
2
2
|
"name": "@edgenets/utils",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.3",
|
4
4
|
"description": "Edgenets utilities package containing common types and utilities.",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/index.js",
|
7
7
|
"types": "dist/index.d.ts",
|
8
8
|
"author": "Edgenets",
|
9
|
+
"license": "MIT",
|
10
|
+
"files": [
|
11
|
+
"dist/",
|
12
|
+
"README.md",
|
13
|
+
"LICENSE"
|
14
|
+
],
|
9
15
|
"scripts": {
|
10
16
|
"build": "eslint --fix && tsc -p tsconfig.json",
|
11
|
-
"test": "
|
17
|
+
"test": "echo 'Skip Tests'",
|
18
|
+
"publish": "pnpm build && npm version patch && npm publish --access public"
|
12
19
|
}
|
13
20
|
}
|
package/eslint.config.js
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
import eslint from "@eslint/js";
|
2
|
-
import tseslint from "typescript-eslint";
|
3
|
-
import prettierConfig from "eslint-config-prettier";
|
4
|
-
|
5
|
-
export default tseslint.config({
|
6
|
-
files: ["src/**/*.ts"],
|
7
|
-
extends: [
|
8
|
-
eslint.configs.recommended,
|
9
|
-
...tseslint.configs.recommended,
|
10
|
-
prettierConfig,
|
11
|
-
],
|
12
|
-
rules: {
|
13
|
-
"@typescript-eslint/array-type": "error",
|
14
|
-
"@typescript-eslint/consistent-type-imports": "error",
|
15
|
-
},
|
16
|
-
});
|
package/tsconfig.json
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"outDir": "./dist",
|
4
|
-
"rootDir": "./src",
|
5
|
-
"sourceMap": true,
|
6
|
-
"declaration": true,
|
7
|
-
"declarationMap": true,
|
8
|
-
"strict": true
|
9
|
-
},
|
10
|
-
"compileOnSave": true,
|
11
|
-
"include": ["src/**/*"],
|
12
|
-
"exclude": ["node_modules", "dist"]
|
13
|
-
}
|