@looker/sdk-rtl 21.5.0 → 21.6.0

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/lib/CSRFSession.js +3 -17
  3. package/lib/CSRFSession.js.map +1 -1
  4. package/lib/apiMethods.js +6 -47
  5. package/lib/apiMethods.js.map +1 -1
  6. package/lib/apiSettings.js +4 -24
  7. package/lib/apiSettings.js.map +1 -1
  8. package/lib/authSession.js +3 -18
  9. package/lib/authSession.js.map +1 -1
  10. package/lib/authToken.js +3 -18
  11. package/lib/authToken.js.map +1 -1
  12. package/lib/baseTransport.js +3 -12
  13. package/lib/baseTransport.js.map +1 -1
  14. package/lib/browser.js +0 -34
  15. package/lib/browser.js.map +1 -1
  16. package/lib/browserServices.js +3 -11
  17. package/lib/browserServices.js.map +1 -1
  18. package/lib/browserSession.js +6 -21
  19. package/lib/browserSession.js.map +1 -1
  20. package/lib/browserTransport.js +5 -63
  21. package/lib/browserTransport.js.map +1 -1
  22. package/lib/constants.js +1 -11
  23. package/lib/constants.js.map +1 -1
  24. package/lib/cryptoHash.js +1 -1
  25. package/lib/cryptoHash.js.map +1 -1
  26. package/lib/delimArray.js +3 -8
  27. package/lib/delimArray.js.map +1 -1
  28. package/lib/errorDoc.js +8 -49
  29. package/lib/errorDoc.js.map +1 -1
  30. package/lib/esm/CSRFSession.js +14 -17
  31. package/lib/esm/CSRFSession.js.map +1 -1
  32. package/lib/esm/apiMethods.js +18 -46
  33. package/lib/esm/apiMethods.js.map +1 -1
  34. package/lib/esm/apiSettings.js +32 -28
  35. package/lib/esm/apiSettings.js.map +1 -1
  36. package/lib/esm/authSession.js +14 -19
  37. package/lib/esm/authSession.js.map +1 -1
  38. package/lib/esm/authToken.js +11 -17
  39. package/lib/esm/authToken.js.map +1 -1
  40. package/lib/esm/baseTransport.js +14 -13
  41. package/lib/esm/baseTransport.js.map +1 -1
  42. package/lib/esm/browser.js +192 -17
  43. package/lib/esm/browser.js.map +1 -1
  44. package/lib/esm/browserServices.js +15 -12
  45. package/lib/esm/browserServices.js.map +1 -1
  46. package/lib/esm/browserSession.js +21 -23
  47. package/lib/esm/browserSession.js.map +1 -1
  48. package/lib/esm/browserTransport.js +24 -68
  49. package/lib/esm/browserTransport.js.map +1 -1
  50. package/lib/esm/constants.js +22 -10
  51. package/lib/esm/constants.js.map +1 -1
  52. package/lib/esm/cryptoHash.js.map +1 -1
  53. package/lib/esm/delimArray.js +10 -6
  54. package/lib/esm/delimArray.js.map +1 -1
  55. package/lib/esm/errorDoc.js +23 -51
  56. package/lib/esm/errorDoc.js.map +1 -1
  57. package/lib/esm/extensionSession.js +11 -16
  58. package/lib/esm/extensionSession.js.map +1 -1
  59. package/lib/esm/extensionTransport.js +13 -19
  60. package/lib/esm/extensionTransport.js.map +1 -1
  61. package/lib/esm/index.js +236 -21
  62. package/lib/esm/index.js.map +1 -1
  63. package/lib/esm/lookerSDKError.js +13 -12
  64. package/lib/esm/lookerSDKError.js.map +1 -1
  65. package/lib/esm/oauthSession.js +23 -66
  66. package/lib/esm/oauthSession.js.map +1 -1
  67. package/lib/esm/paging.js +24 -71
  68. package/lib/esm/paging.js.map +1 -1
  69. package/lib/esm/platformServices.js.map +1 -1
  70. package/lib/esm/proxySession.js +13 -13
  71. package/lib/esm/proxySession.js.map +1 -1
  72. package/lib/esm/testUtils/index.js +17 -0
  73. package/lib/esm/testUtils/index.js.map +1 -0
  74. package/lib/esm/testUtils/testUtils.js +46 -0
  75. package/lib/esm/testUtils/testUtils.js.map +1 -0
  76. package/lib/esm/transport.js +57 -62
  77. package/lib/esm/transport.js.map +1 -1
  78. package/lib/extensionSession.js +3 -17
  79. package/lib/extensionSession.js.map +1 -1
  80. package/lib/extensionTransport.js +5 -20
  81. package/lib/extensionTransport.js.map +1 -1
  82. package/lib/index.js +0 -42
  83. package/lib/index.js.map +1 -1
  84. package/lib/lookerSDKError.js +5 -13
  85. package/lib/lookerSDKError.js.map +1 -1
  86. package/lib/oauthSession.js +8 -63
  87. package/lib/oauthSession.js.map +1 -1
  88. package/lib/paging.js +5 -70
  89. package/lib/paging.js.map +1 -1
  90. package/lib/platformServices.js +1 -1
  91. package/lib/platformServices.js.map +1 -1
  92. package/lib/proxySession.js +0 -12
  93. package/lib/proxySession.js.map +1 -1
  94. package/lib/testUtils/index.js +0 -2
  95. package/lib/testUtils/index.js.map +1 -1
  96. package/lib/testUtils/testUtils.js +1 -16
  97. package/lib/testUtils/testUtils.js.map +1 -1
  98. package/lib/transport.js +8 -50
  99. package/lib/transport.js.map +1 -1
  100. package/package.json +3 -3
