-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document Tracker Notification workflow - skeletton + activity logic
- Loading branch information
Showing
14 changed files
with
412 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
npx tsx temporal/document_tracker/admin/cli.ts "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import parseArgs from "minimist"; | ||
|
||
import { | ||
launchTrackerNotificationWorkflow, | ||
stopTrackerNotificationWorkflow, | ||
} from "@app/temporal/document_tracker/client"; | ||
|
||
const main = async () => { | ||
const argv = parseArgs(process.argv.slice(2)); | ||
|
||
const [command] = argv._; | ||
|
||
console.log(`Running command: ${command}`); | ||
|
||
switch (command) { | ||
case "start": | ||
await launchTrackerNotificationWorkflow(); | ||
return; | ||
case "stop": | ||
await stopTrackerNotificationWorkflow(); | ||
return; | ||
case "notify": | ||
const workspaceId = argv.workspaceId; | ||
const trackerId = argv.trackerId; | ||
if (!workspaceId || !trackerId) { | ||
console.error("workspaceId and trackerId are required"); | ||
return; | ||
} | ||
await launchTrackerNotificationWorkflow([ | ||
{ | ||
workspaceId, | ||
trackerId, | ||
}, | ||
]); | ||
return; | ||
default: | ||
return; | ||
} | ||
}; | ||
|
||
main() | ||
.then(() => { | ||
console.error("\x1b[32m%s\x1b[0m", `Done`); | ||
process.exit(0); | ||
}) | ||
.catch((err) => { | ||
console.error("\x1b[31m%s\x1b[0m", `Error: ${err.message}`); | ||
console.log(err); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.