@lucaapp/service-utils 5.8.0 → 5.9.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/lib/kafka/events/payment.d.ts +189 -12
- package/dist/lib/kafka/events/payment.js +13 -0
- package/dist/lib/kafka/events.d.ts +2 -1
- package/dist/lib/kafka/events.js +5 -1
- package/dist/lib/kafka/kafkaClient.js +40 -11
- package/dist/lib/metrics/metricsClient.js +17 -7
- package/dist/lib/pgBoss/metrics.js +17 -7
- package/dist/lib/phone/phone.js +17 -7
- package/dist/lib/serviceIdentity/service.d.ts +1 -0
- package/dist/lib/serviceIdentity/service.js +1 -0
- package/dist/lib/serviceIdentity/serviceIdentity.js +17 -7
- package/package.json +6 -6
|
@@ -1,28 +1,205 @@
|
|
|
1
|
-
|
|
1
|
+
import { SupportedCurrencies } from '../../money/supportedCurrencies';
|
|
2
|
+
/**
|
|
3
|
+
* JSON-serialisable value tree.
|
|
4
|
+
*
|
|
5
|
+
* Used for opaque payloads carried across the wire. Anything stored here
|
|
6
|
+
* must round-trip through `JSON.stringify` / `JSON.parse` without loss.
|
|
7
|
+
*/
|
|
8
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
9
|
+
[key: string]: JsonValue;
|
|
10
|
+
};
|
|
11
|
+
/** Legacy 3-letter terminal status code from the original payment provider integration. */
|
|
12
|
+
export type RapydPaymentStatus = 'ACT' | 'CAN' | 'CLO' | 'ERR' | 'EXP' | 'NEW' | 'REV';
|
|
13
|
+
/** Provider-neutral payment lifecycle status. */
|
|
14
|
+
export type PaymentStatus = 'PAID' | 'NEW' | 'ACTIVE' | 'CANCELLED' | 'EXPIRED' | 'REFUNDED' | 'ERROR' | 'UNKNOWN';
|
|
15
|
+
/**
|
|
16
|
+
* Lifecycle timestamps shared by all payment events.
|
|
17
|
+
*
|
|
18
|
+
* Each timestamp marks the first time the payment entered the corresponding
|
|
19
|
+
* state. A null value means the state was never reached.
|
|
20
|
+
*/
|
|
21
|
+
export type PaymentStatusTimings = {
|
|
22
|
+
/** Timestamp when the payment record was created (session start, NOT settlement). */
|
|
23
|
+
paymentCreatedAt: Date;
|
|
24
|
+
/** Payment record created; awaiting consumer action (e.g. order created, link sent, QR displayed). */
|
|
25
|
+
statusNewAt: Date | null;
|
|
26
|
+
/** Consumer engaged with the payment flow (e.g. opened a 3DS challenge, tapped a terminal, clicked the payment link). */
|
|
27
|
+
statusActiveAt: Date | null;
|
|
28
|
+
/** Provider authorised and captured the funds (online auth + capture or terminal sale complete). */
|
|
29
|
+
statusCompleteAt?: Date | null;
|
|
30
|
+
/** Cancelled by consumer or operator before completion. */
|
|
31
|
+
statusCanceledAt: Date | null;
|
|
32
|
+
/** Payment session expired before completion. */
|
|
33
|
+
statusExpiredAt: Date | null;
|
|
34
|
+
/** Provider returned an error or refused the payment. */
|
|
35
|
+
statusErrorAt: Date | null;
|
|
36
|
+
/** Authorised payment was reversed before settlement (e.g. chargeback pre-arbitration). */
|
|
37
|
+
statusReversedAt?: Date | null;
|
|
38
|
+
/** Projected or actual settlement date to the merchant balance. Null until the provider schedules settlement. */
|
|
39
|
+
settleAt?: Date | null;
|
|
40
|
+
};
|
|
41
|
+
/** Fields shared by both the legacy {@link Payment} event and the provider-neutral {@link PaymentEvent}. */
|
|
42
|
+
export type PaymentBase = {
|
|
43
|
+
/** Stable payment id. Uniquely identifies the payment across all systems. */
|
|
2
44
|
uuid: string;
|
|
45
|
+
/** Merchant location id (UUID). */
|
|
3
46
|
locationId: string;
|
|
47
|
+
/** Human-readable location name. Null when not provided. */
|
|
4
48
|
locationName: string | null;
|
|
49
|
+
/** Table or seat identifier from the POS. Null for non-dine-in payments. */
|
|
5
50
|
table: string | null;
|
|
51
|
+
/** Pre-created payment-request id. Null for spontaneous payments. */
|
|
6
52
|
paymentRequestId: string | null;
|
|
7
|
-
|
|
8
|
-
paidAt: Date | null;
|
|
53
|
+
/** Short verifier token used by consumer-facing flows to prove ownership of the payment session. */
|
|
9
54
|
paymentVerifier: string;
|
|
10
|
-
|
|
55
|
+
/** Net goods/services amount before tip, in the smallest currency subunit. */
|
|
11
56
|
invoiceAmount: number;
|
|
57
|
+
/** Consumer-added gratuity, in the smallest currency subunit. Zero when no tip was given. */
|
|
12
58
|
tipAmount: number;
|
|
59
|
+
} & PaymentStatusTimings;
|
|
60
|
+
/**
|
|
61
|
+
* Legacy payment event tied to the original provider integration.
|
|
62
|
+
*
|
|
63
|
+
* Kept for backward compatibility. New consumers should subscribe to
|
|
64
|
+
* {@link PaymentEvent}.
|
|
65
|
+
*/
|
|
66
|
+
export type Payment = PaymentBase & {
|
|
67
|
+
/** Total paid by the consumer (= `invoiceAmount + tipAmount`), in the smallest currency subunit. Kept for legacy consumers. */
|
|
68
|
+
totalAmount: number;
|
|
69
|
+
/** Timestamp when the payment was marked paid. */
|
|
70
|
+
paidAt: Date | null;
|
|
71
|
+
/** @deprecated Legacy terminal "CLO" state. Use `statusCompleteAt`. */
|
|
72
|
+
statusClosedAt: Date | null;
|
|
73
|
+
/** Fixed processing fee, in the smallest currency subunit. */
|
|
13
74
|
fixedFee: number;
|
|
75
|
+
/** Variable fee (commission + markup), in the smallest currency subunit. */
|
|
14
76
|
variableFee: number;
|
|
77
|
+
/** Legacy provider payment id. */
|
|
15
78
|
rapydPaymentId: string | null;
|
|
79
|
+
/** Legacy provider error code on failure. */
|
|
16
80
|
rapydErrorCode: string | null;
|
|
81
|
+
/** Legacy provider error message on failure. */
|
|
17
82
|
rapydErrorMessage: string | null;
|
|
18
|
-
|
|
83
|
+
/** Legacy 3-letter status code from the provider. */
|
|
84
|
+
rapydPaymentStatus: RapydPaymentStatus;
|
|
85
|
+
/** Legacy provider customer / saved-card alias. */
|
|
19
86
|
rapydCustomerId: string | null;
|
|
87
|
+
/** Aggregated payout batch id. Null until the payment is included in a payout. */
|
|
20
88
|
payoutId: string | null;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Provider-neutral payment lifecycle event.
|
|
92
|
+
*
|
|
93
|
+
* Carries the full domain context needed for fiscalisation, receipt
|
|
94
|
+
* rendering, and downstream reconciliation. Wire format is JSON: monetary
|
|
95
|
+
* fields are integers in the smallest currency subunit and `currency`
|
|
96
|
+
* declares the unit.
|
|
97
|
+
*/
|
|
98
|
+
export type PaymentEvent = PaymentBase & {
|
|
99
|
+
/** Checkout session id. Optional — some flows emit payment events without a checkout. */
|
|
100
|
+
checkoutId?: string;
|
|
101
|
+
/** Order id (e.g. POS / fiscalisation order reference). Absent for payments not tied to an order. */
|
|
102
|
+
orderId?: string;
|
|
103
|
+
/** Operator-added service charge / convenience fee, in the smallest currency subunit. Zero if none. */
|
|
104
|
+
surchargeAmount: number;
|
|
105
|
+
/** ISO 4217 code that applies to every monetary field on this event. Single-currency invariant. */
|
|
106
|
+
currency: SupportedCurrencies;
|
|
107
|
+
/** Lifecycle status at event-emission time. */
|
|
108
|
+
status: PaymentStatus;
|
|
109
|
+
/** Method identifier, e.g. `'CARD'`, `'CASH'`, `'WALLET'`. */
|
|
110
|
+
method: string;
|
|
111
|
+
/** True if `method` is a cash variant. Cash flows skip provider webhooks and short-circuit fiscalisation. */
|
|
112
|
+
isCash: boolean;
|
|
113
|
+
/** Origin service identifier (free-form short string). */
|
|
114
|
+
source: string;
|
|
115
|
+
/** Aggregated payout batch id. Null until included in a payout. */
|
|
116
|
+
payoutId?: string | null;
|
|
117
|
+
/** Provider-side identifiers, errors, and raw provider payload. Absent for cash. */
|
|
118
|
+
merchantDetails?: PaymentMerchantDetails;
|
|
119
|
+
/** Card-specific identifiers and terminal context. Absent for non-card methods. */
|
|
120
|
+
cardDetails?: PaymentCardDetails;
|
|
121
|
+
/** Per-item breakdown for fiscalisation and receipt rendering. */
|
|
122
|
+
lineItems?: PaymentEventLineItem[];
|
|
123
|
+
};
|
|
124
|
+
/** Amount the consumer actually pays = `invoiceAmount + tipAmount + surchargeAmount` (smallest currency subunit). */
|
|
125
|
+
export declare const consumerPayAmount: (event: PaymentEvent) => number;
|
|
126
|
+
/**
|
|
127
|
+
* Amount receivable by the operator before Luca / provider fees are
|
|
128
|
+
* deducted = `invoiceAmount + tipAmount` (smallest currency subunit).
|
|
129
|
+
*
|
|
130
|
+
* Surcharge is excluded — it covers the consumer-side fee, not operator
|
|
131
|
+
* revenue. Net payout to the operator is this minus the per-payment fees.
|
|
132
|
+
*/
|
|
133
|
+
export declare const operatorReceivableAmount: (event: PaymentEvent) => number;
|
|
134
|
+
/**
|
|
135
|
+
* Provider-side metadata for a payment.
|
|
136
|
+
*
|
|
137
|
+
* All fields optional — populated by whichever provider handled the
|
|
138
|
+
* payment. Absent on cash and other non-provider flows.
|
|
139
|
+
*/
|
|
140
|
+
export type PaymentMerchantDetails = {
|
|
141
|
+
/** Payment-processor identifier (lowercase short string). Null when not yet routed to a provider. */
|
|
142
|
+
provider?: string | null;
|
|
143
|
+
/** Provider's payment id. Null until the provider authorises. */
|
|
144
|
+
providerIdentifier?: string | null;
|
|
145
|
+
/** Machine-readable error / decline code from the provider. Null on success. */
|
|
146
|
+
providerErrorCode?: string | null;
|
|
147
|
+
/** Human-readable provider error detail. Null on success. */
|
|
148
|
+
providerErrorMessage?: string | null;
|
|
149
|
+
/** Raw provider payload (notification or response body). Used for audits and chargeback evidence. */
|
|
150
|
+
providerData?: {
|
|
151
|
+
[key: string]: JsonValue;
|
|
152
|
+
} | null;
|
|
153
|
+
/** Provider-facing merchant reference used to reconcile internal records against the provider's records. */
|
|
154
|
+
externalReference?: string | null;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Card and terminal context.
|
|
158
|
+
*
|
|
159
|
+
* Card fields populated for card payments; terminal/consumer fields
|
|
160
|
+
* populated when applicable, regardless of card vs. wallet.
|
|
161
|
+
*/
|
|
162
|
+
export type PaymentCardDetails = {
|
|
163
|
+
/** Last 4 digits of the card. Null for non-card methods. */
|
|
164
|
+
last4?: string | null;
|
|
165
|
+
/** Provider authorisation code. Null until authorised. */
|
|
166
|
+
authCode?: string | null;
|
|
167
|
+
/** Saved-card alias for tokenised cards. Null for one-time payments. */
|
|
168
|
+
consumerAlias?: string | null;
|
|
169
|
+
/** Physical terminal id. Null for online / QR payments. */
|
|
170
|
+
terminalId?: string | null;
|
|
171
|
+
/** Consumer account id. Null for anonymous payments. */
|
|
172
|
+
consumerId?: string | null;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* One billable line in the order, used for fiscalisation and receipt
|
|
176
|
+
* rendering.
|
|
177
|
+
*
|
|
178
|
+
* Sub-items represent components of a parent line (e.g. base drink + paid
|
|
179
|
+
* topping) and follow the same shape recursively. Amounts are integers in
|
|
180
|
+
* the smallest currency subunit.
|
|
181
|
+
*/
|
|
182
|
+
export type PaymentEventLineItem = {
|
|
183
|
+
/** Stable line-item id. Omitted on synthetic sub-items that have no own row. */
|
|
184
|
+
uuid?: string;
|
|
185
|
+
/** POS-system menu item / SKU id. Null when not synced from the POS menu. */
|
|
186
|
+
posItemId?: string | null;
|
|
187
|
+
/** Display name (e.g. `'Espresso'`). May be omitted when the consumer can resolve it from `posItemId`. */
|
|
188
|
+
name?: string;
|
|
189
|
+
/** Number of units, e.g. `2` for two coffees. */
|
|
190
|
+
quantity: number;
|
|
191
|
+
/** Price for one unit, in the smallest currency subunit. */
|
|
192
|
+
pricePerUnit: number;
|
|
193
|
+
/** `quantity × pricePerUnit + Σ subItems.totalPrice`, in the smallest currency subunit. */
|
|
194
|
+
totalPrice: number;
|
|
195
|
+
/**
|
|
196
|
+
* VAT / sales-tax rate as a percentage value (e.g. `19` for 19%, `7` for
|
|
197
|
+
* 7%). NOT a decimal fraction — `0.19` would mean 0.19%. Null if
|
|
198
|
+
* tax-exempt or unknown.
|
|
199
|
+
*/
|
|
200
|
+
taxPercentage?: number | null;
|
|
201
|
+
/** Item currency. Typically equals the parent payment currency. */
|
|
202
|
+
currency: SupportedCurrencies;
|
|
203
|
+
/** Recursive components of this line. Each sub-item follows the same shape. */
|
|
204
|
+
subItems?: PaymentEventLineItem[];
|
|
28
205
|
};
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.operatorReceivableAmount = exports.consumerPayAmount = void 0;
|
|
4
|
+
/** Amount the consumer actually pays = `invoiceAmount + tipAmount + surchargeAmount` (smallest currency subunit). */
|
|
5
|
+
const consumerPayAmount = (event) => event.invoiceAmount + event.tipAmount + event.surchargeAmount;
|
|
6
|
+
exports.consumerPayAmount = consumerPayAmount;
|
|
7
|
+
/**
|
|
8
|
+
* Amount receivable by the operator before Luca / provider fees are
|
|
9
|
+
* deducted = `invoiceAmount + tipAmount` (smallest currency subunit).
|
|
10
|
+
*
|
|
11
|
+
* Surcharge is excluded — it covers the consumer-side fee, not operator
|
|
12
|
+
* revenue. Net payout to the operator is this minus the per-payment fees.
|
|
13
|
+
*/
|
|
14
|
+
const operatorReceivableAmount = (event) => event.invoiceAmount + event.tipAmount;
|
|
15
|
+
exports.operatorReceivableAmount = operatorReceivableAmount;
|
|
@@ -82,5 +82,6 @@ declare const MessageIssuer: {
|
|
|
82
82
|
"wsevent_backend-pos": Service;
|
|
83
83
|
tokenization_job_item: Service;
|
|
84
84
|
};
|
|
85
|
-
|
|
85
|
+
declare const MessageSignatureIssuers: Partial<Record<KafkaTopic, Service[]>>;
|
|
86
|
+
export { KafkaTopic, MessageIssuer, MessageSignatureIssuers };
|
|
86
87
|
export type { MessageFormats };
|
package/dist/lib/kafka/events.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageIssuer = exports.KafkaTopic = void 0;
|
|
3
|
+
exports.MessageSignatureIssuers = exports.MessageIssuer = exports.KafkaTopic = void 0;
|
|
4
4
|
const serviceIdentity_1 = require("../serviceIdentity");
|
|
5
5
|
var KafkaTopic;
|
|
6
6
|
(function (KafkaTopic) {
|
|
@@ -48,3 +48,7 @@ const MessageIssuer = {
|
|
|
48
48
|
[KafkaTopic.TOKENIZATION_JOB_ITEM]: serviceIdentity_1.Service.BACKEND_PAY,
|
|
49
49
|
};
|
|
50
50
|
exports.MessageIssuer = MessageIssuer;
|
|
51
|
+
const MessageSignatureIssuers = {
|
|
52
|
+
[KafkaTopic.PAYMENTS]: [serviceIdentity_1.Service.BACKEND_PAY, serviceIdentity_1.Service.BACKEND_TSE],
|
|
53
|
+
};
|
|
54
|
+
exports.MessageSignatureIssuers = MessageSignatureIssuers;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.KafkaClient = void 0;
|
|
27
37
|
const kafkajs_1 = require("kafkajs");
|
|
@@ -61,6 +71,18 @@ const messageAcknowledgedCounter = new metrics_1.metricsClient.Counter({
|
|
|
61
71
|
const getIssuer = (kafkaTopic) => {
|
|
62
72
|
return events_1.MessageIssuer[kafkaTopic].valueOf();
|
|
63
73
|
};
|
|
74
|
+
const getAllowedSignatureIssuers = (kafkaTopic) => {
|
|
75
|
+
return (events_1.MessageSignatureIssuers[kafkaTopic] ?? [events_1.MessageIssuer[kafkaTopic]]).map(issuer => issuer.valueOf());
|
|
76
|
+
};
|
|
77
|
+
const headerToString = (header) => {
|
|
78
|
+
if (Array.isArray(header)) {
|
|
79
|
+
return headerToString(header[0]);
|
|
80
|
+
}
|
|
81
|
+
if (Buffer.isBuffer(header)) {
|
|
82
|
+
return header.toString();
|
|
83
|
+
}
|
|
84
|
+
return header;
|
|
85
|
+
};
|
|
64
86
|
class KafkaClient {
|
|
65
87
|
constructor(parentLogger, kafkaConfig, topicSecrets, serviceIdentity) {
|
|
66
88
|
this.connect = async () => {
|
|
@@ -119,11 +141,15 @@ class KafkaClient {
|
|
|
119
141
|
this.logger.info('Skipping signature verification (encryption disabled)');
|
|
120
142
|
return;
|
|
121
143
|
}
|
|
122
|
-
|
|
144
|
+
const signature = headerToString(headers?.signature);
|
|
145
|
+
if (!signature) {
|
|
123
146
|
throw (0, utils_1.logAndGetError)(this.logger, 'Unable to verify signature. Expected header not present');
|
|
124
147
|
}
|
|
125
|
-
const issuer = getIssuer(kafkaTopic);
|
|
126
|
-
const
|
|
148
|
+
const issuer = headerToString(headers?.signatureIssuer) ?? getIssuer(kafkaTopic);
|
|
149
|
+
const allowedIssuers = getAllowedSignatureIssuers(kafkaTopic);
|
|
150
|
+
if (!allowedIssuers.includes(issuer)) {
|
|
151
|
+
throw (0, utils_1.logAndGetError)(this.logger, `Unable to verify signature. Issuer ${issuer} is not allowed for topic=${kafkaTopic}`);
|
|
152
|
+
}
|
|
127
153
|
const jwks = await this.serviceIdentity.getRemoteJWKS(issuer);
|
|
128
154
|
if (!jwks) {
|
|
129
155
|
throw (0, utils_1.logAndGetError)(this.logger, `Unable to find jwks for issuer=${issuer}`);
|
|
@@ -230,7 +256,10 @@ class KafkaClient {
|
|
|
230
256
|
{
|
|
231
257
|
key,
|
|
232
258
|
value: encryptedValue,
|
|
233
|
-
headers: {
|
|
259
|
+
headers: {
|
|
260
|
+
signature,
|
|
261
|
+
signatureIssuer: this.serviceIdentity.identityName,
|
|
262
|
+
},
|
|
234
263
|
},
|
|
235
264
|
],
|
|
236
265
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.metricsClient = void 0;
|
|
27
37
|
exports.metricsClient = __importStar(require("prom-client"));
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/dist/lib/phone/phone.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.normalizePhoneNumber = exports.getPhoneType = exports.getPhoneCountry = exports.parsePhone = exports.formatPhoneNumber = exports.tryParsePhoneNumber = exports.getFormattedPhoneNumber = exports.isValidMobilePhoneNumber = exports.isValidPhoneNumber = exports.OutputFormat = void 0;
|
|
27
37
|
const max_1 = __importStar(require("libphonenumber-js/max"));
|
|
@@ -7,6 +7,7 @@ var Service;
|
|
|
7
7
|
Service["BACKEND_PAY"] = "backend-pay";
|
|
8
8
|
Service["BACKEND_POS"] = "backend-pos";
|
|
9
9
|
Service["BACKEND_PUBSUB"] = "backend-pubsub";
|
|
10
|
+
Service["BACKEND_TSE"] = "backend-tse";
|
|
10
11
|
Service["BACKEND_PYTHON"] = "backend-python";
|
|
11
12
|
Service["BACKEND_LINK"] = "backend-link";
|
|
12
13
|
Service["MASTRA"] = "mastra";
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucaapp/service-utils",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"test": "vitest run",
|
|
16
16
|
"test:coverage": "vitest run --coverage",
|
|
17
17
|
"test:ci": "VITEST_JUNIT_SUITE_NAME=service-utils CI=true vitest run --coverage",
|
|
18
|
-
"audit": "
|
|
18
|
+
"audit:osv": "yarn-osv-audit"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@aws-sdk/lib-storage": "^3.1035.0",
|
|
25
25
|
"@hapi/boom": "^10.0.1",
|
|
26
26
|
"@sentry/node": "^9.10.1",
|
|
27
|
-
"@tsconfig/
|
|
27
|
+
"@tsconfig/node24": "24.0.0",
|
|
28
28
|
"@types/express": "4.17.23",
|
|
29
29
|
"@types/express-serve-static-core": "^4.17.43",
|
|
30
30
|
"@types/node": "22.13.11",
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"eslint": "8.57.0",
|
|
75
75
|
"eslint-plugin-prettier": "4.2.1",
|
|
76
76
|
"eslint-plugin-vitest": "0.4.1",
|
|
77
|
-
"
|
|
77
|
+
"yarn-osv-audit": "0.1.8",
|
|
78
78
|
"prettier": "2.7.1",
|
|
79
79
|
"semantic-release": "^25.0.3",
|
|
80
80
|
"semantic-release-monorepo": "8.0.2",
|
|
81
|
-
"supertest": "
|
|
82
|
-
"typescript": "
|
|
81
|
+
"supertest": "6.3.4",
|
|
82
|
+
"typescript": "6.0.2",
|
|
83
83
|
"vite-tsconfig-paths": "4.3.2",
|
|
84
84
|
"vitest": "4.1.1"
|
|
85
85
|
},
|