@ascendkit/cli 0.3.12 → 0.3.13
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/dist/cli.js +11 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +4 -0
- package/dist/tools/auth.js +23 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -294,6 +294,11 @@ function printAuthSettingsSummary(data) {
|
|
|
294
294
|
if (data.sessionDuration) {
|
|
295
295
|
console.log(`Session: ${data.sessionDuration}`);
|
|
296
296
|
}
|
|
297
|
+
const allowedDomains = Array.isArray(data.allowedDomains) ? data.allowedDomains : [];
|
|
298
|
+
if (allowedDomains.length > 0)
|
|
299
|
+
console.log(`Allowed domains: ${allowedDomains.join(", ")}`);
|
|
300
|
+
if (data.blockPersonalDomains)
|
|
301
|
+
console.log("Block personal domains: on");
|
|
297
302
|
}
|
|
298
303
|
function printTemplateSummary(data, opts) {
|
|
299
304
|
console.log(`Template: ${data.name} (${data.id})`);
|
|
@@ -1094,6 +1099,12 @@ async function runAuth(client, action, rest) {
|
|
|
1094
1099
|
}
|
|
1095
1100
|
if (flags["session-duration"])
|
|
1096
1101
|
params.sessionDuration = flags["session-duration"];
|
|
1102
|
+
if (flags["allowed-domains"] !== undefined) {
|
|
1103
|
+
const raw = flags["allowed-domains"].trim();
|
|
1104
|
+
params.allowedDomains = raw === "" ? [] : raw.split(",").map((d) => d.trim()).filter(Boolean);
|
|
1105
|
+
}
|
|
1106
|
+
if (flags["block-personal-domains"] !== undefined)
|
|
1107
|
+
params.blockPersonalDomains = flags["block-personal-domains"] === "true";
|
|
1097
1108
|
printAuthSettingsSummary(await auth.updateSettings(client, params));
|
|
1098
1109
|
break;
|
|
1099
1110
|
}
|
package/dist/commands/auth.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface UpdateSettingsParams {
|
|
|
8
8
|
requireUsername?: boolean;
|
|
9
9
|
};
|
|
10
10
|
sessionDuration?: string;
|
|
11
|
+
allowedDomains?: string[];
|
|
12
|
+
blockPersonalDomains?: boolean;
|
|
11
13
|
}
|
|
12
14
|
export declare function getSettings(client: AscendKitClient): Promise<unknown>;
|
|
13
15
|
export declare function updateSettings(client: AscendKitClient, params: UpdateSettingsParams): Promise<unknown>;
|
package/dist/commands/auth.js
CHANGED
|
@@ -9,6 +9,10 @@ export async function updateSettings(client, params) {
|
|
|
9
9
|
body.features = params.features;
|
|
10
10
|
if (params.sessionDuration !== undefined)
|
|
11
11
|
body.sessionDuration = params.sessionDuration;
|
|
12
|
+
if (params.allowedDomains !== undefined)
|
|
13
|
+
body.allowedDomains = params.allowedDomains;
|
|
14
|
+
if (params.blockPersonalDomains !== undefined)
|
|
15
|
+
body.blockPersonalDomains = params.blockPersonalDomains;
|
|
12
16
|
return client.managedPut("/api/auth/settings", body);
|
|
13
17
|
}
|
|
14
18
|
export async function updateProviders(client, providers) {
|
package/dist/tools/auth.js
CHANGED
|
@@ -13,6 +13,11 @@ function formatAuthSettings(data) {
|
|
|
13
13
|
];
|
|
14
14
|
if (data.sessionDuration)
|
|
15
15
|
lines.push(`Session: ${data.sessionDuration}`);
|
|
16
|
+
const allowedDomains = Array.isArray(data.allowedDomains) ? data.allowedDomains : [];
|
|
17
|
+
if (allowedDomains.length > 0)
|
|
18
|
+
lines.push(`Allowed domains: ${allowedDomains.join(", ")}`);
|
|
19
|
+
if (data.blockPersonalDomains)
|
|
20
|
+
lines.push("Block personal domains: on");
|
|
16
21
|
return lines.join("\n");
|
|
17
22
|
}
|
|
18
23
|
export function registerAuthTools(server, client) {
|
|
@@ -42,6 +47,24 @@ export function registerAuthTools(server, client) {
|
|
|
42
47
|
const data = await auth.updateSettings(client, params);
|
|
43
48
|
return { content: [{ type: "text", text: formatAuthSettings(data) }] };
|
|
44
49
|
});
|
|
50
|
+
server.tool("auth_domain_restrictions", "Configure email domain restrictions for signups. Set an allowlist of specific domains, or block personal email providers (gmail, yahoo, etc.), or both. Allowlist takes precedence when both are set.", {
|
|
51
|
+
allowedDomains: z
|
|
52
|
+
.array(z.string())
|
|
53
|
+
.optional()
|
|
54
|
+
.describe('Allowed email domains for signup, e.g. ["company.com", "partner.org"]. Pass empty array to clear.'),
|
|
55
|
+
blockPersonalDomains: z
|
|
56
|
+
.boolean()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe("Block signups from common personal email providers (gmail, yahoo, hotmail, etc.)"),
|
|
59
|
+
}, async (params) => {
|
|
60
|
+
const body = {};
|
|
61
|
+
if (params.allowedDomains !== undefined)
|
|
62
|
+
body.allowedDomains = params.allowedDomains;
|
|
63
|
+
if (params.blockPersonalDomains !== undefined)
|
|
64
|
+
body.blockPersonalDomains = params.blockPersonalDomains;
|
|
65
|
+
const data = await client.managedPut("/api/auth/settings", body);
|
|
66
|
+
return { content: [{ type: "text", text: formatAuthSettings(data) }] };
|
|
67
|
+
});
|
|
45
68
|
server.tool("auth_provider_set", "Set which auth providers are enabled for the project. Credentials and magic-link are mutually exclusive. Social-only login (e.g. [\"google\"]) is valid. At least one provider required.", {
|
|
46
69
|
providers: z
|
|
47
70
|
.array(z.string())
|