@rustrak/client 0.25.0 → 0.27.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.
Files changed (71) hide show
  1. package/README.md +65 -48
  2. package/dist/client.cjs +5 -4
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.cts +2 -1
  5. package/dist/client.d.cts.map +1 -1
  6. package/dist/client.d.mts +2 -1
  7. package/dist/client.d.mts.map +1 -1
  8. package/dist/client.mjs +6 -5
  9. package/dist/client.mjs.map +1 -1
  10. package/dist/config.d.cts.map +1 -1
  11. package/dist/config.d.mts.map +1 -1
  12. package/dist/errors.cjs +19 -6
  13. package/dist/errors.cjs.map +1 -1
  14. package/dist/errors.d.cts +1 -1
  15. package/dist/errors.d.cts.map +1 -1
  16. package/dist/errors.d.mts +1 -1
  17. package/dist/errors.d.mts.map +1 -1
  18. package/dist/errors.mjs +19 -7
  19. package/dist/errors.mjs.map +1 -1
  20. package/dist/generated/binary.gen.cjs +6 -0
  21. package/dist/generated/binary.gen.cjs.map +1 -0
  22. package/dist/generated/binary.gen.d.cts +2 -0
  23. package/dist/generated/binary.gen.d.cts.map +1 -0
  24. package/dist/generated/binary.gen.d.mts +2 -0
  25. package/dist/generated/binary.gen.d.mts.map +1 -0
  26. package/dist/generated/binary.gen.mjs +6 -0
  27. package/dist/generated/binary.gen.mjs.map +1 -0
  28. package/dist/generated/client/client.gen.d.cts +1 -0
  29. package/dist/generated/client/index.d.cts +10 -0
  30. package/dist/generated/client/types.gen.d.cts +1 -1
  31. package/dist/generated/client/types.gen.d.mts +1 -1
  32. package/dist/generated/client/utils.gen.cjs +1 -1
  33. package/dist/generated/client/utils.gen.d.cts +2 -0
  34. package/dist/generated/client/utils.gen.d.cts.map +1 -1
  35. package/dist/generated/client/utils.gen.mjs +1 -1
  36. package/dist/generated/client.gen.cjs +2 -1
  37. package/dist/generated/client.gen.cjs.map +1 -1
  38. package/dist/generated/client.gen.mjs +1 -1
  39. package/dist/generated/core/params.gen.d.cts +1 -0
  40. package/dist/generated/core/queryKeySerializer.gen.d.cts +1 -0
  41. package/dist/generated/sdk.gen.cjs +797 -599
  42. package/dist/generated/sdk.gen.cjs.map +1 -1
  43. package/dist/generated/sdk.gen.d.cts +49 -28
  44. package/dist/generated/sdk.gen.d.cts.map +1 -1
  45. package/dist/generated/sdk.gen.d.mts +49 -29
  46. package/dist/generated/sdk.gen.d.mts.map +1 -1
  47. package/dist/generated/sdk.gen.mjs +797 -601
  48. package/dist/generated/sdk.gen.mjs.map +1 -1
  49. package/dist/generated/types.gen.d.cts +349 -20
  50. package/dist/generated/types.gen.d.cts.map +1 -1
  51. package/dist/generated/types.gen.d.mts +349 -20
  52. package/dist/generated/types.gen.d.mts.map +1 -1
  53. package/dist/generated/zod.gen.cjs +253 -18
  54. package/dist/generated/zod.gen.cjs.map +1 -1
  55. package/dist/generated/zod.gen.mjs +216 -17
  56. package/dist/generated/zod.gen.mjs.map +1 -1
  57. package/dist/index.cjs +2 -2
  58. package/dist/index.d.cts +3 -3
  59. package/dist/index.d.mts +3 -3
  60. package/dist/index.mjs +2 -2
  61. package/dist/result.cjs +0 -2
  62. package/dist/result.cjs.map +1 -1
  63. package/dist/result.d.cts.map +1 -1
  64. package/dist/result.d.mts.map +1 -1
  65. package/dist/result.mjs +0 -2
  66. package/dist/result.mjs.map +1 -1
  67. package/dist/utils/http.cjs +18 -31
  68. package/dist/utils/http.cjs.map +1 -1
  69. package/dist/utils/http.mjs +20 -32
  70. package/dist/utils/http.mjs.map +1 -1
  71. package/package.json +7 -9
