@prefecthq/prefect-ui-library 2.10.3 → 2.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prefecthq/prefect-ui-library",
3
- "version": "2.10.3",
3
+ "version": "2.10.4",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -58,6 +58,24 @@ Flow run URL: {{ flow_run|ui_url }}
58
58
  State message: {{ flow_run.state.message }}
59
59
  `.trim()
60
60
 
61
+ const NOTIFICATION_BODY_CUSTOM = `
62
+ Automation: {{ automation.name }}
63
+ Description: {{ automation.description }}
64
+
65
+ Event: {{ event.id }}
66
+ Resource:
67
+ {% for label, value in event.resource %}
68
+ {{ label }}: {{ value }}
69
+ {% endfor %}
70
+ Related Resources:
71
+ {% for related in event.related %}
72
+ Role: {{ related.role }}
73
+ {% for label, value in related %}
74
+ {{ label }}: {{ value }}
75
+ {% endfor %}
76
+ {% endfor %}
77
+ `.trim()
78
+
61
79
  export function getDefaultNotificationBody(template: AutomationTriggerTemplate): string {
62
80
  switch (template) {
63
81
  case 'deployment-status':
@@ -68,8 +86,11 @@ export function getDefaultNotificationBody(template: AutomationTriggerTemplate):
68
86
  return NOTIFICATION_BODY_WORK_POOL_STATUS
69
87
  case 'work-queue-status':
70
88
  return NOTIFICATION_BODY_WORK_QUEUE_STATUS
89
+ case 'custom':
90
+ return NOTIFICATION_BODY_CUSTOM
71
91
  default:
72
- throw new Error(`Default notification body missing for template type: ${template}`)
92
+ const exhaustiveCheck: never = template
93
+ throw new Error(`Default notification body missing for template type: ${exhaustiveCheck}`)
73
94
  }
74
95
  }
75
96
 
@@ -83,7 +104,10 @@ export function getDefaultNotificationSubject(template: AutomationTriggerTemplat
83
104
  return 'Prefect work pool \'{{ work_pool.name }}\' has entered status \'{{ work_pool.status }}\''
84
105
  case 'work-queue-status':
85
106
  return 'Prefect work queue \'{{ work_queue.name }}\' has entered status \'{{ work_queue.status }}\''
107
+ case 'custom':
108
+ return 'A Prefect automation \'{{ automation.name }}\' was triggered'
86
109
  default:
87
- throw new Error(`Default notification subject missing for template type: ${template}`)
110
+ const exchaustiveCheck: never = template
111
+ throw new Error(`Default notification subject missing for template type: ${exchaustiveCheck}`)
88
112
  }
89
113
  }