@secrecy/lib 1.53.0 → 1.55.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.
|
@@ -111,18 +111,16 @@ export class SecrecyCloudClient {
|
|
|
111
111
|
current: encryptedData.byteLength,
|
|
112
112
|
percent: 1,
|
|
113
113
|
});
|
|
114
|
-
|
|
114
|
+
const localData = {
|
|
115
115
|
id: uploadData.id,
|
|
116
116
|
storageType: 'lite',
|
|
117
117
|
size: uploadDataArgs.size,
|
|
118
118
|
sizeEncrypted: uploadDataArgs.sizeEncrypted ?? null,
|
|
119
119
|
data: dataBuffer,
|
|
120
120
|
...filetype,
|
|
121
|
-
});
|
|
122
|
-
return {
|
|
123
|
-
object: 'lite',
|
|
124
|
-
id: uploadData.id,
|
|
125
121
|
};
|
|
122
|
+
dataContentCache.set(uploadData.id, localData);
|
|
123
|
+
return localData;
|
|
126
124
|
}
|
|
127
125
|
if (storageType === 's3' || storageType === 'cold') {
|
|
128
126
|
const uploadDataArgs = encryptedDataKey && md5Encrypted
|
|
@@ -157,18 +155,16 @@ export class SecrecyCloudClient {
|
|
|
157
155
|
current: encryptedData.byteLength,
|
|
158
156
|
percent: 1,
|
|
159
157
|
});
|
|
160
|
-
|
|
158
|
+
const localData = {
|
|
161
159
|
id: uploadData.id,
|
|
162
160
|
storageType: storageType,
|
|
163
161
|
size: uploadDataArgs.size,
|
|
164
162
|
sizeEncrypted: uploadDataArgs.sizeEncrypted ?? null,
|
|
165
163
|
data: dataBuffer,
|
|
166
164
|
...filetype,
|
|
167
|
-
});
|
|
168
|
-
return {
|
|
169
|
-
object: storageType,
|
|
170
|
-
id: uploadData.id,
|
|
171
165
|
};
|
|
166
|
+
dataContentCache.set(uploadData.id, localData);
|
|
167
|
+
return localData;
|
|
172
168
|
}
|
|
173
169
|
const uploadDataPartEnd = async (md5, order) => {
|
|
174
170
|
return this.#apiClient.cloud.uploadDataPartEnd.mutate({
|
|
@@ -206,6 +202,7 @@ export class SecrecyCloudClient {
|
|
|
206
202
|
}
|
|
207
203
|
formData.append('file', new Blob([chunk.data]), `${uploadData.id}-${chunk.order}`);
|
|
208
204
|
await axios.post(part.url, formData, {
|
|
205
|
+
headers: filetype ? { 'content-type': filetype.mime } : undefined,
|
|
209
206
|
onUploadProgress: (progressEvent) => {
|
|
210
207
|
onProgress(part.order, progressEvent);
|
|
211
208
|
},
|
|
@@ -216,18 +213,16 @@ export class SecrecyCloudClient {
|
|
|
216
213
|
await promiseAllLimit(3, uploadData.parts.map((p) => async () => {
|
|
217
214
|
await byPart(p);
|
|
218
215
|
}));
|
|
219
|
-
|
|
216
|
+
const localData = {
|
|
220
217
|
id: uploadData.id,
|
|
221
218
|
storageType: storageType,
|
|
222
219
|
size: uploadDataArgs.size,
|
|
223
220
|
sizeEncrypted: uploadDataArgs.sizeEncrypted ?? null,
|
|
224
221
|
data: dataBuffer,
|
|
225
222
|
...filetype,
|
|
226
|
-
});
|
|
227
|
-
return {
|
|
228
|
-
object: storageType,
|
|
229
|
-
id: uploadData.id,
|
|
230
223
|
};
|
|
224
|
+
dataContentCache.set(uploadData.id, localData);
|
|
225
|
+
return localData;
|
|
231
226
|
}
|
|
232
227
|
throw new Error(`The "${storageType}" is not implemented yet!`);
|
|
233
228
|
}
|
|
@@ -18,10 +18,7 @@ export declare class SecrecyCloudClient {
|
|
|
18
18
|
uploadProgress?: ProgressCallback;
|
|
19
19
|
signal?: AbortSignal;
|
|
20
20
|
meta?: FileTypeResult | true;
|
|
21
|
-
}): Promise<
|
|
22
|
-
id: string;
|
|
23
|
-
object: DataStorageType;
|
|
24
|
-
}>;
|
|
21
|
+
}): Promise<LocalData>;
|
|
25
22
|
uploadDataInCloud({ data, name, nodeId, encryptProgress, uploadProgress, storageType, signal, }: {
|
|
26
23
|
data: globalThis.File | Uint8Array;
|
|
27
24
|
name: string;
|
package/dist/types/client.d.ts
CHANGED
|
@@ -3878,11 +3878,13 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3878
3878
|
name: string;
|
|
3879
3879
|
dataId: string;
|
|
3880
3880
|
expireAt: Date | null;
|
|
3881
|
+
slug: string;
|
|
3881
3882
|
};
|
|
3882
3883
|
_input_out: {
|
|
3883
3884
|
name: string;
|
|
3884
3885
|
dataId: string;
|
|
3885
3886
|
expireAt: Date | null;
|
|
3887
|
+
slug: string;
|
|
3886
3888
|
};
|
|
3887
3889
|
_output_in: {
|
|
3888
3890
|
name: string;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@secrecy/lib",
|
|
3
3
|
"author": "Anonymize <anonymize@gmail.com>",
|
|
4
4
|
"description": "Anonymize Secrecy Library",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.55.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"typescript": "^5.6.2"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@secrecy/trpc-api-types": "1.33.0-
|
|
77
|
+
"@secrecy/trpc-api-types": "1.33.0-dev.42",
|
|
78
78
|
"@trpc/client": "10.45.2",
|
|
79
79
|
"@trpc/server": "10.45.2",
|
|
80
80
|
"@types/libsodium-wrappers-sumo": "^0.7.8",
|