@mongodb-js/oidc-plugin 1.1.8 → 2.0.0
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/dist/api.d.ts +12 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +3 -3
- package/dist/api.js.map +1 -1
- package/dist/log-hook.js +32 -33
- package/dist/log-hook.js.map +1 -1
- package/dist/plugin.d.ts +7 -7
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +187 -149
- package/dist/plugin.js.map +1 -1
- package/dist/rfc-8252-http-server.d.ts.map +1 -1
- package/dist/rfc-8252-http-server.js +165 -150
- package/dist/rfc-8252-http-server.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -6
- package/dist/types.js.map +1 -1
- package/dist/util.d.ts +39 -4
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +85 -30
- package/dist/util.js.map +1 -1
- package/index.d.ts +15 -4
- package/package.json +18 -16
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA+MA,gBAAgB;AAChB,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;AAC/E,cAAc;AACd,MAAa,gBAAiB,SAAQ,KAAK;IACzC,gBAAgB;IACR,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAyB;IAEjD,YACE,OAAe,EACf,EAAE,KAAK,EAAE,QAAQ,EAAyC;QAE1D,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,cAAc,QAAQ,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,KAAc;QACtC,OAAO;QACL,8DAA8D;QAC9D,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAK,KAAa,CAAC,mBAAmB,CAAC,CAC1E,CAAC;IACJ,CAAC;CACF;AAnBD,4CAmBC"}
|
package/dist/util.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { TokenSet } from 'openid-client';
|
|
1
|
+
import type { IDToken, JsonValue, TokenEndpointResponse, TokenEndpointResponseHelpers } from 'openid-client';
|
|
3
2
|
import type { OIDCAbortSignal } from './types';
|
|
4
3
|
export declare function throwIfAborted(signal?: OIDCAbortSignal): void;
|
|
5
4
|
interface AbortCheckArgs {
|
|
@@ -11,9 +10,45 @@ export declare function errorString(err: unknown): string;
|
|
|
11
10
|
export declare function timeoutSignal(ms: number): AbortSignal;
|
|
12
11
|
export declare function withLock<T extends (...args: any[]) => Promise<any>>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
|
|
13
12
|
export declare function normalizeObject<T extends object>(obj: T): T;
|
|
14
|
-
export declare function validateSecureHTTPUrl(url:
|
|
13
|
+
export declare function validateSecureHTTPUrl(url: string | URL | undefined | null | JsonValue, diagnosticId: string): 'http-allowed' | 'http-disallowed';
|
|
15
14
|
export declare function messageFromError(err: unknown): string;
|
|
16
15
|
export declare function getRefreshTokenId(token: string | null | undefined): string | null;
|
|
17
|
-
export declare
|
|
16
|
+
export declare class TokenSet {
|
|
17
|
+
private readonly response;
|
|
18
|
+
readonly expiresAt: number | undefined;
|
|
19
|
+
constructor(response: TokenEndpointResponse & TokenEndpointResponseHelpers, expiresAt?: number | undefined);
|
|
20
|
+
get refreshToken(): string | undefined;
|
|
21
|
+
get accessToken(): string | undefined;
|
|
22
|
+
get idToken(): string | undefined;
|
|
23
|
+
get idTokenClaims(): IDToken | undefined;
|
|
24
|
+
get tokenType(): TokenEndpointResponse['token_type'];
|
|
25
|
+
serialize(): {
|
|
26
|
+
claims: {
|
|
27
|
+
[claim: string]: JsonValue | undefined;
|
|
28
|
+
iss: string;
|
|
29
|
+
sub: string;
|
|
30
|
+
aud: string | string[];
|
|
31
|
+
iat: number;
|
|
32
|
+
exp: number;
|
|
33
|
+
nonce?: string;
|
|
34
|
+
auth_time?: number;
|
|
35
|
+
azp?: string;
|
|
36
|
+
jti?: string;
|
|
37
|
+
nbf?: number;
|
|
38
|
+
cnf?: import("oauth4webapi").ConfirmationClaims;
|
|
39
|
+
} | undefined;
|
|
40
|
+
expiresAt: number | undefined;
|
|
41
|
+
expiresIn: undefined;
|
|
42
|
+
access_token: string;
|
|
43
|
+
expires_in?: number;
|
|
44
|
+
id_token?: string;
|
|
45
|
+
refresh_token?: string;
|
|
46
|
+
scope?: string;
|
|
47
|
+
authorization_details?: import("oauth4webapi").AuthorizationDetails[];
|
|
48
|
+
token_type: "bearer" | "dpop" | Lowercase<string>;
|
|
49
|
+
};
|
|
50
|
+
static fromSerialized(serialized: ReturnType<(typeof TokenSet.prototype)['serialize']>): TokenSet;
|
|
51
|
+
stableId(): string;
|
|
52
|
+
}
|
|
18
53
|
export {};
|
|
19
54
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,qBAAqB,EACrB,4BAA4B,EAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAS/C,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,CAE7D;AAED,UAAU,cAAc;IACtB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,CA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,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED,IAAI,aAAa,IAAI,OAAO,GAAG,SAAS,CAEvC;IAED,IAAI,SAAS,IAAI,qBAAqB,CAAC,YAAY,CAAC,CAEnD;IAID,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;IAaT,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,UAAU,CAAC,CAAC,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,GAC/D,QAAQ;IAcX,QAAQ,IAAI,MAAM;CAcnB"}
|
package/dist/util.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TokenSet = void 0;
|
|
4
|
+
exports.throwIfAborted = throwIfAborted;
|
|
5
|
+
exports.withAbortCheck = withAbortCheck;
|
|
6
|
+
exports.errorString = errorString;
|
|
7
|
+
exports.timeoutSignal = timeoutSignal;
|
|
8
|
+
exports.withLock = withLock;
|
|
9
|
+
exports.normalizeObject = normalizeObject;
|
|
10
|
+
exports.validateSecureHTTPUrl = validateSecureHTTPUrl;
|
|
11
|
+
exports.messageFromError = messageFromError;
|
|
12
|
+
exports.getRefreshTokenId = getRefreshTokenId;
|
|
4
13
|
const crypto_1 = require("crypto");
|
|
5
14
|
class AbortError extends Error {
|
|
6
15
|
constructor() {
|
|
@@ -11,7 +20,6 @@ function throwIfAborted(signal) {
|
|
|
11
20
|
if (signal?.aborted)
|
|
12
21
|
throw signal.reason ?? new AbortError();
|
|
13
22
|
}
|
|
14
|
-
exports.throwIfAborted = throwIfAborted;
|
|
15
23
|
async function withAbortCheck(signal, fn) {
|
|
16
24
|
const signalCheck = () => throwIfAborted(signal);
|
|
17
25
|
let reject;
|
|
@@ -33,18 +41,15 @@ async function withAbortCheck(signal, fn) {
|
|
|
33
41
|
signal?.removeEventListener('abort', listener);
|
|
34
42
|
}
|
|
35
43
|
}
|
|
36
|
-
exports.withAbortCheck = withAbortCheck;
|
|
37
44
|
function errorString(err) {
|
|
38
45
|
return String(typeof err === 'object' && err && 'message' in err ? err.message : err);
|
|
39
46
|
}
|
|
40
|
-
exports.errorString = errorString;
|
|
41
47
|
// AbortSignal.timeout, but consistently .unref()ed
|
|
42
48
|
function timeoutSignal(ms) {
|
|
43
49
|
const controller = new AbortController();
|
|
44
50
|
setTimeout(() => controller.abort(), ms).unref();
|
|
45
51
|
return controller.signal;
|
|
46
52
|
}
|
|
47
|
-
exports.timeoutSignal = timeoutSignal;
|
|
48
53
|
// Ensure that only one call to the target `fn` is active at a time.
|
|
49
54
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
55
|
function withLock(fn) {
|
|
@@ -62,30 +67,32 @@ function withLock(fn) {
|
|
|
62
67
|
return result;
|
|
63
68
|
};
|
|
64
69
|
}
|
|
65
|
-
exports.withLock = withLock;
|
|
66
70
|
// Normalize JS objects by sorting keys so that {a:1,b:2} and {b:2,a:1} are equivalent.
|
|
67
71
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
68
72
|
function normalizeObject(obj) {
|
|
69
73
|
return Object.fromEntries(Object.entries(obj).sort());
|
|
70
74
|
}
|
|
71
|
-
|
|
75
|
+
function isURL(url) {
|
|
76
|
+
return Object.prototype.toString.call(url).toLowerCase() === '[object url]';
|
|
77
|
+
}
|
|
72
78
|
// Throws if the url does not refer to an https: endpoint or a local endpoint, or null or undefined.
|
|
73
79
|
function validateSecureHTTPUrl(url, diagnosticId) {
|
|
74
80
|
try {
|
|
75
81
|
// eslint-disable-next-line eqeqeq
|
|
76
82
|
if (url == null)
|
|
77
|
-
return;
|
|
78
|
-
if (typeof url !== 'string')
|
|
79
|
-
throw new Error(`Expected string, got ${typeof url} instead`);
|
|
80
|
-
const parsed = new URL(url);
|
|
83
|
+
return 'http-disallowed';
|
|
84
|
+
if (typeof url !== 'string' && !isURL(url))
|
|
85
|
+
throw new Error(`Expected string or URL object, got ${typeof url} instead`);
|
|
86
|
+
const parsed = isURL(url) ? url : new URL(url);
|
|
81
87
|
if (parsed.protocol === 'https:')
|
|
82
|
-
return;
|
|
88
|
+
return 'http-disallowed';
|
|
83
89
|
if (parsed.protocol !== 'http:') {
|
|
84
|
-
throw new Error(`Unknown protocol '${parsed.protocol}' '${url}'`);
|
|
90
|
+
throw new Error(`Unknown protocol '${parsed.protocol}' '${String(url)}'`);
|
|
85
91
|
}
|
|
86
92
|
if (!/^(\[::1\]|127(\.\d+){3}|localhost)$/.test(parsed.hostname)) {
|
|
87
|
-
throw new Error(`Need to specify https: when accessing non-local URL '${url}'`);
|
|
93
|
+
throw new Error(`Need to specify https: when accessing non-local URL '${String(url)}'`);
|
|
88
94
|
}
|
|
95
|
+
return 'http-allowed';
|
|
89
96
|
}
|
|
90
97
|
catch (err) {
|
|
91
98
|
if (!err ||
|
|
@@ -98,7 +105,6 @@ function validateSecureHTTPUrl(url, diagnosticId) {
|
|
|
98
105
|
throw err;
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
|
-
exports.validateSecureHTTPUrl = validateSecureHTTPUrl;
|
|
102
108
|
function messageFromError(err) {
|
|
103
109
|
return String(err &&
|
|
104
110
|
typeof err === 'object' &&
|
|
@@ -107,7 +113,6 @@ function messageFromError(err) {
|
|
|
107
113
|
? err.message
|
|
108
114
|
: err);
|
|
109
115
|
}
|
|
110
|
-
exports.messageFromError = messageFromError;
|
|
111
116
|
const salt = (0, crypto_1.randomBytes)(16);
|
|
112
117
|
function getRefreshTokenId(token) {
|
|
113
118
|
if (!token)
|
|
@@ -116,19 +121,69 @@ function getRefreshTokenId(token) {
|
|
|
116
121
|
// that might unnecessarily worry users
|
|
117
122
|
return ('debugid:' + (0, crypto_1.createHash)('sha256').update(salt).update(token).digest('hex'));
|
|
118
123
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
class TokenSet {
|
|
125
|
+
response;
|
|
126
|
+
expiresAt;
|
|
127
|
+
constructor(response, expiresAt) {
|
|
128
|
+
this.response = response;
|
|
129
|
+
this.expiresAt =
|
|
130
|
+
expiresAt ??
|
|
131
|
+
(() => {
|
|
132
|
+
const expiresIn = this.response.expiresIn();
|
|
133
|
+
return expiresIn
|
|
134
|
+
? Math.floor(Date.now() / 1000) + expiresIn
|
|
135
|
+
: undefined;
|
|
136
|
+
})();
|
|
137
|
+
}
|
|
138
|
+
get refreshToken() {
|
|
139
|
+
return this.response.refresh_token;
|
|
140
|
+
}
|
|
141
|
+
get accessToken() {
|
|
142
|
+
return this.response.access_token;
|
|
143
|
+
}
|
|
144
|
+
get idToken() {
|
|
145
|
+
return this.response.id_token;
|
|
146
|
+
}
|
|
147
|
+
get idTokenClaims() {
|
|
148
|
+
return this.response.claims();
|
|
149
|
+
}
|
|
150
|
+
get tokenType() {
|
|
151
|
+
return this.response.token_type;
|
|
152
|
+
}
|
|
153
|
+
// Explicitly expressing the return type of this function is a bit awkward,
|
|
154
|
+
// and since it is only consumed by `fromSerialized`, it's fine to leave it inferred.
|
|
155
|
+
serialize() {
|
|
156
|
+
const expiresIn = this.response.expiresIn();
|
|
157
|
+
const claims = this.response.claims();
|
|
158
|
+
return {
|
|
159
|
+
...this.response,
|
|
160
|
+
claims: claims ? { ...claims } : undefined,
|
|
161
|
+
expiresAt: this.expiresAt ??
|
|
162
|
+
(expiresIn ? Math.floor(Date.now() / 1000) + expiresIn : undefined),
|
|
163
|
+
expiresIn: undefined,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
static fromSerialized(serialized) {
|
|
167
|
+
const helpers = {
|
|
168
|
+
claims: () => serialized.claims,
|
|
169
|
+
expiresIn: () => serialized.expiresAt &&
|
|
170
|
+
Math.max(0, serialized.expiresAt - Math.floor(Date.now() / 1000)),
|
|
171
|
+
};
|
|
172
|
+
return new this(Object.assign({ ...serialized }, helpers), serialized.expiresAt);
|
|
173
|
+
}
|
|
174
|
+
// Identify a token set based on a hash of its contents
|
|
175
|
+
stableId() {
|
|
176
|
+
const { access_token, id_token, refresh_token, token_type } = this.response;
|
|
177
|
+
return (0, crypto_1.createHash)('sha256')
|
|
178
|
+
.update(JSON.stringify({
|
|
179
|
+
access_token,
|
|
180
|
+
id_token,
|
|
181
|
+
refresh_token,
|
|
182
|
+
token_type,
|
|
183
|
+
expires_at: this.expiresAt,
|
|
184
|
+
}))
|
|
185
|
+
.digest('hex');
|
|
186
|
+
}
|
|
132
187
|
}
|
|
133
|
-
exports.
|
|
188
|
+
exports.TokenSet = TokenSet;
|
|
134
189
|
//# sourceMappingURL=util.js.map
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAeA,wCAEC;AAMD,wCAuBC;AAED,kCAIC;AAGD,sCAIC;AAID,4BAgBC;AAID,0CAEC;AAOD,sDAkCC;AAED,4CASC;AAGD,8CASC;AA9ID,mCAAiD;AAEjD,MAAM,UAAW,SAAQ,KAAK;IAC5B;QACE,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACrC,CAAC;CACF;AAED,SAAgB,cAAc,CAAC,MAAwB;IACrD,IAAI,MAAM,EAAE,OAAO;QAAE,MAAM,MAAM,CAAC,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;AAC/D,CAAC;AAMM,KAAK,UAAU,cAAc,CAGlC,MAAmC,EAAE,EAAK;IAC1C,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACjD,IAAI,MAA8B,CAAC;IACnC,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AC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;YACrE,SAAS,EAAE,SAAS;SACrB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,cAAc,CACnB,UAAgE;QAEhE,MAAM,OAAO,GAAiC;YAC5C,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM;YAC/B,SAAS,EAAE,GAAG,EAAE,CACd,UAAU,CAAC,SAAS;gBACpB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;SACpE,CAAC;QACF,OAAO,IAAI,IAAI,CACb,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,OAAO,CAAC,EACzC,UAAU,CAAC,SAAS,CACrB,CAAC;IACJ,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC5E,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC;aACxB,MAAM,CACL,IAAI,CAAC,SAAS,CAAC;YACb,YAAY;YACZ,QAAQ;YACR,aAAa;YACb,UAAU;YACV,UAAU,EAAE,IAAI,CAAC,SAAS;SAC3B,CAAC,CACH;aACA,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;CACF;AArFD,4BAqFC"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
|
|
3
1
|
import type { IncomingMessage } from 'http';
|
|
4
2
|
import type { RequestOptions } from 'https';
|
|
5
3
|
import type { ServerResponse } from 'http';
|
|
@@ -48,7 +46,10 @@ export declare interface DeviceFlowInformation {
|
|
|
48
46
|
*/
|
|
49
47
|
export declare function hookLoggerToMongoLogWriter(emitter: TypedEventEmitter<MongoDBOIDCLogEventsMap>, log: MongoLogWriter, contextPrefix: string): void;
|
|
50
48
|
|
|
51
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
* @deprecated Use a custom `fetch` function instead
|
|
52
|
+
*/
|
|
52
53
|
export declare type HttpOptions = Partial<Pick<RequestOptions, 'agent' | 'ca' | 'cert' | 'crl' | 'headers' | 'key' | 'lookup' | 'passphrase' | 'pfx' | 'timeout'>>;
|
|
53
54
|
|
|
54
55
|
/**
|
|
@@ -74,8 +75,10 @@ export declare interface IdPServerResponse {
|
|
|
74
75
|
/** @public */
|
|
75
76
|
export declare class MongoDBOIDCError extends Error {
|
|
76
77
|
/* Excluded from this release type: [MongoDBOIDCErrorTag] */
|
|
77
|
-
|
|
78
|
+
readonly codeName: `MongoDBOIDC${string}`;
|
|
79
|
+
constructor(message: string, { cause, codeName }: {
|
|
78
80
|
cause?: unknown;
|
|
81
|
+
codeName: string;
|
|
79
82
|
});
|
|
80
83
|
static isMongoDBOIDCError(value: unknown): value is MongoDBOIDCError;
|
|
81
84
|
}
|
|
@@ -367,8 +370,16 @@ export declare interface MongoDBOIDCPluginOptions {
|
|
|
367
370
|
throwOnIncompatibleSerializedState?: boolean;
|
|
368
371
|
/**
|
|
369
372
|
* Provide custom HTTP options for individual HTTP calls.
|
|
373
|
+
*
|
|
374
|
+
* @deprecated Use a custom `fetch` function instead.
|
|
370
375
|
*/
|
|
371
376
|
customHttpOptions?: HttpOptions | ((url: string, options: Readonly<HttpOptions>) => HttpOptions);
|
|
377
|
+
/**
|
|
378
|
+
* Provide a custom `fetch` function to be used for HTTP calls.
|
|
379
|
+
*
|
|
380
|
+
* Any API that is compatible with the web `fetch` API can be used here.
|
|
381
|
+
*/
|
|
382
|
+
customFetch?: (url: string, options: Readonly<unknown>) => Promise<Response>;
|
|
372
383
|
/**
|
|
373
384
|
* Pass ID tokens in place of access tokens. For debugging/working around
|
|
374
385
|
* broken identity providers.
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"email": "compass@mongodb.com"
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/mongodb-js/oidc-plugin",
|
|
16
|
-
"version": "
|
|
16
|
+
"version": "2.0.0",
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
19
|
"url": "https://github.com/mongodb-js/oidc-plugin.git"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"import": "./dist/.esm-wrapper.mjs"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
33
|
+
"node": ">= 20.19.2"
|
|
34
34
|
},
|
|
35
35
|
"types": "./index.d.ts",
|
|
36
36
|
"scripts": {
|
|
@@ -53,43 +53,45 @@
|
|
|
53
53
|
"precommit": "precommit"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@microsoft/api-extractor": "^7.
|
|
56
|
+
"@microsoft/api-extractor": "^7.52.8",
|
|
57
57
|
"@mongodb-js/eslint-config-devtools": "^0.9.9",
|
|
58
58
|
"@mongodb-js/mocha-config-devtools": "^1.0.0",
|
|
59
59
|
"@mongodb-js/monorepo-tools": "^1.1.4",
|
|
60
|
-
"@mongodb-js/oidc-mock-provider": "^0.
|
|
60
|
+
"@mongodb-js/oidc-mock-provider": "^0.11.3",
|
|
61
61
|
"@mongodb-js/prettier-config-devtools": "^1.0.1",
|
|
62
62
|
"@mongodb-js/tsconfig-devtools": "^1.0.0",
|
|
63
63
|
"@types/chai": "^4.2.21",
|
|
64
|
-
"@types/
|
|
64
|
+
"@types/electron-to-chromium": "^1.5.0",
|
|
65
|
+
"@types/express": "^5.0.3",
|
|
65
66
|
"@types/mocha": "^10.0.2",
|
|
66
|
-
"@types/node": "^
|
|
67
|
+
"@types/node": "^20.14.8",
|
|
67
68
|
"@types/oidc-provider": "^8.1.1",
|
|
68
69
|
"@types/sinon-chai": "^3.2.5",
|
|
69
70
|
"chai": "^4.3.6",
|
|
70
71
|
"depcheck": "^1.4.1",
|
|
71
|
-
"electron": "^
|
|
72
|
-
"electron-mocha": "^
|
|
72
|
+
"electron": "^36.5.0",
|
|
73
|
+
"electron-mocha": "^13.1.0",
|
|
74
|
+
"electron-to-chromium": "^1.5.170",
|
|
73
75
|
"eslint": "^7.25.0",
|
|
74
76
|
"gen-esm-wrapper": "^1.1.0",
|
|
75
77
|
"husky": "^8.0.3",
|
|
76
|
-
"mocha": "^
|
|
78
|
+
"mocha": "^11.7.1",
|
|
77
79
|
"mongodb": "^6.7.0",
|
|
78
80
|
"mongodb-log-writer": "^2.1.0",
|
|
79
81
|
"mongodb-runner": "^5.2.0",
|
|
80
|
-
"node-fetch": "^3.3.1",
|
|
81
82
|
"nyc": "^15.1.0",
|
|
82
83
|
"oidc-provider": "https://github.com/panva/node-oidc-provider/archive/refs/tags/v7.14.3.tar.gz",
|
|
83
|
-
"prettier": "2.
|
|
84
|
+
"prettier": "^2.7.1",
|
|
84
85
|
"rimraf": "^5.0.0",
|
|
85
86
|
"sinon": "^15.0.3",
|
|
86
|
-
"typescript": "^5.
|
|
87
|
-
"webdriverio": "^
|
|
87
|
+
"typescript": "^5.8.3",
|
|
88
|
+
"webdriverio": "^9.15.0",
|
|
88
89
|
"xvfb-maybe": "^0.2.1"
|
|
89
90
|
},
|
|
90
91
|
"dependencies": {
|
|
91
|
-
"express": "^
|
|
92
|
-
"
|
|
93
|
-
"
|
|
92
|
+
"express": "^5.1.0",
|
|
93
|
+
"node-fetch": "^3.3.2",
|
|
94
|
+
"open": "^10.1.2",
|
|
95
|
+
"openid-client": "^6.5.1"
|
|
94
96
|
}
|
|
95
97
|
}
|