@firmer/mesh 0.0.1

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.
Files changed (111) hide show
  1. package/README.md +24 -0
  2. package/dist/asm/index.d.ts +11 -0
  3. package/dist/cause/codeable.d.ts +5 -0
  4. package/dist/cause/errors.d.ts +1 -0
  5. package/dist/cause/index.d.ts +3 -0
  6. package/dist/cause/status.d.ts +46 -0
  7. package/dist/codec/codec.d.ts +43 -0
  8. package/dist/codec/index.d.ts +2 -0
  9. package/dist/codec/json.d.ts +12 -0
  10. package/dist/grpc/consumer.d.ts +8 -0
  11. package/dist/grpc/index.d.ts +3 -0
  12. package/dist/grpc/interceptor.d.ts +2 -0
  13. package/dist/grpc/provider.d.ts +5 -0
  14. package/dist/http/consumer.d.ts +12 -0
  15. package/dist/http/index.d.ts +2 -0
  16. package/dist/http/provider.d.ts +5 -0
  17. package/dist/index.d.ts +116 -0
  18. package/dist/macro/ark.d.ts +84 -0
  19. package/dist/macro/binding.d.ts +1 -0
  20. package/dist/macro/dsa.d.ts +20 -0
  21. package/dist/macro/env.d.ts +43 -0
  22. package/dist/macro/idx.d.ts +12 -0
  23. package/dist/macro/index.d.ts +10 -0
  24. package/dist/macro/inspector.d.ts +144 -0
  25. package/dist/macro/loader.d.ts +15 -0
  26. package/dist/macro/mpi.d.ts +21 -0
  27. package/dist/macro/mps.d.ts +12 -0
  28. package/dist/macro/spi.d.ts +13 -0
  29. package/dist/mesh.d.ts +2 -0
  30. package/dist/mesh.js +11088 -0
  31. package/dist/mesh.umd.cjs +24 -0
  32. package/dist/mpc/compiler.d.ts +23 -0
  33. package/dist/mpc/consumer.d.ts +28 -0
  34. package/dist/mpc/consumer_filter.d.ts +6 -0
  35. package/dist/mpc/context.d.ts +33 -0
  36. package/dist/mpc/eden.d.ts +44 -0
  37. package/dist/mpc/execution.d.ts +74 -0
  38. package/dist/mpc/filter.d.ts +19 -0
  39. package/dist/mpc/hook.d.ts +23 -0
  40. package/dist/mpc/index.d.ts +16 -0
  41. package/dist/mpc/invoker.d.ts +57 -0
  42. package/dist/mpc/mesh.d.ts +42 -0
  43. package/dist/mpc/mesh_eden.d.ts +25 -0
  44. package/dist/mpc/mock.d.ts +7 -0
  45. package/dist/mpc/provider.d.ts +10 -0
  46. package/dist/mpc/proxy.d.ts +6 -0
  47. package/dist/mpc/reference.d.ts +21 -0
  48. package/dist/mpc/service.d.ts +7 -0
  49. package/dist/mpc/urn.d.ts +32 -0
  50. package/dist/psi/builtin.d.ts +49 -0
  51. package/dist/psi/cache.d.ts +44 -0
  52. package/dist/psi/cipher.d.ts +73 -0
  53. package/dist/psi/cluster.d.ts +11 -0
  54. package/dist/psi/commerce.d.ts +20 -0
  55. package/dist/psi/context.d.ts +148 -0
  56. package/dist/psi/cryptor.d.ts +23 -0
  57. package/dist/psi/datahouse.d.ts +24 -0
  58. package/dist/psi/dispatcher.d.ts +13 -0
  59. package/dist/psi/endpoint.d.ts +14 -0
  60. package/dist/psi/evaluator.d.ts +20 -0
  61. package/dist/psi/graph.d.ts +11 -0
  62. package/dist/psi/index.d.ts +29 -0
  63. package/dist/psi/kms.d.ts +20 -0
  64. package/dist/psi/kv.d.ts +24 -0
  65. package/dist/psi/licenser.d.ts +24 -0
  66. package/dist/psi/locker.d.ts +19 -0
  67. package/dist/psi/network.d.ts +49 -0
  68. package/dist/psi/pipeline.d.ts +28 -0
  69. package/dist/psi/publisher.d.ts +12 -0
  70. package/dist/psi/registry.d.ts +20 -0
  71. package/dist/psi/routable.d.ts +37 -0
  72. package/dist/psi/savepoint.d.ts +24 -0
  73. package/dist/psi/scheduler.d.ts +47 -0
  74. package/dist/psi/sequence.d.ts +20 -0
  75. package/dist/psi/subscriber.d.ts +11 -0
  76. package/dist/psi/tokenizer.d.ts +48 -0
  77. package/dist/psi/transport.d.ts +33 -0
  78. package/dist/psi/vfs.d.ts +32 -0
  79. package/dist/psi/workflow.d.ts +35 -0
  80. package/dist/schema/citizen.d.ts +25 -0
  81. package/dist/schema/index.d.ts +2 -0
  82. package/dist/schema/schema.d.ts +2 -0
  83. package/dist/system/index.d.ts +1 -0
  84. package/dist/system/mesh_network.d.ts +15 -0
  85. package/dist/test/network.test.d.ts +4 -0
  86. package/dist/tool/addrs.d.ts +11 -0
  87. package/dist/tool/index.d.ts +3 -0
  88. package/dist/tool/table.d.ts +7 -0
  89. package/dist/tool/tool.d.ts +31 -0
  90. package/dist/types/builtin.d.ts +121 -0
  91. package/dist/types/cipher.d.ts +111 -0
  92. package/dist/types/document.d.ts +34 -0
  93. package/dist/types/entity.d.ts +59 -0
  94. package/dist/types/enums.d.ts +2 -0
  95. package/dist/types/environ.d.ts +52 -0
  96. package/dist/types/event.d.ts +55 -0
  97. package/dist/types/index.d.ts +20 -0
  98. package/dist/types/keys.d.ts +41 -0
  99. package/dist/types/license.d.ts +111 -0
  100. package/dist/types/oauth2.d.ts +138 -0
  101. package/dist/types/payload.d.ts +29 -0
  102. package/dist/types/principal.d.ts +35 -0
  103. package/dist/types/registration.d.ts +114 -0
  104. package/dist/types/route.d.ts +90 -0
  105. package/dist/types/savepoint.d.ts +34 -0
  106. package/dist/types/script.d.ts +26 -0
  107. package/dist/types/status.d.ts +13 -0
  108. package/dist/types/transport.d.ts +40 -0
  109. package/dist/types/version.d.ts +10 -0
  110. package/dist/types/workflow.d.ts +190 -0
  111. package/package.json +56 -0
