File tree 5 files changed +32
-27
lines changed
5 files changed +32
-27
lines changed Original file line number Diff line number Diff line change
1
+ import {
2
+ NatsConnection ,
3
+ RequestManyOptions ,
4
+ } from "../nats-base-client/core.ts" ;
5
+ import { ServiceImpl } from "./service.ts" ;
6
+ import { ServiceClientImpl } from "./serviceclient.ts" ;
7
+ import { Service , ServiceClient , ServiceConfig } from "./types.ts" ;
8
+
1
9
export type {
2
10
Endpoint ,
3
11
EndpointInfo ,
@@ -24,4 +32,23 @@ export {
24
32
ServiceVerb ,
25
33
} from "./types.ts" ;
26
34
27
- export { Svc } from "./service.ts" ;
35
+ export class Svc {
36
+ nc : NatsConnection ;
37
+
38
+ constructor ( nc : NatsConnection ) {
39
+ this . nc = nc ;
40
+ }
41
+
42
+ add ( config : ServiceConfig ) : Promise < Service > {
43
+ try {
44
+ const s = new ServiceImpl ( this . nc , config ) ;
45
+ return s . start ( ) ;
46
+ } catch ( err ) {
47
+ return Promise . reject ( err ) ;
48
+ }
49
+ }
50
+
51
+ client ( opts ?: RequestManyOptions , prefix ?: string ) : ServiceClient {
52
+ return new ServiceClientImpl ( this . nc , opts , prefix ) ;
53
+ }
54
+ }
Original file line number Diff line number Diff line change @@ -24,4 +24,4 @@ export {
24
24
ServiceVerb ,
25
25
} from "./internal_mod.ts" ;
26
26
27
- export { Svc } from "./service .ts" ;
27
+ export { Svc } from "./internal_mod .ts" ;
Original file line number Diff line number Diff line change @@ -29,18 +29,15 @@ import {
29
29
Payload ,
30
30
PublishOptions ,
31
31
QueuedIterator ,
32
- RequestManyOptions ,
33
32
ReviverFn ,
34
33
Sub ,
35
34
} from "../nats-base-client/core.ts" ;
36
- import { ServiceClientImpl } from "./serviceclient.ts" ;
37
35
import {
38
36
Endpoint ,
39
37
EndpointInfo ,
40
38
EndpointOptions ,
41
39
NamedEndpointStats ,
42
40
Service ,
43
- ServiceClient ,
44
41
ServiceConfig ,
45
42
ServiceError ,
46
43
ServiceErrorCodeHeader ,
@@ -66,26 +63,6 @@ import {
66
63
*/
67
64
export const ServiceApiPrefix = "$SRV" ;
68
65
69
- export class Svc {
70
- nc : NatsConnection ;
71
- constructor ( nc : NatsConnection ) {
72
- this . nc = nc ;
73
- }
74
-
75
- add ( config : ServiceConfig ) : Promise < Service > {
76
- try {
77
- const s = new ServiceImpl ( this . nc , config ) ;
78
- return s . start ( ) ;
79
- } catch ( err ) {
80
- return Promise . reject ( err ) ;
81
- }
82
- }
83
-
84
- client ( opts ?: RequestManyOptions , prefix ?: string ) : ServiceClient {
85
- return new ServiceClientImpl ( this . nc , opts , prefix ) ;
86
- }
87
- }
88
-
89
66
export class ServiceMsgImpl implements ServiceMsg {
90
67
msg : Msg ;
91
68
constructor ( msg : Msg ) {
Original file line number Diff line number Diff line change @@ -23,14 +23,14 @@ import {
23
23
ServiceResponseType ,
24
24
ServiceStats ,
25
25
ServiceVerb ,
26
+ Svc ,
26
27
} from "../mod.ts" ;
27
28
28
29
import { collect } from "../../nats-base-client/util.ts" ;
29
30
import { ServiceClientImpl } from "../serviceclient.ts" ;
30
31
import Ajv , { JSONSchemaType , ValidateFunction } from "npm:ajv" ;
31
32
32
33
import { parseSemVer } from "../../nats-base-client/semver.ts" ;
33
- import { Svc } from "../service.ts" ;
34
34
35
35
const ajv = new Ajv ( ) ;
36
36
Original file line number Diff line number Diff line change 13
13
* limitations under the License.
14
14
*/
15
15
import { cleanup , setup } from "../../tests/helpers/mod.ts" ;
16
- import { ServiceImpl , Svc } from "../service.ts" ;
16
+ import { ServiceImpl } from "../service.ts" ;
17
17
import {
18
18
assert ,
19
19
assertArrayIncludes ,
@@ -38,6 +38,7 @@ import {
38
38
ServiceResponseType ,
39
39
ServiceStats ,
40
40
ServiceVerb ,
41
+ Svc ,
41
42
} from "../types.ts" ;
42
43
import {
43
44
connect ,
You can’t perform that action at this time.
0 commit comments