Class: IgniterLang::InternalProfileStaticDataCarrier
- Inherits:
-
Object
- Object
- IgniterLang::InternalProfileStaticDataCarrier
- Defined in:
- lib/igniter_lang/internal_profile_static_data_carrier.rb
Constant Summary collapse
- KIND =
"internal_profile_static_data_carrier"- FORMAT_VERSION =
"0.1.0"- STATIC_DATA_STATUSES =
["proof_local_only", "internal_test_seam_only"].freeze
- DIAG_INVALID_SHAPE =
"internal_profile_static_data_carrier.invalid_shape"- DIAG_UNSUPPORTED_KIND =
"internal_profile_static_data_carrier.unsupported_kind"- DIAG_UNSUPPORTED_FORMAT_VERSION =
"internal_profile_static_data_carrier.unsupported_format_version"- DIAG_UNSUPPORTED_STATIC_DATA_STATUS =
"internal_profile_static_data_carrier.unsupported_static_data_status"- DIAG_INVALID_AUTHORITY =
"internal_profile_static_data_carrier.invalid_authority"- DIAG_MISSING_PROFILE_CANDIDATE =
"internal_profile_static_data_carrier.missing_profile_candidate"- DIAG_MISSING_PACK_DESCRIPTOR_CANDIDATES =
"internal_profile_static_data_carrier.missing_pack_descriptor_candidates"- DIAG_SURFACE_OPEN =
"internal_profile_static_data_carrier.surface_open"- DIAG_FORBIDDEN_FIELD =
"internal_profile_static_data_carrier.forbidden_field"- DIAG_PACKET_BUILD_FAILED =
"internal_profile_static_data_carrier.packet_build_failed"- ACCEPTED_AUTHORITY_KINDS =
["proof_only", "design_accepted"].freeze
- ACCEPTED_CANON_STATUSES =
["non_canon", "accepted_design"].freeze
- FORBIDDEN_FIELDS =
%w[ compiler_profile_id compiler_profile_id_source compiler_profile_source profile_source default_profile named_profile profile_discovery igapp_path compilation_report_path loader_report compatibility_report compiler_result manifest sidecar artifact_hash runtime_ready production_ready spark_ready demo_ready public discovery loader report artifact runtime spark production demo ].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #diagnostics ⇒ Object
-
#initialize(static_data) ⇒ InternalProfileStaticDataCarrier
constructor
A new instance of InternalProfileStaticDataCarrier.
- #static_data_digest ⇒ Object
- #to_h ⇒ Object
- #to_source_packet ⇒ Object
- #valid_shape? ⇒ Boolean
Constructor Details
#initialize(static_data) ⇒ InternalProfileStaticDataCarrier
Returns a new instance of InternalProfileStaticDataCarrier.
66 67 68 69 70 71 |
# File 'lib/igniter_lang/internal_profile_static_data_carrier.rb', line 66 def initialize(static_data) @raw_static_data = static_data @static_data = normalize_hash(static_data) @packet_build_diagnostics = [] @diagnostics = validate_static_data end |
Class Method Details
.build(static_data:) ⇒ Object
62 63 64 |
# File 'lib/igniter_lang/internal_profile_static_data_carrier.rb', line 62 def self.build(static_data:) new(static_data) end |
Instance Method Details
#diagnostics ⇒ Object
93 94 95 |
# File 'lib/igniter_lang/internal_profile_static_data_carrier.rb', line 93 def diagnostics deep_copy(@diagnostics + @packet_build_diagnostics) end |
#static_data_digest ⇒ Object
113 114 115 |
# File 'lib/igniter_lang/internal_profile_static_data_carrier.rb', line 113 def static_data_digest Digest::SHA256.hexdigest(JSON.generate(canonicalize(carrier_material)))[0, 24] end |
#to_h ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/igniter_lang/internal_profile_static_data_carrier.rb', line 73 def to_h { "kind" => KIND, "format_version" => FORMAT_VERSION, "valid" => valid_shape?, "static_data_status" => static_data_status_output, "authority" => , "profile_candidate" => deep_copy(@static_data["profile_candidate"]), "pack_descriptor_candidates" => deep_copy(pack_descriptor_candidates), "excluded_namespaces" => deep_copy(excluded_namespaces), "diagnostics" => diagnostics, "static_data_digest" => static_data_digest, "closed_surface_assertions" => closed_surface_assertions_output } end |
#to_source_packet ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/igniter_lang/internal_profile_static_data_carrier.rb', line 97 def to_source_packet return nil unless valid_shape? IgniterLang::InternalProfileAssemblySourcePacket.build( authority: deep_copy(@static_data.fetch("authority")), profile_candidate: deep_copy(@static_data.fetch("profile_candidate")), pack_descriptor_candidates: deep_copy(@static_data.fetch("pack_descriptor_candidates")), lifecycle_state: IgniterLang::InternalProfileAssemblySourcePacket::IMPLEMENTATION_CANDIDATE, closed_surface_assertions: deep_copy(closed_surface_assertions), excluded_namespaces: deep_copy(excluded_namespaces) ) rescue StandardError => e record_packet_build_failure(e) nil end |
#valid_shape? ⇒ Boolean
89 90 91 |
# File 'lib/igniter_lang/internal_profile_static_data_carrier.rb', line 89 def valid_shape? diagnostics.empty? end |