tuturuuu 0.0.1 → 0.0.3
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 +21 -0
- package/README.md +87 -0
- package/dist/errors.d.ts +75 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +155 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/storage.d.ts +280 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +612 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.d.ts +251 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +70 -0
- package/dist/types.js.map +1 -0
- package/package.json +28 -9
- package/src/documents.test.ts +0 -523
- package/src/errors.test.ts +0 -278
- package/src/errors.ts +0 -161
- package/src/index.ts +0 -60
- package/src/storage.test.ts +0 -604
- package/src/storage.ts +0 -702
- package/src/types.test.ts +0 -562
- package/src/types.ts +0 -291
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tuturuuu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -236,6 +236,84 @@ See the [examples](./examples) directory for complete usage examples:
|
|
|
236
236
|
- [basic-usage.ts](./examples/basic-usage.ts) - Basic operations
|
|
237
237
|
- [error-handling.ts](./examples/error-handling.ts) - Error handling patterns
|
|
238
238
|
|
|
239
|
+
## Security Best Practices
|
|
240
|
+
|
|
241
|
+
### ⚠️ Never Expose API Keys Client-Side
|
|
242
|
+
|
|
243
|
+
API keys should **NEVER** be exposed to the browser. Always use server-side code:
|
|
244
|
+
|
|
245
|
+
#### ❌ **WRONG** - Client-Side Usage (Insecure)
|
|
246
|
+
```typescript
|
|
247
|
+
// BAD: API key exposed in browser
|
|
248
|
+
const client = new TuturuuuClient(process.env.NEXT_PUBLIC_API_KEY); // NEVER do this!
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### ✅ **CORRECT** - Server-Side Usage (Secure)
|
|
252
|
+
|
|
253
|
+
**Option 1: Next.js API Routes** (Recommended for web apps)
|
|
254
|
+
```typescript
|
|
255
|
+
// app/api/storage/list/route.ts (SERVER-SIDE)
|
|
256
|
+
import { TuturuuuClient } from 'tuturuuu';
|
|
257
|
+
import { NextResponse } from 'next/server';
|
|
258
|
+
|
|
259
|
+
const client = new TuturuuuClient(process.env.TUTURUUU_API_KEY);
|
|
260
|
+
|
|
261
|
+
export async function GET(request: Request) {
|
|
262
|
+
const files = await client.storage.list({ limit: 50 });
|
|
263
|
+
return NextResponse.json(files);
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Then call from your client:
|
|
268
|
+
```typescript
|
|
269
|
+
// Client component (SAFE)
|
|
270
|
+
const response = await fetch('/api/storage/list');
|
|
271
|
+
const files = await response.json();
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Option 2: Node.js Backend**
|
|
275
|
+
```typescript
|
|
276
|
+
// server.js
|
|
277
|
+
import { TuturuuuClient } from 'tuturuuu';
|
|
278
|
+
import express from 'express';
|
|
279
|
+
|
|
280
|
+
const client = new TuturuuuClient(process.env.TUTURUUU_API_KEY);
|
|
281
|
+
const app = express();
|
|
282
|
+
|
|
283
|
+
app.get('/api/files', async (req, res) => {
|
|
284
|
+
const files = await client.storage.list();
|
|
285
|
+
res.json(files);
|
|
286
|
+
});
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Option 3: Serverless Functions**
|
|
290
|
+
```typescript
|
|
291
|
+
// netlify/functions/storage.ts
|
|
292
|
+
import { TuturuuuClient } from 'tuturuuu';
|
|
293
|
+
|
|
294
|
+
export const handler = async () => {
|
|
295
|
+
const client = new TuturuuuClient(process.env.TUTURUUU_API_KEY);
|
|
296
|
+
const files = await client.storage.list();
|
|
297
|
+
|
|
298
|
+
return {
|
|
299
|
+
statusCode: 200,
|
|
300
|
+
body: JSON.stringify(files),
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Security Checklist
|
|
306
|
+
|
|
307
|
+
- ✅ Use server-side API routes or backend servers
|
|
308
|
+
- ✅ Store API keys in environment variables (`.env.local`, never `.env`)
|
|
309
|
+
- ✅ Add `.env.local` to `.gitignore`
|
|
310
|
+
- ✅ Use `process.env.VARIABLE` (not `process.env.NEXT_PUBLIC_VARIABLE`)
|
|
311
|
+
- ✅ Rotate API keys periodically
|
|
312
|
+
- ❌ Never commit API keys to version control
|
|
313
|
+
- ❌ Never use `NEXT_PUBLIC_` prefix for API keys
|
|
314
|
+
- ❌ Never hardcode API keys in source code
|
|
315
|
+
- ❌ Never expose API keys in client-side JavaScript
|
|
316
|
+
|
|
239
317
|
## API Key Management
|
|
240
318
|
|
|
241
319
|
To use this SDK, you need a Tuturuuu API key:
|
|
@@ -259,6 +337,15 @@ API keys inherit permissions from their assigned **Workspace Role**:
|
|
|
259
337
|
|
|
260
338
|
To modify what an API key can do, update its assigned role's permissions in Settings → Roles.
|
|
261
339
|
|
|
340
|
+
## Example Project
|
|
341
|
+
|
|
342
|
+
See the complete example in [`apps/external`](../../apps/external) which demonstrates:
|
|
343
|
+
- ✅ Secure server-side API routes
|
|
344
|
+
- ✅ File upload functionality
|
|
345
|
+
- ✅ Storage analytics dashboard
|
|
346
|
+
- ✅ Proper environment variable handling
|
|
347
|
+
- ✅ Error handling and loading states
|
|
348
|
+
|
|
262
349
|
## License
|
|
263
350
|
|
|
264
351
|
MIT
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
constructor(message: string, code?: string);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Internal server error (500)
|
|
51
|
+
*/
|
|
52
|
+
export declare class InternalServerError extends TuturuuuError {
|
|
53
|
+
constructor(message: string, code?: string);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Network error
|
|
57
|
+
*/
|
|
58
|
+
export declare class NetworkError extends TuturuuuError {
|
|
59
|
+
constructor(message: string);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Validation error
|
|
63
|
+
*/
|
|
64
|
+
export declare class ValidationError extends TuturuuuError {
|
|
65
|
+
constructor(message: string);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Helper function to create appropriate error from API response
|
|
69
|
+
*/
|
|
70
|
+
export declare function createErrorFromResponse(response: ApiErrorResponse, statusCode: number): TuturuuuError;
|
|
71
|
+
/**
|
|
72
|
+
* Type guard to check if an object is an ApiErrorResponse
|
|
73
|
+
*/
|
|
74
|
+
export declare function isApiErrorResponse(obj: unknown): obj is ApiErrorResponse;
|
|
75
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors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H,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,MAAM,GACjB,aAAa,CAwBf;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,gBAAgB,CASxE"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
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
|
+
if (Error.captureStackTrace) {
|
|
22
|
+
Error.captureStackTrace(this, this.constructor);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.TuturuuuError = TuturuuuError;
|
|
27
|
+
/**
|
|
28
|
+
* Authentication error (401)
|
|
29
|
+
*/
|
|
30
|
+
class AuthenticationError extends TuturuuuError {
|
|
31
|
+
constructor(message, code) {
|
|
32
|
+
super(message, code, 401);
|
|
33
|
+
this.name = 'AuthenticationError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.AuthenticationError = AuthenticationError;
|
|
37
|
+
/**
|
|
38
|
+
* Authorization error (403)
|
|
39
|
+
*/
|
|
40
|
+
class AuthorizationError extends TuturuuuError {
|
|
41
|
+
constructor(message, code) {
|
|
42
|
+
super(message, code, 403);
|
|
43
|
+
this.name = 'AuthorizationError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.AuthorizationError = AuthorizationError;
|
|
47
|
+
/**
|
|
48
|
+
* Not found error (404)
|
|
49
|
+
*/
|
|
50
|
+
class NotFoundError extends TuturuuuError {
|
|
51
|
+
constructor(message, code) {
|
|
52
|
+
super(message, code, 404);
|
|
53
|
+
this.name = 'NotFoundError';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.NotFoundError = NotFoundError;
|
|
57
|
+
/**
|
|
58
|
+
* Bad request error (400)
|
|
59
|
+
*/
|
|
60
|
+
class BadRequestError extends TuturuuuError {
|
|
61
|
+
constructor(message, code) {
|
|
62
|
+
super(message, code, 400);
|
|
63
|
+
this.name = 'BadRequestError';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.BadRequestError = BadRequestError;
|
|
67
|
+
/**
|
|
68
|
+
* Conflict error (409)
|
|
69
|
+
*/
|
|
70
|
+
class ConflictError extends TuturuuuError {
|
|
71
|
+
constructor(message, code) {
|
|
72
|
+
super(message, code, 409);
|
|
73
|
+
this.name = 'ConflictError';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.ConflictError = ConflictError;
|
|
77
|
+
/**
|
|
78
|
+
* Rate limit error (429)
|
|
79
|
+
*/
|
|
80
|
+
class RateLimitError extends TuturuuuError {
|
|
81
|
+
constructor(message, code) {
|
|
82
|
+
super(message, code, 429);
|
|
83
|
+
this.name = 'RateLimitError';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.RateLimitError = RateLimitError;
|
|
87
|
+
/**
|
|
88
|
+
* Internal server error (500)
|
|
89
|
+
*/
|
|
90
|
+
class InternalServerError extends TuturuuuError {
|
|
91
|
+
constructor(message, code) {
|
|
92
|
+
super(message, code, 500);
|
|
93
|
+
this.name = 'InternalServerError';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.InternalServerError = InternalServerError;
|
|
97
|
+
/**
|
|
98
|
+
* Network error
|
|
99
|
+
*/
|
|
100
|
+
class NetworkError extends TuturuuuError {
|
|
101
|
+
constructor(message) {
|
|
102
|
+
super(message, 'NETWORK_ERROR');
|
|
103
|
+
this.name = 'NetworkError';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.NetworkError = NetworkError;
|
|
107
|
+
/**
|
|
108
|
+
* Validation error
|
|
109
|
+
*/
|
|
110
|
+
class ValidationError extends TuturuuuError {
|
|
111
|
+
constructor(message) {
|
|
112
|
+
super(message, 'VALIDATION_ERROR', 400);
|
|
113
|
+
this.name = 'ValidationError';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.ValidationError = ValidationError;
|
|
117
|
+
/**
|
|
118
|
+
* Helper function to create appropriate error from API response
|
|
119
|
+
*/
|
|
120
|
+
function createErrorFromResponse(response, statusCode) {
|
|
121
|
+
const { message, code } = response;
|
|
122
|
+
switch (statusCode) {
|
|
123
|
+
case 400:
|
|
124
|
+
return new BadRequestError(message, code);
|
|
125
|
+
case 401:
|
|
126
|
+
return new AuthenticationError(message, code);
|
|
127
|
+
case 403:
|
|
128
|
+
return new AuthorizationError(message, code);
|
|
129
|
+
case 404:
|
|
130
|
+
return new NotFoundError(message, code);
|
|
131
|
+
case 409:
|
|
132
|
+
return new ConflictError(message, code);
|
|
133
|
+
case 429:
|
|
134
|
+
return new RateLimitError(message, code);
|
|
135
|
+
case 500:
|
|
136
|
+
case 502:
|
|
137
|
+
case 503:
|
|
138
|
+
case 504:
|
|
139
|
+
return new InternalServerError(message, code);
|
|
140
|
+
default:
|
|
141
|
+
return new TuturuuuError(message, code, statusCode);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Type guard to check if an object is an ApiErrorResponse
|
|
146
|
+
*/
|
|
147
|
+
function isApiErrorResponse(obj) {
|
|
148
|
+
return (typeof obj === 'object' &&
|
|
149
|
+
obj !== null &&
|
|
150
|
+
'error' in obj &&
|
|
151
|
+
'message' in obj &&
|
|
152
|
+
typeof obj.error === 'string' &&
|
|
153
|
+
typeof obj.message === 'string');
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAqHH,0DA2BC;AAKD,gDASC;AA1JD;;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;QAC9D,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AAfD,sCAeC;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;QACxC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC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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,14 @@
|
|
|
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 { TuturuuuClientConfig } from './storage';
|
|
11
|
+
export { DocumentsClient, StorageClient, TuturuuuClient } from './storage';
|
|
12
|
+
export type { AnalyticsResponse, ApiErrorResponse, CreateDocumentData, CreateFolderResponse, DeleteDocumentResponse, DeleteResponse, Document, DocumentResponse, GetDocumentResponse, ListDocumentsOptions, ListDocumentsResponse, ListStorageOptions, ListStorageResponse, Pagination, ShareOptions, ShareResponse, StorageAnalytics, StorageObject, UpdateDocumentData, UploadOptions, UploadResponse, } from './types';
|
|
13
|
+
export { createDocumentDataSchema, listDocumentsOptionsSchema, listStorageOptionsSchema, shareOptionsSchema, updateDocumentDataSchema, uploadOptionsSchema, } from './types';
|
|
14
|
+
//# 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,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3E,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
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.createDocumentDataSchema = 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
|
+
var storage_1 = require("./storage");
|
|
28
|
+
Object.defineProperty(exports, "DocumentsClient", { enumerable: true, get: function () { return storage_1.DocumentsClient; } });
|
|
29
|
+
Object.defineProperty(exports, "StorageClient", { enumerable: true, get: function () { return storage_1.StorageClient; } });
|
|
30
|
+
Object.defineProperty(exports, "TuturuuuClient", { enumerable: true, get: function () { return storage_1.TuturuuuClient; } });
|
|
31
|
+
// Zod schemas (for external validation if needed)
|
|
32
|
+
var types_1 = require("./types");
|
|
33
|
+
Object.defineProperty(exports, "createDocumentDataSchema", { enumerable: true, get: function () { return types_1.createDocumentDataSchema; } });
|
|
34
|
+
Object.defineProperty(exports, "listDocumentsOptionsSchema", { enumerable: true, get: function () { return types_1.listDocumentsOptionsSchema; } });
|
|
35
|
+
Object.defineProperty(exports, "listStorageOptionsSchema", { enumerable: true, get: function () { return types_1.listStorageOptionsSchema; } });
|
|
36
|
+
Object.defineProperty(exports, "shareOptionsSchema", { enumerable: true, get: function () { return types_1.shareOptionsSchema; } });
|
|
37
|
+
Object.defineProperty(exports, "updateDocumentDataSchema", { enumerable: true, get: function () { return types_1.updateDocumentDataSchema; } });
|
|
38
|
+
Object.defineProperty(exports, "uploadOptionsSchema", { enumerable: true, get: function () { return types_1.uploadOptionsSchema; } });
|
|
39
|
+
//# 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,qCAA2E;AAAlE,0GAAA,eAAe,OAAA;AAAE,wGAAA,aAAa,OAAA;AAAE,yGAAA,cAAc,OAAA;AAyBvD,kDAAkD;AAClD,iCAOiB;AANf,iHAAA,wBAAwB,OAAA;AACxB,mHAAA,0BAA0B,OAAA;AAC1B,iHAAA,wBAAwB,OAAA;AACxB,2GAAA,kBAAkB,OAAA;AAClB,iHAAA,wBAAwB,OAAA;AACxB,4GAAA,mBAAmB,OAAA"}
|