wechaty-puppet
Version:
Abstract Puppet for Wechaty
60 lines • 2.47 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.Puppet = void 0;
/**
* Wechaty - https://github.com/wechaty/wechaty
*
* @copyright 2016-2018 Huan LI <zixia@zixia.net>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
const fp_ts_1 = require("fp-ts");
const config_js_1 = require("../config.js");
const mod_js_1 = require("../mixins/mod.js");
const puppet_skeleton_js_1 = require("./puppet-skeleton.js");
/**
* Mixins with Functional Programming: compose / pipe
* related discussion: https://github.com/wechaty/puppet/pull/173
*/
const PipedBase = fp_ts_1.function.pipe(puppet_skeleton_js_1.PuppetSkeleton, mod_js_1.memoryMixin, mod_js_1.loginMixin, mod_js_1.cacheMixin, mod_js_1.contactMixin, mod_js_1.roomMemberMixin, mod_js_1.roomMixin, mod_js_1.friendshipMixin, mod_js_1.tagMixin, mod_js_1.roomInvitationMixin, mod_js_1.messageMixin, mod_js_1.miscMixin, mod_js_1.serviceMixin, mod_js_1.readyMixin, mod_js_1.postMixin, mod_js_1.sayableMixin, mod_js_1.tapMixin);
/**
* Huan(202111): validateMixin can not put in the piped list,
* because it import-ed the `PuppetInterface` which is depended on `PuppetImpl`
* which caused circle-dependency.
*
* TODO: put `validateMixin` back in to piped list
*/
const MixinBase = (0, mod_js_1.validateMixin)(PipedBase);
/**
*
* Puppet Base Class
*
* See: https://github.com/wechaty/wechaty/wiki/Puppet
*
*/
class Puppet extends MixinBase {
/**
* Must overwrite by child class to identify their version
*
* Huan(202111): we must put the `VERSION` in the outter side of all the Mixins
* because we do not know which Mixin will override the `VERSION`
*/
static VERSION = config_js_1.VERSION;
constructor(options = {}) {
super(options);
config_js_1.log.verbose('Puppet', 'constructor(%s)', JSON.stringify(options));
}
}
exports.Puppet = Puppet;
//# sourceMappingURL=puppet-abstract.js.map
;