@itsliaaa/baileys 0.1.14 → 0.1.16-beta.1

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.
package/WAProto/index.js CHANGED
@@ -88035,6 +88035,10 @@ export const proto = $root.proto = (() => {
88035
88035
  case 10:
88036
88036
  m.type = 10;
88037
88037
  break;
88038
+ case "AI_RESPONDING":
88039
+ case 11:
88040
+ m.type = 11;
88041
+ break;
88038
88042
  }
88039
88043
  if (d.isImmutable != null) {
88040
88044
  m.isImmutable = Boolean(d.isImmutable);
@@ -88131,6 +88135,7 @@ export const proto = $root.proto = (() => {
88131
88135
  values[valuesById[8] = "DRAFTED"] = 8;
88132
88136
  values[valuesById[9] = "AI_HANDOFF"] = 9;
88133
88137
  values[valuesById[10] = "CHANNELS"] = 10;
88138
+ values[valuesById[11] = "AI_RESPONDING"] = 11;
88134
88139
  return values;
88135
88140
  })();
88136
88141
 
@@ -91654,6 +91659,8 @@ export const proto = $root.proto = (() => {
91654
91659
  SettingsSyncAction.prototype.isStatusNotificationEnabled = null;
91655
91660
  SettingsSyncAction.prototype.statusNotificationToneId = null;
91656
91661
  SettingsSyncAction.prototype.shouldPlaySoundForCallNotification = null;
91662
+ SettingsSyncAction.prototype.chatThemeId = null;
91663
+ SettingsSyncAction.prototype.colorSchemeId = null;
91657
91664
 
91658
91665
  let $oneOfFields;
91659
91666
 
@@ -91812,6 +91819,16 @@ export const proto = $root.proto = (() => {
91812
91819
  set: $util.oneOfSetter($oneOfFields)
91813
91820
  });
91814
91821
 
91822
+ Object.defineProperty(SettingsSyncAction.prototype, "_chatThemeId", {
91823
+ get: $util.oneOfGetter($oneOfFields = ["chatThemeId"]),
91824
+ set: $util.oneOfSetter($oneOfFields)
91825
+ });
91826
+
91827
+ Object.defineProperty(SettingsSyncAction.prototype, "_colorSchemeId", {
91828
+ get: $util.oneOfGetter($oneOfFields = ["colorSchemeId"]),
91829
+ set: $util.oneOfSetter($oneOfFields)
91830
+ });
91831
+
91815
91832
  SettingsSyncAction.create = function create(properties) {
91816
91833
  return new SettingsSyncAction(properties);
91817
91834
  };
@@ -91881,6 +91898,10 @@ export const proto = $root.proto = (() => {
91881
91898
  w.uint32(240).int32(m.statusNotificationToneId);
91882
91899
  if (m.shouldPlaySoundForCallNotification != null && Object.hasOwnProperty.call(m, "shouldPlaySoundForCallNotification"))
91883
91900
  w.uint32(248).bool(m.shouldPlaySoundForCallNotification);
91901
+ if (m.chatThemeId != null && Object.hasOwnProperty.call(m, "chatThemeId"))
91902
+ w.uint32(258).string(m.chatThemeId);
91903
+ if (m.colorSchemeId != null && Object.hasOwnProperty.call(m, "colorSchemeId"))
91904
+ w.uint32(266).string(m.colorSchemeId);
91884
91905
  return w;
91885
91906
  };
91886
91907
 
@@ -92017,6 +92038,14 @@ export const proto = $root.proto = (() => {
92017
92038
  m.shouldPlaySoundForCallNotification = r.bool();
92018
92039
  break;
92019
92040
  }
92041
+ case 32: {
92042
+ m.chatThemeId = r.string();
92043
+ break;
92044
+ }
92045
+ case 33: {
92046
+ m.colorSchemeId = r.string();
92047
+ break;
92048
+ }
92020
92049
  default:
92021
92050
  r.skipType(t & 7);
92022
92051
  break;
@@ -92181,6 +92210,12 @@ export const proto = $root.proto = (() => {
92181
92210
  if (d.shouldPlaySoundForCallNotification != null) {
92182
92211
  m.shouldPlaySoundForCallNotification = Boolean(d.shouldPlaySoundForCallNotification);
92183
92212
  }
92213
+ if (d.chatThemeId != null) {
92214
+ m.chatThemeId = String(d.chatThemeId);
92215
+ }
92216
+ if (d.colorSchemeId != null) {
92217
+ m.colorSchemeId = String(d.colorSchemeId);
92218
+ }
92184
92219
  return m;
92185
92220
  };
92186
92221
 
@@ -92343,6 +92378,16 @@ export const proto = $root.proto = (() => {
92343
92378
  if (o.oneofs)
92344
92379
  d._shouldPlaySoundForCallNotification = "shouldPlaySoundForCallNotification";
92345
92380
  }
92381
+ if (m.chatThemeId != null && m.hasOwnProperty("chatThemeId")) {
92382
+ d.chatThemeId = m.chatThemeId;
92383
+ if (o.oneofs)
92384
+ d._chatThemeId = "chatThemeId";
92385
+ }
92386
+ if (m.colorSchemeId != null && m.hasOwnProperty("colorSchemeId")) {
92387
+ d.colorSchemeId = m.colorSchemeId;
92388
+ if (o.oneofs)
92389
+ d._colorSchemeId = "colorSchemeId";
92390
+ }
92346
92391
  return d;
92347
92392
  };
92348
92393
 
@@ -92408,6 +92453,8 @@ export const proto = $root.proto = (() => {
92408
92453
  values[valuesById[29] = "IS_STATUS_NOTIFICATION_ENABLED"] = 29;
92409
92454
  values[valuesById[30] = "STATUS_NOTIFICATION_TONE_ID"] = 30;
92410
92455
  values[valuesById[31] = "SHOULD_PLAY_SOUND_FOR_CALL_NOTIFICATION"] = 31;
92456
+ values[valuesById[32] = "CHAT_THEME_ID"] = 32;
92457
+ values[valuesById[33] = "COLOR_SCHEME_ID"] = 33;
92411
92458
  return values;
92412
92459
  })();
92413
92460
 
@@ -64,7 +64,7 @@ export const DEFAULT_CONNECTION_CONFIG = {
64
64
  },
65
65
  shouldIgnoreJid: () => false,
66
66
  linkPreviewImageThumbnailWidth: 192,
67
- transactionOpts: { maxCommitRetries: 5, delayBetweenTriesMs: 3000 },
67
+ transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
68
68
  generateHighQualityLinkPreview: false,
69
69
  enableAutoSessionRecreation: true,
70
70
  enableRecentMessageCache: true,
@@ -124,8 +124,8 @@ export const prepareWAMessageMedia = async (message, options) => {
124
124
  }
125
125
  const isNewsletter = !!options.jid && isJidNewsletter(options.jid);
126
126
  const requiresDurationComputation = mediaType === 'audio' && typeof uploadData.seconds === 'undefined';
127
- const requiresThumbnailComputation = (mediaType === 'image' || mediaType === 'video') && typeof uploadData['jpegThumbnail'] === 'undefined';
128
- const requiresWaveformProcessing = mediaType === 'audio' && uploadData.ptt === true;
127
+ const requiresThumbnailComputation = (mediaType === 'image' || mediaType === 'video') && typeof uploadData.jpegThumbnail === 'undefined';
128
+ const requiresWaveformProcessing = mediaType === 'audio' && uploadData.ptt === true && typeof uploadData.waveform === 'undefined';
129
129
  const requiresAudioBackground = options.backgroundColor && mediaType === 'audio' && uploadData.ptt === true;
130
130
  const requiresOriginalForSomeProcessing = requiresDurationComputation || requiresThumbnailComputation || requiresWaveformProcessing;
131
131
  // Lia@Changes 06-02-26 --- Add few support for sending media to newsletter (⁠≧⁠▽⁠≦⁠)
@@ -3,16 +3,10 @@ import { DEFAULT_CACHE_TTLS } from '../Defaults/index.js';
3
3
  import { proto } from '../../WAProto/index.js';
4
4
  import { initAuthCreds } from './auth-utils.js';
5
5
  import { BufferJSON } from './generics.js';
6
- import NodeCache from '@cacheable/node-cache';
7
6
  // Lia@Changes 25-03-26 --- Add useSingleFileAuthState with integrated cache
8
- const FLUSH_TIMEOUT_MS = 25
9
- export const useSingleFileAuthState = async (fileName, _cache) => {
10
- const cache = _cache ||
11
- new NodeCache({
12
- stdTTL: DEFAULT_CACHE_TTLS.SIGNAL_STORE,
13
- useClones: false,
14
- deleteOnExpire: true
15
- });
7
+ const FLUSH_TIMEOUT_MS = 3000;
8
+ export const useSingleFileAuthState = async (fileName) => {
9
+ const cache = new Map();
16
10
  let isLoaded,
17
11
  isWriting,
18
12
  isNeedWrite,
@@ -46,7 +40,7 @@ export const useSingleFileAuthState = async (fileName, _cache) => {
46
40
  do {
47
41
  isNeedWrite = false;
48
42
  const tempFile = fileName + '.temp';
49
- const value = cache.mget(cache.keys());
43
+ const value = Object.fromEntries(cache);
50
44
  await writeFile(tempFile, JSON.stringify(value, BufferJSON.replacer));
51
45
  await rename(tempFile, fileName);
52
46
  }
@@ -59,7 +53,7 @@ export const useSingleFileAuthState = async (fileName, _cache) => {
59
53
  flushKey();
60
54
  };
61
55
  const removeKey = (keyName) => {
62
- cache.del(keyName);
56
+ cache.delete(keyName);
63
57
  flushKey();
64
58
  };
65
59
  const fileInfo = await stat(fileName).catch(() => null);
@@ -78,7 +72,7 @@ export const useSingleFileAuthState = async (fileName, _cache) => {
78
72
  get: (type, ids) => {
79
73
  const data = {};
80
74
  for (const id of ids) {
81
- let value = cache.get(type + '-' + id);
75
+ let value = cache.get(type + id);
82
76
  if (type === 'app-state-sync-key' && value) {
83
77
  value = proto.Message.AppStateSyncKeyData.fromObject(value);
84
78
  }
@@ -89,14 +83,9 @@ export const useSingleFileAuthState = async (fileName, _cache) => {
89
83
  set: (data) => {
90
84
  for (const category in data) {
91
85
  for (const id in data[category]) {
92
- const keyName = category + '-' + id;
86
+ const keyName = category + id;
93
87
  const value = data[category][id];
94
- if (value) {
95
- writeKey(keyName, value);
96
- }
97
- else {
98
- removeKey(keyName);
99
- }
88
+ value ? writeKey(keyName, value) : removeKey(keyName);
100
89
  }
101
90
  }
102
91
  }
@@ -25,7 +25,7 @@ export const getServerFromDomainType = (initialServer, domainType) => {
25
25
  }
26
26
  };
27
27
  export const jidEncode = (user, server, device, agent) => {
28
- return `${user || ''}${!!agent ? `_${agent}` : ''}${!!device ? `:${device}` : ''}@${server}`;
28
+ return `${user || ''}${!!agent ? `_${agent}` : ''}${!!device ? `:${device}` : ''}@${server || 'lid'}`;
29
29
  };
30
30
  export const jidDecode = (jid) => {
31
31
  // todo: investigate how to implement hosted ids in this case
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itsliaaa/baileys",
3
- "version": "0.1.14",
3
+ "version": "0.1.16-beta.1",
4
4
  "description": "A simple fork of Baileys for WhatsApp automation",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",