oidc-spa 7.2.0-rc.2 β 7.2.0-rc.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/LICENSE +21 -0
- package/README.md +185 -0
- package/core/createOidc.js +1 -1
- package/esm/core/createOidc.js +1 -1
- package/esm/tools/Deferred.d.ts +0 -1
- package/esm/tools/Deferred.js +0 -4
- package/esm/tools/Deferred.js.map +1 -1
- package/esm/vendor/frontend/tsafe.d.ts +0 -1
- package/esm/vendor/frontend/tsafe.js +1 -1
- package/package.json +2 -1
- package/tools/Deferred.d.ts +0 -1
- package/tools/Deferred.js +0 -4
- package/tools/Deferred.js.map +1 -1
- package/vendor/frontend/tsafe.d.ts +0 -1
- package/vendor/frontend/tsafe.js +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 GitHub user u/garronej
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<br>
|
|
5
|
+
<a href="https://github.com/keycloakify/oidc-spa/actions">
|
|
6
|
+
<img src="https://github.com/keycloakify/oidc-spa/actions/workflows/ci.yaml/badge.svg?branch=main">
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/oidc-spa">
|
|
9
|
+
<img src="https://img.shields.io/npm/dw/oidc-spa">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://github.com/garronej/oidc-spa/blob/main/LICENSE">
|
|
12
|
+
<img src="https://img.shields.io/npm/l/oidc-spa">
|
|
13
|
+
</a>
|
|
14
|
+
</p>
|
|
15
|
+
<p align="center">
|
|
16
|
+
We're here to help!<br/>
|
|
17
|
+
<a href="https://discord.gg/mJdYJSdcm4">
|
|
18
|
+
<img src="https://dcbadge.limes.pink/api/server/kYFZG7fQmn"/>
|
|
19
|
+
</a>
|
|
20
|
+
</p>
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="https://www.oidc-spa.dev">Home</a>
|
|
23
|
+
-
|
|
24
|
+
<a href="https://docs.oidc-spa.dev">Documentation</a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
> π£οΈ oidc-spa will be introduced at [KeyConf 2025](https://keyconf.dev/) on the 28 of August.
|
|
28
|
+
|
|
29
|
+
A full-featured OpenID Connect / OAuth2 client for single-page applications (SPAs).
|
|
30
|
+
|
|
31
|
+
With `oidc-spa`, you can seamlessly integrate authentication providers like [Keycloak](https://www.keycloak.org/), [Auth0](https://auth0.com/), or [Microsoft Entra ID](https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id) into your application, purely on the client side,
|
|
32
|
+
[without involving your backend in the token exchange](https://docs.oidc-spa.dev/resources/why-no-client-secret).
|
|
33
|
+
|
|
34
|
+
In **simple terms**, `oidc-spa` is a library that makes it easy to **add authentication** to your Vite or Create-React-App project.
|
|
35
|
+
There are many authentication and user management platforms out there: Okta, Auth0, Entra ID...
|
|
36
|
+
There are also plenty of self-hosted options like Keycloak, Ory Hydra, and Dex.
|
|
37
|
+
What all of these have in common is that they implement the OpenID Connect/OAuth2 standard.
|
|
38
|
+
|
|
39
|
+
This library provides a **unified way** to connect with these different providers instead of having to use
|
|
40
|
+
their specific SDKs.
|
|
41
|
+
|
|
42
|
+
`oidc-spa` implement the [**Authorization Code Flow with PKCE**](https://docs.oidc-spa.dev/resources/why-no-client-secret), this means that **you do not need a backend and a database** to handle the authentication process.
|
|
43
|
+
The authentication process is handled entirely in the browser. And no need for `/login` or `/logout` routes.
|
|
44
|
+
|
|
45
|
+
## Why `oidc-spa`?
|
|
46
|
+
|
|
47
|
+
Most OIDC providers push their own client libraries:
|
|
48
|
+
|
|
49
|
+
- **Auth0** β `auth0-spa-js`
|
|
50
|
+
- **Microsoft Entra ID** β `MSAL.js`
|
|
51
|
+
- **Keycloak** β `keycloak-js` (no longer actively promoted, planned for deprecation)
|
|
52
|
+
- **... and so on.**
|
|
53
|
+
|
|
54
|
+
These libraries are **tied to a specific provider**. But what if you need to:
|
|
55
|
+
|
|
56
|
+
β
Switch OIDC providers without modifying your authentication logic?
|
|
57
|
+
β
Build a self-hostable solution that works with any provider (e.g., you're developing a dashboard app that you sell to enterprises and need to integrate with their existing IAM system)?
|
|
58
|
+
β
Stop re-learning authentication implementation every time you change providers?
|
|
59
|
+
|
|
60
|
+
And besides, not all SDKs are equal in terms of setup simplicity, performance, and API quality.
|
|
61
|
+
|
|
62
|
+
We wanted a **universal solution**, one that is as good or better than all existing SDKs in every aspect.
|
|
63
|
+
|
|
64
|
+
## Features
|
|
65
|
+
|
|
66
|
+
- π **No OIDC/OAuth2 expertise required**: Easy to setup and use. We're here to help [on Discord](https://discord.gg/mJdYJSdcm4)!
|
|
67
|
+
- π οΈ **Simple setup**: No need to define `/login` or `/logout` routes, token refreshing is automatic, it just works.
|
|
68
|
+
- β¨ **React integration**: Expose a framework agnostic API but also a React adapter `oidc-spa/react`.
|
|
69
|
+
- π₯ **No limitation**- For example, everything you could do with `keycloak-js`, you can do with `oidc-spa`.
|
|
70
|
+
- π¬ **Detailed debug messages**: If your OIDC server is not properly configured, it tells you precisely whatβs wrong and what you need to do to fix it.
|
|
71
|
+
- π£ **Auto logout with countdown**: "You will be logged out in 10... 9... 8...", users see exactly when their session expires.
|
|
72
|
+
- πͺ **Logout propagation**: Logging out in one tab logs out all others.
|
|
73
|
+
- π **Comprehensive documentation**: Guides and examples for common scenarios.
|
|
74
|
+
- β
**Type safety**: Strong TypeScript support with optional [Zod](https://zod.dev/) integration validating the expected shape of the ID token.
|
|
75
|
+
- π **Security-first**: Uses [**Authorization Code Flow + PKCE**](https://docs.oidc-spa.dev/resources/why-no-client-secret#id-2.-authorization-code-flow--pkce-used-by-oidc-spa), No token persistence in `localStorage` or `sessionStorage`.
|
|
76
|
+
- π₯οΈ **Optional backend utilities**: Provides tools for token validation in JavaScript backends (Node.js, Deno, Web Workers).
|
|
77
|
+
- πͺ **No third-party cookie issues**: Third-party cookies blocked? No problem, `oidc-spa` works around it automatically with no special measures needed on your side.
|
|
78
|
+
- π **Multi-instance support**: Run multiple `oidc-spa` instances in the same app without conflict.
|
|
79
|
+
|
|
80
|
+
## Comparison with Existing Libraries
|
|
81
|
+
|
|
82
|
+
### [oidc-client-ts](https://github.com/authts/oidc-client-ts)
|
|
83
|
+
|
|
84
|
+
While `oidc-client-ts` is a comprehensive toolkit designed for various applications, `oidc-spa` is specifically built for SPAs with an easy-to-set-up API.
|
|
85
|
+
But **ease of use** isn't the only difference, `oidc-spa` also provides **out-of-the-box** solutions for features that `oidc-client-ts` leaves up to you to implement, such as:
|
|
86
|
+
|
|
87
|
+
- **Login/logout propagation** across tabs
|
|
88
|
+
- **Graceful fallback when third-party cookies are blocked**
|
|
89
|
+
- **Seamless browser back/forward cache (bfcache) management**
|
|
90
|
+
- **Auto logout countdown** so users can be automatically logged out after a set period of inactivity.
|
|
91
|
+
- **Ensuring you never get an expired access token error**, even after the computer wakes up from sleep.
|
|
92
|
+
- **Gracefully handles scenarios where the provider does not issue a refresh token or lacks a logout endpoint** (e.g., Google OAuth)
|
|
93
|
+
|
|
94
|
+
### [react-oidc-context](https://github.com/authts/react-oidc-context)
|
|
95
|
+
|
|
96
|
+
`react-oidc-context` is a React wrapper around `oidc-client-ts`.
|
|
97
|
+
`oidc-spa` also feature a carefully crafted React API that comes with [working examples that you can test locally](https://docs.oidc-spa.dev/example-setups/example-setups).
|
|
98
|
+
|
|
99
|
+
### [keycloak-js](https://www.npmjs.com/package/keycloak-js)
|
|
100
|
+
|
|
101
|
+
The official OIDC Client for Keycloak. It only works with Keycloak and [will eventually be deprecated](https://www.keycloak.org/2023/03/adapter-deprecation-update).
|
|
102
|
+
Beyond that, achieving the same seamless user experience as `oidc-spa` with `keycloak-js` requires writing a lot of custom code, code that really **shouldnβt** be handled at the application level.
|
|
103
|
+
|
|
104
|
+
### [NextAuth.js](https://next-auth.js.org/)
|
|
105
|
+
|
|
106
|
+
Since oidc-spa is built for true SPAs, Next.js applications should use NextAuth.js instead.
|
|
107
|
+
|
|
108
|
+
> _NOTE: We might create in the future a `oidc-mpa` library for Multi Page Applications that would aim at supporting Next.js projects._
|
|
109
|
+
|
|
110
|
+
## π Quick start
|
|
111
|
+
|
|
112
|
+
Head over to [the documentation website](https://docs.oidc-spa.dev) π!
|
|
113
|
+
|
|
114
|
+
## Sponsors
|
|
115
|
+
|
|
116
|
+
Project backers, we trust and recommend their services.
|
|
117
|
+
|
|
118
|
+
<br/>
|
|
119
|
+
|
|
120
|
+
<div align="center">
|
|
121
|
+
|
|
122
|
+

|
|
123
|
+
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<div align="center">
|
|
127
|
+
|
|
128
|
+

|
|
129
|
+
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<br/>
|
|
133
|
+
|
|
134
|
+
<p align="center">
|
|
135
|
+
<i><a href="https://phasetwo.io/?utm_source=keycloakify"><strong>Keycloak as a Service</strong></a> - Keycloak community contributors of popular <a href="https://github.com/p2-inc#our-extensions-?utm_source=keycloakify">extensions</a> providing free and dedicated <a href="https://phasetwo.io/hosting/?utm_source=keycloakify">Keycloak hosting</a> and enterprise <a href="https://phasetwo.io/support/?utm_source=keycloakify">Keycloak support</a> to businesses of all sizes.</i>
|
|
136
|
+
</p>
|
|
137
|
+
|
|
138
|
+
<br/>
|
|
139
|
+
<br/>
|
|
140
|
+
<br/>
|
|
141
|
+
|
|
142
|
+
<div align="center">
|
|
143
|
+
|
|
144
|
+

|
|
145
|
+
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
<div align="center">
|
|
149
|
+
|
|
150
|
+

|
|
151
|
+
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<br/>
|
|
155
|
+
|
|
156
|
+
<p align="center">
|
|
157
|
+
<a href="https://www.zone2.tech/services/keycloak-consulting">
|
|
158
|
+
<i><strong>Keycloak Consulting Services</strong> - Your partner in Keycloak deployment, configuration, and extension development for optimized identity management solutions.</i>
|
|
159
|
+
</a>
|
|
160
|
+
</p>
|
|
161
|
+
|
|
162
|
+
## We built it because we needed it.
|
|
163
|
+
|
|
164
|
+
This library isn't a theoretical exercise or a tool for hobby projects.
|
|
165
|
+
We developed it to solve real-world problems we faced ourselves.
|
|
166
|
+
Today, it powers authentication for [Onyxia](https://onyxia.sh),
|
|
167
|
+
a data science platform deployed across multiple large organizations.
|
|
168
|
+
|
|
169
|
+
### Onyxia
|
|
170
|
+
|
|
171
|
+
- [Source code](https://github.com/InseeFrLab/onyxia)
|
|
172
|
+
- [Public instance](https://datalab.sspcloud.fr)
|
|
173
|
+
|
|
174
|
+
<a href="https://youtu.be/FvpNfVrxBFM">
|
|
175
|
+
<img width="1712" alt="image" src="https://user-images.githubusercontent.com/6702424/231314534-2eeb1ab5-5460-4caa-b78d-55afd400c9fc.png">
|
|
176
|
+
</a>
|
|
177
|
+
|
|
178
|
+
### The French Interministerial Base of Free Software
|
|
179
|
+
|
|
180
|
+
- [Source code](https://github.com/codegouvfr/sill-web/)
|
|
181
|
+
- [Deployment of the website](https://sill-preprod.lab.sspcloud.fr/)
|
|
182
|
+
|
|
183
|
+
<a href="https://youtu.be/AT3CvmY_Y7M?si=Edkf0vRNjosGLA3R">
|
|
184
|
+
<img width="1712" alt="image" src="https://github.com/garronej/i18nifty/assets/6702424/aa06cc30-b2bd-4c8b-b435-2f875f53175b">
|
|
185
|
+
</a>
|
package/core/createOidc.js
CHANGED
|
@@ -63,7 +63,7 @@ const isNewBrowserSession_1 = require("./isNewBrowserSession");
|
|
|
63
63
|
const getIsOnline_1 = require("../tools/getIsOnline");
|
|
64
64
|
const isKeycloak_1 = require("../keycloak/isKeycloak");
|
|
65
65
|
// NOTE: Replaced at build time
|
|
66
|
-
const VERSION = "7.2.0-rc.
|
|
66
|
+
const VERSION = "7.2.0-rc.3";
|
|
67
67
|
const globalContext = {
|
|
68
68
|
prOidcByConfigId: new Map(),
|
|
69
69
|
hasLogoutBeenCalled: (0, tsafe_1.id)(false),
|
package/esm/core/createOidc.js
CHANGED
|
@@ -26,7 +26,7 @@ import { createGetIsNewBrowserSession } from "./isNewBrowserSession";
|
|
|
26
26
|
import { getIsOnline } from "../tools/getIsOnline";
|
|
27
27
|
import { isKeycloak } from "../keycloak/isKeycloak";
|
|
28
28
|
// NOTE: Replaced at build time
|
|
29
|
-
const VERSION = "7.2.0-rc.
|
|
29
|
+
const VERSION = "7.2.0-rc.3";
|
|
30
30
|
const globalContext = {
|
|
31
31
|
prOidcByConfigId: new Map(),
|
|
32
32
|
hasLogoutBeenCalled: id(false),
|
package/esm/tools/Deferred.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export declare class Deferred<T> {
|
|
|
4
4
|
readonly resolve: (value: T) => void;
|
|
5
5
|
readonly reject: (error: any) => void;
|
|
6
6
|
constructor();
|
|
7
|
-
readonly isPending: boolean;
|
|
8
7
|
}
|
|
9
8
|
export declare namespace Deferred {
|
|
10
9
|
type Unpack<T extends Deferred<any>> = T extends Deferred<infer U> ? U : never;
|
package/esm/tools/Deferred.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { overwriteReadonlyProp } from "../vendor/frontend/tsafe";
|
|
2
1
|
export class Deferred {
|
|
3
2
|
constructor() {
|
|
4
|
-
this.isPending = true;
|
|
5
3
|
let resolve;
|
|
6
4
|
let reject;
|
|
7
5
|
this.pr = new Promise((resolve_, reject_) => {
|
|
8
6
|
resolve = value => {
|
|
9
|
-
overwriteReadonlyProp(this, "isPending", false);
|
|
10
7
|
resolve_(value);
|
|
11
8
|
};
|
|
12
9
|
reject = error => {
|
|
13
|
-
overwriteReadonlyProp(this, "isPending", false);
|
|
14
10
|
reject_(error);
|
|
15
11
|
};
|
|
16
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deferred.js","sourceRoot":"","sources":["../../../src/tools/Deferred.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"Deferred.js","sourceRoot":"","sources":["../../../src/tools/Deferred.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAQ;IAOjB;QACI,IAAI,OAA4B,CAAC;QACjC,IAAI,MAA6B,CAAC;QAElC,IAAI,CAAC,EAAE,GAAG,IAAI,OAAO,CAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;YAC3C,OAAO,GAAG,KAAK,CAAC,EAAE;gBACd,QAAQ,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC,CAAC;YAEF,MAAM,GAAG,KAAK,CAAC,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,CAAC;YACnB,CAAC,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAMD,MAAM,OAAO,YAAa,SAAQ,QAAmB;CAEpD"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { id } from "tsafe/id";
|
|
2
2
|
export { assert, is, type Equals } from "tsafe/assert";
|
|
3
3
|
export { typeGuard } from "tsafe/typeGuard";
|
|
4
|
-
export { overwriteReadonlyProp } from "tsafe/lab/overwriteReadonlyProp";
|
|
5
4
|
export { noUndefined } from "tsafe/noUndefined";
|
|
6
5
|
export type { Param0 } from "tsafe";
|
|
7
6
|
export { isAmong } from "tsafe/isAmong";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t={d:(r,e)=>{for(var n in e)t.o(e,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:e[n]})},o:(t,r)=>Object.prototype.hasOwnProperty.call(t,r)},r={};t.d(r,{vA:()=>
|
|
1
|
+
var t={d:(r,e)=>{for(var n in e)t.o(e,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:e[n]})},o:(t,r)=>Object.prototype.hasOwnProperty.call(t,r)},r={};t.d(r,{vA:()=>v,id:()=>e,is:()=>h,FB:()=>g,AG:()=>m,Ew:()=>w});var e=function(t){return t};function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function i(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?o(Object(e),!0).forEach((function(r){c(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):o(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function c(t,r,e){return(r=function(t){var r=function(t){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=n(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function f(t,r){if(r&&("object"==u(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function a(t){var r="function"==typeof Map?new Map:void 0;return a=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(r){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return function(t,r,e){if(l())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,r);var o=new(t.bind.apply(t,n));return e&&s(o,e.prototype),o}(t,arguments,p(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s(e,t)},a(t)}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!t})()}function s(t,r){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},s(t,r)}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}var y=function(){function t(r){var e,n,o,c;if(function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),n=this,o=t,c=["Wrong assertion encountered"+(r?': "'.concat(r,'"'):"")],o=p(o),(e=f(n,l()?Reflect.construct(o,c||[],p(n).constructor):o.apply(n,c))).originalMessage=r,Object.setPrototypeOf(e,(this instanceof t?this.constructor:void 0).prototype),!e.stack)return f(e);try{!function(t,r,e){try{t[r]=e}catch(t){}if(t[r]===e)return e;var n=void 0,o=Object.getOwnPropertyDescriptor(t,r)||{enumerable:!0,configurable:!0};if(o.get)throw new Error("Probably a wrong ides to overwrite ".concat(String(r)," getter"));try{Object.defineProperty(t,r,i(i({},o),{},{value:e}))}catch(t){n=t}if(t[r]!==e)throw n||new Error("Can't assign")}(e,"stack",e.stack.split("\n").filter((function(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];var n=r[1];return 1!==n&&2!==n})).join("\n"))}catch(t){}return e}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&s(t,r)}(t,a(Error)),r=t,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(),b=void 0;function v(t,r){if(0===arguments.length&&(t=!0),void 0===b){if(!t)throw new y("function"==typeof r?r():r)}else b=void 0}var d="Wrong usage of the `is` function refer to https://docs.tsafe.dev/is";function h(t){var r={};if(void 0!==b)throw b=void 0,new Error(d);return b=r,Promise.resolve().then((function(){if(b===r)throw new Error(d)})),null}function w(t,r){return r}function m(t){var r={};for(var e in t)void 0!==t[e]&&(r[e]=t[e]);return r}function O(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function g(t,r){var e,n=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return O(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?O(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return c=t.done,t},e:function(t){u=!0,i=t},f:function(){try{c||null==e.return||e.return()}finally{if(u)throw i}}}}(t);try{for(n.s();!(e=n.n()).done;)if(e.value===r)return!0}catch(t){n.e(t)}finally{n.f()}return!1}var j=r.vA,P=r.id,S=r.is,E=r.FB,A=r.AG,_=r.Ew;export{j as assert,P as id,S as is,E as isAmong,A as noUndefined,_ as typeGuard};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oidc-spa",
|
|
3
|
-
"version": "7.2.0-rc.
|
|
3
|
+
"version": "7.2.0-rc.3",
|
|
4
4
|
"description": "Openidconnect client for Single Page Applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
+
"sideEffects": false,
|
|
37
38
|
"main": "index.js",
|
|
38
39
|
"types": "index.d.ts",
|
|
39
40
|
"module": "esm/index.js",
|
package/tools/Deferred.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export declare class Deferred<T> {
|
|
|
4
4
|
readonly resolve: (value: T) => void;
|
|
5
5
|
readonly reject: (error: any) => void;
|
|
6
6
|
constructor();
|
|
7
|
-
readonly isPending: boolean;
|
|
8
7
|
}
|
|
9
8
|
export declare namespace Deferred {
|
|
10
9
|
type Unpack<T extends Deferred<any>> = T extends Deferred<infer U> ? U : never;
|
package/tools/Deferred.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VoidDeferred = exports.Deferred = void 0;
|
|
4
|
-
const tsafe_1 = require("../vendor/frontend/tsafe");
|
|
5
4
|
class Deferred {
|
|
6
5
|
constructor() {
|
|
7
|
-
this.isPending = true;
|
|
8
6
|
let resolve;
|
|
9
7
|
let reject;
|
|
10
8
|
this.pr = new Promise((resolve_, reject_) => {
|
|
11
9
|
resolve = value => {
|
|
12
|
-
(0, tsafe_1.overwriteReadonlyProp)(this, "isPending", false);
|
|
13
10
|
resolve_(value);
|
|
14
11
|
};
|
|
15
12
|
reject = error => {
|
|
16
|
-
(0, tsafe_1.overwriteReadonlyProp)(this, "isPending", false);
|
|
17
13
|
reject_(error);
|
|
18
14
|
};
|
|
19
15
|
});
|
package/tools/Deferred.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deferred.js","sourceRoot":"","sources":["../../src/tools/Deferred.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Deferred.js","sourceRoot":"","sources":["../../src/tools/Deferred.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAQ;IAOjB;QACI,IAAI,OAA4B,CAAC;QACjC,IAAI,MAA6B,CAAC;QAElC,IAAI,CAAC,EAAE,GAAG,IAAI,OAAO,CAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;YAC3C,OAAO,GAAG,KAAK,CAAC,EAAE;gBACd,QAAQ,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC,CAAC;YAEF,MAAM,GAAG,KAAK,CAAC,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,CAAC;YACnB,CAAC,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAxBD,4BAwBC;AAMD,MAAa,YAAa,SAAQ,QAAmB;CAEpD;AAFD,oCAEC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { id } from "tsafe/id";
|
|
2
2
|
export { assert, is, type Equals } from "tsafe/assert";
|
|
3
3
|
export { typeGuard } from "tsafe/typeGuard";
|
|
4
|
-
export { overwriteReadonlyProp } from "tsafe/lab/overwriteReadonlyProp";
|
|
5
4
|
export { noUndefined } from "tsafe/noUndefined";
|
|
6
5
|
export type { Param0 } from "tsafe";
|
|
7
6
|
export { isAmong } from "tsafe/isAmong";
|
package/vendor/frontend/tsafe.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{"use strict";var e={720:function(e,r,t){var n,o=this&&this.__extends||(n=function(e,r){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},n(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}n(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}),i=this&&this.__read||function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),u=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u};Object.defineProperty(r,"__esModule",{value:!0}),r.AssertionError=void 0,r.assert=function(e,r){if(0===arguments.length&&(e=!0),void 0===c){if(!e)throw new a("function"==typeof r?r():r)}else c=void 0},r.is=function(e){var r={};if(void 0!==c)throw c=void 0,new Error(f);return c=r,Promise.resolve().then((function(){if(c===r)throw new Error(f)})),null};var u=t(522),a=function(e){function r(r){var t=this.constructor,n=e.call(this,"Wrong assertion encountered"+(r?': "'.concat(r,'"'):""))||this;if(n.originalMessage=r,Object.setPrototypeOf(n,t.prototype),!n.stack)return n;try{(0,u.overwriteReadonlyProp)(n,"stack",n.stack.split("\n").filter((function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var t=i(e,2)[1];return 1!==t&&2!==t})).join("\n"))}catch(e){}return n}return o(r,e),r}(Error);r.AssertionError=a;var c=void 0,f="Wrong usage of the `is` function refer to https://docs.tsafe.dev/is"},135:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.id=void 0,r.id=function(e){return e}},952:function(e,r){var t=this&&this.__values||function(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0}),r.isAmong=function(e,r){var n,o;try{for(var i=t(e),u=i.next();!u.done;u=i.next())if(u.value===r)return!0}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return!1}},522:function(e,r){var t=this&&this.__assign||function(){return t=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},t.apply(this,arguments)};Object.defineProperty(r,"__esModule",{value:!0}),r.overwriteReadonlyProp=void 0,r.overwriteReadonlyProp=function(e,r,n){try{e[r]=n}catch(e){}if(e[r]===n)return n;var o=void 0,i=Object.getOwnPropertyDescriptor(e,r)||{enumerable:!0,configurable:!0};if(i.get)throw new Error("Probably a wrong ides to overwrite ".concat(String(r)," getter"));try{Object.defineProperty(e,r,t(t({},i),{value:n}))}catch(e){o=e}if(e[r]!==n)throw o||new Error("Can't assign");return n}},505:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.noUndefined=function(e){var r={};for(var t in e)void 0!==e[t]&&(r[t]=e[t]);return r}},497:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.typeGuard=function(e,r){return r}}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}var n={};(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.isAmong=e.noUndefined=e.
|
|
1
|
+
(()=>{"use strict";var e={720:function(e,r,t){var n,o=this&&this.__extends||(n=function(e,r){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},n(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}n(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}),i=this&&this.__read||function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),u=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u};Object.defineProperty(r,"__esModule",{value:!0}),r.AssertionError=void 0,r.assert=function(e,r){if(0===arguments.length&&(e=!0),void 0===c){if(!e)throw new a("function"==typeof r?r():r)}else c=void 0},r.is=function(e){var r={};if(void 0!==c)throw c=void 0,new Error(f);return c=r,Promise.resolve().then((function(){if(c===r)throw new Error(f)})),null};var u=t(522),a=function(e){function r(r){var t=this.constructor,n=e.call(this,"Wrong assertion encountered"+(r?': "'.concat(r,'"'):""))||this;if(n.originalMessage=r,Object.setPrototypeOf(n,t.prototype),!n.stack)return n;try{(0,u.overwriteReadonlyProp)(n,"stack",n.stack.split("\n").filter((function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var t=i(e,2)[1];return 1!==t&&2!==t})).join("\n"))}catch(e){}return n}return o(r,e),r}(Error);r.AssertionError=a;var c=void 0,f="Wrong usage of the `is` function refer to https://docs.tsafe.dev/is"},135:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.id=void 0,r.id=function(e){return e}},952:function(e,r){var t=this&&this.__values||function(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0}),r.isAmong=function(e,r){var n,o;try{for(var i=t(e),u=i.next();!u.done;u=i.next())if(u.value===r)return!0}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return!1}},522:function(e,r){var t=this&&this.__assign||function(){return t=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},t.apply(this,arguments)};Object.defineProperty(r,"__esModule",{value:!0}),r.overwriteReadonlyProp=void 0,r.overwriteReadonlyProp=function(e,r,n){try{e[r]=n}catch(e){}if(e[r]===n)return n;var o=void 0,i=Object.getOwnPropertyDescriptor(e,r)||{enumerable:!0,configurable:!0};if(i.get)throw new Error("Probably a wrong ides to overwrite ".concat(String(r)," getter"));try{Object.defineProperty(e,r,t(t({},i),{value:n}))}catch(e){o=e}if(e[r]!==n)throw o||new Error("Can't assign");return n}},505:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.noUndefined=function(e){var r={};for(var t in e)void 0!==e[t]&&(r[t]=e[t]);return r}},497:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.typeGuard=function(e,r){return r}}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}var n={};(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.isAmong=e.noUndefined=e.typeGuard=e.is=e.assert=e.id=void 0;var r=t(135);Object.defineProperty(e,"id",{enumerable:!0,get:function(){return r.id}});var o=t(720);Object.defineProperty(e,"assert",{enumerable:!0,get:function(){return o.assert}}),Object.defineProperty(e,"is",{enumerable:!0,get:function(){return o.is}});var i=t(497);Object.defineProperty(e,"typeGuard",{enumerable:!0,get:function(){return i.typeGuard}});var u=t(505);Object.defineProperty(e,"noUndefined",{enumerable:!0,get:function(){return u.noUndefined}});var a=t(952);Object.defineProperty(e,"isAmong",{enumerable:!0,get:function(){return a.isAmong}})})(),module.exports=n})();
|
|
2
2
|
exports.__oidcSpaBundle = true;
|