ntfy 1.4.9 → 1.5.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.
@@ -1,10 +1,7 @@
1
- import type { Config, ResponseData } from './interfaces.js';
1
+ import type { BaseConfig, Config, ResponseData } from './interfaces.js';
2
2
  export declare class NtfyClient {
3
- private readonly serverURL;
4
- /**
5
- * @param serverURL Specify your own ntfy Server. See [Self-hosting](https://docs.ntfy.sh/install/).
6
- */
7
- constructor(serverURL?: string);
3
+ private readonly config?;
4
+ constructor(config?: Partial<BaseConfig>);
8
5
  publish<T extends Config>(config: T): Promise<ResponseData<T>>;
9
6
  }
10
7
  export declare function publish<T extends Config>(config: T): Promise<ResponseData<T>>;
@@ -12,14 +12,11 @@ import { URL } from 'url';
12
12
  import { promises as fs } from 'fs';
13
13
  const defaultServerURL = 'https://ntfy.sh';
14
14
  export class NtfyClient {
15
- /**
16
- * @param serverURL Specify your own ntfy Server. See [Self-hosting](https://docs.ntfy.sh/install/).
17
- */
18
- constructor(serverURL) {
19
- this.serverURL = serverURL || defaultServerURL;
15
+ constructor(config) {
16
+ this.config = config;
20
17
  }
21
18
  publish(config) {
22
- return publish(Object.assign({ server: this.serverURL }, config));
19
+ return publish(Object.assign(Object.assign({ server: defaultServerURL }, this.config), config));
23
20
  }
24
21
  }
25
22
  function buildBroadcastActionString(action) {
@@ -1,10 +1,7 @@
1
- import type { Config, ResponseData } from './interfaces.js';
1
+ import type { BaseConfig, Config, ResponseData } from './interfaces.js';
2
2
  export declare class NtfyClient {
3
- private readonly serverURL;
4
- /**
5
- * @param serverURL Specify your own ntfy Server. See [Self-hosting](https://docs.ntfy.sh/install/).
6
- */
7
- constructor(serverURL?: string);
3
+ private readonly config?;
4
+ constructor(config?: Partial<BaseConfig>);
8
5
  publish<T extends Config>(config: T): Promise<ResponseData<T>>;
9
6
  }
10
7
  export declare function publish<T extends Config>(config: T): Promise<ResponseData<T>>;
@@ -3,14 +3,11 @@ import { URL } from 'url';
3
3
  import { promises as fs } from 'fs';
4
4
  const defaultServerURL = 'https://ntfy.sh';
5
5
  export class NtfyClient {
6
- /**
7
- * @param serverURL Specify your own ntfy Server. See [Self-hosting](https://docs.ntfy.sh/install/).
8
- */
9
- constructor(serverURL) {
10
- this.serverURL = serverURL || defaultServerURL;
6
+ constructor(config) {
7
+ this.config = config;
11
8
  }
12
9
  publish(config) {
13
- return publish(Object.assign({ server: this.serverURL }, config));
10
+ return publish(Object.assign(Object.assign({ server: defaultServerURL }, this.config), config));
14
11
  }
15
12
  }
16
13
  function buildBroadcastActionString(action) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Florian Imdahl <git@ffflorian.de>",
3
3
  "dependencies": {
4
- "axios": "1.6.2"
4
+ "axios": "1.6.3"
5
5
  },
6
6
  "description": "Send notifications over ntfy.sh.",
7
7
  "devDependencies": {
@@ -39,6 +39,6 @@
39
39
  "start": "node --loader ts-node/esm src/cli.ts"
40
40
  },
41
41
  "type": "module",
42
- "version": "1.4.9",
43
- "gitHead": "cbfd6b9d91400a0572ee06491edcfb6fd5b2fc2d"
42
+ "version": "1.5.0",
43
+ "gitHead": "c98f9688df3032b1e045420bbfda361b2dbfa71c"
44
44
  }