@@ -0,0 +1,23 @@
1
+ import { Class, Inspector, Parameter, Return } from '../macro';
2
+ export declare abstract class Compiler {
3
+ /**
4
+ * Get the parameter class type.
5
+ */
6
+ abstract intype(method: Inspector): Class<Parameter>;
7
+ /**
8
+ * Get the return class type.
9
+ */
10
+ abstract retype(method: Inspector): Class<Return>;
11
+ /**
12
+ * Compile source code.
13
+ */
14
+ abstract compile(code: string, name: string): any;
15
+ }
16
+ export declare function returnType<T extends (...args: any) => any>(fn: T): T;
17
+ export declare class TSCompiler extends Compiler {
18
+ private static readonly parameters;
19
+ private static readonly returns;
20
+ compile(code: string, name: string): any;
21
+ intype(method: Inspector): Class<Parameter>;
22
+ retype(method: Inspector): Class<Return>;
23
+ }
@@ -0,0 +1,28 @@
1
+ import { Reference } from '../types';
2
+ import { Context } from '../psi';
3
+ import { Execution } from '.';
4
+ export declare abstract class Consumer {
5
+ static HTTP: string;
6
+ static GRPC: string;
7
+ static TCP: string;
8
+ static MQTT: string;
9
+ /**
10
+ * Start the mesh broker.
11
+ */
12
+ abstract start(): void;
13
+ /**
14
+ * Stop the mesh broker.
15
+ */
16
+ abstract close(): void;
17
+ /**
18
+ * Consume the input payload.
19
+ *
20
+ * @param ctx Call context.
21
+ * @param address Remote address.
22
+ * @param urn Actual uniform resource domain name.
23
+ * @param execution Service reference.
24
+ * @param inbound Input arguments.
25
+ * @return Output payload
26
+ */
27
+ abstract consume(ctx: Context, address: string, urn: string, execution: Execution<Reference>, inbound: Uint8Array): Promise<Uint8Array>;
28
+ }
@@ -0,0 +1,6 @@
1
+ import { Filter } from './filter';
2
+ import { Context } from '../psi';
3
+ import { Invocation, Invoker } from './invoker';
4
+ export declare class ConsumerFilter extends Filter {
5
+ invoke(ctx: Context, invoker: Invoker<any>, invocation: Invocation): Promise<any>;
6
+ }
@@ -0,0 +1,33 @@
1
+ import { Context, ContextProvider, Deque, Key } from '../psi';
2
+ import { Location, Principal } from '../types';
3
+ export declare class MeshContext extends Context {
4
+ private traceId;
5
+ private spanId;
6
+ private timestamp;
7
+ private runMode;
8
+ private urn;
9
+ private consumer;
10
+ private calls;
11
+ private attachments;
12
+ private attributes;
13
+ private principals;
14
+ static create(): Context;
15
+ getAttachments(): Map<string, string>;
16
+ getAttribute<T>(key: Key<T>): any;
17
+ getAttributes(): Map<string, any>;
18
+ getConsumer(ctc: Context): Location;
19
+ getPrincipals(): Deque<Principal>;
20
+ getProvider(ctx: Context): Location;
21
+ getRunMode(): number;
22
+ getSpanId(): string;
23
+ getTimestamp(): number;
24
+ getTraceId(): string;
25
+ getUrn(): string;
26
+ setAttribute<T>(key: Key<T>, value: any): void;
27
+ resume(): Context;
28
+ rewriteContext(ctx: Context): void;
29
+ rewriteURN(urn: string): void;
30
+ }
31
+ export declare class MeshContextProvider extends ContextProvider {
32
+ context(): Context;
33
+ }
@@ -0,0 +1,44 @@
1
+ import { Inspector, Type } from '../macro';
2
+ import { Context } from '../psi';
3
+ import { Reference, Service } from '../types';
4
+ import { Execution } from './execution';
5
+ export declare abstract class Eden {
6
+ /**
7
+ * Define the reference object.
8
+ * @param ctx
9
+ * @param metadata
10
+ * @param reference
11
+ */
12
+ abstract define(ctx: Context, metadata: any, reference: Type<any>): any;
13
+ /**
14
+ * Refer the service reference by method.
15
+ * @param ctx
16
+ * @param metadata
17
+ * @param reference
18
+ * @param method
19
+ */
20
+ abstract refer(ctx: Context, metadata: any, reference: Type<any>, method: Inspector): Execution<Reference>;
21
+ /**
22
+ * Store the service object.
23
+ * @param ctx
24
+ * @param kind
25
+ * @param service
26
+ */
27
+ abstract store(ctx: Context, kind: Type<any>, service: any): void;
28
+ /**
29
+ * Infer the reference service by domain.
30
+ * @param ctx
31
+ * @param urn
32
+ */
33
+ abstract infer(ctx: Context, urn: string): Execution<Service>;
34
+ /**
35
+ * Get all reference types.
36
+ * @param ctx
37
+ */
38
+ abstract referTypes(ctx: Context): Type<any>[];
39
+ /**
40
+ * Get all service types.
41
+ * @param ctx
42
+ */
43
+ abstract inferTypes(ctx: Context): Type<any>[];
44
+ }
@@ -0,0 +1,74 @@
1
+ import { Context } from '../psi';
2
+ import { Argument, Stacktrace, Class, Inspector, Parameter, Return, Type, Types } from '../macro';
3
+ import { URN } from './urn';
4
+ export interface Execution<T> {
5
+ /**
6
+ * Execution schema.
7
+ * @param ctx
8
+ */
9
+ schema(ctx: Context): T;
10
+ /**
11
+ * Inspect execution.
12
+ * @param ctx
13
+ */
14
+ inspect(ctx: Context): Inspector;
15
+ /**
16
+ * Execution input type.
17
+ */
18
+ intype(ctx: Context): Class<Parameter>;
19
+ /**
20
+ * Execution output return type.
21
+ */
22
+ retype(ctx: Context): Class<Return>;
23
+ /**
24
+ * Reflect input type.
25
+ * @param ctx
26
+ */
27
+ inflect(ctx: Context): Parameter;
28
+ /**
29
+ * Reflect output return type.
30
+ * @param ctx
31
+ */
32
+ reflect(ctx: Context): Return;
33
+ }
34
+ export declare class GenericExecution implements Execution<any> {
35
+ private readonly inspector;
36
+ private readonly reference;
37
+ private readonly service;
38
+ constructor(ctx: Context, urn: URN);
39
+ inflect(ctx: Context): Parameter;
40
+ inspect(ctx: Context): Inspector;
41
+ intype(ctx: Context): Class<Parameter>;
42
+ reflect(ctx: Context): Return;
43
+ retype(ctx: Context): Class<Return>;
44
+ schema(ctx: Context): any;
45
+ }
46
+ export declare class GenericInspector implements Inspector {
47
+ private readonly urn;
48
+ constructor(urn: URN);
49
+ getType(): Type<any>;
50
+ getAnnotation<T>(kind: Type<T>): T | undefined;
51
+ getName(): string;
52
+ getParameters(): Argument[];
53
+ getReturnType(): Types;
54
+ getExecutable(): () => void;
55
+ getSymbol(): string;
56
+ invoke(target: any, args: any[]): any;
57
+ }
58
+ export declare class GenericParameters extends Map<string, any> implements Parameter {
59
+ map(): Map<string, any>;
60
+ getArguments(): any[];
61
+ getAttachments(): Map<string, string>;
62
+ setArguments(args: any[]): void;
63
+ setAttachments(attachments: Map<string, string>): void;
64
+ }
65
+ export declare class GenericReturns extends Map<string, any> implements Return {
66
+ getCause(): Stacktrace | undefined;
67
+ getCode(): string;
68
+ getContent(): any;
69
+ getMessage(): string;
70
+ setCause(cause: Stacktrace): void;
71
+ setCode(code: string): void;
72
+ setContent(content: any): void;
73
+ setMessage(message: string): void;
74
+ }
@@ -0,0 +1,19 @@
1
+ import { Invocation, Invoker } from './invoker';
2
+ import { Context } from '../psi';
3
+ export declare const PROVIDER: string;
4
+ export declare const CONSUMER: string;
5
+ export declare abstract class Filter {
6
+ /**
7
+ * Invoke the next filter.
8
+ * @param ctx
9
+ * @param invoker
10
+ * @param invocation
11
+ */
12
+ abstract invoke(ctx: Context, invoker: Invoker<any>, invocation: Invocation): Promise<any>;
13
+ }
14
+ /**
15
+ * Composite the filter spi providers as a invoker.
16
+ * @param invoker
17
+ * @param pattern
18
+ */
19
+ export declare function composite(invoker: Invoker<any>, pattern: string): Invoker<any>;
@@ -0,0 +1,23 @@
1
+ import { Dict, globalPtr } from '../macro';
2
+ import { Filter } from './filter';
3
+ import { Context } from '../psi';
4
+ import { Invocation, Invoker } from './invoker';
5
+ import { Codeable } from '../cause';
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>;
10
+ }
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>;
18
+ }
19
+ declare const Hook: Hooks;
20
+ export declare class HookFilter extends Filter {
21
+ invoke(ctx: Context, invoker: Invoker<any>, invocation: Invocation): Promise<any>;
22
+ }
23
+ export { Hook, globalPtr };
@@ -0,0 +1,16 @@
1
+ export * from './compiler';
2
+ export * from './consumer';
3
+ export * from './context';
4
+ export * from './eden';
5
+ export * from './execution';
6
+ export * from './filter';
7
+ export * from './hook';
8
+ export * from './invoker';
9
+ export * from './mesh';
10
+ export * from './mesh_eden';
11
+ export * from './mock';
12
+ export * from './provider';
13
+ export * from './proxy';
14
+ export * from './reference';
15
+ export * from './service';
16
+ export * from './urn';
@@ -0,0 +1,57 @@
1
+ import { Context } from '../psi';
2
+ import { Inspector, Parameter } from '../macro';
3
+ import { Execution } from './execution';
4
+ export interface Invoker<T> {
5
+ run(ctx: Context, invocation: Invocation): Promise<any>;
6
+ }
7
+ export interface Invocation {
8
+ /**
9
+ * Get the delegate target object.
10
+ * @param ctx
11
+ */
12
+ getProxy(ctx: Context): Invoker<any>;
13
+ /**
14
+ * Get the invocation inspector.
15
+ * @param ctx
16
+ */
17
+ getInspector(ctx: Context): Inspector;
18
+ /**
19
+ * Invoke parameters. include arguments and parameters.
20
+ * @param ctx
21
+ */
22
+ getParameters(ctx: Context): Parameter;
23
+ /**
24
+ * Invoke parameters.
25
+ * @param ctx
26
+ */
27
+ getArguments(ctx: Context): any[];
28
+ /**
29
+ * Get the attachments. The attributes will be serialized.
30
+ * @param ctx
31
+ */
32
+ getAttachments(ctx: Context): Map<string, string>;
33
+ /**
34
+ * Get the invocation execution.
35
+ * @param ctx
36
+ */
37
+ getExecution<V>(ctx: Context): Execution<V>;
38
+ /**
39
+ * Is the method return future.
40
+ * @param ctx
41
+ */
42
+ isAsync(ctx: Context): boolean;
43
+ }
44
+ export declare class ServiceInvocation<T> implements Invocation {
45
+ private readonly proxy;
46
+ private readonly inspector;
47
+ private readonly parameters;
48
+ private readonly execution;
49
+ constructor(proxy: Invoker<T>, inspector: Inspector, parameters: Parameter, execution: Execution<any>);
50
+ getArguments(ctx: Context): any[];
51
+ getAttachments(ctx: Context): Map<string, string>;
52
+ getExecution<V>(ctx: Context): Execution<V>;
53
+ getInspector(ctx: Context): Inspector;
54
+ getParameters(ctx: Context): Parameter;
55
+ getProxy(ctx: Context): Invoker<any>;
56
+ isAsync(ctx: Context): boolean;
57
+ }
@@ -0,0 +1,42 @@
1
+ import { Key } from '../psi';
2
+ import { Invocation } from './invoker';
3
+ export declare class Mesh {
4
+ /**
5
+ * Mesh mpc remote address.
6
+ */
7
+ static REMOTE: Key<string>;
8
+ /**
9
+ * Remote app name.
10
+ */
11
+ static REMOTE_NAME: Key<string>;
12
+ /**
13
+ * Mesh invocation attributes.
14
+ */
15
+ static INVOCATION: Key<Invocation>;
16
+ /**
17
+ * Mesh invoke mpi name attributes.
18
+ */
19
+ static UNAME: Key<string>;
20
+ }
21
+ declare class MeshFlag {
22
+ code: string;
23
+ name: string;
24
+ constructor(code: string, name: string);
25
+ }
26
+ 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;
38
+ static ofProto(code: string): MeshFlag;
39
+ static ofCodec(code: string): MeshFlag;
40
+ static ofName(name: string): MeshFlag;
41
+ }
42
+ export {};
@@ -0,0 +1,25 @@
1
+ import { Eden } from './eden';
2
+ import { Context } from '../psi';
3
+ import { Inspector, Type } from '../macro';
4
+ import { Reference, Service } from '../types';
5
+ import { Execution } from './execution';
6
+ export declare class MeshEden extends Eden {
7
+ private providers;
8
+ private consumers;
9
+ private indies;
10
+ private services;
11
+ private references;
12
+ define(ctx: Context, metadata: any, reference: Type<any>): any;
13
+ store(ctx: Context, kind: Type<any>, service: any): void;
14
+ infer(ctx: Context, urn: string): Execution<Service>;
15
+ refer(ctx: Context, metadata: any, reference: Type<any>, method: Inspector): Execution<Reference>;
16
+ inferTypes(ctx: Context): Type<any>[];
17
+ referTypes(ctx: Context): Type<any>[];
18
+ private makeConsumer;
19
+ private makeMethodAsReference;
20
+ private getURN;
21
+ private getURNFlag;
22
+ private getMethods;
23
+ private getEnviron;
24
+ private makeServiceExecution;
25
+ }
@@ -0,0 +1,7 @@
1
+ import { Filter } from './filter';
2
+ import { Context } from '../psi';
3
+ import { Invocation, Invoker } from './invoker';
4
+ export declare const Mock = "mock";
5
+ export declare class MockFilter extends Filter {
6
+ invoke(ctx: Context, invoker: Invoker<any>, invocation: Invocation): Promise<any>;
7
+ }
@@ -0,0 +1,10 @@
1
+ export declare abstract class Provider {
2
+ /**
3
+ * Start the mesh broker.
4
+ */
5
+ abstract start(): void;
6
+ /**
7
+ * Stop the mesh broker.
8
+ */
9
+ abstract close(): void;
10
+ }
@@ -0,0 +1,6 @@
1
+ import { MethodProxy, Type } from '../macro';
2
+ export declare class ServiceProxy extends MethodProxy {
3
+ proxy<T>(kind: Type<T>): T;
4
+ static proxy<T>(kind: Type<T>): T;
5
+ static doProxy<T>(kind: Type<T>, metadata: any): any;
6
+ }
@@ -0,0 +1,21 @@
1
+ import { Inspector, InvocationHandler } from '../macro';
2
+ import { Invocation, Invoker } from './invoker';
3
+ import { Context } from '../psi';
4
+ import { Reference } from '../types';
5
+ import { Codec } from '../codec';
6
+ import { Execution } from './execution';
7
+ export declare class ReferenceInvokeHandler<T extends object> implements Invoker<any>, InvocationHandler {
8
+ private readonly macro;
9
+ private readonly invoker;
10
+ constructor(macro: any);
11
+ context(args: any[]): Context;
12
+ invoke(proxy: any, method: Inspector, args: any[]): any;
13
+ run(ctx: Context, invocation: Invocation): Promise<any>;
14
+ deserialize(ctx: Context, execution: Execution<Reference>, codec: Codec, future: Uint8Array): Promise<any>;
15
+ referExecution(ctx: Context, inspector: Inspector): Execution<Reference>;
16
+ /**
17
+ * Rewrite the urn by execution context.
18
+ */
19
+ private rewriteURN;
20
+ private rewriteAddress;
21
+ }
@@ -0,0 +1,7 @@
1
+ import { Invocation, Invoker } from './invoker';
2
+ import { Context } from '../psi';
3
+ export declare class ServiceInvokeHandler implements Invoker<any> {
4
+ private invoker;
5
+ constructor(service: any);
6
+ run(ctx: Context, invocation: Invocation): Promise<any>;
7
+ }
@@ -0,0 +1,32 @@
1
+ export declare class URN {
2
+ static CN: string;
3
+ static MESH_DOMAIN: string;
4
+ static LocalMDC: string;
5
+ domain: string;
6
+ mdc: string;
7
+ flag: URNFlag;
8
+ name: string;
9
+ static from(urn: string): URN;
10
+ static urn(name: string): string;
11
+ toString(): string;
12
+ private asArray;
13
+ matchName(name: string): boolean;
14
+ resetFlag(proto: string, codec: string): URN;
15
+ }
16
+ export declare class URNFlag {
17
+ v: string;
18
+ proto: string;
19
+ codec: string;
20
+ version: string;
21
+ zone: string;
22
+ cluster: string;
23
+ cell: string;
24
+ group: string;
25
+ address: string;
26
+ port: string;
27
+ static from(value: string): URNFlag;
28
+ toString(): string;
29
+ private padding;
30
+ private paddingChain;
31
+ private static reduce;
32
+ }
@@ -0,0 +1,49 @@
1
+ import { Context } from './context';
2
+ import { Versions } from '../types';
3
+ export declare abstract class Builtin {
4
+ /**
5
+ * Doc export the documents.
6
+ *
7
+ * Parameters:
8
+ * name - mesh.name
9
+ * formatter - document formatter
10
+ * formatted - document
11
+ * Returns:
12
+ * formatted document
13
+ */
14
+ doc(name: string, formatter: string, ctx?: Context): Promise<string>;
15
+ /**
16
+ * Version will get the builtin application version.
17
+ */
18
+ version(ctx?: Context): Promise<Versions>;
19
+ /**
20
+ * Debug set the application log level.
21
+ */
22
+ debug(features: Record<string, string>, ctx?: Context): Promise<void>;
23
+ /**
24
+ * Stats will collect health check stats.
25
+ */
26
+ stats(features: string[], ctx?: Context): Promise<Record<string, string>>;
27
+ /**
28
+ * Fallback is fallback service
29
+ */
30
+ fallback(ctx?: Context): Promise<void>;
31
+ /**
32
+ * Dump the application data.
33
+ */
34
+ dump(names: string[], ctx?: Context): Promise<Record<string, string>>;
35
+ }
36
+ export declare abstract class Hodor {
37
+ /**
38
+ * Stats collect the system, application, process or thread status etc.
39
+ */
40
+ stats(features: string[], ctx?: Context): Promise<Record<string, string>>;
41
+ /**
42
+ * Debug set the debug features.
43
+ */
44
+ debug(features: Record<string, string>, ctx?: Context): Promise<void>;
45
+ /**
46
+ * Dump the application data.
47
+ */
48
+ dump(ctx?: Context): Promise<string>;
49
+ }
@@ -0,0 +1,44 @@
1
+ import { Context } from './context';
2
+ import { CacheBody } from '../types';
3
+ export declare abstract class Cache {
4
+ /**
5
+ * Get the value from cache.
6
+ */
7
+ get(key: string, ctx?: Context): Promise<CacheBody>;
8
+ /**
9
+ * Put the value to cache.
10
+ */
11
+ put(cell: CacheBody, ctx?: Context): Promise<void>;
12
+ /**
13
+ * Remove the cache value.
14
+ */
15
+ remove(key: string, ctx?: Context): Promise<void>;
16
+ /**
17
+ * Incr the cache of expire time.
18
+ */
19
+ incr(key: string, value: number, ctx?: Context): Promise<number>;
20
+ /**
21
+ * Decr the cache of expire time.
22
+ */
23
+ decr(key: string, value: number, ctx?: Context): Promise<number>;
24
+ /**
25
+ * Keys the cache key set.
26
+ */
27
+ keys(pattern: string, ctx?: Context): Promise<string[]>;
28
+ /**
29
+ * HGet get value in hash
30
+ */
31
+ hget(key: string, name: string, ctx?: Context): Promise<CacheBody>;
32
+ /**
33
+ * HSet put value in hash
34
+ */
35
+ hset(key: string, cell: CacheBody, ctx?: Context): Promise<void>;
36
+ /**
37
+ * HDel put value in hash
38
+ */
39
+ hdel(key: string, name: string, ctx?: Context): Promise<void>;
40
+ /**
41
+ * HKeys get the hash keys
42
+ */
43
+ hkeys(key: string, ctx?: Context): Promise<string[]>;
44
+ }
@@ -0,0 +1,73 @@
1
+ import { Context } from './context';
2
+ import { CipherEntity, CipherHello, CipherKey, CipherKeygen, CipherObject, CipherRegen, CipherSuite, CipherTxEntity, Keys, Page, Paging } from '../types';
3
+ export declare abstract class CipherEconomy {
4
+ /**
5
+ * Handshake negotiate multiparty cipher keys.
6
+ *
7
+ * Parameters:
8
+ * - hello: hello
9
+ * Returns:
10
+ * - string cipher group
11
+ */
12
+ handshake(hello: CipherHello, ctx?: Context): Promise<string>;
13
+ /**
14
+ * Collect cipher objects with group. Asyncable can be invoked by multi times.
15
+ *
16
+ * Parameters:
17
+ * - obj: obj
18
+ * Returns:
19
+ * - int 1 for success, 0 for failed
20
+ */
21
+ collect(obj: CipherObject, ctx?: Context): Promise<number>;
22
+ /**
23
+ * Serve will Encrypt or Anonymize
24
+ */
25
+ serve(suite: string, ctx?: Context): Promise<string>;
26
+ /**
27
+ * Deposit cipher object deposit
28
+ */
29
+ deposit(rco: CipherObject, ctx?: Context): Promise<string>;
30
+ /**
31
+ * Objects cipher object index
32
+ */
33
+ objects(index: Paging, ctx?: Context): Promise<Page<CipherObject>>;
34
+ /**
35
+ * Keys key index
36
+ */
37
+ keys(idx: Paging, ctx?: Context): Promise<Page<Keys>>;
38
+ /**
39
+ * Invoke
40
+ */
41
+ invoke(index: Paging, ctx?: Context): Promise<Uint8Array>;
42
+ }
43
+ export declare abstract class CipherProvider {
44
+ /**
45
+ * Suite
46
+ */
47
+ suite(hello: CipherHello, ctx?: Context): Promise<CipherSuite>;
48
+ /**
49
+ * Keygen
50
+ */
51
+ keygen(keygen: CipherKeygen, ctx?: Context): Promise<CipherKey>;
52
+ /**
53
+ * Regen
54
+ */
55
+ regen(keygen: CipherRegen, ctx?: Context): Promise<CipherKey>;
56
+ /**
57
+ * Encode
58
+ */
59
+ encode(explain: CipherEntity, ctx?: Context): Promise<Uint8Array>;
60
+ /**
61
+ * Decode
62
+ */
63
+ decode(cipher: CipherEntity, ctx?: Context): Promise<Uint8Array>;
64
+ /**
65
+ * Recode
66
+ */
67
+ recode(cipher: CipherTxEntity, ctx?: Context): Promise<Uint8Array>;
68
+ }
69
+ export declare abstract class ObjectProvider {
70
+ /**
71
+ */
72
+ serve(ctx?: Context): Promise<string>;
73
+ }
@@ -0,0 +1,11 @@
1
+ import { Context } from './context';
2
+ export declare abstract class Cluster {
3
+ /**
4
+ * Election will election leader of instances.
5
+ */
6
+ election(buff: Uint8Array, ctx?: Context): Promise<Uint8Array>;
7
+ /**
8
+ * IsLeader if same level.
9
+ */
10
+ isLeader(ctx?: Context): Promise<boolean>;
11
+ }