@dnax/core 0.60.0 → 0.60.1

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/app/hono.ts CHANGED
@@ -133,6 +133,7 @@ function HonoInstance(): typeof app {
133
133
  role: sessionData?.role || null,
134
134
  _v: { ...(_v || {}) },
135
135
  isAuth: true,
136
+ uuid: sessionData?.uuid || null,
136
137
  });
137
138
  } else {
138
139
  // no valid token
@@ -379,6 +380,7 @@ function HonoInstance(): typeof app {
379
380
  role: sessionStorage().get().role || null,
380
381
  user: sessionStorage().get().state?.user,
381
382
  state: sessionStorage().get().state,
383
+ uuid: sessionStorage().get().uuid,
382
384
  ip:
383
385
  c.req.raw.headers?.get("CF-Connecting-IP") ||
384
386
  c.req.raw.headers?.get("x-forwarded-for") ||
@@ -403,6 +405,7 @@ function HonoInstance(): typeof app {
403
405
  user: sessionStorage().get().state?.user,
404
406
  state: sessionStorage().get().state,
405
407
  role: sessionStorage().get().role || null,
408
+ uuid: sessionStorage().get().uuid,
406
409
  ip:
407
410
  c.req.raw.headers?.get("CF-Connecting-IP") ||
408
411
  c.req.raw.headers?.get("x-forwarded-for") ||
@@ -95,6 +95,7 @@ class useRest {
95
95
  ids?: string[];
96
96
  id?: string;
97
97
  };
98
+ uuid?: string;
98
99
  action: string;
99
100
  ip?: string;
100
101
  user?: object;
@@ -469,6 +470,7 @@ class useRest {
469
470
  role: sessionStorage()?.get()?.role!,
470
471
  user: sessionStorage()?.get()?.state?.user,
471
472
  state: sessionStorage()?.get()?.state,
473
+ uuid: sessionStorage()?.get()?.uuid,
472
474
  });
473
475
  return resolve(toJson(data));
474
476
  } catch (err) {
@@ -613,6 +615,7 @@ class useRest {
613
615
  role: sessionStorage()?.get()?.role!,
614
616
  user: sessionStorage()?.get()?.state?.user,
615
617
  state: sessionStorage()?.get()?.state,
618
+ uuid: sessionStorage()?.get()?.uuid,
616
619
  });
617
620
  return resolve(toJson(data));
618
621
  } catch (err) {
@@ -1235,6 +1238,7 @@ class useRest {
1235
1238
  role: sessionStorage()?.get()?.role!,
1236
1239
  user: sessionStorage()?.get()?.state?.user,
1237
1240
  state: sessionStorage()?.get()?.state,
1241
+ uuid: sessionStorage()?.get()?.uuid,
1238
1242
  });
1239
1243
  return resolve(toJson(result?.doc || {}));
1240
1244
  } catch (err) {
@@ -1332,6 +1336,7 @@ class useRest {
1332
1336
  role: sessionStorage()?.get()?.role!,
1333
1337
  user: sessionStorage()?.get()?.state?.user,
1334
1338
  state: sessionStorage()?.get()?.state,
1339
+ uuid: sessionStorage()?.get()?.uuid,
1335
1340
  });
1336
1341
 
1337
1342
  return resolve({
@@ -1433,6 +1438,7 @@ class useRest {
1433
1438
  role: sessionStorage()?.get()?.role!,
1434
1439
  user: sessionStorage()?.get()?.state?.user,
1435
1440
  state: sessionStorage()?.get()?.state,
1441
+ uuid: sessionStorage()?.get()?.uuid,
1436
1442
  });
1437
1443
  return resolve(result.doc);
1438
1444
  } catch (err) {
@@ -1665,6 +1671,7 @@ class useRest {
1665
1671
  role: sessionStorage()?.get()?.role!,
1666
1672
  user: sessionStorage()?.get()?.state?.user,
1667
1673
  state: sessionStorage()?.get()?.state,
1674
+ uuid: sessionStorage()?.get()?.uuid,
1668
1675
  });
1669
1676
  return resolve(result.docs);
1670
1677
  } else {
@@ -1804,6 +1811,7 @@ class useRest {
1804
1811
  role: sessionStorage()?.get()?.role!,
1805
1812
  user: sessionStorage()?.get()?.state?.user,
1806
1813
  state: sessionStorage()?.get()?.state,
1814
+ uuid: sessionStorage()?.get()?.uuid,
1807
1815
  });
1808
1816
 
