@superblocksteam/sabs-client 0.258.0 → 0.261.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.
@@ -0,0 +1,18 @@
1
+ import { BadRequestError, InternalServerError, NotFoundError, ConflictError, UnauthorizedError, ForbiddenError, HttpError } from '@superblocksteam/shared';
2
+ export { BadRequestError, InternalServerError, NotFoundError, ConflictError, UnauthorizedError, ForbiddenError, HttpError };
3
+ /**
4
+ * Internal factory function to create appropriate error types based on HTTP status codes
5
+ * @internal
6
+ */
7
+ export declare function createErrorFromStatusCode(statusCode: number, message: string): Error;
8
+ /**
9
+ * Internal function to create a client-side error (treated as BadRequestError with 400 status)
10
+ * @internal
11
+ */
12
+ export declare function createClientError(message: string): BadRequestError;
13
+ /**
14
+ * Internal function to create a network/unknown error (treated as InternalServerError with 500 status)
15
+ * @internal
16
+ */
17
+ export declare function createNetworkError(message: string, originalError?: Error): InternalServerError;
18
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,SAAS,EACV,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC;AAE5H;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAuBpF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAElE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,KAAK,GAAG,mBAAmB,CAK9F"}
package/dist/errors.js ADDED
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpError = exports.ForbiddenError = exports.UnauthorizedError = exports.ConflictError = exports.NotFoundError = exports.InternalServerError = exports.BadRequestError = void 0;
4
+ exports.createErrorFromStatusCode = createErrorFromStatusCode;
5
+ exports.createClientError = createClientError;
6
+ exports.createNetworkError = createNetworkError;
7
+ const shared_1 = require("@superblocksteam/shared");
8
+ Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return shared_1.BadRequestError; } });
9
+ Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return shared_1.InternalServerError; } });
10
+ Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return shared_1.NotFoundError; } });
11
+ Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return shared_1.ConflictError; } });
12
+ Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return shared_1.UnauthorizedError; } });
13
+ Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return shared_1.ForbiddenError; } });
14
+ Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return shared_1.HttpError; } });
15
+ /**
16
+ * Internal factory function to create appropriate error types based on HTTP status codes
17
+ * @internal
18
+ */
19
+ function createErrorFromStatusCode(statusCode, message) {
20
+ const baseMessage = `SABS API Error (${statusCode}): ${message}`;
21
+ switch (statusCode) {
22
+ case 400:
23
+ return new shared_1.BadRequestError(baseMessage);
24
+ case 401:
25
+ return new shared_1.UnauthorizedError(baseMessage);
26
+ case 403:
27
+ return new shared_1.ForbiddenError(baseMessage);
28
+ case 404:
29
+ return new shared_1.NotFoundError(baseMessage);
30
+ case 409:
31
+ return new shared_1.ConflictError(baseMessage);
32
+ case 500:
33
+ case 502:
34
+ case 503:
35
+ case 504:
36
+ return new shared_1.InternalServerError(baseMessage);
37
+ default:
38
+ // For any other status codes, use the generic HttpError
39
+ return new shared_1.HttpError(statusCode, baseMessage);
40
+ }
41
+ }
42
+ /**
43
+ * Internal function to create a client-side error (treated as BadRequestError with 400 status)
44
+ * @internal
45
+ */
46
+ function createClientError(message) {
47
+ return new shared_1.BadRequestError(`SABS Client Error: ${message}`);
48
+ }
49
+ /**
50
+ * Internal function to create a network/unknown error (treated as InternalServerError with 500 status)
51
+ * @internal
52
+ */
53
+ function createNetworkError(message, originalError) {
54
+ const errorMessage = originalError
55
+ ? `SABS Network Error: ${message} (caused by: ${originalError.message})`
56
+ : `SABS Network Error: ${message}`;
57
+ return new shared_1.InternalServerError(errorMessage);
58
+ }
59
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAiBA,8DAuBC;AAMD,8CAEC;AAMD,gDAKC;AA3DD,oDAQiC;AAGxB,gGAVP,wBAAe,OAUO;AAAE,oGATxB,4BAAmB,OASwB;AAAE,8FAR7C,sBAAa,OAQ6C;AAAE,8FAP5D,sBAAa,OAO4D;AAAE,kGAN3E,0BAAiB,OAM2E;AAAE,+FAL9F,uBAAc,OAK8F;AAAE,0FAJ9G,kBAAS,OAI8G;AAEzH;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,UAAkB,EAAE,OAAe;IAC3E,MAAM,WAAW,GAAG,mBAAmB,UAAU,MAAM,OAAO,EAAE,CAAC;IAEjE,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,GAAG;YACN,OAAO,IAAI,wBAAe,CAAC,WAAW,CAAC,CAAC;QAC1C,KAAK,GAAG;YACN,OAAO,IAAI,0BAAiB,CAAC,WAAW,CAAC,CAAC;QAC5C,KAAK,GAAG;YACN,OAAO,IAAI,uBAAc,CAAC,WAAW,CAAC,CAAC;QACzC,KAAK,GAAG;YACN,OAAO,IAAI,sBAAa,CAAC,WAAW,CAAC,CAAC;QACxC,KAAK,GAAG;YACN,OAAO,IAAI,sBAAa,CAAC,WAAW,CAAC,CAAC;QACxC,KAAK,GAAG,CAAC;QACT,KAAK,GAAG,CAAC;QACT,KAAK,GAAG,CAAC;QACT,KAAK,GAAG;YACN,OAAO,IAAI,4BAAmB,CAAC,WAAW,CAAC,CAAC;QAC9C;YACE,wDAAwD;YACxD,OAAO,IAAI,kBAAS,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,OAAe;IAC/C,OAAO,IAAI,wBAAe,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,OAAe,EAAE,aAAqB;IACvE,MAAM,YAAY,GAAG,aAAa;QAChC,CAAC,CAAC,uBAAuB,OAAO,gBAAgB,aAAa,CAAC,OAAO,GAAG;QACxE,CAAC,CAAC,uBAAuB,OAAO,EAAE,CAAC;IACrC,OAAO,IAAI,4BAAmB,CAAC,YAAY,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=errors.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.test.d.ts","sourceRoot":"","sources":["../src/errors.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const errors_1 = require("./errors");
4
+ describe('errors', () => {
5
+ describe('HttpError for unhandled status codes', () => {
6
+ test('creates error with correct properties', () => {
7
+ const status = 418;
8
+ const message = 'I am a teapot';
9
+ const error = new errors_1.HttpError(status, message);
10
+ expect(error).toBeInstanceOf(Error);
11
+ expect(error).toBeInstanceOf(errors_1.HttpError);
12
+ expect(error.name).toBe('Error');
13
+ expect(error.message).toBe(message);
14
+ expect(error.status).toBe(status);
15
+ expect(error.title).toBeUndefined(); // HttpError doesn't set title by default
16
+ });
17
+ test('has consistent interface with other error types', () => {
18
+ const error = new errors_1.HttpError(422, 'Test message');
19
+ expect(error.message).toBe('Test message');
20
+ expect(error.status).toBe(422);
21
+ // Should have the same interface as other HttpError types
22
+ expect('status' in error).toBe(true);
23
+ expect('message' in error).toBe(true);
24
+ });
25
+ test('has proper stack trace', () => {
26
+ const error = new errors_1.HttpError(500, 'Test error');
27
+ expect(error.stack).toBeDefined();
28
+ expect(error.stack).toContain('Test error');
29
+ });
30
+ });
31
+ describe('createErrorFromStatusCode', () => {
32
+ test('creates BadRequestError for status 400', () => {
33
+ const message = 'Invalid request';
34
+ const error = (0, errors_1.createErrorFromStatusCode)(400, message);
35
+ expect(error).toBeInstanceOf(errors_1.BadRequestError);
36
+ expect(error.message).toBe('SABS API Error (400): Invalid request');
37
+ });
38
+ test('creates UnauthorizedError for status 401', () => {
39
+ const message = 'Invalid credentials';
40
+ const error = (0, errors_1.createErrorFromStatusCode)(401, message);
41
+ expect(error).toBeInstanceOf(errors_1.UnauthorizedError);
42
+ expect(error.message).toBe('SABS API Error (401): Invalid credentials');
43
+ });
44
+ test('creates ForbiddenError for status 403', () => {
45
+ const message = 'Access denied';
46
+ const error = (0, errors_1.createErrorFromStatusCode)(403, message);
47
+ expect(error).toBeInstanceOf(errors_1.ForbiddenError);
48
+ expect(error.message).toBe('SABS API Error (403): Access denied');
49
+ });
50
+ test('creates NotFoundError for status 404', () => {
51
+ const message = 'Resource not found';
52
+ const error = (0, errors_1.createErrorFromStatusCode)(404, message);
53
+ expect(error).toBeInstanceOf(errors_1.NotFoundError);
54
+ expect(error.message).toBe('SABS API Error (404): Resource not found');
55
+ });
56
+ test('creates ConflictError for status 409', () => {
57
+ const message = 'Resource conflict';
58
+ const error = (0, errors_1.createErrorFromStatusCode)(409, message);
59
+ expect(error).toBeInstanceOf(errors_1.ConflictError);
60
+ expect(error.message).toBe('SABS API Error (409): Resource conflict');
61
+ });
62
+ test.each([500, 502, 503, 504])('creates InternalServerError for status %s', (statusCode) => {
63
+ const message = 'Server error';
64
+ const error = (0, errors_1.createErrorFromStatusCode)(statusCode, message);
65
+ expect(error).toBeInstanceOf(errors_1.InternalServerError);
66
+ expect(error.message).toBe(`SABS API Error (${statusCode}): Server error`);
67
+ });
68
+ test('creates HttpError for unhandled status codes', () => {
69
+ const statusCode = 418; // I'm a teapot
70
+ const message = 'Teapot error';
71
+ const error = (0, errors_1.createErrorFromStatusCode)(statusCode, message);
72
+ expect(error).toBeInstanceOf(errors_1.HttpError);
73
+ expect(error.message).toBe('SABS API Error (418): Teapot error');
74
+ if (error instanceof errors_1.HttpError) {
75
+ expect(error.status).toBe(statusCode);
76
+ }
77
+ });
78
+ test('handles edge case status codes', () => {
79
+ // Test some edge cases
80
+ const testCases = [
81
+ { status: 100, expected: errors_1.HttpError },
82
+ { status: 200, expected: errors_1.HttpError },
83
+ { status: 300, expected: errors_1.HttpError },
84
+ { status: 451, expected: errors_1.HttpError }, // Unavailable For Legal Reasons
85
+ { status: 999, expected: errors_1.HttpError }
86
+ ];
87
+ testCases.forEach(({ status, expected }) => {
88
+ const error = (0, errors_1.createErrorFromStatusCode)(status, 'Test message');
89
+ expect(error).toBeInstanceOf(expected);
90
+ });
91
+ });
92
+ test('all error types have consistent HttpError interface', () => {
93
+ const testCases = [
94
+ { statusCode: 400, expectedType: errors_1.BadRequestError, expectedTitle: 'Bad request' },
95
+ { statusCode: 500, expectedType: errors_1.InternalServerError, expectedTitle: 'Internal server error' },
96
+ { statusCode: 418, expectedType: errors_1.HttpError, expectedTitle: undefined }
97
+ ];
98
+ testCases.forEach(({ statusCode, expectedType, expectedTitle }) => {
99
+ const error = (0, errors_1.createErrorFromStatusCode)(statusCode, 'Test message');
100
+ expect(error).toBeInstanceOf(expectedType);
101
+ expect(error.message).toBe(`SABS API Error (${statusCode}): Test message`);
102
+ // All error types should have consistent HttpError interface
103
+ expect('status' in error).toBe(true);
104
+ if ('status' in error) {
105
+ expect(error.status).toBe(statusCode);
106
+ }
107
+ if ('title' in error) {
108
+ expect(error.title).toBe(expectedTitle);
109
+ }
110
+ });
111
+ });
112
+ test('returns standard error types for known status codes', () => {
113
+ const testCases = [
114
+ { status: 400, expectedType: errors_1.BadRequestError },
115
+ { status: 401, expectedType: errors_1.UnauthorizedError },
116
+ { status: 403, expectedType: errors_1.ForbiddenError },
117
+ { status: 404, expectedType: errors_1.NotFoundError },
118
+ { status: 409, expectedType: errors_1.ConflictError },
119
+ { status: 500, expectedType: errors_1.InternalServerError },
120
+ { status: 502, expectedType: errors_1.InternalServerError },
121
+ { status: 503, expectedType: errors_1.InternalServerError },
122
+ { status: 504, expectedType: errors_1.InternalServerError }
123
+ ];
124
+ testCases.forEach(({ status, expectedType }) => {
125
+ const error = (0, errors_1.createErrorFromStatusCode)(status, 'Test message');
126
+ expect(error).toBeInstanceOf(Error);
127
+ expect(error).toBeInstanceOf(expectedType);
128
+ expect(error.name).toBe('Error'); // Shared library errors use 'Error' as name
129
+ expect(error.message).toBe(`SABS API Error (${status}): Test message`);
130
+ });
131
+ });
132
+ });
133
+ describe('createClientError', () => {
134
+ test('creates BadRequestError with client error prefix', () => {
135
+ const message = 'Missing required parameter';
136
+ const error = (0, errors_1.createClientError)(message);
137
+ expect(error).toBeInstanceOf(errors_1.BadRequestError);
138
+ expect(error.message).toBe('SABS Client Error: Missing required parameter');
139
+ });
140
+ test('handles empty message', () => {
141
+ const error = (0, errors_1.createClientError)('');
142
+ expect(error.message).toBe('SABS Client Error: ');
143
+ });
144
+ test('handles special characters in message', () => {
145
+ const message = 'Invalid characters: <>&"\'';
146
+ const error = (0, errors_1.createClientError)(message);
147
+ expect(error.message).toBe(`SABS Client Error: ${message}`);
148
+ });
149
+ });
150
+ describe('createNetworkError', () => {
151
+ test('creates InternalServerError with network error prefix', () => {
152
+ const message = 'Connection refused';
153
+ const error = (0, errors_1.createNetworkError)(message);
154
+ expect(error).toBeInstanceOf(errors_1.InternalServerError);
155
+ expect(error.message).toBe('SABS Network Error: Connection refused');
156
+ });
157
+ test('includes original error message when provided', () => {
158
+ const message = 'Request failed';
159
+ const originalError = new Error('ECONNREFUSED');
160
+ const error = (0, errors_1.createNetworkError)(message, originalError);
161
+ expect(error).toBeInstanceOf(errors_1.InternalServerError);
162
+ expect(error.message).toBe('SABS Network Error: Request failed (caused by: ECONNREFUSED)');
163
+ });
164
+ test('handles original error without message', () => {
165
+ const message = 'Network issue';
166
+ const originalError = new Error(); // Empty message
167
+ const error = (0, errors_1.createNetworkError)(message, originalError);
168
+ expect(error.message).toBe('SABS Network Error: Network issue (caused by: )');
169
+ });
170
+ test('handles null original error', () => {
171
+ const message = 'Unknown network error';
172
+ const error = (0, errors_1.createNetworkError)(message, undefined);
173
+ expect(error.message).toBe('SABS Network Error: Unknown network error');
174
+ });
175
+ });
176
+ describe('error inheritance and instanceof checks', () => {
177
+ test('all error types are instances of Error', () => {
178
+ const errors = [
179
+ (0, errors_1.createErrorFromStatusCode)(400, 'Bad Request'),
180
+ (0, errors_1.createErrorFromStatusCode)(401, 'Unauthorized'),
181
+ (0, errors_1.createErrorFromStatusCode)(403, 'Forbidden'),
182
+ (0, errors_1.createErrorFromStatusCode)(404, 'Not Found'),
183
+ (0, errors_1.createErrorFromStatusCode)(409, 'Conflict'),
184
+ (0, errors_1.createErrorFromStatusCode)(500, 'Internal Server Error'),
185
+ (0, errors_1.createErrorFromStatusCode)(418, 'Teapot'),
186
+ (0, errors_1.createClientError)('Client error'),
187
+ (0, errors_1.createNetworkError)('Network error'),
188
+ new errors_1.HttpError(422, 'Custom error')
189
+ ];
190
+ errors.forEach((error) => {
191
+ expect(error).toBeInstanceOf(Error);
192
+ expect(error.message).toBeDefined();
193
+ expect(typeof error.message).toBe('string');
194
+ expect(error.name).toBeDefined();
195
+ });
196
+ });
197
+ test('error types can be distinguished via instanceof', () => {
198
+ const badRequestError = (0, errors_1.createErrorFromStatusCode)(400, 'Bad Request');
199
+ const unauthorizedError = (0, errors_1.createErrorFromStatusCode)(401, 'Unauthorized');
200
+ const notFoundError = (0, errors_1.createErrorFromStatusCode)(404, 'Not Found');
201
+ const httpError = (0, errors_1.createErrorFromStatusCode)(418, 'Teapot');
202
+ // All errors extend HttpError, so they're all instances of HttpError
203
+ expect(badRequestError).toBeInstanceOf(errors_1.BadRequestError);
204
+ expect(badRequestError).toBeInstanceOf(errors_1.HttpError);
205
+ expect(badRequestError).not.toBeInstanceOf(errors_1.UnauthorizedError);
206
+ expect(unauthorizedError).toBeInstanceOf(errors_1.UnauthorizedError);
207
+ expect(unauthorizedError).toBeInstanceOf(errors_1.HttpError);
208
+ expect(unauthorizedError).not.toBeInstanceOf(errors_1.BadRequestError);
209
+ expect(notFoundError).toBeInstanceOf(errors_1.NotFoundError);
210
+ expect(notFoundError).toBeInstanceOf(errors_1.HttpError);
211
+ expect(notFoundError).not.toBeInstanceOf(errors_1.BadRequestError);
212
+ expect(httpError).toBeInstanceOf(errors_1.HttpError);
213
+ expect(httpError).not.toBeInstanceOf(errors_1.BadRequestError);
214
+ });
215
+ });
216
+ describe('error serialization and JSON handling', () => {
217
+ test('errors can be converted to JSON for logging', () => {
218
+ const error = new errors_1.HttpError(422, 'Test error');
219
+ // Test that error properties are accessible for logging
220
+ const logObject = {
221
+ message: error.message,
222
+ name: error.name,
223
+ status: error.status,
224
+ title: error.title
225
+ };
226
+ expect(logObject.message).toBe('Test error');
227
+ expect(logObject.name).toBe('Error');
228
+ expect(logObject.status).toBe(422);
229
+ expect(logObject.title).toBeUndefined();
230
+ });
231
+ test('shared error types have basic error properties', () => {
232
+ const error = (0, errors_1.createErrorFromStatusCode)(400, 'Validation failed');
233
+ const logObject = {
234
+ message: error.message,
235
+ name: error.name,
236
+ stack: error.stack
237
+ };
238
+ expect(logObject.message).toBe('SABS API Error (400): Validation failed');
239
+ expect(logObject.name).toBeDefined();
240
+ expect(logObject.stack).toBeDefined();
241
+ });
242
+ });
243
+ describe('edge cases and error conditions', () => {
244
+ test('handles undefined and null inputs gracefully', () => {
245
+ // These should not throw, but create errors with undefined/null content
246
+ expect(() => (0, errors_1.createErrorFromStatusCode)(400, undefined)).not.toThrow();
247
+ expect(() => (0, errors_1.createErrorFromStatusCode)(400, null)).not.toThrow();
248
+ expect(() => (0, errors_1.createClientError)(undefined)).not.toThrow();
249
+ expect(() => (0, errors_1.createNetworkError)(undefined)).not.toThrow();
250
+ });
251
+ test('handles very large status codes', () => {
252
+ const error = (0, errors_1.createErrorFromStatusCode)(999999, 'Large status code');
253
+ expect(error).toBeInstanceOf(errors_1.HttpError);
254
+ if (error instanceof errors_1.HttpError) {
255
+ expect(error.status).toBe(999999);
256
+ }
257
+ });
258
+ test('handles negative status codes', () => {
259
+ const error = (0, errors_1.createErrorFromStatusCode)(-1, 'Negative status code');
260
+ expect(error).toBeInstanceOf(errors_1.HttpError);
261
+ if (error instanceof errors_1.HttpError) {
262
+ expect(error.status).toBe(-1);
263
+ }
264
+ });
265
+ test('handles very long error messages', () => {
266
+ const longMessage = 'x'.repeat(10000);
267
+ const error = (0, errors_1.createErrorFromStatusCode)(400, longMessage);
268
+ expect(error.message).toContain(longMessage);
269
+ });
270
+ });
271
+ });
272
+ //# sourceMappingURL=errors.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.test.js","sourceRoot":"","sources":["../src/errors.test.ts"],"names":[],"mappings":";;AAAA,qCAWkB;AAElB,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;QACpD,IAAI,CAAC,uCAAuC,EAAE,GAAG,EAAE;YACjD,MAAM,MAAM,GAAG,GAAG,CAAC;YACnB,MAAM,OAAO,GAAG,eAAe,CAAC;YAEhC,MAAM,KAAK,GAAG,IAAI,kBAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAE7C,MAAM,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACpC,MAAM,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,kBAAS,CAAC,CAAC;YACxC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,C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C,kBAAS,CAAC,CAAC;YACxC,IAAI,KAAK,YAAY,kBAAS,EAAE,CAAC;gBAC/B,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC5C,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtC,MAAM,KAAK,GAAG,IAAA,kCAAyB,EAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YAC1D,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './sabs';
2
+ export { BadRequestError, InternalServerError, NotFoundError, ConflictError, UnauthorizedError, ForbiddenError, HttpError } from './errors';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -14,5 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.HttpError = exports.ForbiddenError = exports.UnauthorizedError = exports.ConflictError = exports.NotFoundError = exports.InternalServerError = exports.BadRequestError = void 0;
17
18
  __exportStar(require("./sabs"), exports);
