@kusinta/iot-schema 0.1.0-beta.2 → 0.1.0-beta.20

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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +49 -0
  3. package/package.json +9 -2
  4. package/src/kusinta/iot/access/v1/acl_pb.d.ts +3 -3
  5. package/src/kusinta/iot/access/v1/acl_pb.js +3 -3
  6. package/src/kusinta/iot/access/v1/roles_pb.d.ts +1 -1
  7. package/src/kusinta/iot/access/v1/roles_pb.js +1 -1
  8. package/src/kusinta/iot/common/v1/types_pb.d.ts +1 -1
  9. package/src/kusinta/iot/common/v1/types_pb.js +1 -1
  10. package/src/kusinta/iot/connector/v1/connector_pb.d.ts +31 -24
  11. package/src/kusinta/iot/connector/v1/connector_pb.js +16 -15
  12. package/src/kusinta/iot/connector/v1/connector_service_pb.d.ts +6 -6
  13. package/src/kusinta/iot/connector/v1/connector_service_pb.js +3 -3
  14. package/src/kusinta/iot/device/v1/descriptor_pb.d.ts +3 -3
  15. package/src/kusinta/iot/device/v1/descriptor_pb.js +3 -3
  16. package/src/kusinta/iot/device/v1/device_pb.d.ts +36 -4
  17. package/src/kusinta/iot/device/v1/device_pb.js +4 -4
  18. package/src/kusinta/iot/device/v1/matter_options_pb.d.ts +46 -0
  19. package/src/kusinta/iot/device/v1/matter_options_pb.js +50 -0
  20. package/src/kusinta/iot/device/v1/properties_pb.d.ts +175 -208
  21. package/src/kusinta/iot/device/v1/properties_pb.js +3 -2
  22. package/src/kusinta/iot/device/v1/property_update_pb.d.ts +37 -4
  23. package/src/kusinta/iot/device/v1/property_update_pb.js +2 -2
  24. package/src/kusinta/iot/identity/v1/identity_pb.d.ts +1 -1
  25. package/src/kusinta/iot/identity/v1/identity_pb.js +1 -1
  26. package/src/kusinta/iot/registration/v1/registration_pb.d.ts +170 -0
  27. package/src/kusinta/iot/registration/v1/registration_pb.js +61 -0
  28. package/src/kusinta/iot/registration/v1/registration_service_pb.d.ts +34 -0
  29. package/src/kusinta/iot/registration/v1/registration_service_pb.js +19 -0
  30. package/src/kusinta/iot/signaling/v1/signaling_pb.d.ts +319 -0
  31. package/src/kusinta/iot/signaling/v1/signaling_pb.js +83 -0
  32. package/src/kusinta/iot/signaling/v1/signaling_service_pb.d.ts +34 -0
  33. package/src/kusinta/iot/signaling/v1/signaling_service_pb.js +19 -0
  34. package/src/kusinta/iot/space/v1/space_pb.d.ts +3 -3
  35. package/src/kusinta/iot/space/v1/space_pb.js +3 -3
  36. package/src/kusinta/iot/vendor/homematic/v1/homematic_pb.d.ts +16 -11
  37. package/src/kusinta/iot/vendor/homematic/v1/homematic_pb.js +2 -2
  38. package/src/kusinta/iot/webrtc/v1/app_token_pb.d.ts +153 -0
  39. package/src/kusinta/iot/webrtc/v1/app_token_pb.js +28 -0
  40. package/src/kusinta/iot/webrtc/v1/command_pb.d.ts +3 -3
  41. package/src/kusinta/iot/webrtc/v1/command_pb.js +2 -2
  42. package/src/kusinta/iot/webrtc/v1/device_state_pb.d.ts +67 -4
  43. package/src/kusinta/iot/webrtc/v1/device_state_pb.js +20 -5
  44. package/src/kusinta/iot/webrtc/v1/envelope_pb.d.ts +282 -13
  45. package/src/kusinta/iot/webrtc/v1/envelope_pb.js +70 -11
  46. package/src/kusinta/iot/webrtc/v1/permission_push_pb.d.ts +9 -3
  47. package/src/kusinta/iot/webrtc/v1/permission_push_pb.js +3 -3
  48. package/src/__tests__/access.test.js +0 -134
  49. package/src/__tests__/common.test.js +0 -29
  50. package/src/__tests__/connector.test.js +0 -144
  51. package/src/__tests__/device.test.js +0 -194
  52. package/src/__tests__/identity.test.js +0 -43
  53. package/src/__tests__/space.test.js +0 -54
  54. package/src/__tests__/vendor.test.js +0 -60
  55. package/src/__tests__/webrtc.test.js +0 -268
@@ -1,14 +1,14 @@
1
- // @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts"
1
+ // @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts,import_extension=js"
2
2
  // @generated from file kusinta/iot/webrtc/v1/envelope.proto (package kusinta.iot.webrtc.v1, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
- import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
5
+ import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
6
6
  import type { Message } from "@bufbuild/protobuf";
7
- import type { DeviceId } from "../../identity/v1/identity_pb";
7
+ import type { DeviceId } from "../../identity/v1/identity_pb.js";
8
8
  import type { Timestamp } from "@bufbuild/protobuf/wkt";
