@omnigraph/raml 1.0.0-alpha-20230523153903-5443a1139 → 1.0.0-alpha-20230523154127-518d8667d

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