@unotest/viewer 0.28.0 → 0.30.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.
@@ -32,6 +32,28 @@ interface ViewerIdentity {
32
32
  readonly env?: string;
33
33
  /** Where to POST to end the session. Absent → no log-out affordance. */
34
34
  readonly logoutUrl?: string;
35
+ /** Where to GET the environments the proxy can route this session to
36
+ * ({@link ViewerEnvOption}[]). Absent → no switcher: the proxy has one
37
+ * place to send us, or does not want it picked from here. */
38
+ readonly environmentsUrl?: string;
39
+ /** Where to POST `env=<name>` to be routed elsewhere. The answer is a
40
+ * redirect — the viewer behind the proxy changes, so it is a top-level
41
+ * form submit, never a fetch. */
42
+ readonly switchEnvUrl?: string;
43
+ }
44
+ /** One place the fronting proxy can route a session to. Display only,
45
+ * like {@link ViewerIdentity}: the viewer groups by `project`, shows
46
+ * `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;
35
57
  }
36
58
  interface ViewerSession {
37
59
  readonly capabilities: ViewerCapabilities;
@@ -56,4 +78,4 @@ declare function encodeViewerSession(session: ViewerSession): string;
56
78
  * a broken header must not lock a local user out of their own viewer. */
57
79
  declare function decodeViewerSession(raw: string | undefined): ViewerSession | null;
58
80
 
