@looker/run-it 0.9.43-alpha.1650 → 0.9.44
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +27 -1
- package/lib/RunIt.js +12 -28
- package/lib/RunIt.js.map +1 -1
- package/lib/RunItProvider.js +0 -6
- package/lib/RunItProvider.js.map +1 -1
- package/lib/components/Collapser/CollapserCard.js +0 -8
- package/lib/components/Collapser/CollapserCard.js.map +1 -1
- package/lib/components/Collapser/index.js +0 -1
- package/lib/components/Collapser/index.js.map +1 -1
- package/lib/components/ConfigForm/ConfigForm.js +5 -52
- package/lib/components/ConfigForm/ConfigForm.js.map +1 -1
- package/lib/components/ConfigForm/index.js +0 -4
- package/lib/components/ConfigForm/index.js.map +1 -1
- package/lib/components/ConfigForm/utils.js +5 -21
- package/lib/components/ConfigForm/utils.js.map +1 -1
- package/lib/components/CopyLinkWrapper/CopyLinkWrapper.js +0 -16
- package/lib/components/CopyLinkWrapper/CopyLinkWrapper.js.map +1 -1
- package/lib/components/CopyLinkWrapper/index.js +0 -1
- package/lib/components/CopyLinkWrapper/index.js.map +1 -1
- package/lib/components/DataGrid/DataGrid.d.ts +2 -2
- package/lib/components/DataGrid/DataGrid.js +1 -9
- package/lib/components/DataGrid/DataGrid.js.map +1 -1
- package/lib/components/DataGrid/gridUtils.js +1 -22
- package/lib/components/DataGrid/gridUtils.js.map +1 -1
- package/lib/components/DataGrid/index.js +4 -6
- package/lib/components/DataGrid/index.js.map +1 -1
- package/lib/components/DocSdkCalls/DocMultiCall.js +0 -6
- package/lib/components/DocSdkCalls/DocMultiCall.js.map +1 -1
- package/lib/components/DocSdkCalls/DocSdkCalls.d.ts +1 -0
- package/lib/components/DocSdkCalls/DocSdkCalls.js +5 -17
- package/lib/components/DocSdkCalls/DocSdkCalls.js.map +1 -1
- package/lib/components/DocSdkCalls/callUtils.js +0 -5
- package/lib/components/DocSdkCalls/callUtils.js.map +1 -1
- package/lib/components/DocSdkCalls/index.js +4 -6
- package/lib/components/DocSdkCalls/index.js.map +1 -1
- package/lib/components/Loading/Loading.js +0 -5
- package/lib/components/Loading/Loading.js.map +1 -1
- package/lib/components/Loading/index.js +0 -1
- package/lib/components/Loading/index.js.map +1 -1
- package/lib/components/LoginForm/LoginForm.js +1 -16
- package/lib/components/LoginForm/LoginForm.js.map +1 -1
- package/lib/components/LoginForm/index.js +0 -1
- package/lib/components/LoginForm/index.js.map +1 -1
- package/lib/components/MethodBadge/MethodBadge.js +1 -16
- package/lib/components/MethodBadge/MethodBadge.js.map +1 -1
- package/lib/components/MethodBadge/index.js +0 -1
- package/lib/components/MethodBadge/index.js.map +1 -1
- package/lib/components/PerfTracker/PerfChart.js +0 -12
- package/lib/components/PerfTracker/PerfChart.js.map +1 -1
- package/lib/components/PerfTracker/PerfTable.js +0 -9
- package/lib/components/PerfTracker/PerfTable.js.map +1 -1
- package/lib/components/PerfTracker/PerfTracker.js +0 -18
- package/lib/components/PerfTracker/PerfTracker.js.map +1 -1
- package/lib/components/PerfTracker/index.js +4 -6
- package/lib/components/PerfTracker/index.js.map +1 -1
- package/lib/components/PerfTracker/perfTableUtils.d.ts +1 -1
- package/lib/components/PerfTracker/perfTableUtils.js +2 -18
- package/lib/components/PerfTracker/perfTableUtils.js.map +1 -1
- package/lib/components/PerfTracker/perfUtils.js +4 -42
- package/lib/components/PerfTracker/perfUtils.js.map +1 -1
- package/lib/components/RequestForm/FormItem.js +0 -5
- package/lib/components/RequestForm/FormItem.js.map +1 -1
- package/lib/components/RequestForm/RequestForm.d.ts +3 -1
- package/lib/components/RequestForm/RequestForm.js +25 -23
- package/lib/components/RequestForm/RequestForm.js.map +1 -1
- package/lib/components/RequestForm/formUtils.d.ts +1 -0
- package/lib/components/RequestForm/formUtils.js +9 -47
- package/lib/components/RequestForm/formUtils.js.map +1 -1
- package/lib/components/RequestForm/index.js +0 -2
- package/lib/components/RequestForm/index.js.map +1 -1
- package/lib/components/ResponseExplorer/ResponseExplorer.js +2 -22
- package/lib/components/ResponseExplorer/ResponseExplorer.js.map +1 -1
- package/lib/components/ResponseExplorer/index.js +0 -2
- package/lib/components/ResponseExplorer/index.js.map +1 -1
- package/lib/components/ShowResponse/ShowResponse.js +0 -7
- package/lib/components/ShowResponse/ShowResponse.js.map +1 -1
- package/lib/components/ShowResponse/index.js +0 -1
- package/lib/components/ShowResponse/index.js.map +1 -1
- package/lib/components/ShowResponse/responseUtils.js +4 -49
- package/lib/components/ShowResponse/responseUtils.js.map +1 -1
- package/lib/components/common/common.d.ts +2 -2
- package/lib/components/common/common.js +1 -5
- package/lib/components/common/common.js.map +1 -1
- package/lib/components/common/index.js +0 -1
- package/lib/components/common/index.js.map +1 -1
- package/lib/components/index.js +0 -26
- package/lib/components/index.js.map +1 -1
- package/lib/esm/RunIt.js +65 -62
- package/lib/esm/RunIt.js.map +1 -1
- package/lib/esm/RunItProvider.js +14 -4
- package/lib/esm/RunItProvider.js.map +1 -1
- package/lib/esm/components/Collapser/CollapserCard.js +22 -14
- package/lib/esm/components/Collapser/CollapserCard.js.map +1 -1
- package/lib/esm/components/Collapser/index.js +12 -1
- package/lib/esm/components/Collapser/index.js.map +1 -1
- package/lib/esm/components/ConfigForm/ConfigForm.js +63 -89
- package/lib/esm/components/ConfigForm/ConfigForm.js.map +1 -1
- package/lib/esm/components/ConfigForm/index.js +27 -2
- package/lib/esm/components/ConfigForm/index.js.map +1 -1
- package/lib/esm/components/ConfigForm/utils.js +25 -21
- package/lib/esm/components/ConfigForm/utils.js.map +1 -1
- package/lib/esm/components/CopyLinkWrapper/CopyLinkWrapper.js +22 -19
- package/lib/esm/components/CopyLinkWrapper/CopyLinkWrapper.js.map +1 -1
- package/lib/esm/components/CopyLinkWrapper/index.js +12 -1
- package/lib/esm/components/CopyLinkWrapper/index.js.map +1 -1
- package/lib/esm/components/DataGrid/DataGrid.js +25 -17
- package/lib/esm/components/DataGrid/DataGrid.js.map +1 -1
- package/lib/esm/components/DataGrid/gridUtils.js +26 -15
- package/lib/esm/components/DataGrid/gridUtils.js.map +1 -1
- package/lib/esm/components/DataGrid/index.js +25 -2
- package/lib/esm/components/DataGrid/index.js.map +1 -1
- package/lib/esm/components/DocSdkCalls/DocMultiCall.js +15 -7
- package/lib/esm/components/DocSdkCalls/DocMultiCall.js.map +1 -1
- package/lib/esm/components/DocSdkCalls/DocSdkCalls.js +30 -22
- package/lib/esm/components/DocSdkCalls/DocSdkCalls.js.map +1 -1
- package/lib/esm/components/DocSdkCalls/callUtils.js +10 -3
- package/lib/esm/components/DocSdkCalls/callUtils.js.map +1 -1
- package/lib/esm/components/DocSdkCalls/index.js +19 -2
- package/lib/esm/components/DocSdkCalls/index.js.map +1 -1
- package/lib/esm/components/Loading/Loading.js +14 -6
- package/lib/esm/components/Loading/Loading.js.map +1 -1
- package/lib/esm/components/Loading/index.js +12 -1
- package/lib/esm/components/Loading/index.js.map +1 -1
- package/lib/esm/components/LoginForm/LoginForm.js +21 -18
- package/lib/esm/components/LoginForm/LoginForm.js.map +1 -1
- package/lib/esm/components/LoginForm/index.js +18 -1
- package/lib/esm/components/LoginForm/index.js.map +1 -1
- package/lib/esm/components/MethodBadge/MethodBadge.js +19 -13
- package/lib/esm/components/MethodBadge/MethodBadge.js.map +1 -1
- package/lib/esm/components/MethodBadge/index.js +12 -1
- package/lib/esm/components/MethodBadge/index.js.map +1 -1
- package/lib/esm/components/PerfTracker/PerfChart.js +18 -16
- package/lib/esm/components/PerfTracker/PerfChart.js.map +1 -1
- package/lib/esm/components/PerfTracker/PerfTable.js +22 -15
- package/lib/esm/components/PerfTracker/PerfTable.js.map +1 -1
- package/lib/esm/components/PerfTracker/PerfTracker.js +33 -31
- package/lib/esm/components/PerfTracker/PerfTracker.js.map +1 -1
- package/lib/esm/components/PerfTracker/index.js +19 -2
- package/lib/esm/components/PerfTracker/index.js.map +1 -1
- package/lib/esm/components/PerfTracker/perfTableUtils.js +28 -26
- package/lib/esm/components/PerfTracker/perfTableUtils.js.map +1 -1
- package/lib/esm/components/PerfTracker/perfUtils.js +15 -39
- package/lib/esm/components/PerfTracker/perfUtils.js.map +1 -1
- package/lib/esm/components/RequestForm/FormItem.js +14 -6
- package/lib/esm/components/RequestForm/FormItem.js.map +1 -1
- package/lib/esm/components/RequestForm/RequestForm.js +50 -32
- package/lib/esm/components/RequestForm/RequestForm.js.map +1 -1
- package/lib/esm/components/RequestForm/formUtils.js +47 -53
- package/lib/esm/components/RequestForm/formUtils.js.map +1 -1
- package/lib/esm/components/RequestForm/index.js +19 -2
- package/lib/esm/components/RequestForm/index.js.map +1 -1
- package/lib/esm/components/ResponseExplorer/ResponseExplorer.js +41 -35
- package/lib/esm/components/ResponseExplorer/ResponseExplorer.js.map +1 -1
- package/lib/esm/components/ResponseExplorer/index.js +16 -1
- package/lib/esm/components/ResponseExplorer/index.js.map +1 -1
- package/lib/esm/components/ShowResponse/ShowResponse.js +14 -8
- package/lib/esm/components/ShowResponse/ShowResponse.js.map +1 -1
- package/lib/esm/components/ShowResponse/index.js +12 -1
- package/lib/esm/components/ShowResponse/index.js.map +1 -1
- package/lib/esm/components/ShowResponse/responseUtils.js +43 -61
- package/lib/esm/components/ShowResponse/responseUtils.js.map +1 -1
- package/lib/esm/components/common/common.js +13 -4
- package/lib/esm/components/common/common.js.map +1 -1
- package/lib/esm/components/common/index.js +18 -1
- package/lib/esm/components/common/index.js.map +1 -1
- package/lib/esm/components/index.js +148 -13
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/index.js +49 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/test-data/index.js +68 -0
- package/lib/esm/test-data/index.js.map +1 -0
- package/lib/esm/test-data/responses.js +139 -0
- package/lib/esm/test-data/responses.js.map +1 -0
- package/lib/esm/test-data/specs.js +11 -0
- package/lib/esm/test-data/specs.js.map +1 -0
- package/lib/esm/utils/RunItSDK.js +25 -20
- package/lib/esm/utils/RunItSDK.js.map +1 -1
- package/lib/esm/utils/index.js +27 -2
- package/lib/esm/utils/index.js.map +1 -1
- package/lib/esm/utils/requestUtils.js +42 -64
- package/lib/esm/utils/requestUtils.js.map +1 -1
- package/lib/index.js +0 -8
- package/lib/index.js.map +1 -1
- package/lib/test-data/index.js +20 -22
- package/lib/test-data/index.js.map +1 -1
- package/lib/test-data/responses.js +1 -3
- package/lib/test-data/responses.js.map +1 -1
- package/lib/test-data/specs.js +0 -4
- package/lib/test-data/specs.js.map +1 -1
- package/lib/utils/RunItSDK.js +6 -15
- package/lib/utils/RunItSDK.js.map +1 -1
- package/lib/utils/index.js +0 -4
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/requestUtils.d.ts +1 -1
- package/lib/utils/requestUtils.js +4 -61
- package/lib/utils/requestUtils.js.map +1 -1
- package/package.json +20 -19
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/test-data/index.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 */\nexport {\n testImageResponse,\n testJsonResponse,\n testSqlResponse,\n testTextResponse,\n testHtmlResponse,\n testUnknownResponse,\n testErrorResponse,\n testBogusJsonResponse,\n testOneRowComplexJson,\n} from './responses'\nexport { api } from './specs'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA;AAWA"}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.testUnknownResponse = exports.testTextResponse = exports.testSqlResponse = exports.testOneRowComplexJson = exports.testJsonResponse = exports.testImageResponse = exports.testHtmlResponse = exports.testErrorResponse = exports.testBogusJsonResponse = void 0;
|
7
7
|
var testJsonResponse = {
|
8
8
|
method: 'GET',
|
9
9
|
url: 'https://some/json/data',
|
@@ -79,7 +79,6 @@ var testSqlResponse = {
|
|
79
79
|
responseCompleted: 2000
|
80
80
|
};
|
81
81
|
exports.testSqlResponse = testSqlResponse;
|
82
|
-
|
83
82
|
var testImageResponse = function testImageResponse() {
|
84
83
|
var contentType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'image/png';
|
85
84
|
return {
|
@@ -97,7 +96,6 @@ var testImageResponse = function testImageResponse() {
|
|
97
96
|
responseCompleted: 2000
|
98
97
|
};
|
99
98
|
};
|
100
|
-
|
101
99
|
exports.testImageResponse = testImageResponse;
|
102
100
|
var testUnknownResponse = {
|
103
101
|
method: 'GET',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"responses.js","names":["testJsonResponse","method","url","headers","contentType","ok","statusCode","statusMessage","body","Buffer","from","requestStarted","responseCompleted","testOneRowComplexJson","testTextResponse","testHtmlResponse","testSqlResponse","testImageResponse","testUnknownResponse","testErrorResponse","testBogusJsonResponse"],"sources":["../../src/test-data/responses.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 type { IRawResponse } from '@looker/sdk-rtl'\n\nexport const testJsonResponse: IRawResponse = {\n method: 'GET',\n url: 'https://some/json/data',\n headers: { 'content-type': 'application/json' },\n contentType: 'application/json',\n ok: true,\n statusCode: 200,\n statusMessage: 'OK',\n body: Buffer.from('[{\"key1\": \"value1\" }]'),\n requestStarted: 1000,\n responseCompleted: 2000,\n}\n\nexport const testOneRowComplexJson: IRawResponse = {\n method: 'GET',\n url: 'https://some/json/data',\n headers: { 'content-type': 'application/json' },\n contentType: 'application/json',\n ok: true,\n statusCode: 200,\n statusMessage: 'OK',\n body: Buffer.from(`{\n \"id\": 520,\n \"view\": \"orders\",\n \"fields\": [\n \"orders.id\",\n \"users.age\",\n \"users.city\"\n ],\n \"pivots\": [],\n \"fill_fields\": [],\n \"filters\": null,\n \"filter_expression\": \"\",\n \"sorts\": [],\n \"limit\": \"\",\n \"column_limit\": \"\",\n \"total\": null,\n \"row_total\": \"\",\n \"subtotals\": [],\n \"vis_config\": null,\n \"filter_config\": null,\n \"visible_ui_sections\": \"\",\n \"slug\": \"64zJjJw\",\n \"client_id\": \"zfn3SwIaaHbJTbsXSJ0JO7\",\n \"share_url\": \"https://localhost:9999/x/zfn3SwIaaHbJTbsXSJ0JO7\",\n \"expanded_share_url\": \"https://localhost:9999/explore/thelook/orders?fields=orders.id,users.age,users.city&origin=share-expanded\",\n \"url\": \"/explore/thelook/orders?fields=orders.id,users.age,users.city\",\n \"has_table_calculations\": false,\n \"model\": \"thelook\",\n \"dynamic_fields\": \"\",\n \"query_timezone\": \"\",\n \"quick_calcs\": null,\n \"analysis_config\": null,\n \"can\": {\n \"run\": true,\n \"see_results\": true,\n \"explore\": true,\n \"create\": true,\n \"show\": true,\n \"cost_estimate\": true,\n \"index\": true,\n \"see_lookml\": true,\n \"see_aggregate_table_lookml\": true,\n \"see_derived_table_lookml\": true,\n \"see_sql\": true,\n \"save\": true,\n \"generate_drill_links\": true,\n \"download\": true,\n \"download_unlimited\": true,\n \"use_custom_fields\": true,\n \"schedule\": true\n }\n}`),\n requestStarted: 1000,\n responseCompleted: 2000,\n}\n\nexport const testTextResponse: IRawResponse = {\n method: 'GET',\n url: 'https://some/text/data',\n headers: { 'content-type': 'text/plain;charset=utf-8' },\n contentType: 'text/plain;charset=utf-8',\n ok: true,\n statusCode: 200,\n statusMessage: 'OK',\n body: Buffer.from('some text data'),\n requestStarted: 1000,\n responseCompleted: 2000,\n}\n\nexport const testHtmlResponse: IRawResponse = {\n method: 'GET',\n url: `https://some/html`,\n headers: { 'content-type': 'text/html;charset=utf-8' },\n contentType: 'text/html;charset=utf-8',\n ok: true,\n statusCode: 200,\n statusMessage: 'OK',\n body: Buffer.from(\n '<table>\\n' +\n '<tr><th>Orders Created Date</th><th>Orders Count</th></tr>\\n' +\n '<tr><td>2019-12-22</td><td>39</td></tr>\\n' +\n '</table>'\n ),\n requestStarted: 1000,\n responseCompleted: 2000,\n}\n\nexport const testSqlResponse: IRawResponse = {\n method: 'GET',\n url: `https://some/sql`,\n headers: { 'content-type': 'application/sql' },\n contentType: 'application/sql',\n ok: true,\n statusCode: 200,\n statusMessage: 'OK',\n body: Buffer.from(`SELECT\n COUNT(DISTINCT products.id ) AS \\`products.count\\`\nFROM demo_db.inventory_items AS inventory_items\nLEFT JOIN demo_db.products AS products ON inventory_items.product_id = products.id\nLIMIT 500`),\n requestStarted: 1000,\n responseCompleted: 2000,\n}\n\nexport const testImageResponse = (contentType = 'image/png'): IRawResponse => ({\n method: 'GET',\n url: `http://${contentType}`,\n headers: { 'content-type': contentType },\n contentType,\n ok: true,\n statusCode: 200,\n statusMessage: 'OK',\n body: Buffer.from('some image data'),\n requestStarted: 1000,\n responseCompleted: 2000,\n})\n\nexport const testUnknownResponse: IRawResponse = {\n method: 'GET',\n url: 'http://bogus',\n headers: {},\n contentType: 'bogus',\n ok: true,\n statusCode: 200,\n statusMessage: 'OK',\n body: Buffer.from('some data'),\n requestStarted: 1000,\n responseCompleted: 2000,\n}\n\nexport const testErrorResponse: IRawResponse = {\n method: 'GET',\n url: 'http://error',\n headers: {},\n body: Buffer.from(\n '{\"message\": \"Not found\", \"documentation_url\": \"http://docs.looker.com\"}'\n ),\n contentType: 'text',\n ok: false,\n statusCode: 404,\n statusMessage: 'some status message',\n requestStarted: 1000,\n responseCompleted: 2000,\n}\n\nexport const testBogusJsonResponse: IRawResponse = {\n method: 'GET',\n url: 'https://some/json/data',\n headers: {},\n contentType: 'application/json',\n ok: true,\n statusCode: 200,\n statusMessage: 'OK',\n body: Buffer.from('<html><body>I AM A LYING JSON RESPONSE</body></html>'),\n requestStarted: 1000,\n responseCompleted: 2000,\n}\n"],"mappings":";;;;;;AA4BO,IAAMA,gBAA8B,GAAG;EAC5CC,MAAM,EAAE,KAAK;EACbC,GAAG,EAAE,wBAAwB;EAC7BC,OAAO,EAAE;IAAE,cAAc,EAAE;EAAmB,CAAC;EAC/CC,WAAW,EAAE,kBAAkB;EAC/BC,EAAE,EAAE,IAAI;EACRC,UAAU,EAAE,GAAG;EACfC,aAAa,EAAE,IAAI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AAyE,CAC1E;EACDN,WAAW,EAAE,MAAM;EACnBC,EAAE,EAAE,KAAK;EACTC,UAAU,EAAE,GAAG;EACfC,aAAa,EAAE,qBAAqB;EACpCI,cAAc,EAAE,IAAI;EACpBC,iBAAiB,EAAE;AACrB,CAAC;AAAA;AAEM,IAAMQ,qBAAmC,GAAG;EACjDnB,MAAM,EAAE,KAAK;EACbC,GAAG,EAAE,wBAAwB;EAC7BC,OAAO,EAAE,CAAC,CAAC;EACXC,WAAW,EAAE,kBAAkB;EAC/BC,EAAE,EAAE,IAAI;EACRC,UAAU,EAAE,GAAG;EACfC,aAAa,EAAE,IAAI;EACnBC,IAAI,EAAEC,MAAM,CAACC,IAAI,CAAC,sDAAsD,CAAC;EACzEC,cAAc,EAAE,IAAI;EACpBC,iBAAiB,EAAE;AACrB,CAAC;AAAA"}
|
package/lib/test-data/specs.js
CHANGED
@@ -4,12 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.api = void 0;
|
7
|
-
|
8
7
|
var _sdkCodegen = require("@looker/sdk-codegen");
|
9
|
-
|
10
8
|
var spec = require('../../../../spec/Looker.3.1.oas.json');
|
11
|
-
|
12
9
|
var api = _sdkCodegen.ApiModel.fromJson(spec);
|
13
|
-
|
14
10
|
exports.api = api;
|
15
11
|
//# sourceMappingURL=specs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"specs.js","names":["spec","require","api","ApiModel","fromJson"],"sources":["../../src/test-data/specs.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 */\nimport { ApiModel } from '@looker/sdk-codegen'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst spec = require('../../../../spec/Looker.3.1.oas.json')\n\nexport const api = ApiModel.fromJson(spec)\n"],"mappings":";;;;;;AAyBA;AAGA,IAAMA,IAAI,GAAGC,OAAO,CAAC,sCAAsC,CAAC;AAErD,IAAMC,GAAG,GAAGC,oBAAQ,CAACC,QAAQ,CAACJ,IAAI,CAAC;AAAA"}
|
package/lib/utils/RunItSDK.js
CHANGED
@@ -3,28 +3,21 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
7
|
-
|
6
|
+
exports.initRunItSdk = exports.StoreConstants = void 0;
|
8
7
|
var _sdkRtl = require("@looker/sdk-rtl");
|
9
|
-
|
10
8
|
var _sdk = require("@looker/sdk");
|
11
|
-
|
12
9
|
var _extensionUtils = require("@looker/extension-utils");
|
13
|
-
|
14
10
|
var _components = require("../components");
|
15
|
-
|
16
|
-
function
|
17
|
-
|
18
|
-
function
|
19
|
-
|
20
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
21
|
-
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
15
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
22
16
|
var initRunItSdk = () => {
|
23
17
|
var settings = _objectSpread(_objectSpread({}, (0, _sdkRtl.DefaultSettings)()), {}, {
|
24
18
|
base_url: 'https://self-signed.looker.com:19999',
|
25
19
|
agentTag: 'RunIt 0.8'
|
26
20
|
});
|
27
|
-
|
28
21
|
var options = new _extensionUtils.OAuthConfigProvider(settings, _components.RunItConfigKey);
|
29
22
|
var transport = new _sdkRtl.BrowserTransport(options);
|
30
23
|
var session = new _sdkRtl.BrowserSession(options, transport);
|
@@ -32,11 +25,9 @@ var initRunItSdk = () => {
|
|
32
25
|
_sdkRtl.BrowserTransport.trackPerformance = true;
|
33
26
|
return sdk;
|
34
27
|
};
|
35
|
-
|
36
28
|
exports.initRunItSdk = initRunItSdk;
|
37
29
|
var StoreConstants;
|
38
30
|
exports.StoreConstants = StoreConstants;
|
39
|
-
|
40
31
|
(function (StoreConstants) {
|
41
32
|
StoreConstants["LOCALSTORAGE_SETTINGS_KEY"] = "settings";
|
42
33
|
})(StoreConstants || (exports.StoreConstants = StoreConstants = {}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"RunItSDK.js","names":["initRunItSdk","settings","DefaultSettings","base_url","agentTag","options","OAuthConfigProvider","RunItConfigKey","transport","BrowserTransport","session","BrowserSession","sdk","functionalSdk40","trackPerformance","StoreConstants"],"sources":["../../src/utils/RunItSDK.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 type { IApiSettings } from '@looker/sdk-rtl'\nimport {\n BrowserSession,\n BrowserTransport,\n DefaultSettings,\n} from '@looker/sdk-rtl'\nimport { functionalSdk40 } from '@looker/sdk'\nimport { OAuthConfigProvider } from '@looker/extension-utils'\n\nimport { RunItConfigKey } from '../components'\n\nexport const initRunItSdk = () => {\n const settings = {\n ...DefaultSettings(),\n base_url: 'https://self-signed.looker.com:19999',\n agentTag: 'RunIt 0.8',\n } as IApiSettings\n\n const options = new OAuthConfigProvider(settings, RunItConfigKey)\n const transport = new BrowserTransport(options)\n const session = new BrowserSession(options, transport)\n const sdk = functionalSdk40(session)\n BrowserTransport.trackPerformance = true\n return sdk\n}\n\nexport enum StoreConstants {\n LOCALSTORAGE_SETTINGS_KEY = 'settings',\n}\n"],"mappings":";;;;;;AA2BA;AAKA;AACA;AAEA;AAA8C;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,YAAY,GAAG,MAAM;EAChC,IAAMC,QAAQ,mCACT,IAAAC,uBAAe,GAAE;IACpBC,QAAQ,EAAE,sCAAsC;IAChDC,QAAQ,EAAE;EAAW,EACN;EAEjB,IAAMC,OAAO,GAAG,IAAIC,mCAAmB,CAACL,QAAQ,EAAEM,0BAAc,CAAC;EACjE,IAAMC,SAAS,GAAG,IAAIC,wBAAgB,CAACJ,OAAO,CAAC;EAC/C,IAAMK,OAAO,GAAG,IAAIC,sBAAc,CAACN,OAAO,EAAEG,SAAS,CAAC;EACtD,IAAMI,GAAG,GAAG,IAAAC,oBAAe,EAACH,OAAO,CAAC;EACpCD,wBAAgB,CAACK,gBAAgB,GAAG,IAAI;EACxC,OAAOF,GAAG;AACZ,CAAC;AAAA;AAAA,IAEWG,cAAc;AAAA;AAAA,WAAdA,cAAc;EAAdA,cAAc;AAAA,GAAdA,cAAc,8BAAdA,cAAc"}
|
package/lib/utils/index.js
CHANGED
@@ -3,9 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
|
7
6
|
var _RunItSDK = require("./RunItSDK");
|
8
|
-
|
9
7
|
Object.keys(_RunItSDK).forEach(function (key) {
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
11
9
|
if (key in exports && exports[key] === _RunItSDK[key]) return;
|
@@ -16,9 +14,7 @@ Object.keys(_RunItSDK).forEach(function (key) {
|
|
16
14
|
}
|
17
15
|
});
|
18
16
|
});
|
19
|
-
|
20
17
|
var _requestUtils = require("./requestUtils");
|
21
|
-
|
22
18
|
Object.keys(_requestUtils).forEach(function (key) {
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
24
20
|
if (key in exports && exports[key] === _requestUtils[key]) return;
|
package/lib/utils/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.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 */\nexport * from './RunItSDK'\nexport * from './requestUtils'\n"],"mappings":";;;;;AAyBA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
@@ -7,6 +7,6 @@ export declare const pathify: (path: string, pathParams?: RunItValues | undefine
|
|
7
7
|
export declare const prepareInputs: (inputs: RunItInput[], requestContent: RunItValues) => RunItValues;
|
8
8
|
export declare const formValues: () => Promise<any>;
|
9
9
|
export declare const initRequestContent: (inputs: RunItInput[], requestContent?: {}) => {};
|
10
|
-
export declare const createRequestParams: (inputs: RunItInput[], requestContent: RunItValues) => any[];
|
10
|
+
export declare const createRequestParams: (inputs: RunItInput[], requestContent: RunItValues, keepBody?: boolean) => any[];
|
11
11
|
export declare const runRequest: (sdk: IAPIMethods, basePath: string, httpMethod: RunItHttpMethod, endpoint: string, pathParams: RunItValues, queryParams: RunItValues, body: any) => Promise<IRawResponse>;
|
12
12
|
export declare const createInputs: (spec: IApiModel, method: IMethod) => RunItInput[];
|
@@ -3,71 +3,48 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
7
|
-
|
6
|
+
exports.runRequest = exports.runItNoSet = exports.prepareInputs = exports.pathify = exports.initRequestContent = exports.formValues = exports.createRequestParams = exports.createInputs = void 0;
|
8
7
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
9
|
-
|
10
8
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
11
|
-
|
12
9
|
var _sdkCodegen = require("@looker/sdk-codegen");
|
13
|
-
|
14
10
|
var _extensionUtils = require("@looker/extension-utils");
|
15
|
-
|
16
11
|
var _components = require("../components");
|
17
|
-
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
-
|
20
13
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
21
|
-
|
22
14
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
23
|
-
|
24
15
|
var runItNoSet = value => value;
|
25
|
-
|
26
16
|
exports.runItNoSet = runItNoSet;
|
27
|
-
|
28
17
|
var macro = (path, vars) => path.replace(/{(\w+)}/g, (_, b) => vars[b]);
|
29
|
-
|
30
18
|
var pathify = (path, pathParams) => {
|
31
19
|
var result = path;
|
32
|
-
|
33
20
|
if (pathParams && path.includes('{')) {
|
34
21
|
result = macro(path, pathParams);
|
35
22
|
}
|
36
|
-
|
37
23
|
return result;
|
38
24
|
};
|
39
|
-
|
40
25
|
exports.pathify = pathify;
|
41
|
-
|
42
26
|
var prepareInputs = (inputs, requestContent) => {
|
43
27
|
var result = (0, _cloneDeep.default)(requestContent);
|
44
|
-
|
45
28
|
for (var input of inputs) {
|
46
29
|
var name = input.name;
|
47
|
-
|
48
30
|
if (input.location === 'body') {
|
49
31
|
try {
|
50
32
|
var parsed = void 0;
|
51
|
-
|
52
33
|
if (name in requestContent) {
|
53
34
|
var _value = requestContent[name];
|
54
35
|
parsed = typeof _value === 'string' ? JSON.parse(_value) : _value;
|
55
36
|
} else {
|
56
37
|
parsed = input.type;
|
57
38
|
}
|
58
|
-
|
59
39
|
result[name] = parsed;
|
60
40
|
} catch (e) {
|
61
41
|
result[name] = requestContent[name];
|
62
42
|
}
|
63
43
|
}
|
64
44
|
}
|
65
|
-
|
66
45
|
return result;
|
67
46
|
};
|
68
|
-
|
69
47
|
exports.prepareInputs = prepareInputs;
|
70
|
-
|
71
48
|
var formValues = function () {
|
72
49
|
var _ref = _asyncToGenerator(function* () {
|
73
50
|
var adaptor = (0, _extensionUtils.getEnvAdaptor)();
|
@@ -76,66 +53,51 @@ var formValues = function () {
|
|
76
53
|
adaptor.localStorageRemoveItem(_components.RunItFormKey);
|
77
54
|
return result;
|
78
55
|
});
|
79
|
-
|
80
56
|
return function formValues() {
|
81
57
|
return _ref.apply(this, arguments);
|
82
58
|
};
|
83
59
|
}();
|
84
|
-
|
85
60
|
exports.formValues = formValues;
|
86
|
-
|
87
61
|
var initRequestContent = function initRequestContent(inputs) {
|
88
62
|
var requestContent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
89
63
|
var content = {};
|
90
|
-
|
91
64
|
if ((0, _isEmpty.default)(content)) {
|
92
65
|
content = prepareInputs(inputs, requestContent);
|
93
66
|
}
|
94
|
-
|
95
67
|
return content;
|
96
68
|
};
|
97
|
-
|
98
69
|
exports.initRequestContent = initRequestContent;
|
99
|
-
|
100
|
-
var
|
70
|
+
var createRequestParams = function createRequestParams(inputs, requestContent) {
|
71
|
+
var keepBody = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
101
72
|
var pathParams = {};
|
102
73
|
var queryParams = {};
|
103
74
|
var prepped = prepareInputs(inputs, requestContent);
|
104
|
-
var trimmed = (0, _sdkCodegen.trimInputs)(prepped);
|
75
|
+
var trimmed = (0, _sdkCodegen.trimInputs)(prepped, keepBody);
|
105
76
|
var body;
|
106
|
-
|
107
77
|
for (var input of inputs) {
|
108
78
|
var name = input.name;
|
109
|
-
|
110
79
|
switch (input.location) {
|
111
80
|
case 'path':
|
112
81
|
pathParams[name] = trimmed[name];
|
113
82
|
break;
|
114
|
-
|
115
83
|
case 'query':
|
116
84
|
queryParams[name] = trimmed[name];
|
117
85
|
break;
|
118
|
-
|
119
86
|
case 'body':
|
120
87
|
body = trimmed[name];
|
121
88
|
break;
|
122
|
-
|
123
89
|
default:
|
124
90
|
throw new Error("Invalid input location: '".concat(input.location, "'"));
|
125
91
|
}
|
126
92
|
}
|
127
|
-
|
128
93
|
return [pathParams, queryParams, body];
|
129
94
|
};
|
130
|
-
|
131
95
|
exports.createRequestParams = createRequestParams;
|
132
|
-
|
133
96
|
var runRequest = function () {
|
134
97
|
var _ref2 = _asyncToGenerator(function* (sdk, basePath, httpMethod, endpoint, pathParams, queryParams, body) {
|
135
98
|
if (!sdk.authSession.isAuthenticated()) {
|
136
99
|
yield sdk.ok(sdk.authSession.login());
|
137
100
|
}
|
138
|
-
|
139
101
|
var url = "".concat(basePath).concat(pathify(endpoint, pathParams));
|
140
102
|
var requestStarted = Date.now();
|
141
103
|
var raw = yield sdk.authSession.transport.rawRequest(httpMethod, url, queryParams, body, props => sdk.authSession.authenticate(props));
|
@@ -144,27 +106,21 @@ var runRequest = function () {
|
|
144
106
|
if (!raw.responseCompleted) raw.responseCompleted = responseCompleted;
|
145
107
|
return raw;
|
146
108
|
});
|
147
|
-
|
148
109
|
return function runRequest(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
|
149
110
|
return _ref2.apply(this, arguments);
|
150
111
|
};
|
151
112
|
}();
|
152
|
-
|
153
113
|
exports.runRequest = runRequest;
|
154
|
-
|
155
114
|
var getTypeDefault = type => {
|
156
115
|
switch (type) {
|
157
116
|
case 'boolean':
|
158
117
|
return false;
|
159
|
-
|
160
118
|
case 'int64':
|
161
119
|
case 'integer':
|
162
120
|
return 0;
|
163
|
-
|
164
121
|
case 'float':
|
165
122
|
case 'double':
|
166
123
|
return 0.0;
|
167
|
-
|
168
124
|
case 'hostname':
|
169
125
|
case 'ipv4':
|
170
126
|
case 'ipv6':
|
@@ -173,21 +129,16 @@ var getTypeDefault = type => {
|
|
173
129
|
case 'string':
|
174
130
|
case 'email':
|
175
131
|
return '';
|
176
|
-
|
177
132
|
case 'string[]':
|
178
133
|
return [];
|
179
|
-
|
180
134
|
case 'object':
|
181
135
|
return {};
|
182
|
-
|
183
136
|
case 'datetime':
|
184
137
|
return '';
|
185
|
-
|
186
138
|
default:
|
187
139
|
return '';
|
188
140
|
}
|
189
141
|
};
|
190
|
-
|
191
142
|
var createSampleBody = (spec, type) => {
|
192
143
|
var getSampleValue = type => {
|
193
144
|
if (type instanceof _sdkCodegen.IntrinsicType) return getTypeDefault(type.name);
|
@@ -197,30 +148,23 @@ var createSampleBody = (spec, type) => {
|
|
197
148
|
if (type instanceof _sdkCodegen.HashType) return type.customType ? recurse(spec.types[type.customType]) : {};
|
198
149
|
return recurse(type);
|
199
150
|
};
|
200
|
-
|
201
151
|
var recurse = type => {
|
202
152
|
var sampleBody = {};
|
203
|
-
|
204
153
|
for (var prop of type.writeable) {
|
205
154
|
var sampleValue = getSampleValue(prop.type);
|
206
|
-
|
207
155
|
if (sampleValue !== undefined) {
|
208
156
|
sampleBody[prop.name] = sampleValue;
|
209
157
|
}
|
210
158
|
}
|
211
|
-
|
212
159
|
return sampleBody;
|
213
160
|
};
|
214
|
-
|
215
161
|
return recurse(type);
|
216
162
|
};
|
217
|
-
|
218
163
|
var editType = (spec, type) => {
|
219
164
|
if (type instanceof _sdkCodegen.IntrinsicType) return type.name;
|
220
165
|
if (type instanceof _sdkCodegen.DelimArrayType) return 'string';
|
221
166
|
return createSampleBody(spec, type);
|
222
167
|
};
|
223
|
-
|
224
168
|
var createInputs = (spec, method) => method.allParams.map(param => ({
|
225
169
|
name: param.name,
|
226
170
|
location: param.location,
|
@@ -228,6 +172,5 @@ var createInputs = (spec, method) => method.allParams.map(param => ({
|
|
228
172
|
required: param.required,
|
229
173
|
description: param.description
|
230
174
|
}));
|
231
|
-
|
232
175
|
exports.createInputs = createInputs;
|
233
176
|
//# sourceMappingURL=requestUtils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/utils/requestUtils.ts"],"names":["runItNoSet","value","macro","path","vars","replace","_","b","pathify","pathParams","result","includes","prepareInputs","inputs","requestContent","input","name","location","parsed","JSON","parse","type","e","formValues","adaptor","formValue","localStorageGetItem","RunItFormKey","localStorageRemoveItem","initRequestContent","content","createRequestParams","queryParams","prepped","trimmed","body","Error","runRequest","sdk","basePath","httpMethod","endpoint","authSession","isAuthenticated","ok","login","url","requestStarted","Date","now","raw","transport","rawRequest","props","authenticate","responseCompleted","getTypeDefault","createSampleBody","spec","getSampleValue","IntrinsicType","DelimArrayType","elementType","EnumType","ArrayType","customType","recurse","types","HashType","sampleBody","prop","writeable","sampleValue","undefined","editType","createInputs","method","allParams","map","param","required","description"],"mappings":";;;;;;;AA2BA;;AACA;;AAEA;;AAQA;;AAGA;;;;;;;;AASO,IAAMA,UAAuB,GAAIC,KAAD,IAAgBA,KAAhD;;;;AAQP,IAAMC,KAAK,GAAG,CAACC,IAAD,EAAeC,IAAf,KACZD,IAAI,CAACE,OAAL,CAAa,UAAb,EAAyB,CAACC,CAAD,EAAIC,CAAJ,KAAUH,IAAI,CAACG,CAAD,CAAvC,CADF;;AASO,IAAMC,OAAO,GAAG,CAACL,IAAD,EAAeM,UAAf,KAAoD;AACzE,MAAIC,MAAM,GAAGP,IAAb;;AACA,MAAIM,UAAU,IAAIN,IAAI,CAACQ,QAAL,CAAc,GAAd,CAAlB,EAAsC;AACpCD,IAAAA,MAAM,GAAGR,KAAK,CAACC,IAAD,EAAOM,UAAP,CAAd;AACD;;AACD,SAAOC,MAAP;AACD,CANM;;;;AAaA,IAAME,aAAa,GAAG,CAC3BC,MAD2B,EAE3BC,cAF2B,KAGxB;AACH,MAAMJ,MAAM,GAAG,wBAAUI,cAAV,CAAf;;AACA,OAAK,IAAMC,KAAX,IAAoBF,MAApB,EAA4B;AAC1B,QAAMG,IAAI,GAAGD,KAAK,CAACC,IAAnB;;AACA,QAAID,KAAK,CAACE,QAAN,KAAmB,MAAvB,EAA+B;AAC7B,UAAI;AACF,YAAIC,MAAM,SAAV;;AACA,YAAIF,IAAI,IAAIF,cAAZ,EAA4B;AAC1B,cAAMb,MAAK,GAAGa,cAAc,CAACE,IAAD,CAA5B;AAIAE,UAAAA,MAAM,GAAG,OAAOjB,MAAP,KAAiB,QAAjB,GAA4BkB,IAAI,CAACC,KAAL,CAAWnB,MAAX,CAA5B,GAAgDA,MAAzD;AACD,SAND,MAMO;AAELiB,UAAAA,MAAM,GAAGH,KAAK,CAACM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,EAAEF,KAAK,CAACE;AALY,CAAZ,CAArB,CADK","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 type { IAPIMethods, IRawResponse } from '@looker/sdk-rtl'\nimport cloneDeep from 'lodash/cloneDeep'\nimport isEmpty from 'lodash/isEmpty'\nimport type { IApiModel, IMethod, IType } from '@looker/sdk-codegen'\nimport {\n ArrayType,\n DelimArrayType,\n EnumType,\n HashType,\n IntrinsicType,\n trimInputs,\n} from '@looker/sdk-codegen'\nimport { getEnvAdaptor } from '@looker/extension-utils'\n\nimport type { RunItHttpMethod, RunItInput, RunItValues } from '../RunIt'\nimport { RunItFormKey } from '../components'\n\n/** Hook to set a URL somewhere else in APIX */\nexport type RunItSetter = (value: any) => any\n\n/**\n * A \"no-op\" function\n * @param value passed through\n */\nexport const runItNoSet: RunItSetter = (value: any) => value\n\n/**\n * Replaces {foo} with vars[foo] in provided path\n * @param path with templatized param names\n * @param vars Collection of path params\n * @returns Path with param names replaced with values\n */\nconst macro = (path: string, vars: RunItValues) =>\n path.replace(/{(\\w+)}/g, (_, b) => vars[b])\n\n/**\n * Construct a full request path including path params\n * @param path A request path with path params in curly braces e.g. /queries/{query_id}/run/{result_format}\n * @param pathParams Collection of path params\n * @returns a full request path\n */\nexport const pathify = (path: string, pathParams?: RunItValues): string => {\n let result = path\n if (pathParams && path.includes('{')) {\n result = macro(path, pathParams)\n }\n return result\n}\n\n/**\n * Prepares the inputs for use with the SDK and other RunIt components\n * @param inputs An array describing RunIt form inputs\n * @param requestContent Current request parameters\n */\nexport const prepareInputs = (\n inputs: RunItInput[],\n requestContent: RunItValues\n) => {\n const result = cloneDeep(requestContent)\n for (const input of inputs) {\n const name = input.name\n if (input.location === 'body') {\n try {\n let parsed\n if (name in requestContent) {\n const value = requestContent[name]\n /** The value is not a string when the user has not interacted with this param and prepareInputs has been\n * called (e.g. if user navigates to the Code tab).\n */\n parsed = typeof value === 'string' ? JSON.parse(value) : value\n } else {\n /** This scenario occurs when RunIt is about to be mounted for a new method */\n parsed = input.type\n }\n result[name] = parsed\n } catch (e) {\n /** Treat as x-www-form-urlencoded */\n result[name] = requestContent[name]\n }\n }\n }\n return result\n}\n\n/**\n * Load and clear any saved form values from the session\n * @param configurator storage service\n */\nexport const formValues = async () => {\n const adaptor = getEnvAdaptor()\n const formValue = await adaptor.localStorageGetItem(RunItFormKey)\n const result = formValue ? JSON.parse(formValue) : {}\n adaptor.localStorageRemoveItem(RunItFormKey)\n return result\n}\n\n/**\n * Initializes the request content object from local storage or input definitions, in that order\n * @param configurator storage service\n * @param inputs\n * @param requestContent the current request content\n */\nexport const initRequestContent = (\n inputs: RunItInput[],\n requestContent = {}\n) => {\n // TODO: Temporarily disabling request form state persistence until RunIt is using redux\n // let content = await formValues()\n let content = {}\n if (isEmpty(content)) {\n content = prepareInputs(inputs, requestContent)\n }\n return content\n}\n\n/**\n * Takes all form input values and categorizes them based on their request location\n * @param inputs RunIt form inputs\n * @param requestContent Form input values\n * @returns path, query and body param objects\n */\nexport const createRequestParams = (\n inputs: RunItInput[],\n requestContent: RunItValues\n) => {\n const pathParams = {}\n const queryParams = {}\n const prepped = prepareInputs(inputs, requestContent)\n const trimmed = trimInputs(prepped)\n let body\n for (const input of inputs) {\n const name = input.name\n switch (input.location) {\n case 'path':\n pathParams[name] = trimmed[name]\n break\n case 'query':\n queryParams[name] = trimmed[name]\n break\n case 'body':\n body = trimmed[name]\n break\n default:\n throw new Error(`Invalid input location: '${input.location}'`)\n }\n }\n return [pathParams, queryParams, body]\n}\n\n/**\n * Makes an http request using the SDK browser transport rawRequest method\n * @param sdk functional SDK that supports rawRequest via its transport\n * @param basePath base path for the URL. For standalone this includes the specKey. Empty for extension.\n * @param httpMethod Request operation\n * @param endpoint Request path with path params in curly braces e.g. /queries/{query_id}/run/{result_format}\n * @param pathParams Collection of path params\n * @param queryParams Collection of query params\n * @param body Collection of body params\n */\nexport const runRequest = async (\n sdk: IAPIMethods,\n basePath: string,\n httpMethod: RunItHttpMethod,\n endpoint: string,\n pathParams: RunItValues,\n queryParams: RunItValues,\n body: any\n): Promise<IRawResponse> => {\n if (!sdk.authSession.isAuthenticated()) {\n await sdk.ok(sdk.authSession.login())\n }\n const url = `${basePath}${pathify(endpoint, pathParams)}`\n const requestStarted = Date.now()\n const raw = await sdk.authSession.transport.rawRequest(\n httpMethod,\n url,\n queryParams,\n body,\n (props) => sdk.authSession.authenticate(props)\n )\n const responseCompleted = Date.now()\n // populate timing info if it's not already provided by the transport\n if (!raw.requestStarted) raw.requestStarted = requestStarted\n if (!raw.responseCompleted) raw.responseCompleted = responseCompleted\n return raw\n}\n\n/**\n * Return a default value for a given type name\n * @param type A type name\n */\nconst getTypeDefault = (type: string) => {\n // TODO: use potential equivalent from sdk-codegen, confirm formats\n switch (type) {\n case 'boolean':\n return false\n case 'int64':\n case 'integer':\n return 0\n case 'float':\n case 'double':\n return 0.0\n case 'hostname':\n case 'ipv4':\n case 'ipv6':\n case 'uuid':\n case 'uri':\n case 'string':\n case 'email':\n return ''\n case 'string[]':\n return []\n case 'object':\n return {}\n case 'datetime':\n return ''\n default:\n return ''\n }\n}\n\n/**\n * Given a type object reduce it to its writeable intrinsic and/or custom type properties and their default values\n * @param spec Api spec\n * @param type A type object\n */\nconst createSampleBody = (spec: IApiModel, type: IType) => {\n /* eslint-disable @typescript-eslint/no-use-before-define */\n const getSampleValue = (type: IType) => {\n if (type instanceof IntrinsicType) return getTypeDefault(type.name)\n if (type instanceof DelimArrayType)\n return getTypeDefault(type.elementType.name)\n if (type instanceof EnumType) return ''\n if (type instanceof ArrayType)\n return type.customType\n ? [recurse(spec.types[type.customType])]\n : getTypeDefault(type.name)\n if (type instanceof HashType)\n return type.customType ? recurse(spec.types[type.customType]) : {}\n\n return recurse(type)\n }\n /* eslint-enable @typescript-eslint/no-use-before-define */\n\n const recurse = (type: IType) => {\n const sampleBody: RunItValues = {}\n for (const prop of type.writeable) {\n const sampleValue = getSampleValue(prop.type)\n if (sampleValue !== undefined) {\n sampleBody[prop.name] = sampleValue\n }\n }\n return sampleBody\n }\n return recurse(type)\n}\n\n/**\n * Convert model type to an editable type\n * @param spec API model for building input editor\n * @param type to convert\n */\nconst editType = (spec: IApiModel, type: IType) => {\n if (type instanceof IntrinsicType) return type.name\n // TODO create a DelimArray editing component as part of the complex type editor\n if (type instanceof DelimArrayType) return 'string'\n return createSampleBody(spec, type)\n}\n\n/**\n * Given an SDK method create and return an array of inputs for the run-it form\n * @param spec Api spec\n * @param method A method object\n */\nexport const createInputs = (spec: IApiModel, method: IMethod): RunItInput[] =>\n method.allParams.map((param) => ({\n name: param.name,\n location: param.location,\n type: editType(spec, param.type),\n required: param.required,\n description: param.description,\n }))\n"],"file":"requestUtils.js"}
|
1
|
+
{"version":3,"file":"requestUtils.js","names":["runItNoSet","value","macro","path","vars","replace","_","b","pathify","pathParams","result","includes","prepareInputs","inputs","requestContent","cloneDeep","input","name","location","parsed","JSON","parse","type","e","formValues","adaptor","getEnvAdaptor","formValue","localStorageGetItem","RunItFormKey","localStorageRemoveItem","initRequestContent","content","isEmpty","createRequestParams","keepBody","queryParams","prepped","trimmed","trimInputs","body","Error","runRequest","sdk","basePath","httpMethod","endpoint","authSession","isAuthenticated","ok","login","url","requestStarted","Date","now","raw","transport","rawRequest","props","authenticate","responseCompleted","getTypeDefault","createSampleBody","spec","getSampleValue","IntrinsicType","DelimArrayType","elementType","EnumType","ArrayType","customType","recurse","types","HashType","sampleBody","prop","writeable","sampleValue","undefined","editType","createInputs","method","allParams","map","param","required","description"],"sources":["../../src/utils/requestUtils.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 type { IAPIMethods, IRawResponse } from '@looker/sdk-rtl'\nimport cloneDeep from 'lodash/cloneDeep'\nimport isEmpty from 'lodash/isEmpty'\nimport type { IApiModel, IMethod, IType } from '@looker/sdk-codegen'\nimport {\n ArrayType,\n DelimArrayType,\n EnumType,\n HashType,\n IntrinsicType,\n trimInputs,\n} from '@looker/sdk-codegen'\nimport { getEnvAdaptor } from '@looker/extension-utils'\n\nimport type { RunItHttpMethod, RunItInput, RunItValues } from '../RunIt'\nimport { RunItFormKey } from '../components'\n\n/** Hook to set a URL somewhere else in APIX */\nexport type RunItSetter = (value: any) => any\n\n/**\n * A \"no-op\" function\n * @param value passed through\n */\nexport const runItNoSet: RunItSetter = (value: any) => value\n\n/**\n * Replaces {foo} with vars[foo] in provided path\n * @param path with templatized param names\n * @param vars Collection of path params\n * @returns Path with param names replaced with values\n */\nconst macro = (path: string, vars: RunItValues) =>\n path.replace(/{(\\w+)}/g, (_, b) => vars[b])\n\n/**\n * Construct a full request path including path params\n * @param path A request path with path params in curly braces e.g. /queries/{query_id}/run/{result_format}\n * @param pathParams Collection of path params\n * @returns a full request path\n */\nexport const pathify = (path: string, pathParams?: RunItValues): string => {\n let result = path\n if (pathParams && path.includes('{')) {\n result = macro(path, pathParams)\n }\n return result\n}\n\n/**\n * Prepares the inputs for use with the SDK and other RunIt components\n * @param inputs An array describing RunIt form inputs\n * @param requestContent Current request parameters\n */\nexport const prepareInputs = (\n inputs: RunItInput[],\n requestContent: RunItValues\n) => {\n const result = cloneDeep(requestContent)\n for (const input of inputs) {\n const name = input.name\n if (input.location === 'body') {\n try {\n let parsed\n if (name in requestContent) {\n const value = requestContent[name]\n /** The value is not a string when the user has not interacted with this param and prepareInputs has been\n * called (e.g. if user navigates to the Code tab).\n */\n parsed = typeof value === 'string' ? JSON.parse(value) : value\n } else {\n /** This scenario occurs when RunIt is about to be mounted for a new method */\n parsed = input.type\n }\n result[name] = parsed\n } catch (e) {\n /** Treat as x-www-form-urlencoded */\n result[name] = requestContent[name]\n }\n }\n }\n return result\n}\n\n/**\n * Load and clear any saved form values from the session\n * @param configurator storage service\n */\nexport const formValues = async () => {\n const adaptor = getEnvAdaptor()\n const formValue = await adaptor.localStorageGetItem(RunItFormKey)\n const result = formValue ? JSON.parse(formValue) : {}\n adaptor.localStorageRemoveItem(RunItFormKey)\n return result\n}\n\n/**\n * Initializes the request content object from local storage or input definitions, in that order\n * @param configurator storage service\n * @param inputs\n * @param requestContent the current request content\n */\nexport const initRequestContent = (\n inputs: RunItInput[],\n requestContent = {}\n) => {\n // TODO: Temporarily disabling request form state persistence until RunIt is using redux\n // let content = await formValues()\n let content = {}\n if (isEmpty(content)) {\n content = prepareInputs(inputs, requestContent)\n }\n return content\n}\n\n/**\n * Takes all form input values and categorizes them based on their request location\n * @param inputs RunIt form inputs\n * @param requestContent Form input values\n * @param keepBody true to keep body as is. false trims body values (default)\n * @returns path, query and body param objects\n */\nexport const createRequestParams = (\n inputs: RunItInput[],\n requestContent: RunItValues,\n keepBody = false\n) => {\n const pathParams = {}\n const queryParams = {}\n const prepped = prepareInputs(inputs, requestContent)\n const trimmed = trimInputs(prepped, keepBody)\n let body\n for (const input of inputs) {\n const name = input.name\n switch (input.location) {\n case 'path':\n pathParams[name] = trimmed[name]\n break\n case 'query':\n queryParams[name] = trimmed[name]\n break\n case 'body':\n body = trimmed[name]\n break\n default:\n throw new Error(`Invalid input location: '${input.location}'`)\n }\n }\n return [pathParams, queryParams, body]\n}\n\n/**\n * Makes an http request using the SDK browser transport rawRequest method\n * @param sdk functional SDK that supports rawRequest via its transport\n * @param basePath base path for the URL. For standalone this includes the specKey. Empty for extension.\n * @param httpMethod Request operation\n * @param endpoint Request path with path params in curly braces e.g. /queries/{query_id}/run/{result_format}\n * @param pathParams Collection of path params\n * @param queryParams Collection of query params\n * @param body Collection of body params\n */\nexport const runRequest = async (\n sdk: IAPIMethods,\n basePath: string,\n httpMethod: RunItHttpMethod,\n endpoint: string,\n pathParams: RunItValues,\n queryParams: RunItValues,\n body: any\n): Promise<IRawResponse> => {\n if (!sdk.authSession.isAuthenticated()) {\n await sdk.ok(sdk.authSession.login())\n }\n const url = `${basePath}${pathify(endpoint, pathParams)}`\n const requestStarted = Date.now()\n const raw = await sdk.authSession.transport.rawRequest(\n httpMethod,\n url,\n queryParams,\n body,\n (props) => sdk.authSession.authenticate(props)\n )\n const responseCompleted = Date.now()\n // populate timing info if it's not already provided by the transport\n if (!raw.requestStarted) raw.requestStarted = requestStarted\n if (!raw.responseCompleted) raw.responseCompleted = responseCompleted\n return raw\n}\n\n/**\n * Return a default value for a given type name\n * @param type A type name\n */\nconst getTypeDefault = (type: string) => {\n // TODO: use potential equivalent from sdk-codegen, confirm formats\n switch (type) {\n case 'boolean':\n return false\n case 'int64':\n case 'integer':\n return 0\n case 'float':\n case 'double':\n return 0.0\n case 'hostname':\n case 'ipv4':\n case 'ipv6':\n case 'uuid':\n case 'uri':\n case 'string':\n case 'email':\n return ''\n case 'string[]':\n return []\n case 'object':\n return {}\n case 'datetime':\n return ''\n default:\n return ''\n }\n}\n\n/**\n * Given a type object reduce it to its writeable intrinsic and/or custom type properties and their default values\n * @param spec Api spec\n * @param type A type object\n */\nconst createSampleBody = (spec: IApiModel, type: IType) => {\n /* eslint-disable @typescript-eslint/no-use-before-define */\n const getSampleValue = (type: IType) => {\n if (type instanceof IntrinsicType) return getTypeDefault(type.name)\n if (type instanceof DelimArrayType)\n return getTypeDefault(type.elementType.name)\n if (type instanceof EnumType) return ''\n if (type instanceof ArrayType)\n return type.customType\n ? [recurse(spec.types[type.customType])]\n : getTypeDefault(type.name)\n if (type instanceof HashType)\n return type.customType ? recurse(spec.types[type.customType]) : {}\n\n return recurse(type)\n }\n /* eslint-enable @typescript-eslint/no-use-before-define */\n\n const recurse = (type: IType) => {\n const sampleBody: RunItValues = {}\n for (const prop of type.writeable) {\n const sampleValue = getSampleValue(prop.type)\n if (sampleValue !== undefined) {\n sampleBody[prop.name] = sampleValue\n }\n }\n return sampleBody\n }\n return recurse(type)\n}\n\n/**\n * Convert model type to an editable type\n * @param spec API model for building input editor\n * @param type to convert\n */\nconst editType = (spec: IApiModel, type: IType) => {\n if (type instanceof IntrinsicType) return type.name\n // TODO create a DelimArray editing component as part of the complex type editor\n if (type instanceof DelimArrayType) return 'string'\n return createSampleBody(spec, type)\n}\n\n/**\n * Given an SDK method create and return an array of inputs for the run-it form\n * @param spec Api spec\n * @param method A method object\n */\nexport const createInputs = (spec: IApiModel, method: IMethod): RunItInput[] =>\n method.allParams.map((param) => ({\n name: param.name,\n location: param.location,\n type: editType(spec, param.type),\n required: param.required,\n description: param.description,\n }))\n"],"mappings":";;;;;;AA2BA;AACA;AAEA;AAQA;AAGA;AAA4C;AAAA;AAAA;AASrC,IAAMA,UAAuB,GAAIC,KAAU,IAAKA,KAAK;AAAA;AAQ5D,IAAMC,KAAK,GAAG,CAACC,IAAY,EAAEC,IAAiB,KAC5CD,IAAI,CAACE,OAAO,CAAC,UAAU,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKH,IAAI,CAACG,CAAC,CAAC,CAAC;AAQtC,IAAMC,OAAO,GAAG,CAACL,IAAY,EAAEM,UAAwB,KAAa;EACzE,IAAIC,MAAM,GAAGP,IAAI;EACjB,IAAIM,UAAU,IAAIN,IAAI,CAACQ,QAAQ,CAAC,GAAG,CAAC,EAAE;IACpCD,MAAM,GAAGR,KAAK,CAACC,IAAI,EAAEM,UAAU,CAAC;EAClC;EACA,OAAOC,MAAM;AACf,CAAC;AAAA;AAOM,IAAME,aAAa,GAAG,CAC3BC,MAAoB,EACpBC,cAA2B,KACxB;EACH,IAAMJ,MAAM,GAAG,IAAAK,kBAAS,EAACD,cAAc,CAAC;EACxC,KAAK,IAAME,KAAK,IAAIH,MAAM,EAAE;IAC1B,IAAMI,IAAI,GAAGD,KAAK,CAACC,IAAI;IACvB,IAAID,KAAK,CAACE,QAAQ,KAAK,MAAM,EAAE;MAC7B,IAAI;QACF,IAAIC,MAAM;QACV,IAAIF,IAAI,IAAIH,cAAc,EAAE;UAC1B,IAAMb,MAAK,GAAGa,cAAc,CAACG,IAAI,CAAC;UAIlCE,MAAM,GAAG,OAAOlB,MAAK,KAAK,QAAQ,GAAGmB,IAAI,CAACC,KAAK,CAACpB,MAAK,CAAC,GAAGA,MAAK;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C,QAAQ;EACxBC,WAAW,EAAEF,KAAK,CAACE;AACrB,CAAC,CAAC,CAAC;AAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@looker/run-it",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.44",
|
4
4
|
"description": "A dynamic REST request input form and response visualizer",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib/esm/index.js",
|
@@ -25,52 +25,53 @@
|
|
25
25
|
"url": "https://github.com/looker-open-source/sdk-codegen/issues?q=is%3Aopen+is%3Aissue+project%3Alooker-open-source%2Fsdk-codegen%2F7"
|
26
26
|
},
|
27
27
|
"scripts": {
|
28
|
-
"play": "webpack-dev-server --https --
|
28
|
+
"play": "webpack-dev-server --https --no-firewall --config webpack.dev.config.js --entry ./playground/index.tsx",
|
29
29
|
"test": "jest",
|
30
30
|
"watch": "yarn lerna exec --scope @looker/run-it --stream 'BABEL_ENV=build babel src --root-mode upward --out-dir lib/esm --source-maps --extensions .ts,.tsx --no-comments --watch'"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
33
|
-
"@looker/components-test-utils": "^1.5.
|
34
|
-
"@testing-library/jest-dom": "^5.
|
33
|
+
"@looker/components-test-utils": "^1.5.27",
|
34
|
+
"@testing-library/jest-dom": "^5.16.5",
|
35
35
|
"@testing-library/react": "^11.2.2",
|
36
36
|
"@testing-library/user-event": "^12.6.0",
|
37
37
|
"@types/lodash": "^4.14.157",
|
38
|
-
"@types/papaparse": "^5.
|
38
|
+
"@types/papaparse": "^5.3.7",
|
39
39
|
"@types/react": "^16.14.2",
|
40
40
|
"@types/react-dom": "^16.9.6",
|
41
41
|
"@types/react-router": "^5.1.11",
|
42
42
|
"@types/react-router-dom": "^5.1.5",
|
43
43
|
"@types/react-test-renderer": "^17.0.0",
|
44
|
+
"@types/readable-stream": "^2.3.5",
|
44
45
|
"@types/styled-components": "^5.1.7",
|
46
|
+
"@types/styled-system": "5.1.13",
|
45
47
|
"enzyme": "^3.11.0",
|
46
|
-
"jest-config": "^
|
48
|
+
"jest-config": "^29.4.1",
|
47
49
|
"react-router-dom": "^5.2.0",
|
48
50
|
"react-test-renderer": "^17.0.1",
|
49
51
|
"style-loader": "^1.1.3",
|
50
52
|
"webpack-cli": "^4.6.0",
|
51
|
-
"webpack-dev-server": "^
|
53
|
+
"webpack-dev-server": "^4.11.1"
|
52
54
|
},
|
53
55
|
"dependencies": {
|
54
|
-
"@looker/code-editor": "^0.1.
|
55
|
-
"@looker/components": "^
|
56
|
-
"@looker/design-tokens": "^
|
57
|
-
"@looker/extension-utils": "^0.1.
|
58
|
-
"@looker/icons": "^1.5.
|
59
|
-
"@looker/sdk": "^
|
60
|
-
"@looker/sdk-codegen": "^21.
|
56
|
+
"@looker/code-editor": "^0.1.28",
|
57
|
+
"@looker/components": "^4.1.1",
|
58
|
+
"@looker/design-tokens": "^3.1.0",
|
59
|
+
"@looker/extension-utils": "^0.1.21",
|
60
|
+
"@looker/icons": "^1.5.21",
|
61
|
+
"@looker/sdk": "^23.2.0",
|
62
|
+
"@looker/sdk-codegen": "^21.8.0",
|
61
63
|
"@looker/sdk-codegen-utils": "^21.0.11",
|
62
|
-
"@looker/sdk-rtl": "^21.
|
64
|
+
"@looker/sdk-rtl": "^21.6.0",
|
63
65
|
"@styled-icons/material": "^10.28.0",
|
64
66
|
"@styled-icons/material-outlined": "^10.28.0",
|
65
67
|
"@styled-icons/material-rounded": "^10.28.0",
|
66
|
-
"@types/readable-stream": "^2.3.5",
|
67
68
|
"lodash": "^4.17.19",
|
68
69
|
"papaparse": "^5.3.0",
|
69
|
-
"react": "^16.
|
70
|
-
"react-dom": "^16.
|
70
|
+
"react": "^16.14.0",
|
71
|
+
"react-dom": "^16.14.0",
|
71
72
|
"react-google-charts": "^3.0.15",
|
72
73
|
"react-is": "^16.13.1",
|
73
74
|
"styled-components": "^5.2.1"
|
74
75
|
},
|
75
|
-
"gitHead": "
|
76
|
+
"gitHead": "72979076f633ebded42df7679bbd07813d5d6bbc"
|
76
77
|
}
|