@voltro/plugin-guilds 0.0.0-stage → 0.87.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.
@@ -0,0 +1,396 @@
1
+ import { useEffect as e, useId as t, useRef as n } from "react";
2
+ import { Button as r, Dialog as i, DialogDescription as a, DialogFooter as o, DialogHeader as s, DialogTitle as c, Input as l, Select as u, Textarea as d } from "@voltro/ui-shadcn";
3
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
4
+ //#region src/components.tsx
5
+ var m = {
6
+ en: {
7
+ owner: "Owner",
8
+ officer: "Officer",
9
+ member: "Member",
10
+ title: "Guilds",
11
+ empty: "No guilds match these filters.",
12
+ loading: "Loading guilds…",
13
+ failed: "Guilds could not be updated. Check the result before retrying.",
14
+ open: "Open membership",
15
+ apply: "Applications required",
16
+ invite: "Invitation required",
17
+ level: "Level",
18
+ view: "View guild",
19
+ search: "Exact guild name",
20
+ find: "Find guild",
21
+ members: "Members",
22
+ unknown: "Player unavailable",
23
+ role: "Role",
24
+ create: "Create guild",
25
+ createDescription: "Choose a guild name, a 3–5 character tag and a membership policy.",
26
+ name: "Guild name",
27
+ tag: "Guild tag",
28
+ description: "Description",
29
+ visibility: "Membership policy",
30
+ close: "Close",
31
+ log: "Guild activity",
32
+ logEmpty: "No activity is available."
33
+ },
34
+ de: {
35
+ owner: "Owner",
36
+ officer: "Offizier",
37
+ member: "Mitglied",
38
+ title: "Gilden",
39
+ empty: "Keine Gilden für diese Filter.",
40
+ loading: "Gilden werden geladen…",
41
+ failed: "Gilden konnten nicht aktualisiert werden. Prüfe das Ergebnis vor einem erneuten Versuch.",
42
+ open: "Offener Beitritt",
43
+ apply: "Bewerbung erforderlich",
44
+ invite: "Einladung erforderlich",
45
+ level: "Level",
46
+ view: "Gilde ansehen",
47
+ search: "Genauer Gildenname",
48
+ find: "Gilde finden",
49
+ members: "Mitglieder",
50
+ unknown: "Spieler nicht verfügbar",
51
+ role: "Rolle",
52
+ create: "Gilde erstellen",
53
+ createDescription: "Wähle einen Gildennamen, ein Tag mit 3–5 Zeichen und eine Beitrittsregel.",
54
+ name: "Gildenname",
55
+ tag: "Gildentag",
56
+ description: "Beschreibung",
57
+ visibility: "Beitrittsregel",
58
+ close: "Schließen",
59
+ log: "Gildenaktivität",
60
+ logEmpty: "Keine Aktivität verfügbar."
61
+ }
62
+ }, h = ({ guild: e, labels: t = m.en, onView: n, pending: i = !1 }) => /* @__PURE__ */ p("article", {
63
+ className: "min-w-0 space-y-3 border-b border-border py-5",
64
+ children: [
65
+ /* @__PURE__ */ p("h3", {
66
+ className: "break-words text-base font-semibold",
67
+ children: [e.name, /* @__PURE__ */ p("span", {
68
+ className: "text-muted-foreground",
69
+ children: [
70
+ " [",
71
+ e.tag,
72
+ "]"
73
+ ]
74
+ })]
75
+ }),
76
+ /* @__PURE__ */ f("p", {
77
+ className: "max-w-prose whitespace-pre-wrap break-words text-sm",
78
+ children: e.description
79
+ }),
80
+ /* @__PURE__ */ p("p", {
81
+ className: "text-sm text-muted-foreground",
82
+ children: [
83
+ t[e.visibility],
84
+ " · ",
85
+ t.level,
86
+ " ",
87
+ e.level
88
+ ]
89
+ }),
90
+ /* @__PURE__ */ f(r, {
91
+ type: "button",
92
+ variant: "outline",
93
+ "aria-disabled": i,
94
+ onClick: () => {
95
+ i || n(e.id);
96
+ },
97
+ children: t.view
98
+ })
99
+ ]
100
+ }), g = ({ guilds: e, query: n, onQueryChange: i, onFind: a, onView: o, scopeKey: s, dataScopeKey: c, loading: u = !1, error: d, labels: g = m.en }) => {
101
+ let _ = t(), v = t(), y = s === c;
102
+ return /* @__PURE__ */ p("section", {
103
+ "aria-labelledby": _,
104
+ "aria-busy": u,
105
+ className: "min-w-0 space-y-4",
106
+ children: [
107
+ /* @__PURE__ */ f("h2", {
108
+ id: _,
109
+ className: "text-lg font-semibold",
110
+ children: g.title
111
+ }),
112
+ /* @__PURE__ */ p("form", {
113
+ className: "flex flex-wrap items-end gap-3",
114
+ onSubmit: (e) => {
115
+ e.preventDefault(), !u && n.trim() && a(n.trim());
116
+ },
117
+ children: [/* @__PURE__ */ p("div", {
118
+ className: "min-w-0 flex-1 space-y-2",
119
+ children: [/* @__PURE__ */ f("label", {
120
+ htmlFor: v,
121
+ className: "text-sm font-medium",
122
+ children: g.search
123
+ }), /* @__PURE__ */ f(l, {
124
+ id: v,
125
+ value: n,
126
+ maxLength: 64,
127
+ onChange: (e) => i(e.target.value)
128
+ })]
129
+ }), /* @__PURE__ */ f(r, {
130
+ type: "submit",
131
+ "aria-disabled": u || !n.trim(),
132
+ children: g.find
133
+ })]
134
+ }),
135
+ d === void 0 ? !y || u && e.length === 0 ? /* @__PURE__ */ f("p", {
136
+ role: "status",
137
+ className: "text-sm text-muted-foreground",
138
+ children: g.loading
139
+ }) : e.length === 0 ? /* @__PURE__ */ f("p", {
140
+ className: "text-sm text-muted-foreground",
141
+ children: g.empty
142
+ }) : e.map((e) => /* @__PURE__ */ f(h, {
143
+ guild: e,
144
+ labels: g,
145
+ onView: o,
146
+ pending: u
147
+ }, e.id)) : /* @__PURE__ */ f("p", {
148
+ role: "alert",
149
+ className: "text-sm text-destructive",
150
+ children: g.failed
151
+ })
152
+ ]
153
+ });
154
+ }, _ = ({ members: e, roles: n, identities: r, labels: i = m.en, pending: a = !1, canChangeRole: o, onRoleChange: s }) => {
155
+ let c = t();
156
+ return /* @__PURE__ */ p("section", {
157
+ "aria-labelledby": c,
158
+ className: "min-w-0 space-y-3",
159
+ children: [/* @__PURE__ */ f("h2", {
160
+ id: c,
161
+ className: "text-lg font-semibold",
162
+ children: i.members
163
+ }), /* @__PURE__ */ f("ul", {
164
+ className: "divide-y divide-border",
165
+ children: e.map((e) => {
166
+ let t = r.find((t) => t.subjectId === e.subjectId), c = n.find((t) => t.id === e.roleId);
167
+ return /* @__PURE__ */ p("li", {
168
+ className: "flex min-w-0 flex-wrap items-center justify-between gap-3 py-4",
169
+ children: [/* @__PURE__ */ f("p", {
170
+ className: "break-words font-medium",
171
+ children: t ? `${t.displayName}#${t.tag}` : i.unknown
172
+ }), s && o?.(e) ? /* @__PURE__ */ p("label", {
173
+ className: "flex flex-wrap items-center gap-2 text-sm",
174
+ children: [i.role, /* @__PURE__ */ f(u, {
175
+ value: e.roleId,
176
+ disabled: a,
177
+ onChange: (t) => {
178
+ a || s(e.subjectId, t.target.value);
179
+ },
180
+ children: n.map((e) => /* @__PURE__ */ f("option", {
181
+ value: e.id,
182
+ children: e.name === "owner" || e.name === "officer" || e.name === "member" ? i[e.name] : e.name
183
+ }, e.id))
184
+ })]
185
+ }) : /* @__PURE__ */ f("span", {
186
+ className: "text-sm text-muted-foreground",
187
+ children: c ? c.name === "owner" || c.name === "officer" || c.name === "member" ? i[c.name] : c.name : i.unknown
188
+ })]
189
+ }, e.id);
190
+ })
191
+ })]
192
+ });
193
+ }, v = ({ open: h, onOpenChange: g, value: _, onChange: v, onCreate: y, pending: b = !1, error: x, labels: S = m.en, scopeKey: C, dataScopeKey: w }) => {
194
+ let T = n(null), E = t(), D = t(), O = t(), k = t(), A = t(), j = t(), M = C === w;
195
+ e(() => {
196
+ let e = T.current;
197
+ e && (h && !e.open ? e.showModal() : !h && e.open && e.close());
198
+ }, [h]);
199
+ let N = b || !M, P = M && _.name.trim().length >= 3 && /^[a-zA-Z0-9]{3,5}$/u.test(_.tag);
200
+ return /* @__PURE__ */ p(i, {
201
+ ref: T,
202
+ "aria-labelledby": E,
203
+ "aria-describedby": D,
204
+ onClose: () => g(!1),
205
+ className: "max-h-[90dvh] max-w-[min(36rem,calc(100vw-2rem))] overflow-y-auto",
206
+ children: [
207
+ /* @__PURE__ */ p(s, { children: [/* @__PURE__ */ f(c, {
208
+ id: E,
209
+ children: S.create
210
+ }), /* @__PURE__ */ f(a, {
211
+ id: D,
212
+ children: S.createDescription
213
+ })] }),
214
+ /* @__PURE__ */ p("form", {
215
+ className: "space-y-4",
216
+ "aria-busy": b,
217
+ onSubmit: (e) => {
218
+ e.preventDefault(), !N && P && y(_);
219
+ },
220
+ children: [
221
+ /* @__PURE__ */ p("div", {
222
+ className: "space-y-2",
223
+ children: [/* @__PURE__ */ f("label", {
224
+ htmlFor: O,
225
+ className: "text-sm font-medium",
226
+ children: S.name
227
+ }), /* @__PURE__ */ f(l, {
228
+ id: O,
229
+ value: M ? _.name : "",
230
+ maxLength: 64,
231
+ readOnly: N,
232
+ onChange: (e) => {
233
+ N || v({
234
+ ..._,
235
+ name: e.target.value
236
+ });
237
+ }
238
+ })]
239
+ }),
240
+ /* @__PURE__ */ p("div", {
241
+ className: "space-y-2",
242
+ children: [/* @__PURE__ */ f("label", {
243
+ htmlFor: k,
244
+ className: "text-sm font-medium",
245
+ children: S.tag
246
+ }), /* @__PURE__ */ f(l, {
247
+ id: k,
248
+ value: M ? _.tag : "",
249
+ maxLength: 5,
250
+ readOnly: N,
251
+ onChange: (e) => {
252
+ N || v({
253
+ ..._,
254
+ tag: e.target.value
255
+ });
256
+ }
257
+ })]
258
+ }),
259
+ /* @__PURE__ */ p("div", {
260
+ className: "space-y-2",
261
+ children: [/* @__PURE__ */ f("label", {
262
+ htmlFor: A,
263
+ className: "text-sm font-medium",
264
+ children: S.description
265
+ }), /* @__PURE__ */ f(d, {
266
+ id: A,
267
+ value: M ? _.description ?? "" : "",
268
+ rows: 3,
269
+ readOnly: N,
270
+ onChange: (e) => {
271
+ N || v({
272
+ ..._,
273
+ description: e.target.value
274
+ });
275
+ }
276
+ })]
277
+ }),
278
+ /* @__PURE__ */ p("div", {
279
+ className: "space-y-2",
280
+ children: [/* @__PURE__ */ f("label", {
281
+ htmlFor: j,
282
+ className: "text-sm font-medium",
283
+ children: S.visibility
284
+ }), /* @__PURE__ */ f(u, {
285
+ id: j,
286
+ value: M ? _.visibility ?? "open" : "open",
287
+ disabled: N,
288
+ onChange: (e) => {
289
+ !N && [
290
+ "open",
291
+ "apply",
292
+ "invite"
293
+ ].includes(e.target.value) && v({
294
+ ..._,
295
+ visibility: e.target.value
296
+ });
297
+ },
298
+ children: [
299
+ "open",
300
+ "apply",
301
+ "invite"
302
+ ].map((e) => /* @__PURE__ */ f("option", {
303
+ value: e,
304
+ children: S[e]
305
+ }, e))
306
+ })]
307
+ }),
308
+ /* @__PURE__ */ f(r, {
309
+ type: "submit",
310
+ "aria-disabled": N || !P,
311
+ children: S.create
312
+ }),
313
+ x === void 0 ? null : /* @__PURE__ */ f("p", {
314
+ role: "alert",
315
+ className: "text-sm text-destructive",
316
+ children: S.failed
317
+ })
318
+ ]
319
+ }),
320
+ /* @__PURE__ */ f(o, { children: /* @__PURE__ */ f(r, {
321
+ type: "button",
322
+ variant: "ghost",
323
+ onClick: () => g(!1),
324
+ children: S.close
325
+ }) })
326
+ ]
327
+ });
328
+ }, y = {
329
+ en: {
330
+ created: "Guild created",
331
+ joined: "Member joined",
332
+ left: "Member left",
333
+ kicked: "Member removed",
334
+ ownerTransferred: "Ownership transferred",
335
+ roleChanged: "Member role changed",
336
+ roleConfigured: "Role configured",
337
+ profileChanged: "Profile updated",
338
+ announced: "Announcement posted",
339
+ applicationDecided: "Application reviewed",
340
+ inviteDecided: "Invitation reviewed",
341
+ contribution: "Contribution recorded"
342
+ },
343
+ de: {
344
+ created: "Gilde erstellt",
345
+ joined: "Mitglied beigetreten",
346
+ left: "Mitglied ausgetreten",
347
+ kicked: "Mitglied entfernt",
348
+ ownerTransferred: "Ownership übertragen",
349
+ roleChanged: "Mitgliederrolle geändert",
350
+ roleConfigured: "Rolle eingestellt",
351
+ profileChanged: "Profil aktualisiert",
352
+ announced: "Ankündigung veröffentlicht",
353
+ applicationDecided: "Bewerbung geprüft",
354
+ inviteDecided: "Einladung geprüft",
355
+ contribution: "Beitrag erfasst"
356
+ }
357
+ }, b = ({ entries: e, identities: n, labels: r = m.en, locale: i = "en" }) => {
358
+ let a = t();
359
+ return /* @__PURE__ */ p("section", {
360
+ "aria-labelledby": a,
361
+ className: "min-w-0 space-y-3",
362
+ children: [/* @__PURE__ */ f("h2", {
363
+ id: a,
364
+ className: "text-lg font-semibold",
365
+ children: r.log
366
+ }), e.length === 0 ? /* @__PURE__ */ f("p", {
367
+ className: "text-sm text-muted-foreground",
368
+ children: r.logEmpty
369
+ }) : /* @__PURE__ */ f("ol", {
370
+ className: "divide-y divide-border",
371
+ children: e.map((e) => {
372
+ let t = e.actorId === null ? void 0 : n.find((t) => t.subjectId === e.actorId), a = y[i.startsWith("de") ? "de" : "en"][e.kind] ?? r.log;
373
+ return /* @__PURE__ */ p("li", {
374
+ className: "space-y-1 py-3 text-sm",
375
+ children: [/* @__PURE__ */ p("p", {
376
+ className: "break-words",
377
+ children: [
378
+ a,
379
+ " · ",
380
+ t ? `${t.displayName}#${t.tag}` : r.unknown
381
+ ]
382
+ }), /* @__PURE__ */ f("time", {
383
+ dateTime: new Date(e.at).toISOString(),
384
+ className: "text-muted-foreground",
385
+ children: new Intl.DateTimeFormat(i, {
386
+ dateStyle: "short",
387
+ timeStyle: "short"
388
+ }).format(e.at)
389
+ })]
390
+ }, e.id);
391
+ })
392
+ })]
393
+ });
394
+ };
395
+ //#endregion
396
+ export { g as GuildBrowser, h as GuildCard, v as GuildCreateDialog, b as GuildLog, _ as GuildMemberList, m as guildLabels };
@@ -0,0 +1,114 @@
1
+ import { Schema as e } from "effect";
2
+ //#region src/contract.ts
3
+ var t = "_voltro_guilds", n = "_voltro_guild_members", r = "_voltro_guild_roles", i = "_voltro_guild_applications", a = "_voltro_guild_invites", o = "_voltro_guild_log", s = "_voltro_guild_announcements", c = "_voltro_guild_admissions", l = {
4
+ invite: 1,
5
+ kick: 2,
6
+ promote: 4,
7
+ treasury: 8,
8
+ announce: 16,
9
+ startEvent: 32,
10
+ editProfile: 64
11
+ }, u = e.Number.pipe(e.check(e.isInt()), e.check(e.isGreaterThanOrEqualTo(0))), d = e.Record(e.String, e.Unknown), f = e.Struct({
12
+ id: e.String,
13
+ name: e.String,
14
+ tag: e.String,
15
+ description: e.String,
16
+ emblem: e.NullOr(e.String),
17
+ visibility: e.Literals([
18
+ "open",
19
+ "apply",
20
+ "invite"
21
+ ]),
22
+ minLevel: u,
23
+ region: e.NullOr(e.String),
24
+ language: e.NullOr(e.String),
25
+ level: u,
26
+ xp: u,
27
+ memberCap: u,
28
+ createdAt: u,
29
+ ownerId: e.NullOr(e.String),
30
+ version: u,
31
+ metadata: d
32
+ }), p = e.Struct({
33
+ id: e.String,
34
+ name: e.String,
35
+ tag: e.String,
36
+ description: e.String,
37
+ emblem: e.NullOr(e.String),
38
+ visibility: e.Literals([
39
+ "open",
40
+ "apply",
41
+ "invite"
42
+ ]),
43
+ minLevel: u,
44
+ region: e.NullOr(e.String),
45
+ language: e.NullOr(e.String),
46
+ level: u,
47
+ xp: u,
48
+ memberCap: u,
49
+ createdAt: u,
50
+ version: u
51
+ }), m = e.Struct({
52
+ id: e.String,
53
+ guildId: e.String,
54
+ subjectId: e.String,
55
+ roleId: e.String,
56
+ joinedAt: u,
57
+ contribution: d,
58
+ lastActiveAt: u,
59
+ metadata: d
60
+ }), h = e.Struct({
61
+ id: e.String,
62
+ guildId: e.String,
63
+ name: e.String,
64
+ rank: u,
65
+ permissions: u,
66
+ metadata: d
67
+ }), g = e.Struct({
68
+ id: e.String,
69
+ guildId: e.String,
70
+ subjectId: e.String,
71
+ message: e.String,
72
+ state: e.Literals([
73
+ "pending",
74
+ "accepted",
75
+ "declined",
76
+ "withdrawn"
77
+ ]),
78
+ decidedBy: e.NullOr(e.String),
79
+ decidedAt: e.NullOr(u),
80
+ createdAt: u,
81
+ metadata: d
82
+ }), _ = e.Struct({
83
+ id: e.String,
84
+ guildId: e.String,
85
+ toId: e.String,
86
+ fromId: e.String,
87
+ expiresAt: u,
88
+ state: e.Literals([
89
+ "pending",
90
+ "accepted",
91
+ "declined",
92
+ "cancelled"
93
+ ]),
94
+ createdAt: u,
95
+ metadata: d
96
+ }), v = e.Struct({
97
+ id: e.String,
98
+ guildId: e.String,
99
+ kind: e.String,
100
+ actorId: e.NullOr(e.String),
101
+ targetId: e.NullOr(e.String),
102
+ detail: d,
103
+ at: u
104
+ }), y = e.Struct({
105
+ id: e.String,
106
+ guildId: e.String,
107
+ authorId: e.NullOr(e.String),
108
+ body: e.String,
109
+ pinned: e.Boolean,
110
+ createdAt: u,
111
+ metadata: d
112
+ });
113
+ //#endregion
114
+ export { c as ADMISSIONS_TABLE, s as ANNOUNCEMENTS_TABLE, i as APPLICATIONS_TABLE, t as GUILDS_TABLE, y as GuildAnnouncementSchema, g as GuildApplicationSchema, _ as GuildInviteSchema, v as GuildLogSchema, m as GuildMemberSchema, h as GuildRoleSchema, f as GuildSchema, p as GuildSummarySchema, a as INVITES_TABLE, o as LOG_TABLE, n as MEMBERS_TABLE, l as PERMISSIONS, r as ROLES_TABLE };
@@ -0,0 +1,116 @@
1
+ import { ADMISSIONS_TABLE as e, ANNOUNCEMENTS_TABLE as t, APPLICATIONS_TABLE as n, GUILDS_TABLE as r, INVITES_TABLE as i, LOG_TABLE as a, MEMBERS_TABLE as o, ROLES_TABLE as s } from "./contract.js";
2
+ import { boolean as c, id as l, integer as u, json as d, table as f, text as p, timestamp as m } from "@voltro/database";
3
+ //#region src/entities.ts
4
+ var h = () => p().maxLength(256).externalId().sensitive("pii"), g = () => p().maxLength(256).externalId().sensitive("pii"), _ = () => p().maxLength(64).safe(), v = f(r, {
5
+ id: l({ prefix: "guild" }),
6
+ tenantId: h(),
7
+ name: p().maxLength(64).sensitive("pii"),
8
+ nameKey: p().maxLength(64).serverOnly(),
9
+ tag: p().maxLength(5).safe(),
10
+ tagKey: p().maxLength(64).serverOnly(),
11
+ description: p().sensitive("pii"),
12
+ emblem: p().nullable().sensitive("pii"),
13
+ visibility: p().oneOf([
14
+ "open",
15
+ "apply",
16
+ "invite"
17
+ ]).safe(),
18
+ minLevel: u().safe(),
19
+ region: p().maxLength(64).nullable().safe(),
20
+ language: p().maxLength(64).nullable().safe(),
21
+ level: u().safe(),
22
+ xp: u().safe(),
23
+ memberCap: u().safe(),
24
+ createdAt: m().safe(),
25
+ ownerId: g().nullable(),
26
+ version: u().safe(),
27
+ admission: u().serverOnly(),
28
+ creationKey: p().maxLength(64).serverOnly(),
29
+ dissolvedAt: m().nullable().safe(),
30
+ metadata: d().sensitive("pii")
31
+ }).unique(["nameKey"]).unique(["tagKey"]).index(["tenantId", "visibility"]), y = f(o, {
32
+ id: l({ prefix: "gmem" }),
33
+ tenantId: h(),
34
+ guildId: _(),
35
+ subjectId: g(),
36
+ roleId: _(),
37
+ joinedAt: m().safe(),
38
+ contribution: d().safe(),
39
+ lastActiveAt: m().safe(),
40
+ metadata: d().sensitive("pii")
41
+ }).index(["tenantId", "subjectId"]).index(["guildId"]), b = f(s, {
42
+ id: l({ prefix: "grole" }),
43
+ tenantId: h(),
44
+ guildId: _(),
45
+ name: p().maxLength(64).safe(),
46
+ rank: u().safe(),
47
+ permissions: u().safe(),
48
+ metadata: d().sensitive("pii")
49
+ }).index(["guildId"]), x = f(n, {
50
+ id: l({ prefix: "gapp" }),
51
+ tenantId: h(),
52
+ guildId: _(),
53
+ subjectId: g(),
54
+ message: p().sensitive("pii"),
55
+ state: p().oneOf([
56
+ "pending",
57
+ "accepted",
58
+ "declined",
59
+ "withdrawn"
60
+ ]).safe(),
61
+ decidedBy: g().nullable(),
62
+ decidedAt: m().nullable().safe(),
63
+ createdAt: m().safe(),
64
+ metadata: d().sensitive("pii")
65
+ }).index(["guildId", "state"]).index(["tenantId", "subjectId"]), S = f(i, {
66
+ id: l({ prefix: "ginv" }),
67
+ tenantId: h(),
68
+ guildId: _(),
69
+ toId: g(),
70
+ fromId: g(),
71
+ expiresAt: m().safe(),
72
+ state: p().oneOf([
73
+ "pending",
74
+ "accepted",
75
+ "declined",
76
+ "cancelled"
77
+ ]).safe(),
78
+ createdAt: m().safe(),
79
+ metadata: d().sensitive("pii")
80
+ }).index(["guildId", "state"]).index(["tenantId", "toId"]), C = f(a, {
81
+ id: l({ prefix: "glog" }),
82
+ tenantId: h(),
83
+ guildId: _(),
84
+ kind: p().maxLength(64).safe(),
85
+ actorId: g().nullable(),
86
+ targetId: g().nullable(),
87
+ detail: d().sensitive("pii"),
88
+ at: m().safe()
89
+ }).index(["guildId", "at"]).index(["tenantId", "actorId"]), w = f(t, {
90
+ id: l({ prefix: "gann" }),
91
+ tenantId: h(),
92
+ guildId: _(),
93
+ authorId: g().nullable(),
94
+ body: p().sensitive("pii"),
95
+ pinned: c().safe(),
96
+ createdAt: m().safe(),
97
+ metadata: d().sensitive("pii")
98
+ }).index(["guildId", "createdAt"]).index(["tenantId", "authorId"]), T = f(e, {
99
+ id: l({ prefix: "gadm" }),
100
+ tenantId: h(),
101
+ subjectId: g().nullable(),
102
+ admission: u().serverOnly(),
103
+ erased: c().serverOnly(),
104
+ metadata: d().sensitive("pii")
105
+ }).index(["tenantId", "subjectId"]), E = [
106
+ v,
107
+ y,
108
+ b,
109
+ x,
110
+ S,
111
+ C,
112
+ w,
113
+ T
114
+ ];
115
+ //#endregion
116
+ export { T as guildAdmissionsTable, w as guildAnnouncementsTable, x as guildApplicationsTable, S as guildInvitesTable, C as guildLogTable, y as guildMembersTable, b as guildRolesTable, E as guildTables, v as guildsTable };
@@ -0,0 +1,13 @@
1
+ import { Schema } from 'effect';
2
+ import { YieldableError } from 'effect/Cause';
3
+
4
+ export declare class GuildsError extends GuildsError_base {
5
+ }
6
+
7
+ export declare const guildsError: (code: GuildsError["code"]) => GuildsError;
8
+
9
+ declare const GuildsError_base: Schema.Class<GuildsError, Schema.TaggedStruct<"GuildsError", {
10
+ readonly code: Schema.Literals<readonly ["identity_required", "invalid_input", "forbidden", "not_found", "conflict", "name_taken", "guild_limit", "member_limit", "pending_limit", "blocked", "content_rejected", "expired", "unavailable", "export_limit"]>;
11
+ }>, YieldableError>;
12
+
13
+ export { }
package/dist/errors.js ADDED
@@ -0,0 +1,20 @@
1
+ import { Schema as e } from "effect";
2
+ //#region src/errors.ts
3
+ var t = class extends e.TaggedError()("GuildsError", { code: e.Literals([
4
+ "identity_required",
5
+ "invalid_input",
6
+ "forbidden",
7
+ "not_found",
8
+ "conflict",
9
+ "name_taken",
10
+ "guild_limit",
11
+ "member_limit",
12
+ "pending_limit",
13
+ "blocked",
14
+ "content_rejected",
15
+ "expired",
16
+ "unavailable",
17
+ "export_limit"
18
+ ]) }) {}, n = (e) => new t({ code: e });
19
+ //#endregion
20
+ export { t as GuildsError, n as guildsError };
@@ -0,0 +1,8 @@
1
+ import { ChangeEvent } from '@voltro/database';
2
+ import { SubscribeContext } from '@voltro/runtime';
3
+
4
+ export declare const guildEventTenant: (event: ChangeEvent) => string;
5
+
6
+ export declare const publishGuildChange: (event: ChangeEvent, ctx: SubscribeContext) => Promise<void>;
7
+
8
+ export { }
@@ -0,0 +1,20 @@
1
+ import "./contract.js";
2
+ import { guildChanged as e } from "./events.js";
3
+ //#region src/eventProducer.ts
4
+ var t = (e) => {
5
+ if (e.table !== "_voltro_guild_log") throw Error("Guild events require the owned log table");
6
+ let t = (e.op === "delete" ? e.old : e.new)?.tenantId;
7
+ if (typeof t != "string" || !t.trim() || t.length > 256 || t.includes("\0") || t === "~" || e.op === "update" && e.old?.tenantId !== t) throw Error("Guild events require stable committed tenant evidence");
8
+ return t;
9
+ }, n = async (n, r) => {
10
+ if (t(n), n.op !== "insert") return;
11
+ let i = n.new;
12
+ if (!i || typeof i.id != "string" || !i.id || i.id.length > 64 || typeof i.guildId != "string" || !i.guildId || i.guildId.length > 64 || typeof i.kind != "string" || !i.kind || i.kind.length > 64) throw Error("Guild events require committed log metadata");
13
+ if (!r.publish) throw Error("Guild event publisher is unavailable");
14
+ await r.publish(e, { guildId: i.guildId }, {
15
+ logId: i.id,
16
+ kind: i.kind
17
+ });
18
+ };
19
+ //#endregion
20
+ export { t as guildEventTenant, n as publishGuildChange };