Skip to content

Commit 194fd75

Browse files
committed
Merge branch 'main' of https://github.com/wso2/vscode-extensions into sync/main-release-ballerina-1763738719
2 parents 8cca89e + 651c713 commit 194fd75

File tree

108 files changed

+3903
-2554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+3903
-2554
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ export enum IntermediateClauseType {
5858
WHERE = "where",
5959
FROM = "from",
6060
ORDER_BY = "order by",
61-
LIMIT = "limit"
61+
LIMIT = "limit",
62+
JOIN = "join",
6263
}
6364

6465
export enum ResultClauseType {
@@ -93,7 +94,6 @@ export interface IOType {
9394
members?: IOType[];
9495
defaultValue?: unknown;
9596
optional?: boolean;
96-
focusedMemberId?: string;
9797
isFocused?: boolean;
9898
isRecursive?: boolean;
9999
isDeepNested?: boolean;
@@ -125,6 +125,7 @@ export interface ExpandedDMModel {
125125
query?: Query;
126126
mapping_fields?: Record<string, any>;
127127
triggerRefresh?: boolean;
128+
focusInputRootMap?: Record<string, string>;
128129
}
129130

130131
export interface DMModel {
@@ -138,6 +139,8 @@ export interface DMModel {
138139
focusInputs?: Record<string, IOTypeField>;
139140
mapping_fields?: Record<string, any>;
140141
triggerRefresh?: boolean;
142+
traversingRoot?: string;
143+
focusInputRootMap?: Record<string, string>;
141144
}
142145

143146
export interface ModelState {
@@ -205,6 +208,9 @@ export interface IntermediateClauseProps {
205208
type?: string;
206209
expression: string;
207210
order?: "ascending" | "descending";
211+
lhsExpression?: string;
212+
rhsExpression?: string;
213+
isOuter?: boolean;
208214
}
209215

210216
export interface IntermediateClause {

workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,15 +474,28 @@ export interface GetDataMapperCodedataResponse {
474474
export interface PropertyRequest {
475475
filePath: string;
476476
codedata: CodeData;
477-
propertyKey: string,
478477
targetField: string;
478+
}
479+
480+
export interface FieldPropertyRequest extends PropertyRequest {
479481
fieldId: string;
480482
}
481483

482484
export interface PropertyResponse {
483485
property: Property;
484486
}
485487

488+
export interface ClausePositionRequest {
489+
filePath: string;
490+
codedata: CodeData;
491+
targetField: string;
492+
index: number;
493+
}
494+
495+
export interface ClausePositionResponse {
496+
position: LinePosition;
497+
}
498+
486499
export interface GraphqlDesignServiceParams {
487500
filePath: string;
488501
startLine: LinePosition;

workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export interface BIDiagramAPI {
149149
handleReadmeContent: (params: ReadmeContentRequest) => Promise<ReadmeContentResponse>;
150150
getVisibleVariableTypes: (params: BIGetVisibleVariableTypesRequest) => Promise<BIGetVisibleVariableTypesResponse>;
151151
getExpressionCompletions: (params: ExpressionCompletionsRequest) => Promise<ExpressionCompletionsResponse>;
152+
getDataMapperCompletions: (params: ExpressionCompletionsRequest) => Promise<ExpressionCompletionsResponse>;
152153
getConfigVariables: () => Promise<ConfigVariableResponse>;
153154
updateConfigVariables: (params: UpdateConfigVariableRequest) => Promise<UpdateConfigVariableResponse>;
154155
getConfigVariablesV2: (params: ConfigVariableRequest) => Promise<ConfigVariableResponse>;

workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export const createComponent: RequestType<ComponentRequest, CreateComponentRespo
152152
export const handleReadmeContent: RequestType<ReadmeContentRequest, ReadmeContentResponse> = { method: `${_preFix}/handleReadmeContent` };
153153
export const getVisibleVariableTypes: RequestType<BIGetVisibleVariableTypesRequest, BIGetVisibleVariableTypesResponse> = { method: `${_preFix}/getVisibleVariableTypes` };
154154
export const getExpressionCompletions: RequestType<ExpressionCompletionsRequest, ExpressionCompletionsResponse> = { method: `${_preFix}/getExpressionCompletions` };
155+
export const getDataMapperCompletions: RequestType<ExpressionCompletionsRequest, ExpressionCompletionsResponse> = { method: `${_preFix}/getDataMapperCompletions` };
155156
export const getConfigVariables: RequestType<void, ConfigVariableResponse> = { method: `${_preFix}/getConfigVariables` };
156157
export const updateConfigVariables: RequestType<UpdateConfigVariableRequest, UpdateConfigVariableResponse> = { method: `${_preFix}/updateConfigVariables` };
157158
export const getConfigVariablesV2: RequestType<ConfigVariableRequest, ConfigVariableResponse> = { method: `${_preFix}/getConfigVariablesV2` };

workspaces/ballerina/ballerina-core/src/rpc-types/data-mapper/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ import {
4242
ProcessTypeReferenceResponse,
4343
ProcessTypeReferenceRequest,
4444
ExpandedDMModelResponse,
45-
ClearTypeCacheResponse
45+
ClearTypeCacheResponse,
46+
FieldPropertyRequest,
47+
ClausePositionRequest,
48+
ClausePositionResponse
4649
} from "../../interfaces/extended-lang-client";
4750

4851
export interface DataMapperAPI {
@@ -62,6 +65,8 @@ export interface DataMapperAPI {
6265
getDataMapperCodedata: (params: GetDataMapperCodedataRequest) => Promise<GetDataMapperCodedataResponse>;
6366
getSubMappingCodedata: (params: GetSubMappingCodedataRequest) => Promise<GetDataMapperCodedataResponse>;
6467
getProperty: (params: PropertyRequest) => Promise<PropertyResponse>;
68+
getFieldProperty: (params: FieldPropertyRequest) => Promise<PropertyResponse>;
69+
getClausePosition: (params: ClausePositionRequest) => Promise<ClausePositionResponse>;
6570
getExpandedDMFromDMModel: (params: DMModelRequest) => Promise<ExpandedDMModelResponse>;
6671
getProcessTypeReference: (params: ProcessTypeReferenceRequest) => Promise<ProcessTypeReferenceResponse>;
6772
clearTypeCache: () => Promise<ClearTypeCacheResponse>;

workspaces/ballerina/ballerina-core/src/rpc-types/data-mapper/rpc-type.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ import {
4444
ProcessTypeReferenceResponse,
4545
ProcessTypeReferenceRequest,
4646
ExpandedDMModelResponse,
47-
ClearTypeCacheResponse
47+
ClearTypeCacheResponse,
48+
FieldPropertyRequest,
49+
ClausePositionRequest,
50+
ClausePositionResponse
4851
} from "../../interfaces/extended-lang-client";
4952
import { RequestType } from "vscode-messenger-common";
5053

@@ -65,6 +68,8 @@ export const mapWithTransformFn: RequestType<MapWithFnRequest, DataMapperSourceR
6568
export const getDataMapperCodedata: RequestType<GetDataMapperCodedataRequest, GetDataMapperCodedataResponse> = { method: `${_preFix}/getDataMapperCodedata` };
6669
export const getSubMappingCodedata: RequestType<GetSubMappingCodedataRequest, GetDataMapperCodedataResponse> = { method: `${_preFix}/getSubMappingCodedata` };
6770
export const getProperty: RequestType<PropertyRequest, PropertyResponse> = { method: `${_preFix}/getProperty` };
71+
export const getFieldProperty: RequestType<FieldPropertyRequest, PropertyResponse> = { method: `${_preFix}/getFieldProperty` };
72+
export const getClausePosition: RequestType<ClausePositionRequest, ClausePositionResponse> = { method: `${_preFix}/getClausePosition` };
6873
export const getExpandedDMFromDMModel: RequestType<DMModelRequest, ExpandedDMModelResponse> = { method: `${_preFix}/getExpandedDMFromDMModel` };
6974
export const getProcessTypeReference: RequestType<ProcessTypeReferenceRequest, ProcessTypeReferenceResponse> = { method: `${_preFix}/getProcessTypeReference` };
7075
export const clearTypeCache: RequestType<void, ClearTypeCacheResponse> = { method: `${_preFix}/clearTypeCache` };

workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,10 @@ import {
272272
ProjectInfoRequest,
273273
ProjectInfo,
274274
onMigratedProject,
275-
ProjectMigrationResult
275+
ProjectMigrationResult,
276+
FieldPropertyRequest,
277+
ClausePositionResponse,
278+
ClausePositionRequest
276279
} from "@wso2/ballerina-core";
277280
import { BallerinaExtension } from "./index";
278281
import { debug, handlePullModuleProgress } from "../utils";
@@ -354,6 +357,7 @@ enum EXTENDED_APIS {
354357
BI_GEN_ERROR_HANDLER = 'flowDesignService/addErrorHandler',
355358
BI_GET_ENCLOSED_FUNCTION = 'flowDesignService/getEnclosedFunctionDef',
356359
BI_EXPRESSION_COMPLETIONS = 'expressionEditor/completion',
360+
BI_DATA_MAPPER_COMPLETIONS = 'expressionEditor/dataMapperCompletion',
357361
VISIBLE_VARIABLE_TYPES = 'expressionEditor/visibleVariableTypes',
358362
DATA_MAPPER_MAPPINGS = 'dataMapper/mappings',
359363
DATA_MAPPER_GET_SOURCE = 'dataMapper/getSource',
@@ -369,7 +373,9 @@ enum EXTENDED_APIS {
369373
DATA_MAPPER_MAP_WITH_TRANSFORM_FN = 'dataMapper/transformationFunction',
370374
DATA_MAPPER_CODEDATA = 'dataMapper/nodePosition',
371375
DATA_MAPPER_SUB_MAPPING_CODEDATA = 'dataMapper/subMapping',
372-
DATA_MAPPER_PROPERTY = 'dataMapper/fieldPosition',
376+
DATA_MAPPER_PROPERTY = 'dataMapper/targetFieldPosition',
377+
DATA_MAPPER_FIELD_PROPERTY = 'dataMapper/fieldPosition',
378+
DATA_MAPPER_CLAUSE_POSITION = 'dataMapper/clausePosition',
373379
DATA_MAPPER_CLEAR_TYPE_CACHE = 'dataMapper/clearTypeCache',
374380
VIEW_CONFIG_VARIABLES = 'configEditor/getConfigVariables',
375381
UPDATE_CONFIG_VARIABLES = 'configEditor/updateConfigVariables',
@@ -844,6 +850,14 @@ export class ExtendedLangClient extends LanguageClient implements ExtendedLangCl
844850
return this.sendRequest<PropertyResponse>(EXTENDED_APIS.DATA_MAPPER_PROPERTY, params);
845851
}
846852

853+
async getFieldProperty(params: FieldPropertyRequest): Promise<PropertyResponse | NOT_SUPPORTED_TYPE> {
854+
return this.sendRequest<PropertyResponse>(EXTENDED_APIS.DATA_MAPPER_FIELD_PROPERTY, params);
855+
}
856+
857+
async getClausePosition(params: ClausePositionRequest): Promise<ClausePositionResponse> {
858+
return this.sendRequest<ClausePositionResponse>(EXTENDED_APIS.DATA_MAPPER_CLAUSE_POSITION, params);
859+
}
860+
847861
async clearTypeCache(): Promise<ClearTypeCacheResponse> {
848862
return this.sendRequest<ClearTypeCacheResponse>(EXTENDED_APIS.DATA_MAPPER_CLEAR_TYPE_CACHE);
849863
}
@@ -1145,6 +1159,10 @@ export class ExtendedLangClient extends LanguageClient implements ExtendedLangCl
11451159
return this.sendRequest<ExpressionCompletionsResponse>(EXTENDED_APIS.BI_EXPRESSION_COMPLETIONS, params);
11461160
}
11471161

1162+
async getDataMapperCompletions(params: ExpressionCompletionsRequest): Promise<ExpressionCompletionsResponse> {
1163+
return this.sendRequest<ExpressionCompletionsResponse>(EXTENDED_APIS.BI_DATA_MAPPER_COMPLETIONS, params);
1164+
}
1165+
11481166
async getModuleNodes(params: BIModuleNodesRequest): Promise<BIModuleNodesResponse> {
11491167
return this.sendRequest<BIModuleNodesResponse>(EXTENDED_APIS.BI_MODULE_NODES, params);
11501168
}

workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-handler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ import {
7575
GetConfigVariableNodeTemplateRequest,
7676
getConfigVariables,
7777
getConfigVariablesV2,
78+
getDataMapperCompletions,
7879
getDesignModel,
7980
getDevantMetadata,
8081
getEnclosedFunction,
@@ -182,6 +183,7 @@ export function registerBiDiagramRpcHandlers(messenger: Messenger) {
182183
messenger.onRequest(handleReadmeContent, (args: ReadmeContentRequest) => rpcManger.handleReadmeContent(args));
183184
messenger.onRequest(getVisibleVariableTypes, (args: BIGetVisibleVariableTypesRequest) => rpcManger.getVisibleVariableTypes(args));
184185
messenger.onRequest(getExpressionCompletions, (args: ExpressionCompletionsRequest) => rpcManger.getExpressionCompletions(args));
186+
messenger.onRequest(getDataMapperCompletions, (args: ExpressionCompletionsRequest) => rpcManger.getDataMapperCompletions(args));
185187
messenger.onRequest(getConfigVariables, () => rpcManger.getConfigVariables());
186188
messenger.onRequest(updateConfigVariables, (args: UpdateConfigVariableRequest) => rpcManger.updateConfigVariables(args));
187189
messenger.onRequest(getConfigVariablesV2, (args: ConfigVariableRequest) => rpcManger.getConfigVariablesV2(args));

workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,19 @@ export class BiDiagramRpcManager implements BIDiagramAPI {
894894
});
895895
}
896896

897+
async getDataMapperCompletions(params: ExpressionCompletionsRequest): Promise<ExpressionCompletionsResponse> {
898+
return new Promise((resolve, reject) => {
899+
StateMachine.langClient()
900+
.getDataMapperCompletions(params)
901+
.then((completions) => {
902+
resolve(completions);
903+
})
904+
.catch((error) => {
905+
reject("Error fetching data mapper completions from ls");
906+
});
907+
});
908+
}
909+
897910
async getConfigVariables(): Promise<ConfigVariableResponse> {
898911
return new Promise(async (resolve) => {
899912
const projectPath = StateMachine.context().projectPath;
@@ -2060,6 +2073,7 @@ export class BiDiagramRpcManager implements BIDiagramAPI {
20602073
});
20612074
});
20622075
}
2076+
20632077
}
20642078

20652079
export function getRepoRoot(projectRoot: string): string | undefined {

0 commit comments

Comments
 (0)