@3dnest/garage-host
Advanced tools
Comparing version 0.1.1 to 0.2.0
/*! | ||
* @3dnest/garage-host v0.1.1 | ||
* @3dnest/garage-host v0.2.0 | ||
* (c) 2021-2022 3dnest | ||
@@ -156,3 +156,4 @@ * Released under the MIT License. | ||
origin: _origin, | ||
ticket: _ticket | ||
ticket: _ticket, | ||
app: _app | ||
} = _options; | ||
@@ -168,4 +169,9 @@ | ||
if (isNotString(_app)) { | ||
throwTypeError('Invalid .app, an app id string expected.'); | ||
} | ||
options.origin = _origin; | ||
options.ticket = _ticket; | ||
options.app = _app; | ||
@@ -176,3 +182,3 @@ return options; | ||
const Solution = async (options, installer) => { | ||
const { origin, ticket } = normalize(options); | ||
const { origin, ticket, app } = normalize(options); | ||
@@ -183,3 +189,3 @@ if (isNotFunction(installer)) { | ||
const sessionURL = new URL(`/validate?ticket=${ticket}`, origin); | ||
const sessionURL = new URL(`/validate?ticket=${ticket}&app=${app}`, origin); | ||
const response = await fetch(sessionURL); | ||
@@ -186,0 +192,0 @@ |
/*! | ||
* @3dnest/garage-host v0.1.1 | ||
* @3dnest/garage-host v0.2.0 | ||
* (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),a=e=>!(e=>i(e,"object"))(e),o=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=>{a(e)&&t("Invalid options, a plain object expected.");const i={},{origin:n,ticket:o}=e;return r(n)&&t("Invalid .origin, a url string expected."),r(o)&&t("Invalid .ticket, a ticket string expected."),i.origin=n,i.ticket=o,i})(i);o(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,name: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 name, a string 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(g,u,v)};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),a=e=>!(e=>i(e,"object"))(e),o=e=>!(e=>i(e,"function"))(e),c=document,d=c.body,p=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,d.appendChild(r),t})).finally((()=>{return((e,t)=>e.removeChild(t))((e=t).parentElement,e);var e}))},s=async(i,c)=>{const{origin:d,ticket:s,app:l}=(e=>{a(e)&&t("Invalid options, a plain object expected.");const i={},{origin:n,ticket:o,app:c}=e;return r(n)&&t("Invalid .origin, a url string expected."),r(o)&&t("Invalid .ticket, a ticket string expected."),r(c)&&t("Invalid .app, an app id string expected."),i.origin=n,i.ticket=o,i.app=c,i})(i);o(c)&&t("Invalid installer, a function expected.");const v=new URL(`/validate?ticket=${s}&app=${l}`,d),_=await fetch(v);_.ok||e("Authentication failed.");const w=await _.json(),{scriptList:I,name:g,version:E}=w;n(I)||t("Service: Invalid scriptList, an array expected."),I.forEach(((e,i)=>{r(e)&&t(`Service: Invalid scriptList[${i}], a string expected.`)})),r(g)&&t("Service: Invalid solution name, a string expected."),r(E)&&t("Service: Invalid version, a string expected.");for(const e of I)await p(e);const u=window.__GARAGE_SOLUTION_PROVIDER__,x=window.__SPOKE__;delete window.__GARAGE_SOLUTION_PROVIDER__,delete window.__SPOKE__,c(u,x,w)};export{s as Solution}; |
/*! | ||
* @3dnest/garage-host v0.1.1 | ||
* @3dnest/garage-host v0.2.0 | ||
* (c) 2021-2022 3dnest | ||
@@ -162,3 +162,4 @@ * Released under the MIT License. | ||
origin: _origin, | ||
ticket: _ticket | ||
ticket: _ticket, | ||
app: _app | ||
} = _options; | ||
@@ -174,4 +175,9 @@ | ||
if (isNotString(_app)) { | ||
throwTypeError('Invalid .app, an app id string expected.'); | ||
} | ||
options.origin = _origin; | ||
options.ticket = _ticket; | ||
options.app = _app; | ||
@@ -182,3 +188,3 @@ return options; | ||
const Solution = async (options, installer) => { | ||
const { origin, ticket } = normalize(options); | ||
const { origin, ticket, app } = normalize(options); | ||
@@ -189,3 +195,3 @@ if (isNotFunction(installer)) { | ||
const sessionURL = new URL(`/validate?ticket=${ticket}`, origin); | ||
const sessionURL = new URL(`/validate?ticket=${ticket}&app=${app}`, origin); | ||
const response = await fetch(sessionURL); | ||
@@ -192,0 +198,0 @@ |
/*! | ||
* @3dnest/garage-host v0.1.1 | ||
* @3dnest/garage-host v0.2.0 | ||
* (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)},n=e=>t(e,TypeError),i=(e,t)=>(e=>typeof e)(e)===t,o=Array.isArray,r=e=>!(e=>i(e,"string"))(e),a=e=>!(e=>i(e,"object"))(e),c=e=>!(e=>i(e,"function"))(e),s=document,d=s.body,l=async e=>{const t=(n="script",s.createElement(n));var n;return new Promise(((n,i)=>{var o;return t.onload=n,t.onerror=i,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,i)=>{const{origin:s,ticket:d}=(e=>{a(e)&&n("Invalid options, a plain object expected.");const t={},{origin:i,ticket:o}=e;return r(i)&&n("Invalid .origin, a url string expected."),r(o)&&n("Invalid .ticket, a ticket string expected."),t.origin=i,t.ticket=o,t})(e);c(i)&&n("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,name:v,version:w}=_;o(u)||n("Service: Invalid scriptList, an array expected."),u.forEach(((e,t)=>{r(e)&&n(`Service: Invalid scriptList[${t}], a string expected.`)})),r(v)&&n("Service: Invalid solution name, a string expected."),r(w)&&n("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__,i(g,y,_)},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)},n=e=>t(e,TypeError),i=(e,t)=>(e=>typeof e)(e)===t,r=Array.isArray,o=e=>!(e=>i(e,"string"))(e),a=e=>!(e=>i(e,"object"))(e),c=e=>!(e=>i(e,"function"))(e),d=document,s=d.body,p=async e=>{const t=(n="script",d.createElement(n));var n;return new Promise(((n,i)=>{var r;return t.onload=n,t.onerror=i,t.src=e,r=t,s.appendChild(r),t})).finally((()=>{return((e,t)=>e.removeChild(t))((e=t).parentElement,e);var e}))};e.Solution=async(e,i)=>{const{origin:d,ticket:s,app:l}=(e=>{a(e)&&n("Invalid options, a plain object expected.");const t={},{origin:i,ticket:r,app:c}=e;return o(i)&&n("Invalid .origin, a url string expected."),o(r)&&n("Invalid .ticket, a ticket string expected."),o(c)&&n("Invalid .app, an app id string expected."),t.origin=i,t.ticket=r,t.app=c,t})(e);c(i)&&n("Invalid installer, a function expected.");const f=new URL(`/validate?ticket=${s}&app=${l}`,d),_=await fetch(f);_.ok||t("Authentication failed.");const v=await _.json(),{scriptList:u,name:g,version:w}=v;r(u)||n("Service: Invalid scriptList, an array expected."),u.forEach(((e,t)=>{o(e)&&n(`Service: Invalid scriptList[${t}], a string expected.`)})),o(g)&&n("Service: Invalid solution name, a string expected."),o(w)&&n("Service: Invalid version, a string expected.");for(const e of u)await p(e);const y=window.__GARAGE_SOLUTION_PROVIDER__,I=window.__SPOKE__;delete window.__GARAGE_SOLUTION_PROVIDER__,delete window.__SPOKE__,i(y,I,v)},Object.defineProperty(e,"__esModule",{value:!0})})); |
12
index.js
@@ -26,3 +26,4 @@ import { Lang, Type } from '@produck/charon'; | ||
origin: _origin, | ||
ticket: _ticket | ||
ticket: _ticket, | ||
app: _app | ||
} = _options; | ||
@@ -38,4 +39,9 @@ | ||
if (Type.Not.String(_app)) { | ||
Lang.Throw.TypeError('Invalid .app, an app id string expected.'); | ||
} | ||
options.origin = _origin; | ||
options.ticket = _ticket; | ||
options.app = _app; | ||
@@ -46,3 +52,3 @@ return options; | ||
export const Solution = async (options, installer) => { | ||
const { origin, ticket } = normalize(options); | ||
const { origin, ticket, app } = normalize(options); | ||
@@ -53,3 +59,3 @@ if (Type.Not.Function(installer)) { | ||
const sessionURL = new URL(`/validate?ticket=${ticket}`, origin); | ||
const sessionURL = new URL(`/validate?ticket=${ticket}&app=${app}`, origin); | ||
const response = await fetch(sessionURL); | ||
@@ -56,0 +62,0 @@ |
{ | ||
"name": "@3dnest/garage-host", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "> TODO: description", | ||
@@ -35,11 +35,11 @@ "author": "Chaos Lee <chaos2lee@qq.com>", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^22.0.0", | ||
"@rollup/plugin-commonjs": "^22.0.2", | ||
"@rollup/plugin-html": "^0.2.4", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"rollup": "^2.75.6", | ||
"rollup": "^2.78.1", | ||
"rollup-plugin-livereload": "^2.0.5", | ||
"rollup-plugin-serve": "^1.1.0", | ||
"rollup-plugin-serve": "^2.0.1", | ||
"rollup-plugin-terser": "^7.0.2" | ||
}, | ||
"gitHead": "1b4c0659f4add3fe898af44cf255d264919a340a" | ||
"gitHead": "c8f17cb9756ae40f1a4f98828a542e703fbd57f3" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19349
482