@secrecy/lib 1.0.0 → 1.0.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/LICENSE +1 -1
- package/dist/BaseClient.d.ts +29 -177
- package/dist/BaseClient.js +114 -732
- package/dist/PopupTools.d.ts +4 -4
- package/dist/PopupTools.js +24 -41
- package/dist/ZeusThunder.js +3 -17
- package/dist/cache.js +1 -1
- package/dist/client/SecrecyAppClient.d.ts +17 -0
- package/dist/client/SecrecyAppClient.js +226 -0
- package/dist/client/SecrecyCloudClient.d.ts +89 -0
- package/dist/client/SecrecyCloudClient.js +1405 -0
- package/dist/client/SecrecyDbClient.d.ts +21 -0
- package/dist/client/SecrecyDbClient.js +177 -0
- package/dist/client/SecrecyMailClient.d.ts +42 -0
- package/dist/client/SecrecyMailClient.js +1022 -0
- package/dist/client/SecrecyPayClient.d.ts +28 -0
- package/dist/client/SecrecyPayClient.js +68 -0
- package/dist/client/SecrecyWalletClient.d.ts +30 -0
- package/dist/client/SecrecyWalletClient.js +73 -0
- package/dist/client/convert/file.js +2 -3
- package/dist/client/convert/mail.d.ts +2 -2
- package/dist/client/convert/mail.js +7 -11
- package/dist/client/convert/node.js +19 -33
- package/dist/client/helpers.d.ts +9 -4
- package/dist/client/helpers.js +30 -25
- package/dist/client/index.d.ts +15 -145
- package/dist/client/index.js +16 -3176
- package/dist/client/storage.js +4 -4
- package/dist/client/types/File.d.ts +3 -3
- package/dist/client/types/Inputs.d.ts +4 -4
- package/dist/client/types/Node.d.ts +21 -14
- package/dist/client/types/Node.js +1 -1
- package/dist/client/types/UserAppNotifications.d.ts +1 -1
- package/dist/client/types/UserAppSettings.d.ts +2 -3
- package/dist/client/types/UserAppSettings.js +1 -1
- package/dist/client/types/index.d.ts +23 -51
- package/dist/client/types/index.js +1 -1
- package/dist/client/types/selectors.d.ts +51 -127
- package/dist/client/types/selectors.js +21 -11
- package/dist/crypto/file.d.ts +2 -2
- package/dist/crypto/file.js +19 -34
- package/dist/crypto/index.js +1 -3
- package/dist/error.d.ts +5 -2
- package/dist/error.js +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +4 -4
- package/dist/minify/index.js +2 -7
- package/dist/minify/lz4.js +79 -167
- package/dist/sodium.js +1 -1
- package/dist/utils/store-buddy.d.ts +1 -1
- package/dist/utils/store-buddy.js +1 -8
- package/dist/utils/time.js +1 -3
- package/dist/utils/utils.js +1 -11
- package/dist/worker/md5.js +1 -2
- package/dist/worker/sodium.js +16 -18
- package/dist/worker/workerCodes.js +255 -3
- package/dist/zeus/const.js +476 -27
- package/dist/zeus/index.d.ts +4477 -605
- package/dist/zeus/index.js +181 -239
- package/package.json +64 -61
- package/dist/client/admin/index.d.ts +0 -11
- package/dist/client/admin/index.js +0 -110
- package/dist/worker/__mock__/sodium.worker.d.ts +0 -19
- package/dist/worker/__mock__/sodium.worker.js +0 -49
package/LICENSE
CHANGED
package/dist/BaseClient.d.ts
CHANGED
|
@@ -1,106 +1,14 @@
|
|
|
1
1
|
import type { DownloadProgress as DLProgress } from "ky";
|
|
2
|
-
import type { UserSession } from "./client/types/index.js";
|
|
3
2
|
import type { SecrecyEnv } from "./client/helpers.js";
|
|
4
|
-
import type {
|
|
5
|
-
import
|
|
6
|
-
|
|
3
|
+
import type { GraphQLTypes, Lang, Thunder, UserRole } from "./zeus/index.js";
|
|
4
|
+
import { InfuraNetwork } from "./zeus/index.js";
|
|
5
|
+
import type { ErrorAccessDenied, ErrorLimit, ErrorNotFound, ErrorNotExist } from "./error.js";
|
|
6
|
+
export type SuccessResponse<T> = {
|
|
7
7
|
__typename: "SuccessResponse";
|
|
8
8
|
data: T;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
type: PayInputType;
|
|
13
|
-
token: string;
|
|
14
|
-
firstName: string;
|
|
15
|
-
lastName: string;
|
|
16
|
-
street: string;
|
|
17
|
-
postalCode: string;
|
|
18
|
-
city: string;
|
|
19
|
-
country: string;
|
|
20
|
-
month: string;
|
|
21
|
-
year: string;
|
|
22
|
-
cvv: string;
|
|
23
|
-
number: string;
|
|
24
|
-
};
|
|
25
|
-
export declare type MailLimits = {
|
|
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;
|
|
33
|
-
};
|
|
34
|
-
export declare type Limits = {
|
|
35
|
-
downloadBandwidth?: bigint | undefined;
|
|
36
|
-
downloadCount?: bigint | undefined;
|
|
37
|
-
hardFileCount?: bigint | undefined;
|
|
38
|
-
hardFileSize?: bigint | undefined;
|
|
39
|
-
perFileSize?: bigint | undefined;
|
|
40
|
-
receivedMails: MailLimits;
|
|
41
|
-
sentMails: MailLimits;
|
|
42
|
-
uploadBandwidth?: bigint | undefined;
|
|
43
|
-
uploadCount?: bigint | undefined;
|
|
44
|
-
};
|
|
45
|
-
export declare type GodUser = {
|
|
46
|
-
id: string;
|
|
47
|
-
firstname: string;
|
|
48
|
-
lastname: string;
|
|
49
|
-
email: string;
|
|
50
|
-
phone: string;
|
|
51
|
-
};
|
|
52
|
-
export declare type GodFatherAndChildren = {
|
|
53
|
-
godFather: GodUser | null;
|
|
54
|
-
godChildren: GodUser[];
|
|
55
|
-
};
|
|
56
|
-
export declare type Plan = {
|
|
57
|
-
codes: string[];
|
|
58
|
-
kind: PlanKind;
|
|
59
|
-
limits: Limits;
|
|
60
|
-
};
|
|
61
|
-
export declare type SubscriptionState = "active" | "canceled" | "paused" | "expired" | "future" | "in_trial" | "live" | "past_due";
|
|
62
|
-
export declare type SubscriptionCollectionMethod = "automatic" | "manual";
|
|
63
|
-
declare type InternalSubscription = {
|
|
64
|
-
autorenew: boolean;
|
|
65
|
-
activatedAt?: Date | null | undefined;
|
|
66
|
-
currentPeriodEndsAt?: Date | null | undefined;
|
|
67
|
-
currentPeriodStartedAt?: Date | null | undefined;
|
|
68
|
-
canceledAt?: Date | null | undefined;
|
|
69
|
-
createdAt?: Date | null | undefined;
|
|
70
|
-
expiresAt?: Date | null | undefined;
|
|
71
|
-
pausedAt?: Date | null | undefined;
|
|
72
|
-
trialEndsAt?: Date | null | undefined;
|
|
73
|
-
trialStartedAt?: Date | null | undefined;
|
|
74
|
-
updatedAt?: Date | null | undefined;
|
|
75
|
-
collectionMethod: string;
|
|
76
|
-
state: string;
|
|
77
|
-
plan?: string | null | undefined;
|
|
78
|
-
planCode?: string | null | undefined;
|
|
79
|
-
total?: number | null | undefined;
|
|
80
|
-
};
|
|
81
|
-
declare type RecurlyInvoiceStatus = "pending" | "paid" | "failed" | "past_due" | "open" | "closed" | "voided" | "processing";
|
|
82
|
-
declare type InternalRecurlyInvoices = {
|
|
83
|
-
pdf: string;
|
|
84
|
-
date: Date;
|
|
85
|
-
due: Date;
|
|
86
|
-
status: string;
|
|
87
|
-
total: number;
|
|
88
|
-
name: string;
|
|
89
|
-
currency: string;
|
|
90
|
-
};
|
|
91
|
-
export declare type Subscription = InternalSubscription & {
|
|
92
|
-
collectionMethod: SubscriptionCollectionMethod;
|
|
93
|
-
state: SubscriptionState;
|
|
94
|
-
};
|
|
95
|
-
export declare type RecurlyInvoices = InternalRecurlyInvoices & {
|
|
96
|
-
status: RecurlyInvoiceStatus;
|
|
97
|
-
};
|
|
98
|
-
export declare type PaymentInfos = {
|
|
99
|
-
hostedUrl: string;
|
|
100
|
-
currentSubscription: Subscription;
|
|
101
|
-
invoices: RecurlyInvoices[];
|
|
102
|
-
};
|
|
103
|
-
export declare type SendReport = {
|
|
10
|
+
export type DownloadProgress = DLProgress;
|
|
11
|
+
export type SendReport = {
|
|
104
12
|
id: string;
|
|
105
13
|
user: {
|
|
106
14
|
id: string;
|
|
@@ -116,47 +24,11 @@ export declare type SendReport = {
|
|
|
116
24
|
};
|
|
117
25
|
customMessage?: string | undefined;
|
|
118
26
|
};
|
|
119
|
-
|
|
120
|
-
export declare type SecrecyPlansCodes = typeof plansCodes[number];
|
|
121
|
-
export declare function isValidPlan(planCode: string): planCode is SecrecyPlansCodes;
|
|
122
|
-
export declare type UserData<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
27
|
+
export type UserData<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
123
28
|
isSuperuser: boolean;
|
|
124
29
|
isSearchable: boolean;
|
|
125
30
|
} & T;
|
|
126
|
-
export
|
|
127
|
-
size: bigint;
|
|
128
|
-
sizeBefore: bigint;
|
|
129
|
-
};
|
|
130
|
-
export declare type AppDBConfigField = {
|
|
131
|
-
name: string;
|
|
132
|
-
type: "string" | "number" | "boolean" | "object";
|
|
133
|
-
isArray?: boolean | undefined;
|
|
134
|
-
isNullable?: boolean | undefined;
|
|
135
|
-
isEditable?: boolean | undefined;
|
|
136
|
-
isKey?: boolean | undefined;
|
|
137
|
-
default?: unknown;
|
|
138
|
-
};
|
|
139
|
-
export declare type AppDBConfig = {
|
|
140
|
-
fields: AppDBConfigField[];
|
|
141
|
-
};
|
|
142
|
-
export declare type FaqItem = {
|
|
143
|
-
order: number;
|
|
144
|
-
question: string;
|
|
145
|
-
answer: string;
|
|
146
|
-
};
|
|
147
|
-
export declare type BlogItem = {
|
|
148
|
-
id: string;
|
|
149
|
-
blogId: string;
|
|
150
|
-
order: number;
|
|
151
|
-
author: string;
|
|
152
|
-
body: string;
|
|
153
|
-
date: Date;
|
|
154
|
-
image: string;
|
|
155
|
-
imageAlt: string;
|
|
156
|
-
summary: string;
|
|
157
|
-
title: string;
|
|
158
|
-
};
|
|
159
|
-
export declare type UserBase = {
|
|
31
|
+
export type UserBase = {
|
|
160
32
|
email: string;
|
|
161
33
|
phone: string;
|
|
162
34
|
lastname: string;
|
|
@@ -167,28 +39,28 @@ export declare type UserBase = {
|
|
|
167
39
|
lastLogin: Date;
|
|
168
40
|
lang: Lang;
|
|
169
41
|
};
|
|
170
|
-
|
|
42
|
+
type WithPublicKey = {
|
|
171
43
|
withPublicKey?: boolean;
|
|
172
44
|
};
|
|
173
|
-
export
|
|
45
|
+
export type User<T extends WithPublicKey = WithPublicKey> = T extends {
|
|
174
46
|
withPublicKey: true;
|
|
175
47
|
} ? UserBase & {
|
|
176
48
|
publicKey: string;
|
|
177
49
|
} : UserBase;
|
|
178
|
-
|
|
50
|
+
type ClassGetUserParams = WithPublicKey & {
|
|
179
51
|
userId?: string;
|
|
180
52
|
userEmail?: string;
|
|
181
53
|
};
|
|
182
|
-
|
|
54
|
+
type StaticGetUserParams = ClassGetUserParams & {
|
|
183
55
|
env: SecrecyEnv;
|
|
184
56
|
};
|
|
185
|
-
export
|
|
57
|
+
export type CloudLimits = {
|
|
186
58
|
count: bigint;
|
|
187
59
|
maxCount?: bigint | undefined;
|
|
188
60
|
size: bigint;
|
|
189
61
|
maxSize?: bigint | undefined;
|
|
190
62
|
};
|
|
191
|
-
export
|
|
63
|
+
export type MailLimitsValues = {
|
|
192
64
|
count: bigint;
|
|
193
65
|
maxCount?: bigint | undefined;
|
|
194
66
|
fileSize: bigint;
|
|
@@ -196,7 +68,7 @@ export declare type MailLimitsValues = {
|
|
|
196
68
|
fileCount: bigint;
|
|
197
69
|
maxFileCount?: bigint | undefined;
|
|
198
70
|
};
|
|
199
|
-
export
|
|
71
|
+
export type QueryLimits = {
|
|
200
72
|
cloud: CloudLimits;
|
|
201
73
|
mail: {
|
|
202
74
|
sent: MailLimitsValues;
|
|
@@ -205,11 +77,10 @@ export declare type QueryLimits = {
|
|
|
205
77
|
};
|
|
206
78
|
export declare class BaseClient {
|
|
207
79
|
static readonly getBaseUrl: (env?: SecrecyEnv, graphcdn?: boolean) => string;
|
|
208
|
-
|
|
209
|
-
protected
|
|
80
|
+
static readonly getBaseClient: (env: SecrecyEnv, session?: string | null | undefined) => ReturnType<typeof Thunder>;
|
|
81
|
+
protected thunder: ReturnType<typeof Thunder>;
|
|
210
82
|
sessionId: string;
|
|
211
83
|
constructor(session: string, env: SecrecyEnv);
|
|
212
|
-
sessions(): Promise<SuccessResponse<UserSession[]> | ErrorNotFound | null>;
|
|
213
84
|
logout(sessionId?: string | null | undefined): Promise<void>;
|
|
214
85
|
me<T extends WithPublicKey = WithPublicKey>(params?: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
215
86
|
static user<T extends StaticGetUserParams>(params: T, sessionId?: string | null | undefined): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
|
|
@@ -219,41 +90,22 @@ export declare class BaseClient {
|
|
|
219
90
|
lastname: string | null;
|
|
220
91
|
lang: Lang | null;
|
|
221
92
|
}): Promise<SuccessResponse<User> | ErrorNotFound | ErrorAccessDenied | null>;
|
|
222
|
-
static
|
|
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>;
|
|
228
|
-
static updateAppDBConfig({ appCode, config, env, sessionId }: {
|
|
229
|
-
appCode: string;
|
|
230
|
-
config: AppDBConfig;
|
|
231
|
-
env: SecrecyEnv;
|
|
232
|
-
sessionId?: string | null | undefined;
|
|
233
|
-
}): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | null>;
|
|
234
|
-
static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | ErrorNotFound | ErrorNotExist | null>;
|
|
235
|
-
static getFAQ({ lang, env, sessionId }: {
|
|
236
|
-
lang?: Lang;
|
|
93
|
+
static isCryptoTransactionDone({ env, idOrHash, network }: {
|
|
237
94
|
env: SecrecyEnv;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
lang?: Lang | null | undefined;
|
|
243
|
-
sessionId?: string | null | undefined;
|
|
244
|
-
}): Promise<SuccessResponse<BlogItem[]> | ErrorLangNotExist | null>;
|
|
95
|
+
idOrHash: string;
|
|
96
|
+
network?: InfuraNetwork;
|
|
97
|
+
}): Promise<boolean>;
|
|
98
|
+
limits(): Promise<SuccessResponse<QueryLimits> | ErrorAccessDenied | ErrorNotExist | ErrorLimit | ErrorNotFound | null>;
|
|
245
99
|
reportUser(reportedUserId: string, customMessage?: string): Promise<SuccessResponse<SendReport> | ErrorAccessDenied | ErrorNotFound | null>;
|
|
246
|
-
static deleteUser({ sessionId, userId, env }: {
|
|
247
|
-
sessionId: string;
|
|
248
|
-
userId?: string;
|
|
249
|
-
env: SecrecyEnv;
|
|
250
|
-
}): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
|
|
251
100
|
getSponsorshipLink({ backUrl }: {
|
|
252
101
|
backUrl: string;
|
|
253
102
|
}): Promise<string | null>;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
103
|
+
static getPaymentRequest: ({ env, paymentRequestId, secrecyIdSeller, secrecyId, appCode }: {
|
|
104
|
+
env: SecrecyEnv;
|
|
105
|
+
paymentRequestId: string;
|
|
106
|
+
secrecyIdSeller: string;
|
|
107
|
+
secrecyId?: string | undefined;
|
|
108
|
+
appCode?: string | undefined;
|
|
109
|
+
}) => Promise<SuccessResponse<GraphQLTypes["GetPaymentRequestToPay"]> | ErrorAccessDenied | ErrorNotFound>;
|
|
258
110
|
}
|
|
259
111
|
export {};
|