backend-manager 5.9.7 → 5.9.8
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/package.json +5 -3
- package/templates/_.env +42 -0
- package/templates/_.gitignore +60 -0
- package/templates/backend-manager-config.json +249 -0
- package/templates/database.rules.json +83 -0
- package/templates/firebase.json +66 -0
- package/templates/firestore.indexes.json +4 -0
- package/templates/firestore.rules +112 -0
- package/templates/public/404.html +26 -0
- package/templates/public/index.html +24 -0
- package/templates/remoteconfig.template.json +1 -0
- package/templates/storage-lifecycle-config-1-day.json +9 -0
- package/templates/storage-lifecycle-config-30-days.json +9 -0
- package/templates/storage.rules +8 -0
- package/test/_init/accounts-validation.js +58 -0
- package/test/_legacy/ai/index.js +231 -0
- package/test/_legacy/ai/test.jpg +0 -0
- package/test/_legacy/ai/test.pdf +0 -0
- package/test/_legacy/index.js +31 -0
- package/test/_legacy/payment-resolver/chargebee/orders/refunded.json +0 -0
- package/test/_legacy/payment-resolver/chargebee/orders/unpaid.json +98 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/active.json +578 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-in-trial.json +38 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-skipped-to-active.json +135 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-active-to-cancelled.json +42 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-active.json +44 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-cancelled.json +39 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-refund.json +143 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-suspended.json +48 -0
- package/test/_legacy/payment-resolver/coinbase/orders/regular.json +204 -0
- package/test/_legacy/payment-resolver/coinbase/subscriptions/cancelled.json +204 -0
- package/test/_legacy/payment-resolver/coinbase/subscriptions/paid-2.json +125 -0
- package/test/_legacy/payment-resolver/index.js +1558 -0
- package/test/_legacy/payment-resolver/paypal/orders/refunded.json +0 -0
- package/test/_legacy/payment-resolver/paypal/orders/regular.json +120 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/active-refund-previous-stmnt.json +323 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/active.json +192 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-in-trial.json +125 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-payment-not-complete.json +76 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-payment-overdue-2.json +114 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-payment-overdue.json +114 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-active-to-cancelled.json +111 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-active.json +132 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-cancelled.json +107 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-expired.json +91 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-refund.json +147 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-suspended.json +120 -0
- package/test/_legacy/payment-resolver/stripe/orders/refunded.json +0 -0
- package/test/_legacy/payment-resolver/stripe/orders/regular.json +91 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/active.json +421 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-in-trial.json +349 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-active-failed-authorization.json +430 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-active.json +319 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-cancelled.json +319 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-refund.json +414 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-suspended.json +319 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/unsure.json +339 -0
- package/test/_legacy/test-new +1178 -0
- package/test/_legacy/test.md +89 -0
- package/test/_legacy/usage.js +175 -0
- package/test/_legacy/user.js +31 -0
- package/test/ai/tools-live.js +170 -0
- package/test/boot/emulator-boots.js +37 -0
- package/test/content/blog-generate.js +160 -0
- package/test/email/campaign-send.js +45 -0
- package/test/email/consent-lifecycle.js +257 -0
- package/test/email/feedback-and-plain-send.js +52 -0
- package/test/email/fixtures/clean.json +30 -0
- package/test/email/fixtures/editorial.json +30 -0
- package/test/email/fixtures/field-report.json +53 -0
- package/test/email/marketing-lifecycle.js +132 -0
- package/test/email/newsletter-generate.js +819 -0
- package/test/email/newsletter-templates.js +491 -0
- package/test/email/templates.js +207 -0
- package/test/email/transactional-send.js +34 -0
- package/test/email/transactional.js +560 -0
- package/test/email/validation.js +710 -0
- package/test/events/auth-delete-race.js +201 -0
- package/test/events/payments/journey-payments-cancel-endpoint.js +100 -0
- package/test/events/payments/journey-payments-cancel.js +182 -0
- package/test/events/payments/journey-payments-discount.js +89 -0
- package/test/events/payments/journey-payments-failure.js +146 -0
- package/test/events/payments/journey-payments-legacy-product.js +149 -0
- package/test/events/payments/journey-payments-one-time-failure.js +111 -0
- package/test/events/payments/journey-payments-one-time.js +136 -0
- package/test/events/payments/journey-payments-plan-change.js +144 -0
- package/test/events/payments/journey-payments-refund-webhook.js +180 -0
- package/test/events/payments/journey-payments-suspend.js +181 -0
- package/test/events/payments/journey-payments-trial-cancel.js +130 -0
- package/test/events/payments/journey-payments-trial.js +171 -0
- package/test/events/payments/journey-payments-uid-resolution.js +132 -0
- package/test/events/payments/journey-payments-upgrade.js +135 -0
- package/test/fixtures/chargebee/invoice-one-time.json +27 -0
- package/test/fixtures/chargebee/subscription-active.json +44 -0
- package/test/fixtures/chargebee/subscription-cancelled.json +42 -0
- package/test/fixtures/chargebee/subscription-in-trial.json +41 -0
- package/test/fixtures/chargebee/subscription-legacy-plan.json +41 -0
- package/test/fixtures/chargebee/subscription-non-renewing.json +41 -0
- package/test/fixtures/chargebee/subscription-paused.json +42 -0
- package/test/fixtures/chargebee/webhook-payment-failed.json +51 -0
- package/test/fixtures/chargebee/webhook-subscription-created.json +47 -0
- package/test/fixtures/paypal/order-approved.json +62 -0
- package/test/fixtures/paypal/order-completed.json +110 -0
- package/test/fixtures/paypal/subscription-active.json +76 -0
- package/test/fixtures/paypal/subscription-cancelled.json +50 -0
- package/test/fixtures/paypal/subscription-suspended.json +65 -0
- package/test/fixtures/stripe/checkout-session-completed.json +130 -0
- package/test/fixtures/stripe/invoice-payment-failed.json +148 -0
- package/test/fixtures/stripe/invoice-subscription-payment-failed.json +28 -0
- package/test/fixtures/stripe/subscription-active.json +161 -0
- package/test/fixtures/stripe/subscription-canceled.json +161 -0
- package/test/fixtures/stripe/subscription-trialing.json +161 -0
- package/test/functions/admin/database-read.js +134 -0
- package/test/functions/admin/database-write.js +159 -0
- package/test/functions/admin/edit-post.js +366 -0
- package/test/functions/admin/firestore-query.js +207 -0
- package/test/functions/admin/firestore-read.js +129 -0
- package/test/functions/admin/firestore-write.js +105 -0
- package/test/functions/admin/get-stats.js +115 -0
- package/test/functions/admin/send-email.js +119 -0
- package/test/functions/admin/send-notification.js +208 -0
- package/test/functions/admin/write-repo-content.js +223 -0
- package/test/functions/general/add-marketing-contact.js +335 -0
- package/test/functions/general/fetch-post.js +54 -0
- package/test/functions/general/generate-uuid.js +114 -0
- package/test/functions/test/authenticate.js +64 -0
- package/test/functions/user/create-custom-token.js +73 -0
- package/test/functions/user/delete.js +135 -0
- package/test/functions/user/get-active-sessions.js +111 -0
- package/test/functions/user/get-subscription-info.js +99 -0
- package/test/functions/user/regenerate-api-keys.js +156 -0
- package/test/functions/user/resolve.js +52 -0
- package/test/functions/user/sign-out-all-sessions.js +94 -0
- package/test/functions/user/sign-up.js +252 -0
- package/test/functions/user/submit-feedback.js +104 -0
- package/test/functions/user/validate-settings.js +82 -0
- package/test/helpers/ai-request-payload.js +300 -0
- package/test/helpers/ai-test-provider.js +202 -0
- package/test/helpers/ai-tools-format.js +383 -0
- package/test/helpers/content/blog-auto-publisher.js +484 -0
- package/test/helpers/content/feed-parser.js +528 -0
- package/test/helpers/content/ghostii-blocks.js +134 -0
- package/test/helpers/content/ghostii-feed-integration.js +404 -0
- package/test/helpers/content/ghostii-write-article.js +243 -0
- package/test/helpers/environment.js +230 -0
- package/test/helpers/infer-contact.js +113 -0
- package/test/helpers/merge-line-files.js +271 -0
- package/test/helpers/payment/chargebee/parse-webhook.js +413 -0
- package/test/helpers/payment/chargebee/to-unified-one-time.js +147 -0
- package/test/helpers/payment/chargebee/to-unified-subscription.js +648 -0
- package/test/helpers/payment/paypal/parse-webhook.js +539 -0
- package/test/helpers/payment/paypal/to-unified-one-time.js +382 -0
- package/test/helpers/payment/paypal/to-unified-subscription.js +820 -0
- package/test/helpers/payment/stripe/parse-webhook.js +447 -0
- package/test/helpers/payment/stripe/to-unified-one-time.js +306 -0
- package/test/helpers/payment/stripe/to-unified-subscription.js +708 -0
- package/test/helpers/sanitize.js +222 -0
- package/test/helpers/slugify.js +394 -0
- package/test/helpers/storage.js +194 -0
- package/test/helpers/user.js +755 -0
- package/test/helpers/webhook-forward.js +418 -0
- package/test/mcp/discovery.js +53 -0
- package/test/mcp/oauth.js +161 -0
- package/test/mcp/protocol.js +268 -0
- package/test/mcp/roles.js +188 -0
- package/test/mcp/utils.js +245 -0
- package/test/routes/admin/create-post.js +364 -0
- package/test/routes/admin/database.js +131 -0
- package/test/routes/admin/deduplicate-image-alts.js +190 -0
- package/test/routes/admin/email.js +114 -0
- package/test/routes/admin/firestore-query.js +204 -0
- package/test/routes/admin/firestore.js +127 -0
- package/test/routes/admin/infer-contact.js +218 -0
- package/test/routes/admin/notification.js +198 -0
- package/test/routes/admin/post-resize-image.js +184 -0
- package/test/routes/admin/post.js +368 -0
- package/test/routes/admin/repo-content.js +223 -0
- package/test/routes/admin/stats.js +112 -0
- package/test/routes/content/post.js +54 -0
- package/test/routes/general/uuid.js +115 -0
- package/test/routes/marketing/campaign.js +125 -0
- package/test/routes/marketing/contact.js +370 -0
- package/test/routes/marketing/email-preferences.js +292 -0
- package/test/routes/marketing/push-send.js +32 -0
- package/test/routes/marketing/webhook-forward.js +61 -0
- package/test/routes/marketing/webhook.js +639 -0
- package/test/routes/payments/cancel.js +163 -0
- package/test/routes/payments/discount.js +80 -0
- package/test/routes/payments/dispute-alert.js +320 -0
- package/test/routes/payments/intent.js +336 -0
- package/test/routes/payments/portal.js +92 -0
- package/test/routes/payments/refund.js +179 -0
- package/test/routes/payments/trial-eligibility.js +71 -0
- package/test/routes/payments/webhook.js +107 -0
- package/test/routes/test/authenticate.js +59 -0
- package/test/routes/test/schema.js +554 -0
- package/test/routes/test/usage.js +342 -0
- package/test/routes/user/api-keys.js +156 -0
- package/test/routes/user/delete.js +136 -0
- package/test/routes/user/feedback.js +104 -0
- package/test/routes/user/sessions.js +199 -0
- package/test/routes/user/settings-validate.js +82 -0
- package/test/routes/user/signup.js +542 -0
- package/test/routes/user/subscription.js +99 -0
- package/test/routes/user/token.js +73 -0
- package/test/routes/user/user.js +157 -0
- package/test/rules/notifications.js +410 -0
- package/test/rules/payments-carts.js +371 -0
- package/test/rules/user.js +396 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "sub_1T2SriDEGraYraOkoRJpFdul",
|
|
3
|
+
"object": "subscription",
|
|
4
|
+
"application": null,
|
|
5
|
+
"application_fee_percent": null,
|
|
6
|
+
"automatic_tax": {
|
|
7
|
+
"disabled_reason": null,
|
|
8
|
+
"enabled": false,
|
|
9
|
+
"liability": null
|
|
10
|
+
},
|
|
11
|
+
"billing_cycle_anchor": 1771490742,
|
|
12
|
+
"billing_cycle_anchor_config": null,
|
|
13
|
+
"billing_mode": {
|
|
14
|
+
"flexible": null,
|
|
15
|
+
"type": "classic"
|
|
16
|
+
},
|
|
17
|
+
"billing_thresholds": null,
|
|
18
|
+
"cancel_at": null,
|
|
19
|
+
"cancel_at_period_end": false,
|
|
20
|
+
"canceled_at": null,
|
|
21
|
+
"cancellation_details": {
|
|
22
|
+
"comment": null,
|
|
23
|
+
"feedback": null,
|
|
24
|
+
"reason": null
|
|
25
|
+
},
|
|
26
|
+
"collection_method": "charge_automatically",
|
|
27
|
+
"created": 1771490742,
|
|
28
|
+
"currency": "usd",
|
|
29
|
+
"customer": "cus_U0Tp5P43C5XJ1q",
|
|
30
|
+
"customer_account": null,
|
|
31
|
+
"days_until_due": null,
|
|
32
|
+
"default_payment_method": null,
|
|
33
|
+
"default_source": null,
|
|
34
|
+
"default_tax_rates": [],
|
|
35
|
+
"description": null,
|
|
36
|
+
"discounts": [],
|
|
37
|
+
"ended_at": null,
|
|
38
|
+
"invoice_settings": {
|
|
39
|
+
"account_tax_ids": null,
|
|
40
|
+
"issuer": {
|
|
41
|
+
"type": "self"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"items": {
|
|
45
|
+
"object": "list",
|
|
46
|
+
"data": [
|
|
47
|
+
{
|
|
48
|
+
"id": "si_U0TpmSSOvC7Xjx",
|
|
49
|
+
"object": "subscription_item",
|
|
50
|
+
"billing_thresholds": null,
|
|
51
|
+
"created": 1771490742,
|
|
52
|
+
"current_period_end": 1773909942,
|
|
53
|
+
"current_period_start": 1771490742,
|
|
54
|
+
"discounts": [],
|
|
55
|
+
"metadata": {},
|
|
56
|
+
"plan": {
|
|
57
|
+
"id": "price_1T2SrhDEGraYraOkV8ulwdCq",
|
|
58
|
+
"object": "plan",
|
|
59
|
+
"active": true,
|
|
60
|
+
"amount": 1500,
|
|
61
|
+
"amount_decimal": "1500",
|
|
62
|
+
"billing_scheme": "per_unit",
|
|
63
|
+
"created": 1771490741,
|
|
64
|
+
"currency": "usd",
|
|
65
|
+
"interval": "month",
|
|
66
|
+
"interval_count": 1,
|
|
67
|
+
"livemode": false,
|
|
68
|
+
"metadata": {},
|
|
69
|
+
"meter": null,
|
|
70
|
+
"nickname": null,
|
|
71
|
+
"product": "prod_U0TpXqHUuM0N5l",
|
|
72
|
+
"tiers_mode": null,
|
|
73
|
+
"transform_usage": null,
|
|
74
|
+
"trial_period_days": null,
|
|
75
|
+
"usage_type": "licensed"
|
|
76
|
+
},
|
|
77
|
+
"price": {
|
|
78
|
+
"id": "price_1T2SrhDEGraYraOkV8ulwdCq",
|
|
79
|
+
"object": "price",
|
|
80
|
+
"active": true,
|
|
81
|
+
"billing_scheme": "per_unit",
|
|
82
|
+
"created": 1771490741,
|
|
83
|
+
"currency": "usd",
|
|
84
|
+
"custom_unit_amount": null,
|
|
85
|
+
"livemode": false,
|
|
86
|
+
"lookup_key": null,
|
|
87
|
+
"metadata": {},
|
|
88
|
+
"nickname": null,
|
|
89
|
+
"product": "prod_U0TpXqHUuM0N5l",
|
|
90
|
+
"recurring": {
|
|
91
|
+
"interval": "month",
|
|
92
|
+
"interval_count": 1,
|
|
93
|
+
"meter": null,
|
|
94
|
+
"trial_period_days": null,
|
|
95
|
+
"usage_type": "licensed"
|
|
96
|
+
},
|
|
97
|
+
"tax_behavior": "unspecified",
|
|
98
|
+
"tiers_mode": null,
|
|
99
|
+
"transform_quantity": null,
|
|
100
|
+
"type": "recurring",
|
|
101
|
+
"unit_amount": 1500,
|
|
102
|
+
"unit_amount_decimal": "1500"
|
|
103
|
+
},
|
|
104
|
+
"quantity": 1,
|
|
105
|
+
"subscription": "sub_1T2SriDEGraYraOkoRJpFdul",
|
|
106
|
+
"tax_rates": []
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"has_more": false,
|
|
110
|
+
"total_count": 1,
|
|
111
|
+
"url": "/v1/subscription_items?subscription=sub_1T2SriDEGraYraOkoRJpFdul"
|
|
112
|
+
},
|
|
113
|
+
"latest_invoice": "in_1T2SriDEGraYraOkYBRwklYt",
|
|
114
|
+
"livemode": false,
|
|
115
|
+
"metadata": {},
|
|
116
|
+
"next_pending_invoice_item_invoice": null,
|
|
117
|
+
"on_behalf_of": null,
|
|
118
|
+
"pause_collection": null,
|
|
119
|
+
"payment_settings": {
|
|
120
|
+
"payment_method_options": null,
|
|
121
|
+
"payment_method_types": null,
|
|
122
|
+
"save_default_payment_method": "off"
|
|
123
|
+
},
|
|
124
|
+
"pending_invoice_item_interval": null,
|
|
125
|
+
"pending_setup_intent": null,
|
|
126
|
+
"pending_update": null,
|
|
127
|
+
"plan": {
|
|
128
|
+
"id": "price_1T2SrhDEGraYraOkV8ulwdCq",
|
|
129
|
+
"object": "plan",
|
|
130
|
+
"active": true,
|
|
131
|
+
"amount": 1500,
|
|
132
|
+
"amount_decimal": "1500",
|
|
133
|
+
"billing_scheme": "per_unit",
|
|
134
|
+
"created": 1771490741,
|
|
135
|
+
"currency": "usd",
|
|
136
|
+
"interval": "month",
|
|
137
|
+
"interval_count": 1,
|
|
138
|
+
"livemode": false,
|
|
139
|
+
"metadata": {},
|
|
140
|
+
"meter": null,
|
|
141
|
+
"nickname": null,
|
|
142
|
+
"product": "prod_U0TpXqHUuM0N5l",
|
|
143
|
+
"tiers_mode": null,
|
|
144
|
+
"transform_usage": null,
|
|
145
|
+
"trial_period_days": null,
|
|
146
|
+
"usage_type": "licensed"
|
|
147
|
+
},
|
|
148
|
+
"quantity": 1,
|
|
149
|
+
"schedule": null,
|
|
150
|
+
"start_date": 1771490742,
|
|
151
|
+
"status": "active",
|
|
152
|
+
"test_clock": null,
|
|
153
|
+
"transfer_data": null,
|
|
154
|
+
"trial_end": null,
|
|
155
|
+
"trial_settings": {
|
|
156
|
+
"end_behavior": {
|
|
157
|
+
"missing_payment_method": "create_invoice"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"trial_start": null
|
|
161
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "sub_1T2SsEDEGraYraOk6QdGfzvj",
|
|
3
|
+
"object": "subscription",
|
|
4
|
+
"application": null,
|
|
5
|
+
"application_fee_percent": null,
|
|
6
|
+
"automatic_tax": {
|
|
7
|
+
"disabled_reason": null,
|
|
8
|
+
"enabled": false,
|
|
9
|
+
"liability": null
|
|
10
|
+
},
|
|
11
|
+
"billing_cycle_anchor": 1771490774,
|
|
12
|
+
"billing_cycle_anchor_config": null,
|
|
13
|
+
"billing_mode": {
|
|
14
|
+
"flexible": null,
|
|
15
|
+
"type": "classic"
|
|
16
|
+
},
|
|
17
|
+
"billing_thresholds": null,
|
|
18
|
+
"cancel_at": null,
|
|
19
|
+
"cancel_at_period_end": false,
|
|
20
|
+
"canceled_at": 1771490778,
|
|
21
|
+
"cancellation_details": {
|
|
22
|
+
"comment": null,
|
|
23
|
+
"feedback": null,
|
|
24
|
+
"reason": "cancellation_requested"
|
|
25
|
+
},
|
|
26
|
+
"collection_method": "charge_automatically",
|
|
27
|
+
"created": 1771490774,
|
|
28
|
+
"currency": "usd",
|
|
29
|
+
"customer": "cus_U0TpvrT6VjrQQC",
|
|
30
|
+
"customer_account": null,
|
|
31
|
+
"days_until_due": null,
|
|
32
|
+
"default_payment_method": null,
|
|
33
|
+
"default_source": null,
|
|
34
|
+
"default_tax_rates": [],
|
|
35
|
+
"description": null,
|
|
36
|
+
"discounts": [],
|
|
37
|
+
"ended_at": 1771490778,
|
|
38
|
+
"invoice_settings": {
|
|
39
|
+
"account_tax_ids": null,
|
|
40
|
+
"issuer": {
|
|
41
|
+
"type": "self"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"items": {
|
|
45
|
+
"object": "list",
|
|
46
|
+
"data": [
|
|
47
|
+
{
|
|
48
|
+
"id": "si_U0TpJN0D7TmMxw",
|
|
49
|
+
"object": "subscription_item",
|
|
50
|
+
"billing_thresholds": null,
|
|
51
|
+
"created": 1771490774,
|
|
52
|
+
"current_period_end": 1773909974,
|
|
53
|
+
"current_period_start": 1771490774,
|
|
54
|
+
"discounts": [],
|
|
55
|
+
"metadata": {},
|
|
56
|
+
"plan": {
|
|
57
|
+
"id": "price_1T2SsEDEGraYraOkUDA5v4xo",
|
|
58
|
+
"object": "plan",
|
|
59
|
+
"active": true,
|
|
60
|
+
"amount": 1500,
|
|
61
|
+
"amount_decimal": "1500",
|
|
62
|
+
"billing_scheme": "per_unit",
|
|
63
|
+
"created": 1771490774,
|
|
64
|
+
"currency": "usd",
|
|
65
|
+
"interval": "month",
|
|
66
|
+
"interval_count": 1,
|
|
67
|
+
"livemode": false,
|
|
68
|
+
"metadata": {},
|
|
69
|
+
"meter": null,
|
|
70
|
+
"nickname": null,
|
|
71
|
+
"product": "prod_U0TpeTyFoNvPuf",
|
|
72
|
+
"tiers_mode": null,
|
|
73
|
+
"transform_usage": null,
|
|
74
|
+
"trial_period_days": null,
|
|
75
|
+
"usage_type": "licensed"
|
|
76
|
+
},
|
|
77
|
+
"price": {
|
|
78
|
+
"id": "price_1T2SsEDEGraYraOkUDA5v4xo",
|
|
79
|
+
"object": "price",
|
|
80
|
+
"active": true,
|
|
81
|
+
"billing_scheme": "per_unit",
|
|
82
|
+
"created": 1771490774,
|
|
83
|
+
"currency": "usd",
|
|
84
|
+
"custom_unit_amount": null,
|
|
85
|
+
"livemode": false,
|
|
86
|
+
"lookup_key": null,
|
|
87
|
+
"metadata": {},
|
|
88
|
+
"nickname": null,
|
|
89
|
+
"product": "prod_U0TpeTyFoNvPuf",
|
|
90
|
+
"recurring": {
|
|
91
|
+
"interval": "month",
|
|
92
|
+
"interval_count": 1,
|
|
93
|
+
"meter": null,
|
|
94
|
+
"trial_period_days": null,
|
|
95
|
+
"usage_type": "licensed"
|
|
96
|
+
},
|
|
97
|
+
"tax_behavior": "unspecified",
|
|
98
|
+
"tiers_mode": null,
|
|
99
|
+
"transform_quantity": null,
|
|
100
|
+
"type": "recurring",
|
|
101
|
+
"unit_amount": 1500,
|
|
102
|
+
"unit_amount_decimal": "1500"
|
|
103
|
+
},
|
|
104
|
+
"quantity": 1,
|
|
105
|
+
"subscription": "sub_1T2SsEDEGraYraOk6QdGfzvj",
|
|
106
|
+
"tax_rates": []
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"has_more": false,
|
|
110
|
+
"total_count": 1,
|
|
111
|
+
"url": "/v1/subscription_items?subscription=sub_1T2SsEDEGraYraOk6QdGfzvj"
|
|
112
|
+
},
|
|
113
|
+
"latest_invoice": "in_1T2SsEDEGraYraOkXXfDCnRe",
|
|
114
|
+
"livemode": false,
|
|
115
|
+
"metadata": {},
|
|
116
|
+
"next_pending_invoice_item_invoice": null,
|
|
117
|
+
"on_behalf_of": null,
|
|
118
|
+
"pause_collection": null,
|
|
119
|
+
"payment_settings": {
|
|
120
|
+
"payment_method_options": null,
|
|
121
|
+
"payment_method_types": null,
|
|
122
|
+
"save_default_payment_method": "off"
|
|
123
|
+
},
|
|
124
|
+
"pending_invoice_item_interval": null,
|
|
125
|
+
"pending_setup_intent": null,
|
|
126
|
+
"pending_update": null,
|
|
127
|
+
"plan": {
|
|
128
|
+
"id": "price_1T2SsEDEGraYraOkUDA5v4xo",
|
|
129
|
+
"object": "plan",
|
|
130
|
+
"active": true,
|
|
131
|
+
"amount": 1500,
|
|
132
|
+
"amount_decimal": "1500",
|
|
133
|
+
"billing_scheme": "per_unit",
|
|
134
|
+
"created": 1771490774,
|
|
135
|
+
"currency": "usd",
|
|
136
|
+
"interval": "month",
|
|
137
|
+
"interval_count": 1,
|
|
138
|
+
"livemode": false,
|
|
139
|
+
"metadata": {},
|
|
140
|
+
"meter": null,
|
|
141
|
+
"nickname": null,
|
|
142
|
+
"product": "prod_U0TpeTyFoNvPuf",
|
|
143
|
+
"tiers_mode": null,
|
|
144
|
+
"transform_usage": null,
|
|
145
|
+
"trial_period_days": null,
|
|
146
|
+
"usage_type": "licensed"
|
|
147
|
+
},
|
|
148
|
+
"quantity": 1,
|
|
149
|
+
"schedule": null,
|
|
150
|
+
"start_date": 1771490774,
|
|
151
|
+
"status": "canceled",
|
|
152
|
+
"test_clock": null,
|
|
153
|
+
"transfer_data": null,
|
|
154
|
+
"trial_end": null,
|
|
155
|
+
"trial_settings": {
|
|
156
|
+
"end_behavior": {
|
|
157
|
+
"missing_payment_method": "create_invoice"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"trial_start": null
|
|
161
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "sub_1T2Sv0DEGraYraOkYSU3tfYm",
|
|
3
|
+
"object": "subscription",
|
|
4
|
+
"application": null,
|
|
5
|
+
"application_fee_percent": null,
|
|
6
|
+
"automatic_tax": {
|
|
7
|
+
"disabled_reason": null,
|
|
8
|
+
"enabled": false,
|
|
9
|
+
"liability": null
|
|
10
|
+
},
|
|
11
|
+
"billing_cycle_anchor": 1771577346,
|
|
12
|
+
"billing_cycle_anchor_config": null,
|
|
13
|
+
"billing_mode": {
|
|
14
|
+
"flexible": null,
|
|
15
|
+
"type": "classic"
|
|
16
|
+
},
|
|
17
|
+
"billing_thresholds": null,
|
|
18
|
+
"cancel_at": null,
|
|
19
|
+
"cancel_at_period_end": false,
|
|
20
|
+
"canceled_at": null,
|
|
21
|
+
"cancellation_details": {
|
|
22
|
+
"comment": null,
|
|
23
|
+
"feedback": null,
|
|
24
|
+
"reason": null
|
|
25
|
+
},
|
|
26
|
+
"collection_method": "charge_automatically",
|
|
27
|
+
"created": 1771490946,
|
|
28
|
+
"currency": "usd",
|
|
29
|
+
"customer": "cus_U0Ts6oZ7oPlNan",
|
|
30
|
+
"customer_account": null,
|
|
31
|
+
"days_until_due": null,
|
|
32
|
+
"default_payment_method": null,
|
|
33
|
+
"default_source": null,
|
|
34
|
+
"default_tax_rates": [],
|
|
35
|
+
"description": null,
|
|
36
|
+
"discounts": [],
|
|
37
|
+
"ended_at": null,
|
|
38
|
+
"invoice_settings": {
|
|
39
|
+
"account_tax_ids": null,
|
|
40
|
+
"issuer": {
|
|
41
|
+
"type": "self"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"items": {
|
|
45
|
+
"object": "list",
|
|
46
|
+
"data": [
|
|
47
|
+
{
|
|
48
|
+
"id": "si_U0Tsz1kj4mzWg5",
|
|
49
|
+
"object": "subscription_item",
|
|
50
|
+
"billing_thresholds": null,
|
|
51
|
+
"created": 1771490946,
|
|
52
|
+
"current_period_end": 1771577346,
|
|
53
|
+
"current_period_start": 1771490946,
|
|
54
|
+
"discounts": [],
|
|
55
|
+
"metadata": {},
|
|
56
|
+
"plan": {
|
|
57
|
+
"id": "price_1T2SuzDEGraYraOkQxPibfiV",
|
|
58
|
+
"object": "plan",
|
|
59
|
+
"active": true,
|
|
60
|
+
"amount": 1500,
|
|
61
|
+
"amount_decimal": "1500",
|
|
62
|
+
"billing_scheme": "per_unit",
|
|
63
|
+
"created": 1771490945,
|
|
64
|
+
"currency": "usd",
|
|
65
|
+
"interval": "month",
|
|
66
|
+
"interval_count": 1,
|
|
67
|
+
"livemode": false,
|
|
68
|
+
"metadata": {},
|
|
69
|
+
"meter": null,
|
|
70
|
+
"nickname": null,
|
|
71
|
+
"product": "prod_U0TsJBVgyOkInl",
|
|
72
|
+
"tiers_mode": null,
|
|
73
|
+
"transform_usage": null,
|
|
74
|
+
"trial_period_days": null,
|
|
75
|
+
"usage_type": "licensed"
|
|
76
|
+
},
|
|
77
|
+
"price": {
|
|
78
|
+
"id": "price_1T2SuzDEGraYraOkQxPibfiV",
|
|
79
|
+
"object": "price",
|
|
80
|
+
"active": true,
|
|
81
|
+
"billing_scheme": "per_unit",
|
|
82
|
+
"created": 1771490945,
|
|
83
|
+
"currency": "usd",
|
|
84
|
+
"custom_unit_amount": null,
|
|
85
|
+
"livemode": false,
|
|
86
|
+
"lookup_key": null,
|
|
87
|
+
"metadata": {},
|
|
88
|
+
"nickname": null,
|
|
89
|
+
"product": "prod_U0TsJBVgyOkInl",
|
|
90
|
+
"recurring": {
|
|
91
|
+
"interval": "month",
|
|
92
|
+
"interval_count": 1,
|
|
93
|
+
"meter": null,
|
|
94
|
+
"trial_period_days": null,
|
|
95
|
+
"usage_type": "licensed"
|
|
96
|
+
},
|
|
97
|
+
"tax_behavior": "unspecified",
|
|
98
|
+
"tiers_mode": null,
|
|
99
|
+
"transform_quantity": null,
|
|
100
|
+
"type": "recurring",
|
|
101
|
+
"unit_amount": 1500,
|
|
102
|
+
"unit_amount_decimal": "1500"
|
|
103
|
+
},
|
|
104
|
+
"quantity": 1,
|
|
105
|
+
"subscription": "sub_1T2Sv0DEGraYraOkYSU3tfYm",
|
|
106
|
+
"tax_rates": []
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"has_more": false,
|
|
110
|
+
"total_count": 1,
|
|
111
|
+
"url": "/v1/subscription_items?subscription=sub_1T2Sv0DEGraYraOkYSU3tfYm"
|
|
112
|
+
},
|
|
113
|
+
"latest_invoice": "in_1T2Sv0DEGraYraOkRi6kQMI5",
|
|
114
|
+
"livemode": false,
|
|
115
|
+
"metadata": {},
|
|
116
|
+
"next_pending_invoice_item_invoice": null,
|
|
117
|
+
"on_behalf_of": null,
|
|
118
|
+
"pause_collection": null,
|
|
119
|
+
"payment_settings": {
|
|
120
|
+
"payment_method_options": null,
|
|
121
|
+
"payment_method_types": null,
|
|
122
|
+
"save_default_payment_method": "off"
|
|
123
|
+
},
|
|
124
|
+
"pending_invoice_item_interval": null,
|
|
125
|
+
"pending_setup_intent": "seti_1T2Sv1DEGraYraOkqUY8NXFI",
|
|
126
|
+
"pending_update": null,
|
|
127
|
+
"plan": {
|
|
128
|
+
"id": "price_1T2SuzDEGraYraOkQxPibfiV",
|
|
129
|
+
"object": "plan",
|
|
130
|
+
"active": true,
|
|
131
|
+
"amount": 1500,
|
|
132
|
+
"amount_decimal": "1500",
|
|
133
|
+
"billing_scheme": "per_unit",
|
|
134
|
+
"created": 1771490945,
|
|
135
|
+
"currency": "usd",
|
|
136
|
+
"interval": "month",
|
|
137
|
+
"interval_count": 1,
|
|
138
|
+
"livemode": false,
|
|
139
|
+
"metadata": {},
|
|
140
|
+
"meter": null,
|
|
141
|
+
"nickname": null,
|
|
142
|
+
"product": "prod_U0TsJBVgyOkInl",
|
|
143
|
+
"tiers_mode": null,
|
|
144
|
+
"transform_usage": null,
|
|
145
|
+
"trial_period_days": null,
|
|
146
|
+
"usage_type": "licensed"
|
|
147
|
+
},
|
|
148
|
+
"quantity": 1,
|
|
149
|
+
"schedule": null,
|
|
150
|
+
"start_date": 1771490946,
|
|
151
|
+
"status": "trialing",
|
|
152
|
+
"test_clock": null,
|
|
153
|
+
"transfer_data": null,
|
|
154
|
+
"trial_end": 1771577346,
|
|
155
|
+
"trial_settings": {
|
|
156
|
+
"end_behavior": {
|
|
157
|
+
"missing_payment_method": "create_invoice"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"trial_start": 1771490946
|
|
161
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test: admin:database-read
|
|
3
|
+
* Tests the admin Realtime Database read command
|
|
4
|
+
* Requires admin authentication
|
|
5
|
+
*/
|
|
6
|
+
const TEST_PATH = '_test/database-read-test';
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
description: 'Admin Realtime Database read operation',
|
|
10
|
+
type: 'group',
|
|
11
|
+
tests: [
|
|
12
|
+
// Test 1: Setup - write test data first
|
|
13
|
+
{
|
|
14
|
+
name: 'setup-test-data',
|
|
15
|
+
auth: 'admin',
|
|
16
|
+
timeout: 15000,
|
|
17
|
+
|
|
18
|
+
async run({ http, assert }) {
|
|
19
|
+
// Write test data to read later
|
|
20
|
+
const testData = {
|
|
21
|
+
testField: 'database-read-test-value',
|
|
22
|
+
timestamp: new Date().toISOString(),
|
|
23
|
+
nested: {
|
|
24
|
+
field1: 'nested-value',
|
|
25
|
+
field2: 123,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const writeResponse = await http.command('admin:database-write', {
|
|
30
|
+
path: TEST_PATH,
|
|
31
|
+
document: testData,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
assert.isSuccess(writeResponse, 'Setup: Database write should succeed');
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// Test 2: Admin can read data
|
|
39
|
+
{
|
|
40
|
+
name: 'admin-read-succeeds',
|
|
41
|
+
auth: 'admin',
|
|
42
|
+
timeout: 15000,
|
|
43
|
+
|
|
44
|
+
async run({ http, assert }) {
|
|
45
|
+
const readResponse = await http.command('admin:database-read', {
|
|
46
|
+
path: TEST_PATH,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
assert.isSuccess(readResponse, 'Database read should succeed with admin auth');
|
|
50
|
+
assert.hasProperty(readResponse, 'data.testField', 'Response should contain test data');
|
|
51
|
+
assert.equal(
|
|
52
|
+
readResponse.data.testField,
|
|
53
|
+
'database-read-test-value',
|
|
54
|
+
'Read data should match written data'
|
|
55
|
+
);
|
|
56
|
+
assert.hasProperty(readResponse, 'data.nested.field1', 'Response should contain nested data');
|
|
57
|
+
assert.equal(
|
|
58
|
+
readResponse.data.nested.field2,
|
|
59
|
+
123,
|
|
60
|
+
'Nested field should match written data'
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
// Test 3: Reading non-existent path returns empty/null
|
|
66
|
+
{
|
|
67
|
+
name: 'read-nonexistent-returns-null',
|
|
68
|
+
auth: 'admin',
|
|
69
|
+
timeout: 15000,
|
|
70
|
+
|
|
71
|
+
async run({ http, assert }) {
|
|
72
|
+
const readResponse = await http.command('admin:database-read', {
|
|
73
|
+
path: '_test/nonexistent-path-12345',
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
assert.isSuccess(readResponse, 'Reading non-existent path should succeed');
|
|
77
|
+
// Realtime Database returns null for non-existent paths
|
|
78
|
+
// However, emulator may return empty object {} in some cases
|
|
79
|
+
const data = readResponse.data;
|
|
80
|
+
const isEmpty = data === null
|
|
81
|
+
|| data === undefined
|
|
82
|
+
|| (typeof data === 'object' && Object.keys(data).length === 0);
|
|
83
|
+
assert.ok(
|
|
84
|
+
isEmpty,
|
|
85
|
+
`Non-existent path should return null, undefined, or empty object, got: ${JSON.stringify(data)}`
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
// Test 4: Missing path returns 400 error
|
|
91
|
+
{
|
|
92
|
+
name: 'missing-path-rejected',
|
|
93
|
+
auth: 'admin',
|
|
94
|
+
timeout: 15000,
|
|
95
|
+
|
|
96
|
+
async run({ http, assert }) {
|
|
97
|
+
const readResponse = await http.command('admin:database-read', {});
|
|
98
|
+
|
|
99
|
+
assert.isError(readResponse, 400, 'Missing path should return 400');
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
// Test 5: Unauthenticated request fails
|
|
104
|
+
{
|
|
105
|
+
name: 'unauthenticated-rejected',
|
|
106
|
+
auth: 'none',
|
|
107
|
+
timeout: 15000,
|
|
108
|
+
|
|
109
|
+
async run({ http, assert }) {
|
|
110
|
+
const readResponse = await http.command('admin:database-read', {
|
|
111
|
+
path: TEST_PATH,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
assert.isError(readResponse, 401, 'Database read should fail without authentication');
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
// Test 6: Non-admin user fails
|
|
119
|
+
{
|
|
120
|
+
name: 'non-admin-rejected',
|
|
121
|
+
auth: 'basic',
|
|
122
|
+
timeout: 15000,
|
|
123
|
+
|
|
124
|
+
async run({ http, assert }) {
|
|
125
|
+
const readResponse = await http.command('admin:database-read', {
|
|
126
|
+
path: TEST_PATH,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
assert.isError(readResponse, 403, 'Database read should fail for non-admin user');
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
],
|
|
134
|
+
};
|