atriusmaps-node-sdk 3.3.858 → 3.3.860
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/cjs/package.json.js +1 -1
- package/dist/cjs/src/app.js +1 -1
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +1 -1
- package/dist/cjs/src/debugTools.js +2 -2
- package/dist/cjs/src/extModules/flexapi/src/validate.js +2 -2
- package/dist/cjs/src/extModules/log.js +2 -2
- package/dist/package.json.js +1 -1
- package/dist/src/app.js +1 -1
- package/dist/src/configs/postproc-mol-url-parms.js +1 -1
- package/dist/src/debugTools.js +1 -1
- package/dist/src/extModules/flexapi/src/validate.js +1 -1
- package/dist/src/extModules/log.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
package/dist/cjs/src/app.js
CHANGED
|
@@ -103,7 +103,7 @@ async function extendConfig(config, extendsConfigs) {
|
|
|
103
103
|
|
|
104
104
|
// const isSimpleName = name => /^[-a-zA-Z0-9]+$/.test(name) // composed of only alphanumeric and dash
|
|
105
105
|
|
|
106
|
-
const createPostProcessor = name => config => import(`./configs/postproc-${name}.
|
|
106
|
+
const createPostProcessor = name => config => import(`./configs/postproc-${name}.ts`).then(pp => pp.process(config));
|
|
107
107
|
|
|
108
108
|
const handleConfigPostProcess = async config =>
|
|
109
109
|
config.configPostProc ? Zousan.series(config, ...config.configPostProc.map(createPostProcessor)) : config;
|
|
@@ -124,9 +124,9 @@ async function showCenter() {
|
|
|
124
124
|
html: `<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path stroke="#fF000080" stroke-width="2" d="M0 50h45M55 50h45M50 0v45M50 55v45"/></svg>`,
|
|
125
125
|
styles: {
|
|
126
126
|
position: 'absolute',
|
|
127
|
-
|
|
127
|
+
'inset-inline-start': '50%',
|
|
128
128
|
top: '50%',
|
|
129
|
-
'margin-
|
|
129
|
+
'margin-inline-start': -50 + leftAdj + 'px',
|
|
130
130
|
'margin-top': -50 + topAdj + 'px',
|
|
131
131
|
},
|
|
132
132
|
},
|
|
@@ -139,7 +139,7 @@ function checkType(customTypes, typeSpec, value) {
|
|
|
139
139
|
const allItemsValid = value.reduce(function (isValid, curItem) {
|
|
140
140
|
try {
|
|
141
141
|
checkType(customTypes, typeSpec.itemType, curItem);
|
|
142
|
-
} catch
|
|
142
|
+
} catch {
|
|
143
143
|
return false;
|
|
144
144
|
}
|
|
145
145
|
return isValid;
|
|
@@ -165,7 +165,7 @@ function checkType(customTypes, typeSpec, value) {
|
|
|
165
165
|
const oneTypeValid = typeSpec.types.reduce((isValid, curType) => {
|
|
166
166
|
try {
|
|
167
167
|
checkType(customTypes, curType, value);
|
|
168
|
-
} catch
|
|
168
|
+
} catch {
|
|
169
169
|
return isValid;
|
|
170
170
|
}
|
|
171
171
|
return true;
|
|
@@ -33,10 +33,10 @@ function clog(name, options = {}) {
|
|
|
33
33
|
typeof filter === 'string' ? args[0].includes(filter) : filter.test(args[0]);
|
|
34
34
|
|
|
35
35
|
function logGen(cmethod) {
|
|
36
|
-
return function () {
|
|
36
|
+
return function (...restArgs) {
|
|
37
37
|
const isEnabled = options.enabled === undefined ? true : !!options.enabled;
|
|
38
38
|
if (isEnabled || cmethod === console.error) {
|
|
39
|
-
let args =
|
|
39
|
+
let args = [...restArgs];
|
|
40
40
|
if (style) {
|
|
41
41
|
args.unshift(style);
|
|
42
42
|
}
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",t="3.3.
|
|
1
|
+
var e="web-engine",t="3.3.860",s="UNLICENSED",r="module",o="src/main.js",i=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={"build-storybook":"storybook build",colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt",demo:"cd demo/ && yarn start",dev:"yarn mol e2e","format:check":"yarn prettier . --check","format:fix":"yarn prettier . --write",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh","icons:convert":"node scripts/convertSvgToJsx.mjs",lint:"eslint . --ext .js,.jsx,.ts,.tsx",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol","playwright:ci":"yarn playwright test --grep-invert sdk","playwright:ci:failed":"yarn playwright test --last-failed --grep-invert sdk","playwright:sdk":"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./test/sdk && npx http-server' 8080 'yarn playwright test sdk --ui'","playwright:ui":"yarn playwright test --ui --grep-invert sdk",prepare:"husky",storybook:"storybook dev -p 6006",test:"vitest run --project unit","test-watch":"vitest --watch","test:comp":"vitest run --project browser","test:comp:ci":"vitest run --project browser --reporter=dot","test:comp:ui":"VITE_COMP_UI=1 vitest --project browser --ui --browser.headless=false","test:all":"yarn lint && yarn format:check && yarn test && yarn playwright:ci","test:mod":"playwright test --config=playwright.mod.config.ts",typecheck:"tsc -p tsconfig.checkjs.json"},l=["defaults"],n={"@azure/event-hubs":"^5.12.2","@csstools/normalize.css":"^11.0.1","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@locus-labs/mod-badge":"^0.1.102","@locus-labs/mod-footer":"^0.0.111","@locus-labs/mod-header":"^0.0.105","@locus-labs/mod-location-marker":"^0.0.104","@locus-labs/mod-map-legend":"^0.0.104","@locus-labs/mod-offscreen-indicator":"^0.0.104","@locus-labs/mod-pin":"^0.0.104","@locus-labs/mod-qr-code-card":"^0.0.104","@locus-labs/mod-qr-code-window":"^0.0.105","@locus-labs/mod-walk-time-matrix":"^0.0.103","@mapbox/mapbox-gl-draw":"^1.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/bearing":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^5.2.0","@zumer/snapdom":"^2.9.0","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1",dompurify:"^3.3.3","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^26.0.0","i18next-browser-languagedetector":"^6.1.1",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1",pmtiles:"^4.4.0","prop-types":"^15.8.1","qrcode.react":"^4.2.0",ramda:"^0.30.1",react:"^19.2.4","react-compound-slider":"^3.4.0","react-dom":"^19.2.4","react-json-editor-ajrm":"^2.5.14","react-svg":"^16.3.0","react-virtualized-auto-sizer":"^1.0.25","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.15","styled-normalize":"^8.1.1","throttle-debounce":"^5.0.2",trackjs:"^3.10.4","ua-parser-js":"^0.7.40",uuid:"^11.1.0",zousan:"^3.0.1","zousan-plus":"^4.0.1"},c={"@applitools/eyes-playwright":"^1.46.8","@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@percy/cli":"^1.31.11","@percy/playwright":"^1.1.0","@playwright/test":"^1.59.1","@storybook/addon-essentials":"^8.6.15","@storybook/blocks":"^8.6.15","@storybook/react":"^8.6.15","@storybook/react-vite":"^8.6.15","@testing-library/dom":"^10.4.1","@testing-library/jest-dom":"^6.6.3","@testing-library/react":"^16.3.0","@testing-library/user-event":"^14.5.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","@vitest/browser":"4.1.6","@vitest/browser-playwright":"4.1.6","@vitest/ui":"4.1.6","chai-colors":"^1.0.1","css-loader":"^7.1.2",eslint:"^8.57.1","eslint-config-prettier":"^10.1.8","eslint-config-standard":"^17.1.0","eslint-import-resolver-alias":"^1.1.2","eslint-plugin-n":"^17.16.2","eslint-plugin-node":"^11.1.0","eslint-plugin-playwright":"^2.2.2","eslint-plugin-promise":"^5.2.0","eslint-plugin-react":"^7.37.4","eslint-plugin-standard":"^5.0.0","eslint-plugin-vitest":"^0.5.4","fetch-mock":"^12.6.0",glob:"^11.0.1",husky:"^9.1.7","lint-staged":"^16.4.0","node-fetch":"^2.7.0","null-loader":"^4.0.1",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0",prettier:"^3.8.3","start-server-and-test":"^2.0.11",storybook:"^8.6.15",typescript:"^5.8.2",vite:"^7.3.2",vitest:"4.1.6","webpack-merge":"^6.0.1"},d="yarn@4.13.0",p={node:"24.x"},y={},u={name:e,version:t,private:!0,license:s,type:r,main:o,workspaces:i,scripts:a,"lint-staged":{"*.js":["eslint --fix","prettier --check"],"*.{json,md,css,ts,tsx,jsx}":["prettier --check"],"src/i18n/**/*.json":["node utils/sort-json.js","prettier --write"]},browserslist:l,dependencies:n,devDependencies:c,packageManager:d,engines:p,nx:y};export{l as browserslist,u as default,n as dependencies,c as devDependencies,p as engines,s as license,o as main,e as name,y as nx,d as packageManager,a as scripts,r as type,t as version,i as workspaces};
|
package/dist/src/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{map as e,mergeDeepRight as t}from"ramda";import n from"zousan-plus";import o from"./utils/i18n.js";import{startInitialStateListener as i}from"./utils/isInitialState.js";import a from"../package.json.js";import r from"./debugTools.js";import{buildEnv as s}from"./env.js";import{create as l}from"./extModules/bustle.js";import{initLog as u}from"./extModules/log.js";const c="undefined"!=typeof window;async function g(e,t,n){if(!n)return e.log.info(`Plugin ${t} explicitly disabled`),null;let o=t;if(o.includes("/")){const e=o.split("/");o=e[e.length-1]}return void 0!==n.active&&(!1===n.active||"notLocalhost"===n.active&&e.env.isLocalhost())?(e.log.info(`Plugin ${t} explicitly deativated`),null):import(`../plugins/${t}/src/${o}.js`).then(o=>(e.log.info(`Creating plugin ${t}`),o.create(e,n)))}async function d(e){return c?import(`./configs/${e}.json`):import(`./configs/${e}.json.js`)}async function p(e,n){let o={};const i=await Promise.all(n.map(d));for(const e of i){let n=e.default;n=n.extends?await p(n,n.extends):n,o=t(o,n)}return o=t(o,e),o}const m=e=>t=>import(`./configs/postproc-${e}.
|
|
1
|
+
import{map as e,mergeDeepRight as t}from"ramda";import n from"zousan-plus";import o from"./utils/i18n.js";import{startInitialStateListener as i}from"./utils/isInitialState.js";import a from"../package.json.js";import r from"./debugTools.js";import{buildEnv as s}from"./env.js";import{create as l}from"./extModules/bustle.js";import{initLog as u}from"./extModules/log.js";const c="undefined"!=typeof window;async function g(e,t,n){if(!n)return e.log.info(`Plugin ${t} explicitly disabled`),null;let o=t;if(o.includes("/")){const e=o.split("/");o=e[e.length-1]}return void 0!==n.active&&(!1===n.active||"notLocalhost"===n.active&&e.env.isLocalhost())?(e.log.info(`Plugin ${t} explicitly deativated`),null):import(`../plugins/${t}/src/${o}.js`).then(o=>(e.log.info(`Creating plugin ${t}`),o.create(e,n)))}async function d(e){return c?import(`./configs/${e}.json`):import(`./configs/${e}.json.js`)}async function p(e,n){let o={};const i=await Promise.all(n.map(d));for(const e of i){let n=e.default;n=n.extends?await p(n,n.extends):n,o=t(o,n)}return o=t(o,e),o}const m=e=>t=>import(`./configs/postproc-${e}.ts`).then(e=>e.process(t));async function f(t){const d=Object.create(null);let f=t.extends?await p(t,t.extends):t;f.plugins.monitoring&&await import("../_virtual/_empty_module_placeholder.js").then(e=>e.activate(f.plugins.monitoring)),f=await(async e=>e.configPostProc?n.series(e,...e.configPostProc.map(m)):e)(f);const h=(e=>{const t=e.supportedLanguages||["am","ar","de","el-GR","en","es","fr","hi","is","it","ja","ko","nl","pl","pt","ru","so","th","zh-Hans","zh-Hant"];if("undefined"!=typeof window){let e=new URLSearchParams(location.search).get("lang")||navigator.language;for(;e;){if(e&&t.includes(e))return e;e=e.substring(0,e.lastIndexOf("-"))}}return e.defaultLanguage||"en"})(f),w=await o(h,{debug:f.debug});d.i18n=()=>w,d.gt=()=>w.t.bind(w),d.config=f,d.plugins={};const y=u("web-engine",{enabled:!!f.debug,isBrowser:c,color:"cyan",logFilter:f.logFilter,truncateObjects:!c,trace:false});if(d.log=y.sublog(f.name),d.bus=l({showEvents:!0,reportAllErrors:!0,log:y}),d.info={wePkg:a},"undefined"!=typeof window&&(f.debug?(d.debug=e(e=>e.bind(d),r),r.dndGo.call(d)):d.debug={},window._app=d,window.document&&window.document.title&&f.setWindowTitle&&(document.title=f.name)),d.env=s(d),f.theme?await n.evaluate({name:"ThemeManagerModule",value:import("../_virtual/_empty_module_placeholder.js")},{name:"HistoryManager",value:import("./historyManager.js")},{name:"LayerManager",value:import("../_virtual/_empty_module_placeholder.js")}).then(async({LayerManager:e,HistoryManager:t,ThemeManagerModule:n})=>{const o=n.initThemeManager(d);d.themePack=await o.buildTheme(f.theme,f.defaultTheme),i(),e.initLayerManager(d),t.initHistoryManager(d),d.destroy=()=>e.destroy(d)}):d.destroy=()=>{},f.plugins){for(const e in f.plugins)try{const t=f.plugins[e];if(d.plugins[e])throw Error(`Duplicate plugin name "${e}"`);const n=await g(d,e,t);n&&(d.plugins[e]=n)}catch(t){y.error("Error instantiating plugin "+e),y.error(t)}for(const e in d.plugins)d.plugins[e].init()}return d}export{f as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={navFrom:"online/getDirectionsFromTo",navTo:"online/getDirectionsFromTo",waypoints:"online/getDirectionsFromTo",accessible:"online/getDirectionsFromTo",showNav:"online/getDirectionsFromTo",poiId:["online/getDirectionsFromTo","online/poiView"],vid:"venueDataLoader",stage:"venueDataLoader",contentStage:"venueDataLoader",accountId:"venueDataLoader",search:"online/headerOnline",ho:["online/getDirectionsFromTo","analytics2"],home:"online/homeView",zoom:"mapRenderer",pitch:"mapRenderer",bearing:"mapRenderer",lat:"mapRenderer",lng:"mapRenderer",radius:"mapRenderer",buildingId:"mapRenderer",floorId:"mapRenderer",visualTest:"mapRenderer",refInstallId:"analytics2",disableZoomToExplorePopup:"levelIndicator"};function o(o,n,r){if(n.has("lldebug"))try{o.debug=JSON.parse(n.get("lldebug")),null===o.debug&&(o.debug={})}catch
|
|
1
|
+
const e={navFrom:"online/getDirectionsFromTo",navTo:"online/getDirectionsFromTo",waypoints:"online/getDirectionsFromTo",accessible:"online/getDirectionsFromTo",showNav:"online/getDirectionsFromTo",poiId:["online/getDirectionsFromTo","online/poiView"],vid:"venueDataLoader",stage:"venueDataLoader",contentStage:"venueDataLoader",accountId:"venueDataLoader",search:"online/headerOnline",ho:["online/getDirectionsFromTo","analytics2"],home:"online/homeView",zoom:"mapRenderer",pitch:"mapRenderer",bearing:"mapRenderer",lat:"mapRenderer",lng:"mapRenderer",radius:"mapRenderer",buildingId:"mapRenderer",floorId:"mapRenderer",visualTest:"mapRenderer",refInstallId:"analytics2",disableZoomToExplorePopup:"levelIndicator"};function o(o,n,r){if(n.has("lldebug"))try{o.debug=JSON.parse(n.get("lldebug")),null===o.debug&&(o.debug={})}catch{o.debug=!0}return Object.keys(e).forEach(i=>{if(n.has(i)){let a=e[i];Array.isArray(a)||(a=[a]),a.forEach(e=>{let a=o.plugins[e];!a&&r&&(a=o.plugins[e]={}),a.deepLinkProps={...a.deepLinkProps,[i]:n.get(i)}})}}),n.has("poiId")&&n.has("showNav")&&delete o.plugins["online/poiView"].deepLinkProps.poiId,o}export{o as setDeepLinksForParms};
|
package/dist/src/debugTools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import{$ as t,$$ as n,ad as s,del as o}from"./utils/dom.js";import{singleFile as a}from"./utils/funcs.js";import{orphanTest as r}from"../plugins/wayfinder/src/navGraphDebug.js";"undefined"!=typeof window&&(window.R=e);const i=(e,t)=>d(()=>t.send(e),t),d=(e,t)=>{const n=t.monitor("homeview/performSearch",({term:t})=>{t||(e(),n())})};async function u(){const e=await this.bus.get("map/getPadding"),n=(e.left-e.right)/2,a=(e.top-e.bottom)/2,r=s({html:'<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path stroke="#fF000080" stroke-width="2" d="M0 50h45M55 50h45M50 0v45M50 55v45"/></svg>',styles:{position:"absolute",
|
|
1
|
+
import*as e from"ramda";import{$ as t,$$ as n,ad as s,del as o}from"./utils/dom.js";import{singleFile as a}from"./utils/funcs.js";import{orphanTest as r}from"../plugins/wayfinder/src/navGraphDebug.js";"undefined"!=typeof window&&(window.R=e);const i=(e,t)=>d(()=>t.send(e),t),d=(e,t)=>{const n=t.monitor("homeview/performSearch",({term:t})=>{t||(e(),n())})};async function u(){const e=await this.bus.get("map/getPadding"),n=(e.left-e.right)/2,a=(e.top-e.bottom)/2,r=s({html:'<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path stroke="#fF000080" stroke-width="2" d="M0 50h45M55 50h45M50 0v45M50 55v45"/></svg>',styles:{position:"absolute","inset-inline-start":"50%",top:"50%","margin-inline-start":-50+n+"px","margin-top":-50+a+"px"}},t(".maplibregl-map"));d(()=>o(r),this.bus)}var g={bounds:async function(){const e=await this.bus.get("venueData/getVenueCenter"),{venueRadius:t,bounds:n}=await this.bus.get("venueData/getVenueData");this.bus.send("map/showVenueBounds",{venueCenter:e,venueRadius:t,bounds:n}),i("map/resetVenueBounds",this.bus)},buildingBounds:async function(e){this.bus.send("map/showBuildingBounds",{nameFilter:e}),i("map/resetVenueBounds",this.bus),u.apply(this)},dndGo:function(){const e=this.bus,t=(e,t)=>{e.preventDefault(),t?e.target.classList.add("dragover"):e.target.classList.remove("dragover")},n={drop:async function(n){t(n,!1);for(const t of n.dataTransfer.files){const n=t.name;if("application/json"===t.type||t.type.startsWith("text/")){const s=new FileReader;s.onload=a(async s=>e.send("debugTools/fileDrop",{file:t,filename:n,content:s.target.result})),s.readAsText(t)}}},dragover:function(e){t(e,!0)},dragleave:function(e){t(e,!1)}};Object.keys(n).forEach(function(e){document.body.addEventListener(e,n[e])}),console.log("DnD Listeners installed")},floorBounds:async function(e){const t=this.bus;t.send("map/showFloorBounds",{nameFilter:e}),i("map/resetVenueBounds",t);const n=t.monitor("map/floorChanged",()=>t.send("map/showFloorBounds",{nameFilter:e}));d(n,t),u.apply(this)},getPoiById:function(e){return this.bus.send("poi/getById",{id:e}).then(e=>e[0])},highlightNodes:()=>s({tag:"style",html:"* { background-color: rgba(255,0,0,.2); } * * { background-color: rgba(0,255,0,.2); } * * * { background-color: rgba(0,0,255,.2); } * * * * { background-color: rgba(255,0,255,.2); } * * * * * { background-color: rgba(0,255,255,.2); } * * * * * * { background-color: rgba(255,255,0,.2); } * * * * * * * { background-color: rgba(255,0,0,.2); } * * * * * * * * { background-color: rgba(0,255,0,.2); } * * * * * * * * * { background-color: rgba(0,0,255,.2); }"},t("head")),orphanTest:r,padding:async function(){this.bus.send("map/togglePadding"),i("map/togglePadding",this.bus)},poisByCategory:function(){return this.bus.send("poi/getAll").then(e=>e[0]).then(e=>Object.values(e)).then(e.groupBy(e=>e.category))},showCenter:u,showgraph:async function(){const e=await this.bus.get("wayfinder/getNavGraphFeatures");this.bus.send("map/showNavGraphFeatures",{navGraph:e}),i("map/resetNavGraphFeatures",this.bus)},showIcons:()=>{t("#mapRenderDiv").innerHTML="<style> div { display: inline-block; text-align: center; border: 1px solid lightblue; }</style>"+n("svg symbol").map(e=>`<div><svg><use xlink:href="#${e.id}"/></svg><br/>${e.id}</div>`).join("")},showOrphaned:async function(){const e=await this.bus.get("wayfinder/_getNavGraph"),t=r(e._nodes);this.bus.send("map/showOrphanedGraphNodes",{orphanedNodes:t.orphaned})}};export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=function(t){return"'"+t+"'"};function e(t,e,r){e.args&&o(t.customTypes,e.args,r)}function r(t,e){const r=t.commandDefsList.filter(t=>t.sig.command===e.command&&function(t,e){if(!t.args)return!0;return t.args.reduce(function(t,r){return!(void 0===e[r.name]&&!r.optional)&&t},!0)}(t.sig,e));if(r.length>1)throw Error("Command matches multiple signatures!");return r.length>0?r[0]:null}function n(e,r,n){if(void 0!==r.min&&n<r.min)throw Error("argument "+t(e)+" must be at least "+r.min+" but is "+n);if(void 0!==r.max&&n>r.max)throw Error("argument "+t(e)+" must be at most "+r.max+" but is "+n)}function i(e,r,a){if(!r)return!0;const s=r.name||"";if(e&&e[r.type]&&(r=Object.assign({},e[r.type],r,{type:e[r.type].type})),"integer"===r.type){if("string"==typeof a&&(a=parseInt(a,10)),!Number.isInteger(a))throw Error("expected integer argument for argument "+t(s)+" but received "+a);n(s,r,a)}else if("float"===r.type){if("string"==typeof a&&(a=parseFloat(a)),!Number.isFinite(a))throw Error("expected float argument for argument "+t(s)+" but received '"+a+"'");n(s,r,a)}else if("string"===r.type){if("string"!=typeof a)throw Error(`argument ${t(s)} must be a string but is not (value: ${a})`);if(r.minLength&&a.length<r.minLength)throw Error(`argument ${t(s)} must be a at least ${r.minLength} characters but is '${a}' (${a.length} chars)`);if(r.maxLength&&a.length>r.maxLength)throw Error(`argument ${t(s)} must be a at most ${r.maxLength} characters but is '${a}' (${a.length} chars)`)}else if("boolean"===r.type){if(!0!==a&&!1!==a&&"false"!==a&&"true"!==a&&"yes"!==a&&"no"!==a)throw Error("argument "+t(s)+" must be a boolean but is type "+typeof a+" with value of "+a)}else if("list"===r.type){if(!Array.isArray(a))throw Error("argument "+t(s)+" must be a list but is not. Value = "+a);if(void 0!==r.minLength&&r.minLength>a.length)throw Error("argument "+t(s)+" must contain at least "+r.minLength+" items but only contains "+a.length+" items");if(void 0!==r.maxLength&&r.maxLength<a.length)throw Error("argument "+t(s)+" must contain at most "+r.maxLength+" items but contains "+a.length+" items");if(r.itemType){if(!a.reduce(function(t,n){try{i(e,r.itemType,n)}catch
|
|
1
|
+
const t=function(t){return"'"+t+"'"};function e(t,e,r){e.args&&o(t.customTypes,e.args,r)}function r(t,e){const r=t.commandDefsList.filter(t=>t.sig.command===e.command&&function(t,e){if(!t.args)return!0;return t.args.reduce(function(t,r){return!(void 0===e[r.name]&&!r.optional)&&t},!0)}(t.sig,e));if(r.length>1)throw Error("Command matches multiple signatures!");return r.length>0?r[0]:null}function n(e,r,n){if(void 0!==r.min&&n<r.min)throw Error("argument "+t(e)+" must be at least "+r.min+" but is "+n);if(void 0!==r.max&&n>r.max)throw Error("argument "+t(e)+" must be at most "+r.max+" but is "+n)}function i(e,r,a){if(!r)return!0;const s=r.name||"";if(e&&e[r.type]&&(r=Object.assign({},e[r.type],r,{type:e[r.type].type})),"integer"===r.type){if("string"==typeof a&&(a=parseInt(a,10)),!Number.isInteger(a))throw Error("expected integer argument for argument "+t(s)+" but received "+a);n(s,r,a)}else if("float"===r.type){if("string"==typeof a&&(a=parseFloat(a)),!Number.isFinite(a))throw Error("expected float argument for argument "+t(s)+" but received '"+a+"'");n(s,r,a)}else if("string"===r.type){if("string"!=typeof a)throw Error(`argument ${t(s)} must be a string but is not (value: ${a})`);if(r.minLength&&a.length<r.minLength)throw Error(`argument ${t(s)} must be a at least ${r.minLength} characters but is '${a}' (${a.length} chars)`);if(r.maxLength&&a.length>r.maxLength)throw Error(`argument ${t(s)} must be a at most ${r.maxLength} characters but is '${a}' (${a.length} chars)`)}else if("boolean"===r.type){if(!0!==a&&!1!==a&&"false"!==a&&"true"!==a&&"yes"!==a&&"no"!==a)throw Error("argument "+t(s)+" must be a boolean but is type "+typeof a+" with value of "+a)}else if("list"===r.type){if(!Array.isArray(a))throw Error("argument "+t(s)+" must be a list but is not. Value = "+a);if(void 0!==r.minLength&&r.minLength>a.length)throw Error("argument "+t(s)+" must contain at least "+r.minLength+" items but only contains "+a.length+" items");if(void 0!==r.maxLength&&r.maxLength<a.length)throw Error("argument "+t(s)+" must contain at most "+r.maxLength+" items but contains "+a.length+" items");if(r.itemType){if(!a.reduce(function(t,n){try{i(e,r.itemType,n)}catch{return!1}return t},!0))throw Error(`argument ${t(s)} contains an invalid item(s). All items in the list must be of type: ${JSON.stringify(r.itemType)} - list: ${JSON.stringify(a)}`)}}else if("object"===r.type){if("object"!=typeof a||Array.isArray(a))throw Error("argument "+t(s)+" must be an object but is not. Value = "+a);try{r.props&&o(e,r.props,a)}catch(t){throw Error("Within "+s+", "+t.message)}}else{if("multi"!==r.type)throw Error("type "+r.type+" is an unknown type");if(!r.types.reduce((t,r)=>{try{i(e,r,a)}catch{return t}return!0},!1))throw Error(`Argument ${t(s)} can be of several types, but is not valid for any: ${a}`)}return!0}function o(t,e,r){e.forEach(e=>{if(void 0!==r[e.name])i(t,e,r[e.name]);else if(!e.optional)throw Error("you must include a value for "+e.name)})}export{i as checkType,o as checkTypeList,r as getSigMatch,e as validate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={black:"[30m",red:"[31m",green:"[32m",yellow:"[33m",blue:"[34m",magenta:"[35m",cyan:"[36m",white:"[37m"};function o(r
|
|
1
|
+
const e={black:"[30m",red:"[31m",green:"[32m",yellow:"[33m",blue:"[34m",magenta:"[35m",cyan:"[36m",white:"[37m"};function o(n,r){const t=function(o,n={}){let r=o+": ",t=null;if(n.color)if(n.isBrowser)r="%c"+r,t=`color: ${n.color}`;else{const o=e[n.color];o&&(r=o+r)}function c(e){return function(...o){if(void 0===n.enabled||n.enabled||e===console.error){let c=[...o];t&&c.unshift(t),c.unshift(r),n.truncateObjects&&e!==console.error&&(c=c.map(e=>{return"object"==typeof e?(o=JSON.stringify(e),r=parseInt(n.truncateObjects)||100,o&&o.length>r?o.substring(0,r)+"...":o):e;var o,r}));const l=!n.logFilter||((e,o)=>"string"==typeof o?e[0].includes(o):o.test(e[0]))(c,n.logFilter);(l||e===console.error)&&e.apply(console,c)}}}const l=c(n.trace?console.trace:console.log);return l.info=l,l.warn=c(console.warn),l.detailed=c(console.debug),l.error=c(console.error),l.setEnabled=e=>{n.enabled=e},l}(n,r);return t.sublog=(e,t)=>o(n+"."+e,Object.assign(Object.create(r),t)),t}export{o as initLog};
|
package/package.json
CHANGED