@bstage-sdk/bridge 0.11.0 → 0.12.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- export { B as BRIDGE_ERROR_CODES, a as BRIDGE_SURFACES, b as BridgeError, c as BridgeErrorCode, d as BridgeErrorLike, e as BridgeEventMap, f as BridgeHostEventType, g as BridgeInit, h as BridgeLimits, i as BridgeRequestMap, j as BridgeRequestType, k as BridgeResult, l as BridgeSurface, m as BridgeTranslations, F as FRAME_UNLOAD_EVENT, n as FetchRequest, o as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, p as INIT_RESPONSE, L as LogLevel, M as MemberState, R as READY_EVENT, q as REQUEST_TIMEOUT_MS, r as REQUEST_TYPES, S as SlotState, s as StorageOp, T as ThemeState, t as ToastKind, W as WithSession, u as isBridgeErrorCode, v as isBridgeErrorLike, w as isBridgeSurface, x as isHostEventType, y as isRequestType } from './messages-BjpZyiLy.cjs';
2
- export { C as CreateSrcdocOptions, M as MAX_ELEMENT_NAME_LENGTH, a as MAX_MEDIA_ORIGINS, b as buildFrameCsp, c as createNonce, d as createSession, e as createSrcdoc, i as isValidNonce, f as isValidSession } from './createSrcdoc-DgQyvIjG.cjs';
1
+ export { B as BRIDGE_ERROR_CODES, a as BRIDGE_SURFACES, b as BridgeError, c as BridgeErrorCode, d as BridgeErrorLike, e as BridgeEventMap, f as BridgeHostEventType, g as BridgeInit, h as BridgeLimits, i as BridgeRequestMap, j as BridgeRequestType, k as BridgeResult, l as BridgeSurface, m as BridgeTranslations, F as FRAME_UNLOAD_EVENT, n as FetchRequest, o as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, p as INIT_RESPONSE, L as LogLevel, M as MemberState, R as READY_EVENT, q as REPORTS_PER_SESSION, r as REPORT_COUNT_MAX, s as REPORT_FRAME_MAX_LENGTH, t as REPORT_MAX_FRAMES, u as REPORT_MESSAGE_MAX_LENGTH, v as REQUEST_TIMEOUT_MS, w as REQUEST_TYPES, S as SlotState, x as StorageOp, T as TEMPLATE_REPORT_KINDS, y as TemplateReport, z as TemplateReportKind, A as ThemeState, C as ToastKind, W as WithSession, D as isBridgeErrorCode, E as isBridgeErrorLike, G as isBridgeSurface, J as isHostEventType, K as isRequestType } from './messages-Cdjpvu2S.cjs';
2
+ export { C as CreateSrcdocOptions, M as MAX_ELEMENT_NAME_LENGTH, a as MAX_MEDIA_ORIGINS, R as REPORT_FLUSH_DELAY_MS, b as buildFrameCsp, c as createNonce, d as createSession, e as createSrcdoc, i as isValidNonce, f as isValidSession } from './createSrcdoc-DYZk6dDJ.cjs';
3
3
 
4
4
  /** 봉투 버전. 형식이 하위 호환되지 않게 바뀔 때만 올린다. */
5
5
  declare const BRIDGE_VERSION = 1;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { B as BRIDGE_ERROR_CODES, a as BRIDGE_SURFACES, b as BridgeError, c as BridgeErrorCode, d as BridgeErrorLike, e as BridgeEventMap, f as BridgeHostEventType, g as BridgeInit, h as BridgeLimits, i as BridgeRequestMap, j as BridgeRequestType, k as BridgeResult, l as BridgeSurface, m as BridgeTranslations, F as FRAME_UNLOAD_EVENT, n as FetchRequest, o as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, p as INIT_RESPONSE, L as LogLevel, M as MemberState, R as READY_EVENT, q as REQUEST_TIMEOUT_MS, r as REQUEST_TYPES, S as SlotState, s as StorageOp, T as ThemeState, t as ToastKind, W as WithSession, u as isBridgeErrorCode, v as isBridgeErrorLike, w as isBridgeSurface, x as isHostEventType, y as isRequestType } from './messages-BjpZyiLy.js';
