Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alwaysmeticulous/redaction

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alwaysmeticulous/redaction - npm Package Compare versions

Comparing version 2.187.0 to 2.188.0

9

dist/index.d.ts

@@ -148,3 +148,3 @@ import { RecorderMiddleware, NetworkResponseMetadata } from "@alwaysmeticulous/sdk-bundles-api";

export const OTHER_PII_REDACTORS: PatternBasedRedactorSet<"address" | `${string}addressLine1` | `${string}address_line_1` | `${string}homeAddress` | `${string}home_address` | `${string}postalAddress` | `${string}postal_address` | `${string}phone` | `${string}Phone` | `${string}phone_number` | `${string}ssn` | `${string}SSN` | `${string}username` | `${string}Username` | `${string}user_name` | `${string}credit_card` | `${string}creditCard` | `${string}credit_card_number` | `${string}creditCardNumber` | `${string}cvc` | `${string}CVC`, string>;
export const FREE_TEXT_REDACTORS: PatternBasedRedactorSet<`${string}text` | `${string}description` | `${string}summary` | `${string}title`, string>;
export const FREE_TEXT_REDACTORS: PatternBasedRedactorSet<`${string}text` | `${string}description` | `${string}summary` | `${string}title` | `${string}Text` | `${string}Description` | `${string}Summary` | `${string}Title`, string>;
export const redactDateOfBirth: (_: Date) => Date;

@@ -162,3 +162,3 @@ export const DOB_REDACTORS: PatternBasedRedactorSet<`${string}dob` | `${string}DOB` | `${string}date_of_birth` | `${string}dateOfBirth` | `${string}DateOfBirth` | `${string}birthDate` | `${string}BirthDate` | `${string}birth_date`, Date>;

export const ALL_STRING_FIELDS_THAT_DEFAULT_TO_NO_REDACTION: PatternBasedRedactorSet<"id" | `${string}Id` | `${string}ID` | `${string}_id` | `${string}uuid` | `${string}UUID` | `${string}uuidv4` | `${string}UUIDv4` | `${string}guid` | `${string}GUID` | `${string}Guid` | "type" | `${string}Type` | `${string}_type` | `${string}TYPE` | "kind" | `${string}Kind` | `${string}_kind` | `${string}ed_at` | `${string}edAt`, string>;
export const ALL_DEFAULT_STRING_REDACTORS: PatternBasedRedactorSet<"name" | `${string}_name` | `${string}ullName` | `${string}irstname` | `${string}astname` | `${string}url` | `${string}uri` | `${string}link` | `${string}href` | `${string}Url` | `${string}Uri` | `${string}Link` | `${string}Href` | "address" | `${string}addressLine1` | `${string}address_line_1` | `${string}homeAddress` | `${string}home_address` | `${string}postalAddress` | `${string}postal_address` | `${string}phone` | `${string}Phone` | `${string}phone_number` | `${string}ssn` | `${string}SSN` | `${string}username` | `${string}Username` | `${string}user_name` | `${string}credit_card` | `${string}creditCard` | `${string}credit_card_number` | `${string}creditCardNumber` | `${string}cvc` | `${string}CVC` | `${string}text` | `${string}description` | `${string}summary` | `${string}title` | "id" | `${string}Id` | `${string}ID` | `${string}_id` | `${string}uuid` | `${string}UUID` | `${string}uuidv4` | `${string}UUIDv4` | `${string}guid` | `${string}GUID` | `${string}Guid` | "type" | `${string}Type` | `${string}_type` | `${string}TYPE` | "kind" | `${string}Kind` | `${string}_kind` | `${string}ed_at` | `${string}edAt`, string>;
export const ALL_DEFAULT_STRING_REDACTORS: PatternBasedRedactorSet<"name" | `${string}_name` | `${string}ullName` | `${string}irstname` | `${string}astname` | `${string}url` | `${string}uri` | `${string}link` | `${string}href` | `${string}Url` | `${string}Uri` | `${string}Link` | `${string}Href` | "address" | `${string}addressLine1` | `${string}address_line_1` | `${string}homeAddress` | `${string}home_address` | `${string}postalAddress` | `${string}postal_address` | `${string}phone` | `${string}Phone` | `${string}phone_number` | `${string}ssn` | `${string}SSN` | `${string}username` | `${string}Username` | `${string}user_name` | `${string}credit_card` | `${string}creditCard` | `${string}credit_card_number` | `${string}creditCardNumber` | `${string}cvc` | `${string}CVC` | `${string}text` | `${string}description` | `${string}summary` | `${string}title` | `${string}Text` | `${string}Description` | `${string}Summary` | `${string}Title` | "id" | `${string}Id` | `${string}ID` | `${string}_id` | `${string}uuid` | `${string}UUID` | `${string}uuidv4` | `${string}UUIDv4` | `${string}guid` | `${string}GUID` | `${string}Guid` | "type" | `${string}Type` | `${string}_type` | `${string}TYPE` | "kind" | `${string}Kind` | `${string}_kind` | `${string}ed_at` | `${string}edAt`, string>;
export const ALL_DEFAULT_DATE_REDACTORS: PatternBasedRedactorSet<`${string}dob` | `${string}DOB` | `${string}date_of_birth` | `${string}dateOfBirth` | `${string}DateOfBirth` | `${string}birthDate` | `${string}BirthDate` | `${string}birth_date`, Date>;

