Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RES 3.0 integration #1561

Draft
wants to merge 59 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
fcf53c3
Revert "Revert "PoC of double serialization prevention""
mostlyobvious Jan 30, 2023
2749fb2
Revert "Revert "Pick correct serializer when testing""
mostlyobvious Jan 30, 2023
d46f9e3
Revert "Revert "Less is more""
mostlyobvious Jan 30, 2023
71b22bb
Revert "Revert "Requirements for different column types""
mostlyobvious Jan 30, 2023
2d21505
Revert "Revert "We don't introduce anything new over Value here""
mostlyobvious Jan 30, 2023
a5319ae
Revert "Revert "Big :brain: time""
mostlyobvious Jan 30, 2023
4339cd1
Revert "Revert "Boom, get proposed type for column from AR and act""
mostlyobvious Jan 30, 2023
68cd8e1
Revert "Revert "Extract to variable""
mostlyobvious Jan 30, 2023
d3b9065
Revert "Revert "More meaningful naming""
mostlyobvious Jan 30, 2023
a5ef54f
Revert "Revert "No idea how to achieve the same in Rails < 6.1""
mostlyobvious Jan 30, 2023
1cedb83
Revert "Revert "Better describing what this test is for""
mostlyobvious Jan 30, 2023
5ec7afa
Revert "Revert "Document how to use json in RES 3.0""
mostlyobvious Jan 30, 2023
d0399e8
Revert "Revert "Raise ArgumentError when trying to publish nil as eve…
mostlyobvious Nov 29, 2022
3c2414f
Revert "Revert "Extract assertion to separate method and call it asap""
mostlyobvious Nov 29, 2022
fa5bb0e
Revert "Revert "Assert nil when linking events""
mostlyobvious Nov 29, 2022
8cffd22
Revert "Remove rename warning"
lukaszreszke Dec 8, 2022
55d674e
Revert "Kill mutants"
lukaszreszke Dec 8, 2022
1e39596
Revert "RailsEventStore 2.6.X should point to RailsEventStoreActiveRe…
lukaszreszke Dec 8, 2022
aefd664
Revert "Remove post install deprecation message for rails_event_store…
lukaszreszke Dec 8, 2022
5acd7df
Ensure only supported any usage by default
swistak35 Jul 26, 2021
81d7a47
No more aggregate root configuration
mpraglowski Jan 5, 2021
9bbac9b
Remove deprecated JSONMapper
mpraglowski Jan 5, 2021
42b477a
NullMapper no longer makes sense without serilizaion in mappers
mostlyobvious Jan 9, 2021
45552b4
EventClassRemapping superseded by upcasting
mostlyobvious Jan 9, 2021
d685cfb
No more aliases on RubyEventStore consts
mostlyobvious Jan 15, 2021
6880ad5
Get rid of dubious meta-apply method handlers
mostlyobvious Jan 9, 2021
165742d
Poor way to ensure with_strategy(->{ Default }) has OnDSL
mostlyobvious Jan 9, 2021
dd7a7b2
Refactor
mostlyobvious Jan 9, 2021
7df8857
Kill mutants
mostlyobvious Jan 9, 2021
9eab186
rails_event_store -> ruby_event_store
mostlyobvious Jan 15, 2021
3864da1
Rename to match passed arguments
mostlyobvious Jan 15, 2021
478b064
Rename to match instrumented methods and their arguments
mostlyobvious Jan 15, 2021
2cddc9e
Projections redesigned
mpraglowski Nov 27, 2022
e2040f3
Recreate EventClassRemapper in contrib/transformations
lukaszreszke Feb 6, 2023
f13b20a
Allow projection from one stream only
lukaszreszke Feb 6, 2023
2b4ce59
Factory method instead of constructor
lukaszreszke Feb 6, 2023
abd2110
Always include OnDSL in DefaultApplyStrategy
lukaszreszke Feb 8, 2023
c08316f
Rename WithDefaultApplyStrategy -> WithDefaultStrategy
lukaszreszke Feb 8, 2023
b35e97f
Custom strategy shouldn't rely on OnDSL
lukaszreszke Feb 8, 2023
1a5261f
Make DeafultApplyStrategy private
lukaszreszke Feb 8, 2023
1afa380
Simplify dispatcher
lukaszreszke Feb 7, 2023
756e021
Rename ImmediateAsyncDispatcher to ImmediateDispatcher
lukaszreszke Feb 7, 2023
935e4d0
Rename AfterCommitAsyncDispatcher to AfterCommitDispatcher
lukaszreszke Feb 7, 2023
c8bc3da
Rename Dispatcher to SyncScheduler
lukaszreszke Feb 8, 2023
d496844
Prefer lazy event store initialization
lukaszreszke Feb 8, 2023
67565f9
Namespace
lukaszreszke Feb 10, 2023
7831958
Remove ANONYMOUS_CLASS guard
lukaszreszke Feb 10, 2023
570e074
Remove anonymous class test from projection_spec
lukaszreszke Feb 10, 2023
8f33187
Using projection with event type defined by event's class
lukaszreszke Feb 13, 2023
1060cac
Add event resolver to projection
lukaszreszke Apr 12, 2023
e7e542b
kill mutant
lukaszreszke Apr 12, 2023
76a8cc2
Kill mutant
lukaszreszke Apr 12, 2023
4a0c022
Change test init for 2.7
lukaszreszke Apr 12, 2023
c0c44a5
Follow instrumentation event renames
mostlyobvious Sep 29, 2023
f5988d8
EventClassRemapper vibes
mostlyobvious Sep 29, 2023
d52040b
AggregateRoot unserscore handlers vibe
mostlyobvious Sep 29, 2023
c70019a
event_store_locator vibes
mostlyobvious Sep 29, 2023
7fb1478
rails_event_store_active_record is no more
mostlyobvious Sep 29, 2023
890dc78
Check whether metadata is transformed to binary
fidel Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Recreate EventClassRemapper in contrib/transformations
  • Loading branch information
