openc3 7.0.0.pre.rc2 → 7.0.0

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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/bin/openc3cli +13 -4
  3. data/bin/pipinstall +6 -7
  4. data/bin/pipuninstall +3 -5
  5. data/data/config/interface_modifiers.yaml +1 -1
  6. data/data/config/item_modifiers.yaml +18 -6
  7. data/data/config/telemetry.yaml +1 -1
  8. data/data/config/widgets.yaml +10 -0
  9. data/lib/openc3/accessors/json_accessor.rb +1 -1
  10. data/lib/openc3/api/cmd_api.rb +2 -0
  11. data/lib/openc3/api/settings_api.rb +2 -0
  12. data/lib/openc3/api/tlm_api.rb +3 -3
  13. data/lib/openc3/config/config_parser.rb +4 -4
  14. data/lib/openc3/conversions/conversion.rb +3 -3
  15. data/lib/openc3/core_ext/faraday.rb +4 -0
  16. data/lib/openc3/logs/log_writer.rb +24 -6
  17. data/lib/openc3/logs/packet_log_writer.rb +1 -4
  18. data/lib/openc3/logs/stream_log_pair.rb +11 -4
  19. data/lib/openc3/logs/text_log_writer.rb +1 -4
  20. data/lib/openc3/microservices/interface_microservice.rb +8 -2
  21. data/lib/openc3/microservices/log_microservice.rb +7 -2
  22. data/lib/openc3/microservices/microservice.rb +10 -4
  23. data/lib/openc3/microservices/queue_microservice.rb +9 -2
  24. data/lib/openc3/microservices/scope_cleanup_microservice.rb +116 -1
  25. data/lib/openc3/microservices/text_log_microservice.rb +4 -1
  26. data/lib/openc3/migrations/20241208080000_no_critical_cmd.rb +1 -1
  27. data/lib/openc3/migrations/20250402000000_periodic_only_default.rb +1 -1
  28. data/lib/openc3/migrations/20260203000000_remove_store_id.rb +28 -0
  29. data/lib/openc3/migrations/20260204000000_remove_decom_reducer.rb +29 -1
  30. data/lib/openc3/models/activity_model.rb +41 -9
  31. data/lib/openc3/models/auth_model.rb +54 -19
  32. data/lib/openc3/models/cvt_model.rb +2 -265
  33. data/lib/openc3/models/model.rb +16 -0
  34. data/lib/openc3/models/plugin_model.rb +18 -12
  35. data/lib/openc3/models/plugin_store_model.rb +1 -1
  36. data/lib/openc3/models/python_package_model.rb +2 -2
  37. data/lib/openc3/models/queue_model.rb +5 -3
  38. data/lib/openc3/models/script_engine_model.rb +1 -1
  39. data/lib/openc3/models/target_model.rb +75 -42
  40. data/lib/openc3/models/tool_config_model.rb +12 -0
  41. data/lib/openc3/models/tool_model.rb +18 -5
  42. data/lib/openc3/models/trigger_model.rb +1 -1
  43. data/lib/openc3/models/widget_model.rb +2 -9
  44. data/lib/openc3/operators/operator.rb +9 -7
  45. data/lib/openc3/packets/json_packet.rb +2 -0
  46. data/lib/openc3/packets/packet.rb +1 -0
  47. data/lib/openc3/packets/packet_config.rb +28 -12
  48. data/lib/openc3/script/calendar.rb +8 -0
  49. data/lib/openc3/script/script.rb +19 -0
  50. data/lib/openc3/script/storage.rb +6 -6
  51. data/lib/openc3/script/web_socket_api.rb +1 -1
  52. data/lib/openc3/system/system.rb +6 -6
  53. data/lib/openc3/tools/cmd_tlm_server/interface_thread.rb +0 -2
  54. data/lib/openc3/top_level.rb +15 -63
  55. data/lib/openc3/topics/command_topic.rb +1 -0
  56. data/lib/openc3/topics/limits_event_topic.rb +1 -1
  57. data/lib/openc3/utilities/authentication.rb +46 -7
  58. data/lib/openc3/utilities/authorization.rb +8 -1
  59. data/lib/openc3/utilities/aws_bucket.rb +2 -3
  60. data/lib/openc3/utilities/bucket_utilities.rb +3 -1
  61. data/lib/openc3/utilities/cli_generator.rb +7 -0
  62. data/lib/openc3/utilities/cmd_log.rb +1 -1
  63. data/lib/openc3/utilities/local_mode.rb +3 -0
  64. data/lib/openc3/utilities/process_manager.rb +1 -1
  65. data/lib/openc3/utilities/python_proxy.rb +11 -4
  66. data/lib/openc3/utilities/questdb_client.rb +764 -2
  67. data/lib/openc3/utilities/running_script.rb +25 -7
  68. data/lib/openc3/utilities/script.rb +452 -0
  69. data/lib/openc3/utilities/secrets.rb +1 -1
  70. data/lib/openc3/version.rb +5 -5
  71. data/templates/conversion/conversion.py +0 -8
  72. data/templates/conversion/conversion.rb +0 -11
  73. data/templates/tool_angular/package.json +2 -2
  74. data/templates/tool_react/package.json +1 -1
  75. data/templates/tool_svelte/package.json +1 -1
  76. data/templates/tool_vue/package.json +3 -3
  77. data/templates/widget/package.json +2 -2
  78. metadata +19 -19
  79. data/lib/openc3/migrations/20251022000000_remove_unique_id.rb +0 -23
  80. data/lib/openc3/migrations/20251213120000_reinstall_plugins.rb +0 -45
