@secrecy/lib 1.63.0-feat-orgs.6 → 1.64.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.
@@ -2,7 +2,7 @@ import { usersCache } from './cache.js';
2
2
  import { getStorage } from './client/storage.js';
3
3
  import { createTRPCClient, } from './client.js';
4
4
  import { getPreferedEmail } from './utils.js';
5
- export async function getPublicUser(client, id) {
5
+ async function getPublicUser(client, id) {
6
6
  let user = usersCache.get(id);
7
7
  if (user !== undefined) {
8
8
  return user;
@@ -328,7 +328,7 @@ export class SecrecyCloudClient {
328
328
  }
329
329
  async shareNode(input, progress) {
330
330
  // TODO: Validate input
331
- const nodesMap = await this.#apiClient.cloud.shareNode.mutate(input);
331
+ const nodesMap = await this.#apiClient.cloud.shareNode.query(input);
332
332
  const neededUserKey = Object.entries(nodesMap)
333
333
  .filter(([, nodes]) => nodes.some((node) => node.includeKeys))
334
334
  .map(([userId]) => userId);
@@ -36,7 +36,11 @@ export class SecrecyMailClient {
36
36
  }
37
37
  async create(data, customMessage) {
38
38
  const mail = await this.createDraft(data);
39
- return await this.sendDraft(mail.mailIntegrityId, customMessage);
39
+ const isSent = await this.sendDraft(mail.mailIntegrityId, customMessage);
40
+ if (!isSent) {
41
+ throw new Error('The mail does not sent!');
42
+ }
43
+ return { ...mail, type: 'sent' };
40
44
  }
41
45
  async waitingReceivedMails() {
42
46
  const waitingReceivedMails = await this.#apiClient.mail.waitingReceived.query({});
package/dist/lib/index.js CHANGED
@@ -5,4 +5,3 @@ export * from './client/helpers.js';
5
5
  export * from './sodium.js';
6
6
  export * from './utils/store-buddy.js';
7
7
  export * from './error/index.js';
8
- export { getPublicUser } from './base-client.js';
@@ -1,7 +1,6 @@
1
1
  import { type ApiClient, type RouterOutputs, type RouterInputs, CreateTrpcClientOptions } from './client.js';
2
2
  import { type InfuraNetwork, type PublicUser } from './index.js';
3
3
  import { type SelfUser } from './client/types/user.js';
4
- export declare function getPublicUser(client: ApiClient, id: string): Promise<PublicUser>;
5
4
  export type SecrecyUrls = {
6
5
  auth: string;
7
6
  account: string;
@@ -25,7 +24,7 @@ export declare class BaseClient {
25
24
  static getUser(userId: string, opts?: CreateTrpcClientOptions): Promise<PublicUser>;
26
25
  getUser(userId: string): Promise<PublicUser>;
27
26
  searchUsers(search: string): Promise<PublicUser[]>;
28
- updateProfile(data: RouterInputs['user']['updateProfile']): Promise<Omit<SelfUser, 'account' | 'organization'>>;
27
+ updateProfile(data: RouterInputs['user']['updateProfile']): Promise<Omit<SelfUser, 'account'>>;
29
28
  static isCryptoTransactionDone({ idOrHash, network, opts, }: {
30
29
  idOrHash: string;
31
30
  network?: InfuraNetwork;
@@ -14,7 +14,7 @@ export declare class SecrecyMailClient {
14
14
  deletedMails({ mailType, }: {
15
15
  mailType: ApiMail['type'];
16
16
  }): Promise<Mail[]>;
17
- create(data: NewMail, customMessage?: string | null | undefined): Promise<boolean>;
17
+ create(data: NewMail, customMessage?: string | null | undefined): Promise<SentMail>;
18
18
  waitingReceivedMails(): Promise<WaitingReceivedMail[]>;
19
19
  updateDraft(draftId: string, { body, subject, senderFiles, recipients, replyToId }: Partial<NewMail>): Promise<DraftMail>;
20
20
  deleteDraft(draftId: string): Promise<boolean>;