@react-native-ohos/react-native-tcp-socket 6.3.1 → 6.4.0-bate.1

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 (60) hide show
  1. package/LICENSE +21 -21
  2. package/README.OpenSource +10 -10
  3. package/README.md +12 -12
  4. package/harmony/tcp_socket/BuildProfile.ets +17 -17
  5. package/harmony/tcp_socket/Index.ets +9 -6
  6. package/harmony/tcp_socket/build-profile.json5 +31 -31
  7. package/harmony/tcp_socket/hvigorfile.ts +6 -6
  8. package/harmony/tcp_socket/obfuscation-rules.txt +22 -22
  9. package/harmony/tcp_socket/oh-package.json5 +11 -11
  10. package/harmony/tcp_socket/src/main/cpp/CMakeLists.txt +8 -8
  11. package/harmony/tcp_socket/src/main/cpp/TcpSocketPackage.h +18 -18
  12. package/harmony/tcp_socket/src/main/cpp/generated/RNOH/generated/BaseReactNativeTcpSocketPackage.h +72 -72
  13. package/harmony/tcp_socket/src/main/cpp/generated/RNOH/generated/turbo_modules/TcpSocketModule.cpp +28 -28
  14. package/harmony/tcp_socket/src/main/cpp/generated/RNOH/generated/turbo_modules/TcpSocketModule.h +16 -16
  15. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/ComponentDescriptors.h +24 -24
  16. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/EventEmitters.cpp +16 -16
  17. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/EventEmitters.h +17 -17
  18. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/Props.cpp +19 -19
  19. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/Props.h +18 -18
  20. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/ShadowNodes.cpp +17 -17
  21. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/ShadowNodes.h +23 -23
  22. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/States.cpp +16 -16
  23. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/States.h +18 -18
  24. package/harmony/tcp_socket/src/main/ets/Logger.ts +45 -45
  25. package/harmony/tcp_socket/src/main/ets/TcpEventListener.ts +120 -120
  26. package/harmony/tcp_socket/src/main/ets/TcpSocket.ts +16 -16
  27. package/harmony/tcp_socket/src/main/ets/TcpSocketClient.ts +443 -443
  28. package/harmony/tcp_socket/src/main/ets/{TcpSocketPackage.ts → TcpSocketPackage.ets} +27 -27
  29. package/harmony/tcp_socket/src/main/ets/TcpSocketServer.ts +150 -150
  30. package/harmony/tcp_socket/src/main/ets/TcpSocketTurboModule.ts +224 -224
  31. package/harmony/tcp_socket/src/main/ets/generated/components/ts.ts +5 -5
  32. package/harmony/tcp_socket/src/main/ets/generated/index.ets +5 -5
  33. package/harmony/tcp_socket/src/main/ets/generated/ts.ts +6 -6
  34. package/harmony/tcp_socket/src/main/ets/generated/turboModules/TcpSocketModule.ts +38 -38
  35. package/harmony/tcp_socket/src/main/ets/generated/turboModules/ts.ts +5 -5
  36. package/harmony/tcp_socket/src/main/module.json5 +11 -11
  37. package/harmony/tcp_socket/src/main/resources/base/element/string.json +8 -8
  38. package/harmony/tcp_socket/src/main/resources/en_US/element/string.json +8 -8
  39. package/harmony/tcp_socket/src/main/resources/zh_CN/element/string.json +8 -8
  40. package/harmony/tcp_socket/src/ohosTest/ets/test/Ability.test.ets +34 -34
  41. package/harmony/tcp_socket/src/ohosTest/ets/test/List.test.ets +4 -4
  42. package/harmony/tcp_socket/src/ohosTest/module.json5 +13 -13
  43. package/harmony/tcp_socket/src/test/List.test.ets +4 -4
  44. package/harmony/tcp_socket/src/test/LocalUnit.test.ets +32 -32
  45. package/harmony/tcp_socket/{ts.ts → ts.ets} +6 -6
  46. package/harmony/tcp_socket.har +0 -0
  47. package/lib/types/Globals.d.ts +2 -2
  48. package/lib/types/Server.d.ts +137 -137
  49. package/lib/types/Socket.d.ts +272 -272
  50. package/lib/types/TLSServer.d.ts +28 -28
  51. package/lib/types/TLSSocket.d.ts +50 -50
  52. package/lib/types/index.d.ts +80 -80
  53. package/package.json +83 -77
  54. package/src/Globals.js +12 -12
  55. package/src/Server.js +271 -271
  56. package/src/Socket.js +513 -513
  57. package/src/TLSServer.js +70 -70
  58. package/src/TLSSocket.js +93 -93
  59. package/src/TcpSocketModule.ts +39 -39
  60. package/src/index.js +144 -144
