unitsdb 2.2.8 → 2.2.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94b9120c65578a597fc7699d763d7a374cfef8bac9ab3eb3c0b7e2220601c8f6
4
- data.tar.gz: accf6d8f8dfc53ce8816aede9d46e093b7c71cf86533bc76bbcc79a9654eb790
3
+ metadata.gz: 02e9966f9b73a990ff0c608a12bbe0671d94fb25b6d263bf919d2f631ff4585d
4
+ data.tar.gz: 710c16aba9a41c61a4af9f891f434a4b0b64b09789c1427f42cd2a47035a435c
5
5
  SHA512:
6
- metadata.gz: 3f43fc6cac30b00ac30c5e0f46fd2247499d66f5165632d4d66ea7b0200653ace03fda0f83f2bc9214e9e6248063e9c0f87d0cfea4d188ba77b2598ef7996048
7
- data.tar.gz: 34a1ea5b15a5fe6e76c8730c7eea78448a2e8bc3317575ab24de2f35f0714f0bed47b8f5313e8867bc550454e54d98026c5233743c2f4e33b278611e4940ad31
6
+ metadata.gz: 111baa323a50019347d6f2643236de1ff9eba13a8a7285d5d8c0140d7c47ea08b3d6dfe54fa286641651ab075ec964a04ad72fb274f2eab30cc1c6c1ea34b29f
7
+ data.tar.gz: 4d542496fb728459db62795ba6c8186144837c4671b73591f414f1764486f42f0290ac288017d398607347362c3307ed413cb9b673bc8d37bdf404fac8bdbd4d
data/Gemfile CHANGED
@@ -6,7 +6,6 @@ source "https://rubygems.org"
6
6
  gemspec
7
7
 
8
8
  gem "canon"
9
- gem "lutaml-model", github: "lutaml/lutaml-model", branch: "main"
10
9
  gem "nokogiri"
11
10
  gem "opal", "~> 1.8"
12
11
  gem "rake"
data/README.adoc CHANGED
@@ -1102,3 +1102,12 @@ without any additional setup.
1102
1102
  == License
1103
1103
 
1104
1104
  Copyright Ribose. BSD 2-clause license.
1105
+
1106
+ == JavaScript / TypeScript
1107
+
1108
+ The native JavaScript implementation of UnitsDB is the `unitsdb` package
1109
+ on npm (https://github.com/unitsml/unitsdb-ts[unitsml/unitsdb-ts]) —
1110
+ typed access to the same dataset, rebuilt from unitsdb releases. The
1111
+ former Opal-compiled `@unitsml/unitsdb` package is deprecated; its
1112
+ repository (unitsml/unitsdb-js) is archived.
1113
+
@@ -0,0 +1,9 @@
1
+ module Unitsdb
2
+ class CanonicalConversion < Lutaml::Model::Serializable
3
+ attribute :factor, :string
4
+ attribute :offset, :string
5
+ attribute :root_units, RootUnitReference, collection: true
6
+ end
7
+
8
+ Config.register_model(CanonicalConversion, id: :canonical_conversion)
9
+ end
@@ -27,7 +27,11 @@ module Unitsdb
27
27
 
28
28
  DATABASE_FILES = REQUIRED_DATABASE_FILES.merge(OPTIONAL_DATABASE_FILES).freeze
29
29
 
30
- SUPPORTED_SCHEMA_VERSION = "2.0.0"
30
+ SUPPORTED_SCHEMA_VERSIONS = %w[2.0.0 2.1.0].freeze
31
+
32
+ # Transitional: 2.1.0 adds optional canonical_conversion/operations
33
+ # fields only — 2.0.0 data remains valid.
34
+ SUPPORTED_SCHEMA_VERSION = SUPPORTED_SCHEMA_VERSIONS.last
31
35
 
32
36
  def self.load(dir_path)
33
37
  new(dir_path).load
@@ -112,11 +116,11 @@ module Unitsdb
112
116
  end
113
117
 
114
118
  version = versions.values.first
115
- return version if version == SUPPORTED_SCHEMA_VERSION
119
+ return version if SUPPORTED_SCHEMA_VERSIONS.include?(version)
116
120
 
117
121
  raise Errors::UnsupportedVersionError,
118
122
  "Unsupported database version: #{version}. " \
119
- "Only version #{SUPPORTED_SCHEMA_VERSION} is supported."
123
+ "Supported versions: #{SUPPORTED_SCHEMA_VERSIONS.join(', ')}."
120
124
  end
121
125
 
122
126
  def build_database_hash(documents, schema_version)
data/lib/unitsdb/opal.rb CHANGED
@@ -22,6 +22,7 @@ require "unitsdb/unit_system_reference"
22
22
  require "unitsdb/scale_reference"
23
23
  require "unitsdb/external_reference"
24
24
  require "unitsdb/root_unit_reference"
25
+ require "unitsdb/canonical_conversion"
25
26
  require "unitsdb/si_derived_base"
26
27
  require "unitsdb/dimension_details"
27
28
  require "unitsdb/dimension"
data/lib/unitsdb/scale.rb CHANGED
@@ -7,6 +7,7 @@ module Unitsdb
7
7
  attribute :description, LocalizedString, collection: true
8
8
  attribute :short, :string
9
9
  attribute :properties, ScaleProperties
10
+ attribute :operations, :string, collection: true
10
11
  end
11
12
 
12
13
  Config.register_model(Scale, id: :scale)
data/lib/unitsdb/unit.rb CHANGED
@@ -14,6 +14,7 @@ module Unitsdb
14
14
  attribute :si_derived_bases, SiDerivedBase, collection: true
15
15
  attribute :root_units, RootUnitReference, collection: true
16
16
  attribute :references, ExternalReference, collection: true
17
+ attribute :canonical_conversion, CanonicalConversion
17
18
  attribute :scale_reference, ScaleReference
18
19
  end
19
20
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unitsdb
4
- VERSION = "2.2.8"
4
+ VERSION = "2.2.9"
5
5
 
6
6
  # The version of the bundled UnitsDB data (from the data/ submodule).
7
7
  # This version corresponds to a tag/commit in https://github.com/unitsml/unitsdb.
data/lib/unitsdb.rb CHANGED
@@ -28,6 +28,7 @@ module Unitsdb
28
28
  autoload :ScaleReference, "unitsdb/scale_reference"
29
29
  autoload :ExternalReference, "unitsdb/external_reference"
30
30
  autoload :RootUnitReference, "unitsdb/root_unit_reference"
31
+ autoload :CanonicalConversion, "unitsdb/canonical_conversion"
31
32
  autoload :SiDerivedBase, "unitsdb/si_derived_base"
32
33
  autoload :DimensionDetails, "unitsdb/dimension_details"
33
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unitsdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.8
4
+ version: 2.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-24 00:00:00.000000000 Z
11
+ date: 2026-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fuzzy_match
@@ -165,6 +165,7 @@ files:
165
165
  - data/units.yaml
166
166
  - exe/unitsdb
167
167
  - lib/unitsdb.rb
168
+ - lib/unitsdb/canonical_conversion.rb
168
169
  - lib/unitsdb/cli.rb
169
170
  - lib/unitsdb/commands.rb
170
171
  - lib/unitsdb/commands/_modify.rb