From ac890dcc5cf7008dafaaa67ca4309b6249474546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=9F=91=E8=9E=82?= Date: Mon, 6 Jul 2026 19:34:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9Elicense?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecom-dmb-backend/pom.xml | 6 + .../migration/V20260528__sys_license_init.sql | 30 + ecom-dmb-backend/sql/sys_design.sql | 38 + .../common/config/SecurityConfig.java | 1 + .../exception/GlobalExceptionHandler.java | 10 + .../impl/ImportTaskProcessorServiceImpl.java | 8 +- .../service/impl/ImportTaskServiceImpl.java | 10 +- .../order/controller/OrderController.java | 4 + .../order/service/impl/OrderServiceImpl.java | 23 +- .../modules/license/LicenseAspect.java | 41 + .../modules/license/LicenseAutoConfig.java | 12 + .../modules/license/LicenseEnforcement.java | 41 + .../modules/license/LicenseException.java | 33 + .../modules/license/LicenseFeature.java | 22 + .../modules/license/LicenseFeatureGuard.java | 23 + .../modules/license/LicenseInfo.java | 42 + .../modules/license/LicenseProperties.java | 30 + .../modules/license/LicenseRequired.java | 17 + .../modules/license/LicenseValidator.java | 366 ++ .../license/MachineFingerprintUtil.java | 82 + .../license/RequiresOrderCreateLicense.java | 15 + .../license/controller/InitController.java | 66 + .../controller/SystemLicenseController.java | 49 + .../modules/license/mapper/SysInitMapper.java | 9 + .../license/mapper/SysLicenseMapper.java | 9 + .../license/model/dto/ActivateLicenseDTO.java | 14 + .../license/model/dto/InitAdminDTO.java | 22 + .../license/model/dto/InitCompanyDTO.java | 18 + .../modules/license/model/po/SysInitPO.java | 30 + .../license/model/po/SysLicensePO.java | 44 + .../license/model/vo/FingerprintVO.java | 16 + .../license/model/vo/InitStatusVO.java | 18 + .../license/model/vo/LicenseSummaryVO.java | 24 + .../license/service/InitializeService.java | 213 + .../api/controller/OpenOrderController.java | 2 + .../src/main/resources/application.yml | 10 + .../web-antd/src/api/system/license/apis.ts | 42 + .../web-antd/src/api/system/license/index.ts | 2 + .../src/api/system/license/types/index.ts | 2 + .../src/api/system/license/types/types.dto.ts | 21 + .../src/api/system/license/types/types.vo.ts | 32 + .../apps/web-antd/src/router/guard.ts | 42 +- .../apps/web-antd/src/router/routes/core.ts | 14 + .../apps/web-antd/src/router/routes/index.ts | 4 +- .../src/router/routes/modules/system.ts | 10 + .../web-antd/src/views/init/InitStepAdmin.vue | 85 + .../src/views/init/InitStepCompany.vue | 77 + .../src/views/init/InitStepLicense.vue | 103 + .../web-antd/src/views/init/InitWizard.vue | 91 + .../init/components/FingerprintDisplay.vue | 56 + .../views/system/license/FingerprintInfo.vue | 46 + .../src/views/system/license/LicenseInfo.vue | 160 + ecom-license/.gitignore | 23 + ecom-license/.npmrc | 2 + ecom-license/1.md | 434 ++ ecom-license/DESIGN.md | 1579 +------ ecom-license/DESIGN.reference.md | 318 ++ ecom-license/README.md | 58 + ecom-license/cli/README.md | 393 ++ ecom-license/cli/package.json | 32 + ecom-license/cli/pnpm-lock.yaml | 959 ++++ ecom-license/cli/src/api/client.ts | 95 + ecom-license/cli/src/commands/customer.ts | 104 + ecom-license/cli/src/commands/license.ts | 257 ++ ecom-license/cli/src/commands/login.ts | 63 + ecom-license/cli/src/commands/logout.ts | 7 + ecom-license/cli/src/commands/stats.ts | 35 + ecom-license/cli/src/commands/whoami.ts | 39 + ecom-license/cli/src/config.ts | 53 + ecom-license/cli/src/context.ts | 30 + ecom-license/cli/src/index.ts | 118 + ecom-license/cli/src/ui/render.ts | 100 + ecom-license/cli/tsconfig.json | 14 + ecom-license/server/.env.example | 10 + ecom-license/server/.npmrc | 2 + ecom-license/server/keys/.gitignore | 2 + ecom-license/server/keys/.gitkeep | 0 ecom-license/server/nest-cli.json | 9 + ecom-license/server/package.json | 47 + ecom-license/server/pnpm-lock.yaml | 3967 +++++++++++++++++ ecom-license/server/sql/schema.sql | 76 + ecom-license/server/src/app.module.ts | 37 + .../server/src/common/admin-seed.service.ts | 27 + .../server/src/common/jwt-signer.service.ts | 62 + .../src/entities/lc-activation-log.entity.ts | 33 + .../server/src/entities/lc-admin.entity.ts | 31 + .../server/src/entities/lc-customer.entity.ts | 45 + .../server/src/entities/lc-license.entity.ts | 62 + .../server/src/entities/lc-oper-log.entity.ts | 33 + ecom-license/server/src/main.ts | 17 + .../src/modules/auth/auth.controller.ts | 18 + .../server/src/modules/auth/auth.dto.ts | 11 + .../server/src/modules/auth/auth.module.ts | 23 + .../server/src/modules/auth/auth.service.ts | 38 + .../server/src/modules/auth/jwt-auth.guard.ts | 5 + .../server/src/modules/auth/jwt.strategy.ts | 26 + .../modules/customer/customer.controller.ts | 55 + .../src/modules/customer/customer.dto.ts | 68 + .../src/modules/customer/customer.module.ts | 17 + .../src/modules/customer/customer.service.ts | 67 + .../modules/dashboard/dashboard.controller.ts | 14 + .../src/modules/dashboard/dashboard.module.ts | 13 + .../modules/dashboard/dashboard.service.ts | 41 + .../src/modules/license/license.controller.ts | 59 + .../server/src/modules/license/license.dto.ts | 58 + .../src/modules/license/license.module.ts | 18 + .../src/modules/license/license.service.ts | 123 + ecom-license/server/tsconfig.build.json | 4 + ecom-license/server/tsconfig.json | 23 + ecom-license/tsconfig.json | 7 + 110 files changed, 10678 insertions(+), 1368 deletions(-) create mode 100644 ecom-dmb-backend/sql/migration/V20260528__sys_license_init.sql create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseAspect.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseAutoConfig.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseEnforcement.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseException.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseFeature.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseFeatureGuard.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseInfo.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseProperties.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseRequired.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseValidator.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/MachineFingerprintUtil.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/RequiresOrderCreateLicense.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/controller/InitController.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/controller/SystemLicenseController.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/mapper/SysInitMapper.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/mapper/SysLicenseMapper.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/ActivateLicenseDTO.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/InitAdminDTO.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/InitCompanyDTO.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/po/SysInitPO.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/po/SysLicensePO.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/FingerprintVO.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/InitStatusVO.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/LicenseSummaryVO.java create mode 100644 ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/service/InitializeService.java create mode 100644 ecom-dmb-frontend/apps/web-antd/src/api/system/license/apis.ts create mode 100644 ecom-dmb-frontend/apps/web-antd/src/api/system/license/index.ts create mode 100644 ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/index.ts create mode 100644 ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/types.dto.ts create mode 100644 ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/types.vo.ts create mode 100644 ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepAdmin.vue create mode 100644 ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepCompany.vue create mode 100644 ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepLicense.vue create mode 100644 ecom-dmb-frontend/apps/web-antd/src/views/init/InitWizard.vue create mode 100644 ecom-dmb-frontend/apps/web-antd/src/views/init/components/FingerprintDisplay.vue create mode 100644 ecom-dmb-frontend/apps/web-antd/src/views/system/license/FingerprintInfo.vue create mode 100644 ecom-dmb-frontend/apps/web-antd/src/views/system/license/LicenseInfo.vue create mode 100644 ecom-license/.gitignore create mode 100644 ecom-license/.npmrc create mode 100644 ecom-license/1.md create mode 100644 ecom-license/DESIGN.reference.md create mode 100644 ecom-license/README.md create mode 100644 ecom-license/cli/README.md create mode 100644 ecom-license/cli/package.json create mode 100644 ecom-license/cli/pnpm-lock.yaml create mode 100644 ecom-license/cli/src/api/client.ts create mode 100644 ecom-license/cli/src/commands/customer.ts create mode 100644 ecom-license/cli/src/commands/license.ts create mode 100644 ecom-license/cli/src/commands/login.ts create mode 100644 ecom-license/cli/src/commands/logout.ts create mode 100644 ecom-license/cli/src/commands/stats.ts create mode 100644 ecom-license/cli/src/commands/whoami.ts create mode 100644 ecom-license/cli/src/config.ts create mode 100644 ecom-license/cli/src/context.ts create mode 100644 ecom-license/cli/src/index.ts create mode 100644 ecom-license/cli/src/ui/render.ts create mode 100644 ecom-license/cli/tsconfig.json create mode 100644 ecom-license/server/.env.example create mode 100644 ecom-license/server/.npmrc create mode 100644 ecom-license/server/keys/.gitignore create mode 100644 ecom-license/server/keys/.gitkeep create mode 100644 ecom-license/server/nest-cli.json create mode 100644 ecom-license/server/package.json create mode 100644 ecom-license/server/pnpm-lock.yaml create mode 100644 ecom-license/server/sql/schema.sql create mode 100644 ecom-license/server/src/app.module.ts create mode 100644 ecom-license/server/src/common/admin-seed.service.ts create mode 100644 ecom-license/server/src/common/jwt-signer.service.ts create mode 100644 ecom-license/server/src/entities/lc-activation-log.entity.ts create mode 100644 ecom-license/server/src/entities/lc-admin.entity.ts create mode 100644 ecom-license/server/src/entities/lc-customer.entity.ts create mode 100644 ecom-license/server/src/entities/lc-license.entity.ts create mode 100644 ecom-license/server/src/entities/lc-oper-log.entity.ts create mode 100644 ecom-license/server/src/main.ts create mode 100644 ecom-license/server/src/modules/auth/auth.controller.ts create mode 100644 ecom-license/server/src/modules/auth/auth.dto.ts create mode 100644 ecom-license/server/src/modules/auth/auth.module.ts create mode 100644 ecom-license/server/src/modules/auth/auth.service.ts create mode 100644 ecom-license/server/src/modules/auth/jwt-auth.guard.ts create mode 100644 ecom-license/server/src/modules/auth/jwt.strategy.ts create mode 100644 ecom-license/server/src/modules/customer/customer.controller.ts create mode 100644 ecom-license/server/src/modules/customer/customer.dto.ts create mode 100644 ecom-license/server/src/modules/customer/customer.module.ts create mode 100644 ecom-license/server/src/modules/customer/customer.service.ts create mode 100644 ecom-license/server/src/modules/dashboard/dashboard.controller.ts create mode 100644 ecom-license/server/src/modules/dashboard/dashboard.module.ts create mode 100644 ecom-license/server/src/modules/dashboard/dashboard.service.ts create mode 100644 ecom-license/server/src/modules/license/license.controller.ts create mode 100644 ecom-license/server/src/modules/license/license.dto.ts create mode 100644 ecom-license/server/src/modules/license/license.module.ts create mode 100644 ecom-license/server/src/modules/license/license.service.ts create mode 100644 ecom-license/server/tsconfig.build.json create mode 100644 ecom-license/server/tsconfig.json create mode 100644 ecom-license/tsconfig.json diff --git a/ecom-dmb-backend/pom.xml b/ecom-dmb-backend/pom.xml index 7d819498..a2fb8e63 100644 --- a/ecom-dmb-backend/pom.xml +++ b/ecom-dmb-backend/pom.xml @@ -89,6 +89,12 @@ 0.11.5 runtime + + + com.nimbusds + nimbus-jose-jwt + 9.37.3 + org.springframework.boot diff --git a/ecom-dmb-backend/sql/migration/V20260528__sys_license_init.sql b/ecom-dmb-backend/sql/migration/V20260528__sys_license_init.sql new file mode 100644 index 00000000..e9bcc0aa --- /dev/null +++ b/ecom-dmb-backend/sql/migration/V20260528__sys_license_init.sql @@ -0,0 +1,30 @@ +-- License 与系统初始化表 +CREATE TABLE IF NOT EXISTS sys_init ( + id BIGINT PRIMARY KEY DEFAULT 1, + step TINYINT NOT NULL DEFAULT 0 COMMENT '初始化步骤 0~3', + admin_id BIGINT NULL COMMENT '超级管理员用户ID', + company_name VARCHAR(200) NULL COMMENT '公司名称', + created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) COMMENT '系统初始化状态(单行)'; + +CREATE TABLE IF NOT EXISTS sys_license ( + id BIGINT PRIMARY KEY AUTO_INCREMENT, + company_name VARCHAR(200) NOT NULL COMMENT '授权公司名称', + edition VARCHAR(20) NOT NULL COMMENT '版本 trial/enterprise/unlimited', + machine_fingerprint VARCHAR(100) NOT NULL COMMENT '绑定的机器指纹', + installation_id VARCHAR(64) NULL COMMENT '安装ID', + license_key TEXT NOT NULL COMMENT 'License JWT', + jti VARCHAR(64) NOT NULL COMMENT 'JWT唯一标识', + issued_at DATETIME NOT NULL COMMENT '签发时间', + expires_at DATETIME NOT NULL COMMENT '过期时间', + activated_at DATETIME NOT NULL COMMENT '激活时间', + is_active TINYINT NOT NULL DEFAULT 1 COMMENT '是否有效 1=是 0=否', + created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + UNIQUE KEY uk_jti (jti) +) COMMENT '当前生效的 License'; + +-- 已有环境跳过初始化门禁(仅开发/存量部署) +INSERT INTO sys_init (id, step) VALUES (1, 3) +ON DUPLICATE KEY UPDATE step = GREATEST(step, 3); diff --git a/ecom-dmb-backend/sql/sys_design.sql b/ecom-dmb-backend/sql/sys_design.sql index 54b31dd7..99c67709 100644 --- a/ecom-dmb-backend/sql/sys_design.sql +++ b/ecom-dmb-backend/sql/sys_design.sql @@ -168,4 +168,42 @@ CREATE TABLE `sys_file` ( CONSTRAINT `fk_sys_file_uploader` FOREIGN KEY (`upload_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '系统模块-统一文件资源表(支持本地存储和对象存储)' +-- ======================================== +-- 系统初始化状态表(单行 id=1,首次部署向导进度) +-- ======================================== +DROP TABLE IF EXISTS `sys_init`; +CREATE TABLE `sys_init` ( + `id` bigint UNSIGNED NOT NULL DEFAULT 1 COMMENT '固定主键(单行记录)', + `step` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '初始化步骤(0-未开始 1-超管已创建 2-公司已填写 3-已完成)', + `admin_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '超级管理员用户ID', + `company_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '公司名称', + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `fk_sys_init_admin`(`admin_id` ASC) USING BTREE, + CONSTRAINT `fk_sys_init_admin` FOREIGN KEY (`admin_id`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '系统模块-初始化状态表(单行)' + +-- ======================================== +-- License 授权表(当前部署生效的 License) +-- ======================================== +DROP TABLE IF EXISTS `sys_license`; +CREATE TABLE `sys_license` ( + `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', + `company_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '授权公司名称', + `edition` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '版本(trial/enterprise/unlimited)', + `machine_fingerprint` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '绑定的机器指纹(SaaS 为 *)', + `installation_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '安装ID(machine-id)', + `license_key` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'License JWT', + `jti` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'JWT 唯一标识(吊销用)', + `issued_at` timestamp NOT NULL COMMENT '签发时间', + `expires_at` timestamp NOT NULL COMMENT '过期时间', + `activated_at` timestamp NOT NULL COMMENT '激活时间', + `is_active` tinyint UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否有效(0-无效 1-有效)', + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `uk_jti`(`jti` ASC) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '系统模块-License 授权表' + diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/common/config/SecurityConfig.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/common/config/SecurityConfig.java index a2d2f7fd..e1f399a4 100644 --- a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/common/config/SecurityConfig.java +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/common/config/SecurityConfig.java @@ -46,6 +46,7 @@ public class SecurityConfig { .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .authorizeHttpRequests(auth -> auth .requestMatchers("/auth/login", "/auth/register", "/auth/refresh").permitAll() + .requestMatchers("/init/**").permitAll() .requestMatchers("/uploads/**").permitAll() // 允许直接访问上传的文件 .requestMatchers("/doc.html", "/webjars/**", "/v3/api-docs/**", "/swagger-resources/**", "/swagger-ui/**", "/swagger-ui.html") diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/common/exception/GlobalExceptionHandler.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/common/exception/GlobalExceptionHandler.java index 1996ee1c..1eb6bc6c 100644 --- a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/common/exception/GlobalExceptionHandler.java +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/common/exception/GlobalExceptionHandler.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.servlet.NoHandlerFoundException; import top.xyquan.ecomdmbbackend.common.response.ApiResponse; +import top.xyquan.ecomdmbbackend.modules.license.LicenseException; import java.util.stream.Collectors; @@ -20,6 +21,15 @@ import java.util.stream.Collectors; @RestControllerAdvice public class GlobalExceptionHandler { + /** + * 处理 License 授权异常 + */ + @ExceptionHandler(LicenseException.class) + @ResponseStatus(HttpStatus.FORBIDDEN) + public ApiResponse handleLicenseException(LicenseException e) { + return ApiResponse.fail(e.getMessage()); + } + /** * 处理业务异常 */ diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/importtask/service/impl/ImportTaskProcessorServiceImpl.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/importtask/service/impl/ImportTaskProcessorServiceImpl.java index ac2267f1..0d0ac46d 100644 --- a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/importtask/service/impl/ImportTaskProcessorServiceImpl.java +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/importtask/service/impl/ImportTaskProcessorServiceImpl.java @@ -22,6 +22,8 @@ import top.xyquan.ecomdmbbackend.modules.ecom.product.mapper.ProductMapper; import top.xyquan.ecomdmbbackend.modules.ecom.product.service.ProductSpecService; import top.xyquan.ecomdmbbackend.modules.ecom.promotion.service.impl.PromotionFeeImportProcessor; import top.xyquan.ecomdmbbackend.modules.ecom.shop.mapper.ShopProductRelationMapper; +import top.xyquan.ecomdmbbackend.modules.license.LicenseFeature; +import top.xyquan.ecomdmbbackend.modules.license.LicenseFeatureGuard; import top.xyquan.ecomdmbbackend.modules.sys.file.service.OssService; import top.xyquan.ecomdmbbackend.modules.sys.file.service.SysFileService; import top.xyquan.ecomdmbbackend.modules.sys.file.model.vo.SysFileVO; @@ -64,6 +66,7 @@ public class ImportTaskProcessorServiceImpl implements ImportTaskProcessorServic private final PromotionFeeImportProcessor promotionFeeImportProcessor; private final OrderStatRefreshCoordinator orderStatRefreshCoordinator; private final FeeStatRefreshService feeStatRefreshService; + private final LicenseFeatureGuard licenseFeatureGuard; public ImportTaskProcessorServiceImpl(ImportTaskService importTaskService, ProductSpecService productSpecService, @@ -78,8 +81,10 @@ public class ImportTaskProcessorServiceImpl implements ImportTaskProcessorServic SysFileService sysFileService, PromotionFeeImportProcessor promotionFeeImportProcessor, OrderStatRefreshCoordinator orderStatRefreshCoordinator, - FeeStatRefreshService feeStatRefreshService) { + FeeStatRefreshService feeStatRefreshService, + LicenseFeatureGuard licenseFeatureGuard) { this.importTaskService = importTaskService; + this.licenseFeatureGuard = licenseFeatureGuard; this.orderMapper = orderMapper; this.sseNotificationService = sseNotificationService; this.objectMapper = objectMapper; @@ -107,6 +112,7 @@ public class ImportTaskProcessorServiceImpl implements ImportTaskProcessorServic notifyTaskProgress(task.getCreateBy(), convertToVO(updatedTask)); if ("order".equals(task.getType())) { + licenseFeatureGuard.require(LicenseFeature.ORDER_IMPORT); processOrderImport(task); } else if ("product".equals(task.getType())) { updateTaskStatus(taskId, "failed", "商品导入功能暂未实现", 0, 0, 0); diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/importtask/service/impl/ImportTaskServiceImpl.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/importtask/service/impl/ImportTaskServiceImpl.java index e1342408..d8f45d76 100644 --- a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/importtask/service/impl/ImportTaskServiceImpl.java +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/importtask/service/impl/ImportTaskServiceImpl.java @@ -20,6 +20,8 @@ import top.xyquan.ecomdmbbackend.modules.ecom.importtask.service.ImportTaskQueue import top.xyquan.ecomdmbbackend.modules.ecom.importtask.service.ImportTaskService; import top.xyquan.ecomdmbbackend.modules.ecom.shop.model.po.ShopPO; import top.xyquan.ecomdmbbackend.modules.ecom.shop.service.ShopService; +import top.xyquan.ecomdmbbackend.modules.license.LicenseFeature; +import top.xyquan.ecomdmbbackend.modules.license.LicenseFeatureGuard; import top.xyquan.ecomdmbbackend.utils.CurrentUserContext; import java.time.LocalDate; @@ -39,13 +41,16 @@ public class ImportTaskServiceImpl extends ServiceImpl createOrder(@Valid @RequestBody CreateOrderDTO createOrderDTO) { OrderVO orderVO = orderService.createOrder(createOrderDTO); @@ -90,6 +93,7 @@ public class OrderController { @Operation(summary = "批量导入订单", description = "批量导入订单数据,支持部分成功部分失败") @PostMapping("/batch-import") + @LicenseRequired @RequirePermission(value = "ecom:order:import", description = "批量导入订单", allowSuper = true) public ApiResponse batchImportOrders(@Valid @RequestBody BatchImportOrderDTO batchImportOrderDTO) { BatchImportResultVO result = orderService.batchImportOrders(batchImportOrderDTO); diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/order/service/impl/OrderServiceImpl.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/order/service/impl/OrderServiceImpl.java index 836bed25..bb611e0a 100644 --- a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/order/service/impl/OrderServiceImpl.java +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/ecom/order/service/impl/OrderServiceImpl.java @@ -33,6 +33,8 @@ import top.xyquan.ecomdmbbackend.modules.ecom.product.service.ProductSpecService import top.xyquan.ecomdmbbackend.modules.ecom.order.stat.service.OrderStatCrudCoordinator; import top.xyquan.ecomdmbbackend.modules.ecom.order.stat.support.StatDirtyKey; import top.xyquan.ecomdmbbackend.modules.ecom.shop.service.ShopService; +import top.xyquan.ecomdmbbackend.modules.license.LicenseFeature; +import top.xyquan.ecomdmbbackend.modules.license.LicenseFeatureGuard; import top.xyquan.ecomdmbbackend.utils.CurrentUserContext; import java.time.ZoneId; @@ -58,17 +60,20 @@ public class OrderServiceImpl extends ServiceImpl implemen private final ProductSpecService productSpecService; private final OrderStatusService orderStatusService; private final OrderStatCrudCoordinator orderStatCrudCoordinator; + private final LicenseFeatureGuard licenseFeatureGuard; public OrderServiceImpl(CurrentUserContext currentUserContext, ShopService shopService, ProductService productService, ProductSpecService productSpecService, OrderStatusService orderStatusService, - OrderStatCrudCoordinator orderStatCrudCoordinator) { + OrderStatCrudCoordinator orderStatCrudCoordinator, + LicenseFeatureGuard licenseFeatureGuard) { this.currentUserContext = currentUserContext; this.shopService = shopService; this.productService = productService; this.productSpecService = productSpecService; this.orderStatusService = orderStatusService; this.orderStatCrudCoordinator = orderStatCrudCoordinator; + this.licenseFeatureGuard = licenseFeatureGuard; } /** @@ -79,6 +84,7 @@ public class OrderServiceImpl extends ServiceImpl implemen @Override @Transactional public OrderVO createOrder(CreateOrderDTO createOrderDTO) { + licenseFeatureGuard.require(LicenseFeature.ORDER_CREATE); // 从token中获取公司ID Long companyId = currentUserContext.getCurrentCompanyId(); @@ -375,6 +381,7 @@ public class OrderServiceImpl extends ServiceImpl implemen @Override @Transactional public BatchImportResultVO batchImportOrders(BatchImportOrderDTO batchImportOrderDTO) { + licenseFeatureGuard.require(LicenseFeature.ORDER_IMPORT); List orders = batchImportOrderDTO.getOrders(); List successOrders = new ArrayList<>(); List failureRecords = new ArrayList<>(); @@ -382,21 +389,23 @@ public class OrderServiceImpl extends ServiceImpl implemen int totalCount = orders.size(); int successCount = 0; int failureCount = 0; - + Long importCompanyId = currentUserContext.getCurrentCompanyId(); + Long importUserId = currentUserContext.getCurrentUserId(); + for (int i = 0; i < orders.size(); i++) { - CreateOrderDTO orderDTO = orders.get(i); + CreateOrderDTO rowOrder = orders.get(i); int rowNumber = i + 1; // 行号从1开始 - + try { - // 尝试创建订单 - OrderVO orderVO = createOrder(orderDTO); + // 批量导入走专用写入路径,授权已在方法入口校验 ORDER_IMPORT + OrderVO orderVO = this.createOrderForImport(rowOrder, importCompanyId, importUserId); successOrders.add(orderVO); successCount++; } catch (Exception e) { // 记录失败信息 BatchImportResultVO.ImportFailureRecord failureRecord = new BatchImportResultVO.ImportFailureRecord(); failureRecord.setRowNumber(rowNumber); - failureRecord.setPlatformOrderNo(orderDTO.getPlatformOrderNo()); + failureRecord.setPlatformOrderNo(rowOrder.getPlatformOrderNo()); failureRecord.setFailureReason(e.getMessage()); failureRecords.add(failureRecord); failureCount++; diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseAspect.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseAspect.java new file mode 100644 index 00000000..ec0ed485 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseAspect.java @@ -0,0 +1,41 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.AnnotatedElementUtils; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + +/** + * License 授权切面:拦截 @LicenseRequired 方法 + */ +@Aspect +@Component +@Slf4j +public class LicenseAspect { + + private final LicenseValidator licenseValidator; + + public LicenseAspect(LicenseValidator licenseValidator) { + this.licenseValidator = licenseValidator; + } + + @Around("@annotation(top.xyquan.ecomdmbbackend.modules.license.LicenseRequired)" + + " || @annotation(top.xyquan.ecomdmbbackend.modules.license.RequiresOrderCreateLicense)") + public Object around(ProceedingJoinPoint joinPoint) throws Throwable { + if (!LicenseEnforcement.isEnforced()) { + return joinPoint.proceed(); + } + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + LicenseRequired annotation = AnnotatedElementUtils.findMergedAnnotation(method, LicenseRequired.class); + LicenseFeature feature = annotation != null ? annotation.value() : LicenseFeature.ORDER_IMPORT; + licenseValidator.check(); + licenseValidator.requireFeature(feature); + return joinPoint.proceed(); + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseAutoConfig.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseAutoConfig.java new file mode 100644 index 00000000..7d5664ad --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseAutoConfig.java @@ -0,0 +1,12 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * License 模块自动配置 + */ +@Configuration +@EnableConfigurationProperties(LicenseProperties.class) +public class LicenseAutoConfig { +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseEnforcement.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseEnforcement.java new file mode 100644 index 00000000..bbf7f59a --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseEnforcement.java @@ -0,0 +1,41 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +/** + * License 信任锚与强制开关(编译期常量,不可通过配置文件或环境变量覆盖)。 + *

+ * 私有部署若允许通过 yml/env 修改开关或公钥,部署方可自签 License 从而绕过授权。 + * 发行构建必须保持 {@link #ENFORCED} 为 {@code true},公钥与 License Server 私钥配对。 + *

+ * 本地开发需跳过 License 时:仅在本机临时将 {@link #ENFORCED} 改为 {@code false},勿提交。 + */ +public final class LicenseEnforcement { + + /** + * 发行包必须为 {@code true}。 + * 本地调试可临时改为 {@code false}(勿提交)。 + */ + private static final boolean ENFORCED = false; + + /** + * Ed25519 验签公钥(SPKI PEM),与 ecom-license/server 签发私钥配对。 + * 密钥轮换时需发新版主应用并同步更新 License Server 密钥对。 + */ + private static final String EMBEDDED_PUBLIC_KEY_PEM = """ + -----BEGIN PUBLIC KEY----- + MCowBQYDK2VwAyEAIB3yRtn+hCR/tXTUh1WA6ZFrpUha7WcBYLDWk2ZoTMc= + -----END PUBLIC KEY----- + """; + + private LicenseEnforcement() { + } + + /** 是否执行 License 校验(忽略一切外部配置) */ + public static boolean isEnforced() { + return ENFORCED; + } + + /** 内置验签公钥 PEM,不可通过配置文件替换 */ + public static String getEmbeddedPublicKeyPem() { + return EMBEDDED_PUBLIC_KEY_PEM; + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseException.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseException.java new file mode 100644 index 00000000..287c419a --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseException.java @@ -0,0 +1,33 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import lombok.Getter; + +/** + * License 校验失败异常,由全局异常处理器返回 HTTP 403 + */ +@Getter +public class LicenseException extends RuntimeException { + + private final String errorCode; + + public LicenseException(String errorCode, String message) { + super(message); + this.errorCode = errorCode; + } + + public static LicenseException invalid(String message) { + return new LicenseException("LICENSE_INVALID", message); + } + + public static LicenseException fingerprintMismatch() { + return new LicenseException("LICENSE_FINGERPRINT_MISMATCH", "License 与当前机器指纹不匹配"); + } + + public static LicenseException featureDenied(LicenseFeature feature) { + return new LicenseException("LICENSE_FEATURE_DENIED", "未授权功能: " + feature.getCode()); + } + + public static LicenseException revoked() { + return new LicenseException("LICENSE_REVOKED", "License 已被吊销"); + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseFeature.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseFeature.java new file mode 100644 index 00000000..7df876ca --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseFeature.java @@ -0,0 +1,22 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import lombok.Getter; + +/** + * License 授权功能枚举 + */ +@Getter +public enum LicenseFeature { + + /** 订单批量/文件导入 */ + ORDER_IMPORT("order-import"), + + /** 手动创建单条订单 */ + ORDER_CREATE("order-create"); + + private final String code; + + LicenseFeature(String code) { + this.code = code; + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseFeatureGuard.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseFeatureGuard.java new file mode 100644 index 00000000..3272de16 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseFeatureGuard.java @@ -0,0 +1,23 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import org.springframework.stereotype.Component; + +/** + * Service 层功能门禁,防止绕过 Controller AOP 直接调用 Service + */ +@Component +public class LicenseFeatureGuard { + + private final LicenseValidator licenseValidator; + + public LicenseFeatureGuard(LicenseValidator licenseValidator) { + this.licenseValidator = licenseValidator; + } + + public void require(LicenseFeature feature) { + if (!LicenseEnforcement.isEnforced()) { + return; + } + licenseValidator.requireFeature(feature); + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseInfo.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseInfo.java new file mode 100644 index 00000000..b84cb19c --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseInfo.java @@ -0,0 +1,42 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import lombok.Builder; +import lombok.Data; + +import java.time.Instant; +import java.util.List; + +/** + * 解析并校验后的 License 内存模型 + */ +@Data +@Builder +public class LicenseInfo { + + private String subject; + private String companyName; + private String edition; + private String machineFingerprint; + private String installationId; + private String jti; + private String issuer; + private List features; + private Instant issuedAt; + private Instant expiresAt; + private String rawLicenseKey; + + /** 是否已过期 */ + public boolean isExpired() { + return expiresAt != null && Instant.now().isAfter(expiresAt); + } + + /** 是否包含指定功能 */ + public boolean hasFeature(LicenseFeature feature) { + return features != null && features.contains(feature.getCode()); + } + + /** SaaS 模式:指纹为 * 时不校验硬件 */ + public boolean isWildcardFingerprint() { + return "*".equals(machineFingerprint); + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseProperties.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseProperties.java new file mode 100644 index 00000000..1cfe95a4 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseProperties.java @@ -0,0 +1,30 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * License 模块配置项,对应 application.yml 中 ecom.license.* + */ +@Data +@ConfigurationProperties(prefix = "ecom.license") +public class LicenseProperties { + + /** 环境变量预置的 License JWT */ + private String licenseKey = ""; + + /** License 文件路径 */ + private String licenseFile = "config/license.key"; + + /** 本地吊销 jti 列表文件,每行一个 jti */ + private String revocationFile = "config/revoked.jti"; + + /** 后台全量重验间隔(分钟) */ + private int revalidateInterval = 10; + + /** 是否启用在线吊销同步 */ + private boolean onlineRevocationCheck = false; + + /** License 服务器根地址,用于在线吊销查询 */ + private String licenseServerUrl = ""; +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseRequired.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseRequired.java new file mode 100644 index 00000000..9d151067 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseRequired.java @@ -0,0 +1,17 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 标注需要 License 授权才能访问的 Controller 方法 + */ +@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface LicenseRequired { + + /** 需要的功能,默认订单导入 */ + LicenseFeature value() default LicenseFeature.ORDER_IMPORT; +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseValidator.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseValidator.java new file mode 100644 index 00000000..70525daa --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/LicenseValidator.java @@ -0,0 +1,366 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.nimbusds.jose.crypto.Ed25519Verifier; +import com.nimbusds.jose.jwk.Curve; +import com.nimbusds.jose.jwk.OctetKeyPair; +import com.nimbusds.jose.util.Base64URL; +import com.nimbusds.jwt.JWTClaimsSet; +import com.nimbusds.jwt.SignedJWT; +import jakarta.annotation.PostConstruct; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import org.springframework.web.client.RestTemplate; +import top.xyquan.ecomdmbbackend.modules.license.mapper.SysLicenseMapper; +import top.xyquan.ecomdmbbackend.modules.license.model.po.SysLicensePO; + +import java.io.IOException; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Arrays; +import java.util.Base64; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicReference; + +/** + * License 验签、缓存与定时重验 + */ +@Slf4j +@Component +public class LicenseValidator { + + private static final String ISSUER = "ecom-license-server"; + + private final LicenseProperties properties; + private final SysLicenseMapper sysLicenseMapper; + private final RestTemplate restTemplate; + + /** 内存缓存,请求链路零 I/O */ + private final AtomicReference cachedLicense = new AtomicReference<>(); + + /** 吊销 jti 黑名单 */ + private volatile Set revokedJtiSet = Collections.emptySet(); + + private volatile OctetKeyPair publicJwk; + + public LicenseValidator(LicenseProperties properties, + SysLicenseMapper sysLicenseMapper) { + this.properties = properties; + this.sysLicenseMapper = sysLicenseMapper; + this.restTemplate = new RestTemplate(); + } + + @PostConstruct + public void init() { + loadEmbeddedPublicKey(); + reloadRevokedJti(); + if (LicenseEnforcement.isEnforced()) { + try { + fullValidate(); + } catch (Exception e) { + log.warn("启动时 License 全量校验未通过: {}", e.getMessage()); + cachedLicense.set(null); + } + } + } + + /** 从源码内置公钥加载验签器,禁止通过配置文件替换 */ + private void loadEmbeddedPublicKey() { + try { + this.publicJwk = parsePublicJwk(LicenseEnforcement.getEmbeddedPublicKeyPem()); + } catch (Exception e) { + if (LicenseEnforcement.isEnforced()) { + throw new IllegalStateException("内置 License 公钥加载失败", e); + } + log.warn("内置 License 公钥加载失败(当前未强制校验): {}", e.getMessage()); + } + } + + /** 请求链路轻量校验(仅读内存) */ + public void check() { + if (!LicenseEnforcement.isEnforced()) { + return; + } + LicenseInfo info = cachedLicense.get(); + if (info == null) { + throw LicenseException.invalid("未激活 License 或 License 无效"); + } + assertMemoryValid(info); + } + + /** 校验并确保包含指定功能 */ + public void requireFeature(LicenseFeature feature) { + if (!LicenseEnforcement.isEnforced()) { + return; + } + check(); + LicenseInfo info = cachedLicense.get(); + if (info != null && !info.hasFeature(feature)) { + throw LicenseException.featureDenied(feature); + } + } + + /** + * 解析并全量校验 JWT(激活/续期时调用) + */ + public LicenseInfo parseAndValidate(String licenseKey) { + LicenseInfo info = parseJwt(licenseKey); + validateBusinessRules(info); + return info; + } + + /** 后台全量重验:重新加载来源并验签 */ + public synchronized void fullValidate() { + if (!LicenseEnforcement.isEnforced()) { + return; + } + reloadRevokedJti(); + String licenseKey = resolveLicenseKey(); + if (!StringUtils.hasText(licenseKey)) { + cachedLicense.set(null); + throw LicenseException.invalid("未找到 License"); + } + LicenseInfo info = parseJwt(licenseKey.trim()); + validateBusinessRules(info); + cachedLicense.set(info); + log.debug("License 全量校验通过, jti={}", info.getJti()); + } + + /** 激活后刷新内存缓存 */ + public void refreshCache(LicenseInfo info) { + cachedLicense.set(info); + } + + public LicenseInfo getCachedLicense() { + return cachedLicense.get(); + } + + /** 持久化 License 到数据库并刷新缓存 */ + public void persistLicense(LicenseInfo info) { + // 旧记录全部置为无效 + sysLicenseMapper.update(null, new LambdaUpdateWrapper() + .set(SysLicensePO::getIsActive, 0)); + + SysLicensePO po = new SysLicensePO(); + po.setCompanyName(info.getCompanyName()); + po.setEdition(info.getEdition()); + po.setMachineFingerprint(info.getMachineFingerprint()); + po.setInstallationId(info.getInstallationId()); + po.setLicenseKey(info.getRawLicenseKey()); + po.setJti(info.getJti()); + po.setIssuedAt(toLocalDateTime(info.getIssuedAt())); + po.setExpiresAt(toLocalDateTime(info.getExpiresAt())); + po.setActivatedAt(LocalDateTime.now()); + po.setIsActive(1); + sysLicenseMapper.insert(po); + refreshCache(info); + } + + @Scheduled(fixedDelayString = "#{${ecom.license.revalidate-interval:10} * 60 * 1000}") + public void scheduledRevalidate() { + if (!LicenseEnforcement.isEnforced()) { + return; + } + try { + fullValidate(); + } catch (Exception e) { + log.warn("定时 License 重验失败,清空缓存: {}", e.getMessage()); + cachedLicense.set(null); + } + } + + @Scheduled(fixedDelay = 3600_000) + public void scheduledOnlineRevocationSync() { + if (!LicenseEnforcement.isEnforced() || !properties.isOnlineRevocationCheck()) { + return; + } + LicenseInfo info = cachedLicense.get(); + if (info == null || !StringUtils.hasText(properties.getLicenseServerUrl())) { + return; + } + try { + String url = properties.getLicenseServerUrl().replaceAll("/$", "") + + "/api/licenses/status?jti=" + info.getJti(); + @SuppressWarnings("unchecked") + var body = restTemplate.getForObject(URI.create(url), java.util.Map.class); + if (body != null && "revoked".equals(String.valueOf(body.get("status")))) { + revokedJtiSet = new HashSet<>(revokedJtiSet); + revokedJtiSet.add(info.getJti()); + cachedLicense.set(null); + log.warn("在线吊销同步:jti={} 已吊销", info.getJti()); + } + } catch (Exception e) { + log.debug("在线吊销查询失败: {}", e.getMessage()); + } + } + + @Scheduled(fixedDelay = 86400_000) + public void scheduledNtpCheck() { + // 首版仅日志告警,不拒绝请求 + long offset = Math.abs(System.currentTimeMillis() - Instant.now().toEpochMilli()); + if (offset > 60_000) { + log.warn("系统时钟可能异常,偏移约 {} ms", offset); + } + } + + private void assertMemoryValid(LicenseInfo info) { + if (info.isExpired()) { + throw LicenseException.invalid("License 已过期"); + } + if (revokedJtiSet.contains(info.getJti())) { + throw LicenseException.revoked(); + } + if (!info.isWildcardFingerprint()) { + String current = MachineFingerprintUtil.computeFingerprint(); + if (!current.equals(info.getMachineFingerprint())) { + throw LicenseException.fingerprintMismatch(); + } + } + } + + private void validateBusinessRules(LicenseInfo info) { + if (info.isExpired()) { + throw LicenseException.invalid("License 已过期"); + } + if (revokedJtiSet.contains(info.getJti())) { + throw LicenseException.revoked(); + } + if (!ISSUER.equals(info.getIssuer())) { + throw LicenseException.invalid("License 签发方无效"); + } + if (!info.isWildcardFingerprint()) { + String current = MachineFingerprintUtil.computeFingerprint(); + if (!current.equals(info.getMachineFingerprint())) { + throw LicenseException.fingerprintMismatch(); + } + } + } + + private LicenseInfo parseJwt(String licenseKey) { + if (publicJwk == null) { + throw LicenseException.invalid("License 验签公钥未就绪"); + } + try { + SignedJWT signedJWT = SignedJWT.parse(licenseKey); + Ed25519Verifier verifier = new Ed25519Verifier(publicJwk); + if (!signedJWT.verify(verifier)) { + throw LicenseException.invalid("License 签名验证失败"); + } + JWTClaimsSet claims = signedJWT.getJWTClaimsSet(); + String jti = claims.getJWTID(); + if (!StringUtils.hasText(jti)) { + throw LicenseException.invalid("License 缺少 jti"); + } + List features = claims.getStringListClaim("features"); + if (features == null) { + features = List.of(); + } + return LicenseInfo.builder() + .subject(claims.getSubject()) + .companyName(stringClaim(claims, "company")) + .edition(stringClaim(claims, "edition")) + .machineFingerprint(stringClaim(claims, "machineFingerprint")) + .installationId(stringClaim(claims, "installationId")) + .jti(jti) + .issuer(claims.getIssuer()) + .features(features) + .issuedAt(claims.getIssueTime() != null ? claims.getIssueTime().toInstant() : null) + .expiresAt(claims.getExpirationTime() != null ? claims.getExpirationTime().toInstant() : null) + .rawLicenseKey(licenseKey) + .build(); + } catch (LicenseException e) { + throw e; + } catch (Exception e) { + throw LicenseException.invalid("License 解析失败: " + e.getMessage()); + } + } + + private String resolveLicenseKey() { + // 1. 数据库 + SysLicensePO active = sysLicenseMapper.selectOne(new LambdaQueryWrapper() + .eq(SysLicensePO::getIsActive, 1) + .orderByDesc(SysLicensePO::getActivatedAt) + .last("LIMIT 1")); + if (active != null && StringUtils.hasText(active.getLicenseKey())) { + return active.getLicenseKey(); + } + // 2. 环境变量 + if (StringUtils.hasText(properties.getLicenseKey())) { + return properties.getLicenseKey(); + } + // 3. 文件 + Path path = Paths.get(properties.getLicenseFile()); + if (Files.exists(path)) { + try { + return Files.readString(path, StandardCharsets.UTF_8).trim(); + } catch (IOException e) { + log.warn("读取 License 文件失败: {}", e.getMessage()); + } + } + return null; + } + + private void reloadRevokedJti() { + Path path = Paths.get(properties.getRevocationFile()); + if (!Files.exists(path)) { + revokedJtiSet = Collections.emptySet(); + return; + } + try { + Set set = new HashSet<>(); + Files.lines(path, StandardCharsets.UTF_8) + .map(String::trim) + .filter(StringUtils::hasText) + .forEach(set::add); + revokedJtiSet = Collections.unmodifiableSet(set); + } catch (IOException e) { + log.warn("读取吊销列表失败: {}", e.getMessage()); + } + } + + /** 将 Ed25519 SPKI PEM 转为 nimbus OctetKeyPair */ + private OctetKeyPair parsePublicJwk(String pem) { + try { + String normalized = pem + .replace("-----BEGIN PUBLIC KEY-----", "") + .replace("-----END PUBLIC KEY-----", "") + .replaceAll("\\s", ""); + byte[] decoded = Base64.getDecoder().decode(normalized); + // X509 SPKI 末尾 32 字节为 Ed25519 原始公钥 + if (decoded.length < 32) { + throw new IllegalArgumentException("公钥长度无效"); + } + byte[] rawPublic = Arrays.copyOfRange(decoded, decoded.length - 32, decoded.length); + return new OctetKeyPair.Builder(Curve.Ed25519, Base64URL.encode(rawPublic)).build(); + } catch (Exception e) { + throw new IllegalStateException("License 公钥解析失败: " + e.getMessage(), e); + } + } + + private String stringClaim(JWTClaimsSet claims, String name) { + try { + return claims.getStringClaim(name); + } catch (Exception e) { + return null; + } + } + + private LocalDateTime toLocalDateTime(Instant instant) { + if (instant == null) { + return null; + } + return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/MachineFingerprintUtil.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/MachineFingerprintUtil.java new file mode 100644 index 00000000..2d35cf89 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/MachineFingerprintUtil.java @@ -0,0 +1,82 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import lombok.extern.slf4j.Slf4j; + +import java.io.IOException; +import java.net.InetAddress; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.HexFormat; +import java.util.UUID; + +/** + * 机器指纹工具:machine-id + hostname → FP-{SHA256} + */ +@Slf4j +public final class MachineFingerprintUtil { + + private static final Path MACHINE_ID_PATH = Paths.get("/etc/machine-id"); + private static final Path FALLBACK_MACHINE_ID_PATH = Paths.get("/etc/ecom-machine-id"); + + private MachineFingerprintUtil() { + } + + /** 读取或生成 machine-id */ + public static String getMachineId() { + String machineId = readTrimmed(MACHINE_ID_PATH); + if (machineId != null && !machineId.isEmpty()) { + return machineId; + } + machineId = readTrimmed(FALLBACK_MACHINE_ID_PATH); + if (machineId != null && !machineId.isEmpty()) { + return machineId; + } + // 无 machine-id 时生成并持久化(容器/开发环境) + machineId = UUID.randomUUID().toString(); + try { + Files.writeString(FALLBACK_MACHINE_ID_PATH, machineId, StandardCharsets.UTF_8); + log.info("已生成备用 machine-id: {}", FALLBACK_MACHINE_ID_PATH); + } catch (IOException e) { + log.warn("无法写入备用 machine-id 文件,使用内存 UUID: {}", e.getMessage()); + } + return machineId; + } + + /** 获取主机名 */ + public static String getHostname() { + try { + return InetAddress.getLocalHost().getHostName(); + } catch (Exception e) { + return "unknown-host"; + } + } + + /** 计算机器指纹 FP-{SHA256} */ + public static String computeFingerprint() { + String machineId = getMachineId(); + String hostname = getHostname(); + String raw = machineId + "|" + hostname; + try { + MessageDigest digest = MessageDigest.getInstance("SHA-256"); + byte[] hash = digest.digest(raw.getBytes(StandardCharsets.UTF_8)); + return "FP-" + HexFormat.of().formatHex(hash).toUpperCase(); + } catch (NoSuchAlgorithmException e) { + throw new IllegalStateException("SHA-256 不可用", e); + } + } + + private static String readTrimmed(Path path) { + try { + if (Files.exists(path)) { + return Files.readString(path, StandardCharsets.UTF_8).trim(); + } + } catch (IOException e) { + log.debug("读取 {} 失败: {}", path, e.getMessage()); + } + return null; + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/RequiresOrderCreateLicense.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/RequiresOrderCreateLicense.java new file mode 100644 index 00000000..176ea2bb --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/RequiresOrderCreateLicense.java @@ -0,0 +1,15 @@ +package top.xyquan.ecomdmbbackend.modules.license; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 创建订单接口的 License 门禁(元注解封装,避免 Controller 上 {@code @LicenseRequired(LicenseFeature.xxx)} 触发 IDE 误报) + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@LicenseRequired(LicenseFeature.ORDER_CREATE) +public @interface RequiresOrderCreateLicense { +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/controller/InitController.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/controller/InitController.java new file mode 100644 index 00000000..1034716c --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/controller/InitController.java @@ -0,0 +1,66 @@ +package top.xyquan.ecomdmbbackend.modules.license.controller; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import top.xyquan.ecomdmbbackend.common.response.ApiResponse; +import top.xyquan.ecomdmbbackend.modules.license.model.dto.ActivateLicenseDTO; +import top.xyquan.ecomdmbbackend.modules.license.model.dto.InitAdminDTO; +import top.xyquan.ecomdmbbackend.modules.license.model.dto.InitCompanyDTO; +import top.xyquan.ecomdmbbackend.modules.license.model.vo.FingerprintVO; +import top.xyquan.ecomdmbbackend.modules.license.model.vo.InitStatusVO; +import top.xyquan.ecomdmbbackend.modules.license.model.vo.LicenseSummaryVO; +import top.xyquan.ecomdmbbackend.modules.license.service.InitializeService; + +/** + * 系统初始化向导 API(无需登录) + */ +@Tag(name = "系统初始化", description = "首次部署初始化向导") +@RestController +@RequestMapping("/init") +public class InitController { + + private final InitializeService initializeService; + + public InitController(InitializeService initializeService) { + this.initializeService = initializeService; + } + + @Operation(summary = "获取初始化状态") + @GetMapping("/status") + public ApiResponse status() { + return ApiResponse.success(initializeService.getStatus()); + } + + @Operation(summary = "Step1 创建超级管理员") + @PostMapping("/admin") + public ApiResponse createAdmin(@Valid @RequestBody InitAdminDTO dto) { + initializeService.createAdmin(dto); + return ApiResponse.success("超级管理员创建成功"); + } + + @Operation(summary = "Step2 保存公司信息") + @PostMapping("/company") + public ApiResponse saveCompany(@Valid @RequestBody InitCompanyDTO dto) { + initializeService.saveCompany(dto); + return ApiResponse.success("公司信息保存成功"); + } + + @Operation(summary = "获取机器指纹") + @GetMapping("/fingerprint") + public ApiResponse fingerprint() { + return ApiResponse.success(initializeService.getFingerprint()); + } + + @Operation(summary = "Step3 激活 License") + @PostMapping("/activate") + public ApiResponse activate(@Valid @RequestBody ActivateLicenseDTO dto) { + LicenseSummaryVO summary = initializeService.activate(dto); + return ApiResponse.success("License 激活成功", summary); + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/controller/SystemLicenseController.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/controller/SystemLicenseController.java new file mode 100644 index 00000000..946e6b33 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/controller/SystemLicenseController.java @@ -0,0 +1,49 @@ +package top.xyquan.ecomdmbbackend.modules.license.controller; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import top.xyquan.ecomdmbbackend.common.response.ApiResponse; +import top.xyquan.ecomdmbbackend.modules.license.model.dto.ActivateLicenseDTO; +import top.xyquan.ecomdmbbackend.modules.license.model.vo.FingerprintVO; +import top.xyquan.ecomdmbbackend.modules.license.model.vo.LicenseSummaryVO; +import top.xyquan.ecomdmbbackend.modules.license.service.InitializeService; + +/** + * 已登录用户的 License 管理 API + */ +@Tag(name = "系统-License", description = "License 信息查看与续期") +@RestController +@RequestMapping("/system") +public class SystemLicenseController { + + private final InitializeService initializeService; + + public SystemLicenseController(InitializeService initializeService) { + this.initializeService = initializeService; + } + + @Operation(summary = "获取当前 License 信息") + @GetMapping("/license") + public ApiResponse getLicense() { + return ApiResponse.success(initializeService.getLicenseSummary()); + } + + @Operation(summary = "更新/续期 License") + @PutMapping("/license") + public ApiResponse updateLicense(@Valid @RequestBody ActivateLicenseDTO dto) { + LicenseSummaryVO summary = initializeService.updateLicense(dto); + return ApiResponse.success("License 更新成功", summary); + } + + @Operation(summary = "获取机器指纹") + @GetMapping("/fingerprint") + public ApiResponse fingerprint() { + return ApiResponse.success(initializeService.getFingerprint()); + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/mapper/SysInitMapper.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/mapper/SysInitMapper.java new file mode 100644 index 00000000..d8e9169c --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/mapper/SysInitMapper.java @@ -0,0 +1,9 @@ +package top.xyquan.ecomdmbbackend.modules.license.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import top.xyquan.ecomdmbbackend.modules.license.model.po.SysInitPO; + +@Mapper +public interface SysInitMapper extends BaseMapper { +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/mapper/SysLicenseMapper.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/mapper/SysLicenseMapper.java new file mode 100644 index 00000000..ec2f0ca6 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/mapper/SysLicenseMapper.java @@ -0,0 +1,9 @@ +package top.xyquan.ecomdmbbackend.modules.license.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import top.xyquan.ecomdmbbackend.modules.license.model.po.SysLicensePO; + +@Mapper +public interface SysLicenseMapper extends BaseMapper { +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/ActivateLicenseDTO.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/ActivateLicenseDTO.java new file mode 100644 index 00000000..3f654c94 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/ActivateLicenseDTO.java @@ -0,0 +1,14 @@ +package top.xyquan.ecomdmbbackend.modules.license.model.dto; + +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +/** + * 激活 / 更新 License 请求 + */ +@Data +public class ActivateLicenseDTO { + + @NotBlank(message = "License Key 不能为空") + private String licenseKey; +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/InitAdminDTO.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/InitAdminDTO.java new file mode 100644 index 00000000..8fcb1ae9 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/InitAdminDTO.java @@ -0,0 +1,22 @@ +package top.xyquan.ecomdmbbackend.modules.license.model.dto; + +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +/** + * 初始化 Step1:创建超级管理员 + */ +@Data +public class InitAdminDTO { + + @NotBlank(message = "登录账号不能为空") + private String loginCode; + + private String phone; + + @NotBlank(message = "密码不能为空") + private String password; + + @NotBlank(message = "姓名不能为空") + private String realName; +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/InitCompanyDTO.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/InitCompanyDTO.java new file mode 100644 index 00000000..a0d4aaaa --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/dto/InitCompanyDTO.java @@ -0,0 +1,18 @@ +package top.xyquan.ecomdmbbackend.modules.license.model.dto; + +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +/** + * 初始化 Step2:公司信息 + */ +@Data +public class InitCompanyDTO { + + @NotBlank(message = "公司名称不能为空") + private String companyName; + + private String contactPhone; + + private String contactEmail; +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/po/SysInitPO.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/po/SysInitPO.java new file mode 100644 index 00000000..3fb8c673 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/po/SysInitPO.java @@ -0,0 +1,30 @@ +package top.xyquan.ecomdmbbackend.modules.license.model.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * 系统初始化状态(单行 id=1) + */ +@Data +@TableName("sys_init") +public class SysInitPO { + + @TableId(value = "id", type = IdType.INPUT) + private Long id; + + /** 初始化步骤 0~3 */ + private Integer step; + + private Long adminId; + + private String companyName; + + private LocalDateTime createdAt; + + private LocalDateTime updatedAt; +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/po/SysLicensePO.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/po/SysLicensePO.java new file mode 100644 index 00000000..622a7faa --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/po/SysLicensePO.java @@ -0,0 +1,44 @@ +package top.xyquan.ecomdmbbackend.modules.license.model.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * 当前生效的 License 记录 + */ +@Data +@TableName("sys_license") +public class SysLicensePO { + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private String companyName; + + private String edition; + + private String machineFingerprint; + + private String installationId; + + private String licenseKey; + + private String jti; + + private LocalDateTime issuedAt; + + private LocalDateTime expiresAt; + + private LocalDateTime activatedAt; + + /** 1=有效 0=无效 */ + private Integer isActive; + + private LocalDateTime createdAt; + + private LocalDateTime updatedAt; +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/FingerprintVO.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/FingerprintVO.java new file mode 100644 index 00000000..75e847d0 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/FingerprintVO.java @@ -0,0 +1,16 @@ +package top.xyquan.ecomdmbbackend.modules.license.model.vo; + +import lombok.Builder; +import lombok.Data; + +/** + * 机器指纹信息 + */ +@Data +@Builder +public class FingerprintVO { + + private String fingerprint; + private String machineId; + private String hostname; +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/InitStatusVO.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/InitStatusVO.java new file mode 100644 index 00000000..5914d1d7 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/InitStatusVO.java @@ -0,0 +1,18 @@ +package top.xyquan.ecomdmbbackend.modules.license.model.vo; + +import lombok.Builder; +import lombok.Data; + +/** + * 初始化状态 + */ +@Data +@Builder +public class InitStatusVO { + + private boolean initialized; + private int currentStep; + private boolean adminCreated; + private boolean companySaved; + private boolean licenseActivated; +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/LicenseSummaryVO.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/LicenseSummaryVO.java new file mode 100644 index 00000000..ad55ab5b --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/model/vo/LicenseSummaryVO.java @@ -0,0 +1,24 @@ +package top.xyquan.ecomdmbbackend.modules.license.model.vo; + +import lombok.Builder; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 当前 License 摘要(不含完整 JWT) + */ +@Data +@Builder +public class LicenseSummaryVO { + + private String companyName; + private String edition; + private String machineFingerprint; + private List features; + private LocalDateTime issuedAt; + private LocalDateTime expiresAt; + private Long daysRemaining; + private String status; +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/service/InitializeService.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/service/InitializeService.java new file mode 100644 index 00000000..89b66979 --- /dev/null +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/license/service/InitializeService.java @@ -0,0 +1,213 @@ +package top.xyquan.ecomdmbbackend.modules.license.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; +import top.xyquan.ecomdmbbackend.common.exception.BusinessException; +import top.xyquan.ecomdmbbackend.modules.license.LicenseEnforcement; +import top.xyquan.ecomdmbbackend.modules.license.LicenseInfo; +import top.xyquan.ecomdmbbackend.modules.license.LicenseValidator; +import top.xyquan.ecomdmbbackend.modules.license.MachineFingerprintUtil; +import top.xyquan.ecomdmbbackend.modules.license.mapper.SysInitMapper; +import top.xyquan.ecomdmbbackend.modules.license.model.dto.ActivateLicenseDTO; +import top.xyquan.ecomdmbbackend.modules.license.model.dto.InitAdminDTO; +import top.xyquan.ecomdmbbackend.modules.license.model.dto.InitCompanyDTO; +import top.xyquan.ecomdmbbackend.modules.license.model.po.SysInitPO; +import top.xyquan.ecomdmbbackend.modules.license.model.vo.FingerprintVO; +import top.xyquan.ecomdmbbackend.modules.license.model.vo.InitStatusVO; +import top.xyquan.ecomdmbbackend.modules.license.model.vo.LicenseSummaryVO; +import top.xyquan.ecomdmbbackend.modules.sys.user.mapper.UserMapper; +import top.xyquan.ecomdmbbackend.modules.sys.user.model.po.UserPO; + +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.List; + +/** + * 系统初始化与 License 管理服务 + */ +@Service +public class InitializeService { + + private static final long INIT_ROW_ID = 1L; + + private final SysInitMapper sysInitMapper; + private final UserMapper userMapper; + private final PasswordEncoder passwordEncoder; + private final LicenseValidator licenseValidator; + + public InitializeService(SysInitMapper sysInitMapper, + UserMapper userMapper, + PasswordEncoder passwordEncoder, + LicenseValidator licenseValidator) { + this.sysInitMapper = sysInitMapper; + this.userMapper = userMapper; + this.passwordEncoder = passwordEncoder; + this.licenseValidator = licenseValidator; + } + + public InitStatusVO getStatus() { + SysInitPO init = getOrCreateInitRow(); + int step = init.getStep() != null ? init.getStep() : 0; + return InitStatusVO.builder() + .initialized(step >= 3) + .currentStep(step) + .adminCreated(step >= 1) + .companySaved(step >= 2) + .licenseActivated(step >= 3) + .build(); + } + + public FingerprintVO getFingerprint() { + return FingerprintVO.builder() + .fingerprint(MachineFingerprintUtil.computeFingerprint()) + .machineId(MachineFingerprintUtil.getMachineId()) + .hostname(MachineFingerprintUtil.getHostname()) + .build(); + } + + @Transactional + public void createAdmin(InitAdminDTO dto) { + SysInitPO init = getOrCreateInitRow(); + if (init.getStep() != null && init.getStep() >= 3) { + throw new BusinessException("系统已完成初始化"); + } + if (init.getStep() != null && init.getStep() >= 1) { + throw new BusinessException("超级管理员已创建"); + } + // 检查账号唯一 + if (StringUtils.hasText(dto.getLoginCode())) { + Long count = userMapper.selectCount(new LambdaQueryWrapper() + .eq(UserPO::getLoginCode, dto.getLoginCode())); + if (count > 0) { + throw new BusinessException("登录账号已存在"); + } + } + if (StringUtils.hasText(dto.getPhone())) { + Long count = userMapper.selectCount(new LambdaQueryWrapper() + .eq(UserPO::getPhone, dto.getPhone())); + if (count > 0) { + throw new BusinessException("手机号码已存在"); + } + } + UserPO user = new UserPO(); + user.setLoginCode(dto.getLoginCode()); + user.setPhone(dto.getPhone()); + user.setPassword(passwordEncoder.encode(dto.getPassword())); + user.setRealName(dto.getRealName()); + user.setRole("super"); + user.setStatus(1); + user.setPwdSecurityLevel(3); + user.setPwdUpdateTime(LocalDateTime.now()); + userMapper.insert(user); + + init.setAdminId(user.getId()); + init.setStep(1); + init.setUpdatedAt(LocalDateTime.now()); + sysInitMapper.updateById(init); + } + + @Transactional + public void saveCompany(InitCompanyDTO dto) { + SysInitPO init = getOrCreateInitRow(); + if (init.getStep() == null || init.getStep() < 1) { + throw new BusinessException("请先创建超级管理员"); + } + if (init.getStep() >= 3) { + throw new BusinessException("系统已完成初始化"); + } + init.setCompanyName(dto.getCompanyName()); + init.setStep(2); + init.setUpdatedAt(LocalDateTime.now()); + sysInitMapper.updateById(init); + } + + @Transactional + public LicenseSummaryVO activate(ActivateLicenseDTO dto) { + SysInitPO init = getOrCreateInitRow(); + if (init.getStep() == null || init.getStep() < 2) { + throw new BusinessException("请先完成前两步初始化"); + } + LicenseInfo info = licenseValidator.parseAndValidate(dto.getLicenseKey().trim()); + info = LicenseInfo.builder() + .subject(info.getSubject()) + .companyName(StringUtils.hasText(info.getCompanyName()) ? info.getCompanyName() : init.getCompanyName()) + .edition(info.getEdition()) + .machineFingerprint(info.getMachineFingerprint()) + .installationId(MachineFingerprintUtil.getMachineId()) + .jti(info.getJti()) + .issuer(info.getIssuer()) + .features(info.getFeatures()) + .issuedAt(info.getIssuedAt()) + .expiresAt(info.getExpiresAt()) + .rawLicenseKey(dto.getLicenseKey().trim()) + .build(); + licenseValidator.persistLicense(info); + init.setStep(3); + init.setUpdatedAt(LocalDateTime.now()); + sysInitMapper.updateById(init); + return toSummary(info); + } + + @Transactional + public LicenseSummaryVO updateLicense(ActivateLicenseDTO dto) { + if (!LicenseEnforcement.isEnforced()) { + throw new BusinessException("License 校验未启用,无法更新"); + } + LicenseInfo info = licenseValidator.parseAndValidate(dto.getLicenseKey().trim()); + licenseValidator.persistLicense(info); + return toSummary(info); + } + + public LicenseSummaryVO getLicenseSummary() { + LicenseInfo info = licenseValidator.getCachedLicense(); + if (info == null) { + throw new BusinessException("当前无有效 License"); + } + return toSummary(info); + } + + private LicenseSummaryVO toSummary(LicenseInfo info) { + LocalDateTime expiresAt = info.getExpiresAt() != null + ? LocalDateTime.ofInstant(info.getExpiresAt(), java.time.ZoneId.systemDefault()) + : null; + LocalDateTime issuedAt = info.getIssuedAt() != null + ? LocalDateTime.ofInstant(info.getIssuedAt(), java.time.ZoneId.systemDefault()) + : null; + Long daysRemaining = null; + String status = "active"; + if (expiresAt != null) { + daysRemaining = ChronoUnit.DAYS.between(LocalDateTime.now(), expiresAt); + if (info.isExpired()) { + status = "expired"; + } else if (daysRemaining <= 30) { + status = "expiring"; + } + } + return LicenseSummaryVO.builder() + .companyName(info.getCompanyName()) + .edition(info.getEdition()) + .machineFingerprint(info.getMachineFingerprint()) + .features(info.getFeatures() != null ? info.getFeatures() : List.of()) + .issuedAt(issuedAt) + .expiresAt(expiresAt) + .daysRemaining(daysRemaining) + .status(status) + .build(); + } + + private SysInitPO getOrCreateInitRow() { + SysInitPO init = sysInitMapper.selectById(INIT_ROW_ID); + if (init == null) { + init = new SysInitPO(); + init.setId(INIT_ROW_ID); + init.setStep(0); + init.setCreatedAt(LocalDateTime.now()); + init.setUpdatedAt(LocalDateTime.now()); + sysInitMapper.insert(init); + } + return init; + } +} diff --git a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/open/api/controller/OpenOrderController.java b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/open/api/controller/OpenOrderController.java index b45faf4d..01173927 100644 --- a/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/open/api/controller/OpenOrderController.java +++ b/ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/modules/open/api/controller/OpenOrderController.java @@ -6,6 +6,7 @@ import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import top.xyquan.ecomdmbbackend.common.annotation.RequireOpenScope; +import top.xyquan.ecomdmbbackend.modules.license.LicenseRequired; import top.xyquan.ecomdmbbackend.common.response.ApiResponse; import top.xyquan.ecomdmbbackend.modules.ecom.order.model.dto.BatchImportOrderDTO; import top.xyquan.ecomdmbbackend.modules.ecom.order.model.vo.BatchImportResultVO; @@ -32,6 +33,7 @@ public class OpenOrderController { } @PostMapping("/batch-import") + @LicenseRequired @RequireOpenScope(value = OpenApiScopeConstants.ORDER_IMPORT, description = "批量导入订单") @Operation(summary = "批量导入订单") public ApiResponse batchImportOrders(@Valid @RequestBody BatchImportOrderDTO dto) { diff --git a/ecom-dmb-backend/src/main/resources/application.yml b/ecom-dmb-backend/src/main/resources/application.yml index d47fc33b..e927fa7e 100644 --- a/ecom-dmb-backend/src/main/resources/application.yml +++ b/ecom-dmb-backend/src/main/resources/application.yml @@ -138,6 +138,16 @@ oss: file: access-domain: http://localhost:5666 # 本地文件访问域名 +# License 授权配置(开关与公钥见 LicenseEnforcement 源码硬编码) +ecom: + license: + license-key: ${ECOM_LICENSE_KEY:} + license-file: ${ECOM_LICENSE_FILE:config/license.key} + revocation-file: ${ECOM_LICENSE_REVOCATION_FILE:config/revoked.jti} + revalidate-interval: ${ECOM_LICENSE_REVALIDATE_INTERVAL:10} + online-revocation-check: ${ECOM_LICENSE_ONLINE_REVOKE:false} + license-server-url: ${ECOM_LICENSE_SERVER_URL:} + # 日志配置 logging: level: diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/system/license/apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/system/license/apis.ts new file mode 100644 index 00000000..4fcb421f --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/system/license/apis.ts @@ -0,0 +1,42 @@ +import type { LicenseDTO, LicenseVO } from './types'; + +import { baseRequestClient, requestClient } from '#/api/request'; + +/** 初始化相关 API(无需登录) */ + +export async function getInitStatusApi() { + return baseRequestClient.get('/init/status'); +} + +export async function createInitAdminApi(data: LicenseDTO.InitAdmin) { + return baseRequestClient.post('/init/admin', data); +} + +export async function saveInitCompanyApi(data: LicenseDTO.InitCompany) { + return baseRequestClient.post('/init/company', data); +} + +export async function getInitFingerprintApi() { + return baseRequestClient.get('/init/fingerprint'); +} + +export async function activateLicenseApi(data: LicenseDTO.ActivateLicense) { + return baseRequestClient.post( + '/init/activate', + data, + ); +} + +/** 已登录用户的 License 管理 API */ + +export async function getLicenseInfoApi() { + return requestClient.get('/system/license'); +} + +export async function updateLicenseApi(data: LicenseDTO.ActivateLicense) { + return requestClient.put('/system/license', data); +} + +export async function getSystemFingerprintApi() { + return requestClient.get('/system/fingerprint'); +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/system/license/index.ts b/ecom-dmb-frontend/apps/web-antd/src/api/system/license/index.ts new file mode 100644 index 00000000..daf76d51 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/system/license/index.ts @@ -0,0 +1,2 @@ +export * from './apis'; +export * from './types'; diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/index.ts b/ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/index.ts new file mode 100644 index 00000000..dfd513cd --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/index.ts @@ -0,0 +1,2 @@ +export * from './types.dto'; +export * from './types.vo'; diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/types.dto.ts b/ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/types.dto.ts new file mode 100644 index 00000000..f1bd00fc --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/types.dto.ts @@ -0,0 +1,21 @@ +/** + * License 模块 — 请求 DTO + */ +export namespace LicenseDTO { + export interface InitAdmin { + loginCode: string; + phone?: string; + password: string; + realName: string; + } + + export interface InitCompany { + companyName: string; + contactPhone?: string; + contactEmail?: string; + } + + export interface ActivateLicense { + licenseKey: string; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/types.vo.ts b/ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/types.vo.ts new file mode 100644 index 00000000..fe831350 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/system/license/types/types.vo.ts @@ -0,0 +1,32 @@ +/** + * License 模块 — 响应 VO + */ +export namespace LicenseVO { + /** 初始化状态 */ + export interface InitStatus { + initialized: boolean; + currentStep: number; + adminCreated: boolean; + companySaved: boolean; + licenseActivated: boolean; + } + + /** 机器指纹 */ + export interface Fingerprint { + fingerprint: string; + machineId: string; + hostname: string; + } + + /** License 摘要 */ + export interface LicenseSummary { + companyName?: string; + edition?: string; + machineFingerprint?: string; + features?: string[]; + issuedAt?: string; + expiresAt?: string; + daysRemaining?: number; + status?: string; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/router/guard.ts b/ecom-dmb-frontend/apps/web-antd/src/router/guard.ts index a1ad6d88..a19ca0e7 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/router/guard.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/router/guard.ts @@ -5,11 +5,45 @@ import { preferences } from '@vben/preferences'; import { useAccessStore, useUserStore } from '@vben/stores'; import { startProgress, stopProgress } from '@vben/utils'; -import { accessRoutes, coreRouteNames } from '#/router/routes'; +import { getInitStatusApi } from '#/api/system/license'; +import { INIT_PATH, accessRoutes, coreRouteNames } from '#/router/routes'; import { useAuthStore } from '#/store'; import { generateAccess } from './access'; +/** 缓存初始化状态,避免每次路由切换都请求 */ +let initStatusCache: { checked: boolean; initialized: boolean } = { + checked: false, + initialized: true, +}; + +/** 初始化完成后清除缓存(激活成功后可由页面调用) */ +export function resetInitStatusCache() { + initStatusCache = { checked: false, initialized: true }; +} + +async function ensureInitialized(toPath: string): Promise { + if (toPath === INIT_PATH || toPath.startsWith(`${INIT_PATH}/`)) { + return true; + } + if (!initStatusCache.checked) { + try { + const status = await getInitStatusApi(); + initStatusCache = { + checked: true, + initialized: status.initialized, + }; + } catch { + // 后端不可达时不阻断(本地纯前端开发) + initStatusCache = { checked: true, initialized: true }; + } + } + if (!initStatusCache.initialized) { + return { path: INIT_PATH, replace: true }; + } + return true; +} + /** * 通用守卫配置 * @param router @@ -50,6 +84,12 @@ function setupAccessGuard(router: Router) { const userStore = useUserStore(); const authStore = useAuthStore(); + // 未初始化则强制进入初始化向导(Init 路由本身跳过) + const initCheck = await ensureInitialized(to.path); + if (initCheck !== true) { + return initCheck; + } + // 基本路由,这些路由不需要进入权限拦截 if (coreRouteNames.includes(to.name as string)) { if (to.path === LOGIN_PATH && accessStore.accessToken) { diff --git a/ecom-dmb-frontend/apps/web-antd/src/router/routes/core.ts b/ecom-dmb-frontend/apps/web-antd/src/router/routes/core.ts index 949b0b65..e64bea0c 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/router/routes/core.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/router/routes/core.ts @@ -20,6 +20,9 @@ const fallbackNotFoundRoute: RouteRecordRaw = { path: '/:path(.*)*', }; +/** 系统初始化路径(未初始化时强制跳转) */ +export const INIT_PATH = '/init'; + /** 基本路由,这些路由是必须存在的 */ const coreRoutes: RouteRecordRaw[] = [ /** @@ -38,6 +41,17 @@ const coreRoutes: RouteRecordRaw[] = [ redirect: preferences.app.defaultHomePath, children: [], }, + { + name: 'Init', + path: INIT_PATH, + component: () => import('#/views/init/InitWizard.vue'), + meta: { + hideInBreadcrumb: true, + hideInMenu: true, + hideInTab: true, + title: '系统初始化', + }, + }, { component: AuthPageLayout, meta: { diff --git a/ecom-dmb-frontend/apps/web-antd/src/router/routes/index.ts b/ecom-dmb-frontend/apps/web-antd/src/router/routes/index.ts index b9a00b80..704b8e7f 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/router/routes/index.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/router/routes/index.ts @@ -2,7 +2,7 @@ import type { RouteRecordRaw } from 'vue-router'; import { mergeRouteModules, traverseTreeValues } from '@vben/utils'; -import { coreRoutes, fallbackNotFoundRoute } from './core'; +import { coreRoutes, fallbackNotFoundRoute, INIT_PATH } from './core'; const dynamicRouteFiles = import.meta.glob('./modules/**/*.ts', { eager: true, @@ -41,4 +41,4 @@ const routes: RouteRecordRaw[] = [ /** 有权限校验的路由列表,包含动态路由 */ const accessRoutes = [...dynamicRoutes]; -export { accessRoutes, coreRouteNames, routes }; +export { accessRoutes, coreRouteNames, INIT_PATH, routes }; diff --git a/ecom-dmb-frontend/apps/web-antd/src/router/routes/modules/system.ts b/ecom-dmb-frontend/apps/web-antd/src/router/routes/modules/system.ts index 8e470d79..0f404651 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/router/routes/modules/system.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/router/routes/modules/system.ts @@ -63,6 +63,16 @@ const routes: RouteRecordRaw[] = [ requiresAuth: true, }, }, + { + name: 'SystemLicense', + path: '/platform-admin/license', + component: () => import('#/views/system/license/LicenseInfo.vue'), + meta: { + icon: 'lucide:key-round', + title: 'License 管理', + requiresAuth: true, + }, + }, ]; export default routes; diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepAdmin.vue b/ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepAdmin.vue new file mode 100644 index 00000000..75d98f34 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepAdmin.vue @@ -0,0 +1,85 @@ + + + diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepCompany.vue b/ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepCompany.vue new file mode 100644 index 00000000..31aecb6b --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepCompany.vue @@ -0,0 +1,77 @@ + + + diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepLicense.vue b/ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepLicense.vue new file mode 100644 index 00000000..9fa824ad --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/views/init/InitStepLicense.vue @@ -0,0 +1,103 @@ + + + diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/init/InitWizard.vue b/ecom-dmb-frontend/apps/web-antd/src/views/init/InitWizard.vue new file mode 100644 index 00000000..3b15fc0d --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/views/init/InitWizard.vue @@ -0,0 +1,91 @@ + + + diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/init/components/FingerprintDisplay.vue b/ecom-dmb-frontend/apps/web-antd/src/views/init/components/FingerprintDisplay.vue new file mode 100644 index 00000000..acf37f80 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/views/init/components/FingerprintDisplay.vue @@ -0,0 +1,56 @@ + + + diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/system/license/FingerprintInfo.vue b/ecom-dmb-frontend/apps/web-antd/src/views/system/license/FingerprintInfo.vue new file mode 100644 index 00000000..6602de4a --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/views/system/license/FingerprintInfo.vue @@ -0,0 +1,46 @@ + + + diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/system/license/LicenseInfo.vue b/ecom-dmb-frontend/apps/web-antd/src/views/system/license/LicenseInfo.vue new file mode 100644 index 00000000..bebebaf5 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/views/system/license/LicenseInfo.vue @@ -0,0 +1,160 @@ + + + diff --git a/ecom-license/.gitignore b/ecom-license/.gitignore new file mode 100644 index 00000000..72519ac2 --- /dev/null +++ b/ecom-license/.gitignore @@ -0,0 +1,23 @@ +# 依赖(pnpm workspace 根目录 + 子包软链) +node_modules/ + +# 构建产物 +dist/ +*.tsbuildinfo + +# 环境变量与密钥(勿提交) +.env +.env.* +!.env.example +server/keys/*.pem + +# 日志 +logs/ +*.log +pnpm-debug.log* + +# 系统/编辑器 +.DS_Store +.idea/ +.vscode/ +*.swp diff --git a/ecom-license/.npmrc b/ecom-license/.npmrc new file mode 100644 index 00000000..20be1928 --- /dev/null +++ b/ecom-license/.npmrc @@ -0,0 +1,2 @@ +# 允许 bcrypt 等原生依赖执行 install 脚本 +enable-pre-post-scripts=true diff --git a/ecom-license/1.md b/ecom-license/1.md new file mode 100644 index 00000000..7b9e6cce --- /dev/null +++ b/ecom-license/1.md @@ -0,0 +1,434 @@ +我看完你这份**Ed25519 版 License 设计**了,这一版已经明显比你上一版(JWT + RSA)更专业,基本已经进入“可商用架构”层级了。 + +我还是按**架构评审的方式**给你拆: +👉 不讲表面优化,只讲**会影响你后期成本 / 安全 / 可维护性**的点 + +--- + +# ✅ 一、整体评价(先给结论) + +> ✅ 架构成熟度:**85分(可以上线)** +> ⚠️ 差的这 15 分:主要在 **抗破解能力 + 生命周期控制 + 可扩展性** + +--- + +# ✅ 二、这版比上一版“质变”的地方(做对的) + +### ✔ 1. 从 RSA → Ed25519(这是关键升级) + +👉 这个决策是对的 + +* 签名更小 +* 性能更好 +* 无 padding 坑 +* 更适合 License 这种高频校验场景 + +👉 这一点已经是“架构升级”,不是优化 + +--- + +### ✔ 2. 去掉 JWT,改自定义结构 + +你现在: + +```json +{ + "payload": "...", + "signature": "..." +} +``` + +👉 这是正确方向: + +* 去掉 JWT 历史坑(alg / 解析差异) +* 结构完全可控 +* 更适合 License 场景 + +--- + +### ✔ 3. 引入 AES 加密(GCM) + +👉 很加分的一点 + +你已经做到: + +> “不仅不能改,还看不懂” + +这已经是: + +```text +签名(防篡改) + 加密(防分析) +``` + +👉 商业软件常规做法 + +--- + +### ✔ 4. LicenseManager 分层设计(非常好) + +```text +LicenseManager + ├── load + ├── verify + ├── decrypt + ├── cache +``` + +👉 说明你已经在做: + +* 生命周期管理 +* 统一入口 + +👉 这是“工程能力”的体现 + +--- + +# ⚠️ 三、关键问题(这一版的“隐患点”) + +下面这些才是你现在**真正需要改的** + +--- + +# ❗问题1:AES Key 放在客户端 = “伪加密” + +你现在: + +> AES key 内置在服务端代码 + +--- + +## ⚠️ 本质问题 + +```text +攻击者 = 有代码 +→ 就有 key +→ 就能解密 +``` + +👉 所以: + +> ❗这只是“增加难度”,不是安全 + +--- + +## ✅ 改进建议(分级) + +### ✔ 低成本优化(推荐你现在做) + +```text +key = hash(machineId + salt) +``` + +👉 每台机器不同 + +--- + +### ✔ 中级方案 + +```text +key = 服务端激活时下发 +``` + +👉 不写死 + +--- + +### ✔ 高级方案(企业级) + +```text +key = 动态生成 + 混淆 + 分段存储 +``` + +--- + +# ❗问题2:你“只在初始化时验签”(不够) + +你现在: + +> init 时验证 → 后续只用缓存 + +--- + +## ⚠️ 风险 + +攻击者可以: + +* hook verify 方法 +* patch init 逻辑 +* 修改内存对象 + +👉 然后: + +> 永远有效 + +--- + +## ✅ 正确做法(必须改) + +👉 增加: + +```text +1. 定时重新验签(例如 5~10 分钟) +2. 关键操作前轻量校验 +``` + +--- + +# ❗问题3:功能校验点太少(严重) + +你现在: + +> 只在“订单导入接口”校验 + +--- + +## ⚠️ 问题 + +攻击者可以: + +* 直接绕 controller +* 或改调用路径 + +--- + +## ✅ 正确做法 + +👉 必须: + +```text +License → Feature Gate → Service 层 +``` + +例如: + +```java +if (!license.hasFeature("order-import")) { + throw new ForbiddenException(); +} +``` + +👉 不要只放在 controller + +--- + +# ❗问题4:机器指纹还是“硬绑定”(老问题) + +你现在: + +```text +cpu + mac + disk → hash +``` + +--- + +## ⚠️ 现实问题 + +* 云服务器 → 会变 +* docker → 会变 +* 虚拟机 → 不稳定 + +👉 结果: + +> ❗客户频繁失效 + +--- + +## ✅ 建议(你这一版必须改) + +👉 改为: + +```text +machineId = 安装时生成 UUID +``` + +再: + +```text +fingerprint = hash(uuid + 部分硬件信息) +``` + +--- + +# ❗问题5:没有 License 吊销机制(依然缺) + +你现在: + +> 完全离线 + +--- + +## ⚠️ 风险 + +* 客户退款 +* License 泄露 +* 被破解传播 + +👉 你无法控制 + +--- + +## ✅ 必须补 + +```json +{ + "jti": "license-id" +} +``` + +👉 + 可选: + +```text +定期请求 License Server 校验 +``` + +--- + +# ❗问题6:没有“抗复制机制” + +现在可以: + +```text +复制: +- DB +- license 文件 +``` + +👉 到另一台机器 + +--- + +## ⚠️ 如果指纹被绕: + +> 完全成功 + +--- + +## ✅ 建议 + +增加: + +* installId +* 激活记录 +* 最大激活次数 + +--- + +# ❗问题7:加密顺序可以优化 + +你现在: + +```text +payload → AES → sign +``` + +--- + +## 更推荐: + +```text +payload → sign → encrypt +``` + +👉 为什么? + +* 签名保护“原始数据” +* 加密保护“整体结构” + +👉 更标准(类似 TLS 思路) + +--- + +# ❗问题8:缺少“反调试 / 防hook” + +你现在: + +> 完全信任 JVM + +--- + +## ⚠️ 实际上: + +攻击者可以: + +* 用 Java Agent +* 用 ByteBuddy +* 改方法返回值 + +--- + +## ✅ 建议(至少做一点) + +* 校验关键类 hash +* 检测 debug 模式 +* 方法多点校验(不要单点) + +--- + +# ✅ 四、推荐你升级后的结构(最终版) + +我帮你整理一个更合理的👇 + +--- + +## License 结构 + +```json +{ + "data": "AES加密内容", + "signature": "Ed25519" +} +``` + +--- + +## payload(解密后) + +```json +{ + "companyId": "xxx", + "edition": "enterprise", + "expireAt": 1234567890, + "features": ["order-import"], + "machineId": "xxx", + "jti": "xxx" +} +``` + +--- + +## 核心机制 + +| 模块 | 建议 | +| -- | ---------- | +| 签名 | Ed25519 | +| 加密 | AES-GCM | +| 校验 | 启动 + 定时 | +| 指纹 | UUID + 软绑定 | +| 控制 | Service 层 | +| 吊销 | jti + 在线校验 | + +--- + +# ✅ 五、最终结论(很直接) + +你现在这版: + +> ✅ 已经不是“练手设计”,而是“可卖钱的版本” + +但: + +> ❗ 还没到“抗破解级” + +--- + +# 👉 如果你下一步想做到“商业对抗级” + +我可以帮你补这三块(这才是真正的差距): + +1. ✅ License 混淆(防逆向) +2. ✅ 动态校验(防 patch) +3. ✅ 多点校验(防绕过) + +你可以直接说: + +👉 **“帮我做一版抗破解 license(对抗用户逆向)”** diff --git a/ecom-license/DESIGN.md b/ecom-license/DESIGN.md index e9390d4a..8e30c9b6 100644 --- a/ecom-license/DESIGN.md +++ b/ecom-license/DESIGN.md @@ -1,1431 +1,298 @@ -# Ecom-DMB 授权许可与系统初始化设计方案 +# Ecom-DMB License 实施规格 -> **v2 变更(2026-05)**:License 授权管理平台的管理端由 **Vue Web 后台** 改为 **CLI 命令行工具**。NestJS 后端与 REST API 保持不变,运营方通过 `ecom-license` CLI 完成客户管理、签发/吊销 License 等操作,更适合运维、脚本化与 CI 集成。 +> **v3** · Ed25519 JWT(`alg: EdDSA`)· payload **不加密** · Controller AOP + Service Feature Gate · 本地离线为主 +> 架构评审对照见 [`1.md`](./1.md)。本文只保留**开工所需**的决策、契约与分阶段清单。 -## 1. 概述 +--- -### 1.1 目标 +## 1. 目标与边界 -Ecom-DMB 支持 **SaaS 部署** 和 **私有部署** 两种模式,所有模式均需通过 License 授权才能正常使用。系统**首次运行**时必须完成初始化(管理员创建 + License 激活),激活后方可使用订单导入等受限功能。 +| 项 | 规格 | +|----|------| +| 部署 | 私有部署(绑指纹)/ SaaS(指纹 `*`) | +| 授权粒度 | 每套部署 1 个 License | +| 受限能力 | `order-import`(订单批量导入 + 导入任务创建) | +| 校验层次 | `@LicenseRequired`(Controller)+ `LicenseFeatureGuard`(Service) | +| 运行时 | 请求:内存轻量 `check()`;后台:每 10min `fullValidate()` | +| 本地默认 | `ecom.license.enabled=false`,生产 `ECOM_LICENSE_ENABLED=true` | -### 1.2 授权策略 +**首版不做**:自定义 License 格式、AES 加密、反调试/防 Hook、NTP 拒绝请求(仅告警日志)。 -| 项目 | 说明 | +--- + +## 2. 实施阶段(按顺序) + +### Phase 1 — 主应用后端 `ecom-dmb-backend` ⬅ 先做 + +- [ ] SQL:`sys_init`、`sys_license`(`sql/migration/V20260528__sys_license_init.sql`) +- [ ] `modules/license/` 核心类(见 §4.1) +- [ ] `application.yml` + `pom` 增加 `nimbus-jose-jwt` +- [ ] `SecurityConfig` 放行 `/init/**`;`enabled=false` 时全跳过 +- [ ] 接入导入链路(见 §4.5) +- [ ] 单测:验签、指纹、feature、吊销 jti + +### Phase 2 — 主应用前端 `ecom-dmb-frontend` + +- [ ] `views/init/*` 三步向导 +- [ ] `views/system/license/*` 信息查看 + 续期 + 指纹展示 +- [ ] 路由守卫:未初始化 → `/init` + +### Phase 3 — License 服务器 `ecom-license/server`(NestJS) + +- [ ] 客户/许可证 CRUD、签发、吊销、激活日志 +- [ ] `POST /api/licenses/generate` 用 `jose` + Ed25519 私钥签发 +- [ ] `GET /api/licenses/status?jti=` 供在线吊销同步(可选) + +### Phase 4 — CLI `ecom-license/cli` + +- [ ] `login` / `customer *` / `license generate|revoke|download` +- [ ] **优雅交互**:TTY 下向导式提问、表格/面板输出、加载动画;CI 用 `--json` / `--quiet` 零装饰(见 `DESIGN.reference.md` §E.1) +- [ ] 非交互模式供 CI(`--json` / `--quiet`) + +--- + +## 3. 核心契约 + +### 3.1 架构(一张图) + +``` +运营方: ecom-license CLI → NestJS → 签发 EdDSA JWT +客户方: Spring Boot LicenseValidator(验签+缓存)→ AOP + Service Gate → 仅拦截导入 + Vue 初始化向导 / License 设置页 +``` + +### 3.2 JWT + +**Header**:`{ "alg": "EdDSA", "typ": "JWT", "kid": "2026-v1" }` + +**Payload 必填字段**: + +| 字段 | 说明 | |------|------| -| 校验方式 | RSA 非对称签名 JWT,绑定机器指纹(安装 ID),本地离线校验为主 | -| 授权粒度 | 按**公司维度**授权,每套部署一个 License | -| 限制范围 | 仅限制**订单导入相关接口**,其他功能不做限制 | -| 受限制接口 | `POST /ec/order/batch-import`、`POST /ec/import-task/create` | -| License 内容 | 客户信息、版本类型、有效期、**机器指纹**、安装 ID、功能特性、jti | +| `sub` | 客户编号 | +| `company` | 公司名 | +| `machineFingerprint` | `FP-` + SHA256(machineId\|hostname);SaaS 填 `*` | +| `edition` | `trial` / `enterprise` / `unlimited` | +| `features` | `["order-import"]` | +| `jti` | 唯一 ID,吊销用 | +| `iss` | `ecom-license-server` | +| `iat` / `exp` | 标准 JWT 时间 | -### 1.3 关键概念 +**验签库**:主应用 `nimbus-jose-jwt`(与登录 `jjwt` 分离);签发 `jose`。 -| 概念 | 说明 | -|------|------| -| **License 服务器** | 运营方部署的授权管理平台(NestJS + **CLI**),用于签发和管理 License | -| **License JWT** | RS256 签名的 JWT Token,包含授权信息和机器指纹,不可篡改 | -| **机器指纹** | 根据系统 machine-id(`/etc/machine-id`)+ 主机名生成的唯一哈希值 | -| **安装 ID** | 系统 machine-id(Linux `/etc/machine-id`),由 systemd 在首次启动时自动生成,唯一标识一次 OS 安装 | -| **系统初始化** | 首次运行时的引导流程:创建管理员 + License 激活 | -| **激活** | License 与机器指纹绑定并生效的过程 | - ---- - -## 2. 总体架构 +### 3.3 机器指纹 ``` - 运营方 客户 - ┌──────────────────────────────────────────┐ ┌───────────────────────────────┐ - │ License 授权管理服务器 │ │ Ecom-DMB 主应用 │ - │ │ │ │ - │ ┌──────────────────┐ ┌─────────────┐ │ │ ┌─────────────────────────┐ │ - │ │ ecom-license CLI │ │ NestJS 后端 │ │ │ │ Spring Boot 后端 │ │ - │ │ (运营方本地/CI) │──▶│ REST API │ │ │ │ │ │ - │ │ │ │ │ │ │ │ · LicenseValidator │ │ - │ │ · customer * │ │ · 客户管理 │──┼─────┼──│ · MachineFingerprint │ │ - │ │ · license * │ │ · 签发License│ │ │ │ · InitController │ │ - │ │ · stats / login │ │ · 操作日志 │ │ │ │ · LicenseAspect │ │ - │ └──────────────────┘ └─────────────┘ │ │ └─────────────────────────┘ │ - └──────────────────────────────────────────┘ │ │ - │ ┌─────────────────────────┐ │ - │ │ Vue 3 前端 (Vben Admin) │ │ - │ │ · 初始化向导 / License 设置│ │ - │ └─────────────────────────┘ │ - └───────────────────────────────┘ +machineId = /etc/machine-id,否则 /etc/ecom-machine-id(首次写 UUID) +fingerprint = "FP-" + SHA256(machineId + "|" + hostname).toUpperCase() ``` -**管理端形态说明**: +### 3.4 License 加载优先级 -| 原方案 | 新方案 | 原因 | -|--------|--------|------| -| Vue 3 + Ant Design Vue 管理后台 | **Node.js CLI**(`ecom-license` 命令) | 运营操作低频、偏运维;CLI 便于 SSH/脚本/CI;无需维护第二套 Web UI | -| 浏览器登录后台 | `ecom-license login` + 本地 Token 缓存 | 与 API 认证一致,支持非交互 `--token` | -| 页面表单签发 | `ecom-license license generate` | 支持交互式向导 + 全参数非交互模式 | +| 时机 | 来源顺序 | +|------|----------| +| 启动/定时 revalidate | DB `sys_license` → 环境变量 `ECOM_LICENSE_KEY` → 文件 `config/license.key` | +| 激活后持久化 | 只信 DB;更新/续期写 DB 并刷新内存缓存 | -### 2.1 两种部署模式的 License 获取方式 +### 3.5 校验流程 ``` -私有部署模式: - 客户部署系统 → 初始化页面显示机器指纹 → 客户将指纹发给运营方 - → 运营方通过 `ecom-license` CLI 签发绑定该指纹的 License - → 客户输入 License Key → 系统校验通过 → 激活完成 - -SaaS 部署模式: - 运营方通过 CLI 签发一个不限指纹的 License(machineFingerprint 填 "*") - → 部署系统时直接配置 License → 初始化时自动完成激活 - → License 校验时跳过指纹比对 -``` - -**SaaS 模式指纹策略**:SaaS 环境通常有多台服务器负载均衡,且 IP/网络环境多变,不适合绑定具体硬件指纹。签发 License 时将 `machineFingerprint` 设置为特殊值 `*`,主应用在校验时检测到该值则跳过指纹比对,仅校验签名和有效期。 - ---- - -## 3. 系统初始化设计 - -### 3.1 初始化流程 - -系统启动时检测是否已初始化,未初始化则强制跳转到初始化向导。 - -``` -系统首次启动 - │ - ▼ -┌──────────────────┐ -│ 检测 License │──── 有 License ──▶ 正常进入系统 -│ 与初始化状态 │ -└────────┬─────────┘ - │ 未初始化 - ▼ -┌──────────────────────────────────────────┐ -│ Step 1: 创建超级管理员账号 │ -│ (用户名、密码、邮箱) │ -└────────────────┬─────────────────────────┘ - ▼ -┌──────────────────────────────────────────┐ -│ Step 2: 填写公司基本信息 │ -│ (公司名称、联系方式) │ -└────────────────┬─────────────────────────┘ - ▼ -┌──────────────────────────────────────────┐ -│ Step 3: License 激活 │ -│ │ -│ ┌────────────────────────────────────┐ │ -│ │ 机器指纹(只读显示): │ │ -│ │ FP-7A8D9F0E1B2C3D4E5F6... │ │ -│ │ ┌──────────────────────────────┐ │ │ -│ │ │ 请输入 License Key │ │ │ -│ │ └──────────────────────────────┘ │ │ -│ │ [激活] [离线激活说明] │ │ -│ └────────────────────────────────────┘ │ -│ │ -│ 说明:客户将机器指纹发给运营方,运营方通过 │ -│ `ecom-license license generate` 签发 License │ -└────────────────┬─────────────────────────┘ - ▼ -┌──────────────────────────────────────────┐ -│ License 校验 │ -│ · RSA 签名验证 │ -│ · 有效期校验 │ -│ · 机器指纹匹配校验 │ -│ · 全部通过 → 写入数据库 → 初始化完成 │ -└──────────────────────────────────────────┘ -``` - -### 3.2 初始化 API(主应用 Spring Boot 端) - -| 方法 | 路径 | 说明 | -|------|------|------| -| GET | `/api/init/status` | 获取初始化状态 | -| POST | `/api/init/admin` | 创建超级管理员(Step 1) | -| POST | `/api/init/company` | 保存公司信息(Step 2) | -| GET | `/api/init/fingerprint` | 获取当前机器指纹 | -| POST | `/api/init/activate` | 提交 License Key 完成激活(Step 3) | -| PUT | `/api/system/license` | **License 续期/更新(已激活后调用)** | -| GET | `/api/system/license` | **获取当前 License 信息** | -| GET | `/api/system/fingerprint` | **获取当前机器指纹(已激活后查看)** | - -#### `GET /api/init/status` 响应 - -```json -{ - "initialized": false, - "currentStep": 0, - "adminCreated": false, - "companySaved": false, - "licenseActivated": false -} -``` - -#### `GET /api/init/fingerprint` 响应 - -```json -{ - "fingerprint": "FP-A1B2C3D4E5F67890...", - "raw": { - "macAddress": "00:1a:2b:3c:4d:5e", - "cpuSerial": "BFEBFBFF00090672", - "diskSerial": "S3Z8NB0M123456", - "hostname": "ecom-server-01" - } -} -``` - -#### `POST /api/init/activate` 请求 - -```json -{ - "licenseKey": "eyJhbGciOiJSUzI1NiJ9..." -} -``` - -**校验逻辑**: -1. 用内置公钥验证 JWT 签名 -2. 校验 `exp` 是否过期 -3. 校验 JWT 中的 `machineFingerprint` 与当前机器指纹是否一致(除非指纹为 `*` 表示不限) -4. 校验通过 → 保存 License 到 `sys_license` 表 → 标记初始化完成 - -#### `PUT /api/system/license` 请求 - -```json -{ - "licenseKey": "eyJhbGciOiJSUzI1NiJ9..." -} -``` - -**说明**:与激活接口逻辑一致,但已激活状态下调用时不会重置初始化状态,仅更新 `sys_license` 表和内存缓存。前端在「系统设置 → License 信息」页面调用此接口。 - -#### `GET /api/system/license` 响应 - -```json -{ - "company": "某某科技有限公司", - "edition": "enterprise", - "machineFingerprint": "FP-A1B2C3D4E5F67890...", - "expiresAt": "2027-01-01T00:00:00Z", - "activatedAt": "2026-01-01T00:00:00Z", - "status": "active" -} -``` - -#### `GET /api/system/fingerprint` 响应 - -```json -{ - "fingerprint": "FP-A1B2C3D4E5F67890..." -} -``` - -**说明**:已激活后,用户可在「系统设置 → 机器指纹」页面查看当前指纹,用于迁移服务器时提供给运营方。 - -### 3.3 初始化前端页面(主应用 Vue 3 前端) - -初始化页面属于主应用的 `ecom-dmb-frontend`,在路由守卫中检测初始化状态。 - -``` -src/views/init/ -├── InitWizard.vue # 初始化向导容器(Step 步骤条) -├── InitStepAdmin.vue # Step 1: 创建管理员 -├── InitStepCompany.vue # Step 2: 公司信息 -├── InitStepLicense.vue # Step 3: License 激活(显示指纹 + 输入 License) -└── components/ - └── FingerprintDisplay.vue # 机器指纹展示组件(带复制功能) - -src/views/system/ -└── license/ # ← 新增:系统设置下的 License 相关页面 - ├── LicenseInfo.vue # License 信息查看 + 续期 - └── FingerprintInfo.vue # 机器指纹查看(用于迁移服务器) -``` - -**路由守卫逻辑**: - -```typescript -// router/index.ts -router.beforeEach(async (to) => { - if (to.path.startsWith('/init')) return true - - const initStatus = await initApi.getStatus() - if (!initStatus.initialized) { - return '/init' - } - return true -}) -``` - -### 3.4 主应用数据库设计 - -新增两张表: - -#### `sys_init` 初始化状态表 - -| 字段 | 类型 | 说明 | -|------|------|------| -| id | bigint PK | 主键(固定为 1,仅一行) | -| step | tinyint | 当前完成步骤:0=未开始 1=管理员 2=公司 3=已完成 | -| admin_id | bigint | 创建的超级管理员 ID | -| company_name | varchar(200) | 公司名称 | -| created_at | datetime | 创建时间 | -| updated_at | datetime | 更新时间 | - -> 该表为**单行表**,`id` 固定为 1,通过 `INSERT ... ON DUPLICATE KEY UPDATE` 或先删后插保证唯一性。 - -#### `sys_license` License 表(单行数据) - -| 字段 | 类型 | 说明 | -|------|------|------| -| id | bigint PK | 主键 | -| company_name | varchar(200) | License 中的公司名称 | -| edition | varchar(20) | 版本:trial / enterprise / unlimited | -| machine_fingerprint | varchar(100) | 绑定的机器指纹 | -| installation_id | varchar(64) | 安装 ID(首次运行时生成) | -| license_key | text | JWT License Token | -| issued_at | datetime | 签发时间 | -| expires_at | datetime | 过期时间 | -| activated_at | datetime | 激活时间 | -| is_active | tinyint | 是否有效 0=否 1=是 | -| created_at | datetime | 创建时间 | -| updated_at | datetime | 更新时间 | - ---- - -## 4. 机器指纹设计 - -### 4.1 指纹生成策略 - -机器指纹用于将 License 绑定到特定的部署实例,防止 License 被复制到其他机器使用。 - -**采用系统 machine-id + 主机名方案**: - -| 要素 | 来源 | 说明 | -|------|------|------| -| **系统 machine-id** | Linux `/etc/machine-id` | systemd 在首次启动时自动生成,不同 OS 安装不同;非 Linux 系统回退到随机 UUID | -| **主机名** | `InetAddress.getLocalHost().getHostName()` | 辅助指纹,方便识别 | - -**为什么用 `/etc/machine-id` 而不是自定义 UUID 文件?** - -| 攻击场景 | 自定义 UUID 文件 | 系统 `/etc/machine-id` | -|----------|-----------------|------------------------| -| 拷贝 DB + 配置文件到新机器 | 随文件一起复制,指纹校验通过 ❌ | 新机器有独立 machine-id,校验失败 ✅ | -| 整盘克隆(dd) | machine-id 被一并克隆,防不住 | 同左,整盘克隆不在防护范围 | -| 云镜像创建新实例 | 镜像自带 UUID 文件,所有实例相同 ❌ | 首次引导时 systemd 自动重新生成,每个实例不同 ✅ | - -> **结论**:使用系统 `/etc/machine-id` 能让**大部分实际克隆场景**(文件级别复制、云镜像复用)自动失效,且不需要引入额外组件。整盘克隆超出了客户端授权技术可防护的范围。 - -### 4.2 指纹算法 - -``` -machineId = 读取 /etc/machine-id(不存在则生成 UUID 并写入 /etc/ecom-machine-id 回退) -raw = machineId + "|" + hostname -fingerprint = "FP-" + SHA256(raw).toUpperCase() -``` - -### 4.3 Java 指纹采集实现 - -```java -public class MachineFingerprint { - private static final String SYSTEM_MACHINE_ID = "/etc/machine-id"; - private static final String FALLBACK_FILE = "/etc/ecom-machine-id"; - - public static String generate() { - String machineId = getMachineId(); - String hostname = getHostname(); - String raw = machineId + "|" + hostname; - String hash = DigestUtils.sha256Hex(raw); - return "FP-" + hash.toUpperCase(); - } - - public static String getMachineId() { - // 优先使用系统 machine-id - File sysFile = new File(SYSTEM_MACHINE_ID); - if (sysFile.exists()) { - try { - return new String(Files.readAllBytes(sysFile.toPath())).trim(); - } catch (IOException e) { - // fall through - } - } - // 回退到自定义 UUID 文件(非 Linux 系统 or 容器) - File fallback = new File(FALLBACK_FILE); - if (fallback.exists()) { - try { - return new String(Files.readAllBytes(fallback.toPath())).trim(); - } catch (IOException e) { - // fall through - } - } - // 首次运行:生成 UUID 写入回退文件 - String id = UUID.randomUUID().toString(); - try { - Files.write(fallback.toPath(), id.getBytes()); - } catch (IOException e) { - log.warn("无法写入 machine-id 文件: {}", e.getMessage()); - } - return id; - } -} -``` - -### 4.4 指纹在 License 中的作用 - -- License 签发时:运营方将客户提供的机器指纹写入 JWT Payload 的 `machineFingerprint` 字段 -- License 验证时:主应用计算当前机器指纹,与 JWT 中的指纹比对,不一致则拒绝 -- SaaS 模式:指纹设为 `*`,跳过比对 - -## 5. License 文件格式 - -采用 **RS256 签名的 JWT** 作为 License 载体。 - -### 5.1 JWT Payload 结构 - -```json -{ - "sub": "CUST-20260101-001", - "company": "某某科技有限公司", - "machineFingerprint": "FP-A1B2C3D4E5F67890123456789ABCDEF0", - "edition": "enterprise", - "issuedAt": "2026-01-01T00:00:00Z", - "expiresAt": "2027-01-01T00:00:00Z", - "features": ["order-import"], - "jti": "LIC-AABBCCDD-001", - "iss": "ecom-license-server", - "iat": 1767225600, - "exp": 1798761600 -} -``` - -### 5.2 字段说明 - -| 字段 | 必填 | 说明 | -|------|------|------| -| `sub` | 是 | 客户编号 | -| `company` | 是 | 客户公司名称 | -| `machineFingerprint` | 是 | 绑定的机器指纹(`FP-` 前缀 + SHA256 大写) | -| `edition` | 是 | 版本类型:`trial` / `enterprise` / `unlimited` | -| `expiresAt` | 是 | 过期时间 | -| `features` | 是 | 授权功能列表(目前只有 `order-import`) | -| `jti` | 是 | License 唯一编号 | -| `iss` | 是 | 签发者 | -| `iat` | 是 | 签发时间戳 | -| `exp` | 是 | 过期时间戳 | -| `issuedAt` | 否 | 签发时间(可读格式) | - -### 5.3 License JWT 的存储与加载机制 - -#### 存储方式 - -License JWT 支持三种来源,按优先级从高到低: - -| 优先级 | 来源 | 说明 | -|--------|------|------| -| 1(最高) | **数据库** `sys_license.license_key` | 初始化/激活时写入,运行时持久化 | -| 2 | **环境变量** `ECOM_LICENSE_KEY` | 容器/Docker 部署时注入,覆盖数据库 | -| 3 | **文件** `config/license.key` | 文件挂载,仅首次启动或备用兜底 | - -#### 完整的 License 存储与生命周期 - -``` -┌──────────────────────────────────────────────────────────┐ -│ License JWT 在哪里 │ -│ │ -│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ -│ │ 环境变量 │ │ 文件 │ │ 数据库 │ │ -│ │ ECOM_LICENSE │ │ config/ │ │ sys_license │ │ -│ │ _KEY │ │ license.key │ │ .license_key │ │ -│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │ -│ │ │ │ │ -│ └───────────┬───────┘ │ │ -│ │ │ │ -│ ▼ │ │ -│ ┌─────────────────┐ │ │ -│ │ 启动时加载到内存 │───────────────────┘ │ -│ │ (LicenseHolder) │ 写入(激活/更新时) │ -│ │ │ │ -│ │ LicenseInfo: │ │ -│ │ · jwtToken │ │ -│ │ · company │ │ -│ │ · edition │ │ -│ │ · expiresAt │ │ -│ │ · fingerprint │ │ -│ └────────┬────────┘ │ -│ │ │ -│ ▼ 每次请求只读内存,不读文件不查库 │ -│ ┌─────────────────┐ │ -│ │ AOP 切面校验 │ │ -│ │ · 是否过期 │ │ -│ │ · 指纹是否匹配 │ │ -│ └─────────────────┘ │ -└──────────────────────────────────────────────────────────┘ -``` - -#### 首次部署 vs 运行时 - -| 阶段 | License 来源 | 说明 | -|------|-------------|------| -| **首次启动(未初始化)** | 环境变量或文件 | 初始化前数据库无数据,从环境变量或文件读取,用于预激活 | -| **激活后** | 数据库 | 激活时将 License 写入 `sys_license` 表,此后任何来源都不再读取 | -| **License 更新** | 数据库 | 用户在系统设置页面上传新 License → 更新 `sys_license` 表 → 刷新内存缓存 | -| **容器重启** | 数据库 | 启动时重新从数据库加载到内存 | - -#### 关键原则 - -- **启动时一次加载**:Spring `@PostConstruct` / `ApplicationRunner` 中加载 License 到内存,后续请求不读文件、不查 DB -- **运行时内存缓存**:`LicenseValidator` 是 Spring 单例 Bean,持有 `LicenseInfo` 对象,每次请求直接从内存判断 -- **更新时刷新**:License 更新/续期时,同时更新 DB 和内存缓存 - ---- - -## 6. License 服务器 API 设计 - -### 6.1 认证 - -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | `/api/auth/login` | 管理员登录,返回 JWT Token | -| POST | `/api/auth/logout` | 退出登录 | - -### 6.2 仪表盘 - -| 方法 | 路径 | 说明 | -|------|------|------| -| GET | `/api/dashboard/stats` | 统计数据(客户数、许可证数、即将过期数) | - -### 6.3 客户管理 - -| 方法 | 路径 | 说明 | -|------|------|------| -| GET | `/api/customers` | 客户列表(分页) | -| POST | `/api/customers` | 创建客户 | -| GET | `/api/customers/:id` | 客户详情 | -| PUT | `/api/customers/:id` | 更新客户 | -| DELETE | `/api/customers/:id` | 删除客户 | -| GET | `/api/customers/:id/licenses` | 客户的许可证列表 | - -### 6.4 许可证管理 - -| 方法 | 路径 | 说明 | -|------|------|------| -| GET | `/api/licenses` | 许可证列表(分页) | -| GET | `/api/licenses/:id` | 许可证详情 | -| POST | `/api/licenses/generate` | **签发新 License(核心接口)** | -| POST | `/api/licenses/:id/revoke` | 吊销 License | -| GET | `/api/licenses/:id/download` | 下载 License 文件 | - -### 6.5 签发 License 接口 - -**请求** `POST /api/licenses/generate`: - -```json -{ - "customerId": 1, - "company": "某某科技有限公司", - "machineFingerprint": "FP-A1B2C3D4E5F67890...", - "edition": "enterprise", - "expiresAt": "2027-01-01T00:00:00Z", - "features": ["order-import"] -} -``` - -**响应**: - -```json -{ - "id": 1, - "licenseKey": "eyJhbGciOiJSUzI1NiJ9...(JWT Token)", - "edition": "enterprise", - "machineFingerprint": "FP-A1B2C3D4E5F67890...", - "expiresAt": "2027-01-01T00:00:00Z", - "status": "active" -} -``` - -### 6.6 CLI 命令与 API 映射 - -CLI 是 License 服务器的**唯一管理端**,不单独提供 Web UI。所有运营操作通过 `ecom-license` 命令调用上述 REST API。 - -#### 6.6.1 命令总览 - -``` -ecom-license -├── login [--url] [--username] [--password] # 登录,Token 写入本地配置 -├── logout # 清除本地 Token -├── whoami # 当前 API 地址与登录用户 -│ -├── stats [--json] # GET /api/dashboard/stats -│ -├── customer -│ ├── list [--page] [--size] [--json] # GET /api/customers -│ ├── create [--code] [--name] ... # POST /api/customers(缺参时交互) -│ ├── show [--json] # GET /api/customers/:id -│ ├── update [--name] ... # PUT /api/customers/:id -│ ├── delete [--force] # DELETE /api/customers/:id -│ └── licenses [--json] # GET /api/customers/:id/licenses -│ -└── license - ├── list [--customer-id] [--status] [--json] # GET /api/licenses - ├── show [--json] # GET /api/licenses/:id - ├── generate [options] # POST /api/licenses/generate - ├── revoke [--reason] # POST /api/licenses/:id/revoke - └── download [-o license.key] # GET /api/licenses/:id/download -``` - -**全局选项**(所有子命令可用): - -| 选项 | 环境变量 | 说明 | -|------|----------|------| -| `--url ` | `ECOM_LICENSE_API_URL` | API 根地址,如 `https://license.example.com` | -| `--token ` | `ECOM_LICENSE_TOKEN` | 跳过本地配置,直接带 Bearer Token(CI/脚本) | -| `--json` | — | JSON 输出,便于 `jq` 管道 | -| `--quiet` | — | 仅输出结果字段(如 License Key、文件路径) | -| `--yes` | — | 跳过确认(delete、revoke 等) | - -#### 6.6.2 本地配置 - -默认路径:`~/.config/ecom-license/config.json`(可通过 `ECOM_LICENSE_CONFIG` 覆盖)。 - -```json -{ - "apiUrl": "http://localhost:3100", - "token": "eyJhbGciOiJIUzI1NiIs...", - "username": "admin", - "expiresAt": "2026-05-25T12:00:00Z" -} -``` - -优先级:**命令行 flag > 环境变量 > 配置文件**。 - -#### 6.6.3 交互式 vs 非交互式 - -| 场景 | 推荐方式 | 示例 | -|------|----------|------| -| 日常运维 SSH | 交互式 | `ecom-license login` → `ecom-license license generate`(Inquirer 逐步提问) | -| CI / Ansible | 全非交互 | 环境变量注入 Token + 全参数 `generate` | -| 脚本批量 | `--json` + `jq` | `ecom-license customer list --json \| jq '.items[].code'` | - -**签发 License(非交互示例)**: - -```bash -ecom-license license generate \ - --customer-id 1 \ - --company "某某科技有限公司" \ - --fingerprint "FP-A1B2C3D4E5F67890..." \ - --edition enterprise \ - --expires-at 2027-01-01 \ - --features order-import \ - --json -``` - -**SaaS 不限指纹**: - -```bash -ecom-license license generate \ - --customer-id 2 \ - --company "SaaS 平台" \ - --fingerprint "*" \ - --edition unlimited \ - --expires-at 2028-01-01 -``` - -#### 6.6.4 输出规范 - -**人类可读(默认)**:使用 `chalk` 着色;表格用 `cli-table3`;成功/错误明确分行。 - -**JSON 模式**(`--json`):统一 envelope: - -```json -{ - "ok": true, - "data": { }, - "meta": { "command": "license generate", "apiUrl": "http://localhost:3100" } -} -``` - -错误时 `ok: false`,`error: { "code": "...", "message": "..." }`,进程 exit code 非 0。 - -**安静模式**(`--quiet`):`generate` 只打印 JWT 一行;`download` 只打印文件路径。 - -#### 6.6.5 CLI 技术栈 - -| 项 | 选型 | 说明 | -|----|------|------| -| 运行时 | Node.js ≥ 20 | 与 NestJS 同生态 | -| 命令框架 | **Commander.js** | 子命令、全局 option | -| 交互 | **@inquirer/prompts** | login、generate 缺参时提问 | -| HTTP | **axios** | 与 server 共用类型时可抽 `packages/shared` | -| 配置 | **conf** 或自研 JSON | 读写 `~/.config/ecom-license` | -| 打包 | **tsup** | 产出单文件 `dist/cli.js`,npm bin `ecom-license` | - -#### 6.6.6 典型 CLI 工作流 - -**新客户私有部署(对应 12.1)**: - -```bash -ecom-license login --url https://license.internal -ecom-license customer create --name "某某科技" --contact-name "张三" -ecom-license license generate # 交互输入客户提供的 FP-xxx -ecom-license license download -o customer-001.key -# 将 Key 或 .key 文件发给客户 -``` - -**续期(对应 12.3)**: - -```bash -ecom-license customer licenses 1 -ecom-license license generate \ - --customer-id 1 \ - --fingerprint "FP-原有指纹..." \ - --edition enterprise \ - --expires-at 2028-01-01 -``` - -**吊销**: - -```bash -ecom-license license revoke 42 --reason "合同终止" --yes +导入请求 + → LicenseAspect: check() + requireFeature(ORDER_IMPORT) [enabled 时] + → Service: licenseFeatureGuard.require(ORDER_IMPORT) + → 内存判断: 有 License / 未过期 / 指纹匹配或* / jti 未吊销 / 含 order-import + +后台定时(不进请求链路) + → scheduledRevalidate: fullValidate,失败清空 cachedLicense + → scheduledOnlineRevocationSync: 可选,查 License Server 同步 jti 黑名单 + → scheduledNtpCheck: 仅日志告警 ``` --- -## 7. License 服务器数据库设计 +## 4. Phase 1 后端明细 -### 7.1 管理员表 `lc_admin` - -| 字段 | 类型 | 说明 | -|------|------|------| -| id | bigint PK | 主键 | -| username | varchar(50) | 用户名 | -| password | varchar(255) | BCrypt 加密密码 | -| nickname | varchar(50) | 昵称 | -| status | tinyint | 状态:0=禁用 1=启用 | -| created_at | datetime | 创建时间 | -| updated_at | datetime | 更新时间 | - -### 7.2 客户表 `lc_customer` - -| 字段 | 类型 | 说明 | -|------|------|------| -| id | bigint PK | 主键 | -| code | varchar(50) UK | 客户编码(如 CUST-20260101-001) | -| name | varchar(200) | 公司名称 | -| contact_name | varchar(50) | 联系人 | -| contact_phone | varchar(20) | 联系电话 | -| contact_email | varchar(100) | 联系邮箱 | -| status | tinyint | 状态:0=禁用 1=启用 | -| remark | text | 备注 | -| created_at | datetime | 创建时间 | -| updated_at | datetime | 更新时间 | - -### 7.3 许可证表 `lc_license` - -| 字段 | 类型 | 说明 | -|------|------|------| -| id | bigint PK | 主键 | -| customer_id | bigint FK | 关联客户 ID | -| license_key | text | JWT License Token | -| edition | varchar(20) | 版本:trial / enterprise / unlimited | -| machine_fingerprint | varchar(100) | 绑定的机器指纹 | -| features | varchar(500) | 功能特性列表(JSON 数组) | -| status | varchar(20) | 状态:active / revoked / expired | -| issued_at | datetime | 签发时间 | -| expires_at | datetime | 过期时间 | -| revoked_at | datetime | 吊销时间(可空) | -| max_activations | int | 允许的最大激活次数(null 为不限) | -| activation_count | int | 当前已激活次数 | -| created_at | datetime | 创建时间 | -| updated_at | datetime | 更新时间 | - -### 7.4 激活日志表 `lc_activation_log` - -| 字段 | 类型 | 说明 | -|------|------|------| -| id | bigint PK | 主键 | -| license_id | bigint FK | 关联许可证 ID | -| machine_fingerprint | varchar(100) | 激活时的机器指纹 | -| installation_id | varchar(64) | 激活时的安装 ID | -| hostname | varchar(200) | 激活时的机器主机名 | -| ip | varchar(50) | 请求 IP | -| action | varchar(20) | 动作:activate / deactivate | -| created_at | datetime | 创建时间 | - -### 7.5 操作日志表 `lc_oper_log` - -| 字段 | 类型 | 说明 | -|------|------|------| -| id | bigint PK | 主键 | -| admin_id | bigint | 操作管理员 ID | -| action | varchar(50) | 操作类型 | -| target_type | varchar(50) | 操作对象类型(customer / license) | -| target_id | bigint | 操作对象 ID | -| detail | text | 操作详情(JSON) | -| ip | varchar(50) | 请求 IP | -| created_at | datetime | 创建时间 | - ---- - -## 8. 主应用 License 校验设计(Spring Boot) - -### 8.1 新增模块结构 +### 4.1 模块文件 ``` -ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/ -└── modules/ - └── license/ - ├── LicenseAutoConfig.java # 自动配置 - ├── LicenseProperties.java # 配置属性(public-key, license-key, license-file) - ├── LicenseValidator.java # 核心:加载、缓存、校验 License(Spring 单例) - ├── LicenseAspect.java # AOP 切面(拦截导入接口) - ├── LicenseRequired.java # 注解定义 - ├── LicenseInfo.java # License 解析结果(内存缓存对象) - ├── InitializeService.java # 初始化服务(创建管理员 + 公司 + 激活) - ├── MachineFingerprintUtil.java # 机器指纹生成工具 - ├── entity/ - │ ├── SysInit.java # 初始化状态实体 - │ └── SysLicense.java # License 实体 - ├── mapper/ - │ ├── SysInitMapper.java - │ └── SysLicenseMapper.java - ├── controller/ - │ └── InitController.java # 初始化 API - └── exception/ - └── LicenseException.java +modules/license/ +├── LicenseProperties.java +├── LicenseAutoConfig.java +├── LicenseValidator.java # load / fullValidate / check / requireFeature / 定时任务 +├── LicenseInfo.java +├── LicenseFeature.java # ORDER_IMPORT("order-import") +├── LicenseFeatureGuard.java +├── LicenseRequired.java +├── LicenseAspect.java +├── MachineFingerprintUtil.java +├── InitializeService.java +├── LicenseException.java +├── entity/SysInit.java, SysLicense.java +├── mapper/SysInitMapper.java, SysLicenseMapper.java +└── controller/ + ├── InitController.java # /init/* + └── SystemLicenseController.java # /system/license, /system/fingerprint ``` -### 8.2 License 校验流程(运行时的每次请求) +### 4.2 数据库 -``` -请求到达导入接口(/batch-import 或 /import-task/create) - │ - ▼ -┌──────────────────────────────────────┐ -│ LicenseAspect 拦截 @LicenseRequired │ -└──────────┬───────────────────────────┘ - ▼ -┌──────────────────────────────────────┐ -│ 1. 从内存缓存读取 LicenseInfo │ ← 仅读内存,不读文件/不查库 -│ (启动时已加载完毕) │ -└──────────┬───────────────────────────┘ - ▼ -┌──────────────────────────────────────┐ -│ 2. 是否有 LicenseInfo ? │──── 无 ──▶ 拒绝(未激活) -└──────────┬───────────────────────────┘ - ▼ 有 -┌──────────────────────────────────────┐ -│ 3. 校验有效期(exp) │──── 过期 ──▶ 拒绝 -│ 与当前服务器时间比对 │ -└──────────┬───────────────────────────┘ - ▼ 有效 -┌──────────────────────────────────────┐ -│ 4. 校验机器指纹 │──── 不匹配 ──▶ 拒绝 -│ (LicenseInfo.fingerprint │ -│ vs MachineFingerprintUtil.generate())│ -└──────────┬───────────────────────────┘ - ▼ 匹配 -┌──────────────────────────────────────┐ -│ 5. 校验吊销列表(内存黑名单 jti) │──── 已吊销 ──▶ 拒绝 -└──────────┬───────────────────────────┘ - ▼ 未吊销 -┌──────────────────────────────────────┐ -│ 6. 放行请求 │ -│ 执行导入 │ -└──────────────────────────────────────┘ -``` +**`sys_init`**(单行 `id=1`):`step`(0~3)、`admin_id`、`company_name`、时间戳 -**注意**: -- RSA 验签只在**首次加载时**做一次,运行时请求直接比对内存中的 `LicenseInfo` 字段 -- NTP 时间偏差校验不在此链路中执行,改为启动时 + 定时任务(见 8.6 节) -- 本地吊销黑名单在启动时加载到内存,运行时只读匹配,不产生 I/O +**`sys_license`**:`company_name`、`edition`、`machine_fingerprint`、`installation_id`、`license_key`(text)、`jti`、`issued_at`、`expires_at`、`activated_at`、`is_active` -### 8.3 配置项 `application.yml` +> 现有环境可 `INSERT sys_init (id,step) VALUES (1,3)` 跳过初始化门禁(仅开发)。 + +### 4.3 配置 `application.yml` ```yaml ecom: license: - enabled: true # 是否启用 license 校验 - public-key: | # RSA 公钥 - -----BEGIN PUBLIC KEY----- - MIIBIjANBgkqhkiG9w0BAQEFAAOC... - -----END PUBLIC KEY----- - license-key: "" # License JWT(优先于文件) - license-file: config/license.key # License 文件路径 - max-clock-skew: 5 # 与 NTP 最大时钟偏差(分钟),超时拒绝 - ntp-server: "pool.ntp.org" # NTP 时间源,用于校验本地时间是否被篡改 - ntp-check-interval: 10 # NTP 定时检测间隔(分钟),启动时立即检查一次 - revocation-file: config/revoked.jti # 吊销黑名单文件路径(每行一个 jti) + enabled: ${ECOM_LICENSE_ENABLED:false} + public-key: ${ECOM_LICENSE_PUBLIC_KEY:} # Ed25519 SPKI PEM,支持 public-keys[]+kid + license-key: ${ECOM_LICENSE_KEY:} + license-file: ${ECOM_LICENSE_FILE:config/license.key} + revocation-file: ${ECOM_LICENSE_REVOCATION_FILE:config/revoked.jti} + revalidate-interval: ${ECOM_LICENSE_REVALIDATE_INTERVAL:10} + online-revocation-check: ${ECOM_LICENSE_ONLINE_REVOKE:false} + license-server-url: ${ECOM_LICENSE_SERVER_URL:} ``` -> **注意**:`@Scheduled` 定时任务需要在某个 `@Configuration` 类上添加 `@EnableScheduling` 注解。建议在 `LicenseAutoConfig` 上配置。 +### 4.4 HTTP API(无 `/api` 前缀,与现网一致) -### 8.4 AOP 注解 +| 方法 | 路径 | 鉴权 | 说明 | +|------|------|------|------| +| GET | `/init/status` | 公开 | 初始化进度 | +| POST | `/init/admin` | 公开 | Step1 超管 | +| POST | `/init/company` | 公开 | Step2 公司 | +| GET | `/init/fingerprint` | 公开 | 机器指纹 | +| POST | `/init/activate` | 公开 | `{ "licenseKey": "..." }` | +| GET | `/system/license` | 登录 | 当前 License 摘要 | +| PUT | `/system/license` | 登录 | 续期/更新 | +| GET | `/system/fingerprint` | 登录 | 查看指纹(迁机用) | -```java -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface LicenseRequired { - /** - * 是否校验机器指纹(默认 true) - */ - boolean checkFingerprint() default true; -} +### 4.5 导入链路接入点(必须) -// 使用方式 -@PostMapping("/batch-import") -@RequirePermission("ecom:order:import") -@LicenseRequired -public ApiResponse batchImportOrders(...) { ... } +| 层 | 类 | 动作 | +|----|-----|------| +| Controller | `OrderController`、`OpenOrderController` | `@LicenseRequired` | +| Controller | `ImportTaskController` | `@LicenseRequired` | +| Service | `OrderServiceImpl.batchImportOrders` | `featureGuard.require` | +| Service | `ImportTaskServiceImpl.createImportTask` | `featureGuard.require` | +| Service | `ImportTaskProcessorServiceImpl`(`order` 类型) | `featureGuard.require` | + +### 4.6 `enabled` 行为 + +| enabled | 行为 | +|---------|------| +| `false` | AOP / Guard 直接放行(本地开发) | +| `true` | 无有效 License → 导入接口 403 + 业务错误码 | + +--- + +## 5. Phase 2 前端明细 -@PostMapping("/create") -@RequirePermission("data:import") -@LicenseRequired -public ApiResponse createImportTask(...) { ... } ``` +apps/web-antd/src/views/ +├── init/ +│ ├── InitWizard.vue +│ ├── InitStepAdmin.vue +│ ├── InitStepCompany.vue +│ ├── InitStepLicense.vue +│ └── components/FingerprintDisplay.vue +└── system/license/ + ├── LicenseInfo.vue + └── FingerprintInfo.vue -### 8.5 License JWT 验证逻辑 - -```java -/** - * License 验证器(Spring 单例,启动时加载,运行时只读内存) - */ -@Component -public class LicenseValidator { - - private final PublicKey publicKey; - private final SysLicenseMapper licenseMapper; - private final LicenseProperties properties; - - /** - * 内存缓存的 License 信息 - */ - private volatile LicenseInfo cachedLicense; - - /** - * 吊销列表黑名单(jti 集合) - */ - private final Set revokedJtiSet = new ConcurrentHashSet<>(); - - /** - * NTP 时间偏差缓存(毫秒) - */ - private volatile long clockSkewMs = 0; - - /** - * 上次 NTP 检测时间 - */ - private volatile long lastNtpCheck = 0; - - public LicenseValidator(LicenseProperties props, SysLicenseMapper licenseMapper) throws Exception { - this.licenseMapper = licenseMapper; - this.properties = props; - this.publicKey = loadPublicKey(props.getPublicKey()); - this.cachedLicense = null; - } - - /** - * 启动时加载 License + 吊销列表 - */ - @PostConstruct - public void init() { - loadLicense(); - loadRevocationList(); - checkSystemClock(); - } - - /** - * 定时检测 NTP 时间偏差(每 ntpCheckInterval 分钟执行一次) - */ - @Scheduled(fixedDelayString = "#{@licenseProperties.ntpCheckInterval * 60 * 1000}") - public void scheduledNtpCheck() { - checkSystemClock(); - } - - /** - * 启动时加载 License(@PostConstruct 或 ApplicationRunner 调用) - * 依次尝试:数据库 → 环境变量 → 文件 - */ - public void loadLicense() { - String jwtToken = null; - - // 1. 尝试数据库 - SysLicense sysLicense = licenseMapper.selectOne(new LambdaQueryWrapper<>()); - if (sysLicense != null) { - jwtToken = sysLicense.getLicenseKey(); - } - - // 2. 尝试环境变量 - if (jwtToken == null) { - jwtToken = System.getenv("ECOM_LICENSE_KEY"); - } - - // 3. 尝试文件 - if (jwtToken == null) { - jwtToken = readLicenseFile("config/license.key"); - } - - if (jwtToken != null) { - String fingerprint = MachineFingerprintUtil.generate(); - this.cachedLicense = fullValidate(jwtToken, fingerprint); - } - } - - /** - * 加载吊销列表黑名单(文件 → 内存) - */ - private void loadRevocationList() { - String path = properties.getRevocationFile(); - if (path == null || path.isEmpty()) return; - File file = new File(path); - if (!file.exists()) return; - try { - Files.readAllLines(file.toPath()).stream() - .map(String::trim) - .filter(l -> !l.isEmpty() && !l.startsWith("#")) - .forEach(revokedJtiSet::add); - log.info("已加载 {} 个吊销 JTI", revokedJtiSet.size()); - } catch (IOException e) { - log.warn("吊销列表加载失败: {}", e.getMessage()); - } - } - - /** - * 运行时校验:直接从内存判断,不做任何 I/O - */ - public void check() { - LicenseInfo license = this.cachedLicense; - if (license == null) { - throw new LicenseException("系统未激活,请先完成 License 激活"); - } - if (license.getExpiresAt().before(new Date())) { - throw new LicenseException("License 已过期"); - } - - // 指纹比对:除非 License 中指纹为 "*"(不限),否则必须匹配 - if (!"*".equals(license.getMachineFingerprint())) { - String currentFp = MachineFingerprintUtil.generate(); - if (!license.getMachineFingerprint().equals(currentFp)) { - throw new LicenseException("License 与当前服务器不匹配"); - } - } - - // 吊销检查 - if (license.getJti() != null && revokedJtiSet.contains(license.getJti())) { - throw new LicenseException("此 License 已被吊销"); - } - } - - /** - * NTP 时间偏差检测(启动时 + 定时任务,不进请求链路) - */ - private void checkSystemClock() { - int maxSkew = properties.getMaxClockSkew(); - if (maxSkew <= 0) return; - - try { - InetAddress addr = InetAddress.getByName(properties.getNtpServer()); - NtpUdpClient client = new NtpUdpClient(); - TimeInfo info = client.getTime(addr); - long ntpTime = info.getMessage().getTransmitTimeStamp().getTime(); - long localTime = System.currentTimeMillis(); - long diff = Math.abs(ntpTime - localTime); - this.clockSkewMs = diff; - this.lastNtpCheck = System.currentTimeMillis(); - - if (diff > TimeUnit.MINUTES.toMillis(maxSkew)) { - log.error("系统时间异常(与标准时间偏差 {} 秒)", diff / 1000); - } - } catch (Exception e) { - log.warn("NTP 时间校验失败,跳过: {}", e.getMessage()); - } - } - - /** - * 全量验证(包括 RSA 验签),仅在加载/激活/更新时调用 - */ - public LicenseInfo fullValidate(String jwtToken, String currentFingerprint) { - Jwt jwt = Jwts.parser() - .verifyWith(publicKey) - .build() - .parseSignedClaims(jwtToken); - - Claims claims = jwt.getPayload(); - - Date exp = claims.getExpiration(); - if (exp.before(new Date())) { - throw new LicenseException("License 已过期"); - } - - String fp = claims.get("machineFingerprint", String.class); - // 指纹为 "*" 表示不限制(SaaS 模式),或必须与当前指纹匹配 - if (!"*".equals(fp) && !fp.equals(currentFingerprint)) { - throw new LicenseException("License 与当前服务器不匹配"); - } - - return LicenseInfo.builder() - .company(claims.get("company", String.class)) - .edition(claims.get("edition", String.class)) - .machineFingerprint(fp) - .expiresAt(exp) - .features(claims.get("features", List.class)) - .jti(claims.getId()) // jti 用于吊销 - .installationId(claims.get("installationId", String.class)) - .jwtToken(jwtToken) - .build(); - } - - /** - * 激活时写入 License(初始化/续期时调用) - */ - public void activate(String jwtToken) { - String fingerprint = MachineFingerprintUtil.generate(); - LicenseInfo info = fullValidate(jwtToken, fingerprint); - - // 写入数据库 - SysLicense entity = new SysLicense(); - entity.setLicenseKey(jwtToken); - entity.setCompanyName(info.getCompany()); - entity.setEdition(info.getEdition()); - entity.setMachineFingerprint(fingerprint); - entity.setInstallationId(MachineFingerprintUtil.getMachineId()); - entity.setExpiresAt(info.getExpiresAt()); - entity.setActivatedAt(new Date()); - entity.setIsActive(1); - licenseMapper.insertOrUpdate(entity); - - // 刷新内存缓存 - this.cachedLicense = info; - } - - /** - * 刷新内存缓存(外部更新 License 后调用) - */ - public void refresh() { - loadLicense(); - } -} -``` - -### 8.6 LicenseValidator 生命周期 - -| 时机 | 行为 | 是否做 I/O | -|------|------|-----------| -| 应用启动 `@PostConstruct` | 按优先级(DB→环境变量→文件)加载 JWT,RSA 验签 + 指纹比对,写入内存缓存;加载吊销黑名单文件;触发首次 NTP 时间检测 | 是(读 DB / 文件 + NTP) | -| 定时任务 `@Scheduled` | 每隔 `ntp-check-interval` 分钟执行一次 NTP 时间检测,更新 `clockSkewMs` 缓存;偏差超阈值时记录错误日志(不拒绝请求) | 是(NTP 网络请求,不进请求链路) | -| 每次导入请求 `check()` | 从内存读 `cachedLicense`,比对有效期 + 指纹(`*` 时跳过) + 吊销黑名单,**不做 NTP 请求** | **否** | -| 初始化激活 `activate()` | RSA 验签 + 指纹比对,写入 DB(含 `installationId`)+ 刷新内存缓存 | 是(写 DB) | -| License 续期/更新 `PUT /api/system/license` | 同 `activate()`,但已激活状态下不重置初始化步骤 | 是(写 DB) | -| 查看 License 信息 `GET /api/system/license` | 从内存缓存读取,无需解密 | **否** | - -**核心原则**: -- RSA 非对称验签是 CPU 密集型操作,只在**加载时**做一次;运行时校验仅做内存中的有效期和指纹比对,零开销 -- NTP 时间检测不进请求链路,避免网络 I/O 拖慢接口响应 - -### 8.7 AOP 切面实现 - -```java -@Aspect -@Component -public class LicenseAspect { - - private final LicenseValidator licenseValidator; - - public LicenseAspect(LicenseValidator licenseValidator) { - this.licenseValidator = licenseValidator; - } - - @Around("@annotation(licenseRequired)") - public Object checkLicense(ProceedingJoinPoint joinPoint, LicenseRequired licenseRequired) throws Throwable { - // 直接调用 check() — 只读内存,不做 I/O - licenseValidator.check(); - return joinPoint.proceed(); - } -} +api: api/system/license/ (对接 §4.4) +路由: 未 initialized → redirect /init ``` --- -## 9. 技术选型 +## 6. Phase 3/4 License 平台 `ecom-license/` -### 9.1 License 服务器 +### 6.1 目录 -| 层 | 技术 | 说明 | -|----|------|------| -| 后端框架 | **NestJS** | 渐进式 Node.js 后端,模块化架构 | -| 语言 | **TypeScript** | 类型安全 | -| 数据库 | **MySQL 8.0** | 与主应用保持一致 | -| ORM | **TypeORM** | NestJS 生态,与 MySQL 配合 | -| 认证 | **Passport + JWT** | CLI / API 登录,Bearer Token | -| JWT 签名 | **node-rsa / jsonwebtoken** | RS256 算法 | +``` +ecom-license/ +├── server/ # NestJS + TypeORM + MySQL +│ └── keys/ # private.pem / public.pem(Ed25519) +└── cli/ # Commander,bin: ecom-license +``` -### 9.2 License 管理 CLI +### 6.2 服务端表(摘要) -| 层 | 技术 | 说明 | -|----|------|------| -| 运行时 | **Node.js ≥ 20** | 与 NestJS 同仓库 monorepo | -| 命令行 | **Commander.js** | 子命令与全局选项 | -| 交互 | **@inquirer/prompts** | login、generate 等缺参时向导 | -| HTTP | **Axios** | 调用 NestJS REST API | -| 配置 | **~/.config/ecom-license/config.json** | 缓存 apiUrl、token | -| 输出 | **chalk + cli-table3** | 终端表格与状态色 | -| 打包 | **tsup** | 全局命令 `ecom-license` | +`lc_admin`、`lc_customer`、`lc_license`(含 `jti`、`max_activations`、`status`)、`lc_activation_log`、`lc_oper_log` -> **不再建设** Vue / Vite / Ant Design Vue 管理后台(`admin/`)。若未来需要只读仪表盘,可考虑独立 Grafana 或 CLI `stats --watch`,而非恢复 Web UI。 +### 6.3 核心 API -### 9.3 主应用 License 模块 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | `/api/auth/login` | CLI 登录 | +| POST | `/api/licenses/generate` | **签发** | +| POST | `/api/licenses/:id/revoke` | 吊销 | +| GET | `/api/licenses/status` | 在线吊销查询(`?jti=`) | +| CRUD | `/api/customers` | 客户管理 | -| 层 | 技术 | 说明 | -|----|------|------| -| 签名验证 | **jjwt (0.11.5)** | 已经引入,用于 JWT 验签 | -| 机器指纹 | **Java 原生 API(/etc/machine-id / Hostname)** | 系统 machine-id + 主机名,不依赖硬件 | -| 切面 | **Spring AOP** | 已有依赖 | -| NTP 检测 | **Apache Commons Net (NtpUdpClient)** | 轻量 NTP 客户端 | +### 6.4 CLI 命令树 + +``` +ecom-license login | logout | whoami | stats +ecom-license customer list|create|show|update|delete|licenses +ecom-license license list|show|generate|revoke|download +``` + +全局:`--url` / `--token` / `--json` / `--quiet` / `--yes` +配置:`~/.config/ecom-license/config.json` +交互:TTY 下向导 + 表格 + spinner(`DESIGN.reference.md` §E.1);CI/管道自动静默 --- -## 10. 项目结构 - -``` -ecom-license/ # ⚠ 新建目录:License 授权管理平台 -├── DESIGN.md # 本设计文档 -├── package.json # npm workspaces 根(server + cli) -├── docker-compose.yml # Docker 编排(仅 server + MySQL) -├── .env.example # 环境变量模板 -│ -├── server/ # NestJS 后端 ← 新建 -│ ├── src/ -│ │ ├── main.ts -│ │ ├── app.module.ts -│ │ ├── common/ -│ │ │ ├── guards/ # JWT 认证守卫 -│ │ │ ├── filters/ # 异常过滤器 -│ │ │ └── utils/ -│ │ ├── modules/ -│ │ │ ├── auth/ -│ │ │ ├── customer/ -│ │ │ ├── license/ # 签发 RSA 签名的 JWT License -│ │ │ ├── dashboard/ -│ │ │ └── oper-log/ -│ │ └── config/ -│ ├── keys/ # RSA 密钥对(生产需妥善保管) -│ │ ├── private.pem -│ │ └── public.pem -│ ├── package.json -│ ├── tsconfig.json -│ └── nest-cli.json -│ -└── cli/ # ecom-license CLI ← 新建(替代原 admin/) - ├── src/ - │ ├── index.ts # Commander 入口 - │ ├── config.ts # 读写 ~/.config/ecom-license - │ ├── client.ts # Axios 封装 + 401 处理 - │ ├── output.ts # 表格 / JSON / quiet - │ └── commands/ - │ ├── login.ts - │ ├── customer.ts - │ ├── license.ts - │ └── stats.ts - ├── package.json # bin: { "ecom-license": "./dist/index.js" } - ├── tsconfig.json - └── tsup.config.ts -``` - -以下为**现有项目**中需新增或修改的部分: - -``` -ecom-dmb-backend/ # 主应用后端(已有) -└── src/main/java/top/xyquan/ecomdmbbackend/ - └── modules/ - └── license/ # ← 新增:License 校验 + 初始化模块 - ├── LicenseValidator.java - ├── LicenseAspect.java - ├── LicenseRequired.java - ├── LicenseProperties.java - ├── InitializeService.java - ├── MachineFingerprintUtil.java - ├── entity/ - ├── mapper/ - ├── controller/ - │ └── InitController.java - └── exception/ - -ecom-dmb-frontend/ # 主应用前端(已有) -└── apps/web-antd/src/ - ├── views/ - │ ├── init/ # ← 新增:初始化向导页面 - │ │ ├── InitWizard.vue - │ │ ├── InitStepAdmin.vue - │ │ ├── InitStepCompany.vue - │ │ └── InitStepLicense.vue - │ └── system/ - │ └── license/ # ← 新增:系统设置 - │ ├── LicenseInfo.vue # License 信息查看 + 续期 - │ └── FingerprintInfo.vue # 机器指纹查看 -``` - ---- - -## 11. RSA 密钥管理 - -### 11.1 密钥对生成 +## 7. 密钥与运维 ```bash -# 生成私钥(2048位) -openssl genrsa -out private.pem 2048 - -# 导出公钥 -openssl rsa -in private.pem -pubout -out public.pem +# 生成密钥对(仅 License Server 持私钥) +openssl genpkey -algorithm Ed25519 -out private.pem +openssl pkey -in private.pem -pubout -out public.pem ``` -### 11.2 密钥分发 +| 环境变量 | 用途 | +|----------|------| +| `ECOM_LICENSE_ENABLED` | 主应用开关 | +| `ECOM_LICENSE_PUBLIC_KEY` | 主应用公钥 PEM | +| `ECOM_LICENSE_KEY` | 预置 License JWT | +| `ECOM_LICENSE_API_URL` | CLI 指向 License Server | -``` -License 服务器 Ecom-DMB 主应用 -┌─────────────────┐ ┌────────────────────┐ -│ 私钥 private.pem│ │ 公钥 public.pem │ -│ (签名 License) │ │ (验签 JWT) │ -│ │ │ │ -│ JWT = sign( │ │ claims = verify( │ -│ payload, │ ──License JWT──▶ │ jwt, publicKey) │ -│ privateKey) │ │ │ -└─────────────────┘ │ check: │ - │ · 签名有效 │ - │ · 未过期 │ - │ · 指纹匹配 │ - └────────────────────┘ -``` - -- **私钥**:仅 License 服务器持有,用于签发 License -- **公钥**:内置在 Ecom-DMB 主应用的 `application.yml` 或编译进代码 -- 公钥原则上不应该让客户随意修改,建议编译在代码中或通过配置文件管理并签名保护 - -### 11.3 密钥轮换 - -密钥泄露或定期轮换时,需要让已部署的系统能使用新公钥验证 License。方案如下: - -| 方案 | 说明 | 适用场景 | -|------|------|----------| -| **多公钥列表** | 修改 `LicenseProperties` 支持多个公钥,验证时逐个尝试 | 简单可靠,推荐 | -| **kid 标头** | JWT Header 中携带 `kid` 标识密钥版本,主应用根据 `kid` 选择对应公钥 | 更规范,实现略复杂 | - -**推荐采用多公钥列表方案**: - -```yaml -ecom: - license: - public-keys: - - id: "2025-v1" - key: | - -----BEGIN PUBLIC KEY----- - MIIBIjANBgkqhkiG9w0BAQEFAAOC... - -----END PUBLIC KEY----- - - id: "2026-v2" - key: | - -----BEGIN PUBLIC KEY----- - ... - -----END PUBLIC KEY----- -``` - -轮换流程: -1. License 服务器用新私钥签发 License(JWT Header 携带 `kid`) -2. 主应用发布新版本时内置新旧两个公钥,旧 License 依然可验证 -3. 所有客户续期后,后续版本可移除旧公钥 +**私有部署**:客户给 `FP-xxx` → `license generate --fingerprint FP-xxx` → 客户 `/init/activate` +**SaaS**:`--fingerprint "*"` +**续期**:同指纹重新签发 → 客户 `PUT /system/license` +**迁机**:新指纹 + 吊销旧 `jti`(见 §8) --- -## 12. 典型场景流程 +## 8. 场景速查 -### 12.1 场景一:新客户私有部署(离线) - -``` -客户方 运营方 -─── ─── -1. 部署 Ecom-DMB -2. 访问系统 → 跳转初始化页面 -3. 创建管理员账号 -4. 填写公司信息 -5. 页面显示机器指纹:FP-A1B2C3... - ──────────────────────────────────────────▶ 6. 收到客户提供的机器指纹 - 7. ecom-license login - 8. ecom-license customer create ... - 9. ecom-license license generate --fingerprint FP-A1B2C3... - 10. ecom-license license download -o xxx.key - ◀────────────────────────────────────────── 11. 将 License Key 或 .key 文件发给客户 -12. 粘贴 License Key 并点击激活 -13. 系统校验通过 → 初始化完成 -14. 进入系统,正常使用 -``` - -### 12.2 场景二:SaaS 部署 - -``` -运营方内部流程 -─── -1. 部署 Ecom-DMB(SaaS 环境) -2. 初始化系统,绑定 SaaS 服务器机器指纹 -3. 用 CLI 为每个租户签发 License(`ecom-license license generate`) -4. 新租户注册时,系统自动或手动分配 License -5. 每个租户导入订单时校验所属 License 是否有效 -``` - -### 12.3 场景三:License 续期 - -``` -1. 客户联系运营方续期 -2. 运营方:`ecom-license customer show ` / `customer licenses ` -3. 用相同机器指纹签发新 License(`license generate --expires-at ...`) -4. 将新的 License Key 发给客户 -5. 客户在「系统设置 → License」页面更新 License -6. 系统校验通过,完成续期 -``` - -### 12.4 场景四:迁移服务器 - -``` -1. 客户需要将系统迁移到新服务器 -2. 在新服务器上部署 Ecom-DMB -3. 进入初始化页面,获取新服务器的机器指纹(安装 ID + 主机名) -4. 将新指纹发给运营方 -5. 运营方:`ecom-license license revoke `,再 `license generate --fingerprint <新指纹>` -6. 客户激活 → 迁移完成 -7. 旧服务器的下次请求会因指纹不匹配或 jti 已吊销而失效 -``` +1. **新客私有部署**:部署 → 初始化三步 → 指纹给运营 → CLI 签发 → 客户激活 +2. **SaaS**:运营签发 `*` → 环境变量注入 License → 初始化 +3. **续期**:CLI 新 JWT → 系统设置页更新 +4. **迁机**:新服指纹 → revoke 旧证 → 新证激活 → 旧服指纹/jti 失效 --- -## 13. SaaS 与私有部署的差异点 +## 9. 安全要点(实现时记住即可) -| 维度 | 私有部署 | SaaS 部署 | -|------|----------|-----------| -| 部署方 | 客户 | 运营方 | -| License 来源 | 运营方签发后客户手动激活 | 运营方直接签发并配置 | -| 机器指纹 | 客户服务器的安装 ID + 主机名,严格绑定 | License 中指纹填 `*`,跳过指纹校验 | -| 初始化流程 | 客户自行完成初始化向导 | 运营方部署时完成初始化 | -| License 更新 | 客户手动更新 License | 运营方通过 CLI 更新或自动下发 | -| 地址限制 | 绑定一台服务器 | 不限服务器 | +- 私钥仅在 License Server;主应用只嵌公钥 +- 请求链路零 I/O;篡改内存靠定时 `fullValidate` +- 本地 `revoked.jti` + 可选在线同步 +- 指纹防「拷库到新机」;整盘克隆不防 +- 公钥轮换:`kid` + `public-keys[]` 多钥列表(首版可单钥) --- -## 14. 安全注意事项 +## 10. 后续扩展(勿阻塞首版) -1. **RSA 私钥保护**:私钥是 License 体系的安全基础,必须严格保护,建议存储在 HSM 或密钥管理服务中 -2. **防回滚**:License 过期后不能通过篡改系统时间来绕过——校验时使用绝对时间戳,对比服务器时间与 License exp -3. **系统时间篡改防护**:客户端修改系统时间可绕过有效期校验。解决方案: - - **不进请求链路**:NTP 时间偏差检测在**启动时 + 定时任务**(每 10 分钟)中执行,不阻塞业务请求 - - 偏差超阈值时记录错误日志并告警,不立即拒绝请求(避免 NTP 服务本身不可用导致系统不可用) - - 管理员可通过系统设置查看 NTP 状态和最近检测结果 -4. **机器指纹绕过防护**:指纹基于系统 `/etc/machine-id` + 主机名生成。`/etc/machine-id` 由 systemd 在首次启动时自动生成,不同 OS 安装互不相同。文件复制级别的克隆会自动失效(新系统有自己的 machine-id)。root 可伪造,但此时客户已拥有服务器全部权限,不在威胁模型内 -5. **License 吊销机制**: - - **本地吊销**:通过 `config/revoked.jti` 文件维护吊销列表(每行一个 jti),启动时加载到内存;运行时 `check()` 中 - 匹配内存黑名单,无 I/O 开销 - - **在线吊销(可选)**:如需强吊销,可在启动定时任务中请求 License 服务器 `/api/license/status` 接口查询当前 License - 状态,将吊销的 jti 同步到本地黑名单 -6. **公钥轮换**:参见 11.3 节,防止密钥泄露后无法更新 -7. **激活日志防滥用**:License 服务器记录每次激活的 `machine_fingerprint`、`installation_id`、`hostname`、`ip`;可设置 - `max_activations` 限制 License 的激活次数,防止同一个 License 在大量机器上激活 -8. **License 复制防护**:License JWT 中的 `machineFingerprint` 绑定到机器安装 ID,DB 复制到另一台机器后指纹不匹配; - `installationId` 记录在激活日志中,便于审计追溯 +在线激活、License 到期站内通知、多机共享 License、抗逆向、CLI 多管理员 --- -## 15. 后续可扩展 - -- **在线激活**:初始化时直接输入激活码,主应用自动请求 License 服务器完成激活 -- **批量部署**:支持预生成 License,客户部署时自动激活(静默安装) -- **License 监控**:License 即将过期时在系统内推送通知 -- **多服务器**:支持集群部署的 License 校验(允许同一客户的多台服务器共享一个 License) -- **分级权限**:CLI 侧支持多管理员账号;后续可加 `ecom-license admin *` 子命令 +**详细参考**(CLI 输出格式、完整 DDL、历史 v2 说明、长代码示例):见 [`DESIGN.reference.md`](./DESIGN.reference.md) diff --git a/ecom-license/DESIGN.reference.md b/ecom-license/DESIGN.reference.md new file mode 100644 index 00000000..a2a37c7b --- /dev/null +++ b/ecom-license/DESIGN.reference.md @@ -0,0 +1,318 @@ +# Ecom-DMB License 参考附录 + +> 实施时以 [`DESIGN.md`](./DESIGN.md) 为准。本文供查 JSON 示例、完整 DDL、CLI 细节;**v3 已统一 EdDSA,文中若出现 RS256 请忽略**。 + +--- + +## A. 主应用 API 请求/响应 + +### A.1 `GET /init/status` + +```json +{ + "initialized": false, + "currentStep": 0, + "adminCreated": false, + "companySaved": false, + "licenseActivated": false +} +``` + +### A.2 `GET /init/fingerprint` + +```json +{ + "fingerprint": "FP-A1B2C3D4E5F67890ABCDEF...", + "machineId": "a1b2c3d4-...", + "hostname": "ecom-server-01" +} +``` + +### A.3 `POST /init/activate` / `PUT /system/license` + +请求: + +```json +{ "licenseKey": "eyJhbGciOiJFZERTQSJ9..." } +``` + +激活校验:EdDSA 验签 → `exp` → 指纹匹配(`*` 跳过)→ 写 `sys_license` → `step=3`。 + +### A.4 `GET /system/license` + +```json +{ + "companyName": "某某科技", + "edition": "enterprise", + "machineFingerprint": "FP-...", + "features": ["order-import"], + "issuedAt": "2026-01-01T00:00:00Z", + "expiresAt": "2027-01-01T00:00:00Z", + "daysRemaining": 180, + "status": "active" +} +``` + +### A.5 错误码(导入受限) + +| 场景 | HTTP | 业务码建议 | +|------|------|------------| +| 未激活 / 过期 | 403 | `LICENSE_INVALID` | +| 指纹不匹配 | 403 | `LICENSE_FINGERPRINT_MISMATCH` | +| 功能未授权 | 403 | `LICENSE_FEATURE_DENIED` | +| 已吊销 jti | 403 | `LICENSE_REVOKED` | + +--- + +## B. 主应用 DDL(Flyway) + +```sql +CREATE TABLE IF NOT EXISTS sys_init ( + id BIGINT PRIMARY KEY DEFAULT 1, + step TINYINT NOT NULL DEFAULT 0 COMMENT '0~3', + admin_id BIGINT NULL, + company_name VARCHAR(200) NULL, + created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) COMMENT '系统初始化状态(单行)'; + +CREATE TABLE IF NOT EXISTS sys_license ( + id BIGINT PRIMARY KEY AUTO_INCREMENT, + company_name VARCHAR(200) NOT NULL, + edition VARCHAR(20) NOT NULL, + machine_fingerprint VARCHAR(100) NOT NULL, + installation_id VARCHAR(64) NULL, + license_key TEXT NOT NULL, + jti VARCHAR(64) NOT NULL, + issued_at DATETIME NOT NULL, + expires_at DATETIME NOT NULL, + activated_at DATETIME NOT NULL, + is_active TINYINT NOT NULL DEFAULT 1, + created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + UNIQUE KEY uk_jti (jti) +) COMMENT '当前生效 License'; + +-- 已有环境跳过初始化门禁(仅开发) +INSERT INTO sys_init (id, step) VALUES (1, 3) +ON DUPLICATE KEY UPDATE step = GREATEST(step, 3); +``` + +--- + +## C. License 服务器表结构 + +### `lc_admin` + +`id`, `username`, `password`(BCrypt), `nickname`, `status`, `created_at`, `updated_at` + +### `lc_customer` + +`id`, `code`(UK), `name`, `contact_name`, `contact_phone`, `contact_email`, `status`, `remark`, 时间戳 + +### `lc_license` + +`id`, `customer_id`, `license_key`, `jti`(UK), `edition`, `machine_fingerprint`, `features`(JSON), `status`(active/revoked/expired), `issued_at`, `expires_at`, `revoked_at`, `max_activations`, `activation_count`, 时间戳 + +### `lc_activation_log` + +`license_id`, `machine_fingerprint`, `installation_id`, `hostname`, `ip`, `action`(activate/deactivate), `created_at` + +### `lc_oper_log` + +`admin_id`, `action`, `target_type`, `target_id`, `detail`(JSON), `ip`, `created_at` + +--- + +## D. License 服务器 API 补充 + +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | `/api/auth/logout` | 退出 | +| GET | `/api/dashboard/stats` | 统计 | +| GET | `/api/licenses` | 列表 | +| GET | `/api/licenses/:id` | 详情 | +| GET | `/api/licenses/:id/download` | 下载 `.key` 文件 | +| GET | `/api/customers/:id/licenses` | 客户下许可证 | + +### `POST /api/licenses/generate` + +```json +{ + "customerId": 1, + "company": "某某科技有限公司", + "machineFingerprint": "FP-A1B2...", + "edition": "enterprise", + "expiresAt": "2027-01-01T00:00:00Z", + "features": ["order-import"] +} +``` + +响应含 `licenseKey`(EdDSA JWT)、`jti`、`status: active`。 + +### `GET /api/licenses/status?jti=xxx` + +```json +{ "jti": "uuid", "status": "active", "revokedAt": null } +``` + +--- + +## E. CLI 参考 + +### E.1 交互体验规格(必达) + +**原则**:运营工具要「像产品」—— 默认交互模式赏心悦目;脚本/管道模式干净无噪。 + +#### 技术栈 + +| 能力 | 库 | 用途 | +|------|-----|------| +| 提问向导 | `@inquirer/prompts` | select / input / confirm / password | +| 颜色语义 | `chalk` | 成功绿、警告黄、错误红、信息灰蓝 | +| 加载态 | `ora` | 请求中 spinner,成功 ✓ / 失败 ✗ | +| 表格 | `cli-table3` | `customer list`、`license list` | +| 信息面板 | `boxen` | 签发结果、whoami、stats 摘要 | +| 品牌标题 | `gradient-string` + `figlet`(可选) | 首次 `login` 或无子命令时轻量 banner | + +#### TTY 检测 + +``` +isInteractive = process.stdout.isTTY && !process.env.CI && !--json && !--quiet +``` + +| 模式 | 行为 | +|------|------| +| 交互(默认) | 缺参走向导;列表用表格;API 用 spinner | +| `--json` | 纯 JSON 一行/结构化,无颜色无 spinner | +| `--quiet` | 只输出关键值(如 `licenseKey`、文件路径) | +| 管道/重定向 | 同 `--json` 语义,禁止 boxen/figlet | + +#### 全局体验 + +- **无子命令** / `ecom-license --help`:简短 banner + 常用命令示例(带颜色) +- **未登录**:友好提示 + 引导 `ecom-license login`,非裸 `401` +- **网络/超时**:spinner 停止后一行人话错误 + 可选 `--verbose` 看堆栈 +- **Ctrl+C**:优雅退出,不打印 Node 堆栈 + +#### 命令级交互 + +**`login`**(交互) + +``` + ╭─ Ecom License CLI ─────────────────╮ + │ 授权管理平台 · 运营端 │ + ╰─────────────────────────────────────╯ + +? API 地址 › http://localhost:3100 +? 用户名 › admin +? 密码 › ******** + +⠋ 正在登录... +✔ 登录成功 · admin · Token 有效期至 2026-06-01 +``` + +**`license generate`**(交互向导,分步 confirm) + +1. `search` 选客户(支持输入过滤,非手打 ID) +2. 公司名(默认带出客户名,可改) +3. 指纹:`input` 或选「SaaS 不限指纹 (*)」 +4. `select` edition:trial / enterprise / unlimited(带简短说明) +5. 过期日:`input` + 校验,提供快捷项「+1年」「+30天」 +6. features:默认勾选 `order-import`,`checkbox` 确认 +7. **摘要面板**(boxen)展示全部字段 → `confirm` 签发 +8. 成功:绿色面板输出 `jti`、过期日;`licenseKey` 可复制(长文本折行 + 提示 `--quiet` 取纯 key) + +**`license revoke`**:`confirm` 二次确认(展示 jti/公司/指纹),`--yes` 跳过 + +**`customer list` / `license list`**:表格列对齐;空列表提示「暂无数据」+ 下一步建议(如 `customer create`) + +**`stats`**:boxen 数字卡片风格(客户数 / 有效证 / 即将过期) + +**`download`**:spinner + 成功显示保存路径(绿色) + +#### 输出示例(列表表格) + +``` + ID CODE NAME STATUS + ─── ──────────────── ─────────────────── ────── + 1 CUST-20260101-01 某某科技有限公司 启用 + 2 CUST-20260215-02 示例客户有限公司 启用 + +共 2 条 · 第 1/1 页 +``` + +#### 实现约束 + +- 交互逻辑与 API 调用分离:`commands/*.ts` + `ui/prompts.ts` + `ui/render.ts` +- 所有 spinner 在 `finally` 中 `stop()`,避免残留 +- 颜色跟随 `NO_COLOR` / `FORCE_COLOR` 环境变量 +- 单元测试覆盖非交互路径;交互路径用 snapshot 测 `render.ts` 纯文本 + +--- + +### E.2 配置 `~/.config/ecom-license/config.json` + +```json +{ + "apiUrl": "http://localhost:3100", + "token": "eyJ...", + "username": "admin", + "expiresAt": "2026-05-25T12:00:00Z" +} +``` + +优先级:命令行 flag > 环境变量 > 配置文件。 + +### 全局选项 + +| 选项 | 环境变量 | +|------|----------| +| `--url` | `ECOM_LICENSE_API_URL` | +| `--token` | `ECOM_LICENSE_TOKEN` | +| `--json` / `--quiet` / `--yes` | — | + +### 非交互签发示例 + +```bash +ecom-license license generate \ + --customer-id 1 \ + --company "某某科技" \ + --fingerprint "FP-A1B2..." \ + --edition enterprise \ + --expires "2027-01-01" \ + --features order-import \ + --json +``` + +SaaS:`--fingerprint "*"` + +### E.3 交互式 `license generate` 步骤 + +客户(可搜索选择)→ 公司名 → 指纹或 `*` → edition → 过期日(快捷 +1年)→ features → 摘要确认 → 签发。 +完整视觉与组件选型见 **§E.1**。 + +--- + +## F. v3 相对 v2 / 评审 `1.md` 的决策记录 + +| 议题 | 决策 | +|------|------| +| 签名算法 | **Ed25519 / EdDSA**(非 RSA) | +| 格式 | **标准 JWT**,payload 明文(非自定义结构、非 AES) | +| 校验 | Controller AOP + **Service 双点** | +| 定时验签 | **采纳**,默认 10 分钟 `fullValidate` | +| 在线吊销 | **可选**,默认关 | +| 反调试 / NTP 拒请求 | **首版不做** | + +完整评审原文见 [`1.md`](./1.md)。 + +--- + +## G. 历史完整设计 + +Git 中 v2 长文档(RSA、含大段 Java 伪代码)可通过以下命令查看,**勿作为实现依据**: + +```bash +git show HEAD:ecom-license/DESIGN.md +``` diff --git a/ecom-license/README.md b/ecom-license/README.md new file mode 100644 index 00000000..829f0953 --- /dev/null +++ b/ecom-license/README.md @@ -0,0 +1,58 @@ +# Ecom License 平台 + +`ecom-license/` 是**文档 + 两个独立 Node 子项目**的目录,不是 pnpm monorepo: + +``` +ecom-license/ +├── DESIGN.md # 设计文档 +├── server/ # NestJS 签发服务(独立 pnpm 项目) +└── cli/ # 运营 CLI(独立 pnpm 项目) +``` + +各子项目在自己的目录里 `pnpm install`,依赖装在 `server/node_modules`、`cli/node_modules`,**根目录不会有 node_modules**。 + +## 环境要求 + +- Node.js >= 18 +- pnpm >= 8 +- MySQL + +## Server 快速开始 + +```bash +cd ecom-license/server +pnpm install + +# 初始化表(在目标库执行 sql/schema.sql) +mysql -h -u ecom_license_dev -p ecom_license_dev < sql/schema.sql + +# 生成密钥 +openssl genpkey -algorithm Ed25519 -out keys/private.pem +openssl pkey -in keys/private.pem -pubout -out keys/public.pem + +cp .env.example .env +pnpm build +pnpm start:dev # http://localhost:3100 +``` + +## CLI 快速开始 + +```bash +cd ecom-license/cli +pnpm install +pnpm build + +# 开发(改代码后即时运行,需带子命令) +pnpm dev login +pnpm dev license generate + +# 或构建后运行 +pnpm start login # 默认 admin / admin123 +pnpm stats +``` + +> 不要用裸 `pnpm dev` / `npm run dev`(无子命令只会显示引导)。请用 `pnpm dev login` 等。 + +## 主应用公钥 + +将 `server/keys/public.pem` 配置到主应用 `ECOM_LICENSE_PUBLIC_KEY`。 diff --git a/ecom-license/cli/README.md b/ecom-license/cli/README.md new file mode 100644 index 00000000..6bc8595d --- /dev/null +++ b/ecom-license/cli/README.md @@ -0,0 +1,393 @@ +# ecom-license CLI + +Ecom-DMB License 运营管理命令行工具,用于登录 License Server、管理客户与签发/吊销许可证。 + +**前置条件**:License Server 已启动(默认 `http://localhost:3100`)。首次登录默认账号 `admin` / `admin123`。 + +--- + +## 安装与运行 + +```bash +cd ecom-license/cli +pnpm install +pnpm build # 可选,生产模式需要 +``` + +| 方式 | 命令 | 说明 | +|------|------|------| +| 开发模式 | `pnpm dev <子命令>` | 使用 `tsx` 直接运行源码 | +| 构建产物 | `pnpm start <子命令>` | 运行 `dist/index.js` | +| 全局安装 | `pnpm link --global` 后 `ecom-license` | 需先 `pnpm build` | +| 快捷脚本 | `pnpm login` / `pnpm whoami` / `pnpm stats` | 等价于 `pnpm dev <命令>` | + +无子命令时显示常用命令引导;完整帮助: + +```bash +pnpm dev -- --help +pnpm dev customer --help +pnpm dev license --help +``` + +--- + +## 配置 + +登录成功后写入本地配置文件: + +| 项 | 值 | +|----|-----| +| 默认路径 | `~/.config/ecom-license/config.json` | +| 自定义路径 | 环境变量 `ECOM_LICENSE_CONFIG` | + +```json +{ + "apiUrl": "http://localhost:3100", + "token": "eyJ...", + "username": "admin", + "expiresAt": "2026-06-01T00:00:00.000Z" +} +``` + +`logout` 会清除 token,保留 `apiUrl`。 + +--- + +## 环境变量 + +| 变量 | 作用 | +|------|------| +| `ECOM_LICENSE_API_URL` | API 根地址(优先级低于 `--url`) | +| `ECOM_LICENSE_TOKEN` | Bearer Token(优先级低于 `--token`) | +| `ECOM_LICENSE_USERNAME` | 非交互 `login` 用户名 | +| `ECOM_LICENSE_PASSWORD` | 非交互 `login` 密码 | +| `ECOM_LICENSE_CONFIG` | 配置文件路径 | +| `CI` | 存在时禁用交互向导 | +| `NO_COLOR` / `FORCE_COLOR` | 控制终端颜色 | + +--- + +## 全局选项 + +所有命令均支持(写在子命令前或后均可,由 Commander 解析): + +| 选项 | 说明 | +|------|------| +| `--url ` | API 根地址,如 `http://localhost:3100` | +| `--token ` | 临时指定 Token,不写配置文件 | +| `--json` | 纯 JSON 输出,适合脚本 | +| `--quiet` | 仅输出关键值(如 ID、licenseKey、文件路径) | +| `--yes` | 跳过确认(删除客户、吊销许可证) | +| `--verbose` | 显示详细错误堆栈 | +| `-V, --version` | 版本号 | +| `-h, --help` | 帮助 | + +### 输出模式 + +| 模式 | 条件 | 行为 | +|------|------|------| +| 交互(默认) | TTY 且非 `CI`,无 `--json`/`--quiet` | 缺参时向导提问;列表用表格;请求有 spinner | +| `--json` | 显式指定 | 结构化 JSON,无颜色 | +| `--quiet` | 显式指定 | 单行关键值,便于管道 | +| 管道/重定向 | stdout 非 TTY | 同 `--json` 语义,不展示 banner/boxen | + +--- + +## 命令总览 + +``` +ecom-license [--url] [--token] [--json] [--quiet] [--yes] [--verbose] + +login [--username] [--password] +logout +whoami +stats + +customer list [--page] [--size] +customer create [--code] [--name] [--contact-name] [--contact-phone] [--contact-email] +customer show +customer delete + +license list [--page] [--size] [--customer-id] [--status] +license show +license generate [--customer-id] [--company] [--fingerprint] [--edition] [--expires] [--features] +license revoke +license download [-o|--output ] +``` + +--- + +## 认证与会话 + +### `login` + +登录 License 平台,保存 Token 到配置文件。 + +| 选项 | 说明 | +|------|------| +| `--username ` | 用户名(非交互必填其一) | +| `--password ` | 密码 | + +**交互模式**:依次询问 API 地址(默认当前配置或 `http://localhost:3100`)、用户名、密码。 + +```bash +pnpm dev login +pnpm dev login --username admin --password admin123 +ECOM_LICENSE_USERNAME=admin ECOM_LICENSE_PASSWORD=admin123 pnpm dev login +pnpm dev login --url http://192.168.1.10:3100 +``` + +### `logout` + +清除本地 Token,不删除 API 地址配置。 + +```bash +pnpm dev logout +``` + +### `whoami` + +查看当前登录状态(API 地址、用户名、Token 过期时间)。 + +```bash +pnpm dev whoami +pnpm dev whoami --json +pnpm dev whoami --quiet # 仅输出用户名 +``` + +未登录时退出码 `1`,并提示运行 `login`。 + +### `stats` + +获取平台统计:客户数、有效许可证、即将过期、许可证总数。 + +```bash +pnpm dev stats +pnpm dev stats --json +pnpm dev stats --quiet # 仅输出有效许可证数量 +``` + +--- + +## 客户管理 `customer` + +### `customer list` + +分页列出客户。 + +| 选项 | 默认 | 说明 | +|------|------|------| +| `--page ` | `1` | 页码 | +| `--size ` | `20` | 每页条数 | + +```bash +pnpm dev customer list +pnpm dev customer list --page 2 --size 10 +pnpm dev customer list --json +``` + +### `customer create` + +创建客户。交互模式下会逐步询问公司名、联系人、电话、邮箱、客户编码(编码可留空自动生成)。 + +| 选项 | 说明 | +|------|------| +| `--name ` | 公司名称(**必填**,非交互) | +| `--code ` | 客户编码,省略则服务端自动生成 | +| `--contact-name ` | 联系人 | +| `--contact-phone

` | 联系电话 | +| `--contact-email ` | 联系邮箱 | + +```bash +pnpm dev customer create +pnpm dev customer create --name "某某科技有限公司" --contact-name 张三 --contact-phone 13800138000 +pnpm dev customer create --name "示例公司" --code CUST-001 --json +pnpm dev customer create --name "示例公司" --quiet # 仅输出新客户 ID +``` + +### `customer show ` + +查看单个客户详情(JSON 格式)。 + +```bash +pnpm dev customer show 1 +pnpm dev customer show 1 --json +``` + +### `customer delete ` + +删除客户。交互模式下需二次确认;`--yes` 跳过确认。 + +```bash +pnpm dev customer delete 1 +pnpm dev customer delete 1 --yes +``` + +--- + +## 许可证管理 `license` + +### `license list` + +分页列出许可证,可按客户、状态筛选。 + +| 选项 | 默认 | 说明 | +|------|------|------| +| `--page ` | `1` | 页码 | +| `--size ` | `20` | 每页条数 | +| `--customer-id ` | — | 按客户 ID 过滤 | +| `--status ` | — | 按状态过滤(如 `active`、`revoked`) | + +```bash +pnpm dev license list +pnpm dev license list --customer-id 1 --status active +pnpm dev license list --json +``` + +### `license show ` + +查看单个许可证详情。 + +```bash +pnpm dev license show 1 +pnpm dev license show 1 --json +``` + +### `license generate` + +签发新许可证。交互模式为分步向导:选择客户 → 公司名 → 机器指纹 → 版本 → 有效期 → 功能 → 确认摘要。 + +| 选项 | 默认 | 说明 | +|------|------|------| +| `--customer-id ` | — | 客户 ID | +| `--company ` | — | 授权公司名 | +| `--fingerprint ` | — | 机器指纹,`FP-xxx` 或 `*`(SaaS 不限) | +| `--edition ` | `enterprise` | 版本:`trial` / `enterprise` / `unlimited` | +| `--expires ` | — | 过期日 `YYYY-MM-DD` | +| `--features ` | `order-import` | 逗号分隔功能列表 | + +**非交互模式**必须同时提供:`--customer-id`、`--company`、`--fingerprint`、`--expires`。 + +```bash +# 交互向导(推荐) +pnpm dev license generate + +# 脚本签发 +pnpm dev license generate \ + --customer-id 1 \ + --company "某某科技有限公司" \ + --fingerprint "FP-abc123" \ + --edition enterprise \ + --expires 2027-05-28 \ + --features order-import + +# SaaS 不限指纹 +pnpm dev license generate \ + --customer-id 1 \ + --company "SaaS 客户" \ + --fingerprint "*" \ + --expires 2027-05-28 + +# 仅输出 licenseKey(便于复制到主应用激活) +pnpm dev license generate ... --quiet +pnpm dev license generate ... --json +``` + +签发成功后交互模式以绿色面板展示 ID、JTI、过期日与完整 `licenseKey`。 + +### `license revoke ` + +吊销许可证。交互模式下展示 JTI、指纹并二次确认;`--yes` 跳过。 + +```bash +pnpm dev license revoke 1 +pnpm dev license revoke 1 --yes +pnpm dev license revoke 1 --json +``` + +### `license download ` + +下载许可证文件到本地。 + +| 选项 | 默认 | 说明 | +|------|------|------| +| `-o, --output ` | `license-.key` | 保存路径 | + +```bash +pnpm dev license download 1 +pnpm dev license download 1 -o ./my-license.key +pnpm dev license download 1 --quiet # 仅输出文件路径 +``` + +--- + +## 典型工作流 + +### 1. 首次使用 + +```bash +# 1. 确保 License Server 已启动(ecom-license/server) +cd ../server && pnpm start:dev + +# 2. 登录 +cd ../cli && pnpm dev login + +# 3. 查看平台概况 +pnpm dev stats +``` + +### 2. 为客户签发 License + +```bash +pnpm dev customer create --name "某某科技有限公司" +pnpm dev customer list --quiet # 记下客户 ID,或直接用交互 generate + +pnpm dev license generate # 交互向导 +# 或 +pnpm dev license generate \ + --customer-id 1 \ + --company "某某科技有限公司" \ + --fingerprint "FP-xxxxxxxx" \ + --expires 2027-12-31 \ + --quiet > license.key +``` + +### 3. CI / 脚本集成 + +```bash +export ECOM_LICENSE_API_URL=http://license.internal:3100 +export ECOM_LICENSE_TOKEN="$(pnpm dev login --username admin --password "$SECRET" --json | jq -r .token)" + +pnpm dev customer list --json | jq '.items | length' +pnpm dev stats --json +``` + +--- + +## 错误与提示 + +| 情况 | 行为 | +|------|------| +| 未登录调用需鉴权 API | 提示运行 `ecom-license login`,非裸 401 | +| 网络/服务端错误 | spinner 停止后显示可读错误;加 `--verbose` 看堆栈 | +| Ctrl+C 中断向导 | 优雅退出,不打印 Node 堆栈 | +| 空列表 | 提示下一步建议(如「运行 customer create」) | + +--- + +## 当前未实现的子命令 + +以下能力在 License Server API 中可能存在,CLI 尚未接入: + +- `customer update` — 更新客户信息 +- `customer licenses ` — 查看某客户下全部许可证 + +如需使用,可直接调用 Server REST API,或后续在 CLI 中补充。 + +--- + +## 相关文档 + +- 整体设计:`../DESIGN.md` +- CLI 交互规格:`../DESIGN.reference.md` §E +- Server 启动:`../server/README.md`(若有)或 `../README.md` diff --git a/ecom-license/cli/package.json b/ecom-license/cli/package.json new file mode 100644 index 00000000..6acdd22f --- /dev/null +++ b/ecom-license/cli/package.json @@ -0,0 +1,32 @@ +{ + "name": "ecom-license-cli", + "version": "0.1.0", + "private": true, + "packageManager": "pnpm@10.32.0", + "type": "module", + "bin": { + "ecom-license": "./dist/index.js" + }, + "scripts": { + "build": "tsc", + "dev": "tsx src/index.ts", + "start": "node dist/index.js", + "login": "tsx src/index.ts login", + "whoami": "tsx src/index.ts whoami", + "stats": "tsx src/index.ts stats" + }, + "dependencies": { + "@inquirer/prompts": "^7.2.0", + "boxen": "^8.0.1", + "chalk": "^5.4.1", + "cli-table3": "^0.6.5", + "commander": "^13.0.0", + "gradient-string": "^3.0.0", + "ora": "^8.1.1" + }, + "devDependencies": { + "@types/node": "^22.10.2", + "tsx": "^4.19.2", + "typescript": "^5.7.2" + } +} diff --git a/ecom-license/cli/pnpm-lock.yaml b/ecom-license/cli/pnpm-lock.yaml new file mode 100644 index 00000000..af8ef80e --- /dev/null +++ b/ecom-license/cli/pnpm-lock.yaml @@ -0,0 +1,959 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@inquirer/prompts': + specifier: ^7.2.0 + version: 7.10.1(@types/node@22.19.20) + boxen: + specifier: ^8.0.1 + version: 8.0.1 + chalk: + specifier: ^5.4.1 + version: 5.6.2 + cli-table3: + specifier: ^0.6.5 + version: 0.6.5 + commander: + specifier: ^13.0.0 + version: 13.1.0 + gradient-string: + specifier: ^3.0.0 + version: 3.0.0 + ora: + specifier: ^8.1.1 + version: 8.2.0 + devDependencies: + '@types/node': + specifier: ^22.10.2 + version: 22.19.20 + tsx: + specifier: ^4.19.2 + version: 4.22.4 + typescript: + specifier: ^5.7.2 + version: 5.9.3 + +packages: + + '@colors/colors@1.5.0': + resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} + engines: {node: '>=0.1.90'} + + '@esbuild/aix-ppc64@0.28.0': + resolution: {integrity: sha512-lhRUCeuOyJQURhTxl4WkpFTjIsbDayJHih5kZC1giwE+MhIzAb7mEsQMqMf18rHLsrb5qI1tafG20mLxEWcWlA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.28.0': + resolution: {integrity: sha512-+WzIXQOSaGs33tLEgYPYe/yQHf0WTU0X42Jca3y8NWMbUVhp7rUnw+vAsRC/QiDrdD31IszMrZy+qwPOPjd+rw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.28.0': + resolution: {integrity: sha512-wqh0ByljabXLKHeWXYLqoJ5jKC4XBaw6Hk08OfMrCRd2nP2ZQ5eleDZC41XHyCNgktBGYMbqnrJKq/K/lzPMSQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.28.0': + resolution: {integrity: sha512-+VJggoaKhk2VNNqVL7f6S189UzShHC/mR9EE8rDdSkdpN0KflSwWY/gWjDrNxxisg8Fp1ZCD9jLMo4m0OUfeUA==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.28.0': + resolution: {integrity: sha512-0T+A9WZm+bZ84nZBtk1ckYsOvyA3x7e2Acj1KdVfV4/2tdG4fzUp91YHx+GArWLtwqp77pBXVCPn2We7Letr0Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.28.0': + resolution: {integrity: sha512-fyzLm/DLDl/84OCfp2f/XQ4flmORsjU7VKt8HLjvIXChJoFFOIL6pLJPH4Yhd1n1gGFF9mPwtlN5Wf82DZs+LQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.28.0': + resolution: {integrity: sha512-l9GeW5UZBT9k9brBYI+0WDffcRxgHQD8ShN2Ur4xWq/NFzUKm3k5lsH4PdaRgb2w7mI9u61nr2gI2mLI27Nh3Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.28.0': + resolution: {integrity: sha512-BXoQai/A0wPO6Es3yFJ7APCiKGc1tdAEOgeTNy3SsB491S3aHn4S4r3e976eUnPdU+NbdtmBuLncYir2tMU9Nw==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.28.0': + resolution: {integrity: sha512-RVyzfb3FWsGA55n6WY0MEIEPURL1FcbhFE6BffZEMEekfCzCIMtB5yyDcFnVbTnwk+CLAgTujmV/Lgvih56W+A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.28.0': + resolution: {integrity: sha512-CjaaREJagqJp7iTaNQjjidaNbCKYcd4IDkzbwwxtSvjI7NZm79qiHc8HqciMddQ6CKvJT6aBd8lO9kN/ZudLlw==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.28.0': + resolution: {integrity: sha512-KBnSTt1kxl9x70q+ydterVdl+Cn0H18ngRMRCEQfrbqdUuntQQ0LoMZv47uB97NljZFzY6HcfqEZ2SAyIUTQBQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.28.0': + resolution: {integrity: sha512-zpSlUce1mnxzgBADvxKXX5sl8aYQHo2ezvMNI8I0lbblJtp8V4odlm3Yzlj7gPyt3T8ReksE6bK+pT3WD+aJRg==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.28.0': + resolution: {integrity: sha512-2jIfP6mmjkdmeTlsX/9vmdmhBmKADrWqN7zcdtHIeNSCH1SqIoNI63cYsjQR8J+wGa4Y5izRcSHSm8K3QWmk3w==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.28.0': + resolution: {integrity: sha512-bc0FE9wWeC0WBm49IQMPSPILRocGTQt3j5KPCA8os6VprfuJ7KD+5PzESSrJ6GmPIPJK965ZJHTUlSA6GNYEhg==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.28.0': + resolution: {integrity: sha512-SQPZOwoTTT/HXFXQJG/vBX8sOFagGqvZyXcgLA3NhIqcBv1BJU1d46c0rGcrij2B56Z2rNiSLaZOYW5cUk7yLQ==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.28.0': + resolution: {integrity: sha512-SCfR0HN8CEEjnYnySJTd2cw0k9OHB/YFzt5zgJEwa+wL/T/raGWYMBqwDNAC6dqFKmJYZoQBRfHjgwLHGSrn3Q==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.28.0': + resolution: {integrity: sha512-us0dSb9iFxIi8srnpl931Nvs65it/Jd2a2K3qs7fz2WfGPHqzfzZTfec7oxZJRNPXPnNYZtanmRc4AL/JwVzHQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.28.0': + resolution: {integrity: sha512-CR/RYotgtCKwtftMwJlUU7xCVNg3lMYZ0RzTmAHSfLCXw3NtZtNpswLEj/Kkf6kEL3Gw+BpOekRX0BYCtklhUw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.28.0': + resolution: {integrity: sha512-nU1yhmYutL+fQ71Kxnhg8uEOdC0pwEW9entHykTgEbna2pw2dkbFSMeqjjyHZoCmt8SBkOSvV+yNmm94aUrrqw==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.28.0': + resolution: {integrity: sha512-cXb5vApOsRsxsEl4mcZ1XY3D4DzcoMxR/nnc4IyqYs0rTI8ZKmW6kyyg+11Z8yvgMfAEldKzP7AdP64HnSC/6g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.28.0': + resolution: {integrity: sha512-8wZM2qqtv9UP3mzy7HiGYNH/zjTA355mpeuA+859TyR+e+Tc08IHYpLJuMsfpDJwoLo1ikIJI8jC3GFjnRClzA==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.28.0': + resolution: {integrity: sha512-FLGfyizszcef5C3YtoyQDACyg95+dndv79i2EekILBofh5wpCa1KuBqOWKrEHZg3zrL3t5ouE5jgr94vA+Wb2w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.28.0': + resolution: {integrity: sha512-1ZgjUoEdHZZl/YlV76TSCz9Hqj9h9YmMGAgAPYd+q4SicWNX3G5GCyx9uhQWSLcbvPW8Ni7lj4gDa1T40akdlw==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.28.0': + resolution: {integrity: sha512-Q9StnDmQ/enxnpxCCLSg0oo4+34B9TdXpuyPeTedN/6+iXBJ4J+zwfQI28u/Jl40nOYAxGoNi7mFP40RUtkmUA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.28.0': + resolution: {integrity: sha512-zF3ag/gfiCe6U2iczcRzSYJKH1DCI+ByzSENHlM2FcDbEeo5Zd2C86Aq0tKUYAJJ1obRP84ymxIAksZUcdztHA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.28.0': + resolution: {integrity: sha512-pEl1bO9mfAmIC+tW5btTmrKaujg3zGtUmWNdCw/xs70FBjwAL3o9OEKNHvNmnyylD6ubxUERiEhdsL0xBQ9efw==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@inquirer/ansi@1.0.2': + resolution: {integrity: sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ==} + engines: {node: '>=18'} + + '@inquirer/checkbox@4.3.2': + resolution: {integrity: sha512-VXukHf0RR1doGe6Sm4F0Em7SWYLTHSsbGfJdS9Ja2bX5/D5uwVOEjr07cncLROdBvmnvCATYEWlHqYmXv2IlQA==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/confirm@5.1.21': + resolution: {integrity: sha512-KR8edRkIsUayMXV+o3Gv+q4jlhENF9nMYUZs9PA2HzrXeHI8M5uDag70U7RJn9yyiMZSbtF5/UexBtAVtZGSbQ==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/core@10.3.2': + resolution: {integrity: sha512-43RTuEbfP8MbKzedNqBrlhhNKVwoK//vUFNW3Q3vZ88BLcrs4kYpGg+B2mm5p2K/HfygoCxuKwJJiv8PbGmE0A==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/editor@4.2.23': + resolution: {integrity: sha512-aLSROkEwirotxZ1pBaP8tugXRFCxW94gwrQLxXfrZsKkfjOYC1aRvAZuhpJOb5cu4IBTJdsCigUlf2iCOu4ZDQ==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/expand@4.0.23': + resolution: {integrity: sha512-nRzdOyFYnpeYTTR2qFwEVmIWypzdAx/sIkCMeTNTcflFOovfqUk+HcFhQQVBftAh9gmGrpFj6QcGEqrDMDOiew==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/external-editor@1.0.3': + resolution: {integrity: sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/figures@1.0.15': + resolution: {integrity: sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g==} + engines: {node: '>=18'} + + '@inquirer/input@4.3.1': + resolution: {integrity: sha512-kN0pAM4yPrLjJ1XJBjDxyfDduXOuQHrBB8aLDMueuwUGn+vNpF7Gq7TvyVxx8u4SHlFFj4trmj+a2cbpG4Jn1g==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/number@3.0.23': + resolution: {integrity: sha512-5Smv0OK7K0KUzUfYUXDXQc9jrf8OHo4ktlEayFlelCjwMXz0299Y8OrI+lj7i4gCBY15UObk76q0QtxjzFcFcg==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/password@4.0.23': + resolution: {integrity: sha512-zREJHjhT5vJBMZX/IUbyI9zVtVfOLiTO66MrF/3GFZYZ7T4YILW5MSkEYHceSii/KtRk+4i3RE7E1CUXA2jHcA==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/prompts@7.10.1': + resolution: {integrity: sha512-Dx/y9bCQcXLI5ooQ5KyvA4FTgeo2jYj/7plWfV5Ak5wDPKQZgudKez2ixyfz7tKXzcJciTxqLeK7R9HItwiByg==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/rawlist@4.1.11': + resolution: {integrity: sha512-+LLQB8XGr3I5LZN/GuAHo+GpDJegQwuPARLChlMICNdwW7OwV2izlCSCxN6cqpL0sMXmbKbFcItJgdQq5EBXTw==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/search@3.2.2': + resolution: {integrity: sha512-p2bvRfENXCZdWF/U2BXvnSI9h+tuA8iNqtUKb9UWbmLYCRQxd8WkvwWvYn+3NgYaNwdUkHytJMGG4MMLucI1kA==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/select@4.4.2': + resolution: {integrity: sha512-l4xMuJo55MAe+N7Qr4rX90vypFwCajSakx59qe/tMaC1aEHWLyw68wF4o0A4SLAY4E0nd+Vt+EyskeDIqu1M6w==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/type@3.0.10': + resolution: {integrity: sha512-BvziSRxfz5Ov8ch0z/n3oijRSEcEsHnhggm4xFZe93DHcUCTlutlq9Ox4SVENAfcRD22UQq7T/atg9Wr3k09eA==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@types/node@22.19.20': + resolution: {integrity: sha512-6tELRwSDYWW9EdZhbeZmYGZ1/7Djkt+Ah3/ScEYT9cDord7UJzasR/4D3VONg9tQI5CDp+/CZC1AXj2pCFOvpw==} + + '@types/tinycolor2@1.4.6': + resolution: {integrity: sha512-iEN8J0BoMnsWBqjVbWH/c0G0Hh7O21lpR2/+PrvAVgWdzL7eexIFm4JN/Wn10PTcmNdtS6U67r499mlWMXOxNw==} + + ansi-align@3.0.1: + resolution: {integrity: sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-regex@6.2.2: + resolution: {integrity: sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==} + engines: {node: '>=12'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + ansi-styles@6.2.3: + resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==} + engines: {node: '>=12'} + + boxen@8.0.1: + resolution: {integrity: sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==} + engines: {node: '>=18'} + + camelcase@8.0.0: + resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==} + engines: {node: '>=16'} + + chalk@5.6.2: + resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + + chardet@2.1.1: + resolution: {integrity: sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==} + + cli-boxes@3.0.0: + resolution: {integrity: sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==} + engines: {node: '>=10'} + + cli-cursor@5.0.0: + resolution: {integrity: sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==} + engines: {node: '>=18'} + + cli-spinners@2.9.2: + resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==} + engines: {node: '>=6'} + + cli-table3@0.6.5: + resolution: {integrity: sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==} + engines: {node: 10.* || >= 12.*} + + cli-width@4.1.0: + resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==} + engines: {node: '>= 12'} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + commander@13.1.0: + resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==} + engines: {node: '>=18'} + + emoji-regex@10.6.0: + resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + esbuild@0.28.0: + resolution: {integrity: sha512-sNR9MHpXSUV/XB4zmsFKN+QgVG82Cc7+/aaxJ8Adi8hyOac+EXptIp45QBPaVyX3N70664wRbTcLTOemCAnyqw==} + engines: {node: '>=18'} + hasBin: true + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + get-east-asian-width@1.6.0: + resolution: {integrity: sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==} + engines: {node: '>=18'} + + gradient-string@3.0.0: + resolution: {integrity: sha512-frdKI4Qi8Ihp4C6wZNB565de/THpIaw3DjP5ku87M+N9rNSGmPTjfkq61SdRXB7eCaL8O1hkKDvf6CDMtOzIAg==} + engines: {node: '>=14'} + + iconv-lite@0.7.2: + resolution: {integrity: sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==} + engines: {node: '>=0.10.0'} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-interactive@2.0.0: + resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} + engines: {node: '>=12'} + + is-unicode-supported@1.3.0: + resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} + engines: {node: '>=12'} + + is-unicode-supported@2.1.0: + resolution: {integrity: sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==} + engines: {node: '>=18'} + + log-symbols@6.0.0: + resolution: {integrity: sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==} + engines: {node: '>=18'} + + mimic-function@5.0.1: + resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==} + engines: {node: '>=18'} + + mute-stream@2.0.0: + resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} + engines: {node: ^18.17.0 || >=20.5.0} + + onetime@7.0.0: + resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} + engines: {node: '>=18'} + + ora@8.2.0: + resolution: {integrity: sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==} + engines: {node: '>=18'} + + restore-cursor@5.1.0: + resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==} + engines: {node: '>=18'} + + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + stdin-discarder@0.2.2: + resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==} + engines: {node: '>=18'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + string-width@7.2.0: + resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==} + engines: {node: '>=18'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-ansi@7.2.0: + resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==} + engines: {node: '>=12'} + + tinycolor2@1.6.0: + resolution: {integrity: sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==} + + tinygradient@1.1.5: + resolution: {integrity: sha512-8nIfc2vgQ4TeLnk2lFj4tRLvvJwEfQuabdsmvDdQPT0xlk9TaNtpGd6nNRxXoK6vQhN6RSzj+Cnp5tTQmpxmbw==} + + tsx@4.22.4: + resolution: {integrity: sha512-X8EX+XV4QR5xCsrgxaED954zTDfY8KqlDtskKEL0cHhyS/P8b4IFOvGDQpsC9Q1XnLq915wEfwwY/zzskCtmhg==} + engines: {node: '>=18.0.0'} + hasBin: true + + type-fest@4.41.0: + resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} + engines: {node: '>=16'} + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@6.21.0: + resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + + widest-line@5.0.0: + resolution: {integrity: sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==} + engines: {node: '>=18'} + + wrap-ansi@6.2.0: + resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} + engines: {node: '>=8'} + + wrap-ansi@9.0.2: + resolution: {integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==} + engines: {node: '>=18'} + + yoctocolors-cjs@2.1.3: + resolution: {integrity: sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==} + engines: {node: '>=18'} + +snapshots: + + '@colors/colors@1.5.0': + optional: true + + '@esbuild/aix-ppc64@0.28.0': + optional: true + + '@esbuild/android-arm64@0.28.0': + optional: true + + '@esbuild/android-arm@0.28.0': + optional: true + + '@esbuild/android-x64@0.28.0': + optional: true + + '@esbuild/darwin-arm64@0.28.0': + optional: true + + '@esbuild/darwin-x64@0.28.0': + optional: true + + '@esbuild/freebsd-arm64@0.28.0': + optional: true + + '@esbuild/freebsd-x64@0.28.0': + optional: true + + '@esbuild/linux-arm64@0.28.0': + optional: true + + '@esbuild/linux-arm@0.28.0': + optional: true + + '@esbuild/linux-ia32@0.28.0': + optional: true + + '@esbuild/linux-loong64@0.28.0': + optional: true + + '@esbuild/linux-mips64el@0.28.0': + optional: true + + '@esbuild/linux-ppc64@0.28.0': + optional: true + + '@esbuild/linux-riscv64@0.28.0': + optional: true + + '@esbuild/linux-s390x@0.28.0': + optional: true + + '@esbuild/linux-x64@0.28.0': + optional: true + + '@esbuild/netbsd-arm64@0.28.0': + optional: true + + '@esbuild/netbsd-x64@0.28.0': + optional: true + + '@esbuild/openbsd-arm64@0.28.0': + optional: true + + '@esbuild/openbsd-x64@0.28.0': + optional: true + + '@esbuild/openharmony-arm64@0.28.0': + optional: true + + '@esbuild/sunos-x64@0.28.0': + optional: true + + '@esbuild/win32-arm64@0.28.0': + optional: true + + '@esbuild/win32-ia32@0.28.0': + optional: true + + '@esbuild/win32-x64@0.28.0': + optional: true + + '@inquirer/ansi@1.0.2': {} + + '@inquirer/checkbox@4.3.2(@types/node@22.19.20)': + dependencies: + '@inquirer/ansi': 1.0.2 + '@inquirer/core': 10.3.2(@types/node@22.19.20) + '@inquirer/figures': 1.0.15 + '@inquirer/type': 3.0.10(@types/node@22.19.20) + yoctocolors-cjs: 2.1.3 + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/confirm@5.1.21(@types/node@22.19.20)': + dependencies: + '@inquirer/core': 10.3.2(@types/node@22.19.20) + '@inquirer/type': 3.0.10(@types/node@22.19.20) + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/core@10.3.2(@types/node@22.19.20)': + dependencies: + '@inquirer/ansi': 1.0.2 + '@inquirer/figures': 1.0.15 + '@inquirer/type': 3.0.10(@types/node@22.19.20) + cli-width: 4.1.0 + mute-stream: 2.0.0 + signal-exit: 4.1.0 + wrap-ansi: 6.2.0 + yoctocolors-cjs: 2.1.3 + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/editor@4.2.23(@types/node@22.19.20)': + dependencies: + '@inquirer/core': 10.3.2(@types/node@22.19.20) + '@inquirer/external-editor': 1.0.3(@types/node@22.19.20) + '@inquirer/type': 3.0.10(@types/node@22.19.20) + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/expand@4.0.23(@types/node@22.19.20)': + dependencies: + '@inquirer/core': 10.3.2(@types/node@22.19.20) + '@inquirer/type': 3.0.10(@types/node@22.19.20) + yoctocolors-cjs: 2.1.3 + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/external-editor@1.0.3(@types/node@22.19.20)': + dependencies: + chardet: 2.1.1 + iconv-lite: 0.7.2 + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/figures@1.0.15': {} + + '@inquirer/input@4.3.1(@types/node@22.19.20)': + dependencies: + '@inquirer/core': 10.3.2(@types/node@22.19.20) + '@inquirer/type': 3.0.10(@types/node@22.19.20) + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/number@3.0.23(@types/node@22.19.20)': + dependencies: + '@inquirer/core': 10.3.2(@types/node@22.19.20) + '@inquirer/type': 3.0.10(@types/node@22.19.20) + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/password@4.0.23(@types/node@22.19.20)': + dependencies: + '@inquirer/ansi': 1.0.2 + '@inquirer/core': 10.3.2(@types/node@22.19.20) + '@inquirer/type': 3.0.10(@types/node@22.19.20) + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/prompts@7.10.1(@types/node@22.19.20)': + dependencies: + '@inquirer/checkbox': 4.3.2(@types/node@22.19.20) + '@inquirer/confirm': 5.1.21(@types/node@22.19.20) + '@inquirer/editor': 4.2.23(@types/node@22.19.20) + '@inquirer/expand': 4.0.23(@types/node@22.19.20) + '@inquirer/input': 4.3.1(@types/node@22.19.20) + '@inquirer/number': 3.0.23(@types/node@22.19.20) + '@inquirer/password': 4.0.23(@types/node@22.19.20) + '@inquirer/rawlist': 4.1.11(@types/node@22.19.20) + '@inquirer/search': 3.2.2(@types/node@22.19.20) + '@inquirer/select': 4.4.2(@types/node@22.19.20) + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/rawlist@4.1.11(@types/node@22.19.20)': + dependencies: + '@inquirer/core': 10.3.2(@types/node@22.19.20) + '@inquirer/type': 3.0.10(@types/node@22.19.20) + yoctocolors-cjs: 2.1.3 + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/search@3.2.2(@types/node@22.19.20)': + dependencies: + '@inquirer/core': 10.3.2(@types/node@22.19.20) + '@inquirer/figures': 1.0.15 + '@inquirer/type': 3.0.10(@types/node@22.19.20) + yoctocolors-cjs: 2.1.3 + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/select@4.4.2(@types/node@22.19.20)': + dependencies: + '@inquirer/ansi': 1.0.2 + '@inquirer/core': 10.3.2(@types/node@22.19.20) + '@inquirer/figures': 1.0.15 + '@inquirer/type': 3.0.10(@types/node@22.19.20) + yoctocolors-cjs: 2.1.3 + optionalDependencies: + '@types/node': 22.19.20 + + '@inquirer/type@3.0.10(@types/node@22.19.20)': + optionalDependencies: + '@types/node': 22.19.20 + + '@types/node@22.19.20': + dependencies: + undici-types: 6.21.0 + + '@types/tinycolor2@1.4.6': {} + + ansi-align@3.0.1: + dependencies: + string-width: 4.2.3 + + ansi-regex@5.0.1: {} + + ansi-regex@6.2.2: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + ansi-styles@6.2.3: {} + + boxen@8.0.1: + dependencies: + ansi-align: 3.0.1 + camelcase: 8.0.0 + chalk: 5.6.2 + cli-boxes: 3.0.0 + string-width: 7.2.0 + type-fest: 4.41.0 + widest-line: 5.0.0 + wrap-ansi: 9.0.2 + + camelcase@8.0.0: {} + + chalk@5.6.2: {} + + chardet@2.1.1: {} + + cli-boxes@3.0.0: {} + + cli-cursor@5.0.0: + dependencies: + restore-cursor: 5.1.0 + + cli-spinners@2.9.2: {} + + cli-table3@0.6.5: + dependencies: + string-width: 4.2.3 + optionalDependencies: + '@colors/colors': 1.5.0 + + cli-width@4.1.0: {} + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + + commander@13.1.0: {} + + emoji-regex@10.6.0: {} + + emoji-regex@8.0.0: {} + + esbuild@0.28.0: + optionalDependencies: + '@esbuild/aix-ppc64': 0.28.0 + '@esbuild/android-arm': 0.28.0 + '@esbuild/android-arm64': 0.28.0 + '@esbuild/android-x64': 0.28.0 + '@esbuild/darwin-arm64': 0.28.0 + '@esbuild/darwin-x64': 0.28.0 + '@esbuild/freebsd-arm64': 0.28.0 + '@esbuild/freebsd-x64': 0.28.0 + '@esbuild/linux-arm': 0.28.0 + '@esbuild/linux-arm64': 0.28.0 + '@esbuild/linux-ia32': 0.28.0 + '@esbuild/linux-loong64': 0.28.0 + '@esbuild/linux-mips64el': 0.28.0 + '@esbuild/linux-ppc64': 0.28.0 + '@esbuild/linux-riscv64': 0.28.0 + '@esbuild/linux-s390x': 0.28.0 + '@esbuild/linux-x64': 0.28.0 + '@esbuild/netbsd-arm64': 0.28.0 + '@esbuild/netbsd-x64': 0.28.0 + '@esbuild/openbsd-arm64': 0.28.0 + '@esbuild/openbsd-x64': 0.28.0 + '@esbuild/openharmony-arm64': 0.28.0 + '@esbuild/sunos-x64': 0.28.0 + '@esbuild/win32-arm64': 0.28.0 + '@esbuild/win32-ia32': 0.28.0 + '@esbuild/win32-x64': 0.28.0 + + fsevents@2.3.3: + optional: true + + get-east-asian-width@1.6.0: {} + + gradient-string@3.0.0: + dependencies: + chalk: 5.6.2 + tinygradient: 1.1.5 + + iconv-lite@0.7.2: + dependencies: + safer-buffer: 2.1.2 + + is-fullwidth-code-point@3.0.0: {} + + is-interactive@2.0.0: {} + + is-unicode-supported@1.3.0: {} + + is-unicode-supported@2.1.0: {} + + log-symbols@6.0.0: + dependencies: + chalk: 5.6.2 + is-unicode-supported: 1.3.0 + + mimic-function@5.0.1: {} + + mute-stream@2.0.0: {} + + onetime@7.0.0: + dependencies: + mimic-function: 5.0.1 + + ora@8.2.0: + dependencies: + chalk: 5.6.2 + cli-cursor: 5.0.0 + cli-spinners: 2.9.2 + is-interactive: 2.0.0 + is-unicode-supported: 2.1.0 + log-symbols: 6.0.0 + stdin-discarder: 0.2.2 + string-width: 7.2.0 + strip-ansi: 7.2.0 + + restore-cursor@5.1.0: + dependencies: + onetime: 7.0.0 + signal-exit: 4.1.0 + + safer-buffer@2.1.2: {} + + signal-exit@4.1.0: {} + + stdin-discarder@0.2.2: {} + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + string-width@7.2.0: + dependencies: + emoji-regex: 10.6.0 + get-east-asian-width: 1.6.0 + strip-ansi: 7.2.0 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-ansi@7.2.0: + dependencies: + ansi-regex: 6.2.2 + + tinycolor2@1.6.0: {} + + tinygradient@1.1.5: + dependencies: + '@types/tinycolor2': 1.4.6 + tinycolor2: 1.6.0 + + tsx@4.22.4: + dependencies: + esbuild: 0.28.0 + optionalDependencies: + fsevents: 2.3.3 + + type-fest@4.41.0: {} + + typescript@5.9.3: {} + + undici-types@6.21.0: {} + + widest-line@5.0.0: + dependencies: + string-width: 7.2.0 + + wrap-ansi@6.2.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@9.0.2: + dependencies: + ansi-styles: 6.2.3 + string-width: 7.2.0 + strip-ansi: 7.2.0 + + yoctocolors-cjs@2.1.3: {} diff --git a/ecom-license/cli/src/api/client.ts b/ecom-license/cli/src/api/client.ts new file mode 100644 index 00000000..672b29ba --- /dev/null +++ b/ecom-license/cli/src/api/client.ts @@ -0,0 +1,95 @@ +import { getGlobalOpts, isInteractive } from '../context.js'; +import { loadConfig, resolveApiUrl, resolveToken } from '../config.js'; +import { failSpinner, runSpinner } from '../ui/render.js'; + +export class ApiError extends Error { + constructor( + message: string, + public status?: number, + ) { + super(message); + } +} + +async function parseError(res: Response): Promise { + try { + const body = await res.json(); + if (typeof body?.message === 'string') return body.message; + if (Array.isArray(body?.message)) return body.message.join(', '); + return JSON.stringify(body); + } catch { + return res.statusText || `HTTP ${res.status}`; + } +} + +export async function apiRequest( + method: string, + path: string, + body?: unknown, + auth = true, +): Promise { + const opts = getGlobalOpts(); + const config = await loadConfig(); + const baseUrl = resolveApiUrl(opts.url, config); + const token = resolveToken(opts.token, config); + + const headers: Record = { + 'Content-Type': 'application/json', + Accept: 'application/json', + }; + if (auth && token) { + headers.Authorization = `Bearer ${token}`; + } + + const doFetch = async () => { + const res = await fetch(`${baseUrl}/api${path}`, { + method, + headers, + body: body !== undefined ? JSON.stringify(body) : undefined, + }); + if (!res.ok) { + throw new ApiError(await parseError(res), res.status); + } + if (res.status === 204) return undefined as T; + const contentType = res.headers.get('content-type') || ''; + if (contentType.includes('application/json')) { + return (await res.json()) as T; + } + return (await res.text()) as T; + }; + + if (isInteractive() && !opts.quiet && !opts.json) { + return runSpinner(doFetch, '请求中...'); + } + try { + return await doFetch(); + } catch (e) { + if (e instanceof ApiError && e.status === 401 && auth) { + failSpinner('未登录或 Token 已过期,请运行: ecom-license login'); + } + throw e; + } +} + +export async function apiDownload(path: string, outfile: string): Promise { + const opts = getGlobalOpts(); + const config = await loadConfig(); + const baseUrl = resolveApiUrl(opts.url, config); + const token = resolveToken(opts.token, config); + + const doFetch = async () => { + const res = await fetch(`${baseUrl}/api${path}`, { + headers: token ? { Authorization: `Bearer ${token}` } : {}, + }); + if (!res.ok) throw new ApiError(await parseError(res), res.status); + const { writeFile } = await import('fs/promises'); + const text = await res.text(); + await writeFile(outfile, text, 'utf8'); + return outfile; + }; + + if (isInteractive()) { + return runSpinner(doFetch, '正在下载...'); + } + return doFetch(); +} diff --git a/ecom-license/cli/src/commands/customer.ts b/ecom-license/cli/src/commands/customer.ts new file mode 100644 index 00000000..04d20ff8 --- /dev/null +++ b/ecom-license/cli/src/commands/customer.ts @@ -0,0 +1,104 @@ +import { confirm, input } from '@inquirer/prompts'; + +import { apiRequest } from '../api/client.js'; +import { getGlobalOpts, isInteractive } from '../context.js'; +import { + printEmptyHint, + printJson, + printQuiet, + printSuccess, + printTable, +} from '../ui/render.js'; + +interface Customer { + id: number; + code: string; + name: string; + status: number; + contactName?: string; + contactPhone?: string; +} + +interface PageResult { + items: T[]; + total: number; + page: number; + size: number; +} + +export async function customerList(opts: { page?: number; size?: number }) { + const global = getGlobalOpts(); + const page = opts.page || 1; + const size = opts.size || 20; + const data = await apiRequest>( + 'GET', + `/customers?page=${page}&size=${size}`, + ); + + if (global.json) { + printJson(data); + return; + } + if (!data.items.length) { + printEmptyHint('运行 ecom-license customer create 创建客户'); + return; + } + + printTable( + ['ID', 'CODE', 'NAME', 'STATUS'], + data.items.map((c) => [ + String(c.id), + c.code, + c.name, + c.status === 1 ? '启用' : '禁用', + ]), + ); + console.log(`共 ${data.total} 条 · 第 ${data.page}/${Math.ceil(data.total / data.size) || 1} 页`); +} + +export async function customerCreate(opts: { + code?: string; + name?: string; + contactName?: string; + contactPhone?: string; + contactEmail?: string; +}) { + const global = getGlobalOpts(); + let payload = { ...opts }; + + if (isInteractive() && !opts.name) { + payload.name = await input({ message: '公司名称', validate: (v) => !!v || '必填' }); + payload.contactName = await input({ message: '联系人', default: '' }); + payload.contactPhone = await input({ message: '联系电话', default: '' }); + payload.contactEmail = await input({ message: '联系邮箱', default: '' }); + payload.code = await input({ message: '客户编码(留空自动生成)', default: '' }); + if (!payload.code) delete payload.code; + } + + if (!payload.name) { + console.error('请提供 --name'); + process.exit(1); + } + + const created = await apiRequest('POST', '/customers', payload); + if (global.json) printJson(created); + else if (global.quiet) printQuiet(String(created.id)); + else printSuccess(`客户已创建: ${created.code} · ${created.name}`); +} + +export async function customerShow(id: number) { + const global = getGlobalOpts(); + const customer = await apiRequest('GET', `/customers/${id}`); + if (global.json) printJson(customer); + else printJson(customer); +} + +export async function customerDelete(id: number, yes?: boolean) { + const global = getGlobalOpts(); + if (isInteractive() && !yes && !global.yes) { + const ok = await confirm({ message: `确认删除客户 #${id}?`, default: false }); + if (!ok) return; + } + await apiRequest('DELETE', `/customers/${id}`); + printSuccess(`客户 #${id} 已删除`); +} diff --git a/ecom-license/cli/src/commands/license.ts b/ecom-license/cli/src/commands/license.ts new file mode 100644 index 00000000..03d7928b --- /dev/null +++ b/ecom-license/cli/src/commands/license.ts @@ -0,0 +1,257 @@ +import { checkbox, confirm, input, search, select } from '@inquirer/prompts'; + +import { apiRequest, apiDownload } from '../api/client.js'; +import { getGlobalOpts, isInteractive } from '../context.js'; +import { + printBox, + printEmptyHint, + printJson, + printQuiet, + printSuccess, + printTable, +} from '../ui/render.js'; + +interface Customer { + id: number; + code: string; + name: string; +} + +interface License { + id: number; + jti: string; + edition: string; + machineFingerprint: string; + status: string; + expiresAt: string; + licenseKey?: string; + customer?: Customer; +} + +interface PageResult { + items: T[]; + total: number; + page: number; + size: number; +} + +interface GenerateResult { + id: number; + licenseKey: string; + jti: string; + edition: string; + machineFingerprint: string; + expiresAt: string; + status: string; +} + +export async function licenseList(opts: { + page?: number; + size?: number; + customerId?: number; + status?: string; +}) { + const global = getGlobalOpts(); + const params = new URLSearchParams(); + if (opts.page) params.set('page', String(opts.page)); + if (opts.size) params.set('size', String(opts.size)); + if (opts.customerId) params.set('customerId', String(opts.customerId)); + if (opts.status) params.set('status', opts.status); + + const data = await apiRequest>( + 'GET', + `/licenses?${params.toString()}`, + ); + + if (global.json) { + printJson(data); + return; + } + if (!data.items.length) { + printEmptyHint('运行 ecom-license license generate 签发许可证'); + return; + } + + printTable( + ['ID', 'JTI', 'EDITION', 'FINGERPRINT', 'STATUS', 'EXPIRES'], + data.items.map((l) => [ + String(l.id), + l.jti.slice(0, 8) + '...', + l.edition, + l.machineFingerprint.slice(0, 16) + (l.machineFingerprint.length > 16 ? '...' : ''), + l.status, + l.expiresAt?.slice(0, 10) || '-', + ]), + ); + console.log(`共 ${data.total} 条`); +} + +export async function licenseShow(id: number) { + const global = getGlobalOpts(); + const license = await apiRequest('GET', `/licenses/${id}`); + if (global.json) printJson(license); + else printJson(license); +} + +export async function licenseGenerate(opts: { + customerId?: number; + company?: string; + fingerprint?: string; + edition?: string; + expires?: string; + features?: string; +}) { + const global = getGlobalOpts(); + let customerId = opts.customerId; + let company = opts.company; + let fingerprint = opts.fingerprint; + let edition = opts.edition || 'enterprise'; + let expiresAt = opts.expires; + let features = opts.features?.split(',').map((s) => s.trim()).filter(Boolean) || [ + 'order-import', + 'order-create', + ]; + + if (isInteractive() && !customerId) { + const customers = await apiRequest>('GET', '/customers?page=1&size=100'); + if (!customers.items.length) { + console.error('暂无客户,请先 ecom-license customer create'); + process.exit(1); + } + customerId = await search({ + message: '选择客户', + source: async (term) => { + const q = (term || '').toLowerCase(); + return customers.items + .filter( + (c) => + !q || + c.name.toLowerCase().includes(q) || + c.code.toLowerCase().includes(q), + ) + .map((c) => ({ name: `${c.code} · ${c.name}`, value: c.id })); + }, + }); + const picked = customers.items.find((c) => c.id === customerId)!; + company = await input({ message: '授权公司名', default: picked.name }); + const fpMode = await select({ + message: '机器指纹', + choices: [ + { name: '私有部署(输入 FP-xxx)', value: 'custom' }, + { name: 'SaaS 不限指纹 (*)', value: '*' }, + ], + }); + fingerprint = + fpMode === '*' + ? '*' + : await input({ + message: '机器指纹', + validate: (v) => v.startsWith('FP-') || v === '*' || '格式应为 FP-...', + }); + edition = await select({ + message: '版本类型', + choices: [ + { name: 'trial · 试用', value: 'trial' }, + { name: 'enterprise · 企业', value: 'enterprise' }, + { name: 'unlimited · 无限', value: 'unlimited' }, + ], + }); + const expireChoice = await select({ + message: '有效期', + choices: [ + { name: '+30 天', value: '30d' }, + { name: '+1 年', value: '1y' }, + { name: '自定义日期', value: 'custom' }, + ], + }); + if (expireChoice === 'custom') { + expiresAt = await input({ + message: '过期日期 (YYYY-MM-DD)', + validate: (v) => /^\d{4}-\d{2}-\d{2}$/.test(v) || '格式 YYYY-MM-DD', + }); + } else { + const d = new Date(); + if (expireChoice === '30d') d.setDate(d.getDate() + 30); + else d.setFullYear(d.getFullYear() + 1); + expiresAt = d.toISOString().slice(0, 10); + } + features = await checkbox({ + message: '授权功能', + choices: [ + { name: 'order-import · 订单导入', value: 'order-import', checked: true }, + { name: 'order-create · 创建订单', value: 'order-create', checked: true }, + ], + }); + const summary = [ + `客户 ID: ${customerId}`, + `公司: ${company}`, + `指纹: ${fingerprint}`, + `版本: ${edition}`, + `过期: ${expiresAt}`, + `功能: ${features.join(', ')}`, + ].join('\n'); + const ok = await confirm({ message: `确认签发?\n${summary}`, default: true }); + if (!ok) return; + } + + if (!customerId || !company || !fingerprint || !expiresAt) { + console.error('缺少参数,交互模式请直接运行 ecom-license license generate'); + process.exit(1); + } + + const result = await apiRequest('POST', '/licenses/generate', { + customerId, + company, + machineFingerprint: fingerprint, + edition, + expiresAt: new Date(expiresAt).toISOString(), + features, + }); + + if (global.json) { + printJson(result); + return; + } + if (global.quiet) { + printQuiet(result.licenseKey); + return; + } + + printBox( + '签发成功', + [ + `ID: ${result.id}`, + `JTI: ${result.jti}`, + `过期: ${result.expiresAt?.slice(0, 10)}`, + '', + result.licenseKey, + '', + '提示: 使用 --quiet 仅输出 licenseKey', + ].join('\n'), + 'green', + ); +} + +export async function licenseRevoke(id: number, yes?: boolean) { + const global = getGlobalOpts(); + const license = await apiRequest('GET', `/licenses/${id}`); + if (isInteractive() && !yes && !global.yes) { + const ok = await confirm({ + message: `确认吊销?\nJTI: ${license.jti}\n指纹: ${license.machineFingerprint}`, + default: false, + }); + if (!ok) return; + } + const result = await apiRequest('POST', `/licenses/${id}/revoke`); + if (global.json) printJson(result); + else printSuccess(`许可证 #${id} 已吊销`); +} + +export async function licenseDownload(id: number, output?: string) { + const global = getGlobalOpts(); + const outfile = output || `license-${id}.key`; + const path = await apiDownload(`/licenses/${id}/download`, outfile); + if (global.json) printJson({ path }); + else if (global.quiet) printQuiet(path); + else printSuccess(`已保存到 ${path}`); +} diff --git a/ecom-license/cli/src/commands/login.ts b/ecom-license/cli/src/commands/login.ts new file mode 100644 index 00000000..c248eb13 --- /dev/null +++ b/ecom-license/cli/src/commands/login.ts @@ -0,0 +1,63 @@ +import { input, password } from '@inquirer/prompts'; + +import { apiRequest } from '../api/client.js'; +import { loadConfig, resolveApiUrl, saveConfig } from '../config.js'; +import { getGlobalOpts, isInteractive } from '../context.js'; +import { printBanner, printError, printJson, printSuccess } from '../ui/render.js'; + +interface LoginResult { + token: string; + username: string; + expiresAt: string | null; +} + +export async function loginCommand(opts: { + url?: string; + username?: string; + password?: string; +}) { + const global = getGlobalOpts(); + const config = await loadConfig(); + const apiUrl = resolveApiUrl(opts.url || global.url, config); + + if (isInteractive()) printBanner(); + + let username = opts.username || process.env.ECOM_LICENSE_USERNAME; + let pass = opts.password || process.env.ECOM_LICENSE_PASSWORD; + + if (isInteractive()) { + username = await input({ message: '用户名', default: username || 'admin' }); + pass = await password({ message: '密码', mask: '*' }); + } + + if (!username || !pass) { + printError('请提供用户名和密码'); + process.exit(1); + } + + try { + const result = await apiRequest( + 'POST', + '/auth/login', + { username, password: pass }, + false, + ); + await saveConfig({ + apiUrl, + token: result.token, + username: result.username, + expiresAt: result.expiresAt || undefined, + }); + if (global.json) { + printJson({ username: result.username, expiresAt: result.expiresAt, apiUrl }); + return; + } + printSuccess( + `登录成功 · ${result.username}` + + (result.expiresAt ? ` · Token 有效期至 ${result.expiresAt.slice(0, 10)}` : ''), + ); + } catch (e: any) { + printError(e?.message || '登录失败'); + process.exit(1); + } +} diff --git a/ecom-license/cli/src/commands/logout.ts b/ecom-license/cli/src/commands/logout.ts new file mode 100644 index 00000000..61a59792 --- /dev/null +++ b/ecom-license/cli/src/commands/logout.ts @@ -0,0 +1,7 @@ +import { clearConfig } from '../config.js'; +import { printSuccess } from '../ui/render.js'; + +export async function logoutCommand() { + await clearConfig(); + printSuccess('已退出登录'); +} diff --git a/ecom-license/cli/src/commands/stats.ts b/ecom-license/cli/src/commands/stats.ts new file mode 100644 index 00000000..18b45b7a --- /dev/null +++ b/ecom-license/cli/src/commands/stats.ts @@ -0,0 +1,35 @@ +import { apiRequest } from '../api/client.js'; +import { getGlobalOpts } from '../context.js'; +import { printBox, printJson, printQuiet } from '../ui/render.js'; + +interface Stats { + customerCount: number; + activeLicenseCount: number; + expiringSoonCount: number; + totalLicenses: number; +} + +export async function statsCommand() { + const global = getGlobalOpts(); + const stats = await apiRequest('GET', '/dashboard/stats'); + + if (global.json) { + printJson(stats); + return; + } + if (global.quiet) { + printQuiet(String(stats.activeLicenseCount)); + return; + } + + printBox( + '平台概览', + [ + `客户数: ${stats.customerCount}`, + `有效许可证: ${stats.activeLicenseCount}`, + `即将过期: ${stats.expiringSoonCount}`, + `许可证总数: ${stats.totalLicenses}`, + ].join('\n'), + 'green', + ); +} diff --git a/ecom-license/cli/src/commands/whoami.ts b/ecom-license/cli/src/commands/whoami.ts new file mode 100644 index 00000000..8551929e --- /dev/null +++ b/ecom-license/cli/src/commands/whoami.ts @@ -0,0 +1,39 @@ +import { loadConfig, resolveApiUrl } from '../config.js'; +import { getGlobalOpts } from '../context.js'; +import { printBox, printError, printJson, printQuiet } from '../ui/render.js'; + +export async function whoamiCommand() { + const global = getGlobalOpts(); + const config = await loadConfig(); + const apiUrl = resolveApiUrl(global.url, config); + + if (!config?.token && !global.token) { + printError('未登录,请运行: ecom-license login'); + process.exit(1); + } + + const info = { + apiUrl, + username: config?.username, + expiresAt: config?.expiresAt, + loggedIn: Boolean(config?.token || global.token), + }; + + if (global.json) { + printJson(info); + return; + } + if (global.quiet) { + printQuiet(config?.username || ''); + return; + } + + printBox( + '当前会话', + [ + `API: ${apiUrl}`, + `用户: ${config?.username || '(未知)'}`, + `过期: ${config?.expiresAt || '-'}`, + ].join('\n'), + ); +} diff --git a/ecom-license/cli/src/config.ts b/ecom-license/cli/src/config.ts new file mode 100644 index 00000000..1f31dbeb --- /dev/null +++ b/ecom-license/cli/src/config.ts @@ -0,0 +1,53 @@ +import { mkdir, readFile, writeFile } from 'fs/promises'; +import { homedir } from 'os'; +import { dirname, join } from 'path'; + +export interface CliConfig { + apiUrl: string; + token?: string; + username?: string; + expiresAt?: string; +} + +const DEFAULT_CONFIG_PATH = join( + homedir(), + '.config', + 'ecom-license', + 'config.json', +); + +export function getConfigPath(): string { + return process.env.ECOM_LICENSE_CONFIG || DEFAULT_CONFIG_PATH; +} + +export async function loadConfig(): Promise { + try { + const raw = await readFile(getConfigPath(), 'utf8'); + return JSON.parse(raw) as CliConfig; + } catch { + return null; + } +} + +export async function saveConfig(config: CliConfig): Promise { + const path = getConfigPath(); + await mkdir(dirname(path), { recursive: true }); + await writeFile(path, JSON.stringify(config, null, 2), 'utf8'); +} + +export async function clearConfig(): Promise { + await saveConfig({ apiUrl: (await loadConfig())?.apiUrl || 'http://localhost:3100' }); +} + +export function resolveApiUrl(flagUrl?: string, config?: CliConfig | null): string { + return ( + flagUrl || + process.env.ECOM_LICENSE_API_URL || + config?.apiUrl || + 'http://localhost:3100' + ).replace(/\/$/, ''); +} + +export function resolveToken(flagToken?: string, config?: CliConfig | null): string | undefined { + return flagToken || process.env.ECOM_LICENSE_TOKEN || config?.token; +} diff --git a/ecom-license/cli/src/context.ts b/ecom-license/cli/src/context.ts new file mode 100644 index 00000000..1c26bc46 --- /dev/null +++ b/ecom-license/cli/src/context.ts @@ -0,0 +1,30 @@ +/** 全局 CLI 运行上下文(由 commander 注入) */ +export interface GlobalOpts { + url?: string; + token?: string; + json?: boolean; + quiet?: boolean; + yes?: boolean; + verbose?: boolean; +} + +let globalOpts: GlobalOpts = {}; + +export function setGlobalOpts(opts: GlobalOpts) { + globalOpts = opts; +} + +export function getGlobalOpts(): GlobalOpts { + return globalOpts; +} + +/** TTY 交互模式检测 */ +export function isInteractive(): boolean { + const opts = getGlobalOpts(); + return ( + Boolean(process.stdout.isTTY) && + !process.env.CI && + !opts.json && + !opts.quiet + ); +} diff --git a/ecom-license/cli/src/index.ts b/ecom-license/cli/src/index.ts new file mode 100644 index 00000000..c3aa6116 --- /dev/null +++ b/ecom-license/cli/src/index.ts @@ -0,0 +1,118 @@ +#!/usr/bin/env node +import { Command } from 'commander'; + +import { customerCreate, customerDelete, customerList, customerShow } from './commands/customer.js'; +import { licenseDownload, licenseGenerate, licenseList, licenseRevoke, licenseShow } from './commands/license.js'; +import { loginCommand } from './commands/login.js'; +import { logoutCommand } from './commands/logout.js'; +import { statsCommand } from './commands/stats.js'; +import { whoamiCommand } from './commands/whoami.js'; +import { setGlobalOpts } from './context.js'; +import { printBanner } from './ui/render.js'; + +function applyGlobals(cmd: Command) { + return cmd + .option('--url ', 'API 根地址') + .option('--token ', 'Bearer Token') + .option('--json', 'JSON 输出') + .option('--quiet', '仅输出关键值') + .option('--yes', '跳过确认') + .option('--verbose', '显示详细错误') + .hook('preAction', (thisCmd) => { + const root = thisCmd.optsWithGlobals(); + setGlobalOpts({ + url: root.url, + token: root.token, + json: root.json, + quiet: root.quiet, + yes: root.yes, + verbose: root.verbose, + }); + }); +} + +const program = new Command(); +program.name('ecom-license').description('Ecom-DMB License 运营管理 CLI').version('0.1.0'); + +applyGlobals(program); + +program + .command('login') + .description('登录 License 平台') + .option('--username ') + .option('--password ') + .action((opts, cmd) => loginCommand({ ...opts, url: cmd.optsWithGlobals().url })); + +program.command('logout').description('退出登录').action(logoutCommand); +program.command('whoami').description('查看当前登录状态').action(whoamiCommand); +program.command('stats').description('平台统计').action(statsCommand); + +const customer = program.command('customer').description('客户管理'); +applyGlobals(customer); +customer.command('list').option('--page ').option('--size ').action((opts) => + customerList({ page: Number(opts.page) || 1, size: Number(opts.size) || 20 }), +); +customer + .command('create') + .option('--code ') + .option('--name ') + .option('--contact-name ') + .option('--contact-phone

') + .option('--contact-email ') + .action((opts) => customerCreate(opts)); +customer.command('show ').action((id) => customerShow(Number(id))); +customer.command('delete ').action((id, opts, cmd) => + customerDelete(Number(id), cmd.optsWithGlobals().yes), +); + +const license = program.command('license').description('许可证管理'); +applyGlobals(license); +license + .command('list') + .option('--page ') + .option('--size ') + .option('--customer-id ') + .option('--status ') + .action((opts) => + licenseList({ + page: Number(opts.page) || 1, + size: Number(opts.size) || 20, + customerId: opts.customerId ? Number(opts.customerId) : undefined, + status: opts.status, + }), + ); +license.command('show ').action((id) => licenseShow(Number(id))); +license + .command('generate') + .option('--customer-id ') + .option('--company ') + .option('--fingerprint ') + .option('--edition ') + .option('--expires ') + .option('--features ') + .action((opts) => licenseGenerate(opts)); +license.command('revoke ').action((id, _o, cmd) => + licenseRevoke(Number(id), cmd.optsWithGlobals().yes), +); +license + .command('download ') + .option('-o, --output ') + .action((id, opts) => licenseDownload(Number(id), opts.output)); + +// 无子命令时只展示引导,不输出冗长 --help +program.action(() => { + printBanner(); + console.log('常用命令:'); + console.log(' pnpm dev login # 开发模式登录'); + console.log(' pnpm dev customer create # 创建客户'); + console.log(' pnpm dev license generate # 签发 License'); + console.log(' pnpm start login # 使用构建产物'); + console.log(''); + console.log('完整帮助: pnpm dev -- --help'); +}); + +program.parseAsync(process.argv).catch((err) => { + if (err?.name === 'ExitPromptError') process.exit(0); + console.error(err?.message || err); + process.exit(1); +}); diff --git a/ecom-license/cli/src/ui/render.ts b/ecom-license/cli/src/ui/render.ts new file mode 100644 index 00000000..dde90fe2 --- /dev/null +++ b/ecom-license/cli/src/ui/render.ts @@ -0,0 +1,100 @@ +import boxen from 'boxen'; +import chalk from 'chalk'; +import Table from 'cli-table3'; +import gradient from 'gradient-string'; +import ora, { type Ora } from 'ora'; + +import { getGlobalOpts, isInteractive } from '../context.js'; + +export function printBanner() { + if (!isInteractive()) return; + const title = gradient.pastel('Ecom License CLI'); + console.log( + boxen(`${title}\n${chalk.gray('授权管理平台 · 运营端')}`, { + padding: 1, + borderColor: 'cyan', + borderStyle: 'round', + }), + ); +} + +export function printJson(data: unknown) { + console.log(JSON.stringify(data, null, getGlobalOpts().json ? 2 : 0)); +} + +export function printQuiet(value: string) { + console.log(value); +} + +export function printSuccess(msg: string) { + if (getGlobalOpts().json || getGlobalOpts().quiet) return; + console.log(chalk.green('✔'), msg); +} + +export function printError(msg: string) { + if (getGlobalOpts().json) { + printJson({ error: msg }); + return; + } + console.error(chalk.red('✖'), msg); +} + +export function printInfo(msg: string) { + if (getGlobalOpts().json || getGlobalOpts().quiet) return; + console.log(chalk.blue('ℹ'), msg); +} + +export function printBox(title: string, content: string, borderColor: 'green' | 'cyan' | 'yellow' = 'cyan') { + if (!isInteractive()) return; + console.log( + boxen(content, { + title: chalk.bold(title), + padding: 1, + borderColor, + }), + ); +} + +export function printTable(headers: string[], rows: string[][]) { + if (getGlobalOpts().json) { + printJson( + rows.map((row) => + Object.fromEntries(headers.map((h, i) => [h, row[i]])), + ), + ); + return; + } + if (getGlobalOpts().quiet) return; + const table = new Table({ head: headers.map((h) => chalk.cyan(h)) }); + rows.forEach((r) => table.push(r)); + console.log(table.toString()); +} + +export function printEmptyHint(hint: string) { + if (getGlobalOpts().json || getGlobalOpts().quiet) return; + console.log(chalk.yellow('暂无数据。'), chalk.gray(hint)); +} + +let activeSpinner: Ora | null = null; + +export async function runSpinner(fn: () => Promise, text: string): Promise { + const spinner = ora(text).start(); + activeSpinner = spinner; + try { + const result = await fn(); + spinner.succeed(); + return result; + } catch (e) { + spinner.fail(); + throw e; + } finally { + activeSpinner = null; + } +} + +export function failSpinner(msg: string) { + if (activeSpinner) { + activeSpinner.fail(msg); + activeSpinner = null; + } +} diff --git a/ecom-license/cli/tsconfig.json b/ecom-license/cli/tsconfig.json new file mode 100644 index 00000000..025d2d93 --- /dev/null +++ b/ecom-license/cli/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "declaration": false + }, + "include": ["src/**/*"] +} diff --git a/ecom-license/server/.env.example b/ecom-license/server/.env.example new file mode 100644 index 00000000..8009a3d9 --- /dev/null +++ b/ecom-license/server/.env.example @@ -0,0 +1,10 @@ +PORT=3100 +DB_HOST=192.168.3.100 +DB_PORT=3306 +DB_USERNAME=ecom_license_dev +DB_PASSWORD=ecom_license_dev +DB_DATABASE=ecom_license_dev +JWT_SECRET=change-me-in-production +JWT_EXPIRES_IN=8h +LICENSE_PRIVATE_KEY_PATH=keys/private.pem +LICENSE_KID=2026-v1 diff --git a/ecom-license/server/.npmrc b/ecom-license/server/.npmrc new file mode 100644 index 00000000..d9b56f27 --- /dev/null +++ b/ecom-license/server/.npmrc @@ -0,0 +1,2 @@ +# 提升依赖到 node_modules 顶层,改善 IDE / tsserver 模块解析(pnpm 默认隔离布局对部分编辑器不友好) +shamefully-hoist=true diff --git a/ecom-license/server/keys/.gitignore b/ecom-license/server/keys/.gitignore new file mode 100644 index 00000000..2fa1a9f5 --- /dev/null +++ b/ecom-license/server/keys/.gitignore @@ -0,0 +1,2 @@ +*.pem +!/.gitkeep diff --git a/ecom-license/server/keys/.gitkeep b/ecom-license/server/keys/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/ecom-license/server/nest-cli.json b/ecom-license/server/nest-cli.json new file mode 100644 index 00000000..2f068a1e --- /dev/null +++ b/ecom-license/server/nest-cli.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json.schemastore.org/nest-cli", + "collection": "@nestjs/schematics", + "sourceRoot": "src", + "compilerOptions": { + "deleteOutDir": true, + "tsConfigPath": "tsconfig.build.json" + } +} diff --git a/ecom-license/server/package.json b/ecom-license/server/package.json new file mode 100644 index 00000000..eeb9254c --- /dev/null +++ b/ecom-license/server/package.json @@ -0,0 +1,47 @@ +{ + "name": "ecom-license-server", + "version": "0.1.0", + "private": true, + "packageManager": "pnpm@10.32.0", + "scripts": { + "clean": "rm -rf dist", + "build": "nest build", + "prestart": "pnpm run build", + "start": "node dist/main.js", + "start:dev": "nest start --watch", + "start:prod": "node dist/main.js" + }, + "dependencies": { + "@nestjs/common": "^10.4.15", + "@nestjs/config": "^3.3.0", + "@nestjs/core": "^10.4.15", + "@nestjs/jwt": "^10.2.0", + "@nestjs/passport": "^10.0.3", + "@nestjs/platform-express": "^10.4.15", + "@nestjs/typeorm": "^10.0.2", + "bcrypt": "^5.1.1", + "class-transformer": "^0.5.1", + "class-validator": "^0.14.1", + "jose": "^5.9.6", + "mysql2": "^3.11.5", + "passport": "^0.7.0", + "passport-jwt": "^4.0.1", + "reflect-metadata": "^0.2.2", + "rxjs": "^7.8.1", + "typeorm": "^0.3.20", + "uuid": "^11.0.3" + }, + "pnpm": { + "onlyBuiltDependencies": ["bcrypt", "@nestjs/core"] + }, + "devDependencies": { + "@nestjs/cli": "^10.4.9", + "@nestjs/schematics": "^10.2.3", + "@types/bcrypt": "^5.0.2", + "@types/express": "^5.0.0", + "@types/node": "^22.10.2", + "@types/passport-jwt": "^4.0.1", + "@types/uuid": "^10.0.0", + "typescript": "^5.7.2" + } +} diff --git a/ecom-license/server/pnpm-lock.yaml b/ecom-license/server/pnpm-lock.yaml new file mode 100644 index 00000000..2b7688ff --- /dev/null +++ b/ecom-license/server/pnpm-lock.yaml @@ -0,0 +1,3967 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@nestjs/common': + specifier: ^10.4.15 + version: 10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/config': + specifier: ^3.3.0 + version: 3.3.0(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(rxjs@7.8.2) + '@nestjs/core': + specifier: ^10.4.15 + version: 10.4.22(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@10.4.22)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/jwt': + specifier: ^10.2.0 + version: 10.2.0(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2)) + '@nestjs/passport': + specifier: ^10.0.3 + version: 10.0.3(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(passport@0.7.0) + '@nestjs/platform-express': + specifier: ^10.4.15 + version: 10.4.22(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22) + '@nestjs/typeorm': + specifier: ^10.0.2 + version: 10.0.2(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22)(reflect-metadata@0.2.2)(rxjs@7.8.2)(typeorm@0.3.30(mysql2@3.22.5(@types/node@22.19.20))) + bcrypt: + specifier: ^5.1.1 + version: 5.1.1 + class-transformer: + specifier: ^0.5.1 + version: 0.5.1 + class-validator: + specifier: ^0.14.1 + version: 0.14.4 + jose: + specifier: ^5.9.6 + version: 5.10.0 + mysql2: + specifier: ^3.11.5 + version: 3.22.5(@types/node@22.19.20) + passport: + specifier: ^0.7.0 + version: 0.7.0 + passport-jwt: + specifier: ^4.0.1 + version: 4.0.1 + reflect-metadata: + specifier: ^0.2.2 + version: 0.2.2 + rxjs: + specifier: ^7.8.1 + version: 7.8.2 + typeorm: + specifier: ^0.3.20 + version: 0.3.30(mysql2@3.22.5(@types/node@22.19.20)) + uuid: + specifier: ^11.0.3 + version: 11.1.1 + devDependencies: + '@nestjs/cli': + specifier: ^10.4.9 + version: 10.4.9 + '@nestjs/schematics': + specifier: ^10.2.3 + version: 10.2.3(chokidar@3.6.0)(typescript@5.9.3) + '@types/bcrypt': + specifier: ^5.0.2 + version: 5.0.2 + '@types/express': + specifier: ^5.0.0 + version: 5.0.6 + '@types/node': + specifier: ^22.10.2 + version: 22.19.20 + '@types/passport-jwt': + specifier: ^4.0.1 + version: 4.0.1 + '@types/uuid': + specifier: ^10.0.0 + version: 10.0.0 + typescript: + specifier: ^5.7.2 + version: 5.9.3 + +packages: + + '@angular-devkit/core@17.3.11': + resolution: {integrity: sha512-vTNDYNsLIWpYk2I969LMQFH29GTsLzxNk/0cLw5q56ARF0v5sIWfHYwGTS88jdDqIpuuettcSczbxeA7EuAmqQ==} + engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + peerDependencies: + chokidar: ^3.5.2 + peerDependenciesMeta: + chokidar: + optional: true + + '@angular-devkit/schematics-cli@17.3.11': + resolution: {integrity: sha512-kcOMqp+PHAKkqRad7Zd7PbpqJ0LqLaNZdY1+k66lLWmkEBozgq8v4ASn/puPWf9Bo0HpCiK+EzLf0VHE8Z/y6Q==} + engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + hasBin: true + + '@angular-devkit/schematics@17.3.11': + resolution: {integrity: sha512-I5wviiIqiFwar9Pdk30Lujk8FczEEc18i22A5c6Z9lbmhPQdTroDnEQdsfXjy404wPe8H62s0I15o4pmMGfTYQ==} + engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + + '@babel/code-frame@7.29.7': + resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-identifier@7.29.7': + resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==} + engines: {node: '>=6.9.0'} + + '@borewit/text-codec@0.2.2': + resolution: {integrity: sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==} + + '@colors/colors@1.5.0': + resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} + engines: {node: '>=0.1.90'} + + '@isaacs/cliui@8.0.2': + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + + '@jridgewell/gen-mapping@0.3.13': + resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/source-map@0.3.11': + resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==} + + '@jridgewell/sourcemap-codec@1.5.5': + resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} + + '@jridgewell/trace-mapping@0.3.31': + resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + + '@ljharb/through@2.3.14': + resolution: {integrity: sha512-ajBvlKpWucBB17FuQYUShqpqy8GRgYEpJW0vWJbUu1CV9lWyrDCapy0lScU8T8Z6qn49sSwJB3+M+evYIdGg+A==} + engines: {node: '>= 0.4'} + + '@lukeed/csprng@1.1.0': + resolution: {integrity: sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==} + engines: {node: '>=8'} + + '@mapbox/node-pre-gyp@1.0.11': + resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==} + hasBin: true + + '@nestjs/cli@10.4.9': + resolution: {integrity: sha512-s8qYd97bggqeK7Op3iD49X2MpFtW4LVNLAwXFkfbRxKME6IYT7X0muNTJ2+QfI8hpbNx9isWkrLWIp+g5FOhiA==} + engines: {node: '>= 16.14'} + hasBin: true + peerDependencies: + '@swc/cli': ^0.1.62 || ^0.3.0 || ^0.4.0 || ^0.5.0 + '@swc/core': ^1.3.62 + peerDependenciesMeta: + '@swc/cli': + optional: true + '@swc/core': + optional: true + + '@nestjs/common@10.4.22': + resolution: {integrity: sha512-fxJ4v85nDHaqT1PmfNCQ37b/jcv2OojtXTaK1P2uAXhzLf9qq6WNUOFvxBrV4fhQek1EQoT1o9oj5xAZmv3NRw==} + peerDependencies: + class-transformer: '*' + class-validator: '*' + reflect-metadata: ^0.1.12 || ^0.2.0 + rxjs: ^7.1.0 + peerDependenciesMeta: + class-transformer: + optional: true + class-validator: + optional: true + + '@nestjs/config@3.3.0': + resolution: {integrity: sha512-pdGTp8m9d0ZCrjTpjkUbZx6gyf2IKf+7zlkrPNMsJzYZ4bFRRTpXrnj+556/5uiI6AfL5mMrJc2u7dB6bvM+VA==} + peerDependencies: + '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0 + rxjs: ^7.1.0 + + '@nestjs/core@10.4.22': + resolution: {integrity: sha512-6IX9+VwjiKtCjx+mXVPncpkQ5ZjKfmssOZPFexmT+6T9H9wZ3svpYACAo7+9e7Nr9DZSoRZw3pffkJP7Z0UjaA==} + peerDependencies: + '@nestjs/common': ^10.0.0 + '@nestjs/microservices': ^10.0.0 + '@nestjs/platform-express': ^10.0.0 + '@nestjs/websockets': ^10.0.0 + reflect-metadata: ^0.1.12 || ^0.2.0 + rxjs: ^7.1.0 + peerDependenciesMeta: + '@nestjs/microservices': + optional: true + '@nestjs/platform-express': + optional: true + '@nestjs/websockets': + optional: true + + '@nestjs/jwt@10.2.0': + resolution: {integrity: sha512-x8cG90SURkEiLOehNaN2aRlotxT0KZESUliOPKKnjWiyJOcWurkF3w345WOX0P4MgFzUjGoZ1Sy0aZnxeihT0g==} + peerDependencies: + '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0 + + '@nestjs/passport@10.0.3': + resolution: {integrity: sha512-znJ9Y4S8ZDVY+j4doWAJ8EuuVO7SkQN3yOBmzxbGaXbvcSwFDAdGJ+OMCg52NdzIO4tQoN4pYKx8W6M0ArfFRQ==} + peerDependencies: + '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0 + passport: ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 + + '@nestjs/platform-express@10.4.22': + resolution: {integrity: sha512-ySSq7Py/DFozzZdNDH67m/vHoeVdphDniWBnl6q5QVoXldDdrZIHLXLRMPayTDh5A95nt7jjJzmD4qpTbNQ6tA==} + peerDependencies: + '@nestjs/common': ^10.0.0 + '@nestjs/core': ^10.0.0 + + '@nestjs/schematics@10.2.3': + resolution: {integrity: sha512-4e8gxaCk7DhBxVUly2PjYL4xC2ifDFexCqq1/u4TtivLGXotVk0wHdYuPYe1tHTHuR1lsOkRbfOCpkdTnigLVg==} + peerDependencies: + typescript: '>=4.8.2' + + '@nestjs/typeorm@10.0.2': + resolution: {integrity: sha512-H738bJyydK4SQkRCTeh1aFBxoO1E9xdL/HaLGThwrqN95os5mEyAtK7BLADOS+vldP4jDZ2VQPLj4epWwRqCeQ==} + peerDependencies: + '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0 + '@nestjs/core': ^8.0.0 || ^9.0.0 || ^10.0.0 + reflect-metadata: ^0.1.13 || ^0.2.0 + rxjs: ^7.2.0 + typeorm: ^0.3.0 + + '@nuxtjs/opencollective@0.3.2': + resolution: {integrity: sha512-um0xL3fO7Mf4fDxcqx9KryrB7zgRM5JSlvGN5AGkP6JLM5XEKyjeAiPbNxdXVXQ16isuAhYpvP88NgL2BGd6aA==} + engines: {node: '>=8.0.0', npm: '>=5.0.0'} + hasBin: true + + '@pkgjs/parseargs@0.11.0': + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + + '@sqltools/formatter@1.2.5': + resolution: {integrity: sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw==} + + '@tokenizer/inflate@0.2.7': + resolution: {integrity: sha512-MADQgmZT1eKjp06jpI2yozxaU9uVs4GzzgSL+uEq7bVcJ9V1ZXQkeGNql1fsSI0gMy1vhvNTNbUqrx+pZfJVmg==} + engines: {node: '>=18'} + + '@tokenizer/token@0.3.0': + resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} + + '@types/bcrypt@5.0.2': + resolution: {integrity: sha512-6atioO8Y75fNcbmj0G7UjI9lXN2pQ/IGJ2FWT4a/btd0Lk9lQalHLKhkgKVZ3r+spnmWUKfbMi1GEe9wyHQfNQ==} + + '@types/body-parser@1.19.6': + resolution: {integrity: sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==} + + '@types/connect@3.4.38': + resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} + + '@types/eslint-scope@3.7.7': + resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==} + + '@types/eslint@9.6.1': + resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==} + + '@types/estree@1.0.9': + resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==} + + '@types/express-serve-static-core@5.1.1': + resolution: {integrity: sha512-v4zIMr/cX7/d2BpAEX3KNKL/JrT1s43s96lLvvdTmza1oEvDudCqK9aF/djc/SWgy8Yh0h30TZx5VpzqFCxk5A==} + + '@types/express@5.0.6': + resolution: {integrity: sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA==} + + '@types/http-errors@2.0.5': + resolution: {integrity: sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==} + + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/jsonwebtoken@9.0.10': + resolution: {integrity: sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==} + + '@types/jsonwebtoken@9.0.5': + resolution: {integrity: sha512-VRLSGzik+Unrup6BsouBeHsf4d1hOEgYWTm/7Nmw1sXoN1+tRly/Gy/po3yeahnP4jfnQWWAhQAqcNfH7ngOkA==} + + '@types/ms@2.1.0': + resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} + + '@types/node@22.19.20': + resolution: {integrity: sha512-6tELRwSDYWW9EdZhbeZmYGZ1/7Djkt+Ah3/ScEYT9cDord7UJzasR/4D3VONg9tQI5CDp+/CZC1AXj2pCFOvpw==} + + '@types/passport-jwt@4.0.1': + resolution: {integrity: sha512-Y0Ykz6nWP4jpxgEUYq8NoVZeCQPo1ZndJLfapI249g1jHChvRfZRO/LS3tqu26YgAS/laI1qx98sYGz0IalRXQ==} + + '@types/passport-strategy@0.2.38': + resolution: {integrity: sha512-GC6eMqqojOooq993Tmnmp7AUTbbQSgilyvpCYQjT+H6JfG/g6RGc7nXEniZlp0zyKJ0WUdOiZWLBZft9Yug1uA==} + + '@types/passport@1.0.17': + resolution: {integrity: sha512-aciLyx+wDwT2t2/kJGJR2AEeBz0nJU4WuRX04Wu9Dqc5lSUtwu0WERPHYsLhF9PtseiAMPBGNUOtFjxZ56prsg==} + + '@types/qs@6.15.1': + resolution: {integrity: sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw==} + + '@types/range-parser@1.2.7': + resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==} + + '@types/send@1.2.1': + resolution: {integrity: sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==} + + '@types/serve-static@2.2.0': + resolution: {integrity: sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ==} + + '@types/uuid@10.0.0': + resolution: {integrity: sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==} + + '@types/validator@13.15.10': + resolution: {integrity: sha512-T8L6i7wCuyoK8A/ZeLYt1+q0ty3Zb9+qbSSvrIVitzT3YjZqkTZ40IbRsPanlB4h1QB3JVL1SYCdR6ngtFYcuA==} + + '@webassemblyjs/ast@1.14.1': + resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} + + '@webassemblyjs/floating-point-hex-parser@1.13.2': + resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==} + + '@webassemblyjs/helper-api-error@1.13.2': + resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==} + + '@webassemblyjs/helper-buffer@1.14.1': + resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==} + + '@webassemblyjs/helper-numbers@1.13.2': + resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==} + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': + resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==} + + '@webassemblyjs/helper-wasm-section@1.14.1': + resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==} + + '@webassemblyjs/ieee754@1.13.2': + resolution: {integrity: sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==} + + '@webassemblyjs/leb128@1.13.2': + resolution: {integrity: sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==} + + '@webassemblyjs/utf8@1.13.2': + resolution: {integrity: sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==} + + '@webassemblyjs/wasm-edit@1.14.1': + resolution: {integrity: sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==} + + '@webassemblyjs/wasm-gen@1.14.1': + resolution: {integrity: sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==} + + '@webassemblyjs/wasm-opt@1.14.1': + resolution: {integrity: sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==} + + '@webassemblyjs/wasm-parser@1.14.1': + resolution: {integrity: sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==} + + '@webassemblyjs/wast-printer@1.14.1': + resolution: {integrity: sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==} + + '@xtuc/ieee754@1.2.0': + resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} + + '@xtuc/long@4.2.2': + resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} + + abbrev@1.1.1: + resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + + accepts@1.3.8: + resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} + engines: {node: '>= 0.6'} + + acorn@8.16.0: + resolution: {integrity: sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==} + engines: {node: '>=0.4.0'} + hasBin: true + + agent-base@6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + + ajv-formats@2.1.1: + resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + + ajv-keywords@3.5.2: + resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==} + peerDependencies: + ajv: ^6.9.1 + + ajv-keywords@5.1.0: + resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==} + peerDependencies: + ajv: ^8.8.2 + + ajv@6.15.0: + resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==} + + ajv@8.12.0: + resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==} + + ajv@8.20.0: + resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==} + + ansi-colors@4.1.3: + resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} + engines: {node: '>=6'} + + ansi-escapes@4.3.2: + resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} + engines: {node: '>=8'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-regex@6.2.2: + resolution: {integrity: sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==} + engines: {node: '>=12'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + ansi-styles@6.2.3: + resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==} + engines: {node: '>=12'} + + ansis@4.3.1: + resolution: {integrity: sha512-BJ8/l4R5LRE7hW9WdSuGYrLSHi2ynxeFpDFbH0K/CgNeY/tyhk+vO6TYxXC5r5CpUhNVX310xzPsN/H9lCdfOA==} + engines: {node: '>=14'} + + anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + + app-root-path@3.1.0: + resolution: {integrity: sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA==} + engines: {node: '>= 6.0.0'} + + append-field@1.0.0: + resolution: {integrity: sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==} + + aproba@2.1.0: + resolution: {integrity: sha512-tLIEcj5GuR2RSTnxNKdkK0dJ/GrC7P38sUkiDmDuHfsHmbagTFAxDVIBltoklXEVIQ/f14IL8IMJ5pn9Hez1Ew==} + + are-we-there-yet@2.0.0: + resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} + engines: {node: '>=10'} + deprecated: This package is no longer supported. + + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + + array-flatten@1.1.1: + resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} + + array-timsort@1.0.3: + resolution: {integrity: sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==} + + available-typed-arrays@1.0.7: + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} + engines: {node: '>= 0.4'} + + aws-ssl-profiles@1.1.2: + resolution: {integrity: sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==} + engines: {node: '>= 6.0.0'} + + balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + baseline-browser-mapping@2.10.34: + resolution: {integrity: sha512-IMDedajPifLnHNY0X9n8hKxRTQ6/eTHwr5bDo04WnuqxyKw6LYtQywCuuqPZwhl3aBXMvQpJov42GLCwRRdQzw==} + engines: {node: '>=6.0.0'} + hasBin: true + + bcrypt@5.1.1: + resolution: {integrity: sha512-AGBHOG5hPYZ5Xl9KXzU5iKq9516yEmvCKDg3ecP5kX2aB6UqTeXZxk2ELnDgDm6BQSMlLt9rDB4LoSMx0rYwww==} + engines: {node: '>= 10.0.0'} + + binary-extensions@2.3.0: + resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} + engines: {node: '>=8'} + + bl@4.1.0: + resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} + + body-parser@1.20.4: + resolution: {integrity: sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==} + engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} + + brace-expansion@1.1.15: + resolution: {integrity: sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==} + + brace-expansion@2.1.1: + resolution: {integrity: sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==} + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + + browserslist@4.28.2: + resolution: {integrity: sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + + buffer-equal-constant-time@1.0.1: + resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + buffer@5.7.1: + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + + buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + + busboy@1.6.0: + resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} + engines: {node: '>=10.16.0'} + + bytes@3.1.2: + resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} + engines: {node: '>= 0.8'} + + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + + call-bind@1.0.9: + resolution: {integrity: sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==} + engines: {node: '>= 0.4'} + + call-bound@1.0.4: + resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==} + engines: {node: '>= 0.4'} + + callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + + caniuse-lite@1.0.30001797: + resolution: {integrity: sha512-l8xKG+gwAIExZGl9FrF7KUwuOmk6wbEPC9Xoy/RtnWv1XG0Q4LFlagaLpUv3Kiza3W/wm27zy0yWJEieYKAP6w==} + + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + + chalk@5.6.2: + resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + + chardet@0.7.0: + resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + + chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} + engines: {node: '>= 8.10.0'} + + chownr@2.0.0: + resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} + engines: {node: '>=10'} + + chrome-trace-event@1.0.4: + resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} + engines: {node: '>=6.0'} + + class-transformer@0.5.1: + resolution: {integrity: sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==} + + class-validator@0.14.4: + resolution: {integrity: sha512-AwNusCCam51q703dW82x95tOqQp6oC9HNUl724KxJJOfnKscI8dOloXFgyez7LbTTKWuRBA37FScqVbJEoq8Yw==} + + cli-cursor@3.1.0: + resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} + engines: {node: '>=8'} + + cli-spinners@2.9.2: + resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==} + engines: {node: '>=6'} + + cli-table3@0.6.5: + resolution: {integrity: sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==} + engines: {node: 10.* || >= 12.*} + + cli-width@3.0.0: + resolution: {integrity: sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==} + engines: {node: '>= 10'} + + cli-width@4.1.0: + resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==} + engines: {node: '>= 12'} + + cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} + + clone@1.0.4: + resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} + engines: {node: '>=0.8'} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + color-support@1.1.3: + resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} + hasBin: true + + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + + commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + + comment-json@4.2.5: + resolution: {integrity: sha512-bKw/r35jR3HGt5PEPm1ljsQQGyCrR8sFGNiN5L+ykDHdpO8Smxkrkla9Yi6NkQyUrb8V54PGhfMs6NrIwtxtdw==} + engines: {node: '>= 6'} + + concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + + concat-stream@2.0.0: + resolution: {integrity: sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==} + engines: {'0': node >= 6.0} + + consola@2.15.3: + resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==} + + console-control-strings@1.1.0: + resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} + + content-disposition@0.5.4: + resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} + engines: {node: '>= 0.6'} + + content-type@1.0.5: + resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} + engines: {node: '>= 0.6'} + + cookie-signature@1.0.7: + resolution: {integrity: sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==} + + cookie@0.7.2: + resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} + engines: {node: '>= 0.6'} + + core-util-is@1.0.3: + resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} + + cors@2.8.5: + resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==} + engines: {node: '>= 0.10'} + + cosmiconfig@8.3.6: + resolution: {integrity: sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==} + engines: {node: '>=14'} + peerDependencies: + typescript: '>=4.9.5' + peerDependenciesMeta: + typescript: + optional: true + + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + + dayjs@1.11.21: + resolution: {integrity: sha512-98IT+HOahAisibz/yjKbzuOBwYcjJ7BCLPzARyHiyEBmRz4fatF+KPJszEHXsGYjUG234aH/cOjW1wwTbKUZlA==} + + debug@2.6.9: + resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + dedent@1.7.2: + resolution: {integrity: sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==} + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + + deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + + defaults@1.0.4: + resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} + + define-data-property@1.1.4: + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} + engines: {node: '>= 0.4'} + + delegates@1.0.0: + resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} + + denque@2.1.0: + resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==} + engines: {node: '>=0.10'} + + depd@2.0.0: + resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} + engines: {node: '>= 0.8'} + + destroy@1.2.0: + resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} + engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + dotenv-expand@10.0.0: + resolution: {integrity: sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==} + engines: {node: '>=12'} + + dotenv@16.4.5: + resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} + engines: {node: '>=12'} + + dotenv@16.6.1: + resolution: {integrity: sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==} + engines: {node: '>=12'} + + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + + eastasianwidth@0.2.0: + resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + + ecdsa-sig-formatter@1.0.11: + resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==} + + ee-first@1.1.1: + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + + electron-to-chromium@1.5.368: + resolution: {integrity: sha512-7RckJJK4uESJF9PxvfMWd3TGqIiieUTG4HxnKaKuIpGbcr+r2ZEB3g2gAhCP3Fqm42vJSzLfgab9eva/C4/XVw==} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + emoji-regex@9.2.2: + resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + + encodeurl@2.0.0: + resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==} + engines: {node: '>= 0.8'} + + enhanced-resolve@5.23.0: + resolution: {integrity: sha512-yJN/BOOLxcOW2aQgeif9mSnaUB8KtvmMMp56oA1kx1CRfBKbhZm2pJ+NBY+3eOboHxix8lfjWpHE0Ei5U8RbSA==} + engines: {node: '>=10.13.0'} + + error-ex@1.3.4: + resolution: {integrity: sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==} + + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + + es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} + + es-object-atoms@1.1.2: + resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==} + engines: {node: '>= 0.4'} + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + escape-html@1.0.3: + resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + + escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + + eslint-scope@5.1.1: + resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} + engines: {node: '>=8.0.0'} + + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@4.3.0: + resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + etag@1.8.1: + resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} + engines: {node: '>= 0.6'} + + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + + express@4.22.1: + resolution: {integrity: sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==} + engines: {node: '>= 0.10.0'} + + external-editor@3.1.0: + resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} + engines: {node: '>=4'} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + fast-safe-stringify@2.1.1: + resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} + + fast-uri@3.1.2: + resolution: {integrity: sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==} + + fflate@0.8.3: + resolution: {integrity: sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==} + + figures@3.2.0: + resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} + engines: {node: '>=8'} + + file-type@20.4.1: + resolution: {integrity: sha512-hw9gNZXUfZ02Jo0uafWLaFVPter5/k2rfcrjFJJHX/77xtSDOfJuEFb6oKlFV86FLP1SuyHMW1PSk0U9M5tKkQ==} + engines: {node: '>=18'} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + finalhandler@1.3.2: + resolution: {integrity: sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==} + engines: {node: '>= 0.8'} + + for-each@0.3.5: + resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==} + engines: {node: '>= 0.4'} + + foreground-child@3.3.1: + resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} + engines: {node: '>=14'} + + fork-ts-checker-webpack-plugin@9.0.2: + resolution: {integrity: sha512-Uochze2R8peoN1XqlSi/rGUkDQpRogtLFocP9+PGu68zk1BDAKXfdeCdyVZpgTk8V8WFVQXdEz426VKjXLO1Gg==} + engines: {node: '>=12.13.0', yarn: '>=1.0.0'} + peerDependencies: + typescript: '>3.6.0' + webpack: ^5.11.0 + + forwarded@0.2.0: + resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} + engines: {node: '>= 0.6'} + + fresh@0.5.2: + resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} + engines: {node: '>= 0.6'} + + fs-extra@10.1.0: + resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} + engines: {node: '>=12'} + + fs-minipass@2.1.0: + resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} + engines: {node: '>= 8'} + + fs-monkey@1.1.0: + resolution: {integrity: sha512-QMUezzXWII9EV5aTFXW1UBVUO77wYPpjqIF8/AviUCThNeSYZykpoTixUeaNNBwmCev0AMDWMAni+f8Hxb1IFw==} + + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + gauge@3.0.2: + resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} + engines: {node: '>=10'} + deprecated: This package is no longer supported. + + generate-function@2.3.1: + resolution: {integrity: sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==} + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + glob-to-regexp@0.4.1: + resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} + + glob@10.4.5: + resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + hasBin: true + + glob@10.5.0: + resolution: {integrity: sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + hasBin: true + + glob@7.2.3: + resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + has-own-prop@2.0.0: + resolution: {integrity: sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ==} + engines: {node: '>=8'} + + has-property-descriptors@1.0.2: + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} + + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + + has-unicode@2.0.1: + resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} + + hasown@2.0.4: + resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==} + engines: {node: '>= 0.4'} + + http-errors@2.0.1: + resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==} + engines: {node: '>= 0.8'} + + https-proxy-agent@5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + + iconv-lite@0.4.24: + resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} + engines: {node: '>=0.10.0'} + + iconv-lite@0.7.2: + resolution: {integrity: sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==} + engines: {node: '>=0.10.0'} + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + + import-fresh@3.3.1: + resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} + engines: {node: '>=6'} + + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + inquirer@8.2.6: + resolution: {integrity: sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==} + engines: {node: '>=12.0.0'} + + inquirer@9.2.15: + resolution: {integrity: sha512-vI2w4zl/mDluHt9YEQ/543VTCwPKWiHzKtm9dM2V0NdFcqEexDAjUHzO1oA60HRNaVifGXXM1tRRNluLVHa0Kg==} + engines: {node: '>=18'} + + ipaddr.js@1.9.1: + resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} + engines: {node: '>= 0.10'} + + is-arrayish@0.2.1: + resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} + + is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + + is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-interactive@1.0.0: + resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==} + engines: {node: '>=8'} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-property@1.0.2: + resolution: {integrity: sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==} + + is-typed-array@1.1.15: + resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} + engines: {node: '>= 0.4'} + + is-unicode-supported@0.1.0: + resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} + engines: {node: '>=10'} + + isarray@2.0.5: + resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + iterare@1.2.1: + resolution: {integrity: sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==} + engines: {node: '>=6'} + + jackspeak@3.4.3: + resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + + jest-worker@27.5.1: + resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} + engines: {node: '>= 10.13.0'} + + jose@5.10.0: + resolution: {integrity: sha512-s+3Al/p9g32Iq+oqXxkW//7jk2Vig6FF1CFqzVXoTUXt2qz89YWbL+OwS17NFYEvxC35n0FKeGO2LGYSxeM2Gg==} + + js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + + js-yaml@4.2.0: + resolution: {integrity: sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==} + hasBin: true + + json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + + json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + + json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + + jsonc-parser@3.2.1: + resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==} + + jsonc-parser@3.3.1: + resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==} + + jsonfile@6.2.1: + resolution: {integrity: sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==} + + jsonwebtoken@9.0.2: + resolution: {integrity: sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==} + engines: {node: '>=12', npm: '>=6'} + + jsonwebtoken@9.0.3: + resolution: {integrity: sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==} + engines: {node: '>=12', npm: '>=6'} + + jwa@1.4.2: + resolution: {integrity: sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==} + + jwa@2.0.1: + resolution: {integrity: sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==} + + jws@3.2.3: + resolution: {integrity: sha512-byiJ0FLRdLdSVSReO/U4E7RoEyOCKnEnEPMjq3HxWtvzLsV08/i5RQKsFVNkCldrCaPr2vDNAOMsfs8T/Hze7g==} + + jws@4.0.1: + resolution: {integrity: sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==} + + libphonenumber-js@1.13.6: + resolution: {integrity: sha512-NdB6O6QvlGMCoG003m0YIKG2+Xw7DjmCZhmc1RH+K6HncADUbRf8TZeLegxBBN1VFyPHcNpPTKpIhYLXzJVy1Q==} + + lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + + loader-runner@4.3.2: + resolution: {integrity: sha512-DFEqQ3ihfS9blba08cLfYf1NRAIEm+dDjic073DRDc3/JspI/8wYmtDsHwd3+4hwvdxSK7PGaElfTmm0awWJ4w==} + engines: {node: '>=6.11.5'} + + lodash.includes@4.3.0: + resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==} + + lodash.isboolean@3.0.3: + resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==} + + lodash.isinteger@4.0.4: + resolution: {integrity: sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==} + + lodash.isnumber@3.0.3: + resolution: {integrity: sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==} + + lodash.isplainobject@4.0.6: + resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} + + lodash.isstring@4.0.1: + resolution: {integrity: sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==} + + lodash.once@4.1.1: + resolution: {integrity: sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==} + + lodash@4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + + lodash@4.18.1: + resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==} + + log-symbols@4.1.0: + resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} + engines: {node: '>=10'} + + long@5.3.2: + resolution: {integrity: sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==} + + lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + + lru.min@1.1.4: + resolution: {integrity: sha512-DqC6n3QQ77zdFpCMASA1a3Jlb64Hv2N2DciFGkO/4L9+q/IpIAuRlKOvCXabtRW6cQf8usbmM6BE/TOPysCdIA==} + engines: {bun: '>=1.0.0', deno: '>=1.30.0', node: '>=8.0.0'} + + magic-string@0.30.8: + resolution: {integrity: sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==} + engines: {node: '>=12'} + + make-dir@3.1.0: + resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} + engines: {node: '>=8'} + + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + + media-typer@0.3.0: + resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} + engines: {node: '>= 0.6'} + + memfs@3.5.3: + resolution: {integrity: sha512-UERzLsxzllchadvbPs5aolHh65ISpKpM+ccLbOJ8/vvpBKmAWf+la7dXFy7Mr0ySHbdHrFv5kGFCUHHe6GFEmw==} + engines: {node: '>= 4.0.0'} + + merge-descriptors@1.0.3: + resolution: {integrity: sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + methods@1.1.2: + resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} + engines: {node: '>= 0.6'} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + mime@1.6.0: + resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} + engines: {node: '>=4'} + hasBin: true + + mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + + minimatch@3.1.5: + resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==} + + minimatch@9.0.9: + resolution: {integrity: sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==} + engines: {node: '>=16 || 14 >=14.17'} + + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + minipass@3.3.6: + resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} + engines: {node: '>=8'} + + minipass@5.0.0: + resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==} + engines: {node: '>=8'} + + minipass@7.1.3: + resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==} + engines: {node: '>=16 || 14 >=14.17'} + + minizlib@2.1.2: + resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} + engines: {node: '>= 8'} + + mkdirp@0.5.6: + resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} + hasBin: true + + mkdirp@1.0.4: + resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} + engines: {node: '>=10'} + hasBin: true + + ms@2.0.0: + resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + multer@2.0.2: + resolution: {integrity: sha512-u7f2xaZ/UG8oLXHvtF/oWTRvT44p9ecwBBqTwgJVq0+4BW1g8OW01TyMEGWBHbyMOYVHXslaut7qEQ1meATXgw==} + engines: {node: '>= 10.16.0'} + + mute-stream@0.0.8: + resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} + + mute-stream@1.0.0: + resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + + mysql2@3.22.5: + resolution: {integrity: sha512-95uZ2TrPWAZdwpB3vvvDbmEMcNG8yIeNCyu6GUcr/QnWEE/wXm7+mhOCsdQfWQDTV7qYT/PDUZ4U4UPP4AsXqQ==} + engines: {node: '>= 8.0'} + peerDependencies: + '@types/node': '>= 8' + + named-placeholders@1.1.6: + resolution: {integrity: sha512-Tz09sEL2EEuv5fFowm419c1+a/jSMiBjI9gHxVLrVdbUkkNUUfjsVYs9pVZu5oCon/kmRh9TfLEObFtkVxmY0w==} + engines: {node: '>=8.0.0'} + + negotiator@0.6.3: + resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} + engines: {node: '>= 0.6'} + + neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + + node-abort-controller@3.1.1: + resolution: {integrity: sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==} + + node-addon-api@5.1.0: + resolution: {integrity: sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==} + + node-emoji@1.11.0: + resolution: {integrity: sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==} + + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + + node-releases@2.0.47: + resolution: {integrity: sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==} + engines: {node: '>=18'} + + nopt@5.0.0: + resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} + engines: {node: '>=6'} + hasBin: true + + normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + + npmlog@5.0.1: + resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} + deprecated: This package is no longer supported. + + object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + + object-inspect@1.13.4: + resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} + engines: {node: '>= 0.4'} + + on-finished@2.4.1: + resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} + engines: {node: '>= 0.8'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + + ora@5.4.1: + resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==} + engines: {node: '>=10'} + + os-tmpdir@1.0.2: + resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} + engines: {node: '>=0.10.0'} + + package-json-from-dist@1.0.1: + resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} + + parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} + + parse-json@5.2.0: + resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} + engines: {node: '>=8'} + + parseurl@1.3.3: + resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} + engines: {node: '>= 0.8'} + + passport-jwt@4.0.1: + resolution: {integrity: sha512-UCKMDYhNuGOBE9/9Ycuoyh7vP6jpeTp/+sfMJl7nLff/t6dps+iaeE0hhNkKN8/HZHcJ7lCdOyDxHdDoxoSvdQ==} + + passport-strategy@1.0.0: + resolution: {integrity: sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA==} + engines: {node: '>= 0.4.0'} + + passport@0.7.0: + resolution: {integrity: sha512-cPLl+qZpSc+ireUvt+IzqbED1cHHkDoVYMo30jbJIdOOjQ1MQYZBPiNvmi8UM6lJuOpTPXJGZQk0DtC4y61MYQ==} + engines: {node: '>= 0.4.0'} + + path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-scurry@1.11.1: + resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} + engines: {node: '>=16 || 14 >=14.18'} + + path-to-regexp@0.1.13: + resolution: {integrity: sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==} + + path-to-regexp@3.3.0: + resolution: {integrity: sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==} + + path-type@4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + + pause@0.0.1: + resolution: {integrity: sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.2: + resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} + engines: {node: '>=8.6'} + + picomatch@4.0.1: + resolution: {integrity: sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg==} + engines: {node: '>=12'} + + pluralize@8.0.0: + resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} + engines: {node: '>=4'} + + possible-typed-array-names@1.1.0: + resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==} + engines: {node: '>= 0.4'} + + proxy-addr@2.0.7: + resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} + engines: {node: '>= 0.10'} + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + + qs@6.14.2: + resolution: {integrity: sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q==} + engines: {node: '>=0.6'} + + range-parser@1.2.1: + resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} + engines: {node: '>= 0.6'} + + raw-body@2.5.3: + resolution: {integrity: sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==} + engines: {node: '>= 0.8'} + + readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + + readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + + reflect-metadata@0.2.2: + resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==} + + repeat-string@1.6.1: + resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==} + engines: {node: '>=0.10'} + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + + resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + + restore-cursor@3.1.0: + resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==} + engines: {node: '>=8'} + + rimraf@3.0.2: + resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + deprecated: Rimraf versions prior to v4 are no longer supported + hasBin: true + + run-async@2.4.1: + resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} + engines: {node: '>=0.12.0'} + + run-async@3.0.0: + resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==} + engines: {node: '>=0.12.0'} + + rxjs@7.8.1: + resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} + + rxjs@7.8.2: + resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + + schema-utils@3.3.0: + resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==} + engines: {node: '>= 10.13.0'} + + schema-utils@4.3.3: + resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} + engines: {node: '>= 10.13.0'} + + semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + + semver@7.8.2: + resolution: {integrity: sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==} + engines: {node: '>=10'} + hasBin: true + + send@0.19.2: + resolution: {integrity: sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==} + engines: {node: '>= 0.8.0'} + + serve-static@1.16.3: + resolution: {integrity: sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==} + engines: {node: '>= 0.8.0'} + + set-blocking@2.0.0: + resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} + + set-function-length@1.2.2: + resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} + engines: {node: '>= 0.4'} + + setprototypeof@1.2.0: + resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + + sha.js@2.4.12: + resolution: {integrity: sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==} + engines: {node: '>= 0.10'} + hasBin: true + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + side-channel-list@1.0.1: + resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==} + engines: {node: '>= 0.4'} + + side-channel-map@1.0.1: + resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==} + engines: {node: '>= 0.4'} + + side-channel-weakmap@1.0.2: + resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==} + engines: {node: '>= 0.4'} + + side-channel@1.1.0: + resolution: {integrity: sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==} + engines: {node: '>= 0.4'} + + signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + source-map@0.7.4: + resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} + engines: {node: '>= 8'} + + sql-escaper@1.3.3: + resolution: {integrity: sha512-BsTCV265VpTp8tm1wyIm1xqQCS+Q9NHx2Sr+WcnUrgLrQ6yiDIvHYJV5gHxsj1lMBy2zm5twLaZao8Jd+S8JJw==} + engines: {bun: '>=1.0.0', deno: '>=2.0.0', node: '>=12.0.0'} + + sql-highlight@6.1.0: + resolution: {integrity: sha512-ed7OK4e9ywpE7pgRMkMQmZDPKSVdm0oX5IEtZiKnFucSF0zu6c80GZBe38UqHuVhTWJ9xsKgSMjCG2bml86KvA==} + engines: {node: '>=14'} + + statuses@2.0.2: + resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} + engines: {node: '>= 0.8'} + + streamsearch@1.1.0: + resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} + engines: {node: '>=10.0.0'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + string-width@5.1.2: + resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} + engines: {node: '>=12'} + + string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-ansi@7.2.0: + resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==} + engines: {node: '>=12'} + + strip-bom@3.0.0: + resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} + engines: {node: '>=4'} + + strtok3@10.3.5: + resolution: {integrity: sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA==} + engines: {node: '>=18'} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + symbol-observable@4.0.0: + resolution: {integrity: sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==} + engines: {node: '>=0.10'} + + tapable@2.3.3: + resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==} + engines: {node: '>=6'} + + tar@6.2.1: + resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} + engines: {node: '>=10'} + deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + + terser-webpack-plugin@5.6.1: + resolution: {integrity: sha512-201R5j+sJpK8nFWwKVyNfZot8FaJbLZDq5evriVzbV1wDtSXDjRUDRfJzHpAaxFDMEhsZL1QkeqM61wgsS3KaQ==} + engines: {node: '>= 10.13.0'} + peerDependencies: + '@minify-html/node': '*' + '@swc/core': '*' + '@swc/css': '*' + '@swc/html': '*' + clean-css: '*' + cssnano: '*' + csso: '*' + esbuild: '*' + html-minifier-terser: '*' + lightningcss: '*' + postcss: '*' + uglify-js: '*' + webpack: ^5.1.0 + peerDependenciesMeta: + '@minify-html/node': + optional: true + '@swc/core': + optional: true + '@swc/css': + optional: true + '@swc/html': + optional: true + clean-css: + optional: true + cssnano: + optional: true + csso: + optional: true + esbuild: + optional: true + html-minifier-terser: + optional: true + lightningcss: + optional: true + postcss: + optional: true + uglify-js: + optional: true + + terser@5.48.0: + resolution: {integrity: sha512-J/9An6vs9Us6wKRriSFXBWdRZapREHqFzdNUKk0pmu804EMR6dr6winwo7e5JDxN4xahxQsuysyYFwlwj4XN/Q==} + engines: {node: '>=10'} + hasBin: true + + through@2.3.8: + resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} + + tmp@0.0.33: + resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} + engines: {node: '>=0.6.0'} + + to-buffer@1.2.2: + resolution: {integrity: sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw==} + engines: {node: '>= 0.4'} + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + toidentifier@1.0.1: + resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} + engines: {node: '>=0.6'} + + token-types@6.1.2: + resolution: {integrity: sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==} + engines: {node: '>=14.16'} + + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + + tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + + tsconfig-paths-webpack-plugin@4.2.0: + resolution: {integrity: sha512-zbem3rfRS8BgeNK50Zz5SIQgXzLafiHjOwUAvk/38/o1jHn/V5QAgVUcz884or7WYcPaH3N2CIfUc2u0ul7UcA==} + engines: {node: '>=10.13.0'} + + tsconfig-paths@4.2.0: + resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==} + engines: {node: '>=6'} + + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + + type-fest@0.21.3: + resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} + engines: {node: '>=10'} + + type-is@1.6.18: + resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} + engines: {node: '>= 0.6'} + + typed-array-buffer@1.0.3: + resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==} + engines: {node: '>= 0.4'} + + typedarray@0.0.6: + resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} + + typeorm@0.3.30: + resolution: {integrity: sha512-8T35PzjefOdqc2ZR9mwLQj0pUGp6lQhMbK2EvVMwJVJWlaoHm0v/Q6dThNOZkFchD+0yMg8gwjKM28ePiLSXSQ==} + engines: {node: '>=16.13.0'} + hasBin: true + peerDependencies: + '@google-cloud/spanner': ^5.18.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 + '@sap/hana-client': ^2.14.22 + better-sqlite3: ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 + ioredis: ^5.0.4 + mongodb: ^5.8.0 || ^6.0.0 + mssql: ^9.1.1 || ^10.0.0 || ^11.0.0 || ^12.0.0 + mysql2: ^2.2.5 || ^3.0.1 + oracledb: ^6.3.0 + pg: ^8.5.1 + pg-native: ^3.0.0 + pg-query-stream: ^4.0.0 + redis: ^3.1.1 || ^4.0.0 || ^5.0.14 + sql.js: ^1.4.0 + sqlite3: ^5.0.3 + ts-node: ^10.7.0 + typeorm-aurora-data-api-driver: ^2.0.0 || ^3.0.0 + peerDependenciesMeta: + '@google-cloud/spanner': + optional: true + '@sap/hana-client': + optional: true + better-sqlite3: + optional: true + ioredis: + optional: true + mongodb: + optional: true + mssql: + optional: true + mysql2: + optional: true + oracledb: + optional: true + pg: + optional: true + pg-native: + optional: true + pg-query-stream: + optional: true + redis: + optional: true + sql.js: + optional: true + sqlite3: + optional: true + ts-node: + optional: true + typeorm-aurora-data-api-driver: + optional: true + + typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} + engines: {node: '>=14.17'} + hasBin: true + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + + uid@2.0.2: + resolution: {integrity: sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==} + engines: {node: '>=8'} + + uint8array-extras@1.5.0: + resolution: {integrity: sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==} + engines: {node: '>=18'} + + undici-types@6.21.0: + resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + + universalify@2.0.1: + resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} + engines: {node: '>= 10.0.0'} + + unpipe@1.0.0: + resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} + engines: {node: '>= 0.8'} + + update-browserslist-db@1.2.3: + resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + utils-merge@1.0.1: + resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} + engines: {node: '>= 0.4.0'} + + uuid@11.1.1: + resolution: {integrity: sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ==} + hasBin: true + + uuid@9.0.1: + resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} + deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). + hasBin: true + + validator@13.15.35: + resolution: {integrity: sha512-TQ5pAGhd5whStmqWvYF4OjQROlmv9SMFVt37qoCBdqRffuuklWYQlCNnEs2ZaIBD1kZRNnikiZOS1eqgkar0iw==} + engines: {node: '>= 0.10'} + + vary@1.1.2: + resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} + engines: {node: '>= 0.8'} + + watchpack@2.5.1: + resolution: {integrity: sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==} + engines: {node: '>=10.13.0'} + + wcwidth@1.0.1: + resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} + + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + webpack-node-externals@3.0.0: + resolution: {integrity: sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==} + engines: {node: '>=6'} + + webpack-sources@3.5.0: + resolution: {integrity: sha512-HPuy+uuoTCaaoEoI1LQ3JN9+vrPBvEesnnX1jADHy728cHSMlq4wUc4afYqahq2B1mhQVZxCXOkNTnXltr+2vQ==} + engines: {node: '>=10.13.0'} + + webpack@5.97.1: + resolution: {integrity: sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg==} + engines: {node: '>=10.13.0'} + hasBin: true + peerDependencies: + webpack-cli: '*' + peerDependenciesMeta: + webpack-cli: + optional: true + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + + which-typed-array@1.1.22: + resolution: {integrity: sha512-fvO4ExWMFsqyhG3AiPAObMuY1lxaqgYcxbc49CNdWDDECOJNgQyvsOWVwbZc+qf3rzRtxojBK+CMEv0Ld5CYpw==} + engines: {node: '>= 0.4'} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + wide-align@1.1.5: + resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} + + wrap-ansi@6.2.0: + resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} + engines: {node: '>=8'} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrap-ansi@8.1.0: + resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} + engines: {node: '>=12'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + xtend@4.0.2: + resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} + engines: {node: '>=0.4'} + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yallist@4.0.0: + resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + + yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + + yargs@17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} + +snapshots: + + '@angular-devkit/core@17.3.11(chokidar@3.6.0)': + dependencies: + ajv: 8.12.0 + ajv-formats: 2.1.1(ajv@8.12.0) + jsonc-parser: 3.2.1 + picomatch: 4.0.1 + rxjs: 7.8.1 + source-map: 0.7.4 + optionalDependencies: + chokidar: 3.6.0 + + '@angular-devkit/schematics-cli@17.3.11(chokidar@3.6.0)': + dependencies: + '@angular-devkit/core': 17.3.11(chokidar@3.6.0) + '@angular-devkit/schematics': 17.3.11(chokidar@3.6.0) + ansi-colors: 4.1.3 + inquirer: 9.2.15 + symbol-observable: 4.0.0 + yargs-parser: 21.1.1 + transitivePeerDependencies: + - chokidar + + '@angular-devkit/schematics@17.3.11(chokidar@3.6.0)': + dependencies: + '@angular-devkit/core': 17.3.11(chokidar@3.6.0) + jsonc-parser: 3.2.1 + magic-string: 0.30.8 + ora: 5.4.1 + rxjs: 7.8.1 + transitivePeerDependencies: + - chokidar + + '@babel/code-frame@7.29.7': + dependencies: + '@babel/helper-validator-identifier': 7.29.7 + js-tokens: 4.0.0 + picocolors: 1.1.1 + + '@babel/helper-validator-identifier@7.29.7': {} + + '@borewit/text-codec@0.2.2': {} + + '@colors/colors@1.5.0': + optional: true + + '@isaacs/cliui@8.0.2': + dependencies: + string-width: 5.1.2 + string-width-cjs: string-width@4.2.3 + strip-ansi: 7.2.0 + strip-ansi-cjs: strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: wrap-ansi@7.0.0 + + '@jridgewell/gen-mapping@0.3.13': + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/source-map@0.3.11': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/sourcemap-codec@1.5.5': {} + + '@jridgewell/trace-mapping@0.3.31': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.5 + + '@ljharb/through@2.3.14': + dependencies: + call-bind: 1.0.9 + + '@lukeed/csprng@1.1.0': {} + + '@mapbox/node-pre-gyp@1.0.11': + dependencies: + detect-libc: 2.1.2 + https-proxy-agent: 5.0.1 + make-dir: 3.1.0 + node-fetch: 2.7.0 + nopt: 5.0.0 + npmlog: 5.0.1 + rimraf: 3.0.2 + semver: 7.8.2 + tar: 6.2.1 + transitivePeerDependencies: + - encoding + - supports-color + + '@nestjs/cli@10.4.9': + dependencies: + '@angular-devkit/core': 17.3.11(chokidar@3.6.0) + '@angular-devkit/schematics': 17.3.11(chokidar@3.6.0) + '@angular-devkit/schematics-cli': 17.3.11(chokidar@3.6.0) + '@nestjs/schematics': 10.2.3(chokidar@3.6.0)(typescript@5.7.2) + chalk: 4.1.2 + chokidar: 3.6.0 + cli-table3: 0.6.5 + commander: 4.1.1 + fork-ts-checker-webpack-plugin: 9.0.2(typescript@5.7.2)(webpack@5.97.1) + glob: 10.4.5 + inquirer: 8.2.6 + node-emoji: 1.11.0 + ora: 5.4.1 + tree-kill: 1.2.2 + tsconfig-paths: 4.2.0 + tsconfig-paths-webpack-plugin: 4.2.0 + typescript: 5.7.2 + webpack: 5.97.1 + webpack-node-externals: 3.0.0 + transitivePeerDependencies: + - '@minify-html/node' + - '@swc/css' + - '@swc/html' + - clean-css + - cssnano + - csso + - esbuild + - html-minifier-terser + - lightningcss + - postcss + - uglify-js + - webpack-cli + + '@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2)': + dependencies: + file-type: 20.4.1 + iterare: 1.2.1 + reflect-metadata: 0.2.2 + rxjs: 7.8.2 + tslib: 2.8.1 + uid: 2.0.2 + optionalDependencies: + class-transformer: 0.5.1 + class-validator: 0.14.4 + transitivePeerDependencies: + - supports-color + + '@nestjs/config@3.3.0(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(rxjs@7.8.2)': + dependencies: + '@nestjs/common': 10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + dotenv: 16.4.5 + dotenv-expand: 10.0.0 + lodash: 4.17.21 + rxjs: 7.8.2 + + '@nestjs/core@10.4.22(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@10.4.22)(reflect-metadata@0.2.2)(rxjs@7.8.2)': + dependencies: + '@nestjs/common': 10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nuxtjs/opencollective': 0.3.2 + fast-safe-stringify: 2.1.1 + iterare: 1.2.1 + path-to-regexp: 3.3.0 + reflect-metadata: 0.2.2 + rxjs: 7.8.2 + tslib: 2.8.1 + uid: 2.0.2 + optionalDependencies: + '@nestjs/platform-express': 10.4.22(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22) + transitivePeerDependencies: + - encoding + + '@nestjs/jwt@10.2.0(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))': + dependencies: + '@nestjs/common': 10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@types/jsonwebtoken': 9.0.5 + jsonwebtoken: 9.0.2 + + '@nestjs/passport@10.0.3(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(passport@0.7.0)': + dependencies: + '@nestjs/common': 10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + passport: 0.7.0 + + '@nestjs/platform-express@10.4.22(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22)': + dependencies: + '@nestjs/common': 10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': 10.4.22(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@10.4.22)(reflect-metadata@0.2.2)(rxjs@7.8.2) + body-parser: 1.20.4 + cors: 2.8.5 + express: 4.22.1 + multer: 2.0.2 + tslib: 2.8.1 + transitivePeerDependencies: + - supports-color + + '@nestjs/schematics@10.2.3(chokidar@3.6.0)(typescript@5.7.2)': + dependencies: + '@angular-devkit/core': 17.3.11(chokidar@3.6.0) + '@angular-devkit/schematics': 17.3.11(chokidar@3.6.0) + comment-json: 4.2.5 + jsonc-parser: 3.3.1 + pluralize: 8.0.0 + typescript: 5.7.2 + transitivePeerDependencies: + - chokidar + + '@nestjs/schematics@10.2.3(chokidar@3.6.0)(typescript@5.9.3)': + dependencies: + '@angular-devkit/core': 17.3.11(chokidar@3.6.0) + '@angular-devkit/schematics': 17.3.11(chokidar@3.6.0) + comment-json: 4.2.5 + jsonc-parser: 3.3.1 + pluralize: 8.0.0 + typescript: 5.9.3 + transitivePeerDependencies: + - chokidar + + '@nestjs/typeorm@10.0.2(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22)(reflect-metadata@0.2.2)(rxjs@7.8.2)(typeorm@0.3.30(mysql2@3.22.5(@types/node@22.19.20)))': + dependencies: + '@nestjs/common': 10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': 10.4.22(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@10.4.22)(reflect-metadata@0.2.2)(rxjs@7.8.2) + reflect-metadata: 0.2.2 + rxjs: 7.8.2 + typeorm: 0.3.30(mysql2@3.22.5(@types/node@22.19.20)) + uuid: 9.0.1 + + '@nuxtjs/opencollective@0.3.2': + dependencies: + chalk: 4.1.2 + consola: 2.15.3 + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + + '@pkgjs/parseargs@0.11.0': + optional: true + + '@sqltools/formatter@1.2.5': {} + + '@tokenizer/inflate@0.2.7': + dependencies: + debug: 4.4.3 + fflate: 0.8.3 + token-types: 6.1.2 + transitivePeerDependencies: + - supports-color + + '@tokenizer/token@0.3.0': {} + + '@types/bcrypt@5.0.2': + dependencies: + '@types/node': 22.19.20 + + '@types/body-parser@1.19.6': + dependencies: + '@types/connect': 3.4.38 + '@types/node': 22.19.20 + + '@types/connect@3.4.38': + dependencies: + '@types/node': 22.19.20 + + '@types/eslint-scope@3.7.7': + dependencies: + '@types/eslint': 9.6.1 + '@types/estree': 1.0.9 + + '@types/eslint@9.6.1': + dependencies: + '@types/estree': 1.0.9 + '@types/json-schema': 7.0.15 + + '@types/estree@1.0.9': {} + + '@types/express-serve-static-core@5.1.1': + dependencies: + '@types/node': 22.19.20 + '@types/qs': 6.15.1 + '@types/range-parser': 1.2.7 + '@types/send': 1.2.1 + + '@types/express@5.0.6': + dependencies: + '@types/body-parser': 1.19.6 + '@types/express-serve-static-core': 5.1.1 + '@types/serve-static': 2.2.0 + + '@types/http-errors@2.0.5': {} + + '@types/json-schema@7.0.15': {} + + '@types/jsonwebtoken@9.0.10': + dependencies: + '@types/ms': 2.1.0 + '@types/node': 22.19.20 + + '@types/jsonwebtoken@9.0.5': + dependencies: + '@types/node': 22.19.20 + + '@types/ms@2.1.0': {} + + '@types/node@22.19.20': + dependencies: + undici-types: 6.21.0 + + '@types/passport-jwt@4.0.1': + dependencies: + '@types/jsonwebtoken': 9.0.10 + '@types/passport-strategy': 0.2.38 + + '@types/passport-strategy@0.2.38': + dependencies: + '@types/express': 5.0.6 + '@types/passport': 1.0.17 + + '@types/passport@1.0.17': + dependencies: + '@types/express': 5.0.6 + + '@types/qs@6.15.1': {} + + '@types/range-parser@1.2.7': {} + + '@types/send@1.2.1': + dependencies: + '@types/node': 22.19.20 + + '@types/serve-static@2.2.0': + dependencies: + '@types/http-errors': 2.0.5 + '@types/node': 22.19.20 + + '@types/uuid@10.0.0': {} + + '@types/validator@13.15.10': {} + + '@webassemblyjs/ast@1.14.1': + dependencies: + '@webassemblyjs/helper-numbers': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + + '@webassemblyjs/floating-point-hex-parser@1.13.2': {} + + '@webassemblyjs/helper-api-error@1.13.2': {} + + '@webassemblyjs/helper-buffer@1.14.1': {} + + '@webassemblyjs/helper-numbers@1.13.2': + dependencies: + '@webassemblyjs/floating-point-hex-parser': 1.13.2 + '@webassemblyjs/helper-api-error': 1.13.2 + '@xtuc/long': 4.2.2 + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': {} + + '@webassemblyjs/helper-wasm-section@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/wasm-gen': 1.14.1 + + '@webassemblyjs/ieee754@1.13.2': + dependencies: + '@xtuc/ieee754': 1.2.0 + + '@webassemblyjs/leb128@1.13.2': + dependencies: + '@xtuc/long': 4.2.2 + + '@webassemblyjs/utf8@1.13.2': {} + + '@webassemblyjs/wasm-edit@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/helper-wasm-section': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-opt': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + '@webassemblyjs/wast-printer': 1.14.1 + + '@webassemblyjs/wasm-gen@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wasm-opt@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + + '@webassemblyjs/wasm-parser@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-api-error': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wast-printer@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@xtuc/long': 4.2.2 + + '@xtuc/ieee754@1.2.0': {} + + '@xtuc/long@4.2.2': {} + + abbrev@1.1.1: {} + + accepts@1.3.8: + dependencies: + mime-types: 2.1.35 + negotiator: 0.6.3 + + acorn@8.16.0: {} + + agent-base@6.0.2: + dependencies: + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + ajv-formats@2.1.1(ajv@8.12.0): + optionalDependencies: + ajv: 8.12.0 + + ajv-formats@2.1.1(ajv@8.20.0): + optionalDependencies: + ajv: 8.20.0 + + ajv-keywords@3.5.2(ajv@6.15.0): + dependencies: + ajv: 6.15.0 + + ajv-keywords@5.1.0(ajv@8.20.0): + dependencies: + ajv: 8.20.0 + fast-deep-equal: 3.1.3 + + ajv@6.15.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + ajv@8.12.0: + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + + ajv@8.20.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-uri: 3.1.2 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + + ansi-colors@4.1.3: {} + + ansi-escapes@4.3.2: + dependencies: + type-fest: 0.21.3 + + ansi-regex@5.0.1: {} + + ansi-regex@6.2.2: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + ansi-styles@6.2.3: {} + + ansis@4.3.1: {} + + anymatch@3.1.3: + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.2 + + app-root-path@3.1.0: {} + + append-field@1.0.0: {} + + aproba@2.1.0: {} + + are-we-there-yet@2.0.0: + dependencies: + delegates: 1.0.0 + readable-stream: 3.6.2 + + argparse@2.0.1: {} + + array-flatten@1.1.1: {} + + array-timsort@1.0.3: {} + + available-typed-arrays@1.0.7: + dependencies: + possible-typed-array-names: 1.1.0 + + aws-ssl-profiles@1.1.2: {} + + balanced-match@1.0.2: {} + + base64-js@1.5.1: {} + + baseline-browser-mapping@2.10.34: {} + + bcrypt@5.1.1: + dependencies: + '@mapbox/node-pre-gyp': 1.0.11 + node-addon-api: 5.1.0 + transitivePeerDependencies: + - encoding + - supports-color + + binary-extensions@2.3.0: {} + + bl@4.1.0: + dependencies: + buffer: 5.7.1 + inherits: 2.0.4 + readable-stream: 3.6.2 + + body-parser@1.20.4: + dependencies: + bytes: 3.1.2 + content-type: 1.0.5 + debug: 2.6.9 + depd: 2.0.0 + destroy: 1.2.0 + http-errors: 2.0.1 + iconv-lite: 0.4.24 + on-finished: 2.4.1 + qs: 6.14.2 + raw-body: 2.5.3 + type-is: 1.6.18 + unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color + + brace-expansion@1.1.15: + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + + brace-expansion@2.1.1: + dependencies: + balanced-match: 1.0.2 + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + browserslist@4.28.2: + dependencies: + baseline-browser-mapping: 2.10.34 + caniuse-lite: 1.0.30001797 + electron-to-chromium: 1.5.368 + node-releases: 2.0.47 + update-browserslist-db: 1.2.3(browserslist@4.28.2) + + buffer-equal-constant-time@1.0.1: {} + + buffer-from@1.1.2: {} + + buffer@5.7.1: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + buffer@6.0.3: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + busboy@1.6.0: + dependencies: + streamsearch: 1.1.0 + + bytes@3.1.2: {} + + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + + call-bind@1.0.9: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + get-intrinsic: 1.3.0 + set-function-length: 1.2.2 + + call-bound@1.0.4: + dependencies: + call-bind-apply-helpers: 1.0.2 + get-intrinsic: 1.3.0 + + callsites@3.1.0: {} + + caniuse-lite@1.0.30001797: {} + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + chalk@5.6.2: {} + + chardet@0.7.0: {} + + chokidar@3.6.0: + dependencies: + anymatch: 3.1.3 + braces: 3.0.3 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + + chownr@2.0.0: {} + + chrome-trace-event@1.0.4: {} + + class-transformer@0.5.1: {} + + class-validator@0.14.4: + dependencies: + '@types/validator': 13.15.10 + libphonenumber-js: 1.13.6 + validator: 13.15.35 + + cli-cursor@3.1.0: + dependencies: + restore-cursor: 3.1.0 + + cli-spinners@2.9.2: {} + + cli-table3@0.6.5: + dependencies: + string-width: 4.2.3 + optionalDependencies: + '@colors/colors': 1.5.0 + + cli-width@3.0.0: {} + + cli-width@4.1.0: {} + + cliui@8.0.1: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + clone@1.0.4: {} + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + + color-support@1.1.3: {} + + commander@2.20.3: {} + + commander@4.1.1: {} + + comment-json@4.2.5: + dependencies: + array-timsort: 1.0.3 + core-util-is: 1.0.3 + esprima: 4.0.1 + has-own-prop: 2.0.0 + repeat-string: 1.6.1 + + concat-map@0.0.1: {} + + concat-stream@2.0.0: + dependencies: + buffer-from: 1.1.2 + inherits: 2.0.4 + readable-stream: 3.6.2 + typedarray: 0.0.6 + + consola@2.15.3: {} + + console-control-strings@1.1.0: {} + + content-disposition@0.5.4: + dependencies: + safe-buffer: 5.2.1 + + content-type@1.0.5: {} + + cookie-signature@1.0.7: {} + + cookie@0.7.2: {} + + core-util-is@1.0.3: {} + + cors@2.8.5: + dependencies: + object-assign: 4.1.1 + vary: 1.1.2 + + cosmiconfig@8.3.6(typescript@5.7.2): + dependencies: + import-fresh: 3.3.1 + js-yaml: 4.2.0 + parse-json: 5.2.0 + path-type: 4.0.0 + optionalDependencies: + typescript: 5.7.2 + + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + dayjs@1.11.21: {} + + debug@2.6.9: + dependencies: + ms: 2.0.0 + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + dedent@1.7.2: {} + + deepmerge@4.3.1: {} + + defaults@1.0.4: + dependencies: + clone: 1.0.4 + + define-data-property@1.1.4: + dependencies: + es-define-property: 1.0.1 + es-errors: 1.3.0 + gopd: 1.2.0 + + delegates@1.0.0: {} + + denque@2.1.0: {} + + depd@2.0.0: {} + + destroy@1.2.0: {} + + detect-libc@2.1.2: {} + + dotenv-expand@10.0.0: {} + + dotenv@16.4.5: {} + + dotenv@16.6.1: {} + + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 + + eastasianwidth@0.2.0: {} + + ecdsa-sig-formatter@1.0.11: + dependencies: + safe-buffer: 5.2.1 + + ee-first@1.1.1: {} + + electron-to-chromium@1.5.368: {} + + emoji-regex@8.0.0: {} + + emoji-regex@9.2.2: {} + + encodeurl@2.0.0: {} + + enhanced-resolve@5.23.0: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.3.3 + + error-ex@1.3.4: + dependencies: + is-arrayish: 0.2.1 + + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + + es-module-lexer@1.7.0: {} + + es-object-atoms@1.1.2: + dependencies: + es-errors: 1.3.0 + + escalade@3.2.0: {} + + escape-html@1.0.3: {} + + escape-string-regexp@1.0.5: {} + + eslint-scope@5.1.1: + dependencies: + esrecurse: 4.3.0 + estraverse: 4.3.0 + + esprima@4.0.1: {} + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@4.3.0: {} + + estraverse@5.3.0: {} + + etag@1.8.1: {} + + events@3.3.0: {} + + express@4.22.1: + dependencies: + accepts: 1.3.8 + array-flatten: 1.1.1 + body-parser: 1.20.4 + content-disposition: 0.5.4 + content-type: 1.0.5 + cookie: 0.7.2 + cookie-signature: 1.0.7 + debug: 2.6.9 + depd: 2.0.0 + encodeurl: 2.0.0 + escape-html: 1.0.3 + etag: 1.8.1 + finalhandler: 1.3.2 + fresh: 0.5.2 + http-errors: 2.0.1 + merge-descriptors: 1.0.3 + methods: 1.1.2 + on-finished: 2.4.1 + parseurl: 1.3.3 + path-to-regexp: 0.1.13 + proxy-addr: 2.0.7 + qs: 6.14.2 + range-parser: 1.2.1 + safe-buffer: 5.2.1 + send: 0.19.2 + serve-static: 1.16.3 + setprototypeof: 1.2.0 + statuses: 2.0.2 + type-is: 1.6.18 + utils-merge: 1.0.1 + vary: 1.1.2 + transitivePeerDependencies: + - supports-color + + external-editor@3.1.0: + dependencies: + chardet: 0.7.0 + iconv-lite: 0.4.24 + tmp: 0.0.33 + + fast-deep-equal@3.1.3: {} + + fast-json-stable-stringify@2.1.0: {} + + fast-safe-stringify@2.1.1: {} + + fast-uri@3.1.2: {} + + fflate@0.8.3: {} + + figures@3.2.0: + dependencies: + escape-string-regexp: 1.0.5 + + file-type@20.4.1: + dependencies: + '@tokenizer/inflate': 0.2.7 + strtok3: 10.3.5 + token-types: 6.1.2 + uint8array-extras: 1.5.0 + transitivePeerDependencies: + - supports-color + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + finalhandler@1.3.2: + dependencies: + debug: 2.6.9 + encodeurl: 2.0.0 + escape-html: 1.0.3 + on-finished: 2.4.1 + parseurl: 1.3.3 + statuses: 2.0.2 + unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color + + for-each@0.3.5: + dependencies: + is-callable: 1.2.7 + + foreground-child@3.3.1: + dependencies: + cross-spawn: 7.0.6 + signal-exit: 4.1.0 + + fork-ts-checker-webpack-plugin@9.0.2(typescript@5.7.2)(webpack@5.97.1): + dependencies: + '@babel/code-frame': 7.29.7 + chalk: 4.1.2 + chokidar: 3.6.0 + cosmiconfig: 8.3.6(typescript@5.7.2) + deepmerge: 4.3.1 + fs-extra: 10.1.0 + memfs: 3.5.3 + minimatch: 3.1.5 + node-abort-controller: 3.1.1 + schema-utils: 3.3.0 + semver: 7.8.2 + tapable: 2.3.3 + typescript: 5.7.2 + webpack: 5.97.1 + + forwarded@0.2.0: {} + + fresh@0.5.2: {} + + fs-extra@10.1.0: + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.2.1 + universalify: 2.0.1 + + fs-minipass@2.1.0: + dependencies: + minipass: 3.3.6 + + fs-monkey@1.1.0: {} + + fs.realpath@1.0.0: {} + + fsevents@2.3.3: + optional: true + + function-bind@1.1.2: {} + + gauge@3.0.2: + dependencies: + aproba: 2.1.0 + color-support: 1.1.3 + console-control-strings: 1.1.0 + has-unicode: 2.0.1 + object-assign: 4.1.1 + signal-exit: 3.0.7 + string-width: 4.2.3 + strip-ansi: 6.0.1 + wide-align: 1.1.5 + + generate-function@2.3.1: + dependencies: + is-property: 1.0.2 + + get-caller-file@2.0.5: {} + + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.2 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.4 + math-intrinsics: 1.1.0 + + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.2 + + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + + glob-to-regexp@0.4.1: {} + + glob@10.4.5: + dependencies: + foreground-child: 3.3.1 + jackspeak: 3.4.3 + minimatch: 9.0.9 + minipass: 7.1.3 + package-json-from-dist: 1.0.1 + path-scurry: 1.11.1 + + glob@10.5.0: + dependencies: + foreground-child: 3.3.1 + jackspeak: 3.4.3 + minimatch: 9.0.9 + minipass: 7.1.3 + package-json-from-dist: 1.0.1 + path-scurry: 1.11.1 + + glob@7.2.3: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.5 + once: 1.4.0 + path-is-absolute: 1.0.1 + + gopd@1.2.0: {} + + graceful-fs@4.2.11: {} + + has-flag@4.0.0: {} + + has-own-prop@2.0.0: {} + + has-property-descriptors@1.0.2: + dependencies: + es-define-property: 1.0.1 + + has-symbols@1.1.0: {} + + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 + + has-unicode@2.0.1: {} + + hasown@2.0.4: + dependencies: + function-bind: 1.1.2 + + http-errors@2.0.1: + dependencies: + depd: 2.0.0 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 2.0.2 + toidentifier: 1.0.1 + + https-proxy-agent@5.0.1: + dependencies: + agent-base: 6.0.2 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + iconv-lite@0.4.24: + dependencies: + safer-buffer: 2.1.2 + + iconv-lite@0.7.2: + dependencies: + safer-buffer: 2.1.2 + + ieee754@1.2.1: {} + + import-fresh@3.3.1: + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + + inherits@2.0.4: {} + + inquirer@8.2.6: + dependencies: + ansi-escapes: 4.3.2 + chalk: 4.1.2 + cli-cursor: 3.1.0 + cli-width: 3.0.0 + external-editor: 3.1.0 + figures: 3.2.0 + lodash: 4.18.1 + mute-stream: 0.0.8 + ora: 5.4.1 + run-async: 2.4.1 + rxjs: 7.8.2 + string-width: 4.2.3 + strip-ansi: 6.0.1 + through: 2.3.8 + wrap-ansi: 6.2.0 + + inquirer@9.2.15: + dependencies: + '@ljharb/through': 2.3.14 + ansi-escapes: 4.3.2 + chalk: 5.6.2 + cli-cursor: 3.1.0 + cli-width: 4.1.0 + external-editor: 3.1.0 + figures: 3.2.0 + lodash: 4.18.1 + mute-stream: 1.0.0 + ora: 5.4.1 + run-async: 3.0.0 + rxjs: 7.8.2 + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 6.2.0 + + ipaddr.js@1.9.1: {} + + is-arrayish@0.2.1: {} + + is-binary-path@2.1.0: + dependencies: + binary-extensions: 2.3.0 + + is-callable@1.2.7: {} + + is-extglob@2.1.1: {} + + is-fullwidth-code-point@3.0.0: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-interactive@1.0.0: {} + + is-number@7.0.0: {} + + is-property@1.0.2: {} + + is-typed-array@1.1.15: + dependencies: + which-typed-array: 1.1.22 + + is-unicode-supported@0.1.0: {} + + isarray@2.0.5: {} + + isexe@2.0.0: {} + + iterare@1.2.1: {} + + jackspeak@3.4.3: + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + + jest-worker@27.5.1: + dependencies: + '@types/node': 22.19.20 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + jose@5.10.0: {} + + js-tokens@4.0.0: {} + + js-yaml@4.2.0: + dependencies: + argparse: 2.0.1 + + json-parse-even-better-errors@2.3.1: {} + + json-schema-traverse@0.4.1: {} + + json-schema-traverse@1.0.0: {} + + json5@2.2.3: {} + + jsonc-parser@3.2.1: {} + + jsonc-parser@3.3.1: {} + + jsonfile@6.2.1: + dependencies: + universalify: 2.0.1 + optionalDependencies: + graceful-fs: 4.2.11 + + jsonwebtoken@9.0.2: + dependencies: + jws: 3.2.3 + lodash.includes: 4.3.0 + lodash.isboolean: 3.0.3 + lodash.isinteger: 4.0.4 + lodash.isnumber: 3.0.3 + lodash.isplainobject: 4.0.6 + lodash.isstring: 4.0.1 + lodash.once: 4.1.1 + ms: 2.1.3 + semver: 7.8.2 + + jsonwebtoken@9.0.3: + dependencies: + jws: 4.0.1 + lodash.includes: 4.3.0 + lodash.isboolean: 3.0.3 + lodash.isinteger: 4.0.4 + lodash.isnumber: 3.0.3 + lodash.isplainobject: 4.0.6 + lodash.isstring: 4.0.1 + lodash.once: 4.1.1 + ms: 2.1.3 + semver: 7.8.2 + + jwa@1.4.2: + dependencies: + buffer-equal-constant-time: 1.0.1 + ecdsa-sig-formatter: 1.0.11 + safe-buffer: 5.2.1 + + jwa@2.0.1: + dependencies: + buffer-equal-constant-time: 1.0.1 + ecdsa-sig-formatter: 1.0.11 + safe-buffer: 5.2.1 + + jws@3.2.3: + dependencies: + jwa: 1.4.2 + safe-buffer: 5.2.1 + + jws@4.0.1: + dependencies: + jwa: 2.0.1 + safe-buffer: 5.2.1 + + libphonenumber-js@1.13.6: {} + + lines-and-columns@1.2.4: {} + + loader-runner@4.3.2: {} + + lodash.includes@4.3.0: {} + + lodash.isboolean@3.0.3: {} + + lodash.isinteger@4.0.4: {} + + lodash.isnumber@3.0.3: {} + + lodash.isplainobject@4.0.6: {} + + lodash.isstring@4.0.1: {} + + lodash.once@4.1.1: {} + + lodash@4.17.21: {} + + lodash@4.18.1: {} + + log-symbols@4.1.0: + dependencies: + chalk: 4.1.2 + is-unicode-supported: 0.1.0 + + long@5.3.2: {} + + lru-cache@10.4.3: {} + + lru.min@1.1.4: {} + + magic-string@0.30.8: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + + make-dir@3.1.0: + dependencies: + semver: 6.3.1 + + math-intrinsics@1.1.0: {} + + media-typer@0.3.0: {} + + memfs@3.5.3: + dependencies: + fs-monkey: 1.1.0 + + merge-descriptors@1.0.3: {} + + merge-stream@2.0.0: {} + + methods@1.1.2: {} + + mime-db@1.52.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + mime@1.6.0: {} + + mimic-fn@2.1.0: {} + + minimatch@3.1.5: + dependencies: + brace-expansion: 1.1.15 + + minimatch@9.0.9: + dependencies: + brace-expansion: 2.1.1 + + minimist@1.2.8: {} + + minipass@3.3.6: + dependencies: + yallist: 4.0.0 + + minipass@5.0.0: {} + + minipass@7.1.3: {} + + minizlib@2.1.2: + dependencies: + minipass: 3.3.6 + yallist: 4.0.0 + + mkdirp@0.5.6: + dependencies: + minimist: 1.2.8 + + mkdirp@1.0.4: {} + + ms@2.0.0: {} + + ms@2.1.3: {} + + multer@2.0.2: + dependencies: + append-field: 1.0.0 + busboy: 1.6.0 + concat-stream: 2.0.0 + mkdirp: 0.5.6 + object-assign: 4.1.1 + type-is: 1.6.18 + xtend: 4.0.2 + + mute-stream@0.0.8: {} + + mute-stream@1.0.0: {} + + mysql2@3.22.5(@types/node@22.19.20): + dependencies: + '@types/node': 22.19.20 + aws-ssl-profiles: 1.1.2 + denque: 2.1.0 + generate-function: 2.3.1 + iconv-lite: 0.7.2 + long: 5.3.2 + lru.min: 1.1.4 + named-placeholders: 1.1.6 + sql-escaper: 1.3.3 + + named-placeholders@1.1.6: + dependencies: + lru.min: 1.1.4 + + negotiator@0.6.3: {} + + neo-async@2.6.2: {} + + node-abort-controller@3.1.1: {} + + node-addon-api@5.1.0: {} + + node-emoji@1.11.0: + dependencies: + lodash: 4.18.1 + + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + + node-releases@2.0.47: {} + + nopt@5.0.0: + dependencies: + abbrev: 1.1.1 + + normalize-path@3.0.0: {} + + npmlog@5.0.1: + dependencies: + are-we-there-yet: 2.0.0 + console-control-strings: 1.1.0 + gauge: 3.0.2 + set-blocking: 2.0.0 + + object-assign@4.1.1: {} + + object-inspect@1.13.4: {} + + on-finished@2.4.1: + dependencies: + ee-first: 1.1.1 + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + onetime@5.1.2: + dependencies: + mimic-fn: 2.1.0 + + ora@5.4.1: + dependencies: + bl: 4.1.0 + chalk: 4.1.2 + cli-cursor: 3.1.0 + cli-spinners: 2.9.2 + is-interactive: 1.0.0 + is-unicode-supported: 0.1.0 + log-symbols: 4.1.0 + strip-ansi: 6.0.1 + wcwidth: 1.0.1 + + os-tmpdir@1.0.2: {} + + package-json-from-dist@1.0.1: {} + + parent-module@1.0.1: + dependencies: + callsites: 3.1.0 + + parse-json@5.2.0: + dependencies: + '@babel/code-frame': 7.29.7 + error-ex: 1.3.4 + json-parse-even-better-errors: 2.3.1 + lines-and-columns: 1.2.4 + + parseurl@1.3.3: {} + + passport-jwt@4.0.1: + dependencies: + jsonwebtoken: 9.0.3 + passport-strategy: 1.0.0 + + passport-strategy@1.0.0: {} + + passport@0.7.0: + dependencies: + passport-strategy: 1.0.0 + pause: 0.0.1 + utils-merge: 1.0.1 + + path-is-absolute@1.0.1: {} + + path-key@3.1.1: {} + + path-scurry@1.11.1: + dependencies: + lru-cache: 10.4.3 + minipass: 7.1.3 + + path-to-regexp@0.1.13: {} + + path-to-regexp@3.3.0: {} + + path-type@4.0.0: {} + + pause@0.0.1: {} + + picocolors@1.1.1: {} + + picomatch@2.3.2: {} + + picomatch@4.0.1: {} + + pluralize@8.0.0: {} + + possible-typed-array-names@1.1.0: {} + + proxy-addr@2.0.7: + dependencies: + forwarded: 0.2.0 + ipaddr.js: 1.9.1 + + punycode@2.3.1: {} + + qs@6.14.2: + dependencies: + side-channel: 1.1.0 + + range-parser@1.2.1: {} + + raw-body@2.5.3: + dependencies: + bytes: 3.1.2 + http-errors: 2.0.1 + iconv-lite: 0.4.24 + unpipe: 1.0.0 + + readable-stream@3.6.2: + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + + readdirp@3.6.0: + dependencies: + picomatch: 2.3.2 + + reflect-metadata@0.2.2: {} + + repeat-string@1.6.1: {} + + require-directory@2.1.1: {} + + require-from-string@2.0.2: {} + + resolve-from@4.0.0: {} + + restore-cursor@3.1.0: + dependencies: + onetime: 5.1.2 + signal-exit: 3.0.7 + + rimraf@3.0.2: + dependencies: + glob: 7.2.3 + + run-async@2.4.1: {} + + run-async@3.0.0: {} + + rxjs@7.8.1: + dependencies: + tslib: 2.8.1 + + rxjs@7.8.2: + dependencies: + tslib: 2.8.1 + + safe-buffer@5.2.1: {} + + safer-buffer@2.1.2: {} + + schema-utils@3.3.0: + dependencies: + '@types/json-schema': 7.0.15 + ajv: 6.15.0 + ajv-keywords: 3.5.2(ajv@6.15.0) + + schema-utils@4.3.3: + dependencies: + '@types/json-schema': 7.0.15 + ajv: 8.20.0 + ajv-formats: 2.1.1(ajv@8.20.0) + ajv-keywords: 5.1.0(ajv@8.20.0) + + semver@6.3.1: {} + + semver@7.8.2: {} + + send@0.19.2: + dependencies: + debug: 2.6.9 + depd: 2.0.0 + destroy: 1.2.0 + encodeurl: 2.0.0 + escape-html: 1.0.3 + etag: 1.8.1 + fresh: 0.5.2 + http-errors: 2.0.1 + mime: 1.6.0 + ms: 2.1.3 + on-finished: 2.4.1 + range-parser: 1.2.1 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + + serve-static@1.16.3: + dependencies: + encodeurl: 2.0.0 + escape-html: 1.0.3 + parseurl: 1.3.3 + send: 0.19.2 + transitivePeerDependencies: + - supports-color + + set-blocking@2.0.0: {} + + set-function-length@1.2.2: + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.3.0 + gopd: 1.2.0 + has-property-descriptors: 1.0.2 + + setprototypeof@1.2.0: {} + + sha.js@2.4.12: + dependencies: + inherits: 2.0.4 + safe-buffer: 5.2.1 + to-buffer: 1.2.2 + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + side-channel-list@1.0.1: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + + side-channel-map@1.0.1: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + + side-channel-weakmap@1.0.2: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + side-channel-map: 1.0.1 + + side-channel@1.1.0: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + side-channel-list: 1.0.1 + side-channel-map: 1.0.1 + side-channel-weakmap: 1.0.2 + + signal-exit@3.0.7: {} + + signal-exit@4.1.0: {} + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + source-map@0.7.4: {} + + sql-escaper@1.3.3: {} + + sql-highlight@6.1.0: {} + + statuses@2.0.2: {} + + streamsearch@1.1.0: {} + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + string-width@5.1.2: + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 9.2.2 + strip-ansi: 7.2.0 + + string_decoder@1.3.0: + dependencies: + safe-buffer: 5.2.1 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-ansi@7.2.0: + dependencies: + ansi-regex: 6.2.2 + + strip-bom@3.0.0: {} + + strtok3@10.3.5: + dependencies: + '@tokenizer/token': 0.3.0 + + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + symbol-observable@4.0.0: {} + + tapable@2.3.3: {} + + tar@6.2.1: + dependencies: + chownr: 2.0.0 + fs-minipass: 2.1.0 + minipass: 5.0.0 + minizlib: 2.1.2 + mkdirp: 1.0.4 + yallist: 4.0.0 + + terser-webpack-plugin@5.6.1(webpack@5.97.1): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + jest-worker: 27.5.1 + schema-utils: 4.3.3 + terser: 5.48.0 + webpack: 5.97.1 + + terser@5.48.0: + dependencies: + '@jridgewell/source-map': 0.3.11 + acorn: 8.16.0 + commander: 2.20.3 + source-map-support: 0.5.21 + + through@2.3.8: {} + + tmp@0.0.33: + dependencies: + os-tmpdir: 1.0.2 + + to-buffer@1.2.2: + dependencies: + isarray: 2.0.5 + safe-buffer: 5.2.1 + typed-array-buffer: 1.0.3 + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + toidentifier@1.0.1: {} + + token-types@6.1.2: + dependencies: + '@borewit/text-codec': 0.2.2 + '@tokenizer/token': 0.3.0 + ieee754: 1.2.1 + + tr46@0.0.3: {} + + tree-kill@1.2.2: {} + + tsconfig-paths-webpack-plugin@4.2.0: + dependencies: + chalk: 4.1.2 + enhanced-resolve: 5.23.0 + tapable: 2.3.3 + tsconfig-paths: 4.2.0 + + tsconfig-paths@4.2.0: + dependencies: + json5: 2.2.3 + minimist: 1.2.8 + strip-bom: 3.0.0 + + tslib@2.8.1: {} + + type-fest@0.21.3: {} + + type-is@1.6.18: + dependencies: + media-typer: 0.3.0 + mime-types: 2.1.35 + + typed-array-buffer@1.0.3: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-typed-array: 1.1.15 + + typedarray@0.0.6: {} + + typeorm@0.3.30(mysql2@3.22.5(@types/node@22.19.20)): + dependencies: + '@sqltools/formatter': 1.2.5 + ansis: 4.3.1 + app-root-path: 3.1.0 + buffer: 6.0.3 + dayjs: 1.11.21 + debug: 4.4.3 + dedent: 1.7.2 + dotenv: 16.6.1 + glob: 10.5.0 + reflect-metadata: 0.2.2 + sha.js: 2.4.12 + sql-highlight: 6.1.0 + tslib: 2.8.1 + uuid: 11.1.1 + yargs: 17.7.2 + optionalDependencies: + mysql2: 3.22.5(@types/node@22.19.20) + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + + typescript@5.7.2: {} + + typescript@5.9.3: {} + + uid@2.0.2: + dependencies: + '@lukeed/csprng': 1.1.0 + + uint8array-extras@1.5.0: {} + + undici-types@6.21.0: {} + + universalify@2.0.1: {} + + unpipe@1.0.0: {} + + update-browserslist-db@1.2.3(browserslist@4.28.2): + dependencies: + browserslist: 4.28.2 + escalade: 3.2.0 + picocolors: 1.1.1 + + uri-js@4.4.1: + dependencies: + punycode: 2.3.1 + + util-deprecate@1.0.2: {} + + utils-merge@1.0.1: {} + + uuid@11.1.1: {} + + uuid@9.0.1: {} + + validator@13.15.35: {} + + vary@1.1.2: {} + + watchpack@2.5.1: + dependencies: + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + + wcwidth@1.0.1: + dependencies: + defaults: 1.0.4 + + webidl-conversions@3.0.1: {} + + webpack-node-externals@3.0.0: {} + + webpack-sources@3.5.0: {} + + webpack@5.97.1: + dependencies: + '@types/eslint-scope': 3.7.7 + '@types/estree': 1.0.9 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/wasm-edit': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + acorn: 8.16.0 + browserslist: 4.28.2 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.23.0 + es-module-lexer: 1.7.0 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.2 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 3.3.0 + tapable: 2.3.3 + terser-webpack-plugin: 5.6.1(webpack@5.97.1) + watchpack: 2.5.1 + webpack-sources: 3.5.0 + transitivePeerDependencies: + - '@minify-html/node' + - '@swc/core' + - '@swc/css' + - '@swc/html' + - clean-css + - cssnano + - csso + - esbuild + - html-minifier-terser + - lightningcss + - postcss + - uglify-js + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + + which-typed-array@1.1.22: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.9 + call-bound: 1.0.4 + for-each: 0.3.5 + get-proto: 1.0.1 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + wide-align@1.1.5: + dependencies: + string-width: 4.2.3 + + wrap-ansi@6.2.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@8.1.0: + dependencies: + ansi-styles: 6.2.3 + string-width: 5.1.2 + strip-ansi: 7.2.0 + + wrappy@1.0.2: {} + + xtend@4.0.2: {} + + y18n@5.0.8: {} + + yallist@4.0.0: {} + + yargs-parser@21.1.1: {} + + yargs@17.7.2: + dependencies: + cliui: 8.0.1 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 diff --git a/ecom-license/server/sql/schema.sql b/ecom-license/server/sql/schema.sql new file mode 100644 index 00000000..2245ef35 --- /dev/null +++ b/ecom-license/server/sql/schema.sql @@ -0,0 +1,76 @@ +-- Ecom License Server 表结构 +-- 目标库: ecom_license_dev(执行: mysql ... ecom_license_dev < schema.sql) + +CREATE TABLE IF NOT EXISTS lc_admin ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + username VARCHAR(50) NOT NULL, + password VARCHAR(255) NOT NULL COMMENT 'BCrypt', + nickname VARCHAR(50) NULL, + status TINYINT NOT NULL DEFAULT 1 COMMENT '0=禁用 1=启用', + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (id), + UNIQUE KEY uk_username (username) +) ENGINE=InnoDB COMMENT='License 平台管理员'; + +CREATE TABLE IF NOT EXISTS lc_customer ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + code VARCHAR(50) NOT NULL, + name VARCHAR(200) NOT NULL, + contact_name VARCHAR(50) NULL, + contact_phone VARCHAR(20) NULL, + contact_email VARCHAR(100) NULL, + status TINYINT NOT NULL DEFAULT 1, + remark TEXT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (id), + UNIQUE KEY uk_code (code) +) ENGINE=InnoDB COMMENT='License 客户'; + +CREATE TABLE IF NOT EXISTS lc_license ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + customer_id BIGINT UNSIGNED NOT NULL, + license_key TEXT NOT NULL, + jti VARCHAR(64) NOT NULL, + edition VARCHAR(20) NOT NULL, + machine_fingerprint VARCHAR(100) NOT NULL, + features JSON NOT NULL, + status VARCHAR(20) NOT NULL DEFAULT 'active', + issued_at TIMESTAMP NOT NULL, + expires_at TIMESTAMP NOT NULL, + revoked_at TIMESTAMP NULL, + max_activations INT NULL, + activation_count INT NOT NULL DEFAULT 0, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (id), + UNIQUE KEY uk_jti (jti), + KEY idx_customer_id (customer_id), + CONSTRAINT fk_license_customer FOREIGN KEY (customer_id) REFERENCES lc_customer (id) +) ENGINE=InnoDB COMMENT='签发的 License'; + +CREATE TABLE IF NOT EXISTS lc_activation_log ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + license_id BIGINT UNSIGNED NOT NULL, + machine_fingerprint VARCHAR(100) NOT NULL, + installation_id VARCHAR(64) NULL, + hostname VARCHAR(200) NULL, + ip VARCHAR(50) NULL, + action VARCHAR(20) NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (id), + KEY idx_license_id (license_id) +) ENGINE=InnoDB COMMENT='激活日志'; + +CREATE TABLE IF NOT EXISTS lc_oper_log ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + admin_id BIGINT UNSIGNED NULL, + action VARCHAR(50) NOT NULL, + target_type VARCHAR(50) NULL, + target_id BIGINT UNSIGNED NULL, + detail JSON NULL, + ip VARCHAR(50) NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (id) +) ENGINE=InnoDB COMMENT='操作日志'; diff --git a/ecom-license/server/src/app.module.ts b/ecom-license/server/src/app.module.ts new file mode 100644 index 00000000..fdb740b7 --- /dev/null +++ b/ecom-license/server/src/app.module.ts @@ -0,0 +1,37 @@ +import { Module } from '@nestjs/common'; +import { ConfigModule } from '@nestjs/config'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { AuthModule } from './modules/auth/auth.module'; +import { CustomerModule } from './modules/customer/customer.module'; +import { DashboardModule } from './modules/dashboard/dashboard.module'; +import { LicenseModule } from './modules/license/license.module'; +import { LcAdmin } from './entities/lc-admin.entity'; +import { LcActivationLog } from './entities/lc-activation-log.entity'; +import { LcCustomer } from './entities/lc-customer.entity'; +import { LcLicense } from './entities/lc-license.entity'; +import { LcOperLog } from './entities/lc-oper-log.entity'; +import { AdminSeedService } from './common/admin-seed.service'; + +@Module({ + imports: [ + ConfigModule.forRoot({ isGlobal: true }), + TypeOrmModule.forRoot({ + type: 'mysql', + host: process.env.DB_HOST || 'localhost', + port: Number(process.env.DB_PORT || 3306), + username: process.env.DB_USERNAME || 'root', + password: process.env.DB_PASSWORD || '', + database: process.env.DB_DATABASE || 'ecom_license_dev', + entities: [LcAdmin, LcCustomer, LcLicense, LcActivationLog, LcOperLog], + synchronize: process.env.DB_SYNC === 'true', + timezone: '+08:00', + }), + TypeOrmModule.forFeature([LcAdmin]), + AuthModule, + CustomerModule, + LicenseModule, + DashboardModule, + ], + providers: [AdminSeedService], +}) +export class AppModule {} diff --git a/ecom-license/server/src/common/admin-seed.service.ts b/ecom-license/server/src/common/admin-seed.service.ts new file mode 100644 index 00000000..bbcb9ef0 --- /dev/null +++ b/ecom-license/server/src/common/admin-seed.service.ts @@ -0,0 +1,27 @@ +import { Injectable, OnModuleInit } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import * as bcrypt from 'bcrypt'; +import { Repository } from 'typeorm'; +import { LcAdmin } from '../entities/lc-admin.entity'; + +/** 首次启动时创建默认管理员 admin / admin123 */ +@Injectable() +export class AdminSeedService implements OnModuleInit { + constructor( + @InjectRepository(LcAdmin) + private readonly adminRepo: Repository, + ) {} + + async onModuleInit() { + const count = await this.adminRepo.count(); + if (count > 0) return; + const password = await bcrypt.hash('admin123', 10); + await this.adminRepo.save({ + username: 'admin', + password, + nickname: '默认管理员', + status: 1, + }); + console.log('[seed] 默认管理员已创建: admin / admin123'); + } +} diff --git a/ecom-license/server/src/common/jwt-signer.service.ts b/ecom-license/server/src/common/jwt-signer.service.ts new file mode 100644 index 00000000..089f2a68 --- /dev/null +++ b/ecom-license/server/src/common/jwt-signer.service.ts @@ -0,0 +1,62 @@ +import { Injectable, OnModuleInit } from '@nestjs/common'; +import { readFile } from 'fs/promises'; +import { importPKCS8, SignJWT, type KeyLike } from 'jose'; +import { join } from 'path'; +import { v4 as uuidv4 } from 'uuid'; + +export interface SignLicenseInput { + sub: string; + company: string; + machineFingerprint: string; + edition: string; + features: string[]; + expiresAt: Date; +} + +export interface SignLicenseResult { + licenseKey: string; + jti: string; + issuedAt: Date; + expiresAt: Date; +} + +/** 使用 Ed25519 私钥签发 License JWT */ +@Injectable() +export class JwtSignerService implements OnModuleInit { + private privateKey: KeyLike | null = null; + private kid = process.env.LICENSE_KID || '2026-v1'; + + async onModuleInit() { + const keyPath = + process.env.LICENSE_PRIVATE_KEY_PATH || join(process.cwd(), 'keys', 'private.pem'); + try { + const pem = await readFile(keyPath, 'utf8'); + this.privateKey = await importPKCS8(pem, 'EdDSA'); + } catch (e) { + console.warn(`[license] 未加载私钥 ${keyPath},签发功能不可用。请运行: openssl genpkey -algorithm Ed25519 -out keys/private.pem`); + } + } + + async signLicense(input: SignLicenseInput): Promise { + if (!this.privateKey) { + throw new Error('License 私钥未配置,无法签发'); + } + const jti = uuidv4(); + const issuedAt = new Date(); + const licenseKey = await new SignJWT({ + company: input.company, + machineFingerprint: input.machineFingerprint, + edition: input.edition, + features: input.features, + }) + .setProtectedHeader({ alg: 'EdDSA', typ: 'JWT', kid: this.kid }) + .setIssuer('ecom-license-server') + .setSubject(input.sub) + .setJti(jti) + .setIssuedAt(issuedAt) + .setExpirationTime(input.expiresAt) + .sign(this.privateKey); + + return { licenseKey, jti, issuedAt, expiresAt: input.expiresAt }; + } +} diff --git a/ecom-license/server/src/entities/lc-activation-log.entity.ts b/ecom-license/server/src/entities/lc-activation-log.entity.ts new file mode 100644 index 00000000..33fa3be7 --- /dev/null +++ b/ecom-license/server/src/entities/lc-activation-log.entity.ts @@ -0,0 +1,33 @@ +import { + Column, + CreateDateColumn, + Entity, + PrimaryGeneratedColumn, +} from 'typeorm'; + +@Entity('lc_activation_log') +export class LcActivationLog { + @PrimaryGeneratedColumn({ type: 'bigint', unsigned: true }) + id!: number; + + @Column({ name: 'license_id', type: 'bigint', unsigned: true }) + licenseId!: number; + + @Column({ name: 'machine_fingerprint', length: 100 }) + machineFingerprint!: string; + + @Column({ name: 'installation_id', type: 'varchar', length: 64, nullable: true }) + installationId!: string | null; + + @Column({ type: 'varchar', length: 200, nullable: true }) + hostname!: string | null; + + @Column({ type: 'varchar', length: 50, nullable: true }) + ip!: string | null; + + @Column({ length: 20 }) + action!: string; + + @CreateDateColumn({ name: 'created_at' }) + createdAt!: Date; +} diff --git a/ecom-license/server/src/entities/lc-admin.entity.ts b/ecom-license/server/src/entities/lc-admin.entity.ts new file mode 100644 index 00000000..f69f6a74 --- /dev/null +++ b/ecom-license/server/src/entities/lc-admin.entity.ts @@ -0,0 +1,31 @@ +import { + Column, + CreateDateColumn, + Entity, + PrimaryGeneratedColumn, + UpdateDateColumn, +} from 'typeorm'; + +@Entity('lc_admin') +export class LcAdmin { + @PrimaryGeneratedColumn({ type: 'bigint', unsigned: true }) + id!: number; + + @Column({ length: 50, unique: true }) + username!: string; + + @Column({ length: 255 }) + password!: string; + + @Column({ type: 'varchar', length: 50, nullable: true }) + nickname!: string | null; + + @Column({ type: 'tinyint', default: 1 }) + status!: number; + + @CreateDateColumn({ name: 'created_at' }) + createdAt!: Date; + + @UpdateDateColumn({ name: 'updated_at' }) + updatedAt!: Date; +} diff --git a/ecom-license/server/src/entities/lc-customer.entity.ts b/ecom-license/server/src/entities/lc-customer.entity.ts new file mode 100644 index 00000000..e65ac41f --- /dev/null +++ b/ecom-license/server/src/entities/lc-customer.entity.ts @@ -0,0 +1,45 @@ +import { + Column, + CreateDateColumn, + Entity, + OneToMany, + PrimaryGeneratedColumn, + UpdateDateColumn, +} from 'typeorm'; +import { LcLicense } from './lc-license.entity'; + +@Entity('lc_customer') +export class LcCustomer { + @PrimaryGeneratedColumn({ type: 'bigint', unsigned: true }) + id!: number; + + @Column({ length: 50, unique: true }) + code!: string; + + @Column({ length: 200 }) + name!: string; + + @Column({ name: 'contact_name', type: 'varchar', length: 50, nullable: true }) + contactName!: string | null; + + @Column({ name: 'contact_phone', type: 'varchar', length: 20, nullable: true }) + contactPhone!: string | null; + + @Column({ name: 'contact_email', type: 'varchar', length: 100, nullable: true }) + contactEmail!: string | null; + + @Column({ type: 'tinyint', default: 1 }) + status!: number; + + @Column({ type: 'text', nullable: true }) + remark!: string | null; + + @OneToMany(() => LcLicense, (license) => license.customer) + licenses!: LcLicense[]; + + @CreateDateColumn({ name: 'created_at' }) + createdAt!: Date; + + @UpdateDateColumn({ name: 'updated_at' }) + updatedAt!: Date; +} diff --git a/ecom-license/server/src/entities/lc-license.entity.ts b/ecom-license/server/src/entities/lc-license.entity.ts new file mode 100644 index 00000000..32ce8501 --- /dev/null +++ b/ecom-license/server/src/entities/lc-license.entity.ts @@ -0,0 +1,62 @@ +import { + Column, + CreateDateColumn, + Entity, + JoinColumn, + ManyToOne, + PrimaryGeneratedColumn, + UpdateDateColumn, +} from 'typeorm'; +import { LcCustomer } from './lc-customer.entity'; + +@Entity('lc_license') +export class LcLicense { + @PrimaryGeneratedColumn({ type: 'bigint', unsigned: true }) + id!: number; + + @Column({ name: 'customer_id', type: 'bigint', unsigned: true }) + customerId!: number; + + @ManyToOne(() => LcCustomer, (customer) => customer.licenses) + @JoinColumn({ name: 'customer_id' }) + customer!: LcCustomer; + + @Column({ name: 'license_key', type: 'text' }) + licenseKey!: string; + + @Column({ length: 64, unique: true }) + jti!: string; + + @Column({ length: 20 }) + edition!: string; + + @Column({ name: 'machine_fingerprint', length: 100 }) + machineFingerprint!: string; + + @Column({ type: 'json' }) + features!: string[]; + + @Column({ length: 20, default: 'active' }) + status!: string; + + @Column({ name: 'issued_at', type: 'timestamp' }) + issuedAt!: Date; + + @Column({ name: 'expires_at', type: 'timestamp' }) + expiresAt!: Date; + + @Column({ name: 'revoked_at', type: 'timestamp', nullable: true }) + revokedAt!: Date | null; + + @Column({ name: 'max_activations', type: 'int', nullable: true }) + maxActivations!: number | null; + + @Column({ name: 'activation_count', type: 'int', default: 0 }) + activationCount!: number; + + @CreateDateColumn({ name: 'created_at' }) + createdAt!: Date; + + @UpdateDateColumn({ name: 'updated_at' }) + updatedAt!: Date; +} diff --git a/ecom-license/server/src/entities/lc-oper-log.entity.ts b/ecom-license/server/src/entities/lc-oper-log.entity.ts new file mode 100644 index 00000000..90c06444 --- /dev/null +++ b/ecom-license/server/src/entities/lc-oper-log.entity.ts @@ -0,0 +1,33 @@ +import { + Column, + CreateDateColumn, + Entity, + PrimaryGeneratedColumn, +} from 'typeorm'; + +@Entity('lc_oper_log') +export class LcOperLog { + @PrimaryGeneratedColumn({ type: 'bigint', unsigned: true }) + id!: number; + + @Column({ name: 'admin_id', type: 'bigint', unsigned: true, nullable: true }) + adminId!: number | null; + + @Column({ length: 50 }) + action!: string; + + @Column({ name: 'target_type', type: 'varchar', length: 50, nullable: true }) + targetType!: string | null; + + @Column({ name: 'target_id', type: 'bigint', unsigned: true, nullable: true }) + targetId!: number | null; + + @Column({ type: 'json', nullable: true }) + detail!: Record | null; + + @Column({ type: 'varchar', length: 50, nullable: true }) + ip!: string | null; + + @CreateDateColumn({ name: 'created_at' }) + createdAt!: Date; +} diff --git a/ecom-license/server/src/main.ts b/ecom-license/server/src/main.ts new file mode 100644 index 00000000..a563394b --- /dev/null +++ b/ecom-license/server/src/main.ts @@ -0,0 +1,17 @@ +import { ValidationPipe } from '@nestjs/common'; +import { NestFactory } from '@nestjs/core'; +import { AppModule } from './app.module'; + +async function bootstrap() { + const app = await NestFactory.create(AppModule); + app.setGlobalPrefix('api'); + app.useGlobalPipes( + new ValidationPipe({ whitelist: true, transform: true, forbidNonWhitelisted: true }), + ); + app.enableCors(); + const port = process.env.PORT || 3100; + await app.listen(port); + console.log(`Ecom License Server running on http://localhost:${port}`); +} + +bootstrap(); diff --git a/ecom-license/server/src/modules/auth/auth.controller.ts b/ecom-license/server/src/modules/auth/auth.controller.ts new file mode 100644 index 00000000..7c0b8990 --- /dev/null +++ b/ecom-license/server/src/modules/auth/auth.controller.ts @@ -0,0 +1,18 @@ +import { Body, Controller, Post } from '@nestjs/common'; +import { AuthService } from './auth.service'; +import { LoginDto } from './auth.dto'; + +@Controller('auth') +export class AuthController { + constructor(private readonly authService: AuthService) {} + + @Post('login') + login(@Body() dto: LoginDto) { + return this.authService.login(dto); + } + + @Post('logout') + logout() { + return { success: true }; + } +} diff --git a/ecom-license/server/src/modules/auth/auth.dto.ts b/ecom-license/server/src/modules/auth/auth.dto.ts new file mode 100644 index 00000000..e7af3e1b --- /dev/null +++ b/ecom-license/server/src/modules/auth/auth.dto.ts @@ -0,0 +1,11 @@ +import { IsNotEmpty, IsString } from 'class-validator'; + +export class LoginDto { + @IsString() + @IsNotEmpty() + username!: string; + + @IsString() + @IsNotEmpty() + password!: string; +} diff --git a/ecom-license/server/src/modules/auth/auth.module.ts b/ecom-license/server/src/modules/auth/auth.module.ts new file mode 100644 index 00000000..71652871 --- /dev/null +++ b/ecom-license/server/src/modules/auth/auth.module.ts @@ -0,0 +1,23 @@ +import { Module } from '@nestjs/common'; +import { JwtModule } from '@nestjs/jwt'; +import { PassportModule } from '@nestjs/passport'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { LcAdmin } from '../../entities/lc-admin.entity'; +import { AuthController } from './auth.controller'; +import { AuthService } from './auth.service'; +import { JwtStrategy } from './jwt.strategy'; + +@Module({ + imports: [ + TypeOrmModule.forFeature([LcAdmin]), + PassportModule.register({ defaultStrategy: 'jwt' }), + JwtModule.register({ + secret: process.env.JWT_SECRET || 'change-me-in-production', + signOptions: { expiresIn: process.env.JWT_EXPIRES_IN || '8h' }, + }), + ], + controllers: [AuthController], + providers: [AuthService, JwtStrategy], + exports: [JwtModule], +}) +export class AuthModule {} diff --git a/ecom-license/server/src/modules/auth/auth.service.ts b/ecom-license/server/src/modules/auth/auth.service.ts new file mode 100644 index 00000000..e5d1bd5a --- /dev/null +++ b/ecom-license/server/src/modules/auth/auth.service.ts @@ -0,0 +1,38 @@ +import { Injectable, UnauthorizedException } from '@nestjs/common'; +import { JwtService } from '@nestjs/jwt'; +import { InjectRepository } from '@nestjs/typeorm'; +import * as bcrypt from 'bcrypt'; +import { Repository } from 'typeorm'; +import { LcAdmin } from '../../entities/lc-admin.entity'; +import { LoginDto } from './auth.dto'; + +@Injectable() +export class AuthService { + constructor( + @InjectRepository(LcAdmin) + private readonly adminRepo: Repository, + private readonly jwtService: JwtService, + ) {} + + async login(dto: LoginDto) { + const admin = await this.adminRepo.findOne({ where: { username: dto.username } }); + if (!admin || admin.status !== 1) { + throw new UnauthorizedException('用户名或密码错误'); + } + const ok = await bcrypt.compare(dto.password, admin.password); + if (!ok) { + throw new UnauthorizedException('用户名或密码错误'); + } + const expiresIn = process.env.JWT_EXPIRES_IN || '8h'; + const token = this.jwtService.sign( + { sub: admin.id, username: admin.username }, + { expiresIn }, + ); + const decoded = this.jwtService.decode(token) as { exp?: number }; + return { + token, + username: admin.username, + expiresAt: decoded?.exp ? new Date(decoded.exp * 1000).toISOString() : null, + }; + } +} diff --git a/ecom-license/server/src/modules/auth/jwt-auth.guard.ts b/ecom-license/server/src/modules/auth/jwt-auth.guard.ts new file mode 100644 index 00000000..2155290e --- /dev/null +++ b/ecom-license/server/src/modules/auth/jwt-auth.guard.ts @@ -0,0 +1,5 @@ +import { Injectable } from '@nestjs/common'; +import { AuthGuard } from '@nestjs/passport'; + +@Injectable() +export class JwtAuthGuard extends AuthGuard('jwt') {} diff --git a/ecom-license/server/src/modules/auth/jwt.strategy.ts b/ecom-license/server/src/modules/auth/jwt.strategy.ts new file mode 100644 index 00000000..e27192e6 --- /dev/null +++ b/ecom-license/server/src/modules/auth/jwt.strategy.ts @@ -0,0 +1,26 @@ +import { Injectable, UnauthorizedException } from '@nestjs/common'; +import { PassportStrategy } from '@nestjs/passport'; +import { ExtractJwt, Strategy } from 'passport-jwt'; + +export interface AdminJwtPayload { + sub: number; + username: string; +} + +@Injectable() +export class JwtStrategy extends PassportStrategy(Strategy) { + constructor() { + super({ + jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), + ignoreExpiration: false, + secretOrKey: process.env.JWT_SECRET || 'change-me-in-production', + }); + } + + validate(payload: AdminJwtPayload) { + if (!payload?.sub) { + throw new UnauthorizedException(); + } + return { adminId: payload.sub, username: payload.username }; + } +} diff --git a/ecom-license/server/src/modules/customer/customer.controller.ts b/ecom-license/server/src/modules/customer/customer.controller.ts new file mode 100644 index 00000000..5021c64a --- /dev/null +++ b/ecom-license/server/src/modules/customer/customer.controller.ts @@ -0,0 +1,55 @@ +import { + Body, + Controller, + Delete, + Get, + Param, + ParseIntPipe, + Post, + Put, + Query, + UseGuards, +} from '@nestjs/common'; +import { JwtAuthGuard } from '../auth/jwt-auth.guard'; +import { LicenseService } from '../license/license.service'; +import { CreateCustomerDto, CustomerQueryDto, UpdateCustomerDto } from './customer.dto'; +import { CustomerService } from './customer.service'; + +@Controller('customers') +@UseGuards(JwtAuthGuard) +export class CustomerController { + constructor( + private readonly customerService: CustomerService, + private readonly licenseService: LicenseService, + ) {} + + @Get() + list(@Query() query: CustomerQueryDto) { + return this.customerService.list(query); + } + + @Post() + create(@Body() dto: CreateCustomerDto) { + return this.customerService.create(dto); + } + + @Get(':id') + findOne(@Param('id', ParseIntPipe) id: number) { + return this.customerService.findOne(id); + } + + @Put(':id') + update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateCustomerDto) { + return this.customerService.update(id, dto); + } + + @Delete(':id') + remove(@Param('id', ParseIntPipe) id: number) { + return this.customerService.remove(id); + } + + @Get(':id/licenses') + licenses(@Param('id', ParseIntPipe) id: number) { + return this.licenseService.listByCustomer(id); + } +} diff --git a/ecom-license/server/src/modules/customer/customer.dto.ts b/ecom-license/server/src/modules/customer/customer.dto.ts new file mode 100644 index 00000000..a3411d81 --- /dev/null +++ b/ecom-license/server/src/modules/customer/customer.dto.ts @@ -0,0 +1,68 @@ +import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsString, Min } from 'class-validator'; +import { Type } from 'class-transformer'; + +export class CreateCustomerDto { + @IsString() + @IsOptional() + code?: string; + + @IsString() + @IsNotEmpty() + name!: string; + + @IsString() + @IsOptional() + contactName?: string; + + @IsString() + @IsOptional() + contactPhone?: string; + + @IsEmail() + @IsOptional() + contactEmail?: string; + + @IsString() + @IsOptional() + remark?: string; +} + +export class UpdateCustomerDto { + @IsString() + @IsOptional() + name?: string; + + @IsString() + @IsOptional() + contactName?: string; + + @IsString() + @IsOptional() + contactPhone?: string; + + @IsEmail() + @IsOptional() + contactEmail?: string; + + @IsInt() + @IsOptional() + status?: number; + + @IsString() + @IsOptional() + remark?: string; +} + +export class CustomerQueryDto { + @Type(() => Number) + @IsInt() + @Min(1) + @IsOptional() + page?: number = 1; + + @Type(() => Number) + @IsInt() + @Min(1) + @IsOptional() + size?: number = 20; +} diff --git a/ecom-license/server/src/modules/customer/customer.module.ts b/ecom-license/server/src/modules/customer/customer.module.ts new file mode 100644 index 00000000..4d1d5d22 --- /dev/null +++ b/ecom-license/server/src/modules/customer/customer.module.ts @@ -0,0 +1,17 @@ +import { Module, forwardRef } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { LcCustomer } from '../../entities/lc-customer.entity'; +import { LicenseModule } from '../license/license.module'; +import { CustomerController } from './customer.controller'; +import { CustomerService } from './customer.service'; + +@Module({ + imports: [ + TypeOrmModule.forFeature([LcCustomer]), + forwardRef(() => LicenseModule), + ], + controllers: [CustomerController], + providers: [CustomerService], + exports: [CustomerService], +}) +export class CustomerModule {} diff --git a/ecom-license/server/src/modules/customer/customer.service.ts b/ecom-license/server/src/modules/customer/customer.service.ts new file mode 100644 index 00000000..74f05f24 --- /dev/null +++ b/ecom-license/server/src/modules/customer/customer.service.ts @@ -0,0 +1,67 @@ +import { Injectable, NotFoundException } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Repository } from 'typeorm'; +import { LcCustomer } from '../../entities/lc-customer.entity'; +import { CreateCustomerDto, CustomerQueryDto, UpdateCustomerDto } from './customer.dto'; + +@Injectable() +export class CustomerService { + constructor( + @InjectRepository(LcCustomer) + private readonly customerRepo: Repository, + ) {} + + async list(query: CustomerQueryDto) { + const page = query.page || 1; + const size = query.size || 20; + const [items, total] = await this.customerRepo.findAndCount({ + order: { id: 'DESC' }, + skip: (page - 1) * size, + take: size, + }); + return { items, total, page, size }; + } + + async findOne(id: number) { + const customer = await this.customerRepo.findOne({ where: { id } }); + if (!customer) throw new NotFoundException('客户不存在'); + return customer; + } + + async create(dto: CreateCustomerDto) { + const code = dto.code || (await this.generateCode()); + const customer = this.customerRepo.create({ + code, + name: dto.name, + contactName: dto.contactName ?? null, + contactPhone: dto.contactPhone ?? null, + contactEmail: dto.contactEmail ?? null, + remark: dto.remark ?? null, + status: 1, + }); + return this.customerRepo.save(customer); + } + + async update(id: number, dto: UpdateCustomerDto) { + const customer = await this.findOne(id); + Object.assign(customer, { + ...dto, + contactName: dto.contactName ?? customer.contactName, + contactPhone: dto.contactPhone ?? customer.contactPhone, + contactEmail: dto.contactEmail ?? customer.contactEmail, + }); + return this.customerRepo.save(customer); + } + + async remove(id: number) { + const customer = await this.findOne(id); + await this.customerRepo.remove(customer); + return { success: true }; + } + + private async generateCode() { + const date = new Date().toISOString().slice(0, 10).replace(/-/g, ''); + const count = await this.customerRepo.count(); + return `CUST-${date}-${String(count + 1).padStart(3, '0')}`; + } +} diff --git a/ecom-license/server/src/modules/dashboard/dashboard.controller.ts b/ecom-license/server/src/modules/dashboard/dashboard.controller.ts new file mode 100644 index 00000000..daece216 --- /dev/null +++ b/ecom-license/server/src/modules/dashboard/dashboard.controller.ts @@ -0,0 +1,14 @@ +import { Controller, Get, UseGuards } from '@nestjs/common'; +import { JwtAuthGuard } from '../auth/jwt-auth.guard'; +import { DashboardService } from './dashboard.service'; + +@Controller('dashboard') +@UseGuards(JwtAuthGuard) +export class DashboardController { + constructor(private readonly dashboardService: DashboardService) {} + + @Get('stats') + stats() { + return this.dashboardService.stats(); + } +} diff --git a/ecom-license/server/src/modules/dashboard/dashboard.module.ts b/ecom-license/server/src/modules/dashboard/dashboard.module.ts new file mode 100644 index 00000000..4e8d7553 --- /dev/null +++ b/ecom-license/server/src/modules/dashboard/dashboard.module.ts @@ -0,0 +1,13 @@ +import { Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { LcCustomer } from '../../entities/lc-customer.entity'; +import { LcLicense } from '../../entities/lc-license.entity'; +import { DashboardController } from './dashboard.controller'; +import { DashboardService } from './dashboard.service'; + +@Module({ + imports: [TypeOrmModule.forFeature([LcCustomer, LcLicense])], + controllers: [DashboardController], + providers: [DashboardService], +}) +export class DashboardModule {} diff --git a/ecom-license/server/src/modules/dashboard/dashboard.service.ts b/ecom-license/server/src/modules/dashboard/dashboard.service.ts new file mode 100644 index 00000000..d4fb71e4 --- /dev/null +++ b/ecom-license/server/src/modules/dashboard/dashboard.service.ts @@ -0,0 +1,41 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Repository, MoreThan } from 'typeorm'; +import { LcCustomer } from '../../entities/lc-customer.entity'; +import { LcLicense } from '../../entities/lc-license.entity'; + +@Injectable() +export class DashboardService { + constructor( + @InjectRepository(LcCustomer) + private readonly customerRepo: Repository, + @InjectRepository(LcLicense) + private readonly licenseRepo: Repository, + ) {} + + async stats() { + const customerCount = await this.customerRepo.count(); + const activeLicenseCount = await this.licenseRepo.count({ where: { status: 'active' } }); + const thirtyDaysLater = new Date(); + thirtyDaysLater.setDate(thirtyDaysLater.getDate() + 30); + const expiringSoonCount = await this.licenseRepo.count({ + where: { + status: 'active', + expiresAt: MoreThan(new Date()), + }, + }); + const expiring = await this.licenseRepo + .createQueryBuilder('l') + .where('l.status = :status', { status: 'active' }) + .andWhere('l.expires_at <= :date', { date: thirtyDaysLater }) + .andWhere('l.expires_at > NOW()') + .getCount(); + + return { + customerCount, + activeLicenseCount, + expiringSoonCount: expiring, + totalLicenses: await this.licenseRepo.count(), + }; + } +} diff --git a/ecom-license/server/src/modules/license/license.controller.ts b/ecom-license/server/src/modules/license/license.controller.ts new file mode 100644 index 00000000..8d259ad1 --- /dev/null +++ b/ecom-license/server/src/modules/license/license.controller.ts @@ -0,0 +1,59 @@ +import { + Body, + Controller, + Get, + Param, + ParseIntPipe, + Post, + Query, + Res, + UseGuards, +} from '@nestjs/common'; +import { Response } from 'express'; +import { JwtAuthGuard } from '../auth/jwt-auth.guard'; +import { GenerateLicenseDto, LicenseQueryDto } from './license.dto'; +import { LicenseService } from './license.service'; + +@Controller('licenses') +export class LicenseController { + constructor(private readonly licenseService: LicenseService) {} + + /** 在线吊销状态查询(主应用调用,无需管理员 JWT) */ + @Get('status') + status(@Query('jti') jti: string) { + return this.licenseService.getStatusByJti(jti); + } + + @Get() + @UseGuards(JwtAuthGuard) + list(@Query() query: LicenseQueryDto) { + return this.licenseService.list(query); + } + + @Post('generate') + @UseGuards(JwtAuthGuard) + generate(@Body() dto: GenerateLicenseDto) { + return this.licenseService.generate(dto); + } + + @Get(':id') + @UseGuards(JwtAuthGuard) + findOne(@Param('id', ParseIntPipe) id: number) { + return this.licenseService.findOne(id); + } + + @Post(':id/revoke') + @UseGuards(JwtAuthGuard) + revoke(@Param('id', ParseIntPipe) id: number) { + return this.licenseService.revoke(id); + } + + @Get(':id/download') + @UseGuards(JwtAuthGuard) + async download(@Param('id', ParseIntPipe) id: number, @Res() res: Response) { + const file = await this.licenseService.download(id); + res.setHeader('Content-Type', 'text/plain; charset=utf-8'); + res.setHeader('Content-Disposition', `attachment; filename="${file.filename}"`); + res.send(file.content); + } +} diff --git a/ecom-license/server/src/modules/license/license.dto.ts b/ecom-license/server/src/modules/license/license.dto.ts new file mode 100644 index 00000000..68981d95 --- /dev/null +++ b/ecom-license/server/src/modules/license/license.dto.ts @@ -0,0 +1,58 @@ +import { + IsArray, + IsDateString, + IsInt, + IsNotEmpty, + IsOptional, + IsString, + Min, +} from 'class-validator'; +import { Type } from 'class-transformer'; + +export class GenerateLicenseDto { + @Type(() => Number) + @IsInt() + customerId!: number; + + @IsString() + @IsNotEmpty() + company!: string; + + @IsString() + @IsNotEmpty() + machineFingerprint!: string; + + @IsString() + @IsNotEmpty() + edition!: string; + + @IsDateString() + expiresAt!: string; + + @IsArray() + @IsString({ each: true }) + features!: string[]; +} + +export class LicenseQueryDto { + @Type(() => Number) + @IsInt() + @Min(1) + @IsOptional() + page?: number = 1; + + @Type(() => Number) + @IsInt() + @Min(1) + @IsOptional() + size?: number = 20; + + @Type(() => Number) + @IsInt() + @IsOptional() + customerId?: number; + + @IsString() + @IsOptional() + status?: string; +} diff --git a/ecom-license/server/src/modules/license/license.module.ts b/ecom-license/server/src/modules/license/license.module.ts new file mode 100644 index 00000000..e32f5d39 --- /dev/null +++ b/ecom-license/server/src/modules/license/license.module.ts @@ -0,0 +1,18 @@ +import { Module, forwardRef } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { JwtSignerService } from '../../common/jwt-signer.service'; +import { LcLicense } from '../../entities/lc-license.entity'; +import { CustomerModule } from '../customer/customer.module'; +import { LicenseController } from './license.controller'; +import { LicenseService } from './license.service'; + +@Module({ + imports: [ + TypeOrmModule.forFeature([LcLicense]), + forwardRef(() => CustomerModule), + ], + controllers: [LicenseController], + providers: [LicenseService, JwtSignerService], + exports: [LicenseService, JwtSignerService], +}) +export class LicenseModule {} diff --git a/ecom-license/server/src/modules/license/license.service.ts b/ecom-license/server/src/modules/license/license.service.ts new file mode 100644 index 00000000..893a8d21 --- /dev/null +++ b/ecom-license/server/src/modules/license/license.service.ts @@ -0,0 +1,123 @@ +import { Injectable, NotFoundException } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Repository } from 'typeorm'; +import { JwtSignerService } from '../../common/jwt-signer.service'; +import { LcCustomer } from '../../entities/lc-customer.entity'; +import { LcLicense } from '../../entities/lc-license.entity'; +import { CustomerService } from '../customer/customer.service'; +import { GenerateLicenseDto, LicenseQueryDto } from './license.dto'; + +@Injectable() +export class LicenseService { + constructor( + @InjectRepository(LcLicense) + private readonly licenseRepo: Repository, + private readonly customerService: CustomerService, + private readonly jwtSigner: JwtSignerService, + ) {} + + async list(query: LicenseQueryDto) { + const page = query.page || 1; + const size = query.size || 20; + const qb = this.licenseRepo + .createQueryBuilder('l') + .leftJoinAndSelect('l.customer', 'c') + .orderBy('l.id', 'DESC') + .skip((page - 1) * size) + .take(size); + if (query.customerId) { + qb.andWhere('l.customer_id = :customerId', { customerId: query.customerId }); + } + if (query.status) { + qb.andWhere('l.status = :status', { status: query.status }); + } + const [items, total] = await qb.getManyAndCount(); + return { items, total, page, size }; + } + + async findOne(id: number) { + const license = await this.licenseRepo.findOne({ + where: { id }, + relations: ['customer'], + }); + if (!license) throw new NotFoundException('许可证不存在'); + return license; + } + + async listByCustomer(customerId: number) { + await this.customerService.findOne(customerId); + return this.licenseRepo.find({ + where: { customerId }, + order: { id: 'DESC' }, + }); + } + + async generate(dto: GenerateLicenseDto) { + const customer = await this.customerService.findOne(dto.customerId); + const expiresAt = new Date(dto.expiresAt); + const signed = await this.jwtSigner.signLicense({ + sub: customer.code, + company: dto.company, + machineFingerprint: dto.machineFingerprint, + edition: dto.edition, + features: dto.features, + expiresAt, + }); + const license = this.licenseRepo.create({ + customerId: customer.id, + licenseKey: signed.licenseKey, + jti: signed.jti, + edition: dto.edition, + machineFingerprint: dto.machineFingerprint, + features: dto.features, + status: 'active', + issuedAt: signed.issuedAt, + expiresAt: signed.expiresAt, + activationCount: 0, + }); + const saved = await this.licenseRepo.save(license); + return { + id: saved.id, + licenseKey: saved.licenseKey, + jti: saved.jti, + edition: saved.edition, + machineFingerprint: saved.machineFingerprint, + expiresAt: saved.expiresAt, + status: saved.status, + }; + } + + async revoke(id: number) { + const license = await this.findOne(id); + license.status = 'revoked'; + license.revokedAt = new Date(); + await this.licenseRepo.save(license); + return { id: license.id, jti: license.jti, status: license.status, revokedAt: license.revokedAt }; + } + + /** 在线吊销查询(主应用可选同步) */ + async getStatusByJti(jti: string) { + const license = await this.licenseRepo.findOne({ where: { jti } }); + if (!license) { + throw new NotFoundException('许可证不存在'); + } + // 过期自动标记 + if (license.status === 'active' && license.expiresAt < new Date()) { + license.status = 'expired'; + await this.licenseRepo.save(license); + } + return { + jti: license.jti, + status: license.status, + revokedAt: license.revokedAt, + }; + } + + async download(id: number) { + const license = await this.findOne(id); + return { + filename: `license-${license.jti}.key`, + content: license.licenseKey, + }; + } +} diff --git a/ecom-license/server/tsconfig.build.json b/ecom-license/server/tsconfig.build.json new file mode 100644 index 00000000..79548c6d --- /dev/null +++ b/ecom-license/server/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["node_modules", "dist", "**/*spec.ts"] +} diff --git a/ecom-license/server/tsconfig.json b/ecom-license/server/tsconfig.json new file mode 100644 index 00000000..b4d9473e --- /dev/null +++ b/ecom-license/server/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "target": "ES2021", + "sourceMap": true, + "outDir": "./dist", + "rootDir": "./src", + "baseUrl": "./", + "skipLibCheck": true, + "strict": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "types": ["node"] + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} diff --git a/ecom-license/tsconfig.json b/ecom-license/tsconfig.json new file mode 100644 index 00000000..10900e31 --- /dev/null +++ b/ecom-license/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./server" }, + { "path": "./cli" } + ] +}