latus/packages/socket/src/index.js
2021-01-14 23:30:35 -06:00

34 lines
850 B
JavaScript

import {gather} from '@latus/core';
import badPacketsCheck from './packet/bad-packets-check';
import Bundle from './packet/bundle';
import Refresh from './packet/refresh';
export * from './hooks';
export {default as normalize} from './normalize';
export {default as Packet, Packer, ValidationError} from './packet';
export {default as packets} from './packet/packets';
export default {
hooks: {
'@latus/core/config': () => ({
authenticate: [],
connect: [],
}),
'@latus/core/starting': (latus) => {
// eslint-disable-next-line no-param-reassign
latus.config['%packets'] = gather(
latus,
{
type: '@latus/socket/packets',
check: badPacketsCheck,
},
);
},
'@latus/socket/packets': (latus) => ({
Bundle: Bundle(latus),
Refresh,
}),
},
};