@@ -29,6 +29,13 @@ rescue LoadError
29
29
  end
30
30
 
31
31
  module Authorization
32
+ ANONYMOUS_USER = "anonymous"
33
+
34
+ def self.generate_otp(user)
35
+ raise AuthError.new("Invalid OTP user") unless user == ANONYMOUS_USER
36
+ return OpenC3::AuthModel.generate_session(otp: true)
37
+ end
38
+
32
39
  private
33
40
 
34
41
  # Raises an exception if unauthorized, otherwise does nothing
@@ -41,7 +48,7 @@ rescue LoadError
41
48
  raise AuthError.new("Token is invalid")
42
49
  end
43
50
  end
44
- return "anonymous"
51
+ return ANONYMOUS_USER
45
52
  end
46
53
 
47
54
  def user_info(_token)
@@ -30,8 +30,7 @@ module OpenC3
30
30
  @use_checksum = if ENV.key?('OPENC3_NO_S3_CHECKSUM')
31
31
  ENV['OPENC3_NO_S3_CHECKSUM'].to_s.empty? # Empty string means use checksum
32
32
  else
33
- # If OPENC3_BUCKET_URL is set, we're using a non-AWS S3 backend
34
- !ENV.key?('OPENC3_BUCKET_URL')
33
+ ENV.fetch('OPENC3_CLOUD', 'local').downcase == 'aws'
35
34
  end
36
35
  end
37
36
 
@@ -48,7 +47,7 @@ module OpenC3
48
47
  end
49
48
 
50
49
  def ensure_public(bucket)
51
- unless ENV['OPENC3_NO_BUCKET_POLICY']
50
+ unless ENV.fetch('OPENC3_NO_BUCKET_POLICY', false)
52
51
  policy = <<~EOL
