backend-manager 5.9.4 → 5.9.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.
Files changed (251) hide show
  1. package/CLAUDE.md +6 -0
  2. package/package.json +8 -1
  3. package/src/cli/commands/install.js +4 -3
  4. package/src/cli/commands/setup-tests/backend-manager.js +2 -1
  5. package/src/cli/commands/setup-tests/firebase-admin.js +2 -1
  6. package/src/cli/commands/setup-tests/firebase-functions.js +2 -1
  7. package/src/cli/utils/safe-install.js +13 -0
  8. package/src/manager/routes/payments/cancel/post.js +22 -2
  9. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-11T03-28-07/metadata.json +14 -0
  10. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-11T03-28-07/newsletter.html +486 -0
  11. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-11T03-28-07/newsletter.md +41 -0
  12. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-11T03-28-07/newsletter.mjml +97 -0
  13. package/{test/email/fixtures/clean.json → src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-11T03-28-07/structure.json} +16 -4
  14. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-11T03-28-07/summary.md +1 -0
  15. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-00-28/metadata.json +14 -0
  16. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-00-28/newsletter.html +486 -0
  17. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-00-28/newsletter.md +41 -0
  18. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-00-28/newsletter.mjml +97 -0
  19. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-00-28/structure.json +42 -0
  20. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-00-28/summary.md +1 -0
  21. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-01-34/metadata.json +14 -0
  22. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-01-34/newsletter.html +486 -0
  23. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-01-34/newsletter.md +41 -0
  24. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-01-34/newsletter.mjml +97 -0
  25. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-01-34/structure.json +42 -0
  26. package/src/test/fixtures/firebase-project/.temp/newsletter/run-2026-06-18T01-01-34/summary.md +1 -0
  27. package/src/test/fixtures/firebase-project/.temp/test-mode.json +6 -0
  28. package/src/test/fixtures/firebase-project/database-debug.log +12 -0
  29. package/src/test/fixtures/firebase-project/firestore-debug.log +136 -0
  30. package/src/test/fixtures/firebase-project/pubsub-debug.log +17 -0
  31. package/src/test/test-accounts.js +9 -0
  32. package/.codeclimate.yml +0 -32
  33. package/.nvmrc +0 -1
  34. package/CHANGELOG.md +0 -1432
  35. package/PROGRESS.md +0 -86
  36. package/TODO-2.md +0 -121
  37. package/TODO-CHARGEBLAST.md +0 -32
  38. package/TODO-WEBHOOK-KEY-LEGACY-REMOVAL.md +0 -15
  39. package/TODO-WEBHOOK-KEY-UPGRADE.md +0 -138
  40. package/TODO-email-auth.md +0 -14
  41. package/TODO.md +0 -187
  42. package/plans/mcp2.md +0 -247
  43. package/scripts/test-helper-providers.js +0 -162
  44. package/scripts/update-disposable-domains.js +0 -44
  45. package/templates/_.env +0 -42
  46. package/templates/_.gitignore +0 -60
  47. package/templates/backend-manager-config.json +0 -249
  48. package/templates/database.rules.json +0 -83
  49. package/templates/firebase.json +0 -66
  50. package/templates/firestore.indexes.json +0 -4
  51. package/templates/firestore.rules +0 -112
  52. package/templates/public/404.html +0 -26
  53. package/templates/public/index.html +0 -24
  54. package/templates/remoteconfig.template.json +0 -1
  55. package/templates/storage-lifecycle-config-1-day.json +0 -9
  56. package/templates/storage-lifecycle-config-30-days.json +0 -9
  57. package/templates/storage.rules +0 -8
  58. package/test/_init/accounts-validation.js +0 -58
  59. package/test/_legacy/ai/index.js +0 -231
  60. package/test/_legacy/ai/test.jpg +0 -0
  61. package/test/_legacy/ai/test.pdf +0 -0
  62. package/test/_legacy/index.js +0 -31
  63. package/test/_legacy/payment-resolver/chargebee/orders/refunded.json +0 -0
  64. package/test/_legacy/payment-resolver/chargebee/orders/unpaid.json +0 -98
  65. package/test/_legacy/payment-resolver/chargebee/subscriptions/active.json +0 -578
  66. package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-in-trial.json +0 -38
  67. package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-skipped-to-active.json +0 -135
  68. package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-active-to-cancelled.json +0 -42
  69. package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-active.json +0 -44
  70. package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-cancelled.json +0 -39
  71. package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-refund.json +0 -143
  72. package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-suspended.json +0 -48
  73. package/test/_legacy/payment-resolver/coinbase/orders/regular.json +0 -204
  74. package/test/_legacy/payment-resolver/coinbase/subscriptions/cancelled.json +0 -204
  75. package/test/_legacy/payment-resolver/coinbase/subscriptions/paid-2.json +0 -125
  76. package/test/_legacy/payment-resolver/index.js +0 -1558
  77. package/test/_legacy/payment-resolver/paypal/orders/refunded.json +0 -0
  78. package/test/_legacy/payment-resolver/paypal/orders/regular.json +0 -120
  79. package/test/_legacy/payment-resolver/paypal/subscriptions/active-refund-previous-stmnt.json +0 -323
  80. package/test/_legacy/payment-resolver/paypal/subscriptions/active.json +0 -192
  81. package/test/_legacy/payment-resolver/paypal/subscriptions/trial-in-trial.json +0 -125
  82. package/test/_legacy/payment-resolver/paypal/subscriptions/trial-payment-not-complete.json +0 -76
  83. package/test/_legacy/payment-resolver/paypal/subscriptions/trial-payment-overdue-2.json +0 -114
  84. package/test/_legacy/payment-resolver/paypal/subscriptions/trial-payment-overdue.json +0 -114
  85. package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-active-to-cancelled.json +0 -111
  86. package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-active.json +0 -132
  87. package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-cancelled.json +0 -107
  88. package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-expired.json +0 -91
  89. package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-refund.json +0 -147
  90. package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-suspended.json +0 -120
  91. package/test/_legacy/payment-resolver/stripe/orders/refunded.json +0 -0
  92. package/test/_legacy/payment-resolver/stripe/orders/regular.json +0 -91
  93. package/test/_legacy/payment-resolver/stripe/subscriptions/active.json +0 -421
  94. package/test/_legacy/payment-resolver/stripe/subscriptions/trial-in-trial.json +0 -349
  95. package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-active-failed-authorization.json +0 -430
  96. package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-active.json +0 -319
  97. package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-cancelled.json +0 -319
  98. package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-refund.json +0 -414
  99. package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-suspended.json +0 -319
  100. package/test/_legacy/payment-resolver/stripe/subscriptions/unsure.json +0 -339
  101. package/test/_legacy/test-new +0 -1178
  102. package/test/_legacy/test.md +0 -89
  103. package/test/_legacy/usage.js +0 -175
  104. package/test/_legacy/user.js +0 -31
  105. package/test/ai/tools-live.js +0 -170
  106. package/test/boot/emulator-boots.js +0 -37
  107. package/test/content/blog-generate.js +0 -160
  108. package/test/email/campaign-send.js +0 -45
  109. package/test/email/consent-lifecycle.js +0 -257
  110. package/test/email/feedback-and-plain-send.js +0 -52
  111. package/test/email/fixtures/editorial.json +0 -30
  112. package/test/email/fixtures/field-report.json +0 -53
  113. package/test/email/marketing-lifecycle.js +0 -132
  114. package/test/email/newsletter-generate.js +0 -819
  115. package/test/email/newsletter-templates.js +0 -491
  116. package/test/email/templates.js +0 -207
  117. package/test/email/transactional-send.js +0 -34
  118. package/test/email/transactional.js +0 -560
  119. package/test/email/validation.js +0 -710
  120. package/test/events/auth-delete-race.js +0 -201
  121. package/test/events/payments/journey-payments-cancel-endpoint.js +0 -100
  122. package/test/events/payments/journey-payments-cancel.js +0 -182
  123. package/test/events/payments/journey-payments-discount.js +0 -89
  124. package/test/events/payments/journey-payments-failure.js +0 -146
  125. package/test/events/payments/journey-payments-legacy-product.js +0 -149
  126. package/test/events/payments/journey-payments-one-time-failure.js +0 -111
  127. package/test/events/payments/journey-payments-one-time.js +0 -136
  128. package/test/events/payments/journey-payments-plan-change.js +0 -144
  129. package/test/events/payments/journey-payments-refund-webhook.js +0 -180
  130. package/test/events/payments/journey-payments-suspend.js +0 -181
  131. package/test/events/payments/journey-payments-trial-cancel.js +0 -130
  132. package/test/events/payments/journey-payments-trial.js +0 -171
  133. package/test/events/payments/journey-payments-uid-resolution.js +0 -132
  134. package/test/events/payments/journey-payments-upgrade.js +0 -135
  135. package/test/fixtures/chargebee/invoice-one-time.json +0 -27
  136. package/test/fixtures/chargebee/subscription-active.json +0 -44
  137. package/test/fixtures/chargebee/subscription-cancelled.json +0 -42
  138. package/test/fixtures/chargebee/subscription-in-trial.json +0 -41
  139. package/test/fixtures/chargebee/subscription-legacy-plan.json +0 -41
  140. package/test/fixtures/chargebee/subscription-non-renewing.json +0 -41
  141. package/test/fixtures/chargebee/subscription-paused.json +0 -42
  142. package/test/fixtures/chargebee/webhook-payment-failed.json +0 -51
  143. package/test/fixtures/chargebee/webhook-subscription-created.json +0 -47
  144. package/test/fixtures/paypal/order-approved.json +0 -62
  145. package/test/fixtures/paypal/order-completed.json +0 -110
  146. package/test/fixtures/paypal/subscription-active.json +0 -76
  147. package/test/fixtures/paypal/subscription-cancelled.json +0 -50
  148. package/test/fixtures/paypal/subscription-suspended.json +0 -65
  149. package/test/fixtures/stripe/checkout-session-completed.json +0 -130
  150. package/test/fixtures/stripe/invoice-payment-failed.json +0 -148
  151. package/test/fixtures/stripe/invoice-subscription-payment-failed.json +0 -28
  152. package/test/fixtures/stripe/subscription-active.json +0 -161
  153. package/test/fixtures/stripe/subscription-canceled.json +0 -161
  154. package/test/fixtures/stripe/subscription-trialing.json +0 -161
  155. package/test/functions/admin/database-read.js +0 -134
  156. package/test/functions/admin/database-write.js +0 -159
  157. package/test/functions/admin/edit-post.js +0 -366
  158. package/test/functions/admin/firestore-query.js +0 -207
  159. package/test/functions/admin/firestore-read.js +0 -129
  160. package/test/functions/admin/firestore-write.js +0 -105
  161. package/test/functions/admin/get-stats.js +0 -115
  162. package/test/functions/admin/send-email.js +0 -119
  163. package/test/functions/admin/send-notification.js +0 -208
  164. package/test/functions/admin/write-repo-content.js +0 -223
  165. package/test/functions/general/add-marketing-contact.js +0 -335
  166. package/test/functions/general/fetch-post.js +0 -54
  167. package/test/functions/general/generate-uuid.js +0 -114
  168. package/test/functions/test/authenticate.js +0 -64
  169. package/test/functions/user/create-custom-token.js +0 -73
  170. package/test/functions/user/delete.js +0 -135
  171. package/test/functions/user/get-active-sessions.js +0 -111
  172. package/test/functions/user/get-subscription-info.js +0 -99
  173. package/test/functions/user/regenerate-api-keys.js +0 -156
  174. package/test/functions/user/resolve.js +0 -52
  175. package/test/functions/user/sign-out-all-sessions.js +0 -94
  176. package/test/functions/user/sign-up.js +0 -252
  177. package/test/functions/user/submit-feedback.js +0 -104
  178. package/test/functions/user/validate-settings.js +0 -82
  179. package/test/helpers/ai-request-payload.js +0 -300
  180. package/test/helpers/ai-test-provider.js +0 -202
  181. package/test/helpers/ai-tools-format.js +0 -383
  182. package/test/helpers/content/blog-auto-publisher.js +0 -484
  183. package/test/helpers/content/feed-parser.js +0 -528
  184. package/test/helpers/content/ghostii-blocks.js +0 -134
  185. package/test/helpers/content/ghostii-feed-integration.js +0 -404
  186. package/test/helpers/content/ghostii-write-article.js +0 -243
  187. package/test/helpers/environment.js +0 -230
  188. package/test/helpers/infer-contact.js +0 -113
  189. package/test/helpers/merge-line-files.js +0 -271
  190. package/test/helpers/payment/chargebee/parse-webhook.js +0 -413
  191. package/test/helpers/payment/chargebee/to-unified-one-time.js +0 -147
  192. package/test/helpers/payment/chargebee/to-unified-subscription.js +0 -648
  193. package/test/helpers/payment/paypal/parse-webhook.js +0 -539
  194. package/test/helpers/payment/paypal/to-unified-one-time.js +0 -382
  195. package/test/helpers/payment/paypal/to-unified-subscription.js +0 -820
  196. package/test/helpers/payment/stripe/parse-webhook.js +0 -447
  197. package/test/helpers/payment/stripe/to-unified-one-time.js +0 -306
  198. package/test/helpers/payment/stripe/to-unified-subscription.js +0 -708
  199. package/test/helpers/sanitize.js +0 -222
  200. package/test/helpers/slugify.js +0 -394
  201. package/test/helpers/storage.js +0 -194
  202. package/test/helpers/user.js +0 -755
  203. package/test/helpers/webhook-forward.js +0 -418
  204. package/test/mcp/discovery.js +0 -53
  205. package/test/mcp/oauth.js +0 -161
  206. package/test/mcp/protocol.js +0 -268
  207. package/test/mcp/roles.js +0 -188
  208. package/test/mcp/utils.js +0 -245
  209. package/test/routes/admin/create-post.js +0 -364
  210. package/test/routes/admin/database.js +0 -131
  211. package/test/routes/admin/deduplicate-image-alts.js +0 -190
  212. package/test/routes/admin/email.js +0 -114
  213. package/test/routes/admin/firestore-query.js +0 -204
  214. package/test/routes/admin/firestore.js +0 -127
  215. package/test/routes/admin/infer-contact.js +0 -218
  216. package/test/routes/admin/notification.js +0 -198
  217. package/test/routes/admin/post-resize-image.js +0 -184
  218. package/test/routes/admin/post.js +0 -368
  219. package/test/routes/admin/repo-content.js +0 -223
  220. package/test/routes/admin/stats.js +0 -112
  221. package/test/routes/content/post.js +0 -54
  222. package/test/routes/general/uuid.js +0 -115
  223. package/test/routes/marketing/campaign.js +0 -125
  224. package/test/routes/marketing/contact.js +0 -370
  225. package/test/routes/marketing/email-preferences.js +0 -292
  226. package/test/routes/marketing/push-send.js +0 -32
  227. package/test/routes/marketing/webhook-forward.js +0 -61
  228. package/test/routes/marketing/webhook.js +0 -639
  229. package/test/routes/payments/cancel.js +0 -140
  230. package/test/routes/payments/discount.js +0 -80
  231. package/test/routes/payments/dispute-alert.js +0 -320
  232. package/test/routes/payments/intent.js +0 -336
  233. package/test/routes/payments/portal.js +0 -92
  234. package/test/routes/payments/refund.js +0 -179
  235. package/test/routes/payments/trial-eligibility.js +0 -71
  236. package/test/routes/payments/webhook.js +0 -107
  237. package/test/routes/test/authenticate.js +0 -59
  238. package/test/routes/test/schema.js +0 -554
  239. package/test/routes/test/usage.js +0 -342
  240. package/test/routes/user/api-keys.js +0 -156
  241. package/test/routes/user/delete.js +0 -136
  242. package/test/routes/user/feedback.js +0 -104
  243. package/test/routes/user/sessions.js +0 -199
  244. package/test/routes/user/settings-validate.js +0 -82
  245. package/test/routes/user/signup.js +0 -542
  246. package/test/routes/user/subscription.js +0 -99
  247. package/test/routes/user/token.js +0 -73
  248. package/test/routes/user/user.js +0 -157
  249. package/test/rules/notifications.js +0 -410
  250. package/test/rules/payments-carts.js +0 -371
  251. package/test/rules/user.js +0 -396
