@tabstack/sdk 1.0.4 → 1.0.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/LICENSE +22 -11
- package/README.md +17 -44
- package/dist/cjs/{automate.d.ts → agent.d.ts} +10 -10
- package/dist/cjs/agent.d.ts.map +1 -0
- package/dist/cjs/{automate.js → agent.js} +11 -11
- package/dist/cjs/agent.js.map +1 -0
- package/dist/cjs/agent.test.d.ts +5 -0
- package/dist/cjs/agent.test.d.ts.map +1 -0
- package/dist/cjs/{automate.test.js → agent.test.js} +32 -32
- package/dist/cjs/agent.test.js.map +1 -0
- package/dist/cjs/client.d.ts +13 -13
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +12 -12
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/client.test.d.ts +1 -1
- package/dist/cjs/client.test.js +50 -51
- package/dist/cjs/client.test.js.map +1 -1
- package/dist/cjs/exceptions.d.ts +9 -9
- package/dist/cjs/exceptions.js +13 -13
- package/dist/cjs/exceptions.test.js +30 -30
- package/dist/cjs/extract.d.ts +2 -57
- package/dist/cjs/extract.d.ts.map +1 -1
- package/dist/cjs/extract.js +2 -60
- package/dist/cjs/extract.js.map +1 -1
- package/dist/cjs/extract.test.js +0 -114
- package/dist/cjs/extract.test.js.map +1 -1
- package/dist/cjs/generate.d.ts +1 -1
- package/dist/cjs/generate.js +1 -1
- package/dist/cjs/index.d.ts +9 -9
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +9 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types.d.ts +1 -1
- package/dist/cjs/types.js +1 -1
- package/dist/cjs/util/http.d.ts +1 -1
- package/dist/cjs/util/http.js +4 -4
- package/dist/cjs/util/http.test.js +5 -5
- package/dist/esm/{automate.d.ts → agent.d.ts} +10 -10
- package/dist/esm/agent.d.ts.map +1 -0
- package/dist/esm/{automate.js → agent.js} +9 -9
- package/dist/esm/agent.js.map +1 -0
- package/dist/esm/agent.test.d.ts +5 -0
- package/dist/esm/agent.test.d.ts.map +1 -0
- package/dist/esm/{automate.test.js → agent.test.js} +32 -32
- package/dist/esm/agent.test.js.map +1 -0
- package/dist/esm/client.d.ts +13 -13
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +10 -10
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/client.test.d.ts +1 -1
- package/dist/esm/client.test.js +51 -52
- package/dist/esm/client.test.js.map +1 -1
- package/dist/esm/exceptions.d.ts +9 -9
- package/dist/esm/exceptions.js +11 -11
- package/dist/esm/exceptions.test.js +31 -31
- package/dist/esm/extract.d.ts +2 -57
- package/dist/esm/extract.d.ts.map +1 -1
- package/dist/esm/extract.js +2 -60
- package/dist/esm/extract.js.map +1 -1
- package/dist/esm/extract.test.js +0 -114
- package/dist/esm/extract.test.js.map +1 -1
- package/dist/esm/generate.d.ts +1 -1
- package/dist/esm/generate.js +1 -1
- package/dist/esm/index.d.ts +9 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/util/http.d.ts +1 -1
- package/dist/esm/util/http.js +5 -5
- package/dist/esm/util/http.test.js +6 -6
- package/dist/types/{automate.d.ts → agent.d.ts} +10 -10
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.test.d.ts +5 -0
- package/dist/types/agent.test.d.ts.map +1 -0
- package/dist/types/client.d.ts +13 -13
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client.test.d.ts +1 -1
- package/dist/types/exceptions.d.ts +9 -9
- package/dist/types/extract.d.ts +2 -57
- package/dist/types/extract.d.ts.map +1 -1
- package/dist/types/generate.d.ts +1 -1
- package/dist/types/index.d.ts +9 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types/util/http.d.ts +1 -1
- package/package.json +3 -3
- package/dist/cjs/automate.d.ts.map +0 -1
- package/dist/cjs/automate.js.map +0 -1
- package/dist/cjs/automate.test.d.ts +0 -5
- package/dist/cjs/automate.test.d.ts.map +0 -1
- package/dist/cjs/automate.test.js.map +0 -1
- package/dist/esm/automate.d.ts.map +0 -1
- package/dist/esm/automate.js.map +0 -1
- package/dist/esm/automate.test.d.ts +0 -5
- package/dist/esm/automate.test.d.ts.map +0 -1
- package/dist/esm/automate.test.js.map +0 -1
- package/dist/types/automate.d.ts.map +0 -1
- package/dist/types/automate.test.d.ts +0 -5
- package/dist/types/automate.test.d.ts.map +0 -1
package/dist/esm/client.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Main client for
|
|
2
|
+
* Main client for Tabstack SDK
|
|
3
3
|
*/
|
|
4
4
|
import { Extract } from './extract';
|
|
5
5
|
import { Generate } from './generate';
|
|
6
|
-
import {
|
|
7
|
-
export interface
|
|
6
|
+
import { Agent } from './agent';
|
|
7
|
+
export interface TabstackOptions {
|
|
8
8
|
apiKey: string;
|
|
9
9
|
baseURL?: string;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Tabstack client for web content extraction, generation, and automation
|
|
13
13
|
*
|
|
14
|
-
* This is the main entry point for the
|
|
14
|
+
* This is the main entry point for the Tabstack SDK. Initialize it with your
|
|
15
15
|
* API key to access the extract, generate, and automate operators.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```typescript
|
|
19
|
-
* import {
|
|
19
|
+
* import { Tabstack } from '@tabstack/sdk';
|
|
20
20
|
*
|
|
21
|
-
* const tabs = new
|
|
21
|
+
* const tabs = new Tabstack({
|
|
22
22
|
* apiKey: process.env.TABSTACK_API_KEY!
|
|
23
23
|
* });
|
|
24
24
|
*
|
|
@@ -26,7 +26,7 @@ export interface TABStackOptions {
|
|
|
26
26
|
* console.log(result.content);
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
export declare class
|
|
29
|
+
export declare class Tabstack {
|
|
30
30
|
private httpClient;
|
|
31
31
|
/**
|
|
32
32
|
* Extract operator for converting and extracting web content
|
|
@@ -37,22 +37,22 @@ export declare class TABStack {
|
|
|
37
37
|
*/
|
|
38
38
|
readonly generate: Generate;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Agent client for AI-powered browser automation tasks
|
|
41
41
|
*/
|
|
42
|
-
readonly
|
|
42
|
+
readonly agent: Agent;
|
|
43
43
|
/**
|
|
44
|
-
* Initialize
|
|
44
|
+
* Initialize Tabstack client
|
|
45
45
|
*
|
|
46
46
|
* @param options - Configuration options
|
|
47
47
|
* @throws Error if apiKey is empty or not provided
|
|
48
48
|
*
|
|
49
49
|
* @example
|
|
50
50
|
* ```typescript
|
|
51
|
-
* const tabs = new
|
|
51
|
+
* const tabs = new Tabstack({
|
|
52
52
|
* apiKey: 'your-api-key-here'
|
|
53
53
|
* });
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
|
-
constructor(options:
|
|
56
|
+
constructor(options: TabstackOptions);
|
|
57
57
|
}
|
|
58
58
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/esm/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,UAAU,CAAa;IAE/B;;OAEG;IACH,SAAgB,OAAO,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IAEnC;;OAEG;IACH,SAAgB,KAAK,EAAE,KAAK,CAAC;IAE7B;;;;;;;;;;;;OAYG;gBACS,OAAO,EAAE,eAAe;CAerC"}
|
package/dist/esm/client.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Main client for
|
|
2
|
+
* Main client for Tabstack SDK
|
|
3
3
|
*/
|
|
4
4
|
import { HTTPClient } from './util/http.js';
|
|
5
5
|
import { Extract } from './extract.js';
|
|
6
6
|
import { Generate } from './generate.js';
|
|
7
|
-
import {
|
|
7
|
+
import { Agent } from './agent.js';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Tabstack client for web content extraction, generation, and automation
|
|
10
10
|
*
|
|
11
|
-
* This is the main entry point for the
|
|
11
|
+
* This is the main entry point for the Tabstack SDK. Initialize it with your
|
|
12
12
|
* API key to access the extract, generate, and automate operators.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
|
16
|
-
* import {
|
|
16
|
+
* import { Tabstack } from '@tabstack/sdk';
|
|
17
17
|
*
|
|
18
|
-
* const tabs = new
|
|
18
|
+
* const tabs = new Tabstack({
|
|
19
19
|
* apiKey: process.env.TABSTACK_API_KEY!
|
|
20
20
|
* });
|
|
21
21
|
*
|
|
@@ -23,16 +23,16 @@ import { Automate } from './automate.js';
|
|
|
23
23
|
* console.log(result.content);
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
export class
|
|
26
|
+
export class Tabstack {
|
|
27
27
|
/**
|
|
28
|
-
* Initialize
|
|
28
|
+
* Initialize Tabstack client
|
|
29
29
|
*
|
|
30
30
|
* @param options - Configuration options
|
|
31
31
|
* @throws Error if apiKey is empty or not provided
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
34
|
* ```typescript
|
|
35
|
-
* const tabs = new
|
|
35
|
+
* const tabs = new Tabstack({
|
|
36
36
|
* apiKey: 'your-api-key-here'
|
|
37
37
|
* });
|
|
38
38
|
* ```
|
|
@@ -48,7 +48,7 @@ export class TABStack {
|
|
|
48
48
|
// Initialize operators
|
|
49
49
|
this.extract = new Extract(this.httpClient);
|
|
50
50
|
this.generate = new Generate(this.httpClient);
|
|
51
|
-
this.
|
|
51
|
+
this.agent = new Agent(this.httpClient);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
//# sourceMappingURL=client.js.map
|
package/dist/esm/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAOhC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,QAAQ;IAkBnB;;;;;;;;;;;;OAYG;IACH,YAAY,OAAwB;QAClC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC1D,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC;YAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC,CAAC;QAEH,uBAAuB;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
package/dist/esm/client.test.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tests for
|
|
2
|
+
* Tests for Tabstack Client
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Tabstack } from './client.js';
|
|
5
5
|
import { Extract } from './extract.js';
|
|
6
6
|
import { Generate } from './generate.js';
|
|
7
|
-
import {
|
|
7
|
+
import { Agent } from './agent.js';
|
|
8
8
|
import { HTTPClient } from './util/http.js';
|
|
9
9
|
// Mock dependencies
|
|
10
10
|
jest.mock('./util/http');
|
|
11
11
|
jest.mock('./extract');
|
|
12
12
|
jest.mock('./generate');
|
|
13
|
-
jest.mock('./
|
|
14
|
-
describe('
|
|
13
|
+
jest.mock('./agent');
|
|
14
|
+
describe('Tabstack Client', () => {
|
|
15
15
|
beforeEach(() => {
|
|
16
16
|
jest.clearAllMocks();
|
|
17
17
|
});
|
|
18
18
|
describe('constructor', () => {
|
|
19
19
|
it('should create client with valid API key', () => {
|
|
20
|
-
const client = new
|
|
21
|
-
expect(client).toBeInstanceOf(
|
|
20
|
+
const client = new Tabstack({ apiKey: 'test-api-key' });
|
|
21
|
+
expect(client).toBeInstanceOf(Tabstack);
|
|
22
22
|
expect(HTTPClient).toHaveBeenCalledWith({
|
|
23
23
|
apiKey: 'test-api-key',
|
|
24
24
|
baseURL: undefined,
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
it('should create client with API key and custom baseURL', () => {
|
|
28
|
-
const client = new
|
|
28
|
+
const client = new Tabstack({
|
|
29
29
|
apiKey: 'test-api-key',
|
|
30
30
|
baseURL: 'https://custom.api.com',
|
|
31
31
|
});
|
|
32
|
-
expect(client).toBeInstanceOf(
|
|
32
|
+
expect(client).toBeInstanceOf(Tabstack);
|
|
33
33
|
expect(HTTPClient).toHaveBeenCalledWith({
|
|
34
34
|
apiKey: 'test-api-key',
|
|
35
35
|
baseURL: 'https://custom.api.com',
|
|
@@ -38,73 +38,73 @@ describe('TABStack Client', () => {
|
|
|
38
38
|
it('should throw error when API key is missing', () => {
|
|
39
39
|
expect(() => {
|
|
40
40
|
// @ts-expect-error Testing missing apiKey
|
|
41
|
-
new
|
|
41
|
+
new Tabstack({});
|
|
42
42
|
}).toThrow('apiKey is required');
|
|
43
43
|
});
|
|
44
44
|
it('should throw error when API key is empty string', () => {
|
|
45
45
|
expect(() => {
|
|
46
|
-
new
|
|
46
|
+
new Tabstack({ apiKey: '' });
|
|
47
47
|
}).toThrow('apiKey is required');
|
|
48
48
|
});
|
|
49
49
|
it('should throw error when API key is null', () => {
|
|
50
50
|
expect(() => {
|
|
51
51
|
// @ts-expect-error Testing null apiKey
|
|
52
|
-
new
|
|
52
|
+
new Tabstack({ apiKey: null });
|
|
53
53
|
}).toThrow('apiKey is required');
|
|
54
54
|
});
|
|
55
55
|
it('should throw error when API key is undefined', () => {
|
|
56
56
|
expect(() => {
|
|
57
57
|
// @ts-expect-error Testing undefined apiKey
|
|
58
|
-
new
|
|
58
|
+
new Tabstack({ apiKey: undefined });
|
|
59
59
|
}).toThrow('apiKey is required');
|
|
60
60
|
});
|
|
61
61
|
it('should initialize all operators', () => {
|
|
62
|
-
const client = new
|
|
62
|
+
const client = new Tabstack({ apiKey: 'test-api-key' });
|
|
63
63
|
expect(client.extract).toBeInstanceOf(Extract);
|
|
64
64
|
expect(client.generate).toBeInstanceOf(Generate);
|
|
65
|
-
expect(client.
|
|
65
|
+
expect(client.agent).toBeInstanceOf(Agent);
|
|
66
66
|
});
|
|
67
67
|
it('should pass HTTPClient to all operators', () => {
|
|
68
|
-
void new
|
|
68
|
+
void new Tabstack({ apiKey: 'test-api-key' });
|
|
69
69
|
expect(Extract).toHaveBeenCalledTimes(1);
|
|
70
70
|
expect(Generate).toHaveBeenCalledTimes(1);
|
|
71
|
-
expect(
|
|
71
|
+
expect(Agent).toHaveBeenCalledTimes(1);
|
|
72
72
|
// Verify they were called with the HTTPClient instance
|
|
73
73
|
const httpClientInstance = HTTPClient.mock
|
|
74
74
|
.instances[0];
|
|
75
75
|
expect(Extract).toHaveBeenCalledWith(httpClientInstance);
|
|
76
76
|
expect(Generate).toHaveBeenCalledWith(httpClientInstance);
|
|
77
|
-
expect(
|
|
77
|
+
expect(Agent).toHaveBeenCalledWith(httpClientInstance);
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
describe('operators', () => {
|
|
81
81
|
it('should have extract operator', () => {
|
|
82
|
-
const client = new
|
|
82
|
+
const client = new Tabstack({ apiKey: 'test-api-key' });
|
|
83
83
|
expect(client.extract).toBeDefined();
|
|
84
84
|
expect(client.extract).toBeInstanceOf(Extract);
|
|
85
85
|
});
|
|
86
86
|
it('should have generate operator', () => {
|
|
87
|
-
const client = new
|
|
87
|
+
const client = new Tabstack({ apiKey: 'test-api-key' });
|
|
88
88
|
expect(client.generate).toBeDefined();
|
|
89
89
|
expect(client.generate).toBeInstanceOf(Generate);
|
|
90
90
|
});
|
|
91
|
-
it('should have
|
|
92
|
-
const client = new
|
|
93
|
-
expect(client.
|
|
94
|
-
expect(client.
|
|
91
|
+
it('should have agent client', () => {
|
|
92
|
+
const client = new Tabstack({ apiKey: 'test-api-key' });
|
|
93
|
+
expect(client.agent).toBeDefined();
|
|
94
|
+
expect(client.agent).toBeInstanceOf(Agent);
|
|
95
95
|
});
|
|
96
96
|
it('should have readonly operators', () => {
|
|
97
|
-
const client = new
|
|
97
|
+
const client = new Tabstack({ apiKey: 'test-api-key' });
|
|
98
98
|
// TypeScript ensures readonly, but we can verify they exist
|
|
99
99
|
expect(Object.getOwnPropertyDescriptor(client, 'extract')).toBeDefined();
|
|
100
100
|
expect(Object.getOwnPropertyDescriptor(client, 'generate')).toBeDefined();
|
|
101
|
-
expect(Object.getOwnPropertyDescriptor(client, '
|
|
101
|
+
expect(Object.getOwnPropertyDescriptor(client, 'agent')).toBeDefined();
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
describe('multiple instances', () => {
|
|
105
105
|
it('should create independent client instances', () => {
|
|
106
|
-
const client1 = new
|
|
107
|
-
const client2 = new
|
|
106
|
+
const client1 = new Tabstack({ apiKey: 'key1' });
|
|
107
|
+
const client2 = new Tabstack({ apiKey: 'key2' });
|
|
108
108
|
expect(client1).not.toBe(client2);
|
|
109
109
|
expect(HTTPClient).toHaveBeenCalledTimes(2);
|
|
110
110
|
expect(HTTPClient).toHaveBeenNthCalledWith(1, {
|
|
@@ -117,11 +117,11 @@ describe('TABStack Client', () => {
|
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
it('should create clients with different baseURLs', () => {
|
|
120
|
-
void new
|
|
120
|
+
void new Tabstack({
|
|
121
121
|
apiKey: 'key1',
|
|
122
122
|
baseURL: 'https://api1.example.com',
|
|
123
123
|
});
|
|
124
|
-
void new
|
|
124
|
+
void new Tabstack({
|
|
125
125
|
apiKey: 'key2',
|
|
126
126
|
baseURL: 'https://api2.example.com',
|
|
127
127
|
});
|
|
@@ -146,32 +146,32 @@ describe('TABStack Client', () => {
|
|
|
146
146
|
'my_api_key_with_underscores',
|
|
147
147
|
];
|
|
148
148
|
validKeys.forEach((key) => {
|
|
149
|
-
expect(() => new
|
|
149
|
+
expect(() => new Tabstack({ apiKey: key })).not.toThrow();
|
|
150
150
|
});
|
|
151
151
|
});
|
|
152
152
|
it('should reject non-string API keys', () => {
|
|
153
153
|
const invalidKeys = [123, true, {}, []];
|
|
154
154
|
invalidKeys.forEach((key) => {
|
|
155
155
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
156
|
-
expect(() => new
|
|
156
|
+
expect(() => new Tabstack({ apiKey: key })).toThrow('apiKey is required');
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
159
|
it('should handle whitespace-only API keys', () => {
|
|
160
|
-
expect(() => new
|
|
160
|
+
expect(() => new Tabstack({ apiKey: ' ' })).not.toThrow();
|
|
161
161
|
// Note: The client doesn't trim whitespace, so this technically passes
|
|
162
162
|
// The actual validation happens at the API level
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
describe('configuration', () => {
|
|
166
166
|
it('should handle default configuration', () => {
|
|
167
|
-
void new
|
|
167
|
+
void new Tabstack({ apiKey: 'test-key' });
|
|
168
168
|
expect(HTTPClient).toHaveBeenCalledWith({
|
|
169
169
|
apiKey: 'test-key',
|
|
170
170
|
baseURL: undefined,
|
|
171
171
|
});
|
|
172
172
|
});
|
|
173
173
|
it('should handle custom baseURL with trailing slash', () => {
|
|
174
|
-
void new
|
|
174
|
+
void new Tabstack({
|
|
175
175
|
apiKey: 'test-key',
|
|
176
176
|
baseURL: 'https://custom.api.com/',
|
|
177
177
|
});
|
|
@@ -181,7 +181,7 @@ describe('TABStack Client', () => {
|
|
|
181
181
|
});
|
|
182
182
|
});
|
|
183
183
|
it('should handle custom baseURL without trailing slash', () => {
|
|
184
|
-
void new
|
|
184
|
+
void new Tabstack({
|
|
185
185
|
apiKey: 'test-key',
|
|
186
186
|
baseURL: 'https://custom.api.com',
|
|
187
187
|
});
|
|
@@ -191,7 +191,7 @@ describe('TABStack Client', () => {
|
|
|
191
191
|
});
|
|
192
192
|
});
|
|
193
193
|
it('should handle localhost baseURL', () => {
|
|
194
|
-
void new
|
|
194
|
+
void new Tabstack({
|
|
195
195
|
apiKey: 'test-key',
|
|
196
196
|
baseURL: 'http://localhost:8080',
|
|
197
197
|
});
|
|
@@ -202,52 +202,51 @@ describe('TABStack Client', () => {
|
|
|
202
202
|
});
|
|
203
203
|
});
|
|
204
204
|
describe('type safety', () => {
|
|
205
|
-
it('should enforce
|
|
205
|
+
it('should enforce TabstackOptions interface', () => {
|
|
206
206
|
// This test ensures TypeScript types are working correctly
|
|
207
207
|
const options = {
|
|
208
208
|
apiKey: 'test-key',
|
|
209
209
|
baseURL: 'https://api.example.com',
|
|
210
210
|
};
|
|
211
|
-
const client = new
|
|
212
|
-
expect(client).toBeInstanceOf(
|
|
211
|
+
const client = new Tabstack(options);
|
|
212
|
+
expect(client).toBeInstanceOf(Tabstack);
|
|
213
213
|
});
|
|
214
214
|
it('should allow optional baseURL', () => {
|
|
215
215
|
const options = { apiKey: 'test-key' };
|
|
216
|
-
const client = new
|
|
217
|
-
expect(client).toBeInstanceOf(
|
|
216
|
+
const client = new Tabstack(options);
|
|
217
|
+
expect(client).toBeInstanceOf(Tabstack);
|
|
218
218
|
});
|
|
219
219
|
});
|
|
220
220
|
describe('integration', () => {
|
|
221
221
|
it('should allow chaining operator methods', () => {
|
|
222
|
-
const client = new
|
|
222
|
+
const client = new Tabstack({ apiKey: 'test-key' });
|
|
223
223
|
// Verify operators exist and can be accessed
|
|
224
224
|
expect(client.extract.markdown).toBeDefined();
|
|
225
|
-
expect(client.extract.schema).toBeDefined();
|
|
226
225
|
expect(client.extract.json).toBeDefined();
|
|
227
226
|
expect(client.generate.json).toBeDefined();
|
|
228
|
-
expect(client.automate
|
|
227
|
+
expect(client.agent.automate).toBeDefined();
|
|
229
228
|
});
|
|
230
229
|
it('should maintain separate operator instances per client', () => {
|
|
231
|
-
const client1 = new
|
|
232
|
-
const client2 = new
|
|
230
|
+
const client1 = new Tabstack({ apiKey: 'key1' });
|
|
231
|
+
const client2 = new Tabstack({ apiKey: 'key2' });
|
|
233
232
|
expect(client1.extract).not.toBe(client2.extract);
|
|
234
233
|
expect(client1.generate).not.toBe(client2.generate);
|
|
235
|
-
expect(client1.
|
|
234
|
+
expect(client1.agent).not.toBe(client2.agent);
|
|
236
235
|
});
|
|
237
236
|
});
|
|
238
237
|
describe('error handling', () => {
|
|
239
238
|
it('should throw descriptive error for missing apiKey', () => {
|
|
240
239
|
expect(() => {
|
|
241
240
|
// @ts-expect-error Testing missing apiKey
|
|
242
|
-
new
|
|
241
|
+
new Tabstack({});
|
|
243
242
|
}).toThrow('apiKey is required');
|
|
244
243
|
});
|
|
245
244
|
it('should throw error immediately on construction, not on first use', () => {
|
|
246
245
|
// @ts-expect-error Testing missing apiKey
|
|
247
|
-
expect(() => new
|
|
246
|
+
expect(() => new Tabstack({})).toThrow();
|
|
248
247
|
// Should not throw if apiKey is provided
|
|
249
|
-
const client = new
|
|
250
|
-
expect(client).toBeInstanceOf(
|
|
248
|
+
const client = new Tabstack({ apiKey: 'test-key' });
|
|
249
|
+
expect(client).toBeInstanceOf(Tabstack);
|
|
251
250
|
});
|
|
252
251
|
});
|
|
253
252
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.test.js","sourceRoot":"","sources":["../../src/client.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"client.test.js","sourceRoot":"","sources":["../../src/client.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAA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AC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC3D,MAAM,CAAC,GAAG,EAAE;gBACV,0CAA0C;gBAC1C,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAC;YACnB,CAAC,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;YAC1E,0CAA0C;YAC1C,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YAEzC,yCAAyC;YACzC,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;YACpD,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/esm/exceptions.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Custom exceptions for
|
|
2
|
+
* Custom exceptions for Tabstack SDK
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Base error class for all
|
|
5
|
+
* Base error class for all Tabstack errors
|
|
6
6
|
*/
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class TabstackError extends Error {
|
|
8
8
|
statusCode?: number | undefined;
|
|
9
9
|
constructor(message: string, statusCode?: number | undefined);
|
|
10
10
|
}
|
|
@@ -13,7 +13,7 @@ export declare class TABStackError extends Error {
|
|
|
13
13
|
*
|
|
14
14
|
* Raised when the request is malformed or missing required fields.
|
|
15
15
|
*/
|
|
16
|
-
export declare class BadRequestError extends
|
|
16
|
+
export declare class BadRequestError extends TabstackError {
|
|
17
17
|
constructor(message: string);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -21,7 +21,7 @@ export declare class BadRequestError extends TABStackError {
|
|
|
21
21
|
*
|
|
22
22
|
* Raised when the API key is invalid or missing.
|
|
23
23
|
*/
|
|
24
|
-
export declare class UnauthorizedError extends
|
|
24
|
+
export declare class UnauthorizedError extends TabstackError {
|
|
25
25
|
constructor(message?: string);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
@@ -29,7 +29,7 @@ export declare class UnauthorizedError extends TABStackError {
|
|
|
29
29
|
*
|
|
30
30
|
* Raised when the provided URL is invalid or inaccessible.
|
|
31
31
|
*/
|
|
32
|
-
export declare class InvalidURLError extends
|
|
32
|
+
export declare class InvalidURLError extends TabstackError {
|
|
33
33
|
constructor(message?: string);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
@@ -37,7 +37,7 @@ export declare class InvalidURLError extends TABStackError {
|
|
|
37
37
|
*
|
|
38
38
|
* Raised when the server encounters an error processing the request.
|
|
39
39
|
*/
|
|
40
|
-
export declare class ServerError extends
|
|
40
|
+
export declare class ServerError extends TabstackError {
|
|
41
41
|
constructor(message?: string);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
@@ -45,13 +45,13 @@ export declare class ServerError extends TABStackError {
|
|
|
45
45
|
*
|
|
46
46
|
* Raised when a service (e.g., automate) is not available or not configured.
|
|
47
47
|
*/
|
|
48
|
-
export declare class ServiceUnavailableError extends
|
|
48
|
+
export declare class ServiceUnavailableError extends TabstackError {
|
|
49
49
|
constructor(message?: string);
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Generic API error for unexpected status codes
|
|
53
53
|
*/
|
|
54
|
-
export declare class APIError extends
|
|
54
|
+
export declare class APIError extends TabstackError {
|
|
55
55
|
constructor(message: string, statusCode: number);
|
|
56
56
|
}
|
|
57
57
|
//# sourceMappingURL=exceptions.d.ts.map
|
package/dist/esm/exceptions.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Custom exceptions for
|
|
2
|
+
* Custom exceptions for Tabstack SDK
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Base error class for all
|
|
5
|
+
* Base error class for all Tabstack errors
|
|
6
6
|
*/
|
|
7
|
-
export class
|
|
7
|
+
export class TabstackError extends Error {
|
|
8
8
|
constructor(message, statusCode) {
|
|
9
9
|
super(message);
|
|
10
10
|
this.statusCode = statusCode;
|
|
11
|
-
this.name = '
|
|
12
|
-
Object.setPrototypeOf(this,
|
|
11
|
+
this.name = 'TabstackError';
|
|
12
|
+
Object.setPrototypeOf(this, TabstackError.prototype);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
@@ -17,7 +17,7 @@ export class TABStackError extends Error {
|
|
|
17
17
|
*
|
|
18
18
|
* Raised when the request is malformed or missing required fields.
|
|
19
19
|
*/
|
|
20
|
-
export class BadRequestError extends
|
|
20
|
+
export class BadRequestError extends TabstackError {
|
|
21
21
|
constructor(message) {
|
|
22
22
|
super(message, 400);
|
|
23
23
|
this.name = 'BadRequestError';
|
|
@@ -29,7 +29,7 @@ export class BadRequestError extends TABStackError {
|
|
|
29
29
|
*
|
|
30
30
|
* Raised when the API key is invalid or missing.
|
|
31
31
|
*/
|
|
32
|
-
export class UnauthorizedError extends
|
|
32
|
+
export class UnauthorizedError extends TabstackError {
|
|
33
33
|
constructor(message = 'Unauthorized - Invalid or missing API key') {
|
|
34
34
|
super(message, 401);
|
|
35
35
|
this.name = 'UnauthorizedError';
|
|
@@ -41,7 +41,7 @@ export class UnauthorizedError extends TABStackError {
|
|
|
41
41
|
*
|
|
42
42
|
* Raised when the provided URL is invalid or inaccessible.
|
|
43
43
|
*/
|
|
44
|
-
export class InvalidURLError extends
|
|
44
|
+
export class InvalidURLError extends TabstackError {
|
|
45
45
|
constructor(message = 'Invalid or inaccessible URL') {
|
|
46
46
|
super(message, 422);
|
|
47
47
|
this.name = 'InvalidURLError';
|
|
@@ -53,7 +53,7 @@ export class InvalidURLError extends TABStackError {
|
|
|
53
53
|
*
|
|
54
54
|
* Raised when the server encounters an error processing the request.
|
|
55
55
|
*/
|
|
56
|
-
export class ServerError extends
|
|
56
|
+
export class ServerError extends TabstackError {
|
|
57
57
|
constructor(message = 'Internal server error') {
|
|
58
58
|
super(message, 500);
|
|
59
59
|
this.name = 'ServerError';
|
|
@@ -65,7 +65,7 @@ export class ServerError extends TABStackError {
|
|
|
65
65
|
*
|
|
66
66
|
* Raised when a service (e.g., automate) is not available or not configured.
|
|
67
67
|
*/
|
|
68
|
-
export class ServiceUnavailableError extends
|
|
68
|
+
export class ServiceUnavailableError extends TabstackError {
|
|
69
69
|
constructor(message = 'Service unavailable') {
|
|
70
70
|
super(message, 503);
|
|
71
71
|
this.name = 'ServiceUnavailableError';
|
|
@@ -75,7 +75,7 @@ export class ServiceUnavailableError extends TABStackError {
|
|
|
75
75
|
/**
|
|
76
76
|
* Generic API error for unexpected status codes
|
|
77
77
|
*/
|
|
78
|
-
export class APIError extends
|
|
78
|
+
export class APIError extends TabstackError {
|
|
79
79
|
constructor(message, statusCode) {
|
|
80
80
|
super(message, statusCode);
|
|
81
81
|
this.name = 'APIError';
|