@nvent-addon/app 0.5.14 → 1.0.0-alpha.1

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.
Files changed (95) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +3 -2
  3. package/dist/runtime/app/components/DashboardCard.d.vue.ts +1 -1
  4. package/dist/runtime/app/components/DashboardCard.vue.d.ts +1 -1
  5. package/dist/runtime/app/composables/useWorkers.d.ts +57 -0
  6. package/dist/runtime/app/composables/useWorkers.js +42 -0
  7. package/dist/runtime/app/pages/dashboard.vue +1 -654
  8. package/dist/runtime/app/pages/index.vue +25 -41
  9. package/dist/runtime/app/pages/workers.vue +458 -0
  10. package/dist/runtime/server/api/_workers/index.get.d.ts +8 -0
  11. package/dist/runtime/server/api/_workers/index.get.js +14 -0
  12. package/package.json +12 -11
  13. package/dist/runtime/app/components/ComponentRouter.d.vue.ts +0 -46
  14. package/dist/runtime/app/components/ComponentRouter.vue +0 -26
  15. package/dist/runtime/app/components/ComponentRouter.vue.d.ts +0 -46
  16. package/dist/runtime/app/components/ComponentShell.d.vue.ts +0 -23
  17. package/dist/runtime/app/components/ComponentShell.vue +0 -97
  18. package/dist/runtime/app/components/ComponentShell.vue.d.ts +0 -23
  19. package/dist/runtime/app/components/ConfirmDialog.d.vue.ts +0 -33
  20. package/dist/runtime/app/components/ConfirmDialog.vue +0 -120
  21. package/dist/runtime/app/components/ConfirmDialog.vue.d.ts +0 -33
  22. package/dist/runtime/app/composables/useComponentRouter.d.ts +0 -46
  23. package/dist/runtime/app/composables/useComponentRouter.js +0 -248
  24. package/dist/runtime/app/pages/flows/[name].vue +0 -750
  25. package/dist/runtime/app/pages/flows/index.d.vue.ts +0 -3
  26. package/dist/runtime/app/pages/flows/index.vue +0 -381
  27. package/dist/runtime/app/pages/flows/index.vue.d.ts +0 -3
  28. package/dist/runtime/app/pages/queues/index.d.vue.ts +0 -3
  29. package/dist/runtime/app/pages/queues/index.vue +0 -236
  30. package/dist/runtime/app/pages/queues/index.vue.d.ts +0 -3
  31. package/dist/runtime/app/pages/queues/job.d.vue.ts +0 -3
  32. package/dist/runtime/app/pages/queues/job.vue +0 -261
  33. package/dist/runtime/app/pages/queues/job.vue.d.ts +0 -3
  34. package/dist/runtime/app/pages/queues/jobs.d.vue.ts +0 -3
  35. package/dist/runtime/app/pages/queues/jobs.vue +0 -595
  36. package/dist/runtime/app/pages/queues/jobs.vue.d.ts +0 -3
  37. package/dist/runtime/app/pages/settings/scheduler.d.vue.ts +0 -3
  38. package/dist/runtime/app/pages/settings/scheduler.vue +0 -310
  39. package/dist/runtime/app/pages/settings/scheduler.vue.d.ts +0 -3
  40. package/dist/runtime/app/pages/triggers/[name]/edit.d.vue.ts +0 -3
  41. package/dist/runtime/app/pages/triggers/[name]/edit.vue +0 -429
  42. package/dist/runtime/app/pages/triggers/[name]/edit.vue.d.ts +0 -3
  43. package/dist/runtime/app/pages/triggers/[name].d.vue.ts +0 -3
  44. package/dist/runtime/app/pages/triggers/[name].vue +0 -870
  45. package/dist/runtime/app/pages/triggers/[name].vue.d.ts +0 -3
  46. package/dist/runtime/app/pages/triggers/index.d.vue.ts +0 -3
  47. package/dist/runtime/app/pages/triggers/index.vue +0 -525
  48. package/dist/runtime/app/pages/triggers/index.vue.d.ts +0 -3
  49. package/dist/runtime/app/pages/triggers/new.d.vue.ts +0 -3
  50. package/dist/runtime/app/pages/triggers/new.vue +0 -610
  51. package/dist/runtime/app/pages/triggers/new.vue.d.ts +0 -3
  52. package/dist/runtime/server/api/_flows/[name]/clear-history.delete.d.ts +0 -10
  53. package/dist/runtime/server/api/_flows/[name]/clear-history.delete.js +0 -49
  54. package/dist/runtime/server/api/_flows/[name]/runs/[runId]/cancel.post.d.ts +0 -2
  55. package/dist/runtime/server/api/_flows/[name]/runs/[runId]/cancel.post.js +0 -21
  56. package/dist/runtime/server/api/_flows/[name]/runs/[runId]/restart.post.d.ts +0 -2
  57. package/dist/runtime/server/api/_flows/[name]/runs/[runId]/restart.post.js +0 -21
  58. package/dist/runtime/server/api/_flows/[name]/runs.get.d.ts +0 -17
  59. package/dist/runtime/server/api/_flows/[name]/runs.get.js +0 -64
  60. package/dist/runtime/server/api/_flows/[name]/start.post.d.ts +0 -2
  61. package/dist/runtime/server/api/_flows/[name]/start.post.js +0 -9
  62. package/dist/runtime/server/api/_flows/index.get.d.ts +0 -7
  63. package/dist/runtime/server/api/_flows/index.get.js +0 -5
  64. package/dist/runtime/server/api/_flows/recent-runs.get.d.ts +0 -15
  65. package/dist/runtime/server/api/_flows/recent-runs.get.js +0 -67
  66. package/dist/runtime/server/api/_flows/ws.d.ts +0 -80
  67. package/dist/runtime/server/api/_flows/ws.js +0 -309
  68. package/dist/runtime/server/api/_queues/[name]/job/[id].get.d.ts +0 -2
  69. package/dist/runtime/server/api/_queues/[name]/job/[id].get.js +0 -14
  70. package/dist/runtime/server/api/_queues/[name]/job/index.get.d.ts +0 -2
  71. package/dist/runtime/server/api/_queues/[name]/job/index.get.js +0 -39
  72. package/dist/runtime/server/api/_queues/index.get.d.ts +0 -2
  73. package/dist/runtime/server/api/_queues/index.get.js +0 -106
  74. package/dist/runtime/server/api/_queues/ws.d.ts +0 -48
  75. package/dist/runtime/server/api/_queues/ws.js +0 -215
  76. package/dist/runtime/server/api/_scheduler/jobs.get.d.ts +0 -19
  77. package/dist/runtime/server/api/_scheduler/jobs.get.js +0 -36
  78. package/dist/runtime/server/api/_triggers/[name]/events.get.d.ts +0 -6
  79. package/dist/runtime/server/api/_triggers/[name]/events.get.js +0 -43
  80. package/dist/runtime/server/api/_triggers/[name]/index.get.d.ts +0 -6
  81. package/dist/runtime/server/api/_triggers/[name]/index.get.js +0 -76
  82. package/dist/runtime/server/api/_triggers/[name].delete.d.ts +0 -7
  83. package/dist/runtime/server/api/_triggers/[name].delete.js +0 -37
  84. package/dist/runtime/server/api/_triggers/[name].patch.d.ts +0 -7
  85. package/dist/runtime/server/api/_triggers/[name].patch.js +0 -117
  86. package/dist/runtime/server/api/_triggers/index.get.d.ts +0 -6
  87. package/dist/runtime/server/api/_triggers/index.get.js +0 -44
  88. package/dist/runtime/server/api/_triggers/index.post.d.ts +0 -7
  89. package/dist/runtime/server/api/_triggers/index.post.js +0 -124
  90. package/dist/runtime/server/api/_triggers/stats.get.d.ts +0 -6
  91. package/dist/runtime/server/api/_triggers/stats.get.js +0 -41
  92. package/dist/runtime/server/api/_triggers/ws.d.ts +0 -74
  93. package/dist/runtime/server/api/_triggers/ws.js +0 -315
  94. /package/dist/runtime/app/pages/{flows/[name].d.vue.ts → workers.d.vue.ts} +0 -0
  95. /package/dist/runtime/app/pages/{flows/[name].vue.d.ts → workers.vue.d.ts} +0 -0
