@rawdash/connector-clerk 0.24.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/README.md +134 -0
- package/dist/index.d.ts +476 -0
- package/dist/index.js +638 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<!-- This file is generated from connector metadata by scripts/generate-connector-docs.ts. Do not edit by hand. -->
|
|
2
|
+
|
|
3
|
+
# @rawdash/connector-clerk
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@rawdash/connector-clerk)
|
|
6
|
+
[](https://github.com/rawdash/rawdash/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
Sync users, organizations, sessions, and a derived daily-active-users metric from a Clerk application for sign-up, DAU, and active-session dashboards.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @rawdash/connector-clerk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Authentication
|
|
17
|
+
|
|
18
|
+
A Clerk Backend API secret key (Bearer token). Anyone with the key has read access to every resource the connector syncs.
|
|
19
|
+
|
|
20
|
+
1. Open the Clerk Dashboard for the application you want to sync and navigate to API Keys.
|
|
21
|
+
2. Copy the Secret key (it starts with `sk_test_` for development instances or `sk_live_` for production).
|
|
22
|
+
3. Store it as a rawdash secret and reference it from the connector config as `secretKey: secret("CLERK_SECRET_KEY")`.
|
|
23
|
+
4. Treat the secret key like a root credential - rotate it from the dashboard if it leaks.
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
| Field | Type | Required | Description |
|
|
28
|
+
| ----------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `secretKey` | secret | Yes | Clerk Backend API secret key (starts with `sk_test_` or `sk_live_`). Create one at Clerk Dashboard -> API Keys. |
|
|
30
|
+
| `apiUrl` | string | No | Clerk Backend API base URL. Defaults to https://api.clerk.com; override only if you are pinned to the legacy https://api.clerk.dev host. |
|
|
31
|
+
| `resources` | array | No | Which Clerk resources to sync. Omit to sync all of them. The secret key has read access to every resource by default; the allowlist exists to skip phases your dashboards do not query. |
|
|
32
|
+
| `dauLookbackDays` | number | No | How many days back to bucket users by last_active_at when computing the daily_active_users metric. Defaults to 30; the cap is 90. |
|
|
33
|
+
|
|
34
|
+
## Resources
|
|
35
|
+
|
|
36
|
+
- **`clerk_user`** _(entity)_ - Clerk users keyed by user id, with primary email, sign-in / activity timestamps, and banned / locked flags.
|
|
37
|
+
- Endpoint: `GET /v1/users`
|
|
38
|
+
- Uses offset pagination (limit / offset) capped at 50 pages (~25,000 users) per sync. Incremental syncs pass options.since through as the last_active_at_since filter.
|
|
39
|
+
- `email`: Primary email address (when present).
|
|
40
|
+
- `emailVerified`: Whether the primary email address is verified (null if no email is set).
|
|
41
|
+
- `lastSignInAt`: Most recent sign-in timestamp (Unix ms).
|
|
42
|
+
- `lastActiveAt`: Most recent activity timestamp (Unix ms). Clerk updates this on every successful client request.
|
|
43
|
+
- `banned`: Whether the user has been banned.
|
|
44
|
+
- `locked`: Whether the user is locked from signing in.
|
|
45
|
+
- `createdAt`: When the user account was created (Unix ms).
|
|
46
|
+
- **`clerk_organization`** _(entity)_ - Clerk organizations keyed by organization id, with display name, slug, and members count.
|
|
47
|
+
- Endpoint: `GET /v1/organizations`
|
|
48
|
+
- Uses offset pagination (limit / offset) capped at 50 pages. Clerk has no created_at / updated_at filter for organizations, so each sync re-scans the full list and short-circuits once a page is entirely older than options.since.
|
|
49
|
+
- `name`: Organization display name.
|
|
50
|
+
- `slug`: Organization URL slug.
|
|
51
|
+
- `membersCount`: Number of users in the organization at sync time.
|
|
52
|
+
- `createdAt`: When the organization was created (Unix ms).
|
|
53
|
+
- **`clerk_session`** _(event)_ - Clerk session events. One event per session row with start_ts set to created_at and attributes carrying user id, status, and last activity.
|
|
54
|
+
- Endpoint: `GET /v1/sessions`
|
|
55
|
+
- Uses offset pagination (limit / offset) capped at 50 pages. Clerk has no since filter on /v1/sessions, so the sync walks newest-first and stops once a page is entirely older than options.since.
|
|
56
|
+
- `sessionId`: Clerk session id.
|
|
57
|
+
- `userId`: User the session belongs to.
|
|
58
|
+
- `status`: Session status (active | ended | expired | abandoned | removed | replaced | revoked).
|
|
59
|
+
- `lastActiveAt`: Most recent activity timestamp on the session (Unix ms).
|
|
60
|
+
- **`clerk_daily_active_users`** _(metric)_ - Daily active users derived from the Clerk users endpoint: one sample per UTC day in the configured lookback window, counting users whose last_active_at fell on that day.
|
|
61
|
+
- Endpoint: `GET /v1/users`
|
|
62
|
+
- Unit: count
|
|
63
|
+
- Granularity: 1d
|
|
64
|
+
|
|
65
|
+
## Example
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import {
|
|
69
|
+
defineConfig,
|
|
70
|
+
defineDashboard,
|
|
71
|
+
defineMetric,
|
|
72
|
+
secret,
|
|
73
|
+
} from '@rawdash/core';
|
|
74
|
+
|
|
75
|
+
const clerk = {
|
|
76
|
+
name: 'clerk',
|
|
77
|
+
connectorId: 'clerk',
|
|
78
|
+
config: {
|
|
79
|
+
secretKey: secret('CLERK_SECRET_KEY'),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default defineConfig({
|
|
84
|
+
connectors: [clerk],
|
|
85
|
+
dashboards: {
|
|
86
|
+
identity: defineDashboard({
|
|
87
|
+
widgets: {
|
|
88
|
+
active_users: {
|
|
89
|
+
kind: 'stat',
|
|
90
|
+
title: 'Clerk users',
|
|
91
|
+
metric: defineMetric({
|
|
92
|
+
connector: clerk,
|
|
93
|
+
shape: 'entity',
|
|
94
|
+
entityType: 'clerk_user',
|
|
95
|
+
fn: 'count',
|
|
96
|
+
filter: [{ field: 'banned', op: 'eq', value: false }],
|
|
97
|
+
}),
|
|
98
|
+
},
|
|
99
|
+
active_sessions: {
|
|
100
|
+
kind: 'stat',
|
|
101
|
+
title: 'Active sessions',
|
|
102
|
+
metric: defineMetric({
|
|
103
|
+
connector: clerk,
|
|
104
|
+
shape: 'event',
|
|
105
|
+
name: 'clerk_session',
|
|
106
|
+
fn: 'count',
|
|
107
|
+
filter: [{ field: 'status', op: 'eq', value: 'active' }],
|
|
108
|
+
}),
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Rate limits
|
|
117
|
+
|
|
118
|
+
Clerk Backend API throttles per instance (~20 req/s for production, lower for dev). Responses publish X-RateLimit-Remaining / X-RateLimit-Reset (Unix seconds) headers and the shared HTTP client backs off on 429 using the standard rate-limit policy.
|
|
119
|
+
|
|
120
|
+
## Limitations
|
|
121
|
+
|
|
122
|
+
- Each phase paginates via limit / offset and is capped at 50 pages per sync (~25,000 rows). Instances larger than that should run more frequent incremental syncs so each window fits under the cap.
|
|
123
|
+
- The daily_active_users metric is derived by bucketing users by the day of their last_active_at timestamp - it counts users whose most recent activity fell on each day, not unique users active across overlapping days.
|
|
124
|
+
- Webhooks, JWT templates, instance settings, and impersonation tokens are out of scope.
|
|
125
|
+
|
|
126
|
+
## Links
|
|
127
|
+
|
|
128
|
+
- [Rawdash docs](https://rawdash.dev/docs/connectors/)
|
|
129
|
+
- [Clerk API docs](https://clerk.com/docs/reference/backend-api)
|
|
130
|
+
- [GitHub](https://github.com/rawdash/rawdash)
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
Apache-2.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import { BaseConnector, ConnectorContext, SyncOptions, StorageHandle, SyncResult, ConnectorDoc } from '@rawdash/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const configFields: z.ZodObject<{
|
|
5
|
+
secretKey: z.ZodObject<{
|
|
6
|
+
$secret: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
apiUrl: z.ZodDefault<z.ZodString>;
|
|
9
|
+
resources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
10
|
+
users: "users";
|
|
11
|
+
organizations: "organizations";
|
|
12
|
+
sessions: "sessions";
|
|
13
|
+
daily_active_users: "daily_active_users";
|
|
14
|
+
}>>>;
|
|
15
|
+
dauLookbackDays: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
declare const doc: ConnectorDoc;
|
|
18
|
+
type ClerkResource = 'users' | 'organizations' | 'sessions' | 'daily_active_users';
|
|
19
|
+
interface ClerkSettings {
|
|
20
|
+
apiUrl?: string;
|
|
21
|
+
resources?: readonly ClerkResource[];
|
|
22
|
+
dauLookbackDays?: number;
|
|
23
|
+
}
|
|
24
|
+
declare const clerkCredentials: {
|
|
25
|
+
secretKey: {
|
|
26
|
+
description: string;
|
|
27
|
+
auth: "required";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
type ClerkCredentials = typeof clerkCredentials;
|
|
31
|
+
declare const clerkResources: {
|
|
32
|
+
readonly clerk_user: {
|
|
33
|
+
readonly shape: "entity";
|
|
34
|
+
readonly filterable: [{
|
|
35
|
+
readonly field: "banned";
|
|
36
|
+
readonly ops: ["eq"];
|
|
37
|
+
readonly values: ["true", "false"];
|
|
38
|
+
}, {
|
|
39
|
+
readonly field: "locked";
|
|
40
|
+
readonly ops: ["eq"];
|
|
41
|
+
readonly values: ["true", "false"];
|
|
42
|
+
}];
|
|
43
|
+
readonly description: "Clerk users keyed by user id, with primary email, sign-in / activity timestamps, and banned / locked flags.";
|
|
44
|
+
readonly endpoint: "GET /v1/users";
|
|
45
|
+
readonly notes: "Uses offset pagination (limit / offset) capped at 50 pages (~25,000 users) per sync. Incremental syncs pass options.since through as the last_active_at_since filter.";
|
|
46
|
+
readonly fields: [{
|
|
47
|
+
readonly name: "email";
|
|
48
|
+
readonly description: "Primary email address (when present).";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "emailVerified";
|
|
51
|
+
readonly description: "Whether the primary email address is verified (null if no email is set).";
|
|
52
|
+
}, {
|
|
53
|
+
readonly name: "lastSignInAt";
|
|
54
|
+
readonly description: "Most recent sign-in timestamp (Unix ms).";
|
|
55
|
+
}, {
|
|
56
|
+
readonly name: "lastActiveAt";
|
|
57
|
+
readonly description: "Most recent activity timestamp (Unix ms). Clerk updates this on every successful client request.";
|
|
58
|
+
}, {
|
|
59
|
+
readonly name: "banned";
|
|
60
|
+
readonly description: "Whether the user has been banned.";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "locked";
|
|
63
|
+
readonly description: "Whether the user is locked from signing in.";
|
|
64
|
+
}, {
|
|
65
|
+
readonly name: "createdAt";
|
|
66
|
+
readonly description: "When the user account was created (Unix ms).";
|
|
67
|
+
}];
|
|
68
|
+
readonly responses: {
|
|
69
|
+
readonly users: z.ZodArray<z.ZodObject<{
|
|
70
|
+
id: z.ZodString;
|
|
71
|
+
primary_email_address_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
email_addresses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
73
|
+
id: z.ZodOptional<z.ZodString>;
|
|
74
|
+
email_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
verification: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
76
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
}, z.core.$strip>>>;
|
|
78
|
+
}, z.core.$strip>>>>;
|
|
79
|
+
first_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
80
|
+
last_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
81
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
|
+
last_sign_in_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
83
|
+
last_active_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
84
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
85
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
86
|
+
banned: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
87
|
+
locked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
readonly clerk_organization: {
|
|
92
|
+
readonly shape: "entity";
|
|
93
|
+
readonly filterable: [];
|
|
94
|
+
readonly description: "Clerk organizations keyed by organization id, with display name, slug, and members count.";
|
|
95
|
+
readonly endpoint: "GET /v1/organizations";
|
|
96
|
+
readonly notes: "Uses offset pagination (limit / offset) capped at 50 pages. Clerk has no created_at / updated_at filter for organizations, so each sync re-scans the full list and short-circuits once a page is entirely older than options.since.";
|
|
97
|
+
readonly fields: [{
|
|
98
|
+
readonly name: "name";
|
|
99
|
+
readonly description: "Organization display name.";
|
|
100
|
+
}, {
|
|
101
|
+
readonly name: "slug";
|
|
102
|
+
readonly description: "Organization URL slug.";
|
|
103
|
+
}, {
|
|
104
|
+
readonly name: "membersCount";
|
|
105
|
+
readonly description: "Number of users in the organization at sync time.";
|
|
106
|
+
}, {
|
|
107
|
+
readonly name: "createdAt";
|
|
108
|
+
readonly description: "When the organization was created (Unix ms).";
|
|
109
|
+
}];
|
|
110
|
+
readonly responses: {
|
|
111
|
+
readonly organizations: z.ZodUnion<readonly [z.ZodObject<{
|
|
112
|
+
data: z.ZodArray<z.ZodObject<{
|
|
113
|
+
id: z.ZodString;
|
|
114
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
115
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
116
|
+
members_count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
117
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
118
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
total_count: z.ZodOptional<z.ZodNumber>;
|
|
121
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
|
+
members_count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
126
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
127
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
128
|
+
}, z.core.$strip>>]>;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
readonly clerk_session: {
|
|
132
|
+
readonly shape: "event";
|
|
133
|
+
readonly filterable: [{
|
|
134
|
+
readonly field: "status";
|
|
135
|
+
readonly ops: ["eq"];
|
|
136
|
+
readonly values: string[];
|
|
137
|
+
}];
|
|
138
|
+
readonly description: "Clerk session events. One event per session row with start_ts set to created_at and attributes carrying user id, status, and last activity.";
|
|
139
|
+
readonly endpoint: "GET /v1/sessions";
|
|
140
|
+
readonly notes: "Uses offset pagination (limit / offset) capped at 50 pages. Clerk has no since filter on /v1/sessions, so the sync walks newest-first and stops once a page is entirely older than options.since.";
|
|
141
|
+
readonly fields: [{
|
|
142
|
+
readonly name: "sessionId";
|
|
143
|
+
readonly description: "Clerk session id.";
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "userId";
|
|
146
|
+
readonly description: "User the session belongs to.";
|
|
147
|
+
}, {
|
|
148
|
+
readonly name: "status";
|
|
149
|
+
readonly description: "Session status (active | ended | expired | abandoned | removed | replaced | revoked).";
|
|
150
|
+
}, {
|
|
151
|
+
readonly name: "lastActiveAt";
|
|
152
|
+
readonly description: "Most recent activity timestamp on the session (Unix ms).";
|
|
153
|
+
}];
|
|
154
|
+
readonly responses: {
|
|
155
|
+
readonly sessions: z.ZodArray<z.ZodObject<{
|
|
156
|
+
id: z.ZodString;
|
|
157
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
158
|
+
client_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
159
|
+
status: z.ZodString;
|
|
160
|
+
last_active_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
161
|
+
expire_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
162
|
+
abandon_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
163
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
164
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
165
|
+
}, z.core.$strip>>;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
readonly clerk_daily_active_users: {
|
|
169
|
+
readonly shape: "metric";
|
|
170
|
+
readonly description: "Daily active users derived from the Clerk users endpoint: one sample per UTC day in the configured lookback window, counting users whose last_active_at fell on that day.";
|
|
171
|
+
readonly endpoint: "GET /v1/users";
|
|
172
|
+
readonly unit: "count";
|
|
173
|
+
readonly granularity: "1d";
|
|
174
|
+
readonly dimensions: [];
|
|
175
|
+
readonly responses: {
|
|
176
|
+
readonly dau_users: z.ZodArray<z.ZodObject<{
|
|
177
|
+
id: z.ZodString;
|
|
178
|
+
primary_email_address_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
179
|
+
email_addresses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
180
|
+
id: z.ZodOptional<z.ZodString>;
|
|
181
|
+
email_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
182
|
+
verification: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
183
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
184
|
+
}, z.core.$strip>>>;
|
|
185
|
+
}, z.core.$strip>>>>;
|
|
186
|
+
first_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
last_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
|
+
last_sign_in_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
190
|
+
last_active_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
191
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
192
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
193
|
+
banned: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
194
|
+
locked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
195
|
+
}, z.core.$strip>>;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
declare const id = "clerk";
|
|
200
|
+
declare class ClerkConnector extends BaseConnector<ClerkSettings, ClerkCredentials> {
|
|
201
|
+
static readonly id = "clerk";
|
|
202
|
+
static readonly resources: {
|
|
203
|
+
readonly clerk_user: {
|
|
204
|
+
readonly shape: "entity";
|
|
205
|
+
readonly filterable: [{
|
|
206
|
+
readonly field: "banned";
|
|
207
|
+
readonly ops: ["eq"];
|
|
208
|
+
readonly values: ["true", "false"];
|
|
209
|
+
}, {
|
|
210
|
+
readonly field: "locked";
|
|
211
|
+
readonly ops: ["eq"];
|
|
212
|
+
readonly values: ["true", "false"];
|
|
213
|
+
}];
|
|
214
|
+
readonly description: "Clerk users keyed by user id, with primary email, sign-in / activity timestamps, and banned / locked flags.";
|
|
215
|
+
readonly endpoint: "GET /v1/users";
|
|
216
|
+
readonly notes: "Uses offset pagination (limit / offset) capped at 50 pages (~25,000 users) per sync. Incremental syncs pass options.since through as the last_active_at_since filter.";
|
|
217
|
+
readonly fields: [{
|
|
218
|
+
readonly name: "email";
|
|
219
|
+
readonly description: "Primary email address (when present).";
|
|
220
|
+
}, {
|
|
221
|
+
readonly name: "emailVerified";
|
|
222
|
+
readonly description: "Whether the primary email address is verified (null if no email is set).";
|
|
223
|
+
}, {
|
|
224
|
+
readonly name: "lastSignInAt";
|
|
225
|
+
readonly description: "Most recent sign-in timestamp (Unix ms).";
|
|
226
|
+
}, {
|
|
227
|
+
readonly name: "lastActiveAt";
|
|
228
|
+
readonly description: "Most recent activity timestamp (Unix ms). Clerk updates this on every successful client request.";
|
|
229
|
+
}, {
|
|
230
|
+
readonly name: "banned";
|
|
231
|
+
readonly description: "Whether the user has been banned.";
|
|
232
|
+
}, {
|
|
233
|
+
readonly name: "locked";
|
|
234
|
+
readonly description: "Whether the user is locked from signing in.";
|
|
235
|
+
}, {
|
|
236
|
+
readonly name: "createdAt";
|
|
237
|
+
readonly description: "When the user account was created (Unix ms).";
|
|
238
|
+
}];
|
|
239
|
+
readonly responses: {
|
|
240
|
+
readonly users: z.ZodArray<z.ZodObject<{
|
|
241
|
+
id: z.ZodString;
|
|
242
|
+
primary_email_address_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
243
|
+
email_addresses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
244
|
+
id: z.ZodOptional<z.ZodString>;
|
|
245
|
+
email_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
246
|
+
verification: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
247
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
248
|
+
}, z.core.$strip>>>;
|
|
249
|
+
}, z.core.$strip>>>>;
|
|
250
|
+
first_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
251
|
+
last_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
252
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
253
|
+
last_sign_in_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
254
|
+
last_active_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
255
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
256
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
257
|
+
banned: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
258
|
+
locked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
259
|
+
}, z.core.$strip>>;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
readonly clerk_organization: {
|
|
263
|
+
readonly shape: "entity";
|
|
264
|
+
readonly filterable: [];
|
|
265
|
+
readonly description: "Clerk organizations keyed by organization id, with display name, slug, and members count.";
|
|
266
|
+
readonly endpoint: "GET /v1/organizations";
|
|
267
|
+
readonly notes: "Uses offset pagination (limit / offset) capped at 50 pages. Clerk has no created_at / updated_at filter for organizations, so each sync re-scans the full list and short-circuits once a page is entirely older than options.since.";
|
|
268
|
+
readonly fields: [{
|
|
269
|
+
readonly name: "name";
|
|
270
|
+
readonly description: "Organization display name.";
|
|
271
|
+
}, {
|
|
272
|
+
readonly name: "slug";
|
|
273
|
+
readonly description: "Organization URL slug.";
|
|
274
|
+
}, {
|
|
275
|
+
readonly name: "membersCount";
|
|
276
|
+
readonly description: "Number of users in the organization at sync time.";
|
|
277
|
+
}, {
|
|
278
|
+
readonly name: "createdAt";
|
|
279
|
+
readonly description: "When the organization was created (Unix ms).";
|
|
280
|
+
}];
|
|
281
|
+
readonly responses: {
|
|
282
|
+
readonly organizations: z.ZodUnion<readonly [z.ZodObject<{
|
|
283
|
+
data: z.ZodArray<z.ZodObject<{
|
|
284
|
+
id: z.ZodString;
|
|
285
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
286
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
287
|
+
members_count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
288
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
289
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
290
|
+
}, z.core.$strip>>;
|
|
291
|
+
total_count: z.ZodOptional<z.ZodNumber>;
|
|
292
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
293
|
+
id: z.ZodString;
|
|
294
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
295
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
296
|
+
members_count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
297
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
298
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
299
|
+
}, z.core.$strip>>]>;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
readonly clerk_session: {
|
|
303
|
+
readonly shape: "event";
|
|
304
|
+
readonly filterable: [{
|
|
305
|
+
readonly field: "status";
|
|
306
|
+
readonly ops: ["eq"];
|
|
307
|
+
readonly values: string[];
|
|
308
|
+
}];
|
|
309
|
+
readonly description: "Clerk session events. One event per session row with start_ts set to created_at and attributes carrying user id, status, and last activity.";
|
|
310
|
+
readonly endpoint: "GET /v1/sessions";
|
|
311
|
+
readonly notes: "Uses offset pagination (limit / offset) capped at 50 pages. Clerk has no since filter on /v1/sessions, so the sync walks newest-first and stops once a page is entirely older than options.since.";
|
|
312
|
+
readonly fields: [{
|
|
313
|
+
readonly name: "sessionId";
|
|
314
|
+
readonly description: "Clerk session id.";
|
|
315
|
+
}, {
|
|
316
|
+
readonly name: "userId";
|
|
317
|
+
readonly description: "User the session belongs to.";
|
|
318
|
+
}, {
|
|
319
|
+
readonly name: "status";
|
|
320
|
+
readonly description: "Session status (active | ended | expired | abandoned | removed | replaced | revoked).";
|
|
321
|
+
}, {
|
|
322
|
+
readonly name: "lastActiveAt";
|
|
323
|
+
readonly description: "Most recent activity timestamp on the session (Unix ms).";
|
|
324
|
+
}];
|
|
325
|
+
readonly responses: {
|
|
326
|
+
readonly sessions: z.ZodArray<z.ZodObject<{
|
|
327
|
+
id: z.ZodString;
|
|
328
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
329
|
+
client_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
330
|
+
status: z.ZodString;
|
|
331
|
+
last_active_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
332
|
+
expire_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
333
|
+
abandon_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
334
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
335
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
336
|
+
}, z.core.$strip>>;
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
readonly clerk_daily_active_users: {
|
|
340
|
+
readonly shape: "metric";
|
|
341
|
+
readonly description: "Daily active users derived from the Clerk users endpoint: one sample per UTC day in the configured lookback window, counting users whose last_active_at fell on that day.";
|
|
342
|
+
readonly endpoint: "GET /v1/users";
|
|
343
|
+
readonly unit: "count";
|
|
344
|
+
readonly granularity: "1d";
|
|
345
|
+
readonly dimensions: [];
|
|
346
|
+
readonly responses: {
|
|
347
|
+
readonly dau_users: z.ZodArray<z.ZodObject<{
|
|
348
|
+
id: z.ZodString;
|
|
349
|
+
primary_email_address_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
350
|
+
email_addresses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
351
|
+
id: z.ZodOptional<z.ZodString>;
|
|
352
|
+
email_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
353
|
+
verification: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
354
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
355
|
+
}, z.core.$strip>>>;
|
|
356
|
+
}, z.core.$strip>>>>;
|
|
357
|
+
first_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
358
|
+
last_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
359
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
360
|
+
last_sign_in_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
361
|
+
last_active_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
362
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
363
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
364
|
+
banned: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
365
|
+
locked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
366
|
+
}, z.core.$strip>>;
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
static readonly schemas: {
|
|
371
|
+
readonly users: z.ZodArray<z.ZodObject<{
|
|
372
|
+
id: z.ZodString;
|
|
373
|
+
primary_email_address_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
374
|
+
email_addresses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
375
|
+
id: z.ZodOptional<z.ZodString>;
|
|
376
|
+
email_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
377
|
+
verification: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
378
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
379
|
+
}, z.core.$strip>>>;
|
|
380
|
+
}, z.core.$strip>>>>;
|
|
381
|
+
first_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
382
|
+
last_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
383
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
384
|
+
last_sign_in_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
385
|
+
last_active_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
386
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
387
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
388
|
+
banned: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
389
|
+
locked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
390
|
+
}, z.core.$strip>>;
|
|
391
|
+
} & {
|
|
392
|
+
readonly organizations: z.ZodUnion<readonly [z.ZodObject<{
|
|
393
|
+
data: z.ZodArray<z.ZodObject<{
|
|
394
|
+
id: z.ZodString;
|
|
395
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
396
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
397
|
+
members_count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
398
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
399
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
400
|
+
}, z.core.$strip>>;
|
|
401
|
+
total_count: z.ZodOptional<z.ZodNumber>;
|
|
402
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
403
|
+
id: z.ZodString;
|
|
404
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
405
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
406
|
+
members_count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
407
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
408
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
409
|
+
}, z.core.$strip>>]>;
|
|
410
|
+
} & {
|
|
411
|
+
readonly sessions: z.ZodArray<z.ZodObject<{
|
|
412
|
+
id: z.ZodString;
|
|
413
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
414
|
+
client_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
415
|
+
status: z.ZodString;
|
|
416
|
+
last_active_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
417
|
+
expire_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
418
|
+
abandon_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
419
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
420
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
421
|
+
}, z.core.$strip>>;
|
|
422
|
+
} & {
|
|
423
|
+
readonly dau_users: z.ZodArray<z.ZodObject<{
|
|
424
|
+
id: z.ZodString;
|
|
425
|
+
primary_email_address_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
426
|
+
email_addresses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
427
|
+
id: z.ZodOptional<z.ZodString>;
|
|
428
|
+
email_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
429
|
+
verification: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
430
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
431
|
+
}, z.core.$strip>>>;
|
|
432
|
+
}, z.core.$strip>>>>;
|
|
433
|
+
first_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
434
|
+
last_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
435
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
436
|
+
last_sign_in_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
437
|
+
last_active_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
438
|
+
created_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
439
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
440
|
+
banned: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
441
|
+
locked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
442
|
+
}, z.core.$strip>>;
|
|
443
|
+
} & Readonly<Record<string, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
444
|
+
static create(input: unknown, ctx?: ConnectorContext): ClerkConnector;
|
|
445
|
+
readonly id = "clerk";
|
|
446
|
+
readonly credentials: {
|
|
447
|
+
secretKey: {
|
|
448
|
+
description: string;
|
|
449
|
+
auth: "required";
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
private dauBuckets;
|
|
453
|
+
private baseUrl;
|
|
454
|
+
private dauLookbackDays;
|
|
455
|
+
private dauCutoffMs;
|
|
456
|
+
private parsePageCursor;
|
|
457
|
+
private apiGet;
|
|
458
|
+
private buildUsersUrl;
|
|
459
|
+
private buildOrganizationsUrl;
|
|
460
|
+
private buildSessionsUrl;
|
|
461
|
+
private buildDauUsersUrl;
|
|
462
|
+
private fetchUsersPage;
|
|
463
|
+
private fetchOrganizationsPage;
|
|
464
|
+
private fetchSessionsPage;
|
|
465
|
+
private fetchDauUsersPage;
|
|
466
|
+
private writeUsers;
|
|
467
|
+
private writeOrganizations;
|
|
468
|
+
private writeSessions;
|
|
469
|
+
private accumulateDau;
|
|
470
|
+
private writeDauSamples;
|
|
471
|
+
private clearScopeOnFirstPage;
|
|
472
|
+
private resolveCursor;
|
|
473
|
+
sync(options: SyncOptions, storage: StorageHandle, signal?: AbortSignal): Promise<SyncResult>;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export { ClerkConnector, type ClerkResource, type ClerkSettings, configFields, ClerkConnector as default, doc, id, clerkResources as resources };
|