@zvonimirsun/iszy-common 1.0.10 → 1.0.12

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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var E=(n=>(n.SUPERADMIN="superadmin",n.ADMIN="admin",n))(E||{}),u=(n=>(n[n.DEACTIVATED=0]="DEACTIVATED",n[n.ENABLED=1]="ENABLED",n[n.DISABLED=2]="DISABLED",n))(u||{});const g="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function i(n){let e="";do e=g.charAt(Number(n%62n))+e,n=n/62n;while(n>0n);return e}const D=/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\v\f\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|\\[\x01-\x09\v\f\x0E-\x7F])\*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d{1,2}|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\v\f\x0E-\x1F\x21-\x5A\x53-\x7F]|\\[\x01-\x09\v\f\x0E-\x7F])+)\])$/,I=/^1[3-9]\d{9}$/,t=[];for(let n=0;n<256;++n)t.push((n+256).toString(16).slice(1));function l(n,e=0){return(t[n[e+0]]+t[n[e+1]]+t[n[e+2]]+t[n[e+3]]+"-"+t[n[e+4]]+t[n[e+5]]+"-"+t[n[e+6]]+t[n[e+7]]+"-"+t[n[e+8]]+t[n[e+9]]+"-"+t[n[e+10]]+t[n[e+11]]+t[n[e+12]]+t[n[e+13]]+t[n[e+14]]+t[n[e+15]]).toLowerCase()}let o;const y=new Uint8Array(16);function A(){if(!o){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");o=crypto.getRandomValues.bind(crypto)}return o(y)}const U=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),x={randomUUID:U};function b(n,e,r){var d;if(x.randomUUID&&!n)return x.randomUUID();n=n||{};const c=n.random??((d=n.rng)==null?void 0:d.call(n))??A();if(c.length<16)throw new Error("Random bytes length must be >= 16");return c[6]=c[6]&15|64,c[8]=c[8]&63|128,l(c)}function a(){return b()}function m(n){n=n||a();const e=n.replace(/-/g,""),r=BigInt(`0x${e.substring(0,16)}`),c=BigInt(`0x${e.substring(16,32)}`),d=r^c;return i(d).substring(0,6)}exports.REGEX_EMAIL=D;exports.REGEX_MOBILE_PHONE=I;exports.RoleEnum=E;exports.UserStatus=u;exports.base62Encode=i;exports.encodeUUID=m;exports.getUUID=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var u=(n=>(n.SUPERADMIN="superadmin",n.ADMIN="admin",n))(u||{}),x=(n=>(n[n.DEACTIVATED=0]="DEACTIVATED",n[n.ENABLED=1]="ENABLED",n[n.DISABLED=2]="DISABLED",n))(x||{});const g="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function E(n){let t="";do t=g.charAt(Number(n%62n))+t,n=n/62n;while(n>0n);return t}const D=/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\v\f\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|\\[\x01-\x09\v\f\x0E-\x7F])\*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d{1,2}|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\v\f\x0E-\x1F\x21-\x5A\x53-\x7F]|\\[\x01-\x09\v\f\x0E-\x7F])+)\])$/,I=/^1[3-9]\d{9}$/,e=[];for(let n=0;n<256;++n)e.push((n+256).toString(16).slice(1));function l(n,t=0){return(e[n[t+0]]+e[n[t+1]]+e[n[t+2]]+e[n[t+3]]+"-"+e[n[t+4]]+e[n[t+5]]+"-"+e[n[t+6]]+e[n[t+7]]+"-"+e[n[t+8]]+e[n[t+9]]+"-"+e[n[t+10]]+e[n[t+11]]+e[n[t+12]]+e[n[t+13]]+e[n[t+14]]+e[n[t+15]]).toLowerCase()}let r;const s=new Uint8Array(16);function y(){if(!r){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");r=crypto.getRandomValues.bind(crypto)}return r(s)}const b=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),d={randomUUID:b};function p(n,t,c){n=n||{};const o=n.random??n.rng?.()??y();if(o.length<16)throw new Error("Random bytes length must be >= 16");return o[6]=o[6]&15|64,o[8]=o[8]&63|128,l(o)}function A(n,t,c){return d.randomUUID&&!n?d.randomUUID():p(n)}function i(){return A()}function U(n){n=n||i();const t=n.replace(/-/g,""),c=BigInt(`0x${t.substring(0,16)}`),o=BigInt(`0x${t.substring(16,32)}`),a=c^o;return E(a).substring(0,6)}exports.REGEX_EMAIL=D;exports.REGEX_MOBILE_PHONE=I;exports.RoleEnum=u;exports.UserStatus=x;exports.base62Encode=E;exports.encodeUUID=U;exports.getUUID=i;
package/dist/index.js CHANGED
@@ -1,53 +1,53 @@
1
- var u = /* @__PURE__ */ ((n) => (n.SUPERADMIN = "superadmin", n.ADMIN = "admin", n))(u || {}), E = /* @__PURE__ */ ((n) => (n[n.DEACTIVATED = 0] = "DEACTIVATED", n[n.ENABLED = 1] = "ENABLED", n[n.DISABLED = 2] = "DISABLED", n))(E || {});
2
- const i = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
1
+ var u = /* @__PURE__ */ ((n) => (n.SUPERADMIN = "superadmin", n.ADMIN = "admin", n))(u || {}), i = /* @__PURE__ */ ((n) => (n[n.DEACTIVATED = 0] = "DEACTIVATED", n[n.ENABLED = 1] = "ENABLED", n[n.DISABLED = 2] = "DISABLED", n))(i || {});
2
+ const E = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
3
3
  function g(n) {
4
4
  let t = "";
5
5
  do
6
- t = i.charAt(Number(n % 62n)) + t, n = n / 62n;
6
+ t = E.charAt(Number(n % 62n)) + t, n = n / 62n;
7
7
  while (n > 0n);
8
8
  return t;
9
9
  }
