@secrecy/lib 1.0.0-dev.5 → 1.0.0-dev.50
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 -73
- 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 +102 -0
- package/{lib → dist}/client/helpers.d.ts +1 -1
- package/dist/client/helpers.js +114 -0
- package/dist/client/index.d.ts +163 -0
- package/dist/client/index.js +3209 -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 +56 -0
- package/dist/client/types/Node.js +3 -0
- package/dist/client/types/UserAppNotifications.d.ts +6 -0
- 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 +8 -13
- package/dist/client/types/index.js +8 -0
- package/dist/client/types/selectors.d.ts +400 -0
- package/dist/client/types/selectors.js +130 -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/dist/index.d.ts +12 -0
- 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/dist/worker/sodium.d.ts +3 -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 +1234 -0
- package/dist/zeus/index.d.ts +5893 -0
- package/dist/zeus/index.js +681 -0
- package/package.json +58 -51
- 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 -3699
- 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/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 -8
- 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.d.ts +0 -11
- 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.d.ts +0 -3
- package/lib/worker/sodium.js +0 -141
- package/lib/worker/workerCodes.js +0 -3
- package/lib/zeus/const.js +0 -1609
- package/lib/zeus/index.d.ts +0 -26113
- 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;
|
|
@@ -112,10 +123,6 @@ export declare type UserData<T extends Record<string, unknown> = Record<string,
|
|
|
112
123
|
isSuperuser: boolean;
|
|
113
124
|
isSearchable: boolean;
|
|
114
125
|
} & T;
|
|
115
|
-
export declare type FolderSize = {
|
|
116
|
-
size: bigint;
|
|
117
|
-
sizeBefore: bigint;
|
|
118
|
-
};
|
|
119
126
|
export declare type AppDBConfigField = {
|
|
120
127
|
name: string;
|
|
121
128
|
type: "string" | "number" | "boolean" | "object";
|
|
@@ -152,7 +159,7 @@ export declare type UserBase = {
|
|
|
152
159
|
role: UserRole;
|
|
153
160
|
firstname: string;
|
|
154
161
|
id: string;
|
|
155
|
-
deletedAt
|
|
162
|
+
deletedAt?: Date;
|
|
156
163
|
lastLogin: Date;
|
|
157
164
|
lang: Lang;
|
|
158
165
|
};
|
|
@@ -166,23 +173,24 @@ export declare type User<T extends WithPublicKey = WithPublicKey> = T extends {
|
|
|
166
173
|
} : UserBase;
|
|
167
174
|
declare type ClassGetUserParams = WithPublicKey & {
|
|
168
175
|
userId?: string;
|
|
176
|
+
userEmail?: string;
|
|
169
177
|
};
|
|
170
178
|
declare type StaticGetUserParams = ClassGetUserParams & {
|
|
171
179
|
env: SecrecyEnv;
|
|
172
180
|
};
|
|
173
181
|
export declare type CloudLimits = {
|
|
174
182
|
count: bigint;
|
|
175
|
-
maxCount
|
|
183
|
+
maxCount?: bigint | undefined;
|
|
176
184
|
size: bigint;
|
|
177
|
-
maxSize
|
|
185
|
+
maxSize?: bigint | undefined;
|
|
178
186
|
};
|
|
179
187
|
export declare type MailLimitsValues = {
|
|
180
188
|
count: bigint;
|
|
181
|
-
maxCount
|
|
189
|
+
maxCount?: bigint | undefined;
|
|
182
190
|
fileSize: bigint;
|
|
183
|
-
maxFileSize
|
|
191
|
+
maxFileSize?: bigint | undefined;
|
|
184
192
|
fileCount: bigint;
|
|
185
|
-
maxFileCount
|
|
193
|
+
maxFileCount?: bigint | undefined;
|
|
186
194
|
};
|
|
187
195
|
export declare type QueryLimits = {
|
|
188
196
|
cloud: CloudLimits;
|
|
@@ -197,70 +205,51 @@ export declare class BaseClient {
|
|
|
197
205
|
protected client: ReturnType<typeof Thunder>;
|
|
198
206
|
sessionId: string;
|
|
199
207
|
constructor(session: string, env: SecrecyEnv);
|
|
200
|
-
sessions(): Promise<UserSession[]>;
|
|
208
|
+
sessions(): Promise<SuccessResponse<UserSession[]> | ErrorNotFound | null>;
|
|
201
209
|
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
|
|
210
|
+
me<T extends WithPublicKey = WithPublicKey>(params?: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
211
|
+
static user<T extends StaticGetUserParams>(params: T, sessionId?: string | null | undefined): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
212
|
+
user<T extends ClassGetUserParams>(params: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
205
213
|
updateProfile({ firstname, lastname, lang }: {
|
|
206
214
|
firstname: string | null;
|
|
207
215
|
lastname: string | null;
|
|
208
216
|
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>;
|
|
217
|
+
}): Promise<SuccessResponse<User> | ErrorNotFound | ErrorAccessDenied | null>;
|
|
218
|
+
static plans(env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<Plan[]> | null>;
|
|
219
|
+
pay(planCode: SecrecyPlansCodes, input: PayInput, autoRenew?: boolean | null | undefined): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
|
|
220
|
+
cancelPayment(): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
|
|
221
|
+
paymentInfos(): Promise<SuccessResponse<PaymentInfos> | ErrorAccessDenied | null>;
|
|
222
|
+
limits(): Promise<SuccessResponse<QueryLimits> | ErrorAccessDenied | ErrorNotExist | ErrorLimit | ErrorNotFound | null>;
|
|
223
|
+
godFatherAndChildren(): Promise<SuccessResponse<GodFatherAndChildren> | ErrorNotFound | null>;
|
|
216
224
|
static updateAppDBConfig({ appCode, config, env, sessionId }: {
|
|
217
225
|
appCode: string;
|
|
218
226
|
config: AppDBConfig;
|
|
219
227
|
env: SecrecyEnv;
|
|
220
228
|
sessionId?: string | null | undefined;
|
|
221
|
-
}): Promise<AppDBConfig>;
|
|
222
|
-
static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<AppDBConfig>;
|
|
229
|
+
}): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | null>;
|
|
230
|
+
static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | ErrorNotFound | ErrorNotExist | null>;
|
|
223
231
|
static getFAQ({ lang, env, sessionId }: {
|
|
224
232
|
lang?: Lang;
|
|
225
233
|
env: SecrecyEnv;
|
|
226
234
|
sessionId?: string | null | undefined;
|
|
227
|
-
}): Promise<FaqItem[]>;
|
|
235
|
+
}): Promise<SuccessResponse<FaqItem[]> | ErrorAccessDenied | null>;
|
|
228
236
|
static getBlog({ env, lang, sessionId }: {
|
|
229
237
|
env: SecrecyEnv;
|
|
230
238
|
lang?: Lang | null | undefined;
|
|
231
239
|
sessionId?: string | null | undefined;
|
|
232
|
-
}): Promise<BlogItem[]>;
|
|
233
|
-
reportUser(reportedUserId: string, customMessage?: string): Promise<SendReport |
|
|
240
|
+
}): Promise<SuccessResponse<BlogItem[]> | ErrorLangNotExist | null>;
|
|
241
|
+
reportUser(reportedUserId: string, customMessage?: string): Promise<SuccessResponse<SendReport> | ErrorAccessDenied | ErrorNotFound | null>;
|
|
234
242
|
static deleteUser({ sessionId, userId, env }: {
|
|
235
243
|
sessionId: string;
|
|
236
244
|
userId?: string;
|
|
237
245
|
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 }: {
|
|
246
|
+
}): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
|
|
247
|
+
getSponsorshipLink({ backUrl }: {
|
|
248
|
+
backUrl: string;
|
|
249
|
+
}): Promise<string | null>;
|
|
250
|
+
updateAutoDisconnectDelay({ id, delay }: {
|
|
252
251
|
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>;
|
|
252
|
+
delay: number | null;
|
|
253
|
+
}): Promise<SuccessResponse<boolean> | ErrorNotFound | ErrorAccessDenied | ErrorBasic | null>;
|
|
265
254
|
}
|
|
266
255
|
export {};
|