@zvonimirsun/iszy-common 1.0.4 → 1.0.6

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.
@@ -1 +1,2 @@
1
1
  export * from './role.enum';
2
+ export * from './userstatus.enum';
@@ -0,0 +1,5 @@
1
+ export declare enum UserStatus {
2
+ DEACTIVATED = 0,
3
+ ENABLED = 1,
4
+ DISABLED = 2
5
+ }
package/dist/index.js CHANGED
@@ -1,52 +1,53 @@
1
- var o = /* @__PURE__ */ ((n) => (n.SUPERADMIN = "superadmin", n.ADMIN = "admin", n))(o || {});
2
- const a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
3
- function i(n) {
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";
3
+ function g(n) {
4
4
  let t = "";
5
5
  do
6
- t = a.charAt(Number(n % 62n)) + t, n = n / 62n;
6
+ t = i.charAt(Number(n % 62n)) + t, n = n / 62n;
7
7
  while (n > 0n);
8
8
  return t;
9
9
  }
10
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 = [];
11
11
  for (let n = 0; n < 256; ++n)
12
12
  e.push((n + 256).toString(16).slice(1));
13
- function g(n, t = 0) {
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 r;
17
- const s = new Uint8Array(16);
18
- function U() {
19
- if (!r) {
16
+ let d;
17
+ const a = new Uint8Array(16);
18
+ function I() {
19
+ if (!d) {
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
- r = crypto.getRandomValues.bind(crypto);
22
+ d = crypto.getRandomValues.bind(crypto);
23
23
  }
24
- return r(s);
24
+ return d(a);
25
25
  }
26
- const y = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), u = { randomUUID: y };
27
- function E(n, t, d) {
26
+ const y = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), o = { randomUUID: y };
27
+ function A(n, t, r) {
28
28
  var c;
29
- if (u.randomUUID && !n)
30
- return u.randomUUID();
29
+ if (o.randomUUID && !n)
30
+ return o.randomUUID();
31
31
  n = n || {};
32
- const x = n.random ?? ((c = n.rng) == null ? void 0 : c.call(n)) ?? U();
32
+ const x = n.random ?? ((c = n.rng) == null ? void 0 : c.call(n)) ?? I();
33
33
  if (x.length < 16)
34
34
  throw new Error("Random bytes length must be >= 16");
35
- return x[6] = x[6] & 15 | 64, x[8] = x[8] & 63 | 128, g(x);
35
+ return x[6] = x[6] & 15 | 64, x[8] = x[8] & 63 | 128, D(x);
36
36
  }
37
37
  function h() {
38
- return E();
38
+ return A();
39
39
  }
40
- function I(n) {
40
+ function b(n) {
41
41
  n = n || h();
42
- const t = n.replace(/-/g, ""), d = BigInt(`0x${t.substring(0, 16)}`), x = BigInt(`0x${t.substring(16, 32)}`), c = d ^ x;
43
- return i(c).substring(0, 6);
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);
44
44
  }
45
45
  export {
46
46
  l as REGEX_EMAIL,
47
47
  m as REGEX_MOBILE_PHONE,
48
- o as RoleEnum,
49
- i as base62Encode,
50
- I as encodeUUID,
48
+ u as RoleEnum,
49
+ E as UserStatus,
50
+ g as base62Encode,
51
+ b as encodeUUID,
51
52
  h as getUUID
52
53
  };
@@ -0,0 +1,4 @@
1
+ export interface Device {
2
+ id: number;
3
+ ip: string;
4
+ }
@@ -1,4 +1 @@
1
- export * from './group';
2
- export * from './privilege';
3
- export * from './role';
4
- export * from './user';
1
+ export * from './device';
@@ -1,2 +1,3 @@
1
1
  export * from './auth';
2
2
  export * from './common';
3
+ export * from './user';
@@ -0,0 +1,4 @@
1
+ export * from './group';
2
+ export * from './privilege';
3
+ export * from './role';
4
+ export * from './user';
@@ -20,6 +20,6 @@ export interface RawUser {
20
20
  }
21
21
  export type PublicUser = Omit<RawUser, 'passwd' | 'passwdSalt'>;
22
22
  export type RegisterUser = Pick<RawUser, 'userName' | 'nickName' | 'mobile' | 'email' | 'passwd'>;
23
- export type UpdateUser = Partial<Pick<RawUser, 'userName' | 'nickName' | 'mobile' | 'email' | 'passwd'>> & {
23
+ export interface UpdateUser extends Partial<Pick<RawUser, 'userName' | 'nickName' | 'mobile' | 'email' | 'passwd'>> {
24
24
  oldPasswd?: string;
25
- };
25
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zvonimirsun/iszy-common",
3
3
  "type": "module",
4
- "version": "1.0.4",
4
+ "version": "1.0.6",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
File without changes
File without changes
File without changes