@la-main-verte/shared-types 1.0.80 → 1.0.82

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@la-main-verte/shared-types",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
4
4
  "description": "Shared TypeScript interfaces for frontend of la-main-verte app",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -1,55 +1,55 @@
1
- export interface FertilizerI {
2
- id: number
3
- name: string
4
- slug: string
5
- azotePercentage: number
6
- phosphorePercentage: number
7
- potassiumPercentage: number
8
- /**
9
- * The real azote percentage is the azote percentage multiplied by the azote efficiency.
10
- */
11
- realAzotePercentage: number
12
- /**
13
- * Nitrogen mineralization rate, between 0 and 1 (e.g. 0.9 for 90%).
14
- */
15
- nitrogenMineralizationRate: number | null
16
- imageLocation: string
17
- imageURL: string
18
- quantitySuggested: string
19
- /**
20
- * Blend composition when this fertilizer is a combination of two products.
21
- * Null for single fertilizers.
22
- * When populated, contains the IDs and ratios (as percentages) of the primary and secondary fertilizers.
23
- * The NPK values should be calculated by fetching each fertilizer and applying the weighted average.
24
- *
25
- * @example
26
- * // For a blend:
27
- * {
28
- * "primary_fertilizer_id": 1, // Acti-Sol (70%)
29
- * "primary_fertilizer_ratio": 70,
30
- * "secondary_fertilizer_id": 12, // Bionik (30%)
31
- * "secondary_fertilizer_ratio": 30
32
- * }
33
- *
34
- * // For a single fertilizer:
35
- * {}
36
- */
37
- combination_details: BlendCompositionI | null
38
- }
39
-
40
- interface BlendCompositionI {
41
- primary_fertilizer_id: number
42
- primary_fertilizer_ratio: number
43
- secondary_fertilizer_id: number
44
- secondary_fertilizer_ratio: number
45
- }
46
-
47
- export interface FertilizerSectionI {
48
- sectionTitle: string
49
- sectionSubtitle: string
50
- fertilizers: FertilizerI[]
51
- }
52
-
53
- export interface FertilizersInGridI {
54
- fertilizerSection: FertilizerSectionI[]
55
- }
1
+ export interface FertilizerI {
2
+ id: number
3
+ name: string
4
+ slug: string
5
+ azotePercentage: number
6
+ phosphorePercentage: number
7
+ potassiumPercentage: number
8
+ /**
9
+ * The real azote percentage is the azote percentage multiplied by the azote efficiency.
10
+ */
11
+ realAzotePercentage: number
12
+ /**
13
+ * Nitrogen mineralization rate, between 0 and 1 (e.g. 0.9 for 90%).
14
+ */
15
+ nitrogenMineralizationRate: number | null
16
+ imageLocation: string
17
+ imageURL: string
18
+ quantitySuggested: string
19
+ /**
20
+ * Blend composition when this fertilizer is a combination of two products.
21
+ * Null for single fertilizers.
22
+ * When populated, contains the IDs and ratios (as percentages) of the primary and secondary fertilizers.
23
+ * The NPK values should be calculated by fetching each fertilizer and applying the weighted average.
24
+ *
25
+ * @example
26
+ * // For a blend:
27
+ * {
28
+ * "primary_fertilizer_id": 1, // Acti-Sol (70%)
29
+ * "primary_fertilizer_ratio": 70,
30
+ * "secondary_fertilizer_id": 12, // Bionik (30%)
31
+ * "secondary_fertilizer_ratio": 30
32
+ * }
33
+ *
34
+ * // For a single fertilizer:
35
+ * {}
36
+ */
37
+ combination_details: BlendCompositionI | null
38
+ }
39
+
40
+ interface BlendCompositionI {
41
+ primary_fertilizer_id: number
42
+ primary_fertilizer_ratio: number
43
+ secondary_fertilizer_id: number
44
+ secondary_fertilizer_ratio: number
45
+ }
46
+
47
+ export interface FertilizerSectionI {
48
+ sectionTitle: string
49
+ sectionSubtitle: string
50
+ fertilizers: FertilizerI[]
51
+ }
52
+
53
+ export interface FertilizersInGridI {
54
+ fertilizerSection: FertilizerSectionI[]
55
+ }
package/src/index.ts CHANGED
@@ -1,32 +1,34 @@
1
- export * from './member'
2
- export * from './selection'
3
- export * from './plantSelection'
4
- export * from './plant'
5
- export * from './task'
6
- export * from './calendarView'
7
- export * from './apiError'
8
- export * from './gardenMap'
9
- export * from './gardenOverview'
10
- export * from './alert'
11
- export * from './image'
12
- export * from './note'
13
- export * from './taggedItem'
14
- export * from './fertilizer'
15
- export * from './utmParams'
16
- export * from './plantFilters'
17
- import * as PlantsAPI from './plants.api'
18
- import * as UsersAPI from './users.api'
19
- import * as SessionsAPI from './sessions.api'
20
- import * as HomeAPI from './home.api'
21
- import * as PagesAPI from './pages.api'
22
- import * as PaymentsAPI from './payments.api'
23
-
24
- // Allow access to the API namespaces without conflicts
25
- export namespace API {
26
- export import PLANTS = PlantsAPI
27
- export import USERS = UsersAPI
28
- export import SESSIONS = SessionsAPI
29
- export import HOME = HomeAPI
30
- export import PAGES = PagesAPI
31
- export import PAYMENTS = PaymentsAPI
32
- }
1
+ export * from './member'
2
+ export * from './selection'
3
+ export * from './plantSelection'
4
+ export * from './plant'
5
+ export * from './task'
6
+ export * from './calendarView'
7
+ export * from './apiError'
8
+ export * from './gardenMap'
9
+ export * from './gardenOverview'
10
+ export * from './alert'
11
+ export * from './image'
12
+ export * from './note'
13
+ export * from './taggedItem'
14
+ export * from './fertilizer'
15
+ export * from './utmParams'
16
+ export * from './plantFilters'
17
+ export * from './taxonFamily'
18
+ export * from './rotationGroup'
19
+ import * as PlantsAPI from './plants.api'
20
+ import * as UsersAPI from './users.api'
21
+ import * as SessionsAPI from './sessions.api'
22
+ import * as HomeAPI from './home.api'
23
+ import * as PagesAPI from './pages.api'
24
+ import * as PaymentsAPI from './payments.api'
25
+
26
+ // Allow access to the API namespaces without conflicts
27
+ export namespace API {
28
+ export import PLANTS = PlantsAPI
29
+ export import USERS = UsersAPI
30
+ export import SESSIONS = SessionsAPI
31
+ export import HOME = HomeAPI
32
+ export import PAGES = PagesAPI
33
+ export import PAYMENTS = PaymentsAPI
34
+ }
package/src/plant.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { TaxonFamilyI } from './taxonFamily'
2
2
  import type { SeedingInfoI } from './pages.api'
