@centricare/contract 0.2.1 → 0.3.2

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 CHANGED
@@ -34,17 +34,50 @@ var singleResourceResponseSchema = (dataSchema) => apiResponseSchema(dataSchema)
34
34
  message: "Single resource response metadata must have total=1, offset=0, limit=0, next=null, previous=null"
35
35
  }
36
36
  );
37
+ var SETTING_OPTIONS_TYPE = [
38
+ // Single input
39
+ "string",
40
+ // Mapped to text input in client
41
+ "number",
42
+ // Mapped to number input in client
43
+ "boolean",
44
+ // Mapped to checkbox/switch in client
45
+ "date",
46
+ // Mapped date picker in client
47
+ "datetime",
48
+ // Mapped datetime picker in client
49
+ "daterange",
50
+ // Mapped date range picker in client
51
+ "image",
52
+ // Mapped to file input (single image only) in client
53
+ // Multiple input
54
+ "strings",
55
+ // Mapped to nested array text input in client
56
+ "numbers",
57
+ // Mapped to nested array number input in client
58
+ "images",
59
+ // Mapped to file input (multiple image) in client
60
+ "keyvals"
61
+ // Mapped to nested array text input pair in client
62
+ ];
37
63
  var settingOptionTypeSchema = z5.z.union([
38
- z5.z.enum(["string", "number", "boolean", "date"]),
39
- z5.z.array(z5.z.enum(["string", "number", "boolean", "date"])),
40
- z5.z.string()
64
+ z5.z.enum(SETTING_OPTIONS_TYPE),
65
+ z5.z.string(),
66
+ z5.z.string().array()
41
67
  ]);
42
68
  var settingOptionSchema = z5.z.object({
43
69
  field: z5.z.string().min(1, { message: "field is required" }),
44
70
  label: z5.z.string().optional(),
45
71
  type: settingOptionTypeSchema,
46
72
  default: z5.z.string().nullable(),
47
- value: z5.z.union([z5.z.string(), z5.z.boolean(), z5.z.number()]).nullable()
73
+ value: z5.z.union([
74
+ z5.z.string(),
75
+ z5.z.boolean(),
76
+ z5.z.number(),
77
+ z5.z.string().array(),
78
+ z5.z.number().array(),
79
+ z5.z.object({ key: z5.z.string(), value: z5.z.string() })
80
+ ]).nullable()
48
81
  });
49
82
 
50
83
  // src/registry/registry.json
@@ -966,11 +999,11 @@ var codedConceptSchema = z5.z.object({
966
999
  });
967
1000
  var demographicSchema = z5__default.default.object({
968
1001
  sex: codedConceptSchema,
969
- religion: codedConceptSchema,
970
- ethnicity: z5__default.default.string().optional(),
971
- marital_status: codedConceptSchema,
972
- date_of_birth: z5__default.default.string(),
973
- place_of_birth: z5__default.default.string().optional()
1002
+ religion: codedConceptSchema.nullable(),
1003
+ ethnicity: z5__default.default.string().nullable(),
1004
+ marital_status: codedConceptSchema.nullable(),
1005
+ date_of_birth: z5__default.default.string().nullable(),
1006
+ place_of_birth: z5__default.default.string().nullable()
974
1007
  });
