@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 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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
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
- var _a;
65
- return __awaiter(this, void 0, void 0, function* () {
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
+ 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
- const opts = request === null || request === void 0 ? void 0 : request.opts;
77
- if (_.isEmpty(start_vertex)) {
78
- throw new Error('missing start vertex');
79
- }
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;
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
- // 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;
140
+ traversalStream.push({ data: { value: Buffer.from(JSON.stringify(batch)) } });
122
141
  }
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)));
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
- else {
132
- completeDecodedData.push(doc);
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
- 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)) };
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
- if (completeVertexFields.length > 0) {
146
- queryResult.vertex_fields = completeVertexFields.splice(0, size);
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
- catch (err) {
159
- this.logger.error('Error caught executing traversal', { err: err.message });
160
- this.logger.error('Error stack', err);
161
- throw err;
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":";;;;;;;;;;;;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,qBAAY,CAAC,gBAAgB,CAAC,CAAC;SAC9C;IACH,CAAC;IAED;;;;;;;;;;;;;MAaE;IACI,SAAS,CAAC,IAAS,EAAE,OAAa;;;YACtC,IAAI;gBACF,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,OAAO,CAAC;gBACtC,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;gBAChD,IAAI,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;gBACxC,IAAI,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;oBAC3B,YAAY,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CAAC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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): void;
45
+ checkRequiredFields(requiredFields: string[], documents: any, result: any[]): any;
45
46
  /**
46
47
  * Removes documents found by id.
47
48
  *