Skip to content

Commit

Permalink
Disable only "call" and "get" commands, if SAP NWRFC SDK load fails
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrdjan committed Feb 5, 2021
1 parent cbeab67 commit 243565a
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 135 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Command line tool for pattern based web applications with ABAP/HANA systems.
- Front-end frameworks:
- [Aurelia](http://aurelia.io/)
- Angular, React and Vue by [SAP Fundamenal Library](https://sap.github.io/fundamental/)
- Angular, React and Vue by [Microsot FAST](https://www.fast.design/docs/introduction/)
- Angular, React and Vue by [Microsoft FAST](https://www.fast.design/docs/introduction/)
- UI5 web components for [React](https://sap.github.io/ui5-webcomponents-react/?path=/story/getting-started--page)
- Servers
- SAP Cloud Platform
Expand Down
2 changes: 1 addition & 1 deletion abap-api-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Command line tool for pattern based applications with ABAP/HANA systems.
- ui components'with ABAP data annotations:
- [Aurelia](http://aurelia.io/)
- Angular, React and Vue by [SAP Fundamenal Library](https://sap.github.io/fundamental/)
- Angular, React and Vue by [Microsot FAST](https://www.fast.design/docs/introduction/)
- Angular, React and Vue by [Microsoft FAST](https://www.fast.design/docs/introduction/)
- UI5 web components for [React](https://sap.github.io/ui5-webcomponents-react/?path=/story/getting-started--page)
- [Building a pattern based app](https://github.com/SAP/fundamental-tools/blob/main/doc/app.md)

Expand Down
52 changes: 26 additions & 26 deletions abap-api-tools/package-lock.json

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

6 changes: 3 additions & 3 deletions abap-api-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "abap-api-tools",
"description": "ABAP api tools",
"version": "1.2.3",
"version": "1.3.0",
"homepage": "https://github.com/sap/fundamental-tools",
"author": "SAP",
"license": "Apache-2.0",
Expand All @@ -26,11 +26,11 @@
],
"type": "commonjs",
"scripts": {
"dist": "tsc -p src/ts && cp -r src/configuration dist/.",
"ts": "tsc -p src/ts && cp -r src/configuration dist/.",
"lint": "eslint src/ts",
"deps": "npm i --save chalk js-yaml loglevel sprintf-js yargs node-rfc",
"devdeps": "npm i --save-dev @types/node @types/js-yaml @types/sprintf-js @types/yargs @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint jest typescript",
"build": "rm -rf dist && npm run dist && npm run lint",
"build": "rm -rf dist && npm run ts && npm run lint",
"lock": "npm install --package-lock-only"
},
"keywords": [
Expand Down
10 changes: 5 additions & 5 deletions abap-api-tools/src/ts/abap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
Languages,
DefaultFolder,
} from "./constants";
import { AbapObject, Backend } from "./backend";
import { AnnotationsType, Backend } from "./backend";
import { Frontend } from "./frontend";
import { yamlLoad, log, makeDir, deleteFile, getTimestamp } from "./utils";

Expand All @@ -29,14 +29,14 @@ export const Command = Object.freeze({
languages: "languages",
});

export type ApiList = Record<string, string[]>;
type ApiListType = Record<string, string[]>;
export interface Arguments {
[argName: string]: unknown;
_: (string | number)[];
$0: string;
rfm: string[];
c: string | string[];
apilist: ApiList;
apilist: ApiListType;
cmd: string;
ui: string;
debug: boolean;
Expand All @@ -51,7 +51,7 @@ class CliHandler {
private argv: Arguments;
constructor(argv: Arguments) {
if (argv.c || (argv.rfm && argv.rfm.length)) {
const apilist: ApiList = {};
const apilist: ApiListType = {};

// add apilists
if (argv.c) {
Expand Down Expand Up @@ -80,7 +80,7 @@ class CliHandler {
async run() {
try {
for (const api_name of Object.keys(this.argv.apilist)) {
let abap: AbapObject = {
let abap: AnnotationsType = {
parameters: {},
fields: {},
stat: {},
Expand Down
45 changes: 45 additions & 0 deletions abap-api-tools/src/ts/alpha.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { RfcStructure } from "node-rfc";

export class Alpha {
private all: Set<string> = new Set();
private found: Record<string, RfcStructure> = {};
private rfm_name = "";
private param_name = "";
private field_name = "";

rfm(rfm_name: string): void {
this.rfm_name = rfm_name;
this.param("");
}

param(param_name: string): void {
this.param_name = param_name;
this.field_name = "";
}

field(field_name: string): void {
this.field_name = field_name;
}

get(): { all: string[]; rfm: Record<string, RfcStructure> } {
return { all: Array.from(this.all).sort(), rfm: this.found };
}

add(alpha_name: string): void {
this.all.add(alpha_name);

if (!this.found[this.rfm_name]) {
this.found[this.rfm_name] = {};
}

if (!this.found[this.rfm_name][this.param_name]) {
this.found[this.rfm_name][this.param_name] = {};
}

if (this.field_name) {
this.found[this.rfm_name][this.param_name][this.field_name] = alpha_name;
} else {
this.found[this.rfm_name][this.param_name] = alpha_name;
}
}
}
Loading

0 comments on commit 243565a

Please sign in to comment.