@homebridge/hap-client 2.0.2 → 2.0.3-beta.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.
- package/.github/npm-version-script-esm.js +85 -0
- package/.github/workflows/beta-release.yml +4 -4
- package/.github/workflows/codeql-analysis.yml +3 -3
- package/.github/workflows/release.yml +1 -1
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/eventedHttpClient/httpParser.d.ts +5 -15
- package/dist/eventedHttpClient/httpParser.d.ts.map +1 -0
- package/dist/eventedHttpClient/httpParser.js +39 -40
- package/dist/eventedHttpClient/httpParser.js.map +1 -1
- package/dist/eventedHttpClient/index.d.ts +10 -2
- package/dist/eventedHttpClient/index.d.ts.map +1 -0
- package/dist/eventedHttpClient/index.js +12 -17
- package/dist/eventedHttpClient/index.js.map +1 -1
- package/dist/hap-types.d.ts +5 -18
- package/dist/hap-types.d.ts.map +1 -0
- package/dist/hap-types.js +45 -62
- package/dist/hap-types.js.map +1 -1
- package/dist/index.d.ts +15 -11
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -78
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +33 -13
- package/dist/interfaces.d.ts.map +1 -0
- package/dist/interfaces.js +1 -2
- package/dist/monitor.d.ts +7 -6
- package/dist/monitor.d.ts.map +1 -0
- package/dist/monitor.js +30 -30
- package/dist/monitor.js.map +1 -1
- package/dist/uuid.d.ts +1 -0
- package/dist/uuid.d.ts.map +1 -0
- package/dist/uuid.js +4 -8
- package/dist/uuid.js.map +1 -1
- package/eslint.config.js +57 -0
- package/package.json +35 -30
- package/scripts/gen-hap-types.ts +26 -22
- package/.eslintrc.json +0 -15
- package/scripts/test.ts +0 -9
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This scripts queries the npm registry to pull out the latest version for a given tag.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import assert from 'node:assert'
|
|
8
|
+
import child_process from 'node:child_process'
|
|
9
|
+
import fs from 'node:fs'
|
|
10
|
+
import process from 'node:process'
|
|
11
|
+
|
|
12
|
+
import semver from 'semver'
|
|
13
|
+
|
|
14
|
+
const BRANCH_VERSION_PATTERN = /^([A-Z]+)-(\d+\.\d+\.\d+)$/i
|
|
15
|
+
|
|
16
|
+
// Load the contents of the package.json file
|
|
17
|
+
const packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'))
|
|
18
|
+
|
|
19
|
+
const refArgument = process.argv[2]
|
|
20
|
+
const tagArgument = process.argv[3] || 'latest'
|
|
21
|
+
|
|
22
|
+
if (refArgument === null) {
|
|
23
|
+
console.error('ref argument is missing')
|
|
24
|
+
console.error('Usage: npm-version-script-esm.js <ref> [tag]')
|
|
25
|
+
process.exit(1)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Queries the NPM registry for the latest version for the provided tag.
|
|
30
|
+
* @param tag The tag to query for.
|
|
31
|
+
* @returns {string} Returns the version.
|
|
32
|
+
*/
|
|
33
|
+
function getTagVersionFromNpm(tag) {
|
|
34
|
+
try {
|
|
35
|
+
return child_process.execSync(`npm info ${packageJSON.name} version --tag="${tag}"`).toString('utf8').trim()
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.error(`Failed to query the npm registry for the latest version for tag: ${tag}`)
|
|
38
|
+
// throw e;
|
|
39
|
+
return '0.0.0'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function desiredTargetVersion(ref) {
|
|
44
|
+
// ref is a GitHub action ref string
|
|
45
|
+
if (ref.startsWith('refs/pull/')) {
|
|
46
|
+
throw new Error('The version script was executed inside a PR!')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
assert(ref.startsWith('refs/heads/'))
|
|
50
|
+
const branchName = ref.slice('refs/heads/'.length)
|
|
51
|
+
|
|
52
|
+
const results = branchName.match(BRANCH_VERSION_PATTERN)
|
|
53
|
+
if (results !== null) {
|
|
54
|
+
if (results[1] !== tagArgument) {
|
|
55
|
+
console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return results[2]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
throw new Error(`Malformed branch name for ref: ${ref}. Can't derive the base version. Use a branch name like: beta-x.x.x or alpha-x.x.x`)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// derive the base version from the branch ref
|
|
65
|
+
const baseVersion = desiredTargetVersion(refArgument)
|
|
66
|
+
|
|
67
|
+
// query the npm registry for the latest version of the provided tag name
|
|
68
|
+
const latestReleasedVersion = getTagVersionFromNpm(tagArgument) // e.g. 0.7.0-beta.12
|
|
69
|
+
const latestReleaseBase = semver.inc(latestReleasedVersion, 'patch') // will produce 0.7.0 (removing the preid, needed for the equality check below)
|
|
70
|
+
|
|
71
|
+
let publishTag
|
|
72
|
+
if (semver.eq(baseVersion, latestReleaseBase)) { // check if we are releasing another version for the latest beta or alpha
|
|
73
|
+
publishTag = latestReleasedVersion // set the current latest beta or alpha to be incremented
|
|
74
|
+
} else {
|
|
75
|
+
publishTag = baseVersion // start of with a new beta or alpha version
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// save the package.json
|
|
79
|
+
packageJSON.version = publishTag
|
|
80
|
+
fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2))
|
|
81
|
+
|
|
82
|
+
// perform the same change to the package-lock.json
|
|
83
|
+
const packageLockJSON = JSON.parse(fs.readFileSync('package-lock.json', 'utf8'))
|
|
84
|
+
packageLockJSON.version = publishTag
|
|
85
|
+
fs.writeFileSync('package-lock.json', JSON.stringify(packageLockJSON, null, 2))
|
|
@@ -21,11 +21,11 @@ jobs:
|
|
|
21
21
|
|
|
22
22
|
if: ${{ github.repository == 'homebridge/hap-client' }}
|
|
23
23
|
|
|
24
|
-
uses: homebridge/.github/.github/workflows/npm-publish.yml@latest
|
|
24
|
+
uses: homebridge/.github/.github/workflows/npm-publish-esm.yml@latest
|
|
25
25
|
with:
|
|
26
|
-
tag:
|
|
26
|
+
tag: beta
|
|
27
27
|
dynamically_adjust_version: true
|
|
28
|
-
npm_version_command:
|
|
29
|
-
pre_id:
|
|
28
|
+
npm_version_command: pre
|
|
29
|
+
pre_id: beta
|
|
30
30
|
secrets:
|
|
31
31
|
npm_auth_token: ${{ secrets.npm_token }}
|
|
@@ -19,6 +19,6 @@ jobs:
|
|
|
19
19
|
|
|
20
20
|
if: ${{ github.repository == 'homebridge/hap-client' }}
|
|
21
21
|
|
|
22
|
-
uses: homebridge/.github/.github/workflows/npm-publish.yml@latest
|
|
22
|
+
uses: homebridge/.github/.github/workflows/npm-publish-esm.yml@latest
|
|
23
23
|
secrets:
|
|
24
24
|
npm_auth_token: ${{ secrets.npm_token }}
|
package/.vscode/settings.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@homebridge/hap-client` will be documented in this file. This project tries to adhere to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
|
|
5
|
+
## BETA
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Updated dependencies, regenerate HAP types
|
|
10
|
+
|
|
5
11
|
## v2.0.2 (2024-08-31)
|
|
6
12
|
|
|
7
13
|
### Changed
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
httpVersion: any;
|
|
4
|
-
statusCode: any;
|
|
5
|
-
statusMessage: any;
|
|
6
|
-
method: any;
|
|
7
|
-
url: any;
|
|
8
|
-
headers: any;
|
|
9
|
-
body: any;
|
|
10
|
-
boundary: any;
|
|
11
|
-
multipart: any;
|
|
12
|
-
additional: any;
|
|
13
|
-
};
|
|
1
|
+
import type { HttpMessageParserResult } from '../interfaces';
|
|
2
|
+
declare function httpMessageParser(message: string | Buffer): HttpMessageParserResult;
|
|
14
3
|
declare namespace httpMessageParser {
|
|
15
4
|
var _isTruthy: (v: any) => boolean;
|
|
16
5
|
var _isNumeric: (v: any) => boolean;
|
|
17
6
|
var _isBuffer: (item: any) => any;
|
|
18
7
|
var _isNodeBufferSupported: () => boolean;
|
|
19
|
-
var _parseHeaders: (body:
|
|
8
|
+
var _parseHeaders: (body: string | Buffer) => {};
|
|
20
9
|
var _requestLineRegex: RegExp;
|
|
21
10
|
var _responseLineRegex: RegExp;
|
|
22
11
|
var _headerNewlineRegex: RegExp;
|
|
23
12
|
var _boundaryRegex: RegExp;
|
|
24
|
-
var _createBuffer: (data:
|
|
13
|
+
var _createBuffer: (data: string) => Buffer;
|
|
25
14
|
}
|
|
26
15
|
export default httpMessageParser;
|
|
16
|
+
//# sourceMappingURL=httpParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpParser.d.ts","sourceRoot":"","sources":["../../src/eventedHttpClient/httpParser.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAE5D,iBAAS,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,2BAsOlD;kBAtOQ,iBAAiB;uBAwO0B,GAAG;wBAID,GAAG;0BAcX,GAAG;;8BAcc,MAAM,GAAG,MAAM;;;;;8BA2B5B,MAAM;;AAIxD,eAAe,iBAAiB,CAAA"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
function httpMessageParser(message) {
|
|
4
2
|
const result = {
|
|
5
3
|
protocol: null,
|
|
@@ -27,9 +25,9 @@ function httpMessageParser(message) {
|
|
|
27
25
|
else {
|
|
28
26
|
return result;
|
|
29
27
|
}
|
|
30
|
-
messageString = messageString.replace(/\r\n/
|
|
28
|
+
messageString = messageString.replace(/\r\n/g, '\n');
|
|
31
29
|
(function () {
|
|
32
|
-
const firstNonWhitespaceRegex = /[\w-]+/
|
|
30
|
+
const firstNonWhitespaceRegex = /[\w-]+/g;
|
|
33
31
|
const firstNonWhitespaceIndex = messageString.search(firstNonWhitespaceRegex);
|
|
34
32
|
if (firstNonWhitespaceIndex > 0) {
|
|
35
33
|
message = message.slice(firstNonWhitespaceIndex, message.length);
|
|
@@ -41,8 +39,8 @@ function httpMessageParser(message) {
|
|
|
41
39
|
const requestLineMatch = possibleRequestLine.match(httpMessageParser._requestLineRegex);
|
|
42
40
|
if (Array.isArray(requestLineMatch) && requestLineMatch.length > 1) {
|
|
43
41
|
result.protocol = requestLineMatch[1];
|
|
44
|
-
result.httpVersion = parseFloat(requestLineMatch[2]);
|
|
45
|
-
result.statusCode = parseInt(requestLineMatch[3], 10);
|
|
42
|
+
result.httpVersion = Number.parseFloat(requestLineMatch[2]);
|
|
43
|
+
result.statusCode = Number.parseInt(requestLineMatch[3], 10);
|
|
46
44
|
result.statusMessage = requestLineMatch[4];
|
|
47
45
|
}
|
|
48
46
|
else {
|
|
@@ -50,7 +48,7 @@ function httpMessageParser(message) {
|
|
|
50
48
|
if (Array.isArray(responseLineMath) && responseLineMath.length > 1) {
|
|
51
49
|
result.method = responseLineMath[1];
|
|
52
50
|
result.url = responseLineMath[2];
|
|
53
|
-
result.httpVersion = parseFloat(responseLineMath[3]);
|
|
51
|
+
result.httpVersion = Number.parseFloat(responseLineMath[3]);
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
})();
|
|
@@ -74,16 +72,17 @@ function httpMessageParser(message) {
|
|
|
74
72
|
if (!result.boundary) {
|
|
75
73
|
const boundaryMatch = messageString.match(httpMessageParser._boundaryRegex);
|
|
76
74
|
if (Array.isArray(boundaryMatch) && boundaryMatch.length) {
|
|
77
|
-
fullBoundary = boundaryMatch[0].replace(/[\r\n]+/
|
|
78
|
-
|
|
79
|
-
result.boundary = boundary;
|
|
75
|
+
fullBoundary = boundaryMatch[0].replace(/[\r\n]+/g, '');
|
|
76
|
+
result.boundary = fullBoundary.replace(/^--/, '');
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
})();
|
|
83
80
|
(function () {
|
|
84
81
|
let start = headerNewlineIndex;
|
|
85
|
-
let end =
|
|
86
|
-
|
|
82
|
+
let end = result.headers && Object.prototype.hasOwnProperty.call(result.headers, 'Content-Length')
|
|
83
|
+
? result.headers['Content-Length'] + start
|
|
84
|
+
: messageString.length;
|
|
85
|
+
const firstBoundaryIndex = fullBoundary === null ? -1 : messageString.indexOf(fullBoundary);
|
|
87
86
|
if (firstBoundaryIndex > -1 && result.boundary) {
|
|
88
87
|
start = headerNewlineIndex;
|
|
89
88
|
end = firstBoundaryIndex;
|
|
@@ -92,8 +91,8 @@ function httpMessageParser(message) {
|
|
|
92
91
|
const body = messageString.slice(start, end);
|
|
93
92
|
result.additional = messageString.slice(end);
|
|
94
93
|
if (body && body.length) {
|
|
95
|
-
if ((result.headers && result.headers['Content-Type'] === 'application/hap+json')
|
|
96
|
-
(result.headers && result.headers['Content-Type'] === 'application/json')) {
|
|
94
|
+
if ((result.headers && result.headers['Content-Type'] === 'application/hap+json')
|
|
95
|
+
|| (result.headers && result.headers['Content-Type'] === 'application/json')) {
|
|
97
96
|
try {
|
|
98
97
|
if (result.headers['Content-Length']) {
|
|
99
98
|
result.body = body;
|
|
@@ -112,16 +111,16 @@ function httpMessageParser(message) {
|
|
|
112
111
|
}
|
|
113
112
|
})();
|
|
114
113
|
(function () {
|
|
115
|
-
if (result.boundary) {
|
|
114
|
+
if (result.boundary && fullBoundary) {
|
|
116
115
|
const multipartStart = messageString.indexOf(fullBoundary) + fullBoundary.length;
|
|
117
116
|
const multipartEnd = messageString.lastIndexOf(fullBoundary);
|
|
118
|
-
const multipartBody = messageString.
|
|
119
|
-
const splitRegex = new RegExp(
|
|
117
|
+
const multipartBody = messageString.substring(multipartStart, multipartEnd);
|
|
118
|
+
const splitRegex = new RegExp(`^${fullBoundary}.*[\n\r]?$`, 'gm');
|
|
120
119
|
const parts = multipartBody.split(splitRegex);
|
|
121
|
-
result.multipart = parts.filter(httpMessageParser._isTruthy).map(
|
|
120
|
+
result.multipart = parts.filter(httpMessageParser._isTruthy).map((part, i) => {
|
|
122
121
|
const result = {
|
|
123
122
|
headers: null,
|
|
124
|
-
body:
|
|
123
|
+
body: '',
|
|
125
124
|
meta: {
|
|
126
125
|
body: {
|
|
127
126
|
byteOffset: {
|
|
@@ -131,7 +130,7 @@ function httpMessageParser(message) {
|
|
|
131
130
|
},
|
|
132
131
|
},
|
|
133
132
|
};
|
|
134
|
-
const newlineRegex = /\n\n|\r\n\r\n/
|
|
133
|
+
const newlineRegex = /\n\n|\r\n\r\n/g;
|
|
135
134
|
let newlineIndex = 0;
|
|
136
135
|
let newlineMatch = newlineRegex.exec(part);
|
|
137
136
|
let body = null;
|
|
@@ -144,7 +143,7 @@ function httpMessageParser(message) {
|
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
|
-
const possibleHeadersString = part.
|
|
146
|
+
const possibleHeadersString = part.substring(0, newlineIndex);
|
|
148
147
|
let startOffset = null;
|
|
149
148
|
let endOffset = null;
|
|
150
149
|
if (newlineIndex > -1) {
|
|
@@ -160,9 +159,9 @@ function httpMessageParser(message) {
|
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
161
|
const boundaryNewlineIndexes = [];
|
|
163
|
-
boundaryIndexes.slice(0, boundaryIndexes.length - 1).forEach(
|
|
162
|
+
boundaryIndexes.slice(0, boundaryIndexes.length - 1).forEach((m, k) => {
|
|
164
163
|
const partBody = message.slice(boundaryIndexes[k], boundaryIndexes[k + 1]).toString();
|
|
165
|
-
let headerNewlineIndex = partBody.search(/\n\n|\r\n\r\n/
|
|
164
|
+
let headerNewlineIndex = partBody.search(/\n\n|\r\n\r\n/g) + 2;
|
|
166
165
|
headerNewlineIndex = boundaryIndexes[k] + headerNewlineIndex;
|
|
167
166
|
boundaryNewlineIndexes.push(headerNewlineIndex);
|
|
168
167
|
});
|
|
@@ -190,34 +189,34 @@ httpMessageParser._isTruthy = function _isTruthy(v) {
|
|
|
190
189
|
return !!v;
|
|
191
190
|
};
|
|
192
191
|
httpMessageParser._isNumeric = function _isNumeric(v) {
|
|
193
|
-
if (typeof v === 'number' && !isNaN(v)) {
|
|
192
|
+
if (typeof v === 'number' && !Number.isNaN(v)) {
|
|
194
193
|
return true;
|
|
195
194
|
}
|
|
196
195
|
v = (v || '').toString().trim();
|
|
197
196
|
if (!v) {
|
|
198
197
|
return false;
|
|
199
198
|
}
|
|
200
|
-
return !isNaN(v);
|
|
199
|
+
return !Number.isNaN(v);
|
|
201
200
|
};
|
|
202
201
|
httpMessageParser._isBuffer = function (item) {
|
|
203
|
-
return ((httpMessageParser._isNodeBufferSupported()
|
|
204
|
-
typeof
|
|
205
|
-
|
|
206
|
-
(item instanceof Object
|
|
207
|
-
item._isBuffer));
|
|
202
|
+
return ((httpMessageParser._isNodeBufferSupported()
|
|
203
|
+
&& typeof globalThis === 'object'
|
|
204
|
+
&& globalThis.Buffer.isBuffer(item))
|
|
205
|
+
|| (item instanceof Object
|
|
206
|
+
&& item._isBuffer));
|
|
208
207
|
};
|
|
209
208
|
httpMessageParser._isNodeBufferSupported = function () {
|
|
210
|
-
return (typeof
|
|
211
|
-
typeof
|
|
212
|
-
typeof
|
|
209
|
+
return (typeof globalThis === 'object'
|
|
210
|
+
&& typeof globalThis.Buffer === 'function'
|
|
211
|
+
&& typeof globalThis.Buffer.isBuffer === 'function');
|
|
213
212
|
};
|
|
214
213
|
httpMessageParser._parseHeaders = function _parseHeaders(body) {
|
|
215
214
|
const headers = {};
|
|
216
215
|
if (typeof body !== 'string') {
|
|
217
216
|
return headers;
|
|
218
217
|
}
|
|
219
|
-
body.split(/[\r\n]/).forEach(
|
|
220
|
-
const match = string.match(/([\w-]+):\s*(.*)/
|
|
218
|
+
body.split(/[\r\n]/).forEach((string) => {
|
|
219
|
+
const match = string.match(/([\w-]+):\s*(.*)/);
|
|
221
220
|
if (Array.isArray(match) && match.length === 3) {
|
|
222
221
|
const key = match[1];
|
|
223
222
|
const value = match[2];
|
|
@@ -226,12 +225,12 @@ httpMessageParser._parseHeaders = function _parseHeaders(body) {
|
|
|
226
225
|
});
|
|
227
226
|
return headers;
|
|
228
227
|
};
|
|
229
|
-
httpMessageParser._requestLineRegex = /(HTTP|EVENT)\/(1\.0|1\.1|2\.0)\s+(\d+)\s+([\w\s-
|
|
230
|
-
httpMessageParser._responseLineRegex = /(GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD|TRACE|CONNECT)\s+(
|
|
231
|
-
httpMessageParser._headerNewlineRegex = /^[\r\n]+/
|
|
228
|
+
httpMessageParser._requestLineRegex = /(HTTP|EVENT)\/(1\.0|1\.1|2\.0)\s+(\d+)\s+([\w\s-]+)/i;
|
|
229
|
+
httpMessageParser._responseLineRegex = /(GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD|TRACE|CONNECT)\s+(\S+)\s+HTTP\/(1\.[01]|2\.0)/i;
|
|
230
|
+
httpMessageParser._headerNewlineRegex = /^[\r\n]+/gm;
|
|
232
231
|
httpMessageParser._boundaryRegex = /(\n|\r\n)+--[\w-]+(\n|\r\n)+/g;
|
|
233
232
|
httpMessageParser._createBuffer = function (data) {
|
|
234
|
-
return
|
|
233
|
+
return Buffer.from(data);
|
|
235
234
|
};
|
|
236
|
-
|
|
235
|
+
export default httpMessageParser;
|
|
237
236
|
//# sourceMappingURL=httpParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpParser.js","sourceRoot":"","sources":["../../src/eventedHttpClient/httpParser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"httpParser.js","sourceRoot":"","sources":["../../src/eventedHttpClient/httpParser.ts"],"names":[],"mappings":"AAWA,SAAS,iBAAiB,CAAC,OAAwB;IACjD,MAAM,MAAM,GAA4B;QACtC,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI;QACjB,UA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AA;AAC5F,iBAAiB,CAAC,kBAAkB,GAAG,wFAAwF,CAAA;AAC/H,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAAA;AACpD,iBAAiB,CAAC,cAAc,GAAG,+BAA+B,CAAA;AAElE,iBAAiB,CAAC,aAAa,GAAG,UAAU,IAAY;IACtD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC1B,CAAC,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { HapEvInstance } from '../interfaces.js';
|
|
2
|
+
import httpMessageParser from './httpParser.js';
|
|
2
3
|
export declare const parseMessage: typeof httpMessageParser;
|
|
3
|
-
export declare function createConnection(instance:
|
|
4
|
+
export declare function createConnection(instance: HapEvInstance, pin: string, body: {
|
|
5
|
+
characteristics: {
|
|
6
|
+
aid: number;
|
|
7
|
+
iid: number;
|
|
8
|
+
ev: boolean;
|
|
9
|
+
}[] | undefined;
|
|
10
|
+
}): import("net").Socket;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eventedHttpClient/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAIrD,OAAO,iBAAiB,MAAM,iBAAiB,CAAA;AAE/C,eAAO,MAAM,YAAY,0BAAoB,CAAA;AAE7C,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,eAAe,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,SAAS,CAAA;CAAE,wBAmBxJ"}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const node_url_1 = require("node:url");
|
|
7
|
-
const httpParser_1 = require("./httpParser");
|
|
8
|
-
exports.parseMessage = httpParser_1.default;
|
|
9
|
-
function createConnection(instance, pin, body) {
|
|
10
|
-
const client = (0, node_net_1.createConnection)({
|
|
1
|
+
import { createConnection as netCreateConnection } from 'node:net';
|
|
2
|
+
import httpMessageParser from './httpParser.js';
|
|
3
|
+
export const parseMessage = httpMessageParser;
|
|
4
|
+
export function createConnection(instance, pin, body) {
|
|
5
|
+
const client = netCreateConnection({
|
|
11
6
|
host: instance.ipAddress,
|
|
12
7
|
port: instance.port,
|
|
13
8
|
});
|
|
14
9
|
client.write(_buildMessage({
|
|
15
10
|
method: 'PUT',
|
|
16
|
-
url:
|
|
11
|
+
url: `http://${instance.ipAddress}:${instance.port}/characteristics`,
|
|
17
12
|
maxAttempts: 1,
|
|
18
13
|
headers: {
|
|
19
14
|
'Content-Type': 'Application/json',
|
|
@@ -27,23 +22,23 @@ function createConnection(instance, pin, body) {
|
|
|
27
22
|
function _headersToString(headers) {
|
|
28
23
|
let response = '';
|
|
29
24
|
for (const header of Object.keys(headers)) {
|
|
30
|
-
response = response + header
|
|
25
|
+
response = `${response + header}: ${headers[header]}\r\n`;
|
|
31
26
|
}
|
|
32
27
|
return (response);
|
|
33
28
|
}
|
|
34
29
|
function _buildMessage(request) {
|
|
35
|
-
const context =
|
|
30
|
+
const context = new URL(request.url);
|
|
36
31
|
let message;
|
|
37
|
-
message = request.method
|
|
32
|
+
message = `${request.method} ${context.pathname}`;
|
|
38
33
|
if (context.search) {
|
|
39
34
|
message = message + context.search;
|
|
40
35
|
}
|
|
41
|
-
message = message
|
|
36
|
+
message = `${message} HTTP/1.1\r\nHost: ${context.host}\r\n${_headersToString(request.headers)}`;
|
|
42
37
|
if (request.body) {
|
|
43
|
-
message = message
|
|
38
|
+
message = `${message}Content-Length: ${request.body.length}\r\n\r\n${request.body}\r\n\r\n`;
|
|
44
39
|
}
|
|
45
40
|
else {
|
|
46
|
-
message = message
|
|
41
|
+
message = `${message}\r\n\r\n`;
|
|
47
42
|
}
|
|
48
43
|
return (message);
|
|
49
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eventedHttpClient/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eventedHttpClient/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAElE,OAAO,iBAAiB,MAAM,iBAAiB,CAAA;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG,iBAAiB,CAAA;AAE7C,MAAM,UAAU,gBAAgB,CAAC,QAAuB,EAAE,GAAW,EAAE,IAAkF;IACvJ,MAAM,MAAM,GAAG,mBAAmB,CAAC;QACjC,IAAI,EAAE,QAAQ,CAAC,SAAS;QACxB,IAAI,EAAE,QAAQ,CAAC,IAAI;KACpB,CAAC,CAAA;IAEF,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;QACzB,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,UAAU,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,kBAAkB;QACpE,WAAW,EAAE,CAAC;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,eAAe,EAAE,GAAG;YACpB,YAAY,EAAE,YAAY;SAC3B;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC,CAAA;IAEH,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,gBAAgB,CAAC,OAA6B;IACrD,IAAI,QAAQ,GAAG,EAAE,CAAA;IAEjB,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1C,QAAQ,GAAG,GAAG,QAAQ,GAAG,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,CAAA;IAC3D,CAAC;IACD,OAAO,CAAC,QAAQ,CAAC,CAAA;AACnB,CAAC;AAED,SAAS,aAAa,CAAC,OAAiF;IACtG,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACpC,IAAI,OAAO,CAAA;IAEX,OAAO,GAAG,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAA;IACjD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,MAAM,CAAA;IACpC,CAAC;IACD,OAAO,GAAG,GAAG,OAAO,sBAAsB,OAAO,CAAC,IAAI,OAAO,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAA;IAChG,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,GAAG,GAAG,OAAO,mBAAmB,OAAO,CAAC,IAAI,CAAC,MAAM,WAAW,OAAO,CAAC,IAAI,UAAU,CAAA;IAC7F,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,GAAG,OAAO,UAAU,CAAA;IAChC,CAAC;IAED,OAAO,CAAC,OAAO,CAAC,CAAA;AAClB,CAAC"}
|
package/dist/hap-types.d.ts
CHANGED
|
@@ -31,8 +31,6 @@ export declare const Services: {
|
|
|
31
31
|
CarbonDioxideSensor: string;
|
|
32
32
|
'0000007F-0000-1000-8000-0026BB765291': string;
|
|
33
33
|
CarbonMonoxideSensor: string;
|
|
34
|
-
'0000005A-0000-1000-8000-0026BB765291': string;
|
|
35
|
-
CloudRelay: string;
|
|
36
34
|
'00000080-0000-1000-8000-0026BB765291': string;
|
|
37
35
|
ContactSensor: string;
|
|
38
36
|
'00000129-0000-1000-8000-0026BB765291': string;
|
|
@@ -130,8 +128,6 @@ export declare const Services: {
|
|
|
130
128
|
ThreadTransport: string;
|
|
131
129
|
'00000203-0000-1000-8000-0026BB765291': string;
|
|
132
130
|
TransferTransportManagement: string;
|
|
133
|
-
'00000056-0000-1000-8000-0026BB765291': string;
|
|
134
|
-
Tunnel: string;
|
|
135
131
|
'000000D0-0000-1000-8000-0026BB765291': string;
|
|
136
132
|
Valve: string;
|
|
137
133
|
'0000020A-0000-1000-8000-0026BB765291': string;
|
|
@@ -340,6 +336,10 @@ export declare const Characteristics: {
|
|
|
340
336
|
ManuallyDisabled: string;
|
|
341
337
|
'00000020-0000-1000-8000-0026BB765291': string;
|
|
342
338
|
Manufacturer: string;
|
|
339
|
+
'0000026D-0000-1000-8000-0026BB765291': string;
|
|
340
|
+
MatterFirmwareRevisionNumber: string;
|
|
341
|
+
'0000026E-0000-1000-8000-0026BB765291': string;
|
|
342
|
+
MatterFirmwareUpdateStatus: string;
|
|
343
343
|
'00000243-0000-1000-8000-0026BB765291': string;
|
|
344
344
|
MaximumTransmitPower: string;
|
|
345
345
|
'00000272-0000-1000-8000-0026BB765291': string;
|
|
@@ -422,12 +422,6 @@ export declare const Characteristics: {
|
|
|
422
422
|
RelativeHumidityDehumidifierThreshold: string;
|
|
423
423
|
'000000CA-0000-1000-8000-0026BB765291': string;
|
|
424
424
|
RelativeHumidityHumidifierThreshold: string;
|
|
425
|
-
'0000005E-0000-1000-8000-0026BB765291': string;
|
|
426
|
-
RelayControlPoint: string;
|
|
427
|
-
'0000005B-0000-1000-8000-0026BB765291': string;
|
|
428
|
-
RelayEnabled: string;
|
|
429
|
-
'0000005C-0000-1000-8000-0026BB765291': string;
|
|
430
|
-
RelayState: string;
|
|
431
425
|
'000000D4-0000-1000-8000-0026BB765291': string;
|
|
432
426
|
RemainingDuration: string;
|
|
433
427
|
'000000E1-0000-1000-8000-0026BB765291': string;
|
|
@@ -598,14 +592,6 @@ export declare const Characteristics: {
|
|
|
598
592
|
Token: string;
|
|
599
593
|
'00000242-0000-1000-8000-0026BB765291': string;
|
|
600
594
|
TransmitPower: string;
|
|
601
|
-
'00000061-0000-1000-8000-0026BB765291': string;
|
|
602
|
-
TunnelConnectionTimeout: string;
|
|
603
|
-
'00000060-0000-1000-8000-0026BB765291': string;
|
|
604
|
-
TunneledAccessoryAdvertising: string;
|
|
605
|
-
'00000059-0000-1000-8000-0026BB765291': string;
|
|
606
|
-
TunneledAccessoryConnected: string;
|
|
607
|
-
'00000058-0000-1000-8000-0026BB765291': string;
|
|
608
|
-
TunneledAccessoryStateNumber: string;
|
|
609
595
|
'000000D5-0000-1000-8000-0026BB765291': string;
|
|
610
596
|
ValveType: string;
|
|
611
597
|
'00000037-0000-1000-8000-0026BB765291': string;
|
|
@@ -675,3 +661,4 @@ export declare const Categories: {
|
|
|
675
661
|
TV_SET_TOP_BOX: number;
|
|
676
662
|
TV_STREAMING_STICK: number;
|
|
677
663
|
};
|
|
664
|
+
//# sourceMappingURL=hap-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hap-types.d.ts","sourceRoot":"","sources":["../src/hap-types.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8IpB,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+d3B,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCtB,CAAA"}
|