@@ -1,249 +0,0 @@
1
- {
2
- parent: '', // 'self' = this BEM is the parent (newsletter-sources provider); a URL = external parent; '' = no parent
3
- brand: {
4
- id: 'my-app',
5
- name: 'My Brand',
6
- description: '',
7
- url: 'https://example.com',
8
- contact: {
9
- email: 'support@example.com',
10
- },
11
- // Physical postal address — required by CAN-SPAM in commercial email footers.
12
- // Rendered in the newsletter footer + transactional email footers.
13
- // Structured so the renderer can format it consistently across locales
14
- // and break onto multiple lines if needed. line2/region/postalCode are optional.
15
- address: {
16
- line1: '123 Main St',
17
- line2: 'Suite 100',
18
- city: 'City',
19
- region: 'ST',
20
- postalCode: '12345',
21
- country: 'United States',
22
- },
23
- images: {
24
- wordmark: 'https://example.com/wordmark.png',
25
- brandmark: 'https://example.com/wordmark.png',
26
- combomark: 'https://example.com/combomark.png',
27
- },
28
- },
29
- github: {
30
- user: 'username',
31
- repo_website: 'https://github.com/username/backend-manager',
32
- },
33
- parent: '', // URL of the parent BEM instance (e.g., 'https://api.itwcreativeworks.com') — used by newsletter generator to pull sources
34
- sentry: {
35
- dsn: 'https://d965557418748jd749d837asf00552f@o777489.ingest.sentry.io/8789941',
36
- },
37
- analytics: {
38
- providers: {
39
- google: {
40
- id: null,
41
- },
42
- meta: {
43
- id: null,
44
- },
45
- tiktok: {
46
- id: null,
47
- },
48
- },
49
- },
50
- oauth2: {},
51
- payment: {
52
- processors: {
53
- stripe: {
54
- publishableKey: null,
55
- },
56
- paypal: {
57
- clientId: null,
58
- },
59
- chargebee: {
60
- site: null,
61
- },
62
- coinbase: {
63
- enabled: false,
64
- },
65
- },
66
- products: [
67
- {
68
- id: 'basic',
69
- name: 'Basic',
70
- type: 'subscription',
71
- limits: {
72
- requests: 100,
73
- },
74
- },
75
- {
76
- id: 'premium',
77
- name: 'Premium',
78
- type: 'subscription',
79
- limits: {
80
- requests: 1000,
81
- },
82
- trial: {
83
- days: 14,
84
- },
85
- prices: {
86
- monthly: 4.99,
87
- annually: 49.99,
88
- },
89
- stripe: {
90
- productId: null,
91
- },
92
- paypal: {
93
- productId: null,
94
- },
95
- chargebee: {
96
- itemId: null,
97
- legacyPlanIds: [],
98
- },
99
- },
100
- {
101
- id: 'ultimate',
102
- name: 'Ultimate',
103
- type: 'subscription',
104
- limits: {
105
- requests: 10000,
106
- },
107
- prices: {
108
- monthly: 19.99,
109
- annually: 199.99,
110
- },
111
- stripe: {
112
- productId: null,
113
- },
114
- paypal: {
115
- productId: null,
116
- },
117
- chargebee: {
118
- itemId: null,
119
- legacyPlanIds: [],
120
- },
121
- },
122
- {
123
- id: 'credits-100',
124
- name: '100 Credits',
125
- type: 'one-time',
126
- prices: {
127
- once: 9.99,
128
- },
129
- stripe: {
130
- productId: null,
131
- },
132
- chargebee: {
133
- itemId: null,
134
- },
135
- },
136
- // Add more products/tiers here
137
- ],
138
- },
139
- marketing: {
140
- campaigns: {
141
- enabled: true,
142
- platform: 'sendgrid',
143
- listId: '', // SendGrid Marketing list UUID. Populated by OMEGA's sendgrid/ensure/list.js. Skips runtime list-discovery API call.
144
- },
145
- newsletter: {
146
- enabled: false,
147
- platform: 'beehiiv',
148
- publicationId: '', // Beehiiv publication ID (e.g., 'pub_xxxxx'). Populated by OMEGA's beehiiv/ensure/publication.js. Required for marketing sync to Beehiiv.
149
- // Content: single object or array (matches blog config shape). Generator uses the first entry.
150
- content: [
151
- {
152
- sources: ['$parent'], // '$parent' | '$feed:https://...' | '$brand'
153
- categories: [], // e.g., ['social-media', 'marketing'] — topic constraints + AI categorization
154
- links: [], // links to inject into generated content
155
- instructions: '', // free-form text passed to the AI
156
- tone: 'professional', // 'professional' | 'casual' | 'actionable' | 'witty' | etc.
157
- keywords: [], // SEO keywords to weave in
158
- template: 'clean', // 'clean' | 'editorial' | 'field-report' — layout template
159
- article: {
160
- enabled: false, // expand lead section into a full blog post via Ghostii
161
- author: null,
162
- },
163
- theme: {
164
- primaryColor: '#5B5BFF',
165
- secondaryColor: '#1E1E2A',
166
- accentColor: '#F6F7FB',
167
- font: 'Inter, system-ui, sans-serif',
168
- },
169
- sponsorships: [],
170
- },
171
- ],
172
- },
173
- prune: {
174
- enabled: true,
175
- },
176
- },
177
- firebaseConfig: {
178
- apiKey: '123-456',
179
- authDomain: 'PROJECT-ID.firebaseapp.com',
180
- projectId: 'PROJECT-ID',
181
- storageBucket: 'PROJECT-ID.appspot.com',
182
- messagingSenderId: '123',
183
- appId: '1:123:web:456',
184
- measurementId: 'G-0123456789',
185
- },
186
- // Standalone blog auto-publisher (daily cron). OPT-IN: disabled by default.
187
- // Set enabled: true and quantity >= 1 to auto-publish independent blog posts.
188
- // For newsletter-linked articles, use marketing.newsletter.content.article.enabled instead.
189
- //
190
- // `platform` selects the article-generation provider (only 'ghostii' for now).
191
- //
192
- // Source types:
193
- // '$brand' — generic brand-topic generation
194
- // '$feed:https://example.com/feed' — RSS/Atom/JSON feed: pick one unprocessed article per run
195
- // '$parent' — fetch sources from parent server's source pool (without claiming)
196
- // 'https://example.com/page' — fetch URL content as prompt seed
197
- // 'Write about topic X' — text: use directly as prompt seed
198
- //
199
- // All feed/parent sources are tracked in Firestore (`content-sources`) so the same
200
- // article is never reprocessed. When a feed is unreachable or exhausted, falls back to $brand.
201
- blog: {
202
- enabled: false,
203
- platform: 'ghostii',
204
- content: [
205
- {
206
- sources: [ // '$brand' | '$feed:https://...' | '$parent'
207
- '$brand',
208
- // '$feed:https://techcrunch.com/feed/',
209
- // '$parent',
210
- ],
211
- categories: [], // topic constraints + output tags
212
- links: [], // links to inject into generated content
213
- instructions: '', // free-form text passed to the AI
214
- tone: 'professional', // 'professional' | 'casual' | 'actionable' | 'witty' | etc.
215
- keywords: [], // SEO keywords to weave in
216
- quantity: 0, // number of articles to generate per run
217
- chance: 1.0,
218
- author: null,
219
- postPath: 'ghostii', // defaults to platform name; sub-folder under _posts/{year}/
220
- // Per-entry Ghostii API overrides (all optional, fall back to framework defaults)
221
- overrides: {
222
- // keywords: ['AI', 'technology'],
223
- // length: 'long', // short | medium | long | comprehensive
224
- // research: true, // web search for real external links
225
- // insertImages: true, // section images from Unsplash
226
- // headerImageUrl: 'unsplash', // disabled | unsplash | generate
227
- // maxLinks: 6,
228
- // sectionQuantity: 5,
229
- // feedUrl: '', // brand blog feed for title dedup
230
- },
231
- // brand: 'other-app-id', // Optional: target a different brand
232
- // brandUrl: 'https://api.otherapp.com', // Required if brand is set
233
- },
234
- ],
235
- },
236
- reviews: {
237
- enabled: true,
238
- sites: [
239
- 'trustpilot.com',
240
- ],
241
- },
242
- dataRequest: {
243
- // Additional queries to include in GDPR data exports
244
- // BEM always exports: users, auth record, data-requests, payments-intents, payments-orders
245
- // Single doc: { path: 'collection/{uid}', redact: ['field.to.redact'] }
246
- // Collection query: { collection: 'my-data', where: [['ownerField', '==', '{uid}']] }
247
- queries: [],
248
- },
249
- }
@@ -1,83 +0,0 @@
1
- {
2
- "rules": {
3
- ///---backend-manager---///
4
- ///---version=0.0.0---///
5
-
6
- // Sessions rules
7
- "sessions": {
8
- ".read": false,
9
- ".write": false,
10
- "$room": {
11
- ".read": "
12
- (auth.uid != null && query.equalTo == auth.uid)
13
- ",
14
- ".write": false,
15
- ".indexOn": ["uid"],
16
- "$id": {
17
- ".read": "
18
- // Allowed if user is authenticated AND is the owner of the doc
19
- (auth != null && auth.uid == data.child('uid').val())
20
- // Allowed if uid is equal to the doc id [LEGACY FOR SOMIIBO]
21
- || (auth != null && auth.uid == $id)
22
- // Allowed if user is not authenticated AND is the doc has no owner
23
- || (auth == null && (data.child('uid').val() == ''))
24
- ",
25
- ".write": "
26
- // Allowed if the user is authenticated AND is the owner of the existing doc
27
- (auth != null && auth.uid == data.child('uid').val())
28
- // Allowed if the user is authenticated AND is the owner of the new doc
29
- || (auth != null && auth.uid == newData.child('uid').val())
30
- // Allowed if the user is authenticated AND is the owner of the existing doc
31
- || (auth != null && auth.uid == data.child('uid').val())
32
- // Allowed if uid is equal to the doc id [LEGACY FOR SOMIIBO]
33
- || (auth != null && auth.uid == $id)
34
- // Allowed if the existing doc has no owner
35
- || (data.child('uid').val() == '')
36
- // Allowed if the new doc has no owner
37
- || (newData.child('uid').val() == '')
38
- // Allowed if it's a delete
39
- || (!newData.exists())
40
- ",
41
- }
42
- }
43
- },
44
- "gatherings": {
45
- ".read": false,
46
- ".write": false,
47
- "$room": {
48
- ".read": "
49
- (auth.uid != null && query.equalTo == auth.uid)
50
- ",
51
- ".write": false,
52
- ".indexOn": ["uid"],
53
- "$id": {
54
- ".read": "
55
- // Allowed if user is authenticated AND is the owner of the doc
56
- (auth != null && auth.uid == data.child('uid').val())
57
- // Allowed if uid is equal to the doc id [LEGACY FOR SOMIIBO]
58
- || (auth != null && auth.uid == $id)
59
- // Allowed if user is not authenticated AND is the doc has no owner
60
- || (auth == null && (data.child('uid').val() == ''))
61
- ",
62
- ".write": "
63
- // Allowed if the user is authenticated AND is the owner of the existing doc
64
- (auth != null && auth.uid == data.child('uid').val())
65
- // Allowed if the user is authenticated AND is the owner of the new doc
66
- || (auth != null && auth.uid == newData.child('uid').val())
67
- // Allowed if the user is authenticated AND is the owner of the existing doc
68
- || (auth != null && auth.uid == data.child('uid').val())
69
- // Allowed if uid is equal to the doc id [LEGACY FOR SOMIIBO]
70
- || (auth != null && auth.uid == $id)
71
- // Allowed if the existing doc has no owner
72
- || (data.child('uid').val() == '')
73
- // Allowed if the new doc has no owner
74
- || (newData.child('uid').val() == '')
75
- // Allowed if it's a delete
76
- || (!newData.exists())
77
- ",
78
- }
79
- }
80
- },
81
- ///---------end---------///
82
- }
83
- }
@@ -1,66 +0,0 @@
1
- {
2
- "hosting": {
3
- "public": "public",
4
- "ignore": [
5
- "firebase.json",
6
- "**/.*",
7
- "**/node_modules/**"
8
- ],
9
- "rewrites": [
10
- {
11
- "source": "{/backend-manager,/backend-manager/**,/mcp,/mcp/**,/.well-known/oauth-protected-resource,/.well-known/oauth-authorization-server,/authorize,/token,/register}",
12
- "function": "bm_api"
13
- }
14
- ]
15
- },
16
- "functions": [
17
- {
18
- "source": "functions",
19
- "codebase": "default",
20
- "ignore": [
21
- "node_modules",
22
- ".git",
23
- "firebase-debug.log",
24
- "firebase-debug.*.log"
25
- ]
26
- }
27
- ],
28
- "firestore": {
29
- "rules": "firestore.rules",
30
- "indexes": "firestore.indexes.json"
31
- },
32
- "database": {
33
- "rules": "database.rules.json"
34
- },
35
- "storage": {
36
- "rules": "storage.rules"
37
- },
38
- "emulators": {
39
- "auth": {
40
- "port": 9099
41
- },
42
- "functions": {
43
- "port": 5001
44
- },
45
- "firestore": {
46
- "port": 8080
47
- },
48
- "database": {
49
- "port": 9000
50
- },
51
- "hosting": {
52
- "port": 5002
53
- },
54
- "storage": {
55
- "port": 9199
56
- },
57
- "ui": {
58
- "enabled": true,
59
- "port": 4050
60
- },
61
- "pubsub": {
62
- "port": 8085
63
- },
64
- "singleProjectMode": true
65
- }
66
- }
@@ -1,4 +0,0 @@
1
- {
2
- "indexes": [],
3
- "fieldOverrides": []
4
- }
@@ -1,112 +0,0 @@
1
- rules_version = '2';
2
- service cloud.firestore {
3
- match /databases/{database}/documents {
4
- // Custom rules
5
- // ...
6
-
7
- ///---backend-manager---///
8
- ///---version=0.0.0---///
9
- // Lock by default
10
- match /{document=**} {
11
- allow read, write: if isAdmin();
12
- }
13
-
14
- // Protect user account data
15
- match /users/{uid} {
16
- allow read: if belongsTo(uid);
17
- allow write: if belongsTo(uid) && !isWritingProtectedUserField();
18
- }
19
-
20
- // Protect notification data
21
- match /notifications/{token} {
22
- allow read: if resource == null || existingData().token == token || belongsTo(existingData().owner);
23
- allow update: if existingData().token == token;
24
- allow create: if true;
25
- }
26
-
27
- // Protect abandoned cart data
28
- match /payments-carts/{uid} {
29
- allow create, update: if belongsTo(uid)
30
- && incomingData().owner == uid
31
- && incomingData().status == 'pending';
32
- allow read: if belongsTo(uid);
33
- }
34
-
35
- // Auth functions
36
- function authEmail() {
37
- return request.auth.token.email;
38
- }
39
- function authUid() {
40
- return request.auth.uid;
41
- }
42
- function isAuthenticated() {
43
- return request.auth != null;
44
- }
45
- function belongsTo(identity) {
46
- return isAuthenticated() && (authUid() == identity || authEmail() == identity);
47
- // eventually include a check for (existingData().owner == identity)...(in case its a doc owned by a user that's not actually user doc)
48
- }
49
-
50
- function getRoles() {
51
- return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.roles;
52
- }
53
- function getVerifications() {
54
- return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.verifications;
55
- }
56
- function isAdmin() {
57
- return getRoles().admin == true;
58
- }
59
- function emailVerified() {
60
- return getVerifications().email == true;
61
- }
62
-
63
- function isWritingProtectedUserField() {
64
- return isWritingField('auth')
65
- || isWritingField('roles')
66
- || isWritingField('flags')
67
- || isWritingField('plan') // TODO: REMOVE THIS WHEN ALL PROJECTS UPDATED
68
- || isWritingField('subscription')
69
- || isWritingField('affiliate')
70
- || isWritingField('api')
71
- || isWritingField('metadata')
72
- || isWritingField('usage')
73
- || isWritingField('consent');
74
- }
75
-
76
- function isCreatingField(field) {
77
- return !(field in resource.data) && field in request.resource.data;
78
- }
79
-
80
- function isUpdatingField(field) {
81
- return field in resource.data && field in request.resource.data && resource.data[field] != request.resource.data[field];
82
- }
83
-
84
- function isWritingField(field) {
85
- return isCreatingField(field) || isUpdatingField(field);
86
- }
87
-
88
- // function userEmail(userId) {
89
- // return get(/databases/$(database)/documents/users/$(userId)).data.email;
90
- // }
91
- // Helper functions
92
- // [READ] Data that exists on the Firestore document
93
- function existingData() {
94
- return resource.data;
95
- }
96
- // [WRITE] Data that is sent to a Firestore document
97
- function incomingData() {
98
- return request.resource.data;
99
- }
100
- ///--------tests--------///
101
- // match /test-cases/write/admin {
102
- // allow write: if isAdmin();
103
- // }
104
- ///------resources------///
105
- // https://fireship.io/snippets/firestore-rules-recipes/
106
- // https://github.com/jaysquared/atom-firestore-grammar
107
- // https://fireship.io/courses/firestore-data-modeling/models-roles/
108
- // https://firebase.google.com/docs/firestore/security/test-rules-emulator
109
- ///---------end---------///
110
-
111
- }
112
- }
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>404 Error Page</title>
8
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
9
- </head>
10
-
11
- <body>
12
- <div class="d-flex align-items-center justify-content-center vh-100">
13
- <div class="text-center">
14
- <h1 class="display-1 fw-bold">404</h1>
15
-
16
- <p class="fs-3"> <span class="text-danger">Opps!</span> Page not found.</p>
17
-
18
- <p class="lead">
19
- The page you're looking for doesn't exist.
20
- </p>
21
-
22
- <a href="{url}" class="btn btn-primary">Go Home</a>
23
- </div>
24
- </div>
25
- </body>
26
- </html>
@@ -1,24 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>404 Error Page</title>
8
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
9
- </head>
10
-
11
- <body>
12
- <div class="d-flex align-items-center justify-content-center vh-100">
13
- <div class="text-center">
14
- <h1 class="display-1 fw-bold">Welcome!</h1>
15
-
16
- <p class="lead">
17
- This is an internal page, please return to our main website
18
- </p>
19
-
20
- <a href="{url}" class="btn btn-primary">Go Home</a>
21
- </div>
22
- </div>
23
- </body>
24
- </html>
@@ -1 +0,0 @@
1
- {}
@@ -1,9 +0,0 @@
1
- {
2
- "rule":
3
- [
4
- {
5
- "action": {"type": "Delete"},
6
- "condition": {"age": 1}
7
- }
8
- ]
9
- }
@@ -1,9 +0,0 @@
1
- {
2
- "rule":
3
- [
4
- {
5
- "action": {"type": "Delete"},
6
- "condition": {"age": 30}
7
- }
8
- ]
9
- }
@@ -1,8 +0,0 @@
1
- rules_version = '2';
2
- service firebase.storage {
3
- match /b/{bucket}/o {
4
- match /{allPaths=**} {
5
- allow read, write: if request.auth!=null;
6
- }
7
- }
8
- }
@@ -1,58 +0,0 @@
1
- const { TEST_ACCOUNTS } = require('../../src/test/test-accounts.js');
2
-
3
- /**
4
- * Test: Account Structure Validation
5
- * Verifies that all test accounts were created with the expected User helper fields
6
- * This catches failures in auth:on-create before other tests run
7
- */
8
- module.exports = {
9
- description: 'Test accounts have required User structure',
10
- auth: 'none',
11
- timeout: 10000,
12
-
13
- async run({ accounts, assert, firestore }) {
14
- const accountIds = Object.keys(TEST_ACCOUNTS);
15
-
16
- for (const accountId of accountIds) {
17
- const account = accounts[accountId];
18
-
19
- // Check account was fetched
20
- assert.ok(account, `Account '${accountId}' should exist in accounts object`);
21
- assert.ok(account.uid, `Account '${accountId}' should have uid`);
22
-
23
- // Fetch full user doc from Firestore
24
- const userDoc = await firestore.get(`users/${account.uid}`);
25
-
26
- assert.ok(userDoc, `User doc for '${accountId}' should exist in Firestore`);
27
-
28
- // Validate auth fields (set by on-create)
29
- assert.hasProperty(userDoc, 'auth.uid', `Account '${accountId}' should have auth.uid`);
30
- assert.hasProperty(userDoc, 'auth.email', `Account '${accountId}' should have auth.email`);
31
-
32
- // Validate API fields (generated by on-create via User helper)
33
- assert.hasProperty(userDoc, 'api.clientId', `Account '${accountId}' should have api.clientId`);
34
- assert.hasProperty(userDoc, 'api.privateKey', `Account '${accountId}' should have api.privateKey`);
35
-
36
- // Validate privateKey was fetched correctly
37
- assert.ok(account.privateKey, `Account '${accountId}' privateKey should be fetched`);
38
- assert.equal(
39
- account.privateKey,
40
- userDoc.api.privateKey,
41
- `Account '${accountId}' fetched privateKey should match Firestore`
42
- );
43
-
44
- // Validate affiliate code (generated by on-create via User helper)
45
- assert.hasProperty(userDoc, 'affiliate.code', `Account '${accountId}' should have affiliate.code`);
46
-
47
- // Validate metadata.created (set by on-create via User helper)
48
- assert.hasProperty(userDoc, 'metadata.created.timestamp', `Account '${accountId}' should have metadata.created.timestamp`);
49
- assert.hasProperty(userDoc, 'metadata.created.timestampUNIX', `Account '${accountId}' should have metadata.created.timestampUNIX`);
50
-
51
- // Validate subscription fields (merged from test account properties)
52
- assert.hasProperty(userDoc, 'subscription.product.id', `Account '${accountId}' should have subscription.product.id`);
53
- assert.hasProperty(userDoc, 'subscription.status', `Account '${accountId}' should have subscription.status`);
54
- }
55
-
56
- return { success: true };
57
- },
58
- };