tapimo 0.1.0 → 0.3.0
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/README.md +57 -16
- package/dist/ApiKey.d.ts +4 -1
- package/dist/ApiKey.d.ts.map +1 -1
- package/dist/ApiKey.js +6 -2
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +98 -3
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +150 -1
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +7917 -2315
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +141 -329
- package/dist/App.js.map +1 -1
- package/dist/Scope.d.ts +20 -4
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +23 -4
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.d.ts +2 -2
- package/dist/Webhooks.d.ts.map +1 -1
- package/dist/Webhooks.js +2 -2
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +203 -120
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +111 -6
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +67 -0
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/scopes.d.ts +12 -1
- package/dist/admin/apps/scopes.d.ts.map +1 -1
- package/dist/admin/apps/scopes.js +3 -0
- package/dist/admin/apps/scopes.js.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +116 -116
- package/dist/admin/apps/verified-tokens.js +1 -1
- package/dist/admin/apps/verified-tokens.js.map +1 -1
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.js +13 -13
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts +151 -0
- package/dist/analytics/Analytics.d.ts.map +1 -0
- package/dist/analytics/Analytics.js +212 -0
- package/dist/analytics/Analytics.js.map +1 -0
- package/dist/analytics/tables/requestEvents.d.ts +215 -0
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -0
- package/dist/analytics/tables/requestEvents.js +264 -0
- package/dist/analytics/tables/requestEvents.js.map +1 -0
- package/dist/apps/data/App.d.ts +19576 -0
- package/dist/apps/data/App.d.ts.map +1 -0
- package/dist/apps/data/App.js +272 -0
- package/dist/apps/data/App.js.map +1 -0
- package/dist/apps/data/index.d.ts +3 -0
- package/dist/apps/data/index.d.ts.map +1 -0
- package/dist/apps/data/index.js +3 -0
- package/dist/apps/data/index.js.map +1 -0
- package/dist/apps/{activities.d.ts → data/routes/activities.d.ts} +32 -32
- package/dist/apps/{activities.d.ts.map → data/routes/activities.d.ts.map} +1 -1
- package/dist/apps/{activities.js → data/routes/activities.js} +13 -13
- package/dist/apps/data/routes/activities.js.map +1 -0
- package/dist/apps/{addresses.d.ts → data/routes/addresses.d.ts} +22 -22
- package/dist/apps/{addresses.d.ts.map → data/routes/addresses.d.ts.map} +1 -1
- package/dist/apps/{addresses.js → data/routes/addresses.js} +5 -5
- package/dist/apps/data/routes/addresses.js.map +1 -0
- package/dist/apps/{balances.d.ts → data/routes/balances.d.ts} +4 -4
- package/dist/apps/data/routes/balances.d.ts.map +1 -0
- package/dist/apps/{balances.js → data/routes/balances.js} +42 -11
- package/dist/apps/data/routes/balances.js.map +1 -0
- package/dist/apps/{blocks.d.ts → data/routes/blocks.d.ts} +47 -47
- package/dist/apps/data/routes/blocks.d.ts.map +1 -0
- package/dist/apps/{blocks.js → data/routes/blocks.js} +13 -13
- package/dist/apps/data/routes/blocks.js.map +1 -0
- package/dist/apps/{coingecko.d.ts → data/routes/coingecko.d.ts} +8 -8
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -0
- package/dist/apps/{coingecko.js → data/routes/coingecko.js} +13 -13
- package/dist/apps/data/routes/coingecko.js.map +1 -0
- package/dist/apps/{exchanges.d.ts → data/routes/exchanges.d.ts} +108 -108
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -0
- package/dist/apps/{exchanges.js → data/routes/exchanges.js} +19 -19
- package/dist/apps/data/routes/exchanges.js.map +1 -0
- package/dist/apps/{fee-amm.d.ts → data/routes/fee-amm.d.ts} +39 -39
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -0
- package/dist/apps/{fee-amm.js → data/routes/fee-amm.js} +17 -17
- package/dist/apps/data/routes/fee-amm.js.map +1 -0
- package/dist/apps/data/routes/funding.d.ts +765 -0
- package/dist/apps/data/routes/funding.d.ts.map +1 -0
- package/dist/apps/data/routes/funding.js +383 -0
- package/dist/apps/data/routes/funding.js.map +1 -0
- package/dist/apps/{indexer.d.ts → data/routes/indexer.d.ts} +4 -4
- package/dist/apps/data/routes/indexer.d.ts.map +1 -0
- package/dist/apps/{indexer.js → data/routes/indexer.js} +13 -9
- package/dist/apps/data/routes/indexer.js.map +1 -0
- package/dist/apps/{receipts.d.ts → data/routes/receipts.d.ts} +49 -49
- package/dist/apps/data/routes/receipts.d.ts.map +1 -0
- package/dist/apps/{receipts.js → data/routes/receipts.js} +14 -20
- package/dist/apps/data/routes/receipts.js.map +1 -0
- package/dist/apps/{rpc.d.ts → data/routes/rpc.d.ts} +33 -40
- package/dist/apps/data/routes/rpc.d.ts.map +1 -0
- package/dist/apps/{rpc.js → data/routes/rpc.js} +35 -7
- package/dist/apps/data/routes/rpc.js.map +1 -0
- package/dist/apps/{tokenlist.d.ts → data/routes/tokenlist.d.ts} +40 -40
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -0
- package/dist/apps/{tokenlist.js → data/routes/tokenlist.js} +8 -8
- package/dist/apps/data/routes/tokenlist.js.map +1 -0
- package/dist/apps/{tokens.d.ts → data/routes/tokens.d.ts} +468 -468
- package/dist/apps/data/routes/tokens.d.ts.map +1 -0
- package/dist/apps/{tokens.js → data/routes/tokens.js} +19 -19
- package/dist/apps/data/routes/tokens.js.map +1 -0
- package/dist/apps/{transactions.d.ts → data/routes/transactions.d.ts} +304 -304
- package/dist/apps/data/routes/transactions.d.ts.map +1 -0
- package/dist/apps/{transactions.js → data/routes/transactions.js} +13 -13
- package/dist/apps/data/routes/transactions.js.map +1 -0
- package/dist/apps/{transfers.d.ts → data/routes/transfers.d.ts} +62 -62
- package/dist/apps/data/routes/transfers.d.ts.map +1 -0
- package/dist/apps/{transfers.js → data/routes/transfers.js} +13 -13
- package/dist/apps/data/routes/transfers.js.map +1 -0
- package/dist/apps/{verified-tokens.d.ts → data/routes/verified-tokens.d.ts} +6 -6
- package/dist/apps/data/routes/verified-tokens.d.ts.map +1 -0
- package/dist/apps/{verified-tokens.js → data/routes/verified-tokens.js} +9 -9
- package/dist/apps/data/routes/verified-tokens.js.map +1 -0
- package/dist/apps/{webhooks.d.ts → data/routes/webhooks.d.ts} +17 -17
- package/dist/apps/{webhooks.d.ts.map → data/routes/webhooks.d.ts.map} +1 -1
- package/dist/apps/{webhooks.js → data/routes/webhooks.js} +38 -34
- package/dist/apps/data/routes/webhooks.js.map +1 -0
- package/dist/apps/docs/App.d.ts +29 -0
- package/dist/apps/docs/App.d.ts.map +1 -0
- package/dist/apps/docs/App.js +54 -0
- package/dist/apps/docs/App.js.map +1 -0
- package/dist/{internal/OpenApi.fonts.d.ts → apps/docs/fonts.d.ts} +1 -1
- package/dist/apps/docs/fonts.d.ts.map +1 -0
- package/dist/{internal/OpenApi.fonts.js → apps/docs/fonts.js} +1 -1
- package/dist/apps/docs/fonts.js.map +1 -0
- package/dist/apps/docs/index.d.ts +2 -0
- package/dist/apps/docs/index.d.ts.map +1 -0
- package/dist/apps/docs/index.js +2 -0
- package/dist/apps/docs/index.js.map +1 -0
- package/dist/{internal/OpenApi.logo.d.ts → apps/docs/logo.d.ts} +1 -1
- package/dist/apps/docs/logo.d.ts.map +1 -0
- package/dist/{internal/OpenApi.logo.js → apps/docs/logo.js} +1 -1
- package/dist/apps/docs/logo.js.map +1 -0
- package/dist/apps/docs/reference.d.ts +21 -0
- package/dist/apps/docs/reference.d.ts.map +1 -0
- package/dist/apps/docs/reference.js +112 -0
- package/dist/apps/docs/reference.js.map +1 -0
- package/dist/apps/index.d.ts +5 -0
- package/dist/apps/index.d.ts.map +1 -0
- package/dist/apps/index.js +5 -0
- package/dist/apps/index.js.map +1 -0
- package/dist/apps/mcp.d.ts +76 -0
- package/dist/apps/mcp.d.ts.map +1 -0
- package/dist/apps/mcp.js +188 -0
- package/dist/apps/mcp.js.map +1 -0
- package/dist/apps/metadata.d.ts +7 -0
- package/dist/apps/metadata.d.ts.map +1 -0
- package/dist/apps/metadata.js +15 -0
- package/dist/apps/metadata.js.map +1 -0
- package/dist/apps/platform/App.d.ts +5262 -0
- package/dist/apps/platform/App.d.ts.map +1 -0
- package/dist/apps/platform/App.js +84 -0
- package/dist/apps/platform/App.js.map +1 -0
- package/dist/apps/platform/Billing.d.ts +279 -0
- package/dist/apps/platform/Billing.d.ts.map +1 -0
- package/dist/apps/platform/Billing.js +477 -0
- package/dist/apps/platform/Billing.js.map +1 -0
- package/dist/apps/platform/index.d.ts +3 -0
- package/dist/apps/platform/index.d.ts.map +1 -0
- package/dist/apps/platform/index.js +3 -0
- package/dist/apps/platform/index.js.map +1 -0
- package/dist/apps/platform/routes/api-keys.d.ts +973 -0
- package/dist/apps/platform/routes/api-keys.d.ts.map +1 -0
- package/dist/apps/platform/routes/api-keys.js +430 -0
- package/dist/apps/platform/routes/api-keys.js.map +1 -0
- package/dist/apps/platform/routes/billing.d.ts +1520 -0
- package/dist/apps/platform/routes/billing.d.ts.map +1 -0
- package/dist/apps/platform/routes/billing.js +795 -0
- package/dist/apps/platform/routes/billing.js.map +1 -0
- package/dist/apps/platform/routes/invitations.d.ts +851 -0
- package/dist/apps/platform/routes/invitations.d.ts.map +1 -0
- package/dist/apps/platform/routes/invitations.js +471 -0
- package/dist/apps/platform/routes/invitations.js.map +1 -0
- package/dist/apps/platform/routes/me.d.ts +95 -0
- package/dist/apps/platform/routes/me.d.ts.map +1 -0
- package/dist/apps/platform/routes/me.js +81 -0
- package/dist/apps/platform/routes/me.js.map +1 -0
- package/dist/apps/platform/routes/members.d.ts +554 -0
- package/dist/apps/platform/routes/members.d.ts.map +1 -0
- package/dist/apps/platform/routes/members.js +251 -0
- package/dist/apps/platform/routes/members.js.map +1 -0
- package/dist/apps/platform/routes/orgs.d.ts +596 -0
- package/dist/apps/platform/routes/orgs.d.ts.map +1 -0
- package/dist/apps/platform/routes/orgs.js +276 -0
- package/dist/apps/platform/routes/orgs.js.map +1 -0
- package/dist/apps/platform/routes/projects.d.ts +740 -0
- package/dist/apps/platform/routes/projects.d.ts.map +1 -0
- package/dist/apps/platform/routes/projects.js +286 -0
- package/dist/apps/platform/routes/projects.js.map +1 -0
- package/dist/apps/platform/routes/scopes.d.ts +107 -0
- package/dist/apps/platform/routes/scopes.d.ts.map +1 -0
- package/dist/apps/platform/routes/scopes.js +66 -0
- package/dist/apps/platform/routes/scopes.js.map +1 -0
- package/dist/apps/platform/routes/usage.d.ts +588 -0
- package/dist/apps/platform/routes/usage.d.ts.map +1 -0
- package/dist/apps/platform/routes/usage.js +391 -0
- package/dist/apps/platform/routes/usage.js.map +1 -0
- package/dist/apps/relay/App.d.ts +44 -0
- package/dist/apps/relay/App.d.ts.map +1 -0
- package/dist/apps/relay/App.js +211 -0
- package/dist/apps/relay/App.js.map +1 -0
- package/dist/apps/relay/Sponsorships.d.ts +107 -0
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -0
- package/dist/apps/relay/Sponsorships.js +194 -0
- package/dist/apps/relay/Sponsorships.js.map +1 -0
- package/dist/apps/relay/index.d.ts +3 -0
- package/dist/apps/relay/index.d.ts.map +1 -0
- package/dist/apps/relay/index.js +3 -0
- package/dist/apps/relay/index.js.map +1 -0
- package/dist/cli/Cli.d.ts +9 -2
- package/dist/cli/Cli.d.ts.map +1 -1
- package/dist/cli/Cli.js +12 -4
- package/dist/cli/Cli.js.map +1 -1
- package/dist/cli/commands/admin.d.ts +5 -1
- package/dist/cli/commands/admin.d.ts.map +1 -1
- package/dist/cli/commands/admin.js +82 -3
- package/dist/cli/commands/admin.js.map +1 -1
- package/dist/db/Db.d.ts +17 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +254 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +159 -0
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +187 -2
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/billingSettings.d.ts +55 -0
- package/dist/db/tables/billingSettings.d.ts.map +1 -0
- package/dist/db/tables/billingSettings.js +70 -0
- package/dist/db/tables/billingSettings.js.map +1 -0
- package/dist/db/tables/invitations.d.ts +84 -0
- package/dist/db/tables/invitations.d.ts.map +1 -0
- package/dist/db/tables/invitations.js +165 -0
- package/dist/db/tables/invitations.js.map +1 -0
- package/dist/db/tables/memberships.d.ts +108 -0
- package/dist/db/tables/memberships.d.ts.map +1 -0
- package/dist/db/tables/memberships.js +153 -0
- package/dist/db/tables/memberships.js.map +1 -0
- package/dist/db/tables/organizations.d.ts +48 -0
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +97 -2
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +65 -0
- package/dist/db/tables/projects.d.ts.map +1 -0
- package/dist/db/tables/projects.js +75 -0
- package/dist/db/tables/projects.js.map +1 -0
- package/dist/db/tables/requestUsage.d.ts +121 -0
- package/dist/db/tables/requestUsage.d.ts.map +1 -0
- package/dist/db/tables/requestUsage.js +150 -0
- package/dist/db/tables/requestUsage.js.map +1 -0
- package/dist/db/tables/sponsoredTransactions.d.ts +239 -0
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -0
- package/dist/db/tables/sponsoredTransactions.js +314 -0
- package/dist/db/tables/sponsoredTransactions.js.map +1 -0
- package/dist/db/tables/stripeCustomers.d.ts +81 -0
- package/dist/db/tables/stripeCustomers.d.ts.map +1 -0
- package/dist/db/tables/stripeCustomers.js +120 -0
- package/dist/db/tables/stripeCustomers.js.map +1 -0
- package/dist/db/tables/users.d.ts +48 -0
- package/dist/db/tables/users.d.ts.map +1 -0
- package/dist/db/tables/users.js +65 -0
- package/dist/db/tables/users.js.map +1 -0
- package/dist/handlers/internal/executionError.d.ts.map +1 -1
- package/dist/handlers/internal/executionError.js +2 -0
- package/dist/handlers/internal/executionError.js.map +1 -1
- package/dist/handlers/internal/multisig.d.ts +2 -6
- package/dist/handlers/internal/multisig.d.ts.map +1 -1
- package/dist/handlers/internal/multisig.js +11 -36
- package/dist/handlers/internal/multisig.js.map +1 -1
- package/dist/handlers/internal/sponsorship.d.ts +35 -2
- package/dist/handlers/internal/sponsorship.d.ts.map +1 -1
- package/dist/handlers/internal/sponsorship.js +53 -14
- package/dist/handlers/internal/sponsorship.js.map +1 -1
- package/dist/handlers/internal/utils.d.ts +10 -3
- package/dist/handlers/internal/utils.d.ts.map +1 -1
- package/dist/handlers/internal/utils.js +14 -6
- package/dist/handlers/internal/utils.js.map +1 -1
- package/dist/handlers/relay.d.ts +6 -2
- package/dist/handlers/relay.d.ts.map +1 -1
- package/dist/handlers/relay.js +16 -2
- package/dist/handlers/relay.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/Auth.d.ts +222 -6
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +625 -74
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +4 -1
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/EdgeCache.d.ts +10 -0
- package/dist/internal/EdgeCache.d.ts.map +1 -1
- package/dist/internal/EdgeCache.js +39 -8
- package/dist/internal/EdgeCache.js.map +1 -1
- package/dist/internal/Fees.d.ts +27 -0
- package/dist/internal/Fees.d.ts.map +1 -0
- package/dist/internal/Fees.js +48 -0
- package/dist/internal/Fees.js.map +1 -0
- package/dist/internal/FundingRoutes.d.ts +183 -0
- package/dist/internal/FundingRoutes.d.ts.map +1 -0
- package/dist/internal/FundingRoutes.js +490 -0
- package/dist/internal/FundingRoutes.js.map +1 -0
- package/dist/internal/Id.d.ts +15 -0
- package/dist/internal/Id.d.ts.map +1 -0
- package/dist/internal/Id.js +22 -0
- package/dist/internal/Id.js.map +1 -0
- package/dist/internal/Log.d.ts +9 -3
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +7 -0
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +10 -20
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +8 -58
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/RateLimit.d.ts +25 -0
- package/dist/internal/RateLimit.d.ts.map +1 -1
- package/dist/internal/RateLimit.js +51 -0
- package/dist/internal/RateLimit.js.map +1 -1
- package/dist/internal/Response.d.ts +1 -1
- package/dist/internal/Response.d.ts.map +1 -1
- package/dist/internal/Schema.d.ts +8 -0
- package/dist/internal/Schema.d.ts.map +1 -1
- package/dist/internal/Schema.js +7 -0
- package/dist/internal/Schema.js.map +1 -1
- package/dist/internal/Store.d.ts +7 -1
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +16 -2
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Viem.d.ts +84 -0
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Webhooks.d.ts +1 -1
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +3 -3
- package/dist/internal/Webhooks.js.map +1 -1
- package/package.json +33 -6
- package/src/ApiKey.ts +10 -2
- package/src/ApiKeys.test.ts +155 -1
- package/src/ApiKeys.ts +203 -1
- package/src/App.test.ts +64 -75741
- package/src/App.ts +218 -420
- package/src/Client.test-d.ts +657 -15
- package/src/Scope.ts +26 -4
- package/src/Webhooks.ts +2 -2
- package/src/admin/apps/api-keys.test.ts +51 -0
- package/src/admin/apps/api-keys.ts +84 -0
- package/src/admin/apps/scopes.test.ts +11 -1
- package/src/admin/apps/scopes.ts +3 -0
- package/src/admin/apps/verified-tokens.ts +1 -1
- package/src/admin/ui/src/components/Page.tsx +2 -3
- package/src/admin/ui/src/routes/__root.tsx +2 -2
- package/src/admin/ui/src/routes/api-keys.tsx +2 -2
- package/src/admin/ui.generated.ts +13 -13
- package/src/analytics/Analytics.test.ts +527 -0
- package/src/analytics/Analytics.ts +318 -0
- package/src/analytics/tables/requestEvents.ts +523 -0
- package/src/apps/composition.test.ts +66 -0
- package/src/apps/data/App.test.ts +72 -0
- package/src/apps/data/App.ts +330 -0
- package/src/apps/data/index.ts +2 -0
- package/src/apps/{activities.test.ts → data/routes/activities.test.ts} +3 -3
- package/src/apps/{activities.ts → data/routes/activities.ts} +15 -15
- package/src/apps/{addresses.ts → data/routes/addresses.ts} +6 -6
- package/src/apps/{balances.test.ts → data/routes/balances.test.ts} +2 -2
- package/src/apps/{balances.ts → data/routes/balances.ts} +46 -12
- package/src/apps/{blocks.test.ts → data/routes/blocks.test.ts} +3 -3
- package/src/apps/{blocks.ts → data/routes/blocks.ts} +14 -14
- package/src/apps/{coingecko.test.ts → data/routes/coingecko.test.ts} +2 -2
- package/src/apps/{coingecko.ts → data/routes/coingecko.ts} +14 -14
- package/src/apps/{exchanges.test.ts → data/routes/exchanges.test.ts} +1 -1
- package/src/apps/{exchanges.ts → data/routes/exchanges.ts} +20 -20
- package/src/apps/{fee-amm.test.ts → data/routes/fee-amm.test.ts} +3 -3
- package/src/apps/{fee-amm.ts → data/routes/fee-amm.ts} +18 -18
- package/src/apps/data/routes/funding.test.ts +214 -0
- package/src/apps/data/routes/funding.ts +584 -0
- package/src/apps/{indexer.test.ts → data/routes/indexer.test.ts} +26 -5
- package/src/apps/{indexer.ts → data/routes/indexer.ts} +13 -10
- package/src/apps/{receipts.test.ts → data/routes/receipts.test.ts} +3 -3
- package/src/apps/{receipts.ts → data/routes/receipts.ts} +15 -22
- package/src/apps/{rpc.test.ts → data/routes/rpc.test.ts} +122 -7
- package/src/apps/{rpc.ts → data/routes/rpc.ts} +38 -8
- package/src/apps/{tokenlist.test.ts → data/routes/tokenlist.test.ts} +3 -3
- package/src/apps/{tokenlist.ts → data/routes/tokenlist.ts} +9 -9
- package/src/apps/{tokens.test.ts → data/routes/tokens.test.ts} +2 -2
- package/src/apps/{tokens.ts → data/routes/tokens.ts} +20 -20
- package/src/apps/{transactions.test.ts → data/routes/transactions.test.ts} +3 -3
- package/src/apps/{transactions.ts → data/routes/transactions.ts} +15 -15
- package/src/apps/{transfers.test.ts → data/routes/transfers.test.ts} +2 -2
- package/src/apps/{transfers.ts → data/routes/transfers.ts} +15 -15
- package/src/apps/{verified-tokens.test.ts → data/routes/verified-tokens.test.ts} +3 -3
- package/src/apps/{verified-tokens.ts → data/routes/verified-tokens.ts} +10 -10
- package/src/apps/{webhooks.test.ts → data/routes/webhooks.test.ts} +7 -7
- package/src/apps/{webhooks.ts → data/routes/webhooks.ts} +50 -43
- package/src/apps/docs/App.ts +65 -0
- package/src/apps/docs/index.ts +1 -0
- package/src/apps/docs/reference.ts +132 -0
- package/src/apps/index.ts +4 -0
- package/src/apps/mcp.test.ts +206 -0
- package/src/apps/mcp.ts +250 -0
- package/src/apps/metadata.ts +23 -0
- package/src/apps/platform/App.ts +169 -0
- package/src/apps/platform/Billing.test.ts +530 -0
- package/src/apps/platform/Billing.ts +682 -0
- package/src/apps/platform/index.ts +2 -0
- package/src/apps/platform/routes/api-keys.test.ts +493 -0
- package/src/apps/platform/routes/api-keys.ts +543 -0
- package/src/apps/platform/routes/billing.test.ts +1100 -0
- package/src/apps/platform/routes/billing.ts +966 -0
- package/src/apps/platform/routes/invitations.test.ts +409 -0
- package/src/apps/platform/routes/invitations.ts +587 -0
- package/src/apps/platform/routes/me.test.ts +351 -0
- package/src/apps/platform/routes/me.ts +106 -0
- package/src/apps/platform/routes/members.test.ts +195 -0
- package/src/apps/platform/routes/members.ts +313 -0
- package/src/apps/platform/routes/orgs.test.ts +313 -0
- package/src/apps/platform/routes/orgs.ts +365 -0
- package/src/apps/platform/routes/projects.test.ts +181 -0
- package/src/apps/platform/routes/projects.ts +367 -0
- package/src/apps/platform/routes/scopes.test.ts +29 -0
- package/src/apps/platform/routes/scopes.ts +85 -0
- package/src/apps/platform/routes/usage.test.ts +422 -0
- package/src/apps/platform/routes/usage.ts +527 -0
- package/src/apps/relay/App.test.ts +933 -0
- package/src/apps/relay/App.ts +236 -0
- package/src/apps/relay/Sponsorships.test.ts +375 -0
- package/src/apps/relay/Sponsorships.ts +306 -0
- package/src/apps/relay/index.ts +2 -0
- package/src/cli/Cli.test.ts +25 -2
- package/src/cli/Cli.ts +18 -3
- package/src/cli/commands/admin.test.ts +83 -0
- package/src/cli/commands/admin.ts +91 -3
- package/src/db/Db.ts +296 -0
- package/src/db/Schema.ts +241 -2
- package/src/db/tables/billingSettings.test.ts +87 -0
- package/src/db/tables/billingSettings.ts +108 -0
- package/src/db/tables/invitations.ts +198 -0
- package/src/db/tables/memberships.ts +208 -0
- package/src/db/tables/organizations.test.ts +38 -2
- package/src/db/tables/organizations.ts +117 -2
- package/src/db/tables/projects.ts +107 -0
- package/src/db/tables/requestUsage.ts +231 -0
- package/src/db/tables/sponsoredTransactions.test.ts +325 -0
- package/src/db/tables/sponsoredTransactions.ts +464 -0
- package/src/db/tables/stripeCustomers.test.ts +109 -0
- package/src/db/tables/stripeCustomers.ts +162 -0
- package/src/db/tables/users.ts +85 -0
- package/src/handlers/internal/executionError.ts +2 -0
- package/src/handlers/internal/multisig.test.ts +84 -10
- package/src/handlers/internal/multisig.ts +15 -50
- package/src/handlers/internal/sponsorship.ts +106 -20
- package/src/handlers/internal/utils.ts +19 -7
- package/src/handlers/{internal/relay.localnet.test.ts → relay.test.ts} +2 -2
- package/src/handlers/relay.ts +23 -5
- package/src/index.ts +1 -0
- package/src/internal/Auth.test.ts +491 -25
- package/src/internal/Auth.ts +839 -84
- package/src/internal/Cache.ts +5 -1
- package/src/internal/Cursor.test.ts +3 -2
- package/src/internal/EdgeCache.test.ts +27 -4
- package/src/internal/EdgeCache.ts +47 -9
- package/src/internal/Fees.test.ts +32 -0
- package/src/internal/Fees.ts +51 -0
- package/src/internal/FundingRoutes.ts +583 -0
- package/src/internal/Id.test.ts +17 -0
- package/src/internal/Id.ts +24 -0
- package/src/internal/Log.test.ts +2 -1
- package/src/internal/Log.ts +16 -3
- package/src/internal/MetricSink.ts +1 -1
- package/src/internal/OpenApi.ts +12 -60
- package/src/internal/RateLimit.test.ts +84 -0
- package/src/internal/RateLimit.ts +70 -0
- package/src/internal/Response.ts +1 -1
- package/src/internal/Schema.ts +8 -0
- package/src/internal/Store.test.ts +52 -0
- package/src/internal/Store.ts +24 -5
- package/src/internal/Tidx.local.test.ts +1 -1
- package/src/internal/VerifiedTokens.test.ts +1 -1
- package/src/internal/WebhookDestination.test.ts +1 -1
- package/src/internal/Webhooks.test.ts +7 -7
- package/src/internal/Webhooks.ts +4 -4
- package/dist/apps/activities.js.map +0 -1
- package/dist/apps/addresses.js.map +0 -1
- package/dist/apps/balances.d.ts.map +0 -1
- package/dist/apps/balances.js.map +0 -1
- package/dist/apps/blocks.d.ts.map +0 -1
- package/dist/apps/blocks.js.map +0 -1
- package/dist/apps/coingecko.d.ts.map +0 -1
- package/dist/apps/coingecko.js.map +0 -1
- package/dist/apps/exchanges.d.ts.map +0 -1
- package/dist/apps/exchanges.js.map +0 -1
- package/dist/apps/fee-amm.d.ts.map +0 -1
- package/dist/apps/fee-amm.js.map +0 -1
- package/dist/apps/indexer.d.ts.map +0 -1
- package/dist/apps/indexer.js.map +0 -1
- package/dist/apps/receipts.d.ts.map +0 -1
- package/dist/apps/receipts.js.map +0 -1
- package/dist/apps/rpc.d.ts.map +0 -1
- package/dist/apps/rpc.js.map +0 -1
- package/dist/apps/tokenlist.d.ts.map +0 -1
- package/dist/apps/tokenlist.js.map +0 -1
- package/dist/apps/tokens.d.ts.map +0 -1
- package/dist/apps/tokens.js.map +0 -1
- package/dist/apps/transactions.d.ts.map +0 -1
- package/dist/apps/transactions.js.map +0 -1
- package/dist/apps/transfers.d.ts.map +0 -1
- package/dist/apps/transfers.js.map +0 -1
- package/dist/apps/verified-tokens.d.ts.map +0 -1
- package/dist/apps/verified-tokens.js.map +0 -1
- package/dist/apps/webhooks.js.map +0 -1
- package/dist/internal/OpenApi.fonts.d.ts.map +0 -1
- package/dist/internal/OpenApi.fonts.js.map +0 -1
- package/dist/internal/OpenApi.logo.d.ts.map +0 -1
- package/dist/internal/OpenApi.logo.js.map +0 -1
- package/src/handlers/internal/multisig.localnet.test.ts +0 -146
- /package/src/{internal/OpenApi.fonts.ts → apps/docs/fonts.ts} +0 -0
- /package/src/{internal/OpenApi.logo.ts → apps/docs/logo.ts} +0 -0
package/src/apps/mcp.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { type Context, Hono } from 'hono'
|
|
2
|
+
import { Cli as incur_Cli, type Openapi } from 'incur'
|
|
3
|
+
import * as z from 'zod/mini'
|
|
4
|
+
|
|
5
|
+
import type * as App from '../App.js'
|
|
6
|
+
import * as Auth from '../internal/Auth.js'
|
|
7
|
+
import * as OpenApi from '../internal/OpenApi.js'
|
|
8
|
+
import * as Metadata from './metadata.js'
|
|
9
|
+
|
|
10
|
+
/** Document tag group whose operations surface as MCP tools (the data domain). */
|
|
11
|
+
const tagGroup = 'Data API'
|
|
12
|
+
|
|
13
|
+
/** Tags inside the group hidden from MCP: partner-shaped CoinGecko mirrors and the MCP endpoint itself. */
|
|
14
|
+
const excludedTags = ['CoinGecko', 'MCP']
|
|
15
|
+
|
|
16
|
+
/** Usage guidance surfaced to MCP clients on initialize. */
|
|
17
|
+
const instructions =
|
|
18
|
+
"Tools mirror the Tempo API's data domain. Authenticated tools accept a Tempo API key: send it as an `Authorization: Bearer` header on the HTTP request, or pass the `authorization` tool input per call. List endpoints paginate via `cursor`/`nextCursor`. `docs_*` tools search the Tempo documentation."
|
|
19
|
+
|
|
20
|
+
/** Zod schemas owned by the MCP endpoint's OpenAPI description. */
|
|
21
|
+
export namespace schema {
|
|
22
|
+
/** JSON-RPC request identifier. */
|
|
23
|
+
export const Id = z
|
|
24
|
+
.union([z.string(), z.number(), z.null()])
|
|
25
|
+
.check(z.describe('Client-supplied JSON-RPC request id used to match responses to requests.'))
|
|
26
|
+
|
|
27
|
+
/** JSON-RPC error payload. */
|
|
28
|
+
export const Error = z
|
|
29
|
+
.object({
|
|
30
|
+
code: z
|
|
31
|
+
.number()
|
|
32
|
+
.check(z.int(), z.describe('Numeric JSON-RPC error code returned by the MCP server.')),
|
|
33
|
+
data: z
|
|
34
|
+
.optional(z.unknown())
|
|
35
|
+
.check(z.describe('Optional extra error details returned by the MCP server.')),
|
|
36
|
+
message: z.string().check(z.describe('Human-readable JSON-RPC error message.')),
|
|
37
|
+
})
|
|
38
|
+
.check(z.describe('JSON-RPC error object returned when a message fails.'))
|
|
39
|
+
|
|
40
|
+
/** MCP JSON-RPC response payload. */
|
|
41
|
+
export const Response = z
|
|
42
|
+
.object({
|
|
43
|
+
error: z
|
|
44
|
+
.optional(Error)
|
|
45
|
+
.check(z.describe('JSON-RPC error object returned when a message fails.')),
|
|
46
|
+
id: z
|
|
47
|
+
.optional(Id)
|
|
48
|
+
.check(
|
|
49
|
+
z.describe('Client-supplied JSON-RPC request id used to match responses to requests.'),
|
|
50
|
+
),
|
|
51
|
+
jsonrpc: z.literal('2.0').check(z.describe('JSON-RPC protocol version; MCP uses `2.0`.')),
|
|
52
|
+
result: z.optional(z.unknown()).check(z.describe('Result returned by the MCP method.')),
|
|
53
|
+
})
|
|
54
|
+
.check(z.describe('One MCP JSON-RPC response returned by the server.'))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The MCP route group: a stateless streamable-HTTP MCP server at `/mcp` whose
|
|
59
|
+
* tools mirror the API's data domain (scoped via the OpenAPI document's
|
|
60
|
+
* `Data API` tag group), plus the remote Tempo docs tools. Mount alongside
|
|
61
|
+
* the other route groups:
|
|
62
|
+
*
|
|
63
|
+
* ```ts
|
|
64
|
+
* App.create(options).route('/', mcp({ fetch: (request) => getApp().fetch(request) }))
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export function mcp(options: mcp.Options) {
|
|
68
|
+
const { docs = 'https://mcp.tempo.xyz/mcp', fetch, name = 'tapimo', version = '0.0.0' } = options
|
|
69
|
+
|
|
70
|
+
// One incur instance per caller origin: the OpenAPI document is parsed once,
|
|
71
|
+
// and generated commands rebase onto the origin so tool results embed real
|
|
72
|
+
// absolute URLs (e.g. token asset URIs).
|
|
73
|
+
const clis = new Map<string, ReturnType<typeof build>>()
|
|
74
|
+
|
|
75
|
+
function resolve(origin: string) {
|
|
76
|
+
let cli = clis.get(origin)
|
|
77
|
+
if (!cli) {
|
|
78
|
+
cli = build(origin)
|
|
79
|
+
clis.set(origin, cli)
|
|
80
|
+
// A failed build (spec fetch or docs resolution) retries next request.
|
|
81
|
+
cli.catch(() => clis.delete(origin))
|
|
82
|
+
}
|
|
83
|
+
return cli
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function build(origin: string) {
|
|
87
|
+
const response = await fetch(new Request(new URL('/openapi.json', origin)))
|
|
88
|
+
if (!response.ok) throw new Error(`openapi.json request failed: ${response.status}`)
|
|
89
|
+
const document = (await response.json()) as Document
|
|
90
|
+
const cli = incur_Cli.create(name, {
|
|
91
|
+
description: 'Tempo API',
|
|
92
|
+
// Generated commands build requests against `http://localhost`; rebase
|
|
93
|
+
// them onto the caller origin and dispatch in-process.
|
|
94
|
+
fetch: (request) => {
|
|
95
|
+
const url = new URL(request.url)
|
|
96
|
+
return fetch(new Request(new URL(url.pathname + url.search, origin), request))
|
|
97
|
+
},
|
|
98
|
+
mcp: { instructions },
|
|
99
|
+
openapi: scope(document),
|
|
100
|
+
openapiConfig: { forwardHeaders: ['authorization'], mode: 'namespace' },
|
|
101
|
+
version,
|
|
102
|
+
})
|
|
103
|
+
if (docs !== false)
|
|
104
|
+
cli.command('docs', { description: 'Search the Tempo documentation.', mcp: docs })
|
|
105
|
+
return cli
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async function handler(c: Context<App.Environment>) {
|
|
109
|
+
const cli = await resolve(new URL(c.req.url).origin)
|
|
110
|
+
// incur routes on the first path segment; pin the path to `/mcp` so a
|
|
111
|
+
// mount prefix never leaks into its router.
|
|
112
|
+
return cli.fetch(new Request(new URL('/mcp', c.req.url), c.req.raw))
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// The documented POST carries the auth policy (described routes are
|
|
116
|
+
// default-closed); other methods fall through to the bare route and incur's 405.
|
|
117
|
+
const app = new Hono<App.Environment>()
|
|
118
|
+
.post(
|
|
119
|
+
'/mcp',
|
|
120
|
+
Auth.policy({ apiKey: { scopes: [] }, public: true }),
|
|
121
|
+
OpenApi.describeRoute({
|
|
122
|
+
description:
|
|
123
|
+
"A stateless streamable-HTTP MCP server: send JSON-RPC 2.0 messages as `POST` with `Accept: application/json, text/event-stream`. Tools mirror the API's data domain, plus `docs_*` documentation search. Anonymous requests use the public quota; send `Authorization: Bearer <api key>` for protected tools.",
|
|
124
|
+
operationId: 'mcpRequest',
|
|
125
|
+
// The JSON-RPC request envelope is protocol-owned (like `/rpc`), so the
|
|
126
|
+
// body documents an example rather than a schema.
|
|
127
|
+
requestBody: {
|
|
128
|
+
content: {
|
|
129
|
+
'application/json': {
|
|
130
|
+
example: { jsonrpc: '2.0', id: 1, method: 'tools/list', params: {} },
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
required: true,
|
|
134
|
+
},
|
|
135
|
+
responses: {
|
|
136
|
+
200: {
|
|
137
|
+
content: {
|
|
138
|
+
'application/json': {
|
|
139
|
+
example: {
|
|
140
|
+
jsonrpc: '2.0',
|
|
141
|
+
id: 1,
|
|
142
|
+
result: { tools: [{ name: 'v1_tokens_get', description: 'List tokens' }] },
|
|
143
|
+
},
|
|
144
|
+
schema: OpenApi.resolver(schema.Response),
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
description: 'JSON-RPC response returned by the MCP server.',
|
|
148
|
+
headers: { ...OpenApi.successHeaders },
|
|
149
|
+
},
|
|
150
|
+
202: {
|
|
151
|
+
description:
|
|
152
|
+
'The message was a notification or client response; there is nothing to return.',
|
|
153
|
+
},
|
|
154
|
+
400: {
|
|
155
|
+
content: { 'application/json': { schema: OpenApi.resolver(schema.Response) } },
|
|
156
|
+
description:
|
|
157
|
+
'Malformed or invalid MCP message, returned as a JSON-RPC error response rather than the standard error envelope. A malformed API key returns the standard `400` envelope instead.',
|
|
158
|
+
},
|
|
159
|
+
401: OpenApi.standardError(
|
|
160
|
+
401,
|
|
161
|
+
'The presented API key is invalid. Anonymous requests are allowed under the public quota.',
|
|
162
|
+
['api_key_invalid'],
|
|
163
|
+
),
|
|
164
|
+
406: {
|
|
165
|
+
content: { 'application/json': { schema: OpenApi.resolver(schema.Response) } },
|
|
166
|
+
description:
|
|
167
|
+
'The `Accept` header must include both `application/json` and `text/event-stream`. Returned as a JSON-RPC error response.',
|
|
168
|
+
},
|
|
169
|
+
429: OpenApi.standardError(429, 'Rate limit exceeded.'),
|
|
170
|
+
500: OpenApi.standardError(500, 'Internal server error.'),
|
|
171
|
+
},
|
|
172
|
+
summary: 'Call MCP',
|
|
173
|
+
tags: ['MCP'],
|
|
174
|
+
}),
|
|
175
|
+
handler,
|
|
176
|
+
)
|
|
177
|
+
.all('/mcp', handler)
|
|
178
|
+
return Metadata.attach(app, openapi)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** The OpenAPI metadata this group owns: the MCP endpoint's tag, surfaced under the `Data API` group. */
|
|
182
|
+
const openapi = {
|
|
183
|
+
tags: [
|
|
184
|
+
{
|
|
185
|
+
name: 'MCP',
|
|
186
|
+
description:
|
|
187
|
+
'A hosted Model Context Protocol server: the data domain and Tempo docs exposed as tools.',
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
'x-tagGroups': [{ name: tagGroup, tags: ['MCP'] }],
|
|
191
|
+
} satisfies App.create.Metadata
|
|
192
|
+
|
|
193
|
+
/** The slice of the OpenAPI document the domain filter reads. */
|
|
194
|
+
type Document = Openapi.OpenAPISpec & {
|
|
195
|
+
paths: Record<string, Record<string, unknown>>
|
|
196
|
+
'x-tagGroups'?: readonly { name: string; tags: readonly string[] }[] | undefined
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** HTTP methods that carry operations in an OpenAPI path item. */
|
|
200
|
+
const methods: readonly string[] = ['delete', 'get', 'head', 'options', 'patch', 'post', 'put', 'trace'] // prettier-ignore
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Narrows the document to the data domain: operations tagged inside the
|
|
204
|
+
* `Data API` tag group, minus excluded tags. Platform, relay, and session
|
|
205
|
+
* operations never surface as tools.
|
|
206
|
+
*/
|
|
207
|
+
function scope(document: Document): Openapi.OpenAPISpec {
|
|
208
|
+
const group = document['x-tagGroups']?.find((entry) => entry.name === tagGroup)
|
|
209
|
+
if (!group) throw new Error(`openapi.json is missing the "${tagGroup}" tag group`)
|
|
210
|
+
const tags = new Set(group.tags.filter((tag) => !excludedTags.includes(tag)))
|
|
211
|
+
const paths: Document['paths'] = {}
|
|
212
|
+
for (const [path, item] of Object.entries(document.paths)) {
|
|
213
|
+
// Keep in-domain operations; non-method keys (parameters, summary) ride along.
|
|
214
|
+
const entries = Object.entries(item).filter(([method, operation]) => {
|
|
215
|
+
if (!methods.includes(method)) return true
|
|
216
|
+
const tags_operation = (operation as { tags?: readonly string[] | undefined }).tags
|
|
217
|
+
return tags_operation?.some((tag) => tags.has(tag)) ?? false
|
|
218
|
+
})
|
|
219
|
+
if (entries.some(([method]) => methods.includes(method)))
|
|
220
|
+
paths[path] = Object.fromEntries(entries)
|
|
221
|
+
}
|
|
222
|
+
return { ...document, paths }
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export declare namespace mcp {
|
|
226
|
+
/** Options for the MCP route group. */
|
|
227
|
+
type Options = {
|
|
228
|
+
/** Remote docs MCP source mounted as the `docs` tool group, or `false` to omit it. @default 'https://mcp.tempo.xyz/mcp' */
|
|
229
|
+
docs?: Source | false | undefined
|
|
230
|
+
/** In-process fetch handler for the composed app (e.g. `(request) => app.fetch(request)`). */
|
|
231
|
+
fetch: (request: Request) => Response | Promise<Response>
|
|
232
|
+
/** MCP server name. @default 'tapimo' */
|
|
233
|
+
name?: string | undefined
|
|
234
|
+
/** MCP server version. @default '0.0.0' */
|
|
235
|
+
version?: string | undefined
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** A remote streamable-HTTP MCP server endpoint. */
|
|
239
|
+
type Source =
|
|
240
|
+
| string
|
|
241
|
+
| URL
|
|
242
|
+
| {
|
|
243
|
+
/** Fetch handler used for MCP requests. Defaults to `globalThis.fetch`. */
|
|
244
|
+
fetch?: ((request: Request) => Response | Promise<Response>) | undefined
|
|
245
|
+
/** Headers merged into every MCP request. */
|
|
246
|
+
headers?: Record<string, string> | undefined
|
|
247
|
+
/** Streamable-HTTP MCP endpoint URL. */
|
|
248
|
+
url: string | URL
|
|
249
|
+
}
|
|
250
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Hono } from 'hono'
|
|
2
|
+
|
|
3
|
+
import type * as App from '../App.js'
|
|
4
|
+
|
|
5
|
+
// Hono's `.route()` drops sub-app metadata, so a group's OpenAPI metadata can't
|
|
6
|
+
// ride the instance through it. Each group attaches its metadata here and
|
|
7
|
+
// `App.create` reads it back on mount. The `WeakMap` keeps the association off
|
|
8
|
+
// the app's type, so `testClient`/`hc` inference is untouched.
|
|
9
|
+
const registry = new WeakMap<Hono<any, any>, App.create.Metadata>()
|
|
10
|
+
|
|
11
|
+
/** Attaches a group's OpenAPI metadata to its app instance for `create` to collect on mount. */
|
|
12
|
+
export function attach<const app extends Hono<any, any>>(
|
|
13
|
+
app: app,
|
|
14
|
+
metadata: App.create.Metadata,
|
|
15
|
+
): app {
|
|
16
|
+
registry.set(app, metadata)
|
|
17
|
+
return app
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Reads the OpenAPI metadata attached to an app instance, if any. */
|
|
21
|
+
export function read(app: Hono<any, any>): App.create.Metadata | undefined {
|
|
22
|
+
return registry.get(app)
|
|
23
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { Hono } from 'hono'
|
|
2
|
+
import type Stripe from 'stripe'
|
|
3
|
+
|
|
4
|
+
import type * as App from '../../App.js'
|
|
5
|
+
import * as Metadata from '../metadata.js'
|
|
6
|
+
|
|
7
|
+
import { apiKeys } from './routes/api-keys.js'
|
|
8
|
+
import { billing } from './routes/billing.js'
|
|
9
|
+
import { invitations } from './routes/invitations.js'
|
|
10
|
+
import { me } from './routes/me.js'
|
|
11
|
+
import { members } from './routes/members.js'
|
|
12
|
+
import { orgs } from './routes/orgs.js'
|
|
13
|
+
import { projects } from './routes/projects.js'
|
|
14
|
+
import { scopes } from './routes/scopes.js'
|
|
15
|
+
import { usage } from './routes/usage.js'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Minimal transactional email sender. Cloudflare deployments wrap the Email
|
|
19
|
+
* Service binding (`{ from, send: (m) => env.EMAIL.send(m) }`); other hosts
|
|
20
|
+
* pass any compatible sender. Dispatch is always best-effort.
|
|
21
|
+
*/
|
|
22
|
+
export type Email = {
|
|
23
|
+
/** Console URL embedded in email links (e.g. sign-in URLs). Defaults to the hosted console; self-hosts point it at their own. */
|
|
24
|
+
consoleUrl?: string | undefined
|
|
25
|
+
/** Sender address for platform emails (e.g. `noreply@tempo.xyz`). */
|
|
26
|
+
from: string
|
|
27
|
+
/** Sends one message. */
|
|
28
|
+
send: (message: Email.Message) => Promise<unknown>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare namespace Email {
|
|
32
|
+
/** One transactional message. */
|
|
33
|
+
type Message = {
|
|
34
|
+
/** Sender address. */
|
|
35
|
+
from: string
|
|
36
|
+
/** HTML body. */
|
|
37
|
+
html?: string | undefined
|
|
38
|
+
/** Subject line. */
|
|
39
|
+
subject: string
|
|
40
|
+
/** Plain-text body. */
|
|
41
|
+
text: string
|
|
42
|
+
/** Recipient address. */
|
|
43
|
+
to: string
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Billing capability, one bag per billing source; Stripe is the sole source today. */
|
|
48
|
+
export type Billing = {
|
|
49
|
+
/**
|
|
50
|
+
* Stripe billing source.
|
|
51
|
+
*/
|
|
52
|
+
stripe: {
|
|
53
|
+
/** Constructed Stripe client. */
|
|
54
|
+
client: Stripe
|
|
55
|
+
/** Console URL for Checkout/portal return links when the request carries no `Origin`. Defaults to the hosted console. */
|
|
56
|
+
consoleUrl?: string | undefined
|
|
57
|
+
/** Test-mode Stripe backing sandbox billing; omit to keep sandbox billing 501. */
|
|
58
|
+
sandbox?:
|
|
59
|
+
| {
|
|
60
|
+
/** Constructed test-mode Stripe client. */
|
|
61
|
+
client: Stripe
|
|
62
|
+
/** Test-mode webhook endpoint signing secret (`whsec_…`). */
|
|
63
|
+
webhookSecret: string
|
|
64
|
+
}
|
|
65
|
+
| undefined
|
|
66
|
+
/** Webhook endpoint signing secret (`whsec_…`). */
|
|
67
|
+
webhookSecret: string
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Request environment for platform routes: the shared app environment plus the
|
|
73
|
+
* capabilities this group publishes on context (`billing`, `email`). Owned
|
|
74
|
+
* here, not in core `App.Environment`, since these are platform concerns.
|
|
75
|
+
*/
|
|
76
|
+
export type Environment = {
|
|
77
|
+
Variables: App.Environment['Variables'] & {
|
|
78
|
+
/** Stripe billing capability; undefined when billing is unconfigured. */
|
|
79
|
+
billing: Billing | undefined
|
|
80
|
+
/** Transactional email sender for platform emails; undefined when dispatch is disabled. */
|
|
81
|
+
email: Email | undefined
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The tenant-platform route group: the current user, orgs, projects, members,
|
|
87
|
+
* invitations, and API-key management. Every route reads its dependencies from
|
|
88
|
+
* request context set by {@link App.create}.
|
|
89
|
+
*
|
|
90
|
+
* The session-auth surface (`/v1/auth/siwe` + `session` capability) is owned by
|
|
91
|
+
* {@link App.create}, so platform routes gate on a session without owning it.
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* App.create(options).route('/', platform())
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export function platform(options: platform.Options = {}) {
|
|
98
|
+
const app = new Hono<Environment>()
|
|
99
|
+
// Publish this group's capabilities for handlers; undefined disables each.
|
|
100
|
+
.use('*', async (c, next) => {
|
|
101
|
+
c.set('billing', options.billing)
|
|
102
|
+
c.set('email', options.email)
|
|
103
|
+
await next()
|
|
104
|
+
})
|
|
105
|
+
.route('/', apiKeys({ enabled: options.apiKeys !== false }))
|
|
106
|
+
.route('/', billing())
|
|
107
|
+
.route('/', invitations())
|
|
108
|
+
.route('/', me())
|
|
109
|
+
.route('/', members())
|
|
110
|
+
.route('/', orgs())
|
|
111
|
+
.route('/', projects())
|
|
112
|
+
.route('/', scopes())
|
|
113
|
+
.route('/', usage())
|
|
114
|
+
return Metadata.attach(app, openapi)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export declare namespace platform {
|
|
118
|
+
/** Options for the platform route group. */
|
|
119
|
+
type Options = {
|
|
120
|
+
/** Expose the API-key management routes in the OpenAPI document. @default true */
|
|
121
|
+
apiKeys?: boolean | undefined
|
|
122
|
+
/** Stripe billing capability; omit to disable billing routes (501) and keep production sponsorship closed. */
|
|
123
|
+
billing?: Billing | undefined
|
|
124
|
+
/** Transactional email sender for platform emails (e.g. invitations); omit to disable dispatch — notified flows still work in-product. */
|
|
125
|
+
email?: Email | undefined
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The OpenAPI metadata this group owns: platform operation tags and the
|
|
131
|
+
* `session` security scheme. Tagged onto the {@link platform} instance so
|
|
132
|
+
* `App.create` collects it.
|
|
133
|
+
*/
|
|
134
|
+
const openapi = {
|
|
135
|
+
securitySchemes: {
|
|
136
|
+
session: {
|
|
137
|
+
description: 'Cookie session established by sign-in (`POST /v1/auth/siwe`). Clients may also send the session token as `Authorization: Bearer <token>`.', // prettier-ignore
|
|
138
|
+
in: 'cookie',
|
|
139
|
+
name: 'accounts_auth',
|
|
140
|
+
type: 'apiKey',
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
tags: [
|
|
144
|
+
{ name: 'API Keys', description: 'Credentials for accessing the Tempo API.' },
|
|
145
|
+
{ name: 'Billing', description: 'Organization billing backed by Stripe.' },
|
|
146
|
+
{ name: 'Invitations', description: 'Pending organization invitations.' },
|
|
147
|
+
{ name: 'Members', description: 'Organization team membership.' },
|
|
148
|
+
{ name: 'Organizations', description: 'Teams that own application workspaces and members.' },
|
|
149
|
+
{ name: 'Projects', description: 'Application workspaces within an organization.' },
|
|
150
|
+
{ name: 'Usage', description: 'Request and sponsorship usage for organizations.' },
|
|
151
|
+
{ name: 'Users', description: 'Users on the Tempo Platform.' },
|
|
152
|
+
],
|
|
153
|
+
'x-tagGroups': [
|
|
154
|
+
{
|
|
155
|
+
name: 'Platform API',
|
|
156
|
+
tags: [
|
|
157
|
+
'API Keys',
|
|
158
|
+
'Authentication',
|
|
159
|
+
'Billing',
|
|
160
|
+
'Invitations',
|
|
161
|
+
'Members',
|
|
162
|
+
'Organizations',
|
|
163
|
+
'Projects',
|
|
164
|
+
'Usage',
|
|
165
|
+
'Users',
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
} satisfies App.create.Metadata
|