Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d858387
feat: add new key-user import page and its logic
nikmace Jan 5, 2026
4b32394
refactor: improve logic
nikmace Jan 6, 2026
821cb74
refactor: move key user change writing to generate method
nikmace Jan 6, 2026
416e633
refactor: improve lrep service
nikmace Jan 6, 2026
37dfd19
test: add tooling tests
nikmace Jan 6, 2026
498eb75
Merge branch 'main' into feat/3964/taking-over-key-user-changes
nikmace Jan 6, 2026
5d5dd34
fix: lint errors
nikmace Jan 6, 2026
d6d39ae
refactor: change texts
nikmace Jan 7, 2026
0d73e9e
test: fix test
nikmace Jan 7, 2026
27f040b
refactor: slightly change texts
nikmace Jan 8, 2026
1d9685e
refactor: add new endpoint
nikmace Jan 9, 2026
4765cb7
feat: add change conversion
nikmace Jan 9, 2026
6cce583
refactor: improve prompter class
nikmace Jan 12, 2026
58bc86f
fix: clean key user changes after system change
nikmace Jan 12, 2026
7a5b4bc
refactor: change prompting logic, messages and extract code
nikmace Jan 12, 2026
084ab16
chore: rename file
nikmace Jan 12, 2026
c6e7ec5
refactor: remove optional defaults
nikmace Jan 12, 2026
9175e41
test: add prompter class test suites
nikmace Jan 13, 2026
4a91540
test: add missing tests
nikmace Jan 13, 2026
7acf257
test: add missing tests
nikmace Jan 13, 2026
9f01900
chore: add cset
nikmace Jan 13, 2026
512cd61
refactor: change texts
nikmace Jan 13, 2026
6105a9a
refactor: change texts
nikmace Jan 13, 2026
1b72ff4
refactor: change property and method name
nikmace Jan 13, 2026
35c25cf
test: add integration tests
nikmace Jan 13, 2026
ae3af32
refactor: add requested changes
nikmace Jan 13, 2026
6c1eb5b
Merge branch 'main' into feat/3964/taking-over-key-user-changes
nikmace Jan 14, 2026
c77ddb8
refactor: add requested changes
nikmace Jan 15, 2026
174f76a
refactor: change support generator
nikmace Jan 15, 2026
6db3504
refactor: change text
nikmace Jan 16, 2026
e89b8ae
fix: hide key user changes page for cf and ext project flows
nikmace Jan 19, 2026
eeac78a
fix: resetting state and cloudready system auth bug
nikmace Jan 19, 2026
4cc04ed
fix: error msg parsing from server
nikmace Jan 19, 2026
45a4f11
refactor: change ui message display, lables and errors
nikmace Jan 22, 2026
b9697ac
refactor: change texts
nikmace Jan 22, 2026
ded968e
refactor: remove add_message and change texts
nikmace Jan 22, 2026
917df67
refactor: change texts
nikmace Jan 22, 2026
1a8b6a2
Merge branch 'main' into feat/3964/taking-over-key-user-changes
nikmace Jan 26, 2026
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
7 changes: 7 additions & 0 deletions .changeset/two-dragons-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@sap-ux/generator-adp': minor
'@sap-ux/axios-extension': patch
'@sap-ux/adp-tooling': patch
---

feat(generator-adp): Developer taking over Key-User changes
66 changes: 65 additions & 1 deletion packages/adp-tooling/src/base/change-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import { existsSync, readFileSync, readdirSync } from 'node:fs';

import { DirName, getWebappPath } from '@sap-ux/project-access';
import {
FlexLayer,
TemplateFileName,
type AnnotationsData,
type ChangeType,
type DescriptorVariant,
type InboundContent,
type ManifestChangeProperties,
type PropertyValueType,
ChangeTypeMap
ChangeTypeMap,
type AdpWriterConfig
} from '../types';
import { renderFile } from 'ejs';

Expand Down Expand Up @@ -76,6 +78,68 @@ export async function writeAnnotationChange(
}
}

/**
* Writes key-user change payloads to the generated adaptation project. Transforms key-user changes to a developer adaptation format.
*
* @param projectPath - Project root path.
* @param config - The writer configuration.
* @param fs - Yeoman mem-fs editor.
*/
export async function writeKeyUserChanges(projectPath: string, config: AdpWriterConfig, fs: Editor): Promise<void> {
const changes = config.keyUserChanges;
if (!changes?.length) {
return;
}

for (const entry of changes) {
if (!entry?.content) {
continue;
}

const change = { ...(entry.content as Record<string, unknown>) };
if (!change['fileName']) {
continue;
}

const transformedChange = transformKeyUserChangeForAdp(change, config.app.id, config.app.layer);

await writeChangeToFolder(projectPath, transformedChange as unknown as ManifestChangeProperties, fs);
}
}

