Skip to content

Commit

Permalink
fix: Fixed some search modules
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Sep 17, 2021
1 parent 7946eab commit d739fba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/tools/extractWhatsappSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
import * as fs from 'fs';
import * as path from 'path';

import * as wpp from '../';
import { getPage, WA_DIR } from './browser';

declare global {
interface Window {
WPP: any;
WPP: typeof wpp;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/whatsapp/collections/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,5 @@ exportModule(
{
Collection: 'default',
},
(m) => m.default.toString().includes('Collection initialized without model!')
(m) => m.default.toString().includes('Collection initialized without model')
);
2 changes: 1 addition & 1 deletion src/whatsapp/exportModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function exportModule(
export function exportProxyModel(exports: any, name: string) {
const baseName = name.replace(/Model$/, '');

const names: string[] = [];
const names: string[] = [baseName];

// ChatModel => "chat"
names.push(baseName.replace(/^(\w)/, (l) => l.toLowerCase()));
Expand Down
10 changes: 8 additions & 2 deletions src/whatsapp/models/ChatstateModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { exportProxyModel } from '../exportModule';
import { exportModule } from '../exportModule';
import { Wid } from '../misc';
import {
Model,
Expand Down Expand Up @@ -65,4 +65,10 @@ export declare class ChatstateModel extends Model {
getCollection(): any;
}

exportProxyModel(exports, 'ChatstateModel');
exportModule(
exports,
{
ChatstateModel: 'Chatstate',
},
(m) => m.Chatstate && m.ChatstateCollection
);

0 comments on commit d739fba

Please sign in to comment.