lukaszreszke authored and mostlyobvious committed Sep 29, 2023
commit e2040f3929220182992b0c203a3420ce65efd463
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
require_relative "transformations/version"
require_relative "transformations/with_indifferent_access"
require_relative "transformations/identity_map"
require_relative "transformations/event_class_remapper"

module RubyEventStore
module Transformations
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: true

module RubyEventStore
module Transformations
class EventClassRemapper
def initialize(class_map)
@class_map = class_map
end

def dump(record)
record
end

def load(record)
Record.new(
event_id: record.event_id,
event_type: class_map[record.event_type] || record.event_type,
data: record.data,
metadata: record.metadata,
timestamp: record.timestamp,
valid_at: record.valid_at
)
end

private

attr_reader :class_map
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require "spec_helper"

module RubyEventStore
module Transformations
::RSpec.describe EventClassRemapper do
let(:time) { Time.now.utc }
let(:uuid) { SecureRandom.uuid }

def record(event_type: "TestEvent")
Record.new(
event_id: uuid,
metadata: {
some: "meta"
},
data: {
some: "value"
},
event_type: event_type,
timestamp: time,
valid_at: time
)
end

let(:changeable_record) { record(event_type: "EventNameBeforeRefactor") }
let(:changed_record) { record(event_type: "SomethingHappened") }
let(:class_map) { { "EventNameBeforeRefactor" => "SomethingHappened" } }

specify "#dump" do
expect(EventClassRemapper.new(class_map).dump(record)).to eq(record)
expect(EventClassRemapper.new(class_map).dump(record)).to eq(record)
end

specify "#load" do
expect(EventClassRemapper.new(class_map).load(record)).to eq(record)
expect(EventClassRemapper.new(class_map).load(changeable_record)).to eq(changed_record)
end
end
end
end