9
- import type { DevicePropertyEvent, DeviceStateSnapshot } from "./device_state_pb";
10
- import type { LivePermissionUpdate } from "./permission_push_pb";
11
- import type { CommandResult, DeviceCommand } from "./command_pb";
9
+ import type { DeviceAdded, DevicePropertyEvent, DeviceRemoved, DeviceStateSnapshot } from "./device_state_pb.js";
10
+ import type { LivePermissionUpdate } from "./permission_push_pb.js";
11
+ import type { CommandResult, DeviceCommand } from "./command_pb.js";
12
12
 
13
13
  /**
14
14
  * Describes the file kusinta/iot/webrtc/v1/envelope.proto.
@@ -39,6 +39,22 @@ export declare type Pong = Message<"kusinta.iot.webrtc.v1.Pong"> & {
39
39
  */
40
40
  export declare const PongSchema: GenMessage<Pong>;
41
41
 
42
+ /**
43
+ * @generated from message kusinta.iot.webrtc.v1.HandshakeRejected
44
+ */
45
+ export declare type HandshakeRejected = Message<"kusinta.iot.webrtc.v1.HandshakeRejected"> & {
46
+ /**
47
+ * @generated from field: string reason = 1;
48
+ */
49
+ reason: string;
50
+ };
51
+
52
+ /**
53
+ * Describes the message kusinta.iot.webrtc.v1.HandshakeRejected.
54
+ * Use `create(HandshakeRejectedSchema)` to create a new message.
55
+ */
56
+ export declare const HandshakeRejectedSchema: GenMessage<HandshakeRejected>;
57
+
42
58
  /**
43
59
  * AppHandshake must be the first message sent by the Flutter app on the data channel.
44
60
  * The gateway validates the JWT locally using the mykusinta-api-server public key,
@@ -48,11 +64,21 @@ export declare const PongSchema: GenMessage<Pong>;
48
64
  */
