@secrecy/lib 1.0.0-dev.7 → 1.0.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/README.md +1 -1
- package/{lib → dist}/BaseClient.d.ts +62 -69
- package/dist/BaseClient.js +1124 -0
- package/{lib → dist}/PopupTools.d.ts +1 -1
- package/dist/PopupTools.js +212 -0
- package/{lib → dist}/ZeusThunder.d.ts +0 -0
- package/dist/ZeusThunder.js +79 -0
- package/dist/cache.d.ts +6 -0
- package/dist/cache.js +4 -0
- package/dist/client/admin/index.d.ts +11 -0
- package/dist/client/admin/index.js +110 -0
- package/{lib → dist}/client/convert/file.d.ts +3 -3
- package/dist/client/convert/file.js +34 -0
- package/{lib → dist}/client/convert/mail.d.ts +0 -0
- package/dist/client/convert/mail.js +46 -0
- package/dist/client/convert/node.d.ts +9 -0
- package/dist/client/convert/node.js +101 -0
- package/{lib → dist}/client/helpers.d.ts +1 -1
- package/dist/client/helpers.js +114 -0
- package/dist/client/index.d.ts +164 -0
- package/dist/client/index.js +3206 -0
- package/{lib → dist}/client/storage.d.ts +0 -0
- package/dist/client/storage.js +12 -0
- package/dist/client/types/File.d.ts +14 -0
- package/dist/client/types/File.js +3 -0
- package/{lib → dist}/client/types/Inputs.d.ts +2 -7
- package/dist/client/types/Inputs.js +3 -0
- package/dist/client/types/Node.d.ts +49 -0
- package/dist/client/types/Node.js +3 -0
- package/{lib → dist}/client/types/UserAppNotifications.d.ts +1 -1
- package/dist/client/types/UserAppNotifications.js +3 -0
- package/{lib → dist}/client/types/UserAppSettings.d.ts +0 -1
- package/dist/client/types/UserAppSettings.js +3 -0
- package/{lib → dist}/client/types/index.d.ts +7 -13
- package/dist/client/types/index.js +8 -0
- package/dist/client/types/selectors.d.ts +476 -0
- package/dist/client/types/selectors.js +125 -0
- package/{lib → dist}/crypto/file.d.ts +0 -0
- package/dist/crypto/file.js +210 -0
- package/{lib → dist}/crypto/index.d.ts +0 -0
- package/dist/crypto/index.js +47 -0
- package/dist/error.d.ts +30 -0
- package/dist/error.js +3 -0
- package/{lib → dist}/index.d.ts +4 -3
- package/dist/index.js +10 -0
- package/{lib → dist}/minify/index.d.ts +0 -0
- package/dist/minify/index.js +28 -0
- package/{lib → dist}/minify/lz4.d.ts +0 -0
- package/dist/minify/lz4.js +627 -0
- package/{lib → dist}/sodium.d.ts +0 -0
- package/dist/sodium.js +6 -0
- package/{lib → dist}/utils/store-buddy.d.ts +0 -0
- package/dist/utils/store-buddy.js +65 -0
- package/{lib → dist}/utils/time.d.ts +0 -0
- package/dist/utils/time.js +14 -0
- package/{lib → dist/utils}/utils.d.ts +0 -0
- package/dist/utils/utils.js +57 -0
- package/{lib → dist}/worker/__mock__/sodium.worker.d.ts +0 -0
- package/dist/worker/__mock__/sodium.worker.js +49 -0
- package/{lib → dist}/worker/md5.d.ts +0 -0
- package/dist/worker/md5.js +25 -0
- package/{lib → dist}/worker/sodium.d.ts +0 -0
- package/dist/worker/sodium.js +120 -0
- package/{lib → dist}/worker/workerCodes.d.ts +0 -0
- package/dist/worker/workerCodes.js +3 -0
- package/{lib → dist}/zeus/const.d.ts +5 -0
- package/dist/zeus/const.js +1230 -0
- package/dist/zeus/index.d.ts +4069 -0
- package/dist/zeus/index.js +657 -0
- package/package.json +64 -57
- package/lib/BaseClient.js +0 -1332
- package/lib/PopupTools.js +0 -213
- package/lib/ZeusThunder.js +0 -112
- package/lib/cache.d.ts +0 -7
- package/lib/cache.js +0 -5
- package/lib/client/convert/file.js +0 -39
- package/lib/client/convert/folder.d.ts +0 -8
- package/lib/client/convert/folder.js +0 -264
- package/lib/client/convert/mail.js +0 -46
- package/lib/client/convert/vFile.d.ts +0 -5
- package/lib/client/convert/vFile.js +0 -164
- package/lib/client/helpers.js +0 -116
- package/lib/client/index.d.ts +0 -167
- package/lib/client/index.js +0 -3746
- package/lib/client/storage.js +0 -12
- package/lib/client/types/File.d.ts +0 -21
- package/lib/client/types/File.js +0 -2
- package/lib/client/types/FilesOnUsersOnApplications.d.ts +0 -9
- package/lib/client/types/FilesOnUsersOnApplications.js +0 -2
- package/lib/client/types/Folder.d.ts +0 -68
- package/lib/client/types/Folder.js +0 -7
- package/lib/client/types/Inputs.js +0 -2
- package/lib/client/types/UserAppNotifications.js +0 -2
- package/lib/client/types/UserAppSettings.js +0 -2
- package/lib/client/types/VFile.d.ts +0 -62
- package/lib/client/types/VFile.js +0 -4
- package/lib/client/types/index.js +0 -9
- package/lib/client/types/queries.d.ts +0 -535
- package/lib/client/types/queries.js +0 -192
- package/lib/crypto/file.js +0 -291
- package/lib/crypto/index.js +0 -37
- package/lib/index.js +0 -40
- package/lib/minify/index.js +0 -28
- package/lib/minify/lz4.js +0 -633
- package/lib/sodium.js +0 -28
- package/lib/utils/store-buddy.js +0 -69
- package/lib/utils/time.js +0 -22
- package/lib/utils.js +0 -188
- package/lib/worker/__mock__/sodium.worker.js +0 -57
- package/lib/worker/md5.js +0 -43
- package/lib/worker/sodium.js +0 -155
- package/lib/worker/workerCodes.js +0 -3
- package/lib/zeus/const.js +0 -1643
- package/lib/zeus/index.d.ts +0 -26220
- package/lib/zeus/index.js +0 -552
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# Anonymize Secrecy Library
|
|
1
|
+
# Anonymize Secrecy Library 📚🔐
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { DownloadProgress as DLProgress } from "ky";
|
|
2
|
-
import type { Document } from "bson";
|
|
3
2
|
import type { UserSession } from "./client/types/index.js";
|
|
4
3
|
import type { SecrecyEnv } from "./client/helpers.js";
|
|
5
4
|
import type { Lang, PayInputType, PlanKind, Thunder, UserRole } from "./zeus/index.js";
|
|
5
|
+
import type { ErrorAccessDenied, ErrorLimit, ErrorNotFound, ErrorNotExist, ErrorLangNotExist, ErrorBasic } from "./error.js";
|
|
6
|
+
export declare type SuccessResponse<T> = {
|
|
7
|
+
__typename: "SuccessResponse";
|
|
8
|
+
data: T;
|
|
9
|
+
};
|
|
6
10
|
export declare type DownloadProgress = DLProgress;
|
|
7
11
|
export declare type PayInput = {
|
|
8
12
|
type: PayInputType;
|
|
@@ -19,24 +23,24 @@ export declare type PayInput = {
|
|
|
19
23
|
number: string;
|
|
20
24
|
};
|
|
21
25
|
export declare type MailLimits = {
|
|
22
|
-
count?:
|
|
23
|
-
fileCount?:
|
|
24
|
-
fileSize?:
|
|
25
|
-
hardCount?:
|
|
26
|
-
hardFileCount?:
|
|
27
|
-
hardFileSize?:
|
|
28
|
-
perFileSize?:
|
|
26
|
+
count?: bigint | undefined;
|
|
27
|
+
fileCount?: bigint | undefined;
|
|
28
|
+
fileSize?: bigint | undefined;
|
|
29
|
+
hardCount?: bigint | undefined;
|
|
30
|
+
hardFileCount?: bigint | undefined;
|
|
31
|
+
hardFileSize?: bigint | undefined;
|
|
32
|
+
perFileSize?: bigint | undefined;
|
|
29
33
|
};
|
|
30
34
|
export declare type Limits = {
|
|
31
|
-
downloadBandwidth?:
|
|
32
|
-
downloadCount?:
|
|
33
|
-
hardFileCount?:
|
|
34
|
-
hardFileSize?:
|
|
35
|
-
perFileSize?:
|
|
35
|
+
downloadBandwidth?: bigint | undefined;
|
|
36
|
+
downloadCount?: bigint | undefined;
|
|
37
|
+
hardFileCount?: bigint | undefined;
|
|
38
|
+
hardFileSize?: bigint | undefined;
|
|
39
|
+
perFileSize?: bigint | undefined;
|
|
36
40
|
receivedMails: MailLimits;
|
|
37
41
|
sentMails: MailLimits;
|
|
38
|
-
uploadBandwidth?:
|
|
39
|
-
uploadCount?:
|
|
42
|
+
uploadBandwidth?: bigint | undefined;
|
|
43
|
+
uploadCount?: bigint | undefined;
|
|
40
44
|
};
|
|
41
45
|
export declare type GodUser = {
|
|
42
46
|
id: string;
|
|
@@ -56,8 +60,7 @@ export declare type Plan = {
|
|
|
56
60
|
};
|
|
57
61
|
export declare type SubscriptionState = "active" | "canceled" | "paused" | "expired" | "future" | "in_trial" | "live" | "past_due";
|
|
58
62
|
export declare type SubscriptionCollectionMethod = "automatic" | "manual";
|
|
59
|
-
declare type
|
|
60
|
-
export declare type Subscription = {
|
|
63
|
+
declare type InternalSubscription = {
|
|
61
64
|
autorenew: boolean;
|
|
62
65
|
activatedAt?: Date | null | undefined;
|
|
63
66
|
currentPeriodEndsAt?: Date | null | undefined;
|
|
@@ -69,21 +72,29 @@ export declare type Subscription = {
|
|
|
69
72
|
trialEndsAt?: Date | null | undefined;
|
|
70
73
|
trialStartedAt?: Date | null | undefined;
|
|
71
74
|
updatedAt?: Date | null | undefined;
|
|
72
|
-
collectionMethod:
|
|
73
|
-
state:
|
|
75
|
+
collectionMethod: string;
|
|
76
|
+
state: string;
|
|
74
77
|
plan?: string | null | undefined;
|
|
75
78
|
planCode?: string | null | undefined;
|
|
76
79
|
total?: number | null | undefined;
|
|
77
80
|
};
|
|
78
|
-
|
|
81
|
+
declare type RecurlyInvoiceStatus = "pending" | "paid" | "failed" | "past_due" | "open" | "closed" | "voided" | "processing";
|
|
82
|
+
declare type InternalRecurlyInvoices = {
|
|
79
83
|
pdf: string;
|
|
80
84
|
date: Date;
|
|
81
85
|
due: Date;
|
|
82
|
-
status:
|
|
86
|
+
status: string;
|
|
83
87
|
total: number;
|
|
84
88
|
name: string;
|
|
85
89
|
currency: string;
|
|
86
90
|
};
|
|
91
|
+
export declare type Subscription = InternalSubscription & {
|
|
92
|
+
collectionMethod: SubscriptionCollectionMethod;
|
|
93
|
+
state: SubscriptionState;
|
|
94
|
+
};
|
|
95
|
+
export declare type RecurlyInvoices = InternalRecurlyInvoices & {
|
|
96
|
+
status: RecurlyInvoiceStatus;
|
|
97
|
+
};
|
|
87
98
|
export declare type PaymentInfos = {
|
|
88
99
|
hostedUrl: string;
|
|
89
100
|
currentSubscription: Subscription;
|
|
@@ -152,7 +163,7 @@ export declare type UserBase = {
|
|
|
152
163
|
role: UserRole;
|
|
153
164
|
firstname: string;
|
|
154
165
|
id: string;
|
|
155
|
-
deletedAt
|
|
166
|
+
deletedAt?: Date;
|
|
156
167
|
lastLogin: Date;
|
|
157
168
|
lang: Lang;
|
|
158
169
|
};
|
|
@@ -166,23 +177,24 @@ export declare type User<T extends WithPublicKey = WithPublicKey> = T extends {
|
|
|
166
177
|
} : UserBase;
|
|
167
178
|
declare type ClassGetUserParams = WithPublicKey & {
|
|
168
179
|
userId?: string;
|
|
180
|
+
userEmail?: string;
|
|
169
181
|
};
|
|
170
182
|
declare type StaticGetUserParams = ClassGetUserParams & {
|
|
171
183
|
env: SecrecyEnv;
|
|
172
184
|
};
|
|
173
185
|
export declare type CloudLimits = {
|
|
174
186
|
count: bigint;
|
|
175
|
-
maxCount
|
|
187
|
+
maxCount?: bigint | undefined;
|
|
176
188
|
size: bigint;
|
|
177
|
-
maxSize
|
|
189
|
+
maxSize?: bigint | undefined;
|
|
178
190
|
};
|
|
179
191
|
export declare type MailLimitsValues = {
|
|
180
192
|
count: bigint;
|
|
181
|
-
maxCount
|
|
193
|
+
maxCount?: bigint | undefined;
|
|
182
194
|
fileSize: bigint;
|
|
183
|
-
maxFileSize
|
|
195
|
+
maxFileSize?: bigint | undefined;
|
|
184
196
|
fileCount: bigint;
|
|
185
|
-
maxFileCount
|
|
197
|
+
maxFileCount?: bigint | undefined;
|
|
186
198
|
};
|
|
187
199
|
export declare type QueryLimits = {
|
|
188
200
|
cloud: CloudLimits;
|
|
@@ -197,70 +209,51 @@ export declare class BaseClient {
|
|
|
197
209
|
protected client: ReturnType<typeof Thunder>;
|
|
198
210
|
sessionId: string;
|
|
199
211
|
constructor(session: string, env: SecrecyEnv);
|
|
200
|
-
sessions(): Promise<UserSession[]>;
|
|
212
|
+
sessions(): Promise<SuccessResponse<UserSession[]> | ErrorNotFound | null>;
|
|
201
213
|
logout(sessionId?: string | null | undefined): Promise<void>;
|
|
202
|
-
me<T extends WithPublicKey = WithPublicKey>(params?: T): Promise<User<T
|
|
203
|
-
static user<T extends StaticGetUserParams>(params: T, sessionId?: string | null | undefined): Promise<User<T
|
|
204
|
-
user<T extends ClassGetUserParams>(params: T): Promise<User<T
|
|
214
|
+
me<T extends WithPublicKey = WithPublicKey>(params?: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
215
|
+
static user<T extends StaticGetUserParams>(params: T, sessionId?: string | null | undefined): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
216
|
+
user<T extends ClassGetUserParams>(params: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
205
217
|
updateProfile({ firstname, lastname, lang }: {
|
|
206
218
|
firstname: string | null;
|
|
207
219
|
lastname: string | null;
|
|
208
220
|
lang: Lang | null;
|
|
209
|
-
}): Promise<User>;
|
|
210
|
-
static plans(env: SecrecyEnv, sessionId?: string | null | undefined): Promise<Plan[]>;
|
|
211
|
-
pay(planCode: SecrecyPlansCodes, input: PayInput, autoRenew?: boolean | null | undefined): Promise<boolean>;
|
|
212
|
-
cancelPayment(): Promise<boolean>;
|
|
213
|
-
paymentInfos(): Promise<PaymentInfos | null>;
|
|
214
|
-
limits(): Promise<QueryLimits | null>;
|
|
215
|
-
godFatherAndChildren(): Promise<GodFatherAndChildren | null>;
|
|
221
|
+
}): Promise<SuccessResponse<User> | ErrorNotFound | ErrorAccessDenied | null>;
|
|
222
|
+
static plans(env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<Plan[]> | null>;
|
|
223
|
+
pay(planCode: SecrecyPlansCodes, input: PayInput, autoRenew?: boolean | null | undefined): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
|
|
224
|
+
cancelPayment(): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
|
|
225
|
+
paymentInfos(): Promise<SuccessResponse<PaymentInfos> | ErrorAccessDenied | null>;
|
|
226
|
+
limits(): Promise<SuccessResponse<QueryLimits> | ErrorAccessDenied | ErrorNotExist | ErrorLimit | ErrorNotFound | null>;
|
|
227
|
+
godFatherAndChildren(): Promise<SuccessResponse<GodFatherAndChildren> | ErrorNotFound | null>;
|
|
216
228
|
static updateAppDBConfig({ appCode, config, env, sessionId }: {
|
|
217
229
|
appCode: string;
|
|
218
230
|
config: AppDBConfig;
|
|
219
231
|
env: SecrecyEnv;
|
|
220
232
|
sessionId?: string | null | undefined;
|
|
221
|
-
}): Promise<AppDBConfig>;
|
|
222
|
-
static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<AppDBConfig>;
|
|
233
|
+
}): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | null>;
|
|
234
|
+
static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | ErrorNotFound | ErrorNotExist | null>;
|
|
223
235
|
static getFAQ({ lang, env, sessionId }: {
|
|
224
236
|
lang?: Lang;
|
|
225
237
|
env: SecrecyEnv;
|
|
226
238
|
sessionId?: string | null | undefined;
|
|
227
|
-
}): Promise<FaqItem[]>;
|
|
239
|
+
}): Promise<SuccessResponse<FaqItem[]> | ErrorAccessDenied | null>;
|
|
228
240
|
static getBlog({ env, lang, sessionId }: {
|
|
229
241
|
env: SecrecyEnv;
|
|
230
242
|
lang?: Lang | null | undefined;
|
|
231
243
|
sessionId?: string | null | undefined;
|
|
232
|
-
}): Promise<BlogItem[]>;
|
|
233
|
-
reportUser(reportedUserId: string, customMessage?: string): Promise<SendReport |
|
|
244
|
+
}): Promise<SuccessResponse<BlogItem[]> | ErrorLangNotExist | null>;
|
|
245
|
+
reportUser(reportedUserId: string, customMessage?: string): Promise<SuccessResponse<SendReport> | ErrorAccessDenied | ErrorNotFound | null>;
|
|
234
246
|
static deleteUser({ sessionId, userId, env }: {
|
|
235
247
|
sessionId: string;
|
|
236
248
|
userId?: string;
|
|
237
249
|
env: SecrecyEnv;
|
|
238
|
-
}): Promise<boolean>;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
dbSet<T extends UserData, U extends Document>({ value, userId }: {
|
|
244
|
-
value: U;
|
|
245
|
-
userId?: string | null | undefined;
|
|
246
|
-
}): Promise<T>;
|
|
247
|
-
dbSearch<T>({ search, field }: {
|
|
248
|
-
field: string;
|
|
249
|
-
search: string;
|
|
250
|
-
}): Promise<T[]>;
|
|
251
|
-
deleteFolder({ id }: {
|
|
250
|
+
}): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
|
|
251
|
+
getSponsorshipLink({ backUrl }: {
|
|
252
|
+
backUrl: string;
|
|
253
|
+
}): Promise<string | null>;
|
|
254
|
+
updateAutoDisconnectDelay({ id, delay }: {
|
|
252
255
|
id: string;
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
foldersId: string[];
|
|
256
|
-
parentFolderId?: string | null | undefined;
|
|
257
|
-
}): Promise<boolean>;
|
|
258
|
-
moveFiles({ filesId, parentFolderId }: {
|
|
259
|
-
filesId: string[];
|
|
260
|
-
parentFolderId?: string | null | undefined;
|
|
261
|
-
}): Promise<boolean>;
|
|
262
|
-
folderSize({ folderId }: {
|
|
263
|
-
folderId?: string | null | undefined;
|
|
264
|
-
}): Promise<FolderSize | null>;
|
|
256
|
+
delay: number | null;
|
|
257
|
+
}): Promise<SuccessResponse<boolean> | ErrorNotFound | ErrorAccessDenied | ErrorBasic | null>;
|
|
265
258
|
}
|
|
266
259
|
export {};
|