@routr/simpledata 2.0.8-alpha.11 → 2.0.8-alpha.13

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/utils.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { BadRequest } from "./errors";
2
- import { CommonTypes as CT } from "@routr/common";
3
- import { CommonConnect as CC } from "@routr/common";
2
+ import { CommonConnect as CC, CommonTypes as CT } from "@routr/common";
4
3
  /**
5
4
  * Creates a list of validators from the given schemas.
6
5
  *
package/dist/utils.js CHANGED
@@ -149,6 +149,13 @@ const checkReferences = (resources) => {
149
149
  break;
150
150
  }
151
151
  });
152
+ // Check that reference have not been duplicated
153
+ const references = resources.map((r) => r.ref);
154
+ const duplicates = references.filter((ref, index) => references.indexOf(ref) !== index);
155
+ if (duplicates.length > 0) {
156
+ logger.error(`found duplicated references: ${duplicates}; exiting`);
157
+ process.exit(1);
158
+ }
152
159
  };
153
160
  /**
154
161
  * Loads a list of resources from a file.
@@ -164,7 +171,7 @@ function loadResources(validatorsPath, resourcesPath) {
164
171
  const files = require("fs").readdirSync(resourcesPath);
165
172
  files.forEach((file) => {
166
173
  // eslint-disable-next-line @typescript-eslint/no-var-requires
167
- const resources = require(`${resourcesPath}/${file}`);
174
+ const resources = common_1.Helper.readConfigFile(`${resourcesPath}/${file}`);
168
175
  resources.forEach((resource) => {
169
176
  // Assert the reference has no spaces
170
177
  if (resource.ref.includes(" ")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/simpledata",
3
- "version": "2.0.8-alpha.11",
3
+ "version": "2.0.8-alpha.13",
4
4
  "description": "Files-based API Server for Routr Connect",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -29,8 +29,8 @@
29
29
  "@opentelemetry/sdk-trace-base": "^1.0.4",
30
30
  "@opentelemetry/sdk-trace-node": "^1.0.4",
31
31
  "@opentelemetry/semantic-conventions": "^1.0.4",
32
- "@routr/common": "^2.0.8-alpha.11",
33
- "@routr/processor": "^2.0.8-alpha.11",
32
+ "@routr/common": "^2.0.8-alpha.13",
33
+ "@routr/processor": "^2.0.8-alpha.13",
34
34
  "ajv": "^6.12.6",
35
35
  "google-protobuf": "^3.9.2",
36
36
  "jsonpath": "^1.1.1",
@@ -53,5 +53,5 @@
53
53
  "@types/google-protobuf": "^3.15.6",
54
54
  "@types/jsonpath": "^0.2.0"
55
55
  },
56
- "gitHead": "627659ac51d0814a3106bcaac31a15c581a5809f"
56
+ "gitHead": "d866d6c03c5ea7e8fc3ee074804005df3a5be42f"
57
57
  }