node-consul-service 1.0.13 → 1.0.14

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.
@@ -0,0 +1,2 @@
1
+ export declare function registerService(name: string, id: string, port: number, address?: string): Promise<void>;
2
+ export declare function deregisterService(id: string): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import Consul from "consul";
2
+ declare const client: Consul;
3
+ export default client;
@@ -0,0 +1,5 @@
1
+ import { ServiceInstance } from './types';
2
+ export declare function listServices(): Promise<any[]>;
3
+ export declare function getServiceInstances(serviceName: string): Promise<ServiceInstance[]>;
4
+ export declare function getRandomServiceInstance(serviceName: string): Promise<ServiceInstance>;
5
+ export declare function getServiceUrl(serviceName: string): Promise<string>;
@@ -0,0 +1,10 @@
1
+ import { AxiosRequestHeaders, Method } from 'axios';
2
+ interface CallServiceOptions {
3
+ method?: Method;
4
+ path?: string;
5
+ data?: any;
6
+ headers?: AxiosRequestHeaders;
7
+ params?: Record<string, any>;
8
+ }
9
+ export declare function callService(serviceName: string, options?: CallServiceOptions): Promise<any>;
10
+ export {};
@@ -0,0 +1,18 @@
1
+ type RegisterOptions = {
2
+ name: string;
3
+ id: string;
4
+ port: number;
5
+ address?: string;
6
+ check?: {
7
+ name?: string;
8
+ http?: string;
9
+ interval?: string;
10
+ timeout?: string;
11
+ deregistercriticalserviceafter?: string;
12
+ } | false;
13
+ tags?: string[];
14
+ meta?: Record<string, string>;
15
+ };
16
+ export declare function registerService(options: RegisterOptions): Promise<void>;
17
+ export declare function deregisterService(id: string): Promise<void>;
18
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface ServiceInstance {
2
+ ServiceID: string;
3
+ ServiceName: string;
4
+ ServiceAddress: string;
5
+ ServicePort: number;
6
+ }
@@ -0,0 +1,3 @@
1
+ export * from './consul/registry';
2
+ export * from './consul/discovery';
3
+ export * from './consul/httpCaller';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-consul-service",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,6 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "axios": "^1.9.0",
26
+ "cache-center": "^1.0.8",
26
27
  "consul": "^2.0.1"
27
28
  },
28
29
  "devDependencies": {
package/ .gitignore DELETED
@@ -1,30 +0,0 @@
1
- node_modules
2
- dist
3
- *.tsbuildinfo
4
- .env
5
- .env.*
6
-
7
- npm-debug.log*
8
- yarn-debug.log*
9
- yarn-error.log*
10
- pnpm-debug.log*
11
-
12
-
13
- .DS_Store
14
- Thumbs.db
15
-
16
-
17
- .vscode/
18
- .idea/
19
-
20
-
21
- coverage/
22
- .nyc_output/
23
-
24
-
25
- *.log
26
- *.swp
27
- *.swo
28
-
29
-
30
- .rollup.cache/