@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
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/constants.ts"],"names":["matchCharset","matchCharsetUtf8","matchModeString","matchModeBinary","isTrue","value","test","isFalse","boolDefault","defaultBool","unquote","quote","substring","endsWith","length"],"mappings":"AA0BA,OAAO,IAAMA,YAAY,GAAG,eAArB;AAMP,OAAO,IAAMC,gBAAgB,aAAMD,YAAN,kBAAtB;AAMP,OAAO,IAAME,eAAe,gJAAyIF,YAAzI,MAArB;AAMP,OAAO,IAAMG,eAAe,GAC1B,sEADK;AAQP,OAAO,IAAMC,MAAM,GAAIC,KAAD,IAAmB,sBAAsBC,IAAtB,CAA2BD,KAA3B,CAAlC;AAOP,OAAO,IAAME,OAAO,GAAIF,KAAD,IAAmB,sBAAsBC,IAAtB,CAA2BD,KAA3B,CAAnC;AAQP,OAAO,IAAMG,WAAW,GAAG,SAAdA,WAAc,CAACH,KAAD,EAAwC;AAAA,MAAxBI,WAAwB,uEAAV,KAAU;AACjE,MAAIL,MAAM,CAACC,KAAD,CAAV,EAAmB,OAAO,IAAP;AACnB,MAAIE,OAAO,CAACF,KAAD,CAAX,EAAoB,OAAO,KAAP;AACpB,SAAOI,WAAP;AACD,CAJM;AAWP,OAAO,IAAMC,OAAO,GAAIL,KAAD,IAA8C;AACnE,MAAI,CAACA,KAAL,EAAY,OAAO,EAAP;;AACZ,MAAI,SAASC,IAAT,CAAcD,KAAd,CAAJ,EAA0B;AACxB,QAAMM,KAAK,GAAGN,KAAK,CAACO,SAAN,CAAgB,CAAhB,EAAmB,CAAnB,CAAd;AAEA,QAAIP,KAAK,CAACQ,QAAN,CAAeF,KAAf,CAAJ,EAA2B,OAAON,KAAK,CAACO,SAAN,CAAgB,CAAhB,EAAmBP,KAAK,CAACS,MAAN,GAAe,CAAlC,CAAP;AAC5B;;AACD,SAAOT,KAAP;AACD,CARM","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 const matchCharset = ';.*\bcharset\b='\n\n/**\n * Does this content type say it's utf-8?\n * @type {string} Regular expression for matching charset=utf-8 in Content-Type\n */\nexport const matchCharsetUtf8 = `${matchCharset}.*\\\\butf-8\\\\b`\n\n/**\n * Matching rules for string/text types. String matches must be checked *before* binary matches\n * @type {string} Regular expression for matching Content-Type headers\n */\nexport const matchModeString = `(^application\\\\/.*(\\\\bjson\\\\b|\\\\bxml\\\\b|\\\\bsql\\\\b|\\\\bgraphql\\\\b|\\\\bjavascript\\\\b|\\\\bx-www-form-urlencoded\\\\b)|^text\\\\/|.*\\\\+xml\\\\b|${matchCharset})`\n\n/**\n * Matching rules for all binary or unknown types. Binary matches must be checked *after* string matches\n * @type {string} Regular expression for matching Content-Type headers\n */\nexport const matchModeBinary =\n '^image\\\\/|^audio\\\\/|^video\\\\/|^font\\\\/|^application\\\\/|^multipart\\\\/'\n\n/**\n * Does this string mean \"true\"\n * @param {string} value\n * @returns {boolean} true if matching a `true` value, false otherwise\n */\nexport const isTrue = (value: string) => /^(true|t|yes|y|1)$/i.test(value)\n\n/**\n * Does this string mean \"false\"\n * @param {string} value\n * @returns {boolean} true if matching a `false` value, false otherwise\n */\nexport const isFalse = (value: string) => /^(false|f|no|n|0)$/i.test(value)\n\n/**\n * Return true, false, or default boolean value for string representation of boolean\n * @param {string} value\n * @param {boolean} defaultBool is the value to return if the string doesn't match. defaults to false.\n * @returns {boolean} true or false\n */\nexport const boolDefault = (value: string, defaultBool = false) => {\n if (isTrue(value)) return true\n if (isFalse(value)) return false\n return defaultBool\n}\n\n/**\n * strip surrounding quotes from a string if it is uniformly quoted\n * @param {string | null} value to unquote\n * @returns {string | null} unquoted string if it begins and ends with the same character out of `\\` \" '`\n */\nexport const unquote = (value: string | undefined | null): string => {\n if (!value) return ''\n if (/^['\"`]/.test(value)) {\n const quote = value.substring(0, 1)\n // Strip surrounding quotes?\n if (value.endsWith(quote)) return value.substring(1, value.length - 1)\n }\n return value\n}\n\n/**\n * Documented type alias because URL assignment construction is not compatible with API parameters\n */\nexport type Url = string\n\n/** Documented type to clarify SDK hash types */\nexport interface IDictionary<T> {\n [key: string]: T\n}\n\n/**\n * Documented type alias for password spec\n */\nexport type Password = string\n"],"file":"constants.js"}
1
+ {"version":3,"file":"constants.js","names":["matchCharset","matchCharsetUtf8","matchModeString","matchModeBinary","isTrue","value","test","isFalse","boolDefault","defaultBool","unquote","quote","substring","endsWith","length"],"sources":["../../src/constants.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 const matchCharset = ';.*\bcharset\b='\n\n/**\n * Does this content type say it's utf-8?\n * @type {string} Regular expression for matching charset=utf-8 in Content-Type\n */\nexport const matchCharsetUtf8 = `${matchCharset}.*\\\\butf-8\\\\b`\n\n/**\n * Matching rules for string/text types. String matches must be checked *before* binary matches\n * @type {string} Regular expression for matching Content-Type headers\n */\nexport const matchModeString = `(^application\\\\/.*(\\\\bjson\\\\b|\\\\bxml\\\\b|\\\\bsql\\\\b|\\\\bgraphql\\\\b|\\\\bjavascript\\\\b|\\\\bx-www-form-urlencoded\\\\b)|^text\\\\/|.*\\\\+xml\\\\b|${matchCharset})`\n\n/**\n * Matching rules for all binary or unknown types. Binary matches must be checked *after* string matches\n * @type {string} Regular expression for matching Content-Type headers\n */\nexport const matchModeBinary =\n '^image\\\\/|^audio\\\\/|^video\\\\/|^font\\\\/|^application\\\\/|^multipart\\\\/'\n\n/**\n * Does this string mean \"true\"\n * @param {string} value\n * @returns {boolean} true if matching a `true` value, false otherwise\n */\nexport const isTrue = (value: string) => /^(true|t|yes|y|1)$/i.test(value)\n\n/**\n * Does this string mean \"false\"\n * @param {string} value\n * @returns {boolean} true if matching a `false` value, false otherwise\n */\nexport const isFalse = (value: string) => /^(false|f|no|n|0)$/i.test(value)\n\n/**\n * Return true, false, or default boolean value for string representation of boolean\n * @param {string} value\n * @param {boolean} defaultBool is the value to return if the string doesn't match. defaults to false.\n * @returns {boolean} true or false\n */\nexport const boolDefault = (value: string, defaultBool = false) => {\n if (isTrue(value)) return true\n if (isFalse(value)) return false\n return defaultBool\n}\n\n/**\n * strip surrounding quotes from a string if it is uniformly quoted\n * @param {string | null} value to unquote\n * @returns {string | null} unquoted string if it begins and ends with the same character out of `\\` \" '`\n */\nexport const unquote = (value: string | undefined | null): string => {\n if (!value) return ''\n if (/^['\"`]/.test(value)) {\n const quote = value.substring(0, 1)\n // Strip surrounding quotes?\n if (value.endsWith(quote)) return value.substring(1, value.length - 1)\n }\n return value\n}\n\n/**\n * Documented type alias because URL assignment construction is not compatible with API parameters\n */\nexport type Url = string\n\n/** Documented type to clarify SDK hash types */\nexport interface IDictionary<T> {\n [key: string]: T\n}\n\n/**\n * Documented type alias for password spec\n */\nexport type Password = string\n"],"mappings":";;;;;;AA0BO,IAAMA,YAAY,GAAG,eAAe;AAAA;AAMpC,IAAMC,gBAAgB,aAAMD,YAAY,kBAAe;AAAA;AAMvD,IAAME,eAAe,gJAAyIF,YAAY,MAAG;AAAA;AAM7K,IAAMG,eAAe,GAC1B,sEAAsE;AAAA;AAOjE,IAAMC,MAAM,GAAIC,KAAa,IAAK,qBAAqB,CAACC,IAAI,CAACD,KAAK,CAAC;AAAA;AAOnE,IAAME,OAAO,GAAIF,KAAa,IAAK,qBAAqB,CAACC,IAAI,CAACD,KAAK,CAAC;AAAA;AAQpE,IAAMG,WAAW,GAAG,SAAdA,WAAW,CAAIH,KAAa,EAA0B;EAAA,IAAxBI,WAAW,uEAAG,KAAK;EAC5D,IAAIL,MAAM,CAACC,KAAK,CAAC,EAAE,OAAO,IAAI;EAC9B,IAAIE,OAAO,CAACF,KAAK,CAAC,EAAE,OAAO,KAAK;EAChC,OAAOI,WAAW;AACpB,CAAC;AAAA;AAOM,IAAMC,OAAO,GAAIL,KAAgC,IAAa;EACnE,IAAI,CAACA,KAAK,EAAE,OAAO,EAAE;EACrB,IAAI,QAAQ,CAACC,IAAI,CAACD,KAAK,CAAC,EAAE;IACxB,IAAMM,KAAK,GAAGN,KAAK,CAACO,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;IAEnC,IAAIP,KAAK,CAACQ,QAAQ,CAACF,KAAK,CAAC,EAAE,OAAON,KAAK,CAACO,SAAS,CAAC,CAAC,EAAEP,KAAK,CAACS,MAAM,GAAG,CAAC,CAAC;EACxE;EACA,OAAOT,KAAK;AACd,CAAC;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"cryptoHash.js"}
1
+ {"version":3,"file":"cryptoHash.js","names":[],"sources":["../../src/cryptoHash.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 interface ICryptoHash {\n secureRandom(byte_count: number): string\n sha256Hash(message: string): Promise<string>\n}\n"],"mappings":""}
@@ -1,6 +1,13 @@
1
- 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; }
1
+ "use strict";
2
2
 
3
- export class DelimArray extends Array {
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DelimArray = void 0;
7
+ 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; }
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
9
+ 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); }
10
+ class DelimArray extends Array {
4
11
  constructor(items) {
5
12
  var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
6
13
  var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
@@ -9,17 +16,14 @@ export class DelimArray extends Array {
9
16
  this.separator = separator;
10
17
  this.prefix = prefix;
11
18
  this.suffix = suffix;
12
-
13
19
  _defineProperty(this, "toString", () => {
14
20
  return "".concat(this.prefix).concat(this.join(this.separator)).concat(this.suffix);
15
21
  });
16
-
17
22
  this.push(...(items || []));
18
23
  }
19
-
20
24
  static create() {
21
25
  return Object.create(DelimArray.prototype);
22
26
  }
23
-
24
27
  }
28
+ exports.DelimArray = DelimArray;
25
29
  //# sourceMappingURL=delimArray.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/delimArray.ts"],"names":["DelimArray","Array","constructor","items","separator","prefix","suffix","join","push","create","Object","prototype"],"mappings":";;AA0BA,OAAO,MAAMA,UAAN,SAA4BC,KAA5B,CAAqC;AAC1CC,EAAAA,WAAW,CACTC,KADS,EAKT;AAAA,QAHOC,SAGP,uEAH2B,GAG3B;AAAA,QAFOC,MAEP,uEAFwB,EAExB;AAAA,QADOC,MACP,uEADwB,EACxB;AACA;AADA,SAHOF,SAGP,GAHOA,SAGP;AAAA,SAFOC,MAEP,GAFOA,MAEP;AAAA,SADOC,MACP,GADOA,MACP;;AAAA,sCAagB,MAAc;AAC9B,uBAAU,KAAKD,MAAf,SAAwB,KAAKE,IAAL,CAAU,KAAKH,SAAf,CAAxB,SAAoD,KAAKE,MAAzD;AACD,KAfC;;AAEA,SAAKE,IAAL,CAAU,IAAIL,KAAK,IAAI,EAAb,CAAV;AACD;;AAEY,SAANM,MAAM,GAAqB;AAChC,WAAOC,MAAM,CAACD,MAAP,CAAcT,UAAU,CAACW,SAAzB,CAAP;AACD;;AAbyC","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 class DelimArray<T> extends Array<T> {\n constructor(\n items?: Array<T>,\n public separator: string = ',',\n public prefix: string = '',\n public suffix: string = ''\n ) {\n super()\n this.push(...(items || []))\n }\n\n static create<T>(): DelimArray<T> {\n return Object.create(DelimArray.prototype)\n }\n\n /**\n * Override of Array<T> toString so custom separators can be used\n * @returns {string} Delimited version of array\n */\n public toString = (): string => {\n return `${this.prefix}${this.join(this.separator)}${this.suffix}`\n }\n}\n"],"file":"delimArray.js"}
1
+ {"version":3,"file":"delimArray.js","names":["DelimArray","Array","constructor","items","separator","prefix","suffix","join","push","create","Object","prototype"],"sources":["../../src/delimArray.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 class DelimArray<T> extends Array<T> {\n constructor(\n items?: Array<T>,\n public separator: string = ',',\n public prefix: string = '',\n public suffix: string = ''\n ) {\n super()\n this.push(...(items || []))\n }\n\n static create<T>(): DelimArray<T> {\n return Object.create(DelimArray.prototype)\n }\n\n /**\n * Override of Array<T> toString so custom separators can be used\n * @returns {string} Delimited version of array\n */\n public toString = (): string => {\n return `${this.prefix}${this.join(this.separator)}${this.suffix}`\n }\n}\n"],"mappings":";;;;;;;;;AA0BO,MAAMA,UAAU,SAAYC,KAAK,CAAI;EAC1CC,WAAW,CACTC,KAAgB,EAIhB;IAAA,IAHOC,SAAiB,uEAAG,GAAG;IAAA,IACvBC,MAAc,uEAAG,EAAE;IAAA,IACnBC,MAAc,uEAAG,EAAE;IAE1B,KAAK,EAAE;IAAA,KAJAF,SAAiB,GAAjBA,SAAiB;IAAA,KACjBC,MAAc,GAAdA,MAAc;IAAA,KACdC,MAAc,GAAdA,MAAc;IAAA,kCAcL,MAAc;MAC9B,iBAAU,IAAI,CAACD,MAAM,SAAG,IAAI,CAACE,IAAI,CAAC,IAAI,CAACH,SAAS,CAAC,SAAG,IAAI,CAACE,MAAM;IACjE,CAAC;IAbC,IAAI,CAACE,IAAI,CAAC,IAAIL,KAAK,IAAI,EAAE,CAAC,CAAC;EAC7B;EAEA,OAAOM,MAAM,GAAqB;IAChC,OAAOC,MAAM,CAACD,MAAM,CAACT,UAAU,CAACW,SAAS,CAAC;EAC5C;AASF;AAAC"}
@@ -1,98 +1,84 @@
1
- var _templateObject;
2
-
3
- function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); _groups.set(_this, groups || _groups.get(re)); return _setPrototypeOf(_this, BabelRegExp.prototype); } _inherits(BabelRegExp, RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; if (typeof args[args.length - 1] !== "object") { args = [].slice.call(args); args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
4
-
5
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
6
-
7
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
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; }
1
+ "use strict";
10
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ErrorDocRx = exports.ErrorDocNotFound = exports.ErrorDoc = exports.ErrorCodesUrl = void 0;
7
+ var _transport = require("./transport");
8
+ var _templateObject;
9
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { var i = g[name]; if ("number" == typeof i) groups[name] = result[i];else { for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++; groups[name] = result[i[k]]; } return groups; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) { result.groups = buildGroups(result, this); var indices = result.indices; indices && (indices.groups = buildGroups(indices, this)); } return result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { var group = groups[name]; return "$" + (Array.isArray(group) ? group.join("$") : group); })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
10
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
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(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
14
+ 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); }
11
15
  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); } }
