Skip to content

Commit 3fab08c

Browse files
committed
Merge 'services' into 'master'
feat(services): auto-generate services See merge request: !9
2 parents 0d5eb27 + f51adeb commit 3fab08c

File tree

13,167 files changed

+692342
-150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

13,167 files changed

+692342
-150
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
- name: Setup Node.js
1717
uses: actions/setup-node@v4
1818
with:
19-
node-version: 20
19+
node-version: 18
2020

2121
- name: Setup pnpm
2222
uses: pnpm/action-setup@v2
2323
with:
24-
version: 8
24+
version: 9
2525

2626
- name: Install Dependencies
2727
run: pnpm install

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ jobs:
2020
- name: Setup Node.js
2121
uses: actions/setup-node@v4
2222
with:
23-
node-version: 20
23+
node-version: 18
2424

2525
- name: Setup pnpm
2626
uses: pnpm/action-setup@v2
2727
with:
28-
version: 8
28+
version: 9
2929

3030
- name: Install Dependencies
3131
run: pnpm install

README.EN.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ English | [中文](README.md)
22

33
# Volcengine SDK for Node.js
44

5-
## Installation
5+
## Installation Core Packages
66

77
### Requirements
88

@@ -35,34 +35,26 @@ export VOLCSTACK_ACCESS_KEY_ID="YOUR_AK"
3535
export VOLCSTACK_SECRET_ACCESS_KEY="YOUR_SK"
3636
```
3737

38-
## Endpoint Configuration
39-
40-
The SDK supports multiple ways to configure the Endpoint, with the following priority (highest to lowest):
41-
42-
1. **Custom Endpoint**: Specify `EndpointWithEndpoint` in the client configuration (e.g. `iam.example.com`).
43-
2. **Automatic Addressing**: Specify `region`, and the SDK will automatically construct the Endpoint based on the service name and region (e.g. `ecs.cn-beijing.volcengineapi.com`).
44-
3. **Default**: If not specified and cannot be deduced, `open.volcengineapi.com` is used by default.
45-
4638
## Quick Start
4739

4840
The following example shows how to initialize the client and send a request.
49-
Install the corresponding service SDK package (e.g., `@volcengine/iam`).
41+
Install the corresponding service SDK package (e.g., `@volcengine/ecs`).
5042

5143
```bash
5244
# pnpm
53-
pnpm add @volcengine/iam
45+
pnpm add @volcengine/ecs
5446
```
5547

5648
```typescript
57-
import { IAMClient, ListUsersCommand } from "@volcengine/iam"; // Need to install the corresponding service package
49+
import { ECSClient, DescribeZonesCommand } from "@volcengine/ecs"; // Need to install the corresponding service package
5850

