@theholocron/sentry-client 1.32.0 → 1.33.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.
@@ -0,0 +1,63 @@
1
+ import "@theholocron/http-client";
2
+ import { ErrorSink, Logger } from "@theholocron/observability/core";
3
+ //#region ../../../../../src/utils.d.ts
4
+ interface SentryClientOptions {
5
+ token: string;
6
+ /** Override base URL for testing. Defaults to https://sentry.io/api/0 */
7
+ baseUrl?: string;
8
+ /** Override fetch for testing. Defaults to globalThis.fetch. */
9
+ fetch?: typeof fetch;
10
+ /** Structured logger for request/response diagnostics. Defaults to a no-op. */
11
+ logger?: Logger;
12
+ /** Reports transport failures and unexpected 5xx. Defaults to a no-op. */
13
+ errors?: ErrorSink;
14
+ }
15
+ //#endregion
16
+ //#region ../../../../../src/auth/auth.d.ts
17
+ interface SentryOrganization {
18
+ id: string;
19
+ slug: string;
20
+ name: string;
21
+ }
22
+ //#endregion
23
+ //#region ../../../../../src/projects/projects.d.ts
24
+ interface SentryProject {
25
+ id: string;
26
+ slug: string;
27
+ name: string;
28
+ platform: string | null;
29
+ }
30
+ interface SentryKeyDsn {
31
+ public: string;
32
+ secret: string;
33
+ /** Content Security Policy endpoint. */
34
+ csp: string;
35
+ }
36
+ interface SentryKey {
37
+ id: string;
38
+ label: string;
39
+ public: string;
40
+ secret: string;
41
+ dsn: SentryKeyDsn;
42
+ }
43
+ interface CreateSentryProjectInput {
44
+ name: string;
45
+ platform?: string;
46
+ }
47
+ //#endregion
48
+ //#region ../../../../../src/index.d.ts
49
+ declare function createSentryClient(opts: SentryClientOptions): {
50
+ auth: {
51
+ organizations: () => Promise<SentryOrganization[]>;
52
+ getOrg: (org: string) => Promise<SentryOrganization>;
53
+ };
54
+ projects: {
55
+ list: (org: string) => Promise<SentryProject[]>;
56
+ get: (org: string, slug: string) => Promise<SentryProject>;
57
+ create: (org: string, team: string, input: CreateSentryProjectInput) => Promise<SentryProject>;
58
+ keys: (org: string, slug: string) => Promise<SentryKey[]>;
59
+ };
60
+ };
61
+ type SentryClient = ReturnType<typeof createSentryClient>;
62
+ //#endregion
63
+ export { type CreateSentryProjectInput, SentryClient, type SentryClientOptions, type SentryKey, type SentryKeyDsn, type SentryOrganization, type SentryProject, createSentryClient };
package/dist/index.mjs ADDED
@@ -0,0 +1,56 @@
1
+ import { createRestClient } from "@theholocron/http-client";
2
+ //#region ../../../../../src/auth/auth.ts
3
+ function auth(rest) {
4
+ return {
5
+ /** List all organizations accessible with the current token. */
6
+ organizations: () => rest.request("/organizations/"),
7
+ /** Get a single organization by slug. */
8
+ getOrg: (org) => rest.request(`/organizations/${org}/`)
9
+ };
10
+ }
11
+ //#endregion
12
+ //#region ../../../../../src/projects/projects.ts
13
+ function projects(rest) {
14
+ return {
15
+ /** List all projects in an org. */
16
+ list: (org) => rest.request(`/organizations/${org}/projects/`),
17
+ /** Get a single project by slug. Throws ProviderApiError 404 if not found. */
18
+ get: (org, slug) => rest.request(`/projects/${org}/${slug}/`),
19
+ /**
20
+ * Create a project under a team. Returns the new project.
21
+ * Team slug defaults to org slug when omitted by the caller.
22
+ */
23
+ create: (org, team, input) => rest.request(`/teams/${org}/${team}/projects/`, {
24
+ method: "POST",
25
+ body: {
26
+ name: input.name,
27
+ ...input.platform ? { platform: input.platform } : {}
28
+ }
29
+ }),
30
+ /** List client keys (DSNs) for a project. */
31
+ keys: (org, slug) => rest.request(`/projects/${org}/${slug}/keys/`)
32
+ };
33
+ }
34
+ //#endregion
35
+ //#region ../../../../../src/utils.ts
36
+ function createSentryRestClient(opts) {
37
+ return createRestClient({
38
+ baseUrl: opts.baseUrl ?? "https://sentry.io/api/0",
39
+ token: opts.token,
40
+ vendor: "Sentry",
41
+ fetch: opts.fetch,
42
+ logger: opts.logger,
43
+ errors: opts.errors
44
+ });
45
+ }
46
+ //#endregion
47
+ //#region ../../../../../src/index.ts
48
+ function createSentryClient(opts) {
49
+ const rest = createSentryRestClient(opts);
50
+ return {
51
+ auth: auth(rest),
52
+ projects: projects(rest)
53
+ };
54
+ }
55
+ //#endregion
56
+ export { createSentryClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/sentry-client",
3
- "version": "1.32.0",
3
+ "version": "1.33.0",
4
4
  "description": "A TypeScript client for the Sentry management API",
5
5
  "keywords": [
6
6
  "sentry",
@@ -33,13 +33,13 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@theholocron/observability": "^0.3.0",
36
- "@theholocron/http-client": "^1.32.0"
36
+ "@theholocron/http-client": "^1.33.0"
37
37
  },
38
38
  "devDependencies": {
39
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.5.2",
42
+ "@theholocron/tsdown-config": "^8.6.1",
43
43
  "@theholocron/vitest-config": "^8.2.0",
44
44
  "@types/node": "^26.4.1",
45
45
  "@vitest/coverage-v8": "^5.0.0",