@bobfrankston/miscassists 1.0.46 → 1.0.48
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/README.md +112 -0
- package/package.json +2 -2
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/package.json
CHANGED