openc3 5.20.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/bin/openc3cli +12 -120
  3. data/data/config/command_modifiers.yaml +13 -1
  4. data/data/config/interface_modifiers.yaml +21 -4
  5. data/data/config/item_modifiers.yaml +1 -1
  6. data/data/config/microservice.yaml +15 -2
  7. data/data/config/param_item_modifiers.yaml +1 -1
  8. data/data/config/parameter_modifiers.yaml +1 -1
  9. data/data/config/table_manager.yaml +2 -2
  10. data/data/config/target.yaml +11 -0
  11. data/data/config/telemetry_modifiers.yaml +17 -1
  12. data/data/config/tool.yaml +12 -0
  13. data/data/config/widgets.yaml +13 -17
  14. data/lib/openc3/accessors/form_accessor.rb +4 -3
  15. data/lib/openc3/accessors/html_accessor.rb +3 -3
  16. data/lib/openc3/accessors/http_accessor.rb +13 -13
  17. data/lib/openc3/accessors/xml_accessor.rb +16 -4
  18. data/lib/openc3/api/target_api.rb +0 -30
  19. data/lib/openc3/config/config_parser.rb +6 -3
  20. data/lib/openc3/core_ext/array.rb +0 -16
  21. data/lib/openc3/core_ext.rb +0 -1
  22. data/lib/openc3/interfaces/file_interface.rb +198 -0
  23. data/lib/openc3/interfaces/http_client_interface.rb +71 -39
  24. data/lib/openc3/interfaces/http_server_interface.rb +0 -7
  25. data/lib/openc3/interfaces/interface.rb +2 -0
  26. data/lib/openc3/interfaces/mqtt_interface.rb +32 -15
  27. data/lib/openc3/interfaces/mqtt_stream_interface.rb +19 -4
  28. data/lib/openc3/interfaces/protocols/crc_protocol.rb +7 -0
  29. data/lib/openc3/interfaces/serial_interface.rb +1 -0
  30. data/lib/openc3/interfaces.rb +2 -4
  31. data/lib/openc3/microservices/multi_microservice.rb +3 -3
  32. data/lib/openc3/migrations/20241208080000_no_critical_cmd.rb +31 -0
  33. data/lib/openc3/migrations/20241208080001_no_trigger_group.rb +46 -0
  34. data/lib/openc3/models/interface_model.rb +9 -3
  35. data/lib/openc3/models/microservice_model.rb +8 -1
  36. data/lib/openc3/models/plugin_model.rb +6 -1
  37. data/lib/openc3/models/python_package_model.rb +6 -1
  38. data/lib/openc3/models/reaction_model.rb +14 -10
  39. data/lib/openc3/models/scope_model.rb +60 -42
  40. data/lib/openc3/models/target_model.rb +17 -1
  41. data/lib/openc3/models/timeline_model.rb +17 -5
  42. data/lib/openc3/models/tool_model.rb +15 -3
  43. data/lib/openc3/models/trigger_group_model.rb +6 -3
  44. data/lib/openc3/operators/microservice_operator.rb +8 -0
  45. data/lib/openc3/packets/commands.rb +17 -6
  46. data/lib/openc3/packets/limits.rb +0 -12
  47. data/lib/openc3/packets/packet.rb +1 -1
  48. data/lib/openc3/packets/packet_item.rb +30 -36
  49. data/lib/openc3/packets/structure_item.rb +2 -2
  50. data/lib/openc3/script/script.rb +0 -10
  51. data/lib/openc3/script/web_socket_api.rb +2 -2
  52. data/lib/openc3/streams/mqtt_stream.rb +41 -33
  53. data/lib/openc3/streams/serial_stream.rb +27 -27
  54. data/lib/openc3/streams/stream.rb +17 -17
  55. data/lib/openc3/streams/tcpip_client_stream.rb +1 -1
  56. data/lib/openc3/streams/tcpip_socket_stream.rb +19 -19
  57. data/lib/openc3/system/system.rb +1 -1
  58. data/lib/openc3/system.rb +2 -3
  59. data/lib/openc3/tools/table_manager/table.rb +2 -2
  60. data/lib/openc3/tools/table_manager/table_parser.rb +1 -1
  61. data/lib/openc3/top_level.rb +0 -5
  62. data/lib/openc3/topics/command_decom_topic.rb +0 -7
  63. data/lib/openc3/utilities/bucket_utilities.rb +1 -1
  64. data/lib/openc3/utilities/cli_generator.rb +0 -1
  65. data/lib/openc3/version.rb +6 -6
  66. data/templates/plugin/README.md +1 -1
  67. data/templates/target/targets/TARGET/lib/target.rb +1 -1
  68. data/templates/tool_angular/package.json +8 -8
  69. data/templates/tool_angular/src/app/app.component.html +4 -13
  70. data/templates/tool_angular/src/app/app.component.scss +5 -13
  71. data/templates/tool_angular/src/app/app.component.ts +5 -4
  72. data/templates/tool_angular/src/app/custom-overlay-container.ts +2 -2
  73. data/templates/tool_angular/src/app/openc3-api.d.ts +1 -1
  74. data/templates/tool_angular/src/main.single-spa.ts +1 -1
  75. data/templates/tool_react/package.json +1 -0
  76. data/templates/tool_react/src/root.component.js +1 -1
  77. data/templates/tool_svelte/package.json +11 -9
  78. data/templates/tool_svelte/rollup.config.js +2 -0
  79. data/templates/tool_svelte/src/App.svelte +2 -2
  80. data/templates/tool_vue/eslint.config.mjs +68 -0
  81. data/templates/tool_vue/jsconfig.json +1 -1
  82. data/templates/tool_vue/package.json +26 -43
  83. data/templates/tool_vue/src/App.vue +3 -5
  84. data/templates/tool_vue/src/main.js +12 -23
  85. data/templates/tool_vue/src/router.js +19 -18
  86. data/templates/tool_vue/src/tools/tool_name/tool_name.vue +2 -2
  87. data/templates/tool_vue/vite.config.js +52 -0
  88. data/templates/widget/package.json +19 -26
  89. data/templates/widget/src/Widget.vue +13 -15
  90. data/templates/widget/vite.config.js +26 -0
  91. metadata +10 -41
  92. data/lib/openc3/core_ext/hash.rb +0 -40
  93. data/lib/openc3/core_ext/httpclient.rb +0 -11
  94. data/lib/openc3/interfaces/linc_interface.rb +0 -480
  95. data/lib/openc3/interfaces/protocols/override_protocol.rb +0 -4
  96. data/lib/openc3/microservices/critical_cmd_microservice.rb +0 -74
  97. data/lib/openc3/microservices/reaction_microservice.rb +0 -607
  98. data/lib/openc3/microservices/timeline_microservice.rb +0 -398
  99. data/lib/openc3/microservices/trigger_group_microservice.rb +0 -698
  100. data/lib/openc3/migrations/20230615000000_autonomic.rb +0 -86
  101. data/lib/openc3/migrations/20240915000000_activity_uuid.rb +0 -28
  102. data/lib/openc3/migrations/20241016000000_scope_critical_cmd.rb +0 -24
  103. data/lib/openc3/system/system_config.rb +0 -413
  104. data/templates/tool_svelte/src/services/api.js +0 -92
  105. data/templates/tool_svelte/src/services/axios.js +0 -85
  106. data/templates/tool_svelte/src/services/cable.js +0 -65
  107. data/templates/tool_svelte/src/services/config-parser.js +0 -198
  108. data/templates/tool_svelte/src/services/openc3-api.js +0 -606
  109. data/templates/tool_vue/.eslintrc.js +0 -43
  110. data/templates/tool_vue/babel.config.json +0 -11
  111. data/templates/tool_vue/vue.config.js +0 -38
  112. data/templates/widget/.eslintrc.js +0 -43
  113. data/templates/widget/babel.config.json +0 -11
  114. data/templates/widget/vue.config.js +0 -28
  115. /data/templates/tool_vue/{.prettierrc.js → .prettierrc.cjs} +0 -0
  116. /data/templates/widget/{.prettierrc.js → .prettierrc.cjs} +0 -0
