tuturuuu 0.1.5 → 0.1.7
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/dist/errors.d.ts +90 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +172 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/storage.d.ts +372 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +835 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +34 -0
- package/dist/types.js.map +1 -0
- package/package.json +31 -14
- package/src/errors.ts +202 -0
- package/src/index.ts +90 -0
- package/src/storage.ts +1066 -0
- package/src/types.ts +93 -0
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes for the Tuturuuu SDK
|
|
3
|
+
*/
|
|
4
|
+
import type { ApiErrorResponse } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Base error class for all SDK errors
|
|
7
|
+
*/
|
|
8
|
+
export declare class TuturuuuError extends Error {
|
|
9
|
+
readonly code?: string;
|
|
10
|
+
readonly statusCode?: number;
|
|
11
|
+
constructor(message: string, code?: string, statusCode?: number);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Authentication error (401)
|
|
15
|
+
*/
|
|
16
|
+
export declare class AuthenticationError extends TuturuuuError {
|
|
17
|
+
constructor(message: string, code?: string);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Authorization error (403)
|
|
21
|
+
*/
|
|
22
|
+
export declare class AuthorizationError extends TuturuuuError {
|
|
23
|
+
constructor(message: string, code?: string);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Not found error (404)
|
|
27
|
+
*/
|
|
28
|
+
export declare class NotFoundError extends TuturuuuError {
|
|
29
|
+
constructor(message: string, code?: string);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Bad request error (400)
|
|
33
|
+
*/
|
|
34
|
+
export declare class BadRequestError extends TuturuuuError {
|
|
35
|
+
constructor(message: string, code?: string);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Conflict error (409)
|
|
39
|
+
*/
|
|
40
|
+
export declare class ConflictError extends TuturuuuError {
|
|
41
|
+
constructor(message: string, code?: string);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Rate limit error (429)
|
|
45
|
+
*/
|
|
46
|
+
export declare class RateLimitError extends TuturuuuError {
|
|
47
|
+
/** Number of seconds to wait before retrying (from Retry-After header) */
|
|
48
|
+
readonly retryAfter?: number;
|
|
49
|
+
/** Unix timestamp when the rate limit resets (from X-RateLimit-Reset header) */
|
|
50
|
+
readonly resetTime?: number;
|
|
51
|
+
constructor(message: string, options?: {
|
|
52
|
+
code?: string;
|
|
53
|
+
retryAfter?: number;
|
|
54
|
+
resetTime?: number;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Internal server error (500)
|
|
59
|
+
*/
|
|
60
|
+
export declare class InternalServerError extends TuturuuuError {
|
|
61
|
+
constructor(message: string, code?: string);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Network error
|
|
65
|
+
*/
|
|
66
|
+
export declare class NetworkError extends TuturuuuError {
|
|
67
|
+
constructor(message: string);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Validation error
|
|
71
|
+
*/
|
|
72
|
+
export declare class ValidationError extends TuturuuuError {
|
|
73
|
+
constructor(message: string);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Options for creating a rate limit error from response headers
|
|
77
|
+
*/
|
|
78
|
+
export interface RateLimitHeaders {
|
|
79
|
+
retryAfter?: string | null;
|
|
80
|
+
resetTime?: string | null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Helper function to create appropriate error from API response
|
|
84
|
+
*/
|
|
85
|
+
export declare function createErrorFromResponse(response: ApiErrorResponse, statusCode: number, rateLimitHeaders?: RateLimitHeaders): TuturuuuError;
|
|
86
|
+
/**
|
|
87
|
+
* Type guard to check if an object is an ApiErrorResponse
|
|
88
|
+
*/
|
|
89
|
+
export declare function isApiErrorResponse(obj: unknown): obj is ApiErrorResponse;
|
|
90
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAgBhE;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;gBACxC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;gBACvC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,aAAa;gBAClC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;gBACpC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,aAAa;gBAClC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAC/C,0EAA0E;IAC1E,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,gFAAgF;IAChF,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAGjC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CAOJ;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;gBACxC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,gBAAgB,GAClC,aAAa,CA4Bf;AAWD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,gBAAgB,CASxE"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error classes for the Tuturuuu SDK
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ValidationError = exports.NetworkError = exports.InternalServerError = exports.RateLimitError = exports.ConflictError = exports.BadRequestError = exports.NotFoundError = exports.AuthorizationError = exports.AuthenticationError = exports.TuturuuuError = void 0;
|
|
7
|
+
exports.createErrorFromResponse = createErrorFromResponse;
|
|
8
|
+
exports.isApiErrorResponse = isApiErrorResponse;
|
|
9
|
+
/**
|
|
10
|
+
* Base error class for all SDK errors
|
|
11
|
+
*/
|
|
12
|
+
class TuturuuuError extends Error {
|
|
13
|
+
code;
|
|
14
|
+
statusCode;
|
|
15
|
+
constructor(message, code, statusCode) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = 'TuturuuuError';
|
|
18
|
+
this.code = code;
|
|
19
|
+
this.statusCode = statusCode;
|
|
20
|
+
// Maintains proper stack trace for where our error was thrown
|
|
21
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.TuturuuuError = TuturuuuError;
|
|
25
|
+
/**
|
|
26
|
+
* Authentication error (401)
|
|
27
|
+
*/
|
|
28
|
+
class AuthenticationError extends TuturuuuError {
|
|
29
|
+
constructor(message, code) {
|
|
30
|
+
super(message, code, 401);
|
|
31
|
+
this.name = 'AuthenticationError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.AuthenticationError = AuthenticationError;
|
|
35
|
+
/**
|
|
36
|
+
* Authorization error (403)
|
|
37
|
+
*/
|
|
38
|
+
class AuthorizationError extends TuturuuuError {
|
|
39
|
+
constructor(message, code) {
|
|
40
|
+
super(message, code, 403);
|
|
41
|
+
this.name = 'AuthorizationError';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.AuthorizationError = AuthorizationError;
|
|
45
|
+
/**
|
|
46
|
+
* Not found error (404)
|
|
47
|
+
*/
|
|
48
|
+
class NotFoundError extends TuturuuuError {
|
|
49
|
+
constructor(message, code) {
|
|
50
|
+
super(message, code, 404);
|
|
51
|
+
this.name = 'NotFoundError';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.NotFoundError = NotFoundError;
|
|
55
|
+
/**
|
|
56
|
+
* Bad request error (400)
|
|
57
|
+
*/
|
|
58
|
+
class BadRequestError extends TuturuuuError {
|
|
59
|
+
constructor(message, code) {
|
|
60
|
+
super(message, code, 400);
|
|
61
|
+
this.name = 'BadRequestError';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.BadRequestError = BadRequestError;
|
|
65
|
+
/**
|
|
66
|
+
* Conflict error (409)
|
|
67
|
+
*/
|
|
68
|
+
class ConflictError extends TuturuuuError {
|
|
69
|
+
constructor(message, code) {
|
|
70
|
+
super(message, code, 409);
|
|
71
|
+
this.name = 'ConflictError';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.ConflictError = ConflictError;
|
|
75
|
+
/**
|
|
76
|
+
* Rate limit error (429)
|
|
77
|
+
*/
|
|
78
|
+
class RateLimitError extends TuturuuuError {
|
|
79
|
+
/** Number of seconds to wait before retrying (from Retry-After header) */
|
|
80
|
+
retryAfter;
|
|
81
|
+
/** Unix timestamp when the rate limit resets (from X-RateLimit-Reset header) */
|
|
82
|
+
resetTime;
|
|
83
|
+
constructor(message, options) {
|
|
84
|
+
super(message, options?.code, 429);
|
|
85
|
+
this.name = 'RateLimitError';
|
|
86
|
+
this.retryAfter = options?.retryAfter;
|
|
87
|
+
this.resetTime = options?.resetTime;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.RateLimitError = RateLimitError;
|
|
91
|
+
/**
|
|
92
|
+
* Internal server error (500)
|
|
93
|
+
*/
|
|
94
|
+
class InternalServerError extends TuturuuuError {
|
|
95
|
+
constructor(message, code) {
|
|
96
|
+
super(message, code, 500);
|
|
97
|
+
this.name = 'InternalServerError';
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.InternalServerError = InternalServerError;
|
|
101
|
+
/**
|
|
102
|
+
* Network error
|
|
103
|
+
*/
|
|
104
|
+
class NetworkError extends TuturuuuError {
|
|
105
|
+
constructor(message) {
|
|
106
|
+
super(message, 'NETWORK_ERROR');
|
|
107
|
+
this.name = 'NetworkError';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.NetworkError = NetworkError;
|
|
111
|
+
/**
|
|
112
|
+
* Validation error
|
|
113
|
+
*/
|
|
114
|
+
class ValidationError extends TuturuuuError {
|
|
115
|
+
constructor(message) {
|
|
116
|
+
super(message, 'VALIDATION_ERROR', 400);
|
|
117
|
+
this.name = 'ValidationError';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.ValidationError = ValidationError;
|
|
121
|
+
/**
|
|
122
|
+
* Helper function to create appropriate error from API response
|
|
123
|
+
*/
|
|
124
|
+
function createErrorFromResponse(response, statusCode, rateLimitHeaders) {
|
|
125
|
+
const { message, code } = response;
|
|
126
|
+
switch (statusCode) {
|
|
127
|
+
case 400:
|
|
128
|
+
return new BadRequestError(message, code);
|
|
129
|
+
case 401:
|
|
130
|
+
return new AuthenticationError(message, code);
|
|
131
|
+
case 403:
|
|
132
|
+
return new AuthorizationError(message, code);
|
|
133
|
+
case 404:
|
|
134
|
+
return new NotFoundError(message, code);
|
|
135
|
+
case 409:
|
|
136
|
+
return new ConflictError(message, code);
|
|
137
|
+
case 429:
|
|
138
|
+
return new RateLimitError(message, {
|
|
139
|
+
code,
|
|
140
|
+
retryAfter: parseIntSafe(rateLimitHeaders?.retryAfter),
|
|
141
|
+
resetTime: parseIntSafe(rateLimitHeaders?.resetTime),
|
|
142
|
+
});
|
|
143
|
+
case 500:
|
|
144
|
+
case 502:
|
|
145
|
+
case 503:
|
|
146
|
+
case 504:
|
|
147
|
+
return new InternalServerError(message, code);
|
|
148
|
+
default:
|
|
149
|
+
return new TuturuuuError(message, code, statusCode);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Safely parse a string to integer, returning undefined for invalid values
|
|
154
|
+
*/
|
|
155
|
+
function parseIntSafe(value) {
|
|
156
|
+
if (!value)
|
|
157
|
+
return undefined;
|
|
158
|
+
const parsed = parseInt(value, 10);
|
|
159
|
+
return Number.isNaN(parsed) || parsed < 0 ? undefined : parsed;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Type guard to check if an object is an ApiErrorResponse
|
|
163
|
+
*/
|
|
164
|
+
function isApiErrorResponse(obj) {
|
|
165
|
+
return (typeof obj === 'object' &&
|
|
166
|
+
obj !== null &&
|
|
167
|
+
'error' in obj &&
|
|
168
|
+
'message' in obj &&
|
|
169
|
+
typeof obj.error === 'string' &&
|
|
170
|
+
typeof obj.message === 'string');
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAgJH,0DAgCC;AAcD,gDASC;AAnMD;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK;IACtB,IAAI,CAAU;IACd,UAAU,CAAU;IAEpC,YAAY,OAAe,EAAE,IAAa,EAAE,UAAmB;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,8DAA8D;QAE5D,KAMD,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;CACF;AApBD,sCAoBC;AAED;;GAEG;AACH,MAAa,mBAAoB,SAAQ,aAAa;IACpD,YAAY,OAAe,EAAE,IAAa;QACxC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,aAAa;IACnD,YAAY,OAAe,EAAE,IAAa;Q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C,gBAAgB,EAAE,SAAS,CAAC;aACrD,CAAC,CAAC;QACL,KAAK,GAAG,CAAC;QACT,KAAK,GAAG,CAAC;QACT,KAAK,GAAG,CAAC;QACT,KAAK,GAAG;YACN,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAChD;YACE,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;IACxD,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,KAAgC;IACpD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,GAAY;IAC7C,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,OAAO,IAAI,GAAG;QACd,SAAS,IAAI,GAAG;QAChB,OAAQ,GAAW,CAAC,KAAK,KAAK,QAAQ;QACtC,OAAQ,GAAW,CAAC,OAAO,KAAK,QAAQ,CACzC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tuturuuu SDK
|
|
3
|
+
*
|
|
4
|
+
* Official TypeScript/JavaScript SDK for interacting with the Tuturuuu platform.
|
|
5
|
+
* Provides access to storage (files/folders) and documents via API keys.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { AuthenticationError, AuthorizationError, BadRequestError, ConflictError, createErrorFromResponse, InternalServerError, isApiErrorResponse, NetworkError, NotFoundError, RateLimitError, TuturuuuError, ValidationError, } from './errors';
|
|
10
|
+
export type { RetryConfig, TuturuuuClientConfig } from './storage';
|
|
11
|
+
/**
|
|
12
|
+
* Default Tuturuuu client instance with auto-configured credentials
|
|
13
|
+
*
|
|
14
|
+
* Automatically loads from environment variables:
|
|
15
|
+
* - TUTURUUU_API_KEY (required)
|
|
16
|
+
* - TUTURUUU_BASE_URL (optional, defaults to https://tuturuuu.com/api/v1)
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { tuturuuu } from 'tuturuuu';
|
|
21
|
+
*
|
|
22
|
+
* const analytics = await tuturuuu.storage.getAnalytics();
|
|
23
|
+
* const files = await tuturuuu.storage.list({ path: 'documents' });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export { DocumentsClient, StorageClient, TuturuuuClient, tuturuuu, } from './storage';
|
|
27
|
+
export type { AnalyticsResponse, ApiErrorResponse, BatchShareResponse, CreateDocumentData, CreateFolderResponse, CreateSignedUploadUrlOptions, DeleteDocumentResponse, DeleteResponse, Document, DocumentResponse, DownloadOptions, GetDocumentResponse, ImageResizeMode, ImageTransformOptions, ListDocumentsOptions, ListDocumentsResponse, ListStorageOptions, ListStorageResponse, Pagination, ShareOptions, ShareResponse, SignedUploadUrlResponse, SignedUrlData, StorageAnalytics, StorageObject, UpdateDocumentData, UploadOptions, UploadResponse, } from './types';
|
|
28
|
+
export { createDocumentDataSchema, createSignedUploadUrlOptionsSchema, downloadOptionsSchema, imageTransformOptionsSchema, listDocumentsOptionsSchema, listStorageOptionsSchema, shareOptionsSchema, updateDocumentDataSchema, uploadOptionsSchema, } from './types';
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,aAAa,EACb,eAAe,GAChB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,EACd,QAAQ,GACT,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,EACtB,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAClC,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tuturuuu SDK
|
|
4
|
+
*
|
|
5
|
+
* Official TypeScript/JavaScript SDK for interacting with the Tuturuuu platform.
|
|
6
|
+
* Provides access to storage (files/folders) and documents via API keys.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.uploadOptionsSchema = exports.updateDocumentDataSchema = exports.shareOptionsSchema = exports.listStorageOptionsSchema = exports.listDocumentsOptionsSchema = exports.imageTransformOptionsSchema = exports.downloadOptionsSchema = exports.createSignedUploadUrlOptionsSchema = exports.createDocumentDataSchema = exports.tuturuuu = exports.TuturuuuClient = exports.StorageClient = exports.DocumentsClient = exports.ValidationError = exports.TuturuuuError = exports.RateLimitError = exports.NotFoundError = exports.NetworkError = exports.isApiErrorResponse = exports.InternalServerError = exports.createErrorFromResponse = exports.ConflictError = exports.BadRequestError = exports.AuthorizationError = exports.AuthenticationError = void 0;
|
|
12
|
+
// Errors
|
|
13
|
+
var errors_1 = require("./errors");
|
|
14
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_1.AuthenticationError; } });
|
|
15
|
+
Object.defineProperty(exports, "AuthorizationError", { enumerable: true, get: function () { return errors_1.AuthorizationError; } });
|
|
16
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return errors_1.BadRequestError; } });
|
|
17
|
+
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return errors_1.ConflictError; } });
|
|
18
|
+
Object.defineProperty(exports, "createErrorFromResponse", { enumerable: true, get: function () { return errors_1.createErrorFromResponse; } });
|
|
19
|
+
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return errors_1.InternalServerError; } });
|
|
20
|
+
Object.defineProperty(exports, "isApiErrorResponse", { enumerable: true, get: function () { return errors_1.isApiErrorResponse; } });
|
|
21
|
+
Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return errors_1.NetworkError; } });
|
|
22
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return errors_1.NotFoundError; } });
|
|
23
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return errors_1.RateLimitError; } });
|
|
24
|
+
Object.defineProperty(exports, "TuturuuuError", { enumerable: true, get: function () { return errors_1.TuturuuuError; } });
|
|
25
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_1.ValidationError; } });
|
|
26
|
+
// Main client
|
|
27
|
+
/**
|
|
28
|
+
* Default Tuturuuu client instance with auto-configured credentials
|
|
29
|
+
*
|
|
30
|
+
* Automatically loads from environment variables:
|
|
31
|
+
* - TUTURUUU_API_KEY (required)
|
|
32
|
+
* - TUTURUUU_BASE_URL (optional, defaults to https://tuturuuu.com/api/v1)
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { tuturuuu } from 'tuturuuu';
|
|
37
|
+
*
|
|
38
|
+
* const analytics = await tuturuuu.storage.getAnalytics();
|
|
39
|
+
* const files = await tuturuuu.storage.list({ path: 'documents' });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
var storage_1 = require("./storage");
|
|
43
|
+
Object.defineProperty(exports, "DocumentsClient", { enumerable: true, get: function () { return storage_1.DocumentsClient; } });
|
|
44
|
+
Object.defineProperty(exports, "StorageClient", { enumerable: true, get: function () { return storage_1.StorageClient; } });
|
|
45
|
+
Object.defineProperty(exports, "TuturuuuClient", { enumerable: true, get: function () { return storage_1.TuturuuuClient; } });
|
|
46
|
+
Object.defineProperty(exports, "tuturuuu", { enumerable: true, get: function () { return storage_1.tuturuuu; } });
|
|
47
|
+
// Zod schemas (for external validation if needed)
|
|
48
|
+
var types_1 = require("./types");
|
|
49
|
+
Object.defineProperty(exports, "createDocumentDataSchema", { enumerable: true, get: function () { return types_1.createDocumentDataSchema; } });
|
|
50
|
+
Object.defineProperty(exports, "createSignedUploadUrlOptionsSchema", { enumerable: true, get: function () { return types_1.createSignedUploadUrlOptionsSchema; } });
|
|
51
|
+
Object.defineProperty(exports, "downloadOptionsSchema", { enumerable: true, get: function () { return types_1.downloadOptionsSchema; } });
|
|
52
|
+
Object.defineProperty(exports, "imageTransformOptionsSchema", { enumerable: true, get: function () { return types_1.imageTransformOptionsSchema; } });
|
|
53
|
+
Object.defineProperty(exports, "listDocumentsOptionsSchema", { enumerable: true, get: function () { return types_1.listDocumentsOptionsSchema; } });
|
|
54
|
+
Object.defineProperty(exports, "listStorageOptionsSchema", { enumerable: true, get: function () { return types_1.listStorageOptionsSchema; } });
|
|
55
|
+
Object.defineProperty(exports, "shareOptionsSchema", { enumerable: true, get: function () { return types_1.shareOptionsSchema; } });
|
|
56
|
+
Object.defineProperty(exports, "updateDocumentDataSchema", { enumerable: true, get: function () { return types_1.updateDocumentDataSchema; } });
|
|
57
|
+
Object.defineProperty(exports, "uploadOptionsSchema", { enumerable: true, get: function () { return types_1.uploadOptionsSchema; } });
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,SAAS;AACT,mCAakB;AAZhB,6GAAA,mBAAmB,OAAA;AACnB,4GAAA,kBAAkB,OAAA;AAClB,yGAAA,eAAe,OAAA;AACf,uGAAA,aAAa,OAAA;AACb,iHAAA,uBAAuB,OAAA;AACvB,6GAAA,mBAAmB,OAAA;AACnB,4GAAA,kBAAkB,OAAA;AAClB,sGAAA,YAAY,OAAA;AACZ,uGAAA,aAAa,OAAA;AACb,wGAAA,cAAc,OAAA;AACd,uGAAA,aAAa,OAAA;AACb,yGAAA,eAAe,OAAA;AAGjB,cAAc;AACd;;;;;;;;;;;;;;GAcG;AACH,qCAKmB;AAJjB,0GAAA,eAAe,OAAA;AACf,wGAAA,aAAa,OAAA;AACb,yGAAA,cAAc,OAAA;AACd,mGAAA,QAAQ,OAAA;AAiCV,kDAAkD;AAClD,iCAUiB;AATf,iHAAA,wBAAwB,OAAA;AACxB,2HAAA,kCAAkC,OAAA;AAClC,8GAAA,qBAAqB,OAAA;AACrB,oHAAA,2BAA2B,OAAA;AAC3B,mHAAA,0BAA0B,OAAA;AAC1B,iHAAA,wBAAwB,OAAA;AACxB,2GAAA,kBAAkB,OAAA;AAClB,iHAAA,wBAAwB,OAAA;AACxB,4GAAA,mBAAmB,OAAA"}
|