@galaxy-io/filament-ui 0.11.0 → 0.13.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/api/queries/constants.d.ts +1 -0
- package/dist/api/queries/constants.js +2 -1
- package/dist/api/queries/pipelines.d.ts +15 -0
- package/dist/api/queries/pipelines.js +13 -12
- package/dist/api/queries/runs.d.ts +1 -1
- package/dist/api/queries/runs.js +8 -11
- package/dist/api/queries/webhooks.d.ts +61 -0
- package/dist/api/queries/webhooks.js +41 -0
- package/dist/api/utils.d.ts +1 -0
- package/dist/api/utils.js +3 -1
- package/dist/components/connections/ConnectorPreviewChip.js +4 -3
- package/dist/components/webhooks/WebhookDeliveryUrlCopyButton.d.ts +8 -0
- package/dist/components/webhooks/WebhookDeliveryUrlCopyButton.js +33 -0
- package/dist/components/webhooks/WebhookEndpointErrorLayout.d.ts +7 -0
- package/dist/components/webhooks/WebhookEndpointErrorLayout.js +26 -0
- package/dist/components/webhooks/WebhookEndpointStatusBeacon.d.ts +7 -0
- package/dist/components/webhooks/WebhookEndpointStatusBeacon.js +20 -0
- package/dist/components/webhooks/WebhookEndpointStatusCallout.d.ts +8 -0
- package/dist/components/webhooks/WebhookEndpointStatusCallout.js +11 -0
- package/dist/components/webhooks/constants.d.ts +10 -0
- package/dist/components/webhooks/constants.js +36 -0
- package/dist/components/webhooks/hooks/useWebhookEndpointSync.d.ts +8 -0
- package/dist/components/webhooks/hooks/useWebhookEndpointSync.js +112 -0
- package/dist/components/webhooks/types.d.ts +9 -0
- package/dist/components/webhooks/types.js +13 -0
- package/dist/components/webhooks/utils.d.ts +21 -0
- package/dist/components/webhooks/utils.js +47 -0
- package/dist/constants.js +1 -1
- package/dist/gen/ingestion/v1/capabilities_pb.js +1 -1
- package/dist/gen/ingestion/v1/connectors_pb.d.ts +6 -0
- package/dist/gen/ingestion/v1/connectors_pb.js +1 -1
- package/dist/gen/ingestion/v1/runs_pb.d.ts +2 -1
- package/dist/gen/ingestion/v1/service_pb.d.ts +19 -0
- package/dist/gen/ingestion/v1/service_pb.js +5 -3
- package/dist/gen/ingestion/v1/webhooks_pb.d.ts +177 -0
- package/dist/gen/ingestion/v1/webhooks_pb.js +23 -0
- package/dist/hooks/useConfirm.d.ts +1 -1
- package/dist/module/hooks.d.ts +5 -6
- package/dist/module/hooks.js +6 -1
- package/dist/module/routes.d.ts +1 -2
- package/dist/module/schemas.d.ts +1 -2
- package/dist/module/schemas.js +1 -2
- package/dist/pages/connections/ConnectionsPage.js +0 -4
- package/dist/pages/connections/components/card/ConnectionCard.d.ts +0 -1
- package/dist/pages/connections/components/card/ConnectionCard.js +4 -9
- package/dist/pages/connections/components/create/configure/CreateConnectionConfigure.js +48 -11
- package/dist/pages/connections/components/drawer/ConnectionDrawer.js +6 -1
- package/dist/pages/connections/components/drawer/ConnectionDrawerSection.js +1 -1
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhook.d.ts +7 -0
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhook.js +105 -0
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhookSecrets.d.ts +7 -0
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhookSecrets.js +40 -0
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhookSigningKey.d.ts +9 -0
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhookSigningKey.js +120 -0
- package/dist/pages/connections/components/form/ConnectionFormSigningKeyModal.d.ts +9 -0
- package/dist/pages/connections/components/form/ConnectionFormSigningKeyModal.js +66 -0
- package/dist/pages/connections/components/form/ConnectionFormWrapper.d.ts +1 -0
- package/dist/pages/connections/components/form/ConnectionFormWrapper.js +2 -1
- package/dist/pages/connections/components/form/types.d.ts +5 -0
- package/dist/pages/connections/hooks/useConnectionWebhookKeyMint.d.ts +12 -0
- package/dist/pages/connections/hooks/useConnectionWebhookKeyMint.js +27 -0
- package/dist/pages/observability/ObservabilityPage.js +61 -66
- package/dist/pages/observability/components/ObservabilityPageActions.js +1 -3
- package/dist/pages/observability/components/ObservabilityWidgetEmpty.d.ts +8 -0
- package/dist/pages/observability/components/ObservabilityWidgetEmpty.js +30 -0
- package/dist/pages/observability/components/band/ObservabilityBand.d.ts +3 -0
- package/dist/pages/observability/components/band/ObservabilityBand.js +28 -0
- package/dist/pages/observability/components/band/ObservabilityBandList.d.ts +12 -0
- package/dist/pages/observability/components/band/ObservabilityBandList.js +81 -0
- package/dist/pages/observability/components/band/ObservabilityBandMetricTile.d.ts +10 -0
- package/dist/pages/observability/components/band/ObservabilityBandMetricTile.js +86 -0
- package/dist/pages/observability/components/band/ObservabilityBandPivotSelect.d.ts +7 -0
- package/dist/pages/observability/components/band/ObservabilityBandPivotSelect.js +37 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsChart.d.ts +10 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsChart.js +26 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsPastTile.d.ts +3 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsPastTile.js +128 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsTile.d.ts +3 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsTile.js +13 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsUpcomingTile.d.ts +3 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsUpcomingTile.js +63 -0
- package/dist/pages/observability/components/band/ObservabilityBandTile.d.ts +12 -0
- package/dist/pages/observability/components/band/ObservabilityBandTile.js +71 -0
- package/dist/pages/observability/components/band/ObservabilityBandTimeseriesChart.d.ts +14 -0
- package/dist/pages/observability/components/band/ObservabilityBandTimeseriesChart.js +48 -0
- package/dist/pages/observability/components/band/ObservabilityBandTopList.d.ts +12 -0
- package/dist/pages/observability/components/band/ObservabilityBandTopList.js +19 -0
- package/dist/pages/observability/components/band/constants.d.ts +25 -0
- package/dist/pages/observability/components/band/constants.js +81 -0
- package/dist/pages/observability/components/band/types.d.ts +27 -0
- package/dist/pages/observability/components/band/utils.d.ts +25 -0
- package/dist/pages/observability/components/band/utils.js +93 -0
- package/dist/pages/observability/components/connections/ObservabilityConnectionRow.d.ts +9 -0
- package/dist/pages/observability/components/connections/ObservabilityConnectionRow.js +57 -0
- package/dist/pages/observability/components/connections/ObservabilityConnectionsWidget.d.ts +7 -0
- package/dist/pages/observability/components/connections/ObservabilityConnectionsWidget.js +56 -0
- package/dist/pages/observability/components/connections/constants.d.ts +5 -0
- package/dist/pages/observability/components/connections/constants.js +24 -0
- package/dist/pages/observability/components/connections/types.d.ts +4 -0
- package/dist/pages/observability/components/connections/utils.d.ts +4 -0
- package/dist/pages/observability/components/connections/utils.js +23 -0
- package/dist/pages/observability/components/failures/ObservabilityFailuresBanner.d.ts +3 -0
- package/dist/pages/observability/components/failures/ObservabilityFailuresBanner.js +33 -0
- package/dist/pages/observability/components/failures/ObservabilityFailuresDetails.d.ts +7 -0
- package/dist/pages/observability/components/failures/ObservabilityFailuresDetails.js +99 -0
- package/dist/pages/observability/components/failures/constants.d.ts +2 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesBar.d.ts +7 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesBar.js +34 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesColumnCell.d.ts +7 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesColumnCell.js +15 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesHeader.d.ts +3 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesHeader.js +34 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesRow.d.ts +11 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesRow.js +120 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesWidget.d.ts +3 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesWidget.js +142 -0
- package/dist/pages/observability/components/pipelines/constants.d.ts +23 -0
- package/dist/pages/observability/components/pipelines/constants.js +33 -0
- package/dist/pages/observability/components/pipelines/types.d.ts +22 -0
- package/dist/pages/observability/components/pipelines/types.js +11 -0
- package/dist/pages/observability/components/pipelines/utils.d.ts +9 -0
- package/dist/pages/observability/components/pipelines/utils.js +73 -0
- package/dist/pages/observability/components/runs/ObservabilityRunsPastTable.js +6 -13
- package/dist/pages/observability/components/runs/ObservabilityRunsTableActions.d.ts +3 -0
- package/dist/pages/observability/components/runs/ObservabilityRunsTableActions.js +43 -0
- package/dist/pages/observability/components/runs/ObservabilityRunsTableWidget.js +2 -0
- package/dist/pages/observability/components/runs/ObservabilityRunsViewToggle.d.ts +3 -0
- package/dist/pages/observability/components/runs/ObservabilityRunsViewToggle.js +26 -0
- package/dist/pages/observability/components/runs/constants.d.ts +4 -10
- package/dist/pages/observability/components/runs/constants.js +8 -12
- package/dist/pages/observability/components/scheduled/ObservabilityScheduledWidget.d.ts +3 -0
- package/dist/pages/observability/components/scheduled/ObservabilityScheduledWidget.js +94 -0
- package/dist/pages/observability/components/setup/ObservabilitySetupChecklist.js +3 -1
- package/dist/pages/observability/components/setup/constants.js +1 -1
- package/dist/pages/observability/constants.d.ts +18 -3
- package/dist/pages/observability/constants.js +24 -4
- package/dist/pages/observability/hooks/useObservabilityAggregateQuery.d.ts +2 -0
- package/dist/pages/observability/hooks/useObservabilityAggregateQuery.js +13 -0
- package/dist/pages/observability/hooks/useObservabilityBandRanking.d.ts +8 -0
- package/dist/pages/observability/hooks/useObservabilityBandRanking.js +21 -0
- package/dist/pages/observability/hooks/useObservabilityBandUpcoming.d.ts +8 -0
- package/dist/pages/observability/hooks/useObservabilityBandUpcoming.js +45 -0
- package/dist/pages/observability/hooks/useObservabilityMetricInputs.d.ts +9 -0
- package/dist/pages/observability/hooks/useObservabilityMetricInputs.js +33 -0
- package/dist/pages/observability/hooks/useObservabilityPipelines.d.ts +12 -0
- package/dist/pages/observability/hooks/useObservabilityPipelines.js +22 -0
- package/dist/pages/observability/hooks/useObservabilityTimeseriesQuery.d.ts +2 -0
- package/dist/pages/observability/hooks/useObservabilityTimeseriesQuery.js +13 -0
- package/dist/pages/observability/types.d.ts +16 -0
- package/dist/pages/observability/types.js +7 -1
- package/dist/pages/observability/utils.d.ts +6 -1
- package/dist/pages/observability/utils.js +19 -2
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasPanelResourceOptions.js +1 -1
- package/dist/pages/pipelines/canvas/panel/overview/PipelineCanvasPanelOverview.js +1 -1
- package/dist/pages/pipelines/canvas/panel/overview/node/PipelineCanvasPanelNodeDetail.js +1 -1
- package/dist/pages/pipelines/canvas/panel/overview/resource/PipelineCanvasPanelResourceDetail.js +11 -0
- package/dist/pages/pipelines/canvas/panel/overview/resource/PipelineCanvasPanelResourceEndpoint.js +1 -1
- package/dist/pages/pipelines/canvas/panel/overview/resource/PipelineCanvasPanelResourceSection.js +4 -1
- package/dist/pages/pipelines/canvas/routes/hooks/usePipelineCanvasRoutes.js +1 -1
- package/dist/pages/pipelines/components/create/components/CreatePipelineModalFooter.js +7 -1
- package/dist/pages/pipelines/components/create/hooks/useCreatePipelineResources.js +2 -2
- package/dist/pages/pipelines/components/create/steps/CreatePipelineModalResources.js +5 -2
- package/dist/pages/pipelines/components/create/steps/components/CreatePipelineModalResourcesTable.js +15 -2
- package/dist/pages/pipelines/components/create/steps/components/CreatePipelineModalResourcesUrlCell.d.ts +7 -0
- package/dist/pages/pipelines/components/create/steps/components/CreatePipelineModalResourcesUrlCell.js +27 -0
- package/dist/pages/pipelines/components/header/PipelinePageEditActions.js +10 -0
- package/dist/pages/pipelines/components/header/PipelinePageHeading.js +1 -1
- package/dist/pages/pipelines/components/resource/PipelineResourceCreateForm.d.ts +1 -0
- package/dist/pages/pipelines/components/resource/PipelineResourceCreateForm.js +10 -3
- package/dist/pages/pipelines/components/run/PipelineRunModal.js +7 -4
- package/dist/pages/pipelines/components/run/PipelineRunModalResourcesPane.d.ts +1 -0
- package/dist/pages/pipelines/components/run/PipelineRunModalResourcesPane.js +5 -4
- package/dist/pages/pipelines/components/run/utils.d.ts +1 -0
- package/dist/pages/pipelines/components/run/utils.js +2 -1
- package/dist/pages/pipelines/components/table/PipelinesTable.js +1 -1
- package/dist/pages/pipelines/settings/PipelineSettingsPageAdvanced.js +1 -1
- package/dist/pages/pipelines/settings/PipelineSettingsPageDanger.js +1 -1
- package/dist/pages/pipelines/settings/PipelineSettingsPageGeneral.js +2 -2
- package/dist/pages/pipelines/settings/PipelineSettingsPageSchedule.js +1 -1
- package/dist/styles.css +15 -0
- package/dist/utils/errors.d.ts +2 -0
- package/dist/utils/errors.js +6 -1
- package/package.json +1 -1
- package/dist/pages/observability/components/metrics/ObservabilityMetricsWidget.d.ts +0 -3
- package/dist/pages/observability/components/metrics/ObservabilityMetricsWidget.js +0 -139
- package/dist/pages/observability/components/metrics/constants.d.ts +0 -3
- package/dist/pages/observability/components/metrics/constants.js +0 -11
- package/dist/pages/observability/components/runs/ObservabilityRunsChart.d.ts +0 -3
- package/dist/pages/observability/components/runs/ObservabilityRunsChart.js +0 -66
- package/dist/pages/observability/components/runs/ObservabilityRunsChartWidget.d.ts +0 -3
- package/dist/pages/observability/components/runs/ObservabilityRunsChartWidget.js +0 -75
- package/dist/pages/observability/components/runs/ObservabilityRunsScheduledChart.d.ts +0 -3
- package/dist/pages/observability/components/runs/ObservabilityRunsScheduledChart.js +0 -39
- package/dist/pages/observability/components/runs/types.d.ts +0 -1
- package/dist/pages/observability/components/runs/utils.d.ts +0 -14
- package/dist/pages/observability/components/runs/utils.js +0 -71
- package/dist/pages/observability/components/timeseries/ObservabilityPivotSelect.d.ts +0 -8
- package/dist/pages/observability/components/timeseries/ObservabilityPivotSelect.js +0 -28
- package/dist/pages/observability/components/timeseries/ObservabilityTimeseriesChart.d.ts +0 -14
- package/dist/pages/observability/components/timeseries/ObservabilityTimeseriesChart.js +0 -105
- package/dist/pages/observability/components/timeseries/ObservabilityTimeseriesWidget.d.ts +0 -19
- package/dist/pages/observability/components/timeseries/ObservabilityTimeseriesWidget.js +0 -61
- package/dist/pages/observability/components/timeseries/constants.d.ts +0 -19
- package/dist/pages/observability/components/timeseries/constants.js +0 -57
|
@@ -6,5 +6,6 @@ var PROBE_QUERY_OPTIONS = {
|
|
|
6
6
|
refetchOnWindowFocus: false
|
|
7
7
|
};
|
|
8
8
|
var ACTIVE_RUNS_REFETCH_INTERVAL = 3e3;
|
|
9
|
+
var SCHEDULED_REFETCH_MAX_INTERVAL = 6e4;
|
|
9
10
|
//#endregion
|
|
10
|
-
export { ACTIVE_RUNS_REFETCH_INTERVAL, PROBE_QUERY_OPTIONS };
|
|
11
|
+
export { ACTIVE_RUNS_REFETCH_INTERVAL, PROBE_QUERY_OPTIONS, SCHEDULED_REFETCH_MAX_INTERVAL };
|
|
@@ -34,6 +34,21 @@ export declare const useSuspenseListPipelinesInfiniteQuery: ({ input, }?: {
|
|
|
34
34
|
input?: InfiniteQueryInput<typeof IngestionService.method.listPipelines.input>;
|
|
35
35
|
}) => import('@tanstack/react-query').UseSuspenseInfiniteQueryResult<import('@tanstack/react-query').InfiniteData<ListPipelinesResponse, unknown>, import('@connectrpc/connect').ConnectError>;
|
|
36
36
|
export declare const createGetPipelineInput: (id: Pipeline["id"]) => GetPipelineRequest;
|
|
37
|
+
export declare const createGetPipelineQueryOptions: ({ input, transport, }: {
|
|
38
|
+
input: GetPipelineRequest;
|
|
39
|
+
transport: Transport;
|
|
40
|
+
}) => import('@connectrpc/connect-query').QueryOptions<Omit<import('@bufbuild/protobuf').DescMessage, "field" | "typeName"> & {
|
|
41
|
+
field: Record<"pipeline", import('@bufbuild/protobuf').DescField>;
|
|
42
|
+
typeName: "ingestion.v1.GetPipelineResponse";
|
|
43
|
+
} & {
|
|
44
|
+
readonly $codegenv2: {
|
|
45
|
+
a: GetPipelineResponse;
|
|
46
|
+
b: {
|
|
47
|
+
jsonType?: unknown;
|
|
48
|
+
validType?: unknown;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
} & import('@bufbuild/protobuf').DescMessage>;
|
|
37
52
|
export declare const createGetPipelineQueryKey: (input?: GetPipelineRequest, transport?: Transport) => ["connect-query", {
|
|
38
53
|
transport?: string;
|
|
39
54
|
serviceName: string;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { GetPipelineRequestSchema } from "../../gen/ingestion/v1/pipelines_pb.js";
|
|
2
2
|
import { IngestionService } from "../../gen/ingestion/v1/service_pb.js";
|
|
3
|
-
import { INITIAL_PAGE_PARAM, createListSearchInput, getNextPageParam } from "../utils.js";
|
|
4
3
|
import { ACTIVE_RUNS_REFETCH_INTERVAL } from "./constants.js";
|
|
4
|
+
import { createGetWebhookEndpointQueryKey } from "./webhooks.js";
|
|
5
|
+
import { INITIAL_PAGE_PARAM, createListSearchInput, getNextPageParam, getScheduledRefetchInterval } from "../utils.js";
|
|
5
6
|
import { isRunActive } from "../../utils/runs.js";
|
|
6
7
|
import { createListRunsQueryKey } from "./runs.js";
|
|
7
8
|
import { create } from "@bufbuild/protobuf";
|
|
8
|
-
import {
|
|
9
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
9
10
|
import { createConnectQueryKey, createQueryOptions, useMutation, useQuery, useSuspenseInfiniteQuery, useSuspenseQuery, useTransport } from "@connectrpc/connect-query";
|
|
10
11
|
//#region src/api/queries/pipelines.ts
|
|
11
12
|
var getListPipelinesRefetchInterval = (pipelines) => {
|
|
12
|
-
|
|
13
|
+
if (!pipelines) return false;
|
|
14
|
+
if (pipelines.some((pipeline) => pipeline.lastRun && isRunActive(pipeline.lastRun))) return ACTIVE_RUNS_REFETCH_INTERVAL;
|
|
15
|
+
const waits = pipelines.flatMap((pipeline) => pipeline.schedule?.config?.isEnabled && pipeline.schedule.nextFireAt ? [Number(pipeline.schedule.nextFireAt) - Date.now()] : []);
|
|
16
|
+
return getScheduledRefetchInterval(waits, ACTIVE_RUNS_REFETCH_INTERVAL);
|
|
13
17
|
};
|
|
14
18
|
var createListPipelinesInput = (search) => ({
|
|
15
19
|
includeLastRun: true,
|
|
@@ -54,6 +58,9 @@ var createGetPipelineInput = (id) => create(GetPipelineRequestSchema, {
|
|
|
54
58
|
includeVersions: true,
|
|
55
59
|
includeSchedule: true
|
|
56
60
|
});
|
|
61
|
+
var createGetPipelineQueryOptions = ({ input, transport }) => {
|
|
62
|
+
return createQueryOptions(IngestionService.method.getPipeline, input, { transport });
|
|
63
|
+
};
|
|
57
64
|
var createGetPipelineQueryKey = (input, transport) => {
|
|
58
65
|
return createConnectQueryKey({
|
|
59
66
|
schema: IngestionService.method.getPipeline,
|
|
@@ -68,14 +75,6 @@ var useGetPipelineQuery = ({ input, options = {} }) => {
|
|
|
68
75
|
var useSuspenseGetPipelineQuery = ({ input }) => {
|
|
69
76
|
return useSuspenseQuery(IngestionService.method.getPipeline, input);
|
|
70
77
|
};
|
|
71
|
-
var selectPipelines = (results) => results.flatMap((result) => result.data?.pipeline ?? []);
|
|
72
|
-
var useGetPipelineQueries = (ids) => {
|
|
73
|
-
const transport = useTransport();
|
|
74
|
-
return useQueries({
|
|
75
|
-
queries: ids.map((id) => createQueryOptions(IngestionService.method.getPipeline, createGetPipelineInput(id), { transport })),
|
|
76
|
-
combine: selectPipelines
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
78
|
var useCreatePipelineMutation = (options = {}) => {
|
|
80
79
|
const queryClient = useQueryClient();
|
|
81
80
|
const transport = useTransport();
|
|
@@ -95,6 +94,7 @@ var useUpdatePipelineMutation = (options = {}) => {
|
|
|
95
94
|
onSettled: (...args) => {
|
|
96
95
|
queryClient.invalidateQueries({ queryKey: createListPipelinesQueryKey(void 0, transport) });
|
|
97
96
|
queryClient.invalidateQueries({ queryKey: createGetPipelineQueryKey(void 0, transport) });
|
|
97
|
+
queryClient.invalidateQueries({ queryKey: createGetWebhookEndpointQueryKey(void 0, transport) });
|
|
98
98
|
return options.onSettled?.(...args);
|
|
99
99
|
}
|
|
100
100
|
});
|
|
@@ -108,9 +108,10 @@ var useDeletePipelineMutation = (options = {}) => {
|
|
|
108
108
|
queryClient.invalidateQueries({ queryKey: createListPipelinesQueryKey(void 0, transport) });
|
|
109
109
|
queryClient.invalidateQueries({ queryKey: createGetPipelineQueryKey(void 0, transport) });
|
|
110
110
|
queryClient.invalidateQueries({ queryKey: createListRunsQueryKey(void 0, transport) });
|
|
111
|
+
queryClient.invalidateQueries({ queryKey: createGetWebhookEndpointQueryKey(void 0, transport) });
|
|
111
112
|
return options.onSettled?.(...args);
|
|
112
113
|
}
|
|
113
114
|
});
|
|
114
115
|
};
|
|
115
116
|
//#endregion
|
|
116
|
-
export { createGetPipelineInput, createGetPipelineQueryKey, createListPipelinesInput, createListPipelinesQueryKey, useCreatePipelineMutation, useDeletePipelineMutation,
|
|
117
|
+
export { createGetPipelineInput, createGetPipelineQueryKey, createGetPipelineQueryOptions, createListPipelinesInput, createListPipelinesQueryKey, useCreatePipelineMutation, useDeletePipelineMutation, useGetPipelineQuery, useListPipelinesQuery, useSuspenseGetPipelineQuery, useSuspenseListPipelinesInfiniteQuery, useSuspenseListPipelinesQuery, useUpdatePipelineMutation };
|
|
@@ -5,7 +5,7 @@ import { GetRunRequest, GetRunResponse, ListRunsRequest, ListRunsResponse, RunEv
|
|
|
5
5
|
import { IngestionService } from '../../gen/ingestion/v1/service_pb';
|
|
6
6
|
import { InfiniteQueryInput, UseInfiniteQueryOptions } from '../utils';
|
|
7
7
|
export declare const createListRunsQueryKey: (input?: ListRunsRequest, transport?: Transport) => import('@connectrpc/connect-query').ConnectQueryKey<Omit<import('@bufbuild/protobuf').DescMessage, "field" | "typeName"> & {
|
|
8
|
-
field: Record<"
|
|
8
|
+
field: Record<"pagination" | "runs", import('@bufbuild/protobuf').DescField>;
|
|
9
9
|
typeName: "ingestion.v1.ListRunsResponse";
|
|
10
10
|
} & {
|
|
11
11
|
readonly $codegenv2: {
|
package/dist/api/queries/runs.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ListRunsRequestSchema, RunStatus, TailRunRequestSchema } from "../../gen/ingestion/v1/runs_pb.js";
|
|
2
2
|
import { ACTIVE_RUN_STATUSES } from "../../constants.js";
|
|
3
3
|
import { IngestionService } from "../../gen/ingestion/v1/service_pb.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { ACTIVE_RUNS_REFETCH_INTERVAL, SCHEDULED_REFETCH_MAX_INTERVAL } from "./constants.js";
|
|
5
|
+
import { createGetWebhookEndpointQueryKey } from "./webhooks.js";
|
|
6
|
+
import { INITIAL_PAGE_PARAM, batchIterable, getNextPageParam, getScheduledRefetchInterval } from "../utils.js";
|
|
6
7
|
import { isRunActive } from "../../utils/runs.js";
|
|
7
8
|
import { createGetPipelineInput, createGetPipelineQueryKey, createListPipelinesQueryKey, useGetPipelineQuery } from "./pipelines.js";
|
|
8
9
|
import { create } from "@bufbuild/protobuf";
|
|
@@ -20,18 +21,12 @@ var createListRunsQueryKey = (input, transport) => {
|
|
|
20
21
|
cardinality: void 0
|
|
21
22
|
});
|
|
22
23
|
};
|
|
23
|
-
var SCHEDULED_REFETCH_MAX_INTERVAL = 6e4;
|
|
24
24
|
var IDLE_RUNS_REFETCH_INTERVAL = 3e4;
|
|
25
|
-
var
|
|
26
|
-
const scheduled = runs.filter((run) => run.status === RunStatus.SCHEDULED);
|
|
27
|
-
if (scheduled.length === 0) return false;
|
|
28
|
-
const waits = scheduled.map((run) => run.scheduledAt ? Number(run.scheduledAt) - Date.now() : SCHEDULED_REFETCH_MAX_INTERVAL);
|
|
29
|
-
return Math.min(Math.max(Math.min(...waits), floor), SCHEDULED_REFETCH_MAX_INTERVAL);
|
|
30
|
-
};
|
|
25
|
+
var getRunsScheduledRefetchInterval = (runs, floor) => getScheduledRefetchInterval(runs.filter((run) => run.status === RunStatus.SCHEDULED).map((run) => run.scheduledAt ? Number(run.scheduledAt) - Date.now() : SCHEDULED_REFETCH_MAX_INTERVAL), floor);
|
|
31
26
|
var getListRunsRefetchInterval = (runs) => {
|
|
32
27
|
if (!runs) return false;
|
|
33
28
|
if (runs.some((run) => isRunActive(run))) return ACTIVE_RUNS_REFETCH_INTERVAL;
|
|
34
|
-
return
|
|
29
|
+
return getRunsScheduledRefetchInterval(runs, ACTIVE_RUNS_REFETCH_INTERVAL);
|
|
35
30
|
};
|
|
36
31
|
var getActiveRunsRefetchInterval = (runs, nextFireAt) => {
|
|
37
32
|
if (runs?.some((run) => isRunActive(run))) return ACTIVE_RUNS_REFETCH_INTERVAL;
|
|
@@ -110,7 +105,7 @@ var useSuspenseListRunsInfiniteQuery = ({ input } = {}) => {
|
|
|
110
105
|
var getGetRunRefetchInterval = (run) => {
|
|
111
106
|
if (!run) return false;
|
|
112
107
|
if (isRunActive(run)) return GET_RUN_REFETCH_INTERVAL;
|
|
113
|
-
return
|
|
108
|
+
return getRunsScheduledRefetchInterval([run], GET_RUN_REFETCH_INTERVAL);
|
|
114
109
|
};
|
|
115
110
|
var createGetRunQueryKey = (input, transport) => {
|
|
116
111
|
return createConnectQueryKey({
|
|
@@ -171,6 +166,7 @@ var useRunPipelineMutation = (options = {}) => {
|
|
|
171
166
|
queryClient.invalidateQueries({ queryKey: createListRunsQueryKey(void 0, transport) });
|
|
172
167
|
queryClient.invalidateQueries({ queryKey: createListPipelinesQueryKey(void 0, transport) });
|
|
173
168
|
queryClient.invalidateQueries({ queryKey: createGetPipelineQueryKey(void 0, transport) });
|
|
169
|
+
queryClient.invalidateQueries({ queryKey: createGetWebhookEndpointQueryKey(void 0, transport) });
|
|
174
170
|
return options.onSettled?.(...args);
|
|
175
171
|
}
|
|
176
172
|
});
|
|
@@ -185,6 +181,7 @@ var useSignalRunMutation = (options = {}) => {
|
|
|
185
181
|
queryClient.invalidateQueries({ queryKey: createGetPipelineQueryKey(void 0, transport) });
|
|
186
182
|
queryClient.invalidateQueries({ queryKey: createListPipelinesQueryKey(void 0, transport) });
|
|
187
183
|
queryClient.invalidateQueries({ queryKey: createListRunsQueryKey(void 0, transport) });
|
|
184
|
+
queryClient.invalidateQueries({ queryKey: createGetWebhookEndpointQueryKey(void 0, transport) });
|
|
188
185
|
return options.onSettled?.(...args);
|
|
189
186
|
}
|
|
190
187
|
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Transport } from '@connectrpc/connect';
|
|
2
|
+
import { UseMutationOptions, UseQueryOptions } from '@connectrpc/connect-query';
|
|
3
|
+
import { Connection } from '../../gen/ingestion/v1/connections_pb';
|
|
4
|
+
import { IngestionService } from '../../gen/ingestion/v1/service_pb';
|
|
5
|
+
import { GetWebhookEndpointRequest, GetWebhookEndpointResponse, WebhookEndpointConfig } from '../../gen/ingestion/v1/webhooks_pb';
|
|
6
|
+
export declare const createGetWebhookEndpointInput: (sourceConnectionId: Connection["id"]) => GetWebhookEndpointRequest;
|
|
7
|
+
export declare const createGetWebhookEndpointQueryOptions: ({ input, transport, }: {
|
|
8
|
+
input: GetWebhookEndpointRequest;
|
|
9
|
+
transport: Transport;
|
|
10
|
+
}) => import('@connectrpc/connect-query').QueryOptions<Omit<import('@bufbuild/protobuf').DescMessage, "field" | "typeName"> & {
|
|
11
|
+
field: Record<"endpoint", import('@bufbuild/protobuf').DescField>;
|
|
12
|
+
typeName: "ingestion.v1.GetWebhookEndpointResponse";
|
|
13
|
+
} & {
|
|
14
|
+
readonly $codegenv2: {
|
|
15
|
+
a: GetWebhookEndpointResponse;
|
|
16
|
+
b: {
|
|
17
|
+
jsonType?: unknown;
|
|
18
|
+
validType?: unknown;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
} & import('@bufbuild/protobuf').DescMessage>;
|
|
22
|
+
export declare const createGetWebhookEndpointQueryKey: (input?: GetWebhookEndpointRequest, transport?: Transport) => ["connect-query", {
|
|
23
|
+
transport?: string;
|
|
24
|
+
serviceName: string;
|
|
25
|
+
methodName?: string;
|
|
26
|
+
input?: Record<string, unknown> | "skipped";
|
|
27
|
+
headers?: Record<string, string>;
|
|
28
|
+
} & {
|
|
29
|
+
cardinality: "finite";
|
|
30
|
+
}] & {
|
|
31
|
+
[dataTagSymbol]: GetWebhookEndpointResponse;
|
|
32
|
+
[dataTagErrorSymbol]: import('@connectrpc/connect').ConnectError;
|
|
33
|
+
};
|
|
34
|
+
export declare const useGetWebhookEndpointQuery: ({ input, options, }: {
|
|
35
|
+
input: GetWebhookEndpointRequest;
|
|
36
|
+
options?: UseQueryOptions<typeof IngestionService.method.getWebhookEndpoint.output, GetWebhookEndpointResponse>;
|
|
37
|
+
}) => import('@tanstack/react-query').UseQueryResult<GetWebhookEndpointResponse, import('@connectrpc/connect').ConnectError>;
|
|
38
|
+
export declare const usePutWebhookEndpointMutation: (options?: UseMutationOptions<typeof IngestionService.method.putWebhookEndpoint.input, typeof IngestionService.method.putWebhookEndpoint.output>) => import('@tanstack/react-query').UseMutationResult<import('../../gen/ingestion/v1/webhooks_pb').PutWebhookEndpointResponse, import('@connectrpc/connect').ConnectError, import('../../gen/ingestion/v1/webhooks_pb').PutWebhookEndpointRequest | {
|
|
39
|
+
readonly $typeName?: undefined;
|
|
40
|
+
endpoint?: (WebhookEndpointConfig | {
|
|
41
|
+
readonly $typeName?: undefined;
|
|
42
|
+
sourceConnectionId?: string | undefined;
|
|
43
|
+
pipelineId?: string | undefined;
|
|
44
|
+
routeKey?: string | undefined;
|
|
45
|
+
resources?: string[] | undefined;
|
|
46
|
+
enabled?: boolean | undefined;
|
|
47
|
+
revision?: bigint | undefined;
|
|
48
|
+
successStatus?: number | undefined;
|
|
49
|
+
maxBodyBytes?: bigint | undefined;
|
|
50
|
+
hasSigningSecret?: boolean | undefined;
|
|
51
|
+
routeReady?: boolean | undefined;
|
|
52
|
+
verifier?: string | undefined;
|
|
53
|
+
previousKeyExpiresAt?: bigint | undefined;
|
|
54
|
+
accepting?: boolean | undefined;
|
|
55
|
+
deliveryUrl?: string | undefined;
|
|
56
|
+
}) | undefined;
|
|
57
|
+
expectedRevision?: bigint | undefined;
|
|
58
|
+
importedSecret?: string | undefined;
|
|
59
|
+
mintSecret?: boolean | undefined;
|
|
60
|
+
expectedPipelineVersionId?: string | undefined;
|
|
61
|
+
}, unknown>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { GetWebhookEndpointRequestSchema } from "../../gen/ingestion/v1/webhooks_pb.js";
|
|
2
|
+
import { IngestionService } from "../../gen/ingestion/v1/service_pb.js";
|
|
3
|
+
import { createDiscoverResourcesQueryKey } from "./connectors.js";
|
|
4
|
+
import { ACTIVE_RUNS_REFETCH_INTERVAL } from "./constants.js";
|
|
5
|
+
import { create } from "@bufbuild/protobuf";
|
|
6
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
7
|
+
import { createConnectQueryKey, createQueryOptions, useMutation, useQuery, useTransport } from "@connectrpc/connect-query";
|
|
8
|
+
//#region src/api/queries/webhooks.ts
|
|
9
|
+
var getWebhookEndpointRefetchInterval = (endpoint) => endpoint?.enabled && endpoint.pipelineId && (endpoint.accepting || !endpoint.routeReady) ? ACTIVE_RUNS_REFETCH_INTERVAL : false;
|
|
10
|
+
var createGetWebhookEndpointInput = (sourceConnectionId) => create(GetWebhookEndpointRequestSchema, { sourceConnectionId });
|
|
11
|
+
var createGetWebhookEndpointQueryOptions = ({ input, transport }) => {
|
|
12
|
+
return createQueryOptions(IngestionService.method.getWebhookEndpoint, input, { transport });
|
|
13
|
+
};
|
|
14
|
+
var createGetWebhookEndpointQueryKey = (input, transport) => {
|
|
15
|
+
return createConnectQueryKey({
|
|
16
|
+
schema: IngestionService.method.getWebhookEndpoint,
|
|
17
|
+
input,
|
|
18
|
+
transport,
|
|
19
|
+
cardinality: "finite"
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var useGetWebhookEndpointQuery = ({ input, options = {} }) => {
|
|
23
|
+
return useQuery(IngestionService.method.getWebhookEndpoint, input, {
|
|
24
|
+
refetchInterval: (query) => getWebhookEndpointRefetchInterval(query.state.data?.endpoint),
|
|
25
|
+
...options
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var usePutWebhookEndpointMutation = (options = {}) => {
|
|
29
|
+
const queryClient = useQueryClient();
|
|
30
|
+
const transport = useTransport();
|
|
31
|
+
return useMutation(IngestionService.method.putWebhookEndpoint, {
|
|
32
|
+
...options,
|
|
33
|
+
onSettled: (...args) => {
|
|
34
|
+
queryClient.invalidateQueries({ queryKey: createGetWebhookEndpointQueryKey(void 0, transport) });
|
|
35
|
+
queryClient.invalidateQueries({ queryKey: createDiscoverResourcesQueryKey(void 0, transport) });
|
|
36
|
+
return options.onSettled?.(...args);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { createGetWebhookEndpointInput, createGetWebhookEndpointQueryKey, createGetWebhookEndpointQueryOptions, useGetWebhookEndpointQuery, usePutWebhookEndpointMutation };
|
package/dist/api/utils.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export declare const createListSearchInput: ({ q, sortBy, sortOrder }: ListSearc
|
|
|
18
18
|
sorting: import('../gen/ingestion/v1/sorting_pb').SortingRequest;
|
|
19
19
|
};
|
|
20
20
|
export declare function batchIterable<T>(source: AsyncIterable<T>, intervalMs: number): AsyncGenerator<T[]>;
|
|
21
|
+
export declare const getScheduledRefetchInterval: (waits: number[], floor: number) => number | false;
|
package/dist/api/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SortBy, SortOrder, SortingRequestSchema } from "../gen/ingestion/v1/sorting_pb.js";
|
|
2
|
+
import { SCHEDULED_REFETCH_MAX_INTERVAL } from "./queries/constants.js";
|
|
2
3
|
import { create } from "@bufbuild/protobuf";
|
|
3
4
|
//#region src/api/utils.ts
|
|
4
5
|
var DEFAULT_PAGE_SIZE = 25;
|
|
@@ -56,5 +57,6 @@ async function* batchIterable(source, intervalMs) {
|
|
|
56
57
|
await iterator.return?.();
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
var getScheduledRefetchInterval = (waits, floor) => waits.length === 0 ? false : Math.min(Math.max(Math.min(...waits), floor), SCHEDULED_REFETCH_MAX_INTERVAL);
|
|
59
61
|
//#endregion
|
|
60
|
-
export { INITIAL_PAGE_PARAM, batchIterable, createListSearchInput, createListSortingInput, getNextPageParam };
|
|
62
|
+
export { INITIAL_PAGE_PARAM, batchIterable, createListSearchInput, createListSortingInput, getNextPageParam, getScheduledRefetchInterval };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { FlaskIcon } from "@phosphor-icons/react";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import Chip, { ChipSize
|
|
3
|
+
import Chip, { ChipSize } from "@galaxy-io/dls/chips/Chip";
|
|
3
4
|
//#region src/components/connections/ConnectorPreviewChip.tsx
|
|
4
5
|
var ConnectorPreviewChip = ({ isPreview }) => isPreview ? /* @__PURE__ */ jsx(Chip, {
|
|
5
|
-
|
|
6
|
+
icon: FlaskIcon,
|
|
7
|
+
ariaLabel: "This connector is in preview",
|
|
6
8
|
tooltip: "This connector is in preview",
|
|
7
|
-
variant: ChipVariant.TERTIARY,
|
|
8
9
|
size: ChipSize.SMALL
|
|
9
10
|
}) : null;
|
|
10
11
|
//#endregion
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Connection } from '../../gen/ingestion/v1/connections_pb';
|
|
3
|
+
interface WebhookDeliveryUrlCopyButtonProps {
|
|
4
|
+
sourceConnectionId: Connection["id"];
|
|
5
|
+
resource: string;
|
|
6
|
+
}
|
|
7
|
+
declare const WebhookDeliveryUrlCopyButton: FC<WebhookDeliveryUrlCopyButtonProps>;
|
|
8
|
+
export default WebhookDeliveryUrlCopyButton;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createWebhookDeliveryUrl } from "./utils.js";
|
|
2
|
+
import { createGetWebhookEndpointInput, useGetWebhookEndpointQuery } from "../../api/queries/webhooks.js";
|
|
3
|
+
import { ButtonSize, ButtonVariant } from "@galaxy-io/dls/buttons/Button";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import Text, { TextSize } from "@galaxy-io/dls/text/Text";
|
|
6
|
+
import { FontFamily } from "@galaxy-io/dls/theme/enums";
|
|
7
|
+
import CopyButton from "@galaxy-io/dls/buttons/CopyButton";
|
|
8
|
+
import Tooltip from "@galaxy-io/dls/tooltip/Tooltip";
|
|
9
|
+
//#region src/components/webhooks/WebhookDeliveryUrlCopyButton.tsx
|
|
10
|
+
var WebhookDeliveryUrlCopyButton = ({ sourceConnectionId, resource }) => {
|
|
11
|
+
const { data, isLoading } = useGetWebhookEndpointQuery({
|
|
12
|
+
input: createGetWebhookEndpointInput(sourceConnectionId),
|
|
13
|
+
options: { retry: false }
|
|
14
|
+
});
|
|
15
|
+
const deliveryUrl = createWebhookDeliveryUrl(resource, data?.endpoint?.deliveryUrl);
|
|
16
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
17
|
+
body: /* @__PURE__ */ jsx(Text, {
|
|
18
|
+
size: TextSize.BODY_SM,
|
|
19
|
+
family: FontFamily.MONO,
|
|
20
|
+
children: deliveryUrl ?? "Delivery URL unavailable. Configure WEBHOOK_PUBLIC_BASE_URL."
|
|
21
|
+
}),
|
|
22
|
+
children: /* @__PURE__ */ jsx(CopyButton, {
|
|
23
|
+
label: "Copy URL",
|
|
24
|
+
value: deliveryUrl ?? "",
|
|
25
|
+
ariaLabel: `Copy ${resource} delivery URL`,
|
|
26
|
+
variant: ButtonVariant.SECONDARY,
|
|
27
|
+
size: ButtonSize.SMALL,
|
|
28
|
+
isDisabled: isLoading || !deliveryUrl
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { WebhookDeliveryUrlCopyButton as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ConnectError } from '@connectrpc/connect';
|
|
3
|
+
interface WebhookEndpointErrorLayoutProps {
|
|
4
|
+
error: ConnectError | null;
|
|
5
|
+
}
|
|
6
|
+
declare const WebhookEndpointErrorLayout: FC<WebhookEndpointErrorLayoutProps>;
|
|
7
|
+
export default WebhookEndpointErrorLayout;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isUnimplementedError } from "../../utils/errors.js";
|
|
2
|
+
import ErrorLayout, { ErrorLayoutSize } from "@galaxy-io/dls/layout/ErrorLayout";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import Box from "@galaxy-io/dls/layout/Box";
|
|
5
|
+
//#region src/components/webhooks/WebhookEndpointErrorLayout.tsx
|
|
6
|
+
var WebhookEndpointErrorLayout = ({ error }) => {
|
|
7
|
+
if (isUnimplementedError(error)) return /* @__PURE__ */ jsx(Box, {
|
|
8
|
+
padding: 12,
|
|
9
|
+
children: /* @__PURE__ */ jsx(ErrorLayout, {
|
|
10
|
+
size: ErrorLayoutSize.SMALL,
|
|
11
|
+
header: "Webhooks unavailable",
|
|
12
|
+
description: "Webhook endpoints need PostgreSQL. This server does not support them."
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
16
|
+
padding: 12,
|
|
17
|
+
children: /* @__PURE__ */ jsx(ErrorLayout, {
|
|
18
|
+
size: ErrorLayoutSize.SMALL,
|
|
19
|
+
header: "Failed to load endpoint",
|
|
20
|
+
description: "The webhook endpoint for this source could not be loaded.",
|
|
21
|
+
detail: error?.message
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { WebhookEndpointErrorLayout as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { WebhookEndpointStatus } from './types';
|
|
3
|
+
interface WebhookEndpointStatusBeaconProps {
|
|
4
|
+
status: WebhookEndpointStatus;
|
|
5
|
+
}
|
|
6
|
+
declare const WebhookEndpointStatusBeacon: FC<WebhookEndpointStatusBeaconProps>;
|
|
7
|
+
export default WebhookEndpointStatusBeacon;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WebhookEndpointStatus } from "./types.js";
|
|
2
|
+
import { WEBHOOK_ENDPOINT_STATUS_TO_HUE_MAP, WEBHOOK_ENDPOINT_STATUS_TO_LABEL_MAP } from "./constants.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import Beacon, { BeaconVariant } from "@galaxy-io/dls/beacons/Beacon";
|
|
5
|
+
//#region src/components/webhooks/WebhookEndpointStatusBeacon.tsx
|
|
6
|
+
var WebhookEndpointStatusBeacon = ({ status }) => {
|
|
7
|
+
const hue = WEBHOOK_ENDPOINT_STATUS_TO_HUE_MAP[status];
|
|
8
|
+
const label = WEBHOOK_ENDPOINT_STATUS_TO_LABEL_MAP[status];
|
|
9
|
+
if (!hue) return /* @__PURE__ */ jsx(Beacon, {
|
|
10
|
+
variant: BeaconVariant.TERTIARY,
|
|
11
|
+
label
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ jsx(Beacon, {
|
|
14
|
+
color: hue,
|
|
15
|
+
label,
|
|
16
|
+
isPulse: status === WebhookEndpointStatus.LIVE
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { WebhookEndpointStatusBeacon as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { WebhookEndpointStatus } from './types';
|
|
3
|
+
interface WebhookEndpointStatusCalloutProps {
|
|
4
|
+
status: WebhookEndpointStatus;
|
|
5
|
+
actions?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const WebhookEndpointStatusCallout: FC<WebhookEndpointStatusCalloutProps>;
|
|
8
|
+
export default WebhookEndpointStatusCallout;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WEBHOOK_ENDPOINT_STATUS_TO_HUE_MAP, WEBHOOK_ENDPOINT_STATUS_TO_MESSAGE_MAP } from "./constants.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import Alert from "@galaxy-io/dls/feedback/Alert";
|
|
4
|
+
//#region src/components/webhooks/WebhookEndpointStatusCallout.tsx
|
|
5
|
+
var WebhookEndpointStatusCallout = ({ status, actions }) => /* @__PURE__ */ jsx(Alert, {
|
|
6
|
+
color: WEBHOOK_ENDPOINT_STATUS_TO_HUE_MAP[status],
|
|
7
|
+
header: WEBHOOK_ENDPOINT_STATUS_TO_MESSAGE_MAP[status],
|
|
8
|
+
actions
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { WebhookEndpointStatusCallout as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RoleColor } from '@galaxy-io/dls/theme/tokens/types';
|
|
2
|
+
import { WebhookEndpointStatus } from './types';
|
|
3
|
+
export declare const WEBHOOK_CONNECTOR_NAME = "webhook";
|
|
4
|
+
export declare const WEBHOOK_DOCS_PATH = "/pages/connectors/sources/webhook";
|
|
5
|
+
export declare const WEBHOOK_RESOURCE_PLACEHOLDER = "orders...";
|
|
6
|
+
export declare const WEBHOOK_RESOURCE_TOOLTIP = "Letters, digits, - and _. The name becomes the last part of the delivery URL.";
|
|
7
|
+
export declare const WEBHOOK_RESOURCE_NAME_PATTERN: RegExp;
|
|
8
|
+
export declare const WEBHOOK_ENDPOINT_STATUS_TO_LABEL_MAP: Record<WebhookEndpointStatus, string>;
|
|
9
|
+
export declare const WEBHOOK_ENDPOINT_STATUS_TO_HUE_MAP: Record<WebhookEndpointStatus, RoleColor | undefined>;
|
|
10
|
+
export declare const WEBHOOK_ENDPOINT_STATUS_TO_MESSAGE_MAP: Record<WebhookEndpointStatus, string>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { WebhookEndpointStatus } from "./types.js";
|
|
2
|
+
//#region src/components/webhooks/constants.ts
|
|
3
|
+
var WEBHOOK_CONNECTOR_NAME = "webhook";
|
|
4
|
+
var WEBHOOK_DOCS_PATH = "/pages/connectors/sources/webhook";
|
|
5
|
+
var WEBHOOK_RESOURCE_PLACEHOLDER = "orders...";
|
|
6
|
+
var WEBHOOK_RESOURCE_TOOLTIP = "Letters, digits, - and _. The name becomes the last part of the delivery URL.";
|
|
7
|
+
var WEBHOOK_RESOURCE_NAME_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
|
|
8
|
+
var WEBHOOK_ENDPOINT_STATUS_TO_LABEL_MAP = {
|
|
9
|
+
[WebhookEndpointStatus.NO_KEY]: "No key",
|
|
10
|
+
[WebhookEndpointStatus.NO_PIPELINE]: "No pipeline",
|
|
11
|
+
[WebhookEndpointStatus.PIPELINE_DELETED]: "Pipeline deleted",
|
|
12
|
+
[WebhookEndpointStatus.OFF]: "Off",
|
|
13
|
+
[WebhookEndpointStatus.NOT_RUNNING]: "Not running",
|
|
14
|
+
[WebhookEndpointStatus.WAITING]: "Waiting",
|
|
15
|
+
[WebhookEndpointStatus.LIVE]: "Live"
|
|
16
|
+
};
|
|
17
|
+
var WEBHOOK_ENDPOINT_STATUS_TO_HUE_MAP = {
|
|
18
|
+
[WebhookEndpointStatus.NO_KEY]: void 0,
|
|
19
|
+
[WebhookEndpointStatus.NO_PIPELINE]: void 0,
|
|
20
|
+
[WebhookEndpointStatus.PIPELINE_DELETED]: "yellow",
|
|
21
|
+
[WebhookEndpointStatus.OFF]: void 0,
|
|
22
|
+
[WebhookEndpointStatus.NOT_RUNNING]: "yellow",
|
|
23
|
+
[WebhookEndpointStatus.WAITING]: "orange",
|
|
24
|
+
[WebhookEndpointStatus.LIVE]: "blue"
|
|
25
|
+
};
|
|
26
|
+
var WEBHOOK_ENDPOINT_STATUS_TO_MESSAGE_MAP = {
|
|
27
|
+
[WebhookEndpointStatus.NO_KEY]: "No signing key. Generate one under Secrets.",
|
|
28
|
+
[WebhookEndpointStatus.NO_PIPELINE]: "Create a pipeline from this source to receive payloads.",
|
|
29
|
+
[WebhookEndpointStatus.PIPELINE_DELETED]: "Pipeline deleted. Senders retry until a new one runs.",
|
|
30
|
+
[WebhookEndpointStatus.OFF]: "Add a resource to the pipeline to receive payloads.",
|
|
31
|
+
[WebhookEndpointStatus.NOT_RUNNING]: "Pipeline not running. Senders retry until it starts.",
|
|
32
|
+
[WebhookEndpointStatus.WAITING]: "Payloads wait until the pipeline reads every resource.",
|
|
33
|
+
[WebhookEndpointStatus.LIVE]: "These endpoints are live and can receive payloads."
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { WEBHOOK_CONNECTOR_NAME, WEBHOOK_DOCS_PATH, WEBHOOK_ENDPOINT_STATUS_TO_HUE_MAP, WEBHOOK_ENDPOINT_STATUS_TO_LABEL_MAP, WEBHOOK_ENDPOINT_STATUS_TO_MESSAGE_MAP, WEBHOOK_RESOURCE_NAME_PATTERN, WEBHOOK_RESOURCE_PLACEHOLDER, WEBHOOK_RESOURCE_TOOLTIP };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Connection } from '../../../gen/ingestion/v1/connections_pb';
|
|
2
|
+
import { Pipeline } from '../../../gen/ingestion/v1/pipelines_pb';
|
|
3
|
+
interface WebhookEndpointSyncInput {
|
|
4
|
+
sourceConnection: Connection | null | undefined;
|
|
5
|
+
pipelineId: Pipeline["id"];
|
|
6
|
+
}
|
|
7
|
+
export declare const useWebhookEndpointSync: () => (input: WebhookEndpointSyncInput) => Promise<void>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createPutWebhookEndpointRequest, getWebhookRouteResources, getWebhookSourceRouteKeys, isSameWebhookResources, isWebhookConnector } from "../utils.js";
|
|
2
|
+
import { getErrorMessage, ignoreNotFoundError } from "../../../utils/errors.js";
|
|
3
|
+
import { createGetWebhookEndpointInput, createGetWebhookEndpointQueryOptions, usePutWebhookEndpointMutation } from "../../../api/queries/webhooks.js";
|
|
4
|
+
import { createGetPipelineInput, createGetPipelineQueryOptions } from "../../../api/queries/pipelines.js";
|
|
5
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { useTransport } from "@connectrpc/connect-query";
|
|
7
|
+
import { ToastVariant } from "@galaxy-io/dls/toast/Toast";
|
|
8
|
+
import { useToast } from "@galaxy-io/dls/toast/useToast";
|
|
9
|
+
//#region src/components/webhooks/hooks/useWebhookEndpointSync.ts
|
|
10
|
+
var pendingSyncs = /* @__PURE__ */ new Map();
|
|
11
|
+
var useWebhookEndpointSync = () => {
|
|
12
|
+
const { toast } = useToast();
|
|
13
|
+
const queryClient = useQueryClient();
|
|
14
|
+
const transport = useTransport();
|
|
15
|
+
const { mutateAsync: putEndpoint } = usePutWebhookEndpointMutation();
|
|
16
|
+
const sync = async ({ sourceConnection, pipelineId }) => {
|
|
17
|
+
if (!sourceConnection || !isWebhookConnector(sourceConnection.connector)) return;
|
|
18
|
+
const sourceConnectionId = sourceConnection.id;
|
|
19
|
+
try {
|
|
20
|
+
const pipeline = await queryClient.fetchQuery({
|
|
21
|
+
...createGetPipelineQueryOptions({
|
|
22
|
+
input: createGetPipelineInput(pipelineId),
|
|
23
|
+
transport
|
|
24
|
+
}),
|
|
25
|
+
staleTime: 0
|
|
26
|
+
}).then((response) => response.pipeline, ignoreNotFoundError);
|
|
27
|
+
if (pipeline?.deletedAt !== 0n) return;
|
|
28
|
+
const currentVersion = pipeline.currentVersion;
|
|
29
|
+
if (!currentVersion?.graph) return;
|
|
30
|
+
const graph = currentVersion.graph;
|
|
31
|
+
const expectedPipelineVersionId = currentVersion.id;
|
|
32
|
+
const routeKeys = getWebhookSourceRouteKeys(graph, sourceConnectionId);
|
|
33
|
+
const endpoint = await queryClient.fetchQuery({
|
|
34
|
+
...createGetWebhookEndpointQueryOptions({
|
|
35
|
+
input: createGetWebhookEndpointInput(sourceConnectionId),
|
|
36
|
+
transport
|
|
37
|
+
}),
|
|
38
|
+
staleTime: 0
|
|
39
|
+
}).then((response) => response.endpoint, ignoreNotFoundError);
|
|
40
|
+
const isBoundHere = endpoint?.pipelineId === pipelineId;
|
|
41
|
+
if (routeKeys.length === 0) {
|
|
42
|
+
if (endpoint && isBoundHere && (endpoint.enabled || endpoint.resources.length > 0)) await putEndpoint(createPutWebhookEndpointRequest({
|
|
43
|
+
sourceConnectionId,
|
|
44
|
+
endpoint,
|
|
45
|
+
patch: {
|
|
46
|
+
resources: [],
|
|
47
|
+
enabled: false
|
|
48
|
+
},
|
|
49
|
+
expectedPipelineVersionId
|
|
50
|
+
}));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (!endpoint?.hasSigningSecret) {
|
|
54
|
+
toast({
|
|
55
|
+
variant: ToastVariant.WARNING,
|
|
56
|
+
header: "Webhook endpoint not set up",
|
|
57
|
+
description: "Generate a signing key under Secrets on the source."
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (endpoint.pipelineId && !isBoundHere) {
|
|
62
|
+
const boundPipeline = await queryClient.fetchQuery({
|
|
63
|
+
...createGetPipelineQueryOptions({
|
|
64
|
+
input: createGetPipelineInput(endpoint.pipelineId),
|
|
65
|
+
transport
|
|
66
|
+
}),
|
|
67
|
+
staleTime: 0
|
|
68
|
+
}).then((response) => response.pipeline, ignoreNotFoundError);
|
|
69
|
+
if (boundPipeline && boundPipeline.deletedAt === 0n) {
|
|
70
|
+
toast({
|
|
71
|
+
variant: ToastVariant.WARNING,
|
|
72
|
+
header: "Webhook endpoint unchanged",
|
|
73
|
+
description: `It stays bound to ${boundPipeline.name}.`
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const routeKey = isBoundHere && routeKeys.includes(endpoint.routeKey) ? endpoint.routeKey : routeKeys[0] ?? "";
|
|
79
|
+
const resources = getWebhookRouteResources(graph, routeKey);
|
|
80
|
+
if (isBoundHere && endpoint.routeKey === routeKey && endpoint.enabled && isSameWebhookResources(endpoint.resources, resources)) return;
|
|
81
|
+
await putEndpoint(createPutWebhookEndpointRequest({
|
|
82
|
+
sourceConnectionId,
|
|
83
|
+
endpoint,
|
|
84
|
+
patch: {
|
|
85
|
+
pipelineId,
|
|
86
|
+
routeKey,
|
|
87
|
+
resources,
|
|
88
|
+
enabled: true
|
|
89
|
+
},
|
|
90
|
+
expectedPipelineVersionId
|
|
91
|
+
}));
|
|
92
|
+
} catch (error) {
|
|
93
|
+
toast({
|
|
94
|
+
variant: ToastVariant.ERROR,
|
|
95
|
+
header: "Webhook endpoint not updated",
|
|
96
|
+
description: getErrorMessage(error, "Failed to update the webhook endpoint")
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return (input) => {
|
|
101
|
+
const sourceId = input.sourceConnection?.id;
|
|
102
|
+
if (!sourceId) return Promise.resolve();
|
|
103
|
+
const current = (pendingSyncs.get(sourceId) ?? Promise.resolve()).then(() => sync(input));
|
|
104
|
+
pendingSyncs.set(sourceId, current);
|
|
105
|
+
current.finally(() => {
|
|
106
|
+
if (pendingSyncs.get(sourceId) === current) pendingSyncs.delete(sourceId);
|
|
107
|
+
});
|
|
108
|
+
return current;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
//#endregion
|
|
112
|
+
export { useWebhookEndpointSync };
|