@secrecy/lib 1.0.0-dev.7 → 1.0.0

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 (115) hide show
  1. package/README.md +1 -1
  2. package/{lib → dist}/BaseClient.d.ts +62 -69
  3. package/dist/BaseClient.js +1124 -0
  4. package/{lib → dist}/PopupTools.d.ts +1 -1
  5. package/dist/PopupTools.js +212 -0
  6. package/{lib → dist}/ZeusThunder.d.ts +0 -0
  7. package/dist/ZeusThunder.js +79 -0
  8. package/dist/cache.d.ts +6 -0
  9. package/dist/cache.js +4 -0
  10. package/dist/client/admin/index.d.ts +11 -0
  11. package/dist/client/admin/index.js +110 -0
  12. package/{lib → dist}/client/convert/file.d.ts +3 -3
  13. package/dist/client/convert/file.js +34 -0
  14. package/{lib → dist}/client/convert/mail.d.ts +0 -0
  15. package/dist/client/convert/mail.js +46 -0
  16. package/dist/client/convert/node.d.ts +9 -0
  17. package/dist/client/convert/node.js +101 -0
  18. package/{lib → dist}/client/helpers.d.ts +1 -1
  19. package/dist/client/helpers.js +114 -0
  20. package/dist/client/index.d.ts +164 -0
  21. package/dist/client/index.js +3206 -0
  22. package/{lib → dist}/client/storage.d.ts +0 -0
  23. package/dist/client/storage.js +12 -0
  24. package/dist/client/types/File.d.ts +14 -0
  25. package/dist/client/types/File.js +3 -0
  26. package/{lib → dist}/client/types/Inputs.d.ts +2 -7
  27. package/dist/client/types/Inputs.js +3 -0
  28. package/dist/client/types/Node.d.ts +49 -0
  29. package/dist/client/types/Node.js +3 -0
  30. package/{lib → dist}/client/types/UserAppNotifications.d.ts +1 -1
  31. package/dist/client/types/UserAppNotifications.js +3 -0
  32. package/{lib → dist}/client/types/UserAppSettings.d.ts +0 -1
  33. package/dist/client/types/UserAppSettings.js +3 -0
  34. package/{lib → dist}/client/types/index.d.ts +7 -13
  35. package/dist/client/types/index.js +8 -0
  36. package/dist/client/types/selectors.d.ts +476 -0
  37. package/dist/client/types/selectors.js +125 -0
  38. package/{lib → dist}/crypto/file.d.ts +0 -0
  39. package/dist/crypto/file.js +210 -0
  40. package/{lib → dist}/crypto/index.d.ts +0 -0
  41. package/dist/crypto/index.js +47 -0
  42. package/dist/error.d.ts +30 -0
  43. package/dist/error.js +3 -0
  44. package/{lib → dist}/index.d.ts +4 -3
  45. package/dist/index.js +10 -0
  46. package/{lib → dist}/minify/index.d.ts +0 -0
  47. package/dist/minify/index.js +28 -0
  48. package/{lib → dist}/minify/lz4.d.ts +0 -0
  49. package/dist/minify/lz4.js +627 -0
  50. package/{lib → dist}/sodium.d.ts +0 -0
  51. package/dist/sodium.js +6 -0
  52. package/{lib → dist}/utils/store-buddy.d.ts +0 -0
  53. package/dist/utils/store-buddy.js +65 -0
  54. package/{lib → dist}/utils/time.d.ts +0 -0
  55. package/dist/utils/time.js +14 -0
  56. package/{lib → dist/utils}/utils.d.ts +0 -0
  57. package/dist/utils/utils.js +57 -0
  58. package/{lib → dist}/worker/__mock__/sodium.worker.d.ts +0 -0
  59. package/dist/worker/__mock__/sodium.worker.js +49 -0
  60. package/{lib → dist}/worker/md5.d.ts +0 -0
  61. package/dist/worker/md5.js +25 -0
  62. package/{lib → dist}/worker/sodium.d.ts +0 -0
  63. package/dist/worker/sodium.js +120 -0
  64. package/{lib → dist}/worker/workerCodes.d.ts +0 -0
  65. package/dist/worker/workerCodes.js +3 -0
  66. package/{lib → dist}/zeus/const.d.ts +5 -0
  67. package/dist/zeus/const.js +1230 -0
  68. package/dist/zeus/index.d.ts +4069 -0
  69. package/dist/zeus/index.js +657 -0
  70. package/package.json +64 -57
  71. package/lib/BaseClient.js +0 -1332
  72. package/lib/PopupTools.js +0 -213
  73. package/lib/ZeusThunder.js +0 -112
  74. package/lib/cache.d.ts +0 -7
  75. package/lib/cache.js +0 -5
  76. package/lib/client/convert/file.js +0 -39
  77. package/lib/client/convert/folder.d.ts +0 -8
  78. package/lib/client/convert/folder.js +0 -264
  79. package/lib/client/convert/mail.js +0 -46
  80. package/lib/client/convert/vFile.d.ts +0 -5
  81. package/lib/client/convert/vFile.js +0 -164
  82. package/lib/client/helpers.js +0 -116
  83. package/lib/client/index.d.ts +0 -167
  84. package/lib/client/index.js +0 -3746
  85. package/lib/client/storage.js +0 -12
  86. package/lib/client/types/File.d.ts +0 -21
  87. package/lib/client/types/File.js +0 -2
  88. package/lib/client/types/FilesOnUsersOnApplications.d.ts +0 -9
  89. package/lib/client/types/FilesOnUsersOnApplications.js +0 -2
  90. package/lib/client/types/Folder.d.ts +0 -68
  91. package/lib/client/types/Folder.js +0 -7
  92. package/lib/client/types/Inputs.js +0 -2
  93. package/lib/client/types/UserAppNotifications.js +0 -2
  94. package/lib/client/types/UserAppSettings.js +0 -2
  95. package/lib/client/types/VFile.d.ts +0 -62
  96. package/lib/client/types/VFile.js +0 -4
  97. package/lib/client/types/index.js +0 -9
  98. package/lib/client/types/queries.d.ts +0 -535
  99. package/lib/client/types/queries.js +0 -192
  100. package/lib/crypto/file.js +0 -291
  101. package/lib/crypto/index.js +0 -37
  102. package/lib/index.js +0 -40
  103. package/lib/minify/index.js +0 -28
  104. package/lib/minify/lz4.js +0 -633
  105. package/lib/sodium.js +0 -28
  106. package/lib/utils/store-buddy.js +0 -69
  107. package/lib/utils/time.js +0 -22
  108. package/lib/utils.js +0 -188
  109. package/lib/worker/__mock__/sodium.worker.js +0 -57
  110. package/lib/worker/md5.js +0 -43
  111. package/lib/worker/sodium.js +0 -155
  112. package/lib/worker/workerCodes.js +0 -3
  113. package/lib/zeus/const.js +0 -1643
  114. package/lib/zeus/index.d.ts +0 -26220
  115. 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?: string | undefined;
