@kusinta/iot-schema 0.1.0-beta.2
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/package.json +31 -0
- package/src/__tests__/access.test.js +134 -0
- package/src/__tests__/common.test.js +29 -0
- package/src/__tests__/connector.test.js +144 -0
- package/src/__tests__/device.test.js +194 -0
- package/src/__tests__/identity.test.js +43 -0
- package/src/__tests__/space.test.js +54 -0
- package/src/__tests__/vendor.test.js +60 -0
- package/src/__tests__/webrtc.test.js +268 -0
- package/src/kusinta/iot/access/v1/acl_pb.d.ts +144 -0
- package/src/kusinta/iot/access/v1/acl_pb.js +36 -0
- package/src/kusinta/iot/access/v1/roles_pb.d.ts +81 -0
- package/src/kusinta/iot/access/v1/roles_pb.js +36 -0
- package/src/kusinta/iot/common/v1/types_pb.d.ts +163 -0
- package/src/kusinta/iot/common/v1/types_pb.js +67 -0
- package/src/kusinta/iot/connector/v1/connector_pb.d.ts +359 -0
- package/src/kusinta/iot/connector/v1/connector_pb.js +101 -0
- package/src/kusinta/iot/connector/v1/connector_service_pb.d.ts +29 -0
- package/src/kusinta/iot/connector/v1/connector_service_pb.js +22 -0
- package/src/kusinta/iot/device/v1/descriptor_pb.d.ts +115 -0
- package/src/kusinta/iot/device/v1/descriptor_pb.js +22 -0
- package/src/kusinta/iot/device/v1/device_pb.d.ts +131 -0
- package/src/kusinta/iot/device/v1/device_pb.js +23 -0
- package/src/kusinta/iot/device/v1/properties_pb.d.ts +580 -0
- package/src/kusinta/iot/device/v1/properties_pb.js +96 -0
- package/src/kusinta/iot/device/v1/property_update_pb.d.ts +112 -0
- package/src/kusinta/iot/device/v1/property_update_pb.js +28 -0
- package/src/kusinta/iot/identity/v1/identity_pb.d.ts +108 -0
- package/src/kusinta/iot/identity/v1/identity_pb.js +54 -0
- package/src/kusinta/iot/space/v1/space_pb.d.ts +86 -0
- package/src/kusinta/iot/space/v1/space_pb.js +21 -0
- package/src/kusinta/iot/vendor/homematic/v1/homematic_pb.d.ts +94 -0
- package/src/kusinta/iot/vendor/homematic/v1/homematic_pb.js +26 -0
- package/src/kusinta/iot/webrtc/v1/command_pb.d.ts +271 -0
- package/src/kusinta/iot/webrtc/v1/command_pb.js +70 -0
- package/src/kusinta/iot/webrtc/v1/device_state_pb.d.ts +67 -0
- package/src/kusinta/iot/webrtc/v1/device_state_pb.js +30 -0
- package/src/kusinta/iot/webrtc/v1/envelope_pb.d.ts +210 -0
- package/src/kusinta/iot/webrtc/v1/envelope_pb.js +59 -0
- package/src/kusinta/iot/webrtc/v1/permission_push_pb.d.ts +48 -0
- package/src/kusinta/iot/webrtc/v1/permission_push_pb.js +21 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { describe, it, expect } from 'vitest'
|
|
3
|
+
import { create, toBinary, fromBinary } from '@bufbuild/protobuf'
|
|
4
|
+
import {
|
|
5
|
+
HomematicVendorExtensionSchema,
|
|
6
|
+
HmThermostatPropsSchema,
|
|
7
|
+
} from '../kusinta/iot/vendor/homematic/v1/homematic_pb.js'
|
|
8
|
+
import { DeviceSchema } from '../kusinta/iot/device/v1/device_pb.js'
|
|
9
|
+
|
|
10
|
+
describe('HmThermostatProps', () => {
|
|
11
|
+
it('round-trips boost_mode and control_mode', () => {
|
|
12
|
+
const p = create(HmThermostatPropsSchema, {
|
|
13
|
+
boostMode: true, boostTimePeriod: 15.5, controlMode: 2, frostProtection: false,
|
|
14
|
+
})
|
|
15
|
+
const decoded = fromBinary(HmThermostatPropsSchema, toBinary(HmThermostatPropsSchema, p))
|
|
16
|
+
expect(decoded.boostMode).toBe(true)
|
|
17
|
+
expect(decoded.boostTimePeriod).toBeCloseTo(15.5, 3)
|
|
18
|
+
expect(decoded.controlMode).toBe(2)
|
|
19
|
+
expect(decoded.frostProtection).toBe(false)
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
describe('HomematicVendorExtension', () => {
|
|
24
|
+
it('round-trips homematic_address and thermostat props', () => {
|
|
25
|
+
const ext = create(HomematicVendorExtensionSchema, {
|
|
26
|
+
homematicAddress: 'MEQ1234567',
|
|
27
|
+
homematicType: 'HmIP-eTRV-2',
|
|
28
|
+
homematicProps: { case: 'hmThermostat', value: { boostMode: false, controlMode: 1, currentProfilePeriod: 3.0 } },
|
|
29
|
+
})
|
|
30
|
+
const decoded = fromBinary(HomematicVendorExtensionSchema, toBinary(HomematicVendorExtensionSchema, ext))
|
|
31
|
+
expect(decoded.homematicAddress).toBe('MEQ1234567')
|
|
32
|
+
expect(decoded.homematicType).toBe('HmIP-eTRV-2')
|
|
33
|
+
expect(decoded.homematicProps?.case).toBe('hmThermostat')
|
|
34
|
+
if (decoded.homematicProps?.case === 'hmThermostat') {
|
|
35
|
+
expect(decoded.homematicProps.value.controlMode).toBe(1)
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
describe('Device with HomematicVendorExtension (field 50)', () => {
|
|
42
|
+
it('stores homematic extension in the oneof', () => {
|
|
43
|
+
const d = create(DeviceSchema, {
|
|
44
|
+
descriptor: { deviceId: { value: 'hm-therm-1' }, matterDeviceTypeId: 0x0301 },
|
|
45
|
+
properties: {
|
|
46
|
+
case: 'homematic',
|
|
47
|
+
value: {
|
|
48
|
+
homematicAddress: 'MEQ1234567',
|
|
49
|
+
homematicType: 'HmIP-eTRV-2',
|
|
50
|
+
homematicProps: { case: 'hmThermostat', value: { controlMode: 2 } },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
const decoded = fromBinary(DeviceSchema, toBinary(DeviceSchema, d))
|
|
55
|
+
expect(decoded.properties?.case).toBe('homematic')
|
|
56
|
+
if (decoded.properties?.case === 'homematic') {
|
|
57
|
+
expect(decoded.properties.value.homematicAddress).toBe('MEQ1234567')
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
})
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { describe, it, expect } from 'vitest'
|
|
3
|
+
import { create, toBinary, fromBinary } from '@bufbuild/protobuf'
|
|
4
|
+
import {
|
|
5
|
+
GatewayMessageSchema,
|
|
6
|
+
AppMessageSchema,
|
|
7
|
+
AppHandshakeSchema,
|
|
8
|
+
} from '../kusinta/iot/webrtc/v1/envelope_pb.js'
|
|
9
|
+
import { DeviceCommandSchema, CommandResultSchema } from '../kusinta/iot/webrtc/v1/command_pb.js'
|
|
10
|
+
import { DeviceStateSnapshotSchema, DevicePropertyEventSchema } from '../kusinta/iot/webrtc/v1/device_state_pb.js'
|
|
11
|
+
import { LivePermissionUpdateSchema } from '../kusinta/iot/webrtc/v1/permission_push_pb.js'
|
|
12
|
+
|
|
13
|
+
describe('AppHandshake', () => {
|
|
14
|
+
it('round-trips jwt and subscribe_device_ids', () => {
|
|
15
|
+
const h = create(AppHandshakeSchema, {
|
|
16
|
+
jwt: 'eyJhbGciOiJSUzI1NiJ9.test.sig',
|
|
17
|
+
subscribeDeviceIds: [{ value: 'dev-1' }, { value: 'dev-2' }],
|
|
18
|
+
})
|
|
19
|
+
const decoded = fromBinary(AppHandshakeSchema, toBinary(AppHandshakeSchema, h))
|
|
20
|
+
expect(decoded.jwt).toBe('eyJhbGciOiJSUzI1NiJ9.test.sig')
|
|
21
|
+
expect(decoded.subscribeDeviceIds).toHaveLength(2)
|
|
22
|
+
expect(decoded.subscribeDeviceIds[0].value).toBe('dev-1')
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
describe('DeviceCommand', () => {
|
|
27
|
+
it('round-trips thermostat setpoint command', () => {
|
|
28
|
+
const cmd = create(DeviceCommandSchema, {
|
|
29
|
+
commandId: 'cmd-uuid-1',
|
|
30
|
+
deviceId: { value: 'therm-1' },
|
|
31
|
+
clusterIdHex: '0201',
|
|
32
|
+
commandName: 'SetpointRaiseLower',
|
|
33
|
+
parameters: { case: 'thermostatSetpoint', value: { mode: 4, amount: 50 } },
|
|
34
|
+
})
|
|
35
|
+
const decoded = fromBinary(DeviceCommandSchema, toBinary(DeviceCommandSchema, cmd))
|
|
36
|
+
expect(decoded.commandId).toBe('cmd-uuid-1')
|
|
37
|
+
expect(decoded.deviceId?.value).toBe('therm-1')
|
|
38
|
+
expect(decoded.commandName).toBe('SetpointRaiseLower')
|
|
39
|
+
expect(decoded.parameters?.case).toBe('thermostatSetpoint')
|
|
40
|
+
if (decoded.parameters?.case === 'thermostatSetpoint') {
|
|
41
|
+
expect(decoded.parameters.value.mode).toBe(4)
|
|
42
|
+
expect(decoded.parameters.value.amount).toBe(50)
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('round-trips on/off command', () => {
|
|
47
|
+
const cmd = create(DeviceCommandSchema, {
|
|
48
|
+
commandId: 'cmd-uuid-2',
|
|
49
|
+
deviceId: { value: 'light-1' },
|
|
50
|
+
clusterIdHex: '0006',
|
|
51
|
+
commandName: 'Toggle',
|
|
52
|
+
parameters: { case: 'onOff', value: { toggle: true } },
|
|
53
|
+
})
|
|
54
|
+
const decoded = fromBinary(DeviceCommandSchema, toBinary(DeviceCommandSchema, cmd))
|
|
55
|
+
expect(decoded.parameters?.case).toBe('onOff')
|
|
56
|
+
if (decoded.parameters?.case === 'onOff') {
|
|
57
|
+
expect(decoded.parameters.value.toggle).toBe(true)
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('round-trips level control command', () => {
|
|
62
|
+
const cmd = create(DeviceCommandSchema, {
|
|
63
|
+
commandId: 'cmd-uuid-3',
|
|
64
|
+
deviceId: { value: 'light-2' },
|
|
65
|
+
clusterIdHex: '0008',
|
|
66
|
+
commandName: 'MoveToLevel',
|
|
67
|
+
parameters: { case: 'levelControl', value: { level: 127, transitionTime: 10 } },
|
|
68
|
+
})
|
|
69
|
+
const decoded = fromBinary(DeviceCommandSchema, toBinary(DeviceCommandSchema, cmd))
|
|
70
|
+
expect(decoded.parameters?.case).toBe('levelControl')
|
|
71
|
+
if (decoded.parameters?.case === 'levelControl') {
|
|
72
|
+
expect(decoded.parameters.value.level).toBe(127)
|
|
73
|
+
expect(decoded.parameters.value.transitionTime).toBe(10)
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it('round-trips window covering lift command', () => {
|
|
78
|
+
const cmd = create(DeviceCommandSchema, {
|
|
79
|
+
commandId: 'cmd-uuid-4',
|
|
80
|
+
deviceId: { value: 'blind-1' },
|
|
81
|
+
clusterIdHex: '0102',
|
|
82
|
+
commandName: 'GoToLiftPercentage',
|
|
83
|
+
parameters: { case: 'windowCoveringLift', value: { liftPercent100ths: 5000 } },
|
|
84
|
+
})
|
|
85
|
+
const decoded = fromBinary(DeviceCommandSchema, toBinary(DeviceCommandSchema, cmd))
|
|
86
|
+
expect(decoded.parameters?.case).toBe('windowCoveringLift')
|
|
87
|
+
if (decoded.parameters?.case === 'windowCoveringLift') {
|
|
88
|
+
expect(decoded.parameters.value.liftPercent100ths).toBe(5000)
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
it('round-trips door lock command', () => {
|
|
93
|
+
const cmd = create(DeviceCommandSchema, {
|
|
94
|
+
commandId: 'cmd-uuid-5',
|
|
95
|
+
deviceId: { value: 'lock-1' },
|
|
96
|
+
clusterIdHex: '0101',
|
|
97
|
+
commandName: 'LockDoor',
|
|
98
|
+
parameters: { case: 'doorLock', value: { lockState: 1 } },
|
|
99
|
+
})
|
|
100
|
+
const decoded = fromBinary(DeviceCommandSchema, toBinary(DeviceCommandSchema, cmd))
|
|
101
|
+
expect(decoded.parameters?.case).toBe('doorLock')
|
|
102
|
+
if (decoded.parameters?.case === 'doorLock') {
|
|
103
|
+
expect(decoded.parameters.value.lockState).toBe(1)
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
describe('CommandResult', () => {
|
|
109
|
+
it('round-trips successful result', () => {
|
|
110
|
+
const result = create(CommandResultSchema, { commandId: 'cmd-uuid-1', success: true })
|
|
111
|
+
const decoded = fromBinary(CommandResultSchema, toBinary(CommandResultSchema, result))
|
|
112
|
+
expect(decoded.commandId).toBe('cmd-uuid-1')
|
|
113
|
+
expect(decoded.success).toBe(true)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
it('round-trips failed result with error', () => {
|
|
117
|
+
const result = create(CommandResultSchema, {
|
|
118
|
+
commandId: 'cmd-uuid-2',
|
|
119
|
+
success: false,
|
|
120
|
+
error: { code: 'PERMISSION_DENIED', message: 'Setpoint exceeds property-owner limit' },
|
|
121
|
+
})
|
|
122
|
+
const decoded = fromBinary(CommandResultSchema, toBinary(CommandResultSchema, result))
|
|
123
|
+
expect(decoded.success).toBe(false)
|
|
124
|
+
expect(decoded.error?.code).toBe('PERMISSION_DENIED')
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
describe('DeviceStateSnapshot', () => {
|
|
129
|
+
it('round-trips with devices and permissions', () => {
|
|
130
|
+
const snap = create(DeviceStateSnapshotSchema, {
|
|
131
|
+
devices: [{
|
|
132
|
+
descriptor: { deviceId: { value: 'therm-1' }, matterDeviceTypeId: 0x0301 },
|
|
133
|
+
properties: { case: 'thermostat', value: { occupiedHeatingSetpoint: 2100 } },
|
|
134
|
+
}],
|
|
135
|
+
permissions: { userId: { value: 'user-1' }, gatewayId: { value: 'gw-1' }, deviceAcls: [] },
|
|
136
|
+
})
|
|
137
|
+
const decoded = fromBinary(DeviceStateSnapshotSchema, toBinary(DeviceStateSnapshotSchema, snap))
|
|
138
|
+
expect(decoded.devices).toHaveLength(1)
|
|
139
|
+
expect(decoded.devices[0].descriptor?.deviceId?.value).toBe('therm-1')
|
|
140
|
+
expect(decoded.permissions?.userId?.value).toBe('user-1')
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
describe('DevicePropertyEvent', () => {
|
|
145
|
+
it('round-trips a property update event', () => {
|
|
146
|
+
const event = create(DevicePropertyEventSchema, {
|
|
147
|
+
update: {
|
|
148
|
+
deviceId: { value: 'therm-1' },
|
|
149
|
+
attributeName: 'LocalTemperature',
|
|
150
|
+
value: { case: 'intValue', value: 2050 },
|
|
151
|
+
clusterIdHex: '0402',
|
|
152
|
+
},
|
|
153
|
+
})
|
|
154
|
+
const decoded = fromBinary(DevicePropertyEventSchema, toBinary(DevicePropertyEventSchema, event))
|
|
155
|
+
expect(decoded.update?.attributeName).toBe('LocalTemperature')
|
|
156
|
+
expect(decoded.update?.value?.case).toBe('intValue')
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
describe('LivePermissionUpdate', () => {
|
|
161
|
+
it('round-trips added and removed devices', () => {
|
|
162
|
+
const update = create(LivePermissionUpdateSchema, {
|
|
163
|
+
newPermissions: { userId: { value: 'user-1' }, gatewayId: { value: 'gw-1' }, deviceAcls: [] },
|
|
164
|
+
addedDevices: [{ value: 'dev-new-1' }],
|
|
165
|
+
removedDevices: [{ value: 'dev-old-1' }],
|
|
166
|
+
changeReason: 'DEVICE_ASSIGNED',
|
|
167
|
+
})
|
|
168
|
+
const decoded = fromBinary(LivePermissionUpdateSchema, toBinary(LivePermissionUpdateSchema, update))
|
|
169
|
+
expect(decoded.addedDevices).toHaveLength(1)
|
|
170
|
+
expect(decoded.addedDevices[0].value).toBe('dev-new-1')
|
|
171
|
+
expect(decoded.removedDevices).toHaveLength(1)
|
|
172
|
+
expect(decoded.changeReason).toBe('DEVICE_ASSIGNED')
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
describe('GatewayMessage oneof payload', () => {
|
|
177
|
+
it('round-trips state_snapshot payload', () => {
|
|
178
|
+
const msg = create(GatewayMessageSchema, {
|
|
179
|
+
messageId: 'gw-msg-001',
|
|
180
|
+
payload: {
|
|
181
|
+
case: 'stateSnapshot',
|
|
182
|
+
value: {
|
|
183
|
+
devices: [],
|
|
184
|
+
permissions: { userId: { value: 'user-1' }, gatewayId: { value: 'gw-1' }, deviceAcls: [] },
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
})
|
|
188
|
+
const decoded = fromBinary(GatewayMessageSchema, toBinary(GatewayMessageSchema, msg))
|
|
189
|
+
expect(decoded.messageId).toBe('gw-msg-001')
|
|
190
|
+
expect(decoded.payload?.case).toBe('stateSnapshot')
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
it('round-trips property_event payload', () => {
|
|
194
|
+
const msg = create(GatewayMessageSchema, {
|
|
195
|
+
messageId: 'gw-msg-002',
|
|
196
|
+
payload: {
|
|
197
|
+
case: 'propertyEvent',
|
|
198
|
+
value: {
|
|
199
|
+
update: {
|
|
200
|
+
deviceId: { value: 'therm-1' },
|
|
201
|
+
attributeName: 'OccupiedHeatingSetpoint',
|
|
202
|
+
value: { case: 'intValue', value: 2100 },
|
|
203
|
+
clusterIdHex: '0201',
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
})
|
|
208
|
+
const decoded = fromBinary(GatewayMessageSchema, toBinary(GatewayMessageSchema, msg))
|
|
209
|
+
expect(decoded.payload?.case).toBe('propertyEvent')
|
|
210
|
+
if (decoded.payload?.case === 'propertyEvent') {
|
|
211
|
+
expect(decoded.payload.value.update?.attributeName).toBe('OccupiedHeatingSetpoint')
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
it('round-trips pong payload', () => {
|
|
216
|
+
const msg = create(GatewayMessageSchema, {
|
|
217
|
+
messageId: 'gw-msg-003',
|
|
218
|
+
payload: { case: 'pong', value: {} },
|
|
219
|
+
})
|
|
220
|
+
const decoded = fromBinary(GatewayMessageSchema, toBinary(GatewayMessageSchema, msg))
|
|
221
|
+
expect(decoded.payload?.case).toBe('pong')
|
|
222
|
+
})
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
describe('AppMessage oneof payload', () => {
|
|
226
|
+
it('round-trips handshake payload', () => {
|
|
227
|
+
const msg = create(AppMessageSchema, {
|
|
228
|
+
messageId: 'app-msg-001',
|
|
229
|
+
payload: {
|
|
230
|
+
case: 'handshake',
|
|
231
|
+
value: { jwt: 'token.payload.sig', subscribeDeviceIds: [{ value: 'dev-1' }] },
|
|
232
|
+
},
|
|
233
|
+
})
|
|
234
|
+
const decoded = fromBinary(AppMessageSchema, toBinary(AppMessageSchema, msg))
|
|
235
|
+
expect(decoded.messageId).toBe('app-msg-001')
|
|
236
|
+
expect(decoded.payload?.case).toBe('handshake')
|
|
237
|
+
if (decoded.payload?.case === 'handshake') {
|
|
238
|
+
expect(decoded.payload.value.jwt).toBe('token.payload.sig')
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
it('round-trips command payload', () => {
|
|
243
|
+
const msg = create(AppMessageSchema, {
|
|
244
|
+
messageId: 'app-msg-002',
|
|
245
|
+
payload: {
|
|
246
|
+
case: 'command',
|
|
247
|
+
value: {
|
|
248
|
+
commandId: 'cmd-1',
|
|
249
|
+
deviceId: { value: 'light-1' },
|
|
250
|
+
clusterIdHex: '0006',
|
|
251
|
+
commandName: 'Toggle',
|
|
252
|
+
parameters: { case: 'onOff', value: { toggle: true } },
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
})
|
|
256
|
+
const decoded = fromBinary(AppMessageSchema, toBinary(AppMessageSchema, msg))
|
|
257
|
+
expect(decoded.payload?.case).toBe('command')
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
it('round-trips ping payload', () => {
|
|
261
|
+
const msg = create(AppMessageSchema, {
|
|
262
|
+
messageId: 'app-msg-003',
|
|
263
|
+
payload: { case: 'ping', value: {} },
|
|
264
|
+
})
|
|
265
|
+
const decoded = fromBinary(AppMessageSchema, toBinary(AppMessageSchema, msg))
|
|
266
|
+
expect(decoded.payload?.case).toBe('ping')
|
|
267
|
+
})
|
|
268
|
+
})
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts"
|
|
2
|
+
// @generated from file kusinta/iot/access/v1/acl.proto (package kusinta.iot.access.v1, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
6
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
7
|
+
import type { DeviceId, GatewayId, UserId } from "../../identity/v1/identity_pb";
|
|
8
|
+
import type { PermissionAction, Role } from "./roles_pb";
|
|
9
|
+
import type { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Describes the file kusinta/iot/access/v1/acl.proto.
|
|
13
|
+
*/
|
|
14
|
+
export declare const file_kusinta_iot_access_v1_acl: GenFile;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* PropertyConstraint bounds a single Matter cluster attribute.
|
|
18
|
+
* attribute_name uses PascalCase Matter attribute naming (e.g. "MaxHeatSetpointLimit").
|
|
19
|
+
* MaxHeatSetpointLimit and MinHeatSetpointLimit are actual Matter Thermostat cluster
|
|
20
|
+
* attributes (0x0016, 0x0015) — the gateway writes them directly via the connector.
|
|
21
|
+
*
|
|
22
|
+
* @generated from message kusinta.iot.access.v1.PropertyConstraint
|
|
23
|
+
*/
|
|
24
|
+
export declare type PropertyConstraint = Message<"kusinta.iot.access.v1.PropertyConstraint"> & {
|
|
25
|
+
/**
|
|
26
|
+
* @generated from field: string attribute_name = 1;
|
|
27
|
+
*/
|
|
28
|
+
attributeName: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @generated from oneof kusinta.iot.access.v1.PropertyConstraint.constraint
|
|
32
|
+
*/
|
|
33
|
+
constraint: {
|
|
34
|
+
/**
|
|
35
|
+
* @generated from field: sint32 int_max = 2;
|
|
36
|
+
*/
|
|
37
|
+
value: number;
|
|
38
|
+
case: "intMax";
|
|
39
|
+
} | {
|
|
40
|
+
/**
|
|
41
|
+
* @generated from field: sint32 int_min = 3;
|
|
42
|
+
*/
|
|
43
|
+
value: number;
|
|
44
|
+
case: "intMin";
|
|
45
|
+
} | {
|
|
46
|
+
/**
|
|
47
|
+
* @generated from field: uint32 uint_max = 4;
|
|
48
|
+
*/
|
|
49
|
+
value: number;
|
|
50
|
+
case: "uintMax";
|
|
51
|
+
} | {
|
|
52
|
+
/**
|
|
53
|
+
* @generated from field: uint32 uint_min = 5;
|
|
54
|
+
*/
|
|
55
|
+
value: number;
|
|
56
|
+
case: "uintMin";
|
|
57
|
+
} | { case: undefined; value?: undefined };
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @generated from field: string cluster_id_hex = 6;
|
|
61
|
+
*/
|
|
62
|
+
clusterIdHex: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Describes the message kusinta.iot.access.v1.PropertyConstraint.
|
|
67
|
+
* Use `create(PropertyConstraintSchema)` to create a new message.
|
|
68
|
+
*/
|
|
69
|
+
export declare const PropertyConstraintSchema: GenMessage<PropertyConstraint>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @generated from message kusinta.iot.access.v1.DeviceAcl
|
|
73
|
+
*/
|
|
74
|
+
export declare type DeviceAcl = Message<"kusinta.iot.access.v1.DeviceAcl"> & {
|
|
75
|
+
/**
|
|
76
|
+
* @generated from field: kusinta.iot.identity.v1.DeviceId device_id = 1;
|
|
77
|
+
*/
|
|
78
|
+
deviceId?: DeviceId | undefined;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @generated from field: kusinta.iot.identity.v1.UserId user_id = 2;
|
|
82
|
+
*/
|
|
83
|
+
userId?: UserId | undefined;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @generated from field: kusinta.iot.access.v1.Role role = 3;
|
|
87
|
+
*/
|
|
88
|
+
role: Role;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @generated from field: repeated kusinta.iot.access.v1.PermissionAction allowed_actions = 4;
|
|
92
|
+
*/
|
|
93
|
+
allowedActions: PermissionAction[];
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* empty = all attributes allowed
|
|
97
|
+
*
|
|
98
|
+
* @generated from field: repeated string allowed_attributes = 5;
|
|
99
|
+
*/
|
|
100
|
+
allowedAttributes: string[];
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @generated from field: repeated kusinta.iot.access.v1.PropertyConstraint property_constraints = 6;
|
|
104
|
+
*/
|
|
105
|
+
propertyConstraints: PropertyConstraint[];
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Describes the message kusinta.iot.access.v1.DeviceAcl.
|
|
110
|
+
* Use `create(DeviceAclSchema)` to create a new message.
|
|
111
|
+
*/
|
|
112
|
+
export declare const DeviceAclSchema: GenMessage<DeviceAcl>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @generated from message kusinta.iot.access.v1.EffectivePermissions
|
|
116
|
+
*/
|
|
117
|
+
export declare type EffectivePermissions = Message<"kusinta.iot.access.v1.EffectivePermissions"> & {
|
|
118
|
+
/**
|
|
119
|
+
* @generated from field: kusinta.iot.identity.v1.UserId user_id = 1;
|
|
120
|
+
*/
|
|
121
|
+
userId?: UserId | undefined;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @generated from field: kusinta.iot.identity.v1.GatewayId gateway_id = 2;
|
|
125
|
+
*/
|
|
126
|
+
gatewayId?: GatewayId | undefined;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @generated from field: repeated kusinta.iot.access.v1.DeviceAcl device_acls = 3;
|
|
130
|
+
*/
|
|
131
|
+
deviceAcls: DeviceAcl[];
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @generated from field: google.protobuf.Timestamp valid_at = 4;
|
|
135
|
+
*/
|
|
136
|
+
validAt?: Timestamp | undefined;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Describes the message kusinta.iot.access.v1.EffectivePermissions.
|
|
141
|
+
* Use `create(EffectivePermissionsSchema)` to create a new message.
|
|
142
|
+
*/
|
|
143
|
+
export declare const EffectivePermissionsSchema: GenMessage<EffectivePermissions>;
|
|
144
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts"
|
|
2
|
+
// @generated from file kusinta/iot/access/v1/acl.proto (package kusinta.iot.access.v1, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
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_access_v1_roles } from "./roles_pb";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Describes the file kusinta/iot/access/v1/acl.proto.
|
|
12
|
+
*/
|
|
13
|
+
export const file_kusinta_iot_access_v1_acl = /*@__PURE__*/
|
|
14
|
+
fileDesc("Ch9rdXNpbnRhL2lvdC9hY2Nlc3MvdjEvYWNsLnByb3RvEhVrdXNpbnRhLmlvdC5hY2Nlc3MudjEioAEKElByb3BlcnR5Q29uc3RyYWludBIWCg5hdHRyaWJ1dGVfbmFtZRgBIAEoCRIRCgdpbnRfbWF4GAIgASgRSAASEQoHaW50X21pbhgDIAEoEUgAEhIKCHVpbnRfbWF4GAQgASgNSAASEgoIdWludF9taW4YBSABKA1IABIWCg5jbHVzdGVyX2lkX2hleBgGIAEoCUIMCgpjb25zdHJhaW50IsUCCglEZXZpY2VBY2wSNAoJZGV2aWNlX2lkGAEgASgLMiEua3VzaW50YS5pb3QuaWRlbnRpdHkudjEuRGV2aWNlSWQSMAoHdXNlcl9pZBgCIAEoCzIfLmt1c2ludGEuaW90LmlkZW50aXR5LnYxLlVzZXJJZBIpCgRyb2xlGAMgASgOMhsua3VzaW50YS5pb3QuYWNjZXNzLnYxLlJvbGUSQAoPYWxsb3dlZF9hY3Rpb25zGAQgAygOMicua3VzaW50YS5pb3QuYWNjZXNzLnYxLlBlcm1pc3Npb25BY3Rpb24SGgoSYWxsb3dlZF9hdHRyaWJ1dGVzGAUgAygJEkcKFHByb3BlcnR5X2NvbnN0cmFpbnRzGAYgAygLMikua3VzaW50YS5pb3QuYWNjZXNzLnYxLlByb3BlcnR5Q29uc3RyYWludCLlAQoURWZmZWN0aXZlUGVybWlzc2lvbnMSMAoHdXNlcl9pZBgBIAEoCzIfLmt1c2ludGEuaW90LmlkZW50aXR5LnYxLlVzZXJJZBI2CgpnYXRld2F5X2lkGAIgASgLMiIua3VzaW50YS5pb3QuaWRlbnRpdHkudjEuR2F0ZXdheUlkEjUKC2RldmljZV9hY2xzGAMgAygLMiAua3VzaW50YS5pb3QuYWNjZXNzLnYxLkRldmljZUFjbBIsCgh2YWxpZF9hdBgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCAkgBYgZwcm90bzM", [file_google_protobuf_timestamp, file_kusinta_iot_identity_v1_identity, file_kusinta_iot_access_v1_roles]);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Describes the message kusinta.iot.access.v1.PropertyConstraint.
|
|
18
|
+
* Use `create(PropertyConstraintSchema)` to create a new message.
|
|
19
|
+
*/
|
|
20
|
+
export const PropertyConstraintSchema = /*@__PURE__*/
|
|
21
|
+
messageDesc(file_kusinta_iot_access_v1_acl, 0);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Describes the message kusinta.iot.access.v1.DeviceAcl.
|
|
25
|
+
* Use `create(DeviceAclSchema)` to create a new message.
|
|
26
|
+
*/
|
|
27
|
+
export const DeviceAclSchema = /*@__PURE__*/
|
|
28
|
+
messageDesc(file_kusinta_iot_access_v1_acl, 1);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Describes the message kusinta.iot.access.v1.EffectivePermissions.
|
|
32
|
+
* Use `create(EffectivePermissionsSchema)` to create a new message.
|
|
33
|
+
*/
|
|
34
|
+
export const EffectivePermissionsSchema = /*@__PURE__*/
|
|
35
|
+
messageDesc(file_kusinta_iot_access_v1_acl, 2);
|
|
36
|
+
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts"
|
|
2
|
+
// @generated from file kusinta/iot/access/v1/roles.proto (package kusinta.iot.access.v1, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import type { GenEnum, GenFile } from "@bufbuild/protobuf/codegenv2";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Describes the file kusinta/iot/access/v1/roles.proto.
|
|
9
|
+
*/
|
|
10
|
+
export declare const file_kusinta_iot_access_v1_roles: GenFile;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @generated from enum kusinta.iot.access.v1.Role
|
|
14
|
+
*/
|
|
15
|
+
export enum Role {
|
|
16
|
+
/**
|
|
17
|
+
* @generated from enum value: ROLE_UNSPECIFIED = 0;
|
|
18
|
+
*/
|
|
19
|
+
UNSPECIFIED = 0,
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @generated from enum value: ROLE_RESIDENT = 1;
|
|
23
|
+
*/
|
|
24
|
+
RESIDENT = 1,
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @generated from enum value: ROLE_PROPERTY_OWNER = 2;
|
|
28
|
+
*/
|
|
29
|
+
PROPERTY_OWNER = 2,
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @generated from enum value: ROLE_TECHNICIAN = 3;
|
|
33
|
+
*/
|
|
34
|
+
TECHNICIAN = 3,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @generated from enum value: ROLE_GATEWAY_ADMIN = 4;
|
|
38
|
+
*/
|
|
39
|
+
GATEWAY_ADMIN = 4,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Describes the enum kusinta.iot.access.v1.Role.
|
|
44
|
+
*/
|
|
45
|
+
export declare const RoleSchema: GenEnum<Role>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @generated from enum kusinta.iot.access.v1.PermissionAction
|
|
49
|
+
*/
|
|
50
|
+
export enum PermissionAction {
|
|
51
|
+
/**
|
|
52
|
+
* @generated from enum value: PERMISSION_ACTION_UNSPECIFIED = 0;
|
|
53
|
+
*/
|
|
54
|
+
UNSPECIFIED = 0,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @generated from enum value: PERMISSION_ACTION_READ = 1;
|
|
58
|
+
*/
|
|
59
|
+
READ = 1,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @generated from enum value: PERMISSION_ACTION_WRITE = 2;
|
|
63
|
+
*/
|
|
64
|
+
WRITE = 2,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @generated from enum value: PERMISSION_ACTION_OBSERVE = 3;
|
|
68
|
+
*/
|
|
69
|
+
OBSERVE = 3,
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @generated from enum value: PERMISSION_ACTION_INVOKE = 4;
|
|
73
|
+
*/
|
|
74
|
+
INVOKE = 4,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Describes the enum kusinta.iot.access.v1.PermissionAction.
|
|
79
|
+
*/
|
|
80
|
+
export declare const PermissionActionSchema: GenEnum<PermissionAction>;
|
|
81
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v2.12.0 with parameter "target=js+dts"
|
|
2
|
+
// @generated from file kusinta/iot/access/v1/roles.proto (package kusinta.iot.access.v1, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import { enumDesc, fileDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Describes the file kusinta/iot/access/v1/roles.proto.
|
|
9
|
+
*/
|
|
10
|
+
export const file_kusinta_iot_access_v1_roles = /*@__PURE__*/
|
|
11
|
+
fileDesc("CiFrdXNpbnRhL2lvdC9hY2Nlc3MvdjEvcm9sZXMucHJvdG8SFWt1c2ludGEuaW90LmFjY2Vzcy52MSp1CgRSb2xlEhQKEFJPTEVfVU5TUEVDSUZJRUQQABIRCg1ST0xFX1JFU0lERU5UEAESFwoTUk9MRV9QUk9QRVJUWV9PV05FUhACEhMKD1JPTEVfVEVDSE5JQ0lBThADEhYKElJPTEVfR0FURVdBWV9BRE1JThAEKqsBChBQZXJtaXNzaW9uQWN0aW9uEiEKHVBFUk1JU1NJT05fQUNUSU9OX1VOU1BFQ0lGSUVEEAASGgoWUEVSTUlTU0lPTl9BQ1RJT05fUkVBRBABEhsKF1BFUk1JU1NJT05fQUNUSU9OX1dSSVRFEAISHQoZUEVSTUlTU0lPTl9BQ1RJT05fT0JTRVJWRRADEhwKGFBFUk1JU1NJT05fQUNUSU9OX0lOVk9LRRAEQgJIAWIGcHJvdG8z");
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Describes the enum kusinta.iot.access.v1.Role.
|
|
15
|
+
*/
|
|
16
|
+
export const RoleSchema = /*@__PURE__*/
|
|
17
|
+
enumDesc(file_kusinta_iot_access_v1_roles, 0);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @generated from enum kusinta.iot.access.v1.Role
|
|
21
|
+
*/
|
|
22
|
+
export const Role = /*@__PURE__*/
|
|
23
|
+
tsEnum(RoleSchema);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Describes the enum kusinta.iot.access.v1.PermissionAction.
|
|
27
|
+
*/
|
|
28
|
+
export const PermissionActionSchema = /*@__PURE__*/
|
|
29
|
+
enumDesc(file_kusinta_iot_access_v1_roles, 1);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @generated from enum kusinta.iot.access.v1.PermissionAction
|
|
33
|
+
*/
|
|
34
|
+
export const PermissionAction = /*@__PURE__*/
|
|
35
|
+
tsEnum(PermissionActionSchema);
|
|
36
|
+
|