@secrecy/lib 1.47.3-feat-pay-for-user-billing.1 → 1.48.0-feat-update-typedoc.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/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # Anonymize Secrecy Library 📚🔐🔐
1
+ # Anonymize Secrecy Library 📚🔐
2
2
 
3
3
  - [Docs](https://docs.secrecy.tech)
@@ -14,10 +14,25 @@ async function getPublicUser(client, id) {
14
14
  usersCache.set(user.id, user);
15
15
  return user;
16
16
  }
17
+ /**
18
+ * The `BaseClient` class provides methods for interacting with API clients, handling sessions,
19
+ * and managing users.
20
+ */
17
21
  export class BaseClient {
22
+ /**
23
+ * Creates a new instance of the API client.
24
+ * @param session - The session ID, which can be null or undefined.
25
+ * @param onAccessDenied - Callback function to execute when access is denied.
26
+ * @returns The API client.
27
+ */
18
28
  static getBaseClient = (session, onAccessDenied) => createTRPCClient(session, onAccessDenied);
19
29
  client;
20
30
  sessionId;
31
+ /**
32
+ * Initializes the `BaseClient` with a session ID and access denied handler.
33
+ * @param session - The session ID.
34
+ * @param onAccessDenied - A callback function when access is denied.
35
+ */
21
36
  constructor(session, onAccessDenied) {
22
37
  this.sessionId = session;
23
38
  this.client = BaseClient.getBaseClient(session, async () => {
@@ -32,9 +47,14 @@ export class BaseClient {
32
47
  }
33
48
  });
34
49
  }
50
+ /**
51
+ * Logs out the current session by clearing session data and calling the API logout method.
52
+ * @param sessionId - The session ID to log out from (optional).
53
+ * @returns A promise that resolves when the operation is complete.
54
+ */
35
55
  async logout(sessionId) {
36
56
  if (sessionId === null || sessionId === undefined) {
37
- this.#clean();
57
+ this.clean();
38
58
  }
39
59
  await this.client.auth.logout.mutate({
40
60
  sessionId: sessionId ?? null,
@@ -85,7 +105,11 @@ export class BaseClient {
85
105
  });
86
106
  return getPaymentRequestToPay;
87
107
  };
88
- #clean = () => {
108
+ /**
109
+ * Clears stored session and user data.
110
+ * @private
111
+ */
112
+ clean = () => {
89
113
  const local = getStorage(false);
90
114
  const session = getStorage(true);
91
115
  local.jwt.clear();
@@ -1,12 +1,31 @@
1
1
  import { type ApiClient, type RouterOutputs, type RouterInputs } from './client.js';
2
2
  import { type InfuraNetwork, type PublicUser } from './index.js';
3
3
  import { type SelfUser } from './client/types/user.js';
4
+ /**
5
+ * The `BaseClient` class provides methods for interacting with API clients, handling sessions,
6
+ * and managing users.
7
+ */
4
8
  export declare class BaseClient {
5
- #private;
9
+ /**
10
+ * Creates a new instance of the API client.
11
+ * @param session - The session ID, which can be null or undefined.
12
+ * @param onAccessDenied - Callback function to execute when access is denied.
13
+ * @returns The API client.
14
+ */
6
15
  static readonly getBaseClient: (session?: string | null | undefined, onAccessDenied?: () => void | Promise<void>) => ApiClient;
7
16
  protected client: ApiClient;
8
17
  sessionId: string;
18
+ /**
19
+ * Initializes the `BaseClient` with a session ID and access denied handler.
20
+ * @param session - The session ID.
21
+ * @param onAccessDenied - A callback function when access is denied.
22
+ */
9
23
  constructor(session: string, onAccessDenied?: () => void | Promise<void>);
24
+ /**
25
+ * Logs out the current session by clearing session data and calling the API logout method.
26
+ * @param sessionId - The session ID to log out from (optional).
27
+ * @returns A promise that resolves when the operation is complete.
28
+ */
10
29
  logout(sessionId?: string | null | undefined): Promise<void>;
11
30
  me(): Promise<SelfUser>;
12
31
  static getUser(userId: string, sessionId?: string | null | undefined): Promise<PublicUser>;
@@ -25,4 +44,9 @@ export declare class BaseClient {
25
44
  paymentRequestId: string;
26
45
  secrecyIdSeller: string;
27
46
  }) => Promise<RouterOutputs["stripe"]["paymentRequestToPay"]>;
47
+ /**
48
+ * Clears stored session and user data.
49
+ * @private
50
+ */
51
+ private readonly clean;
28
52
  }
@@ -332,7 +332,6 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
332
332
  totalStorageSizeBase: bigint | null;
333
333
  totalStorageSizeUnit: bigint | null;
334
334
  totalStorageSizePrice: number | null;
335
- baseQuotasId: string;
336
335
  };
337
336
  _output_out: {
338
337
  id: string;
@@ -356,7 +355,6 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
356
355
  totalStorageSizeBase: bigint | null;
357
356
  totalStorageSizeUnit: bigint | null;
358
357
  totalStorageSizePrice: number | null;
359
- baseQuotasId: string;
360
358
  };
361
359
  }, unknown>>;
362
360
  };