1809
1817
  return resolve(doc);
@@ -1942,6 +1950,7 @@ class useRest {
1942
1950
  role: sessionStorage()?.get()?.role!,
1943
1951
  user: sessionStorage()?.get()?.state?.user,
1944
1952
  state: sessionStorage()?.get()?.state,
1953
+ uuid: sessionStorage()?.get()?.uuid,
1945
1954
  });
1946
1955
  return resolve(deletedIds);
1947
1956
  } catch (err) {
@@ -1969,6 +1978,7 @@ class useRest {
1969
1978
  role: sessionStorage()?.get()?.role!,
1970
1979
  user: sessionStorage()?.get()?.state?.user,
1971
1980
  state: sessionStorage()?.get()?.state,
1981
+ uuid: sessionStorage()?.get()?.uuid,
1972
1982
  });
1973
1983
  return resolve(r);
1974
1984
  } catch (err) {
@@ -2042,6 +2052,7 @@ const restActivity = {
2042
2052
  activity: {
2043
2053
  collection?: string;
2044
2054
  data: any;
2055
+ uuid?: string | undefined | null;
2045
2056
  action: string;
2046
2057
  internal?: boolean;
2047
2058
  ip?: string;
@@ -2069,6 +2080,7 @@ const restActivity = {
2069
2080
  state: activity?.state,
2070
2081
  role: activity?.role,
2071
2082
  transaction: activity?.transaction ?? false,
2083
+ uuid: activity?.uuid,
2072
2084
  })
2073
2085
  )
2074
2086
  .catch();
@@ -2,7 +2,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
2
2
  import type { sessionCtx } from "../types";
3
3
  import { localSession } from "./session";
4
4
  import { v4 } from "uuid";
5
- import { jwt } from "../utils";
5
+ import { jwt, uuid } from "../utils";
6
6
  import { Cfg } from "../config";
7
7
  const asyncLocalStorage = new AsyncLocalStorage();
8
8
  const key = "___sessionStorage___";
@@ -24,10 +24,10 @@ const sessionStorage = () => ({
24
24
  get(): {
25
25
  state: {
26
26
  [key: string]: any;
27
- user: any;
27
+ user?: any;
28
28
  };
29
- _v: {
30
- isAuth: boolean;
29
+ _v?: {
30
+ isAuth?: boolean;
31
31
  reqAt?: string;
32
32
  setAt?: string;
33
33
  ip?: string;
@@ -35,6 +35,7 @@ const sessionStorage = () => ({
35
35
  role: string | null | undefined;
36
36
  token?: string;
37
37
  isAuth?: boolean;
38
+ uuid?: string;
38
39
  } {
39
40
  if (!isSetAsyncLocalStorage()) return { state: {}, _v: {}, role: null };
40
41
  let store = asyncLocalStorage?.getStore() as InstanceType<typeof Map>;
@@ -54,6 +55,7 @@ const sessionStorage = () => ({
54
55
  input: {
55
56
  id?: string;
56
57
  state?: object;
58
+ uuid?: string;
57
59
  _v?: object;
58
60
  role?: string;
59
61
  token?: string;
@@ -72,14 +74,19 @@ const sessionStorage = () => ({
72
74
  );
73
75
  }
74
76
  let store = asyncLocalStorage?.getStore() as InstanceType<typeof Map>;
75
- if (!input?.id) {
77
+ if (!input?.uuid) {
76
78
  input.id = v4();
77
79
  }
78
80
 
81
+ if (!input?.uuid) {
82
+ input.uuid = v4();
83
+ }
84
+
79
85
  let data = {
80
86
  isAuth: input?.isAuth ?? false,
81
87
  state: input?.state || {},
82
88
  role: input?.role || null,
89
+ uuid: input?.uuid,
83
90
  _v: {
84
91
  ...(input?._v || {}),
85
92
  setAt: new Date().toString(),
@@ -93,6 +100,7 @@ const sessionStorage = () => ({
93
100
  id: input.id,
94
101
  state: input?.state,
95
102
  role: input?.role || null,
103
+ uuid: input?.uuid,
96
104
  _v: {
97
105
  ...(input?._v || {}),
98
106
  setAt: new Date().toString(),
@@ -116,6 +124,7 @@ const sessionStorage = () => ({
116
124
  role: input.role,
117
125
  token: input.token,
118
126
  id: input.id,
127
+ uuid: input.uuid,
119
128
  };
120
129
  },
121
130
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.60.0",
3
+ "version": "0.60.1",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {