@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.
- package/CHANGELOG.md +24329 -0
- package/LICENSE +61 -0
- package/README.md +165 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +8467 -0
- package/dist/components.js +396 -0
- package/dist/contract.js +114 -0
- package/dist/entities.js +116 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.js +20 -0
- package/dist/eventProducer.d.ts +8 -0
- package/dist/eventProducer.js +20 -0
- package/dist/events.d.ts +15 -0
- package/dist/events.js +14 -0
- package/dist/guild-app/events/guilds.changed.event.ts +1 -0
- package/dist/guild-app/subscribers/guilds.log.subscribe.ts +3 -0
- package/dist/index.d.ts +606 -0
- package/dist/index.js +109 -0
- package/dist/inspect.js +28 -0
- package/dist/port.d.ts +25 -0
- package/dist/port.js +5 -0
- package/dist/rpc.d.ts +355 -0
- package/dist/rpc.js +280 -0
- package/dist/rpcRoutes.js +94 -0
- package/dist/service.js +734 -0
- package/dist/strategies.d.ts +111 -0
- package/dist/strategies.js +51 -0
- package/dist/testing.d.ts +104 -0
- package/dist/testing.js +77 -0
- package/dist/web.d.ts +365 -0
- package/dist/web.js +8 -0
- package/package.json +90 -4
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DeclaredAccess } from '@voltro/protocol';
|
|
2
|
+
import { EventDescriptor } from '@voltro/protocol';
|
|
3
|
+
import { Schema } from 'effect';
|
|
4
|
+
|
|
5
|
+
/** Operator metadata only. Player state is delivered by membership-filtered Live Queries. */
|
|
6
|
+
export declare const guildChanged: EventDescriptor<"guilds.changed", Schema.Struct<{
|
|
7
|
+
readonly guildId: Schema.String;
|
|
8
|
+
}>, Schema.Struct<{
|
|
9
|
+
readonly logId: Schema.String;
|
|
10
|
+
readonly kind: Schema.String;
|
|
11
|
+
}>, DeclaredAccess<{
|
|
12
|
+
readonly guildId: string;
|
|
13
|
+
}>>;
|
|
14
|
+
|
|
15
|
+
export { }
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
import { defineEvent as t } from "@voltro/protocol";
|
|
3
|
+
//#region src/events.ts
|
|
4
|
+
var n = t({
|
|
5
|
+
name: "guilds.changed",
|
|
6
|
+
key: e.Struct({ guildId: e.String }),
|
|
7
|
+
payload: e.Struct({
|
|
8
|
+
logId: e.String,
|
|
9
|
+
kind: e.String
|
|
10
|
+
}),
|
|
11
|
+
guards: [{ scope: "guilds:events:read" }]
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { n as guildChanged };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { guildChanged as default } from '@voltro/plugin-guilds/events'
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { defineSubscriber } from '@voltro/runtime'
|
|
2
|
+
import { guildEventTenant, publishGuildChange } from '@voltro/plugin-guilds/events/server'
|
|
3
|
+
export default defineSubscriber({table:'_voltro_guild_log',on:['insert'],once:true,eventTenant:guildEventTenant,handler:publishGuildChange})
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
import { ColumnBuilder } from '@voltro/database';
|
|
2
|
+
import { Context } from 'effect';
|
|
3
|
+
import { DataStore } from '@voltro/database';
|
|
4
|
+
import { Effect } from 'effect';
|
|
5
|
+
import { FieldDefinitions } from '@voltro/database';
|
|
6
|
+
import { PluginPrivacyTarget } from '@voltro/protocol';
|
|
7
|
+
import { Schema } from 'effect';
|
|
8
|
+
import { Subject } from '@voltro/protocol';
|
|
9
|
+
import { Table } from '@voltro/database';
|
|
10
|
+
import { VoltroPlugin } from '@voltro/protocol';
|
|
11
|
+
import { YieldableError } from 'effect/Cause';
|
|
12
|
+
|
|
13
|
+
declare const ADMISSIONS_TABLE = "_voltro_guild_admissions";
|
|
14
|
+
|
|
15
|
+
declare const ANNOUNCEMENTS_TABLE = "_voltro_guild_announcements";
|
|
16
|
+
|
|
17
|
+
declare const APPLICATIONS_TABLE = "_voltro_guild_applications";
|
|
18
|
+
|
|
19
|
+
declare namespace C {
|
|
20
|
+
export {
|
|
21
|
+
GUILDS_TABLE,
|
|
22
|
+
MEMBERS_TABLE,
|
|
23
|
+
ROLES_TABLE,
|
|
24
|
+
APPLICATIONS_TABLE,
|
|
25
|
+
INVITES_TABLE,
|
|
26
|
+
LOG_TABLE,
|
|
27
|
+
ANNOUNCEMENTS_TABLE,
|
|
28
|
+
ADMISSIONS_TABLE,
|
|
29
|
+
PERMISSIONS,
|
|
30
|
+
GuildPermission,
|
|
31
|
+
GuildSchema,
|
|
32
|
+
GuildSummarySchema,
|
|
33
|
+
GuildSummary,
|
|
34
|
+
GuildMemberSchema,
|
|
35
|
+
GuildRoleSchema,
|
|
36
|
+
GuildApplicationSchema,
|
|
37
|
+
GuildInviteSchema,
|
|
38
|
+
GuildLogSchema,
|
|
39
|
+
GuildAnnouncementSchema,
|
|
40
|
+
Guild,
|
|
41
|
+
GuildMember,
|
|
42
|
+
GuildRole,
|
|
43
|
+
GuildApplication,
|
|
44
|
+
GuildInvite,
|
|
45
|
+
GuildLogEntry,
|
|
46
|
+
GuildAnnouncement,
|
|
47
|
+
CreateGuildInput,
|
|
48
|
+
GuildRoleInput
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export declare interface CreateGuildInput {
|
|
53
|
+
readonly requestId: string;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly tag: string;
|
|
56
|
+
readonly description?: string;
|
|
57
|
+
readonly visibility?: Guild['visibility'];
|
|
58
|
+
readonly region?: string;
|
|
59
|
+
readonly language?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export declare const dataStoreGuilds: (store: DataStore, options: ResolvedGuildOptions) => {
|
|
63
|
+
service: GuildService;
|
|
64
|
+
recordContribution: (subject: Subject, input: {
|
|
65
|
+
readonly tenantId: string;
|
|
66
|
+
readonly guildId: string;
|
|
67
|
+
readonly subjectId: string;
|
|
68
|
+
readonly requestId: string;
|
|
69
|
+
readonly xp: number;
|
|
70
|
+
}) => Effect.Effect<{
|
|
71
|
+
readonly id: string;
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly tag: string;
|
|
74
|
+
readonly description: string;
|
|
75
|
+
readonly emblem: string | null;
|
|
76
|
+
readonly visibility: "open" | "apply" | "invite";
|
|
77
|
+
readonly minLevel: number;
|
|
78
|
+
readonly region: string | null;
|
|
79
|
+
readonly language: string | null;
|
|
80
|
+
readonly level: number;
|
|
81
|
+
readonly xp: number;
|
|
82
|
+
readonly memberCap: number;
|
|
83
|
+
readonly createdAt: number;
|
|
84
|
+
readonly ownerId: string | null;
|
|
85
|
+
readonly version: number;
|
|
86
|
+
readonly metadata: {
|
|
87
|
+
readonly [x: string]: unknown;
|
|
88
|
+
};
|
|
89
|
+
}, GuildsError, never>;
|
|
90
|
+
inactivityProposal: (subject: Subject, input: {
|
|
91
|
+
readonly tenantId: string;
|
|
92
|
+
readonly guildId: string;
|
|
93
|
+
}) => Effect.Effect<string | null, GuildsError, never>;
|
|
94
|
+
exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, GuildsError, never>;
|
|
95
|
+
eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, GuildsError, never>;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export declare const defaultGuildStrategies: Readonly<{
|
|
99
|
+
permissions: ({ role, permission }: GuildPermissionsInput) => boolean;
|
|
100
|
+
levelCurve: ({ xp, baseMemberCap, maximumMemberCap }: GuildLevelInput) => {
|
|
101
|
+
level: number;
|
|
102
|
+
memberCap: number;
|
|
103
|
+
};
|
|
104
|
+
inactivityPolicy: (input: GuildInactivityInput) => string | null;
|
|
105
|
+
}>;
|
|
106
|
+
|
|
107
|
+
export declare type Guild = typeof GuildSchema.Type;
|
|
108
|
+
|
|
109
|
+
/** Stable per-subject SQL row serializes guild-cap admission across independent pools. */
|
|
110
|
+
export declare const guildAdmissionsTable: Table<"_voltro_guild_admissions", FieldDefinitions<{
|
|
111
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
112
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
113
|
+
readonly subjectId: ColumnBuilder<string | null, "text", boolean>;
|
|
114
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
115
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
116
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
117
|
+
}>, true, never>;
|
|
118
|
+
|
|
119
|
+
export declare type GuildAnnouncement = typeof GuildAnnouncementSchema.Type;
|
|
120
|
+
|
|
121
|
+
declare const GuildAnnouncementSchema: Schema.Struct<{
|
|
122
|
+
readonly id: Schema.String;
|
|
123
|
+
readonly guildId: Schema.String;
|
|
124
|
+
readonly authorId: Schema.NullOr<Schema.String>;
|
|
125
|
+
readonly body: Schema.String;
|
|
126
|
+
readonly pinned: Schema.Boolean;
|
|
127
|
+
readonly createdAt: Schema.Number;
|
|
128
|
+
readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
129
|
+
}>;
|
|
130
|
+
|
|
131
|
+
export declare const guildAnnouncementsTable: Table<"_voltro_guild_announcements", FieldDefinitions<{
|
|
132
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
133
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
134
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
135
|
+
readonly authorId: ColumnBuilder<string | null, "text", boolean>;
|
|
136
|
+
readonly body: ColumnBuilder<string, "text", boolean>;
|
|
137
|
+
readonly pinned: ColumnBuilder<boolean, "boolean", boolean>;
|
|
138
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
139
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
140
|
+
}>, true, never>;
|
|
141
|
+
|
|
142
|
+
export declare type GuildApplication = typeof GuildApplicationSchema.Type;
|
|
143
|
+
|
|
144
|
+
declare const GuildApplicationSchema: Schema.Struct<{
|
|
145
|
+
readonly id: Schema.String;
|
|
146
|
+
readonly guildId: Schema.String;
|
|
147
|
+
readonly subjectId: Schema.String;
|
|
148
|
+
readonly message: Schema.String;
|
|
149
|
+
readonly state: Schema.Literals<readonly ["pending", "accepted", "declined", "withdrawn"]>;
|
|
150
|
+
readonly decidedBy: Schema.NullOr<Schema.String>;
|
|
151
|
+
readonly decidedAt: Schema.NullOr<Schema.Number>;
|
|
152
|
+
readonly createdAt: Schema.Number;
|
|
153
|
+
readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
154
|
+
}>;
|
|
155
|
+
|
|
156
|
+
export declare const guildApplicationsTable: Table<"_voltro_guild_applications", FieldDefinitions<{
|
|
157
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
158
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
159
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
160
|
+
readonly subjectId: ColumnBuilder<string, "text", boolean>;
|
|
161
|
+
readonly message: ColumnBuilder<string, "text", boolean>;
|
|
162
|
+
readonly state: ColumnBuilder<"pending" | "accepted" | "withdrawn" | "declined", "text", boolean>;
|
|
163
|
+
readonly decidedBy: ColumnBuilder<string | null, "text", boolean>;
|
|
164
|
+
readonly decidedAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
165
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
166
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
167
|
+
}>, true, never>;
|
|
168
|
+
|
|
169
|
+
export declare interface GuildInactivityInput {
|
|
170
|
+
readonly now: number;
|
|
171
|
+
readonly inactiveAfterMs: number;
|
|
172
|
+
readonly ownerLastActiveAt: number;
|
|
173
|
+
readonly members: ReadonlyArray<{
|
|
174
|
+
readonly subjectId: string;
|
|
175
|
+
readonly rank: number;
|
|
176
|
+
readonly lastActiveAt: number;
|
|
177
|
+
readonly joinedAt: number;
|
|
178
|
+
}>;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export declare type GuildInvite = typeof GuildInviteSchema.Type;
|
|
182
|
+
|
|
183
|
+
declare const GuildInviteSchema: Schema.Struct<{
|
|
184
|
+
readonly id: Schema.String;
|
|
185
|
+
readonly guildId: Schema.String;
|
|
186
|
+
readonly toId: Schema.String;
|
|
187
|
+
readonly fromId: Schema.String;
|
|
188
|
+
readonly expiresAt: Schema.Number;
|
|
189
|
+
readonly state: Schema.Literals<readonly ["pending", "accepted", "declined", "cancelled"]>;
|
|
190
|
+
readonly createdAt: Schema.Number;
|
|
191
|
+
readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
192
|
+
}>;
|
|
193
|
+
|
|
194
|
+
export declare const guildInvitesTable: Table<"_voltro_guild_invites", FieldDefinitions<{
|
|
195
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
196
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
197
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
198
|
+
readonly toId: ColumnBuilder<string, "text", boolean>;
|
|
199
|
+
readonly fromId: ColumnBuilder<string, "text", boolean>;
|
|
200
|
+
readonly expiresAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
201
|
+
readonly state: ColumnBuilder<"pending" | "cancelled" | "accepted" | "declined", "text", boolean>;
|
|
202
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
203
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
204
|
+
}>, true, never>;
|
|
205
|
+
|
|
206
|
+
export declare interface GuildLevelInput {
|
|
207
|
+
readonly xp: number;
|
|
208
|
+
readonly baseMemberCap: number;
|
|
209
|
+
readonly maximumMemberCap: number;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export declare type GuildLogEntry = typeof GuildLogSchema.Type;
|
|
213
|
+
|
|
214
|
+
declare const GuildLogSchema: Schema.Struct<{
|
|
215
|
+
readonly id: Schema.String;
|
|
216
|
+
readonly guildId: Schema.String;
|
|
217
|
+
readonly kind: Schema.String;
|
|
218
|
+
readonly actorId: Schema.NullOr<Schema.String>;
|
|
219
|
+
readonly targetId: Schema.NullOr<Schema.String>;
|
|
220
|
+
readonly detail: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
221
|
+
readonly at: Schema.Number;
|
|
222
|
+
}>;
|
|
223
|
+
|
|
224
|
+
export declare const guildLogTable: Table<"_voltro_guild_log", FieldDefinitions<{
|
|
225
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
226
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
227
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
228
|
+
readonly kind: ColumnBuilder<string, "text", boolean>;
|
|
229
|
+
readonly actorId: ColumnBuilder<string | null, "text", boolean>;
|
|
230
|
+
readonly targetId: ColumnBuilder<string | null, "text", boolean>;
|
|
231
|
+
readonly detail: ColumnBuilder<unknown, "json", boolean>;
|
|
232
|
+
readonly at: ColumnBuilder<Date, "timestamp", boolean>;
|
|
233
|
+
}>, true, never>;
|
|
234
|
+
|
|
235
|
+
export declare type GuildMember = typeof GuildMemberSchema.Type;
|
|
236
|
+
|
|
237
|
+
declare const GuildMemberSchema: Schema.Struct<{
|
|
238
|
+
readonly id: Schema.String;
|
|
239
|
+
readonly guildId: Schema.String;
|
|
240
|
+
readonly subjectId: Schema.String;
|
|
241
|
+
readonly roleId: Schema.String;
|
|
242
|
+
readonly joinedAt: Schema.Number;
|
|
243
|
+
readonly contribution: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
244
|
+
readonly lastActiveAt: Schema.Number;
|
|
245
|
+
readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
246
|
+
}>;
|
|
247
|
+
|
|
248
|
+
export declare class GuildMembershipPort extends GuildMembershipPort_base {
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
declare const GuildMembershipPort_base: Context.ServiceClass<GuildMembershipPort, "@voltro/GuildMembershipPort", GuildMembershipService>;
|
|
252
|
+
|
|
253
|
+
/** Chat, matchmaking parties and guild leaderboards ask this port, never Guild SQL. */
|
|
254
|
+
export declare interface GuildMembershipService {
|
|
255
|
+
/** True only while `subject` belongs to `guildId` in its own tenant. Unknown, foreign or inaccessible guilds answer false. */
|
|
256
|
+
readonly isMember: (subject: Subject, guildId: string) => Effect.Effect<boolean, GuildsError>;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export declare const guildMembersTable: Table<"_voltro_guild_members", FieldDefinitions<{
|
|
260
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
261
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
262
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
263
|
+
readonly subjectId: ColumnBuilder<string, "text", boolean>;
|
|
264
|
+
readonly roleId: ColumnBuilder<string, "text", boolean>;
|
|
265
|
+
readonly joinedAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
266
|
+
readonly contribution: ColumnBuilder<unknown, "json", boolean>;
|
|
267
|
+
readonly lastActiveAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
268
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
269
|
+
}>, true, never>;
|
|
270
|
+
|
|
271
|
+
export declare interface GuildOptions {
|
|
272
|
+
readonly baseMemberCap?: number;
|
|
273
|
+
readonly maximumMemberCap?: number;
|
|
274
|
+
readonly maxGuildsPerSubject?: number;
|
|
275
|
+
readonly maxRoles?: number;
|
|
276
|
+
readonly maxPending?: number;
|
|
277
|
+
readonly inviteTtlMs?: number;
|
|
278
|
+
readonly inactiveAfterMs?: number;
|
|
279
|
+
readonly pageSize?: number;
|
|
280
|
+
readonly maxExportRows?: number;
|
|
281
|
+
readonly maxDescriptionLength?: number;
|
|
282
|
+
readonly maxAnnouncementLength?: number;
|
|
283
|
+
readonly denyWords?: ReadonlyArray<string>;
|
|
284
|
+
readonly strategies?: Partial<typeof defaultGuildStrategies>;
|
|
285
|
+
readonly now?: () => number;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export declare type GuildPermission = keyof typeof PERMISSIONS;
|
|
289
|
+
|
|
290
|
+
export declare interface GuildPermissionsInput {
|
|
291
|
+
readonly role: GuildRole;
|
|
292
|
+
readonly permission: GuildPermission;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export declare type GuildRole = typeof GuildRoleSchema.Type;
|
|
296
|
+
|
|
297
|
+
export declare interface GuildRoleInput {
|
|
298
|
+
readonly guildId: string;
|
|
299
|
+
readonly roleId: string;
|
|
300
|
+
readonly name: string;
|
|
301
|
+
readonly rank: number;
|
|
302
|
+
readonly permissions: number;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
declare const GuildRoleSchema: Schema.Struct<{
|
|
306
|
+
readonly id: Schema.String;
|
|
307
|
+
readonly guildId: Schema.String;
|
|
308
|
+
readonly name: Schema.String;
|
|
309
|
+
readonly rank: Schema.Number;
|
|
310
|
+
readonly permissions: Schema.Number;
|
|
311
|
+
readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
312
|
+
}>;
|
|
313
|
+
|
|
314
|
+
export declare const guildRolesTable: Table<"_voltro_guild_roles", FieldDefinitions<{
|
|
315
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
316
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
317
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
318
|
+
readonly name: ColumnBuilder<string, "text", boolean>;
|
|
319
|
+
readonly rank: ColumnBuilder<number, "integer", boolean>;
|
|
320
|
+
readonly permissions: ColumnBuilder<number, "integer", boolean>;
|
|
321
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
322
|
+
}>, true, never>;
|
|
323
|
+
|
|
324
|
+
declare const GUILDS_TABLE = "_voltro_guilds";
|
|
325
|
+
|
|
326
|
+
declare const GuildSchema: Schema.Struct<{
|
|
327
|
+
readonly id: Schema.String;
|
|
328
|
+
readonly name: Schema.String;
|
|
329
|
+
readonly tag: Schema.String;
|
|
330
|
+
readonly description: Schema.String;
|
|
331
|
+
readonly emblem: Schema.NullOr<Schema.String>;
|
|
332
|
+
readonly visibility: Schema.Literals<readonly ["open", "apply", "invite"]>;
|
|
333
|
+
readonly minLevel: Schema.Number;
|
|
334
|
+
readonly region: Schema.NullOr<Schema.String>;
|
|
335
|
+
readonly language: Schema.NullOr<Schema.String>;
|
|
336
|
+
readonly level: Schema.Number;
|
|
337
|
+
readonly xp: Schema.Number;
|
|
338
|
+
readonly memberCap: Schema.Number;
|
|
339
|
+
readonly createdAt: Schema.Number;
|
|
340
|
+
readonly ownerId: Schema.NullOr<Schema.String>;
|
|
341
|
+
readonly version: Schema.Number;
|
|
342
|
+
readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
343
|
+
}>;
|
|
344
|
+
|
|
345
|
+
export declare class GuildsError extends GuildsError_base {
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
declare const GuildsError_base: Schema.Class<GuildsError, Schema.TaggedStruct<"GuildsError", {
|
|
349
|
+
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"]>;
|
|
350
|
+
}>, YieldableError>;
|
|
351
|
+
|
|
352
|
+
export declare interface GuildService {
|
|
353
|
+
readonly create: (subject: Subject, input: C.CreateGuildInput) => Effect.Effect<C.Guild, GuildsError>;
|
|
354
|
+
readonly mine: (subject: Subject) => Effect.Effect<ReadonlyArray<C.Guild>, GuildsError>;
|
|
355
|
+
readonly get: (subject: Subject, guildId: string) => Effect.Effect<C.Guild, GuildsError>;
|
|
356
|
+
readonly search: (subject: Subject, input: {
|
|
357
|
+
readonly name?: string;
|
|
358
|
+
readonly tag?: string;
|
|
359
|
+
readonly region?: string;
|
|
360
|
+
readonly language?: string;
|
|
361
|
+
}) => Effect.Effect<ReadonlyArray<C.GuildSummary>, GuildsError>;
|
|
362
|
+
readonly members: (subject: Subject, guildId: string) => Effect.Effect<ReadonlyArray<C.GuildMember>, GuildsError>;
|
|
363
|
+
readonly roles: (subject: Subject, guildId: string) => Effect.Effect<ReadonlyArray<C.GuildRole>, GuildsError>;
|
|
364
|
+
readonly join: (subject: Subject, guildId: string) => Effect.Effect<C.GuildMember, GuildsError>;
|
|
365
|
+
readonly leave: (subject: Subject, guildId: string) => Effect.Effect<void, GuildsError>;
|
|
366
|
+
readonly apply: (subject: Subject, input: {
|
|
367
|
+
readonly guildId: string;
|
|
368
|
+
readonly requestId: string;
|
|
369
|
+
readonly message: string;
|
|
370
|
+
}) => Effect.Effect<C.GuildApplication, GuildsError>;
|
|
371
|
+
readonly applications: (subject: Subject, guildId: string) => Effect.Effect<ReadonlyArray<C.GuildApplication>, GuildsError>;
|
|
372
|
+
readonly decideApplication: (subject: Subject, input: {
|
|
373
|
+
readonly applicationId: string;
|
|
374
|
+
readonly accept: boolean;
|
|
375
|
+
}) => Effect.Effect<C.GuildApplication, GuildsError>;
|
|
376
|
+
readonly invite: (subject: Subject, input: {
|
|
377
|
+
readonly guildId: string;
|
|
378
|
+
readonly subjectId: string;
|
|
379
|
+
readonly requestId: string;
|
|
380
|
+
}) => Effect.Effect<C.GuildInvite, GuildsError>;
|
|
381
|
+
readonly invites: (subject: Subject) => Effect.Effect<ReadonlyArray<C.GuildInvite>, GuildsError>;
|
|
382
|
+
readonly decideInvite: (subject: Subject, input: {
|
|
383
|
+
readonly inviteId: string;
|
|
384
|
+
readonly accept: boolean;
|
|
385
|
+
}) => Effect.Effect<C.GuildInvite, GuildsError>;
|
|
386
|
+
readonly kick: (subject: Subject, guildId: string, subjectId: string) => Effect.Effect<void, GuildsError>;
|
|
387
|
+
readonly setRole: (subject: Subject, guildId: string, subjectId: string, roleId: string) => Effect.Effect<C.GuildMember, GuildsError>;
|
|
388
|
+
readonly configureRole: (subject: Subject, input: C.GuildRoleInput) => Effect.Effect<C.GuildRole, GuildsError>;
|
|
389
|
+
readonly transferOwner: (subject: Subject, guildId: string, subjectId: string) => Effect.Effect<C.Guild, GuildsError>;
|
|
390
|
+
readonly updateProfile: (subject: Subject, input: {
|
|
391
|
+
readonly guildId: string;
|
|
392
|
+
readonly baseVersion: number;
|
|
393
|
+
readonly description?: string;
|
|
394
|
+
readonly visibility?: C.Guild['visibility'];
|
|
395
|
+
readonly region?: string | null;
|
|
396
|
+
readonly language?: string | null;
|
|
397
|
+
}) => Effect.Effect<C.Guild, GuildsError>;
|
|
398
|
+
readonly announce: (subject: Subject, input: {
|
|
399
|
+
readonly guildId: string;
|
|
400
|
+
readonly requestId: string;
|
|
401
|
+
readonly body: string;
|
|
402
|
+
readonly pinned?: boolean;
|
|
403
|
+
}) => Effect.Effect<C.GuildAnnouncement, GuildsError>;
|
|
404
|
+
readonly announcements: (subject: Subject, guildId: string) => Effect.Effect<ReadonlyArray<C.GuildAnnouncement>, GuildsError>;
|
|
405
|
+
readonly log: (subject: Subject, guildId: string) => Effect.Effect<ReadonlyArray<C.GuildLogEntry>, GuildsError>;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export declare const guildsPlugin: (input?: GuildOptions) => VoltroPlugin;
|
|
409
|
+
|
|
410
|
+
export declare const guildsTable: Table<"_voltro_guilds", FieldDefinitions<{
|
|
411
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
412
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
413
|
+
readonly name: ColumnBuilder<string, "text", boolean>;
|
|
414
|
+
readonly nameKey: ColumnBuilder<string, "text", boolean>;
|
|
415
|
+
readonly tag: ColumnBuilder<string, "text", boolean>;
|
|
416
|
+
readonly tagKey: ColumnBuilder<string, "text", boolean>;
|
|
417
|
+
readonly description: ColumnBuilder<string, "text", boolean>;
|
|
418
|
+
readonly emblem: ColumnBuilder<string | null, "text", boolean>;
|
|
419
|
+
readonly visibility: ColumnBuilder<"open" | "apply" | "invite", "text", boolean>;
|
|
420
|
+
readonly minLevel: ColumnBuilder<number, "integer", boolean>;
|
|
421
|
+
readonly region: ColumnBuilder<string | null, "text", boolean>;
|
|
422
|
+
readonly language: ColumnBuilder<string | null, "text", boolean>;
|
|
423
|
+
readonly level: ColumnBuilder<number, "integer", boolean>;
|
|
424
|
+
readonly xp: ColumnBuilder<number, "integer", boolean>;
|
|
425
|
+
readonly memberCap: ColumnBuilder<number, "integer", boolean>;
|
|
426
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
427
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
428
|
+
readonly version: ColumnBuilder<number, "integer", boolean>;
|
|
429
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
430
|
+
readonly creationKey: ColumnBuilder<string, "text", boolean>;
|
|
431
|
+
readonly dissolvedAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
432
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
433
|
+
}>, true, never>;
|
|
434
|
+
|
|
435
|
+
export declare type GuildSummary = typeof GuildSummarySchema.Type;
|
|
436
|
+
|
|
437
|
+
declare const GuildSummarySchema: Schema.Struct<{
|
|
438
|
+
readonly id: Schema.String;
|
|
439
|
+
readonly name: Schema.String;
|
|
440
|
+
readonly tag: Schema.String;
|
|
441
|
+
readonly description: Schema.String;
|
|
442
|
+
readonly emblem: Schema.NullOr<Schema.String>;
|
|
443
|
+
readonly visibility: Schema.Literals<readonly ["open", "apply", "invite"]>;
|
|
444
|
+
readonly minLevel: Schema.Number;
|
|
445
|
+
readonly region: Schema.NullOr<Schema.String>;
|
|
446
|
+
readonly language: Schema.NullOr<Schema.String>;
|
|
447
|
+
readonly level: Schema.Number;
|
|
448
|
+
readonly xp: Schema.Number;
|
|
449
|
+
readonly memberCap: Schema.Number;
|
|
450
|
+
readonly createdAt: Schema.Number;
|
|
451
|
+
readonly version: Schema.Number;
|
|
452
|
+
}>;
|
|
453
|
+
|
|
454
|
+
export declare const guildSystemContract: {
|
|
455
|
+
readonly slots: {
|
|
456
|
+
readonly permissions: {
|
|
457
|
+
readonly defaultExport: "bitSetGuildPermissions";
|
|
458
|
+
readonly fixtureExport: "guildPermissionsFixture";
|
|
459
|
+
};
|
|
460
|
+
readonly levelCurve: {
|
|
461
|
+
readonly defaultExport: "quadraticGuildLevels";
|
|
462
|
+
readonly fixtureExport: "guildLevelFixture";
|
|
463
|
+
};
|
|
464
|
+
readonly inactivityPolicy: {
|
|
465
|
+
readonly defaultExport: "highestActiveGuildSuccessor";
|
|
466
|
+
readonly fixtureExport: "guildInactivityFixture";
|
|
467
|
+
};
|
|
468
|
+
};
|
|
469
|
+
readonly ports: {};
|
|
470
|
+
readonly events: readonly ["guilds.changed"];
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
export declare const guildTables: ( Table<"_voltro_guilds", FieldDefinitions<{
|
|
474
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
475
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
476
|
+
readonly name: ColumnBuilder<string, "text", boolean>;
|
|
477
|
+
readonly nameKey: ColumnBuilder<string, "text", boolean>;
|
|
478
|
+
readonly tag: ColumnBuilder<string, "text", boolean>;
|
|
479
|
+
readonly tagKey: ColumnBuilder<string, "text", boolean>;
|
|
480
|
+
readonly description: ColumnBuilder<string, "text", boolean>;
|
|
481
|
+
readonly emblem: ColumnBuilder<string | null, "text", boolean>;
|
|
482
|
+
readonly visibility: ColumnBuilder<"open" | "apply" | "invite", "text", boolean>;
|
|
483
|
+
readonly minLevel: ColumnBuilder<number, "integer", boolean>;
|
|
484
|
+
readonly region: ColumnBuilder<string | null, "text", boolean>;
|
|
485
|
+
readonly language: ColumnBuilder<string | null, "text", boolean>;
|
|
486
|
+
readonly level: ColumnBuilder<number, "integer", boolean>;
|
|
487
|
+
readonly xp: ColumnBuilder<number, "integer", boolean>;
|
|
488
|
+
readonly memberCap: ColumnBuilder<number, "integer", boolean>;
|
|
489
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
490
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
491
|
+
readonly version: ColumnBuilder<number, "integer", boolean>;
|
|
492
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
493
|
+
readonly creationKey: ColumnBuilder<string, "text", boolean>;
|
|
494
|
+
readonly dissolvedAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
495
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
496
|
+
}>, true, never> | Table<"_voltro_guild_members", FieldDefinitions<{
|
|
497
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
498
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
499
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
500
|
+
readonly subjectId: ColumnBuilder<string, "text", boolean>;
|
|
501
|
+
readonly roleId: ColumnBuilder<string, "text", boolean>;
|
|
502
|
+
readonly joinedAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
503
|
+
readonly contribution: ColumnBuilder<unknown, "json", boolean>;
|
|
504
|
+
readonly lastActiveAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
505
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
506
|
+
}>, true, never> | Table<"_voltro_guild_roles", FieldDefinitions<{
|
|
507
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
508
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
509
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
510
|
+
readonly name: ColumnBuilder<string, "text", boolean>;
|
|
511
|
+
readonly rank: ColumnBuilder<number, "integer", boolean>;
|
|
512
|
+
readonly permissions: ColumnBuilder<number, "integer", boolean>;
|
|
513
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
514
|
+
}>, true, never> | Table<"_voltro_guild_applications", FieldDefinitions<{
|
|
515
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
516
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
517
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
518
|
+
readonly subjectId: ColumnBuilder<string, "text", boolean>;
|
|
519
|
+
readonly message: ColumnBuilder<string, "text", boolean>;
|
|
520
|
+
readonly state: ColumnBuilder<"pending" | "accepted" | "withdrawn" | "declined", "text", boolean>;
|
|
521
|
+
readonly decidedBy: ColumnBuilder<string | null, "text", boolean>;
|
|
522
|
+
readonly decidedAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
523
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
524
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
525
|
+
}>, true, never> | Table<"_voltro_guild_invites", FieldDefinitions<{
|
|
526
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
527
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
528
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
529
|
+
readonly toId: ColumnBuilder<string, "text", boolean>;
|
|
530
|
+
readonly fromId: ColumnBuilder<string, "text", boolean>;
|
|
531
|
+
readonly expiresAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
532
|
+
readonly state: ColumnBuilder<"pending" | "cancelled" | "accepted" | "declined", "text", boolean>;
|
|
533
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
534
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
535
|
+
}>, true, never> | Table<"_voltro_guild_log", FieldDefinitions<{
|
|
536
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
537
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
538
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
539
|
+
readonly kind: ColumnBuilder<string, "text", boolean>;
|
|
540
|
+
readonly actorId: ColumnBuilder<string | null, "text", boolean>;
|
|
541
|
+
readonly targetId: ColumnBuilder<string | null, "text", boolean>;
|
|
542
|
+
readonly detail: ColumnBuilder<unknown, "json", boolean>;
|
|
543
|
+
readonly at: ColumnBuilder<Date, "timestamp", boolean>;
|
|
544
|
+
}>, true, never> | Table<"_voltro_guild_announcements", FieldDefinitions<{
|
|
545
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
546
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
547
|
+
readonly guildId: ColumnBuilder<string, "text", boolean>;
|
|
548
|
+
readonly authorId: ColumnBuilder<string | null, "text", boolean>;
|
|
549
|
+
readonly body: ColumnBuilder<string, "text", boolean>;
|
|
550
|
+
readonly pinned: ColumnBuilder<boolean, "boolean", boolean>;
|
|
551
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
552
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
553
|
+
}>, true, never> | Table<"_voltro_guild_admissions", FieldDefinitions<{
|
|
554
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
555
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
556
|
+
readonly subjectId: ColumnBuilder<string | null, "text", boolean>;
|
|
557
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
558
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
559
|
+
readonly metadata: ColumnBuilder<unknown, "json", boolean>;
|
|
560
|
+
}>, true, never>)[];
|
|
561
|
+
|
|
562
|
+
declare const INVITES_TABLE = "_voltro_guild_invites";
|
|
563
|
+
|
|
564
|
+
declare const LOG_TABLE = "_voltro_guild_log";
|
|
565
|
+
|
|
566
|
+
declare const MEMBERS_TABLE = "_voltro_guild_members";
|
|
567
|
+
|
|
568
|
+
declare const PERMISSIONS: {
|
|
569
|
+
readonly invite: 1;
|
|
570
|
+
readonly kick: 2;
|
|
571
|
+
readonly promote: 4;
|
|
572
|
+
readonly treasury: 8;
|
|
573
|
+
readonly announce: 16;
|
|
574
|
+
readonly startEvent: 32;
|
|
575
|
+
readonly editProfile: 64;
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
declare type ResolvedGuildOptions = ReturnType<typeof resolveGuildOptions>;
|
|
579
|
+
|
|
580
|
+
export declare const resolveGuildOptions: (input?: GuildOptions) => Readonly<{
|
|
581
|
+
baseMemberCap: number;
|
|
582
|
+
maximumMemberCap: number;
|
|
583
|
+
maxGuildsPerSubject: number;
|
|
584
|
+
maxRoles: number;
|
|
585
|
+
maxPending: number;
|
|
586
|
+
inviteTtlMs: number;
|
|
587
|
+
inactiveAfterMs: number;
|
|
588
|
+
pageSize: number;
|
|
589
|
+
maxExportRows: number;
|
|
590
|
+
maxDescriptionLength: number;
|
|
591
|
+
maxAnnouncementLength: number;
|
|
592
|
+
denyWords: readonly string[];
|
|
593
|
+
strategies: Readonly<{
|
|
594
|
+
permissions: ({ role, permission }: GuildPermissionsInput) => boolean;
|
|
595
|
+
levelCurve: ({ xp, baseMemberCap, maximumMemberCap }: GuildLevelInput) => {
|
|
596
|
+
level: number;
|
|
597
|
+
memberCap: number;
|
|
598
|
+
};
|
|
599
|
+
inactivityPolicy: (input: GuildInactivityInput) => string | null;
|
|
600
|
+
}>;
|
|
601
|
+
now: () => number;
|
|
602
|
+
}>;
|
|
603
|
+
|
|
604
|
+
declare const ROLES_TABLE = "_voltro_guild_roles";
|
|
605
|
+
|
|
606
|
+
export { }
|