@fragus/sam-types 1.2.24 → 1.2.25

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.24",
2
+ "version": "1.2.25",
3
3
  "name": "@fragus/sam-types",
4
4
  "description": "Typescript interfaces for all types used to communicate between SAM client(s) and the SAM API",
5
5
  "author": "Fragus",
@@ -1,3 +1,5 @@
1
+ import { IBlacklistOwner, IBlacklistOwnersRequest } from '../vehicleBlacklist'
2
+
1
3
  /**
2
4
  * The vehicles a product is blacklisted for, matched like a vehicle blacklist entry: `*` in model or fuel type matches
3
5
  * any, and the model year range is inclusive with null meaning no limit.
@@ -24,22 +26,9 @@ export interface IBlacklistedProductRequest {
24
26
  contractProviderGroupIds: number[]
25
27
  }
26
28
 
27
- /** Owners to add to and remove from a rule; it must keep at least one. */
28
- export interface IBlacklistedProductOwnersRequest {
29
- providerIds: {
30
- add: number[]
31
- remove: number[]
32
- }
33
- contractProviderGroupIds: {
34
- add: number[]
35
- remove: number[]
36
- }
37
- }
29
+ export type IBlacklistedProductOwnersRequest = IBlacklistOwnersRequest
38
30
 
39
- export interface IBlacklistedProductOwner {
40
- id: number
41
- name: string
42
- }
31
+ export type IBlacklistedProductOwner = IBlacklistOwner
43
32
 
44
33
  export interface IBlacklistedProductResponse {
45
34
  id: number
@@ -50,10 +39,7 @@ export interface IBlacklistedProductResponse {
50
39
  contractProviderGroups: IBlacklistedProductOwner[]
51
40
  }
52
41
 
53
- export interface IBlacklistedProductListRecord extends IBlacklistedProductResponse {
54
- /** True in a sub provider's list when the rule applies to it only through its parent. */
55
- parentRecord: boolean
56
- }
42
+ export type IBlacklistedProductListRecord = IBlacklistedProductResponse
57
43
 
58
44
  /** The `debug` of a PRODUCT_BLACKLIST_ALREADY_EXISTS (409) response: the identical rule that exists. */
59
45
  export interface IBlacklistedProductConflict {
@@ -1,20 +1,36 @@
1
- export interface IBlacklistedVehicleRequest {
2
- brand: string
3
- model: string
4
- fuelType: string
5
- /** Inclusive model year range; null on either end means no limit. */
6
- modelYearFrom?: number | null
7
- modelYearTo?: number | null
1
+ /** Owners to add to and remove from a blacklist rule; it must keep at least one. */
2
+ export interface IBlacklistOwnersRequest {
8
3
  providerIds: {
9
4
  add: number[]
10
5
  remove: number[]
11
6
  }
12
- contractProviderGroupIds?: {
7
+ contractProviderGroupIds: {
13
8
  add: number[]
14
9
  remove: number[]
15
10
  }
16
11
  }
17
12
 
13
+ /** A provider or a provider group a blacklist rule applies to. */
14
+ export interface IBlacklistOwner {
15
+ id: number
16
+ name: string
17
+ }
18
+
19
+ /**
20
+ * A vehicle blacklisted for its owners: the providers and groups, at least one in all. A rule cannot be changed once
21
+ * created, only its owners.
22
+ */
23
+ export interface IBlacklistedVehicleRequest {
24
+ brand: string
25
+ model: string
26
+ fuelType: string
27
+ /** Inclusive model year range; null on either end means no limit. */
28
+ modelYearFrom?: number | null
29
+ modelYearTo?: number | null
30
+ providerIds: number[]
31
+ contractProviderGroupIds: number[]
32
+ }
33
+
18
34
  export interface IBlacklistedVehicleResponse {
19
35
  id: number
20
36
  brand: string
@@ -22,22 +38,15 @@ export interface IBlacklistedVehicleResponse {
22
38
  fuelType: string
23
39
  modelYearFrom: number | null
24
40
  modelYearTo: number | null
25
- parentRecord?: boolean
26
- groupRecord?: boolean
41
+ providers: IBlacklistOwner[]
42
+ contractProviderGroups: IBlacklistOwner[]
27
43
  }
28
44
 
29
- export interface IBlacklistedVehicleListRecord extends IBlacklistedVehicleResponse {
30
- // Null on a group-owned entry: the two owners are exclusive.
31
- providerId: number | null
32
- providerName: string | null
33
- contractProviderGroupId: number | null
34
- contractProviderGroupName: string | null
35
- }
45
+ export type IBlacklistedVehicleListRecord = IBlacklistedVehicleResponse
36
46
 
37
- /** Which providers and groups a blacklisted vehicle is registered for. */
38
- export interface IBlacklistedVehicleScope {
39
- providerIds: number[]
40
- contractProviderGroupIds: number[]
47
+ /** The `debug` of a VEHICLE_BLACKLIST_ALREADY_EXISTS (409) response: the identical rule that exists. */
48
+ export interface IBlacklistedVehicleConflict {
49
+ id: number
41
50
  }
42
51
 
43
52
  export type BlacklistedVehicleOrderByType = 'id' | 'brand' | 'model' | 'fuelType'
@@ -1,6 +1,7 @@
1
1
  export type VehcileBlacklistErrors =
2
- | 'DUPLICATE_RECORD'
3
- | 'VEHICLE_BLACKLIST_NOT_FOUND'
4
- | 'PRODUCT_BLACKLIST_NOT_FOUND'
5
- | 'PRODUCT_BLACKLIST_ALREADY_EXISTS'
6
- | 'CONTRACT_PRODUCT_BLACKLISTED'
2
+ | 'DUPLICATE_RECORD'
3
+ | 'VEHICLE_BLACKLIST_NOT_FOUND'
4
+ | 'VEHICLE_BLACKLIST_ALREADY_EXISTS'
5
+ | 'PRODUCT_BLACKLIST_NOT_FOUND'
6
+ | 'PRODUCT_BLACKLIST_ALREADY_EXISTS'
7
+ | 'CONTRACT_PRODUCT_BLACKLISTED'