@tapi-dev/sdk 0.1.36 → 0.1.39
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 +60 -48
- package/dist/cli.d.ts +3 -1
- package/dist/cli.js +459 -255
- package/dist/client.d.ts +1 -1
- package/dist/client.js +10 -3
- package/dist/types.d.ts +1 -1
- package/package.json +7 -1
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { TapiError } from "./errors.js";
|
|
2
2
|
export class HttpClient {
|
|
3
3
|
baseUrl;
|
|
4
|
-
|
|
4
|
+
authToken;
|
|
5
5
|
tappId;
|
|
6
6
|
projectId;
|
|
7
7
|
fetchImpl;
|
|
8
8
|
constructor(options) {
|
|
9
9
|
this.baseUrl = options.baseUrl.replace(/\/+$/, "");
|
|
10
|
-
this.
|
|
10
|
+
this.authToken = options.authToken.trim();
|
|
11
|
+
if (!this.authToken) {
|
|
12
|
+
throw new TapiError("authToken is required", {
|
|
13
|
+
status: 0,
|
|
14
|
+
code: "invalid_client_config",
|
|
15
|
+
details: { field: "authToken" },
|
|
16
|
+
});
|
|
17
|
+
}
|
|
11
18
|
this.tappId = options.tappId.trim();
|
|
12
19
|
if (!this.tappId) {
|
|
13
20
|
throw new TapiError("tappId is required", {
|
|
@@ -35,7 +42,7 @@ export class HttpClient {
|
|
|
35
42
|
const response = await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
36
43
|
method,
|
|
37
44
|
headers: {
|
|
38
|
-
|
|
45
|
+
Authorization: `Bearer ${this.authToken}`,
|
|
39
46
|
"Content-Type": "application/json",
|
|
40
47
|
"X-Tapi-Tapp": this.tappId,
|
|
41
48
|
...(this.projectId ? { "X-Tapi-Project": this.projectId } : {}),
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { LateInput } from "./late-input.js";
|
|
|
2
2
|
export type RunStatus = "queued" | "running" | "waiting_for_input" | "completed" | "failed" | "cancelled" | "needs_developer_attention";
|
|
3
3
|
export interface TapiClientOptions {
|
|
4
4
|
baseUrl: string;
|
|
5
|
-
|
|
5
|
+
authToken: string;
|
|
6
6
|
tappId: string;
|
|
7
7
|
projectId?: string;
|
|
8
8
|
dev?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapi-dev/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -29,9 +29,15 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@types/cli-progress": "^3.11.6",
|
|
32
33
|
"@types/node": "^20.0.0",
|
|
33
34
|
"typescript": "^5.5.0",
|
|
34
35
|
"vite": "6.4.3",
|
|
35
36
|
"vitest": "^4.1.8"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@inquirer/prompts": "^7.10.1",
|
|
40
|
+
"cli-progress": "^3.12.0",
|
|
41
|
+
"yoctocolors": "^2.1.2"
|
|
36
42
|
}
|
|
37
43
|
}
|