3
3
  import type { PlantFilterI } from './plantFilters'
4
+ import type { RotationGroup } from './rotationGroup'
4
5
  /**
5
6
  * Range filter value for min/max filters
6
7
  */
@@ -98,9 +99,16 @@ export interface PlantI {
98
99
  Images?: ImageI[]
99
100
  Member?: Partial<MemberI>
100
101
  notes?: NoteI[]
101
- rotationGroup?: string
102
- // @deprecate once v1.8.1 is fully adopted
103
- rotationFamily?: string
102
+ /**
103
+ * Nitrogen-derived rotation group enum (virtual field on the Plant model).
104
+ * Source of truth for rotation classification — derived from
105
+ * `azoteNeedsKgPerHa` plus the regenerative override on `taxonFamily`.
106
+ */
107
+ rotationGroup?: RotationGroup | null
108
+ /**
109
+ * French label of `rotationGroup`, ready for display.
110
+ */
111
+ translatedRotationGroup?: string | null
104
112
  taxonFamily?: TaxonFamilyI
105
113
  seedingInfo: SeedingInfoI
106
114
  /**
@@ -123,6 +131,33 @@ interface PlantInventoryI {
123
131
 
124
132
  export type AvailableGrowingConditionsI = Record<string, string[]>
125
133
 
134
+ /**
135
+ * For each attribute filter key (e.g. "fruit.color"), the list of values that
136
+ * still yield at least one match under the current search + active filters.
137
+ * Consumed by the frontend to mark filter tags as "unavailable".
138
+ */
139
+ export type AvailableAttributesI = Record<string, string[]>
140
+
141
+ /**
142
+ * Which filter surface the frontend should render for the current search.
143
+ * - `specific`: family-specific filters (e.g. tomate attributes)
144
+ * - `general`: global growing-conditions filters
145
+ *
146
+ * Mutually exclusive by design — the two sets never appear together.
147
+ */
148
+ export type PlantFiltersModeI = 'specific' | 'general'
149
+
150
+ /**
151
+ * Backend-driven description of the filter UI for a given search response.
152
+ * The frontend is a dumb renderer: it shows the filters listed here with the
153
+ * given mode and marks tags whose value is not in `availability` as unavailable.
154
+ */
155
+ export interface PlantFiltersUII {
156
+ mode: PlantFiltersModeI
157
+ filters: PlantFilterI[]
158
+ availability: Record<string, string[]>
159
+ }
160
+
126
161
  export interface GrowingConditionsConfigI {
127
162
  filters: PlantFilterI[]
128
163
  }
@@ -137,4 +172,18 @@ export interface PlantSearchResultI {
137
172
  selections: SelectionModelI[]
138
173
  total?: number
139
174
  familyName?: string
175
+ filtersUI?: PlantFiltersUII
176
+ }
177
+
178
+ /**
179
+ * Response shape for `GET /selections/:slug/gardenZones/:id/rotation-suggestions`.
180
+ * - `advice`: short user-facing sentence explaining the recommendation
181
+ * - `Plants`: parent plants matching the recommended rotation group, with
182
+ * the avoided taxon families excluded. Empty when the zone has no usable
183
+ * history yet.
184
+ */
185
+ export interface PlantRotationSuggestionsI {
186
+ targetYear: number
187
+ advice: string
188
+ Plants: PlantI[]
140
189
  }
@@ -0,0 +1,15 @@
1
+ import type { RotationGroup } from './rotationGroup'
2
+
3
+ export interface TaxonFamilyI {
4
+ id: number
5
+ slug: string
6
+ translation_key: string
7
+ name: string
8
+ latin_name: string | null
9
+ kingdom: string
10
+ description: string | null
11
+ rotation_group: RotationGroup | null
12
+ translated_rotation_group: string | null
13
+ createdAt?: Date
14
+ updatedAt?: Date
15
+ }