Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 80 additions & 99 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions common/scripts/env-webpack-helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
* Creates environment variables object for webpack DefinePlugin with fallback logic:
* 1. Check .env file first for variable values
* 2. If .env declares a variable but has no value, fallback to process.env
* 3. Only define variables that are explicitly declared in .env file
*
* @param {Object} env - Parsed environment variables from .env file (from dotenv.config().parsed)
* @returns {Object} Environment variables object ready for webpack.DefinePlugin
*/
function createEnvDefinePlugin(env) {

const envKeys = Object.create(null);
const missingVars = [];

if (env) {
Object.entries(env).forEach(([key, value]) => {
if (value !== undefined && value !== '') {
envKeys[`process.env.${key}`] = JSON.stringify(value);
}
else if (process.env[key] !== undefined && process.env[key] !== '') {
envKeys[`process.env.${key}`] = JSON.stringify(process.env[key]);
}
else {
missingVars.push(key);
}
});
}

if (missingVars.length > 0) {
throw new Error(
`Missing required environment variables: ${missingVars.join(', ')}\n` +
`Please provide values in either .env file or runtime environment.\n`
);
}

return envKeys;
}

module.exports = {
createEnvDefinePlugin
};

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { ConnectorRequest, ConnectorResponse } from "../rpc-types/connector-wiza
import { SqFlow } from "../rpc-types/sequence-diagram/interfaces";
import { FieldType, FunctionModel, ListenerModel, ServiceClassModel, ServiceModel } from "./service";
import { CDModel } from "./component-diagram";
import { IDMModel, Mapping } from "./inline-data-mapper";
import { DMModel, ExpandedDMModel, IntermediateClause, Mapping, Query } from "./inline-data-mapper";
import { SCOPE } from "../state-machine-types";

