@centricare/contract 0.2.1 → 0.3.0
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/index.cjs +171 -178
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +412 -315
- package/dist/index.d.ts +412 -315
- package/dist/index.mjs +164 -176
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
package/dist/index.mjs
CHANGED
|
@@ -28,17 +28,50 @@ var singleResourceResponseSchema = (dataSchema) => apiResponseSchema(dataSchema)
|
|
|
28
28
|
message: "Single resource response metadata must have total=1, offset=0, limit=0, next=null, previous=null"
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
|
+
var SETTING_OPTIONS_TYPE = [
|
|
32
|
+
// Single input
|
|
33
|
+
"string",
|
|
34
|
+
// Mapped to text input in client
|
|
35
|
+
"number",
|
|
36
|
+
// Mapped to number input in client
|
|
37
|
+
"boolean",
|
|
38
|
+
// Mapped to checkbox/switch in client
|
|
39
|
+
"date",
|
|
40
|
+
// Mapped date picker in client
|
|
41
|
+
"datetime",
|
|
42
|
+
// Mapped datetime picker in client
|
|
43
|
+
"daterange",
|
|
44
|
+
// Mapped date range picker in client
|
|
45
|
+
"image",
|
|
46
|
+
// Mapped to file input (single image only) in client
|
|
47
|
+
// Multiple input
|
|
48
|
+
"strings",
|
|
49
|
+
// Mapped to nested array text input in client
|
|
50
|
+
"numbers",
|
|
51
|
+
// Mapped to nested array number input in client
|
|
52
|
+
"images",
|
|
53
|
+
// Mapped to file input (multiple image) in client
|
|
54
|
+
"keyvals"
|
|
55
|
+
// Mapped to nested array text input pair in client
|
|
56
|
+
];
|
|
31
57
|
var settingOptionTypeSchema = z.union([
|
|
32
|
-
z.enum(
|
|
33
|
-
z.
|
|
34
|
-
z.string()
|
|
58
|
+
z.enum(SETTING_OPTIONS_TYPE),
|
|
59
|
+
z.string(),
|
|
60
|
+
z.string().array()
|
|
35
61
|
]);
|
|
36
62
|
var settingOptionSchema = z.object({
|
|
37
63
|
field: z.string().min(1, { message: "field is required" }),
|
|
38
64
|
label: z.string().optional(),
|
|
39
65
|
type: settingOptionTypeSchema,
|
|
40
66
|
default: z.string().nullable(),
|
|
41
|
-
value: z.union([
|
|
67
|
+
value: z.union([
|
|
68
|
+
z.string(),
|
|
69
|
+
z.boolean(),
|
|
70
|
+
z.number(),
|
|
71
|
+
z.string().array(),
|
|
72
|
+
z.number().array(),
|
|
73
|
+
z.object({ key: z.string(), value: z.string() })
|
|
74
|
+
]).nullable()
|
|
42
75
|
});
|
|
43
76
|
|
|
44
77
|
// src/registry/registry.json
|
|
@@ -960,11 +993,11 @@ var codedConceptSchema = z.object({
|
|
|
960
993
|
});
|
|
961
994
|
var demographicSchema = z5.object({
|
|
962
995
|
sex: codedConceptSchema,
|
|
963
|
-
religion: codedConceptSchema,
|
|
964
|
-
ethnicity: z5.string().
|
|
965
|
-
marital_status: codedConceptSchema,
|
|
966
|
-
date_of_birth: z5.string(),
|
|
967
|
-
place_of_birth: z5.string().
|
|
996
|
+
religion: codedConceptSchema.nullable(),
|
|
997
|
+
ethnicity: z5.string().nullable(),
|
|
998
|
+
marital_status: codedConceptSchema.nullable(),
|
|
999
|
+
date_of_birth: z5.string().nullable(),
|
|
1000
|
+
place_of_birth: z5.string().nullable()
|
|
968
1001
|
});
|
|
969
1002
|
var addressSchema = z.object({
|
|
970
1003
|
street: z.string().min(1, { message: "street is required" }),
|
|
@@ -979,6 +1012,23 @@ var objectIdSchema = z.string().length(24, {
|
|
|
979
1012
|
}).regex(/^[0-9a-fA-F]{24}$/, {
|
|
980
1013
|
message: "ObjectId must be a valid MongoDB ObjectId (24-character hex string)"
|
|
981
1014
|
});
|
|
1015
|
+
var baseSchema = (version) => z.object({
|
|
1016
|
+
_id: objectIdSchema,
|
|
1017
|
+
created_at: timestampSchema,
|
|
1018
|
+
created_by: z.string().min(1, { message: "created_by is required" }),
|
|
1019
|
+
updated_at: timestampSchema,
|
|
1020
|
+
updated_by: z.string().min(1, { message: "updated_by is required" }),
|
|
1021
|
+
schema_version: z.number().int().positive().default(version)
|
|
1022
|
+
});
|
|
1023
|
+
var baseSchemaWithExpiredAt = (version) => z.object({
|
|
1024
|
+
_id: objectIdSchema,
|
|
1025
|
+
created_at: timestampSchema,
|
|
1026
|
+
created_by: z.string().min(1, { message: "created_by is required" }),
|
|
1027
|
+
updated_at: timestampSchema,
|
|
1028
|
+
updated_by: z.string().min(1, { message: "updated_by is required" }),
|
|
1029
|
+
expired_at: timestampSchema,
|
|
1030
|
+
schema_version: z.number().int().positive().default(version)
|
|
1031
|
+
});
|
|
982
1032
|
var USER_SCHEMA_VERSION = 1;
|
|
983
1033
|
var userSchema = z.object({
|
|
984
1034
|
id: z.string(),
|
|
@@ -1040,25 +1090,23 @@ var userMinimalSchema = userSchema.omit({
|
|
|
1040
1090
|
|
|
1041
1091
|
// src/models/user/user-partial.schema.ts
|
|
1042
1092
|
var userPartialSchema = userMinimalSchema.partial();
|
|
1043
|
-
var nonEmpty = z.string().min(1, { message: "assigned_to is required" });
|
|
1044
1093
|
var ASSIGNMENT_SCHEMA_VERSION = 1;
|
|
1045
|
-
var assignmentSchema =
|
|
1046
|
-
_id: objectIdSchema,
|
|
1094
|
+
var assignmentSchema = baseSchema(ASSIGNMENT_SCHEMA_VERSION).extend({
|
|
1047
1095
|
facility_id: objectIdSchema,
|
|
1048
1096
|
type: codedConceptSchema,
|
|
1049
1097
|
for: z.string().min(1, { message: "for is required" }),
|
|
1050
|
-
assigned_to: z.
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
updated_at: z.string(),
|
|
1056
|
-
updated_by: z.string(),
|
|
1057
|
-
schema_version: z.number().int().positive().default(ASSIGNMENT_SCHEMA_VERSION)
|
|
1098
|
+
assigned_to: z.array(
|
|
1099
|
+
z.string().min(1, {
|
|
1100
|
+
message: "assigned_to is required"
|
|
1101
|
+
})
|
|
1102
|
+
).min(1)
|
|
1058
1103
|
});
|
|
1059
1104
|
var AssignmentMongooseSchema = toMongooseSchema(assignmentSchema);
|
|
1060
1105
|
var AssignmentModelName = "assignments";
|
|
1061
|
-
var AssignmentModel = model(
|
|
1106
|
+
var AssignmentModel = model(
|
|
1107
|
+
AssignmentModelName,
|
|
1108
|
+
AssignmentMongooseSchema
|
|
1109
|
+
);
|
|
1062
1110
|
|
|
1063
1111
|
// src/models/assignment/assignment-minimal.schema.ts
|
|
1064
1112
|
var assignmentMinimalSchema = assignmentSchema.omit({
|
|
@@ -1073,16 +1121,10 @@ var assignmentMinimalSchema = assignmentSchema.omit({
|
|
|
1073
1121
|
// src/models/assignment/assignment-partial.schema.ts
|
|
1074
1122
|
var assignmentPartialSchema = assignmentMinimalSchema.partial();
|
|
1075
1123
|
var DEPARTMENT_SCHEMA_VERSION = 1;
|
|
1076
|
-
var departmentSchema =
|
|
1077
|
-
_id: objectIdSchema,
|
|
1124
|
+
var departmentSchema = baseSchema(DEPARTMENT_SCHEMA_VERSION).extend({
|
|
1078
1125
|
facility_id: objectIdSchema,
|
|
1079
1126
|
name: z.string().min(1, { message: "name is required" }),
|
|
1080
|
-
type: codedConceptSchema
|
|
1081
|
-
created_at: z.string(),
|
|
1082
|
-
created_by: z.string(),
|
|
1083
|
-
updated_at: z.string(),
|
|
1084
|
-
updated_by: z.string(),
|
|
1085
|
-
schema_version: z.number().int().positive().default(DEPARTMENT_SCHEMA_VERSION)
|
|
1127
|
+
type: codedConceptSchema
|
|
1086
1128
|
});
|
|
1087
1129
|
var DepartmentMongooseSchema = toMongooseSchema(departmentSchema);
|
|
1088
1130
|
var DepartmentModelName = "departments";
|
|
@@ -1119,10 +1161,15 @@ var FACILITY_SETTING_FIELDS = [
|
|
|
1119
1161
|
"satusehat_org_id",
|
|
1120
1162
|
"satusehat_client_id",
|
|
1121
1163
|
"satusehat_client_secret",
|
|
1164
|
+
"queue_number_length",
|
|
1122
1165
|
"queue_number_separator",
|
|
1123
|
-
"
|
|
1124
|
-
"
|
|
1125
|
-
"
|
|
1166
|
+
"queue_call_threshold",
|
|
1167
|
+
"queue_call_priority",
|
|
1168
|
+
"kiosk_announcements",
|
|
1169
|
+
"kiosk_gallery",
|
|
1170
|
+
"kiosk_faq",
|
|
1171
|
+
"kiosk_services",
|
|
1172
|
+
"payer_types"
|
|
1126
1173
|
];
|
|
1127
1174
|
var FACILITY_SETTINGS_SCHEMA_VERSION = 1;
|
|
1128
1175
|
var facilitySettingsSchema = z.object({
|
|
@@ -1139,14 +1186,21 @@ var facilitySettingsSchema = z.object({
|
|
|
1139
1186
|
schema_version: z.number().int().positive().default(FACILITY_SETTINGS_SCHEMA_VERSION)
|
|
1140
1187
|
});
|
|
1141
1188
|
var facilitySettingsKVSchema = z.object({
|
|
1142
|
-
branding_logo: z.string().
|
|
1143
|
-
satusehat_org_id: z.string().
|
|
1144
|
-
satusehat_client_id: z.string().
|
|
1145
|
-
satusehat_client_secret: z.string().
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1189
|
+
branding_logo: z.string().nullable(),
|
|
1190
|
+
satusehat_org_id: z.string().nullable(),
|
|
1191
|
+
satusehat_client_id: z.string().nullable(),
|
|
1192
|
+
satusehat_client_secret: z.string().nullable(),
|
|
1193
|
+
queue_number_length: z.number().int().positive().nullable().default(3),
|
|
1194
|
+
queue_number_separator: z.string().nullable(),
|
|
1195
|
+
queue_call_priority: z.string().default("sequence").refine((data) => validateCode("crn:queue:priority", data), {
|
|
1196
|
+
message: "Invalid CodedConcept: system/value combination not found in registry"
|
|
1197
|
+
}),
|
|
1198
|
+
queue_call_threshold: z.number().int().positive().default(3),
|
|
1199
|
+
kiosk_announcements: z.string().array(),
|
|
1200
|
+
kiosk_gallery: z.url().array(),
|
|
1201
|
+
kiosk_faq: z.object({ key: z.string(), value: z.string() }).array(),
|
|
1202
|
+
kiosk_services: z.object({ key: z.string(), value: z.string() }).array(),
|
|
1203
|
+
payer_types: z.string().array()
|
|
1150
1204
|
});
|
|
1151
1205
|
|
|
1152
1206
|
// src/models/facility/facility-minimal.schema.ts
|
|
@@ -1159,8 +1213,7 @@ var facilityMinimalSchema = facilitySchema.omit({
|
|
|
1159
1213
|
// src/models/facility/facility-partial.schema.ts
|
|
1160
1214
|
var facilityPartialSchema = facilityMinimalSchema.partial();
|
|
1161
1215
|
var LOCATION_SCHEMA_VERSION = 1;
|
|
1162
|
-
var locationSchema =
|
|
1163
|
-
_id: objectIdSchema,
|
|
1216
|
+
var locationSchema = baseSchema(LOCATION_SCHEMA_VERSION).extend({
|
|
1164
1217
|
parent_id: objectIdSchema,
|
|
1165
1218
|
identifiers: z.array(codedConceptSchema).nonempty({
|
|
1166
1219
|
message: "identifiers must contain at least one CodedConcept"
|
|
@@ -1172,12 +1225,7 @@ var locationSchema = z.object({
|
|
|
1172
1225
|
statuses: z.array(codedConceptSchema).nonempty({
|
|
1173
1226
|
message: "statuses must contain at least one CodedConcept"
|
|
1174
1227
|
}),
|
|
1175
|
-
settings_id: objectIdSchema
|
|
1176
|
-
created_at: timestampSchema,
|
|
1177
|
-
created_by: z.string(),
|
|
1178
|
-
updated_at: timestampSchema,
|
|
1179
|
-
updated_by: z.string(),
|
|
1180
|
-
schema_version: z.number().int().positive().default(LOCATION_SCHEMA_VERSION)
|
|
1228
|
+
settings_id: objectIdSchema
|
|
1181
1229
|
});
|
|
1182
1230
|
var LocationMongooseSchema = toMongooseSchema(locationSchema);
|
|
1183
1231
|
var LocationModelName = "locations";
|
|
@@ -1213,7 +1261,8 @@ var locationMinimalSchema = locationSchema.omit({
|
|
|
1213
1261
|
created_at: true,
|
|
1214
1262
|
created_by: true,
|
|
1215
1263
|
updated_at: true,
|
|
1216
|
-
updated_by: true
|
|
1264
|
+
updated_by: true,
|
|
1265
|
+
schema_version: true
|
|
1217
1266
|
});
|
|
1218
1267
|
|
|
1219
1268
|
// src/models/location/location-partial.schema.ts
|
|
@@ -1288,28 +1337,26 @@ var organizationMinimalSchema = organizationSchema.omit({
|
|
|
1288
1337
|
// src/models/organization/organization-partial.schema.ts
|
|
1289
1338
|
var organizationPartialSchema = organizationMinimalSchema.partial();
|
|
1290
1339
|
var PATIENT_SCHEMA_VERSION = 1;
|
|
1291
|
-
var patientSchema =
|
|
1292
|
-
_id: objectIdSchema,
|
|
1340
|
+
var patientSchema = baseSchema(PATIENT_SCHEMA_VERSION).extend({
|
|
1293
1341
|
organization_id: objectIdSchema,
|
|
1294
1342
|
registering_facility_id: objectIdSchema,
|
|
1295
1343
|
identifiers: z.array(codedConceptSchema),
|
|
1296
|
-
salutation:
|
|
1344
|
+
salutation: codedConceptSchema,
|
|
1297
1345
|
first_name: z.string().min(1, { message: "first_name is required" }),
|
|
1298
1346
|
middle_name: z.string().optional(),
|
|
1299
1347
|
last_name: z.string().min(1, { message: "last_name is required" }),
|
|
1300
1348
|
title: z.string().optional(),
|
|
1301
1349
|
image: z.string().optional(),
|
|
1302
|
-
demographic: demographicSchema
|
|
1350
|
+
demographic: demographicSchema.extend({
|
|
1351
|
+
place_of_birth: demographicSchema.shape.place_of_birth.unwrap(),
|
|
1352
|
+
date_of_birth: demographicSchema.shape.date_of_birth.unwrap(),
|
|
1353
|
+
marital_status: demographicSchema.shape.marital_status.unwrap()
|
|
1354
|
+
}),
|
|
1303
1355
|
statuses: z.array(codedConceptSchema).nonempty({
|
|
1304
1356
|
message: "statuses must contain at least one CodedConcept"
|
|
1305
1357
|
}),
|
|
1306
1358
|
contacts: z.array(codedConceptSchema).optional(),
|
|
1307
|
-
address: addressSchema
|
|
1308
|
-
created_at: timestampSchema,
|
|
1309
|
-
created_by: z.string(),
|
|
1310
|
-
updated_at: timestampSchema,
|
|
1311
|
-
updated_by: z.string(),
|
|
1312
|
-
schema_version: z.number().int().positive().default(PATIENT_SCHEMA_VERSION)
|
|
1359
|
+
address: addressSchema
|
|
1313
1360
|
});
|
|
1314
1361
|
var PatientMongooseSchema = toMongooseSchema(patientSchema);
|
|
1315
1362
|
var PatientModelName = "patients";
|
|
@@ -1328,16 +1375,10 @@ var patientMinimalSchema = patientSchema.omit({
|
|
|
1328
1375
|
// src/models/patient/patient-partial.schema.ts
|
|
1329
1376
|
var patientPartialSchema = patientMinimalSchema.partial();
|
|
1330
1377
|
var PATIENT_ADDITIONAL_SCHEMA_VERSION = 1;
|
|
1331
|
-
var patientAdditionalSchema =
|
|
1332
|
-
id: z.string().uuid({ message: "id must be a valid UUID" }),
|
|
1378
|
+
var patientAdditionalSchema = baseSchema(PATIENT_ADDITIONAL_SCHEMA_VERSION).extend({
|
|
1333
1379
|
patient_id: objectIdSchema,
|
|
1334
1380
|
type: codedConceptSchema,
|
|
1335
|
-
data: z.union([z.object({}), z.array(z.any())])
|
|
1336
|
-
created_at: timestampSchema,
|
|
1337
|
-
created_by: z.string(),
|
|
1338
|
-
updated_at: timestampSchema,
|
|
1339
|
-
updated_by: z.string(),
|
|
1340
|
-
schema_version: z.number().int().positive().default(PATIENT_ADDITIONAL_SCHEMA_VERSION)
|
|
1381
|
+
data: z.union([z.object({}), z.array(z.any())])
|
|
1341
1382
|
});
|
|
1342
1383
|
var PatientAdditionalMongooseSchema = toMongooseSchema(patientAdditionalSchema);
|
|
1343
1384
|
var PatientAdditionalModelName = "patient_additionals";
|
|
@@ -1345,7 +1386,7 @@ var PatientAdditionalModel = model(PatientAdditionalModelName, PatientAdditional
|
|
|
1345
1386
|
|
|
1346
1387
|
// src/models/patient-additional/patient-additional-minimal.schema.ts
|
|
1347
1388
|
var patientAdditionalMinimalSchema = patientAdditionalSchema.omit({
|
|
1348
|
-
|
|
1389
|
+
_id: true,
|
|
1349
1390
|
created_at: true,
|
|
1350
1391
|
created_by: true,
|
|
1351
1392
|
updated_at: true,
|
|
@@ -1356,20 +1397,14 @@ var patientAdditionalMinimalSchema = patientAdditionalSchema.omit({
|
|
|
1356
1397
|
// src/models/patient-additional/patient-additional-partial.schema.ts
|
|
1357
1398
|
var patientAdditionalPartialSchema = patientAdditionalMinimalSchema.partial();
|
|
1358
1399
|
var STAFF_SCHEMA_VERSION = 1;
|
|
1359
|
-
var staffSchema =
|
|
1360
|
-
id: z.string().uuid({ message: "id must be a valid UUID" }),
|
|
1400
|
+
var staffSchema = baseSchema(STAFF_SCHEMA_VERSION).extend({
|
|
1361
1401
|
team_id: objectIdSchema,
|
|
1362
1402
|
user_id: objectIdSchema,
|
|
1363
1403
|
type: codedConceptSchema,
|
|
1364
1404
|
status: codedConceptSchema,
|
|
1365
1405
|
membership_key: z.string().optional(),
|
|
1366
1406
|
group: z.string().optional(),
|
|
1367
|
-
subspecialist: z.string().optional()
|
|
1368
|
-
created_at: timestampSchema,
|
|
1369
|
-
created_by: z.string(),
|
|
1370
|
-
updated_at: timestampSchema,
|
|
1371
|
-
updated_by: z.string(),
|
|
1372
|
-
schema_version: z.number().int().positive().default(STAFF_SCHEMA_VERSION)
|
|
1407
|
+
subspecialist: z.string().optional()
|
|
1373
1408
|
});
|
|
1374
1409
|
var StaffMongooseSchema = toMongooseSchema(staffSchema);
|
|
1375
1410
|
var StaffModelName = "staffs";
|
|
@@ -1377,7 +1412,7 @@ var StaffModel = model(StaffModelName, StaffMongooseSchema);
|
|
|
1377
1412
|
|
|
1378
1413
|
// src/models/staff/staff-minimal.schema.ts
|
|
1379
1414
|
var staffMinimalSchema = staffSchema.omit({
|
|
1380
|
-
|
|
1415
|
+
_id: true,
|
|
1381
1416
|
created_at: true,
|
|
1382
1417
|
created_by: true,
|
|
1383
1418
|
updated_at: true,
|
|
@@ -1388,8 +1423,7 @@ var staffMinimalSchema = staffSchema.omit({
|
|
|
1388
1423
|
// src/models/staff/staff-partial.schema.ts
|
|
1389
1424
|
var staffPartialSchema = staffMinimalSchema.partial();
|
|
1390
1425
|
var UNIT_SCHEMA_VERSION = 1;
|
|
1391
|
-
var unitSchema =
|
|
1392
|
-
_id: objectIdSchema,
|
|
1426
|
+
var unitSchema = baseSchema(UNIT_SCHEMA_VERSION).extend({
|
|
1393
1427
|
facility_id: objectIdSchema,
|
|
1394
1428
|
department_id: objectIdSchema,
|
|
1395
1429
|
name: z.string().min(1, { message: "name is required" }),
|
|
@@ -1398,12 +1432,7 @@ var unitSchema = z.object({
|
|
|
1398
1432
|
statuses: z.array(codedConceptSchema).nonempty({
|
|
1399
1433
|
message: "statuses must contain at least one CodedConcept"
|
|
1400
1434
|
}),
|
|
1401
|
-
settings_id: objectIdSchema
|
|
1402
|
-
created_at: timestampSchema,
|
|
1403
|
-
created_by: z.string(),
|
|
1404
|
-
updated_at: timestampSchema,
|
|
1405
|
-
updated_by: z.string(),
|
|
1406
|
-
schema_version: z.number().int().positive().default(UNIT_SCHEMA_VERSION)
|
|
1435
|
+
settings_id: objectIdSchema
|
|
1407
1436
|
});
|
|
1408
1437
|
var UnitMongooseSchema = toMongooseSchema(unitSchema);
|
|
1409
1438
|
var UnitModelName = "units";
|
|
@@ -1422,19 +1451,15 @@ var unitMinimalSchema = unitSchema.omit({
|
|
|
1422
1451
|
// src/models/unit/unit-partial.schema.ts
|
|
1423
1452
|
var unitPartialSchema = unitMinimalSchema.partial();
|
|
1424
1453
|
var PRACTITIONER_SCHEDULE_SCHEMA_VERSION = 1;
|
|
1425
|
-
var practitionerScheduleSchema =
|
|
1454
|
+
var practitionerScheduleSchema = baseSchema(
|
|
1455
|
+
PRACTITIONER_SCHEDULE_SCHEMA_VERSION
|
|
1456
|
+
).extend({
|
|
1426
1457
|
organization_id: objectIdSchema,
|
|
1427
1458
|
facility_id: objectIdSchema,
|
|
1428
1459
|
staff_id: objectIdSchema,
|
|
1429
1460
|
unit_id: objectIdSchema,
|
|
1430
1461
|
type: codedConceptSchema,
|
|
1431
|
-
day: z.union([z.number(), z.string()]).refine((val) => val != null, { message: "day is required" })
|
|
1432
|
-
_id: objectIdSchema,
|
|
1433
|
-
created_at: timestampSchema.optional(),
|
|
1434
|
-
created_by: z.string().optional(),
|
|
1435
|
-
updated_at: timestampSchema.optional(),
|
|
1436
|
-
updated_by: z.string().optional(),
|
|
1437
|
-
schema_version: z.number().int().positive().default(PRACTITIONER_SCHEDULE_SCHEMA_VERSION)
|
|
1462
|
+
day: z.union([z.number(), z.string()]).refine((val) => val != null, { message: "day is required" })
|
|
1438
1463
|
});
|
|
1439
1464
|
var PractitionerScheduleMongooseSchema = toMongooseSchema(practitionerScheduleSchema);
|
|
1440
1465
|
var PractitionerScheduleModelName = "practitioner_schedules";
|
|
@@ -1453,19 +1478,15 @@ var practitionerScheduleMinimalSchema = practitionerScheduleSchema.omit({
|
|
|
1453
1478
|
// src/models/practitioner-schedule/practitioner-schedule-partial.schema.ts
|
|
1454
1479
|
var practitionerSchedulePartialSchema = practitionerScheduleMinimalSchema.partial();
|
|
1455
1480
|
var PRACTITIONER_SESSION_SCHEMA_VERSION = 1;
|
|
1456
|
-
var practitionerSessionSchema =
|
|
1481
|
+
var practitionerSessionSchema = baseSchema(
|
|
1482
|
+
PRACTITIONER_SESSION_SCHEMA_VERSION
|
|
1483
|
+
).extend({
|
|
1457
1484
|
schedule_id: objectIdSchema,
|
|
1458
1485
|
staff_id: objectIdSchema,
|
|
1459
1486
|
unit_id: objectIdSchema,
|
|
1460
1487
|
start: z.string().min(1, { message: "start is required" }),
|
|
1461
1488
|
end: z.string().min(1, { message: "end is required" }),
|
|
1462
|
-
max_quota: z.number().int().positive({ message: "max_quota must be a positive integer" })
|
|
1463
|
-
_id: objectIdSchema,
|
|
1464
|
-
created_at: timestampSchema.optional(),
|
|
1465
|
-
created_by: z.string().optional(),
|
|
1466
|
-
updated_at: timestampSchema.optional(),
|
|
1467
|
-
updated_by: z.string().optional(),
|
|
1468
|
-
schema_version: z.number().int().positive().default(PRACTITIONER_SESSION_SCHEMA_VERSION)
|
|
1489
|
+
max_quota: z.number().int().positive({ message: "max_quota must be a positive integer" })
|
|
1469
1490
|
});
|
|
1470
1491
|
var PractitionerSessionMongooseSchema = toMongooseSchema(practitionerSessionSchema);
|
|
1471
1492
|
var PractitionerSessionModelName = "practitioner_sessions";
|
|
@@ -1484,17 +1505,11 @@ var practitionerSessionMinimalSchema = practitionerSessionSchema.omit({
|
|
|
1484
1505
|
// src/models/practitioner-session/practitioner-session-partial.schema.ts
|
|
1485
1506
|
var practitionerSessionPartialSchema = practitionerSessionMinimalSchema.partial();
|
|
1486
1507
|
var KSM_SCHEMA_VERSION = 1;
|
|
1487
|
-
var ksmSchema =
|
|
1488
|
-
id: z.string().uuid({ message: "id must be a valid UUID" }),
|
|
1508
|
+
var ksmSchema = baseSchema(KSM_SCHEMA_VERSION).extend({
|
|
1489
1509
|
organization_id: objectIdSchema,
|
|
1490
1510
|
facility_id: objectIdSchema,
|
|
1491
1511
|
name: z.string().min(1, { message: "name is required" }),
|
|
1492
|
-
subspecialist: z.array(z.string()).min(1, { message: "subspecialist is required" })
|
|
1493
|
-
created_at: timestampSchema,
|
|
1494
|
-
created_by: z.string().min(1, { message: "created_by is required" }),
|
|
1495
|
-
updated_at: timestampSchema.nullable(),
|
|
1496
|
-
updated_by: z.string().nullable(),
|
|
1497
|
-
schema_version: z.number().int().positive().default(KSM_SCHEMA_VERSION)
|
|
1512
|
+
subspecialist: z.array(z.string()).min(1, { message: "subspecialist is required" })
|
|
1498
1513
|
});
|
|
1499
1514
|
var KsmMongooseSchema = toMongooseSchema(ksmSchema);
|
|
1500
1515
|
var KsmModelName = "medical_staff_groups";
|
|
@@ -1502,7 +1517,7 @@ var KsmModel = model(KsmModelName, KsmMongooseSchema);
|
|
|
1502
1517
|
|
|
1503
1518
|
// src/models/ksm/ksm-minimal.schema.ts
|
|
1504
1519
|
var ksmMinimalSchema = ksmSchema.omit({
|
|
1505
|
-
|
|
1520
|
+
_id: true,
|
|
1506
1521
|
created_at: true,
|
|
1507
1522
|
created_by: true,
|
|
1508
1523
|
updated_at: true,
|
|
@@ -1514,8 +1529,7 @@ var ksmMinimalSchema = ksmSchema.omit({
|
|
|
1514
1529
|
var ksmPartialSchema = ksmMinimalSchema.partial();
|
|
1515
1530
|
var isoDatetimeRegex3 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})$/;
|
|
1516
1531
|
var PAYER_SCHEMA_VERSION = 1;
|
|
1517
|
-
var payerSchema =
|
|
1518
|
-
id: z.string().uuid({ message: "id must be a valid UUID" }),
|
|
1532
|
+
var payerSchema = baseSchema(PAYER_SCHEMA_VERSION).extend({
|
|
1519
1533
|
organization_id: objectIdSchema,
|
|
1520
1534
|
facility_id: objectIdSchema,
|
|
1521
1535
|
code: z.string().min(1, { message: "code is required" }),
|
|
@@ -1550,12 +1564,7 @@ var payerSchema = z.object({
|
|
|
1550
1564
|
),
|
|
1551
1565
|
settings_id: objectIdSchema
|
|
1552
1566
|
})
|
|
1553
|
-
)
|
|
1554
|
-
created_at: timestampSchema,
|
|
1555
|
-
created_by: z.string().min(1, { message: "created_by is required" }),
|
|
1556
|
-
updated_at: timestampSchema,
|
|
1557
|
-
updated_by: z.string().min(1, { message: "updated_by is required" }),
|
|
1558
|
-
schema_version: z.number().int().positive().default(PAYER_SCHEMA_VERSION)
|
|
1567
|
+
)
|
|
1559
1568
|
});
|
|
1560
1569
|
var PayerMongooseSchema = toMongooseSchema(payerSchema);
|
|
1561
1570
|
var PayerModelName = "payers";
|
|
@@ -1613,7 +1622,7 @@ var payerSettingsKVSchema = z.object({
|
|
|
1613
1622
|
|
|
1614
1623
|
// src/models/payer/payer-minimal.schema.ts
|
|
1615
1624
|
var payerMinimalSchema = payerSchema.omit({
|
|
1616
|
-
|
|
1625
|
+
_id: true,
|
|
1617
1626
|
created_at: true,
|
|
1618
1627
|
created_by: true,
|
|
1619
1628
|
updated_at: true,
|
|
@@ -1624,8 +1633,7 @@ var payerMinimalSchema = payerSchema.omit({
|
|
|
1624
1633
|
// src/models/payer/payer-partial.schema.ts
|
|
1625
1634
|
var payerPartialSchema = payerMinimalSchema.partial();
|
|
1626
1635
|
var QUEUE_SCHEMA_VERSION = 1;
|
|
1627
|
-
var queueSchema =
|
|
1628
|
-
id: z.string().uuid({ message: "id must be a valid UUID" }),
|
|
1636
|
+
var queueSchema = baseSchema(QUEUE_SCHEMA_VERSION).extend({
|
|
1629
1637
|
organization_id: objectIdSchema,
|
|
1630
1638
|
facility_id: objectIdSchema,
|
|
1631
1639
|
unit_id: objectIdSchema,
|
|
@@ -1638,46 +1646,15 @@ var queueSchema = z.object({
|
|
|
1638
1646
|
status: codedConceptSchema,
|
|
1639
1647
|
call_count: z.number().int().positive({ message: "call_count must be a positive integer" })
|
|
1640
1648
|
})
|
|
1641
|
-
)
|
|
1642
|
-
created_at: timestampSchema,
|
|
1643
|
-
created_by: z.string().min(1, { message: "created_by is required" }),
|
|
1644
|
-
updated_at: timestampSchema,
|
|
1645
|
-
updated_by: z.string().min(1, { message: "updated_by is required" }),
|
|
1646
|
-
schema_version: z.number().int().positive().default(QUEUE_SCHEMA_VERSION)
|
|
1649
|
+
)
|
|
1647
1650
|
});
|
|
1648
1651
|
var QueueMongooseSchema = toMongooseSchema(queueSchema);
|
|
1649
1652
|
var QueueModelName = "queues";
|
|
1650
1653
|
var QueueModel = model(QueueModelName, QueueMongooseSchema);
|
|
1651
|
-
var QUEUE_SETTING_FIELDS = [
|
|
1652
|
-
"number_length",
|
|
1653
|
-
"call_priority",
|
|
1654
|
-
"call_threshold"
|
|
1655
|
-
];
|
|
1656
|
-
var QUEUE_SETTINGS_SCHEMA_VERSION = 1;
|
|
1657
|
-
var queueSettingsSchema = z.object({
|
|
1658
|
-
_id: objectIdSchema,
|
|
1659
|
-
scope: z.string().min(1),
|
|
1660
|
-
options: z.array(
|
|
1661
|
-
settingOptionSchema.refine(
|
|
1662
|
-
(opt) => QUEUE_SETTING_FIELDS.includes(opt.field),
|
|
1663
|
-
{ message: "Invalid field for queue settings" }
|
|
1664
|
-
)
|
|
1665
|
-
),
|
|
1666
|
-
updated_at: timestampSchema,
|
|
1667
|
-
updated_by: z.string(),
|
|
1668
|
-
schema_version: z.number().int().positive().default(QUEUE_SETTINGS_SCHEMA_VERSION)
|
|
1669
|
-
});
|
|
1670
|
-
var queueSettingsKVSchema = z.object({
|
|
1671
|
-
number_length: z.number().int().positive().nullable().default(null),
|
|
1672
|
-
call_priority: z.string().default("sequence"),
|
|
1673
|
-
call_threshold: z.number().int().positive().default(3)
|
|
1674
|
-
}).refine((data) => validateCode("crn:queue:priority", data.call_priority), {
|
|
1675
|
-
message: "Invalid CodedConcept: system/value combination not found in registry"
|
|
1676
|
-
});
|
|
1677
1654
|
|
|
1678
1655
|
// src/models/queue/queue-minimal.schema.ts
|
|
1679
1656
|
var queueMinimalSchema = queueSchema.omit({
|
|
1680
|
-
|
|
1657
|
+
_id: true,
|
|
1681
1658
|
created_at: true,
|
|
1682
1659
|
created_by: true,
|
|
1683
1660
|
updated_at: true,
|
|
@@ -1688,17 +1665,11 @@ var queueMinimalSchema = queueSchema.omit({
|
|
|
1688
1665
|
// src/models/queue/queue-partial.schema.ts
|
|
1689
1666
|
var queuePartialSchema = queueMinimalSchema.partial();
|
|
1690
1667
|
var QUEUE_EVENT_LOG_SCHEMA_VERSION = 1;
|
|
1691
|
-
var queueEventLogSchema =
|
|
1692
|
-
id: z.string().uuid({ message: "id must be a valid UUID" }),
|
|
1668
|
+
var queueEventLogSchema = baseSchema(QUEUE_EVENT_LOG_SCHEMA_VERSION).extend({
|
|
1693
1669
|
queue_number_id: objectIdSchema,
|
|
1694
1670
|
queue_number: z.string().min(1, { message: "queue_number is required" }),
|
|
1695
1671
|
events: z.array(codedConceptSchema),
|
|
1696
|
-
count: z.number().int().positive({ message: "count must be a positive integer" })
|
|
1697
|
-
created_at: timestampSchema,
|
|
1698
|
-
created_by: z.string().min(1, { message: "created_by is required" }),
|
|
1699
|
-
updated_at: timestampSchema,
|
|
1700
|
-
updated_by: z.string().min(1, { message: "updated_by is required" }),
|
|
1701
|
-
schema_version: z.number().int().positive().default(QUEUE_EVENT_LOG_SCHEMA_VERSION)
|
|
1672
|
+
count: z.number().int().positive({ message: "count must be a positive integer" })
|
|
1702
1673
|
});
|
|
1703
1674
|
var QueueEventLogMongooseSchema = toMongooseSchema(queueEventLogSchema);
|
|
1704
1675
|
var QueueEventLogModelName = "queue_event_logs";
|
|
@@ -1706,7 +1677,7 @@ var QueueEventLogModel = model(QueueEventLogModelName, QueueEventLogMongooseSche
|
|
|
1706
1677
|
|
|
1707
1678
|
// src/models/queue-event-log/queue-event-log-minimal.schema.ts
|
|
1708
1679
|
var queueEventLogMinimalSchema = queueEventLogSchema.omit({
|
|
1709
|
-
|
|
1680
|
+
_id: true,
|
|
1710
1681
|
created_at: true,
|
|
1711
1682
|
created_by: true,
|
|
1712
1683
|
updated_at: true,
|
|
@@ -1718,8 +1689,9 @@ var queueEventLogMinimalSchema = queueEventLogSchema.omit({
|
|
|
1718
1689
|
var queueEventLogPartialSchema = queueEventLogMinimalSchema.partial();
|
|
1719
1690
|
var isoDatetimeRegex4 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})$/;
|
|
1720
1691
|
var QUEUE_NUMBER_SCHEMA_VERSION = 1;
|
|
1721
|
-
var queueNumberSchema =
|
|
1722
|
-
|
|
1692
|
+
var queueNumberSchema = baseSchemaWithExpiredAt(
|
|
1693
|
+
QUEUE_NUMBER_SCHEMA_VERSION
|
|
1694
|
+
).extend({
|
|
1723
1695
|
organization_id: objectIdSchema,
|
|
1724
1696
|
facility_id: objectIdSchema,
|
|
1725
1697
|
patient_id: objectIdSchema,
|
|
@@ -1734,15 +1706,7 @@ var queueNumberSchema = z.object({
|
|
|
1734
1706
|
}),
|
|
1735
1707
|
sequence: z.number().int().positive({ message: "sequence must be a positive integer" }),
|
|
1736
1708
|
prefix: z.string().min(1, { message: "prefix is required" }),
|
|
1737
|
-
number: z.string().min(1, { message: "number is required" })
|
|
1738
|
-
created_at: timestampSchema,
|
|
1739
|
-
created_by: z.string().min(1, { message: "created_by is required" }),
|
|
1740
|
-
updated_at: timestampSchema,
|
|
1741
|
-
updated_by: z.string().min(1, { message: "updated_by is required" }),
|
|
1742
|
-
expired_at: z.string().refine((val) => isoDatetimeRegex4.test(val), {
|
|
1743
|
-
message: "expired_at must be a valid ISO 8601 datetime"
|
|
1744
|
-
}),
|
|
1745
|
-
schema_version: z.number().int().positive().default(QUEUE_NUMBER_SCHEMA_VERSION)
|
|
1709
|
+
number: z.string().min(1, { message: "number is required" })
|
|
1746
1710
|
});
|
|
1747
1711
|
var QueueNumberMongooseSchema = toMongooseSchema(queueNumberSchema);
|
|
1748
1712
|
var QueueNumberModelName = "queue_numbers";
|
|
@@ -1803,7 +1767,7 @@ var queueNumberSettingsKVSchema = z.object({
|
|
|
1803
1767
|
|
|
1804
1768
|
// src/models/queue-number/queue-number-minimal.schema.ts
|
|
1805
1769
|
var queueNumberMinimalSchema = queueNumberSchema.omit({
|
|
1806
|
-
|
|
1770
|
+
_id: true,
|
|
1807
1771
|
created_at: true,
|
|
1808
1772
|
created_by: true,
|
|
1809
1773
|
updated_at: true,
|
|
@@ -1814,7 +1778,31 @@ var queueNumberMinimalSchema = queueNumberSchema.omit({
|
|
|
1814
1778
|
|
|
1815
1779
|
// src/models/queue-number/queue-number-partial.schema.ts
|
|
1816
1780
|
var queueNumberPartialSchema = queueNumberMinimalSchema.partial();
|
|
1781
|
+
var ARTICLE_SCHEMA_VERSION = 1;
|
|
1782
|
+
var articleSchema = baseSchema(ARTICLE_SCHEMA_VERSION).extend({
|
|
1783
|
+
facility_id: objectIdSchema,
|
|
1784
|
+
title: z.string().min(1, { message: "for is required" }),
|
|
1785
|
+
banner: z.url(),
|
|
1786
|
+
body: z.string(),
|
|
1787
|
+
status: codedConceptSchema
|
|
1788
|
+
});
|
|
1789
|
+
var ArticleMongooseSchema = toMongooseSchema(articleSchema);
|
|
1790
|
+
var ArticleModelName = "articles";
|
|
1791
|
+
var ArticleModel = model(ArticleModelName, ArticleMongooseSchema);
|
|
1792
|
+
|
|
1793
|
+
// src/models/article/article-minimal.schema.ts
|
|
1794
|
+
var articleMinimalSchema = articleSchema.omit({
|
|
1795
|
+
_id: true,
|
|
1796
|
+
created_at: true,
|
|
1797
|
+
created_by: true,
|
|
1798
|
+
updated_at: true,
|
|
1799
|
+
updated_by: true,
|
|
1800
|
+
schema_version: true
|
|
1801
|
+
});
|
|
1802
|
+
|
|
1803
|
+
// src/models/article/article-partial.schema.ts
|
|
1804
|
+
var articlePartialSchema = articleMinimalSchema.partial();
|
|
1817
1805
|
|
|
1818
|
-
export { ASSIGNMENT_SCHEMA_VERSION, AssignmentModel, AssignmentMongooseSchema, DEPARTMENT_SCHEMA_VERSION, DepartmentModel, DepartmentMongooseSchema, FACILITY_SCHEMA_VERSION, FACILITY_SETTINGS_SCHEMA_VERSION, FacilityModel, FacilityMongooseSchema, KSM_SCHEMA_VERSION, KsmModel, KsmMongooseSchema, LOCATION_SCHEMA_VERSION, LOCATION_SETTINGS_SCHEMA_VERSION, LocationModel, LocationMongooseSchema, MEMBER_SCHEMA_VERSION, MemberModel, MemberMongooseSchema, ORGANIZATION_SCHEMA_VERSION, ORGANIZATION_SETTINGS_SCHEMA_VERSION, OrganizationModel, OrganizationMongooseSchema, PATIENT_ADDITIONAL_SCHEMA_VERSION, PATIENT_SCHEMA_VERSION, PAYER_SCHEMA_VERSION, PAYER_SETTINGS_SCHEMA_VERSION, PRACTITIONER_SCHEDULE_SCHEMA_VERSION, PRACTITIONER_SESSION_SCHEMA_VERSION, PatientAdditionalModel, PatientAdditionalMongooseSchema, PatientModel, PatientMongooseSchema, PayerModel, PayerMongooseSchema, PractitionerScheduleModel, PractitionerScheduleMongooseSchema, PractitionerSessionModel, PractitionerSessionMongooseSchema, QUEUE_EVENT_LOG_SCHEMA_VERSION, QUEUE_NUMBER_SCHEMA_VERSION, QUEUE_NUMBER_SETTINGS_SCHEMA_VERSION, QUEUE_SCHEMA_VERSION,
|
|
1806
|
+
export { ARTICLE_SCHEMA_VERSION, ASSIGNMENT_SCHEMA_VERSION, ArticleModel, ArticleMongooseSchema, AssignmentModel, AssignmentMongooseSchema, DEPARTMENT_SCHEMA_VERSION, DepartmentModel, DepartmentMongooseSchema, FACILITY_SCHEMA_VERSION, FACILITY_SETTINGS_SCHEMA_VERSION, FacilityModel, FacilityMongooseSchema, KSM_SCHEMA_VERSION, KsmModel, KsmMongooseSchema, LOCATION_SCHEMA_VERSION, LOCATION_SETTINGS_SCHEMA_VERSION, LocationModel, LocationMongooseSchema, MEMBER_SCHEMA_VERSION, MemberModel, MemberMongooseSchema, ORGANIZATION_SCHEMA_VERSION, ORGANIZATION_SETTINGS_SCHEMA_VERSION, OrganizationModel, OrganizationMongooseSchema, PATIENT_ADDITIONAL_SCHEMA_VERSION, PATIENT_SCHEMA_VERSION, PAYER_SCHEMA_VERSION, PAYER_SETTINGS_SCHEMA_VERSION, PRACTITIONER_SCHEDULE_SCHEMA_VERSION, PRACTITIONER_SESSION_SCHEMA_VERSION, PatientAdditionalModel, PatientAdditionalMongooseSchema, PatientModel, PatientMongooseSchema, PayerModel, PayerMongooseSchema, PractitionerScheduleModel, PractitionerScheduleMongooseSchema, PractitionerSessionModel, PractitionerSessionMongooseSchema, QUEUE_EVENT_LOG_SCHEMA_VERSION, QUEUE_NUMBER_SCHEMA_VERSION, QUEUE_NUMBER_SETTINGS_SCHEMA_VERSION, QUEUE_SCHEMA_VERSION, QueueEventLogModel, QueueEventLogMongooseSchema, QueueModel, QueueMongooseSchema, QueueNumberModel, QueueNumberMongooseSchema, STAFF_SCHEMA_VERSION, StaffModel, StaffMongooseSchema, UNIT_SCHEMA_VERSION, USER_SCHEMA_VERSION, USER_SETTINGS_SCHEMA_VERSION, UnitModel, UnitMongooseSchema, UserModel, UserMongooseSchema, addressSchema, apiResponseSchema, articleMinimalSchema, articlePartialSchema, articleSchema, assignmentMinimalSchema, assignmentPartialSchema, assignmentSchema, baseSchema, baseSchemaWithExpiredAt, codedConceptSchema, demographicSchema, departmentMinimalSchema, departmentPartialSchema, departmentSchema, facilityMinimalSchema, facilityPartialSchema, facilitySchema, facilitySettingsKVSchema, facilitySettingsSchema, ksmMinimalSchema, ksmPartialSchema, ksmSchema, locationMinimalSchema, locationPartialSchema, locationSchema, locationSettingsKVSchema, locationSettingsSchema, memberMinimalSchema, memberPartialSchema, memberSchema, metadataSchema, objectIdSchema, organizationMinimalSchema, organizationPartialSchema, organizationSchema, organizationSettingsKVSchema, organizationSettingsSchema, patientAdditionalMinimalSchema, patientAdditionalPartialSchema, patientAdditionalSchema, patientMinimalSchema, patientPartialSchema, patientSchema, payerMinimalSchema, payerPartialSchema, payerSchema, payerSettingsKVSchema, payerSettingsSchema, practitionerScheduleMinimalSchema, practitionerSchedulePartialSchema, practitionerScheduleSchema, practitionerSessionMinimalSchema, practitionerSessionPartialSchema, practitionerSessionSchema, queueEventLogMinimalSchema, queueEventLogPartialSchema, queueEventLogSchema, queueMinimalSchema, queueNumberMinimalSchema, queueNumberPartialSchema, queueNumberSchema, queueNumberSettingsKVSchema, queueNumberSettingsSchema, queuePartialSchema, queueSchema, settingOptionSchema, settingOptionTypeSchema, singleResourceResponseSchema, staffMinimalSchema, staffPartialSchema, staffSchema, timestampSchema, unitMinimalSchema, unitPartialSchema, unitSchema, userMinimalSchema, userPartialSchema, userSchema, userSettingsKVSchema, userSettingsSchema };
|
|
1819
1807
|
//# sourceMappingURL=index.mjs.map
|
|
1820
1808
|
//# sourceMappingURL=index.mjs.map
|