dbgate-rest 7.1.3-alpha.2 → 7.1.4-alpha.2
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 +7 -7
- package/lib/arrayify.d.ts +3 -3
- package/lib/arrayify.js +81 -81
- package/lib/graphQlDriver.d.ts +2 -2
- package/lib/graphQlDriver.js +55 -55
- package/lib/graphQlQueryParser.d.ts +5 -5
- package/lib/graphQlQueryParser.js +204 -204
- package/lib/graphQlVariables.d.ts +6 -6
- package/lib/graphQlVariables.js +123 -123
- package/lib/graphqlExplorer.d.ts +26 -26
- package/lib/graphqlExplorer.js +125 -125
- package/lib/graphqlIntrospection.d.ts +56 -56
- package/lib/graphqlIntrospection.js +409 -409
- package/lib/index.d.ts +13 -13
- package/lib/index.js +29 -29
- package/lib/oDataAdapter.d.ts +33 -33
- package/lib/oDataAdapter.js +358 -358
- package/lib/oDataAdapter.test.d.ts +2 -2
- package/lib/oDataAdapter.test.js +61 -61
- package/lib/oDataDriver.d.ts +2 -2
- package/lib/oDataDriver.js +85 -85
- package/lib/oDataMetadataParser.d.ts +2 -2
- package/lib/oDataMetadataParser.js +137 -137
- package/lib/openApiAdapter.d.ts +7 -7
- package/lib/openApiAdapter.js +254 -254
- package/lib/openApiDriver.d.ts +2 -2
- package/lib/openApiDriver.js +90 -90
- package/lib/restApiDef.d.ts +55 -55
- package/lib/restApiDef.js +2 -2
- package/lib/restApiExecutor.d.ts +4 -4
- package/lib/restApiExecutor.js +292 -292
- package/lib/restApiExecutor.test.d.ts +16 -16
- package/lib/restApiExecutor.test.js +99 -99
- package/lib/restAuthTools.d.ts +2 -2
- package/lib/restAuthTools.js +20 -20
- package/lib/restDriverBase.d.ts +61 -61
- package/lib/restDriverBase.js +60 -49
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# dbgate-rest
|
|
2
|
-
|
|
3
|
-
REST API support for DbGate
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
yarn add dbgate-rest
|
|
1
|
+
# dbgate-rest
|
|
2
|
+
|
|
3
|
+
REST API support for DbGate
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
yarn add dbgate-rest
|
package/lib/arrayify.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
type FlatObject = Record<string, any>;
|
|
2
|
-
export declare function arrayifyToFlatObjects(input: any): FlatObject[] | undefined;
|
|
3
|
-
export {};
|
|
1
|
+
type FlatObject = Record<string, any>;
|
|
2
|
+
export declare function arrayifyToFlatObjects(input: any): FlatObject[] | undefined;
|
|
3
|
+
export {};
|
package/lib/arrayify.js
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arrayifyToFlatObjects = void 0;
|
|
4
|
-
function isPlainObject(value) {
|
|
5
|
-
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
6
|
-
}
|
|
7
|
-
function flattenValue(value) {
|
|
8
|
-
if (Array.isArray(value)) {
|
|
9
|
-
const primitiveArray = value.every(item => item == null || typeof item !== 'object');
|
|
10
|
-
if (primitiveArray) {
|
|
11
|
-
return value.join(', ');
|
|
12
|
-
}
|
|
13
|
-
return JSON.stringify(value);
|
|
14
|
-
}
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
function flattenObject(obj, prefix = '', out = {}, visited = new WeakSet()) {
|
|
18
|
-
if (visited.has(obj))
|
|
19
|
-
return out;
|
|
20
|
-
visited.add(obj);
|
|
21
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
22
|
-
const nextKey = prefix ? `${prefix}.${key}` : key;
|
|
23
|
-
if (isPlainObject(value)) {
|
|
24
|
-
flattenObject(value, nextKey, out, visited);
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
out[nextKey] = flattenValue(value);
|
|
28
|
-
}
|
|
29
|
-
return out;
|
|
30
|
-
}
|
|
31
|
-
function unwrapArrayItem(item) {
|
|
32
|
-
if (isPlainObject(item) && isPlainObject(item.node)) {
|
|
33
|
-
return item.node;
|
|
34
|
-
}
|
|
35
|
-
return item;
|
|
36
|
-
}
|
|
37
|
-
function collectArrayCandidates(value, set, visited = new WeakSet(), depth = 0) {
|
|
38
|
-
if (depth > 10)
|
|
39
|
-
return;
|
|
40
|
-
if (Array.isArray(value)) {
|
|
41
|
-
set.add(value);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (!isPlainObject(value))
|
|
45
|
-
return;
|
|
46
|
-
if (visited.has(value))
|
|
47
|
-
return;
|
|
48
|
-
visited.add(value);
|
|
49
|
-
if (Array.isArray(value.edges))
|
|
50
|
-
set.add(value.edges);
|
|
51
|
-
if (Array.isArray(value.nodes))
|
|
52
|
-
set.add(value.nodes);
|
|
53
|
-
if (Array.isArray(value.items))
|
|
54
|
-
set.add(value.items);
|
|
55
|
-
for (const nested of Object.values(value)) {
|
|
56
|
-
collectArrayCandidates(nested, set, visited, depth + 1);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function findUniqueArrayCandidate(value) {
|
|
60
|
-
var _a;
|
|
61
|
-
if (Array.isArray(value))
|
|
62
|
-
return value;
|
|
63
|
-
const candidates = new Set();
|
|
64
|
-
collectArrayCandidates(value, candidates);
|
|
65
|
-
if (candidates.size !== 1)
|
|
66
|
-
return null;
|
|
67
|
-
return (_a = candidates.values().next().value) !== null && _a !== void 0 ? _a : null;
|
|
68
|
-
}
|
|
69
|
-
function arrayifyToFlatObjects(input) {
|
|
70
|
-
const arrayCandidate = findUniqueArrayCandidate(input);
|
|
71
|
-
if (!arrayCandidate)
|
|
72
|
-
return undefined;
|
|
73
|
-
return arrayCandidate.map(item => {
|
|
74
|
-
const unwrapped = unwrapArrayItem(item);
|
|
75
|
-
if (isPlainObject(unwrapped)) {
|
|
76
|
-
return flattenObject(unwrapped);
|
|
77
|
-
}
|
|
78
|
-
return { value: unwrapped };
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
exports.arrayifyToFlatObjects = arrayifyToFlatObjects;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayifyToFlatObjects = void 0;
|
|
4
|
+
function isPlainObject(value) {
|
|
5
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
function flattenValue(value) {
|
|
8
|
+
if (Array.isArray(value)) {
|
|
9
|
+
const primitiveArray = value.every(item => item == null || typeof item !== 'object');
|
|
10
|
+
if (primitiveArray) {
|
|
11
|
+
return value.join(', ');
|
|
12
|
+
}
|
|
13
|
+
return JSON.stringify(value);
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function flattenObject(obj, prefix = '', out = {}, visited = new WeakSet()) {
|
|
18
|
+
if (visited.has(obj))
|
|
19
|
+
return out;
|
|
20
|
+
visited.add(obj);
|
|
21
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
22
|
+
const nextKey = prefix ? `${prefix}.${key}` : key;
|
|
23
|
+
if (isPlainObject(value)) {
|
|
24
|
+
flattenObject(value, nextKey, out, visited);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
out[nextKey] = flattenValue(value);
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
function unwrapArrayItem(item) {
|
|
32
|
+
if (isPlainObject(item) && isPlainObject(item.node)) {
|
|
33
|
+
return item.node;
|
|
34
|
+
}
|
|
35
|
+
return item;
|
|
36
|
+
}
|
|
37
|
+
function collectArrayCandidates(value, set, visited = new WeakSet(), depth = 0) {
|
|
38
|
+
if (depth > 10)
|
|
39
|
+
return;
|
|
40
|
+
if (Array.isArray(value)) {
|
|
41
|
+
set.add(value);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (!isPlainObject(value))
|
|
45
|
+
return;
|
|
46
|
+
if (visited.has(value))
|
|
47
|
+
return;
|
|
48
|
+
visited.add(value);
|
|
49
|
+
if (Array.isArray(value.edges))
|
|
50
|
+
set.add(value.edges);
|
|
51
|
+
if (Array.isArray(value.nodes))
|
|
52
|
+
set.add(value.nodes);
|
|
53
|
+
if (Array.isArray(value.items))
|
|
54
|
+
set.add(value.items);
|
|
55
|
+
for (const nested of Object.values(value)) {
|
|
56
|
+
collectArrayCandidates(nested, set, visited, depth + 1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function findUniqueArrayCandidate(value) {
|
|
60
|
+
var _a;
|
|
61
|
+
if (Array.isArray(value))
|
|
62
|
+
return value;
|
|
63
|
+
const candidates = new Set();
|
|
64
|
+
collectArrayCandidates(value, candidates);
|
|
65
|
+
if (candidates.size !== 1)
|
|
66
|
+
return null;
|
|
67
|
+
return (_a = candidates.values().next().value) !== null && _a !== void 0 ? _a : null;
|
|
68
|
+
}
|
|
69
|
+
function arrayifyToFlatObjects(input) {
|
|
70
|
+
const arrayCandidate = findUniqueArrayCandidate(input);
|
|
71
|
+
if (!arrayCandidate)
|
|
72
|
+
return undefined;
|
|
73
|
+
return arrayCandidate.map(item => {
|
|
74
|
+
const unwrapped = unwrapArrayItem(item);
|
|
75
|
+
if (isPlainObject(unwrapped)) {
|
|
76
|
+
return flattenObject(unwrapped);
|
|
77
|
+
}
|
|
78
|
+
return { value: unwrapped };
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
exports.arrayifyToFlatObjects = arrayifyToFlatObjects;
|
package/lib/graphQlDriver.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { EngineDriver } from 'dbgate-types';
|
|
2
|
-
export declare const graphQlDriver: EngineDriver;
|
|
1
|
+
import type { EngineDriver } from 'dbgate-types';
|
|
2
|
+
export declare const graphQlDriver: EngineDriver;
|
package/lib/graphQlDriver.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.graphQlDriver = void 0;
|
|
4
|
-
const graphqlIntrospection_1 = require("./graphqlIntrospection");
|
|
5
|
-
const restDriverBase_1 = require("./restDriverBase");
|
|
6
|
-
const restAuthTools_1 = require("./restAuthTools");
|
|
7
|
-
async function loadGraphQlSchema(dbhan) {
|
|
8
|
-
var _a;
|
|
9
|
-
if (!((_a = dbhan === null || dbhan === void 0 ? void 0 : dbhan.connection) === null || _a === void 0 ? void 0 : _a.apiServerUrl1)) {
|
|
10
|
-
throw new Error('DBGM-00310 GraphQL endpoint URL is not configured');
|
|
11
|
-
}
|
|
12
|
-
const introspectionResult = await (0, graphqlIntrospection_1.fetchGraphQLSchema)(dbhan.connection.apiServerUrl1, (0, restAuthTools_1.buildRestAuthHeaders)(dbhan.connection.restAuth), dbhan.axios);
|
|
13
|
-
if (!introspectionResult || typeof introspectionResult !== 'object') {
|
|
14
|
-
throw new Error('DBGM-00311 GraphQL schema is empty or could not be loaded');
|
|
15
|
-
}
|
|
16
|
-
return introspectionResult;
|
|
17
|
-
}
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
exports.graphQlDriver = {
|
|
20
|
-
...restDriverBase_1.apiDriverBase,
|
|
21
|
-
engine: 'graphql@rest',
|
|
22
|
-
title: 'GraphQL',
|
|
23
|
-
databaseEngineTypes: ['rest', 'graphql'],
|
|
24
|
-
icon: '<svg version="1.1" id="GraphQL_Logo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 400 400" enable-background="new 0 0 400 400" xml:space="preserve"><g><g><g><rect x="122" y="-0.4" transform="matrix(-0.866 -0.5 0.5 -0.866 163.3196 363.3136)" fill="#E535AB" width="16.6" height="320.3"/></g></g><g><g><rect x="39.8" y="272.2" fill="#E535AB" width="320.3" height="16.6"/></g></g><g><g><rect x="37.9" y="312.2" transform="matrix(-0.866 -0.5 0.5 -0.866 83.0693 663.3409)" fill="#E535AB" width="185" height="16.6"/></g></g><g><g><rect x="177.1" y="71.1" transform="matrix(-0.866 -0.5 0.5 -0.866 463.3409 283.0693)" fill="#E535AB" width="185" height="16.6"/></g></g><g><g><rect x="122.1" y="-13" transform="matrix(-0.5 -0.866 0.866 -0.5 126.7903 232.1221)" fill="#E535AB" width="16.6" height="185"/></g></g><g><g><rect x="109.6" y="151.6" transform="matrix(-0.5 -0.866 0.866 -0.5 266.0828 473.3766)" fill="#E535AB" width="320.3" height="16.6"/></g></g><g><g><rect x="52.5" y="107.5" fill="#E535AB" width="16.6" height="185"/></g></g><g><g><rect x="330.9" y="107.5" fill="#E535AB" width="16.6" height="185"/></g></g><g><g><rect x="262.4" y="240.1" transform="matrix(-0.5 -0.866 0.866 -0.5 126.7953 714.2875)" fill="#E535AB" width="14.5" height="160.9"/></g></g><path fill="#E535AB" d="M369.5,297.9c-9.6,16.7-31,22.4-47.7,12.8c-16.7-9.6-22.4-31-12.8-47.7c9.6-16.7,31-22.4,47.7-12.8 C373.5,259.9,379.2,281.2,369.5,297.9"/><path fill="#E535AB" d="M90.9,137c-9.6,16.7-31,22.4-47.7,12.8c-16.7-9.6-22.4-31-12.8-47.7c9.6-16.7,31-22.4,47.7-12.8 C94.8,99,100.5,120.3,90.9,137"/><path fill="#E535AB" d="M30.5,297.9c-9.6-16.7-3.9-38,12.8-47.7c16.7-9.6,38-3.9,47.7,12.8c9.6,16.7,3.9,38-12.8,47.7 C61.4,320.3,40.1,314.6,30.5,297.9"/><path fill="#E535AB" d="M309.1,137c-9.6-16.7-3.9-38,12.8-47.7c16.7-9.6,38-3.9,47.7,12.8c9.6-16.7,3.9-38-12.8,47.7 C340.1,159.4,318.7,153.7,309.1,137"/><path fill="#E535AB" d="M200,395.8c-19.3,0-34.9-15.6-34.9-34.9c0-19.3,15.6-34.9,34.9-34.9c19.3,0,34.9,15.6,34.9,34.9 C234.9,380.1,219.3,395.8,200,395.8"/><path fill="#E535AB" d="M200,74c-19.3,0-34.9-15.6-34.9-34.9c0-19.3,15.6-34.9,34.9-34.9c19.3,0,34.9,15.6,34.9,34.9 C234.9,58.4,219.3,74,200,74"/></g></svg>',
|
|
25
|
-
showConnectionField: (field, values) => {
|
|
26
|
-
if (restDriverBase_1.apiDriverBase.
|
|
27
|
-
return true;
|
|
28
|
-
if (field === 'apiServerUrl1')
|
|
29
|
-
return true;
|
|
30
|
-
return false;
|
|
31
|
-
},
|
|
32
|
-
apiServerUrl1Label: 'GraphQL Endpoint URL',
|
|
33
|
-
beforeConnectionSave: connection => ({
|
|
34
|
-
...connection,
|
|
35
|
-
singleDatabase: true,
|
|
36
|
-
defaultDatabase: '_api_database_',
|
|
37
|
-
}),
|
|
38
|
-
async connect(connection) {
|
|
39
|
-
return {
|
|
40
|
-
connection,
|
|
41
|
-
client: null,
|
|
42
|
-
database: '_api_database_',
|
|
43
|
-
axios: connection.axios,
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
async getVersion(dbhan) {
|
|
47
|
-
var _a;
|
|
48
|
-
const introspectionResult = await loadGraphQlSchema(dbhan);
|
|
49
|
-
const schema = introspectionResult.__schema;
|
|
50
|
-
// const version = 'GraphQL';
|
|
51
|
-
return {
|
|
52
|
-
version: `GraphQL, ${((_a = schema.types) === null || _a === void 0 ? void 0 : _a.length) || 0} types`,
|
|
53
|
-
};
|
|
54
|
-
},
|
|
55
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.graphQlDriver = void 0;
|
|
4
|
+
const graphqlIntrospection_1 = require("./graphqlIntrospection");
|
|
5
|
+
const restDriverBase_1 = require("./restDriverBase");
|
|
6
|
+
const restAuthTools_1 = require("./restAuthTools");
|
|
7
|
+
async function loadGraphQlSchema(dbhan) {
|
|
8
|
+
var _a;
|
|
9
|
+
if (!((_a = dbhan === null || dbhan === void 0 ? void 0 : dbhan.connection) === null || _a === void 0 ? void 0 : _a.apiServerUrl1)) {
|
|
10
|
+
throw new Error('DBGM-00310 GraphQL endpoint URL is not configured');
|
|
11
|
+
}
|
|
12
|
+
const introspectionResult = await (0, graphqlIntrospection_1.fetchGraphQLSchema)(dbhan.connection.apiServerUrl1, (0, restAuthTools_1.buildRestAuthHeaders)(dbhan.connection.restAuth), dbhan.axios);
|
|
13
|
+
if (!introspectionResult || typeof introspectionResult !== 'object') {
|
|
14
|
+
throw new Error('DBGM-00311 GraphQL schema is empty or could not be loaded');
|
|
15
|
+
}
|
|
16
|
+
return introspectionResult;
|
|
17
|
+
}
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
exports.graphQlDriver = {
|
|
20
|
+
...restDriverBase_1.apiDriverBase,
|
|
21
|
+
engine: 'graphql@rest',
|
|
22
|
+
title: 'GraphQL',
|
|
23
|
+
databaseEngineTypes: ['rest', 'graphql'],
|
|
24
|
+
icon: '<svg version="1.1" id="GraphQL_Logo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 400 400" enable-background="new 0 0 400 400" xml:space="preserve"><g><g><g><rect x="122" y="-0.4" transform="matrix(-0.866 -0.5 0.5 -0.866 163.3196 363.3136)" fill="#E535AB" width="16.6" height="320.3"/></g></g><g><g><rect x="39.8" y="272.2" fill="#E535AB" width="320.3" height="16.6"/></g></g><g><g><rect x="37.9" y="312.2" transform="matrix(-0.866 -0.5 0.5 -0.866 83.0693 663.3409)" fill="#E535AB" width="185" height="16.6"/></g></g><g><g><rect x="177.1" y="71.1" transform="matrix(-0.866 -0.5 0.5 -0.866 463.3409 283.0693)" fill="#E535AB" width="185" height="16.6"/></g></g><g><g><rect x="122.1" y="-13" transform="matrix(-0.5 -0.866 0.866 -0.5 126.7903 232.1221)" fill="#E535AB" width="16.6" height="185"/></g></g><g><g><rect x="109.6" y="151.6" transform="matrix(-0.5 -0.866 0.866 -0.5 266.0828 473.3766)" fill="#E535AB" width="320.3" height="16.6"/></g></g><g><g><rect x="52.5" y="107.5" fill="#E535AB" width="16.6" height="185"/></g></g><g><g><rect x="330.9" y="107.5" fill="#E535AB" width="16.6" height="185"/></g></g><g><g><rect x="262.4" y="240.1" transform="matrix(-0.5 -0.866 0.866 -0.5 126.7953 714.2875)" fill="#E535AB" width="14.5" height="160.9"/></g></g><path fill="#E535AB" d="M369.5,297.9c-9.6,16.7-31,22.4-47.7,12.8c-16.7-9.6-22.4-31-12.8-47.7c9.6-16.7,31-22.4,47.7-12.8 C373.5,259.9,379.2,281.2,369.5,297.9"/><path fill="#E535AB" d="M90.9,137c-9.6,16.7-31,22.4-47.7,12.8c-16.7-9.6-22.4-31-12.8-47.7c9.6-16.7,31-22.4,47.7-12.8 C94.8,99,100.5,120.3,90.9,137"/><path fill="#E535AB" d="M30.5,297.9c-9.6-16.7-3.9-38,12.8-47.7c16.7-9.6,38-3.9,47.7,12.8c9.6,16.7,3.9,38-12.8,47.7 C61.4,320.3,40.1,314.6,30.5,297.9"/><path fill="#E535AB" d="M309.1,137c-9.6-16.7-3.9-38,12.8-47.7c16.7-9.6,38-3.9,47.7,12.8c9.6-16.7,3.9-38-12.8,47.7 C340.1,159.4,318.7,153.7,309.1,137"/><path fill="#E535AB" d="M200,395.8c-19.3,0-34.9-15.6-34.9-34.9c0-19.3,15.6-34.9,34.9-34.9c19.3,0,34.9,15.6,34.9,34.9 C234.9,380.1,219.3,395.8,200,395.8"/><path fill="#E535AB" d="M200,74c-19.3,0-34.9-15.6-34.9-34.9c0-19.3,15.6-34.9,34.9-34.9c19.3,0,34.9,15.6,34.9,34.9 C234.9,58.4,219.3,74,200,74"/></g></svg>',
|
|
25
|
+
showConnectionField: (field, values) => {
|
|
26
|
+
if (restDriverBase_1.apiDriverBase.showConnectionField(field, values))
|
|
27
|
+
return true;
|
|
28
|
+
if (field === 'apiServerUrl1')
|
|
29
|
+
return true;
|
|
30
|
+
return false;
|
|
31
|
+
},
|
|
32
|
+
apiServerUrl1Label: 'GraphQL Endpoint URL',
|
|
33
|
+
beforeConnectionSave: connection => ({
|
|
34
|
+
...connection,
|
|
35
|
+
singleDatabase: true,
|
|
36
|
+
defaultDatabase: '_api_database_',
|
|
37
|
+
}),
|
|
38
|
+
async connect(connection) {
|
|
39
|
+
return {
|
|
40
|
+
connection,
|
|
41
|
+
client: null,
|
|
42
|
+
database: '_api_database_',
|
|
43
|
+
axios: connection.axios,
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
async getVersion(dbhan) {
|
|
47
|
+
var _a;
|
|
48
|
+
const introspectionResult = await loadGraphQlSchema(dbhan);
|
|
49
|
+
const schema = introspectionResult.__schema;
|
|
50
|
+
// const version = 'GraphQL';
|
|
51
|
+
return {
|
|
52
|
+
version: `GraphQL, ${((_a = schema.types) === null || _a === void 0 ? void 0 : _a.length) || 0} types`,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function parseGraphQlSelectionPaths(text: string): {
|
|
2
|
-
fieldPaths: string[];
|
|
3
|
-
argumentPaths: string[];
|
|
4
|
-
argumentValues: Record<string, Record<string, string>>;
|
|
5
|
-
};
|
|
1
|
+
export declare function parseGraphQlSelectionPaths(text: string): {
|
|
2
|
+
fieldPaths: string[];
|
|
3
|
+
argumentPaths: string[];
|
|
4
|
+
argumentValues: Record<string, Record<string, string>>;
|
|
5
|
+
};
|