@openmrp/sdk 0.19.4 → 0.19.6

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 (119) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +26 -26
  3. package/client.d.mts +4 -4
  4. package/client.d.ts +4 -4
  5. package/client.js +37 -37
  6. package/client.mjs +35 -35
  7. package/core/api-promise.d.mts +2 -2
  8. package/core/api-promise.d.ts +2 -2
  9. package/core/error.d.mts +2 -2
  10. package/core/error.d.ts +2 -2
  11. package/core/error.js +4 -4
  12. package/core/error.mjs +2 -2
  13. package/core/resource.d.mts +3 -3
  14. package/core/resource.d.ts +3 -3
  15. package/index.d.mts +3 -3
  16. package/index.d.ts +3 -3
  17. package/index.js +4 -4
  18. package/index.mjs +3 -3
  19. package/internal/parse.d.mts +2 -2
  20. package/internal/parse.d.ts +2 -2
  21. package/internal/shims.js +1 -1
  22. package/internal/shims.mjs +1 -1
  23. package/internal/uploads.d.mts +4 -4
  24. package/internal/uploads.d.ts +4 -4
  25. package/internal/utils/base64.js +2 -2
  26. package/internal/utils/base64.mjs +3 -3
  27. package/internal/utils/log.d.mts +3 -3
  28. package/internal/utils/log.d.ts +3 -3
  29. package/internal/utils/path.js +1 -1
  30. package/internal/utils/path.mjs +2 -2
  31. package/internal/utils/values.js +5 -5
  32. package/internal/utils/values.mjs +6 -6
  33. package/package.json +2 -2
  34. package/resources/ai/agents.d.mts +2 -6
  35. package/resources/ai/agents.d.mts.map +1 -1
  36. package/resources/ai/agents.d.ts +2 -6
  37. package/resources/ai/agents.d.ts.map +1 -1
  38. package/resources/ai/ai.d.mts +2 -2
  39. package/resources/ai/ai.d.mts.map +1 -1
  40. package/resources/ai/ai.d.ts +2 -2
  41. package/resources/ai/ai.d.ts.map +1 -1
  42. package/resources/ai/runs/runs.d.mts +1 -4
  43. package/resources/ai/runs/runs.d.mts.map +1 -1
  44. package/resources/ai/runs/runs.d.ts +1 -4
  45. package/resources/ai/runs/runs.d.ts.map +1 -1
  46. package/resources/ai/runs/runs.js.map +1 -1
  47. package/resources/ai/runs/runs.mjs.map +1 -1
  48. package/resources/catalog/items/actions.d.mts +2 -2
  49. package/resources/catalog/items/actions.d.mts.map +1 -1
  50. package/resources/catalog/items/actions.d.ts +2 -2
  51. package/resources/catalog/items/actions.d.ts.map +1 -1
  52. package/resources/core/request-logs.d.mts +2 -2
  53. package/resources/core/request-logs.d.mts.map +1 -1
  54. package/resources/core/request-logs.d.ts +2 -2
  55. package/resources/core/request-logs.d.ts.map +1 -1
  56. package/resources/messaging/conversations/actions.d.mts +2 -2
  57. package/resources/messaging/conversations/actions.d.mts.map +1 -1
  58. package/resources/messaging/conversations/actions.d.ts +2 -2
  59. package/resources/messaging/conversations/actions.d.ts.map +1 -1
  60. package/resources/messaging/conversations/conversations.d.mts +2 -2
  61. package/resources/messaging/conversations/conversations.d.mts.map +1 -1
  62. package/resources/messaging/conversations/conversations.d.ts +2 -2
  63. package/resources/messaging/conversations/conversations.d.ts.map +1 -1
  64. package/resources/messaging/conversations/conversations.js.map +1 -1
  65. package/resources/messaging/conversations/conversations.mjs.map +1 -1
  66. package/resources/messaging/email-domains/email-domains.d.mts +1 -1
  67. package/resources/messaging/email-domains/email-domains.d.mts.map +1 -1
  68. package/resources/messaging/email-domains/email-domains.d.ts +1 -1
  69. package/resources/messaging/email-domains/email-domains.d.ts.map +1 -1
  70. package/resources/messaging/email-inboxes.d.mts +8 -8
  71. package/resources/messaging/email-inboxes.d.mts.map +1 -1
  72. package/resources/messaging/email-inboxes.d.ts +8 -8
  73. package/resources/messaging/email-inboxes.d.ts.map +1 -1
  74. package/resources/messaging/preferences.d.mts +1 -1
  75. package/resources/messaging/preferences.d.mts.map +1 -1
  76. package/resources/messaging/preferences.d.ts +1 -1
  77. package/resources/messaging/preferences.d.ts.map +1 -1
  78. package/resources/operations/shipments/actions.d.mts +1 -1
  79. package/resources/operations/shipments/actions.d.mts.map +1 -1
  80. package/resources/operations/shipments/actions.d.ts +1 -1
  81. package/resources/operations/shipments/actions.d.ts.map +1 -1
  82. package/resources/sales/sales-orders/sales-orders.d.mts +4 -4
  83. package/resources/sales/sales-orders/sales-orders.d.mts.map +1 -1
  84. package/resources/sales/sales-orders/sales-orders.d.ts +4 -4
  85. package/resources/sales/sales-orders/sales-orders.d.ts.map +1 -1
  86. package/resources/sales/volume-discounts.d.mts +4 -4
  87. package/resources/sales/volume-discounts.d.mts.map +1 -1
  88. package/resources/sales/volume-discounts.d.ts +4 -4
  89. package/resources/sales/volume-discounts.d.ts.map +1 -1
  90. package/src/client.ts +17 -17
  91. package/src/core/api-promise.ts +4 -4
  92. package/src/core/error.ts +2 -2
  93. package/src/core/resource.ts +3 -3
  94. package/src/index.ts +3 -3
  95. package/src/internal/parse.ts +2 -2
  96. package/src/internal/shims.ts +1 -1
  97. package/src/internal/uploads.ts +5 -5
  98. package/src/internal/utils/base64.ts +3 -3
  99. package/src/internal/utils/log.ts +3 -3
  100. package/src/internal/utils/path.ts +2 -2
  101. package/src/internal/utils/values.ts +6 -6
  102. package/src/resources/ai/agents.ts +2 -6
  103. package/src/resources/ai/ai.ts +2 -2
  104. package/src/resources/ai/runs/runs.ts +8 -4
  105. package/src/resources/catalog/items/actions.ts +2 -2
  106. package/src/resources/core/request-logs.ts +36 -2
  107. package/src/resources/messaging/conversations/actions.ts +2 -2
  108. package/src/resources/messaging/conversations/conversations.ts +36 -2
  109. package/src/resources/messaging/email-domains/email-domains.ts +1 -1
  110. package/src/resources/messaging/email-inboxes.ts +8 -8
  111. package/src/resources/messaging/preferences.ts +10 -1
  112. package/src/resources/operations/shipments/actions.ts +1 -1
  113. package/src/resources/sales/sales-orders/sales-orders.ts +4 -4
  114. package/src/resources/sales/volume-discounts.ts +32 -4
  115. package/src/version.ts +1 -1
  116. package/version.d.mts +1 -1
  117. package/version.d.ts +1 -1
  118. package/version.js +1 -1
  119. package/version.mjs +1 -1
