@theholocron/holocron-plugin-clerk 5.0.0-alpha.507 → 5.0.0-alpha.509

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/index.d.mts CHANGED
@@ -4,7 +4,7 @@
4
4
  * Implements the `auth` capability against Clerk's Backend REST API.
5
5
  * See README for auth + config docs.
6
6
  */
7
- import { Auth, AuthDescription, AuthError, AuthEvent, AuthIdentity, AuthUser, CreateAuthUserInput, ParseWebhookInput, PluginToken, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, WebhookDashboardInfo } from "@theholocron/cli";
7
+ import { Auth, AuthDescription, AuthError, AuthEvent, AuthIdentity, AuthUser, CreateAuthUserInput, EnsureRelaySourceInput, EnsureRelaySourceResult, ParseWebhookInput, PluginToken, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, WebhookDashboardInfo } from "@theholocron/cli";
8
8
  import { ClerkClient, ClerkClientOptions, createClerkClient } from "@theholocron/clerk-client";
9
9
  /** Resolves the Clerk secret key from `--token`, `HOLOCRON_CLERK_SECRET_KEY`, `CLERK_SECRET_KEY` or the keyring entry for `clerk`, and throws `AuthError` when none is set. */
10
10
  export declare const resolveToken: import("@theholocron/cli").TokenResolver;
@@ -25,6 +25,15 @@ export declare class ClerkAuth implements Auth {
25
25
  alreadyExists: boolean;
26
26
  }>;
27
27
  getWebhookDashboardUrl(): Promise<WebhookDashboardInfo>;
28
+ /**
29
+ * Clerk is the one relay source with a manual step (spec `tech-relay-sources`). Clerk delivers through Svix and
30
+ * neither the Backend API nor the Platform API has a route that makes an endpoint, lists them or returns a `whsec_`
31
+ * signing secret (checked 2026-11-19: `POST`/`DELETE /webhooks/svix` and `POST /webhooks/svix_url` are the only
32
+ * webhook routes). So this makes sure the instance's Svix app exists (idempotent) and returns a `todo` naming the
33
+ * dashboard steps; it never returns a secret and never creates an endpoint. Once the endpoint is made and
34
+ * `COMLINK_CLERK_SECRET` is synced, set `options.confirmed: true` on the source in the layout to stop the `todo`.
35
+ */
36
+ ensureRelaySource(input: EnsureRelaySourceInput): Promise<EnsureRelaySourceResult>;
28
37
  createUser(input: CreateAuthUserInput): Promise<AuthUser>;
29
38
  }
30
39
  /** Verifies a Clerk webhook's signature and replay window, then turns it into a normalized `AuthEvent`; throws `WebhookVerificationError` on a bad signature, invalid JSON or an unmapped event type. */
package/dist/index.mjs CHANGED
@@ -50,6 +50,28 @@ var ClerkAuth = class {
50
50
  if (!url) throw new ProviderApiError("Clerk POST /webhooks/svix_url returned 200 but no `url` field", 500, void 0);
51
51
  return { url };
52
52
  }
53
+ /**
54
+ * Clerk is the one relay source with a manual step (spec `tech-relay-sources`). Clerk delivers through Svix and
55
+ * neither the Backend API nor the Platform API has a route that makes an endpoint, lists them or returns a `whsec_`
56
+ * signing secret (checked 2026-11-19: `POST`/`DELETE /webhooks/svix` and `POST /webhooks/svix_url` are the only
57
+ * webhook routes). So this makes sure the instance's Svix app exists (idempotent) and returns a `todo` naming the
58
+ * dashboard steps; it never returns a secret and never creates an endpoint. Once the endpoint is made and
59
+ * `COMLINK_CLERK_SECRET` is synced, set `options.confirmed: true` on the source in the layout to stop the `todo`.
60
+ */
61
+ async ensureRelaySource(input) {
62
+ await this.ensureWebhookApp();
63
+ if (input.options?.["confirmed"] === true) return {
64
+ created: false,
65
+ updated: []
66
+ };
67
+ const events = input.events?.length ? input.events.join(", ") : "the events the Comlink clerk source carries";
68
+ const binding = `COMLINK_${input.source.toUpperCase()}_SECRET`;
69
+ return {
70
+ created: false,
71
+ updated: [],
72
+ todo: [`Clerk has no API to make a webhook endpoint: in the Clerk Dashboard open Configure, Webhooks, Add Endpoint, set the URL to ${input.url}, tick ${events}, and save.`, `Copy the endpoint's Signing Secret (whsec_...) from its page into the prod 1Password Environment as ${binding}, run \`holocron sync secrets --env prod --cwd apps/comlink --worker comlink\`, then set \`options: { confirmed: true }\` on the \`${input.source}\` relay source to clear this step.`]
73
+ };
74
+ }
53
75
  async createUser(input) {
54
76
  const user = await this.client().users.create({
55
77
  email_address: [input.email],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-clerk",
3
- "version": "5.0.0-alpha.507",
3
+ "version": "5.0.0-alpha.509",
4
4
  "description": "Holocron plugin for Clerk. Implements the auth capability against Clerk's Backend REST API.",
5
5
  "keywords": [
6
6
  "auth",
@@ -40,19 +40,19 @@
40
40
  "tsx": "4.23.15",
41
41
  "typescript": "^5.9.3",
42
42
  "vitest": "^5.1.0",
43
- "@theholocron/cli": "5.0.0-alpha.507",
43
+ "@theholocron/cli": "5.0.0-alpha.509",
44
44
  "@theholocron/clerk-client": "^1.58.0-alpha.47",
45
45
  "@theholocron/eslint-config": "^8.9.0-alpha.21",
46
- "@theholocron/http-client": "^1.58.0-alpha.47",
47
- "@theholocron/tsconfig": "^8.9.0-alpha.21",
48
46
  "@theholocron/misc-utils": "^1.17.0-alpha.5",
47
+ "@theholocron/tsconfig": "^8.9.0-alpha.21",
49
48
  "@theholocron/tsdown-config": "^8.9.0-alpha.21",
50
- "@theholocron/vitest-config": "^8.9.0-alpha.21"
49
+ "@theholocron/vitest-config": "^8.9.0-alpha.21",
50
+ "@theholocron/http-client": "^1.58.0-alpha.47"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@theholocron/clerk-client": "^1.43.1",
54
54
  "@theholocron/misc-utils": "^1.16.0",
55
- "@theholocron/cli": "5.0.0-alpha.507"
55
+ "@theholocron/cli": "5.0.0-alpha.509"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=22"