ruby_event_store-browser 2.5.1 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby_event_store/browser/app.rb +2 -2
- data/lib/ruby_event_store/browser/gem_source.rb +32 -0
- data/lib/ruby_event_store/browser/get_event.rb +10 -1
- data/lib/ruby_event_store/browser/get_stream.rb +7 -16
- data/lib/ruby_event_store/browser/json_api_stream.rb +34 -0
- data/lib/ruby_event_store/browser/urls.rb +26 -2
- data/lib/ruby_event_store/browser/version.rb +1 -1
- data/lib/ruby_event_store/browser.rb +2 -0
- data/public/ruby_event_store_browser.css +1 -1
- data/public/ruby_event_store_browser.css.map +1 -0
- data/public/ruby_event_store_browser.js +1 -1
- data/public/ruby_event_store_browser.js.map +1 -0
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1936ff546e0ad15d87e44b1db604c7249f56bbec6c4eb8837fdd9725b03724df
|
4
|
+
data.tar.gz: bae5fd36d624bfa6d34c655e0d37b93f992438f082a002a687840e17b9de9b42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34c5084fff038f9d503052eb7f74a0a96c035a90afa86c4051fec0ba18eb067187c9df87659a16bddfb6b2bef70dfe99e43b68a9fa392ab7463288fdddb85650
|
7
|
+
data.tar.gz: 42508d0dea023cdec765c5e399ec748609d2a9844a2ac3aa0b8ed4339fdb349419182309465593bb48ca31501c033e2a95ed8654cb4ff1b1053d64d903f643c4
|
@@ -130,11 +130,11 @@ module RubyEventStore
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def json(body)
|
133
|
-
[200, { "
|
133
|
+
[200, { "content-type" => "application/vnd.api+json" }, [JSON.dump(body.to_h)]]
|
134
134
|
end
|
135
135
|
|
136
136
|
def erb(template, **locals)
|
137
|
-
[200, { "
|
137
|
+
[200, { "content-type" => "text/html;charset=utf-8" }, [ERB.new(template).result_with_hash(locals)]]
|
138
138
|
end
|
139
139
|
|
140
140
|
def res_version
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyEventStore
|
4
|
+
module Browser
|
5
|
+
class GemSource
|
6
|
+
attr_reader :path
|
7
|
+
|
8
|
+
def initialize(load_path)
|
9
|
+
@path =
|
10
|
+
load_path
|
11
|
+
.select { |entry| String === entry }
|
12
|
+
.find { |entry| entry.match? %r{ruby_event_store-browser(?:-\d\.\d\.\d)?/lib\z} }
|
13
|
+
end
|
14
|
+
|
15
|
+
def version
|
16
|
+
if from_rubygems?
|
17
|
+
path.split("/").fetch(-2).split("-").last
|
18
|
+
elsif from_git?
|
19
|
+
path.split("/").fetch(-3).split("-").last
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def from_rubygems?
|
24
|
+
path.match? %r{/gems/ruby_event_store-browser-\d\.\d\.\d/lib\z}
|
25
|
+
end
|
26
|
+
|
27
|
+
def from_git?
|
28
|
+
path.match? %r{/bundler/gems/rails_event_store-[a-z0-9]{12}/ruby_event_store-browser/lib\z}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -9,11 +9,20 @@ module RubyEventStore
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_h
|
12
|
-
{
|
12
|
+
{
|
13
|
+
data: [
|
14
|
+
JsonApiEvent.new(event, parent_event_id).to_h,
|
15
|
+
{ relationships: { streams: { data: streams } } }
|
16
|
+
].reduce(&:merge)
|
17
|
+
}
|
13
18
|
end
|
14
19
|
|
15
20
|
private
|
16
21
|
|
22
|
+
def streams
|
23
|
+
event_store.streams_of(event_id).map { |stream| { "id" => stream.name, "type" => "streams" } }
|
24
|
+
end
|
25
|
+
|
17
26
|
attr_reader :event_store, :event_id
|
18
27
|
|
19
28
|
def event
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RubyEventStore
|
2
4
|
module Browser
|
3
5
|
class GetStream
|
@@ -8,28 +10,17 @@ module RubyEventStore
|
|
8
10
|
end
|
9
11
|
|
10
12
|
def to_h
|
11
|
-
{
|
12
|
-
data: {
|
13
|
-
id: stream_name,
|
14
|
-
type: "streams",
|
15
|
-
attributes: {
|
16
|
-
related_streams: related_streams
|
17
|
-
},
|
18
|
-
relationships: {
|
19
|
-
events: {
|
20
|
-
links: {
|
21
|
-
self: routing.paginated_events_from_stream_url(id: stream_name)
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
13
|
+
{ data: JsonApiStream.new(stream_name, events_from_stream_url, related_streams).to_h }
|
27
14
|
end
|
28
15
|
|
29
16
|
private
|
30
17
|
|
31
18
|
attr_reader :stream_name, :routing, :related_streams_query
|
32
19
|
|
20
|
+
def events_from_stream_url
|
21
|
+
routing.paginated_events_from_stream_url(id: stream_name)
|
22
|
+
end
|
23
|
+
|
33
24
|
def related_streams
|
34
25
|
related_streams_query.call(stream_name) unless related_streams_query.equal?(DEFAULT_RELATED_STREAMS_QUERY)
|
35
26
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyEventStore
|
4
|
+
module Browser
|
5
|
+
class JsonApiStream
|
6
|
+
def initialize(stream_name, events_from_stream_url, related_streams)
|
7
|
+
@stream_name = stream_name
|
8
|
+
@events_from_stream_url = events_from_stream_url
|
9
|
+
@related_streams = related_streams
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_h
|
13
|
+
{
|
14
|
+
id: stream_name,
|
15
|
+
type: "streams",
|
16
|
+
attributes: {
|
17
|
+
related_streams: related_streams
|
18
|
+
},
|
19
|
+
relationships: {
|
20
|
+
events: {
|
21
|
+
links: {
|
22
|
+
self: events_from_stream_url
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
attr_reader :stream_name, :events_from_stream_url, :related_streams
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RubyEventStore
|
2
4
|
module Browser
|
3
5
|
class Urls
|
@@ -20,6 +22,7 @@ module RubyEventStore
|
|
20
22
|
@root_path = root_path
|
21
23
|
@app_url = [host, root_path].compact.reduce(:+)
|
22
24
|
@api_url = api_url || ("#{app_url}/api" if app_url)
|
25
|
+
@gem_source = GemSource.new($LOAD_PATH)
|
23
26
|
end
|
24
27
|
|
25
28
|
def events_url
|
@@ -45,11 +48,21 @@ module RubyEventStore
|
|
45
48
|
end
|
46
49
|
|
47
50
|
def browser_js_url
|
48
|
-
"
|
51
|
+
name = "ruby_event_store_browser.js"
|
52
|
+
if gem_source.from_git?
|
53
|
+
cdn_file_url(name)
|
54
|
+
else
|
55
|
+
local_file_url(name)
|
56
|
+
end
|
49
57
|
end
|
50
58
|
|
51
59
|
def browser_css_url
|
52
|
-
"
|
60
|
+
name = "ruby_event_store_browser.css"
|
61
|
+
if gem_source.from_git?
|
62
|
+
cdn_file_url(name)
|
63
|
+
else
|
64
|
+
local_file_url(name)
|
65
|
+
end
|
53
66
|
end
|
54
67
|
|
55
68
|
def bootstrap_js_url
|
@@ -59,6 +72,17 @@ module RubyEventStore
|
|
59
72
|
def ==(o)
|
60
73
|
self.class.eql?(o.class) && app_url.eql?(o.app_url) && api_url.eql?(o.api_url)
|
61
74
|
end
|
75
|
+
|
76
|
+
private
|
77
|
+
attr_reader :gem_source
|
78
|
+
|
79
|
+
def local_file_url(name)
|
80
|
+
"#{app_url}/#{name}"
|
81
|
+
end
|
82
|
+
|
83
|
+
def cdn_file_url(name)
|
84
|
+
"https://cdn.railseventstore.org/#{gem_source.version}/#{name}"
|
85
|
+
end
|
62
86
|
end
|
63
87
|
end
|
64
88
|
end
|
@@ -10,7 +10,9 @@ end
|
|
10
10
|
|
11
11
|
require_relative "browser/get_event"
|
12
12
|
require_relative "browser/json_api_event"
|
13
|
+
require_relative "browser/json_api_stream"
|
13
14
|
require_relative "browser/get_events_from_stream"
|
14
15
|
require_relative "browser/get_stream"
|
15
16
|
require_relative "browser/urls"
|
17
|
+
require_relative "browser/gem_source"
|
16
18
|
require_relative "browser/router"
|
@@ -1 +1 @@
|
|
1
|
-
/*! tailwindcss v3.
|
1
|
+
/*! tailwindcss v3.2.4 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.absolute{position:absolute}.my-10{margin-top:2.5rem;margin-bottom:2.5rem}.ml-4{margin-left:1rem}.mt-8{margin-top:2rem}.mr-1{margin-right:.25rem}.inline-block{display:inline-block}.flex{display:flex}.table{display:table}.h-16{height:4rem}.min-h-screen{min-height:100vh}.w-full{width:100%}.flex-1{flex:1 1 0%}.table-fixed{table-layout:fixed}.border-collapse{border-collapse:collapse}.list-disc{list-style-type:disc}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.rounded{border-radius:.25rem}.border{border-width:1px}.border-t{border-top-width:1px}.border-b{border-bottom-width:1px}.border-gray-400{--tw-border-opacity:1;border-color:rgb(156 163 175/var(--tw-border-opacity))}.border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-red-700{--tw-bg-opacity:1;background-color:rgb(185 28 28/var(--tw-bg-opacity))}.p-0{padding:0}.px-8{padding-left:2rem;padding-right:2rem}.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-8{padding-top:2rem;padding-bottom:2rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.pb-4{padding-bottom:1rem}.pt-2{padding-top:.5rem}.pl-8{padding-left:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.align-bottom{vertical-align:bottom}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-sm{font-size:.875rem;line-height:1.25rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-xs{font-size:.75rem;line-height:1rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-semibold{font-weight:600}.font-bold{font-weight:700}.uppercase{text-transform:uppercase}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity))}.no-underline{text-decoration-line:none}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:border-red-700\/50:disabled{border-color:#b91c1c80}.disabled\:text-red-700\/50:disabled{color:#b91c1c80}
|