@ocelescope/core 0.10.0 → 0.10.2

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 (35) hide show
  1. package/dist/ActivityPicker-BfA34hBU.js +29 -0
  2. package/dist/{AreaChart-DoD3LM50.js → AreaChart-q6rVcUIp.js} +4 -3
  3. package/dist/AttributePicker-Dd8eKA_3.js +95 -0
  4. package/dist/{BarChart-Cixo5Okd.js → BarChart-BLZS87ex.js} +4 -3
  5. package/dist/E2ORelationPicker-CcDSJWc0.js +46 -0
  6. package/dist/EventAttributePicker-Ch0rYS1h.js +27 -0
  7. package/dist/EventPicker-DbqFMMr2.js +39 -0
  8. package/dist/HistogramChart-GgiQdlsk.js +87 -0
  9. package/dist/{LineChart-CVz-dkJI.js → LineChart-Cq935Tk2.js} +4 -3
  10. package/dist/O2ORelationPicker-_XU1FfIX.js +44 -0
  11. package/dist/ObjectAttributePicker-Dpt3IfC5.js +27 -0
  12. package/dist/ObjectPicker-Bd68wl9p.js +39 -0
  13. package/dist/ObjectTypePicker-CXCMky34.js +42 -0
  14. package/dist/{OcelChart-DvGTjJXo.js → OcelChart-BnXjHb_r.js} +1 -1
  15. package/dist/OptionPicker-D9rUIwbY.js +351 -0
  16. package/dist/{PieChart-DBiASngC.js → PieChart-DZFHaTXD.js} +4 -3
  17. package/dist/{ScatterChart-jIQOjQes.js → ScatterChart-DJfJmABJ.js} +4 -3
  18. package/dist/{SqlChart-bwDArK2l.js → SqlChart-Bf7D5o5P.js} +33 -33
  19. package/dist/{SunburstChart-D6FhYBHI.js → SunburstChart-CMNYlKon.js} +3 -2
  20. package/dist/attributeOptions-D4slIoZx.js +37 -0
  21. package/dist/{cartesian-5TPNWjl_.js → cartesian-Dt7weMqK.js} +1 -1
  22. package/dist/index.d.ts +240 -143
  23. package/dist/index.js +28 -100
  24. package/dist/relationOptions-DTtIOIr1.js +33 -0
  25. package/dist/{series-BBXVjHHY.js → series-W1jsVape.js} +1 -1
  26. package/dist/style.css +596 -731
  27. package/dist/{Plot-CxHHyXot.js → useChart-jzzXgs0j.js} +28 -1
  28. package/dist/{useOcelId-BSU0-Srk.js → useOcelId-DIu_aGLH.js} +5 -2
  29. package/dist/useSearch-Ad3AtTVj.js +19 -0
  30. package/package.json +17 -18
  31. package/dist/ActivityPicker-DbrGeiC_.js +0 -18
  32. package/dist/EventAttributePicker-Cf2vVKv5.js +0 -27
  33. package/dist/NamePicker-Be-qmr1x.js +0 -43
  34. package/dist/ObjectAttributePicker-CL43EsYt.js +0 -27
  35. package/dist/ObjectTypePicker-CKmszS0y.js +0 -18
package/dist/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { t as useCurrentOcel } from "./useCurrentOCEL-BeBa7K0g.js";
2
- import { t as useOcelId } from "./useOcelId-BSU0-Srk.js";
3
2
  import { t as useOcelQuery } from "./useOcelQuery-D1QM-Zgv.js";
4
3
  import { ActionIcon, Anchor, AppShell, Box, Burger, Button, Center, ColorSchemeScript, CopyButton, Divider, Group, LoadingOverlay, MantineProvider, Modal, MultiSelect, NavLink, Select, Stack, Table, Text, ThemeIcon, Tooltip, UnstyledButton, createTheme, mantineHtmlProps, useMantineTheme } from "@mantine/core";