@@ -430,16 +428,16 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
430
428
  _input_out: {} | undefined;
431
429
  _output_in: {
432
430
  id: string;
433
- quotasId: string;
434
431
  name: string;
432
+ descriptorId: string;
435
433
  stripePricesId: string | null;
436
434
  isCustomPlan?: boolean | undefined;
437
435
  canHaveDatabase?: boolean | undefined;
438
436
  };
439
437
  _output_out: {
440
438
  id: string;
441
- quotasId: string;
442
439
  name: string;
440
+ descriptorId: string;
443
441
  isCustomPlan: boolean;
444
442
  canHaveDatabase: boolean;
445
443
  stripePricesId: string | null;
@@ -482,40 +480,27 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
482
480
  isCustomPlan?: boolean | undefined;
483
481
  canHaveDatabase?: boolean | undefined;
484
482
  } & {
485
- quotas: {
486
- users: bigint | null;
487
- totalStorageSize: bigint | null;
488
- devs: bigint | null;
483
+ descriptor: {
489
484
  devsBase: bigint | null;
490
485
  devsUnit: bigint | null;
491
486
  devsPrice: number | null;
492
487
  usersBase: bigint | null;
493
488
  usersUnit: bigint | null;
494
489
  usersPrice: number | null;
495
- perDataSize: bigint | null;
496
490
  perDataSizeBase: bigint | null;
497
491
  perDataSizeUnit: bigint | null;
498
492
  perDataSizePrice: number | null;
499
- bandwidth: bigint | null;
500
493
  bandwidthBase: bigint | null;
501
494
  bandwidthUnit: bigint | null;
502
495
  bandwidthPrice: number | null;
503
496
  totalStorageSizeBase: bigint | null;
504
497
  totalStorageSizeUnit: bigint | null;
505
498
  totalStorageSizePrice: number | null;
506
- baseQuotasId: string;
507
- } & {
508
- baseQuotas: {
509
- uploadCount: bigint | null;
510
- downloadCount: bigint | null;
511
- totalDataCount: bigint | null;
512
- totalStorageSize: bigint | null;
513
- perDataSize: bigint | null;
514
- downloadBandwidth: bigint | null;
515
- uploadBandwidth: bigint | null;
516
- receivedMailsId: string;
517
- sentMailsId: string;
518
- };
499
+ devsMax: bigint | null;
500
+ usersMax: bigint | null;
501
+ perDataSizeMax: bigint | null;
502
+ bandwidthMax: bigint | null;
503
+ totalStorageSizeMax: bigint | null;
519
504
  };
520
505
  } & {
521
506
  price: number;
@@ -528,40 +513,27 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
528
513
  isCustomPlan: boolean;
529
514
  canHaveDatabase: boolean;
530
515
  } & {
531
- quotas: {
532
- users: bigint | null;
533
- totalStorageSize: bigint | null;
534
- devs: bigint | null;
516
+ descriptor: {
535
517
  devsBase: bigint | null;
536
518
  devsUnit: bigint | null;
537
519
  devsPrice: number | null;
538
520
  usersBase: bigint | null;
539
521
  usersUnit: bigint | null;
540
522
  usersPrice: number | null;
541
- perDataSize: bigint | null;
542
523
  perDataSizeBase: bigint | null;
543
524
  perDataSizeUnit: bigint | null;
544
525
  perDataSizePrice: number | null;
545
- bandwidth: bigint | null;
546
526
  bandwidthBase: bigint | null;
547
527
  bandwidthUnit: bigint | null;
548
528
  bandwidthPrice: number | null;
549
529
  totalStorageSizeBase: bigint | null;
550
530
  totalStorageSizeUnit: bigint | null;
551
531
  totalStorageSizePrice: number | null;
552
- baseQuotasId: string;
553
- } & {
554
- baseQuotas: {
555
- uploadCount: bigint | null;
556
- downloadCount: bigint | null;
557
- totalDataCount: bigint | null;
558
- totalStorageSize: bigint | null;
559
- perDataSize: bigint | null;
560
- downloadBandwidth: bigint | null;
561
- uploadBandwidth: bigint | null;
562
- receivedMailsId: string;
563
- sentMailsId: string;
564
- };
532
+ devsMax: bigint | null;
533
+ usersMax: bigint | null;
534
+ perDataSizeMax: bigint | null;
535
+ bandwidthMax: bigint | null;
536
+ totalStorageSizeMax: bigint | null;
565
537
  };
566
538
  } & {
567
539
  price: number;
@@ -11257,45 +11229,31 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
11257
11229
  isCustomPlan?: boolean | undefined;
11258
11230
  canHaveDatabase?: boolean | undefined;
11259
11231
  } & {
11260
- quotas: {
11261
- users: bigint | null;
11262
- totalStorageSize: bigint | null;
11263
- devs: bigint | null;
11232
+ descriptor: {
11264
11233
  devsBase: bigint | null;
11265
11234
  devsUnit: bigint | null;
11266
11235
  devsPrice: number | null;
11267
11236
  usersBase: bigint | null;
11268
11237
  usersUnit: bigint | null;
11269
11238
  usersPrice: number | null;
11270
- perDataSize: bigint | null;
11271
11239
  perDataSizeBase: bigint | null;
11272
11240
  perDataSizeUnit: bigint | null;
11273
11241
  perDataSizePrice: number | null;
11274
- bandwidth: bigint | null;
11275
11242
  bandwidthBase: bigint | null;
11276
11243
  bandwidthUnit: bigint | null;
11277
11244
  bandwidthPrice: number | null;
11278
11245
  totalStorageSizeBase: bigint | null;
11279
11246
  totalStorageSizeUnit: bigint | null;
11280
11247
  totalStorageSizePrice: number | null;
11281
- baseQuotasId: string;
11282
- } & {
11283
- baseQuotas: {
11284
- uploadCount: bigint | null;
11285
- downloadCount: bigint | null;
11286
- totalDataCount: bigint | null;
11287
- totalStorageSize: bigint | null;
11288
- perDataSize: bigint | null;
11289
- downloadBandwidth: bigint | null;
11290
- uploadBandwidth: bigint | null;
11291
- receivedMailsId: string;
11292
- sentMailsId: string;
11293
- };
11248
+ devsMax: bigint | null;
11249
+ usersMax: bigint | null;
11250
+ perDataSizeMax: bigint | null;
11251
+ bandwidthMax: bigint | null;
11252
+ totalStorageSizeMax: bigint | null;
11294
11253
  };
11295
11254
  };
11296
11255
  id: string;
11297
11256
  createdAt: Date;
11298
- quotasId: string;
11299
11257
  ownerId: string;
11300
11258
  blocked: boolean;
11301
11259
  name: string;
@@ -11305,6 +11263,7 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
11305
11263
  origin: string[];
11306
11264
  planId: string | null;
11307
11265
  lastMetricsReset: Date;
11266
+ quotasId: string;
11308
11267
  owner: {
11309
11268
  user: {
11310
11269
  id: string;
@@ -11328,45 +11287,31 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
11328
11287
  isCustomPlan: boolean;
11329
11288
  canHaveDatabase: boolean;
11330
11289
  } & {
11331
- quotas: {
11332
- users: bigint | null;
11333
- totalStorageSize: bigint | null;
11334
- devs: bigint | null;
11290
+ descriptor: {
11335
11291
  devsBase: bigint | null;
11336
11292
  devsUnit: bigint | null;
11337
11293
  devsPrice: number | null;
11338
11294
  usersBase: bigint | null;
11339
11295
  usersUnit: bigint | null;
11340
11296
  usersPrice: number | null;
11341
- perDataSize: bigint | null;
11342
11297
  perDataSizeBase: bigint | null;
11343
11298
  perDataSizeUnit: bigint | null;
11344
11299
  perDataSizePrice: number | null;
11345
- bandwidth: bigint | null;
11346
11300
  bandwidthBase: bigint | null;
11347
11301
  bandwidthUnit: bigint | null;
11348
11302
  bandwidthPrice: number | null;
11349
11303
  totalStorageSizeBase: bigint | null;
11350
11304
  totalStorageSizeUnit: bigint | null;
11351
11305
  totalStorageSizePrice: number | null;
11352
- baseQuotasId: string;
11353
- } & {
11354
- baseQuotas: {
11355
- uploadCount: bigint | null;
11356
- downloadCount: bigint | null;
11357
- totalDataCount: bigint | null;
11358
- totalStorageSize: bigint | null;
11359
- perDataSize: bigint | null;
11360
- downloadBandwidth: bigint | null;
11361
- uploadBandwidth: bigint | null;
11362
- receivedMailsId: string;
11363
- sentMailsId: string;
11364
- };
11306
+ devsMax: bigint | null;
11307
+ usersMax: bigint | null;
11308
+ perDataSizeMax: bigint | null;
11309
+ bandwidthMax: bigint | null;
11310
+ totalStorageSizeMax: bigint | null;
11365
11311
  };
11366
11312
  };
11367
11313
  id: string;
11368
11314
  createdAt: Date;
11369
- quotasId: string;
11370
11315
  ownerId: string;
11371
11316
  blocked: boolean;
11372
11317
  name: string;
@@ -11376,6 +11321,7 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
11376
11321
  origin: string[];
11377
11322
  planId: string | null;
11378
11323
  lastMetricsReset: Date;
11324
+ quotasId: string;
11379
11325
  owner: {
11380
11326
  user: {
11381
11327
  id: string;
@@ -11431,45 +11377,31 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
11431
11377
  isCustomPlan?: boolean | undefined;
11432
11378
  canHaveDatabase?: boolean | undefined;
11433
11379
  } & {
11434
- quotas: {
11435
- users: bigint | null;
11436
- totalStorageSize: bigint | null;
11437
- devs: bigint | null;
11380
+ descriptor: {
11438
11381
  devsBase: bigint | null;
11439
11382
  devsUnit: bigint | null;
11440
11383
  devsPrice: number | null;
11441
11384
  usersBase: bigint | null;
11442
11385
  usersUnit: bigint | null;
11443
11386
  usersPrice: number | null;
11444
- perDataSize: bigint | null;
11445
11387
  perDataSizeBase: bigint | null;
11446
11388
  perDataSizeUnit: bigint | null;
11447
11389
  perDataSizePrice: number | null;
11448
- bandwidth: bigint | null;
11449
11390
  bandwidthBase: bigint | null;
11450
11391
  bandwidthUnit: bigint | null;
11451
11392
  bandwidthPrice: number | null;
11452
11393
  totalStorageSizeBase: bigint | null;
11453
11394
  totalStorageSizeUnit: bigint | null;
11454
11395
  totalStorageSizePrice: number | null;
11455
- baseQuotasId: string;
11456
- } & {
11457
- baseQuotas: {
11458
- uploadCount: bigint | null;
11459
- downloadCount: bigint | null;
11460
- totalDataCount: bigint | null;
11461
- totalStorageSize: bigint | null;
11462
- perDataSize: bigint | null;
11463
- downloadBandwidth: bigint | null;
11464
- uploadBandwidth: bigint | null;
11465
- receivedMailsId: string;
11466
- sentMailsId: string;
11467
- };
11396
+ devsMax: bigint | null;
11397
+ usersMax: bigint | null;
11398
+ perDataSizeMax: bigint | null;
11399
+ bandwidthMax: bigint | null;
11400
+ totalStorageSizeMax: bigint | null;
11468
11401
  };
11469
11402
  };
11470
11403
  id: string;
11471
11404
  createdAt: Date;
11472
- quotasId: string;
11473
11405
  ownerId: string;
11474
11406
  blocked: boolean;
11475
11407
  name: string;
@@ -11479,6 +11411,7 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
11479
11411
  origin: string[];
11480
11412
  planId: string | null;
11481
11413
  lastMetricsReset: Date;
11414
+ quotasId: string;
11482
11415
  owner: {
11483
11416
  user: {
11484
11417
  id: string;
@@ -11502,45 +11435,31 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
11502
11435
  isCustomPlan: boolean;
11503
11436
  canHaveDatabase: boolean;
11504
11437
  } & {
11505
- quotas: {
11506
- users: bigint | null;
11507
- totalStorageSize: bigint | null;
11508
- devs: bigint | null;
11438
+ descriptor: {
11509
11439
  devsBase: bigint | null;
11510
11440
  devsUnit: bigint | null;
11511
11441
  devsPrice: number | null;
11512
11442
  usersBase: bigint | null;
11513
11443
  usersUnit: bigint | null;
11514
11444
  usersPrice: number | null;
11515
- perDataSize: bigint | null;
11516
11445
  perDataSizeBase: bigint | null;
11517
11446
  perDataSizeUnit: bigint | null;
11518
11447
  perDataSizePrice: number | null;
11519
- bandwidth: bigint | null;
11520
11448
  bandwidthBase: bigint | null;
11521
11449
  bandwidthUnit: bigint | null;
11522
11450
  bandwidthPrice: number | null;
11523
11451
  totalStorageSizeBase: bigint | null;
11524
11452
  totalStorageSizeUnit: bigint | null;
11525
11453
  totalStorageSizePrice: number | null;
11526
- baseQuotasId: string;
11527
- } & {
11528
- baseQuotas: {
11529
- uploadCount: bigint | null;
11530
- downloadCount: bigint | null;
11531
- totalDataCount: bigint | null;
11532
- totalStorageSize: bigint | null;
11533
- perDataSize: bigint | null;
11534
- downloadBandwidth: bigint | null;
11535
- uploadBandwidth: bigint | null;
11536
- receivedMailsId: string;
11537
- sentMailsId: string;
11538
- };
11454
+ devsMax: bigint | null;
11455
+ usersMax: bigint | null;
11456
+ perDataSizeMax: bigint | null;
11457
+ bandwidthMax: bigint | null;
11458
+ totalStorageSizeMax: bigint | null;
11539
11459
  };
11540
11460
  };
11541
11461
  id: string;
11542
11462
  createdAt: Date;
11543
- quotasId: string;
11544
11463
  ownerId: string;
11545
11464
  blocked: boolean;
11546
11465
  name: string;
@@ -11550,6 +11469,7 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
11550
11469
  origin: string[];
11551
11470
  planId: string | null;
11552
11471
  lastMetricsReset: Date;
11472
+ quotasId: string;
11553
11473
  owner: {
11554
11474
  user: {
11555
11475
  id: string;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@secrecy/lib",
3
3
  "author": "Anonymize <anonymize@gmail.com>",
4
4
  "description": "Anonymize Secrecy Library",
5
- "version": "1.47.3-feat-pay-for-user-billing.1",
5
+ "version": "1.48.0-feat-update-typedoc.1",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/anonymize-org/lib.git"
@@ -74,7 +74,7 @@
74
74
  "typescript": "^5.6.2"
75
75
  },
76
76
  "dependencies": {
77
- "@secrecy/trpc-api-types": "1.33.0-feat-billing-by-app-or-user.1",
77
+ "@secrecy/trpc-api-types": "1.33.0-feat-unencrypted-data.5",
78
78
  "@trpc/client": "10.45.2",
79
79
  "@trpc/server": "10.45.2",
80
80
  "@types/libsodium-wrappers-sumo": "^0.7.8",