|
@@ -19,6 +19,82 @@ import { Observer, Subject, Subscribable, Unsubscribable } from "rxjs"
|
|
|
|
|
|
*/
|
|
|
|
|
|
+interface messageSchemaType {
|
|
|
+ undefined: "UNDEFINED" // when not defined
|
|
|
+ element: "ELEMENT" // fundamental unit
|
|
|
+ composite: "COMPOSITE" // has other schema
|
|
|
+}
|
|
|
+
|
|
|
+export interface MessageSchemaDataModel {
|
|
|
+ schemaId: string // identifier
|
|
|
+ schemaName: string // unique legible name
|
|
|
+ schemaDef: string // jason description of schema
|
|
|
+ schemaType: messageSchemaType // one of selection
|
|
|
+ isConcrete: boolean // whether is consumable message
|
|
|
+}
|
|
|
+
|
|
|
+export interface MessageSchema {
|
|
|
+/* Descsription steriotype for all Fis messages.
|
|
|
+ Has reference to message schema described as interfaces.
|
|
|
+ MessageSchema is a network structure (not a tree hierarchy) where
|
|
|
+ a child schema may have multiple parent schema
|
|
|
+ Definition begins at the lowest denomiator
|
|
|
+ schema, or lowest node.
|
|
|
+ On handling version of message schema, refer to version model
|
|
|
+*/
|
|
|
+ messageSchemaDataModel: MessageSchemaDataModel
|
|
|
+}
|
|
|
+
|
|
|
+export interface MessageSchemaCompositeAssociation {
|
|
|
+/* Associated nodes of a composite schema.
|
|
|
+ Note association is one directional */
|
|
|
+ compositeMessageSchema: MessageSchema
|
|
|
+ compositeEntries: Array <MessageSchema>[]
|
|
|
+ /* associated to schema */
|
|
|
+}
|
|
|
+
|
|
|
+export class MessageSchemaImpl implements MessageSchema {
|
|
|
+
|
|
|
+ messageSchemaDataModel: MessageSchemaDataModel
|
|
|
+
|
|
|
+ constructor (messageSchemaDataModel: MessageSchemaDataModel) {
|
|
|
+ this.messageSchemaDataModel = messageSchemaDataModel
|
|
|
+ }
|
|
|
+ /* validation:
|
|
|
+ - if schemaId is not provided by creator, then self generate
|
|
|
+ - schemaDef should be a valid schema (call api to check)
|
|
|
+ - value changed should emit value changed event to be
|
|
|
+ - handled by for example version logging
|
|
|
+ */
|
|
|
+}
|
|
|
+
|
|
|
+export class MessageSchemaNode extends MessageSchemaAbstractImpl {
|
|
|
+/* fundamental unit of a schema by which composite schema is constructed */
|
|
|
+
|
|
|
+ messageSchemaNodeDataModel: MessageSchemaDataModel
|
|
|
+
|
|
|
+ constructor (messageSchemaNodeDataModel: MessageSchemaDataModel) {
|
|
|
+ super (messageSchemaNodeDataModel)
|
|
|
+ this.messageSchemaNodeDataModel = messageSchemaNodeDataModel
|
|
|
+ }
|
|
|
+
|
|
|
+ /* validation:
|
|
|
+ - schema definition should not contain other schema
|
|
|
+ -
|
|
|
+ */
|
|
|
+}
|
|
|
+
|
|
|
+export interface MessageSchemaComposite {
|
|
|
+/* Schema that has child schema(s)
|
|
|
+ Extended from MessageSchema*/
|
|
|
+ schemaId: string
|
|
|
+ /* reference to Schema Message which has
|
|
|
+ composite node(s) */
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
export interface ActorCommands {
|
|
|
/* base actor commands*/
|
|
|
Subscribe: "SUBSCRIBE", // subsribe to incoming bus
|
|
@@ -44,7 +120,7 @@ export interface CommandNotification {
|
|
|
ActorCommandError: ActorCommandError
|
|
|
}
|
|
|
|
|
|
-export interface ActorQueries {
|
|
|
+export interface ActorQuery {
|
|
|
GetActorIdentifier: "GETACTORIDENTY",
|
|
|
GetSubscribables: "GETSUBSCRIBABLES", // return list of subscribable identities
|
|
|
GetSubscribabers: "GETSUBSCRIBERS", // return list of observer identities
|
|
@@ -100,20 +176,29 @@ interface FisActor<T> extends Subscribable<T> {
|
|
|
}
|
|
|
|
|
|
|
|
|
-/* ============ Actor model base ==================
|
|
|
+/* ============ Actor model base ================== */
|
|
|
+
|
|
|
+
|
|
|
+export class FisActorImpl<T> implements FisActor<T> {
|
|
|
|
|
|
- A Fis actor is stateful object which implements Subscribable
|
|
|
+ /* A Fis actor is stateful object which implements Subscribable
|
|
|
interface. It can be anything including:
|
|
|
business domain object
|
|
|
UI component
|
|
|
message forwarder
|
|
|
- actor directory receptionist
|
|
|
+ actor directory receptionist
|
|
|
+ actor container
|
|
|
+ remote transmission service
|
|
|
+ mircroservice
|
|
|
+ client proxy
|
|
|
+ domain proxy
|
|
|
+ backoffice App Manager
|
|
|
+
|
|
|
+ Behavior of an actor is solely dependent on the actor service
|
|
|
+ passed from its creator actor
|
|
|
|
|
|
Folder location: src.common.actor
|
|
|
- */
|
|
|
-
|
|
|
-export abstract class FisActorBaseImpl<T> implements FisActor<T> {
|
|
|
-
|
|
|
+*/
|
|
|
|
|
|
protected actorId!: String
|
|
|
/* autogenerate a GUID value upon creation */
|