@nmtjs/http-transport 0.1.6 → 0.1.7

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.
@@ -1,11 +1,5 @@
1
- import { Hook, createPlugin } from '@nmtjs/application';
1
+ import { createTransport } from '@nmtjs/application';
2
2
  import { HttpTransportServer } from "./server.js";
3
- export const HttpTransport = createPlugin('HttpTransport', (app, options)=>{
4
- const server = new HttpTransportServer(app, options);
5
- app.hooks.add(Hook.OnStartup, async ()=>{
6
- await server.start();
7
- });
8
- app.hooks.add(Hook.OnShutdown, async ()=>{
9
- await server.stop();
10
- });
3
+ export const HttpTransport = createTransport('HttpTransport', (app, options)=>{
4
+ return new HttpTransportServer(app, options);
11
5
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/transport.ts"],"sourcesContent":["import { Hook, createPlugin } from '@nmtjs/application'\nimport { HttpTransportServer } from './server.ts'\nimport type { HttpTransportOptions } from './types.ts'\n\nexport const HttpTransport = createPlugin<HttpTransportOptions>(\n 'HttpTransport',\n (app, options) => {\n const server = new HttpTransportServer(app, options)\n app.hooks.add(Hook.OnStartup, async () => {\n await server.start()\n })\n app.hooks.add(Hook.OnShutdown, async () => {\n await server.stop()\n })\n },\n)\n"],"names":["Hook","createPlugin","HttpTransportServer","HttpTransport","app","options","server","hooks","add","OnStartup","start","OnShutdown","stop"],"mappings":"AAAA,SAASA,IAAI,EAAEC,YAAY,QAAQ,qBAAoB;AACvD,SAASC,mBAAmB,QAAQ,cAAa;AAGjD,OAAO,MAAMC,gBAAgBF,aAC3B,iBACA,CAACG,KAAKC;IACJ,MAAMC,SAAS,IAAIJ,oBAAoBE,KAAKC;IAC5CD,IAAIG,KAAK,CAACC,GAAG,CAACR,KAAKS,SAAS,EAAE;QAC5B,MAAMH,OAAOI,KAAK;IACpB;IACAN,IAAIG,KAAK,CAACC,GAAG,CAACR,KAAKW,UAAU,EAAE;QAC7B,MAAML,OAAOM,IAAI;IACnB;AACF,GACD"}
1
+ {"version":3,"sources":["../../../lib/transport.ts"],"sourcesContent":["import { createTransport } from '@nmtjs/application'\nimport { HttpTransportServer } from './server.ts'\nimport type { HttpTransportOptions } from './types.ts'\n\nexport const HttpTransport = createTransport<HttpTransportOptions>(\n 'HttpTransport',\n (app, options) => {\n return new HttpTransportServer(app, options)\n },\n)\n"],"names":["createTransport","HttpTransportServer","HttpTransport","app","options"],"mappings":"AAAA,SAASA,eAAe,QAAQ,qBAAoB;AACpD,SAASC,mBAAmB,QAAQ,cAAa;AAGjD,OAAO,MAAMC,gBAAgBF,gBAC3B,iBACA,CAACG,KAAKC;IACJ,OAAO,IAAIH,oBAAoBE,KAAKC;AACtC,GACD"}
package/lib/transport.ts CHANGED
@@ -1,16 +1,10 @@
1
- import { Hook, createPlugin } from '@nmtjs/application'
1
+ import { createTransport } from '@nmtjs/application'
2
2
  import { HttpTransportServer } from './server.ts'
3
3
  import type { HttpTransportOptions } from './types.ts'
4
4
 
5
- export const HttpTransport = createPlugin<HttpTransportOptions>(
5
+ export const HttpTransport = createTransport<HttpTransportOptions>(
6
6
  'HttpTransport',
7
7
  (app, options) => {
8
- const server = new HttpTransportServer(app, options)
9
- app.hooks.add(Hook.OnStartup, async () => {
10
- await server.start()
11
- })
12
- app.hooks.add(Hook.OnShutdown, async () => {
13
- await server.stop()
14
- })
8
+ return new HttpTransportServer(app, options)
15
9
  },
16
10
  )
package/package.json CHANGED
@@ -8,15 +8,15 @@
8
8
  }
9
9
  },
10
10
  "dependencies": {
11
- "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.48.0"
11
+ "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.49.0"
12
12
  },
13
13
  "peerDependencies": {
14
- "@nmtjs/application": "^0.3.8",
15
- "@nmtjs/common": "^0.3.8"
14
+ "@nmtjs/application": "^0.4.2s",
15
+ "@nmtjs/common": "^0.4.2s"
16
16
  },
17
17
  "devDependencies": {
18
- "@nmtjs/application": "^0.3.8",
19
- "@nmtjs/common": "^0.3.8",
18
+ "@nmtjs/application": "^0.4.2s",
19
+ "@nmtjs/common": "^0.4.2s",
20
20
  "@types/node": "^18.0.0"
21
21
  },
22
22
  "engines": {
@@ -30,7 +30,7 @@
30
30
  "LICENSE.md",
31
31
  "README.md"
32
32
  ],
33
- "version": "0.1.6",
33
+ "version": "0.1.7",
34
34
  "scripts": {
35
35
  "build": "neemata-build ./index.ts './lib/**/*.ts'",
36
36
  "type-check": "tsc --noEmit"