@theholocron/clerk-client 1.31.0 → 1.32.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/package.json +5 -5
- package/dist/index.d.mts +0 -183
- package/dist/index.mjs +0 -81
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/clerk-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "A TypeScript client for the Clerk Backend API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"clerk",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@theholocron/observability": "^0.3.0",
|
|
36
|
-
"@theholocron/http-client": "^1.
|
|
36
|
+
"@theholocron/http-client": "^1.32.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
39
|
+
"@theholocron/cli": "5.0.0-alpha.79",
|
|
40
40
|
"@theholocron/eslint-config": "^8.4.3",
|
|
41
41
|
"@theholocron/tsconfig": "^8.2.0",
|
|
42
|
-
"@theholocron/tsdown-config": "^8.2
|
|
42
|
+
"@theholocron/tsdown-config": "^8.5.2",
|
|
43
43
|
"@theholocron/vitest-config": "^8.2.0",
|
|
44
44
|
"@types/node": "^26.4.1",
|
|
45
45
|
"@vitest/coverage-v8": "^5.0.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"releases": "https://github.com/theholocron/clients/releases",
|
|
62
62
|
"wiki": "https://github.com/theholocron/clients/wiki",
|
|
63
63
|
"scripts": {
|
|
64
|
-
"delivery.build": "
|
|
64
|
+
"delivery.build": "holocron run delivery.build -- && node ../../scripts/check-bundle-size.mjs",
|
|
65
65
|
"sourceQuality.staticAnalysis": "holocron run sourceQuality.staticAnalysis --",
|
|
66
66
|
"test:watch": "vitest",
|
|
67
67
|
"verification.typeSafety": "holocron run verification.typeSafety --",
|
package/dist/index.d.mts
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import "@theholocron/http-client";
|
|
2
|
-
import { ErrorSink, Logger } from "@theholocron/observability/core";
|
|
3
|
-
//#region src/utils.d.ts
|
|
4
|
-
interface ClerkClientOptions {
|
|
5
|
-
/** Clerk secret key (sk_live_... or sk_test_...). */
|
|
6
|
-
token: string;
|
|
7
|
-
/** Override base URL for testing. Defaults to https://api.clerk.com/v1. */
|
|
8
|
-
baseUrl?: string;
|
|
9
|
-
/** Override fetch for testing. Defaults to globalThis.fetch. */
|
|
10
|
-
fetch?: typeof fetch;
|
|
11
|
-
/** Structured logger for request/response diagnostics. Defaults to a no-op. */
|
|
12
|
-
logger?: Logger;
|
|
13
|
-
/** Reports transport failures and unexpected 5xx. Defaults to a no-op. */
|
|
14
|
-
errors?: ErrorSink;
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/instance/instance.d.ts
|
|
18
|
-
interface ClerkInstance {
|
|
19
|
-
id?: string;
|
|
20
|
-
object?: string;
|
|
21
|
-
environment_type?: "development" | "production" | "staging" | string;
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/users/users.d.ts
|
|
25
|
-
interface ClerkEmailAddress {
|
|
26
|
-
id: string;
|
|
27
|
-
object: "email_address";
|
|
28
|
-
email_address: string;
|
|
29
|
-
verification: {
|
|
30
|
-
status: string;
|
|
31
|
-
strategy: string;
|
|
32
|
-
} | null;
|
|
33
|
-
linked_to: Array<{
|
|
34
|
-
id: string;
|
|
35
|
-
type: string;
|
|
36
|
-
}>;
|
|
37
|
-
created_at: number;
|
|
38
|
-
updated_at: number;
|
|
39
|
-
}
|
|
40
|
-
interface ClerkPhoneNumber {
|
|
41
|
-
id: string;
|
|
42
|
-
object: "phone_number";
|
|
43
|
-
phone_number: string;
|
|
44
|
-
reserved_for_second_factor: boolean;
|
|
45
|
-
default_second_factor: boolean;
|
|
46
|
-
verification: {
|
|
47
|
-
status: string;
|
|
48
|
-
strategy: string;
|
|
49
|
-
} | null;
|
|
50
|
-
linked_to: Array<{
|
|
51
|
-
id: string;
|
|
52
|
-
type: string;
|
|
53
|
-
}>;
|
|
54
|
-
created_at: number;
|
|
55
|
-
updated_at: number;
|
|
56
|
-
}
|
|
57
|
-
interface ClerkUser {
|
|
58
|
-
id: string;
|
|
59
|
-
object: "user";
|
|
60
|
-
external_id: string | null;
|
|
61
|
-
primary_email_address_id: string | null;
|
|
62
|
-
primary_phone_number_id: string | null;
|
|
63
|
-
primary_web3_wallet_id: string | null;
|
|
64
|
-
username: string | null;
|
|
65
|
-
first_name: string | null;
|
|
66
|
-
last_name: string | null;
|
|
67
|
-
profile_image_url: string;
|
|
68
|
-
image_url: string;
|
|
69
|
-
has_image: boolean;
|
|
70
|
-
public_metadata: Record<string, unknown>;
|
|
71
|
-
private_metadata: Record<string, unknown>;
|
|
72
|
-
unsafe_metadata: Record<string, unknown>;
|
|
73
|
-
email_addresses: ClerkEmailAddress[];
|
|
74
|
-
phone_numbers: ClerkPhoneNumber[];
|
|
75
|
-
last_sign_in_at: number | null;
|
|
76
|
-
banned: boolean;
|
|
77
|
-
locked: boolean;
|
|
78
|
-
lockout_expires_in_seconds: number | null;
|
|
79
|
-
verification_attempts_remaining: number | null;
|
|
80
|
-
created_at: number;
|
|
81
|
-
updated_at: number;
|
|
82
|
-
password_enabled: boolean;
|
|
83
|
-
two_factor_enabled: boolean;
|
|
84
|
-
totp_enabled: boolean;
|
|
85
|
-
backup_code_enabled: boolean;
|
|
86
|
-
}
|
|
87
|
-
interface ClerkUserCount {
|
|
88
|
-
object: "total_count";
|
|
89
|
-
total_count: number;
|
|
90
|
-
}
|
|
91
|
-
interface ClerkDeletedObject {
|
|
92
|
-
object: string;
|
|
93
|
-
id: string;
|
|
94
|
-
slug?: string;
|
|
95
|
-
deleted: boolean;
|
|
96
|
-
}
|
|
97
|
-
interface ClerkUsersListParams {
|
|
98
|
-
limit?: number;
|
|
99
|
-
offset?: number;
|
|
100
|
-
email_address?: string[];
|
|
101
|
-
phone_number?: string[];
|
|
102
|
-
username?: string[];
|
|
103
|
-
external_id?: string[];
|
|
104
|
-
user_id?: string[];
|
|
105
|
-
query?: string;
|
|
106
|
-
last_active_at_since?: number;
|
|
107
|
-
order_by?: string;
|
|
108
|
-
}
|
|
109
|
-
interface CreateClerkUserInput {
|
|
110
|
-
external_id?: string;
|
|
111
|
-
first_name?: string;
|
|
112
|
-
last_name?: string;
|
|
113
|
-
email_address?: string[];
|
|
114
|
-
phone_number?: string[];
|
|
115
|
-
web3_wallet?: string[];
|
|
116
|
-
username?: string;
|
|
117
|
-
password?: string;
|
|
118
|
-
password_digest?: string;
|
|
119
|
-
password_hasher?: string;
|
|
120
|
-
skip_password_checks?: boolean;
|
|
121
|
-
skip_password_requirement?: boolean;
|
|
122
|
-
totp_secret?: string;
|
|
123
|
-
backup_codes?: string[];
|
|
124
|
-
public_metadata?: Record<string, unknown>;
|
|
125
|
-
private_metadata?: Record<string, unknown>;
|
|
126
|
-
unsafe_metadata?: Record<string, unknown>;
|
|
127
|
-
created_at?: string;
|
|
128
|
-
}
|
|
129
|
-
interface UpdateClerkUserInput {
|
|
130
|
-
external_id?: string;
|
|
131
|
-
first_name?: string;
|
|
132
|
-
last_name?: string;
|
|
133
|
-
username?: string;
|
|
134
|
-
password?: string;
|
|
135
|
-
primary_email_address_id?: string;
|
|
136
|
-
notify_primary_email_address_changed?: boolean;
|
|
137
|
-
primary_phone_number_id?: string;
|
|
138
|
-
primary_web3_wallet_id?: string;
|
|
139
|
-
profile_image_id?: string;
|
|
140
|
-
public_metadata?: Record<string, unknown>;
|
|
141
|
-
private_metadata?: Record<string, unknown>;
|
|
142
|
-
unsafe_metadata?: Record<string, unknown>;
|
|
143
|
-
totp_secret?: string;
|
|
144
|
-
backup_codes?: string[];
|
|
145
|
-
delete_self_enabled?: boolean;
|
|
146
|
-
create_organization_enabled?: boolean;
|
|
147
|
-
}
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region src/webhooks/webhooks.d.ts
|
|
150
|
-
interface ClerkSvixApp {
|
|
151
|
-
svix_app_id?: string;
|
|
152
|
-
}
|
|
153
|
-
/** Older Clerk instances return `svix_url`; newer return `url`. */
|
|
154
|
-
interface ClerkSvixUrl {
|
|
155
|
-
url?: string;
|
|
156
|
-
svix_url?: string;
|
|
157
|
-
}
|
|
158
|
-
//#endregion
|
|
159
|
-
//#region src/index.d.ts
|
|
160
|
-
declare function createClerkClient(opts: ClerkClientOptions): {
|
|
161
|
-
instance: {
|
|
162
|
-
get: () => Promise<ClerkInstance>;
|
|
163
|
-
};
|
|
164
|
-
users: {
|
|
165
|
-
list: (params?: ClerkUsersListParams) => Promise<ClerkUser[]>;
|
|
166
|
-
count: (params?: Pick<ClerkUsersListParams, "email_address" | "phone_number" | "username" | "external_id" | "user_id" | "query">) => Promise<ClerkUserCount>;
|
|
167
|
-
get: (id: string) => Promise<ClerkUser>;
|
|
168
|
-
create: (data: CreateClerkUserInput) => Promise<ClerkUser>;
|
|
169
|
-
update: (id: string, data: UpdateClerkUserInput) => Promise<ClerkUser>;
|
|
170
|
-
delete: (id: string) => Promise<ClerkDeletedObject>;
|
|
171
|
-
ban: (id: string) => Promise<ClerkUser>;
|
|
172
|
-
unban: (id: string) => Promise<ClerkUser>;
|
|
173
|
-
lock: (id: string) => Promise<ClerkUser>;
|
|
174
|
-
unlock: (id: string) => Promise<ClerkUser>;
|
|
175
|
-
};
|
|
176
|
-
webhooks: {
|
|
177
|
-
ensureSvixApp: () => Promise<ClerkSvixApp>;
|
|
178
|
-
getSvixUrl: () => Promise<ClerkSvixUrl>;
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
type ClerkClient = ReturnType<typeof createClerkClient>;
|
|
182
|
-
//#endregion
|
|
183
|
-
export { ClerkClient, type ClerkClientOptions, type ClerkDeletedObject, type ClerkEmailAddress, type ClerkInstance, type ClerkPhoneNumber, type ClerkSvixApp, type ClerkSvixUrl, type ClerkUser, type ClerkUserCount, type ClerkUsersListParams, type CreateClerkUserInput, type UpdateClerkUserInput, createClerkClient };
|
package/dist/index.mjs
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { createRestClient } from "@theholocron/http-client";
|
|
2
|
-
//#region src/instance/instance.ts
|
|
3
|
-
function instance(rest) {
|
|
4
|
-
return { get: () => rest.request("/instance") };
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/users/users.ts
|
|
8
|
-
const PATH$1 = "/users";
|
|
9
|
-
function buildUsersQuery(params) {
|
|
10
|
-
const qs = new URLSearchParams();
|
|
11
|
-
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
12
|
-
if (params.offset !== void 0) qs.set("offset", String(params.offset));
|
|
13
|
-
if (params.query) qs.set("query", params.query);
|
|
14
|
-
if (params.order_by) qs.set("order_by", params.order_by);
|
|
15
|
-
if (params.last_active_at_since !== void 0) qs.set("last_active_at_since", String(params.last_active_at_since));
|
|
16
|
-
for (const v of params.email_address ?? []) qs.append("email_address", v);
|
|
17
|
-
for (const v of params.phone_number ?? []) qs.append("phone_number", v);
|
|
18
|
-
for (const v of params.username ?? []) qs.append("username", v);
|
|
19
|
-
for (const v of params.external_id ?? []) qs.append("external_id", v);
|
|
20
|
-
for (const v of params.user_id ?? []) qs.append("user_id", v);
|
|
21
|
-
return qs.toString();
|
|
22
|
-
}
|
|
23
|
-
function users(rest) {
|
|
24
|
-
return {
|
|
25
|
-
list: (params = {}) => {
|
|
26
|
-
const q = buildUsersQuery(params);
|
|
27
|
-
return rest.request(q ? `${PATH$1}?${q}` : PATH$1);
|
|
28
|
-
},
|
|
29
|
-
count: (params = {}) => {
|
|
30
|
-
const q = buildUsersQuery(params);
|
|
31
|
-
return rest.request(q ? `${PATH$1}/count?${q}` : `${PATH$1}/count`);
|
|
32
|
-
},
|
|
33
|
-
get: (id) => rest.request(`${PATH$1}/${id}`),
|
|
34
|
-
create: (data) => rest.request(PATH$1, {
|
|
35
|
-
method: "POST",
|
|
36
|
-
body: data
|
|
37
|
-
}),
|
|
38
|
-
update: (id, data) => rest.request(`${PATH$1}/${id}`, {
|
|
39
|
-
method: "PATCH",
|
|
40
|
-
body: data
|
|
41
|
-
}),
|
|
42
|
-
delete: (id) => rest.request(`${PATH$1}/${id}`, { method: "DELETE" }),
|
|
43
|
-
ban: (id) => rest.request(`${PATH$1}/${id}/ban`, { method: "POST" }),
|
|
44
|
-
unban: (id) => rest.request(`${PATH$1}/${id}/unban`, { method: "POST" }),
|
|
45
|
-
lock: (id) => rest.request(`${PATH$1}/${id}/lock`, { method: "POST" }),
|
|
46
|
-
unlock: (id) => rest.request(`${PATH$1}/${id}/unlock`, { method: "POST" })
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/utils.ts
|
|
51
|
-
function createClerkRestClient(opts) {
|
|
52
|
-
return createRestClient({
|
|
53
|
-
baseUrl: opts.baseUrl ?? "https://api.clerk.com/v1",
|
|
54
|
-
token: opts.token,
|
|
55
|
-
vendor: "Clerk",
|
|
56
|
-
fetch: opts.fetch,
|
|
57
|
-
logger: opts.logger,
|
|
58
|
-
errors: opts.errors
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/webhooks/webhooks.ts
|
|
63
|
-
const PATH = "/webhooks";
|
|
64
|
-
function webhooks(rest) {
|
|
65
|
-
return {
|
|
66
|
-
ensureSvixApp: () => rest.request(`${PATH}/svix`, { method: "POST" }),
|
|
67
|
-
getSvixUrl: () => rest.request(`${PATH}/svix_url`, { method: "POST" })
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/index.ts
|
|
72
|
-
function createClerkClient(opts) {
|
|
73
|
-
const rest = createClerkRestClient(opts);
|
|
74
|
-
return {
|
|
75
|
-
instance: instance(rest),
|
|
76
|
-
users: users(rest),
|
|
77
|
-
webhooks: webhooks(rest)
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
|
-
export { createClerkClient };
|