12
-
13
16
  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); }); }; }
14
-
15
17
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
16
-
17
- import { sdkOk } from './transport';
18
- export var ErrorCodesUrl = 'https://marketplace-api.looker.com/errorcodes/';
19
- export var ErrorDocNotFound = '### No documentation found for ';
18
+ var ErrorCodesUrl = 'https://marketplace-api.looker.com/errorcodes/';
19
+ exports.ErrorCodesUrl = ErrorCodesUrl;
20
+ var ErrorDocNotFound = '### No documentation found for ';
21
+ exports.ErrorDocNotFound = ErrorDocNotFound;
20
22
  var ErrorDocPatternExpression = String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["(?<redirector>(https://docs.looker.com/r|https://cloud.google.com/looker/docs/r)?/err/)(?<apiVersion>.*)/(?<statusCode>d{3})(?<apiPath>.*)"], ["(?<redirector>(https:\\/\\/docs\\.looker\\.com\\/r|https:\\/\\/cloud\\.google\\.com\\/looker\\/docs\\/r)?\\/err\\/)(?<apiVersion>.*)\\/(?<statusCode>\\d{3})(?<apiPath>.*)"])));
21
- export var ErrorDocRx = RegExp(ErrorDocPatternExpression, 'i');
22
-
23
+ var ErrorDocRx = RegExp(ErrorDocPatternExpression, 'i');
24
+ exports.ErrorDocRx = ErrorDocRx;
23
25
  var sdkUrlGet = function () {
24
26
  var _ref = _asyncToGenerator(function* (sdk, url) {
25
- return yield sdkOk(sdk.authSession.transport.request('GET', url));
27
+ return yield (0, _transport.sdkOk)(sdk.authSession.transport.request('GET', url));
26
28
  });
27
-
28
29
  return function sdkUrlGet(_x, _x2) {
29
30
  return _ref.apply(this, arguments);
30
31
  };
31
32
  }();