@@ -1,85 +0,0 @@
1
- /*
2
- # Copyright 2022 Ball Aerospace & Technologies Corp.
3
- # All Rights Reserved.
4
- #
5
- # This program is free software; you can modify and/or redistribute it
6
- # under the terms of the GNU Affero General Public License
7
- # as published by the Free Software Foundation; version 3 with
8
- # attribution addendums as found in the LICENSE.txt
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
-
15
- # Modified by OpenC3, Inc.
16
- # All changes Copyright 2022, OpenC3, Inc.
17
- # All Rights Reserved
18
- #
19
- # This file may also be used under the terms of a commercial license
20
- # if purchased from OpenC3, Inc.
21
- */
22
-
23
- import axios from 'axios'
24
-
25
- const axiosInstance = axios.create({
26
- baseURL: location.origin,
27
- timeout: 60000,
28
- params: {},
29
- })
30
-
31
- axiosInstance.interceptors.response.use(
32
- (response) => response,
33
- (error) => {
34
- if (error.response) {
35
- if (error.response.status === 401) {
36
- OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity, true).then(
37
- function (refreshed) {
38
- if (refreshed) {
39
- OpenC3Auth.setTokens()
40
- }
41
- }
42
- )
43
- }
44
- // Individual tools can set 'Ignore-Errors' to an error code
45
- // they potentially expect, e.g. '500', in which case we ignore it
46
- // For example in CommandSender.vue:
47
- // obs = this.api.cmd(targetName, commandName, paramList, {
48
- // 'Ignore-Errors': '500',
49
- // })
50
- if (
51
- error.response.headers['ignore-errors'] &&
52
- error.response.headers['ignore-errors'].includes(
53
- error.response.status.toString()
54
- )
55
- ) {
56
- return Promise.reject(error)
57
- }
58
- let body = `HTTP ${error.response.status} - `
59
- if (error.response?.statusText) {
60
- body += `${error.response.statusText} `
61
- }
62
- if (error.response?.config?.data) {
63
- body += `${error.response.config.data} `
64
- }
65
- if (error.response?.data?.message) {
66
- body += `${error.response.data.message}`
67
- } else if (error.response?.data?.exception) {
68
- body += `${error.response.data.exception}`
69
- } else if (error.response?.data?.error?.message) {
70
- if (error.response.data.error.class) {
71
- body += `${error.response.data.error.class} `
72
- }
73
- body += `${error.response.data.error.message}`
74
- } else {
75
- body += `${error.response?.data}`
76
- }
77
- alert(`Network error: ${body}`)
78
- throw error
79
- } else {
80
- throw error
81
- }
82
- }
83
- )
84
-
85
- export default axiosInstance
@@ -1,65 +0,0 @@
1
- /*
2
- # Copyright 2022 Ball Aerospace & Technologies Corp.
3
- # All Rights Reserved.
4
- #
5
- # This program is free software; you can modify and/or redistribute it
6
- # under the terms of the GNU Affero General Public License
7
- # as published by the Free Software Foundation; version 3 with
8
- # attribution addendums as found in the LICENSE.txt
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
-
15
- # Modified by OpenC3, Inc.
16
- # All changes Copyright 2022, OpenC3, Inc.
17
- # All Rights Reserved
18
- #
19
- # This file may also be used under the terms of a commercial license
20
- # if purchased from OpenC3, Inc.
21
- */
22
-
23
- import * as ActionCable from '@rails/actioncable'
24
- //ActionCable.logger.enabled = true
25
- ActionCable.ConnectionMonitor.staleThreshold = 10
26
-
27
- export default class Cable {
28
- constructor(url = '/openc3-api/cable') {
29
- this._cable = null
30
- this._url = url
31
- }
32
- disconnect() {
33
- if (this._cable) {
34
- this._cable.disconnect()
35
- }
36
- }
37
- createSubscription(channel, scope, callbacks = {}, additionalOptions = {}) {
38
- return OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity).then(
39
- (refreshed) => {
40
- if (refreshed) {
41
- OpenC3Auth.setTokens()
42
- }
43
- if (this._cable == null) {
44
- let final_url =
45
- this._url +
46
- '?scope=' +
47
- window.openc3Scope +
48
- '&authorization=' +
49
- localStorage.openc3Token
50
- this._cable = ActionCable.createConsumer(encodeURI(final_url))
51
- }
52
- return this._cable.subscriptions.create(
53
- {
54
- channel,
55
- ...additionalOptions,
56
- },
57
- callbacks
58
- )
59
- }
60
- )
61
- }
62
- recordPing() {
63
- this._cable.connection.monitor.recordPing()
64
- }
65
- }
@@ -1,198 +0,0 @@
1
- /*
2
- # Copyright 2022 Ball Aerospace & Technologies Corp.
3
- # All Rights Reserved.
4
- #
5
- # This program is free software; you can modify and/or redistribute it
6
- # under the terms of the GNU Affero General Public License
7
- # as published by the Free Software Foundation; version 3 with
8
- # attribution addendums as found in the LICENSE.txt
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
-
15
- # Modified by OpenC3, Inc.
16
- # All changes Copyright 2024, OpenC3, Inc.
17
- # All Rights Reserved
18
- #
19
- # This file may also be used under the terms of a commercial license
20
- # if purchased from OpenC3, Inc.
21
- */
22
-
23
- export class ConfigParserError {
24
- constructor(config_parser, message, usage = '', url = '') {
25
- this.keyword = config_parser.keyword
26
- this.parameters = config_parser.parameters
27
- this.filename = config_parser.filename
28
- this.line = config_parser.line
29
- this.lineNumber = config_parser.lineNumber
30
- this.message = message
31
- this.usage = usage
32
- this.url = url
33
- }
34
- }
35
-
36
- export class ConfigParserService {
37
- keyword = null
38
- parameters = []
39
- filename = ''
40
- line = ''
41
- lineNumber = 0
42
- url = 'https://docs.openc3.com/docs'
43
- constructor() {}
44
-
45
- verify_num_parameters(min_num_params, max_num_params, usage = '') {
46
- // This syntax works with 0 because each doesn't return any values
47
- // for a backwards range
48
- for (let index = 1; index <= min_num_params; index++) {
49
- // If the parameter is nil (0 based) then we have a problem
50
- if (this.parameters[index - 1] === undefined) {
51
- throw new ConfigParserError(
52
- this,
53
- `Not enough parameters for ${this.keyword}.`,
54
- usage,
55
- this.url,
56
- )
57
- }
58
- }
59
- // If they pass null for max_params we don't check for a maximum number
60
- if (max_num_params && this.parameters[max_num_params] !== undefined) {
61
- throw new ConfigParserError(
62
- this,
63
- `Too many parameters for ${this.keyword}.`,
64
- usage,
65
- this.url,
66
- )
67
- }
68
- }
69
-
70
- remove_quotes(string) {
71
- if (string.length < 2) {
72
- return string
73
- }
74
- let first_char = string.charAt(0)
75
- if (first_char !== '"' && first_char !== "'") {
76
- return string
77
- }
78
- let last_char = string.charAt(string.length - 1)
79
- if (first_char !== last_char) {
80
- return string
81
- }
82
- return string.substring(1, string.length - 1)
83
- }
84
-
85
- scan_string(string, rx) {
86
- if (!rx.global) throw "rx must have 'global' flag set"
87
- let r = []
88
- string.replace(rx, function (match) {
89
- r.push(match)
90
- return match
91
- })
92
- return r
93
- }
94
-
95
- parse_string(
96
- input_string,
97
- original_filename,
98
- yield_non_keyword_lines,
99
- remove_quotes,
100
- handler,
101
- ) {
102
- let string_concat = false
103
- this.line = ''
104
- this.keyword = null
105
- this.parameters = []
106
- this.filename = original_filename
107
-
108
- // Break string into lines
109
- let lines = input_string.split('\n')
110
- let numLines = lines.length
111
-
112
- for (let i = 0; i < numLines; i++) {
113
- this.lineNumber = i + 1
114
- let line = lines[i].trim()
115
- // Ensure the line length is not 0
116
- if (line.length === 0) {
117
- continue
118
- }
119
-
120
- if (string_concat === true) {
121
- // Skip comment lines after a string concatenation
122
- if (line[0] === '#') {
123
- continue
124
- }
125
- // Remove the opening quote if we're continuing the line
126
- line = line.substring(1, line.length)
127
- }
128
-
129
- // Check for string continuation
130
- let last_char = line.charAt(line.length - 1)
131
- let newline = false
132
- switch (last_char) {
133
- case '+': // String concatenation with newlines
134
- newline = true
135
- // Deliberate fall through
136
- case '\\': // String concatenation
137
- // Trim off the concat character plus any spaces, e.g. "line" \
138
- let trim = line.substring(0, line.length - 1).trim()
139
- // Now trim off the last quote so it will flow into the next line
140
- this.line += trim.substring(0, trim.length - 1)
141
- if (newline) {
142
- this.line += '\n'
143
- }
144
- string_concat = true
145
- continue
146
- case '&': // Line continuation
147
- this.line += line.substring(0, line.length - 1)
148
- continue
149
- default:
150
- this.line += line
151
- }
152
- string_concat = false
153
-
154
- let rx = /("([^\\"]|\\.)*")|('([^\\']|\\.)*')|\S+/g
155
- let data = this.scan_string(this.line, rx)
156
- let first_item = ''
157
- if (data.length > 0) {
158
- first_item = first_item + data[0]
159
- }
160
-
161
- if (first_item.length === 0 || first_item.charAt(0) === '#') {
162
- this.keyword = null
163
- } else {
164
- this.keyword = first_item.toUpperCase()
165
- }
166
- this.parameters = []
167
-
168
- // Ignore lines without keywords: comments and blank lines
169
- if (this.keyword === null) {
170
- if (yield_non_keyword_lines) {
171
- handler(this.keyword, this.parameters, this.line, this.lineNumber)
172
- }
173
- this.line = ''
174
- continue
175
- }
176
-
177
- let length = data.length
178
- if (length > 1) {
179
- for (let index = 1; index < length; index++) {
180
- let string = data[index]
181
-
182
- // Don't process trailing comments such as:
183
- // KEYWORD PARAM #This is a comment
184
- if (string.length > 0 && string.charAt(0) === '#') {
185
- break
186
- }
187
- if (remove_quotes) {
188
- this.parameters.push(this.remove_quotes(string))
189
- } else {
190
- this.parameters.push(string)
191
- }
192
- }
193
- }
194
- handler(this.keyword, this.parameters, this.line, this.lineNumber)
195
- this.line = ''
196
- } // for all the lines
197
- } // parse_string
198
- } // class ConfigParserService