@rdmind/rdmind 0.0.21-alpha.2 → 0.0.22-alpha.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/cli.js +4489 -3452
- package/package.json +2 -2
- package/template/sns-demo-app/pom.xml +5 -0
- package/template/sns-demo-app/src/test/java/com/xiaohongshu/sns/demo/app/.gitkeep +0 -0
- package/template/sns-demo-common/pom.xml +9 -0
- package/template/sns-demo-common/src/main/java/com/xiaohongshu/sns/demo/common/metrics/DemoMetrics.java +83 -0
- package/template/sns-demo-common/src/test/java/com/xiaohongshu/sns/demo/common/.gitkeep +0 -0
- package/template/sns-demo-common/src/test/java/com/xiaohongshu/sns/demo/common/utils/RpcResultUtilsTest.java +29 -0
- package/template/sns-demo-domain/pom.xml +5 -0
- package/template/sns-demo-domain/src/test/java/com/xiaohongshu/sns/demo/domain/.gitkeep +0 -0
- package/template/sns-demo-infrastructure/pom.xml +5 -0
- package/template/sns-demo-infrastructure/src/main/java/com/xiaohongshu/sns/demo/infrastructure/config/threadpool/ExecutorConfig.java +24 -0
- package/template/sns-demo-infrastructure/src/test/java/com/xiaohongshu/sns/demo/infrastructure/.gitkeep +0 -0
- package/template/sns-demo-start/pom.xml +5 -0
- package/template/sns-demo-start/src/test/java/com/xiaohongshu/sns/demo/start/.gitkeep +0 -0
- package/templates/idl-template/wiki/.arcconfig +3 -0
- package/templates/idl-template/wiki/README.md +173 -0
- package/templates/idl-template/wiki/SDK-Dev-Guide.md +61 -0
- package/templates/idl-template/wiki/example/.arcconfig +3 -0
- package/templates/idl-template/wiki/example/.gitlab-ci.yml +26 -0
- package/templates/idl-template/wiki/example/gen-java.sh +4 -0
- package/templates/idl-template/wiki/example/hello.thrift +29 -0
- package/templates/idl-template/wiki/example/maven_project/pom.xml +95 -0
- package/templates/idl-template/wiki/example/maven_project/src/main/java/com/xiaohongshu/sns/thrift/hello/HelloServiceAutoConfiguration.java +46 -0
- package/templates/idl-template/wiki/example/maven_project/src/main/java/com/xiaohongshu/sns/thrift/hello/HelloServiceProperties.java +18 -0
- package/templates/idl-template/wiki/example/maven_project/src/main/resources/META-INF/spring.factories +3 -0
- package/templates/idl-template/wiki/example/maven_project/src/test/java/com/xiaohongshu/sns/thrift/test/AutoConfigureTest.java +53 -0
- package/templates/idl-template/wiki/example/sdk-spec.yml +5 -0
- package/examples/context/RDMind.md +0 -8
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
package com.xiaohongshu.sns.thrift.hello;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import com.xiaohongshu.infra.rpc.core.client.NettyClientProxyFactory;
|
|
5
|
+
import com.xiaohongshu.infra.rpc.core.registry.eds.MultiRegionsEdsThriftAddressSubscriberProvider;
|
|
6
|
+
import com.xiaohongshu.sns.rpc.hello.HelloService;
|
|
7
|
+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
8
|
+
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
9
|
+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
10
|
+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
11
|
+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
12
|
+
import org.springframework.context.annotation.Bean;
|
|
13
|
+
import org.springframework.context.annotation.Configuration;
|
|
14
|
+
import org.springframework.context.annotation.Lazy;
|
|
15
|
+
|
|
16
|
+
@Configuration
|
|
17
|
+
@ConditionalOnProperty(prefix = "rpc.hello", name = "service-name")
|
|
18
|
+
@ConditionalOnClass(HelloService.class)
|
|
19
|
+
@ConditionalOnBean(MultiRegionsEdsThriftAddressSubscriberProvider.class)
|
|
20
|
+
@EnableConfigurationProperties(com.xiaohongshu.sns.thrift.hello.HelloServiceProperties.class)
|
|
21
|
+
public class HelloServiceAutoConfiguration {
|
|
22
|
+
|
|
23
|
+
private MultiRegionsEdsThriftAddressSubscriberProvider thriftServerMultiRegionEdsSubscriber;
|
|
24
|
+
private com.xiaohongshu.sns.thrift.hello.HelloServiceProperties properties;
|
|
25
|
+
|
|
26
|
+
public HelloServiceAutoConfiguration (MultiRegionsEdsThriftAddressSubscriberProvider thriftServerMultiRegionEdsSubscriber,
|
|
27
|
+
com.xiaohongshu.sns.thrift.hello.HelloServiceProperties properties) {
|
|
28
|
+
this.thriftServerMultiRegionEdsSubscriber = thriftServerMultiRegionEdsSubscriber;
|
|
29
|
+
this.properties = properties;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Lazy
|
|
33
|
+
@Bean
|
|
34
|
+
@ConditionalOnMissingBean(name = "helloClient")
|
|
35
|
+
public NettyClientProxyFactory helloClient() {
|
|
36
|
+
NettyClientProxyFactory factory = new NettyClientProxyFactory();
|
|
37
|
+
factory.setServerAddressProvider(this.thriftServerMultiRegionEdsSubscriber);
|
|
38
|
+
factory.setThriftClass(HelloService.class);
|
|
39
|
+
factory.setServiceName(this.properties.getServiceName());
|
|
40
|
+
factory.setRpcTimeout(this.properties.getRpcTimeout());
|
|
41
|
+
factory.setConnectTimeout(this.properties.getConnectionTimeout());
|
|
42
|
+
factory.setMethodConfigMap(this.properties.getMethodConfig());
|
|
43
|
+
return factory;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package com.xiaohongshu.sns.thrift.hello;
|
|
2
|
+
|
|
3
|
+
import com.xiaohongshu.infra.rpc.core.ThriftMethodConfig;
|
|
4
|
+
import lombok.Data;
|
|
5
|
+
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
6
|
+
|
|
7
|
+
import java.util.Map;
|
|
8
|
+
|
|
9
|
+
@Data
|
|
10
|
+
@ConfigurationProperties("rpc.hello")
|
|
11
|
+
public class HelloServiceProperties {
|
|
12
|
+
|
|
13
|
+
private String serviceName;
|
|
14
|
+
private Integer rpcTimeout = 1000;
|
|
15
|
+
private Integer connectionTimeout = 100;
|
|
16
|
+
private Map<String, ThriftMethodConfig> methodConfig;
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
package com.xiaohongshu.sns.thrift.test;
|
|
2
|
+
|
|
3
|
+
import com.xiaohongshu.infra.rpc.core.registry.consul.ThriftServerAddressConsulManager;
|
|
4
|
+
import com.xiaohongshu.sns.rpc.hello.HelloService;
|
|
5
|
+
import com.xiaohongshu.sns.thrift.hello.HelloServiceAutoConfiguration;
|
|
6
|
+
import org.junit.After;
|
|
7
|
+
import org.junit.Assert;
|
|
8
|
+
import org.junit.Before;
|
|
9
|
+
import org.junit.Test;
|
|
10
|
+
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
|
11
|
+
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
12
|
+
import org.springframework.core.env.MutablePropertySources;
|
|
13
|
+
import org.springframework.core.env.StandardEnvironment;
|
|
14
|
+
import org.springframework.mock.env.MockPropertySource;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
public class AutoConfigureTest {
|
|
18
|
+
|
|
19
|
+
private AnnotationConfigApplicationContext context;
|
|
20
|
+
|
|
21
|
+
@Before
|
|
22
|
+
public void setUp() {
|
|
23
|
+
this.context = new AnnotationConfigApplicationContext();
|
|
24
|
+
StandardEnvironment environment = new StandardEnvironment();
|
|
25
|
+
MutablePropertySources propertySources = environment.getPropertySources();
|
|
26
|
+
MockPropertySource propertySource = new MockPropertySource();
|
|
27
|
+
propertySource.setProperty("rpc.hello.serviceName", "xxx");
|
|
28
|
+
propertySources.addFirst(propertySource);
|
|
29
|
+
context.setEnvironment(environment);
|
|
30
|
+
context.register(ThriftServerAddressConsulManager.class);
|
|
31
|
+
context.register(HelloServiceAutoConfiguration.class);
|
|
32
|
+
context.refresh();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@After
|
|
36
|
+
public void tearDown() {
|
|
37
|
+
if (this.context != null) {
|
|
38
|
+
this.context.close();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Test
|
|
43
|
+
public void testBeanRegistration() {
|
|
44
|
+
try {
|
|
45
|
+
HelloService.Iface client = this.context.getBean("helloClient", HelloService.Iface.class);
|
|
46
|
+
client.ping();
|
|
47
|
+
} catch (NoSuchBeanDefinitionException e) {
|
|
48
|
+
Assert.fail(e.getMessage());
|
|
49
|
+
} catch (Exception e) {
|
|
50
|
+
e.printStackTrace();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Ink Library Screen Reader Guidance
|
|
2
|
-
|
|
3
|
-
When building custom components, it's important to keep accessibility in mind. While Ink provides the building blocks, ensuring your components are accessible will make your CLIs usable by a wider audience.
|
|
4
|
-
|
|
5
|
-
## General Principles
|
|
6
|
-
|
|
7
|
-
Provide screen reader-friendly output: Use the useIsScreenReaderEnabled hook to detect if a screen reader is active. You can then render a more descriptive output for screen reader users.
|
|
8
|
-
Leverage ARIA props: For components that have a specific role (e.g., a checkbox or a button), use the aria-role, aria-state, and aria-label props on <Box> and <Text> to provide semantic meaning to screen readers.
|