@looker/sdk-rtl 21.6.0 → 21.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -60
- package/README.md +101 -1
- package/lib/CSRFSession.js +2 -2
- package/lib/CSRFSession.js.map +1 -1
- package/lib/apiMethods.d.ts +2 -19
- package/lib/apiMethods.js +4 -4
- package/lib/apiMethods.js.map +1 -1
- package/lib/apiSettings.d.ts +1 -1
- package/lib/apiSettings.js +3 -4
- package/lib/apiSettings.js.map +1 -1
- package/lib/authSession.js +2 -2
- package/lib/authSession.js.map +1 -1
- package/lib/authToken.js +2 -2
- package/lib/authToken.js.map +1 -1
- package/lib/baseTransport.d.ts +4 -3
- package/lib/baseTransport.js +51 -2
- package/lib/baseTransport.js.map +1 -1
- package/lib/browser.js.map +1 -1
- package/lib/browserServices.js +2 -2
- package/lib/browserServices.js.map +1 -1
- package/lib/browserSession.d.ts +1 -1
- package/lib/browserSession.js +4 -4
- package/lib/browserSession.js.map +1 -1
- package/lib/browserTransport.d.ts +3 -4
- package/lib/browserTransport.js +98 -80
- package/lib/browserTransport.js.map +1 -1
- package/lib/constants.d.ts +4 -4
- package/lib/constants.js +5 -10
- package/lib/constants.js.map +1 -1
- package/lib/cryptoHash.js.map +1 -1
- package/lib/delimArray.d.ts +1 -1
- package/lib/delimArray.js +2 -2
- package/lib/delimArray.js.map +1 -1
- package/lib/errorDoc.d.ts +4 -4
- package/lib/errorDoc.js +7 -10
- package/lib/errorDoc.js.map +1 -1
- package/lib/esm/CSRFSession.js +6 -13
- package/lib/esm/CSRFSession.js.map +1 -1
- package/lib/esm/apiMethods.js +9 -17
- package/lib/esm/apiMethods.js.map +1 -1
- package/lib/esm/apiSettings.js +20 -32
- package/lib/esm/apiSettings.js.map +1 -1
- package/lib/esm/authSession.js +6 -13
- package/lib/esm/authSession.js.map +1 -1
- package/lib/esm/authToken.js +3 -10
- package/lib/esm/authToken.js.map +1 -1
- package/lib/esm/baseTransport.js +55 -13
- package/lib/esm/baseTransport.js.map +1 -1
- package/lib/esm/browser.js +17 -192
- package/lib/esm/browser.js.map +1 -1
- package/lib/esm/browserServices.js +8 -15
- package/lib/esm/browserServices.js.map +1 -1
- package/lib/esm/browserSession.js +12 -19
- package/lib/esm/browserSession.js.map +1 -1
- package/lib/esm/browserTransport.js +104 -94
- package/lib/esm/browserTransport.js.map +1 -1
- package/lib/esm/constants.js +8 -22
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/cryptoHash.js.map +1 -1
- package/lib/esm/delimArray.js +3 -10
- package/lib/esm/delimArray.js.map +1 -1
- package/lib/esm/errorDoc.js +10 -20
- package/lib/esm/errorDoc.js.map +1 -1
- package/lib/esm/extensionSession.js +3 -10
- package/lib/esm/extensionSession.js.map +1 -1
- package/lib/esm/extensionTransport.js +8 -12
- package/lib/esm/extensionTransport.js.map +1 -1
- package/lib/esm/index.js +22 -236
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/lookerSDKError.js +9 -19
- package/lib/esm/lookerSDKError.js.map +1 -1
- package/lib/esm/oauthSession.js +15 -22
- package/lib/esm/oauthSession.js.map +1 -1
- package/lib/esm/paging.js +11 -23
- package/lib/esm/paging.js.map +1 -1
- package/lib/esm/platformServices.js.map +1 -1
- package/lib/esm/proxySession.js +6 -13
- package/lib/esm/proxySession.js.map +1 -1
- package/lib/esm/sleep.js +14 -0
- package/lib/esm/sleep.js.map +1 -0
- package/lib/esm/testUtils/index.js +1 -16
- package/lib/esm/testUtils/index.js.map +1 -1
- package/lib/esm/testUtils/testUtils.js +20 -26
- package/lib/esm/testUtils/testUtils.js.map +1 -1
- package/lib/esm/transport.js +126 -61
- package/lib/esm/transport.js.map +1 -1
- package/lib/extensionSession.d.ts +1 -1
- package/lib/extensionSession.js +2 -2
- package/lib/extensionSession.js.map +1 -1
- package/lib/extensionTransport.d.ts +3 -3
- package/lib/extensionTransport.js +7 -4
- package/lib/extensionTransport.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -1
- package/lib/lookerSDKError.d.ts +1 -1
- package/lib/lookerSDKError.js +9 -13
- package/lib/lookerSDKError.js.map +1 -1
- package/lib/oauthSession.d.ts +6 -4
- package/lib/oauthSession.js +7 -7
- package/lib/oauthSession.js.map +1 -1
- package/lib/paging.d.ts +5 -6
- package/lib/paging.js +4 -6
- package/lib/paging.js.map +1 -1
- package/lib/platformServices.js.map +1 -1
- package/lib/proxySession.d.ts +1 -1
- package/lib/proxySession.js.map +1 -1
- package/lib/sleep.d.ts +1 -0
- package/lib/sleep.js +20 -0
- package/lib/sleep.js.map +1 -0
- package/lib/testUtils/index.js.map +1 -1
- package/lib/testUtils/testUtils.js +16 -11
- package/lib/testUtils/testUtils.js.map +1 -1
- package/lib/transport.d.ts +64 -17
- package/lib/transport.js +117 -24
- package/lib/transport.js.map +1 -1
- package/package.json +5 -13
package/CHANGELOG.md
CHANGED
|
@@ -5,190 +5,183 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [21.6.
|
|
8
|
+
## [21.6.3](https://github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.6.2...sdk-rtl-v21.6.3) (2024-09-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fix release 24.16.2 ([#1505](https://github.com/looker-open-source/sdk-codegen/issues/1505)) ([1cd1806](https://github.com/looker-open-source/sdk-codegen/commit/1cd180615901d2daf1fb112b41f2a72d2caacf61))
|
|
14
|
+
|
|
15
|
+
## [21.6.2](https://github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.6.1...sdk-rtl-v21.6.2) (2024-09-11)
|
|
9
16
|
|
|
10
17
|
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* Remove the requests package from the TypeScript SDK ([#1491](https://github.com/looker-open-source/sdk-codegen/issues/1491)) ([670377c](https://github.com/looker-open-source/sdk-codegen/commit/670377c46a546bbd8dcc6679b8aeb041da1b4670)), closes [#1439](https://github.com/looker-open-source/sdk-codegen/issues/1439)
|
|
21
|
+
|
|
22
|
+
## [21.6.1](https://github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.6.0...sdk-rtl-v21.6.1) (2023-06-15)
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- use new CDN for errorcodes repository ([#1320](https://github.com/looker-open-source/sdk-codegen/issues/1320)) ([df40441](https://github.com/looker-open-source/sdk-codegen/commit/df40441cb1f187df5469f834486f8ff4de82c266))
|
|
27
|
+
|
|
28
|
+
## [21.6.0](https://github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.5.0...sdk-rtl-v21.6.0) (2023-02-22)
|
|
29
|
+
|
|
11
30
|
### Features
|
|
12
31
|
|
|
13
|
-
|
|
32
|
+
- keep all body parameters toggle in API Explorer requests ([#1245](https://github.com/looker-open-source/sdk-codegen/issues/1245)) ([043ed3f](https://github.com/looker-open-source/sdk-codegen/commit/043ed3ff12cba4f821604b5b668d7301ed4aa6d1))
|
|
14
33
|
|
|
15
34
|
## [21.5.0](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.4.0...sdk-rtl-v21.5.0) (2022-12-09)
|
|
16
35
|
|
|
17
|
-
|
|
18
36
|
### Features
|
|
19
37
|
|
|
20
|
-
|
|
38
|
+
- add request time tracking ([#1223](https://www.github.com/looker-open-source/sdk-codegen/issues/1223)) ([2aefe06](https://www.github.com/looker-open-source/sdk-codegen/commit/2aefe064d668e02f3af95202e4667036cba01979))
|
|
21
39
|
|
|
22
40
|
## [21.4.0](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.3.4...sdk-rtl-v21.4.0) (2022-09-21)
|
|
23
41
|
|
|
24
|
-
|
|
25
42
|
### Features
|
|
26
43
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
- error code document retrieval ([#1136](https://www.github.com/looker-open-source/sdk-codegen/issues/1136)) ([305966b](https://www.github.com/looker-open-source/sdk-codegen/commit/305966b943e8dc6fde08d58cbb36febcbae5733f))
|
|
45
|
+
- error document retrieval in API Explorer ([#1161](https://www.github.com/looker-open-source/sdk-codegen/issues/1161)) ([89a94e1](https://www.github.com/looker-open-source/sdk-codegen/commit/89a94e167b8a3e1aa662c0b5de7c585b3eac2f13))
|
|
30
46
|
|
|
31
47
|
### Bug Fixes
|
|
32
48
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
- add ErrorDoc class to the Kotlin SDK ([#1143](https://www.github.com/looker-open-source/sdk-codegen/issues/1143)) ([20fbd31](https://www.github.com/looker-open-source/sdk-codegen/commit/20fbd31939e0ff88b9be3fdcf260176069143925))
|
|
50
|
+
- add field details for SDK error ([#1134](https://www.github.com/looker-open-source/sdk-codegen/issues/1134)) ([ef1c96d](https://www.github.com/looker-open-source/sdk-codegen/commit/ef1c96d9bc1ae7c27b6ec4b07c7d33f04930d2a7))
|
|
51
|
+
- add field details for SDK error ([#1141](https://www.github.com/looker-open-source/sdk-codegen/issues/1141)) ([9af3092](https://www.github.com/looker-open-source/sdk-codegen/commit/9af30928417e773b6e23a539012bdf9381490a13))
|
|
52
|
+
- IErrorDetail fields should not be null ([#1146](https://www.github.com/looker-open-source/sdk-codegen/issues/1146)) ([44274b4](https://www.github.com/looker-open-source/sdk-codegen/commit/44274b4a3974ff4b946a9a0f3209c70cd77b245e))
|
|
37
53
|
|
|
38
54
|
### [21.3.4](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.3.3...sdk-rtl-v21.3.4) (2022-07-07)
|
|
39
55
|
|
|
40
|
-
|
|
41
56
|
### Bug Fixes
|
|
42
57
|
|
|
43
|
-
|
|
58
|
+
- correct HTTP status code values ([#1101](https://www.github.com/looker-open-source/sdk-codegen/issues/1101)) ([3d0f902](https://www.github.com/looker-open-source/sdk-codegen/commit/3d0f902b67d6384c08641579ae959829c78d1994))
|
|
44
59
|
|
|
45
60
|
### [21.3.3](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.3.2...sdk-rtl-v21.3.3) (2022-04-07)
|
|
46
61
|
|
|
47
|
-
|
|
48
62
|
### Bug Fixes
|
|
49
63
|
|
|
50
|
-
|
|
64
|
+
- encodeParam doc tweak to republish ([#1050](https://www.github.com/looker-open-source/sdk-codegen/issues/1050)) ([512bc81](https://www.github.com/looker-open-source/sdk-codegen/commit/512bc81865a9f5cbf8fafb83f41dfc2e8629ff3b))
|
|
51
65
|
|
|
52
66
|
### [21.3.2](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.3.1...sdk-rtl-v21.3.2) (2022-04-07)
|
|
53
67
|
|
|
54
|
-
|
|
55
68
|
### Bug Fixes
|
|
56
69
|
|
|
57
|
-
|
|
70
|
+
- encodeParam returned [object Object] for object types ([#1047](https://www.github.com/looker-open-source/sdk-codegen/issues/1047)) ([eccc1db](https://www.github.com/looker-open-source/sdk-codegen/commit/eccc1dbb3d64f36e6a06d71a1c3da37d972abd3a))
|
|
58
71
|
|
|
59
72
|
### [21.3.1](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.2.0...sdk-rtl-v21.3.1) (2022-01-27)
|
|
60
73
|
|
|
61
|
-
|
|
62
74
|
### Features
|
|
63
75
|
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
- add http method to IRawResponse ([#925](https://www.github.com/looker-open-source/sdk-codegen/issues/925)) ([25cef47](https://www.github.com/looker-open-source/sdk-codegen/commit/25cef47fa61a5f15565560b48f5e0c45a0cd9b44))
|
|
66
77
|
|
|
67
78
|
### Bug Fixes
|
|
68
79
|
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
- rtl IError type ([#928](https://www.github.com/looker-open-source/sdk-codegen/issues/928)) ([7d8f906](https://www.github.com/looker-open-source/sdk-codegen/commit/7d8f906f4b10b5e915df292fcf30d1eb456c3463))
|
|
81
|
+
- **sdk-rtl/src/delimArray:** Fixed issue with single element number array ([#927](https://www.github.com/looker-open-source/sdk-codegen/issues/927)) ([6e94d73](https://www.github.com/looker-open-source/sdk-codegen/commit/6e94d73f88fb6c2f3138818967f4e8cb49ff89e6))
|
|
71
82
|
|
|
72
83
|
### [21.3.1](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.3.0...sdk-rtl-v21.3.1) (2021-12-20)
|
|
73
84
|
|
|
74
|
-
|
|
75
85
|
### Bug Fixes
|
|
76
86
|
|
|
77
|
-
|
|
87
|
+
- rtl IError type ([#928](https://www.github.com/looker-open-source/sdk-codegen/issues/928)) ([7d8f906](https://www.github.com/looker-open-source/sdk-codegen/commit/7d8f906f4b10b5e915df292fcf30d1eb456c3463))
|
|
78
88
|
|
|
79
89
|
## [21.3.0](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.2.0...sdk-rtl-v21.3.0) (2021-12-16)
|
|
80
90
|
|
|
81
|
-
|
|
82
91
|
### Features
|
|
83
92
|
|
|
84
|
-
|
|
93
|
+
- add http method to IRawResponse ([#925](https://www.github.com/looker-open-source/sdk-codegen/issues/925)) ([25cef47](https://www.github.com/looker-open-source/sdk-codegen/commit/25cef47fa61a5f15565560b48f5e0c45a0cd9b44))
|
|
85
94
|
|
|
86
95
|
## [21.2.0](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.1.1...sdk-rtl-v21.2.0) (2021-11-10)
|
|
87
96
|
|
|
88
|
-
|
|
89
97
|
### Features
|
|
90
98
|
|
|
91
|
-
|
|
99
|
+
- create @looker/extension-utils ([#886](https://www.github.com/looker-open-source/sdk-codegen/issues/886)) ([9d1720d](https://www.github.com/looker-open-source/sdk-codegen/commit/9d1720d9a4cec00c45195dd9c716d9a2a929264f))
|
|
92
100
|
|
|
93
101
|
### [21.1.1](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.1.0...sdk-rtl-v21.1.1) (2021-10-27)
|
|
94
102
|
|
|
95
|
-
|
|
96
103
|
### Bug Fixes
|
|
97
104
|
|
|
98
|
-
|
|
105
|
+
- another TS SDK error handling tweak ([#873](https://www.github.com/looker-open-source/sdk-codegen/issues/873)) ([1c04952](https://www.github.com/looker-open-source/sdk-codegen/commit/1c049527e22926fa7fe0ae011ab4595520005e2f))
|
|
99
106
|
|
|
100
107
|
## [21.1.0](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.20...sdk-rtl-v21.1.0) (2021-10-19)
|
|
101
108
|
|
|
102
|
-
|
|
103
109
|
### Features
|
|
104
110
|
|
|
105
|
-
|
|
111
|
+
- closest path match for API Explorer ([#811](https://www.github.com/looker-open-source/sdk-codegen/issues/811)) ([45fd26f](https://www.github.com/looker-open-source/sdk-codegen/commit/45fd26fb0f325fa90edfec72f835ed3a79b9afeb))
|
|
106
112
|
|
|
107
113
|
### [21.0.20](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.19...sdk-rtl-v21.0.20) (2021-09-01)
|
|
108
114
|
|
|
109
|
-
|
|
110
115
|
### Features
|
|
111
116
|
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
- http response explorer for RunIt ([#800](https://www.github.com/looker-open-source/sdk-codegen/issues/800)) ([3f273ea](https://www.github.com/looker-open-source/sdk-codegen/commit/3f273ea7f849dafece8f4f5f60558021ecd41705))
|
|
114
118
|
|
|
115
119
|
### Bug Fixes
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
- placate TypeScript 4.4 ([#809](https://www.github.com/looker-open-source/sdk-codegen/issues/809)) ([6509c17](https://www.github.com/looker-open-source/sdk-codegen/commit/6509c17da655be1fb7d51d0275b9e198aa6ae929))
|
|
118
122
|
|
|
119
123
|
### [21.0.19](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.18...sdk-rtl-v21.0.19) (2021-07-30)
|
|
120
124
|
|
|
121
|
-
|
|
122
125
|
### Bug Fixes
|
|
123
126
|
|
|
124
|
-
|
|
127
|
+
- support response observer chaining ([025618c](https://www.github.com/looker-open-source/sdk-codegen/commit/025618c806efc1664b4f573248ad5a64d6cee3e3))
|
|
125
128
|
|
|
126
129
|
### [21.0.18](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.17...sdk-rtl-v21.0.18) (2021-07-09)
|
|
127
130
|
|
|
128
|
-
|
|
129
131
|
### Bug Fixes
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
- browserTransport.ts retains ok: false now ([#745](https://www.github.com/looker-open-source/sdk-codegen/issues/745)) ([451481c](https://www.github.com/looker-open-source/sdk-codegen/commit/451481c62cdc986c860c582e4a77e3e887c6a732))
|
|
132
134
|
|
|
133
135
|
### [21.0.17](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.16...sdk-rtl-v21.0.17) (2021-07-08)
|
|
134
136
|
|
|
135
|
-
|
|
136
137
|
### Bug Fixes
|
|
137
138
|
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
- add a test to additional query param required bug ([#741](https://www.github.com/looker-open-source/sdk-codegen/issues/741)) ([0cbe656](https://www.github.com/looker-open-source/sdk-codegen/commit/0cbe656aaf53f6f92fafcc62eeb573e0ff2d0a19))
|
|
140
|
+
- check HTTP status code for TS SDK "ok" toggle ([#739](https://www.github.com/looker-open-source/sdk-codegen/issues/739)) ([3ed6af7](https://www.github.com/looker-open-source/sdk-codegen/commit/3ed6af78b2cb9610b3386ff851013a93fff40f54))
|
|
140
141
|
|
|
141
142
|
### [21.0.16](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.15...sdk-rtl-v21.0.16) (2021-07-02)
|
|
142
143
|
|
|
143
|
-
|
|
144
144
|
### Bug Fixes
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
- explain pager and pageAll sdk param better ([#736](https://www.github.com/looker-open-source/sdk-codegen/issues/736)) ([a93a9b1](https://www.github.com/looker-open-source/sdk-codegen/commit/a93a9b1ded0acddeaf051e7a2fed5132c1cb5c0c))
|
|
147
147
|
|
|
148
148
|
### [21.0.15](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.14...sdk-rtl-v21.0.15) (2021-07-01)
|
|
149
149
|
|
|
150
|
-
|
|
151
150
|
### Bug Fixes
|
|
152
151
|
|
|
153
|
-
|
|
152
|
+
- paging parsing issues ([#728](https://www.github.com/looker-open-source/sdk-codegen/issues/728)) ([f8eec43](https://www.github.com/looker-open-source/sdk-codegen/commit/f8eec43bdfbe337d41b1da02c127d690c8815ed3))
|
|
154
153
|
|
|
155
154
|
### [21.0.14](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.13...sdk-rtl-v21.0.14) (2021-06-30)
|
|
156
155
|
|
|
157
|
-
|
|
158
156
|
### Features
|
|
159
157
|
|
|
160
|
-
|
|
158
|
+
- paging results for the Typescript SDK ([#698](https://www.github.com/looker-open-source/sdk-codegen/issues/698)) ([537eb57](https://www.github.com/looker-open-source/sdk-codegen/commit/537eb579b9c6d95d600f455a187e6d7b9bf700ef))
|
|
161
159
|
|
|
162
160
|
### [21.0.13](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.12...sdk-rtl-v21.0.13) (2021-05-05)
|
|
163
161
|
|
|
164
|
-
|
|
165
162
|
### Bug Fixes
|
|
166
163
|
|
|
167
|
-
|
|
164
|
+
- use "TypeScript" and "JavaScript" everywhere ([#644](https://www.github.com/looker-open-source/sdk-codegen/issues/644)) ([c15031c](https://www.github.com/looker-open-source/sdk-codegen/commit/c15031cee189556adbd9e18641e7c992e86e3611))
|
|
168
165
|
|
|
169
166
|
### [21.0.12](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.11...sdk-rtl-v21.0.12) (2021-04-15)
|
|
170
167
|
|
|
171
|
-
|
|
172
168
|
### Features
|
|
173
169
|
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
- TypeScript SDK tree-shaking support ([#580](https://www.github.com/looker-open-source/sdk-codegen/issues/580)) ([8b7f2f0](https://www.github.com/looker-open-source/sdk-codegen/commit/8b7f2f00ab1a765a04bd460a1ca88e9b7bd66a98))
|
|
176
171
|
|
|
177
172
|
### Bug Fixes
|
|
178
173
|
|
|
179
|
-
|
|
174
|
+
- TypeScript OAuth test ([#597](https://www.github.com/looker-open-source/sdk-codegen/issues/597)) ([d84d1fc](https://www.github.com/looker-open-source/sdk-codegen/commit/d84d1fc976b52f01981592eacb3abc8e1aab9f1f))
|
|
180
175
|
|
|
181
176
|
### [21.0.11](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-rtl-v21.0.10...sdk-rtl-v21.0.11) (2021-04-02)
|
|
182
177
|
|
|
183
|
-
|
|
184
178
|
### Features
|
|
185
179
|
|
|
186
|
-
|
|
187
|
-
|
|
180
|
+
- Added --versions option to the code generator ([#514](https://www.github.com/looker-open-source/sdk-codegen/issues/514)) ([ee6f3e8](https://www.github.com/looker-open-source/sdk-codegen/commit/ee6f3e8f55e300df1a75c9be89b47f067bc08dee))
|
|
188
181
|
|
|
189
182
|
### Bug Fixes
|
|
190
183
|
|
|
191
|
-
|
|
184
|
+
- TypeScript SDK generator import logic ([#547](https://www.github.com/looker-open-source/sdk-codegen/issues/547)) ([c5aa033](https://www.github.com/looker-open-source/sdk-codegen/commit/c5aa033c749a2db8a0f98d5b8f49dc287fad06a2))
|
|
192
185
|
|
|
193
186
|
## [21.0.8]
|
|
194
187
|
|
package/README.md
CHANGED
|
@@ -4,4 +4,104 @@ The Looker TypeScript/JavaScript SDK depends on the runtime code in this package
|
|
|
4
4
|
|
|
5
5
|
The source code in this package is almost all completely generic REST request/response processing code.
|
|
6
6
|
|
|
7
|
-
The `@looker/sdk`
|
|
7
|
+
The `@looker/sdk` and `@looker/sdk-node` packages are updated with every Looker release. This package has a much longer update/release cycle.
|
|
8
|
+
|
|
9
|
+
## HTTP request behavior options
|
|
10
|
+
|
|
11
|
+
The Browser and Node transport layers can be configured with both SDK-wide settings and request-specific optional properties that modify the
|
|
12
|
+
behavior of a request. These properties are documented in [`ITransportSettings`](src/transport.ts).
|
|
13
|
+
|
|
14
|
+
When initializing the SDK, these values configure the default behavior for every HTTP request.
|
|
15
|
+
The behavior of any specific request can be modified by passing different values in the `options` property of the request method.
|
|
16
|
+
Some of these request configuration properties are further explained below.
|
|
17
|
+
|
|
18
|
+
### timeout
|
|
19
|
+
|
|
20
|
+
If not explicitly configured, the HTTP request `timeout` period is 120 seconds, which is supported in both Node and Browser transport layers via an
|
|
21
|
+
[`AbortSignal.timeout()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static) instance created for each HTTP request.
|
|
22
|
+
|
|
23
|
+
To override the timeout period for a long-running HTTP request, pass a `timeout` override value in the `options` parameter for a request.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const xp = new BrowserTransport({ maxTries: 1 } as ITransportSettings);
|
|
27
|
+
const response = await xp.request(
|
|
28
|
+
'GET',
|
|
29
|
+
'https://my.slow.page',
|
|
30
|
+
undefined,
|
|
31
|
+
undefined,
|
|
32
|
+
undefined,
|
|
33
|
+
{
|
|
34
|
+
timeout: 15 * 60, // 15 minute timeout
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### signal
|
|
40
|
+
|
|
41
|
+
The `signal` property is an optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) argument to pass to a transport's request method. This property
|
|
42
|
+
can be used to cancel a request via programmatic or UI control. The following example is adapted from [browserTransport.spec.ts](src/browserTransport.spec.ts):
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
// times out request in 250 ms via AbortSignal "cancellation"
|
|
46
|
+
const xp = new BrowserTransport({ maxTries: 1 } as ITransportSettings);
|
|
47
|
+
const signal = AbortSignal.timeout(250);
|
|
48
|
+
await expect(
|
|
49
|
+
xp.request(
|
|
50
|
+
'GET',
|
|
51
|
+
'https://timeout.in?ms=2000',
|
|
52
|
+
undefined,
|
|
53
|
+
undefined,
|
|
54
|
+
undefined,
|
|
55
|
+
{
|
|
56
|
+
signal,
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
).rejects.toThrowError('The operation was aborted.');
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### maxTries
|
|
63
|
+
|
|
64
|
+
To enable automatic retries on request methods, set `maxTries` to a number > 1.
|
|
65
|
+
|
|
66
|
+
If `maxTries` is > 1 and the HTTP response is a `202`, `429`, or `503`, an [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff)
|
|
67
|
+
will be used until a success response is received or `maxTries` is exceeded.
|
|
68
|
+
|
|
69
|
+
The waiting period before the retry will use the number of seconds provided in a [`Retry-After header`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) if found.
|
|
70
|
+
|
|
71
|
+
**NOTE**: Automatic retry on `202` varies from the suggestion made in Microsoft's [long-running operations](https://github.com/microsoft/api-guidelines/blob/vNext/graph/patterns/long-running-operations.md)
|
|
72
|
+
design pattern, where `202` is not considered a retryable response.
|
|
73
|
+
|
|
74
|
+
### waitHandler
|
|
75
|
+
|
|
76
|
+
The `waitHandler` property is a [`Waitable`](src/transport.ts) callback that can be used to provide custom messaging and handling of the waiting period between automatic retries. This currently has
|
|
77
|
+
an alpha status, meaning it is subject to change or removal without notice.
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
/** Alpha: Properties for an async Waitable retry handler */
|
|
81
|
+
export interface IWait {
|
|
82
|
+
/** HTTP request that responded with a retry code */
|
|
83
|
+
request: IRawRequest;
|
|
84
|
+
/** HTTP response that is a retry */
|
|
85
|
+
response: IRawResponse;
|
|
86
|
+
/** Attempt number for the retry */
|
|
87
|
+
attempt: number;
|
|
88
|
+
/** Time in milliseconds to wait before retrying */
|
|
89
|
+
waitMS: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Alpha: Response from a Waitable function */
|
|
93
|
+
export interface IWaitResponse {
|
|
94
|
+
/** cancel, retry, or error are the allowed responses for the retryable waiter */
|
|
95
|
+
response: 'cancel' | 'retry' | 'error';
|
|
96
|
+
/** Optional reason for the response */
|
|
97
|
+
reason?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Alpha: Waitable function override for retrying an HTTP request */
|
|
101
|
+
export type Waitable = (waiting: IWait) => Promise<IWaitResponse>;
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### verify_ssl
|
|
105
|
+
|
|
106
|
+
Setting `verify_ssl` to `false` will disable SSL certificate verification. **THIS IS NOT RECOMMENDED** and should only be used in development scenarios where self-signed certificates are used locally.
|
|
107
|
+
The default value for`verify_ssl` is `true`.
|
package/lib/CSRFSession.js
CHANGED
|
@@ -9,8 +9,8 @@ var _authSession = require("./authSession");
|
|
|
9
9
|
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); } }
|
|
10
10
|
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); }); }; }
|
|
11
11
|
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; }
|
|
12
|
-
function _toPropertyKey(
|
|
13
|
-
function _toPrimitive(
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
13
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
14
|
class CSRFSession extends _authSession.AuthSession {
|
|
15
15
|
constructor(settings, transport) {
|
|
16
16
|
super(settings, transport || new _browserTransport.BrowserTransport(settings));
|
package/lib/CSRFSession.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CSRFSession.js","names":["CSRFSession","AuthSession","constructor","settings","transport","BrowserTransport","activeToken","_activeToken","meta","document","head","querySelector","content","getToken","isAuthenticated","token","authenticate","props","headers"],"sources":["../src/CSRFSession.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 './apiSettings'
|
|
1
|
+
{"version":3,"file":"CSRFSession.js","names":["_browserTransport","require","_authSession","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","_defineProperty","obj","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","CSRFSession","AuthSession","constructor","settings","transport","BrowserTransport","activeToken","_activeToken","meta","document","head","querySelector","content","getToken","_this","isAuthenticated","token","authenticate","props","_this2","headers","exports"],"sources":["../src/CSRFSession.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 './apiSettings';\nimport type { IRequestProps, ITransport } from './transport';\nimport { BrowserTransport } from './browserTransport';\nimport { AuthSession } from './authSession';\n\n/**\n * CSRFSession is only for use within the Looker UI or a script that\n * executes in the Looker UI. Not for use by third party web apps. Looker UI web\n * service endpoints require that requests must contain a CSRF token to block third\n * party request forgeries. The actual login state is conveyed via encrypted browser\n * cookies exclusive to the looker domain, which the browser implicitly includes on\n * all web requests to looker UI web service.\n */\nexport class CSRFSession extends AuthSession {\n _activeToken = '';\n constructor(public settings: IApiSettings, transport?: ITransport) {\n super(settings, transport || new BrowserTransport(settings));\n }\n\n get activeToken() {\n if (!this._activeToken) {\n const meta = document.head.querySelector(\n '[name=csrf-token]'\n ) as HTMLMetaElement;\n this._activeToken = meta ? meta.content : '';\n }\n return this._activeToken;\n }\n\n async getToken() {\n return this.activeToken;\n }\n\n /**\n * Returns true if the same origin browser session has a CRSF token established\n * that can be used for API authentication\n */\n isAuthenticated() {\n const token = this.activeToken;\n if (!token) return false;\n return true;\n }\n\n /**\n * Authenticates a request with the CSRF token if it is active\n *\n * @param props Request properties to decorate\n */\n async authenticate(props: IRequestProps) {\n const token = this.activeToken;\n if (token) props.headers['X-CSRF-TOKEN'] = token;\n return props;\n }\n}\n"],"mappings":";;;;;;AA4BA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAA4C,SAAAE,mBAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,GAAA,EAAAC,GAAA,cAAAC,IAAA,GAAAP,GAAA,CAAAK,GAAA,EAAAC,GAAA,OAAAE,KAAA,GAAAD,IAAA,CAAAC,KAAA,WAAAC,KAAA,IAAAP,MAAA,CAAAO,KAAA,iBAAAF,IAAA,CAAAG,IAAA,IAAAT,OAAA,CAAAO,KAAA,YAAAG,OAAA,CAAAV,OAAA,CAAAO,KAAA,EAAAI,IAAA,CAAAT,KAAA,EAAAC,MAAA;AAAA,SAAAS,kBAAAC,EAAA,6BAAAC,IAAA,SAAAC,IAAA,GAAAC,SAAA,aAAAN,OAAA,WAAAV,OAAA,EAAAC,MAAA,QAAAF,GAAA,GAAAc,EAAA,CAAAI,KAAA,CAAAH,IAAA,EAAAC,IAAA,YAAAb,MAAAK,KAAA,IAAAT,kBAAA,CAAAC,G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;IAChB,IAAI,CAAC,IAAI,CAACC,YAAY,EAAE;MACtB,IAAMC,IAAI,GAAGC,QAAQ,CAACC,IAAI,CAACC,aAAa,CACtC,mBACF,CAAoB;MACpB,IAAI,CAACJ,YAAY,GAAGC,IAAI,GAAGA,IAAI,CAACI,OAAO,GAAG,EAAE;IAC9C;IACA,OAAO,IAAI,CAACL,YAAY;EAC1B;EAEMM,QAAQA,CAAA,EAAG;IAAA,IAAAC,KAAA;IAAA,OAAAzC,iBAAA;MACf,OAAOyC,KAAI,CAACR,WAAW;IAAC;EAC1B;EAMAS,eAAeA,CAAA,EAAG;IAChB,IAAMC,KAAK,GAAG,IAAI,CAACV,WAAW;IAC9B,IAAI,CAACU,KAAK,EAAE,OAAO,KAAK;IACxB,OAAO,IAAI;EACb;EAOMC,YAAYA,CAACC,KAAoB,EAAE;IAAA,IAAAC,MAAA;IAAA,OAAA9C,iBAAA;MACvC,IAAM2C,KAAK,GAAGG,MAAI,CAACb,WAAW;MAC9B,IAAIU,KAAK,EAAEE,KAAK,CAACE,OAAO,CAAC,cAAc,CAAC,GAAGJ,KAAK;MAChD,OAAOE,KAAK;IAAC;EACf;AACF;AAACG,OAAA,CAAArB,WAAA,GAAAA,WAAA"}
|
package/lib/apiMethods.d.ts
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Authenticator, HttpMethod, ITransportSettings, SDKResponse, Values } from './transport';
|
|
1
|
+
import type { Authenticator, HttpMethod, IAPIMethods, ITransportSettings, SDKResponse, Values } from './transport';
|
|
3
2
|
import type { IAuthSession } from './authSession';
|
|
4
3
|
export declare const functionalSdk: (authSession: IAuthSession, apiVersion: string, sdkVersion: string) => APIMethods;
|
|
5
|
-
export interface IAPIMethods {
|
|
6
|
-
authSession: IAuthSession;
|
|
7
|
-
sdkVersion: string;
|
|
8
|
-
apiPath: string;
|
|
9
|
-
apiVersion: string;
|
|
10
|
-
ok<TSuccess, TError>(promise: Promise<SDKResponse<TSuccess, TError>>): Promise<TSuccess>;
|
|
11
|
-
makePath(path: string, options: Partial<ITransportSettings>, authenticator?: Authenticator): string;
|
|
12
|
-
authRequest<TSuccess, TError>(method: HttpMethod, path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
|
13
|
-
authStream<T>(callback: (readable: Readable) => Promise<T>, method: HttpMethod, path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<T>;
|
|
14
|
-
get<TSuccess, TError>(path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
|
15
|
-
head<TSuccess, TError>(path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
|
16
|
-
delete<TSuccess, TError>(path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
|
17
|
-
post<TSuccess, TError>(path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
|
18
|
-
put<TSuccess, TError>(path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
|
19
|
-
patch<TSuccess, TError>(path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
|
20
|
-
}
|
|
21
4
|
export declare class APIMethods implements IAPIMethods {
|
|
22
5
|
authSession: IAuthSession;
|
|
23
6
|
sdkVersion: string;
|
|
@@ -32,7 +15,7 @@ export declare class APIMethods implements IAPIMethods {
|
|
|
32
15
|
ok<TSuccess, TError>(promise: Promise<SDKResponse<TSuccess, TError>>): Promise<TSuccess>;
|
|
33
16
|
makePath(path: string, options: Partial<ITransportSettings>, authenticator?: Authenticator): string;
|
|
34
17
|
authRequest<TSuccess, TError>(method: HttpMethod, path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
|
35
|
-
authStream<T>(callback: (
|
|
18
|
+
authStream<T>(callback: (response: Response) => Promise<T>, method: HttpMethod, path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<T>;
|
|
36
19
|
get<TSuccess, TError>(path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
|
37
20
|
head<TSuccess, TError>(path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
|
38
21
|
delete<TSuccess, TError>(path: string, queryParams?: Values, body?: any, options?: Partial<ITransportSettings>): Promise<SDKResponse<TSuccess, TError>>;
|
package/lib/apiMethods.js
CHANGED
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.functionalSdk = exports.APIMethods = void 0;
|
|
7
7
|
var _transport = require("./transport");
|
|
8
|
-
function ownKeys(
|
|
9
|
-
function _objectSpread(
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
10
|
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); } }
|
|
11
11
|
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); }); }; }
|
|
12
12
|
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; }
|
|
13
|
-
function _toPropertyKey(
|
|
14
|
-
function _toPrimitive(
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
15
|
var functionalSdk = (authSession, apiVersion, sdkVersion) => {
|
|
16
16
|
var sdk = new APIMethods(authSession, sdkVersion);
|
|
17
17
|
sdk.apiVersion = apiVersion;
|
package/lib/apiMethods.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiMethods.js","names":["functionalSdk","authSession","apiVersion","sdkVersion","sdk","APIMethods","apiPath","settings","base_url","constructor","agentTag","agentPrefix","_apiPath","value","Error","_apiVersion","create","type","ok","promise","sdkOk","makePath","path","options","authenticator","match","base","authRequest","method","queryParams","body","init","authenticate","transport","request","authStream","callback","stream","get","head","delete","post","put","patch"],"sources":["../src/apiMethods.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 { Readable } from 'readable-stream'\nimport type {\n Authenticator,\n HttpMethod,\n ITransportSettings,\n SDKResponse,\n Values,\n} from './transport'\nimport { agentPrefix, sdkOk } from './transport'\nimport type { IAuthSession } from './authSession'\n\n/**\n * Creates an \"sdk\" to be used with the TypeScript SDK's funcs.ts file\n * @param authSession authentication session\n * @param apiVersion version of API to use (e.g. \"3.1\" or \"4.0\")\n * @param sdkVersion Looker release version (e.g. \"21.4\")\n */\nexport const functionalSdk = (\n authSession: IAuthSession,\n apiVersion: string,\n sdkVersion: string\n) => {\n const sdk = new APIMethods(authSession, sdkVersion)\n sdk.apiVersion = apiVersion\n sdk.apiPath =\n authSession.settings.base_url === ''\n ? ''\n : authSession.settings.base_url + '/api/' + apiVersion\n return sdk\n}\n\nexport interface IAPIMethods {\n authSession: IAuthSession\n sdkVersion: string\n apiPath: string\n apiVersion: string\n\n /** A helper method for simplifying error handling of SDK responses.\n *\n * Pass in a promise returned by any SDK method, and it will return a promise\n * that rejects if the `SDKResponse` is not `ok`. This will swallow the type\n * information in the error case, but allows you to route all the error cases\n * into a single promise rejection.\n *\n * The promise will have an `Error` rejection reason with a string `message`.\n * If the server error contains a `message` field, it will be provided, otherwise a\n * generic message will occur.\n *\n * ```ts\n * const sdk = LookerSDK({...})\n * let look\n * try {\n * look = await sdk.ok(sdk.create_look({...}))\n * // do something with look\n * }\n * catch(e) {\n * // handle error case\n * }\n * ```\n */\n ok<TSuccess, TError>(\n promise: Promise<SDKResponse<TSuccess, TError>>\n ): Promise<TSuccess>\n\n /**\n * Determine whether the url should be an API path, relative from base_url, or is already fully specified override\n * @param path Request path\n * @param options Transport settings\n * @param authenticator optional callback\n * @returns the fully specified request path including any query string parameters\n */\n makePath(\n path: string,\n options: Partial<ITransportSettings>,\n authenticator?: Authenticator\n ): string\n\n /**\n *\n * A helper method to add authentication to an API request for deserialization\n *\n * @param {HttpMethod} method type of HTTP method\n * @param {string} path API endpoint path\n * @param {any} queryParams Optional query params collection for request\n * @param {any} body Optional body for request\n * @param {Partial<ITransportSettings>} options Optional overrides like timeout and verify_ssl\n */\n authRequest<TSuccess, TError>(\n method: HttpMethod,\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>>\n\n /**\n * A helper method to add authentication to an API request for streaming\n * @param {(readable: Readable) => Promise<T>} callback\n * @param {HttpMethod} method\n * @param {string} path\n * @param queryParams\n * @param body\n * @param {Partial<ITransportSettings>} options\n * @returns {Promise<T>}\n */\n authStream<T>(\n callback: (readable: Readable) => Promise<T>,\n method: HttpMethod,\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<T>\n\n /** Make a GET request */\n get<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>>\n\n /** Make a HEAD request */\n head<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>>\n\n /** Make a DELETE request */\n delete<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>>\n\n /** Make a POST request */\n post<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>>\n\n /** Make a PUT request */\n put<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>>\n\n /** Make a PATCH request */\n patch<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>>\n}\n\nexport class APIMethods implements IAPIMethods {\n private _apiPath = ''\n private _apiVersion = ''\n\n /**\n * Initialize the APIMethods wrapper\n * @param authSession authentication management session\n * @param sdkVersion version of the SDK for agent tagging\n */\n constructor(public authSession: IAuthSession, public sdkVersion: string) {\n if (\n !('agentTag' in authSession.settings && authSession.settings.agentTag)\n ) {\n // Initialize agentTag if it's not already explicitly set\n authSession.settings.agentTag = `${agentPrefix} ${sdkVersion}`\n }\n }\n\n get apiPath() {\n return this._apiPath\n }\n\n set apiPath(value: string) {\n if (this._apiPath) {\n throw new Error(\n `API Path is set to \"${this._apiPath}\" and cannot be reassigned`\n )\n }\n this._apiPath = value\n }\n\n get apiVersion() {\n return this._apiVersion\n }\n\n set apiVersion(value: string) {\n // API version can only be set once for the instance\n if (this._apiVersion) {\n throw new Error(\n `API Version is set to \"${this._apiVersion}\" and cannot be reassigned`\n )\n }\n this._apiVersion = value\n }\n\n /** A helper method for constructing with a type as a param\n *\n * Example:\n * APIMethods.create(Looker40SDK, authSession)\n *\n * @param type\n * @param authSession\n */\n static create<T extends APIMethods>(\n type: new (authSession: IAuthSession) => T,\n authSession: IAuthSession\n ): T {\n // eslint-disable-next-line new-cap\n return new type(authSession)\n }\n\n /** A helper method for simplifying error handling of SDK responses.\n *\n * Pass in a promise returned by any SDK method, and it will return a promise\n * that rejects if the `SDKResponse` is not `ok`. This will swallow the type\n * information in the error case, but allows you to route all the error cases\n * into a single promise rejection.\n *\n * The promise will have an `Error` rejection reason with a string `message`.\n * If the server error contains a `message` field, it will be provided, otherwise a\n * generic message will occur.\n *\n * ```ts\n * const sdk = LookerSDK({...})\n * let look\n * try {\n * look = await sdk.ok(sdk.create_look({...}))\n * // do something with look\n * }\n * catch(e) {\n * // handle error case\n * }\n * ```\n */\n async ok<TSuccess, TError>(promise: Promise<SDKResponse<TSuccess, TError>>) {\n return sdkOk<TSuccess, TError>(promise)\n }\n\n /**\n * Determine whether the url should be an API path, relative from base_url, or is already fully specified override\n * @param path Request path\n * @param options Transport settings\n * @param authenticator optional callback\n * @returns the fully specified request path including any query string parameters\n */\n makePath(\n path: string,\n options: Partial<ITransportSettings>,\n authenticator?: Authenticator\n ) {\n if (path.match(/^(http:\\/\\/|https:\\/\\/)/gi)) return path\n // is this an API-versioned call?\n const base = authenticator ? this.apiPath : options.base_url\n return `${base}${path}` // path was relative\n }\n\n /**\n *\n * A helper method to add authentication to an API request for deserialization\n *\n * @param {HttpMethod} method type of HTTP method\n * @param {string} path API endpoint path\n * @param {any} queryParams Optional query params collection for request\n * @param {any} body Optional body for request\n * @param {Partial<ITransportSettings>} options Optional overrides like timeout and verify_ssl\n */\n async authRequest<TSuccess, TError>(\n method: HttpMethod,\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n options = { ...this.authSession.settings, ...options }\n const authenticator = (init: any) => {\n return this.authSession.authenticate(init)\n }\n path = this.makePath(path, options, authenticator)\n return this.authSession.transport.request<TSuccess, TError>(\n method,\n path,\n queryParams,\n body,\n authenticator,\n options\n )\n }\n\n /**\n * A helper method to add authentication to an API request for streaming\n * @param {(readable: Readable) => Promise<T>} callback\n * @param {HttpMethod} method\n * @param {string} path\n * @param queryParams\n * @param body\n * @param {Partial<ITransportSettings>} options\n * @returns {Promise<T>}\n */\n async authStream<T>(\n callback: (readable: Readable) => Promise<T>,\n method: HttpMethod,\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<T> {\n options = { ...this.authSession.settings, ...options }\n const authenticator = (init: any) => {\n return this.authSession.authenticate(init)\n }\n path = this.makePath(path, options, authenticator)\n return this.authSession.transport.stream<T>(\n callback,\n method,\n path,\n queryParams,\n body,\n (init: any) => {\n return this.authSession.authenticate(init)\n },\n options\n )\n }\n\n // // dynamically evaluate a template string\n // macro(template: string, vars: any) {\n // // replace {foo} from spec path with ${foo} for template string\n // template = template.replace(/{/gi, '${')\n // return new Function('return `+ template +`;').call(vars)\n // }\n //\n // pathify(path: string, pathParams?: any) {\n // if (!pathParams) return path\n // if (path.indexOf('{') < 0) return path\n // return this.macro(path, pathParams)\n // }\n\n /** Make a GET request */\n async get<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'GET',\n path,\n queryParams,\n body,\n options\n )\n }\n\n /** Make a HEAD request */\n async head<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'HEAD',\n path,\n queryParams,\n body,\n options\n )\n }\n\n /** Make a DELETE request */\n async delete<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'DELETE',\n path,\n queryParams,\n body,\n options\n )\n }\n\n /** Make a POST request */\n async post<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'POST',\n path,\n queryParams,\n body,\n options\n )\n }\n\n /** Make a PUT request */\n async put<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'PUT',\n path,\n queryParams,\n body,\n options\n )\n }\n\n /** Make a PATCH request */\n async patch<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'PATCH',\n path,\n queryParams,\n body,\n options\n )\n }\n}\n"],"mappings":";;;;;;AAkCA;AAAgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASzC,IAAMA,aAAa,GAAG,CAC3BC,WAAyB,EACzBC,UAAkB,EAClBC,UAAkB,KACf;EACH,IAAMC,GAAG,GAAG,IAAIC,UAAU,CAACJ,WAAW,EAAEE,UAAU,CAAC;EACnDC,GAAG,CAACF,UAAU,GAAGA,UAAU;EAC3BE,GAAG,CAACE,OAAO,GACTL,WAAW,CAACM,QAAQ,CAACC,QAAQ,KAAK,EAAE,GAChC,EAAE,GACFP,WAAW,CAACM,QAAQ,CAACC,QAAQ,GAAG,OAAO,GAAGN,UAAU;EAC1D,OAAOE,GAAG;AACZ,CAAC;AAAA;AAsIM,MAAMC,UAAU,CAAwB;EAS7CI,WAAW,CAAQR,WAAyB,EAASE,UAAkB,EAAE;IAAA,KAAtDF,WAAyB,GAAzBA,WAAyB;IAAA,KAASE,UAAkB,GAAlBA,UAAkB;IAAA,kCARpD,EAAE;IAAA,qCACC,EAAE;IAQtB,IACE,EAAE,UAAU,IAAIF,WAAW,CAACM,QAAQ,IAAIN,WAAW,CAACM,QAAQ,CAACG,QAAQ,CAAC,EACtE;MAEAT,WAAW,CAACM,QAAQ,CAACG,QAAQ,aAAMC,sBAAW,cAAIR,UAAU,CAAE;IAChE;EACF;EAEA,IAAIG,OAAO,GAAG;IACZ,OAAO,IAAI,CAACM,QAAQ;EACtB;EAEA,IAAIN,OAAO,CAACO,KAAa,EAAE;IACzB,IAAI,IAA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ACI,WAAW,CACrB,QAAQ,EACRL,IAAI,EACJO,WAAW,EACXC,IAAI,EACJP,OAAO,CACR;IAAA;EACH;EAGMkB,IAAI,CACRnB,IAAY,EACZO,WAAoB,EACpBC,IAAU,EACVP,OAAqC,EACG;IAAA;IAAA;MACxC,OAAO,MAAI,CAACI,WAAW,CACrB,MAAM,EACNL,IAAI,EACJO,WAAW,EACXC,IAAI,EACJP,OAAO,CACR;IAAA;EACH;EAGMmB,GAAG,CACPpB,IAAY,EACZO,WAAoB,EACpBC,IAAU,EACVP,OAAqC,EACG;IAAA;IAAA;MACxC,OAAO,MAAI,CAACI,WAAW,CACrB,KAAK,EACLL,IAAI,EACJO,WAAW,EACXC,IAAI,EACJP,OAAO,CACR;IAAA;EACH;EAGMoB,KAAK,CACTrB,IAAY,EACZO,WAAoB,EACpBC,IAAU,EACVP,OAAqC,EACG;IAAA;IAAA;MACxC,OAAO,MAAI,CAACI,WAAW,CACrB,OAAO,EACPL,IAAI,EACJO,WAAW,EACXC,IAAI,EACJP,OAAO,CACR;IAAA;EACH;AACF;AAAC"}
|
|
1
|
+
{"version":3,"file":"apiMethods.js","names":["_transport","require","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","err","undefined","obj","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","functionalSdk","authSession","apiVersion","sdkVersion","sdk","APIMethods","apiPath","settings","base_url","exports","constructor","agentTag","concat","agentPrefix","_apiPath","Error","_apiVersion","create","type","ok","promise","sdkOk","makePath","path","options","authenticator","match","base","authRequest","method","queryParams","body","_this","init","authenticate","transport","request","authStream","callback","_this2","stream","get","_this3","head","_this4","delete","_this5","post","_this6","put","_this7","patch","_this8"],"sources":["../src/apiMethods.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 {\n Authenticator,\n HttpMethod,\n IAPIMethods,\n ITransportSettings,\n SDKResponse,\n Values,\n} from './transport';\nimport { agentPrefix, sdkOk } from './transport';\nimport type { IAuthSession } from './authSession';\n\n/**\n * Creates an \"sdk\" to be used with the TypeScript SDK's funcs.ts file\n * @param authSession authentication session\n * @param apiVersion version of API to use (e.g. \"4.0\")\n * @param sdkVersion Looker release version (e.g. \"21.4\")\n */\nexport const functionalSdk = (\n authSession: IAuthSession,\n apiVersion: string,\n sdkVersion: string\n) => {\n const sdk = new APIMethods(authSession, sdkVersion);\n sdk.apiVersion = apiVersion;\n sdk.apiPath =\n authSession.settings.base_url === ''\n ? ''\n : authSession.settings.base_url + '/api/' + apiVersion;\n return sdk;\n};\n\nexport class APIMethods implements IAPIMethods {\n private _apiPath = '';\n private _apiVersion = '';\n\n /**\n * Initialize the APIMethods wrapper\n * @param authSession authentication management session\n * @param sdkVersion version of the SDK for agent tagging\n */\n constructor(public authSession: IAuthSession, public sdkVersion: string) {\n if (\n !('agentTag' in authSession.settings && authSession.settings.agentTag)\n ) {\n // Initialize agentTag if it's not already explicitly set\n authSession.settings.agentTag = `${agentPrefix} ${sdkVersion}`;\n }\n }\n\n get apiPath() {\n return this._apiPath;\n }\n\n set apiPath(value: string) {\n if (this._apiPath) {\n throw new Error(\n `API Path is set to \"${this._apiPath}\" and cannot be reassigned`\n );\n }\n this._apiPath = value;\n }\n\n get apiVersion() {\n return this._apiVersion;\n }\n\n set apiVersion(value: string) {\n // API version can only be set once for the instance\n if (this._apiVersion) {\n throw new Error(\n `API Version is set to \"${this._apiVersion}\" and cannot be reassigned`\n );\n }\n this._apiVersion = value;\n }\n\n /** A helper method for constructing with a type as a param\n *\n * Example:\n * APIMethods.create(Looker40SDK, authSession)\n *\n * @param type\n * @param authSession\n */\n static create<T extends APIMethods>(\n type: new (authSession: IAuthSession) => T,\n authSession: IAuthSession\n ): T {\n // eslint-disable-next-line new-cap\n return new type(authSession);\n }\n\n /** A helper method for simplifying error handling of SDK responses.\n *\n * Pass in a promise returned by any SDK method, and it will return a promise\n * that rejects if the `SDKResponse` is not `ok`. This will swallow the type\n * information in the error case, but allows you to route all the error cases\n * into a single promise rejection.\n *\n * The promise will have an `Error` rejection reason with a string `message`.\n * If the server error contains a `message` field, it will be provided, otherwise a\n * generic message will occur.\n *\n * ```ts\n * const sdk = LookerSDK({...})\n * let look\n * try {\n * look = await sdk.ok(sdk.create_look({...}))\n * // do something with look\n * }\n * catch(e) {\n * // handle error case\n * }\n * ```\n */\n async ok<TSuccess, TError>(promise: Promise<SDKResponse<TSuccess, TError>>) {\n return sdkOk<TSuccess, TError>(promise);\n }\n\n /**\n * Determine whether the url should be an API path, relative from base_url, or is already fully specified override\n * @param path Request path\n * @param options Transport settings\n * @param authenticator optional callback\n * @returns the fully specified request path including any query string parameters\n */\n makePath(\n path: string,\n options: Partial<ITransportSettings>,\n authenticator?: Authenticator\n ) {\n if (path.match(/^(http:\\/\\/|https:\\/\\/)/gi)) return path;\n // is this an API-versioned call?\n const base = authenticator ? this.apiPath : options.base_url;\n return `${base}${path}`; // path was relative\n }\n\n /**\n *\n * A helper method to add authentication to an API request for deserialization\n *\n * @param {HttpMethod} method type of HTTP method\n * @param {string} path API endpoint path\n * @param {any} queryParams Optional query params collection for request\n * @param {any} body Optional body for request\n * @param {Partial<ITransportSettings>} options Optional overrides like timeout and verify_ssl\n */\n async authRequest<TSuccess, TError>(\n method: HttpMethod,\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n options = { ...this.authSession.settings, ...options };\n const authenticator = (init: any) => {\n return this.authSession.authenticate(init);\n };\n path = this.makePath(path, options, authenticator);\n return this.authSession.transport.request<TSuccess, TError>(\n method,\n path,\n queryParams,\n body,\n authenticator,\n options\n );\n }\n\n /**\n * A helper method to add authentication to an API request for streaming\n * @param callback for streaming\n * @param method of HTTP request\n * @param path HTTP path\n * @param queryParams\n * @param body\n * @param options to override\n */\n async authStream<T>(\n callback: (response: Response) => Promise<T>,\n method: HttpMethod,\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<T> {\n options = { ...this.authSession.settings, ...options };\n const authenticator = (init: any) => {\n return this.authSession.authenticate(init);\n };\n path = this.makePath(path, options, authenticator);\n return this.authSession.transport.stream<T>(\n callback,\n method,\n path,\n queryParams,\n body,\n (init: any) => {\n return this.authSession.authenticate(init);\n },\n options\n );\n }\n\n // // dynamically evaluate a template string\n // macro(template: string, vars: any) {\n // // replace {foo} from spec path with ${foo} for template string\n // template = template.replace(/{/gi, '${')\n // return new Function('return `+ template +`;').call(vars)\n // }\n //\n // pathify(path: string, pathParams?: any) {\n // if (!pathParams) return path\n // if (path.indexOf('{') < 0) return path\n // return this.macro(path, pathParams)\n // }\n\n /** Make a GET request */\n async get<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'GET',\n path,\n queryParams,\n body,\n options\n );\n }\n\n /** Make a HEAD request */\n async head<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'HEAD',\n path,\n queryParams,\n body,\n options\n );\n }\n\n /** Make a DELETE request */\n async delete<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'DELETE',\n path,\n queryParams,\n body,\n options\n );\n }\n\n /** Make a POST request */\n async post<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'POST',\n path,\n queryParams,\n body,\n options\n );\n }\n\n /** Make a PUT request */\n async put<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'PUT',\n path,\n queryParams,\n body,\n options\n );\n }\n\n /** Make a PATCH request */\n async patch<TSuccess, TError>(\n path: string,\n queryParams?: Values,\n body?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.authRequest<TSuccess, TError>(\n 'PATCH',\n path,\n queryParams,\n body,\n options\n );\n }\n}\n"],"mappings":";;;;;;AAkCA,IAAAA,UAAA,GAAAC,OAAA;AAAiD,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA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AhE,iBAAA;MACxC,OAAOgE,MAAI,CAAClB,WAAW,CACrB,QAAQ,EACRL,IAAI,EACJO,WAAW,EACXC,IAAI,EACJP,OACF,CAAC;IAAC;EACJ;EAGMuB,IAAIA,CACRxB,IAAY,EACZO,WAAoB,EACpBC,IAAU,EACVP,OAAqC,EACG;IAAA,IAAAwB,MAAA;IAAA,OAAAlE,iBAAA;MACxC,OAAOkE,MAAI,CAACpB,WAAW,CACrB,MAAM,EACNL,IAAI,EACJO,WAAW,EACXC,IAAI,EACJP,OACF,CAAC;IAAC;EACJ;EAGMyB,GAAGA,CACP1B,IAAY,EACZO,WAAoB,EACpBC,IAAU,EACVP,OAAqC,EACG;IAAA,IAAA0B,MAAA;IAAA,OAAApE,iBAAA;MACxC,OAAOoE,MAAI,CAACtB,WAAW,CACrB,KAAK,EACLL,IAAI,EACJO,WAAW,EACXC,IAAI,EACJP,OACF,CAAC;IAAC;EACJ;EAGM2B,KAAKA,CACT5B,IAAY,EACZO,WAAoB,EACpBC,IAAU,EACVP,OAAqC,EACG;IAAA,IAAA4B,MAAA;IAAA,OAAAtE,iBAAA;MACxC,OAAOsE,MAAI,CAACxB,WAAW,CACrB,OAAO,EACPL,IAAI,EACJO,WAAW,EACXC,IAAI,EACJP,OACF,CAAC;IAAC;EACJ;AACF;AAACf,OAAA,CAAAJ,UAAA,GAAAA,UAAA"}
|
package/lib/apiSettings.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface IValueSettings {
|
|
|
3
3
|
[name: string]: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const ApiConfigMap: (envPrefix: string) => IValueSettings;
|
|
6
|
-
export declare const strBadConfiguration
|
|
6
|
+
export declare const strBadConfiguration = "TS-SDK configuration error:\nMissing required configuration values like base_url\n";
|
|
7
7
|
export interface IApiSection {
|
|
8
8
|
[key: string]: string;
|
|
9
9
|
}
|
package/lib/apiSettings.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.strBadConfiguration = exports.configValue = exports.ValueSettings = expo
|
|
|
7
7
|
var _transport = require("./transport");
|
|
8
8
|
var _constants = require("./constants");
|
|
9
9
|
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; }
|
|
10
|
-
function _toPropertyKey(
|
|
11
|
-
function _toPrimitive(
|
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
11
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
12
|
var ApiConfigMap = envPrefix => {
|
|
13
13
|
if (!envPrefix) return {};
|
|
14
14
|
return {
|
|
@@ -20,8 +20,7 @@ var ApiConfigMap = envPrefix => {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
exports.ApiConfigMap = ApiConfigMap;
|
|
23
|
-
var strBadConfiguration = "".concat(_transport.agentPrefix, " configuration error:\nMissing required configuration values like base_url\n");
|
|
24
|
-
exports.strBadConfiguration = strBadConfiguration;
|
|
23
|
+
var strBadConfiguration = exports.strBadConfiguration = "".concat(_transport.agentPrefix, " configuration error:\nMissing required configuration values like base_url\n");
|
|
25
24
|
var DefaultSettings = () => ({
|
|
26
25
|
agentTag: _transport.agentPrefix,
|
|
27
26
|
base_url: '',
|