@7365admin1/core 3.32.2-staging.62 → 3.32.2-staging.63

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.
@@ -0,0 +1,32 @@
1
+ ---
2
+ "@7365admin1/core": minor
3
+ ---
4
+
5
+ CCTV monitoring wall: a site-scoped camera list and a batched health sweep.
6
+
7
+ Two additions to the camera proxy so a supervisor can watch a whole site rather
8
+ than one checkpoint at a time.
9
+
10
+ `getSiteWall` returns the cameras of one site from `site.cameras` - the
11
+ collection the real cameras are in - together with the polling intervals and
12
+ fan-out caps the client should use. No device is contacted, so opening a wall is
13
+ one database read. Entitlement is by site membership, not by the id in the URL,
14
+ and a caller outside the site gets the same answer as one asking for a site that
15
+ does not exist.
16
+
17
+ `getSiteHealth` probes the cameras currently on screen with at most
18
+ `CAMERA_WALL_MAX_CONCURRENT_PROBES` in flight. Reachability is a **per-recorder**
19
+ answer, cached per recorder: twelve of this estate's cameras are twelve channels
20
+ on one device, so a full wall is one connect rather than one per tile. It never
21
+ throws for a camera that is down; unreachable is the answer, and a camera whose
22
+ relay has no configured recorder is refused with a reason instead.
23
+
24
+ Firmware version and device clock are reported as unavailable with a reason: they
25
+ are HTTP CGI facts and the recorder in use exposes RTSP only.
26
+
27
+ Snapshots now record when a camera last returned a picture, so a tile can say
28
+ "last frame 40 minutes ago" instead of "never".
29
+
30
+ New, all optional and conservative by default: `CAMERA_WALL_POLL_MS` (5000),
31
+ `CAMERA_SINGLE_POLL_MS` (2000), `CAMERA_WALL_MAX_TILES` (9),
32
+ `CAMERA_WALL_MAX_CONCURRENT_PROBES` (4), `CAMERA_HEALTH_CACHE_SECONDS` (20).
package/dist/index.d.ts CHANGED
@@ -2879,6 +2879,45 @@ declare function publicCameraFields(camera: Record<string, any>): {
2879
2879
  guardPost: any;
2880
2880
  siteName: any;
2881
2881
  };
2882
+ /**
2883
+ * Tuning for a multi-camera wall, read from the environment.
2884
+ *
2885
+ * **Every number here is a guess that must be measured against a real device**,
2886
+ * which is exactly why the client is not allowed to hold its own copy: the wall
2887
+ * endpoint hands these to the app, so an environment that finds its cameras
2888
+ * cannot take nine simultaneous pulls is retuned by a deployment variable and not
2889
+ * by an app-store release.
2890
+ *
2891
+ * V3.37 documents no concurrent-connection limit for any unit — it is absent, not
2892
+ * generous — so the defaults are deliberately slow and small.
2893
+ */
2894
+ declare function wallConfig(env?: Record<string, string | undefined>): {
2895
+ /** A wall is situational awareness, not evidence. 5 s per tile is watchable. */
2896
+ snapshotPollMs: number;
2897
+ /**
2898
+ * Single-camera view. Matches `CAMERA_SNAPSHOT_CACHE_SECONDS` exactly —
2899
+ * polling faster than the cache costs round trips and never device requests,
2900
+ * so there is no point going below it and real harm in going far below it.
2901
+ */
2902
+ singlePollMs: number;
2903
+ /** The 3x3 ceiling, enforced here as well as in the client's layout list. */
2904
+ maxTiles: number;
2905
+ /** How many cameras a health sweep probes at once. */
2906
+ maxConcurrentProbes: number;
2907
+ /** Health changes slowly; N supervisors on one wall should be one probe. */
2908
+ healthCacheSeconds: number;
2909
+ };
2910
+ /**
2911
+ * Runs `worker` over `items`, at most `limit` at a time.
2912
+ *
2913
+ * The whole reason the wall has a backend change at all. Nine tiles asking for
2914
+ * health separately is eighteen device requests fired at once; this makes it four
2915
+ * in flight regardless of how many tiles the supervisor opens.
2916
+ *
2917
+ * ponytail: index-cursor over N workers rather than a queue library — the input is
2918
+ * bounded by `maxTiles` and this is the entire semantics needed.
2919
+ */
2920
+ declare function mapWithLimit<T, R>(items: Array<T>, limit: number, worker: (item: T) => Promise<R>): Promise<Array<R>>;
2882
2921
 
