solve-engine 2.17.0 → 2.19.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/{chunk-YQV4WGXH.js → chunk-2BET55VH.js} +3 -3
- package/dist/chunk-2BET55VH.js.map +1 -0
- package/dist/{chunk-A2RQUV5H.cjs → chunk-46QSH527.cjs} +4 -4
- package/dist/{chunk-A2RQUV5H.cjs.map → chunk-46QSH527.cjs.map} +1 -1
- package/dist/chunk-53JLDRXA.cjs +2 -0
- package/dist/chunk-53JLDRXA.cjs.map +1 -0
- package/dist/{chunk-2DPKJ2SM.js → chunk-6EPJNHSQ.js} +2 -2
- package/dist/{chunk-2DPKJ2SM.js.map → chunk-6EPJNHSQ.js.map} +1 -1
- package/dist/{chunk-UWAXJX5G.js → chunk-6NXOKM2O.js} +2 -2
- package/dist/{chunk-UWAXJX5G.js.map → chunk-6NXOKM2O.js.map} +1 -1
- package/dist/{chunk-DLAKPF5T.js → chunk-6YGRMAQR.js} +2 -2
- package/dist/{chunk-DLAKPF5T.js.map → chunk-6YGRMAQR.js.map} +1 -1
- package/dist/{chunk-LJFS3XHW.js → chunk-BB5RRSGS.js} +2 -2
- package/dist/{chunk-LJFS3XHW.js.map → chunk-BB5RRSGS.js.map} +1 -1
- package/dist/{chunk-BKSKZA4W.cjs → chunk-BVSATTRX.cjs} +2 -2
- package/dist/{chunk-BKSKZA4W.cjs.map → chunk-BVSATTRX.cjs.map} +1 -1
- package/dist/chunk-CDIHV3ZS.js +2 -0
- package/dist/chunk-CDIHV3ZS.js.map +1 -0
- package/dist/{chunk-G63TMUL2.js → chunk-DLXG73JZ.js} +2 -2
- package/dist/{chunk-G63TMUL2.js.map → chunk-DLXG73JZ.js.map} +1 -1
- package/dist/{chunk-TRDOYAKJ.cjs → chunk-EAB6SSAV.cjs} +2 -2
- package/dist/{chunk-TRDOYAKJ.cjs.map → chunk-EAB6SSAV.cjs.map} +1 -1
- package/dist/{chunk-N64ZK6CL.cjs → chunk-HCPZRSHR.cjs} +2 -2
- package/dist/{chunk-N64ZK6CL.cjs.map → chunk-HCPZRSHR.cjs.map} +1 -1
- package/dist/{chunk-WEAKI5V5.cjs → chunk-IXOE2BQG.cjs} +2 -2
- package/dist/{chunk-WEAKI5V5.cjs.map → chunk-IXOE2BQG.cjs.map} +1 -1
- package/dist/{chunk-SEOIKHYK.js → chunk-JMYBZ6JF.js} +2 -2
- package/dist/{chunk-SEOIKHYK.js.map → chunk-JMYBZ6JF.js.map} +1 -1
- package/dist/{chunk-G2MFTERZ.cjs → chunk-KLPKLTJZ.cjs} +2 -2
- package/dist/{chunk-G2MFTERZ.cjs.map → chunk-KLPKLTJZ.cjs.map} +1 -1
- package/dist/{chunk-44EOEWGP.js → chunk-MDLR2PWN.js} +2 -2
- package/dist/chunk-MDLR2PWN.js.map +1 -0
- package/dist/chunk-O3AVGIX2.cjs +3 -0
- package/dist/chunk-O3AVGIX2.cjs.map +1 -0
- package/dist/{chunk-CEURQXSN.cjs → chunk-OW2SGORC.cjs} +2 -2
- package/dist/{chunk-CEURQXSN.cjs.map → chunk-OW2SGORC.cjs.map} +1 -1
- package/dist/{chunk-5FMYW44V.js → chunk-OZ5BQSAC.js} +2 -2
- package/dist/{chunk-5FMYW44V.js.map → chunk-OZ5BQSAC.js.map} +1 -1
- package/dist/{chunk-PS5OA7QU.js → chunk-P7CQJGNA.js} +3 -3
- package/dist/{chunk-PS5OA7QU.js.map → chunk-P7CQJGNA.js.map} +1 -1
- package/dist/{chunk-BNCBB4H5.cjs → chunk-QD2Z5TDD.cjs} +2 -2
- package/dist/{chunk-BNCBB4H5.cjs.map → chunk-QD2Z5TDD.cjs.map} +1 -1
- package/dist/{chunk-XPJGDGJF.cjs → chunk-TM752D4J.cjs} +2 -2
- package/dist/{chunk-XPJGDGJF.cjs.map → chunk-TM752D4J.cjs.map} +1 -1
- package/dist/{chunk-HQ2PE6HY.cjs → chunk-TYJTGTTY.cjs} +3 -3
- package/dist/{chunk-HQ2PE6HY.cjs.map → chunk-TYJTGTTY.cjs.map} +1 -1
- package/dist/{chunk-6QRHN3I6.cjs → chunk-XB3TWS7J.cjs} +2 -2
- package/dist/chunk-XB3TWS7J.cjs.map +1 -0
- package/dist/{chunk-RLTH2H3U.js → chunk-YBKMCGJ3.js} +2 -2
- package/dist/{chunk-RLTH2H3U.js.map → chunk-YBKMCGJ3.js.map} +1 -1
- package/dist/{chunk-XOEZ7UQI.js → chunk-ZN33O4AL.js} +3 -3
- package/dist/{chunk-XOEZ7UQI.js.map → chunk-ZN33O4AL.js.map} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/language.cjs +1 -1
- package/dist/language.js +1 -1
- package/dist/lexer.cjs +1 -1
- package/dist/lexer.js +1 -1
- package/dist/normalizer.cjs +1 -1
- package/dist/normalizer.js +1 -1
- package/dist/packages.cjs +1 -1
- package/dist/packages.js +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.js +1 -1
- package/dist/uom.cjs +1 -1
- package/dist/uom.js +1 -1
- package/dist/vm.cjs +1 -1
- package/dist/vm.js +1 -1
- package/dist/worker.cjs +2 -2
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-44EOEWGP.js.map +0 -1
- package/dist/chunk-6QRHN3I6.cjs.map +0 -1
- package/dist/chunk-IES365YJ.cjs +0 -3
- package/dist/chunk-IES365YJ.cjs.map +0 -1
- package/dist/chunk-RHE3LC4Q.js +0 -2
- package/dist/chunk-RHE3LC4Q.js.map +0 -1
- package/dist/chunk-WMISTHB2.cjs +0 -2
- package/dist/chunk-WMISTHB2.cjs.map +0 -1
- package/dist/chunk-YQV4WGXH.js.map +0 -1
package/dist/constants.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkOW2SGORC_cjs=require('./chunk-OW2SGORC.cjs');require('./chunk-CO2BI6WL.cjs');Object.defineProperty(exports,"ConfigManager",{enumerable:true,get:function(){return chunkOW2SGORC_cjs.d}});Object.defineProperty(exports,"DEFAULT_CONFIG",{enumerable:true,get:function(){return chunkOW2SGORC_cjs.b}});Object.defineProperty(exports,"ENGINE_VERSION",{enumerable:true,get:function(){return chunkOW2SGORC_cjs.a}});//# sourceMappingURL=constants.cjs.map
|
|
2
2
|
//# sourceMappingURL=constants.cjs.map
|
package/dist/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{d as ConfigManager,b as DEFAULT_CONFIG,a as ENGINE_VERSION}from'./chunk-
|
|
1
|
+
export{d as ConfigManager,b as DEFAULT_CONFIG,a as ENGINE_VERSION}from'./chunk-OZ5BQSAC.js';import'./chunk-PIZQIQVM.js';//# sourceMappingURL=constants.js.map
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
package/dist/engine.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkTYJTGTTY_cjs=require('./chunk-TYJTGTTY.cjs');require('./chunk-EFJCC6FJ.cjs');var chunk46QSH527_cjs=require('./chunk-46QSH527.cjs');require('./chunk-JYLNQOPU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-LNZNJSRW.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-QD2Z5TDD.cjs'),require('./chunk-HG4NPDN5.cjs'),require('./chunk-H3JXNH7X.cjs'),require('./chunk-R2SZFJTT.cjs'),require('./chunk-53JLDRXA.cjs'),require('./chunk-EN3CDYOS.cjs'),require('./chunk-KLPKLTJZ.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-HCPZRSHR.cjs'),require('./chunk-6YM67DWH.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-J7ABVGZH.cjs'),require('./chunk-75JLWK4L.cjs'),require('./chunk-BVSATTRX.cjs'),require('./chunk-OW2SGORC.cjs'),require('./chunk-TM752D4J.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-EAB6SSAV.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-IXOE2BQG.cjs'),require('./chunk-XB3TWS7J.cjs'),require('./chunk-CO2BI6WL.cjs');Object.defineProperty(exports,"DocumentModel",{enumerable:true,get:function(){return chunkTYJTGTTY_cjs.a}});Object.defineProperty(exports,"EvalTier",{enumerable:true,get:function(){return chunkTYJTGTTY_cjs.b}});Object.defineProperty(exports,"ThreeTierEvaluator",{enumerable:true,get:function(){return chunkTYJTGTTY_cjs.c}});Object.defineProperty(exports,"evaluateDocument",{enumerable:true,get:function(){return chunkTYJTGTTY_cjs.d}});Object.defineProperty(exports,"AsyncResolutionBatcher",{enumerable:true,get:function(){return chunk46QSH527_cjs.h}});Object.defineProperty(exports,"ExpressionEngine",{enumerable:true,get:function(){return chunk46QSH527_cjs.n}});Object.defineProperty(exports,"SNAPSHOT_FORMAT",{enumerable:true,get:function(){return chunk46QSH527_cjs.d}});Object.defineProperty(exports,"SNAPSHOT_VERSION",{enumerable:true,get:function(){return chunk46QSH527_cjs.e}});Object.defineProperty(exports,"SnapshotErrorCodes",{enumerable:true,get:function(){return chunk46QSH527_cjs.f}});Object.defineProperty(exports,"checkExpressionComplexity",{enumerable:true,get:function(){return chunk46QSH527_cjs.j}});Object.defineProperty(exports,"checkExpressionLength",{enumerable:true,get:function(){return chunk46QSH527_cjs.i}});Object.defineProperty(exports,"extractReadsAndWrites",{enumerable:true,get:function(){return chunk46QSH527_cjs.k}});Object.defineProperty(exports,"findInlineSolvesInLine",{enumerable:true,get:function(){return chunk46QSH527_cjs.m}});Object.defineProperty(exports,"isEmptyLine",{enumerable:true,get:function(){return chunk46QSH527_cjs.l}});//# sourceMappingURL=engine.cjs.map
|
|
2
2
|
//# sourceMappingURL=engine.cjs.map
|
package/dist/engine.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as DocumentModel,b as EvalTier,c as ThreeTierEvaluator,d as evaluateDocument}from'./chunk-
|
|
1
|
+
export{a as DocumentModel,b as EvalTier,c as ThreeTierEvaluator,d as evaluateDocument}from'./chunk-ZN33O4AL.js';import'./chunk-RAF57WYO.js';export{h as AsyncResolutionBatcher,n as ExpressionEngine,d as SNAPSHOT_FORMAT,e as SNAPSHOT_VERSION,f as SnapshotErrorCodes,j as checkExpressionComplexity,i as checkExpressionLength,k as extractReadsAndWrites,m as findInlineSolvesInLine,l as isEmptyLine}from'./chunk-P7CQJGNA.js';import'./chunk-JVMINMAB.js';import'./chunk-2RWAXT6O.js';import'./chunk-7E7NXKQ5.js';import'./chunk-MIQBJGGR.js';import'./chunk-YBKMCGJ3.js';import'./chunk-JP4JMQOG.js';import'./chunk-QTSDIDAS.js';import'./chunk-XEIDV5JP.js';import'./chunk-CDIHV3ZS.js';import'./chunk-O3BDXOQJ.js';import'./chunk-DLXG73JZ.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-JMYBZ6JF.js';import'./chunk-EQDT42JG.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-KEA5HRL3.js';import'./chunk-3GR46UOX.js';import'./chunk-6YGRMAQR.js';import'./chunk-OZ5BQSAC.js';import'./chunk-6EPJNHSQ.js';import'./chunk-JPFCXLJV.js';import'./chunk-BB5RRSGS.js';import'./chunk-IJMNVBIS.js';import'./chunk-LHLW7JLS.js';import'./chunk-6NXOKM2O.js';import'./chunk-MDLR2PWN.js';import'./chunk-PIZQIQVM.js';//# sourceMappingURL=engine.js.map
|
|
2
2
|
//# sourceMappingURL=engine.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';require('./chunk-
|
|
1
|
+
'use strict';require('./chunk-TYJTGTTY.cjs'),require('./chunk-EFJCC6FJ.cjs');var chunk46QSH527_cjs=require('./chunk-46QSH527.cjs');require('./chunk-JYLNQOPU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-LNZNJSRW.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-QD2Z5TDD.cjs'),require('./chunk-HG4NPDN5.cjs'),require('./chunk-H3JXNH7X.cjs'),require('./chunk-R2SZFJTT.cjs');var chunkO3AVGIX2_cjs=require('./chunk-O3AVGIX2.cjs');require('./chunk-TL545PXW.cjs'),require('./chunk-53JLDRXA.cjs');var chunkEN3CDYOS_cjs=require('./chunk-EN3CDYOS.cjs');require('./chunk-KLPKLTJZ.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-HCPZRSHR.cjs'),require('./chunk-6YM67DWH.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-J7ABVGZH.cjs');var chunk75JLWK4L_cjs=require('./chunk-75JLWK4L.cjs');require('./chunk-BVSATTRX.cjs');var chunkOW2SGORC_cjs=require('./chunk-OW2SGORC.cjs');require('./chunk-TM752D4J.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-EAB6SSAV.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-IXOE2BQG.cjs'),require('./chunk-XB3TWS7J.cjs');var chunkCO2BI6WL_cjs=require('./chunk-CO2BI6WL.cjs');var r={DEFINE_FUNCTION_INVALID_NAME:"DEFINE_FUNCTION_INVALID_NAME",DEFINE_FUNCTION_INVALID_SPEC:"DEFINE_FUNCTION_INVALID_SPEC",DEFINE_FUNCTION_ARITY_MISMATCH:"DEFINE_FUNCTION_ARITY_MISMATCH",DEFINE_FUNCTION_ARGUMENT_TYPE:"DEFINE_FUNCTION_ARGUMENT_TYPE",DEFINE_FUNCTION_RETURN_TYPE:"DEFINE_FUNCTION_RETURN_TYPE"},b=/^[a-z_][a-z0-9_]*$/i,y=new Set(["number","string","boolean"]);function u(e){return e===1?"1 argument":`${e} arguments`}function f(e){switch(e.type){case 0:case 1:return "a number";case 3:return "a string";case 10:return "a boolean";case 2:return "a big integer";case 5:return "a percentage";case 6:return "a value with a unit";case 4:return "a date";case 7:return "a matrix";case 8:return "a range";case 9:return "a symbolic expression";default:return "an unsupported value"}}function A(e,n,t){switch(n.type){case "number":if(e.type===0||e.type===1)return e.toNumber();break;case "string":if(e.type===3)return e.value;break;case "boolean":if(e.type===10)return e.value;break}throw chunkCO2BI6WL_cjs.c.execution({code:r.DEFINE_FUNCTION_ARGUMENT_TYPE,message:`${t}() expects "${n.name}" to be a ${n.type}, but was given ${f(e)}`,expected:`a ${n.type}`,found:f(e),context:{functionName:t,argName:n.name,expectedType:n.type}})}function S(e,n,t){switch(n){case "number":if(typeof e=="number")return chunk75JLWK4L_cjs.n(e);break;case "string":if(typeof e=="string")return chunk75JLWK4L_cjs.t(e);break;case "boolean":if(typeof e=="boolean")return chunk75JLWK4L_cjs.L(e);break}throw chunkCO2BI6WL_cjs.c.internal({code:r.DEFINE_FUNCTION_RETURN_TYPE,message:`${t}() is declared to return a ${n}, but its implementation returned ${typeof e}`,expected:`a ${n}`,found:typeof e,context:{functionName:t,expectedType:n}})}var p=class{constructor(n){this.fnName=n;this.category="Function";}parse(n,t,i){n.consume("LPAREN");let a=0;if(n.peek()?.type!=="RPAREN")for(n.parseExpression(chunkEN3CDYOS_cjs.a.Lowest,i),a++;n.match("COMMA");)n.parseExpression(chunkEN3CDYOS_cjs.a.Lowest,i),a++;n.consume("RPAREN"),i.emitPluginCall(this.fnName,a);}};function P(e){let n=e.args.length;return t=>{if(t.length!==n)throw chunkCO2BI6WL_cjs.c.execution({code:r.DEFINE_FUNCTION_ARITY_MISMATCH,message:`${e.name}() takes ${u(n)}, but was given ${t.length===0?"none":u(t.length)}`,expected:u(n),found:t.length===0?"none":u(t.length),context:{functionName:e.name,expected:n,actual:t.length}});let i=new Array(n);for(let s=0;s<n;s++)i[s]=A(t[s],e.args[s],e.name);let a=e.call(...i);return S(a,e.returns,e.name)}}function V(e){if(typeof e?.name!="string"||!b.test(e.name))throw chunkCO2BI6WL_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_NAME,message:`defineFunction: name must be a single identifier, got ${JSON.stringify(e?.name)}`,suggestion:'e.g. "vat" or "net_price"',context:{name:e?.name}});if(!Array.isArray(e.args))throw chunkCO2BI6WL_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" args must be an array`,context:{name:e.name}});for(let n of e.args){if(typeof n?.name!="string"||n.name.length===0)throw chunkCO2BI6WL_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has an argument with no name`,context:{name:e.name}});if(!y.has(n.type))throw chunkCO2BI6WL_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" argument "${n.name}" has unsupported type ${JSON.stringify(n.type)}`,suggestion:"supported argument types are number, string, boolean",context:{name:e.name,argName:n.name,type:n.type}})}if(!y.has(e.returns))throw chunkCO2BI6WL_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has unsupported return type ${JSON.stringify(e.returns)}`,suggestion:"supported return types are number, string, boolean",context:{name:e.name,returns:e.returns}});if(typeof e.call!="function")throw chunkCO2BI6WL_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" is missing a call implementation`,context:{name:e.name}})}function O(e){V(e);let n=e.name,t=`DEFINE_FN_${n.toUpperCase()}`;return {name:`solve-fn-${n}`,lexerVocabulary:{keywords:{[n.toLowerCase()]:t}},prefixParselets:{[t]:new p(n)},pluginFunctions:{[n]:P(e)}}}function h(e={}){let{extraPackages:n=[],...t}=e;return new chunk46QSH527_cjs.n({...t,packages:n.length>0?[...chunkO3AVGIX2_cjs.y,...n]:chunkO3AVGIX2_cjs.y})}Object.defineProperty(exports,"ExpressionEngine",{enumerable:true,get:function(){return chunk46QSH527_cjs.n}});Object.defineProperty(exports,"SNAPSHOT_FORMAT",{enumerable:true,get:function(){return chunk46QSH527_cjs.d}});Object.defineProperty(exports,"SNAPSHOT_VERSION",{enumerable:true,get:function(){return chunk46QSH527_cjs.e}});Object.defineProperty(exports,"SnapshotErrorCodes",{enumerable:true,get:function(){return chunk46QSH527_cjs.f}});Object.defineProperty(exports,"assertEngineVersionCompatible",{enumerable:true,get:function(){return chunk46QSH527_cjs.c}});Object.defineProperty(exports,"checkEngineVersionCompatibility",{enumerable:true,get:function(){return chunk46QSH527_cjs.b}});Object.defineProperty(exports,"checkPackageCompatibility",{enumerable:true,get:function(){return chunk46QSH527_cjs.a}});Object.defineProperty(exports,"ENGINE_VERSION",{enumerable:true,get:function(){return chunkOW2SGORC_cjs.a}});exports.DefineFunctionErrorCodes=r;exports.createEngine=h;exports.defineFunction=O;//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./chunk-
|
|
1
|
+
import'./chunk-ZN33O4AL.js';import'./chunk-RAF57WYO.js';import {n}from'./chunk-P7CQJGNA.js';export{n as ExpressionEngine,d as SNAPSHOT_FORMAT,e as SNAPSHOT_VERSION,f as SnapshotErrorCodes,c as assertEngineVersionCompatible,b as checkEngineVersionCompatibility,a as checkPackageCompatibility}from'./chunk-P7CQJGNA.js';import'./chunk-JVMINMAB.js';import'./chunk-2RWAXT6O.js';import'./chunk-7E7NXKQ5.js';import'./chunk-MIQBJGGR.js';import'./chunk-YBKMCGJ3.js';import'./chunk-JP4JMQOG.js';import'./chunk-QTSDIDAS.js';import'./chunk-XEIDV5JP.js';import {y as y$1}from'./chunk-2BET55VH.js';import'./chunk-MRRMIBHE.js';import'./chunk-CDIHV3ZS.js';import {a}from'./chunk-O3BDXOQJ.js';import'./chunk-DLXG73JZ.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-JMYBZ6JF.js';import'./chunk-EQDT42JG.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-KEA5HRL3.js';import {L,t,n as n$1}from'./chunk-3GR46UOX.js';import'./chunk-6YGRMAQR.js';export{a as ENGINE_VERSION}from'./chunk-OZ5BQSAC.js';import'./chunk-6EPJNHSQ.js';import'./chunk-JPFCXLJV.js';import'./chunk-BB5RRSGS.js';import'./chunk-IJMNVBIS.js';import'./chunk-LHLW7JLS.js';import'./chunk-6NXOKM2O.js';import'./chunk-MDLR2PWN.js';import {c}from'./chunk-PIZQIQVM.js';var r={DEFINE_FUNCTION_INVALID_NAME:"DEFINE_FUNCTION_INVALID_NAME",DEFINE_FUNCTION_INVALID_SPEC:"DEFINE_FUNCTION_INVALID_SPEC",DEFINE_FUNCTION_ARITY_MISMATCH:"DEFINE_FUNCTION_ARITY_MISMATCH",DEFINE_FUNCTION_ARGUMENT_TYPE:"DEFINE_FUNCTION_ARGUMENT_TYPE",DEFINE_FUNCTION_RETURN_TYPE:"DEFINE_FUNCTION_RETURN_TYPE"},b=/^[a-z_][a-z0-9_]*$/i,y=new Set(["number","string","boolean"]);function u(e){return e===1?"1 argument":`${e} arguments`}function f(e){switch(e.type){case 0:case 1:return "a number";case 3:return "a string";case 10:return "a boolean";case 2:return "a big integer";case 5:return "a percentage";case 6:return "a value with a unit";case 4:return "a date";case 7:return "a matrix";case 8:return "a range";case 9:return "a symbolic expression";default:return "an unsupported value"}}function A(e,n,t){switch(n.type){case "number":if(e.type===0||e.type===1)return e.toNumber();break;case "string":if(e.type===3)return e.value;break;case "boolean":if(e.type===10)return e.value;break}throw c.execution({code:r.DEFINE_FUNCTION_ARGUMENT_TYPE,message:`${t}() expects "${n.name}" to be a ${n.type}, but was given ${f(e)}`,expected:`a ${n.type}`,found:f(e),context:{functionName:t,argName:n.name,expectedType:n.type}})}function S(e,n,t$1){switch(n){case "number":if(typeof e=="number")return n$1(e);break;case "string":if(typeof e=="string")return t(e);break;case "boolean":if(typeof e=="boolean")return L(e);break}throw c.internal({code:r.DEFINE_FUNCTION_RETURN_TYPE,message:`${t$1}() is declared to return a ${n}, but its implementation returned ${typeof e}`,expected:`a ${n}`,found:typeof e,context:{functionName:t$1,expectedType:n}})}var p=class{constructor(n){this.fnName=n;this.category="Function";}parse(n,t,i){n.consume("LPAREN");let a$1=0;if(n.peek()?.type!=="RPAREN")for(n.parseExpression(a.Lowest,i),a$1++;n.match("COMMA");)n.parseExpression(a.Lowest,i),a$1++;n.consume("RPAREN"),i.emitPluginCall(this.fnName,a$1);}};function P(e){let n=e.args.length;return t=>{if(t.length!==n)throw c.execution({code:r.DEFINE_FUNCTION_ARITY_MISMATCH,message:`${e.name}() takes ${u(n)}, but was given ${t.length===0?"none":u(t.length)}`,expected:u(n),found:t.length===0?"none":u(t.length),context:{functionName:e.name,expected:n,actual:t.length}});let i=new Array(n);for(let s=0;s<n;s++)i[s]=A(t[s],e.args[s],e.name);let a=e.call(...i);return S(a,e.returns,e.name)}}function V(e){if(typeof e?.name!="string"||!b.test(e.name))throw c.config({code:r.DEFINE_FUNCTION_INVALID_NAME,message:`defineFunction: name must be a single identifier, got ${JSON.stringify(e?.name)}`,suggestion:'e.g. "vat" or "net_price"',context:{name:e?.name}});if(!Array.isArray(e.args))throw c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" args must be an array`,context:{name:e.name}});for(let n of e.args){if(typeof n?.name!="string"||n.name.length===0)throw c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has an argument with no name`,context:{name:e.name}});if(!y.has(n.type))throw c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" argument "${n.name}" has unsupported type ${JSON.stringify(n.type)}`,suggestion:"supported argument types are number, string, boolean",context:{name:e.name,argName:n.name,type:n.type}})}if(!y.has(e.returns))throw c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has unsupported return type ${JSON.stringify(e.returns)}`,suggestion:"supported return types are number, string, boolean",context:{name:e.name,returns:e.returns}});if(typeof e.call!="function")throw c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" is missing a call implementation`,context:{name:e.name}})}function O(e){V(e);let n=e.name,t=`DEFINE_FN_${n.toUpperCase()}`;return {name:`solve-fn-${n}`,lexerVocabulary:{keywords:{[n.toLowerCase()]:t}},prefixParselets:{[t]:new p(n)},pluginFunctions:{[n]:P(e)}}}function h(e={}){let{extraPackages:n$1=[],...t}=e;return new n({...t,packages:n$1.length>0?[...y$1,...n$1]:y$1})}export{r as DefineFunctionErrorCodes,h as createEngine,O as defineFunction};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/language.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkBVSATTRX_cjs=require('./chunk-BVSATTRX.cjs'),chunkY7O4D3BJ_cjs=require('./chunk-Y7O4D3BJ.cjs'),chunkIXOE2BQG_cjs=require('./chunk-IXOE2BQG.cjs');require('./chunk-XB3TWS7J.cjs');var I=50,C={variable:0,function:1,keyword:1,operator:1,comparison:1,bitwise:1,datetime:1,vector:1,unit:2},T=2e3,p=class{constructor(e,o){this.cache=new Map;this.staticCompletionCandidates=null;this.staticCompletionIndex=null;this.engine=e??null,this.variableNameSource=o?.variableNameSource??(()=>this.defaultVariableNames()),this.normalizeForHighlighting=o?.normalizeForHighlighting??false;}defaultVariableNames(){if(!this.engine)return [];let e=this.engine.getDag().getSnapshot(),o=new Set(Object.keys(e.consumers));for(let n of Object.values(e.writes))for(let i of n)o.add(i);return o}classifyNormalized(e){let o=this.engine.getLexer(),n=o.getHighlightTokenObjects(e);if(n.length===0)return [];let i=e.startsWith("> ")&&o.classifyLine(e).skip?e.slice(2):e,r;try{r=this.engine.getNormalizer().normalize(n);}catch{r=n;}let l=[];for(let t of r){let s;if(t.sourceEnd!==void 0)s=t.sourceEnd;else if(i.startsWith(t.text,t.offset))s=t.offset+t.text.length;else continue;l.push({type:t.type,value:t.value,offset:t.offset,col:t.col,length:s-t.offset,category:chunkY7O4D3BJ_cjs.d(t.type)});}return l}getSemanticTokens(e,o){let n=this.cache.get(o);if(n&&n.text===e)return n.bareWordCandidate!==void 0?this.isKnownVariable(n.bareWordCandidate)?n.tokens:[]:n.tokens;if(!this.engine)return [];let i=this.engine.getLexer(),r=this.normalizeForHighlighting?this.classifyNormalized(e):i.getHighlightTokens(e);if(r.length===0)return this.putCache(o,e,[]),[];let l=i.classifyLine(e),t=[];if(l.hasInlineSolve){let s=i.findInlineSolves(e).filter(a=>this.parsesAsExpression(a.expression)).map(a=>({from:a.start,to:a.end}));for(let a of r){if(!a.category)continue;let m=a.offset,f=a.offset+a.length;s.some(u=>m>=u.from&&f<=u.to)&&t.push({from:m,to:f,category:a.category});}}else {let s=e.startsWith("> ")&&l.skip?e.slice(2):e;if(this.parsesAsExpression(s))for(let a of r)a.category&&t.push({from:a.offset,to:a.offset+a.length,category:a.category});}if(t.length===1&&t[0].category==="variable"){let s=e.slice(t[0].from,t[0].to);return this.putCache(o,e,t,s),this.isKnownVariable(s)?t:[]}return this.putCache(o,e,t),t}getCompletions(e,o){let n=/[A-Za-z0-9_]+$/.exec(e.slice(0,o));if(!n)return [];let i=n[0].toLowerCase();if(!this.engine)return [];let r=[];for(let t of this.variableNameSource())t.toLowerCase().startsWith(i)&&r.push({label:t,category:"variable"});let l=this.getStaticCompletionIndex().get(i[0]);if(l)for(let t of l)t.lowerLabel.startsWith(i)&&r.push(t.item);return r.sort((t,s)=>{let a=(C[t.category]??3)-(C[s.category]??3);return a!==0?a:t.label.localeCompare(s.label)}),r.slice(0,I)}getStaticCompletionCandidates(){if(this.staticCompletionCandidates)return this.staticCompletionCandidates;let e=[];for(let[o,n]of Object.entries(this.engine.getLexer().getKeywords())){let i=chunkY7O4D3BJ_cjs.d(n);i&&e.push({label:o,category:i});}for(let o of chunkIXOE2BQG_cjs.a)e.push({label:o,category:"unit",detail:chunkBVSATTRX_cjs.c(o)});return e.push(...this.engine.getPackageCompletionItems()),this.staticCompletionCandidates=e,e}getStaticCompletionIndex(){if(this.staticCompletionIndex)return this.staticCompletionIndex;let e=new Map;for(let o of this.getStaticCompletionCandidates()){let n=o.label.toLowerCase(),i=n[0];if(i===void 0)continue;let r=e.get(i);r===void 0&&(r=[],e.set(i,r)),r.push({item:o,lowerLabel:n});}return this.staticCompletionIndex=e,e}isKnownVariable(e){for(let o of this.variableNameSource())if(o===e)return true;return false}parsesAsExpression(e){return this.engine.tryCompileExpression(e)}putCache(e,o,n,i){if(!this.cache.has(e)&&this.cache.size>=T){let r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r);}this.cache.set(e,{text:o,tokens:n,bareWordCandidate:i});}invalidateLines(e){for(let o of e)this.cache.delete(o);}invalidateCache(){this.cache.clear(),this.staticCompletionCandidates=null,this.staticCompletionIndex=null;}};var y="solve-";function x(c,e=y){return `${e}${c}`}function E(c){return e=>`${c}${e}`}var S={keyword:"keyword",operator:"keyword",comparison:"keyword",bitwise:"keyword",function:"function",variable:"variable",unit:"type",datetime:"keyword",vector:"type"};function w(c){return {label:c.label,type:S[c.category]??"text",detail:c.detail}}Object.defineProperty(exports,"UNCATEGORIZED_TOKEN_TYPES",{enumerable:true,get:function(){return chunkY7O4D3BJ_cjs.a}});Object.defineProperty(exports,"getTokenCategory",{enumerable:true,get:function(){return chunkY7O4D3BJ_cjs.d}});Object.defineProperty(exports,"registerTokenCategory",{enumerable:true,get:function(){return chunkY7O4D3BJ_cjs.b}});Object.defineProperty(exports,"unregisterTokenCategory",{enumerable:true,get:function(){return chunkY7O4D3BJ_cjs.c}});exports.DEFAULT_TOKEN_CLASS_PREFIX=y;exports.LanguageService=p;exports.completionItemToOption=w;exports.createTokenClassName=E;exports.tokenClassName=x;//# sourceMappingURL=language.cjs.map
|
|
2
2
|
//# sourceMappingURL=language.cjs.map
|
package/dist/language.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {c}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-6YGRMAQR.js';import {d}from'./chunk-JPFCXLJV.js';export{a as UNCATEGORIZED_TOKEN_TYPES,d as getTokenCategory,b as registerTokenCategory,c as unregisterTokenCategory}from'./chunk-JPFCXLJV.js';import {a}from'./chunk-6NXOKM2O.js';import'./chunk-MDLR2PWN.js';var I=50,C={variable:0,function:1,keyword:1,operator:1,comparison:1,bitwise:1,datetime:1,vector:1,unit:2},T=2e3,p=class{constructor(e,o){this.cache=new Map;this.staticCompletionCandidates=null;this.staticCompletionIndex=null;this.engine=e??null,this.variableNameSource=o?.variableNameSource??(()=>this.defaultVariableNames()),this.normalizeForHighlighting=o?.normalizeForHighlighting??false;}defaultVariableNames(){if(!this.engine)return [];let e=this.engine.getDag().getSnapshot(),o=new Set(Object.keys(e.consumers));for(let n of Object.values(e.writes))for(let i of n)o.add(i);return o}classifyNormalized(e){let o=this.engine.getLexer(),n=o.getHighlightTokenObjects(e);if(n.length===0)return [];let i=e.startsWith("> ")&&o.classifyLine(e).skip?e.slice(2):e,r;try{r=this.engine.getNormalizer().normalize(n);}catch{r=n;}let l=[];for(let t of r){let s;if(t.sourceEnd!==void 0)s=t.sourceEnd;else if(i.startsWith(t.text,t.offset))s=t.offset+t.text.length;else continue;l.push({type:t.type,value:t.value,offset:t.offset,col:t.col,length:s-t.offset,category:d(t.type)});}return l}getSemanticTokens(e,o){let n=this.cache.get(o);if(n&&n.text===e)return n.bareWordCandidate!==void 0?this.isKnownVariable(n.bareWordCandidate)?n.tokens:[]:n.tokens;if(!this.engine)return [];let i=this.engine.getLexer(),r=this.normalizeForHighlighting?this.classifyNormalized(e):i.getHighlightTokens(e);if(r.length===0)return this.putCache(o,e,[]),[];let l=i.classifyLine(e),t=[];if(l.hasInlineSolve){let s=i.findInlineSolves(e).filter(a=>this.parsesAsExpression(a.expression)).map(a=>({from:a.start,to:a.end}));for(let a of r){if(!a.category)continue;let m=a.offset,f=a.offset+a.length;s.some(u=>m>=u.from&&f<=u.to)&&t.push({from:m,to:f,category:a.category});}}else {let s=e.startsWith("> ")&&l.skip?e.slice(2):e;if(this.parsesAsExpression(s))for(let a of r)a.category&&t.push({from:a.offset,to:a.offset+a.length,category:a.category});}if(t.length===1&&t[0].category==="variable"){let s=e.slice(t[0].from,t[0].to);return this.putCache(o,e,t,s),this.isKnownVariable(s)?t:[]}return this.putCache(o,e,t),t}getCompletions(e,o){let n=/[A-Za-z0-9_]+$/.exec(e.slice(0,o));if(!n)return [];let i=n[0].toLowerCase();if(!this.engine)return [];let r=[];for(let t of this.variableNameSource())t.toLowerCase().startsWith(i)&&r.push({label:t,category:"variable"});let l=this.getStaticCompletionIndex().get(i[0]);if(l)for(let t of l)t.lowerLabel.startsWith(i)&&r.push(t.item);return r.sort((t,s)=>{let a=(C[t.category]??3)-(C[s.category]??3);return a!==0?a:t.label.localeCompare(s.label)}),r.slice(0,I)}getStaticCompletionCandidates(){if(this.staticCompletionCandidates)return this.staticCompletionCandidates;let e=[];for(let[o,n]of Object.entries(this.engine.getLexer().getKeywords())){let i=d(n);i&&e.push({label:o,category:i});}for(let o of a)e.push({label:o,category:"unit",detail:c(o)});return e.push(...this.engine.getPackageCompletionItems()),this.staticCompletionCandidates=e,e}getStaticCompletionIndex(){if(this.staticCompletionIndex)return this.staticCompletionIndex;let e=new Map;for(let o of this.getStaticCompletionCandidates()){let n=o.label.toLowerCase(),i=n[0];if(i===void 0)continue;let r=e.get(i);r===void 0&&(r=[],e.set(i,r)),r.push({item:o,lowerLabel:n});}return this.staticCompletionIndex=e,e}isKnownVariable(e){for(let o of this.variableNameSource())if(o===e)return true;return false}parsesAsExpression(e){return this.engine.tryCompileExpression(e)}putCache(e,o,n,i){if(!this.cache.has(e)&&this.cache.size>=T){let r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r);}this.cache.set(e,{text:o,tokens:n,bareWordCandidate:i});}invalidateLines(e){for(let o of e)this.cache.delete(o);}invalidateCache(){this.cache.clear(),this.staticCompletionCandidates=null,this.staticCompletionIndex=null;}};var y="solve-";function x(c,e=y){return `${e}${c}`}function E(c){return e=>`${c}${e}`}var S={keyword:"keyword",operator:"keyword",comparison:"keyword",bitwise:"keyword",function:"function",variable:"variable",unit:"type",datetime:"keyword",vector:"type"};function w(c){return {label:c.label,type:S[c.category]??"text",detail:c.detail}}export{y as DEFAULT_TOKEN_CLASS_PREFIX,p as LanguageService,w as completionItemToOption,E as createTokenClassName,x as tokenClassName};//# sourceMappingURL=language.js.map
|
|
2
2
|
//# sourceMappingURL=language.js.map
|
package/dist/lexer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkTM752D4J_cjs=require('./chunk-TM752D4J.cjs');require('./chunk-Y7O4D3BJ.cjs');var chunkEAB6SSAV_cjs=require('./chunk-EAB6SSAV.cjs'),chunk5IJD5L3O_cjs=require('./chunk-5IJD5L3O.cjs');require('./chunk-S3DFU33X.cjs');var chunkIXOE2BQG_cjs=require('./chunk-IXOE2BQG.cjs');require('./chunk-XB3TWS7J.cjs'),require('./chunk-CO2BI6WL.cjs');Object.defineProperty(exports,"Lexer",{enumerable:true,get:function(){return chunkTM752D4J_cjs.b}});Object.defineProperty(exports,"LexerState",{enumerable:true,get:function(){return chunkTM752D4J_cjs.a}});Object.defineProperty(exports,"buildTokenLookup",{enumerable:true,get:function(){return chunkTM752D4J_cjs.d}});Object.defineProperty(exports,"sharedLexer",{enumerable:true,get:function(){return chunkTM752D4J_cjs.c}});Object.defineProperty(exports,"ExpressionLexer",{enumerable:true,get:function(){return chunkEAB6SSAV_cjs.b}});Object.defineProperty(exports,"LexerToken",{enumerable:true,get:function(){return chunkEAB6SSAV_cjs.a}});Object.defineProperty(exports,"TokenTypes",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.a}});Object.defineProperty(exports,"registerAllTokenTypes",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.e}});Object.defineProperty(exports,"registerTokenType",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.b}});Object.defineProperty(exports,"tokenTypeId",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.c}});Object.defineProperty(exports,"tokenTypeName",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.d}});Object.defineProperty(exports,"knownUnits",{enumerable:true,get:function(){return chunkIXOE2BQG_cjs.a}});//# sourceMappingURL=lexer.cjs.map
|
|
2
2
|
//# sourceMappingURL=lexer.cjs.map
|
package/dist/lexer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as Lexer,a as LexerState,d as buildTokenLookup,c as sharedLexer}from'./chunk-
|
|
1
|
+
export{b as Lexer,a as LexerState,d as buildTokenLookup,c as sharedLexer}from'./chunk-6EPJNHSQ.js';import'./chunk-JPFCXLJV.js';export{b as ExpressionLexer,a as LexerToken}from'./chunk-BB5RRSGS.js';export{a as TokenTypes,e as registerAllTokenTypes,b as registerTokenType,c as tokenTypeId,d as tokenTypeName}from'./chunk-IJMNVBIS.js';import'./chunk-LHLW7JLS.js';export{a as knownUnits}from'./chunk-6NXOKM2O.js';import'./chunk-MDLR2PWN.js';import'./chunk-PIZQIQVM.js';//# sourceMappingURL=lexer.js.map
|
|
2
2
|
//# sourceMappingURL=lexer.js.map
|
package/dist/normalizer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';require('./chunk-NGBBNL4K.cjs');var
|
|
1
|
+
'use strict';require('./chunk-NGBBNL4K.cjs');var chunkKLPKLTJZ_cjs=require('./chunk-KLPKLTJZ.cjs');require('./chunk-EAB6SSAV.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-IXOE2BQG.cjs'),require('./chunk-XB3TWS7J.cjs'),require('./chunk-CO2BI6WL.cjs');Object.defineProperty(exports,"BUILTIN_PHRASES",{enumerable:true,get:function(){return chunkKLPKLTJZ_cjs.g}});Object.defineProperty(exports,"PhraseTrie",{enumerable:true,get:function(){return chunkKLPKLTJZ_cjs.a}});Object.defineProperty(exports,"TokenNormalizer",{enumerable:true,get:function(){return chunkKLPKLTJZ_cjs.c}});Object.defineProperty(exports,"createBuiltinNormalizerRules",{enumerable:true,get:function(){return chunkKLPKLTJZ_cjs.f}});Object.defineProperty(exports,"createFusedToken",{enumerable:true,get:function(){return chunkKLPKLTJZ_cjs.b}});Object.defineProperty(exports,"implicitMultiplyRule",{enumerable:true,get:function(){return chunkKLPKLTJZ_cjs.d}});//# sourceMappingURL=normalizer.cjs.map
|
|
2
2
|
//# sourceMappingURL=normalizer.cjs.map
|
package/dist/normalizer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./chunk-2RWAXT6O.js';export{g as BUILTIN_PHRASES,a as PhraseTrie,c as TokenNormalizer,f as createBuiltinNormalizerRules,b as createFusedToken,d as implicitMultiplyRule}from'./chunk-
|
|
1
|
+
import'./chunk-2RWAXT6O.js';export{g as BUILTIN_PHRASES,a as PhraseTrie,c as TokenNormalizer,f as createBuiltinNormalizerRules,b as createFusedToken,d as implicitMultiplyRule}from'./chunk-DLXG73JZ.js';import'./chunk-BB5RRSGS.js';import'./chunk-IJMNVBIS.js';import'./chunk-LHLW7JLS.js';import'./chunk-6NXOKM2O.js';import'./chunk-MDLR2PWN.js';import'./chunk-PIZQIQVM.js';//# sourceMappingURL=normalizer.js.map
|
|
2
2
|
//# sourceMappingURL=normalizer.js.map
|
package/dist/packages.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkO3AVGIX2_cjs=require('./chunk-O3AVGIX2.cjs');require('./chunk-TL545PXW.cjs');var chunk53JLDRXA_cjs=require('./chunk-53JLDRXA.cjs');require('./chunk-EN3CDYOS.cjs'),require('./chunk-KLPKLTJZ.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-HCPZRSHR.cjs'),require('./chunk-6YM67DWH.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-J7ABVGZH.cjs'),require('./chunk-75JLWK4L.cjs'),require('./chunk-BVSATTRX.cjs'),require('./chunk-EAB6SSAV.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-IXOE2BQG.cjs'),require('./chunk-XB3TWS7J.cjs'),require('./chunk-CO2BI6WL.cjs');Object.defineProperty(exports,"ARITHMETIC_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.a}});Object.defineProperty(exports,"BIGINT_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.n}});Object.defineProperty(exports,"BUILTIN_PACKAGES",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.y}});Object.defineProperty(exports,"CONDITIONALS_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.o}});Object.defineProperty(exports,"CONVERTERS_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.p}});Object.defineProperty(exports,"CURRENCY_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.j}});Object.defineProperty(exports,"DATETIME_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.d}});Object.defineProperty(exports,"DICE_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.f}});Object.defineProperty(exports,"FINANCE_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.r}});Object.defineProperty(exports,"FUNCTION_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.c}});Object.defineProperty(exports,"LINES_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.v}});Object.defineProperty(exports,"MAPREDUCE_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.m}});Object.defineProperty(exports,"MATHPHRASES_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.q}});Object.defineProperty(exports,"MATRIX_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.l}});Object.defineProperty(exports,"PERCENTAGE_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.b}});Object.defineProperty(exports,"TABLES_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.w}});Object.defineProperty(exports,"TAGS_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.x}});Object.defineProperty(exports,"TIME_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.e}});Object.defineProperty(exports,"UOM_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.h}});Object.defineProperty(exports,"VARIABLES_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.g}});Object.defineProperty(exports,"VECTOR_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.k}});Object.defineProperty(exports,"WEATHER_PACKAGE",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.s}});Object.defineProperty(exports,"createCurrencyPackage",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.i}});Object.defineProperty(exports,"createKnowledgePackage",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.u}});Object.defineProperty(exports,"createStocksPackage",{enumerable:true,get:function(){return chunkO3AVGIX2_cjs.t}});Object.defineProperty(exports,"SYMBOLIC_PACKAGE",{enumerable:true,get:function(){return chunk53JLDRXA_cjs.a}});//# sourceMappingURL=packages.cjs.map
|
|
2
2
|
//# sourceMappingURL=packages.cjs.map
|
package/dist/packages.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as ARITHMETIC_PACKAGE,n as BIGINT_PACKAGE,y as BUILTIN_PACKAGES,o as CONDITIONALS_PACKAGE,p as CONVERTERS_PACKAGE,j as CURRENCY_PACKAGE,d as DATETIME_PACKAGE,f as DICE_PACKAGE,r as FINANCE_PACKAGE,c as FUNCTION_PACKAGE,v as LINES_PACKAGE,m as MAPREDUCE_PACKAGE,q as MATHPHRASES_PACKAGE,l as MATRIX_PACKAGE,b as PERCENTAGE_PACKAGE,w as TABLES_PACKAGE,x as TAGS_PACKAGE,e as TIME_PACKAGE,h as UOM_PACKAGE,g as VARIABLES_PACKAGE,k as VECTOR_PACKAGE,s as WEATHER_PACKAGE,i as createCurrencyPackage,u as createKnowledgePackage,t as createStocksPackage}from'./chunk-
|
|
1
|
+
export{a as ARITHMETIC_PACKAGE,n as BIGINT_PACKAGE,y as BUILTIN_PACKAGES,o as CONDITIONALS_PACKAGE,p as CONVERTERS_PACKAGE,j as CURRENCY_PACKAGE,d as DATETIME_PACKAGE,f as DICE_PACKAGE,r as FINANCE_PACKAGE,c as FUNCTION_PACKAGE,v as LINES_PACKAGE,m as MAPREDUCE_PACKAGE,q as MATHPHRASES_PACKAGE,l as MATRIX_PACKAGE,b as PERCENTAGE_PACKAGE,w as TABLES_PACKAGE,x as TAGS_PACKAGE,e as TIME_PACKAGE,h as UOM_PACKAGE,g as VARIABLES_PACKAGE,k as VECTOR_PACKAGE,s as WEATHER_PACKAGE,i as createCurrencyPackage,u as createKnowledgePackage,t as createStocksPackage}from'./chunk-2BET55VH.js';import'./chunk-MRRMIBHE.js';export{a as SYMBOLIC_PACKAGE}from'./chunk-CDIHV3ZS.js';import'./chunk-O3BDXOQJ.js';import'./chunk-DLXG73JZ.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-JMYBZ6JF.js';import'./chunk-EQDT42JG.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-KEA5HRL3.js';import'./chunk-3GR46UOX.js';import'./chunk-6YGRMAQR.js';import'./chunk-BB5RRSGS.js';import'./chunk-IJMNVBIS.js';import'./chunk-LHLW7JLS.js';import'./chunk-6NXOKM2O.js';import'./chunk-MDLR2PWN.js';import'./chunk-PIZQIQVM.js';//# sourceMappingURL=packages.js.map
|
|
2
2
|
//# sourceMappingURL=packages.js.map
|
package/dist/testing.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk46QSH527_cjs=require('./chunk-46QSH527.cjs');require('./chunk-JYLNQOPU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-LNZNJSRW.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-QD2Z5TDD.cjs'),require('./chunk-HG4NPDN5.cjs'),require('./chunk-H3JXNH7X.cjs'),require('./chunk-R2SZFJTT.cjs');var chunkO3AVGIX2_cjs=require('./chunk-O3AVGIX2.cjs');require('./chunk-TL545PXW.cjs'),require('./chunk-53JLDRXA.cjs'),require('./chunk-EN3CDYOS.cjs'),require('./chunk-KLPKLTJZ.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-HCPZRSHR.cjs'),require('./chunk-6YM67DWH.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-J7ABVGZH.cjs');var chunk75JLWK4L_cjs=require('./chunk-75JLWK4L.cjs');require('./chunk-BVSATTRX.cjs');var chunkOW2SGORC_cjs=require('./chunk-OW2SGORC.cjs');require('./chunk-TM752D4J.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-EAB6SSAV.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-IXOE2BQG.cjs'),require('./chunk-XB3TWS7J.cjs');var chunkCO2BI6WL_cjs=require('./chunk-CO2BI6WL.cjs');var i=class o extends Error{constructor(t){super(t.message),this.name="ExpectationError",this.code=t.code,this.expected=t.expected,this.actual=t.actual,Object.setPrototypeOf(this,o.prototype);}};function V(o=[],t={}){let{locale:e="en",includeBuiltins:r=true}=t,s=new chunk46QSH527_cjs.n({locale:e,packages:r?chunkO3AVGIX2_cjs.y:[]});for(let a of o)s.registerPackage(a);return s}function v(o,t){try{let e=o.evaluateExpression(t);return e.isError()?{status:"error",code:e.errorCode??"",message:e.errorMessage??"",source:e}:e.isPending()?{status:"pending",value:e}:{status:"value",value:e}}catch(e){if(e instanceof chunkCO2BI6WL_cjs.b)return {status:"error",code:e.code,message:e.message,source:e};let r=e instanceof Error?e.message:String(e);return {status:"error",code:"UNKNOWN_ERROR",message:r,source:new chunk75JLWK4L_cjs.m(13,"UNKNOWN_ERROR",r)}}}function x(o,t){if(Object.is(o,t))return true;if(!Number.isFinite(o)||!Number.isFinite(t))return false;let e=1e-9*Math.max(1,Math.abs(o),Math.abs(t));return Math.abs(o-t)<=e}function l(o){return o.type===3?JSON.stringify(o.value):o.type===6&&typeof o.unit=="string"?`${String(o.value)} ${o.unit}`:String(o.value)}function n(o){switch(o.status){case "value":return l(o.value);case "pending":return "a pending async value";case "error":return `an error (${o.code}: ${o.message})`}}var d=class{constructor(t,e){this.expression=t;this.outcome=e;}get value(){if(this.outcome.status==="error")throw new i({code:"EXPECTED_VALUE",message:`Expected "${this.expression}" to evaluate, but it failed with ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this.outcome.value}toEvaluate(){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EVALUATE",message:`Expected "${this.expression}" to evaluate to a value, but got ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this}toEqual(t,e){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but got ${n(this.outcome)}.`,expected:c(t,e),actual:n(this.outcome)});let r=this.outcome.value,s;if(typeof t=="number"?s=x(r.toNumber(),t):typeof t=="boolean"?s=r.type===10&&r.value===t:s=C(r)===t,!s)throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but it was ${l(r)}.`,expected:c(t,e),actual:l(r)});if(e!==void 0&&r.unit!==e)throw new i({code:"EXPECTED_UNIT",message:`Expected "${this.expression}" to carry the unit "${e}", but it was ${r.unit===void 0?"unitless":`"${r.unit}"`}.`,expected:`unit "${e}"`,actual:r.unit===void 0?"no unit":`unit "${r.unit}"`});return this}toBeError(){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_ERROR",message:`Expected "${this.expression}" to fail, but it produced ${n(this.outcome)}.`,expected:"an error",actual:n(this.outcome)});return this}toFailWith(t){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it produced ${n(this.outcome)}.`,expected:`error code "${t}"`,actual:n(this.outcome)});if(this.outcome.code!==t)throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it failed with "${this.outcome.code}" (${this.outcome.message}).`,expected:`error code "${t}"`,actual:`error code "${this.outcome.code}"`});return this}toBePending(){if(this.outcome.status!=="pending")throw new i({code:"EXPECTED_PENDING",message:`Expected "${this.expression}" to be pending, but got ${n(this.outcome)}.`,expected:"a pending async value",actual:n(this.outcome)});return this}};function c(o,t){let e=typeof o=="string"?JSON.stringify(o):String(o);return t===void 0?e:`${e} ${t}`}function C(o){return String(o.value)}function D(o,t){return new d(t,v(o,t))}var O=["a","an","and","or","but","if","then","the","this","that","these","those","in","on","at","to","of","for","from","with","by","as","per","into","over","is","are","was","were","be","been","being","do","does","did","have","has","had","will","would","can","could","should","may","might","must","price","cost","value","total","sum","count","rate","amount","number","time","date","day","week","month","year","hour","minute","second","add","buy","sell","hold","make","take","give","get","set","run","up","down","out","off","all","some","any","no","not","more","less","one","two","three","first","last","next","each","every","here","there"],$=["error","warning","info"];function k(o){let t=[],e=o.lexerVocabulary;if(e?.keywords)for(let[r,s]of Object.entries(e.keywords))t.push({word:r,via:"keyword",tokenType:s});if(e?.units)for(let r of e.units)t.push({word:r,via:"unit"});if(e?.operators)for(let[r,s]of Object.entries(e.operators))t.push({word:r,via:"operator",tokenType:s});if(o.phrases)for(let[r,s]of Object.entries(o.phrases))r.includes(" ")||t.push({word:r,via:"phrase",tokenType:s});return t}var p=class{constructor(t){this.pkg=t;}notToShadow(t=O){let e=new Set(t.map(s=>s.toLowerCase())),r=k(this.pkg).filter(s=>e.has(s.word.toLowerCase()));if(r.length>0){let s=r.map(a=>`"${a.word}" (${a.via})`).join(", ");throw new i({code:"PACKAGE_SHADOWS_PROSE",message:`Package "${this.pkg.name}" claims prose word(s) as syntax: ${s}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,expected:"no prose words claimed as syntax",actual:s})}return r}notToCollideWith(t,e="error"){let r=chunk46QSH527_cjs.a(this.pkg,t),s=$.indexOf(e),a=r.conflicts.filter(u=>$.indexOf(u.severity)<=s);if(a.length>0){let u=a.map(g=>`[${g.severity}] ${g.detail}`).join(`
|
|
2
2
|
`);throw new i({code:"PACKAGE_VOCABULARY_COLLISION",message:`Package "${this.pkg.name}" collides with another package:
|
|
3
|
-
${u}`,expected:`no conflicts at or above "${e}" severity`,actual:`${a.length} conflict(s)`})}return r}toDeclareCompatibleEngineVersion(t=
|
|
3
|
+
${u}`,expected:`no conflicts at or above "${e}" severity`,actual:`${a.length} conflict(s)`})}return r}toDeclareCompatibleEngineVersion(t=chunkOW2SGORC_cjs.a){let e=chunk46QSH527_cjs.b(this.pkg,t);if(!e.compatible){let r=e.reason==="invalid-range"?`its range "${e.declaredRange}" is not valid semver`:`its range "${e.declaredRange}" is not satisfied by engine version "${e.engineVersion}"`;throw new i({code:"PACKAGE_ENGINE_VERSION_INCOMPATIBLE",message:`Package "${this.pkg.name}" declares an engineVersion that will be rejected at registration: ${r}.`,expected:`an engineVersion satisfied by "${t}"`,actual:`"${e.declaredRange}"`})}return this}};function L(o){return new p(o)}exports.COMMON_PROSE_WORDS=O;exports.ExpectationError=i;exports.ExpressionAssertion=d;exports.PackageAssertion=p;exports.createTestEngine=V;exports.expectExpression=D;exports.expectPackage=L;//# sourceMappingURL=testing.cjs.map
|
|
4
4
|
//# sourceMappingURL=testing.cjs.map
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {n as n$1,a,b}from'./chunk-
|
|
1
|
+
import {n as n$1,a,b}from'./chunk-P7CQJGNA.js';import'./chunk-JVMINMAB.js';import'./chunk-2RWAXT6O.js';import'./chunk-7E7NXKQ5.js';import'./chunk-MIQBJGGR.js';import'./chunk-YBKMCGJ3.js';import'./chunk-JP4JMQOG.js';import'./chunk-QTSDIDAS.js';import'./chunk-XEIDV5JP.js';import {y}from'./chunk-2BET55VH.js';import'./chunk-MRRMIBHE.js';import'./chunk-CDIHV3ZS.js';import'./chunk-O3BDXOQJ.js';import'./chunk-DLXG73JZ.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-JMYBZ6JF.js';import'./chunk-EQDT42JG.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-KEA5HRL3.js';import {m}from'./chunk-3GR46UOX.js';import'./chunk-6YGRMAQR.js';import {a as a$1}from'./chunk-OZ5BQSAC.js';import'./chunk-6EPJNHSQ.js';import'./chunk-JPFCXLJV.js';import'./chunk-BB5RRSGS.js';import'./chunk-IJMNVBIS.js';import'./chunk-LHLW7JLS.js';import'./chunk-6NXOKM2O.js';import'./chunk-MDLR2PWN.js';import {b as b$1}from'./chunk-PIZQIQVM.js';var i=class o extends Error{constructor(t){super(t.message),this.name="ExpectationError",this.code=t.code,this.expected=t.expected,this.actual=t.actual,Object.setPrototypeOf(this,o.prototype);}};function V(o=[],t={}){let{locale:e="en",includeBuiltins:r=true}=t,s=new n$1({locale:e,packages:r?y:[]});for(let a of o)s.registerPackage(a);return s}function v(o,t){try{let e=o.evaluateExpression(t);return e.isError()?{status:"error",code:e.errorCode??"",message:e.errorMessage??"",source:e}:e.isPending()?{status:"pending",value:e}:{status:"value",value:e}}catch(e){if(e instanceof b$1)return {status:"error",code:e.code,message:e.message,source:e};let r=e instanceof Error?e.message:String(e);return {status:"error",code:"UNKNOWN_ERROR",message:r,source:new m(13,"UNKNOWN_ERROR",r)}}}function x(o,t){if(Object.is(o,t))return true;if(!Number.isFinite(o)||!Number.isFinite(t))return false;let e=1e-9*Math.max(1,Math.abs(o),Math.abs(t));return Math.abs(o-t)<=e}function l(o){return o.type===3?JSON.stringify(o.value):o.type===6&&typeof o.unit=="string"?`${String(o.value)} ${o.unit}`:String(o.value)}function n(o){switch(o.status){case "value":return l(o.value);case "pending":return "a pending async value";case "error":return `an error (${o.code}: ${o.message})`}}var d=class{constructor(t,e){this.expression=t;this.outcome=e;}get value(){if(this.outcome.status==="error")throw new i({code:"EXPECTED_VALUE",message:`Expected "${this.expression}" to evaluate, but it failed with ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this.outcome.value}toEvaluate(){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EVALUATE",message:`Expected "${this.expression}" to evaluate to a value, but got ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this}toEqual(t,e){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but got ${n(this.outcome)}.`,expected:c(t,e),actual:n(this.outcome)});let r=this.outcome.value,s;if(typeof t=="number"?s=x(r.toNumber(),t):typeof t=="boolean"?s=r.type===10&&r.value===t:s=C(r)===t,!s)throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but it was ${l(r)}.`,expected:c(t,e),actual:l(r)});if(e!==void 0&&r.unit!==e)throw new i({code:"EXPECTED_UNIT",message:`Expected "${this.expression}" to carry the unit "${e}", but it was ${r.unit===void 0?"unitless":`"${r.unit}"`}.`,expected:`unit "${e}"`,actual:r.unit===void 0?"no unit":`unit "${r.unit}"`});return this}toBeError(){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_ERROR",message:`Expected "${this.expression}" to fail, but it produced ${n(this.outcome)}.`,expected:"an error",actual:n(this.outcome)});return this}toFailWith(t){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it produced ${n(this.outcome)}.`,expected:`error code "${t}"`,actual:n(this.outcome)});if(this.outcome.code!==t)throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it failed with "${this.outcome.code}" (${this.outcome.message}).`,expected:`error code "${t}"`,actual:`error code "${this.outcome.code}"`});return this}toBePending(){if(this.outcome.status!=="pending")throw new i({code:"EXPECTED_PENDING",message:`Expected "${this.expression}" to be pending, but got ${n(this.outcome)}.`,expected:"a pending async value",actual:n(this.outcome)});return this}};function c(o,t){let e=typeof o=="string"?JSON.stringify(o):String(o);return t===void 0?e:`${e} ${t}`}function C(o){return String(o.value)}function D(o,t){return new d(t,v(o,t))}var O=["a","an","and","or","but","if","then","the","this","that","these","those","in","on","at","to","of","for","from","with","by","as","per","into","over","is","are","was","were","be","been","being","do","does","did","have","has","had","will","would","can","could","should","may","might","must","price","cost","value","total","sum","count","rate","amount","number","time","date","day","week","month","year","hour","minute","second","add","buy","sell","hold","make","take","give","get","set","run","up","down","out","off","all","some","any","no","not","more","less","one","two","three","first","last","next","each","every","here","there"],$=["error","warning","info"];function k(o){let t=[],e=o.lexerVocabulary;if(e?.keywords)for(let[r,s]of Object.entries(e.keywords))t.push({word:r,via:"keyword",tokenType:s});if(e?.units)for(let r of e.units)t.push({word:r,via:"unit"});if(e?.operators)for(let[r,s]of Object.entries(e.operators))t.push({word:r,via:"operator",tokenType:s});if(o.phrases)for(let[r,s]of Object.entries(o.phrases))r.includes(" ")||t.push({word:r,via:"phrase",tokenType:s});return t}var p=class{constructor(t){this.pkg=t;}notToShadow(t=O){let e=new Set(t.map(s=>s.toLowerCase())),r=k(this.pkg).filter(s=>e.has(s.word.toLowerCase()));if(r.length>0){let s=r.map(a=>`"${a.word}" (${a.via})`).join(", ");throw new i({code:"PACKAGE_SHADOWS_PROSE",message:`Package "${this.pkg.name}" claims prose word(s) as syntax: ${s}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,expected:"no prose words claimed as syntax",actual:s})}return r}notToCollideWith(t,e="error"){let r=a(this.pkg,t),s=$.indexOf(e),a$1=r.conflicts.filter(u=>$.indexOf(u.severity)<=s);if(a$1.length>0){let u=a$1.map(g=>`[${g.severity}] ${g.detail}`).join(`
|
|
2
2
|
`);throw new i({code:"PACKAGE_VOCABULARY_COLLISION",message:`Package "${this.pkg.name}" collides with another package:
|
|
3
3
|
${u}`,expected:`no conflicts at or above "${e}" severity`,actual:`${a$1.length} conflict(s)`})}return r}toDeclareCompatibleEngineVersion(t=a$1){let e=b(this.pkg,t);if(!e.compatible){let r=e.reason==="invalid-range"?`its range "${e.declaredRange}" is not valid semver`:`its range "${e.declaredRange}" is not satisfied by engine version "${e.engineVersion}"`;throw new i({code:"PACKAGE_ENGINE_VERSION_INCOMPATIBLE",message:`Package "${this.pkg.name}" declares an engineVersion that will be rejected at registration: ${r}.`,expected:`an engineVersion satisfied by "${t}"`,actual:`"${e.declaredRange}"`})}return this}};function L(o){return new p(o)}export{O as COMMON_PROSE_WORDS,i as ExpectationError,d as ExpressionAssertion,p as PackageAssertion,V as createTestEngine,D as expectExpression,L as expectPackage};//# sourceMappingURL=testing.js.map
|
|
4
4
|
//# sourceMappingURL=testing.js.map
|
package/dist/uom.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunkTL545PXW_cjs=require('./chunk-TL545PXW.cjs'),chunk6YM67DWH_cjs=require('./chunk-6YM67DWH.cjs');require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-75JLWK4L.cjs');var
|
|
1
|
+
'use strict';var chunkTL545PXW_cjs=require('./chunk-TL545PXW.cjs'),chunk6YM67DWH_cjs=require('./chunk-6YM67DWH.cjs');require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-75JLWK4L.cjs');var chunkBVSATTRX_cjs=require('./chunk-BVSATTRX.cjs');require('./chunk-XB3TWS7J.cjs'),require('./chunk-CO2BI6WL.cjs');Object.defineProperty(exports,"CurrencyAsyncResolver",{enumerable:true,get:function(){return chunkTL545PXW_cjs.b}});Object.defineProperty(exports,"CurrencyExchangeService",{enumerable:true,get:function(){return chunk6YM67DWH_cjs.a}});Object.defineProperty(exports,"currencyExchangeService",{enumerable:true,get:function(){return chunk6YM67DWH_cjs.b}});Object.defineProperty(exports,"sharedCurrencyExchange",{enumerable:true,get:function(){return chunk6YM67DWH_cjs.c}});Object.defineProperty(exports,"canConvert",{enumerable:true,get:function(){return chunkBVSATTRX_cjs.d}});Object.defineProperty(exports,"convertUnit",{enumerable:true,get:function(){return chunkBVSATTRX_cjs.e}});Object.defineProperty(exports,"getBestUnit",{enumerable:true,get:function(){return chunkBVSATTRX_cjs.h}});Object.defineProperty(exports,"getMeasure",{enumerable:true,get:function(){return chunkBVSATTRX_cjs.c}});Object.defineProperty(exports,"isConvertibleUnit",{enumerable:true,get:function(){return chunkBVSATTRX_cjs.g}});Object.defineProperty(exports,"resolveUnit",{enumerable:true,get:function(){return chunkBVSATTRX_cjs.b}});//# sourceMappingURL=uom.cjs.map
|
|
2
2
|
//# sourceMappingURL=uom.cjs.map
|
package/dist/uom.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as CurrencyAsyncResolver}from'./chunk-MRRMIBHE.js';export{a as CurrencyExchangeService,b as currencyExchangeService,c as sharedCurrencyExchange}from'./chunk-EQDT42JG.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-3GR46UOX.js';export{d as canConvert,e as convertUnit,h as getBestUnit,c as getMeasure,g as isConvertibleUnit,b as resolveUnit}from'./chunk-
|
|
1
|
+
export{b as CurrencyAsyncResolver}from'./chunk-MRRMIBHE.js';export{a as CurrencyExchangeService,b as currencyExchangeService,c as sharedCurrencyExchange}from'./chunk-EQDT42JG.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-3GR46UOX.js';export{d as canConvert,e as convertUnit,h as getBestUnit,c as getMeasure,g as isConvertibleUnit,b as resolveUnit}from'./chunk-6YGRMAQR.js';import'./chunk-MDLR2PWN.js';import'./chunk-PIZQIQVM.js';//# sourceMappingURL=uom.js.map
|
|
2
2
|
//# sourceMappingURL=uom.js.map
|
package/dist/vm.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkQD2Z5TDD_cjs=require('./chunk-QD2Z5TDD.cjs');require('./chunk-HG4NPDN5.cjs');var chunkHCPZRSHR_cjs=require('./chunk-HCPZRSHR.cjs');require('./chunk-6YM67DWH.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-J7ABVGZH.cjs');var chunk75JLWK4L_cjs=require('./chunk-75JLWK4L.cjs');require('./chunk-BVSATTRX.cjs'),require('./chunk-XB3TWS7J.cjs'),require('./chunk-CO2BI6WL.cjs');var l=class{constructor(t){this.checkpoints=[];this.vm=t;}snapshot(t,n,e){if(e.length===0)return null;let r=this.checkpoints.length>0?this.checkpoints[this.checkpoints.length-1]:null,o=Object.create(r?.variables??null),i=Object.create(r?.functions??null);for(let s of e){if(this.vm.hasUserFunction(s)){let p=this.vm.getUserFunction(s);p&&(i[s]=p);continue}let u=this.vm.getVar(s);u!==void 0&&(o[s]=u);}let c={lineNumber:t,lineId:n,variables:o,functions:i,parent:r};return this.checkpoints.push(c),c}restoreTo(t){let n=this.getNearestCheckpoint(t);if(!n){this.vm.reset();return}let e=[],r=n;for(;r;)e.unshift(r),r=r.parent;this.vm.reset();for(let o of e){for(let i of Object.keys(o.variables))this.vm.setVar(i,o.variables[i]);for(let i of Object.keys(o.functions)){let c=o.functions[i];this.vm.defineUserFunction(c.name,c.params,c.program);}}}getNearestCheckpoint(t){let n=null;for(let e of this.checkpoints)if(e.lineNumber<=t)n=e;else break;return n}getCheckpointAt(t){return this.checkpoints.find(n=>n.lineNumber===t)}getAllCheckpoints(){return this.checkpoints}lookupVariable(t){if(this.checkpoints.length===0)return;let e=this.checkpoints[this.checkpoints.length-1].variables;for(;e;){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];e=Object.getPrototypeOf(e);}}clear(){this.checkpoints=[];}get count(){return this.checkpoints.length}get isEmpty(){return this.checkpoints.length===0}get vmInstance(){return this.vm}};Object.defineProperty(exports,"DependencyGraph",{enumerable:true,get:function(){return chunkQD2Z5TDD_cjs.a}});Object.defineProperty(exports,"ScopeManager",{enumerable:true,get:function(){return chunkQD2Z5TDD_cjs.b}});Object.defineProperty(exports,"createVM",{enumerable:true,get:function(){return chunkQD2Z5TDD_cjs.c}});Object.defineProperty(exports,"executeBytecode",{enumerable:true,get:function(){return chunkQD2Z5TDD_cjs.d}});Object.defineProperty(exports,"OpRegistry",{enumerable:true,get:function(){return chunkHCPZRSHR_cjs.v}});Object.defineProperty(exports,"allocatePluginFunctionIndex",{enumerable:true,get:function(){return chunkHCPZRSHR_cjs.E}});Object.defineProperty(exports,"binaryOp",{enumerable:true,get:function(){return chunkHCPZRSHR_cjs.u}});Object.defineProperty(exports,"builtinFunctions",{enumerable:true,get:function(){return chunkHCPZRSHR_cjs.C}});Object.defineProperty(exports,"pluginFunctionIndexFor",{enumerable:true,get:function(){return chunkHCPZRSHR_cjs.F}});Object.defineProperty(exports,"pluginFunctionRegistry",{enumerable:true,get:function(){return chunkHCPZRSHR_cjs.D}});Object.defineProperty(exports,"sharedOpRegistry",{enumerable:true,get:function(){return chunkHCPZRSHR_cjs.w}});Object.defineProperty(exports,"unifyUom",{enumerable:true,get:function(){return chunkHCPZRSHR_cjs.j}});Object.defineProperty(exports,"Value",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.m}});Object.defineProperty(exports,"ValueType",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.g}});Object.defineProperty(exports,"bigIntValue",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.s}});Object.defineProperty(exports,"chargeAllocation",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.c}});Object.defineProperty(exports,"checkAllocation",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.d}});Object.defineProperty(exports,"checkedArray",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.e}});Object.defineProperty(exports,"colVectorValue",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.E}});Object.defineProperty(exports,"hexValue",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.r}});Object.defineProperty(exports,"matrixValue",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.C}});Object.defineProperty(exports,"numberValue",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.n}});Object.defineProperty(exports,"rangeValue",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.F}});Object.defineProperty(exports,"rowVectorValue",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.D}});Object.defineProperty(exports,"stringValue",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.t}});Object.defineProperty(exports,"uomValue",{enumerable:true,get:function(){return chunk75JLWK4L_cjs.u}});exports.VMCheckpointer=l;//# sourceMappingURL=vm.cjs.map
|
|
2
2
|
//# sourceMappingURL=vm.cjs.map
|
package/dist/vm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as DependencyGraph,b as ScopeManager,c as createVM,d as executeBytecode}from'./chunk-
|
|
1
|
+
export{a as DependencyGraph,b as ScopeManager,c as createVM,d as executeBytecode}from'./chunk-YBKMCGJ3.js';import'./chunk-JP4JMQOG.js';export{v as OpRegistry,E as allocatePluginFunctionIndex,u as binaryOp,C as builtinFunctions,F as pluginFunctionIndexFor,D as pluginFunctionRegistry,w as sharedOpRegistry,j as unifyUom}from'./chunk-JMYBZ6JF.js';import'./chunk-EQDT42JG.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-KEA5HRL3.js';export{m as Value,g as ValueType,s as bigIntValue,c as chargeAllocation,d as checkAllocation,e as checkedArray,E as colVectorValue,r as hexValue,C as matrixValue,n as numberValue,F as rangeValue,D as rowVectorValue,t as stringValue,u as uomValue}from'./chunk-3GR46UOX.js';import'./chunk-6YGRMAQR.js';import'./chunk-MDLR2PWN.js';import'./chunk-PIZQIQVM.js';var l=class{constructor(t){this.checkpoints=[];this.vm=t;}snapshot(t,n,e){if(e.length===0)return null;let r=this.checkpoints.length>0?this.checkpoints[this.checkpoints.length-1]:null,o=Object.create(r?.variables??null),i=Object.create(r?.functions??null);for(let s of e){if(this.vm.hasUserFunction(s)){let p=this.vm.getUserFunction(s);p&&(i[s]=p);continue}let u=this.vm.getVar(s);u!==void 0&&(o[s]=u);}let c={lineNumber:t,lineId:n,variables:o,functions:i,parent:r};return this.checkpoints.push(c),c}restoreTo(t){let n=this.getNearestCheckpoint(t);if(!n){this.vm.reset();return}let e=[],r=n;for(;r;)e.unshift(r),r=r.parent;this.vm.reset();for(let o of e){for(let i of Object.keys(o.variables))this.vm.setVar(i,o.variables[i]);for(let i of Object.keys(o.functions)){let c=o.functions[i];this.vm.defineUserFunction(c.name,c.params,c.program);}}}getNearestCheckpoint(t){let n=null;for(let e of this.checkpoints)if(e.lineNumber<=t)n=e;else break;return n}getCheckpointAt(t){return this.checkpoints.find(n=>n.lineNumber===t)}getAllCheckpoints(){return this.checkpoints}lookupVariable(t){if(this.checkpoints.length===0)return;let e=this.checkpoints[this.checkpoints.length-1].variables;for(;e;){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];e=Object.getPrototypeOf(e);}}clear(){this.checkpoints=[];}get count(){return this.checkpoints.length}get isEmpty(){return this.checkpoints.length===0}get vmInstance(){return this.vm}};export{l as VMCheckpointer};//# sourceMappingURL=vm.js.map
|
|
2
2
|
//# sourceMappingURL=vm.js.map
|
package/dist/worker.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var chunk3SSMOVWB_cjs=require('./chunk-3SSMOVWB.cjs'),
|
|
2
|
-
`).forEach((u,d)=>a.set(d+1,u)):o.method==="evaluateLines"?o.args[0].forEach((u,d)=>a.set(d+1,u)):a.set(-1,o.args[0]),a},q=(o,a)=>{if(a.type==="error"){g({kind:"async-error",queryKey:a.queryKey,packageId:a.packageId,error:chunk3SSMOVWB_cjs.b(chunkCO2BI6WL_cjs.d(a.error))});return}let u=[];for(let d of a.lineNumbers){let f=l.get(d);if(f!==void 0)try{let L=o.evaluateLine(d,f);L&&u.push({lineNumber:d,value:m(L,s)});}catch{}}u.length>0&&g({kind:"async-update",lines:u});},F=o=>{c?.();let a=o.getEventStream().getReader();c=()=>{a.cancel();},(async()=>{try{for(;;){let{done:u,value:d}=await a.read();if(u)return;q(o,d);}}catch{}})();},D=o=>{try{let a=H(n,o.packages);t=new
|
|
1
|
+
'use strict';var chunk3SSMOVWB_cjs=require('./chunk-3SSMOVWB.cjs'),chunk46QSH527_cjs=require('./chunk-46QSH527.cjs');require('./chunk-JYLNQOPU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-LNZNJSRW.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-QD2Z5TDD.cjs'),require('./chunk-HG4NPDN5.cjs');var chunkH3JXNH7X_cjs=require('./chunk-H3JXNH7X.cjs');require('./chunk-R2SZFJTT.cjs');var chunkO3AVGIX2_cjs=require('./chunk-O3AVGIX2.cjs');require('./chunk-TL545PXW.cjs'),require('./chunk-53JLDRXA.cjs'),require('./chunk-EN3CDYOS.cjs'),require('./chunk-KLPKLTJZ.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-HCPZRSHR.cjs'),require('./chunk-6YM67DWH.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs');var chunk5TVI2UPZ_cjs=require('./chunk-5TVI2UPZ.cjs'),chunkJ7ABVGZH_cjs=require('./chunk-J7ABVGZH.cjs');require('./chunk-75JLWK4L.cjs'),require('./chunk-BVSATTRX.cjs'),require('./chunk-OW2SGORC.cjs'),require('./chunk-TM752D4J.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-EAB6SSAV.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-IXOE2BQG.cjs'),require('./chunk-XB3TWS7J.cjs');var chunkCO2BI6WL_cjs=require('./chunk-CO2BI6WL.cjs');var W=class{constructor(r){this.nextId=1;this.pending=new Map;this.resolvedListeners=new Set;this.asyncErrorListeners=new Set;this.terminated=false;this.transport=r,this.transport.onMessage(n=>this.onMessage(n));}init(r){let n=this.nextId++;return new Promise((t,s)=>{this.pending.set(n,{resolve:()=>t(),reject:s}),this.transport.postMessage({kind:"init",id:n,localeCode:r.localeCode,diagnostics:r.diagnostics,config:r.config,packages:r.packages,formatting:r.formatting});})}parseDocument(r,n){let{signal:t,...s}=n??{},i=Object.keys(s).length>0?s:void 0;return this.call("parseDocument",[r,i],t)}evaluateLines(r,n){return this.call("evaluateLines",[r],n?.signal)}evaluateExpression(r,n){return this.call("evaluateExpression",[r],n?.signal)}onResolved(r){return this.resolvedListeners.add(r),()=>this.resolvedListeners.delete(r)}onAsyncError(r){return this.asyncErrorListeners.add(r),()=>this.asyncErrorListeners.delete(r)}terminate(){if(this.terminated)return;this.terminated=true;let r=chunk3SSMOVWB_cjs.e();for(let n of this.pending.values())this.unhook(n),n.reject(r);this.pending.clear(),this.resolvedListeners.clear(),this.asyncErrorListeners.clear(),this.transport.terminate();}call(r,n,t){if(this.terminated)return Promise.reject(chunk3SSMOVWB_cjs.e());if(t?.aborted)return Promise.reject(chunk3SSMOVWB_cjs.d(r));let s=this.nextId++;return new Promise((i,l)=>{let p={resolve:i,reject:l};if(t){let c=()=>{this.pending.has(s)&&(this.pending.delete(s),this.transport.postMessage({kind:"cancel",id:s}),l(chunk3SSMOVWB_cjs.d(r)));};p.signal=t,p.onAbort=c,t.addEventListener("abort",c,{once:true});}this.pending.set(s,p),this.transport.postMessage({kind:"request",id:s,method:r,args:n});})}onMessage(r){let n=r;switch(n.kind){case "ready":case "result":{let t=n.kind==="result"?n.value:void 0;this.settle(n.id,s=>s.resolve(t));break}case "error":this.settle(n.id,t=>t.reject(chunk3SSMOVWB_cjs.c(n.error)));break;case "async-update":for(let t of [...this.resolvedListeners])t(n.lines);break;case "async-error":for(let t of [...this.asyncErrorListeners])t({queryKey:n.queryKey,packageId:n.packageId,error:chunk3SSMOVWB_cjs.c(n.error)});break}}settle(r,n){let t=this.pending.get(r);t&&(this.pending.delete(r),this.unhook(t),n(t));}unhook(r){r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort);}};async function K(e){let r=new W(e.transport);return await r.init(e),r}function C(e){return e>0?"Infinity":e<0?"-Infinity":"NaN"}function U(e){let r=e.data.map(n=>typeof n=="object"&&n!==null?chunkJ7ABVGZH_cjs.R(n):typeof n=="number"&&!Number.isFinite(n)?C(n):n);return {rows:e.rows,cols:e.cols,cells:r,hasSymbolic:e.hasSymbolic}}function m(e,r){let n=e.toNumber(),t={type:e.type,text:chunkH3JXNH7X_cjs.c(e,r),number:Number.isFinite(n)?n:0};Number.isFinite(n)||(t.nonFinite=C(n)),e.unit!==void 0&&(t.unit=e.unit),e.timedOut!==void 0&&(t.timedOut=e.timedOut);let s=e.value;if(typeof s=="bigint")t.bigint=s.toString();else if(e.type===7)t.matrix=U(s);else if(e.type===8){let i=s;t.range={min:i.min,max:i.max};}else if(e.type===14){let i=s;t.colour={hex:chunk5TVI2UPZ_cjs.f(i),r:i.r,g:i.g,b:i.b,a:i.a,format:i.format,css:chunk5TVI2UPZ_cjs.g(i)};}else if(e.type===16){let i=s;t.chart={kind:i.kind,points:i.points.map(l=>[l[0],l[1]]),label:i.label,domain:[i.domain[0],i.domain[1]],range:[i.range[0],i.range[1]],...i.expr!==void 0?{expr:i.expr}:{}};}else if(e.type===17){let i=s;t.ipCidr={...i.addr!==void 0?{addr:i.addr}:{},...i.prefix!==void 0?{prefix:i.prefix}:{},text:chunkH3JXNH7X_cjs.c(e).replace(/^=\s*/,"")};}return t}function O(e,r){return e?m(e,r):null}function _(e,r){return {start:e.start,end:e.end,expression:e.expression,lineNumber:e.lineNumber,columnNumber:e.columnNumber,result:O(e.result,r),error:e.error??null}}function y(e,r){return {lineNumber:e.lineNumber,text:e.text,startPosition:e.startPosition,endPosition:e.endPosition,isEmpty:e.isEmpty,hasInlineSolves:e.hasInlineSolves,inlineSolves:e.inlineSolves.map(n=>_(n,r)),expression:e.expression,result:O(e.result,r),error:e.error}}function R(e,r){let n={lines:e.lines.map(t=>y(t,r)),totalLines:e.totalLines,errors:[...e.errors]};return e.diagnostics!==void 0&&(n.diagnostics=e.diagnostics),n}function H(e,r){if(r===void 0)return e;let n=new Map(e.map(s=>[s.name,s])),t=[];for(let s of r){let i=n.get(s);if(!i)throw chunkCO2BI6WL_cjs.c.config(chunk3SSMOVWB_cjs.a.WORKER_UNKNOWN_PACKAGE,`No package named "${s}" is available in this worker runtime`,{name:s,available:[...n.keys()]});t.push(i);}return t}function B(e,r={}){let n=r.packages??chunkO3AVGIX2_cjs.y,t=null,s,i=new Map,l=new Map,p=null,c=null,g=o=>e.postMessage(o),h=(o,a)=>{g({kind:"error",id:o,error:chunk3SSMOVWB_cjs.b(chunkCO2BI6WL_cjs.d(a))});},N=o=>{let a=new Map;return o.method==="parseDocument"?o.args[0].split(`
|
|
2
|
+
`).forEach((u,d)=>a.set(d+1,u)):o.method==="evaluateLines"?o.args[0].forEach((u,d)=>a.set(d+1,u)):a.set(-1,o.args[0]),a},q=(o,a)=>{if(a.type==="error"){g({kind:"async-error",queryKey:a.queryKey,packageId:a.packageId,error:chunk3SSMOVWB_cjs.b(chunkCO2BI6WL_cjs.d(a.error))});return}let u=[];for(let d of a.lineNumbers){let f=l.get(d);if(f!==void 0)try{let L=o.evaluateLine(d,f);L&&u.push({lineNumber:d,value:m(L,s)});}catch{}}u.length>0&&g({kind:"async-update",lines:u});},F=o=>{c?.();let a=o.getEventStream().getReader();c=()=>{a.cancel();},(async()=>{try{for(;;){let{done:u,value:d}=await a.read();if(u)return;q(o,d);}}catch{}})();},D=o=>{try{let a=H(n,o.packages);t=new chunk46QSH527_cjs.n({locale:o.localeCode??"en",diagnostics:o.diagnostics??!1,config:o.config,packages:a}),s=o.formatting,F(t),g({kind:"ready",id:o.id});}catch(a){h(o.id,a);}},V=(o,a)=>{let{method:u,args:d}=a;switch(u){case "parseDocument":return R(o.parseDocument(d[0],d[1]),s);case "evaluateLines":return o.evaluateLines(d[0]).map(f=>y(f,s));case "evaluateExpression":return m(o.evaluateExpression(d[0]),s);default:throw chunkCO2BI6WL_cjs.c.execution(chunk3SSMOVWB_cjs.a.WORKER_UNKNOWN_METHOD,`The worker runtime has no method named "${String(u)}"`,{method:u})}},j=o=>{let a=t;if(!a){h(o.id,chunkCO2BI6WL_cjs.c.execution(chunk3SSMOVWB_cjs.a.WORKER_NOT_INITIALISED,"The worker received a request before its engine finished initialising"));return}p?.abort();let u=new AbortController;p=u,l=N(o),i.set(o.id,u),a.setKeystrokeSignal(u.signal);try{let d=V(a,o);g({kind:"result",id:o.id,value:d});}catch(d){h(o.id,d);}finally{i.delete(o.id),a.setKeystrokeSignal(null);}};return e.onMessage(o=>{let a=o;switch(a.kind){case "init":D(a);break;case "request":j(a);break;case "cancel":i.get(a.id)?.abort();break}}),()=>{c?.(),c=null,p?.abort(),p=null,l=new Map;for(let o of i.values())o.abort();i.clear(),t?.clear(),t=null,e.terminate();}}function G(e){return typeof globalThis.structuredClone=="function"?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e))}function J(){let e=null,r=null,n=true,t=(l,p)=>{let c=G(p);queueMicrotask(()=>{n&&l()?.(c);});};return {client:{postMessage:l=>t(()=>r,l),onMessage:l=>{e=l;},terminate:()=>{n=false;}},host:{postMessage:l=>t(()=>e,l),onMessage:l=>{r=l;},terminate:()=>{n=false;}}}}function $(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{let n=t=>r(t.data);typeof e.addEventListener=="function"?e.addEventListener("message",n):e.onmessage=n,e.start?.();},terminate:()=>{e.terminate?.(),e.close?.();}}}function Q(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{e.on("message",n=>r(n));},terminate:()=>{e.terminate?.(),e.close?.();}}}exports.createLinkedTransports=J;exports.createWorkerEngine=K;exports.eventTargetTransport=$;exports.messagePortTransport=Q;exports.serializeParsedLine=y;exports.serializeParsingResult=R;exports.serializeValue=m;exports.startWorkerRuntime=B;//# sourceMappingURL=worker.cjs.map
|
|
3
3
|
//# sourceMappingURL=worker.cjs.map
|
package/dist/worker.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {a,e,d,c as c$2,b}from'./chunk-4ETS224G.js';import {n}from'./chunk-
|
|
1
|
+
import {a,e,d,c as c$2,b}from'./chunk-4ETS224G.js';import {n}from'./chunk-P7CQJGNA.js';import'./chunk-JVMINMAB.js';import'./chunk-2RWAXT6O.js';import'./chunk-7E7NXKQ5.js';import'./chunk-MIQBJGGR.js';import'./chunk-YBKMCGJ3.js';import'./chunk-JP4JMQOG.js';import {c}from'./chunk-QTSDIDAS.js';import'./chunk-XEIDV5JP.js';import {y as y$1}from'./chunk-2BET55VH.js';import'./chunk-MRRMIBHE.js';import'./chunk-CDIHV3ZS.js';import'./chunk-O3BDXOQJ.js';import'./chunk-DLXG73JZ.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-JMYBZ6JF.js';import'./chunk-EQDT42JG.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import {g,f}from'./chunk-5TCSFTZD.js';import {R as R$1}from'./chunk-KEA5HRL3.js';import'./chunk-3GR46UOX.js';import'./chunk-6YGRMAQR.js';import'./chunk-OZ5BQSAC.js';import'./chunk-6EPJNHSQ.js';import'./chunk-JPFCXLJV.js';import'./chunk-BB5RRSGS.js';import'./chunk-IJMNVBIS.js';import'./chunk-LHLW7JLS.js';import'./chunk-6NXOKM2O.js';import'./chunk-MDLR2PWN.js';import {c as c$1,d as d$1}from'./chunk-PIZQIQVM.js';var W=class{constructor(r){this.nextId=1;this.pending=new Map;this.resolvedListeners=new Set;this.asyncErrorListeners=new Set;this.terminated=false;this.transport=r,this.transport.onMessage(n=>this.onMessage(n));}init(r){let n=this.nextId++;return new Promise((t,s)=>{this.pending.set(n,{resolve:()=>t(),reject:s}),this.transport.postMessage({kind:"init",id:n,localeCode:r.localeCode,diagnostics:r.diagnostics,config:r.config,packages:r.packages,formatting:r.formatting});})}parseDocument(r,n){let{signal:t,...s}=n??{},i=Object.keys(s).length>0?s:void 0;return this.call("parseDocument",[r,i],t)}evaluateLines(r,n){return this.call("evaluateLines",[r],n?.signal)}evaluateExpression(r,n){return this.call("evaluateExpression",[r],n?.signal)}onResolved(r){return this.resolvedListeners.add(r),()=>this.resolvedListeners.delete(r)}onAsyncError(r){return this.asyncErrorListeners.add(r),()=>this.asyncErrorListeners.delete(r)}terminate(){if(this.terminated)return;this.terminated=true;let r=e();for(let n of this.pending.values())this.unhook(n),n.reject(r);this.pending.clear(),this.resolvedListeners.clear(),this.asyncErrorListeners.clear(),this.transport.terminate();}call(r,n,t){if(this.terminated)return Promise.reject(e());if(t?.aborted)return Promise.reject(d(r));let s=this.nextId++;return new Promise((i,l)=>{let p={resolve:i,reject:l};if(t){let c=()=>{this.pending.has(s)&&(this.pending.delete(s),this.transport.postMessage({kind:"cancel",id:s}),l(d(r)));};p.signal=t,p.onAbort=c,t.addEventListener("abort",c,{once:true});}this.pending.set(s,p),this.transport.postMessage({kind:"request",id:s,method:r,args:n});})}onMessage(r){let n=r;switch(n.kind){case "ready":case "result":{let t=n.kind==="result"?n.value:void 0;this.settle(n.id,s=>s.resolve(t));break}case "error":this.settle(n.id,t=>t.reject(c$2(n.error)));break;case "async-update":for(let t of [...this.resolvedListeners])t(n.lines);break;case "async-error":for(let t of [...this.asyncErrorListeners])t({queryKey:n.queryKey,packageId:n.packageId,error:c$2(n.error)});break}}settle(r,n){let t=this.pending.get(r);t&&(this.pending.delete(r),this.unhook(t),n(t));}unhook(r){r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort);}};async function K(e){let r=new W(e.transport);return await r.init(e),r}function C(e){return e>0?"Infinity":e<0?"-Infinity":"NaN"}function U(e){let r=e.data.map(n=>typeof n=="object"&&n!==null?R$1(n):typeof n=="number"&&!Number.isFinite(n)?C(n):n);return {rows:e.rows,cols:e.cols,cells:r,hasSymbolic:e.hasSymbolic}}function m(e,r){let n=e.toNumber(),t={type:e.type,text:c(e,r),number:Number.isFinite(n)?n:0};Number.isFinite(n)||(t.nonFinite=C(n)),e.unit!==void 0&&(t.unit=e.unit),e.timedOut!==void 0&&(t.timedOut=e.timedOut);let s=e.value;if(typeof s=="bigint")t.bigint=s.toString();else if(e.type===7)t.matrix=U(s);else if(e.type===8){let i=s;t.range={min:i.min,max:i.max};}else if(e.type===14){let i=s;t.colour={hex:f(i),r:i.r,g:i.g,b:i.b,a:i.a,format:i.format,css:g(i)};}else if(e.type===16){let i=s;t.chart={kind:i.kind,points:i.points.map(l=>[l[0],l[1]]),label:i.label,domain:[i.domain[0],i.domain[1]],range:[i.range[0],i.range[1]],...i.expr!==void 0?{expr:i.expr}:{}};}else if(e.type===17){let i=s;t.ipCidr={...i.addr!==void 0?{addr:i.addr}:{},...i.prefix!==void 0?{prefix:i.prefix}:{},text:c(e).replace(/^=\s*/,"")};}return t}function O(e,r){return e?m(e,r):null}function _(e,r){return {start:e.start,end:e.end,expression:e.expression,lineNumber:e.lineNumber,columnNumber:e.columnNumber,result:O(e.result,r),error:e.error??null}}function y(e,r){return {lineNumber:e.lineNumber,text:e.text,startPosition:e.startPosition,endPosition:e.endPosition,isEmpty:e.isEmpty,hasInlineSolves:e.hasInlineSolves,inlineSolves:e.inlineSolves.map(n=>_(n,r)),expression:e.expression,result:O(e.result,r),error:e.error}}function R(e,r){let n={lines:e.lines.map(t=>y(t,r)),totalLines:e.totalLines,errors:[...e.errors]};return e.diagnostics!==void 0&&(n.diagnostics=e.diagnostics),n}function H(e,r){if(r===void 0)return e;let n=new Map(e.map(s=>[s.name,s])),t=[];for(let s of r){let i=n.get(s);if(!i)throw c$1.config(a.WORKER_UNKNOWN_PACKAGE,`No package named "${s}" is available in this worker runtime`,{name:s,available:[...n.keys()]});t.push(i);}return t}function B(e,r={}){let n$1=r.packages??y$1,t=null,s,i=new Map,l=new Map,p=null,c=null,g=o=>e.postMessage(o),h=(o,a)=>{g({kind:"error",id:o,error:b(d$1(a))});},N=o=>{let a=new Map;return o.method==="parseDocument"?o.args[0].split(`
|
|
2
2
|
`).forEach((u,d)=>a.set(d+1,u)):o.method==="evaluateLines"?o.args[0].forEach((u,d)=>a.set(d+1,u)):a.set(-1,o.args[0]),a},q=(o,a)=>{if(a.type==="error"){g({kind:"async-error",queryKey:a.queryKey,packageId:a.packageId,error:b(d$1(a.error))});return}let u=[];for(let d of a.lineNumbers){let f=l.get(d);if(f!==void 0)try{let L=o.evaluateLine(d,f);L&&u.push({lineNumber:d,value:m(L,s)});}catch{}}u.length>0&&g({kind:"async-update",lines:u});},F=o=>{c?.();let a=o.getEventStream().getReader();c=()=>{a.cancel();},(async()=>{try{for(;;){let{done:u,value:d}=await a.read();if(u)return;q(o,d);}}catch{}})();},D=o=>{try{let a=H(n$1,o.packages);t=new n({locale:o.localeCode??"en",diagnostics:o.diagnostics??!1,config:o.config,packages:a}),s=o.formatting,F(t),g({kind:"ready",id:o.id});}catch(a){h(o.id,a);}},V=(o,a$1)=>{let{method:u,args:d}=a$1;switch(u){case "parseDocument":return R(o.parseDocument(d[0],d[1]),s);case "evaluateLines":return o.evaluateLines(d[0]).map(f=>y(f,s));case "evaluateExpression":return m(o.evaluateExpression(d[0]),s);default:throw c$1.execution(a.WORKER_UNKNOWN_METHOD,`The worker runtime has no method named "${String(u)}"`,{method:u})}},j=o=>{let a$1=t;if(!a$1){h(o.id,c$1.execution(a.WORKER_NOT_INITIALISED,"The worker received a request before its engine finished initialising"));return}p?.abort();let u=new AbortController;p=u,l=N(o),i.set(o.id,u),a$1.setKeystrokeSignal(u.signal);try{let d=V(a$1,o);g({kind:"result",id:o.id,value:d});}catch(d){h(o.id,d);}finally{i.delete(o.id),a$1.setKeystrokeSignal(null);}};return e.onMessage(o=>{let a=o;switch(a.kind){case "init":D(a);break;case "request":j(a);break;case "cancel":i.get(a.id)?.abort();break}}),()=>{c?.(),c=null,p?.abort(),p=null,l=new Map;for(let o of i.values())o.abort();i.clear(),t?.clear(),t=null,e.terminate();}}function G(e){return typeof globalThis.structuredClone=="function"?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e))}function J(){let e=null,r=null,n=true,t=(l,p)=>{let c=G(p);queueMicrotask(()=>{n&&l()?.(c);});};return {client:{postMessage:l=>t(()=>r,l),onMessage:l=>{e=l;},terminate:()=>{n=false;}},host:{postMessage:l=>t(()=>e,l),onMessage:l=>{r=l;},terminate:()=>{n=false;}}}}function $(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{let n=t=>r(t.data);typeof e.addEventListener=="function"?e.addEventListener("message",n):e.onmessage=n,e.start?.();},terminate:()=>{e.terminate?.(),e.close?.();}}}function Q(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{e.on("message",n=>r(n));},terminate:()=>{e.terminate?.(),e.close?.();}}}export{J as createLinkedTransports,K as createWorkerEngine,$ as eventTargetTransport,Q as messagePortTransport,y as serializeParsedLine,R as serializeParsingResult,m as serializeValue,B as startWorkerRuntime};//# sourceMappingURL=worker.js.map
|
|
3
3
|
//# sourceMappingURL=worker.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solve-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "An embeddable expression engine for natural-language calculations: units, currencies, percentages, dates and matrices, with the parsing and evaluation plumbing already built.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expression-evaluator",
|