@snokam/auth 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,29 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.1.3](https://github.com/snokam/components/compare/@snokam/auth@1.1.2...@snokam/auth@1.1.3) (2024-07-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * cleanup ([69e73b4](https://github.com/snokam/components/commit/69e73b42e3ec6aedd2e9d1ab798b67c35f5fd3af))
12
+ * update deps ([ac90b46](https://github.com/snokam/components/commit/ac90b4651e99404d22eadebd7385e99337a74dd2))
13
+
14
+
15
+
16
+
17
+
18
+ ## [1.1.2](https://github.com/snokam/components/compare/@snokam/auth@1.1.1...@snokam/auth@1.1.2) (2024-07-17)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * try to fix types ([4b1dc2b](https://github.com/snokam/components/commit/4b1dc2b5133ef23e685c225ce12b2f3c7d69bbe3))
24
+
25
+
26
+
27
+
28
+
6
29
  ## [1.1.1](https://github.com/snokam/components/compare/@snokam/auth@1.1.0...@snokam/auth@1.1.1) (2024-07-17)
7
30
 
8
31
 
package/lib/client.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- import { createConfiguration, ServerConfiguration } from "@snokam/employees-client";
1
+ import { Configuration, createConfiguration, ServerConfiguration } from "@snokam/employees-client";
2
2
  export { createConfiguration, ServerConfiguration };
3
+ export type { Configuration };
package/lib/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- export interface AuthProps {
2
- scopes: string[];
3
- baseUrl: string;
4
- withAuth?: boolean;
5
- }
1
+ import { AuthProps } from "./types";
2
+ import { Configuration } from "./client";
3
+ export type { AuthProps, Configuration };
6
4
  export declare const useClient: (props: AuthProps) => {
7
5
  getToken: () => Promise<any>;
8
- configuration: import("@snokam/employees-client").Configuration;
6
+ configuration: Configuration;
9
7
  };
package/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={689:(e,t,o)=>{o.d(t,{ServerConfiguration:()=>n.ServerConfiguration,createConfiguration:()=>n.createConfiguration});const n=require("@snokam/employees-client")},207:(e,t,o)=>{o.d(t,{useGetToken:()=>r});const n=require("@azure/msal-react");const r=({scopes:e})=>{const{instance:t}=(0,n.useMsal)(),o=t.getAllAccounts()[0];return()=>{return n=void 0,r=void 0,i=function*(){if(!o)throw new Error("No active account found.");try{const{accessToken:n}=yield t.acquireTokenSilent({scopes:e,account:o});return n}catch(e){throw console.warn("Failed to acquire token silently",e),e}},new((a=void 0)||(a=Promise))((function(e,t){function o(e){try{u(i.next(e))}catch(e){t(e)}}function c(e){try{u(i.throw(e))}catch(e){t(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof a?n:new a((function(e){e(n)}))).then(o,c)}u((i=i.apply(n,r||[])).next())}));var n,r,a,i}}}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};o.r(n),o.d(n,{useClient:()=>i});var r=o(689),a=o(207);const i=e=>{const t=(0,a.useGetToken)(e),{baseUrl:o}=e,n=(0,r.createConfiguration)(Object.assign({baseServer:new r.ServerConfiguration(o,{})},e.withAuth&&{authMethods:{default:{getName:()=>"default",applySecurityAuthentication:e=>t().then((t=>{e.setHeaderParam("Authorization",`Bearer ${t}`)}))}}}));return{getToken:t,configuration:n}};return n})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={689:(e,t,o)=>{o.d(t,{ServerConfiguration:()=>n.ServerConfiguration,createConfiguration:()=>n.createConfiguration});const n=require("@snokam/employees-client")},207:(e,t,o)=>{o.d(t,{useGetToken:()=>r});const n=require("@azure/msal-react");const r=({scopes:e})=>{const{instance:t}=(0,n.useMsal)(),o=t.getAllAccounts()[0];return()=>{return n=void 0,r=void 0,i=function*(){if(!o)throw new Error("No active account found.");try{const{accessToken:n}=yield t.acquireTokenSilent({scopes:e,account:o});return n}catch(e){throw console.warn("Failed to acquire token silently",e),e}},new((a=void 0)||(a=Promise))((function(e,t){function o(e){try{u(i.next(e))}catch(e){t(e)}}function c(e){try{u(i.throw(e))}catch(e){t(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof a?n:new a((function(e){e(n)}))).then(o,c)}u((i=i.apply(n,r||[])).next())}));var n,r,a,i}}}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};o.r(n),o.d(n,{useClient:()=>i});var r=o(207),a=o(689);const i=e=>{const t=(0,r.useGetToken)(e),{baseUrl:o,withAuth:n}=e,i=(0,a.createConfiguration)(Object.assign({baseServer:new a.ServerConfiguration(o,{})},n?{authMethods:{default:{getName:()=>"default",applySecurityAuthentication:e=>t().then((t=>{e.setHeaderParam("Authorization",`Bearer ${t}`)}))}}}:void 0));return{getToken:t,configuration:i}};return n})()));
2
2
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,GAClB,CATD,CASGK,MAAM,I,6ICTT,MAAM,EAA+BC,QAAQ,2B,2CCA7C,MAAM,EAA+BA,QAAQ,qBCUtC,MAAMC,EAAc,EAAGC,aAC1B,MAAM,SAAEC,IAAa,IAAAC,WACfC,EAAUF,EAASG,iBAAiB,GAC1C,MAAO,KAAMC,OAbqCC,OAa3B,EAboCC,OAa5B,EAb2CC,EAa3B,YAC3C,IAAKL,EACD,MAAM,IAAIM,MAAM,4BAEpB,IACI,MAAM,YAAEC,SAAsBT,EAASU,mBAAmB,CACtDX,SACAG,YAEJ,OAAOO,CACX,CACA,MAAOE,GAEH,MADAC,QAAQC,KAAK,mCAAoCF,GAC3CA,CACV,CACJ,EA1BO,KAFgEG,OAahC,KAXrBA,EAAIC,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKb,EAAUc,KAAKF,GAAS,CAAE,MAAOG,GAAKL,EAAOK,EAAI,CAAE,CAC1F,SAASC,EAASJ,GAAS,IAAMC,EAAKb,EAAiB,MAAEY,GAAS,CAAE,MAAOG,GAAKL,EAAOK,EAAI,CAAE,CAC7F,SAASF,EAAKI,GAJlB,IAAeL,EAIaK,EAAOC,KAAOT,EAAQQ,EAAOL,QAJ1CA,EAIyDK,EAAOL,MAJhDA,aAAiBL,EAAIK,EAAQ,IAAIL,GAAE,SAAUE,GAAWA,EAAQG,EAAQ,KAIjBO,KAAKR,EAAWK,E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/external commonjs \"@snokam/employees-client\"","webpack://snokam/external commonjs \"@azure/msal-react\"","webpack://snokam/./src/token.tsx","webpack://snokam/webpack/bootstrap","webpack://snokam/webpack/runtime/define property getters","webpack://snokam/webpack/runtime/hasOwnProperty shorthand","webpack://snokam/webpack/runtime/make namespace object","webpack://snokam/./src/index.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@snokam/employees-client\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@azure/msal-react\");","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { useMsal } from \"@azure/msal-react\";\nexport const useGetToken = ({ scopes }) => {\n const { instance } = useMsal();\n const account = instance.getAllAccounts()[0];\n return () => __awaiter(void 0, void 0, void 0, function* () {\n if (!account) {\n throw new Error(\"No active account found.\");\n }\n try {\n const { accessToken } = yield instance.acquireTokenSilent({\n scopes,\n account,\n });\n return accessToken;\n }\n catch (error) {\n console.warn(\"Failed to acquire token silently\", error);\n throw error;\n }\n });\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { createConfiguration, ServerConfiguration } from \"./client\";\nimport { useGetToken } from \"./token\";\nexport const useClient = (props) => {\n const getToken = useGetToken(props);\n const { baseUrl } = props;\n const configuration = createConfiguration(Object.assign({ baseServer: new ServerConfiguration(baseUrl, {}) }, (props.withAuth && {\n authMethods: {\n default: {\n getName: () => \"default\",\n applySecurityAuthentication: (request) => getToken().then((token) => {\n request.setHeaderParam(\"Authorization\", `Bearer ${token}`);\n }),\n },\n },\n })));\n return {\n getToken,\n configuration,\n };\n};\n"],"names":["root","factory","exports","module","define","amd","this","require","useGetToken","scopes","instance","useMsal","account","getAllAccounts","__awaiter","thisArg","_arguments","generator","Error","accessToken","acquireTokenSilent","error","console","warn","P","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","useClient","props","getToken","baseUrl","configuration","createConfiguration","assign","baseServer","ServerConfiguration","withAuth","authMethods","default","getName","applySecurityAuthentication","request","token","setHeaderParam"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,GAClB,CATD,CASGK,MAAM,I,6ICTT,MAAM,EAA+BC,QAAQ,2B,2CCA7C,MAAM,EAA+BA,QAAQ,qBCUtC,MAAMC,EAAc,EAAGC,aAC1B,MAAM,SAAEC,IAAa,IAAAC,WACfC,EAAUF,EAASG,iBAAiB,GAC1C,MAAO,KAAMC,OAbqCC,OAa3B,EAboCC,OAa5B,EAb2CC,EAa3B,YAC3C,IAAKL,EACD,MAAM,IAAIM,MAAM,4BAEpB,IACI,MAAM,YAAEC,SAAsBT,EAASU,mBAAmB,CACtDX,SACAG,YAEJ,OAAOO,CACX,CACA,MAAOE,GAEH,MADAC,QAAQC,KAAK,mCAAoCF,GAC3CA,CACV,CACJ,EA1BO,KAFgEG,OAahC,KAXrBA,EAAIC,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKb,EAAUc,KAAKF,GAAS,CAAE,MAAOG,GAAKL,EAAOK,EAAI,CAAE,CAC1F,SAASC,EAASJ,GAAS,IAAMC,EAAKb,EAAiB,MAAEY,GAAS,CAAE,MAAOG,GAAKL,EAAOK,EAAI,CAAE,CAC7F,SAASF,EAAKI,GAJlB,IAAeL,EAIaK,EAAOC,KAAOT,EAAQQ,EAAOL,QAJ1CA,EAIyDK,EAAOL,MAJhDA,aAAiBL,EAAIK,EAAQ,IAAIL,GAAE,SAAUE,GAAWA,EAAQG,EAAQ,KAIjBO,KAAKR,EAAWK,EAAW,CAC7GH,GAAMb,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"@snokam/employees-client\"","webpack://snokam/external commonjs \"@azure/msal-react\"","webpack://snokam/./src/token.tsx","webpack://snokam/webpack/bootstrap","webpack://snokam/webpack/runtime/define property getters","webpack://snokam/webpack/runtime/hasOwnProperty shorthand","webpack://snokam/webpack/runtime/make namespace object","webpack://snokam/./src/index.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@snokam/employees-client\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@azure/msal-react\");","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { useMsal } from \"@azure/msal-react\";\nexport const useGetToken = ({ scopes }) => {\n const { instance } = useMsal();\n const account = instance.getAllAccounts()[0];\n return () => __awaiter(void 0, void 0, void 0, function* () {\n if (!account) {\n throw new Error(\"No active account found.\");\n }\n try {\n const { accessToken } = yield instance.acquireTokenSilent({\n scopes,\n account,\n });\n return accessToken;\n }\n catch (error) {\n console.warn(\"Failed to acquire token silently\", error);\n throw error;\n }\n });\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { useGetToken } from \"./token\";\nimport { createConfiguration, ServerConfiguration, } from \"./client\";\nexport const useClient = (props) => {\n const getToken = useGetToken(props);\n const { baseUrl, withAuth } = props;\n const configuration = createConfiguration(Object.assign({ baseServer: new ServerConfiguration(baseUrl, {}) }, (withAuth\n ? {\n authMethods: {\n default: {\n getName: () => \"default\",\n applySecurityAuthentication: (request) => getToken().then((token) => {\n request.setHeaderParam(\"Authorization\", `Bearer ${token}`);\n }),\n },\n },\n }\n : undefined)));\n return {\n getToken,\n configuration,\n };\n};\n"],"names":["root","factory","exports","module","define","amd","this","require","useGetToken","scopes","instance","useMsal","account","getAllAccounts","__awaiter","thisArg","_arguments","generator","Error","accessToken","acquireTokenSilent","error","console","warn","P","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","useClient","props","getToken","baseUrl","withAuth","configuration","createConfiguration","assign","baseServer","ServerConfiguration","authMethods","default","getName","applySecurityAuthentication","request","token","setHeaderParam"],"sourceRoot":""}
package/lib/token.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { AuthProps } from ".";
1
+ import { AuthProps } from "./types";
2
2
  export declare const useGetToken: ({ scopes }: AuthProps) => () => Promise<any>;
