Skip to content

Commit

Permalink
feat(addon): addon methods added for language code conversions and in…
Browse files Browse the repository at this point in the history
…i file reload
  • Loading branch information
bsrdjan committed Feb 3, 2023
1 parent 5cfc721 commit f678886
Show file tree
Hide file tree
Showing 30 changed files with 1,094 additions and 596 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ else()
endif()

# source files and target library
add_library(${PROJECT_NAME} SHARED src/Client.cc src/nwrfcsdk.cc src/Pool.cc src/Throughput.cc src/Server.cc src/addon.cc)
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)

# build path ignored on Windows, copy after build
if(MSVC)
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# node-rfc

:tada: Darwin on ARM supported with SAP NW RFC SDK 7.50 PL11 :tada:

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.

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

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

- 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)
- 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)

- 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).

- 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)
- Docker containers: [[SAP fundamental-tools/docker]](https://github.com/SAP/fundamental-tools/tree/main/docker)

Other platforms and frameworks:

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

## Requirements

### All platforms
### SAP NW RFC SDK 7.50.11

- 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.

Expand Down
24 changes: 24 additions & 0 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ Usage: [usage/addon](usage.md#addon)
setIniFileDirectory(iniFileDirectory: string)
```

### reloadIniFile

Usage: [usage/addon](usage.md#addon)

```ts
reloadIniFile()
```

### loadCryptoLibrary

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

### languageIsoToSap

Usage: [usage/addon](usage.md#addon)

```ts
languageIsoToSap(langIsoCode: string): string|Error
```

### languageSapToIso

Usage: [usage/addon](usage.md#addon)

```ts
languageSapToIso(langSapCode: string): string|Error
```

## Client

Usage: [usage/client](usage.md#client)
Expand Down
46 changes: 46 additions & 0 deletions doc/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
- **[ABAP Function Module](#abap-function-module)**
- **[Addon](#addon)**
- [setIniFileDirectory](#setinifiledirectory)
- [reloadIniFile](#reloadinifile)
- [loadCryptoLibrary](#loadcryptolibrary)
- [cancelClient](#cancelclient)
- [languageIsoToSap](#languageisotosap)
- [languageSapToIso](#languagesaptoiso)

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

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

### reloadIniFile

Reloads the contents of the `sapnwrfc.ini` file into memory.

Searches the directory given by `RfcSetIniPath()` (or the current working directory)
for the file `sapnwrfc.ini` and loads its contents into memory. Reloading the `sapnwrfc.ini`
file is only necessary after the file has been manually edited.
If you want to use a `sapnwrfc.ini` file in a different location, consider using `setIniFileDirectory()`.

Note: If a file with the name `sapnwrfc.ini` does not exist in the given directory,
this is not considered an error! Default settings are used in this case.

```ts
const noderfc = require("node-rfc");
try{
noderfc.reloadIniFile();
} catch (ex) {
console.log(ex);
}
```

### loadCryptoLibrary

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

### languageIsoToSap

API: [api/addon](api.md#languageisotosap)

Conversion of language ISO code to 1-digit SAP code

```ts
const noderfc = require("node-rfc");
const langSAP = noderfc.languageIsoToSap("EN");
```

### languageSapToIso

API: [api/addon](api.md#languagesaptoiso)

Conversion of language 1-digit SAP code to ISO code

```ts
const noderfc = require("node-rfc");
const langSAP = noderfc.languageSapToIso("E");
```

## Client

API: [api/client](api.md#client)
Expand Down
3 changes: 3 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export * from "./wrapper/sapnwrfc-pool";
export * from "./wrapper/sapnwrfc-throughput";
export * from "./wrapper/sapnwrfc-server";
export declare function setIniFileDirectory(iniFileDirectory: string): void;
export declare function reloadIniFile(): void;
export declare function loadCryptoLibrary(libAbsolutePath: string): void;
export declare const sapnwrfcEvents: EventEmitter;
export declare function cancelClient(client: Client, callback?: Function): void | Promise<any>;
export declare function languageIsoToSap(langIso: string): string;
export declare function languageSapToIso(langSap: string): string;
25 changes: 24 additions & 1 deletion lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions lib/wrapper/noderfc-bindings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ export interface NodeRfcEnvironment {
noderfc: NodeRfcBindingVersions;
versions: Object;
}
export interface NWRfcSdkError {
name: string;
group: number;
code: number;
codeString: string;
key: string;
message: string;
}
export interface NWRfcBinding {
Client: RfcClientBinding;
Pool: RfcPoolBinding;
Expand All @@ -28,6 +36,9 @@ export interface NWRfcBinding {
environment: NodeRfcEnvironment;
setIniFileDirectory(iniFileDirectory: string): any | undefined;
loadCryptoLibrary(libAbsolutePath: string): any | undefined;
languageIsoToSap(langIso: string): string | NWRfcSdkError;
languageSapToIso(langSap: string): string | NWRfcSdkError;
reloadIniFile(): undefined | NWRfcSdkError;
verbose(): this;
}
declare let noderfc_binding: NWRfcBinding;
Expand Down
2 changes: 1 addition & 1 deletion lib/wrapper/noderfc-bindings.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f678886

Please sign in to comment.