@tabstack/sdk 1.0.0
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 +190 -0
- package/README.md +485 -0
- package/dist/cjs/automate.d.ts +156 -0
- package/dist/cjs/automate.d.ts.map +1 -0
- package/dist/cjs/automate.js +211 -0
- package/dist/cjs/automate.js.map +1 -0
- package/dist/cjs/automate.test.d.ts +5 -0
- package/dist/cjs/automate.test.d.ts.map +1 -0
- package/dist/cjs/automate.test.js +441 -0
- package/dist/cjs/automate.test.js.map +1 -0
- package/dist/cjs/client.d.ts +58 -0
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/client.js +58 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/client.test.d.ts +5 -0
- package/dist/cjs/client.test.d.ts.map +1 -0
- package/dist/cjs/client.test.js +256 -0
- package/dist/cjs/client.test.js.map +1 -0
- package/dist/cjs/exceptions.d.ts +57 -0
- package/dist/cjs/exceptions.d.ts.map +1 -0
- package/dist/cjs/exceptions.js +95 -0
- package/dist/cjs/exceptions.js.map +1 -0
- package/dist/cjs/exceptions.test.d.ts +5 -0
- package/dist/cjs/exceptions.test.d.ts.map +1 -0
- package/dist/cjs/exceptions.test.js +239 -0
- package/dist/cjs/exceptions.test.js.map +1 -0
- package/dist/cjs/extract.d.ts +206 -0
- package/dist/cjs/extract.d.ts.map +1 -0
- package/dist/cjs/extract.js +223 -0
- package/dist/cjs/extract.js.map +1 -0
- package/dist/cjs/extract.test.d.ts +5 -0
- package/dist/cjs/extract.test.d.ts.map +1 -0
- package/dist/cjs/extract.test.js +364 -0
- package/dist/cjs/extract.test.js.map +1 -0
- package/dist/cjs/generate.d.ts +113 -0
- package/dist/cjs/generate.d.ts.map +1 -0
- package/dist/cjs/generate.js +124 -0
- package/dist/cjs/generate.js.map +1 -0
- package/dist/cjs/generate.test.d.ts +5 -0
- package/dist/cjs/generate.test.d.ts.map +1 -0
- package/dist/cjs/generate.test.js +314 -0
- package/dist/cjs/generate.test.js.map +1 -0
- package/dist/cjs/index.d.ts +52 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +72 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/types.d.ts +73 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +118 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/types.test.d.ts +5 -0
- package/dist/cjs/types.test.d.ts.map +1 -0
- package/dist/cjs/types.test.js +370 -0
- package/dist/cjs/types.test.js.map +1 -0
- package/dist/cjs/util/http.d.ts +29 -0
- package/dist/cjs/util/http.d.ts.map +1 -0
- package/dist/cjs/util/http.js +201 -0
- package/dist/cjs/util/http.js.map +1 -0
- package/dist/cjs/util/http.test.d.ts +5 -0
- package/dist/cjs/util/http.test.d.ts.map +1 -0
- package/dist/cjs/util/http.test.js +237 -0
- package/dist/cjs/util/http.test.js.map +1 -0
- package/dist/esm/automate.d.ts +156 -0
- package/dist/esm/automate.d.ts.map +1 -0
- package/dist/esm/automate.js +207 -0
- package/dist/esm/automate.js.map +1 -0
- package/dist/esm/automate.test.d.ts +5 -0
- package/dist/esm/automate.test.d.ts.map +1 -0
- package/dist/esm/automate.test.js +439 -0
- package/dist/esm/automate.test.js.map +1 -0
- package/dist/esm/client.d.ts +58 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js +54 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/client.test.d.ts +5 -0
- package/dist/esm/client.test.d.ts.map +1 -0
- package/dist/esm/client.test.js +254 -0
- package/dist/esm/client.test.js.map +1 -0
- package/dist/esm/exceptions.d.ts +57 -0
- package/dist/esm/exceptions.d.ts.map +1 -0
- package/dist/esm/exceptions.js +85 -0
- package/dist/esm/exceptions.js.map +1 -0
- package/dist/esm/exceptions.test.d.ts +5 -0
- package/dist/esm/exceptions.test.d.ts.map +1 -0
- package/dist/esm/exceptions.test.js +237 -0
- package/dist/esm/exceptions.test.js.map +1 -0
- package/dist/esm/extract.d.ts +206 -0
- package/dist/esm/extract.d.ts.map +1 -0
- package/dist/esm/extract.js +219 -0
- package/dist/esm/extract.js.map +1 -0
- package/dist/esm/extract.test.d.ts +5 -0
- package/dist/esm/extract.test.d.ts.map +1 -0
- package/dist/esm/extract.test.js +362 -0
- package/dist/esm/extract.test.js.map +1 -0
- package/dist/esm/generate.d.ts +113 -0
- package/dist/esm/generate.d.ts.map +1 -0
- package/dist/esm/generate.js +120 -0
- package/dist/esm/generate.js.map +1 -0
- package/dist/esm/generate.test.d.ts +5 -0
- package/dist/esm/generate.test.d.ts.map +1 -0
- package/dist/esm/generate.test.js +312 -0
- package/dist/esm/generate.test.js.map +1 -0
- package/dist/esm/index.d.ts +52 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +53 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/types.d.ts +73 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +110 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/types.test.d.ts +5 -0
- package/dist/esm/types.test.d.ts.map +1 -0
- package/dist/esm/types.test.js +368 -0
- package/dist/esm/types.test.js.map +1 -0
- package/dist/esm/util/http.d.ts +29 -0
- package/dist/esm/util/http.d.ts.map +1 -0
- package/dist/esm/util/http.js +164 -0
- package/dist/esm/util/http.js.map +1 -0
- package/dist/esm/util/http.test.d.ts +5 -0
- package/dist/esm/util/http.test.d.ts.map +1 -0
- package/dist/esm/util/http.test.js +232 -0
- package/dist/esm/util/http.test.js.map +1 -0
- package/dist/types/automate.d.ts +156 -0
- package/dist/types/automate.d.ts.map +1 -0
- package/dist/types/automate.test.d.ts +5 -0
- package/dist/types/automate.test.d.ts.map +1 -0
- package/dist/types/client.d.ts +58 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/client.test.d.ts +5 -0
- package/dist/types/client.test.d.ts.map +1 -0
- package/dist/types/exceptions.d.ts +57 -0
- package/dist/types/exceptions.d.ts.map +1 -0
- package/dist/types/exceptions.test.d.ts +5 -0
- package/dist/types/exceptions.test.d.ts.map +1 -0
- package/dist/types/extract.d.ts +206 -0
- package/dist/types/extract.d.ts.map +1 -0
- package/dist/types/extract.test.d.ts +5 -0
- package/dist/types/extract.test.d.ts.map +1 -0
- package/dist/types/generate.d.ts +113 -0
- package/dist/types/generate.d.ts.map +1 -0
- package/dist/types/generate.test.d.ts +5 -0
- package/dist/types/generate.test.d.ts.map +1 -0
- package/dist/types/index.d.ts +52 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types.d.ts +73 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.test.d.ts +5 -0
- package/dist/types/types.test.d.ts.map +1 -0
- package/dist/types/util/http.d.ts +29 -0
- package/dist/types/util/http.d.ts.map +1 -0
- package/dist/types/util/http.test.d.ts +5 -0
- package/dist/types/util/http.test.d.ts.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tests for TABStack Client
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
const extract_1 = require("./extract");
|
|
8
|
+
const generate_1 = require("./generate");
|
|
9
|
+
const automate_1 = require("./automate");
|
|
10
|
+
const http_1 = require("./util/http");
|
|
11
|
+
// Mock dependencies
|
|
12
|
+
jest.mock('./util/http');
|
|
13
|
+
jest.mock('./extract');
|
|
14
|
+
jest.mock('./generate');
|
|
15
|
+
jest.mock('./automate');
|
|
16
|
+
describe('TABStack Client', () => {
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
jest.clearAllMocks();
|
|
19
|
+
});
|
|
20
|
+
describe('constructor', () => {
|
|
21
|
+
it('should create client with valid API key', () => {
|
|
22
|
+
const client = new client_1.TABStack({ apiKey: 'test-api-key' });
|
|
23
|
+
expect(client).toBeInstanceOf(client_1.TABStack);
|
|
24
|
+
expect(http_1.HTTPClient).toHaveBeenCalledWith({
|
|
25
|
+
apiKey: 'test-api-key',
|
|
26
|
+
baseURL: undefined,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it('should create client with API key and custom baseURL', () => {
|
|
30
|
+
const client = new client_1.TABStack({
|
|
31
|
+
apiKey: 'test-api-key',
|
|
32
|
+
baseURL: 'https://custom.api.com',
|
|
33
|
+
});
|
|
34
|
+
expect(client).toBeInstanceOf(client_1.TABStack);
|
|
35
|
+
expect(http_1.HTTPClient).toHaveBeenCalledWith({
|
|
36
|
+
apiKey: 'test-api-key',
|
|
37
|
+
baseURL: 'https://custom.api.com',
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
it('should throw error when API key is missing', () => {
|
|
41
|
+
expect(() => {
|
|
42
|
+
// @ts-expect-error Testing missing apiKey
|
|
43
|
+
new client_1.TABStack({});
|
|
44
|
+
}).toThrow('apiKey is required');
|
|
45
|
+
});
|
|
46
|
+
it('should throw error when API key is empty string', () => {
|
|
47
|
+
expect(() => {
|
|
48
|
+
new client_1.TABStack({ apiKey: '' });
|
|
49
|
+
}).toThrow('apiKey is required');
|
|
50
|
+
});
|
|
51
|
+
it('should throw error when API key is null', () => {
|
|
52
|
+
expect(() => {
|
|
53
|
+
// @ts-expect-error Testing null apiKey
|
|
54
|
+
new client_1.TABStack({ apiKey: null });
|
|
55
|
+
}).toThrow('apiKey is required');
|
|
56
|
+
});
|
|
57
|
+
it('should throw error when API key is undefined', () => {
|
|
58
|
+
expect(() => {
|
|
59
|
+
// @ts-expect-error Testing undefined apiKey
|
|
60
|
+
new client_1.TABStack({ apiKey: undefined });
|
|
61
|
+
}).toThrow('apiKey is required');
|
|
62
|
+
});
|
|
63
|
+
it('should initialize all operators', () => {
|
|
64
|
+
const client = new client_1.TABStack({ apiKey: 'test-api-key' });
|
|
65
|
+
expect(client.extract).toBeInstanceOf(extract_1.Extract);
|
|
66
|
+
expect(client.generate).toBeInstanceOf(generate_1.Generate);
|
|
67
|
+
expect(client.automate).toBeInstanceOf(automate_1.Automate);
|
|
68
|
+
});
|
|
69
|
+
it('should pass HTTPClient to all operators', () => {
|
|
70
|
+
void new client_1.TABStack({ apiKey: 'test-api-key' });
|
|
71
|
+
expect(extract_1.Extract).toHaveBeenCalledTimes(1);
|
|
72
|
+
expect(generate_1.Generate).toHaveBeenCalledTimes(1);
|
|
73
|
+
expect(automate_1.Automate).toHaveBeenCalledTimes(1);
|
|
74
|
+
// Verify they were called with the HTTPClient instance
|
|
75
|
+
const httpClientInstance = http_1.HTTPClient.mock
|
|
76
|
+
.instances[0];
|
|
77
|
+
expect(extract_1.Extract).toHaveBeenCalledWith(httpClientInstance);
|
|
78
|
+
expect(generate_1.Generate).toHaveBeenCalledWith(httpClientInstance);
|
|
79
|
+
expect(automate_1.Automate).toHaveBeenCalledWith(httpClientInstance);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('operators', () => {
|
|
83
|
+
it('should have extract operator', () => {
|
|
84
|
+
const client = new client_1.TABStack({ apiKey: 'test-api-key' });
|
|
85
|
+
expect(client.extract).toBeDefined();
|
|
86
|
+
expect(client.extract).toBeInstanceOf(extract_1.Extract);
|
|
87
|
+
});
|
|
88
|
+
it('should have generate operator', () => {
|
|
89
|
+
const client = new client_1.TABStack({ apiKey: 'test-api-key' });
|
|
90
|
+
expect(client.generate).toBeDefined();
|
|
91
|
+
expect(client.generate).toBeInstanceOf(generate_1.Generate);
|
|
92
|
+
});
|
|
93
|
+
it('should have automate operator', () => {
|
|
94
|
+
const client = new client_1.TABStack({ apiKey: 'test-api-key' });
|
|
95
|
+
expect(client.automate).toBeDefined();
|
|
96
|
+
expect(client.automate).toBeInstanceOf(automate_1.Automate);
|
|
97
|
+
});
|
|
98
|
+
it('should have readonly operators', () => {
|
|
99
|
+
const client = new client_1.TABStack({ apiKey: 'test-api-key' });
|
|
100
|
+
// TypeScript ensures readonly, but we can verify they exist
|
|
101
|
+
expect(Object.getOwnPropertyDescriptor(client, 'extract')).toBeDefined();
|
|
102
|
+
expect(Object.getOwnPropertyDescriptor(client, 'generate')).toBeDefined();
|
|
103
|
+
expect(Object.getOwnPropertyDescriptor(client, 'automate')).toBeDefined();
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
describe('multiple instances', () => {
|
|
107
|
+
it('should create independent client instances', () => {
|
|
108
|
+
const client1 = new client_1.TABStack({ apiKey: 'key1' });
|
|
109
|
+
const client2 = new client_1.TABStack({ apiKey: 'key2' });
|
|
110
|
+
expect(client1).not.toBe(client2);
|
|
111
|
+
expect(http_1.HTTPClient).toHaveBeenCalledTimes(2);
|
|
112
|
+
expect(http_1.HTTPClient).toHaveBeenNthCalledWith(1, {
|
|
113
|
+
apiKey: 'key1',
|
|
114
|
+
baseURL: undefined,
|
|
115
|
+
});
|
|
116
|
+
expect(http_1.HTTPClient).toHaveBeenNthCalledWith(2, {
|
|
117
|
+
apiKey: 'key2',
|
|
118
|
+
baseURL: undefined,
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
it('should create clients with different baseURLs', () => {
|
|
122
|
+
void new client_1.TABStack({
|
|
123
|
+
apiKey: 'key1',
|
|
124
|
+
baseURL: 'https://api1.example.com',
|
|
125
|
+
});
|
|
126
|
+
void new client_1.TABStack({
|
|
127
|
+
apiKey: 'key2',
|
|
128
|
+
baseURL: 'https://api2.example.com',
|
|
129
|
+
});
|
|
130
|
+
expect(http_1.HTTPClient).toHaveBeenCalledTimes(2);
|
|
131
|
+
expect(http_1.HTTPClient).toHaveBeenNthCalledWith(1, {
|
|
132
|
+
apiKey: 'key1',
|
|
133
|
+
baseURL: 'https://api1.example.com',
|
|
134
|
+
});
|
|
135
|
+
expect(http_1.HTTPClient).toHaveBeenNthCalledWith(2, {
|
|
136
|
+
apiKey: 'key2',
|
|
137
|
+
baseURL: 'https://api2.example.com',
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
describe('API key validation', () => {
|
|
142
|
+
it('should accept valid string API keys', () => {
|
|
143
|
+
const validKeys = [
|
|
144
|
+
'abc123',
|
|
145
|
+
'TABS_1234567890',
|
|
146
|
+
'sk-proj-1234567890abcdef',
|
|
147
|
+
'my-api-key-with-dashes',
|
|
148
|
+
'my_api_key_with_underscores',
|
|
149
|
+
];
|
|
150
|
+
validKeys.forEach((key) => {
|
|
151
|
+
expect(() => new client_1.TABStack({ apiKey: key })).not.toThrow();
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
it('should reject non-string API keys', () => {
|
|
155
|
+
const invalidKeys = [123, true, {}, []];
|
|
156
|
+
invalidKeys.forEach((key) => {
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
158
|
+
expect(() => new client_1.TABStack({ apiKey: key })).toThrow('apiKey is required');
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
it('should handle whitespace-only API keys', () => {
|
|
162
|
+
expect(() => new client_1.TABStack({ apiKey: ' ' })).not.toThrow();
|
|
163
|
+
// Note: The client doesn't trim whitespace, so this technically passes
|
|
164
|
+
// The actual validation happens at the API level
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
describe('configuration', () => {
|
|
168
|
+
it('should handle default configuration', () => {
|
|
169
|
+
void new client_1.TABStack({ apiKey: 'test-key' });
|
|
170
|
+
expect(http_1.HTTPClient).toHaveBeenCalledWith({
|
|
171
|
+
apiKey: 'test-key',
|
|
172
|
+
baseURL: undefined,
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
it('should handle custom baseURL with trailing slash', () => {
|
|
176
|
+
void new client_1.TABStack({
|
|
177
|
+
apiKey: 'test-key',
|
|
178
|
+
baseURL: 'https://custom.api.com/',
|
|
179
|
+
});
|
|
180
|
+
expect(http_1.HTTPClient).toHaveBeenCalledWith({
|
|
181
|
+
apiKey: 'test-key',
|
|
182
|
+
baseURL: 'https://custom.api.com/',
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
it('should handle custom baseURL without trailing slash', () => {
|
|
186
|
+
void new client_1.TABStack({
|
|
187
|
+
apiKey: 'test-key',
|
|
188
|
+
baseURL: 'https://custom.api.com',
|
|
189
|
+
});
|
|
190
|
+
expect(http_1.HTTPClient).toHaveBeenCalledWith({
|
|
191
|
+
apiKey: 'test-key',
|
|
192
|
+
baseURL: 'https://custom.api.com',
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
it('should handle localhost baseURL', () => {
|
|
196
|
+
void new client_1.TABStack({
|
|
197
|
+
apiKey: 'test-key',
|
|
198
|
+
baseURL: 'http://localhost:8080',
|
|
199
|
+
});
|
|
200
|
+
expect(http_1.HTTPClient).toHaveBeenCalledWith({
|
|
201
|
+
apiKey: 'test-key',
|
|
202
|
+
baseURL: 'http://localhost:8080',
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
describe('type safety', () => {
|
|
207
|
+
it('should enforce TABStackOptions interface', () => {
|
|
208
|
+
// This test ensures TypeScript types are working correctly
|
|
209
|
+
const options = {
|
|
210
|
+
apiKey: 'test-key',
|
|
211
|
+
baseURL: 'https://api.example.com',
|
|
212
|
+
};
|
|
213
|
+
const client = new client_1.TABStack(options);
|
|
214
|
+
expect(client).toBeInstanceOf(client_1.TABStack);
|
|
215
|
+
});
|
|
216
|
+
it('should allow optional baseURL', () => {
|
|
217
|
+
const options = { apiKey: 'test-key' };
|
|
218
|
+
const client = new client_1.TABStack(options);
|
|
219
|
+
expect(client).toBeInstanceOf(client_1.TABStack);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
describe('integration', () => {
|
|
223
|
+
it('should allow chaining operator methods', () => {
|
|
224
|
+
const client = new client_1.TABStack({ apiKey: 'test-key' });
|
|
225
|
+
// Verify operators exist and can be accessed
|
|
226
|
+
expect(client.extract.markdown).toBeDefined();
|
|
227
|
+
expect(client.extract.schema).toBeDefined();
|
|
228
|
+
expect(client.extract.json).toBeDefined();
|
|
229
|
+
expect(client.generate.json).toBeDefined();
|
|
230
|
+
expect(client.automate.execute).toBeDefined();
|
|
231
|
+
});
|
|
232
|
+
it('should maintain separate operator instances per client', () => {
|
|
233
|
+
const client1 = new client_1.TABStack({ apiKey: 'key1' });
|
|
234
|
+
const client2 = new client_1.TABStack({ apiKey: 'key2' });
|
|
235
|
+
expect(client1.extract).not.toBe(client2.extract);
|
|
236
|
+
expect(client1.generate).not.toBe(client2.generate);
|
|
237
|
+
expect(client1.automate).not.toBe(client2.automate);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
describe('error handling', () => {
|
|
241
|
+
it('should throw descriptive error for missing apiKey', () => {
|
|
242
|
+
expect(() => {
|
|
243
|
+
// @ts-expect-error Testing missing apiKey
|
|
244
|
+
new client_1.TABStack({});
|
|
245
|
+
}).toThrow('apiKey is required');
|
|
246
|
+
});
|
|
247
|
+
it('should throw error immediately on construction, not on first use', () => {
|
|
248
|
+
// @ts-expect-error Testing missing apiKey
|
|
249
|
+
expect(() => new client_1.TABStack({})).toThrow();
|
|
250
|
+
// Should not throw if apiKey is provided
|
|
251
|
+
const client = new client_1.TABStack({ apiKey: 'test-key' });
|
|
252
|
+
expect(client).toBeInstanceOf(client_1.TABStack);
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
//# sourceMappingURL=client.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.test.js","sourceRoot":"","sources":["../../src/client.test.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,qCAAoC;AACpC,uCAAoC;AACpC,yCAAsC;AACtC,yCAAsC;AACtC,sCAAyC;AAEzC,oBAAoB;AACpB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACzB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvB,IAAI,CAAC,IAAI,CAAC,YAAY,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AAC,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,iBAAQ,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,iBAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YAEzC,yCAAyC;YACzC,MAAM,MAAM,GAAG,IAAI,iBAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;YACpD,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,iBAAQ,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom exceptions for TABStack AI SDK
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base error class for all TABStack AI errors
|
|
6
|
+
*/
|
|
7
|
+
export declare class TABStackError extends Error {
|
|
8
|
+
statusCode?: number | undefined;
|
|
9
|
+
constructor(message: string, statusCode?: number | undefined);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Error for 400 Bad Request responses
|
|
13
|
+
*
|
|
14
|
+
* Raised when the request is malformed or missing required fields.
|
|
15
|
+
*/
|
|
16
|
+
export declare class BadRequestError extends TABStackError {
|
|
17
|
+
constructor(message: string);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Error for 401 Unauthorized responses
|
|
21
|
+
*
|
|
22
|
+
* Raised when the API key is invalid or missing.
|
|
23
|
+
*/
|
|
24
|
+
export declare class UnauthorizedError extends TABStackError {
|
|
25
|
+
constructor(message?: string);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Error for 422 Unprocessable Entity responses related to URLs
|
|
29
|
+
*
|
|
30
|
+
* Raised when the provided URL is invalid or inaccessible.
|
|
31
|
+
*/
|
|
32
|
+
export declare class InvalidURLError extends TABStackError {
|
|
33
|
+
constructor(message?: string);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Error for 500 Internal Server Error responses
|
|
37
|
+
*
|
|
38
|
+
* Raised when the server encounters an error processing the request.
|
|
39
|
+
*/
|
|
40
|
+
export declare class ServerError extends TABStackError {
|
|
41
|
+
constructor(message?: string);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Error for 503 Service Unavailable responses
|
|
45
|
+
*
|
|
46
|
+
* Raised when a service (e.g., automate) is not available or not configured.
|
|
47
|
+
*/
|
|
48
|
+
export declare class ServiceUnavailableError extends TABStackError {
|
|
49
|
+
constructor(message?: string);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Generic API error for unexpected status codes
|
|
53
|
+
*/
|
|
54
|
+
export declare class APIError extends TABStackError {
|
|
55
|
+
constructor(message: string, statusCode: number);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=exceptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../../src/exceptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IAG7B,UAAU,CAAC,EAAE,MAAM;gBAD1B,OAAO,EAAE,MAAM,EACR,UAAU,CAAC,EAAE,MAAM,YAAA;CAM7B;AAED;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,aAAa;gBACpC,OAAO,EAAE,MAAM;CAK5B;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,aAAa;gBACtC,OAAO,GAAE,MAAoD;CAK1E;AAED;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,aAAa;gBACpC,OAAO,GAAE,MAAsC;CAK5D;AAED;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,aAAa;gBAChC,OAAO,GAAE,MAAgC;CAKtD;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,aAAa;gBAC5C,OAAO,GAAE,MAA8B;CAKpD;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAAa;gBAC7B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAKhD"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Custom exceptions for TABStack AI SDK
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.APIError = exports.ServiceUnavailableError = exports.ServerError = exports.InvalidURLError = exports.UnauthorizedError = exports.BadRequestError = exports.TABStackError = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Base error class for all TABStack AI errors
|
|
9
|
+
*/
|
|
10
|
+
class TABStackError extends Error {
|
|
11
|
+
constructor(message, statusCode) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.statusCode = statusCode;
|
|
14
|
+
this.name = 'TABStackError';
|
|
15
|
+
Object.setPrototypeOf(this, TABStackError.prototype);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.TABStackError = TABStackError;
|
|
19
|
+
/**
|
|
20
|
+
* Error for 400 Bad Request responses
|
|
21
|
+
*
|
|
22
|
+
* Raised when the request is malformed or missing required fields.
|
|
23
|
+
*/
|
|
24
|
+
class BadRequestError extends TABStackError {
|
|
25
|
+
constructor(message) {
|
|
26
|
+
super(message, 400);
|
|
27
|
+
this.name = 'BadRequestError';
|
|
28
|
+
Object.setPrototypeOf(this, BadRequestError.prototype);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.BadRequestError = BadRequestError;
|
|
32
|
+
/**
|
|
33
|
+
* Error for 401 Unauthorized responses
|
|
34
|
+
*
|
|
35
|
+
* Raised when the API key is invalid or missing.
|
|
36
|
+
*/
|
|
37
|
+
class UnauthorizedError extends TABStackError {
|
|
38
|
+
constructor(message = 'Unauthorized - Invalid or missing API key') {
|
|
39
|
+
super(message, 401);
|
|
40
|
+
this.name = 'UnauthorizedError';
|
|
41
|
+
Object.setPrototypeOf(this, UnauthorizedError.prototype);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
45
|
+
/**
|
|
46
|
+
* Error for 422 Unprocessable Entity responses related to URLs
|
|
47
|
+
*
|
|
48
|
+
* Raised when the provided URL is invalid or inaccessible.
|
|
49
|
+
*/
|
|
50
|
+
class InvalidURLError extends TABStackError {
|
|
51
|
+
constructor(message = 'Invalid or inaccessible URL') {
|
|
52
|
+
super(message, 422);
|
|
53
|
+
this.name = 'InvalidURLError';
|
|
54
|
+
Object.setPrototypeOf(this, InvalidURLError.prototype);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.InvalidURLError = InvalidURLError;
|
|
58
|
+
/**
|
|
59
|
+
* Error for 500 Internal Server Error responses
|
|
60
|
+
*
|
|
61
|
+
* Raised when the server encounters an error processing the request.
|
|
62
|
+
*/
|
|
63
|
+
class ServerError extends TABStackError {
|
|
64
|
+
constructor(message = 'Internal server error') {
|
|
65
|
+
super(message, 500);
|
|
66
|
+
this.name = 'ServerError';
|
|
67
|
+
Object.setPrototypeOf(this, ServerError.prototype);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.ServerError = ServerError;
|
|
71
|
+
/**
|
|
72
|
+
* Error for 503 Service Unavailable responses
|
|
73
|
+
*
|
|
74
|
+
* Raised when a service (e.g., automate) is not available or not configured.
|
|
75
|
+
*/
|
|
76
|
+
class ServiceUnavailableError extends TABStackError {
|
|
77
|
+
constructor(message = 'Service unavailable') {
|
|
78
|
+
super(message, 503);
|
|
79
|
+
this.name = 'ServiceUnavailableError';
|
|
80
|
+
Object.setPrototypeOf(this, ServiceUnavailableError.prototype);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.ServiceUnavailableError = ServiceUnavailableError;
|
|
84
|
+
/**
|
|
85
|
+
* Generic API error for unexpected status codes
|
|
86
|
+
*/
|
|
87
|
+
class APIError extends TABStackError {
|
|
88
|
+
constructor(message, statusCode) {
|
|
89
|
+
super(message, statusCode);
|
|
90
|
+
this.name = 'APIError';
|
|
91
|
+
Object.setPrototypeOf(this, APIError.prototype);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.APIError = APIError;
|
|
95
|
+
//# sourceMappingURL=exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../src/exceptions.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK;IACtC,YACE,OAAe,EACR,UAAmB;QAE1B,KAAK,CAAC,OAAO,CAAC,CAAC;QAFR,eAAU,GAAV,UAAU,CAAS;QAG1B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AATD,sCASC;AAED;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,aAAa;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;CACF;AAND,0CAMC;AAED;;;;GAIG;AACH,MAAa,iBAAkB,SAAQ,aAAa;IAClD,YAAY,UAAkB,2CAA2C;QAC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