@bobfrankston/miscassists 1.0.47 → 1.0.49

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.
@@ -0,0 +1,10 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(git init:*)",
5
+ "Bash(npx tsc:*)",
6
+ "Bash(del \"y:\\\\dev\\\\projects\\\\NodeJS\\\\miscassists\\\\ports.ts\" \"y:\\\\dev\\\\projects\\\\NodeJS\\\\miscassists\\\\ports.js\" \"y:\\\\dev\\\\projects\\\\NodeJS\\\\miscassists\\\\ports.d.ts\" \"y:\\\\dev\\\\projects\\\\NodeJS\\\\miscassists\\\\ports.js.map\")",
7
+ "Bash(npm install)"
8
+ ]
9
+ }
10
+ }
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # @bobfrankston/miscassists
2
+
3
+ Miscellaneous assists for various tasks including DNS utilities, port number definitions, and integration helpers for jserve and smart home systems.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @bobfrankston/miscassists
9
+ ```
10
+
11
+ ## Features
12
+
13
+ This package provides several utility modules:
14
+
15
+ ### DNS Assist (`dnsassist`)
16
+
17
+ DNS resolution utilities with local IP address prioritization:
18
+
19
+ - **`resolve4(name: string, local?: boolean)`** - Resolves hostname to IPv4, prioritizing local addresses
20
+ - **`resolveLocal4(name: string)`** - Resolves hostname to local IPv4 addresses only
21
+ - **`isLocalIP(ip: string)`** - Checks if an IP address is a local network address
22
+ - **`isThisMachine(ip: string)`** - Checks if an IP address belongs to the current machine
23
+ - **`default_fqdn`** - Default fully qualified domain name
24
+
25
+ ### Ports Configuration (`ports`)
26
+
27
+ Centralized port number definitions for various services:
28
+
29
+ ```typescript
30
+ import { ports } from '@bobfrankston/miscassists';
31
+
32
+ console.log(ports.jserve2); // 10080
33
+ console.log(ports.rmfsite); // 9081
34
+ ```
35
+
36
+ Includes port definitions for:
37
+ - jserve2 (HTTP/HTTPS)
38
+ - Home automation listeners (Hubitat MakerAPI, Home Assistant)
39
+ - RMF site variants (production, beta, alpha)
40
+ - SQL services (TCP, HTTP, proxy)
41
+ - Various application servers
42
+
43
+ ### jServe Support (`jserve`)
44
+
45
+ Types and interfaces for jserve integration:
46
+
47
+ - **`jSubSiteInfo`** - Interface for subsite configuration
48
+ - **`jpriv`** - User privilege levels type
49
+ - **`jprivs`** - Array of privilege levels: admin, user, guest, home, bbs
50
+
51
+ ### Maker API Support (`maker`)
52
+
53
+ TypeScript interface for Hubitat MakerAPI payloads:
54
+
55
+ - **`makerPayload`** - Type definition for smart home device events
56
+
57
+ ## Usage
58
+
59
+ ### Basic Import
60
+
61
+ ```typescript
62
+ import { resolve4, ports, jprivs } from '@bobfrankston/miscassists';
63
+
64
+ // Resolve hostname with local IP priority
65
+ const ip = await resolve4('myserver');
66
+
67
+ // Access port definitions
68
+ const serverPort = ports.jserve2;
69
+
70
+ // Check user privileges
71
+ if (jprivs.includes('admin')) {
72
+ // Admin operations
73
+ }
74
+ ```
75
+
76
+ ### Default Import
77
+
78
+ ```typescript
79
+ import miscassists from '@bobfrankston/miscassists';
80
+
81
+ const ip = await miscassists.resolve4('hostname');
82
+ const port = miscassists.ports.jserve2;
83
+ ```
84
+
85
+ ## Development
86
+
87
+ ### Build
88
+
89
+ ```bash
90
+ npm run build
91
+ ```
92
+
93
+ ### Release
94
+
95
+ ```bash
96
+ npm run release
97
+ ```
98
+
99
+ This will:
100
+ 1. Build the TypeScript sources
101
+ 2. Commit changes
102
+ 3. Increment patch version
103
+ 4. Push to git with tags
104
+ 5. Publish to npm
105
+
106
+ ## License
107
+
108
+ ISC
109
+
110
+ ## Repository
111
+
112
+ [https://github.com/BobFrankston/miscassists](https://github.com/BobFrankston/miscassists)
package/dnsassist.d.ts CHANGED
@@ -1,7 +1,8 @@
1
+ import { default_fqdn } from '@bobfrankston/miscinfo';
1
2
  /***
2
3
  * return IPv4 address giving local addresses priority
3
4
  */
4
- export declare const default_fqdn = "aaz.lt";
5
+ export { default_fqdn };
5
6
  export declare function resolve4(name: string, local?: boolean): Promise<string>;
6
7
  export declare function resolveLocal4(name: string): Promise<string>;
7
8
  interface localIPAndMask {
@@ -15,4 +16,3 @@ interface localIPAndMask {
15
16
  export declare let localIPAndMasks: localIPAndMask[];
16
17
  export declare function isLocalIP(ip: string): boolean;
17
18
  export declare function isThisMachine(ip: string): boolean;
18
- export {};
package/dnsassist.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import dns from 'dns';
2
2
  import os from 'os';
3
+ import { default_fqdn } from '@bobfrankston/miscinfo';
3
4
  /***
4
5
  * return IPv4 address giving local addresses priority
5
6
  */
6
- export const default_fqdn = 'aaz.lt'; // For now
7
+ export { default_fqdn };
7
8
  export async function resolve4(name, local) {
8
9
  if (!name?.includes('.'))
9
10
  name += '.' + default_fqdn; // FQDN Hack
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { resolve4, resolveLocal4, isLocalIP, isThisMachine, default_fqdn } from './dnsassist.js';
2
- import { ports, mqtt } from './ports.js';
2
+ import { ports, mqtt } from '@bobfrankston/miscinfo';
3
3
  import { makerPayload } from './maker.js';
4
4
  import { jSubSiteInfo, jpriv, jprivs } from './jserve.js';
5
5
  export { resolve4, resolveLocal4, isLocalIP, isThisMachine, default_fqdn, ports, mqtt, makerPayload, jSubSiteInfo, jpriv, jprivs };
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { resolve4, resolveLocal4, isLocalIP, isThisMachine, default_fqdn } from './dnsassist.js';
2
- import { ports, mqtt } from './ports.js';
2
+ import { ports, mqtt } from '@bobfrankston/miscinfo';
3
3
  import { jprivs } from './jserve.js';
4
4
  export { resolve4, resolveLocal4, isLocalIP, isThisMachine, default_fqdn, ports, mqtt, jprivs };
5
5
  export const values = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/miscassists",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "description": "Miscelleanous assists for various tasks including defining port numbers",
5
5
  "main": "index.js",
6
6
  "module": "main.js",
@@ -17,13 +17,21 @@
17
17
  "license": "ISC",
18
18
  "type": "module",
19
19
  "dependencies": {
20
+ "@bobfrankston/miscinfo": "^1.0.2",
20
21
  "esm": "^3.2.25"
21
22
  },
22
23
  "devDependencies": {
23
- "@types/node": "^20.12.7"
24
+ "@types/node": "^25.2.1"
24
25
  },
25
26
  "repository": {
26
27
  "type": "git",
27
28
  "url": "https://github.com/BobFrankston/miscassists.git"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ ".dependencies": {
34
+ "@bobfrankston/miscinfo": "file:../../npm/miscinfo",
35
+ "esm": "^3.2.25"
28
36
  }
29
37
  }
package/ports.d.ts DELETED
@@ -1,55 +0,0 @@
1
- export declare const ports: {
2
- jserve2: number;
3
- jserve2s: number;
4
- devlisten: number;
5
- halisten: number;
6
- rmfsite: number;
7
- rmfsites: number;
8
- rmfprod: number;
9
- rmfbeta: number;
10
- rmfalpha: number;
11
- shim: number;
12
- shims: number;
13
- jvport: number;
14
- jvports: number;
15
- sqltcp: number;
16
- sqlhttp: number;
17
- sqlproxy2: number;
18
- sqlproxy: number;
19
- sqlproxys: number;
20
- mlplanel: number;
21
- mlpanels: number;
22
- wizzer: number;
23
- pserve: number;
24
- vserve: number;
25
- checkmake: number;
26
- bbt: number;
27
- backts: number;
28
- backserve: number;
29
- syncer: number;
30
- lifxer: number;
31
- itemw: number;
32
- pinst: number;
33
- stephanie: number;
34
- httpudp: number;
35
- logit: number;
36
- psyncer: number;
37
- rmfAlpha2: number;
38
- carder: number;
39
- cardaid: number;
40
- };
41
- export declare const mqtt: {
42
- host: string;
43
- port: number;
44
- topic: {
45
- rmf: string;
46
- subtopics: {
47
- restart: string;
48
- };
49
- devqtt: {
50
- top: string;
51
- sub: string;
52
- };
53
- };
54
- URL: string;
55
- };
package/ports.js DELETED
@@ -1,81 +0,0 @@
1
- import { default_fqdn } from "./dnsassist.js";
2
- export const ports = {
3
- jserve2: 10080,
4
- jserve2s: 10443, // For now, we use the same port for http and https
5
- devlisten: 9070, // Hubitat MakerAPI http server
6
- halisten: 9071, // Home Assistant MakerAPI http server
7
- rmfsite: 9081, // These will be phased out for the new version
8
- rmfsites: 9082, // used to be for SSL but now any port is ssl or not
9
- rmfprod: 9081, // Secondary port for production version (debugging)
10
- rmfbeta: 9082, // Secondary port for beta version (debugging)
11
- rmfalpha: 9083, // Secondary port for the alpha version
12
- shim: 9084, // Warming -- these are current forwarded!
13
- shims: 9085, //
14
- jvport: 9180, // These are copied in hlib
15
- jvports: 9143,
16
- sqltcp: 9098,
17
- sqlhttp: 9099, // For now
18
- sqlproxy2: 9097, // Replace sqlproxy and share a port for http/https
19
- sqlproxy: 9080,
20
- sqlproxys: 9043,
21
- mlplanel: 9300, // Note: This must jibe with mlpanel since we copy it to another system
22
- mlpanels: 9301,
23
- wizzer: 9310, // Work in progress Wiz control. Internal only so not https for now
24
- pserve: 9311, // Photo server
25
- vserve: 9312, // Video server from IIS
26
- checkmake: 9313,
27
- bbt: 9314, // Bulletin board test
28
- backts: 9315,
29
- backserve: 9316,
30
- syncer: 9317,
31
- lifxer: 9318,
32
- itemw: 9319,
33
- pinst: 9299, // Used for my pings server [currently it has a local value because --install-links isn't cooperating]
34
- stephanie: 9320, // For testing stephanie site locally
35
- httpudp: 9321,
36
- logit: 9322, // logit logger
37
- psyncer: 9324, // Used for the powershell version ??
38
- rmfAlpha2: 9325, // So we can try alternative clients.
39
- carder: 9329,
40
- cardaid: 9330
41
- };
42
- const mqttHost = "pi4c";
43
- const mqttPort = 1883;
44
- export const mqtt = {
45
- host: mqttHost,
46
- port: mqttPort,
47
- topic: {
48
- rmf: "rmf",
49
- subtopics: {
50
- restart: "restart",
51
- },
52
- devqtt: {
53
- top: "rmf",
54
- sub: "devqtt"
55
- }
56
- },
57
- URL: `mstt://${mqttHost}.${default_fqdn}:${mqttPort}`
58
- };
59
- // <port port="9070" name="Listen for Hubitat (experimental)" />
60
- // <port port="9080" name="birdbox1:80" />
61
- // <port port="9081" name="Home port for home.rmf.vc et al" />
62
- // <port port="9082" name="Home port for home.rmf.vc et al for SSL" />
63
- // <port port="9083" name="Web Sockets for home control" />
64
- // <port port="9084" name="Insteon Shim" />
65
- // <port port="9085" name="Insteon Shim SSL (reserved)" />
66
- // <port port="9086" name="shimmer" />
67
- // <port port="9087" name="shimmer SSL (not yet)" />
68
- // <port port="9088" name="TCP For NodeSQLAssit" />
69
- // <port port="9089" name="TCP Shelly Listener (HTLog)" />
70
- // <port port="9389" name="Birdbox1:3389" />
71
- // <port port="9920" name="HC XML" />
72
- // <!-- <port port="9994" name="HC TCP Listener" /> -->
73
- // <port port="9800-9899" name="HC TCP Listener" />
74
- // <!-- <port port="9960-9969" name="HC TCP Listener" /> -->
75
- // <port port="9995" name="HC xcmd" />
76
- // <port port="9996" name="HC Manual" />
77
- // <port port="9997" name="HC HTTP" />
78
- // <port port="9970-9979" name="HC Telnet" />
79
- // <port port="9901" name="Lightify Client1" />
80
- //
81
- //# sourceMappingURL=ports.js.map