@olenbetong/appframe-core 1.0.0 → 1.0.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Ølen Betong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -421,7 +421,7 @@ var UserSession = class extends SessionHandler {
421
421
  };
422
422
 
423
423
  // src/index.ts
424
- var version = "1.0.0";
424
+ var version = "1.0.2";
425
425
  export {
426
426
  SessionHandler,
427
427
  UserSession,
@@ -44,5 +44,5 @@ return s;
44
44
  </div>
45
45
  </div>
46
46
  </div>
47
- `;let r=af.userSession.login?v.messages.relog:v.messages.login,p=o.querySelector(".message"),c=o.querySelector(".alert-warning"),a=o.querySelector("input[type=text]"),A=o.querySelector(".sign-in"),i=o.querySelector("input[type=password]");if(p!==null&&a!==null&&c!==null&&a!==null&&A!==null&&i!==null){p.innerText=f(r),a.value=af.userSession.login||"",a.disabled=!!af.userSession.login,a.readOnly=!!af.userSession.login,document.body.appendChild(o);let g=async()=>{i.disabled=!0;let s=new Request("/login",{body:JSON.stringify({username:a.value,password:i.value,remember:!1}),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"});try{let d=await(await fetch(s)).json();if(d.success)document.body.removeChild(o),this.showingDialog=!1,this.eventHandler.emit("onAuthenticated"),c.parentNode&&(c.parentNode.style.display="none");else throw new Error(d.error)}catch(y){if(y&&typeof y=="object"){let d=y;i.disabled=!1,i.classList.toggle("invalid",!0),i.value="",i.focus(),c.innerText=d.message?d.message:String(d),c.parentNode&&(c.parentNode.style.display="initial")}}};A.addEventListener("click",g),i.addEventListener("keyup",s=>{s.key==="Enter"&&g()}),i.addEventListener("change",s=>{s.key==="Enter"&&g()}),a.addEventListener("keyup",s=>{s.key==="Enter"&&g()}),a.addEventListener("change",s=>{s.key==="Enter"&&g()}),i.focus()}}}attachEvent(e,n){return this.eventHandler.on(e,n)}detachEvent(e,n){return this.eventHandler.off(e,n)}},l=v;l.messages={login:"Log in",relog:"Session expired - log in"};var S=class extends l{constructor(n){super();this.decimalSeparator=".";this.groupSeparator=null;this.shortDateFormat="dd.MM.yyyy";this.login=null;this.isDeveloper=!1;this.formats={},Object.assign(this,n)}};var re="1.0.0";export{l as SessionHandler,S as UserSession,L as expose,f as getLocalizedString,q as localStorage,b as mitt,re as version};
47
+ `;let r=af.userSession.login?v.messages.relog:v.messages.login,p=o.querySelector(".message"),c=o.querySelector(".alert-warning"),a=o.querySelector("input[type=text]"),A=o.querySelector(".sign-in"),i=o.querySelector("input[type=password]");if(p!==null&&a!==null&&c!==null&&a!==null&&A!==null&&i!==null){p.innerText=f(r),a.value=af.userSession.login||"",a.disabled=!!af.userSession.login,a.readOnly=!!af.userSession.login,document.body.appendChild(o);let g=async()=>{i.disabled=!0;let s=new Request("/login",{body:JSON.stringify({username:a.value,password:i.value,remember:!1}),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"});try{let d=await(await fetch(s)).json();if(d.success)document.body.removeChild(o),this.showingDialog=!1,this.eventHandler.emit("onAuthenticated"),c.parentNode&&(c.parentNode.style.display="none");else throw new Error(d.error)}catch(y){if(y&&typeof y=="object"){let d=y;i.disabled=!1,i.classList.toggle("invalid",!0),i.value="",i.focus(),c.innerText=d.message?d.message:String(d),c.parentNode&&(c.parentNode.style.display="initial")}}};A.addEventListener("click",g),i.addEventListener("keyup",s=>{s.key==="Enter"&&g()}),i.addEventListener("change",s=>{s.key==="Enter"&&g()}),a.addEventListener("keyup",s=>{s.key==="Enter"&&g()}),a.addEventListener("change",s=>{s.key==="Enter"&&g()}),i.focus()}}}attachEvent(e,n){return this.eventHandler.on(e,n)}detachEvent(e,n){return this.eventHandler.off(e,n)}},l=v;l.messages={login:"Log in",relog:"Session expired - log in"};var S=class extends l{constructor(n){super();this.decimalSeparator=".";this.groupSeparator=null;this.shortDateFormat="dd.MM.yyyy";this.login=null;this.isDeveloper=!1;this.formats={},Object.assign(this,n)}};var re="1.0.2";export{l as SessionHandler,S as UserSession,L as expose,f as getLocalizedString,q as localStorage,b as mitt,re as version};
48
48
  //# sourceMappingURL=af.common.min.js.map
@@ -453,6 +453,6 @@ return s;
453
453
  };
454
454
 
455
455
  // src/index.ts
456
- var version = "1.0.0";
456
+ var version = "1.0.2";
457
457
  return __toCommonJS(src_exports);
458
458
  })();
@@ -44,5 +44,5 @@ return s;
44
44
  </div>
45
45
  </div>
46
46
  </div>
47
- `;let r=af.userSession.login?E.messages.relog:E.messages.login,p=o.querySelector(".message"),d=o.querySelector(".alert-warning"),a=o.querySelector("input[type=text]"),N=o.querySelector(".sign-in"),i=o.querySelector("input[type=password]");if(p!==null&&a!==null&&d!==null&&a!==null&&N!==null&&i!==null){p.innerText=c(r),a.value=af.userSession.login||"",a.disabled=!!af.userSession.login,a.readOnly=!!af.userSession.login,document.body.appendChild(o);let g=async()=>{i.disabled=!0;let s=new Request("/login",{body:JSON.stringify({username:a.value,password:i.value,remember:!1}),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"});try{let u=await(await fetch(s)).json();if(u.success)document.body.removeChild(o),this.showingDialog=!1,this.eventHandler.emit("onAuthenticated"),d.parentNode&&(d.parentNode.style.display="none");else throw new Error(u.error)}catch(h){if(h&&typeof h=="object"){let u=h;i.disabled=!1,i.classList.toggle("invalid",!0),i.value="",i.focus(),d.innerText=u.message?u.message:String(u),d.parentNode&&(d.parentNode.style.display="initial")}}};N.addEventListener("click",g),i.addEventListener("keyup",s=>{s.key==="Enter"&&g()}),i.addEventListener("change",s=>{s.key==="Enter"&&g()}),a.addEventListener("keyup",s=>{s.key==="Enter"&&g()}),a.addEventListener("change",s=>{s.key==="Enter"&&g()}),i.focus()}}}attachEvent(e,n){return this.eventHandler.on(e,n)}detachEvent(e,n){return this.eventHandler.off(e,n)}},l=E;l.messages={login:"Log in",relog:"Session expired - log in"};var y=class extends l{constructor(n){super();this.decimalSeparator=".";this.groupSeparator=null;this.shortDateFormat="dd.MM.yyyy";this.login=null;this.isDeveloper=!1;this.formats={},Object.assign(this,n)}};var F="1.0.0";return R(W);})();
47
+ `;let r=af.userSession.login?E.messages.relog:E.messages.login,p=o.querySelector(".message"),d=o.querySelector(".alert-warning"),a=o.querySelector("input[type=text]"),N=o.querySelector(".sign-in"),i=o.querySelector("input[type=password]");if(p!==null&&a!==null&&d!==null&&a!==null&&N!==null&&i!==null){p.innerText=c(r),a.value=af.userSession.login||"",a.disabled=!!af.userSession.login,a.readOnly=!!af.userSession.login,document.body.appendChild(o);let g=async()=>{i.disabled=!0;let s=new Request("/login",{body:JSON.stringify({username:a.value,password:i.value,remember:!1}),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"});try{let u=await(await fetch(s)).json();if(u.success)document.body.removeChild(o),this.showingDialog=!1,this.eventHandler.emit("onAuthenticated"),d.parentNode&&(d.parentNode.style.display="none");else throw new Error(u.error)}catch(h){if(h&&typeof h=="object"){let u=h;i.disabled=!1,i.classList.toggle("invalid",!0),i.value="",i.focus(),d.innerText=u.message?u.message:String(u),d.parentNode&&(d.parentNode.style.display="initial")}}};N.addEventListener("click",g),i.addEventListener("keyup",s=>{s.key==="Enter"&&g()}),i.addEventListener("change",s=>{s.key==="Enter"&&g()}),a.addEventListener("keyup",s=>{s.key==="Enter"&&g()}),a.addEventListener("change",s=>{s.key==="Enter"&&g()}),i.focus()}}}attachEvent(e,n){return this.eventHandler.on(e,n)}detachEvent(e,n){return this.eventHandler.off(e,n)}},l=E;l.messages={login:"Log in",relog:"Session expired - log in"};var y=class extends l{constructor(n){super();this.decimalSeparator=".";this.groupSeparator=null;this.shortDateFormat="dd.MM.yyyy";this.login=null;this.isDeveloper=!1;this.formats={},Object.assign(this,n)}};var F="1.0.2";return R(W);})();
48
48
  //# sourceMappingURL=af.common.min.js.map
package/es/index.js CHANGED
@@ -4,4 +4,4 @@ export { getLocalizedString } from "./getLocalizedString.js";
4
4
  export { default as localStorage } from "./localStorage.js";
5
5
  export { default as SessionHandler } from "./SessionHandler.js";
6
6
  export { default as UserSession } from "./UserSession.js";
7
- export const version = "1.0.0";
7
+ export const version = "1.0.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-core",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Javascript libraries to utilize the Appframe framework",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
@@ -13,7 +13,7 @@
13
13
  "scripts": {
14
14
  "prepack": "npm run build",
15
15
  "build": "npm run build:esbuild && npm run build:tsc",
16
- "build:esbuild": "node ../../shared/esbuild.js",
16
+ "build:esbuild": "node --loader ts-node/esm.mjs ../../shared/esbuild.ts",
17
17
  "build:tsc": " rm -rf ./es && tsc && node ./scripts/replace-version.js"
18
18
  },
19
19
  "author": "Bjørnar Vister Hansen <bvh@olenbetong.no>",
@@ -34,5 +34,6 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "chalk": "^5.0.1"
37
- }
37
+ },
38
+ "gitHead": "f7d752c4547e6f17d91fa83717175cd21d90b05f"
38
39
  }
package/src/global.d.ts CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  DataObject,
5
5
  Procedure,
6
6
  ProcedureAPI,
7
- } from "@olenbetong/data-object";
7
+ } from "@olenbetong/appframe-data";
8
8
  import UserSession from "./UserSession.js";
9
9
 
10
10
  export type Appframe = {