@secrecy/lib 1.55.1 → 1.55.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.
@@ -111,18 +111,16 @@ export class SecrecyCloudClient {
111
111
  current: encryptedData.byteLength,
112
112
  percent: 1,
113
113
  });
114
- dataContentCache.set(uploadData.id, {
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
- dataContentCache.set(uploadData.id, {
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({
@@ -204,9 +200,8 @@ export class SecrecyCloudClient {
204
200
  for (const [key, value] of Object.entries(part.fields)) {
205
201
  formData.append(key, value);
206
202
  }
207
- formData.append('file', new Blob([chunk.data]), `${uploadData.id}-${chunk.order}`);
203
+ formData.append('file', new Blob([chunk.data], { type: filetype?.mime }), `${uploadData.id}-${chunk.order}`);
208
204
  await axios.post(part.url, formData, {
209
- headers: filetype ? { 'content-type': filetype.mime } : undefined,
210
205
  onUploadProgress: (progressEvent) => {
211
206
  onProgress(part.order, progressEvent);
212
207
  },
@@ -217,18 +212,16 @@ export class SecrecyCloudClient {
217
212
  await promiseAllLimit(3, uploadData.parts.map((p) => async () => {
218
213
  await byPart(p);
219
214
  }));
220
- dataContentCache.set(uploadData.id, {
215
+ const localData = {
221
216
  id: uploadData.id,
222
217
  storageType: storageType,
223
218
  size: uploadDataArgs.size,
224
219
  sizeEncrypted: uploadDataArgs.sizeEncrypted ?? null,
225
220
  data: dataBuffer,
226
221
  ...filetype,
227
- });
228
- return {
229
- object: storageType,
230
- id: uploadData.id,
231
222
  };
223
+ dataContentCache.set(uploadData.id, localData);
224
+ return localData;
232
225
  }
233
226
  throw new Error(`The "${storageType}" is not implemented yet!`);
234
227
  }
@@ -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;
@@ -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.55.1",
5
+ "version": "1.55.3",
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-feat-mime-types.3",
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",