@hookbase/cli 1.0.3 → 2.0.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.
- package/dist/commands/api-keys.d.ts.map +1 -1
- package/dist/commands/api-keys.js +7 -2
- package/dist/commands/api-keys.js.map +1 -1
- package/dist/commands/applications.d.ts.map +1 -1
- package/dist/commands/applications.js +6 -1
- package/dist/commands/applications.js.map +1 -1
- package/dist/commands/cron-groups.d.ts.map +1 -1
- package/dist/commands/cron-groups.js +6 -1
- package/dist/commands/cron-groups.js.map +1 -1
- package/dist/commands/cron.d.ts.map +1 -1
- package/dist/commands/cron.js +6 -1
- package/dist/commands/cron.js.map +1 -1
- package/dist/commands/deliveries.d.ts.map +1 -1
- package/dist/commands/deliveries.js +6 -1
- package/dist/commands/deliveries.js.map +1 -1
- package/dist/commands/destinations.d.ts.map +1 -1
- package/dist/commands/destinations.js +6 -1
- package/dist/commands/destinations.js.map +1 -1
- package/dist/commands/endpoints.d.ts.map +1 -1
- package/dist/commands/endpoints.js +6 -1
- package/dist/commands/endpoints.js.map +1 -1
- package/dist/commands/events.d.ts.map +1 -1
- package/dist/commands/events.js +7 -7
- package/dist/commands/events.js.map +1 -1
- package/dist/commands/groups/inbound.d.ts.map +1 -1
- package/dist/commands/groups/inbound.js +3 -0
- package/dist/commands/groups/inbound.js.map +1 -1
- package/dist/commands/groups/tools.js +1 -1
- package/dist/commands/groups/tools.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +5 -0
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/outbound.d.ts.map +1 -1
- package/dist/commands/outbound.js +6 -1
- package/dist/commands/outbound.js.map +1 -1
- package/dist/commands/routes.d.ts.map +1 -1
- package/dist/commands/routes.js +6 -1
- package/dist/commands/routes.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +6 -1
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/sources.d.ts +2 -0
- package/dist/commands/sources.d.ts.map +1 -1
- package/dist/commands/sources.js +18 -3
- package/dist/commands/sources.js.map +1 -1
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +12 -7
- package/dist/commands/tunnel.js.map +1 -1
- package/dist/commands/tunnels.d.ts.map +1 -1
- package/dist/commands/tunnels.js +6 -6
- package/dist/commands/tunnels.js.map +1 -1
- package/dist/lib/api.d.ts +26 -22
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +100 -347
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/config.d.ts +4 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +9 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/tui/App.js +1 -1
- package/dist/tui/views/Analytics.d.ts.map +1 -1
- package/dist/tui/views/Analytics.js +19 -1
- package/dist/tui/views/Analytics.js.map +1 -1
- package/dist/tui/views/Cron.d.ts.map +1 -1
- package/dist/tui/views/Cron.js +8 -6
- package/dist/tui/views/Cron.js.map +1 -1
- package/dist/tui/views/Events.d.ts.map +1 -1
- package/dist/tui/views/Events.js +2 -1
- package/dist/tui/views/Events.js.map +1 -1
- package/dist/tui/views/Sources.d.ts.map +1 -1
- package/dist/tui/views/Sources.js +131 -7
- package/dist/tui/views/Sources.js.map +1 -1
- package/package.json +1 -1
package/dist/lib/api.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { getApiUrl, getAuthToken
|
|
1
|
+
import { getApiUrl, getAuthToken } from './config.js';
|
|
2
2
|
async function request(method, path, body) {
|
|
3
3
|
const apiUrl = getApiUrl();
|
|
4
4
|
const token = getAuthToken();
|
|
5
|
+
if (!token || !token.startsWith('whr_')) {
|
|
6
|
+
return {
|
|
7
|
+
error: 'Not authenticated. Run "hookbase login" with a valid API key (whr_...).',
|
|
8
|
+
status: 0,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
5
11
|
const headers = {
|
|
6
12
|
'Content-Type': 'application/json',
|
|
13
|
+
'Authorization': `Bearer ${token}`,
|
|
7
14
|
};
|
|
8
|
-
if (token) {
|
|
9
|
-
headers['Authorization'] = `Bearer ${token}`;
|
|
10
|
-
}
|
|
11
15
|
try {
|
|
12
16
|
const response = await fetch(`${apiUrl}${path}`, {
|
|
13
17
|
method,
|
|
@@ -16,8 +20,12 @@ async function request(method, path, body) {
|
|
|
16
20
|
});
|
|
17
21
|
const data = await response.json();
|
|
18
22
|
if (!response.ok) {
|
|
23
|
+
let errorMsg = data.error || data.message || 'Request failed';
|
|
24
|
+
if (data.details) {
|
|
25
|
+
errorMsg += ` - ${JSON.stringify(data.details)}`;
|
|
26
|
+
}
|
|
19
27
|
return {
|
|
20
|
-
error:
|
|
28
|
+
error: errorMsg,
|
|
21
29
|
status: response.status,
|
|
22
30
|
};
|
|
23
31
|
}
|
|
@@ -30,11 +38,6 @@ async function request(method, path, body) {
|
|
|
30
38
|
};
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
|
-
// Helper to ensure org is selected
|
|
34
|
-
function requireOrg() {
|
|
35
|
-
const org = getCurrentOrg();
|
|
36
|
-
return org;
|
|
37
|
-
}
|
|
38
41
|
export async function verifyApiKey(apiKey) {
|
|
39
42
|
const apiUrl = getApiUrl();
|
|
40
43
|
try {
|
|
@@ -68,100 +71,66 @@ export async function getOrganization(orgId) {
|
|
|
68
71
|
return request('GET', `/api/organizations/${orgId}`);
|
|
69
72
|
}
|
|
70
73
|
export async function listApiKeys() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return request('
|
|
75
|
-
}
|
|
76
|
-
export async function createApiKey(name, scopes = ['read', 'write'], expiresInDays) {
|
|
77
|
-
const org = requireOrg();
|
|
78
|
-
if (!org)
|
|
79
|
-
return { error: 'No organization selected', status: 0 };
|
|
80
|
-
return request('POST', `/api/organizations/${org.id}/api-keys`, {
|
|
74
|
+
return request('GET', `/api/api-keys`);
|
|
75
|
+
}
|
|
76
|
+
export async function createApiKey(name, scopes = ['read', 'write', 'delete'], expiresInDays) {
|
|
77
|
+
return request('POST', `/api/api-keys`, {
|
|
81
78
|
name,
|
|
82
79
|
scopes,
|
|
83
80
|
expiresInDays,
|
|
84
81
|
});
|
|
85
82
|
}
|
|
86
83
|
export async function revokeApiKey(keyId) {
|
|
87
|
-
|
|
88
|
-
if (!org)
|
|
89
|
-
return { error: 'No organization selected', status: 0 };
|
|
90
|
-
return request('DELETE', `/api/organizations/${org.id}/api-keys/${keyId}`);
|
|
84
|
+
return request('DELETE', `/api/api-keys/${keyId}`);
|
|
91
85
|
}
|
|
92
86
|
export async function getSources() {
|
|
93
|
-
|
|
94
|
-
if (!org)
|
|
95
|
-
return { error: 'No organization selected', status: 0 };
|
|
96
|
-
return request('GET', `/api/organizations/${org.id}/sources`);
|
|
87
|
+
return request('GET', `/api/sources?pageSize=100`);
|
|
97
88
|
}
|
|
98
89
|
export async function getSource(sourceId) {
|
|
99
|
-
|
|
100
|
-
if (!org)
|
|
101
|
-
return { error: 'No organization selected', status: 0 };
|
|
102
|
-
return request('GET', `/api/organizations/${org.id}/sources/${sourceId}`);
|
|
90
|
+
return request('GET', `/api/sources/${sourceId}`);
|
|
103
91
|
}
|
|
104
92
|
export async function createSource(name, slug, provider, options) {
|
|
105
|
-
const org = requireOrg();
|
|
106
|
-
if (!org)
|
|
107
|
-
return { error: 'No organization selected', status: 0 };
|
|
108
93
|
const body = {
|
|
109
94
|
name,
|
|
110
95
|
slug,
|
|
111
96
|
description: options?.description,
|
|
112
97
|
rejectInvalidSignatures: options?.rejectInvalidSignatures,
|
|
113
98
|
rateLimitPerMinute: options?.rateLimitPerMinute,
|
|
99
|
+
transientMode: options?.transientMode,
|
|
114
100
|
};
|
|
115
101
|
// Only include provider if it's a valid value (not empty)
|
|
116
102
|
if (provider && provider.length > 0) {
|
|
117
103
|
body.provider = provider;
|
|
118
104
|
}
|
|
119
|
-
return request('POST', `/api/
|
|
105
|
+
return request('POST', `/api/sources`, body);
|
|
120
106
|
}
|
|
121
107
|
export async function updateSource(sourceId, data) {
|
|
122
|
-
|
|
123
|
-
if (!org)
|
|
124
|
-
return { error: 'No organization selected', status: 0 };
|
|
125
|
-
return request('PATCH', `/api/organizations/${org.id}/sources/${sourceId}`, {
|
|
108
|
+
return request('PATCH', `/api/sources/${sourceId}`, {
|
|
126
109
|
name: data.name,
|
|
127
110
|
provider: data.provider,
|
|
128
111
|
description: data.description,
|
|
129
112
|
isActive: data.isActive,
|
|
130
113
|
rejectInvalidSignatures: data.rejectInvalidSignatures,
|
|
131
114
|
rateLimitPerMinute: data.rateLimitPerMinute,
|
|
115
|
+
transientMode: data.transientMode,
|
|
132
116
|
});
|
|
133
117
|
}
|
|
134
118
|
export async function deleteSource(sourceId) {
|
|
135
|
-
|
|
136
|
-
if (!org)
|
|
137
|
-
return { error: 'No organization selected', status: 0 };
|
|
138
|
-
return request('DELETE', `/api/organizations/${org.id}/sources/${sourceId}`);
|
|
119
|
+
return request('DELETE', `/api/sources/${sourceId}`);
|
|
139
120
|
}
|
|
140
121
|
export async function rotateSourceSecret(sourceId) {
|
|
141
|
-
|
|
142
|
-
if (!org)
|
|
143
|
-
return { error: 'No organization selected', status: 0 };
|
|
144
|
-
return request('POST', `/api/organizations/${org.id}/sources/${sourceId}/rotate-secret`);
|
|
122
|
+
return request('POST', `/api/sources/${sourceId}/rotate-secret`);
|
|
145
123
|
}
|
|
146
124
|
export async function getDestinations() {
|
|
147
|
-
|
|
148
|
-
if (!org)
|
|
149
|
-
return { error: 'No organization selected', status: 0 };
|
|
150
|
-
return request('GET', `/api/organizations/${org.id}/destinations`);
|
|
125
|
+
return request('GET', `/api/destinations?pageSize=100`);
|
|
151
126
|
}
|
|
152
127
|
export async function getDestination(destId) {
|
|
153
|
-
|
|
154
|
-
if (!org)
|
|
155
|
-
return { error: 'No organization selected', status: 0 };
|
|
156
|
-
return request('GET', `/api/organizations/${org.id}/destinations/${destId}`);
|
|
128
|
+
return request('GET', `/api/destinations/${destId}`);
|
|
157
129
|
}
|
|
158
130
|
export async function createDestination(data) {
|
|
159
|
-
const org = requireOrg();
|
|
160
|
-
if (!org)
|
|
161
|
-
return { error: 'No organization selected', status: 0 };
|
|
162
131
|
// Generate slug from name if not provided
|
|
163
132
|
const slug = data.slug || data.name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
164
|
-
return request('POST', `/api/
|
|
133
|
+
return request('POST', `/api/destinations`, {
|
|
165
134
|
name: data.name,
|
|
166
135
|
slug: slug,
|
|
167
136
|
url: data.url,
|
|
@@ -174,10 +143,7 @@ export async function createDestination(data) {
|
|
|
174
143
|
});
|
|
175
144
|
}
|
|
176
145
|
export async function updateDestination(destId, data) {
|
|
177
|
-
|
|
178
|
-
if (!org)
|
|
179
|
-
return { error: 'No organization selected', status: 0 };
|
|
180
|
-
return request('PATCH', `/api/organizations/${org.id}/destinations/${destId}`, {
|
|
146
|
+
return request('PATCH', `/api/destinations/${destId}`, {
|
|
181
147
|
name: data.name,
|
|
182
148
|
url: data.url,
|
|
183
149
|
method: data.method,
|
|
@@ -190,34 +156,19 @@ export async function updateDestination(destId, data) {
|
|
|
190
156
|
});
|
|
191
157
|
}
|
|
192
158
|
export async function deleteDestination(destId) {
|
|
193
|
-
|
|
194
|
-
if (!org)
|
|
195
|
-
return { error: 'No organization selected', status: 0 };
|
|
196
|
-
return request('DELETE', `/api/organizations/${org.id}/destinations/${destId}`);
|
|
159
|
+
return request('DELETE', `/api/destinations/${destId}`);
|
|
197
160
|
}
|
|
198
161
|
export async function testDestination(destId) {
|
|
199
|
-
|
|
200
|
-
if (!org)
|
|
201
|
-
return { error: 'No organization selected', status: 0 };
|
|
202
|
-
return request('POST', `/api/organizations/${org.id}/destinations/${destId}/test`);
|
|
162
|
+
return request('POST', `/api/destinations/${destId}/test`);
|
|
203
163
|
}
|
|
204
164
|
export async function getRoutes() {
|
|
205
|
-
|
|
206
|
-
if (!org)
|
|
207
|
-
return { error: 'No organization selected', status: 0 };
|
|
208
|
-
return request('GET', `/api/organizations/${org.id}/routes`);
|
|
165
|
+
return request('GET', `/api/routes?pageSize=100`);
|
|
209
166
|
}
|
|
210
167
|
export async function getRoute(routeId) {
|
|
211
|
-
|
|
212
|
-
if (!org)
|
|
213
|
-
return { error: 'No organization selected', status: 0 };
|
|
214
|
-
return request('GET', `/api/organizations/${org.id}/routes/${routeId}`);
|
|
168
|
+
return request('GET', `/api/routes/${routeId}`);
|
|
215
169
|
}
|
|
216
170
|
export async function createRoute(data) {
|
|
217
|
-
|
|
218
|
-
if (!org)
|
|
219
|
-
return { error: 'No organization selected', status: 0 };
|
|
220
|
-
return request('POST', `/api/organizations/${org.id}/routes`, {
|
|
171
|
+
return request('POST', `/api/routes`, {
|
|
221
172
|
name: data.name,
|
|
222
173
|
sourceId: data.sourceId,
|
|
223
174
|
destinationId: data.destinationId,
|
|
@@ -230,10 +181,7 @@ export async function createRoute(data) {
|
|
|
230
181
|
});
|
|
231
182
|
}
|
|
232
183
|
export async function updateRoute(routeId, data) {
|
|
233
|
-
|
|
234
|
-
if (!org)
|
|
235
|
-
return { error: 'No organization selected', status: 0 };
|
|
236
|
-
return request('PATCH', `/api/organizations/${org.id}/routes/${routeId}`, {
|
|
184
|
+
return request('PATCH', `/api/routes/${routeId}`, {
|
|
237
185
|
name: data.name,
|
|
238
186
|
sourceId: data.sourceId,
|
|
239
187
|
destinationId: data.destinationId,
|
|
@@ -246,78 +194,45 @@ export async function updateRoute(routeId, data) {
|
|
|
246
194
|
});
|
|
247
195
|
}
|
|
248
196
|
export async function deleteRoute(routeId) {
|
|
249
|
-
|
|
250
|
-
if (!org)
|
|
251
|
-
return { error: 'No organization selected', status: 0 };
|
|
252
|
-
return request('DELETE', `/api/organizations/${org.id}/routes/${routeId}`);
|
|
197
|
+
return request('DELETE', `/api/routes/${routeId}`);
|
|
253
198
|
}
|
|
254
199
|
export async function getTunnels() {
|
|
255
|
-
|
|
256
|
-
if (!org)
|
|
257
|
-
return { error: 'No organization selected', status: 0 };
|
|
258
|
-
return request('GET', `/api/organizations/${org.id}/tunnels`);
|
|
200
|
+
return request('GET', `/api/tunnels?pageSize=100`);
|
|
259
201
|
}
|
|
260
202
|
export async function getTunnel(tunnelId) {
|
|
261
|
-
|
|
262
|
-
if (!org)
|
|
263
|
-
return { error: 'No organization selected', status: 0 };
|
|
264
|
-
return request('GET', `/api/organizations/${org.id}/tunnels/${tunnelId}`);
|
|
203
|
+
return request('GET', `/api/tunnels/${tunnelId}`);
|
|
265
204
|
}
|
|
266
205
|
export async function createTunnel(name, subdomain) {
|
|
267
|
-
|
|
268
|
-
if (!org)
|
|
269
|
-
return { error: 'No organization selected', status: 0 };
|
|
270
|
-
return request('POST', `/api/organizations/${org.id}/tunnels`, {
|
|
206
|
+
return request('POST', `/api/tunnels`, {
|
|
271
207
|
name,
|
|
272
208
|
subdomain,
|
|
273
209
|
});
|
|
274
210
|
}
|
|
275
211
|
export async function updateTunnel(tunnelId, data) {
|
|
276
|
-
|
|
277
|
-
if (!org)
|
|
278
|
-
return { error: 'No organization selected', status: 0 };
|
|
279
|
-
return request('PATCH', `/api/organizations/${org.id}/tunnels/${tunnelId}`, data);
|
|
212
|
+
return request('PATCH', `/api/tunnels/${tunnelId}`, data);
|
|
280
213
|
}
|
|
281
214
|
export async function deleteTunnel(tunnelId) {
|
|
282
|
-
|
|
283
|
-
if (!org)
|
|
284
|
-
return { error: 'No organization selected', status: 0 };
|
|
285
|
-
return request('DELETE', `/api/organizations/${org.id}/tunnels/${tunnelId}`);
|
|
215
|
+
return request('DELETE', `/api/tunnels/${tunnelId}`);
|
|
286
216
|
}
|
|
287
217
|
export async function getTunnelStatus(tunnelId) {
|
|
288
|
-
|
|
289
|
-
if (!org)
|
|
290
|
-
return { error: 'No organization selected', status: 0 };
|
|
291
|
-
return request('GET', `/api/organizations/${org.id}/tunnels/${tunnelId}/status`);
|
|
218
|
+
return request('GET', `/api/tunnels/${tunnelId}/status`);
|
|
292
219
|
}
|
|
293
220
|
export async function regenerateTunnelToken(tunnelId) {
|
|
294
|
-
|
|
295
|
-
if (!org)
|
|
296
|
-
return { error: 'No organization selected', status: 0 };
|
|
297
|
-
return request('POST', `/api/organizations/${org.id}/tunnels/${tunnelId}/regenerate-token`);
|
|
221
|
+
return request('POST', `/api/tunnels/${tunnelId}/regenerate-token`);
|
|
298
222
|
}
|
|
299
223
|
export async function disconnectTunnel(tunnelId) {
|
|
300
|
-
|
|
301
|
-
if (!org)
|
|
302
|
-
return { error: 'No organization selected', status: 0 };
|
|
303
|
-
return request('POST', `/api/organizations/${org.id}/tunnels/${tunnelId}/disconnect`);
|
|
224
|
+
return request('POST', `/api/tunnels/${tunnelId}/disconnect`);
|
|
304
225
|
}
|
|
305
226
|
export async function getTunnelRequests(tunnelId, options) {
|
|
306
|
-
const org = requireOrg();
|
|
307
|
-
if (!org)
|
|
308
|
-
return { error: 'No organization selected', status: 0 };
|
|
309
227
|
const params = new URLSearchParams();
|
|
310
228
|
if (options?.limit)
|
|
311
229
|
params.set('limit', String(options.limit));
|
|
312
230
|
if (options?.offset)
|
|
313
231
|
params.set('offset', String(options.offset));
|
|
314
232
|
const query = params.toString() ? `?${params.toString()}` : '';
|
|
315
|
-
return request('GET', `/api/
|
|
233
|
+
return request('GET', `/api/tunnels/${tunnelId}/requests${query}`);
|
|
316
234
|
}
|
|
317
235
|
export async function getEvents(options) {
|
|
318
|
-
const org = requireOrg();
|
|
319
|
-
if (!org)
|
|
320
|
-
return { error: 'No organization selected', status: 0 };
|
|
321
236
|
const params = new URLSearchParams();
|
|
322
237
|
if (options?.limit)
|
|
323
238
|
params.set('limit', String(options.limit));
|
|
@@ -336,18 +251,12 @@ export async function getEvents(options) {
|
|
|
336
251
|
if (options?.search)
|
|
337
252
|
params.set('search', options.search);
|
|
338
253
|
const queryString = params.toString();
|
|
339
|
-
return request('GET', `/api/
|
|
254
|
+
return request('GET', `/api/events${queryString ? `?${queryString}` : ''}`);
|
|
340
255
|
}
|
|
341
256
|
export async function getEvent(eventId) {
|
|
342
|
-
|
|
343
|
-
if (!org)
|
|
344
|
-
return { error: 'No organization selected', status: 0 };
|
|
345
|
-
return request('GET', `/api/organizations/${org.id}/events/${eventId}`);
|
|
257
|
+
return request('GET', `/api/events/${eventId}`);
|
|
346
258
|
}
|
|
347
259
|
export async function getDeliveries(options) {
|
|
348
|
-
const org = requireOrg();
|
|
349
|
-
if (!org)
|
|
350
|
-
return { error: 'No organization selected', status: 0 };
|
|
351
260
|
const params = new URLSearchParams();
|
|
352
261
|
if (options?.limit)
|
|
353
262
|
params.set('limit', String(options.limit));
|
|
@@ -362,45 +271,27 @@ export async function getDeliveries(options) {
|
|
|
362
271
|
if (options?.status)
|
|
363
272
|
params.set('status', options.status);
|
|
364
273
|
const queryString = params.toString();
|
|
365
|
-
return request('GET', `/api/
|
|
274
|
+
return request('GET', `/api/deliveries${queryString ? `?${queryString}` : ''}`);
|
|
366
275
|
}
|
|
367
276
|
export async function getDelivery(deliveryId) {
|
|
368
|
-
|
|
369
|
-
if (!org)
|
|
370
|
-
return { error: 'No organization selected', status: 0 };
|
|
371
|
-
return request('GET', `/api/organizations/${org.id}/deliveries/${deliveryId}`);
|
|
277
|
+
return request('GET', `/api/deliveries/${deliveryId}`);
|
|
372
278
|
}
|
|
373
279
|
export async function replayDelivery(deliveryId) {
|
|
374
|
-
|
|
375
|
-
if (!org)
|
|
376
|
-
return { error: 'No organization selected', status: 0 };
|
|
377
|
-
return request('POST', `/api/organizations/${org.id}/deliveries/${deliveryId}/replay`);
|
|
280
|
+
return request('POST', `/api/deliveries/${deliveryId}/replay`);
|
|
378
281
|
}
|
|
379
282
|
export async function bulkReplayDeliveries(deliveryIds) {
|
|
380
|
-
|
|
381
|
-
if (!org)
|
|
382
|
-
return { error: 'No organization selected', status: 0 };
|
|
383
|
-
return request('POST', `/api/organizations/${org.id}/deliveries/bulk-replay`, {
|
|
283
|
+
return request('POST', `/api/deliveries/bulk-replay`, {
|
|
384
284
|
deliveryIds,
|
|
385
285
|
});
|
|
386
286
|
}
|
|
387
287
|
export async function getTransforms() {
|
|
388
|
-
|
|
389
|
-
if (!org)
|
|
390
|
-
return { error: 'No organization selected', status: 0 };
|
|
391
|
-
return request('GET', `/api/organizations/${org.id}/transforms`);
|
|
288
|
+
return request('GET', `/api/transforms`);
|
|
392
289
|
}
|
|
393
290
|
export async function getTransform(transformId) {
|
|
394
|
-
|
|
395
|
-
if (!org)
|
|
396
|
-
return { error: 'No organization selected', status: 0 };
|
|
397
|
-
return request('GET', `/api/organizations/${org.id}/transforms/${transformId}`);
|
|
291
|
+
return request('GET', `/api/transforms/${transformId}`);
|
|
398
292
|
}
|
|
399
293
|
export async function createTransform(data) {
|
|
400
|
-
|
|
401
|
-
if (!org)
|
|
402
|
-
return { error: 'No organization selected', status: 0 };
|
|
403
|
-
return request('POST', `/api/organizations/${org.id}/transforms`, {
|
|
294
|
+
return request('POST', `/api/transforms`, {
|
|
404
295
|
name: data.name,
|
|
405
296
|
type: data.type,
|
|
406
297
|
expression: data.expression,
|
|
@@ -409,50 +300,29 @@ export async function createTransform(data) {
|
|
|
409
300
|
});
|
|
410
301
|
}
|
|
411
302
|
export async function updateTransform(transformId, data) {
|
|
412
|
-
|
|
413
|
-
if (!org)
|
|
414
|
-
return { error: 'No organization selected', status: 0 };
|
|
415
|
-
return request('PATCH', `/api/organizations/${org.id}/transforms/${transformId}`, {
|
|
303
|
+
return request('PATCH', `/api/transforms/${transformId}`, {
|
|
416
304
|
name: data.name,
|
|
417
305
|
expression: data.expression,
|
|
418
306
|
is_active: data.isActive,
|
|
419
307
|
});
|
|
420
308
|
}
|
|
421
309
|
export async function deleteTransform(transformId) {
|
|
422
|
-
|
|
423
|
-
if (!org)
|
|
424
|
-
return { error: 'No organization selected', status: 0 };
|
|
425
|
-
return request('DELETE', `/api/organizations/${org.id}/transforms/${transformId}`);
|
|
310
|
+
return request('DELETE', `/api/transforms/${transformId}`);
|
|
426
311
|
}
|
|
427
312
|
export async function testTransform(data) {
|
|
428
|
-
|
|
429
|
-
if (!org)
|
|
430
|
-
return { error: 'No organization selected', status: 0 };
|
|
431
|
-
return request('POST', `/api/organizations/${org.id}/transforms/test`, data);
|
|
313
|
+
return request('POST', `/api/transforms/test`, data);
|
|
432
314
|
}
|
|
433
315
|
export async function getFilters() {
|
|
434
|
-
|
|
435
|
-
if (!org)
|
|
436
|
-
return { error: 'No organization selected', status: 0 };
|
|
437
|
-
return request('GET', `/api/organizations/${org.id}/filters`);
|
|
316
|
+
return request('GET', `/api/filters`);
|
|
438
317
|
}
|
|
439
318
|
export async function getFilter(filterId) {
|
|
440
|
-
|
|
441
|
-
if (!org)
|
|
442
|
-
return { error: 'No organization selected', status: 0 };
|
|
443
|
-
return request('GET', `/api/organizations/${org.id}/filters/${filterId}`);
|
|
319
|
+
return request('GET', `/api/filters/${filterId}`);
|
|
444
320
|
}
|
|
445
321
|
export async function createFilter(data) {
|
|
446
|
-
|
|
447
|
-
if (!org)
|
|
448
|
-
return { error: 'No organization selected', status: 0 };
|
|
449
|
-
return request('POST', `/api/organizations/${org.id}/filters`, data);
|
|
322
|
+
return request('POST', `/api/filters`, data);
|
|
450
323
|
}
|
|
451
324
|
export async function updateFilter(filterId, data) {
|
|
452
|
-
|
|
453
|
-
if (!org)
|
|
454
|
-
return { error: 'No organization selected', status: 0 };
|
|
455
|
-
return request('PATCH', `/api/organizations/${org.id}/filters/${filterId}`, {
|
|
325
|
+
return request('PATCH', `/api/filters/${filterId}`, {
|
|
456
326
|
name: data.name,
|
|
457
327
|
logic: data.logic,
|
|
458
328
|
conditions: data.conditions,
|
|
@@ -460,52 +330,28 @@ export async function updateFilter(filterId, data) {
|
|
|
460
330
|
});
|
|
461
331
|
}
|
|
462
332
|
export async function deleteFilter(filterId) {
|
|
463
|
-
|
|
464
|
-
if (!org)
|
|
465
|
-
return { error: 'No organization selected', status: 0 };
|
|
466
|
-
return request('DELETE', `/api/organizations/${org.id}/filters/${filterId}`);
|
|
333
|
+
return request('DELETE', `/api/filters/${filterId}`);
|
|
467
334
|
}
|
|
468
335
|
export async function testFilter(data) {
|
|
469
|
-
|
|
470
|
-
if (!org)
|
|
471
|
-
return { error: 'No organization selected', status: 0 };
|
|
472
|
-
return request('POST', `/api/organizations/${org.id}/filters/test`, data);
|
|
336
|
+
return request('POST', `/api/filters/test`, data);
|
|
473
337
|
}
|
|
474
338
|
export async function getAnalyticsOverview() {
|
|
475
|
-
|
|
476
|
-
if (!org)
|
|
477
|
-
return { error: 'No organization selected', status: 0 };
|
|
478
|
-
return request('GET', `/api/organizations/${org.id}/analytics/overview`);
|
|
339
|
+
return request('GET', `/api/analytics/overview`);
|
|
479
340
|
}
|
|
480
341
|
export async function getDashboardAnalytics(range = '24h') {
|
|
481
|
-
|
|
482
|
-
if (!org)
|
|
483
|
-
return { error: 'No organization selected', status: 0 };
|
|
484
|
-
return request('GET', `/api/organizations/${org.id}/analytics/dashboard?range=${range}`);
|
|
342
|
+
return request('GET', `/api/analytics/dashboard?range=${range}`);
|
|
485
343
|
}
|
|
486
344
|
export async function getRecentActivity(limit = 20) {
|
|
487
|
-
|
|
488
|
-
if (!org)
|
|
489
|
-
return { error: 'No organization selected', status: 0 };
|
|
490
|
-
return request('GET', `/api/organizations/${org.id}/realtime/recent?limit=${limit}`);
|
|
345
|
+
return request('GET', `/api/realtime/recent?limit=${limit}`);
|
|
491
346
|
}
|
|
492
347
|
export async function getCronJobs() {
|
|
493
|
-
|
|
494
|
-
if (!org)
|
|
495
|
-
return { error: 'No organization selected', status: 0 };
|
|
496
|
-
return request('GET', `/api/organizations/${org.id}/cron`);
|
|
348
|
+
return request('GET', `/api/cron?pageSize=100`);
|
|
497
349
|
}
|
|
498
350
|
export async function getCronJob(jobId) {
|
|
499
|
-
|
|
500
|
-
if (!org)
|
|
501
|
-
return { error: 'No organization selected', status: 0 };
|
|
502
|
-
return request('GET', `/api/organizations/${org.id}/cron/${jobId}`);
|
|
351
|
+
return request('GET', `/api/cron/${jobId}`);
|
|
503
352
|
}
|
|
504
353
|
export async function createCronJob(data) {
|
|
505
|
-
|
|
506
|
-
if (!org)
|
|
507
|
-
return { error: 'No organization selected', status: 0 };
|
|
508
|
-
return request('POST', `/api/organizations/${org.id}/cron`, {
|
|
354
|
+
return request('POST', `/api/cron`, {
|
|
509
355
|
name: data.name,
|
|
510
356
|
description: data.description,
|
|
511
357
|
cronExpression: data.cronExpression,
|
|
@@ -522,85 +368,46 @@ export async function createCronJob(data) {
|
|
|
522
368
|
});
|
|
523
369
|
}
|
|
524
370
|
export async function updateCronJob(jobId, data) {
|
|
525
|
-
|
|
526
|
-
if (!org)
|
|
527
|
-
return { error: 'No organization selected', status: 0 };
|
|
528
|
-
return request('PATCH', `/api/organizations/${org.id}/cron/${jobId}`, data);
|
|
371
|
+
return request('PATCH', `/api/cron/${jobId}`, data);
|
|
529
372
|
}
|
|
530
373
|
export async function deleteCronJob(jobId) {
|
|
531
|
-
|
|
532
|
-
if (!org)
|
|
533
|
-
return { error: 'No organization selected', status: 0 };
|
|
534
|
-
return request('DELETE', `/api/organizations/${org.id}/cron/${jobId}`);
|
|
374
|
+
return request('DELETE', `/api/cron/${jobId}`);
|
|
535
375
|
}
|
|
536
376
|
export async function triggerCronJob(jobId) {
|
|
537
|
-
|
|
538
|
-
if (!org)
|
|
539
|
-
return { error: 'No organization selected', status: 0 };
|
|
540
|
-
return request('POST', `/api/organizations/${org.id}/cron/${jobId}/trigger`);
|
|
377
|
+
return request('POST', `/api/cron/${jobId}/trigger`);
|
|
541
378
|
}
|
|
542
379
|
export async function getCronExecutions(jobId, limit = 20) {
|
|
543
|
-
|
|
544
|
-
if (!org)
|
|
545
|
-
return { error: 'No organization selected', status: 0 };
|
|
546
|
-
return request('GET', `/api/organizations/${org.id}/cron/${jobId}/executions?limit=${limit}`);
|
|
380
|
+
return request('GET', `/api/cron/${jobId}/executions?limit=${limit}`);
|
|
547
381
|
}
|
|
548
382
|
// ============================================================================
|
|
549
383
|
// Cron Groups
|
|
550
384
|
// ============================================================================
|
|
551
385
|
export async function getCronGroups() {
|
|
552
|
-
|
|
553
|
-
if (!org)
|
|
554
|
-
return { error: 'No organization selected', status: 0 };
|
|
555
|
-
return request('GET', `/api/organizations/${org.id}/cron-groups`);
|
|
386
|
+
return request('GET', `/api/cron-groups`);
|
|
556
387
|
}
|
|
557
388
|
export async function getCronGroup(groupId) {
|
|
558
|
-
|
|
559
|
-
if (!org)
|
|
560
|
-
return { error: 'No organization selected', status: 0 };
|
|
561
|
-
return request('GET', `/api/organizations/${org.id}/cron-groups/${groupId}`);
|
|
389
|
+
return request('GET', `/api/cron-groups/${groupId}`);
|
|
562
390
|
}
|
|
563
391
|
export async function createCronGroup(data) {
|
|
564
|
-
|
|
565
|
-
if (!org)
|
|
566
|
-
return { error: 'No organization selected', status: 0 };
|
|
567
|
-
return request('POST', `/api/organizations/${org.id}/cron-groups`, data);
|
|
392
|
+
return request('POST', `/api/cron-groups`, data);
|
|
568
393
|
}
|
|
569
394
|
export async function updateCronGroup(groupId, data) {
|
|
570
|
-
|
|
571
|
-
if (!org)
|
|
572
|
-
return { error: 'No organization selected', status: 0 };
|
|
573
|
-
return request('PATCH', `/api/organizations/${org.id}/cron-groups/${groupId}`, data);
|
|
395
|
+
return request('PATCH', `/api/cron-groups/${groupId}`, data);
|
|
574
396
|
}
|
|
575
397
|
export async function deleteCronGroup(groupId) {
|
|
576
|
-
|
|
577
|
-
if (!org)
|
|
578
|
-
return { error: 'No organization selected', status: 0 };
|
|
579
|
-
return request('DELETE', `/api/organizations/${org.id}/cron-groups/${groupId}`);
|
|
398
|
+
return request('DELETE', `/api/cron-groups/${groupId}`);
|
|
580
399
|
}
|
|
581
400
|
export async function reorderCronGroups(groupIds) {
|
|
582
|
-
|
|
583
|
-
if (!org)
|
|
584
|
-
return { error: 'No organization selected', status: 0 };
|
|
585
|
-
return request('POST', `/api/organizations/${org.id}/cron-groups/reorder`, { groupIds });
|
|
401
|
+
return request('POST', `/api/cron-groups/reorder`, { groupIds });
|
|
586
402
|
}
|
|
587
403
|
export async function getWebhookApplications() {
|
|
588
|
-
|
|
589
|
-
if (!org)
|
|
590
|
-
return { error: 'No organization selected', status: 0 };
|
|
591
|
-
return request('GET', `/api/organizations/${org.id}/webhook-applications`);
|
|
404
|
+
return request('GET', `/api/webhook-applications`);
|
|
592
405
|
}
|
|
593
406
|
export async function getWebhookApplication(appId) {
|
|
594
|
-
|
|
595
|
-
if (!org)
|
|
596
|
-
return { error: 'No organization selected', status: 0 };
|
|
597
|
-
return request('GET', `/api/organizations/${org.id}/webhook-applications/${appId}`);
|
|
407
|
+
return request('GET', `/api/webhook-applications/${appId}`);
|
|
598
408
|
}
|
|
599
409
|
export async function createWebhookApplication(data) {
|
|
600
|
-
|
|
601
|
-
if (!org)
|
|
602
|
-
return { error: 'No organization selected', status: 0 };
|
|
603
|
-
return request('POST', `/api/organizations/${org.id}/webhook-applications`, {
|
|
410
|
+
return request('POST', `/api/webhook-applications`, {
|
|
604
411
|
name: data.name,
|
|
605
412
|
description: data.description,
|
|
606
413
|
uid: data.uid,
|
|
@@ -608,35 +415,20 @@ export async function createWebhookApplication(data) {
|
|
|
608
415
|
});
|
|
609
416
|
}
|
|
610
417
|
export async function updateWebhookApplication(appId, data) {
|
|
611
|
-
|
|
612
|
-
if (!org)
|
|
613
|
-
return { error: 'No organization selected', status: 0 };
|
|
614
|
-
return request('PATCH', `/api/organizations/${org.id}/webhook-applications/${appId}`, data);
|
|
418
|
+
return request('PATCH', `/api/webhook-applications/${appId}`, data);
|
|
615
419
|
}
|
|
616
420
|
export async function deleteWebhookApplication(appId) {
|
|
617
|
-
|
|
618
|
-
if (!org)
|
|
619
|
-
return { error: 'No organization selected', status: 0 };
|
|
620
|
-
return request('DELETE', `/api/organizations/${org.id}/webhook-applications/${appId}`);
|
|
421
|
+
return request('DELETE', `/api/webhook-applications/${appId}`);
|
|
621
422
|
}
|
|
622
423
|
export async function getWebhookEndpoints(appId) {
|
|
623
|
-
const org = requireOrg();
|
|
624
|
-
if (!org)
|
|
625
|
-
return { error: 'No organization selected', status: 0 };
|
|
626
424
|
const query = appId ? `?applicationId=${appId}` : '';
|
|
627
|
-
return request('GET', `/api/
|
|
425
|
+
return request('GET', `/api/webhook-endpoints${query}`);
|
|
628
426
|
}
|
|
629
427
|
export async function getWebhookEndpoint(endpointId) {
|
|
630
|
-
|
|
631
|
-
if (!org)
|
|
632
|
-
return { error: 'No organization selected', status: 0 };
|
|
633
|
-
return request('GET', `/api/organizations/${org.id}/webhook-endpoints/${endpointId}`);
|
|
428
|
+
return request('GET', `/api/webhook-endpoints/${endpointId}`);
|
|
634
429
|
}
|
|
635
430
|
export async function createWebhookEndpoint(data) {
|
|
636
|
-
|
|
637
|
-
if (!org)
|
|
638
|
-
return { error: 'No organization selected', status: 0 };
|
|
639
|
-
return request('POST', `/api/organizations/${org.id}/webhook-endpoints`, {
|
|
431
|
+
return request('POST', `/api/webhook-endpoints`, {
|
|
640
432
|
applicationId: data.applicationId,
|
|
641
433
|
url: data.url,
|
|
642
434
|
description: data.description,
|
|
@@ -647,34 +439,19 @@ export async function createWebhookEndpoint(data) {
|
|
|
647
439
|
});
|
|
648
440
|
}
|
|
649
441
|
export async function updateWebhookEndpoint(endpointId, data) {
|
|
650
|
-
|
|
651
|
-
if (!org)
|
|
652
|
-
return { error: 'No organization selected', status: 0 };
|
|
653
|
-
return request('PATCH', `/api/organizations/${org.id}/webhook-endpoints/${endpointId}`, data);
|
|
442
|
+
return request('PATCH', `/api/webhook-endpoints/${endpointId}`, data);
|
|
654
443
|
}
|
|
655
444
|
export async function deleteWebhookEndpoint(endpointId) {
|
|
656
|
-
|
|
657
|
-
if (!org)
|
|
658
|
-
return { error: 'No organization selected', status: 0 };
|
|
659
|
-
return request('DELETE', `/api/organizations/${org.id}/webhook-endpoints/${endpointId}`);
|
|
445
|
+
return request('DELETE', `/api/webhook-endpoints/${endpointId}`);
|
|
660
446
|
}
|
|
661
447
|
export async function testWebhookEndpoint(endpointId) {
|
|
662
|
-
|
|
663
|
-
if (!org)
|
|
664
|
-
return { error: 'No organization selected', status: 0 };
|
|
665
|
-
return request('POST', `/api/organizations/${org.id}/webhook-endpoints/${endpointId}/test`);
|
|
448
|
+
return request('POST', `/api/webhook-endpoints/${endpointId}/test`);
|
|
666
449
|
}
|
|
667
450
|
export async function rotateWebhookEndpointSecret(endpointId) {
|
|
668
|
-
|
|
669
|
-
if (!org)
|
|
670
|
-
return { error: 'No organization selected', status: 0 };
|
|
671
|
-
return request('POST', `/api/organizations/${org.id}/webhook-endpoints/${endpointId}/rotate-secret`);
|
|
451
|
+
return request('POST', `/api/webhook-endpoints/${endpointId}/rotate-secret`);
|
|
672
452
|
}
|
|
673
453
|
export async function sendWebhookEvent(data) {
|
|
674
|
-
|
|
675
|
-
if (!org)
|
|
676
|
-
return { error: 'No organization selected', status: 0 };
|
|
677
|
-
return request('POST', `/api/organizations/${org.id}/send-event`, {
|
|
454
|
+
return request('POST', `/api/send-event`, {
|
|
678
455
|
applicationId: data.applicationId,
|
|
679
456
|
eventType: data.eventType,
|
|
680
457
|
payload: data.payload,
|
|
@@ -685,9 +462,6 @@ export async function sendWebhookEvent(data) {
|
|
|
685
462
|
// Outbound Webhooks - Messages
|
|
686
463
|
// ============================================================================
|
|
687
464
|
export async function getWebhookMessages(options) {
|
|
688
|
-
const org = requireOrg();
|
|
689
|
-
if (!org)
|
|
690
|
-
return { error: 'No organization selected', status: 0 };
|
|
691
465
|
const params = new URLSearchParams();
|
|
692
466
|
if (options?.limit)
|
|
693
467
|
params.set('limit', String(options.limit));
|
|
@@ -702,25 +476,16 @@ export async function getWebhookMessages(options) {
|
|
|
702
476
|
if (options?.eventType)
|
|
703
477
|
params.set('eventType', options.eventType);
|
|
704
478
|
const queryString = params.toString();
|
|
705
|
-
return request('GET', `/api/
|
|
479
|
+
return request('GET', `/api/outbound-messages${queryString ? `?${queryString}` : ''}`);
|
|
706
480
|
}
|
|
707
481
|
export async function getWebhookMessage(messageId) {
|
|
708
|
-
|
|
709
|
-
if (!org)
|
|
710
|
-
return { error: 'No organization selected', status: 0 };
|
|
711
|
-
return request('GET', `/api/organizations/${org.id}/outbound-messages/${messageId}`);
|
|
482
|
+
return request('GET', `/api/outbound-messages/${messageId}`);
|
|
712
483
|
}
|
|
713
484
|
export async function retryWebhookMessage(messageId) {
|
|
714
|
-
|
|
715
|
-
if (!org)
|
|
716
|
-
return { error: 'No organization selected', status: 0 };
|
|
717
|
-
return request('POST', `/api/organizations/${org.id}/outbound-messages/${messageId}/retry`);
|
|
485
|
+
return request('POST', `/api/outbound-messages/${messageId}/retry`);
|
|
718
486
|
}
|
|
719
487
|
// DLQ messages are just outbound messages with status=dlq
|
|
720
488
|
export async function getDlqMessages(options) {
|
|
721
|
-
const org = requireOrg();
|
|
722
|
-
if (!org)
|
|
723
|
-
return { error: 'No organization selected', status: 0 };
|
|
724
489
|
const params = new URLSearchParams();
|
|
725
490
|
params.set('status', 'dlq'); // Filter for DLQ messages
|
|
726
491
|
if (options?.limit)
|
|
@@ -732,24 +497,15 @@ export async function getDlqMessages(options) {
|
|
|
732
497
|
if (options?.endpointId)
|
|
733
498
|
params.set('endpointId', options.endpointId);
|
|
734
499
|
const queryString = params.toString();
|
|
735
|
-
return request('GET', `/api/
|
|
500
|
+
return request('GET', `/api/outbound-messages?${queryString}`);
|
|
736
501
|
}
|
|
737
502
|
export async function getDlqMessage(messageId) {
|
|
738
|
-
|
|
739
|
-
if (!org)
|
|
740
|
-
return { error: 'No organization selected', status: 0 };
|
|
741
|
-
return request('GET', `/api/organizations/${org.id}/outbound-messages/${messageId}`);
|
|
503
|
+
return request('GET', `/api/outbound-messages/${messageId}`);
|
|
742
504
|
}
|
|
743
505
|
export async function retryDlqMessage(messageId) {
|
|
744
|
-
|
|
745
|
-
if (!org)
|
|
746
|
-
return { error: 'No organization selected', status: 0 };
|
|
747
|
-
return request('POST', `/api/organizations/${org.id}/outbound-messages/${messageId}/replay`);
|
|
506
|
+
return request('POST', `/api/outbound-messages/${messageId}/replay`);
|
|
748
507
|
}
|
|
749
508
|
export async function bulkRetryDlqMessages(messageIds) {
|
|
750
|
-
const org = requireOrg();
|
|
751
|
-
if (!org)
|
|
752
|
-
return { error: 'No organization selected', status: 0 };
|
|
753
509
|
// Replay each message individually since there's no bulk endpoint
|
|
754
510
|
let retried = 0;
|
|
755
511
|
let failed = 0;
|
|
@@ -765,10 +521,7 @@ export async function bulkRetryDlqMessages(messageIds) {
|
|
|
765
521
|
return { data: { retried, failed }, status: 200 };
|
|
766
522
|
}
|
|
767
523
|
export async function deleteDlqMessage(messageId) {
|
|
768
|
-
const org = requireOrg();
|
|
769
|
-
if (!org)
|
|
770
|
-
return { error: 'No organization selected', status: 0 };
|
|
771
524
|
// Note: Delete may not be supported - check API
|
|
772
|
-
return request('DELETE', `/api/
|
|
525
|
+
return request('DELETE', `/api/outbound-messages/${messageId}`);
|
|
773
526
|
}
|
|
774
527
|
//# sourceMappingURL=api.js.map
|