package/lib/types.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export interface AuthProps {
2
+ scopes: string[];
3
+ baseUrl: string;
4
+ withAuth?: boolean;
5
+ }
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.snokam=o():e.snokam=o()}(this,(()=>(()=>{"use strict";var e={};return(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e),e})()));
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,GAClB,CATD,CASGK,MAAM,I,mBCRT,I,WCAwB,CAACJ,IACH,oBAAXK,QAA0BA,OAAOC,aAC1CC,OAAOC,eAAeR,EAASK,OAAOC,YAAa,CAAEG,MAAO,WAE7DF,OAAOC,eAAeR,EAAS,aAAc,CAAES,OAAO,GAAO,E","sources":["webpack://snokam/webpack/universalModuleDefinition","webpack://snokam/webpack/bootstrap","webpack://snokam/webpack/runtime/make namespace object"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};"],"names":["root","factory","exports","module","define","amd","this","Symbol","toStringTag","Object","defineProperty","value"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@snokam/auth",
3
3
  "description": "Utility functions for authentication",
4
- "version": "1.1.1",
4
+ "version": "1.1.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@azure/msal-react": "^2.0.21",
28
- "@snokam/employees-client": "^1.0.2"
28
+ "@snokam/employees-client": "^1.0.3"
29
29
  },
30
- "gitHead": "f29e97a75bf01848d65e2f4895885d35f9e175a5"
30
+ "gitHead": "a7b3dc28d8e8a75b56f373c291d52cd292794695"
31
31
  }