mirror of
https://github.com/balzack/databag.git
synced 2025-04-22 09:35:16 +00:00
renaming service interface objects
This commit is contained in:
parent
f445fc0e2f
commit
b3c9ffb1f0
@ -1,4 +1,4 @@
|
||||
import type { Channel, Topic, AssetSource, Asset, Tag, Article, Group, Card, Profile, Call, FocusDetail, Config, NodeConfig, NodeAccount, Participant, PushParams } from './types';
|
||||
import type { Channel, Topic, AssetSource, Asset, Tag, Article, Group, Card, Profile, Call, FocusDetail, Config, Setup, Member, Participant, PushParams } from './types';
|
||||
|
||||
export interface Session {
|
||||
getSettings(): Settings;
|
||||
@ -158,14 +158,14 @@ export interface Focus {
|
||||
removeDetailListener(ev: (focused: { cardId: string | null, channelId: string, detail: FocusDetail | null }) => void): void;
|
||||
}
|
||||
|
||||
export interface Node {
|
||||
getAccounts(): Promise<NodeAccount[]>;
|
||||
createAccountAccess(): Promise<string>;
|
||||
resetAccountAccess(): Promise<string>;
|
||||
blockAccount(flag: boolean): Promise<void>;
|
||||
removeAccount(accountId: number): Promise<void>;
|
||||
getConfig(): Promise<NodeConfig>;
|
||||
setConfig(config: NodeConfig): Promise<void>;
|
||||
export interface Service {
|
||||
getMembers(): Promise<Member[]>;
|
||||
createMemberAccess(): Promise<string>;
|
||||
resetMemberAccess(): Promise<string>;
|
||||
blockMember(flag: boolean): Promise<void>;
|
||||
removeMember(accountId: number): Promise<void>;
|
||||
getSetup(): Promise<Setup>;
|
||||
setSetup(setup: Setup): Promise<void>;
|
||||
}
|
||||
|
||||
export interface Contributor {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { SessionModule } from './session';
|
||||
import { NodeModule } from './node';
|
||||
import { ServiceModule } from './service';
|
||||
import { ContributorModule } from './contributor';
|
||||
import { type Logging, ConsoleLogging } from './logging';
|
||||
import { type Store, OfflineStore, OnlineStore, NoStore } from './store';
|
||||
@ -11,7 +11,7 @@ import { addAccount } from './net/addAccount';
|
||||
import { setAdmin } from './net/setAdmin';
|
||||
import { getAvailable } from './net/getAvailable';
|
||||
import { getUsername } from './net/getUsername';
|
||||
import type { Session, Node, Contributor } from './api';
|
||||
import type { Session, Service, Contributor } from './api';
|
||||
import type { Params, SessionParams } from './types';
|
||||
import type { Login } from './entities';
|
||||
import type { Crypto } from './crypto';
|
||||
@ -140,9 +140,9 @@ export class DatabagSDK {
|
||||
});
|
||||
}
|
||||
|
||||
public async configure(node: string, secure: boolean, token: string, mfaCode: string | null): Promise<Node> {
|
||||
public async configure(node: string, secure: boolean, token: string, mfaCode: string | null): Promise<Service> {
|
||||
const access = await setAdmin(node, secure, token, mfaCode);
|
||||
return new NodeModule(this.log, node, secure, token);
|
||||
return new ServiceModule(this.log, node, secure, token);
|
||||
}
|
||||
|
||||
public async automate(node: string, secure: boolean, token: string): Promise<Contributor> {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import type { Node } from './api';
|
||||
import type { NodeAccount, NodeConfig } from './types';
|
||||
import type { Service } from './api';
|
||||
import type { Member, Setup } from './types';
|
||||
import type { Logging } from './logging';
|
||||
|
||||
export class NodeModule implements Node {
|
||||
export class ServiceModule implements Service {
|
||||
private log: Logging;
|
||||
private token: string;
|
||||
private node: string;
|
||||
@ -15,23 +15,23 @@ export class NodeModule implements Node {
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
public async createAccountAccess(): Promise<string> {
|
||||
public async createMemberAccess(): Promise<string> {
|
||||
return '';
|
||||
}
|
||||
|
||||
public async resetAccountAccess(): Promise<string> {
|
||||
public async resetMemberAccess(): Promise<string> {
|
||||
return '';
|
||||
}
|
||||
|
||||
public async blockAccount(flag: boolean): Promise<void> {}
|
||||
public async blockMember(flag: boolean): Promise<void> {}
|
||||
|
||||
public async removeAccount(accountId: number): Promise<void> {}
|
||||
public async removeMember(accountId: number): Promise<void> {}
|
||||
|
||||
public async getAccounts(): Promise<NodeAccount[]> {
|
||||
public async getMembers(): Promise<Member[]> {
|
||||
return [];
|
||||
}
|
||||
|
||||
public async getConfig(): Promise<NodeConfig> {
|
||||
public async getSetup(): Promise<Setup> {
|
||||
return {
|
||||
domain: '',
|
||||
accountStorage: '',
|
||||
@ -53,5 +53,5 @@ export class NodeModule implements Node {
|
||||
};
|
||||
}
|
||||
|
||||
public async setConfig(config: NodeConfig): Promise<void> {}
|
||||
public async setSetup(config: Setup): Promise<void> {}
|
||||
}
|
@ -62,8 +62,7 @@ export type Channel = {
|
||||
enableAudio: boolean;
|
||||
enableVideo: boolean;
|
||||
enableBinary: boolean;
|
||||
//membership: Member;
|
||||
members: Member[];
|
||||
members: Membership[];
|
||||
};
|
||||
|
||||
export type FocusDetail = {
|
||||
@ -76,10 +75,10 @@ export type FocusDetail = {
|
||||
enableVideo: boolean;
|
||||
enableBinary: boolean;
|
||||
created: number;
|
||||
members: Member[];
|
||||
members: Membership[];
|
||||
}
|
||||
|
||||
export type Member = {
|
||||
export type Membership = {
|
||||
guid: string;
|
||||
//pushEnabled: boolean;
|
||||
//canAddTopic: boolean,
|
||||
@ -211,7 +210,7 @@ export type Profile = {
|
||||
node: string;
|
||||
};
|
||||
|
||||
export type NodeAccount = {
|
||||
export type Member = {
|
||||
accountId: number;
|
||||
guid: string;
|
||||
handle: string;
|
||||
@ -222,7 +221,7 @@ export type NodeAccount = {
|
||||
disabled: boolean;
|
||||
};
|
||||
|
||||
export type NodeConfig = {
|
||||
export type Setup = {
|
||||
domain: string;
|
||||
accountStorage: string;
|
||||
enableImage: boolean;
|
||||
|
Loading…
x
Reference in New Issue
Block a user