59
- export { FULL_CAPABILITIES, STANDALONE_SESSION, VIEWER_SESSION_HEADER, type ViewerCapabilities, type ViewerIdentity, type ViewerSession, decodeViewerSession, encodeViewerSession };
81
+ export { FULL_CAPABILITIES, STANDALONE_SESSION, VIEWER_SESSION_HEADER, type ViewerCapabilities, type ViewerEnvOption, type ViewerIdentity, type ViewerSession, decodeViewerSession, encodeViewerSession };
@@ -1 +1 @@
1
- const _0x576d7f=_0x25c5;(function(_0x16be06,_0xce1206){const _0x46f8a5={_0x347a66:0x14c,_0x9299fb:0x15c,_0x1dd569:0x151,_0x250b9f:0x157,_0x4af7ad:0x148,_0x404e73:0x142},_0x2a7bb2=_0x25c5,_0x16d51a=_0x16be06();while(!![]){try{const _0x49cd5c=parseInt(_0x2a7bb2(0x140))/0x1*(-parseInt(_0x2a7bb2(0x13e))/0x2)+parseInt(_0x2a7bb2(_0x46f8a5._0x347a66))/0x3*(parseInt(_0x2a7bb2(0x145))/0x4)+parseInt(_0x2a7bb2(0x155))/0x5+parseInt(_0x2a7bb2(_0x46f8a5._0x9299fb))/0x6*(-parseInt(_0x2a7bb2(0x152))/0x7)+-parseInt(_0x2a7bb2(_0x46f8a5._0x1dd569))/0x8*(-parseInt(_0x2a7bb2(_0x46f8a5._0x250b9f))/0x9)+parseInt(_0x2a7bb2(_0x46f8a5._0x4af7ad))/0xa+-parseInt(_0x2a7bb2(0x14a))/0xb*(parseInt(_0x2a7bb2(_0x46f8a5._0x404e73))/0xc);if(_0x49cd5c===_0xce1206)break;else _0x16d51a['push'](_0x16d51a['shift']());}catch(_0xb82019){_0x16d51a['push'](_0x16d51a['shift']());}}}(_0x1dd3,0x2e48c));var __defProp=Object[_0x576d7f(0x14f)],__name=(_0x28c095,_0x55a4b3)=>__defProp(_0x28c095,_0x576d7f(0x15d),{'value':_0x55a4b3,'configurable':!![]}),FULL_CAPABILITIES={'canRun':!![],'canEditFiles':!![],'canTerminal':!![],'canBrowseFs':!![]},STANDALONE_SESSION={'capabilities':FULL_CAPABILITIES,'identity':null},VIEWER_SESSION_HEADER=_0x576d7f(0x14b);function _0x25c5(_0x18ae68,_0x1cf7f5){_0x18ae68=_0x18ae68-0x13e;const _0x1dd3a4=_0x1dd3();let _0x25c55b=_0x1dd3a4[_0x18ae68];if(_0x25c5['ZQTmwj']===undefined){var _0x14af58=function(_0x26fd60){const _0x6bf5f6='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x28c095='',_0x55a4b3='';for(let _0x551220=0x0,_0x43f01c,_0xd7296f,_0x15ea33=0x0;_0xd7296f=_0x26fd60['charAt'](_0x15ea33++);~_0xd7296f&&(_0x43f01c=_0x551220%0x4?_0x43f01c*0x40+_0xd7296f:_0xd7296f,_0x551220++%0x4)?_0x28c095+=String['fromCharCode'](0xff&_0x43f01c>>(-0x2*_0x551220&0x6)):0x0){_0xd7296f=_0x6bf5f6['indexOf'](_0xd7296f);}for(let _0x3d76e1=0x0,_0x15e5e7=_0x28c095['length'];_0x3d76e1<_0x15e5e7;_0x3d76e1++){_0x55a4b3+='%'+('00'+_0x28c095['charCodeAt'](_0x3d76e1)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x55a4b3);};_0x25c5['kQMtrc']=_0x14af58,_0x25c5['iABWrK']={},_0x25c5['ZQTmwj']=!![];}const _0x5852fa=_0x1dd3a4[0x0],_0x9ca2ed=_0x18ae68+_0x5852fa,_0x50519a=_0x25c5['iABWrK'][_0x9ca2ed];return!_0x50519a?(_0x25c55b=_0x25c5['kQMtrc'](_0x25c55b),_0x25c5['iABWrK'][_0x9ca2ed]=_0x25c55b):_0x25c55b=_0x50519a,_0x25c55b;}function encodeViewerSession(_0x551220){const _0x32567e=_0x576d7f;return Buffer[_0x32567e(0x144)](JSON[_0x32567e(0x143)](_0x551220),'utf8')[_0x32567e(0x141)](_0x32567e(0x150));}__name(encodeViewerSession,_0x576d7f(0x15b));function decodeViewerSession(_0x43f01c){const _0x4f8337={_0x217fb9:0x156,_0x1dc4fe:0x144,_0x43fca4:0x150,_0x23fb59:0x141},_0x19cb99=_0x576d7f;if(_0x43f01c===void 0x0||_0x43f01c==='')return null;let _0xd7296f;try{_0xd7296f=JSON[_0x19cb99(_0x4f8337._0x217fb9)](Buffer[_0x19cb99(_0x4f8337._0x1dc4fe)](_0x43f01c,_0x19cb99(_0x4f8337._0x43fca4))[_0x19cb99(_0x4f8337._0x23fb59)](_0x19cb99(0x154)));}catch{return null;}if(typeof _0xd7296f!==_0x19cb99(0x14e)||_0xd7296f===null)return null;const {capabilities:_0x15ea33,identity:_0x3d76e1}=_0xd7296f,_0x15e5e7=readCapabilities(_0x15ea33);if(_0x15e5e7===null)return null;return{'capabilities':_0x15e5e7,'identity':readIdentity(_0x3d76e1)};}__name(decodeViewerSession,_0x576d7f(0x14d));function readCapabilities(_0x51e130){const _0x10ed43={_0x1a210a:0x158,_0x602ccd:0x146},_0x2bdaa1=_0x576d7f;if(typeof _0x51e130!=='object'||_0x51e130===null)return null;const _0x110818=_0x51e130,_0x55130a=__name(_0x53fc41=>_0x110818[_0x53fc41]===!![],'flag');return{'canRun':_0x55130a(_0x2bdaa1(0x149)),'canEditFiles':_0x55130a(_0x2bdaa1(_0x10ed43._0x1a210a)),'canTerminal':_0x55130a(_0x2bdaa1(_0x10ed43._0x602ccd)),'canBrowseFs':_0x55130a(_0x2bdaa1(0x153))};}__name(readCapabilities,'readCapabilities');function _0x1dd3(){const _0x5edf07=['CMvHzeLKzw50Axr5','mJqWnZq1mePxuLbguG','y2fUuNvU','nJzbzxzlugC','Ec11BM90zxn0lxzPzxDLCI1ZzxnZAw9U','m05vAK13Dq','zgvJB2rLvMLLD2vYu2vZC2LVBG','B2jQzwn0','zgvMAw5LuhjVCgvYDhK','yMfZzty0DxjS','mtz2zKDyEhC','mtKZmteXoePnuNfUCq','y2fUqNjVD3nLrNm','DxrMoa','mtCYmJq5mfPRyvHRra','CgfYC2u','mtmZmJK5C3PtuMvn','y2fUrwrPDezPBgvZ','zw52','Bg9NB3v0vxjS','zw5JB2rLvMLLD2vYu2vZC2LVBG','nK5Lugndtq','BMfTzq','mJG3ndi4t0vRruvU','C3rYAw5N','muvNu1jnqq','Dg9tDhjPBMC','mJyYodCYCNrSuM90','C3rYAw5NAwz5','zNjVBq','ntaYotu2qunlD0Tm','y2fUvgvYBwLUywW'];_0x1dd3=function(){return _0x5edf07;};return _0x1dd3();}function readIdentity(_0x461971){const _0x1d8aae={_0x52c684:0x14e,_0x31d69b:0x13f,_0x277323:0x13f,_0xe74d0d:0x159,_0x43887c:0x15a,_0x5511ea:0x13f},_0x57525f=_0x576d7f;if(typeof _0x461971!==_0x57525f(_0x1d8aae._0x52c684)||_0x461971===null)return null;const _0x520929=_0x461971,{user:_0x3fb62a,role:_0xc7983a}=_0x520929;if(typeof _0x3fb62a!==_0x57525f(_0x1d8aae._0x31d69b)||typeof _0xc7983a!==_0x57525f(_0x1d8aae._0x277323))return null;return{'user':_0x3fb62a,'role':_0xc7983a,...typeof _0x520929[_0x57525f(0x159)]===_0x57525f(0x13f)?{'env':_0x520929[_0x57525f(_0x1d8aae._0xe74d0d)]}:{},...typeof _0x520929[_0x57525f(_0x1d8aae._0x43887c)]===_0x57525f(_0x1d8aae._0x5511ea)?{'logoutUrl':_0x520929[_0x57525f(0x15a)]}:{}};}__name(readIdentity,_0x576d7f(0x147));export{FULL_CAPABILITIES,STANDALONE_SESSION,VIEWER_SESSION_HEADER,decodeViewerSession,encodeViewerSession};
1
+ const _0x40d5f6=_0x5076;(function(_0x290f38,_0x48c93c){const _0x36771a={_0x5da1a6:0x89,_0x2ed8ec:0x8e,_0x433cc4:0x9f,_0x583718:0x88,_0x13b0c3:0xa1,_0x3ae5b6:0x96,_0x2f1656:0x8c,_0x468b59:0x92,_0x456f48:0x94,_0x34e58e:0xa7},_0x4a7a85=_0x5076,_0x3cde15=_0x290f38();while(!![]){try{const _0x5b8c62=-parseInt(_0x4a7a85(_0x36771a._0x5da1a6))/0x1*(parseInt(_0x4a7a85(0x9a))/0x2)+parseInt(_0x4a7a85(0x8d))/0x3*(parseInt(_0x4a7a85(_0x36771a._0x2ed8ec))/0x4)+parseInt(_0x4a7a85(_0x36771a._0x433cc4))/0x5*(parseInt(_0x4a7a85(_0x36771a._0x583718))/0x6)+-parseInt(_0x4a7a85(_0x36771a._0x13b0c3))/0x7*(parseInt(_0x4a7a85(_0x36771a._0x3ae5b6))/0x8)+parseInt(_0x4a7a85(_0x36771a._0x2f1656))/0x9*(parseInt(_0x4a7a85(_0x36771a._0x468b59))/0xa)+-parseInt(_0x4a7a85(0x9d))/0xb*(-parseInt(_0x4a7a85(_0x36771a._0x456f48))/0xc)+-parseInt(_0x4a7a85(_0x36771a._0x34e58e))/0xd;if(_0x5b8c62===_0x48c93c)break;else _0x3cde15['push'](_0x3cde15['shift']());}catch(_0xd3dfdf){_0x3cde15['push'](_0x3cde15['shift']());}}}(_0x1a23,0x2d492));function _0x5076(_0xdc7c00,_0x3f12e5){_0xdc7c00=_0xdc7c00-0x86;const _0x1a2392=_0x1a23();let _0x5076b0=_0x1a2392[_0xdc7c00];if(_0x5076['IgBFfX']===undefined){var _0x3c493c=function(_0x335a89){const _0x19202c='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1da52b='',_0x4c7e9e='';for(let _0x1bd25e=0x0,_0x53a09a,_0x375f95,_0x37877d=0x0;_0x375f95=_0x335a89['charAt'](_0x37877d++);~_0x375f95&&(_0x53a09a=_0x1bd25e%0x4?_0x53a09a*0x40+_0x375f95:_0x375f95,_0x1bd25e++%0x4)?_0x1da52b+=String['fromCharCode'](0xff&_0x53a09a>>(-0x2*_0x1bd25e&0x6)):0x0){_0x375f95=_0x19202c['indexOf'](_0x375f95);}for(let _0x3decbd=0x0,_0x3f901e=_0x1da52b['length'];_0x3decbd<_0x3f901e;_0x3decbd++){_0x4c7e9e+='%'+('00'+_0x1da52b['charCodeAt'](_0x3decbd)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4c7e9e);};_0x5076['eDfFxn']=_0x3c493c,_0x5076['lVFliv']={},_0x5076['IgBFfX']=!![];}const _0x3c548e=_0x1a2392[0x0],_0x543b25=_0xdc7c00+_0x3c548e,_0x5da220=_0x5076['lVFliv'][_0x543b25];return!_0x5da220?(_0x5076b0=_0x5076['eDfFxn'](_0x5076b0),_0x5076['lVFliv'][_0x543b25]=_0x5076b0):_0x5076b0=_0x5da220,_0x5076b0;}var __defProp=Object[_0x40d5f6(0x91)],__name=(_0x1da52b,_0x4c7e9e)=>__defProp(_0x1da52b,_0x40d5f6(0xa6),{'value':_0x4c7e9e,'configurable':!![]}),FULL_CAPABILITIES={'canRun':!![],'canEditFiles':!![],'canTerminal':!![],'canBrowseFs':!![]},STANDALONE_SESSION={'capabilities':FULL_CAPABILITIES,'identity':null},VIEWER_SESSION_HEADER=_0x40d5f6(0x9b);function _0x1a23(){const _0x4aefec=['n3HuBfDOtG','C3rYAw5N','CgfYC2u','B2jQzwn0','CMvHzenHCgfIAwXPDgLLCW','BMfTzq','ntK3nta0n3Htq2vrsW','DxrMoa','y2fUqNjVD3nLrNm','mZi0zxnXtNfn','ndm3nZDOt2TUwwC','C3rYAw5NAwz5','yMfZzty0DxjS','ntCXnw53Dg5wvW','nJnkq3rOBhC','ntC4mJHMAePPEKu','y2fUuNvU','zw5JB2rLvMLLD2vYu2vZC2LVBG','zgvMAw5LuhjVCgvYDhK','ntiZmgngB3zota','zNjVBq','mtjwuMDbv2q','zw52AxjVBM1LBNrZvxjS','nZaYnZyWvNrTqvrV','zMXHzW','zw52','y2fUrwrPDezPBgvZ','nK5fAejRDq','Ec11BM90zxn0lxzPzxDLCI1ZzxnZAw9U','Dg9tDhjPBMC','mJmZmZi0m1zJs25ACW','C3DPDgnOrw52vxjS','mtuYnwPNtMnSBW','zgvJB2rLvMLLD2vYu2vZC2LVBG'];_0x1a23=function(){return _0x4aefec;};return _0x1a23();}function encodeViewerSession(_0x1bd25e){const _0x1cb434={_0x38ba16:0x86,_0x2d6fcd:0x9c},_0xe19321=_0x40d5f6;return Buffer['from'](JSON[_0xe19321(0x8a)](_0x1bd25e),_0xe19321(_0x1cb434._0x38ba16))[_0xe19321(_0x1cb434._0x2d6fcd)](_0xe19321(0x8b));}__name(encodeViewerSession,_0x40d5f6(0x90));function decodeViewerSession(_0x53a09a){const _0x36719a={_0x4d3104:0xa3,_0x410198:0x93},_0x1fa95b=_0x40d5f6;if(_0x53a09a===void 0x0||_0x53a09a==='')return null;let _0x375f95;try{_0x375f95=JSON[_0x1fa95b(_0x36719a._0x4d3104)](Buffer[_0x1fa95b(_0x36719a._0x410198)](_0x53a09a,_0x1fa95b(0x8b))[_0x1fa95b(0x9c)]('utf8'));}catch{return null;}if(typeof _0x375f95!=='object'||_0x375f95===null)return null;const {capabilities:_0x37877d,identity:_0x3decbd}=_0x375f95,_0x3f901e=readCapabilities(_0x37877d);if(_0x3f901e===null)return null;return{'capabilities':_0x3f901e,'identity':readIdentity(_0x3decbd)};}__name(decodeViewerSession,_0x40d5f6(0xa0));function readCapabilities(_0x1bb94e){const _0x17d521={_0x35c196:0x97},_0x406c24=_0x40d5f6;if(typeof _0x1bb94e!==_0x406c24(0xa4)||_0x1bb94e===null)return null;const _0x84cdda=_0x1bb94e,_0x3951fe=__name(_0x24adba=>_0x84cdda[_0x24adba]===!![],_0x406c24(_0x17d521._0x35c196));return{'canRun':_0x3951fe(_0x406c24(0x8f)),'canEditFiles':_0x3951fe(_0x406c24(0x99)),'canTerminal':_0x3951fe('canTerminal'),'canBrowseFs':_0x3951fe(_0x406c24(0x87))};}__name(readCapabilities,_0x40d5f6(0xa5));function readIdentity(_0x30323c){const _0x2bb2e7=_0x40d5f6;if(typeof _0x30323c!=='object'||_0x30323c===null)return null;const _0x14040d=_0x30323c,{user:_0x1ade98,role:_0x3e5d8d}=_0x14040d;if(typeof _0x1ade98!==_0x2bb2e7(0xa2)||typeof _0x3e5d8d!==_0x2bb2e7(0xa2))return null;return{'user':_0x1ade98,'role':_0x3e5d8d,...optionalString(_0x14040d,_0x2bb2e7(0x98)),...optionalString(_0x14040d,'logoutUrl'),...optionalString(_0x14040d,_0x2bb2e7(0x95)),...optionalString(_0x14040d,_0x2bb2e7(0x9e))};}__name(readIdentity,'readIdentity');function optionalString(_0x45b110,_0x37a7a8){const _0x13eadb=_0x40d5f6,_0x5565e8=_0x45b110[_0x37a7a8];return typeof _0x5565e8===_0x13eadb(0xa2)?{[_0x37a7a8]:_0x5565e8}:{};}__name(optionalString,'optionalString');export{FULL_CAPABILITIES,STANDALONE_SESSION,VIEWER_SESSION_HEADER,decodeViewerSession,encodeViewerSession};