@dotdo/do 0.1.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 +400 -0
- package/dist/ai/embeddings.d.ts +129 -0
- package/dist/ai/embeddings.d.ts.map +1 -0
- package/dist/ai/embeddings.js +217 -0
- package/dist/ai/embeddings.js.map +1 -0
- package/dist/ai/gateway.d.ts +139 -0
- package/dist/ai/gateway.d.ts.map +1 -0
- package/dist/ai/gateway.js +179 -0
- package/dist/ai/gateway.js.map +1 -0
- package/dist/ai/image.d.ts +140 -0
- package/dist/ai/image.d.ts.map +1 -0
- package/dist/ai/image.js +199 -0
- package/dist/ai/image.js.map +1 -0
- package/dist/ai/index.d.ts +98 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +223 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/models.d.ts +81 -0
- package/dist/ai/models.d.ts.map +1 -0
- package/dist/ai/models.js +537 -0
- package/dist/ai/models.js.map +1 -0
- package/dist/ai/text.d.ts +176 -0
- package/dist/ai/text.d.ts.map +1 -0
- package/dist/ai/text.js +253 -0
- package/dist/ai/text.js.map +1 -0
- package/dist/ai/voice/agents.d.ts +224 -0
- package/dist/ai/voice/agents.d.ts.map +1 -0
- package/dist/ai/voice/agents.js +375 -0
- package/dist/ai/voice/agents.js.map +1 -0
- package/dist/ai/voice/campaigns.d.ts +307 -0
- package/dist/ai/voice/campaigns.d.ts.map +1 -0
- package/dist/ai/voice/campaigns.js +739 -0
- package/dist/ai/voice/campaigns.js.map +1 -0
- package/dist/ai/voice/index.d.ts +21 -0
- package/dist/ai/voice/index.d.ts.map +1 -0
- package/dist/ai/voice/index.js +42 -0
- package/dist/ai/voice/index.js.map +1 -0
- package/dist/ai/voice/providers.d.ts +283 -0
- package/dist/ai/voice/providers.d.ts.map +1 -0
- package/dist/ai/voice/providers.js +286 -0
- package/dist/ai/voice/providers.js.map +1 -0
- package/dist/ai/voice/sessions.d.ts +294 -0
- package/dist/ai/voice/sessions.d.ts.map +1 -0
- package/dist/ai/voice/sessions.js +531 -0
- package/dist/ai/voice/sessions.js.map +1 -0
- package/dist/ai/voice/tools.d.ts +242 -0
- package/dist/ai/voice/tools.d.ts.map +1 -0
- package/dist/ai/voice/tools.js +370 -0
- package/dist/ai/voice/tools.js.map +1 -0
- package/dist/ai/voice/tts.d.ts +173 -0
- package/dist/ai/voice/tts.d.ts.map +1 -0
- package/dist/ai/voice/tts.js +252 -0
- package/dist/ai/voice/tts.js.map +1 -0
- package/dist/ai/voice/webrtc.d.ts +228 -0
- package/dist/ai/voice/webrtc.d.ts.map +1 -0
- package/dist/ai/voice/webrtc.js +372 -0
- package/dist/ai/voice/webrtc.js.map +1 -0
- package/dist/api/index.d.ts +103 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +191 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/mcp/handlers.d.ts +25 -0
- package/dist/api/mcp/handlers.d.ts.map +1 -0
- package/dist/api/mcp/handlers.js +422 -0
- package/dist/api/mcp/handlers.js.map +1 -0
- package/dist/api/mcp/index.d.ts +113 -0
- package/dist/api/mcp/index.d.ts.map +1 -0
- package/dist/api/mcp/index.js +141 -0
- package/dist/api/mcp/index.js.map +1 -0
- package/dist/api/middleware/auth.d.ts +65 -0
- package/dist/api/middleware/auth.d.ts.map +1 -0
- package/dist/api/middleware/auth.js +271 -0
- package/dist/api/middleware/auth.js.map +1 -0
- package/dist/api/middleware/cors.d.ts +62 -0
- package/dist/api/middleware/cors.d.ts.map +1 -0
- package/dist/api/middleware/cors.js +225 -0
- package/dist/api/middleware/cors.js.map +1 -0
- package/dist/api/middleware/index.d.ts +60 -0
- package/dist/api/middleware/index.d.ts.map +1 -0
- package/dist/api/middleware/index.js +175 -0
- package/dist/api/middleware/index.js.map +1 -0
- package/dist/api/middleware/rateLimit.d.ts +84 -0
- package/dist/api/middleware/rateLimit.d.ts.map +1 -0
- package/dist/api/middleware/rateLimit.js +321 -0
- package/dist/api/middleware/rateLimit.js.map +1 -0
- package/dist/api/routes/ai.d.ts +17 -0
- package/dist/api/routes/ai.d.ts.map +1 -0
- package/dist/api/routes/ai.js +430 -0
- package/dist/api/routes/ai.js.map +1 -0
- package/dist/api/routes/do.d.ts +17 -0
- package/dist/api/routes/do.d.ts.map +1 -0
- package/dist/api/routes/do.js +458 -0
- package/dist/api/routes/do.js.map +1 -0
- package/dist/api/routes/functions.d.ts +111 -0
- package/dist/api/routes/functions.d.ts.map +1 -0
- package/dist/api/routes/functions.js +548 -0
- package/dist/api/routes/functions.js.map +1 -0
- package/dist/api/routes/health.d.ts +16 -0
- package/dist/api/routes/health.d.ts.map +1 -0
- package/dist/api/routes/health.js +163 -0
- package/dist/api/routes/health.js.map +1 -0
- package/dist/api/routes/index.d.ts +41 -0
- package/dist/api/routes/index.d.ts.map +1 -0
- package/dist/api/routes/index.js +275 -0
- package/dist/api/routes/index.js.map +1 -0
- package/dist/api/routes/nouns.d.ts +26 -0
- package/dist/api/routes/nouns.d.ts.map +1 -0
- package/dist/api/routes/nouns.js +456 -0
- package/dist/api/routes/nouns.js.map +1 -0
- package/dist/api/routes/orgs.d.ts +17 -0
- package/dist/api/routes/orgs.d.ts.map +1 -0
- package/dist/api/routes/orgs.js +560 -0
- package/dist/api/routes/orgs.js.map +1 -0
- package/dist/api/routes/relationships.d.ts +30 -0
- package/dist/api/routes/relationships.d.ts.map +1 -0
- package/dist/api/routes/relationships.js +360 -0
- package/dist/api/routes/relationships.js.map +1 -0
- package/dist/api/routes/roles.d.ts +17 -0
- package/dist/api/routes/roles.d.ts.map +1 -0
- package/dist/api/routes/roles.js +721 -0
- package/dist/api/routes/roles.js.map +1 -0
- package/dist/api/routes/things.d.ts +27 -0
- package/dist/api/routes/things.d.ts.map +1 -0
- package/dist/api/routes/things.js +568 -0
- package/dist/api/routes/things.js.map +1 -0
- package/dist/api/routes/users.d.ts +17 -0
- package/dist/api/routes/users.d.ts.map +1 -0
- package/dist/api/routes/users.js +401 -0
- package/dist/api/routes/users.js.map +1 -0
- package/dist/api/routes/verbs.d.ts +31 -0
- package/dist/api/routes/verbs.d.ts.map +1 -0
- package/dist/api/routes/verbs.js +505 -0
- package/dist/api/routes/verbs.js.map +1 -0
- package/dist/api/routes/workflows.d.ts +44 -0
- package/dist/api/routes/workflows.d.ts.map +1 -0
- package/dist/api/routes/workflows.js +521 -0
- package/dist/api/routes/workflows.js.map +1 -0
- package/dist/api/types.d.ts +370 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +11 -0
- package/dist/api/types.js.map +1 -0
- package/dist/db/cdc/events.d.ts +201 -0
- package/dist/db/cdc/events.d.ts.map +1 -0
- package/dist/db/cdc/events.js +271 -0
- package/dist/db/cdc/events.js.map +1 -0
- package/dist/db/cdc/index.d.ts +13 -0
- package/dist/db/cdc/index.d.ts.map +1 -0
- package/dist/db/cdc/index.js +16 -0
- package/dist/db/cdc/index.js.map +1 -0
- package/dist/db/cdc/replay.d.ts +388 -0
- package/dist/db/cdc/replay.d.ts.map +1 -0
- package/dist/db/cdc/replay.js +469 -0
- package/dist/db/cdc/replay.js.map +1 -0
- package/dist/db/cdc/storage.d.ts +567 -0
- package/dist/db/cdc/storage.d.ts.map +1 -0
- package/dist/db/cdc/storage.js +856 -0
- package/dist/db/cdc/storage.js.map +1 -0
- package/dist/db/cdc/streaming.d.ts +459 -0
- package/dist/db/cdc/streaming.d.ts.map +1 -0
- package/dist/db/cdc/streaming.js +636 -0
- package/dist/db/cdc/streaming.js.map +1 -0
- package/dist/db/collections/actions.d.ts +440 -0
- package/dist/db/collections/actions.d.ts.map +1 -0
- package/dist/db/collections/actions.js +631 -0
- package/dist/db/collections/actions.js.map +1 -0
- package/dist/db/collections/base.d.ts +342 -0
- package/dist/db/collections/base.d.ts.map +1 -0
- package/dist/db/collections/base.js +510 -0
- package/dist/db/collections/base.js.map +1 -0
- package/dist/db/collections/index.d.ts +50 -0
- package/dist/db/collections/index.d.ts.map +1 -0
- package/dist/db/collections/index.js +48 -0
- package/dist/db/collections/index.js.map +1 -0
- package/dist/db/collections/nouns.d.ts +260 -0
- package/dist/db/collections/nouns.d.ts.map +1 -0
- package/dist/db/collections/nouns.js +273 -0
- package/dist/db/collections/nouns.js.map +1 -0
- package/dist/db/collections/relationships.d.ts +484 -0
- package/dist/db/collections/relationships.d.ts.map +1 -0
- package/dist/db/collections/relationships.js +815 -0
- package/dist/db/collections/relationships.js.map +1 -0
- package/dist/db/collections/things.d.ts +439 -0
- package/dist/db/collections/things.d.ts.map +1 -0
- package/dist/db/collections/things.js +603 -0
- package/dist/db/collections/things.js.map +1 -0
- package/dist/db/collections/verbs.d.ts +308 -0
- package/dist/db/collections/verbs.d.ts.map +1 -0
- package/dist/db/collections/verbs.js +480 -0
- package/dist/db/collections/verbs.js.map +1 -0
- package/dist/db/index.d.ts +14 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +23 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/storage/cold.d.ts +313 -0
- package/dist/db/storage/cold.d.ts.map +1 -0
- package/dist/db/storage/cold.js +319 -0
- package/dist/db/storage/cold.js.map +1 -0
- package/dist/db/storage/hot.d.ts +340 -0
- package/dist/db/storage/hot.d.ts.map +1 -0
- package/dist/db/storage/hot.js +333 -0
- package/dist/db/storage/hot.js.map +1 -0
- package/dist/db/storage/index.d.ts +242 -0
- package/dist/db/storage/index.d.ts.map +1 -0
- package/dist/db/storage/index.js +109 -0
- package/dist/db/storage/index.js.map +1 -0
- package/dist/db/storage/snapshots.d.ts +342 -0
- package/dist/db/storage/snapshots.d.ts.map +1 -0
- package/dist/db/storage/snapshots.js +298 -0
- package/dist/db/storage/snapshots.js.map +1 -0
- package/dist/db/storage/vortex.d.ts +324 -0
- package/dist/db/storage/vortex.d.ts.map +1 -0
- package/dist/db/storage/vortex.js +365 -0
- package/dist/db/storage/vortex.js.map +1 -0
- package/dist/db/storage/warm.d.ts +306 -0
- package/dist/db/storage/warm.d.ts.map +1 -0
- package/dist/db/storage/warm.js +339 -0
- package/dist/db/storage/warm.js.map +1 -0
- package/dist/do/DigitalObject.d.ts +595 -0
- package/dist/do/DigitalObject.d.ts.map +1 -0
- package/dist/do/DigitalObject.js +971 -0
- package/dist/do/DigitalObject.js.map +1 -0
- package/dist/do/business/financial/accounting.d.ts +436 -0
- package/dist/do/business/financial/accounting.d.ts.map +1 -0
- package/dist/do/business/financial/accounting.js +476 -0
- package/dist/do/business/financial/accounting.js.map +1 -0
- package/dist/do/business/financial/index.d.ts +15 -0
- package/dist/do/business/financial/index.d.ts.map +1 -0
- package/dist/do/business/financial/index.js +20 -0
- package/dist/do/business/financial/index.js.map +1 -0
- package/dist/do/business/financial/metrics.d.ts +370 -0
- package/dist/do/business/financial/metrics.d.ts.map +1 -0
- package/dist/do/business/financial/metrics.js +376 -0
- package/dist/do/business/financial/metrics.js.map +1 -0
- package/dist/do/business/financial/payments.d.ts +397 -0
- package/dist/do/business/financial/payments.d.ts.map +1 -0
- package/dist/do/business/financial/payments.js +395 -0
- package/dist/do/business/financial/payments.js.map +1 -0
- package/dist/do/business/financial/reports.d.ts +284 -0
- package/dist/do/business/financial/reports.d.ts.map +1 -0
- package/dist/do/business/financial/reports.js +347 -0
- package/dist/do/business/financial/reports.js.map +1 -0
- package/dist/do/business/financial/stripe.d.ts +254 -0
- package/dist/do/business/financial/stripe.d.ts.map +1 -0
- package/dist/do/business/financial/stripe.js +261 -0
- package/dist/do/business/financial/stripe.js.map +1 -0
- package/dist/do/business/financial/subscriptions.d.ts +402 -0
- package/dist/do/business/financial/subscriptions.d.ts.map +1 -0
- package/dist/do/business/financial/subscriptions.js +349 -0
- package/dist/do/business/financial/subscriptions.js.map +1 -0
- package/dist/do/business/index.d.ts +9 -0
- package/dist/do/business/index.d.ts.map +1 -0
- package/dist/do/business/index.js +10 -0
- package/dist/do/business/index.js.map +1 -0
- package/dist/do/colo/followers.d.ts +194 -0
- package/dist/do/colo/followers.d.ts.map +1 -0
- package/dist/do/colo/followers.js +224 -0
- package/dist/do/colo/followers.js.map +1 -0
- package/dist/do/colo/fork.d.ts +103 -0
- package/dist/do/colo/fork.d.ts.map +1 -0
- package/dist/do/colo/fork.js +143 -0
- package/dist/do/colo/fork.js.map +1 -0
- package/dist/do/colo/index.d.ts +181 -0
- package/dist/do/colo/index.d.ts.map +1 -0
- package/dist/do/colo/index.js +145 -0
- package/dist/do/colo/index.js.map +1 -0
- package/dist/do/colo/info.d.ts +106 -0
- package/dist/do/colo/info.d.ts.map +1 -0
- package/dist/do/colo/info.js +196 -0
- package/dist/do/colo/info.js.map +1 -0
- package/dist/do/colo/migrate.d.ts +161 -0
- package/dist/do/colo/migrate.d.ts.map +1 -0
- package/dist/do/colo/migrate.js +190 -0
- package/dist/do/colo/migrate.js.map +1 -0
- package/dist/do/colo/routing.d.ts +182 -0
- package/dist/do/colo/routing.d.ts.map +1 -0
- package/dist/do/colo/routing.js +254 -0
- package/dist/do/colo/routing.js.map +1 -0
- package/dist/do/domains/dns.d.ts +269 -0
- package/dist/do/domains/dns.d.ts.map +1 -0
- package/dist/do/domains/dns.js +215 -0
- package/dist/do/domains/dns.js.map +1 -0
- package/dist/do/domains/index.d.ts +40 -0
- package/dist/do/domains/index.d.ts.map +1 -0
- package/dist/do/domains/index.js +61 -0
- package/dist/do/domains/index.js.map +1 -0
- package/dist/do/domains/routing.d.ts +263 -0
- package/dist/do/domains/routing.d.ts.map +1 -0
- package/dist/do/domains/routing.js +362 -0
- package/dist/do/domains/routing.js.map +1 -0
- package/dist/do/domains/ssl.d.ts +217 -0
- package/dist/do/domains/ssl.d.ts.map +1 -0
- package/dist/do/domains/ssl.js +231 -0
- package/dist/do/domains/ssl.js.map +1 -0
- package/dist/do/domains/subdomains.d.ts +207 -0
- package/dist/do/domains/subdomains.d.ts.map +1 -0
- package/dist/do/domains/subdomains.js +223 -0
- package/dist/do/domains/subdomains.js.map +1 -0
- package/dist/do/domains/tlds.d.ts +175 -0
- package/dist/do/domains/tlds.d.ts.map +1 -0
- package/dist/do/domains/tlds.js +188 -0
- package/dist/do/domains/tlds.js.map +1 -0
- package/dist/do/domains/validation.d.ts +164 -0
- package/dist/do/domains/validation.d.ts.map +1 -0
- package/dist/do/domains/validation.js +290 -0
- package/dist/do/domains/validation.js.map +1 -0
- package/dist/do/hibernation.d.ts +385 -0
- package/dist/do/hibernation.d.ts.map +1 -0
- package/dist/do/hibernation.js +518 -0
- package/dist/do/hibernation.js.map +1 -0
- package/dist/do/index.d.ts +19 -0
- package/dist/do/index.d.ts.map +1 -0
- package/dist/do/index.js +23 -0
- package/dist/do/index.js.map +1 -0
- package/dist/do/state.d.ts +336 -0
- package/dist/do/state.d.ts.map +1 -0
- package/dist/do/state.js +290 -0
- package/dist/do/state.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/rpc/client.d.ts +426 -0
- package/dist/rpc/client.d.ts.map +1 -0
- package/dist/rpc/client.js +826 -0
- package/dist/rpc/client.js.map +1 -0
- package/dist/rpc/index.d.ts +19 -0
- package/dist/rpc/index.d.ts.map +1 -0
- package/dist/rpc/index.js +23 -0
- package/dist/rpc/index.js.map +1 -0
- package/dist/rpc/methods.d.ts +364 -0
- package/dist/rpc/methods.d.ts.map +1 -0
- package/dist/rpc/methods.js +557 -0
- package/dist/rpc/methods.js.map +1 -0
- package/dist/rpc/protocol.d.ts +310 -0
- package/dist/rpc/protocol.d.ts.map +1 -0
- package/dist/rpc/protocol.js +672 -0
- package/dist/rpc/protocol.js.map +1 -0
- package/dist/rpc/routes.d.ts +332 -0
- package/dist/rpc/routes.d.ts.map +1 -0
- package/dist/rpc/routes.js +633 -0
- package/dist/rpc/routes.js.map +1 -0
- package/dist/rpc/server.d.ts +380 -0
- package/dist/rpc/server.d.ts.map +1 -0
- package/dist/rpc/server.js +850 -0
- package/dist/rpc/server.js.map +1 -0
- package/dist/sdk/auth.d.ts +201 -0
- package/dist/sdk/auth.d.ts.map +1 -0
- package/dist/sdk/auth.js +343 -0
- package/dist/sdk/auth.js.map +1 -0
- package/dist/sdk/client.d.ts +123 -0
- package/dist/sdk/client.d.ts.map +1 -0
- package/dist/sdk/client.js +403 -0
- package/dist/sdk/client.js.map +1 -0
- package/dist/sdk/index.d.ts +123 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +230 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/rpc.d.ts +275 -0
- package/dist/sdk/rpc.d.ts.map +1 -0
- package/dist/sdk/rpc.js +249 -0
- package/dist/sdk/rpc.js.map +1 -0
- package/dist/sdk/transport.d.ts +283 -0
- package/dist/sdk/transport.d.ts.map +1 -0
- package/dist/sdk/transport.js +661 -0
- package/dist/sdk/transport.js.map +1 -0
- package/dist/sdk/types.d.ts +265 -0
- package/dist/sdk/types.d.ts.map +1 -0
- package/dist/sdk/types.js +27 -0
- package/dist/sdk/types.js.map +1 -0
- package/dist/types/ai.d.ts +533 -0
- package/dist/types/ai.d.ts.map +1 -0
- package/dist/types/ai.js +18 -0
- package/dist/types/ai.js.map +1 -0
- package/dist/types/app.d.ts +371 -0
- package/dist/types/app.d.ts.map +1 -0
- package/dist/types/app.js +151 -0
- package/dist/types/app.js.map +1 -0
- package/dist/types/business.d.ts +482 -0
- package/dist/types/business.d.ts.map +1 -0
- package/dist/types/business.js +60 -0
- package/dist/types/business.js.map +1 -0
- package/dist/types/cascade.d.ts +323 -0
- package/dist/types/cascade.d.ts.map +1 -0
- package/dist/types/cascade.js +82 -0
- package/dist/types/cascade.js.map +1 -0
- package/dist/types/collections.d.ts +704 -0
- package/dist/types/collections.d.ts.map +1 -0
- package/dist/types/collections.js +23 -0
- package/dist/types/collections.js.map +1 -0
- package/dist/types/colo.d.ts +171 -0
- package/dist/types/colo.d.ts.map +1 -0
- package/dist/types/colo.js +63 -0
- package/dist/types/colo.js.map +1 -0
- package/dist/types/communication.d.ts +595 -0
- package/dist/types/communication.d.ts.map +1 -0
- package/dist/types/communication.js +16 -0
- package/dist/types/communication.js.map +1 -0
- package/dist/types/content.d.ts +286 -0
- package/dist/types/content.d.ts.map +1 -0
- package/dist/types/content.js +8 -0
- package/dist/types/content.js.map +1 -0
- package/dist/types/context.d.ts +407 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/context.js +36 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/databases.d.ts +377 -0
- package/dist/types/databases.d.ts.map +1 -0
- package/dist/types/databases.js +14 -0
- package/dist/types/databases.js.map +1 -0
- package/dist/types/domains.d.ts +132 -0
- package/dist/types/domains.d.ts.map +1 -0
- package/dist/types/domains.js +107 -0
- package/dist/types/domains.js.map +1 -0
- package/dist/types/execution.d.ts +381 -0
- package/dist/types/execution.d.ts.map +1 -0
- package/dist/types/execution.js +40 -0
- package/dist/types/execution.js.map +1 -0
- package/dist/types/financial.d.ts +608 -0
- package/dist/types/financial.d.ts.map +1 -0
- package/dist/types/financial.js +12 -0
- package/dist/types/financial.js.map +1 -0
- package/dist/types/functions.d.ts +215 -0
- package/dist/types/functions.d.ts.map +1 -0
- package/dist/types/functions.js +15 -0
- package/dist/types/functions.js.map +1 -0
- package/dist/types/git.d.ts +299 -0
- package/dist/types/git.d.ts.map +1 -0
- package/dist/types/git.js +17 -0
- package/dist/types/git.js.map +1 -0
- package/dist/types/identity.d.ts +141 -0
- package/dist/types/identity.d.ts.map +1 -0
- package/dist/types/identity.js +54 -0
- package/dist/types/identity.js.map +1 -0
- package/dist/types/index.d.ts +40 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +65 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/integrations.d.ts +356 -0
- package/dist/types/integrations.d.ts.map +1 -0
- package/dist/types/integrations.js +19 -0
- package/dist/types/integrations.js.map +1 -0
- package/dist/types/mdxui.d.ts +1955 -0
- package/dist/types/mdxui.d.ts.map +1 -0
- package/dist/types/mdxui.js +751 -0
- package/dist/types/mdxui.js.map +1 -0
- package/dist/types/observability.d.ts +315 -0
- package/dist/types/observability.d.ts.map +1 -0
- package/dist/types/observability.js +13 -0
- package/dist/types/observability.js.map +1 -0
- package/dist/types/rpc.d.ts +339 -0
- package/dist/types/rpc.d.ts.map +1 -0
- package/dist/types/rpc.js +24 -0
- package/dist/types/rpc.js.map +1 -0
- package/dist/types/saas.d.ts +678 -0
- package/dist/types/saas.d.ts.map +1 -0
- package/dist/types/saas.js +59 -0
- package/dist/types/saas.js.map +1 -0
- package/dist/types/service.d.ts +676 -0
- package/dist/types/service.d.ts.map +1 -0
- package/dist/types/service.js +69 -0
- package/dist/types/service.js.map +1 -0
- package/dist/types/site.d.ts +317 -0
- package/dist/types/site.d.ts.map +1 -0
- package/dist/types/site.js +203 -0
- package/dist/types/site.js.map +1 -0
- package/dist/types/startup.d.ts +576 -0
- package/dist/types/startup.d.ts.map +1 -0
- package/dist/types/startup.js +59 -0
- package/dist/types/startup.js.map +1 -0
- package/dist/types/storage.d.ts +276 -0
- package/dist/types/storage.d.ts.map +1 -0
- package/dist/types/storage.js +35 -0
- package/dist/types/storage.js.map +1 -0
- package/dist/types/telephony.d.ts +458 -0
- package/dist/types/telephony.d.ts.map +1 -0
- package/dist/types/telephony.js +19 -0
- package/dist/types/telephony.js.map +1 -0
- package/dist/types/tenant.d.ts +708 -0
- package/dist/types/tenant.d.ts.map +1 -0
- package/dist/types/tenant.js +103 -0
- package/dist/types/tenant.js.map +1 -0
- package/dist/types/voice-ai.d.ts +459 -0
- package/dist/types/voice-ai.d.ts.map +1 -0
- package/dist/types/voice-ai.js +32 -0
- package/dist/types/voice-ai.js.map +1 -0
- package/package.json +143 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colo Awareness Layer
|
|
3
|
+
*
|
|
4
|
+
* Geographic intelligence for Digital Objects. Know where your DOs live,
|
|
5
|
+
* move them where you need them.
|
|
6
|
+
*
|
|
7
|
+
* @module colo
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createColoOperations } from '@do/core/colo'
|
|
12
|
+
*
|
|
13
|
+
* // Create colo operations for a DO instance
|
|
14
|
+
* const colo = createColoOperations(doInstance)
|
|
15
|
+
*
|
|
16
|
+
* // Get current colo info
|
|
17
|
+
* const info = await colo.getInfo()
|
|
18
|
+
* // { colo: 'iad', region: 'enam', city: 'Ashburn', ... }
|
|
19
|
+
*
|
|
20
|
+
* // Fork to another region
|
|
21
|
+
* const replica = await colo.fork('fra', { continuous: true })
|
|
22
|
+
*
|
|
23
|
+
* // Migrate when usage patterns change
|
|
24
|
+
* await colo.migrate('nrt', { strategy: 'graceful' })
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
// Re-export individual operations
|
|
28
|
+
export { getColoInfo, getColoInfoByColo, listColos } from './info';
|
|
29
|
+
export { forkDO } from './fork';
|
|
30
|
+
export { migrateDO } from './migrate';
|
|
31
|
+
export { addFollower, removeFollower, listFollowers } from './followers';
|
|
32
|
+
export { findNearestColo, pingColo } from './routing';
|
|
33
|
+
/**
|
|
34
|
+
* Storage key prefixes for colo-related data
|
|
35
|
+
*/
|
|
36
|
+
export const COLO_STORAGE_KEYS = {
|
|
37
|
+
/** Current colo information */
|
|
38
|
+
COLO_INFO: 'colo:info',
|
|
39
|
+
/** List of follower DO references */
|
|
40
|
+
FOLLOWERS: 'colo:followers',
|
|
41
|
+
/** Replication configuration */
|
|
42
|
+
REPLICATION_CONFIG: 'colo:replication:config',
|
|
43
|
+
/** Current replication status */
|
|
44
|
+
REPLICATION_STATUS: 'colo:replication:status',
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Colo-related event names following NS.Object.event pattern
|
|
48
|
+
*/
|
|
49
|
+
export const COLO_EVENTS = {
|
|
50
|
+
/** Emitted when fork operation starts */
|
|
51
|
+
FORK_STARTED: 'Colo.Fork.started',
|
|
52
|
+
/** Emitted when fork operation completes successfully */
|
|
53
|
+
FORK_COMPLETED: 'Colo.Fork.completed',
|
|
54
|
+
/** Emitted when fork operation fails */
|
|
55
|
+
FORK_FAILED: 'Colo.Fork.failed',
|
|
56
|
+
/** Emitted when migration starts */
|
|
57
|
+
MIGRATION_STARTED: 'Colo.Migration.started',
|
|
58
|
+
/** Emitted when migration completes successfully */
|
|
59
|
+
MIGRATION_COMPLETED: 'Colo.Migration.completed',
|
|
60
|
+
/** Emitted when migration fails */
|
|
61
|
+
MIGRATION_FAILED: 'Colo.Migration.failed',
|
|
62
|
+
/** Emitted when a follower is added */
|
|
63
|
+
FOLLOWER_ADDED: 'Colo.Follower.added',
|
|
64
|
+
/** Emitted when a follower is removed */
|
|
65
|
+
FOLLOWER_REMOVED: 'Colo.Follower.removed',
|
|
66
|
+
/** Emitted when replication lag exceeds threshold */
|
|
67
|
+
REPLICATION_LAG_HIGH: 'Colo.Replication.lagHigh',
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Error codes for colo operations
|
|
71
|
+
*/
|
|
72
|
+
export const COLO_ERRORS = {
|
|
73
|
+
/** Invalid colo code provided */
|
|
74
|
+
INVALID_COLO: 'INVALID_COLO',
|
|
75
|
+
/** Migration operation failed */
|
|
76
|
+
MIGRATION_FAILED: 'MIGRATION_FAILED',
|
|
77
|
+
/** Fork operation failed */
|
|
78
|
+
FORK_FAILED: 'FORK_FAILED',
|
|
79
|
+
/** Follower not found in list */
|
|
80
|
+
FOLLOWER_NOT_FOUND: 'FOLLOWER_NOT_FOUND',
|
|
81
|
+
/** Operation violates jurisdiction constraints */
|
|
82
|
+
JURISDICTION_VIOLATION: 'JURISDICTION_VIOLATION',
|
|
83
|
+
/** Replication error */
|
|
84
|
+
REPLICATION_FAILED: 'REPLICATION_FAILED',
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Error class for colo operations
|
|
88
|
+
*/
|
|
89
|
+
export class ColoError extends Error {
|
|
90
|
+
code;
|
|
91
|
+
/**
|
|
92
|
+
* Create a new ColoError
|
|
93
|
+
*
|
|
94
|
+
* @param message - Error message
|
|
95
|
+
* @param code - Error code from COLO_ERRORS
|
|
96
|
+
*/
|
|
97
|
+
constructor(message, code) {
|
|
98
|
+
super(message);
|
|
99
|
+
this.code = code;
|
|
100
|
+
this.name = 'ColoError';
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create colo operations interface for a Digital Object instance
|
|
105
|
+
*
|
|
106
|
+
* Factory function that wraps a DO instance with all colo-related operations.
|
|
107
|
+
* Returns an object implementing the ColoOperations interface.
|
|
108
|
+
*
|
|
109
|
+
* @param state - The DurableObjectState instance
|
|
110
|
+
* @param env - The environment bindings (for accessing other DOs)
|
|
111
|
+
* @returns ColoOperations interface with all colo methods
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* import { createColoOperations } from '@do/core/colo'
|
|
116
|
+
*
|
|
117
|
+
* class MyDO {
|
|
118
|
+
* private colo: ColoOperations
|
|
119
|
+
*
|
|
120
|
+
* constructor(state: DurableObjectState, env: Env) {
|
|
121
|
+
* this.colo = createColoOperations(state, env)
|
|
122
|
+
* }
|
|
123
|
+
*
|
|
124
|
+
* async fetch(request: Request) {
|
|
125
|
+
* const info = await this.colo.getInfo()
|
|
126
|
+
* return Response.json(info)
|
|
127
|
+
* }
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export function createColoOperations(state, env) {
|
|
132
|
+
// TODO: Implement colo operations factory
|
|
133
|
+
throw new Error('Not implemented');
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Default export for convenience
|
|
137
|
+
*/
|
|
138
|
+
export default {
|
|
139
|
+
createColoOperations,
|
|
140
|
+
COLO_STORAGE_KEYS,
|
|
141
|
+
COLO_EVENTS,
|
|
142
|
+
COLO_ERRORS,
|
|
143
|
+
ColoError,
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=index.js.map
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C5B,iCAAiC;IACjC,gBAAgB,EAAE,kBAAkB;IACpC,4BAA4B;IAC5B,WAAW,EAAE,aAAa;IAC1B,iCAAiC;IACjC,kBAAkB,EAAE,oBAAoB;IACxC,kDAAkD;IAClD,sBAAsB,EAAE,wBAAwB;IAChD,wBAAwB;IACxB,kBAAkB,EAAE,oBAAoB;CAChC,CAAA;AAEV;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAShB;IARlB;;;;;OAKG;IACH,YACE,OAAe,EACC,IAA8B;QAE9C,KAAK,CAAC,OAAO,CAAC,CAAA;QAFE,SAAI,GAAJ,IAAI,CAA0B;QAG9C,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;IACzB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAyB,EACzB,GAAY;IAEZ,0CAA0C;IAC1C,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;AACpC,CAAC;AAED;;GAEG;AACH,eAAe;IACb,oBAAoB;IACpB,iBAAiB;IACjB,WAAW;IACX,WAAW;IACX,SAAS;CACV,CAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colo Information Operations
|
|
3
|
+
*
|
|
4
|
+
* Get information about colos, regions, and the current DO location.
|
|
5
|
+
*
|
|
6
|
+
* @module colo/info
|
|
7
|
+
*/
|
|
8
|
+
import type { ColoInfo, Region, RegionInfo } from '../../types/colo';
|
|
9
|
+
/**
|
|
10
|
+
* Validate that a colo code is known
|
|
11
|
+
*
|
|
12
|
+
* @param colo - IATA colo code to validate
|
|
13
|
+
* @returns True if colo is valid
|
|
14
|
+
*/
|
|
15
|
+
export declare function isValidColo(colo: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Get the region for a given colo code
|
|
18
|
+
*
|
|
19
|
+
* @param colo - IATA colo code
|
|
20
|
+
* @returns Region code or null if colo not found
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const region = getRegionForColo('iad')
|
|
25
|
+
* // 'enam'
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function getRegionForColo(colo: string): Region | null;
|
|
29
|
+
/**
|
|
30
|
+
* Get region metadata
|
|
31
|
+
*
|
|
32
|
+
* @param region - Region code
|
|
33
|
+
* @returns RegionInfo or null if region not found
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const info = getRegionInfo('apac')
|
|
38
|
+
* // { region: 'apac', name: 'Asia Pacific', colos: ['nrt', 'sin', ...] }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function getRegionInfo(region: Region): RegionInfo | null;
|
|
42
|
+
/**
|
|
43
|
+
* Get information about the current colo where this DO is running
|
|
44
|
+
*
|
|
45
|
+
* Retrieves colo information from the request context or cached storage.
|
|
46
|
+
* The colo code comes from Cloudflare's cf.colo property.
|
|
47
|
+
*
|
|
48
|
+
* @param state - The DurableObjectState instance
|
|
49
|
+
* @param request - Optional request to extract colo from cf property
|
|
50
|
+
* @returns ColoInfo with colo code, region, and metadata
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const info = await getColoInfo(this.state, request)
|
|
55
|
+
* console.log(info.colo) // 'iad'
|
|
56
|
+
* console.log(info.region) // 'enam'
|
|
57
|
+
* console.log(info.city) // 'Ashburn'
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function getColoInfo(state: DurableObjectState, request?: Request): Promise<ColoInfo>;
|
|
61
|
+
/**
|
|
62
|
+
* Get information about a specific colo by its IATA code
|
|
63
|
+
*
|
|
64
|
+
* @param colo - IATA airport code (e.g., 'iad', 'lhr', 'nrt')
|
|
65
|
+
* @returns ColoInfo or null if colo not found
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const info = await getColoInfoByColo('fra')
|
|
70
|
+
* if (info) {
|
|
71
|
+
* console.log(info.region) // 'weur'
|
|
72
|
+
* console.log(info.city) // 'Frankfurt'
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function getColoInfoByColo(colo: string): Promise<ColoInfo | null>;
|
|
77
|
+
/**
|
|
78
|
+
* List all available colos, optionally filtered by region
|
|
79
|
+
*
|
|
80
|
+
* @param region - Optional region to filter by
|
|
81
|
+
* @returns Array of ColoInfo for matching colos
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* // List all colos
|
|
86
|
+
* const allColos = await listColos()
|
|
87
|
+
*
|
|
88
|
+
* // List only Asia Pacific colos
|
|
89
|
+
* const apacColos = await listColos('apac')
|
|
90
|
+
* // [{ colo: 'nrt', region: 'apac', ... }, ...]
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function listColos(region?: Region): Promise<ColoInfo[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Colo metadata lookup table
|
|
96
|
+
*
|
|
97
|
+
* Maps IATA codes to city/country information.
|
|
98
|
+
* This is a subset of major colos - Cloudflare has 300+.
|
|
99
|
+
*/
|
|
100
|
+
export declare const COLO_METADATA: Record<string, {
|
|
101
|
+
city: string;
|
|
102
|
+
country: string;
|
|
103
|
+
latitude: number;
|
|
104
|
+
longitude: number;
|
|
105
|
+
}>;
|
|
106
|
+
//# sourceMappingURL=info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../do/colo/info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAYpE;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ5D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAE/D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,kBAAkB,EACzB,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,QAAQ,CAAC,CAMnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAM9E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAMpE;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,MAAM,EACN;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAkEvE,CAAA"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colo Information Operations
|
|
3
|
+
*
|
|
4
|
+
* Get information about colos, regions, and the current DO location.
|
|
5
|
+
*
|
|
6
|
+
* @module colo/info
|
|
7
|
+
*/
|
|
8
|
+
import { REGIONS } from '../../types/colo';
|
|
9
|
+
/**
|
|
10
|
+
* Get all colo codes from all regions
|
|
11
|
+
*
|
|
12
|
+
* @returns Array of all known colo codes
|
|
13
|
+
*/
|
|
14
|
+
function getAllColos() {
|
|
15
|
+
return Object.values(REGIONS).flatMap((r) => r.colos);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Validate that a colo code is known
|
|
19
|
+
*
|
|
20
|
+
* @param colo - IATA colo code to validate
|
|
21
|
+
* @returns True if colo is valid
|
|
22
|
+
*/
|
|
23
|
+
export function isValidColo(colo) {
|
|
24
|
+
return getAllColos().includes(colo.toLowerCase());
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the region for a given colo code
|
|
28
|
+
*
|
|
29
|
+
* @param colo - IATA colo code
|
|
30
|
+
* @returns Region code or null if colo not found
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const region = getRegionForColo('iad')
|
|
35
|
+
* // 'enam'
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function getRegionForColo(colo) {
|
|
39
|
+
const normalizedColo = colo.toLowerCase();
|
|
40
|
+
for (const [region, info] of Object.entries(REGIONS)) {
|
|
41
|
+
if (info.colos.includes(normalizedColo)) {
|
|
42
|
+
return region;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get region metadata
|
|
49
|
+
*
|
|
50
|
+
* @param region - Region code
|
|
51
|
+
* @returns RegionInfo or null if region not found
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const info = getRegionInfo('apac')
|
|
56
|
+
* // { region: 'apac', name: 'Asia Pacific', colos: ['nrt', 'sin', ...] }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export function getRegionInfo(region) {
|
|
60
|
+
return REGIONS[region] ?? null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get information about the current colo where this DO is running
|
|
64
|
+
*
|
|
65
|
+
* Retrieves colo information from the request context or cached storage.
|
|
66
|
+
* The colo code comes from Cloudflare's cf.colo property.
|
|
67
|
+
*
|
|
68
|
+
* @param state - The DurableObjectState instance
|
|
69
|
+
* @param request - Optional request to extract colo from cf property
|
|
70
|
+
* @returns ColoInfo with colo code, region, and metadata
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const info = await getColoInfo(this.state, request)
|
|
75
|
+
* console.log(info.colo) // 'iad'
|
|
76
|
+
* console.log(info.region) // 'enam'
|
|
77
|
+
* console.log(info.city) // 'Ashburn'
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export async function getColoInfo(state, request) {
|
|
81
|
+
// TODO: Implement getColoInfo
|
|
82
|
+
// 1. Try to get colo from request.cf.colo
|
|
83
|
+
// 2. Fall back to cached value in storage
|
|
84
|
+
// 3. Build ColoInfo from colo code
|
|
85
|
+
throw new Error('Not implemented');
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get information about a specific colo by its IATA code
|
|
89
|
+
*
|
|
90
|
+
* @param colo - IATA airport code (e.g., 'iad', 'lhr', 'nrt')
|
|
91
|
+
* @returns ColoInfo or null if colo not found
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const info = await getColoInfoByColo('fra')
|
|
96
|
+
* if (info) {
|
|
97
|
+
* console.log(info.region) // 'weur'
|
|
98
|
+
* console.log(info.city) // 'Frankfurt'
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export async function getColoInfoByColo(colo) {
|
|
103
|
+
// TODO: Implement getColoInfoByColo
|
|
104
|
+
// 1. Validate colo code
|
|
105
|
+
// 2. Look up region
|
|
106
|
+
// 3. Build ColoInfo with known metadata
|
|
107
|
+
throw new Error('Not implemented');
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* List all available colos, optionally filtered by region
|
|
111
|
+
*
|
|
112
|
+
* @param region - Optional region to filter by
|
|
113
|
+
* @returns Array of ColoInfo for matching colos
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* // List all colos
|
|
118
|
+
* const allColos = await listColos()
|
|
119
|
+
*
|
|
120
|
+
* // List only Asia Pacific colos
|
|
121
|
+
* const apacColos = await listColos('apac')
|
|
122
|
+
* // [{ colo: 'nrt', region: 'apac', ... }, ...]
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export async function listColos(region) {
|
|
126
|
+
// TODO: Implement listColos
|
|
127
|
+
// 1. If region provided, filter to that region
|
|
128
|
+
// 2. Build ColoInfo for each colo
|
|
129
|
+
// 3. Sort by some reasonable order (alphabetical or by size)
|
|
130
|
+
throw new Error('Not implemented');
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Colo metadata lookup table
|
|
134
|
+
*
|
|
135
|
+
* Maps IATA codes to city/country information.
|
|
136
|
+
* This is a subset of major colos - Cloudflare has 300+.
|
|
137
|
+
*/
|
|
138
|
+
export const COLO_METADATA = {
|
|
139
|
+
// Western North America
|
|
140
|
+
sjc: { city: 'San Jose', country: 'US', latitude: 37.3639, longitude: -121.9289 },
|
|
141
|
+
lax: { city: 'Los Angeles', country: 'US', latitude: 33.9416, longitude: -118.4085 },
|
|
142
|
+
sea: { city: 'Seattle', country: 'US', latitude: 47.4502, longitude: -122.3088 },
|
|
143
|
+
den: { city: 'Denver', country: 'US', latitude: 39.8561, longitude: -104.6737 },
|
|
144
|
+
phx: { city: 'Phoenix', country: 'US', latitude: 33.4352, longitude: -112.0101 },
|
|
145
|
+
pdx: { city: 'Portland', country: 'US', latitude: 45.5898, longitude: -122.5951 },
|
|
146
|
+
yvr: { city: 'Vancouver', country: 'CA', latitude: 49.1967, longitude: -123.1815 },
|
|
147
|
+
// Eastern North America
|
|
148
|
+
iad: { city: 'Ashburn', country: 'US', latitude: 38.9519, longitude: -77.448 },
|
|
149
|
+
dfw: { city: 'Dallas', country: 'US', latitude: 32.8998, longitude: -97.0403 },
|
|
150
|
+
atl: { city: 'Atlanta', country: 'US', latitude: 33.6407, longitude: -84.4277 },
|
|
151
|
+
ord: { city: 'Chicago', country: 'US', latitude: 41.9742, longitude: -87.9073 },
|
|
152
|
+
mia: { city: 'Miami', country: 'US', latitude: 25.7959, longitude: -80.287 },
|
|
153
|
+
yyz: { city: 'Toronto', country: 'CA', latitude: 43.6777, longitude: -79.6248 },
|
|
154
|
+
bos: { city: 'Boston', country: 'US', latitude: 42.3656, longitude: -71.0096 },
|
|
155
|
+
jfk: { city: 'New York', country: 'US', latitude: 40.6413, longitude: -73.7781 },
|
|
156
|
+
// Western Europe
|
|
157
|
+
lhr: { city: 'London', country: 'GB', latitude: 51.47, longitude: -0.4543 },
|
|
158
|
+
cdg: { city: 'Paris', country: 'FR', latitude: 49.0097, longitude: 2.5479 },
|
|
159
|
+
fra: { city: 'Frankfurt', country: 'DE', latitude: 50.0379, longitude: 8.5622 },
|
|
160
|
+
ams: { city: 'Amsterdam', country: 'NL', latitude: 52.3105, longitude: 4.7683 },
|
|
161
|
+
dub: { city: 'Dublin', country: 'IE', latitude: 53.4264, longitude: -6.2499 },
|
|
162
|
+
mad: { city: 'Madrid', country: 'ES', latitude: 40.4983, longitude: -3.5676 },
|
|
163
|
+
lis: { city: 'Lisbon', country: 'PT', latitude: 38.7742, longitude: -9.1342 },
|
|
164
|
+
// Eastern Europe
|
|
165
|
+
waw: { city: 'Warsaw', country: 'PL', latitude: 52.1672, longitude: 20.9679 },
|
|
166
|
+
bud: { city: 'Budapest', country: 'HU', latitude: 47.4398, longitude: 19.2611 },
|
|
167
|
+
prg: { city: 'Prague', country: 'CZ', latitude: 50.1008, longitude: 14.26 },
|
|
168
|
+
vie: { city: 'Vienna', country: 'AT', latitude: 48.1103, longitude: 16.5697 },
|
|
169
|
+
// Asia Pacific
|
|
170
|
+
nrt: { city: 'Tokyo', country: 'JP', latitude: 35.7653, longitude: 140.3857 },
|
|
171
|
+
sin: { city: 'Singapore', country: 'SG', latitude: 1.3644, longitude: 103.9915 },
|
|
172
|
+
hkg: { city: 'Hong Kong', country: 'HK', latitude: 22.308, longitude: 113.9185 },
|
|
173
|
+
bom: { city: 'Mumbai', country: 'IN', latitude: 19.0896, longitude: 72.8656 },
|
|
174
|
+
del: { city: 'Delhi', country: 'IN', latitude: 28.5562, longitude: 77.1 },
|
|
175
|
+
icn: { city: 'Seoul', country: 'KR', latitude: 37.4602, longitude: 126.4407 },
|
|
176
|
+
kix: { city: 'Osaka', country: 'JP', latitude: 34.4347, longitude: 135.244 },
|
|
177
|
+
// Oceania
|
|
178
|
+
syd: { city: 'Sydney', country: 'AU', latitude: -33.9399, longitude: 151.1753 },
|
|
179
|
+
mel: { city: 'Melbourne', country: 'AU', latitude: -37.6733, longitude: 144.8433 },
|
|
180
|
+
akl: { city: 'Auckland', country: 'NZ', latitude: -37.0082, longitude: 174.7917 },
|
|
181
|
+
per: { city: 'Perth', country: 'AU', latitude: -31.9385, longitude: 115.9672 },
|
|
182
|
+
// South America
|
|
183
|
+
gru: { city: 'Sao Paulo', country: 'BR', latitude: -23.4356, longitude: -46.4731 },
|
|
184
|
+
eze: { city: 'Buenos Aires', country: 'AR', latitude: -34.8222, longitude: -58.5358 },
|
|
185
|
+
scl: { city: 'Santiago', country: 'CL', latitude: -33.393, longitude: -70.7858 },
|
|
186
|
+
bog: { city: 'Bogota', country: 'CO', latitude: 4.7016, longitude: -74.1469 },
|
|
187
|
+
// Africa
|
|
188
|
+
jnb: { city: 'Johannesburg', country: 'ZA', latitude: -26.1367, longitude: 28.242 },
|
|
189
|
+
cpt: { city: 'Cape Town', country: 'ZA', latitude: -33.9715, longitude: 18.6021 },
|
|
190
|
+
nbo: { city: 'Nairobi', country: 'KE', latitude: -1.3192, longitude: 36.9258 },
|
|
191
|
+
// Middle East
|
|
192
|
+
dxb: { city: 'Dubai', country: 'AE', latitude: 25.2532, longitude: 55.3657 },
|
|
193
|
+
tlv: { city: 'Tel Aviv', country: 'IL', latitude: 32.0055, longitude: 34.8854 },
|
|
194
|
+
ruh: { city: 'Riyadh', country: 'SA', latitude: 24.9578, longitude: 46.6989 },
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingUR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G,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE;IAC5E,GAAG,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE;IAC/E,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE;CAC9E,CAAA"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration Operations
|
|
3
|
+
*
|
|
4
|
+
* Move Digital Objects between colos. Use when usage patterns change
|
|
5
|
+
* or for optimization.
|
|
6
|
+
*
|
|
7
|
+
* @module colo/migrate
|
|
8
|
+
*/
|
|
9
|
+
import type { MigrateOptions } from '../../types/colo';
|
|
10
|
+
import type { DigitalObjectRef } from '../../types/identity';
|
|
11
|
+
/**
|
|
12
|
+
* Migration strategy
|
|
13
|
+
*
|
|
14
|
+
* - `graceful`: Wait for in-flight requests, then migrate (slower but safer)
|
|
15
|
+
* - `immediate`: Migrate immediately, in-flight requests may fail (faster but riskier)
|
|
16
|
+
*/
|
|
17
|
+
export type MigrationStrategy = 'graceful' | 'immediate';
|
|
18
|
+
/**
|
|
19
|
+
* Migration state during the migration process
|
|
20
|
+
*/
|
|
21
|
+
export type MigrationState = 'idle' | 'preparing' | 'draining' | 'transferring' | 'switching' | 'completed' | 'failed';
|
|
22
|
+
/**
|
|
23
|
+
* Migration status information
|
|
24
|
+
*/
|
|
25
|
+
export interface MigrationStatus {
|
|
26
|
+
/** Current state of the migration */
|
|
27
|
+
state: MigrationState;
|
|
28
|
+
/** Source colo */
|
|
29
|
+
sourceColo: string;
|
|
30
|
+
/** Target colo */
|
|
31
|
+
targetColo: string;
|
|
32
|
+
/** When migration started */
|
|
33
|
+
startedAt: number;
|
|
34
|
+
/** Progress percentage (0-100) */
|
|
35
|
+
progress: number;
|
|
36
|
+
/** Number of entries transferred */
|
|
37
|
+
entriesTransferred: number;
|
|
38
|
+
/** Total entries to transfer */
|
|
39
|
+
totalEntries: number;
|
|
40
|
+
/** Error message if failed */
|
|
41
|
+
error?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Migrate options with defaults applied
|
|
45
|
+
*/
|
|
46
|
+
export interface ResolvedMigrateOptions {
|
|
47
|
+
/** Whether to wait for migration to complete (default: true) */
|
|
48
|
+
wait: boolean;
|
|
49
|
+
/** Timeout for migration in ms (default: 60000) */
|
|
50
|
+
timeout: number;
|
|
51
|
+
/** Strategy for handling in-flight requests (default: 'graceful') */
|
|
52
|
+
strategy: MigrationStrategy;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Migrate this DO to another colo
|
|
56
|
+
*
|
|
57
|
+
* Moves the primary DO to a different geographic location. This is useful when:
|
|
58
|
+
* - User patterns shift (e.g., most users now in Asia instead of US)
|
|
59
|
+
* - Optimizing for latency based on analytics
|
|
60
|
+
* - Meeting new jurisdiction requirements
|
|
61
|
+
*
|
|
62
|
+
* **Graceful Strategy** (default):
|
|
63
|
+
* 1. Stop accepting new writes
|
|
64
|
+
* 2. Wait for in-flight requests to complete
|
|
65
|
+
* 3. Transfer all state to new location
|
|
66
|
+
* 4. Update routing to point to new location
|
|
67
|
+
* 5. Resume normal operation
|
|
68
|
+
*
|
|
69
|
+
* **Immediate Strategy**:
|
|
70
|
+
* 1. Snapshot current state
|
|
71
|
+
* 2. Create new DO in target colo with snapshot
|
|
72
|
+
* 3. Immediately switch routing
|
|
73
|
+
* 4. In-flight requests to old location may fail
|
|
74
|
+
*
|
|
75
|
+
* @param state - The DurableObjectState instance
|
|
76
|
+
* @param env - Environment bindings
|
|
77
|
+
* @param targetColo - IATA code of target colo (e.g., 'fra', 'nrt')
|
|
78
|
+
* @param options - Migration configuration options
|
|
79
|
+
* @throws ColoError if target colo is invalid or migration fails
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* // Graceful migration (recommended)
|
|
84
|
+
* await migrateDO(state, env, 'nrt', {
|
|
85
|
+
* strategy: 'graceful',
|
|
86
|
+
* timeout: 30000,
|
|
87
|
+
* })
|
|
88
|
+
*
|
|
89
|
+
* // Immediate migration (faster but riskier)
|
|
90
|
+
* await migrateDO(state, env, 'nrt', {
|
|
91
|
+
* strategy: 'immediate',
|
|
92
|
+
* })
|
|
93
|
+
*
|
|
94
|
+
* // Fire and forget (don't wait for completion)
|
|
95
|
+
* await migrateDO(state, env, 'fra', {
|
|
96
|
+
* wait: false,
|
|
97
|
+
* })
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare function migrateDO(state: DurableObjectState, env: unknown, targetColo: string, options?: MigrateOptions): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Apply default values to migrate options
|
|
103
|
+
*
|
|
104
|
+
* @param options - Partial options from caller
|
|
105
|
+
* @returns Fully resolved options with defaults
|
|
106
|
+
*/
|
|
107
|
+
export declare function resolveMigrateOptions(options?: MigrateOptions): ResolvedMigrateOptions;
|
|
108
|
+
/**
|
|
109
|
+
* Get the current migration status
|
|
110
|
+
*
|
|
111
|
+
* @param state - The DurableObjectState instance
|
|
112
|
+
* @returns Current migration status or null if no migration in progress
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const status = await getMigrationStatus(state)
|
|
117
|
+
* if (status) {
|
|
118
|
+
* console.log(`Migration ${status.progress}% complete`)
|
|
119
|
+
* console.log(`${status.entriesTransferred}/${status.totalEntries} entries`)
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export declare function getMigrationStatus(state: DurableObjectState): Promise<MigrationStatus | null>;
|
|
124
|
+
/**
|
|
125
|
+
* Cancel an in-progress migration
|
|
126
|
+
*
|
|
127
|
+
* Can only cancel migrations that haven't reached the 'switching' state.
|
|
128
|
+
* Graceful migrations in 'draining' or 'transferring' state can be cancelled.
|
|
129
|
+
*
|
|
130
|
+
* @param state - The DurableObjectState instance
|
|
131
|
+
* @throws ColoError if no migration in progress or migration cannot be cancelled
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* await cancelMigration(state)
|
|
136
|
+
* // Migration cancelled, DO remains in original colo
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export declare function cancelMigration(state: DurableObjectState): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Drain in-flight requests during graceful migration
|
|
142
|
+
*
|
|
143
|
+
* Waits for active requests to complete before proceeding with state transfer.
|
|
144
|
+
*
|
|
145
|
+
* @param state - The DurableObjectState instance
|
|
146
|
+
* @param timeout - Maximum time to wait in ms
|
|
147
|
+
* @returns True if all requests drained, false if timeout
|
|
148
|
+
*/
|
|
149
|
+
export declare function drainRequests(state: DurableObjectState, timeout: number): Promise<boolean>;
|
|
150
|
+
/**
|
|
151
|
+
* Transfer state to a new DO location
|
|
152
|
+
*
|
|
153
|
+
* Exports all storage entries and sends them to the target DO.
|
|
154
|
+
*
|
|
155
|
+
* @param state - Source DO state
|
|
156
|
+
* @param targetRef - Reference to target DO
|
|
157
|
+
* @param onProgress - Optional callback for progress updates
|
|
158
|
+
* @returns Number of entries transferred
|
|
159
|
+
*/
|
|
160
|
+
export declare function transferState(state: DurableObjectState, targetRef: DigitalObjectRef, onProgress?: (transferred: number, total: number) => void): Promise<number>;
|
|
161
|
+
//# sourceMappingURL=migrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../do/colo/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAA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