@snokam/auth 1.0.11 → 1.0.13

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/lib/server.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,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},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,{getServerToken:()=>o});const n=require("@azure/msal-node");const o=e=>{return t=void 0,o=void 0,i=function*(){if(!process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID)throw new Error("NEXT_PUBLIC_AZURE_AD_CLIENT_ID must be set in the environment variables");if(!process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID)throw new Error("NEXT_PUBLIC_AZURE_AD_TENANT_ID must be set in the environment variables");const t={auth:{clientId:`${process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID}`,authority:`https://login.microsoftonline.com/${process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID}/oauth2/v2.0`,clientSecret:`${process.env.AZURE_AD_SECRET}`}},o=new n.ConfidentialClientApplication(t),r=yield o.acquireTokenByClientCredential({scopes:e.map((e=>e.replace("user_impersonation",".default")))});return`Bearer ${null==r?void 0:r.accessToken}`},new((r=void 0)||(r=Promise))((function(e,n){function c(e){try{a(i.next(e))}catch(e){n(e)}}function s(e){try{a(i.throw(e))}catch(e){n(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(c,s)}a((i=i.apply(t,o||[])).next())}));var t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AAUJ,aAA2C,EAASA,EAASK,aAClF,EA3BW,KAFgEC,OAUP,KAR9CA,EAAIC,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAU/B,GAAS,IAAMgC,EAAKzB,EAAU0B,KAAKjC,GAAS,CAAE,MAAOkC,GAAKJ,EAAOI,EAAI,CAAE,CAC1F,SAASC,EAASnC,GAAS,IAAMgC,EAAKzB,EAAiB,MAAEP,GAAS,CAAE,MAAOkC,GAAKJ,EAAOI,EAAI,CAAE,CAC7F,SAASF,EAAKI,GAJlB,IAAepC,EAIaoC,EAAOC,KAAOR,EAAQO,EAAOpC,QAJ1CA,EAIyDoC,EAAOpC,MAJhDA,aAAiB2B,EAAI3B,EAAQ,IAAI2B,GAAE,SAAUE,GAAWA,EAAQ7B,EAAQ,KAIjBsC,KAAKP,EAAWI,EAAW,CAC7GH,GAAMzB,EAAYA,EAAUgC,MAAMlC,EAASC,GAAc,KAAK2B,OAClE,IAPwC,IAAU5B,EAASC,EAAYqB,EAAGpB,CA6B5E,E","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-node\"","webpack://snokam/./src/server.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-node\");","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 { ConfidentialClientApplication } from \"@azure/msal-node\";\nexport const getServerToken = (scopes) => __awaiter(void 0, void 0, void 0, function* () {\n if (!process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID) {\n throw new Error(\"NEXT_PUBLIC_AZURE_AD_CLIENT_ID must be set in the environment variables\");\n }\n if (!process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID) {\n throw new Error(\"NEXT_PUBLIC_AZURE_AD_TENANT_ID must be set in the environment variables\");\n }\n const config = {\n auth: {\n clientId: `${process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID}`,\n authority: `https://login.microsoftonline.com/${process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID}/oauth2/v2.0`,\n clientSecret: `${process.env.AZURE_AD_SECRET}`,\n },\n };\n const cca = new ConfidentialClientApplication(config);\n const response = yield cca.acquireTokenByClientCredential({\n scopes: scopes.map((scope) => scope.replace(\"user_impersonation\", \".default\")),\n });\n return `Bearer ${response === null || response === void 0 ? void 0 : response.accessToken}`;\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","getServerToken","scopes","__awaiter","thisArg","_arguments","generator","process","env","NEXT_PUBLIC_AZURE_AD_CLIENT_ID","Error","NEXT_PUBLIC_AZURE_AD_TENANT_ID","config","auth","clientId","authority","clientSecret","AZURE_AD_SECRET","cca","ConfidentialClientApplication","response","acquireTokenByClientCredential","map","scope","replace","accessToken","P","Promise","resolve","reject","fulfilled","step","next","e","rejected","result","done","then","apply"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,9 +1,19 @@
1
1
  {
2
2
  "name": "@snokam/auth",
3
3
  "description": "Snøkam auth components",
4
- "version": "1.0.11",
4
+ "version": "1.0.13",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./lib/index.js",
10
+ "types": "./lib/index.d.ts"
11
+ },
12
+ "./server": {
13
+ "import": "./lib/server.js",
14
+ "types": "./lib/server.d.ts"
15
+ }
16
+ },
7
17
  "files": [
8
18
  "lib",
9
19
  "package.json",
@@ -36,5 +46,5 @@
36
46
  "react": "^18.3.1",
37
47
  "react-dom": "^18.3.1"
38
48
  },
39
- "gitHead": "fa18f755058a55ee0617c9877de3612f3cd5f631"
49
+ "gitHead": "dd0378f694ede45c54c25f2f25de92b8d898d3ee"
40
50
  }
File without changes