@helyx/module-account-gate 1.0.1 → 1.0.3

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Add the hosted-only Stage 11 Verification foundation: bounded signed challenge
8
+ contracts, restricted persistence and privacy traversal, shard-safe bot
9
+ delivery, delegated investigation permissions, verifier configuration and
10
+ health, and explicit exclusion from every self-hosted composition.
11
+ - Updated dependencies
12
+ - @helyx/module-manifest@0.6.0
13
+ - @helyx/sdk@0.5.0
14
+
15
+ ## 1.0.2
16
+
17
+ ### Patch Changes
18
+
19
+ - Publish Access Control without an orphaned compiled resource and embed the corrected Live catalogue in generated self-host projects.
20
+
3
21
  ## 1.0.1
4
22
 
5
23
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2686,7 +2686,7 @@ export async function validateAccountGateSetup(services, guildId, configuration,
2686
2686
  errors.push("The managed Access Control panel message is missing. Repost it before processing joins.");
2687
2687
  }
2688
2688
  if (verificationEnabled)
2689
- errors.push("Cloud Verification already owns this server's entry-role workflow. Disable it before enabling Access Control.");
2689
+ errors.push("Helyx Verification already owns this server's entry-role workflow. Disable it before enabling Access Control.");
2690
2690
  if (!gateChannel.viewable || !gateChannel.sendMessages)
2691
2691
  errors.push("Helyx cannot view and send messages in the gate channel.");
2692
2692
  if (!gateAudience.everyoneCanView &&
package/manifest.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "releaseStatus": "live",
4
4
  "id": "helyx.account-gate",
5
5
  "name": "Access Control",
6
- "version": "1.0.1",
6
+ "version": "1.0.3",
7
7
  "description": "Require new members to complete configurable Discord interaction checks before gaining access.",
8
8
  "entry": "./dist/index.js",
9
9
  "framework": "^0.1.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helyx/module-account-gate",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Require configurable Discord interaction checks before new members gain access.",
5
5
  "keywords": [
6
6
  "helyx",
@@ -48,7 +48,7 @@
48
48
  "build": "tsc -b"
49
49
  },
50
50
  "dependencies": {
51
- "@helyx/module-manifest": "0.5.0",
52
- "@helyx/sdk": "0.4.0"
51
+ "@helyx/module-manifest": "0.6.0",
52
+ "@helyx/sdk": "0.5.0"
53
53
  }
54
54
  }
