@cripty2001/utils 0.0.56 → 0.0.58

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.
@@ -20,6 +20,7 @@ export declare class Appserver<U extends AppserverData> {
20
20
  private app;
21
21
  private parseUser;
22
22
  private getMetrics;
23
+ private registered;
23
24
  constructor(port: number, parseUser: AppserverUsergetter<U>, getMetrics: () => Record<string, number>);
24
25
  private handleMetricsRequest;
25
26
  private parseInput;
@@ -40,6 +40,7 @@ class Appserver {
40
40
  app;
41
41
  parseUser;
42
42
  getMetrics;
43
+ registered = new Set();
43
44
  constructor(port, parseUser, getMetrics) {
44
45
  this.parseUser = parseUser;
45
46
  this.getMetrics = getMetrics;
@@ -96,6 +97,9 @@ class Appserver {
96
97
  };
97
98
  }
98
99
  register(action, inputSchema, auth, handler) {
100
+ if (this.registered.has(action))
101
+ throw new Error(`Action ${action} is already registered`);
102
+ this.registered.add(action);
99
103
  this.app.post(`/exec/${action}`, express_1.default.raw({ type: 'application/vnd.msgpack' }), async (req, res) => {
100
104
  const { status, data } = await (async () => {
101
105
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.56",
3
+ "version": "0.0.58",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {