plogme 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
6
+ const DEFAULT_DIRS = ['lib', 'WAProto'];
7
+ const DEFAULT_EXTENSIONS = new Set(['.js', '.mjs', '.cjs', '.ts', '.d.ts', '.proto', '.md', '.json']);
8
+
9
+ const walk = (directory, files) => {
10
+ if (!fs.existsSync(directory)) return;
11
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
12
+ if (entry.name === 'node_modules' || entry.name.startsWith('.')) continue;
13
+ const fullPath = path.join(directory, entry.name);
14
+ if (entry.isDirectory()) walk(fullPath, files);
15
+ else if (DEFAULT_EXTENSIONS.has(path.extname(entry.name))) files.push(fullPath);
16
+ }
17
+ };
18
+
19
+ /**
20
+ * Find a literal or regular-expression pattern in package source.
21
+ * Returns exact relative file, line, column, and matching source line.
22
+ */
23
+ export const grepSource = (pattern, options = {}) => {
24
+ if (typeof pattern !== 'string' || !pattern.trim()) {
25
+ throw new TypeError('grepSource requires a non-empty search string');
26
+ }
27
+ const expression = options.regex ? new RegExp(pattern, options.flags || 'i') : null;
28
+ const needle = options.caseSensitive ? pattern : pattern.toLowerCase();
29
+ const files = [];
30
+ for (const relativeDir of options.dirs || DEFAULT_DIRS) walk(path.resolve(PACKAGE_ROOT, relativeDir), files);
31
+ if (options.includeReadme) files.push(path.resolve(PACKAGE_ROOT, 'README.md'));
32
+ const matches = [];
33
+ for (const file of files.sort()) {
34
+ const lines = fs.readFileSync(file, 'utf8').split(/\r?\n/);
35
+ lines.forEach((line, index) => {
36
+ const found = expression ? expression.test(line) : (options.caseSensitive ? line.includes(pattern) : line.toLowerCase().includes(needle));
37
+ if (found) {
38
+ const column = expression ? Math.max(0, line.search(expression)) : (options.caseSensitive ? line.indexOf(pattern) : line.toLowerCase().indexOf(needle));
39
+ matches.push({ file: path.relative(PACKAGE_ROOT, file), line: index + 1, column: column + 1, text: line.trim() });
40
+ }
41
+ if (expression) expression.lastIndex = 0;
42
+ });
43
+ }
44
+ return matches.slice(0, Math.max(1, options.maxResults || 200));
45
+ };
package/lib/index.d.ts CHANGED
@@ -213,17 +213,33 @@ export interface RelayMessageOptions {
213
213
  /** Retry resend target; requires a device JID and retry count. */
214
214
  participants?: { jid: string; count: number };
215
215
  retryParticipants?: { jid: string; count: number };
216
- /** Keep only the target's primary device. */
216
+ /** Keep only the target's primary device in supported private-chat fan-out paths; not encryption. */
217
217
  isSecret?: boolean;
218
- /** Skip the target's linked devices. */
218
+ /** Skip the target's linked devices in supported private-chat fan-out paths; enforcement is client-dependent. */
219
219
  protected?: boolean;
220
- /** Keep only the sender's own devices. */
220
+ /** Keep only the sender's own devices in supported private-chat fan-out paths. */
221
221
  me?: boolean;
222
222
  [key: string]: unknown;
223
223
  }
224
224
 
225
+ export interface AlbumMediaInput {
226
+ image?: unknown;
227
+ video?: unknown;
228
+ caption?: string;
229
+ [key: string]: unknown;
230
+ }
231
+
232
+ export interface AnimatedWallpaperInput {
233
+ id?: string;
234
+ animatedWallpaperId?: string;
235
+ dimLevel?: number;
236
+ opacity?: number;
237
+ }
238
+
225
239
  export interface WASocket {
226
240
  sendMessage(jid: string | string[], content: StatusContent | GroupStatusContent | Record<string, unknown>, options?: Partial<StatusOptions> & Record<string, unknown>): Promise<unknown>;
241
+ /** Send at least two image/video items as an experimental WhatsApp album. */
242
+ sendAlbumMessage(jid: string, medias: AlbumMediaInput[], options?: Record<string, unknown>): Promise<unknown>;
227
243
  /** Update the connected account's WhatsApp About/profile status. */
228
244
  updateProfileStatus(status: string): Promise<void>;
229
245
  /** Update the connected account's profile name. */
@@ -234,6 +250,8 @@ export interface WASocket {
234
250
  relayMessage(jid: string, message: Record<string, unknown>, options?: RelayMessageOptions): Promise<unknown>;
235
251
  /** Send an experimental Meta AI-style rich menu with image, card buttons, and an optional URL footer. */
236
252
  richMenu(jid: string, content?: RichMenuContent, options?: Record<string, unknown>): Promise<unknown>;
253
+ /** Send raw HTML through the experimental WhatsApp HTML primitive. */
254
+ sendHtmlMessage(jid: string, content: { html: string; trustedSources?: string[] }, options?: Record<string, unknown>): Promise<unknown>;
237
255
  /** Post a personal status using explicit viewers or a configured contact source/provider. */
238
256
  sendStatus(content: Omit<StatusContent, 'statusJidList'>, options?: Partial<StatusOptions> & { statusJidList?: string[] }): Promise<unknown>;
239
257
  /** Publish a status and create status-mention references for the supplied users or groups. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plogme",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Production-ready Baileys fork \u2689 with AI groups, Meta AI prompting, safe compositing fallbacks, rich responses, interactive messages, albums, newsletters, and communities \u2014 without antiban wrappers.",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",