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