Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dist/
**/.env.*
**/yarn-*.log
**/*.ts.snap
copyright-header.txt
**/*.txt
**/.DS_Store
**/.funcignore
**/extensions.csproj
Expand Down
4 changes: 0 additions & 4 deletions .vscode/workspace.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
"name": "logger",
"path": "../packages/logger"
},
{
"name": "parallel-workers",
"path": "../packages/parallel-workers"
},
{
"name": "privacy-scan-core",
"path": "../packages/privacy-scan-core"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"scripts": {
"packages": "yarn workspaces foreach --no-private --parallel --verbose --all",
"clean": "yarn packages run clean && rimraf dist test-results ./**/coverage",
"clean": "yarn packages run clean && rimraf dist test-results",
"build": "yarn packages --topological-dev run build",
"cbuild": "yarn packages --topological-dev run cbuild",
"dbuild": "yarn install && npm-run-all --serial syncpack:fix build",
Expand Down
12 changes: 6 additions & 6 deletions packages/api-contracts/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,6 @@
"type": "integer",
"example": 100
},
"scanType": {
"description": "The targeted type of the scan",
"type": "string",
"enum": ["accessibility", "privacy"],
"example": "accessibility"
},
"scanNotifyUrl": {
"type": "string",
"example": "https://www.example.com/api/notification"
Expand Down Expand Up @@ -543,6 +537,12 @@
"type": "string",
"example": "https://accessibilityinsights.io/"
},
"scanType": {
"description": "The type of the scan",
"type": "string",
"enum": ["accessibility"],
"example": "accessibility"
},
"deepScanId": {
"type": "string",
"example": "d6cdd091-a985-4dfd-a046-57c7f4d23bfc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe(IdentityCredentialCache, () => {
getAccessToken = async () => Promise.reject(new Error('msi service error'));

await expect(identityCredentialCache.getToken(scopes, undefined, getAccessToken)).rejects.toThrowError(
/Credential provider has failed./,
/Azure credential provider has failed./,
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export class IdentityCredentialCache {
try {
return await getAccessToken();
} catch (error) {
throw new Error(`Credential provider has failed. ${System.serializeError(error)}`);
throw new Error(
`Azure credential provider has failed. ClientId: ${clientId}. Scope: ${scope}. Error: ${System.serializeError(
error,
)}. Stack: ${new Error().stack}`,
);
}
});

Expand Down
21 changes: 0 additions & 21 deletions packages/common/src/ciphers/hash-generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,6 @@ describe('HashGenerator', () => {
expect(id).toEqual(expectedId);
});

it('generate getWebsiteScanPageDataDocumentId', () => {
hashGenerator = new HashGenerator(SHA);
const id = hashGenerator.getWebsiteScanPageDataDocumentId('websiteId', 'scanId');
const expectedId = hashGenerator.generateBase64Hash('websiteId', 'scanId');
expect(id).toEqual(expectedId);
});

it('generate WebsiteScanResultDocumentId', () => {
hashGenerator = new HashGenerator(SHA);
const id = hashGenerator.getWebsiteScanResultDocumentId('baseUrl', 'scanGroupId');
const expectedId = hashGenerator.generateBase64Hash('baseUrl', 'scanGroupId');
expect(id).toEqual(expectedId);
});

it('generate WebsiteScanResultPartDocumentId', () => {
hashGenerator = new HashGenerator(SHA);
const id = hashGenerator.getWebsiteScanResultPartDocumentId('baseId', 'scanId');
const expectedId = hashGenerator.generateBase64Hash('baseId', 'scanId');
expect(id).toEqual(expectedId);
});

it('should generate same hash every time without stubbing', () => {
hashGenerator = new HashGenerator(SHA);
const hash1 = hashGenerator.generateBase64Hash('u1', 'f1', 's1', 'r1');
Expand Down
15 changes: 0 additions & 15 deletions packages/common/src/ciphers/hash-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ export class HashGenerator {
return this.generateBase64Hash(baseUrl, scanGroupId);
}

public getWebsiteScanPageDataDocumentId(websiteId: string, scanId: string): string {
// Preserve parameters order below for the hash generation compatibility
return this.generateBase64Hash(websiteId, scanId);
}

public getWebsiteScanResultDocumentId(baseUrl: string, scanGroupId: string): string {
// Preserve parameters order below for the hash generation compatibility
return this.generateBase64Hash(baseUrl, scanGroupId);
}

public getWebsiteScanResultPartDocumentId(baseId: string, scanId: string): string {
// Preserve parameters order below for the hash generation compatibility
return this.generateBase64Hash(baseId, scanId);
}

public getDbHashBucket(prefix: string, ...values: string[]): string {
// Changing buckets count will affect bucket generation of the same values
return this.getHashBucket(prefix, 1000, ...values);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('listMonorepoPackageNames', () => {
"functional-tests",
"health-client",
"logger",
"parallel-workers",
"privacy-scan-core",
"privacy-scan-job-manager",
"privacy-scan-runner",
Expand Down
26 changes: 0 additions & 26 deletions packages/crawler/src/common/hash-generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,6 @@ describe('HashGenerator', () => {
hashGenerator = new HashGenerator(shaJsMock.object);
});

it('generate hash bucket', () => {
hashGenerator = new HashGenerator(SHA);
const bucket = hashGenerator.getHashBucket('bucket', 300, 'id1', 'id2', 'id3');
expect(bucket).toEqual('bucket-101');
});

it('generate DB hash bucket with preset range', () => {
hashGenerator = new HashGenerator(SHA);
const bucket = hashGenerator.getDbHashBucket('bucket', 'id1', 'id2', 'id3');
expect(bucket).toEqual('bucket-425');
});

it('generate WebsiteScanResultDocumentId', () => {
hashGenerator = new HashGenerator(SHA);
const id = hashGenerator.getWebsiteScanResultDocumentId('baseUrl', 'scanGroupId');
const expectedId = hashGenerator.generateBase64Hash('baseUrl', 'scanGroupId');
expect(id).toEqual(expectedId);
});

it('generate WebsiteScanResultPartDocumentId', () => {
hashGenerator = new HashGenerator(SHA);
const id = hashGenerator.getWebsiteScanResultPartDocumentId('baseId', 'scanId');
const expectedId = hashGenerator.generateBase64Hash('baseId', 'scanId');
expect(id).toEqual(expectedId);
});

it('should generate same hash every time without stubbing', () => {
hashGenerator = new HashGenerator(SHA);
const hash1 = hashGenerator.generateBase64Hash('u1', 'f1', 's1', 'r1');
Expand Down
26 changes: 0 additions & 26 deletions packages/crawler/src/common/hash-generator.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import fnv1a from '@sindresorhus/fnv1a';
import { inject, injectable, optional } from 'inversify';
import { JumpConsistentHash } from './jump-consistent-hash';

/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
const shaJS = require('sha.js');
Expand All @@ -12,30 +10,6 @@ const shaJS = require('sha.js');
export class HashGenerator {
public constructor(@optional() @inject('sha') private readonly shaObj = shaJS) {}

public getWebsiteScanResultDocumentId(baseUrl: string, scanGroupId: string): string {
// Preserve parameters order below for the hash generation compatibility
return this.generateBase64Hash(baseUrl, scanGroupId);
}

public getWebsiteScanResultPartDocumentId(baseId: string, scanId: string): string {
// Preserve parameters order below for the hash generation compatibility
return this.generateBase64Hash(baseId, scanId);
}

public getDbHashBucket(prefix: string, ...values: string[]): string {
// Changing buckets count will affect bucket generation of the same values
return this.getHashBucket(prefix, 1000, ...values);
}

public getHashBucket(prefix: string, buckets: number, ...values: string[]): string {
const hashSeed: string = values.join('|').toLowerCase();
const hash = fnv1a(hashSeed);
const hashGenerator = new JumpConsistentHash();
const bucket = hashGenerator.getBucket(hash, buckets);

return `${prefix}-${bucket}`;
}

public generateBase64Hash(...values: string[]): string {
const hashSeed: string = values.join('|').toLowerCase();

Expand Down
5 changes: 0 additions & 5 deletions packages/health-client/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ module.exports = (env) => {
new ignoreDynamicRequire(),
new copyWebpackPlugin({
patterns: [
{
context: '../../packages/parallel-workers/dist',
from: '**/*.js',
to: '',
},
{
context: '.',
from: 'package-ext.json',
Expand Down
9 changes: 0 additions & 9 deletions packages/parallel-workers/jest.config.js

This file was deleted.

46 changes: 0 additions & 46 deletions packages/parallel-workers/package.json

This file was deleted.

8 changes: 0 additions & 8 deletions packages/parallel-workers/prettier.config.js

This file was deleted.

4 changes: 0 additions & 4 deletions packages/parallel-workers/src/index.ts

This file was deleted.

This file was deleted.

Loading