32
-
33
- export class ErrorDoc {
33
+ class ErrorDoc {
34
34
  constructor(sdk) {
35
35
  var getter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : sdkUrlGet;
36
36
  var cdnUrl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ErrorCodesUrl;
37
37
  this.sdk = sdk;
38
38
  this.getter = getter;
39
39
  this.cdnUrl = cdnUrl;
40
-
41
40
  _defineProperty(this, "_index", undefined);
42
41
  }
43
-
44
42
  load() {
45
43
  var _this = this;
46
-
47
44
  return _asyncToGenerator(function* () {
48
45
  if (!_this._index) {
49
46
  try {
50
47
  var result = yield _this.getter(_this.sdk, _this.indexUrl);
51
-
52
48
  if (typeof result === 'string') {
53
49
  result = JSON.parse(result);
54
50
  }
55
-
56
51
  _this._index = result;
57
52
  } catch (e) {
58
53
  return Promise.resolve({});
59
54
  }
60
55
  }
61
-
62
56
  return _this._index;
63
57
  })();
64
58
  }
65
-
66
59
  get indexUrl() {
67
60
  return this.contentUrl('index.json');
68
61
  }
69
-
70
62
  get index() {
71
63
  if (!this._index) {
72
64
  this.load().catch(reason => console.error(reason));
73
65
  }
74
-
75
66
  return this._index;
76
67
  }
77
-
78
68
  specPath(path) {
79
69
  var result = path.replace(/:\w+/g, found => "{".concat(found.substr(1), "}"));
80
70
  return result;
81
71
  }
82
-
83
72
  errorKey(docUrl) {
84
73
  var bits = this.parse(docUrl);
85
74
  if (!bits.redirector) return '';
86
75
  return this.specPath("".concat(bits.statusCode).concat(bits.apiPath));
87
76
  }
88
-
89
77
  notFound(key) {
90
78
  return "".concat(ErrorDocNotFound).concat(key);
91
79
  }
92
-
93
80
  getContent(url) {
94
81
  var _this2 = this;
95
-
96
82
  return _asyncToGenerator(function* () {
97
83
  try {
98
84
  return yield _this2.getter(_this2.sdk, url);
@@ -101,53 +87,39 @@ export class ErrorDoc {
101
87
  }
102
88
  })();
103
89
  }
104
-
105
90
  content(docUrl) {
106
91
  var _this3 = this;
107
-
108
92
  return _asyncToGenerator(function* () {
109
93
  var key = _this3.errorKey(docUrl);
110
-
111
94
  if (!key) {
112
95
  return Promise.resolve(_this3.notFound('bad error code link'));
113
96
  }
114
-
115
97
  yield _this3.load();
116
98
  var item = _this3.index ? _this3.index[key] : undefined;
117
-
118
99
  if (!item) {
119
100
  var code = key.split('/')[0];
120
101
  item = _this3.index ? _this3.index[code] : undefined;
121
-
122
102
  if (!item) {
123
103
  return Promise.resolve(_this3.notFound(key));
124
104
  }
125
105
  }
126
-
127
106
  var url = _this3.contentUrl(item.url);
128
-
129
107
  return yield _this3.getContent(url);
130
108
  })();
131
109
  }
132
-
133
110
  contentUrl(urlPath) {
134
111
  return "".concat(this.cdnUrl).concat(urlPath);
135
112
  }
136
-
137
113
  methodName(errorMdUrl) {
138
114
  var _match$groups;
139
-
140
- var ErrorMdRx = _wrapRegExp(/([0-9A-Z_a-z]+)_[0-9]{3}\.md/i, {
115
+ var ErrorMdRx = _wrapRegExp(/(\w+)_\d{3}\.md/i, {
141
116
  name: 1
142
117
  });
143
-
144
118
  var match = errorMdUrl.match(ErrorMdRx);
145
119
  return (match === null || match === void 0 ? void 0 : (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.name) || '';
146
120
  }
147
-
148
121
  parse(docUrl) {
149
122
  var _match$groups2, _match$groups3, _match$groups4, _match$groups5;
150
-
151
123
  var match = docUrl.match(ErrorDocRx);
152
124
  return {
153
125
  redirector: (match === null || match === void 0 ? void 0 : (_match$groups2 = match.groups) === null || _match$groups2 === void 0 ? void 0 : _match$groups2.redirector) || '',
@@ -156,6 +128,6 @@ export class ErrorDoc {
156
128
  apiPath: (match === null || match === void 0 ? void 0 : (_match$groups5 = match.groups) === null || _match$groups5 === void 0 ? void 0 : _match$groups5.apiPath) || ''
157
129
  };
158
130
  }
159
-
160
131
  }
132
+ exports.ErrorDoc = ErrorDoc;
161
133
  //# sourceMappingURL=errorDoc.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/errorDoc.ts"],"names":["sdkOk","ErrorCodesUrl","ErrorDocNotFound","ErrorDocPatternExpression","String","raw","ErrorDocRx","RegExp","sdkUrlGet","sdk","url","authSession","transport","request","ErrorDoc","constructor","getter","cdnUrl","undefined","load","_index","result","indexUrl","JSON","parse","e","Promise","resolve","contentUrl","index","catch","reason","console","error","specPath","path","replace","found","substr","errorKey","docUrl","bits","redirector","statusCode","apiPath","notFound","key","getContent","message","content","item","code","split","urlPath","methodName","errorMdUrl","ErrorMdRx","match","groups","name","apiVersion"],"mappings":";;;;;;;;;;;;;;;;AA2BA,SAASA,KAAT,QAAsB,aAAtB;AAQA,OAAO,IAAMC,aAAa,GAAG,gDAAtB;AAMP,OAAO,IAAMC,gBAAgB,GAAG,iCAAzB;AAGP,IAAMC,yBAAyB,GAAGC,MAAM,CAACC,GAAV,+XAA/B;AACA,OAAO,IAAMC,UAAU,GAAGC,MAAM,CAACJ,yBAAD,EAA4B,GAA5B,CAAzB;;AAmFP,IAAMK,SAAS;AAAA,+BAAG,WAAOC,GAAP,EAAyBC,GAAzB,EAAyC;AACzD,iBAAaV,KAAK,CAChBS,GAAG,CAACE,WAAJ,CAAgBC,SAAhB,CAA0BC,OAA1B,CAAiD,KAAjD,EAAwDH,GAAxD,CADgB,CAAlB;AAGD,GAJc;;AAAA,kBAATF,SAAS;AAAA;AAAA;AAAA,GAAf;;AAMA,OAAO,MAAMM,QAAN,CAAoC;AAEzCC,EAAAA,WAAW,CACFN,GADE,EAIT;AAAA,QAFOO,MAEP,uEAFgCR,SAEhC;AAAA,QADgBS,MAChB,uEADiChB,aACjC;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pC,GAAG,GAAG,MAAI,CAACkB,UAAL,CAAgBsB,IAAI,CAACxC,GAArB,CAAZ;;AACA,mBAAa,MAAI,CAACqC,UAAL,CAAgBrC,GAAhB,CAAb;AAhB6C;AAiB9C;;AAEDkB,EAAAA,UAAU,CAACyB,OAAD,EAA0B;AAClC,qBAAU,KAAKpC,MAAf,SAAwBoC,OAAxB;AACD;;AAEDC,EAAAA,UAAU,CAACC,UAAD,EAA6B;AAAA;;AACrC,QAAMC,SAAS,eAAG,+BAAH;AAAA;AAAA,MAAf;;AACA,QAAMC,KAAK,GAAGF,UAAU,CAACE,KAAX,CAAiBD,SAAjB,CAAd;AACA,WAAO,CAAAC,KAAK,SAAL,IAAAA,KAAK,WAAL,6BAAAA,KAAK,CAAEC,MAAP,gEAAeC,IAAf,KAAuB,EAA9B;AACD;;AAEDnC,EAAAA,KAAK,CAACgB,MAAD,EAAgC;AAAA;;AACnC,QAAMiB,KAAK,GAAGjB,MAAM,CAACiB,KAAP,CAAanD,UAAb,CAAd;AACA,WAAO;AACLoC,MAAAA,UAAU,EAAE,CAAAe,KAAK,SAAL,IAAAA,KAAK,WAAL,8BAAAA,KAAK,CAAEC,MAAP,kEAAehB,UAAf,KAA6B,EADpC;AAELkB,MAAAA,UAAU,EAAE,CAAAH,KAAK,SAAL,IAAAA,KAAK,WAAL,8BAAAA,KAAK,CAAEC,MAAP,kEAAeE,UAAf,KAA6B,EAFpC;AAGLjB,MAAAA,UAAU,EAAE,CAAAc,KAAK,SAAL,IAAAA,KAAK,WAAL,8BAAAA,KAAK,CAAEC,MAAP,kEAAef,UAAf,KAA6B,EAHpC;AAILC,MAAAA,OAAO,EAAE,CAAAa,KAAK,SAAL,IAAAA,KAAK,WAAL,8BAAAA,KAAK,CAAEC,MAAP,kEAAed,OAAf,KAA0B;AAJ9B,KAAP;AAMD;;AA9FwC","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\nimport type { IAPIMethods } from './apiMethods'\nimport { sdkOk } from './transport'\n\nexport interface IErrorDocItem {\n /** relative path of mark down document */\n url: string\n}\n\n/** Location of the public CDN for Looker API Error codes */\nexport const ErrorCodesUrl = 'https://marketplace-api.looker.com/errorcodes/'\n\n/** Structure of the error code document index */\nexport type ErrorCodeIndex = Record<string, IErrorDocItem>\n\n/** Default \"not found\" content for error documents that don't (yet) exist */\nexport const ErrorDocNotFound = '### No documentation found for '\n\n/** API error document_url link pattern */\nconst ErrorDocPatternExpression = String.raw`(?<redirector>(https:\\/\\/docs\\.looker\\.com\\/r|https:\\/\\/cloud\\.google\\.com\\/looker\\/docs\\/r)?\\/err\\/)(?<apiVersion>.*)\\/(?<statusCode>\\d{3})(?<apiPath>.*)`\nexport const ErrorDocRx = RegExp(ErrorDocPatternExpression, 'i')\n\nexport interface IErrorDocLink {\n /** base redirector url */\n redirector: string\n /** api version of the error link */\n apiVersion: string\n /** HTTP status code */\n statusCode: string\n /** REST API Path */\n apiPath: string\n}\n\nexport interface IErrorDoc {\n /** Index of all know error codes. Call load() to populate it */\n index?: ErrorCodeIndex\n\n /** Url of API error document index */\n indexUrl: string\n\n /**\n * Extract error url into its parts\n * @param docUrl value of documentation_url from error payload\n */\n parse(docUrl: string): IErrorDocLink\n\n /**\n * full url to resolve error document\n * @param urlPath resolved index item (used by content())\n */\n contentUrl(urlPath: string): string\n\n /**\n * fetch content from the URL, returning a \"not found\" response if it fails\n * @param url to fetch\n */\n getContent(url: string): Promise<string>\n\n /**\n * Returns the markdown of the error document\n *\n * Some kind of content is always returned from this method. The content is\n * one of:\n * - the specific document for the method and error code\n * - a generic document for the error code\n * - a \"not found\" mark down if the specific and generic are not defined\n *\n * @param docUrl value of documentation_url from error payload\n */\n content(docUrl: string): Promise<string>\n\n /**\n * Ensure API request path matches the OpenAPI path pattern\n *\n * @example\n * `/entity/:id/part/:part` should be `/entity/{id}/part/{part}`\n *\n * @param path to convert to a spec path\n */\n specPath(path: string): string\n\n /**\n * get the lookup key for the documentation_url\n * @param docUrl value of documentation_url from error payload\n */\n errorKey(docUrl: string): string\n\n /** Fetch and parse the error codes documentation index from the CDN */\n load(): Promise<ErrorCodeIndex>\n\n /**\n * get the name of the method from the error doc url\n * @param errorMdUrl url for the error document\n */\n methodName(errorMdUrl: string): string\n}\n\nexport type SDKGetCallback = (sdk: IAPIMethods, url: string) => Promise<string>\n/**\n * Default fetcher using the SDK\n * @param url to get\n * @private\n */\nconst sdkUrlGet = async (sdk: IAPIMethods, url: string) => {\n return await sdkOk(\n sdk.authSession.transport.request<string, Error>('GET', url)\n )\n}\n\nexport class ErrorDoc implements IErrorDoc {\n private _index?: ErrorCodeIndex = undefined\n constructor(\n public sdk: IAPIMethods,\n public getter: SDKGetCallback = sdkUrlGet,\n public readonly cdnUrl: string = ErrorCodesUrl\n ) {}\n\n public async load(): Promise<ErrorCodeIndex> {\n if (!this._index) {\n try {\n let result = await this.getter(this.sdk, this.indexUrl)\n if (typeof result === 'string') {\n result = JSON.parse(result)\n }\n this._index = result as unknown as ErrorCodeIndex\n } catch (e: any) {\n return Promise.resolve({})\n }\n }\n return this._index\n }\n\n public get indexUrl() {\n return this.contentUrl('index.json')\n }\n\n public get index() {\n if (!this._index) {\n this.load().catch((reason) => console.error(reason))\n }\n return this._index\n }\n\n specPath(path: string): string {\n const result = path.replace(/:\\w+/g, (found) => `{${found.substr(1)}}`)\n return result\n }\n\n errorKey(docUrl: string): string {\n const bits = this.parse(docUrl)\n if (!bits.redirector) return ''\n return this.specPath(`${bits.statusCode}${bits.apiPath}`)\n }\n\n private notFound(key: string): string {\n return `${ErrorDocNotFound}${key}`\n }\n\n async getContent(url: string): Promise<string> {\n try {\n return await this.getter(this.sdk, url)\n } catch (e: any) {\n return Promise.resolve(this.notFound(e.message))\n }\n }\n\n async content(docUrl: string): Promise<string> {\n const key = this.errorKey(docUrl)\n if (!key) {\n return Promise.resolve(this.notFound('bad error code link'))\n }\n await this.load()\n let item = this.index ? this.index[key] : undefined\n if (!item) {\n // fallback to generic error document\n const code = key.split('/')[0]\n item = this.index ? this.index[code] : undefined\n if (!item) {\n return Promise.resolve(this.notFound(key))\n }\n }\n const url = this.contentUrl(item.url)\n return await this.getContent(url)\n }\n\n contentUrl(urlPath: string): string {\n return `${this.cdnUrl}${urlPath}`\n }\n\n methodName(errorMdUrl: string): string {\n const ErrorMdRx = /(?<name>\\w+)_\\d{3}\\.md/i\n const match = errorMdUrl.match(ErrorMdRx)\n return match?.groups?.name || ''\n }\n\n parse(docUrl: string): IErrorDocLink {\n const match = docUrl.match(ErrorDocRx)\n return {\n redirector: match?.groups?.redirector || '',\n apiVersion: match?.groups?.apiVersion || '',\n statusCode: match?.groups?.statusCode || '',\n apiPath: match?.groups?.apiPath || '',\n }\n }\n}\n"],"file":"errorDoc.js"}
1
+ {"version":3,"file":"errorDoc.js","names":["ErrorCodesUrl","ErrorDocNotFound","ErrorDocPatternExpression","String","raw","ErrorDocRx","RegExp","sdkUrlGet","sdk","url","sdkOk","authSession","transport","request","ErrorDoc","constructor","getter","cdnUrl","undefined","load","_index","result","indexUrl","JSON","parse","e","Promise","resolve","contentUrl","index","catch","reason","console","error","specPath","path","replace","found","substr","errorKey","docUrl","bits","redirector","statusCode","apiPath","notFound","key","getContent","message","content","item","code","split","urlPath","methodName","errorMdUrl","ErrorMdRx","match","groups","name","apiVersion"],"sources":["../../src/errorDoc.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\nimport type { IAPIMethods } from './apiMethods'\nimport { sdkOk } from './transport'\n\nexport interface IErrorDocItem {\n /** relative path of mark down document */\n url: string\n}\n\n/** Location of the public CDN for Looker API Error codes */\nexport const ErrorCodesUrl = 'https://marketplace-api.looker.com/errorcodes/'\n\n/** Structure of the error code document index */\nexport type ErrorCodeIndex = Record<string, IErrorDocItem>\n\n/** Default \"not found\" content for error documents that don't (yet) exist */\nexport const ErrorDocNotFound = '### No documentation found for '\n\n/** API error document_url link pattern */\nconst ErrorDocPatternExpression = String.raw`(?<redirector>(https:\\/\\/docs\\.looker\\.com\\/r|https:\\/\\/cloud\\.google\\.com\\/looker\\/docs\\/r)?\\/err\\/)(?<apiVersion>.*)\\/(?<statusCode>\\d{3})(?<apiPath>.*)`\nexport const ErrorDocRx = RegExp(ErrorDocPatternExpression, 'i')\n\nexport interface IErrorDocLink {\n /** base redirector url */\n redirector: string\n /** api version of the error link */\n apiVersion: string\n /** HTTP status code */\n statusCode: string\n /** REST API Path */\n apiPath: string\n}\n\nexport interface IErrorDoc {\n /** Index of all know error codes. Call load() to populate it */\n index?: ErrorCodeIndex\n\n /** Url of API error document index */\n indexUrl: string\n\n /**\n * Extract error url into its parts\n * @param docUrl value of documentation_url from error payload\n */\n parse(docUrl: string): IErrorDocLink\n\n /**\n * full url to resolve error document\n * @param urlPath resolved index item (used by content())\n */\n contentUrl(urlPath: string): string\n\n /**\n * fetch content from the URL, returning a \"not found\" response if it fails\n * @param url to fetch\n */\n getContent(url: string): Promise<string>\n\n /**\n * Returns the markdown of the error document\n *\n * Some kind of content is always returned from this method. The content is\n * one of:\n * - the specific document for the method and error code\n * - a generic document for the error code\n * - a \"not found\" mark down if the specific and generic are not defined\n *\n * @param docUrl value of documentation_url from error payload\n */\n content(docUrl: string): Promise<string>\n\n /**\n * Ensure API request path matches the OpenAPI path pattern\n *\n * @example\n * `/entity/:id/part/:part` should be `/entity/{id}/part/{part}`\n *\n * @param path to convert to a spec path\n */\n specPath(path: string): string\n\n /**\n * get the lookup key for the documentation_url\n * @param docUrl value of documentation_url from error payload\n */\n errorKey(docUrl: string): string\n\n /** Fetch and parse the error codes documentation index from the CDN */\n load(): Promise<ErrorCodeIndex>\n\n /**\n * get the name of the method from the error doc url\n * @param errorMdUrl url for the error document\n */\n methodName(errorMdUrl: string): string\n}\n\nexport type SDKGetCallback = (sdk: IAPIMethods, url: string) => Promise<string>\n/**\n * Default fetcher using the SDK\n * @param url to get\n * @private\n */\nconst sdkUrlGet = async (sdk: IAPIMethods, url: string) => {\n return await sdkOk(\n sdk.authSession.transport.request<string, Error>('GET', url)\n )\n}\n\nexport class ErrorDoc implements IErrorDoc {\n private _index?: ErrorCodeIndex = undefined\n constructor(\n public sdk: IAPIMethods,\n public getter: SDKGetCallback = sdkUrlGet,\n public readonly cdnUrl: string = ErrorCodesUrl\n ) {}\n\n public async load(): Promise<ErrorCodeIndex> {\n if (!this._index) {\n try {\n let result = await this.getter(this.sdk, this.indexUrl)\n if (typeof result === 'string') {\n result = JSON.parse(result)\n }\n this._index = result as unknown as ErrorCodeIndex\n } catch (e: any) {\n return Promise.resolve({})\n }\n }\n return this._index\n }\n\n public get indexUrl() {\n return this.contentUrl('index.json')\n }\n\n public get index() {\n if (!this._index) {\n this.load().catch((reason) => console.error(reason))\n }\n return this._index\n }\n\n specPath(path: string): string {\n const result = path.replace(/:\\w+/g, (found) => `{${found.substr(1)}}`)\n return result\n }\n\n errorKey(docUrl: string): string {\n const bits = this.parse(docUrl)\n if (!bits.redirector) return ''\n return this.specPath(`${bits.statusCode}${bits.apiPath}`)\n }\n\n private notFound(key: string): string {\n return `${ErrorDocNotFound}${key}`\n }\n\n async getContent(url: string): Promise<string> {\n try {\n return await this.getter(this.sdk, url)\n } catch (e: any) {\n return Promise.resolve(this.notFound(e.message))\n }\n }\n\n async content(docUrl: string): Promise<string> {\n const key = this.errorKey(docUrl)\n if (!key) {\n return Promise.resolve(this.notFound('bad error code link'))\n }\n await this.load()\n let item = this.index ? this.index[key] : undefined\n if (!item) {\n // fallback to generic error document\n const code = key.split('/')[0]\n item = this.index ? this.index[code] : undefined\n if (!item) {\n return Promise.resolve(this.notFound(key))\n }\n }\n const url = this.contentUrl(item.url)\n return await this.getContent(url)\n }\n\n contentUrl(urlPath: string): string {\n return `${this.cdnUrl}${urlPath}`\n }\n\n methodName(errorMdUrl: string): string {\n const ErrorMdRx = /(?<name>\\w+)_\\d{3}\\.md/i\n const match = errorMdUrl.match(ErrorMdRx)\n return match?.groups?.name || ''\n }\n\n parse(docUrl: string): IErrorDocLink {\n const match = docUrl.match(ErrorDocRx)\n return {\n redirector: match?.groups?.redirector || '',\n apiVersion: match?.groups?.apiVersion || '',\n statusCode: match?.groups?.statusCode || '',\n apiPath: match?.groups?.apiPath || '',\n }\n }\n}\n"],"mappings":";;;;;;AA2BA;AAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ5B,IAAMA,aAAa,GAAG,gDAAgD;AAAA;AAMtE,IAAMC,gBAAgB,GAAG,iCAAiC;AAAA;AAGjE,IAAMC,yBAAyB,GAAGC,MAAM,CAACC,GAAG,+XAA4J;AACjM,IAAMC,UAAU,GAAGC,MAAM,CAACJ,yBAAyB,EAAE,GAAG,CAAC;AAAA;AAmFhE,IAAMK,SAAS;EAAA,6BAAG,WAAOC,GAAgB,EAAEC,GAAW,EAAK;IACzD,aAAa,IAAAC,gBAAK,EAChBF,GAAG,CAACG,WAAW,CAACC,SAAS,CAACC,OAAO,CAAgB,KAAK,EAAEJ,GAAG,CAAC,CAC7D;EACH,CAAC;EAAA,gBAJKF,SAAS;IAAA;EAAA;AAAA,GAId;AAEM,MAAMO,QAAQ,CAAsB;EAEzCC,WAAW,CACFP,GAAgB,EAGvB;IAAA,IAFOQ,MAAsB,uEAAGT,SAAS;IAAA,IACzBU,MAAc,uEAAGjB,aAAa;IAAA,KAFvCQ,GAAgB,GAAhBA,GAAgB;IAAA,KAChBQ,MAAsB,GAAtBA,MAAsB;IAAA,KACbC,MAAc,GAAdA,MAAc;IAAA,gCAJEC,SAAS;EAKxC;EAEUC,IAAI,GAA4B;IAAA;IAAA;MAC3C,IAAI,CAAC,KAAI,CAACC,MAAM,EAAE;QAChB,IAAI;UACF,IAAIC,MAAM,SAAS,KAAI,CAACL,MAAM,CAAC,KAAI,CAACR,GAAG,EAAE,KAAI,CAACc,QAAQ,CAAC;UACvD,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE;YAC9BA,MAAM,GAAGE,IAAI,CAACC,KAA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AAE;EAClC;EAEAnC,KAAK,CAACgB,MAAc,EAAiB;IAAA;IACnC,IAAMiB,KAAK,GAAGjB,MAAM,CAACiB,KAAK,CAACpD,UAAU,CAAC;IACtC,OAAO;MACLqC,UAAU,EAAE,CAAAe,KAAK,aAALA,KAAK,yCAALA,KAAK,CAAEC,MAAM,mDAAb,eAAehB,UAAU,KAAI,EAAE;MAC3CkB,UAAU,EAAE,CAAAH,KAAK,aAALA,KAAK,yCAALA,KAAK,CAAEC,MAAM,mDAAb,eAAeE,UAAU,KAAI,EAAE;MAC3CjB,UAAU,EAAE,CAAAc,KAAK,aAALA,KAAK,yCAALA,KAAK,CAAEC,MAAM,mDAAb,eAAef,UAAU,KAAI,EAAE;MAC3CC,OAAO,EAAE,CAAAa,KAAK,aAALA,KAAK,yCAALA,KAAK,CAAEC,MAAM,mDAAb,eAAed,OAAO,KAAI;IACrC,CAAC;EACH;AACF;AAAC"}
@@ -1,54 +1,49 @@
1
- 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); } }
1
+ "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ExtensionSession = void 0;
7
+ 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); } }
3
8
  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 _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; }
