@sap/async-xsjs 1.0.8 → 2.0.1

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/package.json CHANGED
@@ -1,27 +1,25 @@
1
1
  {
2
2
  "name": "@sap/async-xsjs",
3
3
  "description": "Compatibility layer to run XS Classic applications on XS Advanced",
4
- "version": "1.0.8",
4
+ "version": "2.0.1",
5
5
  "repository": {},
6
6
  "license": "SEE LICENSE IN LICENSE file",
7
7
  "main": "./lib",
8
8
  "dependencies": {
9
9
  "@sap/audit-logging": "^5.7.1",
10
- "@sap/e2e-trace": "^3.2.0",
11
- "@sap/hana-client": "^2.18.24",
12
- "@sap/hdbext": "^8.0.0",
13
- "@sap/instance-manager": "^3.5.3",
14
- "@sap/jobs-client": "^1.7.43",
15
- "@sap/logging": "^6.2.0",
16
- "@sap/node-jwt": "^1.6.14",
17
- "@sap/node-vsi": "^1.4.21",
18
- "@sap/textanalysis": "~1.1.0",
19
- "@sap/textbundle": "^3.1.0",
20
- "@sap/textmining": "~1.1.6",
21
- "@sap/xsenv": "^3.4.0",
22
- "@sap/xsodata": "^8.0.2",
23
- "@sap/xss-secure": "^4.1.0",
24
- "@sap/xssec": "^3.3.5",
10
+ "@sap/e2e-trace": "^4.1.0",
11
+ "@sap/hana-client": "2.21.28",
12
+ "@sap/hdbext": "^8.0.2",
13
+ "@sap/instance-manager": "^4.1.0",
14
+ "@sap/jobs-client": "^1.8.1",
15
+ "@sap/logging": "^7.1.0",
16
+ "@sap/node-jwt": "^1.6.23",
17
+ "@sap/node-vsi": "^1.4.27",
18
+ "@sap/textbundle": "^4.3.0",
19
+ "@sap/xsenv": "^4.2.0",
20
+ "@sap/xsodata": "^8.1.2",
21
+ "@sap/xss-secure": "^4.3.0",
22
+ "@sap/xssec": "^3.6.0",
25
23
  "accept-language": "2.0.16",
26
24
  "big.js": "5.0.2",
27
25
  "body-parser": "1.19.2",
@@ -30,12 +28,12 @@
30
28
  "content-type": "1.0.1",
31
29
  "cookie": "0.2.2",
32
30
  "cookie-parser": "1.3.5",
33
- "express": "4.18.2",
31
+ "express": "4.19.2",
34
32
  "lodash": "4.17.21",
35
33
  "media-typer": "0.3.0",
36
34
  "moment": "2.29.4",
37
35
  "multiparty": "4.2.2",
38
- "nodemailer": "6.6.1",
36
+ "nodemailer": "6.9.9",
39
37
  "passport": "0.6.0",
40
38
  "passport-strategy": "1.0.0",
41
39
  "sax": "1.2.4",
@@ -43,10 +41,10 @@
43
41
  "verror": "1.10.0",
44
42
  "yauzl": "2.6.0",
45
43
  "yazl": "2.4.1",
46
- "axios": "^1.3.5"
44
+ "axios": "^1.6.2"
47
45
  },
48
46
  "engines": {
49
- "node": "^16.x || ^18.x"
47
+ "node": "^18.x || ^20.x"
50
48
  },
51
49
  "files": [
52
50
  "lib",
@@ -71,7 +69,7 @@
71
69
  "filter-node-package": "3.1.1",
72
70
  "markdown-toc": "^1.1.0",
73
71
  "mocha": "7.1.0",
74
- "moment-timezone": "0.5.13",
72
+ "moment-timezone": "0.5.35",
75
73
  "nock": "^12.0.0",
76
74
  "node-build": "^2.0.1",
77
75
  "node-style": "^2.0.0",
@@ -1,128 +0,0 @@
1
- 'use strict';
2
-
3
- var ta = require('@sap/textanalysis');
4
- var bufferUtils = require('../../../utils/buffer-utils');
5
-
6
- module.exports = Session;
7
-
8
- function Session($db, params) {
9
- this.configuration = params.configuration;
10
- this.client = (async () => { await $db.getConnection()._client; })();
11
- this.schema = $db._dbReqOptions._globalOptions.schema;
12
- }
13
-
14
- Session.prototype.analyze = async function (params) {
15
- return await analyze(this, params);
16
- };
17
-
18
- function analyze(session, params) {
19
- var values = normalizeInput(params);
20
- values.CONFIGURATION_SCHEMA_NAME = session.schema;
21
- values.CONFIGURATION = session.configuration;
22
- return new Promise ((resolve, reject) => {
23
-
24
- ta.analyze(values, session.client, function (err, parameters, rows) {
25
- if (err) {
26
- return reject(err);
27
- }
28
- var tokens = [], entities = [], metadata = [], grammaticalRoles = [];
29
- if (rows) {
30
- for (var i = 0; i < rows.length; i++) {
31
- var row = rows[i];
32
- if (row.RULE === 'Entity Extraction') {
33
- var entity = {
34
- id: row.COUNTER,
35
- text: row.TOKEN,
36
- normalizedForm: row.NORMALIZED,
37
- labelPath: row.TYPE,
38
- offset: row.OFFSET,
39
- paragraph: row.PARAGRAPH,
40
- sentence: row.SENTENCE,
41
- parent: row.PARENT
42
- };
43
- entities.push(entity);
44
- }
45
- else if (row.RULE === 'LXP') {
46
- var token = {
47
- token: row.TOKEN,
48
- normalizedToken: row.NORMALIZED,
49
- partOfSpeech: row.TYPE,
50
- offset: row.OFFSET,
51
- paragraph: row.PARAGRAPH,
52
- sentence: row.SENTENCE
53
- // TODO: stems
54
- };
55
- tokens.push(token);
56
- }
57
- else if (row.RULE === 'Grammatical Role') {
58
- var grammaticalRoleGovernor = {
59
- id: row.PARENT,
60
- dependencyType: row.TYPE
61
- };
62
- var grammaticalRole = {
63
- id: row.COUNTER,
64
- offset: row.OFFSET,
65
- paragraph: row.PARAGRAPH,
66
- sentence: row.SENTENCE,
67
- text: row.TOKEN,
68
- governors: [grammaticalRoleGovernor]
69
- };
70
- grammaticalRoles.push(grammaticalRole);
71
- }
72
- else if (row.RULE === 'Metadata') {
73
- var meta = {
74
- id: row.COUNTER,
75
- token: row.TOKEN,
76
- tokenType: row.TYPE,
77
- offset: row.OFFSET,
78
- paragraph: row.PARAGRAPH,
79
- parent: row.PARENT
80
- };
81
- metadata.push(meta);
82
- }
83
- }
84
- }
85
- return resolve({
86
- language: parameters.LANGUAGE_CODE,
87
- mimeType: parameters.MIME_TYPE,
88
- textSize: 0, // not returned by TA_ANALYZE
89
- plaintext: parameters.PLAINTEXT,
90
- tokens: tokens,
91
- entities: entities,
92
- metadata: metadata,
93
- grammaticalRoles: grammaticalRoles
94
- });
95
- });
96
- });
97
- }
98
-
99
- function normalizeInput(params) {
100
- var mappings = {
101
- 'inputDocumentText': 'DOCUMENT_TEXT',
102
- 'language': 'LANGUAGE_CODE',
103
- 'mimeType': 'MIME_TYPE',
104
- 'tokenSeparators': 'TOKEN_SEPARATORS',
105
- 'languageDetection': 'LANGUAGE_DETECTION'
106
- };
107
-
108
- var values = {
109
- RETURN_PLAINTEXT: params.includePlainText ? 1 : 0
110
- };
111
-
112
- Object.keys(mappings).forEach(function (xscProp) {
113
- if (params.hasOwnProperty(xscProp) && params[xscProp] !== undefined) {
114
- var prop = mappings[xscProp];
115
- values[prop] = params[xscProp];
116
- }
117
- });
118
-
119
- if (params.inputDocumentBinaryContent) {
120
- values.DOCUMENT_BINARY = extractBinary(params.inputDocumentBinaryContent);
121
- }
122
-
123
- return values;
124
- }
125
-
126
- function extractBinary(binContent) {
127
- return bufferUtils.isBinary(binContent) ? bufferUtils.toBuffer(binContent) : Buffer.from(binContent);
128
- }
@@ -1,30 +0,0 @@
1
- 'use strict';
2
-
3
- var MiningSession = require('./mining/Session');
4
- var AnalysisSession = require('./analysis/Session');
5
-
6
- exports.create = createTextObject;
7
-
8
-
9
- function createTextObject($db) {
10
- return {
11
- mining: createMiningObject($db),
12
- analysis: createAnalysisObject($db)
13
- };
14
- }
15
-
16
- function createMiningObject($db) {
17
- return {
18
- Session: function (params) {
19
- return new MiningSession($db, params);
20
- }
21
- };
22
- }
23
-
24
- function createAnalysisObject($db) {
25
- return {
26
- Session: function (params) {
27
- return new AnalysisSession($db, params);
28
- }
29
- };
30
- }
@@ -1,82 +0,0 @@
1
- 'use strict';
2
-
3
- var textmining = require('@sap/textmining');
4
-
5
- module.exports = Session;
6
-
7
- function Session($db, params) {
8
- this._tm = new textmining({
9
- client: async () => { await determineClient($db, params); },
10
- referenceTable: params.referenceTable,
11
- referenceColumn: params.referenceColumn
12
- });
13
- }
14
-
15
- Session.prototype.categorizeKNN = function (params) {
16
- return new Promise ((resolve, reject) => {
17
- this._tm.categorizeKNN(params, function(err, result) {
18
- if (err) { return reject(err);}
19
- resolve(result);
20
- });
21
- });
22
- };
23
-
24
- Session.prototype.getRelatedDocuments = function (params) {
25
- return new Promise ((resolve, reject) => {
26
- this._tm.getRelatedDocuments(params, function(err, result) {
27
- if (err) { return reject(err);}
28
- resolve(result);
29
- });
30
- });
31
- };
32
-
33
- Session.prototype.getRelatedTerms = function (params) {
34
- return new Promise ((resolve, reject) => {
35
- this._tm.getRelatedTerms(params, function(err, result) {
36
- if (err) { return reject(err);}
37
- resolve(result);
38
- });
39
- });
40
- };
41
-
42
- Session.prototype.getRelevantTerms = function (params) {
43
- return new Promise ((resolve, reject) => {
44
- this._tm.getRelevantTerms(params, function(err, result) {
45
- if (err) { return reject(err);}
46
- resolve(result);
47
- });
48
- });
49
- };
50
-
51
- Session.prototype.getRelevantDocuments = function (params) {
52
- return new Promise ((resolve, reject) => {
53
- this._tm.getRelevantDocuments(params, function(err, result) {
54
- if (err) { return reject(err);}
55
- resolve(result);
56
- });
57
- });
58
- };
59
-
60
- Session.prototype.getSuggestedTerms = function (params) {
61
- return new Promise ((resolve, reject) => {
62
- this._tm.getSuggestedTerms(params, function(err, result) {
63
- if (err) { return reject(err);}
64
- resolve(result);
65
- });
66
- });
67
- };
68
-
69
- Session.prototype.initialize = function (params) {
70
- return new Promise ((resolve, reject) => {
71
- this._tm.initialize(params, function(err, result) {
72
- if (err) { return reject(err);}
73
- resolve(result);
74
- });
75
- });
76
- };
77
-
78
- async function determineClient($db, params) {
79
- var conn = params.connection || await $db.getConnection();
80
- return conn._client;
81
- }
82
-