@openmrp/sdk 0.19.3 → 0.19.5
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.
- package/CHANGELOG.md +2 -9
- package/LICENSE +1 -1
- package/README.md +31 -31
- package/client.d.mts +12 -12
- package/client.d.ts +12 -12
- package/client.js +47 -47
- package/client.js.map +1 -1
- package/client.mjs +45 -45
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts +2 -2
- package/core/api-promise.d.ts +2 -2
- package/core/error.d.mts +2 -2
- package/core/error.d.ts +2 -2
- package/core/error.js +4 -4
- package/core/error.mjs +2 -2
- package/core/resource.d.mts +3 -3
- package/core/resource.d.ts +3 -3
- package/index.d.mts +3 -3
- package/index.d.ts +3 -3
- package/index.js +4 -4
- package/index.mjs +3 -3
- package/internal/parse.d.mts +2 -2
- package/internal/parse.d.ts +2 -2
- package/internal/shims.js +1 -1
- package/internal/shims.mjs +1 -1
- package/internal/uploads.d.mts +4 -4
- package/internal/uploads.d.ts +4 -4
- package/internal/utils/base64.js +2 -2
- package/internal/utils/base64.mjs +3 -3
- package/internal/utils/log.d.mts +3 -3
- package/internal/utils/log.d.ts +3 -3
- package/internal/utils/path.js +1 -1
- package/internal/utils/path.mjs +2 -2
- package/internal/utils/values.js +5 -5
- package/internal/utils/values.mjs +6 -6
- package/package.json +3 -3
- package/resources/ai/agents.d.mts +8 -8
- package/resources/ai/agents.d.ts +8 -8
- package/resources/ai/agents.js +6 -6
- package/resources/ai/agents.mjs +6 -6
- package/resources/auth/api-keys/actions.d.mts +2 -2
- package/resources/auth/api-keys/actions.d.ts +2 -2
- package/resources/auth/api-keys/actions.js +2 -2
- package/resources/auth/api-keys/actions.mjs +2 -2
- package/resources/auth/api-keys/api-keys.d.mts +6 -6
- package/resources/auth/api-keys/api-keys.d.ts +6 -6
- package/resources/auth/api-keys/api-keys.js +5 -5
- package/resources/auth/api-keys/api-keys.mjs +5 -5
- package/resources/core/request-logs.d.mts +4 -3
- package/resources/core/request-logs.d.mts.map +1 -1
- package/resources/core/request-logs.d.ts +4 -3
- package/resources/core/request-logs.d.ts.map +1 -1
- package/resources/finance/payment-terms.d.mts +2 -2
- package/resources/finance/payment-terms.d.ts +2 -2
- package/resources/finance/payment-terms.js +2 -2
- package/resources/finance/payment-terms.mjs +2 -2
- package/resources/identity/account-users/account-users.d.mts +2 -2
- package/resources/identity/account-users/account-users.d.ts +2 -2
- package/resources/identity/account-users/account-users.js +2 -2
- package/resources/identity/account-users/account-users.mjs +2 -2
- package/resources/sales/volume-discounts.d.mts +4 -4
- package/resources/sales/volume-discounts.d.mts.map +1 -1
- package/resources/sales/volume-discounts.d.ts +4 -4
- package/resources/sales/volume-discounts.d.ts.map +1 -1
- package/src/client.ts +30 -30
- package/src/core/api-promise.ts +4 -4
- package/src/core/error.ts +2 -2
- package/src/core/resource.ts +3 -3
- package/src/index.ts +3 -3
- package/src/internal/parse.ts +2 -2
- package/src/internal/shims.ts +1 -1
- package/src/internal/uploads.ts +5 -5
- package/src/internal/utils/base64.ts +3 -3
- package/src/internal/utils/log.ts +3 -3
- package/src/internal/utils/path.ts +2 -2
- package/src/internal/utils/values.ts +6 -6
- package/src/resources/ai/agents.ts +8 -8
- package/src/resources/auth/api-keys/actions.ts +2 -2
- package/src/resources/auth/api-keys/api-keys.ts +6 -6
- package/src/resources/core/request-logs.ts +4 -3
- package/src/resources/finance/payment-terms.ts +2 -2
- package/src/resources/identity/account-users/account-users.ts +2 -2
- package/src/resources/sales/volume-discounts.ts +32 -4
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import {
|
|
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
|
|
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
|
|
50
|
+
throw new OpenmrpError(`${name} must be an integer`);
|
|
51
51
|
}
|
|
52
52
|
if (n < 0) {
|
|
53
|
-
throw new
|
|
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
|
|
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
|
|
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 => {
|
|
@@ -54,9 +54,9 @@ export class Agents extends APIResource {
|
|
|
54
54
|
/**
|
|
55
55
|
* Lists the agents available to your account, newest first.
|
|
56
56
|
*
|
|
57
|
-
* Covers both the `system` agents OpenMRP provides to every account and the
|
|
58
|
-
* agents created in yours. Deleted agents are never returned. The `q`
|
|
59
|
-
* matches an agent's name, slug, description, or ID.
|
|
57
|
+
* Covers both the `system` agents OpenMRP provides to every account and the
|
|
58
|
+
* `custom` agents created in yours. Deleted agents are never returned. The `q`
|
|
59
|
+
* parameter matches an agent's name, slug, description, or ID.
|
|
60
60
|
*
|
|
61
61
|
* This endpoint requires the permission: `agents:read`.
|
|
62
62
|
*
|
|
@@ -75,9 +75,9 @@ export class Agents extends APIResource {
|
|
|
75
75
|
/**
|
|
76
76
|
* Retrieves a single agent by ID.
|
|
77
77
|
*
|
|
78
|
-
* Resolves both the `system` agents OpenMRP provides and the `custom` agents in
|
|
79
|
-
* account; the `status` reflects whether the agent is enabled for your
|
|
80
|
-
* specifically.
|
|
78
|
+
* Resolves both the `system` agents OpenMRP provides and the `custom` agents in
|
|
79
|
+
* your account; the `status` reflects whether the agent is enabled for your
|
|
80
|
+
* account specifically.
|
|
81
81
|
*
|
|
82
82
|
* This endpoint requires the permission: `agents:read`.
|
|
83
83
|
*
|
|
@@ -434,8 +434,8 @@ export interface ConfigInput {
|
|
|
434
434
|
/**
|
|
435
435
|
* Instructions that define the agent's role and how it should behave.
|
|
436
436
|
*
|
|
437
|
-
* Sent to the model on every turn of a run, alongside the platform guidance
|
|
438
|
-
* adds automatically.
|
|
437
|
+
* Sent to the model on every turn of a run, alongside the platform guidance
|
|
438
|
+
* OpenMRP adds automatically.
|
|
439
439
|
*/
|
|
440
440
|
system_prompt?: string;
|
|
441
441
|
|
|
@@ -11,7 +11,7 @@ import { path } from '../../../internal/utils/path';
|
|
|
11
11
|
*/
|
|
12
12
|
export class Actions extends APIResource {
|
|
13
13
|
/**
|
|
14
|
-
* Rotates an [API key](https://docs.
|
|
14
|
+
* Rotates an [API key](https://docs.openmrp.ai/api/api-keys) by revoking the
|
|
15
15
|
* existing key and issuing a replacement with the same name, role, and expiration
|
|
16
16
|
* (unless overridden).
|
|
17
17
|
*
|
|
@@ -22,7 +22,7 @@ export class Actions extends APIResource {
|
|
|
22
22
|
*
|
|
23
23
|
* The secret key is returned once and cannot be retrieved later, so you should
|
|
24
24
|
* store it securely. We provide some
|
|
25
|
-
* [recommendations](https://docs.
|
|
25
|
+
* [recommendations](https://docs.openmrp.ai/api/managing-api-keys) on how you can
|
|
26
26
|
* manage your API keys.
|
|
27
27
|
*
|
|
28
28
|
* This endpoint requires the `admin` role type.
|
|
@@ -14,7 +14,7 @@ export class APIKeys extends APIResource {
|
|
|
14
14
|
actions: ActionsAPI.Actions = new ActionsAPI.Actions(this._client);
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Returns [API key](https://docs.
|
|
17
|
+
* Returns [API key](https://docs.openmrp.ai/api/api-keys) metadata by ID.
|
|
18
18
|
*
|
|
19
19
|
* Only the redacted key value is returned. The full secret is available only in
|
|
20
20
|
* the response that issued the key, so a lost secret must be replaced by rotating
|
|
@@ -38,7 +38,7 @@ export class APIKeys extends APIResource {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* Returns a paginated list of [API keys](https://docs.
|
|
41
|
+
* Returns a paginated list of [API keys](https://docs.openmrp.ai/api/api-keys),
|
|
42
42
|
* newest first.
|
|
43
43
|
*
|
|
44
44
|
* Only keys belonging to the account making the request are returned. The search
|
|
@@ -56,7 +56,7 @@ export class APIKeys extends APIResource {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
* Creates an [API key](https://docs.
|
|
59
|
+
* Creates an [API key](https://docs.openmrp.ai/api/api-keys) to authenticate API
|
|
60
60
|
* requests.
|
|
61
61
|
*
|
|
62
62
|
* The key belongs to the account it was created under and only ever acts on behalf
|
|
@@ -65,7 +65,7 @@ export class APIKeys extends APIResource {
|
|
|
65
65
|
*
|
|
66
66
|
* The secret key is returned once and cannot be retrieved later, so you should
|
|
67
67
|
* store it securely. We provide some
|
|
68
|
-
* [recommendations](https://docs.
|
|
68
|
+
* [recommendations](https://docs.openmrp.ai/api/managing-api-keys) on how you can
|
|
69
69
|
* manage your API keys.
|
|
70
70
|
*
|
|
71
71
|
* This endpoint requires the `admin` role type.
|
|
@@ -85,7 +85,7 @@ export class APIKeys extends APIResource {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Revokes an [API key](https://docs.
|
|
88
|
+
* Revokes an [API key](https://docs.openmrp.ai/api/api-keys).
|
|
89
89
|
*
|
|
90
90
|
* Revocation takes effect immediately and cannot be undone; any request still
|
|
91
91
|
* presenting the key is rejected. The key record is kept, so it stays visible in
|
|
@@ -457,7 +457,7 @@ export interface CreatedAPIKey {
|
|
|
457
457
|
*
|
|
458
458
|
* This is the only response that ever contains the secret; if it is lost, rotate
|
|
459
459
|
* the key to issue a new one. Learn more about
|
|
460
|
-
* [managing your API keys](https://docs.
|
|
460
|
+
* [managing your API keys](https://docs.openmrp.ai/api/managing-api-keys).
|
|
461
461
|
*/
|
|
462
462
|
api_key_secret: string;
|
|
463
463
|
|
|
@@ -212,7 +212,7 @@ export interface RequestLog {
|
|
|
212
212
|
/**
|
|
213
213
|
* Request host.
|
|
214
214
|
*
|
|
215
|
-
* Usually `api.
|
|
215
|
+
* Usually `api.openmrp.ai`.
|
|
216
216
|
*/
|
|
217
217
|
host: string;
|
|
218
218
|
|
|
@@ -225,7 +225,8 @@ export interface RequestLog {
|
|
|
225
225
|
* Request latency in microseconds.
|
|
226
226
|
*
|
|
227
227
|
* Measured at the API edge, from the moment the request was received until the
|
|
228
|
-
* response was written, so it excludes network time between your client and
|
|
228
|
+
* response was written, so it excludes network time between your client and
|
|
229
|
+
* OpenMRP.
|
|
229
230
|
*/
|
|
230
231
|
latency_us: number;
|
|
231
232
|
|
|
@@ -436,7 +437,7 @@ export interface RequestLogListParams {
|
|
|
436
437
|
/**
|
|
437
438
|
* Filter by the request host.
|
|
438
439
|
*
|
|
439
|
-
* Typically `api.
|
|
440
|
+
* Typically `api.openmrp.ai`.
|
|
440
441
|
*/
|
|
441
442
|
hosts?: Array<string>;
|
|
442
443
|
|
|
@@ -14,8 +14,8 @@ export class PaymentTerms extends APIResource {
|
|
|
14
14
|
/**
|
|
15
15
|
* Returns a paginated list of payment terms.
|
|
16
16
|
*
|
|
17
|
-
* The list includes both payment terms created by your account and
|
|
18
|
-
* system defaults.
|
|
17
|
+
* The list includes both payment terms created by your account and
|
|
18
|
+
* OpenMRP-provided system defaults.
|
|
19
19
|
*
|
|
20
20
|
* This endpoint requires the permission: `payment_terms:read`.
|
|
21
21
|
*
|
|
@@ -86,7 +86,7 @@ export class AccountUsers extends APIResource {
|
|
|
86
86
|
* const accountUser =
|
|
87
87
|
* await client.identity.accountUsers.create({
|
|
88
88
|
* department_id: 'dp_m0jayebxnkos',
|
|
89
|
-
* email: 'jdoe@
|
|
89
|
+
* email: 'jdoe@openmrp.ai',
|
|
90
90
|
* name: 'John Doe',
|
|
91
91
|
* password: 'QgS7Z8Hhj3&1',
|
|
92
92
|
* preferences: [
|
|
@@ -125,7 +125,7 @@ export class AccountUsers extends APIResource {
|
|
|
125
125
|
* 'acus_e5zu8bde0z3h',
|
|
126
126
|
* {
|
|
127
127
|
* department_id: 'dp_m0jayebxnkos',
|
|
128
|
-
* email: 'jdoe@
|
|
128
|
+
* email: 'jdoe@openmrp.ai',
|
|
129
129
|
* name: 'John Doe',
|
|
130
130
|
* preferences: [
|
|
131
131
|
* {
|
|
@@ -609,7 +609,14 @@ export interface VolumeDiscountListParams {
|
|
|
609
609
|
* Sub-objects to expand in the response. When omitted, sub-objects are returned as
|
|
610
610
|
* `null`.
|
|
611
611
|
*/
|
|
612
|
-
include?: Array<
|
|
612
|
+
include?: Array<
|
|
613
|
+
| 'customer_groups'
|
|
614
|
+
| 'product_lines'
|
|
615
|
+
| 'categories'
|
|
616
|
+
| 'categories.properties'
|
|
617
|
+
| 'attributes'
|
|
618
|
+
| 'acceptable_units'
|
|
619
|
+
>;
|
|
613
620
|
|
|
614
621
|
/**
|
|
615
622
|
* Maximum number of results to return in a single page.
|
|
@@ -629,7 +636,14 @@ export interface VolumeDiscountRetrieveParams {
|
|
|
629
636
|
* Sub-objects to expand in the response. When omitted, sub-objects are returned as
|
|
630
637
|
* `null`.
|
|
631
638
|
*/
|
|
632
|
-
include?: Array<
|
|
639
|
+
include?: Array<
|
|
640
|
+
| 'customer_groups'
|
|
641
|
+
| 'product_lines'
|
|
642
|
+
| 'categories'
|
|
643
|
+
| 'categories.properties'
|
|
644
|
+
| 'attributes'
|
|
645
|
+
| 'acceptable_units'
|
|
646
|
+
>;
|
|
633
647
|
}
|
|
634
648
|
|
|
635
649
|
export interface VolumeDiscountCreateParams {
|
|
@@ -649,7 +663,14 @@ export interface VolumeDiscountCreateParams {
|
|
|
649
663
|
* Query param: Sub-objects to expand in the response. When omitted, sub-objects
|
|
650
664
|
* are returned as `null`.
|
|
651
665
|
*/
|
|
652
|
-
include?: Array<
|
|
666
|
+
include?: Array<
|
|
667
|
+
| 'customer_groups'
|
|
668
|
+
| 'product_lines'
|
|
669
|
+
| 'categories'
|
|
670
|
+
| 'categories.properties'
|
|
671
|
+
| 'attributes'
|
|
672
|
+
| 'acceptable_units'
|
|
673
|
+
>;
|
|
653
674
|
|
|
654
675
|
/**
|
|
655
676
|
* Body param: Attribute IDs to scope the discount to.
|
|
@@ -734,7 +755,14 @@ export interface VolumeDiscountUpdateParams {
|
|
|
734
755
|
* Query param: Sub-objects to expand in the response. When omitted, sub-objects
|
|
735
756
|
* are returned as `null`.
|
|
736
757
|
*/
|
|
737
|
-
include?: Array<
|
|
758
|
+
include?: Array<
|
|
759
|
+
| 'customer_groups'
|
|
760
|
+
| 'product_lines'
|
|
761
|
+
| 'categories'
|
|
762
|
+
| 'categories.properties'
|
|
763
|
+
| 'attributes'
|
|
764
|
+
| 'acceptable_units'
|
|
765
|
+
>;
|
|
738
766
|
|
|
739
767
|
/**
|
|
740
768
|
* Body param: Attribute IDs to set.
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.19.
|
|
1
|
+
export const VERSION = '0.19.5'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.19.
|
|
1
|
+
export declare const VERSION = "0.19.5";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.19.
|
|
1
|
+
export declare const VERSION = "0.19.5";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.19.
|
|
1
|
+
export const VERSION = '0.19.5'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|