@@ -1,4 +0,0 @@
1
- import type { ModuleManagedResource, ModuleRecordService } from "@helyx/sdk";
2
- export declare const preGatePublicChannelResource: ModuleManagedResource;
3
- export declare function loadPreGatePublicChannelIds(records: ModuleRecordService, guildId: string): Promise<readonly string[]>;
4
- //# sourceMappingURL=public-channel-resource.d.ts.map
@@ -1,135 +0,0 @@
1
- import { DashboardActionValidationError, HELYX_SERVICE_NAMES, } from "@helyx/sdk";
2
- import { ACCOUNT_GATE_IDENTITY } from "./contracts.js";
3
- import { managedResourceSummary } from "./managed-resource-summary.js";
4
- import { accountGateRecords } from "./records.js";
5
- const SNOWFLAKE = /^\d{17,20}$/u;
6
- export const preGatePublicChannelResource = {
7
- id: "pre-gate-public-channels",
8
- availableWhileDisabled: true,
9
- async list(context, input) {
10
- const page = await recordService(context).findMany({
11
- moduleId: ACCOUNT_GATE_IDENTITY.moduleId,
12
- collection: "public_channels",
13
- select: accountGateRecords.public_channels.readableFields,
14
- where: { guild_id: context.guildId },
15
- orderBy: [
16
- { field: "guild_id", direction: "asc" },
17
- { field: "channel_id", direction: "asc" },
18
- ],
19
- limit: Math.min(100, input.limit),
20
- });
21
- return {
22
- items: page.records.map((row) => managedResourceSummary(channelDetail(row))),
23
- };
24
- },
25
- async read(context, resourceId) {
26
- const row = await recordService(context).findOne({
27
- moduleId: ACCOUNT_GATE_IDENTITY.moduleId,
28
- collection: "public_channels",
29
- select: accountGateRecords.public_channels.readableFields,
30
- where: { guild_id: context.guildId, channel_id: resourceId },
31
- });
32
- return row ? channelDetail(row) : null;
33
- },
34
- preview(_context, value) {
35
- const channelId = channelValue(value);
36
- return Promise.resolve({
37
- ephemeral: true,
38
- embed: {
39
- title: "Pre-gate public channel",
40
- description: `<#${channelId}> will be allowed to remain visible before members complete Account Gate.`,
41
- color: 0x7c3aed,
42
- },
43
- });
44
- },
45
- async create(context, value) {
46
- const channelId = channelValue(value);
47
- const channel = await context.services
48
- .get(HELYX_SERVICE_NAMES.discordResources)
49
- .inspectChannel({ guildId: context.guildId, channelId });
50
- if (!channel.exists ||
51
- !channel.guildMatches ||
52
- !["guild_text", "guild_announcement"].includes(channel.type))
53
- throw new DashboardActionValidationError("Choose a text or announcement channel from this Discord server.");
54
- const createdAt = new Date();
55
- const result = await recordService(context).appendUnique({
56
- moduleId: ACCOUNT_GATE_IDENTITY.moduleId,
57
- collection: "public_channels",
58
- uniqueBy: ["guild_id", "channel_id"],
59
- values: {
60
- guild_id: context.guildId,
61
- channel_id: channelId,
62
- created_at: createdAt,
63
- },
64
- });
65
- if (!result.created)
66
- throw new DashboardActionValidationError("That channel is already in the pre-gate public allowlist.");
67
- return detail(channelId, createdAt);
68
- },
69
- update() {
70
- return Promise.reject(new DashboardActionValidationError("Remove this channel and add another channel instead."));
71
- },
72
- async delete(context, input) {
73
- const result = await recordService(context).deleteMany({
74
- moduleId: ACCOUNT_GATE_IDENTITY.moduleId,
75
- collection: "public_channels",
76
- where: {
77
- guild_id: context.guildId,
78
- channel_id: input.resourceId,
79
- },
80
- limit: 1,
81
- });
82
- return { deleted: result.deleted === 1 };
83
- },
84
- executeAction() {
85
- return Promise.reject(new DashboardActionValidationError("Pre-gate public channel actions are not supported."));
86
- },
87
- };
88
- export async function loadPreGatePublicChannelIds(records, guildId) {
89
- const page = await records.findMany({
90
- moduleId: ACCOUNT_GATE_IDENTITY.moduleId,
91
- collection: "public_channels",
92
- select: accountGateRecords.public_channels.readableFields,
93
- where: { guild_id: guildId },
94
- orderBy: [
95
- { field: "guild_id", direction: "asc" },
96
- { field: "channel_id", direction: "asc" },
97
- ],
98
- limit: 100,
99
- });
100
- return page.records.map((row) => stringValue(row.channel_id));
101
- }
102
- function channelDetail(row) {
103
- return detail(stringValue(row.channel_id), dateValue(row.created_at));
104
- }
105
- function detail(channelId, createdAt) {
106
- return {
107
- id: channelId,
108
- revision: 1,
109
- status: "allowed",
110
- title: `Channel ${channelId}`,
111
- description: "Intentionally visible before Account Gate completion.",
112
- attributes: { channelId },
113
- updatedAt: createdAt.toISOString(),
114
- value: { channelId },
115
- };
116
- }
117
- function channelValue(value) {
118
- if (typeof value.channelId !== "string" || !SNOWFLAKE.test(value.channelId))
119
- throw new DashboardActionValidationError("Choose a valid Discord text or announcement channel.");
120
- return value.channelId;
121
- }
122
- function recordService(context) {
123
- return context.services.get(HELYX_SERVICE_NAMES.records);
124
- }
125
- function stringValue(value) {
126
- if (typeof value !== "string")
127
- throw new Error("Pre-gate channel record is invalid");
128
- return value;
129
- }
130
- function dateValue(value) {
131
- if (!(value instanceof Date))
132
- throw new Error("Pre-gate channel record is invalid");
133
- return value;
134
- }
135
- //# sourceMappingURL=public-channel-resource.js.map