Get list of unique Workflows and unique Activities

Hello all :wave:

Currently using Temporal’s TypeScript SDK to create a custom UI and was wondering if there is an API to get all unique workflow types and workflow activities?

I’ve seen a few APIs/methods like:

but they all seem like pretty expensive queries and for our use case I’m looking to get back a simple list of all unique values regardless of the workflow status

Example Scenario
I have a namespace that has 3 unique workflow types(Ex: WF_Type1, WF_Type2, WF_Type3) and each workflow type has their own unique list of activities (see below for example)

1. WF_Type1
    * activityA
    * activityB
2. WF_Type2
    * activityC
3. WF_Type3
    * activityD
    * activityE

Ideally, I would like to get back a list of all unique workflow types and workflow activities like below so I can make a dropdown list of all unique values in a custom UI

{
   workflowTypes: ["WF_Type1", "WF_Type2", "WF_Type3"],
   workflowActivities: [
      {
         workflowType: "WF_Type1", 
         workflowActivities: ["activityA", "activityB"], 
      },
      {
         workflowType: "WF_Type2", 
         workflowActivities: ["activityC"], 
      },
      {
         workflowType: "WF_Type3", 
         workflowActivities: ["activityD", "activityE"], 
      },
   ],
}

I don’t think that such api currently exists (registered workflow and activity types per worker and task queue). Since you create the workers you could expose this information in code, for example expose push to a custom rest api or write this info to custom persistence store.

1 Like

I have a similar use case but not sure how to do it.

Currently, I can trigger workflow by name, so I guess there is an internal registry for such information.

So the use case is like:

  • Get list of workflows that registered in Temporal
  • Trigger the workflow by name

If we maintain this via code, assuming NPM packages, this means there are two different sources of truth. Also for simplicity, I’m organizing worker and workflow together. Expose workflow via a different package seems a bit more work.