nacos-sdk-rust-binding-node 0.3.6 → 0.4.0

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/Cargo.toml CHANGED
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  edition = "2021"
3
3
  name = "nacos-sdk-rust-binding-node"
4
- version = "0.3.6"
4
+ version = "0.4.0"
5
5
  authors = ["CheirshCai <785427346@qq.com>"]
6
6
  license = "Apache-2.0"
7
7
  readme = "README.md"
@@ -18,8 +18,8 @@ crate-type = ["cdylib"]
18
18
  napi = { version = "2", default-features = false, features = ["napi4", "async"] }
19
19
  napi-derive = "2"
20
20
 
21
- nacos-sdk = { version = "0.3.6", features = ["async"] }
22
- #nacos-sdk = { git = "https://github.com/nacos-group/nacos-sdk-rust.git", branch = "main", features = ["async"] }
21
+ nacos-sdk = { version = "0.4.0", features = ["default"] }
22
+ #nacos-sdk = { git = "https://github.com/nacos-group/nacos-sdk-rust.git", branch = "main", features = ["default"] }
23
23
 
24
24
  tracing-subscriber = { version = "0.3", features = ["default"] }
25
25
  #tracing-subscriber = { version = "0.3", features = ["env-filter", "local-time"] } # occur `<unknown time>`
package/example/config.js CHANGED
@@ -6,22 +6,22 @@ const { NacosConfigClient, NacosConfigResponse } = require('../index')
6
6
  // 请注意!一般情况下,应用下仅需一个 Config 客户端,而且需要长期持有直至应用停止。
7
7
  // 因为它内部会初始化与服务端的长链接,后续的数据交互及变更订阅,都是实时地通过长链接告知客户端的。
8
8
  const nacos_config_client = new NacosConfigClient({
9
- serverAddr: '0.0.0.0:8848',
10
- namespace: "hongwen",
9
+ serverAddr: '127.0.0.1:8848',
10
+ namespace: "love",
11
11
  appName: "binding-node-example-app"
12
12
  });
13
13
 
