@secrecy/lib 1.0.0-dev.26 → 1.0.0-dev.29

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.
Files changed (155) hide show
  1. package/dist/BaseClient.d.ts +274 -0
  2. package/dist/BaseClient.js +2227 -0
  3. package/dist/PopupTools.d.ts +17 -0
  4. package/dist/PopupTools.js +213 -0
  5. package/dist/ZeusThunder.d.ts +2 -0
  6. package/dist/ZeusThunder.js +113 -0
  7. package/dist/cache.d.ts +7 -0
  8. package/dist/cache.js +5 -0
  9. package/dist/client/admin/index.d.ts +11 -0
  10. package/dist/client/admin/index.js +198 -0
  11. package/dist/client/convert/file.d.ts +5 -0
  12. package/dist/client/convert/file.js +39 -0
  13. package/dist/client/convert/folder.d.ts +8 -0
  14. package/dist/client/convert/folder.js +264 -0
  15. package/dist/client/convert/mail.d.ts +3 -0
  16. package/dist/client/convert/mail.js +46 -0
  17. package/dist/client/convert/vFile.d.ts +5 -0
  18. package/dist/client/convert/vFile.js +164 -0
  19. package/dist/client/helpers.d.ts +23 -0
  20. package/dist/client/helpers.js +114 -0
  21. package/dist/client/index.d.ts +172 -0
  22. package/dist/client/index.js +6181 -0
  23. package/dist/client/storage.d.ts +7 -0
  24. package/dist/client/storage.js +12 -0
  25. package/dist/client/types/File.d.ts +21 -0
  26. package/dist/client/types/File.js +3 -0
  27. package/dist/client/types/FilesOnUsersOnApplications.d.ts +9 -0
  28. package/dist/client/types/FilesOnUsersOnApplications.js +3 -0
  29. package/dist/client/types/Folder.d.ts +68 -0
  30. package/dist/client/types/Folder.js +7 -0
  31. package/dist/client/types/Inputs.d.ts +21 -0
  32. package/dist/client/types/Inputs.js +3 -0
  33. package/dist/client/types/UserAppNotifications.d.ts +6 -0
  34. package/dist/client/types/UserAppNotifications.js +3 -0
  35. package/dist/client/types/UserAppSettings.d.ts +7 -0
  36. package/dist/client/types/UserAppSettings.js +3 -0
  37. package/dist/client/types/VFile.d.ts +62 -0
  38. package/dist/client/types/VFile.js +4 -0
  39. package/dist/client/types/index.d.ts +154 -0
  40. package/dist/client/types/index.js +10 -0
  41. package/dist/client/types/queries.d.ts +535 -0
  42. package/dist/client/types/queries.js +192 -0
  43. package/dist/crypto/file.d.ts +14 -0
  44. package/dist/crypto/file.js +291 -0
  45. package/dist/crypto/index.d.ts +12 -0
  46. package/dist/crypto/index.js +45 -0
  47. package/dist/error.d.ts +30 -0
  48. package/dist/error.js +3 -0
  49. package/dist/index.d.ts +13 -3857
  50. package/dist/index.js +42 -255
  51. package/dist/minify/index.d.ts +2 -0
  52. package/dist/minify/index.js +28 -0
  53. package/dist/minify/lz4.d.ts +5 -0
  54. package/dist/minify/lz4.js +633 -0
  55. package/dist/sodium.d.ts +3 -0
  56. package/dist/sodium.js +28 -0
  57. package/dist/utils/store-buddy.d.ts +14 -0
  58. package/dist/utils/store-buddy.js +69 -0
  59. package/dist/utils/time.d.ts +10 -0
  60. package/dist/utils/time.js +22 -0
  61. package/dist/utils.d.ts +4 -0
  62. package/dist/utils.js +188 -0
  63. package/dist/worker/__mock__/sodium.worker.d.ts +19 -0
  64. package/dist/worker/__mock__/sodium.worker.js +46 -0
  65. package/dist/worker/md5.d.ts +1 -0
  66. package/dist/worker/md5.js +43 -0
  67. package/dist/worker/sodium.d.ts +3 -0
  68. package/dist/worker/sodium.js +155 -0
  69. package/dist/worker/workerCodes.d.ts +2 -0
  70. package/dist/worker/workerCodes.js +3 -0
  71. package/dist/zeus/const.d.ts +2 -0
  72. package/dist/zeus/const.js +2267 -0
  73. package/dist/zeus/index.d.ts +4043 -0
  74. package/dist/zeus/index.js +549 -0
  75. package/package.json +24 -16
  76. package/CHANGELOG.md +0 -178
  77. package/__tests__/client/client.test.ts +0 -81
  78. package/__tests__/client/folder.test.ts +0 -302
  79. package/__tests__/client/mail.test.ts +0 -476
  80. package/__tests__/client/timing.test.ts +0 -35
  81. package/__tests__/client/utils.ts +0 -41
  82. package/__tests__/client/vFile.test.ts +0 -207
  83. package/__tests__/index.test.ts +0 -171
  84. package/commitlint.config.cjs +0 -3
  85. package/dist/index.js.map +0 -1
  86. package/dist/index.mjs +0 -255
  87. package/dist/index.mjs.map +0 -1
  88. package/docs/assets/css/main.css +0 -2660
  89. package/docs/assets/images/icons.png +0 -0
  90. package/docs/assets/images/icons@2x.png +0 -0
  91. package/docs/assets/images/widgets.png +0 -0
  92. package/docs/assets/images/widgets@2x.png +0 -0
  93. package/docs/assets/js/main.js +0 -248
  94. package/docs/assets/js/search.js +0 -1
  95. package/docs/classes/baseclient.baseclient-1.html +0 -1165
  96. package/docs/classes/client.secrecyclient.html +0 -2527
  97. package/docs/enums/index.sodium.base64_variants.html +0 -205
  98. package/docs/index.html +0 -198
  99. package/docs/interfaces/client_types.draftmail.html +0 -335
  100. package/docs/interfaces/client_types.filecontentbase.html +0 -231
  101. package/docs/interfaces/client_types.filecontentcloud.html +0 -244
  102. package/docs/interfaces/client_types.filecontentreceivedmail.html +0 -244
  103. package/docs/interfaces/client_types.filecontentsentmail.html +0 -230
  104. package/docs/interfaces/client_types.receivedmail.html +0 -363
  105. package/docs/interfaces/client_types.sentmail.html +0 -335
  106. package/docs/interfaces/crypto.keypair.html +0 -202
  107. package/docs/interfaces/index.sodium.cryptobox.html +0 -185
  108. package/docs/interfaces/index.sodium.cryptokx.html +0 -185
  109. package/docs/interfaces/index.sodium.keypair.html +0 -199
  110. package/docs/interfaces/index.sodium.messagetag.html +0 -185
  111. package/docs/interfaces/index.sodium.secretbox.html +0 -185
  112. package/docs/interfaces/index.sodium.stateaddress.html +0 -171
  113. package/docs/interfaces/index.sodium.stringcryptobox.html +0 -185
  114. package/docs/interfaces/index.sodium.stringcryptokx.html +0 -185
  115. package/docs/interfaces/index.sodium.stringkeypair.html +0 -199
  116. package/docs/interfaces/index.sodium.stringmessagetag.html +0 -185
  117. package/docs/interfaces/index.sodium.stringsecretbox.html +0 -185
  118. package/docs/interfaces/utils_store_buddy.storebuddy.html +0 -333
  119. package/docs/modules/baseclient.html +0 -929
  120. package/docs/modules/cache.html +0 -185
  121. package/docs/modules/client.html +0 -207
  122. package/docs/modules/client_convert_file.html +0 -216
  123. package/docs/modules/client_convert_folder.html +0 -303
  124. package/docs/modules/client_convert_vfile.html +0 -216
  125. package/docs/modules/client_helpers.html +0 -311
  126. package/docs/modules/client_storage.html +0 -167
  127. package/docs/modules/client_types.html +0 -1227
  128. package/docs/modules/client_types_file.html +0 -233
  129. package/docs/modules/client_types_filesonusersonapplications.html +0 -168
  130. package/docs/modules/client_types_folder.html +0 -383
  131. package/docs/modules/client_types_inputs.html +0 -263
  132. package/docs/modules/client_types_mail.html +0 -181
  133. package/docs/modules/client_types_queries.html +0 -199
  134. package/docs/modules/client_types_userappsettings.html +0 -163
  135. package/docs/modules/client_types_vfile.html +0 -364
  136. package/docs/modules/crypto.html +0 -366
  137. package/docs/modules/crypto_file.html +0 -344
  138. package/docs/modules/index.html +0 -779
  139. package/docs/modules/index.sodium.html +0 -6039
  140. package/docs/modules/minify.html +0 -183
  141. package/docs/modules/minify_lz4.html +0 -279
  142. package/docs/modules/popuptools.html +0 -259
  143. package/docs/modules/sodium.html +0 -167
  144. package/docs/modules/utils.html +0 -219
  145. package/docs/modules/utils_store_buddy.html +0 -208
  146. package/docs/modules/utils_time.html +0 -330
  147. package/docs/modules/worker_md5.html +0 -156
  148. package/docs/modules/worker_sodium.html +0 -231
  149. package/docs/modules/worker_workercodes.html +0 -157
  150. package/docs/modules.html +0 -235
  151. package/index.html +0 -21
  152. package/jest.config.ts +0 -27
  153. package/jest.setup.ts +0 -6
  154. package/release.config.cjs +0 -15
  155. package/tsup.config.ts +0 -23
