@rustrak/client 0.26.0 → 0.27.1

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.
Files changed (43) hide show
  1. package/README.md +18 -0
  2. package/dist/client.cjs +4 -4
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.cts.map +1 -1
  5. package/dist/client.d.mts.map +1 -1
  6. package/dist/client.mjs +4 -4
  7. package/dist/client.mjs.map +1 -1
  8. package/dist/generated/client/client.gen.d.cts +1 -0
  9. package/dist/generated/client/index.d.cts +10 -0
  10. package/dist/generated/client/types.gen.d.cts +1 -1
  11. package/dist/generated/client/types.gen.d.mts +1 -1
  12. package/dist/generated/client/utils.gen.cjs +1 -1
  13. package/dist/generated/client/utils.gen.d.cts +2 -0
  14. package/dist/generated/client/utils.gen.d.cts.map +1 -1
  15. package/dist/generated/client/utils.gen.mjs +1 -1
  16. package/dist/generated/client.gen.cjs +2 -1
  17. package/dist/generated/client.gen.cjs.map +1 -1
  18. package/dist/generated/client.gen.mjs +1 -1
  19. package/dist/generated/core/params.gen.d.cts +1 -0
  20. package/dist/generated/core/queryKeySerializer.gen.d.cts +1 -0
  21. package/dist/generated/sdk.gen.cjs +1231 -942
  22. package/dist/generated/sdk.gen.cjs.map +1 -1
  23. package/dist/generated/sdk.gen.d.cts +49 -27
  24. package/dist/generated/sdk.gen.d.cts.map +1 -1
  25. package/dist/generated/sdk.gen.d.mts +49 -28
  26. package/dist/generated/sdk.gen.d.mts.map +1 -1
  27. package/dist/generated/sdk.gen.mjs +1053 -766
  28. package/dist/generated/sdk.gen.mjs.map +1 -1
  29. package/dist/generated/types.gen.d.cts +349 -0
  30. package/dist/generated/types.gen.d.cts.map +1 -1
  31. package/dist/generated/types.gen.d.mts +349 -0
  32. package/dist/generated/types.gen.d.mts.map +1 -1
  33. package/dist/generated/zod.gen.cjs +2076 -1824
  34. package/dist/generated/zod.gen.cjs.map +1 -1
  35. package/dist/generated/zod.gen.mjs +895 -681
  36. package/dist/generated/zod.gen.mjs.map +1 -1
  37. package/dist/index.cjs +2 -2
  38. package/dist/index.d.cts +3 -3
  39. package/dist/index.d.mts +3 -3
  40. package/dist/index.mjs +2 -2
  41. package/dist/utils/http.cjs.map +1 -1
  42. package/dist/utils/http.mjs.map +1 -1
  43. package/package.json +5 -5
package/README.md CHANGED
@@ -355,6 +355,7 @@ Every method, grouped as it hangs off the client (`client.issues.list(...)`).
355
355
  |---|---|---|
356
356
  | `environments.list({ path })` | `GET /api/projects/{project_id}/environments` | Lists the environments a project's issues have been seen in, by name. |
357
357
  | `feedback.list({ path, query? })` | `GET /api/projects/{project_id}/feedback` | Lists user feedback with what each user submitted. |
358
+ | `feedback.listAll({ query? })` | `GET /api/feedback` | Lists user feedback across every project the reader can read issues on. |
358
359
  | `issues.bulkDelete({ path, body })` | `DELETE /api/projects/{project_id}/issues` | Deletes many issues at once, selected by id or by filter. |
359
360
  | `issues.bulkUpdate({ path, body })` | `PUT /api/projects/{project_id}/issues` | Sets the status or priority of many issues at once, by id. |
360
361
  | `issues.createComment({ path, body })` | `POST /api/projects/{project_id}/issues/{issue_id}/comments` | Add a note. |
@@ -367,6 +368,7 @@ Every method, grouped as it hangs off the client (`client.issues.list(...)`).
367
368
  | `issues.getStats({ path, query? })` | `GET /api/projects/{project_id}/issues/{issue_id}/stats` | Zero-filled event-count timeseries. |
368
369
  | `issues.getTagValues({ path })` | `GET /api/projects/{project_id}/issues/{issue_id}/tags/{key}` | Lists the distinct values (with counts) for a tag key across the issue. |
369
370
  | `issues.list({ path, query? })` | `GET /api/projects/{project_id}/issues` | Lists issues for a project with offset-based pagination |
371
+ | `issues.listAll({ query? })` | `GET /api/issues` | Lists issues across every project the reader can read issues on, in the same shape and pages as a project's list. |
370
372
  | `issues.listUserReports({ path, query? })` | `GET /api/projects/{project_id}/issues/{issue_id}/user-reports` | List user feedback for an issue. |
371
373
  | `issues.markSeen({ path })` | `POST /api/projects/{project_id}/issues/{issue_id}/seen` | Mark the issue as seen by the current user. |
372
374
  | `issues.setBookmark({ path, body })` | `PUT /api/projects/{project_id}/issues/{issue_id}/bookmark` | Set/clear the per-user bookmark. |
@@ -432,6 +434,21 @@ Every method, grouped as it hangs off the client (`client.issues.list(...)`).
432
434
  | `releases.list({ path, query? })` | `GET /api/projects/{project_id}/releases` | Lists a project's releases, newest first, with the events, new issues, environments and session health of each. |
433
435
  | `releases.newIssues({ path, query? })` | `GET /api/projects/{project_id}/releases/{release}/new-issues` | Lists the issues first seen in a release. |
434
436
 
437
+ ### Saved Views
438
+
439
+ | Method | Endpoint | Description |
440
+ |---|---|---|
441
+ | `savedViews.create({ path, body })` | `POST /api/projects/{project_id}/views` | Saves a project page's address as a view, personal unless `visibility` is `project`. |
442
+ | `savedViews.delete({ path })` | `DELETE /api/projects/{project_id}/views/{view_id}` | Deletes a project view. |
443
+ | `savedViews.list({ path, query })` | `GET /api/projects/{project_id}/views` | Lists the views of one project page the caller sees: their own and the shared ones. |
444
+ | `savedViews.setDefault({ path, body })` | `PUT /api/projects/{project_id}/views/default` | Sets or clears the view a project page opens on, for the caller or the project. |
445
+ | `savedViews.update({ path, body })` | `PATCH /api/projects/{project_id}/views/{view_id}` | Renames a project view, or changes its address or who sees it. |
446
+ | `workspaceViews.create({ body })` | `POST /api/views` | Saves a workspace page's address as a view, personal unless `visibility` is `project`. |
447
+ | `workspaceViews.delete({ path })` | `DELETE /api/views/{view_id}` | Deletes a workspace view. |
448
+ | `workspaceViews.list({ query })` | `GET /api/views` | Lists the views of one workspace page (one that spans every project). |
449
+ | `workspaceViews.setDefault({ body })` | `PUT /api/views/default` | Sets or clears the view a workspace page opens on, for the caller or everyone. |
450
+ | `workspaceViews.update({ path, body })` | `PATCH /api/views/{view_id}` | Renames a workspace view, or changes its address or who sees it. |
451
+
435
452
  ### Schedules
