stor-sdk 0.1.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 +21 -0
- package/README.md +200 -0
- package/dist/index.cjs +350 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +267 -0
- package/dist/index.d.ts +267 -0
- package/dist/index.js +305 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Stor.CO.ID
|
|
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
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# stor-sdk
|
|
2
|
+
|
|
3
|
+
Official Node.js SDK for the [Skuy Files](https://stor.co.id) API.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install stor-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { StorSDK } from 'stor-sdk';
|
|
15
|
+
|
|
16
|
+
const stor = new StorSDK({ apiKey: 'sk_your_api_key' });
|
|
17
|
+
|
|
18
|
+
// List files
|
|
19
|
+
const { items, total } = await stor.files.list({ page: 1, limit: 20 });
|
|
20
|
+
console.log(`${total} files found`);
|
|
21
|
+
|
|
22
|
+
// Upload a file
|
|
23
|
+
const uploaded = await stor.files.upload(file, {
|
|
24
|
+
onProgress: (p) => console.log(`${p.percent}%`),
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Configuration
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
const stor = new StorSDK({
|
|
32
|
+
apiKey: 'sk_...', // Required — your API key
|
|
33
|
+
baseUrl: 'https://...', // Optional — defaults to https://api-files.stor.co.id
|
|
34
|
+
timeout: 30000, // Optional — request timeout in ms (default: 30s)
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## API
|
|
39
|
+
|
|
40
|
+
### Files
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// List files (paginated)
|
|
44
|
+
const { items, total, page, limit } = await stor.files.list({
|
|
45
|
+
page: 1,
|
|
46
|
+
limit: 20,
|
|
47
|
+
q: 'search term',
|
|
48
|
+
folderId: 'folder-id',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Get file detail
|
|
52
|
+
const file = await stor.files.get('file-id');
|
|
53
|
+
|
|
54
|
+
// Upload file
|
|
55
|
+
const result = await stor.files.upload(file, {
|
|
56
|
+
folderId: 'optional-folder-id',
|
|
57
|
+
customName: 'my-file.pdf',
|
|
58
|
+
onProgress: ({ loaded, total, percent }) => {
|
|
59
|
+
console.log(`${percent}% uploaded`);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Get signed download URL
|
|
64
|
+
const { url, expiresAt } = await stor.files.getDownloadUrl('file-id', {
|
|
65
|
+
expiresIn: 24, // hours
|
|
66
|
+
maxDownloads: 10,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Rename file
|
|
70
|
+
const updated = await stor.files.update('file-id', { name: 'new-name.pdf' });
|
|
71
|
+
|
|
72
|
+
// Delete file
|
|
73
|
+
await stor.files.delete('file-id');
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Folders
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
// List folders
|
|
80
|
+
const folders = await stor.folders.list({ parentId: 'parent-id' });
|
|
81
|
+
|
|
82
|
+
// Create folder
|
|
83
|
+
const folder = await stor.folders.create({ name: 'My Folder', parentId: null });
|
|
84
|
+
|
|
85
|
+
// Rename folder
|
|
86
|
+
const renamed = await stor.folders.update('folder-id', { name: 'New Name' });
|
|
87
|
+
|
|
88
|
+
// Delete folder (and all contents)
|
|
89
|
+
const { filesDeleted, foldersDeleted } = await stor.folders.delete('folder-id');
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Repos (Git Hosting)
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
// List repos
|
|
96
|
+
const { items } = await stor.repos.list({ page: 1, q: 'my-repo' });
|
|
97
|
+
|
|
98
|
+
// Create repo
|
|
99
|
+
const repo = await stor.repos.create({
|
|
100
|
+
name: 'my-repo',
|
|
101
|
+
description: 'My repository',
|
|
102
|
+
isPublic: false,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Get repo detail
|
|
106
|
+
const detail = await stor.repos.get('repo-id');
|
|
107
|
+
|
|
108
|
+
// Update repo
|
|
109
|
+
const updated = await stor.repos.update('repo-id', { description: 'Updated' });
|
|
110
|
+
|
|
111
|
+
// Delete repo
|
|
112
|
+
await stor.repos.delete('repo-id');
|
|
113
|
+
|
|
114
|
+
// Upload file to repo (auto-commits)
|
|
115
|
+
const upload = await stor.repos.uploadFile('repo-id', file, {
|
|
116
|
+
message: 'Add README',
|
|
117
|
+
onProgress: (p) => console.log(`${p.percent}%`),
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// List files in repo
|
|
121
|
+
const entries = await stor.repos.getTree('repo-id', { path: 'src/' });
|
|
122
|
+
|
|
123
|
+
// Download file from repo (returns ArrayBuffer)
|
|
124
|
+
const blob = await stor.repos.getBlob('repo-id', 'README.md');
|
|
125
|
+
|
|
126
|
+
// Get commit history
|
|
127
|
+
const commits = await stor.repos.getLog('repo-id', { page: 1, limit: 20 });
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### User
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
// Get profile
|
|
134
|
+
const profile = await stor.user.getProfile();
|
|
135
|
+
console.log(profile.email, profile.plan);
|
|
136
|
+
|
|
137
|
+
// Get usage stats
|
|
138
|
+
const usage = await stor.user.getUsage();
|
|
139
|
+
console.log(`${usage.storageUsed} / ${usage.maxStorage} bytes`);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Error Handling
|
|
143
|
+
|
|
144
|
+
All API errors throw typed error classes:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
import { StorSDK, AuthenticationError, NotFoundError, StorError } from 'stor-sdk';
|
|
148
|
+
|
|
149
|
+
try {
|
|
150
|
+
await stor.files.get('non-existent');
|
|
151
|
+
} catch (err) {
|
|
152
|
+
if (err instanceof NotFoundError) {
|
|
153
|
+
console.log('File not found');
|
|
154
|
+
} else if (err instanceof AuthenticationError) {
|
|
155
|
+
console.log('Bad API key');
|
|
156
|
+
} else if (err instanceof StorError) {
|
|
157
|
+
console.log(`API error ${err.status}: ${err.message}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
| HTTP Status | Error Class | Description |
|
|
163
|
+
|-------------|------------|-------------|
|
|
164
|
+
| 401 | `AuthenticationError` | Invalid or missing API key |
|
|
165
|
+
| 403 | `AuthorizationError` | Insufficient scope (`.requiredScope`) |
|
|
166
|
+
| 404 | `NotFoundError` | Resource not found |
|
|
167
|
+
| 409 | `ConflictError` | Duplicate name etc. |
|
|
168
|
+
| 413 | `QuotaExceededError` | Storage quota exceeded |
|
|
169
|
+
| 429 | `RateLimitError` | Rate/bandwidth limit (`.used`, `.limit`) |
|
|
170
|
+
| 5xx | `StorError` | Server error |
|
|
171
|
+
| Network | `NetworkError` | No response received |
|
|
172
|
+
|
|
173
|
+
All errors extend `StorError` with `status`, `body`, and `cause` properties.
|
|
174
|
+
|
|
175
|
+
## TypeScript
|
|
176
|
+
|
|
177
|
+
Full TypeScript support with exported types:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
import type {
|
|
181
|
+
StorFile,
|
|
182
|
+
StorFolder,
|
|
183
|
+
StorRepo,
|
|
184
|
+
PaginatedResponse,
|
|
185
|
+
UploadProgress,
|
|
186
|
+
UserProfile,
|
|
187
|
+
UsageStats,
|
|
188
|
+
TreeEntry,
|
|
189
|
+
Commit,
|
|
190
|
+
} from 'stor-sdk';
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Requirements
|
|
194
|
+
|
|
195
|
+
- Node.js >= 18
|
|
196
|
+
- API key from [stor.co.id/dashboard](https://stor.co.id/dashboard)
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
AuthenticationError: () => AuthenticationError,
|
|
34
|
+
AuthorizationError: () => AuthorizationError,
|
|
35
|
+
ConflictError: () => ConflictError,
|
|
36
|
+
NetworkError: () => NetworkError,
|
|
37
|
+
NotFoundError: () => NotFoundError,
|
|
38
|
+
QuotaExceededError: () => QuotaExceededError,
|
|
39
|
+
RateLimitError: () => RateLimitError,
|
|
40
|
+
StorError: () => StorError,
|
|
41
|
+
StorSDK: () => StorSDK
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
|
+
|
|
45
|
+
// src/http.ts
|
|
46
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
47
|
+
|
|
48
|
+
// src/errors.ts
|
|
49
|
+
var StorError = class extends Error {
|
|
50
|
+
constructor(message, status, body, cause) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.name = "StorError";
|
|
53
|
+
this.status = status;
|
|
54
|
+
this.body = body;
|
|
55
|
+
this.cause = cause;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var AuthenticationError = class extends StorError {
|
|
59
|
+
constructor(message = "Invalid or missing API key", body, cause) {
|
|
60
|
+
super(message, 401, body, cause);
|
|
61
|
+
this.name = "AuthenticationError";
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var AuthorizationError = class extends StorError {
|
|
65
|
+
constructor(message = "Insufficient permissions", body, cause) {
|
|
66
|
+
super(message, 403, body, cause);
|
|
67
|
+
this.name = "AuthorizationError";
|
|
68
|
+
if (body && typeof body === "object" && "requiredScope" in body) {
|
|
69
|
+
this.requiredScope = body.requiredScope;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var NotFoundError = class extends StorError {
|
|
74
|
+
constructor(message = "Resource not found", body, cause) {
|
|
75
|
+
super(message, 404, body, cause);
|
|
76
|
+
this.name = "NotFoundError";
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var ConflictError = class extends StorError {
|
|
80
|
+
constructor(message = "Resource conflict", body, cause) {
|
|
81
|
+
super(message, 409, body, cause);
|
|
82
|
+
this.name = "ConflictError";
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var QuotaExceededError = class extends StorError {
|
|
86
|
+
constructor(message = "Storage quota exceeded", body, cause) {
|
|
87
|
+
super(message, 413, body, cause);
|
|
88
|
+
this.name = "QuotaExceededError";
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var RateLimitError = class extends StorError {
|
|
92
|
+
constructor(message = "Rate limit exceeded", body, cause) {
|
|
93
|
+
super(message, 429, body, cause);
|
|
94
|
+
this.name = "RateLimitError";
|
|
95
|
+
if (body && typeof body === "object") {
|
|
96
|
+
const b = body;
|
|
97
|
+
if (typeof b.used === "number") this.used = b.used;
|
|
98
|
+
if (typeof b.limit === "number") this.limit = b.limit;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var NetworkError = class extends StorError {
|
|
103
|
+
constructor(message = "Network error", cause) {
|
|
104
|
+
super(message, 0, void 0, cause);
|
|
105
|
+
this.name = "NetworkError";
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// src/http.ts
|
|
110
|
+
var DEFAULT_BASE_URL = "https://api-files.stor.co.id";
|
|
111
|
+
var DEFAULT_TIMEOUT = 3e4;
|
|
112
|
+
function createHttpClient(config) {
|
|
113
|
+
const client = import_axios.default.create({
|
|
114
|
+
baseURL: config.baseUrl || DEFAULT_BASE_URL,
|
|
115
|
+
timeout: config.timeout || DEFAULT_TIMEOUT,
|
|
116
|
+
headers: {
|
|
117
|
+
Authorization: `Bearer ${config.apiKey}`
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
client.interceptors.response.use(
|
|
121
|
+
(response) => response,
|
|
122
|
+
(error) => {
|
|
123
|
+
if (!error.response) {
|
|
124
|
+
throw new NetworkError(
|
|
125
|
+
error.message || "Network error",
|
|
126
|
+
error
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
const { status, data } = error.response;
|
|
130
|
+
const message = data?.error || error.message || "Unknown error";
|
|
131
|
+
switch (status) {
|
|
132
|
+
case 401:
|
|
133
|
+
throw new AuthenticationError(message, data, error);
|
|
134
|
+
case 403:
|
|
135
|
+
throw new AuthorizationError(message, data, error);
|
|
136
|
+
case 404:
|
|
137
|
+
throw new NotFoundError(message, data, error);
|
|
138
|
+
case 409:
|
|
139
|
+
throw new ConflictError(message, data, error);
|
|
140
|
+
case 413:
|
|
141
|
+
throw new QuotaExceededError(message, data, error);
|
|
142
|
+
case 429:
|
|
143
|
+
throw new RateLimitError(message, data, error);
|
|
144
|
+
default:
|
|
145
|
+
throw new StorError(message, status, data, error);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
return client;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/resources/files.ts
|
|
153
|
+
var FilesResource = class {
|
|
154
|
+
constructor(http) {
|
|
155
|
+
this.http = http;
|
|
156
|
+
}
|
|
157
|
+
async list(params) {
|
|
158
|
+
const { data } = await this.http.get("/v1/files", { params });
|
|
159
|
+
return {
|
|
160
|
+
items: data.files,
|
|
161
|
+
total: data.total,
|
|
162
|
+
page: data.page,
|
|
163
|
+
limit: data.limit
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async get(fileId) {
|
|
167
|
+
const { data } = await this.http.get(`/v1/files/${fileId}`);
|
|
168
|
+
return data.file;
|
|
169
|
+
}
|
|
170
|
+
async upload(file, options) {
|
|
171
|
+
const formData = new FormData();
|
|
172
|
+
formData.append("file", file);
|
|
173
|
+
if (options?.folderId) formData.append("folderId", options.folderId);
|
|
174
|
+
if (options?.customName) formData.append("customName", options.customName);
|
|
175
|
+
const { data } = await this.http.post("/v1/files/upload", formData, {
|
|
176
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
177
|
+
onUploadProgress: options?.onProgress ? (event) => {
|
|
178
|
+
const total = event.total ?? 0;
|
|
179
|
+
const loaded = event.loaded ?? 0;
|
|
180
|
+
options.onProgress({
|
|
181
|
+
loaded,
|
|
182
|
+
total,
|
|
183
|
+
percent: total > 0 ? Math.round(loaded / total * 100) : 0
|
|
184
|
+
});
|
|
185
|
+
} : void 0
|
|
186
|
+
});
|
|
187
|
+
return data;
|
|
188
|
+
}
|
|
189
|
+
async getDownloadUrl(fileId, options) {
|
|
190
|
+
const { data } = await this.http.get(`/v1/files/${fileId}/download`, {
|
|
191
|
+
params: options
|
|
192
|
+
});
|
|
193
|
+
return data;
|
|
194
|
+
}
|
|
195
|
+
async update(fileId, params) {
|
|
196
|
+
const { data } = await this.http.patch(`/v1/files/${fileId}`, params);
|
|
197
|
+
return data.file;
|
|
198
|
+
}
|
|
199
|
+
async delete(fileId) {
|
|
200
|
+
const { data } = await this.http.delete(`/v1/files/${fileId}`);
|
|
201
|
+
return data;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// src/resources/folders.ts
|
|
206
|
+
var FoldersResource = class {
|
|
207
|
+
constructor(http) {
|
|
208
|
+
this.http = http;
|
|
209
|
+
}
|
|
210
|
+
async list(params) {
|
|
211
|
+
const { data } = await this.http.get("/v1/folders", { params });
|
|
212
|
+
return data.folders;
|
|
213
|
+
}
|
|
214
|
+
async create(params) {
|
|
215
|
+
const { data } = await this.http.post("/v1/folders", params);
|
|
216
|
+
return data.folder;
|
|
217
|
+
}
|
|
218
|
+
async update(folderId, params) {
|
|
219
|
+
const { data } = await this.http.patch(`/v1/folders/${folderId}`, params);
|
|
220
|
+
return data.folder;
|
|
221
|
+
}
|
|
222
|
+
async delete(folderId) {
|
|
223
|
+
const { data } = await this.http.delete(`/v1/folders/${folderId}`);
|
|
224
|
+
return data;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// src/resources/repos.ts
|
|
229
|
+
var ReposResource = class {
|
|
230
|
+
constructor(http) {
|
|
231
|
+
this.http = http;
|
|
232
|
+
}
|
|
233
|
+
async list(params) {
|
|
234
|
+
const { data } = await this.http.get("/v1/repos", { params });
|
|
235
|
+
return {
|
|
236
|
+
items: data.repos.map(normalizeRepo),
|
|
237
|
+
total: data.total,
|
|
238
|
+
page: data.page,
|
|
239
|
+
limit: params?.limit ?? 20
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
async create(params) {
|
|
243
|
+
const { data } = await this.http.post("/v1/repos", params);
|
|
244
|
+
return normalizeRepo(data.data);
|
|
245
|
+
}
|
|
246
|
+
async get(repoId) {
|
|
247
|
+
const { data } = await this.http.get(`/v1/repos/${repoId}`);
|
|
248
|
+
return normalizeRepo(data.data);
|
|
249
|
+
}
|
|
250
|
+
async update(repoId, params) {
|
|
251
|
+
const { data } = await this.http.patch(`/v1/repos/${repoId}`, params);
|
|
252
|
+
return normalizeRepo(data.data);
|
|
253
|
+
}
|
|
254
|
+
async delete(repoId) {
|
|
255
|
+
const { data } = await this.http.delete(`/v1/repos/${repoId}`);
|
|
256
|
+
return data;
|
|
257
|
+
}
|
|
258
|
+
async uploadFile(repoId, file, options) {
|
|
259
|
+
const formData = new FormData();
|
|
260
|
+
formData.append("file", file);
|
|
261
|
+
if (options?.message) formData.append("message", options.message);
|
|
262
|
+
const { data } = await this.http.post(`/v1/repos/${repoId}/upload`, formData, {
|
|
263
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
264
|
+
onUploadProgress: options?.onProgress ? (event) => {
|
|
265
|
+
const total = event.total ?? 0;
|
|
266
|
+
const loaded = event.loaded ?? 0;
|
|
267
|
+
options.onProgress({
|
|
268
|
+
loaded,
|
|
269
|
+
total,
|
|
270
|
+
percent: total > 0 ? Math.round(loaded / total * 100) : 0
|
|
271
|
+
});
|
|
272
|
+
} : void 0
|
|
273
|
+
});
|
|
274
|
+
return data.data;
|
|
275
|
+
}
|
|
276
|
+
async getTree(repoId, params) {
|
|
277
|
+
const { data } = await this.http.get(`/v1/repos/${repoId}/tree`, { params });
|
|
278
|
+
return data.entries;
|
|
279
|
+
}
|
|
280
|
+
async getBlob(repoId, path, params) {
|
|
281
|
+
const { data } = await this.http.get(`/v1/repos/${repoId}/blob/${path}`, {
|
|
282
|
+
params,
|
|
283
|
+
responseType: "arraybuffer"
|
|
284
|
+
});
|
|
285
|
+
return data;
|
|
286
|
+
}
|
|
287
|
+
async getLog(repoId, params) {
|
|
288
|
+
const { data } = await this.http.get(`/v1/repos/${repoId}/log`, { params });
|
|
289
|
+
return data.commits;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
function normalizeRepo(raw) {
|
|
293
|
+
return {
|
|
294
|
+
id: raw._id ?? raw.id,
|
|
295
|
+
userId: raw.userId,
|
|
296
|
+
name: raw.name,
|
|
297
|
+
description: raw.description ?? "",
|
|
298
|
+
isPublic: raw.isPublic ?? false,
|
|
299
|
+
sizeBytes: raw.sizeBytes ?? 0,
|
|
300
|
+
defaultBranch: raw.defaultBranch ?? "main",
|
|
301
|
+
folderId: raw.folderId ?? null,
|
|
302
|
+
clones: raw.clones ?? 0,
|
|
303
|
+
pushes: raw.pushes ?? 0,
|
|
304
|
+
lastPushAt: raw.lastPushAt,
|
|
305
|
+
createdAt: raw.createdAt,
|
|
306
|
+
updatedAt: raw.updatedAt
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/resources/user.ts
|
|
311
|
+
var UserResource = class {
|
|
312
|
+
constructor(http) {
|
|
313
|
+
this.http = http;
|
|
314
|
+
}
|
|
315
|
+
async getProfile() {
|
|
316
|
+
const { data } = await this.http.get("/v1/user");
|
|
317
|
+
return data.user;
|
|
318
|
+
}
|
|
319
|
+
async getUsage() {
|
|
320
|
+
const { data } = await this.http.get("/v1/user/usage");
|
|
321
|
+
return data;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
// src/client.ts
|
|
326
|
+
var StorSDK = class {
|
|
327
|
+
constructor(config) {
|
|
328
|
+
if (!config.apiKey) {
|
|
329
|
+
throw new Error("apiKey is required");
|
|
330
|
+
}
|
|
331
|
+
const http = createHttpClient(config);
|
|
332
|
+
this.files = new FilesResource(http);
|
|
333
|
+
this.folders = new FoldersResource(http);
|
|
334
|
+
this.repos = new ReposResource(http);
|
|
335
|
+
this.user = new UserResource(http);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
339
|
+
0 && (module.exports = {
|
|
340
|
+
AuthenticationError,
|
|
341
|
+
AuthorizationError,
|
|
342
|
+
ConflictError,
|
|
343
|
+
NetworkError,
|
|
344
|
+
NotFoundError,
|
|
345
|
+
QuotaExceededError,
|
|
346
|
+
RateLimitError,
|
|
347
|
+
StorError,
|
|
348
|
+
StorSDK
|
|
349
|
+
});
|
|
350
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/http.ts","../src/errors.ts","../src/resources/files.ts","../src/resources/folders.ts","../src/resources/repos.ts","../src/resources/user.ts","../src/client.ts"],"sourcesContent":["export { StorSDK } from './client.js';\r\n\r\nexport {\r\n StorError,\r\n AuthenticationError,\r\n AuthorizationError,\r\n NotFoundError,\r\n ConflictError,\r\n QuotaExceededError,\r\n RateLimitError,\r\n NetworkError,\r\n} from './errors.js';\r\n\r\nexport type {\r\n StorSDKConfig,\r\n PaginatedResponse,\r\n UploadProgress,\r\n ListParams,\r\n MessageResponse,\r\n StorFile,\r\n FileListParams,\r\n FileUploadOptions,\r\n FileUploadResult,\r\n FileDownloadOptions,\r\n FileDownloadResult,\r\n FileUpdateParams,\r\n StorFolder,\r\n FolderListParams,\r\n FolderCreateParams,\r\n FolderUpdateParams,\r\n FolderDeleteResult,\r\n StorRepo,\r\n RepoListParams,\r\n RepoCreateParams,\r\n RepoUpdateParams,\r\n RepoDeleteResult,\r\n RepoUploadOptions,\r\n RepoUploadResult,\r\n TreeEntry,\r\n TreeParams,\r\n BlobParams,\r\n Commit,\r\n LogParams,\r\n UserProfile,\r\n UsageStats,\r\n} from './types/index.js';\r\n","import axios, { type AxiosInstance, type AxiosError } from 'axios';\r\nimport type { StorSDKConfig } from './types/common.js';\r\nimport {\r\n StorError,\r\n AuthenticationError,\r\n AuthorizationError,\r\n NotFoundError,\r\n ConflictError,\r\n QuotaExceededError,\r\n RateLimitError,\r\n NetworkError,\r\n} from './errors.js';\r\n\r\nconst DEFAULT_BASE_URL = 'https://api-files.stor.co.id';\r\nconst DEFAULT_TIMEOUT = 30_000;\r\n\r\nexport function createHttpClient(config: StorSDKConfig): AxiosInstance {\r\n const client = axios.create({\r\n baseURL: config.baseUrl || DEFAULT_BASE_URL,\r\n timeout: config.timeout || DEFAULT_TIMEOUT,\r\n headers: {\r\n Authorization: `Bearer ${config.apiKey}`,\r\n },\r\n });\r\n\r\n client.interceptors.response.use(\r\n (response) => response,\r\n (error: AxiosError<{ error?: string }>) => {\r\n if (!error.response) {\r\n throw new NetworkError(\r\n error.message || 'Network error',\r\n error,\r\n );\r\n }\r\n\r\n const { status, data } = error.response;\r\n const message = data?.error || error.message || 'Unknown error';\r\n\r\n switch (status) {\r\n case 401:\r\n throw new AuthenticationError(message, data, error);\r\n case 403:\r\n throw new AuthorizationError(message, data, error);\r\n case 404:\r\n throw new NotFoundError(message, data, error);\r\n case 409:\r\n throw new ConflictError(message, data, error);\r\n case 413:\r\n throw new QuotaExceededError(message, data, error);\r\n case 429:\r\n throw new RateLimitError(message, data, error);\r\n default:\r\n throw new StorError(message, status, data, error);\r\n }\r\n },\r\n );\r\n\r\n return client;\r\n}\r\n","export class StorError extends Error {\r\n readonly status: number;\r\n readonly body: unknown;\r\n declare readonly cause?: Error;\r\n\r\n constructor(message: string, status: number, body?: unknown, cause?: Error) {\r\n super(message);\r\n this.name = 'StorError';\r\n this.status = status;\r\n this.body = body;\r\n this.cause = cause;\r\n }\r\n}\r\n\r\nexport class AuthenticationError extends StorError {\r\n constructor(message = 'Invalid or missing API key', body?: unknown, cause?: Error) {\r\n super(message, 401, body, cause);\r\n this.name = 'AuthenticationError';\r\n }\r\n}\r\n\r\nexport class AuthorizationError extends StorError {\r\n readonly requiredScope?: string;\r\n\r\n constructor(message = 'Insufficient permissions', body?: unknown, cause?: Error) {\r\n super(message, 403, body, cause);\r\n this.name = 'AuthorizationError';\r\n if (body && typeof body === 'object' && 'requiredScope' in body) {\r\n this.requiredScope = (body as { requiredScope: string }).requiredScope;\r\n }\r\n }\r\n}\r\n\r\nexport class NotFoundError extends StorError {\r\n constructor(message = 'Resource not found', body?: unknown, cause?: Error) {\r\n super(message, 404, body, cause);\r\n this.name = 'NotFoundError';\r\n }\r\n}\r\n\r\nexport class ConflictError extends StorError {\r\n constructor(message = 'Resource conflict', body?: unknown, cause?: Error) {\r\n super(message, 409, body, cause);\r\n this.name = 'ConflictError';\r\n }\r\n}\r\n\r\nexport class QuotaExceededError extends StorError {\r\n constructor(message = 'Storage quota exceeded', body?: unknown, cause?: Error) {\r\n super(message, 413, body, cause);\r\n this.name = 'QuotaExceededError';\r\n }\r\n}\r\n\r\nexport class RateLimitError extends StorError {\r\n readonly used?: number;\r\n readonly limit?: number;\r\n\r\n constructor(message = 'Rate limit exceeded', body?: unknown, cause?: Error) {\r\n super(message, 429, body, cause);\r\n this.name = 'RateLimitError';\r\n if (body && typeof body === 'object') {\r\n const b = body as Record<string, unknown>;\r\n if (typeof b.used === 'number') this.used = b.used;\r\n if (typeof b.limit === 'number') this.limit = b.limit;\r\n }\r\n }\r\n}\r\n\r\nexport class NetworkError extends StorError {\r\n constructor(message = 'Network error', cause?: Error) {\r\n super(message, 0, undefined, cause);\r\n this.name = 'NetworkError';\r\n }\r\n}\r\n","import type { AxiosInstance } from 'axios';\r\nimport type { PaginatedResponse } from '../types/common.js';\r\nimport type {\r\n StorFile,\r\n FileListParams,\r\n FileUploadOptions,\r\n FileUploadResult,\r\n FileDownloadOptions,\r\n FileDownloadResult,\r\n FileUpdateParams,\r\n} from '../types/files.js';\r\nimport type { MessageResponse } from '../types/common.js';\r\n\r\nexport class FilesResource {\r\n constructor(private readonly http: AxiosInstance) {}\r\n\r\n async list(params?: FileListParams): Promise<PaginatedResponse<StorFile>> {\r\n const { data } = await this.http.get('/v1/files', { params });\r\n return {\r\n items: data.files,\r\n total: data.total,\r\n page: data.page,\r\n limit: data.limit,\r\n };\r\n }\r\n\r\n async get(fileId: string): Promise<StorFile> {\r\n const { data } = await this.http.get(`/v1/files/${fileId}`);\r\n return data.file;\r\n }\r\n\r\n async upload(\r\n file: File | Blob | Buffer,\r\n options?: FileUploadOptions,\r\n ): Promise<FileUploadResult> {\r\n const formData = new FormData();\r\n formData.append('file', file as Blob);\r\n if (options?.folderId) formData.append('folderId', options.folderId);\r\n if (options?.customName) formData.append('customName', options.customName);\r\n\r\n const { data } = await this.http.post('/v1/files/upload', formData, {\r\n headers: { 'Content-Type': 'multipart/form-data' },\r\n onUploadProgress: options?.onProgress\r\n ? (event) => {\r\n const total = event.total ?? 0;\r\n const loaded = event.loaded ?? 0;\r\n options.onProgress!({\r\n loaded,\r\n total,\r\n percent: total > 0 ? Math.round((loaded / total) * 100) : 0,\r\n });\r\n }\r\n : undefined,\r\n });\r\n\r\n return data;\r\n }\r\n\r\n async getDownloadUrl(\r\n fileId: string,\r\n options?: FileDownloadOptions,\r\n ): Promise<FileDownloadResult> {\r\n const { data } = await this.http.get(`/v1/files/${fileId}/download`, {\r\n params: options,\r\n });\r\n return data;\r\n }\r\n\r\n async update(fileId: string, params: FileUpdateParams): Promise<StorFile> {\r\n const { data } = await this.http.patch(`/v1/files/${fileId}`, params);\r\n return data.file;\r\n }\r\n\r\n async delete(fileId: string): Promise<MessageResponse> {\r\n const { data } = await this.http.delete(`/v1/files/${fileId}`);\r\n return data;\r\n }\r\n}\r\n","import type { AxiosInstance } from 'axios';\r\nimport type {\r\n StorFolder,\r\n FolderListParams,\r\n FolderCreateParams,\r\n FolderUpdateParams,\r\n FolderDeleteResult,\r\n} from '../types/folders.js';\r\n\r\nexport class FoldersResource {\r\n constructor(private readonly http: AxiosInstance) {}\r\n\r\n async list(params?: FolderListParams): Promise<StorFolder[]> {\r\n const { data } = await this.http.get('/v1/folders', { params });\r\n return data.folders;\r\n }\r\n\r\n async create(params: FolderCreateParams): Promise<StorFolder> {\r\n const { data } = await this.http.post('/v1/folders', params);\r\n return data.folder;\r\n }\r\n\r\n async update(folderId: string, params: FolderUpdateParams): Promise<StorFolder> {\r\n const { data } = await this.http.patch(`/v1/folders/${folderId}`, params);\r\n return data.folder;\r\n }\r\n\r\n async delete(folderId: string): Promise<FolderDeleteResult> {\r\n const { data } = await this.http.delete(`/v1/folders/${folderId}`);\r\n return data;\r\n }\r\n}\r\n","import type { AxiosInstance } from 'axios';\r\nimport type { PaginatedResponse } from '../types/common.js';\r\nimport type {\r\n StorRepo,\r\n RepoListParams,\r\n RepoCreateParams,\r\n RepoUpdateParams,\r\n RepoDeleteResult,\r\n RepoUploadOptions,\r\n RepoUploadResult,\r\n TreeEntry,\r\n TreeParams,\r\n BlobParams,\r\n Commit,\r\n LogParams,\r\n} from '../types/repos.js';\r\n\r\nexport class ReposResource {\r\n constructor(private readonly http: AxiosInstance) {}\r\n\r\n async list(params?: RepoListParams): Promise<PaginatedResponse<StorRepo>> {\r\n const { data } = await this.http.get('/v1/repos', { params });\r\n return {\r\n items: data.repos.map(normalizeRepo),\r\n total: data.total,\r\n page: data.page,\r\n limit: params?.limit ?? 20,\r\n };\r\n }\r\n\r\n async create(params: RepoCreateParams): Promise<StorRepo> {\r\n const { data } = await this.http.post('/v1/repos', params);\r\n return normalizeRepo(data.data);\r\n }\r\n\r\n async get(repoId: string): Promise<StorRepo> {\r\n const { data } = await this.http.get(`/v1/repos/${repoId}`);\r\n return normalizeRepo(data.data);\r\n }\r\n\r\n async update(repoId: string, params: RepoUpdateParams): Promise<StorRepo> {\r\n const { data } = await this.http.patch(`/v1/repos/${repoId}`, params);\r\n return normalizeRepo(data.data);\r\n }\r\n\r\n async delete(repoId: string): Promise<RepoDeleteResult> {\r\n const { data } = await this.http.delete(`/v1/repos/${repoId}`);\r\n return data;\r\n }\r\n\r\n async uploadFile(\r\n repoId: string,\r\n file: File | Blob | Buffer,\r\n options?: RepoUploadOptions,\r\n ): Promise<RepoUploadResult> {\r\n const formData = new FormData();\r\n formData.append('file', file as Blob);\r\n if (options?.message) formData.append('message', options.message);\r\n\r\n const { data } = await this.http.post(`/v1/repos/${repoId}/upload`, formData, {\r\n headers: { 'Content-Type': 'multipart/form-data' },\r\n onUploadProgress: options?.onProgress\r\n ? (event) => {\r\n const total = event.total ?? 0;\r\n const loaded = event.loaded ?? 0;\r\n options.onProgress!({\r\n loaded,\r\n total,\r\n percent: total > 0 ? Math.round((loaded / total) * 100) : 0,\r\n });\r\n }\r\n : undefined,\r\n });\r\n\r\n return data.data;\r\n }\r\n\r\n async getTree(repoId: string, params?: TreeParams): Promise<TreeEntry[]> {\r\n const { data } = await this.http.get(`/v1/repos/${repoId}/tree`, { params });\r\n return data.entries;\r\n }\r\n\r\n async getBlob(\r\n repoId: string,\r\n path: string,\r\n params?: BlobParams,\r\n ): Promise<ArrayBuffer> {\r\n const { data } = await this.http.get(`/v1/repos/${repoId}/blob/${path}`, {\r\n params,\r\n responseType: 'arraybuffer',\r\n });\r\n return data;\r\n }\r\n\r\n async getLog(repoId: string, params?: LogParams): Promise<Commit[]> {\r\n const { data } = await this.http.get(`/v1/repos/${repoId}/log`, { params });\r\n return data.commits;\r\n }\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nfunction normalizeRepo(raw: any): StorRepo {\r\n return {\r\n id: raw._id ?? raw.id,\r\n userId: raw.userId,\r\n name: raw.name,\r\n description: raw.description ?? '',\r\n isPublic: raw.isPublic ?? false,\r\n sizeBytes: raw.sizeBytes ?? 0,\r\n defaultBranch: raw.defaultBranch ?? 'main',\r\n folderId: raw.folderId ?? null,\r\n clones: raw.clones ?? 0,\r\n pushes: raw.pushes ?? 0,\r\n lastPushAt: raw.lastPushAt,\r\n createdAt: raw.createdAt,\r\n updatedAt: raw.updatedAt,\r\n };\r\n}\r\n","import type { AxiosInstance } from 'axios';\r\nimport type { UserProfile, UsageStats } from '../types/user.js';\r\n\r\nexport class UserResource {\r\n constructor(private readonly http: AxiosInstance) {}\r\n\r\n async getProfile(): Promise<UserProfile> {\r\n const { data } = await this.http.get('/v1/user');\r\n return data.user;\r\n }\r\n\r\n async getUsage(): Promise<UsageStats> {\r\n const { data } = await this.http.get('/v1/user/usage');\r\n return data;\r\n }\r\n}\r\n","import type { StorSDKConfig } from './types/common.js';\r\nimport { createHttpClient } from './http.js';\r\nimport { FilesResource } from './resources/files.js';\r\nimport { FoldersResource } from './resources/folders.js';\r\nimport { ReposResource } from './resources/repos.js';\r\nimport { UserResource } from './resources/user.js';\r\n\r\nexport class StorSDK {\r\n readonly files: FilesResource;\r\n readonly folders: FoldersResource;\r\n readonly repos: ReposResource;\r\n readonly user: UserResource;\r\n\r\n constructor(config: StorSDKConfig) {\r\n if (!config.apiKey) {\r\n throw new Error('apiKey is required');\r\n }\r\n\r\n const http = createHttpClient(config);\r\n\r\n this.files = new FilesResource(http);\r\n this.folders = new FoldersResource(http);\r\n this.repos = new ReposResource(http);\r\n this.user = new UserResource(http);\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA2D;;;ACApD,IAAM,YAAN,cAAwB,MAAM;AAAA,EAKnC,YAAY,SAAiB,QAAgB,MAAgB,OAAe;AAC1E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,QAAQ;AAAA,EACf;AACF;AAEO,IAAM,sBAAN,cAAkC,UAAU;AAAA,EACjD,YAAY,UAAU,8BAA8B,MAAgB,OAAe;AACjF,UAAM,SAAS,KAAK,MAAM,KAAK;AAC/B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,qBAAN,cAAiC,UAAU;AAAA,EAGhD,YAAY,UAAU,4BAA4B,MAAgB,OAAe;AAC/E,UAAM,SAAS,KAAK,MAAM,KAAK;AAC/B,SAAK,OAAO;AACZ,QAAI,QAAQ,OAAO,SAAS,YAAY,mBAAmB,MAAM;AAC/D,WAAK,gBAAiB,KAAmC;AAAA,IAC3D;AAAA,EACF;AACF;AAEO,IAAM,gBAAN,cAA4B,UAAU;AAAA,EA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