@unotest/viewer 0.31.0 → 0.33.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.
@@ -1,3 +1,5 @@
1
+ import { BoxReadEnvironment } from '@unotest/protocol';
2
+
1
3
  /** What the current viewer session is allowed to do, as told by whoever
2
4
  * fronts the viewer (today: the unotest guard proxy).
3
5
  *
@@ -10,7 +12,13 @@
10
12
  *
11
13
  * Capabilities are coarse and role-free on purpose. A proxy that invents
12
14
  * new roles maps them onto these flags; the viewer never learns the word
13
- * "admin" and needs no change when the role set grows (OCP). */
15
+ * "admin" and needs no change when the role set grows (OCP).
16
+ *
17
+ * One more use, and the only one that touches data: a caller who may not
18
+ * edit variables is not shown credential-shaped values or the project's
19
+ * absolute path ({@link CREDENTIAL_NAME}). That is display-masking by
20
+ * capability, not authorization — the proxy still refuses every write,
21
+ * and a forged header can only hide more. */
14
22
  interface ViewerCapabilities {
15
23
  /** Start / abort runs, drive the debugger, control the app-under-test. */
16
24
  readonly canRun: boolean;
@@ -44,17 +52,12 @@ interface ViewerIdentity {
44
52
  /** One place the fronting proxy can route a session to. Display only,
45
53
  * like {@link ViewerIdentity}: the viewer groups by `project`, shows
46
54
  * `environment` and `note`, and sends `name` back — never derives one
47
- * from another. */
48
- interface ViewerEnvOption {
49
- /** What {@link ViewerIdentity.switchEnvUrl} accepts. */
50
- readonly name: string;
51
- /** Grouping axis. Absent when the proxy has no such notion — the
52
- * switcher then offers environments alone. */
53
- readonly project?: string;
54
- readonly environment: string;
55
- /** What that environment is serving right now (a bundle label). */
56
- readonly note?: string;
57
- }
55
+ * from another.
56
+ *
57
+ * The same list the guard serves to a bearer client asking which
58
+ * environments it may read, so the shape lives in the protocol and this
59
+ * is the viewer's name for it — one definition, not two that drift. */
60
+ type ViewerEnvOption = BoxReadEnvironment;
58
61
  interface ViewerSession {
59
62
  readonly capabilities: ViewerCapabilities;
60
63
  /** null when nothing fronts the viewer — plain localhost usage. */
@@ -77,5 +80,8 @@ declare function encodeViewerSession(session: ViewerSession): string;
77
80
  * truncated, forged. The caller then falls back to standalone defaults:
78
81
  * a broken header must not lock a local user out of their own viewer. */
79
82
  declare function decodeViewerSession(raw: string | undefined): ViewerSession | null;
83
+ /** What the caller of this request may do: the proxy's word when it
84
+ * stamped one, everything when nothing fronts the viewer. */
85
+ declare function capabilitiesOf(raw: string | undefined): ViewerCapabilities;
80
86
 
81
- export { FULL_CAPABILITIES, STANDALONE_SESSION, VIEWER_SESSION_HEADER, type ViewerCapabilities, type ViewerEnvOption, type ViewerIdentity, type ViewerSession, decodeViewerSession, encodeViewerSession };
87
+ export { FULL_CAPABILITIES, STANDALONE_SESSION, VIEWER_SESSION_HEADER, type ViewerCapabilities, type ViewerEnvOption, type ViewerIdentity, type ViewerSession, capabilitiesOf, decodeViewerSession, encodeViewerSession };
@@ -1 +1 @@
1
- const _0x3774c0=_0x7b19;(function(_0x18fa57,_0x4b73ef){const _0xb2ca0d={_0x481643:0x1c8,_0x333cca:0x1b8,_0x247929:0x1b4},_0x5668c6=_0x7b19,_0x22c1e0=_0x18fa57();while(!![]){try{const _0x3dcff0=-parseInt(_0x5668c6(_0xb2ca0d._0x481643))/0x1+parseInt(_0x5668c6(0x1cb))/0x2*(-parseInt(_0x5668c6(_0xb2ca0d._0x333cca))/0x3)+parseInt(_0x5668c6(0x1cc))/0x4*(parseInt(_0x5668c6(0x1c7))/0x5)+parseInt(_0x5668c6(0x1bb))/0x6+parseInt(_0x5668c6(_0xb2ca0d._0x247929))/0x7+parseInt(_0x5668c6(0x1c4))/0x8+parseInt(_0x5668c6(0x1b3))/0x9;if(_0x3dcff0===_0x4b73ef)break;else _0x22c1e0['push'](_0x22c1e0['shift']());}catch(_0x434f65){_0x22c1e0['push'](_0x22c1e0['shift']());}}}(_0x1112,0xd8502));var __defProp=Object['defineProperty'],__name=(_0x2c6b5f,_0x26a9dd)=>__defProp(_0x2c6b5f,_0x3774c0(0x1b9),{'value':_0x26a9dd,'configurable':!![]}),FULL_CAPABILITIES={'canRun':!![],'canEditFiles':!![],'canTerminal':!![],'canBrowseFs':!![]},STANDALONE_SESSION={'capabilities':FULL_CAPABILITIES,'identity':null},VIEWER_SESSION_HEADER=_0x3774c0(0x1b5);function encodeViewerSession(_0x1ae3b5){const _0x549b9d={_0x2c4e78:0x1ba},_0x4cae5e=_0x3774c0;return Buffer[_0x4cae5e(0x1cd)](JSON['stringify'](_0x1ae3b5),_0x4cae5e(_0x549b9d._0x2c4e78))[_0x4cae5e(0x1b7)](_0x4cae5e(0x1c2));}__name(encodeViewerSession,_0x3774c0(0x1b6));function _0x7b19(_0x438b05,_0x35a66d){_0x438b05=_0x438b05-0x1b3;const _0x1112b8=_0x1112();let _0x7b191a=_0x1112b8[_0x438b05];if(_0x7b19['xMEVTj']===undefined){var _0x9160b6=function(_0x34f9ac){const _0x3681b6='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2c6b5f='',_0x26a9dd='';for(let _0x1ae3b5=0x0,_0x19e7ae,_0x31c9d1,_0x42742a=0x0;_0x31c9d1=_0x34f9ac['charAt'](_0x42742a++);~_0x31c9d1&&(_0x19e7ae=_0x1ae3b5%0x4?_0x19e7ae*0x40+_0x31c9d1:_0x31c9d1,_0x1ae3b5++%0x4)?_0x2c6b5f+=String['fromCharCode'](0xff&_0x19e7ae>>(-0x2*_0x1ae3b5&0x6)):0x0){_0x31c9d1=_0x3681b6['indexOf'](_0x31c9d1);}for(let _0x39b795=0x0,_0x1cc533=_0x2c6b5f['length'];_0x39b795<_0x1cc533;_0x39b795++){_0x26a9dd+='%'+('00'+_0x2c6b5f['charCodeAt'](_0x39b795)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x26a9dd);};_0x7b19['AVNFXm']=_0x9160b6,_0x7b19['EaYFnl']={},_0x7b19['xMEVTj']=!![];}const _0x43733f=_0x1112b8[0x0],_0x2556c1=_0x438b05+_0x43733f,_0x1b2e9c=_0x7b19['EaYFnl'][_0x2556c1];return!_0x1b2e9c?(_0x7b191a=_0x7b19['AVNFXm'](_0x7b191a),_0x7b19['EaYFnl'][_0x2556c1]=_0x7b191a):_0x7b191a=_0x1b2e9c,_0x7b191a;}function decodeViewerSession(_0x19e7ae){const _0x3dd5b3={_0x5599ca:0x1be,_0x6c288b:0x1cd,_0x38443e:0x1c2,_0x71ba03:0x1ba},_0x50cd09=_0x3774c0;if(_0x19e7ae===void 0x0||_0x19e7ae==='')return null;let _0x31c9d1;try{_0x31c9d1=JSON[_0x50cd09(_0x3dd5b3._0x5599ca)](Buffer[_0x50cd09(_0x3dd5b3._0x6c288b)](_0x19e7ae,_0x50cd09(_0x3dd5b3._0x38443e))['toString'](_0x50cd09(_0x3dd5b3._0x71ba03)));}catch{return null;}if(typeof _0x31c9d1!==_0x50cd09(0x1cf)||_0x31c9d1===null)return null;const {capabilities:_0x42742a,identity:_0x39b795}=_0x31c9d1,_0x1cc533=readCapabilities(_0x42742a);if(_0x1cc533===null)return null;return{'capabilities':_0x1cc533,'identity':readIdentity(_0x39b795)};}__name(decodeViewerSession,_0x3774c0(0x1c6));function _0x1112(){const _0x4a8066=['Bg9NB3v0vxjS','C3rYAw5N','CMvHzeLKzw50Axr5','yMfZzty0DxjS','y2fUrwrPDezPBgvZ','nZiZnZmYoeHjugT3tG','y2fUvgvYBwLUywW','zgvJB2rLvMLLD2vYu2vZC2LVBG','mte0nwvKDgfVqG','mty0nJC4nvzivNfyva','C3DPDgnOrw52vxjS','zMXHzW','ntu1nJy2rLb1vK1L','mtqZmJHJy0H2qvC','zNjVBq','CMvHzenHCgfIAwXPDgLLCW','B2jQzwn0','mtm3otyYmJzntxbnEM0','mtu3nde2vxbPt05K','Ec11BM90zxn0lxzPzxDLCI1ZzxnZAw9U','zw5JB2rLvMLLD2vYu2vZC2LVBG','Dg9tDhjPBMC','ouHKDhLHtW','BMfTzq','DxrMoa','nte1nZm2Avr0re5z','zw52AxjVBM1LBNrZvxjS','zw52','CgfYC2u'];_0x1112=function(){return _0x4a8066;};return _0x1112();}function readCapabilities(_0x4349eb){const _0x3b301f={_0x1eb1a4:0x1c5},_0xe4c485=_0x3774c0;if(typeof _0x4349eb!==_0xe4c485(0x1cf)||_0x4349eb===null)return null;const _0xdb540f=_0x4349eb,_0x585dad=__name(_0x2c4ce8=>_0xdb540f[_0x2c4ce8]===!![],_0xe4c485(0x1ca));return{'canRun':_0x585dad('canRun'),'canEditFiles':_0x585dad(_0xe4c485(0x1c3)),'canTerminal':_0x585dad(_0xe4c485(_0x3b301f._0x1eb1a4)),'canBrowseFs':_0x585dad('canBrowseFs')};}__name(readCapabilities,_0x3774c0(0x1ce));function readIdentity(_0x54dac5){const _0x17d954={_0x472f89:0x1cf,_0x3a491b:0x1bd,_0x6243c5:0x1bf},_0x5b1dbf=_0x3774c0;if(typeof _0x54dac5!==_0x5b1dbf(_0x17d954._0x472f89)||_0x54dac5===null)return null;const _0x4085ad=_0x54dac5,{user:_0x29ef6e,role:_0xefccc9}=_0x4085ad;if(typeof _0x29ef6e!=='string'||typeof _0xefccc9!=='string')return null;return{'user':_0x29ef6e,'role':_0xefccc9,...optionalString(_0x4085ad,_0x5b1dbf(_0x17d954._0x3a491b)),...optionalString(_0x4085ad,_0x5b1dbf(_0x17d954._0x6243c5)),...optionalString(_0x4085ad,_0x5b1dbf(0x1bc)),...optionalString(_0x4085ad,_0x5b1dbf(0x1c9))};}__name(readIdentity,_0x3774c0(0x1c1));function optionalString(_0x426af5,_0x7d49d0){const _0x584b4b=_0x3774c0,_0x2a1122=_0x426af5[_0x7d49d0];return typeof _0x2a1122===_0x584b4b(0x1c0)?{[_0x7d49d0]:_0x2a1122}:{};}__name(optionalString,'optionalString');export{FULL_CAPABILITIES,STANDALONE_SESSION,VIEWER_SESSION_HEADER,decodeViewerSession,encodeViewerSession};
1
+ const _0x23116c=_0x5ebd;function _0x5ebd(_0x15ac29,_0xa8b31c){_0x15ac29=_0x15ac29-0x198;const _0x576d3a=_0x576d();let _0x5ebdfc=_0x576d3a[_0x15ac29];if(_0x5ebd['fxrOoM']===undefined){var _0x42bf16=function(_0x46c169){const _0x831250='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5d1e5a='',_0x38ce73='';for(let _0x404ac3=0x0,_0x1be4bf,_0x253ac2,_0x23258b=0x0;_0x253ac2=_0x46c169['charAt'](_0x23258b++);~_0x253ac2&&(_0x1be4bf=_0x404ac3%0x4?_0x1be4bf*0x40+_0x253ac2:_0x253ac2,_0x404ac3++%0x4)?_0x5d1e5a+=String['fromCharCode'](0xff&_0x1be4bf>>(-0x2*_0x404ac3&0x6)):0x0){_0x253ac2=_0x831250['indexOf'](_0x253ac2);}for(let _0x3cb501=0x0,_0xef5a7c=_0x5d1e5a['length'];_0x3cb501<_0xef5a7c;_0x3cb501++){_0x38ce73+='%'+('00'+_0x5d1e5a['charCodeAt'](_0x3cb501)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x38ce73);};_0x5ebd['IMCVDP']=_0x42bf16,_0x5ebd['zsaXft']={},_0x5ebd['fxrOoM']=!![];}const _0x3375ca=_0x576d3a[0x0],_0x328b1f=_0x15ac29+_0x3375ca,_0x370a05=_0x5ebd['zsaXft'][_0x328b1f];return!_0x370a05?(_0x5ebdfc=_0x5ebd['IMCVDP'](_0x5ebdfc),_0x5ebd['zsaXft'][_0x328b1f]=_0x5ebdfc):_0x5ebdfc=_0x370a05,_0x5ebdfc;}(function(_0x2629d7,_0x8adc1){const _0x4c3c5b={_0x592259:0x1ae,_0x5d347a:0x1b6,_0x4445c7:0x1b7,_0x2e42ca:0x1a4},_0x3ca6ae=_0x5ebd,_0x3ca564=_0x2629d7();while(!![]){try{const _0x3e8d10=-parseInt(_0x3ca6ae(0x1b1))/0x1+-parseInt(_0x3ca6ae(0x1b5))/0x2+-parseInt(_0x3ca6ae(_0x4c3c5b._0x592259))/0x3*(-parseInt(_0x3ca6ae(0x19e))/0x4)+parseInt(_0x3ca6ae(0x19d))/0x5+-parseInt(_0x3ca6ae(0x1a3))/0x6*(-parseInt(_0x3ca6ae(_0x4c3c5b._0x5d347a))/0x7)+-parseInt(_0x3ca6ae(_0x4c3c5b._0x4445c7))/0x8*(-parseInt(_0x3ca6ae(0x19f))/0x9)+-parseInt(_0x3ca6ae(_0x4c3c5b._0x2e42ca))/0xa*(-parseInt(_0x3ca6ae(0x1af))/0xb);if(_0x3e8d10===_0x8adc1)break;else _0x3ca564['push'](_0x3ca564['shift']());}catch(_0x29d2dd){_0x3ca564['push'](_0x3ca564['shift']());}}}(_0x576d,0x9fb6c));var __defProp=Object[_0x23116c(0x1b3)],__name=(_0x5d1e5a,_0x38ce73)=>__defProp(_0x5d1e5a,_0x23116c(0x1b4),{'value':_0x38ce73,'configurable':!![]}),FULL_CAPABILITIES={'canRun':!![],'canEditFiles':!![],'canTerminal':!![],'canBrowseFs':!![]},STANDALONE_SESSION={'capabilities':FULL_CAPABILITIES,'identity':null},VIEWER_SESSION_HEADER=_0x23116c(0x1aa);function encodeViewerSession(_0x404ac3){const _0x3d44b5={_0x2d6f5e:0x1a5,_0x482d50:0x199,_0x22a492:0x19a},_0x457bcd=_0x23116c;return Buffer[_0x457bcd(_0x3d44b5._0x2d6f5e)](JSON[_0x457bcd(_0x3d44b5._0x482d50)](_0x404ac3),'utf8')[_0x457bcd(_0x3d44b5._0x22a492)]('base64url');}__name(encodeViewerSession,_0x23116c(0x1a7));function decodeViewerSession(_0x1be4bf){const _0x4d26f1={_0x411d87:0x1a5,_0x31713b:0x198,_0x179946:0x19a,_0x45cfd9:0x1a1},_0x2a9368=_0x23116c;if(_0x1be4bf===void 0x0||_0x1be4bf==='')return null;let _0x253ac2;try{_0x253ac2=JSON['parse'](Buffer[_0x2a9368(_0x4d26f1._0x411d87)](_0x1be4bf,_0x2a9368(_0x4d26f1._0x31713b))[_0x2a9368(_0x4d26f1._0x179946)](_0x2a9368(0x19c)));}catch{return null;}if(typeof _0x253ac2!==_0x2a9368(_0x4d26f1._0x45cfd9)||_0x253ac2===null)return null;const {capabilities:_0x23258b,identity:_0x3cb501}=_0x253ac2,_0xef5a7c=readCapabilities(_0x23258b);if(_0xef5a7c===null)return null;return{'capabilities':_0xef5a7c,'identity':readIdentity(_0x3cb501)};}__name(decodeViewerSession,_0x23116c(0x1a8));function readCapabilities(_0x1ef77d){const _0x592b76={_0xd23d2d:0x1ab,_0x518fda:0x1a9},_0x1b6ddf=_0x23116c;if(typeof _0x1ef77d!==_0x1b6ddf(0x1a1)||_0x1ef77d===null)return null;const _0xe9397a=_0x1ef77d,_0x3306d2=__name(_0x45a05b=>_0xe9397a[_0x45a05b]===!![],_0x1b6ddf(_0x592b76._0xd23d2d));return{'canRun':_0x3306d2('canRun'),'canEditFiles':_0x3306d2(_0x1b6ddf(0x1a0)),'canTerminal':_0x3306d2(_0x1b6ddf(_0x592b76._0x518fda)),'canBrowseFs':_0x3306d2(_0x1b6ddf(0x1a2))};}__name(readCapabilities,_0x23116c(0x19b));function readIdentity(_0x321f08){const _0x1605f6={_0x59d1a9:0x1b2,_0x5e2071:0x1ac,_0x5aecc9:0x1b0},_0x1eda63=_0x23116c;if(typeof _0x321f08!=='object'||_0x321f08===null)return null;const _0x4f2396=_0x321f08,{user:_0x3ccc93,role:_0x4471db}=_0x4f2396;if(typeof _0x3ccc93!==_0x1eda63(_0x1605f6._0x59d1a9)||typeof _0x4471db!==_0x1eda63(0x1b2))return null;return{'user':_0x3ccc93,'role':_0x4471db,...optionalString(_0x4f2396,_0x1eda63(_0x1605f6._0x5e2071)),...optionalString(_0x4f2396,'logoutUrl'),...optionalString(_0x4f2396,'environmentsUrl'),...optionalString(_0x4f2396,_0x1eda63(_0x1605f6._0x5aecc9))};}__name(readIdentity,_0x23116c(0x1ad));function optionalString(_0x499533,_0x4b3284){const _0x9985b7=_0x23116c,_0x177d7e=_0x499533[_0x4b3284];return typeof _0x177d7e===_0x9985b7(0x1b2)?{[_0x4b3284]:_0x177d7e}:{};}__name(optionalString,_0x23116c(0x1a6));function capabilitiesOf(_0x4d16d1){return decodeViewerSession(_0x4d16d1)?.['capabilities']??FULL_CAPABILITIES;}__name(capabilitiesOf,'capabilitiesOf');function _0x576d(){const _0x2e7165=['DxrMoa','mtGWmZu1mhPuExvKsW','mtjSsuPXDMi','nJG0ouzdDfDiua','y2fUrwrPDezPBgvZ','B2jQzwn0','y2fUqNjVD3nLrNm','mJKYmJe4zNnXy1nv','mti0nJm0mZbrv2rLq3y','zNjVBq','B3b0Aw9UywXtDhjPBMC','zw5JB2rLvMLLD2vYu2vZC2LVBG','zgvJB2rLvMLLD2vYu2vZC2LVBG','y2fUvgvYBwLUywW','Ec11BM90zxn0lxzPzxDLCI1ZzxnZAw9U','zMXHzW','zw52','CMvHzeLKzw50Axr5','odu2ndC5swDhsgDx','mtfXAvDjAwK','C3DPDgnOrw52vxjS','mte3ndqZm3H6uhPssG','C3rYAw5N','zgvMAw5LuhjVCgvYDhK','BMfTzq','mJiZnJi4ofruyvjtvW','mtr1vMHjBhy','nda1nKXXC2PbEG','yMfZzty0DxjS','C3rYAw5NAwz5','Dg9tDhjPBMC','CMvHzenHCgfIAwXPDgLLCW'];_0x576d=function(){return _0x2e7165;};return _0x576d();}export{FULL_CAPABILITIES,STANDALONE_SESSION,VIEWER_SESSION_HEADER,capabilitiesOf,decodeViewerSession,encodeViewerSession};
@@ -0,0 +1,8 @@
1
+ /** Raised for a file that is not a readable archive at all. */
2
+ declare class SnapshotZipError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ /** Every entry in the archive: zip path → bytes. */
6
+ declare function readSnapshotEntries(bytes: Uint8Array): Record<string, Uint8Array>;
7
+
8
+ export { SnapshotZipError, readSnapshotEntries };
@@ -0,0 +1 @@
1
+ var _0x125c44=_0x428d;(function(_0x2a938a,_0x480de2){var _0x4e14a5={_0x29c0bf:0x1aa,_0x25dcf6:0x1a4,_0x39da12:0x1ae,_0x5b8bde:0x1b1,_0x54529c:0x1a8},_0x44bb23=_0x428d,_0x4e5d79=_0x2a938a();while(!![]){try{var _0x2cc890=-parseInt(_0x44bb23(_0x4e14a5._0x29c0bf))/0x1+parseInt(_0x44bb23(0x1ad))/0x2+parseInt(_0x44bb23(_0x4e14a5._0x25dcf6))/0x3*(parseInt(_0x44bb23(_0x4e14a5._0x39da12))/0x4)+-parseInt(_0x44bb23(_0x4e14a5._0x5b8bde))/0x5*(-parseInt(_0x44bb23(0x1a9))/0x6)+-parseInt(_0x44bb23(0x1b0))/0x7*(parseInt(_0x44bb23(0x1a5))/0x8)+-parseInt(_0x44bb23(0x1a7))/0x9*(-parseInt(_0x44bb23(_0x4e14a5._0x54529c))/0xa)+-parseInt(_0x44bb23(0x1af))/0xb;if(_0x2cc890===_0x480de2)break;else _0x4e5d79['push'](_0x4e5d79['shift']());}catch(_0x2dbf7d){_0x4e5d79['push'](_0x4e5d79['shift']());}}}(_0x5308,0x6160b));var __defProp=Object[_0x125c44(0x1a6)],__name=(_0x238bb,_0xc5b364)=>__defProp(_0x238bb,_0x125c44(0x1b2),{'value':_0xc5b364,'configurable':!![]});import{unzipSync}from'fflate';var SnapshotZipError=class extends Error{static{__name(this,_0x125c44(0x1ac));}constructor(_0x5dca6b){var _0x1dfcf0={_0x12c417:0x1b2},_0x4843ec=_0x125c44;super(_0x5dca6b),this[_0x4843ec(_0x1dfcf0._0x12c417)]=_0x4843ec(0x1ac);}};function readSnapshotEntries(_0x5228dd){var _0x25507c={_0x1cd85f:0x1ab},_0x4d55a0=_0x125c44;try{return unzipSync(_0x5228dd);}catch{throw new SnapshotZipError(_0x4d55a0(_0x25507c._0x1cd85f));}}__name(readSnapshotEntries,'readSnapshotEntries');function _0x428d(_0x4284d7,_0x2aebed){_0x4284d7=_0x4284d7-0x1a4;var _0x5308e0=_0x5308();var _0x428dd0=_0x5308e0[_0x4284d7];if(_0x428d['EmSyFq']===undefined){var _0x322a05=function(_0x49aa21){var _0x112f9a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x238bb='',_0xc5b364='';for(var _0x5dca6b=0x0,_0x5228dd,_0x1facb3,_0x1f009e=0x0;_0x1facb3=_0x49aa21['charAt'](_0x1f009e++);~_0x1facb3&&(_0x5228dd=_0x5dca6b%0x4?_0x5228dd*0x40+_0x1facb3:_0x1facb3,_0x5dca6b++%0x4)?_0x238bb+=String['fromCharCode'](0xff&_0x5228dd>>(-0x2*_0x5dca6b&0x6)):0x0){_0x1facb3=_0x112f9a['indexOf'](_0x1facb3);}for(var _0x41017b=0x0,_0x4e8370=_0x238bb['length'];_0x41017b<_0x4e8370;_0x41017b++){_0xc5b364+='%'+('00'+_0x238bb['charCodeAt'](_0x41017b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xc5b364);};_0x428d['GmsxAH']=_0x322a05,_0x428d['sbfxus']={},_0x428d['EmSyFq']=!![];}var _0x2ca569=_0x5308e0[0x0],_0x44a978=_0x4284d7+_0x2ca569,_0xc54081=_0x428d['sbfxus'][_0x44a978];return!_0xc54081?(_0x428dd0=_0x428d['GmsxAH'](_0x428dd0),_0x428d['sbfxus'][_0x44a978]=_0x428dd0):_0x428dd0=_0xc54081,_0x428dd0;}function _0x5308(){var _0x369027=['ntC5ndC0wg5PCMHY','mJa2mJKZnLLzqwPVwG','mZe3nZCYnffIv0vNuq','mJGYmdy4nvjuquL0vW','mtu0ntvnuwjZAeG','BMfTzq','m2LRCeTdqG','ohbnA3vetq','zgvMAw5LuhjVCgvYDhK','ow5qrLHeza','mZi5ndG2mg9TBxz6uW','ndu2DgnXrurQ','mJC5mtC1rMfwA3bK','BM90igeGDMfSAwqGlNPPCcaOy29YCNvWDgvKig9YihDYB25NigzPBguP','u25HChnOB3rAAxbfCNjVCG'];_0x5308=function(){return _0x369027;};return _0x5308();}export{SnapshotZipError,readSnapshotEntries};
@@ -0,0 +1,141 @@
1
+ import { RunMeta, CollectionRunArtifact, RunArtifact, RunSources, QueueSnapshot } from '@unotest/protocol';
2
+
3
+ /** Full snapshot of one run-dir. The event stream is discriminated so the
4
+ * consumer can render per-kind UI without sniffing array contents —
5
+ * `meta.kind` and the union match. Scenario and collection events never
6
+ * mix in a single dir. */
7
+ type RunFullSnapshot = ScenarioRunFullSnapshot | CollectionRunFullSnapshot;
8
+ interface ScenarioRunFullSnapshot {
9
+ meta: RunMeta & {
10
+ kind: "scenario";
11
+ };
12
+ events: RunArtifact[];
13
+ /** Snapshot of the executed sources (entry + helpers) captured at run
14
+ * start. The view renders the overlay against this, never re-reading
15
+ * the on-disk file. `null` for old runs predating the snapshot. */
16
+ sources: RunSources | null;
17
+ }
18
+ interface CollectionRunFullSnapshot {
19
+ meta: RunMeta & {
20
+ kind: "collection";
21
+ };
22
+ events: CollectionRunArtifact[];
23
+ }
24
+
25
+ /** Wire shape of `GET /api/runs`. Lives in `shared/` because it is a
26
+ * contract, not an implementation detail: the controller returns it and
27
+ * the browser store consumes it, and the two drifting apart is exactly
28
+ * the failure this file prevents.
29
+ *
30
+ * History is paged. It used to be "every run there has ever been" in one
31
+ * response, which is the wall the whole runs-history work exists to
32
+ * remove — see `docs/plans/runs-history-scale.md`. */
33
+
34
+ interface RunPage {
35
+ /** Newest first. */
36
+ runs: RunMeta[];
37
+ /** The walk reached the end of retained history, not merely the end of
38
+ * this page. The UI needs the difference to decide whether offering
39
+ * "load more" would be a lie. */
40
+ exhausted: boolean;
41
+ }
42
+ interface RunsListResponse extends RunPage {
43
+ /** False while the background index rebuild is still catching up. The
44
+ * UI says "history is still loading" instead of showing an empty list
45
+ * that looks like "you have no runs". */
46
+ indexReady: boolean;
47
+ }
48
+ interface RunsQuery {
49
+ limit?: number;
50
+ /** Runs started strictly before this timestamp. A cursor rather than an
51
+ * offset: a run finishing mid-scroll cannot shift the page under the
52
+ * reader. */
53
+ before?: number;
54
+ /** Restrict to one scenario, served from that scenario's own index. */
55
+ scenario?: string;
56
+ }
57
+
58
+ interface QueuePayload extends QueueSnapshot {
59
+ /** False when the project turned queueing off (`queue.enabled: false`
60
+ * or `UNOTEST_NO_QUEUE=1`). The UI says so rather than showing an
61
+ * empty queue that will never fill — with queueing off, every
62
+ * producer starts immediately and nothing serialises them. */
63
+ enabled: boolean;
64
+ }
65
+
66
+ /** Bump when the manifest shape changes incompatibly. The importer refuses an
67
+ * unknown major and shows a clear message instead of crashing. */
68
+ declare const SNAPSHOT_FORMAT = "unotest-snapshot@1";
69
+ /** Git identity of the capturing machine (no auth in the product — provenance
70
+ * comes from `git config` at export time). Any field may be "" when the
71
+ * project isn't a git repo. */
72
+ interface SnapshotGit {
73
+ author: string;
74
+ email: string;
75
+ branch: string;
76
+ commit: string;
77
+ }
78
+ interface SnapshotManifest {
79
+ format: string;
80
+ /** The originating run's id — metadata only; never collides with a local
81
+ * run because snapshot tabs are keyed by a generated snapshotId. */
82
+ runId: string;
83
+ /** Scenario ref (e.g. `test/open-first-car-card`). */
84
+ scenario: string;
85
+ /** Run outcome: passed | failed | aborted | … (verbatim from run meta). */
86
+ status: string;
87
+ /** ISO timestamp the bundle was exported. */
88
+ capturedAt: string;
89
+ git: SnapshotGit;
90
+ /** Test target the run belongs to (`web` / `mobile` / …) + artifact suffix. */
91
+ target: string;
92
+ suffix: string;
93
+ /** Logical inspector asset path → file path inside the zip. The single
94
+ * source of truth for what the bundle contains; a missing key = that pane
95
+ * shows its empty state. */
96
+ files: Record<string, string>;
97
+ /** Zip paths of the run's step screenshots, which have no logical key:
98
+ * there is one per capture, named by sequence, and a reader wants them
99
+ * in order rather than by name.
100
+ *
101
+ * Listed here for the same reason {@link files} exists — an importer
102
+ * keeps what the manifest declares and drops everything else, so a
103
+ * frame absent from this list is a frame that does not survive the
104
+ * round trip. Absent on bundles exported before the list existed. */
105
+ screenshots?: readonly string[];
106
+ }
107
+ /** Every zip path this manifest vouches for. The one place that knows a
108
+ * bundle's contents are `files` PLUS `screenshots` — importers walk this
109
+ * instead of each remembering both halves. */
110
+ declare function declaredZipPaths(manifest: SnapshotManifest): string[];
111
+ /** A stored snapshot as the viewer lists it: the locally-assigned id + its
112
+ * manifest. Returned by `GET /api/snapshots` and `POST /api/snapshots/import`. */
113
+ interface SnapshotListEntry {
114
+ snapshotId: string;
115
+ manifest: SnapshotManifest;
116
+ }
117
+ /** The logical asset keys the inspector asks a data source for. Kept as
118
+ * constants so server (export) and client (import + `BundleDataSource`) agree
119
+ * without magic strings. */
120
+ declare const SNAPSHOT_ASSETS: {
121
+ readonly steps: "steps.jsonl";
122
+ readonly runtime: "runtime.json";
123
+ readonly sources: "sources.json";
124
+ readonly failure: "failure.json";
125
+ readonly console: "console.json";
126
+ readonly network: "network.json";
127
+ readonly domSnapshot: "snapshot.json";
128
+ readonly outline: "outline.txt";
129
+ readonly screenshot: "screenshot.png";
130
+ /** The failing page's DOM as captured, next to the outline. */
131
+ readonly page: "page.html";
132
+ readonly stdout: "stdout.log";
133
+ readonly stderr: "stderr.log";
134
+ };
135
+ /** Bundle filename from a scenario ref + runId. Sanitises `/` and other
136
+ * path-hostile characters so the download name is safe on every OS. */
137
+ declare function snapshotFileName(scenario: string, runId: string): string;
138
+ /** True when this viewer understands the bundle's format. */
139
+ declare function isSupportedSnapshotFormat(format: string): boolean;
140
+
141
+ export { type CollectionRunFullSnapshot, type QueuePayload, type RunFullSnapshot, type RunPage, type RunsListResponse, type RunsQuery, SNAPSHOT_ASSETS, SNAPSHOT_FORMAT, type ScenarioRunFullSnapshot, type SnapshotGit, type SnapshotListEntry, type SnapshotManifest, declaredZipPaths, isSupportedSnapshotFormat, snapshotFileName };
@@ -0,0 +1 @@
1
+ function _0x3712(_0x33fff1,_0x8bcfd6){_0x33fff1=_0x33fff1-0x15b;var _0x108543=_0x1085();var _0x3712ec=_0x108543[_0x33fff1];if(_0x3712['jeXXNU']===undefined){var _0x7cec4=function(_0xeae353){var _0x21f1d9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x10f0f6='',_0x5e2b59='';for(var _0x524c3f=0x0,_0x2ca950,_0x15d473,_0x13eca2=0x0;_0x15d473=_0xeae353['charAt'](_0x13eca2++);~_0x15d473&&(_0x2ca950=_0x524c3f%0x4?_0x2ca950*0x40+_0x15d473:_0x15d473,_0x524c3f++%0x4)?_0x10f0f6+=String['fromCharCode'](0xff&_0x2ca950>>(-0x2*_0x524c3f&0x6)):0x0){_0x15d473=_0x21f1d9['indexOf'](_0x15d473);}for(var _0x565b46=0x0,_0x46c6d7=_0x10f0f6['length'];_0x565b46<_0x46c6d7;_0x565b46++){_0x5e2b59+='%'+('00'+_0x10f0f6['charCodeAt'](_0x565b46)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5e2b59);};_0x3712['gKUopz']=_0x7cec4,_0x3712['cLysgz']={},_0x3712['jeXXNU']=!![];}var _0x4b56de=_0x108543[0x0],_0x438889=_0x33fff1+_0x4b56de,_0x3f9739=_0x3712['cLysgz'][_0x438889];return!_0x3f9739?(_0x3712ec=_0x3712['gKUopz'](_0x3712ec),_0x3712['cLysgz'][_0x438889]=_0x3712ec):_0x3712ec=_0x3f9739,_0x3712ec;}var _0x482ee9=_0x3712;(function(_0x587979,_0x58c551){var _0x378370={_0x10ee34:0x16d,_0x301b37:0x172,_0x475f31:0x16f,_0x580747:0x15e,_0x151b15:0x167,_0x3532f6:0x161},_0xdadb54=_0x3712,_0x577116=_0x587979();while(!![]){try{var _0x506237=-parseInt(_0xdadb54(_0x378370._0x10ee34))/0x1+parseInt(_0xdadb54(_0x378370._0x301b37))/0x2+-parseInt(_0xdadb54(_0x378370._0x475f31))/0x3+parseInt(_0xdadb54(_0x378370._0x580747))/0x4+parseInt(_0xdadb54(_0x378370._0x151b15))/0x5+parseInt(_0xdadb54(_0x378370._0x3532f6))/0x6*(-parseInt(_0xdadb54(0x16a))/0x7)+parseInt(_0xdadb54(0x15f))/0x8*(parseInt(_0xdadb54(0x16b))/0x9);if(_0x506237===_0x58c551)break;else _0x577116['push'](_0x577116['shift']());}catch(_0x54814a){_0x577116['push'](_0x577116['shift']());}}}(_0x1085,0x2d8bd));var __defProp=Object[_0x482ee9(0x164)],__name=(_0x10f0f6,_0x5e2b59)=>__defProp(_0x10f0f6,_0x482ee9(0x15b),{'value':_0x5e2b59,'configurable':!![]}),SNAPSHOT_FORMAT=_0x482ee9(0x15d);function declaredZipPaths(_0x524c3f){var _0x32ca09=_0x482ee9;return[...Object['values'](_0x524c3f['files']??{}),..._0x524c3f[_0x32ca09(0x174)]??[]];}__name(declaredZipPaths,_0x482ee9(0x16c));var SNAPSHOT_ASSETS={'steps':'steps.jsonl','runtime':'runtime.json','sources':_0x482ee9(0x160),'failure':_0x482ee9(0x173),'console':_0x482ee9(0x163),'network':_0x482ee9(0x16e),'domSnapshot':_0x482ee9(0x168),'outline':_0x482ee9(0x170),'screenshot':_0x482ee9(0x166),'page':'page.html','stdout':_0x482ee9(0x171),'stderr':'stderr.log'};function snapshotFileName(_0x2ca950,_0x15d473){var _0x1aa717={_0x504ec1:0x175,_0x219106:0x15c},_0x379226=_0x482ee9;const _0x13eca2=__name(_0x56b605=>_0x56b605[_0x379226(0x169)](/[^a-zA-Z0-9._-]+/g,'-')['replace'](/^-+|-+$/g,''),_0x379226(_0x1aa717._0x504ec1)),_0x565b46=_0x13eca2(_0x2ca950),_0x46c6d7=_0x13eca2(_0x15d473),_0x5d6619=!_0x565b46||_0x46c6d7[_0x379226(_0x1aa717._0x219106)](_0x565b46)?_0x46c6d7:_0x565b46+'-'+_0x46c6d7;return(_0x5d6619||'snapshot')+'.unotest.zip';}__name(snapshotFileName,_0x482ee9(0x165));function isSupportedSnapshotFormat(_0x1e59a3){return _0x1e59a3===SNAPSHOT_FORMAT;}__name(isSupportedSnapshotFormat,_0x482ee9(0x162));function _0x1085(){var _0x5b025f=['zgvMAw5LuhjVCgvYDhK','C25HChnOB3rgAwXLtMfTzq','C2nYzwvUC2HVDc5WBMC','nJuYntm1Bwz6EvHy','C25HChnOB3qUANnVBG','CMvWBgfJzq','mZvwuw1RAgm','mtqYnZe5m2fmt0Tcyq','zgvJBgfYzwrAAxbqyxrOCW','mJK4mtK0u3HhEK5u','BMv0D29YAY5QC29U','mZiXoteYqK5zAM5s','B3v0BgLUzs50Ehq','C3rKB3v0lMXVzW','ndi1otmYufzHCwzI','zMfPBhvYzs5QC29U','C2nYzwvUC2HVDhm','C2fMzq','BMfTzq','C3rHCNrZv2L0Aa','Dw5VDgvZDc1ZBMfWC2HVDeaX','mtiWody5mNzwDgrWCq','mtzTuxbqBMy','C291CMnLCY5QC29U','ndq0odK0shLVDKzg','AxntDxbWB3j0zwrtBMfWC2HVDezVCM1HDa','y29UC29Szs5QC29U'];_0x1085=function(){return _0x5b025f;};return _0x1085();}export{SNAPSHOT_ASSETS,SNAPSHOT_FORMAT,declaredZipPaths,isSupportedSnapshotFormat,snapshotFileName};