@restorecommerce/resource-base-interface 0.0.9 → 0.2.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/CHANGELOG.md +25 -0
- package/lib/core/GraphResourcesServiceBase.d.ts +3 -1
- package/lib/core/GraphResourcesServiceBase.js +105 -68
- package/lib/core/GraphResourcesServiceBase.js.map +1 -0
- package/lib/core/ResourcesAPI.d.ts +3 -2
- package/lib/core/ResourcesAPI.js +137 -86
- package/lib/core/ResourcesAPI.js.map +1 -0
- package/lib/core/ServiceBase.d.ts +2 -0
- package/lib/core/ServiceBase.js +238 -57
- package/lib/core/ServiceBase.js.map +1 -0
- package/lib/core/interfaces.d.ts +34 -1
- package/lib/core/interfaces.js +30 -0
- package/lib/core/interfaces.js.map +1 -0
- package/lib/index.d.ts +9 -2
- package/lib/index.js +168 -63
- package/lib/index.js.map +1 -0
- package/package.json +19 -20
- package/test.js +16 -0
- package/testFilter.js +221 -0
- package/tsconfig.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
### 0.2.1 (December 9th, 2021)
|
|
2
|
+
|
|
3
|
+
- updated dependencies
|
|
4
|
+
|
|
5
|
+
### 0.2.0 (August 4th, 2021)
|
|
6
|
+
|
|
7
|
+
- updated create (to remove edgeDef creation) and delete method to match new proto structure response
|
|
8
|
+
- generate status array for create and update operations and up tests
|
|
9
|
+
- generate status array for upsert and improve error handling
|
|
10
|
+
- added status array for delete response
|
|
11
|
+
- filter structure changes
|
|
12
|
+
- updated grpc-client for tests, fix for filter handling (enum mapping), added error array to all tests
|
|
13
|
+
|
|
14
|
+
### 0.1.1 (May 18th, 2021)
|
|
15
|
+
|
|
16
|
+
- improved logging
|
|
17
|
+
|
|
18
|
+
### 0.1.0 (April 27th, 2021)
|
|
19
|
+
|
|
20
|
+
#### Contains breaking changes!
|
|
21
|
+
|
|
22
|
+
- switch to kafkajs
|
|
23
|
+
- change config format for events
|
|
24
|
+
- updated dependencies
|
|
25
|
+
|
|
1
26
|
### 0.0.9 (March 19th, 2021)
|
|
2
27
|
|
|
3
28
|
- fix create and update to support inbound edges
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GraphDatabaseProvider } from '@restorecommerce/chassis-srv';
|
|
2
|
+
import { Logger } from 'winston';
|
|
2
3
|
/**
|
|
3
4
|
* Graph Resource API base provides functions for graph Operations such as
|
|
4
5
|
* creating or modifying Vertices/Edges, graph traversal etc.
|
|
@@ -7,11 +8,12 @@ export declare class GraphResourcesServiceBase {
|
|
|
7
8
|
private db;
|
|
8
9
|
private bufferFiledCfg?;
|
|
9
10
|
bufferedCollections: any;
|
|
11
|
+
logger: Logger;
|
|
10
12
|
/**
|
|
11
13
|
* @constructor
|
|
12
14
|
* @param {object} db Chassis arangodb provider.
|
|
13
15
|
*/
|
|
14
|
-
constructor(db: GraphDatabaseProvider, bufferFiledCfg?: any);
|
|
16
|
+
constructor(db: GraphDatabaseProvider, bufferFiledCfg?: any, logger?: Logger);
|
|
15
17
|
/**
|
|
16
18
|
* collection traversal - Performs a traversal starting from the given
|
|
17
19
|
* startVertex and following edges contained in this edge collection.
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GraphResourcesServiceBase = void 0;
|
|
13
13
|
const _ = require("lodash");
|
|
14
|
+
const logger_1 = require("@restorecommerce/logger");
|
|
14
15
|
/**
|
|
15
16
|
* Graph Resource API base provides functions for graph Operations such as
|
|
16
17
|
* creating or modifying Vertices/Edges, graph traversal etc.
|
|
@@ -20,7 +21,7 @@ class GraphResourcesServiceBase {
|
|
|
20
21
|
* @constructor
|
|
21
22
|
* @param {object} db Chassis arangodb provider.
|
|
22
23
|
*/
|
|
23
|
-
constructor(db, bufferFiledCfg) {
|
|
24
|
+
constructor(db, bufferFiledCfg, logger) {
|
|
24
25
|
this.db = db;
|
|
25
26
|
this.bufferFiledCfg = bufferFiledCfg;
|
|
26
27
|
if (bufferFiledCfg) {
|
|
@@ -30,6 +31,20 @@ class GraphResourcesServiceBase {
|
|
|
30
31
|
this.bufferedCollections.push(key);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
34
|
+
if (logger) {
|
|
35
|
+
this.logger = logger;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const defaultLoggerCfg = {
|
|
39
|
+
console: {
|
|
40
|
+
handleExceptions: false,
|
|
41
|
+
level: 'debug',
|
|
42
|
+
colorize: true,
|
|
43
|
+
prettyPrint: true
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
this.logger = (0, logger_1.createLogger)(defaultLoggerCfg);
|
|
47
|
+
}
|
|
33
48
|
}
|
|
34
49
|
/**
|
|
35
50
|
* collection traversal - Performs a traversal starting from the given
|
|
@@ -48,82 +63,103 @@ class GraphResourcesServiceBase {
|
|
|
48
63
|
traversal(call, context) {
|
|
49
64
|
var _a;
|
|
50
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
start_vertex
|
|
56
|
-
|
|
57
|
-
start_vertex
|
|
66
|
+
try {
|
|
67
|
+
const request = (_a = call.request) === null || _a === void 0 ? void 0 : _a.request;
|
|
68
|
+
const collection_name = request.collection_name;
|
|
69
|
+
let start_vertex = request.start_vertex;
|
|
70
|
+
if (_.isEmpty(start_vertex)) {
|
|
71
|
+
start_vertex = request === null || request === void 0 ? void 0 : request.start_vertices;
|
|
72
|
+
if (!_.isEmpty(start_vertex)) {
|
|
73
|
+
start_vertex = start_vertex.vertices;
|
|
74
|
+
}
|
|
58
75
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
throw new Error('missing start vertex');
|
|
63
|
-
}
|
|
64
|
-
const edge_name = request === null || request === void 0 ? void 0 : request.edge_name;
|
|
65
|
-
let data;
|
|
66
|
-
let path;
|
|
67
|
-
let aql;
|
|
68
|
-
if (request === null || request === void 0 ? void 0 : request.data) {
|
|
69
|
-
data = request === null || request === void 0 ? void 0 : request.data;
|
|
70
|
-
}
|
|
71
|
-
if (request === null || request === void 0 ? void 0 : request.path) {
|
|
72
|
-
path = request === null || request === void 0 ? void 0 : request.path;
|
|
73
|
-
}
|
|
74
|
-
if (request === null || request === void 0 ? void 0 : request.aql) {
|
|
75
|
-
aql = request === null || request === void 0 ? void 0 : request.aql;
|
|
76
|
-
}
|
|
77
|
-
const queryResult = yield this.db.traversal(start_vertex, opts, collection_name, edge_name, data, path, aql);
|
|
78
|
-
let idPropertyMapping = new Map();
|
|
79
|
-
const vertexFields = queryResult.vertex_fields || [];
|
|
80
|
-
let marshallRequired = false;
|
|
81
|
-
for (let eachVertex of vertexFields) {
|
|
82
|
-
const collectionArray = eachVertex._id.split('/');
|
|
83
|
-
const resourceName = collectionArray[0].substring(0, collectionArray[0].length - 1);
|
|
84
|
-
marshallRequired = true;
|
|
85
|
-
if (this.bufferedCollections.indexOf(resourceName) > -1) {
|
|
86
|
-
// need to marshall this collection instance data
|
|
87
|
-
// map id to the actual key which needs to be marshelled
|
|
88
|
-
idPropertyMapping.set(collectionArray[1], this.bufferFiledCfg[resourceName]);
|
|
89
|
-
marshallRequired = true;
|
|
76
|
+
const opts = request === null || request === void 0 ? void 0 : request.opts;
|
|
77
|
+
if (_.isEmpty(start_vertex)) {
|
|
78
|
+
throw new Error('missing start vertex');
|
|
90
79
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
80
|
+
const edge_name = request === null || request === void 0 ? void 0 : request.edge_name;
|
|
81
|
+
let data;
|
|
82
|
+
let path;
|
|
83
|
+
let aql;
|
|
84
|
+
if (request === null || request === void 0 ? void 0 : request.data) {
|
|
85
|
+
data = request === null || request === void 0 ? void 0 : request.data;
|
|
86
|
+
}
|
|
87
|
+
if (request === null || request === void 0 ? void 0 : request.path) {
|
|
88
|
+
path = request === null || request === void 0 ? void 0 : request.path;
|
|
89
|
+
}
|
|
90
|
+
if (request === null || request === void 0 ? void 0 : request.aql) {
|
|
91
|
+
aql = request === null || request === void 0 ? void 0 : request.aql;
|
|
92
|
+
}
|
|
93
|
+
let queryResult;
|
|
94
|
+
try {
|
|
95
|
+
this.logger.debug('Calling traversal', { start_vertex, collection_name });
|
|
96
|
+
queryResult = yield this.db.traversal(start_vertex, opts, collection_name, edge_name, data, path, aql);
|
|
97
|
+
this.logger.debug('Response from DB traversal', { response: queryResult });
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
this.logger.error('Error stack', err);
|
|
101
|
+
this.logger.error('Error executing DB Traversal', { error: err.message });
|
|
102
|
+
throw err;
|
|
103
|
+
}
|
|
104
|
+
let idPropertyMapping = new Map();
|
|
105
|
+
const vertexFields = queryResult.vertex_fields || [];
|
|
106
|
+
let marshallRequired = false;
|
|
107
|
+
for (let eachVertex of vertexFields) {
|
|
108
|
+
const collectionArray = eachVertex._id.split('/');
|
|
109
|
+
const resourceName = collectionArray[0].substring(0, collectionArray[0].length - 1);
|
|
110
|
+
marshallRequired = true;
|
|
111
|
+
if (this.bufferedCollections.indexOf(resourceName) > -1) {
|
|
112
|
+
// need to marshall this collection instance data
|
|
113
|
+
// map id to the actual key which needs to be marshelled
|
|
114
|
+
idPropertyMapping.set(collectionArray[1], this.bufferFiledCfg[resourceName]);
|
|
115
|
+
marshallRequired = true;
|
|
104
116
|
}
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
// sanitize fields to remove _key, _rev and rename _id to id field
|
|
118
|
+
delete eachVertex._key;
|
|
119
|
+
delete eachVertex._rev;
|
|
120
|
+
eachVertex['id'] = eachVertex._id;
|
|
121
|
+
delete eachVertex._id;
|
|
122
|
+
}
|
|
123
|
+
let completeDecodedData = [];
|
|
124
|
+
if (marshallRequired || (queryResult && queryResult.data && queryResult.data.value)) {
|
|
125
|
+
// get the decoded JSON list of resources.
|
|
126
|
+
const decodedData = JSON.parse(Buffer.from(queryResult.data.value).toString());
|
|
127
|
+
for (let doc of decodedData) {
|
|
128
|
+
if (idPropertyMapping.has(doc.id)) {
|
|
129
|
+
completeDecodedData.push(this.marshallData(doc, idPropertyMapping.get(doc.id)));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
completeDecodedData.push(doc);
|
|
133
|
+
}
|
|
107
134
|
}
|
|
108
135
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
136
|
+
const size = 150;
|
|
137
|
+
const completeVertexFields = queryResult.vertex_fields;
|
|
138
|
+
while ((completeDecodedData && completeDecodedData.length > 0) ||
|
|
139
|
+
(completeVertexFields && completeVertexFields.length > 0)) {
|
|
140
|
+
if (completeDecodedData.length > 0) {
|
|
141
|
+
const partDoc = completeDecodedData.splice(0, 1000);
|
|
142
|
+
this.logger.debug('Writing Buffer Chunk', partDoc);
|
|
143
|
+
queryResult.data = { value: Buffer.from(JSON.stringify(partDoc)) };
|
|
144
|
+
}
|
|
145
|
+
if (completeVertexFields.length > 0) {
|
|
146
|
+
queryResult.vertex_fields = completeVertexFields.splice(0, size);
|
|
147
|
+
}
|
|
148
|
+
yield call.write(queryResult);
|
|
149
|
+
this.logger.debug('Buffer chunk written successfully');
|
|
117
150
|
}
|
|
118
|
-
if (
|
|
119
|
-
|
|
151
|
+
if (queryResult && queryResult.paths && queryResult.paths.value) {
|
|
152
|
+
yield call.write(queryResult);
|
|
120
153
|
}
|
|
121
|
-
|
|
154
|
+
this.logger.debug('Invoking end from traversal');
|
|
155
|
+
yield call.end();
|
|
156
|
+
this.logger.debug('Traversal request ended');
|
|
122
157
|
}
|
|
123
|
-
|
|
124
|
-
|
|
158
|
+
catch (err) {
|
|
159
|
+
this.logger.error('Error caught executing traversal', { err: err.message });
|
|
160
|
+
this.logger.error('Error stack', err);
|
|
161
|
+
throw err;
|
|
125
162
|
}
|
|
126
|
-
yield call.end();
|
|
127
163
|
});
|
|
128
164
|
}
|
|
129
165
|
/**
|
|
@@ -145,3 +181,4 @@ class GraphResourcesServiceBase {
|
|
|
145
181
|
}
|
|
146
182
|
}
|
|
147
183
|
exports.GraphResourcesServiceBase = GraphResourcesServiceBase;
|
|
184
|
+
//# sourceMappingURL=GraphResourcesServiceBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphResourcesServiceBase.js","sourceRoot":"","sources":["../../src/core/GraphResourcesServiceBase.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA4B;AAE5B,oDAAuD;AAGvD;;;GAGG;AACH,MAAa,yBAAyB;IAGpC;;;OAGG;IACH,YAAoB,EAAyB,EAAU,cAAoB,EAAE,MAAe;QAAxE,OAAE,GAAF,EAAE,CAAuB;QAAU,mBAAc,GAAd,cAAc,CAAM;QACzE,IAAI,cAAc,EAAE;YAClB,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;YAC9B,KAAK,IAAI,GAAG,IAAI,cAAc,EAAE;gBAC9B,8DAA8D;gBAC9D,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACpC;SACF;QACD,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACtB;aAAM;YACL,MAAM,gBAAgB,GAAG;gBACvB,OAAO,EAAE;oBACP,gBAAgB,EAAE,KAAK;oBACvB,KAAK,EAAE,OAAO;oBACd,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,IAAI;iBAClB;aACF,CAAC;YACF,IAAI,CAAC,MAAM,GAAG,IAAA,qBAAY,EAAC,gBAAgB,CAAC,CAAC;SAC9C;IACH,CAAC;IAED;;;;;;;;;;;;;MA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,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE;YACpD,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;YACzC,oCAAoC;YACpC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;YACjE,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;YAC3B,QAAQ,CAAC,WAAW,CAAC,CAAC,KAAK,GAAG,gBAAgB,CAAC;SAChD;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA/JD,8DA+JC"}
|
|
@@ -12,13 +12,14 @@ export declare class ResourcesAPIBase {
|
|
|
12
12
|
bufferField: string;
|
|
13
13
|
requiredFields: any;
|
|
14
14
|
resourceName: string;
|
|
15
|
+
logger: any;
|
|
15
16
|
/**
|
|
16
17
|
* @constructor
|
|
17
18
|
* @param {object} db Chassis arangodb provider.
|
|
18
19
|
* @param {string} collectionName Name of database collection.
|
|
19
20
|
* @param {any} fieldHandlerConf The collection's field generators configuration.
|
|
20
21
|
*/
|
|
21
|
-
constructor(db: DatabaseProvider, collectionName: string, fieldHandlerConf?: any, edgeCfg?: any, graphName?: string);
|
|
22
|
+
constructor(db: DatabaseProvider, collectionName: string, fieldHandlerConf?: any, edgeCfg?: any, graphName?: string, logger?: any);
|
|
22
23
|
/**
|
|
23
24
|
* Finds documents based on provided filters and options
|
|
24
25
|
* @param {object} filter key value filter using mongodb/nedb filter format.
|
|
@@ -41,7 +42,7 @@ export declare class ResourcesAPIBase {
|
|
|
41
42
|
* @param requiredFields
|
|
42
43
|
* @param documents
|
|
43
44
|
*/
|
|
44
|
-
checkRequiredFields(requiredFields: string[], documents: any):
|
|
45
|
+
checkRequiredFields(requiredFields: string[], documents: any, result: any[]): any;
|
|
45
46
|
/**
|
|
46
47
|
* Removes documents found by id.
|
|
47
48
|
*
|