-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(Data Mapper): creating new data mapper library (#4575)
* initial move over * standalone runs * v2 store works * starting on changing v8 panel to fluent v9 drawer * new dm2 standalone works with vite * build passes * build fix and separated standalones * fixed tests * build passes --------- Co-authored-by: Danielle Cogburn <dacogburn@microsoft.com>
- Loading branch information
1 parent
4296a2a
commit 1bec11b
Showing
99 changed files
with
24,446 additions
and
2,183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
apps/Standalone/src/dataMapperV1/app/DataMapperStandaloneDesignerV2.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import { DevToolbox } from '../components/DevToolbox'; | ||
import { dataMapDataLoaderSlice } from '../state/DataMapDataLoader'; | ||
import { | ||
DataMapperDesigner as DataMapperDesignerV2, | ||
DataMapDataProvider as DataMapDataProviderV2, | ||
DataMapperDesignerProvider as DataMapperDesignerProviderV2, | ||
} from '@microsoft/logic-apps-data-mapper-v2'; | ||
import type { AppDispatch, RootState } from '../state/Store'; | ||
import { AzureThemeDark } from '@fluentui/azure-themes/lib/azure/AzureThemeDark'; | ||
import { AzureThemeLight } from '@fluentui/azure-themes/lib/azure/AzureThemeLight'; | ||
import { ThemeProvider } from '@fluentui/react'; | ||
import { FluentProvider, webDarkTheme, webLightTheme } from '@fluentui/react-components'; | ||
import { PortalCompatProvider } from '@fluentui/react-portal-compat'; | ||
import { InitDataMapperApiService, defaultDataMapperApiServiceOptions, getFunctions } from '@microsoft/logic-apps-data-mapper'; | ||
import { Theme as ThemeType } from '@microsoft/logic-apps-shared'; | ||
import { useEffect } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
|
||
const workflowSchemaFilenames = [ | ||
'Source.xsd', | ||
'Target.xsd', | ||
'SourceJson.json', | ||
'folder/TargetJson.json', | ||
'folder 2/file.json', | ||
'a/a.json', | ||
'a/b.json', | ||
'a/b/c.json', | ||
]; | ||
|
||
const customXsltPath = ['folder/file.xslt', 'file2.xslt']; | ||
|
||
export const DataMapperStandaloneDesignerV2 = () => { | ||
const dispatch = useDispatch<AppDispatch>(); | ||
const theme = useSelector((state: RootState) => state.dataMapDataLoader.theme); | ||
const armToken = useSelector((state: RootState) => state.dataMapDataLoader.armToken); | ||
|
||
const xsltFilename = useSelector((state: RootState) => state.dataMapDataLoader.xsltFilename); | ||
const xsltContent = useSelector((state: RootState) => state.dataMapDataLoader.xsltContent); | ||
const mapDefinition = useSelector((state: RootState) => state.dataMapDataLoader.mapDefinition); | ||
const mapMetadata = useSelector((state: RootState) => state.dataMapDataLoader.mapMetadata); | ||
const fetchedFunctions = useSelector((state: RootState) => state.dataMapDataLoader.fetchedFunctions); | ||
const sourceSchema = useSelector((state: RootState) => state.schemaDataLoader.sourceSchema); | ||
const targetSchema = useSelector((state: RootState) => state.schemaDataLoader.targetSchema); | ||
|
||
// Standalone uses default/dev runtime settings - can just run 'func host start' in the workflow root | ||
InitDataMapperApiService({ | ||
...defaultDataMapperApiServiceOptions, | ||
accessToken: armToken, | ||
}); | ||
|
||
const saveMapDefinitionCall = (dataMapDefinition: string, mapMetadata: string) => { | ||
console.log('Map Definition\n==============='); | ||
console.log(dataMapDefinition); | ||
|
||
console.log('Map Metadata\n==============='); | ||
console.log(mapMetadata); | ||
}; | ||
|
||
const saveXsltCall = (dataMapXslt: string) => { | ||
console.log('\nXSLT\n==============='); | ||
console.log(dataMapXslt); | ||
}; | ||
|
||
useEffect(() => { | ||
const fetchFunctionList = async () => { | ||
const fnManifest = await getFunctions(); | ||
|
||
if (typeof fnManifest !== 'string') { | ||
dispatch(dataMapDataLoaderSlice.actions.changeFetchedFunctions(fnManifest)); | ||
} | ||
}; | ||
|
||
fetchFunctionList(); | ||
}, [dispatch, armToken]); | ||
|
||
const isLightMode = theme === ThemeType.Light; | ||
|
||
return ( | ||
<div style={{ flex: '1 1 1px', display: 'flex', flexDirection: 'column' }}> | ||
<div style={{ flex: '0 1 1px' }}> | ||
<ThemeProvider theme={isLightMode ? AzureThemeLight : AzureThemeDark}> | ||
<FluentProvider theme={isLightMode ? webLightTheme : webDarkTheme}> | ||
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */} | ||
{/* @ts-ignore */} | ||
<PortalCompatProvider> | ||
<DevToolbox /> | ||
</PortalCompatProvider> | ||
</FluentProvider> | ||
</ThemeProvider> | ||
</div> | ||
|
||
<div style={{ flex: '1 1 1px', display: 'flex', flexDirection: 'column' }}> | ||
<DataMapperDesignerProviderV2 locale="en-US" theme={theme} options={{}}> | ||
<DataMapDataProviderV2 | ||
xsltFilename={xsltFilename} | ||
xsltContent={xsltContent} | ||
mapDefinition={mapDefinition} | ||
dataMapMetadata={mapMetadata} | ||
sourceSchema={sourceSchema} | ||
targetSchema={targetSchema} | ||
availableSchemas={workflowSchemaFilenames} | ||
customXsltPaths={customXsltPath} | ||
fetchedFunctions={fetchedFunctions} | ||
theme={theme} | ||
> | ||
<DataMapperDesignerV2 saveMapDefinitionCall={saveMapDefinitionCall} saveXsltCall={saveXsltCall} /> | ||
</DataMapDataProviderV2> | ||
</DataMapperDesignerProviderV2> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -449,7 +449,7 @@ const getDesignerServices = ( | |
workflowName, | ||
httpClient, | ||
}); | ||
|
||
const hostService = {}; | ||
|
||
return { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"name": "@microsoft/logic-apps-data-mapper-v2", | ||
"version": "4.1.1", | ||
"license": "MIT", | ||
"type": "module", | ||
"module": "src/index.ts", | ||
"main": "src/index.ts", | ||
"types": "src/index.ts", | ||
"exports": { | ||
".": { | ||
"types": "./src/index.ts", | ||
"import": "./src/index.ts", | ||
"default": "./src/index.ts" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
"node": ">=12" | ||
}, | ||
"files": [ | ||
"build/lib/**/*", | ||
"src" | ||
], | ||
"publishConfig": { | ||
"main": "build/lib/index.cjs", | ||
"module": "build/lib/index.js", | ||
"types": "build/lib/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types:": "./build/lib/index.d.ts", | ||
"import": "./build/lib/index.js", | ||
"default": "./build/lib/index.cjs" | ||
}, | ||
"./package.json": "./package.json", | ||
"./build/lib/index.css": "./build/lib/index.css" | ||
} | ||
}, | ||
"scripts": { | ||
"build:lib": "tsup && tsc --emitDeclarationOnly", | ||
"test:lib": "vitest --retry=3", | ||
"unpublish:local": "pnpm unpublish --force", | ||
"publish:local": "pnpm unpublish --force && pnpm publish --no-git-checks --registry http://localhost:4873" | ||
}, | ||
"dependencies": { | ||
"@fluentui/azure-themes": "8.5.70", | ||
"@fluentui/react": "8.110.2", | ||
"@fluentui/react-components": "9.42.0", | ||
"@fluentui/react-hooks": "8.6.20", | ||
"@fluentui/react-icons": "2.0.224", | ||
"@fluentui/react-migration-v8-v9": "9.2.16", | ||
"@fluentui/react-portal-compat": "9.0.60", | ||
"@microsoft/applicationinsights-react-js": "3.4.0", | ||
"@microsoft/applicationinsights-web": "2.8.9", | ||
"@microsoft/designer-ui": "workspace:*", | ||
"@microsoft/logic-apps-designer": "workspace:*", | ||
"@microsoft/logic-apps-shared": "workspace:*", | ||
"@react-hookz/web": "22.0.0", | ||
"@reduxjs/toolkit": "1.8.5", | ||
"fuse.js": "6.6.2", | ||
"immer": "9.0.15", | ||
"js-yaml": "4.1.0", | ||
"pathfinding": "0.4.18", | ||
"react-dnd": "16.0.1", | ||
"react-dnd-html5-backend": "16.0.1", | ||
"react-icons": "4.8.0", | ||
"react-intl": "6.3.0", | ||
"react-query": "3.39.3", | ||
"react-redux": "8.0.2", | ||
"reactflow": "11.8.2", | ||
"redux-thunk": "2.4.2", | ||
"redux-undo": "1.1.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.4.0 || ^17.0.0 || ^18.0.0", | ||
"react-dom": "^16.4.0 || ^17.0.0 || ^18.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/js-yaml": "^4.0.9", | ||
"@types/pathfinding": "^0.0.9" | ||
} | ||
} |
Oops, something went wrong.