@jsb188/mday 1.1.10 → 1.1.12
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 +140 -54
- package/src/constants/agentMemory.ts +123 -0
- package/src/constants/agentNote.ts +212 -0
- package/src/constants/aiChat.ts +10 -0
- package/src/constants/billing.ts +126 -0
- package/src/constants/campaign.ts +236 -0
- package/src/constants/contact.ts +72 -0
- package/src/constants/csvExport.ts +133 -0
- package/src/constants/dataTable.ts +21 -21
- package/src/constants/dataTableFieldTypes.generated.ts +59 -0
- package/src/constants/docAccess.ts +33 -0
- package/src/constants/dt.ts +234 -0
- package/src/constants/email.ts +125 -7
- package/src/constants/fieldDoc.ts +104 -0
- package/src/constants/graphqlReactivity.ts +196 -0
- package/src/constants/integration.ts +8 -9
- package/src/constants/log.ts +14 -408
- package/src/constants/logDisplay/README.md +88 -0
- package/src/constants/logDisplay/defaults.ts +39 -0
- package/src/constants/logDisplay/index.ts +27 -0
- package/src/constants/logDisplay/operations/arable.ts +16 -0
- package/src/constants/logDisplay/operations/farmersMarket.ts +10 -0
- package/src/constants/logDisplay/operations/foodManufacturing.ts +13 -0
- package/src/constants/logDisplay/shared/accounting.ts +13 -0
- package/src/constants/logDisplay/shared/interactions.ts +13 -0
- package/src/constants/logDisplay/shared/rackTemperatures.ts +42 -0
- package/src/constants/logTaxonomy.generated.ts +2207 -0
- package/src/constants/noteDoc.ts +77 -0
- package/src/constants/organization.ts +18 -21
- package/src/constants/pageRoute.ts +23 -0
- package/src/constants/qrCode.ts +30 -0
- package/src/constants/sheet.ts +126 -14
- package/src/constants/sms.ts +18 -0
- package/src/constants/square.ts +6 -6
- package/src/constants/storage.ts +80 -7
- package/src/constants/usage.ts +82 -0
- package/src/constants/workflowSteps.ts +60 -0
- package/src/schemas/editLogEntry.ts +836 -780
- package/src/schemas/inboundContact.ts +60 -55
- package/src/schemas/logsQuery.ts +55 -49
- package/src/types/account.d.ts +4 -1
- package/src/types/agentMemory.d.ts +98 -0
- package/src/types/agentNote.d.ts +443 -0
- package/src/types/billing.d.ts +537 -0
- package/src/types/campaign.d.ts +1533 -0
- package/src/types/contact.d.ts +15 -0
- package/src/types/csvExport.d.ts +213 -0
- package/src/types/dataAnalysis.d.ts +44 -0
- package/src/types/dataTable.d.ts +115 -403
- package/src/types/definitionElement.d.ts +35 -0
- package/src/types/docAccess.d.ts +96 -0
- package/src/types/dt.d.ts +257 -0
- package/src/types/email.d.ts +184 -24
- package/src/types/emailReplyReport.d.ts +76 -0
- package/src/types/fieldDoc.d.ts +702 -0
- package/src/types/fieldDocContract.d.ts +90 -0
- package/src/types/inboundContact.d.ts +10 -1
- package/src/types/log.d.ts +254 -295
- package/src/types/logDisplay.types.ts +85 -0
- package/src/types/organization.d.ts +91 -43
- package/src/types/pageRoute.d.ts +48 -0
- package/src/types/qrCode.d.ts +96 -0
- package/src/types/richText.d.ts +81 -0
- package/src/types/sheet.d.ts +678 -129
- package/src/types/sms.d.ts +38 -0
- package/src/types/storage.d.ts +449 -129
- package/src/types/usage.d.ts +106 -0
- package/src/types/workflow.d.ts +315 -54
- package/src/utils/agentMemory.ts +15 -0
- package/src/utils/agentNote.ts +850 -0
- package/src/utils/aiChat.ts +43 -0
- package/src/utils/aiChatWork.ts +64 -0
- package/src/utils/billing.ts +37 -0
- package/src/utils/campaign.ts +1174 -0
- package/src/utils/campaignAI.ts +72 -0
- package/src/utils/campaignAccess.ts +239 -0
- package/src/utils/campaignEmail.ts +601 -0
- package/src/utils/campaignEmailCompiler.ts +372 -0
- package/src/utils/campaignEmailImages.ts +60 -0
- package/src/utils/campaignEmailStyles.ts +544 -0
- package/src/utils/campaignLifecycle.ts +104 -0
- package/src/utils/campaignPreview.ts +285 -0
- package/src/utils/contact.ts +50 -0
- package/src/utils/csvExport.ts +19 -0
- package/src/utils/dataTable.ts +95 -618
- package/src/utils/dataTableFieldTypeRegistry.ts +106 -0
- package/src/utils/dataTableRelativeDate.ts +447 -0
- package/src/utils/definitionElement.ts +84 -0
- package/src/utils/docAccess.ts +383 -0
- package/src/utils/documentName.ts +53 -0
- package/src/utils/email.ts +317 -51
- package/src/utils/emailReplyReport.test.ts +187 -0
- package/src/utils/emailReplyReport.ts +143 -0
- package/src/utils/fieldDoc.ts +157 -0
- package/src/utils/fieldDocAnswers.ts +128 -0
- package/src/utils/fieldDocDefaults.ts +36 -0
- package/src/utils/fieldDocProgram.ts +36 -0
- package/src/utils/fieldDocSummary.ts +30 -0
- package/src/utils/log.ts +276 -192
- package/src/utils/logDisplay.helpers.ts +177 -0
- package/src/utils/logDisplay.ts +87 -0
- package/src/utils/logRegistryValue.ts +90 -0
- package/src/utils/logStoreRead.ts +262 -0
- package/src/utils/logTaxonomy.helpers.ts +17 -0
- package/src/utils/logTaxonomy.ts +76 -0
- package/src/utils/logTaxonomyDisplay.ts +395 -0
- package/src/utils/noteDoc.ts +609 -0
- package/src/utils/organization.ts +337 -84
- package/src/utils/pageRoute.ts +71 -0
- package/src/utils/qrCode.helpers.ts +189 -0
- package/src/utils/qrCode.test.ts +519 -0
- package/src/utils/qrCode.ts +273 -0
- package/src/utils/richTextHTML.ts +385 -0
- package/src/utils/sheet.ts +199 -107
- package/src/utils/sheetAxisMove.ts +616 -0
- package/src/utils/sheetBootstrap.ts +1402 -0
- package/src/utils/sheetCellLiteral.ts +101 -0
- package/src/utils/sheetCommand.ts +358 -0
- package/src/utils/sheetDesign.ts +705 -0
- package/src/utils/sheetExport.ts +186 -0
- package/src/utils/sheetFeatureReference.ts +183 -0
- package/src/utils/sheetFormulaArgs.ts +168 -0
- package/src/utils/sheetFormulaCompile.ts +475 -0
- package/src/utils/sheetFormulaConditionalAggregate.ts +254 -0
- package/src/utils/sheetFormulaCriteria.ts +656 -0
- package/src/utils/sheetFormulaDate.ts +444 -0
- package/src/utils/sheetFormulaEvaluation.ts +899 -0
- package/src/utils/sheetFormulaEvaluator.ts +997 -0
- package/src/utils/sheetFormulaFunctionHandlers.ts +403 -0
- package/src/utils/sheetFormulaLogical.ts +116 -0
- package/src/utils/sheetFormulaLookup.ts +488 -0
- package/src/utils/sheetFormulaMath.ts +48 -0
- package/src/utils/sheetFormulaParser.ts +729 -0
- package/src/utils/sheetFormulaRange.ts +330 -0
- package/src/utils/sheetFormulaReference.ts +703 -0
- package/src/utils/sheetFormulaReferenceAggregates.ts +313 -0
- package/src/utils/sheetFormulaReferenceDates.ts +237 -0
- package/src/utils/sheetFormulaReferenceLogical.ts +330 -0
- package/src/utils/sheetFormulaReferenceLookup.ts +341 -0
- package/src/utils/sheetFormulaReferenceMath.ts +95 -0
- package/src/utils/sheetFormulaReferenceRewrite.ts +220 -0
- package/src/utils/sheetFormulaReferenceText.ts +462 -0
- package/src/utils/sheetFormulaSyntax.ts +1027 -0
- package/src/utils/sheetFormulaText.ts +430 -0
- package/src/utils/sheetJournal.ts +200 -0
- package/src/utils/sheetNumberFormat.ts +1012 -0
- package/src/utils/sheetPreview.ts +68 -0
- package/src/utils/sheetSequence.ts +118 -0
- package/src/utils/sheetSnapshot.ts +739 -0
- package/src/utils/sheetStructureEdit.ts +914 -0
- package/src/utils/sheetStructureReferences.ts +389 -0
- package/src/utils/square.ts +22 -12
- package/src/utils/storage.ts +198 -0
- package/src/utils/table-route.ts +127 -11
- package/src/utils/time.ts +12 -0
- package/src/utils/workflow.ts +334 -40
- package/src/utils/workflowLogFingerprint.ts +302 -0
- package/src/utils/workflowLogRevisionSnapshot.ts +424 -0
- package/src/utils/workflowProgress.ts +280 -0
- package/src/utils/workflowTriggers.ts +61 -0
- package/tests/agentNote.test.ts +395 -0
- package/tests/campaignAI.test.ts +119 -0
- package/tests/campaignAccess.test.ts +239 -0
- package/tests/campaignEmail.test.ts +441 -0
- package/tests/campaignLifecycle.test.ts +134 -0
- package/tests/campaignPublication.test.ts +309 -0
- package/tests/dataTableFieldTypeRegistry.test.ts +111 -0
- package/tests/dataTableRelativeDate.test.ts +412 -0
- package/tests/docAccess.test.ts +525 -0
- package/tests/editLogEntry.test.ts +112 -0
- package/tests/email.test.ts +39 -0
- package/tests/fieldDocProgram.test.ts +114 -0
- package/tests/logDisplay.fixtures.ts +67 -0
- package/tests/logDisplay.test.ts +227 -0
- package/tests/noteDoc.test.ts +514 -0
- package/tests/richTextHTML.test.ts +185 -0
- package/tests/sheetAxisMove.test.ts +352 -0
- package/tests/sheetBootstrap.test.ts +1967 -0
- package/tests/sheetFeatureReference.test.ts +22 -0
- package/tests/sheetFormulaCriteria.test.ts +269 -0
- package/tests/sheetFormulaEvaluator.test.ts +468 -0
- package/tests/sheetFormulaFunctions.test.ts +538 -0
- package/tests/sheetFormulaLanguage.test.ts +361 -0
- package/tests/sheetFormulaParity.fixtures.ts +872 -0
- package/tests/sheetFormulaParity.test.ts +188 -0
- package/tests/sheetFormulaRange.test.ts +167 -0
- package/tests/sheetFormulaReference.test.ts +78 -0
- package/tests/sheetFormulaReferenceRewrite.test.ts +117 -0
- package/tests/sheetFormulaTextDate.test.ts +512 -0
- package/tests/sheetSequence.test.ts +22 -0
- package/tests/sheetSnapshot.test.ts +134 -0
- package/tests/sheetStructureEdit.test.ts +537 -0
- package/tests/sheetStructureReferences.test.ts +589 -0
- package/tests/workflowLifecycleStatus.test.ts +60 -0
- package/tests/workflowLogFingerprint.test.ts +203 -0
- package/tests/workflowLogRevisionSnapshot.test.ts +96 -0
- package/tests/workflowProgress.test.ts +180 -0
- package/tests/workflowTriggers.test.ts +29 -0
- package/tsconfig.json +10 -10
- package/vitest.config.ts +8 -0
- package/src/constants/log-activityTexts.ts +0 -235
- package/src/constants/product.ts +0 -42
- package/src/constants/report.ts +0 -44
- package/src/schemas/organization.ts +0 -65
- package/src/schemas/productsQuery.ts +0 -53
- package/src/schemas/reportsQuery.ts +0 -20
- package/src/types/product.d.ts +0 -84
- package/src/types/report.d.ts +0 -290
- package/src/utils/product-calEvent.ts +0 -455
- package/src/utils/report.ts +0 -158
|
@@ -1,235 +0,0 @@
|
|
|
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
|
-
GREENHOUSE_SEEDING: 'greenhouse seeding crops',
|
|
21
|
-
TRANSPLANTING: 'transplanting crops',
|
|
22
|
-
SEED_COMPLIANCE_NOTE: 'seeding compliance notes',
|
|
23
|
-
OTHER_TRANSPLANT_ACTIVITY: 'other seeding or transplanting activities',
|
|
24
|
-
|
|
25
|
-
// # Field activities
|
|
26
|
-
PREPARE_SOIL: 'soil, beds preparation',
|
|
27
|
-
IRRIGATION: 'irrigation management',
|
|
28
|
-
FERTILIZATION_COMPOST: 'fertilization, compost application',
|
|
29
|
-
PROTECT_CROP: 'hand pulling weed, hoeing, and cultivation work',
|
|
30
|
-
MONITOR_CROP: 'crop monitoring',
|
|
31
|
-
PRUNING: 'pruning',
|
|
32
|
-
STRUCTURE_MAINTENANCE: 'trellising, structure maintenance',
|
|
33
|
-
PREPARE_HARVEST: 'preparing crops for harvest',
|
|
34
|
-
OTHER_FIELD_ACTIVITY: 'other field activities or farm operation notes',
|
|
35
|
-
|
|
36
|
-
// # Harvest activities
|
|
37
|
-
HARVEST_CROP: 'harvesting crops',
|
|
38
|
-
HARVEST_COUNT: 'counting, weighing harvested crops',
|
|
39
|
-
SORT_GRADE: 'sorting, grading crops',
|
|
40
|
-
YIELD_LOSS_ESTIMATE: 'estimating yield or loss',
|
|
41
|
-
OTHER_HARVEST_ACTIVITY: 'other harvest activities',
|
|
42
|
-
|
|
43
|
-
// # Post-harvest activities
|
|
44
|
-
POST_HARVEST_HANDLING: 'washing, drying, trimming, sorting, or grading produce',
|
|
45
|
-
POST_HARVEST_PACKAGING: 'packaging, cooling, or moving produce to storage',
|
|
46
|
-
OTHER_POST_HARVEST_ACTIVITY: 'other post-harvest activities such as cleaning, storage, and maintenance',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const ARABLE_PURCHASES_TO_TEXT = {
|
|
50
|
-
// # Seed purchase activities
|
|
51
|
-
SEED_PURCHASE_INFO: 'seed purchase',
|
|
52
|
-
OTHER_SUPPLY_PURCHASE_ACTIVITY: 'other supply purchase',
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const ARABLE_SALES_TO_TEXT = {
|
|
56
|
-
// # Sales activities
|
|
57
|
-
SALE_PRODUCE_ORDER: 'sales order (produce)',
|
|
58
|
-
OTHER_SALE_ORDER: 'sales order (other)',
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const ARABLE_SEED_TO_SALE_TO_TEXT = {
|
|
62
|
-
COLD_STORAGE_TEMPERATURE: 'checking or changing temperature (cold storage)',
|
|
63
|
-
...ARABLE_PURCHASES_TO_TEXT,
|
|
64
|
-
...ARABLE_SALES_TO_TEXT,
|
|
65
|
-
...ARABLE_FARMING_TO_TEXT,
|
|
66
|
-
...WATER_TESTING_ACTIVITY_TO_TEXT,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// Food Safety is separate from arable farming
|
|
70
|
-
|
|
71
|
-
export const ARABLE_FOOD_SAFETY_TO_TEXT = {
|
|
72
|
-
// # Hygiene
|
|
73
|
-
HYGIENE_PROCEDURE: 'hygiene procedures',
|
|
74
|
-
CONTAMINANT_RISK: 'contaminant risk assessment and mitigation (physical, chemical, microbial)',
|
|
75
|
-
BODILY_FLUID_CONTAMINATION: 'vomitting/bodily fluid decontamination',
|
|
76
|
-
SMOKING_EATING_DRINKING_CONTROL: 'smoking, eating, and drinking control actions',
|
|
77
|
-
PPE_USAGE: 'personal protective equipment (PPE) usage',
|
|
78
|
-
|
|
79
|
-
// # Sanitation
|
|
80
|
-
SANITATION_RISK: 'sanitation risk assessment and mitigation',
|
|
81
|
-
SANITATION_CONSTRUCTION_MAINTENANCE: 'sanitation facilities construction, repairs, or maintenance',
|
|
82
|
-
SANITATION_CLEANING: 'sanitation facilities cleaning activities',
|
|
83
|
-
SANITATION_PEST_CONTROL: 'pest control in sanitation facilities',
|
|
84
|
-
|
|
85
|
-
// # Equpiments & Materials
|
|
86
|
-
EQUIPMENTS_MATERIALS_RISK: 'Materials, food containers/equipments - safety assessment and mitigation',
|
|
87
|
-
EQUIPMENTS_MATERIALS_CLEANING: 'Materials, food containers/equipments - cleaning activities',
|
|
88
|
-
|
|
89
|
-
// # Environment & Biosecurity
|
|
90
|
-
ENVIRONMENT_RISK: 'environmental food safety risk assessment and mitigation',
|
|
91
|
-
|
|
92
|
-
// # Employees
|
|
93
|
-
EMPLOYEE_ORIENTATION: 'new employee orientation',
|
|
94
|
-
EMPLOYEE_TRAINING: 'employee training',
|
|
95
|
-
SICK_EMPLOYEE: 'employee sick report',
|
|
96
|
-
EMPLOYEE_INJURED: 'employee injury report',
|
|
97
|
-
// All texts for same activity names must be same across all operations
|
|
98
|
-
// ie. ARABLE vs FARMERS_MARKET
|
|
99
|
-
EMPLOYEE_NOTES: 'notes about an employee',
|
|
100
|
-
OPERATION_NOTES: 'general operation notes',
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export const ARABLE_ACTIVITIES_TO_TEXT = {
|
|
104
|
-
...ARABLE_SEED_TO_SALE_TO_TEXT,
|
|
105
|
-
...ARABLE_FOOD_SAFETY_TO_TEXT,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* #### #### #### ####
|
|
110
|
-
* Farmers Market
|
|
111
|
-
* #### #### #### ####
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
|
-
export const FARMERS_MARKET_RECEIPT_TO_TEXT = {
|
|
115
|
-
MARKET_CREDIT_RECEIPT: 'receipts for market credits, coins, or voucher redemption',
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export const FARMERS_MARKET_MANAGEMENT_TO_TEXT = {
|
|
119
|
-
MARKET_ATTENDANCE: 'attendance for vendor',
|
|
120
|
-
MARKET_LOAD_LIST: 'vendor load list',
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export const FARMERS_MARKET_NOTE_TO_TEXT = {
|
|
124
|
-
OPERATION_NOTE: 'general operation notes',
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export const FARMERS_MARKET_ACTIVITIES_TO_TEXT = {
|
|
128
|
-
...FARMERS_MARKET_RECEIPT_TO_TEXT,
|
|
129
|
-
...FARMERS_MARKET_MANAGEMENT_TO_TEXT,
|
|
130
|
-
...FARMERS_MARKET_NOTE_TO_TEXT,
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* #### #### #### ####
|
|
135
|
-
* Grower Network
|
|
136
|
-
* #### #### #### ####
|
|
137
|
-
*/
|
|
138
|
-
|
|
139
|
-
export const GROWER_NETWORK_INSPECTION_TO_TEXT = {
|
|
140
|
-
// # WORKER_PRACTICE
|
|
141
|
-
HYGIENE_PROCEDURE: 'worker hygiene procedures',
|
|
142
|
-
SANITATION_PRACTICE: 'sanitation conditions and cleanliness',
|
|
143
|
-
PERSONNEL_PRACTICE: 'PPE compliance, worker practices, training, illness',
|
|
144
|
-
|
|
145
|
-
// # EQUIPMENT
|
|
146
|
-
EQUIPMENT_MATERIAL: 'production and harvest equipments/tools/materials',
|
|
147
|
-
PACKAGING_STORAGE: 'packaging and storage of produce',
|
|
148
|
-
|
|
149
|
-
// # FIELD
|
|
150
|
-
ENVIRONMENT: 'environmental exposure and wildlife activity',
|
|
151
|
-
FIELD_CONDITION: 'field conditions, flood zones, erosion',
|
|
152
|
-
ADJACENT_LAND: 'adjacent land observations, risks',
|
|
153
|
-
|
|
154
|
-
// # PRODUCTION_INPUT
|
|
155
|
-
WATER_INPUT: 'water source, quality, treatment, testing, and application',
|
|
156
|
-
CHEMICAL_INPUT: 'chemical inputs handling and application',
|
|
157
|
-
FERTILIZER_INPUT: 'fertilizer inputs handling and application',
|
|
158
|
-
|
|
159
|
-
// # OPERATION
|
|
160
|
-
RECORDKEEPING: 'document control, record availability, and accuracy',
|
|
161
|
-
FACILITIES: 'facilities, physical infrastructure, and maintenance',
|
|
162
|
-
OPERATION_NOTE: 'general operation notes',
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export const GROWER_NETWORK_ACTIVITIES_TO_TEXT = {
|
|
166
|
-
...GROWER_NETWORK_INSPECTION_TO_TEXT,
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* #### #### #### ####
|
|
171
|
-
* Livestock ranching
|
|
172
|
-
* #### #### #### ####
|
|
173
|
-
*/
|
|
174
|
-
|
|
175
|
-
export const LIVESTOCK_LIFECYCLE_TO_TEXT = {
|
|
176
|
-
// # Livestock life cycle
|
|
177
|
-
LIVESTOCK_PURCHASE: 'livestock purchase',
|
|
178
|
-
LIVESTOCK_BIRTH: 'livestock birth',
|
|
179
|
-
LIVESTOCK_REPRODUCTION: 'livestock reproduction',
|
|
180
|
-
LIVESTOCK_DEATH: 'livestock death',
|
|
181
|
-
OTHER_LIVESTOCK_LIFE_CYCLE_ACTIVITY: 'other livestock life cycle notes',
|
|
182
|
-
|
|
183
|
-
// # Livestock tracking
|
|
184
|
-
LIVESTOCK_GROUP_TRACKING: 'livestock group tracking/movement based on age or other criteria',
|
|
185
|
-
LIVESTOCK_PASTURE_TRACKING: 'livestock pasture tracking/movement', // where they are in pasture
|
|
186
|
-
LIVESTOCK_ROTATIONAL_GRAZING: 'livestock rotational grazing/movement',
|
|
187
|
-
OTHER_LIVESTOCK_TRACKING_ACTIVITY: 'other livestock tracking notes',
|
|
188
|
-
|
|
189
|
-
// # Livestock healthcare
|
|
190
|
-
LIVESTOCK_VACCINATION: 'livestock vaccination',
|
|
191
|
-
LIVESTOCK_SICK: 'livestock sickness',
|
|
192
|
-
LIVESTOCK_INJURY: 'livestock injury',
|
|
193
|
-
LIVESTOCK_CULL: 'livestock culling',
|
|
194
|
-
LIVESTOCK_TREATMENT: 'livestock treatment and recovery',
|
|
195
|
-
OTHER_LIVESTOCK_HEALTHCARE_ACTIVITY: 'other livestock healthcare notes',
|
|
196
|
-
|
|
197
|
-
// # Livestock sale
|
|
198
|
-
LIVESTOCK_SALE: 'livestock sale',
|
|
199
|
-
OTHER_LIVESTOCK_SALE_ACTIVITY: 'other sales activities',
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
export const LIVESTOCK_RANCH_MANAGEMENT_TO_TEXT = {
|
|
203
|
-
// # Ranch management activities
|
|
204
|
-
PASTURE_SEEDING: 'pasture seeding',
|
|
205
|
-
FENCE_MAINTENANCE: 'fence maintenance and buffer management', // buffer zones/buffer management
|
|
206
|
-
WATER_SOURCE_MAINTENANCE: 'water source maintenance',
|
|
207
|
-
OTHER_PASTURE_LAND_MANAGEMENT_ACTIVITY: 'other pasture or ranch operation notes',
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export const LIVESTOCK_TRANSACTIONS_TO_TEXT = {
|
|
211
|
-
// # Supply purchases
|
|
212
|
-
FEED_PURCHASE: 'feed purchase',
|
|
213
|
-
OTHER_SUPPLY_PURCHASE_ACTIVITY: 'other supply purchase',
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export const LIVESTOCK_ACTIVITIES_TO_TEXT = {
|
|
217
|
-
...LIVESTOCK_LIFECYCLE_TO_TEXT,
|
|
218
|
-
...LIVESTOCK_RANCH_MANAGEMENT_TO_TEXT,
|
|
219
|
-
...LIVESTOCK_TRANSACTIONS_TO_TEXT,
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Combine all activity texts;
|
|
224
|
-
* NOTE: If one of these Objects have same key and different value,
|
|
225
|
-
* That would cause a *huge* problem in the agent functions.
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
export const AGENT_TEXT_TO_ACTIVITIES: Record<string, string> = Object.fromEntries(
|
|
229
|
-
Object.entries({
|
|
230
|
-
...ARABLE_ACTIVITIES_TO_TEXT,
|
|
231
|
-
...FARMERS_MARKET_ACTIVITIES_TO_TEXT,
|
|
232
|
-
...GROWER_NETWORK_ACTIVITIES_TO_TEXT,
|
|
233
|
-
...LIVESTOCK_ACTIVITIES_TO_TEXT,
|
|
234
|
-
}).map(([key, value]) => [value, key]),
|
|
235
|
-
);
|
package/src/constants/product.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Products; all types
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export const PRODUCT_TYPES = [
|
|
6
|
-
'FOOD_SAFETY',
|
|
7
|
-
'GLOBAL_GAP',
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Product features
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export const FEATURES_BY_OPERATION = {
|
|
15
|
-
ARABLE: [
|
|
16
|
-
'NORMAL_LOGGING', // First item is always the default
|
|
17
|
-
'FOOD_SAFETY',
|
|
18
|
-
'GLOBAL_GAP',
|
|
19
|
-
],
|
|
20
|
-
FARMERS_MARKET: [
|
|
21
|
-
'NORMAL_LOGGING',
|
|
22
|
-
'MARKET_ATTENDANCE',
|
|
23
|
-
],
|
|
24
|
-
LIVESTOCK: [
|
|
25
|
-
'NORMAL_LOGGING',
|
|
26
|
-
],
|
|
27
|
-
GROWER_NETWORK: [
|
|
28
|
-
'NORMAL_LOGGING',
|
|
29
|
-
'SITE_INSPECTION'
|
|
30
|
-
]
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const PRODUCT_FEATURES = [
|
|
34
|
-
...FEATURES_BY_OPERATION.ARABLE,
|
|
35
|
-
...FEATURES_BY_OPERATION.FARMERS_MARKET,
|
|
36
|
-
...FEATURES_BY_OPERATION.LIVESTOCK,
|
|
37
|
-
...FEATURES_BY_OPERATION.GROWER_NETWORK,
|
|
38
|
-
].filter((value, index, self) => self.indexOf(value) === index);
|
|
39
|
-
|
|
40
|
-
export const PRODUCT_FEATURES_WORKFLOW = PRODUCT_FEATURES.filter((feature) =>
|
|
41
|
-
!['NORMAL_LOGGING'].includes(feature)
|
|
42
|
-
);
|
package/src/constants/report.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reports; all types
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export const REPORT_SORT_OPTS = [
|
|
6
|
-
'PERIOD_DESC',
|
|
7
|
-
'ACTIVITY_DESC',
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
export const REPORT_ROW_PRESETS = [
|
|
11
|
-
|
|
12
|
-
'REPORT_SUMMARY',
|
|
13
|
-
'LINE_TITLE',
|
|
14
|
-
'LINE_ITEMS',
|
|
15
|
-
'ORGS_LIST',
|
|
16
|
-
'TEXTS',
|
|
17
|
-
|
|
18
|
-
// All deprecated below
|
|
19
|
-
'LABELS',
|
|
20
|
-
'BREAK',
|
|
21
|
-
'Q_AND_A',
|
|
22
|
-
'LONG_TEXTS', // Same as "TEXTS" but has a different function in <FileBrowserPlus>
|
|
23
|
-
'HEADINGS',
|
|
24
|
-
'EVIDENCES',
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
export const REPORT_NUMBERED_PRESETS = [
|
|
28
|
-
'LINE_ITEMS',
|
|
29
|
-
'ORGS_LIST',
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
export const REPORT_FREQUENCY_ENUMS = [
|
|
33
|
-
'DAILY',
|
|
34
|
-
'WEEKLY',
|
|
35
|
-
'MONTHLY',
|
|
36
|
-
'QUARTERLY',
|
|
37
|
-
'ANNUALLY',
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
export const REPORT_STATUS_ENUMS = [
|
|
41
|
-
'PASS',
|
|
42
|
-
'WARNING',
|
|
43
|
-
'FAIL',
|
|
44
|
-
];
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import i18n from '@jsb188/app/i18n/index.ts';
|
|
2
|
-
import { makeAddressSchema } from '@jsb188/auth-web/schemas/address';
|
|
3
|
-
import type { OrganizationGQL } from '../types/organization.d.ts';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Length values for validation
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const MIN_LEN_VALUES = {
|
|
10
|
-
name: 40,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Schema; Edit account
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export function makeEditOrganizationSchema(
|
|
18
|
-
formId: string,
|
|
19
|
-
focusedName: string,
|
|
20
|
-
formValues: OrganizationGQL, // always append with "|| nodeData"
|
|
21
|
-
) {
|
|
22
|
-
const addressSchema = makeAddressSchema(
|
|
23
|
-
formId,
|
|
24
|
-
focusedName,
|
|
25
|
-
formValues?.address,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
listData: [{
|
|
30
|
-
// __type: 'subtitle',
|
|
31
|
-
// item: {
|
|
32
|
-
// text: i18n.t('account.profile'),
|
|
33
|
-
// },
|
|
34
|
-
// }, {
|
|
35
|
-
__type: 'input',
|
|
36
|
-
item: {
|
|
37
|
-
name: 'name',
|
|
38
|
-
maxLength: MIN_LEN_VALUES.name,
|
|
39
|
-
label: i18n.t('org.name_of'),
|
|
40
|
-
placeholder: formValues.name,
|
|
41
|
-
autoComplete: 'off',
|
|
42
|
-
}
|
|
43
|
-
}, {
|
|
44
|
-
__type: 'input',
|
|
45
|
-
locked: true,
|
|
46
|
-
item: {
|
|
47
|
-
name: 'operation',
|
|
48
|
-
label: i18n.t('org.type_of'),
|
|
49
|
-
placeholder: i18n.t(`org.type.${formValues.operation}`),
|
|
50
|
-
getter: (value: string) => i18n.t(`org.type.${value}`),
|
|
51
|
-
autoComplete: 'off',
|
|
52
|
-
info: i18n.t('org.contact_to_change'),
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
__type: 'section_title',
|
|
56
|
-
item: {
|
|
57
|
-
title: i18n.t('form.address'),
|
|
58
|
-
description: i18n.t('org.address_notice_msg'),
|
|
59
|
-
}
|
|
60
|
-
}, ...addressSchema.listData],
|
|
61
|
-
rules: [
|
|
62
|
-
...addressSchema.rules,
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { PRODUCT_TYPES } from '@jsb188/mday/constants/product.ts';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import type { ProductTypeEnum } from '../types/product.d.ts';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Zod schema for query params to filter
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export const ProductsFilterSchema = z.object({
|
|
10
|
-
preset: z.string()
|
|
11
|
-
.optional()
|
|
12
|
-
.nullable(),
|
|
13
|
-
productType: z.enum(PRODUCT_TYPES as [string]),
|
|
14
|
-
// startDate: z.string()
|
|
15
|
-
// .refine((sd) => isValidCalDate(sd), { message: 'START_DATE_INVALID' })
|
|
16
|
-
// .refine((sd) => !isFutureCalDate(sd, 1), { message: 'START_DATE_FUTURE_NOT_ALLOWED' })
|
|
17
|
-
// .nullable(),
|
|
18
|
-
// endDate: z.string()
|
|
19
|
-
// .refine((ed) => isValidCalDate(ed), { message: 'END_DATE_INVALID' })
|
|
20
|
-
// .nullable(),
|
|
21
|
-
// timeZone: z.string()
|
|
22
|
-
// .refine((tz) => isValidTimeZone(tz), { message: 'INVALID_TIMEZONE' })
|
|
23
|
-
// .nullable(),
|
|
24
|
-
query: z.string()
|
|
25
|
-
.nullable(),
|
|
26
|
-
});
|
|
27
|
-
// }).refine((data) => {
|
|
28
|
-
// if (!data.endDate) {
|
|
29
|
-
// // No need to validate if endDate is not provided
|
|
30
|
-
// return true;
|
|
31
|
-
// } else if (!data.startDate) {
|
|
32
|
-
// // If endDate is provided, startDate is required
|
|
33
|
-
// return false;
|
|
34
|
-
// }
|
|
35
|
-
// // End date must be after or equal to start date
|
|
36
|
-
// return data.endDate >= data.startDate;
|
|
37
|
-
// }, {
|
|
38
|
-
// message: 'END_DATE_MUST_BE_AFTER_START_DATE',
|
|
39
|
-
// path: ['endDate'], // where to attach the error
|
|
40
|
-
// });
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Convert list of digits to product type enums
|
|
44
|
-
* @param digit - Index digit string from URL param
|
|
45
|
-
* @returns Array of product type enums or null
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
export function convertDigitToProductType(digit?: string | null): ProductTypeEnum | null {
|
|
49
|
-
if (!digit) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
return PRODUCT_TYPES[Number(digit)] || null;
|
|
53
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Zod schema for query params to filter
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const ReportsFilterSchema = z.object({
|
|
8
|
-
preset: z.string()
|
|
9
|
-
.optional()
|
|
10
|
-
.nullable(),
|
|
11
|
-
reportGroupId: z.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.nullable(),
|
|
14
|
-
startPeriod: z.string()
|
|
15
|
-
.optional()
|
|
16
|
-
.nullable(),
|
|
17
|
-
endPeriod: z.string()
|
|
18
|
-
.optional()
|
|
19
|
-
.nullable(),
|
|
20
|
-
});
|
package/src/types/product.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { AccountData } from './account.d.ts';
|
|
2
|
-
import type { AddressObj, ScheduleObj } from '@jsb188/app/types/other.d.ts';
|
|
3
|
-
import { PRODUCT_TYPES } from '../constants/product.ts';
|
|
4
|
-
import type { OrganizationData, OrganizationGQL } from './organization.d.ts';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Enums
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export type ProductTypeEnum = typeof PRODUCT_TYPES[number];
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Filters
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export interface ProductsFilterArgs {
|
|
17
|
-
preset?: '?' | null;
|
|
18
|
-
productType: ProductTypeEnum;
|
|
19
|
-
query?: string | null;
|
|
20
|
-
calDate?: string | null; // "YYYY-MM-DD"
|
|
21
|
-
timeZone?: string | null; // Server only for now
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Product details; Calendar event
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
export interface ProductCalEventObj {
|
|
29
|
-
name: string;
|
|
30
|
-
metadata: Partial<{
|
|
31
|
-
schedule: ScheduleObj | null;
|
|
32
|
-
address: Partial<AddressObj> | null;
|
|
33
|
-
}>;
|
|
34
|
-
|
|
35
|
-
startAt: Date | string; // ISO Date string
|
|
36
|
-
endAt?: Date | string | null; // ISO Date string
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface ProductCalEventData extends ProductCalEventObj {
|
|
40
|
-
__table: 'products_calendar_events';
|
|
41
|
-
productId: number | bigint;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface ProductCalEventGQL {
|
|
45
|
-
__typename: 'ProductCalEvent';
|
|
46
|
-
|
|
47
|
-
id: string;
|
|
48
|
-
organizationId: string;
|
|
49
|
-
|
|
50
|
-
name: string;
|
|
51
|
-
schedule: ScheduleObj | null;
|
|
52
|
-
address: AddressObj | null;
|
|
53
|
-
startAt: Date;
|
|
54
|
-
endAt: Date;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type ProductDetailsObj = ProductCalEventObj;
|
|
58
|
-
export type ProductDetailsData = ProductCalEventData;
|
|
59
|
-
export type ProductDetailsGQL = ProductCalEventGQL;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Product data objects
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
export interface ProductData {
|
|
66
|
-
__table: 'products';
|
|
67
|
-
productId: number | bigint;
|
|
68
|
-
organizationId: number | bigint;
|
|
69
|
-
details: ProductDetailsData;
|
|
70
|
-
createdAt: Date;
|
|
71
|
-
updatedAt: Date;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface ProductGQL {
|
|
75
|
-
__deleted?: boolean; // For client-side only
|
|
76
|
-
|
|
77
|
-
id: string;
|
|
78
|
-
organizationId: string;
|
|
79
|
-
cursor: string | null; // Cursor for pagination
|
|
80
|
-
details: ProductDetailsGQL | null;
|
|
81
|
-
|
|
82
|
-
createdAt: string; // ISO Date
|
|
83
|
-
updatedAt: string; // ISO Date
|
|
84
|
-
}
|