@cloudbase/manager-node 5.7.1-beta.0 → 5.8.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/lib/cloudApp/index.js +12 -3
  2. package/lib/deploy/DatabaseDeployer.js +238 -0
  3. package/lib/deploy/DeployOrchestrator.js +645 -0
  4. package/lib/deploy/FunctionDeployer.js +611 -0
  5. package/lib/deploy/GatewayDeployer.js +612 -0
  6. package/lib/deploy/StateStore.js +327 -0
  7. package/lib/deploy/StaticDeployer.js +236 -0
  8. package/lib/deploy/domain.js +41 -0
  9. package/lib/deploy/framework.js +230 -0
  10. package/lib/deploy/function/artifact.js +207 -0
  11. package/lib/deploy/function/builders/cloud.js +654 -0
  12. package/lib/deploy/function/cam-preflight.js +157 -0
  13. package/lib/deploy/function/cloud-build-service.js +191 -0
  14. package/lib/deploy/function/config-guard.js +595 -0
  15. package/lib/deploy/function/docker-preflight.js +87 -0
  16. package/lib/deploy/function/image-preflight.js +164 -0
  17. package/lib/deploy/function/local-builder.js +129 -0
  18. package/lib/deploy/function/planner.js +278 -0
  19. package/lib/deploy/function/preflight.js +329 -0
  20. package/lib/deploy/types.js +103 -0
  21. package/lib/env/index.js +0 -9
  22. package/lib/environment.js +11 -0
  23. package/lib/function/index.js +1 -1
  24. package/lib/hosting/index.js +4 -1
  25. package/lib/index.js +31 -0
  26. package/lib/projectValidator/index.js +452 -0
  27. package/lib/projectValidator/types.js +2 -0
  28. package/lib/storage/index.js +6 -7
  29. package/lib/utils/index.js +62 -5
  30. package/package.json +2 -1
  31. package/types/cloudApp/index.d.ts +4 -0
  32. package/types/cloudApp/types.d.ts +87 -6
  33. package/types/deploy/DatabaseDeployer.d.ts +70 -0
  34. package/types/deploy/DeployOrchestrator.d.ts +170 -0
  35. package/types/deploy/FunctionDeployer.d.ts +159 -0
  36. package/types/deploy/GatewayDeployer.d.ts +194 -0
  37. package/types/deploy/StateStore.d.ts +170 -0
  38. package/types/deploy/StaticDeployer.d.ts +97 -0
  39. package/types/deploy/domain.d.ts +17 -0
  40. package/types/deploy/framework.d.ts +63 -0
  41. package/types/deploy/function/artifact.d.ts +40 -0
  42. package/types/deploy/function/builders/cloud.d.ts +110 -0
  43. package/types/deploy/function/cam-preflight.d.ts +51 -0
  44. package/types/deploy/function/cloud-build-service.d.ts +10 -0
  45. package/types/deploy/function/config-guard.d.ts +41 -0
  46. package/types/deploy/function/docker-preflight.d.ts +17 -0
  47. package/types/deploy/function/image-preflight.d.ts +21 -0
  48. package/types/deploy/function/local-builder.d.ts +26 -0
  49. package/types/deploy/function/planner.d.ts +15 -0
  50. package/types/deploy/function/preflight.d.ts +9 -0
  51. package/types/deploy/types.d.ts +429 -0
  52. package/types/env/index.d.ts +1 -8
  53. package/types/env/type.d.ts +6 -97
  54. package/types/environment.d.ts +7 -0
  55. package/types/function/types.d.ts +15 -0
  56. package/types/hosting/index.d.ts +6 -0
  57. package/types/index.d.ts +18 -0
  58. package/types/interfaces/function.interface.d.ts +1 -1
  59. package/types/projectValidator/index.d.ts +38 -0
  60. package/types/projectValidator/types.d.ts +26 -0
  61. package/types/storage/index.d.ts +6 -0
  62. package/types/utils/index.d.ts +13 -0