@@ -0,0 +1,274 @@
1
+ import type { DownloadProgress as DLProgress } from "ky";
2
+ import type { Document } from "bson";
3
+ import type { UserSession } from "./client/types/index.js";
4
+ import type { SecrecyEnv } from "./client/helpers.js";
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
+ };
11
+ export declare type DownloadProgress = DLProgress;
12
+ export declare type PayInput = {
13
+ type: PayInputType;
14
+ token: string;
15
+ firstName: string;
16
+ lastName: string;
17
+ street: string;
18
+ postalCode: string;
19
+ city: string;
20
+ country: string;
21
+ month: string;
22
+ year: string;
23
+ cvv: string;
24
+ number: string;
25
+ };
26
+ export declare type MailLimits = {
27
+ count?: string | undefined;
28
+ fileCount?: string | undefined;
29
+ fileSize?: string | undefined;
30
+ hardCount?: string | undefined;
31
+ hardFileCount?: string | undefined;
32
+ hardFileSize?: string | undefined;
33
+ perFileSize?: string | undefined;
34
+ };
35
+ export declare type Limits = {
36
+ downloadBandwidth?: string | undefined;
37
+ downloadCount?: string | undefined;
38
+ hardFileCount?: string | undefined;
39
+ hardFileSize?: string | undefined;
40
+ perFileSize?: string | undefined;
41
+ receivedMails: MailLimits;
42
+ sentMails: MailLimits;
43
+ uploadBandwidth?: string | undefined;
44
+ uploadCount?: string | undefined;
45
+ };
46
+ export declare type GodUser = {
47
+ id: string;
48
+ firstname: string;
49
+ lastname: string;
50
+ email: string;
51
+ phone: string;
52
+ };
53
+ export declare type GodFatherAndChildren = {
54
+ godFather: GodUser | null;
55
+ godChildren: GodUser[];
56
+ };
57
+ export declare type Plan = {
58
+ codes: string[];
59
+ kind: PlanKind;
60
+ limits: Limits;
61
+ };
62
+ export declare type SubscriptionState = "active" | "canceled" | "paused" | "expired" | "future" | "in_trial" | "live" | "past_due";
63
+ export declare type SubscriptionCollectionMethod = "automatic" | "manual";
64
+ declare type RecurlyInvoiceStatus = "pending" | "paid" | "failed" | "past_due" | "open" | "closed" | "voided" | "processing";
65
+ export declare type Subscription = {
66
+ autorenew: boolean;
67
+ activatedAt?: Date | null | undefined;
68
+ currentPeriodEndsAt?: Date | null | undefined;
69
+ currentPeriodStartedAt?: Date | null | undefined;
70
+ canceledAt?: Date | null | undefined;
71
+ createdAt?: Date | null | undefined;
72
+ expiresAt?: Date | null | undefined;
73
+ pausedAt?: Date | null | undefined;
74
+ trialEndsAt?: Date | null | undefined;
75
+ trialStartedAt?: Date | null | undefined;
76
+ updatedAt?: Date | null | undefined;
77
+ collectionMethod: SubscriptionCollectionMethod;
78
+ state: SubscriptionState;
79
+ plan?: string | null | undefined;
80
+ planCode?: string | null | undefined;
81
+ total?: number | null | undefined;
82
+ };
83
+ export declare type RecurlyInvoices = {
84
+ pdf: string;
85
+ date: Date;
86
+ due: Date;
87
+ status: RecurlyInvoiceStatus;
88
+ total: number;
89
+ name: string;
90
+ currency: string;
91
+ };
92
+ export declare type PaymentInfos = {
93
+ hostedUrl: string;
94
+ currentSubscription: Subscription;
95
+ invoices: RecurlyInvoices[];
96
+ };
97
+ export declare type SendReport = {
98
+ id: string;
99
+ user: {
100
+ id: string;
101
+ firstname: string;
102
+ lastname: string;
103
+ email: string;
104
+ };
105
+ reportedUser: {
106
+ id: string;
107
+ firstname: string;
108
+ lastname: string;
109
+ email: string;
110
+ };
111
+ customMessage?: string | undefined;
112
+ };
113
+ declare const plansCodes: readonly ["basic_month", "advanced_month", "pro_month", "basic_year", "advanced_year", "pro_year"];
114
+ export declare type SecrecyPlansCodes = typeof plansCodes[number];
115
+ export declare function isValidPlan(planCode: string): planCode is SecrecyPlansCodes;
116
+ export declare type UserData<T extends Record<string, unknown> = Record<string, unknown>> = {
117
+ isSuperuser: boolean;
118
+ isSearchable: boolean;
119
+ } & T;
120
+ export declare type FolderSize = {
121
+ size: bigint;
122
+ sizeBefore: bigint;
123
+ };
124
+ export declare type AppDBConfigField = {
125
+ name: string;
126
+ type: "string" | "number" | "boolean" | "object";
127
+ isArray?: boolean | undefined;
128
+ isNullable?: boolean | undefined;
129
+ isEditable?: boolean | undefined;
130
+ isKey?: boolean | undefined;
131
+ default?: unknown;
132
+ };
133
+ export declare type AppDBConfig = {
134
+ fields: AppDBConfigField[];
135
+ };
136
+ export declare type FaqItem = {
137
+ order: number;
138
+ question: string;
139
+ answer: string;
140
+ };
141
+ export declare type BlogItem = {
142
+ id: string;
143
+ blogId: string;
144
+ order: number;
145
+ author: string;
146
+ body: string;
147
+ date: Date;
148
+ image: string;
149
+ imageAlt: string;
150
+ summary: string;
151
+ title: string;
152
+ };
153
+ export declare type UserBase = {
154
+ email: string;
155
+ phone: string;
156
+ lastname: string;
157
+ role: UserRole;
158
+ firstname: string;
159
+ id: string;
160
+ deletedAt: Date | null;
161
+ lastLogin: Date;
162
+ lang: Lang;
163
+ };
164
+ declare type WithPublicKey = {
165
+ withPublicKey?: boolean;
166
+ };
167
+ export declare type User<T extends WithPublicKey = WithPublicKey> = T extends {
168
+ withPublicKey: true;
169
+ } ? UserBase & {
170
+ publicKey: string;
171
+ } : UserBase;
172
+ declare type ClassGetUserParams = WithPublicKey & {
173
+ userId?: string;
174
+ };
175
+ declare type StaticGetUserParams = ClassGetUserParams & {
176
+ env: SecrecyEnv;
177
+ };
178
+ export declare type CloudLimits = {
179
+ count: bigint;
180
+ maxCount: bigint | null;
181
+ size: bigint;
182
+ maxSize: bigint | null;
183
+ };
184
+ export declare type MailLimitsValues = {
185
+ count: bigint;
186
+ maxCount: bigint | null;
187
+ fileSize: bigint;
188
+ maxFileSize: bigint | null;
189
+ fileCount: bigint;
190
+ maxFileCount: bigint | null;
191
+ };
192
+ export declare type QueryLimits = {
193
+ cloud: CloudLimits;
194
+ mail: {
195
+ sent: MailLimitsValues;
196
+ received: MailLimitsValues;
197
+ };
198
+ };
199
+ export declare class BaseClient {
200
+ static readonly getBaseUrl: (env?: SecrecyEnv, graphcdn?: boolean) => string;
201
+ private static readonly _getBaseClient;
202
+ protected client: ReturnType<typeof Thunder>;
203
+ sessionId: string;
204
+ constructor(session: string, env: SecrecyEnv);
205
+ sessions(): Promise<SuccessResponse<UserSession[]> | ErrorNotFound | null>;
206
+ logout(sessionId?: string | null | undefined): Promise<void>;
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>;
210
+ updateProfile({ firstname, lastname, lang }: {
211
+ firstname: string | null;
212
+ lastname: string | null;
213
+ lang: Lang | null;
214
+ }): Promise<SuccessResponse<User> | ErrorNotFound | ErrorAccessDenied | null>;
215
+ static plans(env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<Plan[]> | null>;
216
+ pay(planCode: SecrecyPlansCodes, input: PayInput, autoRenew?: boolean | null | undefined): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
217
+ cancelPayment(): Promise<SuccessResponse<boolean> | ErrorAccessDenied | 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>;
221
+ static updateAppDBConfig({ appCode, config, env, sessionId }: {
222
+ appCode: string;
223
+ config: AppDBConfig;
224
+ env: SecrecyEnv;
225
+ sessionId?: string | null | undefined;
226
+ }): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | null>;
227
+ static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | ErrorNotFound | ErrorNotExist | null>;
228
+ static getFAQ({ lang, env, sessionId }: {
229
+ lang?: Lang;
230
+ env: SecrecyEnv;
231
+ sessionId?: string | null | undefined;
232
+ }): Promise<SuccessResponse<FaqItem[]> | ErrorAccessDenied | null>;
233
+ static getBlog({ env, lang, sessionId }: {
234
+ env: SecrecyEnv;
235
+ lang?: Lang | null | undefined;
236
+ sessionId?: string | null | undefined;
237
+ }): Promise<SuccessResponse<BlogItem[]> | ErrorLangNotExist | null>;
238
+ reportUser(reportedUserId: string, customMessage?: string): Promise<SuccessResponse<SendReport> | ErrorAccessDenied | ErrorNotFound | null>;
239
+ static deleteUser({ sessionId, userId, env }: {
240
+ sessionId: string;
241
+ userId?: string;
242
+ env: SecrecyEnv;
243
+ }): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
244
+ dbGet<U>({ field, userId }: {
245
+ field: string;
246
+ userId?: string | null | undefined;
247
+ }): Promise<SuccessResponse<U> | ErrorAccessDenied | ErrorNotExist | ErrorNotFound | null>;
248
+ dbSet<T extends UserData, U extends Document>({ value, userId }: {
249
+ value: U;
250
+ userId?: string | null | undefined;
251
+ }): Promise<SuccessResponse<T> | ErrorAccessDenied | ErrorNotFound | null>;
252
+ dbSearch<T>({ search, field }: {
253
+ field: string;
254
+ search: string;
255
+ }): Promise<SuccessResponse<T[]> | ErrorAccessDenied | ErrorBasic | ErrorNotExist | null>;
256
+ deleteFolder({ id }: {
257
+ id: string;
258
+ }): Promise<SuccessResponse<boolean> | ErrorNotExist | ErrorAccessDenied | null>;
259
+ moveFolders({ foldersId, parentFolderId }: {
260
+ foldersId: string[];
261
+ parentFolderId?: string | null | undefined;
262
+ }): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
263
+ moveFiles({ filesId, parentFolderId }: {
264
+ filesId: string[];
265
+ parentFolderId?: string | null | undefined;
266
+ }): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
267
+ folderSize({ folderId }: {
268
+ folderId?: string | null | undefined;
269
+ }): Promise<SuccessResponse<FolderSize> | ErrorAccessDenied | null>;
270
+ getSponsorshipLink({ backUrl }: {
271
+ backUrl: string;
272
+ }): Promise<string | null>;
273
+ }
274
+ export {};