@dbmx/confy 0.0.77 → 0.0.80
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/esm/_virtual/browser.js +4 -0
- package/esm/_virtual/browser.js.map +1 -0
- package/esm/_virtual/index15.js +4 -0
- package/esm/_virtual/index15.js.map +1 -0
- package/esm/_virtual/index16.js +4 -0
- package/esm/_virtual/index16.js.map +1 -0
- package/esm/_virtual/index17.js +4 -0
- package/esm/_virtual/index17.js.map +1 -0
- package/esm/_virtual/index18.js +4 -0
- package/esm/_virtual/index18.js.map +1 -0
- package/esm/_virtual/node.js +4 -0
- package/esm/_virtual/node.js.map +1 -0
- package/esm/_virtual/serialOrdered.js +4 -0
- package/esm/_virtual/serialOrdered.js.map +1 -0
- package/esm/components/SelectMemberMenu/index.js +1 -1
- package/esm/ducks/utils.js +1 -1
- package/esm/forms/utils.js +2 -2
- package/esm/hooks/roles.js +1 -1
- package/esm/node_modules/asynckit/index.js +13 -0
- package/esm/node_modules/asynckit/index.js.map +1 -0
- package/esm/node_modules/asynckit/lib/abort.js +32 -0
- package/esm/node_modules/asynckit/lib/abort.js.map +1 -0
- package/esm/node_modules/asynckit/lib/async.js +39 -0
- package/esm/node_modules/asynckit/lib/async.js.map +1 -0
- package/esm/node_modules/asynckit/lib/defer.js +29 -0
- package/esm/node_modules/asynckit/lib/defer.js.map +1 -0
- package/esm/node_modules/asynckit/lib/iterate.js +81 -0
- package/esm/node_modules/asynckit/lib/iterate.js.map +1 -0
- package/esm/node_modules/asynckit/lib/state.js +40 -0
- package/esm/node_modules/asynckit/lib/state.js.map +1 -0
- package/esm/node_modules/asynckit/lib/terminator.js +35 -0
- package/esm/node_modules/asynckit/lib/terminator.js.map +1 -0
- package/esm/node_modules/asynckit/parallel.js +50 -0
- package/esm/node_modules/asynckit/parallel.js.map +1 -0
- package/esm/node_modules/asynckit/serial.js +22 -0
- package/esm/node_modules/asynckit/serial.js.map +1 -0
- package/esm/node_modules/asynckit/serialOrdered.js +85 -0
- package/esm/node_modules/asynckit/serialOrdered.js.map +1 -0
- package/esm/node_modules/axios/index.js +26 -0
- package/esm/node_modules/axios/index.js.map +1 -0
- package/esm/node_modules/axios/lib/adapters/adapters.js +133 -0
- package/esm/node_modules/axios/lib/adapters/adapters.js.map +1 -0
- package/esm/node_modules/axios/lib/adapters/fetch.js +331 -0
- package/esm/node_modules/axios/lib/adapters/fetch.js.map +1 -0
- package/esm/node_modules/axios/lib/adapters/http.js +945 -0
- package/esm/node_modules/axios/lib/adapters/http.js.map +1 -0
- package/esm/node_modules/axios/lib/adapters/xhr.js +225 -0
- package/esm/node_modules/axios/lib/adapters/xhr.js.map +1 -0
- package/esm/node_modules/axios/lib/axios.js +87 -0
- package/esm/node_modules/axios/lib/axios.js.map +1 -0
- package/esm/node_modules/axios/lib/cancel/CancelToken.js +134 -0
- package/esm/node_modules/axios/lib/cancel/CancelToken.js.map +1 -0
- package/esm/node_modules/axios/lib/cancel/CanceledError.js +21 -0
- package/esm/node_modules/axios/lib/cancel/CanceledError.js.map +1 -0
- package/esm/node_modules/axios/lib/cancel/isCancel.js +6 -0
- package/esm/node_modules/axios/lib/cancel/isCancel.js.map +1 -0
- package/esm/node_modules/axios/lib/core/Axios.js +260 -0
- package/esm/node_modules/axios/lib/core/Axios.js.map +1 -0
- package/esm/node_modules/axios/lib/core/AxiosError.js +89 -0
- package/esm/node_modules/axios/lib/core/AxiosError.js.map +1 -0
- package/esm/node_modules/axios/lib/core/AxiosHeaders.js +343 -0
- package/esm/node_modules/axios/lib/core/AxiosHeaders.js.map +1 -0
- package/esm/node_modules/axios/lib/core/InterceptorManager.js +71 -0
- package/esm/node_modules/axios/lib/core/InterceptorManager.js.map +1 -0
- package/esm/node_modules/axios/lib/core/buildFullPath.js +23 -0
- package/esm/node_modules/axios/lib/core/buildFullPath.js.map +1 -0
- package/esm/node_modules/axios/lib/core/dispatchRequest.js +78 -0
- package/esm/node_modules/axios/lib/core/dispatchRequest.js.map +1 -0
- package/esm/node_modules/axios/lib/core/mergeConfig.js +108 -0
- package/esm/node_modules/axios/lib/core/mergeConfig.js.map +1 -0
- package/esm/node_modules/axios/lib/core/settle.js +32 -0
- package/esm/node_modules/axios/lib/core/settle.js.map +1 -0
- package/esm/node_modules/axios/lib/core/transformData.js +29 -0
- package/esm/node_modules/axios/lib/core/transformData.js.map +1 -0
- package/esm/node_modules/axios/lib/defaults/index.js +171 -0
- package/esm/node_modules/axios/lib/defaults/index.js.map +1 -0
- package/esm/node_modules/axios/lib/defaults/transitional.js +9 -0
- package/esm/node_modules/axios/lib/defaults/transitional.js.map +1 -0
- package/esm/node_modules/axios/lib/env/data.js +4 -0
- package/esm/node_modules/axios/lib/env/data.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/AxiosTransformStream.js +155 -0
- package/esm/node_modules/axios/lib/helpers/AxiosTransformStream.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +61 -0
- package/esm/node_modules/axios/lib/helpers/AxiosURLSearchParams.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/HttpStatusCode.js +78 -0
- package/esm/node_modules/axios/lib/helpers/HttpStatusCode.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +28 -0
- package/esm/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/bind.js +15 -0
- package/esm/node_modules/axios/lib/helpers/bind.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/buildURL.js +67 -0
- package/esm/node_modules/axios/lib/helpers/buildURL.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/callbackify.js +19 -0
- package/esm/node_modules/axios/lib/helpers/callbackify.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/combineURLs.js +16 -0
- package/esm/node_modules/axios/lib/helpers/combineURLs.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/composeSignals.js +57 -0
- package/esm/node_modules/axios/lib/helpers/composeSignals.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/cookies.js +51 -0
- package/esm/node_modules/axios/lib/helpers/cookies.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +76 -0
- package/esm/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/formDataToJSON.js +94 -0
- package/esm/node_modules/axios/lib/helpers/formDataToJSON.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
- package/esm/node_modules/axios/lib/helpers/formDataToStream.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/fromDataURI.js +54 -0
- package/esm/node_modules/axios/lib/helpers/fromDataURI.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/isAbsoluteURL.js +20 -0
- package/esm/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/isAxiosError.js +15 -0
- package/esm/node_modules/axios/lib/helpers/isAxiosError.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/isURLSameOrigin.js +19 -0
- package/esm/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/parseHeaders.js +70 -0
- package/esm/node_modules/axios/lib/helpers/parseHeaders.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/parseProtocol.js +7 -0
- package/esm/node_modules/axios/lib/helpers/parseProtocol.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
- package/esm/node_modules/axios/lib/helpers/progressEventReducer.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/readBlob.js +16 -0
- package/esm/node_modules/axios/lib/helpers/readBlob.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/resolveConfig.js +73 -0
- package/esm/node_modules/axios/lib/helpers/resolveConfig.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/speedometer.js +54 -0
- package/esm/node_modules/axios/lib/helpers/speedometer.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/spread.js +29 -0
- package/esm/node_modules/axios/lib/helpers/spread.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/throttle.js +45 -0
- package/esm/node_modules/axios/lib/helpers/throttle.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/toFormData.js +239 -0
- package/esm/node_modules/axios/lib/helpers/toFormData.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/toURLEncodedForm.js +20 -0
- package/esm/node_modules/axios/lib/helpers/toURLEncodedForm.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/trackStream.js +92 -0
- package/esm/node_modules/axios/lib/helpers/trackStream.js.map +1 -0
- package/esm/node_modules/axios/lib/helpers/validator.js +111 -0
- package/esm/node_modules/axios/lib/helpers/validator.js.map +1 -0
- package/esm/node_modules/axios/lib/platform/common/utils.js +47 -0
- package/esm/node_modules/axios/lib/platform/common/utils.js.map +1 -0
- package/esm/node_modules/axios/lib/platform/index.js +10 -0
- package/esm/node_modules/axios/lib/platform/index.js.map +1 -0
- package/esm/node_modules/axios/lib/platform/node/classes/FormData.js +6 -0
- package/esm/node_modules/axios/lib/platform/node/classes/FormData.js.map +1 -0
- package/esm/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +6 -0
- package/esm/node_modules/axios/lib/platform/node/classes/URLSearchParams.js.map +1 -0
- package/esm/node_modules/axios/lib/platform/node/index.js +40 -0
- package/esm/node_modules/axios/lib/platform/node/index.js.map +1 -0
- package/esm/node_modules/axios/lib/utils.js +920 -0
- package/esm/node_modules/axios/lib/utils.js.map +1 -0
- package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/implementation.js +66 -0
- package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/implementation.js.map +1 -0
- package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/index.js +7 -0
- package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/index.js.map +1 -0
- package/esm/node_modules/combined-stream/lib/combined_stream.js +215 -0
- package/esm/node_modules/combined-stream/lib/combined_stream.js.map +1 -0
- package/esm/node_modules/debug/src/browser.js +287 -0
- package/esm/node_modules/debug/src/browser.js.map +1 -0
- package/esm/node_modules/debug/src/common.js +304 -0
- package/esm/node_modules/debug/src/common.js.map +1 -0
- package/esm/node_modules/debug/src/index.js +24 -0
- package/esm/node_modules/debug/src/index.js.map +1 -0
- package/esm/node_modules/debug/src/node.js +281 -0
- package/esm/node_modules/debug/src/node.js.map +1 -0
- package/esm/node_modules/deep-equal/node_modules/has-symbols/index.js +22 -0
- package/esm/node_modules/deep-equal/node_modules/has-symbols/index.js.map +1 -0
- package/esm/node_modules/deep-equal/node_modules/has-symbols/shams.js +58 -0
- package/esm/node_modules/deep-equal/node_modules/has-symbols/shams.js.map +1 -0
- package/esm/node_modules/deep-equal/node_modules/has-tostringtag/shams.js +9 -0
- package/esm/node_modules/deep-equal/node_modules/has-tostringtag/shams.js.map +1 -0
- package/esm/node_modules/deep-equal/node_modules/is-regex/index.js +53 -0
- package/esm/node_modules/deep-equal/node_modules/is-regex/index.js.map +1 -0
- package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/callBound.js +16 -0
- package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/callBound.js.map +1 -0
- package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/index.js +53 -0
- package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/index.js.map +1 -0
- package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/get-intrinsic/index.js +307 -0
- package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/get-intrinsic/index.js.map +1 -0
- package/esm/node_modules/delayed-stream/lib/delayed_stream.js +113 -0
- package/esm/node_modules/delayed-stream/lib/delayed_stream.js.map +1 -0
- package/esm/node_modules/es-set-tostringtag/index.js +41 -0
- package/esm/node_modules/es-set-tostringtag/index.js.map +1 -0
- package/esm/node_modules/follow-redirects/debug.js +20 -0
- package/esm/node_modules/follow-redirects/debug.js.map +1 -0
- package/esm/node_modules/follow-redirects/index.js +701 -0
- package/esm/node_modules/follow-redirects/index.js.map +1 -0
- package/esm/node_modules/form-data/lib/form_data.js +514 -0
- package/esm/node_modules/form-data/lib/form_data.js.map +1 -0
- package/esm/node_modules/form-data/lib/populate.js +11 -0
- package/esm/node_modules/form-data/lib/populate.js.map +1 -0
- package/esm/node_modules/get-intrinsic/node_modules/function-bind/implementation.js +75 -0
- package/esm/node_modules/get-intrinsic/node_modules/function-bind/implementation.js.map +1 -0
- package/esm/node_modules/get-intrinsic/node_modules/function-bind/index.js +16 -0
- package/esm/node_modules/get-intrinsic/node_modules/function-bind/index.js.map +1 -0
- package/esm/node_modules/has/src/index.js +7 -0
- package/esm/node_modules/has/src/index.js.map +1 -0
- package/esm/node_modules/has-flag/index.js +18 -0
- package/esm/node_modules/has-flag/index.js.map +1 -0
- package/esm/node_modules/hasown/node_modules/function-bind/implementation.js +75 -0
- package/esm/node_modules/hasown/node_modules/function-bind/implementation.js.map +1 -0
- package/esm/node_modules/hasown/node_modules/function-bind/index.js +16 -0
- package/esm/node_modules/hasown/node_modules/function-bind/index.js.map +1 -0
- package/esm/node_modules/is-boolean-object/node_modules/call-bind/callBound.js +16 -0
- package/esm/node_modules/is-boolean-object/node_modules/call-bind/callBound.js.map +1 -0
- package/esm/node_modules/is-boolean-object/node_modules/call-bind/index.js +53 -0
- package/esm/node_modules/is-boolean-object/node_modules/call-bind/index.js.map +1 -0
- package/esm/node_modules/is-boolean-object/node_modules/get-intrinsic/index.js +307 -0
- package/esm/node_modules/is-boolean-object/node_modules/get-intrinsic/index.js.map +1 -0
- package/esm/node_modules/is-boolean-object/node_modules/has-symbols/index.js +22 -0
- package/esm/node_modules/is-boolean-object/node_modules/has-symbols/index.js.map +1 -0
- package/esm/node_modules/is-boolean-object/node_modules/has-symbols/shams.js +67 -0
- package/esm/node_modules/is-boolean-object/node_modules/has-symbols/shams.js.map +1 -0
- package/esm/node_modules/is-boolean-object/node_modules/has-tostringtag/shams.js +18 -0
- package/esm/node_modules/is-boolean-object/node_modules/has-tostringtag/shams.js.map +1 -0
- package/esm/node_modules/is-number-object/node_modules/has-symbols/shams.js +58 -0
- package/esm/node_modules/is-number-object/node_modules/has-symbols/shams.js.map +1 -0
- package/esm/node_modules/is-number-object/node_modules/has-tostringtag/shams.js +9 -0
- package/esm/node_modules/is-number-object/node_modules/has-tostringtag/shams.js.map +1 -0
- package/esm/node_modules/is-string/node_modules/has-symbols/shams.js +58 -0
- package/esm/node_modules/is-string/node_modules/has-symbols/shams.js.map +1 -0
- package/esm/node_modules/is-string/node_modules/has-tostringtag/shams.js +9 -0
- package/esm/node_modules/is-string/node_modules/has-tostringtag/shams.js.map +1 -0
- package/esm/node_modules/is-symbol/node_modules/has-symbols/index.js +22 -0
- package/esm/node_modules/is-symbol/node_modules/has-symbols/index.js.map +1 -0
- package/esm/node_modules/is-symbol/node_modules/has-symbols/shams.js +58 -0
- package/esm/node_modules/is-symbol/node_modules/has-symbols/shams.js.map +1 -0
- package/esm/node_modules/mime-db/db.json.js +10705 -0
- package/esm/node_modules/mime-db/db.json.js.map +1 -0
- package/esm/node_modules/mime-db/index.js +17 -0
- package/esm/node_modules/mime-db/index.js.map +1 -0
- package/esm/node_modules/mime-types/index.js +194 -0
- package/esm/node_modules/mime-types/index.js.map +1 -0
- package/esm/node_modules/ms/index.js +173 -0
- package/esm/node_modules/ms/index.js.map +1 -0
- package/esm/node_modules/proxy-from-env/index.js +112 -0
- package/esm/node_modules/proxy-from-env/index.js.map +1 -0
- package/esm/node_modules/side-channel/node_modules/call-bind/callBound.js +16 -0
- package/esm/node_modules/side-channel/node_modules/call-bind/callBound.js.map +1 -0
- package/esm/node_modules/side-channel/node_modules/call-bind/index.js +53 -0
- package/esm/node_modules/side-channel/node_modules/call-bind/index.js.map +1 -0
- package/esm/node_modules/side-channel/node_modules/get-intrinsic/index.js +307 -0
- package/esm/node_modules/side-channel/node_modules/get-intrinsic/index.js.map +1 -0
- package/esm/node_modules/side-channel/node_modules/has-symbols/index.js +22 -0
- package/esm/node_modules/side-channel/node_modules/has-symbols/index.js.map +1 -0
- package/esm/node_modules/side-channel/node_modules/has-symbols/shams.js +58 -0
- package/esm/node_modules/side-channel/node_modules/has-symbols/shams.js.map +1 -0
- package/esm/node_modules/side-channel/node_modules/object-inspect/index.js +469 -0
- package/esm/node_modules/side-channel/node_modules/object-inspect/index.js.map +1 -0
- package/esm/node_modules/side-channel/node_modules/object-inspect/util.inspect.js +6 -0
- package/esm/node_modules/side-channel/node_modules/object-inspect/util.inspect.js.map +1 -0
- package/esm/node_modules/supports-color/index.js +149 -0
- package/esm/node_modules/supports-color/index.js.map +1 -0
- package/esm/utils/authorizations.js +1 -1
- package/esm/utils/confy.js +1 -1
- package/package.json +3 -3
- package/esm/lib/api/apiKeys.js +0 -51
- package/esm/lib/api/apiKeys.js.map +0 -1
- package/esm/lib/api/dataBuckets.js +0 -18
- package/esm/lib/api/dataBuckets.js.map +0 -1
- package/esm/lib/api/jobs.js +0 -56
- package/esm/lib/api/jobs.js.map +0 -1
- package/esm/lib/api/members.js +0 -33
- package/esm/lib/api/members.js.map +0 -1
- package/esm/lib/api/people.js +0 -50
- package/esm/lib/api/people.js.map +0 -1
- package/esm/lib/api/roles.js +0 -17
- package/esm/lib/api/roles.js.map +0 -1
- package/esm/lib/api/routes.js +0 -43
- package/esm/lib/api/routes.js.map +0 -1
- package/esm/lib/api/servicesMap.js +0 -17
- package/esm/lib/api/servicesMap.js.map +0 -1
- package/esm/lib/api/spaces.js +0 -32
- package/esm/lib/api/spaces.js.map +0 -1
- package/esm/lib/api/storage.js +0 -94
- package/esm/lib/api/storage.js.map +0 -1
- package/esm/node_modules/@dbmx/auth/dist/index.js +0 -638
- package/esm/node_modules/@dbmx/auth/dist/index.js.map +0 -1
- package/esm/node_modules/@dbmx/auth/dist/oidc-client.js +0 -107
- package/esm/node_modules/@dbmx/auth/dist/oidc-client.js.map +0 -1
- package/esm/node_modules/@dbmx/semver/dist/index.esm.js +0 -958
- package/esm/node_modules/@dbmx/semver/dist/index.esm.js.map +0 -1
- package/esm/node_modules/@dbmx/semver/node_modules/lru-cache/index.js +0 -340
- package/esm/node_modules/@dbmx/semver/node_modules/lru-cache/index.js.map +0 -1
- package/esm/node_modules/@dbmx/semver/node_modules/yallist/iterator.js +0 -18
- package/esm/node_modules/@dbmx/semver/node_modules/yallist/iterator.js.map +0 -1
- package/esm/node_modules/@dbmx/semver/node_modules/yallist/yallist.js +0 -430
- package/esm/node_modules/@dbmx/semver/node_modules/yallist/yallist.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/index.js +0 -251
- package/esm/node_modules/@dbmx/users/esm/index.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/ap.js +0 -44
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/ap.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/bind.js +0 -36
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/bind.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/curry.js +0 -53
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/curry.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/curryN.js +0 -60
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/curryN.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/difference.js +0 -50
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/difference.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/either.js +0 -46
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/either.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/equals.js +0 -37
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/equals.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/flip.js +0 -37
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/flip.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/identity.js +0 -29
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/identity.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/includes.js +0 -32
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/includes.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_Set.js +0 -201
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_Set.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_arity.js +0 -65
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_arity.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_arrayFromIterator.js +0 -13
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_arrayFromIterator.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_concat.js +0 -37
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_concat.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry1.js +0 -23
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry1.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry2.js +0 -35
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry2.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry3.js +0 -53
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry3.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curryN.js +0 -46
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curryN.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_dispatchable.js +0 -50
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_dispatchable.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_equals.js +0 -170
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_equals.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_filter.js +0 -18
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_filter.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_functionName.js +0 -8
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_functionName.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_has.js +0 -6
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_has.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_identity.js +0 -6
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_identity.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_includes.js +0 -8
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_includes.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_includesWith.js +0 -17
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_includesWith.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_indexOf.js +0 -71
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_indexOf.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArguments.js +0 -16
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArguments.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArray.js +0 -18
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArray.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArrayLike.js +0 -58
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArrayLike.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isFunction.js +0 -7
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isFunction.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isInteger.js +0 -14
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isInteger.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isPlaceholder.js +0 -6
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isPlaceholder.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isString.js +0 -6
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isString.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isTransformer.js +0 -6
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isTransformer.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_map.js +0 -15
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_map.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_objectIs.js +0 -17
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_objectIs.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_reduce.js +0 -74
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_reduce.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xfBase.js +0 -11
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xfBase.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xmap.js +0 -29
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xmap.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xwrap.js +0 -28
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xwrap.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/intersection.js +0 -42
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/intersection.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/is.js +0 -34
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/is.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/keys.js +0 -92
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/keys.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/lift.js +0 -34
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/lift.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/liftN.js +0 -35
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/liftN.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/map.js +0 -68
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/map.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/nth.js +0 -39
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/nth.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/or.js +0 -31
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/or.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/path.js +0 -32
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/path.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/paths.js +0 -47
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/paths.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/prop.js +0 -33
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/prop.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/propEq.js +0 -37
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/propEq.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/type.js +0 -36
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/type.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/uniq.js +0 -27
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/uniq.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/uniqBy.js +0 -46
- package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/uniqBy.js.map +0 -1
- package/esm/node_modules/@dbmx/users/esm/roles.js +0 -127
- package/esm/node_modules/@dbmx/users/esm/roles.js.map +0 -1
- package/esm/node_modules/jsrsasign/lib/jsrsasign.js +0 -248
- package/esm/node_modules/jsrsasign/lib/jsrsasign.js.map +0 -1
- package/esm/node_modules/jwt-decode/build/esm/index.js +0 -60
- package/esm/node_modules/jwt-decode/build/esm/index.js.map +0 -1
- package/esm/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js +0 -3591
- package/esm/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js.map +0 -1
- package/esm/node_modules/ramda/es/internal/_objectAssign.js +0 -32
- package/esm/node_modules/ramda/es/internal/_objectAssign.js.map +0 -1
- package/esm/node_modules/ramda/es/merge.js +0 -36
- package/esm/node_modules/ramda/es/merge.js.map +0 -1
|
@@ -1,638 +0,0 @@
|
|
|
1
|
-
import urljoin from '../../../url-join/lib/url-join.js';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import { nanoid } from 'nanoid';
|
|
4
|
-
import { jws, hextob64u as hextob64u_1, crypto as crypto_1 } from '../../../jsrsasign/lib/jsrsasign.js';
|
|
5
|
-
import { AuthRedirect as AuthRedirect$1 } from './oidc-client.js';
|
|
6
|
-
import '../../../oidc-client-ts/dist/esm/oidc-client-ts.js';
|
|
7
|
-
import merge from '../../../ramda/es/merge.js';
|
|
8
|
-
import prop from '../../../ramda/es/prop.js';
|
|
9
|
-
|
|
10
|
-
let self;
|
|
11
|
-
|
|
12
|
-
const DEFAULT_CONFIG = {
|
|
13
|
-
response_type: 'code',
|
|
14
|
-
scope: 'openid offline_access',
|
|
15
|
-
automaticSilentRenew: true,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const SESSION_ENDING_TIMEOUT = 30;
|
|
19
|
-
const OTP_ACCESS_TOKEN_NAME = 'OTP_ACCESS_TOKEN';
|
|
20
|
-
|
|
21
|
-
class EventEmitter {
|
|
22
|
-
constructor() {
|
|
23
|
-
this.listeners = {};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
on(type, cb) {
|
|
27
|
-
if (!(type in this.listeners)) {
|
|
28
|
-
this.listeners[type] = [];
|
|
29
|
-
}
|
|
30
|
-
this.listeners[type].push(cb);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
emit(event) {
|
|
34
|
-
if (!(event.type in this.listeners)) return
|
|
35
|
-
const stack = this.listeners[event.type].slice();
|
|
36
|
-
for (let i = 0, l = stack.length; i < l; i++) {
|
|
37
|
-
stack[i].call(this, event);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
class Auth extends EventEmitter {
|
|
43
|
-
constructor(options, tokens) {
|
|
44
|
-
super();
|
|
45
|
-
this.options = options;
|
|
46
|
-
this.tokens = tokens;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
registerLogout(delay) {
|
|
50
|
-
if (!this.tokens) return
|
|
51
|
-
this.logoutTimer = setTimeout(() => this.signOut(), delay || this.tokens.expires_in * 1000);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
registerEndSession() {
|
|
55
|
-
if (!this.tokens) return
|
|
56
|
-
if (this.refreshSessionTimer) clearTimeout(this.refreshSessionTimer);
|
|
57
|
-
this.refreshSessionTimer = setTimeout(() => {
|
|
58
|
-
this.checkSession()
|
|
59
|
-
.then(() => this.emit({ type: 'sessionEnding', timeout: SESSION_ENDING_TIMEOUT }))
|
|
60
|
-
.catch(() => this.signOut());
|
|
61
|
-
}, this.getSessionExpirationDelay(this.tokens));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async refreshTokens() {
|
|
65
|
-
if (!this.tokens) return
|
|
66
|
-
try {
|
|
67
|
-
const url = '/api/authOTP/refreshTokens';
|
|
68
|
-
const res = await fetch(url, {
|
|
69
|
-
method: 'POST',
|
|
70
|
-
headers: {
|
|
71
|
-
'Content-Type': 'application/json',
|
|
72
|
-
Authorization: `Bearer ${this.tokens.access_token}`,
|
|
73
|
-
},
|
|
74
|
-
body: JSON.stringify({
|
|
75
|
-
refreshToken: this.tokens.refresh_token,
|
|
76
|
-
}),
|
|
77
|
-
});
|
|
78
|
-
if (!res.ok) {
|
|
79
|
-
const errorData = await res.json();
|
|
80
|
-
throw { response: { data: errorData }, status: res.status }
|
|
81
|
-
}
|
|
82
|
-
const { accessToken, refreshToken, idToken } = await res.json();
|
|
83
|
-
const id_token = jws.JWS.parse(idToken);
|
|
84
|
-
this.tokens = {
|
|
85
|
-
access_token: accessToken,
|
|
86
|
-
refresh_token: refreshToken,
|
|
87
|
-
expires_in: id_token.payloadObj.exp,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
this.emit({
|
|
91
|
-
...this.tokens,
|
|
92
|
-
type: 'tokensRefreshed',
|
|
93
|
-
payload: id_token.payloadObj,
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
this.setAccessTokenCookie(accessToken, this.tokens);
|
|
97
|
-
this.registerEndSession();
|
|
98
|
-
|
|
99
|
-
return { ...this.tokens, payload: id_token.payloadObj }
|
|
100
|
-
} catch (err) {
|
|
101
|
-
this.signOut();
|
|
102
|
-
if (err.response?.data) return this.emit({ type: 'error', ...err.response.data })
|
|
103
|
-
throw err
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
getSessionExpirationDelay(token) {
|
|
108
|
-
if (!token?.expires_in) return 3570000
|
|
109
|
-
return Math.max(0, token.expires_in * 1000 - Date.now() - SESSION_ENDING_TIMEOUT * 1000)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
autoRefreshTokens() {
|
|
113
|
-
if (!this.tokens) return
|
|
114
|
-
if (this.autoRefreshTimer) clearTimeout(this.autoRefreshTimer); // autoRefreshTimer can be called by a client
|
|
115
|
-
this.autoRefreshTimer = setTimeout(() => this.refreshTokens(), this.getSessionExpirationDelay(this.tokens));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
async signOut() {
|
|
119
|
-
await this.endSession();
|
|
120
|
-
// await this.revokeRefreshToken()
|
|
121
|
-
this.tokens = null;
|
|
122
|
-
this.logoutTimer = clearTimeout(this.logoutTimer);
|
|
123
|
-
this.autoRefreshTimer = clearTimeout(this.autoRefreshTimer);
|
|
124
|
-
this.refreshSessionTimer = clearTimeout(this.refreshSessionTimer);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
class Oidc extends EventEmitter {
|
|
129
|
-
constructor(options, tokens) {
|
|
130
|
-
super();
|
|
131
|
-
if (!this.isValidConfig(options)) throw new Error(`Invalid setup`)
|
|
132
|
-
this.options = options;
|
|
133
|
-
this.tokens = tokens;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
get configurationUrl() {
|
|
137
|
-
return urljoin(this.options.authority, '/.well-known/openid-configuration')
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
decodeState(state) {
|
|
141
|
-
return state && JSON.parse(atob(state))
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
makeState() {
|
|
145
|
-
const state = {
|
|
146
|
-
srcUrl: window.location.href,
|
|
147
|
-
};
|
|
148
|
-
return btoa(JSON.stringify(state))
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
getSessionExpirationDelay(token) {
|
|
152
|
-
if (!token?.expires_in) return 3570000
|
|
153
|
-
return token.expires_in * 1000 - SESSION_ENDING_TIMEOUT * 1000
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
get authorizationUrl() {
|
|
157
|
-
this.code_verifier = `${nanoid()}-${nanoid()}`;
|
|
158
|
-
localStorage.setItem('code_verifier', this.code_verifier);
|
|
159
|
-
this.code_challenge = hextob64u_1(crypto_1.Util.hashString(this.code_verifier, 'SHA256'));
|
|
160
|
-
return urljoin(
|
|
161
|
-
this.authConfig.authorization_endpoint,
|
|
162
|
-
`?client_id=${this.options.client_id}`,
|
|
163
|
-
`?scope=${this.options.scope}`,
|
|
164
|
-
`?redirect_uri=${this.options.redirect_uri}`,
|
|
165
|
-
`?response_type=${this.options.response_type}`,
|
|
166
|
-
`?nonce=${nanoid()}`,
|
|
167
|
-
`?code_challenge=${this.code_challenge}`,
|
|
168
|
-
`?code_challenge_method=S256`,
|
|
169
|
-
`?state=${this.makeState()}`,
|
|
170
|
-
)
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
get endSessionUrl() {
|
|
174
|
-
return urljoin(
|
|
175
|
-
this.authConfig.end_session_endpoint,
|
|
176
|
-
`?client_id=${this.options.client_id}`,
|
|
177
|
-
`?id_token_hint=${this.tokens?.id_token}`,
|
|
178
|
-
)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
get endSessionUrlWithRedirect() {
|
|
182
|
-
return urljoin(this.endSessionUrl, `&post_logout_redirect_uri=${this.options.redirect_uri}`)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
async getOpenIdConfiguration() {
|
|
186
|
-
try {
|
|
187
|
-
const res = await axios.get(this.configurationUrl).then(prop('data'));
|
|
188
|
-
this.emit({ type: 'configurationLoaded', config: this.authConfig });
|
|
189
|
-
return res
|
|
190
|
-
} catch (err) {
|
|
191
|
-
throw new Error(`Cannot load openid configuration from ${this.configurationUrl}`)
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
async revoke(type) {
|
|
196
|
-
const url = this.authConfig.revocation_endpoint;
|
|
197
|
-
const config = {
|
|
198
|
-
headers: {
|
|
199
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
200
|
-
},
|
|
201
|
-
};
|
|
202
|
-
const params = new URLSearchParams();
|
|
203
|
-
params.append('client_id', this.options.client_id);
|
|
204
|
-
params.append('token', this.tokens[type]);
|
|
205
|
-
params.append('token_type_hint', type);
|
|
206
|
-
|
|
207
|
-
try {
|
|
208
|
-
await axios.post(url, params, config).then(prop('data'));
|
|
209
|
-
} catch (err) {
|
|
210
|
-
if (err.response?.data) return this.emit({ type: 'error', ...err.response.data })
|
|
211
|
-
throw err
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
revokeAccessToken() {
|
|
216
|
-
return this.revoke('access_token')
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
revokeRefreshToken() {
|
|
220
|
-
return this.revoke('refresh_token')
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
registerLogout(delay) {
|
|
224
|
-
if (!this.tokens) return
|
|
225
|
-
this.logoutTimer = setTimeout(() => this.signOut(), delay || this.tokens.expires_in * 1000);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
autoRefreshTokens() {
|
|
229
|
-
if (!this.tokens) return
|
|
230
|
-
if (this.autoRefreshTimer) clearTimeout(this.autoRefreshTimer); // autoRefreshTimer can be called by a client
|
|
231
|
-
this.autoRefreshTimer = setTimeout(() => this.refreshTokens(), this.getSessionExpirationDelay(this.tokens));
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
async checkSession() {
|
|
235
|
-
if (!this.tokens) return
|
|
236
|
-
const url = urljoin(this.authConfig.userinfo_endpoint, `?access_token=${this.tokens.access_token}`);
|
|
237
|
-
return axios.get(url)
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
manageSession(delay = 60 * 1000) {
|
|
241
|
-
if (!this.tokens) return
|
|
242
|
-
setTimeout(() => {
|
|
243
|
-
this.checkSession()
|
|
244
|
-
.then(() => this.manageSession(delay))
|
|
245
|
-
.catch(() => this.signOut());
|
|
246
|
-
}, delay);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
registerEndSession() {
|
|
250
|
-
if (!this.tokens) return
|
|
251
|
-
if (this.refreshSessionTimer) clearTimeout(this.refreshSessionTimer);
|
|
252
|
-
this.refreshSessionTimer = setTimeout(() => {
|
|
253
|
-
this.checkSession()
|
|
254
|
-
.then(() => this.emit({ type: 'sessionEnding', timeout: SESSION_ENDING_TIMEOUT }))
|
|
255
|
-
.catch(() => this.signOut());
|
|
256
|
-
}, this.getSessionExpirationDelay(this.tokens));
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
isValidConfig(config) {
|
|
260
|
-
return config?.authority
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
async getAccessTokenFromCode(code) {
|
|
264
|
-
const params = new URLSearchParams();
|
|
265
|
-
params.append('code', code);
|
|
266
|
-
params.append('client_id', this.options.client_id);
|
|
267
|
-
params.append('grant_type', 'authorization_code');
|
|
268
|
-
params.append('redirect_uri', this.options.redirect_uri);
|
|
269
|
-
params.append('code_verifier', this.code_verifier);
|
|
270
|
-
const config = {
|
|
271
|
-
headers: {
|
|
272
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
273
|
-
},
|
|
274
|
-
};
|
|
275
|
-
const url = this.authConfig.token_endpoint;
|
|
276
|
-
try {
|
|
277
|
-
this.tokens = await axios.post(url, params, config).then(prop('data'));
|
|
278
|
-
const id_token = jws.JWS.parse(this.tokens.id_token);
|
|
279
|
-
if (this.options.autoRefresh) this.autoRefreshTokens();
|
|
280
|
-
else this.registerEndSession();
|
|
281
|
-
this.emit({ ...this.tokens, type: 'signedIn', payload: id_token.payloadObj });
|
|
282
|
-
return { ...this.tokens, payload: id_token.payloadObj }
|
|
283
|
-
} catch (err) {
|
|
284
|
-
if (err.response?.data) return this.emit({ type: 'error', ...err.response.data })
|
|
285
|
-
throw err
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
async refreshTokens() {
|
|
290
|
-
if (!this.tokens) return
|
|
291
|
-
const params = new URLSearchParams();
|
|
292
|
-
params.append('client_id', this.options.client_id);
|
|
293
|
-
params.append('grant_type', 'refresh_token');
|
|
294
|
-
params.append('refresh_token', this.tokens.refresh_token);
|
|
295
|
-
const config = {
|
|
296
|
-
headers: {
|
|
297
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
const url = this.authConfig.token_endpoint;
|
|
301
|
-
try {
|
|
302
|
-
this.tokens = await axios.post(url, params, config).then(prop('data'));
|
|
303
|
-
const id_token = jws.JWS.parse(this.tokens.id_token);
|
|
304
|
-
if (this.options.autoRefresh) this.autoRefreshTokens();
|
|
305
|
-
else this.registerEndSession();
|
|
306
|
-
this.emit({ ...this.tokens, type: 'tokensRefreshed', payload: id_token.payloadObj });
|
|
307
|
-
return { ...this.tokens, payload: id_token.payloadObj }
|
|
308
|
-
} catch (err) {
|
|
309
|
-
this.signOut();
|
|
310
|
-
if (err.response?.data) return this.emit({ type: 'error', ...err.response.data })
|
|
311
|
-
throw err
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
async signOut() {
|
|
316
|
-
await this.endSession();
|
|
317
|
-
// await this.revokeRefreshToken()
|
|
318
|
-
this.tokens = null;
|
|
319
|
-
this.logoutTimer = clearTimeout(this.logoutTimer);
|
|
320
|
-
this.autoRefreshTimer = clearTimeout(this.autoRefreshTimer);
|
|
321
|
-
this.refreshSessionTimer = clearTimeout(this.refreshSessionTimer);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
async init(tokens) {
|
|
325
|
-
this.authConfig = await this.getOpenIdConfiguration();
|
|
326
|
-
if (tokens || tokens === null) this.tokens = tokens;
|
|
327
|
-
this.emit({ type: 'configurationLoaded', config: this.authConfig });
|
|
328
|
-
return this
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
class OidcIFrame extends Oidc {
|
|
333
|
-
async signIn(params) {
|
|
334
|
-
const options = merge(this.options, params);
|
|
335
|
-
try {
|
|
336
|
-
if (!this.authConfig) await this.init();
|
|
337
|
-
let iframe;
|
|
338
|
-
if (!options.frame) iframe = this.loginIframe;
|
|
339
|
-
else {
|
|
340
|
-
iframe = window.document.getElementById(options.frame);
|
|
341
|
-
this.loginIframe = iframe;
|
|
342
|
-
}
|
|
343
|
-
if (!iframe) throw new Error(`Cannot get login iframe ${options.frame}`)
|
|
344
|
-
iframe.src = this.authorizationUrl;
|
|
345
|
-
} catch (err) {
|
|
346
|
-
this.emit({ type: 'error', error_description: err.message || err.toString() });
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
async endSession() {
|
|
351
|
-
if (!this.tokens) return
|
|
352
|
-
let iframe = document.querySelector('iframe[id=logout-frame]');
|
|
353
|
-
if (!iframe) {
|
|
354
|
-
iframe = window.document.createElement('iframe');
|
|
355
|
-
iframe.id = 'logout-frame';
|
|
356
|
-
iframe.style = 'position: absolute; width: 1px; height: 1px; inset: -9999px; display: none;';
|
|
357
|
-
window.document.body.appendChild(iframe);
|
|
358
|
-
}
|
|
359
|
-
iframe.src = this.endSessionUrl;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
class OidcLib extends Oidc {
|
|
364
|
-
async init() {
|
|
365
|
-
try {
|
|
366
|
-
this.code_verifier = localStorage.getItem('code_verifier');
|
|
367
|
-
if (!this.authConfig) this.authConfig = await this.getOpenIdConfiguration();
|
|
368
|
-
this.emit({ type: 'configurationLoaded', config: this.authConfig });
|
|
369
|
-
} catch (err) {
|
|
370
|
-
this.emit({ type: 'error', error_description: err.message || err.toString() });
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
async signIn() {
|
|
375
|
-
try {
|
|
376
|
-
if (!this.authConfig) await this.init();
|
|
377
|
-
window.location.replace(this.authorizationUrl);
|
|
378
|
-
} catch (err) {
|
|
379
|
-
this.emit({ type: 'error', error_description: err.message || err.toString() });
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
async endSession() {
|
|
384
|
-
try {
|
|
385
|
-
if (!this.tokens) return
|
|
386
|
-
this.emit({ type: 'signedOut' });
|
|
387
|
-
window.location.replace(this.endSessionUrlWithRedirect);
|
|
388
|
-
} catch (err) {
|
|
389
|
-
this.emit({ type: 'error', error_description: err.message || err.toString() });
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
class OTP extends Auth {
|
|
395
|
-
init(tokens) {
|
|
396
|
-
this.tokens = tokens;
|
|
397
|
-
return this
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
async endSession() {
|
|
401
|
-
if (!this.tokens) return
|
|
402
|
-
|
|
403
|
-
try {
|
|
404
|
-
const url = '/api/authOTP/logout';
|
|
405
|
-
const res = await fetch(url, {
|
|
406
|
-
method: 'POST',
|
|
407
|
-
headers: {
|
|
408
|
-
'Content-Type': 'application/json',
|
|
409
|
-
},
|
|
410
|
-
body: JSON.stringify({
|
|
411
|
-
accessToken: this.tokens.access_token,
|
|
412
|
-
}),
|
|
413
|
-
});
|
|
414
|
-
|
|
415
|
-
if (!res.ok) {
|
|
416
|
-
const errorData = await res.json();
|
|
417
|
-
throw { response: { data: errorData }, status: res.status }
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
this.removeAccessTokenCookie();
|
|
421
|
-
this.emit({ type: 'signedOut' });
|
|
422
|
-
} catch (err) {
|
|
423
|
-
if (err.response?.data) return this.emit({ type: 'error', ...err.response.data })
|
|
424
|
-
throw err
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
async checkSession() {
|
|
429
|
-
if (!this.tokens) return
|
|
430
|
-
|
|
431
|
-
const url = '/api/authOTP/getMe';
|
|
432
|
-
|
|
433
|
-
const res = await fetch(url, {
|
|
434
|
-
method: 'POST',
|
|
435
|
-
headers: {
|
|
436
|
-
'Content-Type': 'application/json',
|
|
437
|
-
},
|
|
438
|
-
body: JSON.stringify({
|
|
439
|
-
accessToken: this.tokens.access_token,
|
|
440
|
-
}),
|
|
441
|
-
});
|
|
442
|
-
|
|
443
|
-
if (!res.ok) {
|
|
444
|
-
throw new Error(`Request failed with status ${res.status}`)
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
return res.json()
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
getHostname() {
|
|
451
|
-
return location.hostname
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
getBaseDomain() {
|
|
455
|
-
const hostname = this.getHostname();
|
|
456
|
-
const parts = hostname.split('.');
|
|
457
|
-
if (parts.length >= 2) {
|
|
458
|
-
// take the last two parts for base domain (x.com)
|
|
459
|
-
const base = parts.slice(-2).join('.');
|
|
460
|
-
return `.${base}`
|
|
461
|
-
}
|
|
462
|
-
return hostname
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
getCookieDomain() {
|
|
466
|
-
const hostname = this.getHostname();
|
|
467
|
-
return hostname === 'localhost' || hostname === '0.0.0.0' || hostname === '127.0.0.1'
|
|
468
|
-
? ''
|
|
469
|
-
: `domain=${this.getBaseDomain()};`
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
setAccessTokenCookie(value, token) {
|
|
473
|
-
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
474
|
-
const maxAge = Math.max(0, token.expires_in - nowSeconds);
|
|
475
|
-
const domain = this.getCookieDomain();
|
|
476
|
-
const addationalParams = domain ? 'Secure; SameSite=None;' : '';
|
|
477
|
-
document.cookie = `${OTP_ACCESS_TOKEN_NAME}=${value}; max-age=${maxAge}; ${domain} path=/; ${addationalParams}`;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
getAccessTokenCookie() {
|
|
481
|
-
const cookies = document.cookie.split(';');
|
|
482
|
-
for (let cookie of cookies) {
|
|
483
|
-
const [cookieName, cookieValue] = cookie.split('=');
|
|
484
|
-
if (cookieName.trim() === OTP_ACCESS_TOKEN_NAME) {
|
|
485
|
-
const value = cookieValue?.trim();
|
|
486
|
-
return value ? value : null
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
return null
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
removeAccessTokenCookie() {
|
|
493
|
-
const domain = this.getCookieDomain();
|
|
494
|
-
document.cookie = `${OTP_ACCESS_TOKEN_NAME}=; ${domain} path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
async userTokens(tokens) {
|
|
498
|
-
const { accessToken, refreshToken, idToken } = tokens;
|
|
499
|
-
|
|
500
|
-
try {
|
|
501
|
-
const idTokenPayload = jws.JWS.parse(idToken);
|
|
502
|
-
|
|
503
|
-
this.tokens = {
|
|
504
|
-
access_token: accessToken,
|
|
505
|
-
refresh_token: refreshToken,
|
|
506
|
-
expires_in: idTokenPayload.payloadObj.exp,
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
const signedInOptions = {
|
|
510
|
-
...this.tokens,
|
|
511
|
-
payload: idTokenPayload.payloadObj,
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
this.emit({
|
|
515
|
-
type: 'signedIn',
|
|
516
|
-
...signedInOptions,
|
|
517
|
-
});
|
|
518
|
-
|
|
519
|
-
this.setAccessTokenCookie(accessToken, this.tokens);
|
|
520
|
-
this.registerEndSession();
|
|
521
|
-
|
|
522
|
-
return signedInOptions
|
|
523
|
-
} catch (error) {
|
|
524
|
-
// this.emit({ type: 'error', error_description: err.message || err.toString() })
|
|
525
|
-
this.emit({ type: 'error', error: 'failed' });
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* Factory function to create an instance of AuthIFrame, enabling authentication using an iframe
|
|
532
|
-
*
|
|
533
|
-
* @function AuthIFrame
|
|
534
|
-
* @tag auth
|
|
535
|
-
* @param {Object} - [options]: Configuration options for authentication
|
|
536
|
-
* @param {Function} - [onSignIn]: Callback function invoked on successful sign-in
|
|
537
|
-
* @param {Function} - [onSignOut]: Callback function invoked on sign-out
|
|
538
|
-
* @param {Function} - [onAuthError]: Callback function invoked on authentication error
|
|
539
|
-
* @param {string} - [options.authority]: The authority URL for authentication
|
|
540
|
-
* @param {string} - [options.redirect_uri]: The redirect URI for authentication
|
|
541
|
-
* @param {string} - [options.client_id]: The client ID for authentication
|
|
542
|
-
* @return {Auth} - An instance of Auth
|
|
543
|
-
*/
|
|
544
|
-
const AuthIFrame = ({ onSignIn, onSignOut, onAuthError, ...config } = {}) => {
|
|
545
|
-
let signInTimer;
|
|
546
|
-
if (!self) {
|
|
547
|
-
const oidc = new OidcIFrame(Object.assign({}, DEFAULT_CONFIG, config, { redirect_uri: config.redirect_uri }));
|
|
548
|
-
if (onSignIn) oidc.on('signedIn', onSignIn);
|
|
549
|
-
if (onSignOut) oidc.on('signedOut', onSignOut);
|
|
550
|
-
if (onAuthError) oidc.on('error', onAuthError);
|
|
551
|
-
window.onmessage = e => {
|
|
552
|
-
if (e.origin === new URL(config.authority).origin) {
|
|
553
|
-
switch (e.data.type) {
|
|
554
|
-
case 'code':
|
|
555
|
-
oidc.getAccessTokenFromCode(e.data.code);
|
|
556
|
-
break
|
|
557
|
-
case 'signedOut':
|
|
558
|
-
oidc.emit({ type: 'signedOut' });
|
|
559
|
-
break
|
|
560
|
-
case 'session_not_found':
|
|
561
|
-
oidc.emit({
|
|
562
|
-
type: 'error',
|
|
563
|
-
error: 'session_not_found',
|
|
564
|
-
error_description: 'Session was expired, please sign in again',
|
|
565
|
-
});
|
|
566
|
-
if (signInTimer) clearTimeout(signInTimer);
|
|
567
|
-
signInTimer = setTimeout(() => oidc.signIn(), 1000);
|
|
568
|
-
break
|
|
569
|
-
default:
|
|
570
|
-
oidc.emit({ ...e.data, type: 'error' });
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
};
|
|
574
|
-
self = oidc;
|
|
575
|
-
}
|
|
576
|
-
return self
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* Factory function to create an instance of AuthRedirect, enabling redirect authentication.
|
|
581
|
-
*
|
|
582
|
-
* @function AuthRedirect
|
|
583
|
-
* @tag auth
|
|
584
|
-
* @param {Object} - [options]: Configuration options for authentication
|
|
585
|
-
* @param {Function} - [onSignIn]: Callback function invoked on successful sign-in
|
|
586
|
-
* @param {Function} - [onSignOut]: Callback function invoked on sign-out
|
|
587
|
-
* @param {Function} - [onAuthError]: Callback function invoked on authentication error
|
|
588
|
-
* @param {string} - [options.redirect_uri]: The redirect URI for authentication
|
|
589
|
-
* @return {AuthRedirect} - An instance of Auth
|
|
590
|
-
*/
|
|
591
|
-
const AuthRedirect = ({ onSignIn, onSignOut, onAuthError, ...config } = {}) => {
|
|
592
|
-
if (config.lib === 'oidc-client-ts') return AuthRedirect$1({ onSignIn, onSignOut, onAuthError, ...config })
|
|
593
|
-
|
|
594
|
-
if (!self) {
|
|
595
|
-
const oidc = new OidcLib(Object.assign({}, DEFAULT_CONFIG, config, { redirect_uri: config.redirect_uri }));
|
|
596
|
-
if (onSignIn) oidc.on('signedIn', onSignIn);
|
|
597
|
-
if (onSignOut) oidc.on('signedOut', onSignOut);
|
|
598
|
-
if (onAuthError) oidc.on('error', onAuthError);
|
|
599
|
-
|
|
600
|
-
window.onmessage = async e => {
|
|
601
|
-
switch (e.data.type) {
|
|
602
|
-
case 'code':
|
|
603
|
-
await oidc.init();
|
|
604
|
-
oidc.getAccessTokenFromCode(e.data.code);
|
|
605
|
-
break
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
|
|
609
|
-
self = oidc;
|
|
610
|
-
}
|
|
611
|
-
return self
|
|
612
|
-
};
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* Factory function to create an instance of AuthOTP, enabling OTP authentication.
|
|
616
|
-
*
|
|
617
|
-
* @function AuthOTP
|
|
618
|
-
* @tag auth
|
|
619
|
-
* @param {Object} - [options]: Configuration options for authentication
|
|
620
|
-
* @param {Function} - [onSignIn]: Callback function invoked on successful sign-in
|
|
621
|
-
* @param {Function} - [onSignOut]: Callback function invoked on sign-out
|
|
622
|
-
* @param {Function} - [onAuthError]: Callback function invoked on authentication error
|
|
623
|
-
* @return {AuthOTP} - An instance of AuthOTP
|
|
624
|
-
*/
|
|
625
|
-
const AuthOTP = ({ onSignIn, onSignOut, onAuthError, ...config } = {}) => {
|
|
626
|
-
if (!self) {
|
|
627
|
-
const otp = new OTP(Object.assign({}, config));
|
|
628
|
-
if (onSignIn) otp.on('signedIn', onSignIn);
|
|
629
|
-
if (onSignOut) otp.on('signedOut', onSignOut);
|
|
630
|
-
if (onAuthError) otp.on('error', onAuthError);
|
|
631
|
-
|
|
632
|
-
self = otp;
|
|
633
|
-
}
|
|
634
|
-
return self
|
|
635
|
-
};
|
|
636
|
-
|
|
637
|
-
export { AuthIFrame, AuthOTP, AuthRedirect, self };
|
|
638
|
-
//# sourceMappingURL=index.js.map
|