975
1008
  var addressSchema = z5.z.object({
976
1009
  street: z5.z.string().min(1, { message: "street is required" }),
@@ -985,6 +1018,23 @@ var objectIdSchema = z5.z.string().length(24, {
985
1018
  }).regex(/^[0-9a-fA-F]{24}$/, {
986
1019
  message: "ObjectId must be a valid MongoDB ObjectId (24-character hex string)"
987
1020
  });
1021
+ var baseSchema = (version) => z5.z.object({
1022
+ _id: objectIdSchema,
1023
+ created_at: timestampSchema,
1024
+ created_by: z5.z.string().min(1, { message: "created_by is required" }),
1025
+ updated_at: timestampSchema,
1026
+ updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1027
+ schema_version: z5.z.number().int().positive().default(version)
1028
+ });
1029
+ var baseSchemaWithExpiredAt = (version) => z5.z.object({
1030
+ _id: objectIdSchema,
1031
+ created_at: timestampSchema,
1032
+ created_by: z5.z.string().min(1, { message: "created_by is required" }),
1033
+ updated_at: timestampSchema,
1034
+ updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1035
+ expired_at: timestampSchema,
1036
+ schema_version: z5.z.number().int().positive().default(version)
1037
+ });
988
1038
  var USER_SCHEMA_VERSION = 1;
989
1039
  var userSchema = z5.z.object({
990
1040
  id: z5.z.string(),
@@ -1046,25 +1096,23 @@ var userMinimalSchema = userSchema.omit({
1046
1096
 
1047
1097
  // src/models/user/user-partial.schema.ts
1048
1098
  var userPartialSchema = userMinimalSchema.partial();
1049
- var nonEmpty = z5.z.string().min(1, { message: "assigned_to is required" });
1050
1099
  var ASSIGNMENT_SCHEMA_VERSION = 1;
1051
- var assignmentSchema = z5.z.object({
1052
- _id: objectIdSchema,
1100
+ var assignmentSchema = baseSchema(ASSIGNMENT_SCHEMA_VERSION).extend({
1053
1101
  facility_id: objectIdSchema,
1054
1102
  type: codedConceptSchema,
1055
1103
  for: z5.z.string().min(1, { message: "for is required" }),
1056
- assigned_to: z5.z.union([nonEmpty, z5.z.array(nonEmpty)]).transform((val) => Array.isArray(val) ? val : [val]).refine((arr) => arr.length >= 1, {
1057
- message: "assigned_to is required"
1058
- }),
1059
- created_at: z5.z.string(),
1060
- created_by: z5.z.string(),
1061
- updated_at: z5.z.string(),
1062
- updated_by: z5.z.string(),
1063
- schema_version: z5.z.number().int().positive().default(ASSIGNMENT_SCHEMA_VERSION)
1104
+ assigned_to: z5.z.array(
1105
+ z5.z.string().min(1, {
1106
+ message: "assigned_to is required"
1107
+ })
1108
+ ).min(1)
1064
1109
  });
1065
1110
  var AssignmentMongooseSchema = zodMongoose.toMongooseSchema(assignmentSchema);
1066
1111
  var AssignmentModelName = "assignments";
1067
- var AssignmentModel = mongoose.model(AssignmentModelName, AssignmentMongooseSchema);
1112
+ var AssignmentModel = mongoose.model(
1113
+ AssignmentModelName,
1114
+ AssignmentMongooseSchema
1115
+ );
1068
1116
 
1069
1117
  // src/models/assignment/assignment-minimal.schema.ts
1070
1118
  var assignmentMinimalSchema = assignmentSchema.omit({
@@ -1079,16 +1127,10 @@ var assignmentMinimalSchema = assignmentSchema.omit({
1079
1127
  // src/models/assignment/assignment-partial.schema.ts
1080
1128
  var assignmentPartialSchema = assignmentMinimalSchema.partial();
1081
1129
  var DEPARTMENT_SCHEMA_VERSION = 1;
1082
- var departmentSchema = z5.z.object({
1083
- _id: objectIdSchema,
1130
+ var departmentSchema = baseSchema(DEPARTMENT_SCHEMA_VERSION).extend({
1084
1131
  facility_id: objectIdSchema,
1085
1132
  name: z5.z.string().min(1, { message: "name is required" }),
1086
- type: codedConceptSchema,
1087
- created_at: z5.z.string(),
1088
- created_by: z5.z.string(),
1089
- updated_at: z5.z.string(),
1090
- updated_by: z5.z.string(),
1091
- schema_version: z5.z.number().int().positive().default(DEPARTMENT_SCHEMA_VERSION)
1133
+ type: codedConceptSchema
1092
1134
  });
1093
1135
  var DepartmentMongooseSchema = zodMongoose.toMongooseSchema(departmentSchema);
1094
1136
  var DepartmentModelName = "departments";
@@ -1125,10 +1167,15 @@ var FACILITY_SETTING_FIELDS = [
1125
1167
  "satusehat_org_id",
1126
1168
  "satusehat_client_id",
1127
1169
  "satusehat_client_secret",
1170
+ "queue_number_length",
1128
1171
  "queue_number_separator",
1129
- "queue_number_prefix",
1130
- "queue_no_response_count",
1131
- "queue_skip_no_response"
1172
+ "queue_call_threshold",
1173
+ "queue_call_priority",
1174
+ "kiosk_announcements",
1175
+ "kiosk_gallery",
1176
+ "kiosk_faq",
1177
+ "kiosk_services",
1178
+ "payer_types"
1132
1179
  ];
1133
1180
  var FACILITY_SETTINGS_SCHEMA_VERSION = 1;
1134
1181
  var facilitySettingsSchema = z5.z.object({
@@ -1145,14 +1192,21 @@ var facilitySettingsSchema = z5.z.object({
1145
1192
  schema_version: z5.z.number().int().positive().default(FACILITY_SETTINGS_SCHEMA_VERSION)
1146
1193
  });
1147
1194
  var facilitySettingsKVSchema = z5.z.object({
1148
- branding_logo: z5.z.string().optional(),
1149
- satusehat_org_id: z5.z.string().optional(),
1150
- satusehat_client_id: z5.z.string().optional(),
1151
- satusehat_client_secret: z5.z.string().optional(),
1152
- queue_number_separator: z5.z.string().optional(),
1153
- queue_number_prefix: z5.z.enum(["none", "payer"]).default("payer"),
1154
- queue_no_response_count: z5.z.number().default(3),
1155
- queue_skip_no_response: z5.z.boolean().default(true)
1195
+ branding_logo: z5.z.string().nullable(),
1196
+ satusehat_org_id: z5.z.string().nullable(),
1197
+ satusehat_client_id: z5.z.string().nullable(),
1198
+ satusehat_client_secret: z5.z.string().nullable(),
1199
+ queue_number_length: z5.z.number().int().positive().nullable().default(3),
1200
+ queue_number_separator: z5.z.string().nullable(),
1201
+ queue_call_priority: z5.z.string().default("sequence").refine((data) => validateCode("crn:queue:priority", data), {
1202
+ message: "Invalid CodedConcept: system/value combination not found in registry"
1203
+ }),
1204
+ queue_call_threshold: z5.z.number().int().positive().default(3),
1205
+ kiosk_announcements: z5.z.string().array(),
1206
+ kiosk_gallery: z5.z.url().array(),
1207
+ kiosk_faq: z5.z.object({ key: z5.z.string(), value: z5.z.string() }).array(),
1208
+ kiosk_services: z5.z.object({ key: z5.z.string(), value: z5.z.string() }).array(),
1209
+ payer_types: z5.z.string().array()
1156
1210
  });
1157
1211
 
1158
1212
  // src/models/facility/facility-minimal.schema.ts
@@ -1165,8 +1219,7 @@ var facilityMinimalSchema = facilitySchema.omit({
1165
1219
  // src/models/facility/facility-partial.schema.ts
1166
1220
  var facilityPartialSchema = facilityMinimalSchema.partial();
1167
1221
  var LOCATION_SCHEMA_VERSION = 1;
1168
- var locationSchema = z5.z.object({
1169
- _id: objectIdSchema,
1222
+ var locationSchema = baseSchema(LOCATION_SCHEMA_VERSION).extend({
1170
1223
  parent_id: objectIdSchema,
1171
1224
  identifiers: z5.z.array(codedConceptSchema).nonempty({
1172
1225
  message: "identifiers must contain at least one CodedConcept"
@@ -1178,12 +1231,7 @@ var locationSchema = z5.z.object({
1178
1231
  statuses: z5.z.array(codedConceptSchema).nonempty({
1179
1232
  message: "statuses must contain at least one CodedConcept"
1180
1233
  }),
1181
- settings_id: objectIdSchema,
1182
- created_at: timestampSchema,
1183
- created_by: z5.z.string(),
1184
- updated_at: timestampSchema,
1185
- updated_by: z5.z.string(),
1186
- schema_version: z5.z.number().int().positive().default(LOCATION_SCHEMA_VERSION)
1234
+ settings_id: objectIdSchema
1187
1235
  });
1188
1236
  var LocationMongooseSchema = zodMongoose.toMongooseSchema(locationSchema);
1189
1237
  var LocationModelName = "locations";
@@ -1219,7 +1267,8 @@ var locationMinimalSchema = locationSchema.omit({
1219
1267
  created_at: true,
1220
1268
  created_by: true,
1221
1269
  updated_at: true,
1222
- updated_by: true
1270
+ updated_by: true,
1271
+ schema_version: true
1223
1272
  });
1224
1273
 
1225
1274
  // src/models/location/location-partial.schema.ts
@@ -1294,28 +1343,26 @@ var organizationMinimalSchema = organizationSchema.omit({
1294
1343
  // src/models/organization/organization-partial.schema.ts
1295
1344
  var organizationPartialSchema = organizationMinimalSchema.partial();
1296
1345
  var PATIENT_SCHEMA_VERSION = 1;
1297
- var patientSchema = z5.z.object({
1298
- _id: objectIdSchema,
1346
+ var patientSchema = baseSchema(PATIENT_SCHEMA_VERSION).extend({
1299
1347
  organization_id: objectIdSchema,
1300
1348
  registering_facility_id: objectIdSchema,
1301
1349
  identifiers: z5.z.array(codedConceptSchema),
1302
- salutation: z5.z.string().min(1, { message: "salutation is required" }),
1350
+ salutation: codedConceptSchema,
1303
1351
  first_name: z5.z.string().min(1, { message: "first_name is required" }),
1304
1352
  middle_name: z5.z.string().optional(),
1305
1353
  last_name: z5.z.string().min(1, { message: "last_name is required" }),
1306
1354
  title: z5.z.string().optional(),
1307
1355
  image: z5.z.string().optional(),
1308
- demographic: demographicSchema,
1356
+ demographic: demographicSchema.extend({
1357
+ place_of_birth: demographicSchema.shape.place_of_birth.unwrap(),
1358
+ date_of_birth: demographicSchema.shape.date_of_birth.unwrap(),
1359
+ marital_status: demographicSchema.shape.marital_status.unwrap()
1360
+ }),
1309
1361
  statuses: z5.z.array(codedConceptSchema).nonempty({
1310
1362
  message: "statuses must contain at least one CodedConcept"
1311
1363
  }),
1312
1364
  contacts: z5.z.array(codedConceptSchema).optional(),
1313
- address: addressSchema,
1314
- created_at: timestampSchema,
1315
- created_by: z5.z.string(),
1316
- updated_at: timestampSchema,
1317
- updated_by: z5.z.string(),
1318
- schema_version: z5.z.number().int().positive().default(PATIENT_SCHEMA_VERSION)
1365
+ address: addressSchema
1319
1366
  });
1320
1367
  var PatientMongooseSchema = zodMongoose.toMongooseSchema(patientSchema);
1321
1368
  var PatientModelName = "patients";
@@ -1334,16 +1381,10 @@ var patientMinimalSchema = patientSchema.omit({
1334
1381
  // src/models/patient/patient-partial.schema.ts
1335
1382
  var patientPartialSchema = patientMinimalSchema.partial();
1336
1383
  var PATIENT_ADDITIONAL_SCHEMA_VERSION = 1;
1337
- var patientAdditionalSchema = z5.z.object({
1338
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1384
+ var patientAdditionalSchema = baseSchema(PATIENT_ADDITIONAL_SCHEMA_VERSION).extend({
1339
1385
  patient_id: objectIdSchema,
1340
1386
  type: codedConceptSchema,
1341
- data: z5.z.union([z5.z.object({}), z5.z.array(z5.z.any())]),
1342
- created_at: timestampSchema,
1343
- created_by: z5.z.string(),
1344
- updated_at: timestampSchema,
1345
- updated_by: z5.z.string(),
1346
- schema_version: z5.z.number().int().positive().default(PATIENT_ADDITIONAL_SCHEMA_VERSION)
1387
+ data: z5.z.union([z5.z.object({}), z5.z.array(z5.z.any())])
1347
1388
  });
1348
1389
  var PatientAdditionalMongooseSchema = zodMongoose.toMongooseSchema(patientAdditionalSchema);
1349
1390
  var PatientAdditionalModelName = "patient_additionals";
@@ -1351,7 +1392,7 @@ var PatientAdditionalModel = mongoose.model(PatientAdditionalModelName, PatientA
1351
1392
 
1352
1393
  // src/models/patient-additional/patient-additional-minimal.schema.ts
1353
1394
  var patientAdditionalMinimalSchema = patientAdditionalSchema.omit({
1354
- id: true,
1395
+ _id: true,
1355
1396
  created_at: true,
1356
1397
  created_by: true,
1357
1398
  updated_at: true,
@@ -1362,20 +1403,14 @@ var patientAdditionalMinimalSchema = patientAdditionalSchema.omit({
1362
1403
  // src/models/patient-additional/patient-additional-partial.schema.ts
1363
1404
  var patientAdditionalPartialSchema = patientAdditionalMinimalSchema.partial();
1364
1405
  var STAFF_SCHEMA_VERSION = 1;
1365
- var staffSchema = z5.z.object({
1366
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1406
+ var staffSchema = baseSchema(STAFF_SCHEMA_VERSION).extend({
1367
1407
  team_id: objectIdSchema,
1368
1408
  user_id: objectIdSchema,
1369
1409
  type: codedConceptSchema,
1370
1410
  status: codedConceptSchema,
1371
1411
  membership_key: z5.z.string().optional(),
1372
1412
  group: z5.z.string().optional(),
1373
- subspecialist: z5.z.string().optional(),
1374
- created_at: timestampSchema,
1375
- created_by: z5.z.string(),
1376
- updated_at: timestampSchema,
1377
- updated_by: z5.z.string(),
1378
- schema_version: z5.z.number().int().positive().default(STAFF_SCHEMA_VERSION)
1413
+ subspecialist: z5.z.string().optional()
1379
1414
  });
1380
1415
  var StaffMongooseSchema = zodMongoose.toMongooseSchema(staffSchema);
1381
1416
  var StaffModelName = "staffs";
@@ -1383,7 +1418,7 @@ var StaffModel = mongoose.model(StaffModelName, StaffMongooseSchema);
1383
1418
 
1384
1419
  // src/models/staff/staff-minimal.schema.ts
1385
1420
  var staffMinimalSchema = staffSchema.omit({
1386
- id: true,
1421
+ _id: true,
1387
1422
  created_at: true,
1388
1423
  created_by: true,
1389
1424
  updated_at: true,
@@ -1394,8 +1429,7 @@ var staffMinimalSchema = staffSchema.omit({
1394
1429
  // src/models/staff/staff-partial.schema.ts
1395
1430
  var staffPartialSchema = staffMinimalSchema.partial();
1396
1431
  var UNIT_SCHEMA_VERSION = 1;
1397
- var unitSchema = z5.z.object({
1398
- _id: objectIdSchema,
1432
+ var unitSchema = baseSchema(UNIT_SCHEMA_VERSION).extend({
1399
1433
  facility_id: objectIdSchema,
1400
1434
  department_id: objectIdSchema,
1401
1435
  name: z5.z.string().min(1, { message: "name is required" }),
@@ -1404,12 +1438,7 @@ var unitSchema = z5.z.object({
1404
1438
  statuses: z5.z.array(codedConceptSchema).nonempty({
1405
1439
  message: "statuses must contain at least one CodedConcept"
1406
1440
  }),
1407
- settings_id: objectIdSchema,
1408
- created_at: timestampSchema,
1409
- created_by: z5.z.string(),
1410
- updated_at: timestampSchema,
1411
- updated_by: z5.z.string(),
1412
- schema_version: z5.z.number().int().positive().default(UNIT_SCHEMA_VERSION)
1441
+ settings_id: objectIdSchema
1413
1442
  });
1414
1443
  var UnitMongooseSchema = zodMongoose.toMongooseSchema(unitSchema);
1415
1444
  var UnitModelName = "units";
@@ -1428,19 +1457,15 @@ var unitMinimalSchema = unitSchema.omit({
1428
1457
  // src/models/unit/unit-partial.schema.ts
1429
1458
  var unitPartialSchema = unitMinimalSchema.partial();
1430
1459
  var PRACTITIONER_SCHEDULE_SCHEMA_VERSION = 1;
1431
- var practitionerScheduleSchema = z5.z.object({
1460
+ var practitionerScheduleSchema = baseSchema(
1461
+ PRACTITIONER_SCHEDULE_SCHEMA_VERSION
1462
+ ).extend({
1432
1463
  organization_id: objectIdSchema,
1433
1464
  facility_id: objectIdSchema,
1434
1465
  staff_id: objectIdSchema,
1435
1466
  unit_id: objectIdSchema,
1436
1467
  type: codedConceptSchema,
1437
- day: z5.z.union([z5.z.number(), z5.z.string()]).refine((val) => val != null, { message: "day is required" }),
1438
- _id: objectIdSchema,
1439
- created_at: timestampSchema.optional(),
1440
- created_by: z5.z.string().optional(),
1441
- updated_at: timestampSchema.optional(),
1442
- updated_by: z5.z.string().optional(),
1443
- schema_version: z5.z.number().int().positive().default(PRACTITIONER_SCHEDULE_SCHEMA_VERSION)
1468
+ day: z5.z.union([z5.z.number(), z5.z.string()]).refine((val) => val != null, { message: "day is required" })
1444
1469
  });
1445
1470
  var PractitionerScheduleMongooseSchema = zodMongoose.toMongooseSchema(practitionerScheduleSchema);
1446
1471
  var PractitionerScheduleModelName = "practitioner_schedules";
@@ -1459,19 +1484,15 @@ var practitionerScheduleMinimalSchema = practitionerScheduleSchema.omit({
1459
1484
  // src/models/practitioner-schedule/practitioner-schedule-partial.schema.ts
1460
1485
  var practitionerSchedulePartialSchema = practitionerScheduleMinimalSchema.partial();
1461
1486
  var PRACTITIONER_SESSION_SCHEMA_VERSION = 1;
1462
- var practitionerSessionSchema = z5.z.object({
1487
+ var practitionerSessionSchema = baseSchema(
1488
+ PRACTITIONER_SESSION_SCHEMA_VERSION
1489
+ ).extend({
1463
1490
  schedule_id: objectIdSchema,
1464
1491
  staff_id: objectIdSchema,
1465
1492
  unit_id: objectIdSchema,
1466
1493
  start: z5.z.string().min(1, { message: "start is required" }),
1467
1494
  end: z5.z.string().min(1, { message: "end is required" }),
1468
- max_quota: z5.z.number().int().positive({ message: "max_quota must be a positive integer" }),
1469
- _id: objectIdSchema,
1470
- created_at: timestampSchema.optional(),
1471
- created_by: z5.z.string().optional(),
1472
- updated_at: timestampSchema.optional(),
1473
- updated_by: z5.z.string().optional(),
1474
- schema_version: z5.z.number().int().positive().default(PRACTITIONER_SESSION_SCHEMA_VERSION)
1495
+ max_quota: z5.z.number().int().positive({ message: "max_quota must be a positive integer" })
1475
1496
  });
1476
1497
  var PractitionerSessionMongooseSchema = zodMongoose.toMongooseSchema(practitionerSessionSchema);
1477
1498
  var PractitionerSessionModelName = "practitioner_sessions";
@@ -1490,17 +1511,11 @@ var practitionerSessionMinimalSchema = practitionerSessionSchema.omit({
1490
1511
  // src/models/practitioner-session/practitioner-session-partial.schema.ts
1491
1512
  var practitionerSessionPartialSchema = practitionerSessionMinimalSchema.partial();
1492
1513
  var KSM_SCHEMA_VERSION = 1;
1493
- var ksmSchema = z5.z.object({
1494
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1514
+ var ksmSchema = baseSchema(KSM_SCHEMA_VERSION).extend({
1495
1515
  organization_id: objectIdSchema,
1496
1516
  facility_id: objectIdSchema,
1497
1517
  name: z5.z.string().min(1, { message: "name is required" }),
1498
- subspecialist: z5.z.array(z5.z.string()).min(1, { message: "subspecialist is required" }),
1499
- created_at: timestampSchema,
1500
- created_by: z5.z.string().min(1, { message: "created_by is required" }),
1501
- updated_at: timestampSchema.nullable(),
1502
- updated_by: z5.z.string().nullable(),
1503
- schema_version: z5.z.number().int().positive().default(KSM_SCHEMA_VERSION)
1518
+ subspecialist: z5.z.array(z5.z.string()).min(1, { message: "subspecialist is required" })
1504
1519
  });
1505
1520
  var KsmMongooseSchema = zodMongoose.toMongooseSchema(ksmSchema);
1506
1521
  var KsmModelName = "medical_staff_groups";
@@ -1508,7 +1523,7 @@ var KsmModel = mongoose.model(KsmModelName, KsmMongooseSchema);
1508
1523
 
1509
1524
  // src/models/ksm/ksm-minimal.schema.ts
1510
1525
  var ksmMinimalSchema = ksmSchema.omit({
1511
- id: true,
1526
+ _id: true,
1512
1527
  created_at: true,
1513
1528
  created_by: true,
1514
1529
  updated_at: true,
@@ -1520,8 +1535,7 @@ var ksmMinimalSchema = ksmSchema.omit({
1520
1535
  var ksmPartialSchema = ksmMinimalSchema.partial();
1521
1536
  var isoDatetimeRegex3 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})$/;
1522
1537
  var PAYER_SCHEMA_VERSION = 1;
1523
- var payerSchema = z5.z.object({
1524
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1538
+ var payerSchema = baseSchema(PAYER_SCHEMA_VERSION).extend({
1525
1539
  organization_id: objectIdSchema,
1526
1540
  facility_id: objectIdSchema,
1527
1541
  code: z5.z.string().min(1, { message: "code is required" }),
@@ -1556,12 +1570,7 @@ var payerSchema = z5.z.object({
1556
1570
  ),
1557
1571
  settings_id: objectIdSchema
1558
1572
  })
1559
- ),
1560
- created_at: timestampSchema,
1561
- created_by: z5.z.string().min(1, { message: "created_by is required" }),
1562
- updated_at: timestampSchema,
1563
- updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1564
- schema_version: z5.z.number().int().positive().default(PAYER_SCHEMA_VERSION)
1573
+ )
1565
1574
  });
1566
1575
  var PayerMongooseSchema = zodMongoose.toMongooseSchema(payerSchema);
1567
1576
  var PayerModelName = "payers";
@@ -1619,7 +1628,7 @@ var payerSettingsKVSchema = z5.z.object({
1619
1628
 
1620
1629
  // src/models/payer/payer-minimal.schema.ts
1621
1630
  var payerMinimalSchema = payerSchema.omit({
1622
- id: true,
1631
+ _id: true,
1623
1632
  created_at: true,
1624
1633
  created_by: true,
1625
1634
  updated_at: true,
@@ -1630,8 +1639,7 @@ var payerMinimalSchema = payerSchema.omit({
1630
1639
  // src/models/payer/payer-partial.schema.ts
1631
1640
  var payerPartialSchema = payerMinimalSchema.partial();
1632
1641
  var QUEUE_SCHEMA_VERSION = 1;
1633
- var queueSchema = z5.z.object({
1634
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1642
+ var queueSchema = baseSchema(QUEUE_SCHEMA_VERSION).extend({
1635
1643
  organization_id: objectIdSchema,
1636
1644
  facility_id: objectIdSchema,
1637
1645
  unit_id: objectIdSchema,
@@ -1644,46 +1652,15 @@ var queueSchema = z5.z.object({
1644
1652
  status: codedConceptSchema,
1645
1653
  call_count: z5.z.number().int().positive({ message: "call_count must be a positive integer" })
1646
1654
  })
1647
- ),
1648
- created_at: timestampSchema,
1649
- created_by: z5.z.string().min(1, { message: "created_by is required" }),
1650
- updated_at: timestampSchema,
1651
- updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1652
- schema_version: z5.z.number().int().positive().default(QUEUE_SCHEMA_VERSION)
1655
+ )
1653
1656
  });
1654
1657
  var QueueMongooseSchema = zodMongoose.toMongooseSchema(queueSchema);
1655
1658
  var QueueModelName = "queues";
1656
1659
  var QueueModel = mongoose.model(QueueModelName, QueueMongooseSchema);
1657
- var QUEUE_SETTING_FIELDS = [
1658
- "number_length",
1659
- "call_priority",
1660
- "call_threshold"
1661
- ];
1662
- var QUEUE_SETTINGS_SCHEMA_VERSION = 1;
1663
- var queueSettingsSchema = z5.z.object({
1664
- _id: objectIdSchema,
1665
- scope: z5.z.string().min(1),
1666
- options: z5.z.array(
1667
- settingOptionSchema.refine(
1668
- (opt) => QUEUE_SETTING_FIELDS.includes(opt.field),
1669
- { message: "Invalid field for queue settings" }
1670
- )
1671
- ),
1672
- updated_at: timestampSchema,
1673
- updated_by: z5.z.string(),
1674
- schema_version: z5.z.number().int().positive().default(QUEUE_SETTINGS_SCHEMA_VERSION)
1675
- });
1676
- var queueSettingsKVSchema = z5.z.object({
1677
- number_length: z5.z.number().int().positive().nullable().default(null),
1678
- call_priority: z5.z.string().default("sequence"),
1679
- call_threshold: z5.z.number().int().positive().default(3)
1680
- }).refine((data) => validateCode("crn:queue:priority", data.call_priority), {
1681
- message: "Invalid CodedConcept: system/value combination not found in registry"
1682
- });
1683
1660
 
1684
1661
  // src/models/queue/queue-minimal.schema.ts
1685
1662
  var queueMinimalSchema = queueSchema.omit({
1686
- id: true,
1663
+ _id: true,
1687
1664
  created_at: true,
1688
1665
  created_by: true,
1689
1666
  updated_at: true,
@@ -1694,17 +1671,11 @@ var queueMinimalSchema = queueSchema.omit({
1694
1671
  // src/models/queue/queue-partial.schema.ts
1695
1672
  var queuePartialSchema = queueMinimalSchema.partial();
1696
1673
  var QUEUE_EVENT_LOG_SCHEMA_VERSION = 1;
1697
- var queueEventLogSchema = z5.z.object({
1698
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1674
+ var queueEventLogSchema = baseSchema(QUEUE_EVENT_LOG_SCHEMA_VERSION).extend({
1699
1675
  queue_number_id: objectIdSchema,
1700
1676
  queue_number: z5.z.string().min(1, { message: "queue_number is required" }),
1701
1677
  events: z5.z.array(codedConceptSchema),
1702
- count: z5.z.number().int().positive({ message: "count must be a positive integer" }),
1703
- created_at: timestampSchema,
1704
- created_by: z5.z.string().min(1, { message: "created_by is required" }),
1705
- updated_at: timestampSchema,
1706
- updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1707
- schema_version: z5.z.number().int().positive().default(QUEUE_EVENT_LOG_SCHEMA_VERSION)
1678
+ count: z5.z.number().int().positive({ message: "count must be a positive integer" })
1708
1679
  });
1709
1680
  var QueueEventLogMongooseSchema = zodMongoose.toMongooseSchema(queueEventLogSchema);
1710
1681
  var QueueEventLogModelName = "queue_event_logs";
@@ -1712,7 +1683,7 @@ var QueueEventLogModel = mongoose.model(QueueEventLogModelName, QueueEventLogMon
1712
1683
 
1713
1684
  // src/models/queue-event-log/queue-event-log-minimal.schema.ts
1714
1685
  var queueEventLogMinimalSchema = queueEventLogSchema.omit({
1715
- id: true,
1686
+ _id: true,
1716
1687
  created_at: true,
1717
1688
  created_by: true,
1718
1689
  updated_at: true,
@@ -1724,8 +1695,9 @@ var queueEventLogMinimalSchema = queueEventLogSchema.omit({
1724
1695
  var queueEventLogPartialSchema = queueEventLogMinimalSchema.partial();
1725
1696
  var isoDatetimeRegex4 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})$/;
1726
1697
  var QUEUE_NUMBER_SCHEMA_VERSION = 1;
1727
- var queueNumberSchema = z5.z.object({
1728
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1698
+ var queueNumberSchema = baseSchemaWithExpiredAt(
1699
+ QUEUE_NUMBER_SCHEMA_VERSION
1700
+ ).extend({
1729
1701
  organization_id: objectIdSchema,
1730
1702
  facility_id: objectIdSchema,
1731
1703
  patient_id: objectIdSchema,
@@ -1740,15 +1712,7 @@ var queueNumberSchema = z5.z.object({
1740
1712
  }),
1741
1713
  sequence: z5.z.number().int().positive({ message: "sequence must be a positive integer" }),
1742
1714
  prefix: z5.z.string().min(1, { message: "prefix is required" }),
1743
- number: z5.z.string().min(1, { message: "number is required" }),
1744
- created_at: timestampSchema,
1745
- created_by: z5.z.string().min(1, { message: "created_by is required" }),
1746
- updated_at: timestampSchema,
1747
- updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1748
- expired_at: z5.z.string().refine((val) => isoDatetimeRegex4.test(val), {
1749
- message: "expired_at must be a valid ISO 8601 datetime"
1750
- }),
1751
- schema_version: z5.z.number().int().positive().default(QUEUE_NUMBER_SCHEMA_VERSION)
1715
+ number: z5.z.string().min(1, { message: "number is required" })
1752
1716
  });
1753
1717
  var QueueNumberMongooseSchema = zodMongoose.toMongooseSchema(queueNumberSchema);
1754
1718
  var QueueNumberModelName = "queue_numbers";
@@ -1809,7 +1773,7 @@ var queueNumberSettingsKVSchema = z5.z.object({
1809
1773
 
1810
1774
  // src/models/queue-number/queue-number-minimal.schema.ts
1811
1775
  var queueNumberMinimalSchema = queueNumberSchema.omit({
1812
- id: true,
1776
+ _id: true,
1813
1777
  created_at: true,
1814
1778
  created_by: true,
1815
1779
  updated_at: true,
@@ -1820,8 +1784,35 @@ var queueNumberMinimalSchema = queueNumberSchema.omit({
1820
1784
 
1821
1785
  // src/models/queue-number/queue-number-partial.schema.ts
1822
1786
  var queueNumberPartialSchema = queueNumberMinimalSchema.partial();
1787
+ var ARTICLE_SCHEMA_VERSION = 1;
1788
+ var articleSchema = baseSchema(ARTICLE_SCHEMA_VERSION).extend({
1789
+ facility_id: objectIdSchema,
1790
+ title: z5.z.string().min(1, { message: "for is required" }),
1791
+ banner: z5.z.url(),
1792
+ body: z5.z.string(),
1793
+ status: codedConceptSchema
1794
+ });
1795
+ var ArticleMongooseSchema = zodMongoose.toMongooseSchema(articleSchema);
1796
+ var ArticleModelName = "articles";
1797
+ var ArticleModel = mongoose.model(ArticleModelName, ArticleMongooseSchema);
1798
+
1799
+ // src/models/article/article-minimal.schema.ts
1800
+ var articleMinimalSchema = articleSchema.omit({
1801
+ _id: true,
1802
+ created_at: true,
1803
+ created_by: true,
1804
+ updated_at: true,
1805
+ updated_by: true,
1806
+ schema_version: true
1807
+ });
1808
+
1809
+ // src/models/article/article-partial.schema.ts
1810
+ var articlePartialSchema = articleMinimalSchema.partial();
1823
1811
 
1812
+ exports.ARTICLE_SCHEMA_VERSION = ARTICLE_SCHEMA_VERSION;
1824
1813
  exports.ASSIGNMENT_SCHEMA_VERSION = ASSIGNMENT_SCHEMA_VERSION;
1814
+ exports.ArticleModel = ArticleModel;
1815
+ exports.ArticleMongooseSchema = ArticleMongooseSchema;
1825
1816
  exports.AssignmentModel = AssignmentModel;
1826
1817
  exports.AssignmentMongooseSchema = AssignmentMongooseSchema;
1827
1818
  exports.DEPARTMENT_SCHEMA_VERSION = DEPARTMENT_SCHEMA_VERSION;
@@ -1865,7 +1856,6 @@ exports.QUEUE_EVENT_LOG_SCHEMA_VERSION = QUEUE_EVENT_LOG_SCHEMA_VERSION;
1865
1856
  exports.QUEUE_NUMBER_SCHEMA_VERSION = QUEUE_NUMBER_SCHEMA_VERSION;
1866
1857
  exports.QUEUE_NUMBER_SETTINGS_SCHEMA_VERSION = QUEUE_NUMBER_SETTINGS_SCHEMA_VERSION;
1867
1858
  exports.QUEUE_SCHEMA_VERSION = QUEUE_SCHEMA_VERSION;
1868
- exports.QUEUE_SETTINGS_SCHEMA_VERSION = QUEUE_SETTINGS_SCHEMA_VERSION;
1869
1859
  exports.QueueEventLogModel = QueueEventLogModel;
1870
1860
  exports.QueueEventLogMongooseSchema = QueueEventLogMongooseSchema;
1871
1861
  exports.QueueModel = QueueModel;
@@ -1884,9 +1874,14 @@ exports.UserModel = UserModel;
1884
1874
  exports.UserMongooseSchema = UserMongooseSchema;
1885
1875
  exports.addressSchema = addressSchema;
1886
1876
  exports.apiResponseSchema = apiResponseSchema;
1877
+ exports.articleMinimalSchema = articleMinimalSchema;
1878
+ exports.articlePartialSchema = articlePartialSchema;
1879
+ exports.articleSchema = articleSchema;
1887
1880
  exports.assignmentMinimalSchema = assignmentMinimalSchema;
1888
1881
  exports.assignmentPartialSchema = assignmentPartialSchema;
1889
1882
  exports.assignmentSchema = assignmentSchema;
1883
+ exports.baseSchema = baseSchema;
1884
+ exports.baseSchemaWithExpiredAt = baseSchemaWithExpiredAt;
1890
1885
  exports.codedConceptSchema = codedConceptSchema;
1891
1886
  exports.demographicSchema = demographicSchema;
1892
1887
  exports.departmentMinimalSchema = departmentMinimalSchema;
@@ -1943,8 +1938,6 @@ exports.queueNumberSettingsKVSchema = queueNumberSettingsKVSchema;
1943
1938
  exports.queueNumberSettingsSchema = queueNumberSettingsSchema;
1944
1939
  exports.queuePartialSchema = queuePartialSchema;
1945
1940
  exports.queueSchema = queueSchema;
1946
- exports.queueSettingsKVSchema = queueSettingsKVSchema;
1947
- exports.queueSettingsSchema = queueSettingsSchema;
1948
1941
  exports.settingOptionSchema = settingOptionSchema;
1949
1942
  exports.settingOptionTypeSchema = settingOptionTypeSchema;
1950
1943
  exports.singleResourceResponseSchema = singleResourceResponseSchema;