alepha 0.13.4 → 0.13.6
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-files/index.browser.js +5 -5
- package/dist/api-files/index.d.ts +191 -191
- package/dist/api-files/index.js +9 -9
- package/dist/api-jobs/index.browser.js +5 -5
- package/dist/api-jobs/index.d.ts +173 -173
- package/dist/api-jobs/index.js +9 -9
- package/dist/api-notifications/index.browser.js +11 -11
- package/dist/api-notifications/index.d.ts +11 -11
- package/dist/api-notifications/index.js +11 -11
- package/dist/api-parameters/index.browser.js +2 -2
- package/dist/api-parameters/index.d.ts +3 -3
- package/dist/api-parameters/index.js +3 -3
- package/dist/api-users/index.browser.js +6 -6
- package/dist/api-users/index.d.ts +832 -832
- package/dist/api-users/index.js +36 -36
- package/dist/api-verifications/index.browser.js +5 -5
- package/dist/api-verifications/index.d.ts +21 -21
- package/dist/api-verifications/index.js +10 -10
- package/dist/batch/index.d.ts +3 -3
- package/dist/batch/index.js +3 -3
- package/dist/bin/index.js +1 -1
- package/dist/bucket/index.d.ts +6 -6
- package/dist/bucket/index.js +7 -7
- package/dist/cache/index.d.ts +4 -4
- package/dist/cache/index.js +5 -5
- package/dist/cache-redis/index.d.ts +2 -2
- package/dist/cache-redis/index.js +2 -2
- package/dist/cli/{dist-lGnqsKpu.js → dist-BlfFtOk2.js} +16 -16
- package/dist/cli/{dist-lGnqsKpu.js.map → dist-BlfFtOk2.js.map} +1 -1
- package/dist/cli/index.d.ts +31 -75
- package/dist/cli/index.js +94 -171
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +8 -8
- package/dist/command/index.js +11 -10
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +35 -35
- package/dist/core/index.d.ts +39 -39
- package/dist/core/index.js +35 -35
- package/dist/core/index.native.js +35 -35
- package/dist/datetime/index.d.ts +3 -3
- package/dist/datetime/index.js +3 -3
- package/dist/email/index.d.ts +11 -11
- package/dist/email/index.js +42 -42
- package/dist/fake/index.d.ts +2 -2
- package/dist/fake/index.js +5 -5
- package/dist/file/index.d.ts +4 -4
- package/dist/file/index.js +4 -4
- package/dist/lock/index.d.ts +5 -5
- package/dist/lock/index.js +5 -5
- package/dist/lock-redis/index.d.ts +2 -2
- package/dist/lock-redis/index.js +2 -2
- package/dist/logger/index.d.ts +11 -11
- package/dist/logger/index.js +12 -12
- package/dist/orm/index.browser.js +12 -12
- package/dist/orm/index.d.ts +52 -52
- package/dist/orm/index.js +32 -32
- package/dist/queue/index.d.ts +7 -7
- package/dist/queue/index.js +6 -6
- package/dist/queue-redis/index.d.ts +2 -2
- package/dist/queue-redis/index.js +2 -2
- package/dist/redis/index.d.ts +3 -3
- package/dist/redis/index.js +3 -3
- package/dist/retry/index.d.ts +5 -5
- package/dist/retry/index.js +5 -5
- package/dist/router/index.d.ts +1 -1
- package/dist/router/index.js +1 -1
- package/dist/scheduler/index.d.ts +10 -10
- package/dist/scheduler/index.js +7 -7
- package/dist/security/index.browser.js +7 -7
- package/dist/security/index.d.ts +43 -43
- package/dist/security/index.js +46 -46
- package/dist/server/index.browser.js +14 -14
- package/dist/server/index.d.ts +26 -26
- package/dist/server/index.js +26 -26
- package/dist/server-auth/index.browser.js +6 -6
- package/dist/server-auth/index.d.ts +163 -163
- package/dist/server-auth/index.js +13 -13
- package/dist/server-cache/index.d.ts +2 -2
- package/dist/server-cache/index.js +2 -2
- package/dist/server-compress/index.d.ts +2 -2
- package/dist/server-compress/index.js +2 -2
- package/dist/server-cookies/index.browser.js +3 -3
- package/dist/server-cookies/index.d.ts +4 -4
- package/dist/server-cookies/index.js +4 -4
- package/dist/server-cors/index.d.ts +3 -3
- package/dist/server-cors/index.js +3 -3
- package/dist/server-health/index.d.ts +3 -3
- package/dist/server-health/index.js +3 -3
- package/dist/server-helmet/index.d.ts +2 -2
- package/dist/server-helmet/index.js +2 -2
- package/dist/server-links/index.browser.js +5 -5
- package/dist/server-links/index.d.ts +40 -40
- package/dist/server-links/index.js +7 -7
- package/dist/server-metrics/index.d.ts +2 -2
- package/dist/server-metrics/index.js +86 -86
- package/dist/server-multipart/index.d.ts +2 -2
- package/dist/server-multipart/index.js +2 -2
- package/dist/server-proxy/index.d.ts +3 -3
- package/dist/server-proxy/index.js +3 -3
- package/dist/server-rate-limit/index.d.ts +3 -3
- package/dist/server-rate-limit/index.js +3 -3
- package/dist/server-security/index.browser.js +1 -1
- package/dist/server-security/index.d.ts +13 -13
- package/dist/server-security/index.js +4 -4
- package/dist/server-static/index.d.ts +3 -3
- package/dist/server-static/index.js +3 -3
- package/dist/server-swagger/index.d.ts +3 -3
- package/dist/server-swagger/index.js +3 -3
- package/dist/sms/index.d.ts +6 -6
- package/dist/sms/index.js +6 -6
- package/dist/thread/index.d.ts +3 -3
- package/dist/thread/index.js +3 -3
- package/dist/topic/index.d.ts +6 -6
- package/dist/topic/index.js +6 -6
- package/dist/topic-redis/index.d.ts +2 -2
- package/dist/topic-redis/index.js +2 -2
- package/dist/vite/index.d.ts +17 -17
- package/dist/vite/index.js +20 -20
- package/dist/websocket/index.browser.js +9 -9
- package/dist/websocket/index.d.ts +10 -10
- package/dist/websocket/index.js +10 -10
- package/package.json +5 -4
- package/src/cli/apps/AlephaCli.ts +1 -2
- package/src/cli/commands/BiomeCommands.ts +4 -6
- package/src/cli/commands/CoreCommands.ts +2 -2
- package/src/cli/commands/DrizzleCommands.ts +76 -78
- package/src/cli/commands/VerifyCommands.ts +3 -5
- package/src/cli/commands/ViteCommands.ts +6 -8
- package/src/cli/index.ts +1 -1
- package/src/cli/services/{ProjectUtils.ts → AlephaCliUtils.ts} +101 -16
- package/src/command/providers/CliProvider.ts +12 -4
- package/src/cli/services/ProcessRunner.ts +0 -89
package/dist/security/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { DateTimeProvider } from "alepha/datetime";
|
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
6
|
import { UnauthorizedError } from "alepha/server";
|
|
7
7
|
|
|
8
|
-
//#region src/security/errors/InvalidPermissionError.ts
|
|
8
|
+
//#region ../../src/security/errors/InvalidPermissionError.ts
|
|
9
9
|
var InvalidPermissionError = class extends Error {
|
|
10
10
|
constructor(name) {
|
|
11
11
|
super(`Permission '${name}' is invalid`);
|
|
@@ -13,13 +13,13 @@ var InvalidPermissionError = class extends Error {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
16
|
-
//#region src/security/errors/InvalidTokenError.ts
|
|
16
|
+
//#region ../../src/security/errors/InvalidTokenError.ts
|
|
17
17
|
var InvalidTokenError = class extends Error {
|
|
18
18
|
status = 401;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
22
|
-
//#region src/security/errors/RealmNotFoundError.ts
|
|
22
|
+
//#region ../../src/security/errors/RealmNotFoundError.ts
|
|
23
23
|
var RealmNotFoundError = class extends Error {
|
|
24
24
|
constructor(realm) {
|
|
25
25
|
super(`Realm '${realm}' not found`);
|
|
@@ -27,14 +27,14 @@ var RealmNotFoundError = class extends Error {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
|
-
//#region src/security/errors/SecurityError.ts
|
|
30
|
+
//#region ../../src/security/errors/SecurityError.ts
|
|
31
31
|
var SecurityError = class extends Error {
|
|
32
32
|
name = "SecurityError";
|
|
33
33
|
status = 403;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
//#endregion
|
|
37
|
-
//#region
|
|
37
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/buffer_utils.js
|
|
38
38
|
const encoder = new TextEncoder();
|
|
39
39
|
const decoder = new TextDecoder();
|
|
40
40
|
const MAX_INT32 = 2 ** 32;
|
|
@@ -59,7 +59,7 @@ function encode$1(string) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
//#endregion
|
|
62
|
-
//#region
|
|
62
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/base64.js
|
|
63
63
|
function encodeBase64(input) {
|
|
64
64
|
if (Uint8Array.prototype.toBase64) return input.toBase64();
|
|
65
65
|
const CHUNK_SIZE = 32768;
|
|
@@ -76,7 +76,7 @@ function decodeBase64(encoded) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
|
-
//#region
|
|
79
|
+
//#region ../../../../node_modules/jose/dist/webapi/util/base64url.js
|
|
80
80
|
function decode(input) {
|
|
81
81
|
if (Uint8Array.fromBase64) return Uint8Array.fromBase64(typeof input === "string" ? input : decoder.decode(input), { alphabet: "base64url" });
|
|
82
82
|
let encoded = input;
|
|
@@ -99,7 +99,7 @@ function encode(input) {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
//#endregion
|
|
102
|
-
//#region
|
|
102
|
+
//#region ../../../../node_modules/jose/dist/webapi/util/errors.js
|
|
103
103
|
var JOSEError = class extends Error {
|
|
104
104
|
static code = "ERR_JOSE_GENERIC";
|
|
105
105
|
code = "ERR_JOSE_GENERIC";
|
|
@@ -194,7 +194,7 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
|
194
194
|
};
|
|
195
195
|
|
|
196
196
|
//#endregion
|
|
197
|
-
//#region
|
|
197
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
198
198
|
const unusable = (name, prop = "algorithm.name") => /* @__PURE__ */ new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
199
199
|
const isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
200
200
|
function getHashLength(hash) {
|
|
@@ -260,7 +260,7 @@ function checkSigCryptoKey(key, alg, usage) {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
//#endregion
|
|
263
|
-
//#region
|
|
263
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
264
264
|
function message(msg, actual, ...types) {
|
|
265
265
|
types = types.filter(Boolean);
|
|
266
266
|
if (types.length > 2) {
|
|
@@ -279,7 +279,7 @@ const invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ..
|
|
|
279
279
|
const withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
280
280
|
|
|
281
281
|
//#endregion
|
|
282
|
-
//#region
|
|
282
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
283
283
|
const isCryptoKey = (key) => {
|
|
284
284
|
if (key?.[Symbol.toStringTag] === "CryptoKey") return true;
|
|
285
285
|
try {
|
|
@@ -292,7 +292,7 @@ const isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
|
|
|
292
292
|
const isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
293
293
|
|
|
294
294
|
//#endregion
|
|
295
|
-
//#region
|
|
295
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/is_disjoint.js
|
|
296
296
|
function isDisjoint(...headers) {
|
|
297
297
|
const sources = headers.filter(Boolean);
|
|
298
298
|
if (sources.length === 0 || sources.length === 1) return true;
|
|
@@ -312,7 +312,7 @@ function isDisjoint(...headers) {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
//#endregion
|
|
315
|
-
//#region
|
|
315
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/is_object.js
|
|
316
316
|
const isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
317
317
|
function isObject(input) {
|
|
318
318
|
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") return false;
|
|
@@ -323,7 +323,7 @@ function isObject(input) {
|
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
//#endregion
|
|
326
|
-
//#region
|
|
326
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
327
327
|
function checkKeyLength(alg, key) {
|
|
328
328
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
329
329
|
const { modulusLength } = key.algorithm;
|
|
@@ -332,7 +332,7 @@ function checkKeyLength(alg, key) {
|
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
//#endregion
|
|
335
|
-
//#region
|
|
335
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
336
336
|
function subtleMapping(jwk) {
|
|
337
337
|
let algorithm;
|
|
338
338
|
let keyUsages;
|
|
@@ -451,7 +451,7 @@ async function jwkToKey(jwk) {
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
//#endregion
|
|
454
|
-
//#region
|
|
454
|
+
//#region ../../../../node_modules/jose/dist/webapi/key/import.js
|
|
455
455
|
async function importJWK(jwk, alg, options) {
|
|
456
456
|
if (!isObject(jwk)) throw new TypeError("JWK must be an object");
|
|
457
457
|
let ext;
|
|
@@ -486,7 +486,7 @@ async function importJWK(jwk, alg, options) {
|
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
//#endregion
|
|
489
|
-
//#region
|
|
489
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
490
490
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
491
491
|
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) throw new Err("\"crit\" (Critical) Header Parameter MUST be integrity protected");
|
|
492
492
|
if (!protectedHeader || protectedHeader.crit === void 0) return /* @__PURE__ */ new Set();
|
|
@@ -503,7 +503,7 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
//#endregion
|
|
506
|
-
//#region
|
|
506
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
507
507
|
function validateAlgorithms(option, algorithms) {
|
|
508
508
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) throw new TypeError(`"${option}" option must be an array of strings`);
|
|
509
509
|
if (!algorithms) return;
|
|
@@ -511,14 +511,14 @@ function validateAlgorithms(option, algorithms) {
|
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
//#endregion
|
|
514
|
-
//#region
|
|
514
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
515
515
|
const isJWK = (key) => isObject(key) && typeof key.kty === "string";
|
|
516
516
|
const isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
|
|
517
517
|
const isPublicJWK = (key) => key.kty !== "oct" && key.d === void 0 && key.priv === void 0;
|
|
518
518
|
const isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
519
519
|
|
|
520
520
|
//#endregion
|
|
521
|
-
//#region
|
|
521
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
522
522
|
let cache;
|
|
523
523
|
const handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
524
524
|
cache ||= /* @__PURE__ */ new WeakMap();
|
|
@@ -642,7 +642,7 @@ async function normalizeKey(key, alg) {
|
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
//#endregion
|
|
645
|
-
//#region
|
|
645
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
646
646
|
const tag = (key) => key?.[Symbol.toStringTag];
|
|
647
647
|
const jwkMatchesOp = (alg, key, usage) => {
|
|
648
648
|
if (key.use !== void 0) {
|
|
@@ -731,7 +731,7 @@ function checkKeyType(alg, key, usage) {
|
|
|
731
731
|
}
|
|
732
732
|
|
|
733
733
|
//#endregion
|
|
734
|
-
//#region
|
|
734
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
735
735
|
function subtleAlgorithm(alg, algorithm) {
|
|
736
736
|
const hash = `SHA-${alg.slice(-3)}`;
|
|
737
737
|
switch (alg) {
|
|
@@ -771,7 +771,7 @@ function subtleAlgorithm(alg, algorithm) {
|
|
|
771
771
|
}
|
|
772
772
|
|
|
773
773
|
//#endregion
|
|
774
|
-
//#region
|
|
774
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
775
775
|
async function getSigKey(alg, key, usage) {
|
|
776
776
|
if (key instanceof Uint8Array) {
|
|
777
777
|
if (!alg.startsWith("HS")) throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
@@ -785,7 +785,7 @@ async function getSigKey(alg, key, usage) {
|
|
|
785
785
|
}
|
|
786
786
|
|
|
787
787
|
//#endregion
|
|
788
|
-
//#region
|
|
788
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/verify.js
|
|
789
789
|
async function verify(alg, key, signature, data) {
|
|
790
790
|
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
791
791
|
checkKeyLength(alg, cryptoKey);
|
|
@@ -798,7 +798,7 @@ async function verify(alg, key, signature, data) {
|
|
|
798
798
|
}
|
|
799
799
|
|
|
800
800
|
//#endregion
|
|
801
|
-
//#region
|
|
801
|
+
//#region ../../../../node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
802
802
|
async function flattenedVerify(jws, key, options) {
|
|
803
803
|
if (!isObject(jws)) throw new JWSInvalid("Flattened JWS must be an object");
|
|
804
804
|
if (jws.protected === void 0 && jws.header === void 0) throw new JWSInvalid("Flattened JWS must have either of the \"protected\" or \"header\" members");
|
|
@@ -865,7 +865,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
865
865
|
}
|
|
866
866
|
|
|
867
867
|
//#endregion
|
|
868
|
-
//#region
|
|
868
|
+
//#region ../../../../node_modules/jose/dist/webapi/jws/compact/verify.js
|
|
869
869
|
async function compactVerify(jws, key, options) {
|
|
870
870
|
if (jws instanceof Uint8Array) jws = decoder.decode(jws);
|
|
871
871
|
if (typeof jws !== "string") throw new JWSInvalid("Compact JWS must be a string or Uint8Array");
|
|
@@ -888,7 +888,7 @@ async function compactVerify(jws, key, options) {
|
|
|
888
888
|
}
|
|
889
889
|
|
|
890
890
|
//#endregion
|
|
891
|
-
//#region
|
|
891
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/jwt_claims_set.js
|
|
892
892
|
const epoch = (date) => Math.floor(date.getTime() / 1e3);
|
|
893
893
|
const minute = 60;
|
|
894
894
|
const hour = minute * 60;
|
|
@@ -1053,7 +1053,7 @@ var JWTClaimsBuilder = class {
|
|
|
1053
1053
|
};
|
|
1054
1054
|
|
|
1055
1055
|
//#endregion
|
|
1056
|
-
//#region
|
|
1056
|
+
//#region ../../../../node_modules/jose/dist/webapi/jwt/verify.js
|
|
1057
1057
|
async function jwtVerify(jwt, key, options) {
|
|
1058
1058
|
const verified = await compactVerify(jwt, key, options);
|
|
1059
1059
|
if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
@@ -1069,7 +1069,7 @@ async function jwtVerify(jwt, key, options) {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
|
|
1071
1071
|
//#endregion
|
|
1072
|
-
//#region
|
|
1072
|
+
//#region ../../../../node_modules/jose/dist/webapi/lib/sign.js
|
|
1073
1073
|
async function sign(alg, key, data) {
|
|
1074
1074
|
const cryptoKey = await getSigKey(alg, key, "sign");
|
|
1075
1075
|
checkKeyLength(alg, cryptoKey);
|
|
@@ -1078,7 +1078,7 @@ async function sign(alg, key, data) {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
|
|
1080
1080
|
//#endregion
|
|
1081
|
-
//#region
|
|
1081
|
+
//#region ../../../../node_modules/jose/dist/webapi/jws/flattened/sign.js
|
|
1082
1082
|
var FlattenedSign = class {
|
|
1083
1083
|
#payload;
|
|
1084
1084
|
#protectedHeader;
|
|
@@ -1143,7 +1143,7 @@ var FlattenedSign = class {
|
|
|
1143
1143
|
};
|
|
1144
1144
|
|
|
1145
1145
|
//#endregion
|
|
1146
|
-
//#region
|
|
1146
|
+
//#region ../../../../node_modules/jose/dist/webapi/jws/compact/sign.js
|
|
1147
1147
|
var CompactSign = class {
|
|
1148
1148
|
#flattened;
|
|
1149
1149
|
constructor(payload) {
|
|
@@ -1161,7 +1161,7 @@ var CompactSign = class {
|
|
|
1161
1161
|
};
|
|
1162
1162
|
|
|
1163
1163
|
//#endregion
|
|
1164
|
-
//#region
|
|
1164
|
+
//#region ../../../../node_modules/jose/dist/webapi/jwt/sign.js
|
|
1165
1165
|
var SignJWT = class {
|
|
1166
1166
|
#protectedHeader;
|
|
1167
1167
|
#jwt;
|
|
@@ -1209,7 +1209,7 @@ var SignJWT = class {
|
|
|
1209
1209
|
};
|
|
1210
1210
|
|
|
1211
1211
|
//#endregion
|
|
1212
|
-
//#region
|
|
1212
|
+
//#region ../../../../node_modules/jose/dist/webapi/jwks/local.js
|
|
1213
1213
|
function getKtyFromAlg(alg) {
|
|
1214
1214
|
switch (typeof alg === "string" && alg.slice(0, 2)) {
|
|
1215
1215
|
case "RS":
|
|
@@ -1305,7 +1305,7 @@ function createLocalJWKSet(jwks) {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
|
|
1307
1307
|
//#endregion
|
|
1308
|
-
//#region
|
|
1308
|
+
//#region ../../../../node_modules/jose/dist/webapi/jwks/remote.js
|
|
1309
1309
|
function isCloudflareWorkers() {
|
|
1310
1310
|
return typeof WebSocketPair !== "undefined" || typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime !== "undefined" && EdgeRuntime === "vercel";
|
|
1311
1311
|
}
|
|
@@ -1447,7 +1447,7 @@ function createRemoteJWKSet(url, options) {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
|
|
1449
1449
|
//#endregion
|
|
1450
|
-
//#region src/security/providers/JwtProvider.ts
|
|
1450
|
+
//#region ../../src/security/providers/JwtProvider.ts
|
|
1451
1451
|
/**
|
|
1452
1452
|
* Provides utilities for working with JSON Web Tokens (JWT).
|
|
1453
1453
|
*/
|
|
@@ -1549,7 +1549,7 @@ var JwtProvider = class {
|
|
|
1549
1549
|
};
|
|
1550
1550
|
|
|
1551
1551
|
//#endregion
|
|
1552
|
-
//#region src/security/providers/SecurityProvider.ts
|
|
1552
|
+
//#region ../../src/security/providers/SecurityProvider.ts
|
|
1553
1553
|
const DEFAULT_APP_SECRET = "05759934015388327323179852515731";
|
|
1554
1554
|
const envSchema = t.object({ APP_SECRET: t.text({ default: DEFAULT_APP_SECRET }) });
|
|
1555
1555
|
var SecurityProvider = class {
|
|
@@ -1941,7 +1941,7 @@ var SecurityProvider = class {
|
|
|
1941
1941
|
};
|
|
1942
1942
|
|
|
1943
1943
|
//#endregion
|
|
1944
|
-
//#region src/security/primitives/$permission.ts
|
|
1944
|
+
//#region ../../src/security/primitives/$permission.ts
|
|
1945
1945
|
/**
|
|
1946
1946
|
* Create a new permission.
|
|
1947
1947
|
*/
|
|
@@ -1977,7 +1977,7 @@ var PermissionPrimitive = class extends Primitive {
|
|
|
1977
1977
|
$permission[KIND] = PermissionPrimitive;
|
|
1978
1978
|
|
|
1979
1979
|
//#endregion
|
|
1980
|
-
//#region src/security/primitives/$realm.ts
|
|
1980
|
+
//#region ../../src/security/primitives/$realm.ts
|
|
1981
1981
|
/**
|
|
1982
1982
|
* Create a new realm.
|
|
1983
1983
|
*/
|
|
@@ -2132,7 +2132,7 @@ var RealmPrimitive = class extends Primitive {
|
|
|
2132
2132
|
$realm[KIND] = RealmPrimitive;
|
|
2133
2133
|
|
|
2134
2134
|
//#endregion
|
|
2135
|
-
//#region src/security/primitives/$role.ts
|
|
2135
|
+
//#region ../../src/security/primitives/$role.ts
|
|
2136
2136
|
/**
|
|
2137
2137
|
* Create a new role.
|
|
2138
2138
|
*/
|
|
@@ -2170,7 +2170,7 @@ var RolePrimitive = class extends Primitive {
|
|
|
2170
2170
|
$role[KIND] = RolePrimitive;
|
|
2171
2171
|
|
|
2172
2172
|
//#endregion
|
|
2173
|
-
//#region src/security/providers/CryptoProvider.ts
|
|
2173
|
+
//#region ../../src/security/providers/CryptoProvider.ts
|
|
2174
2174
|
const scryptAsync = promisify(scrypt);
|
|
2175
2175
|
var CryptoProvider = class {
|
|
2176
2176
|
async hashPassword(password) {
|
|
@@ -2199,7 +2199,7 @@ var CryptoProvider = class {
|
|
|
2199
2199
|
};
|
|
2200
2200
|
|
|
2201
2201
|
//#endregion
|
|
2202
|
-
//#region src/security/errors/InvalidCredentialsError.ts
|
|
2202
|
+
//#region ../../src/security/errors/InvalidCredentialsError.ts
|
|
2203
2203
|
/**
|
|
2204
2204
|
* Error thrown when the provided credentials are invalid.
|
|
2205
2205
|
*
|
|
@@ -2214,7 +2214,7 @@ var InvalidCredentialsError = class extends UnauthorizedError {
|
|
|
2214
2214
|
};
|
|
2215
2215
|
|
|
2216
2216
|
//#endregion
|
|
2217
|
-
//#region src/security/primitives/$serviceAccount.ts
|
|
2217
|
+
//#region ../../src/security/primitives/$serviceAccount.ts
|
|
2218
2218
|
/**
|
|
2219
2219
|
* Allow to get an access token for a service account.
|
|
2220
2220
|
*
|
|
@@ -2314,7 +2314,7 @@ const $serviceAccount = (options) => {
|
|
|
2314
2314
|
};
|
|
2315
2315
|
|
|
2316
2316
|
//#endregion
|
|
2317
|
-
//#region src/security/schemas/permissionSchema.ts
|
|
2317
|
+
//#region ../../src/security/schemas/permissionSchema.ts
|
|
2318
2318
|
const permissionSchema = t.object({
|
|
2319
2319
|
name: t.text({ description: "Name of the permission." }),
|
|
2320
2320
|
group: t.optional(t.text({ description: "Group of the permission." })),
|
|
@@ -2324,7 +2324,7 @@ const permissionSchema = t.object({
|
|
|
2324
2324
|
});
|
|
2325
2325
|
|
|
2326
2326
|
//#endregion
|
|
2327
|
-
//#region src/security/schemas/roleSchema.ts
|
|
2327
|
+
//#region ../../src/security/schemas/roleSchema.ts
|
|
2328
2328
|
const roleSchema = t.object({
|
|
2329
2329
|
name: t.text({ description: "Name of the role." }),
|
|
2330
2330
|
description: t.optional(t.text({ description: "Describe the role." })),
|
|
@@ -2337,7 +2337,7 @@ const roleSchema = t.object({
|
|
|
2337
2337
|
});
|
|
2338
2338
|
|
|
2339
2339
|
//#endregion
|
|
2340
|
-
//#region src/security/schemas/userAccountInfoSchema.ts
|
|
2340
|
+
//#region ../../src/security/schemas/userAccountInfoSchema.ts
|
|
2341
2341
|
const userAccountInfoSchema = t.object({
|
|
2342
2342
|
id: t.text({ description: "Unique identifier for the user." }),
|
|
2343
2343
|
name: t.optional(t.text({ description: "Full name of the user." })),
|
|
@@ -2353,7 +2353,7 @@ const userAccountInfoSchema = t.object({
|
|
|
2353
2353
|
});
|
|
2354
2354
|
|
|
2355
2355
|
//#endregion
|
|
2356
|
-
//#region src/security/index.ts
|
|
2356
|
+
//#region ../../src/security/index.ts
|
|
2357
2357
|
/**
|
|
2358
2358
|
* Provides comprehensive authentication and authorization capabilities with JWT tokens, role-based access control, and user management.
|
|
2359
2359
|
*
|
|
@@ -2,7 +2,7 @@ import { $inject, $module, Alepha, AlephaError, isFileLike, t } from "alepha";
|
|
|
2
2
|
import { $cache } from "alepha/cache";
|
|
3
3
|
import { $logger } from "alepha/logger";
|
|
4
4
|
|
|
5
|
-
//#region src/server/errors/HttpError.ts
|
|
5
|
+
//#region ../../src/server/errors/HttpError.ts
|
|
6
6
|
const isHttpError = (error, status) => {
|
|
7
7
|
if (!(!!error && typeof error === "object" && "message" in error && typeof error.message === "string" && "status" in error && typeof error.status === "number")) return false;
|
|
8
8
|
if (status) return error.status === status;
|
|
@@ -63,7 +63,7 @@ const errorNameByStatus = {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
//#endregion
|
|
66
|
-
//#region src/server/helpers/isMultipart.ts
|
|
66
|
+
//#region ../../src/server/helpers/isMultipart.ts
|
|
67
67
|
/**
|
|
68
68
|
* Checks if the route has multipart/form-data request body.
|
|
69
69
|
*/
|
|
@@ -77,7 +77,7 @@ const isMultipart = (options) => {
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
//#endregion
|
|
80
|
-
//#region src/server/schemas/errorSchema.ts
|
|
80
|
+
//#region ../../src/server/schemas/errorSchema.ts
|
|
81
81
|
const errorSchema = t.object({
|
|
82
82
|
error: t.text({ description: "HTTP error name" }),
|
|
83
83
|
status: t.integer({ description: "HTTP status code" }),
|
|
@@ -103,7 +103,7 @@ const errorSchema = t.object({
|
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
//#endregion
|
|
106
|
-
//#region src/server/services/HttpClient.ts
|
|
106
|
+
//#region ../../src/server/services/HttpClient.ts
|
|
107
107
|
var HttpClient = class {
|
|
108
108
|
log = $logger();
|
|
109
109
|
alepha = $inject(Alepha);
|
|
@@ -315,7 +315,7 @@ var HttpClient = class {
|
|
|
315
315
|
};
|
|
316
316
|
|
|
317
317
|
//#endregion
|
|
318
|
-
//#region src/server/constants/routeMethods.ts
|
|
318
|
+
//#region ../../src/server/constants/routeMethods.ts
|
|
319
319
|
const routeMethods = [
|
|
320
320
|
"GET",
|
|
321
321
|
"POST",
|
|
@@ -329,7 +329,7 @@ const routeMethods = [
|
|
|
329
329
|
];
|
|
330
330
|
|
|
331
331
|
//#endregion
|
|
332
|
-
//#region src/server/errors/BadRequestError.ts
|
|
332
|
+
//#region ../../src/server/errors/BadRequestError.ts
|
|
333
333
|
var BadRequestError = class extends HttpError {
|
|
334
334
|
constructor(message = "Invalid request body", cause) {
|
|
335
335
|
super({
|
|
@@ -340,7 +340,7 @@ var BadRequestError = class extends HttpError {
|
|
|
340
340
|
};
|
|
341
341
|
|
|
342
342
|
//#endregion
|
|
343
|
-
//#region src/server/errors/ConflictError.ts
|
|
343
|
+
//#region ../../src/server/errors/ConflictError.ts
|
|
344
344
|
var ConflictError = class extends HttpError {
|
|
345
345
|
constructor(message = "Entity already exists", cause) {
|
|
346
346
|
super({
|
|
@@ -351,7 +351,7 @@ var ConflictError = class extends HttpError {
|
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
//#endregion
|
|
354
|
-
//#region src/server/errors/ForbiddenError.ts
|
|
354
|
+
//#region ../../src/server/errors/ForbiddenError.ts
|
|
355
355
|
var ForbiddenError = class extends HttpError {
|
|
356
356
|
constructor(message = "No permission to access this resource", cause) {
|
|
357
357
|
super({
|
|
@@ -362,7 +362,7 @@ var ForbiddenError = class extends HttpError {
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
//#endregion
|
|
365
|
-
//#region src/server/errors/NotFoundError.ts
|
|
365
|
+
//#region ../../src/server/errors/NotFoundError.ts
|
|
366
366
|
var NotFoundError = class extends HttpError {
|
|
367
367
|
constructor(message = "Resource not found", cause) {
|
|
368
368
|
super({
|
|
@@ -373,7 +373,7 @@ var NotFoundError = class extends HttpError {
|
|
|
373
373
|
};
|
|
374
374
|
|
|
375
375
|
//#endregion
|
|
376
|
-
//#region src/server/errors/UnauthorizedError.ts
|
|
376
|
+
//#region ../../src/server/errors/UnauthorizedError.ts
|
|
377
377
|
var UnauthorizedError = class extends HttpError {
|
|
378
378
|
name = "UnauthorizedError";
|
|
379
379
|
constructor(message = "Not allowed to access this resource", cause) {
|
|
@@ -385,7 +385,7 @@ var UnauthorizedError = class extends HttpError {
|
|
|
385
385
|
};
|
|
386
386
|
|
|
387
387
|
//#endregion
|
|
388
|
-
//#region src/server/errors/ValidationError.ts
|
|
388
|
+
//#region ../../src/server/errors/ValidationError.ts
|
|
389
389
|
var ValidationError = class extends HttpError {
|
|
390
390
|
constructor(message = "Validation has failed", cause) {
|
|
391
391
|
super({
|
|
@@ -396,7 +396,7 @@ var ValidationError = class extends HttpError {
|
|
|
396
396
|
};
|
|
397
397
|
|
|
398
398
|
//#endregion
|
|
399
|
-
//#region src/server/helpers/ServerReply.ts
|
|
399
|
+
//#region ../../src/server/helpers/ServerReply.ts
|
|
400
400
|
/**
|
|
401
401
|
* Helper for building server replies.
|
|
402
402
|
*/
|
|
@@ -435,7 +435,7 @@ var ServerReply = class {
|
|
|
435
435
|
};
|
|
436
436
|
|
|
437
437
|
//#endregion
|
|
438
|
-
//#region src/server/schemas/okSchema.ts
|
|
438
|
+
//#region ../../src/server/schemas/okSchema.ts
|
|
439
439
|
const okSchema = t.object({
|
|
440
440
|
ok: t.boolean({ description: "True when operation succeed" }),
|
|
441
441
|
id: t.optional(t.union([t.text(), t.integer()])),
|
|
@@ -446,7 +446,7 @@ const okSchema = t.object({
|
|
|
446
446
|
});
|
|
447
447
|
|
|
448
448
|
//#endregion
|
|
449
|
-
//#region src/server/index.browser.ts
|
|
449
|
+
//#region ../../src/server/index.browser.ts
|
|
450
450
|
const AlephaServer = $module({
|
|
451
451
|
name: "alepha.server",
|
|
452
452
|
primitives: [],
|