@snokam/auth 1.1.0 → 1.1.2
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 +22 -0
- package/lib/client.d.ts +2 -0
- package/lib/client.js +2 -0
- package/lib/client.js.map +1 -0
- package/lib/index.d.ts +5 -12
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/token.d.ts +2 -0
- package/lib/token.js +2 -0
- package/lib/token.js.map +1 -0
- package/lib/types.d.ts +5 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.2](https://github.com/snokam/components/compare/@snokam/auth@1.1.1...@snokam/auth@1.1.2) (2024-07-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* try to fix types ([4b1dc2b](https://github.com/snokam/components/commit/4b1dc2b5133ef23e685c225ce12b2f3c7d69bbe3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.1.1](https://github.com/snokam/components/compare/@snokam/auth@1.1.0...@snokam/auth@1.1.1) (2024-07-17)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* add useClient function ([a0beff3](https://github.com/snokam/components/commit/a0beff349c625a7f1823fe91de8b30d64a26b5fd))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# 1.1.0 (2024-07-17)
|
|
7
29
|
|
|
8
30
|
|
package/lib/client.d.ts
ADDED
package/lib/client.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={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{ServerConfiguration:()=>t.ServerConfiguration,createConfiguration:()=>t.createConfiguration});const t=require("@snokam/employees-client");return o})()));
|
|
2
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.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,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,iHCL9D,MAAM,EAA+BC,QAAQ,4B","sources":["webpack://snokam/webpack/universalModuleDefinition","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/external commonjs \"@snokam/employees-client\""],"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 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};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@snokam/employees-client\");"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require"],"sourceRoot":""}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const useAuth: (props: AuthProps) => {
|
|
1
|
+
import { Configuration } from "@snokam/employees-client";
|
|
2
|
+
import { AuthProps } from "./types";
|
|
3
|
+
export type { AuthProps };
|
|
4
|
+
export declare const useClient: (props: AuthProps) => {
|
|
6
5
|
getToken: () => Promise<any>;
|
|
7
|
-
|
|
8
|
-
new (): {
|
|
9
|
-
pre(context: RequestContext): Promise<RequestContext>;
|
|
10
|
-
post(context: ResponseContext): Promise<ResponseContext>;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
6
|
+
configuration: Configuration;
|
|
13
7
|
};
|
|
14
|
-
export declare const useGetToken: ({ scopes }: AuthProps) => () => Promise<any>;
|
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={
|
|
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,withAuth:n}=e,i=(0,r.createConfiguration)(Object.assign({baseServer:new r.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,
|
|
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,EAAYA,EAAUoB,MAAMtB,EAASC,GAAc,KAAKe,OAClE,IAPwC,IAAUhB,EAASC,EAAYQ,EAAGP,CA4BxE,E,GC3BFqB,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAavC,QAGrB,IAAIC,EAASmC,EAAyBE,GAAY,CAGjDtC,QAAS,CAAC,GAOX,OAHAyC,EAAoBH,GAAUrC,EAAQA,EAAOD,QAASqC,GAG/CpC,EAAOD,OACf,CCrBAqC,EAAoBK,EAAI,CAAC1C,EAAS2C,KACjC,IAAI,IAAIC,KAAOD,EACXN,EAAoBQ,EAAEF,EAAYC,KAASP,EAAoBQ,EAAE7C,EAAS4C,IAC5EE,OAAOC,eAAe/C,EAAS4C,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDP,EAAoBQ,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFd,EAAoBkB,EAAKvD,IACH,oBAAXwD,QAA0BA,OAAOC,aAC1CX,OAAOC,eAAe/C,EAASwD,OAAOC,YAAa,CAAE9B,MAAO,WAE7DmB,OAAOC,eAAe/C,EAAS,aAAc,CAAE2B,OAAO,GAAO,E,+DCHvD,MAAM+B,EAAaC,IACtB,MAAMC,GAAW,IAAAtD,aAAYqD,IACvB,QAAEE,EAAO,SAAEC,GAAaH,EACxBI,GAAgB,IAAAC,qBAAoBlB,OAAOmB,OAAO,CAAEC,WAAY,IAAI,EAAAC,oBAAoBN,EAAS,CAAC,IAAOC,EACzG,CACEM,YAAa,CACTC,QAAS,CACLC,QAAS,IAAM,UACfC,4BAA8BC,GAAYZ,IAAW1B,MAAMuC,IACvDD,EAAQE,eAAe,gBAAiB,UAAUD,IAAQ,YAKxEjC,IACN,MAAO,CACHoB,WACAG,gBACH,E","sources":["webpack://snokam/webpack/universalModuleDefinition","webpack://snokam/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, 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
ADDED
package/lib/token.js
ADDED
|
@@ -0,0 +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={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{useGetToken:()=>n});const o=require("@azure/msal-react");const n=({scopes:e})=>{const{instance:t}=(0,o.useMsal)(),n=t.getAllAccounts()[0];return()=>{return o=void 0,r=void 0,i=function*(){if(!n)throw new Error("No active account found.");try{const{accessToken:o}=yield t.acquireTokenSilent({scopes:e,account:n});return o}catch(e){throw console.warn("Failed to acquire token silently",e),e}},new((c=void 0)||(c=Promise))((function(e,t){function n(e){try{u(i.next(e))}catch(e){t(e)}}function a(e){try{u(i.throw(e))}catch(e){t(e)}}function u(t){var o;t.done?e(t.value):(o=t.value,o instanceof c?o:new c((function(e){e(o)}))).then(n,a)}u((i=i.apply(o,r||[])).next())}));var o,r,c,i}};return t})()));
|
|
2
|
+
//# sourceMappingURL=token.js.map
|
package/lib/token.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.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,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,uCCL9D,MAAM,EAA+BC,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,EAAUtB,GAAS,IAAMuB,EAAKZ,EAAUa,KAAKxB,GAAS,CAAE,MAAOyB,GAAKJ,EAAOI,EAAI,CAAE,CAC1F,SAASC,EAAS1B,GAAS,IAAMuB,EAAKZ,EAAiB,MAAEX,GAAS,CAAE,MAAOyB,GAAKJ,EAAOI,EAAI,CAAE,CAC7F,SAASF,EAAKI,GAJlB,IAAe3B,EAIa2B,EAAOC,KAAOR,EAAQO,EAAO3B,QAJ1CA,EAIyD2B,EAAO3B,MAJhDA,aAAiBkB,EAAIlB,EAAQ,IAAIkB,GAAE,SAAUE,GAAWA,EAAQpB,EAAQ,KAIjB6B,KAAKP,EAAWI,EAAW,CAC7GH,GAAMZ,EAAYA,EAAUmB,MAAMrB,EAASC,GAAc,KAAKc,OAClE,IAPwC,IAAUf,EAASC,EAAYQ,EAAGP,CA4BxE,G","sources":["webpack://snokam/webpack/universalModuleDefinition","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/external commonjs \"@azure/msal-react\"","webpack://snokam/./src/token.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 ","// The require scope\nvar __webpack_require__ = {};\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};","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"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","useGetToken","scopes","instance","useMsal","account","getAllAccounts","__awaiter","thisArg","_arguments","generator","Error","accessToken","acquireTokenSilent","error","console","warn","P","Promise","resolve","reject","fulfilled","step","next","e","rejected","result","done","then","apply"],"sourceRoot":""}
|
package/lib/types.d.ts
CHANGED
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.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"@azure/msal-react": "^2.0.21",
|
|
28
28
|
"@snokam/employees-client": "^1.0.2"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "f83895b5d4c0b1ba2a443f1180e6f1de0f6fff4a"
|
|
31
31
|
}
|