19
+ var errors_1 = require("./errors");
20
+ Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return errors_1.BadRequestError; } });
21
+ Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return errors_1.InternalServerError; } });
22
+ Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return errors_1.NotFoundError; } });
23
+ Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return errors_1.ConflictError; } });
24
+ Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return errors_1.UnauthorizedError; } });
25
+ Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return errors_1.ForbiddenError; } });
26
+ Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return errors_1.HttpError; } });
18
27
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,mCAA4I;AAAnI,yGAAA,eAAe,OAAA;AAAE,6GAAA,mBAAmB,OAAA;AAAE,uGAAA,aAAa,OAAA;AAAE,uGAAA,aAAa,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,mGAAA,SAAS,OAAA"}
package/dist/sabs.d.ts CHANGED
@@ -1,29 +1,111 @@
1
1
  import { ApplicationMetadata, BuildResponse, BuildStatus, ListResponse, StatusResponse, TerminateResponse, BulkStatusResponse, CreateLiveEditResponse, TerminateLiveEditResponse } from '@superblocksteam/sabs-types';
2
+ /**
3
+ * SABS (Superblocks Application Build System) TypeScript Client
4
+ *
5
+ * Provides methods to interact with the SABS API for building and managing applications.
6
+ *
7
+ * All error types inherit from the standard `HttpError` class that extends the standard `Error` class,
8
+ * ensuring backward compatibility with existing error handling code that catches generic `Error` instances
9
+ * used in earlier versions of the client library.
10
+ */
2
11
  export declare class SabsClient {
3
12
  private readonly baseUrl;
4
13
  constructor(baseUrl: string);
14
+ /**
15
+ * Start a new build for an application
16
+ *
17
+ * @param params - Build parameters
18
+ * @param params.directoryHash - Hash of the application directory to build
19
+ * @param params.meta - Application metadata (ID and organization ID)
20
+ * @param params.buildKey - Secret build key for authentication
21
+ * @param params.accessToken - JWT access token for authorization
22
+ * @returns Promise resolving to build information including build ID
23
+ * @throws BadRequestError if the directory hash, application metadata, application ID, organization ID, build key, or access token are empty or invalid
24
+ * @throws ForbiddenError if the access token is invalid or missing the required scopes
25
+ * @throws InternalServerError if the service has an unexpected error while performing this request
26
+ * @throws HttpError if the request fails for an unknown reason
27
+ */
5
28
  build({ directoryHash, meta, buildKey, accessToken }: {
6
29
  directoryHash: string;
7
30
  meta: ApplicationMetadata;
8
31
  buildKey: string;
9
32
  accessToken?: string;
10
33
  }): Promise<BuildResponse>;
34
+ /**
35
+ * Get the status of a build
36
+ *
37
+ * @param params - Status query parameters
38
+ * @param params.buildId - ID of the build to check
39
+ * @param params.accessToken - JWT access token for authorization
40
+ * @returns Promise resolving to build status information
41
+ * @throws BadRequestError if the build ID or access token is empty or invalid
42
+ * @throws UnauthorizedError if the access token is invalid or missing the required scopes
43
+ * @throws NotFoundError if the build ID is invalid
44
+ * @throws InternalServerError if the service has an unexpected error while performing this request
45
+ * @throws HttpError if the request fails for an unknown reason
46
+ */
11
47
  status({ buildId, accessToken }: {
12
48
  buildId: string;
13
49
  accessToken?: string;
14
50
  }): Promise<StatusResponse>;
51
+ /**
52
+ * Get the status of multiple builds at once
53
+ *
54
+ * @param params - Bulk status query parameters
55
+ * @param params.organizationId - Organization ID
56
+ * @param params.applicationId - Application ID
57
+ * @param params.directoryHashes - Array of directory hashes to check
58
+ * @param params.accessToken - JWT access token for authorization
59
+ * @returns Promise resolving to multiple build status information
60
+ * @throws BadRequestError if the organization ID, application ID, directory hashes, or access token are empty or invalid
61
+ * @throws UnauthorizedError if the access token is invalid or missing the required scopes
62
+ * @throws NotFoundError if the organization ID or application ID is invalid
63
+ * @throws InternalServerError if the service has an unexpected error while performing this request
64
+ * @throws HttpError if the request fails for an unknown reason
65
+ */
15
66
  bulkStatus({ organizationId, applicationId, directoryHashes, accessToken }: {
16
67
  organizationId: string;
17
68
  applicationId: string;
18
69
  directoryHashes: string[];
19
70
  accessToken?: string;
20
71
  }): Promise<BulkStatusResponse>;
72
+ /**
73
+ * List all builds for a specific application and directory
74
+ *
75
+ * @param params - List query parameters
76
+ * @param params.organizationId - Organization ID
77
+ * @param params.applicationId - Application ID
78
+ * @param params.directoryHash - Hash of the application directory
79
+ * @param params.accessToken - JWT access token for authorization
80
+ * @returns Promise resolving to list of builds
81
+ * @throws BadRequestError if the organization ID, application ID, directory hash, or access token are empty or invalid
82
+ * @throws UnauthorizedError if the access token is invalid or missing the required scopes
83
+ * @throws NotFoundError if the organization ID or application ID is invalid
84
+ * @throws InternalServerError if the service has an unexpected error while performing this request
85
+ * @throws HttpError if the request fails for an unknown reason
86
+ */
21
87
  list({ organizationId, applicationId, directoryHash, accessToken }: {
22
88
  organizationId: string;
23
89
  applicationId: string;
24
90
  directoryHash: string;
25
91
  accessToken?: string;
26
92
  }): Promise<ListResponse>;
93
+ /**
94
+ * Terminate a running build with a final status
95
+ *
96
+ * @param params - Termination parameters
97
+ * @param params.buildId - ID of the build to terminate
98
+ * @param params.status - Final status of the build
99
+ * @param params.buildKey - Secret build key for authentication
100
+ * @param params.error - Optional error message if build failed
101
+ * @param params.accessToken - JWT access token for authorization
102
+ * @returns Promise resolving to termination confirmation
103
+ * @throws BadRequestError if the build ID, build status, build key, or access token are empty or invalid
104
+ * @throws UnauthorizedError if the access token is invalid or missing the required scopes
105
+ * @throws NotFoundError if the build ID is invalid
106
+ * @throws InternalServerError if the service has an unexpected error while performing this request
107
+ * @throws HttpError if the request fails for an unknown reason
108
+ */
27
109
  terminate({ buildId, status, buildKey, error, accessToken }: {
28
110
  buildId: string;
29
111
  status: BuildStatus;
@@ -31,6 +113,21 @@ export declare class SabsClient {
31
113
  error?: string;
32
114
  accessToken?: string;
33
115
  }): Promise<TerminateResponse>;
116
+ /**
117
+ * Create a new live edit session for real-time development
118
+ *
119
+ * @param params - Live edit creation parameters
120
+ * @param params.applicationId - Application ID
121
+ * @param params.organizationId - Organization ID
122
+ * @param params.branch - Git branch name
123
+ * @param params.expiresIn - Session duration in seconds
124
+ * @param params.accessToken - JWT access token for authorization
125
+ * @returns Promise resolving to live edit session information
126
+ * @throws BadRequestError if the application ID, organization ID, branch, or access token are empty or invalid, or expiresIn is not greater than 0
127
+ * @throws UnauthorizedError if the access token is invalid or missing the required scopes
128
+ * @throws InternalServerError if the service has an unexpected error while performing this request
129
+ * @throws HttpError if the request fails for an unknown reason
130
+ */
34
131
  createLiveEdit({ applicationId, organizationId, branch, expiresIn, accessToken }: {
35
132
  applicationId: string;
36
133
  organizationId: string;
@@ -38,6 +135,19 @@ export declare class SabsClient {
38
135
  expiresIn: number;
39
136
  accessToken: string;
40
137
  }): Promise<CreateLiveEditResponse>;
138
+ /**
139
+ * Terminate an active live edit session
140
+ *
141
+ * @param params - Live edit termination parameters
142
+ * @param params.liveEditId - ID of the live edit session to terminate
143
+ * @param params.accessToken - JWT access token for authorization
144
+ * @returns Promise resolving to termination confirmation
145
+ * @throws BadRequestError if the live edit ID or access token are empty or invalid
146
+ * @throws UnauthorizedError if the access token is invalid or missing the required scopes
147
+ * @throws NotFoundError if the live edit ID is invalid
148
+ * @throws InternalServerError if the service has an unexpected error while performing this request
149
+ * @throws HttpError if the request fails for an unknown reason
150
+ */
41
151
  terminateLiveEdit({ liveEditId, accessToken }: {
42
152
  liveEditId: string;
43
153
  accessToken: string;
@@ -1 +1 @@
1
- {"version":3,"file":"sabs.d.ts","source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