@@ -189,3 +189,4 @@ type IsFixedStringUnion<T> = T extends string ? string extends T ? false : true : false;

*/
static builderWithDefaults(): NestedFieldsRedactor<"name" | `${string}_name` | `${string}ullName` | `${string}irstname` | `${string}astname` | `${string}url` | `${string}uri` | `${string}link` | `${string}href` | `${string}Url` | `${string}Uri` | `${string}Link` | `${string}Href` | "address" | `${string}addressLine1` | `${string}address_line_1` | `${string}homeAddress` | `${string}home_address` | `${string}postalAddress` | `${string}postal_address` | `${string}phone` | `${string}Phone` | `${string}phone_number` | `${string}ssn` | `${string}SSN` | `${string}username` | `${string}Username` | `${string}user_name` | `${string}credit_card` | `${string}creditCard` | `${string}credit_card_number` | `${string}creditCardNumber` | `${string}cvc` | `${string}CVC` | `${string}text` | `${string}description` | `${string}summary` | `${string}title` | "id" | `${string}Id` | `${string}ID` | `${string}_id` | `${string}uuid` | `${string}UUID` | `${string}uuidv4` | `${string}UUIDv4` | `${string}guid` | `${string}GUID` | `${string}Guid` | "type" | `${string}Type` | `${string}_type` | `${string}TYPE` | "kind" | `${string}Kind` | `${string}_kind` | `${string}ed_at` | `${string}edAt`, `${string}dob` | `${string}DOB` | `${string}date_of_birth` | `${string}dateOfBirth` | `${string}DateOfBirth` | `${string}birthDate` | `${string}BirthDate` | `${string}birth_date`>;
static builderWithDefaults(): NestedFieldsRedactor<"name" | `${string}_name` | `${string}ullName` | `${string}irstname` | `${string}astname` | `${string}url` | `${string}uri` | `${string}link` | `${string}href` | `${string}Url` | `${string}Uri` | `${string}Link` | `${string}Href` | "address" | `${string}addressLine1` | `${string}address_line_1` | `${string}homeAddress` | `${string}home_address` | `${string}postalAddress` | `${string}postal_address` | `${string}phone` | `${string}Phone` | `${string}phone_number` | `${string}ssn` | `${string}SSN` | `${string}username` | `${string}Username` | `${string}user_name` | `${string}credit_card` | `${string}creditCard` | `${string}credit_card_number` | `${string}creditCardNumber` | `${string}cvc` | `${string}CVC` | `${string}text` | `${string}description` | `${string}summary` | `${string}title` | `${string}Text` | `${string}Description` | `${string}Summary` | `${string}Title` | "id" | `${string}Id` | `${string}ID` | `${string}_id` | `${string}uuid` | `${string}UUID` | `${string}uuidv4` | `${string}UUIDv4` | `${string}guid` | `${string}GUID` | `${string}Guid` | "type" | `${string}Type` | `${string}_type` | `${string}TYPE` | "kind" | `${string}Kind` | `${string}_kind` | `${string}ed_at` | `${string}edAt`, `${string}dob` | `${string}DOB` | `${string}date_of_birth` | `${string}dateOfBirth` | `${string}DateOfBirth` | `${string}birthDate` | `${string}BirthDate` | `${string}birth_date`>;
withDefaultStringRedactor(redactor: Redactor<string>): NestedFieldsRedactor<HANDLED_STRING_KEY_TYPES, HANDLED_DATE_KEY_TYPES>;
withPatternBasedStringRedactor<KEY_TYPE extends string>(redactor: PatternBasedRedactor<KEY_TYPE, string>): NestedFieldsRedactor<HANDLED_STRING_KEY_TYPES & KEY_TYPE, HANDLED_DATE_KEY_TYPES>;