23
- fileCount?: string | undefined;
24
- fileSize?: string | undefined;
25
- hardCount?: string | undefined;
26
- hardFileCount?: string | undefined;
27
- hardFileSize?: string | undefined;
28
- perFileSize?: string | undefined;
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?: string | undefined;
32
- downloadCount?: string | undefined;
33
- hardFileCount?: string | undefined;
34
- hardFileSize?: string | undefined;
35
- perFileSize?: string | undefined;
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?: string | undefined;
39
- uploadCount?: string | undefined;
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 RecurlyInvoiceStatus = "pending" | "paid" | "failed" | "past_due" | "open" | "closed" | "voided" | "processing";
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: SubscriptionCollectionMethod;
73
- state: SubscriptionState;
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
- export declare type RecurlyInvoices = {
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: RecurlyInvoiceStatus;
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;
@@ -152,7 +163,7 @@ export declare type UserBase = {
152
163
  role: UserRole;
153
164
  firstname: string;
154
165
  id: string;
155
- deletedAt: Date | null;
166
+ deletedAt?: Date;
156
167
  lastLogin: Date;
157
168
  lang: Lang;
158
169
  };
@@ -166,23 +177,24 @@ export declare type User<T extends WithPublicKey = WithPublicKey> = T extends {
166
177
  } : UserBase;
167
178
  declare type ClassGetUserParams = WithPublicKey & {
168
179
  userId?: string;
180
+ userEmail?: string;
169
181
  };
170
182
  declare type StaticGetUserParams = ClassGetUserParams & {
171
183
  env: SecrecyEnv;
172
184
  };
173
185
  export declare type CloudLimits = {
174
186
  count: bigint;
175
- maxCount: bigint | null;
187
+ maxCount?: bigint | undefined;
176
188
  size: bigint;
177
- maxSize: bigint | null;
189
+ maxSize?: bigint | undefined;
178
190
  };
179
191
  export declare type MailLimitsValues = {
180
192
  count: bigint;
181
- maxCount: bigint | null;
193
+ maxCount?: bigint | undefined;
182
194
  fileSize: bigint;
183
- maxFileSize: bigint | null;
195
+ maxFileSize?: bigint | undefined;
184
196
  fileCount: bigint;
185
- maxFileCount: bigint | null;
197
+ maxFileCount?: bigint | undefined;
186
198
  };
187
199
  export declare type QueryLimits = {
188
200
  cloud: CloudLimits;
@@ -197,70 +209,51 @@ export declare class BaseClient {
197
209
  protected client: ReturnType<typeof Thunder>;
198
210
  sessionId: string;
199
211
  constructor(session: string, env: SecrecyEnv);
200
- sessions(): Promise<UserSession[]>;
212
+ sessions(): Promise<SuccessResponse<UserSession[]> | ErrorNotFound | null>;
201
213
  logout(sessionId?: string | null | undefined): Promise<void>;
202
- me<T extends WithPublicKey = WithPublicKey>(params?: T): Promise<User<T> | null>;
203
- static user<T extends StaticGetUserParams>(params: T, sessionId?: string | null | undefined): Promise<User<T> | null>;
204
- user<T extends ClassGetUserParams>(params: T): Promise<User<T> | null>;
214
+ me<T extends WithPublicKey = WithPublicKey>(params?: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
215
+ static user<T extends StaticGetUserParams>(params: T, sessionId?: string | null | undefined): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
216
+ user<T extends ClassGetUserParams>(params: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
205
217
  updateProfile({ firstname, lastname, lang }: {
206
218
  firstname: string | null;
207
219
  lastname: string | null;
208
220
  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>;
221
+ }): Promise<SuccessResponse<User> | ErrorNotFound | ErrorAccessDenied | null>;
222
+ static plans(env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<Plan[]> | null>;
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>;
216
228
  static updateAppDBConfig({ appCode, config, env, sessionId }: {
217
229
  appCode: string;
218
230
  config: AppDBConfig;
219
231
  env: SecrecyEnv;
220
232
  sessionId?: string | null | undefined;
221
- }): Promise<AppDBConfig>;
222
- static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<AppDBConfig>;
233
+ }): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | null>;
234
+ static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | ErrorNotFound | ErrorNotExist | null>;
223
235
  static getFAQ({ lang, env, sessionId }: {
224
236
  lang?: Lang;
225
237
  env: SecrecyEnv;
226
238
  sessionId?: string | null | undefined;
227
- }): Promise<FaqItem[]>;
239
+ }): Promise<SuccessResponse<FaqItem[]> | ErrorAccessDenied | null>;
228
240
  static getBlog({ env, lang, sessionId }: {
229
241
  env: SecrecyEnv;
230
242
  lang?: Lang | null | undefined;
231
243
  sessionId?: string | null | undefined;
232
- }): Promise<BlogItem[]>;
233
- reportUser(reportedUserId: string, customMessage?: string): Promise<SendReport | undefined>;
244
+ }): Promise<SuccessResponse<BlogItem[]> | ErrorLangNotExist | null>;
245
+ reportUser(reportedUserId: string, customMessage?: string): Promise<SuccessResponse<SendReport> | ErrorAccessDenied | ErrorNotFound | null>;
234
246
  static deleteUser({ sessionId, userId, env }: {
235
247
  sessionId: string;
236
248
  userId?: string;
237
249
  env: SecrecyEnv;
238
- }): Promise<boolean>;
239
- dbGet<U>({ field, userId }: {
240
- field: string;
241
- userId?: string | null | undefined;
242
- }): Promise<U>;
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 }: {
250
+ }): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
251
+ getSponsorshipLink({ backUrl }: {
252
+ backUrl: string;
253
+ }): Promise<string | null>;
254
+ updateAutoDisconnectDelay({ id, delay }: {
252
255
  id: string;
253
- }): Promise<boolean>;
254
- moveFolders({ foldersId, parentFolderId }: {
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>;
256
+ delay: number | null;
257
+ }): Promise<SuccessResponse<boolean> | ErrorNotFound | ErrorAccessDenied | ErrorBasic | null>;
265
258
  }
266
259
  export {};