@lucaapp/service-utils 1.46.1 → 1.46.2
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.
|
@@ -26,7 +26,7 @@ declare class Money implements Money {
|
|
|
26
26
|
* @deprecated Use getFormattedString in place of getEuroString
|
|
27
27
|
*/
|
|
28
28
|
getEuroString(): string;
|
|
29
|
-
getFormattedString(locale: string): string;
|
|
29
|
+
getFormattedString(locale: string, includeSymbol?: boolean): string;
|
|
30
30
|
percentage(percentage: number): Money;
|
|
31
31
|
min(comparator: Money): Money;
|
|
32
32
|
max(comparator: Money): Money;
|
package/dist/lib/money/money.js
CHANGED
|
@@ -40,9 +40,9 @@ class Money {
|
|
|
40
40
|
getEuroString() {
|
|
41
41
|
return this.getEuroAmount().toFixed(2);
|
|
42
42
|
}
|
|
43
|
-
getFormattedString(locale) {
|
|
43
|
+
getFormattedString(locale, includeSymbol = true) {
|
|
44
44
|
const transactionalLanguage = locale === 'de' ? 'de-DE' : 'en-US';
|
|
45
|
-
|
|
45
|
+
const formattedString = new Intl.NumberFormat(transactionalLanguage, {
|
|
46
46
|
style: 'currency',
|
|
47
47
|
currency: 'EUR',
|
|
48
48
|
minimumFractionDigits: 2,
|
|
@@ -50,6 +50,9 @@ class Money {
|
|
|
50
50
|
})
|
|
51
51
|
.format(this.getEuroAmount())
|
|
52
52
|
.replace(/\s/, ' ');
|
|
53
|
+
return includeSymbol
|
|
54
|
+
? formattedString
|
|
55
|
+
: formattedString.replace(/€|\s/g, '');
|
|
53
56
|
}
|
|
54
57
|
add(addend) {
|
|
55
58
|
return Money.fromAmount(this.value + (addend?.value || 0));
|
|
@@ -6,6 +6,16 @@ import { z } from 'zod';
|
|
|
6
6
|
type JWKS = {
|
|
7
7
|
keys: jose.JWK[];
|
|
8
8
|
};
|
|
9
|
+
export declare enum ServiceIdentityErrorType {
|
|
10
|
+
NO_JWT_PROVIDED = "SERVICE_IDENTITY_NO_JWT_PROVIDED",
|
|
11
|
+
URL_MISMATCH = "SERVICE_IDENTITY_URL_MISMATCH",
|
|
12
|
+
METHOD_MISMATCH = "SERVICE_IDENTITY_METHOD_MISMATCH"
|
|
13
|
+
}
|
|
14
|
+
export declare class ServiceIdentityError extends Error {
|
|
15
|
+
type: ServiceIdentityErrorType;
|
|
16
|
+
meta?: object | undefined;
|
|
17
|
+
constructor(type: ServiceIdentityErrorType, message?: string, meta?: object | undefined);
|
|
18
|
+
}
|
|
9
19
|
declare class ServiceIdentity {
|
|
10
20
|
readonly identityName: string;
|
|
11
21
|
readonly identityKid: string;
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ServiceIdentity = void 0;
|
|
29
|
+
exports.ServiceIdentity = exports.ServiceIdentityError = exports.ServiceIdentityErrorType = void 0;
|
|
30
30
|
const jose = __importStar(require("jose"));
|
|
31
31
|
const url_1 = require("url");
|
|
32
32
|
const boom_1 = require("@hapi/boom");
|
|
@@ -47,7 +47,7 @@ var ServiceIdentityErrorType;
|
|
|
47
47
|
ServiceIdentityErrorType["NO_JWT_PROVIDED"] = "SERVICE_IDENTITY_NO_JWT_PROVIDED";
|
|
48
48
|
ServiceIdentityErrorType["URL_MISMATCH"] = "SERVICE_IDENTITY_URL_MISMATCH";
|
|
49
49
|
ServiceIdentityErrorType["METHOD_MISMATCH"] = "SERVICE_IDENTITY_METHOD_MISMATCH";
|
|
50
|
-
})(ServiceIdentityErrorType || (ServiceIdentityErrorType = {}));
|
|
50
|
+
})(ServiceIdentityErrorType = exports.ServiceIdentityErrorType || (exports.ServiceIdentityErrorType = {}));
|
|
51
51
|
class ServiceIdentityError extends Error {
|
|
52
52
|
constructor(type, message, meta) {
|
|
53
53
|
super(message);
|
|
@@ -55,6 +55,7 @@ class ServiceIdentityError extends Error {
|
|
|
55
55
|
this.meta = meta;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
exports.ServiceIdentityError = ServiceIdentityError;
|
|
58
59
|
class ServiceIdentity {
|
|
59
60
|
constructor(identityName, identityKid, identityPrivateKey, identityPublicKey, debug = false) {
|
|
60
61
|
this.jwksCache = {};
|