atriusmaps-node-sdk 3.3.1159 → 3.3.1161
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 +21 -11
- package/dist/package.json.js +1 -1
- package/dist/src/app.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
package/dist/cjs/src/app.js
CHANGED
|
@@ -15,7 +15,7 @@ function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: nu
|
|
|
15
15
|
|
|
16
16
|
const isBrowser = typeof window !== "undefined";
|
|
17
17
|
const TRACE = false;
|
|
18
|
-
async function
|
|
18
|
+
async function loadPlugin(app, id, config) {
|
|
19
19
|
if (!config) {
|
|
20
20
|
app.log.info(`Plugin ${id} explicitly disabled`);
|
|
21
21
|
return null;
|
|
@@ -26,14 +26,10 @@ async function setupPlugin(app, id, config) {
|
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
return id.includes("/") ? (() => {
|
|
30
30
|
const [scope, shortName] = id.split("/");
|
|
31
31
|
return import(`../plugins/${scope}/${shortName}/src/index.js`);
|
|
32
32
|
})() : import(`../plugins/${id}/src/index.js`);
|
|
33
|
-
return load.then((pluginModule) => {
|
|
34
|
-
app.log.info(`Creating plugin ${id}`);
|
|
35
|
-
return pluginModule.create(app, config);
|
|
36
|
-
});
|
|
37
33
|
}
|
|
38
34
|
const getLang = (config) => {
|
|
39
35
|
const supportedLanguages = config.supportedLanguages || [
|
|
@@ -143,6 +139,14 @@ async function create(rawConfig) {
|
|
|
143
139
|
}
|
|
144
140
|
}
|
|
145
141
|
appInstance.env = env.buildEnv(appInstance);
|
|
142
|
+
const pluginLoads = Object.entries(config.plugins ?? {}).map(([id, pluginConfig]) => ({
|
|
143
|
+
id,
|
|
144
|
+
pluginConfig,
|
|
145
|
+
loaded: loadPlugin(appInstance, id, pluginConfig).then(
|
|
146
|
+
(pluginModule) => ({ status: "fulfilled", pluginModule }),
|
|
147
|
+
(error) => ({ status: "rejected", error })
|
|
148
|
+
)
|
|
149
|
+
}));
|
|
146
150
|
const { theme } = config;
|
|
147
151
|
if (theme) {
|
|
148
152
|
await evaluate.evaluateResults(
|
|
@@ -162,15 +166,21 @@ async function create(rawConfig) {
|
|
|
162
166
|
};
|
|
163
167
|
}
|
|
164
168
|
if (config.plugins) {
|
|
165
|
-
for (const id
|
|
169
|
+
for (const { id, pluginConfig, loaded } of pluginLoads) {
|
|
166
170
|
try {
|
|
167
|
-
const pluginConfig = config.plugins[id];
|
|
168
171
|
if (appInstance.plugins[id]) {
|
|
169
172
|
throw Error(`Duplicate plugin name "${id}"`);
|
|
170
173
|
}
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
+
const result = await loaded;
|
|
175
|
+
if (result.status === "rejected") {
|
|
176
|
+
throw result.error;
|
|
177
|
+
}
|
|
178
|
+
if (result.pluginModule) {
|
|
179
|
+
appLog.info(`Creating plugin ${id}`);
|
|
180
|
+
const plugin = await result.pluginModule.create(appInstance, pluginConfig);
|
|
181
|
+
if (plugin) {
|
|
182
|
+
appInstance.plugins[id] = plugin;
|
|
183
|
+
}
|
|
174
184
|
}
|
|
175
185
|
} catch (e) {
|
|
176
186
|
appLog.error("Error instantiating plugin " + id);
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="3.3.
|
|
1
|
+
var a="3.3.1161",e={version:a};export{e as default,a as version};
|
package/dist/src/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{map as t,mergeDeepRight as
|
|
1
|
+
import{map as t,mergeDeepRight as e}from"ramda";import{evaluateResults as o}from"zousan/evaluate";import{series as n}from"zousan/series";import i from"./utils/i18n.js";import{startInitialStateListener as a}from"./utils/isInitialState.js";import{version as s}from"../package.json.js";import r from"./debugTools.js";import{buildEnv as l}from"./env.js";import{create as u}from"./extModules/bustle.js";import{initLog as c}from"./extModules/log.js";const g="undefined"!=typeof window;async function p(t,e,o){return o?void 0!==o.active&&(!1===o.active||"notLocalhost"===o.active&&t.env.isLocalhost())?(t.log.info(`Plugin ${e} explicitly deativated`),null):e.includes("/")?(()=>{const[t,o]=e.split("/");return import(`../plugins/${t}/${o}/src/index.js`)})():import(`../plugins/${e}/src/index.js`):(t.log.info(`Plugin ${e} explicitly disabled`),null)}async function d(t){return g?import(`./configs/${t}.json`):import(`./configs/${t}.json.js`)}async function m(t,o){let n={};const i=await Promise.all(o.map(d));for(const t of i){let o=t.default;o=o.extends?await m(o,o.extends):o,n=e(n,o)}return n=e(n,t),n}const f=t=>e=>import(`./configs/postproc-${t}.ts`).then(t=>t.process(e));async function w(e){const d=Object.create(null);let w=e.extends?await m(e,e.extends):e;if(w.plugins?.monitoring&&!1!==w.plugins.monitoring.active){const t=w.plugins.monitoring;try{const e=await(import("../_virtual/_empty_module_placeholder.js"));await e.activate(t)}catch(t){const e=t instanceof Error?t.message:String(t);console.warn("Monitoring plugin failed to load (continuing without it):",e)}}if(w=await(async t=>t.configPostProc?n(t,...t.configPostProc.map(f)):t)(w),g&&w.plugins?.posthog&&!1!==w.plugins.posthog.active)try{const{activate:t}=await(import("../plugins/posthog/src/posthog.js"));await t(w.plugins.posthog)}catch(t){console.warn("PostHog failed to start (continuing without it):",t)}const h=(t=>{const e=t.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 t=new URLSearchParams(location.search).get("lang")||navigator.language;for(;t;){if(t&&e.includes(t))return t;t=t.substring(0,t.lastIndexOf("-"))}}return t.defaultLanguage||"en"})(w),y=await i(h,{debug:w.debug});d.i18n=()=>y,d.gt=()=>y.t.bind(y),d.config=w,d.plugins={};const j=c("web-engine",{enabled:!!w.debug,isBrowser:g,color:"cyan",logFilter:w.logFilter,truncateObjects:!g,trace:false});d.log=j.sublog(w.name),d.bus=u({showEvents:!0,reportAllErrors:!0,log:j}),d.info={wePkg:{version:s}},"undefined"!=typeof window&&(w.debug?(d.debug=t(t=>t.bind(d),r),r.dndGo.call(d)):d.debug={},window._app=d,window.document&&window.document.title&&w.setWindowTitle&&(document.title=w.name)),d.env=l(d);const v=Object.entries(w.plugins??{}).map(([t,e])=>({id:t,pluginConfig:e,loaded:p(d,t,e).then(t=>({status:"fulfilled",pluginModule:t}),t=>({status:"rejected",error:t}))})),{theme:b}=w;if(b?await o({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:t,HistoryManager:e,ThemeManagerModule:o})=>{const n=o.initThemeManager(d);d.themePack=await n.buildTheme(b,w.defaultTheme),a(),t.initLayerManager(d),e.initHistoryManager(d),d.destroy=()=>t.destroy()}):d.destroy=()=>{},w.plugins){for(const{id:t,pluginConfig:e,loaded:o}of v)try{if(d.plugins[t])throw Error(`Duplicate plugin name "${t}"`);const n=await o;if("rejected"===n.status)throw n.error;if(n.pluginModule){j.info(`Creating plugin ${t}`);const o=await n.pluginModule.create(d,e);o&&(d.plugins[t]=o)}}catch(e){j.error("Error instantiating plugin "+t),j.error(e)}for(const t in d.plugins)d.plugins[t].init()}return"undefined"!=typeof window&&d.bus.send("appInsights/log",{name:"app/loaded",properties:{deploymentHost:window.location.host}}),d}export{w as create};
|
package/package.json
CHANGED