@@ -215,3 +216,3 @@ withPatternBasedStringRedactors<KEY_TYPE extends string>(set: PatternBasedRedactorSet<KEY_TYPE, string>): NestedFieldsRedactor<HANDLED_STRING_KEY_TYPES | KEY_TYPE, HANDLED_DATE_KEY_TYPES>;

}): (value: T) => T;
redactNestedStringFieldsNonTypeSafe: <T>(opts: {
createRedactorLax: <T>(opts: {
strings: Record<string, Redactor<string>>;

@@ -218,0 +219,0 @@ dates?: Record<string, Redactor<Date>>;

@@ -48,2 +48,3 @@ function $parcel$exportWildcard(dest, source) {

parsed = JSON.parse(response.content.text ?? "");
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (_e) {

@@ -216,2 +217,3 @@ // If it's not valid JSON we assume it is an error/failed response so doesn't need to be redacted

return parsedUrl.toString();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (_e) {

@@ -281,3 +283,3 @@ return (0, $8775099367f3effc$export$62d597f0a8051e9a)(url);

const $ae48da3a2344a35c$export$8f52f6621375b80d = (0, $7b7fa2c19d7d6971$export$8a444b6ebcf2fa34).create().with((0, $7b7fa2c19d7d6971$export$5ce15c50c7ba440c)("address", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("addressLine1", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("address_line_1", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("homeAddress", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("home_address", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("postalAddress", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("postal_address", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("phone", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("Phone", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("phone_number", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("ssn", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("SSN", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("username", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("Username", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("user_name", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("credit_card", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("creditCard", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("credit_card_number", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("creditCardNumber", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("cvc", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("CVC", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4)));
const $ae48da3a2344a35c$export$e0b3ed47ae4f0dc = (0, $7b7fa2c19d7d6971$export$8a444b6ebcf2fa34).create().with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("text", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("description", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("summary", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("title", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4)));
const $ae48da3a2344a35c$export$e0b3ed47ae4f0dc = (0, $7b7fa2c19d7d6971$export$8a444b6ebcf2fa34).create().with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("text", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("description", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("summary", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("title", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("Text", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("Description", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("Summary", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4))).with((0, $7b7fa2c19d7d6971$export$7f66c2e43b8445a5)("Title", (0, $3c0b7b2278f26fd3$export$9791de86fcee0c4)));
const $ae48da3a2344a35c$export$f02f7a62000ad1ea = (_)=>{

@@ -297,6 +299,7 @@ return new Date(0);

class $042914f81553c43b$export$a0063b118a222d07 {
constructor(stringRedactors, dateRedactors){
constructor(stringRedactors, dateRedactors, defaultStringRedactor){
this.stringRedactors = stringRedactors;
this.dateRedactors = dateRedactors;
this.redactNestedStringFieldsNonTypeSafe = (opts)=>{
this.defaultStringRedactor = defaultStringRedactor;
this.createRedactorLax = (opts)=>{
return $042914f81553c43b$var$createRedactor({

@@ -323,2 +326,5 @@ ...opts,

}
withDefaultStringRedactor(redactor) {
return new $042914f81553c43b$export$a0063b118a222d07(this.stringRedactors, this.dateRedactors, redactor);
}
withPatternBasedStringRedactor(redactor) {

@@ -373,3 +379,17 @@ return new $042914f81553c43b$export$a0063b118a222d07([

}
const $042914f81553c43b$var$createRedactor = ({ strings: strings , dates: dates , numbers: numbers , bigints: bigints , patternBasedRedactors: patternBasedRedactors })=>{
const $042914f81553c43b$var$createRedactor = ({ strings: strings , dates: dates , numbers: numbers , bigints: bigints , patternBasedRedactors: patternBasedRedactors , defaultStringRedactor: defaultStringRedactor })=>{
const indexedPatternBasedStringRedactors = {
byTrailingBigram: {},
other: []
};
for (const redactor of patternBasedRedactors.strings){
const keyMatch = redactor.type === "key-postfix" ? redactor.postfix : redactor.key;
if (keyMatch.length >= 2) {
const trailingBigram = keyMatch.slice(-2);
indexedPatternBasedStringRedactors.byTrailingBigram[trailingBigram] = [
...indexedPatternBasedStringRedactors.byTrailingBigram[trailingBigram] ?? [],
redactor
];
} else indexedPatternBasedStringRedactors.other.push(redactor);
}
const redactFn = (value, key)=>{

@@ -380,5 +400,5 @@ if (value == null || typeof value === "boolean" || typeof value === "function" || typeof value === "symbol") return value;

if (!fieldRedactor) {
const patternBasedRedactor = key ? $042914f81553c43b$var$findApplicablePatternBasedRedactor(key, patternBasedRedactors.strings) : null;
const patternBasedRedactor = key ? $042914f81553c43b$var$findApplicablePatternBasedStringRedactor(key, indexedPatternBasedStringRedactors) : null;
if (patternBasedRedactor) return patternBasedRedactor.redactor(value);
return value;
return defaultStringRedactor ? defaultStringRedactor(value) : value;
}

@@ -444,2 +464,9 @@ return fieldRedactor(value);

};
const $042914f81553c43b$var$findApplicablePatternBasedStringRedactor = (key, indexedPatternBasedStringRedactors)=>{
const redactor = $042914f81553c43b$var$findApplicablePatternBasedRedactor(key, indexedPatternBasedStringRedactors.other);
if (redactor || key.length < 2) return redactor;
const redactorsMatchingBigram = indexedPatternBasedStringRedactors.byTrailingBigram[key.slice(-2)] ?? [];
if (redactorsMatchingBigram.length === 0) return null;
return $042914f81553c43b$var$findApplicablePatternBasedRedactor(key, redactorsMatchingBigram);
};

@@ -446,0 +473,0 @@

@@ -32,2 +32,3 @@ function $parcel$export(e, n, v, s) {

parsed = JSON.parse(response.content.text ?? "");
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (_e) {

@@ -200,2 +201,3 @@ // If it's not valid JSON we assume it is an error/failed response so doesn't need to be redacted

return parsedUrl.toString();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (_e) {

@@ -265,3 +267,3 @@ return (0, $39db114007ea6380$export$62d597f0a8051e9a)(url);

const $453ce7387c3361c5$export$8f52f6621375b80d = (0, $c2da2f7939ccb281$export$8a444b6ebcf2fa34).create().with((0, $c2da2f7939ccb281$export$5ce15c50c7ba440c)("address", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("addressLine1", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("address_line_1", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("homeAddress", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("home_address", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("postalAddress", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("postal_address", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("phone", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("Phone", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("phone_number", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("ssn", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("SSN", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("username", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("Username", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("user_name", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("credit_card", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("creditCard", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("credit_card_number", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("creditCardNumber", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("cvc", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("CVC", (0, $e449d9aabbf31633$export$9791de86fcee0c4)));
const $453ce7387c3361c5$export$e0b3ed47ae4f0dc = (0, $c2da2f7939ccb281$export$8a444b6ebcf2fa34).create().with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("text", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("description", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("summary", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("title", (0, $e449d9aabbf31633$export$9791de86fcee0c4)));
const $453ce7387c3361c5$export$e0b3ed47ae4f0dc = (0, $c2da2f7939ccb281$export$8a444b6ebcf2fa34).create().with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("text", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("description", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("summary", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("title", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("Text", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("Description", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("Summary", (0, $e449d9aabbf31633$export$9791de86fcee0c4))).with((0, $c2da2f7939ccb281$export$7f66c2e43b8445a5)("Title", (0, $e449d9aabbf31633$export$9791de86fcee0c4)));
const $453ce7387c3361c5$export$f02f7a62000ad1ea = (_)=>{

@@ -281,6 +283,7 @@ return new Date(0);

class $4a36c7f8b55737fa$export$a0063b118a222d07 {
constructor(stringRedactors, dateRedactors){
constructor(stringRedactors, dateRedactors, defaultStringRedactor){
this.stringRedactors = stringRedactors;
this.dateRedactors = dateRedactors;
this.redactNestedStringFieldsNonTypeSafe = (opts)=>{
this.defaultStringRedactor = defaultStringRedactor;
this.createRedactorLax = (opts)=>{
return $4a36c7f8b55737fa$var$createRedactor({

@@ -307,2 +310,5 @@ ...opts,

}
withDefaultStringRedactor(redactor) {
return new $4a36c7f8b55737fa$export$a0063b118a222d07(this.stringRedactors, this.dateRedactors, redactor);
}
withPatternBasedStringRedactor(redactor) {

@@ -357,3 +363,17 @@ return new $4a36c7f8b55737fa$export$a0063b118a222d07([

}
const $4a36c7f8b55737fa$var$createRedactor = ({ strings: strings , dates: dates , numbers: numbers , bigints: bigints , patternBasedRedactors: patternBasedRedactors })=>{
const $4a36c7f8b55737fa$var$createRedactor = ({ strings: strings , dates: dates , numbers: numbers , bigints: bigints , patternBasedRedactors: patternBasedRedactors , defaultStringRedactor: defaultStringRedactor })=>{
const indexedPatternBasedStringRedactors = {
byTrailingBigram: {},
other: []
};
for (const redactor of patternBasedRedactors.strings){
const keyMatch = redactor.type === "key-postfix" ? redactor.postfix : redactor.key;
if (keyMatch.length >= 2) {
const trailingBigram = keyMatch.slice(-2);
indexedPatternBasedStringRedactors.byTrailingBigram[trailingBigram] = [
...indexedPatternBasedStringRedactors.byTrailingBigram[trailingBigram] ?? [],
redactor
];
} else indexedPatternBasedStringRedactors.other.push(redactor);
}
const redactFn = (value, key)=>{

@@ -364,5 +384,5 @@ if (value == null || typeof value === "boolean" || typeof value === "function" || typeof value === "symbol") return value;

if (!fieldRedactor) {
const patternBasedRedactor = key ? $4a36c7f8b55737fa$var$findApplicablePatternBasedRedactor(key, patternBasedRedactors.strings) : null;
const patternBasedRedactor = key ? $4a36c7f8b55737fa$var$findApplicablePatternBasedStringRedactor(key, indexedPatternBasedStringRedactors) : null;
if (patternBasedRedactor) return patternBasedRedactor.redactor(value);
return value;
return defaultStringRedactor ? defaultStringRedactor(value) : value;
}

@@ -428,2 +448,9 @@ return fieldRedactor(value);

};
const $4a36c7f8b55737fa$var$findApplicablePatternBasedStringRedactor = (key, indexedPatternBasedStringRedactors)=>{
const redactor = $4a36c7f8b55737fa$var$findApplicablePatternBasedRedactor(key, indexedPatternBasedStringRedactors.other);
if (redactor || key.length < 2) return redactor;
const redactorsMatchingBigram = indexedPatternBasedStringRedactors.byTrailingBigram[key.slice(-2)] ?? [];
if (redactorsMatchingBigram.length === 0) return null;
return $4a36c7f8b55737fa$var$findApplicablePatternBasedRedactor(key, redactorsMatchingBigram);
};

@@ -430,0 +457,0 @@

{
"name": "@alwaysmeticulous/redaction",
"version": "2.187.0",
"version": "2.188.0",
"license": "ISC",

@@ -18,5 +18,5 @@ "source": "src/index.ts",

"format": "prettier --write src",
"lint": "eslint src --ext=ts,tsx,js --cache",
"lint": "eslint \"src/**/*.{js,ts,tsx}\" --cache",
"lint:commit": "eslint --cache $(git diff --relative --name-only --diff-filter=ACMRTUXB master | grep -E \"(.js$|.ts$|.tsx$)\")",
"lint:fix": "eslint src --ext=ts,tsx,js --cache --fix",
"lint:fix": "eslint \"src/**/*.{js,ts,tsx}\" --cache --fix",
"depcheck": "depcheck --ignore-patterns=dist",

@@ -26,4 +26,4 @@ "test": "jest"

"devDependencies": {
"@alwaysmeticulous/api": "^2.186.0",
"@alwaysmeticulous/sdk-bundles-api": "^2.186.0"
"@alwaysmeticulous/api": "^2.188.0",
"@alwaysmeticulous/sdk-bundles-api": "^2.188.0"
},

@@ -47,3 +47,3 @@ "author": {

},
"gitHead": "7886cd2eaf96f28b17380de065ca0fe87dd2604c"
"gitHead": "4d6aa04424e8c7438d3bc237860594030841d152"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc