@rayutek/abap-adt-api 6.2.1-pkg-1.0.0
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.
- package/.abapgit.xml +27 -0
- package/LICENSE +21 -0
- package/README.md +23 -0
- package/build/AdtClient.d.ts +292 -0
- package/build/AdtClient.d.ts.map +1 -0
- package/build/AdtClient.js +628 -0
- package/build/AdtException.d.ts +62 -0
- package/build/AdtException.d.ts.map +1 -0
- package/build/AdtException.js +185 -0
- package/build/AdtHTTP.d.ts +113 -0
- package/build/AdtHTTP.d.ts.map +1 -0
- package/build/AdtHTTP.js +285 -0
- package/build/api/abapgit.d.ts +86 -0
- package/build/api/abapgit.d.ts.map +1 -0
- package/build/api/abapgit.js +300 -0
- package/build/api/activate.d.ts +39 -0
- package/build/api/activate.d.ts.map +1 -0
- package/build/api/activate.js +105 -0
- package/build/api/atc.d.ts +163 -0
- package/build/api/atc.d.ts.map +1 -0
- package/build/api/atc.js +440 -0
- package/build/api/cds.d.ts +52 -0
- package/build/api/cds.d.ts.map +1 -0
- package/build/api/cds.js +147 -0
- package/build/api/debugger.d.ts +238 -0
- package/build/api/debugger.d.ts.map +1 -0
- package/build/api/debugger.js +299 -0
- package/build/api/delete.d.ts +20 -0
- package/build/api/delete.d.ts.map +1 -0
- package/build/api/delete.js +29 -0
- package/build/api/discovery.d.ts +44 -0
- package/build/api/discovery.d.ts.map +1 -0
- package/build/api/discovery.js +78 -0
- package/build/api/feeds.d.ts +63 -0
- package/build/api/feeds.d.ts.map +1 -0
- package/build/api/feeds.js +65 -0
- package/build/api/index.d.ts +22 -0
- package/build/api/index.d.ts.map +1 -0
- package/build/api/index.js +37 -0
- package/build/api/nodeContents.d.ts +41 -0
- package/build/api/nodeContents.d.ts.map +1 -0
- package/build/api/nodeContents.js +78 -0
- package/build/api/objectcontents.d.ts +21 -0
- package/build/api/objectcontents.d.ts.map +1 -0
- package/build/api/objectcontents.js +68 -0
- package/build/api/objectcreator.d.ts +103 -0
- package/build/api/objectcreator.d.ts.map +1 -0
- package/build/api/objectcreator.js +372 -0
- package/build/api/objectstructure.d.ts +71 -0
- package/build/api/objectstructure.d.ts.map +1 -0
- package/build/api/objectstructure.js +37 -0
- package/build/api/refactor.d.ts +122 -0
- package/build/api/refactor.d.ts.map +1 -0
- package/build/api/refactor.js +470 -0
- package/build/api/revisions.d.ts +12 -0
- package/build/api/revisions.d.ts.map +1 -0
- package/build/api/revisions.js +61 -0
- package/build/api/search.d.ts +25 -0
- package/build/api/search.d.ts.map +1 -0
- package/build/api/search.js +67 -0
- package/build/api/syntax.d.ts +133 -0
- package/build/api/syntax.d.ts.map +1 -0
- package/build/api/syntax.js +327 -0
- package/build/api/tablecontents.d.ts +141 -0
- package/build/api/tablecontents.d.ts.map +1 -0
- package/build/api/tablecontents.js +186 -0
- package/build/api/trace.test.d.ts +2 -0
- package/build/api/trace.test.d.ts.map +1 -0
- package/build/api/trace.test.js +39 -0
- package/build/api/traces.d.ts +13 -0
- package/build/api/traces.d.ts.map +1 -0
- package/build/api/traces.js +97 -0
- package/build/api/tracetypes.d.ts +276 -0
- package/build/api/tracetypes.d.ts.map +1 -0
- package/build/api/tracetypes.js +474 -0
- package/build/api/transports.d.ts +158 -0
- package/build/api/transports.d.ts.map +1 -0
- package/build/api/transports.js +292 -0
- package/build/api/unittest.d.ts +81 -0
- package/build/api/unittest.d.ts.map +1 -0
- package/build/api/unittest.js +164 -0
- package/build/api/urlparser.d.ts +34 -0
- package/build/api/urlparser.d.ts.map +1 -0
- package/build/api/urlparser.js +86 -0
- package/build/index.d.ts +10 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +49 -0
- package/build/requestLogger.d.ts +30 -0
- package/build/requestLogger.d.ts.map +1 -0
- package/build/requestLogger.js +100 -0
- package/build/utilities.d.ts +42 -0
- package/build/utilities.d.ts.map +1 -0
- package/build/utilities.js +221 -0
- package/jest.config.js +32 -0
- package/package.json +45 -0
- package/setenv_sample.js +27 -0
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { session_types, ClientOptions, HttpResponse, HttpClient } from "./AdtHTTP";
|
|
2
|
+
export * from "./AdtClient";
|
|
3
|
+
export * from "./AdtException";
|
|
4
|
+
export { LogCallback, LogData } from "./requestLogger";
|
|
5
|
+
export { AbapClassStructure, AbapObjectStructure, ActivationResult, ActivationResultMessage, AdtCompatibilityGraph, AdtCoreDiscoveryResult, AdtDiscoveryResult, AdtGraphNode, AdtLock, AtcCustomizing, AtcProposal, AtcRunResult, AtcUser, AtcWorkList, BindingService, BindingServiceCollection, BindingServiceInformation, BindingServiceNavigation, BindingServiceResult, BindinTypes, BindingValidationOptions, ClassComponent, ClassInclude, ClassMetaData, CompletionElementInfo, CompletionProposal, CreatableType, CreatableTypeIds, CreatableTypes, DdicAnnotation, DdicElement, DdicObjectReference, DdicProperties, DebugAttach, DebugAction, DebugBreakpoint, DebugBreakpointError, DebugChildVariablesInfo, DebugChildVariablesHierarchy, Debuggee, DebuggerScope, DebuggingMode, DebugListenerError, DebugMessage, DebugMetaType, DebugMetaTypeComplex, DebugMetaTypeSimple, DebugReachedBreakpoint, DebugSettings, DebugStack, DebugStackAbap, DebugStackInfo, DebugStackSimple, DebugStackVit, DebugStackSourceType, DebugStackType, DebugState, DebugStep, DebugStepType, DebugVariable, DefinitionLocation, Delta, Dump, DumpCategory, DumpsFeed, ExtractMethodProposal, Feed, FeedAttribute, FeedDataType, FeedOperator, FeedQueryVariant, FeedRefresh, FixProposal, FragmentLocation, FunctionGroupMetaData, GenericMetaData, GenericRefactoring, GitBranch, GitExternalInfo, GitObject, GitRepo, GitStaging, GitStagingFile, GitStagingObject,
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated since 1.2.1, duplicate of GitExternalInfo
|
|
8
|
+
*/
|
|
9
|
+
GitRemoteInfo, GitUser, GroupTypeIds, GroupValidateOptions, HierarchyNode, InactiveObject, InactiveObjectElement, InactiveObjectRecord, Link, Location, MainInclude, NewBindingOptions, NewObjectOptions, NewPackageOptions, Node, NodeCategory, NodeObjectType, NodeParents, NodeStructure, NonGroupTypeIds, ObjectSourceOptions, ObjectType, ObjectTypeDescriptor, ObjectValidateOptions, ObjectVersion, PackageSpecificData, PackageTypeId, PackageTypes, PackageValidateOptions, PackageValueHelpResult, PackageValueHelpType, ParentTypeIds, PathStep, PrettyPrinterSettings, PrettyPrinterStyle, ProgramMetaData, QueryResult, QueryResultColumn, Range, ReferenceUri, RenameRefactoring, RenameRefactoringProposal, Revision, SearchResult, ServiceBinding, ServiceBindingBinding, ServiceBindingPackageRef, ServiceBindingService, SyntaxCheckResult, SystemUser, TransportAddUserResponse, SimpleTransportConfiguration, RangeTransportConfiguration, TransportConfiguration, TransportConfigurationEntry, TransportDateFilter, TransportInfo, TransportObject, TransportOwnerResponse, TransportReleaseMessage, TransportReleaseReport, TransportRequest, TransportTarget, TransportTask, TransportsOfUser, TypeKinds, UnitTestAlert, UnitTestAlertKind, UnitTestClass, UnitTestMethod, UnitTestOccurrenceMarker, UnitTestSeverity, UnitTestStackEntry, UriParts, uriPartsToString, UsageReference, UsageReferenceSnippet, ValidateOptions, ValidationResult, classIncludes, debugMetaIsComplex, hasPackageOptions, inactiveObjectsInResults, isBindingOptions, isClassMetaData, isClassStructure, isCreatableTypeId, isGroupType, isNodeParent, isNonGroupType, isPackageOptions, isPackageType, isDebugListenerError, isDebuggee, isDebuggerBreakpoint, objectPath, parentTypeId, parseServiceBinding, servicePreviewUrl, TraceResults, TraceHitList, TraceDBAccessResponse, TraceStatementResponse, TraceStatementOptions, TracesCreationConfig, TraceParameters, traceProcessObjects, TraceRequestList, UnitTestRunFlags } from "./api";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,YAAY,EACZ,UAAU,EACX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BAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,OAAO,CAAA"}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.traceProcessObjects = exports.servicePreviewUrl = exports.parseServiceBinding = exports.parentTypeId = exports.objectPath = exports.isDebuggerBreakpoint = exports.isDebuggee = exports.isDebugListenerError = exports.isPackageType = exports.isPackageOptions = exports.isNonGroupType = exports.isNodeParent = exports.isGroupType = exports.isCreatableTypeId = exports.isClassStructure = exports.isClassMetaData = exports.isBindingOptions = exports.inactiveObjectsInResults = exports.hasPackageOptions = exports.debugMetaIsComplex = exports.uriPartsToString = exports.UnitTestSeverity = exports.UnitTestAlertKind = exports.TypeKinds = exports.TransportDateFilter = exports.CreatableTypes = exports.BindinTypes = exports.session_types = void 0;
|
|
18
|
+
var AdtHTTP_1 = require("./AdtHTTP");
|
|
19
|
+
Object.defineProperty(exports, "session_types", { enumerable: true, get: function () { return AdtHTTP_1.session_types; } });
|
|
20
|
+
__exportStar(require("./AdtClient"), exports);
|
|
21
|
+
__exportStar(require("./AdtException"), exports);
|
|
22
|
+
var api_1 = require("./api");
|
|
23
|
+
Object.defineProperty(exports, "BindinTypes", { enumerable: true, get: function () { return api_1.BindinTypes; } });
|
|
24
|
+
Object.defineProperty(exports, "CreatableTypes", { enumerable: true, get: function () { return api_1.CreatableTypes; } });
|
|
25
|
+
Object.defineProperty(exports, "TransportDateFilter", { enumerable: true, get: function () { return api_1.TransportDateFilter; } });
|
|
26
|
+
Object.defineProperty(exports, "TypeKinds", { enumerable: true, get: function () { return api_1.TypeKinds; } });
|
|
27
|
+
Object.defineProperty(exports, "UnitTestAlertKind", { enumerable: true, get: function () { return api_1.UnitTestAlertKind; } });
|
|
28
|
+
Object.defineProperty(exports, "UnitTestSeverity", { enumerable: true, get: function () { return api_1.UnitTestSeverity; } });
|
|
29
|
+
Object.defineProperty(exports, "uriPartsToString", { enumerable: true, get: function () { return api_1.uriPartsToString; } });
|
|
30
|
+
Object.defineProperty(exports, "debugMetaIsComplex", { enumerable: true, get: function () { return api_1.debugMetaIsComplex; } });
|
|
31
|
+
Object.defineProperty(exports, "hasPackageOptions", { enumerable: true, get: function () { return api_1.hasPackageOptions; } });
|
|
32
|
+
Object.defineProperty(exports, "inactiveObjectsInResults", { enumerable: true, get: function () { return api_1.inactiveObjectsInResults; } });
|
|
33
|
+
Object.defineProperty(exports, "isBindingOptions", { enumerable: true, get: function () { return api_1.isBindingOptions; } });
|
|
34
|
+
Object.defineProperty(exports, "isClassMetaData", { enumerable: true, get: function () { return api_1.isClassMetaData; } });
|
|
35
|
+
Object.defineProperty(exports, "isClassStructure", { enumerable: true, get: function () { return api_1.isClassStructure; } });
|
|
36
|
+
Object.defineProperty(exports, "isCreatableTypeId", { enumerable: true, get: function () { return api_1.isCreatableTypeId; } });
|
|
37
|
+
Object.defineProperty(exports, "isGroupType", { enumerable: true, get: function () { return api_1.isGroupType; } });
|
|
38
|
+
Object.defineProperty(exports, "isNodeParent", { enumerable: true, get: function () { return api_1.isNodeParent; } });
|
|
39
|
+
Object.defineProperty(exports, "isNonGroupType", { enumerable: true, get: function () { return api_1.isNonGroupType; } });
|
|
40
|
+
Object.defineProperty(exports, "isPackageOptions", { enumerable: true, get: function () { return api_1.isPackageOptions; } });
|
|
41
|
+
Object.defineProperty(exports, "isPackageType", { enumerable: true, get: function () { return api_1.isPackageType; } });
|
|
42
|
+
Object.defineProperty(exports, "isDebugListenerError", { enumerable: true, get: function () { return api_1.isDebugListenerError; } });
|
|
43
|
+
Object.defineProperty(exports, "isDebuggee", { enumerable: true, get: function () { return api_1.isDebuggee; } });
|
|
44
|
+
Object.defineProperty(exports, "isDebuggerBreakpoint", { enumerable: true, get: function () { return api_1.isDebuggerBreakpoint; } });
|
|
45
|
+
Object.defineProperty(exports, "objectPath", { enumerable: true, get: function () { return api_1.objectPath; } });
|
|
46
|
+
Object.defineProperty(exports, "parentTypeId", { enumerable: true, get: function () { return api_1.parentTypeId; } });
|
|
47
|
+
Object.defineProperty(exports, "parseServiceBinding", { enumerable: true, get: function () { return api_1.parseServiceBinding; } });
|
|
48
|
+
Object.defineProperty(exports, "servicePreviewUrl", { enumerable: true, get: function () { return api_1.servicePreviewUrl; } });
|
|
49
|
+
Object.defineProperty(exports, "traceProcessObjects", { enumerable: true, get: function () { return api_1.traceProcessObjects; } });
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HttpClientOptions, HttpClientResponse } from "./AdtHTTP";
|
|
2
|
+
export interface RequestData {
|
|
3
|
+
method: string;
|
|
4
|
+
uri: string;
|
|
5
|
+
params: Record<string, string>;
|
|
6
|
+
headers: Record<string, string>;
|
|
7
|
+
body?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ResponseData {
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
statusCode: number;
|
|
12
|
+
statusMessage: string;
|
|
13
|
+
body?: string;
|
|
14
|
+
}
|
|
15
|
+
export type LogData = {
|
|
16
|
+
id: number;
|
|
17
|
+
request: RequestData;
|
|
18
|
+
response: ResponseData;
|
|
19
|
+
stateful: boolean;
|
|
20
|
+
startTime: Date;
|
|
21
|
+
duration: number;
|
|
22
|
+
error?: Error;
|
|
23
|
+
clientId: number;
|
|
24
|
+
};
|
|
25
|
+
export interface LogCallback {
|
|
26
|
+
(data: LogData): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const logError: (clientId: number, error: unknown, callback: LogCallback | undefined, config: HttpClientOptions) => void;
|
|
29
|
+
export declare const logResponse: (clientId: number, original: HttpClientResponse, config: HttpClientOptions, callback: LogCallback | undefined) => void;
|
|
30
|
+
//# sourceMappingURL=requestLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestLogger.d.ts","sourceRoot":"","sources":["../src/requestLogger.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAEjE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,YAAY,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,IAAI,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;CACtB;AA6ED,eAAO,MAAM,QAAQ,aACT,MAAM,SACT,OAAO,YACJ,WAAW,GAAG,SAAS,UACzB,iBAAiB,SAuB1B,CAAA;AAED,eAAO,MAAM,WAAW,aACZ,MAAM,YACN,kBAAkB,UACpB,iBAAiB,YACf,WAAW,GAAG,SAAS,SAQlC,CAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.logResponse = exports.logError = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const _1 = require(".");
|
|
9
|
+
const utilities_1 = require("./utilities");
|
|
10
|
+
const getLoggingData = (config) => {
|
|
11
|
+
if (!(0, utilities_1.isObject)(config))
|
|
12
|
+
return { id: -1, startTime: new Date(), duration: 0 };
|
|
13
|
+
const id = (0, utilities_1.isNumber)(config === null || config === void 0 ? void 0 : config.adtRequestNumber) ? config.adtRequestNumber : -1;
|
|
14
|
+
const startTime = (config === null || config === void 0 ? void 0 : config.adtStartTime) instanceof Date ? config.adtStartTime : new Date();
|
|
15
|
+
return {
|
|
16
|
+
id,
|
|
17
|
+
startTime,
|
|
18
|
+
duration: new Date().getTime() - startTime.getTime()
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const createLogData = (request, response, clientId, config, error) => {
|
|
22
|
+
var _a;
|
|
23
|
+
const { id, duration, startTime } = getLoggingData(config);
|
|
24
|
+
const stateful = ((_a = request.headers) === null || _a === void 0 ? void 0 : _a["X-sap-adt-sessiontype"]) === _1.session_types.stateful;
|
|
25
|
+
return { id, request, response, startTime, duration, stateful, clientId };
|
|
26
|
+
};
|
|
27
|
+
const convertRequest = (original) => {
|
|
28
|
+
if (!(0, utilities_1.isObject)(original))
|
|
29
|
+
return { headers: {}, method: "", uri: "", params: {} };
|
|
30
|
+
const { headers, data, method, uri, params } = original;
|
|
31
|
+
return {
|
|
32
|
+
method: method || "GET",
|
|
33
|
+
uri: (0, utilities_1.isString)(uri) ? uri : "",
|
|
34
|
+
params: (0, utilities_1.isObject)(params) ? { ...params } : {},
|
|
35
|
+
headers: (0, utilities_1.isObject)(headers) ? { ...headers } : {},
|
|
36
|
+
body: (0, utilities_1.isString)(data) || (0, utilities_1.isUndefined)(data) ? data : JSON.stringify(data)
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const convertAxiosResponse = (original) => {
|
|
40
|
+
if (!original)
|
|
41
|
+
return { headers: {}, statusCode: 0, statusMessage: "" };
|
|
42
|
+
const { headers, data, status, statusText } = original;
|
|
43
|
+
return {
|
|
44
|
+
headers: headers ? { ...headers } : {},
|
|
45
|
+
statusCode: status,
|
|
46
|
+
statusMessage: statusText,
|
|
47
|
+
body: (0, utilities_1.isString)(data) ? data : JSON.stringify(data)
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const convertResponse = (original) => {
|
|
51
|
+
if (!original)
|
|
52
|
+
return { headers: {}, statusCode: 0, statusMessage: "" };
|
|
53
|
+
if ((0, _1.isAdtException)(original)) {
|
|
54
|
+
const resp = {
|
|
55
|
+
headers: {},
|
|
56
|
+
statusCode: (0, _1.isAdtError)(original) ? original.err : 501,
|
|
57
|
+
statusMessage: original.message
|
|
58
|
+
};
|
|
59
|
+
return resp;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const { headers, body, status, statusText } = original;
|
|
63
|
+
return {
|
|
64
|
+
headers: headers ? { ...headers } : {},
|
|
65
|
+
statusCode: status,
|
|
66
|
+
statusMessage: statusText,
|
|
67
|
+
body: (0, utilities_1.isString)(body) ? body : JSON.stringify(body)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const logError = (clientId, error, callback, config) => {
|
|
72
|
+
try {
|
|
73
|
+
if (!callback)
|
|
74
|
+
return;
|
|
75
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
76
|
+
const request = convertRequest(error.config);
|
|
77
|
+
const response = convertAxiosResponse(error.response);
|
|
78
|
+
callback(createLogData(request, response, clientId, error.config, error));
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
const resp = (0, _1.isAdtException)(error)
|
|
82
|
+
? convertResponse(error)
|
|
83
|
+
: convertResponse(undefined);
|
|
84
|
+
callback(createLogData(convertRequest(config), resp, clientId, config, error));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) { }
|
|
88
|
+
};
|
|
89
|
+
exports.logError = logError;
|
|
90
|
+
const logResponse = (clientId, original, config, callback) => {
|
|
91
|
+
try {
|
|
92
|
+
if (!callback)
|
|
93
|
+
return;
|
|
94
|
+
const request = convertRequest(config);
|
|
95
|
+
const response = convertResponse(original);
|
|
96
|
+
callback(createLogData(request, response, clientId, config));
|
|
97
|
+
}
|
|
98
|
+
catch (error) { }
|
|
99
|
+
};
|
|
100
|
+
exports.logResponse = logResponse;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { strnumOptions, X2jOptions } from "fast-xml-parser";
|
|
2
|
+
import * as t from "io-ts";
|
|
3
|
+
export { encode as encodeEntity } from "html-entities";
|
|
4
|
+
export declare const isObject: <T extends Object>(x: unknown) => x is T;
|
|
5
|
+
export declare const isArray: <T = unknown>(x: unknown) => x is T[];
|
|
6
|
+
export declare const isString: (x: unknown) => x is string;
|
|
7
|
+
export declare const isNumber: (x: unknown) => x is number;
|
|
8
|
+
export declare const isNativeError: (e: unknown) => e is Error;
|
|
9
|
+
export declare const isUndefined: (x: unknown) => x is undefined;
|
|
10
|
+
export declare function JSON2AbapXML(original: any, root?: string): string;
|
|
11
|
+
export declare const xmlArrayType: <C extends t.Mixed>(x: C) => t.UnionC<[t.ArrayC<C>, C, t.UndefinedC]>;
|
|
12
|
+
export declare const extractXmlArray: <T>(x: T | T[] | undefined) => T[];
|
|
13
|
+
export declare function xmlNode(xml: any, ...path: string[]): any;
|
|
14
|
+
export declare function xmlFlatArray<T>(xml: any, ...path: string[]): T[];
|
|
15
|
+
export declare function xmlArray<T>(xml: any, ...path: string[]): T[];
|
|
16
|
+
export declare const xmlRoot: (o: any) => any;
|
|
17
|
+
export declare const stripNs: (x: any) => any;
|
|
18
|
+
type StripAttrPrefix<T extends string> = T extends `@_${infer B}` ? B : never;
|
|
19
|
+
type attribKeys<T, K = keyof T> = K extends keyof T & `@_${infer _}` ? K : never;
|
|
20
|
+
type attribValues<T> = {
|
|
21
|
+
[P in attribKeys<T> as StripAttrPrefix<P>]: T[P];
|
|
22
|
+
};
|
|
23
|
+
export declare const xmlNodeAttr: (n: any) => any;
|
|
24
|
+
export declare const typedNodeAttr: <T = unknown>(n: T) => attribValues<T>;
|
|
25
|
+
export declare const bar: "pip";
|
|
26
|
+
export declare const numberParseOptions: strnumOptions;
|
|
27
|
+
export declare const fullParse: (xml: string, options?: X2jOptions) => any;
|
|
28
|
+
export declare const parse: (xml: string, options?: X2jOptions) => any;
|
|
29
|
+
export declare function toInt(x?: string): number;
|
|
30
|
+
export declare const parseSapDate: (d: string) => number | Date;
|
|
31
|
+
export declare const toSapDate: (d: Date) => number;
|
|
32
|
+
export declare const parseJsonDate: (d: string) => Date;
|
|
33
|
+
export declare function btoa(s: string): string;
|
|
34
|
+
export declare function parts(whole: any, pattern: RegExp): string[];
|
|
35
|
+
export declare const followUrl: (base: string, extra: string) => string;
|
|
36
|
+
export declare const boolFromAbap: (x: any) => boolean;
|
|
37
|
+
export declare function formatQS(raw: any): string;
|
|
38
|
+
export declare const toXmlAttributes: (o: any, prefix: string) => string;
|
|
39
|
+
export type Clean<T> = Pick<T, keyof T>;
|
|
40
|
+
export declare const orUndefined: <T extends t.Mixed>(x: T) => t.UnionC<[t.UndefinedC, T]>;
|
|
41
|
+
export declare function mixed<R extends t.Props, O extends t.Props>(required: R, optional: O): t.IntersectionC<[t.TypeC<R>, t.PartialC<O>]>;
|
|
42
|
+
//# sourceMappingURL=utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,KAAK,CAAC,MAAM,OAAO,CAAA;AAC1B,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,eAAe,CAAA;AAGtD,eAAO,MAAM,QAAQ,wBAAyB,OAAO,WACvB,CAAA;AAC9B,eAAO,MAAM,OAAO,mBAAoB,OAAO,aAA+B,CAAA;AAC9E,eAAO,MAAM,QAAQ,MAAO,OAAO,gBAAuC,CAAA;AAC1E,eAAO,MAAM,QAAQ,MAAO,OAAO,gBAAuC,CAAA;AAC1E,eAAO,MAAM,aAAa,MAAO,OAAO,eACb,CAAA;AAC3B,eAAO,MAAM,WAAW,MAAO,OAAO,mBACZ,CAAA;AAE1B,wBAAgB,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,GAAE,MAAe,UAehE;AAED,eAAO,MAAM,YAAY,uEACc,CAAA;AACvC,eAAO,MAAM,eAAe,oCACK,CAAA;AAEjC,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAUxD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,CAqBhE;AAED,wBA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EAAE,MAAM,GAAG,MAAM,EAAE,CAI3D;AAED,eAAO,MAAM,SAAS,SAAU,MAAM,SAAS,MAAM,WAOpD,CAAA;AAED,eAAO,MAAM,YAAY,MAAO,GAAG,YAAc,CAAA;AAEjD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,UAQhC;AAED,eAAO,MAAM,eAAe,MAAO,GAAG,UAAU,MAAM,WAQrD,CAAA;AAED,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;AAEvC,eAAO,MAAM,WAAW,0DACG,CAAA;AAE3B,wBAAgB,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,EACxD,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,GACV,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAE9C"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.mixed = exports.orUndefined = exports.toXmlAttributes = exports.formatQS = exports.boolFromAbap = exports.followUrl = exports.parts = exports.btoa = exports.parseJsonDate = exports.toSapDate = exports.parseSapDate = exports.toInt = exports.parse = exports.fullParse = exports.numberParseOptions = exports.bar = exports.typedNodeAttr = exports.xmlNodeAttr = exports.stripNs = exports.xmlRoot = exports.xmlArray = exports.xmlFlatArray = exports.xmlNode = exports.extractXmlArray = exports.xmlArrayType = exports.JSON2AbapXML = exports.isUndefined = exports.isNativeError = exports.isNumber = exports.isString = exports.isArray = exports.isObject = exports.encodeEntity = void 0;
|
|
27
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
28
|
+
const t = __importStar(require("io-ts"));
|
|
29
|
+
var html_entities_1 = require("html-entities");
|
|
30
|
+
Object.defineProperty(exports, "encodeEntity", { enumerable: true, get: function () { return html_entities_1.encode; } });
|
|
31
|
+
const html_entities_2 = require("html-entities");
|
|
32
|
+
const isObject = (x) => !!x && typeof x === "object";
|
|
33
|
+
exports.isObject = isObject;
|
|
34
|
+
const isArray = (x) => Array.isArray(x);
|
|
35
|
+
exports.isArray = isArray;
|
|
36
|
+
const isString = (x) => typeof x === "string";
|
|
37
|
+
exports.isString = isString;
|
|
38
|
+
const isNumber = (x) => typeof x === "number";
|
|
39
|
+
exports.isNumber = isNumber;
|
|
40
|
+
const isNativeError = (e) => !!e && e instanceof Error;
|
|
41
|
+
exports.isNativeError = isNativeError;
|
|
42
|
+
const isUndefined = (x) => typeof x === "undefined";
|
|
43
|
+
exports.isUndefined = isUndefined;
|
|
44
|
+
function JSON2AbapXML(original, root = "DATA") {
|
|
45
|
+
// only flat objects for now, might extend later...
|
|
46
|
+
let inner = "";
|
|
47
|
+
for (const key of Object.keys(original))
|
|
48
|
+
if (original[key])
|
|
49
|
+
inner = `${inner}\n<${key}>${(0, html_entities_2.encode)(original[key]) || ""}</${key}>`;
|
|
50
|
+
else
|
|
51
|
+
inner = `${inner}\n<${key}/>`;
|
|
52
|
+
return `<?xml version="1.0" encoding="UTF-8"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
|
53
|
+
<asx:values>
|
|
54
|
+
<${root}>
|
|
55
|
+
${inner}
|
|
56
|
+
</${root}>
|
|
57
|
+
</asx:values>
|
|
58
|
+
</asx:abap>`;
|
|
59
|
+
}
|
|
60
|
+
exports.JSON2AbapXML = JSON2AbapXML;
|
|
61
|
+
const xmlArrayType = (x) => t.union([t.array(x), x, t.undefined]);
|
|
62
|
+
exports.xmlArrayType = xmlArrayType;
|
|
63
|
+
const extractXmlArray = (x) => x ? ((0, exports.isArray)(x) ? x : [x]) : [];
|
|
64
|
+
exports.extractXmlArray = extractXmlArray;
|
|
65
|
+
function xmlNode(xml, ...path) {
|
|
66
|
+
let current = xml;
|
|
67
|
+
path.some(key => {
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
if ((0, exports.isObject)(current))
|
|
70
|
+
current = current[key];
|
|
71
|
+
return !current;
|
|
72
|
+
});
|
|
73
|
+
return current;
|
|
74
|
+
}
|
|
75
|
+
exports.xmlNode = xmlNode;
|
|
76
|
+
function xmlFlatArray(xml, ...path) {
|
|
77
|
+
if (!xml)
|
|
78
|
+
return [];
|
|
79
|
+
if (path.length === 0) {
|
|
80
|
+
if ((0, exports.isArray)(xml))
|
|
81
|
+
return xml;
|
|
82
|
+
else
|
|
83
|
+
return [xml];
|
|
84
|
+
}
|
|
85
|
+
if ((0, exports.isArray)(xml))
|
|
86
|
+
return xml.reduce((arr, x) => [...arr, ...xmlFlatArray(x, ...path)], []);
|
|
87
|
+
if ((0, exports.isObject)(xml)) {
|
|
88
|
+
const [idx, ...rest] = path;
|
|
89
|
+
// @ts-ignore
|
|
90
|
+
return xmlFlatArray(xml[idx], ...rest);
|
|
91
|
+
}
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
exports.xmlFlatArray = xmlFlatArray;
|
|
95
|
+
function xmlArray(xml, ...path) {
|
|
96
|
+
const node = xmlNode(xml, ...path);
|
|
97
|
+
if (node) {
|
|
98
|
+
if ((0, exports.isArray)(node))
|
|
99
|
+
return node;
|
|
100
|
+
else
|
|
101
|
+
return [node];
|
|
102
|
+
}
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
exports.xmlArray = xmlArray;
|
|
106
|
+
const ok = Object.keys;
|
|
107
|
+
const xmlRoot = (o) => o[ok(o).filter(k => k !== "?xml")[0]];
|
|
108
|
+
exports.xmlRoot = xmlRoot;
|
|
109
|
+
const stripNs = (x) => x &&
|
|
110
|
+
ok(x).reduce((obj, key) => {
|
|
111
|
+
const nk = key.split(":").slice(1).join(":") || key;
|
|
112
|
+
if (nk in obj)
|
|
113
|
+
obj[key] = key;
|
|
114
|
+
else
|
|
115
|
+
obj[nk] = x[key];
|
|
116
|
+
return obj;
|
|
117
|
+
}, {});
|
|
118
|
+
exports.stripNs = stripNs;
|
|
119
|
+
const stripAttrPrefix = (x) => x.replace(/^@_/, "");
|
|
120
|
+
// extract XML attributes of a node from its JSON representation
|
|
121
|
+
const xmlNodeAttr = (n) => n &&
|
|
122
|
+
ok(n)
|
|
123
|
+
.filter(k => k.match(/^(?!@_xmlns)@_/))
|
|
124
|
+
.reduce((part, cur) => {
|
|
125
|
+
part[cur.replace(/^@_/, "")] = n[cur];
|
|
126
|
+
return part;
|
|
127
|
+
}, {});
|
|
128
|
+
exports.xmlNodeAttr = xmlNodeAttr;
|
|
129
|
+
const typedNodeAttr = (n) => n &&
|
|
130
|
+
ok(n)
|
|
131
|
+
.filter(k => k.match(/^(?!@_xmlns)@_/))
|
|
132
|
+
.reduce((part, cur) => {
|
|
133
|
+
// @ts-ignore
|
|
134
|
+
part[cur.replace(/^@_/, "")] = n[cur];
|
|
135
|
+
return part;
|
|
136
|
+
}, {});
|
|
137
|
+
exports.typedNodeAttr = typedNodeAttr;
|
|
138
|
+
exports.bar = stripAttrPrefix("@_pip");
|
|
139
|
+
exports.numberParseOptions = {
|
|
140
|
+
leadingZeros: false,
|
|
141
|
+
hex: true,
|
|
142
|
+
skipLike: new RegExp("")
|
|
143
|
+
};
|
|
144
|
+
const fullParse = (xml, options = {}) => new fast_xml_parser_1.XMLParser({
|
|
145
|
+
ignoreAttributes: false,
|
|
146
|
+
trimValues: false,
|
|
147
|
+
parseAttributeValue: true,
|
|
148
|
+
...options
|
|
149
|
+
}).parse(xml);
|
|
150
|
+
exports.fullParse = fullParse;
|
|
151
|
+
const parse = (xml, options = {}) => new fast_xml_parser_1.XMLParser(options).parse(xml);
|
|
152
|
+
exports.parse = parse;
|
|
153
|
+
function toInt(x) {
|
|
154
|
+
if (!x)
|
|
155
|
+
return 0;
|
|
156
|
+
if (x.match(/^\s*[+-]?\d*\s*$/))
|
|
157
|
+
return Number.parseInt(x, 10);
|
|
158
|
+
return 0;
|
|
159
|
+
}
|
|
160
|
+
exports.toInt = toInt;
|
|
161
|
+
const parseSapDate = (d) => {
|
|
162
|
+
const match = d.match(/(\d\d\d\d)(\d\d)(\d\d)/);
|
|
163
|
+
if (!match)
|
|
164
|
+
return new Date(); // wrong but valid
|
|
165
|
+
const [Y, M, D] = match.slice(1);
|
|
166
|
+
return Date.UTC(toInt(Y), toInt(M) - 1, toInt(D));
|
|
167
|
+
};
|
|
168
|
+
exports.parseSapDate = parseSapDate;
|
|
169
|
+
const toSapDate = (d) => d.getUTCFullYear() * 10000 + (d.getUTCMonth() + 1) * 100 + d.getUTCDate();
|
|
170
|
+
exports.toSapDate = toSapDate;
|
|
171
|
+
const parseJsonDate = (d) => new Date(Date.parse(d));
|
|
172
|
+
exports.parseJsonDate = parseJsonDate;
|
|
173
|
+
function btoa(s) {
|
|
174
|
+
return Buffer.from(s).toString("base64");
|
|
175
|
+
}
|
|
176
|
+
exports.btoa = btoa;
|
|
177
|
+
function parts(whole, pattern) {
|
|
178
|
+
if (!(0, exports.isString)(whole))
|
|
179
|
+
return [];
|
|
180
|
+
const match = whole.match(pattern);
|
|
181
|
+
return match ? match.slice(1) : [];
|
|
182
|
+
}
|
|
183
|
+
exports.parts = parts;
|
|
184
|
+
const followUrl = (base, extra) => {
|
|
185
|
+
if (extra.match(/^\.\//)) {
|
|
186
|
+
base = base.replace(/[^\/]*$/, "");
|
|
187
|
+
extra = extra.replace(/^\.\//, "");
|
|
188
|
+
}
|
|
189
|
+
else
|
|
190
|
+
extra = extra.replace(/^\//, "");
|
|
191
|
+
base = base.replace(/\/$/, "");
|
|
192
|
+
return base + "/" + extra;
|
|
193
|
+
};
|
|
194
|
+
exports.followUrl = followUrl;
|
|
195
|
+
const boolFromAbap = (x) => x === "X";
|
|
196
|
+
exports.boolFromAbap = boolFromAbap;
|
|
197
|
+
function formatQS(raw) {
|
|
198
|
+
const val = (key, x) => (0, exports.isArray)(x)
|
|
199
|
+
? x.map(e => val(key, e)).join("&")
|
|
200
|
+
: `${key}=${encodeURIComponent(x)}`;
|
|
201
|
+
return Object.getOwnPropertyNames(raw)
|
|
202
|
+
.map(k => val(k, raw[k]))
|
|
203
|
+
.join("&");
|
|
204
|
+
}
|
|
205
|
+
exports.formatQS = formatQS;
|
|
206
|
+
const toXmlAttributes = (o, prefix) => {
|
|
207
|
+
const sep = prefix ? ":" : "";
|
|
208
|
+
return o
|
|
209
|
+
? Object.getOwnPropertyNames(o)
|
|
210
|
+
.sort()
|
|
211
|
+
.map(k => `${prefix}${sep}${k.replace(/^@_/, "")}="${o[k]}"`)
|
|
212
|
+
.join(" ")
|
|
213
|
+
: "";
|
|
214
|
+
};
|
|
215
|
+
exports.toXmlAttributes = toXmlAttributes;
|
|
216
|
+
const orUndefined = (x) => t.union([t.undefined, x]);
|
|
217
|
+
exports.orUndefined = orUndefined;
|
|
218
|
+
function mixed(required, optional) {
|
|
219
|
+
return t.intersection([t.type(required), t.partial(optional)]);
|
|
220
|
+
}
|
|
221
|
+
exports.mixed = mixed;
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
+
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
// A set of global variables that need to be available in all test environments
|
|
6
|
+
globals: {
|
|
7
|
+
"ts-jest": {
|
|
8
|
+
tsconfig: "tsconfig.json"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
moduleNameMapper: {
|
|
12
|
+
"^axios$": "axios/dist/node/axios.cjs"
|
|
13
|
+
},
|
|
14
|
+
// An array of file extensions your modules use
|
|
15
|
+
moduleFileExtensions: ["ts", "tsx", "js"],
|
|
16
|
+
|
|
17
|
+
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
18
|
+
setupFiles: ["<rootDir>/setenv.js"],
|
|
19
|
+
|
|
20
|
+
// The test environment that will be used for testing
|
|
21
|
+
testEnvironment: "node",
|
|
22
|
+
|
|
23
|
+
// The glob patterns Jest uses to detect test files
|
|
24
|
+
testMatch: ["**/__tests__/*.+(ts|tsx|js)", "**/*.test.ts"],
|
|
25
|
+
|
|
26
|
+
// A map from regular expressions to paths to transformers
|
|
27
|
+
transform: {
|
|
28
|
+
"\\.(ts|tsx)$": "ts-jest"
|
|
29
|
+
},
|
|
30
|
+
testTimeout: 10000,
|
|
31
|
+
transformIgnorePatterns: ["/node_modules/"]
|
|
32
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rayutek/abap-adt-api",
|
|
3
|
+
"version": "6.2.1-pkg-1.0.0",
|
|
4
|
+
"description": "Interface to Abap Developer Tools webservice",
|
|
5
|
+
"outDir": "build",
|
|
6
|
+
"main": "build/index.js",
|
|
7
|
+
"types": "build/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"watch": "tsc -w",
|
|
11
|
+
"prepublishOnly": "tsc",
|
|
12
|
+
"test": "jest"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"ABAP",
|
|
16
|
+
"ADT"
|
|
17
|
+
],
|
|
18
|
+
"author": "Marcello Urbani",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/marcellourbani/abap-adt-api"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"axios": "^1.7.2",
|
|
26
|
+
"fast-xml-parser": "^4.4.0",
|
|
27
|
+
"fp-ts": "^2.16.7",
|
|
28
|
+
"html-entities": "^2.5.2",
|
|
29
|
+
"io-ts": "^2.2.21",
|
|
30
|
+
"io-ts-reporters": "^2.0.1",
|
|
31
|
+
"sprintf-js": "^1.1.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/html-entities": "^1.3.4",
|
|
35
|
+
"@types/jest": "^27.4.1",
|
|
36
|
+
"@types/node": "^17.0.29",
|
|
37
|
+
"@types/sprintf-js": "^1.1.2",
|
|
38
|
+
"@types/tough-cookie": "^4.0.2",
|
|
39
|
+
"client-oauth2": "^4.3.3",
|
|
40
|
+
"eslint": "^8.14.0",
|
|
41
|
+
"jest": "^27.5.1",
|
|
42
|
+
"ts-jest": "^27.1.4",
|
|
43
|
+
"typescript": "^4.6.3"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/setenv_sample.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
process.env.ADT_URL = "https://vhcalnplci.bti.local:44300/"
|
|
2
|
+
process.env.ADT_USER = "developer"
|
|
3
|
+
process.env.ADT_PASS = "secret"
|
|
4
|
+
process.env.ADT_TRANS = "NPLK900060"
|
|
5
|
+
process.env.ADT_SYSTEMID = "NPL"
|
|
6
|
+
// Optimal setup for password protected git repos
|
|
7
|
+
process.env.ADT_GIT_REPO = "https://github.com/myaccount/myprivateproject.git"
|
|
8
|
+
process.env.ADT_GIT_USER = "myuser"
|
|
9
|
+
process.env.ADT_ATCAPPROVER = "myapprover"
|
|
10
|
+
process.env.ADT_GIT_PASS = "secret"
|
|
11
|
+
// uncomment the following line to allow disrupting tests i.e. create and release transports, create and delete objects
|
|
12
|
+
// process.env.ADT_ENABLE_ALL = "YES"
|
|
13
|
+
|
|
14
|
+
// for connecting with cloud instances, like Cloud Platform Trial. Pretty hard to get the right values
|
|
15
|
+
process.env.ADT_CP = JSON.stringify({
|
|
16
|
+
accessToken: "Oauth access token",
|
|
17
|
+
refreshToken: "Oauth refresh token",
|
|
18
|
+
tokenType: "bearer",
|
|
19
|
+
clientId: "your client ID",
|
|
20
|
+
clientSecret: "Your client secret",
|
|
21
|
+
uaaUrl: "your UAA Url",
|
|
22
|
+
url: "Abap instance URL",
|
|
23
|
+
user: "Myusername",
|
|
24
|
+
repopkg: "ZGITREPOPKG",
|
|
25
|
+
repouser: "git repo user",
|
|
26
|
+
repopwd: "git repo password"
|
|
27
|
+
})
|