@theholocron/holocron-plugin-sentry 3.54.0 → 3.55.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # `@theholocron/holocron-plugin-sentry`
4
4
 
5
- Sentry plugin for [Holocron](../cli). Implements the `observability`
5
+ Sentry plugin for [Holocron](../cli). Implements the `errors`
6
6
  capability against the [Sentry management API](https://docs.sentry.io/api/).
7
7
 
8
8
  ## Install
@@ -33,7 +33,7 @@ user-owned and org-owned tokens are accepted.
33
33
  ```jsonc
34
34
  {
35
35
  "providers": {
36
- "observability": ["sentry", { "org": "my-org-slug", "team": "my-team" }],
36
+ "errors": ["sentry", { "org": "my-org-slug", "team": "my-team" }],
37
37
  },
38
38
  }
39
39
 
@@ -51,6 +51,8 @@ user-owned and org-owned tokens are accepted.
51
51
  | `whoami` | Fetches the org by slug to verify the token and confirm the org exists. |
52
52
  | `ensureProject` | Looks up the project by slug (derived from `name`); creates it under the configured team if absent. Returns the DSN and an `alreadyExists` flag. Idempotent. |
53
53
 
54
- `holocron setup` calls `ensureProject` and pushes both `SENTRY_DSN` and
55
- `NEXT_PUBLIC_SENTRY_DSN` to GitHub Secrets (same DSN value, both keys
56
- required by the Sentry Next.js SDK).
54
+ A provider entry in `holocron.config` is only needed to enable `holocron
55
+ setup` provisioning (`ensureProject` + pushing `SENTRY_DSN` /
56
+ `NEXT_PUBLIC_SENTRY_DSN` to Secrets) and `holocron doctor` connectivity
57
+ checks — not for runtime error reporting, which the CLI activates directly
58
+ from `HOLOCRON_SENTRY_DSN` (fallback `SENTRY_DSN`).
package/dist/index.d.mts CHANGED
@@ -1,21 +1,21 @@
1
- import { AuthError, Observability, ResolveTokenInput } from "@theholocron/cli";
1
+ import { AuthError, Errors, ResolveTokenInput } from "@theholocron/cli";
2
2
  import { SentryClient, SentryClientOptions, createSentryClient } from "@theholocron/sentry-client";
3
3
  //#region src/auth.d.ts
4
4
  declare const resolveToken: (input?: ResolveTokenInput) => string;
5
5
  //#endregion
6
- //#region src/capabilities/observability.d.ts
7
- interface SentryObservabilityOptions {
8
- /** Sentry organization slug. Required. */
9
- org: string;
6
+ //#region src/capabilities/errors.d.ts
7
+ interface SentryErrorsOptions {
8
+ /** Sentry organization slug. Required for `whoami` and `ensureProject`. */
9
+ org?: string;
10
10
  /** Default team slug for project creation. Defaults to org slug. */
11
11
  team?: string;
12
12
  }
13
- declare class SentryObservability implements Observability {
13
+ declare class SentryErrors implements Errors {
14
14
  private readonly client;
15
15
  private readonly opts;
16
- readonly key: "observability";
16
+ readonly key: "errors";
17
17
  readonly providerName = "sentry";
18
- constructor(client: SentryClient, opts: SentryObservabilityOptions);
18
+ constructor(client: SentryClient, opts: SentryErrorsOptions);
19
19
  describe(): Promise<{
20
20
  provider: string;
21
21
  envKeys: string[];
@@ -30,6 +30,12 @@ declare class SentryObservability implements Observability {
30
30
  dsn: string;
31
31
  alreadyExists: boolean;
32
32
  }>;
33
+ /**
34
+ * `org` is optional at construction (the `errors` capability activates from
35
+ * env vars alone), but the management-API calls need it. Validate here so
36
+ * the runtime is never blocked at plugin-load time.
37
+ */
38
+ private requireOrg;
33
39
  }
34
40
  //#endregion
35
41
  //#region src/verify-token.d.ts
@@ -49,9 +55,13 @@ interface VerifyTokenOptions {
49
55
  declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult>;
50
56
  //#endregion
51
57
  //#region src/index.d.ts
52
- interface SentryPluginOptions extends ResolveTokenInput, SentryObservabilityOptions {
53
- /** Sentry organization slug. Required. Narrows ResolveTokenInput.org (optional) to string. */
54
- org: string;
58
+ interface SentryPluginOptions extends ResolveTokenInput, SentryErrorsOptions {
59
+ /**
60
+ * Sentry organization slug. Optional at load time — the `errors` capability
61
+ * activates from env vars alone — but required for `whoami` / `ensureProject`
62
+ * (validated at call time, not construction).
63
+ */
64
+ org?: string;
55
65
  /** Override base URL for tests. */
56
66
  baseUrl?: string;
57
67
  fetch?: typeof fetch;
@@ -61,13 +71,13 @@ interface PluginContext {
61
71
  client: SentryClient;
62
72
  }
63
73
  declare function createContext(options: SentryPluginOptions): PluginContext;
64
- declare function observability(ctx: PluginContext): Observability;
74
+ declare function errors(ctx: PluginContext): Errors;
65
75
  declare function createPlugin(options: SentryPluginOptions): {
66
76
  name: string;
67
77
  capabilities: {
68
- observability: () => Observability;
78
+ errors: () => Errors;
69
79
  };
70
80
  };
71
81
  declare const AUTH_HINT: string;
72
82
  //#endregion
73
- export { AUTH_HINT, AuthError, PluginContext, type ResolveTokenInput, type SentryClient, type SentryClientOptions, SentryObservability, type SentryObservabilityOptions, SentryPluginOptions, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createContext, createPlugin, createSentryClient, observability, resolveToken, verifyToken };
83
+ export { AUTH_HINT, AuthError, PluginContext, type ResolveTokenInput, type SentryClient, type SentryClientOptions, SentryErrors, type SentryErrorsOptions, SentryPluginOptions, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createContext, createPlugin, createSentryClient, errors, resolveToken, verifyToken };
package/dist/index.mjs CHANGED
@@ -8,16 +8,15 @@ const resolveToken = createResolveToken({
8
8
  errorMessage: "no Sentry auth token found. Pass --token <TOKEN>, set HOLOCRON_SENTRY_TOKEN / SENTRY_AUTH_TOKEN, or run: holocron auth set sentry <TOKEN>"
9
9
  });
10
10
  //#endregion
11
- //#region src/capabilities/observability.ts
12
- var SentryObservability = class {
11
+ //#region src/capabilities/errors.ts
12
+ var SentryErrors = class {
13
13
  client;
14
14
  opts;
15
- key = "observability";
15
+ key = "errors";
16
16
  providerName = "sentry";
17
17
  constructor(client, opts) {
18
18
  this.client = client;
19
19
  this.opts = opts;
20
- if (!opts.org) throw new Error("SentryObservability requires `org` in options");
21
20
  }
22
21
  async describe() {
23
22
  return {
@@ -26,13 +25,14 @@ var SentryObservability = class {
26
25
  };
27
26
  }
28
27
  async whoami() {
29
- return { org: (await this.client.auth.getOrg(this.opts.org)).slug };
28
+ return { org: (await this.client.auth.getOrg(this.requireOrg())).slug };
30
29
  }
31
30
  async ensureProject(input) {
31
+ const org = this.requireOrg();
32
32
  const slug = toSlug(input.name);
33
33
  try {
34
- const existing = await this.client.projects.get(this.opts.org, slug);
35
- const dsn = (await this.client.projects.keys(this.opts.org, existing.slug))[0]?.dsn.public;
34
+ const existing = await this.client.projects.get(org, slug);
35
+ const dsn = (await this.client.projects.keys(org, existing.slug))[0]?.dsn.public;
36
36
  /* c8 ignore next */
37
37
  if (!dsn) throw new ProviderApiError(`Sentry project ${slug} has no keys`, 404, void 0);
38
38
  return {
@@ -42,12 +42,12 @@ var SentryObservability = class {
42
42
  } catch (err) {
43
43
  if (!(err instanceof ProviderApiError) || err.status !== 404) throw err;
44
44
  }
45
- const team = this.opts.team ?? this.opts.org;
46
- const project = await this.client.projects.create(this.opts.org, team, {
45
+ const team = this.opts.team ?? org;
46
+ const project = await this.client.projects.create(org, team, {
47
47
  name: input.name,
48
48
  platform: input.platform ?? "node"
49
49
  });
50
- const dsn = (await this.client.projects.keys(this.opts.org, project.slug))[0]?.dsn.public;
50
+ const dsn = (await this.client.projects.keys(org, project.slug))[0]?.dsn.public;
51
51
  /* c8 ignore next */
52
52
  if (!dsn) throw new ProviderApiError(`Sentry project ${project.slug} has no keys after creation`, 500, void 0);
53
53
  return {
@@ -55,6 +55,15 @@ var SentryObservability = class {
55
55
  alreadyExists: false
56
56
  };
57
57
  }
58
+ /**
59
+ * `org` is optional at construction (the `errors` capability activates from
60
+ * env vars alone), but the management-API calls need it. Validate here so
61
+ * the runtime is never blocked at plugin-load time.
62
+ */
63
+ requireOrg() {
64
+ if (!this.opts.org) throw new Error("@theholocron/holocron-plugin-sentry requires `org` in options for this operation");
65
+ return this.opts.org;
66
+ }
58
67
  };
59
68
  function toSlug(name) {
60
69
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
@@ -82,7 +91,6 @@ async function verifyToken(token, opts = {}) {
82
91
  //#endregion
83
92
  //#region src/index.ts
84
93
  function createContext(options) {
85
- if (!options.org) throw new Error("@theholocron/holocron-plugin-sentry requires `org` in options");
86
94
  return {
87
95
  options,
88
96
  client: createSentryClient({
@@ -92,8 +100,8 @@ function createContext(options) {
92
100
  })
93
101
  };
94
102
  }
95
- function observability(ctx) {
96
- return new SentryObservability(ctx.client, {
103
+ function errors(ctx) {
104
+ return new SentryErrors(ctx.client, {
97
105
  org: ctx.options.org,
98
106
  team: ctx.options.team
99
107
  });
@@ -102,9 +110,9 @@ function createPlugin(options) {
102
110
  const ctx = createContext(options);
103
111
  return {
104
112
  name: "@theholocron/holocron-plugin-sentry",
105
- capabilities: { observability: () => observability(ctx) }
113
+ capabilities: { errors: () => errors(ctx) }
106
114
  };
107
115
  }
108
116
  const AUTH_HINT = "generate an auth token at https://sentry.io/settings/account/api/auth-tokens/ with project:read, project:write, and org:read scopes, then run: holocron auth set sentry <TOKEN>";
109
117
  //#endregion
110
- export { AUTH_HINT, AuthError, SentryObservability, createContext, createPlugin, createSentryClient, observability, resolveToken, verifyToken };
118
+ export { AUTH_HINT, AuthError, SentryErrors, createContext, createPlugin, createSentryClient, errors, resolveToken, verifyToken };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-sentry",
3
- "version": "3.54.0",
4
- "description": "Holocron plugin for Sentry. Implements the observability capability against Sentry's management API — project provisioning and DSN retrieval.",
3
+ "version": "3.55.0",
4
+ "description": "Holocron plugin for Sentry. Implements the errors capability against Sentry's management API — project provisioning and DSN retrieval.",
5
5
  "keywords": [
6
+ "errors",
6
7
  "holocron",
7
- "observability",
8
8
  "plugin",
9
9
  "sentry"
10
10
  ],
@@ -46,11 +46,11 @@
46
46
  "tsx": "4.23.12",
47
47
  "typescript": "^5.9.3",
48
48
  "vitest": "^4.1.11",
49
- "@theholocron/cli": "3.54.0"
49
+ "@theholocron/cli": "3.55.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@theholocron/sentry-client": "^1.14.2",
53
- "@theholocron/cli": "3.54.0"
53
+ "@theholocron/cli": "3.55.0"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "@theholocron/sentry-client": {}