6
-
7
- export class ExtensionSession {
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(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
+ 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); }
12
+ class ExtensionSession {
8
13
  constructor(settings, transport) {
9
14
  this.settings = settings;
10
-
11
15
  _defineProperty(this, "sudoId", '');
12
-
13
16
  _defineProperty(this, "transport", void 0);
14
-
15
17
  this.settings = settings;
16
18
  this.transport = transport;
17
19
  }
18
-
19
20
  isAuthenticated() {
20
21
  return true;
21
22
  }
22
-
23
23
  authenticate(init) {
24
24
  return _asyncToGenerator(function* () {
25
25
  return Promise.reject(Error("Authenticate ".concat(init ? 'request property overrides' : '', " not supported from ExtensionSession")));
26
26
  })();
27
27
  }
28
-
29
28
  getToken() {
30
29
  return _asyncToGenerator(function* () {
31
30
  return Promise.reject(Error('Access to token is not allowed from ExtensionSession'));
32
31
  })();
33
32
  }
34
-
35
33
  isSudo() {
36
34
  throw new Error('isSudo is not allowed from ExtensionSession');
37
35
  }
38
-
39
36
  login(sudoId) {
40
37
  return _asyncToGenerator(function* () {
41
38
  return Promise.reject(Error("Login ".concat(sudoId ? 'for sudo' : '', " not supported from ExtensionSession")));
42
39
  })();
43
40
  }
44
-
45
41
  logout() {
46
42
  return _asyncToGenerator(function* () {
47
43
  return Promise.reject(Error('Logout not supported from ExtensionSession'));
48
44
  })();
49
45
  }
50
-
51
46
  reset() {}
52
-
53
47
  }
