@7365admin1/core 3.32.2-staging.85 → 3.32.2-staging.87

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,17 @@
1
+ ---
2
+ "@7365admin1/core": patch
3
+ ---
4
+
5
+ Scope the notification inbox to the signed-in person.
6
+
7
+ Every handler on `/notifications` read the user id out of the query string or
8
+ the URL and acted on it without comparing it to the session, so any signed-in
9
+ account could list another person's notifications, mark them read, and read
10
+ their unread count. Whose inbox is opened now comes from the session; a request
11
+ naming somebody else is refused rather than quietly served.
12
+
13
+ `POST /notifications` writes into up to 5000 inboxes at once and had no
14
+ authorisation beyond being signed in. It now requires a Seven365 super admin.
15
+
16
+ The `user` parameter is still accepted, so no app has to be released in step
17
+ with this: every caller in the organisation already sends its own id.
@@ -0,0 +1,31 @@
1
+ ---
2
+ "@7365admin1/core": minor
3
+ ---
4
+
5
+ Hold property-manager service-provider invitations for Seven365 approval, and give an invitation a life
6
+
7
+ A property management company inviting a service provider used to reach that
8
+ provider immediately. It now waits for the Seven365 super admin, and the
9
+ provider is told nothing at all until it is approved — no email, no in-app
10
+ message, and the invitation is not even readable to them. Approval is the one
11
+ place an invitation reaches the provider, so there is a single function that can
12
+ leak an unapproved one. An invitation Seven365 sends itself is not held.
13
+
14
+ An invitation now has seven states instead of two: waiting for Seven365, waiting
15
+ for the provider, accepted, not approved (with a reason the property manager
16
+ sees word for word), declined, cancelled and expired. Every change goes through
17
+ one conditional update that moves the row only from an expected state and
18
+ appends an immutable history line in the same write — so approving or accepting
19
+ twice writes nothing the second time, and no path can move an invitation
20
+ silently. Deleting is a soft delete: the row leaves the property manager's list,
21
+ the record and its history stay and remain visible to Seven365.
22
+
23
+ Authorization, which this endpoint did not have: the caller is resolved from the
24
+ session and must belong to the organisation the invitation is sent for — being
25
+ signed in used to be enough to invite a provider to any organisation's site.
26
+ Approving and rejecting require the Seven365 super-admin membership (an org-less
27
+ `members` row of type `admin` whose role is also of type `admin`), not an email
28
+ address, so it behaves the same in staging and production.
29
+
30
+ An already-onboarded provider still never sees sign-up or a one-time code, and
31
+ the sign-up path for a brand-new company is unchanged.
package/dist/index.d.ts CHANGED
@@ -503,16 +503,18 @@ declare function useVerificationService(): {
503
503
  createUserInvite: ({ email, metadata, }: {
504
504
  email: string;
505
505
  metadata: TKeyValuePair;
506
- }) => Promise<bson.ObjectId>;
506
+ }) => Promise<ObjectId>;
507
507
  createForgetPassword: (email: string) => Promise<string>;
508
- createServiceProviderInvite: ({ email, orgId, siteId, siteName, app, inviteType, }: {
508
+ createServiceProviderInvite: ({ email, orgId, siteId, siteName, app, inviteType, invitedBy, }: {
509
509
  email: string;
510
510
  orgId: string;
511
511
  siteId: string;
512
512
  siteName: string;
513
513
  app: string;
514
514
  inviteType: "create-org" | "organization-invite";
515
- }) => Promise<bson.ObjectId>;
515
+ /** the signed-in user, from the session — never from the request body */
516
+ invitedBy?: string | undefined;
517
+ }) => Promise<ObjectId>;
516
518
  getById: (id: string) => Promise<TVerification>;
517
519
  verify: (id: string) => Promise<TVerification>;
518
520
  cancelUserInvitation: (id: string) => Promise<void>;
@@ -520,7 +522,7 @@ declare function useVerificationService(): {
520
522
  signUp: ({ email, metadata, }: {
521
523
  email: string;
522
524
  metadata: TKeyValuePair;
523
- }) => Promise<bson.ObjectId>;
525
+ }) => Promise<ObjectId>;
524
526
  checkExpiredInvitation: () => Promise<string>;
525
527
  createSimpleUserInvite: ({ email, metadata, }: {
526
528
  email: string;
@@ -529,7 +531,7 @@ declare function useVerificationService(): {
529
531
  createSimpleMemberInvite: ({ email, metadata, }: {
530
532
  email: string;
531
533
  metadata: TKeyValuePair;
532
- }) => Promise<bson.ObjectId>;
534
+ }) => Promise<ObjectId>;
533
535
  createSimpleServiceProviderInvite: ({ email, app, name, role, orgId, siteId, siteName, }: {
534
536
  email: string;
535
537
  app?: string | undefined;
@@ -538,7 +540,7 @@ declare function useVerificationService(): {
538
540
  orgId: string;
539
541
  siteId: string;
540
542
  siteName: string;
541
- }) => Promise<bson.ObjectId>;
543
+ }) => Promise<ObjectId>;
542
544
  };
