skyfall 0.7.1 → 0.7.2
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/skyfall/firehose/commit_message.rb +5 -2
- data/lib/skyfall/firehose/labels_message.rb +4 -1
- data/lib/skyfall/firehose/message.rb +13 -11
- data/lib/skyfall/firehose/operation.rb +17 -12
- data/lib/skyfall/jetstream/commit_message.rb +2 -0
- data/lib/skyfall/jetstream/message.rb +2 -0
- data/lib/skyfall/jetstream/operation.rb +1 -9
- data/lib/skyfall/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fb0b83e7dfffdd7d36673ef3b1472ab6efdefbca6f39c2b80a5a1cf80061b4f2
|
|
4
|
+
data.tar.gz: 6edbd2f5b2130197de5b41e902047bceb0e243867eed517f40bfb7b169c9d427
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f145928fb2afc5ad2ace9a0614d2f0b4debfa0b76eab52cf98f59624e091c170ff397130e87d9d64a007d66856ca69b31cb406a022ea3a72641c03580b3fc9b8
|
|
7
|
+
data.tar.gz: c137e90709bf92171f1f8731687b3916ab72cf27cecf5392e8cc001adfacd0ebcc36ab03263997784c64685faa037ff15a1366de29da8b8c590948e93dc48e14
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [0.7.2] - 2026.08-17
|
|
2
|
+
|
|
3
|
+
- bumped up Oxygene dependency (see below under 0.7.1) to 0.1, with a stricter dependency rule
|
|
4
|
+
- includes various performance improvements for Base 32 en/decoding, CID & CAR parsing
|
|
5
|
+
- commit message decoding can be around 30% faster
|
|
6
|
+
- un-deprecated `#path` in both `Operation` classes (marked deprecated in 0.7.0)
|
|
7
|
+
- added `#ops` as alias for `#operations` in all message classes
|
|
8
|
+
- fixed `CommitMessage#prev_data` throwing an error if `prevData` is nil
|
|
9
|
+
- updated Firehose message constructors to verify that required fields aren't nil (not only that they're present), and for `LabelsMessage` that `labels` is an array
|
|
10
|
+
- some minor optimizations
|
|
11
|
+
- added some unit tests
|
|
12
|
+
|
|
1
13
|
## [0.7.1] - 2026-08-05
|
|
2
14
|
|
|
3
15
|
- extracted `CID` and `CarArchive` to a new gem "oxygene"
|
|
@@ -40,7 +40,7 @@ module Skyfall
|
|
|
40
40
|
|
|
41
41
|
# @return [Oxygene::CID, nil] CID (Content Identifier) of data of the previous commit in the repo
|
|
42
42
|
def prev_data
|
|
43
|
-
@prev_data ||= Oxygene::CID.from_cbor_tag(@data_object['prevData'])
|
|
43
|
+
@prev_data ||= @data_object['prevData'] && Oxygene::CID.from_cbor_tag(@data_object['prevData'])
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# @return [Oxygene::CID] CID (Content Identifier) of the commit
|
|
@@ -60,11 +60,14 @@ module Skyfall
|
|
|
60
60
|
@operations ||= @data_object['ops'].map { |op| Firehose::Operation.new(self, op) }
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
+
alias ops operations
|
|
64
|
+
|
|
63
65
|
# Looks up record data assigned to a given operation in the commit's CAR archive.
|
|
64
66
|
# @param op [Firehose::Operation]
|
|
65
67
|
# @return [Hash, nil]
|
|
66
68
|
def raw_record_for_operation(op)
|
|
67
|
-
|
|
69
|
+
cid = op.cid
|
|
70
|
+
cid && blocks.section_with_cid(cid, use_map: false, return_body: false)&.json_body
|
|
68
71
|
end
|
|
69
72
|
end
|
|
70
73
|
end
|
|
@@ -28,7 +28,10 @@ module Skyfall
|
|
|
28
28
|
super
|
|
29
29
|
check_if_not_nil 'seq', 'labels'
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
label_data = @data_object['labels']
|
|
32
|
+
raise DecodeError.new("Invalid labels field") unless label_data.is_a?(Array)
|
|
33
|
+
|
|
34
|
+
@labels = label_data.map { |x| Label.new(x) }
|
|
32
35
|
end
|
|
33
36
|
|
|
34
37
|
protected
|
|
@@ -109,6 +109,8 @@ module Skyfall
|
|
|
109
109
|
[]
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
+
alias ops operations
|
|
113
|
+
|
|
112
114
|
#
|
|
113
115
|
# @return [Boolean] true if the message is {Firehose::UnknownMessage} (of unrecognized type)
|
|
114
116
|
#
|
|
@@ -157,13 +159,13 @@ module Skyfall
|
|
|
157
159
|
|
|
158
160
|
# Note: this method is written this way as an optimization
|
|
159
161
|
def check_if_not_nil(a, b = nil, c = nil, d = nil, e = nil, f = nil, g = nil)
|
|
160
|
-
ok =
|
|
161
|
-
ok &&=
|
|
162
|
-
ok &&=
|
|
163
|
-
ok &&=
|
|
164
|
-
ok &&=
|
|
165
|
-
ok &&=
|
|
166
|
-
ok &&=
|
|
162
|
+
ok = !@data_object[a].nil?
|
|
163
|
+
ok &&= !@data_object[b].nil? if b
|
|
164
|
+
ok &&= !@data_object[c].nil? if c
|
|
165
|
+
ok &&= !@data_object[d].nil? if d
|
|
166
|
+
ok &&= !@data_object[e].nil? if e
|
|
167
|
+
ok &&= !@data_object[f].nil? if f
|
|
168
|
+
ok &&= !@data_object[g].nil? if g
|
|
167
169
|
|
|
168
170
|
if !ok
|
|
169
171
|
expected_fields = [a, b, c, d, e, f, g].compact
|
|
@@ -183,10 +185,6 @@ module Skyfall
|
|
|
183
185
|
|
|
184
186
|
type, data = objects
|
|
185
187
|
|
|
186
|
-
if data['error']
|
|
187
|
-
raise SubscriptionError.new(data['error'], data['message'])
|
|
188
|
-
end
|
|
189
|
-
|
|
190
188
|
raise DecodeError.new("Invalid object type: #{type.inspect}") unless type.is_a?(Hash)
|
|
191
189
|
raise DecodeError.new("Missing data: #{type.inspect}") unless type['op'] && type['t']
|
|
192
190
|
raise DecodeError.new("Invalid object type: #{type['op'].inspect}") unless type['op'].is_a?(Integer)
|
|
@@ -195,6 +193,10 @@ module Skyfall
|
|
|
195
193
|
raise UnsupportedError.new("Unsupported version: #{type['op']}") unless type['op'] == 1
|
|
196
194
|
raise DecodeError.new("Invalid object type: #{data.inspect}") unless data.is_a?(Hash)
|
|
197
195
|
|
|
196
|
+
if data['error']
|
|
197
|
+
raise SubscriptionError.new(data['error'], data['message'])
|
|
198
|
+
end
|
|
199
|
+
|
|
198
200
|
[type, data]
|
|
199
201
|
end
|
|
200
202
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative '../collection'
|
|
4
|
+
require_relative '../errors'
|
|
4
5
|
require_relative '../firehose'
|
|
5
6
|
require 'oxygene'
|
|
6
7
|
|
|
@@ -42,36 +43,40 @@ module Skyfall
|
|
|
42
43
|
alias did repo
|
|
43
44
|
|
|
44
45
|
# @return [String] path part of the record URI (collection + rkey)
|
|
45
|
-
# @deprecated Use {#collection} + {#rkey}
|
|
46
46
|
def path
|
|
47
|
-
@@path_warning_printed ||= false
|
|
48
|
-
|
|
49
|
-
unless @@path_warning_printed
|
|
50
|
-
$stderr.puts "Warning: Skyfall::Firehose::Operation#path is deprecated - use #collection + #rkey"
|
|
51
|
-
@@path_warning_printed = true
|
|
52
|
-
end
|
|
53
|
-
|
|
54
47
|
@json['path']
|
|
55
48
|
end
|
|
56
49
|
|
|
57
50
|
# @return [Symbol] type of the operation (`:create`, `:update` or `:delete`)
|
|
58
51
|
def action
|
|
59
|
-
@json['action'].to_sym
|
|
52
|
+
@action ||= @json['action'].to_sym
|
|
60
53
|
end
|
|
61
54
|
|
|
62
55
|
# @return [String] record collection NSID
|
|
63
56
|
def collection
|
|
64
|
-
@
|
|
57
|
+
@collection ||= begin
|
|
58
|
+
path = @json['path']
|
|
59
|
+
slash = path.index('/')
|
|
60
|
+
raise DecodeError, "Path doesn't contain a /: #{path}" if slash.nil?
|
|
61
|
+
|
|
62
|
+
path[0...slash]
|
|
63
|
+
end
|
|
65
64
|
end
|
|
66
65
|
|
|
67
66
|
# @return [String] record rkey
|
|
68
67
|
def rkey
|
|
69
|
-
@
|
|
68
|
+
@rkey ||= begin
|
|
69
|
+
path = @json['path']
|
|
70
|
+
slash = path.index('/')
|
|
71
|
+
raise DecodeError, "Path doesn't contain a /: #{path}" if slash.nil?
|
|
72
|
+
|
|
73
|
+
path[(slash + 1)..-1]
|
|
74
|
+
end
|
|
70
75
|
end
|
|
71
76
|
|
|
72
77
|
# @return [String] full AT URI of the record
|
|
73
78
|
def uri
|
|
74
|
-
"at://#{repo}/#{
|
|
79
|
+
@uri ||= "at://#{repo}/#{path}"
|
|
75
80
|
end
|
|
76
81
|
|
|
77
82
|
# @return [Oxygene::CID, nil] CID (Content Identifier) of the record (nil for delete operations)
|
|
@@ -42,16 +42,8 @@ module Skyfall
|
|
|
42
42
|
alias did repo
|
|
43
43
|
|
|
44
44
|
# @return [String] path part of the record URI (collection + rkey)
|
|
45
|
-
# @deprecated Use {#collection} + {#rkey}
|
|
46
45
|
def path
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
unless @@path_warning_printed
|
|
50
|
-
$stderr.puts "Warning: Skyfall::Jetstream::Operation#path is deprecated - use #collection + #rkey"
|
|
51
|
-
@@path_warning_printed = true
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
@json['collection'] + '/' + @json['rkey']
|
|
46
|
+
@path ||= "#{@json['collection']}/#{@json['rkey']}"
|
|
55
47
|
end
|
|
56
48
|
|
|
57
49
|
# @return [Symbol] type of the operation (`:create`, `:update` or `:delete`)
|
data/lib/skyfall/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: skyfall
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kuba Suder
|
|
@@ -47,16 +47,16 @@ dependencies:
|
|
|
47
47
|
name: oxygene
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
|
49
49
|
requirements:
|
|
50
|
-
- - "
|
|
50
|
+
- - "~>"
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: 0.0
|
|
52
|
+
version: 0.1.0
|
|
53
53
|
type: :runtime
|
|
54
54
|
prerelease: false
|
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
|
57
|
-
- - "
|
|
57
|
+
- - "~>"
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: 0.0
|
|
59
|
+
version: 0.1.0
|
|
60
60
|
description: "\n Skyfall is a Ruby gem for connecting to the \"firehose\" of the
|
|
61
61
|
AT Protocol network that Bluesky is built on,\n i.e. a websocket which streams
|
|
62
62
|
all new posts and everything else happening on the network in real time. The code\n
|