quidproquo-actionprocessor-awslambda 0.0.230 → 0.0.231

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.
@@ -16,7 +16,7 @@ const getProcessGetRecords = (qpqConfig) => {
16
16
  const internalEventRecord = {
17
17
  time: eventBridgeEvent.time,
18
18
  correlation: context.awsRequestId,
19
- detail: eventBridgeEvent.detail,
19
+ metadata: eventBridgeEvent.detail,
20
20
  };
21
21
  return (0, quidproquo_core_1.actionResult)([internalEventRecord]);
22
22
  });
@@ -4,14 +4,16 @@ exports.askRunNeptuneOpenCypherQuery = void 0;
4
4
  const quidproquo_core_1 = require("quidproquo-core");
5
5
  const customActions_1 = require("../customActions");
6
6
  const askConvertNeptuneCypherResponseToCypherResponse_1 = require("./converters/askConvertNeptuneCypherResponseToCypherResponse");
7
+ const utils_1 = require("./utils");
7
8
  function* askRunNeptuneOpenCypherQuery({ graphDatabaseName, openCypherQuery, params, instance, }) {
8
9
  const graphEndpoints = yield* (0, customActions_1.askGraphDatabaseForNeptuneGetEndpoints)(graphDatabaseName);
9
10
  const graphEndpoint = instance === quidproquo_core_1.GraphDatabaseInstanceType.Read ? graphEndpoints.readEndpoint : graphEndpoints.writeEndpoint;
10
11
  if (!graphEndpoint) {
11
12
  return yield* (0, quidproquo_core_1.askThrowError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `No [${instance}] endpoint found`);
12
13
  }
14
+ const neptuneQuery = (0, utils_1.convertQpqQueryToNeptune)(openCypherQuery);
13
15
  const response = yield* (0, quidproquo_core_1.askNetworkRequest)('POST', `${graphEndpoint}/openCypher`, {
14
- body: { query: openCypherQuery, parameters: params },
16
+ body: { query: neptuneQuery, parameters: params },
15
17
  headers: {
16
18
  'Content-Type': 'application/json',
17
19
  Accept: 'application/json',
@@ -0,0 +1 @@
1
+ export declare function convertQpqQueryToNeptune(query: string): string;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertQpqQueryToNeptune = void 0;
4
+ // Neptune: Replace qpqElementId(n) with n.`~id`
5
+ function convertQpqQueryToNeptune(query) {
6
+ return query.replace(/qpqElementId\((.*?)\)/g, '$1.`~id`');
7
+ }
8
+ exports.convertQpqQueryToNeptune = convertQpqQueryToNeptune;
@@ -0,0 +1 @@
1
+ export * from './convertQpqQueryToNeptune';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./convertQpqQueryToNeptune"), exports);
@@ -4,7 +4,7 @@ const getProcessGetRecords = (qpqConfig) => {
4
4
  const internalEventRecord = {
5
5
  time: eventBridgeEvent.time,
6
6
  correlation: context.awsRequestId,
7
- detail: eventBridgeEvent.detail,
7
+ metadata: eventBridgeEvent.detail,
8
8
  };
9
9
  return actionResult([internalEventRecord]);
10
10
  };
@@ -1,14 +1,16 @@
1
1
  import { ErrorTypeEnum, askNetworkRequest, askThrowError, GraphDatabaseInstanceType, } from 'quidproquo-core';
2
2
  import { askGraphDatabaseForNeptuneGetEndpoints } from '../customActions';
3
3
  import { askConvertNeptuneCypherResponseToCypherResponse } from './converters/askConvertNeptuneCypherResponseToCypherResponse';
4
+ import { convertQpqQueryToNeptune } from './utils';
4
5
  export function* askRunNeptuneOpenCypherQuery({ graphDatabaseName, openCypherQuery, params, instance, }) {
5
6
  const graphEndpoints = yield* askGraphDatabaseForNeptuneGetEndpoints(graphDatabaseName);
6
7
  const graphEndpoint = instance === GraphDatabaseInstanceType.Read ? graphEndpoints.readEndpoint : graphEndpoints.writeEndpoint;
7
8
  if (!graphEndpoint) {
8
9
  return yield* askThrowError(ErrorTypeEnum.GenericError, `No [${instance}] endpoint found`);
9
10
  }
11
+ const neptuneQuery = convertQpqQueryToNeptune(openCypherQuery);
10
12
  const response = yield* askNetworkRequest('POST', `${graphEndpoint}/openCypher`, {
11
- body: { query: openCypherQuery, parameters: params },
13
+ body: { query: neptuneQuery, parameters: params },
12
14
  headers: {
13
15
  'Content-Type': 'application/json',
14
16
  Accept: 'application/json',
@@ -0,0 +1 @@
1
+ export declare function convertQpqQueryToNeptune(query: string): string;
@@ -0,0 +1,4 @@
1
+ // Neptune: Replace qpqElementId(n) with n.`~id`
2
+ export function convertQpqQueryToNeptune(query) {
3
+ return query.replace(/qpqElementId\((.*?)\)/g, '$1.`~id`');
4
+ }
@@ -0,0 +1 @@
1
+ export * from './convertQpqQueryToNeptune';
@@ -0,0 +1 @@
1
+ export * from './convertQpqQueryToNeptune';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-actionprocessor-awslambda",
3
- "version": "0.0.230",
3
+ "version": "0.0.231",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -52,9 +52,9 @@
52
52
  "lodash": "^4.17.21",
53
53
  "node-cache": "^5.1.2",
54
54
  "node-match-path": "^0.6.3",
55
- "quidproquo-config-aws": "0.0.230",
56
- "quidproquo-core": "0.0.230",
57
- "quidproquo-webserver": "0.0.230"
55
+ "quidproquo-config-aws": "0.0.231",
56
+ "quidproquo-core": "0.0.231",
57
+ "quidproquo-webserver": "0.0.231"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/aws-lambda": "^8.10.109",
@@ -62,7 +62,7 @@
62
62
  "@types/jsonwebtoken": "^9.0.2",
63
63
  "@types/lodash": "^4.14.194",
64
64
  "@types/node": "^18.11.9",
65
- "quidproquo-tsconfig": "0.0.230",
65
+ "quidproquo-tsconfig": "0.0.231",
66
66
  "typescript": "^4.9.3"
67
67
  }
68
68
  }