@jsb188/mday 1.1.4 → 1.1.6
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 +20 -3
- package/src/constants/log-activityTexts.ts +209 -0
- package/src/constants/log.ts +339 -160
- package/src/constants/organization.ts +54 -0
- package/src/constants/product.ts +66 -0
- package/src/constants/report.ts +25 -0
- package/src/schemas/childOrganizationsQuery.ts +44 -0
- package/src/schemas/editLogEntry.ts +777 -0
- package/src/schemas/logsQuery.ts +352 -0
- package/src/schemas/organization.ts +228 -0
- package/src/schemas/productsQuery.ts +145 -0
- package/src/schemas/reportsQuery.ts +107 -0
- package/src/types/action.d.ts +42 -0
- package/src/types/log.d.ts +251 -28
- package/src/types/organization.d.ts +245 -0
- package/src/types/product.d.ts +173 -0
- package/src/types/report.d.ts +177 -0
- package/src/utils/log.ts +841 -36
- package/src/utils/organization.ts +233 -0
- package/src/utils/product-calEvent.ts +508 -0
- package/src/utils/route-helpers.ts +583 -0
- package/src/schemas/queryString.ts +0 -0
package/package.json
CHANGED
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsb188/mday",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Mday specific functions and constants.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "jsb188",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
9
9
|
"./constants/log": "./src/constants/log.ts",
|
|
10
|
-
"./
|
|
10
|
+
"./constants/organization": "./src/constants/organization.ts",
|
|
11
|
+
"./constants/product": "./src/constants/product.ts",
|
|
12
|
+
"./schemas/editLogEntry": "./src/schemas/editLogEntry.ts",
|
|
13
|
+
"./schemas/logsQuery": "./src/schemas/logsQuery.ts",
|
|
14
|
+
"./schemas/organization": "./src/schemas/organization.ts",
|
|
15
|
+
"./schemas/childOrganizationsQuery": "./src/schemas/childOrganizationsQuery.ts",
|
|
16
|
+
"./schemas/productsQuery": "./src/schemas/productsQuery.ts",
|
|
17
|
+
"./schemas/reportsQuery": "./src/schemas/reportsQuery.ts",
|
|
18
|
+
"./types/action.d": "./src/types/action.d.ts",
|
|
11
19
|
"./types/log.d": "./src/types/log.d.ts",
|
|
12
|
-
"./
|
|
20
|
+
"./types/organization.d": "./src/types/organization.d.ts",
|
|
21
|
+
"./types/product.d": "./src/types/product.d.ts",
|
|
22
|
+
"./types/report.d": "./src/types/report.d.ts",
|
|
23
|
+
"./utils/log": "./src/utils/log.ts",
|
|
24
|
+
"./utils/organization": "./src/utils/organization.ts",
|
|
25
|
+
"./utils/product-calEvent": "./src/utils/product-calEvent.ts",
|
|
26
|
+
"./utils/route": "./src/utils/route-helpers.ts"
|
|
13
27
|
},
|
|
14
28
|
"dependencies": {
|
|
15
29
|
"zod": "^3.25.67"
|
|
16
30
|
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@jsb188/app": "1.1.6"
|
|
33
|
+
},
|
|
17
34
|
"scripts": {
|
|
18
35
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
36
|
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* *Not* operation-specific activities that could be used for many farming operations
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const WATER_TESTING_ACTIVITY_TO_TEXT = {
|
|
6
|
+
WATER_TESTING: 'checking chlorine levels in water',
|
|
7
|
+
OTHER_WATER_TESTING_ACTIVITY: 'other water testing related activities',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* #### #### #### ####
|
|
12
|
+
* Arable farming
|
|
13
|
+
* #### #### #### ####
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export const ARABLE_FARMING_TO_TEXT = {
|
|
17
|
+
// # Seeding & transplanting activities
|
|
18
|
+
SEEDING: 'seeding crops',
|
|
19
|
+
DIRECT_SEEDING: 'direct seeding crops',
|
|
20
|
+
TRANSPLANTING: 'transplanting crops',
|
|
21
|
+
SEED_COMPLIANCE_NOTE: 'seed compliance notes',
|
|
22
|
+
OTHER_TRANSPLANT_ACTIVITY: 'other seeding or transplanting activities',
|
|
23
|
+
|
|
24
|
+
// # Field activities
|
|
25
|
+
PREPARE_SOIL: 'soil, beds preparation',
|
|
26
|
+
IRRIGATION: 'irrigation management',
|
|
27
|
+
FERTILIZATION_COMPOST: 'fertilization, compost application',
|
|
28
|
+
PROTECT_CROP: 'hand pulling weed, hoeing, and cultivation work',
|
|
29
|
+
MONITOR_CROP: 'crop monitoring',
|
|
30
|
+
PRUNING: 'pruning',
|
|
31
|
+
STRUCTURE_MAINTENANCE: 'trellising, structure maintenance',
|
|
32
|
+
PREPARE_HARVEST: 'preparing crops for harvest',
|
|
33
|
+
OTHER_FIELD_ACTIVITY: 'other field activities or farm operation notes',
|
|
34
|
+
|
|
35
|
+
// # Harvest activities
|
|
36
|
+
HARVEST_CROP: 'harvesting crops',
|
|
37
|
+
HARVEST_COUNT: 'counting, weighing harvested crops',
|
|
38
|
+
SORT_GRADE: 'sorting, grading crops',
|
|
39
|
+
YIELD_LOSS_ESTIMATE: 'estimating yield or loss',
|
|
40
|
+
OTHER_HARVEST_ACTIVITY: 'other harvest activities',
|
|
41
|
+
|
|
42
|
+
// # Post-harvest activities
|
|
43
|
+
POST_HARVEST_HANDLING: 'washing, drying, trimming, sorting, or grading produce',
|
|
44
|
+
POST_HARVEST_PACKAGING: 'packaging, cooling, or moving produce to storage',
|
|
45
|
+
OTHER_POST_HARVEST_ACTIVITY: 'other post-harvest activities such as cleaning, storage, and maintenance',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const ARABLE_TRANSACTIONS_TO_TEXT = {
|
|
49
|
+
// # Seed purchase activities
|
|
50
|
+
SEED_PURCHASE_INFO: 'seed purchase',
|
|
51
|
+
OTHER_SUPPLY_PURCHASE_ACTIVITY: 'other supply purchase',
|
|
52
|
+
|
|
53
|
+
// # Sales activities
|
|
54
|
+
SALE_PRODUCE_ORDER: 'purchase order (produce)',
|
|
55
|
+
OTHER_SALE_ORDER: 'purchase order (other)',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const ARABLE_SEED_TO_SALE_TO_TEXT = {
|
|
59
|
+
COLD_STORAGE_TEMPERATURE: 'checking or changing temperature (cold storage)',
|
|
60
|
+
...ARABLE_TRANSACTIONS_TO_TEXT,
|
|
61
|
+
...ARABLE_FARMING_TO_TEXT,
|
|
62
|
+
...WATER_TESTING_ACTIVITY_TO_TEXT,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Food Safety is separate from arable farming
|
|
66
|
+
|
|
67
|
+
export const ARABLE_FOOD_SAFETY_TO_TEXT = {
|
|
68
|
+
// # Hygiene
|
|
69
|
+
HYGIENE_PROCEDURE: 'hygiene procedures',
|
|
70
|
+
CONTAMINANT_RISK: 'contaminant risk assessment and mitigation (physical, chemical, microbial)',
|
|
71
|
+
BODILY_FLUID_CONTAMINATION: 'vomitting/bodily fluid decontamination',
|
|
72
|
+
SMOKING_EATING_DRINKING_CONTROL: 'smoking, eating, and drinking control actions',
|
|
73
|
+
PPE_USAGE: 'personal protective equipment (PPE) usage',
|
|
74
|
+
|
|
75
|
+
// # Sanitation
|
|
76
|
+
SANITATION_RISK: 'sanitation risk assessment and mitigation',
|
|
77
|
+
SANITATION_CONSTRUCTION_MAINTENANCE: 'sanitation facilities construction, repairs, or maintenance',
|
|
78
|
+
SANITATION_CLEANING: 'sanitation facilities cleaning activities',
|
|
79
|
+
SANITATION_PEST_CONTROL: 'pest control in sanitation facilities',
|
|
80
|
+
|
|
81
|
+
// # Equpiments & Materials
|
|
82
|
+
EQUIPMENTS_MATERIALS_RISK: 'Materials, food containers/equipments - safety assessment and mitigation',
|
|
83
|
+
EQUIPMENTS_MATERIALS_CLEANING: 'Materials, food containers/equipments - cleaning activities',
|
|
84
|
+
|
|
85
|
+
// # Environment & Biosecurity
|
|
86
|
+
ENVIRONMENT_RISK: 'environmental food safety risk assessment and mitigation',
|
|
87
|
+
|
|
88
|
+
// # Employees
|
|
89
|
+
EMPLOYEE_ORIENTATION: 'new employee orientation',
|
|
90
|
+
EMPLOYEE_TRAINING: 'employee training',
|
|
91
|
+
SICK_EMPLOYEE: 'employee sick report',
|
|
92
|
+
EMPLOYEE_INJURED: 'employee injury report',
|
|
93
|
+
// All texts for same activity names must be same across all operations
|
|
94
|
+
// ie. ARABLE vs FARMERS_MARKET
|
|
95
|
+
EMPLOYEE_NOTES: 'notes about an employee',
|
|
96
|
+
OPERATION_NOTES: 'general operation notes',
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const ARABLE_ACTIVITIES_TO_TEXT = {
|
|
100
|
+
...ARABLE_SEED_TO_SALE_TO_TEXT,
|
|
101
|
+
...ARABLE_FOOD_SAFETY_TO_TEXT,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* #### #### #### ####
|
|
106
|
+
* Farmers Market
|
|
107
|
+
* #### #### #### ####
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
export const FARMERS_MARKET_RECEIPT_TO_TEXT = {
|
|
111
|
+
MARKET_CREDIT_RECEIPT: 'market credits, coins, or voucher receipts',
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const FARMERS_MARKET_OPERATION_TO_TEXT = {
|
|
115
|
+
MARKET_ATTENDANCE: 'attendance for vendor',
|
|
116
|
+
MARKET_LOAD_LIST: 'vendor load list',
|
|
117
|
+
VENDOR_NOTES: 'notes about a vendor',
|
|
118
|
+
// All texts for same activity names must be same across all operations
|
|
119
|
+
// ie. ARABLE vs FARMERS_MARKET
|
|
120
|
+
EMPLOYEE_NOTES: 'notes about an employee',
|
|
121
|
+
FARMERS_MARKET_NOTES: 'notes about farmers market',
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const FARMERS_MARKET_ACTIVITIES_TO_TEXT = {
|
|
125
|
+
...FARMERS_MARKET_RECEIPT_TO_TEXT,
|
|
126
|
+
...FARMERS_MARKET_OPERATION_TO_TEXT,
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* #### #### #### ####
|
|
131
|
+
* Livestock ranching
|
|
132
|
+
* #### #### #### ####
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
export const LIVESTOCK_LIFECYCLE_TO_TEXT = {
|
|
136
|
+
// # Livestock life cycle
|
|
137
|
+
LIVESTOCK_PURCHASE: 'livestock purchase',
|
|
138
|
+
LIVESTOCK_BIRTH: 'livestock birth',
|
|
139
|
+
LIVESTOCK_REPRODUCTION: 'livestock reproduction',
|
|
140
|
+
LIVESTOCK_DEATH: 'livestock death',
|
|
141
|
+
OTHER_LIVESTOCK_LIFE_CYCLE_ACTIVITY: 'other livestock life cycle notes',
|
|
142
|
+
|
|
143
|
+
// # Livestock tracking
|
|
144
|
+
LIVESTOCK_GROUP_TRACKING: 'livestock group tracking/movement based on age or other criteria',
|
|
145
|
+
LIVESTOCK_PASTURE_TRACKING: 'livestock pasture tracking/movement', // where they are in pasture
|
|
146
|
+
LIVESTOCK_ROTATIONAL_GRAZING: 'livestock rotational grazing/movement',
|
|
147
|
+
OTHER_LIVESTOCK_TRACKING_ACTIVITY: 'other livestock tracking notes',
|
|
148
|
+
|
|
149
|
+
// # Livestock healthcare
|
|
150
|
+
LIVESTOCK_VACCINATION: 'livestock vaccination',
|
|
151
|
+
LIVESTOCK_SICK: 'livestock sickness',
|
|
152
|
+
LIVESTOCK_INJURY: 'livestock injury',
|
|
153
|
+
LIVESTOCK_CULL: 'livestock culling',
|
|
154
|
+
LIVESTOCK_TREATMENT: 'livestock treatment and recovery',
|
|
155
|
+
OTHER_LIVESTOCK_HEALTHCARE_ACTIVITY: 'other livestock healthcare notes',
|
|
156
|
+
|
|
157
|
+
// # Livestock sale
|
|
158
|
+
LIVESTOCK_SALE: 'livestock sale',
|
|
159
|
+
OTHER_LIVESTOCK_SALE_ACTIVITY: 'other sales activities',
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export const LIVESTOCK_RANCH_MANAGEMENT_TO_TEXT = {
|
|
163
|
+
// # Ranch management activities
|
|
164
|
+
PASTURE_SEEDING: 'pasture seeding',
|
|
165
|
+
FENCE_MAINTENANCE: 'fence maintenance and buffer management', // buffer zones/buffer management
|
|
166
|
+
WATER_SOURCE_MAINTENANCE: 'water source maintenance',
|
|
167
|
+
OTHER_PASTURE_LAND_MANAGEMENT_ACTIVITY: 'other pasture or ranch operation notes',
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const LIVESTOCK_TRANSACTIONS_TO_TEXT = {
|
|
171
|
+
// # Supply purchases
|
|
172
|
+
FEED_PURCHASE: 'feed purchase',
|
|
173
|
+
OTHER_SUPPLY_PURCHASE_ACTIVITY: 'other supply purchase',
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const LIVESTOCK_ACTIVITIES_TO_TEXT = {
|
|
177
|
+
...LIVESTOCK_LIFECYCLE_TO_TEXT,
|
|
178
|
+
...LIVESTOCK_RANCH_MANAGEMENT_TO_TEXT,
|
|
179
|
+
...LIVESTOCK_TRANSACTIONS_TO_TEXT,
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* #### #### #### ####
|
|
184
|
+
* AI tasks
|
|
185
|
+
* #### #### #### ####
|
|
186
|
+
*/
|
|
187
|
+
|
|
188
|
+
export const AI_TASKS_TO_TEXT = {
|
|
189
|
+
// NOTE: If updating this, update [functions-aiTasks.ts] too
|
|
190
|
+
AI_SEND_MESSAGE: 'message',
|
|
191
|
+
AI_REMINDER: 'reminder message',
|
|
192
|
+
AI_CHECK_IN: 'check-in message',
|
|
193
|
+
AI_SCHEDULED_TASK: 'scheduled task',
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Combine all activity texts;
|
|
198
|
+
* NOTE: If one of these Objects have same key and different value,
|
|
199
|
+
* That would cause a *huge* problem in the agent functions.
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
export const AGENT_TEXT_TO_ACTIVITIES: Record<string, string> = Object.fromEntries(
|
|
203
|
+
Object.entries({
|
|
204
|
+
...ARABLE_ACTIVITIES_TO_TEXT,
|
|
205
|
+
...FARMERS_MARKET_ACTIVITIES_TO_TEXT,
|
|
206
|
+
...LIVESTOCK_ACTIVITIES_TO_TEXT,
|
|
207
|
+
...AI_TASKS_TO_TEXT,
|
|
208
|
+
}).map(([key, value]) => [value, key]),
|
|
209
|
+
);
|