2
- export { C as CreateSrcdocOptions, M as MAX_ELEMENT_NAME_LENGTH, a as MAX_MEDIA_ORIGINS, b as buildFrameCsp, c as createNonce, d as createSession, e as createSrcdoc, i as isValidNonce, f as isValidSession } from './createSrcdoc-DgQyvIjG.js';
1
+ export { B as BRIDGE_ERROR_CODES, a as BRIDGE_SURFACES, b as BridgeError, c as BridgeErrorCode, d as BridgeErrorLike, e as BridgeEventMap, f as BridgeHostEventType, g as BridgeInit, h as BridgeLimits, i as BridgeRequestMap, j as BridgeRequestType, k as BridgeResult, l as BridgeSurface, m as BridgeTranslations, F as FRAME_UNLOAD_EVENT, n as FetchRequest, o as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, p as INIT_RESPONSE, L as LogLevel, M as MemberState, R as READY_EVENT, q as REPORTS_PER_SESSION, r as REPORT_COUNT_MAX, s as REPORT_FRAME_MAX_LENGTH, t as REPORT_MAX_FRAMES, u as REPORT_MESSAGE_MAX_LENGTH, v as REQUEST_TIMEOUT_MS, w as REQUEST_TYPES, S as SlotState, x as StorageOp, T as TEMPLATE_REPORT_KINDS, y as TemplateReport, z as TemplateReportKind, A as ThemeState, C as ToastKind, W as WithSession, D as isBridgeErrorCode, E as isBridgeErrorLike, G as isBridgeSurface, J as isHostEventType, K as isRequestType } from './messages-Cdjpvu2S.js';
2
+ export { C as CreateSrcdocOptions, M as MAX_ELEMENT_NAME_LENGTH, a as MAX_MEDIA_ORIGINS, R as REPORT_FLUSH_DELAY_MS, b as buildFrameCsp, c as createNonce, d as createSession, e as createSrcdoc, i as isValidNonce, f as isValidSession } from './createSrcdoc-DYZk6dDJ.js';
3
3
 
4
4
  /** 봉투 버전. 형식이 하위 호환되지 않게 바뀔 때만 올린다. */
5
5
  declare const BRIDGE_VERSION = 1;