543
545
 
544
546
  declare function useVerificationController(): {
@@ -877,7 +879,7 @@ declare const TPrice: z.ZodObject<{
877
879
  deletedAt: z.ZodOptional<z.ZodDate>;
878
880
  }, "strip", z.ZodTypeAny, {
879
881
  name: string;
880
- type: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription";
882
+ type: "other" | "one-time-payment" | "monthly-subscription" | "yearly-subscription";
881
883
  value: number;
882
884
  _id?: ObjectId | undefined;
883
885
  createdAt?: Date | undefined;
@@ -889,7 +891,7 @@ declare const TPrice: z.ZodObject<{
889
891
  name: string;
890
892
  _id?: string | ObjectId | undefined;
891
893
  createdAt?: Date | undefined;
892
- type?: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription" | undefined;
894
+ type?: "other" | "one-time-payment" | "monthly-subscription" | "yearly-subscription" | undefined;
893
895
  updatedAt?: Date | undefined;
894
896
  deletedAt?: Date | undefined;
895
897
  value?: number | undefined;
@@ -900,7 +902,7 @@ type TPrice = z.infer<typeof TPrice>;
900
902
  declare function usePriceModel(db: Db): {
901
903
  createPrice: (value: Pick<TPrice, "type" | "name" | "value">) => {
902
904
  name: string;
903
- type: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription";
905
+ type: "other" | "one-time-payment" | "monthly-subscription" | "yearly-subscription";
904
906
  value: number;
905
907
  _id?: ObjectId | undefined;
906
908
  createdAt?: Date | undefined;
@@ -913,7 +915,7 @@ declare function usePriceModel(db: Db): {
913
915
  name: string;
914
916
  _id?: string | ObjectId | undefined;
915
917
  createdAt?: Date | undefined;
916
- type?: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription" | undefined;
918
+ type?: "other" | "one-time-payment" | "monthly-subscription" | "yearly-subscription" | undefined;
917
919
  updatedAt?: Date | undefined;
918
920
  deletedAt?: Date | undefined;
919
921
  value?: number | undefined;
@@ -921,7 +923,7 @@ declare function usePriceModel(db: Db): {
921
923
  saleExpiry?: Date | undefined;
922
924
  }, {
923
925
  name: string;
924
- type: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription";
926
+ type: "other" | "one-time-payment" | "monthly-subscription" | "yearly-subscription";
925
927
  value: number;
926
928
  _id?: ObjectId | undefined;
927
929
  createdAt?: Date | undefined;
@@ -932,7 +934,7 @@ declare function usePriceModel(db: Db): {
932
934
  }>;
933
935
  collection: Collection<{
934
936
  name: string;
935
- type: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription";
937
+ type: "other" | "one-time-payment" | "monthly-subscription" | "yearly-subscription";
936
938
  value: number;
937
939
  _id?: ObjectId | undefined;
938
940
  createdAt?: Date | undefined;
@@ -1110,7 +1112,7 @@ declare const TInvoice: z.ZodObject<{
1110
1112
  updatedAt: z.ZodOptional<z.ZodDate>;
1111
1113
  }, "strip", z.ZodTypeAny, {
1112
1114
  status: "pending" | "cancelled" | "paid" | "overdue";
1113
- type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1115
+ type: "other" | "organization-subscription" | "affiliate-subscription" | "one-time-payment";
1114
1116
  items: {
1115
1117
  description: string;
1116
1118
  total: number;
@@ -1147,7 +1149,7 @@ declare const TInvoice: z.ZodObject<{
1147
1149
  _id?: string | ObjectId | undefined;
1148
1150
  createdAt?: Date | undefined;
1149
1151
  status?: "pending" | "cancelled" | "paid" | "overdue" | undefined;
1150
- type?: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other" | undefined;
1152
+ type?: "other" | "organization-subscription" | "affiliate-subscription" | "one-time-payment" | undefined;
1151
1153
  updatedAt?: Date | undefined;
1152
1154
  metadata?: {
1153
1155
  description?: string | undefined;
@@ -1164,7 +1166,7 @@ declare function useInvoiceModel(db: Db): {
1164
1166
  createInvoice: (data: TInvoice) => TInvoice;
1165
1167
  collection: Collection<{
1166
1168
  status: "pending" | "cancelled" | "paid" | "overdue";
1167
- type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1169
+ type: "other" | "organization-subscription" | "affiliate-subscription" | "one-time-payment";
1168
1170
  items: {
1169
1171
  description: string;
1170
1172
  total: number;
@@ -1196,7 +1198,7 @@ declare function useInvoiceRepo(): {
1196
1198
  add: (value: TInvoice, session?: ClientSession) => Promise<void>;
1197
1199
  getByDueDate: (dueDate: Date, status?: TInvoice["status"]) => Promise<{
1198
1200
  status: "pending" | "cancelled" | "paid" | "overdue";
1199
- type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1201
+ type: "other" | "organization-subscription" | "affiliate-subscription" | "one-time-payment";
1200
1202
  items: {
1201
1203
  description: string;
1202
1204
  total: number;
@@ -1232,7 +1234,7 @@ declare function useInvoiceRepo(): {
1232
1234
  pageRange: string;
1233
1235
  } | {
1234
1236
  status: "pending" | "cancelled" | "paid" | "overdue";
1235
- type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1237
+ type: "other" | "organization-subscription" | "affiliate-subscription" | "one-time-payment";
1236
1238
  items: {
1237
1239
  description: string;
1238
1240
  total: number;
@@ -1258,7 +1260,7 @@ declare function useInvoiceRepo(): {
1258
1260
  }>;
1259
1261
  getOverdueInvoices: (BATCH_SIZE?: number) => Promise<{
1260
1262
  status: "pending" | "cancelled" | "paid" | "overdue";
1261
- type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1263
+ type: "other" | "organization-subscription" | "affiliate-subscription" | "one-time-payment";
1262
1264
  items: {
1263
1265
  description: string;
1264
1266
  total: number;
@@ -8083,11 +8085,32 @@ declare enum VerificationType {
8083
8085
  SERVICE_PROVIDER_CREATE_ORG = "service-provider-create-org"
8084
8086
  }
8085
8087
  declare enum VerificationStatus {
8088
+ /**
8089
+ * A service-provider invitation sent by a property management company, held
8090
+ * for the Seven365 super admin. NOTHING has reached the provider yet — no
8091
+ * email, no in-app message. Only this status blocks the notification.
8092
+ */
8093
+ AWAITING_APPROVAL = "awaiting-approval",
8094
+ /** Waiting for the invited party. For a service provider this means approved. */
8086
8095
  PENDING = "pending",
8087
8096
  COMPLETE = "complete",
8088
8097
  EXPIRED = "expired",
8089
- CANCELLED = "cancelled"
8098
+ CANCELLED = "cancelled",
8099
+ /** Refused by the Seven365 super admin, with a reason. Never notified. */
8100
+ REJECTED = "rejected",
8101
+ /** Refused by the invited service provider itself. */
8102
+ DECLINED = "declined"
8090
8103
  }
8104
+ /** The states an invitation can still move out of. */
8105
+ declare const VERIFICATION_OPEN_STATUSES: string[];
8106
+ /** One immutable line of an invitation's history. Appended, never edited. */
8107
+ type TVerificationEvent = {
8108
+ action: string;
8109
+ at: string;
8110
+ by?: string | ObjectId | null;
8111
+ byName?: string;
8112
+ reason?: string;
8113
+ };
8091
8114
  declare enum VerificationSubjectType {
8092
8115
  _MEMBER_INVITE = "Member Invite",
8093
8116
  _USER_INVITE = "User Invite",
@@ -8115,6 +8138,11 @@ type TVerificationMetadataV2 = {
8115
8138
  siteName?: string;
8116
8139
  serviceProviderOrgId?: string | ObjectId;
8117
8140
  verificationCode?: string;
8141
+ /** Who sent the invitation. Taken from the session, never from the body. */
8142
+ invitedBy?: string | ObjectId;
8143
+ invitedByName?: string;
8144
+ /** True when the sender was a property management company — those need approval. */
8145
+ invitedByPropertyManagement?: boolean;
8118
8146
  };
8119
8147
  type TVerificationV2 = {
8120
8148
  _id?: ObjectId;
@@ -8125,6 +8153,17 @@ type TVerificationV2 = {
8125
8153
  createdAt: string;
8126
8154
  updatedAt?: string | null;
8127
8155
  expireAt: string;
8156
+ /** Set by the super admin when refusing. Shown to the property manager verbatim. */
8157
+ rejectionReason?: string | null;
8158
+ /**
8159
+ * Soft delete. The row leaves the property manager's list but the record and
8160
+ * its history are kept and stay visible to the Seven365 super admin. Nothing
8161
+ * about an invitation is ever hard-deleted.
8162
+ */
8163
+ deletedAt?: string | null;
8164
+ deletedBy?: string | ObjectId | null;
8165
+ /** Append-only audit trail: who did what, when, and why. */
8166
+ history?: TVerificationEvent[];
8128
8167
  };
8129
8168
  declare class MVerificationV2 implements TVerificationV2 {
8130
8169
  _id?: ObjectId;
@@ -8135,6 +8174,10 @@ declare class MVerificationV2 implements TVerificationV2 {
8135
8174
  createdAt: string;
8136
8175
  updatedAt?: string | null;
8137
8176
  expireAt: string;
8177
+ rejectionReason?: string | null;
8178
+ deletedAt?: string | null;
8179
+ deletedBy?: string | ObjectId | null;
8180
+ history?: TVerificationEvent[];
8138
8181
  constructor(value: TVerificationV2);
8139
8182
  }
8140
8183
 
@@ -8142,6 +8185,29 @@ declare function useVerificationRepoV2(): {
8142
8185
  createIndex: () => Promise<void>;
8143
8186
  createTextIndex: () => Promise<void>;
8144
8187
  add: (value: TVerificationV2, session?: ClientSession) => Promise<ObjectId>;
8188
+ getServiceProviderInviteById: (id: string | ObjectId) => Promise<TVerificationV2 | null>;
8189
+ transitionServiceProviderInvite: ({ id, from, to, event, set, session, }: {
8190
+ id: string | ObjectId;
8191
+ from: string[];
8192
+ to?: string | undefined;
8193
+ event: TVerificationEvent;
8194
+ set?: Record<string, any> | undefined;
8195
+ session?: ClientSession | undefined;
8196
+ }) => Promise<any>;
8197
+ getServiceProviderInvites: ({ statuses, orgIds, email, search, includeDeleted, page, limit, }: {
8198
+ statuses?: string[] | undefined;
8199
+ orgIds?: string[] | undefined;
8200
+ email?: string | undefined;
8201
+ search?: string | undefined;
8202
+ includeDeleted?: boolean | undefined;
8203
+ page?: number | undefined;
8204
+ limit?: number | undefined;
8205
+ }) => Promise<{
8206
+ items: any[];
8207
+ pages: number;
8208
+ pageRange: string;
8209
+ }>;
8210
+ countServiceProviderInvitesAwaitingApproval: () => Promise<number>;
8145
8211
  updateVerificationStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
8146
8212
  getByVerificationCode: (verificationCode: string) => Promise<TVerification | null>;
8147
8213
  getVerificationById: (id: string | ObjectId) => Promise<TVerificationV2 | null>;
@@ -8174,11 +8240,11 @@ declare function useVerificationServiceV2(): {
8174
8240
  email: string;
8175
8241
  metadata: TVerificationMetadataV2;
8176
8242
  }) => Promise<{
8177
- res: bson.ObjectId;
8243
+ res: ObjectId;
8178
8244
  verificationCode: string;
8179
8245
  }>;
8180
8246
  verify: (verificationCode: string) => Promise<{
8181
- _id: bson.ObjectId | undefined;
8247
+ _id: ObjectId | undefined;
8182
8248
  type: string;
8183
8249
  email: string;
8184
8250
  status: string | undefined;
@@ -8187,17 +8253,19 @@ declare function useVerificationServiceV2(): {
8187
8253
  createUserInvite: ({ email, metadata, }: {
8188
8254
  email: string;
8189
8255
  metadata: TVerificationMetadataV2;
8190
- }) => Promise<bson.ObjectId>;
8256
+ }) => Promise<ObjectId>;
8191
8257
  createOrganizationInvite: ({ email, metadata, }: {
8192
8258
  email: string;
8193
8259
  metadata: TVerificationMetadataV2;
8194
- }) => Promise<bson.ObjectId>;
8195
- createServiceProviderInvite: ({ email, orgId, siteId, siteName, }: {
8260
+ }) => Promise<ObjectId>;
8261
+ createServiceProviderInvite: ({ email, orgId, siteId, siteName, invitedBy, }: {
8196
8262
  email: string;
8197
8263
  orgId: string;
8198
8264
  siteId: string;
8199
8265
  siteName: string;
8200
- }) => Promise<bson.ObjectId>;
8266
+ /** the signed-in user, from the session — never from the request body */
8267
+ invitedBy?: string | undefined;
8268
+ }) => Promise<ObjectId>;
8201
8269
  createForgetPassword: (email: string) => Promise<string>;
8202
8270
  cancelUserInvitation: (id: string) => Promise<void>;
8203
8271
  resendSignUpVerification: (email: string) => Promise<{
@@ -8216,6 +8284,198 @@ declare function useVerificationControllerV2(): {
8216
8284
  resendSignUpVerification: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8217
8285
  };
8218
8286
 
8287
+ /**
8288
+ * Service-provider invitation lifecycle.
8289
+ *
8290
+ * Every handler is mounted behind `requireAuth` and every one re-derives the
8291
+ * caller from the session — `req.user`, never a body or query field. The id in
8292
+ * the path selects an invitation; the service decides whether this caller may
8293
+ * do that to it.
8294
+ */
8295
+ declare function useServiceProviderInviteController(): {
8296
+ list: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8297
+ approvals: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8298
+ pendingApprovalCount: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8299
+ approve: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8300
+ reject: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8301
+ cancel: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8302
+ resend: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8303
+ remove: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8304
+ decline: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8305
+ getOne: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8306
+ };
8307
+
8308
+ declare function useServiceProviderInviteService(): {
8309
+ listForCaller: ({ userId, orgId, statuses, search, page, limit, }: {
8310
+ userId?: string | undefined;
8311
+ orgId?: string | undefined;
8312
+ statuses?: string[] | undefined;
8313
+ search?: string | undefined;
8314
+ page?: number | undefined;
8315
+ limit?: number | undefined;
8316
+ }) => Promise<{
8317
+ items: {
8318
+ statusLabel: string;
8319
+ _id?: ObjectId | undefined;
8320
+ type: string;
8321
+ email: string;
8322
+ metadata?: TVerificationMetadataV2 | undefined;
8323
+ status?: string | undefined;
8324
+ createdAt: string;
8325
+ updatedAt?: string | null | undefined;
8326
+ expireAt: string;
8327
+ rejectionReason?: string | null | undefined;
8328
+ deletedAt?: string | null | undefined;
8329
+ deletedBy?: string | ObjectId | null | undefined;
8330
+ history?: TVerificationEvent[] | undefined;
8331
+ }[];
8332
+ pages: number;
8333
+ pageRange: string;
8334
+ }>;
8335
+ listApprovals: ({ userId, status, page, limit, includeDeleted, }: {
8336
+ userId?: string | undefined;
8337
+ status?: string | undefined;
8338
+ page?: number | undefined;
8339
+ limit?: number | undefined;
8340
+ includeDeleted?: boolean | undefined;
8341
+ }) => Promise<{
8342
+ awaitingApprovalCount: number;
8343
+ items: any[];
8344
+ pages: number;
8345
+ pageRange: string;
8346
+ }>;
8347
+ approvalCount: ({ userId }: {
8348
+ userId?: string | undefined;
8349
+ }) => Promise<{
8350
+ count: number;
8351
+ }>;
8352
+ approve: ({ id, userId }: {
8353
+ id: string;
8354
+ userId?: string | undefined;
8355
+ }) => Promise<{
8356
+ message: string;
8357
+ }>;
8358
+ reject: ({ id, userId, reason, }: {
8359
+ id: string;
8360
+ userId?: string | undefined;
8361
+ reason?: string | undefined;
8362
+ }) => Promise<{
8363
+ message: string;
8364
+ }>;
8365
+ cancel: ({ id, userId }: {
8366
+ id: string;
8367
+ userId?: string | undefined;
8368
+ }) => Promise<{
8369
+ message: string;
8370
+ }>;
8371
+ resend: ({ id, userId }: {
8372
+ id: string;
8373
+ userId?: string | undefined;
8374
+ }) => Promise<{
8375
+ message: string;
8376
+ }>;
8377
+ softDelete: ({ id, userId }: {
8378
+ id: string;
8379
+ userId?: string | undefined;
8380
+ }) => Promise<{
8381
+ message: string;
8382
+ }>;
8383
+ decline: ({ id, userId }: {
8384
+ id: string;
8385
+ userId?: string | undefined;
8386
+ }) => Promise<{
8387
+ message: string;
8388
+ }>;
8389
+ getForProvider: ({ id, userId, }: {
8390
+ id: string;
8391
+ userId?: string | undefined;
8392
+ }) => Promise<{
8393
+ _id: ObjectId | undefined;
8394
+ orgName: string;
8395
+ siteName: string;
8396
+ status: string | undefined;
8397
+ statusLabel: string;
8398
+ expireAt: string;
8399
+ }>;
8400
+ notifyProvider: (invite: TVerificationV2) => Promise<void>;
8401
+ };
8402
+
8403
+ declare const SERVICE_PROVIDER_SIGN_UP_TYPE = "service-provider-invite";
8404
+ declare const SERVICE_PROVIDER_SIGN_IN_TYPE = "service-provider-create-org";
8405
+ declare const SERVICE_PROVIDER_SIGN_UP_SUBJECT = "Service Provider Invite";
8406
+ declare const SERVICE_PROVIDER_SIGN_IN_SUBJECT = "Service Provider Organization Invite";
8407
+ /** Membership types that mean "a property management company sent this". */
8408
+ declare const PROPERTY_MANAGEMENT_MEMBER_TYPES: string[];
8409
+ type ServiceProviderInviteFacts = {
8410
+ /** the invited email already has a user account */
8411
+ hasUser: boolean;
8412
+ /** the invited email owns an organisation (i.e. it is an existing provider) */
8413
+ hasProviderOrg: boolean;
8414
+ /** that organisation already has an active engagement on this site */
8415
+ engagedOnSite: boolean;
8416
+ /** an invitation for this email and this site is already waiting */
8417
+ invitePending: boolean;
8418
+ /** the sender is a property management company, so Seven365 must approve first */
8419
+ inviterIsPropertyManagement?: boolean;
8420
+ };
8421
+ type ServiceProviderInviteDecision = {
8422
+ ok: true;
8423
+ type: string;
8424
+ subject: string;
8425
+ existingProvider: boolean;
8426
+ /** hold it for the super admin and tell the provider nothing yet */
8427
+ requiresApproval: boolean;
8428
+ } | {
8429
+ ok: false;
8430
+ reason: string;
8431
+ };
8432
+ declare function decideServiceProviderInvite(facts: ServiceProviderInviteFacts): ServiceProviderInviteDecision;
8433
+ type ServiceProviderInviteAction = "approve" | "reject" | "cancel" | "resend" | "accept" | "decline" | "delete";
8434
+ /** Which statuses each action may be applied to. */
8435
+ declare const SERVICE_PROVIDER_INVITE_TRANSITIONS: Record<ServiceProviderInviteAction, {
8436
+ from: string[];
8437
+ to?: string;
8438
+ }>;
8439
+ /**
8440
+ * The words a person sees. Deliberately not the stored value — nobody outside
8441
+ * the code should ever read "awaiting-approval".
8442
+ */
8443
+ declare const SERVICE_PROVIDER_INVITE_LABELS: Record<string, string>;
8444
+ declare function serviceProviderInviteLabel(status?: string): string;
8445
+ /**
8446
+ * Why an action cannot be applied, in words a property manager can act on —
8447
+ * or `null` when it can. Returning the same sentence the API returns keeps the
8448
+ * screen and the server saying one thing.
8449
+ */
8450
+ declare function refuseServiceProviderInviteAction(action: ServiceProviderInviteAction, status?: string): string | null;
8451
+
8452
+ /**
8453
+ * Who is asking, resolved from the session id alone.
8454
+ *
8455
+ * Every invitation action re-derives this — the caller never states who they
8456
+ * are in a body or a query field.
8457
+ *
8458
+ * **Super admin is a membership, not an email address.** `createDefaultUser()`
8459
+ * seeds a role named "Super Admin" with `type: "admin"` and a `members` row with
8460
+ * `type: "admin"` and NO organisation; the user behind it is whatever
8461
+ * `DEFAULT_USER_EMAIL` is set to in that environment (`admin@gmail.com` on
8462
+ * staging, something else in production). Gating on the email address would
8463
+ * therefore work on staging and fail in production, and would break the day the
8464
+ * account is rotated. Both halves are required — a `members` row of type
8465
+ * "admin" whose role is also of type "admin" — because staging carries a second
8466
+ * role merely NAMED "Super Admin" that is an ordinary organisation role.
8467
+ */
8468
+ type InviteActor = {
8469
+ id: string;
8470
+ name: string;
8471
+ isSuperAdmin: boolean;
8472
+ /** every organisation this user is a live member of */
8473
+ orgIds: string[];
8474
+ /** organisations this user represents as a property management company */
8475
+ propertyManagementOrgIds: string[];
8476
+ };
8477
+ declare function resolveInviteActor(userId?: string | ObjectId | null): Promise<InviteActor>;
8478
+
8219
8479
  declare function useAuthControllerV2(): {
8220
8480
  signUp: (req: Request, res: Response, next: NextFunction) => Promise<void>;
8221
8481
  login: (req: Request, res: Response, next: NextFunction) => Promise<void>;
@@ -9606,6 +9866,26 @@ declare function useNotificationRepo(): {
9606
9866
  }>;
9607
9867
  };
9608
9868
 
9869
+ /**
9870
+ * The notification inbox.
9871
+ *
9872
+ * **Whose inbox is taken from the session, not from the request.** Until now
9873
+ * every handler here read the user id out of the query string or the URL and
9874
+ * used it as given, so any signed-in account could list somebody else's
9875
+ * notifications, mark them read, and read their unread count — the session was
9876
+ * checked, but never against the record being touched.
9877
+ *
9878
+ * Nothing a client sends can change whose inbox is opened now. The `user`
9879
+ * parameter is still accepted so that no app has to be released in step with
9880
+ * this: every caller in the estate already sends its own id, so ignoring the
9881
+ * value changes nothing for them — but it is now checked, and a request naming
9882
+ * somebody else is refused rather than quietly served.
9883
+ *
9884
+ * `POST /` is a different animal: it writes a notification into up to 5000
9885
+ * inboxes at once and had no authorisation beyond being signed in. It is now
9886
+ * restricted to a Seven365 super admin. No application in the organisation
9887
+ * calls it today, so restricting it breaks nothing that exists.
9888
+ */
9609
9889
  declare function useNotificationController(): {
9610
9890
  add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
9611
9891
  getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
@@ -9614,4 +9894,20 @@ declare function useNotificationController(): {
9614
9894
  getUnreadCount: (req: Request, res: Response, next: NextFunction) => Promise<void>;
9615
9895
  };
9616
9896
 
9617
- export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BidStatus, BidType, BuildingLevelStatus, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, CAMERA_ANPR_PERMISSIONS, CAMERA_CAPABILITIES, CAMERA_CAPABILITY_REASONS, CAMERA_NOT_PATROL_OR_CCTV, CAMERA_PTZ_PERMISSIONS, CAMERA_REQUEST_TIMEOUT_MS, CAMERA_RTSP_TIMEOUT_MS, CAMERA_SETUP_PERMISSIONS, CAMERA_SNAPSHOT_CACHE_SECONDS, CAMERA_SNAPSHOT_MAX_BYTES, CAMERA_TEST_MIN_INTERVAL_SECONDS, CAMERA_TEST_ROUND_LIMIT, CAMERA_TEST_ROUND_SECONDS, CAMERA_TYPE_ANPR, CAMERA_TYPE_IP, CAMERA_VIEW_PERMISSIONS, CLOCK_DRIFT_WARN_SECONDS, CURRENT_TIME_ENDPOINT, Camera, CameraAddressInput, CameraCapability, CameraCapabilityContext, CameraCapabilityDescriptor, CameraCapabilityEntry, CameraCapabilityReason, CameraCapabilityState, CameraCapabilityTrace, CameraDevice, CameraMembership, CameraTestStatus, CameraTransport, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, DeviceHttpTarget, DeviceProbeResult, DynamicFormFields, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, FormEntryStatus, GuestSort, GuestStatus, HID_PERMISSION_CATEGORIES, IAccessCard, IAccessCardTransaction, MAX_CAMERA_CHANNEL, 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, MHidSipAccount, 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, MSubscriptionPlan, 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, THidSipAccount, 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, TRANSPORT_DEVICE_HTTP, TRANSPORT_RELAY_PLAYER, TRANSPORT_RTSP_FRAME, 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, TSubscriptionPlan, TSubscriptionPlanApplication, 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, allowedPlanApplications, attendanceSchema, attendanceSettingsSchema, building_level_namespace_collection, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, cameraBaseUrl, cameraCapabilitiesFor, cameraDevices, cameraGrant, cameraHealthSummary, cameraManagePermissions, cameraTransports, chatPrelovedEvents, chatSchema, clampPtzSpeed, clockDriftSeconds, createManpowerRemarksDaily, customerSchema, deriveCameraHost, describeCameraCapabilities, designationsSchema, deviceControlEnabled, deviceHttpEnabled, deviceHttpTargets, deviceHttpTimeoutMs, deviceProbeTtlSeconds, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, ffmpegFrameArgs, ffmpegPath, formatCapabilityTrace, formatDahuaDate, guests_namespace_collection, hasAnyCapability, hasAnyPermission, incidentReport, incidentReportLog, incidents_namespace_collection, isCameraEntitled, isPatrolCctvCamera, isRelayPlayerUrl, logCamera, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, mapWithLimit, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, online_forms_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseCameraChannel, parseCameraHost, parseDahuaFind, parseDeviceTime, parseSoftwareVersion, promoCodeSchema, ptzEndpoint, publicCameraFields, registerCameraTransport, relayForRecorder, remarksSchema, resetCameraTransports, residentAppModuleKeys, residentFormEntry, resolutionRefusalReason, resolveCamera, resolveDeviceHttp, 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, schemaHidAmicoUserImageUploadQuery, schemaHidAmicoVisitorImageParams, schemaHidAmicoVisitorImageUploadQuery, schemaHidAmicoVisitorQr, schemaHidPermissionCandidateQuery, schemaHidPermissionScopeQuery, schemaHidSipAccountRequest, 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, subscriptionPlanSchema, 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, useSubscriptionPlanController, useSubscriptionPlanRepo, 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 };
9897
+ /**
9898
+ * Is this person a Seven365 super admin?
9899
+ *
9900
+ * **Super admin is a membership, not an email address.** `createDefaultUser()`
9901
+ * seeds a role of `type: "admin"` and a `members` row of `type: "admin"` with no
9902
+ * organisation; the account behind it is whatever `DEFAULT_USER_EMAIL` is set to
9903
+ * in that environment (`admin@gmail.com` on staging, something else in
9904
+ * production). Gating on an email address would therefore pass on staging and
9905
+ * fail in production, and would break the day the account is rotated.
9906
+ *
9907
+ * Both halves are required — a `members` row of type "admin" whose role is also
9908
+ * of type "admin" — because staging carries a second role merely *named*
9909
+ * "Super Admin" that is an ordinary organisation role.
9910
+ */
9911
+ declare function isSuperAdmin(userId?: string | ObjectId | null): Promise<boolean>;
9912
+
9913
+ export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BidStatus, BidType, BuildingLevelStatus, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, CAMERA_ANPR_PERMISSIONS, CAMERA_CAPABILITIES, CAMERA_CAPABILITY_REASONS, CAMERA_NOT_PATROL_OR_CCTV, CAMERA_PTZ_PERMISSIONS, CAMERA_REQUEST_TIMEOUT_MS, CAMERA_RTSP_TIMEOUT_MS, CAMERA_SETUP_PERMISSIONS, CAMERA_SNAPSHOT_CACHE_SECONDS, CAMERA_SNAPSHOT_MAX_BYTES, CAMERA_TEST_MIN_INTERVAL_SECONDS, CAMERA_TEST_ROUND_LIMIT, CAMERA_TEST_ROUND_SECONDS, CAMERA_TYPE_ANPR, CAMERA_TYPE_IP, CAMERA_VIEW_PERMISSIONS, CLOCK_DRIFT_WARN_SECONDS, CURRENT_TIME_ENDPOINT, Camera, CameraAddressInput, CameraCapability, CameraCapabilityContext, CameraCapabilityDescriptor, CameraCapabilityEntry, CameraCapabilityReason, CameraCapabilityState, CameraCapabilityTrace, CameraDevice, CameraMembership, CameraTestStatus, CameraTransport, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, DeviceHttpTarget, DeviceProbeResult, DynamicFormFields, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, FormEntryStatus, GuestSort, GuestStatus, HID_PERMISSION_CATEGORIES, IAccessCard, IAccessCardTransaction, InviteActor, MAX_CAMERA_CHANNEL, 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, MHidSipAccount, 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, MSubscriptionPlan, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, NotificationAppSlug, NotificationModule, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PATROL_CCTV_CAMERA_FILTER, PERSON_TYPES, PROPERTY_MANAGEMENT_MEMBER_TYPES, PStatus, PTZ_ALLOWED_ACTIONS, PTZ_ALLOWED_CODES, Period, PersonStatus, PersonType, PersonTypes, PostOrder, PostSort, PostStatus, QrTagProps, ResidentAppModuleKey, SERVICE_PROVIDER_INVITE_LABELS, SERVICE_PROVIDER_INVITE_TRANSITIONS, SERVICE_PROVIDER_SIGN_IN_SUBJECT, SERVICE_PROVIDER_SIGN_IN_TYPE, SERVICE_PROVIDER_SIGN_UP_SUBJECT, SERVICE_PROVIDER_SIGN_UP_TYPE, SOFTWARE_VERSION_ENDPOINT, ServiceProviderInviteAction, ServiceProviderInviteDecision, ServiceProviderInviteFacts, 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, THidSipAccount, 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, TRANSPORT_DEVICE_HTTP, TRANSPORT_RELAY_PLAYER, TRANSPORT_RTSP_FRAME, 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, TSubscriptionPlan, TSubscriptionPlanApplication, TUnitBilling, TUnits, TUpdateFormEntry, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationEvent, TVerificationMetadata, TVerificationMetadataV2, TVerificationV2, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, UserStatus, VERIFICATION_OPEN_STATUSES, VehicleCategory, VehicleOrder, VehicleSort, VehicleStatus, VehicleType, VerificationLinkType, VerificationStatus, VerificationSubjectType, VerificationType, VisitorSort, VisitorStatus, addressSchema, allowedFieldsSite, allowedNatures, allowedPlanApplications, attendanceSchema, attendanceSettingsSchema, building_level_namespace_collection, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, cameraBaseUrl, cameraCapabilitiesFor, cameraDevices, cameraGrant, cameraHealthSummary, cameraManagePermissions, cameraTransports, chatPrelovedEvents, chatSchema, clampPtzSpeed, clockDriftSeconds, createManpowerRemarksDaily, customerSchema, decideServiceProviderInvite, deriveCameraHost, describeCameraCapabilities, designationsSchema, deviceControlEnabled, deviceHttpEnabled, deviceHttpTargets, deviceHttpTimeoutMs, deviceProbeTtlSeconds, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, ffmpegFrameArgs, ffmpegPath, formatCapabilityTrace, formatDahuaDate, guests_namespace_collection, hasAnyCapability, hasAnyPermission, incidentReport, incidentReportLog, incidents_namespace_collection, isCameraEntitled, isPatrolCctvCamera, isRelayPlayerUrl, isSuperAdmin, logCamera, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, mapWithLimit, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, online_forms_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseCameraChannel, parseCameraHost, parseDahuaFind, parseDeviceTime, parseSoftwareVersion, promoCodeSchema, ptzEndpoint, publicCameraFields, refuseServiceProviderInviteAction, registerCameraTransport, relayForRecorder, remarksSchema, resetCameraTransports, residentAppModuleKeys, residentFormEntry, resolutionRefusalReason, resolveCamera, resolveDeviceHttp, resolveInviteActor, 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, schemaHidAmicoUserImageUploadQuery, schemaHidAmicoVisitorImageParams, schemaHidAmicoVisitorImageUploadQuery, schemaHidAmicoVisitorQr, schemaHidPermissionCandidateQuery, schemaHidPermissionScopeQuery, schemaHidSipAccountRequest, 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, serviceProviderInviteLabel, sessionSchema, shiftSchema, siteSchema, site_people_namespace_collection, snapshotEndpoint, snapshotRefusalReason, subscriptionPlanSchema, 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, useServiceProviderInviteController, useServiceProviderInviteService, 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, useSubscriptionPlanController, useSubscriptionPlanRepo, 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 };