@@ -519,7 +519,7 @@ export interface VolumeDiscountListParams {
519
519
  * Sub-objects to expand in the response. When omitted, sub-objects are returned as
520
520
  * `null`.
521
521
  */
522
- include?: Array<'customer_groups' | 'product_lines' | 'categories' | 'attributes' | 'acceptable_units'>;
522
+ include?: Array<'customer_groups' | 'product_lines' | 'categories' | 'categories.properties' | 'attributes' | 'acceptable_units'>;
523
523
  /**
524
524
  * Maximum number of results to return in a single page.
525
525
  */
@@ -536,7 +536,7 @@ export interface VolumeDiscountRetrieveParams {
536
536
  * Sub-objects to expand in the response. When omitted, sub-objects are returned as
537
537
  * `null`.
538
538
  */
539
- include?: Array<'customer_groups' | 'product_lines' | 'categories' | 'attributes' | 'acceptable_units'>;
539
+ include?: Array<'customer_groups' | 'product_lines' | 'categories' | 'categories.properties' | 'attributes' | 'acceptable_units'>;
540
540
  }
541
541
  export interface VolumeDiscountCreateParams {
542
542
  /**
@@ -553,7 +553,7 @@ export interface VolumeDiscountCreateParams {
553
553
  * Query param: Sub-objects to expand in the response. When omitted, sub-objects
554
554
  * are returned as `null`.
555
555
  */
556
- include?: Array<'customer_groups' | 'product_lines' | 'categories' | 'attributes' | 'acceptable_units'>;
556
+ include?: Array<'customer_groups' | 'product_lines' | 'categories' | 'categories.properties' | 'attributes' | 'acceptable_units'>;
557
557
  /**
558
558
  * Body param: Attribute IDs to scope the discount to.
559
559
  *
@@ -626,7 +626,7 @@ export interface VolumeDiscountUpdateParams {
626
626
  * Query param: Sub-objects to expand in the response. When omitted, sub-objects
627
627
  * are returned as `null`.
628
628
  */
629
- include?: Array<'customer_groups' | 'product_lines' | 'categories' | 'attributes' | 'acceptable_units'>;
629
+ include?: Array<'customer_groups' | 'product_lines' | 'categories' | 'categories.properties' | 'attributes' | 'acceptable_units'>;
630
630
  /**
631
631
  * Body param: Attribute IDs to set.
632
632
  *
@@ -1 +1 @@
1
- {"version":3,"file":"volume-discounts.d.ts","sourceRoot":"","sources":["../../src/resources/sales/volume-discounts.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAA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B,IAAI,sBAAsB,EACrD,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
package/src/client.ts CHANGED
@@ -177,7 +177,7 @@ export interface ClientOptions {
177
177
  /**
178
178
  * API Client for interfacing with the Openmrp API.
179
179
  */
180
- export class Openmrp {
180
+ export class OpenMRP {
181
181
  bearerToken: string | null;
182
182
  openmrpAccountID: string | null;
183
183
 
@@ -222,13 +222,13 @@ export class Openmrp {
222
222
  };
223
223
 
224
224
  if (baseURL && opts.environment) {
225
- throw new Errors.OpenmrpError(
225
+ throw new Errors.OpenMRPError(
226
226
  'Ambiguous URL; The `baseURL` option (or OPENMRP_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null',
227
227
  );
228
228
  }
229
229
 
230
230
  this.baseURL = options.baseURL || environments[options.environment || 'production'];
231
- this.timeout = options.timeout ?? Openmrp.DEFAULT_TIMEOUT /* 1 minute */;
231
+ this.timeout = options.timeout ?? OpenMRP.DEFAULT_TIMEOUT /* 1 minute */;
232
232
  this.logger = options.logger ?? console;
233
233
  const defaultLogLevel = 'warn';
234
234
  // Set default logLevel early so that we can log a warning in parseLogLevel.
@@ -787,10 +787,10 @@ export class Openmrp {
787
787
  }
788
788
  }
789
789
 
790
- static Openmrp = this;
790
+ static OpenMRP = this;
791
791
  static DEFAULT_TIMEOUT = 60000; // 1 minute
792
792
 
793
- static OpenmrpError = Errors.OpenmrpError;
793
+ static OpenMRPError = Errors.OpenMRPError;
794
794
  static APIError = Errors.APIError;
795
795
  static APIConnectionError = Errors.APIConnectionError;
796
796
  static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
@@ -833,18 +833,18 @@ export class Openmrp {
833
833
  settings: API.Settings = new API.Settings(this);
834
834
  }
835
835
 
836
- Openmrp.Auth = Auth;
837
- Openmrp.Core = Core;
838
- Openmrp.Catalog = Catalog;
839
- Openmrp.AI = AI;
840
- Openmrp.Messaging = Messaging;
841
- Openmrp.Sales = Sales;
842
- Openmrp.Finance = Finance;
843
- Openmrp.Operations = Operations;
844
- Openmrp.Identity = Identity;
845
- Openmrp.Settings = Settings;
846
-
847
- export declare namespace Openmrp {
836
+ OpenMRP.Auth = Auth;
837
+ OpenMRP.Core = Core;
838
+ OpenMRP.Catalog = Catalog;
839
+ OpenMRP.AI = AI;
840
+ OpenMRP.Messaging = Messaging;
841
+ OpenMRP.Sales = Sales;
842
+ OpenMRP.Finance = Finance;
843
+ OpenMRP.Operations = Operations;
844
+ OpenMRP.Identity = Identity;
845
+ OpenMRP.Settings = Settings;
846
+
847
+ export declare namespace OpenMRP {
848
848
  export type RequestOptions = Opts.RequestOptions;
849
849
 
850
850
  export { Auth as Auth };
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { type Openmrp } from '../client';
3
+ import { type OpenMRP } from '../client';
4
4
 
5
5
  import { type PromiseOrValue } from '../internal/types';
6
6
  import { APIResponseProps, defaultParseResponse } from '../internal/parse';
@@ -11,13 +11,13 @@ import { APIResponseProps, defaultParseResponse } from '../internal/parse';
11
11
  */
12
12
  export class APIPromise<T> extends Promise<T> {
13
13
  private parsedPromise: Promise<T> | undefined;
14
- #client: Openmrp;
14
+ #client: OpenMRP;
15
15
 
16
16
  constructor(
17
- client: Openmrp,
17
+ client: OpenMRP,
18
18
  private responsePromise: Promise<APIResponseProps>,
19
19
  private parseResponse: (
20
- client: Openmrp,
20
+ client: OpenMRP,
21
21
  props: APIResponseProps,
22
22
  ) => PromiseOrValue<T> = defaultParseResponse,
23
23
  ) {
package/src/core/error.ts CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  import { castToError } from '../internal/errors';
4
4
 
5
- export class OpenmrpError extends Error {}
5
+ export class OpenMRPError extends Error {}
6
6
 
7
7
  export class APIError<
8
8
  TStatus extends number | undefined = number | undefined,
9
9
  THeaders extends Headers | undefined = Headers | undefined,
10
10
  TError extends Object | undefined = Object | undefined,
11
- > extends OpenmrpError {
11
+ > extends OpenMRPError {
12
12
  /** HTTP status for the response that caused the error */
13
13
  readonly status: TStatus;
14
14
  /** HTTP headers for the response that caused the error */
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import type { Openmrp } from '../client';
3
+ import type { OpenMRP } from '../client';
4
4
 
5
5
  export abstract class APIResource {
6
- protected _client: Openmrp;
6
+ protected _client: OpenMRP;
7
7
 
8
- constructor(client: Openmrp) {
8
+ constructor(client: OpenMRP) {
9
9
  this._client = client;
10
10
  }
11
11
  }
package/src/index.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { Openmrp as default } from './client';
3
+ export { OpenMRP as default } from './client';
4
4
 
5
5
  export { type Uploadable, toFile } from './core/uploads';
6
6
  export { APIPromise } from './core/api-promise';
7
- export { Openmrp, type ClientOptions } from './client';
7
+ export { OpenMRP, type ClientOptions } from './client';
8
8
  export {
9
- OpenmrpError,
9
+ OpenMRPError,
10
10
  APIError,
11
11
  APIConnectionError,
12
12
  APIConnectionTimeoutError,
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import type { FinalRequestOptions } from './request-options';
4
- import { type Openmrp } from '../client';
4
+ import { type OpenMRP } from '../client';
5
5
  import { formatRequestDetails, loggerFor } from './utils/log';
6
6
 
7
7
  export type APIResponseProps = {
@@ -13,7 +13,7 @@ export type APIResponseProps = {
13
13
  startTime: number;
14
14
  };
15
15
 
16
- export async function defaultParseResponse<T>(client: Openmrp, props: APIResponseProps): Promise<T> {
16
+ export async function defaultParseResponse<T>(client: OpenMRP, props: APIResponseProps): Promise<T> {
17
17
  const { response, requestLogID, retryOfRequestLogID, startTime } = props;
18
18
  const body = await (async () => {
19
19
  // fetch refuses to read the body when the status code is 204.
@@ -16,7 +16,7 @@ export function getDefaultFetch(): Fetch {
16
16
  }
17
17
 
18
18
  throw new Error(
19
- '`fetch` is not defined as a global; Either pass `fetch` to the client, `new Openmrp({ fetch })` or polyfill the global, `globalThis.fetch = fetch`',
19
+ '`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenMRP({ fetch })` or polyfill the global, `globalThis.fetch = fetch`',
20
20
  );
21
21
  }
22
22
 
@@ -1,6 +1,6 @@
1
1
  import { type RequestOptions } from './request-options';
2
2
  import type { FilePropertyBag, Fetch } from './builtin-types';
3
- import type { Openmrp } from '../client';
3
+ import type { OpenMRP } from '../client';
4
4
  import { ReadableStreamFrom } from './shims';
5
5
 
6
6
  export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView;
@@ -74,7 +74,7 @@ export const isAsyncIterable = (value: any): value is AsyncIterable<any> =>
74
74
  */
75
75
  export const maybeMultipartFormRequestOptions = async (
76
76
  opts: RequestOptions,
77
- fetch: Openmrp | Fetch,
77
+ fetch: OpenMRP | Fetch,
78
78
  ): Promise<RequestOptions> => {
79
79
  if (!hasUploadableValue(opts.body)) return opts;
80
80
 
@@ -85,7 +85,7 @@ type MultipartFormRequestOptions = Omit<RequestOptions, 'body'> & { body: unknow
85
85
 
86
86
  export const multipartFormRequestOptions = async (
87
87
  opts: MultipartFormRequestOptions,
88
- fetch: Openmrp | Fetch,
88
+ fetch: OpenMRP | Fetch,
89
89
  ): Promise<RequestOptions> => {
90
90
  return { ...opts, body: await createForm(opts.body, fetch) };
91
91
  };
@@ -98,7 +98,7 @@ const supportsFormDataMap = /* @__PURE__ */ new WeakMap<Fetch, Promise<boolean>>
98
98
  * This function detects if the fetch function provided supports the global FormData object to avoid
99
99
  * confusing error messages later on.
100
100
  */
101
- function supportsFormData(fetchObject: Openmrp | Fetch): Promise<boolean> {
101
+ function supportsFormData(fetchObject: OpenMRP | Fetch): Promise<boolean> {
102
102
  const fetch: Fetch = typeof fetchObject === 'function' ? fetchObject : (fetchObject as any).fetch;
103
103
  const cached = supportsFormDataMap.get(fetch);
104
104
  if (cached) return cached;
@@ -124,7 +124,7 @@ function supportsFormData(fetchObject: Openmrp | Fetch): Promise<boolean> {
124
124
 
125
125
  export const createForm = async <T = Record<string, unknown>>(
126
126
  body: T | undefined,
127
- fetch: Openmrp | Fetch,
127
+ fetch: OpenMRP | Fetch,
128
128
  ): Promise<FormData> => {
129
129
  if (!(await supportsFormData(fetch))) {
130
130
  throw new TypeError(
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { OpenmrpError } from '../../core/error';
3
+ import { OpenMRPError } from '../../core/error';
4
4
  import { encodeUTF8 } from './bytes';
5
5
 
6
6
  export const toBase64 = (data: string | Uint8Array | null | undefined): string => {
@@ -18,7 +18,7 @@ export const toBase64 = (data: string | Uint8Array | null | undefined): string =
18
18
  return btoa(String.fromCharCode.apply(null, data as any));
19
19
  }
20
20
 
21
- throw new OpenmrpError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
21
+ throw new OpenMRPError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
22
22
  };
23
23
 
24
24
  export const fromBase64 = (str: string): Uint8Array => {
@@ -36,5 +36,5 @@ export const fromBase64 = (str: string): Uint8Array => {
36
36
  return buf;
37
37
  }
38
38
 
39
- throw new OpenmrpError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
39
+ throw new OpenMRPError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
40
40
  };
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { hasOwn } from './values';
4
- import { type Openmrp } from '../../client';
4
+ import { type OpenMRP } from '../../client';
5
5
  import { RequestOptions } from '../request-options';
6
6
 
7
7
  type LogFn = (message: string, ...rest: unknown[]) => void;
@@ -24,7 +24,7 @@ const levelNumbers = {
24
24
  export const parseLogLevel = (
25
25
  maybeLevel: string | undefined,
26
26
  sourceName: string,
27
- client: Openmrp,
27
+ client: OpenMRP,
28
28
  ): LogLevel | undefined => {
29
29
  if (!maybeLevel) {
30
30
  return undefined;
@@ -60,7 +60,7 @@ const noopLogger = {
60
60
 
61
61
  let cachedLoggers = /* @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();
62
62
 
63
- export function loggerFor(client: Openmrp): Logger {
63
+ export function loggerFor(client: OpenMRP): Logger {
64
64
  const logger = client.logger;
65
65
  const logLevel = client.logLevel ?? 'off';
66
66
  if (!logger) {
@@ -1,4 +1,4 @@
1
- import { OpenmrpError } from '../../core/error';
1
+ import { OpenMRPError } from '../../core/error';
2
2
 
3
3
  /**
4
4
  * Percent-encode everything that isn't safe to have in a path without encoding safe chars.
@@ -72,7 +72,7 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
72
72
  return acc + spaces + arrows;
73
73
  }, '');
74
74
 
75
- throw new OpenmrpError(
75
+ throw new OpenMRPError(
76
76
  `Path parameters result in path with invalid segments:\n${invalidSegments
77
77
  .map((e) => e.error)
78
78
  .join('\n')}\n${path}\n${underline}`,
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { OpenmrpError } from '../../core/error';
3
+ import { OpenMRPError } from '../../core/error';
4
4
 
5
5
  // https://url.spec.whatwg.org/#url-scheme-string
6
6
  const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
@@ -39,7 +39,7 @@ export function isObj(obj: unknown): obj is Record<string, unknown> {
39
39
 
40
40
  export const ensurePresent = <T>(value: T | null | undefined): T => {
41
41
  if (value == null) {
42
- throw new OpenmrpError(`Expected a value to be given but received ${value} instead.`);
42
+ throw new OpenMRPError(`Expected a value to be given but received ${value} instead.`);
43
43
  }
44
44
 
45
45
  return value;
@@ -47,10 +47,10 @@ export const ensurePresent = <T>(value: T | null | undefined): T => {
47
47
 
48
48
  export const validatePositiveInteger = (name: string, n: unknown): number => {
49
49
  if (typeof n !== 'number' || !Number.isInteger(n)) {
50
- throw new OpenmrpError(`${name} must be an integer`);
50
+ throw new OpenMRPError(`${name} must be an integer`);
51
51
  }
52
52
  if (n < 0) {
53
- throw new OpenmrpError(`${name} must be a positive integer`);
53
+ throw new OpenMRPError(`${name} must be a positive integer`);
54
54
  }
55
55
  return n;
56
56
  };
@@ -59,14 +59,14 @@ export const coerceInteger = (value: unknown): number => {
59
59
  if (typeof value === 'number') return Math.round(value);
60
60
  if (typeof value === 'string') return parseInt(value, 10);
61
61
 
62
- throw new OpenmrpError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
62
+ throw new OpenMRPError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
63
63
  };
64
64
 
65
65
  export const coerceFloat = (value: unknown): number => {
66
66
  if (typeof value === 'number') return value;
67
67
  if (typeof value === 'string') return parseFloat(value);
68
68
 
69
- throw new OpenmrpError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
69
+ throw new OpenMRPError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
70
70
  };
71
71
 
72
72
  export const coerceBoolean = (value: unknown): boolean => {
@@ -754,10 +754,8 @@ export interface UpdateAgentRequest {
754
754
  export interface UpdateAgentStatusRequest {
755
755
  /**
756
756
  * Account-level status to set for the agent.
757
- *
758
- * Either `active` or `inactive`.
759
757
  */
760
- status: string;
758
+ status: 'active' | 'inactive';
761
759
  }
762
760
 
763
761
  export interface AgentDeleteResponse {}
@@ -945,10 +943,8 @@ export interface AgentUpdateParams {
945
943
  export interface AgentUpdateStatusParams {
946
944
  /**
947
945
  * Body param: Account-level status to set for the agent.
948
- *
949
- * Either `active` or `inactive`.
950
946
  */
951
- status: string;
947
+ status: 'active' | 'inactive';
952
948
 
953
949
  /**
954
950
  * Query param: Sub-objects to expand in the response. When omitted, sub-objects
@@ -122,7 +122,7 @@ export interface AvailableTool {
122
122
  * - `api_endpoint`: an operation of this API exposed as a tool, letting the agent
123
123
  * perform it on the account's behalf.
124
124
  */
125
- category: string;
125
+ category: 'built_in' | 'api_endpoint';
126
126
 
127
127
  /**
128
128
  * JSON schema describing the configuration options this tool accepts.
@@ -174,7 +174,7 @@ export interface AvailableTool {
174
174
  * Role type the caller must have for this tool, when the operation is gated by
175
175
  * role rather than a permission (e.g. `admin`).
176
176
  */
177
- required_role_type: string | null;
177
+ required_role_type: 'admin' | 'user' | 'scanner' | 'sales_rep' | 'agent' | null;
178
178
 
179
179
  /**
180
180
  * A stable identifier used when attaching the tool to an agent.
@@ -536,11 +536,15 @@ export interface RunListParams {
536
536
 
537
537
  /**
538
538
  * Restricts results to runs in this status.
539
- *
540
- * One of `pending`, `running`, `awaiting_input`, `awaiting_approval`, `completed`,
541
- * `failed`, or `cancelled`.
542
539
  */
543
- status?: string;
540
+ status?:
541
+ | 'pending'
542
+ | 'running'
543
+ | 'completed'
544
+ | 'failed'
545
+ | 'cancelled'
546
+ | 'awaiting_input'
547
+ | 'awaiting_approval';
544
548
  }
545
549
 
546
550
  export interface RunRetrieveParams {
@@ -94,7 +94,7 @@ export interface BulkReconcileItemsRequest {
94
94
  * - `addition`: adds the quantity to the item's current quantity.
95
95
  * - `force`: sets the item's current quantity to exactly the given quantity.
96
96
  */
97
- reconcile_type: string;
97
+ reconcile_type: 'addition' | 'force';
98
98
  }
99
99
 
100
100
  /**
@@ -277,7 +277,7 @@ export interface ActionBulkReconcileParams {
277
277
  * - `addition`: adds the quantity to the item's current quantity.
278
278
  * - `force`: sets the item's current quantity to exactly the given quantity.
279
279
  */
280
- reconcile_type: string;
280
+ reconcile_type: 'addition' | 'force';
281
281
  }
282
282
 
283
283
  export declare namespace Actions {
@@ -200,7 +200,41 @@ export interface RequestLog {
200
200
  * Matches the `code` of the error response the caller received. Populated only for
201
201
  * failed requests.
202
202
  */
203
- error_code: string | null;
203
+ error_code:
204
+ | 'expired_token'
205
+ | 'api_key_expired'
206
+ | 'api_key_revoked'
207
+ | 'invalid_credentials'
208
+ | 'insufficient_permissions'
209
+ | 'payment_required'
210
+ | 'agent_spending_cap_reached'
211
+ | 'validation_failed'
212
+ | 'missing_field'
213
+ | 'invalid_format'
214
+ | 'method_not_allowed'
215
+ | 'resource_not_found'
216
+ | 'resource_exists'
217
+ | 'resource_conflict'
218
+ | 'resource_gone'
219
+ | 'idempotency_in_progress'
220
+ | 'limit_exceeded'
221
+ | 'registration_closed'
222
+ | 'rate_limit_exceeded'
223
+ | 'parameter_missing'
224
+ | 'parameter_invalid'
225
+ | 'parameter_unknown'
226
+ | 'parameters_exclusive'
227
+ | 'internal_error'
228
+ | 'service_unavailable'
229
+ | 'external_service_error'
230
+ | 'timeout'
231
+ | 'connection_error'
232
+ | 'request_timeout'
233
+ | 'client_closed_request'
234
+ | 'api_version_required'
235
+ | 'api_version_invalid'
236
+ | 'api_version_too_old'
237
+ | null;
204
238
 
205
239
  /**
206
240
  * Human-readable error message.
@@ -233,7 +267,7 @@ export interface RequestLog {
233
267
  /**
234
268
  * HTTP method.
235
269
  */
236
- method: string;
270
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
237
271
 
238
272
  /**
239
273
  * The route template the request matched, with path parameters left as
@@ -423,7 +423,7 @@ export interface AssignConversationRequest {
423
423
  * - `account_user`: an individual teammate takes the case.
424
424
  * - `account_group`: a team takes the case, so anyone on it can pick it up.
425
425
  */
426
- assignee_resource_type?: string;
426
+ assignee_resource_type?: 'account_user' | 'account_group';
427
427
  }
428
428
 
429
429
  /**
@@ -776,7 +776,7 @@ export interface ActionAssignParams {
776
776
  * - `account_user`: an individual teammate takes the case.
777
777
  * - `account_group`: a team takes the case, so anyone on it can pick it up.
778
778
  */
779
- assignee_resource_type?: string;
779
+ assignee_resource_type?: 'account_user' | 'account_group';
780
780
  }
781
781
 
782
782
  export interface ActionReportParams {
@@ -900,7 +900,41 @@ export interface Message {
900
900
  * `agent_spending_cap_reached`, for example, is a cue to offer raising the agent
901
901
  * spending limit.
902
902
  */
903
- agent_error_code: string | null;
903
+ agent_error_code:
904
+ | 'expired_token'
905
+ | 'api_key_expired'
906
+ | 'api_key_revoked'
907
+ | 'invalid_credentials'
908
+ | 'insufficient_permissions'
909
+ | 'payment_required'
910
+ | 'agent_spending_cap_reached'
911
+ | 'validation_failed'
912
+ | 'missing_field'
913
+ | 'invalid_format'
914
+ | 'method_not_allowed'
915
+ | 'resource_not_found'
916
+ | 'resource_exists'
917
+ | 'resource_conflict'
918
+ | 'resource_gone'
919
+ | 'idempotency_in_progress'
920
+ | 'limit_exceeded'
921
+ | 'registration_closed'
922
+ | 'rate_limit_exceeded'
923
+ | 'parameter_missing'
924
+ | 'parameter_invalid'
925
+ | 'parameter_unknown'
926
+ | 'parameters_exclusive'
927
+ | 'internal_error'
928
+ | 'service_unavailable'
929
+ | 'external_service_error'
930
+ | 'timeout'
931
+ | 'connection_error'
932
+ | 'request_timeout'
933
+ | 'client_closed_request'
934
+ | 'api_version_required'
935
+ | 'api_version_invalid'
936
+ | 'api_version_too_old'
937
+ | null;
904
938
 
905
939
  /**
906
940
  * A single execution of an agent, from trigger through completion.
@@ -1049,7 +1083,7 @@ export interface Message {
1049
1083
  * `streaming` means the body is still being generated and keeps growing as
1050
1084
  * realtime updates arrive; `complete` means it is final.
1051
1085
  */
1052
- streaming_state: string | null;
1086
+ streaming_state: 'streaming' | 'complete' | null;
1053
1087
 
1054
1088
  /**
1055
1089
  * The email subject line.
@@ -153,7 +153,7 @@ export interface EmailDomain {
153
153
  *
154
154
  * Inboxes can only be created on a `verified` domain.
155
155
  */
156
- status: string;
156
+ status: 'pending' | 'verified' | 'failed';
157
157
 
158
158
  /**
159
159
  * Last updated timestamp.