@burdenoff/microfe-healthybowl 2026.904.21 → 2026.904.22
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/dist/components/assistant/AssistantChatArea.js +7 -9
- package/dist/components/assistant/AssistantChatArea.js.map +1 -1
- package/dist/healthybowl/HealthyBowlRoot.js +56 -57
- package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
- package/dist/healthybowl/HealthyBowlRoutes.js +36 -48
- package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
- package/dist/healthybowl/components/CreateFarmTaskButton.js.map +1 -1
- package/dist/healthybowl/components/PageLayout.js +10 -11
- package/dist/healthybowl/components/PageLayout.js.map +1 -1
- package/dist/healthybowl/context/HealthyBowlContext.js +7 -7
- package/dist/healthybowl/context/HealthyBowlContext.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlCompliance.js +141 -157
- package/dist/healthybowl/hooks/useHealthyBowlCompliance.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlData.js +0 -18
- package/dist/healthybowl/hooks/useHealthyBowlData.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlDistribution.js +37 -52
- package/dist/healthybowl/hooks/useHealthyBowlDistribution.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js +78 -135
- package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js.map +1 -1
- package/dist/healthybowl/hooks/useIrrigationAutomation.js +1 -1
- package/dist/healthybowl/hooks/useIrrigationAutomation.js.map +1 -1
- package/dist/healthybowl/hooks/useSuccessionPlanning.js +1 -1
- package/dist/healthybowl/hooks/useSuccessionPlanning.js.map +1 -1
- package/dist/healthybowl/hooks/useWeatherIntelligence.js +1 -1
- package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -1
- package/dist/healthybowl/offline/OfflineStatusPill.js +21 -40
- package/dist/healthybowl/offline/OfflineStatusPill.js.map +1 -1
- package/dist/healthybowl/offline/OfflineSyncProvider.js +130 -153
- package/dist/healthybowl/offline/OfflineSyncProvider.js.map +1 -1
- package/dist/healthybowl/offline/graphql.js.map +1 -1
- package/dist/healthybowl/offline/store.js +1 -1
- package/dist/healthybowl/offline/syncEngine.js +1 -2
- package/dist/healthybowl/offline/syncEngine.js.map +1 -1
- package/dist/healthybowl/offline/types.js.map +1 -1
- package/dist/healthybowl/pages/GettingStartedPage.js +0 -1
- package/dist/healthybowl/pages/GettingStartedPage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/InsightsPage.js +2 -2
- package/dist/healthybowl/pages/analytics/InsightsPage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/ReportsPage.js +99 -136
- package/dist/healthybowl/pages/analytics/ReportsPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js +162 -204
- package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js +178 -196
- package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js +141 -142
- package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropFieldsPage.js +0 -2
- package/dist/healthybowl/pages/crops/CropFieldsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropHarvestPage.js +272 -316
- package/dist/healthybowl/pages/crops/CropHarvestPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropPlanningPage.js +0 -6
- package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js +846 -871
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js +334 -376
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js +188 -415
- package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/distribution/labels.js +2 -10
- package/dist/healthybowl/pages/distribution/labels.js.map +1 -1
- package/dist/healthybowl/pages/farm/FarmProfilePage.js +0 -1
- package/dist/healthybowl/pages/farm/FarmProfilePage.js.map +1 -1
- package/dist/healthybowl/pages/field-capture/CaptureObservationForm.js +8 -8
- package/dist/healthybowl/pages/fields/FieldMapPage.js +0 -2
- package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/FinancialReportsPage.js +107 -92
- package/dist/healthybowl/pages/financial/FinancialReportsPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +188 -228
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js +191 -261
- package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js +14 -14
- package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/irrigation/IrrigationPage.js +307 -338
- package/dist/healthybowl/pages/irrigation/IrrigationPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js +102 -126
- package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDepthPage.js +215 -257
- package/dist/healthybowl/pages/livestock/AnimalDepthPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/GrazingPage.js +0 -1
- package/dist/healthybowl/pages/livestock/GrazingPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/HerdDepthPage.js +0 -4
- package/dist/healthybowl/pages/livestock/HerdDepthPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js +9 -8
- package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js.map +1 -1
- package/dist/healthybowl/pages/network/ExpertsPage.js +419 -520
- package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +130 -129
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +237 -285
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -1
- package/dist/healthybowl/utils/plantingCapacity.js +10 -10
- package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +86 -74
- package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
- package/dist/services/assistantApi.js +30 -59
- package/dist/services/assistantApi.js.map +1 -1
- package/dist/utils/pageContext.js +1 -15
- package/dist/utils/pageContext.js.map +1 -1
- package/package.json +1 -1
- package/dist/healthybowl/hooks/useAgronomyDecisions.js +0 -79
- package/dist/healthybowl/hooks/useAgronomyDecisions.js.map +0 -1
- package/dist/healthybowl/hooks/useAnalyticsReports.js +0 -173
- package/dist/healthybowl/hooks/useAnalyticsReports.js.map +0 -1
- package/dist/healthybowl/hooks/useComplianceExports.js +0 -74
- package/dist/healthybowl/hooks/useComplianceExports.js.map +0 -1
- package/dist/healthybowl/hooks/useConsultationPayments.js +0 -59
- package/dist/healthybowl/hooks/useConsultationPayments.js.map +0 -1
- package/dist/healthybowl/hooks/usePlantingEstimate.js +0 -88
- package/dist/healthybowl/hooks/usePlantingEstimate.js.map +0 -1
- package/dist/healthybowl/offline/HeaderOfflinePill.js +0 -28
- package/dist/healthybowl/offline/HeaderOfflinePill.js.map +0 -1
- package/dist/healthybowl/offline/captureCache.js +0 -30
- package/dist/healthybowl/offline/captureCache.js.map +0 -1
- package/dist/healthybowl/offline/headerSlot.js +0 -24
- package/dist/healthybowl/offline/headerSlot.js.map +0 -1
- package/dist/healthybowl/pages/ai/AiDecisionsPage.js +0 -287
- package/dist/healthybowl/pages/ai/AiDecisionsPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/ResidueTestsPage.js +0 -291
- package/dist/healthybowl/pages/compliance/ResidueTestsPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js +0 -300
- package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/substanceRuleForm.js +0 -135
- package/dist/healthybowl/pages/compliance/substanceRuleForm.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js +0 -49
- package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js +0 -48
- package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js +0 -54
- package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js.map +0 -1
- package/dist/healthybowl/pages/livestock/PedigreeTree.js +0 -154
- package/dist/healthybowl/pages/livestock/PedigreeTree.js.map +0 -1
- package/dist/healthybowl/pages/livestock/eidTagInput.js +0 -39
- package/dist/healthybowl/pages/livestock/eidTagInput.js.map +0 -1
- package/dist/healthybowl/pages/livestock/pedigreeLayout.js +0 -68
- package/dist/healthybowl/pages/livestock/pedigreeLayout.js.map +0 -1
- package/dist/healthybowl/pages/weather/alertDelivery.js +0 -105
- package/dist/healthybowl/pages/weather/alertDelivery.js.map +0 -1
- package/dist/healthybowl/utils/icsInspection.js +0 -18
- package/dist/healthybowl/utils/icsInspection.js.map +0 -1
|
@@ -16,10 +16,7 @@ var o = "00000000-0000-0000-0000-000000000001", s = "\n status\n blocked\n en
|
|
|
16
16
|
latestWeightKg
|
|
17
17
|
latestWeightAt
|
|
18
18
|
withdrawal { ${s} }
|
|
19
|
-
`, u = `
|
|
20
|
-
${l}
|
|
21
|
-
archived
|
|
22
|
-
`, d = "\n id\n animalId\n weightKg\n measuredAt\n method\n notes\n createdAt\n", f = `
|
|
19
|
+
`, u = "\n id\n animalId\n weightKg\n measuredAt\n method\n notes\n createdAt\n", d = `
|
|
23
20
|
animalId
|
|
24
21
|
tagNumber
|
|
25
22
|
eidTag
|
|
@@ -32,226 +29,172 @@ var o = "00000000-0000-0000-0000-000000000001", s = "\n status\n blocked\n en
|
|
|
32
29
|
bodyConditionScore
|
|
33
30
|
damId
|
|
34
31
|
damTag
|
|
35
|
-
damArchived
|
|
36
32
|
sireId
|
|
37
33
|
sireTag
|
|
38
|
-
sireArchived
|
|
39
34
|
grazingPaddock
|
|
40
35
|
rotationDate
|
|
41
36
|
grazingNotes
|
|
42
37
|
adgKgPerDay
|
|
43
38
|
latestWeightKg
|
|
44
39
|
latestWeightAt
|
|
45
|
-
weightHistory { ${
|
|
40
|
+
weightHistory { ${u} }
|
|
46
41
|
withdrawal { ${s} }
|
|
47
|
-
`,
|
|
42
|
+
`, f = r`
|
|
48
43
|
query HealthyBowlHerdDepth($context: ContextInput!, $groupId: ID, $search: String) {
|
|
49
44
|
healthyBowlHerdDepth(context: $context, groupId: $groupId, search: $search) {
|
|
50
|
-
truncated
|
|
51
45
|
rows { ${l} }
|
|
52
46
|
summary { totalAnimals animalsInWithdrawal animalsClear complianceMessage }
|
|
53
47
|
groups { ${c} }
|
|
54
48
|
}
|
|
55
49
|
}
|
|
56
|
-
`,
|
|
57
|
-
query HealthyBowlHerdDepthWithArchived(
|
|
58
|
-
$context: ContextInput!
|
|
59
|
-
$groupId: ID
|
|
60
|
-
$search: String
|
|
61
|
-
$includeArchived: Boolean
|
|
62
|
-
) {
|
|
63
|
-
healthyBowlHerdDepth(context: $context, groupId: $groupId, search: $search, includeArchived: $includeArchived) {
|
|
64
|
-
truncated
|
|
65
|
-
rows { ${u} }
|
|
66
|
-
summary { totalAnimals animalsInWithdrawal animalsClear complianceMessage }
|
|
67
|
-
groups { ${c} }
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
`, h = "\n animalId tagNumber name type breed gender dateOfBirth generation relation archived childAnimalId\n", g = r`
|
|
71
|
-
query HealthyBowlAnimalPedigree($context: ContextInput!, $animalId: ID!, $ancestorDepth: Int, $offspringDepth: Int) {
|
|
72
|
-
healthyBowlAnimalPedigree(
|
|
73
|
-
context: $context
|
|
74
|
-
animalId: $animalId
|
|
75
|
-
ancestorDepth: $ancestorDepth
|
|
76
|
-
offspringDepth: $offspringDepth
|
|
77
|
-
) {
|
|
78
|
-
root { ${h} }
|
|
79
|
-
ancestors { ${h} }
|
|
80
|
-
offspring { ${"\n animalId tagNumber name type gender dateOfBirth generation viaParent archived parentAnimalId parentAnimalIds\n"} }
|
|
81
|
-
truncated
|
|
82
|
-
cycleDetected
|
|
83
|
-
ancestorDepth
|
|
84
|
-
offspringDepth
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
`, _ = r`
|
|
50
|
+
`, p = r`
|
|
88
51
|
query HealthyBowlAnimalDepth($context: ContextInput!, $animalId: ID!) {
|
|
89
|
-
healthyBowlAnimalDepth(context: $context, animalId: $animalId) { ${
|
|
52
|
+
healthyBowlAnimalDepth(context: $context, animalId: $animalId) { ${d} }
|
|
90
53
|
}
|
|
91
|
-
`,
|
|
54
|
+
`, m = r`
|
|
92
55
|
query HealthyBowlAnimalGroups($context: ContextInput!) {
|
|
93
56
|
healthyBowlAnimalGroups(context: $context) { ${c} }
|
|
94
57
|
}
|
|
95
|
-
`,
|
|
58
|
+
`, h = r`
|
|
96
59
|
mutation UpdateHealthyBowlAnimalDepth($input: UpdateHealthyBowlAnimalDepthInput!) {
|
|
97
|
-
updateHealthyBowlAnimalDepth(input: $input) { ${
|
|
60
|
+
updateHealthyBowlAnimalDepth(input: $input) { ${d} }
|
|
98
61
|
}
|
|
99
|
-
`,
|
|
62
|
+
`, g = r`
|
|
100
63
|
mutation CreateHealthyBowlAnimalGroup($input: CreateHealthyBowlAnimalGroupInput!) {
|
|
101
64
|
createHealthyBowlAnimalGroup(input: $input) { ${c} }
|
|
102
65
|
}
|
|
103
|
-
`,
|
|
66
|
+
`, _ = r`
|
|
104
67
|
mutation UpdateHealthyBowlAnimalGroup($input: UpdateHealthyBowlAnimalGroupInput!) {
|
|
105
68
|
updateHealthyBowlAnimalGroup(input: $input) { ${c} }
|
|
106
69
|
}
|
|
107
|
-
`,
|
|
70
|
+
`, v = r`
|
|
108
71
|
mutation DeleteHealthyBowlAnimalGroup($id: ID!, $context: ContextInput!) {
|
|
109
72
|
deleteHealthyBowlAnimalGroup(id: $id, context: $context)
|
|
110
73
|
}
|
|
111
|
-
`,
|
|
74
|
+
`, y = r`
|
|
112
75
|
mutation RecordHealthyBowlAnimalWeight($input: RecordHealthyBowlAnimalWeightInput!) {
|
|
113
|
-
recordHealthyBowlAnimalWeight(input: $input) { ${
|
|
76
|
+
recordHealthyBowlAnimalWeight(input: $input) { ${u} }
|
|
114
77
|
}
|
|
115
|
-
`,
|
|
78
|
+
`, b = r`
|
|
116
79
|
mutation DeleteHealthyBowlAnimalWeight($id: ID!, $context: ContextInput!) {
|
|
117
80
|
deleteHealthyBowlAnimalWeight(id: $id, context: $context)
|
|
118
81
|
}
|
|
119
82
|
`;
|
|
120
|
-
function
|
|
121
|
-
let { workspaceId: s } = e(), c = s || o, l = n(() => ({ workspaceId: c }), [c]), u = r.herd === !0, d = r.groups === !0,
|
|
122
|
-
variables:
|
|
123
|
-
context: l,
|
|
124
|
-
groupId: h,
|
|
125
|
-
search: T,
|
|
126
|
-
includeArchived: !0
|
|
127
|
-
} : {
|
|
83
|
+
function x(r = {}) {
|
|
84
|
+
let { workspaceId: s } = e(), c = s || o, l = n(() => ({ workspaceId: c }), [c]), u = r.herd === !0, d = r.groups === !0, x = r.animalId ?? null, S = a(f, {
|
|
85
|
+
variables: {
|
|
128
86
|
context: l,
|
|
129
|
-
groupId:
|
|
130
|
-
search:
|
|
87
|
+
groupId: r.herdGroupId ?? null,
|
|
88
|
+
search: r.herdSearch ?? null
|
|
131
89
|
},
|
|
132
90
|
fetchPolicy: "cache-and-network",
|
|
133
91
|
skip: !u
|
|
134
|
-
}),
|
|
92
|
+
}), C = a(m, {
|
|
135
93
|
variables: { context: l },
|
|
136
94
|
fetchPolicy: "cache-and-network",
|
|
137
95
|
skip: !d
|
|
138
|
-
}),
|
|
139
|
-
variables: {
|
|
140
|
-
context: l,
|
|
141
|
-
animalId: f ?? ""
|
|
142
|
-
},
|
|
143
|
-
fetchPolicy: "cache-and-network",
|
|
144
|
-
skip: !f
|
|
145
|
-
}), A = a(g, {
|
|
96
|
+
}), w = a(p, {
|
|
146
97
|
variables: {
|
|
147
98
|
context: l,
|
|
148
|
-
animalId:
|
|
149
|
-
ancestorDepth: r.pedigreeAncestorDepth ?? null,
|
|
150
|
-
offspringDepth: null
|
|
99
|
+
animalId: x ?? ""
|
|
151
100
|
},
|
|
152
101
|
fetchPolicy: "cache-and-network",
|
|
153
|
-
skip: !
|
|
154
|
-
}), [
|
|
102
|
+
skip: !x
|
|
103
|
+
}), [T] = i(h), [E] = i(g), [D] = i(_), [O] = i(v), [k] = i(y), [A] = i(b), j = t(() => S.refetch(), [S]), M = t(() => C.refetch(), [C]), N = t(() => w.refetch(), [w]), P = t(async () => {
|
|
155
104
|
let e = [];
|
|
156
|
-
u && e.push(
|
|
105
|
+
u && e.push(j().catch(() => void 0)), d && e.push(M().catch(() => void 0)), x && e.push(N().catch(() => void 0)), await Promise.all(e);
|
|
157
106
|
}, [
|
|
158
107
|
u,
|
|
159
108
|
d,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
]), U = t(async (e) => {
|
|
167
|
-
let t = await j({ variables: { input: {
|
|
109
|
+
x,
|
|
110
|
+
j,
|
|
111
|
+
M,
|
|
112
|
+
N
|
|
113
|
+
]), F = t(async (e) => {
|
|
114
|
+
let t = await T({ variables: { input: {
|
|
168
115
|
...e,
|
|
169
116
|
context: l
|
|
170
117
|
} } });
|
|
171
|
-
return await
|
|
118
|
+
return await P(), t.data?.updateHealthyBowlAnimalDepth;
|
|
172
119
|
}, [
|
|
173
|
-
|
|
120
|
+
T,
|
|
174
121
|
l,
|
|
175
|
-
|
|
176
|
-
]),
|
|
177
|
-
let t = await
|
|
122
|
+
P
|
|
123
|
+
]), I = t(async (e) => {
|
|
124
|
+
let t = await E({ variables: { input: {
|
|
178
125
|
...e,
|
|
179
126
|
context: l
|
|
180
127
|
} } });
|
|
181
|
-
return await
|
|
128
|
+
return await P(), t.data?.createHealthyBowlAnimalGroup;
|
|
182
129
|
}, [
|
|
183
|
-
|
|
130
|
+
E,
|
|
184
131
|
l,
|
|
185
|
-
|
|
186
|
-
]),
|
|
187
|
-
let t = await
|
|
132
|
+
P
|
|
133
|
+
]), L = t(async (e) => {
|
|
134
|
+
let t = await D({ variables: { input: {
|
|
188
135
|
...e,
|
|
189
136
|
context: l
|
|
190
137
|
} } });
|
|
191
|
-
return await
|
|
138
|
+
return await P(), t.data?.updateHealthyBowlAnimalGroup;
|
|
192
139
|
}, [
|
|
193
|
-
|
|
140
|
+
D,
|
|
194
141
|
l,
|
|
195
|
-
|
|
196
|
-
]),
|
|
197
|
-
await
|
|
142
|
+
P
|
|
143
|
+
]), R = t(async (e) => {
|
|
144
|
+
await O({ variables: {
|
|
198
145
|
id: e,
|
|
199
146
|
context: l
|
|
200
|
-
} }), await
|
|
147
|
+
} }), await P();
|
|
201
148
|
}, [
|
|
202
|
-
|
|
149
|
+
O,
|
|
203
150
|
l,
|
|
204
|
-
|
|
205
|
-
]),
|
|
206
|
-
let t = await
|
|
151
|
+
P
|
|
152
|
+
]), z = t(async (e) => {
|
|
153
|
+
let t = await k({ variables: { input: {
|
|
207
154
|
...e,
|
|
208
155
|
context: l
|
|
209
156
|
} } });
|
|
210
|
-
return await
|
|
157
|
+
return await P(), t.data?.recordHealthyBowlAnimalWeight;
|
|
211
158
|
}, [
|
|
212
|
-
|
|
159
|
+
k,
|
|
213
160
|
l,
|
|
214
|
-
|
|
215
|
-
]),
|
|
216
|
-
await
|
|
161
|
+
P
|
|
162
|
+
]), B = t(async (e) => {
|
|
163
|
+
await A({ variables: {
|
|
217
164
|
id: e,
|
|
218
165
|
context: l
|
|
219
|
-
} }), await
|
|
166
|
+
} }), await P();
|
|
220
167
|
}, [
|
|
221
|
-
|
|
168
|
+
A,
|
|
222
169
|
l,
|
|
223
|
-
|
|
170
|
+
P
|
|
224
171
|
]);
|
|
225
172
|
return {
|
|
226
|
-
herd:
|
|
227
|
-
groups:
|
|
228
|
-
animalDepth:
|
|
229
|
-
pedigree: A.data?.healthyBowlAnimalPedigree ?? null,
|
|
173
|
+
herd: S.data?.healthyBowlHerdDepth ?? null,
|
|
174
|
+
groups: C.data?.healthyBowlAnimalGroups ?? S.data?.healthyBowlHerdDepth?.groups ?? [],
|
|
175
|
+
animalDepth: w.data?.healthyBowlAnimalDepth ?? null,
|
|
230
176
|
loading: {
|
|
231
|
-
herd:
|
|
232
|
-
groups:
|
|
233
|
-
animal:
|
|
234
|
-
pedigree: A.loading
|
|
177
|
+
herd: S.loading,
|
|
178
|
+
groups: C.loading,
|
|
179
|
+
animal: w.loading
|
|
235
180
|
},
|
|
236
181
|
errors: {
|
|
237
|
-
herd:
|
|
238
|
-
groups:
|
|
239
|
-
animal:
|
|
240
|
-
pedigree: A.error ?? null
|
|
182
|
+
herd: S.error ?? null,
|
|
183
|
+
groups: C.error ?? null,
|
|
184
|
+
animal: w.error ?? null
|
|
241
185
|
},
|
|
242
|
-
refetchHerd:
|
|
243
|
-
refetchGroups:
|
|
244
|
-
refetchAnimal:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
deleteWeight: J
|
|
186
|
+
refetchHerd: j,
|
|
187
|
+
refetchGroups: M,
|
|
188
|
+
refetchAnimal: N,
|
|
189
|
+
updateAnimalDepth: F,
|
|
190
|
+
createGroup: I,
|
|
191
|
+
updateGroup: L,
|
|
192
|
+
deleteGroup: R,
|
|
193
|
+
recordWeight: z,
|
|
194
|
+
deleteWeight: B
|
|
252
195
|
};
|
|
253
196
|
}
|
|
254
197
|
//#endregion
|
|
255
|
-
export {
|
|
198
|
+
export { x as useHealthyBowlLivestockDepth };
|
|
256
199
|
|
|
257
200
|
//# sourceMappingURL=useHealthyBowlLivestockDepth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHealthyBowlLivestockDepth.js","names":[],"sources":["../../../src/healthybowl/hooks/useHealthyBowlLivestockDepth.ts"],"sourcesContent":["/**\n * Deep livestock records — data hook.\n * Roadmap 18 · BOFF-2890 · gap L-1.\n *\n * Broadens the animal record with EID/RFID, body-condition score, manual/smart groups, dam/sire\n * genealogy, grazing/rotation, and a weight history that yields ADG. The medication-withdrawal\n * end-date + \"do not sell\" compliance flag are REUSED from the shipped withdrawal sub-domain\n * (BOFF-2885) and surfaced here on the deep herd view. Documents are declared inline with `gql`\n * (the same escape hatch `useHealthyBowlWithdrawal`/`useHealthyBowlDistribution` use) because\n * codegen validates against the committed `graphql/wspace.graphql` snapshot. Types mirror\n * `wspace-healthybowl-svc/src/modules/healthybowl/schema/livestock-depth.gql`.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\nconst FALLBACK_WORKSPACE_ID = '00000000-0000-0000-0000-000000000001';\n\n// ── types (mirror livestock-depth.gql) ─────────────────────────────────────────\n\nexport interface AnimalWithdrawalBadge {\n status: string;\n blocked: boolean;\n endDate: string | null;\n daysLeft: number;\n milkClearDate: string | null;\n meatClearDate: string | null;\n eggsClearDate: string | null;\n}\n\nexport interface HerdDepthRow {\n animalId: string;\n tagNumber: string;\n eidTag: string | null;\n name: string;\n type: string;\n groupId: string | null;\n groupName: string | null;\n bodyConditionScore: number | null;\n adgKgPerDay: number | null;\n latestWeightKg: number | null;\n latestWeightAt: string | null;\n /**\n * True when the animal has left the herd. Only present at all when `herdIncludeArchived` was set —\n * the default document does not select it, so it is `undefined` on every other caller's rows.\n */\n archived?: boolean;\n withdrawal: AnimalWithdrawalBadge;\n}\n\nexport interface AnimalGroup {\n id: string;\n name: string;\n description: string | null;\n kind: string;\n smartRule: Record<string, unknown> | null;\n color: string | null;\n animalCount: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface HerdComplianceSummary {\n totalAnimals: number;\n animalsInWithdrawal: number;\n animalsClear: number;\n complianceMessage: string;\n}\n\nexport interface HerdDepthView {\n rows: HerdDepthRow[];\n summary: HerdComplianceSummary;\n groups: AnimalGroup[];\n /**\n * True when the server hit a row cap, so `rows` is a page of the herd rather than the herd\n * (BOFF-6012). `summary.totalAnimals` counts the rows returned; `groups[].animalCount` still\n * counts the whole herd.\n */\n truncated: boolean;\n}\n\nexport interface WeightRecord {\n id: string;\n animalId: string;\n weightKg: number;\n measuredAt: string;\n method: string | null;\n notes: string | null;\n createdAt: string;\n}\n\nexport interface AnimalDepthRecord {\n animalId: string;\n tagNumber: string;\n eidTag: string | null;\n name: string;\n type: string;\n breed: string | null;\n status: string;\n groupId: string | null;\n groupName: string | null;\n bodyConditionScore: number | null;\n damId: string | null;\n damTag: string | null;\n /** True when the dam has left the herd (BOFF-6011). Drives the \"(archived)\" suffix. */\n damArchived: boolean;\n sireId: string | null;\n sireTag: string | null;\n /** True when the sire has left the herd. See `damArchived`. */\n sireArchived: boolean;\n grazingPaddock: string | null;\n rotationDate: string | null;\n grazingNotes: string | null;\n adgKgPerDay: number | null;\n latestWeightKg: number | null;\n latestWeightAt: string | null;\n weightHistory: WeightRecord[];\n withdrawal: AnimalWithdrawalBadge;\n}\n\ninterface HbContext {\n workspaceId: string;\n}\n\n// ── field fragments ─────────────────────────────────────────────────────────\n\nconst WITHDRAWAL_FIELDS = `\n status\n blocked\n endDate\n daysLeft\n milkClearDate\n meatClearDate\n eggsClearDate\n`;\n\nconst GROUP_FIELDS = `\n id\n name\n description\n kind\n smartRule\n color\n animalCount\n createdAt\n updatedAt\n`;\n\nconst HERD_ROW_FIELDS = `\n animalId\n tagNumber\n eidTag\n name\n type\n groupId\n groupName\n bodyConditionScore\n adgKgPerDay\n latestWeightKg\n latestWeightAt\n withdrawal { ${WITHDRAWAL_FIELDS} }\n`;\n\n/** The herd row plus the archived marker. Only the genealogy picker asks for this — see the note\n * above `GET_HERD_DEPTH_WITH_ARCHIVED`. */\nconst HERD_ROW_FIELDS_WITH_ARCHIVED = `\n ${HERD_ROW_FIELDS}\n archived\n`;\n\nconst WEIGHT_FIELDS = `\n id\n animalId\n weightKg\n measuredAt\n method\n notes\n createdAt\n`;\n\nconst ANIMAL_DEPTH_FIELDS = `\n animalId\n tagNumber\n eidTag\n name\n type\n breed\n status\n groupId\n groupName\n bodyConditionScore\n damId\n damTag\n damArchived\n sireId\n sireTag\n sireArchived\n grazingPaddock\n rotationDate\n grazingNotes\n adgKgPerDay\n latestWeightKg\n latestWeightAt\n weightHistory { ${WEIGHT_FIELDS} }\n withdrawal { ${WITHDRAWAL_FIELDS} }\n`;\n\n// ── documents ─────────────────────────────────────────────────────────────\n\nconst GET_HERD_DEPTH = gql`\n query HealthyBowlHerdDepth($context: ContextInput!, $groupId: ID, $search: String) {\n healthyBowlHerdDepth(context: $context, groupId: $groupId, search: $search) {\n truncated\n rows { ${HERD_ROW_FIELDS} }\n summary { totalAnimals animalsInWithdrawal animalsClear complianceMessage }\n groups { ${GROUP_FIELDS} }\n }\n }\n`;\n\n/**\n * The archived-aware variant, used ONLY when a caller sets `herdIncludeArchived` (BOFF-6195).\n *\n * Deliberately a second document rather than one document with an optional argument. The herd list\n * and the grazing move modal do not want archived rows and have no reason to carry the risk: a\n * single shared document would send `includeArchived` and select `archived` on every read, so a\n * supergraph that has not yet composed those — a stale prod Hive CDN edge lasts ~30–40 min after a\n * publish — would fail validation on `/livestock/records` and `/livestock/grazing` too, not just on\n * the one page that needs the feature. The blast radius is now exactly the caller that opted in.\n *\n * The operation name differs so Apollo treats it as a distinct operation.\n */\nconst GET_HERD_DEPTH_WITH_ARCHIVED = gql`\n query HealthyBowlHerdDepthWithArchived(\n $context: ContextInput!\n $groupId: ID\n $search: String\n $includeArchived: Boolean\n ) {\n healthyBowlHerdDepth(context: $context, groupId: $groupId, search: $search, includeArchived: $includeArchived) {\n truncated\n rows { ${HERD_ROW_FIELDS_WITH_ARCHIVED} }\n summary { totalAnimals animalsInWithdrawal animalsClear complianceMessage }\n groups { ${GROUP_FIELDS} }\n }\n }\n`;\n\nexport interface PedigreeNode {\n animalId: string;\n tagNumber: string;\n name: string;\n type: string;\n breed: string | null;\n gender: string;\n dateOfBirth: string | null;\n generation: number;\n /** DAM | SIRE — which side of this node's own child it sits on. SELF on the root. */\n relation: string;\n archived: boolean;\n /** ONE of the animals a generation closer to the root that this node parents. */\n childAnimalId: string | null;\n}\n\nexport interface OffspringNode {\n animalId: string;\n tagNumber: string;\n name: string;\n type: string;\n gender: string;\n dateOfBirth: string | null;\n generation: number;\n /** DAM | SIRE | BOTH — the parent link followed from the preceding node in the pedigree walk. */\n viaParent: string;\n archived: boolean;\n /** One matching preceding parent for compatibility; parentAnimalIds retains every matching edge. */\n parentAnimalId: string | null;\n /** All immediately preceding parents matched in the walk; empty for direct offspring. */\n parentAnimalIds: string[];\n}\n\nexport interface AnimalPedigree {\n root: PedigreeNode;\n ancestors: PedigreeNode[];\n offspring: OffspringNode[];\n /** A depth or node cap stopped the walk, so the tree shown is incomplete. */\n truncated: boolean;\n /** The walk re-entered an animal it had already visited — reachable on undated rows. */\n cycleDetected: boolean;\n ancestorDepth: number;\n offspringDepth: number;\n}\n\nconst PEDIGREE_NODE_FIELDS = `\n animalId tagNumber name type breed gender dateOfBirth generation relation archived childAnimalId\n`;\nconst OFFSPRING_NODE_FIELDS = `\n animalId tagNumber name type gender dateOfBirth generation viaParent archived parentAnimalId parentAnimalIds\n`;\n\nconst GET_PEDIGREE = gql`\n query HealthyBowlAnimalPedigree($context: ContextInput!, $animalId: ID!, $ancestorDepth: Int, $offspringDepth: Int) {\n healthyBowlAnimalPedigree(\n context: $context\n animalId: $animalId\n ancestorDepth: $ancestorDepth\n offspringDepth: $offspringDepth\n ) {\n root { ${PEDIGREE_NODE_FIELDS} }\n ancestors { ${PEDIGREE_NODE_FIELDS} }\n offspring { ${OFFSPRING_NODE_FIELDS} }\n truncated\n cycleDetected\n ancestorDepth\n offspringDepth\n }\n }\n`;\n\nconst GET_ANIMAL_DEPTH = gql`\n query HealthyBowlAnimalDepth($context: ContextInput!, $animalId: ID!) {\n healthyBowlAnimalDepth(context: $context, animalId: $animalId) { ${ANIMAL_DEPTH_FIELDS} }\n }\n`;\n\nconst GET_GROUPS = gql`\n query HealthyBowlAnimalGroups($context: ContextInput!) {\n healthyBowlAnimalGroups(context: $context) { ${GROUP_FIELDS} }\n }\n`;\n\nconst UPDATE_ANIMAL_DEPTH = gql`\n mutation UpdateHealthyBowlAnimalDepth($input: UpdateHealthyBowlAnimalDepthInput!) {\n updateHealthyBowlAnimalDepth(input: $input) { ${ANIMAL_DEPTH_FIELDS} }\n }\n`;\n\nconst CREATE_GROUP = gql`\n mutation CreateHealthyBowlAnimalGroup($input: CreateHealthyBowlAnimalGroupInput!) {\n createHealthyBowlAnimalGroup(input: $input) { ${GROUP_FIELDS} }\n }\n`;\n\nconst UPDATE_GROUP = gql`\n mutation UpdateHealthyBowlAnimalGroup($input: UpdateHealthyBowlAnimalGroupInput!) {\n updateHealthyBowlAnimalGroup(input: $input) { ${GROUP_FIELDS} }\n }\n`;\n\nconst DELETE_GROUP = gql`\n mutation DeleteHealthyBowlAnimalGroup($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlAnimalGroup(id: $id, context: $context)\n }\n`;\n\nconst RECORD_WEIGHT = gql`\n mutation RecordHealthyBowlAnimalWeight($input: RecordHealthyBowlAnimalWeightInput!) {\n recordHealthyBowlAnimalWeight(input: $input) { ${WEIGHT_FIELDS} }\n }\n`;\n\nconst DELETE_WEIGHT = gql`\n mutation DeleteHealthyBowlAnimalWeight($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlAnimalWeight(id: $id, context: $context)\n }\n`;\n\n// ── hook ─────────────────────────────────────────────────────────────────────\n\nexport interface UseLivestockDepthOptions {\n /** Fetch the deep herd view (rows + compliance summary + groups). */\n herd?: boolean;\n /** Optional group filter for the herd view. */\n herdGroupId?: string | null;\n /** Optional free-text search (tag / name / EID) for the herd view. */\n herdSearch?: string | null;\n /**\n * Include archived (soft-deleted) animals in the herd rows. Off by default — only the genealogy\n * picker wants them, and they must never appear in a herd LIST. `summary` and\n * `groups[].animalCount` stay live-only whatever this is set to (BOFF-6195).\n */\n herdIncludeArchived?: boolean;\n /** Fetch the animal groups list. */\n groups?: boolean;\n /** Fetch a single animal's deep record. */\n animalId?: string | null;\n /** Fetch the animal's pedigree (ancestors + offspring). Requires `animalId` (BOFF-6097). */\n pedigree?: boolean;\n /** Generations of ancestors to walk. The server clamps to 1..8; default 4. */\n pedigreeAncestorDepth?: number | null;\n}\n\nexport function useHealthyBowlLivestockDepth(options: UseLivestockDepthOptions = {}) {\n const { workspaceId } = useHealthyBowl();\n const effectiveWorkspaceId = workspaceId || FALLBACK_WORKSPACE_ID;\n const ctx = useMemo<HbContext>(() => ({ workspaceId: effectiveWorkspaceId }), [effectiveWorkspaceId]);\n\n const enableHerd = options.herd === true;\n const enableGroups = options.groups === true;\n const animalId = options.animalId ?? null;\n const herdGroupId = options.herdGroupId ?? null;\n const herdSearch = options.herdSearch ?? null;\n const herdIncludeArchived = options.herdIncludeArchived ?? false;\n\n const herdQuery = useQuery<\n { healthyBowlHerdDepth: HerdDepthView },\n { context: HbContext; groupId: string | null; search: string | null; includeArchived?: boolean }\n >(herdIncludeArchived ? GET_HERD_DEPTH_WITH_ARCHIVED : GET_HERD_DEPTH, {\n variables: herdIncludeArchived\n ? { context: ctx, groupId: herdGroupId, search: herdSearch, includeArchived: true }\n : { context: ctx, groupId: herdGroupId, search: herdSearch },\n fetchPolicy: 'cache-and-network',\n skip: !enableHerd,\n });\n\n const groupsQuery = useQuery<{ healthyBowlAnimalGroups: AnimalGroup[] }, { context: HbContext }>(GET_GROUPS, {\n variables: { context: ctx },\n fetchPolicy: 'cache-and-network',\n skip: !enableGroups,\n });\n\n const animalQuery = useQuery<{ healthyBowlAnimalDepth: AnimalDepthRecord }, { context: HbContext; animalId: string }>(\n GET_ANIMAL_DEPTH,\n { variables: { context: ctx, animalId: animalId ?? '' }, fetchPolicy: 'cache-and-network', skip: !animalId }\n );\n\n const pedigreeQuery = useQuery<\n { healthyBowlAnimalPedigree: AnimalPedigree },\n { context: HbContext; animalId: string; ancestorDepth: number | null; offspringDepth: number | null }\n >(GET_PEDIGREE, {\n variables: {\n context: ctx,\n animalId: animalId ?? '',\n ancestorDepth: options.pedigreeAncestorDepth ?? null,\n offspringDepth: null,\n },\n fetchPolicy: 'cache-and-network',\n skip: !animalId || options.pedigree !== true,\n });\n\n const [updateAnimalDepthMutation] = useMutation(UPDATE_ANIMAL_DEPTH);\n const [createGroupMutation] = useMutation(CREATE_GROUP);\n const [updateGroupMutation] = useMutation(UPDATE_GROUP);\n const [deleteGroupMutation] = useMutation(DELETE_GROUP);\n const [recordWeightMutation] = useMutation(RECORD_WEIGHT);\n const [deleteWeightMutation] = useMutation(DELETE_WEIGHT);\n\n const refetchHerd = useCallback(() => herdQuery.refetch(), [herdQuery]);\n const refetchGroups = useCallback(() => groupsQuery.refetch(), [groupsQuery]);\n const refetchAnimal = useCallback(() => animalQuery.refetch(), [animalQuery]);\n const refetchPedigree = useCallback(() => pedigreeQuery.refetch(), [pedigreeQuery]);\n const enablePedigree = options.pedigree === true;\n\n const reconcile = useCallback(async () => {\n const runners: Array<Promise<unknown>> = [];\n if (enableHerd) runners.push(refetchHerd().catch(() => undefined));\n if (enableGroups) runners.push(refetchGroups().catch(() => undefined));\n if (animalId) runners.push(refetchAnimal().catch(() => undefined));\n // An edit that changes dam/sire changes the tree — without this the panel keeps showing the\n // pre-edit ancestry until a hard reload (BOFF-6097).\n if (animalId && enablePedigree) runners.push(refetchPedigree().catch(() => undefined));\n await Promise.all(runners);\n }, [enableHerd, enableGroups, animalId, enablePedigree, refetchHerd, refetchGroups, refetchAnimal, refetchPedigree]);\n\n const updateAnimalDepth = useCallback(\n async (input: Record<string, unknown>): Promise<AnimalDepthRecord | undefined> => {\n const res = await updateAnimalDepthMutation({ variables: { input: { ...input, context: ctx } } });\n await reconcile();\n return (res.data as { updateHealthyBowlAnimalDepth?: AnimalDepthRecord } | null)?.updateHealthyBowlAnimalDepth;\n },\n [updateAnimalDepthMutation, ctx, reconcile]\n );\n\n const createGroup = useCallback(\n async (input: Record<string, unknown>): Promise<AnimalGroup | undefined> => {\n const res = await createGroupMutation({ variables: { input: { ...input, context: ctx } } });\n await reconcile();\n return (res.data as { createHealthyBowlAnimalGroup?: AnimalGroup } | null)?.createHealthyBowlAnimalGroup;\n },\n [createGroupMutation, ctx, reconcile]\n );\n\n const updateGroup = useCallback(\n async (input: Record<string, unknown>): Promise<AnimalGroup | undefined> => {\n const res = await updateGroupMutation({ variables: { input: { ...input, context: ctx } } });\n await reconcile();\n return (res.data as { updateHealthyBowlAnimalGroup?: AnimalGroup } | null)?.updateHealthyBowlAnimalGroup;\n },\n [updateGroupMutation, ctx, reconcile]\n );\n\n const deleteGroup = useCallback(\n async (id: string): Promise<void> => {\n await deleteGroupMutation({ variables: { id, context: ctx } });\n await reconcile();\n },\n [deleteGroupMutation, ctx, reconcile]\n );\n\n const recordWeight = useCallback(\n async (input: Record<string, unknown>): Promise<WeightRecord | undefined> => {\n const res = await recordWeightMutation({ variables: { input: { ...input, context: ctx } } });\n await reconcile();\n return (res.data as { recordHealthyBowlAnimalWeight?: WeightRecord } | null)?.recordHealthyBowlAnimalWeight;\n },\n [recordWeightMutation, ctx, reconcile]\n );\n\n const deleteWeight = useCallback(\n async (id: string): Promise<void> => {\n await deleteWeightMutation({ variables: { id, context: ctx } });\n await reconcile();\n },\n [deleteWeightMutation, ctx, reconcile]\n );\n\n return {\n herd: herdQuery.data?.healthyBowlHerdDepth ?? null,\n groups: groupsQuery.data?.healthyBowlAnimalGroups ?? herdQuery.data?.healthyBowlHerdDepth?.groups ?? [],\n animalDepth: animalQuery.data?.healthyBowlAnimalDepth ?? null,\n pedigree: pedigreeQuery.data?.healthyBowlAnimalPedigree ?? null,\n loading: {\n herd: herdQuery.loading,\n groups: groupsQuery.loading,\n animal: animalQuery.loading,\n pedigree: pedigreeQuery.loading,\n },\n errors: {\n herd: herdQuery.error ?? null,\n groups: groupsQuery.error ?? null,\n animal: animalQuery.error ?? null,\n pedigree: pedigreeQuery.error ?? null,\n },\n refetchHerd,\n refetchGroups,\n refetchAnimal,\n refetchPedigree,\n updateAnimalDepth,\n createGroup,\n updateGroup,\n deleteGroup,\n recordWeight,\n deleteWeight,\n };\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"useHealthyBowlLivestockDepth.js","names":[],"sources":["../../../src/healthybowl/hooks/useHealthyBowlLivestockDepth.ts"],"sourcesContent":["/**\n * Deep livestock records — data hook.\n * Roadmap 18 · BOFF-2890 · gap L-1.\n *\n * Broadens the animal record with EID/RFID, body-condition score, manual/smart groups, dam/sire\n * genealogy, grazing/rotation, and a weight history that yields ADG. The medication-withdrawal\n * end-date + \"do not sell\" compliance flag are REUSED from the shipped withdrawal sub-domain\n * (BOFF-2885) and surfaced here on the deep herd view. Documents are declared inline with `gql`\n * (the same escape hatch `useHealthyBowlWithdrawal`/`useHealthyBowlDistribution` use) because\n * codegen validates against the committed `graphql/wspace.graphql` snapshot. Types mirror\n * `wspace-healthybowl-svc/src/modules/healthybowl/schema/livestock-depth.gql`.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\nconst FALLBACK_WORKSPACE_ID = '00000000-0000-0000-0000-000000000001';\n\n// ── types (mirror livestock-depth.gql) ─────────────────────────────────────────\n\nexport interface AnimalWithdrawalBadge {\n status: string;\n blocked: boolean;\n endDate: string | null;\n daysLeft: number;\n milkClearDate: string | null;\n meatClearDate: string | null;\n eggsClearDate: string | null;\n}\n\nexport interface HerdDepthRow {\n animalId: string;\n tagNumber: string;\n eidTag: string | null;\n name: string;\n type: string;\n groupId: string | null;\n groupName: string | null;\n bodyConditionScore: number | null;\n adgKgPerDay: number | null;\n latestWeightKg: number | null;\n latestWeightAt: string | null;\n withdrawal: AnimalWithdrawalBadge;\n}\n\nexport interface AnimalGroup {\n id: string;\n name: string;\n description: string | null;\n kind: string;\n smartRule: Record<string, unknown> | null;\n color: string | null;\n animalCount: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface HerdComplianceSummary {\n totalAnimals: number;\n animalsInWithdrawal: number;\n animalsClear: number;\n complianceMessage: string;\n}\n\nexport interface HerdDepthView {\n rows: HerdDepthRow[];\n summary: HerdComplianceSummary;\n groups: AnimalGroup[];\n}\n\nexport interface WeightRecord {\n id: string;\n animalId: string;\n weightKg: number;\n measuredAt: string;\n method: string | null;\n notes: string | null;\n createdAt: string;\n}\n\nexport interface AnimalDepthRecord {\n animalId: string;\n tagNumber: string;\n eidTag: string | null;\n name: string;\n type: string;\n breed: string | null;\n status: string;\n groupId: string | null;\n groupName: string | null;\n bodyConditionScore: number | null;\n damId: string | null;\n damTag: string | null;\n sireId: string | null;\n sireTag: string | null;\n grazingPaddock: string | null;\n rotationDate: string | null;\n grazingNotes: string | null;\n adgKgPerDay: number | null;\n latestWeightKg: number | null;\n latestWeightAt: string | null;\n weightHistory: WeightRecord[];\n withdrawal: AnimalWithdrawalBadge;\n}\n\ninterface HbContext {\n workspaceId: string;\n}\n\n// ── field fragments ─────────────────────────────────────────────────────────\n\nconst WITHDRAWAL_FIELDS = `\n status\n blocked\n endDate\n daysLeft\n milkClearDate\n meatClearDate\n eggsClearDate\n`;\n\nconst GROUP_FIELDS = `\n id\n name\n description\n kind\n smartRule\n color\n animalCount\n createdAt\n updatedAt\n`;\n\nconst HERD_ROW_FIELDS = `\n animalId\n tagNumber\n eidTag\n name\n type\n groupId\n groupName\n bodyConditionScore\n adgKgPerDay\n latestWeightKg\n latestWeightAt\n withdrawal { ${WITHDRAWAL_FIELDS} }\n`;\n\nconst WEIGHT_FIELDS = `\n id\n animalId\n weightKg\n measuredAt\n method\n notes\n createdAt\n`;\n\nconst ANIMAL_DEPTH_FIELDS = `\n animalId\n tagNumber\n eidTag\n name\n type\n breed\n status\n groupId\n groupName\n bodyConditionScore\n damId\n damTag\n sireId\n sireTag\n grazingPaddock\n rotationDate\n grazingNotes\n adgKgPerDay\n latestWeightKg\n latestWeightAt\n weightHistory { ${WEIGHT_FIELDS} }\n withdrawal { ${WITHDRAWAL_FIELDS} }\n`;\n\n// ── documents ─────────────────────────────────────────────────────────────\n\nconst GET_HERD_DEPTH = gql`\n query HealthyBowlHerdDepth($context: ContextInput!, $groupId: ID, $search: String) {\n healthyBowlHerdDepth(context: $context, groupId: $groupId, search: $search) {\n rows { ${HERD_ROW_FIELDS} }\n summary { totalAnimals animalsInWithdrawal animalsClear complianceMessage }\n groups { ${GROUP_FIELDS} }\n }\n }\n`;\n\nconst GET_ANIMAL_DEPTH = gql`\n query HealthyBowlAnimalDepth($context: ContextInput!, $animalId: ID!) {\n healthyBowlAnimalDepth(context: $context, animalId: $animalId) { ${ANIMAL_DEPTH_FIELDS} }\n }\n`;\n\nconst GET_GROUPS = gql`\n query HealthyBowlAnimalGroups($context: ContextInput!) {\n healthyBowlAnimalGroups(context: $context) { ${GROUP_FIELDS} }\n }\n`;\n\nconst UPDATE_ANIMAL_DEPTH = gql`\n mutation UpdateHealthyBowlAnimalDepth($input: UpdateHealthyBowlAnimalDepthInput!) {\n updateHealthyBowlAnimalDepth(input: $input) { ${ANIMAL_DEPTH_FIELDS} }\n }\n`;\n\nconst CREATE_GROUP = gql`\n mutation CreateHealthyBowlAnimalGroup($input: CreateHealthyBowlAnimalGroupInput!) {\n createHealthyBowlAnimalGroup(input: $input) { ${GROUP_FIELDS} }\n }\n`;\n\nconst UPDATE_GROUP = gql`\n mutation UpdateHealthyBowlAnimalGroup($input: UpdateHealthyBowlAnimalGroupInput!) {\n updateHealthyBowlAnimalGroup(input: $input) { ${GROUP_FIELDS} }\n }\n`;\n\nconst DELETE_GROUP = gql`\n mutation DeleteHealthyBowlAnimalGroup($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlAnimalGroup(id: $id, context: $context)\n }\n`;\n\nconst RECORD_WEIGHT = gql`\n mutation RecordHealthyBowlAnimalWeight($input: RecordHealthyBowlAnimalWeightInput!) {\n recordHealthyBowlAnimalWeight(input: $input) { ${WEIGHT_FIELDS} }\n }\n`;\n\nconst DELETE_WEIGHT = gql`\n mutation DeleteHealthyBowlAnimalWeight($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlAnimalWeight(id: $id, context: $context)\n }\n`;\n\n// ── hook ─────────────────────────────────────────────────────────────────────\n\nexport interface UseLivestockDepthOptions {\n /** Fetch the deep herd view (rows + compliance summary + groups). */\n herd?: boolean;\n /** Optional group filter for the herd view. */\n herdGroupId?: string | null;\n /** Optional free-text search (tag / name / EID) for the herd view. */\n herdSearch?: string | null;\n /** Fetch the animal groups list. */\n groups?: boolean;\n /** Fetch a single animal's deep record. */\n animalId?: string | null;\n}\n\nexport function useHealthyBowlLivestockDepth(options: UseLivestockDepthOptions = {}) {\n const { workspaceId } = useHealthyBowl();\n const effectiveWorkspaceId = workspaceId || FALLBACK_WORKSPACE_ID;\n const ctx = useMemo<HbContext>(() => ({ workspaceId: effectiveWorkspaceId }), [effectiveWorkspaceId]);\n\n const enableHerd = options.herd === true;\n const enableGroups = options.groups === true;\n const animalId = options.animalId ?? null;\n const herdGroupId = options.herdGroupId ?? null;\n const herdSearch = options.herdSearch ?? null;\n\n const herdQuery = useQuery<\n { healthyBowlHerdDepth: HerdDepthView },\n { context: HbContext; groupId: string | null; search: string | null }\n >(GET_HERD_DEPTH, {\n variables: { context: ctx, groupId: herdGroupId, search: herdSearch },\n fetchPolicy: 'cache-and-network',\n skip: !enableHerd,\n });\n\n const groupsQuery = useQuery<{ healthyBowlAnimalGroups: AnimalGroup[] }, { context: HbContext }>(GET_GROUPS, {\n variables: { context: ctx },\n fetchPolicy: 'cache-and-network',\n skip: !enableGroups,\n });\n\n const animalQuery = useQuery<{ healthyBowlAnimalDepth: AnimalDepthRecord }, { context: HbContext; animalId: string }>(\n GET_ANIMAL_DEPTH,\n { variables: { context: ctx, animalId: animalId ?? '' }, fetchPolicy: 'cache-and-network', skip: !animalId }\n );\n\n const [updateAnimalDepthMutation] = useMutation(UPDATE_ANIMAL_DEPTH);\n const [createGroupMutation] = useMutation(CREATE_GROUP);\n const [updateGroupMutation] = useMutation(UPDATE_GROUP);\n const [deleteGroupMutation] = useMutation(DELETE_GROUP);\n const [recordWeightMutation] = useMutation(RECORD_WEIGHT);\n const [deleteWeightMutation] = useMutation(DELETE_WEIGHT);\n\n const refetchHerd = useCallback(() => herdQuery.refetch(), [herdQuery]);\n const refetchGroups = useCallback(() => groupsQuery.refetch(), [groupsQuery]);\n const refetchAnimal = useCallback(() => animalQuery.refetch(), [animalQuery]);\n\n const reconcile = useCallback(async () => {\n const runners: Array<Promise<unknown>> = [];\n if (enableHerd) runners.push(refetchHerd().catch(() => undefined));\n if (enableGroups) runners.push(refetchGroups().catch(() => undefined));\n if (animalId) runners.push(refetchAnimal().catch(() => undefined));\n await Promise.all(runners);\n }, [enableHerd, enableGroups, animalId, refetchHerd, refetchGroups, refetchAnimal]);\n\n const updateAnimalDepth = useCallback(\n async (input: Record<string, unknown>): Promise<AnimalDepthRecord | undefined> => {\n const res = await updateAnimalDepthMutation({ variables: { input: { ...input, context: ctx } } });\n await reconcile();\n return (res.data as { updateHealthyBowlAnimalDepth?: AnimalDepthRecord } | null)?.updateHealthyBowlAnimalDepth;\n },\n [updateAnimalDepthMutation, ctx, reconcile]\n );\n\n const createGroup = useCallback(\n async (input: Record<string, unknown>): Promise<AnimalGroup | undefined> => {\n const res = await createGroupMutation({ variables: { input: { ...input, context: ctx } } });\n await reconcile();\n return (res.data as { createHealthyBowlAnimalGroup?: AnimalGroup } | null)?.createHealthyBowlAnimalGroup;\n },\n [createGroupMutation, ctx, reconcile]\n );\n\n const updateGroup = useCallback(\n async (input: Record<string, unknown>): Promise<AnimalGroup | undefined> => {\n const res = await updateGroupMutation({ variables: { input: { ...input, context: ctx } } });\n await reconcile();\n return (res.data as { updateHealthyBowlAnimalGroup?: AnimalGroup } | null)?.updateHealthyBowlAnimalGroup;\n },\n [updateGroupMutation, ctx, reconcile]\n );\n\n const deleteGroup = useCallback(\n async (id: string): Promise<void> => {\n await deleteGroupMutation({ variables: { id, context: ctx } });\n await reconcile();\n },\n [deleteGroupMutation, ctx, reconcile]\n );\n\n const recordWeight = useCallback(\n async (input: Record<string, unknown>): Promise<WeightRecord | undefined> => {\n const res = await recordWeightMutation({ variables: { input: { ...input, context: ctx } } });\n await reconcile();\n return (res.data as { recordHealthyBowlAnimalWeight?: WeightRecord } | null)?.recordHealthyBowlAnimalWeight;\n },\n [recordWeightMutation, ctx, reconcile]\n );\n\n const deleteWeight = useCallback(\n async (id: string): Promise<void> => {\n await deleteWeightMutation({ variables: { id, context: ctx } });\n await reconcile();\n },\n [deleteWeightMutation, ctx, reconcile]\n );\n\n return {\n herd: herdQuery.data?.healthyBowlHerdDepth ?? null,\n groups: groupsQuery.data?.healthyBowlAnimalGroups ?? herdQuery.data?.healthyBowlHerdDepth?.groups ?? [],\n animalDepth: animalQuery.data?.healthyBowlAnimalDepth ?? null,\n loading: {\n herd: herdQuery.loading,\n groups: groupsQuery.loading,\n animal: animalQuery.loading,\n },\n errors: {\n herd: herdQuery.error ?? null,\n groups: groupsQuery.error ?? null,\n animal: animalQuery.error ?? null,\n },\n refetchHerd,\n refetchGroups,\n refetchAnimal,\n updateAnimalDepth,\n createGroup,\n updateGroup,\n deleteGroup,\n recordWeight,\n deleteWeight,\n };\n}\n"],"mappings":"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"}
|
|
@@ -3,7 +3,7 @@ import { useCallback as t } from "react";
|
|
|
3
3
|
import { gql as n } from "@apollo/client";
|
|
4
4
|
import { useMutation as r, useQuery as i } from "@apollo/client/react";
|
|
5
5
|
//#region src/healthybowl/hooks/useIrrigationAutomation.ts
|
|
6
|
-
var a = "\n id\n scheduleId\n fieldId\n soilThresholdPct\n skipIfRain\n rainProbThreshold\n notifyInApp\n
|
|
6
|
+
var a = "\n id\n scheduleId\n fieldId\n soilThresholdPct\n skipIfRain\n rainProbThreshold\n notifyInApp\n status\n workflowKey\n lastRunId\n lastEvaluatedAt\n lastOutcome\n", o = n`
|
|
7
7
|
query HealthyBowlIrrigationAutomations($context: ContextInput!, $scheduleId: ID, $fieldId: ID) {
|
|
8
8
|
healthyBowlIrrigationAutomations(context: $context, scheduleId: $scheduleId, fieldId: $fieldId) {
|
|
9
9
|
${a}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIrrigationAutomation.js","names":[],"sources":["../../../src/healthybowl/hooks/useIrrigationAutomation.ts"],"sourcesContent":["/**\n * Irrigation automation data hook — FluidGrids-backed auto-irrigation rules\n * (roadmap #3, Phase B).\n *\n * Mirrors the raw-gql pattern used by `useIrrigation` (and Suppliers / Nursery):\n * the offline codegen doesn't type the IrrigationAutomation operations, so these\n * are hand-written `gql` documents executed directly against the live gateway.\n * Every op carries the workspace `context`.\n * @module healthybowl\n */\nimport { useCallback } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\n/** A FluidGrids-backed automation rule that drives an irrigation schedule. */\nexport interface IrrigationAutomation {\n id: string;\n /** The IrrigationSchedule this rule automates. */\n scheduleId: string;\n /** Convenience copy of the schedule's field (no FK enforced). */\n fieldId?: string | null;\n /** Soil-moisture threshold (%) below which the rule fires. */\n soilThresholdPct: number;\n /** When true, the run is skipped if rain is forecast. */\n skipIfRain?: boolean | null;\n /** Rain-probability threshold (%) above which a run is skipped. */\n rainProbThreshold?: number | null;\n /** When true, the farmer gets an in-app notification on each evaluation. */\n notifyInApp?: boolean | null;\n
|
|
1
|
+
{"version":3,"file":"useIrrigationAutomation.js","names":[],"sources":["../../../src/healthybowl/hooks/useIrrigationAutomation.ts"],"sourcesContent":["/**\n * Irrigation automation data hook — FluidGrids-backed auto-irrigation rules\n * (roadmap #3, Phase B).\n *\n * Mirrors the raw-gql pattern used by `useIrrigation` (and Suppliers / Nursery):\n * the offline codegen doesn't type the IrrigationAutomation operations, so these\n * are hand-written `gql` documents executed directly against the live gateway.\n * Every op carries the workspace `context`.\n * @module healthybowl\n */\nimport { useCallback } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\n/** A FluidGrids-backed automation rule that drives an irrigation schedule. */\nexport interface IrrigationAutomation {\n id: string;\n /** The IrrigationSchedule this rule automates. */\n scheduleId: string;\n /** Convenience copy of the schedule's field (no FK enforced). */\n fieldId?: string | null;\n /** Soil-moisture threshold (%) below which the rule fires. */\n soilThresholdPct: number;\n /** When true, the run is skipped if rain is forecast. */\n skipIfRain?: boolean | null;\n /** Rain-probability threshold (%) above which a run is skipped. */\n rainProbThreshold?: number | null;\n /** When true, the farmer gets an in-app notification on each evaluation. */\n notifyInApp?: boolean | null;\n /** Lifecycle status: active / paused. */\n status: string;\n /** FluidGrids workflow key; null until the workflow is provisioned. */\n workflowKey?: string | null;\n /** WorkflowRun id of the most recent run, if any. */\n lastRunId?: string | null;\n /** ISO-8601 timestamp of the last evaluation, if any. */\n lastEvaluatedAt?: string | null;\n /** Outcome summary of the last evaluation (e.g. ran / skipped). */\n lastOutcome?: string | null;\n}\n\n/** Editable fields for automation create (context is attached from the hook). */\nexport interface CreateIrrigationAutomationInput {\n scheduleId: string;\n soilThresholdPct: number;\n skipIfRain?: boolean | null;\n rainProbThreshold?: number | null;\n notifyInApp?: boolean | null;\n status?: string | null;\n}\n\n/** Editable fields for automation update (context is attached from the hook). */\nexport interface UpdateIrrigationAutomationInput {\n soilThresholdPct?: number | null;\n skipIfRain?: boolean | null;\n rainProbThreshold?: number | null;\n notifyInApp?: boolean | null;\n status?: string | null;\n}\n\nconst IRRIGATION_AUTOMATION_FIELDS = `\n id\n scheduleId\n fieldId\n soilThresholdPct\n skipIfRain\n rainProbThreshold\n notifyInApp\n status\n workflowKey\n lastRunId\n lastEvaluatedAt\n lastOutcome\n`;\n\nconst IRRIGATION_AUTOMATIONS_QUERY = gql`\n query HealthyBowlIrrigationAutomations($context: ContextInput!, $scheduleId: ID, $fieldId: ID) {\n healthyBowlIrrigationAutomations(context: $context, scheduleId: $scheduleId, fieldId: $fieldId) {\n ${IRRIGATION_AUTOMATION_FIELDS}\n }\n }\n`;\n\nconst CREATE_IRRIGATION_AUTOMATION = gql`\n mutation CreateHealthyBowlIrrigationAutomation($input: CreateHealthyBowlIrrigationAutomationInput!) {\n createHealthyBowlIrrigationAutomation(input: $input) {\n ${IRRIGATION_AUTOMATION_FIELDS}\n }\n }\n`;\n\nconst UPDATE_IRRIGATION_AUTOMATION = gql`\n mutation UpdateHealthyBowlIrrigationAutomation($input: UpdateHealthyBowlIrrigationAutomationInput!) {\n updateHealthyBowlIrrigationAutomation(input: $input) {\n ${IRRIGATION_AUTOMATION_FIELDS}\n }\n }\n`;\n\nconst DELETE_IRRIGATION_AUTOMATION = gql`\n mutation DeleteHealthyBowlIrrigationAutomation($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlIrrigationAutomation(id: $id, context: $context)\n }\n`;\n\nconst RUN_IRRIGATION_AUTOMATION = gql`\n mutation RunHealthyBowlIrrigationAutomation($id: ID!, $context: ContextInput!) {\n runHealthyBowlIrrigationAutomation(id: $id, context: $context)\n }\n`;\n\ninterface IrrigationAutomationsQueryData {\n healthyBowlIrrigationAutomations: IrrigationAutomation[];\n}\ninterface RunAutomationMutationData {\n runHealthyBowlIrrigationAutomation: string | null;\n}\n\n/**\n * Loads irrigation automation rules for the active workspace and exposes rule\n * CRUD (incl. pause/resume via `status`) plus a `runAutomation` trigger.\n * Mutations refetch the list so the caller's view stays in sync.\n */\nexport function useIrrigationAutomation() {\n const { workspaceId } = useHealthyBowl();\n const context = { workspaceId };\n\n const { data, loading, error, refetch } = useQuery<IrrigationAutomationsQueryData>(IRRIGATION_AUTOMATIONS_QUERY, {\n variables: { context },\n skip: !workspaceId,\n fetchPolicy: 'cache-and-network',\n notifyOnNetworkStatusChange: true,\n });\n\n const [createAutomationMutation] = useMutation(CREATE_IRRIGATION_AUTOMATION);\n const [updateAutomationMutation] = useMutation(UPDATE_IRRIGATION_AUTOMATION);\n const [deleteAutomationMutation] = useMutation(DELETE_IRRIGATION_AUTOMATION);\n const [runAutomationMutation] = useMutation<RunAutomationMutationData>(RUN_IRRIGATION_AUTOMATION);\n\n const createAutomation = useCallback(\n async (input: CreateIrrigationAutomationInput) => {\n await createAutomationMutation({ variables: { input: { ...input, context } } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [createAutomationMutation, refetch, workspaceId]\n );\n\n const updateAutomation = useCallback(\n async (id: string, input: UpdateIrrigationAutomationInput) => {\n await updateAutomationMutation({ variables: { input: { id, ...input, context } } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [updateAutomationMutation, refetch, workspaceId]\n );\n\n const deleteAutomation = useCallback(\n async (id: string) => {\n await deleteAutomationMutation({ variables: { id, context } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [deleteAutomationMutation, refetch, workspaceId]\n );\n\n const runAutomation = useCallback(\n async (id: string): Promise<string | null> => {\n const result = await runAutomationMutation({ variables: { id, context } });\n await refetch();\n return result.data?.runHealthyBowlIrrigationAutomation ?? null;\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [runAutomationMutation, refetch, workspaceId]\n );\n\n return {\n automations: data?.healthyBowlIrrigationAutomations ?? [],\n loading,\n error: error ?? null,\n refetch,\n createAutomation,\n updateAutomation,\n deleteAutomation,\n runAutomation,\n };\n}\n"],"mappings":";;;;;AA6DA,IAAM,IAA+B,mLAe/B,IAA+B,CAAG;;;QAGhC,EAA6B;;;GAK/B,IAA+B,CAAG;;;QAGhC,EAA6B;;;GAK/B,IAA+B,CAAG;;;QAGhC,EAA6B;;;GAK/B,IAA+B,CAAG;;;;GAMlC,IAA4B,CAAG;;;;;AAkBrC,SAAgB,IAA0B;CACxC,IAAM,EAAE,mBAAgB,EAAe,GACjC,IAAU,EAAE,eAAY,GAExB,EAAE,SAAM,YAAS,UAAO,eAAY,EAAyC,GAA8B;EAC/G,WAAW,EAAE,WAAQ;EACrB,MAAM,CAAC;EACP,aAAa;EACb,6BAA6B;CAC/B,CAAC,GAEK,CAAC,KAA4B,EAAY,CAA4B,GACrE,CAAC,KAA4B,EAAY,CAA4B,GACrE,CAAC,KAA4B,EAAY,CAA4B,GACrE,CAAC,KAAyB,EAAuC,CAAyB,GAE1F,IAAmB,EACvB,OAAO,MAA2C;EAEhD,AADA,MAAM,EAAyB,EAAE,WAAW,EAAE,OAAO;GAAE,GAAG;GAAO;EAAQ,EAAE,EAAE,CAAC,GAC9E,MAAM,EAAQ;CAChB,GAEA;EAAC;EAA0B;EAAS;CAAW,CACjD,GAEM,IAAmB,EACvB,OAAO,GAAY,MAA2C;EAE5D,AADA,MAAM,EAAyB,EAAE,WAAW,EAAE,OAAO;GAAE;GAAI,GAAG;GAAO;EAAQ,EAAE,EAAE,CAAC,GAClF,MAAM,EAAQ;CAChB,GAEA;EAAC;EAA0B;EAAS;CAAW,CACjD,GAEM,IAAmB,EACvB,OAAO,MAAe;EAEpB,AADA,MAAM,EAAyB,EAAE,WAAW;GAAE;GAAI;EAAQ,EAAE,CAAC,GAC7D,MAAM,EAAQ;CAChB,GAEA;EAAC;EAA0B;EAAS;CAAW,CACjD,GAEM,IAAgB,EACpB,OAAO,MAAuC;EAC5C,IAAM,IAAS,MAAM,EAAsB,EAAE,WAAW;GAAE;GAAI;EAAQ,EAAE,CAAC;EAEzE,OADA,MAAM,EAAQ,GACP,EAAO,MAAM,sCAAsC;CAC5D,GAEA;EAAC;EAAuB;EAAS;CAAW,CAC9C;CAEA,OAAO;EACL,aAAa,GAAM,oCAAoC,CAAC;EACxD;EACA,OAAO,KAAS;EAChB;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -3,7 +3,7 @@ import { useCallback as t, useMemo as n } from "react";
|
|
|
3
3
|
import { gql as r } from "@apollo/client";
|
|
4
4
|
import { useMutation as i, useQuery as a } from "@apollo/client/react";
|
|
5
5
|
//#region src/healthybowl/hooks/useSuccessionPlanning.ts
|
|
6
|
-
var o = "\n id\n cropId\n fieldId\n cropName\n season\n startDate\n sowDate\n status\n bedId\n plantCatalogId\n plantsNeeded\n seedGrams\n seedlingsToRaise\n
|
|
6
|
+
var o = "\n id\n cropId\n fieldId\n cropName\n season\n startDate\n sowDate\n status\n bedId\n plantCatalogId\n plantsNeeded\n seedGrams\n seedlingsToRaise\n successionGroupId\n successionIndex\n", s = r`
|
|
7
7
|
query HealthyBowlSuccessionPlans($context: ContextInput!) {
|
|
8
8
|
getHealthyBowlCropsData(context: $context) {
|
|
9
9
|
plantingPlans {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSuccessionPlanning.js","names":[],"sources":["../../../src/healthybowl/hooks/useSuccessionPlanning.ts"],"sourcesContent":["/**\n * Succession-planting data hook (roadmap I-6).\n *\n * The offline codegen doesn't type the succession/bed operations, so — mirroring\n * the raw-gql pattern used for the Master Plant List and field boundaries — these\n * are hand-written `gql` documents executed directly against the live gateway.\n *\n * Existing plans are read from `getHealthyBowlCropsData.plantingPlans` (the only\n * place plantingPlans is exposed) and filtered to this field client-side.\n * @module healthybowl\n */\nimport { useCallback, useMemo } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\n/** A planting plan row with the succession + seed-rate fields we care about. */\nexport interface SuccessionPlan {\n id: string;\n cropId?: string | null;\n fieldId?: string | null;\n cropName: string;\n season: string;\n startDate: string;\n sowDate?: string | null;\n status: string;\n bedId?: string | null;\n plantCatalogId?: string | null;\n plantsNeeded?: number | null;\n seedGrams?: number | null;\n seedlingsToRaise?: number | null;\n
|
|
1
|
+
{"version":3,"file":"useSuccessionPlanning.js","names":[],"sources":["../../../src/healthybowl/hooks/useSuccessionPlanning.ts"],"sourcesContent":["/**\n * Succession-planting data hook (roadmap I-6).\n *\n * The offline codegen doesn't type the succession/bed operations, so — mirroring\n * the raw-gql pattern used for the Master Plant List and field boundaries — these\n * are hand-written `gql` documents executed directly against the live gateway.\n *\n * Existing plans are read from `getHealthyBowlCropsData.plantingPlans` (the only\n * place plantingPlans is exposed) and filtered to this field client-side.\n * @module healthybowl\n */\nimport { useCallback, useMemo } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\n/** A planting plan row with the succession + seed-rate fields we care about. */\nexport interface SuccessionPlan {\n id: string;\n cropId?: string | null;\n fieldId?: string | null;\n cropName: string;\n season: string;\n startDate: string;\n sowDate?: string | null;\n status: string;\n bedId?: string | null;\n plantCatalogId?: string | null;\n plantsNeeded?: number | null;\n seedGrams?: number | null;\n seedlingsToRaise?: number | null;\n successionGroupId?: string | null;\n successionIndex?: number | null;\n}\n\n/** A bed on this field, for the optional succession bed selector. */\nexport interface FieldBed {\n id: string;\n name: string;\n}\n\n/** Input for a succession series (context is attached from the hook). */\nexport interface SuccessionInput {\n fieldId: string;\n bedId?: string | null;\n cropId?: string | null;\n plantCatalogId?: string | null;\n season?: string | null;\n year: number;\n startDate: string;\n intervalDays: number;\n count: number;\n plantsNeeded?: number | null;\n seedGrams?: number | null;\n seedlingsToRaise?: number | null;\n density?: number | null;\n notes?: string | null;\n}\n\nconst PLAN_FIELDS = `\n id\n cropId\n fieldId\n cropName\n season\n startDate\n sowDate\n status\n bedId\n plantCatalogId\n plantsNeeded\n seedGrams\n seedlingsToRaise\n successionGroupId\n successionIndex\n`;\n\nconst PLANS_QUERY = gql`\n query HealthyBowlSuccessionPlans($context: ContextInput!) {\n getHealthyBowlCropsData(context: $context) {\n plantingPlans {\n ${PLAN_FIELDS}\n }\n }\n }\n`;\n\nconst BEDS_QUERY = gql`\n query HealthyBowlBedsForSuccession($context: ContextInput!, $fieldId: ID) {\n healthyBowlBeds(context: $context, fieldId: $fieldId) {\n id\n name\n }\n }\n`;\n\nconst CREATE_SUCCESSION = gql`\n mutation CreateHealthyBowlSuccessionPlan($input: CreateHealthyBowlSuccessionPlanInput!) {\n createHealthyBowlSuccessionPlan(input: $input) {\n ${PLAN_FIELDS}\n }\n }\n`;\n\nconst DELETE_PLAN = gql`\n mutation DeleteHealthyBowlPlantingPlanFromSuccession($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlPlantingPlan(id: $id, context: $context)\n }\n`;\n\ninterface PlansQueryData {\n getHealthyBowlCropsData: { plantingPlans: SuccessionPlan[] };\n}\ninterface BedsQueryData {\n healthyBowlBeds: FieldBed[];\n}\n\n/**\n * Loads succession plans + beds for one field and exposes create/delete helpers.\n * Only plans with a `successionGroupId` that belong to `fieldId` are returned,\n * already sorted by group then by succession index.\n */\nexport function useSuccessionPlanning(fieldId: string | undefined) {\n const { workspaceId } = useHealthyBowl();\n const context = { workspaceId };\n\n const {\n data: plansData,\n loading,\n error,\n refetch,\n } = useQuery<PlansQueryData>(PLANS_QUERY, {\n variables: { context },\n skip: !workspaceId,\n fetchPolicy: 'cache-and-network',\n notifyOnNetworkStatusChange: true,\n });\n\n const { data: bedsData } = useQuery<BedsQueryData>(BEDS_QUERY, {\n variables: { context, fieldId },\n skip: !workspaceId || !fieldId,\n fetchPolicy: 'cache-and-network',\n });\n\n const [createMutation] = useMutation(CREATE_SUCCESSION);\n const [deleteMutation] = useMutation(DELETE_PLAN);\n\n const successionPlans = useMemo(() => {\n const all = plansData?.getHealthyBowlCropsData?.plantingPlans ?? [];\n return all\n .filter((p) => p.fieldId === fieldId && p.successionGroupId != null)\n .sort((a, b) => {\n const group = String(a.successionGroupId).localeCompare(String(b.successionGroupId));\n if (group !== 0) return group;\n return (a.successionIndex ?? 0) - (b.successionIndex ?? 0);\n });\n }, [plansData, fieldId]);\n\n const createSuccession = useCallback(\n async (input: SuccessionInput): Promise<SuccessionPlan[]> => {\n const result = await createMutation({ variables: { input: { ...input, context } } });\n await refetch();\n const data = result.data as { createHealthyBowlSuccessionPlan?: SuccessionPlan[] } | null | undefined;\n return data?.createHealthyBowlSuccessionPlan ?? [];\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [createMutation, refetch, workspaceId]\n );\n\n const deletePlan = useCallback(\n async (id: string) => {\n await deleteMutation({ variables: { id, context } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [deleteMutation, refetch, workspaceId]\n );\n\n return {\n successionPlans,\n beds: bedsData?.healthyBowlBeds ?? [],\n loading,\n error,\n refetch,\n createSuccession,\n deletePlan,\n };\n}\n"],"mappings":";;;;;AA2DA,IAAM,IAAc,6MAkBd,IAAc,CAAG;;;;UAIb,EAAY;;;;GAMhB,IAAa,CAAG;;;;;;;GAShB,IAAoB,CAAG;;;QAGrB,EAAY;;;GAKd,IAAc,CAAG;;;;;AAkBvB,SAAgB,EAAsB,GAA6B;CACjE,IAAM,EAAE,mBAAgB,EAAe,GACjC,IAAU,EAAE,eAAY,GAExB,EACJ,MAAM,GACN,YACA,UACA,eACE,EAAyB,GAAa;EACxC,WAAW,EAAE,WAAQ;EACrB,MAAM,CAAC;EACP,aAAa;EACb,6BAA6B;CAC/B,CAAC,GAEK,EAAE,MAAM,MAAa,EAAwB,GAAY;EAC7D,WAAW;GAAE;GAAS;EAAQ;EAC9B,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;CACf,CAAC,GAEK,CAAC,KAAkB,EAAY,CAAiB,GAChD,CAAC,KAAkB,EAAY,CAAW,GAE1C,IAAkB,SACV,GAAW,yBAAyB,iBAAiB,CAAC,GAE/D,QAAQ,MAAM,EAAE,YAAY,KAAW,EAAE,qBAAqB,IAAI,EAClE,MAAM,GAAG,MAAM;EACd,IAAM,IAAQ,OAAO,EAAE,iBAAiB,EAAE,cAAc,OAAO,EAAE,iBAAiB,CAAC;EAEnF,OADI,MAAU,KACN,EAAE,mBAAmB,MAAM,EAAE,mBAAmB,KADhC;CAE1B,CAAC,GACF,CAAC,GAAW,CAAO,CAAC,GAEjB,IAAmB,EACvB,OAAO,MAAsD;EAC3D,IAAM,IAAS,MAAM,EAAe,EAAE,WAAW,EAAE,OAAO;GAAE,GAAG;GAAO;EAAQ,EAAE,EAAE,CAAC;EAGnF,OAFA,MAAM,EAAQ,GACD,EAAO,MACP,mCAAmC,CAAC;CACnD,GAEA;EAAC;EAAgB;EAAS;CAAW,CACvC,GAEM,IAAa,EACjB,OAAO,MAAe;EAEpB,AADA,MAAM,EAAe,EAAE,WAAW;GAAE;GAAI;EAAQ,EAAE,CAAC,GACnD,MAAM,EAAQ;CAChB,GAEA;EAAC;EAAgB;EAAS;CAAW,CACvC;CAEA,OAAO;EACL;EACA,MAAM,GAAU,mBAAmB,CAAC;EACpC;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -3,7 +3,7 @@ import { useCallback as t } from "react";
|
|
|
3
3
|
import { gql as n } from "@apollo/client";
|
|
4
4
|
import { useLazyQuery as r, useMutation as i, useQuery as a } from "@apollo/client/react";
|
|
5
5
|
//#region src/healthybowl/hooks/useWeatherIntelligence.ts
|
|
6
|
-
var o = "\n startYear\n endYear\n baselineYears\n source\n synced\n lastSyncedAt\n points {\n year\n month\n monthName\n avgTemp\n totalRainfall\n avgHumidity\n }\n baseline {\n month\n monthName\n avgTemp\n tempMin\n tempMax\n avgRainfall\n rainfallMin\n rainfallMax\n }\n", s = "\n id\n ruleId\n ruleName\n alertType\n severity\n title\n advisory\n metric\n observedValue\n threshold\n unit\n fieldId\n cropName\n conditionSignature\n windowStartAt\n windowEndAt\n channels\n status\n triggeredAt\n handledAt\n snoozedUntil\n", c = "\n inAppEnabled\n smsEnabled\n smsNumber\n emailEnabled\n
|
|
6
|
+
var o = "\n startYear\n endYear\n baselineYears\n source\n synced\n lastSyncedAt\n points {\n year\n month\n monthName\n avgTemp\n totalRainfall\n avgHumidity\n }\n baseline {\n month\n monthName\n avgTemp\n tempMin\n tempMax\n avgRainfall\n rainfallMin\n rainfallMax\n }\n", s = "\n id\n ruleId\n ruleName\n alertType\n severity\n title\n advisory\n metric\n observedValue\n threshold\n unit\n fieldId\n cropName\n conditionSignature\n windowStartAt\n windowEndAt\n channels\n status\n triggeredAt\n handledAt\n snoozedUntil\n", c = "\n inAppEnabled\n smsEnabled\n smsNumber\n emailEnabled\n webhookEnabled\n webhookUrl\n quietHoursEnabled\n quietHoursStart\n quietHoursEnd\n escalateCriticalFrost\n alertLeadTimeHours\n baselineYears\n deviationThresholdPct\n weeklyDigestEmail\n aiAdvisoryEnabled\n advisoryLanguage\n units\n historyStartYear\n historyEndYear\n historyLastSyncedAt\n", l = n`
|
|
7
7
|
query GetHealthyBowlWeatherHistorySeries($context: ContextInput!, $years: Int) {
|
|
8
8
|
getHealthyBowlWeatherHistorySeries(context: $context, years: $years) {
|
|
9
9
|
${o}
|