@openmrp/sdk 0.19.5 → 0.19.7

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 (114) 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 +1 -1
  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/src/client.ts +17 -17
  87. package/src/core/api-promise.ts +4 -4
  88. package/src/core/error.ts +2 -2
  89. package/src/core/resource.ts +3 -3
  90. package/src/index.ts +3 -3
  91. package/src/internal/parse.ts +2 -2
  92. package/src/internal/shims.ts +1 -1
  93. package/src/internal/uploads.ts +5 -5
  94. package/src/internal/utils/base64.ts +3 -3
  95. package/src/internal/utils/log.ts +3 -3
  96. package/src/internal/utils/path.ts +2 -2
  97. package/src/internal/utils/values.ts +6 -6
  98. package/src/resources/ai/agents.ts +2 -6
  99. package/src/resources/ai/ai.ts +2 -2
  100. package/src/resources/ai/runs/runs.ts +8 -4
  101. package/src/resources/catalog/items/actions.ts +2 -2
  102. package/src/resources/core/request-logs.ts +36 -2
  103. package/src/resources/messaging/conversations/actions.ts +2 -2
  104. package/src/resources/messaging/conversations/conversations.ts +36 -2
  105. package/src/resources/messaging/email-domains/email-domains.ts +1 -1
  106. package/src/resources/messaging/email-inboxes.ts +8 -8
  107. package/src/resources/messaging/preferences.ts +10 -1
  108. package/src/resources/operations/shipments/actions.ts +1 -1
  109. package/src/resources/sales/sales-orders/sales-orders.ts +4 -4
  110. package/src/version.ts +1 -1
  111. package/version.d.mts +1 -1
  112. package/version.d.ts +1 -1
  113. package/version.js +1 -1
  114. package/version.mjs +1 -1
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.
@@ -181,7 +181,7 @@ export interface CreateEmailInboxRequest {
181
181
  * Leaving this unset makes the agent run on every incoming message, since email
182
182
  * has no reliable @mention convention.
183
183
  */
184
- agent_trigger_policy?: string;
184
+ agent_trigger_policy?: 'mention' | 'keyword' | 'always';
185
185
 
186
186
  /**
187
187
  * Display name for the `From` header of outbound mail.
@@ -244,7 +244,7 @@ export interface EmailInbox {
244
244
  * When no policy is set the agent runs on every incoming message, since email has
245
245
  * no reliable @mention convention.
246
246
  */
247
- agent_trigger_policy: string | null;
247
+ agent_trigger_policy: 'mention' | 'keyword' | 'always' | null;
248
248
 
249
249
  /**
250
250
  * Creation timestamp.
@@ -296,7 +296,7 @@ export interface EmailInbox {
296
296
  * - `disabled`: the inbox stays provisioned and keeps its history, but inbound
297
297
  * mail is dropped without being threaded.
298
298
  */
299
- status: string;
299
+ status: 'active' | 'disabled';
300
300
 
301
301
  /**
302
302
  * Last updated timestamp.
@@ -343,7 +343,7 @@ export interface UpdateEmailInboxRequest {
343
343
  * - `disabled`: the inbox stays provisioned and keeps its history, but inbound
344
344
  * mail is dropped without being threaded.
345
345
  */
346
- status: string;
346
+ status: 'active' | 'disabled';
347
347
 
348
348
  /**
349
349
  * The agent to bind to this inbox to handle incoming mail.
@@ -369,7 +369,7 @@ export interface UpdateEmailInboxRequest {
369
369
  * While no policy has been set, the agent runs on every incoming message, since
370
370
  * email has no reliable @mention convention.
371
371
  */
372
- agent_trigger_policy?: string;
372
+ agent_trigger_policy?: 'mention' | 'keyword' | 'always';
373
373
 
374
374
  /**
375
375
  * Display name for the `From` header of outbound mail.
@@ -437,7 +437,7 @@ export interface EmailInboxCreateParams {
437
437
  * Leaving this unset makes the agent run on every incoming message, since email
438
438
  * has no reliable @mention convention.
439
439
  */
440
- agent_trigger_policy?: string;
440
+ agent_trigger_policy?: 'mention' | 'keyword' | 'always';
441
441
 
442
442
  /**
443
443
  * Body param: Display name for the `From` header of outbound mail.
@@ -478,7 +478,7 @@ export interface EmailInboxUpdateParams {
478
478
  * - `disabled`: the inbox stays provisioned and keeps its history, but inbound
479
479
  * mail is dropped without being threaded.
480
480
  */
481
- status: string;
481
+ status: 'active' | 'disabled';
482
482
 
483
483
  /**
484
484
  * Query param: Sub-objects to expand in the response. When omitted, sub-objects
@@ -511,7 +511,7 @@ export interface EmailInboxUpdateParams {
511
511
  * While no policy has been set, the agent runs on every incoming message, since
512
512
  * email has no reliable @mention convention.
513
513
  */
514
- agent_trigger_policy?: string;
514
+ agent_trigger_policy?: 'mention' | 'keyword' | 'always';
515
515
 
516
516
  /**
517
517
  * Body param: Display name for the `From` header of outbound mail.
@@ -108,7 +108,16 @@ export interface NotificationPreference {
108
108
  * A preference with no category is the user's global default, used for every
109
109
  * category they have not set a specific preference for.
110
110
  */
111
- category: string | null;
111
+ category:
112
+ | 'chat.message'
113
+ | 'chat.mention'
114
+ | 'chat.added'
115
+ | 'order.updated'
116
+ | 'agent.run_completed'
117
+ | 'agent.alert'
118
+ | 'system.broadcast'
119
+ | 'customer.registered'
120
+ | null;
112
121
 
113
122
  /**
114
123
  * Creation timestamp.
@@ -234,7 +234,7 @@ export interface RateShopResult {
234
234
  * replaced every option's carrier rate.
235
235
  * - `none`: standard carrier rates apply with no exemption.
236
236
  */
237
- exemption_type: string | null;
237
+ exemption_type: 'freight_exempt' | 'minimum_order_met' | 'flat_rate' | 'none' | null;
238
238
 
239
239
  /**
240
240
  * Flat shipping amount applied to the options.
@@ -407,7 +407,7 @@ export interface CreateSalesOrderRequest {
407
407
  /**
408
408
  * Fulfillment priority used to rank the order on the shop floor.
409
409
  */
410
- priority_code: string;
410
+ priority_code: 'low' | 'normal' | 'high';
411
411
 
412
412
  /**
413
413
  * Ship-to address ID.
@@ -1570,7 +1570,7 @@ export interface UpdateSalesOrderRequest {
1570
1570
  /**
1571
1571
  * New fulfillment priority for the order.
1572
1572
  */
1573
- priority_code?: string;
1573
+ priority_code?: 'low' | 'normal' | 'high';
1574
1574
 
1575
1575
  /**
1576
1576
  * Date delivery is promised to the customer.
@@ -1839,7 +1839,7 @@ export interface SalesOrderCreateParams {
1839
1839
  /**
1840
1840
  * Body param: Fulfillment priority used to rank the order on the shop floor.
1841
1841
  */
1842
- priority_code: string;
1842
+ priority_code: 'low' | 'normal' | 'high';
1843
1843
 
1844
1844
  /**
1845
1845
  * Body param: Ship-to address ID.
@@ -2131,7 +2131,7 @@ export interface SalesOrderUpdateParams {
2131
2131
  /**
2132
2132
  * Body param: New fulfillment priority for the order.
2133
2133
  */
2134
- priority_code?: string;
2134
+ priority_code?: 'low' | 'normal' | 'high';
2135
2135
 
2136
2136
  /**
2137
2137
  * Body param: Date delivery is promised to the customer.
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.19.5'; // x-release-please-version
1
+ export const VERSION = '0.19.7'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.19.5";
1
+ export declare const VERSION = "0.19.7";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.19.5";
1
+ export declare const VERSION = "0.19.7";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.19.5'; // x-release-please-version
4
+ exports.VERSION = '0.19.7'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.19.5'; // x-release-please-version
1
+ export const VERSION = '0.19.7'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map