@univer-cli/content-execution 1.0.0-beta.2 → 1.0.0-rc.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/README.md +3 -2
- package/README.zh-CN.md +3 -2
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,12 +38,13 @@ The package returns only the program string. The caller remains responsible for
|
|
|
38
38
|
| Unit type | Injected binding |
|
|
39
39
|
| --------- | ---------------------------------- |
|
|
40
40
|
| Sheet | `univerAPI`, `api`, `workbook` |
|
|
41
|
-
| Doc | `univerAPI`, `api`, `
|
|
41
|
+
| Doc | `univerAPI`, `api`, `doc` |
|
|
42
42
|
| Slide | `univerAPI`, `api`, `presentation` |
|
|
43
|
-
| Base | `univerAPI`, `api`, `
|
|
43
|
+
| Base | `univerAPI`, `api`, `base` |
|
|
44
44
|
| Board | `univerAPI`, `api`, `board` |
|
|
45
45
|
|
|
46
46
|
Root Facade is obtained through `unitId` instead of relying on the current active unit, so the same code can be stably executed in the headless runtime.
|
|
47
|
+
If the selected Unit does not exist, the program throws `Cannot find <binding> <unitId>` before running user code.
|
|
47
48
|
|
|
48
49
|
## Validation and errors
|
|
49
50
|
|
package/README.zh-CN.md
CHANGED
|
@@ -39,12 +39,13 @@ Package 只返回 program 字符串。Runtime 的获取、执行模式、lease
|
|
|
39
39
|
| Unit 类型 | 注入的 binding |
|
|
40
40
|
| --------- | ---------------------------------- |
|
|
41
41
|
| Sheet | `univerAPI`、`api`、`workbook` |
|
|
42
|
-
| Doc | `univerAPI`、`api`、`
|
|
42
|
+
| Doc | `univerAPI`、`api`、`doc` |
|
|
43
43
|
| Slide | `univerAPI`、`api`、`presentation` |
|
|
44
|
-
| Base | `univerAPI`、`api`、`
|
|
44
|
+
| Base | `univerAPI`、`api`、`base` |
|
|
45
45
|
| Board | `univerAPI`、`api`、`board` |
|
|
46
46
|
|
|
47
47
|
Root Facade 通过 `unitId` 获取,而不是依赖当前 active Unit,因此相同代码可在 headless runtime 中稳定执行。
|
|
48
|
+
如果指定 Unit 不存在,program 会在执行用户代码前抛出 `Cannot find <binding> <unitId>` 错误。
|
|
48
49
|
|
|
49
50
|
## 校验与错误
|
|
50
51
|
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x2e5622=_0x5a51;(function(_0x282979,_0x35ed91){const _0xaa713d=_0x5a51,_0x58055e=_0x282979();while(!![]){try{const _0x436e76=-parseInt(_0xaa713d(0x13a))/0x1+-parseInt(_0xaa713d(0x123))/0x2+parseInt(_0xaa713d(0x110))/0x3*(parseInt(_0xaa713d(0x138))/0x4)+-parseInt(_0xaa713d(0x134))/0x5*(parseInt(_0xaa713d(0x107))/0x6)+-parseInt(_0xaa713d(0x10a))/0x7*(parseInt(_0xaa713d(0x121))/0x8)+parseInt(_0xaa713d(0x135))/0x9+parseInt(_0xaa713d(0x112))/0xa;if(_0x436e76===_0x35ed91)break;else _0x58055e['push'](_0x58055e['shift']());}catch(_0x509400){_0x58055e['push'](_0x58055e['shift']());}}}(_0x34db,0xbbe78));function _0x34db(){const _0x32dbab=['Cannot\x20find\x20base\x20','3590thKqKI','2106432XDzHbi','CONTENT_EXECUTION_RESERVED_BINDING','name','52CAQBHL','length','47816yQlHAe','some','5580vAeKda','trim','return\x20(async\x20()\x20=>\x20{\x20','5789ZZEBgs','join','unitType','ContentExecutionError','if\x20(!board)\x20throw\x20new\x20Error(','Cannot\x20find\x20board\x20','217095nCGfOo','if\x20(!workbook)\x20throw\x20new\x20Error(','24799910WnNQos','const\x20','workbook','unitId','stringify','CONTENT_EXECUTION_INVALID_INPUT','\x20content\x20execution\x20prelude','board','\x0a})();','`\x20is\x20reserved\x20by\x20the\x20','if\x20(!doc)\x20throw\x20new\x20Error(','const\x20base\x20=\x20api.getBase(','Cannot\x20find\x20workbook\x20','slide','api','14264GQgyZR','const\x20api\x20=\x20univerAPI;','1390062xEyzWU','details','presentation','univerAPI','base','string','code','const\x20board\x20=\x20api.getBoard(','const\x20doc\x20=\x20api.getDocument(','doc','if\x20(!presentation)\x20throw\x20new\x20Error(','const\x20workbook\x20=\x20api.getWorkbook(','Cannot\x20find\x20doc\x20','Content\x20execution\x20Unit\x20ID\x20must\x20not\x20be\x20empty','sheet','Unexpected\x20content\x20execution\x20Unit\x20type:\x20'];_0x34db=function(){return _0x32dbab;};return _0x34db();}var e=class extends Error{[_0x2e5622(0x129)];[_0x2e5622(0x124)];constructor(_0x22fa8f,_0x314821,_0x5c39b7){const _0x8af374=_0x2e5622;super(_0x314821),this[_0x8af374(0x129)]=_0x22fa8f,this[_0x8af374(0x124)]=_0x5c39b7,this[_0x8af374(0x137)]=_0x8af374(0x10d);}},t=[_0x2e5622(0x131),_0x2e5622(0x12c),_0x2e5622(0x11f),'base','board'];function n(_0x324179){const _0x81c076=_0x2e5622;if(typeof _0x324179[_0x81c076(0x129)]!=_0x81c076(0x128))throw new e(_0x81c076(0x117),'Content\x20execution\x20code\x20must\x20be\x20a\x20string');if(typeof _0x324179[_0x81c076(0x115)]!=_0x81c076(0x128)||_0x324179['unitId'][_0x81c076(0x108)]()[_0x81c076(0x139)]===0x0)throw new e(_0x81c076(0x117),_0x81c076(0x130),{'unitId':_0x324179[_0x81c076(0x115)]});if(!c(_0x324179['unitType']))throw new e('CONTENT_EXECUTION_UNIT_TYPE_UNSUPPORTED','Content\x20execution\x20does\x20not\x20support\x20Unit\x20type\x20'+String(_0x324179['unitType']),{'supportedUnitTypes':t,'unitType':_0x324179[_0x81c076(0x10c)]});let _0x26370d=i(_0x324179[_0x81c076(0x10c)]);return o(_0x324179['code'],_0x324179[_0x81c076(0x10c)],_0x26370d),r(_0x324179[_0x81c076(0x10c)],_0x324179[_0x81c076(0x115)])+'\x0a'+_0x324179['code'];}function r(_0x12be0d,_0x1c48f9){const _0x192d99=_0x2e5622;let _0x302e8d=JSON[_0x192d99(0x116)](_0x1c48f9);return _0x12be0d==='sheet'?[_0x192d99(0x122),_0x192d99(0x12e)+_0x302e8d+');',_0x192d99(0x111)+JSON[_0x192d99(0x116)](_0x192d99(0x11e)+_0x1c48f9)+');'][_0x192d99(0x10b)]('\x0a'):_0x12be0d===_0x192d99(0x12c)?[_0x192d99(0x122),_0x192d99(0x12b)+_0x302e8d+');',_0x192d99(0x11c)+JSON['stringify'](_0x192d99(0x12f)+_0x1c48f9)+');']['join']('\x0a'):_0x12be0d===_0x192d99(0x11f)?[_0x192d99(0x122),'const\x20presentation\x20=\x20api.getPresentation('+_0x302e8d+');',_0x192d99(0x12d)+JSON[_0x192d99(0x116)]('Cannot\x20find\x20presentation\x20'+_0x1c48f9)+');'][_0x192d99(0x10b)]('\x0a'):_0x12be0d===_0x192d99(0x127)?['const\x20api\x20=\x20univerAPI;',_0x192d99(0x11d)+_0x302e8d+');','if\x20(!base)\x20throw\x20new\x20Error('+JSON[_0x192d99(0x116)](_0x192d99(0x133)+_0x1c48f9)+');'][_0x192d99(0x10b)]('\x0a'):_0x12be0d==='board'?[_0x192d99(0x122),_0x192d99(0x12a)+_0x302e8d+');',_0x192d99(0x10e)+JSON[_0x192d99(0x116)](_0x192d99(0x10f)+_0x1c48f9)+');'][_0x192d99(0x10b)]('\x0a'):a(_0x12be0d);}function i(_0x527284){const _0x3088de=_0x2e5622;return _0x527284==='sheet'?['univerAPI','api',_0x3088de(0x114)]:_0x527284===_0x3088de(0x12c)?[_0x3088de(0x126),'api',_0x3088de(0x12c)]:_0x527284===_0x3088de(0x11f)?[_0x3088de(0x126),'api',_0x3088de(0x125)]:_0x527284===_0x3088de(0x127)?['univerAPI',_0x3088de(0x120),'base']:_0x527284===_0x3088de(0x119)?[_0x3088de(0x126),_0x3088de(0x120),_0x3088de(0x119)]:a(_0x527284);}function a(_0x18a6be){const _0x45ae2e=_0x2e5622;throw Error(_0x45ae2e(0x132)+String(_0x18a6be));}function o(_0x2a114c,_0x17a045,_0x567c84){const _0x39efc9=_0x2e5622;if(s(_0x2a114c)){for(let _0x144069 of _0x567c84)if(!s(_0x39efc9(0x113)+_0x144069+'\x20=\x20undefined;\x0a'+_0x2a114c))throw new e(_0x39efc9(0x136),'`'+_0x144069+_0x39efc9(0x11b)+_0x17a045+_0x39efc9(0x118),{'binding':_0x144069,'reservedBindings':_0x567c84,'unitType':_0x17a045});}}function s(_0x10034b){const _0x284aed=_0x2e5622;try{return Function(_0x284aed(0x126),_0x284aed(0x109)+_0x10034b+_0x284aed(0x11a)),!0x0;}catch{return!0x1;}}function c(_0xde4220){const _0xa2ad5=_0x2e5622;return t[_0xa2ad5(0x13b)](_0x470b01=>_0x470b01===_0xde4220);}function _0x5a51(_0x2699c8,_0x4b09a4){_0x2699c8=_0x2699c8-0x107;const _0x34dbbd=_0x34db();let _0x5a510d=_0x34dbbd[_0x2699c8];return _0x5a510d;}export{e as ContentExecutionError,n as prepareContentExecutionProgram};
|