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

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.3"
4
+ version = "0.3.6"
5
5
  authors = ["CheirshCai <785427346@qq.com>"]
6
6
  license = "Apache-2.0"
7
7
  readme = "README.md"
@@ -18,7 +18,7 @@ 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.3", features = ["async"] }
21
+ nacos-sdk = { version = "0.3.6", features = ["async"] }
22
22
  #nacos-sdk = { git = "https://github.com/nacos-group/nacos-sdk-rust.git", branch = "main", features = ["async"] }
23
23
 
24
24
  tracing-subscriber = { version = "0.3", features = ["default"] }
package/example/config.js CHANGED
@@ -3,6 +3,8 @@
3
3
  const { NacosConfigClient, NacosConfigResponse } = require('../index')
4
4
 
5
5
  // If it fails, pay attention to err
6
+ // 请注意!一般情况下,应用下仅需一个 Config 客户端,而且需要长期持有直至应用停止。
7
+ // 因为它内部会初始化与服务端的长链接,后续的数据交互及变更订阅,都是实时地通过长链接告知客户端的。
6
8
  const nacos_config_client = new NacosConfigClient({
7
9
  serverAddr: '0.0.0.0:8848',
8
10
  namespace: "hongwen",
@@ -3,6 +3,8 @@
3
3
  const { NacosConfigClient, NacosConfigResponse } = require('../index')
4
4
 
5
5
  // If it fails, pay attention to err
6
+ // 请注意!一般情况下,应用下仅需一个 Config 客户端,而且需要长期持有直至应用停止。
7
+ // 因为它内部会初始化与服务端的长链接,后续的数据交互及变更订阅,都是实时地通过长链接告知客户端的。
6
8
  const nacos_config_client = new NacosConfigClient(
7
9
  {
8
10
  serverAddr: '127.0.0.1:8848',
package/example/naming.js CHANGED
@@ -3,6 +3,8 @@
3
3
  const { NacosNamingClient, NacosServiceInstance } = require('../index')
4
4
 
5
5
  // If it fails, pay attention to err
6
+ // 请注意!一般情况下,应用下仅需一个 Naming 客户端,而且需要长期持有直至应用停止。
7
+ // 因为它内部会初始化与服务端的长链接,后续的数据交互及变更订阅,都是实时地通过长链接告知客户端的。
6
8
  const nacos_naming_client = new NacosNamingClient({
7
9
  serverAddr: '0.0.0.0:8848',
8
10
  namespace: "hongwen",
package/index.d.ts CHANGED
@@ -17,6 +17,8 @@ export interface ClientOptions {
17
17
  password?: string
18
18
  /** naming push_empty_protection, default true */
19
19
  namingPushEmptyProtection?: boolean
20
+ /** naming load_cache_at_start, default false */
21
+ namingLoadCacheAtStart?: boolean
20
22
  }
21
23
  export interface NacosConfigResponse {
22
24
  /** Namespace/Tenant */
@@ -108,13 +110,13 @@ export class NacosConfigClient {
108
110
  * Add NacosConfigChangeListener callback func, which listen the config change.
109
111
  * If it fails, pay attention to err
110
112
  */
111
- addListener(dataId: string, group: string, listener: (err: Error | null, value: NacosConfigResponse) => any): Promise<void>
113
+ addListener(dataId: string, group: string, listener: (err: Error | null, arg: NacosConfigResponse) => any): Promise<void>
112
114
  /**
113
115
  * Remove NacosConfigChangeListener callback func, but noop....
114
116
  * The logic is not implemented internally, and only APIs are provided as compatibility.
115
117
  * Users maybe do not need it? Not removing the listener is not a big problem, Sorry!
116
118
  */
117
- removeListener(dataId: string, group: string, listener: (err: Error | null, value: NacosConfigResponse) => any): Promise<void>
119
+ removeListener(dataId: string, group: string, listener: (err: Error | null, arg: NacosConfigResponse) => any): Promise<void>
118
120
  }
119
121
  /** Client api of Nacos Naming. */
120
122
  export class NacosNamingClient {
@@ -154,11 +156,11 @@ export class NacosNamingClient {
154
156
  * Add NacosNamingEventListener callback func, which listen the instance change.
155
157
  * If it fails, pay attention to err
156
158
  */
157
- subscribe(serviceName: string, group: string, clusters: Array<string> | undefined | null, listener: (err: Error | null, value: Array<NacosServiceInstance>) => any): Promise<void>
159
+ subscribe(serviceName: string, group: string, clusters: Array<string> | undefined | null, listener: (err: Error | null, arg: Array<NacosServiceInstance>) => any): Promise<void>
158
160
  /**
159
161
  * Remove NacosNamingEventListener callback func, but noop....
160
162
  * The logic is not implemented internally, and only APIs are provided as compatibility.
161
163
  * Users maybe do not need it? Not removing the subscription is not a big problem, Sorry!
162
164
  */
163
- unSubscribe(serviceName: string, group: string, clusters: Array<string> | undefined | null, listener: (err: Error | null, value: Array<NacosServiceInstance>) => any): Promise<void>
165
+ unSubscribe(serviceName: string, group: string, clusters: Array<string> | undefined | null, listener: (err: Error | null, arg: Array<NacosServiceInstance>) => any): Promise<void>
164
166
  }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "binding",
8
8
  "ffi"
9
9
  ],
10
- "version": "0.3.3",
10
+ "version": "0.3.6",
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.3",
59
- "nacos-sdk-rust-binding-node-darwin-x64": "0.3.3",
60
- "nacos-sdk-rust-binding-node-linux-x64-gnu": "0.3.3",
61
- "nacos-sdk-rust-binding-node-darwin-arm64": "0.3.3",
62
- "nacos-sdk-rust-binding-node-android-arm64": "0.3.3",
63
- "nacos-sdk-rust-binding-node-linux-arm64-gnu": "0.3.3",
64
- "nacos-sdk-rust-binding-node-linux-arm64-musl": "0.3.3",
65
- "nacos-sdk-rust-binding-node-win32-arm64-msvc": "0.3.3",
66
- "nacos-sdk-rust-binding-node-linux-arm-gnueabihf": "0.3.3",
67
- "nacos-sdk-rust-binding-node-linux-x64-musl": "0.3.3",
68
- "nacos-sdk-rust-binding-node-freebsd-x64": "0.3.3",
69
- "nacos-sdk-rust-binding-node-win32-ia32-msvc": "0.3.3",
70
- "nacos-sdk-rust-binding-node-android-arm-eabi": "0.3.3",
71
- "nacos-sdk-rust-binding-node-darwin-universal": "0.3.3"
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"
72
72
  }
73
73
  }
package/src/lib.rs CHANGED
@@ -56,6 +56,8 @@ pub struct ClientOptions {
56
56
  pub password: Option<String>,
57
57
  /// naming push_empty_protection, default true
58
58
  pub naming_push_empty_protection: Option<bool>,
59
+ /// naming load_cache_at_start, default false
60
+ pub naming_load_cache_at_start: Option<bool>,
59
61
  }
60
62
 
61
63
  mod config;
package/src/naming.rs CHANGED
@@ -25,7 +25,8 @@ impl NacosNamingClient {
25
25
  .app_name
26
26
  .unwrap_or(nacos_sdk::api::constants::UNKNOWN.to_string()),
27
27
  )
28
- .naming_push_empty_protection(client_options.naming_push_empty_protection.unwrap_or(true));
28
+ .naming_push_empty_protection(client_options.naming_push_empty_protection.unwrap_or(true))
29
+ .naming_load_cache_at_start(client_options.naming_load_cache_at_start.unwrap_or(false));
29
30
 
30
31
  // need enable_auth_plugin_http with username & password
31
32
  let is_enable_auth = client_options.username.is_some() && client_options.password.is_some();
package/tea.yaml ADDED
@@ -0,0 +1,7 @@
1
+ # https://tea.xyz/what-is-this-file
2
+ ---
3
+ version: 1.0.0
4
+ codeOwners:
5
+ - '0x43814eC189dF422BfE409cC4391d270d2401fe53'
6
+ - '0xcdd8B009EAc6179EDF1c0A0eA4A3fe413914f12c'
7
+ quorum: 1