connectbase-client 3.5.2 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cli.js +17 -17
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,34 @@
3
3
  본 SDK 의 모든 주요 변경사항을 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/) 형식으로 기록합니다.
4
4
  버전은 [Semantic Versioning](https://semver.org/lang/ko/) 을 따릅니다.
5
5
 
6
+ ## [3.5.3] - 2026-05-01
7
+
8
+ ### Fixed — `connectbase tunnel --label` 의 `tunnel_id` 추출 실패
9
+
10
+ 3.5.2 의 `parseArgs()` 패치로 `--label` / `--description` 이 정상 파싱되어
11
+ `registerEndpointBinding()` 까지 호출되는 것은 확인됐으나, 함수 진입 직후
12
+ `tunnel_id` 추출 단계에서 즉시 skip 되어 자동 등록이 여전히 한 번도
13
+ 수행되지 않던 문제를 수정했습니다.
14
+
15
+ 원인: 추출 로직이 `https://<id>.tunnel.connectbase.world` (subdomain 기반)
16
+ 형식을 가정했으나, 실제 발급 URL 은 `https://tunnel.connectbase.world/<id>`
17
+ (path 기반) 입니다. `host.replace(/\.tunnel\.connectbase\.world$/, '')` 가
18
+ 정규식 매칭에 실패해 입력을 그대로 반환 → `tunnelId === host` 조건으로
19
+ "tunnel_id 추출 실패" 분기 진입 → 자동 등록 skip.
20
+
21
+ - URL 파싱을 제거하고, 서버가 `tunnel_ready` 메시지에 직접 실어 보내는
22
+ `tunnel_id` 필드를 그대로 사용하도록 변경 (서버 권위값 기준 — 향후 URL
23
+ 형식 변경에 영향받지 않음).
24
+ - `registerEndpointBinding()` 시그니처: `tunnelUrl` → `tunnelId` 로 단순화 +
25
+ `export` 노출 → 단위 테스트 가능.
26
+ - `test/cli-register-endpoint.test.ts` 회귀 가드 5 케이스 신규 추가:
27
+ 201 (정상 등록 — body.tunnel_id 검증), description 기본값, baseUrl trailing
28
+ slash 정규화, appId URL 인코딩, 409/401/5xx/네트워크 오류 시 호출부
29
+ 흐름 유지 (throw 하지 않음).
30
+
31
+ 회귀 영향 범위: 3.5.2 의 `--label` 자동 등록 사용자 (해당 기능을 처음으로
32
+ 정상 동작시킴). 다른 옵션 / 기본 `tunnel` 동작에는 영향 없음.
33
+
6
34
  ## [3.5.2] - 2026-05-01
7
35
 
8
36
  ### Fixed — `connectbase tunnel --label` / `--description` 옵션이 파싱되지 않던 문제
package/dist/cli.js CHANGED
@@ -34,6 +34,7 @@ __export(cli_exports, {
34
34
  computeDeployDiff: () => computeDeployDiff,
35
35
  normalizeRelativePath: () => normalizeRelativePath,
36
36
  parseArgs: () => parseArgs,
37
+ registerEndpointBinding: () => registerEndpointBinding,
37
38
  sha256Hex: () => sha256Hex
38
39
  });
39
40
  module.exports = __toCommonJS(cli_exports);
@@ -1566,15 +1567,8 @@ ${colors.blue}?${colors.reset} \uC571 \uC120\uD0DD (\uBC88\uD638): `);
1566
1567
  success(`\uC571 \uC0DD\uC131 \uC644\uB8CC: ${createData.app_name}`);
1567
1568
  return { appId: createData.app_id, publicKey: createData.public_key };
1568
1569
  }
1569
- async function registerEndpointBinding(baseUrl, appId, secretKey, tunnelUrl, label, description) {
1570
+ async function registerEndpointBinding(baseUrl, appId, secretKey, tunnelId, label, description) {
1570
1571
  try {
1571
- const u = new URL(tunnelUrl);
1572
- const host = u.hostname;
1573
- const tunnelId = host.replace(/\.tunnel\.connectbase\.world$/, "");
1574
- if (!tunnelId || tunnelId === host) {
1575
- error(`tunnel_id \uCD94\uCD9C \uC2E4\uD328 (${tunnelUrl}) \u2014 endpoint "${label}" \uC790\uB3D9 \uB4F1\uB85D skip`);
1576
- return;
1577
- }
1578
1572
  const apiBase = baseUrl.replace(/\/+$/, "");
1579
1573
  const res = await fetch(`${apiBase}/v1/apps/${encodeURIComponent(appId)}/endpoints/cli`, {
1580
1574
  method: "POST",
@@ -1837,15 +1831,20 @@ ${colors.dim}\uC678\uBD80 \uC9C1\uC811 \uD638\uCD9C \uC2DC \uB2E4\uC74C \uD5E4\u
1837
1831
  log(`${colors.dim} $ curl -H "X-Proxy-Token: ${proxyToken}" ${tunnelUrl}/${colors.reset}`);
1838
1832
  log(`${colors.dim} $ curl "${tunnelUrl}/?proxy_token=${proxyToken}"${colors.reset}`);
1839
1833
  }
1840
- if (tunnelOpts?.label && tunnelUrl) {
1841
- await registerEndpointBinding(
1842
- config.baseUrl,
1843
- appId,
1844
- tunnelKey,
1845
- tunnelUrl,
1846
- tunnelOpts.label,
1847
- tunnelOpts.description
1848
- );
1834
+ if (tunnelOpts?.label) {
1835
+ const tunnelId = typeof msg.tunnel_id === "string" ? msg.tunnel_id : "";
1836
+ if (!tunnelId) {
1837
+ error(`tunnel_ready \uBA54\uC2DC\uC9C0\uC5D0 tunnel_id \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 endpoint "${tunnelOpts.label}" \uC790\uB3D9 \uB4F1\uB85D skip`);
1838
+ } else {
1839
+ await registerEndpointBinding(
1840
+ config.baseUrl,
1841
+ appId,
1842
+ tunnelKey,
1843
+ tunnelId,
1844
+ tunnelOpts.label,
1845
+ tunnelOpts.description
1846
+ );
1847
+ }
1849
1848
  }
1850
1849
  log(`
1851
1850
  ${colors.dim}Ctrl+C\uB85C \uC885\uB8CC${colors.reset}
@@ -2227,5 +2226,6 @@ main().catch((err) => {
2227
2226
  computeDeployDiff,
2228
2227
  normalizeRelativePath,
2229
2228
  parseArgs,
2229
+ registerEndpointBinding,
2230
2230
  sha256Hex
2231
2231
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "connectbase-client",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "Connect Base JavaScript/TypeScript SDK for browser and Node.js",
5
5
  "repository": {
6
6
  "type": "git",