package/dist/errors.d.mts CHANGED
@@ -61,7 +61,7 @@ export type RustrakError = {
61
61
  readonly message: string;
62
62
  };
63
63
  export type RustrakErrorKind = RustrakError['kind'];
64
- export declare const FIELD_ERROR_CODES: readonly ["required", "invalid", "already_exists", "too_short", "too_long", "custom"];
64
+ export declare const FIELD_ERROR_CODES: readonly ["required", "invalid", "already_exists", "too_short", "too_long", "incorrect", "custom"];
65
65
  export type FieldErrorCode = (typeof FIELD_ERROR_CODES)[number];
66
66
  export type FieldError = {
67
67
  readonly field: string;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.mts","names":[],"sources":["../src/errors.ts"],"mappings":"A,YAuBY;WAQG;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WACA,kBAAkB;;WASlB;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WAEA;WACA,kBAAkB;;WAYlB;WACA;WACA;WACA,kBAAkB;;WAMlB;WAAkC;;WAWlC;WACA;WACA;WACA;;WAmBA;WACA;WAEA;;WAQA;WAAmC;;YAGtC,mBAAmB;qBAalB;YAUD,yBAAyB;YAyBzB;WACD;WACA,MAAM;WACN;;qBAOE;qBAQA;qBAGA;wBASG,YAAY,OAAO"}
1
+ {"version":3,"file":"errors.d.mts","names":[],"sources":["../src/errors.ts"],"mappings":"A,YAuBY;WAQG;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WACA,kBAAkB;;WASlB;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WACA,kBAAkB;;WAIlB;WACA;WACA;WAEA;WACA,kBAAkB;;WAYlB;WACA;WACA;WACA,kBAAkB;;WAMlB;WAAkC;;WAWlC;WACA;WACA;WACA;;WAmBA;WACA;WAEA;;WAQA;WAAmC;;YAEtC,mBAAmB;qBAalB;YAUD,yBAAyB;YAyBzB;WACD;WACA,MAAM;WACN;;qBAOE;qBAQA;qBAGA;wBAgBG,YAAY,OAAO"}
package/dist/errors.mjs CHANGED
@@ -16,6 +16,7 @@ const FIELD_ERROR_CODES = [
16
16
  "already_exists",
17
17
  "too_short",
18
18
  "too_long",
19
+ "incorrect",
19
20
  "custom"
20
21
  ];
21
22
  /**
@@ -33,15 +34,26 @@ const NETWORK_ERROR_MESSAGE = "The request could not reach the server.";
33
34
  /** The fixed message a `network` error carries when the client timed out. */
34
35
  const TIMEOUT_ERROR_MESSAGE = "The request timed out.";
35
36
  /**
36
- * Whether retrying the same call could plausibly succeed.
37
- *
38
- * `network` and `server_error` are transient by nature; `rate_limited` clears
39
- * once its window rolls over. Everything else is deterministic: the same
40
- * request will fail the same way.
37
+ * Statuses where the same request may well succeed a moment later. The one
38
+ * rule behind {@link isRetryable} and the transport's automatic retries.
39
+ */
40
+ const TRANSIENT_STATUSES = /* @__PURE__ */ new Set([
41
+ 408,
42
+ 429,
43
+ 500,
44
+ 502,
45
+ 503,
46
+ 504
47
+ ]);
48
+ /**
49
+ * Whether retrying the same call could plausibly succeed: a request that never
50
+ * got a response, or a transient status. A `rate_limited` error says how long
51
+ * to wait in `retryAfter`. Everything else is deterministic: the same request
52
+ * will fail the same way.
41
53
  */
42
54
  function isRetryable(error) {
43
- return error.kind === "network" || error.kind === "server_error" || error.kind === "rate_limited";
55
+ return error.kind === "network" || "status" in error && TRANSIENT_STATUSES.has(error.status);
44
56
  }
45
- export { FIELD_ERROR_CODES, NETWORK_ERROR_MESSAGE, SERVER_ERROR_MESSAGE, TIMEOUT_ERROR_MESSAGE, isRetryable };
57
+ export { FIELD_ERROR_CODES, NETWORK_ERROR_MESSAGE, SERVER_ERROR_MESSAGE, TIMEOUT_ERROR_MESSAGE, TRANSIENT_STATUSES, isRetryable };
46
58
 
47
59
  //# sourceMappingURL=errors.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.mjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["/**\n * The one closed error union `@rustrak/client` reports.\n *\n * It mirrors `apps/server/src/error.rs` variant by variant, plus the three\n * failures that never reach the server (`invalid_request`, `network`,\n * `invalid_response`) and a catch-all so an unanticipated status is still\n * representable rather than unrepresentable.\n *\n * Every member is a plain object: no class, no prototype chain, no `Error`\n * instance. That is what lets a failed `Result` survive `structuredClone` and\n * therefore React's server/client boundary.\n *\n * `status` is `number`, never a literal union. Pinning literals would make a\n * proxy-generated 502 or a future status a type error at the call site rather\n * than a value the consumer can log.\n *\n * `fields` appears on every member that can carry an `AppError` body, because\n * `AppError::with_field` works on all eight Rust variants: a `Forbidden` or a\n * `NotFound` may name an input just as a `Conflict` does. Only the members\n * that never carry a server body at all (`server_error`, which discards it,\n * plus `invalid_request`, `network` and `invalid_response`, which never had\n * one) omit it. See {@link FieldError}.\n */\nexport type RustrakError =\n /**\n * 400. `AppError::Validation`: the server rejected the request.\n *\n * `fields` is present only when the server named the offending inputs; a\n * consumer that ignores it behaves exactly as it did before.\n */\n | {\n readonly kind: 'validation';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 401. `AppError::Unauthorized`: no session, or the session expired. */\n | {\n readonly kind: 'unauthenticated';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 403. `AppError::Forbidden`: authenticated, but not allowed. */\n | {\n readonly kind: 'forbidden';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 404. `AppError::NotFound`. */\n | {\n readonly kind: 'not_found';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /**\n * 409. `AppError::Conflict`.\n *\n * Where `fields` earns its keep: uniqueness is the thing only the server can\n * know, and a taken name or slug is a 409, not a 400.\n */\n | {\n readonly kind: 'conflict';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 410. Reserved for endpoints that retire a resource rather than delete it. */\n | {\n readonly kind: 'gone';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 413. `AppError::PayloadTooLarge`: envelope ingestion only. */\n | {\n readonly kind: 'payload_too_large';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 429. The ingest rate limiter (`routes/ingest.rs`), the one flat body. */\n | {\n readonly kind: 'rate_limited';\n readonly status: number;\n readonly message: string;\n /** Seconds to wait, from the `Retry-After` header, when the server sent one. */\n readonly retryAfter?: number;\n readonly fields?: readonly FieldError[];\n }\n /**\n * Any status below 500 that no other member claims. The catch-all that keeps\n * the union closed but total.\n *\n * Not only 4xx: a 3xx that reached the error path (a redirect ky did not\n * follow), a 408, an unenumerated 4xx, and an opaque `status: 0` all land\n * here. `status` is the field to read; `kind` only says \"no dedicated\n * handling exists for this one\".\n */\n | {\n readonly kind: 'client_error';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /**\n * The caller's own input failed a pre-flight check. Never reached the\n * network, so it has no status.\n */\n | { readonly kind: 'invalid_request'; readonly message: string }\n /**\n * Any 5xx. `AppError::Database` and `AppError::Internal` both land here, and\n * so does anything a reverse proxy generates.\n *\n * `message` is always {@link SERVER_ERROR_MESSAGE}: the server's body is\n * discarded at construction, inside the client, so no consumer can leak a\n * connection string or a filesystem path into a UI. `incidentId` is the\n * forward-compatible slot for a correlation id the server does not send yet.\n */\n | {\n readonly kind: 'server_error';\n readonly status: number;\n readonly message: string;\n readonly incidentId?: string;\n }\n /**\n * The request never got an HTTP response: DNS, connection refused, TLS,\n * timeout, abort. Also a connection that died while the body was still being\n * read, which is a transport failure even though a status line arrived.\n *\n * `message` is always {@link NETWORK_ERROR_MESSAGE} or\n * {@link TIMEOUT_ERROR_MESSAGE}, never the underlying error's own: fetch\n * builds that message by interpolating the request method and URL\n * (`Request failed due to a network error: GET http://rustrak.internal:8080/api/projects`),\n * so echoing it prints a self-hosted deployment's internal host and port into\n * any UI that renders `error.message`.\n *\n * Carries no `cause` for the same reason. `reason` is the machine-readable\n * discriminator a caller needs instead, derived from the error's `name` and\n * never from its message.\n */\n | {\n readonly kind: 'network';\n readonly message: string;\n /** `timeout` when the client gave up waiting; `unreachable` otherwise. */\n readonly reason: 'timeout' | 'unreachable';\n }\n /**\n * A 2xx arrived but the body is not what the schema promises: not JSON, or\n * JSON of the wrong shape.\n *\n * Carries no Zod issues: they embed the offending response data.\n */\n | { readonly kind: 'invalid_response'; readonly message: string };\n\n/** The `kind` discriminant, useful for exhaustive `switch` in consumers. */\nexport type RustrakErrorKind = RustrakError['kind'];\n\n/**\n * Every `code` a {@link FieldError} may carry, mirroring the `FieldErrorCode`\n * enum in `apps/server/src/error.rs`.\n *\n * Deliberately tiny and resource-agnostic. `tests/unit/app-error-contract.test.ts`\n * parses that Rust enum and fails if this list stops matching it, so a variant\n * added on the server cannot ship without a matching entry here.\n *\n * Exported as a value, not only a type, so a consumer can exhaustively switch\n * or validate against it at runtime.\n */\nexport const FIELD_ERROR_CODES = [\n 'required',\n 'invalid',\n 'already_exists',\n 'too_short',\n 'too_long',\n 'custom',\n] as const;\n\n/** The `code` of a {@link FieldError}. */\nexport type FieldErrorCode = (typeof FIELD_ERROR_CODES)[number];\n\n/**\n * One input the server rejected, named as data.\n *\n * `field` is a **dot path into the request body** (`slug`,\n * `credentials.webhook_url`), which is exactly what a form library's\n * `setError` takes.\n *\n * Select the copy shown to the user from `(field, code)` and never from\n * `message`: that is what makes it translatable. `message` is populated only\n * for `code: 'custom'`, where the code set genuinely cannot express the\n * reason, and is then rendered verbatim. The client strips a `message` that\n * arrives on any other code, so the rule holds even against a server that\n * breaks it.\n *\n * The same `(field, code)` pair can mean two things at two statuses:\n * `(role, 'invalid')` is \"not a role at all\" on a 400 and \"a real role, but\n * not acceptable right now\" on a 409. Branch on `kind` as well when the copy\n * has to differ.\n *\n * A `field` naming an input the form does not have must fall back to a\n * form-level error. Passing an unknown path to `setError` registers a\n * phantom field that nothing can ever clear.\n */\nexport type FieldError = {\n readonly field: string;\n readonly code: FieldErrorCode;\n readonly message?: string;\n};\n\n/**\n * The fixed message every `server_error` carries. Exported so a consumer (or a\n * test) can assert that nothing server-supplied survived the 5xx redaction.\n */\nexport const SERVER_ERROR_MESSAGE = 'The server failed to handle the request.';\n\n/**\n * The fixed message a `network` error carries when the request never reached\n * the server. Fixed for the same reason as {@link SERVER_ERROR_MESSAGE}: the\n * underlying message interpolates the request URL, which is the deployment's\n * internal host and port. Read `reason` to branch, not `message`.\n */\nexport const NETWORK_ERROR_MESSAGE = 'The request could not reach the server.';\n\n/** The fixed message a `network` error carries when the client timed out. */\nexport const TIMEOUT_ERROR_MESSAGE = 'The request timed out.';\n\n/**\n * Whether retrying the same call could plausibly succeed.\n *\n * `network` and `server_error` are transient by nature; `rate_limited` clears\n * once its window rolls over. Everything else is deterministic: the same\n * request will fail the same way.\n */\nexport function isRetryable(error: RustrakError): boolean {\n return (\n error.kind === 'network' ||\n error.kind === 'server_error' ||\n error.kind === 'rate_limited'\n );\n}\n"],"mappings":";;;;;;;;;;;;AA2KA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAsCA,MAAa,uBAAuB;;;;;;;AAQpC,MAAa,wBAAwB;;AAGrC,MAAa,wBAAwB;;;;;;;;AASrC,SAAgB,YAAY,OAA8B;CACxD,OACE,MAAM,SAAS,aACf,MAAM,SAAS,kBACf,MAAM,SAAS;AAEnB"}
1
+ {"version":3,"file":"errors.mjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["/**\n * The one closed error union `@rustrak/client` reports.\n *\n * It mirrors `apps/server/src/error.rs` variant by variant, plus the three\n * failures that never reach the server (`invalid_request`, `network`,\n * `invalid_response`) and a catch-all so an unanticipated status is still\n * representable rather than unrepresentable.\n *\n * Every member is a plain object: no class, no prototype chain, no `Error`\n * instance. That is what lets a failed `Result` survive `structuredClone` and\n * therefore React's server/client boundary.\n *\n * `status` is `number`, never a literal union. Pinning literals would make a\n * proxy-generated 502 or a future status a type error at the call site rather\n * than a value the consumer can log.\n *\n * `fields` appears on every member that can carry an `AppError` body, because\n * `AppError::with_field` works on all eight Rust variants: a `Forbidden` or a\n * `NotFound` may name an input just as a `Conflict` does. Only the members\n * that never carry a server body at all (`server_error`, which discards it,\n * plus `invalid_request`, `network` and `invalid_response`, which never had\n * one) omit it. See {@link FieldError}.\n */\nexport type RustrakError =\n /**\n * 400. `AppError::Validation`: the server rejected the request.\n *\n * `fields` is present only when the server named the offending inputs; a\n * consumer that ignores it behaves exactly as it did before.\n */\n | {\n readonly kind: 'validation';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 401. `AppError::Unauthorized`: no session, or the session expired. */\n | {\n readonly kind: 'unauthenticated';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 403. `AppError::Forbidden`: authenticated, but not allowed. */\n | {\n readonly kind: 'forbidden';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 404. `AppError::NotFound`. */\n | {\n readonly kind: 'not_found';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /**\n * 409. `AppError::Conflict`.\n *\n * Where `fields` earns its keep: uniqueness is the thing only the server can\n * know, and a taken name or slug is a 409, not a 400.\n */\n | {\n readonly kind: 'conflict';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 410. Reserved for endpoints that retire a resource rather than delete it. */\n | {\n readonly kind: 'gone';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 413. `AppError::PayloadTooLarge`: envelope ingestion only. */\n | {\n readonly kind: 'payload_too_large';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /** 429. The ingest rate limiter (`routes/ingest.rs`), the one flat body. */\n | {\n readonly kind: 'rate_limited';\n readonly status: number;\n readonly message: string;\n /** Seconds to wait, from the `Retry-After` header, when the server sent one. */\n readonly retryAfter?: number;\n readonly fields?: readonly FieldError[];\n }\n /**\n * Any status below 500 that no other member claims. The catch-all that keeps\n * the union closed but total.\n *\n * Not only 4xx: a 3xx that reached the error path (a redirect `fetch` did\n * not follow), a 408, an unenumerated 4xx, and an opaque `status: 0` all land\n * here. `status` is the field to read; `kind` only says \"no dedicated\n * handling exists for this one\".\n */\n | {\n readonly kind: 'client_error';\n readonly status: number;\n readonly message: string;\n readonly fields?: readonly FieldError[];\n }\n /**\n * The caller's own input failed a pre-flight check. Never reached the\n * network, so it has no status.\n */\n | { readonly kind: 'invalid_request'; readonly message: string }\n /**\n * Any 5xx. `AppError::Database` and `AppError::Internal` both land here, and\n * so does anything a reverse proxy generates.\n *\n * `message` is always {@link SERVER_ERROR_MESSAGE}: the server's body is\n * discarded at construction, inside the client, so no consumer can leak a\n * connection string or a filesystem path into a UI. `incidentId` names the\n * server log line that holds what was discarded, when the body carries one.\n */\n | {\n readonly kind: 'server_error';\n readonly status: number;\n readonly message: string;\n readonly incidentId?: string;\n }\n /**\n * The request never got an HTTP response: DNS, connection refused, TLS,\n * timeout, abort. Also a connection that died while the body was still being\n * read, which is a transport failure even though a status line arrived.\n *\n * `message` is always {@link NETWORK_ERROR_MESSAGE} or\n * {@link TIMEOUT_ERROR_MESSAGE}, never the underlying error's own: fetch\n * builds that message by interpolating the request method and URL\n * (`Request failed due to a network error: GET http://rustrak.internal:8080/api/projects`),\n * so echoing it prints a self-hosted deployment's internal host and port into\n * any UI that renders `error.message`.\n *\n * Carries no `cause` for the same reason. `reason` is the machine-readable\n * discriminator a caller needs instead, derived from the error's `name` and\n * never from its message.\n */\n | {\n readonly kind: 'network';\n readonly message: string;\n /** `timeout` when the client gave up waiting; `unreachable` otherwise. */\n readonly reason: 'timeout' | 'unreachable';\n }\n /**\n * A 2xx arrived but the body is not what the schema promises: not JSON, or\n * JSON of the wrong shape.\n *\n * Carries no Zod issues: they embed the offending response data.\n */\n | { readonly kind: 'invalid_response'; readonly message: string };\n\nexport type RustrakErrorKind = RustrakError['kind'];\n\n/**\n * Every `code` a {@link FieldError} may carry, mirroring the `FieldErrorCode`\n * enum in `apps/server/src/error.rs`.\n *\n * Deliberately tiny and resource-agnostic. `tests/unit/app-error-contract.test.ts`\n * parses that Rust enum and fails if this list stops matching it, so a variant\n * added on the server cannot ship without a matching entry here.\n *\n * Exported as a value, not only a type, so a consumer can exhaustively switch\n * or validate against it at runtime.\n */\nexport const FIELD_ERROR_CODES = [\n 'required',\n 'invalid',\n 'already_exists',\n 'too_short',\n 'too_long',\n 'incorrect',\n 'custom',\n] as const;\n\nexport type FieldErrorCode = (typeof FIELD_ERROR_CODES)[number];\n\n/**\n * One input the server rejected, named as data.\n *\n * `field` is a **dot path into the request body** (`slug`,\n * `credentials.webhook_url`), which is exactly what a form library's\n * `setError` takes.\n *\n * Select the copy shown to the user from `(field, code)` and never from\n * `message`: that is what makes it translatable. `message` is populated only\n * for `code: 'custom'`, where the code set genuinely cannot express the\n * reason, and is then rendered verbatim. The client strips a `message` that\n * arrives on any other code, so the rule holds even against a server that\n * breaks it.\n *\n * The same `(field, code)` pair can mean two things at two statuses:\n * `(role, 'invalid')` is \"not a role at all\" on a 400 and \"a real role, but\n * not acceptable right now\" on a 409. Branch on `kind` as well when the copy\n * has to differ.\n *\n * A `field` naming an input the form does not have must fall back to a\n * form-level error. Passing an unknown path to `setError` registers a\n * phantom field that nothing can ever clear.\n */\nexport type FieldError = {\n readonly field: string;\n readonly code: FieldErrorCode;\n readonly message?: string;\n};\n\n/**\n * The fixed message every `server_error` carries. Exported so a consumer (or a\n * test) can assert that nothing server-supplied survived the 5xx redaction.\n */\nexport const SERVER_ERROR_MESSAGE = 'The server failed to handle the request.';\n\n/**\n * The fixed message a `network` error carries when the request never reached\n * the server. Fixed for the same reason as {@link SERVER_ERROR_MESSAGE}: the\n * underlying message interpolates the request URL, which is the deployment's\n * internal host and port. Read `reason` to branch, not `message`.\n */\nexport const NETWORK_ERROR_MESSAGE = 'The request could not reach the server.';\n\n/** The fixed message a `network` error carries when the client timed out. */\nexport const TIMEOUT_ERROR_MESSAGE = 'The request timed out.';\n\n/**\n * Statuses where the same request may well succeed a moment later. The one\n * rule behind {@link isRetryable} and the transport's automatic retries.\n */\nexport const TRANSIENT_STATUSES: ReadonlySet<number> = new Set([\n 408, 429, 500, 502, 503, 504,\n]);\n\n/**\n * Whether retrying the same call could plausibly succeed: a request that never\n * got a response, or a transient status. A `rate_limited` error says how long\n * to wait in `retryAfter`. Everything else is deterministic: the same request\n * will fail the same way.\n */\nexport function isRetryable(error: RustrakError): boolean {\n return (\n error.kind === 'network' ||\n ('status' in error && TRANSIENT_STATUSES.has(error.status))\n );\n}\n"],"mappings":";;;;;;;;;;;;AA0KA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAqCA,MAAa,uBAAuB;;;;;;;AAQpC,MAAa,wBAAwB;;AAGrC,MAAa,wBAAwB;;;;;AAMrC,MAAa,qCAA0C,IAAI,IAAI;CAC7D;CAAK;CAAK;CAAK;CAAK;CAAK;AAC3B,CAAC;;;;;;;AAQD,SAAgB,YAAY,OAA8B;CACxD,OACE,MAAM,SAAS,aACd,YAAY,SAAS,mBAAmB,IAAI,MAAM,MAAM;AAE7D"}
@@ -0,0 +1,6 @@
1
+ // src/generated/binary.gen.ts
2
+ /** Operations whose 2xx is a file, not JSON. */
3
+ const BINARY = ["events.downloadAttachment"];
4
+ exports.BINARY = BINARY;
5
+
6
+ //# sourceMappingURL=binary.gen.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.gen.cjs","names":[],"sources":["../../src/generated/binary.gen.ts"],"sourcesContent":["// Generated by `pnpm generate` from openapi.json. Do not edit by hand.\n\n/** Operations whose 2xx is a file, not JSON. */\nexport const BINARY = [\n 'events.downloadAttachment',\n] as const;\n"],"mappings":";;AAGA,MAAa,SAAS,CACpB,2BACF"}
@@ -0,0 +1,2 @@
1
+ export declare const BINARY: readonly ["events.downloadAttachment"];
2
+ //# sourceMappingURL=binary.gen.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.gen.d.cts","names":[],"sources":["../../src/generated/binary.gen.ts"],"mappings":"A,qBAGa"}
@@ -0,0 +1,2 @@
1
+ export declare const BINARY: readonly ["events.downloadAttachment"];
2
+ //# sourceMappingURL=binary.gen.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.gen.d.mts","names":[],"sources":["../../src/generated/binary.gen.ts"],"mappings":"A,qBAGa"}
@@ -0,0 +1,6 @@
1
+ // src/generated/binary.gen.ts
2
+ /** Operations whose 2xx is a file, not JSON. */
3
+ const BINARY = ["events.downloadAttachment"];
4
+ export { BINARY };
5
+
6
+ //# sourceMappingURL=binary.gen.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.gen.mjs","names":[],"sources":["../../src/generated/binary.gen.ts"],"sourcesContent":["// Generated by `pnpm generate` from openapi.json. Do not edit by hand.\n\n/** Operations whose 2xx is a file, not JSON. */\nexport const BINARY = [\n 'events.downloadAttachment',\n] as const;\n"],"mappings":";;AAGA,MAAa,SAAS,CACpB,2BACF"}
@@ -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 {}