package/dist/index.js CHANGED
@@ -13,8 +13,15 @@ import {
13
13
  MAX_ENVELOPE_TYPE_LENGTH,
14
14
  MAX_MEDIA_ORIGINS,
15
15
  READY_EVENT,
16
+ REPORTS_PER_SESSION,
17
+ REPORT_COUNT_MAX,
18
+ REPORT_FLUSH_DELAY_MS,
19
+ REPORT_FRAME_MAX_LENGTH,
20
+ REPORT_MAX_FRAMES,
21
+ REPORT_MESSAGE_MAX_LENGTH,
16
22
  REQUEST_TIMEOUT_MS,
17
23
  REQUEST_TYPES,
24
+ TEMPLATE_REPORT_KINDS,
18
25
  buildFrameCsp,
19
26
  createEnvelope,
20
27
  createNonce,
@@ -29,8 +36,8 @@ import {
29
36
  isRequestType,
30
37
  isValidNonce,
31
38
  isValidSession
32
- } from "./chunk-ND2HFYBP.js";
33
- import "./chunk-CSAW3L7P.js";
39
+ } from "./chunk-NXB47KPE.js";
40
+ import "./chunk-TPKNGW34.js";
34
41
  export {
35
42
  BRIDGE_ERROR_CODES,
36
43
  BRIDGE_NAMESPACE,
@@ -46,8 +53,15 @@ export {
46
53
  MAX_ENVELOPE_TYPE_LENGTH,
47
54
  MAX_MEDIA_ORIGINS,
48
55
  READY_EVENT,
56
+ REPORTS_PER_SESSION,
57
+ REPORT_COUNT_MAX,
58
+ REPORT_FLUSH_DELAY_MS,
59
+ REPORT_FRAME_MAX_LENGTH,
60
+ REPORT_MAX_FRAMES,
61
+ REPORT_MESSAGE_MAX_LENGTH,
49
62
  REQUEST_TIMEOUT_MS,
50
63
  REQUEST_TYPES,
64
+ TEMPLATE_REPORT_KINDS,
51
65
  buildFrameCsp,
52
66
  createEnvelope,
53
67
  createNonce,
@@ -19,7 +19,7 @@ declare function isBridgeErrorLike(value: unknown): value is BridgeErrorLike;
19
19
  /** 프레임 요청 타임아웃. */
20
20
  declare const REQUEST_TIMEOUT_MS = 15000;
21
21
  /** 프레임 → 호스트 요청 종류(브리지 프로토콜 표). */
22
- declare const REQUEST_TYPES: readonly ["fetch", "navigate", "back", "openExternal", "toast", "resize", "track", "storage", "log"];
22
+ declare const REQUEST_TYPES: readonly ["fetch", "navigate", "back", "openExternal", "toast", "resize", "track", "storage", "log", "report"];
23
23
  type BridgeRequestType = (typeof REQUEST_TYPES)[number];
24
24
  /** 호스트 → 프레임 이벤트 종류. */
25
25
  declare const HOST_EVENT_TYPES: readonly ["slot.context", "locale", "member", "theme", "visibility"];
@@ -101,6 +101,29 @@ interface FetchResult {
101
101
  type ToastKind = 'info' | 'success' | 'warning' | 'error';
102
102
  type LogLevel = 'debug' | 'info' | 'warn' | 'error';
103
103
  type StorageOp = 'get' | 'set' | 'remove';
104
+ /** 템플릿 에러 보고 종류 — 전역 에러, 처리 안 된 Promise 거절, 엔트리 스크립트 로드 실패. */
105
+ declare const TEMPLATE_REPORT_KINDS: readonly ["error", "rejection", "load"];
106
+ type TemplateReportKind = (typeof TEMPLATE_REPORT_KINDS)[number];
107
+ /** report message 최대 길이(자). 프레임 수집기는 이 길이로 잘라 보내고, 호스트는 넘으면 거절한다. */
108
+ declare const REPORT_MESSAGE_MAX_LENGTH = 300;
109
+ /** report frames 최대 개수. */
110
+ declare const REPORT_MAX_FRAMES = 10;
111
+ /** report frame 한 줄 최대 길이(자). */
112
+ declare const REPORT_FRAME_MAX_LENGTH = 200;
113
+ /** report count 상한(같은 fingerprint 누적 횟수). 하한은 1. */
114
+ declare const REPORT_COUNT_MAX = 100;
115
+ /** 프레임 세션당 report 상한. 프레임 수집기와 호스트가 각자 지킨다. */
116
+ declare const REPORTS_PER_SESSION = 5;
117
+ /**
118
+ * `report` payload — 격리 프레임이 잡은 템플릿 에러 하나(같은 fingerprint는 count로 묶는다).
119
+ * URL·placement 같은 귀속 정보는 싣지 않는다 — 호스트가 자기가 띄운 템플릿으로 귀속한다.
120
+ */
121
+ interface TemplateReport {
122
+ readonly kind: TemplateReportKind;
123
+ readonly message: string;
124
+ readonly frames: readonly string[];
125
+ readonly count: number;
126
+ }
104
127
  /** 요청 type별 payload·결과 타입. */
105
128
  interface BridgeRequestMap {
106
129
  fetch: {
@@ -160,6 +183,10 @@ interface BridgeRequestMap {
160
183
  };
161
184
  res: Record<string, never>;
162
185
  };
186
+ report: {
187
+ req: TemplateReport;
188
+ res: Record<string, never>;
189
+ };
163
190
  }
164
191
  /** 이벤트 type별 payload. */
165
192
  interface BridgeEventMap {
@@ -194,4 +221,4 @@ declare const IFRAME_ATTRIBUTES: {
194
221
  declare function isRequestType(value: unknown): value is BridgeRequestType;
195
222
  declare function isHostEventType(value: unknown): value is BridgeHostEventType;
196
223
 
197
- export { BRIDGE_ERROR_CODES as B, FRAME_UNLOAD_EVENT as F, HOST_EVENT_TYPES as H, IFRAME_ATTRIBUTES as I, type LogLevel as L, type MemberState as M, READY_EVENT as R, type SlotState as S, type ThemeState as T, type WithSession as W, BRIDGE_SURFACES as a, BridgeError as b, type BridgeErrorCode as c, type BridgeErrorLike as d, type BridgeEventMap as e, type BridgeHostEventType as f, type BridgeInit as g, type BridgeLimits as h, type BridgeRequestMap as i, type BridgeRequestType as j, type BridgeResult as k, type BridgeSurface as l, type BridgeTranslations as m, type FetchRequest as n, type FetchResult as o, INIT_RESPONSE as p, REQUEST_TIMEOUT_MS as q, REQUEST_TYPES as r, type StorageOp as s, type ToastKind as t, isBridgeErrorCode as u, isBridgeErrorLike as v, isBridgeSurface as w, isHostEventType as x, isRequestType as y };
224
+ export { type ThemeState as A, BRIDGE_ERROR_CODES as B, type ToastKind as C, isBridgeErrorCode as D, isBridgeErrorLike as E, FRAME_UNLOAD_EVENT as F, isBridgeSurface as G, HOST_EVENT_TYPES as H, IFRAME_ATTRIBUTES as I, isHostEventType as J, isRequestType as K, type LogLevel as L, type MemberState as M, READY_EVENT as R, type SlotState as S, TEMPLATE_REPORT_KINDS as T, type WithSession as W, BRIDGE_SURFACES as a, BridgeError as b, type BridgeErrorCode as c, type BridgeErrorLike as d, type BridgeEventMap as e, type BridgeHostEventType as f, type BridgeInit as g, type BridgeLimits as h, type BridgeRequestMap as i, type BridgeRequestType as j, type BridgeResult as k, type BridgeSurface as l, type BridgeTranslations as m, type FetchRequest as n, type FetchResult as o, INIT_RESPONSE as p, REPORTS_PER_SESSION as q, REPORT_COUNT_MAX as r, REPORT_FRAME_MAX_LENGTH as s, REPORT_MAX_FRAMES as t, REPORT_MESSAGE_MAX_LENGTH as u, REQUEST_TIMEOUT_MS as v, REQUEST_TYPES as w, type StorageOp as x, type TemplateReport as y, type TemplateReportKind as z };
@@ -19,7 +19,7 @@ declare function isBridgeErrorLike(value: unknown): value is BridgeErrorLike;
19
19
  /** 프레임 요청 타임아웃. */
20
20
  declare const REQUEST_TIMEOUT_MS = 15000;
21
21
  /** 프레임 → 호스트 요청 종류(브리지 프로토콜 표). */
22
- declare const REQUEST_TYPES: readonly ["fetch", "navigate", "back", "openExternal", "toast", "resize", "track", "storage", "log"];
22
+ declare const REQUEST_TYPES: readonly ["fetch", "navigate", "back", "openExternal", "toast", "resize", "track", "storage", "log", "report"];
23
23
  type BridgeRequestType = (typeof REQUEST_TYPES)[number];
24
24
  /** 호스트 → 프레임 이벤트 종류. */
25
25
  declare const HOST_EVENT_TYPES: readonly ["slot.context", "locale", "member", "theme", "visibility"];
@@ -101,6 +101,29 @@ interface FetchResult {
101
101
  type ToastKind = 'info' | 'success' | 'warning' | 'error';
102
102
  type LogLevel = 'debug' | 'info' | 'warn' | 'error';
103
103
  type StorageOp = 'get' | 'set' | 'remove';
104
+ /** 템플릿 에러 보고 종류 — 전역 에러, 처리 안 된 Promise 거절, 엔트리 스크립트 로드 실패. */
105
+ declare const TEMPLATE_REPORT_KINDS: readonly ["error", "rejection", "load"];
106
+ type TemplateReportKind = (typeof TEMPLATE_REPORT_KINDS)[number];
107
+ /** report message 최대 길이(자). 프레임 수집기는 이 길이로 잘라 보내고, 호스트는 넘으면 거절한다. */
108
+ declare const REPORT_MESSAGE_MAX_LENGTH = 300;
109
+ /** report frames 최대 개수. */
110
+ declare const REPORT_MAX_FRAMES = 10;
111
+ /** report frame 한 줄 최대 길이(자). */
112
+ declare const REPORT_FRAME_MAX_LENGTH = 200;
113
+ /** report count 상한(같은 fingerprint 누적 횟수). 하한은 1. */
114
+ declare const REPORT_COUNT_MAX = 100;
115
+ /** 프레임 세션당 report 상한. 프레임 수집기와 호스트가 각자 지킨다. */
116
+ declare const REPORTS_PER_SESSION = 5;
117
+ /**
118
+ * `report` payload — 격리 프레임이 잡은 템플릿 에러 하나(같은 fingerprint는 count로 묶는다).
119
+ * URL·placement 같은 귀속 정보는 싣지 않는다 — 호스트가 자기가 띄운 템플릿으로 귀속한다.
120
+ */
121
+ interface TemplateReport {
122
+ readonly kind: TemplateReportKind;
123
+ readonly message: string;
124
+ readonly frames: readonly string[];
125
+ readonly count: number;
126
+ }
104
127
  /** 요청 type별 payload·결과 타입. */
105
128
  interface BridgeRequestMap {
106
129
  fetch: {
@@ -160,6 +183,10 @@ interface BridgeRequestMap {
160
183
  };
161
184
  res: Record<string, never>;
162
185
  };
186
+ report: {
187
+ req: TemplateReport;
188
+ res: Record<string, never>;
189
+ };
163
190
  }
164
191
  /** 이벤트 type별 payload. */
165
192
  interface BridgeEventMap {
@@ -194,4 +221,4 @@ declare const IFRAME_ATTRIBUTES: {
194
221
  declare function isRequestType(value: unknown): value is BridgeRequestType;
195
222
  declare function isHostEventType(value: unknown): value is BridgeHostEventType;
196
223
 
197
- export { BRIDGE_ERROR_CODES as B, FRAME_UNLOAD_EVENT as F, HOST_EVENT_TYPES as H, IFRAME_ATTRIBUTES as I, type LogLevel as L, type MemberState as M, READY_EVENT as R, type SlotState as S, type ThemeState as T, type WithSession as W, BRIDGE_SURFACES as a, BridgeError as b, type BridgeErrorCode as c, type BridgeErrorLike as d, type BridgeEventMap as e, type BridgeHostEventType as f, type BridgeInit as g, type BridgeLimits as h, type BridgeRequestMap as i, type BridgeRequestType as j, type BridgeResult as k, type BridgeSurface as l, type BridgeTranslations as m, type FetchRequest as n, type FetchResult as o, INIT_RESPONSE as p, REQUEST_TIMEOUT_MS as q, REQUEST_TYPES as r, type StorageOp as s, type ToastKind as t, isBridgeErrorCode as u, isBridgeErrorLike as v, isBridgeSurface as w, isHostEventType as x, isRequestType as y };
224
+ export { type ThemeState as A, BRIDGE_ERROR_CODES as B, type ToastKind as C, isBridgeErrorCode as D, isBridgeErrorLike as E, FRAME_UNLOAD_EVENT as F, isBridgeSurface as G, HOST_EVENT_TYPES as H, IFRAME_ATTRIBUTES as I, isHostEventType as J, isRequestType as K, type LogLevel as L, type MemberState as M, READY_EVENT as R, type SlotState as S, TEMPLATE_REPORT_KINDS as T, type WithSession as W, BRIDGE_SURFACES as a, BridgeError as b, type BridgeErrorCode as c, type BridgeErrorLike as d, type BridgeEventMap as e, type BridgeHostEventType as f, type BridgeInit as g, type BridgeLimits as h, type BridgeRequestMap as i, type BridgeRequestType as j, type BridgeResult as k, type BridgeSurface as l, type BridgeTranslations as m, type FetchRequest as n, type FetchResult as o, INIT_RESPONSE as p, REPORTS_PER_SESSION as q, REPORT_COUNT_MAX as r, REPORT_FRAME_MAX_LENGTH as s, REPORT_MAX_FRAMES as t, REPORT_MESSAGE_MAX_LENGTH as u, REQUEST_TIMEOUT_MS as v, REQUEST_TYPES as w, type StorageOp as x, type TemplateReport as y, type TemplateReportKind as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bstage-sdk/bridge",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "bstage SDK bridge — isolated template iframe protocol, host policy and frame client",
5
5
  "type": "module",
6
6
  "publishConfig": {