@magemetrics/core 0.1.8 → 0.2.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/index.d.ts +545 -258
- package/dist/index.js +541 -104
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -745,11 +745,11 @@ var VisualizationMetadataSchema = z.object({
|
|
|
745
745
|
originalCount: z.number(),
|
|
746
746
|
sampledCount: z.number()
|
|
747
747
|
}).optional();
|
|
748
|
-
V1FrontendVisualizationSchema.extend({
|
|
748
|
+
var V1FrontendVisualizationWithDataSchema = V1FrontendVisualizationSchema.extend({
|
|
749
749
|
data: VisualizationDataSchema,
|
|
750
750
|
_metadata: VisualizationMetadataSchema
|
|
751
751
|
});
|
|
752
|
-
FrontendVisualizationSchema.extend({
|
|
752
|
+
var FrontendVisualizationWithDataSchema = FrontendVisualizationSchema.extend({
|
|
753
753
|
data: VisualizationDataSchema,
|
|
754
754
|
_metadata: VisualizationMetadataSchema
|
|
755
755
|
});
|
|
@@ -759,7 +759,7 @@ var FlowIdParam = z.object({ flowId: z.string().uuid() }).openapi("FlowId", { ty
|
|
|
759
759
|
var FlowDataIdParam = z.object({ flowDataId: z.string().pipe(z.coerce.number()) }).openapi("FlowDataId", { type: "integer" });
|
|
760
760
|
var ReportId = z.string().pipe(z.coerce.number());
|
|
761
761
|
var ReportIdParam = z.object({ report_id: ReportId }).openapi("ReportId", { type: "integer" });
|
|
762
|
-
createRoute({
|
|
762
|
+
var RetrieveFlowDataReports = createRoute({
|
|
763
763
|
method: "get",
|
|
764
764
|
path: "/api/v1/flows/{flowId}/data-reports",
|
|
765
765
|
operationId: "retrieveFlowDataReports",
|
|
@@ -2080,89 +2080,6 @@ var ExchangeExternalToken = createRoute({
|
|
|
2080
2080
|
}
|
|
2081
2081
|
});
|
|
2082
2082
|
|
|
2083
|
-
// ../shared/dist/src/schemas/dashboard.js
|
|
2084
|
-
var DashboardTileSchema = z.discriminatedUnion("type", [
|
|
2085
|
-
z.object({
|
|
2086
|
-
type: z.literal("data-report"),
|
|
2087
|
-
flowId: z.string(),
|
|
2088
|
-
flowDataId: z.number(),
|
|
2089
|
-
title: z.string(),
|
|
2090
|
-
col: z.number(),
|
|
2091
|
-
colSpan: z.number(),
|
|
2092
|
-
rowSpan: z.number()
|
|
2093
|
-
}),
|
|
2094
|
-
z.object({
|
|
2095
|
-
type: z.literal("visualization"),
|
|
2096
|
-
visualizationId: z.number(),
|
|
2097
|
-
title: z.string(),
|
|
2098
|
-
col: z.number(),
|
|
2099
|
-
colSpan: z.number(),
|
|
2100
|
-
rowSpan: z.number()
|
|
2101
|
-
})
|
|
2102
|
-
]);
|
|
2103
|
-
var DashboardSchema = z.object({
|
|
2104
|
-
company_id: z.number(),
|
|
2105
|
-
created_at: z.string(),
|
|
2106
|
-
description: z.string().nullable(),
|
|
2107
|
-
id: z.string().uuid(),
|
|
2108
|
-
name: z.string(),
|
|
2109
|
-
positions: z.array(DashboardTileSchema),
|
|
2110
|
-
updated_at: z.string(),
|
|
2111
|
-
is_removed: z.boolean(),
|
|
2112
|
-
is_public: z.boolean()
|
|
2113
|
-
});
|
|
2114
|
-
var DashboardIdParam = DashboardSchema.shape.id.openapi("DashboardId", {
|
|
2115
|
-
type: "string",
|
|
2116
|
-
format: "uuid"
|
|
2117
|
-
});
|
|
2118
|
-
var FrontendDashboardSchema = DashboardSchema.omit({
|
|
2119
|
-
company_id: true,
|
|
2120
|
-
created_at: true,
|
|
2121
|
-
updated_at: true,
|
|
2122
|
-
is_removed: true
|
|
2123
|
-
});
|
|
2124
|
-
|
|
2125
|
-
// ../shared/dist/src/endpoints/companion/dashboards.routes.js
|
|
2126
|
-
var RetrieveDashboard = createRoute({
|
|
2127
|
-
method: "get",
|
|
2128
|
-
path: "/api/v1/dashboard/{dashboard_id}",
|
|
2129
|
-
operationId: "retrieveDashboard",
|
|
2130
|
-
request: {
|
|
2131
|
-
headers: SupabaseHeaderSchema,
|
|
2132
|
-
params: z.object({
|
|
2133
|
-
dashboard_id: DashboardIdParam
|
|
2134
|
-
})
|
|
2135
|
-
},
|
|
2136
|
-
responses: {
|
|
2137
|
-
200: {
|
|
2138
|
-
description: "The dashboard with the given id",
|
|
2139
|
-
content: {
|
|
2140
|
-
"application/json": {
|
|
2141
|
-
schema: FrontendDashboardSchema
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
},
|
|
2145
|
-
404: {
|
|
2146
|
-
content: {
|
|
2147
|
-
"application/json": {
|
|
2148
|
-
schema: z.object({ error: z.string() })
|
|
2149
|
-
}
|
|
2150
|
-
},
|
|
2151
|
-
description: "Unable to retrieve dashboard with this id"
|
|
2152
|
-
},
|
|
2153
|
-
500: {
|
|
2154
|
-
description: "Something wrong happened",
|
|
2155
|
-
content: {
|
|
2156
|
-
"application/json": {
|
|
2157
|
-
schema: z.object({
|
|
2158
|
-
error: z.string()
|
|
2159
|
-
})
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
});
|
|
2165
|
-
|
|
2166
2083
|
// ../shared/dist/src/endpoints/end2end/run.routes.js
|
|
2167
2084
|
var End2EndApiResponseSchema = z.discriminatedUnion("status", [
|
|
2168
2085
|
z.object({
|
|
@@ -2363,6 +2280,289 @@ var hashString = (value) => {
|
|
|
2363
2280
|
const hash = sha256(data);
|
|
2364
2281
|
return Array.from(hash).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
2365
2282
|
};
|
|
2283
|
+
|
|
2284
|
+
// ../shared/dist/src/schemas/canvas.js
|
|
2285
|
+
var CanvasSchema = z.object({
|
|
2286
|
+
company_id: z.number(),
|
|
2287
|
+
created_at: z.string(),
|
|
2288
|
+
id: z.string().uuid(),
|
|
2289
|
+
title: z.string().nullable(),
|
|
2290
|
+
updated_at: z.string(),
|
|
2291
|
+
is_removed: z.boolean(),
|
|
2292
|
+
is_public: z.boolean(),
|
|
2293
|
+
nodes: z.array(z.any()),
|
|
2294
|
+
edges: z.array(z.any())
|
|
2295
|
+
});
|
|
2296
|
+
var FrontendCanvasSchema = CanvasSchema.omit({
|
|
2297
|
+
company_id: true,
|
|
2298
|
+
created_at: true,
|
|
2299
|
+
updated_at: true,
|
|
2300
|
+
is_removed: true
|
|
2301
|
+
});
|
|
2302
|
+
var UpdateCanvasSchema = z.object({
|
|
2303
|
+
id: CanvasSchema.shape.id,
|
|
2304
|
+
title: CanvasSchema.shape.title.optional(),
|
|
2305
|
+
nodes: CanvasSchema.shape.nodes.optional(),
|
|
2306
|
+
edges: CanvasSchema.shape.edges.optional(),
|
|
2307
|
+
is_public: CanvasSchema.shape.is_public.optional()
|
|
2308
|
+
});
|
|
2309
|
+
var CreateCanvasSchema = CanvasSchema.omit({
|
|
2310
|
+
id: true,
|
|
2311
|
+
created_at: true,
|
|
2312
|
+
updated_at: true,
|
|
2313
|
+
company_id: true,
|
|
2314
|
+
is_removed: true
|
|
2315
|
+
}).extend({
|
|
2316
|
+
flow_id: z.string().optional()
|
|
2317
|
+
});
|
|
2318
|
+
var CanvasIdParam = CanvasSchema.shape.id.openapi("CanvasId", {
|
|
2319
|
+
type: "string",
|
|
2320
|
+
format: "uuid"
|
|
2321
|
+
});
|
|
2322
|
+
|
|
2323
|
+
// ../shared/dist/src/endpoints/companion/canvas.routes.js
|
|
2324
|
+
var ListCanvases = createRoute({
|
|
2325
|
+
method: "get",
|
|
2326
|
+
path: "/api/v1/canvases",
|
|
2327
|
+
operationId: "listCanvases",
|
|
2328
|
+
request: {
|
|
2329
|
+
headers: SupabaseHeaderSchema,
|
|
2330
|
+
query: z.object({
|
|
2331
|
+
search: z.string().optional()
|
|
2332
|
+
})
|
|
2333
|
+
},
|
|
2334
|
+
responses: {
|
|
2335
|
+
200: {
|
|
2336
|
+
description: "A list of canvases",
|
|
2337
|
+
content: {
|
|
2338
|
+
"application/json": {
|
|
2339
|
+
schema: z.array(FrontendCanvasSchema.extend({
|
|
2340
|
+
canvas_flows: z.object({
|
|
2341
|
+
flow_id: z.string()
|
|
2342
|
+
}).array()
|
|
2343
|
+
}))
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
},
|
|
2347
|
+
500: {
|
|
2348
|
+
description: "Something wrong happened",
|
|
2349
|
+
content: {
|
|
2350
|
+
"application/json": {
|
|
2351
|
+
schema: z.object({
|
|
2352
|
+
error: z.string()
|
|
2353
|
+
})
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
});
|
|
2359
|
+
var RetrieveCanvas = createRoute({
|
|
2360
|
+
method: "get",
|
|
2361
|
+
path: "/api/v1/canvas/{canvas_id}",
|
|
2362
|
+
operationId: "retrieveCanvas",
|
|
2363
|
+
request: {
|
|
2364
|
+
headers: SupabaseHeaderSchema,
|
|
2365
|
+
params: z.object({
|
|
2366
|
+
canvas_id: CanvasIdParam
|
|
2367
|
+
})
|
|
2368
|
+
},
|
|
2369
|
+
responses: {
|
|
2370
|
+
200: {
|
|
2371
|
+
description: "The canvas with the given id",
|
|
2372
|
+
content: {
|
|
2373
|
+
"application/json": {
|
|
2374
|
+
schema: FrontendCanvasSchema
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
},
|
|
2378
|
+
404: {
|
|
2379
|
+
content: {
|
|
2380
|
+
"application/json": {
|
|
2381
|
+
schema: z.object({ error: z.string() })
|
|
2382
|
+
}
|
|
2383
|
+
},
|
|
2384
|
+
description: "Unable to retrieve canvas with this id"
|
|
2385
|
+
},
|
|
2386
|
+
500: {
|
|
2387
|
+
description: "Something wrong happened",
|
|
2388
|
+
content: {
|
|
2389
|
+
"application/json": {
|
|
2390
|
+
schema: z.object({
|
|
2391
|
+
error: z.string()
|
|
2392
|
+
})
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
});
|
|
2398
|
+
var CreateCanvas = createRoute({
|
|
2399
|
+
method: "post",
|
|
2400
|
+
path: "/api/v1/canvas/",
|
|
2401
|
+
operationId: "createCanvas",
|
|
2402
|
+
request: {
|
|
2403
|
+
headers: SupabaseHeaderSchema,
|
|
2404
|
+
body: {
|
|
2405
|
+
required: true,
|
|
2406
|
+
content: {
|
|
2407
|
+
"application/json": {
|
|
2408
|
+
schema: CreateCanvasSchema
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
},
|
|
2413
|
+
responses: {
|
|
2414
|
+
201: {
|
|
2415
|
+
description: "The created canvas",
|
|
2416
|
+
content: {
|
|
2417
|
+
"application/json": {
|
|
2418
|
+
schema: z.object({
|
|
2419
|
+
id: z.string()
|
|
2420
|
+
})
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
},
|
|
2424
|
+
400: {
|
|
2425
|
+
content: {
|
|
2426
|
+
"application/json": {
|
|
2427
|
+
schema: z.object({ error: z.string() })
|
|
2428
|
+
}
|
|
2429
|
+
},
|
|
2430
|
+
description: "Invalid request"
|
|
2431
|
+
},
|
|
2432
|
+
500: {
|
|
2433
|
+
description: "Something wrong happened",
|
|
2434
|
+
content: {
|
|
2435
|
+
"application/json": {
|
|
2436
|
+
schema: z.object({
|
|
2437
|
+
error: z.string()
|
|
2438
|
+
})
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
});
|
|
2444
|
+
var UpdateCanvas = createRoute({
|
|
2445
|
+
method: "put",
|
|
2446
|
+
path: "/api/v1/canvas/{canvas_id}",
|
|
2447
|
+
operationId: "updateCanvas",
|
|
2448
|
+
request: {
|
|
2449
|
+
headers: SupabaseHeaderSchema,
|
|
2450
|
+
params: z.object({
|
|
2451
|
+
canvas_id: CanvasIdParam
|
|
2452
|
+
}),
|
|
2453
|
+
body: {
|
|
2454
|
+
required: true,
|
|
2455
|
+
content: {
|
|
2456
|
+
"application/json": {
|
|
2457
|
+
schema: UpdateCanvasSchema.omit({ id: true })
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
},
|
|
2462
|
+
responses: {
|
|
2463
|
+
200: {
|
|
2464
|
+
description: "The updated canvas",
|
|
2465
|
+
content: {
|
|
2466
|
+
"application/json": {
|
|
2467
|
+
schema: z.object({
|
|
2468
|
+
success: z.literal(true)
|
|
2469
|
+
})
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
},
|
|
2473
|
+
404: {
|
|
2474
|
+
content: {
|
|
2475
|
+
"application/json": {
|
|
2476
|
+
schema: z.object({ error: z.string() })
|
|
2477
|
+
}
|
|
2478
|
+
},
|
|
2479
|
+
description: "Unable to retrieve canvas with this id"
|
|
2480
|
+
},
|
|
2481
|
+
500: {
|
|
2482
|
+
description: "Something wrong happened",
|
|
2483
|
+
content: {
|
|
2484
|
+
"application/json": {
|
|
2485
|
+
schema: z.object({
|
|
2486
|
+
error: z.string()
|
|
2487
|
+
})
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
});
|
|
2493
|
+
var DeleteCanvas = createRoute({
|
|
2494
|
+
method: "delete",
|
|
2495
|
+
path: "/api/v1/canvas/{canvas_id}",
|
|
2496
|
+
operationId: "deleteCanvas",
|
|
2497
|
+
request: {
|
|
2498
|
+
headers: SupabaseHeaderSchema,
|
|
2499
|
+
params: z.object({
|
|
2500
|
+
canvas_id: CanvasIdParam
|
|
2501
|
+
})
|
|
2502
|
+
},
|
|
2503
|
+
responses: {
|
|
2504
|
+
204: {
|
|
2505
|
+
description: "Canvas deleted successfully"
|
|
2506
|
+
},
|
|
2507
|
+
404: {
|
|
2508
|
+
content: {
|
|
2509
|
+
"application/json": {
|
|
2510
|
+
schema: z.object({ error: z.string() })
|
|
2511
|
+
}
|
|
2512
|
+
},
|
|
2513
|
+
description: "Unable to delete canvas with this id"
|
|
2514
|
+
},
|
|
2515
|
+
500: {
|
|
2516
|
+
description: "Something wrong happened",
|
|
2517
|
+
content: {
|
|
2518
|
+
"application/json": {
|
|
2519
|
+
schema: z.object({
|
|
2520
|
+
error: z.string()
|
|
2521
|
+
})
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
});
|
|
2527
|
+
var GetCanvasForFlow = createRoute({
|
|
2528
|
+
method: "get",
|
|
2529
|
+
path: "/api/v1/canvas/flow/{flow_id}",
|
|
2530
|
+
operationId: "getCanvasForFlow",
|
|
2531
|
+
request: {
|
|
2532
|
+
headers: SupabaseHeaderSchema,
|
|
2533
|
+
params: z.object({
|
|
2534
|
+
flow_id: z.string().uuid()
|
|
2535
|
+
})
|
|
2536
|
+
},
|
|
2537
|
+
responses: {
|
|
2538
|
+
200: {
|
|
2539
|
+
description: "The canvas for the given flow",
|
|
2540
|
+
content: {
|
|
2541
|
+
"application/json": {
|
|
2542
|
+
schema: FrontendCanvasSchema
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
},
|
|
2546
|
+
404: {
|
|
2547
|
+
content: {
|
|
2548
|
+
"application/json": {
|
|
2549
|
+
schema: z.object({ error: z.string() })
|
|
2550
|
+
}
|
|
2551
|
+
},
|
|
2552
|
+
description: "Unable to retrieve canvas for this flow"
|
|
2553
|
+
},
|
|
2554
|
+
500: {
|
|
2555
|
+
description: "Something wrong happened",
|
|
2556
|
+
content: {
|
|
2557
|
+
"application/json": {
|
|
2558
|
+
schema: z.object({
|
|
2559
|
+
error: z.string()
|
|
2560
|
+
})
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
});
|
|
2366
2566
|
var QuickActionSchema = z.object({
|
|
2367
2567
|
label: z.string(),
|
|
2368
2568
|
explanation: z.string()
|
|
@@ -2521,6 +2721,103 @@ createRoute({
|
|
|
2521
2721
|
}
|
|
2522
2722
|
}
|
|
2523
2723
|
});
|
|
2724
|
+
|
|
2725
|
+
// ../shared/dist/src/endpoints/visualizations.routes.js
|
|
2726
|
+
var VisualizationWithDataResponse = z.union([
|
|
2727
|
+
FrontendVisualizationWithDataSchema,
|
|
2728
|
+
V1FrontendVisualizationWithDataSchema
|
|
2729
|
+
]).openapi("VisualizationWithData");
|
|
2730
|
+
createRoute({
|
|
2731
|
+
method: "get",
|
|
2732
|
+
path: "/api/v1/visualizations/{visualization_id}",
|
|
2733
|
+
operationId: "fetchVisualization",
|
|
2734
|
+
request: {
|
|
2735
|
+
headers: SupabaseHeaderSchema,
|
|
2736
|
+
params: z.object({ visualization_id: z.string().pipe(z.coerce.number()) }).openapi("VisualizationId", { type: "number" })
|
|
2737
|
+
},
|
|
2738
|
+
responses: {
|
|
2739
|
+
200: {
|
|
2740
|
+
description: "The content of the visualization",
|
|
2741
|
+
content: {
|
|
2742
|
+
"application/json": {
|
|
2743
|
+
schema: VisualizationWithDataResponse
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
},
|
|
2747
|
+
400: {
|
|
2748
|
+
content: {
|
|
2749
|
+
"application/json": {
|
|
2750
|
+
schema: z.object({ error: z.string() })
|
|
2751
|
+
}
|
|
2752
|
+
},
|
|
2753
|
+
description: "Invalid arguments to fetch visualization"
|
|
2754
|
+
},
|
|
2755
|
+
404: {
|
|
2756
|
+
content: {
|
|
2757
|
+
"application/json": {
|
|
2758
|
+
schema: z.object({ error: z.string() })
|
|
2759
|
+
}
|
|
2760
|
+
},
|
|
2761
|
+
description: "Unable to fetch visualization with this id"
|
|
2762
|
+
},
|
|
2763
|
+
500: {
|
|
2764
|
+
description: "Something wrong happened",
|
|
2765
|
+
content: {
|
|
2766
|
+
"application/json": {
|
|
2767
|
+
schema: z.object({
|
|
2768
|
+
error: z.string()
|
|
2769
|
+
})
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
});
|
|
2775
|
+
var ListVisualizationsForFlow = createRoute({
|
|
2776
|
+
method: "get",
|
|
2777
|
+
path: "/api/v1/flows/{flowId}/visualizations",
|
|
2778
|
+
operationId: "listVisualizationsForFlow",
|
|
2779
|
+
request: {
|
|
2780
|
+
headers: SupabaseHeaderSchema,
|
|
2781
|
+
params: FlowIdParam,
|
|
2782
|
+
query: FlowDataIdParam.partial()
|
|
2783
|
+
},
|
|
2784
|
+
responses: {
|
|
2785
|
+
200: {
|
|
2786
|
+
description: "List visualizations for a given flow. Can be filtered by flow data id as well",
|
|
2787
|
+
content: {
|
|
2788
|
+
"application/json": {
|
|
2789
|
+
schema: FrontendVisualizationSchema.array()
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
},
|
|
2793
|
+
400: {
|
|
2794
|
+
content: {
|
|
2795
|
+
"application/json": {
|
|
2796
|
+
schema: z.object({ error: z.string() })
|
|
2797
|
+
}
|
|
2798
|
+
},
|
|
2799
|
+
description: "Invalid arguments to fetch visualization"
|
|
2800
|
+
},
|
|
2801
|
+
404: {
|
|
2802
|
+
content: {
|
|
2803
|
+
"application/json": {
|
|
2804
|
+
schema: z.object({ error: z.string() })
|
|
2805
|
+
}
|
|
2806
|
+
},
|
|
2807
|
+
description: "Unable to list visualizations"
|
|
2808
|
+
},
|
|
2809
|
+
500: {
|
|
2810
|
+
description: "Something wrong happened",
|
|
2811
|
+
content: {
|
|
2812
|
+
"application/json": {
|
|
2813
|
+
schema: z.object({
|
|
2814
|
+
error: z.string()
|
|
2815
|
+
})
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
});
|
|
2524
2821
|
var DataTableSchema = z.object({
|
|
2525
2822
|
id: z.number(),
|
|
2526
2823
|
dataset: z.string(),
|
|
@@ -2572,7 +2869,7 @@ var toSearchParams = ({ cursor, filters, sorting, limit }) => {
|
|
|
2572
2869
|
|
|
2573
2870
|
// package.json
|
|
2574
2871
|
var package_default = {
|
|
2575
|
-
version: "0.
|
|
2872
|
+
version: "0.2.0"};
|
|
2576
2873
|
var MageMetricsChatTransport = class extends DefaultChatTransport {
|
|
2577
2874
|
constructor(apiUrl, flowId, options) {
|
|
2578
2875
|
super({
|
|
@@ -2757,6 +3054,38 @@ var MageMetricsClient = class {
|
|
|
2757
3054
|
* Public API methods that automatically wait for authentication
|
|
2758
3055
|
*/
|
|
2759
3056
|
api = {
|
|
3057
|
+
getFlowVisualizations: async (flowId) => {
|
|
3058
|
+
await this.waitForAuth();
|
|
3059
|
+
const { data, error, response } = await this.internalApiClient.GET(
|
|
3060
|
+
ListVisualizationsForFlow.path,
|
|
3061
|
+
{ params: { path: { flowId } } }
|
|
3062
|
+
);
|
|
3063
|
+
if (error) {
|
|
3064
|
+
throw new ApiError(error.error, response, {
|
|
3065
|
+
status: response.status,
|
|
3066
|
+
statusText: response.statusText,
|
|
3067
|
+
url: response.url,
|
|
3068
|
+
method: "GET"
|
|
3069
|
+
});
|
|
3070
|
+
}
|
|
3071
|
+
return data;
|
|
3072
|
+
},
|
|
3073
|
+
getFlowDataReports: async (flowId) => {
|
|
3074
|
+
await this.waitForAuth();
|
|
3075
|
+
const { data, error, response } = await this.internalApiClient.GET(
|
|
3076
|
+
RetrieveFlowDataReports.path,
|
|
3077
|
+
{ params: { path: { flowId } } }
|
|
3078
|
+
);
|
|
3079
|
+
if (error) {
|
|
3080
|
+
throw new ApiError(error.error, response, {
|
|
3081
|
+
status: response.status,
|
|
3082
|
+
statusText: response.statusText,
|
|
3083
|
+
url: response.url,
|
|
3084
|
+
method: "GET"
|
|
3085
|
+
});
|
|
3086
|
+
}
|
|
3087
|
+
return data;
|
|
3088
|
+
},
|
|
2760
3089
|
getRecentFlows: async (params = {}) => {
|
|
2761
3090
|
await this.waitForAuth();
|
|
2762
3091
|
const { data, error, response } = await this.internalApiClient.GET(
|
|
@@ -2825,27 +3154,135 @@ var MageMetricsClient = class {
|
|
|
2825
3154
|
return { flowId: data.flowId };
|
|
2826
3155
|
}
|
|
2827
3156
|
},
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
3157
|
+
canvas: {
|
|
3158
|
+
list: async (query) => {
|
|
3159
|
+
await this.waitForAuth();
|
|
3160
|
+
const { data, error, response } = await this.internalApiClient.GET(
|
|
3161
|
+
ListCanvases.path,
|
|
3162
|
+
{
|
|
3163
|
+
params: {
|
|
3164
|
+
query: {
|
|
3165
|
+
search: query
|
|
3166
|
+
}
|
|
2836
3167
|
}
|
|
2837
3168
|
}
|
|
3169
|
+
);
|
|
3170
|
+
if (error) {
|
|
3171
|
+
throw new ApiError(error.error, response, {
|
|
3172
|
+
status: response.status,
|
|
3173
|
+
statusText: response.statusText,
|
|
3174
|
+
url: response.url,
|
|
3175
|
+
method: "GET"
|
|
3176
|
+
});
|
|
2838
3177
|
}
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
3178
|
+
return FrontendCanvasSchema.extend({
|
|
3179
|
+
canvas_flows: z.object({
|
|
3180
|
+
flow_id: z.string()
|
|
3181
|
+
}).array()
|
|
3182
|
+
}).array().parse(data);
|
|
3183
|
+
},
|
|
3184
|
+
get: async (canvasId) => {
|
|
3185
|
+
await this.waitForAuth();
|
|
3186
|
+
const { data, error, response } = await this.internalApiClient.GET(
|
|
3187
|
+
RetrieveCanvas.path,
|
|
3188
|
+
{
|
|
3189
|
+
params: {
|
|
3190
|
+
path: {
|
|
3191
|
+
canvas_id: canvasId
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
);
|
|
3196
|
+
if (error) {
|
|
3197
|
+
throw new ApiError(error.error, response, {
|
|
3198
|
+
status: response.status,
|
|
3199
|
+
statusText: response.statusText,
|
|
3200
|
+
url: response.url,
|
|
3201
|
+
method: "GET"
|
|
3202
|
+
});
|
|
3203
|
+
}
|
|
3204
|
+
return FrontendCanvasSchema.parse(data);
|
|
3205
|
+
},
|
|
3206
|
+
create: async (body) => {
|
|
3207
|
+
await this.waitForAuth();
|
|
3208
|
+
const { data, error, response } = await this.internalApiClient.POST(
|
|
3209
|
+
CreateCanvas.path,
|
|
3210
|
+
{
|
|
3211
|
+
body
|
|
3212
|
+
}
|
|
3213
|
+
);
|
|
3214
|
+
if (!data) {
|
|
3215
|
+
throw new ApiError(error.error, response, {
|
|
3216
|
+
status: response.status,
|
|
3217
|
+
statusText: response.statusText,
|
|
3218
|
+
url: response.url,
|
|
3219
|
+
method: "POST"
|
|
3220
|
+
});
|
|
3221
|
+
}
|
|
3222
|
+
return data;
|
|
3223
|
+
},
|
|
3224
|
+
update: async (body) => {
|
|
3225
|
+
await this.waitForAuth();
|
|
3226
|
+
const { data, error, response } = await this.internalApiClient.PUT(
|
|
3227
|
+
UpdateCanvas.path,
|
|
3228
|
+
{
|
|
3229
|
+
params: {
|
|
3230
|
+
path: {
|
|
3231
|
+
canvas_id: String(body.id)
|
|
3232
|
+
}
|
|
3233
|
+
},
|
|
3234
|
+
body
|
|
3235
|
+
}
|
|
3236
|
+
);
|
|
3237
|
+
if (!data) {
|
|
3238
|
+
throw new ApiError(error.error, response, {
|
|
3239
|
+
status: response.status,
|
|
3240
|
+
statusText: response.statusText,
|
|
3241
|
+
url: response.url,
|
|
3242
|
+
method: "PUT"
|
|
3243
|
+
});
|
|
3244
|
+
}
|
|
3245
|
+
return data;
|
|
3246
|
+
},
|
|
3247
|
+
delete: async (canvasId) => {
|
|
3248
|
+
await this.waitForAuth();
|
|
3249
|
+
const { error, response } = await this.internalApiClient.DELETE(
|
|
3250
|
+
DeleteCanvas.path,
|
|
3251
|
+
{
|
|
3252
|
+
params: { path: { canvas_id: canvasId } }
|
|
3253
|
+
}
|
|
3254
|
+
);
|
|
3255
|
+
if (error) {
|
|
3256
|
+
throw new ApiError(error.error, response, {
|
|
3257
|
+
status: response.status,
|
|
3258
|
+
statusText: response.statusText,
|
|
3259
|
+
url: response.url,
|
|
3260
|
+
method: "DELETE"
|
|
3261
|
+
});
|
|
3262
|
+
}
|
|
3263
|
+
},
|
|
3264
|
+
getForFlow: async (flowId) => {
|
|
3265
|
+
await this.waitForAuth();
|
|
3266
|
+
const { data, error, response } = await this.internalApiClient.GET(
|
|
3267
|
+
GetCanvasForFlow.path,
|
|
3268
|
+
{
|
|
3269
|
+
params: {
|
|
3270
|
+
path: {
|
|
3271
|
+
flow_id: flowId
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
);
|
|
3276
|
+
if (error) {
|
|
3277
|
+
throw new ApiError(error.error, response, {
|
|
3278
|
+
status: response.status,
|
|
3279
|
+
statusText: response.statusText,
|
|
3280
|
+
url: response.url,
|
|
3281
|
+
method: "GET"
|
|
3282
|
+
});
|
|
3283
|
+
}
|
|
3284
|
+
return FrontendCanvasSchema.parse(data);
|
|
2847
3285
|
}
|
|
2848
|
-
return data;
|
|
2849
3286
|
},
|
|
2850
3287
|
exportReportData: async (reportId, format = "blob") => {
|
|
2851
3288
|
await this.waitForAuth();
|