53
52
  {
54
53
  "Version": "2012-10-17",
@@ -117,7 +117,9 @@ module OpenC3
117
117
  # Allow caching for files that have a filename versioning strategy
118
118
  has_version_number = /(-|_|\.)\d+(-|_|\.)\d+(-|_|\.)\d+\./.match(filename)
119
119
  has_content_hash = /[\.-][a-f0-9]{20}\./.match(filename)
120
- return nil if has_version_number or has_content_hash
120
+ # Font files are immutable assets deployed with plugins and safe to cache
121
+ is_font = /\.(woff2?|eot|ttf|otf)$/.match(filename)
122
+ return nil if has_version_number or has_content_hash or is_font
121
123
  return 'no-store'
122
124
  end
123
125
 
@@ -197,6 +197,8 @@ module OpenC3
197
197
  target_lib_filename = "#{target_name.downcase}.#{@@language}"
198
198
  target_class = target_lib_filename.filename_to_class_name
199
199
  target_object = target_name.downcase
200
+ target_class.inspect # Remove unused variable warning. These are used in binding for generator
201
+ target_object.inspect # Remove unused variable warning. These are used in binding for generator
200
202
 
201
203
  process_template("#{TEMPLATES_DIR}/target", binding) do |filename|
202
204
  # Rename the template TARGET to our actual target named after the plugin
@@ -292,6 +294,7 @@ RUBY
292
294
  end
293
295
  microservice_filename = "#{microservice_name.downcase}.#{@@language}"
294
296
  microservice_class = microservice_filename.filename_to_class_name
297
+ microservice_class.inspect # Remove unused variable warning. These are used in binding for generator
295
298
 
296
299
  process_template("#{TEMPLATES_DIR}/microservice", binding) do |filename|
297
300
  # Rename the template MICROSERVICE to our actual microservice name
@@ -547,6 +550,7 @@ RUBY
547
550
  conversion_name = "#{args[2].upcase.gsub(/_+|-+/, '_')}_CONVERSION"
548
551
  conversion_basename = "#{conversion_name.downcase}.#{@@language}"
549
552
  conversion_class = conversion_basename.filename_to_class_name
553
+ conversion_class.inspect # Remove unused variable warning. These are used in binding for generator
550
554
  conversion_filename = "targets/#{target_name}/lib/#{conversion_basename}"
551
555
  if File.exist?(conversion_filename)
552
556
  abort("Conversion #{conversion_filename} already exists!")
@@ -601,6 +605,7 @@ RUBY
601
605
  processor_name = "#{args[2].upcase.gsub(/_+|-+/, '_')}_PROCESSOR"
602
606
  processor_basename = "#{processor_name.downcase}.#{@@language}"
603
607
  processor_class = processor_basename.filename_to_class_name
608
+ processor_class.inspect # Remove unused variable warning. These are used in binding for generator
604
609
  processor_filename = "targets/#{target_name}/lib/#{processor_basename}"
605
610
  if File.exist?(processor_filename)
606
611
  abort("Processor #{processor_filename} already exists!")
@@ -656,6 +661,7 @@ RUBY
656
661
  response_basename = "#{response_name.downcase}.#{@@language}"
657
662
  response_filename = "targets/#{target_name}/lib/#{response_basename}"
658
663
  response_class = response_basename.filename_to_class_name
664
+ response_class.inspect # Remove unused variable warning. These are used in binding for generator
659
665
  if File.exist?(response_filename)
660
666
  abort("response #{response_filename} already exists!")
661
667
  end
@@ -709,6 +715,7 @@ RUBY
709
715
  validator_name = "#{args[2].upcase.gsub(/_+|-+/, '_')}_COMMAND_VALIDATOR"
710
716
  validator_basename = "#{validator_name.downcase}.#{@@language}"
711
717
  validator_class = validator_basename.filename_to_class_name
718
+ validator_class.inspect # Remove unused variable warning. These are used in binding for generator
712
719
  validator_filename = "targets/#{target_name}/lib/#{validator_basename}"
713
720
  if File.exist?(validator_filename)
714
721
  abort("Command validator #{validator_filename} already exists!")
@@ -11,7 +11,7 @@
11
11
  # This file may also be used under the terms of a commercial license
12
12
  # if purchased from OpenC3, Inc.
13
13
 
14
- require 'openc3/packets/packet'
14
+ # require 'openc3/packets/packet' # Circular require
15
15
 
16
16
  module OpenC3
17
17
  module CmdLog
@@ -450,6 +450,7 @@ module OpenC3
450
450
  end
451
451
 
452
452
  def self.save_tool_config(scope, tool, name, data)
453
+ return unless ENV['OPENC3_LOCAL_MODE'] and Dir.exist?(OPENC3_LOCAL_MODE_PATH)
453
454
  json = JSON.parse(data, allow_nan: true, create_additions: true)
454
455
  config_path = "#{OPENC3_LOCAL_MODE_PATH}/#{scope}/tool_config/#{tool}/#{name}.json"
455
456
  return unless File.expand_path(config_path).start_with?(OPENC3_LOCAL_MODE_PATH)
@@ -460,6 +461,7 @@ module OpenC3
460
461
  end
461
462
 
462
463
  def self.delete_tool_config(scope, tool, name)
464
+ return unless ENV['OPENC3_LOCAL_MODE'] and Dir.exist?(OPENC3_LOCAL_MODE_PATH)
463
465
  config_path = "#{OPENC3_LOCAL_MODE_PATH}/#{scope}/tool_config/#{tool}/#{name}.json"
464
466
  return unless File.expand_path(config_path).start_with?(OPENC3_LOCAL_MODE_PATH)
465
467
  FileUtils.rm_f(config_path)
@@ -479,6 +481,7 @@ module OpenC3
479
481
  end
480
482
 
481
483
  def self.save_setting(scope, name, data)
484
+ return unless ENV['OPENC3_LOCAL_MODE'] and Dir.exist?(OPENC3_LOCAL_MODE_PATH)
482
485
  config_path = "#{OPENC3_LOCAL_MODE_PATH}/#{scope}/settings/#{name}.json"
483
486
  return unless File.expand_path(config_path).start_with?(OPENC3_LOCAL_MODE_PATH)
484
487
  FileUtils.mkdir_p(File.dirname(config_path))
@@ -17,7 +17,7 @@
17
17
 
18
18
  require 'openc3/operators/operator'
19
19
  require 'openc3/models/process_status_model'
20
- require 'openc3/models/scope_model'
20
+ # require 'openc3/models/scope_model' # Circular require
21
21
  require 'openc3/utilities/logger'
22
22
  require 'socket'
23
23
 
@@ -11,13 +11,13 @@
11
11
  # This file may also be used under the terms of a commercial license
12
12
  # if purchased from OpenC3, Inc.
13
13
 
14
- # TODO: Delegate to actual Python to verify that classes exist
15
- # and to get proper data from them like converted_type
16
-
17
14
  module OpenC3
18
15
  class PythonProxy
19
16
  attr_accessor :name
20
17
  attr_accessor :args
18
+ attr_accessor :converted_type
19
+ attr_accessor :converted_bit_size
20
+ attr_accessor :converted_array_size
21
21
 
22
22
  def initialize(type, class_name, *params)
23
23
  @type = type
@@ -25,6 +25,9 @@ module OpenC3
25
25
  @params = params
26
26
  @args = params
27
27
  @name = nil
28
+ @converted_type = nil
29
+ @converted_bit_size = nil
30
+ @converted_array_size = nil
28
31
  end
29
32
 
30
33
  def class
@@ -36,7 +39,11 @@ module OpenC3
36
39
  when "Processor"
37
40
  return { 'name' => @name, 'class' => @class_name, 'params' => @params }
38
41
  when "Conversion"
39
- return { 'class' => @class_name, 'params' => @params }
42
+ result = { 'class' => @class_name, 'params' => @params }
43
+ result['converted_type'] = @converted_type.to_s if @converted_type
44
+ result['converted_bit_size'] = @converted_bit_size if @converted_bit_size
45
+ result['converted_array_size'] = @converted_array_size if @converted_array_size
46
+ return result
40
47
  when "LimitsResponse"
41
48
  return { "class" => @class_name, 'params' => @params }
42
49
  else