@secrecy/lib 1.0.0-dev.5 → 1.0.0-dev.50

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 (116) hide show
  1. package/README.md +1 -1
  2. package/{lib → dist}/BaseClient.d.ts +62 -73
  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 +102 -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 +163 -0
  21. package/dist/client/index.js +3209 -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 +56 -0
  29. package/dist/client/types/Node.js +3 -0
  30. package/dist/client/types/UserAppNotifications.d.ts +6 -0
  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 +8 -13
  35. package/dist/client/types/index.js +8 -0
  36. package/dist/client/types/selectors.d.ts +400 -0
  37. package/dist/client/types/selectors.js +130 -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/dist/index.d.ts +12 -0
  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/dist/worker/sodium.d.ts +3 -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 +1234 -0
  68. package/dist/zeus/index.d.ts +5893 -0
  69. package/dist/zeus/index.js +681 -0
  70. package/package.json +58 -51
  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 -3699
  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/UserAppSettings.js +0 -2
  94. package/lib/client/types/VFile.d.ts +0 -62
  95. package/lib/client/types/VFile.js +0 -4
  96. package/lib/client/types/index.js +0 -8
  97. package/lib/client/types/queries.d.ts +0 -535
  98. package/lib/client/types/queries.js +0 -192
  99. package/lib/crypto/file.js +0 -291
  100. package/lib/crypto/index.js +0 -37
  101. package/lib/index.d.ts +0 -11
  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.d.ts +0 -3
  112. package/lib/worker/sodium.js +0 -141
  113. package/lib/worker/workerCodes.js +0 -3
  114. package/lib/zeus/const.js +0 -1609
  115. package/lib/zeus/index.d.ts +0 -26113
  116. 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;
@@ -112,10 +123,6 @@ export declare type UserData<T extends Record<string, unknown> = Record<string,
112
123
  isSuperuser: boolean;
113
124
  isSearchable: boolean;
114
125
  } & T;
115
- export declare type FolderSize = {
116
- size: bigint;
117
- sizeBefore: bigint;
118
- };
119
126
  export declare type AppDBConfigField = {
120
127
  name: string;
121
128
  type: "string" | "number" | "boolean" | "object";
@@ -152,7 +159,7 @@ export declare type UserBase = {
152
159
  role: UserRole;
153
160
  firstname: string;
154
161
  id: string;
155
- deletedAt: Date | null;
162
+ deletedAt?: Date;
156
163
  lastLogin: Date;
157
164
  lang: Lang;
158
165
  };
@@ -166,23 +173,24 @@ export declare type User<T extends WithPublicKey = WithPublicKey> = T extends {
166
173
  } : UserBase;
167
174
  declare type ClassGetUserParams = WithPublicKey & {
168
175
  userId?: string;
176
+ userEmail?: string;
169
177
  };
170
178
  declare type StaticGetUserParams = ClassGetUserParams & {
171
179
  env: SecrecyEnv;
172
180
  };
173
181
  export declare type CloudLimits = {
174
182
  count: bigint;
175
- maxCount: bigint | null;
183
+ maxCount?: bigint | undefined;
176
184
  size: bigint;
177
- maxSize: bigint | null;
185
+ maxSize?: bigint | undefined;
178
186
  };
179
187
  export declare type MailLimitsValues = {
180
188
  count: bigint;
181
- maxCount: bigint | null;
189
+ maxCount?: bigint | undefined;
182
190
  fileSize: bigint;
183
- maxFileSize: bigint | null;
191
+ maxFileSize?: bigint | undefined;
184
192
  fileCount: bigint;
185
- maxFileCount: bigint | null;
193
+ maxFileCount?: bigint | undefined;
186
194
  };
187
195
  export declare type QueryLimits = {
188
196
  cloud: CloudLimits;
@@ -197,70 +205,51 @@ export declare class BaseClient {
197
205
  protected client: ReturnType<typeof Thunder>;
198
206
  sessionId: string;
199
207
  constructor(session: string, env: SecrecyEnv);
200
- sessions(): Promise<UserSession[]>;
208
+ sessions(): Promise<SuccessResponse<UserSession[]> | ErrorNotFound | null>;
201
209
  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>;
210
+ me<T extends WithPublicKey = WithPublicKey>(params?: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
211
+ static user<T extends StaticGetUserParams>(params: T, sessionId?: string | null | undefined): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
212
+ user<T extends ClassGetUserParams>(params: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
205
213
  updateProfile({ firstname, lastname, lang }: {
206
214
  firstname: string | null;
207
215
  lastname: string | null;
208
216
  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>;
217
+ }): Promise<SuccessResponse<User> | ErrorNotFound | ErrorAccessDenied | null>;
218
+ static plans(env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<Plan[]> | null>;
219
+ pay(planCode: SecrecyPlansCodes, input: PayInput, autoRenew?: boolean | null | undefined): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
220
+ cancelPayment(): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
221
+ paymentInfos(): Promise<SuccessResponse<PaymentInfos> | ErrorAccessDenied | null>;
222
+ limits(): Promise<SuccessResponse<QueryLimits> | ErrorAccessDenied | ErrorNotExist | ErrorLimit | ErrorNotFound | null>;
223
+ godFatherAndChildren(): Promise<SuccessResponse<GodFatherAndChildren> | ErrorNotFound | null>;
216
224
  static updateAppDBConfig({ appCode, config, env, sessionId }: {
217
225
  appCode: string;
218
226
  config: AppDBConfig;
219
227
  env: SecrecyEnv;
220
228
  sessionId?: string | null | undefined;
221
- }): Promise<AppDBConfig>;
222
- static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<AppDBConfig>;
229
+ }): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | null>;
230
+ static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | ErrorNotFound | ErrorNotExist | null>;
223
231
  static getFAQ({ lang, env, sessionId }: {
224
232
  lang?: Lang;
225
233
  env: SecrecyEnv;
226
234
  sessionId?: string | null | undefined;
227
- }): Promise<FaqItem[]>;
235
+ }): Promise<SuccessResponse<FaqItem[]> | ErrorAccessDenied | null>;
228
236
  static getBlog({ env, lang, sessionId }: {
229
237
  env: SecrecyEnv;
230
238
  lang?: Lang | null | undefined;
231
239
  sessionId?: string | null | undefined;
232
- }): Promise<BlogItem[]>;
233
- reportUser(reportedUserId: string, customMessage?: string): Promise<SendReport | undefined>;
240
+ }): Promise<SuccessResponse<BlogItem[]> | ErrorLangNotExist | null>;
241
+ reportUser(reportedUserId: string, customMessage?: string): Promise<SuccessResponse<SendReport> | ErrorAccessDenied | ErrorNotFound | null>;
234
242
  static deleteUser({ sessionId, userId, env }: {
235
243
  sessionId: string;
236
244
  userId?: string;
237
245
  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 }: {
246
+ }): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
247
+ getSponsorshipLink({ backUrl }: {
248
+ backUrl: string;
249
+ }): Promise<string | null>;
250
+ updateAutoDisconnectDelay({ id, delay }: {
252
251
  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>;
252
+ delay: number | null;
253
+ }): Promise<SuccessResponse<boolean> | ErrorNotFound | ErrorAccessDenied | ErrorBasic | null>;
265
254
  }
266
255
  export {};