2883
2922
  /**
2884
2923
  * Camera functions for Virtual Patrol, proxied.
@@ -2932,6 +2971,14 @@ declare function useCameraViewService(): {
2932
2971
  userId?: string;
2933
2972
  permissions: Array<string>;
2934
2973
  }) => Promise<bson.Document>;
2974
+ authorizeSite: (params: {
2975
+ siteId: string;
2976
+ userId?: string;
2977
+ }) => Promise<{
2978
+ site: mongodb.WithId<bson.Document> | null;
2979
+ siteObjectId: ObjectId;
2980
+ db: mongodb.Db;
2981
+ }>;
2935
2982
  getSnapshot: (params: {
2936
2983
  cameraId: string;
2937
2984
  userId?: string;
@@ -2986,6 +3033,70 @@ declare function useCameraViewService(): {
2986
3033
  driftSeconds: null;
2987
3034
  detailUnavailableReason: string;
2988
3035
  }>;
3036
+ getSiteWall: (params: {
3037
+ siteId: string;
3038
+ userId?: string;
3039
+ }) => Promise<{
3040
+ site: {
3041
+ _id: ObjectId;
3042
+ name: any;
3043
+ };
3044
+ config: {
3045
+ snapshotPollMs: number;
3046
+ singlePollMs: number;
3047
+ maxTiles: number;
3048
+ maxConcurrentProbes: number;
3049
+ healthCacheSeconds: number;
3050
+ };
3051
+ cameras: {
3052
+ unavailableReason: string | null;
3053
+ _id: any;
3054
+ name: any;
3055
+ type: any;
3056
+ status: any;
3057
+ guardPost: any;
3058
+ siteName: any;
3059
+ }[];
3060
+ }>;
3061
+ getSiteHealth: (params: {
3062
+ siteId: string;
3063
+ userId?: string;
3064
+ cameraIds: Array<string>;
3065
+ }) => Promise<{
3066
+ cameras: ({
3067
+ reachable: boolean;
3068
+ health: "unsupported";
3069
+ reason: string;
3070
+ firmwareVersion: null;
3071
+ deviceTime: null;
3072
+ driftSeconds: null;
3073
+ detailUnavailableReason: string;
3074
+ lastFrameAt: string | null;
3075
+ unavailableReason: string | null;
3076
+ _id: any;
3077
+ name: any;
3078
+ type: any;
3079
+ status: any;
3080
+ guardPost: any;
3081
+ siteName: any;
3082
+ } | {
3083
+ reachable: boolean;
3084
+ health: "ok" | "drifted" | "unreachable";
3085
+ reason: string | null;
3086
+ firmwareVersion: null;
3087
+ deviceTime: null;
3088
+ driftSeconds: null;
3089
+ detailUnavailableReason: string;
3090
+ lastFrameAt: string | null;
3091
+ unavailableReason: string | null;
3092
+ _id: any;
3093
+ name: any;
3094
+ type: any;
3095
+ status: any;
3096
+ guardPost: any;
3097
+ siteName: any;
3098
+ })[];
3099
+ }>;
2989
3100
  movePtz: (params: {
2990
3101
  cameraId: string;
2991
3102
  userId?: string;
@@ -3010,6 +3121,8 @@ declare function useCameraViewController(): {
3010
3121
  status: (req: Request, res: Response, next: NextFunction) => Promise<void>;
3011
3122
  ptz: (req: Request, res: Response, next: NextFunction) => Promise<void>;
3012
3123
  capabilities: (_req: Request, res: Response) => Promise<void>;
3124
+ wall: (req: Request, res: Response, next: NextFunction) => Promise<void>;
3125
+ health: (req: Request, res: Response, next: NextFunction) => Promise<void>;
3013
3126
  };
3014
3127
 
3015
3128
  type TCustomerSite = {
@@ -8836,4 +8949,4 @@ declare function useNotificationController(): {
8836
8949
  add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8837
8950
  };
8838
8951
 
8839
- export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BidStatus, BidType, BuildingLevelStatus, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, CAMERA_NOT_PATROL_OR_CCTV, CAMERA_PTZ_PERMISSIONS, CAMERA_REQUEST_TIMEOUT_MS, CAMERA_RTSP_TIMEOUT_MS, CAMERA_SNAPSHOT_CACHE_SECONDS, CAMERA_SNAPSHOT_MAX_BYTES, CAMERA_TYPE_ANPR, CAMERA_TYPE_IP, CAMERA_VIEW_PERMISSIONS, CLOCK_DRIFT_WARN_SECONDS, CURRENT_TIME_ENDPOINT, Camera, CameraDevice, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, DynamicFormFields, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, FormEntryStatus, GuestSort, GuestStatus, HID_PERMISSION_CATEGORIES, IAccessCard, IAccessCardTransaction, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBidPreloved, MBillingConfiguration, MBillingItem, MBuilding, MBuildingLevel, MBuildingUnit, MBulletinBoard, MBulletinVideo, MCategoryPreloved, MChannelPreloved, MChat, MChatPreloved, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MFormEntry, MGuestManagement, MHidAmicoEvent, MHidAmicoIdentity, MHidAmicoReader, MHidSitePermissions, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MNotification, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MOvernightParkingApprovalHours, MOvernightParkingRequest, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPost, MPostFavorite, MPromoCode, MRobot, MRole, MRoleV2, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubcategoryPreloved, MSubscription, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, NotificationAppSlug, NotificationModule, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PATROL_CCTV_CAMERA_FILTER, PERSON_TYPES, PStatus, PTZ_ALLOWED_ACTIONS, PTZ_ALLOWED_CODES, Period, PersonStatus, PersonType, PersonTypes, PostOrder, PostSort, PostStatus, QrTagProps, ResidentAppModuleKey, SOFTWARE_VERSION_ENDPOINT, SiteAddress, SiteCategories, SiteStatus, SortFields, SortOrder, Status, SubjectOrder, SubjectSort, SubscriptionType, TAccessMngmntSettings, TActionStatus, TAddress, TAffectedEntities, TAffectedInjured, TAppServiceType, TApprovedBy, TApprover, TAttendance, TAttendanceCheckIn, TAttendanceCheckOut, TAttendanceCheckTime, TAttendanceLocation, TAttendanceSettings, TAttendanceSettingsGetBySite, TAuthorities, TAuthoritiesCalled, TBidPreloved, TBilling, TBillingConfiguration, TBillingItem, TBuilding, TBuildingLevel, TBuildingUnit, TBulletinBoard, TBulletinVideo, TCamera, TCategoryPreloved, TChannelPreloved, TChat, TChatPreloved, TCheckPoint$1 as TCheckPoint, TComplaintInfo, TComplaintReceivedTo, TCounter, TCreateNfcPatrolLog, TCustomer, TCustomerSite, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentCreate, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TFolderUpdate, TFormEntry, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, THidAmicoEvent, THidAmicoIdentity, THidAmicoReader, THidPermissionAssignment, THidPermissionCategory, THidSitePermissions, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TKeyRef, TManpowerDesignations, TManpowerDesignationsUpdate, TManpowerMonitoring, TManpowerMonitoringUpdate, TManpowerRemarks, TManpowerRemarksStatusUpdate, TManpowerRemarksUpdate, TManpowerSearchFilter, TManpowerSites, TMember, TMemberUpdateStatus, TMessagePreloved, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TNotification, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPost, TPostFavorite, TPrice, TPriceType, TPromoCode, TPromoTier, TRecipientOfComplaint, TRemarks, TResident, TResidentAppModules, TRobot, TRobotMetadata, TRole, TRoleV2, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TShifts, TSignNfcPatrolLog, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteInformation, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubcategoryPreloved, TSubmissionForm, TSubscription, TUnitBilling, TUnits, TUpdateFormEntry, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationMetadata, TVerificationMetadataV2, TVerificationV2, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, UserStatus, VehicleCategory, VehicleOrder, VehicleSort, VehicleStatus, VehicleType, VerificationLinkType, VerificationStatus, VerificationSubjectType, VerificationType, VisitorSort, VisitorStatus, addressSchema, allowedFieldsSite, allowedNatures, attendanceSchema, attendanceSettingsSchema, building_level_namespace_collection, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, cameraBaseUrl, cameraDevices, cameraHealthSummary, chatPrelovedEvents, chatSchema, clampPtzSpeed, clockDriftSeconds, createManpowerRemarksDaily, customerSchema, designationsSchema, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, ffmpegFrameArgs, ffmpegPath, formatDahuaDate, guests_namespace_collection, hasAnyPermission, incidentReport, incidentReportLog, incidents_namespace_collection, isCameraEntitled, isPatrolCctvCamera, logCamera, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, online_forms_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseCameraHost, parseDahuaFind, parseDeviceTime, parseSoftwareVersion, promoCodeSchema, ptzEndpoint, publicCameraFields, remarksSchema, residentAppModuleKeys, residentFormEntry, resolutionRefusalReason, resolveCamera, robotSchema, rtspUrl, schema, schemaAppSlugNotification, schemaApprovedBy, schemaApprover, schemaBidPreloved, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingLevel, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCategoryPreloved, schemaChannelPreloved, schemaChatPreloved, schemaCreateHidAmicoIdentity, schemaCreateNfcPatrolLog, schemaCreateNotification, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaFormEntry, schemaGuestManagement, schemaHidAmicoConfiguration, schemaHidAmicoEvent, schemaHidAmicoExecuteActions, schemaHidAmicoIdentity, schemaHidAmicoIdentityIdParams, schemaHidAmicoIdentityQuery, schemaHidAmicoIntercomCall, schemaHidAmicoLogQuery, schemaHidAmicoNotificationParams, schemaHidAmicoObjectOperation, schemaHidAmicoReader, schemaHidAmicoReaderIdParams, schemaHidAmicoReaderListQuery, schemaHidAmicoSetConfiguration, schemaHidAmicoSiteIdParams, schemaHidAmicoSync, schemaHidAmicoUserImageParams, schemaHidAmicoVisitorQr, schemaHidPermissionCandidateQuery, schemaIncidentReport, schemaListNotification, schemaMultipleDocumentManagement, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaNotification, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaPost, schemaPostFavorite, schemaServiceProvider, schemaServiceProviderBilling, schemaSignNfcPatrolLog, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaSubcategoryPreloved, schemaUnitBilling, schemaUpdateBidPreloved, schemaUpdateBuildingLevel, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateCategoryPreloved, schemaUpdateChatPreloved, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateFolderManagement, schemaUpdateFormEntry, schemaUpdateGuestManagement, schemaUpdateHidAmicoIdentity, schemaUpdateHidAmicoReader, schemaUpdateHidSitePermissions, schemaUpdateIncidentReport, schemaUpdateNotification, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdateOvernightParkingRequest, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdatePost, schemaUpdatePostFavorite, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteFacilityBooking, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateSubcategoryPreloved, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, sessionSchema, shiftSchema, siteSchema, site_people_namespace_collection, snapshotEndpoint, snapshotRefusalReason, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBidPrelovedController, useBidPrelovedRepo, useBidPrelovedService, useBuildingController, useBuildingLevelController, useBuildingLevelRepo, useBuildingLevelService, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useCameraViewController, useCameraViewService, useCategoryPrelovedController, useCategoryPrelovedRepo, useChannelPrelovedController, useChannelPrelovedRepo, useChatController, useChatPrelovedController, useChatPrelovedRepo, useChatPrelovedService, useChatRepo, useCounterModel, useCounterRepo, useCustomerController, useCustomerRepo, useCustomerSiteController, useCustomerSiteRepo, useCustomerSiteService, useDahuaService, useDashboardController, useDashboardRepo, useDocumentManagementController, useDocumentManagementRepo, useDocumentManagementService, useEntryPassSettingsController, useEntryPassSettingsRepo, useEventManagementController, useEventManagementRepo, useEventManagementService, useFeedbackController, useFeedbackRepo, useFeedbackService, useFileController, useFileRepo, useFileService, useFormEntryController, useFormEntryRepo, useGuestManagementController, useGuestManagementRepo, useGuestManagementService, useHidAmicoController, useHidAmicoRepo, useHidAmicoService, useHrmLabsAttendanceCtrl, useHrmLabsAttendanceSrvc, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useManpowerDesignationCtrl, useManpowerDesignationRepo, useManpowerMonitoringCtrl, useManpowerMonitoringRepo, useManpowerMonitoringSrvc, useManpowerRemarkCtrl, useManpowerRemarksRepo, useManpowerSitesCtrl, useManpowerSitesRepo, useManpowerSitesSrvc, useMemberController, useMemberRepo, useMemberService, useNewDashboardController, useNewDashboardRepo, useNfcPatrolLogController, useNfcPatrolLogRepo, useNfcPatrolLogService, useNfcPatrolRouteController, useNfcPatrolRouteRepo, useNfcPatrolRouteService, useNfcPatrolSettingsController, useNfcPatrolSettingsRepository, useNfcPatrolSettingsService, useNfcPatrolTagController, useNfcPatrolTagRepo, useNfcPatrolTagService, useNotificationController, useNotificationRepo, useOccurrenceBookController, useOccurrenceBookRepo, useOccurrenceBookService, useOccurrenceEntryController, useOccurrenceEntryRepo, useOccurrenceEntryService, useOccurrenceSubjectController, useOccurrenceSubjectRepo, useOccurrenceSubjectService, useOnlineFormController, useOnlineFormRepo, useOrgController, useOrgControllerV2, useOrgRepo, useOvernightParkingController, useOvernightParkingRepo, useOvernightParkingRequestController, useOvernightParkingRequestRepo, useOvernightParkingRequestService, usePatrolLogController, usePatrolLogRepo, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePostFavoriteController, usePostFavoriteRepo, usePostFavoriteService, usePostPrelovedController, usePostPrelovedRepo, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRedDotPaymentController, useRedDotPaymentRepo, useRedDotPaymentSvc, useRobotController, useRobotRepo, useRobotService, useRoleController, useRoleControllerV2, useRoleRepo, useRoleRepoV2, useRoleServiceV2, useServiceProviderBillingController, useServiceProviderBillingRepo, useServiceProviderBillingService, useServiceProviderController, useServiceProviderRepo, useSessionRepo, useSiteBillingConfigurationController, useSiteBillingConfigurationRepo, useSiteBillingItemController, useSiteBillingItemRepo, useSiteCameraController, useSiteCameraRepo, useSiteCameraService, useSiteController, useSiteFacilityBookingController, useSiteFacilityBookingRepo, useSiteFacilityBookingService, useSiteFacilityController, useSiteFacilityRepo, useSiteFacilityService, useSiteRepo, useSiteService, useSiteUnitBillingController, useSiteUnitBillingRepo, useSiteUnitBillingService, useStatementOfAccountController, useStatementOfAccountRepo, useSubcategoryPrelovedController, useSubcategoryPrelovedRepo, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useUserController, useUserControllerV2, useUserRepo, useUserRepoV2, useUserService, useUserServiceV2, useVehicleController, useVehicleRepo, useVehicleService, useVerificationController, useVerificationControllerV2, useVerificationRepo, useVerificationRepoV2, useVerificationService, useVerificationServiceV2, useVisitorTransactionController, useVisitorTransactionRepo, useVisitorTransactionService, useWorkOrderController, useWorkOrderRepo, useWorkOrderService, userSchema, vehicleSchema, vehicles_namespace_collection, visitorPersonRepo, visitorPersonService, visitorType, visitors_namespace_collection, workOrderSchema, work_orders2_namespace_collection, work_orders_namespace_collection };
8952
+ export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BidStatus, BidType, BuildingLevelStatus, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, CAMERA_NOT_PATROL_OR_CCTV, CAMERA_PTZ_PERMISSIONS, CAMERA_REQUEST_TIMEOUT_MS, CAMERA_RTSP_TIMEOUT_MS, CAMERA_SNAPSHOT_CACHE_SECONDS, CAMERA_SNAPSHOT_MAX_BYTES, CAMERA_TYPE_ANPR, CAMERA_TYPE_IP, CAMERA_VIEW_PERMISSIONS, CLOCK_DRIFT_WARN_SECONDS, CURRENT_TIME_ENDPOINT, Camera, CameraDevice, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, DynamicFormFields, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, FormEntryStatus, GuestSort, GuestStatus, HID_PERMISSION_CATEGORIES, IAccessCard, IAccessCardTransaction, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBidPreloved, MBillingConfiguration, MBillingItem, MBuilding, MBuildingLevel, MBuildingUnit, MBulletinBoard, MBulletinVideo, MCategoryPreloved, MChannelPreloved, MChat, MChatPreloved, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MFormEntry, MGuestManagement, MHidAmicoEvent, MHidAmicoIdentity, MHidAmicoReader, MHidSitePermissions, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MNotification, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MOvernightParkingApprovalHours, MOvernightParkingRequest, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPost, MPostFavorite, MPromoCode, MRobot, MRole, MRoleV2, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubcategoryPreloved, MSubscription, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, NotificationAppSlug, NotificationModule, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PATROL_CCTV_CAMERA_FILTER, PERSON_TYPES, PStatus, PTZ_ALLOWED_ACTIONS, PTZ_ALLOWED_CODES, Period, PersonStatus, PersonType, PersonTypes, PostOrder, PostSort, PostStatus, QrTagProps, ResidentAppModuleKey, SOFTWARE_VERSION_ENDPOINT, SiteAddress, SiteCategories, SiteStatus, SortFields, SortOrder, Status, SubjectOrder, SubjectSort, SubscriptionType, TAccessMngmntSettings, TActionStatus, TAddress, TAffectedEntities, TAffectedInjured, TAppServiceType, TApprovedBy, TApprover, TAttendance, TAttendanceCheckIn, TAttendanceCheckOut, TAttendanceCheckTime, TAttendanceLocation, TAttendanceSettings, TAttendanceSettingsGetBySite, TAuthorities, TAuthoritiesCalled, TBidPreloved, TBilling, TBillingConfiguration, TBillingItem, TBuilding, TBuildingLevel, TBuildingUnit, TBulletinBoard, TBulletinVideo, TCamera, TCategoryPreloved, TChannelPreloved, TChat, TChatPreloved, TCheckPoint$1 as TCheckPoint, TComplaintInfo, TComplaintReceivedTo, TCounter, TCreateNfcPatrolLog, TCustomer, TCustomerSite, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentCreate, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TFolderUpdate, TFormEntry, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, THidAmicoEvent, THidAmicoIdentity, THidAmicoReader, THidPermissionAssignment, THidPermissionCategory, THidSitePermissions, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TKeyRef, TManpowerDesignations, TManpowerDesignationsUpdate, TManpowerMonitoring, TManpowerMonitoringUpdate, TManpowerRemarks, TManpowerRemarksStatusUpdate, TManpowerRemarksUpdate, TManpowerSearchFilter, TManpowerSites, TMember, TMemberUpdateStatus, TMessagePreloved, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TNotification, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPost, TPostFavorite, TPrice, TPriceType, TPromoCode, TPromoTier, TRecipientOfComplaint, TRemarks, TResident, TResidentAppModules, TRobot, TRobotMetadata, TRole, TRoleV2, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TShifts, TSignNfcPatrolLog, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteInformation, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubcategoryPreloved, TSubmissionForm, TSubscription, TUnitBilling, TUnits, TUpdateFormEntry, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationMetadata, TVerificationMetadataV2, TVerificationV2, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, UserStatus, VehicleCategory, VehicleOrder, VehicleSort, VehicleStatus, VehicleType, VerificationLinkType, VerificationStatus, VerificationSubjectType, VerificationType, VisitorSort, VisitorStatus, addressSchema, allowedFieldsSite, allowedNatures, attendanceSchema, attendanceSettingsSchema, building_level_namespace_collection, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, cameraBaseUrl, cameraDevices, cameraHealthSummary, chatPrelovedEvents, chatSchema, clampPtzSpeed, clockDriftSeconds, createManpowerRemarksDaily, customerSchema, designationsSchema, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, ffmpegFrameArgs, ffmpegPath, formatDahuaDate, guests_namespace_collection, hasAnyPermission, incidentReport, incidentReportLog, incidents_namespace_collection, isCameraEntitled, isPatrolCctvCamera, logCamera, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, mapWithLimit, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, online_forms_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseCameraHost, parseDahuaFind, parseDeviceTime, parseSoftwareVersion, promoCodeSchema, ptzEndpoint, publicCameraFields, remarksSchema, residentAppModuleKeys, residentFormEntry, resolutionRefusalReason, resolveCamera, robotSchema, rtspUrl, schema, schemaAppSlugNotification, schemaApprovedBy, schemaApprover, schemaBidPreloved, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingLevel, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCategoryPreloved, schemaChannelPreloved, schemaChatPreloved, schemaCreateHidAmicoIdentity, schemaCreateNfcPatrolLog, schemaCreateNotification, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaFormEntry, schemaGuestManagement, schemaHidAmicoConfiguration, schemaHidAmicoEvent, schemaHidAmicoExecuteActions, schemaHidAmicoIdentity, schemaHidAmicoIdentityIdParams, schemaHidAmicoIdentityQuery, schemaHidAmicoIntercomCall, schemaHidAmicoLogQuery, schemaHidAmicoNotificationParams, schemaHidAmicoObjectOperation, schemaHidAmicoReader, schemaHidAmicoReaderIdParams, schemaHidAmicoReaderListQuery, schemaHidAmicoSetConfiguration, schemaHidAmicoSiteIdParams, schemaHidAmicoSync, schemaHidAmicoUserImageParams, schemaHidAmicoVisitorQr, schemaHidPermissionCandidateQuery, schemaIncidentReport, schemaListNotification, schemaMultipleDocumentManagement, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaNotification, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaPost, schemaPostFavorite, schemaServiceProvider, schemaServiceProviderBilling, schemaSignNfcPatrolLog, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaSubcategoryPreloved, schemaUnitBilling, schemaUpdateBidPreloved, schemaUpdateBuildingLevel, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateCategoryPreloved, schemaUpdateChatPreloved, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateFolderManagement, schemaUpdateFormEntry, schemaUpdateGuestManagement, schemaUpdateHidAmicoIdentity, schemaUpdateHidAmicoReader, schemaUpdateHidSitePermissions, schemaUpdateIncidentReport, schemaUpdateNotification, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdateOvernightParkingRequest, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdatePost, schemaUpdatePostFavorite, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteFacilityBooking, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateSubcategoryPreloved, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, sessionSchema, shiftSchema, siteSchema, site_people_namespace_collection, snapshotEndpoint, snapshotRefusalReason, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBidPrelovedController, useBidPrelovedRepo, useBidPrelovedService, useBuildingController, useBuildingLevelController, useBuildingLevelRepo, useBuildingLevelService, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useCameraViewController, useCameraViewService, useCategoryPrelovedController, useCategoryPrelovedRepo, useChannelPrelovedController, useChannelPrelovedRepo, useChatController, useChatPrelovedController, useChatPrelovedRepo, useChatPrelovedService, useChatRepo, useCounterModel, useCounterRepo, useCustomerController, useCustomerRepo, useCustomerSiteController, useCustomerSiteRepo, useCustomerSiteService, useDahuaService, useDashboardController, useDashboardRepo, useDocumentManagementController, useDocumentManagementRepo, useDocumentManagementService, useEntryPassSettingsController, useEntryPassSettingsRepo, useEventManagementController, useEventManagementRepo, useEventManagementService, useFeedbackController, useFeedbackRepo, useFeedbackService, useFileController, useFileRepo, useFileService, useFormEntryController, useFormEntryRepo, useGuestManagementController, useGuestManagementRepo, useGuestManagementService, useHidAmicoController, useHidAmicoRepo, useHidAmicoService, useHrmLabsAttendanceCtrl, useHrmLabsAttendanceSrvc, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useManpowerDesignationCtrl, useManpowerDesignationRepo, useManpowerMonitoringCtrl, useManpowerMonitoringRepo, useManpowerMonitoringSrvc, useManpowerRemarkCtrl, useManpowerRemarksRepo, useManpowerSitesCtrl, useManpowerSitesRepo, useManpowerSitesSrvc, useMemberController, useMemberRepo, useMemberService, useNewDashboardController, useNewDashboardRepo, useNfcPatrolLogController, useNfcPatrolLogRepo, useNfcPatrolLogService, useNfcPatrolRouteController, useNfcPatrolRouteRepo, useNfcPatrolRouteService, useNfcPatrolSettingsController, useNfcPatrolSettingsRepository, useNfcPatrolSettingsService, useNfcPatrolTagController, useNfcPatrolTagRepo, useNfcPatrolTagService, useNotificationController, useNotificationRepo, useOccurrenceBookController, useOccurrenceBookRepo, useOccurrenceBookService, useOccurrenceEntryController, useOccurrenceEntryRepo, useOccurrenceEntryService, useOccurrenceSubjectController, useOccurrenceSubjectRepo, useOccurrenceSubjectService, useOnlineFormController, useOnlineFormRepo, useOrgController, useOrgControllerV2, useOrgRepo, useOvernightParkingController, useOvernightParkingRepo, useOvernightParkingRequestController, useOvernightParkingRequestRepo, useOvernightParkingRequestService, usePatrolLogController, usePatrolLogRepo, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePostFavoriteController, usePostFavoriteRepo, usePostFavoriteService, usePostPrelovedController, usePostPrelovedRepo, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRedDotPaymentController, useRedDotPaymentRepo, useRedDotPaymentSvc, useRobotController, useRobotRepo, useRobotService, useRoleController, useRoleControllerV2, useRoleRepo, useRoleRepoV2, useRoleServiceV2, useServiceProviderBillingController, useServiceProviderBillingRepo, useServiceProviderBillingService, useServiceProviderController, useServiceProviderRepo, useSessionRepo, useSiteBillingConfigurationController, useSiteBillingConfigurationRepo, useSiteBillingItemController, useSiteBillingItemRepo, useSiteCameraController, useSiteCameraRepo, useSiteCameraService, useSiteController, useSiteFacilityBookingController, useSiteFacilityBookingRepo, useSiteFacilityBookingService, useSiteFacilityController, useSiteFacilityRepo, useSiteFacilityService, useSiteRepo, useSiteService, useSiteUnitBillingController, useSiteUnitBillingRepo, useSiteUnitBillingService, useStatementOfAccountController, useStatementOfAccountRepo, useSubcategoryPrelovedController, useSubcategoryPrelovedRepo, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useUserController, useUserControllerV2, useUserRepo, useUserRepoV2, useUserService, useUserServiceV2, useVehicleController, useVehicleRepo, useVehicleService, useVerificationController, useVerificationControllerV2, useVerificationRepo, useVerificationRepoV2, useVerificationService, useVerificationServiceV2, useVisitorTransactionController, useVisitorTransactionRepo, useVisitorTransactionService, useWorkOrderController, useWorkOrderRepo, useWorkOrderService, userSchema, vehicleSchema, vehicles_namespace_collection, visitorPersonRepo, visitorPersonService, visitorType, visitors_namespace_collection, wallConfig, workOrderSchema, work_orders2_namespace_collection, work_orders_namespace_collection };
package/dist/index.js CHANGED
@@ -6085,6 +6085,7 @@ __export(src_exports, {
6085
6085
  manpowerMonitoringSchema: () => manpowerMonitoringSchema,
6086
6086
  manpowerRemarksSchema: () => manpowerRemarksSchema,
6087
6087
  manpowerSitesSchema: () => manpowerSitesSchema,
6088
+ mapWithLimit: () => mapWithLimit,
6088
6089
  nfcPatrolSettingsSchema: () => nfcPatrolSettingsSchema,
6089
6090
  nfcPatrolSettingsSchemaUpdate: () => nfcPatrolSettingsSchemaUpdate,
6090
6091
  occurrence_book_namespace_collection: () => occurrence_book_namespace_collection,
@@ -6447,6 +6448,7 @@ __export(src_exports, {
6447
6448
  vehicleSchema: () => vehicleSchema,
6448
6449
  vehicles_namespace_collection: () => vehicles_namespace_collection,
6449
6450
  visitors_namespace_collection: () => visitors_namespace_collection,
6451
+ wallConfig: () => wallConfig,
6450
6452
  workOrderSchema: () => workOrderSchema,
6451
6453
  work_orders2_namespace_collection: () => work_orders2_namespace_collection,
6452
6454
  work_orders_namespace_collection: () => work_orders_namespace_collection
@@ -32583,6 +32585,42 @@ function publicCameraFields(camera) {
32583
32585
  siteName: camera?.siteName ?? ""
32584
32586
  };
32585
32587
  }
32588
+ function wallConfig(env = globalThis?.process?.env ?? {}) {
32589
+ return {
32590
+ /** A wall is situational awareness, not evidence. 5 s per tile is watchable. */
32591
+ snapshotPollMs: positiveNumber(env.CAMERA_WALL_POLL_MS, 5e3),
32592
+ /**
32593
+ * Single-camera view. Matches `CAMERA_SNAPSHOT_CACHE_SECONDS` exactly —
32594
+ * polling faster than the cache costs round trips and never device requests,
32595
+ * so there is no point going below it and real harm in going far below it.
32596
+ */
32597
+ singlePollMs: positiveNumber(env.CAMERA_SINGLE_POLL_MS, 2e3),
32598
+ /** The 3x3 ceiling, enforced here as well as in the client's layout list. */
32599
+ maxTiles: positiveNumber(env.CAMERA_WALL_MAX_TILES, 9),
32600
+ /** How many cameras a health sweep probes at once. */
32601
+ maxConcurrentProbes: positiveNumber(env.CAMERA_WALL_MAX_CONCURRENT_PROBES, 4),
32602
+ /** Health changes slowly; N supervisors on one wall should be one probe. */
32603
+ healthCacheSeconds: positiveNumber(env.CAMERA_HEALTH_CACHE_SECONDS, 20)
32604
+ };
32605
+ }
32606
+ function positiveNumber(raw, fallback) {
32607
+ const value = Number(raw);
32608
+ return Number.isFinite(value) && value > 0 ? value : fallback;
32609
+ }
32610
+ async function mapWithLimit(items, limit, worker) {
32611
+ const results = new Array(items.length);
32612
+ let cursor = 0;
32613
+ async function run() {
32614
+ while (cursor < items.length) {
32615
+ const index = cursor;
32616
+ cursor += 1;
32617
+ results[index] = await worker(items[index]);
32618
+ }
32619
+ }
32620
+ const width = Math.max(1, Math.min(limit, items.length));
32621
+ await Promise.all(Array.from({ length: width }, run));
32622
+ return results;
32623
+ }
32586
32624
 
