@heroku/js-blanket 0.0.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.
@@ -0,0 +1,41 @@
1
+ // Integration test to verify the public API works correctly
2
+
3
+ import { expect } from 'chai';
4
+ import {
5
+ Scrubber,
6
+ createRedactor,
7
+ HEROKU_FIELDS,
8
+ PII_PATTERNS,
9
+ } from './index.js';
10
+
11
+ describe('js-blanket', () => {
12
+ it('creates and uses Scrubber instances for field-based scrubbing', () => {
13
+ expect(Scrubber).to.be.a('function');
14
+ const scrubber = new Scrubber({ fields: ['password'] });
15
+ expect(scrubber).to.be.instanceOf(Scrubber);
16
+ });
17
+
18
+ it('creates redactor instances that scrub sensitive data', () => {
19
+ expect(createRedactor).to.be.a('function');
20
+ const redactor = createRedactor({ fields: ['password'] });
21
+ const result = redactor.scrub({ password: 'secret' });
22
+ expect(result.data.password).to.equal('[SCRUBBED]');
23
+ });
24
+
25
+ it('provides HEROKU_FIELDS preset with standard Heroku sensitive fields', () => {
26
+ expect(HEROKU_FIELDS).to.be.an('array');
27
+ expect(HEROKU_FIELDS).to.include('password');
28
+ // Check for api_key pattern (can be string or regex)
29
+ const hasApiKey = HEROKU_FIELDS.some(
30
+ (field) =>
31
+ field === 'api_key' ||
32
+ (field instanceof RegExp && field.test('api_key'))
33
+ );
34
+ expect(hasApiKey).to.be.true;
35
+ });
36
+
37
+ it('provides PII_PATTERNS preset with common PII regex patterns', () => {
38
+ expect(PII_PATTERNS).to.be.an('array');
39
+ expect(PII_PATTERNS.length).to.be.greaterThan(0);
40
+ });
41
+ });
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ // Core exports
2
+ export { Scrubber } from './core/scrubber.js';
3
+ export type { ScrubConfig, ScrubResult } from './core/types.js';
4
+ export { HEROKU_FIELDS, GDPR_FIELDS, PCI_FIELDS } from './core/presets.js';
5
+ export { PII_PATTERNS } from './core/patterns.js';
6
+
7
+ // Logging adapter
8
+ export { createRedactor } from './adapters/logging/generic.js';
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "CommonJS",
5
+ "moduleResolution": "Node",
6
+ "outDir": "./dist/cjs",
7
+ "target": "ES2022",
8
+ "declaration": false,
9
+ "tsBuildInfoFile": "./dist/cjs/.tsbuildinfo"
10
+ },
11
+ "include": ["src/**/*"]
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "./dist/esm",
7
+ "target": "ES2022",
8
+ "declaration": true,
9
+ "tsBuildInfoFile": "./dist/esm/.tsbuildinfo"
10
+ },
11
+ "include": ["src/**/*"]
12
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022"],
5
+ "module": "NodeNext",
6
+ "moduleResolution": "nodenext",
7
+ "declaration": true,
8
+ "sourceMap": true,
9
+ "outDir": "./dist",
10
+ "rootDir": "./src",
11
+ "importHelpers": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "esModuleInterop": true,
14
+ "strict": true,
15
+ "noImplicitAny": true,
16
+ "strictNullChecks": true,
17
+ "strictFunctionTypes": true,
18
+ "strictPropertyInitialization": true,
19
+ "noFallthroughCasesInSwitch": true,
20
+ "noUncheckedIndexedAccess": true,
21
+ "exactOptionalPropertyTypes": true,
22
+ "skipLibCheck": true,
23
+ "skipDefaultLibCheck": true,
24
+ "resolveJsonModule": true,
25
+ "types": ["node", "mocha"],
26
+ "allowImportingTsExtensions": false,
27
+ "noEmit": false,
28
+ "incremental": true,
29
+ "tsBuildInfoFile": "./dist/.tsbuildinfo"
30
+ },
31
+ "include": ["src/**/*"]
32
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "declaration": false,
3
+ "extends": "./tsconfig.json",
4
+ "compilerOptions": {
5
+ "sourceMap": true,
6
+ "rootDirs": ["./test", "./src"]
7
+ },
8
+ "include": ["./test/**/*", "./src/**/*"]
9
+ }