quidproquo-neo4j 0.0.230
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/README.md +1 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/getGraphDatabaseExecuteOpenCypherQueryActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/getGraphDatabaseExecuteOpenCypherQueryActionProcessor.js +21 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/index.js +17 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/askRunNeo4jOpenCypherQuery.d.ts +2 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/askRunNeo4jOpenCypherQuery.js +30 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/askConvertAnyNeo4jResultToAnyGraphResult.d.ts +3 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/askConvertAnyNeo4jResultToAnyGraphResult.js +20 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jCypherResponseToCypherResponse.d.ts +3 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jCypherResponseToCypherResponse.js +17 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jNodeResultToGraphNodeResult.d.ts +3 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jNodeResultToGraphNodeResult.js +13 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jRelationshipResultToGraphRelationshipResult.d.ts +3 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jRelationshipResultToGraphRelationshipResult.js +15 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/index.d.ts +1 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/index.js +17 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/utils/index.d.ts +3 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/utils/index.js +19 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jNodeResult.d.ts +2 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jNodeResult.js +15 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jRelationshipResult.d.ts +2 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jRelationshipResult.js +15 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jScalarResult.d.ts +2 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jScalarResult.js +7 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/index.d.ts +1 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/index.js +17 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/types/index.d.ts +1 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/types/index.js +17 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/types/neo4j.d.ts +38 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/types/neo4j.js +3 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/utils/convertQpqQueryToNeo4j.d.ts +1 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/utils/convertQpqQueryToNeo4j.js +8 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/utils/index.d.ts +1 -0
- package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/utils/index.js +17 -0
- package/lib/commonjs/config/index.d.ts +1 -0
- package/lib/commonjs/config/index.js +17 -0
- package/lib/commonjs/config/settings/graphDatabaseNeo4j/defineGraphDatabaseNeo4j.d.ts +2 -0
- package/lib/commonjs/config/settings/graphDatabaseNeo4j/defineGraphDatabaseNeo4j.js +20 -0
- package/lib/commonjs/config/settings/graphDatabaseNeo4j/index.d.ts +1 -0
- package/lib/commonjs/config/settings/graphDatabaseNeo4j/index.js +17 -0
- package/lib/commonjs/config/settings/index.d.ts +1 -0
- package/lib/commonjs/config/settings/index.js +17 -0
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +7 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/getGraphDatabaseExecuteOpenCypherQueryActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/getGraphDatabaseExecuteOpenCypherQueryActionProcessor.js +6 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/index.d.ts +2 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/index.js +4 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/askRunNeo4jOpenCypherQuery.d.ts +2 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/askRunNeo4jOpenCypherQuery.js +26 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/askConvertAnyNeo4jResultToAnyGraphResult.d.ts +3 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/askConvertAnyNeo4jResultToAnyGraphResult.js +16 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jCypherResponseToCypherResponse.d.ts +3 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jCypherResponseToCypherResponse.js +16 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jNodeResultToGraphNodeResult.d.ts +3 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jNodeResultToGraphNodeResult.js +9 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jRelationshipResultToGraphRelationshipResult.d.ts +3 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/askConvertNeo4jRelationshipResultToGraphRelationshipResult.js +11 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/index.d.ts +1 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/index.js +1 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/utils/index.d.ts +3 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/utils/index.js +3 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jNodeResult.d.ts +2 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jNodeResult.js +11 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jRelationshipResult.d.ts +2 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jRelationshipResult.js +11 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jScalarResult.d.ts +2 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/converters/utils/isNeo4jScalarResult.js +3 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/index.d.ts +1 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/index.js +1 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/types/index.d.ts +1 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/types/index.js +1 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/types/neo4j.d.ts +38 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/types/neo4j.js +2 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/utils/convertQpqQueryToNeo4j.d.ts +1 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/utils/convertQpqQueryToNeo4j.js +4 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/utils/index.d.ts +1 -0
- package/lib/esm/actionProcessor/graphDatabaseOverride/stories/utils/index.js +1 -0
- package/lib/esm/config/index.d.ts +1 -0
- package/lib/esm/config/index.js +1 -0
- package/lib/esm/config/settings/graphDatabaseNeo4j/defineGraphDatabaseNeo4j.d.ts +2 -0
- package/lib/esm/config/settings/graphDatabaseNeo4j/defineGraphDatabaseNeo4j.js +13 -0
- package/lib/esm/config/settings/graphDatabaseNeo4j/index.d.ts +1 -0
- package/lib/esm/config/settings/graphDatabaseNeo4j/index.js +1 -0
- package/lib/esm/config/settings/index.d.ts +1 -0
- package/lib/esm/config/settings/index.js +1 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +3 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# quidproquo-neo4j
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getGraphDatabaseExecuteOpenCypherQueryActionProcessor = void 0;
|
|
13
|
+
const crypto_1 = require("crypto");
|
|
14
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
15
|
+
const stories_1 = require("./stories");
|
|
16
|
+
const getGraphDatabaseExecuteOpenCypherQueryActionProcessor = (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
return ({
|
|
18
|
+
[quidproquo_core_1.GraphDatabaseActionType.ExecuteOpenCypherQuery]: (0, quidproquo_core_1.getProcessCustomImplementation)(qpqConfig, stories_1.askRunNeo4jOpenCypherQuery, 'Neo4j Cypher Query', null, () => new Date().toISOString(), crypto_1.randomUUID),
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
exports.getGraphDatabaseExecuteOpenCypherQueryActionProcessor = getGraphDatabaseExecuteOpenCypherQueryActionProcessor;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getGraphDatabaseActionProcessor = void 0;
|
|
13
|
+
const getGraphDatabaseExecuteOpenCypherQueryActionProcessor_1 = require("./getGraphDatabaseExecuteOpenCypherQueryActionProcessor");
|
|
14
|
+
const getGraphDatabaseActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
return (Object.assign({}, (yield (0, getGraphDatabaseExecuteOpenCypherQueryActionProcessor_1.getGraphDatabaseExecuteOpenCypherQueryActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
16
|
+
});
|
|
17
|
+
exports.getGraphDatabaseActionProcessor = getGraphDatabaseActionProcessor;
|
package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/askRunNeo4jOpenCypherQuery.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AskResponse, GraphCypherResponse, GraphDatabaseExecuteOpenCypherQueryActionPayload } from 'quidproquo-core';
|
|
2
|
+
export declare function askRunNeo4jOpenCypherQuery({ graphDatabaseName, openCypherQuery, params, }: GraphDatabaseExecuteOpenCypherQueryActionPayload): AskResponse<GraphCypherResponse>;
|
package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/askRunNeo4jOpenCypherQuery.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askRunNeo4jOpenCypherQuery = void 0;
|
|
4
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
+
const converters_1 = require("./converters");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
function* askRunNeo4jOpenCypherQuery({ graphDatabaseName, openCypherQuery, params, }) {
|
|
8
|
+
// Convert qpq functions to neo4j
|
|
9
|
+
const neo4jQuery = (0, utils_1.convertQpqQueryToNeo4j)(openCypherQuery);
|
|
10
|
+
// Get the neo4j instance name
|
|
11
|
+
const instanceName = yield* (0, quidproquo_core_1.askConfigGetParameter)(`neo4j-${graphDatabaseName}-instance`);
|
|
12
|
+
// Get password
|
|
13
|
+
const password = yield* (0, quidproquo_core_1.askConfigGetSecret)(`neo4j-${graphDatabaseName}-password`);
|
|
14
|
+
const response = yield* (0, quidproquo_core_1.askNetworkRequest)('POST', `HTTPS://${instanceName}.databases.neo4j.io:443/db/neo4j/query/v2`, {
|
|
15
|
+
body: {
|
|
16
|
+
statement: neo4jQuery,
|
|
17
|
+
parameters: params,
|
|
18
|
+
},
|
|
19
|
+
headers: {
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
Accept: 'application/json',
|
|
22
|
+
Authorization: `Basic ${Buffer.from(`neo4j:${password}`).toString('base64')}`,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
if (response.status < 200 || response.status >= 300) {
|
|
26
|
+
return yield* (0, quidproquo_core_1.askThrowError)(quidproquo_core_1.ErrorTypeEnum.GenericError, 'Unable to query database');
|
|
27
|
+
}
|
|
28
|
+
return yield* (0, converters_1.askConvertNeo4jCypherResponseToCypherResponse)(response.data);
|
|
29
|
+
}
|
|
30
|
+
exports.askRunNeo4jOpenCypherQuery = askRunNeo4jOpenCypherQuery;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askConvertAnyNeo4jResultToAnyGraphResult = void 0;
|
|
4
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
+
const askConvertNeo4jNodeResultToGraphNodeResult_1 = require("./askConvertNeo4jNodeResultToGraphNodeResult");
|
|
6
|
+
const askConvertNeo4jRelationshipResultToGraphRelationshipResult_1 = require("./askConvertNeo4jRelationshipResultToGraphRelationshipResult");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
function* askConvertAnyNeo4jResultToAnyGraphResult(anyNeo4jResult) {
|
|
9
|
+
if ((0, utils_1.isNeo4jScalarResult)(anyNeo4jResult)) {
|
|
10
|
+
return anyNeo4jResult;
|
|
11
|
+
}
|
|
12
|
+
if ((0, utils_1.isNeo4jNodeResult)(anyNeo4jResult)) {
|
|
13
|
+
return yield* (0, askConvertNeo4jNodeResultToGraphNodeResult_1.askConvertNeo4jNodeResultToGraphNodeResult)(anyNeo4jResult);
|
|
14
|
+
}
|
|
15
|
+
if ((0, utils_1.isNeo4jRelationshipResult)(anyNeo4jResult)) {
|
|
16
|
+
return yield* (0, askConvertNeo4jRelationshipResultToGraphRelationshipResult_1.askConvertNeo4jRelationshipResultToGraphRelationshipResult)(anyNeo4jResult);
|
|
17
|
+
}
|
|
18
|
+
return yield* (0, quidproquo_core_1.askThrowError)(quidproquo_core_1.ErrorTypeEnum.GenericError, 'Unable to convert neptune query result');
|
|
19
|
+
}
|
|
20
|
+
exports.askConvertAnyNeo4jResultToAnyGraphResult = askConvertAnyNeo4jResultToAnyGraphResult;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askConvertNeo4jCypherResponseToCypherResponse = void 0;
|
|
4
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
+
const askConvertAnyNeo4jResultToAnyGraphResult_1 = require("./askConvertAnyNeo4jResultToAnyGraphResult");
|
|
6
|
+
function* askConvertNeo4jCypherResponseToCypherResponse(neo4jCypherResponse) {
|
|
7
|
+
const results = yield* (0, quidproquo_core_1.askMap)(neo4jCypherResponse.data.values, function* askConvertValuesToGraphQueryResult(values) {
|
|
8
|
+
const graphQueryResult = yield* (0, quidproquo_core_1.askReduce)(values, {}, function* askCombineAnyNeo4jResultIntoGraphQueryResult(acc, value, index) {
|
|
9
|
+
return Object.assign(Object.assign({}, acc), { [neo4jCypherResponse.data.fields[index]]: yield* (0, askConvertAnyNeo4jResultToAnyGraphResult_1.askConvertAnyNeo4jResultToAnyGraphResult)(value) });
|
|
10
|
+
});
|
|
11
|
+
return graphQueryResult;
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
results,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.askConvertNeo4jCypherResponseToCypherResponse = askConvertNeo4jCypherResponseToCypherResponse;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askConvertNeo4jNodeResultToGraphNodeResult = void 0;
|
|
4
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
+
function* askConvertNeo4jNodeResultToGraphNodeResult(neptuneNodeResult) {
|
|
6
|
+
return {
|
|
7
|
+
$entityType: quidproquo_core_1.GraphEntityType.Node,
|
|
8
|
+
$id: neptuneNodeResult.elementId,
|
|
9
|
+
$labels: neptuneNodeResult.labels,
|
|
10
|
+
$properties: neptuneNodeResult.properties,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.askConvertNeo4jNodeResultToGraphNodeResult = askConvertNeo4jNodeResultToGraphNodeResult;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AskResponse, GraphRelationshipResult } from 'quidproquo-core';
|
|
2
|
+
import { Neo4jRelationshipResult } from '../types';
|
|
3
|
+
export declare function askConvertNeo4jRelationshipResultToGraphRelationshipResult(neptuneRelationshipResult: Neo4jRelationshipResult): AskResponse<GraphRelationshipResult>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askConvertNeo4jRelationshipResultToGraphRelationshipResult = void 0;
|
|
4
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
+
function* askConvertNeo4jRelationshipResultToGraphRelationshipResult(neptuneRelationshipResult) {
|
|
6
|
+
return {
|
|
7
|
+
$entityType: quidproquo_core_1.GraphEntityType.Relationship,
|
|
8
|
+
$id: neptuneRelationshipResult.elementId,
|
|
9
|
+
$start: neptuneRelationshipResult.startNodeElementId,
|
|
10
|
+
$end: neptuneRelationshipResult.endNodeElementId,
|
|
11
|
+
$type: neptuneRelationshipResult.type,
|
|
12
|
+
$properties: neptuneRelationshipResult.properties,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.askConvertNeo4jRelationshipResultToGraphRelationshipResult = askConvertNeo4jRelationshipResultToGraphRelationshipResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './askConvertNeo4jCypherResponseToCypherResponse';
|
|
@@ -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("./askConvertNeo4jCypherResponseToCypherResponse"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./isNeo4jNodeResult"), exports);
|
|
18
|
+
__exportStar(require("./isNeo4jRelationshipResult"), exports);
|
|
19
|
+
__exportStar(require("./isNeo4jScalarResult"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNeo4jNodeResult = void 0;
|
|
4
|
+
function isNeo4jNodeResult(anyNeo4jResult) {
|
|
5
|
+
// Must be a scaler
|
|
6
|
+
if (typeof anyNeo4jResult !== 'object') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
// must be a relationship
|
|
10
|
+
if (anyNeo4jResult.startNodeElementId) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
exports.isNeo4jNodeResult = isNeo4jNodeResult;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNeo4jRelationshipResult = void 0;
|
|
4
|
+
function isNeo4jRelationshipResult(anyNeo4jResult) {
|
|
5
|
+
// Must be a scaler
|
|
6
|
+
if (typeof anyNeo4jResult !== 'object') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
// must be a relationship
|
|
10
|
+
if (anyNeo4jResult.startNodeElementId) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
exports.isNeo4jRelationshipResult = isNeo4jRelationshipResult;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNeo4jScalarResult = void 0;
|
|
4
|
+
function isNeo4jScalarResult(anyNeo4jResult) {
|
|
5
|
+
return typeof anyNeo4jResult !== 'object' || anyNeo4jResult === null;
|
|
6
|
+
}
|
|
7
|
+
exports.isNeo4jScalarResult = isNeo4jScalarResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './askRunNeo4jOpenCypherQuery';
|
|
@@ -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("./askRunNeo4jOpenCypherQuery"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './neo4j';
|
|
@@ -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("./neo4j"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface Neo4jGraphEntity {
|
|
2
|
+
elementId: string;
|
|
3
|
+
properties: Record<string, any>;
|
|
4
|
+
}
|
|
5
|
+
export interface Neo4jNodeResult extends Neo4jGraphEntity {
|
|
6
|
+
labels: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface Neo4jRelationshipResult extends Neo4jGraphEntity {
|
|
9
|
+
startNodeElementId: string;
|
|
10
|
+
endNodeElementId: string;
|
|
11
|
+
type: string;
|
|
12
|
+
}
|
|
13
|
+
export type Neo4jScalarResult = number | string | boolean | null;
|
|
14
|
+
export type AnyNeo4jResult = Neo4jNodeResult | Neo4jRelationshipResult | Neo4jScalarResult;
|
|
15
|
+
export interface Neo4jNotification {
|
|
16
|
+
code: string;
|
|
17
|
+
description: string;
|
|
18
|
+
severity: 'WARNING' | 'ERROR';
|
|
19
|
+
title: string;
|
|
20
|
+
position: {
|
|
21
|
+
offset: number;
|
|
22
|
+
line: number;
|
|
23
|
+
column: number;
|
|
24
|
+
};
|
|
25
|
+
category: string;
|
|
26
|
+
}
|
|
27
|
+
export interface Neo4jCypherRequest {
|
|
28
|
+
statement: string;
|
|
29
|
+
parameters?: Record<string, any>;
|
|
30
|
+
}
|
|
31
|
+
export interface Neo4jCypherResponse {
|
|
32
|
+
data: {
|
|
33
|
+
fields: string[];
|
|
34
|
+
values: AnyNeo4jResult[][];
|
|
35
|
+
};
|
|
36
|
+
notifications?: Neo4jNotification[];
|
|
37
|
+
bookmarks?: string[];
|
|
38
|
+
}
|
package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/utils/convertQpqQueryToNeo4j.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function convertQpqQueryToNeo4j(query: string): string;
|
package/lib/commonjs/actionProcessor/graphDatabaseOverride/stories/utils/convertQpqQueryToNeo4j.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertQpqQueryToNeo4j = void 0;
|
|
4
|
+
// Neo4j version: Replace qpqElementId(n) with elementId(n)
|
|
5
|
+
function convertQpqQueryToNeo4j(query) {
|
|
6
|
+
return query.replace(/qpqElementId\((.*?)\)/g, 'elementId($1)');
|
|
7
|
+
}
|
|
8
|
+
exports.convertQpqQueryToNeo4j = convertQpqQueryToNeo4j;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './convertQpqQueryToNeo4j';
|
|
@@ -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("./convertQpqQueryToNeo4j"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './settings';
|
|
@@ -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("./settings"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.defineGraphDatabaseNeo4j = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
9
|
+
// export interface QPQConfigAdvancedGraphDatabaseNeo4jSettings extends QPQConfigAdvancedSettings {
|
|
10
|
+
// owner?: CrossModuleOwner<'graphDatabaseName'>;
|
|
11
|
+
// }
|
|
12
|
+
// export interface GraphDatabaseNeo4jQPQConfigSetting extends QPQConfigSetting {
|
|
13
|
+
// name: string;
|
|
14
|
+
// }
|
|
15
|
+
const defineGraphDatabaseNeo4j = (databaseName) => [
|
|
16
|
+
(0, quidproquo_core_1.defineParameter)(`neo4j-${databaseName}-instance`),
|
|
17
|
+
(0, quidproquo_core_1.defineSecret)(`neo4j-${databaseName}-password`),
|
|
18
|
+
(0, quidproquo_core_1.defineActionProcessors)(`full@${path_1.default.join(__dirname, '../../../actionProcessor/graphDatabaseOverride')}::getGraphDatabaseActionProcessor`),
|
|
19
|
+
];
|
|
20
|
+
exports.defineGraphDatabaseNeo4j = defineGraphDatabaseNeo4j;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './defineGraphDatabaseNeo4j';
|
|
@@ -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("./defineGraphDatabaseNeo4j"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './graphDatabaseNeo4j';
|
|
@@ -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("./graphDatabaseNeo4j"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tmp: () => number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { randomUUID } from 'crypto';
|
|
2
|
+
import { getProcessCustomImplementation, GraphDatabaseActionType, } from 'quidproquo-core';
|
|
3
|
+
import { askRunNeo4jOpenCypherQuery } from './stories';
|
|
4
|
+
export const getGraphDatabaseExecuteOpenCypherQueryActionProcessor = async (qpqConfig) => ({
|
|
5
|
+
[GraphDatabaseActionType.ExecuteOpenCypherQuery]: getProcessCustomImplementation(qpqConfig, askRunNeo4jOpenCypherQuery, 'Neo4j Cypher Query', null, () => new Date().toISOString(), randomUUID),
|
|
6
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { getGraphDatabaseExecuteOpenCypherQueryActionProcessor } from './getGraphDatabaseExecuteOpenCypherQueryActionProcessor';
|
|
2
|
+
export const getGraphDatabaseActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
+
...(await getGraphDatabaseExecuteOpenCypherQueryActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AskResponse, GraphCypherResponse, GraphDatabaseExecuteOpenCypherQueryActionPayload } from 'quidproquo-core';
|
|
2
|
+
export declare function askRunNeo4jOpenCypherQuery({ graphDatabaseName, openCypherQuery, params, }: GraphDatabaseExecuteOpenCypherQueryActionPayload): AskResponse<GraphCypherResponse>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { askConfigGetParameter, askConfigGetSecret, askNetworkRequest, askThrowError, ErrorTypeEnum, } from 'quidproquo-core';
|
|
2
|
+
import { askConvertNeo4jCypherResponseToCypherResponse } from './converters';
|
|
3
|
+
import { convertQpqQueryToNeo4j } from './utils';
|
|
4
|
+
export function* askRunNeo4jOpenCypherQuery({ graphDatabaseName, openCypherQuery, params, }) {
|
|
5
|
+
// Convert qpq functions to neo4j
|
|
6
|
+
const neo4jQuery = convertQpqQueryToNeo4j(openCypherQuery);
|
|
7
|
+
// Get the neo4j instance name
|
|
8
|
+
const instanceName = yield* askConfigGetParameter(`neo4j-${graphDatabaseName}-instance`);
|
|
9
|
+
// Get password
|
|
10
|
+
const password = yield* askConfigGetSecret(`neo4j-${graphDatabaseName}-password`);
|
|
11
|
+
const response = yield* askNetworkRequest('POST', `HTTPS://${instanceName}.databases.neo4j.io:443/db/neo4j/query/v2`, {
|
|
12
|
+
body: {
|
|
13
|
+
statement: neo4jQuery,
|
|
14
|
+
parameters: params,
|
|
15
|
+
},
|
|
16
|
+
headers: {
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
Accept: 'application/json',
|
|
19
|
+
Authorization: `Basic ${Buffer.from(`neo4j:${password}`).toString('base64')}`,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
if (response.status < 200 || response.status >= 300) {
|
|
23
|
+
return yield* askThrowError(ErrorTypeEnum.GenericError, 'Unable to query database');
|
|
24
|
+
}
|
|
25
|
+
return yield* askConvertNeo4jCypherResponseToCypherResponse(response.data);
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { askThrowError, ErrorTypeEnum } from 'quidproquo-core';
|
|
2
|
+
import { askConvertNeo4jNodeResultToGraphNodeResult } from './askConvertNeo4jNodeResultToGraphNodeResult';
|
|
3
|
+
import { askConvertNeo4jRelationshipResultToGraphRelationshipResult } from './askConvertNeo4jRelationshipResultToGraphRelationshipResult';
|
|
4
|
+
import { isNeo4jNodeResult, isNeo4jRelationshipResult, isNeo4jScalarResult } from './utils';
|
|
5
|
+
export function* askConvertAnyNeo4jResultToAnyGraphResult(anyNeo4jResult) {
|
|
6
|
+
if (isNeo4jScalarResult(anyNeo4jResult)) {
|
|
7
|
+
return anyNeo4jResult;
|
|
8
|
+
}
|
|
9
|
+
if (isNeo4jNodeResult(anyNeo4jResult)) {
|
|
10
|
+
return yield* askConvertNeo4jNodeResultToGraphNodeResult(anyNeo4jResult);
|
|
11
|
+
}
|
|
12
|
+
if (isNeo4jRelationshipResult(anyNeo4jResult)) {
|
|
13
|
+
return yield* askConvertNeo4jRelationshipResultToGraphRelationshipResult(anyNeo4jResult);
|
|
14
|
+
}
|
|
15
|
+
return yield* askThrowError(ErrorTypeEnum.GenericError, 'Unable to convert neptune query result');
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { askMap, askReduce } from 'quidproquo-core';
|
|
2
|
+
import { askConvertAnyNeo4jResultToAnyGraphResult } from './askConvertAnyNeo4jResultToAnyGraphResult';
|
|
3
|
+
export function* askConvertNeo4jCypherResponseToCypherResponse(neo4jCypherResponse) {
|
|
4
|
+
const results = yield* askMap(neo4jCypherResponse.data.values, function* askConvertValuesToGraphQueryResult(values) {
|
|
5
|
+
const graphQueryResult = yield* askReduce(values, {}, function* askCombineAnyNeo4jResultIntoGraphQueryResult(acc, value, index) {
|
|
6
|
+
return {
|
|
7
|
+
...acc,
|
|
8
|
+
[neo4jCypherResponse.data.fields[index]]: yield* askConvertAnyNeo4jResultToAnyGraphResult(value),
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
return graphQueryResult;
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
results,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GraphEntityType } from 'quidproquo-core';
|
|
2
|
+
export function* askConvertNeo4jNodeResultToGraphNodeResult(neptuneNodeResult) {
|
|
3
|
+
return {
|
|
4
|
+
$entityType: GraphEntityType.Node,
|
|
5
|
+
$id: neptuneNodeResult.elementId,
|
|
6
|
+
$labels: neptuneNodeResult.labels,
|
|
7
|
+
$properties: neptuneNodeResult.properties,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AskResponse, GraphRelationshipResult } from 'quidproquo-core';
|
|
2
|
+
import { Neo4jRelationshipResult } from '../types';
|
|
3
|
+
export declare function askConvertNeo4jRelationshipResultToGraphRelationshipResult(neptuneRelationshipResult: Neo4jRelationshipResult): AskResponse<GraphRelationshipResult>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GraphEntityType } from 'quidproquo-core';
|
|
2
|
+
export function* askConvertNeo4jRelationshipResultToGraphRelationshipResult(neptuneRelationshipResult) {
|
|
3
|
+
return {
|
|
4
|
+
$entityType: GraphEntityType.Relationship,
|
|
5
|
+
$id: neptuneRelationshipResult.elementId,
|
|
6
|
+
$start: neptuneRelationshipResult.startNodeElementId,
|
|
7
|
+
$end: neptuneRelationshipResult.endNodeElementId,
|
|
8
|
+
$type: neptuneRelationshipResult.type,
|
|
9
|
+
$properties: neptuneRelationshipResult.properties,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './askConvertNeo4jCypherResponseToCypherResponse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './askConvertNeo4jCypherResponseToCypherResponse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './askRunNeo4jOpenCypherQuery';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './askRunNeo4jOpenCypherQuery';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './neo4j';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './neo4j';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface Neo4jGraphEntity {
|
|
2
|
+
elementId: string;
|
|
3
|
+
properties: Record<string, any>;
|
|
4
|
+
}
|
|
5
|
+
export interface Neo4jNodeResult extends Neo4jGraphEntity {
|
|
6
|
+
labels: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface Neo4jRelationshipResult extends Neo4jGraphEntity {
|
|
9
|
+
startNodeElementId: string;
|
|
10
|
+
endNodeElementId: string;
|
|
11
|
+
type: string;
|
|
12
|
+
}
|
|
13
|
+
export type Neo4jScalarResult = number | string | boolean | null;
|
|
14
|
+
export type AnyNeo4jResult = Neo4jNodeResult | Neo4jRelationshipResult | Neo4jScalarResult;
|
|
15
|
+
export interface Neo4jNotification {
|
|
16
|
+
code: string;
|
|
17
|
+
description: string;
|
|
18
|
+
severity: 'WARNING' | 'ERROR';
|
|
19
|
+
title: string;
|
|
20
|
+
position: {
|
|
21
|
+
offset: number;
|
|
22
|
+
line: number;
|
|
23
|
+
column: number;
|
|
24
|
+
};
|
|
25
|
+
category: string;
|
|
26
|
+
}
|
|
27
|
+
export interface Neo4jCypherRequest {
|
|
28
|
+
statement: string;
|
|
29
|
+
parameters?: Record<string, any>;
|
|
30
|
+
}
|
|
31
|
+
export interface Neo4jCypherResponse {
|
|
32
|
+
data: {
|
|
33
|
+
fields: string[];
|
|
34
|
+
values: AnyNeo4jResult[][];
|
|
35
|
+
};
|
|
36
|
+
notifications?: Neo4jNotification[];
|
|
37
|
+
bookmarks?: string[];
|
|
38
|
+
}
|
package/lib/esm/actionProcessor/graphDatabaseOverride/stories/utils/convertQpqQueryToNeo4j.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function convertQpqQueryToNeo4j(query: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './convertQpqQueryToNeo4j';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './convertQpqQueryToNeo4j';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './settings';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './settings';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { defineActionProcessors, defineParameter, defineSecret } from 'quidproquo-core';
|
|
3
|
+
// export interface QPQConfigAdvancedGraphDatabaseNeo4jSettings extends QPQConfigAdvancedSettings {
|
|
4
|
+
// owner?: CrossModuleOwner<'graphDatabaseName'>;
|
|
5
|
+
// }
|
|
6
|
+
// export interface GraphDatabaseNeo4jQPQConfigSetting extends QPQConfigSetting {
|
|
7
|
+
// name: string;
|
|
8
|
+
// }
|
|
9
|
+
export const defineGraphDatabaseNeo4j = (databaseName) => [
|
|
10
|
+
defineParameter(`neo4j-${databaseName}-instance`),
|
|
11
|
+
defineSecret(`neo4j-${databaseName}-password`),
|
|
12
|
+
defineActionProcessors(`full@${path.join(__dirname, '../../../actionProcessor/graphDatabaseOverride')}::getGraphDatabaseActionProcessor`),
|
|
13
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './defineGraphDatabaseNeo4j';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './defineGraphDatabaseNeo4j';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './graphDatabaseNeo4j';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './graphDatabaseNeo4j';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tmp: () => number;
|
package/lib/esm/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "quidproquo-neo4j",
|
|
3
|
+
"version": "0.0.230",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./lib/commonjs/index.js",
|
|
6
|
+
"module": "./lib/esm/index.js",
|
|
7
|
+
"types": "./lib/commonjs/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"files": [
|
|
10
|
+
"lib/**/*"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
+
"clean": "npx rimraf lib && npx rimraf node_modules",
|
|
15
|
+
"build": "npm run clean && npm run build:esm && npm run build:cjs",
|
|
16
|
+
"watch": "tsc -p tsconfig.commonjs.json -w",
|
|
17
|
+
"build:cjs": "tsc -p tsconfig.commonjs.json",
|
|
18
|
+
"build:esm": "tsc -p tsconfig.esm.json"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/joe-coady/quidproquo.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [],
|
|
25
|
+
"author": "",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/joe-coady/quidproquo/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/joe-coady/quidproquo#readme",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"quidproquo-tsconfig": "0.0.230",
|
|
33
|
+
"typescript": "^4.9.3"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@anthropic-ai/sdk": "^0.19.1",
|
|
37
|
+
"quidproquo-core": "0.0.230",
|
|
38
|
+
"upath": "^2.0.1"
|
|
39
|
+
}
|
|
40
|
+
}
|