package.json: replace toml package

We need to be able to stringify objects into a toml format for on-prem.
This is needed to save the worker config, unfortunately the current toml
package only parses toml and can't stringify back to toml.
This commit is contained in:
Gianluca Zuccarelli 2025-04-29 16:36:54 +00:00 committed by Klara Simickova
parent cfa437a34b
commit 1715d395c2
4 changed files with 26 additions and 17 deletions

View file

@ -1,5 +1,6 @@
import React from 'react';
import { parse } from '@ltd/j-toml';
import {
ActionGroup,
Button,
@ -18,7 +19,6 @@ import { DropEvent } from '@patternfly/react-core/dist/esm/helpers';
import { HelpIcon } from '@patternfly/react-icons';
import { addNotification } from '@redhat-cloud-services/frontend-components-notifications/redux';
import { useNavigate } from 'react-router-dom';
import { parse } from 'toml';
import { mapOnPremToHosted } from './helpers/onPremToHostedBlueprintMapper';
@ -27,7 +27,10 @@ import {
useBulkImportRepositoriesMutation,
} from '../../store/contentSourcesApi';
import { useAppDispatch } from '../../store/hooks';
import { BlueprintExportResponse } from '../../store/imageBuilderApi';
import {
BlueprintExportResponse,
BlueprintItem,
} from '../../store/imageBuilderApi';
import { importCustomRepositories, wizardState } from '../../store/wizardSlice';
import { resolveRelPath } from '../../Utilities/path';
import { mapExportRequestToState } from '../CreateImageWizard/utilities/requestMapper';
@ -130,7 +133,9 @@ export const ImportBlueprintModal: React.FunctionComponent<
const isJson = filename.endsWith('.json');
if (isToml) {
const tomlBlueprint = parse(fileContent);
const blueprintFromFile = mapOnPremToHosted(tomlBlueprint);
const blueprintFromFile = mapOnPremToHosted(
tomlBlueprint as BlueprintItem
);
const importBlueprintState = mapExportRequestToState(
blueprintFromFile,
[]