@awarevue/api-types 1.0.114 → 1.1.1
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.
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isMessageFromAgent = exports.getAgentMessageIssues = exports.sAbortChange = exports.sApplyChangeProgress = exports.sApplyChangeRs = exports.sApplyChange = exports.sValidateChangeRs = exports.sChangeIssue = exports.sChangeIssueCode = exports.sValidateChangeRq = exports.sRefMap = exports.sDeviceMap = exports.sAccessMutation = exports.sObjectDelete = exports.sObjectMerge = exports.sGetAvailableDevicesRs = exports.sGetAvailableDevicesRq = exports.sPushEventRs = exports.sPushEventRq = exports.sPushStateUpdateRs = exports.sPushStateUpdateRq = exports.sRunCommandRs = exports.sRunCommandRq = exports.sStopServiceRs = exports.sStopServiceRq = exports.sStartServiceRs = exports.sStartServiceRq = exports.sValidateProviderConfigRs = exports.sConfigurationIssue = exports.sValidateProviderConfigRq = exports.sUnregister = exports.sRegisterRs = exports.sRegisterRq = exports.sAccessControlCapabilityReport = exports.sTokenSpecs = exports.sAccessObjectKind = exports.sProviderSpecs = exports.sUiHint = exports.sUiWidgetHint = exports.sUiOrderHint = exports.sErrorPayload = exports.sResponsePayload = exports.sMessageWithPayload = exports.sMessageHeader = void 0;
|
|
3
|
+
exports.isMessageFromAgent = exports.getAgentMessageIssues = exports.sAbortChange = exports.sApplyChangeProgress = exports.sApplyChangeRs = exports.sApplyChange = exports.sValidateChangeRs = exports.sChangeIssue = exports.sChangeIssueCode = exports.sValidateChangeRq = exports.sRefMap = exports.sDeviceMap = exports.sAccessMutation = exports.sObjectDelete = exports.sObjectMerge = exports.sGetAvailableDevicesRs = exports.sGetAvailableDevicesRq = exports.sPushEventRs = exports.sPushEventRq = exports.sPushStateUpdateRs = exports.sPushStateUpdateRq = exports.sQueryRs = exports.sQueryRq = exports.sRunCommandRs = exports.sRunCommandRq = exports.sStopServiceRs = exports.sStopServiceRq = exports.sStartServiceRs = exports.sStartServiceRq = exports.sValidateProviderConfigRs = exports.sConfigurationIssue = exports.sValidateProviderConfigRq = exports.sUnregister = exports.sRegisterRs = exports.sRegisterRq = exports.sAccessControlCapabilityReport = exports.sTokenSpecs = exports.sAccessObjectKind = exports.sProviderSpecs = exports.sUiHint = exports.sUiWidgetHint = exports.sUiOrderHint = exports.sErrorPayload = exports.sResponsePayload = exports.sMessageWithPayload = exports.sMessageHeader = exports.sAgentDeviceInfo = void 0;
|
|
4
4
|
const device_1 = require("../device");
|
|
5
5
|
const device_import_1 = require("../device-import");
|
|
6
6
|
const credential_1 = require("../access-control/credential");
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
const access_control_1 = require("../access-control");
|
|
9
|
+
exports.sAgentDeviceInfo = device_1.sForeignDeviceInfo.and(device_1.sAnyDeviceSpecs).and(zod_1.z.object({
|
|
10
|
+
presets: zod_1.z.array(device_1.sPresetDto),
|
|
11
|
+
}));
|
|
9
12
|
// PROTOCOL ENVELOPE
|
|
10
13
|
exports.sMessageHeader = zod_1.z.object({
|
|
11
14
|
version: zod_1.z.number().describe('Protocol version'),
|
|
@@ -132,7 +135,7 @@ exports.sStopServiceRs = (0, exports.sResponsePayload)(zod_1.z.literal('stop-rs'
|
|
|
132
135
|
exports.sRunCommandRq = zod_1.z
|
|
133
136
|
.object({
|
|
134
137
|
kind: zod_1.z.literal('command'),
|
|
135
|
-
device:
|
|
138
|
+
device: exports.sAgentDeviceInfo,
|
|
136
139
|
command: zod_1.z.string().nonempty(),
|
|
137
140
|
batchId: zod_1.z
|
|
138
141
|
.string()
|
|
@@ -142,6 +145,21 @@ exports.sRunCommandRq = zod_1.z
|
|
|
142
145
|
})
|
|
143
146
|
.describe('Request to run a device command');
|
|
144
147
|
exports.sRunCommandRs = (0, exports.sResponsePayload)(zod_1.z.literal('command-rs'), zod_1.z.object({})).describe('Response for running a device command');
|
|
148
|
+
// QUERIES
|
|
149
|
+
exports.sQueryRq = zod_1.z.object({
|
|
150
|
+
kind: zod_1.z.literal('query'),
|
|
151
|
+
query: zod_1.z.string().nonempty(),
|
|
152
|
+
device: exports.sAgentDeviceInfo,
|
|
153
|
+
args: zod_1.z.unknown().describe('Query arguments, depends on the query type'),
|
|
154
|
+
replyUrl: zod_1.z
|
|
155
|
+
.string()
|
|
156
|
+
.nonempty()
|
|
157
|
+
.optional()
|
|
158
|
+
.describe('URL to optionally POST the query response to. The default is to reply via query-rs'),
|
|
159
|
+
});
|
|
160
|
+
exports.sQueryRs = (0, exports.sResponsePayload)(zod_1.z.literal('query-rs'), zod_1.z.object({
|
|
161
|
+
result: zod_1.z.unknown().describe('Query result, depends on the query type'),
|
|
162
|
+
})).describe('Response for a query');
|
|
145
163
|
// PUSH DEVICE STATE UPDATE
|
|
146
164
|
exports.sPushStateUpdateRq = zod_1.z
|
|
147
165
|
.object({
|
|
@@ -278,28 +296,6 @@ exports.sObjectDelete = zod_1.z
|
|
|
278
296
|
}),
|
|
279
297
|
])
|
|
280
298
|
.describe('Object delete request');
|
|
281
|
-
// export const sRelationMerge = z.object({
|
|
282
|
-
// kind: z.literal('relation-merge'),
|
|
283
|
-
// left: z.object({
|
|
284
|
-
// kind: sAccessObjectKind,
|
|
285
|
-
// objectId: z
|
|
286
|
-
// .string()
|
|
287
|
-
// .optional()
|
|
288
|
-
// .describe(
|
|
289
|
-
// 'Object ID as in backend. Can be undefined if object is new to backend and agent is trying to create it',
|
|
290
|
-
// ),
|
|
291
|
-
// }),
|
|
292
|
-
// right: z.object({
|
|
293
|
-
// kind: sAccessObjectKind,
|
|
294
|
-
// objectId: z
|
|
295
|
-
// .string()
|
|
296
|
-
// .optional()
|
|
297
|
-
// .describe(
|
|
298
|
-
// 'Object ID as in backend. Can be undefined if object is new to backend and agent is trying to create it',
|
|
299
|
-
// ),
|
|
300
|
-
// }),
|
|
301
|
-
// linkExists: z.boolean(),
|
|
302
|
-
// });
|
|
303
299
|
exports.sAccessMutation = zod_1.z
|
|
304
300
|
.union([exports.sObjectMerge, exports.sObjectDelete])
|
|
305
301
|
.describe('Access object change description');
|
|
@@ -391,6 +387,7 @@ const fromAgentSchemaByKind = {
|
|
|
391
387
|
'start-rs': exports.sStartServiceRs,
|
|
392
388
|
'stop-rs': exports.sStopServiceRs,
|
|
393
389
|
'command-rs': exports.sRunCommandRs,
|
|
390
|
+
'query-rs': exports.sQueryRs,
|
|
394
391
|
state: exports.sPushStateUpdateRq,
|
|
395
392
|
event: exports.sPushEventRq,
|
|
396
393
|
'get-available-devices-rs': exports.sGetAvailableDevicesRs,
|