@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
@@ -0,0 +1 @@
|
|
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;EACnBC,IAAI,EAAEC,MAAM,CAACC,IAAI,CAAC,uBAAuB,CAAC;EAC1CC,cAAc,EAAE,IAAI;EACpBC,iBAAiB,EAAE;AACrB,CAAC;AAAA;AAEM,IAAMC,qBAAmC,GAAG;EACjDZ,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;EACnBC,IAAI,EAAEC,MAAM,CAACC,IAAI,48CAmDhB;EACDC,cAAc,EAAE,IAAI;EACpBC,iBAAiB,EAAE;AACrB,CAAC;AAAA;AAEM,IAAME,gBAA8B,GAAG;EAC5C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AC;AAAA"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.api = void 0;
|
7
|
+
var _sdkCodegen = require("@looker/sdk-codegen");
|
8
|
+
var spec = require('../../../../spec/Looker.3.1.oas.json');
|
9
|
+
var api = _sdkCodegen.ApiModel.fromJson(spec);
|
10
|
+
exports.api = api;
|
11
|
+
//# sourceMappingURL=specs.js.map
|
@@ -0,0 +1 @@
|
|
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"}
|
@@ -1,29 +1,34 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.initRunItSdk = exports.StoreConstants = void 0;
|
7
|
+
var _sdkRtl = require("@looker/sdk-rtl");
|
8
|
+
var _sdk = require("@looker/sdk");
|
9
|
+
var _extensionUtils = require("@looker/extension-utils");
|
10
|
+
var _components = require("../components");
|
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); }
|
16
|
+
var initRunItSdk = () => {
|
17
|
+
var settings = _objectSpread(_objectSpread({}, (0, _sdkRtl.DefaultSettings)()), {}, {
|
13
18
|
base_url: 'https://self-signed.looker.com:19999',
|
14
19
|
agentTag: 'RunIt 0.8'
|
15
20
|
});
|
16
|
-
|
17
|
-
var
|
18
|
-
var
|
19
|
-
var
|
20
|
-
|
21
|
-
BrowserTransport.trackPerformance = true;
|
21
|
+
var options = new _extensionUtils.OAuthConfigProvider(settings, _components.RunItConfigKey);
|
22
|
+
var transport = new _sdkRtl.BrowserTransport(options);
|
23
|
+
var session = new _sdkRtl.BrowserSession(options, transport);
|
24
|
+
var sdk = (0, _sdk.functionalSdk40)(session);
|
25
|
+
_sdkRtl.BrowserTransport.trackPerformance = true;
|
22
26
|
return sdk;
|
23
27
|
};
|
24
|
-
|
25
|
-
|
28
|
+
exports.initRunItSdk = initRunItSdk;
|
29
|
+
var StoreConstants;
|
30
|
+
exports.StoreConstants = StoreConstants;
|
26
31
|
(function (StoreConstants) {
|
27
32
|
StoreConstants["LOCALSTORAGE_SETTINGS_KEY"] = "settings";
|
28
|
-
})(StoreConstants || (StoreConstants = {}));
|
33
|
+
})(StoreConstants || (exports.StoreConstants = StoreConstants = {}));
|
29
34
|
//# sourceMappingURL=RunItSDK.js.map
|
@@ -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/esm/utils/index.js
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _RunItSDK = require("./RunItSDK");
|
7
|
+
Object.keys(_RunItSDK).forEach(function (key) {
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
9
|
+
if (key in exports && exports[key] === _RunItSDK[key]) return;
|
10
|
+
Object.defineProperty(exports, key, {
|
11
|
+
enumerable: true,
|
12
|
+
get: function get() {
|
13
|
+
return _RunItSDK[key];
|
14
|
+
}
|
15
|
+
});
|
16
|
+
});
|
17
|
+
var _requestUtils = require("./requestUtils");
|
18
|
+
Object.keys(_requestUtils).forEach(function (key) {
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
20
|
+
if (key in exports && exports[key] === _requestUtils[key]) return;
|
21
|
+
Object.defineProperty(exports, key, {
|
22
|
+
enumerable: true,
|
23
|
+
get: function get() {
|
24
|
+
return _requestUtils[key];
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
3
28
|
//# sourceMappingURL=index.js.map
|
@@ -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"}
|
@@ -1,110 +1,103 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.runRequest = exports.runItNoSet = exports.prepareInputs = exports.pathify = exports.initRequestContent = exports.formValues = exports.createRequestParams = exports.createInputs = void 0;
|
7
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
8
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
9
|
+
var _sdkCodegen = require("@looker/sdk-codegen");
|
10
|
+
var _extensionUtils = require("@looker/extension-utils");
|
11
|
+
var _components = require("../components");
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1
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); } }
|
2
|
-
|
3
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); }); }; }
|
4
|
-
|
5
|
-
|
6
|
-
import isEmpty from 'lodash/isEmpty';
|
7
|
-
import { ArrayType, DelimArrayType, EnumType, HashType, IntrinsicType, trimInputs } from '@looker/sdk-codegen';
|
8
|
-
import { getEnvAdaptor } from '@looker/extension-utils';
|
9
|
-
import { RunItFormKey } from '../components';
|
10
|
-
export var runItNoSet = value => value;
|
11
|
-
|
15
|
+
var runItNoSet = value => value;
|
16
|
+
exports.runItNoSet = runItNoSet;
|
12
17
|
var macro = (path, vars) => path.replace(/{(\w+)}/g, (_, b) => vars[b]);
|
13
|
-
|
14
|
-
export var pathify = (path, pathParams) => {
|
18
|
+
var pathify = (path, pathParams) => {
|
15
19
|
var result = path;
|
16
|
-
|
17
20
|
if (pathParams && path.includes('{')) {
|
18
21
|
result = macro(path, pathParams);
|
19
22
|
}
|
20
|
-
|
21
23
|
return result;
|
22
24
|
};
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
exports.pathify = pathify;
|
26
|
+
var prepareInputs = (inputs, requestContent) => {
|
27
|
+
var result = (0, _cloneDeep.default)(requestContent);
|
26
28
|
for (var input of inputs) {
|
27
29
|
var name = input.name;
|
28
|
-
|
29
30
|
if (input.location === 'body') {
|
30
31
|
try {
|
31
32
|
var parsed = void 0;
|
32
|
-
|
33
33
|
if (name in requestContent) {
|
34
34
|
var _value = requestContent[name];
|
35
35
|
parsed = typeof _value === 'string' ? JSON.parse(_value) : _value;
|
36
36
|
} else {
|
37
37
|
parsed = input.type;
|
38
38
|
}
|
39
|
-
|
40
39
|
result[name] = parsed;
|
41
40
|
} catch (e) {
|
42
41
|
result[name] = requestContent[name];
|
43
42
|
}
|
44
43
|
}
|
45
44
|
}
|
46
|
-
|
47
45
|
return result;
|
48
46
|
};
|
49
|
-
|
47
|
+
exports.prepareInputs = prepareInputs;
|
48
|
+
var formValues = function () {
|
50
49
|
var _ref = _asyncToGenerator(function* () {
|
51
|
-
var adaptor = getEnvAdaptor();
|
52
|
-
var formValue = yield adaptor.localStorageGetItem(RunItFormKey);
|
50
|
+
var adaptor = (0, _extensionUtils.getEnvAdaptor)();
|
51
|
+
var formValue = yield adaptor.localStorageGetItem(_components.RunItFormKey);
|
53
52
|
var result = formValue ? JSON.parse(formValue) : {};
|
54
|
-
adaptor.localStorageRemoveItem(RunItFormKey);
|
53
|
+
adaptor.localStorageRemoveItem(_components.RunItFormKey);
|
55
54
|
return result;
|
56
55
|
});
|
57
|
-
|
58
56
|
return function formValues() {
|
59
57
|
return _ref.apply(this, arguments);
|
60
58
|
};
|
61
59
|
}();
|
62
|
-
|
60
|
+
exports.formValues = formValues;
|
61
|
+
var initRequestContent = function initRequestContent(inputs) {
|
63
62
|
var requestContent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
64
63
|
var content = {};
|
65
|
-
|
66
|
-
if (isEmpty(content)) {
|
64
|
+
if ((0, _isEmpty.default)(content)) {
|
67
65
|
content = prepareInputs(inputs, requestContent);
|
68
66
|
}
|
69
|
-
|
70
67
|
return content;
|
71
68
|
};
|
72
|
-
|
69
|
+
exports.initRequestContent = initRequestContent;
|
70
|
+
var createRequestParams = function createRequestParams(inputs, requestContent) {
|
71
|
+
var keepBody = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
73
72
|
var pathParams = {};
|
74
73
|
var queryParams = {};
|
75
74
|
var prepped = prepareInputs(inputs, requestContent);
|
76
|
-
var trimmed = trimInputs(prepped);
|
75
|
+
var trimmed = (0, _sdkCodegen.trimInputs)(prepped, keepBody);
|
77
76
|
var body;
|
78
|
-
|
79
77
|
for (var input of inputs) {
|
80
78
|
var name = input.name;
|
81
|
-
|
82
79
|
switch (input.location) {
|
83
80
|
case 'path':
|
84
81
|
pathParams[name] = trimmed[name];
|
85
82
|
break;
|
86
|
-
|
87
83
|
case 'query':
|
88
84
|
queryParams[name] = trimmed[name];
|
89
85
|
break;
|
90
|
-
|
91
86
|
case 'body':
|
92
87
|
body = trimmed[name];
|
93
88
|
break;
|
94
|
-
|
95
89
|
default:
|
96
90
|
throw new Error("Invalid input location: '".concat(input.location, "'"));
|
97
91
|
}
|
98
92
|
}
|
99
|
-
|
100
93
|
return [pathParams, queryParams, body];
|
101
94
|
};
|
102
|
-
|
95
|
+
exports.createRequestParams = createRequestParams;
|
96
|
+
var runRequest = function () {
|
103
97
|
var _ref2 = _asyncToGenerator(function* (sdk, basePath, httpMethod, endpoint, pathParams, queryParams, body) {
|
104
98
|
if (!sdk.authSession.isAuthenticated()) {
|
105
99
|
yield sdk.ok(sdk.authSession.login());
|
106
100
|
}
|
107
|
-
|
108
101
|
var url = "".concat(basePath).concat(pathify(endpoint, pathParams));
|
109
102
|
var requestStarted = Date.now();
|
110
103
|
var raw = yield sdk.authSession.transport.rawRequest(httpMethod, url, queryParams, body, props => sdk.authSession.authenticate(props));
|
@@ -113,25 +106,21 @@ export var runRequest = function () {
|
|
113
106
|
if (!raw.responseCompleted) raw.responseCompleted = responseCompleted;
|
114
107
|
return raw;
|
115
108
|
});
|
116
|
-
|
117
109
|
return function runRequest(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
|
118
110
|
return _ref2.apply(this, arguments);
|
119
111
|
};
|
120
112
|
}();
|
121
|
-
|
113
|
+
exports.runRequest = runRequest;
|
122
114
|
var getTypeDefault = type => {
|
123
115
|
switch (type) {
|
124
116
|
case 'boolean':
|
125
117
|
return false;
|
126
|
-
|
127
118
|
case 'int64':
|
128
119
|
case 'integer':
|
129
120
|
return 0;
|
130
|
-
|
131
121
|
case 'float':
|
132
122
|
case 'double':
|
133
123
|
return 0.0;
|
134
|
-
|
135
124
|
case 'hostname':
|
136
125
|
case 'ipv4':
|
137
126
|
case 'ipv6':
|
@@ -140,59 +129,48 @@ var getTypeDefault = type => {
|
|
140
129
|
case 'string':
|
141
130
|
case 'email':
|
142
131
|
return '';
|
143
|
-
|
144
132
|
case 'string[]':
|
145
133
|
return [];
|
146
|
-
|
147
134
|
case 'object':
|
148
135
|
return {};
|
149
|
-
|
150
136
|
case 'datetime':
|
151
137
|
return '';
|
152
|
-
|
153
138
|
default:
|
154
139
|
return '';
|
155
140
|
}
|
156
141
|
};
|
157
|
-
|
158
142
|
var createSampleBody = (spec, type) => {
|
159
143
|
var getSampleValue = type => {
|
160
|
-
if (type instanceof IntrinsicType) return getTypeDefault(type.name);
|
161
|
-
if (type instanceof DelimArrayType) return getTypeDefault(type.elementType.name);
|
162
|
-
if (type instanceof EnumType) return '';
|
163
|
-
if (type instanceof ArrayType) return type.customType ? [recurse(spec.types[type.customType])] : getTypeDefault(type.name);
|
164
|
-
if (type instanceof HashType) return type.customType ? recurse(spec.types[type.customType]) : {};
|
144
|
+
if (type instanceof _sdkCodegen.IntrinsicType) return getTypeDefault(type.name);
|
145
|
+
if (type instanceof _sdkCodegen.DelimArrayType) return getTypeDefault(type.elementType.name);
|
146
|
+
if (type instanceof _sdkCodegen.EnumType) return '';
|
147
|
+
if (type instanceof _sdkCodegen.ArrayType) return type.customType ? [recurse(spec.types[type.customType])] : getTypeDefault(type.name);
|
148
|
+
if (type instanceof _sdkCodegen.HashType) return type.customType ? recurse(spec.types[type.customType]) : {};
|
165
149
|
return recurse(type);
|
166
150
|
};
|
167
|
-
|
168
151
|
var recurse = type => {
|
169
152
|
var sampleBody = {};
|
170
|
-
|
171
153
|
for (var prop of type.writeable) {
|
172
154
|
var sampleValue = getSampleValue(prop.type);
|
173
|
-
|
174
155
|
if (sampleValue !== undefined) {
|
175
156
|
sampleBody[prop.name] = sampleValue;
|
176
157
|
}
|
177
158
|
}
|
178
|
-
|
179
159
|
return sampleBody;
|
180
160
|
};
|
181
|
-
|
182
161
|
return recurse(type);
|
183
162
|
};
|
184
|
-
|
185
163
|
var editType = (spec, type) => {
|
186
|
-
if (type instanceof IntrinsicType) return type.name;
|
187
|
-
if (type instanceof DelimArrayType) return 'string';
|
164
|
+
if (type instanceof _sdkCodegen.IntrinsicType) return type.name;
|
165
|
+
if (type instanceof _sdkCodegen.DelimArrayType) return 'string';
|
188
166
|
return createSampleBody(spec, type);
|
189
167
|
};
|
190
|
-
|
191
|
-
export var createInputs = (spec, method) => method.allParams.map(param => ({
|
168
|
+
var createInputs = (spec, method) => method.allParams.map(param => ({
|
192
169
|
name: param.name,
|
193
170
|
location: param.location,
|
194
171
|
type: editType(spec, param.type),
|
195
172
|
required: param.required,
|
196
173
|
description: param.description
|
197
174
|
}));
|
175
|
+
exports.createInputs = createInputs;
|
198
176
|
//# sourceMappingURL=requestUtils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/requestUtils.ts"],"names":["cloneDeep","isEmpty","ArrayType","DelimArrayType","EnumType","HashType","IntrinsicType","trimInputs","getEnvAdaptor","RunItFormKey","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","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","elementType","customType","recurse","types","sampleBody","prop","writeable","sampleValue","undefined","editType","createInputs","method","allParams","map","param","required","description"],"mappings":";;;;AA2BA,OAAOA,SAAP,MAAsB,kBAAtB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AAEA,SACEC,SADF,EAEEC,cAFF,EAGEC,QAHF,EAIEC,QAJF,EAKEC,aALF,EAMEC,UANF,QAOO,qBAPP;AAQA,SAASC,aAAT,QAA8B,yBAA9B;AAGA,SAASC,YAAT,QAA6B,eAA7B;AASA,OAAO,IAAMC,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;;AASA,OAAO,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;AAaP,OAAO,IAAME,aAAa,GAAG,CAC3BC,MAD2B,EAE3BC,cAF2B,KAGxB;AACH,MAAMJ,MAAM,GAAGpB,SAAS,CAACwB,cAAD,CAAxB;;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,G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CAACxD,QAFe;AAG/BI,EAAAA,IAAI,EAAE+C,QAAQ,CAACX,IAAD,EAAOgB,KAAK,CAACpD,IAAb,CAHiB;AAI/BqD,EAAAA,QAAQ,EAAED,KAAK,CAACC,QAJe;AAK/BC,EAAAA,WAAW,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,cAA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K,CAACnE,IAAI;EAChBC,QAAQ,EAAEkE,KAAK,CAAClE,QAAQ;EACxBI,IAAI,EAAEyD,QAAQ,CAAChB,IAAI,EAAEqB,KAAK,CAAC9D,IAAI,CAAC;EAChC+D,QAAQ,EAAED,KAAK,CAACC,QAAQ;EACxBC,WAAW,EAAEF,KAAK,CAACE;AACrB,CAAC,CAAC,CAAC;AAAA"}
|
package/lib/index.js
CHANGED
@@ -3,9 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
|
7
6
|
var _RunIt = require("./RunIt");
|
8
|
-
|
9
7
|
Object.keys(_RunIt).forEach(function (key) {
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
11
9
|
if (key in exports && exports[key] === _RunIt[key]) return;
|
@@ -16,9 +14,7 @@ Object.keys(_RunIt).forEach(function (key) {
|
|
16
14
|
}
|
17
15
|
});
|
18
16
|
});
|
19
|
-
|
20
17
|
var _RunItProvider = require("./RunItProvider");
|
21
|
-
|
22
18
|
Object.keys(_RunItProvider).forEach(function (key) {
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
24
20
|
if (key in exports && exports[key] === _RunItProvider[key]) return;
|
@@ -29,9 +25,7 @@ Object.keys(_RunItProvider).forEach(function (key) {
|
|
29
25
|
}
|
30
26
|
});
|
31
27
|
});
|
32
|
-
|
33
28
|
var _utils = require("./utils");
|
34
|
-
|
35
29
|
Object.keys(_utils).forEach(function (key) {
|
36
30
|
if (key === "default" || key === "__esModule") return;
|
37
31
|
if (key in exports && exports[key] === _utils[key]) return;
|
@@ -42,9 +36,7 @@ Object.keys(_utils).forEach(function (key) {
|
|
42
36
|
}
|
43
37
|
});
|
44
38
|
});
|
45
|
-
|
46
39
|
var _components = require("./components");
|
47
|
-
|
48
40
|
Object.keys(_components).forEach(function (key) {
|
49
41
|
if (key === "default" || key === "__esModule") return;
|
50
42
|
if (key in exports && exports[key] === _components[key]) return;
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/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 */\n\nexport * from './RunIt'\nexport * from './RunItProvider'\nexport * from './utils'\nexport * from './components'\n"],"mappings":";;;;;AA0BA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/lib/test-data/index.js
CHANGED
@@ -3,68 +3,66 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
Object.defineProperty(exports, "
|
6
|
+
Object.defineProperty(exports, "api", {
|
7
7
|
enumerable: true,
|
8
8
|
get: function get() {
|
9
|
-
return
|
9
|
+
return _specs.api;
|
10
10
|
}
|
11
11
|
});
|
12
|
-
Object.defineProperty(exports, "
|
12
|
+
Object.defineProperty(exports, "testBogusJsonResponse", {
|
13
13
|
enumerable: true,
|
14
14
|
get: function get() {
|
15
|
-
return _responses.
|
15
|
+
return _responses.testBogusJsonResponse;
|
16
16
|
}
|
17
17
|
});
|
18
|
-
Object.defineProperty(exports, "
|
18
|
+
Object.defineProperty(exports, "testErrorResponse", {
|
19
19
|
enumerable: true,
|
20
20
|
get: function get() {
|
21
|
-
return _responses.
|
21
|
+
return _responses.testErrorResponse;
|
22
22
|
}
|
23
23
|
});
|
24
|
-
Object.defineProperty(exports, "
|
24
|
+
Object.defineProperty(exports, "testHtmlResponse", {
|
25
25
|
enumerable: true,
|
26
26
|
get: function get() {
|
27
|
-
return _responses.
|
27
|
+
return _responses.testHtmlResponse;
|
28
28
|
}
|
29
29
|
});
|
30
|
-
Object.defineProperty(exports, "
|
30
|
+
Object.defineProperty(exports, "testImageResponse", {
|
31
31
|
enumerable: true,
|
32
32
|
get: function get() {
|
33
|
-
return _responses.
|
33
|
+
return _responses.testImageResponse;
|
34
34
|
}
|
35
35
|
});
|
36
|
-
Object.defineProperty(exports, "
|
36
|
+
Object.defineProperty(exports, "testJsonResponse", {
|
37
37
|
enumerable: true,
|
38
38
|
get: function get() {
|
39
|
-
return _responses.
|
39
|
+
return _responses.testJsonResponse;
|
40
40
|
}
|
41
41
|
});
|
42
|
-
Object.defineProperty(exports, "
|
42
|
+
Object.defineProperty(exports, "testOneRowComplexJson", {
|
43
43
|
enumerable: true,
|
44
44
|
get: function get() {
|
45
|
-
return _responses.
|
45
|
+
return _responses.testOneRowComplexJson;
|
46
46
|
}
|
47
47
|
});
|
48
|
-
Object.defineProperty(exports, "
|
48
|
+
Object.defineProperty(exports, "testSqlResponse", {
|
49
49
|
enumerable: true,
|
50
50
|
get: function get() {
|
51
|
-
return _responses.
|
51
|
+
return _responses.testSqlResponse;
|
52
52
|
}
|
53
53
|
});
|
54
|
-
Object.defineProperty(exports, "
|
54
|
+
Object.defineProperty(exports, "testTextResponse", {
|
55
55
|
enumerable: true,
|
56
56
|
get: function get() {
|
57
|
-
return _responses.
|
57
|
+
return _responses.testTextResponse;
|
58
58
|
}
|
59
59
|
});
|
60
|
-
Object.defineProperty(exports, "
|
60
|
+
Object.defineProperty(exports, "testUnknownResponse", {
|
61
61
|
enumerable: true,
|
62
62
|
get: function get() {
|
63
|
-
return
|
63
|
+
return _responses.testUnknownResponse;
|
64
64
|
}
|
65
65
|
});
|
66
|
-
|
67
66
|
var _responses = require("./responses");
|
68
|
-
|
69
67
|
var _specs = require("./specs");
|
70
68
|
//# sourceMappingURL=index.js.map
|