@nymphjs/pubsub 1.0.0-beta.11 → 1.0.0-beta.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.
@@ -17,7 +17,8 @@ export type QuerySubscriptionData = {
17
17
 
18
18
  export type AuthenticateMessageData = {
19
19
  action: 'authenticate';
20
- token: string;
20
+ authToken: string;
21
+ switchToken?: string;
21
22
  };
22
23
 
23
24
  export type QuerySubscribeMessageData = {
@@ -1,9 +1,9 @@
1
- import { Config } from './d';
1
+ import { Config } from './d.js';
2
2
 
3
3
  export default {
4
4
  originIsAllowed: () => {
5
5
  throw new Error(
6
- 'You must provide a "originIsAllowed" function to PubSub config to determine if client origin is allowed.'
6
+ 'You must provide a "originIsAllowed" function to PubSub config to determine if client origin is allowed.',
7
7
  );
8
8
  },
9
9
  entries: ['ws://127.0.0.1:8080/'],
package/src/conf/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Config } from './d';
1
+ export { Config } from './d.js';
2
2
 
3
- import defaults from './defaults';
3
+ import defaults from './defaults.js';
4
4
  export { defaults as ConfigDefaults };
@@ -1,14 +1,14 @@
1
- import type { Nymph, TilmeldInterface } from '@nymphjs/nymph';
2
- import http from 'http';
3
- import { server as WebSocketServer } from 'websocket';
1
+ import http from 'node:http';
2
+ import type { Nymph } from '@nymphjs/nymph';
3
+ import ws from 'websocket';
4
4
 
5
- import { Config, ConfigDefaults as defaults } from './conf';
6
- import PubSub from './PubSub';
5
+ import { Config, ConfigDefaults as defaults } from './conf/index.js';
6
+ import PubSub from './PubSub.js';
7
7
 
8
8
  export default function createServer(
9
9
  port = 8080,
10
10
  config: Partial<Config> = {},
11
- nymph: Nymph
11
+ nymph: Nymph,
12
12
  ) {
13
13
  const server = http.createServer((_request, response) => {
14
14
  response.writeHead(404);
@@ -19,11 +19,11 @@ export default function createServer(
19
19
  (config.logger ?? defaults.logger)(
20
20
  'log',
21
21
  new Date().toISOString(),
22
- `Nymph-PubSub server started listening on port ${port}.`
22
+ `Nymph-PubSub server started listening on port ${port}.`,
23
23
  );
24
24
  });
25
25
 
26
- const wsServer = new WebSocketServer({
26
+ const wsServer = new ws.server({
27
27
  httpServer: listener,
28
28
  // You should not use autoAcceptConnections for production
29
29
  // applications, as it defeats all standard cross-origin protection
package/src/index.ts CHANGED
@@ -1,10 +1,10 @@
1
- export * from './conf';
1
+ export * from './conf/index.js';
2
2
 
3
- import PubSub from './PubSub';
3
+ import PubSub from './PubSub.js';
4
4
  export { PubSub };
5
5
 
6
- export * from './PubSub.types';
6
+ export * from './PubSub.types.js';
7
7
 
8
- import createServer from './createServer';
8
+ import createServer from './createServer.js';
9
9
  export { createServer };
10
10
  export default createServer;
package/tsconfig.json CHANGED
@@ -2,10 +2,12 @@
2
2
  "extends": "@tsconfig/recommended/tsconfig.json",
3
3
 
4
4
  "compilerOptions": {
5
- "lib": ["ES2021"],
6
- "target": "ES2021",
5
+ "module": "ES2022",
6
+ "moduleResolution": "node",
7
+ "lib": ["ES2022"],
8
+ "target": "ES2022",
7
9
  "noImplicitAny": true,
8
- "removeComments": true,
10
+ "removeComments": false,
9
11
  "sourceMap": true,
10
12
  "outDir": "dist",
11
13
  "resolveJsonModule": true,
package/typedoc.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": ["../../typedoc.base.json"],
3
+ "entryPoints": ["src/index.ts"]
4
+ }