@looker/sdk-codegen-scripts 21.5.42 → 21.5.43
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/CHANGELOG.md +9 -0
- package/lib/convert.apispec.js +3 -3
- package/lib/convert.apispec.js.map +1 -1
- package/lib/convert.js.map +1 -1
- package/lib/declarationMiner.js +6 -6
- package/lib/declarationMiner.js.map +1 -1
- package/lib/esm/convert.apispec.js +2 -2
- package/lib/esm/convert.apispec.js.map +1 -1
- package/lib/esm/convert.js.map +1 -1
- package/lib/esm/declarationMiner.js +5 -5
- package/lib/esm/declarationMiner.js.map +1 -1
- package/lib/esm/exampleMiner.js +6 -5
- package/lib/esm/exampleMiner.js.map +1 -1
- package/lib/esm/fetchSpec.apispec.js +2 -2
- package/lib/esm/fetchSpec.apispec.js.map +1 -1
- package/lib/esm/fetchSpec.js +12 -12
- package/lib/esm/fetchSpec.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/languages.js.map +1 -1
- package/lib/esm/legacy.js +2 -2
- package/lib/esm/legacy.js.map +1 -1
- package/lib/esm/legacyGenerator.js +2 -2
- package/lib/esm/legacyGenerator.js.map +1 -1
- package/lib/esm/nodeUtils.js.map +1 -1
- package/lib/esm/prettify.js +2 -2
- package/lib/esm/prettify.js.map +1 -1
- package/lib/esm/reformatter.js +2 -2
- package/lib/esm/reformatter.js.map +1 -1
- package/lib/esm/sdkConfig.js.map +1 -1
- package/lib/esm/sdkGen.js +2 -2
- package/lib/esm/sdkGen.js.map +1 -1
- package/lib/esm/sdkGenerator.js +2 -2
- package/lib/esm/sdkGenerator.js.map +1 -1
- package/lib/esm/specConvert.js +2 -2
- package/lib/esm/specConvert.js.map +1 -1
- package/lib/esm/utils.js +4 -4
- package/lib/esm/utils.js.map +1 -1
- package/lib/esm/yamlToJson.js.map +1 -1
- package/lib/exampleMiner.js +7 -8
- package/lib/exampleMiner.js.map +1 -1
- package/lib/fetchSpec.apispec.js +3 -3
- package/lib/fetchSpec.apispec.js.map +1 -1
- package/lib/fetchSpec.js +12 -12
- package/lib/fetchSpec.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/languages.js +1 -1
- package/lib/languages.js.map +1 -1
- package/lib/legacy.js +2 -2
- package/lib/legacy.js.map +1 -1
- package/lib/legacyGenerator.js +2 -2
- package/lib/legacyGenerator.js.map +1 -1
- package/lib/nodeUtils.js +2 -3
- package/lib/nodeUtils.js.map +1 -1
- package/lib/prettify.js +3 -4
- package/lib/prettify.js.map +1 -1
- package/lib/reformatter.js +3 -4
- package/lib/reformatter.js.map +1 -1
- package/lib/sdkConfig.js +2 -3
- package/lib/sdkConfig.js.map +1 -1
- package/lib/sdkGen.js +4 -5
- package/lib/sdkGen.js.map +1 -1
- package/lib/sdkGenerator.js +3 -4
- package/lib/sdkGenerator.js.map +1 -1
- package/lib/specConvert.js +3 -4
- package/lib/specConvert.js.map +1 -1
- package/lib/utils.js +4 -4
- package/lib/utils.js.map +1 -1
- package/lib/yamlToJson.js +1 -2
- package/lib/yamlToJson.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -305,6 +305,15 @@
|
|
|
305
305
|
* @looker/sdk-node bumped from 26.6.0 to 26.6.1
|
|
306
306
|
* @looker/sdk-rtl bumped from 21.6.4 to 21.6.5
|
|
307
307
|
|
|
308
|
+
### Dependencies
|
|
309
|
+
|
|
310
|
+
* The following workspace dependencies were updated
|
|
311
|
+
* dependencies
|
|
312
|
+
* @looker/sdk bumped from 26.6.1 to 26.8.0
|
|
313
|
+
* @looker/sdk-codegen bumped from 21.11.2 to 21.11.3
|
|
314
|
+
* @looker/sdk-codegen-utils bumped from 21.0.32 to 21.0.33
|
|
315
|
+
* @looker/sdk-node bumped from 26.6.1 to 26.8.0
|
|
316
|
+
|
|
308
317
|
## [21.5.40](https://github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-scripts-v21.5.39...sdk-codegen-scripts-v21.5.40) (2026-03-11)
|
|
309
318
|
|
|
310
319
|
|
package/lib/convert.apispec.js
CHANGED
|
@@ -8,9 +8,9 @@ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
|
8
8
|
var _sdkNode = require("@looker/sdk-node");
|
|
9
9
|
var _sdkCodegen = require("@looker/sdk-codegen");
|
|
10
10
|
var _sdkCodegenUtils = require("@looker/sdk-codegen-utils");
|
|
11
|
-
function _interopRequireDefault(
|
|
12
|
-
function asyncGeneratorStep(
|
|
13
|
-
function _asyncToGenerator(
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
13
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
14
14
|
var swaggerFrag = "\n{\n \"paths\": {\n \"/query_tasks/multi_results\": {\n \"get\": {\n \"tags\": [\"Query\"],\n \"operationId\": \"query_task_multi_results\",\n \"summary\": \"Get Multiple Async Query Results\",\n \"description\": \"### Fetch results of multiple async queries\\n\\nReturns the results of multiple async queries in one request.\\n\\nFor Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.\\nQuery Tasks whose results have expired will have a status of 'expired'.\\nIf the user making the API request does not have sufficient privileges to view a Query Task result, the result will have a status of 'missing'\\n\",\n \"parameters\": [\n {\n \"name\": \"query_task_ids\",\n \"in\": \"query\",\n \"description\": \"List of Query Task IDs\",\n \"required\": true,\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"collectionFormat\": \"csv\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Multiple query results\",\n \"schema\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"db_query\"\n }\n },\n \"/dashboards/{lookml_dashboard_id}/import/{space_id}\": {\n \"post\": {\n \"tags\": [\"Dashboard\"],\n \"operationId\": \"import_lookml_dashboard\",\n \"summary\": \"Import LookML Dashboard\",\n \"description\": \"### Import a LookML dashboard to a space as a UDD\\nCreates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard\\nand puts it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.\\n\\nTo give the imported dashboard specify a (e.g. title: \\\"my title\\\") in the body of your request, otherwise the imported\\ndashboard will have the same title as the original LookML dashboard.\\n\\nFor this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to\\ncreate content in the space the dashboard is being imported to.\\n\\n**Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)\\n**Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)\\n\",\n \"parameters\": [\n {\n \"name\": \"lookml_dashboard_id\",\n \"in\": \"path\",\n \"description\": \"Id of LookML dashboard\",\n \"required\": true,\n \"type\": \"string\"\n },\n {\n \"name\": \"space_id\",\n \"in\": \"path\",\n \"description\": \"Id of space to import the dashboard to\",\n \"required\": true,\n \"type\": \"string\"\n },\n {\n \"name\": \"body\",\n \"in\": \"body\",\n \"description\": \"Dashboard\",\n \"required\": false,\n \"schema\": {\n \"$ref\": \"#/definitions/Dashboard\"\n }\n },\n {\n \"name\": \"raw_locale\",\n \"in\": \"query\",\n \"description\": \"If true, and this dashboard is localized, export it with the raw keys, not localized.\",\n \"required\": false,\n \"type\": \"boolean\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Dashboard\",\n \"schema\": {\n \"$ref\": \"#/definitions/Dashboard\"\n }\n },\n \"201\": {\n \"description\": \"dashboard\",\n \"schema\": {\n \"$ref\": \"#/definitions/Dashboard\"\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n },\n \"422\": {\n \"description\": \"Validation Error\",\n \"schema\": {\n \"$ref\": \"#/definitions/ValidationError\"\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"non_query\"\n }\n }\n }\n}\n";
|
|
15
15
|
var openApiFrag = "\n{\n \"paths\": {\n \"/query_tasks/multi_results\": {\n \"get\": {\n \"tags\": [\"Query\"],\n \"operationId\": \"query_task_multi_results\",\n \"summary\": \"Get Multiple Async Query Results\",\n \"description\": \"### Fetch results of multiple async queries\\n\\nReturns the results of multiple async queries in one request.\\n\\nFor Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.\\nQuery Tasks whose results have expired will have a status of 'expired'.\\nIf the user making the API request does not have sufficient privileges to view a Query Task result, the result will have a status of 'missing'\\n\",\n \"parameters\": [\n {\n \"name\": \"query_task_ids\",\n \"in\": \"query\",\n \"description\": \"List of Query Task IDs\",\n \"required\": true,\n \"style\": \"simple\",\n \"explode\": false,\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Multiple query results\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n }\n }\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"db_query\"\n }\n },\n\n \"/dashboards/{lookml_dashboard_id}/import/{space_id}\": {\n \"post\": {\n \"tags\": [\"Dashboard\"],\n \"operationId\": \"import_lookml_dashboard\",\n \"summary\": \"Import LookML Dashboard\",\n \"description\": \"### Import a LookML dashboard to a space as a UDD\\nCreates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard\\nand puts it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.\\n\\nTo give the imported dashboard specify a (e.g. title: \\\"my title\\\") in the body of your request, otherwise the imported\\ndashboard will have the same title as the original LookML dashboard.\\n\\nFor this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to\\ncreate content in the space the dashboard is being imported to.\\n\\n**Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)\\n**Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)\\n\",\n \"parameters\": [\n {\n \"name\": \"lookml_dashboard_id\",\n \"in\": \"path\",\n \"description\": \"Id of LookML dashboard\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"space_id\",\n \"in\": \"path\",\n \"description\": \"Id of space to import the dashboard to\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"raw_locale\",\n \"in\": \"query\",\n \"description\": \"If true, and this dashboard is localized, export it with the raw keys, not localized.\",\n \"required\": false,\n \"schema\": {\n \"type\": \"boolean\"\n }\n }\n ],\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Dashboard\"\n }\n }\n },\n \"description\": \"Dashboard\"\n },\n \"responses\": {\n \"200\": {\n \"description\": \"Dashboard\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Dashboard\"\n }\n }\n }\n },\n \"201\": {\n \"description\": \"dashboard\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Dashboard\"\n }\n }\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n },\n \"422\": {\n \"description\": \"Validation Error\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/ValidationError\"\n }\n }\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"non_query\"\n }\n }\n }\n}\n";
|
|
16
16
|
var specFrag = "\n\"can\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"boolean\"\n },\n \"readOnly\": true,\n \"description\": \"Operations the current user is able to perform on this object\",\n \"x-looker-nullable\": false\n},\n\"content_favorite_id\": {\n \"type\": \"integer\",\n \"format\": \"int64\",\n \"readOnly\": true,\n \"description\": \"Content Favorite Id\",\n \"x-looker-nullable\": true\n},\n\"content_metadata_id\": {\n \"type\": \"integer\",\n \"format\": \"int64\",\n \"readOnly\": true,\n \"description\": \"Id of content metadata\",\n \"x-looker-nullable\": true\n},\n\"description\": {\n \"type\": \"string\",\n \"readOnly\": true,\n \"description\": \"Description\",\n \"x-looker-nullable\": true\n},\n\"hidden\": {\n \"type\": \"boolean\",\n \"readOnly\": true,\n \"description\": \"Is Hidden\",\n \"x-looker-nullable\": false,\n \"x-looker-deprecated\": true,\n},\n\"supported_formats\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"readOnly\": true,\n \"x-looker-values\": [\n \"txt\",\n \"csv\",\n \"inline_json\",\n \"json\",\n \"json_label\",\n \"json_detail\",\n \"json_detail_lite_stream\",\n \"xlsx\",\n \"html\",\n \"wysiwyg_pdf\",\n \"assembled_pdf\",\n \"wysiwyg_png\",\n \"csv_zip\"\n ],\n \"description\": \"A list of data formats the integration supports. If unspecified, the default is all data formats. Valid values are: \\\"txt\\\", \\\"csv\\\", \\\"inline_json\\\", \\\"json\\\", \\\"json_label\\\", \\\"json_detail\\\", \\\"json_detail_lite_stream\\\", \\\"xlsx\\\", \\\"html\\\", \\\"wysiwyg_pdf\\\", \\\"assembled_pdf\\\", \\\"wysiwyg_png\\\", \\\"csv_zip\\\".\",\n \"nullable\": false\n},\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.apispec.js","names":["_fs","require","_nodeTest","_expect","_cloneDeep","_interopRequireDefault","_isEmpty","_sdkNode","_sdkCodegen","_sdkCodegenUtils","obj","__esModule","default","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","swaggerFrag","openApiFrag","specFrag","swagger","JSON","parse","api","config","TestConfig","specToModel","swaggerFile","testFile","apiFile","swaggerSource","readFileSync","fullSwagger","apiSource","settings","NodeSettingsIniFile","localIni","sdk","LookerNodeSDK","init40","baseUrl","authSession","base_url","describe","it","actual","swapXLookerTags","expect","toContain","not","openApiStyle","toEqual","toBeUndefined","fixConversion","spec","fixes","toHaveLength","onlyPublic","specs","filter","v","status","toBeDefined","getLookerSpecs","looker_release_version","current_version","version","supported","supported_versions","versions","getSpecLinks","forEach","name","url","isEmpty","current","find","s","links","link","replace","substring","indexOf","loadSpecs","description","op","paths","get","param","parameters","convertParam","expected","defs","definitions","convertDefs","keys","Object","length","skip","upgradeSpec","left","ApiModel","fromString","right","diff","compareSpecs","full_version","swagger_url","api_server_url","getSpecsFromVersions","entries","_ref6","_","a","isDefault","moar","cloneDeep","push"],"sources":["../src/convert.apispec.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport { readFileSync } from 'fs';\nimport { describe, it } from 'node:test';\nimport { expect } from 'expect';\nimport cloneDeep from 'lodash/cloneDeep';\nimport isEmpty from 'lodash/isEmpty';\nimport { LookerNodeSDK, NodeSettingsIniFile } from '@looker/sdk-node';\nimport type { ISpecItem } from '@looker/sdk-codegen';\nimport {\n ApiModel,\n compareSpecs,\n convertDefs,\n convertParam,\n fixConversion,\n getLookerSpecs,\n getSpecLinks,\n getSpecsFromVersions,\n loadSpecs,\n openApiStyle,\n specToModel,\n swapXLookerTags,\n upgradeSpec,\n} from '@looker/sdk-codegen';\nimport { TestConfig, testFile } from '@looker/sdk-codegen-utils';\n\nconst swaggerFrag = `\n{\n \"paths\": {\n \"/query_tasks/multi_results\": {\n \"get\": {\n \"tags\": [\"Query\"],\n \"operationId\": \"query_task_multi_results\",\n \"summary\": \"Get Multiple Async Query Results\",\n \"description\": \"### Fetch results of multiple async queries\\\\n\\\\nReturns the results of multiple async queries in one request.\\\\n\\\\nFor Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.\\\\nQuery Tasks whose results have expired will have a status of 'expired'.\\\\nIf the user making the API request does not have sufficient privileges to view a Query Task result, the result will have a status of 'missing'\\\\n\",\n \"parameters\": [\n {\n \"name\": \"query_task_ids\",\n \"in\": \"query\",\n \"description\": \"List of Query Task IDs\",\n \"required\": true,\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"collectionFormat\": \"csv\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Multiple query results\",\n \"schema\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"db_query\"\n }\n },\n \"/dashboards/{lookml_dashboard_id}/import/{space_id}\": {\n \"post\": {\n \"tags\": [\"Dashboard\"],\n \"operationId\": \"import_lookml_dashboard\",\n \"summary\": \"Import LookML Dashboard\",\n \"description\": \"### Import a LookML dashboard to a space as a UDD\\\\nCreates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard\\\\nand puts it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.\\\\n\\\\nTo give the imported dashboard specify a (e.g. title: \\\\\"my title\\\\\") in the body of your request, otherwise the imported\\\\ndashboard will have the same title as the original LookML dashboard.\\\\n\\\\nFor this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to\\\\ncreate content in the space the dashboard is being imported to.\\\\n\\\\n**Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)\\\\n**Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)\\\\n\",\n \"parameters\": [\n {\n \"name\": \"lookml_dashboard_id\",\n \"in\": \"path\",\n \"description\": \"Id of LookML dashboard\",\n \"required\": true,\n \"type\": \"string\"\n },\n {\n \"name\": \"space_id\",\n \"in\": \"path\",\n \"description\": \"Id of space to import the dashboard to\",\n \"required\": true,\n \"type\": \"string\"\n },\n {\n \"name\": \"body\",\n \"in\": \"body\",\n \"description\": \"Dashboard\",\n \"required\": false,\n \"schema\": {\n \"$ref\": \"#/definitions/Dashboard\"\n }\n },\n {\n \"name\": \"raw_locale\",\n \"in\": \"query\",\n \"description\": \"If true, and this dashboard is localized, export it with the raw keys, not localized.\",\n \"required\": false,\n \"type\": \"boolean\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Dashboard\",\n \"schema\": {\n \"$ref\": \"#/definitions/Dashboard\"\n }\n },\n \"201\": {\n \"description\": \"dashboard\",\n \"schema\": {\n \"$ref\": \"#/definitions/Dashboard\"\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n },\n \"422\": {\n \"description\": \"Validation Error\",\n \"schema\": {\n \"$ref\": \"#/definitions/ValidationError\"\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"non_query\"\n }\n }\n }\n}\n`;\nconst openApiFrag = `\n{\n \"paths\": {\n \"/query_tasks/multi_results\": {\n \"get\": {\n \"tags\": [\"Query\"],\n \"operationId\": \"query_task_multi_results\",\n \"summary\": \"Get Multiple Async Query Results\",\n \"description\": \"### Fetch results of multiple async queries\\\\n\\\\nReturns the results of multiple async queries in one request.\\\\n\\\\nFor Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.\\\\nQuery Tasks whose results have expired will have a status of 'expired'.\\\\nIf the user making the API request does not have sufficient privileges to view a Query Task result, the result will have a status of 'missing'\\\\n\",\n \"parameters\": [\n {\n \"name\": \"query_task_ids\",\n \"in\": \"query\",\n \"description\": \"List of Query Task IDs\",\n \"required\": true,\n \"style\": \"simple\",\n \"explode\": false,\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Multiple query results\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n }\n }\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"db_query\"\n }\n },\n\n \"/dashboards/{lookml_dashboard_id}/import/{space_id}\": {\n \"post\": {\n \"tags\": [\"Dashboard\"],\n \"operationId\": \"import_lookml_dashboard\",\n \"summary\": \"Import LookML Dashboard\",\n \"description\": \"### Import a LookML dashboard to a space as a UDD\\\\nCreates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard\\\\nand puts it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.\\\\n\\\\nTo give the imported dashboard specify a (e.g. title: \\\\\"my title\\\\\") in the body of your request, otherwise the imported\\\\ndashboard will have the same title as the original LookML dashboard.\\\\n\\\\nFor this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to\\\\ncreate content in the space the dashboard is being imported to.\\\\n\\\\n**Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)\\\\n**Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)\\\\n\",\n \"parameters\": [\n {\n \"name\": \"lookml_dashboard_id\",\n \"in\": \"path\",\n \"description\": \"Id of LookML dashboard\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"space_id\",\n \"in\": \"path\",\n \"description\": \"Id of space to import the dashboard to\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"raw_locale\",\n \"in\": \"query\",\n \"description\": \"If true, and this dashboard is localized, export it with the raw keys, not localized.\",\n \"required\": false,\n \"schema\": {\n \"type\": \"boolean\"\n }\n }\n ],\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Dashboard\"\n }\n }\n },\n \"description\": \"Dashboard\"\n },\n \"responses\": {\n \"200\": {\n \"description\": \"Dashboard\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Dashboard\"\n }\n }\n }\n },\n \"201\": {\n \"description\": \"dashboard\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Dashboard\"\n }\n }\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n },\n \"422\": {\n \"description\": \"Validation Error\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/ValidationError\"\n }\n }\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"non_query\"\n }\n }\n }\n}\n`;\nconst specFrag = `\n\"can\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"boolean\"\n },\n \"readOnly\": true,\n \"description\": \"Operations the current user is able to perform on this object\",\n \"x-looker-nullable\": false\n},\n\"content_favorite_id\": {\n \"type\": \"integer\",\n \"format\": \"int64\",\n \"readOnly\": true,\n \"description\": \"Content Favorite Id\",\n \"x-looker-nullable\": true\n},\n\"content_metadata_id\": {\n \"type\": \"integer\",\n \"format\": \"int64\",\n \"readOnly\": true,\n \"description\": \"Id of content metadata\",\n \"x-looker-nullable\": true\n},\n\"description\": {\n \"type\": \"string\",\n \"readOnly\": true,\n \"description\": \"Description\",\n \"x-looker-nullable\": true\n},\n\"hidden\": {\n \"type\": \"boolean\",\n \"readOnly\": true,\n \"description\": \"Is Hidden\",\n \"x-looker-nullable\": false,\n \"x-looker-deprecated\": true,\n},\n\"supported_formats\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"readOnly\": true,\n \"x-looker-values\": [\n \"txt\",\n \"csv\",\n \"inline_json\",\n \"json\",\n \"json_label\",\n \"json_detail\",\n \"json_detail_lite_stream\",\n \"xlsx\",\n \"html\",\n \"wysiwyg_pdf\",\n \"assembled_pdf\",\n \"wysiwyg_png\",\n \"csv_zip\"\n ],\n \"description\": \"A list of data formats the integration supports. If unspecified, the default is all data formats. Valid values are: \\\\\"txt\\\\\", \\\\\"csv\\\\\", \\\\\"inline_json\\\\\", \\\\\"json\\\\\", \\\\\"json_label\\\\\", \\\\\"json_detail\\\\\", \\\\\"json_detail_lite_stream\\\\\", \\\\\"xlsx\\\\\", \\\\\"html\\\\\", \\\\\"wysiwyg_pdf\\\\\", \\\\\"assembled_pdf\\\\\", \\\\\"wysiwyg_png\\\\\", \\\\\"csv_zip\\\\\".\",\n \"nullable\": false\n},\n`;\n\nconst swagger = JSON.parse(swaggerFrag);\nconst api = JSON.parse(openApiFrag);\n\nconst config = TestConfig(specToModel);\nconst swaggerFile = testFile('Looker.4.0.json');\nconst apiFile = testFile('Looker.4.0.oas.json');\nconst swaggerSource = readFileSync(swaggerFile, 'utf-8');\nconst fullSwagger = JSON.parse(swaggerSource);\nconst apiSource = readFileSync(apiFile, 'utf-8');\nconst settings = new NodeSettingsIniFile(\n 'LOOKERSDK',\n config.localIni,\n 'Looker'\n);\nconst sdk = LookerNodeSDK.init40(settings);\nconst baseUrl = sdk.authSession.settings.base_url;\n\ndescribe('spec conversion', () => {\n it('swaps out x-looker-tags', () => {\n const actual = swapXLookerTags(specFrag);\n expect(actual).toContain('\"nullable\": true');\n expect(actual).not.toContain('\"x-looker-nullable\": true');\n expect(actual).toContain('\"enum\": [');\n expect(actual).not.toContain('\"x-looker-values\": [');\n expect(actual).toContain('\"deprecated\": true');\n expect(actual).not.toContain('\"x-looker-deprecated\"');\n });\n\n it('collectionFormat to style', () => {\n expect(openApiStyle('csv')).toEqual('simple');\n expect(openApiStyle('ssv')).toEqual('spaceDelimited');\n expect(openApiStyle('pipes')).toEqual('pipeDelimited');\n expect(openApiStyle('tabs')).toBeUndefined();\n });\n\n it('fixes missing conversion items', () => {\n const actual = fixConversion(openApiFrag, swaggerFrag);\n expect(actual.spec).toContain(`\"style\":\"simple\"`);\n expect(actual.fixes).not.toHaveLength(0);\n });\n\n describe('spec retrieval', () => {\n const onlyPublic = (specs: ISpecItem[]) => {\n return specs.filter(v => v.status !== 'undocumented');\n };\n\n it('gets looker specs', async () => {\n expect(baseUrl).toBeDefined();\n const actual = await getLookerSpecs(sdk, baseUrl);\n expect(actual).toBeDefined();\n expect(actual.looker_release_version).not.toEqual('');\n expect(actual.current_version.version).not.toEqual('');\n const supported = onlyPublic(actual.supported_versions);\n expect(supported).toHaveLength(1);\n });\n\n it('gets spec links', async () => {\n const versions = await getLookerSpecs(sdk, baseUrl);\n expect(versions).toBeDefined();\n versions.supported_versions = onlyPublic(versions.supported_versions);\n const actual = getSpecLinks(versions);\n expect(actual).toBeDefined();\n /*\n * 23.18 and later only has one API defined\n * expect(actual).toHaveLength(3)\n */\n actual.forEach(spec => {\n expect(spec.name).not.toEqual('');\n expect(spec.version).not.toEqual('');\n expect(spec.status).not.toEqual('');\n expect(spec.url).not.toEqual('');\n expect(isEmpty(spec.api)).toEqual(true);\n });\n const current = actual.find(s => s.status === 'current');\n expect(current).toBeDefined();\n actual.forEach(spec => expect(isEmpty(spec.api)).toEqual(true));\n });\n\n it('fetches and parses all specs', async () => {\n const versions = await getLookerSpecs(sdk, baseUrl);\n expect(versions).toBeDefined();\n versions.supported_versions = onlyPublic(versions.supported_versions);\n const links = getSpecLinks(versions);\n links.forEach(\n link =>\n (link.url = link.url.replace(\n link.url.substring(0, link.url.indexOf('/api/')),\n baseUrl\n ))\n );\n const actual = await loadSpecs(sdk, links);\n expect(actual).toBeDefined();\n /*\n * 23.18 and later only has one API defined\n * expect(actual).toHaveLength(3)\n */\n actual.forEach(spec => {\n expect(isEmpty(spec.api)).toEqual(false);\n expect(spec.api.version).not.toEqual('');\n expect(spec.api.description).not.toEqual('');\n });\n });\n });\n\n describe('spec upgrade', () => {\n it('converts a swagger array param', () => {\n const op = swagger.paths['/query_tasks/multi_results'].get;\n const param = op.parameters[0];\n const actual = convertParam(param);\n expect(actual).toBeDefined();\n const expected =\n api.paths['/query_tasks/multi_results'].get.parameters[0];\n expect(actual).toEqual(expected);\n });\n\n it('converts all definitions', () => {\n const defs = fullSwagger.definitions;\n const actual = convertDefs(defs);\n expect(actual).toBeDefined();\n const keys = Object.keys(actual);\n expect(keys).toHaveLength(Object.keys(defs).length);\n });\n\n /** eslint-disable jest/no-disabled-tests */\n it('matches a reference OpenAPI conversion', { skip: true }, () => {\n // TODO There is a different branch to address this\n const spec = upgradeSpec(swaggerSource);\n expect(spec).toBeDefined();\n const left = ApiModel.fromString(apiSource);\n const right = ApiModel.fromString(spec);\n const diff = compareSpecs(left, right);\n expect(diff).toHaveLength(0);\n });\n\n it('passes through an existing OpenAPI spec', () => {\n const spec = upgradeSpec(apiSource);\n expect(spec).toBeDefined();\n const left = ApiModel.fromString(apiSource);\n const right = ApiModel.fromString(spec);\n const diff = compareSpecs(left, right);\n expect(diff).toHaveLength(0);\n });\n });\n\n describe('getSpecsFromVersions', () => {\n const versions = {\n looker_release_version: '21.3.0',\n current_version: {\n version: '3.1',\n full_version: '3.1.0',\n status: 'current',\n swagger_url: 'http://localhost:19999/api/3.1/swagger.json',\n },\n supported_versions: [\n {\n version: '2.99',\n full_version: '2.99.0',\n status: 'internal_test',\n swagger_url: 'http://localhost:19999/api/2.99/swagger.json',\n },\n {\n version: '3.0',\n full_version: '3.0.0',\n status: 'legacy',\n swagger_url: 'http://localhost:19999/api/3.0/swagger.json',\n },\n {\n version: '3.1',\n full_version: '3.1.0',\n status: 'current',\n swagger_url: 'http://localhost:19999/api/3.1/swagger.json',\n },\n {\n version: '4.0',\n full_version: '4.0.21.3',\n status: 'experimental',\n swagger_url: 'http://localhost:19999/api/4.0/swagger.json',\n },\n ],\n api_server_url: 'http://localhost:19999',\n };\n\n it('only gets supported specifications', async () => {\n const actual = await getSpecsFromVersions(versions);\n expect(Object.keys(actual)).toEqual(['3.1', '4.0']);\n });\n\n it('current is the default spec', async () => {\n const specs = await getSpecsFromVersions(versions);\n const actual = Object.entries(specs).find(\n ([_, a]) => a.status === 'current'\n );\n expect(actual).toBeDefined();\n if (actual) {\n const [, current] = actual;\n expect(current).toBeDefined();\n expect(current.status).toEqual('current');\n expect(current.isDefault).toEqual(true);\n }\n });\n\n it('specs have unique keys', async () => {\n const moar = cloneDeep(versions);\n moar.supported_versions.push(\n {\n version: '4.0',\n full_version: 'full',\n status: 'un',\n swagger_url: 'http://localhost:19999/api/4.0/u.json',\n },\n {\n version: '4.0',\n full_version: 'full',\n status: 'un',\n swagger_url: 'http://localhost:19999/api/4.0/un.json',\n },\n {\n version: '4.0',\n full_version: 'full',\n status: 'un',\n swagger_url: 'http://localhost:19999/api/4.0/un3.json',\n },\n {\n version: '4.0',\n full_version: 'full',\n status: 'un',\n swagger_url: 'http://localhost:19999/api/4.0/un4.json',\n }\n );\n const actual = await getSpecsFromVersions(moar);\n expect(Object.keys(actual)).toEqual([\n '3.1',\n '4.0',\n '4.0u',\n '4.0un',\n '4.0un3',\n '4.0un4',\n ]);\n });\n });\n});\n"],"mappings":";;AA0BA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAC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,CAAC,CAClC,KAAK,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,CACT,CAAC;IACJ,CAAC,EAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"convert.apispec.js","names":["_fs","require","_nodeTest","_expect","_cloneDeep","_interopRequireDefault","_isEmpty","_sdkNode","_sdkCodegen","_sdkCodegenUtils","e","__esModule","default","asyncGeneratorStep","n","t","r","o","a","c","i","u","value","done","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","swaggerFrag","openApiFrag","specFrag","swagger","JSON","parse","api","config","TestConfig","specToModel","swaggerFile","testFile","apiFile","swaggerSource","readFileSync","fullSwagger","apiSource","settings","NodeSettingsIniFile","localIni","sdk","LookerNodeSDK","init40","baseUrl","authSession","base_url","describe","it","actual","swapXLookerTags","expect","toContain","not","openApiStyle","toEqual","toBeUndefined","fixConversion","spec","fixes","toHaveLength","onlyPublic","specs","filter","v","status","toBeDefined","getLookerSpecs","looker_release_version","current_version","version","supported","supported_versions","versions","getSpecLinks","forEach","name","url","isEmpty","current","find","s","links","link","replace","substring","indexOf","loadSpecs","description","op","paths","get","param","parameters","convertParam","expected","defs","definitions","convertDefs","keys","Object","length","skip","upgradeSpec","left","ApiModel","fromString","right","diff","compareSpecs","full_version","swagger_url","api_server_url","getSpecsFromVersions","entries","_ref6","_","isDefault","moar","cloneDeep","push"],"sources":["../src/convert.apispec.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport { readFileSync } from 'fs';\nimport { describe, it } from 'node:test';\nimport { expect } from 'expect';\nimport cloneDeep from 'lodash/cloneDeep';\nimport isEmpty from 'lodash/isEmpty';\nimport { LookerNodeSDK, NodeSettingsIniFile } from '@looker/sdk-node';\nimport type { ISpecItem } from '@looker/sdk-codegen';\nimport {\n ApiModel,\n compareSpecs,\n convertDefs,\n convertParam,\n fixConversion,\n getLookerSpecs,\n getSpecLinks,\n getSpecsFromVersions,\n loadSpecs,\n openApiStyle,\n specToModel,\n swapXLookerTags,\n upgradeSpec,\n} from '@looker/sdk-codegen';\nimport { TestConfig, testFile } from '@looker/sdk-codegen-utils';\n\nconst swaggerFrag = `\n{\n \"paths\": {\n \"/query_tasks/multi_results\": {\n \"get\": {\n \"tags\": [\"Query\"],\n \"operationId\": \"query_task_multi_results\",\n \"summary\": \"Get Multiple Async Query Results\",\n \"description\": \"### Fetch results of multiple async queries\\\\n\\\\nReturns the results of multiple async queries in one request.\\\\n\\\\nFor Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.\\\\nQuery Tasks whose results have expired will have a status of 'expired'.\\\\nIf the user making the API request does not have sufficient privileges to view a Query Task result, the result will have a status of 'missing'\\\\n\",\n \"parameters\": [\n {\n \"name\": \"query_task_ids\",\n \"in\": \"query\",\n \"description\": \"List of Query Task IDs\",\n \"required\": true,\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"collectionFormat\": \"csv\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Multiple query results\",\n \"schema\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"db_query\"\n }\n },\n \"/dashboards/{lookml_dashboard_id}/import/{space_id}\": {\n \"post\": {\n \"tags\": [\"Dashboard\"],\n \"operationId\": \"import_lookml_dashboard\",\n \"summary\": \"Import LookML Dashboard\",\n \"description\": \"### Import a LookML dashboard to a space as a UDD\\\\nCreates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard\\\\nand puts it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.\\\\n\\\\nTo give the imported dashboard specify a (e.g. title: \\\\\"my title\\\\\") in the body of your request, otherwise the imported\\\\ndashboard will have the same title as the original LookML dashboard.\\\\n\\\\nFor this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to\\\\ncreate content in the space the dashboard is being imported to.\\\\n\\\\n**Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)\\\\n**Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)\\\\n\",\n \"parameters\": [\n {\n \"name\": \"lookml_dashboard_id\",\n \"in\": \"path\",\n \"description\": \"Id of LookML dashboard\",\n \"required\": true,\n \"type\": \"string\"\n },\n {\n \"name\": \"space_id\",\n \"in\": \"path\",\n \"description\": \"Id of space to import the dashboard to\",\n \"required\": true,\n \"type\": \"string\"\n },\n {\n \"name\": \"body\",\n \"in\": \"body\",\n \"description\": \"Dashboard\",\n \"required\": false,\n \"schema\": {\n \"$ref\": \"#/definitions/Dashboard\"\n }\n },\n {\n \"name\": \"raw_locale\",\n \"in\": \"query\",\n \"description\": \"If true, and this dashboard is localized, export it with the raw keys, not localized.\",\n \"required\": false,\n \"type\": \"boolean\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Dashboard\",\n \"schema\": {\n \"$ref\": \"#/definitions/Dashboard\"\n }\n },\n \"201\": {\n \"description\": \"dashboard\",\n \"schema\": {\n \"$ref\": \"#/definitions/Dashboard\"\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"schema\": {\n \"$ref\": \"#/definitions/Error\"\n }\n },\n \"422\": {\n \"description\": \"Validation Error\",\n \"schema\": {\n \"$ref\": \"#/definitions/ValidationError\"\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"non_query\"\n }\n }\n }\n}\n`;\nconst openApiFrag = `\n{\n \"paths\": {\n \"/query_tasks/multi_results\": {\n \"get\": {\n \"tags\": [\"Query\"],\n \"operationId\": \"query_task_multi_results\",\n \"summary\": \"Get Multiple Async Query Results\",\n \"description\": \"### Fetch results of multiple async queries\\\\n\\\\nReturns the results of multiple async queries in one request.\\\\n\\\\nFor Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.\\\\nQuery Tasks whose results have expired will have a status of 'expired'.\\\\nIf the user making the API request does not have sufficient privileges to view a Query Task result, the result will have a status of 'missing'\\\\n\",\n \"parameters\": [\n {\n \"name\": \"query_task_ids\",\n \"in\": \"query\",\n \"description\": \"List of Query Task IDs\",\n \"required\": true,\n \"style\": \"simple\",\n \"explode\": false,\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Multiple query results\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n }\n }\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"db_query\"\n }\n },\n\n \"/dashboards/{lookml_dashboard_id}/import/{space_id}\": {\n \"post\": {\n \"tags\": [\"Dashboard\"],\n \"operationId\": \"import_lookml_dashboard\",\n \"summary\": \"Import LookML Dashboard\",\n \"description\": \"### Import a LookML dashboard to a space as a UDD\\\\nCreates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard\\\\nand puts it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.\\\\n\\\\nTo give the imported dashboard specify a (e.g. title: \\\\\"my title\\\\\") in the body of your request, otherwise the imported\\\\ndashboard will have the same title as the original LookML dashboard.\\\\n\\\\nFor this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to\\\\ncreate content in the space the dashboard is being imported to.\\\\n\\\\n**Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)\\\\n**Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)\\\\n\",\n \"parameters\": [\n {\n \"name\": \"lookml_dashboard_id\",\n \"in\": \"path\",\n \"description\": \"Id of LookML dashboard\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"space_id\",\n \"in\": \"path\",\n \"description\": \"Id of space to import the dashboard to\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"raw_locale\",\n \"in\": \"query\",\n \"description\": \"If true, and this dashboard is localized, export it with the raw keys, not localized.\",\n \"required\": false,\n \"schema\": {\n \"type\": \"boolean\"\n }\n }\n ],\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Dashboard\"\n }\n }\n },\n \"description\": \"Dashboard\"\n },\n \"responses\": {\n \"200\": {\n \"description\": \"Dashboard\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Dashboard\"\n }\n }\n }\n },\n \"201\": {\n \"description\": \"dashboard\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Dashboard\"\n }\n }\n }\n },\n \"400\": {\n \"description\": \"Bad Request\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n },\n \"404\": {\n \"description\": \"Not Found\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Error\"\n }\n }\n }\n },\n \"422\": {\n \"description\": \"Validation Error\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/ValidationError\"\n }\n }\n }\n }\n },\n \"x-looker-status\": \"beta\",\n \"x-looker-activity-type\": \"non_query\"\n }\n }\n }\n}\n`;\nconst specFrag = `\n\"can\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"boolean\"\n },\n \"readOnly\": true,\n \"description\": \"Operations the current user is able to perform on this object\",\n \"x-looker-nullable\": false\n},\n\"content_favorite_id\": {\n \"type\": \"integer\",\n \"format\": \"int64\",\n \"readOnly\": true,\n \"description\": \"Content Favorite Id\",\n \"x-looker-nullable\": true\n},\n\"content_metadata_id\": {\n \"type\": \"integer\",\n \"format\": \"int64\",\n \"readOnly\": true,\n \"description\": \"Id of content metadata\",\n \"x-looker-nullable\": true\n},\n\"description\": {\n \"type\": \"string\",\n \"readOnly\": true,\n \"description\": \"Description\",\n \"x-looker-nullable\": true\n},\n\"hidden\": {\n \"type\": \"boolean\",\n \"readOnly\": true,\n \"description\": \"Is Hidden\",\n \"x-looker-nullable\": false,\n \"x-looker-deprecated\": true,\n},\n\"supported_formats\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"readOnly\": true,\n \"x-looker-values\": [\n \"txt\",\n \"csv\",\n \"inline_json\",\n \"json\",\n \"json_label\",\n \"json_detail\",\n \"json_detail_lite_stream\",\n \"xlsx\",\n \"html\",\n \"wysiwyg_pdf\",\n \"assembled_pdf\",\n \"wysiwyg_png\",\n \"csv_zip\"\n ],\n \"description\": \"A list of data formats the integration supports. If unspecified, the default is all data formats. Valid values are: \\\\\"txt\\\\\", \\\\\"csv\\\\\", \\\\\"inline_json\\\\\", \\\\\"json\\\\\", \\\\\"json_label\\\\\", \\\\\"json_detail\\\\\", \\\\\"json_detail_lite_stream\\\\\", \\\\\"xlsx\\\\\", \\\\\"html\\\\\", \\\\\"wysiwyg_pdf\\\\\", \\\\\"assembled_pdf\\\\\", \\\\\"wysiwyg_png\\\\\", \\\\\"csv_zip\\\\\".\",\n \"nullable\": false\n},\n`;\n\nconst swagger = JSON.parse(swaggerFrag);\nconst api = JSON.parse(openApiFrag);\n\nconst config = TestConfig(specToModel);\nconst swaggerFile = testFile('Looker.4.0.json');\nconst apiFile = testFile('Looker.4.0.oas.json');\nconst swaggerSource = readFileSync(swaggerFile, 'utf-8');\nconst fullSwagger = JSON.parse(swaggerSource);\nconst apiSource = readFileSync(apiFile, 'utf-8');\nconst settings = new NodeSettingsIniFile(\n 'LOOKERSDK',\n config.localIni,\n 'Looker'\n);\nconst sdk = LookerNodeSDK.init40(settings);\nconst baseUrl = sdk.authSession.settings.base_url;\n\ndescribe('spec conversion', () => {\n it('swaps out x-looker-tags', () => {\n const actual = swapXLookerTags(specFrag);\n expect(actual).toContain('\"nullable\": true');\n expect(actual).not.toContain('\"x-looker-nullable\": true');\n expect(actual).toContain('\"enum\": [');\n expect(actual).not.toContain('\"x-looker-values\": [');\n expect(actual).toContain('\"deprecated\": true');\n expect(actual).not.toContain('\"x-looker-deprecated\"');\n });\n\n it('collectionFormat to style', () => {\n expect(openApiStyle('csv')).toEqual('simple');\n expect(openApiStyle('ssv')).toEqual('spaceDelimited');\n expect(openApiStyle('pipes')).toEqual('pipeDelimited');\n expect(openApiStyle('tabs')).toBeUndefined();\n });\n\n it('fixes missing conversion items', () => {\n const actual = fixConversion(openApiFrag, swaggerFrag);\n expect(actual.spec).toContain(`\"style\":\"simple\"`);\n expect(actual.fixes).not.toHaveLength(0);\n });\n\n describe('spec retrieval', () => {\n const onlyPublic = (specs: ISpecItem[]) => {\n return specs.filter(v => v.status !== 'undocumented');\n };\n\n it('gets looker specs', async () => {\n expect(baseUrl).toBeDefined();\n const actual = await getLookerSpecs(sdk, baseUrl);\n expect(actual).toBeDefined();\n expect(actual.looker_release_version).not.toEqual('');\n expect(actual.current_version.version).not.toEqual('');\n const supported = onlyPublic(actual.supported_versions);\n expect(supported).toHaveLength(1);\n });\n\n it('gets spec links', async () => {\n const versions = await getLookerSpecs(sdk, baseUrl);\n expect(versions).toBeDefined();\n versions.supported_versions = onlyPublic(versions.supported_versions);\n const actual = getSpecLinks(versions);\n expect(actual).toBeDefined();\n /*\n * 23.18 and later only has one API defined\n * expect(actual).toHaveLength(3)\n */\n actual.forEach(spec => {\n expect(spec.name).not.toEqual('');\n expect(spec.version).not.toEqual('');\n expect(spec.status).not.toEqual('');\n expect(spec.url).not.toEqual('');\n expect(isEmpty(spec.api)).toEqual(true);\n });\n const current = actual.find(s => s.status === 'current');\n expect(current).toBeDefined();\n actual.forEach(spec => expect(isEmpty(spec.api)).toEqual(true));\n });\n\n it('fetches and parses all specs', async () => {\n const versions = await getLookerSpecs(sdk, baseUrl);\n expect(versions).toBeDefined();\n versions.supported_versions = onlyPublic(versions.supported_versions);\n const links = getSpecLinks(versions);\n links.forEach(\n link =>\n (link.url = link.url.replace(\n link.url.substring(0, link.url.indexOf('/api/')),\n baseUrl\n ))\n );\n const actual = await loadSpecs(sdk, links);\n expect(actual).toBeDefined();\n /*\n * 23.18 and later only has one API defined\n * expect(actual).toHaveLength(3)\n */\n actual.forEach(spec => {\n expect(isEmpty(spec.api)).toEqual(false);\n expect(spec.api.version).not.toEqual('');\n expect(spec.api.description).not.toEqual('');\n });\n });\n });\n\n describe('spec upgrade', () => {\n it('converts a swagger array param', () => {\n const op = swagger.paths['/query_tasks/multi_results'].get;\n const param = op.parameters[0];\n const actual = convertParam(param);\n expect(actual).toBeDefined();\n const expected =\n api.paths['/query_tasks/multi_results'].get.parameters[0];\n expect(actual).toEqual(expected);\n });\n\n it('converts all definitions', () => {\n const defs = fullSwagger.definitions;\n const actual = convertDefs(defs);\n expect(actual).toBeDefined();\n const keys = Object.keys(actual);\n expect(keys).toHaveLength(Object.keys(defs).length);\n });\n\n /** eslint-disable jest/no-disabled-tests */\n it('matches a reference OpenAPI conversion', { skip: true }, () => {\n // TODO There is a different branch to address this\n const spec = upgradeSpec(swaggerSource);\n expect(spec).toBeDefined();\n const left = ApiModel.fromString(apiSource);\n const right = ApiModel.fromString(spec);\n const diff = compareSpecs(left, right);\n expect(diff).toHaveLength(0);\n });\n\n it('passes through an existing OpenAPI spec', () => {\n const spec = upgradeSpec(apiSource);\n expect(spec).toBeDefined();\n const left = ApiModel.fromString(apiSource);\n const right = ApiModel.fromString(spec);\n const diff = compareSpecs(left, right);\n expect(diff).toHaveLength(0);\n });\n });\n\n describe('getSpecsFromVersions', () => {\n const versions = {\n looker_release_version: '21.3.0',\n current_version: {\n version: '3.1',\n full_version: '3.1.0',\n status: 'current',\n swagger_url: 'http://localhost:19999/api/3.1/swagger.json',\n },\n supported_versions: [\n {\n version: '2.99',\n full_version: '2.99.0',\n status: 'internal_test',\n swagger_url: 'http://localhost:19999/api/2.99/swagger.json',\n },\n {\n version: '3.0',\n full_version: '3.0.0',\n status: 'legacy',\n swagger_url: 'http://localhost:19999/api/3.0/swagger.json',\n },\n {\n version: '3.1',\n full_version: '3.1.0',\n status: 'current',\n swagger_url: 'http://localhost:19999/api/3.1/swagger.json',\n },\n {\n version: '4.0',\n full_version: '4.0.21.3',\n status: 'experimental',\n swagger_url: 'http://localhost:19999/api/4.0/swagger.json',\n },\n ],\n api_server_url: 'http://localhost:19999',\n };\n\n it('only gets supported specifications', async () => {\n const actual = await getSpecsFromVersions(versions);\n expect(Object.keys(actual)).toEqual(['3.1', '4.0']);\n });\n\n it('current is the default spec', async () => {\n const specs = await getSpecsFromVersions(versions);\n const actual = Object.entries(specs).find(\n ([_, a]) => a.status === 'current'\n );\n expect(actual).toBeDefined();\n if (actual) {\n const [, current] = actual;\n expect(current).toBeDefined();\n expect(current.status).toEqual('current');\n expect(current.isDefault).toEqual(true);\n }\n });\n\n it('specs have unique keys', async () => {\n const moar = cloneDeep(versions);\n moar.supported_versions.push(\n {\n version: '4.0',\n full_version: 'full',\n status: 'un',\n swagger_url: 'http://localhost:19999/api/4.0/u.json',\n },\n {\n version: '4.0',\n full_version: 'full',\n status: 'un',\n swagger_url: 'http://localhost:19999/api/4.0/un.json',\n },\n {\n version: '4.0',\n full_version: 'full',\n status: 'un',\n swagger_url: 'http://localhost:19999/api/4.0/un3.json',\n },\n {\n version: '4.0',\n full_version: 'full',\n status: 'un',\n swagger_url: 'http://localhost:19999/api/4.0/un4.json',\n }\n );\n const actual = await getSpecsFromVersions(moar);\n expect(Object.keys(actual)).toEqual([\n '3.1',\n '4.0',\n '4.0u',\n '4.0un',\n '4.0un3',\n '4.0un4',\n ]);\n });\n });\n});\n"],"mappings":";;AA0BA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAEA,IAAAO,WAAA,GAAAP,OAAA;AAeA,IAAAQ,gBAAA,GAAAR,OAAA;AAAiE,SAAAI,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAA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;QAC7B,IAAAf,cAAM,EAAC4B,OAAO,CAACd,MAAM,CAAC,CAACV,OAAO,CAAC,SAAS,CAAC;QACzC,IAAAJ,cAAM,EAAC4B,OAAO,CAACsC,SAAS,CAAC,CAAC9D,OAAO,CAAC,IAAI,CAAC;MACzC;IACF,CAAC,EAAC;IAEF,IAAAP,YAAE,EAAC,wBAAwB,EAAAhC,iBAAA,CAAE,aAAY;MACvC,IAAMsG,IAAI,GAAG,IAAAC,kBAAS,EAAC9C,QAAQ,CAAC;MAChC6C,IAAI,CAAC9C,kBAAkB,CAACgD,IAAI,CAC1B;QACElD,OAAO,EAAE,KAAK;QACdwC,YAAY,EAAE,MAAM;QACpB7C,MAAM,EAAE,IAAI;QACZ8C,WAAW,EAAE;MACf,CAAC,EACD;QACEzC,OAAO,EAAE,KAAK;QACdwC,YAAY,EAAE,MAAM;QACpB7C,MAAM,EAAE,IAAI;QACZ8C,WAAW,EAAE;MACf,CAAC,EACD;QACEzC,OAAO,EAAE,KAAK;QACdwC,YAAY,EAAE,MAAM;QACpB7C,MAAM,EAAE,IAAI;QACZ8C,WAAW,EAAE;MACf,CAAC,EACD;QACEzC,OAAO,EAAE,KAAK;QACdwC,YAAY,EAAE,MAAM;QACpB7C,MAAM,EAAE,IAAI;QACZ8C,WAAW,EAAE;MACf,CACF,CAAC;MACD,IAAM9D,MAAM,SAAS,IAAAgE,gCAAoB,EAACK,IAAI,CAAC;MAC/C,IAAAnE,cAAM,EAACiD,MAAM,CAACD,IAAI,CAAClD,MAAM,CAAC,CAAC,CAACM,OAAO,CAAC,CAClC,KAAK,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,CACT,CAAC;IACJ,CAAC,EAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/lib/convert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.js","names":["_sdkCodegenUtils","require","_sdkCodegen","_nodeUtils","convertSpec","exports","specFileName","openApiFilename","force","arguments","length","undefined","isFileSync","log","concat","spec","readFileSync","swagger","JSON","parse","run","openapi","writeFileSync","stringify","Error","fail","source","upgradeSpec","createJsonFile"],"sources":["../src/convert.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport { log } from '@looker/sdk-codegen-utils';\nimport { upgradeSpec } from '@looker/sdk-codegen';\nimport {\n createJsonFile,\n fail,\n isFileSync,\n readFileSync,\n run,\n writeFileSync,\n} from './nodeUtils';\n\n/**\n * Convert a Swagger specification to OpenAPI\n *\n * If the source spec is already an OpenAPI spec, fixes are still processed\n *\n * @param specFileName source Swagger spec file\n * @param openApiFilename destination OpenAPI spec file\n * @param force use `true` to force a conversion even if the file exists\n * @returns {Promise<string>} name of OpenAPI file\n */\nexport const convertSpec = (\n specFileName: string,\n openApiFilename: string,\n force = false\n) => {\n if (isFileSync(openApiFilename) && !force) {\n log(`${openApiFilename} already exists. Skipping conversion.`);\n return openApiFilename;\n }\n const spec = readFileSync(specFileName);\n const swagger = JSON.parse(spec);\n if (swagger.swagger) {\n // Still a swagger spec. Convert it.\n // https://github.com/Mermade/oas-kit/tree/master/packages/swagger2openapi config options:\n // patch to fix up small errors in source definition (not required, just to ensure smooth process)\n // indent no spaces\n // output to openApiFilename\n run('yarn swagger2openapi', [\n specFileName,\n '-p',\n '-i',\n '\"\"',\n '-o',\n openApiFilename,\n ]);\n } else if (swagger.openapi) {\n // We've already got an OpenAPI file\n writeFileSync(openApiFilename, JSON.stringify(swagger));\n } else {\n throw new Error(`Bad specification file ${specFileName}`);\n }\n if (!isFileSync(openApiFilename)) {\n return fail('convertSpec', `creating ${openApiFilename} failed`);\n }\n const source = upgradeSpec(readFileSync(openApiFilename));\n createJsonFile(openApiFilename, source);\n return openApiFilename;\n};\n"],"mappings":";;;;;;AA0BA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAmBO,IAAMG,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,SAAdA,WAAWA,CACtBE,YAAoB,EACpBC,eAAuB,EAEpB;EAAA,IADHC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAEb,IAAI,IAAAG,qBAAU,EAACL,eAAe,CAAC,IAAI,CAACC,KAAK,EAAE;IACzC,IAAAK,oBAAG,KAAAC,MAAA,CAAIP,eAAe,0CAAuC,CAAC;IAC9D,OAAOA,eAAe;EACxB;EACA,IAAMQ,IAAI,GAAG,IAAAC,uBAAY,EAACV,YAAY,CAAC;EACvC,IAAMW,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAC;EAChC,IAAIE,OAAO,CAACA,OAAO,EAAE;IAMnB,IAAAG,cAAG,EAAC,sBAAsB,EAAE,CAC1Bd,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJC,eAAe,CAChB,CAAC;EACJ,CAAC,MAAM,IAAIU,OAAO,CAACI,OAAO,EAAE;IAE1B,IAAAC,wBAAa,EAACf,eAAe,EAAEW,IAAI,CAACK,SAAS,CAACN,OAAO,CAAC,CAAC;EACzD,CAAC,MAAM;IACL,MAAM,IAAIO,KAAK,2BAAAV,MAAA,CAA2BR,YAAY,CAAE,CAAC;EAC3D;EACA,IAAI,CAAC,IAAAM,qBAAU,EAACL,eAAe,CAAC,EAAE;IAChC,OAAO,IAAAkB,eAAI,EAAC,aAAa,cAAAX,MAAA,CAAcP,eAAe,YAAS,CAAC;EAClE;EACA,IAAMmB,MAAM,GAAG,IAAAC,uBAAW,EAAC,IAAAX,uBAAY,EAACT,eAAe,CAAC,CAAC;EACzD,IAAAqB,yBAAc,EAACrB,eAAe,EAAEmB,MAAM,CAAC;EACvC,OAAOnB,eAAe;AACxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"convert.js","names":["_sdkCodegenUtils","require","_sdkCodegen","_nodeUtils","convertSpec","exports","specFileName","openApiFilename","force","arguments","length","undefined","isFileSync","log","concat","spec","readFileSync","swagger","JSON","parse","run","openapi","writeFileSync","stringify","Error","fail","source","upgradeSpec","createJsonFile"],"sources":["../src/convert.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport { log } from '@looker/sdk-codegen-utils';\nimport { upgradeSpec } from '@looker/sdk-codegen';\nimport {\n createJsonFile,\n fail,\n isFileSync,\n readFileSync,\n run,\n writeFileSync,\n} from './nodeUtils';\n\n/**\n * Convert a Swagger specification to OpenAPI\n *\n * If the source spec is already an OpenAPI spec, fixes are still processed\n *\n * @param specFileName source Swagger spec file\n * @param openApiFilename destination OpenAPI spec file\n * @param force use `true` to force a conversion even if the file exists\n * @returns {Promise<string>} name of OpenAPI file\n */\nexport const convertSpec = (\n specFileName: string,\n openApiFilename: string,\n force = false\n) => {\n if (isFileSync(openApiFilename) && !force) {\n log(`${openApiFilename} already exists. Skipping conversion.`);\n return openApiFilename;\n }\n const spec = readFileSync(specFileName);\n const swagger = JSON.parse(spec);\n if (swagger.swagger) {\n // Still a swagger spec. Convert it.\n // https://github.com/Mermade/oas-kit/tree/master/packages/swagger2openapi config options:\n // patch to fix up small errors in source definition (not required, just to ensure smooth process)\n // indent no spaces\n // output to openApiFilename\n run('yarn swagger2openapi', [\n specFileName,\n '-p',\n '-i',\n '\"\"',\n '-o',\n openApiFilename,\n ]);\n } else if (swagger.openapi) {\n // We've already got an OpenAPI file\n writeFileSync(openApiFilename, JSON.stringify(swagger));\n } else {\n throw new Error(`Bad specification file ${specFileName}`);\n }\n if (!isFileSync(openApiFilename)) {\n return fail('convertSpec', `creating ${openApiFilename} failed`);\n }\n const source = upgradeSpec(readFileSync(openApiFilename));\n createJsonFile(openApiFilename, source);\n return openApiFilename;\n};\n"],"mappings":";;;;;;AA0BA,IAAAA,gBAAA,GAAAC,OAAA;AAC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AAC","ignoreList":[]}
|
package/lib/declarationMiner.js
CHANGED
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.rubyTypeProbe = exports.rubyMethodProbe = exports.DeclarationMiner = void 0;
|
|
7
7
|
var _path = _interopRequireDefault(require("path"));
|
|
8
8
|
var _exampleMiner = require("./exampleMiner");
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
-
function _defineProperty(
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
14
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
-
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o =
|
|
16
|
-
function _inherits(
|
|
17
|
-
function _setPrototypeOf(
|
|
15
|
+
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
|
|
16
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
17
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
18
18
|
var fileFilter = (endpointFilePattern, typeFilePattern, fileName) => {
|
|
19
19
|
var fileMatch = endpointFilePattern.test(fileName) || typeFilePattern.test(fileName);
|
|
20
20
|
return (0, _exampleMiner.filterCodeFiles)(fileName) && fileMatch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarationMiner.js","names":["_path","_interopRequireDefault","require","_exampleMiner","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","_wrapRegExp","BabelRegExp","RegExp","prototype","WeakMap","p","set","get","_setPrototypeOf","buildGroups","reduce","create","_inherits","exec","groups","indices","replace","Array","isArray","join","slice","subClass","superClass","constructor","setPrototypeOf","bind","__proto__","fileFilter","endpointFilePattern","typeFilePattern","fileName","fileMatch","test","filterCodeFiles","rubyMethodProbe","exports","fileNamePattern","declarationPattern","verb","path","matchToSpecKeyTransform","match","_match$groups","_match$groups2","toLocaleUpperCase","concat","rubyTypeProbe","typeName","DeclarationMiner","sourcePath","methodProbe","typeProbe","originOverride","execute","filePath","mProbe","tProbe","files","getCodeFiles","undefined","f","relFile","processFile","basename","methods","mineFile","types","lode","commitHash","process","chdir","getCommitHash","remoteOrigin","getRemoteOrigin","ExampleMiner","relate","probe","mineCode","readFile","content","lines","split","declarations","line","index","sourceFile"],"sources":["../src/declarationMiner.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport path from 'path';\nimport type { DeclarationNuggets, IDeclarationMine } from '@looker/sdk-codegen';\n\nimport {\n ExampleMiner,\n filterCodeFiles,\n getCodeFiles,\n getCommitHash,\n getRemoteOrigin,\n readFile,\n} from './exampleMiner';\n\n/**\n * Filter that checks if given file name matches any of the specified patterns\n * @param endpointFilePattern A pattern that matches endpoint files\n * @param typeFilePattern A pattern that matches type files\n * @param fileName File name to check against patterns\n */\nconst fileFilter = (\n endpointFilePattern: RegExp,\n typeFilePattern: RegExp,\n fileName: string\n) => {\n const fileMatch =\n endpointFilePattern.test(fileName) || typeFilePattern.test(fileName);\n return filterCodeFiles(fileName) && fileMatch;\n};\n\n/**\n * Reference method probe for a Ruby controller\n */\nexport const rubyMethodProbe = {\n fileNamePattern: /^(?!test).*_controller.rb$/,\n declarationPattern:\n /(?<verb>GET|POST|DELETE|PUT|PATCH)\\s(?:\"|')\\/api\\/3\\.x(?<path>\\S+)(?:\"|')/i,\n matchToSpecKeyTransform: (match: RegExpExecArray) => {\n const verb = match.groups?.verb.toLocaleUpperCase();\n const path = match.groups?.path\n .replace(':#', '')\n .replace('#', '')\n .replace(/:(\\w+)/g, '{$1}');\n const key = `${verb} ${path}`;\n return key;\n },\n};\n\n/**\n * Reference type probe for a Ruby mapper\n */\nexport const rubyTypeProbe: IProbe = {\n fileNamePattern: /^(?!test).*_mapper.rb$/,\n declarationPattern: /class\\s(?<typeName>\\w+)Mapper/i,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n matchToSpecKeyTransform: (match: RegExpExecArray) => match.groups!.typeName,\n};\n\nexport interface IProbe {\n /** Pattern of file names to mine */\n fileNamePattern: RegExp;\n /** Pattern matching the declaration of a method/type */\n declarationPattern: RegExp;\n /** A transform lambda for transforming a declaration match into a spec key */\n matchToSpecKeyTransform: (match: RegExpExecArray) => string;\n}\n\nexport class DeclarationMiner {\n types: DeclarationNuggets = {};\n methods: DeclarationNuggets = {};\n\n constructor(\n public readonly sourcePath: string,\n public readonly methodProbe: IProbe,\n public readonly typeProbe: IProbe,\n private readonly originOverride: string\n ) {}\n\n execute(sourcePath?: string, methodProbe?: IProbe, typeProbe?: IProbe) {\n const filePath = sourcePath ?? this.sourcePath;\n const mProbe = methodProbe ?? this.methodProbe;\n const tProbe = typeProbe ?? this.typeProbe;\n\n const files = getCodeFiles(\n filePath,\n undefined,\n fileFilter.bind(null, mProbe.fileNamePattern, tProbe.fileNamePattern),\n ['node_modules', 'dist']\n );\n\n files.forEach(f => {\n const relFile = this.processFile(f);\n const fileName = path.basename(relFile);\n if (mProbe.fileNamePattern.test(fileName)) {\n this.methods = {\n ...this.methods,\n ...this.mineFile(relFile, f, mProbe),\n };\n } else {\n this.types = { ...this.types, ...this.mineFile(relFile, f, tProbe) };\n }\n });\n return this.lode;\n }\n\n get commitHash(): string {\n process.chdir(this.sourcePath);\n return getCommitHash();\n }\n\n get remoteOrigin(): string {\n if (this.originOverride) {\n return this.originOverride;\n }\n process.chdir(this.sourcePath);\n return getRemoteOrigin();\n }\n\n get lode(): IDeclarationMine {\n return {\n commitHash: this.commitHash,\n remoteOrigin: this.remoteOrigin,\n types: this.types,\n methods: this.methods,\n };\n }\n\n protected processFile(fileName: string) {\n const relFile = ExampleMiner.relate(this.sourcePath, fileName);\n return relFile;\n }\n\n protected mineFile(relFile: string, fileName: string, probe: IProbe) {\n return this.mineCode(relFile, readFile(fileName), probe);\n }\n\n protected mineCode(relFile: string, content: string, probe: IProbe) {\n const lines = content.split('\\n');\n const declarations: DeclarationNuggets = {};\n lines.forEach((line, index) => {\n const match = probe.declarationPattern.exec(line);\n if (match) {\n const key = probe.matchToSpecKeyTransform(match);\n declarations[key] = {\n line: index + 1,\n sourceFile: relFile,\n };\n }\n });\n return declarations;\n }\n}\n"],"mappings":";;;;;;AA0BA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AAOwB,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,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,KAAK,CAAC;EAC1D;EAEUC,QAAQA,CAAChB,OAAe,EAAEkB,OAAe,EAAEH,KAAa,EAAE;IAClE,IAAMI,KAAK,GAAGD,OAAO,CAACE,KAAK,CAAC,IAAI,CAAC;IACjC,IAAMC,YAAgC,GAAG,CAAC,CAAC;IAC3CF,KAAK,CAAClG,OAAO,CAAC,CAACqG,IAAI,EAAEC,KAAK,KAAK;MAC7B,IAAM3C,KAAK,GAAGmC,KAAK,CAACvC,kBAAkB,CAACxB,IAAI,CAACsE,IAAI,CAAC;MACjD,IAAI1C,KAAK,EAAE;QACT,IAAMtD,GAAG,GAAGyF,KAAK,CAACpC,uBAAuB,CAACC,KAAK,CAAC;QAChDyC,YAAY,CAAC/F,GAAG,CAAC,GAAG;UAClBgG,IAAI,EAAEC,KAAK,GAAG,CAAC;UACfC,UAAU,EAAExB;QACd,CAAC;MACH;IACF,CAAC,CAAC;IACF,OAAOqB,YAAY;EACrB;AACF;AAAC/C,OAAA,CAAAa,gBAAA,GAAAA,gBAAA"}
|
|
1
|
+
{"version":3,"file":"declarationMiner.js","names":["_path","_interopRequireDefault","require","_exampleMiner","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_wrapRegExp","BabelRegExp","RegExp","prototype","WeakMap","p","set","get","_setPrototypeOf","buildGroups","reduce","create","_inherits","exec","groups","indices","replace","Array","isArray","join","slice","constructor","setPrototypeOf","bind","__proto__","fileFilter","endpointFilePattern","typeFilePattern","fileName","fileMatch","test","filterCodeFiles","rubyMethodProbe","exports","fileNamePattern","declarationPattern","verb","path","matchToSpecKeyTransform","match","_match$groups","_match$groups2","toLocaleUpperCase","key","concat","rubyTypeProbe","typeName","DeclarationMiner","sourcePath","methodProbe","typeProbe","originOverride","execute","filePath","mProbe","tProbe","files","getCodeFiles","undefined","f","relFile","processFile","basename","methods","mineFile","types","lode","commitHash","process","chdir","getCommitHash","remoteOrigin","getRemoteOrigin","ExampleMiner","relate","probe","mineCode","readFile","content","lines","split","declarations","line","index","sourceFile"],"sources":["../src/declarationMiner.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport path from 'path';\nimport type { DeclarationNuggets, IDeclarationMine } from '@looker/sdk-codegen';\n\nimport {\n ExampleMiner,\n filterCodeFiles,\n getCodeFiles,\n getCommitHash,\n getRemoteOrigin,\n readFile,\n} from './exampleMiner';\n\n/**\n * Filter that checks if given file name matches any of the specified patterns\n * @param endpointFilePattern A pattern that matches endpoint files\n * @param typeFilePattern A pattern that matches type files\n * @param fileName File name to check against patterns\n */\nconst fileFilter = (\n endpointFilePattern: RegExp,\n typeFilePattern: RegExp,\n fileName: string\n) => {\n const fileMatch =\n endpointFilePattern.test(fileName) || typeFilePattern.test(fileName);\n return filterCodeFiles(fileName) && fileMatch;\n};\n\n/**\n * Reference method probe for a Ruby controller\n */\nexport const rubyMethodProbe = {\n fileNamePattern: /^(?!test).*_controller.rb$/,\n declarationPattern:\n /(?<verb>GET|POST|DELETE|PUT|PATCH)\\s(?:\"|')\\/api\\/3\\.x(?<path>\\S+)(?:\"|')/i,\n matchToSpecKeyTransform: (match: RegExpExecArray) => {\n const verb = match.groups?.verb.toLocaleUpperCase();\n const path = match.groups?.path\n .replace(':#', '')\n .replace('#', '')\n .replace(/:(\\w+)/g, '{$1}');\n const key = `${verb} ${path}`;\n return key;\n },\n};\n\n/**\n * Reference type probe for a Ruby mapper\n */\nexport const rubyTypeProbe: IProbe = {\n fileNamePattern: /^(?!test).*_mapper.rb$/,\n declarationPattern: /class\\s(?<typeName>\\w+)Mapper/i,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n matchToSpecKeyTransform: (match: RegExpExecArray) => match.groups!.typeName,\n};\n\nexport interface IProbe {\n /** Pattern of file names to mine */\n fileNamePattern: RegExp;\n /** Pattern matching the declaration of a method/type */\n declarationPattern: RegExp;\n /** A transform lambda for transforming a declaration match into a spec key */\n matchToSpecKeyTransform: (match: RegExpExecArray) => string;\n}\n\nexport class DeclarationMiner {\n types: DeclarationNuggets = {};\n methods: DeclarationNuggets = {};\n\n constructor(\n public readonly sourcePath: string,\n public readonly methodProbe: IProbe,\n public readonly typeProbe: IProbe,\n private readonly originOverride: string\n ) {}\n\n execute(sourcePath?: string, methodProbe?: IProbe, typeProbe?: IProbe) {\n const filePath = sourcePath ?? this.sourcePath;\n const mProbe = methodProbe ?? this.methodProbe;\n const tProbe = typeProbe ?? this.typeProbe;\n\n const files = getCodeFiles(\n filePath,\n undefined,\n fileFilter.bind(null, mProbe.fileNamePattern, tProbe.fileNamePattern),\n ['node_modules', 'dist']\n );\n\n files.forEach(f => {\n const relFile = this.processFile(f);\n const fileName = path.basename(relFile);\n if (mProbe.fileNamePattern.test(fileName)) {\n this.methods = {\n ...this.methods,\n ...this.mineFile(relFile, f, mProbe),\n };\n } else {\n this.types = { ...this.types, ...this.mineFile(relFile, f, tProbe) };\n }\n });\n return this.lode;\n }\n\n get commitHash(): string {\n process.chdir(this.sourcePath);\n return getCommitHash();\n }\n\n get remoteOrigin(): string {\n if (this.originOverride) {\n return this.originOverride;\n }\n process.chdir(this.sourcePath);\n return getRemoteOrigin();\n }\n\n get lode(): IDeclarationMine {\n return {\n commitHash: this.commitHash,\n remoteOrigin: this.remoteOrigin,\n types: this.types,\n methods: this.methods,\n };\n }\n\n protected processFile(fileName: string) {\n const relFile = ExampleMiner.relate(this.sourcePath, fileName);\n return relFile;\n }\n\n protected mineFile(relFile: string, fileName: string, probe: IProbe) {\n return this.mineCode(relFile, readFile(fileName), probe);\n }\n\n protected mineCode(relFile: string, content: string, probe: IProbe) {\n const lines = content.split('\\n');\n const declarations: DeclarationNuggets = {};\n lines.forEach((line, index) => {\n const match = probe.declarationPattern.exec(line);\n if (match) {\n const key = probe.matchToSpecKeyTransform(match);\n declarations[key] = {\n line: index + 1,\n sourceFile: relFile,\n };\n }\n });\n return declarations;\n }\n}\n"],"mappings":";;;;;;AA0BA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AAOwB,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAP,CAAA,OAAAM,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAR,CAAA,GAAAI,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAX,CAAA,EAAAI,CAAA,EAAAQ,U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/BN,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBF,OAAO,EAAE,IAAI,CAACA;IAChB,CAAC;EACH;EAEUF,WAAWA,CAACjC,QAAgB,EAAE;IACtC,IAAMgC,OAAO,GAAGa,0BAAY,CAACC,MAAM,CAAC,IAAI,CAAC1B,UAAU,EAAEpB,QAAQ,CAAC;IAC9D,OAAOgC,OAAO;EAChB;EAEUI,QAAQA,CAACJ,OAAe,EAAEhC,QAAgB,EAAE+C,KAAa,EAAE;IACnE,OAAO,IAAI,CAACC,QAAQ,CAAChB,OAAO,EAAE,IAAAiB,sBAAQ,EAACjD,QAAQ,CAAC,EAAE+C,KAAK,CAAC;EAC1D;EAEUC,QAAQA,CAAChB,OAAe,EAAEkB,OAAe,EAAEH,KAAa,EAAE;IAClE,IAAMI,KAAK,GAAGD,OAAO,CAACE,KAAK,CAAC,IAAI,CAAC;IACjC,IAAMC,YAAgC,GAAG,CAAC,CAAC;IAC3CF,KAAK,CAAChG,OAAO,CAAC,CAACmG,IAAI,EAAEC,KAAK,KAAK;MAC7B,IAAM5C,KAAK,GAAGoC,KAAK,CAACxC,kBAAkB,CAACtB,IAAI,CAACqE,IAAI,CAAC;MACjD,IAAI3C,KAAK,EAAE;QACT,IAAMI,GAAG,GAAGgC,KAAK,CAACrC,uBAAuB,CAACC,KAAK,CAAC;QAChD0C,YAAY,CAACtC,GAAG,CAAC,GAAG;UAClBuC,IAAI,EAAEC,KAAK,GAAG,CAAC;UACfC,UAAU,EAAExB;QACd,CAAC;MACH;IACF,CAAC,CAAC;IACF,OAAOqB,YAAY;EACrB;AACF;AAAChD,OAAA,CAAAc,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function asyncGeneratorStep(
|
|
2
|
-
function _asyncToGenerator(
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
2
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
3
3
|
import { readFileSync } from 'fs';
|
|
4
4
|
import { describe, it } from 'node:test';
|
|
5
5
|
import { expect } from 'expect';
|