@secrecy/lib 1.62.1-feat-next15.1 → 1.62.1-feat-orgs.2
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/dist/lib/client/SecrecyCloudClient.js +4 -4
- package/dist/lib/client.js +3 -3
- package/dist/types/cache.d.ts +2 -2
- package/dist/types/client/SecrecyCloudClient.d.ts +15 -15
- package/dist/types/client/index.d.ts +2 -2
- package/dist/types/client/types/index.d.ts +2 -2
- package/dist/types/client.d.ts +16207 -4428
- package/dist/types/crypto/data.d.ts +3 -3
- package/dist/types/error/client.d.ts +2 -2
- package/dist/types/error/index.d.ts +4 -4
- package/dist/types/error/server.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/types.d.ts +2 -1
- package/dist/types/worker/sodium.d.ts +3 -3
- package/package.json +29 -28
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
1
2
|
import ky from 'ky';
|
|
2
3
|
import { nodesCache, dataCache, dataContentCache, nodesEncryptionCache, } from '../cache.js';
|
|
3
4
|
import { secretStreamKeygen } from '../crypto/data.js';
|
|
@@ -184,7 +185,7 @@ export class SecrecyCloudClient {
|
|
|
184
185
|
const progressParts = {};
|
|
185
186
|
const onProgress = (part, progressEvent) => {
|
|
186
187
|
progressParts[part] = progressEvent;
|
|
187
|
-
const current = Object.values(progressParts).reduce((prv, cur) => prv + cur.
|
|
188
|
+
const current = Object.values(progressParts).reduce((prv, cur) => prv + cur.loaded, 0);
|
|
188
189
|
void uploadProgress?.({
|
|
189
190
|
percent: current / encryptedData.byteLength,
|
|
190
191
|
total: encryptedData.byteLength,
|
|
@@ -201,12 +202,11 @@ export class SecrecyCloudClient {
|
|
|
201
202
|
formData.append(key, value);
|
|
202
203
|
}
|
|
203
204
|
formData.append('file', new Blob([chunk.data], { type: filetype?.mime }), `${uploadData.id}-${chunk.order}`);
|
|
204
|
-
await
|
|
205
|
-
signal,
|
|
206
|
-
body: formData,
|
|
205
|
+
await axios.post(part.url, formData, {
|
|
207
206
|
onUploadProgress: (progressEvent) => {
|
|
208
207
|
onProgress(part.order, progressEvent);
|
|
209
208
|
},
|
|
209
|
+
signal,
|
|
210
210
|
});
|
|
211
211
|
return uploadDataPartEnd(chunk.md5, chunk.order);
|
|
212
212
|
};
|
package/dist/lib/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { httpBatchLink, loggerLink,
|
|
1
|
+
import { httpBatchLink, loggerLink, createTRPCProxyClient, TRPCClientError, } from '@trpc/client';
|
|
2
2
|
import superjson from 'superjson';
|
|
3
3
|
import { SECRECY_LIB_VERSION } from './versioning.js';
|
|
4
4
|
export function isTRPCClientError(cause) {
|
|
@@ -9,7 +9,8 @@ superjson.registerCustom({
|
|
|
9
9
|
serialize: (v) => [...v],
|
|
10
10
|
deserialize: (v) => Buffer.from(v),
|
|
11
11
|
}, 'buffer');
|
|
12
|
-
export const createTRPCClient = (opts) =>
|
|
12
|
+
export const createTRPCClient = (opts) => createTRPCProxyClient({
|
|
13
|
+
transformer: superjson,
|
|
13
14
|
links: [
|
|
14
15
|
loggerLink({
|
|
15
16
|
enabled: (op) => {
|
|
@@ -23,7 +24,6 @@ export const createTRPCClient = (opts) => innerCreateTRPCClient({
|
|
|
23
24
|
},
|
|
24
25
|
}),
|
|
25
26
|
httpBatchLink({
|
|
26
|
-
transformer: superjson,
|
|
27
27
|
url: opts.apiUrl
|
|
28
28
|
? `${opts.apiUrl}/trpc`
|
|
29
29
|
: 'https://api.secrecy.tech/trpc',
|
package/dist/types/cache.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ export declare const dataCache: Map<string, InternalData>;
|
|
|
4
4
|
export declare const nodesCache: Map<string, InternalNode | InternalNodeFull>;
|
|
5
5
|
export declare const nodesEncryptionCache: Map<string, InternalMinimalNodeForEncryption>;
|
|
6
6
|
export declare const usersCache: Map<string, {
|
|
7
|
-
firstname: string;
|
|
8
|
-
lastname: string;
|
|
9
7
|
id: string;
|
|
8
|
+
lastname: string;
|
|
9
|
+
firstname: string;
|
|
10
10
|
avatar: string | null;
|
|
11
11
|
isSearchable: boolean;
|
|
12
12
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProgressCallback, SecrecyClient } from '../index.js';
|
|
2
2
|
import type { DataMetadata, DataStorageType, KeyPair, LocalData, Node, NodeFull, NodeType } from './types/index.js';
|
|
3
3
|
import { type RouterInputs, type ApiClient, type RouterOutputs } from '../client.js';
|
|
4
|
-
import { type
|
|
4
|
+
import { type DownloadProgress } from '../types.js';
|
|
5
5
|
import { FileTypeResult } from 'file-type';
|
|
6
6
|
export declare class SecrecyCloudClient {
|
|
7
7
|
#private;
|
|
@@ -63,13 +63,13 @@ export declare class SecrecyCloudClient {
|
|
|
63
63
|
}): Promise<NodeFull>;
|
|
64
64
|
dataContent({ dataId, onDownloadProgress, progressDecrypt, signal, }: {
|
|
65
65
|
dataId: string;
|
|
66
|
-
onDownloadProgress?: (progress:
|
|
66
|
+
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
67
67
|
progressDecrypt?: ProgressCallback;
|
|
68
68
|
signal?: AbortSignal;
|
|
69
69
|
}): Promise<LocalData>;
|
|
70
70
|
dataContents({ dataIds, onDownloadProgress, progressDecrypt, signal, }: {
|
|
71
71
|
dataIds: string[];
|
|
72
|
-
onDownloadProgress?: (progress:
|
|
72
|
+
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
73
73
|
progressDecrypt?: ProgressCallback;
|
|
74
74
|
signal?: AbortSignal;
|
|
75
75
|
}): Promise<LocalData[]>;
|
|
@@ -104,23 +104,22 @@ export declare class SecrecyCloudClient {
|
|
|
104
104
|
toType: "s3" | "cold" | "lite";
|
|
105
105
|
}>;
|
|
106
106
|
getPublicDataLink(input: RouterInputs['cloud']['dataLink']): Promise<{
|
|
107
|
-
id: string;
|
|
108
107
|
name: string;
|
|
108
|
+
id: string;
|
|
109
109
|
dataId: string;
|
|
110
|
-
slug: string;
|
|
111
110
|
expireAt: Date | null;
|
|
111
|
+
slug: string;
|
|
112
112
|
}>;
|
|
113
113
|
getPublicDataLinks(input: RouterInputs['cloud']['dataLinks']): Promise<{
|
|
114
|
-
id: string;
|
|
115
114
|
name: string;
|
|
115
|
+
id: string;
|
|
116
116
|
dataId: string;
|
|
117
|
-
slug: string;
|
|
118
117
|
expireAt: Date | null;
|
|
118
|
+
slug: string;
|
|
119
119
|
}[]>;
|
|
120
120
|
checkAccesses(input: RouterInputs['cloud']['checkAccesses']): Promise<{
|
|
121
121
|
isMatching: true;
|
|
122
122
|
} | {
|
|
123
|
-
isMatching: false;
|
|
124
123
|
details: {
|
|
125
124
|
missingNodeAccesses: {
|
|
126
125
|
userId: string;
|
|
@@ -133,32 +132,33 @@ export declare class SecrecyCloudClient {
|
|
|
133
132
|
}[];
|
|
134
133
|
invalidRightsAccesses: {
|
|
135
134
|
userId: string;
|
|
136
|
-
nodeId: string;
|
|
137
135
|
current: "admin" | "write" | "read";
|
|
136
|
+
nodeId: string;
|
|
138
137
|
expect: "admin" | "write" | "read";
|
|
139
138
|
}[];
|
|
140
139
|
};
|
|
140
|
+
isMatching: false;
|
|
141
141
|
}>;
|
|
142
142
|
createPublicDataLink(input: RouterInputs['cloud']['createDataLink']): Promise<{
|
|
143
|
-
id: string;
|
|
144
143
|
name: string;
|
|
144
|
+
id: string;
|
|
145
145
|
dataId: string;
|
|
146
|
-
slug: string;
|
|
147
146
|
expireAt: Date | null;
|
|
147
|
+
slug: string;
|
|
148
148
|
}>;
|
|
149
149
|
updatePublicDataLink(input: RouterInputs['cloud']['updateDataLink']): Promise<{
|
|
150
|
-
id: string;
|
|
151
150
|
name: string;
|
|
151
|
+
id: string;
|
|
152
152
|
dataId: string;
|
|
153
|
-
slug: string;
|
|
154
153
|
expireAt: Date | null;
|
|
154
|
+
slug: string;
|
|
155
155
|
}>;
|
|
156
156
|
deletePublicDataLink(input: RouterInputs['cloud']['deleteDataLink']): Promise<{
|
|
157
|
-
id: string;
|
|
158
157
|
name: string;
|
|
158
|
+
id: string;
|
|
159
159
|
dataId: string;
|
|
160
|
-
slug: string;
|
|
161
160
|
expireAt: Date | null;
|
|
161
|
+
slug: string;
|
|
162
162
|
}>;
|
|
163
163
|
private _handleDataContent;
|
|
164
164
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseClient, type SecrecyUrls } from '../base-client.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Progress } from '../crypto/data.js';
|
|
3
3
|
import { SecrecyCloudClient } from './SecrecyCloudClient.js';
|
|
4
4
|
import { SecrecyMailClient } from './SecrecyMailClient.js';
|
|
5
5
|
import { SecrecyAppClient } from './SecrecyAppClient.js';
|
|
@@ -11,7 +11,7 @@ import { type KeyPair } from './types/index.js';
|
|
|
11
11
|
import { SecrecyUserClient } from './SecrecyUserClient.js';
|
|
12
12
|
import { SecrecyPseudonymClient } from './SecrecyPseudonymClient.js';
|
|
13
13
|
export type NewMail = Pick<RouterInputs['mail']['createDraft'], 'body' | 'subject' | 'senderFiles' | 'recipients' | 'replyToId'>;
|
|
14
|
-
export type ProgressCallback = (progress:
|
|
14
|
+
export type ProgressCallback = (progress: Progress) => Promise<void>;
|
|
15
15
|
export interface SecrecyClientOptions {
|
|
16
16
|
uaSession: string;
|
|
17
17
|
uaKeys: KeyPair;
|
|
@@ -29,18 +29,18 @@ export declare const secrecyUserApp: z.ZodReadonly<z.ZodObject<{
|
|
|
29
29
|
jwt: z.ZodString;
|
|
30
30
|
uaSession: z.ZodString;
|
|
31
31
|
}, "strict", z.ZodTypeAny, {
|
|
32
|
-
jwt: string;
|
|
33
32
|
keys: {
|
|
34
33
|
publicKey: string;
|
|
35
34
|
privateKey: string;
|
|
36
35
|
};
|
|
36
|
+
jwt: string;
|
|
37
37
|
uaSession: string;
|
|
38
38
|
}, {
|
|
39
|
-
jwt: string;
|
|
40
39
|
keys: {
|
|
41
40
|
publicKey: string;
|
|
42
41
|
privateKey: string;
|
|
43
42
|
};
|
|
43
|
+
jwt: string;
|
|
44
44
|
uaSession: string;
|
|
45
45
|
}>>;
|
|
46
46
|
export type SecrecyUserApp = z.infer<typeof secrecyUserApp>;
|