@mcp-abap-adt/adt-clients 3.14.3 → 3.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -52,7 +52,7 @@ export declare const ACCEPT_TABLE_TYPE = "application/vnd.sap.adt.tabletypes.v2+
|
|
|
52
52
|
export declare const CT_TABLE_TYPE = "application/vnd.sap.adt.tabletype.v1+xml";
|
|
53
53
|
export declare const ACCEPT_DOMAIN = "application/vnd.sap.adt.domains.v2+xml, application/vnd.sap.adt.domains.v1+xml";
|
|
54
54
|
export declare const CT_DOMAIN = "application/vnd.sap.adt.domains.v2+xml";
|
|
55
|
-
export declare const ACCEPT_DATA_ELEMENT = "application/vnd.sap.adt.dataelements.
|
|
55
|
+
export declare const ACCEPT_DATA_ELEMENT = "application/vnd.sap.adt.dataelements.v1+xml, application/vnd.sap.adt.dataelements.v2+xml";
|
|
56
56
|
export declare const CT_DATA_ELEMENT = "application/vnd.sap.adt.dataelements.v2+xml";
|
|
57
57
|
export declare const ACCEPT_STRUCTURE = "application/vnd.sap.adt.structures.v2+xml, application/vnd.sap.adt.structures.v1+xml";
|
|
58
58
|
export declare const CT_STRUCTURE = "application/vnd.sap.adt.structures.v2+xml";
|
|
@@ -84,7 +84,7 @@ exports.CT_TABLE_TYPE = 'application/vnd.sap.adt.tabletype.v1+xml';
|
|
|
84
84
|
exports.ACCEPT_DOMAIN = 'application/vnd.sap.adt.domains.v2+xml, application/vnd.sap.adt.domains.v1+xml';
|
|
85
85
|
exports.CT_DOMAIN = 'application/vnd.sap.adt.domains.v2+xml';
|
|
86
86
|
// Data Elements
|
|
87
|
-
exports.ACCEPT_DATA_ELEMENT = 'application/vnd.sap.adt.dataelements.
|
|
87
|
+
exports.ACCEPT_DATA_ELEMENT = 'application/vnd.sap.adt.dataelements.v1+xml, application/vnd.sap.adt.dataelements.v2+xml';
|
|
88
88
|
exports.CT_DATA_ELEMENT = 'application/vnd.sap.adt.dataelements.v2+xml';
|
|
89
89
|
// Structures
|
|
90
90
|
exports.ACCEPT_STRUCTURE = 'application/vnd.sap.adt.structures.v2+xml, application/vnd.sap.adt.structures.v1+xml';
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DataElement create operations - Low-level functions
|
|
3
3
|
* NOTE: Caller should call connection.setSessionType("stateful") before creating
|
|
4
|
+
*
|
|
5
|
+
* Create sends minimal XML (root element + packageRef only).
|
|
6
|
+
* Type details (typeKind, labels, etc.) are set via update after creation,
|
|
7
|
+
* matching Eclipse ADT behavior.
|
|
4
8
|
*/
|
|
5
9
|
import type { IAdtResponse as AxiosResponse, IAbapConnection } from '@mcp-abap-adt/interfaces';
|
|
6
10
|
import type { ICreateDataElementParams } from './types';
|
|
7
11
|
/**
|
|
8
12
|
* Low-level: Create data element (POST)
|
|
9
|
-
* Does NOT activate - just creates the object
|
|
13
|
+
* Does NOT activate - just creates the object with minimal metadata.
|
|
14
|
+
* Type information and labels should be set via updateDataElement() afterwards.
|
|
10
15
|
*/
|
|
11
16
|
export declare function create(connection: IAbapConnection, args: ICreateDataElementParams): Promise<AxiosResponse>;
|
|
12
17
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/core/dataElement/create.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/core/dataElement/create.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD;;;;GAIG;AACH,wBAAsB,MAAM,CAC1B,UAAU,EAAE,eAAe,EAC3B,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,aAAa,CAAC,CA8BxB"}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* DataElement create operations - Low-level functions
|
|
4
4
|
* NOTE: Caller should call connection.setSessionType("stateful") before creating
|
|
5
|
+
*
|
|
6
|
+
* Create sends minimal XML (root element + packageRef only).
|
|
7
|
+
* Type details (typeKind, labels, etc.) are set via update after creation,
|
|
8
|
+
* matching Eclipse ADT behavior.
|
|
5
9
|
*/
|
|
6
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
11
|
exports.create = create;
|
|
@@ -10,118 +14,20 @@ const internalUtils_1 = require("../../utils/internalUtils");
|
|
|
10
14
|
const timeouts_1 = require("../../utils/timeouts");
|
|
11
15
|
/**
|
|
12
16
|
* Low-level: Create data element (POST)
|
|
13
|
-
* Does NOT activate - just creates the object
|
|
17
|
+
* Does NOT activate - just creates the object with minimal metadata.
|
|
18
|
+
* Type information and labels should be set via updateDataElement() afterwards.
|
|
14
19
|
*/
|
|
15
20
|
async function create(connection, args) {
|
|
16
21
|
const url = `/sap/bc/adt/ddic/dataelements${args.transport_request ? `?corrNr=${args.transport_request}` : ''}`;
|
|
17
22
|
const username = args.responsible || '';
|
|
18
23
|
const masterSystem = args.masterSystem || '';
|
|
19
|
-
// Description is limited to 60 characters in SAP ADT
|
|
20
24
|
const description = (0, internalUtils_1.limitDescription)(args.description || args.data_element_name);
|
|
21
|
-
if (!args.type_kind) {
|
|
22
|
-
throw new Error('type_kind is required. Must be one of: domain, predefinedAbapType, refToPredefinedAbapType, refToDictionaryType, refToClifType');
|
|
23
|
-
}
|
|
24
|
-
// Validate required parameters based on type_kind
|
|
25
|
-
// predefinedAbapType and refToPredefinedAbapType require data_type
|
|
26
|
-
// Other types (domain, refToDictionaryType, refToClifType) require type_name
|
|
27
|
-
if (args.type_kind === 'predefinedAbapType' ||
|
|
28
|
-
args.type_kind === 'refToPredefinedAbapType') {
|
|
29
|
-
if (!args.data_type) {
|
|
30
|
-
throw new Error(`data_type is required when type_kind is '${args.type_kind}'. Provide data type (e.g., CHAR, NUMC, INT4).`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
// domain, refToDictionaryType, refToClifType require type_name
|
|
35
|
-
if (args.type_kind === 'domain') {
|
|
36
|
-
// For domain, type_name (domain name) is required, but it will be used as data_type internally
|
|
37
|
-
if (!args.type_name && !args.data_type) {
|
|
38
|
-
throw new Error(`type_name (domain name) is required when type_kind is 'domain'. Provide domain name (e.g., ZOK_AUTH_ID).`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// refToDictionaryType, refToClifType
|
|
43
|
-
if (!args.type_name) {
|
|
44
|
-
throw new Error(`type_name is required when type_kind is '${args.type_kind}'. Provide ${args.type_kind === 'refToDictionaryType' ? 'data element name' : 'class name'}.`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const typeKindXml = args.type_kind;
|
|
49
|
-
// Use provided values directly - no automatic determination
|
|
50
|
-
// When typeKind is 'domain', dataType should contain the domain name, and it goes to typeName in XML
|
|
51
|
-
let typeName = '';
|
|
52
|
-
if (typeKindXml === 'domain') {
|
|
53
|
-
// For domain type, typeName is the domain name (type_name), not the underlying data type
|
|
54
|
-
typeName = (args.type_name || args.data_type || '').toUpperCase();
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
// For other types, typeName comes from type_name parameter
|
|
58
|
-
typeName = args.type_name ? args.type_name.toUpperCase() : '';
|
|
59
|
-
}
|
|
60
|
-
const dataType = args.data_type || '';
|
|
61
|
-
const length = args.length || 0;
|
|
62
|
-
const decimals = args.decimals || 0;
|
|
63
|
-
const shortLabel = args.short_label || '';
|
|
64
|
-
const mediumLabel = args.medium_label || '';
|
|
65
|
-
const longLabel = args.long_label || '';
|
|
66
|
-
const headingLabel = args.heading_label || '';
|
|
67
|
-
const searchHelp = args.search_help !== undefined ? args.search_help : '';
|
|
68
|
-
const searchHelpParameter = args.search_help_parameter !== undefined ? args.search_help_parameter : '';
|
|
69
|
-
const setGetParameter = args.set_get_parameter !== undefined ? args.set_get_parameter : '';
|
|
70
|
-
const defaultComponentName = args.default_component_name !== undefined
|
|
71
|
-
? args.default_component_name
|
|
72
|
-
: '';
|
|
73
|
-
const deactivateInputHistory = args.deactivate_input_history !== undefined
|
|
74
|
-
? args.deactivate_input_history
|
|
75
|
-
: false;
|
|
76
|
-
const changeDocument = args.change_document !== undefined ? args.change_document : false;
|
|
77
|
-
const leftToRightDirection = args.left_to_right_direction !== undefined
|
|
78
|
-
? args.left_to_right_direction
|
|
79
|
-
: false;
|
|
80
|
-
const deactivateBIDIFiltering = args.deactivate_bidi_filtering !== undefined
|
|
81
|
-
? args.deactivate_bidi_filtering
|
|
82
|
-
: false;
|
|
83
25
|
const masterSystemAttr = masterSystem
|
|
84
26
|
? ` adtcore:masterSystem="${masterSystem}"`
|
|
85
27
|
: '';
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
xmlns:adtcore="http://www.sap.com/adt/core"
|
|
89
|
-
xmlns:atom="http://www.w3.org/2005/Atom"
|
|
90
|
-
xmlns:dtel="http://www.sap.com/adt/dictionary/dataelements"
|
|
91
|
-
adtcore:description="${description}"
|
|
92
|
-
adtcore:language="EN"
|
|
93
|
-
adtcore:name="${args.data_element_name.toUpperCase()}"
|
|
94
|
-
adtcore:type="DTEL/DE"
|
|
95
|
-
adtcore:masterLanguage="EN"${masterSystemAttr}
|
|
96
|
-
adtcore:responsible="${username}">
|
|
28
|
+
const responsibleAttr = username ? ` adtcore:responsible="${username}"` : '';
|
|
29
|
+
const xmlBody = `<?xml version="1.0" encoding="UTF-8"?><blue:wbobj xmlns:blue="http://www.sap.com/wbobj/dictionary/dtel" xmlns:adtcore="http://www.sap.com/adt/core" adtcore:description="${description}" adtcore:language="EN" adtcore:name="${args.data_element_name.toUpperCase()}" adtcore:type="DTEL/DE" adtcore:masterLanguage="EN"${masterSystemAttr}${responsibleAttr}>
|
|
97
30
|
<adtcore:packageRef adtcore:name="${args.package_name.toUpperCase()}"/>
|
|
98
|
-
<dtel:dataElement>
|
|
99
|
-
<dtel:typeKind>${typeKindXml}</dtel:typeKind>
|
|
100
|
-
${typeName ? `<dtel:typeName>${typeName}</dtel:typeName>` : '<dtel:typeName/>'}
|
|
101
|
-
${dataType ? `<dtel:dataType>${dataType}</dtel:dataType>` : '<dtel:dataType/>'}
|
|
102
|
-
<dtel:dataTypeLength>${String(length).padStart(6, '0')}</dtel:dataTypeLength>
|
|
103
|
-
<dtel:dataTypeDecimals>${String(decimals).padStart(6, '0')}</dtel:dataTypeDecimals>
|
|
104
|
-
<dtel:shortFieldLabel>${shortLabel}</dtel:shortFieldLabel>
|
|
105
|
-
<dtel:shortFieldLength>10</dtel:shortFieldLength>
|
|
106
|
-
<dtel:shortFieldMaxLength>10</dtel:shortFieldMaxLength>
|
|
107
|
-
<dtel:mediumFieldLabel>${mediumLabel}</dtel:mediumFieldLabel>
|
|
108
|
-
<dtel:mediumFieldLength>20</dtel:mediumFieldLength>
|
|
109
|
-
<dtel:mediumFieldMaxLength>20</dtel:mediumFieldMaxLength>
|
|
110
|
-
<dtel:longFieldLabel>${longLabel}</dtel:longFieldLabel>
|
|
111
|
-
<dtel:longFieldLength>40</dtel:longFieldLength>
|
|
112
|
-
<dtel:longFieldMaxLength>40</dtel:longFieldMaxLength>
|
|
113
|
-
<dtel:headingFieldLabel>${headingLabel}</dtel:headingFieldLabel>
|
|
114
|
-
<dtel:headingFieldLength>55</dtel:headingFieldLength>
|
|
115
|
-
<dtel:headingFieldMaxLength>55</dtel:headingFieldMaxLength>
|
|
116
|
-
${searchHelp ? `<dtel:searchHelp>${searchHelp}</dtel:searchHelp>` : '<dtel:searchHelp/>'}
|
|
117
|
-
${searchHelpParameter ? `<dtel:searchHelpParameter>${searchHelpParameter}</dtel:searchHelpParameter>` : '<dtel:searchHelpParameter/>'}
|
|
118
|
-
${setGetParameter ? `<dtel:setGetParameter>${setGetParameter}</dtel:setGetParameter>` : '<dtel:setGetParameter/>'}
|
|
119
|
-
${defaultComponentName ? `<dtel:defaultComponentName>${defaultComponentName}</dtel:defaultComponentName>` : '<dtel:defaultComponentName/>'}
|
|
120
|
-
<dtel:deactivateInputHistory>${deactivateInputHistory}</dtel:deactivateInputHistory>
|
|
121
|
-
<dtel:changeDocument>${changeDocument}</dtel:changeDocument>
|
|
122
|
-
<dtel:leftToRightDirection>${leftToRightDirection}</dtel:leftToRightDirection>
|
|
123
|
-
<dtel:deactivateBIDIFiltering>${deactivateBIDIFiltering}</dtel:deactivateBIDIFiltering>
|
|
124
|
-
</dtel:dataElement>
|
|
125
31
|
</blue:wbobj>`;
|
|
126
32
|
const headers = {
|
|
127
33
|
Accept: contentTypes_1.ACCEPT_DATA_ELEMENT,
|