h1v3 0.10.1 → 0.11.0
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.
|
@@ -7,10 +7,10 @@ import { userInvites } from "./team/invites.js";
|
|
|
7
7
|
import { team } from "./team/team.js";
|
|
8
8
|
import { logger } from "./logger.js";
|
|
9
9
|
|
|
10
|
-
function populateParameters(ps,
|
|
10
|
+
function populateParameters(ps, path) {
|
|
11
11
|
|
|
12
|
-
if (!
|
|
13
|
-
return Object.entries(ps).reduce((
|
|
12
|
+
if (!path) return path;
|
|
13
|
+
return Object.entries(ps).reduce((p, [k, v]) => p.replaceAll(`$${k}`, v), path);
|
|
14
14
|
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -29,11 +29,12 @@ export async function inject({ database, authentication, metaURL, meta, handleEr
|
|
|
29
29
|
meta = meta || await import(metaURL, { with: { type: "json" } });
|
|
30
30
|
|
|
31
31
|
const log = logger(database, authentication, meta.o11y.path);
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
32
|
+
const buildEventStore = (path, params) => eventStore(database, authentication, populateParameters(params, path));
|
|
33
|
+
const teamMembershipStoreFactory = ({ tid }) => buildEventStore(meta.team.membership.path, { tid });
|
|
34
|
+
const teamDetailsStoreFactory = ({ tid }) => buildEventStore(meta.team.details.path, { tid });
|
|
35
|
+
const userInvitesStoreFactory = ({ emailId }) => buildEventStore(meta.userInvites.path, { emailId });
|
|
36
|
+
const userTeamsStoreFactory = ({ uid }) => buildEventStore(meta.user.teams.path, { uid });
|
|
37
|
+
const userProfileStoreFactory = ({ uid }) => buildEventStore(meta.user.profile.path, { uid });
|
|
37
38
|
|
|
38
39
|
return {
|
|
39
40
|
|
|
@@ -68,6 +69,12 @@ export async function inject({ database, authentication, metaURL, meta, handleEr
|
|
|
68
69
|
|
|
69
70
|
return log.context(sharedAttributes);
|
|
70
71
|
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
eventStore(path, params) {
|
|
75
|
+
|
|
76
|
+
return buildEventStore(path, params);
|
|
77
|
+
|
|
71
78
|
}
|
|
72
79
|
|
|
73
80
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function rand62(n) {
|
|
2
2
|
|
|
3
|
-
if (n
|
|
3
|
+
if (!n || n < 1) return "";
|
|
4
4
|
const out = [];
|
|
5
5
|
const bytes = new Uint8Array(n * 2);
|
|
6
6
|
do {
|
|
@@ -14,7 +14,7 @@ export function rand62(n) {
|
|
|
14
14
|
out.push(
|
|
15
15
|
String.fromCharCode(x < 10 ? 48 + x : x < 36 ? 97 + x - 10 : 65 + x - 36)
|
|
16
16
|
);
|
|
17
|
-
if (out.length
|
|
17
|
+
if (out.length >= n) return out.join('');
|
|
18
18
|
|
|
19
19
|
}
|
|
20
20
|
|