@stryker-mutator/dashboard-data-access 0.14.4-pr-613.0 → 0.14.4-pr-614.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/README.md CHANGED
@@ -6,14 +6,14 @@
6
6
  ## Table storage
7
7
 
8
8
  ```
9
- |--------------------|
10
- | Project |
11
- |--------------------|
12
- | owner: string PK |
13
- | name: string RK |
14
- | enabled: bool |
15
- | apiKeyHash: string |
16
- |--------------------|
9
+ |--------------------|
10
+ | Project |
11
+ |--------------------|
12
+ | owner: string PK |
13
+ | name: string RK |
14
+ | enabled: bool |
15
+ | apiKeyHash: string |
16
+ |--------------------|
17
17
 
18
18
  |-----------------------------------|
19
19
  | MutationTestingReport |
@@ -30,15 +30,15 @@
30
30
  RK = Row key
31
31
  ```
32
32
 
33
- This data model will be stored in an [Azure table service database](https://docs.microsoft.com/en-us/rest/api/storageservices/Understanding-the-Table-Service-Data-Model?redirectedfrom=MSDN).
33
+ This data model will be stored in an [Azure table service database](https://docs.microsoft.com/en-us/rest/api/storageservices/Understanding-the-Table-Service-Data-Model?redirectedfrom=MSDN).
34
34
  It is a, very scalable, NoSQL database.
35
35
 
36
36
  Some notes:
37
- * A `Project`'s `owner` is i.e. `'github.com/stryker-mutator'`
38
- * A `Project`'s `name` is the short name of the repository, i.e. `'stryker'`
39
- * The `MutationTestingReport`'s `projectName` and `version` form the Partition Key. This is te full project name including the branch name (usually) i.e. `'github.com/stryker-mutator/stryker/master'`
40
37
 
38
+ - A `Project`'s `owner` is i.e. `'github.com/stryker-mutator'`
39
+ - A `Project`'s `name` is the short name of the repository, i.e. `'stryker'`
40
+ - The `MutationTestingReport`'s `projectName` and `version` form the Partition Key. This is te full project name including the branch name (usually) i.e. `'github.com/stryker-mutator/stryker/master'`
41
41
 
42
42
  ## Blob storage
43
43
 
44
- The mutation testing report json data is stored in Azure blob storage. The name of the blobs are `projectName`/`version`/`module`.
44
+ The mutation testing report json data is stored in Azure blob storage. The name of the blobs are `projectName`/`version`/`module`.
@@ -10,20 +10,14 @@ export class DashboardQuery {
10
10
  condition: 'not(RowKey eq ?)',
11
11
  params: [encodeKey(this.ModelClass.createRowKey(rowKey) || '')],
12
12
  };
13
- return new DashboardQuery(this.ModelClass, [
14
- ...this.whereConditions,
15
- whereCondition,
16
- ]);
13
+ return new DashboardQuery(this.ModelClass, [...this.whereConditions, whereCondition]);
17
14
  }
18
15
  wherePartitionKeyEquals(partitionKey) {
19
16
  const whereCondition = {
20
17
  condition: 'PartitionKey eq ?',
21
18
  params: [encodeKey(this.ModelClass.createPartitionKey(partitionKey))],
22
19
  };
23
- return new DashboardQuery(this.ModelClass, [
24
- ...this.whereConditions,
25
- whereCondition,
26
- ]);
20
+ return new DashboardQuery(this.ModelClass, [...this.whereConditions, whereCondition]);
27
21
  }
28
22
  static create(ModelClass) {
29
23
  return new DashboardQuery(ModelClass, []);
@@ -25,8 +25,7 @@ export class MutationTestingResultMapper {
25
25
  });
26
26
  }
