@firmer/mesh 0.0.5 → 0.0.7

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.
@@ -1,23 +1,23 @@
1
- import { Dict, globalPtr } from '../macro';
1
+ import { Dict } from '../macro';
2
2
  import { Filter } from './filter';
3
3
  import { Context } from '../psi';
4
4
  import { Invocation, Invoker } from './invoker';
5
5
  import { Codeable } from '../cause';
6
6
  export interface MeshDescriptor {
7
- beforeHooks: Dict<string, (ctx: Context, invocation: Invocation) => void>;
8
- successHooks: Dict<string, (ctx: Context, invocation: Invocation, r: any) => void>;
9
- failureHooks: Dict<string, (ctx: Context, invocation: Invocation, e: Codeable) => void>;
7
+ beforeHooks: Dict<string, (ctx: Context, invocation: Invocation) => Promise<void>>;
8
+ successHooks: Dict<string, (ctx: Context, invocation: Invocation, r: any) => Promise<void>>;
9
+ failureHooks: Dict<string, (ctx: Context, invocation: Invocation, e: Codeable) => Promise<void>>;
10
10
  }
11
11
  declare class Hooks {
12
- onBefore(name: string, hook: (ctx: Context, invocation: Invocation) => void): void;
13
- onSuccess(name: string, hook: (ctx: Context, invocation: Invocation, r: any) => void): void;
14
- onFailure(name: string, hook: (ctx: Context, invocation: Invocation, e: Codeable) => void): void;
15
- before(): Dict<string, (ctx: Context, invocation: Invocation) => void>;
16
- success(): Dict<string, (ctx: Context, invocation: Invocation, r: any) => void>;
17
- failure(): Dict<string, (ctx: Context, invocation: Invocation, r: Codeable) => void>;
12
+ onBefore(name: string, hook: (ctx: Context, invocation: Invocation) => Promise<void>): void;
13
+ onSuccess(name: string, hook: (ctx: Context, invocation: Invocation, r: any) => Promise<void>): void;
14
+ onFailure(name: string, hook: (ctx: Context, invocation: Invocation, e: Codeable) => Promise<void>): void;
15
+ before(): Dict<string, (ctx: Context, invocation: Invocation) => Promise<void>>;
16
+ success(): Dict<string, (ctx: Context, invocation: Invocation, r: any) => Promise<void>>;
17
+ failure(): Dict<string, (ctx: Context, invocation: Invocation, r: Codeable) => Promise<void>>;
18
18
  }
19
19
  declare const Hook: Hooks;
20
20
  export declare class HookFilter extends Filter {
21
21
  invoke(ctx: Context, invoker: Invoker<any>, invocation: Invocation): Promise<any>;
22
22
  }
23
- export { Hook, globalPtr };
23
+ export { Hook, };
@@ -27,6 +27,10 @@ export declare class Mesh {
27
27
  * MEsh consumer set in context.
28
28
  */
29
29
  static readonly CODEC: Key<Codec>;
30
+ /**
31
+ * MPC timeout in mills.
32
+ */
33
+ static readonly TIMEOUT: Key<number>;
30
34
  }
