@restorecommerce/resource-base-interface 0.1.1 → 0.2.3
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 +22 -0
- package/lib/core/GraphResourcesServiceBase.js +121 -101
- package/lib/core/GraphResourcesServiceBase.js.map +1 -1
- package/lib/core/ResourcesAPI.d.ts +3 -2
- package/lib/core/ResourcesAPI.js +279 -228
- package/lib/core/ResourcesAPI.js.map +1 -1
- package/lib/core/ServiceBase.d.ts +2 -0
- package/lib/core/ServiceBase.js +345 -165
- package/lib/core/ServiceBase.js.map +1 -1
- package/lib/core/interfaces.d.ts +66 -1
- package/lib/core/interfaces.js +36 -0
- package/lib/core/interfaces.js.map +1 -1
- package/lib/index.d.ts +9 -2
- package/lib/index.js +187 -64
- package/lib/index.js.map +1 -1
- package/package.json +21 -20
- package/tsconfig.json +12 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
### 0.2.3 (January 28th, 2022)
|
|
2
|
+
|
|
3
|
+
- fix traversal for changes in proto structure and updated tests
|
|
4
|
+
- updated dependencies
|
|
5
|
+
|
|
6
|
+
### 0.2.2 (December 22nd, 2021)
|
|
7
|
+
|
|
8
|
+
- updated RC dependencies
|
|
9
|
+
|
|
10
|
+
### 0.2.1 (December 9th, 2021)
|
|
11
|
+
|
|
12
|
+
- updated dependencies
|
|
13
|
+
|
|
14
|
+
### 0.2.0 (August 4th, 2021)
|
|
15
|
+
|
|
16
|
+
- updated create (to remove edgeDef creation) and delete method to match new proto structure response
|
|
17
|
+
- generate status array for create and update operations and up tests
|
|
18
|
+
- generate status array for upsert and improve error handling
|
|
19
|
+
- added status array for delete response
|
|
20
|
+
- filter structure changes
|
|
21
|
+
- updated grpc-client for tests, fix for filter handling (enum mapping), added error array to all tests
|
|
22
|
+
|
|
1
23
|
### 0.1.1 (May 18th, 2021)
|
|
2
24
|
|
|
3
25
|
- improved logging
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
10
20
|
};
|
|
11
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
22
|
exports.GraphResourcesServiceBase = void 0;
|
|
13
|
-
const _ = require("lodash");
|
|
23
|
+
const _ = __importStar(require("lodash"));
|
|
14
24
|
const logger_1 = require("@restorecommerce/logger");
|
|
25
|
+
const stream_1 = require("stream");
|
|
15
26
|
/**
|
|
16
27
|
* Graph Resource API base provides functions for graph Operations such as
|
|
17
28
|
* creating or modifying Vertices/Edges, graph traversal etc.
|
|
@@ -43,7 +54,7 @@ class GraphResourcesServiceBase {
|
|
|
43
54
|
prettyPrint: true
|
|
44
55
|
}
|
|
45
56
|
};
|
|
46
|
-
this.logger = logger_1.createLogger(defaultLoggerCfg);
|
|
57
|
+
this.logger = (0, logger_1.createLogger)(defaultLoggerCfg);
|
|
47
58
|
}
|
|
48
59
|
}
|
|
49
60
|
/**
|
|
@@ -60,107 +71,116 @@ class GraphResourcesServiceBase {
|
|
|
60
71
|
* @return {TraversalResponse} TraversalResponse containing VertexFields,
|
|
61
72
|
* traversed pahts and materialized data
|
|
62
73
|
*/
|
|
63
|
-
traversal(call, context) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
async traversal(call, context) {
|
|
75
|
+
try {
|
|
76
|
+
const request = call.request?.request;
|
|
77
|
+
const vertices = request?.vertices;
|
|
78
|
+
const collection = request?.collection;
|
|
79
|
+
const options = request?.opts;
|
|
80
|
+
if (!vertices && !collection) {
|
|
81
|
+
const message = 'missing start vertex or collection_name for graph traversal';
|
|
82
|
+
this.logger.error(message);
|
|
83
|
+
await call.write({
|
|
84
|
+
operation_status: { code: 400, message }
|
|
85
|
+
});
|
|
86
|
+
return await call.end();
|
|
87
|
+
}
|
|
88
|
+
const filters = request?.filters;
|
|
89
|
+
let path = request?.path ? request.path : false;
|
|
90
|
+
let traversalCursor;
|
|
91
|
+
let sort;
|
|
92
|
+
if (collection && !_.isEmpty(collection.sort)) {
|
|
93
|
+
sort = {};
|
|
94
|
+
_.forEach(collection.sort, (s) => {
|
|
95
|
+
switch (s.order) {
|
|
96
|
+
case 'ASCENDING':
|
|
97
|
+
case 1:
|
|
98
|
+
sort[s.field] = 'ASC';
|
|
99
|
+
break;
|
|
100
|
+
case 2:
|
|
101
|
+
case 'DESCENDING':
|
|
102
|
+
sort[s.field] = 'DESC';
|
|
103
|
+
break;
|
|
104
|
+
case 'UNSORTED':
|
|
105
|
+
case 0:
|
|
106
|
+
default:
|
|
107
|
+
break;
|
|
74
108
|
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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;
|
|
109
|
+
});
|
|
110
|
+
collection.sort = sort;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
this.logger.debug('Calling traversal', { vertices, collection });
|
|
114
|
+
traversalCursor = await this.db.traversal(vertices, collection, options, filters);
|
|
115
|
+
this.logger.debug('Received traversal ArrayCursor from DB');
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
this.logger.error('Error stack', err);
|
|
119
|
+
this.logger.error('Error executing DB Traversal', { error: err.message });
|
|
120
|
+
await call.write({
|
|
121
|
+
operation_status: { code: err.code ? err.code : 500, message: err.message }
|
|
122
|
+
});
|
|
123
|
+
return await call.end();
|
|
124
|
+
}
|
|
125
|
+
let rootCursor = traversalCursor.rootCursor;
|
|
126
|
+
let associationCursor = traversalCursor.associationCursor;
|
|
127
|
+
const traversalStream = new stream_1.Stream.Readable({ objectMode: true });
|
|
128
|
+
// root entity data batches
|
|
129
|
+
if (rootCursor && rootCursor.batches) {
|
|
130
|
+
for await (const batch of rootCursor.batches) {
|
|
131
|
+
// root entity data, encoding before pushing batch
|
|
132
|
+
for (let elem of batch) {
|
|
133
|
+
if (elem._key) {
|
|
134
|
+
delete elem._key;
|
|
135
|
+
}
|
|
136
|
+
if (elem._rev) {
|
|
137
|
+
delete elem._rev;
|
|
138
|
+
}
|
|
116
139
|
}
|
|
117
|
-
|
|
118
|
-
delete eachVertex._key;
|
|
119
|
-
delete eachVertex._rev;
|
|
120
|
-
eachVertex['id'] = eachVertex._id;
|
|
121
|
-
delete eachVertex._id;
|
|
140
|
+
traversalStream.push({ data: { value: Buffer.from(JSON.stringify(batch)) } });
|
|
122
141
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
142
|
+
}
|
|
143
|
+
// association entity data batches
|
|
144
|
+
if (associationCursor && associationCursor.batches) {
|
|
145
|
+
for await (const batch of associationCursor.batches) {
|
|
146
|
+
let associationData = [];
|
|
147
|
+
let traversedPaths = [];
|
|
148
|
+
for (let data of batch) {
|
|
149
|
+
if (data.v._key) {
|
|
150
|
+
delete data.v._key;
|
|
130
151
|
}
|
|
131
|
-
|
|
132
|
-
|
|
152
|
+
if (data.v._rev) {
|
|
153
|
+
delete data.v._rev;
|
|
154
|
+
}
|
|
155
|
+
associationData.push(data.v);
|
|
156
|
+
if (path) {
|
|
157
|
+
traversedPaths.push(data.p);
|
|
133
158
|
}
|
|
134
159
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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)) };
|
|
160
|
+
if (!_.isEmpty(associationData)) {
|
|
161
|
+
// associated entity data, encoding before pushing data
|
|
162
|
+
traversalStream.push({ data: { value: Buffer.from(JSON.stringify(associationData)) } });
|
|
144
163
|
}
|
|
145
|
-
|
|
146
|
-
|
|
164
|
+
// paths
|
|
165
|
+
if (!_.isEmpty(traversedPaths)) {
|
|
166
|
+
// traversed paths, encoding before pushing paths
|
|
167
|
+
traversalStream.push({ paths: { value: Buffer.from(JSON.stringify(traversedPaths)) } });
|
|
147
168
|
}
|
|
148
|
-
yield call.write(queryResult);
|
|
149
|
-
this.logger.debug('Buffer chunk written successfully');
|
|
150
|
-
}
|
|
151
|
-
if (queryResult && queryResult.paths && queryResult.paths.value) {
|
|
152
|
-
yield call.write(queryResult);
|
|
153
169
|
}
|
|
154
|
-
this.logger.debug('Invoking end from traversal');
|
|
155
|
-
yield call.end();
|
|
156
|
-
this.logger.debug('Traversal request ended');
|
|
157
170
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
171
|
+
traversalStream.push({ operation_status: { code: 200, message: 'success' } });
|
|
172
|
+
traversalStream.push(null);
|
|
173
|
+
traversalStream.pipe(call.request);
|
|
174
|
+
this.logger.debug('Traversal request ended');
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
this.logger.error('Error caught executing traversal', { err: err.message });
|
|
179
|
+
this.logger.error('Error stack', err);
|
|
180
|
+
return {
|
|
181
|
+
operation_status: { code: err.code ? err.code : 500, message: err.message }
|
|
182
|
+
};
|
|
183
|
+
}
|
|
164
184
|
}
|
|
165
185
|
/**
|
|
166
186
|
* marshall the data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphResourcesServiceBase.js","sourceRoot":"","sources":["../../src/core/GraphResourcesServiceBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GraphResourcesServiceBase.js","sourceRoot":"","sources":["../../src/core/GraphResourcesServiceBase.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA4B;AAE5B,oDAAuD;AAGvD,mCAAgC;AAGhC;;;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;;;;;;;;;;;;;MAaE;IACF,KAAK,CAAC,SAAS,CAAC,IAAS,EAAE,OAAa;QACtC,IAAI;YACF,MAAM,OAAO,GAAqB,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;YACxD,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC;YACnC,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,CAAC;YACvC,MAAM,OAAO,GAAG,OAAO,EAAE,IAAI,CAAC;YAC9B,IAAI,CAAC,QAAQ,IAAI,CAAC,UAAU,EAAE;gBAC5B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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
|
*
|