core-3nweb-client-lib 0.36.0 → 0.37.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.
@@ -82,7 +82,7 @@ declare namespace web3n.asmail {
82
82
  }
83
83
 
84
84
  interface DeliveryService {
85
-
85
+
86
86
  /**
87
87
  * This returns a promise, resolvable to an allowable total size of a
88
88
  * message
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright (C) 2017 - 2018, 2020 - 2022 3NSoft Inc.
2
+ Copyright (C) 2017 - 2018, 2020 - 2022, 2025 3NSoft Inc.
3
3
 
4
4
  This program is free software: you can redistribute it and/or modify it under
5
5
  the terms of the GNU General Public License as published by the Free Software
@@ -62,6 +62,7 @@ declare namespace web3n.caps.common {
62
62
  }
63
63
 
64
64
  interface MailCAPSetting {
65
+ preflightsTo?: 'all' | { whitelist: string[]; };
65
66
  sendingTo?: 'all' | { whitelist: string[]; };
66
67
  receivingFrom?: 'all' | { whitelist: string[]; };
67
68
  config?: 'all';
@@ -27,6 +27,7 @@ export declare class ASMail {
27
27
  private setupDelivery;
28
28
  private setupInbox;
29
29
  makeASMailCAP(): Service;
30
+ makePreflightOnlyASMailCAP(): Service;
30
31
  close(): Promise<void>;
31
32
  }
32
33
  export {};
@@ -112,6 +112,17 @@ class ASMail {
112
112
  return Object.freeze(w);
113
113
  }
114
114
  ;
115
+ makePreflightOnlyASMailCAP() {
116
+ const { preFlight } = this.delivery.makeCAP();
117
+ const w = {
118
+ getUserId: async () => this.address,
119
+ delivery: {
120
+ preFlight
121
+ }
122
+ };
123
+ return Object.freeze(w);
124
+ }
125
+ ;
115
126
  async close() {
116
127
  await this.inbox.close();
117
128
  await this.delivery.close();
@@ -150,11 +150,16 @@ class Core {
150
150
  }
151
151
  }
152
152
  makeMailCAP(requestedCAPs) {
153
- if (requestedCAPs.mail
154
- && (requestedCAPs.mail.receivingFrom === 'all')
155
- && (requestedCAPs.mail.sendingTo === 'all')) {
153
+ if (!requestedCAPs.mail) {
154
+ return;
155
+ }
156
+ const { sendingTo, receivingFrom, preflightsTo } = requestedCAPs.mail;
157
+ if ((receivingFrom === 'all') && (sendingTo === 'all')) {
156
158
  return this.asmail.makeASMailCAP();
157
159
  }
160
+ else if (preflightsTo === 'all') {
161
+ return this.asmail.makePreflightOnlyASMailCAP();
162
+ }
158
163
  else {
159
164
  return undefined;
160
165
  }