@awarevue/agent-sdk 1.0.35 → 1.0.37

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/agent-app.js CHANGED
@@ -113,7 +113,6 @@ class AgentApp {
113
113
  return issues.length > 0
114
114
  ? (0, rxjs_1.of)(issues)
115
115
  : this.agent.validateAccessChange$(validationContext, message);
116
- return (0, rxjs_1.of)(issues);
117
116
  }));
118
117
  return validateOb$.pipe((0, rxjs_1.map)((issues) => ({
119
118
  kind: 'validate-change-rs',
@@ -28,8 +28,8 @@ const createValidator = (agent) => {
28
28
  ]
29
29
  : [])),
30
30
  ];
31
- const notFoundPersonIds = personIds.filter((p) => !req.refMap['person'][p]);
32
- const notFoundScheduleIds = scheduleIds.filter((s) => !req.refMap['schedule'][s]);
31
+ const notFoundPersonIds = personIds.filter((p) => !req.refMap['person'][p] || !req.refMap['person'][p].length);
32
+ const notFoundScheduleIds = scheduleIds.filter((s) => !req.refMap['schedule'][s] || !req.refMap['schedule'][s].length);
33
33
  return [
34
34
  ...notFoundPersonIds.map((id) => ({
35
35
  code: 'NOT_FOUND',
@@ -45,7 +45,15 @@ const createValidator = (agent) => {
45
45
  };
46
46
  const getBadReferenceIssues$ = (context, req) => {
47
47
  if (!agent.find$)
48
- return [];
48
+ return (0, rxjs_1.of)([
49
+ [],
50
+ {
51
+ person: emptyMap,
52
+ schedule: emptyMap,
53
+ accessRule: emptyMap,
54
+ zone: emptyMap,
55
+ },
56
+ ]);
49
57
  const personIds = Object.entries(req.refMap['person'] || {}).flatMap(([objectId, refs]) => refs.map((ref) => ({ objectId, ref })));
50
58
  const scheduleIds = Object.entries(req.refMap['schedule'] || {}).flatMap(([objectId, refs]) => refs.map((ref) => ({ objectId, ref })));
51
59
  const ruleIds = Object.entries(req.refMap['accessRule'] || {}).flatMap(([objectId, refs]) => refs.map((ref) => ({ objectId, ref })));
@@ -68,7 +76,6 @@ const createValidator = (agent) => {
68
76
  ? (0, rxjs_1.of)(emptyMap)
69
77
  : agent.find$(context, 'zone', zoneIds.map((p) => p.ref)),
70
78
  ]).pipe((0, rxjs_1.mergeMap)(([persons, schedules, rules, zones]) => {
71
- var _a, _b;
72
79
  const issues = [];
73
80
  // check persons
74
81
  for (const personId of personIds) {
@@ -92,7 +99,7 @@ const createValidator = (agent) => {
92
99
  }
93
100
  // check rules
94
101
  for (const ruleId of ruleIds) {
95
- if (!((_a = rules['accessRule']) === null || _a === void 0 ? void 0 : _a[ruleId.ref])) {
102
+ if (!rules[ruleId.ref]) {
96
103
  issues.push({
97
104
  code: 'BAD_REFERENCE',
98
105
  objectId: ruleId.ref,
@@ -102,7 +109,7 @@ const createValidator = (agent) => {
102
109
  }
103
110
  // check zones
104
111
  for (const zoneId of zoneIds) {
105
- if (!((_b = zones['zone']) === null || _b === void 0 ? void 0 : _b[zoneId.ref])) {
112
+ if (!zones[zoneId.ref]) {
106
113
  issues.push({
107
114
  code: 'BAD_REFERENCE',
108
115
  objectId: zoneId.objectId,
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awarevue/agent-sdk",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "SDK for building Agent implementations that speak the Aware protocol.",
5
5
  "author": "Yaser Awajan",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "lint:fix": "yarn lint --fix"
28
28
  },
29
29
  "dependencies": {
30
- "@awarevue/api-types": "^1.0.35",
30
+ "@awarevue/api-types": "^1.0.37",
31
31
  "rxjs": "^7.8.2",
32
32
  "ws": "^8",
33
33
  "zod": "3.24.2"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awarevue/agent-sdk",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "SDK for building Agent implementations that speak the Aware protocol.",
5
5
  "author": "Yaser Awajan",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "lint:fix": "yarn lint --fix"
28
28
  },
29
29
  "dependencies": {
30
- "@awarevue/api-types": "^1.0.35",
30
+ "@awarevue/api-types": "^1.0.37",
31
31
  "rxjs": "^7.8.2",
32
32
  "ws": "^8",
33
33
  "zod": "3.24.2"