@trayio/commons 4.83.0 → 4.84.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PartialRedactionCodec.d.ts","sourceRoot":"","sources":["../../src/codec/PartialRedactionCodec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,qBAAsB,YAAW,KAAK,CAAC,OAAO,CAAC;IAC3D,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAA+B;IAE9D,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAI/B,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC;IAIhD,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,yBAAyB;
|
|
1
|
+
{"version":3,"file":"PartialRedactionCodec.d.ts","sourceRoot":"","sources":["../../src/codec/PartialRedactionCodec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,qBAAsB,YAAW,KAAK,CAAC,OAAO,CAAC;IAC3D,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAA+B;IAE9D,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAI/B,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC;IAIhD,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,yBAAyB;IAsBjC,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,6BAA6B;IAcrC,OAAO,CAAC,wBAAwB,CAM9B;CACF"}
|
|
@@ -47,6 +47,11 @@ class PartialRedactionCodec {
|
|
|
47
47
|
if (Array.isArray(value)) {
|
|
48
48
|
return this.removeNullFromArrayIfPresent(value);
|
|
49
49
|
}
|
|
50
|
+
if (typeof value === 'string' ||
|
|
51
|
+
typeof value === 'number' ||
|
|
52
|
+
typeof value === 'boolean') {
|
|
53
|
+
return this.partiallyRedactPrimitive(value);
|
|
54
|
+
}
|
|
50
55
|
return value;
|
|
51
56
|
}
|
|
52
57
|
removeNullFromArrayIfPresent(value) {
|
|
@@ -24,6 +24,12 @@ describe('PartialRedactionCodec', () => {
|
|
|
24
24
|
};
|
|
25
25
|
expect(actualValue).toStrictEqual(expectedValue);
|
|
26
26
|
});
|
|
27
|
+
it('should redact primitive data', () => {
|
|
28
|
+
const value = 'password';
|
|
29
|
+
const actualValue = PartialRedactionCodec_1.PartialRedactionCodec.instance.encode(value);
|
|
30
|
+
const expectedValue = 'pass.....';
|
|
31
|
+
expect(actualValue).toStrictEqual(expectedValue);
|
|
32
|
+
});
|
|
27
33
|
it('should redact sensitive typed data in nested arrays', () => {
|
|
28
34
|
const value = {
|
|
29
35
|
users: [{ password: 'password', username: 'username' }],
|