-
-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
131 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// @ts-check | ||
/* | ||
* moleculer | ||
* Copyright (c) 2023 MoleculerJS (https://github.com/moleculerjs/moleculer) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// @ts-check | ||
/* | ||
* moleculer | ||
* Copyright (c) 2023 MoleculerJS (https://github.com/moleculerjs/moleculer) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import type { ActionSchema } from "../service"; | ||
import type { ServiceEvent, ServiceDependency } from "../service"; | ||
|
||
import BrokerNode = require("./node"); | ||
import ServiceItem = require("./service-item"); | ||
|
||
import ServiceBroker = require("../service-broker"); | ||
import Registry = require("./registry"); | ||
|
||
declare namespace ServiceCatalog { | ||
export interface ServiceCatalogListOptions { | ||
onlyLocal?: boolean; | ||
onlyAvailable?: boolean; | ||
skipInternal?: boolean; | ||
withActions?: boolean; | ||
withEvents?: boolean; | ||
grouping?: boolean; | ||
} | ||
|
||
export interface ServiceCatalogListResult { | ||
name: string; | ||
version: string | number; | ||
fullName: string; | ||
settings: Record<string, any>; | ||
metadata: Record<string, any>; | ||
|
||
local: boolean; | ||
available: boolean; | ||
nodes?: string[]; | ||
nodeID?: string; | ||
|
||
action?: Omit<ActionSchema, "handler" | "remoteHandler" | "service">; | ||
events?: Omit<ServiceEvent, "handler" | "remoteHandler" | "service">; | ||
} | ||
|
||
export interface ServiceCatalogLocalNodeServicesResult { | ||
name: string; | ||
version: string | number; | ||
fullName: string; | ||
settings: Record<string, any>; | ||
metadata: Record<string, any>; | ||
dependencies: string | ServiceDependency | (string | ServiceDependency)[]; | ||
|
||
action: Record<string, Omit<ActionSchema, "handler" | "remoteHandler" | "service">>; | ||
events: Record<string, Omit<ServiceEvent, "handler" | "remoteHandler" | "service">>; | ||
} | ||
} | ||
|
||
declare class ServiceCatalog { | ||
registry: Registry; | ||
broker: ServiceBroker; | ||
services: ServiceItem[]; | ||
|
||
constructor(registry: Registry, broker: ServiceBroker); | ||
|
||
add(node: BrokerNode, service: ServiceItem, local: boolean): ServiceItem; | ||
|
||
has(fullName: string, nodeID: string): boolean; | ||
get(fullName: string, nodeID: string): ServiceItem; | ||
|
||
list(opts: ServiceCatalog.ServiceCatalogListOptions): ServiceCatalog.ServiceCatalogListResult[]; | ||
|
||
getLocalNodeServices(): ServiceCatalog.ServiceCatalogLocalNodeServicesResult[]; | ||
|
||
removeAllByNodeID(nodeID: string): void; | ||
remove(fullName: string, nodeID: string): void; | ||
|
||
} | ||
|
||
export = ServiceCatalog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
import Node = require("./node"); | ||
|
||
import type { ActionSchema } from "../service"; | ||
import type { ServiceEvent } from "../service"; | ||
|
||
declare class ServiceItem { | ||
node: Node; | ||
name: string; | ||
fullName: string; | ||
version: string | number; | ||
settings: Record<string, any>; | ||
metadata: Record<string, any>; | ||
|
||
local: boolean; | ||
actions: Record<string, ActionSchema>; | ||
events: Record<string, ServiceEvent>; | ||
|
||
constructor(node: Node, service: Record<string, any>, local: boolean); | ||
|
||
equals(fullName: string, nodeID: string): boolean; | ||
|
||
update(svc: Record<string, any>): void; | ||
|
||
addAction(action: ActionSchema): void; | ||
addEvent(event: ServiceEvent): void; | ||
} | ||
export = ServiceItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// @ts-check | ||
/* | ||
* moleculer | ||
* Copyright (c) 2023 MoleculerJS (https://github.com/moleculerjs/moleculer) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// @ts-check | ||
/* | ||
* moleculer | ||
* Copyright (c) 2023 MoleculerJS (https://github.com/moleculerjs/moleculer) | ||
|