h1v3 0.10.2 → 0.12.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.
- package/dist/browser/client/context.js +15 -8
- package/package.json +1 -1
- package/src/commands/vendor.js +6 -52
- package/src/configuration/rules.js +4 -0
- package/src/exec-eventstore.js +1 -1
- package/src/membership/team-membership/store.js +10 -2
- package/src/package.js +32 -0
- package/src/system/main.js +2 -0
|
@@ -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
|
};
|
package/package.json
CHANGED
package/src/commands/vendor.js
CHANGED
|
@@ -1,35 +1,23 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
|
-
import { dirname, join
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
import me from "../package.js";
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
async function readPackageJSON() {
|
|
9
|
-
|
|
10
|
-
return JSON.parse(await fs.readFile(`${__dirname}/../../package.json`));
|
|
7
|
+
const packageName = `${me.name}@${me.version}`;
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
10
|
|
|
14
11
|
async function vendor(subpath) {
|
|
15
12
|
|
|
16
13
|
const src = join(__dirname, "..", "..", "dist", "browser", subpath);;
|
|
17
14
|
|
|
18
15
|
// Destination: include semver
|
|
19
|
-
const
|
|
20
|
-
const dest =join(destVendorPath(), versionedName, subpath);
|
|
16
|
+
const dest =join(destVendorPath(), packageName, subpath);
|
|
21
17
|
|
|
22
18
|
// Recursive copy
|
|
23
19
|
await fs.cp(src, dest, { recursive: true });
|
|
24
|
-
console.log(`Vendored ${
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async function versionedPackageName() {
|
|
29
|
-
|
|
30
|
-
const { version, name } = await readPackageJSON();
|
|
31
|
-
const versionedName = `${name}@${version}`;
|
|
32
|
-
return versionedName;
|
|
20
|
+
console.log(`Vendored ${packageName}/${subpath} -> ${dest}`);
|
|
33
21
|
|
|
34
22
|
}
|
|
35
23
|
|
|
@@ -39,18 +27,6 @@ function destVendorPath() {
|
|
|
39
27
|
|
|
40
28
|
}
|
|
41
29
|
|
|
42
|
-
// export async function eventStore(_argv) {
|
|
43
|
-
|
|
44
|
-
// await vendor("event-store");
|
|
45
|
-
|
|
46
|
-
// }
|
|
47
|
-
|
|
48
|
-
// export async function webPlatform(_argv) {
|
|
49
|
-
|
|
50
|
-
// await vendor("web");
|
|
51
|
-
|
|
52
|
-
// }
|
|
53
|
-
|
|
54
30
|
export async function deps(_argv) {
|
|
55
31
|
|
|
56
32
|
// lit
|
|
@@ -78,28 +54,6 @@ export async function client(_argv) {
|
|
|
78
54
|
|
|
79
55
|
}
|
|
80
56
|
|
|
81
|
-
// export async function webPlatformUI(_argv) {
|
|
82
|
-
|
|
83
|
-
// await webPlatform(_argv);
|
|
84
|
-
// await vendor("web-ui");
|
|
85
|
-
// const resp = await fetch("https://cdn.jsdelivr.net/gh/lit/dist@3.3.1/core/lit-core.min.js")
|
|
86
|
-
// const lit = await resp.text();
|
|
87
|
-
// const dest = join(".", "public", "vendor", "lit@3.3.1", "dist");
|
|
88
|
-
// await fs.mkdir(dest, { recursive: true });
|
|
89
|
-
// await fs.writeFile(
|
|
90
|
-
// join(".", "public", "vendor", "lit@3.3.1", "dist", "lit-core.min.js"),
|
|
91
|
-
// lit
|
|
92
|
-
// );
|
|
93
|
-
|
|
94
|
-
// }
|
|
95
|
-
|
|
96
|
-
// export async function membership(_argv) {
|
|
97
|
-
|
|
98
|
-
// await eventStore(_argv);
|
|
99
|
-
// await vendor("team");
|
|
100
|
-
|
|
101
|
-
// }
|
|
102
|
-
|
|
103
57
|
export async function symLinkLatest(_argv) {
|
|
104
58
|
|
|
105
59
|
const vendorPath = destVendorPath();
|
|
@@ -28,6 +28,10 @@ export const teamInviteToEmailMapping = ({ team: { membership: { path } } }) =>
|
|
|
28
28
|
|
|
29
29
|
`root.child('${path}/${PROJECTIONS}/inviteToEmail')`;
|
|
30
30
|
|
|
31
|
+
export const assertTeamDoesNotExist = ({ team: { membership: { path } } }) =>
|
|
32
|
+
|
|
33
|
+
`!root.child('${path}').exists()`;
|
|
34
|
+
|
|
31
35
|
export const assertDoesNotAlreadyExist =
|
|
32
36
|
|
|
33
37
|
"!data.exists()";
|
package/src/exec-eventstore.js
CHANGED
|
@@ -2,7 +2,7 @@ import details from "./projections/details.js";
|
|
|
2
2
|
import members from "./projections/members.js";
|
|
3
3
|
import inviteToEmail from "./projections/inviteToEmail.js";
|
|
4
4
|
|
|
5
|
-
import { eventTypes, INVITE_ACCEPTED, INVITE_REJECTED } from "./events.js";
|
|
5
|
+
import { BECAME_ADMIN, eventTypes, INVITE_ACCEPTED, INVITE_REJECTED } from "./events.js";
|
|
6
6
|
import {
|
|
7
7
|
newDataPayloadId,
|
|
8
8
|
assertPayloadUidMyUserId,
|
|
@@ -12,10 +12,12 @@ import {
|
|
|
12
12
|
teamInviteToEmailMapping,
|
|
13
13
|
any,
|
|
14
14
|
all,
|
|
15
|
-
assertEventIsOfType
|
|
15
|
+
assertEventIsOfType,
|
|
16
|
+
assertTeamDoesNotExist
|
|
16
17
|
} from "../../configuration/rules.js";
|
|
17
18
|
import { verifyStorePaths } from "../team-details/verify-store-paths.js";
|
|
18
19
|
|
|
20
|
+
|
|
19
21
|
export function store(paths) {
|
|
20
22
|
|
|
21
23
|
verifyStorePaths(paths, {
|
|
@@ -44,6 +46,12 @@ export function store(paths) {
|
|
|
44
46
|
|
|
45
47
|
)
|
|
46
48
|
|
|
49
|
+
),
|
|
50
|
+
all(
|
|
51
|
+
|
|
52
|
+
assertTeamDoesNotExist(paths),
|
|
53
|
+
assertEventIsOfType(BECAME_ADMIN),
|
|
54
|
+
assertPayloadUidMyUserId
|
|
47
55
|
)
|
|
48
56
|
|
|
49
57
|
),
|
package/src/package.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
import { dirname } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
|
|
9
|
+
get version() {
|
|
10
|
+
|
|
11
|
+
return ensure().version;
|
|
12
|
+
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
get name() {
|
|
16
|
+
|
|
17
|
+
return ensure().name;
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function ensure() {
|
|
24
|
+
|
|
25
|
+
if (!ensure.json) {
|
|
26
|
+
|
|
27
|
+
ensure.json = JSON.parse(readFileSync(`${__dirname}/../package.json`));
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
return ensure.json;
|
|
31
|
+
|
|
32
|
+
}
|
package/src/system/main.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import minimist from "minimist";
|
|
2
2
|
import { loadConfiguration } from "../configuration/load-configuration.js"
|
|
3
|
+
import me from "../package.js";
|
|
3
4
|
|
|
4
5
|
export async function main(commands) {
|
|
5
6
|
|
|
@@ -45,6 +46,7 @@ async function invoke(commands, verb, argv) {
|
|
|
45
46
|
|
|
46
47
|
function displayHelp(commands) {
|
|
47
48
|
|
|
49
|
+
console.log("Version", me.version);
|
|
48
50
|
console.log("Help:");
|
|
49
51
|
console.log("");
|
|
50
52
|
|