@fiado/type-kit 3.340.0 → 3.341.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/bin/common/constants/CreditIdPattern.d.ts +8 -0
- package/bin/common/constants/CreditIdPattern.js +11 -0
- package/bin/loanCredit/constants/CreditIdPattern.d.ts +3 -5
- package/bin/loanCredit/constants/CreditIdPattern.js +6 -6
- package/bin/mdm/dtos/DeviceEnrollRequest.js +2 -1
- package/package.json +1 -1
- package/src/common/constants/CreditIdPattern.ts +9 -0
- package/src/loanCredit/constants/CreditIdPattern.ts +3 -6
- package/src/mdm/dtos/DeviceEnrollRequest.ts +3 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formato del identificador de crédito: ULID canónico de 26 chars en Crockford base32.
|
|
3
|
+
* `loan-credit-business` lo genera con `ulid()`, no con UUID — validar UUID rechaza todos los
|
|
4
|
+
* créditos reales. Vive en `common` porque lo comparten el contrato de `loanCredit` y el de `mdm`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CREDIT_ID_PATTERN: RegExp;
|
|
7
|
+
/** Mensaje único, para que el caller no tenga que adivinar el formato. */
|
|
8
|
+
export declare const CREDIT_ID_MESSAGE = "creditId debe ser un ULID de 26 caracteres";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CREDIT_ID_MESSAGE = exports.CREDIT_ID_PATTERN = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Formato del identificador de crédito: ULID canónico de 26 chars en Crockford base32.
|
|
6
|
+
* `loan-credit-business` lo genera con `ulid()`, no con UUID — validar UUID rechaza todos los
|
|
7
|
+
* créditos reales. Vive en `common` porque lo comparten el contrato de `loanCredit` y el de `mdm`.
|
|
8
|
+
*/
|
|
9
|
+
exports.CREDIT_ID_PATTERN = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
|
|
10
|
+
/** Mensaje único, para que el caller no tenga que adivinar el formato. */
|
|
11
|
+
exports.CREDIT_ID_MESSAGE = 'creditId debe ser un ULID de 26 caracteres';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* El formato del `creditId` vive en `common`: lo comparten este contrato y el de `mdm`.
|
|
3
|
+
* Se re-exporta acá para no romper a quien ya lo importaba desde `loanCredit`.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
/** Mensaje único de los 6 endpoints de dispositivo, para que el caller no adivine el formato. */
|
|
7
|
-
export declare const CREDIT_ID_MESSAGE = "creditId debe ser un ULID de 26 caracteres";
|
|
5
|
+
export { CREDIT_ID_MESSAGE, CREDIT_ID_PATTERN } from '../../common/constants/CreditIdPattern';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CREDIT_ID_PATTERN = exports.CREDIT_ID_MESSAGE = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* El formato del `creditId` vive en `common`: lo comparten este contrato y el de `mdm`.
|
|
6
|
+
* Se re-exporta acá para no romper a quien ya lo importaba desde `loanCredit`.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports
|
|
8
|
+
var CreditIdPattern_1 = require("../../common/constants/CreditIdPattern");
|
|
9
|
+
Object.defineProperty(exports, "CREDIT_ID_MESSAGE", { enumerable: true, get: function () { return CreditIdPattern_1.CREDIT_ID_MESSAGE; } });
|
|
10
|
+
Object.defineProperty(exports, "CREDIT_ID_PATTERN", { enumerable: true, get: function () { return CreditIdPattern_1.CREDIT_ID_PATTERN; } });
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.DeviceEnrollRequest = void 0;
|
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
|
+
const CreditIdPattern_1 = require("../../common/constants/CreditIdPattern");
|
|
15
16
|
class DeviceEnrollRequest {
|
|
16
17
|
}
|
|
17
18
|
exports.DeviceEnrollRequest = DeviceEnrollRequest;
|
|
@@ -41,7 +42,7 @@ __decorate([
|
|
|
41
42
|
], DeviceEnrollRequest.prototype, "model", void 0);
|
|
42
43
|
__decorate([
|
|
43
44
|
(0, class_transformer_1.Expose)(),
|
|
44
|
-
(0, class_validator_1.
|
|
45
|
+
(0, class_validator_1.Matches)(CreditIdPattern_1.CREDIT_ID_PATTERN, { message: CreditIdPattern_1.CREDIT_ID_MESSAGE }),
|
|
45
46
|
__metadata("design:type", String)
|
|
46
47
|
], DeviceEnrollRequest.prototype, "creditId", void 0);
|
|
47
48
|
__decorate([
|
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formato del identificador de crédito: ULID canónico de 26 chars en Crockford base32.
|
|
3
|
+
* `loan-credit-business` lo genera con `ulid()`, no con UUID — validar UUID rechaza todos los
|
|
4
|
+
* créditos reales. Vive en `common` porque lo comparten el contrato de `loanCredit` y el de `mdm`.
|
|
5
|
+
*/
|
|
6
|
+
export const CREDIT_ID_PATTERN = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
|
|
7
|
+
|
|
8
|
+
/** Mensaje único, para que el caller no tenga que adivinar el formato. */
|
|
9
|
+
export const CREDIT_ID_MESSAGE = 'creditId debe ser un ULID de 26 caracteres';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* El formato del `creditId` vive en `common`: lo comparten este contrato y el de `mdm`.
|
|
3
|
+
* Se re-exporta acá para no romper a quien ya lo importaba desde `loanCredit`.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
/** Mensaje único de los 6 endpoints de dispositivo, para que el caller no adivine el formato. */
|
|
8
|
-
export const CREDIT_ID_MESSAGE = 'creditId debe ser un ULID de 26 caracteres';
|
|
5
|
+
export { CREDIT_ID_MESSAGE, CREDIT_ID_PATTERN } from '../../common/constants/CreditIdPattern';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Expose } from "class-transformer";
|
|
2
|
-
import { IsString, IsNotEmpty, IsOptional, IsNumber, IsPositive,
|
|
2
|
+
import { IsString, IsNotEmpty, IsOptional, IsNumber, IsPositive, Matches } from "class-validator";
|
|
3
|
+
import { CREDIT_ID_MESSAGE, CREDIT_ID_PATTERN } from "../../common/constants/CreditIdPattern";
|
|
3
4
|
|
|
4
5
|
export class DeviceEnrollRequest {
|
|
5
6
|
@Expose()
|
|
@@ -23,7 +24,7 @@ export class DeviceEnrollRequest {
|
|
|
23
24
|
model?: string;
|
|
24
25
|
|
|
25
26
|
@Expose()
|
|
26
|
-
@
|
|
27
|
+
@Matches(CREDIT_ID_PATTERN, { message: CREDIT_ID_MESSAGE })
|
|
27
28
|
creditId: string;
|
|
28
29
|
|
|
29
30
|
@Expose()
|