@galaxy-io/filament-ui 0.1.1 → 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/pages/pipelines/canvas/PipelineCanvasConnectionSelector.js +3 -1
- package/dist/pages/pipelines/canvas/PipelineCanvasFlow.js +10 -4
- package/dist/pages/pipelines/canvas/graph/rules.d.ts +3 -2
- package/dist/pages/pipelines/canvas/graph/rules.js +9 -33
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasEdgeConfig.d.ts +5 -5
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasEdgeConfig.js +14 -13
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasEdgeResources.d.ts +6 -7
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasEdgeResources.js +18 -24
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasPanelResourceOptions.d.ts +6 -7
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasPanelResourceOptions.js +3 -3
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasSourceNodeResources.d.ts +2 -0
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasSourceNodeResources.js +11 -0
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasSourceResources.d.ts +1 -0
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasSourceResources.js +1 -0
- package/dist/pages/pipelines/canvas/nodes/PipelineCanvasNodePlaceholder.js +3 -1
- package/dist/pages/pipelines/canvas/nodes/PipelineCanvasNodeSource.js +2 -4
- 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 +26 -28
- package/dist/pages/pipelines/canvas/panel/overview/resource/PipelineCanvasPanelResourceEndpoint.js +1 -1
- package/dist/pages/pipelines/canvas/panel/overview/resource/PipelineCanvasPanelResourceSection.js +6 -20
- package/dist/pages/pipelines/canvas/panel/overview/resource/transform/PipelineCanvasPanelResourceTransformSection.js +2 -2
- package/dist/pages/pipelines/canvas/providers/canvas/PipelineCanvasProvider.d.ts +3 -2
- package/dist/pages/pipelines/canvas/providers/canvas/PipelineCanvasProvider.js +7 -4
- package/dist/pages/pipelines/canvas/providers/canvas/actions.d.ts +6 -2
- package/dist/pages/pipelines/canvas/providers/canvas/reducer.js +18 -11
- package/dist/pages/pipelines/canvas/routes/PipelineCanvasRoutesDraftRow.js +17 -17
- package/dist/pages/pipelines/canvas/routes/PipelineCanvasRoutesList.js +1 -1
- package/dist/pages/pipelines/canvas/routes/PipelineCanvasRoutesRowControls.js +16 -17
- package/dist/pages/pipelines/canvas/routes/PipelineCanvasRoutesSourceIsland.js +2 -2
- package/dist/pages/pipelines/canvas/routes/hooks/usePipelineCanvasRoutes.js +4 -7
- package/dist/pages/pipelines/canvas/routes/hooks/usePipelineCanvasRoutesDraft.js +4 -16
- package/dist/pages/pipelines/canvas/routes/types.d.ts +0 -2
- package/dist/pages/pipelines/canvas/routes/utils.js +1 -1
- package/dist/pages/pipelines/canvas/utils.d.ts +4 -8
- package/dist/pages/pipelines/canvas/utils.js +14 -31
- package/dist/pages/pipelines/components/create/serialize.js +13 -31
- package/dist/pages/pipelines/components/create/steps/components/CreatePipelineModalDeliveryConnection.js +3 -3
- package/dist/pages/pipelines/components/create/steps/components/CreatePipelineModalResourcesReadModeCell.js +3 -3
- package/dist/pages/pipelines/components/header/PipelinePageEditActions.js +4 -19
- package/dist/pages/pipelines/components/resource/utils.d.ts +2 -2
- package/dist/pages/pipelines/components/resource/utils.js +3 -3
- package/dist/pages/pipelines/components/transform/PipelineTransformFields.js +4 -9
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsCall.js +1 -1
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsChain.js +1 -1
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsConditionGroup.js +1 -1
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsConditionRow.js +1 -1
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsNested.js +1 -1
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsProvider.d.ts +3 -4
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsProvider.js +15 -23
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsStepCard.js +21 -47
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsStepCompute.js +1 -1
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsStepDrop.js +1 -1
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsStepRename.js +1 -1
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsSteps.d.ts +3 -0
- package/dist/pages/pipelines/components/transform/{PipelineTransformFieldsResourceSteps.js → PipelineTransformFieldsSteps.js} +11 -29
- package/dist/pages/pipelines/components/transform/actions.d.ts +3 -12
- package/dist/pages/pipelines/components/transform/actions.js +0 -1
- package/dist/pages/pipelines/components/transform/grammar/parse.d.ts +1 -1
- package/dist/pages/pipelines/components/transform/grammar/parse.js +1 -1
- package/dist/pages/pipelines/components/transform/grammar/serialize.d.ts +1 -1
- package/dist/pages/pipelines/components/transform/grammar/serialize.js +3 -6
- package/dist/pages/pipelines/components/transform/hooks/usePipelineTransformFieldsIssues.d.ts +1 -2
- package/dist/pages/pipelines/components/transform/hooks/usePipelineTransformFieldsIssues.js +4 -6
- package/dist/pages/pipelines/components/transform/hooks/usePipelineTransformFieldsValidation.js +20 -19
- package/dist/pages/pipelines/components/transform/reducer.d.ts +1 -1
- package/dist/pages/pipelines/components/transform/reducer.js +18 -37
- package/dist/pages/pipelines/components/transform/types.d.ts +3 -4
- package/dist/pages/pipelines/components/transform/utils.d.ts +3 -3
- package/dist/pages/pipelines/components/transform/utils.js +7 -8
- package/dist/pages/pipelines/components/transform/validation.js +10 -13
- package/dist/utils/select.d.ts +1 -0
- package/dist/utils/select.js +2 -1
- package/package.json +1 -1
- package/dist/pages/pipelines/components/transform/PipelineTransformFieldsResourceSteps.d.ts +0 -8
|
@@ -1,42 +1,24 @@
|
|
|
1
1
|
import { usePipelineTransformFieldsActions, usePipelineTransformFieldsEnvironment, usePipelineTransformFieldsState } from "./PipelineTransformFieldsProvider.js";
|
|
2
2
|
import { usePipelineTransformFieldsIssues } from "./hooks/usePipelineTransformFieldsIssues.js";
|
|
3
3
|
import PipelineTransformFieldsStepItem from "./PipelineTransformFieldsStepItem.js";
|
|
4
|
-
import {
|
|
5
|
-
import Flex, { AlignItems } from "@galaxy-io/dls/layout/Flex";
|
|
6
|
-
import Text, { TextSize, TextVariant } from "@galaxy-io/dls/text/Text";
|
|
7
|
-
import { FontFamily } from "@galaxy-io/dls/theme/enums";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
5
|
import { SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
9
6
|
import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
10
|
-
//#region src/pages/pipelines/components/transform/
|
|
7
|
+
//#region src/pages/pipelines/components/transform/PipelineTransformFieldsSteps.tsx
|
|
11
8
|
var NO_ISSUES = [];
|
|
12
|
-
var
|
|
13
|
-
const {
|
|
9
|
+
var PipelineTransformFieldsSteps = () => {
|
|
10
|
+
const { steps, draft } = usePipelineTransformFieldsState();
|
|
14
11
|
const { moveStep } = usePipelineTransformFieldsActions();
|
|
15
|
-
const {
|
|
16
|
-
const issuesByStep = usePipelineTransformFieldsIssues(
|
|
12
|
+
const { isReadOnly } = usePipelineTransformFieldsEnvironment();
|
|
13
|
+
const issuesByStep = usePipelineTransformFieldsIssues();
|
|
17
14
|
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 4 } }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }));
|
|
18
|
-
const steps = stepsByResource.get(resource) ?? [];
|
|
19
15
|
const ids = steps.map((step) => step.id);
|
|
20
16
|
const handleDragEnd = ({ active, over }) => {
|
|
21
17
|
if (!over || active.id === over.id) return;
|
|
22
|
-
moveStep(
|
|
18
|
+
moveStep(ids.indexOf(String(active.id)), ids.indexOf(String(over.id)));
|
|
23
19
|
};
|
|
24
20
|
if (steps.length === 0) return null;
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
alignItems: AlignItems.START,
|
|
27
|
-
padding: [
|
|
28
|
-
8,
|
|
29
|
-
12,
|
|
30
|
-
0,
|
|
31
|
-
48
|
|
32
|
-
],
|
|
33
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
34
|
-
size: TextSize.CAPTION,
|
|
35
|
-
variant: TextVariant.SECONDARY,
|
|
36
|
-
family: FontFamily.MONO,
|
|
37
|
-
children: resource
|
|
38
|
-
})
|
|
39
|
-
}), /* @__PURE__ */ jsx(DndContext, {
|
|
21
|
+
return /* @__PURE__ */ jsx(DndContext, {
|
|
40
22
|
sensors,
|
|
41
23
|
collisionDetection: closestCenter,
|
|
42
24
|
onDragEnd: handleDragEnd,
|
|
@@ -47,10 +29,10 @@ var PipelineTransformFieldsResourceSteps = ({ resource, hasDivider }) => {
|
|
|
47
29
|
children: steps.map((step, index) => /* @__PURE__ */ jsx(PipelineTransformFieldsStepItem, {
|
|
48
30
|
step,
|
|
49
31
|
issues: issuesByStep.get(step.id) ?? NO_ISSUES,
|
|
50
|
-
hasDivider:
|
|
32
|
+
hasDivider: index > 0
|
|
51
33
|
}, step.id))
|
|
52
34
|
})
|
|
53
|
-
})
|
|
35
|
+
});
|
|
54
36
|
};
|
|
55
37
|
//#endregion
|
|
56
|
-
export {
|
|
38
|
+
export { PipelineTransformFieldsSteps as default };
|
|
@@ -7,7 +7,6 @@ export declare enum PipelineTransformFieldsActionType {
|
|
|
7
7
|
OPEN_STEP = "OPEN_STEP",
|
|
8
8
|
CANCEL = "CANCEL",
|
|
9
9
|
SET_DRAFT = "SET_DRAFT",
|
|
10
|
-
SET_RESOURCE = "SET_RESOURCE",
|
|
11
10
|
SAVE = "SAVE",
|
|
12
11
|
REMOVE_STEP = "REMOVE_STEP",
|
|
13
12
|
MOVE_STEP = "MOVE_STEP"
|
|
@@ -16,15 +15,12 @@ export interface LoadAction {
|
|
|
16
15
|
type: PipelineTransformFieldsActionType.LOAD;
|
|
17
16
|
payload: {
|
|
18
17
|
definition: TransformDefinition | undefined;
|
|
19
|
-
|
|
18
|
+
resource: Resource["name"];
|
|
20
19
|
functionsByName: Map<TransformFunction["name"], TransformFunction>;
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
|
-
|
|
22
|
+
interface OpenNewAction {
|
|
24
23
|
type: PipelineTransformFieldsActionType.OPEN_NEW;
|
|
25
|
-
payload: {
|
|
26
|
-
resources: Resource["name"][];
|
|
27
|
-
};
|
|
28
24
|
}
|
|
29
25
|
export interface OpenStepAction {
|
|
30
26
|
type: PipelineTransformFieldsActionType.OPEN_STEP;
|
|
@@ -37,10 +33,6 @@ export interface SetDraftAction {
|
|
|
37
33
|
type: PipelineTransformFieldsActionType.SET_DRAFT;
|
|
38
34
|
payload: TransformEditableStep;
|
|
39
35
|
}
|
|
40
|
-
export interface SetResourceAction {
|
|
41
|
-
type: PipelineTransformFieldsActionType.SET_RESOURCE;
|
|
42
|
-
payload: Resource["name"];
|
|
43
|
-
}
|
|
44
36
|
interface SaveAction {
|
|
45
37
|
type: PipelineTransformFieldsActionType.SAVE;
|
|
46
38
|
}
|
|
@@ -51,10 +43,9 @@ export interface RemoveStepAction {
|
|
|
51
43
|
export interface MoveStepAction {
|
|
52
44
|
type: PipelineTransformFieldsActionType.MOVE_STEP;
|
|
53
45
|
payload: {
|
|
54
|
-
resource: Resource["name"];
|
|
55
46
|
from: number;
|
|
56
47
|
to: number;
|
|
57
48
|
};
|
|
58
49
|
}
|
|
59
|
-
export type PipelineTransformFieldsAction = LoadAction | OpenNewAction | OpenStepAction | CancelAction | SetDraftAction |
|
|
50
|
+
export type PipelineTransformFieldsAction = LoadAction | OpenNewAction | OpenStepAction | CancelAction | SetDraftAction | SaveAction | RemoveStepAction | MoveStepAction;
|
|
60
51
|
export {};
|
|
@@ -5,7 +5,6 @@ var PipelineTransformFieldsActionType = /* @__PURE__ */ function(PipelineTransfo
|
|
|
5
5
|
PipelineTransformFieldsActionType["OPEN_STEP"] = "OPEN_STEP";
|
|
6
6
|
PipelineTransformFieldsActionType["CANCEL"] = "CANCEL";
|
|
7
7
|
PipelineTransformFieldsActionType["SET_DRAFT"] = "SET_DRAFT";
|
|
8
|
-
PipelineTransformFieldsActionType["SET_RESOURCE"] = "SET_RESOURCE";
|
|
9
8
|
PipelineTransformFieldsActionType["SAVE"] = "SAVE";
|
|
10
9
|
PipelineTransformFieldsActionType["REMOVE_STEP"] = "REMOVE_STEP";
|
|
11
10
|
PipelineTransformFieldsActionType["MOVE_STEP"] = "MOVE_STEP";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Resource } from '../../../../../gen/ingestion/v1/connectors_pb';
|
|
2
2
|
import { TransformFunction } from '../../../../../gen/ingestion/v1/transformations_pb';
|
|
3
3
|
import { TransformDefinition, TransformStep } from '../types';
|
|
4
|
-
export declare const parseTransformDefinition: (definition: TransformDefinition | undefined,
|
|
4
|
+
export declare const parseTransformDefinition: (definition: TransformDefinition | undefined, resource: Resource["name"], functionsByName: Map<TransformFunction["name"], TransformFunction>) => TransformStep[];
|
|
@@ -84,6 +84,6 @@ var getResourceSteps = (definition, resource) => {
|
|
|
84
84
|
if (entry === void 0 || !isJsonObject(entry) || !Array.isArray(entry.steps)) return [];
|
|
85
85
|
return entry.steps;
|
|
86
86
|
};
|
|
87
|
-
var parseTransformDefinition = (definition,
|
|
87
|
+
var parseTransformDefinition = (definition, resource, functionsByName) => getResourceSteps(definition, resource).map((step) => parseTransformStep(step, functionsByName));
|
|
88
88
|
//#endregion
|
|
89
89
|
export { parseTransformDefinition };
|
|
@@ -4,4 +4,4 @@ import { TransformComputeOutput, TransformDefinition, TransformStep } from '../t
|
|
|
4
4
|
export declare const getTransformOutputName: (output: TransformComputeOutput, isMatchingRows: boolean) => string;
|
|
5
5
|
export declare const isTransformOutputInPlace: (output: TransformComputeOutput, isMatchingRows: boolean) => boolean;
|
|
6
6
|
export declare const serializeTransformStep: (step: TransformStep) => JsonValue;
|
|
7
|
-
export declare const serializeTransformDefinition: (
|
|
7
|
+
export declare const serializeTransformDefinition: (resource: Resource["name"], steps: TransformStep[], grammarVersion: number, base?: TransformDefinition) => TransformDefinition | undefined;
|
|
@@ -27,16 +27,13 @@ var serializeTransformStep = (step) => match(step).with({ kind: TransformStepKin
|
|
|
27
27
|
where: serializeTransformExpr(where)
|
|
28
28
|
} : { compute };
|
|
29
29
|
}).exhaustive();
|
|
30
|
-
var serializeTransformDefinition = (
|
|
30
|
+
var serializeTransformDefinition = (resource, steps, grammarVersion, base) => {
|
|
31
31
|
const resources = {};
|
|
32
32
|
const saved = base?.resources;
|
|
33
33
|
if (saved !== void 0 && isJsonObject(saved)) {
|
|
34
|
-
for (const [
|
|
35
|
-
}
|
|
36
|
-
for (const [resource, steps] of stepsByResource) {
|
|
37
|
-
if (steps.length === 0) continue;
|
|
38
|
-
resources[resource] = { steps: steps.map(serializeTransformStep) };
|
|
34
|
+
for (const [name, entry] of Object.entries(saved)) if (name !== resource) resources[name] = entry;
|
|
39
35
|
}
|
|
36
|
+
if (steps.length > 0) resources[resource] = { steps: steps.map(serializeTransformStep) };
|
|
40
37
|
if (Object.keys(resources).length === 0) return void 0;
|
|
41
38
|
return {
|
|
42
39
|
version: grammarVersion,
|
package/dist/pages/pipelines/components/transform/hooks/usePipelineTransformFieldsIssues.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { Resource } from '../../../../../gen/ingestion/v1/connectors_pb';
|
|
2
1
|
import { TransformStep } from '../types';
|
|
3
|
-
export declare const usePipelineTransformFieldsIssues: (
|
|
2
|
+
export declare const usePipelineTransformFieldsIssues: () => Map<TransformStep["id"], string[]>;
|
|
@@ -6,12 +6,10 @@ import { usePipelineTransformFieldsEnvironment, usePipelineTransformFieldsState
|
|
|
6
6
|
import { useMemo } from "react";
|
|
7
7
|
import { create } from "@bufbuild/protobuf";
|
|
8
8
|
//#region src/pages/pipelines/components/transform/hooks/usePipelineTransformFieldsIssues.ts
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
const
|
|
13
|
-
const steps = stepsByResource.get(resource) ?? NO_STEPS;
|
|
14
|
-
const definition = useMemo(() => serializeTransformDefinition(/* @__PURE__ */ new Map([[resource, steps]]), grammarVersion), [
|
|
9
|
+
var usePipelineTransformFieldsIssues = () => {
|
|
10
|
+
const { steps } = usePipelineTransformFieldsState();
|
|
11
|
+
const { resource, sourceConnectionId, grammarVersion } = usePipelineTransformFieldsEnvironment();
|
|
12
|
+
const definition = useMemo(() => serializeTransformDefinition(resource, steps, grammarVersion), [
|
|
15
13
|
grammarVersion,
|
|
16
14
|
resource,
|
|
17
15
|
steps
|
package/dist/pages/pipelines/components/transform/hooks/usePipelineTransformFieldsValidation.js
CHANGED
|
@@ -15,30 +15,29 @@ var NO_COLUMNS = [];
|
|
|
15
15
|
var NO_ERRORS = /* @__PURE__ */ new Map();
|
|
16
16
|
var NO_TYPES = /* @__PURE__ */ new Map();
|
|
17
17
|
var usePipelineTransformFieldsValidation = (draft) => {
|
|
18
|
-
const {
|
|
19
|
-
const {
|
|
20
|
-
const savedIssues = usePipelineTransformFieldsIssues(
|
|
21
|
-
const requiresValidation = sourceConnectionId !== ""
|
|
18
|
+
const { steps } = usePipelineTransformFieldsState();
|
|
19
|
+
const { resource, columns: resourceColumns, sourceConnectionId, functionsByName, grammarVersion, isReadOnly } = usePipelineTransformFieldsEnvironment();
|
|
20
|
+
const savedIssues = usePipelineTransformFieldsIssues();
|
|
21
|
+
const requiresValidation = sourceConnectionId !== "";
|
|
22
22
|
const prefixDefinition = useMemo(() => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const steps = (placed.stepsByResource.get(draft.resource) ?? []).slice(0, placed.index);
|
|
26
|
-
return serializeTransformDefinition(/* @__PURE__ */ new Map([[draft.resource, steps]]), grammarVersion);
|
|
23
|
+
const placed = placeTransformDraft(steps, draft);
|
|
24
|
+
return serializeTransformDefinition(resource, placed.steps.slice(0, placed.index), grammarVersion);
|
|
27
25
|
}, [
|
|
28
26
|
draft,
|
|
29
27
|
grammarVersion,
|
|
30
|
-
|
|
28
|
+
resource,
|
|
29
|
+
steps
|
|
31
30
|
]);
|
|
32
31
|
const hasPrefix = requiresValidation && prefixDefinition !== void 0;
|
|
33
32
|
const prefix = useValidateTransformQuery({
|
|
34
33
|
input: create(ValidateTransformRequestSchema, {
|
|
35
34
|
sourceConnectionId,
|
|
36
|
-
resource
|
|
35
|
+
resource,
|
|
37
36
|
transform: prefixDefinition
|
|
38
37
|
}),
|
|
39
38
|
options: { enabled: hasPrefix }
|
|
40
39
|
});
|
|
41
|
-
const columns = hasPrefix ? prefix.data?.outputColumns ?? NO_COLUMNS :
|
|
40
|
+
const columns = hasPrefix ? prefix.data?.outputColumns ?? NO_COLUMNS : resourceColumns;
|
|
42
41
|
const prefixError = prefix.error !== null ? "Unable to load the columns available before this step." : null;
|
|
43
42
|
const isPrefixPending = hasPrefix && prefix.data === void 0 && prefixError === null;
|
|
44
43
|
const isComplete = isTransformDraftComplete(draft, columns, functionsByName);
|
|
@@ -46,12 +45,16 @@ var usePipelineTransformFieldsValidation = (draft) => {
|
|
|
46
45
|
const clientError = getTransformDraftError(draft, functionsByName);
|
|
47
46
|
const debounced = useDebouncedValue(draft, 250);
|
|
48
47
|
const isSettled = debounced === draft;
|
|
49
|
-
const placed = useMemo(() => placeTransformDraft(
|
|
50
|
-
const definition = useMemo(() => serializeTransformDefinition(placed.
|
|
48
|
+
const placed = useMemo(() => placeTransformDraft(steps, debounced), [debounced, steps]);
|
|
49
|
+
const definition = useMemo(() => serializeTransformDefinition(resource, placed.steps, grammarVersion), [
|
|
50
|
+
resource,
|
|
51
|
+
placed,
|
|
52
|
+
grammarVersion
|
|
53
|
+
]);
|
|
51
54
|
const validation = useValidateTransformQuery({
|
|
52
55
|
input: create(ValidateTransformRequestSchema, {
|
|
53
56
|
sourceConnectionId,
|
|
54
|
-
resource
|
|
57
|
+
resource,
|
|
55
58
|
transform: definition
|
|
56
59
|
}),
|
|
57
60
|
options: {
|
|
@@ -59,7 +62,7 @@ var usePipelineTransformFieldsValidation = (draft) => {
|
|
|
59
62
|
placeholderData: keepPreviousData
|
|
60
63
|
}
|
|
61
64
|
});
|
|
62
|
-
const stepPath = getTransformStepPath(
|
|
65
|
+
const stepPath = getTransformStepPath(resource, placed.index);
|
|
63
66
|
const isFresh = isSettled && validation.data !== void 0 && !validation.isPlaceholderData;
|
|
64
67
|
const showsIssues = isFresh && isComplete && clientError === null;
|
|
65
68
|
const validationError = isSettled && validation.error !== null ? "Unable to validate this transformation." : null;
|
|
@@ -68,9 +71,8 @@ var usePipelineTransformFieldsValidation = (draft) => {
|
|
|
68
71
|
errors: NO_ERRORS,
|
|
69
72
|
downstream: []
|
|
70
73
|
};
|
|
71
|
-
const steps = placed.stepsByResource.get(debounced.resource) ?? [];
|
|
72
74
|
const downstream = [...groupTransformIssuesByStep(validation.data.issues)].flatMap(([index, messages]) => {
|
|
73
|
-
const step = steps[index];
|
|
75
|
+
const step = placed.steps[index];
|
|
74
76
|
if (!step || index <= placed.index) return [];
|
|
75
77
|
const saved = savedIssues.get(step.id) ?? [];
|
|
76
78
|
return messages.filter((message) => !saved.includes(message)).map((message) => `Step ${index + 1}: ${message}`);
|
|
@@ -80,7 +82,6 @@ var usePipelineTransformFieldsValidation = (draft) => {
|
|
|
80
82
|
downstream
|
|
81
83
|
};
|
|
82
84
|
}, [
|
|
83
|
-
debounced.resource,
|
|
84
85
|
placed,
|
|
85
86
|
savedIssues,
|
|
86
87
|
showsIssues,
|
|
@@ -88,7 +89,7 @@ var usePipelineTransformFieldsValidation = (draft) => {
|
|
|
88
89
|
validation.data
|
|
89
90
|
]);
|
|
90
91
|
const types = useMemo(() => validation.data ? mapTransformExpressionTypes(validation.data.expressionTypes, stepPath) : NO_TYPES, [stepPath, validation.data]);
|
|
91
|
-
const isDisabled = isReadOnly || isPrefixPending || prefixError !== null
|
|
92
|
+
const isDisabled = isReadOnly || isPrefixPending || prefixError !== null;
|
|
92
93
|
const editor = useMemo(() => ({
|
|
93
94
|
columns,
|
|
94
95
|
types,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LoadAction, PipelineTransformFieldsAction } from './actions';
|
|
2
2
|
import { PipelineTransformFieldsState } from './types';
|
|
3
|
-
export declare const createInitialPipelineTransformFieldsState: ({ definition,
|
|
3
|
+
export declare const createInitialPipelineTransformFieldsState: ({ definition, resource, functionsByName, }: LoadAction["payload"]) => PipelineTransformFieldsState;
|
|
4
4
|
declare const pipelineTransformFieldsReducer: (state: PipelineTransformFieldsState, action: PipelineTransformFieldsAction) => PipelineTransformFieldsState;
|
|
5
5
|
export default pipelineTransformFieldsReducer;
|
|
@@ -5,37 +5,32 @@ import { createTransformStep, placeTransformDraft } from "./utils.js";
|
|
|
5
5
|
import { match } from "ts-pattern";
|
|
6
6
|
import { arrayMove } from "@dnd-kit/sortable";
|
|
7
7
|
//#region src/pages/pipelines/components/transform/reducer.ts
|
|
8
|
-
var createInitialPipelineTransformFieldsState = ({ definition,
|
|
9
|
-
|
|
8
|
+
var createInitialPipelineTransformFieldsState = ({ definition, resource, functionsByName }) => ({
|
|
9
|
+
steps: parseTransformDefinition(definition, resource, functionsByName),
|
|
10
10
|
draft: null
|
|
11
11
|
});
|
|
12
12
|
function load(_, action) {
|
|
13
13
|
return createInitialPipelineTransformFieldsState(action.payload);
|
|
14
14
|
}
|
|
15
|
-
function openNew(state
|
|
15
|
+
function openNew(state) {
|
|
16
16
|
return {
|
|
17
17
|
...state,
|
|
18
18
|
draft: {
|
|
19
|
-
resource: resources.length === 1 ? resources[0] : "",
|
|
20
19
|
id: null,
|
|
21
20
|
step: createTransformStep(TransformStepKind.COMPUTE)
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
24
|
function openStep(state, action) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return state;
|
|
25
|
+
const step = state.steps.find((candidate) => candidate.id === action.payload);
|
|
26
|
+
if (!step || step.kind === TransformStepKind.RAW) return state;
|
|
27
|
+
return {
|
|
28
|
+
...state,
|
|
29
|
+
draft: {
|
|
30
|
+
id: step.id,
|
|
31
|
+
step
|
|
32
|
+
}
|
|
33
|
+
};
|
|
39
34
|
}
|
|
40
35
|
function cancel(state) {
|
|
41
36
|
return {
|
|
@@ -53,41 +48,27 @@ function setDraft(state, action) {
|
|
|
53
48
|
}
|
|
54
49
|
};
|
|
55
50
|
}
|
|
56
|
-
function setResource(state, action) {
|
|
57
|
-
if (!state.draft) return state;
|
|
58
|
-
return {
|
|
59
|
-
...state,
|
|
60
|
-
draft: {
|
|
61
|
-
...state.draft,
|
|
62
|
-
resource: action.payload,
|
|
63
|
-
step: createTransformStep(state.draft.step.kind, "", state.draft.step.id)
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
51
|
function save(state) {
|
|
68
52
|
if (!state.draft) return state;
|
|
69
53
|
return {
|
|
70
|
-
|
|
54
|
+
steps: placeTransformDraft(state.steps, state.draft).steps,
|
|
71
55
|
draft: null
|
|
72
56
|
};
|
|
73
57
|
}
|
|
74
58
|
function removeStep(state, action) {
|
|
75
59
|
return {
|
|
76
|
-
|
|
60
|
+
steps: state.steps.filter((step) => step.id !== action.payload),
|
|
77
61
|
draft: state.draft?.id === action.payload ? null : state.draft
|
|
78
62
|
};
|
|
79
63
|
}
|
|
80
64
|
function moveStep(state, action) {
|
|
81
|
-
const {
|
|
82
|
-
|
|
83
|
-
if (!steps || from === to) return state;
|
|
84
|
-
const stepsByResource = new Map(state.stepsByResource);
|
|
85
|
-
stepsByResource.set(resource, arrayMove(steps, from, to));
|
|
65
|
+
const { from, to } = action.payload;
|
|
66
|
+
if (from === to) return state;
|
|
86
67
|
return {
|
|
87
68
|
...state,
|
|
88
|
-
|
|
69
|
+
steps: arrayMove(state.steps, from, to)
|
|
89
70
|
};
|
|
90
71
|
}
|
|
91
|
-
var pipelineTransformFieldsReducer = (state, action) => match(action).with({ type: PipelineTransformFieldsActionType.LOAD }, (action) => load(state, action)).with({ type: PipelineTransformFieldsActionType.OPEN_NEW }, (
|
|
72
|
+
var pipelineTransformFieldsReducer = (state, action) => match(action).with({ type: PipelineTransformFieldsActionType.LOAD }, (action) => load(state, action)).with({ type: PipelineTransformFieldsActionType.OPEN_NEW }, () => openNew(state)).with({ type: PipelineTransformFieldsActionType.OPEN_STEP }, (action) => openStep(state, action)).with({ type: PipelineTransformFieldsActionType.CANCEL }, () => cancel(state)).with({ type: PipelineTransformFieldsActionType.SET_DRAFT }, (action) => setDraft(state, action)).with({ type: PipelineTransformFieldsActionType.SAVE }, () => save(state)).with({ type: PipelineTransformFieldsActionType.REMOVE_STEP }, (action) => removeStep(state, action)).with({ type: PipelineTransformFieldsActionType.MOVE_STEP }, (action) => moveStep(state, action)).exhaustive();
|
|
92
73
|
//#endregion
|
|
93
74
|
export { createInitialPipelineTransformFieldsState, pipelineTransformFieldsReducer as default };
|
|
@@ -114,17 +114,16 @@ export type TransformAction = {
|
|
|
114
114
|
fn: TransformFunction["name"];
|
|
115
115
|
};
|
|
116
116
|
export interface PipelineTransformFieldsDraft {
|
|
117
|
-
resource: Resource["name"];
|
|
118
117
|
id: TransformStep["id"] | null;
|
|
119
118
|
step: TransformEditableStep;
|
|
120
119
|
}
|
|
121
120
|
export interface PipelineTransformFieldsState {
|
|
122
|
-
|
|
121
|
+
steps: TransformStep[];
|
|
123
122
|
draft: PipelineTransformFieldsDraft | null;
|
|
124
123
|
}
|
|
125
124
|
export interface PipelineTransformFieldsEnvironment {
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
resource: Resource["name"];
|
|
126
|
+
columns: ResourceColumn[];
|
|
128
127
|
sourceConnectionId: Connection["id"];
|
|
129
128
|
functionsByName: Map<TransformFunction["name"], TransformFunction>;
|
|
130
129
|
grammarVersion: ListTransformFunctionsResponse["grammarVersion"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SelectOption } from '@galaxy-io/dls/inputs/SelectInput';
|
|
2
|
-
import {
|
|
2
|
+
import { ResourceColumn } from '../../../../gen/ingestion/v1/connectors_pb';
|
|
3
3
|
import { TransformFunction } from '../../../../gen/ingestion/v1/transformations_pb';
|
|
4
4
|
import { PipelineTransformFieldsDraft, PipelineTransformFieldsEditor, TransformAction, TransformChain, TransformChainCall, TransformEditableStep, TransformExpr, TransformLiteralExpr, TransformLiteralKind, TransformSelectEntry, TransformSelectModel, TransformStep } from './types';
|
|
5
5
|
export declare const createTransformStep: (kind: TransformEditableStep["kind"], column?: string, id?: string) => TransformEditableStep;
|
|
@@ -15,8 +15,8 @@ interface TransformActionContext {
|
|
|
15
15
|
rootType: string | undefined;
|
|
16
16
|
}
|
|
17
17
|
export declare const applyTransformAction: (step: TransformEditableStep, outputIndex: number, action: TransformAction, { functionsByName, columns, rootType }: TransformActionContext) => TransformEditableStep;
|
|
18
|
-
export declare const placeTransformDraft: (
|
|
19
|
-
|
|
18
|
+
export declare const placeTransformDraft: (steps: TransformStep[], draft: PipelineTransformFieldsDraft) => {
|
|
19
|
+
steps: TransformStep[];
|
|
20
20
|
index: number;
|
|
21
21
|
};
|
|
22
22
|
export declare const getTransformColumnType: (columns: ResourceColumn[], name: ResourceColumn["name"]) => string | undefined;
|
|
@@ -96,15 +96,14 @@ var applyTransformAction = (step, outputIndex, action, { functionsByName, column
|
|
|
96
96
|
} : candidate)
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
|
-
var placeTransformDraft = (
|
|
100
|
-
const steps = stepsByResource.get(draft.resource) ?? [];
|
|
99
|
+
var placeTransformDraft = (steps, draft) => {
|
|
101
100
|
const at = draft.id === null ? -1 : steps.findIndex((step) => step.id === draft.id);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
index
|
|
101
|
+
return at === -1 ? {
|
|
102
|
+
steps: [...steps, draft.step],
|
|
103
|
+
index: steps.length
|
|
104
|
+
} : {
|
|
105
|
+
steps: steps.map((step, slot) => slot === at ? draft.step : step),
|
|
106
|
+
index: at
|
|
108
107
|
};
|
|
109
108
|
};
|
|
110
109
|
var getTransformColumnType = (columns, name) => columns.find((column) => column.name === name)?.logicalType;
|
|
@@ -5,20 +5,17 @@ import { getTransformArgumentSpec, isTransformExprComplete, isTransformIntegerOn
|
|
|
5
5
|
import { getTransformColumnType, getTransformNumberError } from "./utils.js";
|
|
6
6
|
import { match } from "ts-pattern";
|
|
7
7
|
//#region src/pages/pipelines/components/transform/validation.ts
|
|
8
|
-
var isTransformDraftComplete = (draft, columns, functionsByName) => {
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return calls.length > 0 || root.kind !== TransformExprKind.COLUMN || getTransformColumnType(columns, root.name) === "bool";
|
|
18
|
-
}).exhaustive();
|
|
19
|
-
};
|
|
8
|
+
var isTransformDraftComplete = (draft, columns, functionsByName) => match(draft.step).with({ kind: TransformStepKind.RENAME }, (step) => step.pairs.length > 0 && step.pairs.every((pair) => pair.from !== "" && pair.to.trim() !== "")).with({ kind: TransformStepKind.DROP }, (step) => step.names.length > 0 && step.names.every((name) => name !== "")).with({ kind: TransformStepKind.COMPUTE }, (step) => {
|
|
9
|
+
if (step.outputs.length === 0) return false;
|
|
10
|
+
if (!step.outputs.every((output) => isTransformExprComplete(output.expr, functionsByName))) return false;
|
|
11
|
+
if (step.outputs.some((output) => getTransformOutputName(output, step.where !== null) === "")) return false;
|
|
12
|
+
if (step.where === null) return true;
|
|
13
|
+
if (!isTransformExprComplete(step.where, functionsByName)) return false;
|
|
14
|
+
const { root, calls } = getTransformChain(step.where);
|
|
15
|
+
return calls.length > 0 || root.kind !== TransformExprKind.COLUMN || getTransformColumnType(columns, root.name) === "bool";
|
|
16
|
+
}).exhaustive();
|
|
20
17
|
var isGrammarValue = (value) => value === null ? false : Array.isArray(value) ? value.every(isGrammarValue) : typeof value === "object" ? Object.entries(value).every(([key, entry]) => key !== "" && isGrammarValue(entry)) : true;
|
|
21
|
-
var isTransformDraftValidatable = (draft) =>
|
|
18
|
+
var isTransformDraftValidatable = (draft) => isGrammarValue(serializeTransformStep(draft.step));
|
|
22
19
|
var getTransformExprError = (expr, integerOnly, functionsByName) => {
|
|
23
20
|
if (expr.kind === TransformExprKind.LITERAL) return expr.literalKind === TransformLiteralKind.NUMBER && expr.value !== null ? getTransformNumberError(expr.value, integerOnly) : null;
|
|
24
21
|
if (expr.kind !== TransformExprKind.CALL) return null;
|
package/dist/utils/select.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ type ProtoEnum<TEnum extends number> = {
|
|
|
4
4
|
} & Record<string, string | TEnum>;
|
|
5
5
|
export declare const getEnumValues: <TEnum extends number>(enumObject: ProtoEnum<TEnum>) => TEnum[];
|
|
6
6
|
export declare const createEnumSelectOptions: <TEnum extends number>(values: readonly TEnum[], labels: Record<TEnum, string>) => SelectOption[];
|
|
7
|
+
export declare const getEnumSelectValue: <TEnum extends number>(enumObject: ProtoEnum<TEnum>, value: TEnum) => string | null;
|
|
7
8
|
export declare const mapOptionIdToEnum: <TEnum extends number>(enumObject: ProtoEnum<TEnum>, id: string) => TEnum;
|
|
8
9
|
export {};
|
package/dist/utils/select.js
CHANGED
|
@@ -4,6 +4,7 @@ var createEnumSelectOptions = (values, labels) => values.map((value) => ({
|
|
|
4
4
|
id: String(value),
|
|
5
5
|
label: labels[value]
|
|
6
6
|
}));
|
|
7
|
+
var getEnumSelectValue = (enumObject, value) => value === enumObject.UNSPECIFIED ? null : String(value);
|
|
7
8
|
var mapOptionIdToEnum = (enumObject, id) => getEnumValues(enumObject).find((value) => value === Number(id)) ?? enumObject.UNSPECIFIED;
|
|
8
9
|
//#endregion
|
|
9
|
-
export { createEnumSelectOptions, getEnumValues, mapOptionIdToEnum };
|
|
10
|
+
export { createEnumSelectOptions, getEnumSelectValue, getEnumValues, mapOptionIdToEnum };
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { Resource } from '../../../../gen/ingestion/v1/connectors_pb';
|
|
3
|
-
interface PipelineTransformFieldsResourceStepsProps {
|
|
4
|
-
resource: Resource["name"];
|
|
5
|
-
hasDivider: boolean;
|
|
6
|
-
}
|
|
7
|
-
declare const PipelineTransformFieldsResourceSteps: FC<PipelineTransformFieldsResourceStepsProps>;
|
|
8
|
-
export default PipelineTransformFieldsResourceSteps;
|