5
- import { getDownloadFlatLogQueryKey, getDownloadOCELQueryKey, getDownloadResourceAsPnmlQueryKey, getDownloadResourceQueryKey, getDownloadVariantFlatLogQueryKey, useActivities, useAggregatedAttributes, useAttributeNames, useE2o, useE2oCombinations, useEventAttributes, useEventIds, useGetDefaultOcel, useGetOcels, useImportDefaultOcel, useLogout, useO2o, useO2oCombinations, useObjectAttributes, useObjectIds, useObjectTypes, useUpload } from "@ocelescope/api-base";
4
+ import { getDownloadFlatLogQueryKey, getDownloadOCELQueryKey, getDownloadResourceAsPnmlQueryKey, getDownloadResourceQueryKey, getDownloadVariantFlatLogQueryKey, useActivities, useAggregatedAttributes, useAttributeNames, useE2o, useE2oCombinations, useEventAttributes, useGetDefaultOcel, useGetOcels, useImportDefaultOcel, useLogout, useO2o, useO2oCombinations, useObjectAttributes, useObjectTypes, useUpload } from "@ocelescope/api-base";
6
5
  import { HydrationBoundary, QueryClient, QueryClientProvider, keepPreviousData, useQueryClient } from "@tanstack/react-query";
7
6
  import { BookOpenIcon, BugIcon, CheckIcon, ChevronDownIcon, ChevronRightIcon, ContainerIcon, DownloadIcon, FilterIcon, GlobeIcon, HelpCircleIcon, LightbulbIcon, LogOutIcon, MailIcon, PackageIcon, PackagePlusIcon, PuzzleIcon, TriangleAlertIcon, UploadIcon, XIcon } from "lucide-react";
8
7
  import { DataTable } from "mantine-datatable";
@@ -17,7 +16,7 @@ import z from "zod";
17
16
  import { Notifications, showNotification } from "@mantine/notifications";
18
17
  import { Theme } from "@r4pm/components/ui";
19
18
  import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
20
- import { useDebouncedValue, useDisclosure } from "@mantine/hooks";
19
+ import { useDisclosure } from "@mantine/hooks";
21
20
  import { env as env$1, useSessionStore } from "@ocelescope/api-client";
22
21
  import Link from "next/link.js";
23
22
  import { useRouter } from "next/router.js";
