@miguelmorales13/nestkit 0.25.0 → 0.26.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/README.md +5 -0
- package/dist/auth/index.cjs +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/oauth/index.cjs +23 -15
- package/dist/auth/oauth/index.js +23 -15
- package/dist/auth/oauth/oauth-provider.d.ts +9 -0
- package/dist/auth/oauth/providers/apple.d.ts +3 -1
- package/dist/bootstrap/index.cjs +4 -4
- package/dist/bootstrap/index.js +3 -3
- package/dist/{chunk-FNUZGYUF.cjs → chunk-ALIKVFOV.cjs} +2 -2
- package/dist/{chunk-UNEVXCFW.js → chunk-PFHHLB7B.js} +1 -1
- package/dist/errors/index.cjs +5 -5
- package/dist/errors/index.js +4 -4
- package/dist/index.cjs +17 -17
- package/dist/index.js +19 -19
- package/package.json +1 -1
- package/dist/{chunk-A2DGK4ZL.js → chunk-2DUEQKOI.js} +3 -3
- package/dist/{chunk-MSTXS3MU.cjs → chunk-LSDY6ETG.cjs} +3 -3
package/README.md
CHANGED
|
@@ -1415,6 +1415,11 @@ subidos por la persona, que necesitan un permiso que la app no tiene, y el callb
|
|
|
1415
1415
|
500. El flujo entero son unas cuarenta líneas de `fetch` y cada campo que se manda se ve en
|
|
1416
1416
|
`oauth-provider.ts`.
|
|
1417
1417
|
|
|
1418
|
+
**Red inyectable (0.26.0, opcional).** Todo proveedor acepta `fetchImpl?: typeof fetch` en sus credenciales
|
|
1419
|
+
(`googleProvider({ fetchImpl })`, etc.): lo usa para el canje del `code` por el token y para leer el perfil
|
|
1420
|
+
(Apple, también para sus llaves públicas). Sirve para pasar por un cliente con tiempo límite, reintentos y
|
|
1421
|
+
alertas. Sin la opción se usa el `fetch` global, igual que antes.
|
|
1422
|
+
|
|
1418
1423
|
Un proveedor es un objeto, no una clase que heredar: vienen ocho —`googleProvider`,
|
|
1419
1424
|
`appleProvider`, `facebookProvider`, `tiktokProvider`, `githubProvider`, `microsoftProvider`,
|
|
1420
1425
|
`discordProvider`, `linkedinProvider`— y uno nuevo es declarar cuatro URLs y una función que mapee su
|
package/dist/auth/index.cjs
CHANGED
|
@@ -8,8 +8,8 @@ var _chunkFH5UNWWWcjs = require('../chunk-FH5UNWWW.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkHDFPSA2Vcjs = require('../chunk-HDFPSA2V.cjs');
|
|
11
|
-
require('../chunk-SDWHKPXI.cjs');
|
|
12
11
|
require('../chunk-Q5Y33L7B.cjs');
|
|
12
|
+
require('../chunk-SDWHKPXI.cjs');
|
|
13
13
|
require('../chunk-PNK5WMPP.cjs');
|
|
14
14
|
|
|
15
15
|
|
package/dist/auth/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
ForbiddenAppException,
|
|
9
9
|
UnauthorizedAppException
|
|
10
10
|
} from "../chunk-ZFIDAX7K.js";
|
|
11
|
-
import "../chunk-ETRUVZTJ.js";
|
|
12
11
|
import "../chunk-M3GQDRWR.js";
|
|
12
|
+
import "../chunk-ETRUVZTJ.js";
|
|
13
13
|
import "../chunk-VVMRZEIW.js";
|
|
14
14
|
import {
|
|
15
15
|
__decorateClass,
|
|
@@ -7,8 +7,8 @@ var _chunkFH5UNWWWcjs = require('../../chunk-FH5UNWWW.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkHDFPSA2Vcjs = require('../../chunk-HDFPSA2V.cjs');
|
|
10
|
-
require('../../chunk-SDWHKPXI.cjs');
|
|
11
10
|
require('../../chunk-Q5Y33L7B.cjs');
|
|
11
|
+
require('../../chunk-SDWHKPXI.cjs');
|
|
12
12
|
require('../../chunk-PNK5WMPP.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
@@ -32,6 +32,7 @@ async function readJson(response, what) {
|
|
|
32
32
|
function googleProvider(credentials = {}) {
|
|
33
33
|
return {
|
|
34
34
|
name: "google",
|
|
35
|
+
fetchImpl: credentials.fetchImpl,
|
|
35
36
|
clientId: _nullishCoalesce(credentials.clientId, () => ( process.env.GOOGLE_CLIENT_ID)),
|
|
36
37
|
clientSecret: _nullishCoalesce(credentials.clientSecret, () => ( process.env.GOOGLE_CLIENT_SECRET)),
|
|
37
38
|
callbackUrl: _nullishCoalesce(credentials.callbackUrl, () => ( process.env.GOOGLE_CALLBACK_URL)),
|
|
@@ -47,7 +48,7 @@ function googleProvider(credentials = {}) {
|
|
|
47
48
|
},
|
|
48
49
|
async fetchProfile(accessToken) {
|
|
49
50
|
const data = await readJson(
|
|
50
|
-
await fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
|
|
51
|
+
await (_nullishCoalesce(credentials.fetchImpl, () => ( fetch)))("https://www.googleapis.com/oauth2/v3/userinfo", {
|
|
51
52
|
headers: { Authorization: `Bearer ${accessToken}` }
|
|
52
53
|
}),
|
|
53
54
|
"Google userinfo"
|
|
@@ -69,6 +70,7 @@ function facebookProvider(credentials = {}) {
|
|
|
69
70
|
const version = _nullishCoalesce(process.env.FACEBOOK_GRAPH_VERSION, () => ( "v21.0"));
|
|
70
71
|
return {
|
|
71
72
|
name: "facebook",
|
|
73
|
+
fetchImpl: credentials.fetchImpl,
|
|
72
74
|
clientId: _nullishCoalesce(credentials.clientId, () => ( process.env.FACEBOOK_APP_ID)),
|
|
73
75
|
clientSecret: _nullishCoalesce(credentials.clientSecret, () => ( process.env.FACEBOOK_APP_SECRET)),
|
|
74
76
|
callbackUrl: _nullishCoalesce(credentials.callbackUrl, () => ( process.env.FACEBOOK_CALLBACK_URL)),
|
|
@@ -79,7 +81,7 @@ function facebookProvider(credentials = {}) {
|
|
|
79
81
|
const url = new URL(`https://graph.facebook.com/${version}/me`);
|
|
80
82
|
url.searchParams.set("fields", "id,name,email,picture.type(large)");
|
|
81
83
|
const data = await readJson(
|
|
82
|
-
await fetch(url, { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
84
|
+
await (_nullishCoalesce(credentials.fetchImpl, () => ( fetch)))(url, { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
83
85
|
"Facebook me"
|
|
84
86
|
);
|
|
85
87
|
const picture = data.picture;
|
|
@@ -113,7 +115,7 @@ async function exchangeCode(provider, code) {
|
|
|
113
115
|
code
|
|
114
116
|
});
|
|
115
117
|
const data = await readJson(
|
|
116
|
-
await fetch(provider.tokenUrl, {
|
|
118
|
+
await (_nullishCoalesce(provider.fetchImpl, () => ( fetch)))(provider.tokenUrl, {
|
|
117
119
|
method: "POST",
|
|
118
120
|
headers: {
|
|
119
121
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
@@ -145,6 +147,7 @@ function appleProvider(credentials = {}) {
|
|
|
145
147
|
const configured = Boolean(clientId && teamId && keyId && privateKey);
|
|
146
148
|
return {
|
|
147
149
|
name: "apple",
|
|
150
|
+
fetchImpl: credentials.fetchImpl,
|
|
148
151
|
clientId,
|
|
149
152
|
// Only offered as configured when every piece exists: `provider()` tests
|
|
150
153
|
// `clientSecret` for truthiness, and a function that would throw later
|
|
@@ -158,7 +161,7 @@ function appleProvider(credentials = {}) {
|
|
|
158
161
|
callbackMethod: "POST",
|
|
159
162
|
async fetchProfile(_accessToken, tokens, callback) {
|
|
160
163
|
if (!tokens.id_token) throw new Error("Apple token exchange returned no id_token.");
|
|
161
|
-
const claims = await verifyAppleIdToken(tokens.id_token, clientId, keysUrl);
|
|
164
|
+
const claims = await verifyAppleIdToken(tokens.id_token, clientId, keysUrl, credentials.fetchImpl);
|
|
162
165
|
const verified = claims.email_verified === true || claims.email_verified === "true";
|
|
163
166
|
return {
|
|
164
167
|
providerAccountId: claims.sub,
|
|
@@ -180,17 +183,17 @@ function mintClientSecret(clientId, teamId, keyId, privateKey) {
|
|
|
180
183
|
}
|
|
181
184
|
var cachedKeys;
|
|
182
185
|
var KEYS_TTL_MS = 60 * 60 * 1e3;
|
|
183
|
-
async function appleKeys(keysUrl, kid) {
|
|
186
|
+
async function appleKeys(keysUrl, kid, fetchImpl) {
|
|
184
187
|
const fresh = cachedKeys && Date.now() - cachedKeys.fetchedAt < KEYS_TTL_MS;
|
|
185
188
|
if (fresh && cachedKeys.keys.some((k) => k.kid === kid)) return cachedKeys.keys;
|
|
186
|
-
const data = await readJson(await fetch(keysUrl), "Apple keys");
|
|
189
|
+
const data = await readJson(await (_nullishCoalesce(fetchImpl, () => ( fetch)))(keysUrl), "Apple keys");
|
|
187
190
|
cachedKeys = { fetchedAt: Date.now(), keys: _nullishCoalesce(data.keys, () => ( [])) };
|
|
188
191
|
return cachedKeys.keys;
|
|
189
192
|
}
|
|
190
|
-
async function verifyAppleIdToken(idToken, clientId, keysUrl = KEYS_URL) {
|
|
193
|
+
async function verifyAppleIdToken(idToken, clientId, keysUrl = KEYS_URL, fetchImpl) {
|
|
191
194
|
const decoded = _jsonwebtoken2.default.decode(idToken, { complete: true });
|
|
192
195
|
const kid = _optionalChain([decoded, 'optionalAccess', _5 => _5.header, 'access', _6 => _6.kid]);
|
|
193
|
-
const key = (await appleKeys(keysUrl, kid)).find((k) => k.kid === kid);
|
|
196
|
+
const key = (await appleKeys(keysUrl, kid, fetchImpl)).find((k) => k.kid === kid);
|
|
194
197
|
if (!key) throw new Error("Apple id_token is signed with a key Apple does not publish.");
|
|
195
198
|
const pem = _crypto.createPublicKey.call(void 0, { key, format: "jwk" }).export({ type: "spki", format: "pem" });
|
|
196
199
|
return _jsonwebtoken2.default.verify(idToken, pem, { algorithms: ["RS256"], audience: clientId, issuer: ISSUER });
|
|
@@ -211,6 +214,7 @@ function nameFromCallback(callback) {
|
|
|
211
214
|
function tiktokProvider(credentials = {}) {
|
|
212
215
|
return {
|
|
213
216
|
name: "tiktok",
|
|
217
|
+
fetchImpl: credentials.fetchImpl,
|
|
214
218
|
clientId: _nullishCoalesce(credentials.clientId, () => ( process.env.TIKTOK_CLIENT_KEY)),
|
|
215
219
|
clientSecret: _nullishCoalesce(credentials.clientSecret, () => ( process.env.TIKTOK_CLIENT_SECRET)),
|
|
216
220
|
callbackUrl: _nullishCoalesce(credentials.callbackUrl, () => ( process.env.TIKTOK_CALLBACK_URL)),
|
|
@@ -222,7 +226,7 @@ function tiktokProvider(credentials = {}) {
|
|
|
222
226
|
const url = new URL("https://open.tiktokapis.com/v2/user/info/");
|
|
223
227
|
url.searchParams.set("fields", "open_id,display_name,avatar_url");
|
|
224
228
|
const data = await readJson(
|
|
225
|
-
await fetch(url, { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
229
|
+
await (_nullishCoalesce(credentials.fetchImpl, () => ( fetch)))(url, { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
226
230
|
"TikTok user info"
|
|
227
231
|
);
|
|
228
232
|
const error = data.error;
|
|
@@ -243,6 +247,7 @@ function tiktokProvider(credentials = {}) {
|
|
|
243
247
|
function githubProvider(credentials = {}) {
|
|
244
248
|
return {
|
|
245
249
|
name: "github",
|
|
250
|
+
fetchImpl: credentials.fetchImpl,
|
|
246
251
|
clientId: _nullishCoalesce(credentials.clientId, () => ( process.env.GITHUB_CLIENT_ID)),
|
|
247
252
|
clientSecret: _nullishCoalesce(credentials.clientSecret, () => ( process.env.GITHUB_CLIENT_SECRET)),
|
|
248
253
|
callbackUrl: _nullishCoalesce(credentials.callbackUrl, () => ( process.env.GITHUB_CALLBACK_URL)),
|
|
@@ -255,9 +260,9 @@ function githubProvider(credentials = {}) {
|
|
|
255
260
|
Accept: "application/vnd.github+json",
|
|
256
261
|
"User-Agent": "nestkit"
|
|
257
262
|
};
|
|
258
|
-
const user = await readJson(await fetch("https://api.github.com/user", { headers }), "GitHub user");
|
|
263
|
+
const user = await readJson(await (_nullishCoalesce(credentials.fetchImpl, () => ( fetch)))("https://api.github.com/user", { headers }), "GitHub user");
|
|
259
264
|
const emails = await readJson(
|
|
260
|
-
await fetch("https://api.github.com/user/emails", { headers }),
|
|
265
|
+
await (_nullishCoalesce(credentials.fetchImpl, () => ( fetch)))("https://api.github.com/user/emails", { headers }),
|
|
261
266
|
"GitHub emails"
|
|
262
267
|
);
|
|
263
268
|
const primary = Array.isArray(emails) ? _nullishCoalesce(emails.find((e) => e.primary && e.verified), () => ( emails.find((e) => e.verified))) : void 0;
|
|
@@ -276,6 +281,7 @@ function microsoftProvider(credentials = {}) {
|
|
|
276
281
|
const tenant = _nullishCoalesce(_nullishCoalesce(credentials.tenant, () => ( process.env.MICROSOFT_TENANT)), () => ( "common"));
|
|
277
282
|
return {
|
|
278
283
|
name: "microsoft",
|
|
284
|
+
fetchImpl: credentials.fetchImpl,
|
|
279
285
|
clientId: _nullishCoalesce(credentials.clientId, () => ( process.env.MICROSOFT_CLIENT_ID)),
|
|
280
286
|
clientSecret: _nullishCoalesce(credentials.clientSecret, () => ( process.env.MICROSOFT_CLIENT_SECRET)),
|
|
281
287
|
callbackUrl: _nullishCoalesce(credentials.callbackUrl, () => ( process.env.MICROSOFT_CALLBACK_URL)),
|
|
@@ -284,7 +290,7 @@ function microsoftProvider(credentials = {}) {
|
|
|
284
290
|
scope: _nullishCoalesce(credentials.scope, () => ( "openid profile email User.Read")),
|
|
285
291
|
async fetchProfile(accessToken) {
|
|
286
292
|
const me = await readJson(
|
|
287
|
-
await fetch("https://graph.microsoft.com/v1.0/me", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
293
|
+
await (_nullishCoalesce(credentials.fetchImpl, () => ( fetch)))("https://graph.microsoft.com/v1.0/me", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
288
294
|
"Microsoft Graph me"
|
|
289
295
|
);
|
|
290
296
|
const email = _nullishCoalesce(me.mail, () => ( me.userPrincipalName));
|
|
@@ -301,6 +307,7 @@ function microsoftProvider(credentials = {}) {
|
|
|
301
307
|
function discordProvider(credentials = {}) {
|
|
302
308
|
return {
|
|
303
309
|
name: "discord",
|
|
310
|
+
fetchImpl: credentials.fetchImpl,
|
|
304
311
|
clientId: _nullishCoalesce(credentials.clientId, () => ( process.env.DISCORD_CLIENT_ID)),
|
|
305
312
|
clientSecret: _nullishCoalesce(credentials.clientSecret, () => ( process.env.DISCORD_CLIENT_SECRET)),
|
|
306
313
|
callbackUrl: _nullishCoalesce(credentials.callbackUrl, () => ( process.env.DISCORD_CALLBACK_URL)),
|
|
@@ -309,7 +316,7 @@ function discordProvider(credentials = {}) {
|
|
|
309
316
|
scope: _nullishCoalesce(credentials.scope, () => ( "identify email")),
|
|
310
317
|
async fetchProfile(accessToken) {
|
|
311
318
|
const user = await readJson(
|
|
312
|
-
await fetch("https://discord.com/api/users/@me", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
319
|
+
await (_nullishCoalesce(credentials.fetchImpl, () => ( fetch)))("https://discord.com/api/users/@me", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
313
320
|
"Discord user"
|
|
314
321
|
);
|
|
315
322
|
const id = String(user.id);
|
|
@@ -328,6 +335,7 @@ function discordProvider(credentials = {}) {
|
|
|
328
335
|
function linkedinProvider(credentials = {}) {
|
|
329
336
|
return {
|
|
330
337
|
name: "linkedin",
|
|
338
|
+
fetchImpl: credentials.fetchImpl,
|
|
331
339
|
clientId: _nullishCoalesce(credentials.clientId, () => ( process.env.LINKEDIN_CLIENT_ID)),
|
|
332
340
|
clientSecret: _nullishCoalesce(credentials.clientSecret, () => ( process.env.LINKEDIN_CLIENT_SECRET)),
|
|
333
341
|
callbackUrl: _nullishCoalesce(credentials.callbackUrl, () => ( process.env.LINKEDIN_CALLBACK_URL)),
|
|
@@ -336,7 +344,7 @@ function linkedinProvider(credentials = {}) {
|
|
|
336
344
|
scope: _nullishCoalesce(credentials.scope, () => ( "openid profile email")),
|
|
337
345
|
async fetchProfile(accessToken) {
|
|
338
346
|
const claims = await readJson(
|
|
339
|
-
await fetch("https://api.linkedin.com/v2/userinfo", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
347
|
+
await (_nullishCoalesce(credentials.fetchImpl, () => ( fetch)))("https://api.linkedin.com/v2/userinfo", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
340
348
|
"LinkedIn userinfo"
|
|
341
349
|
);
|
|
342
350
|
return {
|
package/dist/auth/oauth/index.js
CHANGED
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
UnauthorizedAppException,
|
|
8
8
|
ValidationAppException
|
|
9
9
|
} from "../../chunk-ZFIDAX7K.js";
|
|
10
|
-
import "../../chunk-ETRUVZTJ.js";
|
|
11
10
|
import "../../chunk-M3GQDRWR.js";
|
|
11
|
+
import "../../chunk-ETRUVZTJ.js";
|
|
12
12
|
import "../../chunk-VVMRZEIW.js";
|
|
13
13
|
import {
|
|
14
14
|
__decorateClass,
|
|
@@ -32,6 +32,7 @@ async function readJson(response, what) {
|
|
|
32
32
|
function googleProvider(credentials = {}) {
|
|
33
33
|
return {
|
|
34
34
|
name: "google",
|
|
35
|
+
fetchImpl: credentials.fetchImpl,
|
|
35
36
|
clientId: credentials.clientId ?? process.env.GOOGLE_CLIENT_ID,
|
|
36
37
|
clientSecret: credentials.clientSecret ?? process.env.GOOGLE_CLIENT_SECRET,
|
|
37
38
|
callbackUrl: credentials.callbackUrl ?? process.env.GOOGLE_CALLBACK_URL,
|
|
@@ -47,7 +48,7 @@ function googleProvider(credentials = {}) {
|
|
|
47
48
|
},
|
|
48
49
|
async fetchProfile(accessToken) {
|
|
49
50
|
const data = await readJson(
|
|
50
|
-
await fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
|
|
51
|
+
await (credentials.fetchImpl ?? fetch)("https://www.googleapis.com/oauth2/v3/userinfo", {
|
|
51
52
|
headers: { Authorization: `Bearer ${accessToken}` }
|
|
52
53
|
}),
|
|
53
54
|
"Google userinfo"
|
|
@@ -69,6 +70,7 @@ function facebookProvider(credentials = {}) {
|
|
|
69
70
|
const version = process.env.FACEBOOK_GRAPH_VERSION ?? "v21.0";
|
|
70
71
|
return {
|
|
71
72
|
name: "facebook",
|
|
73
|
+
fetchImpl: credentials.fetchImpl,
|
|
72
74
|
clientId: credentials.clientId ?? process.env.FACEBOOK_APP_ID,
|
|
73
75
|
clientSecret: credentials.clientSecret ?? process.env.FACEBOOK_APP_SECRET,
|
|
74
76
|
callbackUrl: credentials.callbackUrl ?? process.env.FACEBOOK_CALLBACK_URL,
|
|
@@ -79,7 +81,7 @@ function facebookProvider(credentials = {}) {
|
|
|
79
81
|
const url = new URL(`https://graph.facebook.com/${version}/me`);
|
|
80
82
|
url.searchParams.set("fields", "id,name,email,picture.type(large)");
|
|
81
83
|
const data = await readJson(
|
|
82
|
-
await fetch(url, { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
84
|
+
await (credentials.fetchImpl ?? fetch)(url, { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
83
85
|
"Facebook me"
|
|
84
86
|
);
|
|
85
87
|
const picture = data.picture;
|
|
@@ -113,7 +115,7 @@ async function exchangeCode(provider, code) {
|
|
|
113
115
|
code
|
|
114
116
|
});
|
|
115
117
|
const data = await readJson(
|
|
116
|
-
await fetch(provider.tokenUrl, {
|
|
118
|
+
await (provider.fetchImpl ?? fetch)(provider.tokenUrl, {
|
|
117
119
|
method: "POST",
|
|
118
120
|
headers: {
|
|
119
121
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
@@ -145,6 +147,7 @@ function appleProvider(credentials = {}) {
|
|
|
145
147
|
const configured = Boolean(clientId && teamId && keyId && privateKey);
|
|
146
148
|
return {
|
|
147
149
|
name: "apple",
|
|
150
|
+
fetchImpl: credentials.fetchImpl,
|
|
148
151
|
clientId,
|
|
149
152
|
// Only offered as configured when every piece exists: `provider()` tests
|
|
150
153
|
// `clientSecret` for truthiness, and a function that would throw later
|
|
@@ -158,7 +161,7 @@ function appleProvider(credentials = {}) {
|
|
|
158
161
|
callbackMethod: "POST",
|
|
159
162
|
async fetchProfile(_accessToken, tokens, callback) {
|
|
160
163
|
if (!tokens.id_token) throw new Error("Apple token exchange returned no id_token.");
|
|
161
|
-
const claims = await verifyAppleIdToken(tokens.id_token, clientId, keysUrl);
|
|
164
|
+
const claims = await verifyAppleIdToken(tokens.id_token, clientId, keysUrl, credentials.fetchImpl);
|
|
162
165
|
const verified = claims.email_verified === true || claims.email_verified === "true";
|
|
163
166
|
return {
|
|
164
167
|
providerAccountId: claims.sub,
|
|
@@ -180,17 +183,17 @@ function mintClientSecret(clientId, teamId, keyId, privateKey) {
|
|
|
180
183
|
}
|
|
181
184
|
var cachedKeys;
|
|
182
185
|
var KEYS_TTL_MS = 60 * 60 * 1e3;
|
|
183
|
-
async function appleKeys(keysUrl, kid) {
|
|
186
|
+
async function appleKeys(keysUrl, kid, fetchImpl) {
|
|
184
187
|
const fresh = cachedKeys && Date.now() - cachedKeys.fetchedAt < KEYS_TTL_MS;
|
|
185
188
|
if (fresh && cachedKeys.keys.some((k) => k.kid === kid)) return cachedKeys.keys;
|
|
186
|
-
const data = await readJson(await fetch(keysUrl), "Apple keys");
|
|
189
|
+
const data = await readJson(await (fetchImpl ?? fetch)(keysUrl), "Apple keys");
|
|
187
190
|
cachedKeys = { fetchedAt: Date.now(), keys: data.keys ?? [] };
|
|
188
191
|
return cachedKeys.keys;
|
|
189
192
|
}
|
|
190
|
-
async function verifyAppleIdToken(idToken, clientId, keysUrl = KEYS_URL) {
|
|
193
|
+
async function verifyAppleIdToken(idToken, clientId, keysUrl = KEYS_URL, fetchImpl) {
|
|
191
194
|
const decoded = jwt.decode(idToken, { complete: true });
|
|
192
195
|
const kid = decoded?.header.kid;
|
|
193
|
-
const key = (await appleKeys(keysUrl, kid)).find((k) => k.kid === kid);
|
|
196
|
+
const key = (await appleKeys(keysUrl, kid, fetchImpl)).find((k) => k.kid === kid);
|
|
194
197
|
if (!key) throw new Error("Apple id_token is signed with a key Apple does not publish.");
|
|
195
198
|
const pem = createPublicKey({ key, format: "jwk" }).export({ type: "spki", format: "pem" });
|
|
196
199
|
return jwt.verify(idToken, pem, { algorithms: ["RS256"], audience: clientId, issuer: ISSUER });
|
|
@@ -211,6 +214,7 @@ function nameFromCallback(callback) {
|
|
|
211
214
|
function tiktokProvider(credentials = {}) {
|
|
212
215
|
return {
|
|
213
216
|
name: "tiktok",
|
|
217
|
+
fetchImpl: credentials.fetchImpl,
|
|
214
218
|
clientId: credentials.clientId ?? process.env.TIKTOK_CLIENT_KEY,
|
|
215
219
|
clientSecret: credentials.clientSecret ?? process.env.TIKTOK_CLIENT_SECRET,
|
|
216
220
|
callbackUrl: credentials.callbackUrl ?? process.env.TIKTOK_CALLBACK_URL,
|
|
@@ -222,7 +226,7 @@ function tiktokProvider(credentials = {}) {
|
|
|
222
226
|
const url = new URL("https://open.tiktokapis.com/v2/user/info/");
|
|
223
227
|
url.searchParams.set("fields", "open_id,display_name,avatar_url");
|
|
224
228
|
const data = await readJson(
|
|
225
|
-
await fetch(url, { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
229
|
+
await (credentials.fetchImpl ?? fetch)(url, { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
226
230
|
"TikTok user info"
|
|
227
231
|
);
|
|
228
232
|
const error = data.error;
|
|
@@ -243,6 +247,7 @@ function tiktokProvider(credentials = {}) {
|
|
|
243
247
|
function githubProvider(credentials = {}) {
|
|
244
248
|
return {
|
|
245
249
|
name: "github",
|
|
250
|
+
fetchImpl: credentials.fetchImpl,
|
|
246
251
|
clientId: credentials.clientId ?? process.env.GITHUB_CLIENT_ID,
|
|
247
252
|
clientSecret: credentials.clientSecret ?? process.env.GITHUB_CLIENT_SECRET,
|
|
248
253
|
callbackUrl: credentials.callbackUrl ?? process.env.GITHUB_CALLBACK_URL,
|
|
@@ -255,9 +260,9 @@ function githubProvider(credentials = {}) {
|
|
|
255
260
|
Accept: "application/vnd.github+json",
|
|
256
261
|
"User-Agent": "nestkit"
|
|
257
262
|
};
|
|
258
|
-
const user = await readJson(await fetch("https://api.github.com/user", { headers }), "GitHub user");
|
|
263
|
+
const user = await readJson(await (credentials.fetchImpl ?? fetch)("https://api.github.com/user", { headers }), "GitHub user");
|
|
259
264
|
const emails = await readJson(
|
|
260
|
-
await fetch("https://api.github.com/user/emails", { headers }),
|
|
265
|
+
await (credentials.fetchImpl ?? fetch)("https://api.github.com/user/emails", { headers }),
|
|
261
266
|
"GitHub emails"
|
|
262
267
|
);
|
|
263
268
|
const primary = Array.isArray(emails) ? emails.find((e) => e.primary && e.verified) ?? emails.find((e) => e.verified) : void 0;
|
|
@@ -276,6 +281,7 @@ function microsoftProvider(credentials = {}) {
|
|
|
276
281
|
const tenant = credentials.tenant ?? process.env.MICROSOFT_TENANT ?? "common";
|
|
277
282
|
return {
|
|
278
283
|
name: "microsoft",
|
|
284
|
+
fetchImpl: credentials.fetchImpl,
|
|
279
285
|
clientId: credentials.clientId ?? process.env.MICROSOFT_CLIENT_ID,
|
|
280
286
|
clientSecret: credentials.clientSecret ?? process.env.MICROSOFT_CLIENT_SECRET,
|
|
281
287
|
callbackUrl: credentials.callbackUrl ?? process.env.MICROSOFT_CALLBACK_URL,
|
|
@@ -284,7 +290,7 @@ function microsoftProvider(credentials = {}) {
|
|
|
284
290
|
scope: credentials.scope ?? "openid profile email User.Read",
|
|
285
291
|
async fetchProfile(accessToken) {
|
|
286
292
|
const me = await readJson(
|
|
287
|
-
await fetch("https://graph.microsoft.com/v1.0/me", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
293
|
+
await (credentials.fetchImpl ?? fetch)("https://graph.microsoft.com/v1.0/me", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
288
294
|
"Microsoft Graph me"
|
|
289
295
|
);
|
|
290
296
|
const email = me.mail ?? me.userPrincipalName;
|
|
@@ -301,6 +307,7 @@ function microsoftProvider(credentials = {}) {
|
|
|
301
307
|
function discordProvider(credentials = {}) {
|
|
302
308
|
return {
|
|
303
309
|
name: "discord",
|
|
310
|
+
fetchImpl: credentials.fetchImpl,
|
|
304
311
|
clientId: credentials.clientId ?? process.env.DISCORD_CLIENT_ID,
|
|
305
312
|
clientSecret: credentials.clientSecret ?? process.env.DISCORD_CLIENT_SECRET,
|
|
306
313
|
callbackUrl: credentials.callbackUrl ?? process.env.DISCORD_CALLBACK_URL,
|
|
@@ -309,7 +316,7 @@ function discordProvider(credentials = {}) {
|
|
|
309
316
|
scope: credentials.scope ?? "identify email",
|
|
310
317
|
async fetchProfile(accessToken) {
|
|
311
318
|
const user = await readJson(
|
|
312
|
-
await fetch("https://discord.com/api/users/@me", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
319
|
+
await (credentials.fetchImpl ?? fetch)("https://discord.com/api/users/@me", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
313
320
|
"Discord user"
|
|
314
321
|
);
|
|
315
322
|
const id = String(user.id);
|
|
@@ -328,6 +335,7 @@ function discordProvider(credentials = {}) {
|
|
|
328
335
|
function linkedinProvider(credentials = {}) {
|
|
329
336
|
return {
|
|
330
337
|
name: "linkedin",
|
|
338
|
+
fetchImpl: credentials.fetchImpl,
|
|
331
339
|
clientId: credentials.clientId ?? process.env.LINKEDIN_CLIENT_ID,
|
|
332
340
|
clientSecret: credentials.clientSecret ?? process.env.LINKEDIN_CLIENT_SECRET,
|
|
333
341
|
callbackUrl: credentials.callbackUrl ?? process.env.LINKEDIN_CALLBACK_URL,
|
|
@@ -336,7 +344,7 @@ function linkedinProvider(credentials = {}) {
|
|
|
336
344
|
scope: credentials.scope ?? "openid profile email",
|
|
337
345
|
async fetchProfile(accessToken) {
|
|
338
346
|
const claims = await readJson(
|
|
339
|
-
await fetch("https://api.linkedin.com/v2/userinfo", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
347
|
+
await (credentials.fetchImpl ?? fetch)("https://api.linkedin.com/v2/userinfo", { headers: { Authorization: `Bearer ${accessToken}` } }),
|
|
340
348
|
"LinkedIn userinfo"
|
|
341
349
|
);
|
|
342
350
|
return {
|
|
@@ -63,6 +63,8 @@ export interface OAuthProviderConfig {
|
|
|
63
63
|
authorizeUrl: string;
|
|
64
64
|
/** Where the `code` is exchanged for an access token. */
|
|
65
65
|
tokenUrl: string;
|
|
66
|
+
/** Optional network hook for the token exchange (`exchangeCode`). Default: global `fetch`. */
|
|
67
|
+
fetchImpl?: typeof fetch;
|
|
66
68
|
scope: string;
|
|
67
69
|
/** Extra query parameters for the consent screen (`prompt`, `access_type`…). */
|
|
68
70
|
authorizeParams?: Record<string, string>;
|
|
@@ -92,6 +94,13 @@ export interface ProviderCredentials {
|
|
|
92
94
|
callbackUrl?: string;
|
|
93
95
|
/** Overrides the default scope. */
|
|
94
96
|
scope?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Optional network hook for this provider's own calls (profile reads, and
|
|
99
|
+
* the `code` exchange via `OAuthProviderConfig.fetchImpl`). Lets the app
|
|
100
|
+
* route them through a resilient client (timeout, retries, alerts).
|
|
101
|
+
* Default: the global `fetch`.
|
|
102
|
+
*/
|
|
103
|
+
fetchImpl?: typeof fetch;
|
|
95
104
|
}
|
|
96
105
|
/**
|
|
97
106
|
* Reads a provider's JSON, or throws with the body when it fails.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type OAuthProviderConfig } from '../oauth-provider.js';
|
|
2
2
|
export interface AppleCredentials {
|
|
3
|
+
/** Optional network hook (token exchange and Apple's public keys). Default: global `fetch`. */
|
|
4
|
+
fetchImpl?: typeof fetch;
|
|
3
5
|
/** The Services ID (`com.example.web`), not the App ID. `APPLE_CLIENT_ID`. */
|
|
4
6
|
clientId?: string;
|
|
5
7
|
/** `APPLE_TEAM_ID`. */
|
|
@@ -54,5 +56,5 @@ export declare function appleProvider(credentials?: AppleCredentials): OAuthProv
|
|
|
54
56
|
*/
|
|
55
57
|
export declare function mintClientSecret(clientId: string, teamId: string, keyId: string, privateKey: string): string;
|
|
56
58
|
/** Signature, issuer, audience and expiry — the four things a forged or replayed token fails. */
|
|
57
|
-
export declare function verifyAppleIdToken(idToken: string, clientId: string, keysUrl?: string): Promise<AppleIdClaims>;
|
|
59
|
+
export declare function verifyAppleIdToken(idToken: string, clientId: string, keysUrl?: string, fetchImpl?: typeof fetch): Promise<AppleIdClaims>;
|
|
58
60
|
export {};
|
package/dist/bootstrap/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkALIKVFOVcjs = require('../chunk-ALIKVFOV.cjs');
|
|
4
4
|
require('../chunk-3AUOOEQO.cjs');
|
|
5
|
-
require('../chunk-
|
|
5
|
+
require('../chunk-LSDY6ETG.cjs');
|
|
6
|
+
require('../chunk-Q5Y33L7B.cjs');
|
|
6
7
|
require('../chunk-AXMW5JF7.cjs');
|
|
7
8
|
require('../chunk-Y72D5L6I.cjs');
|
|
8
9
|
require('../chunk-SDWHKPXI.cjs');
|
|
9
|
-
require('../chunk-Q5Y33L7B.cjs');
|
|
10
10
|
require('../chunk-PNK5WMPP.cjs');
|
|
11
11
|
require('../chunk-2REOCMUD.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
exports.applyNestKitDefaults =
|
|
14
|
+
exports.applyNestKitDefaults = _chunkALIKVFOVcjs.applyNestKitDefaults;
|
package/dist/bootstrap/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyNestKitDefaults
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-PFHHLB7B.js";
|
|
4
4
|
import "../chunk-DYHSOULW.js";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-2DUEQKOI.js";
|
|
6
|
+
import "../chunk-M3GQDRWR.js";
|
|
6
7
|
import "../chunk-X4PQJZ4G.js";
|
|
7
8
|
import "../chunk-TCAMLNUZ.js";
|
|
8
9
|
import "../chunk-ETRUVZTJ.js";
|
|
9
|
-
import "../chunk-M3GQDRWR.js";
|
|
10
10
|
import "../chunk-VVMRZEIW.js";
|
|
11
11
|
import "../chunk-4MGIQFAJ.js";
|
|
12
12
|
export {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunk3AUOOEQOcjs = require('./chunk-3AUOOEQO.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkLSDY6ETGcjs = require('./chunk-LSDY6ETG.cjs');
|
|
7
7
|
|
|
8
8
|
// src/bootstrap/apply-defaults.ts
|
|
9
9
|
|
|
@@ -17,7 +17,7 @@ function applyNestKitDefaults(app, options = {}) {
|
|
|
17
17
|
app.useGlobalPipes(
|
|
18
18
|
new (0, _common.ValidationPipe)({ whitelist: true, transform: true, ...options.validation })
|
|
19
19
|
);
|
|
20
|
-
app.useGlobalFilters(new (0,
|
|
20
|
+
app.useGlobalFilters(new (0, _chunkLSDY6ETGcjs.GlobalExceptionFilter)());
|
|
21
21
|
app.useGlobalInterceptors(new (0, _chunk3AUOOEQOcjs.ResponseInterceptor)());
|
|
22
22
|
if (options.swagger !== false) {
|
|
23
23
|
const swaggerOptions = _nullishCoalesce(options.swagger, () => ( { title: "API" }));
|
package/dist/errors/index.cjs
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
var _chunkHDFPSA2Vcjs = require('../chunk-HDFPSA2V.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('../chunk-AXMW5JF7.cjs');
|
|
13
|
-
require('../chunk-Y72D5L6I.cjs');
|
|
14
|
-
require('../chunk-SDWHKPXI.cjs');
|
|
11
|
+
var _chunkLSDY6ETGcjs = require('../chunk-LSDY6ETG.cjs');
|
|
15
12
|
|
|
16
13
|
|
|
17
14
|
var _chunkQ5Y33L7Bcjs = require('../chunk-Q5Y33L7B.cjs');
|
|
15
|
+
require('../chunk-AXMW5JF7.cjs');
|
|
16
|
+
require('../chunk-Y72D5L6I.cjs');
|
|
17
|
+
require('../chunk-SDWHKPXI.cjs');
|
|
18
18
|
require('../chunk-PNK5WMPP.cjs');
|
|
19
19
|
require('../chunk-2REOCMUD.cjs');
|
|
20
20
|
|
|
@@ -25,4 +25,4 @@ require('../chunk-2REOCMUD.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
exports.AppException = _chunkQ5Y33L7Bcjs.AppException; exports.ConflictAppException = _chunkHDFPSA2Vcjs.ConflictAppException; exports.ForbiddenAppException = _chunkHDFPSA2Vcjs.ForbiddenAppException; exports.GlobalExceptionFilter =
|
|
28
|
+
exports.AppException = _chunkQ5Y33L7Bcjs.AppException; exports.ConflictAppException = _chunkHDFPSA2Vcjs.ConflictAppException; exports.ForbiddenAppException = _chunkHDFPSA2Vcjs.ForbiddenAppException; exports.GlobalExceptionFilter = _chunkLSDY6ETGcjs.GlobalExceptionFilter; exports.NotFoundAppException = _chunkHDFPSA2Vcjs.NotFoundAppException; exports.UnauthorizedAppException = _chunkHDFPSA2Vcjs.UnauthorizedAppException; exports.ValidationAppException = _chunkHDFPSA2Vcjs.ValidationAppException;
|
package/dist/errors/index.js
CHANGED
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
} from "../chunk-ZFIDAX7K.js";
|
|
9
9
|
import {
|
|
10
10
|
GlobalExceptionFilter
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-X4PQJZ4G.js";
|
|
13
|
-
import "../chunk-TCAMLNUZ.js";
|
|
14
|
-
import "../chunk-ETRUVZTJ.js";
|
|
11
|
+
} from "../chunk-2DUEQKOI.js";
|
|
15
12
|
import {
|
|
16
13
|
AppException
|
|
17
14
|
} from "../chunk-M3GQDRWR.js";
|
|
15
|
+
import "../chunk-X4PQJZ4G.js";
|
|
16
|
+
import "../chunk-TCAMLNUZ.js";
|
|
17
|
+
import "../chunk-ETRUVZTJ.js";
|
|
18
18
|
import "../chunk-VVMRZEIW.js";
|
|
19
19
|
import "../chunk-4MGIQFAJ.js";
|
|
20
20
|
export {
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkSPTDXUEDcjs = require('./chunk-SPTDXUED.cjs');
|
|
6
|
-
require('./chunk-KVBQBT3D.cjs');
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-KVBQBT3D.cjs');
|
|
7
2
|
|
|
8
3
|
|
|
9
4
|
|
|
@@ -13,14 +8,15 @@ var _chunkRF75KC63cjs = require('./chunk-RF75KC63.cjs');
|
|
|
13
8
|
|
|
14
9
|
|
|
15
10
|
|
|
16
|
-
var
|
|
11
|
+
var _chunkSPTDXUEDcjs = require('./chunk-SPTDXUED.cjs');
|
|
17
12
|
|
|
18
13
|
|
|
19
14
|
|
|
20
15
|
|
|
16
|
+
var _chunkHVHYZXBBcjs = require('./chunk-HVHYZXBB.cjs');
|
|
21
17
|
|
|
22
18
|
|
|
23
|
-
var
|
|
19
|
+
var _chunkQS2W5XCQcjs = require('./chunk-QS2W5XCQ.cjs');
|
|
24
20
|
require('./chunk-H2EHN366.cjs');
|
|
25
21
|
|
|
26
22
|
|
|
@@ -30,13 +26,10 @@ var _chunk52IOOHNXcjs = require('./chunk-52IOOHNX.cjs');
|
|
|
30
26
|
require('./chunk-W2T2VFLC.cjs');
|
|
31
27
|
|
|
32
28
|
|
|
33
|
-
var
|
|
29
|
+
var _chunkALIKVFOVcjs = require('./chunk-ALIKVFOV.cjs');
|
|
34
30
|
|
|
35
31
|
|
|
36
32
|
var _chunk3AUOOEQOcjs = require('./chunk-3AUOOEQO.cjs');
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var _chunkQS2W5XCQcjs = require('./chunk-QS2W5XCQ.cjs');
|
|
40
33
|
require('./chunk-7SOM7EZP.cjs');
|
|
41
34
|
|
|
42
35
|
|
|
@@ -47,7 +40,17 @@ require('./chunk-7SOM7EZP.cjs');
|
|
|
47
40
|
var _chunkHDFPSA2Vcjs = require('./chunk-HDFPSA2V.cjs');
|
|
48
41
|
|
|
49
42
|
|
|
50
|
-
var
|
|
43
|
+
var _chunkLSDY6ETGcjs = require('./chunk-LSDY6ETG.cjs');
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
var _chunkQ5Y33L7Bcjs = require('./chunk-Q5Y33L7B.cjs');
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
var _chunkAPUFKA4Kcjs = require('./chunk-APUFKA4K.cjs');
|
|
51
54
|
|
|
52
55
|
|
|
53
56
|
|
|
@@ -63,9 +66,6 @@ var _chunkY72D5L6Icjs = require('./chunk-Y72D5L6I.cjs');
|
|
|
63
66
|
var _chunkSDWHKPXIcjs = require('./chunk-SDWHKPXI.cjs');
|
|
64
67
|
|
|
65
68
|
|
|
66
|
-
var _chunkQ5Y33L7Bcjs = require('./chunk-Q5Y33L7B.cjs');
|
|
67
|
-
|
|
68
|
-
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
var _chunkPNK5WMPPcjs = require('./chunk-PNK5WMPP.cjs');
|
|
@@ -108,4 +108,4 @@ require('./chunk-2REOCMUD.cjs');
|
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
exports.AppException = _chunkQ5Y33L7Bcjs.AppException; exports.BaseCrudService = _chunk52IOOHNXcjs.BaseCrudService; exports.BaseResponseDto = _chunkQS2W5XCQcjs.BaseResponseDto; exports.ConflictAppException = _chunkHDFPSA2Vcjs.ConflictAppException; exports.ForbiddenAppException = _chunkHDFPSA2Vcjs.ForbiddenAppException; exports.GlobalExceptionFilter =
|
|
111
|
+
exports.AppException = _chunkQ5Y33L7Bcjs.AppException; exports.BaseCrudService = _chunk52IOOHNXcjs.BaseCrudService; exports.BaseResponseDto = _chunkQS2W5XCQcjs.BaseResponseDto; exports.ConflictAppException = _chunkHDFPSA2Vcjs.ConflictAppException; exports.ForbiddenAppException = _chunkHDFPSA2Vcjs.ForbiddenAppException; exports.GlobalExceptionFilter = _chunkLSDY6ETGcjs.GlobalExceptionFilter; exports.I18nInterceptor = _chunkAPUFKA4Kcjs.I18nInterceptor; exports.I18nMessage = _chunkPNK5WMPPcjs.I18nMessage; exports.I18nModule = _chunkAPUFKA4Kcjs.I18nModule; exports.ListQuery = _chunk52IOOHNXcjs.ListQuery; exports.NestI18nTranslator = _chunkAPUFKA4Kcjs.NestI18nTranslator; exports.NotFoundAppException = _chunkHDFPSA2Vcjs.NotFoundAppException; exports.PG_POOL = _chunkRF75KC63cjs.PG_POOL; exports.PgModule = _chunkRF75KC63cjs.PgModule; exports.REQUEST_ID_HEADER = _chunkHVHYZXBBcjs.REQUEST_ID_HEADER; exports.RequestContext = _chunkSDWHKPXIcjs.RequestContext; exports.RequestIdMiddleware = _chunkHVHYZXBBcjs.RequestIdMiddleware; exports.ResponseInterceptor = _chunk3AUOOEQOcjs.ResponseInterceptor; exports.SUPABASE_ANON_CLIENT = _chunkSPTDXUEDcjs.SUPABASE_ANON_CLIENT; exports.SUPABASE_SERVICE_ROLE_CLIENT = _chunkSPTDXUEDcjs.SUPABASE_SERVICE_ROLE_CLIENT; exports.SupabaseModule = _chunkSPTDXUEDcjs.SupabaseModule; exports.TrackingModule = _chunkHVHYZXBBcjs.TrackingModule; exports.UnauthorizedAppException = _chunkHDFPSA2Vcjs.UnauthorizedAppException; exports.ValidationAppException = _chunkHDFPSA2Vcjs.ValidationAppException; exports.applyNestKitDefaults = _chunkALIKVFOVcjs.applyNestKitDefaults; exports.buildPageMeta = _chunkY72D5L6Icjs.buildPageMeta; exports.createCrudController = _chunk52IOOHNXcjs.createCrudController; exports.currentLanguage = _chunkAXMW5JF7cjs.currentLanguage; exports.isI18nMessage = _chunkPNK5WMPPcjs.isI18nMessage; exports.isPaginated = _chunkY72D5L6Icjs.isPaginated; exports.matchLanguage = _chunkAPUFKA4Kcjs.matchLanguage; exports.paginated = _chunkY72D5L6Icjs.paginated; exports.t = _chunkPNK5WMPPcjs.t; exports.translate = _chunkAXMW5JF7cjs.translate; exports.translateDeep = _chunkAXMW5JF7cjs.translateDeep; exports.translateOr = _chunkAPUFKA4Kcjs.translateOr; exports.withTenantScope = _chunkRF75KC63cjs.withTenantScope;
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SUPABASE_ANON_CLIENT,
|
|
3
|
-
SUPABASE_SERVICE_ROLE_CLIENT,
|
|
4
|
-
SupabaseModule
|
|
5
|
-
} from "./chunk-PA24P76K.js";
|
|
6
1
|
import "./chunk-EPVKCBPT.js";
|
|
7
2
|
import {
|
|
8
3
|
PG_POOL,
|
|
9
4
|
PgModule,
|
|
10
5
|
withTenantScope
|
|
11
6
|
} from "./chunk-VKOPDDCC.js";
|
|
7
|
+
import {
|
|
8
|
+
SUPABASE_ANON_CLIENT,
|
|
9
|
+
SUPABASE_SERVICE_ROLE_CLIENT,
|
|
10
|
+
SupabaseModule
|
|
11
|
+
} from "./chunk-PA24P76K.js";
|
|
12
12
|
import {
|
|
13
13
|
REQUEST_ID_HEADER,
|
|
14
14
|
RequestIdMiddleware,
|
|
15
15
|
TrackingModule
|
|
16
16
|
} from "./chunk-4PFAKLT3.js";
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
NestI18nTranslator,
|
|
21
|
-
matchLanguage,
|
|
22
|
-
translateOr
|
|
23
|
-
} from "./chunk-6RAPVLJM.js";
|
|
18
|
+
BaseResponseDto
|
|
19
|
+
} from "./chunk-XX2HPTRU.js";
|
|
24
20
|
import "./chunk-ODPSIFOB.js";
|
|
25
21
|
import {
|
|
26
22
|
BaseCrudService,
|
|
@@ -30,13 +26,10 @@ import {
|
|
|
30
26
|
import "./chunk-ZJMLEP5H.js";
|
|
31
27
|
import {
|
|
32
28
|
applyNestKitDefaults
|
|
33
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-PFHHLB7B.js";
|
|
34
30
|
import {
|
|
35
31
|
ResponseInterceptor
|
|
36
32
|
} from "./chunk-DYHSOULW.js";
|
|
37
|
-
import {
|
|
38
|
-
BaseResponseDto
|
|
39
|
-
} from "./chunk-XX2HPTRU.js";
|
|
40
33
|
import "./chunk-DQYAIQQ5.js";
|
|
41
34
|
import {
|
|
42
35
|
ConflictAppException,
|
|
@@ -47,7 +40,17 @@ import {
|
|
|
47
40
|
} from "./chunk-ZFIDAX7K.js";
|
|
48
41
|
import {
|
|
49
42
|
GlobalExceptionFilter
|
|
50
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-2DUEQKOI.js";
|
|
44
|
+
import {
|
|
45
|
+
AppException
|
|
46
|
+
} from "./chunk-M3GQDRWR.js";
|
|
47
|
+
import {
|
|
48
|
+
I18nInterceptor,
|
|
49
|
+
I18nModule,
|
|
50
|
+
NestI18nTranslator,
|
|
51
|
+
matchLanguage,
|
|
52
|
+
translateOr
|
|
53
|
+
} from "./chunk-6RAPVLJM.js";
|
|
51
54
|
import {
|
|
52
55
|
currentLanguage,
|
|
53
56
|
translate,
|
|
@@ -61,9 +64,6 @@ import {
|
|
|
61
64
|
import {
|
|
62
65
|
RequestContext
|
|
63
66
|
} from "./chunk-ETRUVZTJ.js";
|
|
64
|
-
import {
|
|
65
|
-
AppException
|
|
66
|
-
} from "./chunk-M3GQDRWR.js";
|
|
67
67
|
import {
|
|
68
68
|
I18nMessage,
|
|
69
69
|
isI18nMessage,
|
package/package.json
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AppException
|
|
3
|
+
} from "./chunk-M3GQDRWR.js";
|
|
1
4
|
import {
|
|
2
5
|
getI18nRuntime,
|
|
3
6
|
translate,
|
|
@@ -6,9 +9,6 @@ import {
|
|
|
6
9
|
import {
|
|
7
10
|
RequestContext
|
|
8
11
|
} from "./chunk-ETRUVZTJ.js";
|
|
9
|
-
import {
|
|
10
|
-
AppException
|
|
11
|
-
} from "./chunk-M3GQDRWR.js";
|
|
12
12
|
import {
|
|
13
13
|
__decorateClass
|
|
14
14
|
} from "./chunk-4MGIQFAJ.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
+
var _chunkQ5Y33L7Bcjs = require('./chunk-Q5Y33L7B.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
|
-
var _chunkAXMW5JF7cjs = require('./chunk-AXMW5JF7.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkAXMW5JF7cjs = require('./chunk-AXMW5JF7.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkSDWHKPXIcjs = require('./chunk-SDWHKPXI.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunk2REOCMUDcjs = require('./chunk-2REOCMUD.cjs');
|