14
14
  try {
15
15
  // If it fails, pay attention to err
16
- nacos_config_client.getConfig('hongwen.properties', 'LOVE').then(data => {
16
+ nacos_config_client.getConfig('todo-dataid', 'LOVE').then(data => {
17
17
  console.log('getConfig => ' + data);
18
18
  });
19
19
 
20
- nacos_config_client.getConfigResp('hongwen.properties', 'LOVE').then(data => {
20
+ nacos_config_client.getConfigResp('todo-dataid', 'LOVE').then(data => {
21
21
  console.log('getConfigResp => ' + JSON.stringify(data));
22
22
  });
23
23
  } catch(e) {
24
24
  console.log(e);
25
25
  }
26
26
 
27
- nacos_config_client.addListener('hongwen.properties', 'LOVE', (err, config_resp) => { console.log(config_resp) });
27
+ nacos_config_client.addListener('todo-dataid', 'LOVE', (err, config_resp) => { console.log(config_resp) });
@@ -8,7 +8,7 @@ const { NacosConfigClient, NacosConfigResponse } = require('../index')
8
8
  const nacos_config_client = new NacosConfigClient(
9
9
  {
10
10
  serverAddr: '127.0.0.1:8848',
11
- namespace: "hongwen",
11
+ namespace: "love",
12
12
  appName: "binding-node-example-app"
13
13
  },
14
14
  (err, config_req, config_resp) => {
@@ -29,15 +29,15 @@ const nacos_config_client = new NacosConfigClient(
29
29
 
30
30
  try {
31
31
  // If it fails, pay attention to err
32
- nacos_config_client.getConfig('hongwen.properties', 'LOVE').then(data => {
32
+ nacos_config_client.getConfig('todo-dataid', 'LOVE').then(data => {
33
33
  console.log('getConfig => ' + data);
34
34
  });
35
35
 
36
- nacos_config_client.getConfigResp('hongwen.properties', 'LOVE').then((data) => {
36
+ nacos_config_client.getConfigResp('todo-dataid', 'LOVE').then((data) => {
37
37
  console.log('getConfigResp => ' + JSON.stringify(data));
38
38
  });
39
39
  } catch(e) {
40
40
  console.log(e);
41
41
  }
42
42
 
43
- nacos_config_client.addListener('hongwen.properties', 'LOVE', (err, config_resp) => { console.log(config_resp) });
43
+ nacos_config_client.addListener('todo-dataid', 'LOVE', (err, config_resp) => { console.log(config_resp) });
package/example/naming.js CHANGED
@@ -6,8 +6,8 @@ const { NacosNamingClient, NacosServiceInstance } = require('../index')
6
6
  // 请注意!一般情况下,应用下仅需一个 Naming 客户端,而且需要长期持有直至应用停止。
7
7
  // 因为它内部会初始化与服务端的长链接,后续的数据交互及变更订阅,都是实时地通过长链接告知客户端的。
8
8
  const nacos_naming_client = new NacosNamingClient({
9
- serverAddr: '0.0.0.0:8848',
10
- namespace: "hongwen",
9
+ serverAddr: '127.0.0.1:8848',
10
+ namespace: "love",
11
11
  appName: "binding-node-example-app"
12
12
  });
13
13
 
@@ -66,5 +66,3 @@ function sleep(time){
66
66
  await sleep(300000);
67
67
  process.exit(0);
68
68
  })();
69
-
70
-
package/index.d.ts CHANGED
@@ -141,17 +141,17 @@ export class NacosNamingClient {
141
141
  * Get all instances by service and group. default cluster=[], subscribe=true.
142
142
  * If it fails, pay attention to err
143
143
  */
144
- getAllInstances(serviceName: string, group: string, clusters?: Array<string> | undefined | null, subscribe?: boolean = true): Promise<Array<NacosServiceInstance>>
144
+ getAllInstances(serviceName: string, group: string, clusters?: Array<string> | undefined | null, subscribe?: boolean | true): Promise<Array<NacosServiceInstance>>
145
145
  /**
146
146
  * Select instances whether healthy or not. default cluster=[], subscribe=true, healthy=true.
147
147
  * If it fails, pay attention to err
148
148
  */
149
- selectInstances(serviceName: string, group: string, clusters?: Array<string> | undefined | null, subscribe?: boolean = true, healthy?: boolean = true): Promise<Array<NacosServiceInstance>>
149
+ selectInstances(serviceName: string, group: string, clusters?: Array<string> | undefined | null, subscribe?: boolean | true, healthy?: boolean | true): Promise<Array<NacosServiceInstance>>
150
150
  /**
151
151
  * Select one healthy instance. default cluster=[], subscribe=true.
152
152
  * If it fails, pay attention to err
153
153
  */
154
- selectOneHealthyInstance(serviceName: string, group: string, clusters?: Array<string> | undefined | null, subscribe?: boolean = true): Promise<NacosServiceInstance>
154
+ selectOneHealthyInstance(serviceName: string, group: string, clusters?: Array<string> | undefined | null, subscribe?: boolean | true): Promise<NacosServiceInstance>
155
155
  /**
156
156
  * Add NacosNamingEventListener callback func, which listen the instance change.
157
157
  * If it fails, pay attention to err
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "binding",
8
8
  "ffi"
9
9
  ],
10
- "version": "0.3.6",
10
+ "version": "0.4.0",
11
11
  "bugs": "https://github.com/opc-source/nacos-sdk-rust-binding-node/issues",
12
12
  "license": "MIT",
13
13
  "repository": {
@@ -55,19 +55,19 @@
55
55
  },
56
56
  "packageManager": "yarn@3.4.1",
57
57
  "optionalDependencies": {
58
- "nacos-sdk-rust-binding-node-win32-x64-msvc": "0.3.6",
59
- "nacos-sdk-rust-binding-node-darwin-x64": "0.3.6",
60
- "nacos-sdk-rust-binding-node-linux-x64-gnu": "0.3.6",
61
- "nacos-sdk-rust-binding-node-darwin-arm64": "0.3.6",
62
- "nacos-sdk-rust-binding-node-android-arm64": "0.3.6",
63
- "nacos-sdk-rust-binding-node-linux-arm64-gnu": "0.3.6",
64
- "nacos-sdk-rust-binding-node-linux-arm64-musl": "0.3.6",
65
- "nacos-sdk-rust-binding-node-win32-arm64-msvc": "0.3.6",
66
- "nacos-sdk-rust-binding-node-linux-arm-gnueabihf": "0.3.6",
67
- "nacos-sdk-rust-binding-node-linux-x64-musl": "0.3.6",
68
- "nacos-sdk-rust-binding-node-freebsd-x64": "0.3.6",
69
- "nacos-sdk-rust-binding-node-win32-ia32-msvc": "0.3.6",
70
- "nacos-sdk-rust-binding-node-android-arm-eabi": "0.3.6",
71
- "nacos-sdk-rust-binding-node-darwin-universal": "0.3.6"
58
+ "nacos-sdk-rust-binding-node-win32-x64-msvc": "0.4.0",
59
+ "nacos-sdk-rust-binding-node-darwin-x64": "0.4.0",
60
+ "nacos-sdk-rust-binding-node-linux-x64-gnu": "0.4.0",
61
+ "nacos-sdk-rust-binding-node-darwin-arm64": "0.4.0",
62
+ "nacos-sdk-rust-binding-node-android-arm64": "0.4.0",
63
+ "nacos-sdk-rust-binding-node-linux-arm64-gnu": "0.4.0",
64
+ "nacos-sdk-rust-binding-node-linux-arm64-musl": "0.4.0",
65
+ "nacos-sdk-rust-binding-node-win32-arm64-msvc": "0.4.0",
66
+ "nacos-sdk-rust-binding-node-linux-arm-gnueabihf": "0.4.0",
67
+ "nacos-sdk-rust-binding-node-linux-x64-musl": "0.4.0",
68
+ "nacos-sdk-rust-binding-node-freebsd-x64": "0.4.0",
69
+ "nacos-sdk-rust-binding-node-win32-ia32-msvc": "0.4.0",
70
+ "nacos-sdk-rust-binding-node-android-arm-eabi": "0.4.0",
71
+ "nacos-sdk-rust-binding-node-darwin-universal": "0.4.0"
72
72
  }
73
73
  }
package/src/naming.rs CHANGED
@@ -123,7 +123,7 @@ impl NacosNamingClient {
123
123
  service_name: String,
124
124
  group: String,
125
125
  clusters: Option<Vec<String>>,
126
- #[napi(ts_arg_type = "boolean = true")] subscribe: Option<bool>,
126
+ #[napi(ts_arg_type = "boolean | true")] subscribe: Option<bool>,
127
127
  ) -> Result<Vec<NacosServiceInstance>> {
128
128
  let rust_instances = self
129
129
  .inner
@@ -152,8 +152,8 @@ impl NacosNamingClient {
152
152
  service_name: String,
153
153
  group: String,
154
154
  clusters: Option<Vec<String>>,
155
- #[napi(ts_arg_type = "boolean = true")] subscribe: Option<bool>,
156
- #[napi(ts_arg_type = "boolean = true")] healthy: Option<bool>,
155
+ #[napi(ts_arg_type = "boolean | true")] subscribe: Option<bool>,
156
+ #[napi(ts_arg_type = "boolean | true")] healthy: Option<bool>,
157
157
  ) -> Result<Vec<NacosServiceInstance>> {
158
158
  let rust_instances = self
159
159
  .inner
@@ -183,7 +183,7 @@ impl NacosNamingClient {
183
183
  service_name: String,
184
184
  group: String,
185
185
  clusters: Option<Vec<String>>,
186
- #[napi(ts_arg_type = "boolean = true")] subscribe: Option<bool>,
186
+ #[napi(ts_arg_type = "boolean | true")] subscribe: Option<bool>,
187
187
  ) -> Result<NacosServiceInstance> {
188
188
  let rust_instance = self
189
189
  .inner