31
35
  declare class MeshFlag {
32
36
  code: string;
@@ -5,6 +5,7 @@ import { Reference } from '../types';
5
5
  import { Codec } from '../codec';
6
6
  import { Execution } from './execution';
7
7
  export declare class ReferenceInvokeHandler<T extends object> implements Invoker<any>, InvocationHandler {
8
+ private readonly placeholder;
8
9
  private readonly macro;
9
10
  private readonly invoker;
10
11
  constructor(macro: any);
package/dist/mpc/urn.d.ts CHANGED
@@ -7,7 +7,9 @@ export declare class URN {
7
7
  flag: URNFlag;
8
8
  name: string;
9
9
  static from(urn: string): URN;
10
- static urn(name: string): string;
10
+ static urn(name: string): URN;
11
+ proto(proto: string): this;
12
+ codec(codec: string): this;
11
13
  toString(): string;
12
14
  private asArray;
13
15
  matchName(name: string): boolean;
@@ -0,0 +1,32 @@
1
+ import { Context } from './context';
2
+ import { Page, Paging, Replica, Settings } from '../types';
3
+ export declare abstract class Devops {
4
+ /**
5
+ * Init
6
+ */
7
+ init(flags: string, ctx?: Context): Promise<void>;
8
+ /**
9
+ * Settings
10
+ */
11
+ settings(ctx?: Context): Promise<Record<string, Settings>>;
12
+ /**
13
+ * Setting
14
+ */
15
+ setting(appset: string, setting: Settings, ctx?: Context): Promise<void>;
16
+ /**
17
+ * IndexReplica
18
+ */
19
+ indexReplica(idx: Paging, ctx?: Context): Promise<Page<Replica>>;
20
+ /**
21
+ * ImportReplica
22
+ */
23
+ importReplica(raw: Uint8Array, ctx?: Context): Promise<string>;
24
+ /**
25
+ * Replicate
26
+ */
27
+ replicate(appset: string, ctx?: Context): Promise<string>;
28
+ /**
29
+ * Recover
30
+ */
31
+ recover(id: string, ctx?: Context): Promise<string>;
32
+ }
@@ -0,0 +1,20 @@
1
+ import { Context } from './context';
2
+ import { Firewall, Page, Paging } from '../types';
3
+ export declare abstract class Firewalld {
4
+ /**
5
+ * Save 保存防火墙规则,支持保存包括黑白名单、限流熔断等逻辑.
6
+ */
7
+ save(wall: Firewall, ctx?: Context): Promise<string>;
8
+ /**
9
+ * Remove 删除防火墙规则.
10
+ */
11
+ remove(code: string, ctx?: Context): Promise<void>;
12
+ /**
13
+ * Describe 查看防火墙规则.
14
+ */
15
+ describe(code: string, ctx?: Context): Promise<Firewall>;
16
+ /**
17
+ * Index 分页查看防火墙规则.
18
+ */
19
+ index(idx: Paging, ctx?: Context): Promise<Page<Firewall>>;
20
+ }
@@ -7,9 +7,10 @@ export * from './context';
7
7
  export * from './cryptor';
8
8
  export * from './daler';
9
9
  export * from './datahouse';
10
+ export * from './devops';
10
11
  export * from './dispatcher';
11
12
  export * from './endpoint';
12
- export * from './evaluator';
13
+ export * from './firewall';
13
14
  export * from './graph';
14
15
  export * from './kms';
15
16
  export * from './kv';
@@ -27,4 +28,5 @@ export * from './subscriber';
27
28
  export * from './tokenizer';
28
29
  export * from './transport';
29
30
  export * from './vfs';
31
+ export * from './vm';
30
32
  export * from './workflow';
@@ -46,4 +46,8 @@ export declare abstract class Network {
46
46
  * Imports the weave certificate.
47
47
  */
48
48
  imports(crt: string, ctx?: Context): Promise<void>;
49
+ /**
50
+ * Remove the network route.
51
+ */
52
+ remove(sid: string, did: string, ctx?: Context): Promise<void>;
49
53
  }
@@ -1,5 +1,5 @@
1
1
  import { Context } from './context';
2
- import { AccessCode, AccessGrant, AccessToken, Captcha, Credential, Session } from '../types';
2
+ import { AccessCode, AccessGrant, AccessToken, Captcha, Credential, GrantCode, Session } from '../types';
3
3
  export declare abstract class Tokenizer {
4
4
  /**
5
5
  * Captcha apply a graphics captcha.
@@ -22,9 +22,9 @@ export declare abstract class Tokenizer {
22
22
  */
23
23
  quickauth(credential: Credential, ctx?: Context): Promise<AccessToken>;
24
24
  /**
25
- * Grant OAuth2 code grant.
25
+ * Grant OAuth2 code authorize.
26
26
  */
27
- grant(credential: Credential, ctx?: Context): Promise<AccessGrant>;
27
+ grant(grant: AccessGrant, ctx?: Context): Promise<GrantCode>;
28
28
  /**
29
29
  * Accept OAuth2 accept grant code.
30
30
  */
@@ -45,10 +45,14 @@ export declare abstract class Tokenizer {
45
45
  * Refresh OAuth2 auth token refresh.
46
46
  */
47
47
  refresh(token: string, ctx?: Context): Promise<AccessToken>;
48
+ /**
49
+ * Destroy OAuth2 auth token destroy.
50
+ */
51
+ destroy(token: string, ctx?: Context): Promise<void>;
48
52
  }
49
- export declare abstract class TokenProvider {
53
+ export declare abstract class AuthProvider {
50
54
  /**
51
- * Provide
55
+ * Session
52
56
  */
53
- provide(token: string, ctx?: Context): Promise<Session>;
57
+ session(credential: Credential, ctx?: Context): Promise<Session>;
54
58
  }
@@ -0,0 +1,28 @@
1
+ import { Context } from './context';
2
+ import { Page, Paging, Script } from '../types';
3
+ export declare abstract class VM {
4
+ /**
5
+ * Compile the script.
6
+ */
7
+ compile(script: Script, ctx?: Context): Promise<string>;
8
+ /**
9
+ * Setup set up the script.
10
+ */
11
+ setup(code: string, version: string, ctx?: Context): Promise<void>;
12
+ /**
13
+ * Remove the script.
14
+ */
15
+ remove(code: string, ctx?: Context): Promise<void>;
16
+ /**
17
+ * Describe the script.
18
+ */
19
+ describe(code: string, ctx?: Context): Promise<Script>;
20
+ /**
21
+ * Exec the script with name.
22
+ */
23
+ exec(code: string, args: Record<string, string>, dft: string, ctx?: Context): Promise<string>;
24
+ /**
25
+ * Index the scripts.
26
+ */
27
+ index(idx: Paging, ctx?: Context): Promise<Page<Script>>;
28
+ }
@@ -0,0 +1,100 @@
1
+ export declare class Settings {
2
+ /**
3
+ * 名称
4
+ */
5
+ name: string;
6
+ /**
7
+ * 图标
8
+ */
9
+ icon: string;
10
+ /**
11
+ * 版本
12
+ */
13
+ version: string;
14
+ /**
15
+ * 说明
16
+ */
17
+ memo: string;
18
+ /**
19
+ * 扩展
20
+ */
21
+ raw: Record<string, string>;
22
+ }
23
+ export declare class Replica {
24
+ /**
25
+ * 主键,任务编码
26
+ */
27
+ code: string;
28
+ /**
29
+ * 任务名称
30
+ */
31
+ name: string;
32
+ /**
33
+ * 场景:backup/restore/migrate/sync
34
+ */
35
+ scene: string;
36
+ /**
37
+ * 模式:full/incremental
38
+ */
39
+ mode: string;
40
+ /**
41
+ * 调度:cron/once
42
+ */
43
+ plan: string;
44
+ /**
45
+ * 说明
46
+ */
47
+ memo: string;
48
+ /**
49
+ * 源类型
50
+ */
51
+ srcKind: string;
52
+ /**
53
+ * 源地址
54
+ */
55
+ srcURI: string;
56
+ /**
57
+ * 源选项
58
+ */
59
+ srcOption: string;
60
+ /**
61
+ * 目标类型
62
+ */
63
+ dstKind: string;
64
+ /**
65
+ * 目标地址
66
+ */
67
+ dstURI: string;
68
+ /**
69
+ * 目标选项
70
+ */
71
+ dstOption: string;
72
+ /**
73
+ * 最近一次执行结果
74
+ */
75
+ last: string;
76
+ /**
77
+ * 状态
78
+ */
79
+ status: number;
80
+ /**
81
+ * 原始配置
82
+ */
83
+ raw: string;
84
+ /**
85
+ * 创建时间
86
+ */
87
+ createAt?: Date;
88
+ /**
89
+ * 更新时间
90
+ */
91
+ updateAt?: Date;
92
+ /**
93
+ * 创建人
94
+ */
95
+ createBy: string;
96
+ /**
97
+ * 更新人
98
+ */
99
+ updateBy: string;
100
+ }
@@ -57,4 +57,8 @@ export declare class Environ {
57
57
  * 兼容
58
58
  */
59
59
  instID: string;
60
+ /**
61
+ * 兼容
62
+ */
63
+ instName: string;
60
64
  }
@@ -0,0 +1,98 @@
1
+ export declare class Firewall {
2
+ /**
3
+ * 主键
4
+ */
5
+ code: string;
6
+ /**
7
+ * 名称
8
+ */
9
+ name: string;
10
+ /**
11
+ * 绑定地址
12
+ */
13
+ listen: string;
14
+ /**
15
+ * 优先级
16
+ */
17
+ priority: number;
18
+ /**
19
+ * 协议类型TCP/ALP/UDP
20
+ */
21
+ kind: string;
22
+ /**
23
+ * 场景模式limit/control
24
+ */
25
+ mode: string;
26
+ /**
27
+ * 具体协议
28
+ */
29
+ proto: string;
30
+ /**
31
+ * 插件名称
32
+ */
33
+ filter: string;
34
+ /**
35
+ * 插件参数
36
+ */
37
+ flags: string;
38
+ /**
39
+ * 访问来源
40
+ */
41
+ src: string;
42
+ /**
43
+ * 访问目的
44
+ */
45
+ dst: string;
46
+ /**
47
+ * 主机
48
+ */
49
+ host: string;
50
+ /**
51
+ * 路径
52
+ */
53
+ path: string;
54
+ /**
55
+ * 方法
56
+ */
57
+ method: string;
58
+ /**
59
+ * 参数
60
+ */
61
+ query: string;
62
+ /**
63
+ * 头部
64
+ */
65
+ header: string;
66
+ /**
67
+ * cookie
68
+ */
69
+ cookie: string;
70
+ /**
71
+ * 备注
72
+ */
73
+ memo: string;
74
+ /**
75
+ * JSON信息
76
+ */
77
+ raw: string;
78
+ /**
79
+ * 状态
80
+ */
81
+ status: number;
82
+ /**
83
+ * 创建时间
84
+ */
85
+ createAt?: Date;
86
+ /**
87
+ * 更新时间
88
+ */
89
+ updateAt?: Date;
90
+ /**
91
+ * 创建人
92
+ */
93
+ createBy: string;
94
+ /**
95
+ * 更新人
96
+ */
97
+ updateBy: string;
98
+ }
@@ -1,11 +1,13 @@
1
1
  export * from './builtin';
2
2
  export * from './cipher';
3
3
  export * from './daler';
4
+ export * from './devops';
4
5
  export * from './document';
5
6
  export * from './entity';
6
7
  export * from './enums';
7
8
  export * from './environ';
8
9
  export * from './event';
10
+ export * from './firewall';
9
11
  export * from './keys';
10
12
  export * from './license';
11
13
  export * from './oauth2';
@@ -14,6 +16,7 @@ export * from './principal';
14
16
  export * from './registration';
15
17
  export * from './route';
16
18
  export * from './savepoint';
19
+ export * from './schema';
17
20
  export * from './script';
18
21
  export * from './status';
19
22
  export * from './transport';
@@ -12,25 +12,43 @@ export declare class Captcha {
12
12
  */
13
13
  text: string;
14
14
  }
15
- export declare class Credential {
15
+ export declare class AccessGrant {
16
16
  /**
17
17
  * OAuth client id
18
18
  */
19
19
  clientId: string;
20
20
  /**
21
- * OAuth client key
21
+ * OAuth authorize scope
22
22
  */
23
- clientKey: string;
23
+ scope: string;
24
24
  /**
25
- * OAuth authorize username
25
+ * OAuth authorize state
26
26
  */
27
- username: string;
27
+ state: string;
28
28
  /**
29
- * OAuth authorize password
29
+ * OAuth authorize flags, 2 redirect, 4 callback
30
30
  */
31
- password: string;
31
+ flags: number;
32
+ }
33
+ export declare class Credential {
34
+ /**
35
+ * Auth client id
36
+ */
37
+ clientId: string;
32
38
  /**
33
- * OAuth authorize captcha
39
+ * Auth type: password/verifycode/qrcode
40
+ */
41
+ authType: string;
42
+ /**
43
+ * Auth authorize key like username
44
+ */
45
+ accessKey: string;
46
+ /**
47
+ * Auth authorize secret like password
48
+ */
49
+ secretKey: string;
50
+ /**
51
+ * Auth authorize captcha
34
52
  */
35
53
  captcha: string;
36
54
  }
@@ -46,7 +64,7 @@ export declare class AccessToken {
46
64
  /**
47
65
  * OAuth access token expires time in mills
48
66
  */
49
- expiresAt: number;
67
+ expiresAt?: Date;
50
68
  /**
51
69
  * OAuth access token scope
52
70
  */
@@ -56,7 +74,7 @@ export declare class AccessToken {
56
74
  */
57
75
  refreshToken: string;
58
76
  }
59
- export declare class AccessGrant {
77
+ export declare class GrantCode {
60
78
  /**
61
79
  * OAuth grant code
62
80
  */
@@ -0,0 +1,158 @@
1
+ export declare class ParameterMirror {
2
+ /**
3
+ */
4
+ name: string;
5
+ /**
6
+ */
7
+ macros: Record<string, Record<string, string>>;
8
+ /**
9
+ */
10
+ comments: string[];
11
+ /**
12
+ */
13
+ kind: string;
14
+ /**
15
+ */
16
+ value: string;
17
+ /**
18
+ */
19
+ flags: number;
20
+ /**
21
+ */
22
+ usage: string;
23
+ }
24
+ export declare class ReturnMirror {
25
+ /**
26
+ */
27
+ name: string;
28
+ /**
29
+ */
30
+ comments: string[];
31
+ /**
32
+ */
33
+ kind: string;
34
+ /**
35
+ */
36
+ value: string;
37
+ /**
38
+ */
39
+ flags: number;
40
+ /**
41
+ */
42
+ usage: string;
43
+ }
44
+ export declare class ThrowableMirror {
45
+ /**
46
+ */
47
+ name: string;
48
+ /**
49
+ */
50
+ comments: string[];
51
+ /**
52
+ */
53
+ kind: string;
54
+ }
55
+ export declare class VariableMirror {
56
+ /**
57
+ */
58
+ name: string;
59
+ /**
60
+ */
61
+ macros: Record<string, Record<string, string>>;
62
+ /**
63
+ */
64
+ comments: string[];
65
+ /**
66
+ */
67
+ modifier: number;
68
+ /**
69
+ */
70
+ kind: string;
71
+ /**
72
+ */
73
+ value: string;
74
+ /**
75
+ */
76
+ flags: number;
77
+ /**
78
+ */
79
+ usage: string;
80
+ }
81
+ export declare class MethodMirror {
82
+ /**
83
+ */
84
+ name: string;
85
+ /**
86
+ */
87
+ macros: Record<string, Record<string, string>>;
88
+ /**
89
+ */
90
+ comments: string[];
91
+ /**
92
+ */
93
+ modifier: number;
94
+ /**
95
+ */
96
+ parameters: ParameterMirror[];
97
+ /**
98
+ */
99
+ returns: ReturnMirror[];
100
+ /**
101
+ */
102
+ causes: ThrowableMirror[];
103
+ }
104
+ export declare class KindMirror {
105
+ /**
106
+ */
107
+ name: string;
108
+ /**
109
+ */
110
+ macros: Record<string, Record<string, string>>;
111
+ /**
112
+ */
113
+ comments: string[];
114
+ /**
115
+ */
116
+ modifier: number;
117
+ /**
118
+ */
119
+ variables: VariableMirror[];
120
+ /**
121
+ */
122
+ methods: MethodMirror[];
123
+ /**
124
+ */
125
+ supers: string[];
126
+ /**
127
+ */
128
+ traits: string[];
129
+ /**
130
+ */
131
+ signature: string;
132
+ }
133
+ export declare class FileMirror {
134
+ /**
135
+ */
136
+ name: string;
137
+ /**
138
+ */
139
+ pkg: string;
140
+ /**
141
+ */
142
+ path: string;
143
+ /**
144
+ */
145
+ imports: Record<string, string>;
146
+ /**
147
+ */
148
+ kinds: KindMirror[];
149
+ /**
150
+ */
151
+ variables: VariableMirror[];
152
+ /**
153
+ */
154
+ methods: MethodMirror[];
155
+ /**
156
+ */
157
+ set: Record<string, string>;
158
+ }