@cloudbase/realtime 1.2.3-alpha.0 → 1.8.2

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/src/ws-event.ts CHANGED
@@ -1,128 +1,128 @@
1
- import { ERR_CODE, CloudSDKError } from './error'
1
+ import { ERR_CODE, CloudSDKError } from './error';
2
2
 
3
3
  export const CLOSE_EVENT_CODE_INFO = {
4
4
  1000: {
5
5
  code: 1000,
6
6
  name: 'Normal Closure',
7
7
  description:
8
- 'Normal closure; the connection successfully completed whatever purpose for which it was created.'
8
+ 'Normal closure; the connection successfully completed whatever purpose for which it was created.',
9
9
  },
10
10
  1001: {
11
11
  code: 1001,
12
12
  name: 'Going Away',
13
13
  description:
14
- 'The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection.'
14
+ 'The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection.',
15
15
  },
16
16
  1002: {
17
17
  code: 1002,
18
18
  name: 'Protocol Error',
19
19
  description:
20
- 'The endpoint is terminating the connection due to a protocol error.'
20
+ 'The endpoint is terminating the connection due to a protocol error.',
21
21
  },
22
22
  1003: {
23
23
  code: 1003,
24
24
  name: 'Unsupported Data',
25
25
  description:
26
- 'The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data).'
26
+ 'The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data).',
27
27
  },
28
28
  1005: {
29
29
  code: 1005,
30
30
  name: 'No Status Received',
31
31
  description:
32
- 'Indicates that no status code was provided even though one was expected.'
32
+ 'Indicates that no status code was provided even though one was expected.',
33
33
  },
34
34
  1006: {
35
35
  code: 1006,
36
36
  name: 'Abnormal Closure',
37
37
  description:
38
- 'Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected.'
38
+ 'Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected.',
39
39
  },
40
40
  1007: {
41
41
  code: 1007,
42
42
  name: 'Invalid frame payload data',
43
43
  description:
44
- 'The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message).'
44
+ 'The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message).',
45
45
  },
46
46
  1008: {
47
47
  code: 1008,
48
48
  name: 'Policy Violation',
49
49
  description:
50
- 'The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable.'
50
+ 'The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable.',
51
51
  },
52
52
  1009: {
53
53
  code: 1009,
54
54
  name: 'Message too big',
55
55
  description:
56
- 'The endpoint is terminating the connection because a data frame was received that is too large.'
56
+ 'The endpoint is terminating the connection because a data frame was received that is too large.',
57
57
  },
58
58
  1010: {
59
59
  code: 1010,
60
60
  name: 'Missing Extension',
61
61
  description:
62
- "The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."
62
+ 'The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn\'t.',
63
63
  },
64
64
  1011: {
65
65
  code: 1011,
66
66
  name: 'Internal Error',
67
67
  description:
68
- 'The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.'
68
+ 'The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.',
69
69
  },
70
70
  1012: {
71
71
  code: 1012,
72
72
  name: 'Service Restart',
73
73
  description:
74
- 'The server is terminating the connection because it is restarting.'
74
+ 'The server is terminating the connection because it is restarting.',
75
75
  },
76
76
  1013: {
77
77
  code: 1013,
78
78
  name: 'Try Again Later',
79
79
  description:
80
- 'The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients.'
80
+ 'The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients.',
81
81
  },
82
82
  1014: {
83
83
  code: 1014,
84
84
  name: 'Bad Gateway',
85
85
  description:
86
- 'The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code.'
86
+ 'The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code.',
87
87
  },
88
88
  1015: {
89
89
  code: 1015,
90
90
  name: 'TLS Handshake',
91
91
  description:
92
- "Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."
92
+ 'Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can\'t be verified).',
93
93
  },
94
94
  // custom
95
95
  3000: {
96
96
  code: 3000,
97
97
  name: 'Reconnect WebSocket',
98
98
  description:
99
- 'The client is terminating the connection because it wants to reconnect'
99
+ 'The client is terminating the connection because it wants to reconnect',
100
100
  },
101
101
  3001: {
102
102
  code: 3001,
103
103
  name: 'No Realtime Listeners',
104
104
  description:
105
- 'The client is terminating the connection because no more realtime listeners exist'
105
+ 'The client is terminating the connection because no more realtime listeners exist',
106
106
  },
107
107
  3002: {
108
108
  code: 3002,
109
109
  name: 'Heartbeat Ping Error',
110
110
  description:
111
- 'The client is terminating the connection due to its failure in sending heartbeat messages'
111
+ 'The client is terminating the connection due to its failure in sending heartbeat messages',
112
112
  },
113
113
  3003: {
114
114
  code: 3003,
115
115
  name: 'Heartbeat Pong Timeout Error',
116
116
  description:
117
- 'The client is terminating the connection because no heartbeat response is received from the server'
117
+ 'The client is terminating the connection because no heartbeat response is received from the server',
118
118
  },
119
119
  3050: {
120
120
  code: 3050,
121
121
  name: 'Server Close',
122
122
  description:
123
- 'The client is terminating the connection because no heartbeat response is received from the server'
124
- }
125
- }
123
+ 'The client is terminating the connection because no heartbeat response is received from the server',
124
+ },
125
+ };
126
126
 