@@ -1,50 +1,50 @@
1
- /**
2
- * @typedef {object} TLSSocketOptions
3
- * @property {any} [ca]
4
- * @property {any} [key]
5
- * @property {any} [cert]
6
- * @property {string} [androidKeyStore]
7
- * @property {string} [certAlias]
8
- * @property {string} [keyAlias]
9
- * @property {string[]} [resolvedKeys]
10
- *
11
- * @extends {Socket}
12
- */
13
- export default class TLSSocket extends Socket {
14
- /**
15
- * @private
16
- * Resolves the asset source if necessary and registers the resolved key.
17
- * @param {TLSSocketOptions} options The options object containing the source to be resolved.
18
- * @param {'ca' | 'key' | 'cert'} key The key name being resolved.
19
- */
20
- private static resolveAssetIfNeeded;
21
- /**
22
- * @param {Socket} socket Any instance of `Socket`.
23
- * @param {TLSSocketOptions} [options] Options for the TLS socket.
24
- */
25
- constructor(socket: Socket, options?: TLSSocketOptions | undefined);
26
- /** @private */
27
- private _options;
28
- /** @private */
29
- private _socket;
30
- /**
31
- * @private
32
- */
33
- private _initialize;
34
- /**
35
- * @private
36
- */
37
- private _startTLS;
38
- getCertificate(): any;
39
- getPeerCertificate(): any;
40
- }
41
- export type TLSSocketOptions = {
42
- ca?: any;
43
- key?: any;
44
- cert?: any;
45
- androidKeyStore?: string | undefined;
46
- certAlias?: string | undefined;
47
- keyAlias?: string | undefined;
48
- resolvedKeys?: string[] | undefined;
49
- };
50
- import Socket from "./Socket";
1
+ /**
2
+ * @typedef {object} TLSSocketOptions
3
+ * @property {any} [ca]
4
+ * @property {any} [key]
5
+ * @property {any} [cert]
6
+ * @property {string} [androidKeyStore]
7
+ * @property {string} [certAlias]
8
+ * @property {string} [keyAlias]
9
+ * @property {string[]} [resolvedKeys]
10
+ *
11
+ * @extends {Socket}
12
+ */
13
+ export default class TLSSocket extends Socket {
14
+ /**
15
+ * @private
16
+ * Resolves the asset source if necessary and registers the resolved key.
17
+ * @param {TLSSocketOptions} options The options object containing the source to be resolved.
18
+ * @param {'ca' | 'key' | 'cert'} key The key name being resolved.
19
+ */
20
+ private static resolveAssetIfNeeded;
21
+ /**
22
+ * @param {Socket} socket Any instance of `Socket`.
23
+ * @param {TLSSocketOptions} [options] Options for the TLS socket.
24
+ */
25
+ constructor(socket: Socket, options?: TLSSocketOptions | undefined);
26
+ /** @private */
27
+ private _options;
28
+ /** @private */
29
+ private _socket;
30
+ /**
31
+ * @private
32
+ */
33
+ private _initialize;
34
+ /**
35
+ * @private
36
+ */
37
+ private _startTLS;
38
+ getCertificate(): any;
39
+ getPeerCertificate(): any;
40
+ }
41
+ export type TLSSocketOptions = {
42
+ ca?: any;
43
+ key?: any;
44
+ cert?: any;
45
+ androidKeyStore?: string | undefined;
46
+ certAlias?: string | undefined;
47
+ keyAlias?: string | undefined;
48
+ resolvedKeys?: string[] | undefined;
49
+ };
50
+ import Socket from "./Socket";
@@ -1,81 +1,81 @@
1
- declare namespace _default {
2
- export { createConnection as connect };
3
- export { createServer };
4
- export { createConnection };
5
- export { createTLSServer };
6
- export { connectTLS };
7
- export { isIP };
8
- export { isIPv4 };
9
- export { isIPv6 };
10
- export { Server };
11
- export { Socket };
12
- export { TLSServer };
13
- export { TLSSocket };
14
- export const hasIdentity: typeof import("./TLSSocket").default.hasIdentity;
15
- }
16
- export default _default;
17
- export type ServerOptions = {
18
- noDelay?: boolean | undefined;
19
- keepAlive?: boolean | undefined;
20
- keepAliveInitialDelay?: number | undefined;
21
- allowHalfOpen?: boolean | undefined;
22
- pauseOnConnect?: boolean | undefined;
23
- };
24
- /**
25
- * @param {import('./Socket').ConnectionOptions} options
26
- * @param {() => void} callback
27
- * @returns {Socket}
28
- */
29
- declare function createConnection(options: import('./Socket').ConnectionOptions, callback: () => void): Socket;
30
- /**
31
- * @typedef {object} ServerOptions
32
- * @property {boolean} [noDelay]
33
- * @property {boolean} [keepAlive]
34
- * @property {number} [keepAliveInitialDelay]
35
- * @property {boolean} [allowHalfOpen]
36
- * @property {boolean} [pauseOnConnect]
37
- */
38
- /**
39
- * Creates a new TCP server.
40
- *
41
- * @param {ServerOptions | ((socket: Socket) => void)} [options] An options object or a connection listener
42
- * @param {(socket: Socket) => void} [connectionListener] A listener for the 'connection' event
43
- * @returns {Server}
44
- */
45
- declare function createServer(options?: ServerOptions | ((socket: Socket) => void) | undefined, connectionListener?: ((socket: Socket) => void) | undefined): Server;
46
- /**
47
- * @param {import('./TLSServer').TLSServerOptions} options
48
- * @param {(socket: TLSSocket) => void} connectionListener
49
- * @returns {TLSServer}
50
- */
51
- declare function createTLSServer(options: import('./TLSServer').TLSServerOptions, connectionListener: (socket: TLSSocket) => void): TLSServer;
52
- /**
53
- * The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event.
54
- *
55
- * @param {import('./TLSSocket').TLSSocketOptions & import('./Socket').ConnectionOptions} options
56
- * @param {() => void} [callback]
57
- * @returns {TLSSocket}
58
- */
59
- declare function connectTLS(options: import('./TLSSocket').TLSSocketOptions & import('./Socket').ConnectionOptions, callback?: (() => void) | undefined): TLSSocket;
60
- /**
61
- * Tests if input is an IP address. Returns `0` for invalid strings, returns `4` for IP version 4 addresses, and returns `6` for IP version 6 addresses.
62
- *
63
- * @param {string} input
64
- */
65
- declare function isIP(input: string): 0 | 4 | 6;
66
- /**
67
- * Returns `true` if input is a version 4 IP address, otherwise returns `false`.
68
- *
69
- * @param {string} input
70
- */
71
- declare function isIPv4(input: string): boolean;
72
- /**
73
- * Returns `true` if input is a version 6 IP address, otherwise returns `false`.
74
- *
75
- * @param {string} input
76
- */
77
- declare function isIPv6(input: string): boolean;
78
- import Server from "./Server";
79
- import Socket from "./Socket";
80
- import TLSServer from "./TLSServer";
1
+ declare namespace _default {
2
+ export { createConnection as connect };
3
+ export { createServer };
4
+ export { createConnection };
5
+ export { createTLSServer };
6
+ export { connectTLS };
7
+ export { isIP };
8
+ export { isIPv4 };
9
+ export { isIPv6 };
10
+ export { Server };
11
+ export { Socket };
12
+ export { TLSServer };
13
+ export { TLSSocket };
14
+ export const hasIdentity: typeof import("./TLSSocket").default.hasIdentity;
15
+ }
16
+ export default _default;
17
+ export type ServerOptions = {
18
+ noDelay?: boolean | undefined;
19
+ keepAlive?: boolean | undefined;
20
+ keepAliveInitialDelay?: number | undefined;
21
+ allowHalfOpen?: boolean | undefined;
22
+ pauseOnConnect?: boolean | undefined;
23
+ };
24
+ /**
25
+ * @param {import('./Socket').ConnectionOptions} options
26
+ * @param {() => void} callback
27
+ * @returns {Socket}
28
+ */
29
+ declare function createConnection(options: import('./Socket').ConnectionOptions, callback: () => void): Socket;
30
+ /**
31
+ * @typedef {object} ServerOptions
32
+ * @property {boolean} [noDelay]
33
+ * @property {boolean} [keepAlive]
34
+ * @property {number} [keepAliveInitialDelay]
35
+ * @property {boolean} [allowHalfOpen]
36
+ * @property {boolean} [pauseOnConnect]
37
+ */
38
+ /**
39
+ * Creates a new TCP server.
40
+ *
41
+ * @param {ServerOptions | ((socket: Socket) => void)} [options] An options object or a connection listener
42
+ * @param {(socket: Socket) => void} [connectionListener] A listener for the 'connection' event
43
+ * @returns {Server}
44
+ */
45
+ declare function createServer(options?: ServerOptions | ((socket: Socket) => void) | undefined, connectionListener?: ((socket: Socket) => void) | undefined): Server;
46
+ /**
47
+ * @param {import('./TLSServer').TLSServerOptions} options
48
+ * @param {(socket: TLSSocket) => void} connectionListener
49
+ * @returns {TLSServer}
50
+ */
51
+ declare function createTLSServer(options: import('./TLSServer').TLSServerOptions, connectionListener: (socket: TLSSocket) => void): TLSServer;
52
+ /**
53
+ * The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event.
54
+ *
55
+ * @param {import('./TLSSocket').TLSSocketOptions & import('./Socket').ConnectionOptions} options
56
+ * @param {() => void} [callback]
57
+ * @returns {TLSSocket}
58
+ */
59
+ declare function connectTLS(options: import('./TLSSocket').TLSSocketOptions & import('./Socket').ConnectionOptions, callback?: (() => void) | undefined): TLSSocket;
60
+ /**
61
+ * Tests if input is an IP address. Returns `0` for invalid strings, returns `4` for IP version 4 addresses, and returns `6` for IP version 6 addresses.
62
+ *
63
+ * @param {string} input
64
+ */
65
+ declare function isIP(input: string): 0 | 4 | 6;
66
+ /**
67
+ * Returns `true` if input is a version 4 IP address, otherwise returns `false`.
68
+ *
69
+ * @param {string} input
70
+ */
71
+ declare function isIPv4(input: string): boolean;
72
+ /**
73
+ * Returns `true` if input is a version 6 IP address, otherwise returns `false`.
74
+ *
75
+ * @param {string} input
76
+ */
77
+ declare function isIPv6(input: string): boolean;
78
+ import Server from "./Server";
79
+ import Socket from "./Socket";
80
+ import TLSServer from "./TLSServer";
81
81
  import TLSSocket from "./TLSSocket";