48
+ exports.ExtensionSession = ExtensionSession;
54
49
  //# sourceMappingURL=extensionSession.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/extensionSession.ts"],"names":["ExtensionSession","constructor","settings","transport","isAuthenticated","authenticate","init","Promise","reject","Error","getToken","isSudo","login","sudoId","logout","reset"],"mappings":";;;;;;AA8BA,OAAO,MAAMA,gBAAN,CAA+C;AAIpDC,EAAAA,WAAW,CAAQC,QAAR,EAAgCC,SAAhC,EAAuD;AAAA,SAA/CD,QAA+C,GAA/CA,QAA+C;;AAAA,oCAHzD,EAGyD;;AAAA;;AAChE,SAAKA,QAAL,GAAgBA,QAAhB;AACA,SAAKC,SAAL,GAAiBA,SAAjB;AACD;;AAEDC,EAAAA,eAAe,GAAG;AAEhB,WAAO,IAAP;AACD;;AAEKC,EAAAA,YAAY,CAACC,IAAD,EAAsB;AAAA;AACtC,aAAOC,OAAO,CAACC,MAAR,CACLC,KAAK,wBAEDH,IAAI,GAAG,4BAAH,GAAkC,EAFrC,0CADA,CAAP;AADsC;AAQvC;;AAEKI,EAAAA,QAAQ,GAAiB;AAAA;AAC7B,aAAOH,OAAO,CAACC,MAAR,CACLC,KAAK,CAAC,sDAAD,CADA,CAAP;AAD6B;AAI9B;;AAEDE,EAAAA,MAAM,GAAY;AAChB,UAAM,IAAIF,KAAJ,CAAU,6CAAV,CAAN;AACD;;AAEKG,EAAAA,KAAK,CAACC,MAAD,EAAyC;AAAA;AAClD,aAAON,OAAO,CAACC,MAAR,CACLC,KAAK,iBACMI,MAAM,GAAG,UAAH,GAAgB,EAD5B,0CADA,CAAP;AADkD;AAMnD;;AAEKC,EAAAA,MAAM,GAAqB;AAAA;AAC/B,aAAOP,OAAO,CAACC,MAAR,CAAeC,KAAK,CAAC,4CAAD,CAApB,CAAP;AAD+B;AAEhC;;AAEDM,EAAAA,KAAK,GAAS,CAEb;;AAhDmD","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 { ITransport, IRequestProps } from './transport'\nimport type { IAuthSession } from './authSession'\n\nexport class ExtensionSession implements IAuthSession {\n sudoId = ''\n transport: ITransport\n\n constructor(public settings: IApiSettings, transport: ITransport) {\n this.settings = settings\n this.transport = transport\n }\n\n isAuthenticated() {\n // Assume if the extension exists then it is authenticated\n return true\n }\n\n async authenticate(init: IRequestProps) {\n return Promise.reject(\n Error(\n `Authenticate ${\n init ? 'request property overrides' : ''\n } not supported from ExtensionSession`\n )\n )\n }\n\n async getToken(): Promise<any> {\n return Promise.reject(\n Error('Access to token is not allowed from ExtensionSession')\n )\n }\n\n isSudo(): boolean {\n throw new Error('isSudo is not allowed from ExtensionSession')\n }\n\n async login(sudoId?: string | number): Promise<any> {\n return Promise.reject(\n Error(\n `Login ${sudoId ? 'for sudo' : ''} not supported from ExtensionSession`\n )\n )\n }\n\n async logout(): Promise<boolean> {\n return Promise.reject(Error('Logout not supported from ExtensionSession'))\n }\n\n reset(): void {\n // noop\n }\n}\n"],"file":"extensionSession.js"}
