@secrecy/lib 1.0.0-dev.18 → 1.0.0-dev.21
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 -0
- package/lib/BaseClient.d.ts +20 -15
- package/lib/BaseClient.js +726 -265
- package/lib/ZeusThunder.js +3 -6
- package/lib/client/admin/index.d.ts +3 -2
- package/lib/client/admin/index.js +44 -33
- package/lib/client/index.d.ts +24 -21
- package/lib/client/index.js +1280 -561
- package/lib/error.d.ts +30 -0
- package/lib/error.js +3 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -2
- package/lib/zeus/const.js +957 -733
- package/lib/zeus/index.d.ts +2018 -32522
- package/lib/zeus/index.js +34 -43
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/BaseClient.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import type { Document } from "bson";
|
|
|
3
3
|
import type { UserSession } from "./client/types/index.js";
|
|
4
4
|
import type { SecrecyEnv } from "./client/helpers.js";
|
|
5
5
|
import type { Lang, PayInputType, PlanKind, Thunder, UserRole } from "./zeus/index.js";
|
|
6
|
+
import type { ErrorAccessDenied, ErrorLimit, ErrorNotFound, ErrorNotExist, ErrorLangNotExist, ErrorBasic } from "./error.js";
|
|
7
|
+
export declare type SuccessResponse<T> = {
|
|
8
|
+
__typename: "SuccessResponse";
|
|
9
|
+
data: T;
|
|
10
|
+
};
|
|
6
11
|
export declare type DownloadProgress = DLProgress;
|
|
7
12
|
export declare type PayInput = {
|
|
8
13
|
type: PayInputType;
|
|
@@ -197,39 +202,39 @@ export declare class BaseClient {
|
|
|
197
202
|
protected client: ReturnType<typeof Thunder>;
|
|
198
203
|
sessionId: string;
|
|
199
204
|
constructor(session: string, env: SecrecyEnv);
|
|
200
|
-
sessions(): Promise<UserSession[]>;
|
|
205
|
+
sessions(): Promise<SuccessResponse<UserSession[]> | ErrorNotFound | null>;
|
|
201
206
|
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
|
|
207
|
+
me<T extends WithPublicKey = WithPublicKey>(params?: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
208
|
+
static user<T extends StaticGetUserParams>(params: T, sessionId?: string | null | undefined): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
209
|
+
user<T extends ClassGetUserParams>(params: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
205
210
|
updateProfile({ firstname, lastname, lang }: {
|
|
206
211
|
firstname: string | null;
|
|
207
212
|
lastname: string | null;
|
|
208
213
|
lang: Lang | null;
|
|
209
214
|
}): Promise<User>;
|
|
210
|
-
static plans(env: SecrecyEnv, sessionId?: string | null | undefined): Promise<Plan[]>;
|
|
215
|
+
static plans(env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<Plan[]> | null>;
|
|
211
216
|
pay(planCode: SecrecyPlansCodes, input: PayInput, autoRenew?: boolean | null | undefined): Promise<boolean>;
|
|
212
217
|
cancelPayment(): Promise<boolean>;
|
|
213
|
-
paymentInfos(): Promise<PaymentInfos | null>;
|
|
214
|
-
limits(): Promise<QueryLimits | null>;
|
|
215
|
-
godFatherAndChildren(): Promise<GodFatherAndChildren | null>;
|
|
218
|
+
paymentInfos(): Promise<SuccessResponse<PaymentInfos> | ErrorAccessDenied | null>;
|
|
219
|
+
limits(): Promise<SuccessResponse<QueryLimits> | ErrorAccessDenied | ErrorNotExist | ErrorLimit | ErrorNotFound | null>;
|
|
220
|
+
godFatherAndChildren(): Promise<SuccessResponse<GodFatherAndChildren> | ErrorNotFound | null>;
|
|
216
221
|
static updateAppDBConfig({ appCode, config, env, sessionId }: {
|
|
217
222
|
appCode: string;
|
|
218
223
|
config: AppDBConfig;
|
|
219
224
|
env: SecrecyEnv;
|
|
220
225
|
sessionId?: string | null | undefined;
|
|
221
226
|
}): Promise<AppDBConfig>;
|
|
222
|
-
static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<AppDBConfig>;
|
|
227
|
+
static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | ErrorNotFound | ErrorNotExist | null>;
|
|
223
228
|
static getFAQ({ lang, env, sessionId }: {
|
|
224
229
|
lang?: Lang;
|
|
225
230
|
env: SecrecyEnv;
|
|
226
231
|
sessionId?: string | null | undefined;
|
|
227
|
-
}): Promise<FaqItem[]>;
|
|
232
|
+
}): Promise<SuccessResponse<FaqItem[]> | ErrorAccessDenied | null>;
|
|
228
233
|
static getBlog({ env, lang, sessionId }: {
|
|
229
234
|
env: SecrecyEnv;
|
|
230
235
|
lang?: Lang | null | undefined;
|
|
231
236
|
sessionId?: string | null | undefined;
|
|
232
|
-
}): Promise<BlogItem[]>;
|
|
237
|
+
}): Promise<SuccessResponse<BlogItem[]> | ErrorLangNotExist | null>;
|
|
233
238
|
reportUser(reportedUserId: string, customMessage?: string): Promise<SendReport | undefined>;
|
|
234
239
|
static deleteUser({ sessionId, userId, env }: {
|
|
235
240
|
sessionId: string;
|
|
@@ -239,7 +244,7 @@ export declare class BaseClient {
|
|
|
239
244
|
dbGet<U>({ field, userId }: {
|
|
240
245
|
field: string;
|
|
241
246
|
userId?: string | null | undefined;
|
|
242
|
-
}): Promise<U>;
|
|
247
|
+
}): Promise<SuccessResponse<U> | ErrorAccessDenied | ErrorNotExist | ErrorNotFound | null>;
|
|
243
248
|
dbSet<T extends UserData, U extends Document>({ value, userId }: {
|
|
244
249
|
value: U;
|
|
245
250
|
userId?: string | null | undefined;
|
|
@@ -247,7 +252,7 @@ export declare class BaseClient {
|
|
|
247
252
|
dbSearch<T>({ search, field }: {
|
|
248
253
|
field: string;
|
|
249
254
|
search: string;
|
|
250
|
-
}): Promise<T[]>;
|
|
255
|
+
}): Promise<SuccessResponse<T[]> | ErrorAccessDenied | ErrorBasic | ErrorNotExist | null>;
|
|
251
256
|
deleteFolder({ id }: {
|
|
252
257
|
id: string;
|
|
253
258
|
}): Promise<boolean>;
|
|
@@ -261,9 +266,9 @@ export declare class BaseClient {
|
|
|
261
266
|
}): Promise<boolean>;
|
|
262
267
|
folderSize({ folderId }: {
|
|
263
268
|
folderId?: string | null | undefined;
|
|
264
|
-
}): Promise<FolderSize | null>;
|
|
269
|
+
}): Promise<SuccessResponse<FolderSize> | ErrorAccessDenied | null>;
|
|
265
270
|
getSponsorshipLink({ backUrl }: {
|
|
266
271
|
backUrl: string;
|
|
267
|
-
}): Promise<string | null>;
|
|
272
|
+
}): Promise<string | ErrorNotFound | null>;
|
|
268
273
|
}
|
|
269
274
|
export {};
|