/**
* Transforms a key-user change to a developer adaptation format.
*
* @param change - The key-user change from the backend.
* @param appId - The ID of the newly created Adaptation Project.
* @param layer - The layer of the change.
* @returns {Record<string, unknown>} The transformed change object.
*/
export function transformKeyUserChangeForAdp(
change: Record<string, unknown>,
appId: string,
layer: FlexLayer | undefined
): Record<string, unknown> {
const transformed = { ...change };

transformed.layer = layer ?? FlexLayer.CUSTOMER_BASE;
transformed.reference = appId;
transformed.namespace = path.posix.join('apps', appId, DirName.Changes, '/');
if (transformed.projectId) {
transformed.projectId = appId;
}
transformed.support ??= {};
const supportObject = transformed.support as Record<string, unknown>;
supportObject.generator = 'adp-key-user-converter';

delete transformed.adaptationId;
delete transformed.version;
delete transformed.context;
delete transformed.versionId;

return transformed;
}

/**
* Writes a given change object to a file within a specified folder in the project's 'changes' directory.
* If an additional subdirectory is specified, the change file is written there.
Expand Down
1 change: 1 addition & 0 deletions packages/adp-tooling/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export * from './base/helper';
export * from './base/constants';
export * from './base/project-builder';
export * from './base/abap/manifest-service';
export { writeKeyUserChanges } from './base/change-utils';
export { promptGeneratorInput, PromptDefaults } from './base/prompt';
export * from './preview/adp-preview';
export * from './writer/cf';
Expand Down
7 changes: 6 additions & 1 deletion packages/adp-tooling/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { UI5FlexLayer, ManifestNamespace, Manifest, Package } from '@sap-ux/project-access';
import type { DestinationAbapTarget, UrlAbapTarget } from '@sap-ux/system-access';
import type { Adp, BspApp } from '@sap-ux/ui5-config';
import type { AxiosRequestConfig, OperationsType } from '@sap-ux/axios-extension';
import type { AxiosRequestConfig, KeyUserChangeContent, OperationsType } from '@sap-ux/axios-extension';
import type { Editor } from 'mem-fs-editor';
import type { Destination } from '@sap-ux/btp-utils';
import type { YUIQuestion } from '@sap-ux/inquirer-common';
Expand Down Expand Up @@ -109,6 +109,10 @@ export interface AdpWriterConfig {
*/
templatePathOverwrite?: string;
};
/**
* Optional: Key-user changes to be written to the project.
*/
keyUserChanges?: KeyUserChangeContent[];
}

/**
Expand All @@ -133,6 +137,7 @@ export interface AttributesAnswers {
enableTypeScript: boolean;
addDeployConfig?: boolean;
addFlpConfig?: boolean;
importKeyUserChanges?: boolean;
}

export interface SourceApplication {
Expand Down
5 changes: 4 additions & 1 deletion packages/adp-tooling/src/writer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { getI18nDescription, getI18nModels, writeI18nModels } from './i18n';
import { writeTemplateToFolder, writeUI5Yaml, writeUI5DeployYaml } from './project-utils';
import { FlexLayer, type AdpWriterConfig, type InternalInboundNavigation } from '../types';
import { getApplicationType } from '../source';
import { writeKeyUserChanges } from '../base/change-utils';

const baseTmplPath = join(__dirname, '../../templates');

Expand All @@ -23,7 +24,8 @@ function setDefaults(config: AdpWriterConfig): AdpWriterConfig {
ui5: { ...config.ui5 },
deploy: config.deploy ? { ...config.deploy } : undefined,
options: { ...config.options },
customConfig: config.customConfig ? { ...config.customConfig } : undefined
customConfig: config.customConfig ? { ...config.customConfig } : undefined,
keyUserChanges: config.keyUserChanges
};
configWithDefaults.app.title ??= `Adaptation of ${config.app.reference}`;
configWithDefaults.app.layer ??= FlexLayer.CUSTOMER_BASE;
Expand Down Expand Up @@ -67,6 +69,7 @@ export async function generate(basePath: string, config: AdpWriterConfig, fs?: E
writeTemplateToFolder(templatePath, join(basePath), fullConfig, fs);
await writeUI5DeployYaml(basePath, fullConfig, fs);
await writeUI5Yaml(basePath, fullConfig, fs);
await writeKeyUserChanges(basePath, fullConfig, fs);

return fs;
}
Expand Down
12 changes: 9 additions & 3 deletions packages/adp-tooling/src/writer/writer-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { join } from 'node:path';

import type { ToolsLogger } from '@sap-ux/logger';
import type { Manifest, Package } from '@sap-ux/project-access';
import type { AbapServiceProvider } from '@sap-ux/axios-extension';
import type { AbapServiceProvider, KeyUserChangeContent } from '@sap-ux/axios-extension';

import type {
AdpWriterConfig,
Expand Down Expand Up @@ -68,6 +68,10 @@ export interface ConfigOptions {
* The tools ID.
*/
toolsId: string;
/**
* Optional: Key-user changes to be written to the project.
*/
keyUserChanges?: KeyUserChangeContent[];
}

/**
Expand All @@ -94,7 +98,8 @@ export async function getConfig(options: ConfigOptions): Promise<AdpWriterConfig
publicVersions,
systemVersion,
manifest,
toolsId
toolsId,
keyUserChanges
} = options;

const ato = await provider.getAtoInfo();
Expand Down Expand Up @@ -155,7 +160,8 @@ export async function getConfig(options: ConfigOptions): Promise<AdpWriterConfig
options: {
fioriTools: true,
enableTypeScript
}
},
keyUserChanges
};
}

Expand Down
Loading
Loading