Closed mattbishop closed 1 year ago
Some questions about this task:
evently append
is the only command so far that's not namespaced. Is that what you want here? Personally I think the namespaces are a little ugly and I would completely get rid of them (for example evently list-entities
is better than evently registry:list-entities
).-s <eventid>
argument, does that refer to the event in the body? Or does is the -s
argument a boolean flag?{json event}
argument, does that go into data
? I thought the namespaces were required by oclif? I'm probably wrong about that. We should be consistent though. One good thing about name spacing is that it is easier to discover:
evently registry
will give back all the registry commands.
About the append flags, -s
is short for --selector
which is what append atomically expects. Maybe this should be more scoped, like:
evently append:atomic --selector fjgjtu58fjr4lg8kg5 '{"entity":"tennis","event":"Game Started","key":"Winter_classic-2023","meta":{},"data":{"players":["Matt","Evert"]}}'
evently append:fact '{"entity":"tennis","event":"Rain Started","key":"Winter_classic-2023","meta":{},"data":"heavy"}'
evently append:serial --previous 33jfngj64lflhefge3 '{"entity":"tennis","event":"Ball Returned","key":"Winter_classic-2023","meta":{},"data":{"player":"Matt"}'
This way one can get help with the specific append type.
On a side note, I don't expect people to be typing the append commands so much as using them to load data and develop. I can easily imagine a batch append command that loads a set of facts via the CLI in a script.
I defnitely agree consistency is good, so ill leave it up to you what you prefer. Personally testing the library i found it a bit annoying to need a level of nesting to discover commands while there are only handful.
But happy to stick to that format!
Two more thoughts:
The append types vend their schema with GET, so GET https://preview.evently.cloud/append/fact
returns the JSON schema for that append method. The other two atomic
and serial
work the same way. I don't have a mechanism for individual event schemas, but that's coming later.
JSON5 inputs sound great! I can see this is a great use case for integration tests that have comments and other things in the file. What do you think as a way to support it in the CLI? I am curious about adding this into the server itself too so one could specify JSON5 in the append and selector requests. This would be a good first step.
Ok, so what ill do is for appending is that I'll always download the json schema before submitting, so I can use AJV to validate the input.
Three ways to append an event:
The body of the command is the full event:
evently append -s <event-id> '{json event}'