connectbase-client 3.35.0 → 3.35.2

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.
package/dist/index.d.mts CHANGED
@@ -96,10 +96,10 @@ interface AbortOptions {
96
96
  * Recent API calls breadcrumb buffer — SDK 디버깅 / platform issue 발행 시 자동 첨부.
97
97
  *
98
98
  * **저장 정책 (PII 보호):**
99
- * - method, path (query string strip), status, duration_ms, timestamp 만 저장
99
+ * - method, path (query string 전체 strip), status, duration_ms, timestamp 만 저장
100
100
  * - body / response body / 인증 토큰 미저장
101
- * - URL secret-like 패턴 (key=, token=, password=) 자동 redact
102
- * - `/v1/auth/*`, `/v1/oauth/token` 등 민감 endpoint path 만 (쿼리 strip)
101
+ * - 쿼리스트링은 단위 redact 가 아니라 통째로 제거 (토큰/PII 누출 가능성 0)
102
+ * - 따라서 `/v1/auth/*`, `/v1/oauth/token` 등 민감 endpoint path 만 보존
103
103
  */
104
104
  interface RecentApiCall {
105
105
  method: string;
@@ -187,7 +187,7 @@ declare class HttpClient {
187
187
  private refreshLockedUntil;
188
188
  /**
189
189
  * 최근 API 호출 breadcrumb (PII strip 후 저장). platform_issue 발행 시 자동 첨부 가능.
190
- * `client.support.getRecentCalls()` 로 외부 노출.
190
+ * `client.support.getRecentApiCalls()` 로 외부 노출.
191
191
  */
192
192
  private recentCalls;
193
193
  /**
@@ -280,6 +280,13 @@ declare class HttpClient {
280
280
  * Base URL 반환
281
281
  */
282
282
  getBaseUrl(): string;
283
+ /**
284
+ * 이 클라이언트에 설정된 앱 ID 반환 (미설정 시 undefined).
285
+ *
286
+ * 콘솔(앱 소유자 JWT) 경로를 호출하기 전에 appId 유무를 확인하기 위한 public 접근자.
287
+ * private `config` 필드를 access-modifier 관통 cast 없이 노출한다.
288
+ */
289
+ getAppId(): string | undefined;
283
290
  private refreshAccessToken;
284
291
  /**
285
292
  * 새로고침/탭 재개 시 HttpOnly cookie 만으로 access token 을 복구한다.
@@ -7974,6 +7981,9 @@ declare class EndpointAPI {
7974
7981
  * predicate 는 같은 Response 를 한 번만 읽을 수 있으므로, 헬퍼 내부에서
7975
7982
  * `res.clone().json()` 형태로 안전하게 파싱한 뒤 호출자에게 전달.
7976
7983
  *
7984
+ * predicate 의 `body` 는 `unknown` 으로 전달되므로, 호출자가 자신의 응답
7985
+ * 스키마로 narrowing 한 뒤 사용한다 (런타임 검증 책임은 호출자에게 있음).
7986
+ *
7977
7987
  * @example ComfyUI 결과 폴링
7978
7988
  * ```typescript
7979
7989
  * type Hist = Record<string, { outputs: Record<string, { images?: { filename: string }[] }> }>
@@ -7981,7 +7991,8 @@ declare class EndpointAPI {
7981
7991
  * const filename = await cb.endpoint.pollUntil<string>(
7982
7992
  * "comfyui-main",
7983
7993
  * { path: `/history/${promptId}` },
7984
- * (data: Hist) => {
7994
+ * (body) => {
7995
+ * const data = body as Hist
7985
7996
  * const entry = data[promptId]
7986
7997
  * if (!entry) return undefined // 아직 큐에 있음
7987
7998
  * for (const out of Object.values(entry.outputs)) {
@@ -8024,7 +8035,7 @@ declare class EndpointAPI {
8024
8035
  * ```
8025
8036
  */
8026
8037
  connectWebSocket(label: string, opts?: ConnectWebSocketOptions): Promise<WebSocket>;
8027
- pollUntil<T>(label: string, init: EndpointCallInit, predicate: (body: any, res: Response) => T | undefined | Promise<T | undefined>, opts?: PollUntilOptions): Promise<T>;
8038
+ pollUntil<T>(label: string, init: EndpointCallInit, predicate: (body: unknown, res: Response) => T | undefined | Promise<T | undefined>, opts?: PollUntilOptions): Promise<T>;
8028
8039
  }
8029
8040
  /**
8030
8041
  * EndpointAPI.call 의 init 인자.
package/dist/index.d.ts CHANGED
@@ -96,10 +96,10 @@ interface AbortOptions {
96
96
  * Recent API calls breadcrumb buffer — SDK 디버깅 / platform issue 발행 시 자동 첨부.
97
97
  *
98
98
  * **저장 정책 (PII 보호):**
99
- * - method, path (query string strip), status, duration_ms, timestamp 만 저장
99
+ * - method, path (query string 전체 strip), status, duration_ms, timestamp 만 저장
100
100
  * - body / response body / 인증 토큰 미저장
101
- * - URL secret-like 패턴 (key=, token=, password=) 자동 redact
102
- * - `/v1/auth/*`, `/v1/oauth/token` 등 민감 endpoint path 만 (쿼리 strip)
101
+ * - 쿼리스트링은 단위 redact 가 아니라 통째로 제거 (토큰/PII 누출 가능성 0)
102
+ * - 따라서 `/v1/auth/*`, `/v1/oauth/token` 등 민감 endpoint path 만 보존
103
103
  */
104
104
  interface RecentApiCall {
105
105
  method: string;
@@ -187,7 +187,7 @@ declare class HttpClient {
187
187
  private refreshLockedUntil;
188
188
  /**
189
189
  * 최근 API 호출 breadcrumb (PII strip 후 저장). platform_issue 발행 시 자동 첨부 가능.
190
- * `client.support.getRecentCalls()` 로 외부 노출.
190
+ * `client.support.getRecentApiCalls()` 로 외부 노출.
191
191
  */
192
192
  private recentCalls;
193
193
  /**
@@ -280,6 +280,13 @@ declare class HttpClient {
280
280
  * Base URL 반환
281
281
  */
282
282
  getBaseUrl(): string;
283
+ /**
284
+ * 이 클라이언트에 설정된 앱 ID 반환 (미설정 시 undefined).
285
+ *
286
+ * 콘솔(앱 소유자 JWT) 경로를 호출하기 전에 appId 유무를 확인하기 위한 public 접근자.
287
+ * private `config` 필드를 access-modifier 관통 cast 없이 노출한다.
288
+ */
289
+ getAppId(): string | undefined;
283
290
  private refreshAccessToken;
284
291
  /**
285
292
  * 새로고침/탭 재개 시 HttpOnly cookie 만으로 access token 을 복구한다.
@@ -7974,6 +7981,9 @@ declare class EndpointAPI {
7974
7981
  * predicate 는 같은 Response 를 한 번만 읽을 수 있으므로, 헬퍼 내부에서
7975
7982
  * `res.clone().json()` 형태로 안전하게 파싱한 뒤 호출자에게 전달.
7976
7983
  *
7984
+ * predicate 의 `body` 는 `unknown` 으로 전달되므로, 호출자가 자신의 응답
7985
+ * 스키마로 narrowing 한 뒤 사용한다 (런타임 검증 책임은 호출자에게 있음).
7986
+ *
7977
7987
  * @example ComfyUI 결과 폴링
7978
7988
  * ```typescript
7979
7989
  * type Hist = Record<string, { outputs: Record<string, { images?: { filename: string }[] }> }>
@@ -7981,7 +7991,8 @@ declare class EndpointAPI {
7981
7991
  * const filename = await cb.endpoint.pollUntil<string>(
7982
7992
  * "comfyui-main",
7983
7993
  * { path: `/history/${promptId}` },
7984
- * (data: Hist) => {
7994
+ * (body) => {
7995
+ * const data = body as Hist
7985
7996
  * const entry = data[promptId]
7986
7997
  * if (!entry) return undefined // 아직 큐에 있음
7987
7998
  * for (const out of Object.values(entry.outputs)) {
@@ -8024,7 +8035,7 @@ declare class EndpointAPI {
8024
8035
  * ```
8025
8036
  */
8026
8037
  connectWebSocket(label: string, opts?: ConnectWebSocketOptions): Promise<WebSocket>;
8027
- pollUntil<T>(label: string, init: EndpointCallInit, predicate: (body: any, res: Response) => T | undefined | Promise<T | undefined>, opts?: PollUntilOptions): Promise<T>;
8038
+ pollUntil<T>(label: string, init: EndpointCallInit, predicate: (body: unknown, res: Response) => T | undefined | Promise<T | undefined>, opts?: PollUntilOptions): Promise<T>;
8028
8039
  }
8029
8040
  /**
8030
8041
  * EndpointAPI.call 의 init 인자.
package/dist/index.js CHANGED
@@ -184,7 +184,7 @@ var HttpClient = class {
184
184
  this.refreshLockedUntil = 0;
185
185
  /**
186
186
  * 최근 API 호출 breadcrumb (PII strip 후 저장). platform_issue 발행 시 자동 첨부 가능.
187
- * `client.support.getRecentCalls()` 로 외부 노출.
187
+ * `client.support.getRecentApiCalls()` 로 외부 노출.
188
188
  */
189
189
  this.recentCalls = new RecentCallsBuffer();
190
190
  /**
@@ -380,6 +380,15 @@ var HttpClient = class {
380
380
  getBaseUrl() {
381
381
  return this.config.baseUrl;
382
382
  }
383
+ /**
384
+ * 이 클라이언트에 설정된 앱 ID 반환 (미설정 시 undefined).
385
+ *
386
+ * 콘솔(앱 소유자 JWT) 경로를 호출하기 전에 appId 유무를 확인하기 위한 public 접근자.
387
+ * private `config` 필드를 access-modifier 관통 cast 없이 노출한다.
388
+ */
389
+ getAppId() {
390
+ return this.config.appId;
391
+ }
383
392
  async refreshAccessToken() {
384
393
  if (this.isRefreshing) {
385
394
  return this.refreshPromise;
@@ -843,13 +852,14 @@ var AuthAPI = class {
843
852
  return;
844
853
  }
845
854
  if (typeof window === "undefined") return;
855
+ const bridge = window;
846
856
  if (memberId) {
847
- if (typeof window.__cbSetMember === "function") {
848
- window.__cbSetMember(memberId);
857
+ if (typeof bridge.__cbSetMember === "function") {
858
+ bridge.__cbSetMember(memberId);
849
859
  }
850
860
  } else {
851
- if (typeof window.__cbClearMember === "function") {
852
- window.__cbClearMember();
861
+ if (typeof bridge.__cbClearMember === "function") {
862
+ bridge.__cbClearMember();
853
863
  }
854
864
  }
855
865
  }
@@ -895,6 +905,15 @@ var AuthAPI = class {
895
905
  data,
896
906
  { skipAuth: true }
897
907
  );
908
+ assertShape(
909
+ response,
910
+ {
911
+ access_token: { type: "string" },
912
+ refresh_token: { type: "string" },
913
+ member_id: { type: "string-or-number" }
914
+ },
915
+ "auth.signUpMember"
916
+ );
898
917
  this.http.setTokens(response.access_token, response.refresh_token);
899
918
  this.notifyVisitorTracker(response.member_id);
900
919
  return response;
@@ -1125,6 +1144,14 @@ var AuthAPI = class {
1125
1144
  {},
1126
1145
  { headers: { "Authorization": `Bearer ${storedData.refreshToken}` }, skipAuth: true }
1127
1146
  );
1147
+ assertShape(
1148
+ refreshed,
1149
+ {
1150
+ access_token: { type: "string" },
1151
+ refresh_token: { type: "string" }
1152
+ },
1153
+ "auth.signInAsGuestMember.reissue"
1154
+ );
1128
1155
  this.http.setTokens(refreshed.access_token, refreshed.refresh_token);
1129
1156
  this.storeGuestMemberTokens(refreshed.access_token, refreshed.refresh_token, storedData.memberId);
1130
1157
  this.notifyVisitorTracker(storedData.memberId);
@@ -1145,6 +1172,15 @@ var AuthAPI = class {
1145
1172
  {},
1146
1173
  { skipAuth: true }
1147
1174
  );
1175
+ assertShape(
1176
+ response,
1177
+ {
1178
+ access_token: { type: "string" },
1179
+ refresh_token: { type: "string" },
1180
+ member_id: { type: "string-or-number" }
1181
+ },
1182
+ "auth.signInAsGuestMember.new"
1183
+ );
1148
1184
  this.http.setTokens(response.access_token, response.refresh_token);
1149
1185
  this.storeGuestMemberTokens(response.access_token, response.refresh_token, response.member_id);
1150
1186
  this.notifyVisitorTracker(response.member_id);
@@ -1331,7 +1367,7 @@ var DatabaseAPI = class {
1331
1367
  * appId 가 설정되어 있어야 콘솔 경로를 호출할 수 있습니다 (validation_schema set/delete).
1332
1368
  */
1333
1369
  requireAppId() {
1334
- const appId = this.http.config?.appId;
1370
+ const appId = this.http.getAppId();
1335
1371
  if (!appId) {
1336
1372
  throw new Error(
1337
1373
  "setValidationSchema/deleteValidationSchema \uB294 \uCF58\uC194 (JWT) \uC778\uC99D\uC774 \uD544\uC694\uD558\uBA70 ConnectBase config \uC5D0 appId \uAC00 \uC124\uC815\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4."
@@ -9084,6 +9120,9 @@ var EndpointAPI = class {
9084
9120
  * predicate 는 같은 Response 를 한 번만 읽을 수 있으므로, 헬퍼 내부에서
9085
9121
  * `res.clone().json()` 형태로 안전하게 파싱한 뒤 호출자에게 전달.
9086
9122
  *
9123
+ * predicate 의 `body` 는 `unknown` 으로 전달되므로, 호출자가 자신의 응답
9124
+ * 스키마로 narrowing 한 뒤 사용한다 (런타임 검증 책임은 호출자에게 있음).
9125
+ *
9087
9126
  * @example ComfyUI 결과 폴링
9088
9127
  * ```typescript
9089
9128
  * type Hist = Record<string, { outputs: Record<string, { images?: { filename: string }[] }> }>
@@ -9091,7 +9130,8 @@ var EndpointAPI = class {
9091
9130
  * const filename = await cb.endpoint.pollUntil<string>(
9092
9131
  * "comfyui-main",
9093
9132
  * { path: `/history/${promptId}` },
9094
- * (data: Hist) => {
9133
+ * (body) => {
9134
+ * const data = body as Hist
9095
9135
  * const entry = data[promptId]
9096
9136
  * if (!entry) return undefined // 아직 큐에 있음
9097
9137
  * for (const out of Object.values(entry.outputs)) {
@@ -9658,13 +9698,14 @@ var AnalyticsAPI = class {
9658
9698
  setMemberId(memberId) {
9659
9699
  this.memberId = memberId || null;
9660
9700
  if (typeof window !== "undefined") {
9701
+ const bridge = window;
9661
9702
  if (memberId) {
9662
- if (typeof window.__cbSetMember === "function") {
9663
- window.__cbSetMember(memberId);
9703
+ if (typeof bridge.__cbSetMember === "function") {
9704
+ bridge.__cbSetMember(memberId);
9664
9705
  }
9665
9706
  } else {
9666
- if (typeof window.__cbClearMember === "function") {
9667
- window.__cbClearMember();
9707
+ if (typeof bridge.__cbClearMember === "function") {
9708
+ bridge.__cbClearMember();
9668
9709
  }
9669
9710
  }
9670
9711
  }
@@ -9929,7 +9970,8 @@ var AnalyticsAPI = class {
9929
9970
  }
9930
9971
  isDNT() {
9931
9972
  if (typeof navigator === "undefined") return false;
9932
- return navigator.doNotTrack === "1" || navigator.globalPrivacyControl === true;
9973
+ const gpc = navigator.globalPrivacyControl;
9974
+ return navigator.doNotTrack === "1" || gpc === true;
9933
9975
  }
9934
9976
  createBaseEvent(type) {
9935
9977
  return {
package/dist/index.mjs CHANGED
@@ -138,7 +138,7 @@ var HttpClient = class {
138
138
  this.refreshLockedUntil = 0;
139
139
  /**
140
140
  * 최근 API 호출 breadcrumb (PII strip 후 저장). platform_issue 발행 시 자동 첨부 가능.
141
- * `client.support.getRecentCalls()` 로 외부 노출.
141
+ * `client.support.getRecentApiCalls()` 로 외부 노출.
142
142
  */
143
143
  this.recentCalls = new RecentCallsBuffer();
144
144
  /**
@@ -334,6 +334,15 @@ var HttpClient = class {
334
334
  getBaseUrl() {
335
335
  return this.config.baseUrl;
336
336
  }
337
+ /**
338
+ * 이 클라이언트에 설정된 앱 ID 반환 (미설정 시 undefined).
339
+ *
340
+ * 콘솔(앱 소유자 JWT) 경로를 호출하기 전에 appId 유무를 확인하기 위한 public 접근자.
341
+ * private `config` 필드를 access-modifier 관통 cast 없이 노출한다.
342
+ */
343
+ getAppId() {
344
+ return this.config.appId;
345
+ }
337
346
  async refreshAccessToken() {
338
347
  if (this.isRefreshing) {
339
348
  return this.refreshPromise;
@@ -797,13 +806,14 @@ var AuthAPI = class {
797
806
  return;
798
807
  }
799
808
  if (typeof window === "undefined") return;
809
+ const bridge = window;
800
810
  if (memberId) {
801
- if (typeof window.__cbSetMember === "function") {
802
- window.__cbSetMember(memberId);
811
+ if (typeof bridge.__cbSetMember === "function") {
812
+ bridge.__cbSetMember(memberId);
803
813
  }
804
814
  } else {
805
- if (typeof window.__cbClearMember === "function") {
806
- window.__cbClearMember();
815
+ if (typeof bridge.__cbClearMember === "function") {
816
+ bridge.__cbClearMember();
807
817
  }
808
818
  }
809
819
  }
@@ -849,6 +859,15 @@ var AuthAPI = class {
849
859
  data,
850
860
  { skipAuth: true }
851
861
  );
862
+ assertShape(
863
+ response,
864
+ {
865
+ access_token: { type: "string" },
866
+ refresh_token: { type: "string" },
867
+ member_id: { type: "string-or-number" }
868
+ },
869
+ "auth.signUpMember"
870
+ );
852
871
  this.http.setTokens(response.access_token, response.refresh_token);
853
872
  this.notifyVisitorTracker(response.member_id);
854
873
  return response;
@@ -1079,6 +1098,14 @@ var AuthAPI = class {
1079
1098
  {},
1080
1099
  { headers: { "Authorization": `Bearer ${storedData.refreshToken}` }, skipAuth: true }
1081
1100
  );
1101
+ assertShape(
1102
+ refreshed,
1103
+ {
1104
+ access_token: { type: "string" },
1105
+ refresh_token: { type: "string" }
1106
+ },
1107
+ "auth.signInAsGuestMember.reissue"
1108
+ );
1082
1109
  this.http.setTokens(refreshed.access_token, refreshed.refresh_token);
1083
1110
  this.storeGuestMemberTokens(refreshed.access_token, refreshed.refresh_token, storedData.memberId);
1084
1111
  this.notifyVisitorTracker(storedData.memberId);
@@ -1099,6 +1126,15 @@ var AuthAPI = class {
1099
1126
  {},
1100
1127
  { skipAuth: true }
1101
1128
  );
1129
+ assertShape(
1130
+ response,
1131
+ {
1132
+ access_token: { type: "string" },
1133
+ refresh_token: { type: "string" },
1134
+ member_id: { type: "string-or-number" }
1135
+ },
1136
+ "auth.signInAsGuestMember.new"
1137
+ );
1102
1138
  this.http.setTokens(response.access_token, response.refresh_token);
1103
1139
  this.storeGuestMemberTokens(response.access_token, response.refresh_token, response.member_id);
1104
1140
  this.notifyVisitorTracker(response.member_id);
@@ -1285,7 +1321,7 @@ var DatabaseAPI = class {
1285
1321
  * appId 가 설정되어 있어야 콘솔 경로를 호출할 수 있습니다 (validation_schema set/delete).
1286
1322
  */
1287
1323
  requireAppId() {
1288
- const appId = this.http.config?.appId;
1324
+ const appId = this.http.getAppId();
1289
1325
  if (!appId) {
1290
1326
  throw new Error(
1291
1327
  "setValidationSchema/deleteValidationSchema \uB294 \uCF58\uC194 (JWT) \uC778\uC99D\uC774 \uD544\uC694\uD558\uBA70 ConnectBase config \uC5D0 appId \uAC00 \uC124\uC815\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4."
@@ -9038,6 +9074,9 @@ var EndpointAPI = class {
9038
9074
  * predicate 는 같은 Response 를 한 번만 읽을 수 있으므로, 헬퍼 내부에서
9039
9075
  * `res.clone().json()` 형태로 안전하게 파싱한 뒤 호출자에게 전달.
9040
9076
  *
9077
+ * predicate 의 `body` 는 `unknown` 으로 전달되므로, 호출자가 자신의 응답
9078
+ * 스키마로 narrowing 한 뒤 사용한다 (런타임 검증 책임은 호출자에게 있음).
9079
+ *
9041
9080
  * @example ComfyUI 결과 폴링
9042
9081
  * ```typescript
9043
9082
  * type Hist = Record<string, { outputs: Record<string, { images?: { filename: string }[] }> }>
@@ -9045,7 +9084,8 @@ var EndpointAPI = class {
9045
9084
  * const filename = await cb.endpoint.pollUntil<string>(
9046
9085
  * "comfyui-main",
9047
9086
  * { path: `/history/${promptId}` },
9048
- * (data: Hist) => {
9087
+ * (body) => {
9088
+ * const data = body as Hist
9049
9089
  * const entry = data[promptId]
9050
9090
  * if (!entry) return undefined // 아직 큐에 있음
9051
9091
  * for (const out of Object.values(entry.outputs)) {
@@ -9612,13 +9652,14 @@ var AnalyticsAPI = class {
9612
9652
  setMemberId(memberId) {
9613
9653
  this.memberId = memberId || null;
9614
9654
  if (typeof window !== "undefined") {
9655
+ const bridge = window;
9615
9656
  if (memberId) {
9616
- if (typeof window.__cbSetMember === "function") {
9617
- window.__cbSetMember(memberId);
9657
+ if (typeof bridge.__cbSetMember === "function") {
9658
+ bridge.__cbSetMember(memberId);
9618
9659
  }
9619
9660
  } else {
9620
- if (typeof window.__cbClearMember === "function") {
9621
- window.__cbClearMember();
9661
+ if (typeof bridge.__cbClearMember === "function") {
9662
+ bridge.__cbClearMember();
9622
9663
  }
9623
9664
  }
9624
9665
  }
@@ -9883,7 +9924,8 @@ var AnalyticsAPI = class {
9883
9924
  }
9884
9925
  isDNT() {
9885
9926
  if (typeof navigator === "undefined") return false;
9886
- return navigator.doNotTrack === "1" || navigator.globalPrivacyControl === true;
9927
+ const gpc = navigator.globalPrivacyControl;
9928
+ return navigator.doNotTrack === "1" || gpc === true;
9887
9929
  }
9888
9930
  createBaseEvent(type) {
9889
9931
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "connectbase-client",
3
- "version": "3.35.0",
3
+ "version": "3.35.2",
4
4
  "description": "Connect Base JavaScript/TypeScript SDK for browser and Node.js",
5
5
  "repository": {
6
6
  "type": "git",