package/types/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { EnvService } from './env';
2
2
  import { FunctionService } from './function';
3
+ import { FunctionDeployer } from './deploy/FunctionDeployer';
3
4
  import { CloudRunService } from './cloudrun';
4
5
  import { AgentService } from './agent';
5
6
  import { StorageService } from './storage';
@@ -21,6 +22,8 @@ import { CloudAppService } from './cloudApp';
21
22
  import { AiModelService } from './aiModel';
22
23
  import { IntegrationService } from './integration';
23
24
  import { MonitorService } from './monitor';
25
+ import { ProjectValidator } from './projectValidator';
26
+ import { DeployOrchestrator } from './deploy/DeployOrchestrator';
24
27
  interface CloudBaseConfig {
25
28
  secretId?: string;
26
29
  secretKey?: string;
@@ -47,10 +50,17 @@ declare class CloudBase {
47
50
  private cloudBaseConfig;
48
51
  private environmentManager;
49
52
  private docsService;
53
+ private projectValidatorService;
54
+ private deployOrchestratorService;
50
55
  constructor(config?: CloudBaseConfig);
51
56
  addEnvironment(envId: string): void;
52
57
  currentEnvironment(): Environment;
53
58
  get functions(): FunctionService;
59
+ /**
60
+ * 函数部署编排器(FunctionDeployer)
61
+ * 在现有 FunctionService 之上,按 buildStrategy 编排 Event/HTTP 函数的创建、更新与访问收敛
62
+ */
63
+ get functionDeployer(): FunctionDeployer;
54
64
  get cloudrun(): CloudRunService;
55
65
  get agent(): AgentService;
56
66
  get storage(): StorageService;
@@ -101,6 +111,14 @@ declare class CloudBase {
101
111
  */
102
112
  get monitor(): MonitorService;
103
113
  get docs(): DocsService;
114
+ get projectValidator(): ProjectValidator;
115
+ getProjectValidator(): ProjectValidator;
116
+ /**
117
+ * 声明式部署编排器
118
+ * 顺序:database → functions → app → hosting → gateway;支持 dry-run / only / skip / 幂等重试
119
+ */
120
+ get deployOrchestrator(): DeployOrchestrator;
121
+ getDeployOrchestrator(): DeployOrchestrator;
104
122
  getEnvironmentManager(): EnvironmentManager;
105
123
  getManagerConfig(): CloudBaseConfig;
106
124
  get isInternalEndpoint(): Boolean;
@@ -44,7 +44,7 @@ export interface ICloudFunction extends ICloudFunctionConfig {
44
44
  name: string;
45
45
  description?: string;
46
46
  type?: 'Event' | 'HTTP';
47
- protocolType?: 'WS';
47
+ protocolType?: 'HTTP' | 'WS';
48
48
  protocolParams?: {
49
49
  wsParams?: {
50
50
  idleTimeOut?: number;
@@ -0,0 +1,38 @@
1
+ import { ProjectValidationResult, ProjectValidatorValidateOptions } from './types';
2
+ export declare class ProjectValidator {
3
+ validate(options?: ProjectValidatorValidateOptions): Promise<ProjectValidationResult>;
4
+ private loadProjectConfig;
5
+ private validateSchema;
6
+ private validateEnvId;
7
+ /**
8
+ * 个人版 TCR 的 username/password/namespace 必须在 cloudbaserc 中显式声明。
9
+ * ConfigParser 已先解析 {{env.*}},因此这里同时承担缺失 env 值的前置校验。
10
+ */
11
+ private validatePersonalRegistryConfig;
12
+ private hasPersonalCloudFunction;
13
+ private isPersonalCloudFunction;
14
+ private validateResources;
15
+ private validateConsistency;
16
+ /**
17
+ * 检测 hosting 路由中 enablePathTransmission=true 与自动生成 pathRewrite 的冲突
18
+ *
19
+ * hosting 目标未显式配置 pathRewrite 时,部署会自动生成 PathRewrite.Prefix = hosting.deployPath。
20
+ * 若同时显式开启 enablePathTransmission=true,路径透传会覆盖路径重写,导致请求打到错误的托管路径(404)。
21
+ */
22
+ private validateGatewayPathRewriteConflicts;
23
+ /**
24
+ * 子路径部署(deployPath !== '/')下,前端构建产物若仍使用根路径 base(如 Vite 默认 '/'),
25
+ * 会导致资源请求落到 /assets/* 而非 /{deployPath}/assets/*,出现 404/白屏。
26
+ *
27
+ * 这里在“可能存在构建步骤”的 hosting 配置上给出防坑告警。
28
+ */
29
+ private validateHostingSubPathBaseRisks;
30
+ private validateUniqueNames;
31
+ private validateUniqueField;
32
+ private validateGatewayTargets;
33
+ private getSummary;
34
+ private getLinkedEnvId;
35
+ private normalizeSchemaPath;
36
+ private getErrorMessage;
37
+ }
38
+ export * from './types';
@@ -0,0 +1,26 @@
1
+ export type ProjectValidationIssueLevel = 'error' | 'warning';
2
+ export interface ProjectValidationIssue {
3
+ level: ProjectValidationIssueLevel;
4
+ resource?: string;
5
+ field?: string;
6
+ message: string;
7
+ fix?: string;
8
+ }
9
+ export interface ProjectValidationSummary {
10
+ functions: number;
11
+ hosting: number;
12
+ databases: number;
13
+ gateways: number;
14
+ }
15
+ export interface ProjectValidationResult {
16
+ valid: boolean;
17
+ version: string;
18
+ errors: ProjectValidationIssue[];
19
+ warnings: ProjectValidationIssue[];
20
+ summary: ProjectValidationSummary;
21
+ }
22
+ export interface ProjectValidatorValidateOptions {
23
+ cwd?: string;
24
+ configPath?: string;
25
+ mode?: string;
26
+ }
@@ -49,6 +49,12 @@ export interface IRoutingRules {
49
49
  export interface IBucketWebsiteOptions {
50
50
  indexDocument: string;
51
51
  errorDocument?: string;
52
+ /** 错误文档是否保留原始 HTTP 状态码:Enabled / Disabled(SPA 回退需 Disabled,否则 404 状态码使前端路由失效) */
53
+ originalHttpStatus?: string;
54
+ /** 404 是否展示腾讯云公益页面:Enabled / Disabled(SPA 回退需 Disabled,否则覆盖错误文档) */
55
+ charity404?: string;
56
+ /** 忽略 HTML 扩展名:Enabled / Disabled(未传则保持默认 Disabled) */
57
+ autoAddressing?: string;
52
58
  routingRules?: Array<IRoutingRules>;
53
59
  region: string;
54
60
  bucket: string;
@@ -6,11 +6,24 @@ export * from './envLazy';
6
6
  export * from './fs';
7
7
  export * from './http-request';
8
8
  export { guid6 } from './uuid';
9
+ interface IZipExtraEntry {
10
+ /** zip 包内的相对路径 */
11
+ zipPath: string;
12
+ /** 文件文本内容 */
13
+ content: string | Buffer;
14
+ /** unix 权限位(八进制),如 0o755 */
15
+ mode?: number;
16
+ }
9
17
  interface IZipOption {
10
18
  dirPath: string;
11
19
  outputPath: string;
12
20
  ignore?: string | string[];
13
21
  pattern?: string;
22
+ /**
23
+ * 额外注入 zip 的文件条目(不来自 dirPath),用于把 SDK 生成的辅助文件
24
+ * (如构建推送脚本)打进包内,而不污染用户源码目录。
25
+ */
26
+ extraEntries?: IZipExtraEntry[];
14
27
  }
15
28
  export declare function compressToZip(option: IZipOption): Promise<unknown>;
16
29
  /**