@m1kad0/hannah-proto 3.0.0 → 3.1.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/dist/compat_interceptor.d.ts +28 -0
- package/dist/compat_interceptor.js +30 -0
- package/dist/compat_versions.d.ts +2 -0
- package/dist/compat_versions.js +75 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-message compatibility check (hannah-proto#9, hannah#217).
|
|
3
|
+
*
|
|
4
|
+
* DRAFT / template — not wired into anything consuming it yet, needs
|
|
5
|
+
* review before use. See python/hannah_proto/compat_interceptor.py for the
|
|
6
|
+
* full design rationale (kept there as the canonical explanation, not
|
|
7
|
+
* repeated here to avoid drift between copies).
|
|
8
|
+
*
|
|
9
|
+
* REQUIRED_COMPAT_VERSIONS comes from generated `./compat_versions`
|
|
10
|
+
* (scripts/gen-compat-versions.js, run by generate.sh) rather than from
|
|
11
|
+
* runtime reflection on the generated message types — ts-proto is
|
|
12
|
+
* configured without `outputSchema`, so there is no descriptor/options
|
|
13
|
+
* data available on the generated types to read compat_version off of
|
|
14
|
+
* directly (unlike the Python/Go versions). See gen-compat-versions.js's
|
|
15
|
+
* header comment for what's unverified there.
|
|
16
|
+
*/
|
|
17
|
+
import type { Interceptor } from "@grpc/grpc-js";
|
|
18
|
+
import { DEFAULT_COMPAT_VERSION } from "./compat_versions";
|
|
19
|
+
export declare const COMPAT_VERSION_METADATA_KEY = "x-compat-version";
|
|
20
|
+
export { DEFAULT_COMPAT_VERSION };
|
|
21
|
+
/**
|
|
22
|
+
* grpc-js client interceptor: attaches x-compat-version metadata to every
|
|
23
|
+
* outgoing call, derived from the RPC method being invoked — so the server
|
|
24
|
+
* only has to reject calls genuinely affected by a breaking change, not
|
|
25
|
+
* every call after any unrelated schema change anywhere (see
|
|
26
|
+
* hannah-proto#9, the SetGroupRooms incident).
|
|
27
|
+
*/
|
|
28
|
+
export declare const compatVersionInterceptor: Interceptor;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compatVersionInterceptor = exports.DEFAULT_COMPAT_VERSION = exports.COMPAT_VERSION_METADATA_KEY = void 0;
|
|
4
|
+
const grpc_js_1 = require("@grpc/grpc-js");
|
|
5
|
+
const compat_versions_1 = require("./compat_versions");
|
|
6
|
+
Object.defineProperty(exports, "DEFAULT_COMPAT_VERSION", { enumerable: true, get: function () { return compat_versions_1.DEFAULT_COMPAT_VERSION; } });
|
|
7
|
+
exports.COMPAT_VERSION_METADATA_KEY = "x-compat-version";
|
|
8
|
+
/** `methodName` is the bare RPC name (e.g. "SubmitText"), matching the keys
|
|
9
|
+
* gen-compat-versions.js writes into REQUIRED_COMPAT_VERSIONS. */
|
|
10
|
+
function getRequiredCompatVersion(methodName) {
|
|
11
|
+
return compat_versions_1.REQUIRED_COMPAT_VERSIONS[methodName] ?? compat_versions_1.DEFAULT_COMPAT_VERSION;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* grpc-js client interceptor: attaches x-compat-version metadata to every
|
|
15
|
+
* outgoing call, derived from the RPC method being invoked — so the server
|
|
16
|
+
* only has to reject calls genuinely affected by a breaking change, not
|
|
17
|
+
* every call after any unrelated schema change anywhere (see
|
|
18
|
+
* hannah-proto#9, the SetGroupRooms incident).
|
|
19
|
+
*/
|
|
20
|
+
const compatVersionInterceptor = (options, nextCall) => {
|
|
21
|
+
const methodName = options.method_definition.path.split("/").pop() ?? "";
|
|
22
|
+
const required = getRequiredCompatVersion(methodName);
|
|
23
|
+
return new grpc_js_1.InterceptingCall(nextCall(options), {
|
|
24
|
+
start(metadata, listener, next) {
|
|
25
|
+
metadata.set(exports.COMPAT_VERSION_METADATA_KEY, String(required));
|
|
26
|
+
next(metadata, listener);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
exports.compatVersionInterceptor = compatVersionInterceptor;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REQUIRED_COMPAT_VERSIONS = exports.DEFAULT_COMPAT_VERSION = void 0;
|
|
4
|
+
// Generated by scripts/gen-compat-versions.js — do not edit by hand.
|
|
5
|
+
exports.DEFAULT_COMPAT_VERSION = 1;
|
|
6
|
+
exports.REQUIRED_COMPAT_VERSIONS = {
|
|
7
|
+
"GetUsers": 1,
|
|
8
|
+
"GetUser": 1,
|
|
9
|
+
"LinkAccount": 1,
|
|
10
|
+
"UnlinkAccount": 1,
|
|
11
|
+
"SetTrustLevel": 1,
|
|
12
|
+
"SetSystemMessages": 1,
|
|
13
|
+
"SetAutomation": 1,
|
|
14
|
+
"Login": 1,
|
|
15
|
+
"CreateUser": 1,
|
|
16
|
+
"UpdateUser": 1,
|
|
17
|
+
"DeleteUser": 1,
|
|
18
|
+
"GetResidents": 1,
|
|
19
|
+
"GetDevices": 1,
|
|
20
|
+
"ControlDevice": 1,
|
|
21
|
+
"SubmitText": 1,
|
|
22
|
+
"SubmitVoice": 1,
|
|
23
|
+
"Announce": 1,
|
|
24
|
+
"Notify": 1,
|
|
25
|
+
"GetSatellites": 1,
|
|
26
|
+
"SetSatelliteRoom": 1,
|
|
27
|
+
"SetSatelliteDisplayName": 1,
|
|
28
|
+
"SetSatelliteOwner": 1,
|
|
29
|
+
"SetSatelliteSmalltalkFollowup": 1,
|
|
30
|
+
"DeleteSatellite": 1,
|
|
31
|
+
"GetRooms": 1,
|
|
32
|
+
"GetGroups": 1,
|
|
33
|
+
"CreateGroup": 1,
|
|
34
|
+
"UpdateGroup": 1,
|
|
35
|
+
"DeleteGroup": 1,
|
|
36
|
+
"SetGroupSatellites": 1,
|
|
37
|
+
"GetTriggers": 1,
|
|
38
|
+
"CreateTrigger": 1,
|
|
39
|
+
"UpdateTrigger": 1,
|
|
40
|
+
"DeleteTrigger": 1,
|
|
41
|
+
"GetAlarms": 1,
|
|
42
|
+
"CreateAlarm": 1,
|
|
43
|
+
"UpdateAlarm": 1,
|
|
44
|
+
"DeleteAlarm": 1,
|
|
45
|
+
"GetSettings": 1,
|
|
46
|
+
"UpdateConfig": 1,
|
|
47
|
+
"GetBleTags": 1,
|
|
48
|
+
"CreateBleTag": 1,
|
|
49
|
+
"UpdateBleTag": 1,
|
|
50
|
+
"DeleteBleTag": 1,
|
|
51
|
+
"GetCars": 1,
|
|
52
|
+
"CreateCar": 1,
|
|
53
|
+
"UpdateCar": 1,
|
|
54
|
+
"DeleteCar": 1,
|
|
55
|
+
"GetCarState": 1,
|
|
56
|
+
"GetAllCarStates": 1,
|
|
57
|
+
"SubscribeEvents": 1,
|
|
58
|
+
"TriggerFirmwareUpdate": 1,
|
|
59
|
+
"TriggerSatelliteRestart": 1,
|
|
60
|
+
"RequestSatelliteCapture": 1,
|
|
61
|
+
"ReleaseSatelliteCapture": 1,
|
|
62
|
+
"StreamSatelliteAudio": 1,
|
|
63
|
+
"TriggerPlink": 1,
|
|
64
|
+
"RegisterProxy": 1,
|
|
65
|
+
"SubmitSatelliteAudio": 1,
|
|
66
|
+
"NotifySatelliteRegistered": 1,
|
|
67
|
+
"NotifySatelliteGone": 1,
|
|
68
|
+
"ProvisionSatellite": 1,
|
|
69
|
+
"EnrollVoiceprint": 1,
|
|
70
|
+
"TimerConnect": 1,
|
|
71
|
+
"GetTimers": 1,
|
|
72
|
+
"DeleteTimer": 1,
|
|
73
|
+
"AgentConnect": 1,
|
|
74
|
+
"AutomationConnect": 1
|
|
75
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export * from './version';
|
|
|
2
2
|
export * as agent from './agent';
|
|
3
3
|
export * as automation from './automation';
|
|
4
4
|
export * as car_state from './car_state';
|
|
5
|
+
export * as compat_interceptor from './compat_interceptor';
|
|
6
|
+
export * as compat_versions from './compat_versions';
|
|
5
7
|
export * as control from './control';
|
|
6
8
|
export * as device_control_menu from './device_control_menu';
|
|
7
9
|
export * as event_stream from './event_stream';
|
package/dist/index.js
CHANGED
|
@@ -36,11 +36,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.weather = exports.wakeword_capture = exports.user_registry = exports.timer_service = exports.timer_admin = exports.speaker_enrollment = exports.shared = exports.satellite_proxy = exports.satellite_provisioning = exports.satellite = exports.options = exports.hannah = exports.event_stream = exports.device_control_menu = exports.control = exports.car_state = exports.automation = exports.agent = void 0;
|
|
39
|
+
exports.weather = exports.wakeword_capture = exports.user_registry = exports.timer_service = exports.timer_admin = exports.speaker_enrollment = exports.shared = exports.satellite_proxy = exports.satellite_provisioning = exports.satellite = exports.options = exports.hannah = exports.event_stream = exports.device_control_menu = exports.control = exports.compat_versions = exports.compat_interceptor = exports.car_state = exports.automation = exports.agent = void 0;
|
|
40
40
|
__exportStar(require("./version"), exports);
|
|
41
41
|
exports.agent = __importStar(require("./agent"));
|
|
42
42
|
exports.automation = __importStar(require("./automation"));
|
|
43
43
|
exports.car_state = __importStar(require("./car_state"));
|
|
44
|
+
exports.compat_interceptor = __importStar(require("./compat_interceptor"));
|
|
45
|
+
exports.compat_versions = __importStar(require("./compat_versions"));
|
|
44
46
|
exports.control = __importStar(require("./control"));
|
|
45
47
|
exports.device_control_menu = __importStar(require("./device_control_menu"));
|
|
46
48
|
exports.event_stream = __importStar(require("./event_stream"));
|
package/package.json
CHANGED