@7365admin1/core 3.100.1 → 3.102.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -494,6 +494,7 @@ __export(src_exports, {
494
494
  notificationCategory: () => notificationCategory,
495
495
  notificationCategoryLabel: () => notificationCategoryLabel,
496
496
  notificationEvents: () => notificationEvents,
497
+ notificationKind: () => notificationKind,
497
498
  notificationRoom: () => notificationRoom,
498
499
  notifyAccessMode: () => notifyAccessMode,
499
500
  notifyRobotFault: () => notifyRobotFault,
@@ -1018,6 +1019,7 @@ __export(src_exports, {
1018
1019
  wallsFromOccupancyGrid: () => wallsFromOccupancyGrid,
1019
1020
  waypointsFor: () => waypointsFor,
1020
1021
  withLiveLink: () => withLiveLink,
1022
+ withNotificationKind: () => withNotificationKind,
1021
1023
  workOrderSchema: () => workOrderSchema,
1022
1024
  work_orders2_namespace_collection: () => work_orders2_namespace_collection,
1023
1025
  work_orders_namespace_collection: () => work_orders_namespace_collection
@@ -8344,6 +8346,7 @@ function useVerificationRepoV2() {
8344
8346
  statuses = [],
8345
8347
  orgIds,
8346
8348
  email = "",
8349
+ siteId = "",
8347
8350
  search = "",
8348
8351
  includeDeleted = false,
8349
8352
  page = 1,
@@ -8362,6 +8365,12 @@ function useVerificationRepoV2() {
8362
8365
  query2.status = { $in: statuses };
8363
8366
  if (email)
8364
8367
  query2.email = email.trim().toLowerCase();
8368
+ if (siteId) {
8369
+ const ids2 = [siteId];
8370
+ if (import_mongodb22.ObjectId.isValid(siteId))
8371
+ ids2.push(new import_mongodb22.ObjectId(siteId));
8372
+ query2["metadata.siteId"] = { $in: ids2 };
8373
+ }
8365
8374
  if (!includeDeleted)
8366
8375
  query2.deletedAt = null;
8367
8376
  if (search.trim()) {
@@ -8532,6 +8541,91 @@ function MCustomerSite(value) {
8532
8541
  // src/repositories/customer-site.repo.ts
8533
8542
  var import_mongodb24 = require("mongodb");
8534
8543
  var import_joi13 = __toESM(require("joi"));
8544
+
8545
+ // src/utils/customer-site-list.util.ts
8546
+ var SITE_RELATIONSHIPS = ["own", "served"];
8547
+ var SP_INVITE_TYPES = [
8548
+ "service-provider-invite",
8549
+ "service-provider-create-org"
8550
+ ];
8551
+ function escapeRegex(value) {
8552
+ return String(value ?? "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8553
+ }
8554
+ function relationshipMatch(org, relationship, client) {
8555
+ const self = [org, String(org)];
8556
+ const match = {};
8557
+ const and = [];
8558
+ if (relationship === "own") {
8559
+ and.push({ siteOrg: { $in: [...self, null, ""] } });
8560
+ } else if (relationship === "served") {
8561
+ and.push({ siteOrg: { $nin: [...self, null, ""] } });
8562
+ }
8563
+ if (client) {
8564
+ and.push(
8565
+ { siteOrg: { $in: [client, String(client)] } },
8566
+ { siteOrg: { $nin: self } }
8567
+ );
8568
+ }
8569
+ if (and.length)
8570
+ match.$and = and;
8571
+ return match;
8572
+ }
8573
+ function relationshipField(orgId) {
8574
+ return {
8575
+ relationship: {
8576
+ $cond: [
8577
+ {
8578
+ $or: [
8579
+ { $in: [{ $ifNull: ["$siteOrg", ""] }, ["", null]] },
8580
+ { $eq: [{ $toString: "$siteOrg" }, orgId] }
8581
+ ]
8582
+ },
8583
+ "own",
8584
+ "served"
8585
+ ]
8586
+ }
8587
+ };
8588
+ }
8589
+ function searchMatch(search) {
8590
+ const term = String(search ?? "").trim();
8591
+ if (!term)
8592
+ return null;
8593
+ const re = { $regex: escapeRegex(term), $options: "i" };
8594
+ return {
8595
+ $or: [
8596
+ { name: re },
8597
+ { siteOrgName: re },
8598
+ { "siteAddress.line1": re },
8599
+ { "siteAddress.line2": re },
8600
+ { "siteAddress.city": re },
8601
+ { "siteAddress.postalCode": re },
8602
+ { "siteAddress.country": re }
8603
+ ]
8604
+ };
8605
+ }
8606
+ var iso = (value) => {
8607
+ if (!value)
8608
+ return null;
8609
+ const d = new Date(value);
8610
+ return Number.isNaN(d.getTime()) ? null : d.toISOString();
8611
+ };
8612
+ function invitationFor(siteId, invites) {
8613
+ const mine = invites.filter((v2) => String(v2?.metadata?.siteId ?? "") === siteId).sort(
8614
+ (a, b) => new Date(b.createdAt ?? 0).getTime() - new Date(a.createdAt ?? 0).getTime()
8615
+ );
8616
+ const v = mine[0];
8617
+ if (!v)
8618
+ return null;
8619
+ const accepted = [...v.history ?? []].reverse().find((h) => h?.action === "accepted" || h?.action === "site-linked");
8620
+ return {
8621
+ id: String(v._id ?? ""),
8622
+ invitedByName: String(v.metadata?.invitedByName ?? ""),
8623
+ invitedAt: iso(v.createdAt),
8624
+ acceptedAt: iso(accepted?.at)
8625
+ };
8626
+ }
8627
+
8628
+ // src/repositories/customer-site.repo.ts
8535
8629
  function useCustomerSiteRepo() {
8536
8630
  const db2 = import_node_server_utils26.useAtlas.getDb();
8537
8631
  if (!db2) {
@@ -8539,6 +8633,7 @@ function useCustomerSiteRepo() {
8539
8633
  }
8540
8634
  const namespace_collection3 = "customer.sites";
8541
8635
  const collection = db2.collection(namespace_collection3);
8636
+ const verifications = db2.collection("verifications");
8542
8637
  const { delNamespace, getCache, setCache } = (0, import_node_server_utils26.useCache)(namespace_collection3);
8543
8638
  async function createIndexes() {
8544
8639
  try {
@@ -8628,7 +8723,10 @@ function useCustomerSiteRepo() {
8628
8723
  sort = {},
8629
8724
  org = "",
8630
8725
  status = "active",
8631
- siteScope = null
8726
+ siteScope = null,
8727
+ relationship = "",
8728
+ client = "",
8729
+ category = ""
8632
8730
  }, session) {
8633
8731
  page = page > 0 ? page - 1 : 0;
8634
8732
  try {
@@ -8640,6 +8738,14 @@ function useCustomerSiteRepo() {
8640
8738
  org,
8641
8739
  status
8642
8740
  };
8741
+ let clientId = null;
8742
+ if (client) {
8743
+ try {
8744
+ clientId = new import_mongodb24.ObjectId(client);
8745
+ } catch (error) {
8746
+ throw new import_node_server_utils26.BadRequestError("Invalid client ID format.");
8747
+ }
8748
+ }
8643
8749
  sort = Object.keys(sort).length > 0 ? sort : { _id: -1 };
8644
8750
  const cacheOptions = {
8645
8751
  org: org.toString(),
@@ -8656,6 +8762,12 @@ function useCustomerSiteRepo() {
8656
8762
  if (search) {
8657
8763
  cacheOptions.search = search;
8658
8764
  }
8765
+ if (relationship)
8766
+ cacheOptions.relationship = relationship;
8767
+ if (client)
8768
+ cacheOptions.client = client;
8769
+ if (category)
8770
+ cacheOptions.category = category;
8659
8771
  const cacheKey = (0, import_node_server_utils26.makeCacheKey)(namespace_collection3, cacheOptions);
8660
8772
  const cachedData = await getCache(cacheKey);
8661
8773
  if (cachedData) {
@@ -8663,8 +8775,14 @@ function useCustomerSiteRepo() {
8663
8775
  return cachedData;
8664
8776
  }
8665
8777
  try {
8778
+ const orgId = org.toString();
8779
+ const search_ = searchMatch(search);
8780
+ const listMatch = {
8781
+ ...query2,
8782
+ ...relationshipMatch(org, relationship, clientId)
8783
+ };
8666
8784
  const distinctPipeline = [
8667
- { $match: query2 },
8785
+ { $match: listMatch },
8668
8786
  { $sort: sort },
8669
8787
  { $group: { _id: "$site", doc: { $first: "$$ROOT" } } },
8670
8788
  { $replaceRoot: { newRoot: "$doc" } },
@@ -8681,8 +8799,22 @@ function useCustomerSiteRepo() {
8681
8799
  // The site's own timezone, so the Edit Site form opens on the zone the
8682
8800
  // site really has. Lives only on the site, never on this row.
8683
8801
  { $set: { timezone: "$_liveSite.timezone" } },
8802
+ /*
8803
+ * The Sites list's columns. Address and category come from the SITE,
8804
+ * like the name: a served site's engagement row was written by the
8805
+ * invitation with neither. The row's own `address` / `category` are
8806
+ * left exactly as they were for every other caller.
8807
+ */
8808
+ {
8809
+ $set: {
8810
+ siteAddress: { $ifNull: ["$_liveSite.address", "$address"] },
8811
+ siteCategory: { $ifNull: ["$_liveSite.category", "$category"] },
8812
+ ...relationshipField(orgId)
8813
+ }
8814
+ },
8684
8815
  { $unset: "_liveSite" },
8685
- ...search ? [{ $match: { name: { $regex: search, $options: "i" } } }] : [],
8816
+ ...search_ ? [{ $match: search_ }] : [],
8817
+ ...category ? [{ $match: { siteCategory: category } }] : [],
8686
8818
  { $sort: sort }
8687
8819
  ];
8688
8820
  const items = await collection.aggregate(
@@ -8695,7 +8827,54 @@ function useCustomerSiteRepo() {
8695
8827
  ).toArray();
8696
8828
  const countResult = await collection.aggregate([...distinctPipeline, { $count: "total" }], { session }).toArray();
8697
8829
  const length = countResult[0]?.total ?? 0;
8698
- const data = (0, import_node_server_utils26.paginate)(items, page, limit, length);
8830
+ const servedSites = items.filter((row) => row.relationship === "served" && row.site).map((row) => row.site);
8831
+ if (servedSites.length) {
8832
+ const invites = await verifications.find(
8833
+ {
8834
+ type: { $in: SP_INVITE_TYPES },
8835
+ status: "complete",
8836
+ "metadata.providerOrg": { $in: [orgId, org] },
8837
+ "metadata.siteId": {
8838
+ $in: [...servedSites, ...servedSites.map(String)]
8839
+ }
8840
+ },
8841
+ {
8842
+ projection: {
8843
+ createdAt: 1,
8844
+ history: 1,
8845
+ "metadata.siteId": 1,
8846
+ "metadata.invitedByName": 1
8847
+ },
8848
+ session
8849
+ }
8850
+ ).toArray().catch((error) => {
8851
+ import_node_server_utils26.logger.error(
8852
+ `Sites list: invitation lookup failed: ${error?.message}`
8853
+ );
8854
+ return [];
8855
+ });
8856
+ for (const row of items) {
8857
+ if (row.relationship === "served") {
8858
+ row.invitation = invitationFor(String(row.site), invites);
8859
+ }
8860
+ }
8861
+ }
8862
+ const clients = await collection.aggregate(
8863
+ [
8864
+ { $match: { ...query2, ...relationshipMatch(org, "served") } },
8865
+ { $sort: { _id: -1 } },
8866
+ { $group: { _id: "$siteOrg", name: { $first: "$siteOrgName" } } },
8867
+ { $sort: { name: 1 } }
8868
+ ],
8869
+ { session }
8870
+ ).toArray();
8871
+ const data = {
8872
+ ...(0, import_node_server_utils26.paginate)(items, page, limit, length),
8873
+ clients: clients.map((c) => ({
8874
+ _id: String(c._id),
8875
+ name: c.name ?? ""
8876
+ }))
8877
+ };
8699
8878
  setCache(cacheKey, data, 15 * 60).then(() => {
8700
8879
  import_node_server_utils26.logger.info(`Cache set for key: ${cacheKey}`);
8701
8880
  }).catch((err) => {
@@ -11321,6 +11500,26 @@ async function filterByAccess(userIds, context, data) {
11321
11500
  }
11322
11501
  }
11323
11502
 
11503
+ // src/utils/notification-kind.util.ts
11504
+ var NOT_A_KIND = /* @__PURE__ */ new Set(["", "other", "platform"]);
11505
+ function notificationKind(data, category) {
11506
+ if (data?.kind)
11507
+ return String(data.kind);
11508
+ const module2 = String(data?.module ?? "");
11509
+ if (!NOT_A_KIND.has(module2))
11510
+ return module2;
11511
+ const fromCategory = String(category ?? "");
11512
+ return NOT_A_KIND.has(fromCategory) ? "" : fromCategory;
11513
+ }
11514
+ function withNotificationKind(data, category) {
11515
+ if (!data?.params?.id)
11516
+ return data;
11517
+ const kind = notificationKind(data, category);
11518
+ if (!kind)
11519
+ return data;
11520
+ return { ...data, params: { ...data.params, kind } };
11521
+ }
11522
+
11324
11523
  // src/services/notification.service.ts
11325
11524
  var { addMany: _addNotification } = useNotificationRepo();
11326
11525
  var { filterRecipients: _filterRecipients } = useNotificationPreferenceRepo();
@@ -11331,6 +11530,7 @@ function toStringArray(recipient) {
11331
11530
  async function send(userIds, title, body, data, isForMAMobileApp = false, appSlug, category) {
11332
11531
  try {
11333
11532
  const key = category || data?.module || "other";
11533
+ data = withNotificationKind(data, category);
11334
11534
  userIds = await filterByAccess(userIds, { category: key, siteId: data?.siteId });
11335
11535
  const inAppIds = await _filterRecipients(userIds, key, "inApp");
11336
11536
  if (inAppIds.length) {
@@ -11421,6 +11621,7 @@ var NotificationService = class {
11421
11621
  `${what} is now on iService365.`,
11422
11622
  {
11423
11623
  module: "platform",
11624
+ kind: "client",
11424
11625
  screen: "",
11425
11626
  params: { id: payload.orgId.toString() }
11426
11627
  },
@@ -11462,7 +11663,7 @@ var NotificationService = class {
11462
11663
  staff,
11463
11664
  title,
11464
11665
  body,
11465
- { module: "platform", screen: "", params: { id: payload.robotId } },
11666
+ { module: "platform", kind: "robot", screen: "", params: { id: payload.robotId } },
11466
11667
  false,
11467
11668
  void 0,
11468
11669
  "platform"
@@ -11477,7 +11678,7 @@ var NotificationService = class {
11477
11678
  staff,
11478
11679
  title,
11479
11680
  body,
11480
- { module: "platform", screen: "", params: { id: payload.robotId } },
11681
+ { module: "platform", kind: "robot", screen: "", params: { id: payload.robotId } },
11481
11682
  false,
11482
11683
  void 0,
11483
11684
  "platform"
@@ -11676,7 +11877,13 @@ var NotificationService = class {
11676
11877
  toStringArray(payload.to),
11677
11878
  `${payload.providerName} ${verb} your invitation`,
11678
11879
  payload.accepted ? `${payload.providerName} accepted your invitation to provide services at ${payload.siteName}. They can now see the site in their own app.` : `${payload.providerName} declined your invitation to provide services at ${payload.siteName}.`,
11679
- { module: "other", screen: "" },
11880
+ {
11881
+ module: "other",
11882
+ kind: "serviceProviderInviteAnswer",
11883
+ screen: "",
11884
+ // `site`, not `siteId`: the row stays unscoped on purpose (see above).
11885
+ ...payload.invitationId ? { params: { id: payload.invitationId, ...payload.siteId ? { site: payload.siteId } : {} } } : {}
11886
+ },
11680
11887
  false,
11681
11888
  void 0,
11682
11889
  "serviceProviderInvite"
@@ -11743,7 +11950,10 @@ var NotificationService = class {
11743
11950
  body: `${which} has been ${payload.action} on your site's emergency contact list. Check the number is right before it is needed.`,
11744
11951
  data: {
11745
11952
  contactId: payload.contactId?.toString(),
11746
- action: payload.action
11953
+ action: payload.action,
11954
+ // The page is the site's contact list, so the site stands in when a
11955
+ // removed contact has no id left to name.
11956
+ params: payload.contactId || payload.siteId ? { id: (payload.contactId ?? payload.siteId).toString() } : void 0
11747
11957
  }
11748
11958
  });
11749
11959
  }
@@ -13428,6 +13638,7 @@ function useServiceProviderInviteService() {
13428
13638
  async function listForCaller({
13429
13639
  userId,
13430
13640
  orgId,
13641
+ siteId,
13431
13642
  statuses,
13432
13643
  search = "",
13433
13644
  page = 1,
@@ -13448,16 +13659,85 @@ function useServiceProviderInviteService() {
13448
13659
  // A super admin asking for everything passes no scope; everyone else is
13449
13660
  // pinned to their own organisations even if they ask for more.
13450
13661
  orgIds: staffMayBypass(actor) && !orgId ? void 0 : scope,
13662
+ siteId: siteId || void 0,
13451
13663
  search,
13452
13664
  page,
13453
13665
  limit
13454
13666
  });
13667
+ const names = /* @__PURE__ */ new Map();
13668
+ const items = await Promise.all(
13669
+ (data.items ?? []).map(
13670
+ (invite) => sentRow(invite, names)
13671
+ )
13672
+ );
13673
+ return { ...data, items };
13674
+ }
13675
+ async function sentRow(invite, names) {
13676
+ const metadata = invite.metadata ?? {};
13677
+ const status = serviceProviderInviteViewStatus(invite);
13678
+ const accepted = status === "complete" /* COMPLETE */ && !invite.deletedAt;
13679
+ const siteId = metadata.siteId?.toString?.() ?? "";
13680
+ const history = invite.history ?? [];
13681
+ const answer = [...history].reverse().find(
13682
+ (h) => ["accepted", "site-linked", "declined", "cancelled", "rejected"].includes(h?.action)
13683
+ );
13684
+ let providerOrgId = metadata.providerOrg?.toString?.() ?? "";
13685
+ let providerOrgName = String(metadata.providerOrgName ?? "");
13686
+ if (accepted && !providerOrgId) {
13687
+ const byEmail = await getOrgByEmail(
13688
+ String(invite.email ?? "").trim().toLowerCase()
13689
+ ).catch(() => null);
13690
+ providerOrgId = byEmail?._id?.toString?.() ?? "";
13691
+ providerOrgName = byEmail?.name ?? "";
13692
+ }
13693
+ let contactEmail = "";
13694
+ let contactPhone = "";
13695
+ let onSite = false;
13696
+ if (accepted && providerOrgId) {
13697
+ const [org, links] = await Promise.all([
13698
+ getOrgById(providerOrgId).catch(() => null),
13699
+ siteId ? useCustomerSiteRepo().countActiveByOrgAndSite(providerOrgId, siteId).catch(() => 0) : Promise.resolve(0)
13700
+ ]);
13701
+ providerOrgName = providerOrgName || org?.name || "";
13702
+ contactEmail = String(org?.email ?? "");
13703
+ contactPhone = String(org?.contact ?? "");
13704
+ onSite = links > 0;
13705
+ }
13706
+ const invitedBy = metadata.invitedBy?.toString?.() ?? "";
13707
+ let invitedByName = String(metadata.invitedByName ?? "");
13708
+ if (!invitedByName && invitedBy) {
13709
+ if (!names.has(invitedBy)) {
13710
+ names.set(
13711
+ invitedBy,
13712
+ getUserById(invitedBy).then((u) => String(u?.name ?? "")).catch(() => "")
13713
+ );
13714
+ }
13715
+ invitedByName = await names.get(invitedBy);
13716
+ }
13717
+ const companyName = providerOrgName || String(metadata.name ?? "");
13455
13718
  return {
13456
- ...data,
13457
- items: (data.items ?? []).map((invite) => ({
13458
- ...invite,
13459
- statusLabel: serviceProviderInviteLabel(invite.status)
13460
- }))
13719
+ ...invite,
13720
+ // Apps still on an older layer-common read the company from
13721
+ // `metadata.name` (set only on sign-up invitations). Filled in the reply
13722
+ // only - nothing is written. ponytail: drop once every app's pin reads
13723
+ // `companyName`.
13724
+ metadata: { ...metadata, name: companyName },
13725
+ // `status` stays the stored value (it decides which actions a row
13726
+ // offers); `viewStatus` reads a lapsed "pending" as "expired".
13727
+ viewStatus: status,
13728
+ statusLabel: serviceProviderInviteLabel(status),
13729
+ // The company the invitation is for: the one that accepted it, else the
13730
+ // new company's name the sender typed (a sign-up invitation).
13731
+ companyName,
13732
+ providerOrgId,
13733
+ service: String(metadata.app ?? ""),
13734
+ siteName: String(metadata.siteName ?? ""),
13735
+ invitedByName,
13736
+ invitedAt: invite.createdAt ?? null,
13737
+ answeredAt: status === "expired" ? invite.expireAt ?? null : status === "pending" || status === "awaiting-approval" /* AWAITING_APPROVAL */ ? null : answer?.at ?? invite.updatedAt ?? null,
13738
+ contactEmail,
13739
+ contactPhone,
13740
+ onSite
13461
13741
  };
13462
13742
  }
13463
13743
  async function approvalCount({ userId }) {
@@ -13681,7 +13961,9 @@ function useServiceProviderInviteService() {
13681
13961
  to,
13682
13962
  accepted,
13683
13963
  providerName: providerName || providerOrg?.name || String(invite.email ?? ""),
13684
- siteName: invite.metadata?.siteName ?? "the site"
13964
+ siteName: invite.metadata?.siteName ?? "the site",
13965
+ invitationId: invite._id?.toString(),
13966
+ siteId: invite.metadata?.siteId?.toString?.()
13685
13967
  });
13686
13968
  } catch (error) {
13687
13969
  import_node_server_utils43.logger.log({
@@ -20204,7 +20486,7 @@ function useVehicleRepo() {
20204
20486
  let query2 = { ...baseQuery };
20205
20487
  if (search)
20206
20488
  query2.$text = { $search: search };
20207
- const escapeRegex2 = (input) => input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
20489
+ const escapeRegex3 = (input) => input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
20208
20490
  const buildGroupedPipeline = (matchQuery) => [
20209
20491
  { $match: matchQuery },
20210
20492
  {
@@ -20388,7 +20670,7 @@ function useVehicleRepo() {
20388
20670
  const countResult = await collection.aggregate(buildGroupedCountPipeline(query2)).toArray();
20389
20671
  length = countResult[0]?.total || 0;
20390
20672
  if ((!items || items.length === 0) && search) {
20391
- const escaped = escapeRegex2(search);
20673
+ const escaped = escapeRegex3(search);
20392
20674
  const regexQuery = {
20393
20675
  ...baseQuery,
20394
20676
  $or: [
@@ -21177,7 +21459,7 @@ function useVehicleRepo() {
21177
21459
  ...baseQuery,
21178
21460
  ...search && { $text: { $search: search } }
21179
21461
  };
21180
- const escapeRegex2 = (input) => input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
21462
+ const escapeRegex3 = (input) => input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
21181
21463
  const buildPipeline = (matchQuery) => [
21182
21464
  { $match: matchQuery },
21183
21465
  {
@@ -21205,7 +21487,7 @@ function useVehicleRepo() {
21205
21487
  const countResult = await collection.aggregate(buildCountPipeline(query2)).toArray();
21206
21488
  length = countResult[0]?.total || 0;
21207
21489
  if ((!items || items.length === 0) && search) {
21208
- const escaped = escapeRegex2(search);
21490
+ const escaped = escapeRegex3(search);
21209
21491
  const regexQuery = {
21210
21492
  ...baseQuery,
21211
21493
  $or: [
@@ -29366,9 +29648,9 @@ function parsePromoExpiry(value) {
29366
29648
  const us = raw.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
29367
29649
  if (us)
29368
29650
  return endOfDay(us[3], us[1], us[2]);
29369
- const iso = raw.match(/^(\d{4})-(\d{2})-(\d{2})$/);
29370
- if (iso)
29371
- return endOfDay(iso[1], iso[2], iso[3]);
29651
+ const iso2 = raw.match(/^(\d{4})-(\d{2})-(\d{2})$/);
29652
+ if (iso2)
29653
+ return endOfDay(iso2[1], iso2[2], iso2[3]);
29372
29654
  const parsed = new Date(raw);
29373
29655
  return Number.isNaN(parsed.getTime()) ? null : parsed;
29374
29656
  }
@@ -32571,7 +32853,7 @@ function useServiceProviderRepo() {
32571
32853
  throw new import_node_server_utils97.BadRequestError("Invalid site ID format.");
32572
32854
  }
32573
32855
  }
32574
- cacheOptions.membersLookup = "1";
32856
+ cacheOptions.membersLookup = "2";
32575
32857
  const cacheKey = (0, import_node_server_utils97.makeCacheKey)(namespace_collection3, cacheOptions);
32576
32858
  const cachedData = await getCache(cacheKey);
32577
32859
  if (cachedData) {
@@ -32587,7 +32869,7 @@ function useServiceProviderRepo() {
32587
32869
  localField: "serviceProviderOrgId",
32588
32870
  foreignField: "_id",
32589
32871
  as: "organization",
32590
- pipeline: [{ $project: { nature: 1, email: 1 } }]
32872
+ pipeline: [{ $project: { nature: 1, email: 1, contact: 1 } }]
32591
32873
  }
32592
32874
  },
32593
32875
  {
@@ -32599,11 +32881,19 @@ function useServiceProviderRepo() {
32599
32881
  {
32600
32882
  $lookup: {
32601
32883
  from: "members",
32602
- let: { spOrgId: "$serviceProviderOrgId" },
32884
+ // The provider's staff assigned to THIS site, not the provider's
32885
+ // whole headcount - the client has no business knowing how big
32886
+ // its contractor is, only who works on its estate.
32887
+ let: { spOrgId: "$serviceProviderOrgId", spSiteId: "$siteId" },
32603
32888
  pipeline: [
32604
32889
  {
32605
32890
  $match: {
32606
- $expr: { $eq: ["$org", "$$spOrgId"] },
32891
+ $expr: {
32892
+ $and: [
32893
+ { $eq: ["$org", "$$spOrgId"] },
32894
+ { $eq: ["$siteId", "$$spSiteId"] }
32895
+ ]
32896
+ },
32607
32897
  status: "active"
32608
32898
  }
32609
32899
  },
@@ -32626,6 +32916,7 @@ function useServiceProviderRepo() {
32626
32916
  }
32627
32917
  },
32628
32918
  nature: "$organization.nature",
32919
+ contact: { $ifNull: ["$organization.contact", ""] },
32629
32920
  orgId: 1,
32630
32921
  siteId: 1,
32631
32922
  siteName: 1,
@@ -32875,6 +33166,104 @@ function useServiceProviderRepo() {
32875
33166
  throw error;
32876
33167
  }
32877
33168
  }
33169
+ async function getEngagedProvidersBySite(site) {
33170
+ try {
33171
+ site = new import_mongodb72.ObjectId(site);
33172
+ } catch {
33173
+ throw new import_node_server_utils97.BadRequestError("Invalid site ID format.");
33174
+ }
33175
+ return await db2.collection("customer.sites").aggregate([
33176
+ {
33177
+ $match: {
33178
+ site,
33179
+ status: "active",
33180
+ // The client's own row for its own site is not a provider, and a
33181
+ // row that does not say whose site it is proves nothing.
33182
+ siteOrg: { $nin: [null, ""] },
33183
+ $expr: { $ne: ["$org", "$siteOrg"] }
33184
+ }
33185
+ },
33186
+ { $sort: { _id: 1 } },
33187
+ {
33188
+ $group: {
33189
+ _id: "$org",
33190
+ engagementId: { $first: "$_id" },
33191
+ siteName: { $first: "$name" },
33192
+ since: { $first: "$createdAt" }
33193
+ }
33194
+ },
33195
+ {
33196
+ $lookup: {
33197
+ from: "organizations",
33198
+ localField: "_id",
33199
+ foreignField: "_id",
33200
+ as: "organization",
33201
+ pipeline: [
33202
+ { $project: { name: 1, nature: 1, email: 1, contact: 1 } }
33203
+ ]
33204
+ }
33205
+ },
33206
+ { $unwind: { path: "$organization", preserveNullAndEmptyArrays: true } },
33207
+ {
33208
+ $lookup: {
33209
+ from: "members",
33210
+ let: { spOrgId: "$_id" },
33211
+ pipeline: [
33212
+ {
33213
+ $match: {
33214
+ $expr: { $eq: ["$org", "$$spOrgId"] },
33215
+ siteId: site,
33216
+ status: "active"
33217
+ }
33218
+ },
33219
+ { $count: "c" }
33220
+ ],
33221
+ as: "_memberCount"
33222
+ }
33223
+ },
33224
+ {
33225
+ $project: {
33226
+ _id: "$engagementId",
33227
+ name: { $ifNull: ["$organization.name", ""] },
33228
+ type: { $ifNull: ["$organization.nature", ""] },
33229
+ nature: "$organization.nature",
33230
+ email: { $ifNull: ["$organization.email", ""] },
33231
+ contact: { $ifNull: ["$organization.contact", ""] },
33232
+ siteId: site,
33233
+ siteName: 1,
33234
+ serviceProviderOrgId: "$_id",
33235
+ status: "active",
33236
+ category: "external",
33237
+ since: 1,
33238
+ source: "engagement",
33239
+ members: {
33240
+ $ifNull: [{ $arrayElemAt: ["$_memberCount.c", 0] }, 0]
33241
+ }
33242
+ }
33243
+ },
33244
+ { $sort: { name: 1 } },
33245
+ { $limit: 200 }
33246
+ ]).toArray();
33247
+ }
33248
+ async function getSiteProviderKeys(site) {
33249
+ try {
33250
+ site = new import_mongodb72.ObjectId(site);
33251
+ } catch {
33252
+ throw new import_node_server_utils97.BadRequestError("Invalid site ID format.");
33253
+ }
33254
+ const rows = await collection.find(
33255
+ { siteId: site },
33256
+ { projection: { serviceProviderOrgId: 1, email: 1 } }
33257
+ ).toArray();
33258
+ return {
33259
+ orgIds: new Set(
33260
+ rows.map((r) => r.serviceProviderOrgId?.toString?.() ?? "").filter(Boolean)
33261
+ ),
33262
+ emails: new Set(
33263
+ rows.map((r) => String(r.email ?? "").trim().toLowerCase()).filter(Boolean)
33264
+ )
33265
+ };
33266
+ }
32878
33267
  return {
32879
33268
  createTextIndex,
32880
33269
  createUniqueIndex,
@@ -32885,7 +33274,9 @@ function useServiceProviderRepo() {
32885
33274
  getServiceProviderById,
32886
33275
  getByServiceProviderOrgIdType,
32887
33276
  getByEmail,
32888
- updateStatusById
33277
+ updateStatusById,
33278
+ getEngagedProvidersBySite,
33279
+ getSiteProviderKeys
32889
33280
  };
32890
33281
  }
32891
33282
 
@@ -33605,7 +33996,9 @@ var import_node_server_utils102 = require("@7365admin1/node-server-utils");
33605
33996
  function useServiceProviderService() {
33606
33997
  const {
33607
33998
  createServiceProvider: _createServiceProvider,
33608
- getServiceProviders: _getServiceProviders
33999
+ getServiceProviders: _getServiceProviders,
34000
+ getEngagedProvidersBySite: _getEngaged,
34001
+ getSiteProviderKeys: _getSiteProviderKeys
33609
34002
  } = useServiceProviderRepo();
33610
34003
  const { getById: getOrgById, getByEmail: getOrgByEmail } = useOrgRepo();
33611
34004
  const { getSiteById } = useSiteRepo();
@@ -33685,9 +34078,40 @@ function useServiceProviderService() {
33685
34078
  status
33686
34079
  });
33687
34080
  }
34081
+ async function getServiceProvidersForSite({
34082
+ search = "",
34083
+ page = 1,
34084
+ limit = 10,
34085
+ siteId
34086
+ }) {
34087
+ const [engaged, keys] = await Promise.all([
34088
+ _getEngaged(siteId),
34089
+ _getSiteProviderKeys(siteId)
34090
+ ]);
34091
+ const needle = search.trim().toLowerCase();
34092
+ const derived = engaged.filter(
34093
+ (row) => !keys.orgIds.has(row.serviceProviderOrgId?.toString?.() ?? "") && !(row.email && keys.emails.has(String(row.email).trim().toLowerCase())) && (!needle || String(row.name ?? "").toLowerCase().includes(needle))
34094
+ );
34095
+ const stored = (p, l) => _getServiceProviders({ search, page: p, limit: l, siteId, status: "active" });
34096
+ if (!derived.length)
34097
+ return await stored(page, limit);
34098
+ const start = (Math.max(page, 1) - 1) * limit;
34099
+ const fromDerived = derived.slice(start, start + limit);
34100
+ const need = limit - fromDerived.length;
34101
+ const storedStart = Math.max(0, start - derived.length);
34102
+ const first = await stored(1, Math.max(storedStart + need, 1));
34103
+ const total = derived.length + totalOf(first);
34104
+ const fromStored = need > 0 ? (first?.items ?? []).slice(storedStart, storedStart + need) : [];
34105
+ return (0, import_node_server_utils102.paginate)([...fromDerived, ...fromStored], Math.max(page, 1) - 1, limit, total);
34106
+ }
34107
+ function totalOf(data) {
34108
+ const match = /of\s+(\d+)/.exec(String(data?.pageRange ?? ""));
34109
+ return match ? Number(match[1]) : (data?.items ?? []).length;
34110
+ }
33688
34111
  return {
33689
34112
  createServiceProvider,
33690
- getServiceProviders
34113
+ getServiceProviders,
34114
+ getServiceProvidersForSite
33691
34115
  };
33692
34116
  }
33693
34117
 
@@ -33702,7 +34126,18 @@ function useServiceProviderController() {
33702
34126
  getByEmail: _getByEmail,
33703
34127
  updateStatusById: _updateStatusById
33704
34128
  } = useServiceProviderRepo();
33705
- const { createServiceProvider: _createServiceProvider } = useServiceProviderService();
34129
+ const {
34130
+ createServiceProvider: _createServiceProvider,
34131
+ getServiceProvidersForSite: _getServiceProvidersForSite
34132
+ } = useServiceProviderService();
34133
+ async function isSiteClient(req, siteId) {
34134
+ const actor = await resolveInviteActor(callerId(req));
34135
+ if (staffMayBypass(actor))
34136
+ return true;
34137
+ const site = await useSiteRepo().getSiteById(siteId).catch(() => null);
34138
+ const owner = (site?.orgId ?? site?.org)?.toString?.() ?? "";
34139
+ return Boolean(owner) && actor.orgIds.includes(owner);
34140
+ }
33706
34141
  const { createServiceProvider: _add } = useServiceProviderRepo();
33707
34142
  async function createServiceProvider(req, res, next) {
33708
34143
  const validation = import_joi46.default.string().hex().required();
@@ -33731,7 +34166,12 @@ function useServiceProviderController() {
33731
34166
  orgId: import_joi46.default.string().hex().optional().allow("", null),
33732
34167
  siteId: import_joi46.default.string().hex().optional().allow("", null),
33733
34168
  serviceProviderOrgId: import_joi46.default.string().hex().optional().allow("", null),
33734
- status: import_joi46.default.string().optional().allow("", null)
34169
+ status: import_joi46.default.string().optional().allow("", null),
34170
+ // "engagements": also list providers engaged through an accepted
34171
+ // invitation. Opt-in, because those rows carry the engagement's id, not
34172
+ // a service-providers id - a caller that stores the id (the MA app's
34173
+ // feedback provider picker) must keep getting stored rows only.
34174
+ include: import_joi46.default.string().valid("engagements").optional().allow("", null)
33735
34175
  });
33736
34176
  const query2 = { ...req.query };
33737
34177
  const { error } = validation.validate(query2);
@@ -33748,7 +34188,9 @@ function useServiceProviderController() {
33748
34188
  const serviceProviderOrgId = req.query.serviceProviderOrgId ?? "";
33749
34189
  const status = req.query.status ?? "active";
33750
34190
  try {
33751
- const data = await _getServiceProviders({
34191
+ if (siteId)
34192
+ await requireSiteReach(req, siteId);
34193
+ const data = req.query.include === "engagements" && siteId && status === "active" && !orgId && !serviceProviderOrgId && await isSiteClient(req, siteId) ? await _getServiceProvidersForSite({ search, page, limit, siteId }) : await _getServiceProviders({
33752
34194
  search,
33753
34195
  page,
33754
34196
  limit,
@@ -43284,7 +43726,7 @@ function useCustomerSiteController() {
43284
43726
  }
43285
43727
  }
43286
43728
  async function getAll(req, res, next) {
43287
- const allowedFields = ["createdAt", "name"];
43729
+ const allowedFields = ["createdAt", "name", "siteOrgName"];
43288
43730
  const allowedOrder = ["asc", "desc"];
43289
43731
  const validation = import_joi61.default.object({
43290
43732
  search: import_joi61.default.string().optional().allow("", null),
@@ -43293,7 +43735,13 @@ function useCustomerSiteController() {
43293
43735
  sort: import_joi61.default.string().pattern(/^([a-zA-Z0-9_]+)(,[a-zA-Z0-9_]+)*$/).optional().allow("", ...allowedFields),
43294
43736
  order: import_joi61.default.string().pattern(/^(asc|desc)(,(asc|desc))*$/).optional().allow("", ...allowedOrder),
43295
43737
  org: import_joi61.default.string().hex().required(),
43296
- status: import_joi61.default.string().required()
43738
+ status: import_joi61.default.string().required(),
43739
+ // The Organization app's Sites list filters. All optional: every other
43740
+ // caller (site switchers, mobile pickers) sends none of them and gets
43741
+ // exactly the list it got before.
43742
+ relationship: import_joi61.default.string().valid(...SITE_RELATIONSHIPS).optional().allow("", null),
43743
+ client: import_joi61.default.string().hex().length(24).optional().allow("", null),
43744
+ category: import_joi61.default.string().valid(...Object.values(SiteCategories)).optional().allow("", null)
43297
43745
  });
43298
43746
  const query2 = { ...req.query };
43299
43747
  const { error } = validation.validate(query2);
@@ -43307,6 +43755,9 @@ function useCustomerSiteController() {
43307
43755
  const limit = parseInt(req.query.limit ?? "10");
43308
43756
  const org = req.query.org ?? "";
43309
43757
  const status = req.query.status ?? "active";
43758
+ const relationship = req.query.relationship || "";
43759
+ const client = req.query.client || "";
43760
+ const category = req.query.category || "";
43310
43761
  const sortObj = {};
43311
43762
  const sortFields = String(req.query.sort).split(",");
43312
43763
  const sortOrders = String(req.query.order).split(",");
@@ -43326,7 +43777,10 @@ function useCustomerSiteController() {
43326
43777
  sort: sortObj,
43327
43778
  org,
43328
43779
  status,
43329
- siteScope
43780
+ siteScope,
43781
+ relationship,
43782
+ client,
43783
+ category
43330
43784
  });
43331
43785
  res.json(data);
43332
43786
  return;
@@ -45314,7 +45768,7 @@ function usePersonService() {
45314
45768
  let set = {};
45315
45769
  const cleanInput = (str) => str.replace(/\s+/g, "");
45316
45770
  const cleanPhone = (str) => str.replace(/\D/g, "");
45317
- const escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
45771
+ const escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
45318
45772
  const nric = value.nric ? cleanInput(value.nric) : "";
45319
45773
  const name = value.name?.trim();
45320
45774
  const contact = value.contact?.trim();
@@ -45322,8 +45776,8 @@ function usePersonService() {
45322
45776
  const email = value.email?.trim();
45323
45777
  const type = value.type?.trim();
45324
45778
  const company = value.company?.trim();
45325
- const nricQuery = nric ? { nric: { $regex: `^${escapeRegex2(nric)}$`, $options: "i" } } : null;
45326
- const nameQuery = name ? { name: { $regex: `^${escapeRegex2(name)}$`, $options: "i" } } : null;
45779
+ const nricQuery = nric ? { nric: { $regex: `^${escapeRegex3(nric)}$`, $options: "i" } } : null;
45780
+ const nameQuery = name ? { name: { $regex: `^${escapeRegex3(name)}$`, $options: "i" } } : null;
45327
45781
  let nricCondition = null;
45328
45782
  if (nric) {
45329
45783
  if (nric.length < 9) {
@@ -45336,8 +45790,8 @@ function usePersonService() {
45336
45790
  }
45337
45791
  const orConditions = [
45338
45792
  ...nricCondition ? [nricCondition] : [],
45339
- ...contact ? [{ contacts: { $regex: `^\\+?${cleanPhone(escapeRegex2(contact))}$`, $options: "i" } }] : [],
45340
- ...plateNumber ? [{ plateNumbers: { $regex: `^${escapeRegex2(plateNumber)}$`, $options: "i" } }] : []
45793
+ ...contact ? [{ contacts: { $regex: `^\\+?${cleanPhone(escapeRegex3(contact))}$`, $options: "i" } }] : [],
45794
+ ...plateNumber ? [{ plateNumbers: { $regex: `^${escapeRegex3(plateNumber)}$`, $options: "i" } }] : []
45341
45795
  ];
45342
45796
  const existingPerson2 = await findFirstTen(
45343
45797
  {
@@ -47224,7 +47678,7 @@ function useHidAmicoRepo() {
47224
47678
  passwordSet: Boolean(password)
47225
47679
  };
47226
47680
  }
47227
- function escapeRegex2(value) {
47681
+ function escapeRegex3(value) {
47228
47682
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
47229
47683
  }
47230
47684
  function buildIdentityKeyQuery(value) {
@@ -47427,7 +47881,7 @@ function useHidAmicoRepo() {
47427
47881
  query2.type = value.type;
47428
47882
  }
47429
47883
  if (value.search) {
47430
- const search = escapeRegex2(value.search);
47884
+ const search = escapeRegex3(value.search);
47431
47885
  query2.$or = [
47432
47886
  { hidUserId: { $regex: search, $options: "i" } },
47433
47887
  { registration: { $regex: search, $options: "i" } },
@@ -47668,7 +48122,7 @@ function useHidAmicoRepo() {
47668
48122
  const text2 = search.trim();
47669
48123
  if (!text2)
47670
48124
  return {};
47671
- const pattern = { $regex: escapeRegex2(text2), $options: "i" };
48125
+ const pattern = { $regex: escapeRegex3(text2), $options: "i" };
47672
48126
  return {
47673
48127
  $or: [
47674
48128
  { name: pattern },
@@ -60046,7 +60500,7 @@ var NETWORK_SORTS = {
60046
60500
  };
60047
60501
  var NETWORK_OFFLINE_CODE = "OFFLINE";
60048
60502
  var ROBOT_FAULTS_COLLECTION = "robot-faults";
60049
- function escapeRegex(value) {
60503
+ function escapeRegex2(value) {
60050
60504
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
60051
60505
  }
60052
60506
  function matchDefaulted(field, value, fallback) {
@@ -60150,7 +60604,7 @@ function networkListPipeline(q) {
60150
60604
  pipeline.push({ $match: { offline: true } });
60151
60605
  const search = (q.search ?? "").trim();
60152
60606
  if (search) {
60153
- const rx = { $regex: escapeRegex(search), $options: "i" };
60607
+ const rx = { $regex: escapeRegex2(search), $options: "i" };
60154
60608
  pipeline.push({
60155
60609
  $match: { $or: [{ name: rx }, { robotSn: rx }, { "client.name": rx }, { "site.name": rx }] }
60156
60610
  });
@@ -67310,7 +67764,7 @@ function usePatrolEmailRepo() {
67310
67764
  throw new import_node_server_utils177.BadRequestError(`Invalid ${label2} format.`);
67311
67765
  }
67312
67766
  }
67313
- function escapeRegex2(value) {
67767
+ function escapeRegex3(value) {
67314
67768
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
67315
67769
  }
67316
67770
  async function createIndexes() {
@@ -67447,8 +67901,8 @@ function usePatrolEmailRepo() {
67447
67901
  ...status ? { status } : { status: { $ne: "deleted" } },
67448
67902
  ...search && {
67449
67903
  $or: [
67450
- { subject: { $regex: escapeRegex2(search), $options: "i" } },
67451
- { recipients: { $regex: escapeRegex2(search), $options: "i" } }
67904
+ { subject: { $regex: escapeRegex3(search), $options: "i" } },
67905
+ { recipients: { $regex: escapeRegex3(search), $options: "i" } }
67452
67906
  ]
67453
67907
  }
67454
67908
  };
@@ -85649,7 +86103,7 @@ function filterByShiftTime(attendance, shiftData, timezone, format2) {
85649
86103
  return checkInLocal.isBetween(shiftStart, shiftEnd, null, "[]");
85650
86104
  });
85651
86105
  }
85652
- function paginate58(data, page, limit) {
86106
+ function paginate59(data, page, limit) {
85653
86107
  const length = data.length;
85654
86108
  const startIndex = (page - 1) * limit;
85655
86109
  const endIndex = startIndex + limit;
@@ -85997,7 +86451,7 @@ var hrmlabs_attendance_util_default = {
85997
86451
  hrmLabsAuthentication,
85998
86452
  fetchAttendanceData,
85999
86453
  filterByShiftTime,
86000
- paginate: paginate58,
86454
+ paginate: paginate59,
86001
86455
  designationCount,
86002
86456
  totalCountPerShift,
86003
86457
  filterByStatus,
@@ -87734,7 +88188,7 @@ var {
87734
88188
  hrmLabsAuthentication: hrmLabsAuthentication3,
87735
88189
  fetchAttendanceData: fetchAttendanceData2,
87736
88190
  filterByShiftTime: filterByShiftTime2,
87737
- paginate: paginate64,
88191
+ paginate: paginate65,
87738
88192
  designationCount: designationCount2,
87739
88193
  totalCountPerShift: totalCountPerShift2,
87740
88194
  filterByStatus: filterByStatus2,
@@ -87844,7 +88298,7 @@ function useHrmLabsAttendanceSrvc() {
87844
88298
  status
87845
88299
  );
87846
88300
  }
87847
- const paginatedItems = paginate64(filteredAttendance, page, limit);
88301
+ const paginatedItems = paginate65(filteredAttendance, page, limit);
87848
88302
  return {
87849
88303
  items: paginatedItems.items,
87850
88304
  pages: paginatedItems.pages,
@@ -92144,6 +92598,7 @@ function useServiceProviderInviteController() {
92144
92598
  try {
92145
92599
  const schema2 = import_joi149.default.object({
92146
92600
  org: import_joi149.default.string().hex().length(24).optional().allow("", null),
92601
+ siteId: import_joi149.default.string().hex().length(24).optional().allow("", null),
92147
92602
  status: import_joi149.default.string().optional().allow("", null),
92148
92603
  search: import_joi149.default.string().max(200).optional().allow("", null),
92149
92604
  page: import_joi149.default.number().min(1).default(1),
@@ -92153,10 +92608,13 @@ function useServiceProviderInviteController() {
92153
92608
  if (error)
92154
92609
  throw new import_node_server_utils282.BadRequestError(`Invalid input: ${error.message}`);
92155
92610
  const statuses = String(value.status ?? "").split(",").map((s) => s.trim()).filter(Boolean);
92611
+ if (value.siteId)
92612
+ await requireSiteReach(req, value.siteId);
92156
92613
  res.json(
92157
92614
  await listForCaller({
92158
92615
  userId: callerId5(req),
92159
92616
  orgId: value.org || void 0,
92617
+ siteId: value.siteId || void 0,
92160
92618
  statuses,
92161
92619
  search: value.search || "",
92162
92620
  page: value.page,
@@ -99076,6 +99534,7 @@ function usePersonalEmergencyChainController() {
99076
99534
  notificationCategory,
99077
99535
  notificationCategoryLabel,
99078
99536
  notificationEvents,
99537
+ notificationKind,
99079
99538
  notificationRoom,
99080
99539
  notifyAccessMode,
99081
99540
  notifyRobotFault,
@@ -99600,6 +100059,7 @@ function usePersonalEmergencyChainController() {
99600
100059
  wallsFromOccupancyGrid,
99601
100060
  waypointsFor,
99602
100061
  withLiveLink,
100062
+ withNotificationKind,
99603
100063
  workOrderSchema,
99604
100064
  work_orders2_namespace_collection,
99605
100065
  work_orders_namespace_collection