@eleven-am/pondsocket 0.1.109 → 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 -8
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.109",
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
 
@@ -36,7 +36,6 @@ type Params<Path> = {
36
36
  interface EndpointMetadata {
37
37
  path?: string;
38
38
  channels: Constructor<NonNullable<unknown>>[];
39
- guards?: Constructor<CanActivate>[];
40
39
  }
41
40
 
42
41
  type PondPath<Path extends string> = Path | RegExp;
@@ -171,16 +170,15 @@ declare class Context<Path extends string = string> {
171
170
  event: PondEvent<Path> | null;
172
171
 
173
172
  /**
174
- * @desc Retrieves metadata associated with the class
175
- * @param key - the key to retrieve
173
+ * @desc Returns the *type* of the controller class which the current handler belongs to.
176
174
  */
177
- public retrieveClassData<A = unknown>(key: symbol): A | null;
175
+ getClass<T = any>(): Type<T>;
178
176
 
179
177
  /**
180
- * @desc Retrieves metadata associated with the method
181
- * @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.
182
180
  */
183
- public retrieveMethodData<A = unknown>(key: symbol): A | null;
181
+ getHandler(): Function;
184
182
 
185
183
  /**
186
184
  * @desc Adds request data to the context