@secrecy/lib 1.0.0-dev.24 → 1.0.0-dev.27

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/__tests__/client/client.test.ts +81 -0
  2. package/__tests__/client/folder.test.ts +302 -0
  3. package/__tests__/client/mail.test.ts +476 -0
  4. package/__tests__/client/timing.test.ts +35 -0
  5. package/__tests__/client/utils.ts +41 -0
  6. package/__tests__/client/vFile.test.ts +207 -0
  7. package/__tests__/index.test.ts +171 -0
  8. package/commitlint.config.cjs +3 -0
  9. package/{lib/zeus → dist}/index.d.ts +729 -915
  10. package/dist/index.js +255 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/index.mjs +255 -0
  13. package/dist/index.mjs.map +1 -0
  14. package/docs/assets/css/main.css +2660 -0
  15. package/docs/assets/images/icons.png +0 -0
  16. package/docs/assets/images/icons@2x.png +0 -0
  17. package/docs/assets/images/widgets.png +0 -0
  18. package/docs/assets/images/widgets@2x.png +0 -0
  19. package/docs/assets/js/main.js +248 -0
  20. package/docs/assets/js/search.js +1 -0
  21. package/docs/classes/baseclient.baseclient-1.html +1165 -0
  22. package/docs/classes/client.secrecyclient.html +2527 -0
  23. package/docs/enums/index.sodium.base64_variants.html +205 -0
  24. package/docs/index.html +198 -0
  25. package/docs/interfaces/client_types.draftmail.html +335 -0
  26. package/docs/interfaces/client_types.filecontentbase.html +231 -0
  27. package/docs/interfaces/client_types.filecontentcloud.html +244 -0
  28. package/docs/interfaces/client_types.filecontentreceivedmail.html +244 -0
  29. package/docs/interfaces/client_types.filecontentsentmail.html +230 -0
  30. package/docs/interfaces/client_types.receivedmail.html +363 -0
  31. package/docs/interfaces/client_types.sentmail.html +335 -0
  32. package/docs/interfaces/crypto.keypair.html +202 -0
  33. package/docs/interfaces/index.sodium.cryptobox.html +185 -0
  34. package/docs/interfaces/index.sodium.cryptokx.html +185 -0
  35. package/docs/interfaces/index.sodium.keypair.html +199 -0
  36. package/docs/interfaces/index.sodium.messagetag.html +185 -0
  37. package/docs/interfaces/index.sodium.secretbox.html +185 -0
  38. package/docs/interfaces/index.sodium.stateaddress.html +171 -0
  39. package/docs/interfaces/index.sodium.stringcryptobox.html +185 -0
  40. package/docs/interfaces/index.sodium.stringcryptokx.html +185 -0
  41. package/docs/interfaces/index.sodium.stringkeypair.html +199 -0
  42. package/docs/interfaces/index.sodium.stringmessagetag.html +185 -0
  43. package/docs/interfaces/index.sodium.stringsecretbox.html +185 -0
  44. package/docs/interfaces/utils_store_buddy.storebuddy.html +333 -0
  45. package/docs/modules/baseclient.html +929 -0
  46. package/docs/modules/cache.html +185 -0
  47. package/docs/modules/client.html +207 -0
  48. package/docs/modules/client_convert_file.html +216 -0
  49. package/docs/modules/client_convert_folder.html +303 -0
  50. package/docs/modules/client_convert_vfile.html +216 -0
  51. package/docs/modules/client_helpers.html +311 -0
  52. package/docs/modules/client_storage.html +167 -0
  53. package/docs/modules/client_types.html +1227 -0
  54. package/docs/modules/client_types_file.html +233 -0
  55. package/docs/modules/client_types_filesonusersonapplications.html +168 -0
  56. package/docs/modules/client_types_folder.html +383 -0
  57. package/docs/modules/client_types_inputs.html +263 -0
  58. package/docs/modules/client_types_mail.html +181 -0
  59. package/docs/modules/client_types_queries.html +199 -0
  60. package/docs/modules/client_types_userappsettings.html +163 -0
  61. package/docs/modules/client_types_vfile.html +364 -0
  62. package/docs/modules/crypto.html +366 -0
  63. package/docs/modules/crypto_file.html +344 -0
  64. package/docs/modules/index.html +779 -0
  65. package/docs/modules/index.sodium.html +6039 -0
  66. package/docs/modules/minify.html +183 -0
  67. package/docs/modules/minify_lz4.html +279 -0
  68. package/docs/modules/popuptools.html +259 -0
  69. package/docs/modules/sodium.html +167 -0
  70. package/docs/modules/utils.html +219 -0
  71. package/docs/modules/utils_store_buddy.html +208 -0
  72. package/docs/modules/utils_time.html +330 -0
  73. package/docs/modules/worker_md5.html +156 -0
  74. package/docs/modules/worker_sodium.html +231 -0
  75. package/docs/modules/worker_workercodes.html +157 -0
  76. package/docs/modules.html +235 -0
  77. package/index.html +21 -0
  78. package/jest.config.ts +27 -0
  79. package/jest.setup.ts +6 -0
  80. package/package.json +30 -39
  81. package/release.config.cjs +15 -0
  82. package/tsup.config.ts +26 -0
  83. package/lib/BaseClient.d.ts +0 -274
  84. package/lib/BaseClient.js +0 -2227
  85. package/lib/PopupTools.d.ts +0 -17
  86. package/lib/PopupTools.js +0 -213
  87. package/lib/ZeusThunder.d.ts +0 -2
  88. package/lib/ZeusThunder.js +0 -113
  89. package/lib/cache.d.ts +0 -7
  90. package/lib/cache.js +0 -5
  91. package/lib/client/admin/index.d.ts +0 -11
  92. package/lib/client/admin/index.js +0 -198
  93. package/lib/client/convert/file.d.ts +0 -5
  94. package/lib/client/convert/file.js +0 -39
  95. package/lib/client/convert/folder.d.ts +0 -8
  96. package/lib/client/convert/folder.js +0 -264
  97. package/lib/client/convert/mail.d.ts +0 -3
  98. package/lib/client/convert/mail.js +0 -46
  99. package/lib/client/convert/vFile.d.ts +0 -5
  100. package/lib/client/convert/vFile.js +0 -164
  101. package/lib/client/helpers.d.ts +0 -23
  102. package/lib/client/helpers.js +0 -114
  103. package/lib/client/index.d.ts +0 -172
  104. package/lib/client/index.js +0 -6171
  105. package/lib/client/storage.d.ts +0 -7
  106. package/lib/client/storage.js +0 -12
  107. package/lib/client/types/File.d.ts +0 -21
  108. package/lib/client/types/File.js +0 -3
  109. package/lib/client/types/FilesOnUsersOnApplications.d.ts +0 -9
  110. package/lib/client/types/FilesOnUsersOnApplications.js +0 -3
  111. package/lib/client/types/Folder.d.ts +0 -68
  112. package/lib/client/types/Folder.js +0 -7
  113. package/lib/client/types/Inputs.d.ts +0 -21
  114. package/lib/client/types/Inputs.js +0 -3
  115. package/lib/client/types/UserAppNotifications.d.ts +0 -6
  116. package/lib/client/types/UserAppNotifications.js +0 -3
  117. package/lib/client/types/UserAppSettings.d.ts +0 -7
  118. package/lib/client/types/UserAppSettings.js +0 -3
  119. package/lib/client/types/VFile.d.ts +0 -62
  120. package/lib/client/types/VFile.js +0 -4
  121. package/lib/client/types/index.d.ts +0 -154
  122. package/lib/client/types/index.js +0 -10
  123. package/lib/client/types/queries.d.ts +0 -535
  124. package/lib/client/types/queries.js +0 -192
  125. package/lib/crypto/file.d.ts +0 -14
  126. package/lib/crypto/file.js +0 -291
  127. package/lib/crypto/index.d.ts +0 -12
  128. package/lib/crypto/index.js +0 -37
  129. package/lib/error.d.ts +0 -30
  130. package/lib/error.js +0 -3
  131. package/lib/index.d.ts +0 -13
  132. package/lib/index.js +0 -42
  133. package/lib/minify/index.d.ts +0 -2
  134. package/lib/minify/index.js +0 -28
  135. package/lib/minify/lz4.d.ts +0 -5
  136. package/lib/minify/lz4.js +0 -633
  137. package/lib/sodium.d.ts +0 -3
  138. package/lib/sodium.js +0 -28
  139. package/lib/utils/store-buddy.d.ts +0 -14
  140. package/lib/utils/store-buddy.js +0 -69
  141. package/lib/utils/time.d.ts +0 -10
  142. package/lib/utils/time.js +0 -22
  143. package/lib/utils.d.ts +0 -4
  144. package/lib/utils.js +0 -188
  145. package/lib/worker/__mock__/sodium.worker.d.ts +0 -19
  146. package/lib/worker/__mock__/sodium.worker.js +0 -46
  147. package/lib/worker/md5.d.ts +0 -1
  148. package/lib/worker/md5.js +0 -43
  149. package/lib/worker/sodium.d.ts +0 -3
  150. package/lib/worker/sodium.js +0 -155
  151. package/lib/worker/workerCodes.d.ts +0 -2
  152. package/lib/worker/workerCodes.js +0 -3
  153. package/lib/zeus/const.d.ts +0 -2
  154. package/lib/zeus/const.js +0 -2267
  155. package/lib/zeus/index.js +0 -549
@@ -1,274 +0,0 @@
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 {};