package/lib/esm/index.js CHANGED
@@ -1,22 +1,237 @@
1
- export * from './apiMethods';
2
- export * from './apiSettings';
3
- export * from './authSession';
4
- export * from './authToken';
5
- export * from './baseTransport';
6
- export * from './browserSession';
7
- export * from './browserServices';
8
- export * from './browserTransport';
9
- export * from './constants';
10
- export * from './cryptoHash';
11
- export * from './CSRFSession';
12
- export * from './delimArray';
13
- export * from './errorDoc';
14
- export * from './extensionSession';
15
- export * from './extensionTransport';
16
- export * from './lookerSDKError';
17
- export * from './oauthSession';
18
- export * from './paging';
19
- export * from './platformServices';
20
- export * from './proxySession';
21
- export * from './transport';
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _apiMethods = require("./apiMethods");
7
+ Object.keys(_apiMethods).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _apiMethods[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _apiMethods[key];
14
+ }
15
+ });
16
+ });
17
+ var _apiSettings = require("./apiSettings");
18
+ Object.keys(_apiSettings).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _apiSettings[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _apiSettings[key];
25
+ }
26
+ });
27
+ });
28
+ var _authSession = require("./authSession");
29
+ Object.keys(_authSession).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _authSession[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _authSession[key];
36
+ }
37
+ });
38
+ });
39
+ var _authToken = require("./authToken");
40
+ Object.keys(_authToken).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _authToken[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function get() {
46
+ return _authToken[key];
47
+ }
48
+ });
49
+ });
50
+ var _baseTransport = require("./baseTransport");
51
+ Object.keys(_baseTransport).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _baseTransport[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function get() {
57
+ return _baseTransport[key];
58
+ }
59
+ });
60
+ });
61
+ var _browserSession = require("./browserSession");
62
+ Object.keys(_browserSession).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _browserSession[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function get() {
68
+ return _browserSession[key];
69
+ }
70
+ });
71
+ });
72
+ var _browserServices = require("./browserServices");
73
+ Object.keys(_browserServices).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _browserServices[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function get() {
79
+ return _browserServices[key];
80
+ }
81
+ });
82
+ });
83
+ var _browserTransport = require("./browserTransport");
84
+ Object.keys(_browserTransport).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _browserTransport[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function get() {
90
+ return _browserTransport[key];
91
+ }
92
+ });
93
+ });
94
+ var _constants = require("./constants");
95
+ Object.keys(_constants).forEach(function (key) {
96
+ if (key === "default" || key === "__esModule") return;
97
+ if (key in exports && exports[key] === _constants[key]) return;
98
+ Object.defineProperty(exports, key, {
99
+ enumerable: true,
100
+ get: function get() {
101
+ return _constants[key];
102
+ }
103
+ });
104
+ });
105
+ var _cryptoHash = require("./cryptoHash");
106
+ Object.keys(_cryptoHash).forEach(function (key) {
107
+ if (key === "default" || key === "__esModule") return;
108
+ if (key in exports && exports[key] === _cryptoHash[key]) return;
109
+ Object.defineProperty(exports, key, {
110
+ enumerable: true,
111
+ get: function get() {
112
+ return _cryptoHash[key];
113
+ }
114
+ });
115
+ });
116
+ var _CSRFSession = require("./CSRFSession");
117
+ Object.keys(_CSRFSession).forEach(function (key) {
118
+ if (key === "default" || key === "__esModule") return;
119
+ if (key in exports && exports[key] === _CSRFSession[key]) return;
120
+ Object.defineProperty(exports, key, {
121
+ enumerable: true,
122
+ get: function get() {
123
+ return _CSRFSession[key];
124
+ }
125
+ });
126
+ });
127
+ var _delimArray = require("./delimArray");
128
+ Object.keys(_delimArray).forEach(function (key) {
129
+ if (key === "default" || key === "__esModule") return;
130
+ if (key in exports && exports[key] === _delimArray[key]) return;
131
+ Object.defineProperty(exports, key, {
132
+ enumerable: true,
133
+ get: function get() {
134
+ return _delimArray[key];
135
+ }
136
+ });
137
+ });
138
+ var _errorDoc = require("./errorDoc");
139
+ Object.keys(_errorDoc).forEach(function (key) {
140
+ if (key === "default" || key === "__esModule") return;
141
+ if (key in exports && exports[key] === _errorDoc[key]) return;
142
+ Object.defineProperty(exports, key, {
143
+ enumerable: true,
144
+ get: function get() {
145
+ return _errorDoc[key];
146
+ }
147
+ });
148
+ });
149
+ var _extensionSession = require("./extensionSession");
150
+ Object.keys(_extensionSession).forEach(function (key) {
151
+ if (key === "default" || key === "__esModule") return;
152
+ if (key in exports && exports[key] === _extensionSession[key]) return;
153
+ Object.defineProperty(exports, key, {
154
+ enumerable: true,
155
+ get: function get() {
156
+ return _extensionSession[key];
157
+ }
158
+ });
159
+ });
160
+ var _extensionTransport = require("./extensionTransport");
161
+ Object.keys(_extensionTransport).forEach(function (key) {
162
+ if (key === "default" || key === "__esModule") return;
163
+ if (key in exports && exports[key] === _extensionTransport[key]) return;
164
+ Object.defineProperty(exports, key, {
165
+ enumerable: true,
166
+ get: function get() {
167
+ return _extensionTransport[key];
168
+ }
169
+ });
170
+ });
171
+ var _lookerSDKError = require("./lookerSDKError");
172
+ Object.keys(_lookerSDKError).forEach(function (key) {
173
+ if (key === "default" || key === "__esModule") return;
174
+ if (key in exports && exports[key] === _lookerSDKError[key]) return;
175
+ Object.defineProperty(exports, key, {
176
+ enumerable: true,
177
+ get: function get() {
178
+ return _lookerSDKError[key];
179
+ }
180
+ });
181
+ });
182
+ var _oauthSession = require("./oauthSession");
183
+ Object.keys(_oauthSession).forEach(function (key) {
184
+ if (key === "default" || key === "__esModule") return;
185
+ if (key in exports && exports[key] === _oauthSession[key]) return;
186
+ Object.defineProperty(exports, key, {
187
+ enumerable: true,
188
+ get: function get() {
189
+ return _oauthSession[key];
190
+ }
191
+ });
192
+ });
193
+ var _paging = require("./paging");
194
+ Object.keys(_paging).forEach(function (key) {
195
+ if (key === "default" || key === "__esModule") return;
196
+ if (key in exports && exports[key] === _paging[key]) return;
197
+ Object.defineProperty(exports, key, {
198
+ enumerable: true,
199
+ get: function get() {
200
+ return _paging[key];
201
+ }
202
+ });
203
+ });
204
+ var _platformServices = require("./platformServices");
205
+ Object.keys(_platformServices).forEach(function (key) {
206
+ if (key === "default" || key === "__esModule") return;
207
+ if (key in exports && exports[key] === _platformServices[key]) return;
208
+ Object.defineProperty(exports, key, {
209
+ enumerable: true,
210
+ get: function get() {
211
+ return _platformServices[key];
212
+ }
213
+ });
214
+ });
215
+ var _proxySession = require("./proxySession");
216
+ Object.keys(_proxySession).forEach(function (key) {
217
+ if (key === "default" || key === "__esModule") return;
218
+ if (key in exports && exports[key] === _proxySession[key]) return;
219
+ Object.defineProperty(exports, key, {
220
+ enumerable: true,
221
+ get: function get() {
222
+ return _proxySession[key];
223
+ }
224
+ });
225
+ });
226
+ var _transport = require("./transport");
227
+ Object.keys(_transport).forEach(function (key) {
228
+ if (key === "default" || key === "__esModule") return;
229
+ if (key in exports && exports[key] === _transport[key]) return;
230
+ Object.defineProperty(exports, key, {
231
+ enumerable: true,
232
+ get: function get() {
233
+ return _transport[key];
234
+ }
235
+ });
236
+ });
22
237
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":"AA0BA,cAAc,cAAd;AACA,cAAc,eAAd;AACA,cAAc,eAAd;AACA,cAAc,aAAd;AACA,cAAc,iBAAd;AACA,cAAc,kBAAd;AACA,cAAc,mBAAd;AACA,cAAc,oBAAd;AACA,cAAc,aAAd;AACA,cAAc,cAAd;AACA,cAAc,eAAd;AACA,cAAc,cAAd;AACA,cAAc,YAAd;AACA,cAAc,oBAAd;AACA,cAAc,sBAAd;AACA,cAAc,kBAAd;AACA,cAAc,gBAAd;AACA,cAAc,UAAd;AACA,cAAc,oBAAd;AACA,cAAc,gBAAd;AACA,cAAc,aAAd","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 './apiMethods'\nexport * from './apiSettings'\nexport * from './authSession'\nexport * from './authToken'\nexport * from './baseTransport'\nexport * from './browserSession'\nexport * from './browserServices'\nexport * from './browserTransport'\nexport * from './constants'\nexport * from './cryptoHash'\nexport * from './CSRFSession'\nexport * from './delimArray'\nexport * from './errorDoc'\nexport * from './extensionSession'\nexport * from './extensionTransport'\nexport * from './lookerSDKError'\nexport * from './oauthSession'\nexport * from './paging'\nexport * from './platformServices'\nexport * from './proxySession'\nexport * from './transport'\n"],"file":"index.js"}
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 './apiMethods'\nexport * from './apiSettings'\nexport * from './authSession'\nexport * from './authToken'\nexport * from './baseTransport'\nexport * from './browserSession'\nexport * from './browserServices'\nexport * from './browserTransport'\nexport * from './constants'\nexport * from './cryptoHash'\nexport * from './CSRFSession'\nexport * from './delimArray'\nexport * from './errorDoc'\nexport * from './extensionSession'\nexport * from './extensionTransport'\nexport * from './lookerSDKError'\nexport * from './oauthSession'\nexport * from './paging'\nexport * from './platformServices'\nexport * from './proxySession'\nexport * from './transport'\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;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;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;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;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;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;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -1,25 +1,26 @@
1
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1
+ "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LookerSDKError = void 0;
7
+ var _excluded = ["errors", "documentation_url"];
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
-
5
- export var LookerSDKError = (() => {
10
+ var LookerSDKError = (() => {
6
11
  'use strict';
7
12
 
8
13
  var LookerSDKErrorConstructor = function LookerSDKError() {
9
14
  var _errors, _documentation_url;
10
-
11
15
  for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
12
16
  _ref[_key] = arguments[_key];
13
17
  }
14
-
15
18
  var [message, _ref2 = {}, ...rest] = _ref;
16
-
17
19
  var {
18
- errors,
19
- documentation_url
20
- } = _ref2,
21
- errorOptions = _objectWithoutProperties(_ref2, ["errors", "documentation_url"]);
22
-
20
+ errors,
21
+ documentation_url
22
+ } = _ref2,
23
+ errorOptions = _objectWithoutProperties(_ref2, _excluded);
23
24
  (_errors = errors) !== null && _errors !== void 0 ? _errors : errors = [];
24
25
  (_documentation_url = documentation_url) !== null && _documentation_url !== void 0 ? _documentation_url : documentation_url = '';
25
26
  var error = this ? new Error(message, errorOptions, ...rest) : Error(message, errorOptions, ...rest);
@@ -31,7 +32,6 @@ export var LookerSDKError = (() => {
31
32
  error.documentation_url = documentation_url;
32
33
  return error;
33
34
  };
34
-
35
35
  Object.defineProperty(LookerSDKErrorConstructor, 'prototype', {
36
36
  value: Object.create(Error.prototype, {
37
37
  constructor: {
@@ -49,4 +49,5 @@ export var LookerSDKError = (() => {
49
49
  });
50
50
  return LookerSDKErrorConstructor;
51
51
  })();
52
+ exports.LookerSDKError = LookerSDKError;
52
53
  //# sourceMappingURL=lookerSDKError.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lookerSDKError.ts"],"names":["LookerSDKError","LookerSDKErrorConstructor","message","rest","errors","documentation_url","errorOptions","error","Error","Object","setPrototypeOf","getPrototypeOf","prototype","defineProperty","enumerable","value","create","constructor","writable","configurable","name"],"mappings":";;;;AAiFA,OAAO,IAAMA,cAA0C,GACtC,CAAC,MAAM;AACpB;;AACA,MAAMC,yBAAyB,GAAG,SAASD,cAAT,GAkBhC;AAAA;;AAAA;AAAA;AAAA;;AAAA,QAhBG,CACDE,OADC,EAED,QAII,EANH,EAOD,GAAGC,IAPF,CAgBH;;AAAA,QAdE;AACEC,MAAAA,MADF;AAEEC,MAAAA;AAFF,KAcF;AAAA,QAXOC,YAWP;;AAEA,eAAAF,MAAM,UAAN,mCAAAA,MAAM,GAAK,EAAX;AACA,0BAAAC,iBAAiB,UAAjB,yDAAAA,iBAAiB,GAAK,EAAtB;AAKA,QAAME,KAAK,GAAG,OACV,IAAIC,KAAJ,CACEN,OADF,EAKEI,YALF,EAME,GAAGH,IANL,CADU,GASVK,KAAK,CACHN,OADG,EAGHI,YAHG,EAIH,GAAGH,IAJA,CATT;AAoBAM,IAAAA,MAAM,CAACC,cAAP,CACEH,KADF,EAEE,OAAOE,MAAM,CAACE,cAAP,CAAsB,IAAtB,CAAP,GAAqCX,cAAc,CAACY,SAFtD;AASAH,IAAAA,MAAM,CAACI,cAAP,CAAsBN,KAAtB,EAA6B,SAA7B,EAAwC;AAAEO,MAAAA,UAAU,EAAE;AAAd,KAAxC;AACEP,IAAAA,KAAD,CAA0BH,MAA1B,GAAmCA,MAAnC;AACCG,IAAAA,KAAD,CAA0BF,iBAA1B,GAA8CA,iBAA9C;AAED,WAAOE,KAAP;AACD,GA5DD;;AAuEAE,EAAAA,MAAM,CAACI,cAAP,CACEZ,yBADF,EAEE,WAFF,EAOE;AACEc,IAAAA,KAAK,EAAEN,MAAM,CAACO,MAAP,CAAcR,KAAK,CAACI,SAApB,EAA+B;AACpCK,MAAAA,WAAW,EAAE;AACXF,QAAAA,KAAK,EAAEd,yBADI;AAEXiB,QAAAA,QAAQ,EAAE,IAFC;AAGXC,QAAAA,YAAY,EAAE;AAHH,OADuB;AAMpCC,MAAAA,IAAI,EAAE;AACJL,QAAAA,KAAK,EAAE,gBADH;AAEJG,QAAAA,QAAQ,EAAE,IAFN;AAGJC,QAAAA,YAAY,EAAE;AAHV;AAN8B,KAA/B,CADT;AAiBED,IAAAA,QAAQ,EAAE;AAjBZ,GAPF;AA4BA,SAAOjB,yBAAP;AACD,CAtGc,GADV","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 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\n/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-redeclare */\n\n// Defensive type-level programming to guard against additional\n// parameters being added to Error, as happened in lib.es2022.error.d.ts\n// (which introduced the errorOptions argument)\ntype AugmentErrorOptions<\n ErrorParameters extends unknown[],\n AdditionalErrorOptions\n> = ErrorParameters extends [(infer Message)?]\n ? [Message?, AdditionalErrorOptions?]\n : ErrorParameters extends [(infer Message)?, (infer ErrorOptions)?]\n ? [Message?, (ErrorOptions & AdditionalErrorOptions)?]\n : ErrorParameters extends [\n (infer Message)?,\n (infer ErrorOptions)?,\n ...infer Rest\n ]\n ? [Message?, (ErrorOptions & AdditionalErrorOptions)?, ...Rest]\n : never\n\ninterface IErrorDetail {\n field?: string\n code?: string\n message?: string\n documentation_url: string\n}\n\n// This specifies SDK custom error options\ninterface ILookerSDKErrorOptions {\n errors?: IErrorDetail[]\n documentation_url?: string | null\n}\n\ninterface ILookerSDKErrorConstructor {\n new (\n ...args: AugmentErrorOptions<\n ConstructorParameters<ErrorConstructor>,\n ILookerSDKErrorOptions\n >\n ): LookerSDKError\n (\n ...args: AugmentErrorOptions<\n Parameters<ErrorConstructor>,\n ILookerSDKErrorOptions\n >\n ): LookerSDKError\n}\n\n// The subclass and function expression's name should match, so that stack traces look clean.\n// We bind it to a local identifier for clarity, and to perform a type assertion.\nexport interface LookerSDKError extends Error {\n errors?: IErrorDetail[]\n documentation_url?: string | null\n}\n\nexport const LookerSDKError: ILookerSDKErrorConstructor =\n /* #__PURE__*/ (() => {\n 'use strict'\n const LookerSDKErrorConstructor = function LookerSDKError(\n this: LookerSDKError | undefined,\n ...[\n message,\n {\n errors,\n documentation_url,\n ...errorOptions\n } = {} as ILookerSDKErrorOptions,\n ...rest\n ]: AugmentErrorOptions<\n ConstructorParameters<ErrorConstructor>,\n ILookerSDKErrorOptions\n > &\n AugmentErrorOptions<\n Parameters<ErrorConstructor>,\n ILookerSDKErrorOptions\n >\n ) {\n // handle null in addition to undefined\n errors ??= []\n documentation_url ??= ''\n\n // The `super()` call. At present, Error() and new Error() are\n // indistinguishable, but use whatever we were invoked with in case\n // that ever changes.\n const error = this\n ? new Error(\n message,\n // we have to suppress a type error here if TypeScript\n // doesn't know es2022's two-argument Error constructor\n // @ts-ignore-error\n errorOptions,\n ...rest\n )\n : Error(\n message,\n // @ts-ignore-error\n errorOptions,\n ...rest\n )\n\n // Object.setPrototypeOf() is necessary when extending built-ins,\n // since Error.call(this, message, errorOptions, ...rest) doesn't\n // set up the prototype chain the way it would with a user-defined\n // class.\n Object.setPrototypeOf(\n error,\n this ? Object.getPrototypeOf(this) : LookerSDKError.prototype\n )\n\n // Normally the 'message' property of JavaScript Error objects is non-enumerable\n // set it to be enumerable for consistency with our non-error responses,\n // which are implemented as plain JavaScript objects where all\n // properties are enumerable.\n Object.defineProperty(error, 'message', { enumerable: true })\n ;(error as LookerSDKError).errors = errors\n ;(error as LookerSDKError).documentation_url = documentation_url\n\n return error\n } as ILookerSDKErrorConstructor\n\n // LookerSDKError.prototype, LookerSDKError.prototype.constructor, and\n // LookerSDKError.prototoype.name all have to be non-enumerable to match\n // the built-in RangeError, TypeError, etc., so we use\n // Object.defineProperty to set them instead of `=` assignment.\n\n // Default values for property descriptor objects:\n // writable: false\n // enumerable: false\n // configurable: false\n Object.defineProperty(\n LookerSDKErrorConstructor,\n 'prototype',\n // It's a weird wart that the built-in Error constructor\n // prototypes have writable and configurable constructor and name\n // fields. We follow that behavior to be consistent, not because\n // it makes sense.\n {\n value: Object.create(Error.prototype, {\n constructor: {\n value: LookerSDKErrorConstructor,\n writable: true,\n configurable: true,\n },\n name: {\n value: 'LookerSDKError',\n writable: true,\n configurable: true,\n },\n }),\n // SomeConstructorFunction.prototype starts off writable with\n // `function`-type constructors, in contrast to `class SomeClass`.\n // Set this to be non-writable to match `class`es and the built-in\n // Error constructors.\n writable: false,\n }\n )\n\n return LookerSDKErrorConstructor\n })()\n"],"file":"lookerSDKError.js"}
1
+ {"version":3,"file":"lookerSDKError.js","names":["LookerSDKError","LookerSDKErrorConstructor","message","rest","errors","documentation_url","errorOptions","error","Error","Object","setPrototypeOf","getPrototypeOf","prototype","defineProperty","enumerable","value","create","constructor","writable","configurable","name"],"sources":["../../src/lookerSDKError.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 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\n/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-redeclare */\n\n// Defensive type-level programming to guard against additional\n// parameters being added to Error, as happened in lib.es2022.error.d.ts\n// (which introduced the errorOptions argument)\ntype AugmentErrorOptions<\n ErrorParameters extends unknown[],\n AdditionalErrorOptions\n> = ErrorParameters extends [(infer Message)?]\n ? [Message?, AdditionalErrorOptions?]\n : ErrorParameters extends [(infer Message)?, (infer ErrorOptions)?]\n ? [Message?, (ErrorOptions & AdditionalErrorOptions)?]\n : ErrorParameters extends [\n (infer Message)?,\n (infer ErrorOptions)?,\n ...infer Rest\n ]\n ? [Message?, (ErrorOptions & AdditionalErrorOptions)?, ...Rest]\n : never\n\ninterface IErrorDetail {\n field?: string\n code?: string\n message?: string\n documentation_url: string\n}\n\n// This specifies SDK custom error options\ninterface ILookerSDKErrorOptions {\n errors?: IErrorDetail[]\n documentation_url?: string | null\n}\n\ninterface ILookerSDKErrorConstructor {\n new (\n ...args: AugmentErrorOptions<\n ConstructorParameters<ErrorConstructor>,\n ILookerSDKErrorOptions\n >\n ): LookerSDKError\n (\n ...args: AugmentErrorOptions<\n Parameters<ErrorConstructor>,\n ILookerSDKErrorOptions\n >\n ): LookerSDKError\n}\n\n// The subclass and function expression's name should match, so that stack traces look clean.\n// We bind it to a local identifier for clarity, and to perform a type assertion.\nexport interface LookerSDKError extends Error {\n errors?: IErrorDetail[]\n documentation_url?: string | null\n}\n\nexport const LookerSDKError: ILookerSDKErrorConstructor =\n /* #__PURE__*/ (() => {\n 'use strict'\n const LookerSDKErrorConstructor = function LookerSDKError(\n this: LookerSDKError | undefined,\n ...[\n message,\n {\n errors,\n documentation_url,\n ...errorOptions\n } = {} as ILookerSDKErrorOptions,\n ...rest\n ]: AugmentErrorOptions<\n ConstructorParameters<ErrorConstructor>,\n ILookerSDKErrorOptions\n > &\n AugmentErrorOptions<\n Parameters<ErrorConstructor>,\n ILookerSDKErrorOptions\n >\n ) {\n // handle null in addition to undefined\n errors ??= []\n documentation_url ??= ''\n\n // The `super()` call. At present, Error() and new Error() are\n // indistinguishable, but use whatever we were invoked with in case\n // that ever changes.\n const error = this\n ? new Error(\n message,\n // we have to suppress a type error here if TypeScript\n // doesn't know es2022's two-argument Error constructor\n // @ts-ignore-error\n errorOptions,\n ...rest\n )\n : Error(\n message,\n // @ts-ignore-error\n errorOptions,\n ...rest\n )\n\n // Object.setPrototypeOf() is necessary when extending built-ins,\n // since Error.call(this, message, errorOptions, ...rest) doesn't\n // set up the prototype chain the way it would with a user-defined\n // class.\n Object.setPrototypeOf(\n error,\n this ? Object.getPrototypeOf(this) : LookerSDKError.prototype\n )\n\n // Normally the 'message' property of JavaScript Error objects is non-enumerable\n // set it to be enumerable for consistency with our non-error responses,\n // which are implemented as plain JavaScript objects where all\n // properties are enumerable.\n Object.defineProperty(error, 'message', { enumerable: true })\n ;(error as LookerSDKError).errors = errors\n ;(error as LookerSDKError).documentation_url = documentation_url\n\n return error\n } as ILookerSDKErrorConstructor\n\n // LookerSDKError.prototype, LookerSDKError.prototype.constructor, and\n // LookerSDKError.prototoype.name all have to be non-enumerable to match\n // the built-in RangeError, TypeError, etc., so we use\n // Object.defineProperty to set them instead of `=` assignment.\n\n // Default values for property descriptor objects:\n // writable: false\n // enumerable: false\n // configurable: false\n Object.defineProperty(\n LookerSDKErrorConstructor,\n 'prototype',\n // It's a weird wart that the built-in Error constructor\n // prototypes have writable and configurable constructor and name\n // fields. We follow that behavior to be consistent, not because\n // it makes sense.\n {\n value: Object.create(Error.prototype, {\n constructor: {\n value: LookerSDKErrorConstructor,\n writable: true,\n configurable: true,\n },\n name: {\n value: 'LookerSDKError',\n writable: true,\n configurable: true,\n },\n }),\n // SomeConstructorFunction.prototype starts off writable with\n // `function`-type constructors, in contrast to `class SomeClass`.\n // Set this to be non-writable to match `class`es and the built-in\n // Error constructors.\n writable: false,\n }\n )\n\n return LookerSDKErrorConstructor\n })()\n"],"mappings":";;;;;;;;;AAiFO,IAAMA,cAA0C,GACtC,CAAC,MAAM;EACpB,YAAY;;EACZ,IAAMC,yBAAyB,GAAG,SAASD,cAAc,GAkBvD;IAAA;IAAA;MAAA;IAAA;IAAA,IAhBG,CACDE,OAAO,EACP,QAII,CAAC,CAA2B,EAChC,GAAGC,IAAI,CACR;IAAA,IANC;QACEC,MAAM;QACNC;MAEF,CAAC;MADIC,YAAY;IAanB,WAAAF,MAAM,6CAANA,MAAM,GAAK,EAAE;IACb,sBAAAC,iBAAiB,mEAAjBA,iBAAiB,GAAK,EAAE;IAKxB,IAAME,KAAK,GAAG,IAAI,GACd,IAAIC,KAAK,CACPN,OAAO,EAIPI,YAAY,EACZ,GAAGH,IAAI,CACR,GACDK,KAAK,CACHN,OAAO,EAEPI,YAAY,EACZ,GAAGH,IAAI,CACR;IAMLM,MAAM,CAACC,cAAc,CACnBH,KAAK,EACL,IAAI,GAAGE,MAAM,CAACE,cAAc,CAAC,IAAI,CAAC,GAAGX,cAAc,CAACY,SAAS,CAC9D;IAMDH,MAAM,CAACI,cAAc,CAACN,KAAK,EAAE,SAAS,EAAE;MAAEO,UAAU,EAAE;IAAK,CAAC,CAAC;IAC3DP,KAAK,CAAoBH,MAAM,GAAGA,MAAM;IACxCG,KAAK,CAAoBF,iBAAiB,GAAGA,iBAAiB;IAEhE,OAAOE,KAAK;EACd,CAA+B;EAW/BE,MAAM,CAACI,cAAc,CACnBZ,yBAAyB,EACzB,WAAW,EAKX;IACEc,KAAK,EAAEN,MAAM,CAACO,MAAM,CAACR,KAAK,CAACI,SAAS,EAAE;MACpCK,WAAW,EAAE;QACXF,KAAK,EAAEd,yBAAyB;QAChCiB,QAAQ,EAAE,IAAI;QACdC,YAAY,EAAE;MAChB,CAAC;MACDC,IAAI,EAAE;QACJL,KAAK,EAAE,gBAAgB;QACvBG,QAAQ,EAAE,IAAI;QACdC,YAAY,EAAE;MAChB;IACF,CAAC,CAAC;IAKFD,QAAQ,EAAE;EACZ,CAAC,CACF;EAED,OAAOjB,yBAAyB;AAClC,CAAC,GAAG;AAAA"}
@@ -1,64 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OAuthSession = void 0;
7
+ var _authSession = require("./authSession");
8
+ var _transport = require("./transport");
9
+ var _authToken = require("./authToken");
1
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); } }
2
-
3
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); }); }; }
4
-
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6
-
7
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
-
9
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
-
11
- import { AuthSession } from './authSession';
12
- import { agentPrefix, sdkError } from './transport';
13
- import { AuthToken } from './authToken';
14
- export class OAuthSession extends AuthSession {
12
+ 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; }
13
+ 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; }
14
+ 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; }
15
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
16
+ 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); }
17
+ class OAuthSession extends _authSession.AuthSession {
15
18
  constructor(services) {
16
19
  super(services.settings, services.transport);
17
-
18
- _defineProperty(this, "activeToken", new AuthToken());
19
-
20
+ _defineProperty(this, "activeToken", new _authToken.AuthToken());
20
21
  _defineProperty(this, "crypto", void 0);
21
-
22
22
  _defineProperty(this, "reentry", false);
23
-
24
23
  this.crypto = services.crypto;
25
24
  var keys = ['client_id', 'redirect_uri', 'base_url', 'looker_url'];
26
-
27
25
  var config = _objectSpread(_objectSpread({}, this.settings), this.settings.readConfig());
28
-
29
26
  keys.forEach(key => {
30
27
  var value = config[key];
31
-
32
28
  if (!value) {
33
- throw sdkError({
29
+ throw (0, _transport.sdkError)({
34
30
  message: "Missing required configuration setting: '".concat(key, "'")
35
31
  });
36
32
  }
37
33
  });
38
34
  }
39
-
40
35
  readConfig() {
41
36
  return _objectSpread(_objectSpread({}, this.settings), this.settings.readConfig());
42
37
  }
43
-
44
38
  authenticate(props) {
45
39
  var _this = this;
46
-
47
40
  return _asyncToGenerator(function* () {
48
41
  var token = yield _this.getToken();
49
-
50
42
  if (token.access_token) {
51
43
  props.headers.Authorization = "Bearer ".concat(token.access_token);
52
44
  }
53
-
54
45
  return props;
55
46
  })();
56
47
  }
57
-
58
48
  get code_verifier() {
59
49
  return sessionStorage.getItem(OAuthSession.codeVerifierKey);
60
50
  }
61
-
62
51
  set code_verifier(value) {
63
52
  if (value === null) {
64
53
  sessionStorage.removeItem(OAuthSession.codeVerifierKey);
@@ -66,11 +55,9 @@ export class OAuthSession extends AuthSession {
66
55
  sessionStorage.setItem(OAuthSession.codeVerifierKey, value);
67
56
  }
68
57
  }
69
-
70
58
  get returnUrl() {
71
59
  return sessionStorage.getItem(OAuthSession.returnUrlKey);
72
60
  }
73
-
74
61
  set returnUrl(value) {
75
62
  if (!value) {
76
63
  sessionStorage.removeItem(OAuthSession.returnUrlKey);
@@ -78,69 +65,54 @@ export class OAuthSession extends AuthSession {
78
65
  sessionStorage.setItem(OAuthSession.returnUrlKey, value);
79
66
  }
80
67
  }
81
-
82
68
  clearStorage() {
83
69
  sessionStorage.removeItem(OAuthSession.codeVerifierKey);
84
70
  sessionStorage.removeItem(OAuthSession.returnUrlKey);
85
71
  }
86
-
87
72
  login(_sudoId) {
88
73
  var _this2 = this;
89
-
90
74
  return _asyncToGenerator(function* () {
91
75
  if (!_this2.isAuthenticated()) {
92
76
  if (_this2.reentry) {} else if (!_this2.returnUrl) {
93
- var authUrl = yield _this2.createAuthCodeRequestUrl('cors_api', agentPrefix);
77
+ var authUrl = yield _this2.createAuthCodeRequestUrl('cors_api', _transport.agentPrefix);
94
78
  var returnTo = window.location.pathname + window.location.search;
95
79
  _this2.returnUrl = returnTo;
96
80
  window.location.href = authUrl;
97
81
  } else {
98
82
  _this2.reentry = true;
99
83
  _this2.returnUrl = null;
100
-
101
84
  if (!_this2.code_verifier) {
102
85
  return Promise.reject(new Error('OAuth failed: expected code_verifier to be stored'));
103
86
  }
104
-
105
87
  var params = new URLSearchParams(window.location.search);
106
88
  var code = params.get('code');
107
-
108
89
  if (!code) {
109
90
  return Promise.reject(new Error("OAuth failed: no OAuth code parameter found in ".concat(window.location.pathname + window.location.search)));
110
91
  }
111
-
112
92
  yield _this2.redeemAuthCode(code);
113
93
  }
114
-
115
94
  return yield _this2.getToken();
116
95
  }
117
-
118
96
  return _this2.activeToken;
119
97
  })();
120
98
  }
121
-
122
99
  requestToken(body) {
123
100
  var _this3 = this;
124
-
125
101
  return _asyncToGenerator(function* () {
126
102
  var config = _this3.readConfig();
127
-
128
103
  var url = new URL(config.base_url);
129
104
  url.pathname = '/api/token';
130
105
  var token = yield _this3.ok(_this3.transport.request('POST', url.toString(), undefined, body));
131
106
  return _this3.activeToken.setToken(token);
132
107
  })();
133
108
  }
134
-
135
109
  createAuthCodeRequestUrl(scope, state) {
136
110
  var _this4 = this;
137
-
138
111
  return _asyncToGenerator(function* () {
139
- _this4.code_verifier = _this4.crypto.secureRandom(33);
140
- var code_challenge = yield _this4.crypto.sha256Hash(_this4.code_verifier);
141
-
112
+ var verifier = _this4.crypto.secureRandom(33);
113
+ _this4.code_verifier = verifier;
114
+ var code_challenge = yield _this4.crypto.sha256Hash(verifier);
142
115
  var config = _this4.readConfig();
143
-
144
116
  var params = {
145
117
  client_id: config.client_id,
146
118
  code_challenge: code_challenge,
@@ -156,7 +128,6 @@ export class OAuthSession extends AuthSession {
156
128
  return url.toString();
157
129
  })();
158
130
  }
159
-
160
131
  redeemAuthCodeBody(authCode, codeVerifier) {
161
132
  var verifier = codeVerifier || this.code_verifier || '';
162
133
  var config = this.readConfig();
@@ -168,23 +139,18 @@ export class OAuthSession extends AuthSession {
168
139
  redirect_uri: config.redirect_uri
169
140
  };
170
141
  }
171
-
172
142
  redeemAuthCode(authCode, codeVerifier) {
173
143
  var _this5 = this;
174
-
175
144
  return _asyncToGenerator(function* () {
176
145
  return _this5.requestToken(_this5.redeemAuthCodeBody(authCode, codeVerifier));
177
146
  })();
178
147
  }
179
-
180
148
  getToken() {
181
149
  var _this6 = this;
182
-
183
150
  return _asyncToGenerator(function* () {
184
151
  if (!_this6.isAuthenticated()) {
185
152
  if (_this6.activeToken.refresh_token) {
186
153
  var config = _this6.readConfig();
187
-
188
154
  yield _this6.requestToken({
189
155
  client_id: config.client_id,
190
156
  grant_type: 'refresh_token',
@@ -193,38 +159,29 @@ export class OAuthSession extends AuthSession {
193
159
  });
194
160
  }
195
161
  }
196
-
197
162
  return _this6.activeToken;
198
163
  })();
199
164
  }
200
-
201
165
  isAuthenticated() {
202
166
  return this.activeToken.isActive();
203
167
  }
204
-
205
168
  logout() {
206
169
  var _this7 = this;
207
-
208
170
  return _asyncToGenerator(function* () {
209
171
  if (_this7.activeToken.access_token) {
210
172
  yield _this7.ok(_this7.transport.request('DELETE', "/api/logout", undefined, undefined, init => {
211
173
  init.headers.Authorization = "Bearer ".concat(_this7.activeToken.access_token);
212
174
  return init;
213
175
  }));
214
- _this7.activeToken = new AuthToken();
215
-
176
+ _this7.activeToken = new _authToken.AuthToken();
216
177
  _this7.clearStorage();
217
-
218
178
  return true;
219
179
  }
220
-
221
180
  return false;
222
181
  })();
223
182
  }
224
-
225
183
  }
226
-
184
+ exports.OAuthSession = OAuthSession;
227
185
  _defineProperty(OAuthSession, "codeVerifierKey", 'looker_oauth_code_verifier');
228
-
229
186
  _defineProperty(OAuthSession, "returnUrlKey", 'looker_oauth_return_url');
230
187
  //# sourceMappingURL=oauthSession.js.map