Skip to content

Commit f678886

Browse files
committed
feat(addon): addon methods added for language code conversions and ini file reload
1 parent 5cfc721 commit f678886

30 files changed

+1094
-596
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ else()
9393
endif()
9494

9595
# source files and target library
96-
add_library(${PROJECT_NAME} SHARED src/Client.cc src/nwrfcsdk.cc src/Pool.cc src/Throughput.cc src/Server.cc src/addon.cc)
96+
add_library(${PROJECT_NAME} SHARED src/cpp/Client.cc src/cpp/nwrfcsdk.cc src/cpp/Pool.cc src/cpp/Throughput.cc src/cpp/Server.cc src/cpp/addon.cc)
9797

9898
# build path ignored on Windows, copy after build
9999
if(MSVC)

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# node-rfc
22

3+
:tada: Darwin on ARM supported with SAP NW RFC SDK 7.50 PL11 :tada:
4+
35
Asynchronous, non-blocking [SAP NetWeaver RFC SDK](https://support.sap.com/en/product/connectors/nwrfcsdk.html) client bindings for [Node.js](http://nodejs.org/), providing convenient ABAP business logic consumption from Node.js.
46

57
[![NPM](https://nodei.co/npm/node-rfc.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-rfc/)
@@ -49,9 +51,11 @@ Asynchronous, non-blocking [SAP NetWeaver RFC SDK](https://support.sap.com/en/pr
4951

5052
- [Current and active nodejs LTS releases](https://github.com/nodejs/LTS)
5153

52-
- The _node-rfc_ connector can be [built from source](#download-and-installation) on all platforms supported both by [SAP NW RFC SDK](https://launchpad.support.sap.com/#/notes/2573790) and by [nodejs](https://github.com/nodejs/node/blob/master/BUILDING.md#supported-platforms-1)
54+
- The _node-rfc_ connector can be built from source([build instructions](#download-and-installation)) on all platforms supported by both [SAP NW RFC SDK](https://launchpad.support.sap.com/#/notes/2573790) and [nodejs](https://github.com/nodejs/node/blob/master/BUILDING.md#supported-platforms-1)
55+
56+
- In addition, pre-built wheels are provided for [active nodejs LTS releases](https://github.com/nodejs/LTS), for Windows, Darwin and Ubuntu Linux, attached to node-rfc GitHub [release](https://github.com/SAP/node-rfc/releases/latest).
5357

54-
- Pre-built binaries are provided for [active nodejs LTS releases](https://github.com/nodejs/LTS), for 64 bit Windows 10, macOS 10.15 and [Centos 7 based docker container](https://github.com/SAP/fundamental-tools/tree/master/docker)
58+
- Docker containers: [[SAP fundamental-tools/docker]](https://github.com/SAP/fundamental-tools/tree/main/docker)
5559

5660
Other platforms and frameworks:
5761

@@ -74,7 +78,7 @@ Other platforms and frameworks:
7478

7579
## Requirements
7680

77-
### All platforms
81+
### SAP NW RFC SDK 7.50.11
7882

7983
- SAP NW RFC SDK C++ binaries must be downloaded (SAP partner or customer account required) and locally installed. Check [installation instructions](doc/installation.md#sap-nwrfc-sdk-installation) and [SAP NW RFC SDK section on SAP Support Portal](https://support.sap.com/en/product/connectors/nwrfcsdk.html). Using the latest version is reccomended as SAP NW RFC SDK is fully backwards compatible, supporting all NetWeaver systems, from today S4, down to R/3 release 4.6C.
8084

doc/api.md

+24
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ Usage: [usage/addon](usage.md#addon)
2929
setIniFileDirectory(iniFileDirectory: string)
3030
```
3131

32+
### reloadIniFile
33+
34+
Usage: [usage/addon](usage.md#addon)
35+
36+
```ts
37+
reloadIniFile()
38+
```
39+
3240
### loadCryptoLibrary
3341

3442
Usage: [usage/addon](usage.md#addon)
@@ -45,6 +53,22 @@ Usage: [usage/addon](usage.md#cancelclient)
4553
cancelClient(client: Client, callback?: Function): void | Promise<any>;
4654
```
4755

56+
### languageIsoToSap
57+
58+
Usage: [usage/addon](usage.md#addon)
59+
60+
```ts
61+
languageIsoToSap(langIsoCode: string): string|Error
62+
```
63+
64+
### languageSapToIso
65+
66+
Usage: [usage/addon](usage.md#addon)
67+
68+
```ts
69+
languageSapToIso(langSapCode: string): string|Error
70+
```
71+
4872
## Client
4973

5074
Usage: [usage/client](usage.md#client)

doc/usage.md

+46
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
- **[ABAP Function Module](#abap-function-module)**
77
- **[Addon](#addon)**
88
- [setIniFileDirectory](#setinifiledirectory)
9+
- [reloadIniFile](#reloadinifile)
910
- [loadCryptoLibrary](#loadcryptolibrary)
1011
- [cancelClient](#cancelclient)
12+
- [languageIsoToSap](#languageisotosap)
13+
- [languageSapToIso](#languagesaptoiso)
1114

1215
<a name="client-toc"></a>
1316

@@ -144,6 +147,27 @@ const noderfc = require("node-rfc");
144147
noderfc.setIniFileDirectory("/some/folder");
145148
```
146149

150+
### reloadIniFile
151+
152+
Reloads the contents of the `sapnwrfc.ini` file into memory.
153+
154+
Searches the directory given by `RfcSetIniPath()` (or the current working directory)
155+
for the file `sapnwrfc.ini` and loads its contents into memory. Reloading the `sapnwrfc.ini`
156+
file is only necessary after the file has been manually edited.
157+
If you want to use a `sapnwrfc.ini` file in a different location, consider using `setIniFileDirectory()`.
158+
159+
Note: If a file with the name `sapnwrfc.ini` does not exist in the given directory,
160+
this is not considered an error! Default settings are used in this case.
161+
162+
```ts
163+
const noderfc = require("node-rfc");
164+
try{
165+
noderfc.reloadIniFile();
166+
} catch (ex) {
167+
console.log(ex);
168+
}
169+
```
170+
147171
### loadCryptoLibrary
148172

149173
Sets the absolute path to the sapcrypto library to enable TLS encryption via Websocket RFC.
@@ -166,6 +190,28 @@ const noderfc = require("node-rfc");
166190
noderfc.cancelClient(client);
167191
```
168192

193+
### languageIsoToSap
194+
195+
API: [api/addon](api.md#languageisotosap)
196+
197+
Conversion of language ISO code to 1-digit SAP code
198+
199+
```ts
200+
const noderfc = require("node-rfc");
201+
const langSAP = noderfc.languageIsoToSap("EN");
202+
```
203+
204+
### languageSapToIso
205+
206+
API: [api/addon](api.md#languagesaptoiso)
207+
208+
Conversion of language 1-digit SAP code to ISO code
209+
210+
```ts
211+
const noderfc = require("node-rfc");
212+
const langSAP = noderfc.languageSapToIso("E");
213+
```
214+
169215
## Client
170216

171217
API: [api/client](api.md#client)

lib/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export * from "./wrapper/sapnwrfc-pool";
77
export * from "./wrapper/sapnwrfc-throughput";
88
export * from "./wrapper/sapnwrfc-server";
99
export declare function setIniFileDirectory(iniFileDirectory: string): void;
10+
export declare function reloadIniFile(): void;
1011
export declare function loadCryptoLibrary(libAbsolutePath: string): void;
1112
export declare const sapnwrfcEvents: EventEmitter;
1213
export declare function cancelClient(client: Client, callback?: Function): void | Promise<any>;
14+
export declare function languageIsoToSap(langIso: string): string;
15+
export declare function languageSapToIso(langSap: string): string;

lib/index.js

+24-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/wrapper/noderfc-bindings.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ export interface NodeRfcEnvironment {
1919
noderfc: NodeRfcBindingVersions;
2020
versions: Object;
2121
}
22+
export interface NWRfcSdkError {
23+
name: string;
24+
group: number;
25+
code: number;
26+
codeString: string;
27+
key: string;
28+
message: string;
29+
}
2230
export interface NWRfcBinding {
2331
Client: RfcClientBinding;
2432
Pool: RfcPoolBinding;
@@ -28,6 +36,9 @@ export interface NWRfcBinding {
2836
environment: NodeRfcEnvironment;
2937
setIniFileDirectory(iniFileDirectory: string): any | undefined;
3038
loadCryptoLibrary(libAbsolutePath: string): any | undefined;
39+
languageIsoToSap(langIso: string): string | NWRfcSdkError;
40+
languageSapToIso(langSap: string): string | NWRfcSdkError;
41+
reloadIniFile(): undefined | NWRfcSdkError;
3142
verbose(): this;
3243
}
3344
declare let noderfc_binding: NWRfcBinding;

lib/wrapper/noderfc-bindings.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)