@orth/sdk 0.3.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +157 -24
- package/dist/index.d.mts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +50 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,11 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Orthogonal SDK
|
|
4
|
+
|
|
5
|
+
**Call any API on the [Orthogonal](https://orthogonal.com) platform from TypeScript — one client, one balance.**
|
|
6
|
+
|
|
7
|
+
Reach hundreds of production APIs through a single client and a single credit balance. No per-provider signups, keys, or contracts — authentication, routing, and billing are handled for you.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@orth/sdk)
|
|
10
|
+
[](https://www.npmjs.com/package/@orth/sdk)
|
|
11
|
+
[](https://www.npmjs.com/package/@orth/sdk)
|
|
12
|
+
[](https://nodejs.org)
|
|
13
|
+
[](./LICENSE)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
## Table of Contents
|
|
18
|
+
|
|
19
|
+
- [Why Orthogonal](#why-orthogonal)
|
|
20
|
+
- [Installation](#installation)
|
|
21
|
+
- [Quick Start](#quick-start)
|
|
22
|
+
- [Authentication](#authentication)
|
|
23
|
+
- [Usage](#usage)
|
|
24
|
+
- [Error Handling](#error-handling)
|
|
25
|
+
- [API Reference](#api-reference)
|
|
26
|
+
- [TypeScript](#typescript)
|
|
27
|
+
- [Related](#related)
|
|
28
|
+
- [License](#license)
|
|
29
|
+
|
|
30
|
+
## Why Orthogonal
|
|
31
|
+
|
|
32
|
+
Orthogonal is a marketplace of production APIs behind one account and one balance:
|
|
33
|
+
|
|
34
|
+
- **One integration** — call any API on the platform through a single `run()` method.
|
|
35
|
+
- **Pay per use** — a single credit balance instead of juggling dozens of provider subscriptions.
|
|
36
|
+
- **Self-correcting errors** — failed calls carry a structured hint (expected schema, unexpected/missing fields, numeric bounds) so agents can fix and retry.
|
|
37
|
+
- **Fully typed** — ships with TypeScript definitions and ESM + CJS builds.
|
|
4
38
|
|
|
5
39
|
## Installation
|
|
6
40
|
|
|
41
|
+
Requires **Node.js 18+**.
|
|
42
|
+
|
|
7
43
|
```bash
|
|
8
44
|
npm install @orth/sdk
|
|
45
|
+
# or: pnpm add @orth/sdk / yarn add @orth/sdk
|
|
9
46
|
```
|
|
10
47
|
|
|
11
48
|
## Quick Start
|
|
@@ -14,41 +51,137 @@ npm install @orth/sdk
|
|
|
14
51
|
import Orthogonal from "@orth/sdk";
|
|
15
52
|
|
|
16
53
|
const orthogonal = new Orthogonal({
|
|
17
|
-
apiKey: process.env.ORTHOGONAL_API_KEY
|
|
54
|
+
apiKey: process.env.ORTHOGONAL_API_KEY!,
|
|
18
55
|
});
|
|
19
56
|
|
|
20
|
-
const
|
|
21
|
-
api: "
|
|
22
|
-
path: "/
|
|
23
|
-
query: {
|
|
57
|
+
const res = await orthogonal.run({
|
|
58
|
+
api: "tavily",
|
|
59
|
+
path: "/search",
|
|
60
|
+
query: { query: "latest AI news" },
|
|
24
61
|
});
|
|
25
62
|
|
|
26
|
-
console.log(
|
|
27
|
-
console.log(
|
|
63
|
+
console.log(res.data); // the upstream API's response
|
|
64
|
+
console.log(res.price); // amount charged, e.g. "0.01"
|
|
28
65
|
```
|
|
29
66
|
|
|
30
|
-
|
|
67
|
+
Get an API key from your [Orthogonal dashboard](https://orthogonal.com/dashboard).
|
|
31
68
|
|
|
32
|
-
|
|
69
|
+
## Authentication
|
|
33
70
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"data": { ... }
|
|
39
|
-
}
|
|
71
|
+
Pass your key to the constructor:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
const orthogonal = new Orthogonal({ apiKey: "orth_live_your_key" });
|
|
40
75
|
```
|
|
41
76
|
|
|
42
|
-
|
|
77
|
+
Prefer reading it from the environment so keys never live in source:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
const orthogonal = new Orthogonal({ apiKey: process.env.ORTHOGONAL_API_KEY! });
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
### GET request (query params)
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
const res = await orthogonal.run({
|
|
89
|
+
api: "fantastic-jobs",
|
|
90
|
+
path: "/v1/active-ats",
|
|
91
|
+
query: { time_frame: "1h", limit: 10 },
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### POST request (JSON body)
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const res = await orthogonal.run({
|
|
99
|
+
api: "some-api",
|
|
100
|
+
path: "/v1/generate",
|
|
101
|
+
body: { prompt: "a red bicycle" },
|
|
102
|
+
});
|
|
103
|
+
```
|
|
43
104
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
105
|
+
### Custom headers
|
|
106
|
+
|
|
107
|
+
Headers passed to the constructor are sent on every request:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
const orthogonal = new Orthogonal({
|
|
111
|
+
apiKey: process.env.ORTHOGONAL_API_KEY!,
|
|
112
|
+
headers: { "x-my-trace-id": "abc123" },
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Error Handling
|
|
117
|
+
|
|
118
|
+
`run()` resolves with the response on success and **throws** an `OrthogonalRunError` on any non-2xx response. The error extends `Error` (so `error.message` and `instanceof Error` work) and carries structured details:
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import Orthogonal, { OrthogonalRunError } from "@orth/sdk";
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
const res = await orthogonal.run({
|
|
125
|
+
api: "fantastic-jobs",
|
|
126
|
+
path: "/v1/active-ats",
|
|
127
|
+
query: { time_frame: "1h", company: "Google" }, // wrong field name
|
|
128
|
+
});
|
|
129
|
+
} catch (err) {
|
|
130
|
+
if (err instanceof OrthogonalRunError) {
|
|
131
|
+
console.error(err.message); // human-readable summary
|
|
132
|
+
console.error(err.status); // HTTP status, e.g. 400
|
|
133
|
+
console.error(err.orthogonal); // self-correction hint (see below)
|
|
134
|
+
console.error(err.responseBody); // full parsed error body
|
|
135
|
+
}
|
|
49
136
|
}
|
|
50
137
|
```
|
|
51
138
|
|
|
139
|
+
On a contract violation the `orthogonal` hint tells you exactly what to fix — for example, that `company` is an unexpected field and `organization` is the expected one, plus the endpoint's expected schema — so an agent can correct the request and retry instead of repeating a failing call.
|
|
140
|
+
|
|
141
|
+
## API Reference
|
|
142
|
+
|
|
143
|
+
### `new Orthogonal(config)`
|
|
144
|
+
|
|
145
|
+
| Option | Type | Description |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| `apiKey` | `string` | **Required.** Your Orthogonal API key (`orth_live_…` / `orth_test_…`). |
|
|
148
|
+
| `headers` | `Record<string, string>` | Optional headers sent on every request. |
|
|
149
|
+
|
|
150
|
+
### `orthogonal.run(options)` → `Promise<RunResponse>`
|
|
151
|
+
|
|
152
|
+
| Option | Type | Description |
|
|
153
|
+
| --- | --- | --- |
|
|
154
|
+
| `api` | `string` | **Required.** The API slug (e.g. `"tavily"`). |
|
|
155
|
+
| `path` | `string` | **Required.** The endpoint path (e.g. `"/search"`). |
|
|
156
|
+
| `query` | `Record<string, unknown>` | Query parameters. |
|
|
157
|
+
| `body` | `Record<string, unknown>` | Request body for POST/PUT/PATCH. |
|
|
158
|
+
|
|
159
|
+
**`RunResponse`**
|
|
160
|
+
|
|
161
|
+
| Field | Type | Description |
|
|
162
|
+
| --- | --- | --- |
|
|
163
|
+
| `success` | `boolean` | Whether the call succeeded. |
|
|
164
|
+
| `price` | `string` | Amount charged in USD (e.g. `"0.01"`). |
|
|
165
|
+
| `data` | `unknown` | The upstream API's response. |
|
|
166
|
+
|
|
167
|
+
### `OrthogonalRunError`
|
|
168
|
+
|
|
169
|
+
Thrown by `run()` on a non-2xx response. Extends `Error`.
|
|
170
|
+
|
|
171
|
+
| Property | Type | Description |
|
|
172
|
+
| --- | --- | --- |
|
|
173
|
+
| `status` | `number` | HTTP status of the failed response. |
|
|
174
|
+
| `orthogonal` | `unknown` | Self-correction hint (expected schema, unexpected/missing fields), when present. |
|
|
175
|
+
| `responseBody` | `unknown` | The full parsed response body. |
|
|
176
|
+
|
|
177
|
+
## TypeScript
|
|
178
|
+
|
|
179
|
+
The package ships with type definitions and both ESM and CommonJS builds — no `@types` package needed. All options and responses (`OrthogonalConfig`, `RunOptions`, `RunResponse`) are exported.
|
|
180
|
+
|
|
181
|
+
## Related
|
|
182
|
+
|
|
183
|
+
- **[`@orth/cli`](https://www.npmjs.com/package/@orth/cli)** — the Orthogonal command-line tool for discovering and calling APIs from your terminal.
|
|
184
|
+
|
|
52
185
|
## License
|
|
53
186
|
|
|
54
|
-
MIT
|
|
187
|
+
[MIT](./LICENSE) © Orthogonal
|
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,28 @@ interface RunResponse {
|
|
|
32
32
|
data: unknown;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Error thrown by {@link Orthogonal.run} on a non-2xx response.
|
|
37
|
+
*
|
|
38
|
+
* Extends `Error` (so existing `catch (e) { e.message }` keeps working) but also
|
|
39
|
+
* carries the structured server payload. On a contract violation the API returns
|
|
40
|
+
* an `_orthogonal` self-correction hint (expected schema, unexpected/missing
|
|
41
|
+
* fields, numeric bounds) — exposed here as `orthogonal` so an agent can fix the
|
|
42
|
+
* request and retry instead of only seeing the terse message.
|
|
43
|
+
*/
|
|
44
|
+
declare class OrthogonalRunError extends Error {
|
|
45
|
+
/** HTTP status of the failed response. */
|
|
46
|
+
status: number;
|
|
47
|
+
/** The API's `_orthogonal` self-correction hint, when present. */
|
|
48
|
+
orthogonal?: unknown;
|
|
49
|
+
/** The full parsed response body. */
|
|
50
|
+
responseBody?: unknown;
|
|
51
|
+
constructor(message: string, opts: {
|
|
52
|
+
status: number;
|
|
53
|
+
orthogonal?: unknown;
|
|
54
|
+
responseBody?: unknown;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
35
57
|
/**
|
|
36
58
|
* Orthogonal SDK client
|
|
37
59
|
*
|
|
@@ -62,4 +84,4 @@ declare class Orthogonal {
|
|
|
62
84
|
run(options: RunOptions): Promise<RunResponse>;
|
|
63
85
|
}
|
|
64
86
|
|
|
65
|
-
export { Orthogonal, type OrthogonalConfig, type RunOptions, type RunResponse, Orthogonal as default };
|
|
87
|
+
export { Orthogonal, type OrthogonalConfig, OrthogonalRunError, type RunOptions, type RunResponse, Orthogonal as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,28 @@ interface RunResponse {
|
|
|
32
32
|
data: unknown;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Error thrown by {@link Orthogonal.run} on a non-2xx response.
|
|
37
|
+
*
|
|
38
|
+
* Extends `Error` (so existing `catch (e) { e.message }` keeps working) but also
|
|
39
|
+
* carries the structured server payload. On a contract violation the API returns
|
|
40
|
+
* an `_orthogonal` self-correction hint (expected schema, unexpected/missing
|
|
41
|
+
* fields, numeric bounds) — exposed here as `orthogonal` so an agent can fix the
|
|
42
|
+
* request and retry instead of only seeing the terse message.
|
|
43
|
+
*/
|
|
44
|
+
declare class OrthogonalRunError extends Error {
|
|
45
|
+
/** HTTP status of the failed response. */
|
|
46
|
+
status: number;
|
|
47
|
+
/** The API's `_orthogonal` self-correction hint, when present. */
|
|
48
|
+
orthogonal?: unknown;
|
|
49
|
+
/** The full parsed response body. */
|
|
50
|
+
responseBody?: unknown;
|
|
51
|
+
constructor(message: string, opts: {
|
|
52
|
+
status: number;
|
|
53
|
+
orthogonal?: unknown;
|
|
54
|
+
responseBody?: unknown;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
35
57
|
/**
|
|
36
58
|
* Orthogonal SDK client
|
|
37
59
|
*
|
|
@@ -62,4 +84,4 @@ declare class Orthogonal {
|
|
|
62
84
|
run(options: RunOptions): Promise<RunResponse>;
|
|
63
85
|
}
|
|
64
86
|
|
|
65
|
-
export { Orthogonal, type OrthogonalConfig, type RunOptions, type RunResponse, Orthogonal as default };
|
|
87
|
+
export { Orthogonal, type OrthogonalConfig, OrthogonalRunError, type RunOptions, type RunResponse, Orthogonal as default };
|
package/dist/index.js
CHANGED
|
@@ -21,11 +21,41 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Orthogonal: () => Orthogonal,
|
|
24
|
+
OrthogonalRunError: () => OrthogonalRunError,
|
|
24
25
|
default: () => index_default
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(index_exports);
|
|
27
28
|
var VERSION = "0.1.0";
|
|
28
29
|
var BASE_URL = "https://api.orth.sh";
|
|
30
|
+
function formatError(raw, status) {
|
|
31
|
+
if (raw == null) return `Request failed with status ${status}`;
|
|
32
|
+
if (typeof raw === "string") {
|
|
33
|
+
return raw.length > 0 ? raw : `Request failed with status ${status}`;
|
|
34
|
+
}
|
|
35
|
+
if (typeof raw === "object") {
|
|
36
|
+
const obj = raw;
|
|
37
|
+
if (typeof obj.message === "string" && obj.message.length > 0) return obj.message;
|
|
38
|
+
if (typeof obj.error === "string" && obj.error.length > 0) return obj.error;
|
|
39
|
+
try {
|
|
40
|
+
const json = JSON.stringify(raw);
|
|
41
|
+
if (json && json !== "{}" && json !== "[]" && json !== "null") return json;
|
|
42
|
+
return `Request failed with status ${status}`;
|
|
43
|
+
} catch {
|
|
44
|
+
return `Request failed with status ${status}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return String(raw);
|
|
48
|
+
}
|
|
49
|
+
var OrthogonalRunError = class _OrthogonalRunError extends Error {
|
|
50
|
+
constructor(message, opts) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.name = "OrthogonalRunError";
|
|
53
|
+
this.status = opts.status;
|
|
54
|
+
this.orthogonal = opts.orthogonal;
|
|
55
|
+
this.responseBody = opts.responseBody;
|
|
56
|
+
Object.setPrototypeOf(this, _OrthogonalRunError.prototype);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
29
59
|
var Orthogonal = class {
|
|
30
60
|
constructor(config) {
|
|
31
61
|
if (!config.apiKey) {
|
|
@@ -52,14 +82,28 @@ var Orthogonal = class {
|
|
|
52
82
|
});
|
|
53
83
|
const data = await response.json();
|
|
54
84
|
if (!response.ok) {
|
|
85
|
+
const orthogonal = data?._orthogonal;
|
|
55
86
|
if (response.status === 401) {
|
|
56
|
-
throw new
|
|
87
|
+
throw new OrthogonalRunError(
|
|
88
|
+
"Invalid API key. Visit https://orthogonal.com to get one!",
|
|
89
|
+
{ status: 401, orthogonal, responseBody: data }
|
|
90
|
+
);
|
|
57
91
|
}
|
|
58
92
|
if (response.status === 402) {
|
|
59
|
-
|
|
93
|
+
const rawError2 = data.data?.error || data.error;
|
|
94
|
+
const hasServerMessage = rawError2 !== void 0 && rawError2 !== null && rawError2 !== "";
|
|
95
|
+
throw new OrthogonalRunError(
|
|
96
|
+
hasServerMessage ? formatError(rawError2, response.status) : "Insufficient credits. Top up your balance at https://www.orthogonal.com/dashboard/balance",
|
|
97
|
+
{ status: 402, orthogonal, responseBody: data }
|
|
98
|
+
);
|
|
60
99
|
}
|
|
61
|
-
const
|
|
62
|
-
|
|
100
|
+
const rawError = data.data?.error || data.error;
|
|
101
|
+
const errorMessage = formatError(rawError, response.status);
|
|
102
|
+
throw new OrthogonalRunError(errorMessage, {
|
|
103
|
+
status: response.status,
|
|
104
|
+
orthogonal,
|
|
105
|
+
responseBody: data
|
|
106
|
+
});
|
|
63
107
|
}
|
|
64
108
|
return data;
|
|
65
109
|
}
|
|
@@ -67,6 +111,7 @@ var Orthogonal = class {
|
|
|
67
111
|
var index_default = Orthogonal;
|
|
68
112
|
// Annotate the CommonJS export names for ESM import in node:
|
|
69
113
|
0 && (module.exports = {
|
|
70
|
-
Orthogonal
|
|
114
|
+
Orthogonal,
|
|
115
|
+
OrthogonalRunError
|
|
71
116
|
});
|
|
72
117
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { OrthogonalConfig, RunOptions, RunResponse } from \"./types\";\n\nconst VERSION = \"0.1.0\";\nconst BASE_URL = \"https://api.orth.sh\";\n\n/**\n * Orthogonal SDK client\n *\n * @example\n * ```typescript\n * import Orthogonal from \"@orth/sdk\";\n *\n * const orthogonal = new Orthogonal({\n * apiKey: process.env.ORTHOGONAL_API_KEY\n * });\n *\n * const response = await orthogonal.run({\n * api: \"andi\",\n * path: \"/api/v1/search\",\n * query: { q: \"hello world\" }\n * });\n *\n * console.log(response.data);\n * ```\n */\nexport class Orthogonal {\n private apiKey: string;\n private customHeaders: Record<string, string>;\n\n constructor(config: OrthogonalConfig) {\n if (!config.apiKey) {\n throw new Error(\"Orthogonal API key is required\");\n }\n this.apiKey = config.apiKey;\n this.customHeaders = config.headers || {};\n }\n\n /**\n * Call any API on the Orthogonal platform\n */\n async run(options: RunOptions): Promise<RunResponse> {\n const { api, path, query, body } = options;\n\n const response = await fetch(`${BASE_URL}/v1/run`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${this.apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": `@orth/sdk/${VERSION}`,\n \"X-Orthogonal-Source\": \"sdk\",\n ...this.customHeaders,\n },\n body: JSON.stringify({ api, path, query, body }),\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n // Provide helpful error messages for common cases\n if (response.status === 401) {\n throw new
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { OrthogonalConfig, RunOptions, RunResponse } from \"./types\";\n\nconst VERSION = \"0.1.0\";\nconst BASE_URL = \"https://api.orth.sh\";\n\n/**\n * Coerce an error payload into a human-readable string.\n *\n * Upstream providers surface errors as structured objects (e.g. People Data Labs\n * returns `{type: [...], message: \"...\"}`). Passing those to `new Error()` coerces\n * to `\"[object Object]\"`, which is useless to SDK consumers. We prefer the most\n * specific string field when present, and fall back to JSON so callers can still\n * see the full payload.\n */\nfunction formatError(raw: unknown, status: number): string {\n if (raw == null) return `Request failed with status ${status}`;\n if (typeof raw === \"string\") {\n return raw.length > 0 ? raw : `Request failed with status ${status}`;\n }\n if (typeof raw === \"object\") {\n const obj = raw as Record<string, unknown>;\n // Only use .message / .error if they are non-empty strings; otherwise fall\n // through to JSON.stringify so callers still see the full payload.\n if (typeof obj.message === \"string\" && obj.message.length > 0) return obj.message;\n if (typeof obj.error === \"string\" && obj.error.length > 0) return obj.error;\n try {\n const json = JSON.stringify(raw);\n // \"{}\" / \"[]\" / \"null\" aren't useful; fall back to the status message.\n if (json && json !== \"{}\" && json !== \"[]\" && json !== \"null\") return json;\n return `Request failed with status ${status}`;\n } catch {\n return `Request failed with status ${status}`;\n }\n }\n return String(raw);\n}\n\n/**\n * Error thrown by {@link Orthogonal.run} on a non-2xx response.\n *\n * Extends `Error` (so existing `catch (e) { e.message }` keeps working) but also\n * carries the structured server payload. On a contract violation the API returns\n * an `_orthogonal` self-correction hint (expected schema, unexpected/missing\n * fields, numeric bounds) — exposed here as `orthogonal` so an agent can fix the\n * request and retry instead of only seeing the terse message.\n */\nexport class OrthogonalRunError extends Error {\n /** HTTP status of the failed response. */\n status: number;\n /** The API's `_orthogonal` self-correction hint, when present. */\n orthogonal?: unknown;\n /** The full parsed response body. */\n responseBody?: unknown;\n\n constructor(\n message: string,\n opts: { status: number; orthogonal?: unknown; responseBody?: unknown },\n ) {\n super(message);\n this.name = \"OrthogonalRunError\";\n this.status = opts.status;\n this.orthogonal = opts.orthogonal;\n this.responseBody = opts.responseBody;\n // Restore the prototype chain for instanceof across the compiled target.\n Object.setPrototypeOf(this, OrthogonalRunError.prototype);\n }\n}\n\n/**\n * Orthogonal SDK client\n *\n * @example\n * ```typescript\n * import Orthogonal from \"@orth/sdk\";\n *\n * const orthogonal = new Orthogonal({\n * apiKey: process.env.ORTHOGONAL_API_KEY\n * });\n *\n * const response = await orthogonal.run({\n * api: \"andi\",\n * path: \"/api/v1/search\",\n * query: { q: \"hello world\" }\n * });\n *\n * console.log(response.data);\n * ```\n */\nexport class Orthogonal {\n private apiKey: string;\n private customHeaders: Record<string, string>;\n\n constructor(config: OrthogonalConfig) {\n if (!config.apiKey) {\n throw new Error(\"Orthogonal API key is required\");\n }\n this.apiKey = config.apiKey;\n this.customHeaders = config.headers || {};\n }\n\n /**\n * Call any API on the Orthogonal platform\n */\n async run(options: RunOptions): Promise<RunResponse> {\n const { api, path, query, body } = options;\n\n const response = await fetch(`${BASE_URL}/v1/run`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${this.apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": `@orth/sdk/${VERSION}`,\n \"X-Orthogonal-Source\": \"sdk\",\n ...this.customHeaders,\n },\n body: JSON.stringify({ api, path, query, body }),\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n const orthogonal = (data as any)?._orthogonal;\n // Provide helpful error messages for common cases\n if (response.status === 401) {\n throw new OrthogonalRunError(\n \"Invalid API key. Visit https://orthogonal.com to get one!\",\n { status: 401, orthogonal, responseBody: data },\n );\n }\n if (response.status === 402) {\n // 402 now covers several distinct cases: insufficient credits, a per-key\n // daily spend limit, and an account-wide daily spend limit. Surface the\n // server's specific message when it provided one so callers know which\n // applies. We test `rawError` directly (not formatError's output) so a\n // real message that happens to start with \"Request failed\" isn't mistaken\n // for the no-message fallback.\n const rawError = data.data?.error || data.error;\n const hasServerMessage =\n rawError !== undefined && rawError !== null && rawError !== \"\";\n throw new OrthogonalRunError(\n hasServerMessage\n ? formatError(rawError, response.status)\n : \"Insufficient credits. Top up your balance at https://www.orthogonal.com/dashboard/balance\",\n { status: 402, orthogonal, responseBody: data },\n );\n }\n // Check for nested error in data.error (e.g., from target API). Use `||`\n // (not `??`) so that falsy values like `\"\"` still fall through the chain\n // to the status-based fallback inside `formatError`.\n const rawError = data.data?.error || data.error;\n const errorMessage = formatError(rawError, response.status);\n throw new OrthogonalRunError(errorMessage, {\n status: response.status,\n orthogonal,\n responseBody: data,\n });\n }\n\n return data as RunResponse;\n }\n}\n\n// Export types\nexport * from \"./types\";\n\n// Default export\nexport default Orthogonal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAM,UAAU;AAChB,IAAM,WAAW;AAWjB,SAAS,YAAY,KAAc,QAAwB;AACzD,MAAI,OAAO,KAAM,QAAO,8BAA8B,MAAM;AAC5D,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,IAAI,SAAS,IAAI,MAAM,8BAA8B,MAAM;AAAA,EACpE;AACA,MAAI,OAAO,QAAQ,UAAU;AAC3B,UAAM,MAAM;AAGZ,QAAI,OAAO,IAAI,YAAY,YAAY,IAAI,QAAQ,SAAS,EAAG,QAAO,IAAI;AAC1E,QAAI,OAAO,IAAI,UAAU,YAAY,IAAI,MAAM,SAAS,EAAG,QAAO,IAAI;AACtE,QAAI;AACF,YAAM,OAAO,KAAK,UAAU,GAAG;AAE/B,UAAI,QAAQ,SAAS,QAAQ,SAAS,QAAQ,SAAS,OAAQ,QAAO;AACtE,aAAO,8BAA8B,MAAM;AAAA,IAC7C,QAAQ;AACN,aAAO,8BAA8B,MAAM;AAAA,IAC7C;AAAA,EACF;AACA,SAAO,OAAO,GAAG;AACnB;AAWO,IAAM,qBAAN,MAAM,4BAA2B,MAAM;AAAA,EAQ5C,YACE,SACA,MACA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS,KAAK;AACnB,SAAK,aAAa,KAAK;AACvB,SAAK,eAAe,KAAK;AAEzB,WAAO,eAAe,MAAM,oBAAmB,SAAS;AAAA,EAC1D;AACF;AAsBO,IAAM,aAAN,MAAiB;AAAA,EAItB,YAAY,QAA0B;AACpC,QAAI,CAAC,OAAO,QAAQ;AAClB,YAAM,IAAI,MAAM,gCAAgC;AAAA,IAClD;AACA,SAAK,SAAS,OAAO;AACrB,SAAK,gBAAgB,OAAO,WAAW,CAAC;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,IAAI,SAA2C;AACnD,UAAM,EAAE,KAAK,MAAM,OAAO,KAAK,IAAI;AAEnC,UAAM,WAAW,MAAM,MAAM,GAAG,QAAQ,WAAW;AAAA,MACjD,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,eAAe,UAAU,KAAK,MAAM;AAAA,QACpC,gBAAgB;AAAA,QAChB,cAAc,aAAa,OAAO;AAAA,QAClC,uBAAuB;AAAA,QACvB,GAAG,KAAK;AAAA,MACV;AAAA,MACA,MAAM,KAAK,UAAU,EAAE,KAAK,MAAM,OAAO,KAAK,CAAC;AAAA,IACjD,CAAC;AAED,UAAM,OAAO,MAAM,SAAS,KAAK;AAEjC,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,aAAc,MAAc;AAElC,UAAI,SAAS,WAAW,KAAK;AAC3B,cAAM,IAAI;AAAA,UACR;AAAA,UACA,EAAE,QAAQ,KAAK,YAAY,cAAc,KAAK;AAAA,QAChD;AAAA,MACF;AACA,UAAI,SAAS,WAAW,KAAK;AAO3B,cAAMA,YAAW,KAAK,MAAM,SAAS,KAAK;AAC1C,cAAM,mBACJA,cAAa,UAAaA,cAAa,QAAQA,cAAa;AAC9D,cAAM,IAAI;AAAA,UACR,mBACI,YAAYA,WAAU,SAAS,MAAM,IACrC;AAAA,UACJ,EAAE,QAAQ,KAAK,YAAY,cAAc,KAAK;AAAA,QAChD;AAAA,MACF;AAIA,YAAM,WAAW,KAAK,MAAM,SAAS,KAAK;AAC1C,YAAM,eAAe,YAAY,UAAU,SAAS,MAAM;AAC1D,YAAM,IAAI,mBAAmB,cAAc;AAAA,QACzC,QAAQ,SAAS;AAAA,QACjB;AAAA,QACA,cAAc;AAAA,MAChB,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AACF;AAMA,IAAO,gBAAQ;","names":["rawError"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
var VERSION = "0.1.0";
|
|
3
3
|
var BASE_URL = "https://api.orth.sh";
|
|
4
|
+
function formatError(raw, status) {
|
|
5
|
+
if (raw == null) return `Request failed with status ${status}`;
|
|
6
|
+
if (typeof raw === "string") {
|
|
7
|
+
return raw.length > 0 ? raw : `Request failed with status ${status}`;
|
|
8
|
+
}
|
|
9
|
+
if (typeof raw === "object") {
|
|
10
|
+
const obj = raw;
|
|
11
|
+
if (typeof obj.message === "string" && obj.message.length > 0) return obj.message;
|
|
12
|
+
if (typeof obj.error === "string" && obj.error.length > 0) return obj.error;
|
|
13
|
+
try {
|
|
14
|
+
const json = JSON.stringify(raw);
|
|
15
|
+
if (json && json !== "{}" && json !== "[]" && json !== "null") return json;
|
|
16
|
+
return `Request failed with status ${status}`;
|
|
17
|
+
} catch {
|
|
18
|
+
return `Request failed with status ${status}`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return String(raw);
|
|
22
|
+
}
|
|
23
|
+
var OrthogonalRunError = class _OrthogonalRunError extends Error {
|
|
24
|
+
constructor(message, opts) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = "OrthogonalRunError";
|
|
27
|
+
this.status = opts.status;
|
|
28
|
+
this.orthogonal = opts.orthogonal;
|
|
29
|
+
this.responseBody = opts.responseBody;
|
|
30
|
+
Object.setPrototypeOf(this, _OrthogonalRunError.prototype);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
4
33
|
var Orthogonal = class {
|
|
5
34
|
constructor(config) {
|
|
6
35
|
if (!config.apiKey) {
|
|
@@ -27,14 +56,28 @@ var Orthogonal = class {
|
|
|
27
56
|
});
|
|
28
57
|
const data = await response.json();
|
|
29
58
|
if (!response.ok) {
|
|
59
|
+
const orthogonal = data?._orthogonal;
|
|
30
60
|
if (response.status === 401) {
|
|
31
|
-
throw new
|
|
61
|
+
throw new OrthogonalRunError(
|
|
62
|
+
"Invalid API key. Visit https://orthogonal.com to get one!",
|
|
63
|
+
{ status: 401, orthogonal, responseBody: data }
|
|
64
|
+
);
|
|
32
65
|
}
|
|
33
66
|
if (response.status === 402) {
|
|
34
|
-
|
|
67
|
+
const rawError2 = data.data?.error || data.error;
|
|
68
|
+
const hasServerMessage = rawError2 !== void 0 && rawError2 !== null && rawError2 !== "";
|
|
69
|
+
throw new OrthogonalRunError(
|
|
70
|
+
hasServerMessage ? formatError(rawError2, response.status) : "Insufficient credits. Top up your balance at https://www.orthogonal.com/dashboard/balance",
|
|
71
|
+
{ status: 402, orthogonal, responseBody: data }
|
|
72
|
+
);
|
|
35
73
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
74
|
+
const rawError = data.data?.error || data.error;
|
|
75
|
+
const errorMessage = formatError(rawError, response.status);
|
|
76
|
+
throw new OrthogonalRunError(errorMessage, {
|
|
77
|
+
status: response.status,
|
|
78
|
+
orthogonal,
|
|
79
|
+
responseBody: data
|
|
80
|
+
});
|
|
38
81
|
}
|
|
39
82
|
return data;
|
|
40
83
|
}
|
|
@@ -42,6 +85,7 @@ var Orthogonal = class {
|
|
|
42
85
|
var index_default = Orthogonal;
|
|
43
86
|
export {
|
|
44
87
|
Orthogonal,
|
|
88
|
+
OrthogonalRunError,
|
|
45
89
|
index_default as default
|
|
46
90
|
};
|
|
47
91
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { OrthogonalConfig, RunOptions, RunResponse } from \"./types\";\n\nconst VERSION = \"0.1.0\";\nconst BASE_URL = \"https://api.orth.sh\";\n\n/**\n * Orthogonal SDK client\n *\n * @example\n * ```typescript\n * import Orthogonal from \"@orth/sdk\";\n *\n * const orthogonal = new Orthogonal({\n * apiKey: process.env.ORTHOGONAL_API_KEY\n * });\n *\n * const response = await orthogonal.run({\n * api: \"andi\",\n * path: \"/api/v1/search\",\n * query: { q: \"hello world\" }\n * });\n *\n * console.log(response.data);\n * ```\n */\nexport class Orthogonal {\n private apiKey: string;\n private customHeaders: Record<string, string>;\n\n constructor(config: OrthogonalConfig) {\n if (!config.apiKey) {\n throw new Error(\"Orthogonal API key is required\");\n }\n this.apiKey = config.apiKey;\n this.customHeaders = config.headers || {};\n }\n\n /**\n * Call any API on the Orthogonal platform\n */\n async run(options: RunOptions): Promise<RunResponse> {\n const { api, path, query, body } = options;\n\n const response = await fetch(`${BASE_URL}/v1/run`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${this.apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": `@orth/sdk/${VERSION}`,\n \"X-Orthogonal-Source\": \"sdk\",\n ...this.customHeaders,\n },\n body: JSON.stringify({ api, path, query, body }),\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n // Provide helpful error messages for common cases\n if (response.status === 401) {\n throw new
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { OrthogonalConfig, RunOptions, RunResponse } from \"./types\";\n\nconst VERSION = \"0.1.0\";\nconst BASE_URL = \"https://api.orth.sh\";\n\n/**\n * Coerce an error payload into a human-readable string.\n *\n * Upstream providers surface errors as structured objects (e.g. People Data Labs\n * returns `{type: [...], message: \"...\"}`). Passing those to `new Error()` coerces\n * to `\"[object Object]\"`, which is useless to SDK consumers. We prefer the most\n * specific string field when present, and fall back to JSON so callers can still\n * see the full payload.\n */\nfunction formatError(raw: unknown, status: number): string {\n if (raw == null) return `Request failed with status ${status}`;\n if (typeof raw === \"string\") {\n return raw.length > 0 ? raw : `Request failed with status ${status}`;\n }\n if (typeof raw === \"object\") {\n const obj = raw as Record<string, unknown>;\n // Only use .message / .error if they are non-empty strings; otherwise fall\n // through to JSON.stringify so callers still see the full payload.\n if (typeof obj.message === \"string\" && obj.message.length > 0) return obj.message;\n if (typeof obj.error === \"string\" && obj.error.length > 0) return obj.error;\n try {\n const json = JSON.stringify(raw);\n // \"{}\" / \"[]\" / \"null\" aren't useful; fall back to the status message.\n if (json && json !== \"{}\" && json !== \"[]\" && json !== \"null\") return json;\n return `Request failed with status ${status}`;\n } catch {\n return `Request failed with status ${status}`;\n }\n }\n return String(raw);\n}\n\n/**\n * Error thrown by {@link Orthogonal.run} on a non-2xx response.\n *\n * Extends `Error` (so existing `catch (e) { e.message }` keeps working) but also\n * carries the structured server payload. On a contract violation the API returns\n * an `_orthogonal` self-correction hint (expected schema, unexpected/missing\n * fields, numeric bounds) — exposed here as `orthogonal` so an agent can fix the\n * request and retry instead of only seeing the terse message.\n */\nexport class OrthogonalRunError extends Error {\n /** HTTP status of the failed response. */\n status: number;\n /** The API's `_orthogonal` self-correction hint, when present. */\n orthogonal?: unknown;\n /** The full parsed response body. */\n responseBody?: unknown;\n\n constructor(\n message: string,\n opts: { status: number; orthogonal?: unknown; responseBody?: unknown },\n ) {\n super(message);\n this.name = \"OrthogonalRunError\";\n this.status = opts.status;\n this.orthogonal = opts.orthogonal;\n this.responseBody = opts.responseBody;\n // Restore the prototype chain for instanceof across the compiled target.\n Object.setPrototypeOf(this, OrthogonalRunError.prototype);\n }\n}\n\n/**\n * Orthogonal SDK client\n *\n * @example\n * ```typescript\n * import Orthogonal from \"@orth/sdk\";\n *\n * const orthogonal = new Orthogonal({\n * apiKey: process.env.ORTHOGONAL_API_KEY\n * });\n *\n * const response = await orthogonal.run({\n * api: \"andi\",\n * path: \"/api/v1/search\",\n * query: { q: \"hello world\" }\n * });\n *\n * console.log(response.data);\n * ```\n */\nexport class Orthogonal {\n private apiKey: string;\n private customHeaders: Record<string, string>;\n\n constructor(config: OrthogonalConfig) {\n if (!config.apiKey) {\n throw new Error(\"Orthogonal API key is required\");\n }\n this.apiKey = config.apiKey;\n this.customHeaders = config.headers || {};\n }\n\n /**\n * Call any API on the Orthogonal platform\n */\n async run(options: RunOptions): Promise<RunResponse> {\n const { api, path, query, body } = options;\n\n const response = await fetch(`${BASE_URL}/v1/run`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${this.apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": `@orth/sdk/${VERSION}`,\n \"X-Orthogonal-Source\": \"sdk\",\n ...this.customHeaders,\n },\n body: JSON.stringify({ api, path, query, body }),\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n const orthogonal = (data as any)?._orthogonal;\n // Provide helpful error messages for common cases\n if (response.status === 401) {\n throw new OrthogonalRunError(\n \"Invalid API key. Visit https://orthogonal.com to get one!\",\n { status: 401, orthogonal, responseBody: data },\n );\n }\n if (response.status === 402) {\n // 402 now covers several distinct cases: insufficient credits, a per-key\n // daily spend limit, and an account-wide daily spend limit. Surface the\n // server's specific message when it provided one so callers know which\n // applies. We test `rawError` directly (not formatError's output) so a\n // real message that happens to start with \"Request failed\" isn't mistaken\n // for the no-message fallback.\n const rawError = data.data?.error || data.error;\n const hasServerMessage =\n rawError !== undefined && rawError !== null && rawError !== \"\";\n throw new OrthogonalRunError(\n hasServerMessage\n ? formatError(rawError, response.status)\n : \"Insufficient credits. Top up your balance at https://www.orthogonal.com/dashboard/balance\",\n { status: 402, orthogonal, responseBody: data },\n );\n }\n // Check for nested error in data.error (e.g., from target API). Use `||`\n // (not `??`) so that falsy values like `\"\"` still fall through the chain\n // to the status-based fallback inside `formatError`.\n const rawError = data.data?.error || data.error;\n const errorMessage = formatError(rawError, response.status);\n throw new OrthogonalRunError(errorMessage, {\n status: response.status,\n orthogonal,\n responseBody: data,\n });\n }\n\n return data as RunResponse;\n }\n}\n\n// Export types\nexport * from \"./types\";\n\n// Default export\nexport default Orthogonal;\n"],"mappings":";AAEA,IAAM,UAAU;AAChB,IAAM,WAAW;AAWjB,SAAS,YAAY,KAAc,QAAwB;AACzD,MAAI,OAAO,KAAM,QAAO,8BAA8B,MAAM;AAC5D,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,IAAI,SAAS,IAAI,MAAM,8BAA8B,MAAM;AAAA,EACpE;AACA,MAAI,OAAO,QAAQ,UAAU;AAC3B,UAAM,MAAM;AAGZ,QAAI,OAAO,IAAI,YAAY,YAAY,IAAI,QAAQ,SAAS,EAAG,QAAO,IAAI;AAC1E,QAAI,OAAO,IAAI,UAAU,YAAY,IAAI,MAAM,SAAS,EAAG,QAAO,IAAI;AACtE,QAAI;AACF,YAAM,OAAO,KAAK,UAAU,GAAG;AAE/B,UAAI,QAAQ,SAAS,QAAQ,SAAS,QAAQ,SAAS,OAAQ,QAAO;AACtE,aAAO,8BAA8B,MAAM;AAAA,IAC7C,QAAQ;AACN,aAAO,8BAA8B,MAAM;AAAA,IAC7C;AAAA,EACF;AACA,SAAO,OAAO,GAAG;AACnB;AAWO,IAAM,qBAAN,MAAM,4BAA2B,MAAM;AAAA,EAQ5C,YACE,SACA,MACA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS,KAAK;AACnB,SAAK,aAAa,KAAK;AACvB,SAAK,eAAe,KAAK;AAEzB,WAAO,eAAe,MAAM,oBAAmB,SAAS;AAAA,EAC1D;AACF;AAsBO,IAAM,aAAN,MAAiB;AAAA,EAItB,YAAY,QAA0B;AACpC,QAAI,CAAC,OAAO,QAAQ;AAClB,YAAM,IAAI,MAAM,gCAAgC;AAAA,IAClD;AACA,SAAK,SAAS,OAAO;AACrB,SAAK,gBAAgB,OAAO,WAAW,CAAC;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,IAAI,SAA2C;AACnD,UAAM,EAAE,KAAK,MAAM,OAAO,KAAK,IAAI;AAEnC,UAAM,WAAW,MAAM,MAAM,GAAG,QAAQ,WAAW;AAAA,MACjD,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,eAAe,UAAU,KAAK,MAAM;AAAA,QACpC,gBAAgB;AAAA,QAChB,cAAc,aAAa,OAAO;AAAA,QAClC,uBAAuB;AAAA,QACvB,GAAG,KAAK;AAAA,MACV;AAAA,MACA,MAAM,KAAK,UAAU,EAAE,KAAK,MAAM,OAAO,KAAK,CAAC;AAAA,IACjD,CAAC;AAED,UAAM,OAAO,MAAM,SAAS,KAAK;AAEjC,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,aAAc,MAAc;AAElC,UAAI,SAAS,WAAW,KAAK;AAC3B,cAAM,IAAI;AAAA,UACR;AAAA,UACA,EAAE,QAAQ,KAAK,YAAY,cAAc,KAAK;AAAA,QAChD;AAAA,MACF;AACA,UAAI,SAAS,WAAW,KAAK;AAO3B,cAAMA,YAAW,KAAK,MAAM,SAAS,KAAK;AAC1C,cAAM,mBACJA,cAAa,UAAaA,cAAa,QAAQA,cAAa;AAC9D,cAAM,IAAI;AAAA,UACR,mBACI,YAAYA,WAAU,SAAS,MAAM,IACrC;AAAA,UACJ,EAAE,QAAQ,KAAK,YAAY,cAAc,KAAK;AAAA,QAChD;AAAA,MACF;AAIA,YAAM,WAAW,KAAK,MAAM,SAAS,KAAK;AAC1C,YAAM,eAAe,YAAY,UAAU,SAAS,MAAM;AAC1D,YAAM,IAAI,mBAAmB,cAAc;AAAA,QACzC,QAAQ,SAAS;AAAA,QACjB;AAAA,QACA,cAAc;AAAA,MAChB,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AACF;AAMA,IAAO,gBAAQ;","names":["rawError"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orth/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "TypeScript SDK to call any API on the Orthogonal platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
17
19
|
],
|
|
18
20
|
"sideEffects": false,
|
|
19
21
|
"scripts": {
|