@eleven-am/pondsocket 0.1.110 → 0.1.111

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.
Files changed (3) hide show
  1. package/nest.js +12 -4
  2. package/package.json +1 -1
  3. package/types.d.ts +6 -7
package/nest.js CHANGED
@@ -43,10 +43,6 @@ function isNotEmpty(value) {
43
43
  value !== '' &&
44
44
  Object.keys(value).length !== 0;
45
45
  }
46
- function createClassDecorator(key, value) {
47
- // eslint-disable-next-line new-cap
48
- return (0, common_1.applyDecorators)((0, common_1.Injectable)(), (0, common_1.SetMetadata)(key, value));
49
- }
50
46
  function manageClassData(key, target) {
51
47
  return {
52
48
  get() {
@@ -58,6 +54,12 @@ function manageClassData(key, target) {
58
54
  },
59
55
  };
60
56
  }
57
+ function createClassDecorator(key, path) {
58
+ return (target) => {
59
+ const { set } = manageClassData(key, target);
60
+ set(path);
61
+ };
62
+ }
61
63
  function manageMethodData(key, target, propertyKey) {
62
64
  function getter() {
63
65
  var _a;
@@ -238,6 +240,12 @@ class Context {
238
240
  retrieveMethodData(key) {
239
241
  return manageMethodData(key, this.instance, this.propertyKey).get();
240
242
  }
243
+ getClass() {
244
+ return this.instance.constructor;
245
+ }
246
+ getHandler() {
247
+ return this.instance[this.propertyKey];
248
+ }
241
249
  addData(key, value) {
242
250
  this.data[key] = value;
243
251
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleven-am/pondsocket",
3
- "version": "0.1.110",
3
+ "version": "0.1.111",
4
4
  "description": "PondSocket is a fast simple socket server",
5
5
  "keywords": [
6
6
  "socket",
package/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Server as HTTPServer, IncomingHttpHeaders } from 'http';
2
2
 
3
- import type { ModuleMetadata, DynamicModule } from '@nestjs/common';
3
+ import type { ModuleMetadata, DynamicModule, Type } from '@nestjs/common';
4
4
  import type { Express } from 'express';
5
5
  import { WebSocketServer } from 'ws';
6
6
 
@@ -170,16 +170,15 @@ declare class Context<Path extends string = string> {
170
170
  event: PondEvent<Path> | null;
171
171
 
172
172
  /**
173
- * @desc Retrieves metadata associated with the class
174
- * @param key - the key to retrieve
173
+ * @desc Returns the *type* of the controller class which the current handler belongs to.
175
174
  */
176
- public retrieveClassData<A = unknown>(key: symbol): A | null;
175
+ getClass<T = any>(): Type<T>;
177
176
 
178
177
  /**
179
- * @desc Retrieves metadata associated with the method
180
- * @param key - the key to retrieve
178
+ * @desc Returns a reference to the handler (method) that will be invoked next in the
179
+ * request pipeline.
181
180
  */
182
- public retrieveMethodData<A = unknown>(key: symbol): A | null;
181
+ getHandler(): Function;
183
182
 
184
183
  /**
185
184
  * @desc Adds request data to the context