49
65
  export declare type AppHandshake = Message<"kusinta.iot.webrtc.v1.AppHandshake"> & {
50
66
  /**
67
+ * Signed compact JWS. Its payload claims are documented by AppTokenClaims
68
+ * in app_token.proto — the shared contract between mykusinta-api-server
69
+ * (issuer) and the gateway (validator).
70
+ *
51
71
  * @generated from field: string jwt = 1;
52
72
  */
53
73
  jwt: string;
54
74
 
55
75
  /**
76
+ * Initial interest set — an optimisation that saves one round trip, equivalent to
77
+ * sending SubscribeDevices immediately after the handshake. Interest only: naming
78
+ * an id here does not entitle the app to it, and ids the user may not see are
79
+ * refused in the SubscriptionAck that follows. Not the only mechanism — the set is
80
+ * revisable mid-session via AppMessage.subscribe / .unsubscribe.
81
+ *
56
82
  * @generated from field: repeated kusinta.iot.identity.v1.DeviceId subscribe_device_ids = 2;
57
83
  */
58
84
  subscribeDeviceIds: DeviceId[];
@@ -64,6 +90,110 @@ export declare type AppHandshake = Message<"kusinta.iot.webrtc.v1.AppHandshake">
64
90
  */
65
91
  export declare const AppHandshakeSchema: GenMessage<AppHandshake>;
66
92
 
93
+ /**
94
+ * Adds device_ids to what the app wants streamed. Interest, never entitlement:
95
+ * the gateway intersects the request with what the user is permitted to see and
96
+ * reports what it declined in SubscriptionAck.refused. Additive — ids already in
97
+ * the set are a no-op, so a retry after a dropped ack is safe.
98
+ *
99
+ * @generated from message kusinta.iot.webrtc.v1.SubscribeDevices
100
+ */
101
+ export declare type SubscribeDevices = Message<"kusinta.iot.webrtc.v1.SubscribeDevices"> & {
102
+ /**
103
+ * @generated from field: repeated kusinta.iot.identity.v1.DeviceId device_ids = 1;
104
+ */
105
+ deviceIds: DeviceId[];
106
+ };
107
+
108
+ /**
109
+ * Describes the message kusinta.iot.webrtc.v1.SubscribeDevices.
110
+ * Use `create(SubscribeDevicesSchema)` to create a new message.
111
+ */
112
+ export declare const SubscribeDevicesSchema: GenMessage<SubscribeDevices>;
113
+
114
+ /**
115
+ * Removes device_ids from what the app wants streamed. Removing an id the app is
116
+ * not subscribed to is a no-op, not an error.
117
+ *
118
+ * @generated from message kusinta.iot.webrtc.v1.UnsubscribeDevices
119
+ */
120
+ export declare type UnsubscribeDevices = Message<"kusinta.iot.webrtc.v1.UnsubscribeDevices"> & {
121
+ /**
122
+ * @generated from field: repeated kusinta.iot.identity.v1.DeviceId device_ids = 1;
123
+ */
124
+ deviceIds: DeviceId[];
125
+ };
126
+
127
+ /**
128
+ * Describes the message kusinta.iot.webrtc.v1.UnsubscribeDevices.
129
+ * Use `create(UnsubscribeDevicesSchema)` to create a new message.
130
+ */
131
+ export declare const UnsubscribeDevicesSchema: GenMessage<UnsubscribeDevices>;
132
+
133
+ /**
134
+ * A device the gateway declined to add to the interest set. Ids the gateway does
135
+ * not know are refused as NOT_ENTITLED rather than a distinct not-found code, so
136
+ * the ack cannot be used to enumerate devices the user may not see.
137
+ *
138
+ * @generated from message kusinta.iot.webrtc.v1.RefusedSubscription
139
+ */
140
+ export declare type RefusedSubscription = Message<"kusinta.iot.webrtc.v1.RefusedSubscription"> & {
141
+ /**
142
+ * @generated from field: kusinta.iot.identity.v1.DeviceId device_id = 1;
143
+ */
144
+ deviceId?: DeviceId | undefined;
145
+
146
+ /**
147
+ * @generated from field: kusinta.iot.webrtc.v1.GatewayErrorCode code = 2;
148
+ */
149
+ code: GatewayErrorCode;
150
+
151
+ /**
152
+ * human-readable, for logs
153
+ *
154
+ * @generated from field: string message = 3;
155
+ */
156
+ message: string;
157
+ };
158
+
159
+ /**
160
+ * Describes the message kusinta.iot.webrtc.v1.RefusedSubscription.
161
+ * Use `create(RefusedSubscriptionSchema)` to create a new message.
162
+ */
163
+ export declare const RefusedSubscriptionSchema: GenMessage<RefusedSubscription>;
164
+
165
+ /**
166
+ * Answer to SubscribeDevices / UnsubscribeDevices, gateway → Flutter app.
167
+ * `subscribed` is the effective set after the change, not a delta: an app that
168
+ * missed an ack or raced two requests re-syncs from it without reconnecting.
169
+ *
170
+ * @generated from message kusinta.iot.webrtc.v1.SubscriptionAck
171
+ */
172
+ export declare type SubscriptionAck = Message<"kusinta.iot.webrtc.v1.SubscriptionAck"> & {
173
+ /**
174
+ * AppMessage.message_id of the request
175
+ *
176
+ * @generated from field: string in_reply_to = 1;
177
+ */
178
+ inReplyTo: string;
179
+
180
+ /**
181
+ * @generated from field: repeated kusinta.iot.identity.v1.DeviceId subscribed = 2;
182
+ */
183
+ subscribed: DeviceId[];
184
+
185
+ /**
186
+ * @generated from field: repeated kusinta.iot.webrtc.v1.RefusedSubscription refused = 3;
187
+ */
188
+ refused: RefusedSubscription[];
189
+ };
190
+
191
+ /**
192
+ * Describes the message kusinta.iot.webrtc.v1.SubscriptionAck.
193
+ * Use `create(SubscriptionAckSchema)` to create a new message.
194
+ */
195
+ export declare const SubscriptionAckSchema: GenMessage<SubscriptionAck>;
196
+
67
197
  /**
68
198
  * @generated from message kusinta.iot.webrtc.v1.PropertyReadRequest
69
199
  */
@@ -90,6 +220,40 @@ export declare type PropertyReadRequest = Message<"kusinta.iot.webrtc.v1.Propert
90
220
  */
91
221
  export declare const PropertyReadRequestSchema: GenMessage<PropertyReadRequest>;
92
222
 
223
+ /**
224
+ * Session-level error, gateway → Flutter app. Mirrors connector.v1.GatewayError
225
+ * on the connector leg; kept separate because the two legs have different
226
+ * authorization semantics and this one has a closed code vocabulary.
227
+ *
228
+ * @generated from message kusinta.iot.webrtc.v1.GatewayError
229
+ */
230
+ export declare type GatewayError = Message<"kusinta.iot.webrtc.v1.GatewayError"> & {
231
+ /**
232
+ * @generated from field: kusinta.iot.webrtc.v1.GatewayErrorCode code = 1;
233
+ */
234
+ code: GatewayErrorCode;
235
+
236
+ /**
237
+ * human-readable, for logs — never rendered to a user
238
+ *
239
+ * @generated from field: string message = 2;
240
+ */
241
+ message: string;
242
+
243
+ /**
244
+ * structured detail, e.g. {"device_id": "therm-1"}
245
+ *
246
+ * @generated from field: map<string, string> metadata = 3;
247
+ */
248
+ metadata: { [key: string]: string };
249
+ };
250
+
251
+ /**
252
+ * Describes the message kusinta.iot.webrtc.v1.GatewayError.
253
+ * Use `create(GatewayErrorSchema)` to create a new message.
254
+ */
255
+ export declare const GatewayErrorSchema: GenMessage<GatewayError>;
256
+
93
257
  /**
94
258
  * GatewayMessage: gateway → Flutter app
95
259
  *
@@ -135,18 +299,40 @@ export declare type GatewayMessage = Message<"kusinta.iot.webrtc.v1.GatewayMessa
135
299
  case: "commandResult";
136
300
  } | {
137
301
  /**
138
- * error description string
139
- *
140
- * @generated from field: string error = 7;
302
+ * @generated from field: kusinta.iot.webrtc.v1.Pong pong = 8;
303
+ */
304
+ value: Pong;
305
+ case: "pong";
306
+ } | {
307
+ /**
308
+ * @generated from field: kusinta.iot.webrtc.v1.HandshakeRejected handshake_rejected = 9;
309
+ */
310
+ value: HandshakeRejected;
311
+ case: "handshakeRejected";
312
+ } | {
313
+ /**
314
+ * @generated from field: kusinta.iot.webrtc.v1.GatewayError error = 10;
141
315
  */
142
- value: string;
316
+ value: GatewayError;
143
317
  case: "error";
144
318
  } | {
145
319
  /**
146
- * @generated from field: kusinta.iot.webrtc.v1.Pong pong = 8;
320
+ * @generated from field: kusinta.iot.webrtc.v1.SubscriptionAck subscription_ack = 11;
147
321
  */
148
- value: Pong;
149
- case: "pong";
322
+ value: SubscriptionAck;
323
+ case: "subscriptionAck";
324
+ } | {
325
+ /**
326
+ * @generated from field: kusinta.iot.webrtc.v1.DeviceAdded device_added = 12;
327
+ */
328
+ value: DeviceAdded;
329
+ case: "deviceAdded";
330
+ } | {
331
+ /**
332
+ * @generated from field: kusinta.iot.webrtc.v1.DeviceRemoved device_removed = 13;
333
+ */
334
+ value: DeviceRemoved;
335
+ case: "deviceRemoved";
150
336
  } | { case: undefined; value?: undefined };
