@firmer/mesh 0.0.3 → 0.0.4

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.
@@ -8,12 +8,12 @@ export declare class MeshContext extends Context {
8
8
  private urn;
9
9
  private consumer;
10
10
  private calls;
11
- private attachments;
12
- private attributes;
13
- private principals;
11
+ private readonly attachments;
12
+ private readonly attributes;
13
+ private readonly principals;
14
14
  static create(): Context;
15
15
  getAttachments(): Map<string, string>;
16
- getAttribute<T>(key: Key<T>): any;
16
+ getAttribute<T>(key: Key<T>): T;
17
17
  getAttributes(): Map<string, any>;
18
18
  getConsumer(ctc: Context): Location;
19
19
  getPrincipals(): Deque<Principal>;
@@ -23,7 +23,7 @@ export declare class MeshContext extends Context {
23
23
  getTimestamp(): number;
24
24
  getTraceId(): string;
25
25
  getUrn(): string;
26
- setAttribute<T>(key: Key<T>, value: any): void;
26
+ setAttribute<T>(key: Key<T>, value: T): void;
27
27
  resume(): Context;
28
28
  rewriteContext(ctx: Context): void;
29
29
  rewriteURN(urn: string): void;
@@ -1,22 +1,32 @@
1
- import { Key } from '../psi';
1
+ import { Context, Key } from '../psi';
2
2
  import { Invocation } from './invoker';
3
+ import { Consumer } from './consumer';
4
+ import { Codec } from '../codec';
3
5
  export declare class Mesh {
4
6
  /**
5
7
  * Mesh mpc remote address.
6
8
  */
7
- static REMOTE: Key<string>;
9
+ static readonly REMOTE: Key<string>;
8
10
  /**
9
11
  * Remote app name.
10
12
  */
11
- static REMOTE_NAME: Key<string>;
13
+ static readonly REMOTE_NAME: Key<string>;
12
14
  /**
13
15
  * Mesh invocation attributes.
14
16
  */
15
- static INVOCATION: Key<Invocation>;
17
+ static readonly INVOCATION: Key<Invocation>;
16
18
  /**
17
19
  * Mesh invoke mpi name attributes.
18
20
  */
19
- static UNAME: Key<string>;
21
+ static readonly UNAME: Key<string>;
22
+ /**
23
+ * MEsh consumer set in context.
24
+ */
25
+ static readonly CONSUMER: Key<Consumer>;
26
+ /**
27
+ * MEsh consumer set in context.
28
+ */
29
+ static readonly CODEC: Key<Codec>;
20
30
  }
21
31
  declare class MeshFlag {
22
32
  code: string;
@@ -24,19 +34,27 @@ declare class MeshFlag {
24
34
  constructor(code: string, name: string);
25
35
  }
26
36
  export declare class MeshFlags {
27
- static HTTP: MeshFlag;
28
- static GRPC: MeshFlag;
29
- static MQTT: MeshFlag;
30
- static TCP: MeshFlag;
31
- static JSON: MeshFlag;
32
- static PROTOBUF: MeshFlag;
33
- static XML: MeshFlag;
34
- static THRIFT: MeshFlag;
35
- static YAML: MeshFlag;
36
- private static PROTO;
37
- private static CODEC;
37
+ static readonly HTTP: MeshFlag;
38
+ static readonly GRPC: MeshFlag;
39
+ static readonly MQTT: MeshFlag;
40
+ static readonly TCP: MeshFlag;
41
+ static readonly JSON: MeshFlag;
42
+ static readonly PROTOBUF: MeshFlag;
43
+ static readonly XML: MeshFlag;
44
+ static readonly THRIFT: MeshFlag;
45
+ static readonly YAML: MeshFlag;
46
+ private static readonly PROTO;
47
+ private static readonly CODEC;
38
48
  static ofProto(code: string): MeshFlag;
39
49
  static ofCodec(code: string): MeshFlag;
40
50
  static ofName(name: string): MeshFlag;
41
51
  }
52
+ /**
53
+ * Set consumer in context.
54
+ */
55
+ export declare const withConsumer: (name: string) => Context;
56
+ /**
57
+ * Set codec in context.
58
+ */
59
+ export declare const withCodec: (name: string) => Context;
42
60
  export {};
@@ -83,11 +83,11 @@ export declare abstract class Context {
83
83
  /**
84
84
  * getAttribute like getAttachments, but attribute wont be transfer in invoke chain.
85
85
  */
86
- abstract getAttribute<T>(key: Key<T>): any;
86
+ abstract getAttribute<T>(key: Key<T>): T;
87
87
  /**
88
88
  * setAttribute Like putAttachments, but attribute won't be transfer in invoke chain.
89
89
  */
90
- abstract setAttribute<T>(key: Key<T>, value: any): void;
90
+ abstract setAttribute<T>(key: Key<T>, value: T): void;
91
91
  /**
92
92
  * rewriteURN rewrite the urn.
93
93
  */
@@ -105,32 +105,23 @@ export declare abstract class Context {
105
105
  * https://www.rfc-editor.org/rfc/rfc7540#section-8.1.2
106
106
  */
107
107
  export declare class Header {
108
- static MESH_TRACE_ID: Header;
109
- static MESH_SPAN_ID: Header;
110
- static MESH_TIMESTAMP: Header;
111
- static MESH_RUN_MODE: Header;
112
- static MESH_CONSUMER: Header;
113
- static MESH_PROVIDER: Header;
114
- static MESH_URN: Header;
115
- static MESH_FROM_INST_ID: Header;
116
- static MESH_FROM_NODE_ID: Header;
117
- static MESH_INCOMING_HOST: Header;
118
- static MESH_OUTGOING_HOST: Header;
119
- static MESH_INCOMING_PROXY: Header;
120
- static MESH_OUTGOING_PROXY: Header;
121
- static MESH_SUBSET: Header;
122
- static MESH_SESSION_ID: Header;
123
- static MESH_VERSION: Header;
124
- static MESH_TIMEOUT: Header;
125
- static MESH_PTP_VERSION: Header;
126
- static MESH_PTP_TPC: Header;
127
- static MESH_PTP_TRACE_ID: Header;
128
- static MESH_PTP_TOKEN: Header;
129
- static MESH_PTP_SOURCE_NODE_ID: Header;
130
- static MESH_PTP_TARGET_NODE_ID: Header;
131
- static MESH_PTP_SOURCE_INST_ID: Header;
132
- static MESH_PTP_TARGET_INST_ID: Header;
133
- static MESH_PTP_SESSION_ID: Header;
108
+ static readonly MESH_TRACE_ID: Header;
109
+ static readonly MESH_SPAN_ID: Header;
110
+ static readonly MESH_TIMESTAMP: Header;
111
+ static readonly MESH_RUN_MODE: Header;
112
+ static readonly MESH_CONSUMER: Header;
113
+ static readonly MESH_PROVIDER: Header;
114
+ static readonly MESH_URN: Header;
115
+ static readonly MESH_FROM_INST_ID: Header;
116
+ static readonly MESH_FROM_NODE_ID: Header;
117
+ static readonly MESH_INCOMING_HOST: Header;
118
+ static readonly MESH_OUTGOING_HOST: Header;
119
+ static readonly MESH_INCOMING_PROXY: Header;
120
+ static readonly MESH_OUTGOING_PROXY: Header;
121
+ static readonly MESH_SUBSET: Header;
122
+ static readonly MESH_SESSION_ID: Header;
123
+ static readonly MESH_VERSION: Header;
124
+ static readonly MESH_TIMEOUT: Header;
134
125
  private readonly key;
135
126
  constructor(key: string);
136
127
  get(ctx: Context): string;
@@ -0,0 +1,72 @@
1
+ import { Context } from './context';
2
+ import { DalerBinlog, DalerCluster, DalerDTSJob, DalerSource, DalerTest, Page, Paging } from '../types';
3
+ export declare abstract class Daler {
4
+ /**
5
+ * Query
6
+ */
7
+ query(test: DalerTest, ctx?: Context): Promise<any>;
8
+ /**
9
+ * SaveSource
10
+ */
11
+ saveSource(ds: DalerSource, ctx?: Context): Promise<string>;
12
+ /**
13
+ * IndexSource
14
+ */
15
+ indexSource(idx: Paging, ctx?: Context): Promise<Page<DalerSource>>;
16
+ /**
17
+ * DescribeSource
18
+ */
19
+ describeSource(id: string, ctx?: Context): Promise<DalerSource>;
20
+ /**
21
+ * RemoveSource
22
+ */
23
+ removeSource(id: string, ctx?: Context): Promise<void>;
24
+ /**
25
+ * SaveCluster
26
+ */
27
+ saveCluster(cluster: DalerCluster, ctx?: Context): Promise<string>;
28
+ /**
29
+ * IndexCluster
30
+ */
31
+ indexCluster(idx: Paging, ctx?: Context): Promise<Page<DalerCluster>>;
32
+ /**
33
+ * DescribeCluster
34
+ */
35
+ describeCluster(id: string, ctx?: Context): Promise<DalerCluster>;
36
+ /**
37
+ * RemoveCluster
38
+ */
39
+ removeCluster(id: string, ctx?: Context): Promise<void>;
40
+ /**
41
+ * SaveDTS
42
+ */
43
+ saveDTS(dts: DalerDTSJob, ctx?: Context): Promise<string>;
44
+ /**
45
+ * RunDTS
46
+ */
47
+ runDTS(id: string, ctx?: Context): Promise<void>;
48
+ /**
49
+ * IndexDTS
50
+ */
51
+ indexDTS(idx: Paging, ctx?: Context): Promise<Page<DalerDTSJob>>;
52
+ /**
53
+ * RemoveDTS
54
+ */
55
+ removeDTS(id: string, ctx?: Context): Promise<void>;
56
+ /**
57
+ * ToggleDTS
58
+ */
59
+ toggleDTS(id: string, ctx?: Context): Promise<void>;
60
+ /**
61
+ * IndexBinlog
62
+ */
63
+ indexBinlog(idx: Paging, ctx?: Context): Promise<Page<DalerBinlog>>;
64
+ /**
65
+ * TailBinlog
66
+ */
67
+ tailBinlog(idx: Paging, ctx?: Context): Promise<Page<Record<string, string>>>;
68
+ /**
69
+ * RedoBinlog
70
+ */
71
+ redoBinlog(id: string, ctx?: Context): Promise<void>;
72
+ }
@@ -5,6 +5,7 @@ export * from './cluster';
5
5
  export * from './commerce';
6
6
  export * from './context';
7
7
  export * from './cryptor';
8
+ export * from './daler';
8
9
  export * from './datahouse';
9
10
  export * from './dispatcher';
10
11
  export * from './endpoint';
package/dist/psi/kms.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Context } from './context';
2
- import { Environ, KeyCsr, Keys } from '../types';
2
+ import { CrtRevokeRequest, CrtRotateRequest, Environ, KeyCsr, Keys, Page, Paging } from '../types';
3
3
  export declare abstract class KMS {
4
4
  /**
5
5
  * Reset will override the keystore environ.
@@ -10,11 +10,31 @@ export declare abstract class KMS {
10
10
  */
11
11
  environ(ctx?: Context): Promise<Environ>;
12
12
  /**
13
- * List will return the keystore environ.
13
+ * Issue will apply the certification.
14
14
  */
15
- list(cno: string, ctx?: Context): Promise<Keys[]>;
15
+ issue(csr: KeyCsr, ctx?: Context): Promise<Keys>;
16
16
  /**
17
- * Issue will apply the certification.
17
+ * Index will return the keystore environ.
18
+ */
19
+ index(idx: Paging, ctx?: Context): Promise<Page<Keys>>;
20
+ /**
21
+ * Revoke will revoke the keys
22
+ */
23
+ revoke(crr: CrtRevokeRequest, ctx?: Context): Promise<void>;
24
+ /**
25
+ * Rotate will rotate the keys
26
+ */
27
+ rotate(crr: CrtRotateRequest, ctx?: Context): Promise<void>;
28
+ /**
29
+ * Remove
30
+ */
31
+ remove(id: string, ctx?: Context): Promise<void>;
32
+ /**
33
+ * Append
34
+ */
35
+ append(car: Keys, ctx?: Context): Promise<void>;
36
+ /**
37
+ * Explain
18
38
  */
19
- issue(csr: KeyCsr, ctx?: Context): Promise<Keys[]>;
39
+ explain(algo: string, keys: string, ctx?: Context): Promise<string>;
20
40
  }
@@ -1,5 +1,5 @@
1
1
  import { Context } from './context';
2
- import { AccessCode, AccessGrant, AccessID, AccessToken, Captcha, Credential } from '../types';
2
+ import { AccessCode, AccessGrant, AccessToken, Captcha, Credential, Session } from '../types';
3
3
  export declare abstract class Tokenizer {
4
4
  /**
5
5
  * Captcha apply a graphics captcha.
@@ -40,9 +40,15 @@ export declare abstract class Tokenizer {
40
40
  /**
41
41
  * Authenticate OAuth2 authenticate.
42
42
  */
43
- authenticate(token: string, ctx?: Context): Promise<AccessID>;
43
+ authenticate(token: string, ctx?: Context): Promise<Session>;
44
44
  /**
45
45
  * Refresh OAuth2 auth token refresh.
46
46
  */
47
47
  refresh(token: string, ctx?: Context): Promise<AccessToken>;
48
48
  }
49
+ export declare abstract class TokenProvider {
50
+ /**
51
+ * Provide
52
+ */
53
+ provide(token: string, ctx?: Context): Promise<Session>;
54
+ }
@@ -0,0 +1,168 @@
1
+ export declare class DalerSource {
2
+ /**
3
+ * Datasource ID
4
+ */
5
+ id: string;
6
+ /**
7
+ * Datasource name
8
+ */
9
+ name: string;
10
+ /**
11
+ * 数据结构模态:graph/relation/kv/cache/object
12
+ */
13
+ modal: string;
14
+ /**
15
+ * Datasource protocol
16
+ */
17
+ proto: string;
18
+ /**
19
+ * Datasource URL
20
+ */
21
+ url: string;
22
+ /**
23
+ * Datasource memo
24
+ */
25
+ memo: string;
26
+ /**
27
+ * 状态
28
+ */
29
+ status: number;
30
+ }
31
+ export declare class DalerInstance extends DalerSource {
32
+ /**
33
+ * Is master or slave
34
+ */
35
+ role: string;
36
+ /**
37
+ * Read wight
38
+ */
39
+ rw: number;
40
+ /**
41
+ * Write wight
42
+ */
43
+ ww: number;
44
+ /**
45
+ * Failover policy
46
+ */
47
+ failover: boolean;
48
+ }
49
+ export declare class DalerCluster {
50
+ /**
51
+ * Data Cluster ID
52
+ */
53
+ id: string;
54
+ /**
55
+ * Data Cluster name
56
+ */
57
+ name: string;
58
+ /**
59
+ * 数据结构模态:graph/relation/kv/cache/object
60
+ */
61
+ modal: string;
62
+ /**
63
+ * Max keepalive duration
64
+ */
65
+ keepalive: number;
66
+ /**
67
+ * Max retry times
68
+ */
69
+ retries: number;
70
+ /**
71
+ * ReadWrite mode
72
+ */
73
+ rwmode: number;
74
+ /**
75
+ * Failover policy
76
+ */
77
+ failover: boolean;
78
+ /**
79
+ * Instances
80
+ */
81
+ instances: DalerInstance[];
82
+ /**
83
+ * 状态
84
+ */
85
+ status: number;
86
+ /**
87
+ * Datasource URL
88
+ */
89
+ url: string;
90
+ /**
91
+ * Datasource protocol
92
+ */
93
+ proto: string;
94
+ /**
95
+ * 全局函数
96
+ */
97
+ gfs: string;
98
+ }
99
+ export declare class DalerTest {
100
+ /**
101
+ * ID
102
+ */
103
+ id: string;
104
+ /**
105
+ * Expression
106
+ */
107
+ expr: string;
108
+ /**
109
+ * Database name
110
+ */
111
+ db: string;
112
+ }
113
+ export declare class DalerDTSJob {
114
+ /**
115
+ * Datasource ID
116
+ */
117
+ id: string;
118
+ /**
119
+ * Datasource name
120
+ */
121
+ name: string;
122
+ /**
123
+ * Datasource memo
124
+ */
125
+ memo: string;
126
+ /**
127
+ * Nodes
128
+ */
129
+ nodes: string[];
130
+ /**
131
+ * Sides
132
+ */
133
+ sides: Record<string, string>;
134
+ /**
135
+ * 状态
136
+ */
137
+ status: number;
138
+ }
139
+ export declare class DalerBinlog {
140
+ /**
141
+ * Binlog ID
142
+ */
143
+ id: string;
144
+ /**
145
+ * Binlog name
146
+ */
147
+ name: string;
148
+ /**
149
+ * 数据结构模态:graph/relation/kv/cache/object
150
+ */
151
+ modal: string;
152
+ /**
153
+ * Binlog path
154
+ */
155
+ path: string;
156
+ /**
157
+ * Binlog size in bytes
158
+ */
159
+ size: number;
160
+ /**
161
+ * Binlog lines
162
+ */
163
+ lines: number;
164
+ /**
165
+ * Binlog create time
166
+ */
167
+ createAt?: Date;
168
+ }
@@ -49,4 +49,12 @@ export declare class Environ {
49
49
  * Lattice
50
50
  */
51
51
  lattice: Lattice;
52
+ /**
53
+ * 兼容
54
+ */
55
+ nodeID: string;
56
+ /**
57
+ * 兼容
58
+ */
59
+ instID: string;
52
60
  }
@@ -1,5 +1,6 @@
1
1
  export * from './builtin';
2
2
  export * from './cipher';
3
+ export * from './daler';
3
4
  export * from './document';
4
5
  export * from './entity';
5
6
  export * from './enums';
@@ -1,12 +1,3 @@
1
- export declare class Keys {
2
- /**
3
- * enumeration in KeyKind
4
- */
5
- kind: string;
6
- /**
7
- */
8
- key: string;
9
- }
10
1
  export declare class KeyCsr {
11
2
  /**
12
3
  */
@@ -20,6 +11,9 @@ export declare class KeyCsr {
20
11
  /**
21
12
  */
22
13
  length: number;
14
+ /**
15
+ */
16
+ activeAt?: Date;
23
17
  /**
24
18
  */
25
19
  expireAt?: Date;
@@ -29,6 +23,9 @@ export declare class KeyCsr {
29
23
  /**
30
24
  */
31
25
  isCA: boolean;
26
+ /**
27
+ */
28
+ caAlgo: string;
32
29
  /**
33
30
  */
34
31
  caCert: string;
@@ -38,4 +35,63 @@ export declare class KeyCsr {
38
35
  /**
39
36
  */
40
37
  ips: string[];
38
+ /**
39
+ */
40
+ name: string;
41
+ /**
42
+ * 证书用途
43
+ */
44
+ usage: number;
45
+ }
46
+ export declare class Keys extends KeyCsr {
47
+ /**
48
+ * 证书PEM
49
+ */
50
+ crt: string;
51
+ /**
52
+ * 私钥PEM
53
+ */
54
+ key: string;
55
+ /**
56
+ * 证书撤销列表PEM
57
+ */
58
+ crl: string;
59
+ /**
60
+ * 主键ID
61
+ */
62
+ id: string;
63
+ }
64
+ export declare class CrtRevokeRequest {
65
+ /**
66
+ * 主键ID
67
+ */
68
+ id: string;
69
+ /**
70
+ * 撤销原因
71
+ */
72
+ reason: number;
73
+ }
74
+ export declare class CrtRotateRequest {
75
+ /**
76
+ * 主键ID
77
+ */
78
+ id: string;
79
+ /**
80
+ * 算法
81
+ */
82
+ algo: string;
83
+ /**
84
+ * 证书过期时间
85
+ */
86
+ expireAt?: Date;
87
+ }
88
+ export declare class Keyset {
89
+ /**
90
+ * 证书列表
91
+ */
92
+ crts: Record<string, Keys>;
93
+ /**
94
+ * 根证书列表
95
+ */
96
+ roots: Record<string, Keys>;
41
97
  }
@@ -120,9 +120,9 @@ export declare class Session {
120
120
  */
121
121
  deptId: string;
122
122
  /**
123
- * User node id
123
+ * User mdc
124
124
  */
125
- nodeId: string;
125
+ mdc: string;
126
126
  /**
127
127
  * User institution id
128
128
  */