@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.
@@ -1,7 +1,7 @@
1
- import { guildsError as e } from "./errors.js";
2
- import { PERMISSIONS as t } from "./contract.js";
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: e, permission: n }) => Number.isSafeInteger(e.permissions) && e.permissions >= 0 && e.permissions <= 127 && (e.permissions & t[n]) !== 0, r = ({ xp: e, baseMemberCap: t, maximumMemberCap: n }) => {
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 = (t = {}) => {
14
+ }), o = (e = {}) => {
15
15
  let n = {
16
- baseMemberCap: t.baseMemberCap ?? 50,
17
- maximumMemberCap: t.maximumMemberCap ?? 500,
18
- maxGuildsPerSubject: t.maxGuildsPerSubject ?? 1,
19
- maxRoles: t.maxRoles ?? 20,
20
- maxPending: t.maxPending ?? 100,
21
- inviteTtlMs: t.inviteTtlMs ?? 6048e5,
22
- inactiveAfterMs: t.inactiveAfterMs ?? 2592e6,
23
- pageSize: t.pageSize ?? 50,
24
- maxExportRows: t.maxExportRows ?? 1e4,
25
- maxDescriptionLength: t.maxDescriptionLength ?? 2e3,
26
- maxAnnouncementLength: t.maxAnnouncementLength ?? 4e3,
27
- denyWords: Object.freeze([...t.denyWords ?? []]),
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
- ...t.strategies
30
+ ...e.strategies
31
31
  }),
32
- now: t.now ?? Date.now
32
+ now: e.now ?? Date.now
33
33
  };
34
- for (let [t, r] of [
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(t) || t < 1 || t > r) throw e("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 e("invalid_input");
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 { guildsError as e } from "./errors.js";
2
- import { bitSetGuildPermissions as t, highestActiveGuildSuccessor as n, quadraticGuildLevels as r, resolveGuildOptions as i } from "./strategies.js";
3
- import { GuildMembershipPort as a, GuildPermissionPort as o, GuildRosterPort as s } from "./port.js";
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: t,
18
+ defaultImplementation: i,
19
19
  defaultProbe: {
20
- run: () => c.sync(() => t(d)),
20
+ run: () => c.sync(() => i(d)),
21
21
  expected: !1
22
22
  },
23
23
  overrideProbe: {
24
- run: () => c.sync(() => i({ strategies: { permissions: () => !0 } }).strategies.permissions(d)),
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: r,
33
+ defaultImplementation: o,
34
34
  defaultProbe: {
35
- run: () => c.sync(() => r(p)),
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(() => i({ strategies: { levelCurve: () => ({
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: n,
68
+ defaultImplementation: a,
69
69
  defaultProbe: {
70
- run: () => c.sync(() => n(h)),
70
+ run: () => c.sync(() => a(h)),
71
71
  expected: "a"
72
72
  },
73
73
  overrideProbe: {
74
- run: () => c.sync(() => i({ strategies: { inactivityPolicy: () => null } }).strategies.inactivityPolicy(h)),
74
+ run: () => c.sync(() => s({ strategies: { inactivityPolicy: () => null } }).strategies.inactivityPolicy(h)),
75
75
  expected: null
76
76
  }
77
- }, _ = (t = {}) => ({
78
- isMember: () => c.fail(e("unavailable")),
79
- ...t
80
- }), v = (e = {}) => l.sync(a, () => _(e)), y = v(), b = {
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: a,
82
+ tag: e,
83
83
  fakeLayer: y,
84
84
  probe: {
85
- run: () => c.scoped(a.pipe(c.flatMap((e) => e.isMember({
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 = (t = {}) => ({
93
- memberIds: () => c.fail(e("unavailable")),
94
- ...t
95
- }), S = (e = {}) => l.sync(s, () => x(e)), C = S(), w = {
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: s,
97
+ tag: n,
98
98
  fakeLayer: C,
99
99
  probe: {
100
- run: () => c.scoped(s.pipe(c.flatMap((e) => e.memberIds({
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 = (t = {}) => ({
108
- may: () => c.fail(e("unavailable")),
109
- ...t
110
- }), E = (e = {}) => l.sync(o, () => T(e));
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 { PERMISSIONS as e } from "./contract.js";
2
- import { BASE_NAME as t } from "./rpc.js";
3
- import { GuildBrowser as n, GuildCard as r, GuildCreateDialog as i, GuildLog as a, GuildMemberList as o, guildLabels as s } from "./components.js";
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 = (e, n = "app") => u(n, c(t, "get"), { guildId: e }), f = (e = "app") => u(e, c(t, "mine"), {}), p = (e, n = "app") => u(n, c(t, "members"), { guildId: e }), m = (e, n = "app") => u(n, c(t, "roles"), { guildId: e }), h = (e = {}, n = "app") => u(n, c(t, "search"), e), g = (e, n = "app") => u(n, c(t, "applications"), { guildId: e }), _ = (e = "app") => u(e, c(t, "invites"), {}), v = (e, n = "app") => u(n, c(t, "announcements"), { guildId: e }), y = (e, n = "app") => u(n, c(t, "log"), { guildId: e }), b = (e = "app") => l(e, c(t, "create")), x = (e = "app") => l(e, c(t, "join")), S = (e = "app") => l(e, c(t, "leave"));
8
- export { n as GuildBrowser, r as GuildCard, i as GuildCreateDialog, a as GuildLog, o as GuildMemberList, e as PERMISSIONS, s 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 };
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.90.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.90.0",
77
- "@voltro/database": "0.90.0",
78
- "@voltro/client": "0.90.0",
79
- "@voltro/runtime": "0.90.0",
80
- "@voltro/plugin-moderation": "0.90.0",
81
- "@voltro/plugin-social": "0.90.0",
82
- "@voltro/ui-shadcn": "0.90.0",
83
- "@voltro/plugin-licensing": "0.90.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.2",
86
+ "effect": "4.1.4",
87
87
  "react": "^19.0.0"
88
88
  },
89
89
  "publishConfig": {