interface: removed unused api and store files

This commit is contained in:
Logan Allen 2020-09-22 15:09:25 -05:00
parent 8652c2d923
commit 65b317a0f9
7 changed files with 0 additions and 341 deletions

View File

@ -9,7 +9,6 @@ import MetadataApi from './metadata';
import ContactsApi from './contacts';
import GroupsApi from './groups';
import LaunchApi from './launch';
import LinksApi from './links';
import PublishApi from './publish';
import GraphApi from './graph';
import S3Api from './s3';
@ -22,7 +21,6 @@ export default class GlobalApi extends BaseApi<StoreState> {
contacts = new ContactsApi(this.ship, this.channel, this.store);
groups = new GroupsApi(this.ship, this.channel, this.store);
launch = new LaunchApi(this.ship, this.channel, this.store);
links = new LinksApi(this.ship, this.channel, this.store);
publish = new PublishApi(this.ship, this.channel, this.store);
s3 = new S3Api(this.ship, this.channel, this.store);
graph = new GraphApi(this.ship, this.channel, this.store);

View File

@ -1,131 +0,0 @@
import { stringToTa } from '../lib/util';
import BaseApi from './base';
import { StoreState } from '../store/type';
import { Path } from '~/types/noun';
export default class LinksApi extends BaseApi<StoreState> {
getCommentsPage(path: Path, url: string, page: number) {
const strictUrl = stringToTa(url);
const endpoint = '/json/' + page + '/discussions/' + strictUrl + path;
this.fetchLink(
endpoint,
(res) => {
if (res.data['link-update']['initial-discussions']) {
// these aren't returned with the response,
// so this ensures the reducers know them.
res.data['link-update']['initial-discussions'].path = path;
res.data['link-update']['initial-discussions'].url = url;
}
this.store.handleEvent(res);
},
console.error,
() => {} // no-op on quit
);
}
getPage(path: Path, page: number) {
const endpoint = '/json/' + page + '/submissions' + path;
this.fetchLink(
endpoint,
(dat) => {
this.store.handleEvent(dat);
},
console.error,
() => {} // no-op on quit
);
}
getSubmission(path: Path, url: string, callback) {
const strictUrl = stringToTa(url);
const endpoint = '/json/0/submission/' + strictUrl + path;
this.fetchLink(
endpoint,
(res) => {
if (res.data?.['link-update']?.submission) {
callback(res.data?.['link-update']?.submission);
} else {
console.error('unexpected submission response', res);
}
},
console.error,
() => {} // no-op on quit
);
}
createCollection(path, title, description, members, realGroup) {
// members is either {group:'/group-path'} or {'ships':[~zod]},
// with realGroup signifying if ships should become a managed group or not.
return this.viewAction({
create: { path, title, description, members, realGroup }
});
}
deleteCollection(path) {
return this.viewAction({
delete: { path }
});
}
inviteToCollection(path, ships) {
return this.viewAction({
invite: { path, ships }
});
}
joinCollection(path) {
return this.linkListenAction({ watch: path });
}
removeCollection(path) {
return this.linkListenAction({ leave: path });
}
postLink(path: Path, url: string, title: string) {
return this.linkAction({
save: { path, url, title }
});
}
postComment(path: Path, url: string, comment: string) {
return this.linkAction({
note: { path, url, udon: comment }
});
}
// leave url as null to mark all under path as read
seenLink(path: Path, url?: string) {
return this.linkAction({
seen: { path, url: url || null }
});
}
private linkAction(data) {
return this.action('link-store', 'link-action', data);
}
private viewAction(data) {
return this.action('link-view', 'link-view-action', data);
}
private linkListenAction(data) {
return this.action('link-listen-hook', 'link-listen-action', data);
}
private fetchLink(path: Path, result, fail, quit) {
this.subscribe.bind(this)(
path,
'PUT',
this.ship,
'link-view',
result,
fail,
quit
);
}
}

View File

@ -1,29 +0,0 @@
import BaseStore from './base';
import InviteReducer from '../reducers/invite-update';
import MetadataReducer from '../reducers/metadata-update';
import LocalReducer from '../reducers/local';
export default class GlobalStore extends BaseStore {
constructor() {
super();
this.inviteReducer = new InviteReducer();
this.metadataReducer = new MetadataReducer();
this.localReducer = new LocalReducer();
}
initialState() {
return {
invites: {},
associations: {},
selectedGroups: []
};
}
reduce(data, state) {
this.inviteReducer.reduce(data, this.state);
this.metadataReducer.reduce(data, this.state);
this.localReducer.reduce(data, this.state);
}
}

View File

@ -1,45 +0,0 @@
import ContactReducer from '../reducers/contact-update';
import GroupReducer from '../reducers/group-update';
import InviteReducer from '../reducers/invite-update';
import PermissionReducer from '../reducers/permission-update';
import MetadataReducer from '../reducers/metadata-update';
import LocalReducer from '../reducers/local';
import S3Reducer from '../reducers/s3-update';
import BaseStore from './base';
export default class GroupsStore extends BaseStore {
constructor() {
super();
this.groupReducer = new GroupReducer();
this.permissionReducer = new PermissionReducer();
this.contactReducer = new ContactReducer();
this.inviteReducer = new InviteReducer();
this.metadataReducer = new MetadataReducer();
this.s3Reducer = new S3Reducer();
this.localReducer = new LocalReducer();
}
initialState() {
return {
contacts: {},
groups: {},
associations: {},
permissions: {},
invites: {},
s3: {}
};
}
reduce(data, state) {
this.groupReducer.reduce(data, this.state);
this.permissionReducer.reduce(data, this.state);
this.contactReducer.reduce(data, this.state);
this.inviteReducer.reduce(data, this.state);
this.metadataReducer.reduce(data, this.state);
this.s3Reducer.reduce(data, this.state);
this.localReducer.reduce(data, this.state);
}
}

View File

@ -1,25 +0,0 @@
import BaseStore from './base';
import LaunchReducer from '../reducers/launch-update';
export default class LaunchStore extends BaseStore {
constructor() {
super();
this.launchReducer = new LaunchReducer();
}
initialState() {
return {
launch: {
firstTime: false,
tileOrdering: [],
tiles: {},
},
location: '',
weather: {}
};
}
reduce(data, state) {
this.launchReducer.reduce(data, state);
}
}

View File

@ -1,59 +0,0 @@
import GroupReducer from '../reducers/group-update';
import ContactReducer from '../reducers/contact-update';
import PermissionReducer from '../reducers/permission-update';
import MetadataReducer from '../reducers/metadata-update';
import InviteReducer from '../reducers/invite-update';
import LinkReducer from '../reducers/link-update';
import ListenReducer from '../reducers/listen-update';
import LocalReducer from '../reducers/local';
import S3Reducer from '../reducers/s3-update';
import BaseStore from './base';
export default class LinksStore extends BaseStore {
constructor() {
super();
this.groupReducer = new GroupReducer();
this.contactReducer = new ContactReducer();
this.permissionReducer = new PermissionReducer();
this.metadataReducer = new MetadataReducer();
this.inviteReducer = new InviteReducer();
this.localReducer = new LocalReducer();
this.linkReducer = new LinkReducer();
this.listenReducer = new ListenReducer();
this.s3Reducer = new S3Reducer();
}
initialState() {
return {
contacts: {},
groups: {},
associations: {
link: {},
contacts: {}
},
invites: {},
links: {},
listening: new Set(),
comments: {},
seen: {},
permissions: {},
s3: {},
sidebarShown: true
};
}
reduce(data, state) {
this.groupReducer.reduce(data, this.state);
this.contactReducer.reduce(data, this.state);
this.permissionReducer.reduce(data, this.state);
this.metadataReducer.reduce(data, this.state);
this.inviteReducer.reduce(data, this.state);
this.localReducer.reduce(data, this.state);
this.linkReducer.reduce(data, this.state);
this.listenReducer.reduce(data, this.state);
this.s3Reducer.reduce(data, this.state);
}
}

View File

@ -1,50 +0,0 @@
import BaseStore from './base';
import ContactReducer from '../reducers/contact-update';
import GroupReducer from '../reducers/group-update';
import LocalReducer from '../reducers/local';
import PublishReducer from '../reducers/publish-update';
import InviteReducer from '../reducers/invite-update';
import PublishResponseReducer from '../reducers/publish-response';
import PermissionReducer from '../reducers/permission-update';
import MetadataReducer from '../reducers/metadata-update';
export default class PublishStore extends BaseStore {
constructor() {
super();
this.contactReducer = new ContactReducer();
this.groupReducer = new GroupReducer();
this.localReducer = new LocalReducer();
this.publishReducer = new PublishReducer();
this.inviteReducer = new InviteReducer();
this.responseReducer = new PublishResponseReducer();
this.permissionReducer = new PermissionReducer();
this.metadataReducer = new MetadataReducer();
}
initialState() {
return {
notebooks: {},
groups: {},
contacts: {},
associations: {
contacts: {}
},
permissions: {},
invites: {},
sidebarShown: true
};
}
reduce(data, state) {
this.contactReducer.reduce(data, this.state);
this.groupReducer.reduce(data, this.state);
this.localReducer.reduce(data, this.state);
this.publishReducer.reduce(data, this.state);
this.permissionReducer.reduce(data, this.state);
this.metadataReducer.reduce(data, this.state);
this.inviteReducer.reduce(data, this.state);
this.responseReducer.reduce(data, this.state);
}
}