@theholocron/holocron-plugin-sentry 3.59.0 → 3.60.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/index.d.mts CHANGED
@@ -15,7 +15,7 @@ declare class SentryErrors implements Errors {
15
15
  private readonly opts;
16
16
  readonly key: "errors";
17
17
  readonly providerName = "sentry";
18
- constructor(client: SentryClient, opts: SentryErrorsOptions);
18
+ constructor(client: () => SentryClient, opts: SentryErrorsOptions);
19
19
  describe(): Promise<{
20
20
  provider: string;
21
21
  envKeys: string[];
@@ -68,7 +68,7 @@ interface SentryPluginOptions extends ResolveTokenInput, SentryErrorsOptions {
68
68
  }
69
69
  interface PluginContext {
70
70
  options: SentryPluginOptions;
71
- client: SentryClient;
71
+ client: () => SentryClient;
72
72
  }
73
73
  declare function createContext(options: SentryPluginOptions): PluginContext;
74
74
  declare function errors(ctx: PluginContext): Errors;
package/dist/index.mjs CHANGED
@@ -25,14 +25,14 @@ var SentryErrors = class {
25
25
  };
26
26
  }
27
27
  async whoami() {
28
- return { org: (await this.client.auth.getOrg(this.requireOrg())).slug };
28
+ return { org: (await this.client().auth.getOrg(this.requireOrg())).slug };
29
29
  }
30
30
  async ensureProject(input) {
31
31
  const org = this.requireOrg();
32
32
  const slug = toSlug(input.name);
33
33
  try {
34
- const existing = await this.client.projects.get(org, slug);
35
- const dsn = (await this.client.projects.keys(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 {
@@ -43,11 +43,11 @@ var SentryErrors = class {
43
43
  if (!(err instanceof ProviderApiError) || err.status !== 404) throw err;
44
44
  }
45
45
  const team = this.opts.team ?? org;
46
- const project = await this.client.projects.create(org, team, {
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(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 {
@@ -91,9 +91,10 @@ async function verifyToken(token, opts = {}) {
91
91
  //#endregion
92
92
  //#region src/index.ts
93
93
  function createContext(options) {
94
+ let client;
94
95
  return {
95
96
  options,
96
- client: createSentryClient({
97
+ client: () => client ??= createSentryClient({
97
98
  token: resolveToken(options),
98
99
  baseUrl: options.baseUrl,
99
100
  fetch: options.fetch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-sentry",
3
- "version": "3.59.0",
3
+ "version": "3.60.0",
4
4
  "description": "Holocron plugin for Sentry. Implements the errors capability against Sentry's management API — project provisioning and DSN retrieval.",
5
5
  "keywords": [
6
6
  "errors",
@@ -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.59.0"
49
+ "@theholocron/cli": "3.60.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@theholocron/sentry-client": "^1.14.2",
53
- "@theholocron/cli": "3.59.0"
53
+ "@theholocron/cli": "3.60.0"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "@theholocron/sentry-client": {}