@secrecy/lib 1.60.2 → 1.61.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.
@@ -472,7 +472,7 @@ export class SecrecyCloudClient {
472
472
  await this.dataMetadata({ id: dataId });
473
473
  const data = dataCache.get(dataId);
474
474
  if (data === undefined) {
475
- const receivedMails = await this.#client.mail.receivedMails();
475
+ const receivedMails = await this.#client.mail.receivedMails({});
476
476
  const mail = receivedMails.find((m) => m.attachments.some((f) => f.id === dataId));
477
477
  if (mail === undefined) {
478
478
  const err = {
@@ -54,7 +54,7 @@ export class SecrecyMailClient {
54
54
  return waitingReceivedMailsWithIds;
55
55
  }
56
56
  async updateDraft(draftId, { body, subject, senderFiles, recipients, replyToId }) {
57
- const drafts = await this.draftMails();
57
+ const drafts = await this.draftMails({});
58
58
  const draft = drafts.find((d) => d.mailIntegrityId === draftId);
59
59
  if (draft === undefined) {
60
60
  throw new Error(`Invalid draft ${draftId}`);
@@ -121,7 +121,7 @@ export class SecrecyMailClient {
121
121
  return isDeleted;
122
122
  }
123
123
  async sendDraft(draftId, customMessage) {
124
- const drafts = await this.draftMails();
124
+ const drafts = await this.draftMails({});
125
125
  const draft = drafts.find((d) => d.mailIntegrityId === draftId);
126
126
  if (draft === undefined) {
127
127
  return false;
@@ -159,7 +159,7 @@ export class SecrecyMailClient {
159
159
  }
160
160
  async sendWaitingEmails() {
161
161
  // TODO optimize this
162
- const mails = await this.sentMails();
162
+ const mails = await this.sentMails({});
163
163
  const filtered = mails.filter((m) => m.temporaryRecipients.length > 0);
164
164
  for (const mail of filtered) {
165
165
  for (const { email } of mail.temporaryRecipients) {
@@ -233,24 +233,24 @@ export class SecrecyMailClient {
233
233
  });
234
234
  return isUnread;
235
235
  }
236
- async receivedMails() {
237
- const receivedMails = await this.#apiClient.mail.received.query({});
236
+ async receivedMails(input) {
237
+ const receivedMails = await this.#apiClient.mail.received.query(input);
238
238
  return await Promise.all(receivedMails.map(async (mail) => (await convertInternalMailToExternal({
239
239
  mail,
240
240
  client: this.#client,
241
241
  keyPair: this.#keys,
242
242
  }))));
243
243
  }
244
- async sentMails() {
245
- const sentMails = await this.#apiClient.mail.sent.query({});
244
+ async sentMails(input) {
245
+ const sentMails = await this.#apiClient.mail.sent.query(input);
246
246
  return await Promise.all(sentMails.map(async (mail) => (await convertInternalMailToExternal({
247
247
  mail,
248
248
  client: this.#client,
249
249
  keyPair: this.#keys,
250
250
  }))));
251
251
  }
252
- async draftMails() {
253
- const draftMails = await this.#apiClient.mail.draft.query({});
252
+ async draftMails(input) {
253
+ const draftMails = await this.#apiClient.mail.draft.query(input);
254
254
  return await Promise.all(draftMails.map(async (mail) => (await convertInternalMailToExternal({
255
255
  mail,
256
256
  client: this.#client,
@@ -1,4 +1,4 @@
1
- import { type ApiClient } from '../client.js';
1
+ import { type ApiClient, type RouterInputs } from '../client.js';
2
2
  import type { DraftMail, Mail, NewMail, ReceivedMail, SecrecyClient, SentMail, WaitingReceivedMail } from '../index.js';
3
3
  import { type KeyPair } from './types/index.js';
4
4
  import { type ApiMail } from './types/mail.js';
@@ -34,9 +34,9 @@ export declare class SecrecyMailClient {
34
34
  unread({ mailId }: {
35
35
  mailId: string;
36
36
  }): Promise<boolean>;
37
- receivedMails(): Promise<ReceivedMail[]>;
38
- sentMails(): Promise<SentMail[]>;
39
- draftMails(): Promise<DraftMail[]>;
37
+ receivedMails(input: RouterInputs['mail']['received']): Promise<ReceivedMail[]>;
38
+ sentMails(input: RouterInputs['mail']['sent']): Promise<SentMail[]>;
39
+ draftMails(input: RouterInputs['mail']['draft']): Promise<DraftMail[]>;
40
40
  unreadReceivedMailsCount(): Promise<number>;
41
41
  private readonly _eachUser;
42
42
  }
@@ -1937,7 +1937,17 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
1937
1937
  transformer: typeof superjson;
1938
1938
  }>;
1939
1939
  _meta: object;
1940
- _ctx_out: {};
1940
+ _ctx_out: {
1941
+ session: Omit<SecrecySession, "app">;
1942
+ req: {
1943
+ headers: Headers;
1944
+ };
1945
+ res: {
1946
+ headers: Headers;
1947
+ };
1948
+ locale: Locales;
1949
+ ls: TranslationFunctions;
1950
+ };
1941
1951
  _input_in: {
1942
1952
  userId: string;
1943
1953
  };
@@ -9142,7 +9152,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9142
9152
  createdAt: string;
9143
9153
  updatedAt: string;
9144
9154
  type: _neondatabase_api_client.EndpointType;
9145
- host: string;
9146
9155
  branchId: string;
9147
9156
  suspendTimeoutSeconds: number;
9148
9157
  creationSource: string;
@@ -9151,6 +9160,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9151
9160
  regionId: string;
9152
9161
  currentState: _neondatabase_api_client.EndpointState;
9153
9162
  disabled: boolean;
9163
+ host: string;
9154
9164
  passwordlessAccess: boolean;
9155
9165
  poolerEnabled: boolean;
9156
9166
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9164,7 +9174,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9164
9174
  createdAt: string;
9165
9175
  updatedAt: string;
9166
9176
  type: _neondatabase_api_client.EndpointType;
9167
- host: string;
9168
9177
  branchId: string;
9169
9178
  suspendTimeoutSeconds: number;
9170
9179
  creationSource: string;
@@ -9173,6 +9182,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9173
9182
  regionId: string;
9174
9183
  currentState: _neondatabase_api_client.EndpointState;
9175
9184
  disabled: boolean;
9185
+ host: string;
9176
9186
  passwordlessAccess: boolean;
9177
9187
  poolerEnabled: boolean;
9178
9188
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9328,7 +9338,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9328
9338
  createdAt: string;
9329
9339
  updatedAt: string;
9330
9340
  type: _neondatabase_api_client.EndpointType;
9331
- host: string;
9332
9341
  branchId: string;
9333
9342
  suspendTimeoutSeconds: number;
9334
9343
  creationSource: string;
@@ -9337,6 +9346,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9337
9346
  regionId: string;
9338
9347
  currentState: _neondatabase_api_client.EndpointState;
9339
9348
  disabled: boolean;
9349
+ host: string;
9340
9350
  passwordlessAccess: boolean;
9341
9351
  poolerEnabled: boolean;
9342
9352
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9350,7 +9360,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9350
9360
  createdAt: string;
9351
9361
  updatedAt: string;
9352
9362
  type: _neondatabase_api_client.EndpointType;
9353
- host: string;
9354
9363
  branchId: string;
9355
9364
  suspendTimeoutSeconds: number;
9356
9365
  creationSource: string;
@@ -9359,6 +9368,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9359
9368
  regionId: string;
9360
9369
  currentState: _neondatabase_api_client.EndpointState;
9361
9370
  disabled: boolean;
9371
+ host: string;
9362
9372
  passwordlessAccess: boolean;
9363
9373
  poolerEnabled: boolean;
9364
9374
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9440,7 +9450,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9440
9450
  createdAt: string;
9441
9451
  updatedAt: string;
9442
9452
  type: _neondatabase_api_client.EndpointType;
9443
- host: string;
9444
9453
  branchId: string;
9445
9454
  suspendTimeoutSeconds: number;
9446
9455
  creationSource: string;
@@ -9449,6 +9458,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9449
9458
  regionId: string;
9450
9459
  currentState: _neondatabase_api_client.EndpointState;
9451
9460
  disabled: boolean;
9461
+ host: string;
9452
9462
  passwordlessAccess: boolean;
9453
9463
  poolerEnabled: boolean;
9454
9464
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9462,7 +9472,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9462
9472
  createdAt: string;
9463
9473
  updatedAt: string;
9464
9474
  type: _neondatabase_api_client.EndpointType;
9465
- host: string;
9466
9475
  branchId: string;
9467
9476
  suspendTimeoutSeconds: number;
9468
9477
  creationSource: string;
@@ -9471,6 +9480,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9471
9480
  regionId: string;
9472
9481
  currentState: _neondatabase_api_client.EndpointState;
9473
9482
  disabled: boolean;
9483
+ host: string;
9474
9484
  passwordlessAccess: boolean;
9475
9485
  poolerEnabled: boolean;
9476
9486
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9548,7 +9558,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9548
9558
  createdAt: string;
9549
9559
  updatedAt: string;
9550
9560
  type: _neondatabase_api_client.EndpointType;
9551
- host: string;
9552
9561
  branchId: string;
9553
9562
  suspendTimeoutSeconds: number;
9554
9563
  creationSource: string;
@@ -9557,6 +9566,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9557
9566
  regionId: string;
9558
9567
  currentState: _neondatabase_api_client.EndpointState;
9559
9568
  disabled: boolean;
9569
+ host: string;
9560
9570
  passwordlessAccess: boolean;
9561
9571
  poolerEnabled: boolean;
9562
9572
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9570,7 +9580,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9570
9580
  createdAt: string;
9571
9581
  updatedAt: string;
9572
9582
  type: _neondatabase_api_client.EndpointType;
9573
- host: string;
9574
9583
  branchId: string;
9575
9584
  suspendTimeoutSeconds: number;
9576
9585
  creationSource: string;
@@ -9579,6 +9588,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9579
9588
  regionId: string;
9580
9589
  currentState: _neondatabase_api_client.EndpointState;
9581
9590
  disabled: boolean;
9591
+ host: string;
9582
9592
  passwordlessAccess: boolean;
9583
9593
  poolerEnabled: boolean;
9584
9594
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9660,7 +9670,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9660
9670
  createdAt: string;
9661
9671
  updatedAt: string;
9662
9672
  type: _neondatabase_api_client.EndpointType;
9663
- host: string;
9664
9673
  branchId: string;
9665
9674
  suspendTimeoutSeconds: number;
9666
9675
  creationSource: string;
@@ -9669,6 +9678,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9669
9678
  regionId: string;
9670
9679
  currentState: _neondatabase_api_client.EndpointState;
9671
9680
  disabled: boolean;
9681
+ host: string;
9672
9682
  passwordlessAccess: boolean;
9673
9683
  poolerEnabled: boolean;
9674
9684
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9682,7 +9692,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9682
9692
  createdAt: string;
9683
9693
  updatedAt: string;
9684
9694
  type: _neondatabase_api_client.EndpointType;
9685
- host: string;
9686
9695
  branchId: string;
9687
9696
  suspendTimeoutSeconds: number;
9688
9697
  creationSource: string;
@@ -9691,6 +9700,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9691
9700
  regionId: string;
9692
9701
  currentState: _neondatabase_api_client.EndpointState;
9693
9702
  disabled: boolean;
9703
+ host: string;
9694
9704
  passwordlessAccess: boolean;
9695
9705
  poolerEnabled: boolean;
9696
9706
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9772,7 +9782,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9772
9782
  createdAt: string;
9773
9783
  updatedAt: string;
9774
9784
  type: _neondatabase_api_client.EndpointType;
9775
- host: string;
9776
9785
  branchId: string;
9777
9786
  suspendTimeoutSeconds: number;
9778
9787
  creationSource: string;
@@ -9781,6 +9790,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9781
9790
  regionId: string;
9782
9791
  currentState: _neondatabase_api_client.EndpointState;
9783
9792
  disabled: boolean;
9793
+ host: string;
9784
9794
  passwordlessAccess: boolean;
9785
9795
  poolerEnabled: boolean;
9786
9796
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9794,7 +9804,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9794
9804
  createdAt: string;
9795
9805
  updatedAt: string;
9796
9806
  type: _neondatabase_api_client.EndpointType;
9797
- host: string;
9798
9807
  branchId: string;
9799
9808
  suspendTimeoutSeconds: number;
9800
9809
  creationSource: string;
@@ -9803,6 +9812,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9803
9812
  regionId: string;
9804
9813
  currentState: _neondatabase_api_client.EndpointState;
9805
9814
  disabled: boolean;
9815
+ host: string;
9806
9816
  passwordlessAccess: boolean;
9807
9817
  poolerEnabled: boolean;
9808
9818
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9884,7 +9894,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9884
9894
  createdAt: string;
9885
9895
  updatedAt: string;
9886
9896
  type: _neondatabase_api_client.EndpointType;
9887
- host: string;
9888
9897
  branchId: string;
9889
9898
  suspendTimeoutSeconds: number;
9890
9899
  creationSource: string;
@@ -9893,6 +9902,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9893
9902
  regionId: string;
9894
9903
  currentState: _neondatabase_api_client.EndpointState;
9895
9904
  disabled: boolean;
9905
+ host: string;
9896
9906
  passwordlessAccess: boolean;
9897
9907
  poolerEnabled: boolean;
9898
9908
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -9906,7 +9916,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9906
9916
  createdAt: string;
9907
9917
  updatedAt: string;
9908
9918
  type: _neondatabase_api_client.EndpointType;
9909
- host: string;
9910
9919
  branchId: string;
9911
9920
  suspendTimeoutSeconds: number;
9912
9921
  creationSource: string;
@@ -9915,6 +9924,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
9915
9924
  regionId: string;
9916
9925
  currentState: _neondatabase_api_client.EndpointState;
9917
9926
  disabled: boolean;
9927
+ host: string;
9918
9928
  passwordlessAccess: boolean;
9919
9929
  poolerEnabled: boolean;
9920
9930
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -10008,7 +10018,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
10008
10018
  createdAt: string;
10009
10019
  updatedAt: string;
10010
10020
  type: _neondatabase_api_client.EndpointType;
10011
- host: string;
10012
10021
  branchId: string;
10013
10022
  suspendTimeoutSeconds: number;
10014
10023
  creationSource: string;
@@ -10017,6 +10026,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
10017
10026
  regionId: string;
10018
10027
  currentState: _neondatabase_api_client.EndpointState;
10019
10028
  disabled: boolean;
10029
+ host: string;
10020
10030
  passwordlessAccess: boolean;
10021
10031
  poolerEnabled: boolean;
10022
10032
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -10030,7 +10040,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
10030
10040
  createdAt: string;
10031
10041
  updatedAt: string;
10032
10042
  type: _neondatabase_api_client.EndpointType;
10033
- host: string;
10034
10043
  branchId: string;
10035
10044
  suspendTimeoutSeconds: number;
10036
10045
  creationSource: string;
@@ -10039,6 +10048,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
10039
10048
  regionId: string;
10040
10049
  currentState: _neondatabase_api_client.EndpointState;
10041
10050
  disabled: boolean;
10051
+ host: string;
10042
10052
  passwordlessAccess: boolean;
10043
10053
  poolerEnabled: boolean;
10044
10054
  poolerMode: _neondatabase_api_client.EndpointPoolerMode;
@@ -10700,8 +10710,14 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
10700
10710
  }>;
10701
10711
  _meta: object;
10702
10712
  _ctx_out: {};
10703
- _input_in: {};
10704
- _input_out: {};
10713
+ _input_in: {} & {
10714
+ page?: number | undefined;
10715
+ perPage?: number | undefined;
10716
+ };
10717
+ _input_out: {} & {
10718
+ page: number;
10719
+ perPage: number;
10720
+ };
10705
10721
  _output_in: ({
10706
10722
  id: string;
10707
10723
  createdAt: Date;
@@ -10916,8 +10932,14 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
10916
10932
  }>;
10917
10933
  _meta: object;
10918
10934
  _ctx_out: {};
10919
- _input_in: {};
10920
- _input_out: {};
10935
+ _input_in: {} & {
10936
+ page?: number | undefined;
10937
+ perPage?: number | undefined;
10938
+ };
10939
+ _input_out: {} & {
10940
+ page: number;
10941
+ perPage: number;
10942
+ };
10921
10943
  _output_in: ({
10922
10944
  id: string;
10923
10945
  createdAt: Date;
@@ -11296,8 +11318,14 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => {
11296
11318
  }>;
11297
11319
  _meta: object;
11298
11320
  _ctx_out: {};
11299
- _input_in: {};
11300
- _input_out: {};
11321
+ _input_in: {} & {
11322
+ page?: number | undefined;
11323
+ perPage?: number | undefined;
11324
+ };
11325
+ _input_out: {} & {
11326
+ page: number;
11327
+ perPage: number;
11328
+ };
11301
11329
  _output_in: ({
11302
11330
  id: string;
11303
11331
  createdAt: Date;
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.60.2",
5
+ "version": "1.61.0",
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.7.2"
75
75
  },
76
76
  "dependencies": {
77
- "@secrecy/trpc-api-types": "1.33.0-dev.48",
77
+ "@secrecy/trpc-api-types": "1.33.0-feat-mails-pagination.1",
78
78
  "@trpc/client": "10.45.2",
79
79
  "@trpc/server": "10.45.2",
80
80
  "@types/libsodium-wrappers-sumo": "^0.7.8",