@ascendkit/cli 0.2.0 → 0.3.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/dist/api/client.d.ts +2 -0
- package/dist/api/client.js +34 -8
- package/dist/cli.js +1047 -314
- package/dist/commands/auth.d.ts +4 -0
- package/dist/commands/auth.js +12 -0
- package/dist/commands/campaigns.d.ts +22 -0
- package/dist/commands/campaigns.js +25 -0
- package/dist/commands/content.js +4 -4
- package/dist/commands/email.d.ts +62 -6
- package/dist/commands/email.js +26 -17
- package/dist/commands/import.d.ts +75 -0
- package/dist/commands/import.js +97 -0
- package/dist/commands/journeys.d.ts +3 -0
- package/dist/commands/journeys.js +9 -6
- package/dist/commands/platform.d.ts +28 -0
- package/dist/commands/platform.js +219 -101
- package/dist/commands/surveys.js +5 -5
- package/dist/mcp.js +35 -3
- package/dist/tools/auth.js +66 -8
- package/dist/tools/campaigns.d.ts +3 -0
- package/dist/tools/campaigns.js +78 -0
- package/dist/tools/content.js +24 -12
- package/dist/tools/email.js +47 -17
- package/dist/tools/import.d.ts +3 -0
- package/dist/tools/import.js +116 -0
- package/dist/tools/journeys.js +25 -14
- package/dist/tools/platform.js +151 -6
- package/dist/tools/surveys.js +9 -9
- package/dist/utils/journey-format.d.ts +6 -0
- package/dist/utils/journey-format.js +6 -4
- package/dist/utils/survey-format.js +2 -2
- package/package.json +5 -5
package/dist/commands/auth.d.ts
CHANGED
|
@@ -13,5 +13,9 @@ export declare function getSettings(client: AscendKitClient): Promise<unknown>;
|
|
|
13
13
|
export declare function updateSettings(client: AscendKitClient, params: UpdateSettingsParams): Promise<unknown>;
|
|
14
14
|
export declare function updateProviders(client: AscendKitClient, providers: string[]): Promise<unknown>;
|
|
15
15
|
export declare function updateOAuthCredentials(client: AscendKitClient, provider: string, clientId: string, clientSecret: string, callbackUrl?: string): Promise<unknown>;
|
|
16
|
+
export declare function deleteOAuthCredentials(client: AscendKitClient, provider: string): Promise<unknown>;
|
|
16
17
|
export declare function getOAuthSetupUrl(portalUrl: string, provider: string, publicKey?: string): string;
|
|
17
18
|
export declare function listUsers(client: AscendKitClient): Promise<unknown>;
|
|
19
|
+
export declare function deleteUser(client: AscendKitClient, userId: string): Promise<unknown>;
|
|
20
|
+
export declare function bulkDeleteUsers(client: AscendKitClient, userIds: string[]): Promise<unknown>;
|
|
21
|
+
export declare function reactivateUser(client: AscendKitClient, userId: string): Promise<unknown>;
|
package/dist/commands/auth.js
CHANGED
|
@@ -20,6 +20,9 @@ export async function updateOAuthCredentials(client, provider, clientId, clientS
|
|
|
20
20
|
body.callbackUrl = callbackUrl;
|
|
21
21
|
return client.managedPut(`/api/auth/settings/oauth/${provider}`, body);
|
|
22
22
|
}
|
|
23
|
+
export async function deleteOAuthCredentials(client, provider) {
|
|
24
|
+
return client.managedDelete(`/api/auth/settings/oauth/${provider}`);
|
|
25
|
+
}
|
|
23
26
|
export function getOAuthSetupUrl(portalUrl, provider, publicKey) {
|
|
24
27
|
const base = `${portalUrl}/settings/oauth/${provider}`;
|
|
25
28
|
return publicKey ? `${base}?pk=${encodeURIComponent(publicKey)}` : base;
|
|
@@ -27,3 +30,12 @@ export function getOAuthSetupUrl(portalUrl, provider, publicKey) {
|
|
|
27
30
|
export async function listUsers(client) {
|
|
28
31
|
return client.managedRequest("GET", "/api/users");
|
|
29
32
|
}
|
|
33
|
+
export async function deleteUser(client, userId) {
|
|
34
|
+
return client.managedDelete(`/api/users/${userId}`);
|
|
35
|
+
}
|
|
36
|
+
export async function bulkDeleteUsers(client, userIds) {
|
|
37
|
+
return client.managedPost("/api/users/bulk-deactivate", { userIds });
|
|
38
|
+
}
|
|
39
|
+
export async function reactivateUser(client, userId) {
|
|
40
|
+
return client.managedPost(`/api/users/${userId}/reactivate`);
|
|
41
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AscendKitClient } from "../api/client.js";
|
|
2
|
+
export interface CreateCampaignParams {
|
|
3
|
+
name: string;
|
|
4
|
+
templateId: string;
|
|
5
|
+
audienceFilter: Record<string, unknown>;
|
|
6
|
+
scheduledAt?: string;
|
|
7
|
+
fromIdentityEmail?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UpdateCampaignParams {
|
|
10
|
+
name?: string;
|
|
11
|
+
templateId?: string;
|
|
12
|
+
audienceFilter?: Record<string, unknown>;
|
|
13
|
+
scheduledAt?: string;
|
|
14
|
+
fromIdentityEmail?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function createCampaign(client: AscendKitClient, params: CreateCampaignParams): Promise<unknown>;
|
|
17
|
+
export declare function listCampaigns(client: AscendKitClient, status?: string, limit?: number): Promise<unknown>;
|
|
18
|
+
export declare function getCampaign(client: AscendKitClient, campaignId: string): Promise<unknown>;
|
|
19
|
+
export declare function updateCampaign(client: AscendKitClient, campaignId: string, params: UpdateCampaignParams): Promise<unknown>;
|
|
20
|
+
export declare function deleteCampaign(client: AscendKitClient, campaignId: string): Promise<unknown>;
|
|
21
|
+
export declare function previewAudience(client: AscendKitClient, audienceFilter: Record<string, unknown>): Promise<unknown>;
|
|
22
|
+
export declare function getCampaignAnalytics(client: AscendKitClient, campaignId: string): Promise<unknown>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export async function createCampaign(client, params) {
|
|
2
|
+
return client.managedPost("/api/v1/campaigns", params);
|
|
3
|
+
}
|
|
4
|
+
export async function listCampaigns(client, status, limit = 200) {
|
|
5
|
+
const params = new URLSearchParams();
|
|
6
|
+
if (status)
|
|
7
|
+
params.set("status", status);
|
|
8
|
+
params.set("limit", String(limit));
|
|
9
|
+
return client.managedGet(`/api/v1/campaigns?${params.toString()}`);
|
|
10
|
+
}
|
|
11
|
+
export async function getCampaign(client, campaignId) {
|
|
12
|
+
return client.managedGet(`/api/v1/campaigns/${campaignId}`);
|
|
13
|
+
}
|
|
14
|
+
export async function updateCampaign(client, campaignId, params) {
|
|
15
|
+
return client.managedPut(`/api/v1/campaigns/${campaignId}`, params);
|
|
16
|
+
}
|
|
17
|
+
export async function deleteCampaign(client, campaignId) {
|
|
18
|
+
return client.managedDelete(`/api/v1/campaigns/${campaignId}`);
|
|
19
|
+
}
|
|
20
|
+
export async function previewAudience(client, audienceFilter) {
|
|
21
|
+
return client.managedPost("/api/v1/campaigns/preview", { audienceFilter });
|
|
22
|
+
}
|
|
23
|
+
export async function getCampaignAnalytics(client, campaignId) {
|
|
24
|
+
return client.managedGet(`/api/v1/campaigns/${campaignId}/analytics`);
|
|
25
|
+
}
|
package/dist/commands/content.js
CHANGED
|
@@ -9,10 +9,10 @@ export async function listTemplates(client, params) {
|
|
|
9
9
|
searchParams.set("isSystem", String(params.isSystem));
|
|
10
10
|
const qs = searchParams.toString();
|
|
11
11
|
const path = qs ? `/api/content/templates?${qs}` : "/api/content/templates";
|
|
12
|
-
return client.
|
|
12
|
+
return client.managedGet(path);
|
|
13
13
|
}
|
|
14
14
|
export async function getTemplate(client, templateId) {
|
|
15
|
-
return client.
|
|
15
|
+
return client.managedGet(`/api/content/templates/${templateId}`);
|
|
16
16
|
}
|
|
17
17
|
export async function updateTemplate(client, templateId, params) {
|
|
18
18
|
return client.managedPut(`/api/content/templates/${templateId}`, params);
|
|
@@ -21,8 +21,8 @@ export async function deleteTemplate(client, templateId) {
|
|
|
21
21
|
return client.managedDelete(`/api/content/templates/${templateId}`);
|
|
22
22
|
}
|
|
23
23
|
export async function listVersions(client, templateId) {
|
|
24
|
-
return client.
|
|
24
|
+
return client.managedGet(`/api/content/templates/${templateId}/versions`);
|
|
25
25
|
}
|
|
26
26
|
export async function getVersion(client, templateId, versionNumber) {
|
|
27
|
-
return client.
|
|
27
|
+
return client.managedGet(`/api/content/templates/${templateId}/versions/${versionNumber}`);
|
|
28
28
|
}
|
package/dist/commands/email.d.ts
CHANGED
|
@@ -23,15 +23,71 @@ export interface EmailSettings {
|
|
|
23
23
|
value: string;
|
|
24
24
|
}>;
|
|
25
25
|
dnsProvider?: DnsProviderInfo;
|
|
26
|
+
identities?: EmailIdentity[];
|
|
27
|
+
}
|
|
28
|
+
export interface EmailIdentity {
|
|
29
|
+
email: string;
|
|
30
|
+
displayName: string;
|
|
31
|
+
verificationStatus: string;
|
|
32
|
+
isDefault: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface EmailIdentitiesResponse {
|
|
35
|
+
identities: EmailIdentity[];
|
|
36
|
+
active?: {
|
|
37
|
+
fromEmail?: string;
|
|
38
|
+
fromName?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface DnsCheckRecord {
|
|
42
|
+
name: string;
|
|
43
|
+
type: string;
|
|
44
|
+
expectedValue: string;
|
|
45
|
+
found: boolean;
|
|
46
|
+
observedValue: string | null;
|
|
47
|
+
mismatch: boolean;
|
|
48
|
+
error: string | null;
|
|
49
|
+
checkedAt: string;
|
|
50
|
+
}
|
|
51
|
+
export interface DnsCheckResponse {
|
|
52
|
+
summary: {
|
|
53
|
+
total: number;
|
|
54
|
+
found: number;
|
|
55
|
+
notFound: number;
|
|
56
|
+
mismatch: number;
|
|
57
|
+
errored: number;
|
|
58
|
+
};
|
|
59
|
+
records: DnsCheckRecord[];
|
|
26
60
|
}
|
|
27
61
|
export declare function getSettings(client: AscendKitClient): Promise<EmailSettings>;
|
|
28
62
|
export declare function updateSettings(client: AscendKitClient, params: UpdateEmailSettingsParams): Promise<EmailSettings>;
|
|
29
63
|
export declare function setupDomain(client: AscendKitClient, domain: string): Promise<EmailSettings>;
|
|
30
|
-
export declare function checkDomainStatus(client: AscendKitClient): Promise<
|
|
64
|
+
export declare function checkDomainStatus(client: AscendKitClient): Promise<{
|
|
65
|
+
domain?: string;
|
|
66
|
+
status?: string;
|
|
67
|
+
dnsRecords?: Array<{
|
|
68
|
+
type: string;
|
|
69
|
+
name: string;
|
|
70
|
+
value: string;
|
|
71
|
+
}>;
|
|
72
|
+
dnsProvider?: DnsProviderInfo;
|
|
73
|
+
}>;
|
|
74
|
+
export declare function checkDnsRecords(client: AscendKitClient): Promise<DnsCheckResponse>;
|
|
31
75
|
export declare function getDnsProvider(client: AscendKitClient, domain?: string): Promise<DnsProviderInfo>;
|
|
32
76
|
export declare function removeDomain(client: AscendKitClient): Promise<EmailSettings>;
|
|
33
|
-
export declare function
|
|
34
|
-
export declare function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}): Promise<
|
|
77
|
+
export declare function listIdentities(client: AscendKitClient): Promise<EmailIdentitiesResponse>;
|
|
78
|
+
export declare function createIdentity(client: AscendKitClient, identity: {
|
|
79
|
+
email: string;
|
|
80
|
+
displayName?: string;
|
|
81
|
+
}): Promise<EmailIdentitiesResponse>;
|
|
82
|
+
export declare function resendIdentityVerification(client: AscendKitClient, email: string): Promise<EmailIdentitiesResponse>;
|
|
83
|
+
export declare function setDefaultIdentity(client: AscendKitClient, identity: {
|
|
84
|
+
email: string;
|
|
85
|
+
displayName?: string;
|
|
86
|
+
}): Promise<EmailIdentitiesResponse>;
|
|
87
|
+
export declare function removeIdentity(client: AscendKitClient, email: string): Promise<EmailIdentitiesResponse>;
|
|
88
|
+
export declare function sendTestEmail(client: AscendKitClient, request: {
|
|
89
|
+
to: string;
|
|
90
|
+
fromIdentityEmail?: string;
|
|
91
|
+
}): Promise<{
|
|
92
|
+
message: string;
|
|
93
|
+
}>;
|
package/dist/commands/email.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function getSettings(client) {
|
|
2
|
-
return client.
|
|
2
|
+
return client.managedGet("/api/email/settings");
|
|
3
3
|
}
|
|
4
4
|
export async function updateSettings(client, params) {
|
|
5
5
|
const body = {};
|
|
@@ -13,27 +13,36 @@ export async function setupDomain(client, domain) {
|
|
|
13
13
|
return client.managedPost("/api/email/settings/setup-domain", { domain });
|
|
14
14
|
}
|
|
15
15
|
export async function checkDomainStatus(client) {
|
|
16
|
-
return client.
|
|
16
|
+
return client.managedGet("/api/email/settings/domain-status");
|
|
17
|
+
}
|
|
18
|
+
export async function checkDnsRecords(client) {
|
|
19
|
+
return client.managedGet("/api/email/settings/check-dns-records");
|
|
17
20
|
}
|
|
18
21
|
export async function getDnsProvider(client, domain) {
|
|
19
22
|
const suffix = domain ? `?domain=${encodeURIComponent(domain)}` : "";
|
|
20
|
-
return client.
|
|
23
|
+
return client.managedGet(`/api/email/settings/dns-provider${suffix}`);
|
|
21
24
|
}
|
|
22
25
|
export async function removeDomain(client) {
|
|
23
26
|
return client.managedDelete("/api/email/settings/domain");
|
|
24
27
|
}
|
|
25
|
-
export async function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return
|
|
28
|
+
export async function listIdentities(client) {
|
|
29
|
+
return client.managedGet("/api/email/settings/identities");
|
|
30
|
+
}
|
|
31
|
+
export async function createIdentity(client, identity) {
|
|
32
|
+
return client.managedPost("/api/email/settings/identities", {
|
|
33
|
+
email: identity.email,
|
|
34
|
+
displayName: identity.displayName ?? "",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export async function resendIdentityVerification(client, email) {
|
|
38
|
+
return client.managedPost(`/api/email/settings/identities/${encodeURIComponent(email)}/resend`, {});
|
|
39
|
+
}
|
|
40
|
+
export async function setDefaultIdentity(client, identity) {
|
|
41
|
+
return client.managedPost(`/api/email/settings/identities/${encodeURIComponent(identity.email)}/default`, { displayName: identity.displayName ?? "" });
|
|
42
|
+
}
|
|
43
|
+
export async function removeIdentity(client, email) {
|
|
44
|
+
return client.managedDelete(`/api/email/settings/identities/${encodeURIComponent(email)}`);
|
|
45
|
+
}
|
|
46
|
+
export async function sendTestEmail(client, request) {
|
|
47
|
+
return client.managedPost("/api/email/settings/send-test", request);
|
|
39
48
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { AscendKitClient } from "../api/client.js";
|
|
2
|
+
export interface ImportUserRecord {
|
|
3
|
+
sourceId: string;
|
|
4
|
+
email: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
emailVerified?: boolean;
|
|
8
|
+
hadPassword?: boolean;
|
|
9
|
+
oauthProviders?: Array<{
|
|
10
|
+
providerId: string;
|
|
11
|
+
accountId: string;
|
|
12
|
+
}>;
|
|
13
|
+
metadata?: Record<string, unknown>;
|
|
14
|
+
tags?: string[];
|
|
15
|
+
createdAt?: string;
|
|
16
|
+
lastLoginAt?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ImportUsersPayload {
|
|
19
|
+
source: string;
|
|
20
|
+
users: ImportUserRecord[];
|
|
21
|
+
authSettings?: {
|
|
22
|
+
enabledProviders?: string[];
|
|
23
|
+
oauthClientIds?: Record<string, string>;
|
|
24
|
+
};
|
|
25
|
+
dryRun?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface ImportResult {
|
|
28
|
+
imported: number;
|
|
29
|
+
duplicates: Array<{
|
|
30
|
+
email: string;
|
|
31
|
+
sourceId: string;
|
|
32
|
+
}>;
|
|
33
|
+
errors: Array<{
|
|
34
|
+
email: string;
|
|
35
|
+
sourceId: string;
|
|
36
|
+
reason: string;
|
|
37
|
+
}>;
|
|
38
|
+
warnings: string[];
|
|
39
|
+
}
|
|
40
|
+
export declare function importUsers(client: AscendKitClient, payload: ImportUsersPayload): Promise<ImportResult>;
|
|
41
|
+
export declare function instantiateMigrationJourney(client: AscendKitClient, fromIdentityEmail?: string): Promise<unknown>;
|
|
42
|
+
interface ClerkUser {
|
|
43
|
+
id: string;
|
|
44
|
+
email_addresses?: Array<{
|
|
45
|
+
id: string;
|
|
46
|
+
email_address: string;
|
|
47
|
+
verification?: {
|
|
48
|
+
status: string;
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
primary_email_address_id?: string;
|
|
52
|
+
first_name?: string;
|
|
53
|
+
last_name?: string;
|
|
54
|
+
image_url?: string;
|
|
55
|
+
password_enabled?: boolean;
|
|
56
|
+
external_accounts?: Array<{
|
|
57
|
+
id: string;
|
|
58
|
+
provider: string;
|
|
59
|
+
provider_user_id: string;
|
|
60
|
+
}>;
|
|
61
|
+
public_metadata?: Record<string, unknown>;
|
|
62
|
+
private_metadata?: Record<string, unknown>;
|
|
63
|
+
created_at?: number;
|
|
64
|
+
last_sign_in_at?: number;
|
|
65
|
+
last_active_at?: number;
|
|
66
|
+
}
|
|
67
|
+
export declare function transformClerkUser(clerk: ClerkUser): ImportUserRecord;
|
|
68
|
+
export declare function fetchClerkUsers(apiKey: string, instanceUrl?: string): Promise<ClerkUser[]>;
|
|
69
|
+
export interface ClerkDerivedSettings {
|
|
70
|
+
hasCredentials: boolean;
|
|
71
|
+
providers: string[];
|
|
72
|
+
}
|
|
73
|
+
export declare function deriveSettingsFromUsers(users: ImportUserRecord[]): ClerkDerivedSettings;
|
|
74
|
+
export declare function parseClerkExport(filePath: string): ClerkUser[];
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
export async function importUsers(client, payload) {
|
|
3
|
+
return client.managedPost("/api/import/users", payload);
|
|
4
|
+
}
|
|
5
|
+
export async function instantiateMigrationJourney(client, fromIdentityEmail) {
|
|
6
|
+
return client.managedPost("/api/import/instantiate-migration-journey", {
|
|
7
|
+
fromIdentityEmail: fromIdentityEmail ?? null,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
function clerkProviderToAscendKit(provider) {
|
|
11
|
+
const map = {
|
|
12
|
+
oauth_google: "google",
|
|
13
|
+
oauth_github: "github",
|
|
14
|
+
oauth_linkedin: "linkedin",
|
|
15
|
+
oauth_linkedin_oidc: "linkedin",
|
|
16
|
+
};
|
|
17
|
+
return map[provider] ?? provider.replace(/^oauth_/, "");
|
|
18
|
+
}
|
|
19
|
+
export function transformClerkUser(clerk) {
|
|
20
|
+
const primaryEmail = clerk.email_addresses?.find((e) => e.id === clerk.primary_email_address_id);
|
|
21
|
+
const email = primaryEmail?.email_address ?? clerk.email_addresses?.[0]?.email_address ?? "";
|
|
22
|
+
const emailVerified = primaryEmail?.verification?.status === "verified";
|
|
23
|
+
const name = [clerk.first_name, clerk.last_name].filter(Boolean).join(" ") || undefined;
|
|
24
|
+
const oauthProviders = (clerk.external_accounts ?? []).map((ext) => ({
|
|
25
|
+
providerId: clerkProviderToAscendKit(ext.provider),
|
|
26
|
+
accountId: ext.provider_user_id,
|
|
27
|
+
}));
|
|
28
|
+
// Clerk timestamps are Unix ms
|
|
29
|
+
const createdAt = clerk.created_at
|
|
30
|
+
? new Date(clerk.created_at).toISOString()
|
|
31
|
+
: undefined;
|
|
32
|
+
const lastLoginAt = clerk.last_sign_in_at
|
|
33
|
+
? new Date(clerk.last_sign_in_at).toISOString()
|
|
34
|
+
: undefined;
|
|
35
|
+
return {
|
|
36
|
+
sourceId: clerk.id,
|
|
37
|
+
email,
|
|
38
|
+
name,
|
|
39
|
+
image: clerk.image_url || undefined,
|
|
40
|
+
emailVerified,
|
|
41
|
+
hadPassword: clerk.password_enabled ?? false,
|
|
42
|
+
oauthProviders,
|
|
43
|
+
metadata: clerk.public_metadata ?? undefined,
|
|
44
|
+
createdAt,
|
|
45
|
+
lastLoginAt,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export async function fetchClerkUsers(apiKey, instanceUrl) {
|
|
49
|
+
const baseUrl = instanceUrl ?? "https://api.clerk.com";
|
|
50
|
+
const allUsers = [];
|
|
51
|
+
let offset = 0;
|
|
52
|
+
const limit = 100;
|
|
53
|
+
while (true) {
|
|
54
|
+
const url = `${baseUrl}/v1/users?limit=${limit}&offset=${offset}`;
|
|
55
|
+
const response = await fetch(url, {
|
|
56
|
+
headers: {
|
|
57
|
+
Authorization: `Bearer ${apiKey}`,
|
|
58
|
+
"Content-Type": "application/json",
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
if (!response.ok) {
|
|
62
|
+
const text = await response.text();
|
|
63
|
+
throw new Error(`Clerk API error ${response.status}: ${text}`);
|
|
64
|
+
}
|
|
65
|
+
const users = (await response.json());
|
|
66
|
+
if (users.length === 0)
|
|
67
|
+
break;
|
|
68
|
+
allUsers.push(...users);
|
|
69
|
+
offset += users.length;
|
|
70
|
+
if (users.length < limit)
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
return allUsers;
|
|
74
|
+
}
|
|
75
|
+
export function deriveSettingsFromUsers(users) {
|
|
76
|
+
let hasCredentials = false;
|
|
77
|
+
const providers = new Set();
|
|
78
|
+
for (const u of users) {
|
|
79
|
+
if (u.hadPassword)
|
|
80
|
+
hasCredentials = true;
|
|
81
|
+
for (const p of u.oauthProviders ?? []) {
|
|
82
|
+
providers.add(p.providerId);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { hasCredentials, providers: [...providers].sort() };
|
|
86
|
+
}
|
|
87
|
+
export function parseClerkExport(filePath) {
|
|
88
|
+
const raw = readFileSync(filePath, "utf-8");
|
|
89
|
+
const parsed = JSON.parse(raw);
|
|
90
|
+
if (Array.isArray(parsed)) {
|
|
91
|
+
return parsed;
|
|
92
|
+
}
|
|
93
|
+
if (parsed.users && Array.isArray(parsed.users)) {
|
|
94
|
+
return parsed.users;
|
|
95
|
+
}
|
|
96
|
+
throw new Error("Unrecognized Clerk export format. Expected a JSON array of users or an object with a 'users' key.");
|
|
97
|
+
}
|
|
@@ -30,6 +30,7 @@ export declare function updateJourney(client: AscendKitClient, journeyId: string
|
|
|
30
30
|
export declare function deleteJourney(client: AscendKitClient, journeyId: string): Promise<unknown>;
|
|
31
31
|
export declare function activateJourney(client: AscendKitClient, journeyId: string): Promise<unknown>;
|
|
32
32
|
export declare function pauseJourney(client: AscendKitClient, journeyId: string): Promise<unknown>;
|
|
33
|
+
export declare function resumeJourney(client: AscendKitClient, journeyId: string): Promise<unknown>;
|
|
33
34
|
export declare function archiveJourney(client: AscendKitClient, journeyId: string): Promise<unknown>;
|
|
34
35
|
export declare function getJourneyAnalytics(client: AscendKitClient, journeyId: string): Promise<unknown>;
|
|
35
36
|
export declare function getJourneyVisualization(client: AscendKitClient, journeyId: string): Promise<unknown>;
|
|
@@ -41,6 +42,7 @@ export interface AddNodeParams {
|
|
|
41
42
|
surveySlug?: string;
|
|
42
43
|
tagName?: string;
|
|
43
44
|
stageName?: string;
|
|
45
|
+
fromIdentityEmail?: string;
|
|
44
46
|
};
|
|
45
47
|
terminal?: boolean;
|
|
46
48
|
}
|
|
@@ -51,6 +53,7 @@ export interface EditNodeParams {
|
|
|
51
53
|
surveySlug?: string;
|
|
52
54
|
tagName?: string;
|
|
53
55
|
stageName?: string;
|
|
56
|
+
fromIdentityEmail?: string;
|
|
54
57
|
};
|
|
55
58
|
terminal?: boolean;
|
|
56
59
|
}
|
|
@@ -11,10 +11,10 @@ export async function listJourneys(client, opts) {
|
|
|
11
11
|
if (opts?.offset != null)
|
|
12
12
|
qs.set("offset", String(opts.offset));
|
|
13
13
|
const query = qs.toString();
|
|
14
|
-
return client.
|
|
14
|
+
return client.managedGet(`${BASE}${query ? `?${query}` : ""}`);
|
|
15
15
|
}
|
|
16
16
|
export async function getJourney(client, journeyId) {
|
|
17
|
-
return client.
|
|
17
|
+
return client.managedGet(`${BASE}/${journeyId}`);
|
|
18
18
|
}
|
|
19
19
|
export async function updateJourney(client, journeyId, params) {
|
|
20
20
|
return client.managedRequest("PATCH", `${BASE}/${journeyId}`, params);
|
|
@@ -28,17 +28,20 @@ export async function activateJourney(client, journeyId) {
|
|
|
28
28
|
export async function pauseJourney(client, journeyId) {
|
|
29
29
|
return client.managedPost(`${BASE}/${journeyId}/pause`);
|
|
30
30
|
}
|
|
31
|
+
export async function resumeJourney(client, journeyId) {
|
|
32
|
+
return client.managedPost(`${BASE}/${journeyId}/resume`);
|
|
33
|
+
}
|
|
31
34
|
export async function archiveJourney(client, journeyId) {
|
|
32
35
|
return client.managedPost(`${BASE}/${journeyId}/archive`);
|
|
33
36
|
}
|
|
34
37
|
export async function getJourneyAnalytics(client, journeyId) {
|
|
35
|
-
return client.
|
|
38
|
+
return client.managedGet(`${BASE}/${journeyId}/analytics`);
|
|
36
39
|
}
|
|
37
40
|
export async function getJourneyVisualization(client, journeyId) {
|
|
38
|
-
return client.
|
|
41
|
+
return client.managedGet(`${BASE}/${journeyId}/visualization`);
|
|
39
42
|
}
|
|
40
43
|
export async function listNodes(client, journeyId) {
|
|
41
|
-
return client.
|
|
44
|
+
return client.managedGet(`${BASE}/${journeyId}/nodes`);
|
|
42
45
|
}
|
|
43
46
|
export async function addNode(client, journeyId, params) {
|
|
44
47
|
return client.managedPost(`${BASE}/${journeyId}/nodes`, params);
|
|
@@ -56,7 +59,7 @@ export async function listTransitions(client, journeyId, opts) {
|
|
|
56
59
|
if (opts?.to_node)
|
|
57
60
|
qs.set("to_node", opts.to_node);
|
|
58
61
|
const query = qs.toString();
|
|
59
|
-
return client.
|
|
62
|
+
return client.managedGet(`${BASE}/${journeyId}/transitions${query ? `?${query}` : ""}`);
|
|
60
63
|
}
|
|
61
64
|
export async function addTransition(client, journeyId, params) {
|
|
62
65
|
return client.managedPost(`${BASE}/${journeyId}/transitions`, params);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare function init(apiUrl?: string, portalUrl?: string): Promise<void>;
|
|
2
2
|
export declare function logout(): void;
|
|
3
3
|
export declare function listProjects(): Promise<unknown>;
|
|
4
|
+
export declare function showProject(projectId: string): Promise<Record<string, unknown>>;
|
|
4
5
|
export declare function createProject(name: string, description?: string, enabledServices?: string[]): Promise<unknown>;
|
|
5
6
|
export declare function listEnvironments(projectId: string): Promise<unknown>;
|
|
6
7
|
export declare function useEnvironment(tier: string, projectId: string): Promise<void>;
|
|
@@ -30,6 +31,21 @@ export declare function mcpLogin(client: AscendKitClient, params: McpLoginParams
|
|
|
30
31
|
};
|
|
31
32
|
accountId: string;
|
|
32
33
|
}>;
|
|
34
|
+
export declare function mcpSetEnvironmentByPublicKey(client: AscendKitClient, publicKey: string): Promise<{
|
|
35
|
+
updatedFiles: string[];
|
|
36
|
+
environment: {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
tier: string;
|
|
40
|
+
publicKey: string;
|
|
41
|
+
secretKey?: string | null;
|
|
42
|
+
};
|
|
43
|
+
project: {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
};
|
|
47
|
+
role: string;
|
|
48
|
+
}>;
|
|
33
49
|
export declare function mcpListProjects(client: AscendKitClient): Promise<unknown>;
|
|
34
50
|
export declare function mcpCreateProject(client: AscendKitClient, params: McpCreateProjectParams): Promise<unknown>;
|
|
35
51
|
export declare function mcpListEnvironments(client: AscendKitClient, projectId: string): Promise<unknown>;
|
|
@@ -47,3 +63,15 @@ export declare function mcpPromoteEnvironment(client: AscendKitClient, params: {
|
|
|
47
63
|
environmentId: string;
|
|
48
64
|
targetTier: string;
|
|
49
65
|
}): Promise<unknown>;
|
|
66
|
+
export interface McpUpdateEnvironmentVariablesParams {
|
|
67
|
+
projectId?: string;
|
|
68
|
+
envId?: string;
|
|
69
|
+
variables: Record<string, string>;
|
|
70
|
+
}
|
|
71
|
+
export declare function mcpGetEnvironment(client: AscendKitClient, params: {
|
|
72
|
+
projectId?: string;
|
|
73
|
+
envId?: string;
|
|
74
|
+
}): Promise<Record<string, unknown>>;
|
|
75
|
+
export declare function mcpUpdateEnvironmentVariables(client: AscendKitClient, params: McpUpdateEnvironmentVariablesParams): Promise<unknown>;
|
|
76
|
+
export declare function getEnvironment(projectId: string, envId: string): Promise<Record<string, unknown>>;
|
|
77
|
+
export declare function updateEnvironmentVariables(projectId: string, envId: string, variables: Record<string, string>): Promise<unknown>;
|