@stack-spot/portal-network 0.122.0 → 0.123.0

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.
@@ -14,49 +14,39 @@ const oazapfts = Oazapfts.runtime(defaults);
14
14
  export const servers = {
15
15
  generatedServerUrl: "https://account-notification-engine.dev.stackspot.com"
16
16
  };
17
- export type NotificationContentResponse = {
17
+ export type NotificationContentRequest = {
18
+ /** User friendly title for the notification */
18
19
  title: string;
20
+ /** User friendly description for the notification (allows the use of markdown) */
19
21
  description: string;
20
22
  };
21
- export type GetTenantNotificationsResponse = {
22
- id: string;
23
- content: {
24
- [key: string]: NotificationContentResponse;
25
- };
26
- broadcast_level: "ACCOUNT" | "INDIVIDUAL" | "PLATFORM" | "RESOURCE";
27
- context: "ACCOUNT" | "STUDIO" | "WORKSPACE" | "AI";
28
- target?: string;
29
- criticality: "LOW" | "MEDIUM" | "HIGH";
30
- call_to_action: string;
31
- persistent: boolean;
32
- committed: boolean;
33
- last_until?: string;
34
- trigger_at: string;
35
- created_at?: string;
36
- is_banner: boolean;
23
+ export type NotificationTargetBase = {
24
+ "type": string;
37
25
  };
38
- export type PagingResponseModelGetTenantNotificationsResponse = {
39
- items: GetTenantNotificationsResponse[];
40
- size: number;
41
- total_elements: number;
26
+ export type AccountValue = {
27
+ "type": "AccountValue";
28
+ } & NotificationTargetBase & {
29
+ value?: string;
42
30
  };
43
- export type ErrorDetails = {
44
- code: "INTEGRATION_EXCEPTION" | "INVALID_TENANT" | "VALIDATION_ERROR" | "MANDATORY_FIELD_NOT_INFORMED" | "INVALID_REQUEST" | "NOTIFICATION_NOT_FOUND" | "INVALID_FIELD" | "MISSING_TOKEN";
45
- field?: string;
46
- details?: string;
47
- values?: string[];
31
+ export type Attribute = {
32
+ key: string;
33
+ value: string;
48
34
  };
49
- export type ApiErrorResponse = {
50
- code?: "INTEGRATION_EXCEPTION" | "INVALID_TENANT" | "VALIDATION_ERROR" | "MANDATORY_FIELD_NOT_INFORMED" | "INVALID_REQUEST" | "NOTIFICATION_NOT_FOUND" | "INVALID_FIELD" | "MISSING_TOKEN";
51
- status: number;
52
- message: string;
53
- details?: ErrorDetails[];
35
+ export type Value = {
36
+ attribute?: Attribute;
37
+ resourceType: string;
38
+ resourceSlug: string;
39
+ action: string;
54
40
  };
55
- export type NotificationContentRequest = {
56
- /** User friendly title for the notification */
57
- title: string;
58
- /** User friendly description for the notification (allows the use of markdown) */
59
- description: string;
41
+ export type ResourceValue = {
42
+ "type": "ResourceValue";
43
+ } & NotificationTargetBase & {
44
+ value?: Value;
45
+ };
46
+ export type UsersValue = {
47
+ "type": "UsersValue";
48
+ } & NotificationTargetBase & {
49
+ value?: string[];
60
50
  };
61
51
  export type CreateTenantNotificationRequest = {
62
52
  /** Map of language codes to notification content. Each entry represents the content of the notification in a specific language. */
@@ -65,86 +55,95 @@ export type CreateTenantNotificationRequest = {
65
55
  };
66
56
  /** Level of broadcasting to the notification. */
67
57
  broadcast_level: "ACCOUNT" | "INDIVIDUAL" | "PLATFORM" | "RESOURCE" | "ACCOUNT" | "INDIVIDUAL" | "RESOURCE";
68
- /** The target of the notification, user id for 'individual', resource id for 'resource', leave empty for any other */
69
- target: string;
58
+ target: AccountValue | ResourceValue | UsersValue;
70
59
  /** Criticality of the notification. */
71
- criticality: "LOW" | "MEDIUM" | "HIGH" | "LOW" | "MEDIUM" | "HIGH";
60
+ criticality?: "LOW" | "MEDIUM" | "HIGH" | "LOW" | "MEDIUM" | "HIGH";
72
61
  /** Which context to publish the notification */
73
62
  context: "ACCOUNT" | "STUDIO" | "WORKSPACE" | "AI" | "Account" | "Studio" | "Workspace";
74
63
  /** Possible redirect link for the notification button. */
75
64
  call_to_action: string;
76
65
  /** If the notification should be re-consumed until 'last_until' is reached. */
77
- persistent: boolean;
66
+ persistent?: boolean;
78
67
  /** UTC formatted timestamp to when the notification should finally end, if the persistent is set to true. */
79
68
  last_until?: string;
80
69
  /** UTC formatted timestamp for when to triggers the notification. */
81
70
  trigger_at: string;
71
+ /** Notification channel audience. Determines which platform will receive the notification. */
72
+ audience?: "AI" | "EDP" | "ACCOUNT" | "ACCOUNT" | "AI" | "EDP";
73
+ };
74
+ export type ErrorDetails = {
75
+ code: "INTEGRATION_EXCEPTION" | "INVALID_TENANT" | "VALIDATION_ERROR" | "MANDATORY_FIELD_NOT_INFORMED" | "INVALID_REQUEST" | "NOTIFICATION_NOT_FOUND" | "INVALID_FIELD" | "MISSING_TOKEN";
76
+ field?: string;
77
+ details?: string;
78
+ values?: string[];
79
+ };
80
+ export type ApiErrorResponse = {
81
+ code?: "INTEGRATION_EXCEPTION" | "INVALID_TENANT" | "VALIDATION_ERROR" | "MANDATORY_FIELD_NOT_INFORMED" | "INVALID_REQUEST" | "NOTIFICATION_NOT_FOUND" | "INVALID_FIELD" | "MISSING_TOKEN";
82
+ status: number;
83
+ message: string;
84
+ details?: ErrorDetails[];
82
85
  };
83
86
  export type CreatePlatformNotificationRequest = {
84
87
  /** Map of language codes to notification content. Each entry represents the content of the notification in a specific language. */
85
88
  content: {
86
89
  [key: string]: NotificationContentRequest;
87
90
  };
91
+ target?: ResourceValue;
88
92
  /** Criticality of the notification. */
89
- criticality: "LOW" | "MEDIUM" | "HIGH" | "LOW" | "MEDIUM" | "HIGH";
93
+ criticality?: "LOW" | "MEDIUM" | "HIGH" | "LOW" | "MEDIUM" | "HIGH";
90
94
  /** Which context to publish the notification */
91
95
  context: "ACCOUNT" | "STUDIO" | "WORKSPACE" | "AI" | "Account" | "Studio" | "Workspace";
92
96
  /** Possible redirect link for the notification button. */
93
97
  call_to_action: string;
94
98
  /** If the notification should be re-consumed until last_until is reached. */
95
- persistent: boolean;
99
+ persistent?: boolean;
96
100
  /** UTC formatted timestamp to when the notification should finally ended if the persistent is set to true. */
97
101
  last_until?: string;
98
102
  /** UTC formatted timestamp for when to triggers the notification. */
99
103
  trigger_at: string;
100
104
  /** If the notification should be shown as banner. */
101
- is_banner: boolean;
105
+ is_banner?: boolean;
106
+ /** Notification channel audience. Determines which platform will receive the notification. */
107
+ audience?: "AI" | "EDP" | "ACCOUNT" | "ACCOUNT" | "AI" | "EDP";
102
108
  };
103
109
  export type CreatePlatformNotificationResponse = {
110
+ intentId: string;
111
+ };
112
+ export type NotificationContentResponse = {
113
+ title: string;
114
+ description: string;
115
+ };
116
+ export type GetTenantNotificationsResponse = {
104
117
  id: string;
118
+ content: {
119
+ [key: string]: NotificationContentResponse;
120
+ };
121
+ broadcast_level: "ACCOUNT" | "INDIVIDUAL" | "PLATFORM" | "RESOURCE";
122
+ context: "ACCOUNT" | "STUDIO" | "WORKSPACE" | "AI";
123
+ criticality: "LOW" | "MEDIUM" | "HIGH";
124
+ call_to_action: string;
125
+ persistent: boolean;
126
+ committed: boolean;
127
+ last_until?: string;
128
+ trigger_at: string;
129
+ created_at?: string;
130
+ is_banner: boolean;
131
+ audience?: "AI" | "EDP" | "ACCOUNT";
132
+ };
133
+ export type PagingResponseModelGetTenantNotificationsResponse = {
134
+ items: GetTenantNotificationsResponse[];
135
+ size: number;
136
+ total_elements: number;
105
137
  };
106
138
  export type GetCommittedNotificationsResponse = {
107
139
  /** If there are uncommitted notifications for the user */
108
140
  uncommitted_messages: boolean;
109
141
  };
110
- /**
111
- * Get notifications for tenant
112
- */
113
- export function findAll1({ size, page, createdSince, context, criticality, content, committed, tenantId }: {
114
- size?: number;
115
- page?: number;
116
- createdSince?: number;
117
- context?: "ACCOUNT" | "STUDIO" | "WORKSPACE" | "AI";
118
- criticality?: "LOW" | "MEDIUM" | "HIGH";
119
- content?: string;
120
- committed?: boolean;
121
- tenantId: string;
122
- }, opts?: Oazapfts.RequestOpts) {
123
- return oazapfts.ok(oazapfts.fetchJson<{
124
- status: 200;
125
- data: PagingResponseModelGetTenantNotificationsResponse;
126
- } | {
127
- status: 403;
128
- data: ApiErrorResponse;
129
- } | {
130
- status: 500;
131
- data: ApiErrorResponse;
132
- }>(`/v1/tenants/${encodeURIComponent(tenantId)}/notifications${QS.query(QS.explode({
133
- size,
134
- page,
135
- createdSince,
136
- context,
137
- criticality,
138
- content,
139
- committed
140
- }))}`, {
141
- ...opts
142
- }));
143
- }
144
142
  /**
145
143
  * Generate a new notification intent to the specified tenant
146
144
  */
147
- export function create({ tenantId, createTenantNotificationRequest }: {
145
+ export function create({ dryRun, tenantId, createTenantNotificationRequest }: {
146
+ dryRun?: boolean;
148
147
  tenantId: string;
149
148
  createTenantNotificationRequest: CreateTenantNotificationRequest;
150
149
  }, opts?: Oazapfts.RequestOpts) {
@@ -157,7 +156,9 @@ export function create({ tenantId, createTenantNotificationRequest }: {
157
156
  } | {
158
157
  status: 500;
159
158
  data: ApiErrorResponse;
160
- }>(`/v1/tenants/${encodeURIComponent(tenantId)}/notifications`, oazapfts.json({
159
+ }>(`/v1/tenants/${encodeURIComponent(tenantId)}/notifications${QS.query(QS.explode({
160
+ dryRun
161
+ }))}`, oazapfts.json({
161
162
  ...opts,
162
163
  method: "POST",
163
164
  body: createTenantNotificationRequest
@@ -201,7 +202,7 @@ export function create1({ createPlatformNotificationRequest }: {
201
202
  /**
202
203
  * Get notifications for tenant
203
204
  */
204
- export function findAll({ size, page, createdSince, context, criticality, content, committed, isBanner, tenantId }: {
205
+ export function findAll({ size, page, createdSince, context, criticality, content, committed, isBanner, audience, tenantId }: {
205
206
  size?: number;
206
207
  page?: number;
207
208
  createdSince?: number;
@@ -210,6 +211,7 @@ export function findAll({ size, page, createdSince, context, criticality, conten
210
211
  content?: string;
211
212
  committed?: boolean;
212
213
  isBanner?: boolean;
214
+ audience?: "AI" | "EDP" | "ACCOUNT";
213
215
  tenantId: string;
214
216
  }, opts?: Oazapfts.RequestOpts) {
215
217
  return oazapfts.ok(oazapfts.fetchJson<{
@@ -229,7 +231,8 @@ export function findAll({ size, page, createdSince, context, criticality, conten
229
231
  criticality,
230
232
  content,
231
233
  committed,
232
- isBanner
234
+ isBanner,
235
+ audience
233
236
  }))}`, {
234
237
  ...opts
235
238
  }));
@@ -276,10 +279,10 @@ export function getHealthz(opts?: Oazapfts.RequestOpts) {
276
279
  }));
277
280
  }
278
281
  /**
279
- * Delete notification by id
282
+ * Delete notification by intent id
280
283
  */
281
- export function deleteV1TenantsByTenantIdNotificationsAndNotificationId({ notificationId, tenantId }: {
282
- notificationId: string;
284
+ export function deleteV1TenantsByTenantIdNotificationsAndNotificationIntentId({ notificationIntentId, tenantId }: {
285
+ notificationIntentId: string;
283
286
  tenantId: string;
284
287
  }, opts?: Oazapfts.RequestOpts) {
285
288
  return oazapfts.ok(oazapfts.fetchJson<{
@@ -290,7 +293,7 @@ export function deleteV1TenantsByTenantIdNotificationsAndNotificationId({ notifi
290
293
  } | {
291
294
  status: 500;
292
295
  data: ApiErrorResponse;
293
- }>(`/v1/tenants/${encodeURIComponent(tenantId)}/notifications/${encodeURIComponent(notificationId)}`, {
296
+ }>(`/v1/tenants/${encodeURIComponent(tenantId)}/notifications/${encodeURIComponent(notificationIntentId)}`, {
294
297
  ...opts,
295
298
  method: "DELETE"
296
299
  }));
@@ -318,10 +321,10 @@ export function uncommit({ notificationId, tenantId }: {
318
321
  /**
319
322
  * Batches deletes the notification in all tenants
320
323
  */
321
- export function delete1({ notificationId }: {
322
- notificationId: string;
324
+ export function delete1({ notificationIntentId }: {
325
+ notificationIntentId: string;
323
326
  }, opts?: Oazapfts.RequestOpts) {
324
- return oazapfts.ok(oazapfts.fetchText(`/v1/notifications/${encodeURIComponent(notificationId)}`, {
327
+ return oazapfts.ok(oazapfts.fetchText(`/v1/notifications/${encodeURIComponent(notificationIntentId)}`, {
325
328
  ...opts,
326
329
  method: "DELETE"
327
330
  }));
@@ -30,6 +30,7 @@ import {
30
30
  getAvailableActionVersionsByActionSlug,
31
31
  getAvailableWorkflowVersionsByWorkflowSlug,
32
32
  getDependentPluginsVersions,
33
+ getDependentWorkflowVersions,
33
34
  getGetPluginView,
34
35
  getInfrastructureEnvironmentsUsesPlugin,
35
36
  getListOfInputs,
@@ -41,6 +42,7 @@ import {
41
42
  getPluginVersionUsageSummary,
42
43
  getStackBySlugV2,
43
44
  getStackUsesPlugin,
45
+ getStackUsesWorkflow,
44
46
  getStackVersionById,
45
47
  getStackVersionListByIds,
46
48
  getStackWorkspaceDetailView,
@@ -56,7 +58,12 @@ import {
56
58
  getWorkflow,
57
59
  getWorkflowByStudioSlug,
58
60
  getWorkflowDoc,
61
+ getWorkflowPluginUsage,
62
+ getWorkflowStackUsage,
63
+ getWorkflowsUsingPlugin,
64
+ getWorkflowUsageOfWorkflow,
59
65
  getWorkflowUsageSummary,
66
+ getWorkflowVersionsNotInUse,
60
67
  getWorkflowVersionUsageSummary,
61
68
  listAccountWorkflow,
62
69
  listActions,
@@ -208,6 +215,33 @@ class ContentClient extends ReactQueryNetworkClient {
208
215
  return lastPage.content && lastPage.content.length < size ? undefined : { page: parsedLastPageParam + 1 }
209
216
  },
210
217
  })
218
+
219
+ /**
220
+ * Gets list of Stacks using the workflow.
221
+ */
222
+ stacksUsesWorkflow = this.query(getStackUsesWorkflow)
223
+
224
+ /**
225
+ * Get list of workflow by stack.
226
+ */
227
+ workflowsFromStackUsage = this.query(getWorkflowStackUsage)
228
+
229
+ /**
230
+ * Gets list of workflow versions not used by any Content.
231
+ *
232
+ */
233
+ workflowVersionsNotInUse = this.query(getWorkflowVersionsNotInUse)
234
+
235
+ /**
236
+ * Gets list of workflow that are used by a specific workflow.
237
+ */
238
+ workflowsUsageOfWorkflow = this.query(getWorkflowUsageOfWorkflow)
239
+
240
+ /**
241
+ * Gets list of workflow versions that are used by a specific workflow.
242
+ */
243
+ workflowVersionsUsedByWorkflow = this.query(getDependentWorkflowVersions)
244
+
211
245
  /**
212
246
  * Gets all account workflows
213
247
  */
@@ -260,6 +294,12 @@ class ContentClient extends ReactQueryNetworkClient {
260
294
  * Get usage summary of plugin
261
295
  */
262
296
  pluginUsageSummary = this.query(getPluginModalView)
297
+
298
+ /**
299
+ * Gets list of Workflow versions using the plugin
300
+ */
301
+ workflowVersionsPluginUsage = this.query(getWorkflowPluginUsage)
302
+
263
303
  /**
264
304
  * Gets list of Stacks using the plugin
265
305
  */
@@ -296,6 +336,10 @@ class ContentClient extends ReactQueryNetworkClient {
296
336
  * Gets list of Application using the plugin
297
337
  */
298
338
  applicationUsingPlugin = this.query(getApplicationsUsesPlugin)
339
+ /**
340
+ * Gets list of workflow using the plugin
341
+ */
342
+ workflowsUsingPlugin = this.query(getWorkflowsUsingPlugin)
299
343
  /**
300
344
  * Gets list of PluginVersions used by Applications
301
345
  */