@voltro/plugin-guilds 0.90.0 → 0.91.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/CHANGELOG.md +131 -0
- package/THIRD-PARTY-NOTICES.md +181 -1358
- package/dist/index.js +79 -79
- package/dist/inspect.js +6 -6
- package/dist/service.js +509 -509
- package/dist/strategies.js +21 -21
- package/dist/testing.js +28 -28
- package/dist/web.js +5 -5
- package/package.json +10 -10
package/dist/strategies.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PERMISSIONS as e } from "./contract.js";
|
|
2
|
+
import { guildsError as t } from "./errors.js";
|
|
3
3
|
// src/strategies.ts
|
|
4
|
-
var n = ({ role:
|
|
4
|
+
var n = ({ role: t, permission: n }) => Number.isSafeInteger(t.permissions) && t.permissions >= 0 && t.permissions <= 127 && (t.permissions & e[n]) !== 0, r = ({ xp: e, baseMemberCap: t, maximumMemberCap: n }) => {
|
|
5
5
|
let r = 1 + Math.floor(Math.sqrt(e / 1e3));
|
|
6
6
|
return {
|
|
7
7
|
level: r,
|
|
@@ -11,27 +11,27 @@ var n = ({ role: e, permission: n }) => Number.isSafeInteger(e.permissions) && e
|
|
|
11
11
|
permissions: n,
|
|
12
12
|
levelCurve: r,
|
|
13
13
|
inactivityPolicy: i
|
|
14
|
-
}), o = (
|
|
14
|
+
}), o = (e = {}) => {
|
|
15
15
|
let n = {
|
|
16
|
-
baseMemberCap:
|
|
17
|
-
maximumMemberCap:
|
|
18
|
-
maxGuildsPerSubject:
|
|
19
|
-
maxRoles:
|
|
20
|
-
maxPending:
|
|
21
|
-
inviteTtlMs:
|
|
22
|
-
inactiveAfterMs:
|
|
23
|
-
pageSize:
|
|
24
|
-
maxExportRows:
|
|
25
|
-
maxDescriptionLength:
|
|
26
|
-
maxAnnouncementLength:
|
|
27
|
-
denyWords: Object.freeze([...
|
|
16
|
+
baseMemberCap: e.baseMemberCap ?? 50,
|
|
17
|
+
maximumMemberCap: e.maximumMemberCap ?? 500,
|
|
18
|
+
maxGuildsPerSubject: e.maxGuildsPerSubject ?? 1,
|
|
19
|
+
maxRoles: e.maxRoles ?? 20,
|
|
20
|
+
maxPending: e.maxPending ?? 100,
|
|
21
|
+
inviteTtlMs: e.inviteTtlMs ?? 6048e5,
|
|
22
|
+
inactiveAfterMs: e.inactiveAfterMs ?? 2592e6,
|
|
23
|
+
pageSize: e.pageSize ?? 50,
|
|
24
|
+
maxExportRows: e.maxExportRows ?? 1e4,
|
|
25
|
+
maxDescriptionLength: e.maxDescriptionLength ?? 2e3,
|
|
26
|
+
maxAnnouncementLength: e.maxAnnouncementLength ?? 4e3,
|
|
27
|
+
denyWords: Object.freeze([...e.denyWords ?? []]),
|
|
28
28
|
strategies: Object.freeze({
|
|
29
29
|
...a,
|
|
30
|
-
...
|
|
30
|
+
...e.strategies
|
|
31
31
|
}),
|
|
32
|
-
now:
|
|
32
|
+
now: e.now ?? Date.now
|
|
33
33
|
};
|
|
34
|
-
for (let [
|
|
34
|
+
for (let [e, r] of [
|
|
35
35
|
[n.baseMemberCap, 1e4],
|
|
36
36
|
[n.maximumMemberCap, 1e4],
|
|
37
37
|
[n.maxGuildsPerSubject, 100],
|
|
@@ -43,8 +43,8 @@ var n = ({ role: e, permission: n }) => Number.isSafeInteger(e.permissions) && e
|
|
|
43
43
|
[n.maxExportRows, 1e5],
|
|
44
44
|
[n.maxDescriptionLength, 2e4],
|
|
45
45
|
[n.maxAnnouncementLength, 2e4]
|
|
46
|
-
]) if (!Number.isSafeInteger(
|
|
47
|
-
if (n.maximumMemberCap < n.baseMemberCap || n.denyWords.length > 1e3 || n.denyWords.some((e) => !e.trim() || e.length > 256) || typeof n.now != "function" || Object.values(n.strategies).some((e) => typeof e != "function")) throw
|
|
46
|
+
]) if (!Number.isSafeInteger(e) || e < 1 || e > r) throw t("invalid_input");
|
|
47
|
+
if (n.maximumMemberCap < n.baseMemberCap || n.denyWords.length > 1e3 || n.denyWords.some((e) => !e.trim() || e.length > 256) || typeof n.now != "function" || Object.values(n.strategies).some((e) => typeof e != "function")) throw t("invalid_input");
|
|
48
48
|
return Object.freeze(n);
|
|
49
49
|
};
|
|
50
50
|
export { n as bitSetGuildPermissions, a as defaultGuildStrategies, i as highestActiveGuildSuccessor, r as quadraticGuildLevels, o as resolveGuildOptions };
|
package/dist/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { GuildMembershipPort as e, GuildPermissionPort as t, GuildRosterPort as n } from "./port.js";
|
|
2
|
+
import { guildsError as r } from "./errors.js";
|
|
3
|
+
import { bitSetGuildPermissions as i, highestActiveGuildSuccessor as a, quadraticGuildLevels as o, resolveGuildOptions as s } from "./strategies.js";
|
|
4
4
|
import { Effect as c, Layer as l, Result as u } from "effect";
|
|
5
5
|
// src/testing.ts
|
|
6
6
|
var d = {
|
|
@@ -15,13 +15,13 @@ var d = {
|
|
|
15
15
|
permission: "kick"
|
|
16
16
|
}, f = {
|
|
17
17
|
kind: "slot",
|
|
18
|
-
defaultImplementation:
|
|
18
|
+
defaultImplementation: i,
|
|
19
19
|
defaultProbe: {
|
|
20
|
-
run: () => c.sync(() =>
|
|
20
|
+
run: () => c.sync(() => i(d)),
|
|
21
21
|
expected: !1
|
|
22
22
|
},
|
|
23
23
|
overrideProbe: {
|
|
24
|
-
run: () => c.sync(() =>
|
|
24
|
+
run: () => c.sync(() => s({ strategies: { permissions: () => !0 } }).strategies.permissions(d)),
|
|
25
25
|
expected: !0
|
|
26
26
|
}
|
|
27
27
|
}, p = {
|
|
@@ -30,16 +30,16 @@ var d = {
|
|
|
30
30
|
maximumMemberCap: 500
|
|
31
31
|
}, m = {
|
|
32
32
|
kind: "slot",
|
|
33
|
-
defaultImplementation:
|
|
33
|
+
defaultImplementation: o,
|
|
34
34
|
defaultProbe: {
|
|
35
|
-
run: () => c.sync(() =>
|
|
35
|
+
run: () => c.sync(() => o(p)),
|
|
36
36
|
expected: {
|
|
37
37
|
level: 2,
|
|
38
38
|
memberCap: 55
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
overrideProbe: {
|
|
42
|
-
run: () => c.sync(() =>
|
|
42
|
+
run: () => c.sync(() => s({ strategies: { levelCurve: () => ({
|
|
43
43
|
level: 3,
|
|
44
44
|
memberCap: 60
|
|
45
45
|
}) } }).strategies.levelCurve(p)),
|
|
@@ -65,47 +65,47 @@ var d = {
|
|
|
65
65
|
}]
|
|
66
66
|
}, g = {
|
|
67
67
|
kind: "slot",
|
|
68
|
-
defaultImplementation:
|
|
68
|
+
defaultImplementation: a,
|
|
69
69
|
defaultProbe: {
|
|
70
|
-
run: () => c.sync(() =>
|
|
70
|
+
run: () => c.sync(() => a(h)),
|
|
71
71
|
expected: "a"
|
|
72
72
|
},
|
|
73
73
|
overrideProbe: {
|
|
74
|
-
run: () => c.sync(() =>
|
|
74
|
+
run: () => c.sync(() => s({ strategies: { inactivityPolicy: () => null } }).strategies.inactivityPolicy(h)),
|
|
75
75
|
expected: null
|
|
76
76
|
}
|
|
77
|
-
}, _ = (
|
|
78
|
-
isMember: () => c.fail(
|
|
79
|
-
...
|
|
80
|
-
}), v = (
|
|
77
|
+
}, _ = (e = {}) => ({
|
|
78
|
+
isMember: () => c.fail(r("unavailable")),
|
|
79
|
+
...e
|
|
80
|
+
}), v = (t = {}) => l.sync(e, () => _(t)), y = v(), b = {
|
|
81
81
|
kind: "port",
|
|
82
|
-
tag:
|
|
82
|
+
tag: e,
|
|
83
83
|
fakeLayer: y,
|
|
84
84
|
probe: {
|
|
85
|
-
run: () => c.scoped(
|
|
85
|
+
run: () => c.scoped(e.pipe(c.flatMap((e) => e.isMember({
|
|
86
86
|
type: "user",
|
|
87
87
|
id: "one",
|
|
88
88
|
tenantId: "tenant"
|
|
89
89
|
}, "guild")), c.result, c.map((e) => u.isFailure(e) ? e.failure.code : e.success), c.provide(y))),
|
|
90
90
|
expected: "unavailable"
|
|
91
91
|
}
|
|
92
|
-
}, x = (
|
|
93
|
-
memberIds: () => c.fail(
|
|
94
|
-
...
|
|
95
|
-
}), S = (e = {}) => l.sync(
|
|
92
|
+
}, x = (e = {}) => ({
|
|
93
|
+
memberIds: () => c.fail(r("unavailable")),
|
|
94
|
+
...e
|
|
95
|
+
}), S = (e = {}) => l.sync(n, () => x(e)), C = S(), w = {
|
|
96
96
|
kind: "port",
|
|
97
|
-
tag:
|
|
97
|
+
tag: n,
|
|
98
98
|
fakeLayer: C,
|
|
99
99
|
probe: {
|
|
100
|
-
run: () => c.scoped(
|
|
100
|
+
run: () => c.scoped(n.pipe(c.flatMap((e) => e.memberIds({
|
|
101
101
|
type: "user",
|
|
102
102
|
id: "one",
|
|
103
103
|
tenantId: "tenant"
|
|
104
104
|
}, "guild")), c.result, c.map((e) => u.isFailure(e) ? e.failure.code : e.success), c.provide(C))),
|
|
105
105
|
expected: "unavailable"
|
|
106
106
|
}
|
|
107
|
-
}, T = (
|
|
108
|
-
may: () => c.fail(
|
|
109
|
-
...
|
|
110
|
-
}), E = (e = {}) => l.sync(
|
|
107
|
+
}, T = (e = {}) => ({
|
|
108
|
+
may: () => c.fail(r("unavailable")),
|
|
109
|
+
...e
|
|
110
|
+
}), E = (e = {}) => l.sync(t, () => T(e));
|
|
111
111
|
export { v as fakeGuildMembershipLayer, _ as fakeGuildMembershipService, E as fakeGuildPermissionLayer, T as fakeGuildPermissionService, S as fakeGuildRosterLayer, x as fakeGuildRosterService, g as guildInactivityFixture, m as guildLevelFixture, y as guildMembershipFakeLayer, b as guildMembershipPortFixture, f as guildPermissionsFixture, C as guildRosterFakeLayer, w as guildRosterPortFixture };
|
package/dist/web.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { BASE_NAME as e } from "./rpc.js";
|
|
2
|
+
import { GuildBrowser as t, GuildCard as n, GuildCreateDialog as r, GuildLog as i, GuildMemberList as a, guildLabels as o } from "./components.js";
|
|
3
|
+
import { PERMISSIONS as s } from "./contract.js";
|
|
4
4
|
import { pluginTag as c } from "@voltro/protocol";
|
|
5
5
|
import { useAction as l, useSubscription as u } from "@voltro/client";
|
|
6
6
|
// src/web.ts
|
|
7
|
-
var d = (
|
|
8
|
-
export {
|
|
7
|
+
var d = (t, n = "app") => u(n, c(e, "get"), { guildId: t }), f = (t = "app") => u(t, c(e, "mine"), {}), p = (t, n = "app") => u(n, c(e, "members"), { guildId: t }), m = (t, n = "app") => u(n, c(e, "roles"), { guildId: t }), h = (t = {}, n = "app") => u(n, c(e, "search"), t), g = (t, n = "app") => u(n, c(e, "applications"), { guildId: t }), _ = (t = "app") => u(t, c(e, "invites"), {}), v = (t, n = "app") => u(n, c(e, "announcements"), { guildId: t }), y = (t, n = "app") => u(n, c(e, "log"), { guildId: t }), b = (t = "app") => l(t, c(e, "create")), x = (t = "app") => l(t, c(e, "join")), S = (t = "app") => l(t, c(e, "leave"));
|
|
8
|
+
export { t as GuildBrowser, n as GuildCard, r as GuildCreateDialog, i as GuildLog, a as GuildMemberList, s as PERMISSIONS, o as guildLabels, d as useGuild, v as useGuildAnnouncements, g as useGuildApplications, b as useGuildCreate, _ as useGuildInvites, x as useGuildJoin, S as useGuildLeave, f as useGuildList, y as useGuildLog, p as useGuildMembers, m as useGuildRoles, h as useGuildSearch };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-guilds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.1",
|
|
4
4
|
"description": "SQL-authoritative guilds, scoped roles, membership admission and privacy with replaceable rules",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -73,17 +73,17 @@
|
|
|
73
73
|
"node": ">=24.0.0"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@voltro/protocol": "0.
|
|
77
|
-
"@voltro/database": "0.
|
|
78
|
-
"@voltro/client": "0.
|
|
79
|
-
"@voltro/runtime": "0.
|
|
80
|
-
"@voltro/plugin-moderation": "0.
|
|
81
|
-
"@voltro/plugin-social": "0.
|
|
82
|
-
"@voltro/ui-shadcn": "0.
|
|
83
|
-
"@voltro/plugin-licensing": "0.
|
|
76
|
+
"@voltro/protocol": "0.91.1",
|
|
77
|
+
"@voltro/database": "0.91.1",
|
|
78
|
+
"@voltro/client": "0.91.1",
|
|
79
|
+
"@voltro/runtime": "0.91.1",
|
|
80
|
+
"@voltro/plugin-moderation": "0.91.1",
|
|
81
|
+
"@voltro/plugin-social": "0.91.1",
|
|
82
|
+
"@voltro/ui-shadcn": "0.91.1",
|
|
83
|
+
"@voltro/plugin-licensing": "0.91.1"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"effect": "4.1.
|
|
86
|
+
"effect": "4.1.4",
|
|
87
87
|
"react": "^19.0.0"
|
|
88
88
|
},
|
|
89
89
|
"publishConfig": {
|