backend-manager 5.0.131 → 5.0.132

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/CHANGELOG.md CHANGED
@@ -14,6 +14,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
14
14
  - `Fixed` for any bug fixes.
15
15
  - `Security` in case of vulnerabilities.
16
16
 
17
+ # [5.0.131] - 2026-03-11
18
+ ### Changed
19
+ - Analytics config restructured: consolidated `googleAnalytics`, `meta`, and `tiktok` under unified `analytics.providers` namespace with `google`, `meta`, and `tiktok` keys
20
+ - Google Analytics secret moved from config (`googleAnalytics.secret`) to env var (`GOOGLE_ANALYTICS_SECRET`)
21
+ - Meta pixel ID read from `analytics.providers.meta.id` instead of `meta.pixelId`
22
+ - TikTok pixel code read from `analytics.providers.tiktok.id` instead of `tiktok.pixelCode`
23
+ - Flattened `owner` field from `{ uid: string }` to plain UID string in feedback docs, notifications, and `getDocumentWithOwnerUser()` default path
24
+ - Moved `created` timestamp inside `metadata` object in feedback documents
25
+ - Added `GOOGLE_ANALYTICS_SECRET`, `META_ACCESS_TOKEN`, `TIKTOK_ACCESS_TOKEN` to `.env` template
26
+ - Bumped version to 5.0.131
27
+
17
28
  # [5.0.129] - 2026-03-11
18
29
  ### Added
19
30
  - Usage proxy system: `setUser()` to bill usage to a different user, `addMirror()`/`setMirrors()` to write usage to additional Firestore docs in parallel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "5.0.131",
3
+ "version": "5.0.132",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -590,37 +590,23 @@ function formatHistory(options, prompt, message, _log) {
590
590
  attachments: options.message.attachments,
591
591
  });
592
592
 
593
- // Trim all history content
594
- history.forEach((m) => {
595
- if (typeof m.content === 'string') {
596
- m.content = m.content.trim();
597
- }
598
- });
599
-
600
- // Format history
601
- history.map((m) => {
602
- const originalContent = m.content;
603
- const originalAttachments = m.attachments;
604
-
605
- // Set properties
606
- m.role = m.role || 'developer';
607
- m.content = formatMessageContent(originalContent, originalAttachments, _log, 'responses', m.role);
608
- m.attachments = [];
593
+ // Format history into new objects (avoid mutating originals which may be persisted by the caller)
594
+ const formatted = history.map((m) => {
595
+ const role = m.role || 'developer';
596
+ const content = typeof m.content === 'string' ? m.content.trim() : String(m.content || '');
597
+
598
+ const result = {
599
+ role: role,
600
+ content: formatMessageContent(content, m.attachments, _log, 'responses', role),
601
+ };
609
602
 
610
- // Delete any field except for role, content
611
- Object.keys(m).forEach((key) => {
612
- if (!['role', 'content'].includes(key)) {
613
- delete m[key];
614
- }
615
- });
616
- })
603
+ // Log
604
+ _log('Message', result.role, result.content);
617
605
 
618
- // Log message
619
- history.forEach((m) => {
620
- _log('Message', m.role, m.content);
606
+ return result;
621
607
  });
622
608
 
623
- return history;
609
+ return formatted;
624
610
  }
625
611
 
626
612
  function attemptRequest(options, self, prompt, message, user, moderation, attempt, assistant, resolve, reject, _log) {