@secrecy/lib 1.29.0-feat-rename-file.2 → 1.29.0-feat-add-manage-user-data.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.
- package/dist/lib/cache.js +2 -2
- package/dist/lib/client/SecrecyAppClient.js +2 -2
- package/dist/lib/client/SecrecyCloudClient.js +91 -91
- package/dist/lib/client/SecrecyMailClient.js +25 -25
- package/dist/lib/client/convert/file.js +29 -0
- package/dist/lib/client/convert/mail.js +4 -4
- package/dist/lib/client/convert/node.js +7 -7
- package/dist/lib/client/index.js +3 -3
- package/dist/types/cache.d.ts +3 -3
- package/dist/types/client/SecrecyCloudClient.d.ts +15 -15
- package/dist/types/client/convert/file.d.ts +4 -0
- package/dist/types/client/index.d.ts +1 -1
- package/dist/types/client/types/file.d.ts +6 -0
- package/dist/types/client/types/index.d.ts +1 -1
- package/dist/types/client/types/mail.d.ts +5 -5
- package/dist/types/client/types/node.d.ts +4 -4
- package/dist/types/client.d.ts +445 -507
- package/dist/types/index.d.ts +2 -2
- package/dist/types/worker/sodium.d.ts +1 -1
- package/package.json +2 -2
- package/dist/lib/client/convert/data.js +0 -29
- package/dist/types/client/convert/data.d.ts +0 -4
- package/dist/types/client/types/data.d.ts +0 -6
- /package/dist/lib/client/types/{data.js → file.js} +0 -0
- /package/dist/lib/crypto/{data.js → file.js} +0 -0
- /package/dist/types/crypto/{data.d.ts → file.d.ts} +0 -0
package/dist/types/cache.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { InternalNode,
|
|
1
|
+
import type { InternalNode, InternalFile, InternalNodeFull } from './client/types/index.js';
|
|
2
2
|
import { LRUCache } from 'lru-cache';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const filesCache: Map<string, InternalFile>;
|
|
4
4
|
export declare const nodesCache: Map<string, InternalNode | InternalNodeFull>;
|
|
5
5
|
export declare const usersCache: Map<string, {
|
|
6
6
|
id: string;
|
|
@@ -10,4 +10,4 @@ export declare const usersCache: Map<string, {
|
|
|
10
10
|
isSearchable: boolean;
|
|
11
11
|
}>;
|
|
12
12
|
export declare const publicKeysCache: Map<string, string>;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const dataCache: LRUCache<string, Uint8Array, unknown>;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { ProgressCallback, SecrecyClient } from '../index.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FileMetadata, KeyPair, Node, NodeFull, NodeType, Rights } from './types/index.js';
|
|
3
3
|
import { type ApiClient } from '../client.js';
|
|
4
4
|
import { type DownloadProgress } from '../types.js';
|
|
5
5
|
export declare class SecrecyCloudClient {
|
|
6
6
|
#private;
|
|
7
7
|
constructor(client: SecrecyClient, keys: KeyPair, apiClient: ApiClient);
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
addFileToHistory({ fileId, nodeId, }: {
|
|
9
|
+
fileId: string;
|
|
10
10
|
nodeId: string;
|
|
11
11
|
}): Promise<NodeFull>;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
uploadFile({ file, encryptProgress, uploadProgress, signal, }: {
|
|
13
|
+
file: globalThis.File | Uint8Array;
|
|
14
14
|
encryptProgress?: ProgressCallback;
|
|
15
15
|
uploadProgress?: ProgressCallback;
|
|
16
16
|
signal?: AbortSignal;
|
|
17
17
|
}): Promise<string>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
uploadFileInCloud({ file, name, nodeId, encryptProgress, uploadProgress, signal, }: {
|
|
19
|
+
file: globalThis.File | Uint8Array;
|
|
20
20
|
name: string;
|
|
21
21
|
nodeId?: string;
|
|
22
22
|
encryptProgress?: ProgressCallback;
|
|
@@ -46,9 +46,9 @@ export declare class SecrecyCloudClient {
|
|
|
46
46
|
id?: string | null | undefined;
|
|
47
47
|
deleted?: boolean | null | undefined;
|
|
48
48
|
}): Promise<NodeFull>;
|
|
49
|
-
|
|
49
|
+
fileMetadata({ id }: {
|
|
50
50
|
id: string;
|
|
51
|
-
}): Promise<
|
|
51
|
+
}): Promise<FileMetadata>;
|
|
52
52
|
shareNode({ nodeId, userId, rights, }: {
|
|
53
53
|
nodeId: string;
|
|
54
54
|
userId: string;
|
|
@@ -60,14 +60,14 @@ export declare class SecrecyCloudClient {
|
|
|
60
60
|
isFavorite?: boolean | null | undefined;
|
|
61
61
|
deletedAt?: Date | null | undefined;
|
|
62
62
|
}): Promise<NodeFull>;
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
fileContent({ fileId, onDownloadProgress, progressDecrypt, signal, }: {
|
|
64
|
+
fileId: string;
|
|
65
65
|
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
66
66
|
progressDecrypt?: ProgressCallback;
|
|
67
67
|
signal?: AbortSignal;
|
|
68
68
|
}): Promise<Uint8Array>;
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
deleteFile({ fileId, nodeId, }: {
|
|
70
|
+
fileId: string;
|
|
71
71
|
nodeId: string;
|
|
72
72
|
}): Promise<boolean>;
|
|
73
73
|
deleteNode({ nodeId }: {
|
|
@@ -79,8 +79,8 @@ export declare class SecrecyCloudClient {
|
|
|
79
79
|
nodeIds: string[];
|
|
80
80
|
parentNodeId?: string | null | undefined;
|
|
81
81
|
}): Promise<boolean>;
|
|
82
|
-
saveInCloud({
|
|
83
|
-
|
|
82
|
+
saveInCloud({ fileId, name, nodeId, }: {
|
|
83
|
+
fileId: string;
|
|
84
84
|
name: string;
|
|
85
85
|
nodeId?: string;
|
|
86
86
|
}): Promise<NodeFull>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApiFile, InternalFile, FileMetadata, KeyPair } from '../types/index.js';
|
|
2
|
+
export declare function apiFileToInternal(apiFile: ApiFile, keyPair: KeyPair): InternalFile;
|
|
3
|
+
export declare function internalFileToFile(internal: InternalFile): FileMetadata;
|
|
4
|
+
export declare function apiFileToExternal(apiFile: ApiFile, keyPair: KeyPair): FileMetadata;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseClient } from '../base-client.js';
|
|
2
|
-
import type { Progress } from '../crypto/
|
|
2
|
+
import type { Progress } from '../crypto/file.js';
|
|
3
3
|
import { SecrecyCloudClient } from './SecrecyCloudClient.js';
|
|
4
4
|
import { SecrecyMailClient } from './SecrecyMailClient.js';
|
|
5
5
|
import { SecrecyAppClient } from './SecrecyAppClient.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type RouterOutputs } from '../../client.js';
|
|
2
|
+
export type FileMetadata = Pick<ApiFile, 'id' | 'size' | 'sizeBefore' | 'md5' | 'md5Encrypted' | 'createdAt'>;
|
|
3
|
+
export type InternalFile = FileMetadata & {
|
|
4
|
+
key: string;
|
|
5
|
+
};
|
|
6
|
+
export type ApiFile = NonNullable<RouterOutputs['cloud']['fileById']>;
|
|
@@ -15,7 +15,7 @@ export interface BaseMail {
|
|
|
15
15
|
isAltered: boolean;
|
|
16
16
|
recipients: Array<Omit<PublicUser, 'publicKey'>>;
|
|
17
17
|
temporaryRecipients: TemporaryMailUser[];
|
|
18
|
-
|
|
18
|
+
files: Array<{
|
|
19
19
|
id: string;
|
|
20
20
|
name: string;
|
|
21
21
|
key: string;
|
|
@@ -74,10 +74,10 @@ export interface WaitingReceivedMail {
|
|
|
74
74
|
recipients: PublicUser[];
|
|
75
75
|
temporaryRecipients: TemporaryMailUser[];
|
|
76
76
|
}
|
|
77
|
-
export interface
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
export interface MailFile {
|
|
78
|
+
fileKey: string;
|
|
79
|
+
filename: string;
|
|
80
|
+
file: {
|
|
81
81
|
id: string;
|
|
82
82
|
};
|
|
83
83
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RouterOutputs } from '../../client.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FileMetadata, InternalFile, PublicUser } from './index.js';
|
|
3
3
|
export type Rights = ApiNode['users'][number][1];
|
|
4
4
|
export type NodeAccess<T extends Record<string, unknown> = Record<string, unknown>> = T & {
|
|
5
5
|
rights: Rights;
|
|
@@ -34,17 +34,17 @@ export interface Node<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U exten
|
|
|
34
34
|
createdBy: PublicUser;
|
|
35
35
|
access: NodeAccess<U>;
|
|
36
36
|
users: Array<[PublicUser, Rights]>;
|
|
37
|
-
|
|
37
|
+
currentFileId: string | null;
|
|
38
38
|
parentId: string | null;
|
|
39
39
|
}
|
|
40
|
-
export type NodeFull<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U extends Record<string, unknown> = Record<string, unknown>, V extends
|
|
40
|
+
export type NodeFull<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U extends Record<string, unknown> = Record<string, unknown>, V extends FileMetadata = FileMetadata> = Node<T, U> & {
|
|
41
41
|
parent: Node<T, U> | null;
|
|
42
42
|
children: Array<Node<T, U>>;
|
|
43
43
|
current?: V;
|
|
44
44
|
history: V[];
|
|
45
45
|
};
|
|
46
46
|
export type InternalNode = Node<InternalNodeBreadcrumbItem, NameKey>;
|
|
47
|
-
export type InternalNodeFull = NodeFull<InternalNodeBreadcrumbItem, NameKey,
|
|
47
|
+
export type InternalNodeFull = NodeFull<InternalNodeBreadcrumbItem, NameKey, InternalFile>;
|
|
48
48
|
export type ApiNode = RouterOutputs['cloud']['nodeById'];
|
|
49
49
|
export type ApiNodeFull = RouterOutputs['cloud']['nodeFullById'];
|
|
50
50
|
export type ApiNodeParent = NonNullable<RouterOutputs['cloud']['nodeFullById']['parent']>;
|