@omnigraph/raml 1.0.0-alpha-20230523154841-376b13623 → 1.0.0-alpha-20230523160518-5443a1139
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.
|
@@ -28,6 +28,7 @@ function resolveTraitsByIs(base) {
|
|
|
28
28
|
* from RAML API Document
|
|
29
29
|
*/
|
|
30
30
|
async function getJSONSchemaOptionsFromRAMLOptions({ source, cwd: ramlFileCwd = cross_helpers_1.process.cwd(), operations: extraOperations, endpoint: forcedBaseUrl, fetch = fetch_1.fetch, schemaHeaders = {}, selectQueryOrMutationField = [], }) {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f;
|
|
31
32
|
const fieldTypeMap = {};
|
|
32
33
|
for (const { fieldName, type } of selectQueryOrMutationField) {
|
|
33
34
|
fieldTypeMap[fieldName] = type;
|
|
@@ -118,8 +119,8 @@ async function getJSONSchemaOptionsFromRAMLOptions({ source, cwd: ramlFileCwd =
|
|
|
118
119
|
let requestTypeName;
|
|
119
120
|
const responseByStatusCode = {};
|
|
120
121
|
const method = methodNode.method().toUpperCase();
|
|
121
|
-
let fieldName = methodNode.displayName()
|
|
122
|
-
const description = methodNode.description()
|
|
122
|
+
let fieldName = (_a = methodNode.displayName()) === null || _a === void 0 ? void 0 : _a.replace('GET_', '');
|
|
123
|
+
const description = ((_b = methodNode.description()) === null || _b === void 0 ? void 0 : _b.value()) || ((_c = resourceNode.description()) === null || _c === void 0 ? void 0 : _c.value());
|
|
123
124
|
const originalFullRelativeUrl = resourceNode.completeRelativeUri();
|
|
124
125
|
let fullRelativeUrl = originalFullRelativeUrl;
|
|
125
126
|
const argTypeMap = {};
|
|
@@ -162,7 +163,7 @@ async function getJSONSchemaOptionsFromRAMLOptions({ source, cwd: ramlFileCwd =
|
|
|
162
163
|
}
|
|
163
164
|
for (const responseNode of responses) {
|
|
164
165
|
const statusCode = responseNode.code().value();
|
|
165
|
-
const responseNodeDescription = responseNode.description()
|
|
166
|
+
const responseNodeDescription = (_d = responseNode.description()) === null || _d === void 0 ? void 0 : _d.value();
|
|
166
167
|
for (const bodyNode of responseNode.body()) {
|
|
167
168
|
if (bodyNode.name().includes('application/json')) {
|
|
168
169
|
const bodyJson = bodyNode.toJSON();
|
|
@@ -200,10 +201,10 @@ async function getJSONSchemaOptionsFromRAMLOptions({ source, cwd: ramlFileCwd =
|
|
|
200
201
|
}
|
|
201
202
|
fieldName =
|
|
202
203
|
fieldName ||
|
|
203
|
-
(0, utils_js_1.getFieldNameFromPath)(originalFullRelativeUrl, method, responseByStatusCode['200']
|
|
204
|
+
(0, utils_js_1.getFieldNameFromPath)(originalFullRelativeUrl, method, (_e = responseByStatusCode['200']) === null || _e === void 0 ? void 0 : _e.responseTypeName);
|
|
204
205
|
if (fieldName) {
|
|
205
206
|
const graphQLFieldName = (0, utils_1.sanitizeNameForGraphQL)(fieldName);
|
|
206
|
-
const operationType = fieldTypeMap[graphQLFieldName]
|
|
207
|
+
const operationType = ((_f = fieldTypeMap[graphQLFieldName]) !== null && _f !== void 0 ? _f : method === 'GET') ? 'query' : 'mutation';
|
|
207
208
|
operations.push({
|
|
208
209
|
type: operationType,
|
|
209
210
|
field: graphQLFieldName,
|
|
@@ -24,6 +24,7 @@ function resolveTraitsByIs(base) {
|
|
|
24
24
|
* from RAML API Document
|
|
25
25
|
*/
|
|
26
26
|
export async function getJSONSchemaOptionsFromRAMLOptions({ source, cwd: ramlFileCwd = process.cwd(), operations: extraOperations, endpoint: forcedBaseUrl, fetch = crossUndiciFetch, schemaHeaders = {}, selectQueryOrMutationField = [], }) {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f;
|
|
27
28
|
const fieldTypeMap = {};
|
|
28
29
|
for (const { fieldName, type } of selectQueryOrMutationField) {
|
|
29
30
|
fieldTypeMap[fieldName] = type;
|
|
@@ -114,8 +115,8 @@ export async function getJSONSchemaOptionsFromRAMLOptions({ source, cwd: ramlFil
|
|
|
114
115
|
let requestTypeName;
|
|
115
116
|
const responseByStatusCode = {};
|
|
116
117
|
const method = methodNode.method().toUpperCase();
|
|
117
|
-
let fieldName = methodNode.displayName()
|
|
118
|
-
const description = methodNode.description()
|
|
118
|
+
let fieldName = (_a = methodNode.displayName()) === null || _a === void 0 ? void 0 : _a.replace('GET_', '');
|
|
119
|
+
const description = ((_b = methodNode.description()) === null || _b === void 0 ? void 0 : _b.value()) || ((_c = resourceNode.description()) === null || _c === void 0 ? void 0 : _c.value());
|
|
119
120
|
const originalFullRelativeUrl = resourceNode.completeRelativeUri();
|
|
120
121
|
let fullRelativeUrl = originalFullRelativeUrl;
|
|
121
122
|
const argTypeMap = {};
|
|
@@ -158,7 +159,7 @@ export async function getJSONSchemaOptionsFromRAMLOptions({ source, cwd: ramlFil
|
|
|
158
159
|
}
|
|
159
160
|
for (const responseNode of responses) {
|
|
160
161
|
const statusCode = responseNode.code().value();
|
|
161
|
-
const responseNodeDescription = responseNode.description()
|
|
162
|
+
const responseNodeDescription = (_d = responseNode.description()) === null || _d === void 0 ? void 0 : _d.value();
|
|
162
163
|
for (const bodyNode of responseNode.body()) {
|
|
163
164
|
if (bodyNode.name().includes('application/json')) {
|
|
164
165
|
const bodyJson = bodyNode.toJSON();
|
|
@@ -196,10 +197,10 @@ export async function getJSONSchemaOptionsFromRAMLOptions({ source, cwd: ramlFil
|
|
|
196
197
|
}
|
|
197
198
|
fieldName =
|
|
198
199
|
fieldName ||
|
|
199
|
-
getFieldNameFromPath(originalFullRelativeUrl, method, responseByStatusCode['200']
|
|
200
|
+
getFieldNameFromPath(originalFullRelativeUrl, method, (_e = responseByStatusCode['200']) === null || _e === void 0 ? void 0 : _e.responseTypeName);
|
|
200
201
|
if (fieldName) {
|
|
201
202
|
const graphQLFieldName = sanitizeNameForGraphQL(fieldName);
|
|
202
|
-
const operationType = fieldTypeMap[graphQLFieldName]
|
|
203
|
+
const operationType = ((_f = fieldTypeMap[graphQLFieldName]) !== null && _f !== void 0 ? _f : method === 'GET') ? 'query' : 'mutation';
|
|
203
204
|
operations.push({
|
|
204
205
|
type: operationType,
|
|
205
206
|
field: graphQLFieldName,
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnigraph/raml",
|
|
3
|
-
"version": "1.0.0-alpha-
|
|
3
|
+
"version": "1.0.0-alpha-20230523160518-5443a1139",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@graphql-mesh/cross-helpers": "0.4.0-alpha-
|
|
7
|
-
"@graphql-mesh/utils": "1.0.0-alpha-
|
|
8
|
-
"@graphql-tools/utils": "^9.2.1
|
|
6
|
+
"@graphql-mesh/cross-helpers": "0.4.0-alpha-20230523160518-5443a1139",
|
|
7
|
+
"@graphql-mesh/utils": "1.0.0-alpha-20230523160518-5443a1139",
|
|
8
|
+
"@graphql-tools/utils": "^9.2.1",
|
|
9
9
|
"graphql": "*",
|
|
10
10
|
"tslib": "^2.4.0"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@ardatan/raml-1-parser": "1.1.69",
|
|
14
|
-
"@graphql-mesh/string-interpolation": "0.5.0-alpha-
|
|
15
|
-
"@omnigraph/json-schema": "1.0.0-alpha-
|
|
14
|
+
"@graphql-mesh/string-interpolation": "0.5.0-alpha-20230523160518-5443a1139",
|
|
15
|
+
"@omnigraph/json-schema": "1.0.0-alpha-20230523160518-5443a1139",
|
|
16
16
|
"@whatwg-node/fetch": "^0.8.0",
|
|
17
17
|
"change-case": "4.1.2",
|
|
18
|
-
"json-machete": "1.0.0-alpha-
|
|
18
|
+
"json-machete": "1.0.0-alpha-20230523160518-5443a1139",
|
|
19
19
|
"to-json-schema": "0.2.5"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
@@ -24,9 +24,6 @@
|
|
|
24
24
|
"directory": "packages/loaders/raml"
|
|
25
25
|
},
|
|
26
26
|
"license": "MIT",
|
|
27
|
-
"engines": {
|
|
28
|
-
"node": ">=16.0.0"
|
|
29
|
-
},
|
|
30
27
|
"main": "cjs/index.js",
|
|
31
28
|
"module": "esm/index.js",
|
|
32
29
|
"typings": "typings/index.d.ts",
|