export interface DidOpenParams {
Expand Down Expand Up @@ -279,15 +279,30 @@ export interface TypeWithIdentifier {
type: TypeField;
}

export interface InlineDataMapperModelRequest {
export interface InitialIDMSourceRequest {
filePath: string;
flowNode: FlowNode;
propertyKey: string;
}

export interface InitialIDMSourceResponse {
textEdits: {
[key: string]: TextEdit[];
};
}

export interface InlineDataMapperModelRequest {
filePath: string;
codedata: CodeData;
position: LinePosition;
targetField?: string;
}

export interface InlineDataMapperSourceRequest extends InlineDataMapperModelRequest {
mappings: Mapping[];
export interface InlineDataMapperSourceRequest {
filePath: string;
codedata: CodeData;
varName?: string;
targetField?: string;
mapping: Mapping;
}

export interface VisualizableFieldsRequest {
Expand All @@ -297,23 +312,61 @@ export interface VisualizableFieldsRequest {
}

export interface InlineDataMapperModelResponse {
mappingsModel: IDMModel;
mappingsModel: ExpandedDMModel | DMModel;
}

export interface InlineDataMapperSourceResponse {
source: string;
textEdits: {
[key: string]: TextEdit[];
};
}

export interface VisualizableFieldsResponse {
visualizableProperties: string[];
visualizableProperties: {
[key: string]: string;
};
}

export interface AddArrayElementRequest {
filePath: string;
flowNode: FlowNode;
position: LinePosition;
propertyKey: string;
codedata: CodeData;
varName?: string;
targetField?: string;
propertyKey?: string;
}

export interface ConvertToQueryRequest{
filePath: string;
codedata: CodeData;
varName?: string;
targetField?: string;
propertyKey?: string;
}

export interface AddClausesRequest {
filePath: string;
codedata: CodeData;
index: number;
clause: IntermediateClause;
varName?: string;
targetField: string;
propertyKey?: string;
}

export interface GetInlineDataMapperCodedataRequest {
filePath: string;
codedata: CodeData;
name: string;
}

export interface GetSubMappingCodedataRequest {
filePath: string;
codedata: CodeData;
view: string;
}

export interface GetInlineDataMapperCodedataResponse {
codedata: CodeData;
}

export interface GraphqlDesignServiceParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* under the License.
*/

import { CodeData } from "./bi";
import { LineRange } from "./common";

export enum TypeKind {
Record = "record",
Array = "array",
Expand All @@ -24,13 +27,23 @@ export enum TypeKind {
Float = "float",
Decimal = "decimal",
Boolean = "boolean",
Enum = "enum",
Unknown = "unknown"
}

export enum InputCategory {
Const = "const",
ModuleVariable = "moduleVariable",
Configurable = "configurable"
Configurable = "configurable",
Enum = "enum"
}

export enum IntermediateClauseType {
LET = "let",
WHERE = "where",
FROM = "from",
ORDER_BY = "order by",
LIMIT = "limit"
}

export interface IDMDiagnostic {
Expand All @@ -56,28 +69,145 @@ export interface IOType {
variableName?: string;
fields?: IOType[];
member?: IOType;
members?: EnumMember[];
defaultValue?: unknown;
optional?: boolean;
}

export interface Mapping {
output: string,
inputs: string[];
inputs?: string[];
expression: string;
elements?: MappingElement[];
diagnostics?: IDMDiagnostic[];
isComplex?: boolean;
isFunctionCall?: boolean;
isQueryExpression?: boolean;
}

export interface IDMModel {
export interface ExpandedDMModel {
inputs: IOType[];
output: IOType;
subMappings?: IOType[];
mappings: Mapping[];
source: string;
view: string;
query?: Query;
}

export interface DMModel {
inputs: IORoot[];
output: IORoot;
subMappings?: IORoot[];
types: Record<string, RecordType | EnumType>;
mappings: Mapping[];
view: string;
query?: Query;
}

export interface ModelState {
model: ExpandedDMModel;
hasInputsOutputsChanged?: boolean;
hasSubMappingsChanged?: boolean;
}

export interface IORoot extends IOTypeField {
id: string;
category?: InputCategory;
}

export interface RecordType {
fields: IOTypeField[];
}

export interface EnumType {
members?: EnumMember[];
}

export interface IOTypeField {
typeName?: string;
kind: TypeKind;
fieldName?: string;
member?: IOTypeField;
defaultValue?: unknown;
optional?: boolean;
ref?: string;
}

export interface EnumMember {
id: string;
value: string;
}

export interface MappingElement {
mappings: Mapping[];
}

export interface Query {
output: string,
inputs: string[];
diagnostics?: IDMDiagnostic[];
fromClause: FromClause;
intermediateClauses?: IntermediateClause[];
resultClause: string;
}

export interface FromClause {
name: string;
type: string;
expression: string;
}

export interface IntermediateClauseProps {
name?: string;
type?: string;
expression: string;
order?: "ascending" | "descending";
}

export interface IntermediateClause {
type: IntermediateClauseType;
properties: IntermediateClauseProps;
}

export interface ResultClause {
type: string;
properties: {
expression: string;
};
query?: Query;
}

export interface IDMFormProps {
targetLineRange: LineRange;
fields: IDMFormField[];
submitText?: string;
cancelText?: string;
nestedForm?: boolean;
onSubmit: (data: IDMFormFieldValues) => void;
onCancel?: () => void;
isSaving?: boolean;
helperPaneSide?: 'right' | 'left';
}

export interface IDMFormField {
key: string;
label: string;
type: null | string;
optional: boolean;
editable: boolean;
documentation: string;
value: string | any[];
valueTypeConstraint: string;
enabled: boolean;
items?: string[];
}

export interface IDMFormFieldValues {
[key: string]: any;
}

export interface IDMViewState {
viewId: string;
codedata?: CodeData;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,29 @@
*/
import {
AddArrayElementRequest,
ConvertToQueryRequest,
AddClausesRequest,
InlineDataMapperModelRequest,
InlineDataMapperModelResponse,
InlineDataMapperSourceRequest,
InlineDataMapperSourceResponse,
VisualizableFieldsRequest,
VisualizableFieldsResponse
VisualizableFieldsResponse,
InitialIDMSourceResponse,
InitialIDMSourceRequest,
GetInlineDataMapperCodedataRequest,
GetInlineDataMapperCodedataResponse,
GetSubMappingCodedataRequest
} from "../../interfaces/extended-lang-client";

export interface InlineDataMapperAPI {
getInitialIDMSource: (params: InitialIDMSourceRequest) => Promise<InitialIDMSourceResponse>;
getDataMapperModel: (params: InlineDataMapperModelRequest) => Promise<InlineDataMapperModelResponse>;
getDataMapperSource: (params: InlineDataMapperSourceRequest) => Promise<InlineDataMapperSourceResponse>;
getVisualizableFields: (params: VisualizableFieldsRequest) => Promise<VisualizableFieldsResponse>;
addNewArrayElement: (params: AddArrayElementRequest) => Promise<InlineDataMapperSourceResponse>;
convertToQuery: (params: ConvertToQueryRequest) => Promise<InlineDataMapperSourceResponse>;
addClauses: (params: AddClausesRequest) => Promise<InlineDataMapperSourceResponse>;
getDataMapperCodedata: (params: GetInlineDataMapperCodedataRequest) => Promise<GetInlineDataMapperCodedataResponse>;
getSubMappingCodedata: (params: GetSubMappingCodedataRequest) => Promise<GetInlineDataMapperCodedataResponse>;
}
Loading
Loading