@arkstack/notifications 0.19.3 → 0.19.5

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/dist/index.d.ts CHANGED
@@ -281,9 +281,17 @@ declare class PusherRealtimeDriver implements RealtimeDriver {
281
281
  private cluster;
282
282
  private useTLS;
283
283
  private server;
284
+ /**
285
+ * The server address and TLS browsers connect with. Defaults to the address
286
+ * the server uses, which differs when it reaches the server over a private
287
+ * network (e.g. `soketi` inside Docker).
288
+ *
289
+ * @returns
290
+ */
291
+ private publicServer;
284
292
  /**
285
293
  * Public settings a `pusher-js` client needs, including the self-hosted
286
- * server address when `host` is set.
294
+ * server address when one is set.
287
295
  *
288
296
  * @returns
289
297
  */
@@ -450,6 +458,12 @@ type PusherTransportConfig = {
450
458
  */
451
459
  host?: string;
452
460
  port?: number;
461
+ /** The address browsers connect to, when it differs from `host` (defaults to `host`). */
462
+ public_host?: string;
463
+ /** The port browsers connect to (defaults to `port`). */
464
+ public_port?: number;
465
+ /** Whether browsers connect over TLS (defaults to `use_tls`). */
466
+ public_use_tls?: boolean;
453
467
  };
454
468
  type FirebaseTransportConfig = {
455
469
  project_id?: string;
@@ -767,6 +781,9 @@ interface NotificationConfig<T = any> {
767
781
  use_tls?: boolean;
768
782
  host?: string;
769
783
  port?: number;
784
+ public_host?: string;
785
+ public_port?: number;
786
+ public_use_tls?: boolean;
770
787
  };
771
788
  firebase?: ({
772
789
  project_id: string;
package/dist/index.js CHANGED
@@ -1032,17 +1032,35 @@ var PusherRealtimeDriver = class PusherRealtimeDriver {
1032
1032
  };
1033
1033
  }
1034
1034
  /**
1035
+ * The server address and TLS browsers connect with. Defaults to the address
1036
+ * the server uses, which differs when it reaches the server over a private
1037
+ * network (e.g. `soketi` inside Docker).
1038
+ *
1039
+ * @returns
1040
+ */
1041
+ publicServer() {
1042
+ const server = this.server();
1043
+ const host = this.options.public_host ?? (env("PUSHER_PUBLIC_HOST", "") || server.host);
1044
+ const port = this.options.public_port ?? (Number(env("PUSHER_PUBLIC_PORT", 0)) || server.port);
1045
+ const tls = env("PUSHER_PUBLIC_USE_TLS", "");
1046
+ return {
1047
+ host,
1048
+ port,
1049
+ useTLS: this.options.public_use_tls ?? (tls === "" ? this.useTLS() : String(tls) === "true")
1050
+ };
1051
+ }
1052
+ /**
1035
1053
  * Public settings a `pusher-js` client needs, including the self-hosted
1036
- * server address when `host` is set.
1054
+ * server address when one is set.
1037
1055
  *
1038
1056
  * @returns
1039
1057
  */
1040
1058
  clientConfig() {
1041
- const { host, port } = this.server();
1059
+ const { host, port, useTLS } = this.publicServer();
1042
1060
  return {
1043
1061
  key: this.key(),
1044
1062
  cluster: this.cluster(),
1045
- forceTLS: this.useTLS(),
1063
+ forceTLS: useTLS,
1046
1064
  ...host ? {
1047
1065
  wsHost: host,
1048
1066
  wsPort: port,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/notifications",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
4
4
  "type": "module",
5
5
  "description": "Framework-agnostic notification module for Arkstack and Nodejs, providing support for multi-channel notification delivery.",
6
6
  "homepage": "https://arkstack.toneflix.net/guide/notifications",
@@ -34,17 +34,17 @@
34
34
  "africastalking": "^0.8.0",
35
35
  "nodemailer": "^9.0.3",
36
36
  "twilio": "^6.0.2",
37
- "@arkstack/common": "^0.19.3"
37
+ "@arkstack/common": "^0.19.5"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@kanun-hq/plugin-phone": "^0.1.8",
41
41
  "firebase-admin": "^13.0.0",
42
42
  "pusher": "^5.2.0",
43
- "@arkstack/database": "^0.19.3",
44
- "@arkstack/contract": "^0.19.3",
45
- "@arkstack/driver-express": "^0.19.3",
46
- "@arkstack/driver-h3": "^0.19.3",
47
- "@arkstack/jobs": "^0.19.3"
43
+ "@arkstack/database": "^0.19.5",
44
+ "@arkstack/contract": "^0.19.5",
45
+ "@arkstack/driver-h3": "^0.19.5",
46
+ "@arkstack/driver-express": "^0.19.5",
47
+ "@arkstack/jobs": "^0.19.5"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
50
  "@arkstack/driver-express": {