oox 0.3.10 → 0.3.11

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oox",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "OOX Service Engine",
5
5
  "keywords": [
6
6
  "http",
@@ -4,18 +4,6 @@ import { getContext, genContext, } from '../context.js';
4
4
  import { KeepAliveConnectionError, addKeepAliveConnection, removeKeepAliveConnection, } from '../keepalive-connection.js';
5
5
  import { call, } from '../app.js';
6
6
  export class SampleKeepAliveConnectionAdapter {
7
- OOXEvent = {
8
- CONNECT: 'connect',
9
- DISCONNECT: 'disconnect',
10
- ERROR: 'error',
11
- CALL: 'call',
12
- READY: 'oox:ready',
13
- ENABLED: 'oox:enabled',
14
- DISABLED: 'oox:disabled',
15
- REGISTRY_SYNC_CONNECTIONS: 'oox:registry:sync_connections',
16
- REGISTRY_SUBSCRIBE: 'oox:registry:subscribe',
17
- REGISTRY_NOTIFY: 'oox:registry:notify',
18
- };
19
7
  /**
20
8
  * 通知连接列表
21
9
  */
@@ -64,6 +52,7 @@ export class SampleKeepAliveConnectionAdapter {
64
52
  const connection = this.newConnection(identify);
65
53
  addKeepAliveConnection(connection);
66
54
  this.bindConnectionEvents(connection);
55
+ this.bindCall(connection);
67
56
  try {
68
57
  await new Promise((resolve, reject) => {
69
58
  connection.once('enabled', resolve);
@@ -81,7 +70,6 @@ export class SampleKeepAliveConnectionAdapter {
81
70
  removeKeepAliveConnection(connection);
82
71
  throw error;
83
72
  }
84
- this.bindCall(connection);
85
73
  return connection;
86
74
  }
87
75
  async close(connection) {
@@ -133,8 +121,6 @@ export class SampleKeepAliveConnectionAdapter {
133
121
  * @param connection
134
122
  */
135
123
  bindCall(connection) {
136
- if (!connection.enabled)
137
- throw new Error('Connection not enabled');
138
124
  const { id, name, ip } = connection.data;
139
125
  connection.nativeConnection.on(this.OOXEvent.CALL, async (action, params, context, callback) => {
140
126
  const validContext = genContext({
@@ -12,7 +12,7 @@ export interface SampleKeepAliveNativeConnection extends KeepAliveNativeConnecti
12
12
  }
13
13
  export declare abstract class SampleKeepAliveConnectionAdapter<NativeConnection extends SampleKeepAliveNativeConnection> implements KeepAliveConnectionAdapter<NativeConnection> {
14
14
  abstract name: string;
15
- OOXEvent: {
15
+ abstract OOXEvent: {
16
16
  CONNECT: string;
17
17
  DISCONNECT: string;
18
18
  ERROR: string;