@3dnest/garage-host
Advanced tools
Comparing version 0.0.1 to 0.0.2
/*! | ||
* @3dnest/garage-host v0.0.1 | ||
* @3dnest/garage-host v0.0.2 | ||
* (c) 2021-2022 3dnest | ||
@@ -134,6 +134,6 @@ * Released under the MIT License. | ||
const loadScript = url => { | ||
const loadScript = async url => { | ||
const script = createElement('script'); | ||
new Promise((resolve, reject) => { | ||
return new Promise((resolve, reject) => { | ||
script.onload = resolve; | ||
@@ -219,5 +219,5 @@ script.onerror = reject; | ||
installer(meta, Spoke, SolutionProvider); | ||
installer(SolutionProvider, Spoke, meta); | ||
}; | ||
export { Solution }; |
/*! | ||
* @3dnest/garage-host v0.0.1 | ||
* @3dnest/garage-host v0.0.2 | ||
* (c) 2021-2022 3dnest | ||
* Released under the MIT License. | ||
*/ | ||
const e=(e,t=Error)=>{throw new t(e)},t=t=>e(t,TypeError),i=(e,t)=>(e=>typeof e)(e)===t,n=Array.isArray,r=e=>!(e=>i(e,"string"))(e),o=e=>!(e=>i(e,"object"))(e),a=e=>!(e=>i(e,"function"))(e),c=document,s=c.body,d=e=>{const t=(i="script",c.createElement(i));var i;new Promise(((i,n)=>{var r;return t.onload=i,t.onerror=n,t.src=e,r=t,s.appendChild(r),t})).finally((()=>{return((e,t)=>e.removeChild(t))((e=t).parentElement,e);var e}))},l=async(i,c)=>{const{origin:s,ticket:l}=(e=>{o(e)&&t("Invalid options, a plain object expected.");const i={},{origin:n,ticket:a}=e;return r(n)&&t("Invalid .origin, a url string expected."),r(a)&&t("Invalid .ticket, a ticket string expected."),i.origin=n,i.ticket=a,i})(i);a(c)&&t("Invalid installer, a function expected.");const p=new URL(`/validate?ticket=${l}`,s),_=await fetch(p);_.ok||e("Authentication failed.");const v=await _.json(),{scriptList:w,solution:I,version:E}=v;n(w)||t("Service: Invalid scriptList, an array expected."),w.forEach(((e,i)=>{r(e)&&t(`Service: Invalid scriptList[${i}], a string expected.`)})),r(I)&&t("Service: Invalid solution, a string as name expected."),r(E)&&t("Service: Invalid version, a string expected.");for(const e of w)await d(e);const g=window.__GARAGE_SOLUTION_PROVIDER__,u=window.__SPOKE__;delete window.__GARAGE_SOLUTION_PROVIDER__,delete window.__SPOKE__,c(v,u,g)};export{l as Solution}; | ||
const e=(e,t=Error)=>{throw new t(e)},t=t=>e(t,TypeError),i=(e,t)=>(e=>typeof e)(e)===t,n=Array.isArray,r=e=>!(e=>i(e,"string"))(e),o=e=>!(e=>i(e,"object"))(e),a=e=>!(e=>i(e,"function"))(e),c=document,s=c.body,d=async e=>{const t=(i="script",c.createElement(i));var i;return new Promise(((i,n)=>{var r;return t.onload=i,t.onerror=n,t.src=e,r=t,s.appendChild(r),t})).finally((()=>{return((e,t)=>e.removeChild(t))((e=t).parentElement,e);var e}))},l=async(i,c)=>{const{origin:s,ticket:l}=(e=>{o(e)&&t("Invalid options, a plain object expected.");const i={},{origin:n,ticket:a}=e;return r(n)&&t("Invalid .origin, a url string expected."),r(a)&&t("Invalid .ticket, a ticket string expected."),i.origin=n,i.ticket=a,i})(i);a(c)&&t("Invalid installer, a function expected.");const p=new URL(`/validate?ticket=${l}`,s),_=await fetch(p);_.ok||e("Authentication failed.");const v=await _.json(),{scriptList:w,solution:I,version:u}=v;n(w)||t("Service: Invalid scriptList, an array expected."),w.forEach(((e,i)=>{r(e)&&t(`Service: Invalid scriptList[${i}], a string expected.`)})),r(I)&&t("Service: Invalid solution, a string as name expected."),r(u)&&t("Service: Invalid version, a string expected.");for(const e of w)await d(e);const E=window.__GARAGE_SOLUTION_PROVIDER__,g=window.__SPOKE__;delete window.__GARAGE_SOLUTION_PROVIDER__,delete window.__SPOKE__,c(E,g,v)};export{l as Solution}; |
/*! | ||
* @3dnest/garage-host v0.0.1 | ||
* @3dnest/garage-host v0.0.2 | ||
* (c) 2021-2022 3dnest | ||
@@ -140,6 +140,6 @@ * Released under the MIT License. | ||
const loadScript = url => { | ||
const loadScript = async url => { | ||
const script = createElement('script'); | ||
new Promise((resolve, reject) => { | ||
return new Promise((resolve, reject) => { | ||
script.onload = resolve; | ||
@@ -225,3 +225,3 @@ script.onerror = reject; | ||
installer(meta, Spoke, SolutionProvider); | ||
installer(SolutionProvider, Spoke, meta); | ||
}; | ||
@@ -228,0 +228,0 @@ |
/*! | ||
* @3dnest/garage-host v0.0.1 | ||
* @3dnest/garage-host v0.0.2 | ||
* (c) 2021-2022 3dnest | ||
* Released under the MIT License. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["garage-host"]={})}(this,(function(e){"use strict";const t=(e,t=Error)=>{throw new t(e)},i=e=>t(e,TypeError),n=(e,t)=>(e=>typeof e)(e)===t,o=Array.isArray,r=e=>!(e=>n(e,"string"))(e),a=e=>!(e=>n(e,"object"))(e),c=e=>!(e=>n(e,"function"))(e),s=document,d=s.body,l=e=>{const t=(i="script",s.createElement(i));var i;new Promise(((i,n)=>{var o;return t.onload=i,t.onerror=n,t.src=e,o=t,d.appendChild(o),t})).finally((()=>{return((e,t)=>e.removeChild(t))((e=t).parentElement,e);var e}))};e.Solution=async(e,n)=>{const{origin:s,ticket:d}=(e=>{a(e)&&i("Invalid options, a plain object expected.");const t={},{origin:n,ticket:o}=e;return r(n)&&i("Invalid .origin, a url string expected."),r(o)&&i("Invalid .ticket, a ticket string expected."),t.origin=n,t.ticket=o,t})(e);c(n)&&i("Invalid installer, a function expected.");const p=new URL(`/validate?ticket=${d}`,s),f=await fetch(p);f.ok||t("Authentication failed.");const _=await f.json(),{scriptList:u,solution:v,version:w}=_;o(u)||i("Service: Invalid scriptList, an array expected."),u.forEach(((e,t)=>{r(e)&&i(`Service: Invalid scriptList[${t}], a string expected.`)})),r(v)&&i("Service: Invalid solution, a string as name expected."),r(w)&&i("Service: Invalid version, a string expected.");for(const e of u)await l(e);const g=window.__GARAGE_SOLUTION_PROVIDER__,y=window.__SPOKE__;delete window.__GARAGE_SOLUTION_PROVIDER__,delete window.__SPOKE__,n(_,y,g)},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["garage-host"]={})}(this,(function(e){"use strict";const t=(e,t=Error)=>{throw new t(e)},i=e=>t(e,TypeError),n=(e,t)=>(e=>typeof e)(e)===t,o=Array.isArray,r=e=>!(e=>n(e,"string"))(e),a=e=>!(e=>n(e,"object"))(e),c=e=>!(e=>n(e,"function"))(e),s=document,d=s.body,l=async e=>{const t=(i="script",s.createElement(i));var i;return new Promise(((i,n)=>{var o;return t.onload=i,t.onerror=n,t.src=e,o=t,d.appendChild(o),t})).finally((()=>{return((e,t)=>e.removeChild(t))((e=t).parentElement,e);var e}))};e.Solution=async(e,n)=>{const{origin:s,ticket:d}=(e=>{a(e)&&i("Invalid options, a plain object expected.");const t={},{origin:n,ticket:o}=e;return r(n)&&i("Invalid .origin, a url string expected."),r(o)&&i("Invalid .ticket, a ticket string expected."),t.origin=n,t.ticket=o,t})(e);c(n)&&i("Invalid installer, a function expected.");const p=new URL(`/validate?ticket=${d}`,s),f=await fetch(p);f.ok||t("Authentication failed.");const _=await f.json(),{scriptList:u,solution:v,version:w}=_;o(u)||i("Service: Invalid scriptList, an array expected."),u.forEach(((e,t)=>{r(e)&&i(`Service: Invalid scriptList[${t}], a string expected.`)})),r(v)&&i("Service: Invalid solution, a string as name expected."),r(w)&&i("Service: Invalid version, a string expected.");for(const e of u)await l(e);const g=window.__GARAGE_SOLUTION_PROVIDER__,y=window.__SPOKE__;delete window.__GARAGE_SOLUTION_PROVIDER__,delete window.__SPOKE__,n(g,y,_)},Object.defineProperty(e,"__esModule",{value:!0})})); |
import { Lang, Type } from '@produck/charon'; | ||
import { Dom } from '@produck/charon-browser'; | ||
const loadScript = url => { | ||
const loadScript = async url => { | ||
const script = Dom.createElement('script'); | ||
new Promise((resolve, reject) => { | ||
return new Promise((resolve, reject) => { | ||
script.onload = resolve; | ||
@@ -88,3 +88,3 @@ script.onerror = reject; | ||
installer(meta, Spoke, SolutionProvider); | ||
installer(SolutionProvider, Spoke, meta); | ||
}; |
{ | ||
"name": "@3dnest/garage-host", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "> TODO: description", | ||
@@ -43,3 +43,3 @@ "author": "Chaos Lee <chaos2lee@qq.com>", | ||
}, | ||
"gitHead": "8fc34e985ba43b7f96ba23a8db5d5326fcebe988" | ||
"gitHead": "7f9abe601bfd2c4b81634ac90877e7814f55f479" | ||
} |
18779