@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
92 lines (91 loc) • 2.81 kB
TypeScript
import HubClient from '../hubClient/HubClient';
import HubObject from '../hubClient/HubObject';
import { HubClientOptions } from '../hubClient/IHubClient';
/**
* Constants that represent what type of commit strategy to be used.
*/
export declare enum CommitStrategyType {
Basic = "basic",
LastWriterWins = "lastWriterWins"
}
/**
* Constants that represent what interface type the hub request payload will be.
*/
export declare enum HubInterfaceType {
Actions = "Actions",
Collections = "Collections",
Permissions = "Permissions",
Profile = "Profile"
}
/**
* Hub Operations
*/
export declare enum Operation {
Create = "create",
Read = "read",
Update = "update",
Delete = "delete"
}
/**
* Interface for defining options for HubInterface.
*/
export declare class HubInterfaceOptions extends HubClientOptions {
/**
* The schema for the object that will be committed.
*/
context: string | undefined;
/**
* The type of the object that will be committed.
*/
type: string | undefined;
/**
* Commit Strategy to define what strategy to use when compiling commits.
*/
commitStrategy: CommitStrategyType;
/**
* Hub Interface to define the type of interface the hub request payload will be.
*/
hubInterface: HubInterfaceType;
}
/**
* An Abstract Class for Hub Interfaces.
*
*/
export default abstract class HubInterface {
readonly hubInterface: HubInterfaceType;
readonly commitStrategy: CommitStrategyType;
readonly type: string;
readonly context: string;
hubClient: HubClient;
/**
* Creates an instance of HubMethods that will be used to send hub requests and responses.
* @param [hubInterfaceOptions] for configuring how to form hub requests and responses.
*/
constructor(hubInterfaceOptions: HubInterfaceOptions);
/**
* Add object to Hub Owner's hub.
* @param object object to be added to hub owned by hub owner.
*/
addObject(object: any): Promise<any>;
/**
* Get all unhydrated hubObjects of specific type.
*/
getUnHydratedObjects(): Promise<HubObject[]>;
/**
* create and return hydrated hubObject.
* @param hubObject unhydrated hubObject containing on object metadata.
*/
getObject(hubObject: HubObject): Promise<HubObject>;
/**
* Get a list of all hydrated HubObjects containing both metadata and payload.
*/
getObjects(): Promise<HubObject[]>;
/**
* Update Hub Object in hub owner's hub.
*/
updateObject(hubObject: HubObject): Promise<void>;
/**
* Update Hub Object in hub owner's hub.
*/
deleteObject(hubObject: HubObject): Promise<void>;
}