1
+ {"version":3,"file":"extensionSession.js","names":["ExtensionSession","constructor","settings","transport","isAuthenticated","authenticate","init","Promise","reject","Error","getToken","isSudo","login","sudoId","logout","reset"],"sources":["../../src/extensionSession.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 { ITransport, IRequestProps } from './transport'\nimport type { IAuthSession } from './authSession'\n\nexport class ExtensionSession implements IAuthSession {\n sudoId = ''\n transport: ITransport\n\n constructor(public settings: IApiSettings, transport: ITransport) {\n this.settings = settings\n this.transport = transport\n }\n\n isAuthenticated() {\n // Assume if the extension exists then it is authenticated\n return true\n }\n\n async authenticate(init: IRequestProps) {\n return Promise.reject(\n Error(\n `Authenticate ${\n init ? 'request property overrides' : ''\n } not supported from ExtensionSession`\n )\n )\n }\n\n async getToken(): Promise<any> {\n return Promise.reject(\n Error('Access to token is not allowed from ExtensionSession')\n )\n }\n\n isSudo(): boolean {\n throw new Error('isSudo is not allowed from ExtensionSession')\n }\n\n async login(sudoId?: string | number): Promise<any> {\n return Promise.reject(\n Error(\n `Login ${sudoId ? 'for sudo' : ''} not supported from ExtensionSession`\n )\n )\n }\n\n async logout(): Promise<boolean> {\n return Promise.reject(Error('Logout not supported from ExtensionSession'))\n }\n\n reset(): void {\n // noop\n }\n}\n"],"mappings":";;;;;;;;;;;AA8BO,MAAMA,gBAAgB,CAAyB;EAIpDC,WAAW,CAAQC,QAAsB,EAAEC,SAAqB,EAAE;IAAA,KAA/CD,QAAsB,GAAtBA,QAAsB;IAAA,gCAHhC,EAAE;IAAA;IAIT,IAAI,CAACA,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC5B;EAEAC,eAAe,GAAG;IAEhB,OAAO,IAAI;EACb;EAEMC,YAAY,CAACC,IAAmB,EAAE;IAAA;MACtC,OAAOC,OAAO,CAACC,MAAM,CACnBC,KAAK,wBAEDH,IAAI,GAAG,4BAA4B,GAAG,EAAE,0CAE3C,CACF;IAAA;EACH;EAEMI,QAAQ,GAAiB;IAAA;MAC7B,OAAOH,OAAO,CAACC,MAAM,CACnBC,KAAK,CAAC,sDAAsD,CAAC,CAC9D;IAAA;EACH;EAEAE,MAAM,GAAY;IAChB,MAAM,IAAIF,KAAK,CAAC,6CAA6C,CAAC;EAChE;EAEMG,KAAK,CAACC,MAAwB,EAAgB;IAAA;MAClD,OAAON,OAAO,CAACC,MAAM,CACnBC,KAAK,iBACMI,MAAM,GAAG,UAAU,GAAG,EAAE,0CAClC,CACF;IAAA;EACH;EAEMC,MAAM,GAAqB;IAAA;MAC/B,OAAOP,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAAA;EAC5E;EAEAM,KAAK,GAAS,CAEd;AACF;AAAC"}
@@ -1,50 +1,44 @@
1
- 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; }
2
-
3
- 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; }
4
-
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ExtensionTransport = void 0;
7
+ 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; }
8
+ 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; }
5
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); } }
6
-
7
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); }); }; }
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
- export class ExtensionTransport {
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(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
13
+ 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); }
14
+ class ExtensionTransport {
12
15
  constructor(options, hostConnection) {
13
16
  this.options = options;
14
17
  this.hostConnection = hostConnection;
15
-
16
18
  _defineProperty(this, "observer", void 0);
17
-
18
19
  this.options = options;
19
20
  this.hostConnection = hostConnection;
20
21
  }
21
-
22
22
  rawRequest(method, path, queryParams, body, authenticator, options) {
23
23
  var _this = this;
24
-
25
24
  return _asyncToGenerator(function* () {
26
25
  var response = yield _this.hostConnection.rawRequest(method, path, body, queryParams, authenticator, options);
27
26
  return _this.observer ? _this.observer(response) : response;
28
27
  })();
29
28
  }
30
-
31
29
  request(method, path, queryParams, body, authenticator, options) {
32
30
  var _this2 = this;
33
-
34
31
  return _asyncToGenerator(function* () {
35
32
  return _this2.hostConnection.request(method, path, body, queryParams, authenticator, options);
36
33
  })();
37
34
  }
38
-
39
35
  stream(callback, method, path, queryParams, body, authenticator, options) {
40
36
  var _this3 = this;
41
-
42
37
  return _asyncToGenerator(function* () {
43
38
  options = options ? _objectSpread(_objectSpread({}, _this3.options), options) : _this3.options;
44
39
  return _this3.hostConnection.stream(callback, method, path, body, queryParams, authenticator, options);
45
40
  })();
46
41
  }
47
-
48
42
  parseResponse(_raw) {
49
43
  var result = {
50
44
  ok: false,
@@ -52,6 +46,6 @@ export class ExtensionTransport {
52
46
  };
53
47
  return Promise.resolve(result);
54
48
  }
55
-
56
49
  }
50
+ exports.ExtensionTransport = ExtensionTransport;
57
51
  //# sourceMappingURL=extensionTransport.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/extensionTransport.ts"],"names":["ExtensionTransport","constructor","options","hostConnection","rawRequest","method","path","queryParams","body","authenticator","response","observer","request","stream","callback","parseResponse","_raw","result","ok","error","Error","Promise","resolve"],"mappings":";;;;;;;;;;AAoEA,OAAO,MAAMA,kBAAN,CAA+C;AACpDC,EAAAA,WAAW,CACQC,OADR,EAEDC,cAFC,EAGT;AAAA,SAFiBD,OAEjB,GAFiBA,OAEjB;AAAA,SADQC,cACR,GADQA,cACR;;AAAA;;AACA,SAAKD,OAAL,GAAeA,OAAf;AACA,SAAKC,cAAL,GAAsBA,cAAtB;AACD;;AAIKC,EAAAA,UAAU,CACdC,MADc,EAEdC,IAFc,EAGdC,WAHc,EAIdC,IAJc,EAKdC,aALc,EAMdP,OANc,EAOS;AAAA;;AAAA;AACvB,UAAMQ,QAAQ,SAAS,KAAI,CAACP,cAAL,CAAoBC,UAApB,CACrBC,MADqB,EAErBC,IAFqB,EAGrBE,IAHqB,EAIrBD,WAJqB,EAKrBE,aALqB,EAMrBP,OANqB,CAAvB;AAQA,aAAO,KAAI,CAACS,QAAL,GAAgB,KAAI,CAACA,QAAL,CAAcD,QAAd,CAAhB,GAA0CA,QAAjD;AATuB;AAUxB;;AAEKE,EAAAA,OAAO,CACXP,MADW,EAEXC,IAFW,EAGXC,WAHW,EAIXC,IAJW,EAKXC,aALW,EAMXP,OANW,EAO6B;AAAA;;AAAA;AACxC,aAAO,MAAI,CAACC,cAAL,CAAoBS,OAApB,CACLP,MADK,EAELC,IAFK,EAGLE,IAHK,EAILD,WAJK,EAKLE,aALK,EAMLP,OANK,CAAP;AADwC;AASzC;;AAEKW,EAAAA,MAAM,CACVC,QADU,EAEVT,MAFU,EAGVC,IAHU,EAIVC,WAJU,EAKVC,IALU,EAMVC,aANU,EAOVP,OAPU,EAQS;AAAA;;AAAA;AACnBA,MAAAA,OAAO,GAAGA,OAAO,mCAAQ,MAAI,CAACA,OAAb,GAAyBA,OAAzB,IAAqC,MAAI,CAACA,OAA3D;AACA,aAAO,MAAI,CAACC,cAAL,CAAoBU,MAApB,CACLC,QADK,EAELT,MAFK,EAGLC,IAHK,EAILE,IAJK,EAKLD,WALK,EAMLE,aANK,EAOLP,OAPK,CAAP;AAFmB;AAWpB;;AAEDa,EAAAA,aAAa,CACXC,IADW,EAE6B;AACxC,QAAMC,MAAqC,GAAG;AAC5CC,MAAAA,EAAE,EAAE,KADwC;AAE5CC,MAAAA,KAAK,EAAE,IAAIC,KAAJ,CAAU,uBAAV;AAFqC,KAA9C;AAIA,WAAOC,OAAO,CAACC,OAAR,CAAgBL,MAAhB,CAAP;AACD;;AA7EmD","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 Values,\n SDKResponse,\n ITransport,\n ITransportSettings,\n HttpMethod,\n IRawResponse,\n RawObserver,\n} from './transport'\n\nexport interface IHostConnection {\n rawRequest(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n authenticator?: Authenticator,\n options?: Partial<ITransportSettings>\n ): Promise<IRawResponse>\n\n request(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n authenticator?: Authenticator,\n options?: Partial<ITransportSettings>\n ): Promise<any>\n\n stream<T>(\n callback: (readable: Readable) => Promise<T>,\n method: HttpMethod,\n path: string,\n queryParams?: Values,\n body?: any,\n authenticator?: Authenticator,\n options?: Partial<ITransportSettings>\n ): Promise<T>\n}\n\nexport class ExtensionTransport implements ITransport {\n constructor(\n private readonly options: ITransportSettings,\n private hostConnection: IHostConnection\n ) {\n this.options = options\n this.hostConnection = hostConnection\n }\n\n observer: RawObserver | undefined\n\n async rawRequest(\n method: HttpMethod,\n path: string,\n queryParams?: any,\n body?: any,\n authenticator?: any,\n options?: Partial<ITransportSettings>\n ): Promise<IRawResponse> {\n const response = await this.hostConnection.rawRequest(\n method,\n path,\n body,\n queryParams,\n authenticator,\n options\n )\n return this.observer ? this.observer(response) : response\n }\n\n async request<TSuccess, TError>(\n method: HttpMethod,\n path: string,\n queryParams?: any,\n body?: any,\n authenticator?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.hostConnection.request(\n method,\n path,\n body,\n queryParams,\n authenticator,\n options\n )\n }\n\n async stream<TSuccess>(\n callback: (readable: any) => Promise<TSuccess>,\n method: HttpMethod,\n path: string,\n queryParams?: any,\n body?: any,\n authenticator?: any,\n options?: Partial<ITransportSettings>\n ): Promise<TSuccess> {\n options = options ? { ...this.options, ...options } : this.options\n return this.hostConnection.stream(\n callback,\n method,\n path,\n body,\n queryParams,\n authenticator,\n options\n )\n }\n\n parseResponse<TSuccess, TError>(\n _raw: IRawResponse\n ): Promise<SDKResponse<TSuccess, TError>> {\n const result: SDKResponse<TSuccess, TError> = {\n ok: false,\n error: new Error('Should not be called!') as unknown as TError,\n }\n return Promise.resolve(result)\n }\n}\n"],"file":"extensionTransport.js"}
1
+ {"version":3,"file":"extensionTransport.js","names":["ExtensionTransport","constructor","options","hostConnection","rawRequest","method","path","queryParams","body","authenticator","response","observer","request","stream","callback","parseResponse","_raw","result","ok","error","Error","Promise","resolve"],"sources":["../../src/extensionTransport.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 Values,\n SDKResponse,\n ITransport,\n ITransportSettings,\n HttpMethod,\n IRawResponse,\n RawObserver,\n} from './transport'\n\nexport interface IHostConnection {\n rawRequest(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n authenticator?: Authenticator,\n options?: Partial<ITransportSettings>\n ): Promise<IRawResponse>\n\n request(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n authenticator?: Authenticator,\n options?: Partial<ITransportSettings>\n ): Promise<any>\n\n stream<T>(\n callback: (readable: Readable) => Promise<T>,\n method: HttpMethod,\n path: string,\n queryParams?: Values,\n body?: any,\n authenticator?: Authenticator,\n options?: Partial<ITransportSettings>\n ): Promise<T>\n}\n\nexport class ExtensionTransport implements ITransport {\n constructor(\n private readonly options: ITransportSettings,\n private hostConnection: IHostConnection\n ) {\n this.options = options\n this.hostConnection = hostConnection\n }\n\n observer: RawObserver | undefined\n\n async rawRequest(\n method: HttpMethod,\n path: string,\n queryParams?: any,\n body?: any,\n authenticator?: any,\n options?: Partial<ITransportSettings>\n ): Promise<IRawResponse> {\n const response = await this.hostConnection.rawRequest(\n method,\n path,\n body,\n queryParams,\n authenticator,\n options\n )\n return this.observer ? this.observer(response) : response\n }\n\n async request<TSuccess, TError>(\n method: HttpMethod,\n path: string,\n queryParams?: any,\n body?: any,\n authenticator?: any,\n options?: Partial<ITransportSettings>\n ): Promise<SDKResponse<TSuccess, TError>> {\n return this.hostConnection.request(\n method,\n path,\n body,\n queryParams,\n authenticator,\n options\n )\n }\n\n async stream<TSuccess>(\n callback: (readable: any) => Promise<TSuccess>,\n method: HttpMethod,\n path: string,\n queryParams?: any,\n body?: any,\n authenticator?: any,\n options?: Partial<ITransportSettings>\n ): Promise<TSuccess> {\n options = options ? { ...this.options, ...options } : this.options\n return this.hostConnection.stream(\n callback,\n method,\n path,\n body,\n queryParams,\n authenticator,\n options\n )\n }\n\n parseResponse<TSuccess, TError>(\n _raw: IRawResponse\n ): Promise<SDKResponse<TSuccess, TError>> {\n const result: SDKResponse<TSuccess, TError> = {\n ok: false,\n error: new Error('Should not be called!') as unknown as TError,\n }\n return Promise.resolve(result)\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAoEO,MAAMA,kBAAkB,CAAuB;EACpDC,WAAW,CACQC,OAA2B,EACpCC,cAA+B,EACvC;IAA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