@sgintokic/baileys 0.0.2

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.

Potentially problematic release.


This version of @sgintokic/baileys might be problematic. Click here for more details.

Files changed (106) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +1097 -0
  3. package/WAProto/index.js +2 -0
  4. package/engine-requirements.js +1 -0
  5. package/lib/Defaults/index.js +155 -0
  6. package/lib/Signal/Group/ciphertext-message.js +11 -0
  7. package/lib/Signal/Group/group-session-builder.js +41 -0
  8. package/lib/Signal/Group/group_cipher.js +108 -0
  9. package/lib/Signal/Group/index.js +11 -0
  10. package/lib/Signal/Group/keyhelper.js +14 -0
  11. package/lib/Signal/Group/sender-chain-key.js +31 -0
  12. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  13. package/lib/Signal/Group/sender-key-message.js +79 -0
  14. package/lib/Signal/Group/sender-key-name.js +49 -0
  15. package/lib/Signal/Group/sender-key-record.js +46 -0
  16. package/lib/Signal/Group/sender-key-state.js +104 -0
  17. package/lib/Signal/Group/sender-message-key.js +29 -0
  18. package/lib/Signal/libsignal.js +485 -0
  19. package/lib/Signal/lid-mapping.js +291 -0
  20. package/lib/Socket/Client/index.js +2 -0
  21. package/lib/Socket/Client/types.js +10 -0
  22. package/lib/Socket/Client/websocket.js +64 -0
  23. package/lib/Socket/business.js +293 -0
  24. package/lib/Socket/chats.js +1068 -0
  25. package/lib/Socket/communities.js +476 -0
  26. package/lib/Socket/groups.js +383 -0
  27. package/lib/Socket/index.js +8 -0
  28. package/lib/Socket/messages-recv.js +1830 -0
  29. package/lib/Socket/messages-send.js +1462 -0
  30. package/lib/Socket/mex.js +55 -0
  31. package/lib/Socket/newsletter.js +277 -0
  32. package/lib/Socket/socket.js +1087 -0
  33. package/lib/Store/index.js +3 -0
  34. package/lib/Store/make-in-memory-store.js +517 -0
  35. package/lib/Store/make-ordered-dictionary.js +75 -0
  36. package/lib/Store/object-repository.js +23 -0
  37. package/lib/Types/Auth.js +1 -0
  38. package/lib/Types/Bussines.js +1 -0
  39. package/lib/Types/Call.js +1 -0
  40. package/lib/Types/Chat.js +7 -0
  41. package/lib/Types/Contact.js +1 -0
  42. package/lib/Types/Events.js +1 -0
  43. package/lib/Types/GroupMetadata.js +1 -0
  44. package/lib/Types/Label.js +24 -0
  45. package/lib/Types/LabelAssociation.js +6 -0
  46. package/lib/Types/Message.js +18 -0
  47. package/lib/Types/Newsletter.js +33 -0
  48. package/lib/Types/Product.js +1 -0
  49. package/lib/Types/Signal.js +1 -0
  50. package/lib/Types/Socket.js +2 -0
  51. package/lib/Types/State.js +15 -0
  52. package/lib/Types/USync.js +1 -0
  53. package/lib/Types/index.js +31 -0
  54. package/lib/Utils/auth-utils.js +293 -0
  55. package/lib/Utils/browser-utils.js +32 -0
  56. package/lib/Utils/business.js +245 -0
  57. package/lib/Utils/chat-utils.js +959 -0
  58. package/lib/Utils/crypto.js +133 -0
  59. package/lib/Utils/decode-wa-message.js +376 -0
  60. package/lib/Utils/event-buffer.js +620 -0
  61. package/lib/Utils/generics.js +417 -0
  62. package/lib/Utils/history.js +150 -0
  63. package/lib/Utils/identity-change-handler.js +63 -0
  64. package/lib/Utils/index.js +21 -0
  65. package/lib/Utils/link-preview.js +91 -0
  66. package/lib/Utils/logger.js +2 -0
  67. package/lib/Utils/lt-hash.js +6 -0
  68. package/lib/Utils/make-mutex.js +31 -0
  69. package/lib/Utils/message-retry-manager.js +240 -0
  70. package/lib/Utils/messages-media.js +901 -0
  71. package/lib/Utils/messages.js +2052 -0
  72. package/lib/Utils/noise-handler.js +229 -0
  73. package/lib/Utils/offline-node-processor.js +50 -0
  74. package/lib/Utils/pre-key-manager.js +119 -0
  75. package/lib/Utils/process-message.js +641 -0
  76. package/lib/Utils/reporting-utils.js +346 -0
  77. package/lib/Utils/signal.js +188 -0
  78. package/lib/Utils/stanza-ack.js +33 -0
  79. package/lib/Utils/sync-action-utils.js +53 -0
  80. package/lib/Utils/tc-token-utils.js +15 -0
  81. package/lib/Utils/use-multi-file-auth-state.js +116 -0
  82. package/lib/Utils/use-single-file-auth-state.js +94 -0
  83. package/lib/Utils/validate-connection.js +235 -0
  84. package/lib/WABinary/constants.js +1300 -0
  85. package/lib/WABinary/decode.js +258 -0
  86. package/lib/WABinary/encode.js +219 -0
  87. package/lib/WABinary/generic-utils.js +203 -0
  88. package/lib/WABinary/index.js +5 -0
  89. package/lib/WABinary/jid-utils.js +93 -0
  90. package/lib/WABinary/types.js +1 -0
  91. package/lib/WAM/BinaryInfo.js +9 -0
  92. package/lib/WAM/constants.js +20669 -0
  93. package/lib/WAM/encode.js +151 -0
  94. package/lib/WAM/index.js +3 -0
  95. package/lib/WAUSync/Protocols/USyncContactProtocol.js +21 -0
  96. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +50 -0
  97. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +20 -0
  98. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +29 -0
  99. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +59 -0
  100. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +21 -0
  101. package/lib/WAUSync/Protocols/index.js +4 -0
  102. package/lib/WAUSync/USyncQuery.js +103 -0
  103. package/lib/WAUSync/USyncUser.js +22 -0
  104. package/lib/WAUSync/index.js +3 -0
  105. package/lib/index.js +11 -0
  106. package/package.json +58 -0
