@fragus/sam-types 1.2.23 → 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.23",
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,6 +1,8 @@
1
+ import { IBlacklistOwner, IBlacklistOwnersRequest } from '../vehicleBlacklist'
2
+
1
3
  /**
2
- * The vehicles a warranty product is blacklisted for, matched like a vehicle blacklist entry: `*` in model or fuel type
3
- * matches any, and the model year range is inclusive with null meaning no limit.
4
+ * The vehicles a product is blacklisted for, matched like a vehicle blacklist entry: `*` in model or fuel type matches
5
+ * any, and the model year range is inclusive with null meaning no limit.
4
6
  */
5
7
  export interface IBlacklistedProductVehicle {
6
8
  brand: string
@@ -10,43 +12,38 @@ export interface IBlacklistedProductVehicle {
10
12
  modelYearTo: number | null
11
13
  }
12
14
 
13
- /** A warranty product blacklisted by its exact name (case-insensitive) or its V4 product id; exactly one is set. */
15
+ /**
16
+ * A product blacklisted by its exact name, ignoring case (a warranty, or a service agreement by its internal or
17
+ * external name), or by its V4 product id; exactly one is set. The owners are the providers and groups, at least one in
18
+ * all. A rule cannot be changed once created, only its owners.
19
+ */
14
20
  export interface IBlacklistedProductRequest {
15
- warrantyName: string | null
21
+ productName: string | null
16
22
  v4ProductId: number | null
17
23
  /** Only for these vehicles; missing or null blacklists the product for every vehicle. */
18
24
  vehicle?: IBlacklistedProductVehicle | null
19
- providerIds: {
20
- add: number[]
21
- remove: number[]
22
- }
23
- contractProviderGroupIds?: {
24
- add: number[]
25
- remove: number[]
26
- }
25
+ providerIds: number[]
26
+ contractProviderGroupIds: number[]
27
27
  }
28
28
 
29
+ export type IBlacklistedProductOwnersRequest = IBlacklistOwnersRequest
30
+
31
+ export type IBlacklistedProductOwner = IBlacklistOwner
32
+
29
33
  export interface IBlacklistedProductResponse {
30
34
  id: number
31
- warrantyName: string | null
35
+ productName: string | null
32
36
  v4ProductId: number | null
33
37
  vehicle: IBlacklistedProductVehicle | null
34
- parentRecord?: boolean
35
- groupRecord?: boolean
38
+ providers: IBlacklistedProductOwner[]
39
+ contractProviderGroups: IBlacklistedProductOwner[]
36
40
  }
37
41
 
38
- export interface IBlacklistedProductListRecord extends IBlacklistedProductResponse {
39
- // Null on a group-owned entry: the two owners are exclusive.
40
- providerId: number | null
41
- providerName: string | null
42
- contractProviderGroupId: number | null
43
- contractProviderGroupName: string | null
44
- }
42
+ export type IBlacklistedProductListRecord = IBlacklistedProductResponse
45
43
 
46
- /** Which providers and groups a blacklisted product is registered for. */
47
- export interface IBlacklistedProductScope {
48
- providerIds: number[]
49
- contractProviderGroupIds: number[]
44
+ /** The `debug` of a PRODUCT_BLACKLIST_ALREADY_EXISTS (409) response: the identical rule that exists. */
45
+ export interface IBlacklistedProductConflict {
46
+ id: number
50
47
  }
51
48
 
52
- export type BlacklistedProductOrderByType = 'id' | 'warrantyName' | 'v4ProductId'
49
+ export type BlacklistedProductOrderByType = 'id' | 'productName' | 'v4ProductId'
@@ -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,5 +1,7 @@
1
1
  export type VehcileBlacklistErrors =
2
- | 'DUPLICATE_RECORD'
3
- | 'VEHICLE_BLACKLIST_NOT_FOUND'
4
- | 'PRODUCT_BLACKLIST_NOT_FOUND'
5
- | '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'