availsync 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.adal/skills/stripe-best-practices/SKILL.md +42 -0
- package/.adal/skills/stripe-best-practices/references/billing.md +36 -0
- package/.adal/skills/stripe-best-practices/references/connect.md +48 -0
- package/.adal/skills/stripe-best-practices/references/payments.md +79 -0
- package/.adal/skills/stripe-best-practices/references/security.md +109 -0
- package/.adal/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.adal/skills/stripe-projects/SKILL.md +139 -0
- package/.adal/skills/upgrade-stripe/SKILL.md +185 -0
- package/.agents/skills/stripe-best-practices/SKILL.md +42 -0
- package/.agents/skills/stripe-best-practices/references/billing.md +36 -0
- package/.agents/skills/stripe-best-practices/references/connect.md +48 -0
- package/.agents/skills/stripe-best-practices/references/payments.md +79 -0
- package/.agents/skills/stripe-best-practices/references/security.md +109 -0
- package/.agents/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.agents/skills/stripe-projects/SKILL.md +139 -0
- package/.agents/skills/upgrade-stripe/SKILL.md +185 -0
- package/.augment/skills/stripe-best-practices/SKILL.md +42 -0
- package/.augment/skills/stripe-best-practices/references/billing.md +36 -0
- package/.augment/skills/stripe-best-practices/references/connect.md +48 -0
- package/.augment/skills/stripe-best-practices/references/payments.md +79 -0
- package/.augment/skills/stripe-best-practices/references/security.md +109 -0
- package/.augment/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.augment/skills/stripe-projects/SKILL.md +139 -0
- package/.augment/skills/upgrade-stripe/SKILL.md +185 -0
- package/.bob/skills/stripe-best-practices/SKILL.md +42 -0
- package/.bob/skills/stripe-best-practices/references/billing.md +36 -0
- package/.bob/skills/stripe-best-practices/references/connect.md +48 -0
- package/.bob/skills/stripe-best-practices/references/payments.md +79 -0
- package/.bob/skills/stripe-best-practices/references/security.md +109 -0
- package/.bob/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.bob/skills/stripe-projects/SKILL.md +139 -0
- package/.bob/skills/upgrade-stripe/SKILL.md +185 -0
- package/.claude/settings.local.json +7 -0
- package/.claude/skills/stripe-best-practices/SKILL.md +42 -0
- package/.claude/skills/stripe-best-practices/references/billing.md +36 -0
- package/.claude/skills/stripe-best-practices/references/connect.md +48 -0
- package/.claude/skills/stripe-best-practices/references/payments.md +79 -0
- package/.claude/skills/stripe-best-practices/references/security.md +109 -0
- package/.claude/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.claude/skills/stripe-projects/SKILL.md +139 -0
- package/.claude/skills/upgrade-stripe/SKILL.md +185 -0
- package/.codebuddy/skills/stripe-best-practices/SKILL.md +42 -0
- package/.codebuddy/skills/stripe-best-practices/references/billing.md +36 -0
- package/.codebuddy/skills/stripe-best-practices/references/connect.md +48 -0
- package/.codebuddy/skills/stripe-best-practices/references/payments.md +79 -0
- package/.codebuddy/skills/stripe-best-practices/references/security.md +109 -0
- package/.codebuddy/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.codebuddy/skills/stripe-projects/SKILL.md +139 -0
- package/.codebuddy/skills/upgrade-stripe/SKILL.md +185 -0
- package/.commandcode/skills/stripe-best-practices/SKILL.md +42 -0
- package/.commandcode/skills/stripe-best-practices/references/billing.md +36 -0
- package/.commandcode/skills/stripe-best-practices/references/connect.md +48 -0
- package/.commandcode/skills/stripe-best-practices/references/payments.md +79 -0
- package/.commandcode/skills/stripe-best-practices/references/security.md +109 -0
- package/.commandcode/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.commandcode/skills/stripe-projects/SKILL.md +139 -0
- package/.commandcode/skills/upgrade-stripe/SKILL.md +185 -0
- package/.continue/skills/stripe-best-practices/SKILL.md +42 -0
- package/.continue/skills/stripe-best-practices/references/billing.md +36 -0
- package/.continue/skills/stripe-best-practices/references/connect.md +48 -0
- package/.continue/skills/stripe-best-practices/references/payments.md +79 -0
- package/.continue/skills/stripe-best-practices/references/security.md +109 -0
- package/.continue/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.continue/skills/stripe-projects/SKILL.md +139 -0
- package/.continue/skills/upgrade-stripe/SKILL.md +185 -0
- package/.cortex/skills/stripe-best-practices/SKILL.md +42 -0
- package/.cortex/skills/stripe-best-practices/references/billing.md +36 -0
- package/.cortex/skills/stripe-best-practices/references/connect.md +48 -0
- package/.cortex/skills/stripe-best-practices/references/payments.md +79 -0
- package/.cortex/skills/stripe-best-practices/references/security.md +109 -0
- package/.cortex/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.cortex/skills/stripe-projects/SKILL.md +139 -0
- package/.cortex/skills/upgrade-stripe/SKILL.md +185 -0
- package/.crush/skills/stripe-best-practices/SKILL.md +42 -0
- package/.crush/skills/stripe-best-practices/references/billing.md +36 -0
- package/.crush/skills/stripe-best-practices/references/connect.md +48 -0
- package/.crush/skills/stripe-best-practices/references/payments.md +79 -0
- package/.crush/skills/stripe-best-practices/references/security.md +109 -0
- package/.crush/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.crush/skills/stripe-projects/SKILL.md +139 -0
- package/.crush/skills/upgrade-stripe/SKILL.md +185 -0
- package/.env.example +20 -0
- package/.factory/skills/stripe-best-practices/SKILL.md +42 -0
- package/.factory/skills/stripe-best-practices/references/billing.md +36 -0
- package/.factory/skills/stripe-best-practices/references/connect.md +48 -0
- package/.factory/skills/stripe-best-practices/references/payments.md +79 -0
- package/.factory/skills/stripe-best-practices/references/security.md +109 -0
- package/.factory/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.factory/skills/stripe-projects/SKILL.md +139 -0
- package/.factory/skills/upgrade-stripe/SKILL.md +185 -0
- package/.goose/skills/stripe-best-practices/SKILL.md +42 -0
- package/.goose/skills/stripe-best-practices/references/billing.md +36 -0
- package/.goose/skills/stripe-best-practices/references/connect.md +48 -0
- package/.goose/skills/stripe-best-practices/references/payments.md +79 -0
- package/.goose/skills/stripe-best-practices/references/security.md +109 -0
- package/.goose/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.goose/skills/stripe-projects/SKILL.md +139 -0
- package/.goose/skills/upgrade-stripe/SKILL.md +185 -0
- package/.iflow/skills/stripe-best-practices/SKILL.md +42 -0
- package/.iflow/skills/stripe-best-practices/references/billing.md +36 -0
- package/.iflow/skills/stripe-best-practices/references/connect.md +48 -0
- package/.iflow/skills/stripe-best-practices/references/payments.md +79 -0
- package/.iflow/skills/stripe-best-practices/references/security.md +109 -0
- package/.iflow/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.iflow/skills/stripe-projects/SKILL.md +139 -0
- package/.iflow/skills/upgrade-stripe/SKILL.md +185 -0
- package/.junie/skills/stripe-best-practices/SKILL.md +42 -0
- package/.junie/skills/stripe-best-practices/references/billing.md +36 -0
- package/.junie/skills/stripe-best-practices/references/connect.md +48 -0
- package/.junie/skills/stripe-best-practices/references/payments.md +79 -0
- package/.junie/skills/stripe-best-practices/references/security.md +109 -0
- package/.junie/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.junie/skills/stripe-projects/SKILL.md +139 -0
- package/.junie/skills/upgrade-stripe/SKILL.md +185 -0
- package/.kilocode/skills/stripe-best-practices/SKILL.md +42 -0
- package/.kilocode/skills/stripe-best-practices/references/billing.md +36 -0
- package/.kilocode/skills/stripe-best-practices/references/connect.md +48 -0
- package/.kilocode/skills/stripe-best-practices/references/payments.md +79 -0
- package/.kilocode/skills/stripe-best-practices/references/security.md +109 -0
- package/.kilocode/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.kilocode/skills/stripe-projects/SKILL.md +139 -0
- package/.kilocode/skills/upgrade-stripe/SKILL.md +185 -0
- package/.kiro/skills/stripe-best-practices/SKILL.md +42 -0
- package/.kiro/skills/stripe-best-practices/references/billing.md +36 -0
- package/.kiro/skills/stripe-best-practices/references/connect.md +48 -0
- package/.kiro/skills/stripe-best-practices/references/payments.md +79 -0
- package/.kiro/skills/stripe-best-practices/references/security.md +109 -0
- package/.kiro/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.kiro/skills/stripe-projects/SKILL.md +139 -0
- package/.kiro/skills/upgrade-stripe/SKILL.md +185 -0
- package/.kode/skills/stripe-best-practices/SKILL.md +42 -0
- package/.kode/skills/stripe-best-practices/references/billing.md +36 -0
- package/.kode/skills/stripe-best-practices/references/connect.md +48 -0
- package/.kode/skills/stripe-best-practices/references/payments.md +79 -0
- package/.kode/skills/stripe-best-practices/references/security.md +109 -0
- package/.kode/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.kode/skills/stripe-projects/SKILL.md +139 -0
- package/.kode/skills/upgrade-stripe/SKILL.md +185 -0
- package/.mcpjam/skills/stripe-best-practices/SKILL.md +42 -0
- package/.mcpjam/skills/stripe-best-practices/references/billing.md +36 -0
- package/.mcpjam/skills/stripe-best-practices/references/connect.md +48 -0
- package/.mcpjam/skills/stripe-best-practices/references/payments.md +79 -0
- package/.mcpjam/skills/stripe-best-practices/references/security.md +109 -0
- package/.mcpjam/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.mcpjam/skills/stripe-projects/SKILL.md +139 -0
- package/.mcpjam/skills/upgrade-stripe/SKILL.md +185 -0
- package/.mux/skills/stripe-best-practices/SKILL.md +42 -0
- package/.mux/skills/stripe-best-practices/references/billing.md +36 -0
- package/.mux/skills/stripe-best-practices/references/connect.md +48 -0
- package/.mux/skills/stripe-best-practices/references/payments.md +79 -0
- package/.mux/skills/stripe-best-practices/references/security.md +109 -0
- package/.mux/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.mux/skills/stripe-projects/SKILL.md +139 -0
- package/.mux/skills/upgrade-stripe/SKILL.md +185 -0
- package/.neovate/skills/stripe-best-practices/SKILL.md +42 -0
- package/.neovate/skills/stripe-best-practices/references/billing.md +36 -0
- package/.neovate/skills/stripe-best-practices/references/connect.md +48 -0
- package/.neovate/skills/stripe-best-practices/references/payments.md +79 -0
- package/.neovate/skills/stripe-best-practices/references/security.md +109 -0
- package/.neovate/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.neovate/skills/stripe-projects/SKILL.md +139 -0
- package/.neovate/skills/upgrade-stripe/SKILL.md +185 -0
- package/.nixpacksignore +14 -0
- package/.openhands/skills/stripe-best-practices/SKILL.md +42 -0
- package/.openhands/skills/stripe-best-practices/references/billing.md +36 -0
- package/.openhands/skills/stripe-best-practices/references/connect.md +48 -0
- package/.openhands/skills/stripe-best-practices/references/payments.md +79 -0
- package/.openhands/skills/stripe-best-practices/references/security.md +109 -0
- package/.openhands/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.openhands/skills/stripe-projects/SKILL.md +139 -0
- package/.openhands/skills/upgrade-stripe/SKILL.md +185 -0
- package/.pi/skills/stripe-best-practices/SKILL.md +42 -0
- package/.pi/skills/stripe-best-practices/references/billing.md +36 -0
- package/.pi/skills/stripe-best-practices/references/connect.md +48 -0
- package/.pi/skills/stripe-best-practices/references/payments.md +79 -0
- package/.pi/skills/stripe-best-practices/references/security.md +109 -0
- package/.pi/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.pi/skills/stripe-projects/SKILL.md +139 -0
- package/.pi/skills/upgrade-stripe/SKILL.md +185 -0
- package/.pochi/skills/stripe-best-practices/SKILL.md +42 -0
- package/.pochi/skills/stripe-best-practices/references/billing.md +36 -0
- package/.pochi/skills/stripe-best-practices/references/connect.md +48 -0
- package/.pochi/skills/stripe-best-practices/references/payments.md +79 -0
- package/.pochi/skills/stripe-best-practices/references/security.md +109 -0
- package/.pochi/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.pochi/skills/stripe-projects/SKILL.md +139 -0
- package/.pochi/skills/upgrade-stripe/SKILL.md +185 -0
- package/.qoder/skills/stripe-best-practices/SKILL.md +42 -0
- package/.qoder/skills/stripe-best-practices/references/billing.md +36 -0
- package/.qoder/skills/stripe-best-practices/references/connect.md +48 -0
- package/.qoder/skills/stripe-best-practices/references/payments.md +79 -0
- package/.qoder/skills/stripe-best-practices/references/security.md +109 -0
- package/.qoder/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.qoder/skills/stripe-projects/SKILL.md +139 -0
- package/.qoder/skills/upgrade-stripe/SKILL.md +185 -0
- package/.qwen/skills/stripe-best-practices/SKILL.md +42 -0
- package/.qwen/skills/stripe-best-practices/references/billing.md +36 -0
- package/.qwen/skills/stripe-best-practices/references/connect.md +48 -0
- package/.qwen/skills/stripe-best-practices/references/payments.md +79 -0
- package/.qwen/skills/stripe-best-practices/references/security.md +109 -0
- package/.qwen/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.qwen/skills/stripe-projects/SKILL.md +139 -0
- package/.qwen/skills/upgrade-stripe/SKILL.md +185 -0
- package/.roo/skills/stripe-best-practices/SKILL.md +42 -0
- package/.roo/skills/stripe-best-practices/references/billing.md +36 -0
- package/.roo/skills/stripe-best-practices/references/connect.md +48 -0
- package/.roo/skills/stripe-best-practices/references/payments.md +79 -0
- package/.roo/skills/stripe-best-practices/references/security.md +109 -0
- package/.roo/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.roo/skills/stripe-projects/SKILL.md +139 -0
- package/.roo/skills/upgrade-stripe/SKILL.md +185 -0
- package/.trae/skills/stripe-best-practices/SKILL.md +42 -0
- package/.trae/skills/stripe-best-practices/references/billing.md +36 -0
- package/.trae/skills/stripe-best-practices/references/connect.md +48 -0
- package/.trae/skills/stripe-best-practices/references/payments.md +79 -0
- package/.trae/skills/stripe-best-practices/references/security.md +109 -0
- package/.trae/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.trae/skills/stripe-projects/SKILL.md +139 -0
- package/.trae/skills/upgrade-stripe/SKILL.md +185 -0
- package/.vibe/skills/stripe-best-practices/SKILL.md +42 -0
- package/.vibe/skills/stripe-best-practices/references/billing.md +36 -0
- package/.vibe/skills/stripe-best-practices/references/connect.md +48 -0
- package/.vibe/skills/stripe-best-practices/references/payments.md +79 -0
- package/.vibe/skills/stripe-best-practices/references/security.md +109 -0
- package/.vibe/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.vibe/skills/stripe-projects/SKILL.md +139 -0
- package/.vibe/skills/upgrade-stripe/SKILL.md +185 -0
- package/.windsurf/skills/stripe-best-practices/SKILL.md +42 -0
- package/.windsurf/skills/stripe-best-practices/references/billing.md +36 -0
- package/.windsurf/skills/stripe-best-practices/references/connect.md +48 -0
- package/.windsurf/skills/stripe-best-practices/references/payments.md +79 -0
- package/.windsurf/skills/stripe-best-practices/references/security.md +109 -0
- package/.windsurf/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.windsurf/skills/stripe-projects/SKILL.md +139 -0
- package/.windsurf/skills/upgrade-stripe/SKILL.md +185 -0
- package/.zencoder/skills/stripe-best-practices/SKILL.md +42 -0
- package/.zencoder/skills/stripe-best-practices/references/billing.md +36 -0
- package/.zencoder/skills/stripe-best-practices/references/connect.md +48 -0
- package/.zencoder/skills/stripe-best-practices/references/payments.md +79 -0
- package/.zencoder/skills/stripe-best-practices/references/security.md +109 -0
- package/.zencoder/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.zencoder/skills/stripe-projects/SKILL.md +139 -0
- package/.zencoder/skills/upgrade-stripe/SKILL.md +185 -0
- package/AUDIT.md +95 -0
- package/BLOCKERS.md +0 -0
- package/COOLIFY.md +51 -0
- package/MCP_SETUP.md +23 -0
- package/PRODUCTION_CHECKLIST.md +246 -0
- package/README.md +47 -0
- package/ROADMAP.md +91 -0
- package/docs/superpowers/plans/2026-05-11-availsync-frontend-sales-flow.md +2445 -0
- package/frontend/.env.example +2 -0
- package/frontend/app/admin/layout.tsx +13 -0
- package/frontend/app/admin/page.tsx +747 -0
- package/frontend/app/app/activity/page.tsx +257 -0
- package/frontend/app/app/agents/[agentId]/page.tsx +21 -0
- package/frontend/app/app/agents/page.tsx +1155 -0
- package/frontend/app/app/audit/page.tsx +225 -0
- package/frontend/app/app/availability/page.tsx +840 -0
- package/frontend/app/app/holds/page.tsx +262 -0
- package/frontend/app/app/layout.tsx +19 -0
- package/frontend/app/app/onboarding/page.tsx +10 -0
- package/frontend/app/app/onboarding/verify/page.tsx +309 -0
- package/frontend/app/app/page.tsx +508 -0
- package/frontend/app/app/settings/page.tsx +399 -0
- package/frontend/app/app/work/page.tsx +426 -0
- package/frontend/app/changelog/page.tsx +93 -0
- package/frontend/app/checkout/page.tsx +25 -0
- package/frontend/app/docs/api/page.tsx +157 -0
- package/frontend/app/docs/page.tsx +296 -0
- package/frontend/app/docs/pilot/page.tsx +127 -0
- package/frontend/app/docs/quickstart/page.tsx +318 -0
- package/frontend/app/docs/reliability/page.tsx +78 -0
- package/frontend/app/docs/sdk/node/page.tsx +166 -0
- package/frontend/app/globals.css +57 -0
- package/frontend/app/icon.png +0 -0
- package/frontend/app/layout.tsx +87 -0
- package/frontend/app/login/page.tsx +14 -0
- package/frontend/app/page.tsx +47 -0
- package/frontend/app/pricing/page.tsx +66 -0
- package/frontend/app/privacy/page.tsx +52 -0
- package/frontend/app/robots.ts +26 -0
- package/frontend/app/security/page.tsx +74 -0
- package/frontend/app/signup/page.tsx +14 -0
- package/frontend/app/sitemap.ts +14 -0
- package/frontend/app/terms/page.tsx +51 -0
- package/frontend/components/brand/AvailsyncLogo.tsx +56 -0
- package/frontend/components/checkout/CheckoutClient.tsx +100 -0
- package/frontend/components/dashboard/AgentForm.tsx +59 -0
- package/frontend/components/dashboard/AppShell.tsx +291 -0
- package/frontend/components/dashboard/AvailabilityChecker.tsx +117 -0
- package/frontend/components/dashboard/AvailabilityWindowForm.tsx +40 -0
- package/frontend/components/dashboard/HoldForm.tsx +133 -0
- package/frontend/components/dashboard/MetricCard.tsx +10 -0
- package/frontend/components/login/LoginForm.tsx +95 -0
- package/frontend/components/marketing/AgentCoordinationStory.tsx +1530 -0
- package/frontend/components/marketing/Faq.tsx +41 -0
- package/frontend/components/marketing/Hero.tsx +73 -0
- package/frontend/components/marketing/HowItWorks.tsx +28 -0
- package/frontend/components/marketing/ObserveModeTeaser.tsx +41 -0
- package/frontend/components/marketing/PricingTeaser.tsx +23 -0
- package/frontend/components/marketing/ProblemSolution.tsx +36 -0
- package/frontend/components/marketing/SiteFooter.tsx +59 -0
- package/frontend/components/marketing/SiteHeader.tsx +45 -0
- package/frontend/components/marketing/UseCases.tsx +27 -0
- package/frontend/components/onboarding/OnboardingClient.tsx +278 -0
- package/frontend/components/pricing/PricingCards.tsx +65 -0
- package/frontend/components/privacy/CookieConsent.tsx +230 -0
- package/frontend/components/privacy/CookieSettingsButton.tsx +15 -0
- package/frontend/components/seo/JsonLd.tsx +10 -0
- package/frontend/components/signup/SignupForm.tsx +55 -0
- package/frontend/components/ui/Badge.tsx +23 -0
- package/frontend/components/ui/Button.tsx +37 -0
- package/frontend/components/ui/Card.tsx +11 -0
- package/frontend/components/ui/ConfirmDialog.tsx +77 -0
- package/frontend/components/ui/EmptyState.tsx +24 -0
- package/frontend/components/ui/Input.tsx +14 -0
- package/frontend/components/ui/KeyDisplay.tsx +49 -0
- package/frontend/components/ui/Select.tsx +14 -0
- package/frontend/components/ui/Skeleton.tsx +24 -0
- package/frontend/components/ui/Tabs.tsx +19 -0
- package/frontend/components/ui/Textarea.tsx +14 -0
- package/frontend/components/ui/Toast.tsx +78 -0
- package/frontend/components/waitlist/WaitlistDialog.tsx +128 -0
- package/frontend/lib/api.ts +1282 -0
- package/frontend/lib/billing.ts +6 -0
- package/frontend/lib/cookieConsent.ts +113 -0
- package/frontend/lib/format.ts +16 -0
- package/frontend/lib/plans.ts +62 -0
- package/frontend/lib/schemas.ts +108 -0
- package/frontend/lib/seo.ts +376 -0
- package/frontend/lib/setupGuides.ts +630 -0
- package/frontend/lib/storage.ts +30 -0
- package/frontend/next-env.d.ts +6 -0
- package/frontend/next.config.mjs +13 -0
- package/frontend/package-lock.json +14409 -0
- package/frontend/package.json +41 -0
- package/frontend/playwright.config.ts +20 -0
- package/frontend/postcss.config.mjs +8 -0
- package/frontend/public/.gitkeep +0 -0
- package/frontend/public/brand/availsync-logo-board.png +0 -0
- package/frontend/public/brand/availsync-logo-dark.png +0 -0
- package/frontend/public/brand/availsync-mark-dark.png +0 -0
- package/frontend/public/brand/availsync-wordmark-dark.png +0 -0
- package/frontend/public/marketing/hero-agent-coordination.png +0 -0
- package/frontend/tailwind.config.ts +53 -0
- package/frontend/tests/smoke.spec.ts +89 -0
- package/frontend/tsconfig.json +23 -0
- package/jest.config.js +7 -0
- package/nixpacks.toml +11 -0
- package/package.json +53 -0
- package/packages/mcp/LICENSE +21 -0
- package/packages/mcp/README.md +60 -0
- package/packages/mcp/jest.config.cjs +8 -0
- package/packages/mcp/package.json +54 -0
- package/packages/mcp/src/helpers.ts +38 -0
- package/packages/mcp/src/index.test.ts +60 -0
- package/packages/mcp/src/index.ts +387 -0
- package/packages/mcp/tsconfig.json +20 -0
- package/packages/mcp/tsconfig.test.json +12 -0
- package/packages/node/LICENSE +21 -0
- package/packages/node/README.md +120 -0
- package/packages/node/jest.config.cjs +8 -0
- package/packages/node/package.json +46 -0
- package/packages/node/src/index.test.ts +360 -0
- package/packages/node/src/index.ts +402 -0
- package/packages/node/tsconfig.json +20 -0
- package/packages/node/tsconfig.test.json +12 -0
- package/plan.md +923 -0
- package/skills/stripe-best-practices/SKILL.md +42 -0
- package/skills/stripe-best-practices/references/billing.md +36 -0
- package/skills/stripe-best-practices/references/connect.md +48 -0
- package/skills/stripe-best-practices/references/payments.md +79 -0
- package/skills/stripe-best-practices/references/security.md +109 -0
- package/skills/stripe-best-practices/references/treasury.md +16 -0
- package/skills/stripe-projects/SKILL.md +139 -0
- package/skills/upgrade-stripe/SKILL.md +185 -0
- package/skills-lock.json +20 -0
- package/src/core/availability.ts +178 -0
- package/src/core/conflict.ts +209 -0
- package/src/core/work.ts +490 -0
- package/src/db/client.ts +17 -0
- package/src/db/migrations/001_init.sql +88 -0
- package/src/db/migrations/002_stripe.sql +2 -0
- package/src/db/migrations/003_workspace_auth.sql +19 -0
- package/src/db/migrations/004_agent_mcp_status.sql +2 -0
- package/src/db/migrations/005_hold_event_actor.sql +4 -0
- package/src/db/migrations/006_agent_activity.sql +35 -0
- package/src/db/migrations/007_work_coordination.sql +60 -0
- package/src/db/migrations/008_work_claim_leases.sql +20 -0
- package/src/db/migrations/009_billing_subscription_state.sql +23 -0
- package/src/db/migrations/010_agent_api_key_prefix.sql +10 -0
- package/src/db/migrations/011_org_verified_and_work_event_retention.sql +11 -0
- package/src/db/migrations/012_agent_enforcement_mode.sql +12 -0
- package/src/db/migrations/013_support_tickets.sql +21 -0
- package/src/db/migrations/014_paid_plan_waitlist.sql +23 -0
- package/src/db/migrations/015_agent_last_seen.sql +2 -0
- package/src/db/migrations.ts +164 -0
- package/src/db/run-migrations.ts +13 -0
- package/src/index.ts +183 -0
- package/src/lib/activity.ts +137 -0
- package/src/lib/apiKeys.ts +32 -0
- package/src/lib/appInfo.ts +26 -0
- package/src/lib/billingConfig.ts +3 -0
- package/src/lib/env.ts +75 -0
- package/src/lib/logger.ts +8 -0
- package/src/lib/plans.ts +204 -0
- package/src/mcp/server.js +5 -0
- package/src/mcp/server.ts +350 -0
- package/src/middleware/auth.ts +342 -0
- package/src/middleware/requestId.ts +16 -0
- package/src/routes/account.ts +168 -0
- package/src/routes/activity.ts +126 -0
- package/src/routes/admin.ts +514 -0
- package/src/routes/audit.ts +68 -0
- package/src/routes/auth.ts +203 -0
- package/src/routes/availability.ts +325 -0
- package/src/routes/billing.ts +406 -0
- package/src/routes/conflicts.ts +131 -0
- package/src/routes/holds.ts +437 -0
- package/src/routes/mcp.ts +57 -0
- package/src/routes/metrics.ts +39 -0
- package/src/routes/onboarding.ts +273 -0
- package/src/routes/orgs.ts +981 -0
- package/src/routes/preferences.ts +132 -0
- package/src/routes/session.ts +16 -0
- package/src/routes/support.ts +77 -0
- package/src/routes/value.ts +186 -0
- package/src/routes/waitlist.ts +63 -0
- package/src/routes/work.ts +1578 -0
- package/src/server.ts +36 -0
- package/src/types/index.ts +109 -0
- package/tests/integration/activity.route.test.ts +103 -0
- package/tests/integration/admin.route.test.ts +143 -0
- package/tests/integration/agent-keys.route.test.ts +237 -0
- package/tests/integration/availability.route.test.ts +125 -0
- package/tests/integration/billing.route.test.ts +393 -0
- package/tests/integration/conflicts.route.test.ts +131 -0
- package/tests/integration/flows.test.ts +154 -0
- package/tests/integration/helpers.ts +134 -0
- package/tests/integration/holds.route.test.ts +185 -0
- package/tests/integration/metrics.route.test.ts +100 -0
- package/tests/integration/onboarding.verify.route.test.ts +163 -0
- package/tests/integration/preferences.route.test.ts +53 -0
- package/tests/integration/session.route.test.ts +97 -0
- package/tests/integration/system.route.test.ts +92 -0
- package/tests/integration/value.route.test.ts +235 -0
- package/tests/integration/work.route.test.ts +745 -0
- package/tests/setup.ts +4 -0
- package/tests/smoke.sh +62 -0
- package/tests/unit/auth.test.ts +114 -0
- package/tests/unit/availability.test.ts +149 -0
- package/tests/unit/conflict.test.ts +118 -0
- package/tests/unit/env.test.ts +69 -0
- package/tests/unit/migrations.test.ts +135 -0
- package/tests/unit/request-id.test.ts +37 -0
- package/tmp-mobile-agents.png +0 -0
- package/tmp-next-mobile.err.log +10 -0
- package/tmp-next-mobile.log +5 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
export type ResourceType = 'repo' | 'project';
|
|
2
|
+
|
|
3
|
+
export type FetchLike = (
|
|
4
|
+
input: string | URL | Request,
|
|
5
|
+
init?: RequestInit,
|
|
6
|
+
) => Promise<Response>;
|
|
7
|
+
|
|
8
|
+
export type AvailsyncClientOptions = {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
agentId: string;
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
fetch?: FetchLike;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type WorkStartOptions = {
|
|
17
|
+
resource: string;
|
|
18
|
+
durationMinutes?: number;
|
|
19
|
+
reason?: string;
|
|
20
|
+
idempotencyKey?: string;
|
|
21
|
+
metadata?: Record<string, unknown>;
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type WorkExtendOptions = {
|
|
26
|
+
durationMinutes?: number;
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type WorkFinishOptions = {
|
|
31
|
+
outcome?: string;
|
|
32
|
+
reason?: string;
|
|
33
|
+
metadata?: Record<string, unknown>;
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type ParsedResource = {
|
|
38
|
+
resourceType: ResourceType;
|
|
39
|
+
resourceKey: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type WorkClaim = {
|
|
43
|
+
id: string;
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type ShadowDecision = {
|
|
48
|
+
action: 'skip_run';
|
|
49
|
+
reason?: string;
|
|
50
|
+
retry_after?: string | null;
|
|
51
|
+
blocking_claim?: Record<string, unknown> | null;
|
|
52
|
+
rule_applied?: string | null;
|
|
53
|
+
winning_claim_id?: string | null;
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type WorkRunStartProceed = {
|
|
58
|
+
action: 'proceed';
|
|
59
|
+
claim: WorkClaim | null;
|
|
60
|
+
resource?: Record<string, unknown>;
|
|
61
|
+
reason?: string;
|
|
62
|
+
retry_after?: null;
|
|
63
|
+
blocking_claim?: null;
|
|
64
|
+
shadow_mode?: boolean;
|
|
65
|
+
would_have_blocked?: boolean;
|
|
66
|
+
shadow_decision?: ShadowDecision | null;
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type WorkRunStartSkip = {
|
|
71
|
+
action: 'skip_run';
|
|
72
|
+
claim?: null;
|
|
73
|
+
resource?: Record<string, unknown>;
|
|
74
|
+
reason: string;
|
|
75
|
+
retry_after?: string | null;
|
|
76
|
+
blocking_claim?: Record<string, unknown> | null;
|
|
77
|
+
[key: string]: unknown;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export type WorkRunStartResult = WorkRunStartProceed | WorkRunStartSkip;
|
|
81
|
+
|
|
82
|
+
export type WorkRunExtendResult = {
|
|
83
|
+
action: 'extended';
|
|
84
|
+
claim: WorkClaim;
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export type WorkRunFinishResult = {
|
|
89
|
+
action: 'finished' | 'already_finished';
|
|
90
|
+
claim: WorkClaim;
|
|
91
|
+
[key: string]: unknown;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type WithClaimSkipResult = {
|
|
95
|
+
action: 'skip_run';
|
|
96
|
+
reason: string;
|
|
97
|
+
retryAfter: string | null;
|
|
98
|
+
blockingClaim: Record<string, unknown> | null;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type WithClaimProceedResult<T> = {
|
|
102
|
+
action: 'proceed';
|
|
103
|
+
claim: GuardedWorkClaim | null;
|
|
104
|
+
result: T;
|
|
105
|
+
shadowMode: boolean;
|
|
106
|
+
wouldHaveBlocked: boolean;
|
|
107
|
+
shadowDecision: ShadowDecision | null;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type GuardedWorkClaim = WorkClaim & {
|
|
111
|
+
extend(options?: WorkExtendOptions): Promise<WorkRunExtendResult>;
|
|
112
|
+
finish(options?: WorkFinishOptions): Promise<WorkRunFinishResult>;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export type WithClaimContext = {
|
|
116
|
+
claim: GuardedWorkClaim | null;
|
|
117
|
+
shadow: {
|
|
118
|
+
mode: boolean;
|
|
119
|
+
wouldHaveBlocked: boolean;
|
|
120
|
+
decision: ShadowDecision | null;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export class AvailsyncError extends Error {
|
|
125
|
+
readonly code: string;
|
|
126
|
+
readonly status: number | null;
|
|
127
|
+
readonly details?: unknown;
|
|
128
|
+
|
|
129
|
+
constructor(input: {
|
|
130
|
+
code: string;
|
|
131
|
+
message: string;
|
|
132
|
+
status?: number | null;
|
|
133
|
+
details?: unknown;
|
|
134
|
+
}) {
|
|
135
|
+
super(input.message);
|
|
136
|
+
this.name = 'AvailsyncError';
|
|
137
|
+
this.code = input.code;
|
|
138
|
+
this.status = input.status ?? null;
|
|
139
|
+
this.details = input.details;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function parseResource(resource: string): ParsedResource {
|
|
144
|
+
const separator = resource.indexOf(':');
|
|
145
|
+
if (separator <= 0 || separator === resource.length - 1) {
|
|
146
|
+
throw new AvailsyncError({
|
|
147
|
+
code: 'invalid_resource',
|
|
148
|
+
message: 'Resource must use "repo:owner/name" or "project:key" format.',
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const resourceType = resource.slice(0, separator);
|
|
153
|
+
const resourceKey = resource.slice(separator + 1);
|
|
154
|
+
if ((resourceType !== 'repo' && resourceType !== 'project') || resourceKey.trim() !== resourceKey || !resourceKey) {
|
|
155
|
+
throw new AvailsyncError({
|
|
156
|
+
code: 'invalid_resource',
|
|
157
|
+
message: 'Resource must use "repo:owner/name" or "project:key" format.',
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return { resourceType, resourceKey };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function createAvailsyncClient(options: AvailsyncClientOptions) {
|
|
165
|
+
if (!options.apiKey) {
|
|
166
|
+
throw new AvailsyncError({ code: 'missing_api_key', message: 'apiKey is required.' });
|
|
167
|
+
}
|
|
168
|
+
if (!options.agentId) {
|
|
169
|
+
throw new AvailsyncError({ code: 'missing_agent_id', message: 'agentId is required.' });
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const baseUrl = (options.baseUrl ?? 'https://availsync.dev').replace(/\/+$/, '');
|
|
173
|
+
const timeoutMs = options.timeoutMs ?? 30_000;
|
|
174
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
175
|
+
if (!fetchImpl) {
|
|
176
|
+
throw new AvailsyncError({
|
|
177
|
+
code: 'fetch_unavailable',
|
|
178
|
+
message: 'Global fetch is unavailable. Use Node 18+ or pass a fetch implementation.',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function request<T>(path: string, init: RequestInit, signal?: AbortSignal): Promise<T> {
|
|
183
|
+
const abort = createRequestAbort(timeoutMs, signal);
|
|
184
|
+
let response: Response;
|
|
185
|
+
try {
|
|
186
|
+
response = await fetchImpl(`${baseUrl}${path}`, { ...init, signal: abort.signal });
|
|
187
|
+
} catch (error) {
|
|
188
|
+
if (abort.timedOut()) {
|
|
189
|
+
throw new AvailsyncError({
|
|
190
|
+
code: 'timeout',
|
|
191
|
+
message: 'Timed out calling Availsync.',
|
|
192
|
+
details: { timeout_ms: timeoutMs },
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (signal?.aborted) {
|
|
196
|
+
throw new AvailsyncError({
|
|
197
|
+
code: 'aborted',
|
|
198
|
+
message: 'Availsync request was aborted.',
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
throw new AvailsyncError({
|
|
202
|
+
code: 'network_error',
|
|
203
|
+
message: 'Network error calling Availsync.',
|
|
204
|
+
details: error instanceof Error ? { message: error.message } : undefined,
|
|
205
|
+
});
|
|
206
|
+
} finally {
|
|
207
|
+
abort.cleanup();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const body = await parseJson(response);
|
|
211
|
+
if (!response.ok) {
|
|
212
|
+
const errorBody = asRecord(body);
|
|
213
|
+
throw new AvailsyncError({
|
|
214
|
+
code: stringFrom(errorBody.error) ?? `http_${response.status}`,
|
|
215
|
+
message: stringFrom(errorBody.message) ?? 'Availsync API request failed.',
|
|
216
|
+
status: response.status,
|
|
217
|
+
details: body,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return body as T;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function headers(idempotencyKey?: string): Record<string, string> {
|
|
224
|
+
return {
|
|
225
|
+
Authorization: `Bearer ${options.apiKey}`,
|
|
226
|
+
'Content-Type': 'application/json',
|
|
227
|
+
...(idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : {}),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async function start(input: WorkStartOptions): Promise<WorkRunStartResult> {
|
|
232
|
+
const resource = parseResource(input.resource);
|
|
233
|
+
return request<WorkRunStartResult>('/v1/work/run/start', {
|
|
234
|
+
method: 'POST',
|
|
235
|
+
headers: headers(input.idempotencyKey),
|
|
236
|
+
body: JSON.stringify({
|
|
237
|
+
agent_id: options.agentId,
|
|
238
|
+
resource_type: resource.resourceType,
|
|
239
|
+
resource_key: resource.resourceKey,
|
|
240
|
+
duration_minutes: input.durationMinutes,
|
|
241
|
+
reason: input.reason,
|
|
242
|
+
metadata: input.metadata,
|
|
243
|
+
client_name: '@availsync/node',
|
|
244
|
+
}),
|
|
245
|
+
}, input.signal);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async function extend(claimId: string, input: WorkExtendOptions = {}): Promise<WorkRunExtendResult> {
|
|
249
|
+
return request<WorkRunExtendResult>('/v1/work/run/extend', {
|
|
250
|
+
method: 'POST',
|
|
251
|
+
headers: headers(),
|
|
252
|
+
body: JSON.stringify({
|
|
253
|
+
claim_id: claimId,
|
|
254
|
+
duration_minutes: input.durationMinutes,
|
|
255
|
+
client_name: '@availsync/node',
|
|
256
|
+
}),
|
|
257
|
+
}, input.signal);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async function finish(claimId: string, input: WorkFinishOptions = {}): Promise<WorkRunFinishResult> {
|
|
261
|
+
return request<WorkRunFinishResult>('/v1/work/run/finish', {
|
|
262
|
+
method: 'POST',
|
|
263
|
+
headers: headers(),
|
|
264
|
+
body: JSON.stringify({
|
|
265
|
+
claim_id: claimId,
|
|
266
|
+
outcome: input.outcome,
|
|
267
|
+
reason: input.reason,
|
|
268
|
+
metadata: input.metadata,
|
|
269
|
+
client_name: '@availsync/node',
|
|
270
|
+
}),
|
|
271
|
+
}, input.signal);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function guardedClaim(claim: WorkClaim): GuardedWorkClaim {
|
|
275
|
+
return {
|
|
276
|
+
...claim,
|
|
277
|
+
extend: (input?: WorkExtendOptions) => extend(claim.id, input),
|
|
278
|
+
finish: (input?: WorkFinishOptions) => finish(claim.id, input),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
async function withClaim<T>(
|
|
283
|
+
resource: string,
|
|
284
|
+
input: Omit<WorkStartOptions, 'resource'>,
|
|
285
|
+
fn: (context: WithClaimContext) => Promise<T> | T,
|
|
286
|
+
): Promise<WithClaimSkipResult | WithClaimProceedResult<T>> {
|
|
287
|
+
const startResult = await start({ ...input, resource });
|
|
288
|
+
if (startResult.action === 'skip_run') {
|
|
289
|
+
return {
|
|
290
|
+
action: 'skip_run',
|
|
291
|
+
reason: startResult.reason,
|
|
292
|
+
retryAfter: startResult.retry_after ?? null,
|
|
293
|
+
blockingClaim: startResult.blocking_claim ?? null,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const shadowMode = Boolean(startResult.shadow_mode);
|
|
298
|
+
const wouldHaveBlocked = Boolean(startResult.would_have_blocked);
|
|
299
|
+
const shadowDecision = startResult.shadow_decision ?? null;
|
|
300
|
+
if (!startResult.claim) {
|
|
301
|
+
const result = await fn({
|
|
302
|
+
claim: null,
|
|
303
|
+
shadow: { mode: shadowMode, wouldHaveBlocked, decision: shadowDecision },
|
|
304
|
+
});
|
|
305
|
+
return {
|
|
306
|
+
action: 'proceed',
|
|
307
|
+
claim: null,
|
|
308
|
+
result,
|
|
309
|
+
shadowMode,
|
|
310
|
+
wouldHaveBlocked,
|
|
311
|
+
shadowDecision,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const claim = guardedClaim(startResult.claim);
|
|
316
|
+
let result: T;
|
|
317
|
+
try {
|
|
318
|
+
result = await fn({
|
|
319
|
+
claim,
|
|
320
|
+
shadow: { mode: shadowMode, wouldHaveBlocked, decision: shadowDecision },
|
|
321
|
+
});
|
|
322
|
+
} catch (error) {
|
|
323
|
+
try {
|
|
324
|
+
await finish(claim.id, { outcome: 'error' });
|
|
325
|
+
} catch {
|
|
326
|
+
// Preserve the original agent error; finish failures are visible in Availsync Activity.
|
|
327
|
+
}
|
|
328
|
+
throw error;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
await finish(claim.id, { outcome: 'finished' });
|
|
332
|
+
return { action: 'proceed', claim, result, shadowMode, wouldHaveBlocked, shadowDecision };
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return {
|
|
336
|
+
work: {
|
|
337
|
+
start,
|
|
338
|
+
extend,
|
|
339
|
+
finish,
|
|
340
|
+
withClaim,
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function createRequestAbort(timeoutMs: number, external?: AbortSignal): {
|
|
346
|
+
signal: AbortSignal;
|
|
347
|
+
cleanup(): void;
|
|
348
|
+
timedOut(): boolean;
|
|
349
|
+
} {
|
|
350
|
+
const controller = new AbortController();
|
|
351
|
+
let didTimeout = false;
|
|
352
|
+
let timeout: ReturnType<typeof setTimeout> | undefined;
|
|
353
|
+
|
|
354
|
+
if (timeoutMs > 0) {
|
|
355
|
+
timeout = setTimeout(() => {
|
|
356
|
+
didTimeout = true;
|
|
357
|
+
controller.abort();
|
|
358
|
+
}, timeoutMs);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const abortFromExternal = () => controller.abort();
|
|
362
|
+
if (external) {
|
|
363
|
+
if (external.aborted) {
|
|
364
|
+
controller.abort();
|
|
365
|
+
} else {
|
|
366
|
+
external.addEventListener('abort', abortFromExternal, { once: true });
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return {
|
|
371
|
+
signal: controller.signal,
|
|
372
|
+
cleanup() {
|
|
373
|
+
if (timeout) clearTimeout(timeout);
|
|
374
|
+
external?.removeEventListener('abort', abortFromExternal);
|
|
375
|
+
},
|
|
376
|
+
timedOut() {
|
|
377
|
+
return didTimeout;
|
|
378
|
+
},
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
async function parseJson(response: Response): Promise<unknown> {
|
|
383
|
+
const text = await response.text();
|
|
384
|
+
if (!text) return {};
|
|
385
|
+
try {
|
|
386
|
+
return JSON.parse(text);
|
|
387
|
+
} catch {
|
|
388
|
+
throw new AvailsyncError({
|
|
389
|
+
code: 'invalid_json',
|
|
390
|
+
message: 'Availsync API returned invalid JSON.',
|
|
391
|
+
status: response.status,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function asRecord(value: unknown): Record<string, unknown> {
|
|
397
|
+
return value && typeof value === 'object' ? (value as Record<string, unknown>) : {};
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function stringFrom(value: unknown): string | null {
|
|
401
|
+
return typeof value === 'string' ? value : null;
|
|
402
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"declarationMap": true,
|
|
11
|
+
"outDir": "./dist",
|
|
12
|
+
"rootDir": "./src",
|
|
13
|
+
"strict": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"skipLibCheck": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*.ts"],
|
|
19
|
+
"exclude": ["src/**/*.test.ts", "dist"]
|
|
20
|
+
}
|