@@ -0,0 +1,476 @@
1
+ import { proto } from "../../WAProto/index.js";
2
+ import { WAMessageStubType } from "../Types/index.js";
3
+ import {
4
+ generateMessageID,
5
+ generateMessageIDV2,
6
+ unixTimestampSeconds,
7
+ } from "../Utils/index.js";
8
+ import logger from "../Utils/logger.js";
9
+ import {
10
+ getBinaryNodeChild,
11
+ getBinaryNodeChildren,
12
+ getBinaryNodeChildString,
13
+ jidEncode,
14
+ jidNormalizedUser,
15
+ } from "../WABinary/index.js";
16
+ import { makeBusinessSocket } from "./business.js";
17
+ export const makeCommunitiesSocket = (config) => {
18
+ const sock = makeBusinessSocket(config);
19
+ const { authState, ev, query, upsertMessage } = sock;
20
+ const communityQuery = async (jid, type, content) =>
21
+ query({
22
+ tag: "iq",
23
+ attrs: { type: type, xmlns: "w:g2", to: jid },
24
+ content: content,
25
+ });
26
+ const communityMetadata = async (jid) => {
27
+ const result = await communityQuery(jid, "get", [
28
+ { tag: "query", attrs: { request: "interactive" } },
29
+ ]);
30
+ return extractCommunityMetadata(result);
31
+ };
32
+ const communityFetchAllParticipating = async () => {
33
+ const result = await query({
34
+ tag: "iq",
35
+ attrs: { to: "@g.us", xmlns: "w:g2", type: "get" },
36
+ content: [
37
+ {
38
+ tag: "participating",
39
+ attrs: {},
40
+ content: [
41
+ { tag: "participants", attrs: {} },
42
+ { tag: "description", attrs: {} },
43
+ ],
44
+ },
45
+ ],
46
+ });
47
+ const data = {};
48
+ const communitiesChild = getBinaryNodeChild(result, "communities");
49
+ if (communitiesChild) {
50
+ const communities = getBinaryNodeChildren(communitiesChild, "community");
51
+ for (const communityNode of communities) {
52
+ const meta = extractCommunityMetadata({
53
+ tag: "result",
54
+ attrs: {},
55
+ content: [communityNode],
56
+ });
57
+ data[meta.id] = meta;
58
+ }
59
+ }
60
+ sock.ev.emit("groups.update", Object.values(data));
61
+ return data;
62
+ };
63
+ async function parseGroupResult(node) {
64
+ logger.info({ node: node }, "parseGroupResult");
65
+ const groupNode = getBinaryNodeChild(node, "group");
66
+ if (groupNode) {
67
+ try {
68
+ logger.info({ groupNode: groupNode }, "groupNode");
69
+ const metadata = await sock.groupMetadata(`${groupNode.attrs.id}@g.us`);
70
+ return metadata ? metadata : Optional.empty();
71
+ } catch (error) {
72
+ console.error("Error parsing group metadata:", error);
73
+ return Optional.empty();
74
+ }
75
+ }
76
+ return Optional.empty();
77
+ }
78
+ const Optional = {
79
+ empty: () => null,
80
+ of: (value) => (value !== null ? { value: value } : null),
81
+ };
82
+ sock.ws.on("CB:ib,,dirty", async (node) => {
83
+ const { attrs } = getBinaryNodeChild(node, "dirty");
84
+ if (attrs.type !== "communities") {
85
+ return;
86
+ }
87
+ await communityFetchAllParticipating();
88
+ await sock.cleanDirtyBits("groups");
89
+ });
90
+ return {
91
+ ...sock,
92
+ communityMetadata: communityMetadata,
93
+ communityCreate: async (subject, body) => {
94
+ const descriptionId = generateMessageID().substring(0, 12);
95
+ const result = await communityQuery("@g.us", "set", [
96
+ {
97
+ tag: "create",
98
+ attrs: { subject: subject },
99
+ content: [
100
+ {
101
+ tag: "description",
102
+ attrs: { id: descriptionId },
103
+ content: [
104
+ {
105
+ tag: "body",
106
+ attrs: {},
107
+ content: Buffer.from(body || "", "utf-8"),
108
+ },
109
+ ],
110
+ },
111
+ {
112
+ tag: "parent",
113
+ attrs: { default_membership_approval_mode: "request_required" },
114
+ },
115
+ { tag: "allow_non_admin_sub_group_creation", attrs: {} },
116
+ { tag: "create_general_chat", attrs: {} },
117
+ ],
118
+ },
119
+ ]);
120
+ return await parseGroupResult(result);
121
+ },
122
+ communityCreateGroup: async (subject, participants, parentCommunityJid) => {
123
+ const key = generateMessageIDV2();
124
+ const result = await communityQuery("@g.us", "set", [
125
+ {
126
+ tag: "create",
127
+ attrs: { subject: subject, key: key },
128
+ content: [
129
+ ...participants.map((jid) => ({
130
+ tag: "participant",
131
+ attrs: { jid: jid },
132
+ })),
133
+ { tag: "linked_parent", attrs: { jid: parentCommunityJid } },
134
+ ],
135
+ },
136
+ ]);
137
+ return await parseGroupResult(result);
138
+ },
139
+ communityLeave: async (id) => {
140
+ await communityQuery("@g.us", "set", [
141
+ {
142
+ tag: "leave",
143
+ attrs: {},
144
+ content: [{ tag: "community", attrs: { id: id } }],
145
+ },
146
+ ]);
147
+ },
148
+ communityUpdateSubject: async (jid, subject) => {
149
+ await communityQuery(jid, "set", [
150
+ { tag: "subject", attrs: {}, content: Buffer.from(subject, "utf-8") },
151
+ ]);
152
+ },
153
+ communityLinkGroup: async (groupJid, parentCommunityJid) => {
154
+ await communityQuery(parentCommunityJid, "set", [
155
+ {
156
+ tag: "links",
157
+ attrs: {},
158
+ content: [
159
+ {
160
+ tag: "link",
161
+ attrs: { link_type: "sub_group" },
162
+ content: [{ tag: "group", attrs: { jid: groupJid } }],
163
+ },
164
+ ],
165
+ },
166
+ ]);
167
+ },
168
+ communityUnlinkGroup: async (groupJid, parentCommunityJid) => {
169
+ await communityQuery(parentCommunityJid, "set", [
170
+ {
171
+ tag: "unlink",
172
+ attrs: { unlink_type: "sub_group" },
173
+ content: [{ tag: "group", attrs: { jid: groupJid } }],
174
+ },
175
+ ]);
176
+ },
177
+ communityFetchLinkedGroups: async (jid) => {
178
+ let communityJid = jid;
179
+ let isCommunity = false;
180
+ // Try to determine if it is a subgroup or a community
181
+ const metadata = await sock.groupMetadata(jid);
182
+ if (metadata.linkedParent) {
183
+ // It is a subgroup, get the community jid
184
+ communityJid = metadata.linkedParent;
185
+ } else {
186
+ // It is a community
187
+ isCommunity = true;
188
+ }
189
+ // Fetch all subgroups of the community
190
+ const result = await communityQuery(communityJid, "get", [
191
+ { tag: "sub_groups", attrs: {} },
192
+ ]);
193
+ const linkedGroupsData = [];
194
+ const subGroupsNode = getBinaryNodeChild(result, "sub_groups");
195
+ if (subGroupsNode) {
196
+ const groupNodes = getBinaryNodeChildren(subGroupsNode, "group");
197
+ for (const groupNode of groupNodes) {
198
+ linkedGroupsData.push({
199
+ id: groupNode.attrs.id
200
+ ? jidEncode(groupNode.attrs.id, "g.us")
201
+ : undefined,
202
+ subject: groupNode.attrs.subject || "",
203
+ creation: groupNode.attrs.creation
204
+ ? Number(groupNode.attrs.creation)
205
+ : undefined,
206
+ owner: groupNode.attrs.creator
207
+ ? jidNormalizedUser(groupNode.attrs.creator)
208
+ : undefined,
209
+ size: groupNode.attrs.size
210
+ ? Number(groupNode.attrs.size)
211
+ : undefined,
212
+ });
213
+ }
214
+ }
215
+ return {
216
+ communityJid: communityJid,
217
+ isCommunity: isCommunity,
218
+ linkedGroups: linkedGroupsData,
219
+ };
220
+ },
221
+ communityRequestParticipantsList: async (jid) => {
222
+ const result = await communityQuery(jid, "get", [
223
+ { tag: "membership_approval_requests", attrs: {} },
224
+ ]);
225
+ const node = getBinaryNodeChild(result, "membership_approval_requests");
226
+ const participants = getBinaryNodeChildren(
227
+ node,
228
+ "membership_approval_request",
229
+ );
230
+ return participants.map((v) => v.attrs);
231
+ },
232
+ communityRequestParticipantsUpdate: async (jid, participants, action) => {
233
+ const result = await communityQuery(jid, "set", [
234
+ {
235
+ tag: "membership_requests_action",
236
+ attrs: {},
237
+ content: [
238
+ {
239
+ tag: action,
240
+ attrs: {},
241
+ content: participants.map((jid) => ({
242
+ tag: "participant",
243
+ attrs: { jid: jid },
244
+ })),
245
+ },
246
+ ],
247
+ },
248
+ ]);
249
+ const node = getBinaryNodeChild(result, "membership_requests_action");
250
+ const nodeAction = getBinaryNodeChild(node, action);
251
+ const participantsAffected = getBinaryNodeChildren(
252
+ nodeAction,
253
+ "participant",
254
+ );
255
+ return participantsAffected.map((p) => {
256
+ return { status: p.attrs.error || "200", jid: p.attrs.jid };
257
+ });
258
+ },
259
+ communityParticipantsUpdate: async (jid, participants, action) => {
260
+ const result = await communityQuery(jid, "set", [
261
+ {
262
+ tag: action,
263
+ attrs: action === "remove" ? { linked_groups: "true" } : {},
264
+ content: participants.map((jid) => ({
265
+ tag: "participant",
266
+ attrs: { jid: jid },
267
+ })),
268
+ },
269
+ ]);
270
+ const node = getBinaryNodeChild(result, action);
271
+ const participantsAffected = getBinaryNodeChildren(node, "participant");
272
+ return participantsAffected.map((p) => {
273
+ return { status: p.attrs.error || "200", jid: p.attrs.jid, content: p };
274
+ });
275
+ },
276
+ communityUpdateDescription: async (jid, description) => {
277
+ const metadata = await communityMetadata(jid);
278
+ const prev = metadata.descId ?? null;
279
+ await communityQuery(jid, "set", [
280
+ {
281
+ tag: "description",
282
+ attrs: {
283
+ ...(description ? { id: generateMessageID() } : { delete: "true" }),
284
+ ...(prev ? { prev: prev } : {}),
285
+ },
286
+ content: description
287
+ ? [
288
+ {
289
+ tag: "body",
290
+ attrs: {},
291
+ content: Buffer.from(description, "utf-8"),
292
+ },
293
+ ]
294
+ : undefined,
295
+ },
296
+ ]);
297
+ },
298
+ communityInviteCode: async (jid) => {
299
+ const result = await communityQuery(jid, "get", [
300
+ { tag: "invite", attrs: {} },
301
+ ]);
302
+ const inviteNode = getBinaryNodeChild(result, "invite");
303
+ return inviteNode?.attrs.code;
304
+ },
305
+ communityRevokeInvite: async (jid) => {
306
+ const result = await communityQuery(jid, "set", [
307
+ { tag: "invite", attrs: {} },
308
+ ]);
309
+ const inviteNode = getBinaryNodeChild(result, "invite");
310
+ return inviteNode?.attrs.code;
311
+ },
312
+ communityAcceptInvite: async (code) => {
313
+ const results = await communityQuery("@g.us", "set", [
314
+ { tag: "invite", attrs: { code: code } },
315
+ ]);
316
+ const result = getBinaryNodeChild(results, "community");
317
+ return result?.attrs.jid;
318
+ },
319
+ /**
320
+ * revoke a v4 invite for someone
321
+ * @param communityJid community jid
322
+ * @param invitedJid jid of person you invited
323
+ * @returns true if successful
324
+ */
325
+ communityRevokeInviteV4: async (communityJid, invitedJid) => {
326
+ const result = await communityQuery(communityJid, "set", [
327
+ {
328
+ tag: "revoke",
329
+ attrs: {},
330
+ content: [{ tag: "participant", attrs: { jid: invitedJid } }],
331
+ },
332
+ ]);
333
+ return !!result;
334
+ },
335
+ /**
336
+ * accept a CommunityInviteMessage
337
+ * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
338
+ * @param inviteMessage the message to accept
339
+ */
340
+ communityAcceptInviteV4: ev.createBufferedFunction(
341
+ async (key, inviteMessage) => {
342
+ key = typeof key === "string" ? { remoteJid: key } : key;
343
+ const results = await communityQuery(inviteMessage.groupJid, "set", [
344
+ {
345
+ tag: "accept",
346
+ attrs: {
347
+ code: inviteMessage.inviteCode,
348
+ expiration: inviteMessage.inviteExpiration.toString(),
349
+ admin: key.remoteJid,
350
+ },
351
+ },
352
+ ]);
353
+ // if we have the full message key
354
+ // update the invite message to be expired
355
+ if (key.id) {
356
+ // create new invite message that is expired
357
+ inviteMessage =
358
+ proto.Message.GroupInviteMessage.fromObject(inviteMessage);
359
+ inviteMessage.inviteExpiration = 0;
360
+ inviteMessage.inviteCode = "";
361
+ ev.emit("messages.update", [
362
+ {
363
+ key: key,
364
+ update: { message: { groupInviteMessage: inviteMessage } },
365
+ },
366
+ ]);
367
+ }
368
+ // generate the community add message
369
+ await upsertMessage(
370
+ {
371
+ key: {
372
+ remoteJid: inviteMessage.groupJid,
373
+ id: generateMessageIDV2(sock.user?.id),
374
+ fromMe: false,
375
+ participant: key.remoteJid,
376
+ },
377
+ messageStubType: WAMessageStubType.GROUP_PARTICIPANT_ADD,
378
+ messageStubParameters: [JSON.stringify(authState.creds.me)],
379
+ participant: key.remoteJid,
380
+ messageTimestamp: unixTimestampSeconds(),
381
+ },
382
+ "notify",
383
+ );
384
+ return results.attrs.from;
385
+ },
386
+ ),
387
+ communityGetInviteInfo: async (code) => {
388
+ const results = await communityQuery("@g.us", "get", [
389
+ { tag: "invite", attrs: { code: code } },
390
+ ]);
391
+ return extractCommunityMetadata(results);
392
+ },
393
+ communityToggleEphemeral: async (jid, ephemeralExpiration) => {
394
+ const content = ephemeralExpiration
395
+ ? {
396
+ tag: "ephemeral",
397
+ attrs: { expiration: ephemeralExpiration.toString() },
398
+ }
399
+ : { tag: "not_ephemeral", attrs: {} };
400
+ await communityQuery(jid, "set", [content]);
401
+ },
402
+ communitySettingUpdate: async (jid, setting) => {
403
+ await communityQuery(jid, "set", [{ tag: setting, attrs: {} }]);
404
+ },
405
+ communityMemberAddMode: async (jid, mode) => {
406
+ await communityQuery(jid, "set", [
407
+ { tag: "member_add_mode", attrs: {}, content: mode },
408
+ ]);
409
+ },
410
+ communityJoinApprovalMode: async (jid, mode) => {
411
+ await communityQuery(jid, "set", [
412
+ {
413
+ tag: "membership_approval_mode",
414
+ attrs: {},
415
+ content: [{ tag: "community_join", attrs: { state: mode } }],
416
+ },
417
+ ]);
418
+ },
419
+ communityFetchAllParticipating: communityFetchAllParticipating,
420
+ };
421
+ };
422
+ export const extractCommunityMetadata = (result) => {
423
+ const community = getBinaryNodeChild(result, "community");
424
+ const descChild = getBinaryNodeChild(community, "description");
425
+ let desc;
426
+ let descId;
427
+ if (descChild) {
428
+ desc = getBinaryNodeChildString(descChild, "body");
429
+ descId = descChild.attrs.id;
430
+ }
431
+ const communityId = community.attrs.id?.includes("@")
432
+ ? community.attrs.id
433
+ : jidEncode(community.attrs.id || "", "g.us");
434
+ const eph = getBinaryNodeChild(community, "ephemeral")?.attrs.expiration;
435
+ const memberAddMode =
436
+ getBinaryNodeChildString(community, "member_add_mode") === "all_member_add";
437
+ const metadata = {
438
+ id: communityId,
439
+ subject: community.attrs.subject || "",
440
+ subjectOwner: community.attrs.s_o,
441
+ subjectTime: Number(community.attrs.s_t || 0),
442
+ size: getBinaryNodeChildren(community, "participant").length,
443
+ creation: Number(community.attrs.creation || 0),
444
+ owner: community.attrs.creator
445
+ ? jidNormalizedUser(community.attrs.creator)
446
+ : undefined,
447
+ desc: desc,
448
+ descId: descId,
449
+ linkedParent:
450
+ getBinaryNodeChild(community, "linked_parent")?.attrs.jid || undefined,
451
+ restrict: !!getBinaryNodeChild(community, "locked"),
452
+ announce: !!getBinaryNodeChild(community, "announcement"),
453
+ isCommunity: !!getBinaryNodeChild(community, "parent"),
454
+ isCommunityAnnounce: !!getBinaryNodeChild(
455
+ community,
456
+ "default_sub_community",
457
+ ),
458
+ joinApprovalMode: !!getBinaryNodeChild(
459
+ community,
460
+ "membership_approval_mode",
461
+ ),
462
+ memberAddMode: memberAddMode,
463
+ participants: getBinaryNodeChildren(community, "participant").map(
464
+ ({ attrs }) => {
465
+ return {
466
+ // TODO: IMPLEMENT THE PN/LID FIELDS HERE!!
467
+ id: attrs.jid,
468
+ admin: attrs.type || null,
469
+ };
470
+ },
471
+ ),
472
+ ephemeralDuration: eph ? +eph : undefined,
473
+ addressingMode: getBinaryNodeChildString(community, "addressing_mode"),
474
+ };
475
+ return metadata;
476
+ };