151
337
  };
152
338
 
@@ -199,6 +385,18 @@ export declare type AppMessage = Message<"kusinta.iot.webrtc.v1.AppMessage"> & {
199
385
  */
200
386
  value: Ping;
201
387
  case: "ping";
388
+ } | {
389
+ /**
390
+ * @generated from field: kusinta.iot.webrtc.v1.SubscribeDevices subscribe = 7;
391
+ */
392
+ value: SubscribeDevices;
393
+ case: "subscribe";
394
+ } | {
395
+ /**
396
+ * @generated from field: kusinta.iot.webrtc.v1.UnsubscribeDevices unsubscribe = 8;
397
+ */
398
+ value: UnsubscribeDevices;
399
+ case: "unsubscribe";
202
400
  } | { case: undefined; value?: undefined };
203
401
  };
204
402
 
@@ -208,3 +406,74 @@ export declare type AppMessage = Message<"kusinta.iot.webrtc.v1.AppMessage"> & {
208
406
  */
209
407
  export declare const AppMessageSchema: GenMessage<AppMessage>;
210
408
 
409
+ /**
410
+ * Machine-readable classification of a session-level gateway error, so the app
411
+ * can branch without string-matching a human sentence. Deliberately an enum here,
412
+ * unlike the free-form code on connector.v1.GatewayError: the app leg is versioned
413
+ * together with the gateway, and clients need an exhaustive switch.
414
+ *
415
+ * @generated from enum kusinta.iot.webrtc.v1.GatewayErrorCode
416
+ */
417
+ export enum GatewayErrorCode {
418
+ /**
419
+ * Sender did not set a code, or sent one this client's schema does not know.
420
+ *
421
+ * @generated from enum value: GATEWAY_ERROR_CODE_UNSPECIFIED = 0;
422
+ */
423
+ UNSPECIFIED = 0,
424
+
425
+ /**
426
+ * Permanent refusal — the user may not see or act on this. Stop asking, tell the user.
427
+ *
428
+ * @generated from enum value: GATEWAY_ERROR_CODE_NOT_ENTITLED = 1;
429
+ */
430
+ NOT_ENTITLED = 1,
431
+
432
+ /**
433
+ * The app sent something malformed. A client bug: log it, do not retry.
434
+ *
435
+ * @generated from enum value: GATEWAY_ERROR_CODE_INVALID_REQUEST = 2;
436
+ */
437
+ INVALID_REQUEST = 2,
438
+
439
+ /**
440
+ * Transient failure. Retrying is reasonable.
441
+ *
442
+ * @generated from enum value: GATEWAY_ERROR_CODE_UNAVAILABLE = 3;
443
+ */
444
+ UNAVAILABLE = 3,
445
+
446
+ /**
447
+ * Gateway-side fault. Not the app's doing; retry cautiously.
448
+ *
449
+ * @generated from enum value: GATEWAY_ERROR_CODE_INTERNAL = 4;
450
+ */
451
+ INTERNAL = 4,
452
+
453
+ /**
454
+ * The user already holds the maximum number of concurrent sessions this
455
+ * gateway will keep, and this attempt is refused. Permanent for this attempt:
456
+ * the limit does not clear on its own, so retrying is exactly the wrong
457
+ * response — the user must end another session first. Distinct from
458
+ * NOT_ENTITLED, which is a statement about what the user may see; this user
459
+ * may, they are simply already connected enough times.
460
+ *
461
+ * The limit itself is gateway configuration and deliberately not modelled
462
+ * here. GatewayError.message carries the specifics so a client can render
463
+ * something actionable.
464
+ *
465
+ * Rollout note: a client whose schema predates this value decodes it as
466
+ * UNSPECIFIED, which is retryable by design. Client handling must therefore
467
+ * ship before or with the gateway that emits it, and the gateway must close
468
+ * the session itself rather than rely on the client standing down.
469
+ *
470
+ * @generated from enum value: GATEWAY_ERROR_CODE_SESSION_LIMIT_REACHED = 5;
471
+ */
472
+ SESSION_LIMIT_REACHED = 5,
473
+ }
474
+
475
+ /**
476
+ * Describes the enum kusinta.iot.webrtc.v1.GatewayErrorCode.
477
+ */
478
+ export declare const GatewayErrorCodeSchema: GenEnum<GatewayErrorCode>;
479
+
@@ -1,19 +1,19 @@
1
- // @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts"
1
+ // @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts,import_extension=js"
2
2
  // @generated from file kusinta/iot/webrtc/v1/envelope.proto (package kusinta.iot.webrtc.v1, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
- import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
5
+ import { enumDesc, fileDesc, messageDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";
6
6
  import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
7
- import { file_kusinta_iot_identity_v1_identity } from "../../identity/v1/identity_pb";
8
- import { file_kusinta_iot_webrtc_v1_command } from "./command_pb";
9
- import { file_kusinta_iot_webrtc_v1_device_state } from "./device_state_pb";
10
- import { file_kusinta_iot_webrtc_v1_permission_push } from "./permission_push_pb";
7
+ import { file_kusinta_iot_identity_v1_identity } from "../../identity/v1/identity_pb.js";
8
+ import { file_kusinta_iot_webrtc_v1_command } from "./command_pb.js";
9
+ import { file_kusinta_iot_webrtc_v1_device_state } from "./device_state_pb.js";
10
+ import { file_kusinta_iot_webrtc_v1_permission_push } from "./permission_push_pb.js";
11
11
 
12
12
  /**
13
13
  * Describes the file kusinta/iot/webrtc/v1/envelope.proto.
14
14
  */
15
15
  export const file_kusinta_iot_webrtc_v1_envelope = /*@__PURE__*/
16
- fileDesc("CiRrdXNpbnRhL2lvdC93ZWJydGMvdjEvZW52ZWxvcGUucHJvdG8SFWt1c2ludGEuaW90LndlYnJ0Yy52MSIGCgRQaW5nIgYKBFBvbmciXAoMQXBwSGFuZHNoYWtlEgsKA2p3dBgBIAEoCRI/ChRzdWJzY3JpYmVfZGV2aWNlX2lkcxgCIAMoCzIhLmt1c2ludGEuaW90LmlkZW50aXR5LnYxLkRldmljZUlkInsKE1Byb3BlcnR5UmVhZFJlcXVlc3QSNAoJZGV2aWNlX2lkGAEgASgLMiEua3VzaW50YS5pb3QuaWRlbnRpdHkudjEuRGV2aWNlSWQSFgoOYXR0cmlidXRlX25hbWUYAiABKAkSFgoOY2x1c3Rlcl9pZF9oZXgYAyABKAkisAMKDkdhdGV3YXlNZXNzYWdlEhIKCm1lc3NhZ2VfaWQYASABKAkSKwoHc2VudF9hdBgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASRAoOc3RhdGVfc25hcHNob3QYAyABKAsyKi5rdXNpbnRhLmlvdC53ZWJydGMudjEuRGV2aWNlU3RhdGVTbmFwc2hvdEgAEkQKDnByb3BlcnR5X2V2ZW50GAQgASgLMioua3VzaW50YS5pb3Qud2VicnRjLnYxLkRldmljZVByb3BlcnR5RXZlbnRIABJIChFwZXJtaXNzaW9uX3VwZGF0ZRgFIAEoCzIrLmt1c2ludGEuaW90LndlYnJ0Yy52MS5MaXZlUGVybWlzc2lvblVwZGF0ZUgAEj4KDmNvbW1hbmRfcmVzdWx0GAYgASgLMiQua3VzaW50YS5pb3Qud2VicnRjLnYxLkNvbW1hbmRSZXN1bHRIABIPCgVlcnJvchgHIAEoCUgAEisKBHBvbmcYCCABKAsyGy5rdXNpbnRhLmlvdC53ZWJydGMudjEuUG9uZ0gAQgkKB3BheWxvYWQivAIKCkFwcE1lc3NhZ2USEgoKbWVzc2FnZV9pZBgBIAEoCRIrCgdzZW50X2F0GAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBI4CgloYW5kc2hha2UYAyABKAsyIy5rdXNpbnRhLmlvdC53ZWJydGMudjEuQXBwSGFuZHNoYWtlSAASNwoHY29tbWFuZBgEIAEoCzIkLmt1c2ludGEuaW90LndlYnJ0Yy52MS5EZXZpY2VDb21tYW5kSAASQgoMcmVhZF9yZXF1ZXN0GAUgASgLMioua3VzaW50YS5pb3Qud2VicnRjLnYxLlByb3BlcnR5UmVhZFJlcXVlc3RIABIrCgRwaW5nGAYgASgLMhsua3VzaW50YS5pb3Qud2VicnRjLnYxLlBpbmdIAEIJCgdwYXlsb2FkQgJIAWIGcHJvdG8z", [file_google_protobuf_timestamp, file_kusinta_iot_identity_v1_identity, file_kusinta_iot_webrtc_v1_command, file_kusinta_iot_webrtc_v1_device_state, file_kusinta_iot_webrtc_v1_permission_push]);
16
+ fileDesc("CiRrdXNpbnRhL2lvdC93ZWJydGMvdjEvZW52ZWxvcGUucHJvdG8SFWt1c2ludGEuaW90LndlYnJ0Yy52MSIGCgRQaW5nIgYKBFBvbmciIwoRSGFuZHNoYWtlUmVqZWN0ZWQSDgoGcmVhc29uGAEgASgJIlwKDEFwcEhhbmRzaGFrZRILCgNqd3QYASABKAkSPwoUc3Vic2NyaWJlX2RldmljZV9pZHMYAiADKAsyIS5rdXNpbnRhLmlvdC5pZGVudGl0eS52MS5EZXZpY2VJZCJJChBTdWJzY3JpYmVEZXZpY2VzEjUKCmRldmljZV9pZHMYASADKAsyIS5rdXNpbnRhLml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ASgLMiQua3VzaW50YS5pb3Qud2VicnRjLnYxLkRldmljZUNvbW1hbmRIABJCCgxyZWFkX3JlcXVlc3QYBSABKAsyKi5rdXNpbnRhLmlvdC53ZWJydGMudjEuUHJvcGVydHlSZWFkUmVxdWVzdEgAEisKBHBpbmcYBiABKAsyGy5rdXNpbnRhLmlvdC53ZWJydGMudjEuUGluZ0gAEjwKCXN1YnNjcmliZRgHIAEoCzInLmt1c2ludGEuaW90LndlYnJ0Yy52MS5TdWJzY3JpYmVEZXZpY2VzSAASQAoLdW5zdWJzY3JpYmUYCCABKAsyKS5rdXNpbnRhLmlvdC53ZWJydGMudjEuVW5zdWJzY3JpYmVEZXZpY2VzSABCCQoHcGF5bG9hZCr2AQoQR2F0ZXdheUVycm9yQ29kZRIiCh5HQVRFV0FZX0VSUk9SX0NPREVfVU5TUEVDSUZJRUQQABIjCh9HQVRFV0FZX0VSUk9SX0NPREVfTk9UX0VOVElUTEVEEAESJgoiR0FURVdBWV9FUlJPUl9DT0RFX0lOVkFMSURfUkVRVUVTVBACEiIKHkdBVEVXQVlfRVJST1JfQ09ERV9VTkFWQUlMQUJMRRADEh8KG0dBVEVXQVlfRVJST1JfQ09ERV9JTlRFUk5BTBAEEiwKKEdBVEVXQVlfRVJST1JfQ09ERV9TRVNTSU9OX0xJTUlUX1JFQUNIRUQQBUICSAFiBnByb3RvMw", [file_google_protobuf_timestamp, file_kusinta_iot_identity_v1_identity, file_kusinta_iot_webrtc_v1_command, file_kusinta_iot_webrtc_v1_device_state, file_kusinta_iot_webrtc_v1_permission_push]);
17
17
 
18
18
  /**
19
19
  * Describes the message kusinta.iot.webrtc.v1.Ping.
@@ -29,31 +29,90 @@ export const PingSchema = /*@__PURE__*/
29
29
  export const PongSchema = /*@__PURE__*/
30
30
  messageDesc(file_kusinta_iot_webrtc_v1_envelope, 1);
31
31
 
32
+ /**
33
+ * Describes the message kusinta.iot.webrtc.v1.HandshakeRejected.
34
+ * Use `create(HandshakeRejectedSchema)` to create a new message.
35
+ */
36
+ export const HandshakeRejectedSchema = /*@__PURE__*/
37
+ messageDesc(file_kusinta_iot_webrtc_v1_envelope, 2);
38
+
32
39
  /**
33
40
  * Describes the message kusinta.iot.webrtc.v1.AppHandshake.
34
41
  * Use `create(AppHandshakeSchema)` to create a new message.
35
42
  */
36
43
  export const AppHandshakeSchema = /*@__PURE__*/
37
- messageDesc(file_kusinta_iot_webrtc_v1_envelope, 2);
44
+ messageDesc(file_kusinta_iot_webrtc_v1_envelope, 3);
45
+
46
+ /**
47
+ * Describes the message kusinta.iot.webrtc.v1.SubscribeDevices.
48
+ * Use `create(SubscribeDevicesSchema)` to create a new message.
49
+ */
50
+ export const SubscribeDevicesSchema = /*@__PURE__*/
51
+ messageDesc(file_kusinta_iot_webrtc_v1_envelope, 4);
52
+
53
+ /**
54
+ * Describes the message kusinta.iot.webrtc.v1.UnsubscribeDevices.
55
+ * Use `create(UnsubscribeDevicesSchema)` to create a new message.
56
+ */
57
+ export const UnsubscribeDevicesSchema = /*@__PURE__*/
58
+ messageDesc(file_kusinta_iot_webrtc_v1_envelope, 5);
59
+
60
+ /**
61
+ * Describes the message kusinta.iot.webrtc.v1.RefusedSubscription.
62
+ * Use `create(RefusedSubscriptionSchema)` to create a new message.
63
+ */
64
+ export const RefusedSubscriptionSchema = /*@__PURE__*/
65
+ messageDesc(file_kusinta_iot_webrtc_v1_envelope, 6);
66
+
67
+ /**
68
+ * Describes the message kusinta.iot.webrtc.v1.SubscriptionAck.
69
+ * Use `create(SubscriptionAckSchema)` to create a new message.
70
+ */
71
+ export const SubscriptionAckSchema = /*@__PURE__*/
72
+ messageDesc(file_kusinta_iot_webrtc_v1_envelope, 7);
38
73
 
39
74
  /**
40
75
  * Describes the message kusinta.iot.webrtc.v1.PropertyReadRequest.
41
76
  * Use `create(PropertyReadRequestSchema)` to create a new message.
42
77
  */
43
78
  export const PropertyReadRequestSchema = /*@__PURE__*/
44
- messageDesc(file_kusinta_iot_webrtc_v1_envelope, 3);
79
+ messageDesc(file_kusinta_iot_webrtc_v1_envelope, 8);
80
+
81
+ /**
82
+ * Describes the message kusinta.iot.webrtc.v1.GatewayError.
83
+ * Use `create(GatewayErrorSchema)` to create a new message.
84
+ */
85
+ export const GatewayErrorSchema = /*@__PURE__*/
86
+ messageDesc(file_kusinta_iot_webrtc_v1_envelope, 9);
45
87
 
46
88
  /**
47
89
  * Describes the message kusinta.iot.webrtc.v1.GatewayMessage.
48
90
  * Use `create(GatewayMessageSchema)` to create a new message.
49
91
  */
50
92
  export const GatewayMessageSchema = /*@__PURE__*/
51
- messageDesc(file_kusinta_iot_webrtc_v1_envelope, 4);
93
+ messageDesc(file_kusinta_iot_webrtc_v1_envelope, 10);
52
94
 
53
95
  /**
54
96
  * Describes the message kusinta.iot.webrtc.v1.AppMessage.
55
97
  * Use `create(AppMessageSchema)` to create a new message.
56
98
  */
57
99
  export const AppMessageSchema = /*@__PURE__*/
58
- messageDesc(file_kusinta_iot_webrtc_v1_envelope, 5);
100
+ messageDesc(file_kusinta_iot_webrtc_v1_envelope, 11);
101
+
102
+ /**
103
+ * Describes the enum kusinta.iot.webrtc.v1.GatewayErrorCode.
104
+ */
105
+ export const GatewayErrorCodeSchema = /*@__PURE__*/
106
+ enumDesc(file_kusinta_iot_webrtc_v1_envelope, 0);
107
+
108
+ /**
109
+ * Machine-readable classification of a session-level gateway error, so the app
110
+ * can branch without string-matching a human sentence. Deliberately an enum here,
111
+ * unlike the free-form code on connector.v1.GatewayError: the app leg is versioned
112
+ * together with the gateway, and clients need an exhaustive switch.
113
+ *
114
+ * @generated from enum kusinta.iot.webrtc.v1.GatewayErrorCode
115
+ */
116
+ export const GatewayErrorCode = /*@__PURE__*/
117
+ tsEnum(GatewayErrorCodeSchema);
59
118
 
@@ -1,11 +1,11 @@
1
- // @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts"
1
+ // @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts,import_extension=js"
2
2
  // @generated from file kusinta/iot/webrtc/v1/permission_push.proto (package kusinta.iot.webrtc.v1, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
5
  import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
6
6
  import type { Message } from "@bufbuild/protobuf";
7
- import type { EffectivePermissions } from "../../access/v1/acl_pb";
8
- import type { DeviceId } from "../../identity/v1/identity_pb";
7
+ import type { EffectivePermissions } from "../../access/v1/acl_pb.js";
8
+ import type { DeviceId } from "../../identity/v1/identity_pb.js";
9
9
 
10
10
  /**
11
11
  * Describes the file kusinta/iot/webrtc/v1/permission_push.proto.
@@ -25,11 +25,17 @@ export declare type LivePermissionUpdate = Message<"kusinta.iot.webrtc.v1.LivePe
25
25
  newPermissions?: EffectivePermissions | undefined;
26
26
 
27
27
  /**
28
+ * Newly entitled devices. Entitlement is not interest: the app is not subscribed
29
+ * to these until it asks via AppMessage.subscribe.
30
+ *
28
31
  * @generated from field: repeated kusinta.iot.identity.v1.DeviceId added_devices = 2;
29
32
  */
30
33
  addedDevices: DeviceId[];
31
34
 
32
35
  /**
36
+ * Devices the user may no longer see. The gateway has already dropped these from
37
+ * the app's interest set — no property events follow, and no unsubscribe is needed.
38
+ *
33
39
  * @generated from field: repeated kusinta.iot.identity.v1.DeviceId removed_devices = 3;
34
40
  */
35
41
  removedDevices: DeviceId[];
@@ -1,10 +1,10 @@
1
- // @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts"
1
+ // @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts,import_extension=js"
2
2
  // @generated from file kusinta/iot/webrtc/v1/permission_push.proto (package kusinta.iot.webrtc.v1, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
5
  import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
6
- import { file_kusinta_iot_identity_v1_identity } from "../../identity/v1/identity_pb";
7
- import { file_kusinta_iot_access_v1_acl } from "../../access/v1/acl_pb";
6
+ import { file_kusinta_iot_identity_v1_identity } from "../../identity/v1/identity_pb.js";
7
+ import { file_kusinta_iot_access_v1_acl } from "../../access/v1/acl_pb.js";
8
8
 
9
9
  /**
10
10
  * Describes the file kusinta/iot/webrtc/v1/permission_push.proto.
@@ -1,134 +0,0 @@
1
- // @ts-check
2
- import { describe, it, expect } from 'vitest'
3
- import { create, toBinary, fromBinary } from '@bufbuild/protobuf'
4
- import { Role, PermissionAction } from '../kusinta/iot/access/v1/roles_pb.js'
5
- import {
6
- PropertyConstraintSchema,
7
- DeviceAclSchema,
8
- EffectivePermissionsSchema,
9
- } from '../kusinta/iot/access/v1/acl_pb.js'
10
-
11
- describe('Role and PermissionAction enums', () => {
12
- it('Role.RESIDENT is defined', () => {
13
- expect(Role.RESIDENT).toBeDefined()
14
- })
15
-
16
- it('Role.PROPERTY_OWNER is defined', () => {
17
- expect(Role.PROPERTY_OWNER).toBeDefined()
18
- })
19
-
20
- it('PermissionAction.WRITE is defined', () => {
21
- expect(PermissionAction.WRITE).toBeDefined()
22
- })
23
- })
24
-
25
- describe('PropertyConstraint — property-owner setpoint limits', () => {
26
- it('round-trips int_max constraint for MaxHeatSetpointLimit', () => {
27
- const c = create(PropertyConstraintSchema, {
28
- attributeName: 'MaxHeatSetpointLimit',
29
- constraint: { case: 'intMax', value: 2200 },
30
- clusterIdHex: '0201',
31
- })
32
- const decoded = fromBinary(PropertyConstraintSchema, toBinary(PropertyConstraintSchema, c))
33
- expect(decoded.attributeName).toBe('MaxHeatSetpointLimit')
34
- expect(decoded.constraint?.case).toBe('intMax')
35
- if (decoded.constraint?.case === 'intMax') {
36
- expect(decoded.constraint.value).toBe(2200)
37
- }
38
- })
39
-
40
- it('round-trips int_min constraint for MinHeatSetpointLimit', () => {
41
- const c = create(PropertyConstraintSchema, {
42
- attributeName: 'MinHeatSetpointLimit',
43
- constraint: { case: 'intMin', value: 1600 },
44
- clusterIdHex: '0201',
45
- })
46
- const decoded = fromBinary(PropertyConstraintSchema, toBinary(PropertyConstraintSchema, c))
47
- expect(decoded.constraint?.case).toBe('intMin')
48
- if (decoded.constraint?.case === 'intMin') {
49
- expect(decoded.constraint.value).toBe(1600)
50
- }
51
- })
52
-
53
- it('round-trips uint_max constraint', () => {
54
- const c = create(PropertyConstraintSchema, {
55
- attributeName: 'CurrentLevel',
56
- constraint: { case: 'uintMax', value: 200 },
57
- clusterIdHex: '0008',
58
- })
59
- const decoded = fromBinary(PropertyConstraintSchema, toBinary(PropertyConstraintSchema, c))
60
- expect(decoded.constraint?.case).toBe('uintMax')
61
- })
62
- })
63
-
64
- describe('DeviceAcl', () => {
65
- it('round-trips resident acl with allowed actions and constraints', () => {
66
- const acl = create(DeviceAclSchema, {
67
- deviceId: { value: 'therm-1' },
68
- userId: { value: 'user-resident-1' },
69
- role: Role.RESIDENT,
70
- allowedActions: [PermissionAction.READ, PermissionAction.WRITE],
71
- allowedAttributes: ['OccupiedHeatingSetpoint', 'LocalTemperature'],
72
- propertyConstraints: [
73
- {
74
- attributeName: 'OccupiedHeatingSetpoint',
75
- constraint: { case: 'intMax', value: 2200 },
76
- clusterIdHex: '0201',
77
- },
78
- {
79
- attributeName: 'OccupiedHeatingSetpoint',
80
- constraint: { case: 'intMin', value: 1600 },
81
- clusterIdHex: '0201',
82
- },
83
- ],
84
- })
85
- const decoded = fromBinary(DeviceAclSchema, toBinary(DeviceAclSchema, acl))
86
- expect(decoded.deviceId?.value).toBe('therm-1')
87
- expect(decoded.userId?.value).toBe('user-resident-1')
88
- expect(decoded.role).toBe(Role.RESIDENT)
89
- expect(decoded.allowedActions).toEqual([PermissionAction.READ, PermissionAction.WRITE])
90
- expect(decoded.allowedAttributes).toEqual(['OccupiedHeatingSetpoint', 'LocalTemperature'])
91
- expect(decoded.propertyConstraints).toHaveLength(2)
92
- expect(decoded.propertyConstraints[0].constraint?.case).toBe('intMax')
93
- })
94
-
95
- it('round-trips property-owner acl', () => {
96
- const acl = create(DeviceAclSchema, {
97
- deviceId: { value: 'therm-1' },
98
- userId: { value: 'user-owner-1' },
99
- role: Role.PROPERTY_OWNER,
100
- allowedActions: [PermissionAction.READ, PermissionAction.WRITE, PermissionAction.OBSERVE],
101
- })
102
- const decoded = fromBinary(DeviceAclSchema, toBinary(DeviceAclSchema, acl))
103
- expect(decoded.role).toBe(Role.PROPERTY_OWNER)
104
- })
105
- })
106
-
107
- describe('EffectivePermissions', () => {
108
- it('round-trips with multiple device acls', () => {
109
- const perms = create(EffectivePermissionsSchema, {
110
- userId: { value: 'user-1' },
111
- gatewayId: { value: 'gw-1' },
112
- deviceAcls: [
113
- {
114
- deviceId: { value: 'therm-1' },
115
- userId: { value: 'user-1' },
116
- role: Role.RESIDENT,
117
- allowedActions: [PermissionAction.READ, PermissionAction.WRITE],
118
- },
119
- {
120
- deviceId: { value: 'light-1' },
121
- userId: { value: 'user-1' },
122
- role: Role.RESIDENT,
123
- allowedActions: [PermissionAction.READ, PermissionAction.WRITE],
124
- },
125
- ],
126
- })
127
- const decoded = fromBinary(EffectivePermissionsSchema, toBinary(EffectivePermissionsSchema, perms))
128
- expect(decoded.userId?.value).toBe('user-1')
129
- expect(decoded.gatewayId?.value).toBe('gw-1')
130
- expect(decoded.deviceAcls).toHaveLength(2)
131
- expect(decoded.deviceAcls[0].deviceId?.value).toBe('therm-1')
132
- expect(decoded.deviceAcls[1].deviceId?.value).toBe('light-1')
133
- })
134
- })