@@ -365,14 +364,15 @@ const BarList = ({ data, labelHeader, valueHeader = "Frequency", maxVisibleItems
365
364
  //#endregion
366
365
  //#region src/components/charts/index.tsx
367
366
  const browserOnly = (load) => dynamic(load, { ssr: false });
368
- const BarChart = browserOnly(() => import("./BarChart-Cixo5Okd.js").then((n) => n.n).then((module) => module.BarChart));
369
- const LineChart = browserOnly(() => import("./LineChart-CVz-dkJI.js").then((n) => n.n).then((module) => module.LineChart));
370
- const AreaChart = browserOnly(() => import("./AreaChart-DoD3LM50.js").then((n) => n.n).then((module) => module.AreaChart));
371
- const ScatterChart = browserOnly(() => import("./ScatterChart-jIQOjQes.js").then((n) => n.n).then((module) => module.ScatterChart));
372
- const PieChart = browserOnly(() => import("./PieChart-DBiASngC.js").then((n) => n.n).then((module) => module.PieChart));
373
- const SunburstChart = browserOnly(() => import("./SunburstChart-D6FhYBHI.js").then((n) => n.n).then((module) => module.SunburstChart));
374
- const SqlChart = browserOnly(() => import("./SqlChart-bwDArK2l.js").then((module) => module.SqlChart));
375
- const OcelChart = browserOnly(() => import("./OcelChart-DvGTjJXo.js").then((module) => module.OcelChart));
367
+ const BarChart = browserOnly(() => import("./BarChart-BLZS87ex.js").then((n) => n.n).then((module) => module.BarChart));
368
+ const HistogramChart = browserOnly(() => import("./HistogramChart-GgiQdlsk.js").then((n) => n.n).then((module) => module.HistogramChart));
369
+ const LineChart = browserOnly(() => import("./LineChart-Cq935Tk2.js").then((n) => n.n).then((module) => module.LineChart));
370
+ const AreaChart = browserOnly(() => import("./AreaChart-q6rVcUIp.js").then((n) => n.n).then((module) => module.AreaChart));
371
+ const ScatterChart = browserOnly(() => import("./ScatterChart-DJfJmABJ.js").then((n) => n.n).then((module) => module.ScatterChart));
372
+ const PieChart = browserOnly(() => import("./PieChart-DZFHaTXD.js").then((n) => n.n).then((module) => module.PieChart));
373
+ const SunburstChart = browserOnly(() => import("./SunburstChart-CMNYlKon.js").then((n) => n.n).then((module) => module.SunburstChart));
374
+ const SqlChart = browserOnly(() => import("./SqlChart-Bf7D5o5P.js").then((module) => module.SqlChart));
375
+ const OcelChart = browserOnly(() => import("./OcelChart-BnXjHb_r.js").then((module) => module.OcelChart));
376
376
  //#endregion
377
377
  //#region src/components/Dropzone/Dropzone.module.css
378
378
  var Dropzone_module_default = {
@@ -550,6 +550,10 @@ const sseHandler = async (req, res) => {
550
550
  });
551
551
  const webStream = backendRes.body;
552
552
  const nodeStream = Readable.fromWeb(webStream);
553
+ nodeStream.on("error", (err) => {
554
+ if (!controller.signal.aborted) console.error("SSE stream error:", err);
555
+ res.end();
556
+ });
553
557
  nodeStream.pipe(res);
554
558
  res.on("close", () => {
555
559
  console.log("Client disconnected");
@@ -1324,94 +1328,18 @@ const OcelescopeDocument = () => {
1324
1328
  });
1325
1329
  };
1326
1330
  //#endregion
1327
- //#region src/components/pickers/IdPicker.tsx
1328
- /**
1329
- * Picking ids by typing.
1330
- *
1331
- * Presentational: a log holds far more events and objects than a list can
1332
- * show, so the caller decides which ids a search turns up.
1333
- */
1334
- const IdPicker = ({ ids, label, placeholder = "Search…", search, onSearch, loading = false, emptyText, disabled, ...selection }) => {
1335
- const picked = selection.multiple ? [...selection.value] : selection.value ? [selection.value] : [];
1336
- const shared = {
1337
- size: "xs",
1338
- label,
1339
- placeholder,
1340
- searchable: true,
1341
- disabled,
1342
- data: [.../* @__PURE__ */ new Set([...ids, ...picked])],
1343
- searchValue: search,
1344
- onSearchChange: onSearch,
1345
- nothingFoundMessage: emptyText ?? (loading ? "Searching…" : "Nothing found")
1346
- };
1347
- return selection.multiple ? /* @__PURE__ */ jsx(MultiSelect, {
1348
- ...shared,
1349
- value: picked,
1350
- onChange: selection.onChange,
1351
- clearable: true
1352
- }) : /* @__PURE__ */ jsx(Select, {
1353
- ...shared,
1354
- value: picked[0] ?? null,
1355
- onChange: (next) => selection.onChange(next ?? void 0)
1356
- });
1357
- };
1358
- //#endregion
1359
- //#region src/components/pickers/internal/useSearch.ts
1360
- /** What the reader has typed, slowed to one request per pause in typing. */
1361
- const useSearch = () => {
1362
- const [search, setSearch] = useState("");
1363
- const [debounced] = useDebouncedValue(search, 300);
1364
- return {
1365
- search,
1366
- setSearch,
1367
- debounced: debounced || void 0
1368
- };
1369
- };
1370
- //#endregion
1371
- //#region src/components/pickers/EventPicker.tsx
1372
- /** Events of the log, found by typing part of an id. */
1373
- const EventPicker = ({ ocelId, ocelVersion = "filtered", limit = 50, ...picker }) => {
1374
- const id = useOcelId(ocelId);
1375
- const { search, setSearch, debounced } = useSearch();
1376
- const { data, isPending } = useEventIds(id, {
1377
- search: debounced,
1378
- size: limit,
1379
- ocel_version: ocelVersion
1380
- }, { query: { enabled: id != null } });
1381
- return /* @__PURE__ */ jsx(IdPicker, {
1382
- ids: data?.response ?? [],
1383
- search,
1384
- onSearch: setSearch,
1385
- loading: isPending,
1386
- ...picker
1387
- });
1388
- };
1389
- //#endregion
1390
- //#region src/components/pickers/ObjectPicker.tsx
1391
- /** Objects of the log, found by typing part of an id. */
1392
- const ObjectPicker = ({ ocelId, ocelVersion = "filtered", limit = 50, ...picker }) => {
1393
- const id = useOcelId(ocelId);
1394
- const { search, setSearch, debounced } = useSearch();
1395
- const { data, isPending } = useObjectIds(id, {
1396
- search: debounced,
1397
- size: limit,
1398
- ocel_version: ocelVersion
1399
- }, { query: { enabled: id != null } });
1400
- return /* @__PURE__ */ jsx(IdPicker, {
1401
- ids: data?.response ?? [],
1402
- search,
1403
- onSearch: setSearch,
1404
- loading: isPending,
1405
- ...picker
1406
- });
1407
- };
1408
- //#endregion
1409
- //#region src/components/pickers/index.tsx
1410
- const NamePicker = dynamic(() => import("./NamePicker-Be-qmr1x.js").then((module) => module.NamePicker), { ssr: false });
1411
- const ActivityPicker = dynamic(() => import("./ActivityPicker-DbrGeiC_.js").then((module) => module.ActivityPicker), { ssr: false });
1412
- const ObjectTypePicker = dynamic(() => import("./ObjectTypePicker-CKmszS0y.js").then((module) => module.ObjectTypePicker), { ssr: false });
1413
- const EventAttributePicker = dynamic(() => import("./EventAttributePicker-Cf2vVKv5.js").then((module) => module.EventAttributePicker), { ssr: false });
1414
- const ObjectAttributePicker = dynamic(() => import("./ObjectAttributePicker-CL43EsYt.js").then((module) => module.ObjectAttributePicker), { ssr: false });
1331
+ //#region src/components/Pickers/index.tsx
1332
+ const clientOnly = (load) => dynamic(load, { ssr: false });
1333
+ const OptionPicker = clientOnly(() => import("./OptionPicker-D9rUIwbY.js").then((m) => m.OptionPicker));
1334
+ const ActivityPicker = clientOnly(() => import("./ActivityPicker-BfA34hBU.js").then((m) => m.ActivityPicker));
1335
+ const ObjectTypePicker = clientOnly(() => import("./ObjectTypePicker-CXCMky34.js").then((m) => m.ObjectTypePicker));
1336
+ const EventPicker = clientOnly(() => import("./EventPicker-DbqFMMr2.js").then((m) => m.EventPicker));
1337
+ const ObjectPicker = clientOnly(() => import("./ObjectPicker-Bd68wl9p.js").then((m) => m.ObjectPicker));
1338
+ const EventAttributePicker = clientOnly(() => import("./EventAttributePicker-Ch0rYS1h.js").then((m) => m.EventAttributePicker));
1339
+ const ObjectAttributePicker = clientOnly(() => import("./ObjectAttributePicker-Dpt3IfC5.js").then((m) => m.ObjectAttributePicker));
1340
+ const AttributePicker = clientOnly(() => import("./AttributePicker-Dd8eKA_3.js").then((m) => m.AttributePicker));
1341
+ const E2ORelationPicker = clientOnly(() => import("./E2ORelationPicker-CcDSJWc0.js").then((m) => m.E2ORelationPicker));
1342
+ const O2ORelationPicker = clientOnly(() => import("./O2ORelationPicker-_XU1FfIX.js").then((m) => m.O2ORelationPicker));
1415
1343
  //#endregion
1416
1344
  //#region src/components/RelationTable.tsx
1417
1345
  const PAGE_SIZE = 10;
@@ -1713,4 +1641,4 @@ const useDownloadResourceAsPnml = useDownloadFromServer(getDownloadResourceAsPnm
1713
1641
  const defineModule = (def) => def;
1714
1642
  const defineModuleRoute = (def) => def;
1715
1643
  //#endregion
1716
- export { ActivityPicker, AreaChart, AttributesTable, BarChart, BarList, EventAttributePicker, EventPicker, FileDropzone, FullScreenUpload, HelpModal, IdPicker, LineChart, NamePicker, ObjectAttributePicker, ObjectPicker, ObjectTypePicker, OcelChart, OcelSelect, OcelescopeApp, OcelescopeDocument, PieChart, RelationTable, ScatterChart, SqlChart, SunburstChart, UploadModal, UploadSection, createModulesPage, defineModule, defineModuleRoute, env, formatAttributeValue, getModuleRoute, sseHandler, useCurrentOcel, useDownloadFile, useDownloadFlatOCEL, useDownloadOCEL, useDownloadResource, useDownloadResourceAsPnml, useDownloadVariantFlatLog, useInvalidate, useOcelQuery };
1644
+ export { ActivityPicker, AreaChart, AttributePicker, AttributesTable, BarChart, BarList, E2ORelationPicker, EventAttributePicker, EventPicker, FileDropzone, FullScreenUpload, HelpModal, HistogramChart, LineChart, O2ORelationPicker, ObjectAttributePicker, ObjectPicker, ObjectTypePicker, OcelChart, OcelSelect, OcelescopeApp, OcelescopeDocument, OptionPicker, PieChart, RelationTable, ScatterChart, SqlChart, SunburstChart, UploadModal, UploadSection, createModulesPage, defineModule, defineModuleRoute, env, formatAttributeValue, getModuleRoute, sseHandler, useCurrentOcel, useDownloadFile, useDownloadFlatOCEL, useDownloadOCEL, useDownloadResource, useDownloadResourceAsPnml, useDownloadVariantFlatLog, useInvalidate, useOcelQuery };
@@ -0,0 +1,33 @@
1
+ //#region src/components/Pickers/internal/relationOptions.ts
2
+ const relationId = (relation) => JSON.stringify([
3
+ relation.source,
4
+ relation.target,
5
+ relation.qualifier
6
+ ]);
7
+ const relationLabel = (relation) => relation.qualifier ? `${relation.target} · ${relation.qualifier}` : relation.target;
8
+ /**
9
+ * Rows of the E2O or O2O endpoint as options: one per target type and
10
+ * qualifier, counted by how many relations there are. Grouped by source
11
+ * unless the picker is narrowed to one.
12
+ */
13
+ const relationOptions = ({ rows, source, unit, sourceColor, targetColor }) => rows.filter((row) => source === void 0 || row.source === source).map((row) => {
14
+ const relation = {
15
+ source: row.source,
16
+ target: row.target,
17
+ qualifier: row.qualifier
18
+ };
19
+ const perSource = row.min_count === row.max_count ? `${row.min_count}` : `${row.min_count}–${row.max_count}`;
20
+ return {
21
+ value: relation,
22
+ label: relationLabel(relation),
23
+ description: `${perSource} per ${unit}`,
24
+ count: row.sum,
25
+ color: targetColor(row.target),
26
+ group: source === void 0 ? {
27
+ label: row.source,
28
+ color: sourceColor(row.source)
29
+ } : void 0
30
+ };
31
+ });
32
+ //#endregion
33
+ export { relationLabel as n, relationOptions as r, relationId as t };
@@ -1,4 +1,4 @@
1
- import { a as plotted, i as measureOf, r as label } from "./Plot-CxHHyXot.js";
1
+ import { a as measureOf, i as label, o as plotted } from "./useChart-jzzXgs0j.js";
2
2
  //#region src/components/charts/internal/series.ts
3
3
  /**
4
4
  * The rows as traces: one per value of the `series` column, or one per measure