10
- const l = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\v\f\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|\\[\x01-\x09\v\f\x0E-\x7F])\*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d{1,2}|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\v\f\x0E-\x1F\x21-\x5A\x53-\x7F]|\\[\x01-\x09\v\f\x0E-\x7F])+)\])$/, m = /^1[3-9]\d{9}$/, e = [];
10
+ const l = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\v\f\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|\\[\x01-\x09\v\f\x0E-\x7F])\*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d{1,2}|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\v\f\x0E-\x1F\x21-\x5A\x53-\x7F]|\\[\x01-\x09\v\f\x0E-\x7F])+)\])$/, b = /^1[3-9]\d{9}$/, e = [];
11
11
  for (let n = 0; n < 256; ++n)
12
12
  e.push((n + 256).toString(16).slice(1));
13
13
  function D(n, t = 0) {
14
14
  return (e[n[t + 0]] + e[n[t + 1]] + e[n[t + 2]] + e[n[t + 3]] + "-" + e[n[t + 4]] + e[n[t + 5]] + "-" + e[n[t + 6]] + e[n[t + 7]] + "-" + e[n[t + 8]] + e[n[t + 9]] + "-" + e[n[t + 10]] + e[n[t + 11]] + e[n[t + 12]] + e[n[t + 13]] + e[n[t + 14]] + e[n[t + 15]]).toLowerCase();
15
15
  }
16
- let d;
16
+ let c;
17
17
  const a = new Uint8Array(16);
18
18
  function I() {
19
- if (!d) {
19
+ if (!c) {
20
20
  if (typeof crypto > "u" || !crypto.getRandomValues)
21
21
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
22
- d = crypto.getRandomValues.bind(crypto);
22
+ c = crypto.getRandomValues.bind(crypto);
23
23
  }
24
- return d(a);
24
+ return c(a);
25
25
  }
26
- const y = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), o = { randomUUID: y };
27
- function A(n, t, r) {
28
- var c;
29
- if (o.randomUUID && !n)
30
- return o.randomUUID();
26
+ const p = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), r = { randomUUID: p };
27
+ function y(n, t, x) {
31
28
  n = n || {};
32
- const x = n.random ?? ((c = n.rng) == null ? void 0 : c.call(n)) ?? I();
33
- if (x.length < 16)
29
+ const o = n.random ?? n.rng?.() ?? I();
30
+ if (o.length < 16)
34
31
  throw new Error("Random bytes length must be >= 16");
35
- return x[6] = x[6] & 15 | 64, x[8] = x[8] & 63 | 128, D(x);
32
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, D(o);
33
+ }
34
+ function A(n, t, x) {
35
+ return r.randomUUID && !n ? r.randomUUID() : y(n);
36
36
  }
37
37
  function h() {
38
38
  return A();
39
39
  }
40
- function b(n) {
40
+ function m(n) {
41
41
  n = n || h();
42
- const t = n.replace(/-/g, ""), r = BigInt(`0x${t.substring(0, 16)}`), x = BigInt(`0x${t.substring(16, 32)}`), c = r ^ x;
43
- return g(c).substring(0, 6);
42
+ const t = n.replace(/-/g, ""), x = BigInt(`0x${t.substring(0, 16)}`), o = BigInt(`0x${t.substring(16, 32)}`), d = x ^ o;
43
+ return g(d).substring(0, 6);
44
44
  }
45
45
  export {
46
46
  l as REGEX_EMAIL,
47
- m as REGEX_MOBILE_PHONE,
47
+ b as REGEX_MOBILE_PHONE,
48
48
  u as RoleEnum,
49
- E as UserStatus,
49
+ i as UserStatus,
50
50
  g as base62Encode,
51
- b as encodeUUID,
51
+ m as encodeUUID,
52
52
  h as getUUID
53
53
  };
@@ -1,8 +1,11 @@
1
1
  export interface Device {
2
2
  id?: string;
3
3
  ip: string;
4
+ name: string;
4
5
  current?: boolean;
5
- name?: boolean;
6
+ createdAt?: Date;
7
+ updatedAt?: Date;
8
+ [key: string]: any;
6
9
  }
7
10
  export interface DeviceCache extends Device {
8
11
  id: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zvonimirsun/iszy-common",
3
3
  "type": "module",
4
- "version": "1.0.10",
4
+ "version": "1.0.12",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -17,14 +17,14 @@
17
17
  "./dist"
18
18
  ],
19
19
  "dependencies": {
20
- "uuid": "^11.1.0"
20
+ "uuid": "^13.0.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@antfu/eslint-config": "^4.12.0",
24
- "eslint": "^9.24.0",
25
- "taze": "^19.0.4",
26
- "typescript": "~5.8.3",
27
- "vite": "^6.2.6"
23
+ "@antfu/eslint-config": "^5.4.1",
24
+ "eslint": "^9.37.0",
25
+ "taze": "^19.7.0",
26
+ "typescript": "~5.9.3",
27
+ "vite": "^7.1.9"
28
28
  },
29
29
  "scripts": {
30
30
  "dev": "vite",