@be-link/tfs-cli-nodejs 0.0.1 → 0.0.3

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.
Files changed (84) hide show
  1. package/errors/BizError.d.ts +4 -0
  2. package/errors/BizError.js +11 -0
  3. package/errors/BizError.js.map +1 -0
  4. package/errors/FulfillError.d.ts +4 -0
  5. package/errors/FulfillError.js +11 -0
  6. package/errors/FulfillError.js.map +1 -0
  7. package/index.d.ts +4 -0
  8. package/index.js +11 -0
  9. package/index.js.map +1 -0
  10. package/package.json +1 -1
  11. package/tfs/http.d.ts +1 -0
  12. package/tfs/http.js +66 -0
  13. package/tfs/http.js.map +1 -0
  14. package/tfs/modules/baseService.d.ts +14 -0
  15. package/tfs/modules/baseService.js +32 -0
  16. package/tfs/modules/baseService.js.map +1 -0
  17. package/tfs/modules/reschedule/service.d.ts +9 -0
  18. package/tfs/modules/reschedule/service.js +22 -0
  19. package/tfs/modules/reschedule/service.js.map +1 -0
  20. package/tfs/modules/reschedule/type.d.ts +42 -0
  21. package/tfs/modules/reschedule/type.js +3 -0
  22. package/tfs/modules/reschedule/type.js.map +1 -0
  23. package/types.d.ts +21 -0
  24. package/types.js +3 -0
  25. package/types.js.map +1 -0
  26. package/utils/env.d.ts +6 -0
  27. package/utils/env.js +16 -0
  28. package/utils/env.js.map +1 -0
  29. package/utils/string.d.ts +5 -0
  30. package/utils/string.js +10 -0
  31. package/utils/string.js.map +1 -0
  32. package/.husky/commit-msg +0 -4
  33. package/.versionrc +0 -22
  34. package/CHANGELOG.md +0 -121
  35. package/Makefile +0 -2
  36. package/ci/index.ts +0 -73
  37. package/commitlint.config.js +0 -3
  38. package/docs/.nojekyll +0 -1
  39. package/docs/assets/highlight.css +0 -71
  40. package/docs/assets/main.js +0 -59
  41. package/docs/assets/navigation.js +0 -1
  42. package/docs/assets/search.js +0 -1
  43. package/docs/assets/style.css +0 -1383
  44. package/docs/classes/_internal_.RosJobService.html +0 -89
  45. package/docs/classes/_internal_.RosProcessService.html +0 -220
  46. package/docs/classes/_internal_.RosQueryService.html +0 -118
  47. package/docs/classes/_internal_.default.html +0 -72
  48. package/docs/enums/_internal_.Constants.OperatorRoleEnum.html +0 -85
  49. package/docs/enums/_internal_.Constants.RefundOrderStatusEnum.html +0 -109
  50. package/docs/index.html +0 -63
  51. package/docs/interfaces/_internal_.IApply.html +0 -147
  52. package/docs/interfaces/_internal_.IAuditReject.html +0 -92
  53. package/docs/interfaces/_internal_.ICancel.html +0 -84
  54. package/docs/interfaces/_internal_.IDoRefund.html +0 -68
  55. package/docs/interfaces/_internal_.IFirstAuditPass.html +0 -108
  56. package/docs/interfaces/_internal_.IGetOrderRequest.html +0 -68
  57. package/docs/interfaces/_internal_.IIsOrderCanBeReverse.html +0 -68
  58. package/docs/interfaces/_internal_.IJobService.html +0 -72
  59. package/docs/interfaces/_internal_.IModifyInfo.html +0 -107
  60. package/docs/interfaces/_internal_.IQueryOrdersRequest.html +0 -118
  61. package/docs/interfaces/_internal_.IReverseOrderDTO.html +0 -50
  62. package/docs/interfaces/_internal_.IReverseOrderProcessController.html +0 -196
  63. package/docs/interfaces/_internal_.IReverseOrderQueryController.html +0 -100
  64. package/docs/interfaces/_internal_.ISecondAuditPass.html +0 -92
  65. package/docs/modules/_internal_.Constants.html +0 -54
  66. package/docs/modules/_internal_.html +0 -72
  67. package/docs/modules.html +0 -52
  68. package/docs/variables/RosConstants.html +0 -45
  69. package/docs/variables/rosJobService.html +0 -42
  70. package/docs/variables/rosProcessService.html +0 -42
  71. package/docs/variables/rosQueryService.html +0 -42
  72. package/jest.config.js +0 -194
  73. package/src/errors/BizError.ts +0 -10
  74. package/src/errors/FulfillError.ts +0 -10
  75. package/src/index.ts +0 -8
  76. package/src/tfs/http.ts +0 -66
  77. package/src/tfs/modules/baseService.ts +0 -31
  78. package/src/tfs/modules/reschedule/service.ts +0 -19
  79. package/src/tfs/modules/reschedule/type.d.ts +0 -51
  80. package/src/types.ts +0 -22
  81. package/src/utils/env.ts +0 -14
  82. package/src/utils/string.ts +0 -6
  83. package/tsconfig.json +0 -114
  84. package/typedoc.json +0 -15
