@alwaysai/device-agent-schemas 2.1.13 → 2.2.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.
Files changed (253) hide show
  1. package/.eslintrc +1 -21
  2. package/docs/README.md +47 -21
  3. package/docs/app-install-response-schema-properties-appinstallresponse-properties-appinstallpayload-properties-appsignedurl.md +15 -0
  4. package/docs/app-install-response-schema-properties-appinstallresponse-properties-appinstallpayload.md +39 -0
  5. package/docs/app-install-response-schema-properties-appinstallresponse-properties-appreleasehash.md +25 -0
  6. package/docs/app-install-response-schema-properties-appinstallresponse-properties-models_install_payload.md +15 -0
  7. package/docs/app-install-response-schema-properties-appinstallresponse-properties-projectid.md +25 -0
  8. package/docs/app-install-response-schema-properties-appinstallresponse.md +116 -0
  9. package/docs/app-install-response-schema.md +39 -0
  10. package/docs/app-install-schema-properties-projectid.md +2 -2
  11. package/docs/app-install-schema.md +2 -2
  12. package/docs/app-logs-schema-properties-logchunk.md +15 -0
  13. package/docs/app-logs-schema-properties-projectid.md +25 -0
  14. package/docs/app-logs-schema.md +23 -21
  15. package/docs/app-state-control-schema-properties-basecommand.md +25 -0
  16. package/docs/app-state-control-schema-properties-projectid.md +25 -0
  17. package/docs/app-state-control-schema.md +34 -22
  18. package/docs/app-state-schema-properties-appstate-items-properties-appdetails-properties-projectid.md +2 -2
  19. package/docs/app-state-schema-properties-appstate-items-properties-appdetails.md +2 -2
  20. package/docs/app-state-schema.md +3 -30
  21. package/docs/app-uninstall-schema-properties-projectid.md +2 -2
  22. package/docs/app-uninstall-schema.md +2 -2
  23. package/docs/app-version-control-schema.md +5 -56
  24. package/docs/common-schema-defs-appreleasehash.md +5 -5
  25. package/docs/common-schema-defs-projectid.md +7 -7
  26. package/docs/common-schema-defs-txid.md +29 -0
  27. package/docs/common-schema.md +11 -0
  28. package/docs/device-action-schema-properties-action.md +23 -0
  29. package/docs/device-action-schema.md +47 -0
  30. package/docs/device-stats-schema-properties-cpudetails-properties-temperature.md +15 -0
  31. package/docs/device-stats-schema-properties-cpudetails-properties-usedperc.md +15 -0
  32. package/docs/device-stats-schema-properties-cpudetails.md +58 -0
  33. package/docs/device-stats-schema-properties-cpuusage.md +15 -0
  34. package/docs/device-stats-schema-properties-diskdetails-properties-freegb.md +15 -0
  35. package/docs/device-stats-schema-properties-diskdetails-properties-usedgb.md +15 -0
  36. package/docs/device-stats-schema-properties-diskdetails.md +58 -0
  37. package/docs/device-stats-schema-properties-diskutil.md +15 -0
  38. package/docs/device-stats-schema-properties-memdetails-properties-freemb.md +15 -0
  39. package/docs/device-stats-schema-properties-memdetails-properties-usedmb.md +15 -0
  40. package/docs/device-stats-schema-properties-memdetails.md +58 -0
  41. package/docs/device-stats-schema-properties-usedmemorypercentage.md +15 -0
  42. package/docs/device-stats-schema.md +134 -0
  43. package/docs/live-updates-toggle-schema-properties-applogs-properties-toggle.md +15 -0
  44. package/docs/live-updates-toggle-schema-properties-applogs.md +68 -0
  45. package/docs/live-updates-toggle-schema-properties-appstate.md +15 -0
  46. package/docs/live-updates-toggle-schema-properties-devicestats.md +15 -0
  47. package/docs/live-updates-toggle-schema.md +34 -23
  48. package/docs/models-install-response-schema-properties-modelsinstallresponse.md +68 -0
  49. package/docs/models-install-response-schema.md +39 -0
  50. package/docs/shadow-project-update-schema-properties-appconfig.md +15 -0
  51. package/docs/shadow-project-update-schema-properties-envvars-patternproperties--patternproperties-.md +15 -0
  52. package/docs/shadow-project-update-schema-properties-envvars-patternproperties--patternproperties.md +15 -0
  53. package/docs/shadow-project-update-schema-properties-envvars-patternproperties-.md +39 -0
  54. package/docs/shadow-project-update-schema-properties-envvars-patternproperties.md +15 -0
  55. package/docs/shadow-project-update-schema-properties-envvars.md +44 -0
  56. package/docs/shadow-project-update-schema.md +63 -0
  57. package/docs/shadow-projects-update-all-schema-patternproperties.md +15 -0
  58. package/docs/shadow-projects-update-all-schema-propertynames.md +25 -0
  59. package/docs/shadow-projects-update-all-schema.md +44 -0
  60. package/docs/signed-urls-request-schema-properties-modelsonlyurlsrequest.md +7 -7
  61. package/docs/signed-urls-request-schema-properties-signedurlsrequest.md +8 -8
  62. package/docs/signed-urls-request-schema.md +4 -31
  63. package/docs/status-response-schema-properties-message.md +15 -0
  64. package/docs/status-response-schema-properties-status.md +27 -0
  65. package/docs/status-response-schema.md +70 -0
  66. package/docs/system-information-schema-properties-cpu-properties-brand.md +15 -0
  67. package/docs/system-information-schema-properties-cpu-properties-cores.md +15 -0
  68. package/docs/system-information-schema-properties-cpu-properties-efficiencycores.md +15 -0
  69. package/docs/system-information-schema-properties-cpu-properties-manufacturer.md +15 -0
  70. package/docs/system-information-schema-properties-cpu-properties-model.md +15 -0
  71. package/docs/system-information-schema-properties-cpu-properties-physicalcores.md +15 -0
  72. package/docs/system-information-schema-properties-cpu-properties-processors.md +15 -0
  73. package/docs/system-information-schema-properties-cpu-properties-vendor.md +15 -0
  74. package/docs/system-information-schema-properties-cpu.md +172 -0
  75. package/docs/system-information-schema-properties-device-properties-manufacturer.md +15 -0
  76. package/docs/system-information-schema-properties-device-properties-model.md +15 -0
  77. package/docs/system-information-schema-properties-device-properties-serial.md +15 -0
  78. package/docs/system-information-schema-properties-device-properties-version.md +15 -0
  79. package/docs/system-information-schema-properties-device-properties-virtual.md +15 -0
  80. package/docs/system-information-schema-properties-device.md +115 -0
  81. package/docs/system-information-schema-properties-disk-properties-drives-items-properties-device.md +15 -0
  82. package/docs/system-information-schema-properties-disk-properties-drives-items-properties-name.md +15 -0
  83. package/docs/system-information-schema-properties-disk-properties-drives-items-properties-size.md +15 -0
  84. package/docs/system-information-schema-properties-disk-properties-drives-items-properties-type.md +15 -0
  85. package/docs/system-information-schema-properties-disk-properties-drives-items-properties-vendor.md +15 -0
  86. package/docs/system-information-schema-properties-disk-properties-drives-items.md +115 -0
  87. package/docs/system-information-schema-properties-disk-properties-drives.md +15 -0
  88. package/docs/system-information-schema-properties-disk.md +39 -0
  89. package/docs/system-information-schema-properties-network-properties-ipv4address.md +15 -0
  90. package/docs/system-information-schema-properties-network-properties-ipv6address.md +15 -0
  91. package/docs/system-information-schema-properties-network-properties-macaddress.md +15 -0
  92. package/docs/system-information-schema-properties-network.md +77 -0
  93. package/docs/system-information-schema-properties-os-properties-architecture.md +15 -0
  94. package/docs/system-information-schema-properties-os-properties-distro.md +15 -0
  95. package/docs/system-information-schema-properties-os-properties-hostname.md +15 -0
  96. package/docs/system-information-schema-properties-os-properties-kernel.md +15 -0
  97. package/docs/system-information-schema-properties-os-properties-platform.md +15 -0
  98. package/docs/system-information-schema-properties-os-properties-release.md +15 -0
  99. package/docs/system-information-schema-properties-os.md +134 -0
  100. package/docs/system-information-schema-properties-versions-properties-agent.md +15 -0
  101. package/docs/system-information-schema-properties-versions-properties-deviceagentschemas.md +15 -0
  102. package/docs/system-information-schema-properties-versions.md +58 -0
  103. package/docs/system-information-schema.md +134 -0
  104. package/docs/to-client-message-schema-allof-0-if-properties-messagetype.md +23 -0
  105. package/docs/to-client-message-schema-allof-0-if-properties.md +15 -0
  106. package/docs/to-client-message-schema-allof-0-if.md +47 -0
  107. package/docs/to-client-message-schema-allof-0-then-properties.md +15 -0
  108. package/docs/to-client-message-schema-allof-0-then.md +39 -0
  109. package/docs/to-client-message-schema-allof-0.md +15 -0
  110. package/docs/to-client-message-schema-allof-1-if-properties-messagetype.md +23 -0
  111. package/docs/to-client-message-schema-allof-1-if-properties.md +15 -0
  112. package/docs/to-client-message-schema-allof-1-if.md +47 -0
  113. package/docs/to-client-message-schema-allof-1-then-properties.md +15 -0
  114. package/docs/to-client-message-schema-allof-1-then.md +39 -0
  115. package/docs/to-client-message-schema-allof-1.md +15 -0
  116. package/docs/to-client-message-schema-allof-2-if-properties-messagetype.md +23 -0
  117. package/docs/to-client-message-schema-allof-2-if-properties.md +15 -0
  118. package/docs/to-client-message-schema-allof-2-if.md +47 -0
  119. package/docs/to-client-message-schema-allof-2-then-properties.md +15 -0
  120. package/docs/to-client-message-schema-allof-2-then.md +39 -0
  121. package/docs/to-client-message-schema-allof-2.md +15 -0
  122. package/docs/to-client-message-schema-allof-3-if-properties-messagetype.md +23 -0
  123. package/docs/to-client-message-schema-allof-3-if-properties.md +15 -0
  124. package/docs/to-client-message-schema-allof-3-if.md +47 -0
  125. package/docs/to-client-message-schema-allof-3-then-properties.md +15 -0
  126. package/docs/to-client-message-schema-allof-3-then.md +39 -0
  127. package/docs/to-client-message-schema-allof-3.md +15 -0
  128. package/docs/to-client-message-schema-defs-toclient.md +25 -0
  129. package/docs/to-client-message-schema-defs.md +15 -0
  130. package/docs/to-client-message-schema-properties-deviceid.md +15 -0
  131. package/docs/to-client-message-schema-properties-messagetype.md +26 -0
  132. package/docs/to-client-message-schema-properties-payload.md +25 -0
  133. package/docs/to-client-message-schema-properties-timestamp.md +15 -0
  134. package/docs/to-client-message-schema-properties-topic-oneof-0.md +25 -0
  135. package/docs/to-client-message-schema-properties-topic.md +19 -0
  136. package/docs/to-client-message-schema.md +196 -0
  137. package/docs/to-cloud-message-schema-allof-0-if-properties-messagetype.md +23 -0
  138. package/docs/to-cloud-message-schema-allof-0-if-properties.md +15 -0
  139. package/docs/to-cloud-message-schema-allof-0-if.md +47 -0
  140. package/docs/to-cloud-message-schema-allof-0-then-properties.md +15 -0
  141. package/docs/to-cloud-message-schema-allof-0-then.md +39 -0
  142. package/docs/to-cloud-message-schema-allof-0.md +15 -0
  143. package/docs/to-cloud-message-schema-defs-tocloud.md +25 -0
  144. package/docs/to-cloud-message-schema-defs.md +15 -0
  145. package/docs/to-cloud-message-schema-properties-deviceid.md +15 -0
  146. package/docs/to-cloud-message-schema-properties-messagetype.md +23 -0
  147. package/docs/to-cloud-message-schema-properties-payload.md +19 -0
  148. package/docs/to-cloud-message-schema-properties-timestamp.md +15 -0
  149. package/docs/to-cloud-message-schema-properties-topic-oneof-0.md +25 -0
  150. package/docs/to-cloud-message-schema-properties-topic.md +19 -0
  151. package/docs/to-cloud-message-schema.md +181 -0
  152. package/docs/to-device-agent-message-schema-allof-0-if-properties-messagetype.md +23 -0
  153. package/docs/to-device-agent-message-schema-allof-0-if-properties.md +15 -0
  154. package/docs/to-device-agent-message-schema-allof-0-if.md +47 -0
  155. package/docs/to-device-agent-message-schema-allof-0-then-properties.md +15 -0
  156. package/docs/to-device-agent-message-schema-allof-0-then.md +39 -0
  157. package/docs/to-device-agent-message-schema-allof-0.md +15 -0
  158. package/docs/to-device-agent-message-schema-allof-1-if-properties-messagetype.md +23 -0
  159. package/docs/to-device-agent-message-schema-allof-1-if-properties.md +15 -0
  160. package/docs/to-device-agent-message-schema-allof-1-if.md +47 -0
  161. package/docs/to-device-agent-message-schema-allof-1-then-properties.md +15 -0
  162. package/docs/to-device-agent-message-schema-allof-1-then.md +45 -0
  163. package/docs/to-device-agent-message-schema-allof-1.md +15 -0
  164. package/docs/to-device-agent-message-schema-allof-2-if-properties-messagetype.md +23 -0
  165. package/docs/to-device-agent-message-schema-allof-2-if-properties.md +15 -0
  166. package/docs/to-device-agent-message-schema-allof-2-if.md +47 -0
  167. package/docs/to-device-agent-message-schema-allof-2-then-properties.md +15 -0
  168. package/docs/to-device-agent-message-schema-allof-2-then.md +39 -0
  169. package/docs/to-device-agent-message-schema-allof-2.md +15 -0
  170. package/docs/to-device-agent-message-schema-allof-3-if-properties-messagetype.md +23 -0
  171. package/docs/to-device-agent-message-schema-allof-3-if-properties.md +15 -0
  172. package/docs/to-device-agent-message-schema-allof-3-if.md +47 -0
  173. package/docs/to-device-agent-message-schema-allof-3-then-properties.md +15 -0
  174. package/docs/to-device-agent-message-schema-allof-3-then.md +39 -0
  175. package/docs/to-device-agent-message-schema-allof-3.md +15 -0
  176. package/docs/to-device-agent-message-schema-allof-4-if-properties-messagetype.md +23 -0
  177. package/docs/to-device-agent-message-schema-allof-4-if-properties.md +15 -0
  178. package/docs/to-device-agent-message-schema-allof-4-if.md +47 -0
  179. package/docs/to-device-agent-message-schema-allof-4-then-properties.md +15 -0
  180. package/docs/to-device-agent-message-schema-allof-4-then.md +39 -0
  181. package/docs/to-device-agent-message-schema-allof-4.md +15 -0
  182. package/docs/to-device-agent-message-schema-allof-5-if-properties-messagetype.md +23 -0
  183. package/docs/to-device-agent-message-schema-allof-5-if-properties.md +15 -0
  184. package/docs/to-device-agent-message-schema-allof-5-if.md +47 -0
  185. package/docs/to-device-agent-message-schema-allof-5-then-properties.md +15 -0
  186. package/docs/to-device-agent-message-schema-allof-5-then.md +39 -0
  187. package/docs/to-device-agent-message-schema-allof-5.md +15 -0
  188. package/docs/to-device-agent-message-schema-allof-6-if-properties-messagetype.md +23 -0
  189. package/docs/to-device-agent-message-schema-allof-6-if-properties.md +15 -0
  190. package/docs/to-device-agent-message-schema-allof-6-if.md +47 -0
  191. package/docs/to-device-agent-message-schema-allof-6-then-properties.md +15 -0
  192. package/docs/to-device-agent-message-schema-allof-6-then.md +39 -0
  193. package/docs/to-device-agent-message-schema-allof-6.md +15 -0
  194. package/docs/to-device-agent-message-schema-defs-todevice.md +25 -0
  195. package/docs/to-device-agent-message-schema-defs.md +15 -0
  196. package/docs/to-device-agent-message-schema-properties-messagetype.md +29 -0
  197. package/docs/to-device-agent-message-schema-properties-payload.md +35 -0
  198. package/docs/to-device-agent-message-schema-properties-timestamp.md +15 -0
  199. package/docs/to-device-agent-message-schema-properties-topic.md +25 -0
  200. package/docs/to-device-agent-message-schema.md +202 -0
  201. package/lib/constants.d.ts.map +1 -1
  202. package/lib/constants.js +10 -10
  203. package/lib/constants.js.map +1 -1
  204. package/lib/constants.test.js.map +1 -1
  205. package/lib/device-agent-action-schema.d.ts.map +1 -1
  206. package/lib/device-stats-schema.d.ts +6 -6
  207. package/lib/device-stats-schema.d.ts.map +1 -1
  208. package/lib/index.d.ts +2 -2
  209. package/lib/index.d.ts.map +1 -1
  210. package/lib/index.js +11 -1
  211. package/lib/index.js.map +1 -1
  212. package/lib/message-builders.d.ts +1 -1
  213. package/lib/message-builders.d.ts.map +1 -1
  214. package/lib/message-builders.js +3 -3
  215. package/lib/message-builders.js.map +1 -1
  216. package/lib/schemas/device-stats-schema.json +24 -6
  217. package/lib/schemas/shadow-project-update-schema.json +30 -0
  218. package/lib/schemas/shadow-projects-update-all-schema.json +17 -0
  219. package/lib/shadow-schema.d.ts +104 -0
  220. package/lib/shadow-schema.d.ts.map +1 -0
  221. package/lib/shadow-schema.js +75 -0
  222. package/lib/shadow-schema.js.map +1 -0
  223. package/lib/shadow-schema.test.d.ts +2 -0
  224. package/lib/shadow-schema.test.d.ts.map +1 -0
  225. package/lib/shadow-schema.test.js +148 -0
  226. package/lib/shadow-schema.test.js.map +1 -0
  227. package/lib/status-response-schema.d.ts.map +1 -1
  228. package/lib/types.d.ts.map +1 -1
  229. package/lib/types.js +1 -3
  230. package/lib/types.js.map +1 -1
  231. package/lib/types.test.js +92 -92
  232. package/lib/types.test.js.map +1 -1
  233. package/package.json +2 -4
  234. package/src/app-action-schema.ts +1 -1
  235. package/src/constants.test.ts +7 -5
  236. package/src/constants.ts +30 -19
  237. package/src/device-agent-action-schema.ts +2 -1
  238. package/src/device-stats-schema.ts +6 -6
  239. package/src/index.ts +38 -13
  240. package/src/message-builders.ts +48 -36
  241. package/src/schemas/device-stats-schema.json +24 -6
  242. package/src/schemas/shadow-project-update-schema.json +30 -0
  243. package/src/schemas/shadow-projects-update-all-schema.json +17 -0
  244. package/src/shadow-schema.test.ts +172 -0
  245. package/src/shadow-schema.ts +172 -0
  246. package/src/status-response-schema.ts +2 -1
  247. package/src/types.test.ts +97 -94
  248. package/src/types.ts +30 -19
  249. package/lib/system-information-schema.d.ts +0 -45
  250. package/lib/system-information-schema.d.ts.map +0 -1
  251. package/lib/system-information-schema.js +0 -3
  252. package/lib/system-information-schema.js.map +0 -1
  253. package/src/system-information-schema.ts +0 -44
