@labdigital/commercetools-mock 0.6.3 → 0.6.4

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.
@@ -7,6 +7,6 @@ export declare class ProjectAPI {
7
7
  private _services;
8
8
  constructor(projectKey: string, services: Services, storage: AbstractStorage);
9
9
  add<ReferenceTypeId extends keyof ResourceMap>(typeId: ReferenceTypeId | 'custom-object', resource: ResourceMap[ReferenceTypeId]): void;
10
- get<ReferenceTypeId extends keyof ResourceMap>(typeId: ReferenceTypeId, id: string, params: GetParams): ResourceMap[ReferenceTypeId];
10
+ get<ReferenceTypeId extends keyof ResourceMap>(typeId: ReferenceTypeId, id: string, params?: GetParams): ResourceMap[ReferenceTypeId];
11
11
  getRepository<ReferenceTypeId extends keyof RepositoryMap>(typeId: ReferenceTypeId): RepositoryMap[ReferenceTypeId];
12
12
  }
package/dist/storage.d.ts CHANGED
@@ -17,7 +17,7 @@ export declare abstract class AbstractStorage {
17
17
  abstract assertStorage(typeId: RepositoryTypes): void;
18
18
  abstract all(projectKey: string, typeId: RepositoryTypes): Array<BaseResource>;
19
19
  abstract add<RepositoryTypes extends keyof ResourceMap>(projectKey: string, typeId: RepositoryTypes, obj: ResourceMap[RepositoryTypes]): void;
20
- abstract get<RepositoryTypes extends keyof ResourceMap>(projectKey: string, typeId: RepositoryTypes, id: string, params: GetParams): ResourceMap[RepositoryTypes] | null;
20
+ abstract get<RepositoryTypes extends keyof ResourceMap>(projectKey: string, typeId: RepositoryTypes, id: string, params?: GetParams): ResourceMap[RepositoryTypes] | null;
21
21
  abstract getByKey<RepositoryTypes extends keyof ResourceMap>(projectKey: string, typeId: RepositoryTypes, key: string, params: GetParams): ResourceMap[RepositoryTypes] | null;
22
22
  abstract addProject(projectKey: string): Project;
23
23
  abstract getProject(projectKey: string): Project;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.3",
2
+ "version": "0.6.4",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
package/src/projectAPI.ts CHANGED
@@ -41,7 +41,7 @@ export class ProjectAPI {
41
41
  get<ReferenceTypeId extends keyof ResourceMap>(
42
42
  typeId: ReferenceTypeId,
43
43
  id: string,
44
- params: GetParams
44
+ params?: GetParams
45
45
  ): ResourceMap[ReferenceTypeId] {
46
46
  return this._storage.get(
47
47
  this.projectKey,
@@ -11,9 +11,9 @@ export const checkConcurrentModification = (
11
11
  ) => {
12
12
  if (resource.version === expectedVersion) return
13
13
 
14
- const identifier = (<BaseResource>resource).id
15
- ? (<BaseResource>resource).id
16
- : (<Project>resource).key
14
+ const identifier = (resource as BaseResource).id
15
+ ? (resource as BaseResource).id
16
+ : (resource as Project).key
17
17
 
18
18
  throw new CommercetoolsError<ConcurrentModificationError>(
19
19
  {
@@ -1,10 +1,7 @@
1
1
  import { Update } from '@commercetools/platform-sdk'
2
2
  import { ParsedQs } from 'qs'
3
3
  import { Request, Response, Router } from 'express'
4
- import {
5
- AbstractResourceRepository,
6
- RepositoryContext,
7
- } from '../repositories/abstract'
4
+ import { AbstractResourceRepository } from '../repositories/abstract'
8
5
  import { getRepositoryContext } from '../repositories/helpers'
9
6
 
10
7
  export default abstract class AbstractService {
@@ -19,7 +19,6 @@ export class ProjectService {
19
19
  }
20
20
 
21
21
  get(request: Request, response: Response) {
22
- const projectKey = request.params.projectKey
23
22
  const project = this.repository.get(getRepositoryContext(request))
24
23
  return response.status(200).send(project)
25
24
  }
package/src/storage.ts CHANGED
@@ -67,7 +67,7 @@ export abstract class AbstractStorage {
67
67
  projectKey: string,
68
68
  typeId: RepositoryTypes,
69
69
  id: string,
70
- params: GetParams
70
+ params?: GetParams
71
71
  ): ResourceMap[RepositoryTypes] | null
72
72
 
73
73
  abstract getByKey<RepositoryTypes extends keyof ResourceMap>(