5951
// 1. Use AK/SK from environment variables and specify Region
60-
const client = new IAMClient({
52+
const client = new ECSClient({
6153
region: "cn-beijing",
6254
});
6355

6456
// 2. Or explicitly pass AK/SK in the code
65-
// const client = new IAMClient({
57+
// const client = new ECSClient({
6658
// accessKeyId: "YOUR_AK",
6759
// secretAccessKey: "YOUR_SK",
6860
// region: "cn-beijing",
@@ -71,7 +63,7 @@ const client = new IAMClient({
7163
async function main() {
7264
try {
7365
// Send request (refer to service SDK documentation for specific Commands)
74-
const command = new ListUsersCommand({});
66+
const command = new DescribeZonesCommand({});
7567
const response = await client.send(command);
7668
console.log(response);
7769
} catch (error) {

README.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Volcengine SDK for Node.js
44

5-
## 安装
5+
## 安装 Core 包
66

77
### 环境要求
88

@@ -35,35 +35,27 @@ export VOLCSTACK_ACCESS_KEY_ID="YOUR_AK"
3535
export VOLCSTACK_SECRET_ACCESS_KEY="YOUR_SK"
3636
```
3737

38-
## Endpoint 设置
39-
40-
SDK 支持多种方式配置 Endpoint,优先级从高到低:
41-
42-
1. **自定义 Endpoint**: 在客户端配置中指定 `host` (e.g. `open.volcengineapi.com`).
43-
2. **自动寻址**: 指定 `region`,SDK 会根据服务名和区域自动构造 Endpoint (e.g. `ecs.cn-beijing.volcengineapi.com`).
44-
3. **默认**: 如果未指定且无法推导,默认使用 `open.volcengineapi.com`.
45-
4638
## 快速开始
4739

4840
以下示例展示了如何初始化客户端并发送请求。
49-
安装对应的业务 SDK 包(如 `@volcengine/iam`)。
41+
安装对应的业务 SDK 包(如 `@volcengine/ecs`)。
5042

5143
```bash
5244
# pnpm
53-
pnpm add @volcengine/iam
45+
pnpm add @volcengine/ecs
5446

5547
```
5648

5749
```typescript
58-
import { IAMClient } from "@volcengine/iam"; // 需安装对应的业务包
50+
import { ECSClient, DescribeZonesCommand } from "@volcengine/ecs"; // 需安装对应的业务包
5951

6052
// 1. 使用环境变量中的 AK/SK,并指定 Region
61-
const client = new IAMClient({
53+
const client = new ECSClient({
6254
region: "cn-beijing",
6355
});
6456

6557
// 2. 或者在代码中显式传入 AK/SK
66-
// const client = new IAMClient({
58+
// const client = new ECSClient({
6759
// accessKeyId: "YOUR_AK",
6860
// secretAccessKey: "YOUR_SK",
6961
// region: "cn-beijing",
@@ -72,7 +64,7 @@ const client = new IAMClient({
7264
async function main() {
7365
try {
7466
// 发送请求 (具体 Command 需参考业务 SDK 文档)
75-
const command = new ListUsersCommand({});
67+
const command = new DescribeZonesCommand({});
7668
const response = await client.send(command);
7769
console.log(response);
7870
} catch (error) {

SDK_Integration.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,10 @@ The backoff strategy determines the wait time between each retry. You can choose
441441
- `ExponentialWithRandomJitterBackoffStrategy` (Default): Exponential backoff with jitter. Adds a random delay on top of exponential backoff to help avoid "thundering herd" effects.
442442

443443
```typescript
444+
import { StrategyName } from "@volcengine/sdk-core";
444445
const client = new EcsClient({
445446
// ... other configurations
446-
retryMode: "ExponentialBackoffStrategy",
447+
strategyName: StrategyName.ExponentialWithRandomJitterBackoffStrategy,
447448
});
448449
```
449450

@@ -502,7 +503,7 @@ try {
502503
if (error.status !== undefined) {
503504
// 1.1 SSL Error (status === 0)
504505
if (error.status === 0) {
505-
console.error(`❌ SSL Error: ${error.message}`);
506+
console.error(`❌ SSL Error`);
506507
}
507508
// 1.2 Server returned error (status > 0)
508509
else {
@@ -514,7 +515,6 @@ try {
514515
console.error(` RequestId: ${RequestId}`);
515516
} else {
516517
// Other HTTP errors (such as 404, 500, 502, etc.)
517-
console.error(`❌ HTTP Error ${error.status}: ${error.message}`);
518518
}
519519
}
520520
}
@@ -530,17 +530,12 @@ try {
530530
}
531531
// 3. Handle other SDK exceptions (Exception)
532532
else {
533-
console.error("❌ SDK Exception Occurred:");
534-
console.error(` Message: ${error.message}`);
535-
console.error(` Name: ${error.name}`);
536-
if (error.originalError) {
537-
console.error(" Cause:", error.originalError);
538-
}
533+
console.error("❌ SDK Exception Occurred");
539534
}
540535
}
541536
// 4. Unknown error (Error not thrown by SDK)
542537
else {
543-
console.error("❌ Unknown Error:", error);
538+
console.error("❌ Unknown Error");
544539
}
545540
}
546541
```

SDK_Integration_zh.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,11 @@ SDK 只会对特定的错误进行重试,包括:
441441
- `ExponentialWithRandomJitterBackoffStrategy` (默认): 带抖动的指数退避。在指数退避的基础上增加一个随机延迟,有助于避免“惊群效应”。
442442

443443
```typescript
444+
import { StrategyName } from "@volcengine/sdk-core";
445+
444446
const client = new EcsClient({
445447
// ... 其他配置
446-
retryMode: "ExponentialBackoffStrategy",
448+
strategyName: StrategyName.ExponentialWithRandomJitterBackoffStrategy,
447449
});
448450
```
449451

@@ -502,7 +504,7 @@ try {
502504
if (error.status !== undefined) {
503505
// 1.1 SSL 错误 (status === 0)
504506
if (error.status === 0) {
505-
console.error(`❌ SSL Error: ${error.message}`);
507+
console.error(`❌ SSL Error`);
506508
}
507509
// 1.2 服务端返回的错误 (status > 0)
508510
else {
@@ -514,7 +516,6 @@ try {
514516
console.error(` RequestId: ${RequestId}`);
515517
} else {
516518
// 其他 HTTP 错误 (如 404, 500, 502 等)
517-
console.error(`❌ HTTP Error ${error.status}: ${error.message}`);
518519
}
519520
}
520521
}
@@ -530,17 +531,12 @@ try {
530531
}
531532
// 3. 处理其他 SDK 异常 (Exception)
532533
else {
533-
console.error("❌ SDK Exception Occurred:");
534-
console.error(` Message: ${error.message}`);
535-
console.error(` Name: ${error.name}`);
536-
if (error.originalError) {
537-
console.error(" Cause:", error.originalError);
538-
}
534+
console.error("❌ SDK Exception Occurred");
539535
}
540536
}
541537
// 4. 未知错误 (非 SDK 抛出的错误)
542538
else {
543-
console.error("❌ Unknown Error:", error);
539+
console.error("❌ Unknown Error");
544540
}
545541
}
546542
```

meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"lasted": "1.0.91",
2+
"lasted": "1.0.1",
33
"meta_commit": "416a374787b965e9d18b4f1c640a654cf4ede574"
4-
}
4+
}

packages/sdk-core/src/client/Client.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,18 @@ export class Client {
102102

103103
async send<
104104
TInput extends CommandInput,
105+
TOutput extends any,
105106
TCommandName extends keyof CommandOutputMap
106107
>(
107-
command: Command<TInput, CommandOutputMap[TCommandName], TCommandName>,
108+
command: Command<TInput, TOutput, TCommandName>,
108109
options?: SendOptions
109-
): Promise<CommandOutputMap[TCommandName]> {
110+
): Promise<TOutput> {
110111
const stack = this.middlewareStack.merge(command.middlewareStack);
111112
const context: MiddlewareContext = {
112113
clientName: this.constructor.name,
113114
commandName: command.constructor.name,
114115
clientConfig: this.config,
115116
contentType: command.requestConfig?.contentType || "",
116-
castMap: {
117-
requestMap: command.requestMap,
118-
responseMap: command.responseMap,
119-
},
120-
skipResponseCasting: options?.skipResponseCasting,
121117
};
122118
const handler = stack.resolve(async (args: Args) => args, context);
123119

@@ -189,10 +185,9 @@ export class Client {
189185
*/
190186
debugMiddlewareStack<
191187
TInput extends CommandInput,
188+
TOutput extends any,
192189
TCommandName extends keyof CommandOutputMap
193-
>(
194-
command: Command<TInput, CommandOutputMap[TCommandName], TCommandName>
195-
): string {
190+
>(command: Command<TInput, TOutput, TCommandName>): string {
196191
const mergedStack = this.middlewareStack.merge(command.middlewareStack);
197192
return mergedStack.toString();
198193
}

packages/sdk-core/src/client/stsClient/api.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ import { AssumeRoleResponse } from "./types/index";
2828
// ============================================================================
2929
export type AssumeRoleCommandOutput = CommandOutput<AssumeRoleResponse>;
3030

31-
declare module "../../types/types" {
32-
interface CommandOutputMap {
33-
AssumeRoleCommand: AssumeRoleCommandOutput;
34-
}
35-
}
3631
/**
3732
* STSClient Service Client
3833
*/

packages/sdk-core/src/command/Command.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ export class Command<
1919
pathname?: string;
2020
contentType?: string;
2121
};
22-
requestMap?: Record<string, any>;
23-
responseMap?: Record<string, any>;
2422

2523
protected __type?: {
2624
output: TOutput;

0 commit comments

Comments
 (0)