@natch-the-storage/heathershaw-platform-types 1.0.0 → 1.0.1

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/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @natch-the-storage/heathershaw-platform-types
2
+
3
+ Validation schemas and enums exported from `validators.js` for frontend use.
4
+
5
+ ## Install
6
+
7
+ Install the package and peer dependency:
8
+
9
+ ```bash
10
+ npm install @natch-the-storage/heathershaw-platform-types zod
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ES module:
16
+
17
+ ```js
18
+ import { createOrderBodySchema } from "@natch-the-storage/heathershaw-platform-types";
19
+
20
+ // or import the built ESM file directly
21
+ import { createOrderBodySchema } from "@natch-the-storage/heathershaw-platform-types/build/validators.es.js";
22
+ ```
23
+
24
+ CommonJS:
25
+
26
+ ```js
27
+ const {
28
+ createOrderBodySchema,
29
+ } = require("@natch-the-storage/heathershaw-platform-types");
30
+ ```
31
+
32
+ Note: `zod` is a peer dependency — you must install it in the consumer project.
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("zod");var t=[`PENDING`,`RECEIVED`,`ESCALATED`],n=[`PENDING`,`PROCESSING`,`RESOLVED`],r=[`INVOICE`,`POS`],i=[`AWAITING_PAYMENT`,`PAID`,`PENDING_INVOICE`],a=[`TODO1`,`TODO2`,`TODO3`],o=[`HEATHERSHAWS`,`PHARMACY`,`PATIENT`],s=[`eRx`,`PAPER`],c=[`STANDARD`,`COLD_CHAIN`],l=[`Hazardous`,`Cytotoxic`,`High-Risk`],u=e.z.object({street:e.z.string().min(1),suburb:e.z.string().min(1),state:e.z.string().min(1),postcode:e.z.string().min(1),deliveryInstructions:e.z.string().optional()}),d=e.z.object({id:e.z.number(),name:e.z.string(),email:e.z.string(),phone:e.z.string()}),f=e.z.object({allergies:e.z.string().nullable(),conditions:e.z.string().nullable(),relevantHistory:e.z.string().nullable(),currentMedications:e.z.string().nullable(),prescriber:d.nullable()}),p=e.z.object({id:e.z.number(),prescriberId:e.z.number(),patientRecordId:e.z.number(),productId:e.z.number(),dateIssued:e.z.string(),processed:e.z.boolean(),repeatsRemaining:e.z.number(),daysSupply:e.z.number(),repeatStorage:e.z.enum(o),compoundDirectId:e.z.string().nullable(),imageKey:e.z.string().nullable()}),m=e.z.object({id:e.z.number(),partnerPharmacyProfileId:e.z.number().nullable(),patientRecordId:e.z.number().nullable(),completed:e.z.boolean(),paymentModeAtOrder:e.z.enum(r),paymentStatus:e.z.enum(i),scriptType:e.z.enum(s),paperScriptReceived:e.z.boolean(),shippingType:e.z.enum(c),shippingFee:e.z.string(),lineItems:e.z.unknown(),orderChangeNotes:e.z.string().nullable(),counsellingRequired:e.z.boolean(),confirmationSentAt:e.z.date().nullable(),hubspotContactId:e.z.string().nullable(),createdByUserId:e.z.string().nullable()}),h=e.z.object({id:e.z.preprocess(e=>typeof e==`string`&&e!==``?Number(e):e,e.z.number().int().min(1))}),g=e.z.object({page:e.z.preprocess(e=>{if(typeof e==`string`&&e!==``)return Number(e)},e.z.number().int().min(1).optional()),limit:e.z.preprocess(e=>{if(typeof e==`string`&&e!==``)return Number(e)},e.z.number().int().min(1).max(100).optional())}),_=e.z.object({to:e.z.string(),name:e.z.string(),number:e.z.number()}),v=e.z.object({body:e.z.string(),to:e.z.string(),from:e.z.string()}),y=e.z.object({userId:e.z.string(),patientRecordId:e.z.number().int().nullable().optional(),compoundDirectId:e.z.string().nullable().optional(),remindersEnabled:e.z.boolean().optional(),scriptSubmissions:e.z.array(p).nullable()}),b=e.z.object({id:e.z.number().int().min(1),userId:e.z.string().optional(),patientRecordId:e.z.number().int().nullable().optional(),compoundDirectId:e.z.string().nullable().optional(),remindersEnabled:e.z.boolean().optional(),scriptSubmissions:e.z.array(p).nullable().optional()}),x=e.z.object({partnerPharmacyProfileId:e.z.number().int().nullable().optional(),patientRecordId:e.z.number().int().nullable().optional(),completed:e.z.boolean().optional(),paymentModeAtOrder:e.z.enum(r),paymentStatus:e.z.enum(i),scriptType:e.z.enum(s),paperScriptReceived:e.z.boolean().optional(),shippingType:e.z.enum(c),shippingFee:e.z.string(),lineItems:e.z.unknown().optional(),orderChangeNotes:e.z.string().nullable().optional(),counsellingRequired:e.z.boolean().optional(),confirmationSentAt:e.z.coerce.date().nullable().optional(),hubspotContactId:e.z.string().nullable().optional(),createdByUserId:e.z.string().nullable().optional()}),S=e.z.object({id:e.z.number().int().min(1),partnerPharmacyProfileId:e.z.number().int().nullable().optional(),patientRecordId:e.z.number().int().nullable().optional(),completed:e.z.boolean().optional(),paymentModeAtOrder:e.z.enum(r).optional(),paymentStatus:e.z.enum(i).optional(),scriptType:e.z.enum(s).optional(),paperScriptReceived:e.z.boolean().optional(),shippingType:e.z.enum(c).optional(),shippingFee:e.z.string().optional(),lineItems:e.z.unknown().optional(),orderChangeNotes:e.z.string().nullable().optional(),counsellingRequired:e.z.boolean().optional(),confirmationSentAt:e.z.coerce.date().nullable().optional(),hubspotContactId:e.z.string().nullable().optional(),createdByUserId:e.z.string().nullable().optional()}),C=e.z.object({orderId:e.z.number().int(),partnerPharmacyProfileId:e.z.number().int(),status:e.z.enum(t),remindersSent:e.z.number().int(),reminderIntervalDays:e.z.number().int().optional(),escalationEmail:e.z.string(),receivedMarked:e.z.boolean()}),w=e.z.object({id:e.z.number().int().min(1),orderId:e.z.number().int().optional(),partnerPharmacyProfileId:e.z.number().int().optional(),status:e.z.enum(t).optional(),remindersSent:e.z.number().int().optional(),reminderIntervalDays:e.z.number().int().optional(),escalationEmail:e.z.string().optional(),receivedMarked:e.z.boolean().optional()}),T=e.z.object({userId:e.z.string(),abn:e.z.string(),contactName:e.z.string(),invoiceEmail:e.z.string(),phone:e.z.string(),discountTier:e.z.string(),paymentMode:e.z.enum(r),remindersEnabled:e.z.boolean().optional(),priceMatches:e.z.unknown().optional(),dispatchAddress:u.nullable(),orders:e.z.unknown().optional(),xeroContactId:e.z.string().nullable().optional()}),E=e.z.object({id:e.z.number().int().min(1),userId:e.z.string().optional(),abn:e.z.string().optional(),contactName:e.z.string().optional(),invoiceEmail:e.z.string().optional(),phone:e.z.string().optional(),discountTier:e.z.string().optional(),paymentMode:e.z.enum(r).optional(),remindersEnabled:e.z.boolean().optional(),priceMatches:e.z.unknown().optional(),dispatchAddress:u.nullable().optional(),orders:e.z.unknown().optional(),xeroContactId:e.z.string().nullable().optional()}),D=g.extend({partner_pharmacy_profile_id:e.z.preprocess(e=>{if(typeof e==`string`&&e!==``)return Number(e)},e.z.number().int().min(1).optional())}),O=e.z.object({partnerPharmacyProfileId:e.z.number().int().nullable().optional(),userId:e.z.string().nullable().optional(),firstName:e.z.string(),lastName:e.z.string(),dateOfBirth:e.z.string(),medicareNumber:e.z.string().nullable().optional(),phone:e.z.string(),address:u.nullable(),healthInfo:f.nullable(),reminderEnabled:e.z.boolean().optional(),scripts:e.z.array(p).nullable(),orderHistory:e.z.array(m).nullable()}),k=e.z.object({id:e.z.number().int().min(1),partnerPharmacyProfileId:e.z.number().int().nullable().optional(),userId:e.z.string().nullable().optional(),firstName:e.z.string().optional(),lastName:e.z.string().optional(),dateOfBirth:e.z.string().optional(),medicareNumber:e.z.string().nullable().optional(),phone:e.z.string().optional(),address:u.nullable().optional(),healthInfo:f.nullable().optional(),reminderEnabled:e.z.boolean().optional(),scripts:e.z.array(p).nullable().optional(),orderHistory:e.z.array(m).nullable().optional()}),A=e.z.object({name:e.z.string(),email:e.z.string(),phone:e.z.string()}),j=e.z.object({id:e.z.number().int().min(1),name:e.z.string().optional(),email:e.z.string().optional(),phone:e.z.string().optional()}),M=e.z.object({partnerPharmacyProfileId:e.z.number().int(),productId:e.z.number().int(),overridePrice:e.z.string()}),N=e.z.object({id:e.z.number().int().min(1),partnerPharmacyProfileId:e.z.number().int().optional(),productId:e.z.number().int().optional(),overridePrice:e.z.string().optional()}),P=e.z.object({name:e.z.string(),imageKey:e.z.string().nullable().optional(),abbreviations:e.z.array(e.z.string()).nullable().optional(),category:e.z.enum(a),rrp:e.z.string(),hazardTags:e.z.array(e.z.enum(l)).nullable().optional(),compoundDirectId:e.z.string().nullable().optional(),requiresFridge:e.z.boolean().optional(),flavours:e.z.array(e.z.string()).nullable().optional(),requiresS8Medicare:e.z.boolean().optional()}),F=e.z.object({id:e.z.number().int().min(1),name:e.z.string().optional(),imageKey:e.z.string().nullable().optional(),abbreviations:e.z.array(e.z.string()).nullable().optional(),category:e.z.enum(a).optional(),rrp:e.z.string().optional(),hazardTags:e.z.array(e.z.enum(l)).nullable().optional(),compoundDirectId:e.z.string().nullable().optional(),requiresFridge:e.z.boolean().optional(),flavours:e.z.array(e.z.string()).nullable().optional(),requiresS8Medicare:e.z.boolean().optional()}),I=e.z.object({status:e.z.enum(n).optional(),partnerPharmacyProfileId:e.z.number().int(),name:e.z.string(),strength:e.z.string(),form:e.z.string(),quantity:e.z.number().int(),patientContext:e.z.string()}),L=e.z.object({id:e.z.number().int().min(1),status:e.z.enum(n).optional(),partnerPharmacyProfileId:e.z.number().int().optional(),name:e.z.string().optional(),strength:e.z.string().optional(),form:e.z.string().optional(),quantity:e.z.number().int().optional(),patientContext:e.z.string().optional()}),R=e.z.object({orderId:e.z.number().int(),patientRecordId:e.z.number().int(),daysSupply:e.z.number().int(),dispatchedAt:e.z.coerce.date(),reminderDueAt:e.z.coerce.date(),reminderOffsetDays:e.z.number().int().optional(),pharmacyReminderSent:e.z.boolean().optional(),patientSmsSent:e.z.boolean().optional(),enabled:e.z.boolean().optional()}),z=e.z.object({id:e.z.number().int().min(1),orderId:e.z.number().int().optional(),patientRecordId:e.z.number().int().optional(),daysSupply:e.z.number().int().optional(),dispatchedAt:e.z.coerce.date().optional(),reminderDueAt:e.z.coerce.date().optional(),reminderOffsetDays:e.z.number().int().optional(),pharmacyReminderSent:e.z.boolean().optional(),patientSmsSent:e.z.boolean().optional(),enabled:e.z.boolean().optional()}),B=e.z.object({prescriberId:e.z.number().int(),patientRecordId:e.z.number().int(),productId:e.z.number().int(),dateIssued:e.z.string(),processed:e.z.boolean().optional(),repeatsRemaining:e.z.number().int().optional(),daysSupply:e.z.number().int(),repeatStorage:e.z.enum(o),compoundDirectId:e.z.string().nullable().optional(),imageKey:e.z.string().nullable().optional()}),V=e.z.object({id:e.z.number().int().min(1),prescriberId:e.z.number().int().optional(),patientRecordId:e.z.number().int().optional(),productId:e.z.number().int().optional(),dateIssued:e.z.string().optional(),processed:e.z.boolean().optional(),repeatsRemaining:e.z.number().int().optional(),daysSupply:e.z.number().int().optional(),repeatStorage:e.z.enum(o).optional(),compoundDirectId:e.z.string().nullable().optional(),imageKey:e.z.string().nullable().optional()});exports.addressSchema=u,exports.createDirectUserProfileBodySchema=y,exports.createOrderBodySchema=x,exports.createPaperScriptReminderBodySchema=C,exports.createPartnerPharmacyProfileBodySchema=T,exports.createPatientRecordBodySchema=O,exports.createPrescriberBodySchema=A,exports.createPriceMatchBodySchema=M,exports.createProductBodySchema=P,exports.createQuoteBodySchema=I,exports.createRepeatReminderBodySchema=R,exports.createScriptBodySchema=B,exports.devEmailSchema=_,exports.getAllSchema=g,exports.getByIdSchema=h,exports.getPatientRecordsQuerySchema=D,exports.hazardTagsValues=l,exports.healthInfoSchema=f,exports.orderSelectSchema=m,exports.paperScriptReminderStatusValues=t,exports.paymentModeAtOrderValues=r,exports.paymentStatusValues=i,exports.prescriberSelectSchema=d,exports.productCategoryValues=a,exports.quoteStatusValues=n,exports.repeatStorageValues=o,exports.scriptSelectSchema=p,exports.scriptTypeValues=s,exports.shippingTypeValues=c,exports.smsSchema=v,exports.updateDirectUserProfileBodySchema=b,exports.updateOrderBodySchema=S,exports.updatePaperScriptReminderBodySchema=w,exports.updatePartnerPharmacyProfileBodySchema=E,exports.updatePatientRecordBodySchema=k,exports.updatePrescriberBodySchema=j,exports.updatePriceMatchBodySchema=N,exports.updateProductBodySchema=F,exports.updateQuoteBodySchema=L,exports.updateRepeatReminderBodySchema=z,exports.updateScriptBodySchema=V;
@@ -0,0 +1,311 @@
1
+ import { z as e } from "zod";
2
+ //#region validators.js
3
+ var t = [
4
+ "PENDING",
5
+ "RECEIVED",
6
+ "ESCALATED"
7
+ ], n = [
8
+ "PENDING",
9
+ "PROCESSING",
10
+ "RESOLVED"
11
+ ], r = ["INVOICE", "POS"], i = [
12
+ "AWAITING_PAYMENT",
13
+ "PAID",
14
+ "PENDING_INVOICE"
15
+ ], a = [
16
+ "TODO1",
17
+ "TODO2",
18
+ "TODO3"
19
+ ], o = [
20
+ "HEATHERSHAWS",
21
+ "PHARMACY",
22
+ "PATIENT"
23
+ ], s = ["eRx", "PAPER"], c = ["STANDARD", "COLD_CHAIN"], l = [
24
+ "Hazardous",
25
+ "Cytotoxic",
26
+ "High-Risk"
27
+ ], u = e.object({
28
+ street: e.string().min(1),
29
+ suburb: e.string().min(1),
30
+ state: e.string().min(1),
31
+ postcode: e.string().min(1),
32
+ deliveryInstructions: e.string().optional()
33
+ }), d = e.object({
34
+ id: e.number(),
35
+ name: e.string(),
36
+ email: e.string(),
37
+ phone: e.string()
38
+ }), f = e.object({
39
+ allergies: e.string().nullable(),
40
+ conditions: e.string().nullable(),
41
+ relevantHistory: e.string().nullable(),
42
+ currentMedications: e.string().nullable(),
43
+ prescriber: d.nullable()
44
+ }), p = e.object({
45
+ id: e.number(),
46
+ prescriberId: e.number(),
47
+ patientRecordId: e.number(),
48
+ productId: e.number(),
49
+ dateIssued: e.string(),
50
+ processed: e.boolean(),
51
+ repeatsRemaining: e.number(),
52
+ daysSupply: e.number(),
53
+ repeatStorage: e.enum(o),
54
+ compoundDirectId: e.string().nullable(),
55
+ imageKey: e.string().nullable()
56
+ }), m = e.object({
57
+ id: e.number(),
58
+ partnerPharmacyProfileId: e.number().nullable(),
59
+ patientRecordId: e.number().nullable(),
60
+ completed: e.boolean(),
61
+ paymentModeAtOrder: e.enum(r),
62
+ paymentStatus: e.enum(i),
63
+ scriptType: e.enum(s),
64
+ paperScriptReceived: e.boolean(),
65
+ shippingType: e.enum(c),
66
+ shippingFee: e.string(),
67
+ lineItems: e.unknown(),
68
+ orderChangeNotes: e.string().nullable(),
69
+ counsellingRequired: e.boolean(),
70
+ confirmationSentAt: e.date().nullable(),
71
+ hubspotContactId: e.string().nullable(),
72
+ createdByUserId: e.string().nullable()
73
+ }), h = e.object({ id: e.preprocess((e) => typeof e == "string" && e !== "" ? Number(e) : e, e.number().int().min(1)) }), g = e.object({
74
+ page: e.preprocess((e) => {
75
+ if (typeof e == "string" && e !== "") return Number(e);
76
+ }, e.number().int().min(1).optional()),
77
+ limit: e.preprocess((e) => {
78
+ if (typeof e == "string" && e !== "") return Number(e);
79
+ }, e.number().int().min(1).max(100).optional())
80
+ }), _ = e.object({
81
+ to: e.string(),
82
+ name: e.string(),
83
+ number: e.number()
84
+ }), v = e.object({
85
+ body: e.string(),
86
+ to: e.string(),
87
+ from: e.string()
88
+ }), y = e.object({
89
+ userId: e.string(),
90
+ patientRecordId: e.number().int().nullable().optional(),
91
+ compoundDirectId: e.string().nullable().optional(),
92
+ remindersEnabled: e.boolean().optional(),
93
+ scriptSubmissions: e.array(p).nullable()
94
+ }), b = e.object({
95
+ id: e.number().int().min(1),
96
+ userId: e.string().optional(),
97
+ patientRecordId: e.number().int().nullable().optional(),
98
+ compoundDirectId: e.string().nullable().optional(),
99
+ remindersEnabled: e.boolean().optional(),
100
+ scriptSubmissions: e.array(p).nullable().optional()
101
+ }), x = e.object({
102
+ partnerPharmacyProfileId: e.number().int().nullable().optional(),
103
+ patientRecordId: e.number().int().nullable().optional(),
104
+ completed: e.boolean().optional(),
105
+ paymentModeAtOrder: e.enum(r),
106
+ paymentStatus: e.enum(i),
107
+ scriptType: e.enum(s),
108
+ paperScriptReceived: e.boolean().optional(),
109
+ shippingType: e.enum(c),
110
+ shippingFee: e.string(),
111
+ lineItems: e.unknown().optional(),
112
+ orderChangeNotes: e.string().nullable().optional(),
113
+ counsellingRequired: e.boolean().optional(),
114
+ confirmationSentAt: e.coerce.date().nullable().optional(),
115
+ hubspotContactId: e.string().nullable().optional(),
116
+ createdByUserId: e.string().nullable().optional()
117
+ }), S = e.object({
118
+ id: e.number().int().min(1),
119
+ partnerPharmacyProfileId: e.number().int().nullable().optional(),
120
+ patientRecordId: e.number().int().nullable().optional(),
121
+ completed: e.boolean().optional(),
122
+ paymentModeAtOrder: e.enum(r).optional(),
123
+ paymentStatus: e.enum(i).optional(),
124
+ scriptType: e.enum(s).optional(),
125
+ paperScriptReceived: e.boolean().optional(),
126
+ shippingType: e.enum(c).optional(),
127
+ shippingFee: e.string().optional(),
128
+ lineItems: e.unknown().optional(),
129
+ orderChangeNotes: e.string().nullable().optional(),
130
+ counsellingRequired: e.boolean().optional(),
131
+ confirmationSentAt: e.coerce.date().nullable().optional(),
132
+ hubspotContactId: e.string().nullable().optional(),
133
+ createdByUserId: e.string().nullable().optional()
134
+ }), C = e.object({
135
+ orderId: e.number().int(),
136
+ partnerPharmacyProfileId: e.number().int(),
137
+ status: e.enum(t),
138
+ remindersSent: e.number().int(),
139
+ reminderIntervalDays: e.number().int().optional(),
140
+ escalationEmail: e.string(),
141
+ receivedMarked: e.boolean()
142
+ }), w = e.object({
143
+ id: e.number().int().min(1),
144
+ orderId: e.number().int().optional(),
145
+ partnerPharmacyProfileId: e.number().int().optional(),
146
+ status: e.enum(t).optional(),
147
+ remindersSent: e.number().int().optional(),
148
+ reminderIntervalDays: e.number().int().optional(),
149
+ escalationEmail: e.string().optional(),
150
+ receivedMarked: e.boolean().optional()
151
+ }), T = e.object({
152
+ userId: e.string(),
153
+ abn: e.string(),
154
+ contactName: e.string(),
155
+ invoiceEmail: e.string(),
156
+ phone: e.string(),
157
+ discountTier: e.string(),
158
+ paymentMode: e.enum(r),
159
+ remindersEnabled: e.boolean().optional(),
160
+ priceMatches: e.unknown().optional(),
161
+ dispatchAddress: u.nullable(),
162
+ orders: e.unknown().optional(),
163
+ xeroContactId: e.string().nullable().optional()
164
+ }), E = e.object({
165
+ id: e.number().int().min(1),
166
+ userId: e.string().optional(),
167
+ abn: e.string().optional(),
168
+ contactName: e.string().optional(),
169
+ invoiceEmail: e.string().optional(),
170
+ phone: e.string().optional(),
171
+ discountTier: e.string().optional(),
172
+ paymentMode: e.enum(r).optional(),
173
+ remindersEnabled: e.boolean().optional(),
174
+ priceMatches: e.unknown().optional(),
175
+ dispatchAddress: u.nullable().optional(),
176
+ orders: e.unknown().optional(),
177
+ xeroContactId: e.string().nullable().optional()
178
+ }), D = g.extend({ partner_pharmacy_profile_id: e.preprocess((e) => {
179
+ if (typeof e == "string" && e !== "") return Number(e);
180
+ }, e.number().int().min(1).optional()) }), O = e.object({
181
+ partnerPharmacyProfileId: e.number().int().nullable().optional(),
182
+ userId: e.string().nullable().optional(),
183
+ firstName: e.string(),
184
+ lastName: e.string(),
185
+ dateOfBirth: e.string(),
186
+ medicareNumber: e.string().nullable().optional(),
187
+ phone: e.string(),
188
+ address: u.nullable(),
189
+ healthInfo: f.nullable(),
190
+ reminderEnabled: e.boolean().optional(),
191
+ scripts: e.array(p).nullable(),
192
+ orderHistory: e.array(m).nullable()
193
+ }), k = e.object({
194
+ id: e.number().int().min(1),
195
+ partnerPharmacyProfileId: e.number().int().nullable().optional(),
196
+ userId: e.string().nullable().optional(),
197
+ firstName: e.string().optional(),
198
+ lastName: e.string().optional(),
199
+ dateOfBirth: e.string().optional(),
200
+ medicareNumber: e.string().nullable().optional(),
201
+ phone: e.string().optional(),
202
+ address: u.nullable().optional(),
203
+ healthInfo: f.nullable().optional(),
204
+ reminderEnabled: e.boolean().optional(),
205
+ scripts: e.array(p).nullable().optional(),
206
+ orderHistory: e.array(m).nullable().optional()
207
+ }), A = e.object({
208
+ name: e.string(),
209
+ email: e.string(),
210
+ phone: e.string()
211
+ }), j = e.object({
212
+ id: e.number().int().min(1),
213
+ name: e.string().optional(),
214
+ email: e.string().optional(),
215
+ phone: e.string().optional()
216
+ }), M = e.object({
217
+ partnerPharmacyProfileId: e.number().int(),
218
+ productId: e.number().int(),
219
+ overridePrice: e.string()
220
+ }), N = e.object({
221
+ id: e.number().int().min(1),
222
+ partnerPharmacyProfileId: e.number().int().optional(),
223
+ productId: e.number().int().optional(),
224
+ overridePrice: e.string().optional()
225
+ }), P = e.object({
226
+ name: e.string(),
227
+ imageKey: e.string().nullable().optional(),
228
+ abbreviations: e.array(e.string()).nullable().optional(),
229
+ category: e.enum(a),
230
+ rrp: e.string(),
231
+ hazardTags: e.array(e.enum(l)).nullable().optional(),
232
+ compoundDirectId: e.string().nullable().optional(),
233
+ requiresFridge: e.boolean().optional(),
234
+ flavours: e.array(e.string()).nullable().optional(),
235
+ requiresS8Medicare: e.boolean().optional()
236
+ }), F = e.object({
237
+ id: e.number().int().min(1),
238
+ name: e.string().optional(),
239
+ imageKey: e.string().nullable().optional(),
240
+ abbreviations: e.array(e.string()).nullable().optional(),
241
+ category: e.enum(a).optional(),
242
+ rrp: e.string().optional(),
243
+ hazardTags: e.array(e.enum(l)).nullable().optional(),
244
+ compoundDirectId: e.string().nullable().optional(),
245
+ requiresFridge: e.boolean().optional(),
246
+ flavours: e.array(e.string()).nullable().optional(),
247
+ requiresS8Medicare: e.boolean().optional()
248
+ }), I = e.object({
249
+ status: e.enum(n).optional(),
250
+ partnerPharmacyProfileId: e.number().int(),
251
+ name: e.string(),
252
+ strength: e.string(),
253
+ form: e.string(),
254
+ quantity: e.number().int(),
255
+ patientContext: e.string()
256
+ }), L = e.object({
257
+ id: e.number().int().min(1),
258
+ status: e.enum(n).optional(),
259
+ partnerPharmacyProfileId: e.number().int().optional(),
260
+ name: e.string().optional(),
261
+ strength: e.string().optional(),
262
+ form: e.string().optional(),
263
+ quantity: e.number().int().optional(),
264
+ patientContext: e.string().optional()
265
+ }), R = e.object({
266
+ orderId: e.number().int(),
267
+ patientRecordId: e.number().int(),
268
+ daysSupply: e.number().int(),
269
+ dispatchedAt: e.coerce.date(),
270
+ reminderDueAt: e.coerce.date(),
271
+ reminderOffsetDays: e.number().int().optional(),
272
+ pharmacyReminderSent: e.boolean().optional(),
273
+ patientSmsSent: e.boolean().optional(),
274
+ enabled: e.boolean().optional()
275
+ }), z = e.object({
276
+ id: e.number().int().min(1),
277
+ orderId: e.number().int().optional(),
278
+ patientRecordId: e.number().int().optional(),
279
+ daysSupply: e.number().int().optional(),
280
+ dispatchedAt: e.coerce.date().optional(),
281
+ reminderDueAt: e.coerce.date().optional(),
282
+ reminderOffsetDays: e.number().int().optional(),
283
+ pharmacyReminderSent: e.boolean().optional(),
284
+ patientSmsSent: e.boolean().optional(),
285
+ enabled: e.boolean().optional()
286
+ }), B = e.object({
287
+ prescriberId: e.number().int(),
288
+ patientRecordId: e.number().int(),
289
+ productId: e.number().int(),
290
+ dateIssued: e.string(),
291
+ processed: e.boolean().optional(),
292
+ repeatsRemaining: e.number().int().optional(),
293
+ daysSupply: e.number().int(),
294
+ repeatStorage: e.enum(o),
295
+ compoundDirectId: e.string().nullable().optional(),
296
+ imageKey: e.string().nullable().optional()
297
+ }), V = e.object({
298
+ id: e.number().int().min(1),
299
+ prescriberId: e.number().int().optional(),
300
+ patientRecordId: e.number().int().optional(),
301
+ productId: e.number().int().optional(),
302
+ dateIssued: e.string().optional(),
303
+ processed: e.boolean().optional(),
304
+ repeatsRemaining: e.number().int().optional(),
305
+ daysSupply: e.number().int().optional(),
306
+ repeatStorage: e.enum(o).optional(),
307
+ compoundDirectId: e.string().nullable().optional(),
308
+ imageKey: e.string().nullable().optional()
309
+ });
310
+ //#endregion
311
+ export { u as addressSchema, y as createDirectUserProfileBodySchema, x as createOrderBodySchema, C as createPaperScriptReminderBodySchema, T as createPartnerPharmacyProfileBodySchema, O as createPatientRecordBodySchema, A as createPrescriberBodySchema, M as createPriceMatchBodySchema, P as createProductBodySchema, I as createQuoteBodySchema, R as createRepeatReminderBodySchema, B as createScriptBodySchema, _ as devEmailSchema, g as getAllSchema, h as getByIdSchema, D as getPatientRecordsQuerySchema, l as hazardTagsValues, f as healthInfoSchema, m as orderSelectSchema, t as paperScriptReminderStatusValues, r as paymentModeAtOrderValues, i as paymentStatusValues, d as prescriberSelectSchema, a as productCategoryValues, n as quoteStatusValues, o as repeatStorageValues, p as scriptSelectSchema, s as scriptTypeValues, c as shippingTypeValues, v as smsSchema, b as updateDirectUserProfileBodySchema, S as updateOrderBodySchema, w as updatePaperScriptReminderBodySchema, E as updatePartnerPharmacyProfileBodySchema, k as updatePatientRecordBodySchema, j as updatePrescriberBodySchema, N as updatePriceMatchBodySchema, F as updateProductBodySchema, L as updateQuoteBodySchema, z as updateRepeatReminderBodySchema, V as updateScriptBodySchema };
package/package.json CHANGED
@@ -1,18 +1,29 @@
1
1
  {
2
2
  "name": "@natch-the-storage/heathershaw-platform-types",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Validation and interfaces to use on the client",
5
5
  "license": "ISC",
6
6
  "author": "Natch Surana",
7
- "type": "commonjs",
8
- "main": "index.js",
7
+ "type": "module",
8
+ "main": "build/validators.cjs.js",
9
+ "module": "build/validators.es.js",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./build/validators.es.js",
13
+ "require": "./build/validators.cjs.js"
14
+ }
15
+ },
16
+ "peerDependencies": {
17
+ "zod": "^4.4.3"
18
+ },
9
19
  "files": [
10
20
  "build"
11
21
  ],
12
22
  "scripts": {
13
- "test": "exit 0"
23
+ "test": "exit 0",
24
+ "build": "vite build"
14
25
  },
15
26
  "dependencies": {
16
- "zod": "^4.4.3"
27
+ "vite": "^8.0.16"
17
28
  }
18
29
  }
@@ -1,389 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- // ─── Enum value arrays ──────────────────────────────────────────────────────────
4
- export const paperScriptReminderStatusValues = [
5
- 'PENDING',
6
- 'RECEIVED',
7
- 'ESCALATED',
8
- ];
9
- export const quoteStatusValues = ['PENDING', 'PROCESSING', 'RESOLVED'];
10
- export const paymentModeAtOrderValues = ['INVOICE', 'POS'];
11
- export const paymentStatusValues = [
12
- 'AWAITING_PAYMENT',
13
- 'PAID',
14
- 'PENDING_INVOICE',
15
- ];
16
- export const productCategoryValues = ['TODO1', 'TODO2', 'TODO3'];
17
- export const repeatStorageValues = ['HEATHERSHAWS', 'PHARMACY', 'PATIENT'];
18
- export const scriptTypeValues = ['eRx', 'PAPER'];
19
- export const shippingTypeValues = ['STANDARD', 'COLD_CHAIN'];
20
- export const hazardTagsValues = ['Hazardous', 'Cytotoxic', 'High-Risk'];
21
-
22
- // ─── Shared sub-schemas ─────────────────────────────────────────────────────────
23
- export const addressSchema = z.object({
24
- street: z.string().min(1),
25
- suburb: z.string().min(1),
26
- state: z.string().min(1),
27
- postcode: z.string().min(1),
28
- deliveryInstructions: z.string().optional(),
29
- });
30
-
31
- export const prescriberSelectSchema = z.object({
32
- id: z.number(),
33
- name: z.string(),
34
- email: z.string(),
35
- phone: z.string(),
36
- });
37
-
38
- export const healthInfoSchema = z.object({
39
- allergies: z.string().nullable(),
40
- conditions: z.string().nullable(),
41
- relevantHistory: z.string().nullable(),
42
- currentMedications: z.string().nullable(),
43
- prescriber: prescriberSelectSchema.nullable(),
44
- });
45
-
46
- export const scriptSelectSchema = z.object({
47
- id: z.number(),
48
- prescriberId: z.number(),
49
- patientRecordId: z.number(),
50
- productId: z.number(),
51
- dateIssued: z.string(),
52
- processed: z.boolean(),
53
- repeatsRemaining: z.number(),
54
- daysSupply: z.number(),
55
- repeatStorage: z.enum(repeatStorageValues),
56
- compoundDirectId: z.string().nullable(),
57
- imageKey: z.string().nullable(),
58
- });
59
-
60
- export const orderSelectSchema = z.object({
61
- id: z.number(),
62
- partnerPharmacyProfileId: z.number().nullable(),
63
- patientRecordId: z.number().nullable(),
64
- completed: z.boolean(),
65
- paymentModeAtOrder: z.enum(paymentModeAtOrderValues),
66
- paymentStatus: z.enum(paymentStatusValues),
67
- scriptType: z.enum(scriptTypeValues),
68
- paperScriptReceived: z.boolean(),
69
- shippingType: z.enum(shippingTypeValues),
70
- shippingFee: z.string(),
71
- lineItems: z.unknown(),
72
- orderChangeNotes: z.string().nullable(),
73
- counsellingRequired: z.boolean(),
74
- confirmationSentAt: z.date().nullable(),
75
- hubspotContactId: z.string().nullable(),
76
- createdByUserId: z.string().nullable(),
77
- });
78
-
79
- // ─── common ─────────────────────────────────────────────────────────────────────
80
- export const getByIdSchema = z.object({
81
- id: z.preprocess((value) => {
82
- if (typeof value === 'string' && value !== '') return Number(value);
83
- return value;
84
- }, z.number().int().min(1)),
85
- });
86
-
87
- export const getAllSchema = z.object({
88
- page: z.preprocess((value) => {
89
- if (typeof value === 'string' && value !== '') return Number(value);
90
- return undefined;
91
- }, z.number().int().min(1).optional()),
92
- limit: z.preprocess((value) => {
93
- if (typeof value === 'string' && value !== '') return Number(value);
94
- return undefined;
95
- }, z.number().int().min(1).max(100).optional()),
96
- });
97
-
98
- export const devEmailSchema = z.object({
99
- to: z.string(),
100
- name: z.string(),
101
- number: z.number(),
102
- });
103
-
104
- export const smsSchema = z.object({
105
- body: z.string(),
106
- to: z.string(),
107
- from: z.string(),
108
- });
109
-
110
- // ─── direct-user-profile ────────────────────────────────────────────────────────
111
- export const createDirectUserProfileBodySchema = z.object({
112
- userId: z.string(),
113
- patientRecordId: z.number().int().nullable().optional(),
114
- compoundDirectId: z.string().nullable().optional(),
115
- remindersEnabled: z.boolean().optional(),
116
- scriptSubmissions: z.array(scriptSelectSchema).nullable(),
117
- });
118
-
119
- export const updateDirectUserProfileBodySchema = z.object({
120
- id: z.number().int().min(1),
121
- userId: z.string().optional(),
122
- patientRecordId: z.number().int().nullable().optional(),
123
- compoundDirectId: z.string().nullable().optional(),
124
- remindersEnabled: z.boolean().optional(),
125
- scriptSubmissions: z.array(scriptSelectSchema).nullable().optional(),
126
- });
127
-
128
- // ─── order ──────────────────────────────────────────────────────────────────────
129
- export const createOrderBodySchema = z.object({
130
- partnerPharmacyProfileId: z.number().int().nullable().optional(),
131
- patientRecordId: z.number().int().nullable().optional(),
132
- completed: z.boolean().optional(),
133
- paymentModeAtOrder: z.enum(paymentModeAtOrderValues),
134
- paymentStatus: z.enum(paymentStatusValues),
135
- scriptType: z.enum(scriptTypeValues),
136
- paperScriptReceived: z.boolean().optional(),
137
- shippingType: z.enum(shippingTypeValues),
138
- shippingFee: z.string(),
139
- lineItems: z.unknown().optional(),
140
- orderChangeNotes: z.string().nullable().optional(),
141
- counsellingRequired: z.boolean().optional(),
142
- confirmationSentAt: z.coerce.date().nullable().optional(),
143
- hubspotContactId: z.string().nullable().optional(),
144
- createdByUserId: z.string().nullable().optional(),
145
- });
146
-
147
- export const updateOrderBodySchema = z.object({
148
- id: z.number().int().min(1),
149
- partnerPharmacyProfileId: z.number().int().nullable().optional(),
150
- patientRecordId: z.number().int().nullable().optional(),
151
- completed: z.boolean().optional(),
152
- paymentModeAtOrder: z.enum(paymentModeAtOrderValues).optional(),
153
- paymentStatus: z.enum(paymentStatusValues).optional(),
154
- scriptType: z.enum(scriptTypeValues).optional(),
155
- paperScriptReceived: z.boolean().optional(),
156
- shippingType: z.enum(shippingTypeValues).optional(),
157
- shippingFee: z.string().optional(),
158
- lineItems: z.unknown().optional(),
159
- orderChangeNotes: z.string().nullable().optional(),
160
- counsellingRequired: z.boolean().optional(),
161
- confirmationSentAt: z.coerce.date().nullable().optional(),
162
- hubspotContactId: z.string().nullable().optional(),
163
- createdByUserId: z.string().nullable().optional(),
164
- });
165
-
166
- // ─── paper-script-reminder ──────────────────────────────────────────────────────
167
- export const createPaperScriptReminderBodySchema = z.object({
168
- orderId: z.number().int(),
169
- partnerPharmacyProfileId: z.number().int(),
170
- status: z.enum(paperScriptReminderStatusValues),
171
- remindersSent: z.number().int(),
172
- reminderIntervalDays: z.number().int().optional(),
173
- escalationEmail: z.string(),
174
- receivedMarked: z.boolean(),
175
- });
176
-
177
- export const updatePaperScriptReminderBodySchema = z.object({
178
- id: z.number().int().min(1),
179
- orderId: z.number().int().optional(),
180
- partnerPharmacyProfileId: z.number().int().optional(),
181
- status: z.enum(paperScriptReminderStatusValues).optional(),
182
- remindersSent: z.number().int().optional(),
183
- reminderIntervalDays: z.number().int().optional(),
184
- escalationEmail: z.string().optional(),
185
- receivedMarked: z.boolean().optional(),
186
- });
187
-
188
- // ─── partner-pharmacy-profile ───────────────────────────────────────────────────
189
- export const createPartnerPharmacyProfileBodySchema = z.object({
190
- userId: z.string(),
191
- abn: z.string(),
192
- contactName: z.string(),
193
- invoiceEmail: z.string(),
194
- phone: z.string(),
195
- discountTier: z.string(),
196
- paymentMode: z.enum(paymentModeAtOrderValues),
197
- remindersEnabled: z.boolean().optional(),
198
- priceMatches: z.unknown().optional(),
199
- dispatchAddress: addressSchema.nullable(),
200
- orders: z.unknown().optional(),
201
- xeroContactId: z.string().nullable().optional(),
202
- });
203
-
204
- export const updatePartnerPharmacyProfileBodySchema = z.object({
205
- id: z.number().int().min(1),
206
- userId: z.string().optional(),
207
- abn: z.string().optional(),
208
- contactName: z.string().optional(),
209
- invoiceEmail: z.string().optional(),
210
- phone: z.string().optional(),
211
- discountTier: z.string().optional(),
212
- paymentMode: z.enum(paymentModeAtOrderValues).optional(),
213
- remindersEnabled: z.boolean().optional(),
214
- priceMatches: z.unknown().optional(),
215
- dispatchAddress: addressSchema.nullable().optional(),
216
- orders: z.unknown().optional(),
217
- xeroContactId: z.string().nullable().optional(),
218
- });
219
-
220
- // ─── patient-record ─────────────────────────────────────────────────────────────
221
- export const getPatientRecordsQuerySchema = getAllSchema.extend({
222
- partner_pharmacy_profile_id: z.preprocess((value) => {
223
- if (typeof value === 'string' && value !== '') return Number(value);
224
- return undefined;
225
- }, z.number().int().min(1).optional()),
226
- });
227
-
228
- export const createPatientRecordBodySchema = z.object({
229
- partnerPharmacyProfileId: z.number().int().nullable().optional(),
230
- userId: z.string().nullable().optional(),
231
- firstName: z.string(),
232
- lastName: z.string(),
233
- dateOfBirth: z.string(),
234
- medicareNumber: z.string().nullable().optional(),
235
- phone: z.string(),
236
- address: addressSchema.nullable(),
237
- healthInfo: healthInfoSchema.nullable(),
238
- reminderEnabled: z.boolean().optional(),
239
- scripts: z.array(scriptSelectSchema).nullable(),
240
- orderHistory: z.array(orderSelectSchema).nullable(),
241
- });
242
-
243
- export const updatePatientRecordBodySchema = z.object({
244
- id: z.number().int().min(1),
245
- partnerPharmacyProfileId: z.number().int().nullable().optional(),
246
- userId: z.string().nullable().optional(),
247
- firstName: z.string().optional(),
248
- lastName: z.string().optional(),
249
- dateOfBirth: z.string().optional(),
250
- medicareNumber: z.string().nullable().optional(),
251
- phone: z.string().optional(),
252
- address: addressSchema.nullable().optional(),
253
- healthInfo: healthInfoSchema.nullable().optional(),
254
- reminderEnabled: z.boolean().optional(),
255
- scripts: z.array(scriptSelectSchema).nullable().optional(),
256
- orderHistory: z.array(orderSelectSchema).nullable().optional(),
257
- });
258
-
259
- // ─── prescriber ─────────────────────────────────────────────────────────────────
260
- export const createPrescriberBodySchema = z.object({
261
- name: z.string(),
262
- email: z.string(),
263
- phone: z.string(),
264
- });
265
-
266
- export const updatePrescriberBodySchema = z.object({
267
- id: z.number().int().min(1),
268
- name: z.string().optional(),
269
- email: z.string().optional(),
270
- phone: z.string().optional(),
271
- });
272
-
273
- // ─── price-match ────────────────────────────────────────────────────────────────
274
- export const createPriceMatchBodySchema = z.object({
275
- partnerPharmacyProfileId: z.number().int(),
276
- productId: z.number().int(),
277
- overridePrice: z.string(),
278
- });
279
-
280
- export const updatePriceMatchBodySchema = z.object({
281
- id: z.number().int().min(1),
282
- partnerPharmacyProfileId: z.number().int().optional(),
283
- productId: z.number().int().optional(),
284
- overridePrice: z.string().optional(),
285
- });
286
-
287
- // ─── product ────────────────────────────────────────────────────────────────────
288
- export const createProductBodySchema = z.object({
289
- name: z.string(),
290
- imageKey: z.string().nullable().optional(),
291
- abbreviations: z.array(z.string()).nullable().optional(),
292
- category: z.enum(productCategoryValues),
293
- rrp: z.string(),
294
- hazardTags: z.array(z.enum(hazardTagsValues)).nullable().optional(),
295
- compoundDirectId: z.string().nullable().optional(),
296
- requiresFridge: z.boolean().optional(),
297
- flavours: z.array(z.string()).nullable().optional(),
298
- requiresS8Medicare: z.boolean().optional(),
299
- });
300
-
301
- export const updateProductBodySchema = z.object({
302
- id: z.number().int().min(1),
303
- name: z.string().optional(),
304
- imageKey: z.string().nullable().optional(),
305
- abbreviations: z.array(z.string()).nullable().optional(),
306
- category: z.enum(productCategoryValues).optional(),
307
- rrp: z.string().optional(),
308
- hazardTags: z.array(z.enum(hazardTagsValues)).nullable().optional(),
309
- compoundDirectId: z.string().nullable().optional(),
310
- requiresFridge: z.boolean().optional(),
311
- flavours: z.array(z.string()).nullable().optional(),
312
- requiresS8Medicare: z.boolean().optional(),
313
- });
314
-
315
- // ─── quote ──────────────────────────────────────────────────────────────────────
316
- export const createQuoteBodySchema = z.object({
317
- status: z.enum(quoteStatusValues).optional(),
318
- partnerPharmacyProfileId: z.number().int(),
319
- name: z.string(),
320
- strength: z.string(),
321
- form: z.string(),
322
- quantity: z.number().int(),
323
- patientContext: z.string(),
324
- });
325
-
326
- export const updateQuoteBodySchema = z.object({
327
- id: z.number().int().min(1),
328
- status: z.enum(quoteStatusValues).optional(),
329
- partnerPharmacyProfileId: z.number().int().optional(),
330
- name: z.string().optional(),
331
- strength: z.string().optional(),
332
- form: z.string().optional(),
333
- quantity: z.number().int().optional(),
334
- patientContext: z.string().optional(),
335
- });
336
-
337
- // ─── repeat-reminder ────────────────────────────────────────────────────────────
338
- export const createRepeatReminderBodySchema = z.object({
339
- orderId: z.number().int(),
340
- patientRecordId: z.number().int(),
341
- daysSupply: z.number().int(),
342
- dispatchedAt: z.coerce.date(),
343
- reminderDueAt: z.coerce.date(),
344
- reminderOffsetDays: z.number().int().optional(),
345
- pharmacyReminderSent: z.boolean().optional(),
346
- patientSmsSent: z.boolean().optional(),
347
- enabled: z.boolean().optional(),
348
- });
349
-
350
- export const updateRepeatReminderBodySchema = z.object({
351
- id: z.number().int().min(1),
352
- orderId: z.number().int().optional(),
353
- patientRecordId: z.number().int().optional(),
354
- daysSupply: z.number().int().optional(),
355
- dispatchedAt: z.coerce.date().optional(),
356
- reminderDueAt: z.coerce.date().optional(),
357
- reminderOffsetDays: z.number().int().optional(),
358
- pharmacyReminderSent: z.boolean().optional(),
359
- patientSmsSent: z.boolean().optional(),
360
- enabled: z.boolean().optional(),
361
- });
362
-
363
- // ─── script ─────────────────────────────────────────────────────────────────────
364
- export const createScriptBodySchema = z.object({
365
- prescriberId: z.number().int(),
366
- patientRecordId: z.number().int(),
367
- productId: z.number().int(),
368
- dateIssued: z.string(),
369
- processed: z.boolean().optional(),
370
- repeatsRemaining: z.number().int().optional(),
371
- daysSupply: z.number().int(),
372
- repeatStorage: z.enum(repeatStorageValues),
373
- compoundDirectId: z.string().nullable().optional(),
374
- imageKey: z.string().nullable().optional(),
375
- });
376
-
377
- export const updateScriptBodySchema = z.object({
378
- id: z.number().int().min(1),
379
- prescriberId: z.number().int().optional(),
380
- patientRecordId: z.number().int().optional(),
381
- productId: z.number().int().optional(),
382
- dateIssued: z.string().optional(),
383
- processed: z.boolean().optional(),
384
- repeatsRemaining: z.number().int().optional(),
385
- daysSupply: z.number().int().optional(),
386
- repeatStorage: z.enum(repeatStorageValues).optional(),
387
- compoundDirectId: z.string().nullable().optional(),
388
- imageKey: z.string().nullable().optional(),
389
- });
package/index.js DELETED
@@ -1 +0,0 @@
1
- console.log("test");