package/package.json CHANGED
@@ -1,77 +1,83 @@
1
- {
2
- "name": "@react-native-ohos/react-native-tcp-socket",
3
- "title": "React Native Tcp Socket",
4
- "version": "6.3.1",
5
- "description": "React Native TCP socket API for HarmonyOS with SSL/TLS support",
6
- "main": "src/index.js",
7
- "types": "lib/types/index.d.ts",
8
- "scripts": {
9
- "ci": "yarn install --frozen-lockfile && yarn lint && yarn declaration:build && yarn checkjs && yarn test",
10
- "lint": "eslint .",
11
- "checkjs": "tsc && tsc -p ./__tests__/tsconfig.json",
12
- "test": "jest ./__tests__",
13
- "declaration:build": "tsc -p ./declaration.tsconfig.json",
14
- "prepublishOnly": "yarn declaration:build && yarn checkjs",
15
- "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-tcp-socket --cpp-output-path ./harmony/tcp_socket/src/main/cpp/generated --ets-output-path ./harmony/tcp_socket/src/main/ets/generated --turbo-modules-spec-paths ./src/TcpSocketModule.ts"
16
- },
17
- "files": [
18
- "/src",
19
- "/lib",
20
- "/harmony"
21
- ],
22
- "repository": {
23
- "type": "git",
24
- "url": "git+https://gitcode.com/openharmony-sig/rntpc_react-native-tcp-socket.git",
25
- "baseUrl": "https://gitcode.com/openharmony-sig/rntpc_react-native-tcp-socket"
26
- },
27
- "keywords": [
28
- "react-native",
29
- "harmony",
30
- "tcp-socket",
31
- "tls",
32
- "ssl",
33
- "tcp-server",
34
- "tcp-client",
35
- "tcp",
36
- "react-native-library"
37
- ],
38
- "harmony": {
39
- "alias": "react-native-tcp-socket"
40
- },
41
- "license": "MIT",
42
- "licenseFilename": "LICENSE",
43
- "readmeFilename": "README.md",
44
- "peerDependencies": {
45
- "react-native": ">=0.60.0"
46
- },
47
- "devDependencies": {
48
- "@babel/core": "^7.7.7",
49
- "@semantic-release/changelog": "^5.0.0",
50
- "@semantic-release/git": "^9.0.0",
51
- "@semantic-release/github": "^7.0.0",
52
- "@semantic-release/npm": "^7.0.0",
53
- "@types/eventemitter3": "^2.0.2",
54
- "@types/jest": "^25.1.3",
55
- "@types/react-native": "^0.61.17",
56
- "babel-eslint": "^10.1.0",
57
- "babel-jest": "^24.9.0",
58
- "eslint": "^6.8.0",
59
- "eslint-config-prettier": "^6.5.0",
60
- "eslint-plugin-jest": "^23.6.0",
61
- "eslint-plugin-jsdoc": "^21.0.0",
62
- "eslint-plugin-prettier": "^3.1.1",
63
- "jest": "^26.6.3",
64
- "metro-react-native-babel-preset": "^0.58.0",
65
- "prettier": "^1.18.2",
66
- "react": "16.9.0",
67
- "react-native": "0.60.5",
68
- "semantic-release": "^17.0.1",
69
- "typescript": "^4.1.3",
70
- "react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
71
- },
72
- "dependencies": {
73
- "buffer": "^5.4.3",
74
- "eventemitter3": "^4.0.7",
75
- "react-native-tcp-socket": "6.2.0"
76
- }
77
- }
1
+ {
2
+ "name": "@react-native-ohos/react-native-tcp-socket",
3
+ "title": "React Native Tcp Socket",
4
+ "version": "6.4.0-bate.1",
5
+ "description": "React Native TCP socket API for HarmonyOS with SSL/TLS support",
6
+ "main": "src/index.js",
7
+ "types": "lib/types/index.d.ts",
8
+ "scripts": {
9
+ "ci": "yarn install --frozen-lockfile && yarn lint && yarn declaration:build && yarn checkjs && yarn test",
10
+ "lint": "eslint .",
11
+ "checkjs": "tsc && tsc -p ./__tests__/tsconfig.json",
12
+ "test": "jest ./__tests__",
13
+ "declaration:build": "tsc -p ./declaration.tsconfig.json",
14
+ "prepublishOnly": "yarn declaration:build && yarn checkjs",
15
+ "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-tcp-socket --cpp-output-path ./harmony/tcp_socket/src/main/cpp/generated --ets-output-path ./harmony/tcp_socket/src/main/ets/generated --turbo-modules-spec-paths ./src/TcpSocketModule.ts"
16
+ },
17
+ "files": [
18
+ "/src",
19
+ "/lib",
20
+ "/harmony"
21
+ ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://gitcode.com/openharmony-sig/rntpc_react-native-tcp-socket.git",
25
+ "baseUrl": "https://gitcode.com/openharmony-sig/rntpc_react-native-tcp-socket"
26
+ },
27
+ "keywords": [
28
+ "react-native",
29
+ "harmony",
30
+ "tcp-socket",
31
+ "tls",
32
+ "ssl",
33
+ "tcp-server",
34
+ "tcp-client",
35
+ "tcp",
36
+ "react-native-library"
37
+ ],
38
+ "harmony": {
39
+ "alias": "react-native-tcp-socket",
40
+ "autolinking": {
41
+ "etsPackageClassName":"TcpSocketPackage",
42
+ "cppPackageClassName":"TcpSocketPackage",
43
+ "cmakeLibraryTargetName": "rnoh_tcp_socket",
44
+ "ohPackageName": "@react-native-ohos/react-native-tcp-socket"
45
+ }
46
+ },
47
+ "license": "MIT",
48
+ "licenseFilename": "LICENSE",
49
+ "readmeFilename": "README.md",
50
+ "peerDependencies": {
51
+ "react-native": ">=0.60.0"
52
+ },
53
+ "devDependencies": {
54
+ "@babel/core": "^7.7.7",
55
+ "@semantic-release/changelog": "^5.0.0",
56
+ "@semantic-release/git": "^9.0.0",
57
+ "@semantic-release/github": "^7.0.0",
58
+ "@semantic-release/npm": "^7.0.0",
59
+ "@types/eventemitter3": "^2.0.2",
60
+ "@types/jest": "^25.1.3",
61
+ "@types/react-native": "^0.61.17",
62
+ "babel-eslint": "^10.1.0",
63
+ "babel-jest": "^24.9.0",
64
+ "eslint": "^6.8.0",
65
+ "eslint-config-prettier": "^6.5.0",
66
+ "eslint-plugin-jest": "^23.6.0",
67
+ "eslint-plugin-jsdoc": "^21.0.0",
68
+ "eslint-plugin-prettier": "^3.1.1",
69
+ "jest": "^26.6.3",
70
+ "metro-react-native-babel-preset": "^0.58.0",
71
+ "prettier": "^1.18.2",
72
+ "react": "19.1.1",
73
+ "react-native": "0.82.1",
74
+ "semantic-release": "^17.0.1",
75
+ "typescript": "^4.1.3",
76
+ "react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
77
+ },
78
+ "dependencies": {
79
+ "buffer": "^5.4.3",
80
+ "eventemitter3": "^4.0.7",
81
+ "react-native-tcp-socket": "6.2.0"
82
+ }
83
+ }
package/src/Globals.js CHANGED
@@ -1,12 +1,12 @@
1
- import { DeviceEventEmitter } from 'react-native';
2
-
3
-
4
- let instanceNumber = 0;
5
-
6
- function getNextId() {
7
- return instanceNumber++;
8
- }
9
-
10
- const nativeEventEmitter = DeviceEventEmitter;
11
-
12
- export { nativeEventEmitter, getNextId };
1
+ import { DeviceEventEmitter } from 'react-native';
2
+
3
+
4
+ let instanceNumber = 0;
5
+
6
+ function getNextId() {
7
+ return instanceNumber++;
8
+ }
9
+
10
+ const nativeEventEmitter = DeviceEventEmitter;
11
+
12
+ export { nativeEventEmitter, getNextId };