@secrecy/lib 1.66.0-feat-next15.2 → 1.67.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.
- package/dist/lib/client/SecrecyCloudClient.js +54 -20
- package/dist/lib/client/SecrecyOrganizationClient.js +26 -0
- package/dist/lib/client/index.js +3 -0
- package/dist/lib/client.js +9 -4
- package/dist/types/cache.d.ts +2 -2
- package/dist/types/client/SecrecyCloudClient.d.ts +35 -35
- package/dist/types/client/SecrecyOrganizationClient.d.ts +13 -0
- package/dist/types/client/index.d.ts +4 -2
- package/dist/types/client/types/data.d.ts +1 -1
- package/dist/types/client/types/index.d.ts +29 -3
- package/dist/types/client.d.ts +18018 -5231
- package/dist/types/crypto/data.d.ts +4 -4
- package/dist/types/error/client.d.ts +11 -7
- package/dist/types/error/index.d.ts +23 -23
- package/dist/types/error/server.d.ts +13 -35
- package/dist/types/index.d.ts +2 -2
- package/dist/types/minify/index.d.ts +2 -2
- package/dist/types/types.d.ts +2 -1
- package/dist/types/utils/array.d.ts +2 -2
- package/dist/types/worker/sodium.d.ts +3 -3
- package/package.json +30 -31
- package/dist/lib/transformer.js +0 -18
- package/dist/types/transformer.d.ts +0 -2
|
@@ -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';
|
|
@@ -14,7 +15,6 @@ import { kiloToBytes } from '../utils.js';
|
|
|
14
15
|
import { fileTypeFromBuffer } from 'file-type';
|
|
15
16
|
import { encryptName, generateAndEncryptNameAndKey } from '../crypto/domain.js';
|
|
16
17
|
import { chunkByTotalItems } from '../utils/object.js';
|
|
17
|
-
import axios from 'axios';
|
|
18
18
|
export class SecrecyCloudClient {
|
|
19
19
|
#client;
|
|
20
20
|
#keys;
|
|
@@ -25,7 +25,10 @@ export class SecrecyCloudClient {
|
|
|
25
25
|
this.#apiClient = apiClient;
|
|
26
26
|
}
|
|
27
27
|
async addDataToHistory({ dataId, nodeId, }) {
|
|
28
|
-
const addDataToHistory = await this.#apiClient.cloud.addDataToHistory.mutate({
|
|
28
|
+
const addDataToHistory = await this.#apiClient.cloud.addDataToHistory.mutate({
|
|
29
|
+
dataId,
|
|
30
|
+
nodeId,
|
|
31
|
+
});
|
|
29
32
|
const node = await apiNodeFullToInternalFull(addDataToHistory, this.#keys);
|
|
30
33
|
const data = node.history.find((d) => d.id === dataId);
|
|
31
34
|
if (data !== undefined) {
|
|
@@ -71,7 +74,10 @@ export class SecrecyCloudClient {
|
|
|
71
74
|
const dataKey = encrypted ? secretStreamKeygen() : null;
|
|
72
75
|
const { data: encryptedData, md5: md5Data, md5Encrypted, } = dataKey
|
|
73
76
|
? await encrypt(dataKey, compressed, encryptProgress, signal)
|
|
74
|
-
: {
|
|
77
|
+
: {
|
|
78
|
+
data: compressed,
|
|
79
|
+
md5: await md5(compressed),
|
|
80
|
+
};
|
|
75
81
|
const encryptedDataKey = dataKey
|
|
76
82
|
? encryptCryptoBox(dataKey, this.#keys.publicKey, this.#keys.privateKey)
|
|
77
83
|
: null;
|
|
@@ -162,7 +168,11 @@ export class SecrecyCloudClient {
|
|
|
162
168
|
return localData;
|
|
163
169
|
}
|
|
164
170
|
const uploadDataPartEnd = async (md5, order) => {
|
|
165
|
-
return this.#apiClient.cloud.uploadDataPartEnd.mutate({
|
|
171
|
+
return this.#apiClient.cloud.uploadDataPartEnd.mutate({
|
|
172
|
+
dataId: uploadData.id,
|
|
173
|
+
md5,
|
|
174
|
+
order,
|
|
175
|
+
}, { signal });
|
|
166
176
|
};
|
|
167
177
|
const chunkParts = new Array();
|
|
168
178
|
for (const [index, chunk] of enumerate(chunks(encryptedData, Number(uploadData.partSize)))) {
|
|
@@ -175,7 +185,7 @@ export class SecrecyCloudClient {
|
|
|
175
185
|
const progressParts = {};
|
|
176
186
|
const onProgress = (part, progressEvent) => {
|
|
177
187
|
progressParts[part] = progressEvent;
|
|
178
|
-
const current = Object.values(progressParts).reduce((prv, cur) => prv + cur.
|
|
188
|
+
const current = Object.values(progressParts).reduce((prv, cur) => prv + cur.loaded, 0);
|
|
179
189
|
void uploadProgress?.({
|
|
180
190
|
percent: current / encryptedData.byteLength,
|
|
181
191
|
total: encryptedData.byteLength,
|
|
@@ -193,14 +203,10 @@ export class SecrecyCloudClient {
|
|
|
193
203
|
}
|
|
194
204
|
formData.append('file', new Blob([chunk.data], { type: filetype?.mime }), `${uploadData.id}-${chunk.order}`);
|
|
195
205
|
await axios.post(part.url, formData, {
|
|
196
|
-
signal,
|
|
197
206
|
onUploadProgress: (progressEvent) => {
|
|
198
|
-
onProgress(part.order,
|
|
199
|
-
percent: progressEvent.progress ?? 0,
|
|
200
|
-
totalBytes: progressEvent.total ?? 0,
|
|
201
|
-
transferredBytes: progressEvent.loaded ?? 0,
|
|
202
|
-
});
|
|
207
|
+
onProgress(part.order, progressEvent);
|
|
203
208
|
},
|
|
209
|
+
signal,
|
|
204
210
|
});
|
|
205
211
|
return uploadDataPartEnd(chunk.md5, chunk.order);
|
|
206
212
|
};
|
|
@@ -228,7 +234,11 @@ export class SecrecyCloudClient {
|
|
|
228
234
|
uploadProgress,
|
|
229
235
|
signal,
|
|
230
236
|
});
|
|
231
|
-
return await this.saveInCloud({
|
|
237
|
+
return await this.saveInCloud({
|
|
238
|
+
dataId: uploadedData.id,
|
|
239
|
+
name,
|
|
240
|
+
nodeId,
|
|
241
|
+
});
|
|
232
242
|
}
|
|
233
243
|
async deletedNodes() {
|
|
234
244
|
const deletedNodes = await this.#apiClient.cloud.nodesDeleted.query({});
|
|
@@ -239,7 +249,9 @@ export class SecrecyCloudClient {
|
|
|
239
249
|
return await Promise.all(nodesShared.map(async (node) => await apiNodeToExternal(node, this.#keys)));
|
|
240
250
|
}
|
|
241
251
|
async nodesSharedWithMe(type = 'FOLDER') {
|
|
242
|
-
const nodesSharedWithMe = await this.#apiClient.cloud.nodesSharedWithMe.query({
|
|
252
|
+
const nodesSharedWithMe = await this.#apiClient.cloud.nodesSharedWithMe.query({
|
|
253
|
+
type,
|
|
254
|
+
});
|
|
243
255
|
return await Promise.all(nodesSharedWithMe.map(async (node) => await apiNodeToExternal(node, this.#keys)));
|
|
244
256
|
}
|
|
245
257
|
async deleteNodeSharing({ nodeId, userId, }) {
|
|
@@ -273,7 +285,9 @@ export class SecrecyCloudClient {
|
|
|
273
285
|
return isDuplicated;
|
|
274
286
|
}
|
|
275
287
|
async deleteNodeCloudTrash({ ids }) {
|
|
276
|
-
const { isDeleted } = await this.#apiClient.cloud.deleteNodeCloudTrash.mutate({
|
|
288
|
+
const { isDeleted } = await this.#apiClient.cloud.deleteNodeCloudTrash.mutate({
|
|
289
|
+
ids,
|
|
290
|
+
});
|
|
277
291
|
return isDeleted;
|
|
278
292
|
}
|
|
279
293
|
async createFolder({ name, parentFolderId, }) {
|
|
@@ -304,11 +318,16 @@ export class SecrecyCloudClient {
|
|
|
304
318
|
return folder;
|
|
305
319
|
}
|
|
306
320
|
async node({ id, deleted, } = {}) {
|
|
307
|
-
const node = await this.#apiClient.cloud.nodeFullById.query({
|
|
321
|
+
const node = await this.#apiClient.cloud.nodeFullById.query({
|
|
322
|
+
id,
|
|
323
|
+
deleted,
|
|
324
|
+
});
|
|
308
325
|
return await apiNodeToExternalNodeFull(node, this.#keys);
|
|
309
326
|
}
|
|
310
327
|
async dataMetadata({ id }) {
|
|
311
|
-
const data = await this.#apiClient.cloud.dataById.query({
|
|
328
|
+
const data = await this.#apiClient.cloud.dataById.query({
|
|
329
|
+
id,
|
|
330
|
+
});
|
|
312
331
|
return apiDataToExternal(data, this.#keys);
|
|
313
332
|
}
|
|
314
333
|
async shareNode(input, progress) {
|
|
@@ -320,7 +339,11 @@ export class SecrecyCloudClient {
|
|
|
320
339
|
const publicKeysMap = await this.#client.app.userPublicKey(neededUserKey);
|
|
321
340
|
const maxNodesBatchSize = 1000;
|
|
322
341
|
const totalNodesToShare = Object.values(nodesMap).reduce((size, ids) => size + ids.length, 0);
|
|
323
|
-
progress?.({
|
|
342
|
+
progress?.({
|
|
343
|
+
total: totalNodesToShare,
|
|
344
|
+
current: 0,
|
|
345
|
+
percent: 0,
|
|
346
|
+
});
|
|
324
347
|
const chunks = totalNodesToShare > maxNodesBatchSize
|
|
325
348
|
? chunkByTotalItems(nodesMap, maxNodesBatchSize)
|
|
326
349
|
: [nodesMap];
|
|
@@ -441,7 +464,13 @@ export class SecrecyCloudClient {
|
|
|
441
464
|
for (const [userId, nodes] of Object.entries(nodesToUpdateRights)) {
|
|
442
465
|
finishInput.push(...nodes.map((node) => ({
|
|
443
466
|
userId,
|
|
444
|
-
nodes: [
|
|
467
|
+
nodes: [
|
|
468
|
+
{
|
|
469
|
+
id: node.nodeId,
|
|
470
|
+
data: [],
|
|
471
|
+
...node.permissions,
|
|
472
|
+
},
|
|
473
|
+
],
|
|
445
474
|
})));
|
|
446
475
|
}
|
|
447
476
|
const subState = await this.#apiClient.cloud.shareNodeFinish.mutate(finishInput);
|
|
@@ -479,7 +508,10 @@ export class SecrecyCloudClient {
|
|
|
479
508
|
const errorDetailsLength = details.invalidRightsAccesses.length +
|
|
480
509
|
details.missingDataAccesses.length +
|
|
481
510
|
details.missingNodeAccesses.length;
|
|
482
|
-
return {
|
|
511
|
+
return {
|
|
512
|
+
isFinished: errorDetailsLength === 0,
|
|
513
|
+
details: details,
|
|
514
|
+
};
|
|
483
515
|
}
|
|
484
516
|
async updateNode({ nodeId, name, isFavorite, deletedAt, }) {
|
|
485
517
|
let node = nodesCache.get(nodeId);
|
|
@@ -562,7 +594,9 @@ export class SecrecyCloudClient {
|
|
|
562
594
|
}));
|
|
563
595
|
}
|
|
564
596
|
async deleteNodes({ nodeIds, }) {
|
|
565
|
-
return this.#apiClient.cloud.deleteNodes.mutate({
|
|
597
|
+
return this.#apiClient.cloud.deleteNodes.mutate({
|
|
598
|
+
ids: nodeIds,
|
|
599
|
+
});
|
|
566
600
|
}
|
|
567
601
|
async deleteData({ dataId, nodeId, }) {
|
|
568
602
|
const { isDeleted } = await this.#apiClient.cloud.deleteData.mutate({
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class SecrecyOrganizationClient {
|
|
2
|
+
// readonly #client: SecrecyClient
|
|
3
|
+
#apiClient;
|
|
4
|
+
constructor(_client, _keys, apiClient) {
|
|
5
|
+
// this.#client = client
|
|
6
|
+
this.#apiClient = apiClient;
|
|
7
|
+
}
|
|
8
|
+
async create(input) {
|
|
9
|
+
return this.#apiClient.org.create.mutate(input);
|
|
10
|
+
}
|
|
11
|
+
async update(input) {
|
|
12
|
+
return this.#apiClient.org.update.mutate(input);
|
|
13
|
+
}
|
|
14
|
+
async addMember(input) {
|
|
15
|
+
return this.#apiClient.org.addMember.mutate(input);
|
|
16
|
+
}
|
|
17
|
+
async removeMember(input) {
|
|
18
|
+
return this.#apiClient.org.removeMember.mutate(input);
|
|
19
|
+
}
|
|
20
|
+
async updateRole(input) {
|
|
21
|
+
return this.#apiClient.org.updateRole.mutate(input);
|
|
22
|
+
}
|
|
23
|
+
async list(input) {
|
|
24
|
+
return this.#apiClient.org.list.query(input);
|
|
25
|
+
}
|
|
26
|
+
}
|
package/dist/lib/client/index.js
CHANGED
|
@@ -9,12 +9,14 @@ import { SecrecyPayClient } from './SecrecyPayClient.js';
|
|
|
9
9
|
import { SecrecyUserClient } from './SecrecyUserClient.js';
|
|
10
10
|
import { SecrecyPseudonymClient } from './SecrecyPseudonymClient.js';
|
|
11
11
|
import { decryptAnonymous } from '../crypto/index.js';
|
|
12
|
+
import { SecrecyOrganizationClient } from './SecrecyOrganizationClient.js';
|
|
12
13
|
export class SecrecyClient extends BaseClient {
|
|
13
14
|
#keys;
|
|
14
15
|
cloud;
|
|
15
16
|
mail;
|
|
16
17
|
app;
|
|
17
18
|
db;
|
|
19
|
+
organization;
|
|
18
20
|
wallet;
|
|
19
21
|
pay;
|
|
20
22
|
user;
|
|
@@ -39,6 +41,7 @@ export class SecrecyClient extends BaseClient {
|
|
|
39
41
|
this.mail = new SecrecyMailClient(this, this.#keys, this.client);
|
|
40
42
|
this.app = new SecrecyAppClient(opts.uaJwt, this, this.#keys, this.client);
|
|
41
43
|
this.db = new SecrecyDbClient(this, this.#keys, this.client);
|
|
44
|
+
this.organization = new SecrecyOrganizationClient(this, this.#keys, this.client);
|
|
42
45
|
this.wallet = new SecrecyWalletClient(this);
|
|
43
46
|
this.pay = new SecrecyPayClient(this, this.#keys, this.client);
|
|
44
47
|
this.user = new SecrecyUserClient(this, this.#keys, this.client);
|
package/dist/lib/client.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { httpBatchLink, loggerLink,
|
|
1
|
+
import { httpBatchLink, loggerLink, createTRPCProxyClient, TRPCClientError, } from '@trpc/client';
|
|
2
|
+
import superjson from 'superjson';
|
|
2
3
|
import { SECRECY_LIB_VERSION } from './versioning.js';
|
|
3
|
-
import { transformer } from './transformer.js';
|
|
4
4
|
export function isTRPCClientError(cause) {
|
|
5
5
|
return cause instanceof TRPCClientError;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
superjson.registerCustom({
|
|
8
|
+
isApplicable: (v) => v instanceof Buffer,
|
|
9
|
+
serialize: (v) => [...v],
|
|
10
|
+
deserialize: (v) => Buffer.from(v),
|
|
11
|
+
}, 'buffer');
|
|
12
|
+
export const createTRPCClient = (opts) => createTRPCProxyClient({
|
|
13
|
+
transformer: superjson,
|
|
8
14
|
links: [
|
|
9
15
|
loggerLink({
|
|
10
16
|
enabled: (op) => {
|
|
@@ -18,7 +24,6 @@ export const createTRPCClient = (opts) => innerCreateTRPCClient({
|
|
|
18
24
|
},
|
|
19
25
|
}),
|
|
20
26
|
httpBatchLink({
|
|
21
|
-
transformer,
|
|
22
27
|
url: opts.apiUrl
|
|
23
28
|
? `${opts.apiUrl}/trpc`
|
|
24
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;
|
|
@@ -12,7 +12,7 @@ export declare class SecrecyCloudClient {
|
|
|
12
12
|
}): Promise<NodeFull>;
|
|
13
13
|
uploadData({ storageType, data, encrypted, encryptProgress, uploadProgress, signal, meta, }: {
|
|
14
14
|
storageType: DataStorageType;
|
|
15
|
-
data: globalThis.File | Uint8Array
|
|
15
|
+
data: globalThis.File | Uint8Array;
|
|
16
16
|
encrypted?: boolean;
|
|
17
17
|
encryptProgress?: ProgressCallback;
|
|
18
18
|
uploadProgress?: ProgressCallback;
|
|
@@ -20,7 +20,7 @@ export declare class SecrecyCloudClient {
|
|
|
20
20
|
meta?: FileTypeResult | true;
|
|
21
21
|
}): Promise<LocalData>;
|
|
22
22
|
uploadDataInCloud({ data, name, nodeId, encryptProgress, uploadProgress, storageType, signal, }: {
|
|
23
|
-
data: globalThis.File | Uint8Array
|
|
23
|
+
data: globalThis.File | Uint8Array;
|
|
24
24
|
name: string;
|
|
25
25
|
nodeId?: string;
|
|
26
26
|
encryptProgress?: ProgressCallback;
|
|
@@ -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;
|
|
109
|
-
|
|
110
|
-
expireAt: Date | null;
|
|
108
|
+
id: string;
|
|
111
109
|
dataId: string;
|
|
110
|
+
expireAt: Date | null;
|
|
111
|
+
slug: string;
|
|
112
112
|
}>;
|
|
113
113
|
getPublicDataLinks(input: RouterInputs['cloud']['dataLinks']): Promise<{
|
|
114
|
-
id: string;
|
|
115
114
|
name: string;
|
|
116
|
-
|
|
117
|
-
expireAt: Date | null;
|
|
115
|
+
id: string;
|
|
118
116
|
dataId: string;
|
|
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;
|
|
@@ -128,51 +127,52 @@ export declare class SecrecyCloudClient {
|
|
|
128
127
|
}[];
|
|
129
128
|
missingDataAccesses: {
|
|
130
129
|
userId: string;
|
|
131
|
-
nodeId: string;
|
|
132
130
|
dataId: string;
|
|
131
|
+
nodeId: string;
|
|
133
132
|
}[];
|
|
134
133
|
invalidRightsAccesses: {
|
|
135
134
|
userId: string;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
rights: "delete" | "read" | "write";
|
|
135
|
+
current: {
|
|
136
|
+
rights: "delete" | "write" | "read";
|
|
139
137
|
} & {
|
|
140
|
-
addAccess?: "delete" | "
|
|
141
|
-
sharingAddAccess?: "delete" | "
|
|
142
|
-
delAccess?: "delete" | "
|
|
143
|
-
sharingDelAccess?: "delete" | "
|
|
138
|
+
addAccess?: "delete" | "write" | "read" | null | undefined;
|
|
139
|
+
sharingAddAccess?: "delete" | "write" | "read" | null | undefined;
|
|
140
|
+
delAccess?: "delete" | "write" | "read" | null | undefined;
|
|
141
|
+
sharingDelAccess?: "delete" | "write" | "read" | null | undefined;
|
|
144
142
|
};
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
nodeId: string;
|
|
144
|
+
expect: {
|
|
145
|
+
rights: "delete" | "write" | "read";
|
|
147
146
|
} & {
|
|
148
|
-
addAccess?: "delete" | "
|
|
149
|
-
sharingAddAccess?: "delete" | "
|
|
150
|
-
delAccess?: "delete" | "
|
|
151
|
-
sharingDelAccess?: "delete" | "
|
|
147
|
+
addAccess?: "delete" | "write" | "read" | null | undefined;
|
|
148
|
+
sharingAddAccess?: "delete" | "write" | "read" | null | undefined;
|
|
149
|
+
delAccess?: "delete" | "write" | "read" | null | undefined;
|
|
150
|
+
sharingDelAccess?: "delete" | "write" | "read" | null | undefined;
|
|
152
151
|
};
|
|
153
152
|
}[];
|
|
154
153
|
};
|
|
154
|
+
isMatching: false;
|
|
155
155
|
}>;
|
|
156
156
|
createPublicDataLink(input: RouterInputs['cloud']['createDataLink']): Promise<{
|
|
157
|
-
id: string;
|
|
158
157
|
name: string;
|
|
159
|
-
|
|
160
|
-
expireAt: Date | null;
|
|
158
|
+
id: string;
|
|
161
159
|
dataId: string;
|
|
160
|
+
expireAt: Date | null;
|
|
161
|
+
slug: string;
|
|
162
162
|
}>;
|
|
163
163
|
updatePublicDataLink(input: RouterInputs['cloud']['updateDataLink']): Promise<{
|
|
164
|
-
id: string;
|
|
165
164
|
name: string;
|
|
166
|
-
|
|
167
|
-
expireAt: Date | null;
|
|
165
|
+
id: string;
|
|
168
166
|
dataId: string;
|
|
167
|
+
expireAt: Date | null;
|
|
168
|
+
slug: string;
|
|
169
169
|
}>;
|
|
170
170
|
deletePublicDataLink(input: RouterInputs['cloud']['deleteDataLink']): Promise<{
|
|
171
|
-
id: string;
|
|
172
171
|
name: string;
|
|
173
|
-
|
|
174
|
-
expireAt: Date | null;
|
|
172
|
+
id: string;
|
|
175
173
|
dataId: string;
|
|
174
|
+
expireAt: Date | null;
|
|
175
|
+
slug: string;
|
|
176
176
|
}>;
|
|
177
177
|
private _handleDataContent;
|
|
178
178
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RouterInputs, RouterOutputs, type ApiClient } from '../client.js';
|
|
2
|
+
import type { SecrecyClient } from '../index.js';
|
|
3
|
+
import { type KeyPair } from './types/index.js';
|
|
4
|
+
export declare class SecrecyOrganizationClient {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(_client: SecrecyClient, _keys: KeyPair, apiClient: ApiClient);
|
|
7
|
+
create(input: RouterInputs['org']['create']): Promise<RouterOutputs['org']['create']>;
|
|
8
|
+
update(input: Omit<RouterInputs['org']['update'], 'billingProfileStripeCustomerId'>): Promise<RouterOutputs['org']['update']>;
|
|
9
|
+
addMember(input: RouterInputs['org']['addMember']): Promise<RouterOutputs['org']['addMember']>;
|
|
10
|
+
removeMember(input: RouterInputs['org']['removeMember']): Promise<RouterOutputs['org']['removeMember']>;
|
|
11
|
+
updateRole(input: RouterInputs['org']['updateRole']): Promise<RouterOutputs['org']['updateRole']>;
|
|
12
|
+
list(input: RouterInputs['org']['list']): Promise<RouterOutputs['org']['list']>;
|
|
13
|
+
}
|
|
@@ -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';
|
|
@@ -10,8 +10,9 @@ import { ApiClient, type RouterInputs } from '../client.js';
|
|
|
10
10
|
import { type KeyPair } from './types/index.js';
|
|
11
11
|
import { SecrecyUserClient } from './SecrecyUserClient.js';
|
|
12
12
|
import { SecrecyPseudonymClient } from './SecrecyPseudonymClient.js';
|
|
13
|
+
import { SecrecyOrganizationClient } from './SecrecyOrganizationClient.js';
|
|
13
14
|
export type NewMail = Pick<RouterInputs['mail']['createDraft'], 'body' | 'subject' | 'senderFiles' | 'recipients' | 'replyToId'>;
|
|
14
|
-
export type ProgressCallback = (progress:
|
|
15
|
+
export type ProgressCallback = (progress: Progress) => Promise<void>;
|
|
15
16
|
export interface SecrecyClientOptions {
|
|
16
17
|
uaSession: string;
|
|
17
18
|
uaKeys: KeyPair;
|
|
@@ -25,6 +26,7 @@ export declare class SecrecyClient extends BaseClient {
|
|
|
25
26
|
mail: SecrecyMailClient;
|
|
26
27
|
app: SecrecyAppClient;
|
|
27
28
|
db: SecrecyDbClient;
|
|
29
|
+
organization: SecrecyOrganizationClient;
|
|
28
30
|
wallet: SecrecyWalletClient;
|
|
29
31
|
pay: SecrecyPayClient;
|
|
30
32
|
user: SecrecyUserClient;
|
|
@@ -7,14 +7,40 @@ export type * from './user.js';
|
|
|
7
7
|
declare const keyPair: z.ZodObject<{
|
|
8
8
|
publicKey: z.ZodString;
|
|
9
9
|
privateKey: z.ZodString;
|
|
10
|
-
}, z.
|
|
10
|
+
}, "strict", z.ZodTypeAny, {
|
|
11
|
+
publicKey: string;
|
|
12
|
+
privateKey: string;
|
|
13
|
+
}, {
|
|
14
|
+
publicKey: string;
|
|
15
|
+
privateKey: string;
|
|
16
|
+
}>;
|
|
11
17
|
export type KeyPair = z.infer<typeof keyPair>;
|
|
12
18
|
export declare const secrecyUserApp: z.ZodReadonly<z.ZodObject<{
|
|
13
19
|
keys: z.ZodObject<{
|
|
14
20
|
publicKey: z.ZodString;
|
|
15
21
|
privateKey: z.ZodString;
|
|
16
|
-
}, z.
|
|
22
|
+
}, "strict", z.ZodTypeAny, {
|
|
23
|
+
publicKey: string;
|
|
24
|
+
privateKey: string;
|
|
25
|
+
}, {
|
|
26
|
+
publicKey: string;
|
|
27
|
+
privateKey: string;
|
|
28
|
+
}>;
|
|
17
29
|
jwt: z.ZodString;
|
|
18
30
|
uaSession: z.ZodString;
|
|
19
|
-
}, z.
|
|
31
|
+
}, "strict", z.ZodTypeAny, {
|
|
32
|
+
keys: {
|
|
33
|
+
publicKey: string;
|
|
34
|
+
privateKey: string;
|
|
35
|
+
};
|
|
36
|
+
jwt: string;
|
|
37
|
+
uaSession: string;
|
|
38
|
+
}, {
|
|
39
|
+
keys: {
|
|
40
|
+
publicKey: string;
|
|
41
|
+
privateKey: string;
|
|
42
|
+
};
|
|
43
|
+
jwt: string;
|
|
44
|
+
uaSession: string;
|
|
45
|
+
}>>;
|
|
20
46
|
export type SecrecyUserApp = z.infer<typeof secrecyUserApp>;
|