package/src/constants.ts CHANGED
@@ -13,14 +13,14 @@ export const DEVICE_TOPIC_PREFIX = 'to-device';
13
13
  export const DEVICE_TYPE = 'aai-device';
14
14
 
15
15
  const toCloudMessageTypeEnum = keyMirror({
16
- signed_urls_request: null,
16
+ signed_urls_request: null
17
17
  });
18
18
 
19
19
  const toClientMessageTypeEnum = keyMirror({
20
20
  app_logs: null,
21
21
  app_state: null,
22
22
  device_stats: null,
23
- status_response: null,
23
+ status_response: null
24
24
  });
25
25
 
26
26
  const toDeviceAgentMessageTypeEnum = keyMirror({
@@ -30,28 +30,28 @@ const toDeviceAgentMessageTypeEnum = keyMirror({
30
30
  models_install_response: null,
31
31
  live_state_updates: null,
32
32
  status_response: null,
33
- device_action: null,
33
+ device_action: null
34
34
  });
35
35
 
36
36
  const appStateEnum = keyMirror({
37
37
  up: null,
38
38
  stopped: null,
39
- restarting: null,
39
+ restarting: null
40
40
  });
41
41
 
42
42
  const appStateControlEnum = keyMirror({
43
43
  start: null,
44
44
  stop: null,
45
- restart: null,
45
+ restart: null
46
46
  });
47
47
 
48
48
  const appVersionControlEnum = keyMirror({
49
49
  install: null,
50
- uninstall: null,
50
+ uninstall: null
51
51
  });
52
52
 
53
53
  const liveUpdatesEnum = keyMirror({
54
- live_updates: null,
54
+ live_updates: null
55
55
  });
56
56
 
57
57
  const statusEnum = keyMirror({
@@ -59,11 +59,11 @@ const statusEnum = keyMirror({
59
59
  in_progress: null,
60
60
  failure: null,
61
61
  success: null,
62
- connection_lost: null,
62
+ connection_lost: null
63
63
  });
64
64
 
65
65
  const deviceActionEnum = keyMirror({
66
- system_restart: null,
66
+ system_restart: null
67
67
  });
68
68
 
69
69
  export const keyMirrors = {
@@ -75,24 +75,32 @@ export const keyMirrors = {
75
75
  appVersionControl: appVersionControlEnum,
76
76
  liveUpdates: liveUpdatesEnum,
77
77
  statusResponse: statusEnum,
78
- deviceAction: deviceActionEnum,
78
+ deviceAction: deviceActionEnum
79
79
  };
80
80
 
81
- export const toCloudMessageTypeValues = Object.values(keyMirrors.toCloudMessageType);
82
- export type ToCloudMessageTypeValue = keyof typeof keyMirrors.toCloudMessageType;
81
+ export const toCloudMessageTypeValues = Object.values(
82
+ keyMirrors.toCloudMessageType
83
+ );
84
+ export type ToCloudMessageTypeValue =
85
+ keyof typeof keyMirrors.toCloudMessageType;
83
86
 
84
- export const toClientMessageTypeValues = Object.values(keyMirrors.toClientMessageType);
85
- export type ToClientMessageTypeValue = keyof typeof keyMirrors.toClientMessageType;
87
+ export const toClientMessageTypeValues = Object.values(
88
+ keyMirrors.toClientMessageType
89
+ );
90
+ export type ToClientMessageTypeValue =
91
+ keyof typeof keyMirrors.toClientMessageType;
86
92
 
87
93
  export type AppLogsMessageType = typeof toClientMessageTypeEnum.app_logs;
88
94
  export type AppStateMessageType = typeof toClientMessageTypeEnum.app_state;
89
- export type DeviceStatsMessageType = typeof toClientMessageTypeEnum.device_stats;
90
- export type StatusResponseMessageType = typeof toClientMessageTypeEnum.status_response;
95
+ export type DeviceStatsMessageType =
96
+ typeof toClientMessageTypeEnum.device_stats;
97
+ export type StatusResponseMessageType =
98
+ typeof toClientMessageTypeEnum.status_response;
91
99
  export type SignedUrlsRequestMessageType =
92
100
  typeof toCloudMessageTypeEnum.signed_urls_request;
93
101
 
94
102
  export const toDeviceAgentMessageTypeValues = Object.values(
95
- keyMirrors.toDeviceAgentMessageType,
103
+ keyMirrors.toDeviceAgentMessageType
96
104
  );
97
105
  export type ToDeviceAgentMessageTypeValue =
98
106
  keyof typeof keyMirrors.toDeviceAgentMessageType;
@@ -108,7 +116,8 @@ export type ModelsInstallResponseMessageType =
108
116
  typeof toDeviceAgentMessageTypeEnum.models_install_response;
109
117
  export type LiveStateUpdatesTogglesMessageType =
110
118
  typeof toDeviceAgentMessageTypeEnum.live_state_updates;
111
- export type DeviceActionMessageType = typeof toDeviceAgentMessageTypeEnum.device_action;
119
+ export type DeviceActionMessageType =
120
+ typeof toDeviceAgentMessageTypeEnum.device_action;
112
121
 
113
122
  export const appStateValues = Object.values(keyMirrors.appState);
114
123
  export type AppStateValue = keyof typeof keyMirrors.appState;
@@ -116,7 +125,9 @@ export type AppStateValue = keyof typeof keyMirrors.appState;
116
125
  export const appStateControlValues = Object.values(keyMirrors.appStateControl);
117
126
  export type AppStateControlValue = keyof typeof keyMirrors.appStateControl;
118
127
 
119
- export const appVersionControlValues = Object.values(keyMirrors.appVersionControl);
128
+ export const appVersionControlValues = Object.values(
129
+ keyMirrors.appVersionControl
130
+ );
120
131
  export type AppVersionControlValue = keyof typeof keyMirrors.appVersionControl;
121
132
 
122
133
  export const liveUpdatesValues = Object.values(keyMirrors.liveUpdates);
@@ -10,7 +10,8 @@ export interface LiveStateUpdatesTogglePayload {
10
10
  };
11
11
  }
12
12
 
13
- export interface LiveStateUpdatesToggleMessage extends BaseToDeviceAgentMessage {
13
+ export interface LiveStateUpdatesToggleMessage
14
+ extends BaseToDeviceAgentMessage {
14
15
  messageType: LiveStateUpdatesTogglesMessageType;
15
16
  payload: LiveStateUpdatesTogglePayload;
16
17
  }
@@ -4,18 +4,18 @@ import { DeviceStatsMessageType } from './constants';
4
4
  import { BaseToClientMessage } from './types';
5
5
 
6
6
  interface CpuDetails {
7
- usedPerc: number;
8
- temperature: number;
7
+ usedPerc?: number | null;
8
+ temperature?: number | null;
9
9
  }
10
10
 
11
11
  interface DiskDetails {
12
- usedGb: number;
13
- freeGb: number;
12
+ usedGb?: number | null;
13
+ freeGb?: number | null;
14
14
  }
15
15
 
16
16
  interface MemDetails {
17
- usedMb: number;
18
- freeMb: number;
17
+ usedMb?: number | null;
18
+ freeMb?: number | null;
19
19
  }
20
20
 
21
21
  export interface DeviceStatsPayload {
package/src/index.ts CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  getToClientTopic,
15
15
  getToCloudTopic,
16
16
  getToDeviceTopic,
17
- validateToCloudMessage,
17
+ validateToCloudMessage
18
18
  } from './types';
19
19
  import { generateTxId } from './utils';
20
20
  import {
@@ -22,7 +22,7 @@ import {
22
22
  AppState,
23
23
  ServiceStatus,
24
24
  AppStatePayload,
25
- AppStateMessage,
25
+ AppStateMessage
26
26
  } from './app-state-schema';
27
27
  import { AppLogsPayload, AppLogsMessage } from './app-logs-schema';
28
28
  import {
@@ -33,7 +33,7 @@ import {
33
33
  AppVersionControlInstallPayload,
34
34
  AppVersionControlUninstallPayload,
35
35
  AppVersionControlMessage,
36
- ModelInstallPayload,
36
+ ModelInstallPayload
37
37
  } from './app-action-schema';
38
38
  import {
39
39
  ToClientMessageTypeValue,
@@ -48,23 +48,22 @@ import {
48
48
  SignedUrlsRequestMessageType,
49
49
  StatusResponseMessageType,
50
50
  StatusResponseValue,
51
- ToCloudMessageTypeValue,
51
+ ToCloudMessageTypeValue
52
52
  } from './constants';
53
53
  import {
54
54
  LiveStateUpdatesTogglePayload,
55
- LiveStateUpdatesToggleMessage,
55
+ LiveStateUpdatesToggleMessage
56
56
  } from './device-agent-action-schema';
57
57
  import { DeviceStatsPayload, DeviceStatsMessage } from './device-stats-schema';
58
58
  import {
59
59
  StatusResponsePayload,
60
60
  ToClientStatusResponseMessage,
61
- ToDeviceStatusResponseMessage,
61
+ ToDeviceStatusResponseMessage
62
62
  } from './status-response-schema';
63
63
  import {
64
64
  SignedUrlsRequestPayload,
65
- SignedUrlsRequestMessage,
65
+ SignedUrlsRequestMessage
66
66
  } from './signed-urls-request-schema';
67
- import { SystemInformationPayload } from './system-information-schema';
68
67
  import { DeviceActionPayload } from './device-action-schema';
69
68
  import {
70
69
  buildAppLogsMessage,
@@ -76,20 +75,40 @@ import {
76
75
  buildDeviceStatsMessage,
77
76
  buildSignedUrlsRequestMessage,
78
77
  buildToClientStatusResponseMessage,
79
- buildToDeviceStatusResponseMessage,
78
+ buildToDeviceStatusResponseMessage
80
79
  } from './message-builders';
80
+ import {
81
+ ProjectShadowUpdate,
82
+ ShadowProjectsUpdateAll,
83
+ validateProjectShadowUpdate,
84
+ validateShadowProjectsUpdateAll,
85
+ SystemInformationShadowUpdate,
86
+ validateSystemInformationShadowUpdate,
87
+ buildBaseShadowMessage,
88
+ buildUpdateProjectShadowMessage,
89
+ buildUpdateSystemInfoShadowMessage,
90
+ ShadowTopics,
91
+ ShadowNames,
92
+ getShadowTopic,
93
+ getDesiredFromMessage
94
+ } from './shadow-schema';
81
95
 
82
96
  export {
83
97
  // getters
84
98
  getToClientTopic,
85
99
  getToCloudTopic,
86
100
  getToDeviceTopic,
101
+ getShadowTopic,
102
+ getDesiredFromMessage,
87
103
  // types
88
104
  AppDetails,
89
105
  ServiceStatus,
90
106
  AppState,
91
107
  AppStateControlValue,
92
108
  AppStateValue,
109
+ ProjectShadowUpdate,
110
+ ShadowProjectsUpdateAll,
111
+ SystemInformationShadowUpdate,
93
112
  // messageTypes
94
113
  ToCloudMessageTypeValue,
95
114
  AppStateControlMessageType,
@@ -121,9 +140,6 @@ export {
121
140
  ModelsInstallResponsePayload,
122
141
  SignedUrlsRequestPayload,
123
142
  SignedUrlsRequestMessage,
124
- SystemInformationPayload,
125
- DeviceActionPayload,
126
- // generic messages
127
143
  BaseToDeviceAgentMessage,
128
144
  ToDeviceAgentMessage,
129
145
  ToDeviceAgentMessagePayload,
@@ -135,10 +151,14 @@ export {
135
151
  BaseToCloudMessage,
136
152
  ToCloudMessage,
137
153
  ToCloudMessagePayload,
154
+ DeviceActionPayload,
138
155
  // message validators
139
156
  validateToDeviceAgentMessage,
140
157
  validateToClientMessage,
141
158
  validateToCloudMessage,
159
+ validateShadowProjectsUpdateAll,
160
+ validateProjectShadowUpdate,
161
+ validateSystemInformationShadowUpdate,
142
162
  // message builders
143
163
  buildAppLogsMessage,
144
164
  buildAppStateMessage,
@@ -150,8 +170,13 @@ export {
150
170
  buildLiveStateUpdatesToggleMessage,
151
171
  buildAppStateControlMessage,
152
172
  buildDeviceActionMessage,
173
+ buildBaseShadowMessage,
174
+ buildUpdateProjectShadowMessage,
175
+ buildUpdateSystemInfoShadowMessage,
153
176
  // key mirrors
154
177
  keyMirrors,
178
+ ShadowTopics,
179
+ ShadowNames,
155
180
  // utilities
156
- generateTxId,
181
+ generateTxId
157
182
  };
@@ -3,7 +3,7 @@ import {
3
3
  AppStateControlPayload,
4
4
  AppVersionControlInstallPayload,
5
5
  AppVersionControlMessage,
6
- AppVersionControlUninstallPayload,
6
+ AppVersionControlUninstallPayload
7
7
  } from './app-action-schema';
8
8
  import { AppLogsMessage, AppLogsPayload } from './app-logs-schema';
9
9
  import { AppStateMessage, AppStatePayload } from './app-state-schema';
@@ -13,19 +13,22 @@ import {
13
13
  DeviceStatsMessageType,
14
14
  SignedUrlsRequestMessageType,
15
15
  StatusResponseMessageType,
16
- keyMirrors,
16
+ keyMirrors
17
17
  } from './constants';
18
- import { DeviceActionMessage, DeviceActionPayload } from './device-action-schema';
18
+ import {
19
+ DeviceActionMessage,
20
+ DeviceActionPayload
21
+ } from './device-action-schema';
19
22
  import {
20
23
  LiveStateUpdatesToggleMessage,
21
- LiveStateUpdatesTogglePayload,
24
+ LiveStateUpdatesTogglePayload
22
25
  } from './device-agent-action-schema';
23
26
  import { DeviceStatsMessage, DeviceStatsPayload } from './device-stats-schema';
24
27
  import { SignedUrlsRequestMessage } from './signed-urls-request-schema';
25
28
  import {
26
29
  StatusResponsePayload,
27
30
  ToClientStatusResponseMessage,
28
- ToDeviceStatusResponseMessage,
31
+ ToDeviceStatusResponseMessage
29
32
  } from './status-response-schema';
30
33
  import {
31
34
  BaseToClientMessage,
@@ -34,37 +37,43 @@ import {
34
37
  ToCloudMessagePayload,
35
38
  getToClientTopic,
36
39
  getToCloudTopic,
37
- getToDeviceTopic,
40
+ getToDeviceTopic
38
41
  } from './types';
39
42
 
40
- function buildBaseToClientMessage(clientId: string, txId: string): BaseToClientMessage {
43
+ function buildBaseToClientMessage(
44
+ clientId: string,
45
+ txId: string
46
+ ): BaseToClientMessage {
41
47
  const baseClientMessage = {
42
48
  timestamp: new Date().toUTCString(),
43
49
  deviceId: clientId,
44
50
  topic: getToClientTopic(clientId),
45
- txId,
51
+ txId
46
52
  };
47
53
  return baseClientMessage;
48
54
  }
49
55
 
50
56
  function buildBaseToDeviceMessage(
51
57
  deviceId: string,
52
- txId: string,
58
+ txId: string
53
59
  ): BaseToDeviceAgentMessage {
54
60
  const baseToDeviceMessage = {
55
61
  timestamp: new Date().toUTCString(),
56
62
  topic: getToDeviceTopic(deviceId),
57
- txId,
63
+ txId
58
64
  };
59
65
  return baseToDeviceMessage;
60
66
  }
61
67
 
62
- function buildBaseToCloudMessage(deviceId: string, txId: string): BaseToCloudMessage {
68
+ function buildBaseToCloudMessage(
69
+ deviceId: string,
70
+ txId: string
71
+ ): BaseToCloudMessage {
63
72
  const baseToCloudMessage = {
64
73
  deviceId,
65
74
  timestamp: new Date().toUTCString(),
66
75
  topic: getToCloudTopic(deviceId),
67
- txId,
76
+ txId
68
77
  };
69
78
  return baseToCloudMessage;
70
79
  }
@@ -75,14 +84,15 @@ function buildBaseToCloudMessage(deviceId: string, txId: string): BaseToCloudMes
75
84
  function buildAppLogsMessage(
76
85
  clientId: string,
77
86
  payload: AppLogsPayload,
78
- txId: string,
87
+ txId: string
79
88
  ): AppLogsMessage {
80
89
  const baseMessage = buildBaseToClientMessage(clientId, txId);
81
- const messageType: AppLogsMessageType = keyMirrors.toClientMessageType.app_logs;
90
+ const messageType: AppLogsMessageType =
91
+ keyMirrors.toClientMessageType.app_logs;
82
92
  const message = {
83
93
  ...baseMessage,
84
94
  messageType,
85
- payload,
95
+ payload
86
96
  };
87
97
  return message;
88
98
  }
@@ -91,14 +101,15 @@ function buildAppLogsMessage(
91
101
  function buildAppStateMessage(
92
102
  clientId: string,
93
103
  payload: AppStatePayload,
94
- txId: string,
104
+ txId: string
95
105
  ): AppStateMessage {
96
106
  const baseMessage = buildBaseToClientMessage(clientId, txId);
97
- const messageType: AppStateMessageType = keyMirrors.toClientMessageType.app_state;
107
+ const messageType: AppStateMessageType =
108
+ keyMirrors.toClientMessageType.app_state;
98
109
  const message = {
99
110
  ...baseMessage,
100
111
  messageType,
101
- payload,
112
+ payload
102
113
  };
103
114
  return message;
104
115
  }
@@ -107,7 +118,7 @@ function buildAppStateMessage(
107
118
  function buildToClientStatusResponseMessage(
108
119
  clientId: string,
109
120
  payload: StatusResponsePayload,
110
- txId: string,
121
+ txId: string
111
122
  ): ToClientStatusResponseMessage {
112
123
  const baseMessage = buildBaseToClientMessage(clientId, txId);
113
124
  const messageType: StatusResponseMessageType =
@@ -115,7 +126,7 @@ function buildToClientStatusResponseMessage(
115
126
  const message = {
116
127
  ...baseMessage,
117
128
  messageType,
118
- payload,
129
+ payload
119
130
  };
120
131
  return message;
121
132
  }
@@ -124,14 +135,15 @@ function buildToClientStatusResponseMessage(
124
135
  function buildDeviceStatsMessage(
125
136
  clientId: string,
126
137
  payload: DeviceStatsPayload,
127
- txId: string,
138
+ txId: string
128
139
  ): DeviceStatsMessage {
129
- const messageType: DeviceStatsMessageType = keyMirrors.toClientMessageType.device_stats;
140
+ const messageType: DeviceStatsMessageType =
141
+ keyMirrors.toClientMessageType.device_stats;
130
142
  const baseMessage = buildBaseToClientMessage(clientId, txId);
131
143
  const message = {
132
144
  ...baseMessage,
133
145
  messageType,
134
- payload,
146
+ payload
135
147
  };
136
148
  return message;
137
149
  }
@@ -142,7 +154,7 @@ function buildDeviceStatsMessage(
142
154
  function buildToDeviceStatusResponseMessage(
143
155
  clientId: string,
144
156
  payload: StatusResponsePayload,
145
- txId: string,
157
+ txId: string
146
158
  ): ToDeviceStatusResponseMessage {
147
159
  const baseMessage = buildBaseToDeviceMessage(clientId, txId);
148
160
  const messageType: StatusResponseMessageType =
@@ -150,7 +162,7 @@ function buildToDeviceStatusResponseMessage(
150
162
  const message = {
151
163
  ...baseMessage,
152
164
  messageType,
153
- payload,
165
+ payload
154
166
  };
155
167
  return message;
156
168
  }
@@ -159,14 +171,14 @@ function buildToDeviceStatusResponseMessage(
159
171
  function buildAppVersionControlMessage(
160
172
  deviceId: string,
161
173
  payload: AppVersionControlInstallPayload | AppVersionControlUninstallPayload,
162
- txId: string,
174
+ txId: string
163
175
  ): AppVersionControlMessage {
164
176
  const messageType = keyMirrors.toDeviceAgentMessageType.app_version_control;
165
177
  const baseMessage = buildBaseToDeviceMessage(deviceId, txId);
166
178
  const message = {
167
179
  ...baseMessage,
168
180
  messageType,
169
- payload,
181
+ payload
170
182
  };
171
183
  return message;
172
184
  }
@@ -175,14 +187,14 @@ function buildAppVersionControlMessage(
175
187
  function buildLiveStateUpdatesToggleMessage(
176
188
  deviceId: string,
177
189
  payload: LiveStateUpdatesTogglePayload,
178
- txId: string,
190
+ txId: string
179
191
  ): LiveStateUpdatesToggleMessage {
180
192
  const messageType = keyMirrors.toDeviceAgentMessageType.live_state_updates;
181
193
  const baseMessage = buildBaseToDeviceMessage(deviceId, txId);
182
194
  const message = {
183
195
  ...baseMessage,
184
196
  messageType,
185
- payload,
197
+ payload
186
198
  };
187
199
  return message;
188
200
  }
@@ -191,14 +203,14 @@ function buildLiveStateUpdatesToggleMessage(
191
203
  function buildAppStateControlMessage(
192
204
  deviceId: string,
193
205
  payload: AppStateControlPayload,
194
- txId: string,
206
+ txId: string
195
207
  ): AppStateControlMessage {
196
208
  const messageType = keyMirrors.toDeviceAgentMessageType.app_state_control;
197
209
  const baseMessage = buildBaseToDeviceMessage(deviceId, txId);
198
210
  const message = {
199
211
  ...baseMessage,
200
212
  messageType,
201
- payload,
213
+ payload
202
214
  };
203
215
  return message;
204
216
  }
@@ -206,14 +218,14 @@ function buildAppStateControlMessage(
206
218
  function buildDeviceActionMessage(
207
219
  deviceId: string,
208
220
  payload: DeviceActionPayload,
209
- txId: string,
221
+ txId: string
210
222
  ): DeviceActionMessage {
211
223
  const messageType = keyMirrors.toDeviceAgentMessageType.device_action;
212
224
  const baseMessage = buildBaseToDeviceMessage(deviceId, txId);
213
225
  const message = {
214
226
  ...baseMessage,
215
227
  messageType,
216
- payload,
228
+ payload
217
229
  };
218
230
  return message;
219
231
  }
@@ -224,7 +236,7 @@ function buildDeviceActionMessage(
224
236
  function buildSignedUrlsRequestMessage(
225
237
  clientId: string,
226
238
  payload: ToCloudMessagePayload,
227
- txId: string,
239
+ txId: string
228
240
  ): SignedUrlsRequestMessage {
229
241
  const baseMessage = buildBaseToCloudMessage(clientId, txId);
230
242
  const messageType: SignedUrlsRequestMessageType =
@@ -232,7 +244,7 @@ function buildSignedUrlsRequestMessage(
232
244
  const message = {
233
245
  ...baseMessage,
234
246
  messageType,
235
- payload,
247
+ payload
236
248
  };
237
249
  return message;
238
250
  }
@@ -247,5 +259,5 @@ export {
247
259
  buildAppVersionControlMessage,
248
260
  buildLiveStateUpdatesToggleMessage,
249
261
  buildAppStateControlMessage,
250
- buildDeviceActionMessage,
262
+ buildDeviceActionMessage
251
263
  };
@@ -21,10 +21,16 @@
21
21
  "description": "CPU utilization information",
22
22
  "properties": {
23
23
  "usedPerc": {
24
- "type": "number"
24
+ "type": [
25
+ "number",
26
+ "null"
27
+ ]
25
28
  },
26
29
  "temperature": {
27
- "type": "number"
30
+ "type": [
31
+ "number",
32
+ "null"
33
+ ]
28
34
  }
29
35
  }
30
36
  },
@@ -33,10 +39,16 @@
33
39
  "description": "Disk utilization information",
34
40
  "properties": {
35
41
  "usedGb": {
36
- "type": "number"
42
+ "type": [
43
+ "number",
44
+ "null"
45
+ ]
37
46
  },
38
47
  "freeGb": {
39
- "type": "number"
48
+ "type": [
49
+ "number",
50
+ "null"
51
+ ]
40
52
  }
41
53
  }
42
54
  },
@@ -45,10 +57,16 @@
45
57
  "description": "Memory utilization information",
46
58
  "properties": {
47
59
  "usedMb": {
48
- "type": "number"
60
+ "type": [
61
+ "number",
62
+ "null"
63
+ ]
49
64
  },
50
65
  "freeMb": {
51
- "type": "number"
66
+ "type": [
67
+ "number",
68
+ "null"
69
+ ]
52
70
  }
53
71
  }
54
72
  }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$id": "https://alwaysai.co/shadow-project-update-schema.json",
3
+ "title": "shadow_project_update_schema",
4
+ "description": "The messaging payload structure for a all properties of a single project shadow update",
5
+ "type": "object",
6
+ "nullable": true,
7
+ "properties": {
8
+ "appConfig": {
9
+ "type": "string"
10
+ },
11
+ "envVars": {
12
+ "type": "object",
13
+ "patternProperties": {
14
+ ".*": {
15
+ "type": "object",
16
+ "patternProperties":{
17
+ ".*": {
18
+ "type": ["string", "null"]
19
+ }
20
+ },
21
+ "required": []
22
+ }
23
+ },
24
+ "required": [],
25
+ "additionalProperties": true
26
+ }
27
+ },
28
+ "required": [],
29
+ "additionalProperties": true
30
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$id": "https://alwaysai.co/shadow-projects-update-all-schema.json",
3
+ "title": "shadow-projects-update-all",
4
+ "description": "The messaging payload structure for shadow's projects update delta",
5
+ "type": "object",
6
+ "patternProperties": {
7
+ ".*": {
8
+ "type": ["object","null"],
9
+ "$ref": "https://alwaysai.co/shadow-project-update-schema.json"
10
+ }
11
+ },
12
+ "propertyNames": {
13
+ "$ref": "https://alwaysai.co/common-schema.json#/$defs/projectId"
14
+ },
15
+ "required": [],
16
+ "additionalProperties": true
17
+ }