Skip to content

Commit

Permalink
snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
thantos committed Sep 13, 2023
1 parent 6d4af52 commit 786bb32
Showing 1 changed file with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ var CallKind;
CallKind2[CallKind2["ExpectSignalCall"] = 3] = "ExpectSignalCall";
CallKind2[CallKind2["GetExecutionCall"] = 14] = "GetExecutionCall";
CallKind2[CallKind2["InvokeTransactionCall"] = 9] = "InvokeTransactionCall";
CallKind2[CallKind2["QueueCall"] = 15] = "QueueCall";
CallKind2[CallKind2["SearchCall"] = 11] = "SearchCall";
CallKind2[CallKind2["SendSignalCall"] = 6] = "SendSignalCall";
CallKind2[CallKind2["SignalHandlerCall"] = 5] = "SignalHandlerCall";
CallKind2[CallKind2["SocketSendCall"] = 16] = "SocketSendCall";
CallKind2[CallKind2["StartWorkflowCall"] = 13] = "StartWorkflowCall";
CallKind2[CallKind2["TaskCall"] = 0] = "TaskCall";
CallKind2[CallKind2["TaskRequestCall"] = 12] = "TaskRequestCall";
CallKind2[CallKind2["SearchCall"] = 11] = "SearchCall";
CallKind2[CallKind2["StartWorkflowCall"] = 13] = "StartWorkflowCall";
CallKind2[CallKind2["QueueCall"] = 15] = "QueueCall";
})(CallKind || (CallKind = {}));
var Schedule = {
Expand Down Expand Up @@ -73,7 +74,8 @@ var PropertyKind;
PropertyKind2[PropertyKind2["ServiceSpec"] = 5] = "ServiceSpec";
PropertyKind2[PropertyKind2["ServiceType"] = 6] = "ServiceType";
PropertyKind2[PropertyKind2["ServiceUrl"] = 7] = "ServiceUrl";
PropertyKind2[PropertyKind2["TaskToken"] = 8] = "TaskToken";
PropertyKind2[PropertyKind2["SocketUrls"] = 8] = "SocketUrls";
PropertyKind2[PropertyKind2["TaskToken"] = 9] = "TaskToken";
})(PropertyKind || (PropertyKind = {}));
globalThis._eventual ??= { resources: {} };
Expand All @@ -96,6 +98,7 @@ var ServiceType;
ServiceType2["EntityStreamWorker"] = "EntityStreamWorker";
ServiceType2["OrchestratorWorker"] = "OrchestratorWorker";
ServiceType2["QueueHandlerWorker"] = "QueueHandlerWorker";
ServiceType2["SocketWorker"] = "SocketWorker";
ServiceType2["Subscription"] = "Subscription";
ServiceType2["TaskWorker"] = "TaskWorker";
ServiceType2["TransactionWorker"] = "TransactionWorker";
Expand Down Expand Up @@ -130,8 +133,12 @@ function e({ base: t = "", routes: n = [] } = {}) {
}
var itty_router_min_default = { Router: e };
function parseArgs(args, predicates) {
return Object.fromEntries(Object.entries(predicates).map(([name, predicate]) => [name, args.find(predicate)]));
}
function command(...args) {
const [sourceLocation, name, options, handler] = parseCommandArgs(args);
const { sourceLocation, name, options, handler } = parseCommandArgs(args);
const command2 = {
kind: "Command",
name,
Expand All @@ -143,12 +150,12 @@ function command(...args) {
return registerEventualResource("Command", command2);
}
function parseCommandArgs(args) {
return [
args.find(isSourceLocation),
args.find((a) => typeof a === "string"),
args.find((a) => typeof a === "object" && !isSourceLocation(a)),
args.find((a) => typeof a === "function")
];
return parseArgs(args, {
sourceLocation: isSourceLocation,
name: (a) => typeof a === "string",
options: (a) => typeof a === "object" && !isSourceLocation(a),
handler: (a) => typeof a === "function"
});
}
var router = itty_router_min_default.Router();
Expand All @@ -162,7 +169,7 @@ function createRouter(middlewares) {
return (middleware) => createRouter([...middlewares ?? [], middleware]);
} else if (method === "command") {
return (...args) => {
const [sourceLocation, name, options, handler] = parseCommandArgs(args);
const { sourceLocation, name, options, handler } = parseCommandArgs(args);
return command(sourceLocation, name, {
...options ?? {},
middlewares
Expand Down

0 comments on commit 786bb32

Please sign in to comment.