32587
32625
  // src/services/camera-view.service.ts
32588
32626
  var import_node_server_utils95 = require("@7365admin1/node-server-utils");
@@ -32719,6 +32757,113 @@ function useCameraViewService() {
32719
32757
  socket.on("error", () => done(false));
32720
32758
  });
32721
32759
  }
32760
+ async function authorizeSite(params) {
32761
+ if (!params.userId || !import_mongodb56.ObjectId.isValid(params.userId)) {
32762
+ throw new import_node_server_utils95.UnauthorizedError("Not signed in.");
32763
+ }
32764
+ if (!import_mongodb56.ObjectId.isValid(params.siteId)) {
32765
+ throw new import_node_server_utils95.BadRequestError("Invalid site id.");
32766
+ }
32767
+ const db = import_node_server_utils95.useAtlas.getDb();
32768
+ if (!db)
32769
+ throw new Error("Unable to connect to server.");
32770
+ const siteObjectId = new import_mongodb56.ObjectId(params.siteId);
32771
+ const site = await db.collection("sites").findOne({ _id: siteObjectId }, { projection: { org: 1, name: 1 } });
32772
+ const memberships = await db.collection("members").find({ user: new import_mongodb56.ObjectId(params.userId), status: { $ne: "deleted" } }).project({ siteId: 1, org: 1, role: 1 }).toArray();
32773
+ const entitled = Boolean(site) && isCameraEntitled({
32774
+ cameraSite: siteObjectId,
32775
+ cameraOrg: site?.org,
32776
+ memberships
32777
+ });
32778
+ if (!entitled)
32779
+ throw new import_node_server_utils95.NotFoundError("Site not found.");
32780
+ const permissions = await getUserPermissions({
32781
+ user: params.userId,
32782
+ org: memberships[0]?.org
32783
+ });
32784
+ if (!hasAnyPermission(permissions, CAMERA_VIEW_PERMISSIONS)) {
32785
+ throw new import_node_server_utils95.UnauthorizedError(
32786
+ "You do not have permission to view these cameras."
32787
+ );
32788
+ }
32789
+ return { site, siteObjectId, db };
32790
+ }
32791
+ async function getSiteWall(params) {
32792
+ const { site, siteObjectId, db } = await authorizeSite(params);
32793
+ const cameras = await db.collection("site.cameras").find({
32794
+ ...PATROL_CCTV_CAMERA_FILTER,
32795
+ site: siteObjectId,
32796
+ status: { $ne: "deleted" }
32797
+ }).project({ _id: 1, name: 1, type: 1, status: 1, guardPost: 1, host: 1 }).sort({ guardPost: 1, name: 1 }).toArray();
32798
+ return {
32799
+ site: { _id: siteObjectId, name: site?.name ?? "" },
32800
+ config: wallConfig(),
32801
+ cameras: cameras.map((camera) => ({
32802
+ ...publicCameraFields({ ...camera, siteName: site?.name }),
32803
+ // Answered before anything is requested, so a camera with no address or
32804
+ // an inactive one renders with a reason and costs zero device requests.
32805
+ // (An ANPR unit never reaches here — it is filtered out above.)
32806
+ unavailableReason: snapshotRefusalReason(camera)
32807
+ }))
32808
+ };
32809
+ }
32810
+ async function getSiteHealth(params) {
32811
+ const { siteObjectId, db } = await authorizeSite(params);
32812
+ const config2 = wallConfig();
32813
+ const wanted = params.cameraIds.filter((id) => import_mongodb56.ObjectId.isValid(id)).slice(0, config2.maxTiles);
32814
+ if (wanted.length === 0)
32815
+ return { cameras: [] };
32816
+ const cameras = await db.collection("site.cameras").find({
32817
+ ...PATROL_CCTV_CAMERA_FILTER,
32818
+ _id: { $in: wanted.map((id) => new import_mongodb56.ObjectId(id)) },
32819
+ site: siteObjectId
32820
+ }).toArray();
32821
+ const results = await mapWithLimit(
32822
+ cameras,
32823
+ config2.maxConcurrentProbes,
32824
+ (camera) => probeCamera(camera, config2.healthCacheSeconds)
32825
+ );
32826
+ return { cameras: results };
32827
+ }
32828
+ async function probeCamera(camera, cacheSeconds) {
32829
+ const id = camera?._id?.toString?.() ?? "";
32830
+ const identity = {
32831
+ ...publicCameraFields(camera),
32832
+ unavailableReason: snapshotRefusalReason(camera)
32833
+ };
32834
+ const lastFrameAt = await getCache(`lastframe:${id}`) || null;
32835
+ const base = {
32836
+ ...identity,
32837
+ firmwareVersion: null,
32838
+ deviceTime: null,
32839
+ driftSeconds: null,
32840
+ detailUnavailableReason: "Firmware and device clock are not available: this recorder is reachable over video only.",
32841
+ lastFrameAt
32842
+ };
32843
+ const resolved = identity.unavailableReason ? null : resolveCamera(camera?.host);
32844
+ if (!resolved) {
32845
+ return {
32846
+ ...base,
32847
+ reachable: false,
32848
+ health: "unsupported",
32849
+ reason: identity.unavailableReason ?? "This camera is not configured."
32850
+ };
32851
+ }
32852
+ const cacheKey = `device:${resolved.device.host}:${resolved.device.port}`;
32853
+ const cached = await getCache(cacheKey);
32854
+ const reachable = typeof cached === "boolean" ? cached : await probeDevice(resolved.device);
32855
+ if (typeof cached !== "boolean") {
32856
+ setCache(cacheKey, reachable, cacheSeconds).catch(
32857
+ (error) => import_node_server_utils95.logger.info(`Camera device health cache write failed: ${error?.message}`)
32858
+ );
32859
+ }
32860
+ return {
32861
+ ...base,
32862
+ reachable,
32863
+ health: cameraHealthSummary({ reachable, driftSeconds: null }),
32864
+ reason: reachable ? null : "The recorder did not respond."
32865
+ };
32866
+ }
32722
32867
  async function getSnapshot(params) {
32723
32868
  const camera = await authorizeCamera({
32724
32869
  cameraId: params.cameraId,
@@ -32749,6 +32894,11 @@ function useCameraViewService() {
32749
32894
  setCache(cacheKey, buffer.toString("base64"), CAMERA_SNAPSHOT_CACHE_SECONDS).catch(
32750
32895
  (error) => import_node_server_utils95.logger.info(`Camera snapshot cache write failed: ${error?.message}`)
32751
32896
  );
32897
+ setCache(
32898
+ `lastframe:${params.cameraId}`,
32899
+ (/* @__PURE__ */ new Date()).toISOString(),
32900
+ LAST_FRAME_TTL_SECONDS
32901
+ ).catch(() => void 0);
32752
32902
  return { buffer, cached: false };
32753
32903
  }
32754
32904
  async function captureSnapshot(params) {
@@ -32819,9 +32969,12 @@ function useCameraViewService() {
32819
32969
  }
32820
32970
  return {
32821
32971
  authorizeCamera,
32972
+ authorizeSite,
32822
32973
  getSnapshot,
32823
32974
  captureSnapshot,
32824
32975
  getStatus,
32976
+ getSiteWall,
32977
+ getSiteHealth,
32825
32978
  movePtz,
32826
32979
  ptzEnabled
32827
32980
  };
@@ -32832,12 +32985,20 @@ function maxConcurrentGrabs() {
32832
32985
  return Number.isFinite(value) && value > 0 ? value : 4;
32833
32986
  }
32834
32987
  var inFlightGrabs = 0;
32988
+ var LAST_FRAME_TTL_SECONDS = 60 * 60;
32835
32989
 
32836
32990
  // src/controllers/camera-view.controller.ts
32837
32991
  var import_joi50 = __toESM(require("joi"));
32838
32992
  var import_node_server_utils96 = require("@7365admin1/node-server-utils");
32839
32993
  function useCameraViewController() {
32840
- const { getSnapshot, captureSnapshot, getStatus, movePtz } = useCameraViewService();
32994
+ const {
32995
+ getSnapshot,
32996
+ captureSnapshot,
32997
+ getStatus,
32998
+ getSiteWall,
32999
+ getSiteHealth,
33000
+ movePtz
33001
+ } = useCameraViewService();
32841
33002
  function callerId(req) {
32842
33003
  const user = req.user;
32843
33004
  return user?.user?.toString?.() || user?._id?.toString?.();
@@ -32905,10 +33066,35 @@ function useCameraViewController() {
32905
33066
  next(err);
32906
33067
  }
32907
33068
  }
33069
+ async function wall(req, res, next) {
33070
+ try {
33071
+ const result = await getSiteWall({
33072
+ siteId: String(req.params.siteId ?? ""),
33073
+ userId: callerId(req)
33074
+ });
33075
+ res.json(result);
33076
+ } catch (error) {
33077
+ next(error);
33078
+ }
33079
+ }
33080
+ async function health(req, res, next) {
33081
+ const raw = req.query.ids;
33082
+ const ids = String(Array.isArray(raw) ? raw.join(",") : raw ?? "").split(",").map((id) => id.trim()).filter(Boolean);
33083
+ try {
33084
+ const result = await getSiteHealth({
33085
+ siteId: String(req.params.siteId ?? ""),
33086
+ userId: callerId(req),
33087
+ cameraIds: ids
33088
+ });
33089
+ res.json(result);
33090
+ } catch (error) {
33091
+ next(error);
33092
+ }
33093
+ }
32908
33094
  async function capabilities(_req, res) {
32909
33095
  res.json({ snapshot: true, status: true, ptz: false, liveVideo: false });
32910
33096
  }
32911
- return { snapshot, capture, status, ptz, capabilities };
33097
+ return { snapshot, capture, status, ptz, capabilities, wall, health };
32912
33098
  }
32913
33099
 
32914
33100
  // src/models/customer-site.model.ts
@@ -74516,6 +74702,7 @@ function useNotificationController() {
74516
74702
  manpowerMonitoringSchema,
74517
74703
  manpowerRemarksSchema,
74518
74704
  manpowerSitesSchema,
74705
+ mapWithLimit,
74519
74706
  nfcPatrolSettingsSchema,
74520
74707
  nfcPatrolSettingsSchemaUpdate,
74521
74708
  occurrence_book_namespace_collection,
@@ -74878,6 +75065,7 @@ function useNotificationController() {
74878
75065
  vehicleSchema,
74879
75066
  vehicles_namespace_collection,
74880
75067
  visitors_namespace_collection,
75068
+ wallConfig,
74881
75069
  workOrderSchema,
74882
75070
  work_orders2_namespace_collection,
74883
75071
  work_orders_namespace_collection