@@ -0,0 +1,4 @@
1
+ export default class BizError extends Error {
2
+ code: number;
3
+ constructor(message: string, code?: number);
4
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class BizError extends Error {
4
+ constructor(message, code = 400) {
5
+ super(message);
6
+ this.code = code;
7
+ this.name = 'BizError';
8
+ }
9
+ }
10
+ exports.default = BizError;
11
+ //# sourceMappingURL=BizError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BizError.js","sourceRoot":"","sources":["../../src/errors/BizError.ts"],"names":[],"mappings":";;AAAA,MAAqB,QAAS,SAAQ,KAAK;IAIzC,YAAY,OAAe,EAAE,OAAe,GAAG;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;IACxB,CAAC;CACF;AATD,2BASC"}
@@ -0,0 +1,4 @@
1
+ export default class FulfillError extends Error {
2
+ code: number;
3
+ constructor(message: string, code?: number);
4
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class FulfillError extends Error {
4
+ constructor(message, code = 500) {
5
+ super(message);
6
+ this.code = code;
7
+ this.name = 'UserError';
8
+ }
9
+ }
10
+ exports.default = FulfillError;
11
+ //# sourceMappingURL=FulfillError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FulfillError.js","sourceRoot":"","sources":["../../src/errors/FulfillError.ts"],"names":[],"mappings":";;AAAA,MAAqB,YAAa,SAAQ,KAAK;IAI7C,YAAY,OAAe,EAAE,OAAe,GAAG;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;IACzB,CAAC;CACF;AATD,+BASC"}
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import BizError from './errors/BizError';
2
+ import rescheduleService from './tfs/modules/reschedule/service';
3
+ /** 业务模块 */
4
+ export { BizError, rescheduleService, };
package/index.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.rescheduleService = exports.BizError = void 0;
7
+ const BizError_1 = __importDefault(require("./errors/BizError"));
8
+ exports.BizError = BizError_1.default;
9
+ const service_1 = __importDefault(require("./tfs/modules/reschedule/service"));
10
+ exports.rescheduleService = service_1.default;
11
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iEAAwC;AAKtC,mBALK,kBAAQ,CAKL;AAJV,+EAAgE;AAK9D,4BALK,iBAAiB,CAKL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@be-link/tfs-cli-nodejs",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "交易履约服务Nodejs客户端",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tfs/http.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function callApi<T extends (args: any) => Promise<any>>(url: string, ...request: Parameters<T>): Promise<Awaited<ReturnType<T>>>;
package/tfs/http.js ADDED
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.callApi = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const FulfillError_1 = __importDefault(require("../errors/FulfillError"));
9
+ const uuid_1 = require("uuid");
10
+ const BizError_1 = __importDefault(require("../errors/BizError"));
11
+ async function callApi(url, ...request) {
12
+ const requestId = (0, uuid_1.v4)();
13
+ const maxRetries = 3; // 最大重试次数
14
+ let retries = 0;
15
+ let errorInfo = null;
16
+ while (retries < maxRetries) {
17
+ try {
18
+ console.info(`准备发起TFS请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
19
+ const response = await axios_1.default.post(url, request[0], {
20
+ headers: {
21
+ 'X-Request-Id': requestId,
22
+ 'x-belink-accessType': 'authorizationTokenInside',
23
+ 'x-belink-authorization': process.env.authorizationTokenInside || ""
24
+ },
25
+ timeout: 60000, // 设置超时时间为 60 秒
26
+ });
27
+ const responseData = response.data;
28
+ return responseData.data;
29
+ }
30
+ catch (error) {
31
+ console.error(`TFS请求失败[${requestId}]: ${error.message}`);
32
+ errorInfo = error;
33
+ const axiosError = error;
34
+ const ErrorClass = axiosError.response
35
+ ? axiosError.response.status === 400
36
+ ? BizError_1.default
37
+ : FulfillError_1.default
38
+ : FulfillError_1.default;
39
+ if (axiosError.response) {
40
+ const response = axiosError.response;
41
+ const data = response.data;
42
+ console.error(`TFS 异常: ${axiosError.message},requestId: ${requestId}`);
43
+ console.info('响应信息', data.message);
44
+ console.info('响应信息Data', JSON.stringify(data));
45
+ console.error('异常堆栈', JSON.stringify(error.stack));
46
+ if (axiosError.response.status !== 502) {
47
+ throw new ErrorClass(data.message || 'TFS Error', response.status);
48
+ }
49
+ if (retries === maxRetries) {
50
+ throw new ErrorClass(data.message || 'TFS Error', response.status);
51
+ }
52
+ }
53
+ console.error(`TFS 未知异常: ${axiosError.message}`, error.stack);
54
+ if (retries === maxRetries) {
55
+ throw error;
56
+ }
57
+ retries++;
58
+ // 进行重试
59
+ await new Promise(resolve => setTimeout(resolve, 1000)); // 延时 1 秒再重试
60
+ }
61
+ }
62
+ // 如果重试次数达到上限,抛出错误
63
+ throw new Error(errorInfo);
64
+ }
65
+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;SACrE;KACF;IAED,kBAAkB;IAClB,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAA;AAC5B,CAAC;AAxDD,0BAwDC"}
@@ -0,0 +1,14 @@
1
+ export default abstract class BaseService {
2
+ private isPublicEnv;
3
+ /** URL一级路径 */
4
+ protected abstract prefixUrl: string;
5
+ /** 子网域名 */
6
+ protected readonly natDevHost = "http://qgostaxv.tfs.nmkh74o4.rlwzae9d.com:8090";
7
+ protected readonly natProdHost = "";
8
+ /** 公网域名 */
9
+ protected readonly publicDevHost = "https://tfs-74680-5-1304510571.sh.run.tcloudbase.com";
10
+ protected readonly publicProdHost = "";
11
+ constructor();
12
+ /** 获取API URL */
13
+ protected getApiUrl(func: Function): string;
14
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const env_1 = __importDefault(require("../../utils/env"));
7
+ const string_1 = require("../../utils/string");
8
+ class BaseService {
9
+ constructor() {
10
+ /** 子网域名 */
11
+ this.natDevHost = 'http://qgostaxv.tfs.nmkh74o4.rlwzae9d.com:8090';
12
+ this.natProdHost = '';
13
+ /** 公网域名 */
14
+ this.publicDevHost = 'https://tfs-74680-5-1304510571.sh.run.tcloudbase.com';
15
+ this.publicProdHost = '';
16
+ /** 如果是云函数环境, 默认走公网访问 */
17
+ this.isPublicEnv = (process.env.CONTAINER_ENV || 'SCF') === 'SCF';
18
+ }
19
+ /** 获取API URL */
20
+ getApiUrl(func) {
21
+ const host = this.isPublicEnv
22
+ ? env_1.default.isProduction()
23
+ ? this.publicProdHost
24
+ : this.publicDevHost
25
+ : env_1.default.isProduction()
26
+ ? this.natProdHost
27
+ : this.natDevHost;
28
+ return `${host}${this.prefixUrl}/${(0, string_1.camelToKebabCase)(func.name)}`;
29
+ }
30
+ }
31
+ exports.default = BaseService;
32
+ //# sourceMappingURL=baseService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseService.js","sourceRoot":"","sources":["../../../src/tfs/modules/baseService.ts"],"names":[],"mappings":";;;;;AAAA,0DAAsC;AACtC,+CAAqD;AAErD,MAA8B,WAAW;IAWvC;QAPA,WAAW;QACQ,eAAU,GAAG,gDAAgD,CAAA;QAC7D,gBAAW,GAAG,EAAE,CAAA;QACnC,WAAW;QACQ,kBAAa,GAAG,sDAAsD,CAAA;QACtE,mBAAc,GAAG,EAAE,CAAA;QAGpC,wBAAwB;QACxB,IAAI,CAAC,WAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,KAAK,CAAC,KAAK,KAAK,CAAA;IACnE,CAAC;IAED,gBAAgB;IACN,SAAS,CAAC,IAAc;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW;YAC3B,CAAC,CAAC,aAAQ,CAAC,YAAY,EAAE;gBACvB,CAAC,CAAC,IAAI,CAAC,cAAc;gBACrB,CAAC,CAAC,IAAI,CAAC,aAAa;YACtB,CAAC,CAAC,aAAQ,CAAC,YAAY,EAAE;gBACvB,CAAC,CAAC,IAAI,CAAC,WAAW;gBAClB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAA;QACrB,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,SAAS,IAAI,IAAA,yBAAgB,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;IAClE,CAAC;CACF;AA3BD,8BA2BC"}
@@ -0,0 +1,9 @@
1
+ import BaseService from '../baseService';
2
+ import { Reschedule } from './type';
3
+ declare class RescheduleService extends BaseService implements Reschedule.Controller {
4
+ protected prefixUrl: string;
5
+ rescheduleOrder(request: Reschedule.Request.IRescheduleOrder): Promise<void>;
6
+ isOrderCanReschedule(request: Reschedule.Request.IIsOrderCanReschedule): Promise<Reschedule.Response.IIsOrderCanReschedule>;
7
+ }
8
+ declare const rescheduleService: RescheduleService;
9
+ export default rescheduleService;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const http_1 = require("../../http");
7
+ const baseService_1 = __importDefault(require("../baseService"));
8
+ class RescheduleService extends baseService_1.default {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.prefixUrl = '/reschedule';
12
+ }
13
+ rescheduleOrder(request) {
14
+ return (0, http_1.callApi)(this.getApiUrl(this.rescheduleOrder), request);
15
+ }
16
+ isOrderCanReschedule(request) {
17
+ return (0, http_1.callApi)(this.getApiUrl(this.isOrderCanReschedule), request);
18
+ }
19
+ }
20
+ const rescheduleService = new RescheduleService();
21
+ exports.default = rescheduleService;
22
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../src/tfs/modules/reschedule/service.ts"],"names":[],"mappings":";;;;;AAAA,qCAAoC;AACpC,iEAAwC;AAGxC,MAAM,iBAAkB,SAAQ,qBAAW;IAA3C;;QACY,cAAS,GAAW,aAAa,CAAA;IAS7C,CAAC;IAPC,eAAe,CAAC,OAA4C;QAC1D,OAAO,IAAA,cAAO,EAA2C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,CAAA;IACzG,CAAC;IACD,oBAAoB,CAAC,OAAiD;QACpE,OAAO,IAAA,cAAO,EAAgD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAA;IACnH,CAAC;CAEF;AAED,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAA;AAEjD,kBAAe,iBAAiB,CAAA"}
@@ -0,0 +1,42 @@
1
+ export declare namespace Reschedule {
2
+ namespace Request {
3
+ interface IRescheduleOrder {
4
+ /** 订单号 */
5
+ orderId: string;
6
+ /** 目标SkuId */
7
+ targetSkuId: string;
8
+ /** 原因类型 */
9
+ reasonType: string;
10
+ /** 原因描述 */
11
+ reasonDesc: string;
12
+ /** 操作人姓名 */
13
+ operatorName: string;
14
+ /** 附件列表 */
15
+ attachment: string[];
16
+ }
17
+ interface IIsOrderCanReschedule {
18
+ /** 订单号 */
19
+ orderId: string;
20
+ /** 目标SkuId */
21
+ targetSkuId: string;
22
+ /** 原因类型 */
23
+ reasonType: string;
24
+ /** 原因描述 */
25
+ reasonDesc: string;
26
+ }
27
+ }
28
+ namespace Response {
29
+ interface IIsOrderCanReschedule {
30
+ /** 是否允许改期 */
31
+ isCanReschedule: boolean;
32
+ }
33
+ }
34
+ namespace DTO {
35
+ }
36
+ interface Controller {
37
+ /** 更改订单出行日期 */
38
+ rescheduleOrder(request: Request.IRescheduleOrder): Promise<void>;
39
+ /** 校验订单是否允许改期 */
40
+ isOrderCanReschedule(request: Request.IIsOrderCanReschedule): Promise<Response.IIsOrderCanReschedule>;
41
+ }
42
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../src/tfs/modules/reschedule/type.ts"],"names":[],"mappings":""}
package/types.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ export declare namespace Fulfill {
2
+ /**
3
+ * 常量类型
4
+ */
5
+ namespace Constants {
6
+ /**
7
+ * 流水类型
8
+ * @enum
9
+ */
10
+ const enum OperationEnum {
11
+ /**
12
+ * 增加
13
+ */
14
+ ADD = "ADD",
15
+ /**
16
+ * 扣减
17
+ */
18
+ SUBTRACT = "SUBTRACT"
19
+ }
20
+ }
21
+ }
package/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/utils/env.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ declare const envUtils: {
2
+ isProduction(): boolean;
3
+ isDevelopment(): boolean;
4
+ isPPE(): boolean;
5
+ };
6
+ export default envUtils;
package/utils/env.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const envUtils = {
4
+ // 环境判断
5
+ isProduction() {
6
+ return process.env.NODE_ENV === 'prod';
7
+ },
8
+ isDevelopment() {
9
+ return process.env.NODE_ENV === 'development';
10
+ },
11
+ isPPE() {
12
+ return process.env.NODE_ENV === 'ppe';
13
+ }
14
+ };
15
+ exports.default = envUtils;
16
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/utils/env.ts"],"names":[],"mappings":";;AAAA,MAAM,QAAQ,GAAG;IACf,OAAO;IACP,YAAY;QACV,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAA;IACxC,CAAC;IACD,aAAa;QACX,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAA;IAC/C,CAAC;IACD,KAAK;QACH,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,KAAK,CAAA;IACvC,CAAC;CACF,CAAA;AAED,kBAAe,QAAQ,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Camel case to kebab case
3
+ * e.g. camelToKebabCase('camelCase') => 'camel-case'
4
+ */
5
+ export declare const camelToKebabCase: (str: string) => string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.camelToKebabCase = void 0;
4
+ /**
5
+ * Camel case to kebab case
6
+ * e.g. camelToKebabCase('camelCase') => 'camel-case'
7
+ */
8
+ const camelToKebabCase = (str) => str.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);
9
+ exports.camelToKebabCase = camelToKebabCase;
10
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":";;;AACA;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAA/F,QAAA,gBAAgB,oBAA+E"}
package/.husky/commit-msg DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npx --no -- commitlint --edit "$1"
package/.versionrc DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "header":"# 更新日志 \n\n",
3
- "types": [
4
- {"type": "feat", "section": "✨ Features | 新功能"},
5
- {"type": "fix", "section": "🐛 Bug Fixes | Bug 修复"},
6
- {"type": "perf", "section":"⚡ Performance Improvements | 性能优化"},
7
- {"type": "revert", "section":"⏪ Reverts | 回退"},
8
- {"type": "chore", "section":"📦 Chores | 其他更新"},
9
- {"type": "docs", "section":"📝 Documentation | 文档"},
10
- {"type": "style", "section":"💄 Styles | 风格", "hidden": true},
11
- {"type": "refactor", "section":"♻ Code Refactoring | 代码重构"},
12
- {"type": "test", "section":"✅ Tests | 测试"},
13
- {"type": "build", "section":"👷‍ Build System | 构建"},
14
- {"type": "ci", "section":"🔧 Continuous Integration | CI 配置"}
15
- ],
16
- "skip": {
17
- "bump": false,
18
- "changelog": false,
19
- "commit": false,
20
- "tag": false
21
- }
22
- }
package/CHANGELOG.md DELETED
@@ -1,121 +0,0 @@
1
- # 更新日志
2
-
3
-
4
- ### 1.1.2 (2024-04-26)
5
-
6
-
7
- ### 📦 Chores | 其他更新
8
-
9
- * **release:** 1.0.0 ([548598d](https://github.com/snowmountain-top/user-cli-nodejs/commit/548598d2d4b770e072cd58a30eed184a900aa4dc))
10
- * **release:** 1.0.1 ([a95dfd3](https://github.com/snowmountain-top/user-cli-nodejs/commit/a95dfd3c29150a3742976ca23f70774e638f18c0))
11
- * **release:** 1.0.104 ([bb37982](https://github.com/snowmountain-top/user-cli-nodejs/commit/bb379820cdb7a1fec6cc29de88becf818d1ffee3))
12
- * **release:** 1.0.2 ([6f0f30e](https://github.com/snowmountain-top/user-cli-nodejs/commit/6f0f30e4dc22820628bd21042b9267dfc4980e0c))
13
- * **release:** 1.1.0 ([3ca5e48](https://github.com/snowmountain-top/user-cli-nodejs/commit/3ca5e489cbb66b4f10b65f9b43815f78186d3823))
14
- * **release:** 1.1.1 ([5f72247](https://github.com/snowmountain-top/user-cli-nodejs/commit/5f72247f75ba938aa6e51791b80cbbdbf4c4a046))
15
-
16
- ### [1.1.1](https://github.com/snowmountain-top/user-cli-nodejs/compare/v1.1.0...v1.1.1) (2024-04-26)
17
-
18
- ## [1.1.0](https://github.com/snowmountain-top/user-cli-nodejs/compare/v1.0.104...v1.1.0) (2024-04-26)
19
-
20
- ### [1.0.104](https://github.com/snowmountain-top/user-cli-nodejs/compare/v1.0.16...v1.0.104) (2024-04-26)
21
-
22
- ### [1.0.2](https://github.com/snowmountain-top/user-cli-nodejs/compare/v1.0.1...v1.0.2) (2024-02-05)
23
-
24
- ### [1.0.1](https://github.com/snowmountain-top/user-cli-nodejs/compare/v1.0.0...v1.0.1) (2024-02-05)
25
-
26
- ## 1.0.0 (2024-02-05)
27
-
28
- ### [0.0.64](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.63...v0.0.64) (2024-01-17)
29
-
30
- ### [0.0.63](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.62...v0.0.63) (2024-01-17)
31
-
32
- ### [0.0.62](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.61...v0.0.62) (2024-01-17)
33
-
34
- ### [0.0.59](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.58...v0.0.59) (2024-01-17)
35
-
36
- ### [0.0.58](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.57...v0.0.58) (2024-01-03)
37
-
38
- ### [0.0.57](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.56...v0.0.57) (2023-12-14)
39
-
40
- ### [0.0.56](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.56-beta.0...v0.0.56) (2023-12-14)
41
-
42
- ### [0.0.56-beta.0](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.55...v0.0.56-beta.0) (2023-12-12)
43
-
44
- ### [0.0.55](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.54...v0.0.55) (2023-12-12)
45
-
46
- ### [0.0.54](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.54-beta.3...v0.0.54) (2023-12-12)
47
-
48
- ### [0.0.54-beta.3](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.54-beta.2...v0.0.54-beta.3) (2023-12-12)
49
-
50
- ### [0.0.54-beta.2](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.54-beta.1...v0.0.54-beta.2) (2023-12-12)
51
-
52
- ### [0.0.54-beta.1](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.54-beta.0...v0.0.54-beta.1) (2023-12-12)
53
-
54
- ### [0.0.54-beta.0](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.53...v0.0.54-beta.0) (2023-12-12)
55
-
56
- ### [0.0.53](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.52...v0.0.53) (2023-12-12)
57
-
58
- ### [0.0.52](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.48...v0.0.52) (2023-12-12)
59
-
60
-
61
- ### ✨ Features | 新功能
62
-
63
- * 自定义异常 ([cb99133](https://github.com/snowmountain-top/ros-cli-nodejs/commit/cb991332f9e6cc7301d4f1e5c0d927c9e8da4b37))
64
-
65
-
66
- ### 📦 Chores | 其他更新
67
-
68
- * **release:** 0.0.48 ([42f46cd](https://github.com/snowmountain-top/ros-cli-nodejs/commit/42f46cd7ee40552fa4a78499e42de529601ed776))
69
- * **release:** 0.0.51 ([2ff9e45](https://github.com/snowmountain-top/ros-cli-nodejs/commit/2ff9e458a75a355a53a883af826d0b5b1797b531))
70
-
71
- ### [0.0.51](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.50...v0.0.51) (2023-12-01)
72
-
73
- ### [0.0.48](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.45-beta.0...v0.0.48) (2023-11-28)
74
-
75
-
76
- ### 📝 Documentation | 文档
77
-
78
- * 删除 versionrc.js config 文件 ([ea655be](https://github.com/snowmountain-top/ros-cli-nodejs/commit/ea655be5d8cc349fe19a37af1d3615b2f8dbbf9e))
79
-
80
-
81
- ### 📦 Chores | 其他更新
82
-
83
- * **release:** 0.0.48 ([07315b2](https://github.com/snowmountain-top/ros-cli-nodejs/commit/07315b203792c54a271514526f37fe8769781ee8))
84
-
85
-
86
- ### ✨ Features | 新功能
87
-
88
- * 自定义异常 ([cb99133](https://github.com/snowmountain-top/ros-cli-nodejs/commit/cb991332f9e6cc7301d4f1e5c0d927c9e8da4b37))
89
-
90
- ### [0.0.48](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.47...v0.0.48) (2023-11-28)
91
-
92
- ### [0.0.45-beta.0](https://github.com/snowmountain-top/ros-cli-nodejs/compare/v0.0.42-beta.0...v0.0.45-beta.0) (2023-11-27)
93
-
94
-
95
- ### 📦 Chores | 其他更新
96
-
97
- * **release:** 0.0.41 ([ff9b1ab](https://github.com/snowmountain-top/ros-cli-nodejs/commit/ff9b1ab960a9a156e8f0fe56be0550155f6b2b8d))
98
- * **release:** 0.0.42 ([447efd2](https://github.com/snowmountain-top/ros-cli-nodejs/commit/447efd2faf01bfb32370aaec9f5c332139a5dcdb))
99
- * **release:** 0.0.43 ([9d36971](https://github.com/snowmountain-top/ros-cli-nodejs/commit/9d3697157f9155a8724ebd06ed14189cbc8cf7b4))
100
- * **release:** 0.0.44 ([d4bf6e6](https://github.com/snowmountain-top/ros-cli-nodejs/commit/d4bf6e6bcba033b4bb2dcc6249a512d230c523b2))
101
-
102
-
103
- ### ✨ Features | 新功能
104
-
105
- * 酒店退份数时指定扣减房间数量 ([6a3e0e3](https://github.com/snowmountain-top/ros-cli-nodejs/commit/6a3e0e33d3dbd08120825c07f5dcb0dd495ba026))
106
- * 酒店退份数时指定扣减房间数量 ([450b176](https://github.com/snowmountain-top/ros-cli-nodejs/commit/450b17675c8c955ddb689552d7736be751df67fa))
107
- * 添加changlog ([97304e0](https://github.com/snowmountain-top/ros-cli-nodejs/commit/97304e0744b45f3a9d2d45d67460df9b1af82a0e))
108
- * 添加changlog ([db1d1d9](https://github.com/snowmountain-top/ros-cli-nodejs/commit/db1d1d9d305e72f5bf9fcadf2571df4948d8da7c))
109
-
110
-
111
- ### 📝 Documentation | 文档
112
-
113
- * update package.json ([868bfa4](https://github.com/snowmountain-top/ros-cli-nodejs/commit/868bfa4b216612c72afd1fed4f815d3300c4a141))
114
-
115
-
116
- ### 👷‍ Build System | 构建
117
-
118
- * 添加 publish 发布自动化流程 ([95699f6](https://github.com/snowmountain-top/ros-cli-nodejs/commit/95699f65370b6e1f01beec4d31e867d71952c685))
119
- * 添加 publish 发布自动化流程 ([6c69f7a](https://github.com/snowmountain-top/ros-cli-nodejs/commit/6c69f7a19ef7e14a3c68004766c23ebd107fbb6e))
120
-
121
- # 更新日志
package/Makefile DELETED
@@ -1,2 +0,0 @@
1
- publish:
2
- npm run build && cd dist && npm publish && cd ..
package/ci/index.ts DELETED
@@ -1,73 +0,0 @@
1
- import * as fs from 'fs'
2
- import * as path from 'path'
3
- import inquirer from 'inquirer'
4
- import { spawn } from 'child_process'
5
-
6
- let content = fs.readFileSync(path.resolve(__dirname, '../package.json'), { encoding: 'utf-8' })
7
- const packageContent = JSON.parse(content as string)
8
- const version = packageContent.version;
9
- const reg = /([0-9])\.([0-9])\.([0-9]+)(?:(\-\w*)\.([0-9]+))?/g;
10
- const execs: any[] = reg.exec(version) as Array<any>;
11
- console.log("当前 version: ", version)
12
- const addOne = (num: string) => Number(num) + 1;
13
- const getVersion = ([major, minor, patch]: Array<string| number>) => `${major}.${minor}.${patch}`
14
-
15
- const getVersionLists = () => ([
16
- //major
17
- {
18
- name: 'major version update: ' + getVersion([addOne(execs[1]), 0, 0]),
19
- value: 'major',
20
- },
21
- // minor
22
- {
23
- name: 'minor version update: ' + getVersion([execs[1], addOne(execs[2]), execs[3]]),
24
- value: 'minor'
25
- },
26
- // patch
27
- {
28
- name: 'patch version update: ' + getVersion([execs[1], execs[2], addOne(execs[3])]),
29
- value: 'patch'
30
- },
31
- // beta
32
- {
33
- name: 'beta version update: ' + getVersion([execs[1], execs[2], addOne(execs[3])]) + `-beta.${addOne(execs[5] || -1)}`,
34
- value: 'beta'
35
- }
36
- ])
37
-
38
-
39
- const onSelectVersion = async () => {
40
- const versions = getVersionLists();
41
- inquirer.prompt([
42
- {
43
- name: 'mode',
44
- type: 'list',
45
- message: '请选择需要发布的版本',
46
- choices: versions,
47
- default: [version[0]]
48
- }
49
- ]).then(result => {
50
- // 更新版本号
51
- // const standardVersion = path.resolve(__dirname, '../node_modules/.bin/standard-version')
52
- const script = `npm run update:${result.mode} && npm run build && cd dist && npm publish && cd ..`
53
- runScript(script)
54
- })
55
- }
56
- onSelectVersion()
57
-
58
- function runScript(script: string) {
59
- if(!script) return
60
-
61
- const childProcess = spawn(script,{
62
- shell: true
63
- });
64
-
65
- childProcess.stderr.on('data', chunk=>{
66
- console.log("stderr data", chunk.toString())
67
- })
68
-
69
- childProcess.stdout.on('data', chunk=>{
70
- console.log(chunk.toString())
71
- })
72
-
73
- }
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: ['@commitlint/config-conventional']
3
- }
package/docs/.nojekyll DELETED
@@ -1 +0,0 @@
1
- TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.