@@ -1,117 +0,0 @@
1
- import { defineEventHandler, getRouterParam, readBody, useTrigger } from "#imports";
2
- export default defineEventHandler(async (event) => {
3
- const logger = {
4
- info: console.log,
5
- error: console.error
6
- };
7
- const trigger = useTrigger();
8
- const name = getRouterParam(event, "name");
9
- if (!name) {
10
- return {
11
- error: "Missing trigger name",
12
- statusCode: 400
13
- };
14
- }
15
- try {
16
- const body = await readBody(event);
17
- logger.info("Updating trigger", {
18
- name,
19
- updates: Object.keys(body)
20
- });
21
- if (!trigger.hasTrigger(name)) {
22
- return {
23
- error: "Trigger not found",
24
- statusCode: 404
25
- };
26
- }
27
- const existing = trigger.getTrigger(name);
28
- if (!existing) {
29
- return {
30
- error: "Trigger not found",
31
- statusCode: 404
32
- };
33
- }
34
- const updateOpts = {
35
- name,
36
- type: existing.type,
37
- scope: existing.scope,
38
- status: body.status !== void 0 ? body.status : existing.status,
39
- displayName: body.displayName !== void 0 ? body.displayName : existing.displayName,
40
- description: body.description !== void 0 ? body.description : existing.description,
41
- source: existing.source
42
- };
43
- if (existing.type === "webhook" && body.config) {
44
- updateOpts.webhook = {
45
- path: body.config.path !== void 0 ? body.config.path : existing.webhook?.path,
46
- method: body.config.method !== void 0 ? body.config.method : existing.webhook?.method,
47
- auth: body.config.requireAuth ? {
48
- header: body.config.authHeader || existing.webhook?.auth?.header || "X-API-Key"
49
- } : void 0
50
- };
51
- } else if (existing.webhook) {
52
- updateOpts.webhook = existing.webhook;
53
- }
54
- if (existing.type === "schedule" && body.config) {
55
- updateOpts.schedule = {
56
- cron: body.config.cron !== void 0 ? body.config.cron : existing.schedule?.cron,
57
- timezone: body.config.timezone !== void 0 ? body.config.timezone : existing.schedule?.timezone
58
- };
59
- if (body.config.interval !== void 0 || existing.schedule?.interval !== void 0) {
60
- updateOpts.schedule.interval = body.config.interval !== void 0 ? body.config.interval : existing.schedule?.interval;
61
- }
62
- } else if (existing.schedule) {
63
- updateOpts.schedule = existing.schedule;
64
- }
65
- if (existing.type === "event" && body.config) {
66
- updateOpts.config = {
67
- event: body.config.event !== void 0 ? body.config.event : existing.config?.event,
68
- filter: body.config.filter !== void 0 ? body.config.filter ? JSON.parse(body.config.filter) : void 0 : existing.config?.filter
69
- };
70
- } else if (existing.config) {
71
- updateOpts.config = existing.config;
72
- }
73
- await trigger.registerTrigger(updateOpts);
74
- if (body.subscriptions !== void 0) {
75
- const currentSubs = trigger.getSubscribedFlows(name);
76
- const newSubs = Array.from(new Set(body.subscriptions));
77
- logger.info("Processing subscription changes", {
78
- trigger: name,
79
- currentSubs,
80
- newSubs,
81
- toRemove: currentSubs.filter((f) => !newSubs.includes(f)),
82
- toAdd: newSubs.filter((f) => !currentSubs.includes(f))
83
- });
84
- for (const flowName of currentSubs) {
85
- if (!newSubs.includes(flowName)) {
86
- logger.info(`Removing subscription: ${flowName} from ${name}`);
87
- await trigger.unsubscribeTrigger(name, flowName);
88
- }
89
- }
90
- for (const flowName of newSubs) {
91
- if (!currentSubs.includes(flowName)) {
92
- logger.info(`Adding new subscription: ${flowName} to ${name}`);
93
- await trigger.subscribeTrigger({
94
- trigger: name,
95
- flow: flowName,
96
- mode: "auto"
97
- });
98
- } else {
99
- logger.info(`Subscription already exists: ${flowName}, skipping`);
100
- }
101
- }
102
- }
103
- logger.info(`Successfully updated trigger '${name}'`);
104
- const updated = trigger.getTrigger(name);
105
- return {
106
- success: true,
107
- trigger: updated
108
- };
109
- } catch (err) {
110
- logger.error("Failed to update trigger", { error: err });
111
- return {
112
- error: "Failed to update trigger",
113
- message: err instanceof Error ? err.message : String(err),
114
- statusCode: 500
115
- };
116
- }
117
- });
@@ -1,6 +0,0 @@
1
- /**
2
- * Get all triggers with their subscriptions and stats
3
- * Returns comprehensive trigger data for the UI
4
- */
5
- declare const _default: any;
6
- export default _default;
@@ -1,44 +0,0 @@
1
- import { defineEventHandler, useTrigger } from "#imports";
2
- export default defineEventHandler(async () => {
3
- const { getAllTriggers, getSubscribedFlows, getTriggerStats } = useTrigger();
4
- const triggers = getAllTriggers({
5
- sortBy: "registeredAt",
6
- order: "desc"
7
- });
8
- const enhancedTriggers = await Promise.all(
9
- triggers.map(async (trigger) => {
10
- const subscribedFlows = getSubscribedFlows(trigger.name);
11
- const stats = await getTriggerStats(trigger.name);
12
- return {
13
- name: trigger.name,
14
- type: trigger.type,
15
- scope: trigger.scope,
16
- displayName: trigger.displayName,
17
- description: trigger.description,
18
- source: trigger.source,
19
- status: trigger.status || "active",
20
- registeredAt: trigger.registeredAt,
21
- lastActivityAt: trigger.lastActivityAt,
22
- webhook: trigger.webhook,
23
- schedule: trigger.schedule,
24
- config: trigger.config,
25
- subscribedFlows,
26
- subscriptionCount: subscribedFlows.length,
27
- stats: {
28
- totalFires: stats?.totalFires || 0,
29
- last24h: 0,
30
- // Not tracked yet in current implementation
31
- successCount: 0,
32
- // Not tracked yet
33
- failureCount: 0,
34
- // Not tracked yet
35
- activeSubscribers: stats?.activeSubscribers || subscribedFlows.length,
36
- successRate: 100,
37
- // Default since failures not tracked yet
38
- lastFiredAt: stats?.lastFiredAt
39
- }
40
- };
41
- })
42
- );
43
- return enhancedTriggers;
44
- });
@@ -1,7 +0,0 @@
1
- /**
2
- * POST /api/_triggers
3
- *
4
- * Register a new trigger with subscriptions
5
- */
6
- declare const _default: any;
7
- export default _default;
@@ -1,124 +0,0 @@
1
- import { defineEventHandler, readBody, useTrigger } from "#imports";
2
- export default defineEventHandler(async (event) => {
3
- const logger = {
4
- info: console.log,
5
- error: console.error
6
- };
7
- const trigger = useTrigger();
8
- try {
9
- const body = await readBody(event);
10
- if (!body.name) {
11
- return {
12
- error: "Missing required field: name",
13
- statusCode: 400
14
- };
15
- }
16
- if (!body.type) {
17
- return {
18
- error: "Missing required field: type",
19
- statusCode: 400
20
- };
21
- }
22
- if (!["event", "webhook", "schedule", "manual"].includes(body.type)) {
23
- return {
24
- error: "Invalid trigger type",
25
- statusCode: 400
26
- };
27
- }
28
- if (body.type === "event" && !body.config?.event) {
29
- return {
30
- error: "Event triggers require config.event",
31
- statusCode: 400
32
- };
33
- }
34
- if (body.type === "webhook" && !body.config?.path) {
35
- return {
36
- error: "Webhook triggers require config.path",
37
- statusCode: 400
38
- };
39
- }
40
- if (body.type === "schedule") {
41
- if (!body.config?.cron && !body.config?.interval) {
42
- return {
43
- error: "Schedule triggers require config.cron or config.interval",
44
- statusCode: 400
45
- };
46
- }
47
- }
48
- logger.info("Registering new trigger", {
49
- name: body.name,
50
- type: body.type,
51
- subscriptions: body.subscriptions?.length || 0
52
- });
53
- if (trigger.hasTrigger(body.name)) {
54
- return {
55
- error: "Trigger already exists",
56
- statusCode: 409
57
- };
58
- }
59
- const triggerOpts = {
60
- name: body.name,
61
- type: body.type,
62
- scope: body.scope || "flow",
63
- displayName: body.displayName || body.name,
64
- description: body.description,
65
- source: "ui"
66
- };
67
- if (body.type === "webhook") {
68
- triggerOpts.webhook = {
69
- path: body.config.path,
70
- method: body.config.method || "POST",
71
- auth: body.config.requireAuth ? {
72
- header: body.config.authHeader || "X-API-Key"
73
- } : void 0
74
- };
75
- } else if (body.type === "schedule") {
76
- triggerOpts.schedule = {
77
- cron: body.config.cron || void 0,
78
- interval: body.config.interval || void 0,
79
- timezone: body.config.timezone || "UTC"
80
- };
81
- if (body.config.runImmediately) {
82
- triggerOpts.config = { runImmediately: true };
83
- }
84
- } else if (body.type === "event") {
85
- triggerOpts.config = {
86
- event: body.config.event,
87
- filter: body.config.filter ? JSON.parse(body.config.filter) : void 0
88
- };
89
- }
90
- await trigger.registerTrigger(triggerOpts);
91
- if (body.subscriptions && body.subscriptions.length > 0) {
92
- for (const flowName of body.subscriptions) {
93
- await trigger.subscribeTrigger({
94
- trigger: body.name,
95
- flow: flowName,
96
- mode: "auto"
97
- });
98
- }
99
- }
100
- logger.info(
101
- `Successfully registered trigger '${body.name}' with ${body.subscriptions?.length || 0} subscriptions`
102
- );
103
- return {
104
- success: true,
105
- trigger: {
106
- name: body.name,
107
- displayName: body.displayName || body.name,
108
- type: body.type,
109
- scope: body.scope || "flow",
110
- config: body.config || {},
111
- subscriptions: body.subscriptions || [],
112
- status: "active",
113
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
114
- }
115
- };
116
- } catch (err) {
117
- logger.error("Failed to create trigger", { error: err });
118
- return {
119
- error: "Failed to create trigger",
120
- message: err instanceof Error ? err.message : String(err),
121
- statusCode: 500
122
- };
123
- }
124
- });
@@ -1,6 +0,0 @@
1
- /**
2
- * Get aggregate trigger statistics
3
- * Returns overview stats for the triggers page
4
- */
5
- declare const _default: any;
6
- export default _default;
@@ -1,41 +0,0 @@
1
- import { defineEventHandler, useTrigger } from "#imports";
2
- export default defineEventHandler(async () => {
3
- const { getAllTriggers, getAllSubscriptions } = useTrigger();
4
- const triggers = getAllTriggers();
5
- const subscriptions = getAllSubscriptions();
6
- const byType = triggers.reduce((acc, trigger) => {
7
- acc[trigger.type] = (acc[trigger.type] || 0) + 1;
8
- return acc;
9
- }, {});
10
- const byScope = triggers.reduce((acc, trigger) => {
11
- acc[trigger.scope] = (acc[trigger.scope] || 0) + 1;
12
- return acc;
13
- }, {});
14
- const byStatus = triggers.reduce((acc, trigger) => {
15
- const status = trigger.status || "active";
16
- acc[status] = (acc[status] || 0) + 1;
17
- return acc;
18
- }, {});
19
- const { getTriggerStats } = useTrigger();
20
- let totalFires = 0;
21
- for (const trigger of triggers) {
22
- const stats = await getTriggerStats(trigger.name);
23
- totalFires += stats?.totalFires || 0;
24
- }
25
- return {
26
- total: triggers.length,
27
- active: byStatus.active || 0,
28
- inactive: byStatus.inactive || 0,
29
- retired: byStatus.retired || 0,
30
- byType,
31
- byScope,
32
- byStatus,
33
- totalSubscriptions: subscriptions.length,
34
- totalFires,
35
- // Count triggers with active subscriptions
36
- withSubscribers: triggers.filter((t) => {
37
- const triggerSubs = subscriptions.filter((s) => s.triggerName === t.name);
38
- return triggerSubs.length > 0;
39
- }).length
40
- };
41
- });
@@ -1,74 +0,0 @@
1
- /**
2
- * WebSocket endpoint for trigger events
3
- * Supports subscribing to specific triggers and receiving real-time updates
4
- *
5
- * Message format (client -> server):
6
- * {
7
- * "type": "subscribe",
8
- * "triggerName": "user.created"
9
- * }
10
- *
11
- * {
12
- * "type": "unsubscribe",
13
- * "triggerName": "user.created"
14
- * }
15
- *
16
- * {
17
- * "type": "ping"
18
- * }
19
- *
20
- * {
21
- * "type": "subscribe.stats"
22
- * }
23
- *
24
- * {
25
- * "type": "unsubscribe.stats"
26
- * }
27
- *
28
- * Message format (server -> client):
29
- * {
30
- * "type": "event",
31
- * "triggerName": "user.created",
32
- * "event": { type: "...", data: {...}, timestamp: ... }
33
- * }
34
- *
35
- * {
36
- * "type": "history",
37
- * "triggerName": "user.created",
38
- * "events": [ ...historicalEvents ]
39
- * }
40
- *
41
- * {
42
- * "type": "subscribed",
43
- * "triggerName": "user.created"
44
- * }
45
- *
46
- * {
47
- * "type": "unsubscribed",
48
- * "triggerName": "user.created"
49
- * }
50
- *
51
- * {
52
- * "type": "trigger.stats.initial",
53
- * "data": { id: "triggerName", metadata: {...} },
54
- * "timestamp": 1234567890
55
- * }
56
- *
57
- * {
58
- * "type": "trigger.stats.update",
59
- * "data": { id: "triggerName", metadata: {...} },
60
- * "timestamp": 1234567890
61
- * }
62
- *
63
- * {
64
- * "type": "pong",
65
- * "timestamp": 1234567890
66
- * }
67
- *
68
- * {
69
- * "type": "error",
70
- * "message": "error description"
71
- * }
72
- */
73
- declare const _default: any;
74
- export default _default;