@alwaysai/device-agent-schemas 2.3.3 → 2.3.5

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 (415) hide show
  1. package/LICENSE +12 -0
  2. package/README.md +12 -1
  3. package/package.json +19 -9
  4. package/.eslintignore +0 -4
  5. package/.eslintrc +0 -14
  6. package/.node-version +0 -1
  7. package/bitbucket-pipelines.yml +0 -10
  8. package/development.md +0 -53
  9. package/docs/README.md +0 -107
  10. package/docs/agent-message-schema-defs-toclient.md +0 -25
  11. package/docs/agent-message-schema-defs-tocloud.md +0 -25
  12. package/docs/agent-message-schema-defs.md +0 -15
  13. package/docs/agent-message-schema-properties-deviceid.md +0 -15
  14. package/docs/agent-message-schema-properties-payload-oneof-app_install_status.md +0 -66
  15. package/docs/agent-message-schema-properties-payload-oneof-app_logs.md +0 -66
  16. package/docs/agent-message-schema-properties-payload-oneof-app_state.md +0 -66
  17. package/docs/agent-message-schema-properties-payload-oneof-device_stats.md +0 -66
  18. package/docs/agent-message-schema-properties-payload-oneof-signed_urls_request.md +0 -85
  19. package/docs/agent-message-schema-properties-payload.md +0 -27
  20. package/docs/agent-message-schema-properties-timestamp.md +0 -15
  21. package/docs/agent-message-schema-properties-topic-oneof-0.md +0 -25
  22. package/docs/agent-message-schema-properties-topic-oneof-1.md +0 -25
  23. package/docs/agent-message-schema-properties-topic.md +0 -21
  24. package/docs/agent-message-schema.md +0 -138
  25. package/docs/app-install-cloud-response-schema-properties-appinstallcloudresponse-properties-appinstallpayload-properties-appsignedurl.md +0 -15
  26. package/docs/app-install-cloud-response-schema-properties-appinstallcloudresponse-properties-appinstallpayload.md +0 -39
  27. package/docs/app-install-cloud-response-schema-properties-appinstallcloudresponse-properties-appreleasehash.md +0 -25
  28. package/docs/app-install-cloud-response-schema-properties-appinstallcloudresponse-properties-models_install_payload.md +0 -15
  29. package/docs/app-install-cloud-response-schema-properties-appinstallcloudresponse-properties-projectid.md +0 -25
  30. package/docs/app-install-cloud-response-schema-properties-appinstallcloudresponse.md +0 -116
  31. package/docs/app-install-cloud-response-schema-properties-messagetype.md +0 -23
  32. package/docs/app-install-cloud-response-schema.md +0 -66
  33. package/docs/app-install-response-schema-properties-appinstallresponse-properties-appinstallpayload-properties-appsignedurl.md +0 -15
  34. package/docs/app-install-response-schema-properties-appinstallresponse-properties-appinstallpayload.md +0 -39
  35. package/docs/app-install-response-schema-properties-appinstallresponse-properties-appreleasehash.md +0 -25
  36. package/docs/app-install-response-schema-properties-appinstallresponse-properties-models_install_payload.md +0 -15
  37. package/docs/app-install-response-schema-properties-appinstallresponse-properties-projectid.md +0 -25
  38. package/docs/app-install-response-schema-properties-appinstallresponse.md +0 -116
  39. package/docs/app-install-response-schema.md +0 -39
  40. package/docs/app-install-schema-properties-appreleasehash.md +0 -25
  41. package/docs/app-install-schema-properties-basecommand.md +0 -23
  42. package/docs/app-install-schema-properties-projectid.md +0 -25
  43. package/docs/app-install-schema.md +0 -105
  44. package/docs/app-install-status-schema-properties-appinstallstatus-properties-appreleasehash.md +0 -25
  45. package/docs/app-install-status-schema-properties-appinstallstatus-properties-message.md +0 -15
  46. package/docs/app-install-status-schema-properties-appinstallstatus-properties-status.md +0 -26
  47. package/docs/app-install-status-schema-properties-appinstallstatus.md +0 -98
  48. package/docs/app-install-status-schema-properties-messagetype.md +0 -23
  49. package/docs/app-install-status-schema.md +0 -66
  50. package/docs/app-logs-schema-properties-applogs-properties-logchunk.md +0 -15
  51. package/docs/app-logs-schema-properties-applogs-properties-projectid.md +0 -25
  52. package/docs/app-logs-schema-properties-applogs.md +0 -68
  53. package/docs/app-logs-schema-properties-logchunk.md +0 -15
  54. package/docs/app-logs-schema-properties-messagetype.md +0 -23
  55. package/docs/app-logs-schema-properties-projectid.md +0 -25
  56. package/docs/app-logs-schema.md +0 -68
  57. package/docs/app-state-control-schema-properties-appstatecontrol-properties-basecommand.md +0 -25
  58. package/docs/app-state-control-schema-properties-appstatecontrol-properties-projectid.md +0 -25
  59. package/docs/app-state-control-schema-properties-appstatecontrol.md +0 -78
  60. package/docs/app-state-control-schema-properties-basecommand.md +0 -25
  61. package/docs/app-state-control-schema-properties-messagetype.md +0 -23
  62. package/docs/app-state-control-schema-properties-projectid.md +0 -25
  63. package/docs/app-state-control-schema.md +0 -78
  64. package/docs/app-state-schema-properties-appstate-items-properties-appdetails-properties-projectid.md +0 -25
  65. package/docs/app-state-schema-properties-appstate-items-properties-appdetails-properties-version.md +0 -25
  66. package/docs/app-state-schema-properties-appstate-items-properties-appdetails.md +0 -78
  67. package/docs/app-state-schema-properties-appstate-items-properties-services-items-properties-name.md +0 -15
  68. package/docs/app-state-schema-properties-appstate-items-properties-services-items-properties-state.md +0 -25
  69. package/docs/app-state-schema-properties-appstate-items-properties-services-items.md +0 -68
  70. package/docs/app-state-schema-properties-appstate-items-properties-services.md +0 -15
  71. package/docs/app-state-schema-properties-appstate-items.md +0 -58
  72. package/docs/app-state-schema-properties-appstate.md +0 -15
  73. package/docs/app-state-schema-properties-messagetype.md +0 -23
  74. package/docs/app-state-schema.md +0 -39
  75. package/docs/app-uninstall-schema-properties-basecommand.md +0 -23
  76. package/docs/app-uninstall-schema-properties-projectid.md +0 -25
  77. package/docs/app-uninstall-schema.md +0 -76
  78. package/docs/app-version-control-schema-properties-appversioncontrol.md +0 -21
  79. package/docs/app-version-control-schema-properties-messagetype.md +0 -23
  80. package/docs/app-version-control-schema.md +0 -21
  81. package/docs/app_install_cloud_response_schema-properties-appinstallcloudresponse-properties-appinstallpayload-properties-appsignedurl.md +0 -15
  82. package/docs/app_install_cloud_response_schema-properties-appinstallcloudresponse-properties-appinstallpayload.md +0 -39
  83. package/docs/app_install_cloud_response_schema-properties-appinstallcloudresponse-properties-appreleasehash.md +0 -25
  84. package/docs/app_install_cloud_response_schema-properties-appinstallcloudresponse-properties-modelsinstallpayload.md +0 -15
  85. package/docs/app_install_cloud_response_schema-properties-appinstallcloudresponse-properties-projectid.md +0 -25
  86. package/docs/app_install_cloud_response_schema-properties-appinstallcloudresponse.md +0 -116
  87. package/docs/app_install_cloud_response_schema-properties-messagetype.md +0 -23
  88. package/docs/app_install_cloud_response_schema.md +0 -66
  89. package/docs/app_install_schema-properties-appreleasehash.md +0 -25
  90. package/docs/app_install_schema-properties-basecommand.md +0 -23
  91. package/docs/app_install_schema-properties-projectid.md +0 -25
  92. package/docs/app_install_schema.md +0 -105
  93. package/docs/app_state_control_schema-properties-appstatecontrol-properties-basecommand.md +0 -25
  94. package/docs/app_state_control_schema-properties-appstatecontrol-properties-projectid.md +0 -25
  95. package/docs/app_state_control_schema-properties-appstatecontrol.md +0 -78
  96. package/docs/app_state_control_schema-properties-messagetype.md +0 -23
  97. package/docs/app_state_control_schema.md +0 -66
  98. package/docs/app_uninstall_schema-properties-basecommand.md +0 -23
  99. package/docs/app_uninstall_schema-properties-projectid.md +0 -25
  100. package/docs/app_uninstall_schema.md +0 -76
  101. package/docs/app_version_control_schema-properties-appversioncontrol.md +0 -21
  102. package/docs/app_version_control_schema-properties-messagetype.md +0 -23
  103. package/docs/app_version_control_schema.md +0 -72
  104. package/docs/client-message-schema-defs-message.md +0 -25
  105. package/docs/client-message-schema-defs.md +0 -15
  106. package/docs/client-message-schema-properties-payload-oneof-live_state_updates.md +0 -66
  107. package/docs/client-message-schema-properties-payload-oneof-models_install_cloud_response.md +0 -66
  108. package/docs/client-message-schema-properties-payload.md +0 -27
  109. package/docs/client-message-schema-properties-timestamp.md +0 -15
  110. package/docs/client-message-schema-properties-topic.md +0 -25
  111. package/docs/client-message-schema.md +0 -112
  112. package/docs/client_message_schema-defs-message.md +0 -25
  113. package/docs/client_message_schema-defs.md +0 -15
  114. package/docs/client_message_schema-properties-payload-oneof-3.md +0 -66
  115. package/docs/client_message_schema-properties-payload-oneof-4.md +0 -66
  116. package/docs/client_message_schema-properties-payload.md +0 -27
  117. package/docs/client_message_schema-properties-timestamp.md +0 -15
  118. package/docs/client_message_schema-properties-topic.md +0 -25
  119. package/docs/client_message_schema.md +0 -112
  120. package/docs/common-schema-defs-appreleasehash.md +0 -25
  121. package/docs/common-schema-defs-modelid.md +0 -25
  122. package/docs/common-schema-defs-projectid.md +0 -25
  123. package/docs/common-schema-defs-txid.md +0 -29
  124. package/docs/common-schema-defs.md +0 -15
  125. package/docs/common-schema.md +0 -61
  126. package/docs/device-action-schema-properties-action.md +0 -23
  127. package/docs/device-action-schema.md +0 -47
  128. package/docs/device-stats-schema-properties-cpudetails-properties-temperature.md +0 -15
  129. package/docs/device-stats-schema-properties-cpudetails-properties-usedperc.md +0 -15
  130. package/docs/device-stats-schema-properties-cpudetails.md +0 -58
  131. package/docs/device-stats-schema-properties-cpuusage.md +0 -15
  132. package/docs/device-stats-schema-properties-diskdetails-properties-freegb.md +0 -15
  133. package/docs/device-stats-schema-properties-diskdetails-properties-usedgb.md +0 -15
  134. package/docs/device-stats-schema-properties-diskdetails.md +0 -58
  135. package/docs/device-stats-schema-properties-diskutil.md +0 -15
  136. package/docs/device-stats-schema-properties-memdetails-properties-freemb.md +0 -15
  137. package/docs/device-stats-schema-properties-memdetails-properties-usedmb.md +0 -15
  138. package/docs/device-stats-schema-properties-memdetails.md +0 -58
  139. package/docs/device-stats-schema-properties-usedmemorypercentage.md +0 -15
  140. package/docs/device-stats-schema.md +0 -134
  141. package/docs/device-status-schema-properties-devicestats-properties-cpuusage.md +0 -15
  142. package/docs/device-status-schema-properties-devicestats-properties-diskutil.md +0 -15
  143. package/docs/device-status-schema-properties-devicestats-properties-usedmemorypercentage.md +0 -15
  144. package/docs/device-status-schema-properties-devicestats.md +0 -77
  145. package/docs/device-status-schema-properties-messagetype.md +0 -23
  146. package/docs/device-status-schema.md +0 -66
  147. package/docs/live-updates-toggle-schema-properties-applogs-properties-toggle.md +0 -15
  148. package/docs/live-updates-toggle-schema-properties-applogs.md +0 -68
  149. package/docs/live-updates-toggle-schema-properties-appstate.md +0 -15
  150. package/docs/live-updates-toggle-schema-properties-devicestats.md +0 -15
  151. package/docs/live-updates-toggle-schema-properties-liveupdatestoggles-properties-applogs-properties-projectid.md +0 -25
  152. package/docs/live-updates-toggle-schema-properties-liveupdatestoggles-properties-applogs-properties-toggle.md +0 -15
  153. package/docs/live-updates-toggle-schema-properties-liveupdatestoggles-properties-applogs.md +0 -68
  154. package/docs/live-updates-toggle-schema-properties-liveupdatestoggles-properties-appstate.md +0 -15
  155. package/docs/live-updates-toggle-schema-properties-liveupdatestoggles-properties-devicestats.md +0 -15
  156. package/docs/live-updates-toggle-schema-properties-liveupdatestoggles.md +0 -77
  157. package/docs/live-updates-toggle-schema-properties-messagetype.md +0 -23
  158. package/docs/live-updates-toggle-schema.md +0 -77
  159. package/docs/live_updates_toggle_schema-properties-liveupdatestoggles-properties-applogs-properties-projectid.md +0 -25
  160. package/docs/live_updates_toggle_schema-properties-liveupdatestoggles-properties-applogs-properties-toggle.md +0 -15
  161. package/docs/live_updates_toggle_schema-properties-liveupdatestoggles-properties-applogs.md +0 -68
  162. package/docs/live_updates_toggle_schema-properties-liveupdatestoggles-properties-appstate.md +0 -15
  163. package/docs/live_updates_toggle_schema-properties-liveupdatestoggles-properties-devicestats.md +0 -15
  164. package/docs/live_updates_toggle_schema-properties-liveupdatestoggles.md +0 -77
  165. package/docs/live_updates_toggle_schema-properties-messagetype.md +0 -23
  166. package/docs/live_updates_toggle_schema.md +0 -66
  167. package/docs/models-install-cloud-response-schema-properties-messagetype.md +0 -23
  168. package/docs/models-install-cloud-response-schema-properties-modelsinstallcloudresponse-properties-projectid.md +0 -25
  169. package/docs/models-install-cloud-response-schema-properties-modelsinstallcloudresponse.md +0 -68
  170. package/docs/models-install-cloud-response-schema.md +0 -66
  171. package/docs/models-install-payload-schema-items-properties-id.md +0 -25
  172. package/docs/models-install-payload-schema-items-properties-modelsignedurl.md +0 -15
  173. package/docs/models-install-payload-schema-items-properties-version.md +0 -15
  174. package/docs/models-install-payload-schema-items.md +0 -87
  175. package/docs/models-install-payload-schema.md +0 -15
  176. package/docs/models-install-response-schema-properties-modelsinstallresponse.md +0 -68
  177. package/docs/models-install-response-schema.md +0 -39
  178. package/docs/models_install_cloud_response_schema-properties-messagetype.md +0 -23
  179. package/docs/models_install_cloud_response_schema-properties-modelsinstallcloudresponse-properties-projectid.md +0 -25
  180. package/docs/models_install_cloud_response_schema-properties-modelsinstallcloudresponse.md +0 -68
  181. package/docs/models_install_cloud_response_schema.md +0 -66
  182. package/docs/models_install_payload_schema-items-properties-id.md +0 -25
  183. package/docs/models_install_payload_schema-items-properties-modelsignedurl.md +0 -15
  184. package/docs/models_install_payload_schema-items-properties-version.md +0 -15
  185. package/docs/models_install_payload_schema-items.md +0 -87
  186. package/docs/models_install_payload_schema.md +0 -15
  187. package/docs/shadow-project-update-schema-properties-appconfig.md +0 -15
  188. package/docs/shadow-project-update-schema-properties-envvars-patternproperties--patternproperties-.md +0 -15
  189. package/docs/shadow-project-update-schema-properties-envvars-patternproperties--patternproperties.md +0 -15
  190. package/docs/shadow-project-update-schema-properties-envvars-patternproperties-.md +0 -39
  191. package/docs/shadow-project-update-schema-properties-envvars-patternproperties.md +0 -15
  192. package/docs/shadow-project-update-schema-properties-envvars.md +0 -44
  193. package/docs/shadow-project-update-schema.md +0 -63
  194. package/docs/shadow-projects-update-all-schema-patternproperties.md +0 -15
  195. package/docs/shadow-projects-update-all-schema-propertynames.md +0 -25
  196. package/docs/shadow-projects-update-all-schema.md +0 -44
  197. package/docs/signed-urls-request-schema-properties-messagetype.md +0 -23
  198. package/docs/signed-urls-request-schema-properties-modelsonlyurlsrequest-properties-models-patternproperties-a-za-z0-9_.md +0 -15
  199. package/docs/signed-urls-request-schema-properties-modelsonlyurlsrequest-properties-models-patternproperties.md +0 -15
  200. package/docs/signed-urls-request-schema-properties-modelsonlyurlsrequest-properties-models.md +0 -39
  201. package/docs/signed-urls-request-schema-properties-modelsonlyurlsrequest-properties-projectid.md +0 -25
  202. package/docs/signed-urls-request-schema-properties-modelsonlyurlsrequest.md +0 -68
  203. package/docs/signed-urls-request-schema-properties-signedurlsrequest-properties-appreleasehash.md +0 -25
  204. package/docs/signed-urls-request-schema-properties-signedurlsrequest-properties-projectid.md +0 -25
  205. package/docs/signed-urls-request-schema-properties-signedurlsrequest.md +0 -78
  206. package/docs/signed-urls-request-schema.md +0 -58
  207. package/docs/status-response-schema-properties-message.md +0 -15
  208. package/docs/status-response-schema-properties-status.md +0 -27
  209. package/docs/status-response-schema.md +0 -70
  210. package/docs/system-information-schema-properties-cpu-properties-brand.md +0 -15
  211. package/docs/system-information-schema-properties-cpu-properties-cores.md +0 -15
  212. package/docs/system-information-schema-properties-cpu-properties-efficiencycores.md +0 -15
  213. package/docs/system-information-schema-properties-cpu-properties-manufacturer.md +0 -15
  214. package/docs/system-information-schema-properties-cpu-properties-model.md +0 -15
  215. package/docs/system-information-schema-properties-cpu-properties-physicalcores.md +0 -15
  216. package/docs/system-information-schema-properties-cpu-properties-processors.md +0 -15
  217. package/docs/system-information-schema-properties-cpu-properties-vendor.md +0 -15
  218. package/docs/system-information-schema-properties-cpu.md +0 -172
  219. package/docs/system-information-schema-properties-device-properties-manufacturer.md +0 -15
  220. package/docs/system-information-schema-properties-device-properties-model.md +0 -15
  221. package/docs/system-information-schema-properties-device-properties-serial.md +0 -15
  222. package/docs/system-information-schema-properties-device-properties-version.md +0 -15
  223. package/docs/system-information-schema-properties-device-properties-virtual.md +0 -15
  224. package/docs/system-information-schema-properties-device.md +0 -115
  225. package/docs/system-information-schema-properties-disk-properties-drives-items-properties-device.md +0 -15
  226. package/docs/system-information-schema-properties-disk-properties-drives-items-properties-name.md +0 -15
  227. package/docs/system-information-schema-properties-disk-properties-drives-items-properties-size.md +0 -15
  228. package/docs/system-information-schema-properties-disk-properties-drives-items-properties-type.md +0 -15
  229. package/docs/system-information-schema-properties-disk-properties-drives-items-properties-vendor.md +0 -15
  230. package/docs/system-information-schema-properties-disk-properties-drives-items.md +0 -115
  231. package/docs/system-information-schema-properties-disk-properties-drives.md +0 -15
  232. package/docs/system-information-schema-properties-disk.md +0 -39
  233. package/docs/system-information-schema-properties-network-properties-ipv4address.md +0 -15
  234. package/docs/system-information-schema-properties-network-properties-ipv6address.md +0 -15
  235. package/docs/system-information-schema-properties-network-properties-macaddress.md +0 -15
  236. package/docs/system-information-schema-properties-network.md +0 -77
  237. package/docs/system-information-schema-properties-os-properties-architecture.md +0 -15
  238. package/docs/system-information-schema-properties-os-properties-distro.md +0 -15
  239. package/docs/system-information-schema-properties-os-properties-hostname.md +0 -15
  240. package/docs/system-information-schema-properties-os-properties-kernel.md +0 -15
  241. package/docs/system-information-schema-properties-os-properties-platform.md +0 -15
  242. package/docs/system-information-schema-properties-os-properties-release.md +0 -15
  243. package/docs/system-information-schema-properties-os.md +0 -134
  244. package/docs/system-information-schema-properties-versions-properties-agent.md +0 -15
  245. package/docs/system-information-schema-properties-versions-properties-deviceagentschemas.md +0 -15
  246. package/docs/system-information-schema-properties-versions.md +0 -58
  247. package/docs/system-information-schema.md +0 -134
  248. package/docs/to-client-message-schema-allof-0-if-properties-messagetype.md +0 -23
  249. package/docs/to-client-message-schema-allof-0-if-properties.md +0 -15
  250. package/docs/to-client-message-schema-allof-0-if.md +0 -47
  251. package/docs/to-client-message-schema-allof-0-then-properties.md +0 -15
  252. package/docs/to-client-message-schema-allof-0-then.md +0 -39
  253. package/docs/to-client-message-schema-allof-0.md +0 -15
  254. package/docs/to-client-message-schema-allof-1-if-properties-messagetype.md +0 -23
  255. package/docs/to-client-message-schema-allof-1-if-properties.md +0 -15
  256. package/docs/to-client-message-schema-allof-1-if.md +0 -47
  257. package/docs/to-client-message-schema-allof-1-then-properties.md +0 -15
  258. package/docs/to-client-message-schema-allof-1-then.md +0 -39
  259. package/docs/to-client-message-schema-allof-1.md +0 -15
  260. package/docs/to-client-message-schema-allof-2-if-properties-messagetype.md +0 -23
  261. package/docs/to-client-message-schema-allof-2-if-properties.md +0 -15
  262. package/docs/to-client-message-schema-allof-2-if.md +0 -47
  263. package/docs/to-client-message-schema-allof-2-then-properties.md +0 -15
  264. package/docs/to-client-message-schema-allof-2-then.md +0 -39
  265. package/docs/to-client-message-schema-allof-2.md +0 -15
  266. package/docs/to-client-message-schema-allof-3-if-properties-messagetype.md +0 -23
  267. package/docs/to-client-message-schema-allof-3-if-properties.md +0 -15
  268. package/docs/to-client-message-schema-allof-3-if.md +0 -47
  269. package/docs/to-client-message-schema-allof-3-then-properties.md +0 -15
  270. package/docs/to-client-message-schema-allof-3-then.md +0 -39
  271. package/docs/to-client-message-schema-allof-3.md +0 -15
  272. package/docs/to-client-message-schema-defs-toclient.md +0 -25
  273. package/docs/to-client-message-schema-defs.md +0 -15
  274. package/docs/to-client-message-schema-properties-deviceid.md +0 -15
  275. package/docs/to-client-message-schema-properties-messagetype.md +0 -26
  276. package/docs/to-client-message-schema-properties-payload.md +0 -25
  277. package/docs/to-client-message-schema-properties-timestamp.md +0 -15
  278. package/docs/to-client-message-schema-properties-topic-oneof-0.md +0 -25
  279. package/docs/to-client-message-schema-properties-topic.md +0 -19
  280. package/docs/to-client-message-schema.md +0 -196
  281. package/docs/to-cloud-message-schema-allof-0-if-properties-messagetype.md +0 -23
  282. package/docs/to-cloud-message-schema-allof-0-if-properties.md +0 -15
  283. package/docs/to-cloud-message-schema-allof-0-if.md +0 -47
  284. package/docs/to-cloud-message-schema-allof-0-then-properties.md +0 -15
  285. package/docs/to-cloud-message-schema-allof-0-then.md +0 -39
  286. package/docs/to-cloud-message-schema-allof-0.md +0 -15
  287. package/docs/to-cloud-message-schema-defs-tocloud.md +0 -25
  288. package/docs/to-cloud-message-schema-defs.md +0 -15
  289. package/docs/to-cloud-message-schema-properties-deviceid.md +0 -15
  290. package/docs/to-cloud-message-schema-properties-messagetype.md +0 -23
  291. package/docs/to-cloud-message-schema-properties-payload.md +0 -19
  292. package/docs/to-cloud-message-schema-properties-timestamp.md +0 -15
  293. package/docs/to-cloud-message-schema-properties-topic-oneof-0.md +0 -25
  294. package/docs/to-cloud-message-schema-properties-topic.md +0 -19
  295. package/docs/to-cloud-message-schema.md +0 -181
  296. package/docs/to-device-agent-message-schema-allof-0-if-properties-messagetype.md +0 -23
  297. package/docs/to-device-agent-message-schema-allof-0-if-properties.md +0 -15
  298. package/docs/to-device-agent-message-schema-allof-0-if.md +0 -47
  299. package/docs/to-device-agent-message-schema-allof-0-then-properties.md +0 -15
  300. package/docs/to-device-agent-message-schema-allof-0-then.md +0 -39
  301. package/docs/to-device-agent-message-schema-allof-0.md +0 -15
  302. package/docs/to-device-agent-message-schema-allof-1-if-properties-messagetype.md +0 -23
  303. package/docs/to-device-agent-message-schema-allof-1-if-properties.md +0 -15
  304. package/docs/to-device-agent-message-schema-allof-1-if.md +0 -47
  305. package/docs/to-device-agent-message-schema-allof-1-then-properties.md +0 -15
  306. package/docs/to-device-agent-message-schema-allof-1-then.md +0 -45
  307. package/docs/to-device-agent-message-schema-allof-1.md +0 -15
  308. package/docs/to-device-agent-message-schema-allof-2-if-properties-messagetype.md +0 -23
  309. package/docs/to-device-agent-message-schema-allof-2-if-properties.md +0 -15
  310. package/docs/to-device-agent-message-schema-allof-2-if.md +0 -47
  311. package/docs/to-device-agent-message-schema-allof-2-then-properties.md +0 -15
  312. package/docs/to-device-agent-message-schema-allof-2-then.md +0 -39
  313. package/docs/to-device-agent-message-schema-allof-2.md +0 -15
  314. package/docs/to-device-agent-message-schema-allof-3-if-properties-messagetype.md +0 -23
  315. package/docs/to-device-agent-message-schema-allof-3-if-properties.md +0 -15
  316. package/docs/to-device-agent-message-schema-allof-3-if.md +0 -47
  317. package/docs/to-device-agent-message-schema-allof-3-then-properties.md +0 -15
  318. package/docs/to-device-agent-message-schema-allof-3-then.md +0 -39
  319. package/docs/to-device-agent-message-schema-allof-3.md +0 -15
  320. package/docs/to-device-agent-message-schema-allof-4-if-properties-messagetype.md +0 -23
  321. package/docs/to-device-agent-message-schema-allof-4-if-properties.md +0 -15
  322. package/docs/to-device-agent-message-schema-allof-4-if.md +0 -47
  323. package/docs/to-device-agent-message-schema-allof-4-then-properties.md +0 -15
  324. package/docs/to-device-agent-message-schema-allof-4-then.md +0 -39
  325. package/docs/to-device-agent-message-schema-allof-4.md +0 -15
  326. package/docs/to-device-agent-message-schema-allof-5-if-properties-messagetype.md +0 -23
  327. package/docs/to-device-agent-message-schema-allof-5-if-properties.md +0 -15
  328. package/docs/to-device-agent-message-schema-allof-5-if.md +0 -47
  329. package/docs/to-device-agent-message-schema-allof-5-then-properties.md +0 -15
  330. package/docs/to-device-agent-message-schema-allof-5-then.md +0 -39
  331. package/docs/to-device-agent-message-schema-allof-5.md +0 -15
  332. package/docs/to-device-agent-message-schema-allof-6-if-properties-messagetype.md +0 -23
  333. package/docs/to-device-agent-message-schema-allof-6-if-properties.md +0 -15
  334. package/docs/to-device-agent-message-schema-allof-6-if.md +0 -47
  335. package/docs/to-device-agent-message-schema-allof-6-then-properties.md +0 -15
  336. package/docs/to-device-agent-message-schema-allof-6-then.md +0 -39
  337. package/docs/to-device-agent-message-schema-allof-6.md +0 -15
  338. package/docs/to-device-agent-message-schema-defs-todevice.md +0 -25
  339. package/docs/to-device-agent-message-schema-defs.md +0 -15
  340. package/docs/to-device-agent-message-schema-properties-messagetype.md +0 -29
  341. package/docs/to-device-agent-message-schema-properties-payload.md +0 -35
  342. package/docs/to-device-agent-message-schema-properties-timestamp.md +0 -15
  343. package/docs/to-device-agent-message-schema-properties-topic.md +0 -25
  344. package/docs/to-device-agent-message-schema.md +0 -202
  345. package/jest.config.js +0 -3
  346. package/lib/app-action-schema.d.ts.map +0 -1
  347. package/lib/app-action-schema.js.map +0 -1
  348. package/lib/app-logs-schema.d.ts.map +0 -1
  349. package/lib/app-logs-schema.js.map +0 -1
  350. package/lib/app-state-schema.d.ts.map +0 -1
  351. package/lib/app-state-schema.js.map +0 -1
  352. package/lib/constants.d.ts.map +0 -1
  353. package/lib/constants.js.map +0 -1
  354. package/lib/device-action-schema.d.ts.map +0 -1
  355. package/lib/device-action-schema.js.map +0 -1
  356. package/lib/device-agent-action-schema.d.ts.map +0 -1
  357. package/lib/device-agent-action-schema.js.map +0 -1
  358. package/lib/device-stats-schema.d.ts.map +0 -1
  359. package/lib/device-stats-schema.js.map +0 -1
  360. package/lib/index.d.ts.map +0 -1
  361. package/lib/index.js.map +0 -1
  362. package/lib/message-builders.d.ts.map +0 -1
  363. package/lib/message-builders.js.map +0 -1
  364. package/lib/shadow-schema.d.ts.map +0 -1
  365. package/lib/shadow-schema.js.map +0 -1
  366. package/lib/signed-urls-request-schema.d.ts.map +0 -1
  367. package/lib/signed-urls-request-schema.js.map +0 -1
  368. package/lib/status-response-schema.d.ts.map +0 -1
  369. package/lib/status-response-schema.js.map +0 -1
  370. package/lib/types.d.ts.map +0 -1
  371. package/lib/types.js.map +0 -1
  372. package/lib/utils.d.ts.map +0 -1
  373. package/lib/utils.js.map +0 -1
  374. package/src/app-action-schema.ts +0 -71
  375. package/src/app-logs-schema.ts +0 -13
  376. package/src/app-state-schema.ts +0 -27
  377. package/src/constants.ts +0 -140
  378. package/src/device-action-schema.ts +0 -11
  379. package/src/device-agent-action-schema.ts +0 -17
  380. package/src/device-stats-schema.ts +0 -33
  381. package/src/index.ts +0 -190
  382. package/src/message-builders.ts +0 -263
  383. package/src/schemas/app-install-response-schema.json +0 -41
  384. package/src/schemas/app-install-schema.json +0 -20
  385. package/src/schemas/app-logs-schema.json +0 -16
  386. package/src/schemas/app-state-control-schema.json +0 -17
  387. package/src/schemas/app-state-schema.json +0 -49
  388. package/src/schemas/app-uninstall-schema.json +0 -17
  389. package/src/schemas/app-version-control-schema.json +0 -14
  390. package/src/schemas/common-schema.json +0 -27
  391. package/src/schemas/device-action-schema.json +0 -14
  392. package/src/schemas/device-stats-schema.json +0 -58
  393. package/src/schemas/live-updates-toggle-schema.json +0 -29
  394. package/src/schemas/models-install-payload-schema.json +0 -22
  395. package/src/schemas/models-install-response-schema.json +0 -23
  396. package/src/schemas/secure-tunnel-schema.json +0 -30
  397. package/src/schemas/shadow-project-update-schema.json +0 -30
  398. package/src/schemas/shadow-projects-update-all-schema.json +0 -17
  399. package/src/schemas/signed-urls-request-schema.json +0 -42
  400. package/src/schemas/status-response-schema.json +0 -16
  401. package/src/schemas/system-information-schema.json +0 -155
  402. package/src/schemas/to-client-message-schema.json +0 -98
  403. package/src/schemas/to-cloud-message-schema.json +0 -56
  404. package/src/schemas/to-device-agent-message-schema.json +0 -135
  405. package/src/shadow-schema.ts +0 -208
  406. package/src/signed-urls-request-schema.ts +0 -22
  407. package/src/status-response-schema.ts +0 -18
  408. package/src/types.ts +0 -175
  409. package/src/utils.ts +0 -21
  410. package/tests/constants.test.ts +0 -41
  411. package/tests/shadow-schema.test.ts +0 -192
  412. package/tests/types.test.ts +0 -515
  413. package/tsconfig.build.json +0 -4
  414. package/tsconfig.eslint.json +0 -5
  415. package/tsconfig.json +0 -91