436
453
 
437
454
  | Method | Endpoint | Description |
@@ -445,6 +462,7 @@ Every method, grouped as it hangs off the client (`client.issues.list(...)`).
445
462
  | `sentry.getIssue({ path })` | `GET /api/0/issues/{issue_id}/` | One issue with its releases and its 24h and 30d series (Sentry's `GroupDetailsEndpoint`). |
446
463
  | `sentry.getLatestEvent({ path })` | `GET /api/0/issues/{issue_id}/events/latest/` | The issue's most recent event (Sentry's `GroupEventDetailsEndpoint`, `issues/endpoints/group_event_details.py`). |
447
464
  | `sentry.listIssues({ path, query? })` | `GET /api/0/projects/{org_slug}/{project_slug}/issues/` | Issues, filtered by `query`, sorted by `sort` and paginated by `cursor` (Sentry's `ProjectGroupIndexEndpoint`, `issues/endpoints/project_group_index.py`). |
465
+ | `sentry.listOrganizationIssues({ path, query? })` | `GET /api/0/organizations/{org_slug}/issues/` | Issues across projects, narrowed by `project`, filtered by `query`, sorted by `sort` and paginated by `cursor` (Sentry's `OrganizationGroupIndexEndpoint`, `issues/endpoints/organization_group_index.py`). |
448
466
  | `sentry.listOrganizations()` | `GET /api/0/organizations/` | The organizations the token belongs to (Sentry's `OrganizationIndexEndpoint`): always the one synthetic org. |
449
467
  | `sentry.listProjects({ query? })` | `GET /api/0/projects/` | The projects the token can see, newest first (Sentry's `ProjectIndexEndpoint`, `core/endpoints/project_index.py`). |
450
468
  | `sentry.listRepos({ path })` | `GET /api/0/organizations/{org_slug}/repos/` | The code repositories connected to the organization (Sentry's `OrganizationRepositoriesEndpoint`). |
package/dist/client.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  const require_binary_gen = require("./generated/binary.gen.cjs");
2
- const require_utils_gen = require("./generated/client/utils.gen.cjs");
3
2
  const require_client_gen = require("./generated/client/client.gen.cjs");
3
+ const require_utils_gen = require("./generated/client/utils.gen.cjs");
4
4
  const require_sdk_gen = require("./generated/sdk.gen.cjs");
5
5
  const require_result = require("./result.cjs");
6
6
  const require_http = require("./utils/http.cjs");
7
- let zod = require("zod");
7
+ let zod_v4_core = require("zod/v4/core");
8
8
  // src/client.ts
9
9
  const BINARY_OPERATIONS = new Set(require_binary_gen.BINARY);
10
10
  /**
@@ -69,7 +69,7 @@ function toResult({ data, error, response }) {
69
69
  if (error === void 0) return require_result.Ok(data);
70
70
  if (error instanceof require_http.RustrakTransportFailure) return require_result.Err(error.rustrakError);
71
71
  if (response && !response.ok) return require_result.Err(require_http.transformHttpError(response, error));
72
- if (!response && error instanceof zod.ZodError) return require_result.Err({
72
+ if (!response && error instanceof zod_v4_core.$ZodError) return require_result.Err({
73
73
  kind: "invalid_request",
74
74
  message: "The request input did not match the expected schema."
75
75
  });
@@ -77,7 +77,7 @@ function toResult({ data, error, response }) {
77
77
  kind: "invalid_response",
78
78
  message: "The server returned a body that is not valid JSON."
79
79
  });
80
- if (response && error instanceof zod.ZodError) return require_result.Err({
80
+ if (response && error instanceof zod_v4_core.$ZodError) return require_result.Err({
81
81
  kind: "invalid_response",
82
82
  message: "The server response did not match the expected schema."
83
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"client.cjs","names":["BINARY","Rustrak","createClient","createConfig","createFetch","Ok","RustrakTransportFailure","Err","transformHttpError","ZodError"],"sources":["../src/client.ts"],"sourcesContent":["import { ZodError } from 'zod';\nimport type { ClientConfig } from './config.js';\nimport type { RustrakError } from './errors.js';\nimport { BINARY } from './generated/binary.gen.js';\nimport { createClient, createConfig } from './generated/client/index.js';\nimport { Rustrak } from './generated/sdk.gen.js';\nimport { Err, Ok, type Result } from './result.js';\nimport {\n createFetch,\n RustrakTransportFailure,\n transformHttpError,\n} from './utils/http.js';\n\n/**\n * Operations whose 2xx is a file, read as a `Blob`. The spec leaves the body\n * untyped (zod has no binary type), so the type comes from this list.\n */\ntype Binary = (typeof BINARY)[number];\nconst BINARY_OPERATIONS: ReadonlySet<string> = new Set(BINARY);\n\n/** What a caller may pass: the request's own parts, never client plumbing. */\ntype RequestKeys = 'path' | 'query' | 'body' | 'headers' | 'signal';\n\ntype Call<F, Bytes extends boolean> = F extends (options: infer O) => infer R\n ? (\n ...args: {} extends Pick<O, Extract<keyof O, RequestKeys>>\n ? [options?: Pick<O, Extract<keyof O, RequestKeys>>]\n : [options: Pick<O, Extract<keyof O, RequestKeys>>]\n ) => Promise<\n Result<Bytes extends true ? Blob : Data<Awaited<R>>, RustrakError>\n >\n : never;\n\n/** The success half of the generated `{ data, error }` union. */\ntype Data<R> =\n Extract<R, { error: undefined }> extends { data: infer D } ? D : never;\n\ntype Resource<T, Name extends string> = {\n readonly [M in keyof T]: Call<\n T[M],\n `${Name}.${M & string}` extends Binary ? true : false\n >;\n};\n\n/**\n * Every operation in `openapi.json`, grouped by tag:\n * `client.issues.list({ path: { project_id } })`.\n *\n * Generated in `src/generated/`; this file only changes what a call returns.\n */\nexport type RustrakClient = {\n readonly [R in keyof Rustrak]: Resource<Rustrak[R], R & string>;\n};\n\n/**\n * Main Rustrak API client. Every method returns a `Result`; nothing throws for\n * an expected failure.\n *\n * @example\n * ```typescript\n * const client = new RustrakClient({\n * baseUrl: 'http://localhost:8080',\n * token: 'your-api-token',\n * });\n *\n * const issues = await client.issues.list({ path: { project_id: 1 } });\n * if (issues.success) console.log(issues.data.items);\n * ```\n */\nexport const RustrakClient = class {\n constructor(config: ClientConfig) {\n // biome-ignore lint/correctness/noConstructorReturn: the instance is the generated SDK with every method wrapped\n return Object.setPrototypeOf(createApi(config), new.target.prototype);\n }\n} as unknown as new (\n config: ClientConfig,\n) => RustrakClient;\n\nfunction createApi(config: ClientConfig): RustrakClient {\n const sdk = new Rustrak({\n client: createClient(\n createConfig({\n baseUrl: config.baseUrl,\n credentials: 'include',\n fetch: createFetch(config),\n // Every 2xx in the spec is JSON or empty, except the files in\n // `BINARY`. `auto` would hand back an HTML page or a stream as a\n // success without validating it.\n parseAs: 'json',\n headers: {\n // Without it a content-negotiating hop can answer with HTML.\n Accept: 'application/json',\n ...config.headers,\n ...(config.token && { Authorization: `Bearer ${config.token}` }),\n },\n }),\n ),\n });\n\n const api: Record<string, Record<string, unknown>> = {};\n for (const name of Object.getOwnPropertyNames(Rustrak.prototype)) {\n if (name === 'constructor') continue;\n const resource = sdk[name as keyof Rustrak] as unknown as Record<\n string,\n (options: object) => Promise<Outcome>\n >;\n const methods: Record<string, unknown> = {};\n for (const method of Object.getOwnPropertyNames(\n Object.getPrototypeOf(resource),\n )) {\n if (method === 'constructor') continue;\n methods[method] = async (options: { headers?: unknown } = {}) =>\n toResult(\n await resource[method]!({\n ...options,\n // A JSON write spreads these into an object, which keeps nothing\n // of a `Headers` or an array of pairs.\n headers:\n options.headers instanceof Headers ||\n Array.isArray(options.headers)\n ? Object.fromEntries(new Headers(options.headers))\n : options.headers,\n ...(BINARY_OPERATIONS.has(`${name}.${method}`) && {\n parseAs: 'blob',\n }),\n throwOnError: false,\n }),\n );\n }\n api[name] = methods;\n }\n return api as unknown as RustrakClient;\n}\n\ntype Outcome = {\n data?: unknown;\n error?: unknown;\n response?: Response;\n};\n\n/**\n * The boundary: the generated client's `{ data, error, response }` becomes a\n * `Result`.\n *\n * Only failures this file recognises become an `Err`. Anything else, a\n * `TypeError` from a genuine bug, is rethrown so it crashes where it can be\n * debugged instead of being laundered into `{ success: false }`.\n */\nfunction toResult({\n data,\n error,\n response,\n}: Outcome): Result<unknown, RustrakError> {\n if (error === undefined) return Ok(data);\n if (error instanceof RustrakTransportFailure) return Err(error.rustrakError);\n if (response && !response.ok) {\n // `error` is the parsed body, or its text when it is not JSON.\n return Err(transformHttpError(response, error));\n }\n if (!response && error instanceof ZodError) {\n return Err({\n kind: 'invalid_request',\n message: 'The request input did not match the expected schema.',\n });\n }\n if (response && error instanceof SyntaxError) {\n return Err({\n kind: 'invalid_response',\n message: 'The server returned a body that is not valid JSON.',\n });\n }\n if (response && error instanceof ZodError) {\n // No Zod issues: they embed the offending response data.\n return Err({\n kind: 'invalid_response',\n message: 'The server response did not match the expected schema.',\n });\n }\n throw error;\n}\n"],"mappings":";;;;;;;;AAkBA,MAAM,oBAAyC,IAAI,IAAIA,mBAAAA,MAAM;;;;;;;;;;;;;;;;AAmD7D,MAAa,gBAAgB,MAAM;CACjC,YAAY,QAAsB;EAEhC,OAAO,OAAO,eAAe,UAAU,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;CAEhD,IAAI,CAAC,YAAY,iBAAiBC,IAAAA,UAChC,OAAOF,eAAAA,IAAI;EACT,MAAM;EACN,SAAS;CACX,CAAC;CAEH,IAAI,YAAY,iBAAiB,aAC/B,OAAOA,eAAAA,IAAI;EACT,MAAM;EACN,SAAS;CACX,CAAC;CAEH,IAAI,YAAY,iBAAiBE,IAAAA,UAE/B,OAAOF,eAAAA,IAAI;EACT,MAAM;EACN,SAAS;CACX,CAAC;CAEH,MAAM;AACR"}
1
+ {"version":3,"file":"client.cjs","names":["BINARY","Rustrak","createClient","createConfig","createFetch","Ok","RustrakTransportFailure","Err","transformHttpError","ZodError"],"sources":["../src/client.ts"],"sourcesContent":["// The core class: what Zod Mini throws, and what classic `ZodError` extends.\nimport { $ZodError as ZodError } from 'zod/v4/core';\nimport type { ClientConfig } from './config.js';\nimport type { RustrakError } from './errors.js';\nimport { BINARY } from './generated/binary.gen.js';\nimport { createClient, createConfig } from './generated/client/index.js';\nimport { Rustrak } from './generated/sdk.gen.js';\nimport { Err, Ok, type Result } from './result.js';\nimport {\n createFetch,\n RustrakTransportFailure,\n transformHttpError,\n} from './utils/http.js';\n\n/**\n * Operations whose 2xx is a file, read as a `Blob`. The spec leaves the body\n * untyped (zod has no binary type), so the type comes from this list.\n */\ntype Binary = (typeof BINARY)[number];\nconst BINARY_OPERATIONS: ReadonlySet<string> = new Set(BINARY);\n\n/** What a caller may pass: the request's own parts, never client plumbing. */\ntype RequestKeys = 'path' | 'query' | 'body' | 'headers' | 'signal';\n\ntype Call<F, Bytes extends boolean> = F extends (options: infer O) => infer R\n ? (\n ...args: {} extends Pick<O, Extract<keyof O, RequestKeys>>\n ? [options?: Pick<O, Extract<keyof O, RequestKeys>>]\n : [options: Pick<O, Extract<keyof O, RequestKeys>>]\n ) => Promise<\n Result<Bytes extends true ? Blob : Data<Awaited<R>>, RustrakError>\n >\n : never;\n\n/** The success half of the generated `{ data, error }` union. */\ntype Data<R> =\n Extract<R, { error: undefined }> extends { data: infer D } ? D : never;\n\ntype Resource<T, Name extends string> = {\n readonly [M in keyof T]: Call<\n T[M],\n `${Name}.${M & string}` extends Binary ? true : false\n >;\n};\n\n/**\n * Every operation in `openapi.json`, grouped by tag:\n * `client.issues.list({ path: { project_id } })`.\n *\n * Generated in `src/generated/`; this file only changes what a call returns.\n */\nexport type RustrakClient = {\n readonly [R in keyof Rustrak]: Resource<Rustrak[R], R & string>;\n};\n\n/**\n * Main Rustrak API client. Every method returns a `Result`; nothing throws for\n * an expected failure.\n *\n * @example\n * ```typescript\n * const client = new RustrakClient({\n * baseUrl: 'http://localhost:8080',\n * token: 'your-api-token',\n * });\n *\n * const issues = await client.issues.list({ path: { project_id: 1 } });\n * if (issues.success) console.log(issues.data.items);\n * ```\n */\nexport const RustrakClient = class {\n constructor(config: ClientConfig) {\n // biome-ignore lint/correctness/noConstructorReturn: the instance is the generated SDK with every method wrapped\n return Object.setPrototypeOf(createApi(config), new.target.prototype);\n }\n} as unknown as new (\n config: ClientConfig,\n) => RustrakClient;\n\nfunction createApi(config: ClientConfig): RustrakClient {\n const sdk = new Rustrak({\n client: createClient(\n createConfig({\n baseUrl: config.baseUrl,\n credentials: 'include',\n fetch: createFetch(config),\n // Every 2xx in the spec is JSON or empty, except the files in\n // `BINARY`. `auto` would hand back an HTML page or a stream as a\n // success without validating it.\n parseAs: 'json',\n headers: {\n // Without it a content-negotiating hop can answer with HTML.\n Accept: 'application/json',\n ...config.headers,\n ...(config.token && { Authorization: `Bearer ${config.token}` }),\n },\n }),\n ),\n });\n\n const api: Record<string, Record<string, unknown>> = {};\n for (const name of Object.getOwnPropertyNames(Rustrak.prototype)) {\n if (name === 'constructor') continue;\n const resource = sdk[name as keyof Rustrak] as unknown as Record<\n string,\n (options: object) => Promise<Outcome>\n >;\n const methods: Record<string, unknown> = {};\n for (const method of Object.getOwnPropertyNames(\n Object.getPrototypeOf(resource),\n )) {\n if (method === 'constructor') continue;\n methods[method] = async (options: { headers?: unknown } = {}) =>\n toResult(\n await resource[method]!({\n ...options,\n // A JSON write spreads these into an object, which keeps nothing\n // of a `Headers` or an array of pairs.\n headers:\n options.headers instanceof Headers ||\n Array.isArray(options.headers)\n ? Object.fromEntries(new Headers(options.headers))\n : options.headers,\n ...(BINARY_OPERATIONS.has(`${name}.${method}`) && {\n parseAs: 'blob',\n }),\n throwOnError: false,\n }),\n );\n }\n api[name] = methods;\n }\n return api as unknown as RustrakClient;\n}\n\ntype Outcome = {\n data?: unknown;\n error?: unknown;\n response?: Response;\n};\n\n/**\n * The boundary: the generated client's `{ data, error, response }` becomes a\n * `Result`.\n *\n * Only failures this file recognises become an `Err`. Anything else, a\n * `TypeError` from a genuine bug, is rethrown so it crashes where it can be\n * debugged instead of being laundered into `{ success: false }`.\n */\nfunction toResult({\n data,\n error,\n response,\n}: Outcome): Result<unknown, RustrakError> {\n if (error === undefined) return Ok(data);\n if (error instanceof RustrakTransportFailure) return Err(error.rustrakError);\n if (response && !response.ok) {\n // `error` is the parsed body, or its text when it is not JSON.\n return Err(transformHttpError(response, error));\n }\n if (!response && error instanceof ZodError) {\n return Err({\n kind: 'invalid_request',\n message: 'The request input did not match the expected schema.',\n });\n }\n if (response && error instanceof SyntaxError) {\n return Err({\n kind: 'invalid_response',\n message: 'The server returned a body that is not valid JSON.',\n });\n }\n if (response && error instanceof ZodError) {\n // No Zod issues: they embed the offending response data.\n return Err({\n kind: 'invalid_response',\n message: 'The server response did not match the expected schema.',\n });\n }\n throw error;\n}\n"],"mappings":";;;;;;;;AAmBA,MAAM,oBAAyC,IAAI,IAAIA,mBAAAA,MAAM;;;;;;;;;;;;;;;;AAmD7D,MAAa,gBAAgB,MAAM;CACjC,YAAY,QAAsB;EAEhC,OAAO,OAAO,eAAe,UAAU,MAAM,GAAG,WAAW,SAAS;CACtE;AACF;AAIA,SAAS,UAAU,QAAqC;CACtD,MAAM,MAAM,IAAIC,gBAAAA,QAAQ,EACtB,QAAQC,mBAAAA,aACNC,kBAAAA,aAAa;EACX,SAAS,OAAO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T,MAAM;EACN,SAAS;CACX,CAAC;CAEH,IAAI,YAAY,iBAAiBE,YAAAA,WAE/B,OAAOF,eAAAA,IAAI;EACT,MAAM;EACN,SAAS;CACX,CAAC;CAEH,MAAM;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.cts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;KAiBK,iBAAiB;KAIjB;KAEA,KAAK,GAAG,yBAAyB,YAAW,eAAe,YAAY,SAEnE,iBAAiB,KAAK,GAAG,cAAc,GAAG,iBACxC,UAAU,KAAK,GAAG,cAAc,GAAG,kBACnC,SAAS,KAAK,GAAG,cAAc,GAAG,mBACpC,QACH,OAAO,qBAAqB,OAAO,KAAK,QAAQ,KAAK;KAKtD,KAAK,KACR,QAAQ;EAAK;;EAA8B,YAAY;IAAM;KAE1D,SAAS,GAAG,mCACL,WAAW,IAAI,KACvB,EAAE,OACC,QAAQ,qBAAqB;YAUxB,4BACA,WAAW,UAAU,SAAS,QAAQ,IAAI;qBAkBzC,oBAMX,QAAQ,iBACL"}
1
+ {"version":3,"file":"client.d.cts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;KAkBK,iBAAiB;KAIjB;KAEA,KAAK,GAAG,yBAAyB,YAAW,eAAe,YAAY,SAEnE,iBAAiB,KAAK,GAAG,cAAc,GAAG,iBACxC,UAAU,KAAK,GAAG,cAAc,GAAG,kBACnC,SAAS,KAAK,GAAG,cAAc,GAAG,mBACpC,QACH,OAAO,qBAAqB,OAAO,KAAK,QAAQ,KAAK;KAKtD,KAAK,KACR,QAAQ;EAAK;;EAA8B,YAAY;IAAM;KAE1D,SAAS,GAAG,mCACL,WAAW,IAAI,KACvB,EAAE,OACC,QAAQ,qBAAqB;YAUxB,4BACA,WAAW,UAAU,SAAS,QAAQ,IAAI;qBAkBzC,oBAMX,QAAQ,iBACL"}
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;KAiBK,iBAAiB;KAIjB;KAEA,KAAK,GAAG,yBAAyB,YAAW,eAAe,YAAY,SAEnE,iBAAiB,KAAK,GAAG,cAAc,GAAG,iBACxC,UAAU,KAAK,GAAG,cAAc,GAAG,kBACnC,SAAS,KAAK,GAAG,cAAc,GAAG,mBACpC,QACH,OAAO,qBAAqB,OAAO,KAAK,QAAQ,KAAK;KAKtD,KAAK,KACR,QAAQ;EAAK;;EAA8B,YAAY;IAAM;KAE1D,SAAS,GAAG,mCACL,WAAW,IAAI,KACvB,EAAE,OACC,QAAQ,qBAAqB;YAUxB,4BACA,WAAW,UAAU,SAAS,QAAQ,IAAI;qBAkBzC,oBAMX,QAAQ,iBACL"}
1
+ {"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;KAkBK,iBAAiB;KAIjB;KAEA,KAAK,GAAG,yBAAyB,YAAW,eAAe,YAAY,SAEnE,iBAAiB,KAAK,GAAG,cAAc,GAAG,iBACxC,UAAU,KAAK,GAAG,cAAc,GAAG,kBACnC,SAAS,KAAK,GAAG,cAAc,GAAG,mBACpC,QACH,OAAO,qBAAqB,OAAO,KAAK,QAAQ,KAAK;KAKtD,KAAK,KACR,QAAQ;EAAK;;EAA8B,YAAY;IAAM;KAE1D,SAAS,GAAG,mCACL,WAAW,IAAI,KACvB,EAAE,OACC,QAAQ,qBAAqB;YAUxB,4BACA,WAAW,UAAU,SAAS,QAAQ,IAAI;qBAkBzC,oBAMX,QAAQ,iBACL"}
package/dist/client.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { BINARY } from "./generated/binary.gen.mjs";
2
- import { createConfig } from "./generated/client/utils.gen.mjs";
3
2
  import { createClient } from "./generated/client/client.gen.mjs";
3
+ import { createConfig } from "./generated/client/utils.gen.mjs";
4
4
  import { Rustrak } from "./generated/sdk.gen.mjs";
5
5
  import { Err, Ok } from "./result.mjs";
6
6
  import { RustrakTransportFailure, createFetch, transformHttpError } from "./utils/http.mjs";
7
- import { ZodError } from "zod";
7
+ import { $ZodError } from "zod/v4/core";
8
8
  // src/client.ts
9
9
  const BINARY_OPERATIONS = new Set(BINARY);
10
10
  /**
@@ -69,7 +69,7 @@ function toResult({ data, error, response }) {
69
69
  if (error === void 0) return Ok(data);
70
70
  if (error instanceof RustrakTransportFailure) return Err(error.rustrakError);
71
71
  if (response && !response.ok) return Err(transformHttpError(response, error));
72
- if (!response && error instanceof ZodError) return Err({
72
+ if (!response && error instanceof $ZodError) return Err({
73
73
  kind: "invalid_request",
74
74
  message: "The request input did not match the expected schema."
75
75
  });
@@ -77,7 +77,7 @@ function toResult({ data, error, response }) {
77
77
  kind: "invalid_response",
78
78
  message: "The server returned a body that is not valid JSON."
79
79
  });
80
- if (response && error instanceof ZodError) return Err({
80
+ if (response && error instanceof $ZodError) return Err({
81
81
  kind: "invalid_response",
82
82
  message: "The server response did not match the expected schema."
83
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import { ZodError } from 'zod';\nimport type { ClientConfig } from './config.js';\nimport type { RustrakError } from './errors.js';\nimport { BINARY } from './generated/binary.gen.js';\nimport { createClient, createConfig } from './generated/client/index.js';\nimport { Rustrak } from './generated/sdk.gen.js';\nimport { Err, Ok, type Result } from './result.js';\nimport {\n createFetch,\n RustrakTransportFailure,\n transformHttpError,\n} from './utils/http.js';\n\n/**\n * Operations whose 2xx is a file, read as a `Blob`. The spec leaves the body\n * untyped (zod has no binary type), so the type comes from this list.\n */\ntype Binary = (typeof BINARY)[number];\nconst BINARY_OPERATIONS: ReadonlySet<string> = new Set(BINARY);\n\n/** What a caller may pass: the request's own parts, never client plumbing. */\ntype RequestKeys = 'path' | 'query' | 'body' | 'headers' | 'signal';\n\ntype Call<F, Bytes extends boolean> = F extends (options: infer O) => infer R\n ? (\n ...args: {} extends Pick<O, Extract<keyof O, RequestKeys>>\n ? [options?: Pick<O, Extract<keyof O, RequestKeys>>]\n : [options: Pick<O, Extract<keyof O, RequestKeys>>]\n ) => Promise<\n Result<Bytes extends true ? Blob : Data<Awaited<R>>, RustrakError>\n >\n : never;\n\n/** The success half of the generated `{ data, error }` union. */\ntype Data<R> =\n Extract<R, { error: undefined }> extends { data: infer D } ? D : never;\n\ntype Resource<T, Name extends string> = {\n readonly [M in keyof T]: Call<\n T[M],\n `${Name}.${M & string}` extends Binary ? true : false\n >;\n};\n\n/**\n * Every operation in `openapi.json`, grouped by tag:\n * `client.issues.list({ path: { project_id } })`.\n *\n * Generated in `src/generated/`; this file only changes what a call returns.\n */\nexport type RustrakClient = {\n readonly [R in keyof Rustrak]: Resource<Rustrak[R], R & string>;\n};\n\n/**\n * Main Rustrak API client. Every method returns a `Result`; nothing throws for\n * an expected failure.\n *\n * @example\n * ```typescript\n * const client = new RustrakClient({\n * baseUrl: 'http://localhost:8080',\n * token: 'your-api-token',\n * });\n *\n * const issues = await client.issues.list({ path: { project_id: 1 } });\n * if (issues.success) console.log(issues.data.items);\n * ```\n */\nexport const RustrakClient = class {\n constructor(config: ClientConfig) {\n // biome-ignore lint/correctness/noConstructorReturn: the instance is the generated SDK with every method wrapped\n return Object.setPrototypeOf(createApi(config), new.target.prototype);\n }\n} as unknown as new (\n config: ClientConfig,\n) => RustrakClient;\n\nfunction createApi(config: ClientConfig): RustrakClient {\n const sdk = new Rustrak({\n client: createClient(\n createConfig({\n baseUrl: config.baseUrl,\n credentials: 'include',\n fetch: createFetch(config),\n // Every 2xx in the spec is JSON or empty, except the files in\n // `BINARY`. `auto` would hand back an HTML page or a stream as a\n // success without validating it.\n parseAs: 'json',\n headers: {\n // Without it a content-negotiating hop can answer with HTML.\n Accept: 'application/json',\n ...config.headers,\n ...(config.token && { Authorization: `Bearer ${config.token}` }),\n },\n }),\n ),\n });\n\n const api: Record<string, Record<string, unknown>> = {};\n for (const name of Object.getOwnPropertyNames(Rustrak.prototype)) {\n if (name === 'constructor') continue;\n const resource = sdk[name as keyof Rustrak] as unknown as Record<\n string,\n (options: object) => Promise<Outcome>\n >;\n const methods: Record<string, unknown> = {};\n for (const method of Object.getOwnPropertyNames(\n Object.getPrototypeOf(resource),\n )) {\n if (method === 'constructor') continue;\n methods[method] = async (options: { headers?: unknown } = {}) =>\n toResult(\n await resource[method]!({\n ...options,\n // A JSON write spreads these into an object, which keeps nothing\n // of a `Headers` or an array of pairs.\n headers:\n options.headers instanceof Headers ||\n Array.isArray(options.headers)\n ? Object.fromEntries(new Headers(options.headers))\n : options.headers,\n ...(BINARY_OPERATIONS.has(`${name}.${method}`) && {\n parseAs: 'blob',\n }),\n throwOnError: false,\n }),\n );\n }\n api[name] = methods;\n }\n return api as unknown as RustrakClient;\n}\n\ntype Outcome = {\n data?: unknown;\n error?: unknown;\n response?: Response;\n};\n\n/**\n * The boundary: the generated client's `{ data, error, response }` becomes a\n * `Result`.\n *\n * Only failures this file recognises become an `Err`. Anything else, a\n * `TypeError` from a genuine bug, is rethrown so it crashes where it can be\n * debugged instead of being laundered into `{ success: false }`.\n */\nfunction toResult({\n data,\n error,\n response,\n}: Outcome): Result<unknown, RustrakError> {\n if (error === undefined) return Ok(data);\n if (error instanceof RustrakTransportFailure) return Err(error.rustrakError);\n if (response && !response.ok) {\n // `error` is the parsed body, or its text when it is not JSON.\n return Err(transformHttpError(response, error));\n }\n if (!response && error instanceof ZodError) {\n return Err({\n kind: 'invalid_request',\n message: 'The request input did not match the expected schema.',\n });\n }\n if (response && error instanceof SyntaxError) {\n return Err({\n kind: 'invalid_response',\n message: 'The server returned a body that is not valid JSON.',\n });\n }\n if (response && error instanceof ZodError) {\n // No Zod issues: they embed the offending response data.\n return Err({\n kind: 'invalid_response',\n message: 'The server response did not match the expected schema.',\n });\n }\n throw error;\n}\n"],"mappings":";;;;;;;;AAkBA,MAAM,oBAAyC,IAAI,IAAI,MAAM;;;;;;;;;;;;;;;;AAmD7D,MAAa,gBAAgB,MAAM;CACjC,YAAY,QAAsB;EAEhC,OAAO,OAAO,eAAe,UAAU,MAAM,GAAG,WAAW,SAAS;CACtE;AACF;AAIA,SAA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ACT,MAAM;EACN,SAAS;CACX,CAAC;CAEH,IAAI,YAAY,iBAAiB,UAE/B,OAAO,IAAI;EACT,MAAM;EACN,SAAS;CACX,CAAC;CAEH,MAAM;AACR"}
1
+ {"version":3,"file":"client.mjs","names":["ZodError"],"sources":["../src/client.ts"],"sourcesContent":["// The core class: what Zod Mini throws, and what classic `ZodError` extends.\nimport { $ZodError as ZodError } from 'zod/v4/core';\nimport type { ClientConfig } from './config.js';\nimport type { RustrakError } from './errors.js';\nimport { BINARY } from './generated/binary.gen.js';\nimport { createClient, createConfig } from './generated/client/index.js';\nimport { Rustrak } from './generated/sdk.gen.js';\nimport { Err, Ok, type Result } from './result.js';\nimport {\n createFetch,\n RustrakTransportFailure,\n transformHttpError,\n} from './utils/http.js';\n\n/**\n * Operations whose 2xx is a file, read as a `Blob`. The spec leaves the body\n * untyped (zod has no binary type), so the type comes from this list.\n */\ntype Binary = (typeof BINARY)[number];\nconst BINARY_OPERATIONS: ReadonlySet<string> = new Set(BINARY);\n\n/** What a caller may pass: the request's own parts, never client plumbing. */\ntype RequestKeys = 'path' | 'query' | 'body' | 'headers' | 'signal';\n\ntype Call<F, Bytes extends boolean> = F extends (options: infer O) => infer R\n ? (\n ...args: {} extends Pick<O, Extract<keyof O, RequestKeys>>\n ? [options?: Pick<O, Extract<keyof O, RequestKeys>>]\n : [options: Pick<O, Extract<keyof O, RequestKeys>>]\n ) => Promise<\n Result<Bytes extends true ? Blob : Data<Awaited<R>>, RustrakError>\n >\n : never;\n\n/** The success half of the generated `{ data, error }` union. */\ntype Data<R> =\n Extract<R, { error: undefined }> extends { data: infer D } ? D : never;\n\ntype Resource<T, Name extends string> = {\n readonly [M in keyof T]: Call<\n T[M],\n `${Name}.${M & string}` extends Binary ? true : false\n >;\n};\n\n/**\n * Every operation in `openapi.json`, grouped by tag:\n * `client.issues.list({ path: { project_id } })`.\n *\n * Generated in `src/generated/`; this file only changes what a call returns.\n */\nexport type RustrakClient = {\n readonly [R in keyof Rustrak]: Resource<Rustrak[R], R & string>;\n};\n\n/**\n * Main Rustrak API client. Every method returns a `Result`; nothing throws for\n * an expected failure.\n *\n * @example\n * ```typescript\n * const client = new RustrakClient({\n * baseUrl: 'http://localhost:8080',\n * token: 'your-api-token',\n * });\n *\n * const issues = await client.issues.list({ path: { project_id: 1 } });\n * if (issues.success) console.log(issues.data.items);\n * ```\n */\nexport const RustrakClient = class {\n constructor(config: ClientConfig) {\n // biome-ignore lint/correctness/noConstructorReturn: the instance is the generated SDK with every method wrapped\n return Object.setPrototypeOf(createApi(config), new.target.prototype);\n }\n} as unknown as new (\n config: ClientConfig,\n) => RustrakClient;\n\nfunction createApi(config: ClientConfig): RustrakClient {\n const sdk = new Rustrak({\n client: createClient(\n createConfig({\n baseUrl: config.baseUrl,\n credentials: 'include',\n fetch: createFetch(config),\n // Every 2xx in the spec is JSON or empty, except the files in\n // `BINARY`. `auto` would hand back an HTML page or a stream as a\n // success without validating it.\n parseAs: 'json',\n headers: {\n // Without it a content-negotiating hop can answer with HTML.\n Accept: 'application/json',\n ...config.headers,\n ...(config.token && { Authorization: `Bearer ${config.token}` }),\n },\n }),\n ),\n });\n\n const api: Record<string, Record<string, unknown>> = {};\n for (const name of Object.getOwnPropertyNames(Rustrak.prototype)) {\n if (name === 'constructor') continue;\n const resource = sdk[name as keyof Rustrak] as unknown as Record<\n string,\n (options: object) => Promise<Outcome>\n >;\n const methods: Record<string, unknown> = {};\n for (const method of Object.getOwnPropertyNames(\n Object.getPrototypeOf(resource),\n )) {\n if (method === 'constructor') continue;\n methods[method] = async (options: { headers?: unknown } = {}) =>\n toResult(\n await resource[method]!({\n ...options,\n // A JSON write spreads these into an object, which keeps nothing\n // of a `Headers` or an array of pairs.\n headers:\n options.headers instanceof Headers ||\n Array.isArray(options.headers)\n ? Object.fromEntries(new Headers(options.headers))\n : options.headers,\n ...(BINARY_OPERATIONS.has(`${name}.${method}`) && {\n parseAs: 'blob',\n }),\n throwOnError: false,\n }),\n );\n }\n api[name] = methods;\n }\n return api as unknown as RustrakClient;\n}\n\ntype Outcome = {\n data?: unknown;\n error?: unknown;\n response?: Response;\n};\n\n/**\n * The boundary: the generated client's `{ data, error, response }` becomes a\n * `Result`.\n *\n * Only failures this file recognises become an `Err`. Anything else, a\n * `TypeError` from a genuine bug, is rethrown so it crashes where it can be\n * debugged instead of being laundered into `{ success: false }`.\n */\nfunction toResult({\n data,\n error,\n response,\n}: Outcome): Result<unknown, RustrakError> {\n if (error === undefined) return Ok(data);\n if (error instanceof RustrakTransportFailure) return Err(error.rustrakError);\n if (response && !response.ok) {\n // `error` is the parsed body, or its text when it is not JSON.\n return Err(transformHttpError(response, error));\n }\n if (!response && error instanceof ZodError) {\n return Err({\n kind: 'invalid_request',\n message: 'The request input did not match the expected schema.',\n });\n }\n if (response && error instanceof SyntaxError) {\n return Err({\n kind: 'invalid_response',\n message: 'The server returned a body that is not valid JSON.',\n });\n }\n if (response && error instanceof ZodError) {\n // No Zod issues: they embed the offending response data.\n return Err({\n kind: 'invalid_response',\n message: 'The server response did not match the expected schema.',\n });\n }\n throw error;\n}\n"],"mappings":";;;;;;;;AAmBA,MAAM,oBAAyC,IAAI,IAAI,MAAM;;;;;;;;;;;;;;;;AAmD7D,MAAa,gBAAgB,MAAM;CACjC,YAAY,QAAsB;EAEhC,OAAO,OAAO,eAAe,UAAU,MAAM,GAAG,WAAW,SAAS;CACtE;AACF;AAIA,SAAS,UAAU,QAAqC;CACtD,MAAM,MAAM,IAAI,QAAQ,EACtB,QAAQ,aACN,aAAa;EACX,SAAS,OAAO;EAChB,aAAa;EACb,OAAO,YAAY,MAAM;EAIzB,SAAS;EACT,SAAS;GAEP,QAAQ;GACR,GAAG,OAAO;GACV,GAAI,OAAO,SAAS,EAAE,eAAe,UAAU,OAAO,QAAQ;EAChE;CACF,CAAC,CACH,EACF,CAAC;CAED,MAAM,MAA+C,CAAC;CACtD,KAAK,MAAM,QAAQ,OAAO,oBAAoB,QAAQ,SAAS,GAAG;EAChE,IAAI,SAAS,eAAe;EAC5B,MAAM,WAAW,IAAI;EAIrB,MAAM,UAAmC,CAAC;EAC1C,KAAK,MAAM,UAAU,OAAO,oBAC1B,OAAO,eAAe,QAAQ,CAChC,GAAG;GACD,IAAI,WAAW,eAAe;GAC9B,QAAQ,UAAU,OAAO,UAAiC,CAAC,MACzD,SACE,MAAM,SAAS,OAAO,CAAE;IACtB,GAAG;IAGH,SACE,QAAQ,mBAAmB,WAC3B,MAAM,QAAQ,QAAQ,OAAO,IACzB,OAAO,YAAY,IAAI,QAAQ,QAAQ,OAAO,CAAC,IAC/C,QAAQ;IACd,GAAI,kBAAkB,IAAI,GAAG,KAAK,GAAG,QAAQ,KAAK,EAChD,SAAS,OACX;IACA,cAAc;GAChB,CAAC,CACH;EACJ;EACA,IAAI,QAAQ;CACd;CACA,OAAO;AACT;;;;;;;;;AAgBA,SAAS,SAAS,EAChB,MACA,OACA,YACyC;CACzC,IAAI,UAAU,KAAA,GAAW,OAAO,GAAG,IAAI;CACvC,IAAI,iBAAiB,yBAAyB,OAAO,IAAI,MAAM,YAAY;CAC3E,IAAI,YAAY,CAAC,SAAS,IAExB,OAAO,IAAI,mBAAmB,UAAU,KAAK,CAAC;CAEhD,IAAI,CAAC,YAAY,iBAAiBA,WAChC,OAAO,IAAI;EACT,MAAM;EACN,SAAS;CACX,CAAC;CAEH,IAAI,YAAY,iBAAiB,aAC/B,OAAO,IAAI;EACT,MAAM;EACN,SAAS;CACX,CAAC;CAEH,IAAI,YAAY,iBAAiBA,WAE/B,OAAO,IAAI;EACT,MAAM;EACN,SAAS;CACX,CAAC;CAEH,MAAM;AACR"}
@@ -0,0 +1 @@
1
+ import "./types.gen.cjs";
@@ -0,0 +1,10 @@
1
+ import { Auth } from "../core/auth.gen.cjs";
2
+ import { QuerySerializerOptions } from "../core/bodySerializer.gen.cjs";
3
+ import "../core/params.gen.cjs";
4
+ import "../core/queryKeySerializer.gen.cjs";
5
+ import { ServerSentEventsResult } from "../core/serverSentEvents.gen.cjs";
6
+ import { ClientMeta } from "../core/types.gen.cjs";
7
+ import "./client.gen.cjs";
8
+ import { Client, ClientOptions, Config, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape } from "./types.gen.cjs";
9
+ import "./utils.gen.cjs";
10
+ export type { Client, ClientMeta, Options, RequestResult, TDataShape };
@@ -1,6 +1,6 @@
1
1
  import { Auth } from "../core/auth.gen.cjs";
2
- import { Client as Client$1, Config as Config$1 } from "../core/types.gen.cjs";
3
2
  import { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen.cjs";
3
+ import { Client as Client$1, Config as Config$1 } from "../core/types.gen.cjs";
4
4
  import { Middleware } from "./utils.gen.cjs";
5
5
  export type ResponseStyle = 'data' | 'fields';
6
6
  export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
@@ -1,6 +1,6 @@
1
1
  import { Auth } from "../core/auth.gen.mjs";
2
- import { Client as Client$1, Config as Config$1 } from "../core/types.gen.mjs";
3
2
  import { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen.mjs";
3
+ import { Client as Client$1, Config as Config$1 } from "../core/types.gen.mjs";
4
4
  import { Middleware } from "./utils.gen.mjs";
5
5
  export type ResponseStyle = 'data' | 'fields';
6
6
  export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
@@ -1,7 +1,7 @@
1
+ const require_auth_gen = require("../core/auth.gen.cjs");
1
2
  const require_bodySerializer_gen = require("../core/bodySerializer.gen.cjs");
2
3
  const require_pathSerializer_gen = require("../core/pathSerializer.gen.cjs");
3
4
  const require_utils_gen = require("../core/utils.gen.cjs");
4
- const require_auth_gen = require("../core/auth.gen.cjs");
5
5
  // src/generated/client/utils.gen.ts
6
6
  const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
7
7
  const querySerializer = (queryParams) => {
@@ -1,3 +1,5 @@
1
+ import "../core/bodySerializer.gen.cjs";
2
+ import "./types.gen.cjs";
1
3
  type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res | undefined, request: Req | undefined, options: Options) => Err | Promise<Err>;
2
4
  type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
3
5
  type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.gen.d.cts","names":[],"sources":["../../../src/generated/client/utils.gen.ts"],"mappings":"A,KAwNK,eAAe,KAAK,KAAK,KAAK,YACjC,OAAO,KAEP,UAAU,iBAEV,SAAS,iBACT,SAAS,YACN,MAAM,QAAQ;KAEd,eAAe,KAAK,YAAY,SAAS,KAAK,SAAS,YAAY,MAAM,QAAQ;KAEjF,eAAe,KAAK,KAAK,YAC5B,UAAU,KACV,SAAS,KACT,SAAS,YACN,MAAM,QAAQ;cAEb,aAAa;EACjB,KAAK,MAAM;EAEX;EAIA,MAAM,aAAa;EAOnB,OAAO,aAAa;EAKpB,oBAAoB,aAAa;EAOjC,OAAO,aAAa,aAAa,IAAI,uBAAuB;EAS5D,IAAI,IAAI;;iBAMO,WAAW,KAAK,KAAK,KAAK;EACzC,OAAO,aAAa,eAAe,KAAK,KAAK,KAAK;EAClD,SAAS,aAAa,eAAe,KAAK;EAC1C,UAAU,aAAa,eAAe,KAAK,KAAK"}
1
+ {"version":3,"file":"utils.gen.d.cts","names":[],"sources":["../../../src/generated/client/utils.gen.ts"],"mappings":";;KAwNK,eAAe,KAAK,KAAK,KAAK,YACjC,OAAO,KAEP,UAAU,iBAEV,SAAS,iBACT,SAAS,YACN,MAAM,QAAQ;KAEd,eAAe,KAAK,YAAY,SAAS,KAAK,SAAS,YAAY,MAAM,QAAQ;KAEjF,eAAe,KAAK,KAAK,YAC5B,UAAU,KACV,SAAS,KACT,SAAS,YACN,MAAM,QAAQ;cAEb,aAAa;EACjB,KAAK,MAAM;EAEX;EAIA,MAAM,aAAa;EAOnB,OAAO,aAAa;EAKpB,oBAAoB,aAAa;EAOjC,OAAO,aAAa,aAAa,IAAI,uBAAuB;EAS5D,IAAI,IAAI;;iBAMO,WAAW,KAAK,KAAK,KAAK;EACzC,OAAO,aAAa,eAAe,KAAK,KAAK,KAAK;EAClD,SAAS,aAAa,eAAe,KAAK;EAC1C,UAAU,aAAa,eAAe,KAAK,KAAK"}
@@ -1,7 +1,7 @@
1
+ import { getAuthToken } from "../core/auth.gen.mjs";
1
2
  import { jsonBodySerializer } from "../core/bodySerializer.gen.mjs";
2
3
  import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from "../core/pathSerializer.gen.mjs";
3
4
  import { getUrl } from "../core/utils.gen.mjs";
4
- import { getAuthToken } from "../core/auth.gen.mjs";
5
5
  // src/generated/client/utils.gen.ts
6
6
  const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
7
7
  const querySerializer = (queryParams) => {
@@ -1,6 +1,7 @@
1
+ const require_client_gen = require("./client/client.gen.cjs");
1
2
  const require_utils_gen = require("./client/utils.gen.cjs");
2
3
  // src/generated/client.gen.ts
3
- const client = require("./client/client.gen.cjs").createClient(require_utils_gen.createConfig({ baseUrl: "/" }));
4
+ const client = require_client_gen.createClient(require_utils_gen.createConfig({ baseUrl: "/" }));
4
5
  exports.client = client;
5
6
 
6
7
  //# sourceMappingURL=client.gen.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.gen.cjs","names":["createClient","createConfig"],"sources":["../../src/generated/client.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\nimport { type Client, type ClientOptions, type Config, createClient, createConfig } from './client/index.js';\nimport type { ClientOptions as ClientOptions2 } from './types.gen.js';\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;\n\nexport const client: Client = createClient(createConfig<ClientOptions2>({ baseUrl: '/' }));\n"],"mappings":";;AAeA,MAAa,S,iCAAiBA,CAAAA,CAAAA,aAAaC,kBAAAA,aAA6B,EAAE,SAAS,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"client.gen.cjs","names":["createClient","createConfig"],"sources":["../../src/generated/client.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\nimport { type Client, type ClientOptions, type Config, createClient, createConfig } from './client/index.js';\nimport type { ClientOptions as ClientOptions2 } from './types.gen.js';\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;\n\nexport const client: Client = createClient(createConfig<ClientOptions2>({ baseUrl: '/' }));\n"],"mappings":";;;AAeA,MAAa,SAAiBA,mBAAAA,aAAaC,kBAAAA,aAA6B,EAAE,SAAS,IAAI,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
- import { createConfig } from "./client/utils.gen.mjs";
2
1
  import { createClient } from "./client/client.gen.mjs";
2
+ import { createConfig } from "./client/utils.gen.mjs";
3
3
  // src/generated/client.gen.ts
4
4
  const client = createClient(createConfig({ baseUrl: "/" }));
5
5
  export { client };
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ export {}