27
27
  catch (err) {
28
- if (isStorageError(err) &&
29
- err.code === additionalErrorCodes.BLOB_HAS_BEEN_MODIFIED) {
28
+ if (isStorageError(err) && err.code === additionalErrorCodes.BLOB_HAS_BEEN_MODIFIED) {
30
29
  throw new OptimisticConcurrencyError(`Blob "${JSON.stringify(id)}" was modified by another process`);
31
30
  }
32
31
  else {
@@ -41,8 +40,7 @@ export class MutationTestingResultMapper {
41
40
  return result;
42
41
  }
43
42
  catch (error) {
44
- if (isStorageError(error) &&
45
- error.code === Constants.BlobErrorCodeStrings.BLOB_NOT_FOUND) {
43
+ if (isStorageError(error) && error.code === Constants.BlobErrorCodeStrings.BLOB_NOT_FOUND) {
46
44
  return null;
47
45
  }
48
46
  else {
@@ -51,8 +51,7 @@ export default class TableStorageMapper {
51
51
  }
52
52
  catch (err) {
53
53
  if (isStorageError(err) &&
54
- err.code ===
55
- Constants.StorageErrorCodeStrings.UPDATE_CONDITION_NOT_SATISFIED) {
54
+ err.code === Constants.StorageErrorCodeStrings.UPDATE_CONDITION_NOT_SATISFIED) {
56
55
  throw new OptimisticConcurrencyError(`Replace entity with etag ${etag} resulted in ${Constants.StorageErrorCodeStrings.UPDATE_CONDITION_NOT_SATISFIED}`);
57
56
  }
58
57
  else {
@@ -1,4 +1,4 @@
1
- import { aggregateResultsByModule, calculateMetrics, } from 'mutation-testing-metrics';
1
+ import { aggregateResultsByModule, calculateMetrics } from 'mutation-testing-metrics';
2
2
  import { MutationTestingResultMapper } from '../mappers/MutationTestingResultMapper.js';
3
3
  import { createMutationTestingReportMapper, DashboardQuery, } from '../mappers/index.js';
4
4
  import { isMutationTestResult, } from '@stryker-mutator/dashboard-common';
@@ -40,10 +40,7 @@ export class MutationTestingReportService {
40
40
  const moduleScoreResults = await this.mutationScoreMapper.findAll(DashboardQuery.create(MutationTestingReport)
41
41
  .wherePartitionKeyEquals(id)
42
42
  .whereRowKeyNotEquals({ moduleName: undefined }));
43
- const resultsByModule = Object.fromEntries((await Promise.all(moduleScoreResults.map(async (score) => [
44
- score.model.moduleName,
45
- await this.resultMapper.findOne(score.model),
46
- ]))).filter(moduleHasResult));
43
+ const resultsByModule = Object.fromEntries((await Promise.all(moduleScoreResults.map(async (score) => [score.model.moduleName, await this.resultMapper.findOne(score.model)]))).filter(moduleHasResult));
47
44
  if (Object.keys(resultsByModule).length) {
48
45
  const projectResult = aggregateResultsByModule(resultsByModule);
49
46
  const projectReport = Object.assign(Object.assign({}, id), { mutationScore: this.calculateMutationScore(projectResult) });
@@ -27,9 +27,7 @@ export class RealTimeMutantsBlobService {
27
27
  }
28
28
  async appendToReport(id, mutants) {
29
29
  const blobName = toBlobName(id);
30
- const data = mutants
31
- .map((mutant) => `${JSON.stringify(mutant)}\n`)
32
- .join('');
30
+ const data = mutants.map((mutant) => `${JSON.stringify(mutant)}\n`).join('');
33
31
  await __classPrivateFieldGet(this, _RealTimeMutantsBlobService_blobService, "f").appendBlockFromText(RealTimeMutantsBlobService.CONTAINER_NAME, blobName, data);
34
32
  }
35
33
  async getReport(id) {
@@ -1,5 +1,5 @@
1
1
  import { promisify } from 'util';
2
- import { createTableService, } from 'azure-storage';
2
+ import { createTableService } from 'azure-storage';
3
3
  export default class TableServiceAsPromised {
4
4
  constructor(tableService = createTableService()) {
5
5
  this.createTableIfNotExists = promisify(tableService.createTableIfNotExists).bind(tableService);
@@ -3,5 +3,5 @@ import { StorageError } from 'azure-storage';
3
3
  export declare function encodeKey(inputWithSlashes: string): string;
4
4
  export declare function decodeKey(inputWithSemiColons: string): string;
5
5
  export declare function isStorageError(maybeStorageError: unknown): maybeStorageError is StorageError;
6
- export declare function toBlobName({ projectName, version, moduleName, realTime, }: ReportIdentifier): string;
6
+ export declare function toBlobName({ projectName, version, moduleName, realTime }: ReportIdentifier): string;
7
7
  //# sourceMappingURL=utils.d.ts.map
package/dist/src/utils.js CHANGED
@@ -8,13 +8,8 @@ export function isStorageError(maybeStorageError) {
8
8
  return (maybeStorageError instanceof Error &&
9
9
  maybeStorageError.name === 'StorageError');
10
10
  }
11
- export function toBlobName({ projectName, version, moduleName, realTime, }) {
12
- const slug = [
13
- projectName,
14
- version,
15
- moduleName,
16
- realTime ? 'real-time' : realTime,
17
- ]
11
+ export function toBlobName({ projectName, version, moduleName, realTime }) {
12
+ const slug = [projectName, version, moduleName, realTime ? 'real-time' : realTime]
18
13
  .filter(Boolean)
19
14
  .join('/');
20
15
  return encodeKey(slug);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryker-mutator/dashboard-data-access",
3
- "version": "0.14.4-pr-613.0",
3
+ "version": "0.14.4-pr-614.0",
4
4
  "type": "module",
5
5
  "description": "This package contains the data access layer of the stryker dashboard application.",
6
6
  "scripts": {
@@ -21,10 +21,10 @@
21
21
  "typings": "src/index.ts",
22
22
  "license": "ISC",
23
23
  "dependencies": {
24
- "@stryker-mutator/dashboard-common": "0.14.4-pr-613.0",
24
+ "@stryker-mutator/dashboard-common": "0.14.4-pr-614.0",
25
25
  "azure-storage": "2.10.7",
26
26
  "mutation-testing-metrics": "3.0.4",
27
27
  "mutation-testing-report-schema": "3.0.4"
28
28
  },
29
- "gitHead": "cebf6f97d8c2171e4a378ef792ecc8d8172f82df"
29
+ "gitHead": "e412ef8783a5932df88227c5fb02f0593aa40ff3"
30
30
  }