@@ -1,208 +0,0 @@
1
- import Ajv2019 from 'ajv/dist/2019';
2
- import * as shadowProjectsUpdateAllSchema from './schemas/shadow-projects-update-all-schema.json';
3
- import * as shadowProjectUpdateSchema from './schemas/shadow-project-update-schema.json';
4
- import * as systemInformationSchema from './schemas/system-information-schema.json';
5
- import * as secureTunnelSchema from './schemas/secure-tunnel-schema.json';
6
- import * as commonSchema from './schemas/common-schema.json';
7
-
8
- import { keyMirror } from './utils';
9
-
10
- const ajv = new Ajv2019({
11
- allErrors: true,
12
- schemas: [commonSchema]
13
- });
14
-
15
- /* ============================================================================
16
- Shadow Topics
17
- ============================================================================ */
18
-
19
- const SHADOW_PREFIX = `$aws/things/`;
20
-
21
- export const ShadowTopics = keyMirror({
22
- get: null,
23
- 'get/accepted': null,
24
- 'get/rejected': null,
25
- update: null,
26
- 'update/delta': null,
27
- 'update/accepted': null,
28
- 'update/rejected': null,
29
- delete: null,
30
- 'delete/accepted': null,
31
- 'delete/rejected': null
32
- });
33
- export type ShadowTopics = keyof typeof ShadowTopics;
34
- export const SHADOW_TOPICS = Object.keys(ShadowTopics) as ShadowTopics[];
35
-
36
- const ShadowNames = keyMirror({
37
- projects: null,
38
- 'system-info': null,
39
- 'secure-tunnel': null
40
- });
41
- export type ShadowNames = keyof typeof ShadowNames;
42
- export const SHADOW_NAMES = Object.keys(ShadowNames) as ShadowNames[];
43
-
44
- export const getShadowTopic = (
45
- clientId: string,
46
- shadowName: ShadowNames,
47
- shadowTopic: ShadowTopics
48
- ) => `${SHADOW_PREFIX}${clientId}/shadow/name/${shadowName}/${shadowTopic}`;
49
-
50
- /* ============================================================================
51
- Project Shadow
52
- ============================================================================ */
53
-
54
- export interface ProjectShadowUpdate {
55
- appConfig?: string;
56
- envVars?: {
57
- [service: string]: {
58
- [key: string]: string | null;
59
- };
60
- };
61
- }
62
-
63
- export interface ShadowProjectsUpdateAll {
64
- [projectId: string]: ProjectShadowUpdate | null;
65
- }
66
-
67
- // Shadow Message validator functions
68
- ajv.addSchema(shadowProjectUpdateSchema, 'shadow-project-update-schema.json');
69
- export const validateProjectShadowUpdate = ajv.compile<ProjectShadowUpdate>(
70
- shadowProjectUpdateSchema
71
- );
72
-
73
- ajv.addSchema(
74
- shadowProjectsUpdateAllSchema,
75
- 'shadow-projects-update-all-schema.json'
76
- );
77
- export const validateShadowProjectsUpdateAll =
78
- ajv.compile<ShadowProjectsUpdateAll>(shadowProjectsUpdateAllSchema);
79
-
80
- export function getDesiredFromMessage(message) {
81
- if (message?.state?.desired) {
82
- return message.state.desired;
83
- } else return null;
84
- }
85
-
86
- /* ============================================================================
87
- System Information Shadow
88
- ============================================================================ */
89
-
90
- export interface SystemInformationShadowUpdate {
91
- os?: {
92
- platform?: string;
93
- distro?: string;
94
- release?: string;
95
- kernel?: string;
96
- architecture?: string;
97
- hostname?: string;
98
- };
99
- cpu?: {
100
- manufacturer?: string;
101
- brand?: string;
102
- vendor?: string;
103
- model?: string;
104
- cores?: number;
105
- physicalCores?: number;
106
- efficiencyCores?: number;
107
- };
108
- disk?: {
109
- drives: {
110
- device?: string;
111
- type?: string;
112
- name?: string;
113
- vendor?: string;
114
- size?: number;
115
- }[];
116
- };
117
- device?: {
118
- manufacturer?: string;
119
- model?: string;
120
- version?: string;
121
- serial?: string;
122
- virtual?: boolean;
123
- };
124
- network?: {
125
- ipv4Address?: string;
126
- ipv6Address?: string;
127
- macAddress?: string;
128
- };
129
- versions?: {
130
- agent?: string;
131
- deviceAgentSchemas?: string;
132
- npm?: string;
133
- node?: string;
134
- docker?: string;
135
- dockerCompose?: string;
136
- };
137
- lastBootTime?: string;
138
- }
139
-
140
- ajv.addSchema(systemInformationSchema, 'system-information-schema.json');
141
- export const validateSystemInformationShadowUpdate =
142
- ajv.compile<SystemInformationShadowUpdate>(systemInformationSchema);
143
-
144
- /* ============================================================================
145
- Secure Tunnel Shadow
146
- ============================================================================ */
147
-
148
- export type SecureTunnelPortInfo = {
149
- enabled: boolean;
150
- type: string;
151
- ip: string;
152
- port: number;
153
- };
154
-
155
- export type SecureTunnelShadowDescriptionReported = {
156
- st_ports: SecureTunnelPortInfo[];
157
- };
158
-
159
- ajv.addSchema(secureTunnelSchema, 'secure-tunnel-schema.json');
160
- export const validateSecureTunnelShadowUpdate =
161
- ajv.compile<SecureTunnelShadowDescriptionReported>(secureTunnelSchema);
162
-
163
- /* ============================================================================
164
- Shadow Message Builders
165
- ============================================================================ */
166
-
167
- export function buildBaseShadowMessage(clientId: string) {
168
- const baseShadowMessage = {
169
- clientToken: clientId
170
- };
171
- return baseShadowMessage;
172
- }
173
-
174
- export function buildUpdateProjectShadowMessage({
175
- clientId,
176
- reported,
177
- desired
178
- }: {
179
- clientId: string;
180
- reported?: ShadowProjectsUpdateAll | SystemInformationShadowUpdate;
181
- desired?: ShadowProjectsUpdateAll;
182
- }) {
183
- const state = { reported, desired };
184
-
185
- const message = {
186
- ...buildBaseShadowMessage(clientId),
187
- state
188
- };
189
- return message;
190
- }
191
-
192
- export function buildUpdateSystemInfoShadowMessage(
193
- clientId: string,
194
- systemInfo: SystemInformationShadowUpdate
195
- ) {
196
- return buildUpdateProjectShadowMessage({ clientId, reported: systemInfo });
197
- }
198
-
199
- export function buildUpdateSecureTunnelShadowMessage(
200
- reported: SecureTunnelShadowDescriptionReported,
201
- clientId: string
202
- ) {
203
- const message = {
204
- ...buildBaseShadowMessage(clientId),
205
- state: { reported }
206
- };
207
- return message;
208
- }
@@ -1,22 +0,0 @@
1
- import { SignedUrlsRequestMessageType } from './constants';
2
- import { BaseToClientMessage } from './types';
3
-
4
- type ModelsObject = {
5
- [modelId: string]: number;
6
- };
7
-
8
- export interface SignedUrlsRequestPayload {
9
- signedUrlsRequest?: {
10
- projectId: string;
11
- appReleaseHash: string;
12
- };
13
- modelsOnlyUrlsRequest?: {
14
- projectId: string;
15
- models: ModelsObject;
16
- };
17
- }
18
-
19
- export interface SignedUrlsRequestMessage extends BaseToClientMessage {
20
- messageType: SignedUrlsRequestMessageType;
21
- payload: SignedUrlsRequestPayload;
22
- }
@@ -1,18 +0,0 @@
1
- import { StatusResponseMessageType, StatusResponseValue } from './constants';
2
- import { BaseToClientMessage, BaseToDeviceAgentMessage } from './types';
3
-
4
- export interface StatusResponsePayload {
5
- status: StatusResponseValue;
6
- message?: string;
7
- }
8
-
9
- export interface ToClientStatusResponseMessage extends BaseToClientMessage {
10
- messageType: StatusResponseMessageType;
11
- payload: StatusResponsePayload;
12
- }
13
-
14
- export interface ToDeviceStatusResponseMessage
15
- extends BaseToDeviceAgentMessage {
16
- messageType: StatusResponseMessageType;
17
- payload: StatusResponsePayload;
18
- }
package/src/types.ts DELETED
@@ -1,175 +0,0 @@
1
- import Ajv2019 from 'ajv/dist/2019';
2
- import {
3
- CLIENT_TOPIC_PREFIX,
4
- CLOUD_TOPIC_PREFIX,
5
- DEVICE_TOPIC_PREFIX,
6
- DEVICE_TYPE
7
- } from './constants';
8
- import * as commonSchema from './schemas/common-schema.json';
9
- import * as deviceStatsSchema from './schemas/device-stats-schema.json';
10
- import * as appStateSchema from './schemas/app-state-schema.json';
11
- import * as appLogsSchema from './schemas/app-logs-schema.json';
12
- import * as statusResponseSchema from './schemas/status-response-schema.json';
13
- import * as signedUrlsRequestSchema from './schemas/signed-urls-request-schema.json';
14
- import * as toDeviceAgentMessageSchema from './schemas/to-device-agent-message-schema.json';
15
- import * as modelsInstallPayloadSchema from './schemas/models-install-payload-schema.json';
16
- import * as appInstallSchema from './schemas/app-install-schema.json';
17
- import * as appUninstallSchema from './schemas/app-uninstall-schema.json';
18
- import * as toClientMessageSchema from './schemas/to-client-message-schema.json';
19
- import * as toCloudMessageSchema from './schemas/to-cloud-message-schema.json';
20
- import * as appStateControlSchema from './schemas/app-state-control-schema.json';
21
- import * as appVersionControlSchema from './schemas/app-version-control-schema.json';
22
- import * as appInstallResponseSchema from './schemas/app-install-response-schema.json';
23
- import * as modelsInstallResponseSchema from './schemas/models-install-response-schema.json';
24
- import * as liveUpdatesTogglesSchema from './schemas/live-updates-toggle-schema.json';
25
- import * as deviceActionSchema from './schemas/device-action-schema.json';
26
- import { AppLogsMessage, AppLogsPayload } from './app-logs-schema';
27
- import {
28
- AppInstallResponseMessage,
29
- AppInstallResponsePayload,
30
- AppStateControlMessage,
31
- AppStateControlPayload,
32
- AppVersionControlInstallPayload,
33
- AppVersionControlMessage,
34
- AppVersionControlUninstallPayload,
35
- ModelsInstallResponseMessage,
36
- ModelsInstallResponsePayload
37
- } from './app-action-schema';
38
- import {
39
- LiveStateUpdatesToggleMessage,
40
- LiveStateUpdatesTogglePayload
41
- } from './device-agent-action-schema';
42
- import {
43
- StatusResponsePayload,
44
- ToClientStatusResponseMessage,
45
- ToDeviceStatusResponseMessage
46
- } from './status-response-schema';
47
- import { AppStateMessage, AppStatePayload } from './app-state-schema';
48
- import {
49
- SignedUrlsRequestMessage,
50
- SignedUrlsRequestPayload
51
- } from './signed-urls-request-schema';
52
- import { DeviceStatsMessage, DeviceStatsPayload } from './device-stats-schema';
53
- import {
54
- DeviceActionMessage,
55
- DeviceActionPayload
56
- } from './device-action-schema';
57
-
58
- // Note: the other schemas do not need to be added, because they will
59
- // automatically be added in the compile step due to $ref usage (and $id lookup)
60
- const ajv = new Ajv2019({
61
- allErrors: true,
62
- schemas: [commonSchema]
63
- });
64
-
65
- export const getToClientTopic = (
66
- deviceUuid: string,
67
- deviceType: string = DEVICE_TYPE
68
- ) => `${CLIENT_TOPIC_PREFIX}/${deviceType}/${deviceUuid}`;
69
-
70
- export const getToCloudTopic = (
71
- deviceUuid: string,
72
- deviceType: string = DEVICE_TYPE
73
- ) => `${CLOUD_TOPIC_PREFIX}/${deviceType}/${deviceUuid}`;
74
-
75
- export const getToDeviceTopic = (
76
- deviceUuid: string,
77
- deviceType: string = DEVICE_TYPE
78
- ) => `${DEVICE_TOPIC_PREFIX}/${deviceType}/${deviceUuid}`;
79
-
80
- /* ============================================================================
81
- ToClient Message
82
- ============================================================================ */
83
-
84
- export interface BaseToClientMessage {
85
- deviceId: string;
86
- timestamp: string;
87
- topic?: string;
88
- txId: string;
89
- }
90
-
91
- export type ToClientMessage =
92
- | AppLogsMessage
93
- | ToClientStatusResponseMessage
94
- | AppStateMessage
95
- | DeviceStatsMessage;
96
-
97
- export type ToClientMessagePayload =
98
- | AppLogsPayload
99
- | AppStatePayload
100
- | DeviceStatsPayload
101
- | StatusResponsePayload;
102
-
103
- ajv.addSchema(deviceStatsSchema, 'device-stats-schema.json');
104
- ajv.addSchema(appStateSchema, 'app-state-schema.json');
105
- ajv.addSchema(appLogsSchema, 'app-logs-schema.json');
106
- ajv.addSchema(statusResponseSchema, 'status-response-schema.json');
107
- ajv.addSchema(toClientMessageSchema, 'to-client-message-schema.json');
108
- export const validateToClientMessage = ajv.compile<BaseToClientMessage>(
109
- toClientMessageSchema
110
- );
111
-
112
- /* ============================================================================
113
- ToCloud Message
114
- ============================================================================ */
115
-
116
- export interface BaseToCloudMessage {
117
- deviceId: string;
118
- timestamp: string;
119
- topic?: string;
120
- txId: string;
121
- }
122
-
123
- export type ToCloudMessage = SignedUrlsRequestMessage;
124
-
125
- export type ToCloudMessagePayload = SignedUrlsRequestPayload;
126
-
127
- ajv.addSchema(signedUrlsRequestSchema, 'signed-urls-request-schema.json');
128
- export const validateToCloudMessage =
129
- ajv.compile<BaseToCloudMessage>(toCloudMessageSchema);
130
-
131
- /* ============================================================================
132
- To Device Agent Message
133
- ============================================================================ */
134
-
135
- export interface BaseToDeviceAgentMessage {
136
- timestamp: string;
137
- topic?: string;
138
- txId: string;
139
- }
140
-
141
- export type ToDeviceAgentMessage =
142
- | AppStateControlMessage
143
- | AppVersionControlMessage
144
- | LiveStateUpdatesToggleMessage
145
- | ToDeviceStatusResponseMessage
146
- | AppInstallResponseMessage
147
- | ModelsInstallResponseMessage
148
- | DeviceActionMessage;
149
-
150
- export type ToDeviceAgentMessagePayload =
151
- | AppStateControlPayload
152
- | AppVersionControlInstallPayload
153
- | AppVersionControlUninstallPayload
154
- | LiveStateUpdatesTogglePayload
155
- | StatusResponsePayload
156
- | AppInstallResponsePayload
157
- | ModelsInstallResponsePayload
158
- | DeviceActionPayload;
159
-
160
- ajv.addSchema(modelsInstallPayloadSchema, 'models-install-payload-schema.json');
161
- ajv.addSchema(appInstallSchema, 'app-install-schema.json');
162
- ajv.addSchema(appUninstallSchema, 'app-uninstall-schema.json');
163
- ajv.addSchema(appStateControlSchema, 'app-state-control-schema.json');
164
- ajv.addSchema(appVersionControlSchema, 'app-version-control-schema.json');
165
- ajv.addSchema(appInstallResponseSchema, 'app-install-response-schema.json');
166
- ajv.addSchema(
167
- modelsInstallResponseSchema,
168
- 'models-install-response-schema.json'
169
- );
170
- ajv.addSchema(liveUpdatesTogglesSchema, 'live-updates-toggle-schema.json');
171
- ajv.addSchema(deviceActionSchema, 'device-action-schema.json');
172
-
173
- export const validateToDeviceAgentMessage = ajv.compile<ToDeviceAgentMessage>(
174
- toDeviceAgentMessageSchema
175
- );
package/src/utils.ts DELETED
@@ -1,21 +0,0 @@
1
- import { v4 as uuidv4 } from 'uuid';
2
-
3
- export function loadSchemaAsObject(schema: object) {
4
- return JSON.parse(JSON.stringify(schema));
5
- }
6
-
7
- /* eslint-disable */
8
- export function keyMirror<T extends object>(obj: T): { [K in keyof T]: K } {
9
- const newObj = {};
10
- for (const key in obj) {
11
- if (obj.hasOwnProperty(key)) {
12
- newObj[String(key)] = key;
13
- }
14
- }
15
- return newObj as { [K in keyof T]: K };
16
- }
17
- /* eslint-enable */
18
-
19
- export function generateTxId(): string {
20
- return uuidv4();
21
- }
@@ -1,41 +0,0 @@
1
- import {
2
- APP_RELEASE_ID_PATTERN,
3
- CLIENT_TOPIC_PREFIX,
4
- CLOUD_TOPIC_PREFIX,
5
- DEVICE_TOPIC_PREFIX,
6
- DEVICE_TYPE,
7
- MODEL_ID_PATTERN,
8
- PROJECT_ID_PATTERN
9
- } from '../src/constants';
10
- import * as commonSchema from '../src/schemas/common-schema.json';
11
- import * as toClientMessageSchema from '../src/schemas/to-client-message-schema.json';
12
- import * as toCloudMessageSchema from '../src/schemas/to-cloud-message-schema.json';
13
- import * as toDeviceAgentMessageSchema from '../src/schemas/to-device-agent-message-schema.json';
14
-
15
- describe('Validate regex in schemas matches constants', () => {
16
- test('to-client-message-schema', () => {
17
- expect(toClientMessageSchema.$defs.toClient.pattern).toEqual(
18
- `${CLIENT_TOPIC_PREFIX}/${DEVICE_TYPE}/${PROJECT_ID_PATTERN}`
19
- );
20
- });
21
-
22
- test('to-cloud-message-schema', () => {
23
- expect(toCloudMessageSchema.$defs.toCloud.pattern).toEqual(
24
- `${CLOUD_TOPIC_PREFIX}/${DEVICE_TYPE}/${PROJECT_ID_PATTERN}`
25
- );
26
- });
27
-
28
- test('to-device-agent-message-schema', () => {
29
- expect(toDeviceAgentMessageSchema.$defs.toDevice.pattern).toEqual(
30
- `^${DEVICE_TOPIC_PREFIX}/${DEVICE_TYPE}/${PROJECT_ID_PATTERN}`
31
- );
32
- });
33
-
34
- test('common-schema', () => {
35
- expect(commonSchema.$defs.projectId.pattern).toEqual(PROJECT_ID_PATTERN);
36
- expect(commonSchema.$defs.appReleaseHash.pattern).toEqual(
37
- APP_RELEASE_ID_PATTERN
38
- );
39
- expect(commonSchema.$defs.modelId.pattern).toEqual(MODEL_ID_PATTERN);
40
- });
41
- });
@@ -1,192 +0,0 @@
1
- import {
2
- getShadowTopic,
3
- validateShadowProjectsUpdateAll,
4
- buildBaseShadowMessage,
5
- buildUpdateProjectShadowMessage,
6
- buildUpdateSystemInfoShadowMessage,
7
- SystemInformationShadowUpdate,
8
- ShadowProjectsUpdateAll,
9
- SecureTunnelShadowDescriptionReported,
10
- buildUpdateSecureTunnelShadowMessage
11
- } from '../src/shadow-schema';
12
-
13
- const validShadowProjectsUpdateStructures: ShadowProjectsUpdateAll[] = [
14
- {
15
- '1111e3b3-1d06-4c90-839c-8dcbb60b1053': {
16
- appConfig: 'stringified_json'
17
- }
18
- },
19
- {
20
- '2222e3b3-1d06-4c90-839c-8dcbb60b1053': {
21
- envVars: {
22
- alwaysai: {
23
- VAR0: 'VAL0',
24
- VAR1: 'VAL1'
25
- }
26
- }
27
- }
28
- },
29
- {
30
- '3333e3b3-1d06-4c90-839c-8dcbb60b1053': {
31
- appConfig: 'stringified_json',
32
- envVars: {
33
- alwaysai: {
34
- VAR0: 'VAL0',
35
- VAR1: 'VAL1'
36
- }
37
- }
38
- }
39
- },
40
- {
41
- '4444e3b3-1d06-4c90-839c-8dcbb60b1053': {
42
- appConfig: 'stringified_json'
43
- },
44
- '5555e3b3-1d06-4c90-839c-8dcbb60b1053': {
45
- envVars: {
46
- alwaysai: {
47
- VAR0: 'VAL0',
48
- VAR1: 'VAL1'
49
- }
50
- }
51
- }
52
- },
53
- {
54
- '6666e3b3-1d06-4c90-839c-8dcbb60b1053': null
55
- }
56
- ];
57
-
58
- const invalidShadowProjectsUpdateStructures = [
59
- {
60
- project0: {
61
- appConfig: {
62
- key: 'value'
63
- }
64
- }
65
- },
66
- {
67
- project0: {
68
- envVars: 'unexpected-string'
69
- }
70
- }
71
- ];
72
-
73
- const validBaseMessage = {
74
- clientToken: '111'
75
- };
76
- const validSystemInfoMessage = {
77
- clientToken: '111',
78
- state: {
79
- reported: {
80
- cpu: {
81
- brand: 'walmart'
82
- }
83
- }
84
- }
85
- };
86
- const validShadowUpdateMessage = {
87
- clientToken: '111',
88
- state: {
89
- reported: {
90
- ...validShadowProjectsUpdateStructures[0],
91
- ...validShadowProjectsUpdateStructures[1]
92
- }
93
- }
94
- };
95
- const validSecureTunnelUpdateMessage = {
96
- clientToken: '111',
97
- state: {
98
- reported: {
99
- st_ports: [
100
- { enabled: false, type: 'test', ip: '141.193.213.20', port: 13 }
101
- ]
102
- }
103
- }
104
- };
105
-
106
- const validGetAccepted: ShadowProjectsUpdateAll[] = [];
107
- validShadowProjectsUpdateStructures.forEach((updateDelta) => {
108
- validGetAccepted.push(updateDelta);
109
- });
110
- validGetAccepted.push({});
111
-
112
- function validateSuccess(items, validateFunc) {
113
- items.forEach((item) => {
114
- const valid = validateFunc(item);
115
- if (!valid) {
116
- // eslint-disable-next-line no-console
117
- console.log(item);
118
- // eslint-disable-next-line no-console
119
- console.log(validateShadowProjectsUpdateAll.errors);
120
- }
121
- expect(valid).toBe(true);
122
- });
123
- }
124
-
125
- function validateFailure(items, validateFunc) {
126
- items.forEach((item) => {
127
- expect(validateFunc(item)).toBe(false);
128
- });
129
- }
130
-
131
- describe('Test project shadow messages', () => {
132
- test('valid update delta', () => {
133
- validateSuccess(validGetAccepted, validateShadowProjectsUpdateAll);
134
- });
135
-
136
- test('test invalid client message', () => {
137
- validateFailure(
138
- invalidShadowProjectsUpdateStructures,
139
- validateShadowProjectsUpdateAll
140
- );
141
- });
142
-
143
- test('valid base shadow message', () => {
144
- const baseMessage = buildBaseShadowMessage('111');
145
- expect(baseMessage).toEqual(validBaseMessage);
146
- });
147
- test('valid update project shadow message', () => {
148
- const reported: ShadowProjectsUpdateAll = {
149
- '1111e3b3-1d06-4c90-839c-8dcbb60b1053': {
150
- appConfig: 'stringified_json'
151
- },
152
- '2222e3b3-1d06-4c90-839c-8dcbb60b1053': {
153
- envVars: {
154
- alwaysai: {
155
- VAR0: 'VAL0',
156
- VAR1: 'VAL1'
157
- }
158
- }
159
- }
160
- };
161
- const message = buildUpdateProjectShadowMessage({
162
- clientId: '111',
163
- reported
164
- });
165
- expect(message).toEqual(validShadowUpdateMessage);
166
- });
167
- test('valid update system info shadow message', () => {
168
- const systemInfo: SystemInformationShadowUpdate = {
169
- cpu: { brand: 'walmart' }
170
- };
171
- const message = buildUpdateSystemInfoShadowMessage('111', systemInfo);
172
- expect(message).toEqual(validSystemInfoMessage);
173
- });
174
- test('valid update secure tunnel shadow message', () => {
175
- const reported: SecureTunnelShadowDescriptionReported = {
176
- st_ports: [
177
- { enabled: false, type: 'test', ip: '141.193.213.20', port: 13 }
178
- ]
179
- };
180
- const message = buildUpdateSecureTunnelShadowMessage(reported, '111');
181
- expect(message).toEqual(validSecureTunnelUpdateMessage);
182
- });
183
- });
184
-
185
- describe('Test project shadow topic generation', () => {
186
- test('shadow topic get', () => {
187
- const shadowTopic = getShadowTopic('111', 'projects', 'get/accepted');
188
- expect(shadowTopic).toEqual(
189
- '$aws/things/111/shadow/name/projects/get/accepted'
190
- );
191
- });
192
- });