agenttwin 0.3.21 → 0.3.23
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/dist/api.js +2113 -609
- package/dist/dashboard/assets/dashboard/agent-home.css +7 -7
- package/dist/dashboard/assets/dashboard/bay-morning.webp +0 -0
- package/dist/dashboard/assets/dashboard/golden-gate-afternoon.webp +0 -0
- package/dist/dashboard/assets/dashboard/golden-gate-portrait.webp +0 -0
- package/dist/dashboard/assets/dashboard/moonlit-coast.webp +0 -0
- package/dist/dashboard/assets/next/static/chunks/{1250-7571b1a697f6bb4a.js → 1250-a3c859fd20517500.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/{2743-a0efd6f4aeb11cc5.js → 2743-72610a5d5a3f8462.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/5663-403316746afad10e.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/{page-9c11295678539a5f.js → page-0e0392368e0a891e.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-4981ea4966b19e3e.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-dd4ac0f5f36e6bfa.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/{page-34574448d210c775.js → page-de0fe6d84be21e6a.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-360cbffc57981f6b.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/page-fc4df4912ce3af44.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/{webpack-40324749d289e4a5.js → webpack-9e40ef55e5f2fb53.js} +1 -1
- package/dist/dashboard/assets/next/static/css/{42045de5f39b50ca.css → 37d81e1d2804cc5f.css} +1 -1
- package/dist/dashboard/assets/next/static/css/69ec1bae997c3bb0.css +1 -0
- package/dist/dashboard/assets/next/static/css/ad85402a1595e56e.css +1 -0
- package/dist/dashboard/assets/next/static/css/{4bbe78c2fe206b92.css → da981fb878a02b8c.css} +1 -1
- package/dist/dashboard/assets/next/static/media/bay-morning.82669113.webp +0 -0
- package/dist/dashboard/assets/next/static/media/golden-gate-afternoon.0aa49492.webp +0 -0
- package/dist/dashboard/assets/next/static/media/golden-gate-portrait.89fc667a.webp +0 -0
- package/dist/dashboard/assets/next/static/media/moonlit-coast.09739ef4.webp +0 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/engine.js +6386 -4974
- package/dist/gateway.js +2194 -604
- package/dist/twins/catalog.json +6020 -0
- package/dist/twins/engine/v2/THIRD-PARTY.txt +25 -0
- package/dist/twins/engine/v2/chunks/2CHBP57N.mjs +8 -0
- package/dist/twins/engine/v2/chunks/4CPL6MPF.mjs +30 -0
- package/dist/twins/engine/v2/chunks/OYLYKZGD.mjs +2 -0
- package/dist/twins/engine/v2/chunks/SQSP35HM.mjs +38 -0
- package/dist/twins/engine/v2/chunks/YSJQQVUM.mjs +2 -0
- package/dist/twins/engine/v2/react-dom_client.mjs +272 -0
- package/dist/twins/engine/v2/react-dom_server.mjs +263 -0
- package/dist/twins/engine/v2/react.mjs +2 -0
- package/dist/twins/engine/v2/react_jsx-runtime.mjs +31 -0
- package/dist/twins/engine/v2/volter_world-core.mjs +195 -0
- package/dist/twins/engine/v2/volter_world-core_app-route.mjs +2 -0
- package/dist/twins/engine/v2/volter_world-core_network-policy.mjs +2 -0
- package/dist/twins/engine/v3/THIRD-PARTY.txt +65 -0
- package/dist/twins/engine/v3/chunks/2CHBP57N.mjs +8 -0
- package/dist/twins/engine/v3/chunks/2YSSPA5O.mjs +65 -0
- package/dist/twins/engine/v3/chunks/5PWRY4UK.mjs +154 -0
- package/dist/twins/engine/v3/chunks/7XRKSFFJ.mjs +2 -0
- package/dist/twins/engine/v3/chunks/AWOWH2H5.mjs +2 -0
- package/dist/twins/engine/v3/chunks/C46M5U3Q.mjs +2 -0
- package/dist/twins/engine/v3/chunks/MFH2VZPP.mjs +2 -0
- package/dist/twins/engine/v3/chunks/MWCO5UV3.mjs +2 -0
- package/dist/twins/engine/v3/chunks/N5BL5RDF.mjs +313 -0
- package/dist/twins/engine/v3/chunks/O7HGPMXG.mjs +2 -0
- package/dist/twins/engine/v3/chunks/OYLYKZGD.mjs +2 -0
- package/dist/twins/engine/v3/chunks/PLB7HTON.mjs +8 -0
- package/dist/twins/engine/v3/chunks/TY4LDBVH.mjs +7 -0
- package/dist/twins/engine/v3/chunks/VDIRUSCM.mjs +2 -0
- package/dist/twins/engine/v3/chunks/WGUCFQK6.mjs +2 -0
- package/dist/twins/engine/v3/chunks/WPATONSC.mjs +2 -0
- package/dist/twins/engine/v3/react_jsx-runtime.mjs +2 -0
- package/dist/twins/engine/v3/volter_world-core.mjs +2 -0
- package/dist/twins/engine/v3/volter_world-ui.mjs +559 -0
- package/dist/twins/packs/ahrefs/LICENSE +202 -0
- package/dist/twins/packs/ahrefs/NOTICE +7 -0
- package/dist/twins/packs/ahrefs/index.mjs +2 -0
- package/dist/twins/packs/ai-gateway/LICENSE +202 -0
- package/dist/twins/packs/ai-gateway/NOTICE +7 -0
- package/dist/twins/packs/ai-gateway/index.mjs +14 -0
- package/dist/twins/packs/airtable/LICENSE +202 -0
- package/dist/twins/packs/airtable/NOTICE +7 -0
- package/dist/twins/packs/airtable/index.mjs +2 -0
- package/dist/twins/packs/algolia/LICENSE +202 -0
- package/dist/twins/packs/algolia/NOTICE +7 -0
- package/dist/twins/packs/algolia/index.mjs +2 -0
- package/dist/twins/packs/ambientcg/LICENSE +202 -0
- package/dist/twins/packs/ambientcg/NOTICE +7 -0
- package/dist/twins/packs/ambientcg/index.mjs +2 -0
- package/dist/twins/packs/anthropic/LICENSE +202 -0
- package/dist/twins/packs/anthropic/NOTICE +7 -0
- package/dist/twins/packs/anthropic/index.mjs +18 -0
- package/dist/twins/packs/assemblyai/LICENSE +202 -0
- package/dist/twins/packs/assemblyai/NOTICE +7 -0
- package/dist/twins/packs/assemblyai/index.mjs +11 -0
- package/dist/twins/packs/aws/LICENSE +202 -0
- package/dist/twins/packs/aws/NOTICE +7 -0
- package/dist/twins/packs/aws/index.mjs +2 -0
- package/dist/twins/packs/azure/LICENSE +202 -0
- package/dist/twins/packs/azure/NOTICE +7 -0
- package/dist/twins/packs/azure/index.mjs +38 -0
- package/dist/twins/packs/azureformrecognizer/LICENSE +202 -0
- package/dist/twins/packs/azureformrecognizer/NOTICE +7 -0
- package/dist/twins/packs/azureformrecognizer/index.mjs +3 -0
- package/dist/twins/packs/bitly/LICENSE +202 -0
- package/dist/twins/packs/bitly/NOTICE +7 -0
- package/dist/twins/packs/bitly/index.mjs +2 -0
- package/dist/twins/packs/bluesky/LICENSE +202 -0
- package/dist/twins/packs/bluesky/NOTICE +7 -0
- package/dist/twins/packs/bluesky/index.mjs +30 -0
- package/dist/twins/packs/calcom/LICENSE +202 -0
- package/dist/twins/packs/calcom/NOTICE +7 -0
- package/dist/twins/packs/calcom/index.mjs +2 -0
- package/dist/twins/packs/clerk/LICENSE +202 -0
- package/dist/twins/packs/clerk/NOTICE +7 -0
- package/dist/twins/packs/clerk/index.mjs +5 -0
- package/dist/twins/packs/cloudflare/LICENSE +202 -0
- package/dist/twins/packs/cloudflare/NOTICE +7 -0
- package/dist/twins/packs/cloudflare/index.mjs +79 -0
- package/dist/twins/packs/cohere/LICENSE +202 -0
- package/dist/twins/packs/cohere/NOTICE +7 -0
- package/dist/twins/packs/cohere/index.mjs +2 -0
- package/dist/twins/packs/datadog/LICENSE +202 -0
- package/dist/twins/packs/datadog/NOTICE +7 -0
- package/dist/twins/packs/datadog/index.mjs +3 -0
- package/dist/twins/packs/deepinfra/LICENSE +202 -0
- package/dist/twins/packs/deepinfra/NOTICE +7 -0
- package/dist/twins/packs/deepinfra/index.mjs +13 -0
- package/dist/twins/packs/deepseek/LICENSE +202 -0
- package/dist/twins/packs/deepseek/NOTICE +7 -0
- package/dist/twins/packs/deepseek/index.mjs +12 -0
- package/dist/twins/packs/discord/LICENSE +202 -0
- package/dist/twins/packs/discord/NOTICE +7 -0
- package/dist/twins/packs/discord/index.mjs +2 -0
- package/dist/twins/packs/duckduckgo/LICENSE +202 -0
- package/dist/twins/packs/duckduckgo/NOTICE +7 -0
- package/dist/twins/packs/duckduckgo/index.mjs +532 -0
- package/dist/twins/packs/dynadot/LICENSE +202 -0
- package/dist/twins/packs/dynadot/NOTICE +7 -0
- package/dist/twins/packs/dynadot/index.mjs +2 -0
- package/dist/twins/packs/e2b/LICENSE +202 -0
- package/dist/twins/packs/e2b/NOTICE +7 -0
- package/dist/twins/packs/e2b/index.mjs +2 -0
- package/dist/twins/packs/elevenlabs/LICENSE +202 -0
- package/dist/twins/packs/elevenlabs/NOTICE +7 -0
- package/dist/twins/packs/elevenlabs/index.mjs +4 -0
- package/dist/twins/packs/expo/LICENSE +202 -0
- package/dist/twins/packs/expo/NOTICE +7 -0
- package/dist/twins/packs/expo/index.mjs +2 -0
- package/dist/twins/packs/fal/LICENSE +202 -0
- package/dist/twins/packs/fal/NOTICE +7 -0
- package/dist/twins/packs/fal/index.mjs +2 -0
- package/dist/twins/packs/figma/LICENSE +202 -0
- package/dist/twins/packs/figma/NOTICE +7 -0
- package/dist/twins/packs/figma/index.mjs +2 -0
- package/dist/twins/packs/firecrawl/LICENSE +202 -0
- package/dist/twins/packs/firecrawl/NOTICE +7 -0
- package/dist/twins/packs/firecrawl/index.mjs +9 -0
- package/dist/twins/packs/fireworks/LICENSE +202 -0
- package/dist/twins/packs/fireworks/NOTICE +7 -0
- package/dist/twins/packs/fireworks/index.mjs +13 -0
- package/dist/twins/packs/fly/LICENSE +202 -0
- package/dist/twins/packs/fly/NOTICE +7 -0
- package/dist/twins/packs/fly/index.mjs +2 -0
- package/dist/twins/packs/gcs/LICENSE +202 -0
- package/dist/twins/packs/gcs/NOTICE +7 -0
- package/dist/twins/packs/gcs/index.mjs +8 -0
- package/dist/twins/packs/gemini/LICENSE +202 -0
- package/dist/twins/packs/gemini/NOTICE +7 -0
- package/dist/twins/packs/gemini/index.mjs +7 -0
- package/dist/twins/packs/github/LICENSE +202 -0
- package/dist/twins/packs/github/NOTICE +7 -0
- package/dist/twins/packs/github/index.mjs +75153 -0
- package/dist/twins/packs/googleads/LICENSE +202 -0
- package/dist/twins/packs/googleads/NOTICE +7 -0
- package/dist/twins/packs/googleads/index.mjs +3 -0
- package/dist/twins/packs/googlemaps/LICENSE +202 -0
- package/dist/twins/packs/googlemaps/NOTICE +7 -0
- package/dist/twins/packs/googlemaps/index.mjs +2 -0
- package/dist/twins/packs/googleoauth/LICENSE +202 -0
- package/dist/twins/packs/googleoauth/NOTICE +7 -0
- package/dist/twins/packs/googleoauth/index.mjs +2 -0
- package/dist/twins/packs/hackernews/LICENSE +202 -0
- package/dist/twins/packs/hackernews/NOTICE +7 -0
- package/dist/twins/packs/hackernews/index.mjs +35 -0
- package/dist/twins/packs/huggingface/LICENSE +202 -0
- package/dist/twins/packs/huggingface/NOTICE +7 -0
- package/dist/twins/packs/huggingface/index.mjs +9 -0
- package/dist/twins/packs/inngest/LICENSE +202 -0
- package/dist/twins/packs/inngest/NOTICE +7 -0
- package/dist/twins/packs/inngest/index.mjs +2 -0
- package/dist/twins/packs/instagram/LICENSE +202 -0
- package/dist/twins/packs/instagram/NOTICE +7 -0
- package/dist/twins/packs/instagram/index.mjs +2 -0
- package/dist/twins/packs/jira/LICENSE +202 -0
- package/dist/twins/packs/jira/NOTICE +7 -0
- package/dist/twins/packs/jira/index.mjs +2 -0
- package/dist/twins/packs/langfuse/LICENSE +202 -0
- package/dist/twins/packs/langfuse/NOTICE +7 -0
- package/dist/twins/packs/langfuse/index.mjs +2 -0
- package/dist/twins/packs/linear/LICENSE +202 -0
- package/dist/twins/packs/linear/NOTICE +7 -0
- package/dist/twins/packs/linear/index.mjs +52866 -0
- package/dist/twins/packs/linkedin/LICENSE +202 -0
- package/dist/twins/packs/linkedin/NOTICE +7 -0
- package/dist/twins/packs/linkedin/index.mjs +78 -0
- package/dist/twins/packs/livekit/LICENSE +202 -0
- package/dist/twins/packs/livekit/NOTICE +7 -0
- package/dist/twins/packs/livekit/index.mjs +2 -0
- package/dist/twins/packs/mailgun/LICENSE +202 -0
- package/dist/twins/packs/mailgun/NOTICE +7 -0
- package/dist/twins/packs/mailgun/index.mjs +13 -0
- package/dist/twins/packs/mapbox/LICENSE +202 -0
- package/dist/twins/packs/mapbox/NOTICE +7 -0
- package/dist/twins/packs/mapbox/index.mjs +2 -0
- package/dist/twins/packs/merge/LICENSE +202 -0
- package/dist/twins/packs/merge/NOTICE +7 -0
- package/dist/twins/packs/merge/index.mjs +4 -0
- package/dist/twins/packs/mistral/LICENSE +202 -0
- package/dist/twins/packs/mistral/NOTICE +7 -0
- package/dist/twins/packs/mistral/index.mjs +6 -0
- package/dist/twins/packs/mixpanel/LICENSE +202 -0
- package/dist/twins/packs/mixpanel/NOTICE +8 -0
- package/dist/twins/packs/mixpanel/index.mjs +2 -0
- package/dist/twins/packs/mongodb/LICENSE +202 -0
- package/dist/twins/packs/mongodb/NOTICE +7 -0
- package/dist/twins/packs/mongodb/index.mjs +8 -0
- package/dist/twins/packs/moonshot/LICENSE +202 -0
- package/dist/twins/packs/moonshot/NOTICE +7 -0
- package/dist/twins/packs/moonshot/index.mjs +18 -0
- package/dist/twins/packs/notion/LICENSE +202 -0
- package/dist/twins/packs/notion/NOTICE +7 -0
- package/dist/twins/packs/notion/index.mjs +2 -0
- package/dist/twins/packs/npm-registry/LICENSE +202 -0
- package/dist/twins/packs/npm-registry/NOTICE +7 -0
- package/dist/twins/packs/npm-registry/index.mjs +2 -0
- package/dist/twins/packs/oa-treasury/LICENSE +202 -0
- package/dist/twins/packs/oa-treasury/NOTICE +8 -0
- package/dist/twins/packs/oa-treasury/index.mjs +16 -0
- package/dist/twins/packs/openai/LICENSE +202 -0
- package/dist/twins/packs/openai/NOTICE +7 -0
- package/dist/twins/packs/openai/index.mjs +3473 -0
- package/dist/twins/packs/openrouter/LICENSE +202 -0
- package/dist/twins/packs/openrouter/NOTICE +7 -0
- package/dist/twins/packs/openrouter/index.mjs +2 -0
- package/dist/twins/packs/openweather/LICENSE +202 -0
- package/dist/twins/packs/openweather/NOTICE +7 -0
- package/dist/twins/packs/openweather/index.mjs +2 -0
- package/dist/twins/packs/paypal/LICENSE +202 -0
- package/dist/twins/packs/paypal/NOTICE +7 -0
- package/dist/twins/packs/paypal/index.mjs +51 -0
- package/dist/twins/packs/pinecone/LICENSE +202 -0
- package/dist/twins/packs/pinecone/NOTICE +7 -0
- package/dist/twins/packs/pinecone/index.mjs +2 -0
- package/dist/twins/packs/plain/LICENSE +202 -0
- package/dist/twins/packs/plain/NOTICE +8 -0
- package/dist/twins/packs/plain/index.mjs +18426 -0
- package/dist/twins/packs/planetscale/LICENSE +202 -0
- package/dist/twins/packs/planetscale/NOTICE +7 -0
- package/dist/twins/packs/planetscale/index.mjs +18 -0
- package/dist/twins/packs/polar/LICENSE +202 -0
- package/dist/twins/packs/polar/NOTICE +7 -0
- package/dist/twins/packs/polar/index.mjs +2 -0
- package/dist/twins/packs/polyhaven/LICENSE +202 -0
- package/dist/twins/packs/polyhaven/NOTICE +7 -0
- package/dist/twins/packs/polyhaven/index.mjs +3 -0
- package/dist/twins/packs/postmark/LICENSE +202 -0
- package/dist/twins/packs/postmark/NOTICE +7 -0
- package/dist/twins/packs/postmark/index.mjs +12 -0
- package/dist/twins/packs/reddit/LICENSE +202 -0
- package/dist/twins/packs/reddit/NOTICE +7 -0
- package/dist/twins/packs/reddit/index.mjs +324 -0
- package/dist/twins/packs/redis/LICENSE +202 -0
- package/dist/twins/packs/redis/NOTICE +7 -0
- package/dist/twins/packs/redis/index.mjs +2 -0
- package/dist/twins/packs/replicate/LICENSE +202 -0
- package/dist/twins/packs/replicate/NOTICE +7 -0
- package/dist/twins/packs/replicate/index.mjs +2 -0
- package/dist/twins/packs/resend/LICENSE +202 -0
- package/dist/twins/packs/resend/NOTICE +7 -0
- package/dist/twins/packs/resend/index.mjs +139 -0
- package/dist/twins/packs/runhuman/LICENSE +202 -0
- package/dist/twins/packs/runhuman/NOTICE +7 -0
- package/dist/twins/packs/runhuman/index.mjs +3 -0
- package/dist/twins/packs/scrapecreators/LICENSE +202 -0
- package/dist/twins/packs/scrapecreators/NOTICE +7 -0
- package/dist/twins/packs/scrapecreators/index.mjs +2 -0
- package/dist/twins/packs/segment/LICENSE +202 -0
- package/dist/twins/packs/segment/NOTICE +8 -0
- package/dist/twins/packs/segment/index.mjs +2 -0
- package/dist/twins/packs/sendblue/LICENSE +202 -0
- package/dist/twins/packs/sendblue/NOTICE +7 -0
- package/dist/twins/packs/sendblue/index.mjs +2 -0
- package/dist/twins/packs/sendgrid/LICENSE +202 -0
- package/dist/twins/packs/sendgrid/NOTICE +8 -0
- package/dist/twins/packs/sendgrid/index.mjs +4 -0
- package/dist/twins/packs/sentry/LICENSE +202 -0
- package/dist/twins/packs/sentry/NOTICE +7 -0
- package/dist/twins/packs/sentry/index.mjs +5 -0
- package/dist/twins/packs/sigstore/LICENSE +202 -0
- package/dist/twins/packs/sigstore/NOTICE +7 -0
- package/dist/twins/packs/sigstore/index.mjs +12 -0
- package/dist/twins/packs/slack/LICENSE +202 -0
- package/dist/twins/packs/slack/NOTICE +7 -0
- package/dist/twins/packs/slack/index.mjs +66 -0
- package/dist/twins/packs/smtp/LICENSE +202 -0
- package/dist/twins/packs/smtp/NOTICE +7 -0
- package/dist/twins/packs/smtp/index.mjs +3 -0
- package/dist/twins/packs/snowflake/LICENSE +202 -0
- package/dist/twins/packs/snowflake/NOTICE +8 -0
- package/dist/twins/packs/snowflake/index.mjs +30 -0
- package/dist/twins/packs/stigg/LICENSE +202 -0
- package/dist/twins/packs/stigg/NOTICE +8 -0
- package/dist/twins/packs/stigg/index.mjs +22194 -0
- package/dist/twins/packs/stream/LICENSE +202 -0
- package/dist/twins/packs/stream/NOTICE +7 -0
- package/dist/twins/packs/stream/index.mjs +2 -0
- package/dist/twins/packs/stripe/LICENSE +202 -0
- package/dist/twins/packs/stripe/NOTICE +7 -0
- package/dist/twins/packs/stripe/index.mjs +211 -0
- package/dist/twins/packs/supabase/LICENSE +202 -0
- package/dist/twins/packs/supabase/NOTICE +7 -0
- package/dist/twins/packs/supabase/index.mjs +2 -0
- package/dist/twins/packs/supermemory/LICENSE +202 -0
- package/dist/twins/packs/supermemory/NOTICE +7 -0
- package/dist/twins/packs/supermemory/index.mjs +2 -0
- package/dist/twins/packs/svix/LICENSE +202 -0
- package/dist/twins/packs/svix/NOTICE +7 -0
- package/dist/twins/packs/svix/index.mjs +2 -0
- package/dist/twins/packs/tavily/LICENSE +202 -0
- package/dist/twins/packs/tavily/NOTICE +7 -0
- package/dist/twins/packs/tavily/index.mjs +2 -0
- package/dist/twins/packs/telegram/LICENSE +202 -0
- package/dist/twins/packs/telegram/NOTICE +7 -0
- package/dist/twins/packs/telegram/index.mjs +11 -0
- package/dist/twins/packs/temporal/LICENSE +202 -0
- package/dist/twins/packs/temporal/NOTICE +7 -0
- package/dist/twins/packs/temporal/index.mjs +44 -0
- package/dist/twins/packs/tiktok/LICENSE +202 -0
- package/dist/twins/packs/tiktok/NOTICE +7 -0
- package/dist/twins/packs/tiktok/index.mjs +2 -0
- package/dist/twins/packs/tinybird/LICENSE +202 -0
- package/dist/twins/packs/tinybird/NOTICE +7 -0
- package/dist/twins/packs/tinybird/index.mjs +50 -0
- package/dist/twins/packs/togetherai/LICENSE +202 -0
- package/dist/twins/packs/togetherai/NOTICE +7 -0
- package/dist/twins/packs/togetherai/index.mjs +11 -0
- package/dist/twins/packs/tremendous/LICENSE +202 -0
- package/dist/twins/packs/tremendous/NOTICE +7 -0
- package/dist/twins/packs/tremendous/index.mjs +2 -0
- package/dist/twins/packs/tripo/LICENSE +202 -0
- package/dist/twins/packs/tripo/NOTICE +7 -0
- package/dist/twins/packs/tripo/index.mjs +9 -0
- package/dist/twins/packs/tunnel/LICENSE +202 -0
- package/dist/twins/packs/tunnel/NOTICE +7 -0
- package/dist/twins/packs/tunnel/index.mjs +2 -0
- package/dist/twins/packs/twelvelabs/LICENSE +202 -0
- package/dist/twins/packs/twelvelabs/NOTICE +7 -0
- package/dist/twins/packs/twelvelabs/index.mjs +5 -0
- package/dist/twins/packs/twilio/LICENSE +202 -0
- package/dist/twins/packs/twilio/NOTICE +7 -0
- package/dist/twins/packs/twilio/index.mjs +2 -0
- package/dist/twins/packs/twitch/LICENSE +202 -0
- package/dist/twins/packs/twitch/NOTICE +7 -0
- package/dist/twins/packs/twitch/index.mjs +68 -0
- package/dist/twins/packs/upstash/LICENSE +202 -0
- package/dist/twins/packs/upstash/NOTICE +7 -0
- package/dist/twins/packs/upstash/index.mjs +14 -0
- package/dist/twins/packs/upstashvector/LICENSE +202 -0
- package/dist/twins/packs/upstashvector/NOTICE +7 -0
- package/dist/twins/packs/upstashvector/index.mjs +3 -0
- package/dist/twins/packs/vercel/LICENSE +202 -0
- package/dist/twins/packs/vercel/NOTICE +7 -0
- package/dist/twins/packs/vercel/index.mjs +10 -0
- package/dist/twins/packs/veriff/LICENSE +202 -0
- package/dist/twins/packs/veriff/NOTICE +7 -0
- package/dist/twins/packs/veriff/index.mjs +2 -0
- package/dist/twins/packs/vgauth/LICENSE +202 -0
- package/dist/twins/packs/vgauth/NOTICE +7 -0
- package/dist/twins/packs/vgauth/index.mjs +2 -0
- package/dist/twins/packs/vital/LICENSE +202 -0
- package/dist/twins/packs/vital/NOTICE +7 -0
- package/dist/twins/packs/vital/index.mjs +2 -0
- package/dist/twins/packs/volteridentity/LICENSE +202 -0
- package/dist/twins/packs/volteridentity/NOTICE +7 -0
- package/dist/twins/packs/volteridentity/index.mjs +2 -0
- package/dist/twins/packs/webrisk/LICENSE +202 -0
- package/dist/twins/packs/webrisk/NOTICE +7 -0
- package/dist/twins/packs/webrisk/index.mjs +2 -0
- package/dist/twins/packs/worldlabs/LICENSE +202 -0
- package/dist/twins/packs/worldlabs/NOTICE +7 -0
- package/dist/twins/packs/worldlabs/index.mjs +2 -0
- package/dist/twins/packs/x/LICENSE +202 -0
- package/dist/twins/packs/x/NOTICE +7 -0
- package/dist/twins/packs/x/index.mjs +63 -0
- package/dist/twins/packs/xai/LICENSE +202 -0
- package/dist/twins/packs/xai/NOTICE +7 -0
- package/dist/twins/packs/xai/index.mjs +4 -0
- package/dist/twins/packs/xidentity/LICENSE +202 -0
- package/dist/twins/packs/xidentity/NOTICE +8 -0
- package/dist/twins/packs/xidentity/index.mjs +209 -0
- package/dist/twins/packs/youtube/LICENSE +202 -0
- package/dist/twins/packs/youtube/NOTICE +7 -0
- package/dist/twins/packs/youtube/index.mjs +5 -0
- package/dist/worker.js +442 -18
- package/dist/world-host.js +928 -91
- package/package.json +6 -5
- package/dist/dashboard/assets/dashboard/bay-morning.png +0 -0
- package/dist/dashboard/assets/dashboard/golden-gate-afternoon.png +0 -0
- package/dist/dashboard/assets/dashboard/golden-gate-portrait.png +0 -0
- package/dist/dashboard/assets/dashboard/moonlit-coast.png +0 -0
- package/dist/dashboard/assets/next/static/chunks/2868-424d32cfc8ae81c9.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-f9fca2c08f779fa0.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-bc480c9258e5cc4d.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-f04c0b236abaead3.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/page-07c8054d57c9089b.js +0 -1
- package/dist/dashboard/assets/next/static/css/4af3c8ca0da0f48b.css +0 -1
- package/dist/dashboard/assets/next/static/css/6b8edde77e493a51.css +0 -1
- package/dist/dashboard/assets/next/static/media/bay-morning.1a9f358c.png +0 -0
- package/dist/dashboard/assets/next/static/media/golden-gate-afternoon.3e7cea58.png +0 -0
- package/dist/dashboard/assets/next/static/media/golden-gate-portrait.7941528f.png +0 -0
- package/dist/dashboard/assets/next/static/media/moonlit-coast.bbe901a1.png +0 -0
- /package/dist/dashboard/assets/next/static/{5ub3D2yzS8DE7w2qZd1nv → GTd0IQ6HYyhE_2HqcgFno}/_buildManifest.js +0 -0
- /package/dist/dashboard/assets/next/static/{5ub3D2yzS8DE7w2qZd1nv → GTd0IQ6HYyhE_2HqcgFno}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
@agenttwin/twin-polyhaven
|
|
2
|
+
|
|
3
|
+
Contains @volter/twin-polyhaven 1.0.0 by Volter (https://github.com/volter-ai),
|
|
4
|
+
licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
Modified by AgentTwin: bundled and minified into one file; only code reachable from the pack's
|
|
7
|
+
fetch factory is included; shared modules are imported from the AgentTwin twin engine.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire as __atReq}from'node:module';const require=__atReq(import.meta.url);
|
|
2
|
+
var ne=Object.defineProperty;var ae=(e,t)=>{for(var s in t)ne(e,s,{get:t[s],enumerable:!0})};import{packOf as be,registerPack as we}from"../../engine/v3/volter_world-core.mjs";var j={vendor:"polyhaven",discovery:{twinOf:"Poly Haven's public asset catalog as Volter Editor browses it: assets by type and category, an asset's files, and the files and thumbnails themselves",stores:"the published assets with their files trees, each file's bytes, and each thumbnail"},lanes:{routes:[{lane:"dl",host:"^(dl\\.polyhaven\\.org|cdn\\.polyhaven\\.com)$"},{lane:"api",host:"^api\\.polyhaven\\.com$"}],default:"api"},descriptor:{protocol:"3",transport:"rest",archetype:"crud",bin:"world-polyhaven",resources:["asset"],specSource:"Poly Haven's OpenAPI document (api/spec/SOURCE.md) and the download hosts' document written from it and Backblaze's page (dl/spec/SOURCE.md)",description:"Poly Haven twin \u2014 the public asset catalog (assets by type and category, an asset's files, their downloads and thumbnails), as Volter Editor's asset library browses and imports it.",adoption:{sdks:[],envStems:[]},hosts:[{host:"api.polyhaven.com"},{host:"dl.polyhaven.org"},{host:"cdn.polyhaven.com"}],endpointEnvNone:"the editor calls api.polyhaven.com and the urls it answers; the World claims the hosts"}};var g={vendor:"polyhaven",service:"polyhaven",body:{json:"always"},ids:{template:"{uuid}"},time:"unix",error:"{message}",readOnly:{status:403,message:"This twin was started read-only; writes are refused."},notFound:{status:404,message:"No asset with id {id}"},gap:{status:404,message:"Cannot GET"},list:{style:"envelope",envelope:{data:"{data}"},limit:{param:"limit",default:100,max:100}},deleted:{},unmodeled:["get_author_id","get_info_id","get_search","get_taxonomy","get_taxonomy_type","get_types"],resources:{asset:{idPrefix:"",refresh:{list:"get_assets",items:"$body",keyed:!0,unpaginated:!0}},_file:{idPrefix:""}},doors:[{id:"assets",method:"POST",path:"/_twin/assets",note:"{ id, type (hdris|textures|models), name, categories, tags?, authors?, description?, category?, date_published?, files: { <group>: { <resolution>: { <format>: { name?, text | base64, include?: { <path>: { text | base64 } } } } } }, thumbnail? (base64 PNG) }: Poly Haven publishes an asset; answers it as /info would"}],discovery:{twinOf:"Poly Haven's catalog API: assets by type and category, their categories' counts, an asset's files",stores:"the published assets and their files trees (the dl lane serves the bytes)",identity:"none: the API is public"},descriptor:{protocol:"3",transport:"rest",archetype:"crud",bin:"world-polyhaven-api",resources:["asset"],specSource:"Poly Haven's OpenAPI document (spec/SOURCE.md)",description:"Poly Haven's api lane \u2014 the catalog.",adoption:{sdks:[],envStems:[]},hosts:[{host:"api.polyhaven.com"}],endpointEnvNone:"the vendor lane"}};var $={generatedBy:"scripts/derive-pack.ts",spec:"openapi.json",format:"openapi",version:"1.0.0",resources:[],operations:[{id:"get_assets",method:"get",path:"/assets",pathParams:[],query:[{name:"attributes",type:"string",required:!1},{name:"categories",type:"string",required:!1},{name:"category",type:"string",required:!1},{name:"collection",type:"string",required:!1},{name:"type",type:"string",required:!1},{name:"vault",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,class:"retrieve",resource:"assets"},{id:"get_author_id",method:"get",path:"/author/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed"},{id:"get_categories_type",method:"get",path:"/categories/{type}",pathParams:["type"],query:[{name:"in",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,class:"computed"},{id:"get_files_id",method:"get",path:"/files/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed"},{id:"get_info_id",method:"get",path:"/info/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed"},{id:"get_search",method:"get",path:"/search",pathParams:[],query:[{name:"future",type:"boolean",required:!1},{name:"hybrid",type:"boolean",required:!1},{name:"limit",type:"integer",required:!1},{name:"min",type:"number",required:!1,minimum:-1,maximum:1},{name:"q",type:"string",required:!0},{name:"t",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,class:"retrieve",resource:"searchResults"},{id:"get_taxonomy",method:"get",path:"/taxonomy",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed"},{id:"get_taxonomy_type",method:"get",path:"/taxonomy/{type}",pathParams:["type"],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed"},{id:"get_types",method:"get",path:"/types",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed"}]};var b={vendor:"polyhaven",service:"polyhaven",body:{json:"always"},ids:{template:"{uuid}"},time:"unix",error:{code:"{code}",message:"{message}",status:"{status}"},readOnly:{status:401,code:"unauthorized",message:"This twin was started read-only; writes are refused."},notFound:{status:404,code:"not_found",message:"File with such name does not exist."},gap:{status:404,code:"not_found",message:"File with such name does not exist."},spanning:["fileName"],deleted:{},resources:{},discovery:{twinOf:"Poly Haven's download hosts: an asset's files by name in the ph-assets bucket, and its thumbnail",stores:"nothing of its own: the files and thumbnails are the api lane's"},descriptor:{protocol:"3",transport:"rest",archetype:"crud",bin:"world-polyhaven-dl",resources:[],specSource:"the download hosts' document (spec/SOURCE.md)",description:"Poly Haven's dl lane \u2014 files and thumbnails.",adoption:{sdks:[],envStems:[]},hosts:[{host:"dl.polyhaven.org"},{host:"cdn.polyhaven.com"}],endpointEnvNone:"the vendor lane"}};var A={generatedBy:"scripts/derive-pack.ts",spec:"openapi.json",format:"openapi",version:"1.0.0",resources:[],operations:[{id:"getThumbnail",method:"get",path:"/asset_img/thumbs/{file}",pathParams:["file"],query:[{name:"height",type:"integer",required:!1},{name:"v",type:"string",required:!1},{name:"width",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,responseMedia:{"200":["image/png"]},defaultResponseMedia:{"200":"image/png"},class:"computed"},{id:"downloadFileByName",method:"get",path:"/file/{bucket}/{fileName}",pathParams:["bucket","fileName"],query:[],body:[],bodyEncoding:"none",successStatus:200,responseMedia:{"200":["application/octet-stream"]},defaultResponseMedia:{"200":"application/octet-stream"},class:"computed"}]};import{createVendorFetch as ge}from"../../engine/v3/volter_world-core.mjs";import{createPackFetch as me}from"../../engine/v3/volter_world-core.mjs";var M={};ae(M,{assets:()=>ce});var f="asset",F="_file",h={hdris:0,textures:1,models:2},V=["HDRIs","Textures","Models"],L="ph-assets",W=e=>`https://dl.polyhaven.org/file/${L}/${e}`,P=e=>`/asset_img/thumbs/${e}.png`,d=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{},E=(e,t)=>new Response(t,{status:e,headers:{"content-type":"text/html; charset=utf-8"}}),O=e=>e.rowsRaw(f).filter(t=>t.deleted!==!0),T=(e,t)=>Object.fromEntries(Object.entries(e.own(t)).filter(([s])=>!s.startsWith("_")&&s!=="id")),v=(e,t)=>e.own(t).type;function R(e){return e===null||e==="all"?"all":Object.hasOwn(h,e)?h[e]:E(400,`Unsupported asset type: ${e}.
|
|
3
|
+
Must be: hdris/textures/models/all`)}var k=e=>e?e.split(",").map(t=>t.trim()).filter(Boolean):[],N=(e,t)=>t.every(s=>(e.categories??[]).includes(s));var u=(e,t=400)=>Response.json({message:e},{status:t});function Y(e){if(typeof e.text=="string")return new TextEncoder().encode(e.text);if(typeof e.base64=="string")return Uint8Array.from(atob(e.base64),t=>t.charCodeAt(0))}async function ce(e){let t=d(e.body),s=String(t.id??"");if(!/^[A-Za-z0-9_-]+$/.test(s))return u("id must be a slug: letters, digits, _ and -");if(e.row(f,s))return u(`an asset ${s} is published already`,409);if(!Object.hasOwn(h,String(t.type)))return u("type must be hdris, textures or models");let r=h[String(t.type)];if(typeof t.name!="string"||!t.name)return u("name is required");if(!Array.isArray(t.categories)||!t.categories.every(o=>typeof o=="string"))return u("categories must be an array of strings");let c=V[r],m=[],a=new Map,S=(o,l)=>{if(a.has(o))throw new Error("duplicate file name");if(o.split("/").some(p=>!p||p==="."||p==="..")||o.includes("\\")||o.includes("\0"))throw new Error("invalid file name");return a.set(o,l),m.push({id:o,name:o,size:l.length,_sha1:e.crypto.digest("sha1",l),md5:e.crypto.md5(l),_asset:s}),{size:l.length,url:W(o),md5:e.crypto.md5(l)}},w=Object.create(null);try{for(let[o,l]of Object.entries(d(t.files)))for(let[p,te]of Object.entries(d(l)))for(let[_,se]of Object.entries(d(te))){if([o,p,_].some(x=>["__proto__","prototype","constructor"].includes(x)))return u("reserved file tree key");let q=d(se),I=Y(q);if(!I)return u(`files.${o}.${p}.${_} needs text or base64`);let z=`${c}/${_}/${p}/${s}`,U=Object.create(null);for(let[x,re]of Object.entries(d(q.include))){let D=Y(d(re));if(!D)return u(`files.${o}.${p}.${_}.include.${x} needs text or base64`);U[x]=S(`${z}/${x}`,D)}let oe=S(`${z}/${typeof q.name=="string"?q.name:`${s}${r===1?`_${o}`:""}_${p}.${_}`}`,I);(w[o]??={})[p]={...d(d(w[o])[p]),[_]:{...Object.keys(U).length?{include:U}:{},...oe}}}}catch{return u("files must contain valid base64 and unique relative file names")}let y=typeof t.thumbnail=="string"?t.thumbnail:void 0,n=y?e.crypto.md5(y).slice(0,8):void 0,i;try{i=y?Uint8Array.from(atob(y),o=>o.charCodeAt(0)):void 0}catch{return u("thumbnail must be valid base64")}for(let[o,l]of a)await e.blobs.put(o,l);i&&await e.blobs.put(P(s).slice(1),i);for(let o of m)await e.record(F,o,String(o.id));return await e.write(f,s,{date_published:typeof t.date_published=="number"?t.date_published:Math.floor(Date.parse(e.occurredAt)/1e3),name:t.name,description:typeof t.description=="string"?t.description:"",categories:t.categories,tags:Array.isArray(t.tags)?t.tags:[],authors:d(t.authors),...typeof t.category=="string"?{category:t.category}:{},files_hash:e.crypto.digest("sha1",JSON.stringify(w)),download_count:0,...n?{img_version:n}:{},thumbnail_url:`https://cdn.polyhaven.com${P(s)}?width=256&height=256${n?`&v=${n}`:""}`,type:r,_files:w,_thumbnail:y!==void 0},"asset.publish"),Response.json({id:s,...T(e,e.row(f,s))},{status:201})}async function G(e){let t=new URL(e.call.request.url).searchParams,s=R(t.get("type")??t.get("t"));if(s instanceof Response)return s;let r=k(t.get("categories")??t.get("c")),c=new Set(O(e).flatMap(a=>a.categories??[]));if(r.some(a=>!c.has(a)))return E(400,"Unknown category");let m=O(e).filter(a=>(s==="all"||v(e,a)===s)&&N(a,r));return Response.json(Object.fromEntries(m.map(a=>[String(a.id),T(e,a)])))}async function K(e){let t=new URL(e.call.request.url).searchParams,s=String(e.call.params.type),r=R(s);if(r instanceof Response)return r;let c=k(t.get("in")),m=O(e).filter(n=>N(n,c)),a=new Map,S=n=>{a.set(n,(a.get(n)??0)+1)};if(r==="all")for(let n of m)S(Object.keys(h).find(i=>h[i]===v(e,n)));else for(let n of m.filter(i=>v(e,i)===r))for(let i of n.categories??[])c.includes(i)||S(i);let w=[...a].sort((n,i)=>i[1]-n[1]||n[0].localeCompare(i[0])),y=c.length?[]:[["all",r==="all"?m.length:m.filter(n=>v(e,n)===r).length]];return Response.json(Object.fromEntries([...y,...w]))}async function J(e){let t=String(e.call.params.id),s=e.row(f,t);return!s||s.deleted===!0?E(404,`No asset with id ${t}`):Response.json(d(s._files))}var Z={get_assets:G,get_categories_type:K,get_files_id:J};function B(e={}){return me({manifest:g,surface:$,handlers:Z,doors:M},e)}import{createPackFetch as ye}from"../../engine/v3/volter_world-core.mjs";async function Q(e){let t=String(e.call.params.file),s=t.endsWith(".png")?t.slice(0,-4):"",r=s?e.row(f,s):void 0,c=r&&r.deleted!==!0&&r._thumbnail===!0?await e.blobs.get(P(s).slice(1)):null;return c?new Response(new Uint8Array(c).buffer,{headers:{"content-type":"image/png","content-length":String(c.length)}}):new Response("Not Found",{status:404,headers:{"content-type":"text/plain"}})}async function X(e){let t=String(e.call.params.fileName),s=String(e.call.params.bucket)===L?e.row(F,t):void 0;if(!s||s.deleted===!0)return Response.json({code:"not_found",message:"File with such name does not exist.",status:404},{status:404});let r=await e.blobs.get(t);return r?new Response(new Uint8Array(r).buffer,{headers:{"content-type":"application/octet-stream","content-length":String(r.length),"x-bz-file-name":t,"x-bz-content-sha1":String(s._sha1)}}):Response.json({code:"not_found",message:"File with such name does not exist.",status:404},{status:404})}var ee={downloadFileByName:X,getThumbnail:Q};function H(e={}){return ye({manifest:b,surface:A,handlers:ee},e)}function C(e={}){return ge(j,{api:{fetch:B(e),manifest:g},dl:{fetch:H(e),manifest:b}})}import{serveHttp as it}from"../../engine/v3/volter_world-core.mjs";var gt=we(be(j,{api:{manifest:g,surface:$},dl:{manifest:b,surface:A}}));export{C as createTwinFetch};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
@agenttwin/twin-postmark
|
|
2
|
+
|
|
3
|
+
Contains @volter/twin-postmark 0.1.37 by Volter (https://github.com/volter-ai),
|
|
4
|
+
licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
Modified by AgentTwin: bundled and minified into one file; only code reachable from the pack's
|
|
7
|
+
fetch factory is included; shared modules are imported from the AgentTwin twin engine.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{createRequire as __atReq}from'node:module';const require=__atReq(import.meta.url);
|
|
2
|
+
import{applyTwinWrite as Ke,projectResources as de,worldNow as Ve}from"../../engine/v2/volter_world-core.mjs";import{projectResources as q,deliveryTraceHeaders as Fe}from"../../engine/v2/volter_world-core.mjs";import{appDestination as Le,appFetch as Ue}from"../../engine/v2/volter_world-core_app-route.mjs";import{worldEgressRefusal as je}from"../../engine/v2/volter_world-core_network-policy.mjs";var ee="postmark";var $e={Delivery:"Delivery",Open:"Open",Click:"Click",Bounce:"Bounce",SpamComplaint:"SpamComplaint",SubscriptionChange:"SubscriptionChange"};function L(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function te(e,t,i){return q(ee,i).filter(a=>a.type==="webhook"&&a.deleted!==!0).filter(a=>a.MessageStream===e).filter(a=>L(L(a.Triggers)[$e[t]]).Enabled===!0)}function ne(e){let t={"content-type":"application/json"};for(let a of Array.isArray(e.HttpHeaders)?e.HttpHeaders:[]){let r=L(a);typeof r.Name=="string"&&r.Name!==""&&(t[r.Name]=String(r.Value??""))}let i=L(e.HttpAuth);return typeof i.Username=="string"&&i.Username!==""&&(t.Authorization=`Basic ${Buffer.from(`${i.Username}:${String(i.Password??"")}`).toString("base64")}`),t}var re=async(e,t,i)=>{if(!(!Le(e)&&je(e)!==null))try{await Ue(e,{method:"POST",headers:{...i,...Fe()},body:t})}catch{}};async function x(e,t,i,a={}){let r=te(e,t,a.root);if(r.length===0)return[];let o=a.deliver??re,p=JSON.stringify({RecordType:t,...i}),d=[];for(let T of r){let b=ne(T);await o(String(T.Url),p,b),d.push({url:String(T.Url),body:p,headers:b})}return d}async function se(e,t={}){let i=q(ee,t.root).find(T=>T.type==="server"&&T.deleted!==!0),a=typeof i?.InboundHookUrl=="string"?i.InboundHookUrl:"";if(a==="")return[];let r;try{r=new URL(a)}catch{return[]}let o={"content-type":"application/json"};r.username!==""&&(o.Authorization=`Basic ${Buffer.from(`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`).toString("base64")}`,r.username="",r.password="");let p=r.toString(),d=JSON.stringify(e);return await(t.deliver??re)(p,d,o),[{url:p,body:d,headers:o}]}function V(e){let t=String(e.recipient??"").split("@")[0]?.toLowerCase()??"";if(t.startsWith("bounce"))return{events:["Bounced"],status:"Sent"};if(t.startsWith("spam")||t.startsWith("complaint"))return{events:["Delivered","SpamComplaint"],status:"Sent"};let i=["Delivered"];return e.trackOpens&&i.push("Opened"),e.trackLinks&&e.trackLinks!=="None"&&i.push("LinkClicked"),{events:i,status:"Sent"}}var J="postmark",c={ok:0,badToken:10,bulkNotApproved:14,invalidEmailRequest:300,invalidJson:402,invalidRequestField:403,inactiveRecipient:406,tooManyBatchMessages:410,signatureNotFound:501,signatureNoData:502,publicDomainSignature:503,signatureExists:504,domainNotFound:510,domainExists:512,domainNameRequired:514,fromEmailRequired:520,invalidEmailValue:522,serverInboundDomainInUse:602,serverNameExists:603,serverNameInvalid:608,serverNoData:609,serverNotFound:1453,messageNotFound:701,inboundRuleNoData:809,inboundRuleExists:810,inboundRuleNotFound:812,bounceNotFound:1001,bounceCannotActivate:1003,templateNotFound:1101,templateNoData:1109,streamTypeInvalid:1221,streamNameRequired:1223,streamNotFound:1226,streamIdInvalid:1227,streamCannotArchiveDefault:1229,streamIdExists:1230,streamCannotArchive:1241,streamCannotUnarchive:1232,streamIdReservedPrefix:1233,sendStreamNotFound:1235,dataRemovalIdInvalid:1301,webhookArchivedStream:1350,webhookNotFound:1352,webhookUrlRequired:1354,suppressionAuthority:1406,suppressionInvalidEmail:1408,suppressionNoBody:1409};function B(e,t,i){return{status:t,body:{ErrorCode:i,Message:e}}}function m(e,t){return B(t,422,e)}function E(e){return{status:200,body:{ErrorCode:c.ok,Message:e}}}var U=500,ce="POSTMARK_API_TEST";function me(e,t){if(!e)return;let i=t.toLowerCase();for(let[a,r]of Object.entries(e))if(a.toLowerCase()===i)return r}function We(e,t,i){if(e.headers===void 0)return null;let a=t==="account"?"x-postmark-account-token":"x-postmark-server-token",r=(me(e.headers,a)??"").trim();return r===""?B(`Request does not contain a valid ${t==="account"?"Account":"Server"} token.`,401,c.badToken):r===ce&&!i?B("The Postmark Test API Token may only be used on the /email endpoint.",403,c.badToken):null}function Ge(e){return(me(e.headers,"x-postmark-server-token")??"").trim()===ce}function w(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function C(e){return e??Ve()}function $(e,t){return de(J,t).filter(i=>i.type===e&&!i.id.startsWith("_"))}function v(e,t){return $(e,t).filter(i=>i.deleted!==!0)}function S(e){let t={};for(let[i,a]of Object.entries(e))i==="type"||i==="id"||i==="updatedAt"||i.startsWith("_")||(t[i]=a);return t}function y(e,t,i){return v(e,i).find(a=>a.id===t)}function N(e,t){let i=0;for(let a of $(e,t)){let r=Number(a.id);Number.isFinite(r)&&r>i&&(i=r)}return i+1}function Ye(e,t){let i="";for(let a=0;i.length<t;a+=1){let r=2166136261,o=`${a}:${e}`;for(let p=0;p<o.length;p+=1)r^=o.charCodeAt(p),r=Math.imul(r,16777619)>>>0;i+=r.toString(16).padStart(8,"0")}return i.slice(0,t)}function pe(e,t){let i=`${e}:${t.occurredAt??""}:${$(e,t.root).length}`,a=Ye(i,32);return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20,32)}`}function Je(e,t,i){let a=de(J,i).find(r=>r.type===e&&r.id===t);return(typeof a?._seq=="number"?a._seq:0)+1}async function h(e,t,i,a,r){let{resource:o}=await Ke(J,{operation:a,subjectType:e,subjectId:t,fields:{...i,_seq:Je(e,t,r.root)},...r.occurredAt?{occurredAt:r.occurredAt}:{},actor:{kind:"agent"}},r.root);return S(o)}var ze=[{ID:"outbound",Name:"Transactional Stream",MessageStreamType:"Transactional",Description:"Default Transactional Stream"},{ID:"broadcast",Name:"Broadcast Stream",MessageStreamType:"Broadcast",Description:"Default Broadcast Stream"},{ID:"inbound",Name:"Inbound Stream",MessageStreamType:"Inbound",Description:"Default Inbound Stream"}],Ze=new Set(["outbound","inbound"]),I=1;async function Xe(e){if(e.readOnly)return;let t=C(e.occurredAt);for(let i of ze)y("message_stream",i.ID,e.root)||await h("message_stream",i.ID,{ID:i.ID,ServerID:I,Name:i.Name,Description:i.Description,MessageStreamType:i.MessageStreamType,CreatedAt:t,UpdatedAt:null,ArchivedAt:null,SubscriptionManagementConfiguration:{UnsubscribeHandlingType:i.MessageStreamType==="Broadcast"?"Postmark":"None"}},"message_stream.bootstrap",e);y("server",String(I),e.root)||await h("server",String(I),fe(I,"Twin Server",{}),"server.bootstrap",e)}function fe(e,t,i){return{ID:e,Name:t,ApiTokens:[`postmark-twin-server-token-${e}`],ServerLink:`https://account.postmarkapp.com/servers/${e}/streams`,Color:"blue",SmtpApiActivated:!0,RawEmailEnabled:!1,DeliveryType:"Live",InboundAddress:`twin${e}inbound@inbound.postmarkapp.com`,InboundHookUrl:"",BounceHookUrl:"",OpenHookUrl:"",DeliveryHookUrl:"",ClickHookUrl:"",PostFirstOpenOnly:!1,InboundDomain:"",InboundHash:`twinhash${e}`,InboundSpamThreshold:5,TrackOpens:!1,TrackLinks:"None",IncludeBounceContentInHook:!1,EnableSmtpApiErrorHooks:!1,...Y(i)}}function P(e){return typeof e!="string"||e.trim()===""?[]:e.split(",").map(t=>{let i=t.trim(),a=/^(.*)<([^>]+)>$/.exec(i);return a?{Email:a[2].trim(),Name:a[1].trim().replace(/^"|"$/g,"")}:{Email:i,Name:""}}).filter(t=>t.Email!=="")}function H(e){return e.map(t=>t.Email)}function z(e){return P(typeof e=="string"?e:"")[0]?.Email??""}var _=e=>/^[^@\s,]+@[^@\s,]+\.[^@\s,]+$/.test(e),K=(e,t)=>`${e}::${t.toLowerCase()}`;function Qe(e,t,i){return y("suppression",K(e,t),i)!==void 0}async function ge(e,t,i,a,r){await h("suppression",K(e,t),{EmailAddress:t,SuppressionReason:i,Origin:a,CreatedAt:C(r.occurredAt),MessageStream:e,deleted:!1},"suppression.create",r)}function W(e,t){if(typeof e.From!="string"||!_(z(e.From)))return m(c.invalidEmailRequest,"Invalid 'From' value.");let i=[...P(e.To),...P(e.Cc),...P(e.Bcc)];if(i.length===0)return m(c.invalidEmailRequest,"Zero recipients specified.");let a=i.find(r=>!_(r.Email));if(a)return m(c.invalidEmailRequest,`Error parsing 'To': Illegal email address '${a.Email}'.`);for(let[r,o]of[["To",e.To],["Cc",e.Cc],["Bcc",e.Bcc]])if(P(o).length>50)return m(c.invalidEmailRequest,`Error parsing '${r}': you may only send to 50 recipients per field.`);if(!t){let r=typeof e.HtmlBody=="string"&&e.HtmlBody!=="",o=typeof e.TextBody=="string"&&e.TextBody!=="";if(!r&&!o)return m(c.invalidEmailRequest,"Provide either email TextBody or HtmlBody or both.")}if(e.Attachments!==void 0){if(!Array.isArray(e.Attachments))return m(c.invalidEmailRequest,"Error parsing 'Attachments': expected an array.");for(let r of e.Attachments){let o=w(r);if(typeof o.Name!="string"||o.Name==="")return m(c.invalidEmailRequest,"Error parsing 'Attachments': each attachment requires a Name.");if(typeof o.Content!="string"||o.Content==="")return m(c.invalidEmailRequest,"Error parsing 'Attachments': each attachment requires base64 Content.");if(typeof o.ContentType!="string"||o.ContentType==="")return m(c.invalidEmailRequest,"Error parsing 'Attachments': each attachment requires a ContentType.")}}return null}function ye(e,t){let i=String(e??"");if(i==="")return;let a=v("template",t);return a.find(r=>String(r.TemplateId)===i)??a.find(r=>r.Alias!=null&&String(r.Alias)===i)}function j(e,t){return typeof e!="string"?"":e.replace(/\{\{\s*([\w.]+)\s*\}\}/g,(i,a)=>{let r=t;for(let o of a.split("."))if(r&&typeof r=="object"&&o in r)r=r[o];else return"";return r==null?"":String(r)})}function qe(...e){let t={};for(let i of e)if(typeof i=="string")for(let a of i.matchAll(/\{\{\s*([\w.]+)\s*\}\}/g)){let r=a[1].split(".")[0];r in t||(t[r]=`${r}_Value`)}return t}async function G(e,t){let i=typeof e.MessageStream=="string"&&e.MessageStream!==""?e.MessageStream:"outbound";if(!y("message_stream",i,t.root))return m(c.sendStreamNotFound,"The stream provided does not exist on this server.");let a=P(e.To),r=P(e.Cc),o=P(e.Bcc),p=[...H(a),...H(r),...H(o)],d=p.filter(u=>Qe(i,u,t.root));if(d.length)return m(c.inactiveRecipient,`You tried to send to recipient(s) that have been marked as inactive. Found inactive addresses: ${d.join(", ")}. Inactive recipients are ones that have generated a hard bounce or a spam complaint.`);let T=C(t.occurredAt),b=pe("message",t);await h("message",b,{MessageID:b,Tag:typeof e.Tag=="string"?e.Tag:"",To:a,Cc:r,Bcc:o,Recipients:p,ReceivedAt:T,From:String(e.From??""),Subject:typeof e.Subject=="string"?e.Subject:"",Attachments:Array.isArray(e.Attachments)?e.Attachments.map(u=>String(w(u).Name??"")):[],Status:"Sent",TrackOpens:e.TrackOpens===!0,TrackLinks:typeof e.TrackLinks=="string"&&e.TrackLinks!==""?e.TrackLinks:"None",Metadata:w(e.Metadata),MessageStream:i,Sandboxed:!1,HtmlBody:typeof e.HtmlBody=="string"?e.HtmlBody:null,TextBody:typeof e.TextBody=="string"?e.TextBody:null,ReplyTo:typeof e.ReplyTo=="string"?e.ReplyTo:"",Headers:Array.isArray(e.Headers)?e.Headers:[],MessageEvents:[]},"message.send",t),await et(b,t);let k={To:H(a).join(", "),SubmittedAt:T,MessageID:b,ErrorCode:c.ok,Message:Ge(t)?"Test job accepted":"OK"};return r.length&&(k.Cc=H(r).join(", ")),o.length&&(k.Bcc=H(o).join(", ")),{status:200,body:k}}async function et(e,t){let i=y("message",e,t.root);if(!i)return;let a=C(t.occurredAt),r=String(i.MessageStream??"outbound"),o=i.Recipients?.[0]??"",p=V({recipient:o,trackOpens:i.TrackOpens===!0,trackLinks:String(i.TrackLinks??"None")}),d={Name:"Twin Mail",Company:"Volter",Family:"Twin"},T={CountryISOCode:"US",Country:"United States"},b=[];for(let k of p.events)if(k==="Delivered")b.push({Recipient:o,Type:"Delivered",ReceivedAt:a,Details:{DeliveryMessage:"smtp;250 2.0.0 OK",DestinationServer:"twin.local (127.0.0.1)",DestinationIP:"127.0.0.1"}}),await x(r,"Delivery",{RecordType:"Delivery",ServerID:I,MessageStream:r,MessageID:e,Recipient:o,Tag:i.Tag??"",DeliveredAt:a,Details:"smtp;250 2.0.0 OK",Metadata:i.Metadata??{}},t);else if(k==="Opened")b.push({Recipient:o,Type:"Opened",ReceivedAt:a,Details:{Summary:"Opened by the twin recipient"}}),await x(r,"Open",{RecordType:"Open",MessageStream:r,FirstOpen:!0,MessageID:e,Recipient:o,Tag:i.Tag??"",ReceivedAt:a,Platform:"WebMail",ReadSeconds:5,UserAgent:"postmark-twin",Client:d,OS:d,Geo:T,Metadata:i.Metadata??{}},t);else if(k==="LinkClicked")b.push({Recipient:o,Type:"LinkClicked",ReceivedAt:a,Details:{Summary:"Clicked by the twin recipient",Link:"https://twin.test/link",ClickLocation:"HTML"}}),await x(r,"Click",{RecordType:"Click",MessageStream:r,MessageID:e,Recipient:o,Tag:i.Tag??"",ReceivedAt:a,ClickLocation:"HTML",OriginalLink:"https://twin.test/link",Platform:"Desktop",UserAgent:"postmark-twin",Client:d,OS:d,Geo:T,Metadata:i.Metadata??{}},t);else if(k==="Bounced"||k==="SpamComplaint"){let u=k==="SpamComplaint",s=N("bounce",t.root),n={RecordType:"Bounce",ID:s,Type:u?"SpamComplaint":"HardBounce",TypeCode:u?100001:1,Name:u?"Spam complaint":"Hard bounce",Tag:i.Tag??"",MessageID:e,ServerID:I,Description:u?"The subscriber explicitly marked this message as spam.":"The server was unable to deliver your message (ex: unknown user, mailbox not found).",Details:u?"Test spam complaint":"Test bounce",Email:o,From:z(i.From),BouncedAt:a,DumpAvailable:!0,Inactive:!0,CanActivate:!u,Subject:String(i.Subject??""),MessageStream:r};await h("bounce",String(s),n,"bounce.record",t),await ge(r,o,u?"SpamComplaint":"HardBounce","Recipient",t),b.push({Recipient:o,Type:u?"SpamComplaint":"Bounced",ReceivedAt:a,Details:{Summary:n.Description,BounceID:s}}),await x(r,u?"SpamComplaint":"Bounce",{...n,RecordType:u?"SpamComplaint":"Bounce"},t)}await h("message",e,{MessageEvents:b,Status:p.status},"message.deliver",t)}function he(e){return Array.isArray(e.MessageEvents)?e.MessageEvents:[]}function A(e,t){return he(e).filter(i=>i.Type===t).length}function O(e,t){return v("message",e).reduce((i,a)=>i+A(a,t),0)}function tt(e){let t=v("message",e),i=t.length,a=O(e,"Bounced"),r=O(e,"SpamComplaint"),o=O(e,"Opened"),p=O(e,"LinkClicked"),d=t.filter(k=>k.TrackOpens===!0).length,T=t.filter(k=>k.TrackLinks!=="None").length,b=k=>i===0?0:Number((k/i*100).toFixed(3));return{Sent:i,Bounced:a,SMTPApiErrors:0,BounceRate:b(a),SpamComplaints:r,SpamComplaintsRate:b(r),Opens:o,UniqueOpens:t.filter(k=>A(k,"Opened")>0).length,Tracked:d+T,WithLinkTracking:T,WithOpenTracking:d,TotalTrackedLinksSent:T,UniqueLinksClicked:t.filter(k=>A(k,"LinkClicked")>0).length,TotalClicks:p,WithClientRecorded:o,WithPlatformRecorded:o,WithReadTimeRecorded:o}}function D(e,t,i){let a=new Map;for(let o of v("message",e)){let p=String(o.ReceivedAt??"").slice(0,10)||"1970-01-01",d=a.get(p)??{};for(let[T,b]of Object.entries(i(o)))d[T]=(d[T]??0)+b;a.set(p,d)}return{Days:[...a.entries()].sort(([o],[p])=>o.localeCompare(p)).map(([o,p])=>({Date:o,...p})),...t}}function ae(e,t){let i={Name:"Twin Mail",Company:"Volter",Family:"Twin"},a=[];for(let r of v("message",e))for(let o of he(r)){if(o.Type!==t)continue;let p={MessageID:r.MessageID,MessageStream:r.MessageStream,Recipient:o.Recipient,Tag:r.Tag??"",ReceivedAt:o.ReceivedAt,UserAgent:"postmark-twin",Client:i,OS:i,Geo:{CountryISOCode:"US",Country:"United States"}};a.push(t==="Opened"?{RecordType:"Open",...p,Platform:"WebMail",FirstOpen:!0,ReadSeconds:5}:{RecordType:"Click",...p,Platform:"Desktop",ClickLocation:"HTML",OriginalLink:"https://twin.test/link"})}return a}function M(e,t){let i=Number(t.offset??"0")||0,a=Number(t.count??""),r=Number.isFinite(a)&&a>0?a:e.length;return e.slice(i,i+r)}var nt=new Set(["servers","domains","senders","data-removals"]);async function Z(e){let t=e.method.toUpperCase(),i=e.path.split("?"),a=i[0].replace(/\/+$/,"")||"/",r=Object.fromEntries(new URLSearchParams(i[1]??"")),o=a.replace(/^\/+/,"").split("/"),p=(o[0]??"").toLowerCase(),d=s=>decodeURIComponent(o[s]??"");if(e.readOnly&&t!=="GET")return B("twin is read-only; omit readOnly to accept writes",405,405);let T=nt.has(p)||p==="templates"&&(o[1]??"").toLowerCase()==="push",b=We(e,T?"account":"server",p==="email");if(b)return b;let k={};if(e.body)try{k=JSON.parse(e.body)}catch{return m(c.invalidJson,"Invalid JSON")}let u=w(k);if(a==="/"||a==="")return{status:200,body:{ErrorCode:0,Message:"OK",Service:"postmark",Object:"twin"}};if(await Xe(e),p==="_twin"&&o[1]==="inbound"&&t==="POST"){let s=pe("inbound_message",e),n=String(u.From??"sender@twin.test"),l=String(u.To??"twin1inbound@inbound.postmarkapp.com"),g=C(e.occurredAt),f=_e=>({Email:_e,Name:"",MailboxHash:""}),Q=await h("inbound_message",s,{MessageID:s,From:n,FromName:String(u.FromName??""),FromFull:f(n),To:l,ToFull:[f(l)],Cc:"",CcFull:[],Bcc:"",BccFull:[],ReplyTo:"",OriginalRecipient:l,Subject:String(u.Subject??""),Date:g,MailboxHash:String(u.MailboxHash??""),Tag:String(u.Tag??""),Status:"Processed",Attachments:[],MessageStream:"inbound",TextBody:String(u.TextBody??""),HtmlBody:String(u.HtmlBody??""),StrippedTextReply:"",Headers:[],BlockedReason:""},"inbound_message.receive",e);return await se(Q,e),{status:200,body:Q}}if(p==="email"){if(o.length===1&&t==="POST")return W(u,!1)??G(u,e);if(o.length===2&&o[1]==="withTemplate"&&t==="POST")return oe(u,e);if(o.length===2&&o[1]==="batch"&&t==="POST"){let s=Array.isArray(k)?k:[];if(s.length===0)return m(c.invalidEmailRequest,"Provide a non-empty array of messages.");if(s.length>U)return m(c.tooManyBatchMessages,`You may only send up to ${U} messages in a single batched request.`);let n=[];for(let l of s){let g=w(l),f=W(g,!1);n.push(f?f.body:(await G(g,e)).body)}return{status:200,body:n}}if(o.length===2&&o[1]==="batchWithTemplates"&&t==="POST"){let s=Array.isArray(u.Messages)?u.Messages:[];if(s.length===0)return m(c.invalidEmailRequest,"Provide a non-empty 'Messages' array.");if(s.length>U)return m(c.tooManyBatchMessages,`You may only send up to ${U} messages in a single batched request.`);let n=[];for(let l of s)n.push((await oe(w(l),e)).body);return{status:200,body:n}}if(o.length===2&&o[1]==="bulk"&&t==="POST"||o.length===3&&o[1]==="bulk"&&t==="GET")return m(c.bulkNotApproved,"This endpoint requires approval to access. Contact support to use the Bulk API.")}if(p==="messages"&&o[1]==="outbound"){if(o[2]==="opens"&&t==="GET"){let s=ae(e.root,"Opened");return o.length===4&&(s=s.filter(n=>n.MessageID===d(3))),r.recipient&&(s=s.filter(n=>String(n.Recipient).includes(r.recipient))),r.tag&&(s=s.filter(n=>n.Tag===r.tag)),{status:200,body:{TotalCount:s.length,Opens:M(s,r)}}}if(o[2]==="clicks"&&t==="GET"){let s=ae(e.root,"LinkClicked");return o.length===4&&(s=s.filter(n=>n.MessageID===d(3))),r.recipient&&(s=s.filter(n=>String(n.Recipient).includes(r.recipient))),r.tag&&(s=s.filter(n=>n.Tag===r.tag)),{status:200,body:{TotalCount:s.length,Clicks:M(s,r)}}}if(o.length===2&&t==="GET"){let s=v("message",e.root).map(S).sort((n,l)=>String(l.ReceivedAt??"").localeCompare(String(n.ReceivedAt??"")));return r.recipient&&(s=s.filter(n=>n.Recipients.some(l=>l.includes(r.recipient)))),r.fromEmail&&(s=s.filter(n=>z(n.From).includes(r.fromEmail))),r.tag&&(s=s.filter(n=>n.Tag===r.tag)),r.subject&&(s=s.filter(n=>String(n.Subject??"").includes(r.subject))),r.status&&(s=s.filter(n=>String(n.Status??"").toLowerCase()===r.status.toLowerCase())),r.messageStream&&(s=s.filter(n=>n.MessageStream===r.messageStream)),{status:200,body:{TotalCount:s.length,Messages:M(s,r).map(ie)}}}if(o.length===4&&o[3]==="details"&&t==="GET"){let s=y("message",d(2),e.root);if(!s)return m(c.messageNotFound,"This message was not found.");let n=S(s);return{status:200,body:{...ie(n),TextBody:n.TextBody,HtmlBody:n.HtmlBody,Body:ue(n),MessageEvents:n.MessageEvents??[]}}}if(o.length===4&&o[3]==="dump"&&t==="GET"){let s=y("message",d(2),e.root);return s?{status:200,body:{Body:ue(S(s))}}:m(c.messageNotFound,"This message was not found.")}}if(p==="messages"&&o[1]==="inbound"){if(o.length===2&&t==="GET"){let s=v("inbound_message",e.root).map(S).map(rt);return r.recipient&&(s=s.filter(n=>String(n.To??"").includes(r.recipient))),r.fromEmail&&(s=s.filter(n=>String(n.From??"").includes(r.fromEmail))),r.subject&&(s=s.filter(n=>String(n.Subject??"").includes(r.subject))),r.mailboxHash&&(s=s.filter(n=>n.MailboxHash===r.mailboxHash)),r.status&&(s=s.filter(n=>String(n.Status??"").toLowerCase()===r.status.toLowerCase())),{status:200,body:{TotalCount:s.length,InboundMessages:M(s,r)}}}if(o.length===4&&o[3]==="details"&&t==="GET"){let s=y("inbound_message",d(2),e.root);return s?{status:200,body:S(s)}:m(c.messageNotFound,"This message was not found.")}if(o.length===4&&(o[3]==="bypass"||o[3]==="retry")&&t==="PUT"){let s=y("inbound_message",d(2),e.root);if(!s)return m(c.messageNotFound,"This message was not found, or cannot be bypassed or retried.");let n=o[3]==="bypass";return n&&s.Status!=="Blocked"?m(c.messageNotFound,"This message was not found, or cannot be bypassed or retried."):(await h("inbound_message",d(2),{Status:n?"Processed":"Queued",BlockedReason:""},n?"inbound_message.bypass":"inbound_message.retry",e),E(n?"Successfully bypassed message.":"Successfully rescheduled failed message."))}}if(p==="deliverystats"&&o.length===1&&t==="GET"){let s=v("bounce",e.root),n=new Map;for(let l of s){let g=String(l.Type),f=n.get(g)??{Type:g,Name:String(l.Name??g),Count:0};f.Count+=1,n.set(g,f)}return{status:200,body:{InactiveMails:v("suppression",e.root).length,Bounces:[{Name:"All",Count:s.length},...n.values()]}}}if(p==="bounces"){if(o.length===1&&t==="GET"){let s=v("bounce",e.root).map(S).sort((n,l)=>Number(l.ID)-Number(n.ID));return r.type&&(s=s.filter(n=>n.Type===r.type)),r.emailFilter&&(s=s.filter(n=>String(n.Email??"").includes(r.emailFilter))),r.inactive!==void 0&&(s=s.filter(n=>String(n.Inactive)===r.inactive)),r.messageID&&(s=s.filter(n=>n.MessageID===r.messageID)),r.tag&&(s=s.filter(n=>n.Tag===r.tag)),{status:200,body:{TotalCount:s.length,Bounces:M(s,r)}}}if(o.length===2&&t==="GET"){let s=y("bounce",d(1),e.root);return s?{status:200,body:S(s)}:m(c.bounceNotFound,"The bounce was not found.")}if(o.length===3&&o[2]==="dump"&&t==="GET"){let s=y("bounce",d(1),e.root);return s?{status:200,body:{Body:`Return-Path: <>\r
|
|
3
|
+
Subject: Undelivered Mail Returned to Sender\r
|
|
4
|
+
To: ${s.From}\r
|
|
5
|
+
\r
|
|
6
|
+
${s.Description}\r
|
|
7
|
+
`}}:m(c.bounceNotFound,"The bounce was not found, or its dump is no longer available.")}if(o.length===3&&o[2]==="activate"&&t==="PUT"){let s=y("bounce",d(1),e.root);if(!s)return m(c.bounceNotFound,"The bounce was not found.");if(s.CanActivate!==!0)return m(c.bounceCannotActivate,"Due to the type of bounce, this address cannot be reactivated.");await h("bounce",d(1),{Inactive:!1},"bounce.activate",e);let n=K(String(s.MessageStream??"outbound"),String(s.Email??""));return y("suppression",n,e.root)&&await h("suppression",n,{deleted:!0},"suppression.delete",e),{status:200,body:{Message:"OK",Bounce:S(y("bounce",d(1),e.root))}}}}if(p==="templates"){if(o.length===2&&o[1]?.toLowerCase()==="push")return B("Cannot PUT /templates/push \u2014 the template-push API is not modeled by this twin",404,c.invalidRequestField);if(o.length===2&&o[1]==="validate"&&t==="POST"){let s=f=>({ContentIsValid:typeof f!="string"||!/\{\{[^}]*$/.test(f),ValidationErrors:[],RenderedContent:j(f,w(u.TestRenderModel))}),n=s(u.HtmlBody),l=s(u.TextBody),g=s(u.Subject);return{status:200,body:{AllContentIsValid:n.ContentIsValid&&l.ContentIsValid&&g.ContentIsValid,HtmlBody:n,TextBody:l,Subject:g,SuggestedTemplateModel:qe(u.HtmlBody,u.TextBody,u.Subject)}}}if(o.length===1&&t==="GET"){let s=v("template",e.root).map(S).sort((l,g)=>Number(l.TemplateId)-Number(g.TemplateId));r.templateType&&(s=s.filter(l=>l.TemplateType===r.templateType)),r.layoutTemplate&&(s=s.filter(l=>l.LayoutTemplate===r.layoutTemplate));let n=M(s,r).map(l=>({Active:l.Active,TemplateId:l.TemplateId,Name:l.Name,Alias:l.Alias,TemplateType:l.TemplateType,LayoutTemplate:l.LayoutTemplate}));return{status:200,body:{TotalCount:s.length,Templates:n}}}if(o.length===1&&t==="POST"){if(typeof u.Name!="string"||u.Name==="")return m(c.templateNoData,"A template Name is required.");let s=u.TemplateType==="Layout"?"Layout":"Standard",n=typeof u.Alias=="string"&&u.Alias!==""?u.Alias:null;if(n&&v("template",e.root).some(g=>g.Alias===n))return m(c.templateNotFound,`A template with the alias '${n}' already exists on this server.`);let l=N("template",e.root);return await h("template",String(l),{TemplateId:l,Name:u.Name,Alias:n,TemplateType:s,Subject:typeof u.Subject=="string"?u.Subject:"",HtmlBody:typeof u.HtmlBody=="string"?u.HtmlBody:null,TextBody:typeof u.TextBody=="string"?u.TextBody:null,LayoutTemplate:typeof u.LayoutTemplate=="string"?u.LayoutTemplate:null,Active:!0,AssociatedServerId:I},"template.create",e),{status:200,body:{TemplateId:l,Name:u.Name,Active:!0,Alias:n,TemplateType:s,LayoutTemplate:typeof u.LayoutTemplate=="string"?u.LayoutTemplate:null}}}if(o.length===2){let s=ye(d(1),e.root),n=m(c.templateNotFound,"The template associated with this request was not found.");if(t==="GET")return s?{status:200,body:S(s)}:n;if(t==="PUT"){if(!s)return n;let l={};for(let f of["Name","Subject","HtmlBody","TextBody","Alias","LayoutTemplate"])f in u&&(l[f]=u[f]);if(Object.keys(l).length===0)return m(c.templateNoData,"No template data received.");if(typeof l.Alias=="string"&&v("template",e.root).some(f=>f.Alias===l.Alias&&String(f.TemplateId)!==String(s.TemplateId)))return m(c.templateNotFound,`A template with the alias '${l.Alias}' already exists on this server.`);await h("template",String(s.TemplateId),l,"template.update",e);let g=y("template",String(s.TemplateId),e.root);return{status:200,body:{TemplateId:g.TemplateId,Name:g.Name,Active:g.Active,Alias:g.Alias,TemplateType:g.TemplateType,LayoutTemplate:g.LayoutTemplate}}}if(t==="DELETE")return s?(await h("template",String(s.TemplateId),{deleted:!0},"template.delete",e),E("Template deleted.")):n}}if(p==="message-streams"){if(o.length>=3&&o[2]==="suppressions")return ut(o,t,u,r,e);if(o.length===1&&t==="GET"){let n=v("message_stream",e.root).map(S);return String(r.includeArchivedStreams??"")!=="true"&&(n=n.filter(l=>l.ArchivedAt==null)),r.messageStreamType&&r.messageStreamType!=="All"&&(n=n.filter(l=>l.MessageStreamType===r.messageStreamType)),{status:200,body:{MessageStreams:n,TotalCount:n.length}}}if(o.length===1&&t==="POST"){let n=typeof u.ID=="string"?u.ID.trim():"";if(n===""||!/^[A-Za-z][A-Za-z0-9-]{0,29}$/.test(n))return m(c.streamIdInvalid,"The ID must be a non-empty string starting with a letter, up to 30 characters.");if(/^pm-/i.test(n))return m(c.streamIdReservedPrefix,"The ID must not start with the pm- prefix.");if($("message_stream",e.root).some(f=>f.id===n))return m(c.streamIdExists,"The ID provided already exists for this server.");let l=u.MessageStreamType;return l!=="Transactional"&&l!=="Broadcast"&&l!=="Inbound"?m(c.streamTypeInvalid,"The MessageStreamType associated with this request was invalid."):typeof u.Name!="string"||u.Name.trim()===""?m(c.streamNameRequired,"A valid Name must be provided."):{status:200,body:await h("message_stream",n,{ID:n,ServerID:I,Name:u.Name,Description:typeof u.Description=="string"?u.Description:"",MessageStreamType:l,CreatedAt:C(e.occurredAt),UpdatedAt:null,ArchivedAt:null,SubscriptionManagementConfiguration:w(u.SubscriptionManagementConfiguration).UnsubscribeHandlingType?w(u.SubscriptionManagementConfiguration):{UnsubscribeHandlingType:l==="Broadcast"?"Postmark":"None"}},"message_stream.create",e)}}let s=m(c.streamNotFound,"The message stream for the provided ID was not found.");if(o.length===2&&t==="GET"){let n=y("message_stream",d(1),e.root);return n?{status:200,body:S(n)}:s}if(o.length===2&&t==="PATCH"){if(!y("message_stream",d(1),e.root))return s;let l={};for(let g of["Name","Description","SubscriptionManagementConfiguration"])g in u&&(l[g]=u[g]);return Object.keys(l).length===0?m(c.streamNameRequired,"A valid Name must be provided."):(l.UpdatedAt=C(e.occurredAt),await h("message_stream",d(1),l,"message_stream.update",e),{status:200,body:S(y("message_stream",d(1),e.root))})}if(o.length===3&&o[2]==="archive"&&t==="POST"){let n=y("message_stream",d(1),e.root);if(!n)return s;if(Ze.has(d(1)))return m(c.streamCannotArchiveDefault,"You cannot archive the default transactional and inbound streams.");if(n.ArchivedAt!=null)return m(c.streamCannotArchive,"Stream is unable to be archived at this time.");let l=new Date(Date.parse(C(e.occurredAt))+1080*3600*1e3).toISOString();return await h("message_stream",d(1),{ArchivedAt:C(e.occurredAt),ExpectedPurgeDate:l},"message_stream.archive",e),{status:200,body:{ID:d(1),ServerID:I,ExpectedPurgeDate:l}}}if(o.length===3&&o[2]==="unarchive"&&t==="POST"){let n=y("message_stream",d(1),e.root);return n?n.ArchivedAt==null?m(c.streamCannotUnarchive,"This message stream is not archived."):(await h("message_stream",d(1),{ArchivedAt:null,ExpectedPurgeDate:null},"message_stream.unarchive",e),{status:200,body:S(y("message_stream",d(1),e.root))}):s}}if(p==="webhooks"){let s=m(c.webhookNotFound,"The webhook for the provided ID was not found.");if(o.length===1&&t==="GET"){let n=v("webhook",e.root).map(S);return r.MessageStream&&(n=n.filter(l=>l.MessageStream===r.MessageStream)),{status:200,body:{Webhooks:n}}}if(o.length===1&&t==="POST"){if(typeof u.Url!="string"||u.Url==="")return m(c.webhookUrlRequired,"The request must contain a valid Url field.");let n=typeof u.MessageStream=="string"&&u.MessageStream!==""?u.MessageStream:"outbound",l=y("message_stream",n,e.root);if(!l)return m(c.streamNotFound,"The message stream for the provided ID was not found.");if(l.ArchivedAt!=null)return m(c.webhookArchivedStream,"You cannot create a webhook using an archived MessageStream.");let g=N("webhook",e.root);return{status:200,body:await h("webhook",String(g),{ID:g,Url:u.Url,MessageStream:n,HttpAuth:w(u.HttpAuth).Username?w(u.HttpAuth):null,HttpHeaders:Array.isArray(u.HttpHeaders)?u.HttpHeaders:[],Triggers:le(u.Triggers)},"webhook.create",e)}}if(o.length===2&&t==="GET"){let n=y("webhook",d(1),e.root);return n?{status:200,body:S(n)}:s}if(o.length===2&&t==="PUT"){if(!y("webhook",d(1),e.root))return s;let l={};return typeof u.Url=="string"&&(l.Url=u.Url),"HttpAuth"in u&&(l.HttpAuth=w(u.HttpAuth).Username?w(u.HttpAuth):null),Array.isArray(u.HttpHeaders)&&(l.HttpHeaders=u.HttpHeaders),"Triggers"in u&&(l.Triggers=le(u.Triggers)),await h("webhook",d(1),l,"webhook.update",e),{status:200,body:S(y("webhook",d(1),e.root))}}if(o.length===2&&t==="DELETE")return y("webhook",d(1),e.root)?(await h("webhook",d(1),{deleted:!0},"webhook.delete",e),E("Webhook deleted.")):s}if(p==="server"&&o.length===1){let s=y("server",String(I),e.root);if(!s)return m(c.serverNotFound,"This server was not found.");if(t==="GET")return{status:200,body:S(s)};if(t==="PUT"){let n=Y(u);return Object.keys(n).length===0?m(c.serverNoData,"No server data received."):(await h("server",String(I),n,"server.update",e),{status:200,body:S(y("server",String(I),e.root))})}}if(p==="servers"){let s=m(c.serverNotFound,"This server was not found.");if(o.length===1&&t==="GET"){let n=v("server",e.root).map(S);return r.name&&(n=n.filter(l=>String(l.Name??"").includes(r.name))),{status:200,body:{TotalCount:n.length,Servers:M(n,r)}}}if(o.length===1&&t==="POST"){if(typeof u.Name!="string"||u.Name.trim()==="")return m(c.serverNameInvalid,"Server name is invalid or missing.");if(v("server",e.root).some(g=>g.Name===u.Name))return m(c.serverNameExists,"This server name already exists.");if(typeof u.InboundDomain=="string"&&u.InboundDomain!==""&&v("server",e.root).some(g=>g.InboundDomain===u.InboundDomain))return m(c.serverInboundDomainInUse,"The specified inbound domain is already registered or in use on another server.");let n=N("server",e.root);return{status:200,body:await h("server",String(n),fe(n,u.Name,u),"server.create",e)}}if(o.length===2&&t==="GET"){let n=y("server",d(1),e.root);return n?{status:200,body:S(n)}:s}if(o.length===2&&t==="PUT"){if(!y("server",d(1),e.root))return s;let n=Y(u);return Object.keys(n).length===0?m(c.serverNoData,"No server data received."):(await h("server",d(1),n,"server.update",e),{status:200,body:S(y("server",d(1),e.root))})}if(o.length===2&&t==="DELETE")return y("server",d(1),e.root)?(await h("server",d(1),{deleted:!0},"server.delete",e),E("Server deleted.")):s}if(p==="stats"&&o[1]==="outbound"&&t==="GET"){let s=e.root;if(o.length===2)return{status:200,body:tt(s)};let n=o.slice(2).join("/").toLowerCase(),l=O(s,"Opened"),g=O(s,"LinkClicked");if(n==="sends")return{status:200,body:D(s,{Sent:v("message",s).length},()=>({Sent:1}))};if(n==="bounces")return{status:200,body:D(s,{HardBounce:O(s,"Bounced")},f=>({HardBounce:A(f,"Bounced")}))};if(n==="spam")return{status:200,body:D(s,{SpamComplaint:O(s,"SpamComplaint")},f=>({SpamComplaint:A(f,"SpamComplaint")}))};if(n==="tracked")return{status:200,body:D(s,{Tracked:v("message",s).filter(f=>f.TrackOpens===!0).length},f=>({Tracked:f.TrackOpens===!0?1:0}))};if(n==="opens")return{status:200,body:D(s,{Opens:l,Unique:l},f=>({Opens:A(f,"Opened"),Unique:A(f,"Opened")}))};if(n==="opens/platforms")return{status:200,body:D(s,{WebMail:l,Desktop:0,Mobile:0,Unknown:0},f=>({WebMail:A(f,"Opened")}))};if(n==="opens/emailclients")return{status:200,body:D(s,{"Twin Mail":l},f=>({"Twin Mail":A(f,"Opened")}))};if(n==="opens/readtimes")return{status:200,body:D(s,{"7s+":l},f=>({"7s+":A(f,"Opened")}))};if(n==="clicks")return{status:200,body:D(s,{Clicks:g,Unique:g},f=>({Clicks:A(f,"LinkClicked"),Unique:A(f,"LinkClicked")}))};if(n==="clicks/browserfamilies")return{status:200,body:D(s,{"Twin Browser":g},f=>({"Twin Browser":A(f,"LinkClicked")}))};if(n==="clicks/platforms")return{status:200,body:D(s,{Desktop:g,Mobile:0,Unknown:0},f=>({Desktop:A(f,"LinkClicked")}))};if(n==="clicks/location")return{status:200,body:D(s,{HTML:g,Text:0},f=>({HTML:A(f,"LinkClicked"),Text:0}))}}if(p==="triggers"&&o[1]?.toLowerCase()==="inboundrules"){if(o.length===2&&t==="GET"){let s=v("inbound_rule",e.root).map(S);return{status:200,body:{TotalCount:s.length,InboundRules:M(s,r)}}}if(o.length===2&&t==="POST"){if(typeof u.Rule!="string"||u.Rule.trim()==="")return m(c.inboundRuleNoData,"No trigger data received.");if(v("inbound_rule",e.root).some(l=>l.Rule===u.Rule))return m(c.inboundRuleExists,"This inbound rule already exists.");let s=N("inbound_rule",e.root);return{status:200,body:await h("inbound_rule",String(s),{ID:s,Rule:u.Rule},"inbound_rule.create",e)}}if(o.length===3&&t==="DELETE")return y("inbound_rule",d(2),e.root)?(await h("inbound_rule",d(2),{deleted:!0},"inbound_rule.delete",e),E("Inbound rule removed.")):m(c.inboundRuleNotFound,"This inbound rule was not found.")}if(p==="domains"){let s=m(c.domainNotFound,"This domain was not found.");if(o.length===1&&t==="GET"){let n=v("domain",e.root).map(S).map(ot);return{status:200,body:{TotalCount:n.length,Domains:M(n,r)}}}if(o.length===1&&t==="POST"){if(typeof u.Name!="string"||u.Name==="")return m(c.domainNameRequired,"Name is a required field to create a Domain.");if(v("domain",e.root).some(g=>g.Name===u.Name))return m(c.domainExists,"Domain already exists.");let n=N("domain",e.root);return{status:200,body:await h("domain",String(n),Te(n,u.Name,typeof u.ReturnPathDomain=="string"?u.ReturnPathDomain:""),"domain.create",e)}}if(o.length===2&&t==="GET"){let n=y("domain",d(1),e.root);return n?{status:200,body:S(n)}:s}if(o.length===2&&t==="PUT")return y("domain",d(1),e.root)?typeof u.ReturnPathDomain!="string"?m(c.invalidEmailValue,"A valid ReturnPathDomain must be provided."):(await h("domain",d(1),{ReturnPathDomain:u.ReturnPathDomain,ReturnPathDomainVerified:!1},"domain.update",e),{status:200,body:S(y("domain",d(1),e.root))}):s;if(o.length===2&&t==="DELETE")return y("domain",d(1),e.root)?(await h("domain",d(1),{deleted:!0},"domain.delete",e),E("Domain deleted.")):s;if(o.length===3){let n=y("domain",d(1),e.root);if(!n)return s;let l=o[2].toLowerCase(),g=async()=>({status:200,body:S(y("domain",d(1),e.root))});if(l==="verifydkim"&&t==="PUT")return await h("domain",d(1),{DKIMVerified:!0,WeakDKIM:!1,DKIMUpdateStatus:"Verified",DKIMPendingHost:"",DKIMPendingTextValue:""},"domain.verify_dkim",e),g();if(l==="verifyreturnpath"&&t==="PUT")return n.ReturnPathDomain?(await h("domain",d(1),{ReturnPathDomainVerified:!0},"domain.verify_return_path",e),g()):m(c.invalidEmailValue,"Set a ReturnPathDomain before verifying it.");if(l==="verifyspf"&&t==="POST")return await h("domain",d(1),{SPFVerified:!0},"domain.verify_spf",e),g();if(l==="rotatedkim"&&t==="POST"){let f=`twin${String(n.ID)}rot`;return await h("domain",d(1),{DKIMPendingHost:`${f}._domainkey.${String(n.Name)}`,DKIMPendingTextValue:`k=rsa;p=TWIN${f.toUpperCase()}`,DKIMUpdateStatus:"Pending",DKIMVerified:!1},"domain.rotate_dkim",e),g()}}}if(p==="senders"){let s=m(c.signatureNotFound,"This signature was not found.");if(o.length===1&&t==="GET"){let n=v("sender_signature",e.root).map(S).map(l=>({Domain:l.Domain,EmailAddress:l.EmailAddress,ReplyToEmailAddress:l.ReplyToEmailAddress,Name:l.Name,Confirmed:l.Confirmed,ID:l.ID}));return{status:200,body:{TotalCount:n.length,SenderSignatures:M(n,r)}}}if(o.length===1&&t==="POST"){if(typeof u.FromEmail!="string"||u.FromEmail==="")return m(c.fromEmailRequired,"FromEmail is a required field to create a Sender Signature.");if(!_(u.FromEmail))return m(c.invalidEmailValue,"The value provided is not a valid email address.");let n=u.FromEmail.split("@")[1].toLowerCase();if(at.has(n))return m(c.publicDomainSignature,"You can't use public domain emails or public domains.");if(v("sender_signature",e.root).some(f=>f.EmailAddress===u.FromEmail))return m(c.signatureExists,"This signature already exists, or a similar signature already exists.");let l=N("sender_signature",e.root);return{status:200,body:await h("sender_signature",String(l),it(l,u.FromEmail,u),"sender_signature.create",e)}}if(o.length===2&&t==="GET"){let n=y("sender_signature",d(1),e.root);return n?{status:200,body:S(n)}:s}if(o.length===2&&t==="PUT"){if(!y("sender_signature",d(1),e.root))return s;let n={};return typeof u.Name=="string"&&(n.Name=u.Name),typeof u.ReplyToEmail=="string"&&(n.ReplyToEmailAddress=u.ReplyToEmail),typeof u.ReturnPathDomain=="string"&&(n.ReturnPathDomain=u.ReturnPathDomain),typeof u.ConfirmationPersonalNote=="string"&&(n.ConfirmationPersonalNote=u.ConfirmationPersonalNote),Object.keys(n).length===0?m(c.signatureNoData,"No update data or signature data received."):(await h("sender_signature",d(1),n,"sender_signature.update",e),{status:200,body:S(y("sender_signature",d(1),e.root))})}if(o.length===2&&t==="DELETE")return y("sender_signature",d(1),e.root)?(await h("sender_signature",d(1),{deleted:!0},"sender_signature.delete",e),E("Signature deleted.")):s;if(o.length===3&&t==="POST"){let n=y("sender_signature",d(1),e.root);if(!n)return s;let l=o[2].toLowerCase();if(l==="resend")return E("Confirmation email for the sender signature was re-sent.");if(l==="verifyspf")return await h("sender_signature",d(1),{SPFVerified:!0},"sender_signature.verify_spf",e),{status:200,body:S(y("sender_signature",d(1),e.root))};if(l==="requestnewdkim")return await h("sender_signature",d(1),{DKIMUpdateStatus:"Pending",DKIMPendingHost:`twinrot._domainkey.${String(n.Domain)}`},"sender_signature.request_dkim",e),E("New DKIM has been requested for this signature.")}}if(p==="data-removals"){if(o.length===1&&t==="POST"){let s=String(u.RequestedBy??""),n=String(u.RequestedFor??"");if(!_(s)||!_(n))return m(c.invalidEmailValue,"Provide a valid 'RequestedBy' and 'RequestedFor' email address.");let l=N("data_removal",e.root);return await h("data_removal",String(l),{ID:l,Status:"Pending",RequestedBy:s,RequestedFor:n,NotifyWhenCompleted:u.NotifyWhenCompleted===!0},"data_removal.create",e),{status:200,body:{ID:l,Status:"Pending"}}}if(o.length===2&&t==="GET"){let s=y("data_removal",d(1),e.root);return s?{status:200,body:{ID:s.ID,Status:s.Status}}:m(c.dataRemovalIdInvalid,"Missing or incorrect data removal request ID.")}}return B(`Cannot ${t} ${a}`,404,c.invalidRequestField)}async function oe(e,t){let i=W(e,!0);if(i)return i;if(e.TemplateId===void 0&&e.TemplateAlias===void 0)return m(c.templateNotFound,"The request specifies neither TemplateId nor TemplateAlias.");let a=ye(e.TemplateId!==void 0?e.TemplateId:e.TemplateAlias,t.root);if(!a)return m(c.templateNotFound,"The template associated with this request was not found.");let r=w(e.TemplateModel);return G({...e,Subject:j(a.Subject,r),HtmlBody:a.HtmlBody==null?void 0:j(a.HtmlBody,r),TextBody:a.TextBody==null?void 0:j(a.TextBody,r)},t)}function ie(e){return{MessageID:e.MessageID,Tag:e.Tag,To:e.To,Cc:e.Cc,Bcc:e.Bcc,Recipients:e.Recipients,ReceivedAt:e.ReceivedAt,From:e.From,Subject:e.Subject,Attachments:e.Attachments,Status:e.Status,TrackOpens:e.TrackOpens,TrackLinks:e.TrackLinks,Metadata:e.Metadata,MessageStream:e.MessageStream,Sandboxed:e.Sandboxed}}function rt(e){let{TextBody:t,HtmlBody:i,StrippedTextReply:a,Headers:r,BlockedReason:o,...p}=e;return p}function ue(e){let t=e.Recipients?.join(", ")??"",i=e.HtmlBody??e.TextBody??"";return`From: ${e.From}\r
|
|
8
|
+
To: ${t}\r
|
|
9
|
+
Subject: ${e.Subject}\r
|
|
10
|
+
X-PM-Message-Id: ${e.MessageID}\r
|
|
11
|
+
\r
|
|
12
|
+
${i}`}function le(e){let t=w(e),i=a=>({Enabled:w(t[a]).Enabled===!0});return{Open:{...i("Open"),PostFirstOpenOnly:w(t.Open).PostFirstOpenOnly===!0},Click:i("Click"),Delivery:i("Delivery"),Bounce:{...i("Bounce"),IncludeContent:w(t.Bounce).IncludeContent===!0},SpamComplaint:{...i("SpamComplaint"),IncludeContent:w(t.SpamComplaint).IncludeContent===!0},SubscriptionChange:i("SubscriptionChange")}}var st=["Name","Color","SmtpApiActivated","RawEmailEnabled","InboundHookUrl","BounceHookUrl","OpenHookUrl","DeliveryHookUrl","ClickHookUrl","PostFirstOpenOnly","InboundSpamThreshold","TrackOpens","TrackLinks","IncludeBounceContentInHook","EnableSmtpApiErrorHooks","InboundDomain","DeliveryType"];function Y(e){let t={};for(let i of st)i in e&&(t[i]=e[i]);return t}var at=new Set(["gmail.com","yahoo.com","hotmail.com","outlook.com","aol.com","icloud.com","live.com","msn.com"]);function Te(e,t,i){return{ID:e,Name:t,SPFVerified:!1,DKIMVerified:!1,WeakDKIM:!1,ReturnPathDomainVerified:!1,SPFHost:t,SPFTextValue:"v=spf1 a mx include:spf.mtasv.net ~all",DKIMHost:`20260101._domainkey.${t}`,DKIMTextValue:"k=rsa;p=TWINDKIMPUBLICKEY",DKIMPendingHost:"",DKIMPendingTextValue:"",DKIMRevokedHost:"",DKIMRevokedTextValue:"",SafeToRemoveRevokedKeyFromDNS:!1,DKIMUpdateStatus:"Verified",ReturnPathDomain:i,ReturnPathDomainCNAMEValue:"pm.mtasv.net"}}function ot(e){return{ID:e.ID,Name:e.Name,SPFVerified:e.SPFVerified,DKIMVerified:e.DKIMVerified,WeakDKIM:e.WeakDKIM,ReturnPathDomainVerified:e.ReturnPathDomainVerified}}function it(e,t,i){let a=t.split("@")[1]??"";return{...Te(e,a,typeof i.ReturnPathDomain=="string"?i.ReturnPathDomain:""),ID:e,Domain:a,EmailAddress:t,ReplyToEmailAddress:typeof i.ReplyToEmail=="string"?i.ReplyToEmail:"",Name:typeof i.Name=="string"?i.Name:t,Confirmed:!1,ConfirmationPersonalNote:typeof i.ConfirmationPersonalNote=="string"?i.ConfirmationPersonalNote:""}}async function ut(e,t,i,a,r){let o=decodeURIComponent(e[1]??"");if(!y("message_stream",o,r.root))return m(c.streamNotFound,"The message stream for the provided ID was not found.");if(e.length===4&&e[3]==="dump"&&t==="GET"){let d=v("suppression",r.root).filter(T=>T.MessageStream===o).map(S).map(T=>({EmailAddress:T.EmailAddress,SuppressionReason:T.SuppressionReason,Origin:T.Origin,CreatedAt:T.CreatedAt}));return a.suppressionReason&&(d=d.filter(T=>T.SuppressionReason===a.suppressionReason)),a.origin&&(d=d.filter(T=>T.Origin===a.origin)),a.emailAddress&&(d=d.filter(T=>String(T.EmailAddress).includes(a.emailAddress))),{status:200,body:{Suppressions:d}}}let p=Array.isArray(i.Suppressions)?i.Suppressions.map(w):[];if(e.length===3&&t==="POST"){if(p.length===0)return m(c.suppressionNoBody,"A proper request body must be provided.");let d=[];for(let T of p){let b=String(T.EmailAddress??"");if(!_(b)){d.push({EmailAddress:b,Status:"Failed",Message:"An invalid email address was provided."});continue}await ge(o,b,"ManualSuppression","Customer",r),d.push({EmailAddress:b,Status:"Suppressed",Message:null})}return{status:200,body:{Suppressions:d}}}if(e.length===4&&e[3]==="delete"&&t==="POST"){if(p.length===0)return m(c.suppressionNoBody,"A proper request body must be provided.");let d=[];for(let T of p){let b=String(T.EmailAddress??""),k=K(o,b),u=y("suppression",k,r.root);if(u&&u.SuppressionReason!=="ManualSuppression"){d.push({EmailAddress:b,Status:"Failed",Message:"You do not have the required authority to change this suppression."});continue}u&&await h("suppression",k,{deleted:!0},"suppression.delete",r),d.push({EmailAddress:b,Status:"Deleted",Message:null})}return{status:200,body:{Suppressions:d}}}return B(`Cannot ${t} /${e.join("/")}`,404,c.invalidRequestField)}import{serveHttp as At}from"../../engine/v2/volter_world-core.mjs";import{createTwinFetchFromHandler as lt,statefulTwinManifest as dt}from"../../engine/v2/volter_world-core.mjs";function X(e){return lt(Z,{...e,manifest:dt({vendor:"postmark",twinOf:"the Postmark transactional-email API",stores:"servers, sent messages and their opens/deliveries (the mirror shows the inbox)"}),responseHeaders:{connection:"close"}})}import{observeResources as ct}from"../../engine/v2/volter_world-core.mjs";var Se="postmark";function R(e){return Array.isArray(e)?e:[]}function be(e){return{type:"message",id:String(e.MessageID),fields:{MessageID:String(e.MessageID),Tag:e.Tag??"",To:R(e.To),Cc:R(e.Cc),Bcc:R(e.Bcc),Recipients:R(e.Recipients),ReceivedAt:e.ReceivedAt??null,From:e.From??null,Subject:e.Subject??"",Attachments:R(e.Attachments),Status:e.Status??"Sent",TrackOpens:e.TrackOpens===!0,TrackLinks:e.TrackLinks??"None",Metadata:e.Metadata??{},MessageStream:e.MessageStream??"outbound",Sandboxed:e.Sandboxed===!0,HtmlBody:null,TextBody:null,MessageEvents:[]}}}function ke(e){return{type:"bounce",id:String(e.ID),fields:{RecordType:"Bounce",ID:e.ID,Type:e.Type??"HardBounce",TypeCode:e.TypeCode??1,Name:e.Name??"Hard bounce",Tag:e.Tag??"",MessageID:e.MessageID??null,ServerID:e.ServerID??1,Description:e.Description??"",Details:e.Details??"",Email:e.Email??null,From:e.From??null,BouncedAt:e.BouncedAt??null,DumpAvailable:e.DumpAvailable===!0,Inactive:e.Inactive===!0,CanActivate:e.CanActivate===!0,Subject:e.Subject??"",MessageStream:e.MessageStream??"outbound"}}}function ve(e){return{type:"template",id:String(e.TemplateId),fields:{TemplateId:e.TemplateId,Name:e.Name??null,Alias:e.Alias??null,TemplateType:e.TemplateType??"Standard",Active:e.Active!==!1,LayoutTemplate:e.LayoutTemplate??null,Subject:e.Subject??"",HtmlBody:e.HtmlBody??null,TextBody:e.TextBody??null,AssociatedServerId:1}}}function we(e){return{type:"message_stream",id:String(e.ID),fields:{ID:String(e.ID),ServerID:e.ServerID??1,Name:e.Name??String(e.ID),Description:e.Description??"",MessageStreamType:e.MessageStreamType??"Transactional",CreatedAt:e.CreatedAt??null,UpdatedAt:e.UpdatedAt??null,ArchivedAt:e.ArchivedAt??null,SubscriptionManagementConfiguration:e.SubscriptionManagementConfiguration??{UnsubscribeHandlingType:"None"}}}}function Ae(e){return{type:"webhook",id:String(e.ID),fields:{ID:e.ID,Url:e.Url??null,MessageStream:e.MessageStream??"outbound",HttpAuth:e.HttpAuth??null,HttpHeaders:R(e.HttpHeaders),Triggers:e.Triggers??{}}}}function De(e){return{type:"server",id:String(e.ID),fields:{ID:e.ID,Name:e.Name??null,Color:e.Color??"blue",DeliveryType:e.DeliveryType??"Live",TrackOpens:e.TrackOpens===!0,TrackLinks:e.TrackLinks??"None",InboundAddress:e.InboundAddress??"",ServerLink:e.ServerLink??"",SmtpApiActivated:e.SmtpApiActivated!==!1}}}async function Ie(e){return R((await e.getOutboundMessages({count:500,offset:0})).Messages).map(be)}async function Re(e){return R((await e.getBounces({count:500,offset:0})).Bounces).map(ke)}async function Me(e){return R((await e.getTemplates({count:500,offset:0})).Templates).map(ve)}async function Ee(e){return R((await e.getMessageStreams()).MessageStreams).map(we)}async function Ce(e){return R((await e.getWebhooks()).Webhooks).map(Ae)}async function Ne(e){return[De(await e.getServer())]}async function Pe(e,t){let i=[...await Ee(e),...await Ne(e),...await Me(e),...await Ie(e),...await Re(e),...await Ce(e)],a=ct(Se,i.map(r=>({type:r.type,id:r.id,fields:r.fields})),{...t.root!==void 0?{root:t.root}:{},at:t.occurredAt,batch:`obs:${Se}:${t.occurredAt}`});return{observed:a.observed,deltasAppended:a.appended}}var mt=new Set(["message.send","template.create","webhook.create","message_stream.create"]);function pt(e){if(!mt.has(e))throw new Error(`postmark push: unsupported operation '${e}' \u2014 refusing to silently drop a local write`)}function F(e){return Array.isArray(e)?e.map(t=>String(t?.Email??t)).filter(Boolean).join(", "):typeof e=="string"?e:""}async function Oe(e,t){let i=t.operation??`${t.subject.type}.update`;pt(i);let a=t.fields??{},r=t.subject.id;if(i==="message.send"){let o=await e.sendEmail({From:String(a.From??""),To:F(a.To)||F(a.Recipients),...F(a.Cc)?{Cc:F(a.Cc)}:{},...F(a.Bcc)?{Bcc:F(a.Bcc)}:{},Subject:String(a.Subject??""),...a.HtmlBody!=null?{HtmlBody:String(a.HtmlBody)}:{},...a.TextBody!=null?{TextBody:String(a.TextBody)}:{},...a.Tag?{Tag:String(a.Tag)}:{},...a.MessageStream?{MessageStream:String(a.MessageStream)}:{},...a.TrackOpens===!0?{TrackOpens:!0}:{},...a.TrackLinks&&a.TrackLinks!=="None"?{TrackLinks:String(a.TrackLinks)}:{}});r=String(o.MessageID)}else i==="template.create"?r=String((await e.createTemplate({Name:String(a.Name??""),...a.Alias!=null?{Alias:String(a.Alias)}:{},Subject:String(a.Subject??""),...a.HtmlBody!=null?{HtmlBody:String(a.HtmlBody)}:{},...a.TextBody!=null?{TextBody:String(a.TextBody)}:{},TemplateType:String(a.TemplateType??"Standard")})).TemplateId):i==="webhook.create"?r=String((await e.createWebhook({Url:String(a.Url??""),MessageStream:String(a.MessageStream??"outbound"),...a.HttpAuth?{HttpAuth:a.HttpAuth}:{},...Array.isArray(a.HttpHeaders)&&a.HttpHeaders.length?{HttpHeaders:a.HttpHeaders}:{},Triggers:a.Triggers??{}})).ID):i==="message_stream.create"&&(r=String((await e.createMessageStream({ID:String(a.ID??t.subject.id),Name:String(a.Name??""),MessageStreamType:String(a.MessageStreamType??"Transactional"),...a.Description?{Description:String(a.Description)}:{}})).ID));return{externalId:r||t.subject.id}}function Be(e){let t=async a=>{let r=await e({method:"GET",path:a,headers:{accept:"application/json",authorization:"Bearer twin","x-postmark-server-token":"twin"}});if(r.status<200||r.status>=300)throw new Error(`postmark GET ${a} refused: HTTP ${r.status} ${r.body.slice(0,200)}`);return JSON.parse(r.body||"{}")},i=async(a,r)=>{let o=await e({method:"POST",path:a,headers:{accept:"application/json","content-type":"application/json","x-postmark-server-token":"twin"},body:JSON.stringify(r)});if(o.status<200||o.status>=300)throw new Error(`postmark POST ${a} refused: HTTP ${o.status} ${o.body.slice(0,200)}`);return JSON.parse(o.body||"{}")};return{getServer:()=>t("/server"),getMessageStreams:()=>t("/message-streams"),getOutboundMessages:()=>t("/messages/outbound"),getBounces:()=>t("/bounces"),getTemplates:()=>t("/templates"),getWebhooks:()=>t("/webhooks"),sendEmail:a=>i("/email",a),createTemplate:a=>i("/templates",a),createWebhook:a=>i("/webhooks",a),createMessageStream:a=>i("/message-streams",a)}}async function xe(e,t={}){return Pe(Be(e),{...t.root!==void 0?{root:t.root}:{},occurredAt:t.occurredAt??new Date().toISOString()})}async function He(e,t,i){let a=t.operation??`${t.subject.type}.update`;try{return await Oe(Be(e),{operation:a,subject:t.subject,fields:t.fields??{}})}catch(r){let o=r instanceof Error?r.message:String(r);if(/unsupported operation|not pushable|no push/i.test(o))return{externalId:t.subject.id,data:{performed:!1,reason:`${a} is the twin's own record \u2014 nothing at Postmark to write`}};throw r}}import{bundleClient as Nt,fileResponse as Pt,filePathOf as Ot}from"../../engine/v2/volter_world-core.mjs";import{serveHttp as xt}from"../../engine/v2/volter_world-core.mjs";import{registerPack as ft}from"../../engine/v2/volter_world-core.mjs";var gt={protocol:"2",refresh:{every:"5m",webhook:!0,onDemand:{atMost:"30s"}},stateSystem:{perform:He,refresh:xe},roundTrip:{method:"POST",path:"/email",body:{From:"round@trip.test",To:"round@trip.test",Subject:"round trip",TextBody:"round trip"},headers:{"x-postmark-server-token":"round-trip"}},parityOrigin:"http://twin",vendor:"postmark",transport:"rest",archetype:"crud",bin:"world-postmark",resources:["message","bounce","template","message_stream","webhook","suppression","server","domain","sender_signature","inbound_rule"],specSource:"postmark-conformance.ts (inline per-object JSON Schemas derived from the official `postmark` SDK models + developer.postmarkapp.com)",description:"Postmark transactional email API twin \u2014 send/template/batch sends, outbound message activity, bounces + delivery stats, templates, message streams, suppressions, webhooks, domains and sender signatures, with an activity mirror UI.",adoption:{pypi:["postmarker"],sdks:["postmark"],envStems:["POSTMARK"]},hosts:[{host:"api.postmarkapp.com"}]};ft(gt);export{X as createTwinFetch};
|