127
127
  export enum CLOSE_EVENT_CODE {
128
128
  // spec
@@ -151,12 +151,12 @@ export enum CLOSE_EVENT_CODE {
151
151
  }
152
152
 
153
153
  export const getWSCloseError = (code: CLOSE_EVENT_CODE, reason?: string) => {
154
- const info = CLOSE_EVENT_CODE_INFO[code]
154
+ const info = CLOSE_EVENT_CODE_INFO[code];
155
155
  const errMsg = !info
156
156
  ? `code ${code}`
157
- : `${info.name}, code ${code}, reason ${reason || info.description}`
157
+ : `${info.name}, code ${code}, reason ${reason || info.description}`;
158
158
  return new CloudSDKError({
159
159
  errCode: ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED as string,
160
- errMsg
161
- })
162
- }
160
+ errMsg,
161
+ });
162
+ };
package/tsconfig.esm.json CHANGED
@@ -1,27 +1,9 @@
1
1
  {
2
- "compileOnSave": true,
2
+ "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "allowSyntheticDefaultImports": true,
5
- "declaration": true,
6
- "esModuleInterop": true,
7
- "experimentalDecorators": true,
8
- "emitDecoratorMetadata": true,
9
4
  "module": "es6",
10
- "noFallthroughCasesInSwitch": true,
11
- "noUnusedLocals": true,
12
- "noUnusedParameters": true,
13
5
  "outDir": "dist/esm",
14
6
  "rootDir": "src",
15
- "pretty": true,
16
- "removeComments": true,
17
- "skipLibCheck": true,
18
- "strictBindCallApply": true,
19
- "declarationMap": false,
20
- "inlineSourceMap": true,
21
- "inlineSources": true,
22
- "target": "es5",
23
- "moduleResolution": "node",
24
- "lib": ["es2015", "dom"]
25
7
  },
26
8
  "include": [
27
9
  "src/**/*.ts",
@@ -31,4 +13,4 @@
31
13
  "node_modules",
32
14
  "dist"
33
15
  ]
34
- }
16
+ }
package/tsconfig.json CHANGED
@@ -1,27 +1,9 @@
1
1
  {
2
- "compileOnSave": true,
2
+ "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "allowSyntheticDefaultImports": true,
5
- "declaration": true,
6
- "esModuleInterop": true,
7
- "experimentalDecorators": true,
8
- "emitDecoratorMetadata": true,
9
4
  "module": "commonjs",
10
- "noFallthroughCasesInSwitch": true,
11
- "noUnusedLocals": true,
12
- "noUnusedParameters": true,
13
5
  "outDir": "dist/cjs",
14
6
  "rootDir": "src",
15
- "pretty": true,
16
- "removeComments": true,
17
- "skipLibCheck": true,
18
- "strictBindCallApply": true,
19
- "declarationMap": false,
20
- "inlineSourceMap": true,
21
- "inlineSources": true,
22
- "target": "es5",
23
- "moduleResolution": "node",
24
- "lib": ["es2015", "dom"]
25
7
  },
26
8
  "include": [
27
9
  "src/**/*.ts",
@@ -31,4 +13,4 @@
31
13
  "node_modules",
32
14
  "dist"
33
15
  ]
34
- }
16
+ }
package/.eslintrc DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "extends": [
3
- "eslint-config-alloy/typescript"
4
- ],
5
- "rules": {
6
- "indent": [
7
- "error",
8
- 2,
9
- {
10
- "SwitchCase": 1,
11
- "flatTernaryExpressions": true
12
- }
13
- ],
14
- "guard-for-in": 0,
15
- "no-param-reassign": 0,
16
- "no-undefined": 0,
17
- "@typescript-eslint/explicit-member-accessibility": 0,
18
- "@typescript-eslint/no-invalid-this": 0,
19
- "@typescript-eslint/no-loss-of-precision": 0,
20
- "@typescript-eslint/consistent-type-assertions": 0,
21
- "@typescript-eslint/no-duplicate-imports": 0
22
- },
23
- "parserOptions": {
24
- "ecmaVersion": 6,
25
- "sourceType": "module",
26
- "ecmaFeatures": {
27
- "modules": true
28
- }
29
- }
30
- }