@teepin/sdk 0.2.1 → 0.3.0-rc.1
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/README.md +41 -36
- package/dist/cjs/client.js +42 -4
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/direct/bytes.js +50 -0
- package/dist/cjs/direct/bytes.js.map +1 -0
- package/dist/cjs/direct/common.js +167 -0
- package/dist/cjs/direct/common.js.map +1 -0
- package/dist/cjs/direct/downloads-plan.js +127 -0
- package/dist/cjs/direct/downloads-plan.js.map +1 -0
- package/dist/cjs/direct/engine.js +405 -0
- package/dist/cjs/direct/engine.js.map +1 -0
- package/dist/cjs/direct/formats.js +44 -0
- package/dist/cjs/direct/formats.js.map +1 -0
- package/dist/cjs/direct/hpke.js +275 -0
- package/dist/cjs/direct/hpke.js.map +1 -0
- package/dist/cjs/direct/journal.js +80 -0
- package/dist/cjs/direct/journal.js.map +1 -0
- package/dist/cjs/direct/large.js +850 -0
- package/dist/cjs/direct/large.js.map +1 -0
- package/dist/cjs/direct/reads.js +1314 -0
- package/dist/cjs/direct/reads.js.map +1 -0
- package/dist/cjs/direct/sha256.js +122 -0
- package/dist/cjs/direct/sha256.js.map +1 -0
- package/dist/cjs/direct/tws1.js +480 -0
- package/dist/cjs/direct/tws1.js.map +1 -0
- package/dist/cjs/direct/uploads.js +1706 -0
- package/dist/cjs/direct/uploads.js.map +1 -0
- package/dist/cjs/errors.js +70 -13
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/links.js +195 -0
- package/dist/cjs/links.js.map +1 -0
- package/dist/cjs/node/downloads.js +835 -0
- package/dist/cjs/node/downloads.js.map +1 -0
- package/dist/cjs/node/journal.js +841 -0
- package/dist/cjs/node/journal.js.map +1 -0
- package/dist/cjs/node/uploads.js +219 -0
- package/dist/cjs/node/uploads.js.map +1 -0
- package/dist/cjs/node.js +26 -39
- package/dist/cjs/node.js.map +1 -1
- package/dist/cjs/storage.js +214 -184
- package/dist/cjs/storage.js.map +1 -1
- package/dist/cjs/transfer.js +18 -351
- package/dist/cjs/transfer.js.map +1 -1
- package/dist/esm/client.js +42 -4
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/direct/bytes.js +42 -0
- package/dist/esm/direct/bytes.js.map +1 -0
- package/dist/esm/direct/common.js +155 -0
- package/dist/esm/direct/common.js.map +1 -0
- package/dist/esm/direct/downloads-plan.js +117 -0
- package/dist/esm/direct/downloads-plan.js.map +1 -0
- package/dist/esm/direct/engine.js +385 -0
- package/dist/esm/direct/engine.js.map +1 -0
- package/dist/esm/direct/formats.js +40 -0
- package/dist/esm/direct/formats.js.map +1 -0
- package/dist/esm/direct/hpke.js +262 -0
- package/dist/esm/direct/hpke.js.map +1 -0
- package/dist/esm/direct/journal.js +75 -0
- package/dist/esm/direct/journal.js.map +1 -0
- package/dist/esm/direct/large.js +816 -0
- package/dist/esm/direct/large.js.map +1 -0
- package/dist/esm/direct/reads.js +1275 -0
- package/dist/esm/direct/reads.js.map +1 -0
- package/dist/esm/direct/sha256.js +118 -0
- package/dist/esm/direct/sha256.js.map +1 -0
- package/dist/esm/direct/tws1.js +460 -0
- package/dist/esm/direct/tws1.js.map +1 -0
- package/dist/esm/direct/uploads.js +1660 -0
- package/dist/esm/direct/uploads.js.map +1 -0
- package/dist/esm/errors.js +64 -11
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/links.js +189 -0
- package/dist/esm/links.js.map +1 -0
- package/dist/esm/node/downloads.js +829 -0
- package/dist/esm/node/downloads.js.map +1 -0
- package/dist/esm/node/journal.js +824 -0
- package/dist/esm/node/journal.js.map +1 -0
- package/dist/esm/node/uploads.js +187 -0
- package/dist/esm/node/uploads.js.map +1 -0
- package/dist/esm/node.js +17 -14
- package/dist/esm/node.js.map +1 -1
- package/dist/esm/storage.js +214 -184
- package/dist/esm/storage.js.map +1 -1
- package/dist/esm/transfer.js +19 -349
- package/dist/esm/transfer.js.map +1 -1
- package/dist/types/client.d.ts +45 -4
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/direct/bytes.d.ts +11 -0
- package/dist/types/direct/bytes.d.ts.map +1 -0
- package/dist/types/direct/common.d.ts +47 -0
- package/dist/types/direct/common.d.ts.map +1 -0
- package/dist/types/direct/downloads-plan.d.ts +75 -0
- package/dist/types/direct/downloads-plan.d.ts.map +1 -0
- package/dist/types/direct/engine.d.ts +191 -0
- package/dist/types/direct/engine.d.ts.map +1 -0
- package/dist/types/direct/formats.d.ts +9 -0
- package/dist/types/direct/formats.d.ts.map +1 -0
- package/dist/types/direct/hpke.d.ts +55 -0
- package/dist/types/direct/hpke.d.ts.map +1 -0
- package/dist/types/direct/journal.d.ts +55 -0
- package/dist/types/direct/journal.d.ts.map +1 -0
- package/dist/types/direct/large.d.ts +170 -0
- package/dist/types/direct/large.d.ts.map +1 -0
- package/dist/types/direct/reads.d.ts +306 -0
- package/dist/types/direct/reads.d.ts.map +1 -0
- package/dist/types/direct/sha256.d.ts +16 -0
- package/dist/types/direct/sha256.d.ts.map +1 -0
- package/dist/types/direct/tws1.d.ts +157 -0
- package/dist/types/direct/tws1.d.ts.map +1 -0
- package/dist/types/direct/uploads.d.ts +461 -0
- package/dist/types/direct/uploads.d.ts.map +1 -0
- package/dist/types/errors.d.ts +47 -8
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/links.d.ts +86 -0
- package/dist/types/links.d.ts.map +1 -0
- package/dist/types/node/downloads.d.ts +73 -0
- package/dist/types/node/downloads.d.ts.map +1 -0
- package/dist/types/node/journal.d.ts +162 -0
- package/dist/types/node/journal.d.ts.map +1 -0
- package/dist/types/node/uploads.d.ts +86 -0
- package/dist/types/node/uploads.d.ts.map +1 -0
- package/dist/types/node.d.ts +4 -2
- package/dist/types/node.d.ts.map +1 -1
- package/dist/types/storage.d.ts +107 -64
- package/dist/types/storage.d.ts.map +1 -1
- package/dist/types/transfer.d.ts +14 -23
- package/dist/types/transfer.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/types/storage.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { TeepinClient } from './client.js';
|
|
2
|
+
import { ObjectFile } from './direct/reads.js';
|
|
3
|
+
import { DirectUploads } from './direct/uploads.js';
|
|
2
4
|
import { type DownloadOptions, type DownloadSink, type UploadBody, type UploadOptions } from './transfer.js';
|
|
5
|
+
export { ObjectFile } from './direct/reads.js';
|
|
3
6
|
/** A bucket of the project. */
|
|
4
7
|
export interface Bucket {
|
|
5
8
|
id: string;
|
|
@@ -61,6 +64,10 @@ export interface PutObjectOptions {
|
|
|
61
64
|
ifMatch?: string;
|
|
62
65
|
/** Write only if no object is at the key. */
|
|
63
66
|
ifNoneMatch?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Stops the call. An object a pack has already taken may still be saved: its pack is shared with other putObject
|
|
69
|
+
* calls, and goes on.
|
|
70
|
+
*/
|
|
64
71
|
signal?: AbortSignal;
|
|
65
72
|
}
|
|
66
73
|
/** An inclusive byte range; end undefined means to the end. */
|
|
@@ -68,6 +75,15 @@ export interface ByteRange {
|
|
|
68
75
|
start: number;
|
|
69
76
|
end?: number;
|
|
70
77
|
}
|
|
78
|
+
export interface DeleteObjectOptions {
|
|
79
|
+
/**
|
|
80
|
+
* Delete only if the object still has this ETag (quoted or not; "*" for any object), checked in the same step as the
|
|
81
|
+
* delete: otherwise PreconditionFailedError (412) and nothing is deleted. A move passes the ETag it checked, so a
|
|
82
|
+
* write that lands in between survives.
|
|
83
|
+
*/
|
|
84
|
+
ifMatch?: string;
|
|
85
|
+
signal?: AbortSignal;
|
|
86
|
+
}
|
|
71
87
|
export interface GetObjectOptions {
|
|
72
88
|
range?: ByteRange;
|
|
73
89
|
/** Resolve to null when the object still has this ETag (304). */
|
|
@@ -92,6 +108,12 @@ export interface ObjectResponse extends ObjectInfo {
|
|
|
92
108
|
bytes(): Promise<Uint8Array>;
|
|
93
109
|
text(): Promise<string>;
|
|
94
110
|
}
|
|
111
|
+
export interface OpenObjectOptions {
|
|
112
|
+
/** Windows fetched ahead of a reader reading straight on (default 2); up to prefetch + 2 windows are held in memory. */
|
|
113
|
+
prefetch?: number;
|
|
114
|
+
/** Aborting it stops every read of the object, as close() does. */
|
|
115
|
+
signal?: AbortSignal;
|
|
116
|
+
}
|
|
95
117
|
/** One key deleteObjects could not delete. */
|
|
96
118
|
export interface DeleteError {
|
|
97
119
|
key: string;
|
|
@@ -103,16 +125,21 @@ export interface DeleteResult {
|
|
|
103
125
|
deleted: string[];
|
|
104
126
|
errors: DeleteError[];
|
|
105
127
|
}
|
|
106
|
-
/**
|
|
107
|
-
|
|
128
|
+
/**
|
|
129
|
+
* A share link (section 26): a console page anyone holding url can open, to preview or save the object, until
|
|
130
|
+
* expiresAt. Its sealed token is url's fragment (<console>/l#<token>), never sent to the console's host.
|
|
131
|
+
*/
|
|
132
|
+
export interface ShareLink {
|
|
108
133
|
url: string;
|
|
134
|
+
/** The second it stops opening. */
|
|
109
135
|
expiresAt: Date;
|
|
110
136
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
137
|
+
export interface CreateLinkOptions {
|
|
138
|
+
/** Seconds the link opens for: 1 to 86,400 (24 hours); default 900 (15 minutes). */
|
|
139
|
+
expiresIn?: number;
|
|
140
|
+
/** "inline" (the default): the page previews the object where it safely can; "attachment": it saves the file. */
|
|
141
|
+
disposition?: 'inline' | 'attachment';
|
|
142
|
+
signal?: AbortSignal;
|
|
116
143
|
}
|
|
117
144
|
/** An upload in parts that has not been completed. */
|
|
118
145
|
export interface Upload {
|
|
@@ -123,37 +150,44 @@ export interface Upload {
|
|
|
123
150
|
createdAt: Date;
|
|
124
151
|
/** When it is cancelled if not completed (7 days). */
|
|
125
152
|
expiresAt: Date;
|
|
126
|
-
/** Filled by listParts. */
|
|
127
|
-
parts: Part[];
|
|
128
153
|
}
|
|
129
|
-
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
/** The MD5 of the part, in hex; completeUpload needs it. */
|
|
134
|
-
etag: string;
|
|
135
|
-
uploadedAt?: Date;
|
|
136
|
-
}
|
|
137
|
-
/** The rules of uploads in parts. */
|
|
154
|
+
/**
|
|
155
|
+
* Earlier releases' rules for uploads in parts, which partSize and computeETag use to match the ETag of an object
|
|
156
|
+
* uploaded in parts before the direct path. Uploads now follow the direct path's own rules (at most 3,000 parts).
|
|
157
|
+
*/
|
|
138
158
|
export declare const MIN_PART_SIZE: number;
|
|
139
159
|
export declare const MAX_PART_SIZE: number;
|
|
140
160
|
export declare const MAX_PARTS = 10000;
|
|
161
|
+
/** The largest object Teepin Storage holds (5 TiB). */
|
|
141
162
|
export declare const MAX_OBJECT_SIZE: number;
|
|
142
163
|
export declare function parseObject(raw: unknown): StorageObject;
|
|
143
|
-
export declare function quote(etag: string): string;
|
|
144
164
|
export declare function unquote(etag: string): string;
|
|
145
165
|
/**
|
|
146
|
-
* Teepin Storage
|
|
147
|
-
*
|
|
148
|
-
* way to move data of any size.
|
|
166
|
+
* Teepin Storage: buckets, objects and transfers. upload and download are the
|
|
167
|
+
* high-level way to move data of any size.
|
|
149
168
|
*
|
|
150
169
|
* Every method sends your API key, so call them from a backend you control.
|
|
151
|
-
*
|
|
152
|
-
*
|
|
170
|
+
*
|
|
171
|
+
* Reads come straight from the storage network, each byte verified on this
|
|
172
|
+
* device before it is used (TEEPIN-STORAGE-DESIGN.md section 22.5). Writes are
|
|
173
|
+
* encrypted on this device and sent straight to the storage network too
|
|
174
|
+
* (section 22.4): small objects in packs, large ones in parts. No file byte
|
|
175
|
+
* passes through Teepin's API.
|
|
153
176
|
*/
|
|
154
177
|
export declare class StorageService {
|
|
155
178
|
readonly client: TeepinClient;
|
|
179
|
+
private directReads?;
|
|
180
|
+
private uploadEngine?;
|
|
156
181
|
constructor(client: TeepinClient);
|
|
182
|
+
/** Reads through read sessions, made on first use. */
|
|
183
|
+
private get reads();
|
|
184
|
+
/**
|
|
185
|
+
* The direct upload engine, made on first use: putObject's shared packs and the node entry's upload runs. Internal:
|
|
186
|
+
* @teepin/sdk/node gives it the disk.
|
|
187
|
+
*/
|
|
188
|
+
get directUploads(): DirectUploads;
|
|
189
|
+
/** Zeroes the data keys kept for reads (TeepinClient.close calls it). */
|
|
190
|
+
close(): void;
|
|
157
191
|
private call;
|
|
158
192
|
/** Whether the account's stored data is on hold. */
|
|
159
193
|
getHold(signal?: AbortSignal): Promise<StorageHold>;
|
|
@@ -176,18 +210,28 @@ export declare class StorageService {
|
|
|
176
210
|
*/
|
|
177
211
|
objects(bucket: string, prefix?: string, signal?: AbortSignal): AsyncGenerator<StorageObject>;
|
|
178
212
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
213
|
+
* Stores an object, encrypted on this device: in a pack shared with the other putObject calls waiting at the same
|
|
214
|
+
* time (up to 16 MiB), or in parts straight to the storage network above that; an empty one is written by the API
|
|
215
|
+
* alone, with no bytes. The call returns once its object is committed. upload also takes streams.
|
|
181
216
|
*/
|
|
182
217
|
putObject(bucket: string, key: string, body: Blob | ArrayBuffer | ArrayBufferView | string, opts?: PutObjectOptions): Promise<StorageObject>;
|
|
183
218
|
/** An object's details without its bytes. */
|
|
184
219
|
statObject(bucket: string, key: string, signal?: AbortSignal): Promise<StorageObject>;
|
|
185
|
-
/** An object's download headers without its bytes. */
|
|
220
|
+
/** An object's download headers without its bytes, built from statObject. */
|
|
186
221
|
headObject(bucket: string, key: string, signal?: AbortSignal): Promise<ObjectInfo>;
|
|
187
|
-
/**
|
|
222
|
+
/**
|
|
223
|
+
* Streams an object's bytes, or one range. Resolves to null when ifNoneMatch matched.
|
|
224
|
+
*
|
|
225
|
+
* The bytes come from the storage network, each verified before the body yields it (a whole read's SHA-256 as its
|
|
226
|
+
* last bytes arrive: ChecksumMismatchError), and ifNoneMatch asks the object's details first, so a match signs and
|
|
227
|
+
* bills nothing. Read the body to its end or cancel it: that frees the read and zeroes its copy of the data key.
|
|
228
|
+
*/
|
|
188
229
|
getObject(bucket: string, key: string, opts?: GetObjectOptions): Promise<ObjectResponse | null>;
|
|
189
|
-
/**
|
|
190
|
-
|
|
230
|
+
/**
|
|
231
|
+
* Deletes an object; with ifMatch, only if it still has that ETag (PreconditionFailedError otherwise). An AbortSignal
|
|
232
|
+
* in place of the options is taken as before.
|
|
233
|
+
*/
|
|
234
|
+
deleteObject(bucket: string, key: string, opts?: DeleteObjectOptions | AbortSignal): Promise<void>;
|
|
191
235
|
/**
|
|
192
236
|
* Deletes many objects, 1000 to a request; each key succeeds or fails on
|
|
193
237
|
* its own. A key already gone is in errors with code object_not_found.
|
|
@@ -201,61 +245,60 @@ export declare class StorageService {
|
|
|
201
245
|
/**
|
|
202
246
|
* Copies srcBucket/srcKey (any bucket of the project) to bucket/key. The
|
|
203
247
|
* bytes are read and written again, so a copy is billed as a download as
|
|
204
|
-
* well as the stored copy.
|
|
248
|
+
* well as the stored copy. The conditions are on the destination.
|
|
249
|
+
*
|
|
250
|
+
* The copy is made on this device (section 23.6): the object is read (every
|
|
251
|
+
* byte verified) and uploaded anew, packed or in parts, streamed under the
|
|
252
|
+
* upload's memory bound. It keeps the source's content type and metadata.
|
|
205
253
|
*/
|
|
206
254
|
copyObject(bucket: string, key: string, srcBucket: string, srcKey: string, opts?: {
|
|
207
255
|
ifMatch?: string;
|
|
208
256
|
ifNoneMatch?: boolean;
|
|
209
257
|
signal?: AbortSignal;
|
|
210
258
|
}): Promise<StorageObject>;
|
|
211
|
-
/**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
presignUpload(bucket: string, key: string, opts?: {
|
|
219
|
-
expiresIn?: number;
|
|
220
|
-
maxBytes?: number;
|
|
221
|
-
contentType?: string;
|
|
222
|
-
signal?: AbortSignal;
|
|
223
|
-
}): Promise<SignedUpload>;
|
|
224
|
-
/** Starts an upload in parts. upload does all of it for you. */
|
|
225
|
-
createUpload(bucket: string, key: string, opts?: {
|
|
226
|
-
contentType?: string;
|
|
227
|
-
metadata?: Record<string, string>;
|
|
228
|
-
signal?: AbortSignal;
|
|
229
|
-
}): Promise<Upload>;
|
|
230
|
-
/** Sends part number (1 to 10000) of an upload; sending a number again replaces it. */
|
|
231
|
-
uploadPart(bucket: string, uploadId: string, number: number, data: Uint8Array | Blob, signal?: AbortSignal): Promise<Part>;
|
|
232
|
-
/** An upload and the parts received so far, in order. */
|
|
233
|
-
listParts(bucket: string, uploadId: string, signal?: AbortSignal): Promise<Upload>;
|
|
259
|
+
/**
|
|
260
|
+
* Makes a share link to an object that exists now: a console page anyone holding it can open with no sign-in, to
|
|
261
|
+
* preview or save the object, until it expires. It opens whatever is at the key when it is opened, and stops opening
|
|
262
|
+
* when the object is deleted or the account's stored data is on hold. The link carries its own credential, so share
|
|
263
|
+
* it only with those who may read the object. openLink opens one in code.
|
|
264
|
+
*/
|
|
265
|
+
createLink(bucket: string, key: string, opts?: CreateLinkOptions): Promise<ShareLink>;
|
|
234
266
|
/** A bucket's open uploads under prefix, oldest first. */
|
|
235
267
|
listUploads(bucket: string, prefix?: string, signal?: AbortSignal): Promise<Upload[]>;
|
|
236
|
-
/** Assembles the parts named, in ascending order, into the object. */
|
|
237
|
-
completeUpload(bucket: string, uploadId: string, parts: {
|
|
238
|
-
number: number;
|
|
239
|
-
etag: string;
|
|
240
|
-
}[], signal?: AbortSignal): Promise<StorageObject>;
|
|
241
268
|
/** Cancels an upload and drops its parts. */
|
|
242
269
|
abortUpload(bucket: string, uploadId: string, signal?: AbortSignal): Promise<void>;
|
|
243
270
|
/**
|
|
244
|
-
* Stores data at bucket/key:
|
|
245
|
-
*
|
|
246
|
-
*
|
|
271
|
+
* Stores data at bucket/key, encrypted on this device: packed (shared with putObject's calls) up to 16 MiB, in
|
|
272
|
+
* parallel parts straight to the storage network above that, and a stream of unknown size read a part ahead and sent
|
|
273
|
+
* as it is read (its parts held in memory: at most (concurrency + 3) of them). Each part is retried on its own.
|
|
247
274
|
*
|
|
248
275
|
* ```ts
|
|
249
276
|
* await teepin.storage.upload('my-bucket', 'videos/a.mp4', file, { onProgress: (done, total) => {} });
|
|
250
277
|
* ```
|
|
251
278
|
*/
|
|
252
279
|
upload(bucket: string, key: string, body: UploadBody, opts?: UploadOptions): Promise<StorageObject>;
|
|
253
|
-
/**
|
|
280
|
+
/**
|
|
281
|
+
* Downloads an object into memory, as parallel ranges: the storage network's read windows, every byte verified before
|
|
282
|
+
* it is written, and the whole object checked against its SHA-256 (a mismatch is tried once more before
|
|
283
|
+
* ChecksumMismatchError).
|
|
284
|
+
*/
|
|
254
285
|
download(bucket: string, key: string, opts?: DownloadOptions): Promise<{
|
|
255
286
|
object: StorageObject;
|
|
256
287
|
data: Uint8Array;
|
|
257
288
|
}>;
|
|
258
|
-
/**
|
|
289
|
+
/**
|
|
290
|
+
* Downloads an object into sink (a file, in @teepin/sdk/node), as parallel ranges pinned to one version. Every byte is
|
|
291
|
+
* verified before it is written (the whole object's SHA-256 too, when it is read in one range).
|
|
292
|
+
*/
|
|
259
293
|
downloadTo(bucket: string, key: string, sink: DownloadSink, opts?: DownloadOptions): Promise<StorageObject>;
|
|
294
|
+
/**
|
|
295
|
+
* Opens an object for reading at any offset: read(offset, length), size, info and close(). Reading straight on
|
|
296
|
+
* fetches a window at a time (64 MiB on the storage network) with the next prefetch windows ahead, so up to
|
|
297
|
+
* prefetch + 2 windows are held in memory; a read somewhere else fetches only what it needs. Every byte is verified
|
|
298
|
+
* before it is read, and every window comes from the version first opened: ObjectChangedError if the object is
|
|
299
|
+
* replaced while it is read. Close it when done: that zeroes its copy of the data key.
|
|
300
|
+
*/
|
|
301
|
+
openObject(bucket: string, key: string, opts?: OpenObjectOptions): Promise<ObjectFile>;
|
|
302
|
+
private downloadParams;
|
|
260
303
|
}
|
|
261
304
|
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAW,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAEvB,+BAA+B;AAC/B,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,uBAAuB;AACvB,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,8FAA8F;IAC9F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB;AAED,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,WAAW,CAAC,EAAE,IAAI,CAAC;C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M,SAAK,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAKvF,6CAA6C;IACvC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxF;;;;;;;;OAQG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;IAuD7G;;;;OAIG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,aAAa,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC;IAmB7H;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,aAAa,CAAC;IAI/G;;;;;;OAMG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,iBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC;IAOhG,OAAO,CAAC,cAAc;CASvB"}
|
package/dist/types/transfer.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** The part size of uploads in parts and of parallel download ranges. */
|
|
1
|
+
/** The part size of uploads in parts, unless asked for. */
|
|
3
2
|
export declare const DEFAULT_PART_SIZE: number;
|
|
4
3
|
/** upload sends larger data in parts. */
|
|
5
4
|
export declare const MULTIPART_THRESHOLD: number;
|
|
@@ -17,22 +16,21 @@ export type UploadBody = string | ArrayBuffer | ArrayBufferView | Blob | UploadS
|
|
|
17
16
|
export interface UploadOptions {
|
|
18
17
|
contentType?: string;
|
|
19
18
|
metadata?: Record<string, string>;
|
|
20
|
-
/** Bytes per part (default 16 MiB, at least 5 MiB). */
|
|
19
|
+
/** Bytes per part (default 16 MiB, or 64 MiB for a stream with no expectedSize; at least 5 MiB). */
|
|
21
20
|
partSize?: number;
|
|
22
|
-
/**
|
|
21
|
+
/** A stream's parts sent at once (default 4); other uploads follow the client's uploadConcurrency. */
|
|
23
22
|
concurrency?: number;
|
|
24
23
|
/** Bytes sent so far and the total (-1 for a stream); advances as parts finish. */
|
|
25
24
|
onProgress?: (done: number, total: number) => void;
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* left open (for 7 days) to be resumed, instead of cancelled.
|
|
26
|
+
* A stream's expected size in bytes, a hint: it chooses the part size, so a stream larger than 3,000 of the default
|
|
27
|
+
* 64 MiB parts can be sent.
|
|
30
28
|
*/
|
|
31
|
-
|
|
29
|
+
expectedSize?: number;
|
|
32
30
|
signal?: AbortSignal;
|
|
33
31
|
}
|
|
34
32
|
export interface DownloadOptions {
|
|
35
|
-
/** Bytes per range fetched at once (
|
|
33
|
+
/** Bytes per range fetched at once. Ranges are the storage network's read windows (64 MiB), which a smaller partSize splits. */
|
|
36
34
|
partSize?: number;
|
|
37
35
|
/** Ranges fetched at once (default 8). */
|
|
38
36
|
concurrency?: number;
|
|
@@ -46,27 +44,20 @@ export interface DownloadSink {
|
|
|
46
44
|
write(offset: number, data: Uint8Array): void | Promise<void>;
|
|
47
45
|
}
|
|
48
46
|
/**
|
|
49
|
-
* The part size
|
|
50
|
-
*
|
|
47
|
+
* The part size earlier releases' uploads in parts used for size bytes when want was asked for: at least
|
|
48
|
+
* MIN_PART_SIZE, doubled until the parts fit in MAX_PARTS. With computeETag it matches the ETag of an object uploaded
|
|
49
|
+
* in parts before the direct path (one ending in "-<parts>"); objects uploaded now have their SHA-256 as their ETag.
|
|
51
50
|
*/
|
|
52
51
|
export declare function partSize(size: number, want?: number): number;
|
|
53
52
|
/** The SHA-256 of data, in hex. */
|
|
54
53
|
export declare function sha256Hex(data: Uint8Array): Promise<string>;
|
|
55
54
|
/**
|
|
56
|
-
* The ETag Teepin gives source:
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
55
|
+
* The ETag Teepin gives source: its SHA-256 when parts is 0, which is every object uploaded now however it was sent.
|
|
56
|
+
* An object uploaded in parts by an earlier release has the SHA-256 of its parts' SHA-256s with "-<parts>": pass the
|
|
57
|
+
* part size it used (partSize) and its part count. Compare with StorageObject.etag to tell whether local data and an
|
|
58
|
+
* object hold the same bytes.
|
|
60
59
|
*/
|
|
61
60
|
export declare function computeETag(source: UploadSource, partBytes: number, parts: number): Promise<string>;
|
|
62
61
|
/** An UploadSource over bytes or a Blob. */
|
|
63
62
|
export declare function sourceOf(body: Exclude<UploadBody, ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>>): UploadSource;
|
|
64
|
-
export declare function upload(s: StorageService, bucket: string, key: string, body: UploadBody, opts?: UploadOptions): Promise<StorageObject>;
|
|
65
|
-
/** Downloads into memory and checks objects stored in one request against their SHA-256. For large files use downloadTo. */
|
|
66
|
-
export declare function download(s: StorageService, bucket: string, key: string, opts?: DownloadOptions): Promise<{
|
|
67
|
-
object: StorageObject;
|
|
68
|
-
data: Uint8Array;
|
|
69
|
-
}>;
|
|
70
|
-
/** Downloads into sink, as parallel ranges pinned to one version of the object. Does not check the checksum; @teepin/sdk/node's downloadFile does. */
|
|
71
|
-
export declare function downloadTo(s: StorageService, bucket: string, key: string, sink: DownloadSink, opts?: DownloadOptions): Promise<StorageObject>;
|
|
72
63
|
//# sourceMappingURL=transfer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../src/transfer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../src/transfer.ts"],"names":[],"mappings":"AAUA,2DAA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AC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,MAAM,CAIvD;AAID,mCAAmC;AACnC,wBAAsB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAEjE;AAYD;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAUzG;AAED,4CAA4C;AAC5C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC,GAAG,YAAY,CAYxH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teepin/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-rc.1",
|
|
4
4
|
"description": "Official TypeScript/JavaScript SDK for Teepin Web Services: Teepin Inference (AI models in confidential enclaves, OpenAI-compatible) and Teepin Storage, for Node 20+ and browsers",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/package-types.mjs",
|
|
12
12
|
"prepare": "npm run build",
|
|
13
|
-
"test": "npm run build && node --test test/storage.test.mjs test/inference.test.mjs test/config.test.mjs",
|
|
13
|
+
"test": "npm run build && node --test test/storage.test.mjs test/inference.test.mjs test/config.test.mjs test/formats.test.mjs test/fake-direct.test.mjs test/engine.test.mjs test/journal.test.mjs test/sha256.test.mjs test/reads.test.mjs test/downloads.test.mjs test/uploads.test.mjs test/uploads-large.test.mjs test/upload-journal.test.mjs test/links.test.mjs",
|
|
14
14
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.examples.json"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|