dt-common-device 13.3.0 → 13.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,4 +16,5 @@ export declare class AdminService {
16
16
  getChildCollectionsByParentIds(parentIds: string[]): Promise<any[]>;
17
17
  deleteAllCollectionHierarchy(propertyId: string, source: string): Promise<void>;
18
18
  getCollectionByName(name: string, propertyId: string): Promise<any | null>;
19
+ propertyHasSaltoConnection(propertyId: string): Promise<boolean>;
19
20
  }
@@ -75,6 +75,7 @@ exports.AdminService = void 0;
75
75
  const typedi_1 = __importStar(require("typedi"));
76
76
  const Admin_repository_1 = require("./Admin.repository");
77
77
  const redis_utils_1 = require("../../utils/redis.utils");
78
+ const connection_1 = require("../connection");
78
79
  let AdminService = (() => {
79
80
  let _classDecorators = [(0, typedi_1.Service)()];
80
81
  let _classDescriptor;
@@ -304,6 +305,11 @@ let AdminService = (() => {
304
305
  async getCollectionByName(name, propertyId) {
305
306
  return await this.adminRepository.getCollectionByName(name, propertyId);
306
307
  }
308
+ async propertyHasSaltoConnection(propertyId) {
309
+ const connections = await typedi_1.default.get(connection_1.LocalConnectionService).getConnectionsByPropertyId(propertyId);
310
+ return connections.every((connection) => connection.connectionProvider === connection_1.ConnectionProvider.SaltoKS ||
311
+ connection.connectionProvider === connection_1.ConnectionProvider.SaltoSpace);
312
+ }
307
313
  };
308
314
  __setFunctionName(_classThis, "AdminService");
309
315
  (() => {
@@ -156,8 +156,10 @@ let PmsService = (() => {
156
156
  const last = orderedAccessGroups?.at(-1);
157
157
  const secondLast = orderedAccessGroups?.at(-2);
158
158
  // True only if last and second last entries are same and equal to accessGroupId
159
- return (last.accessGroupId === accessGroupId &&
160
- secondLast.accessGroupId === accessGroupId //B A(secondLast) A(last)
159
+ return (
160
+ // This 1st condition doesnt seems to be required so verify with use case
161
+ last.accessGroupId === accessGroupId &&
162
+ secondLast.accessGroupId === accessGroupId //A(secondLast) A(last)
161
163
  );
162
164
  }
163
165
  };
@@ -155,7 +155,9 @@ let IssueRepository = (() => {
155
155
  const matchesType = issue.type === offlineFilter.type;
156
156
  const matchesSubType = issue.entitySubType === offlineFilter.subType;
157
157
  const isOlderThanCutoff = issueCreatedAt < cutoff;
158
- return !(matchesType && matchesSubType && isOlderThanCutoff);
158
+ if (!matchesType || !matchesSubType)
159
+ return true;
160
+ return matchesType && matchesSubType && isOlderThanCutoff;
159
161
  });
160
162
  }
161
163
  }
@@ -222,7 +224,7 @@ let IssueRepository = (() => {
222
224
  ...query,
223
225
  type: offlineFilter.type,
224
226
  entitySubType: offlineFilter.subType,
225
- createdAt: { $lt: cutoff },
227
+ createdAt: { $gt: cutoff.toISOString() },
226
228
  };
227
229
  const excludeCount = await Issue_model_1.IssueModel.countDocuments(excludeQuery);
228
230
  total = Math.max(0, total - excludeCount);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "13.3.0",
3
+ "version": "13.3.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [