whale-code 6.5.5 → 6.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -31
- package/bin/{swagmanager-mcp.js → whale-code.js} +17 -2
- package/dist/cli/app.js +148 -72
- package/dist/cli/app.js.map +1 -0
- package/dist/cli/chat/AgentSelector.js +105 -10
- package/dist/cli/chat/AgentSelector.js.map +1 -0
- package/dist/cli/chat/ChatApp.d.ts +31 -0
- package/dist/cli/chat/ChatApp.js +539 -286
- package/dist/cli/chat/ChatApp.js.map +1 -0
- package/dist/cli/chat/ChatInput.js +1088 -770
- package/dist/cli/chat/ChatInput.js.map +1 -0
- package/dist/cli/chat/MarkdownText.js +39 -14
- package/dist/cli/chat/MarkdownText.js.map +1 -0
- package/dist/cli/chat/MemoryManager.js +181 -46
- package/dist/cli/chat/MemoryManager.js.map +1 -0
- package/dist/cli/chat/MessageList.d.ts +2 -3
- package/dist/cli/chat/MessageList.js +186 -45
- package/dist/cli/chat/MessageList.js.map +1 -0
- package/dist/cli/chat/ModelSelector.js +282 -63
- package/dist/cli/chat/ModelSelector.js.map +1 -0
- package/dist/cli/chat/NodeManager.js +165 -75
- package/dist/cli/chat/NodeManager.js.map +1 -0
- package/dist/cli/chat/NodeSelector.js +171 -30
- package/dist/cli/chat/NodeSelector.js.map +1 -0
- package/dist/cli/chat/PlanApproval.js +281 -57
- package/dist/cli/chat/PlanApproval.js.map +1 -0
- package/dist/cli/chat/RewindViewer.js +559 -144
- package/dist/cli/chat/RewindViewer.js.map +1 -0
- package/dist/cli/chat/SessionManager.js +137 -30
- package/dist/cli/chat/SessionManager.js.map +1 -0
- package/dist/cli/chat/SlashMenu.js +293 -164
- package/dist/cli/chat/SlashMenu.js.map +1 -0
- package/dist/cli/chat/StatusBar.js +172 -9
- package/dist/cli/chat/StatusBar.js.map +1 -0
- package/dist/cli/chat/StoreSelector.js +147 -18
- package/dist/cli/chat/StoreSelector.js.map +1 -0
- package/dist/cli/chat/StreamingText.d.ts +1 -5
- package/dist/cli/chat/StreamingText.js +22 -7
- package/dist/cli/chat/StreamingText.js.map +1 -0
- package/dist/cli/chat/SubagentPanel.d.ts +1 -2
- package/dist/cli/chat/SubagentPanel.js +612 -72
- package/dist/cli/chat/SubagentPanel.js.map +1 -0
- package/dist/cli/chat/TeamPanel.d.ts +1 -0
- package/dist/cli/chat/TeamPanel.js +230 -30
- package/dist/cli/chat/TeamPanel.js.map +1 -0
- package/dist/cli/chat/ThemeSelector.js +84 -24
- package/dist/cli/chat/ThemeSelector.js.map +1 -0
- package/dist/cli/chat/ToolIndicator.js +1476 -371
- package/dist/cli/chat/ToolIndicator.js.map +1 -0
- package/dist/cli/chat/hooks/useAgentLoop.d.ts +1 -0
- package/dist/cli/chat/hooks/useAgentLoop.js +481 -367
- package/dist/cli/chat/hooks/useAgentLoop.js.map +1 -0
- package/dist/cli/chat/hooks/useSlashCommands.d.ts +3 -14
- package/dist/cli/chat/hooks/useSlashCommands.js +744 -572
- package/dist/cli/chat/hooks/useSlashCommands.js.map +1 -0
- package/dist/cli/commands/config-cmd.js +56 -57
- package/dist/cli/commands/config-cmd.js.map +1 -0
- package/dist/cli/commands/db.js +184 -169
- package/dist/cli/commands/db.js.map +1 -0
- package/dist/cli/commands/doctor.js +212 -122
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init.js +211 -244
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/mcp.js +127 -122
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/login/LoginApp.js +355 -141
- package/dist/cli/login/LoginApp.js.map +1 -0
- package/dist/cli/print-mode.js +196 -177
- package/dist/cli/print-mode.js.map +1 -0
- package/dist/cli/serve-mode.js +615 -530
- package/dist/cli/serve-mode.js.map +1 -0
- package/dist/cli/services/agent-config.d.ts +5 -1
- package/dist/cli/services/agent-config.js +66 -36
- package/dist/cli/services/agent-config.js.map +1 -0
- package/dist/cli/services/agent-definitions.d.ts +4 -1
- package/dist/cli/services/agent-definitions.js +97 -56
- package/dist/cli/services/agent-definitions.js.map +1 -0
- package/dist/cli/services/agent-events.js +225 -162
- package/dist/cli/services/agent-events.js.map +1 -0
- package/dist/cli/services/agent-loop.js +976 -688
- package/dist/cli/services/agent-loop.js.map +1 -0
- package/dist/cli/services/agent-worker-base.d.ts +35 -5
- package/dist/cli/services/agent-worker-base.js +337 -153
- package/dist/cli/services/agent-worker-base.js.map +1 -0
- package/dist/cli/services/api-retry.js +69 -64
- package/dist/cli/services/api-retry.js.map +1 -0
- package/dist/cli/services/auth-service.d.ts +3 -3
- package/dist/cli/services/auth-service.js +209 -132
- package/dist/cli/services/auth-service.js.map +1 -0
- package/dist/cli/services/background-processes.js +343 -267
- package/dist/cli/services/background-processes.js.map +1 -0
- package/dist/cli/services/browser-auth.d.ts +2 -2
- package/dist/cli/services/browser-auth.js +159 -118
- package/dist/cli/services/browser-auth.js.map +1 -0
- package/dist/cli/services/claude-md-loader.js +40 -36
- package/dist/cli/services/claude-md-loader.js.map +1 -0
- package/dist/cli/services/config-store.d.ts +9 -4
- package/dist/cli/services/config-store.js +164 -117
- package/dist/cli/services/config-store.js.map +1 -0
- package/dist/cli/services/debug-log.d.ts +1 -1
- package/dist/cli/services/debug-log.js +34 -35
- package/dist/cli/services/debug-log.js.map +1 -0
- package/dist/cli/services/env-detect.d.ts +7 -0
- package/dist/cli/services/env-detect.js +9 -0
- package/dist/cli/services/env-detect.js.map +1 -0
- package/dist/cli/services/error-logger.js +187 -169
- package/dist/cli/services/error-logger.js.map +1 -0
- package/dist/cli/services/file-history.d.ts +1 -1
- package/dist/cli/services/file-history.js +50 -54
- package/dist/cli/services/file-history.js.map +1 -0
- package/dist/cli/services/format-server-response.js +332 -372
- package/dist/cli/services/format-server-response.js.map +1 -0
- package/dist/cli/services/git-context.js +61 -45
- package/dist/cli/services/git-context.js.map +1 -0
- package/dist/cli/services/hooks.d.ts +2 -2
- package/dist/cli/services/hooks.js +195 -180
- package/dist/cli/services/hooks.js.map +1 -0
- package/dist/cli/services/ink-incremental.d.ts +19 -0
- package/dist/cli/services/ink-incremental.js +59 -0
- package/dist/cli/services/ink-incremental.js.map +1 -0
- package/dist/cli/services/ink-resize-fix.js +54 -44
- package/dist/cli/services/ink-resize-fix.js.map +1 -0
- package/dist/cli/services/ink-sync-output.d.ts +12 -0
- package/dist/cli/services/ink-sync-output.js +16 -0
- package/dist/cli/services/ink-sync-output.js.map +1 -0
- package/dist/cli/services/interactive-tools.js +268 -212
- package/dist/cli/services/interactive-tools.js.map +1 -0
- package/dist/cli/services/keybinding-manager.d.ts +11 -1
- package/dist/cli/services/keybinding-manager.js +126 -63
- package/dist/cli/services/keybinding-manager.js.map +1 -0
- package/dist/cli/services/local-tools.d.ts +1 -1
- package/dist/cli/services/local-tools.js +939 -656
- package/dist/cli/services/local-tools.js.map +1 -0
- package/dist/cli/services/lsp-manager.js +757 -594
- package/dist/cli/services/lsp-manager.js.map +1 -0
- package/dist/cli/services/mcp-client.d.ts +1 -1
- package/dist/cli/services/mcp-client.js +173 -134
- package/dist/cli/services/mcp-client.js.map +1 -0
- package/dist/cli/services/memory-manager.js +53 -40
- package/dist/cli/services/memory-manager.js.map +1 -0
- package/dist/cli/services/model-manager.js +55 -40
- package/dist/cli/services/model-manager.js.map +1 -0
- package/dist/cli/services/model-router.js +115 -85
- package/dist/cli/services/model-router.js.map +1 -0
- package/dist/cli/services/paths.d.ts +30 -0
- package/dist/cli/services/paths.js +81 -0
- package/dist/cli/services/paths.js.map +1 -0
- package/dist/cli/services/permission-modes.js +32 -25
- package/dist/cli/services/permission-modes.js.map +1 -0
- package/dist/cli/services/rewind.js +182 -168
- package/dist/cli/services/rewind.js.map +1 -0
- package/dist/cli/services/ripgrep.js +115 -115
- package/dist/cli/services/ripgrep.js.map +1 -0
- package/dist/cli/services/sandbox.d.ts +1 -1
- package/dist/cli/services/sandbox.js +58 -37
- package/dist/cli/services/sandbox.js.map +1 -0
- package/dist/cli/services/server-tools.js +738 -565
- package/dist/cli/services/server-tools.js.map +1 -0
- package/dist/cli/services/session-persistence.js +69 -74
- package/dist/cli/services/session-persistence.js.map +1 -0
- package/dist/cli/services/subagent-worker.js +42 -27
- package/dist/cli/services/subagent-worker.js.map +1 -0
- package/dist/cli/services/subagent.d.ts +2 -0
- package/dist/cli/services/subagent.js +605 -433
- package/dist/cli/services/subagent.js.map +1 -0
- package/dist/cli/services/system-prompt.js +86 -78
- package/dist/cli/services/system-prompt.js.map +1 -0
- package/dist/cli/services/task-decomposer.d.ts +1 -1
- package/dist/cli/services/task-decomposer.js +172 -139
- package/dist/cli/services/task-decomposer.js.map +1 -0
- package/dist/cli/services/team-lead.d.ts +2 -2
- package/dist/cli/services/team-lead.js +727 -529
- package/dist/cli/services/team-lead.js.map +1 -0
- package/dist/cli/services/team-state.js +319 -319
- package/dist/cli/services/team-state.js.map +1 -0
- package/dist/cli/services/teammate.d.ts +8 -2
- package/dist/cli/services/teammate.js +857 -569
- package/dist/cli/services/teammate.js.map +1 -0
- package/dist/cli/services/telemetry.d.ts +6 -1
- package/dist/cli/services/telemetry.js +180 -157
- package/dist/cli/services/telemetry.js.map +1 -0
- package/dist/cli/services/tools/agent-tools.d.ts +3 -3
- package/dist/cli/services/tools/agent-tools.js +480 -322
- package/dist/cli/services/tools/agent-tools.js.map +1 -0
- package/dist/cli/services/tools/file-ops.js +563 -450
- package/dist/cli/services/tools/file-ops.js.map +1 -0
- package/dist/cli/services/tools/search-tools.js +231 -162
- package/dist/cli/services/tools/search-tools.js.map +1 -0
- package/dist/cli/services/tools/shell-exec.js +197 -151
- package/dist/cli/services/tools/shell-exec.js.map +1 -0
- package/dist/cli/services/tools/task-manager.js +206 -173
- package/dist/cli/services/tools/task-manager.js.map +1 -0
- package/dist/cli/services/tools/web-tools.js +388 -341
- package/dist/cli/services/tools/web-tools.js.map +1 -0
- package/dist/cli/setup/SetupApp.d.ts +2 -2
- package/dist/cli/setup/SetupApp.js +608 -160
- package/dist/cli/setup/SetupApp.js.map +1 -0
- package/dist/cli/shared/ErrorBoundary.d.ts +22 -0
- package/dist/cli/shared/ErrorBoundary.js +73 -0
- package/dist/cli/shared/ErrorBoundary.js.map +1 -0
- package/dist/cli/shared/MatrixIntro.js +66 -69
- package/dist/cli/shared/MatrixIntro.js.map +1 -0
- package/dist/cli/shared/SpinnerSlot.d.ts +14 -0
- package/dist/cli/shared/SpinnerSlot.js +63 -0
- package/dist/cli/shared/SpinnerSlot.js.map +1 -0
- package/dist/cli/shared/Theme.d.ts +1 -1
- package/dist/cli/shared/Theme.js +136 -92
- package/dist/cli/shared/Theme.js.map +1 -0
- package/dist/cli/shared/WhaleBanner.js +99 -11
- package/dist/cli/shared/WhaleBanner.js.map +1 -0
- package/dist/cli/shared/markdown.d.ts +3 -1
- package/dist/cli/shared/markdown.js +736 -674
- package/dist/cli/shared/markdown.js.map +1 -0
- package/dist/cli/shared/marked-terminal.d.js +2 -0
- package/dist/cli/shared/marked-terminal.d.js.map +1 -0
- package/dist/cli/shared/theme-manager.js +99 -90
- package/dist/cli/shared/theme-manager.js.map +1 -0
- package/dist/cli/shared/theme-presets.js +256 -254
- package/dist/cli/shared/theme-presets.js.map +1 -0
- package/dist/cli/status/StatusApp.js +235 -86
- package/dist/cli/status/StatusApp.js.map +1 -0
- package/dist/cli/stores/StoreApp.js +275 -65
- package/dist/cli/stores/StoreApp.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +509 -396
- package/dist/index.js.map +1 -0
- package/dist/local-agent/connection.d.ts +2 -2
- package/dist/local-agent/connection.js +352 -293
- package/dist/local-agent/connection.js.map +1 -0
- package/dist/local-agent/discovery.js +259 -122
- package/dist/local-agent/discovery.js.map +1 -0
- package/dist/local-agent/executor.js +216 -193
- package/dist/local-agent/executor.js.map +1 -0
- package/dist/local-agent/index.d.ts +2 -2
- package/dist/local-agent/index.js +156 -156
- package/dist/local-agent/index.js.map +1 -0
- package/dist/node/adapters/base.js +18 -8
- package/dist/node/adapters/base.js.map +1 -0
- package/dist/node/adapters/discord.js +286 -275
- package/dist/node/adapters/discord.js.map +1 -0
- package/dist/node/adapters/email.js +189 -202
- package/dist/node/adapters/email.js.map +1 -0
- package/dist/node/adapters/imessage.js +145 -142
- package/dist/node/adapters/imessage.js.map +1 -0
- package/dist/node/adapters/slack.js +237 -236
- package/dist/node/adapters/slack.js.map +1 -0
- package/dist/node/adapters/sms.js +149 -151
- package/dist/node/adapters/sms.js.map +1 -0
- package/dist/node/adapters/telegram.js +88 -92
- package/dist/node/adapters/telegram.js.map +1 -0
- package/dist/node/adapters/webchat.js +160 -136
- package/dist/node/adapters/webchat.js.map +1 -0
- package/dist/node/adapters/whatsapp.js +212 -215
- package/dist/node/adapters/whatsapp.js.map +1 -0
- package/dist/node/cli.js +884 -653
- package/dist/node/cli.js.map +1 -0
- package/dist/node/config.js +20 -18
- package/dist/node/config.js.map +1 -0
- package/dist/node/gateway-client.js +191 -181
- package/dist/node/gateway-client.js.map +1 -0
- package/dist/node/portal/clipboard.js +161 -130
- package/dist/node/portal/clipboard.js.map +1 -0
- package/dist/node/portal/discovery.js +51 -45
- package/dist/node/portal/discovery.js.map +1 -0
- package/dist/node/portal/forward.js +64 -58
- package/dist/node/portal/forward.js.map +1 -0
- package/dist/node/portal/index.js +246 -221
- package/dist/node/portal/index.js.map +1 -0
- package/dist/node/portal/multiplexer.js +192 -182
- package/dist/node/portal/multiplexer.js.map +1 -0
- package/dist/node/portal/permissions.js +102 -70
- package/dist/node/portal/permissions.js.map +1 -0
- package/dist/node/portal/protocol.js +153 -116
- package/dist/node/portal/protocol.js.map +1 -0
- package/dist/node/portal/screen.js +80 -69
- package/dist/node/portal/screen.js.map +1 -0
- package/dist/node/portal/session.js +124 -117
- package/dist/node/portal/session.js.map +1 -0
- package/dist/node/portal/shell.js +140 -113
- package/dist/node/portal/shell.js.map +1 -0
- package/dist/node/portal/stream.js +77 -75
- package/dist/node/portal/stream.js.map +1 -0
- package/dist/node/portal/transfer.js +190 -167
- package/dist/node/portal/transfer.js.map +1 -0
- package/dist/node/portal/ui.js +124 -99
- package/dist/node/portal/ui.js.map +1 -0
- package/dist/node/remote-desktop/compile-helper.js +50 -45
- package/dist/node/remote-desktop/compile-helper.js.map +1 -0
- package/dist/node/remote-desktop/index.js +215 -187
- package/dist/node/remote-desktop/index.js.map +1 -0
- package/dist/node/remote-desktop/protocol.js +45 -29
- package/dist/node/remote-desktop/protocol.js.map +1 -0
- package/dist/node/runtime.js +493 -410
- package/dist/node/runtime.js.map +1 -0
- package/dist/server/handlers/__test-utils__/test-db.js +39 -89
- package/dist/server/handlers/__test-utils__/test-db.js.map +1 -0
- package/dist/server/handlers/analytics.js +467 -261
- package/dist/server/handlers/analytics.js.map +1 -0
- package/dist/server/handlers/api-docs.js +1030 -895
- package/dist/server/handlers/api-docs.js.map +1 -0
- package/dist/server/handlers/api-keys.js +291 -242
- package/dist/server/handlers/api-keys.js.map +1 -0
- package/dist/server/handlers/billing.js +330 -239
- package/dist/server/handlers/billing.js.map +1 -0
- package/dist/server/handlers/browser.js +468 -395
- package/dist/server/handlers/browser.js.map +1 -0
- package/dist/server/handlers/catalog.js +1377 -978
- package/dist/server/handlers/catalog.js.map +1 -0
- package/dist/server/handlers/clickhouse.js +157 -109
- package/dist/server/handlers/clickhouse.js.map +1 -0
- package/dist/server/handlers/comms.js +1439 -984
- package/dist/server/handlers/comms.js.map +1 -0
- package/dist/server/handlers/creations.js +461 -394
- package/dist/server/handlers/creations.js.map +1 -0
- package/dist/server/handlers/crm.js +1082 -791
- package/dist/server/handlers/crm.js.map +1 -0
- package/dist/server/handlers/discovery.js +251 -232
- package/dist/server/handlers/discovery.js.map +1 -0
- package/dist/server/handlers/embeddings.js +241 -164
- package/dist/server/handlers/embeddings.js.map +1 -0
- package/dist/server/handlers/enrichment.js +887 -718
- package/dist/server/handlers/enrichment.js.map +1 -0
- package/dist/server/handlers/image-gen.js +467 -376
- package/dist/server/handlers/image-gen.js.map +1 -0
- package/dist/server/handlers/inventory.js +797 -424
- package/dist/server/handlers/inventory.js.map +1 -0
- package/dist/server/handlers/kali.js +272 -230
- package/dist/server/handlers/kali.js.map +1 -0
- package/dist/server/handlers/llm-providers.js +803 -580
- package/dist/server/handlers/llm-providers.js.map +1 -0
- package/dist/server/handlers/local-agent.js +133 -105
- package/dist/server/handlers/local-agent.js.map +1 -0
- package/dist/server/handlers/media.js +1179 -857
- package/dist/server/handlers/media.js.map +1 -0
- package/dist/server/handlers/meta-ads.js +2669 -2093
- package/dist/server/handlers/meta-ads.js.map +1 -0
- package/dist/server/handlers/nodes.js +1321 -913
- package/dist/server/handlers/nodes.js.map +1 -0
- package/dist/server/handlers/operations.js +183 -157
- package/dist/server/handlers/operations.js.map +1 -0
- package/dist/server/handlers/platform.js +346 -210
- package/dist/server/handlers/platform.js.map +1 -0
- package/dist/server/handlers/remove-bg.js +118 -86
- package/dist/server/handlers/remove-bg.js.map +1 -0
- package/dist/server/handlers/storefront.js +586 -446
- package/dist/server/handlers/storefront.js.map +1 -0
- package/dist/server/handlers/supply-chain.js +546 -326
- package/dist/server/handlers/supply-chain.js.map +1 -0
- package/dist/server/handlers/transcription.js +106 -97
- package/dist/server/handlers/transcription.js.map +1 -0
- package/dist/server/handlers/video-gen.js +593 -424
- package/dist/server/handlers/video-gen.js.map +1 -0
- package/dist/server/handlers/voice.js +1458 -1039
- package/dist/server/handlers/voice.js.map +1 -0
- package/dist/server/handlers/workflow-steps.js +2837 -2116
- package/dist/server/handlers/workflow-steps.js.map +1 -0
- package/dist/server/handlers/workflows.js +1630 -933
- package/dist/server/handlers/workflows.js.map +1 -0
- package/dist/server/index.js +3167 -2422
- package/dist/server/index.js.map +1 -0
- package/dist/server/lib/batch-client.js +471 -409
- package/dist/server/lib/batch-client.js.map +1 -0
- package/dist/server/lib/clickhouse-buffer.js +118 -104
- package/dist/server/lib/clickhouse-buffer.js.map +1 -0
- package/dist/server/lib/clickhouse-client.js +107 -107
- package/dist/server/lib/clickhouse-client.js.map +1 -0
- package/dist/server/lib/coa-renderer.js +1786 -356
- package/dist/server/lib/coa-renderer.js.map +1 -0
- package/dist/server/lib/code-worker-pool.js +227 -177
- package/dist/server/lib/code-worker-pool.js.map +1 -0
- package/dist/server/lib/code-worker.js +174 -164
- package/dist/server/lib/code-worker.js.map +1 -0
- package/dist/server/lib/compaction-service.d.ts +2 -12
- package/dist/server/lib/compaction-service.js +74 -184
- package/dist/server/lib/compaction-service.js.map +1 -0
- package/dist/server/lib/logger.js +36 -24
- package/dist/server/lib/logger.js.map +1 -0
- package/dist/server/lib/otel.js +101 -80
- package/dist/server/lib/otel.js.map +1 -0
- package/dist/server/lib/pdf-renderer.js +952 -788
- package/dist/server/lib/pdf-renderer.js.map +1 -0
- package/dist/server/lib/prompt-sanitizer.js +188 -108
- package/dist/server/lib/prompt-sanitizer.js.map +1 -0
- package/dist/server/lib/provider-capabilities.js +136 -138
- package/dist/server/lib/provider-capabilities.js.map +1 -0
- package/dist/server/lib/provider-failover.js +190 -168
- package/dist/server/lib/provider-failover.js.map +1 -0
- package/dist/server/lib/rate-limiter.js +186 -117
- package/dist/server/lib/rate-limiter.js.map +1 -0
- package/dist/server/lib/react-pdf-layout.js +551 -382
- package/dist/server/lib/react-pdf-layout.js.map +1 -0
- package/dist/server/lib/server-agent-loop.d.ts +4 -1
- package/dist/server/lib/server-agent-loop.js +906 -634
- package/dist/server/lib/server-agent-loop.js.map +1 -0
- package/dist/server/lib/server-subagent.js +260 -164
- package/dist/server/lib/server-subagent.js.map +1 -0
- package/dist/server/lib/session-checkpoint.js +105 -96
- package/dist/server/lib/session-checkpoint.js.map +1 -0
- package/dist/server/lib/ssrf-guard.js +193 -184
- package/dist/server/lib/ssrf-guard.js.map +1 -0
- package/dist/server/lib/supabase-client.js +94 -82
- package/dist/server/lib/supabase-client.js.map +1 -0
- package/dist/server/lib/template-resolver.js +154 -176
- package/dist/server/lib/template-resolver.js.map +1 -0
- package/dist/server/lib/utils.js +242 -133
- package/dist/server/lib/utils.js.map +1 -0
- package/dist/server/local-agent-gateway.d.ts +2 -2
- package/dist/server/local-agent-gateway.js +785 -627
- package/dist/server/local-agent-gateway.js.map +1 -0
- package/dist/server/providers/anthropic.js +250 -172
- package/dist/server/providers/anthropic.js.map +1 -0
- package/dist/server/providers/bedrock.js +217 -158
- package/dist/server/providers/bedrock.js.map +1 -0
- package/dist/server/providers/gemini.js +548 -418
- package/dist/server/providers/gemini.js.map +1 -0
- package/dist/server/providers/openai.js +571 -437
- package/dist/server/providers/openai.js.map +1 -0
- package/dist/server/providers/registry.js +23 -18
- package/dist/server/providers/registry.js.map +1 -0
- package/dist/server/providers/shared.js +123 -95
- package/dist/server/providers/shared.js.map +1 -0
- package/dist/server/providers/types.js +1 -11
- package/dist/server/providers/types.js.map +1 -0
- package/dist/server/proxy-handlers.js +209 -165
- package/dist/server/proxy-handlers.js.map +1 -0
- package/dist/server/tool-router.js +959 -599
- package/dist/server/tool-router.js.map +1 -0
- package/dist/server/validation.js +248 -188
- package/dist/server/validation.js.map +1 -0
- package/dist/server/worker.js +202 -133
- package/dist/server/worker.js.map +1 -0
- package/dist/setup.d.ts +2 -2
- package/dist/setup.js +151 -147
- package/dist/setup.js.map +1 -0
- package/dist/shared/agent-core.d.ts +115 -26
- package/dist/shared/agent-core.js +956 -522
- package/dist/shared/agent-core.js.map +1 -0
- package/dist/shared/anthropic-types.js +1 -6
- package/dist/shared/anthropic-types.js.map +1 -0
- package/dist/shared/api-client.d.ts +16 -9
- package/dist/shared/api-client.js +419 -327
- package/dist/shared/api-client.js.map +1 -0
- package/dist/shared/compaction.d.ts +36 -0
- package/dist/shared/compaction.js +138 -0
- package/dist/shared/compaction.js.map +1 -0
- package/dist/shared/constants.js +67 -64
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/sse-parser.js +221 -219
- package/dist/shared/sse-parser.js.map +1 -0
- package/dist/shared/tool-dispatch.d.ts +4 -0
- package/dist/shared/tool-dispatch.js +226 -165
- package/dist/shared/tool-dispatch.js.map +1 -0
- package/dist/shared/types.js +1 -6
- package/dist/shared/types.js.map +1 -0
- package/dist/types/cli-highlight.d.js +2 -0
- package/dist/types/cli-highlight.d.js.map +1 -0
- package/dist/types/diff.d.js +2 -0
- package/dist/types/diff.d.js.map +1 -0
- package/dist/types/pdf-parse.d.js +2 -0
- package/dist/types/pdf-parse.d.js.map +1 -0
- package/dist/updater.d.ts +1 -1
- package/dist/updater.js +118 -92
- package/dist/updater.js.map +1 -0
- package/dist/webchat/widget.js +227 -380
- package/dist/webchat/widget.js.map +1 -0
- package/package.json +22 -10
- package/vendor/ink/build/ansi-tokenizer.d.ts +38 -0
- package/vendor/ink/build/ansi-tokenizer.js +316 -0
- package/vendor/ink/build/ansi-tokenizer.js.map +1 -0
- package/vendor/ink/build/apply-styles.js +175 -0
- package/vendor/ink/build/build-layout.js +77 -0
- package/vendor/ink/build/calculate-wrapped-text.js +53 -0
- package/vendor/ink/build/colorize.d.ts +3 -0
- package/vendor/ink/build/colorize.js +48 -0
- package/vendor/ink/build/colorize.js.map +1 -0
- package/vendor/ink/build/components/AccessibilityContext.d.ts +3 -0
- package/vendor/ink/build/components/AccessibilityContext.js +5 -0
- package/vendor/ink/build/components/AccessibilityContext.js.map +1 -0
- package/vendor/ink/build/components/App.d.ts +18 -0
- package/vendor/ink/build/components/App.js +351 -0
- package/vendor/ink/build/components/App.js.map +1 -0
- package/vendor/ink/build/components/AppContext.d.ts +15 -0
- package/vendor/ink/build/components/AppContext.js +11 -0
- package/vendor/ink/build/components/AppContext.js.map +1 -0
- package/vendor/ink/build/components/BackgroundContext.d.ts +4 -0
- package/vendor/ink/build/components/BackgroundContext.js +3 -0
- package/vendor/ink/build/components/BackgroundContext.js.map +1 -0
- package/vendor/ink/build/components/Box.d.ts +117 -0
- package/vendor/ink/build/components/Box.js +34 -0
- package/vendor/ink/build/components/Box.js.map +1 -0
- package/vendor/ink/build/components/Color.js +62 -0
- package/vendor/ink/build/components/Cursor.d.ts +83 -0
- package/vendor/ink/build/components/Cursor.js +53 -0
- package/vendor/ink/build/components/Cursor.js.map +1 -0
- package/vendor/ink/build/components/CursorContext.d.ts +11 -0
- package/vendor/ink/build/components/CursorContext.js +8 -0
- package/vendor/ink/build/components/CursorContext.js.map +1 -0
- package/vendor/ink/build/components/ErrorBoundary.d.ts +18 -0
- package/vendor/ink/build/components/ErrorBoundary.js +23 -0
- package/vendor/ink/build/components/ErrorBoundary.js.map +1 -0
- package/vendor/ink/build/components/ErrorOverview.d.ts +6 -0
- package/vendor/ink/build/components/ErrorOverview.js +84 -0
- package/vendor/ink/build/components/ErrorOverview.js.map +1 -0
- package/vendor/ink/build/components/FocusContext.d.ts +16 -0
- package/vendor/ink/build/components/FocusContext.js +17 -0
- package/vendor/ink/build/components/FocusContext.js.map +1 -0
- package/vendor/ink/build/components/Newline.d.ts +13 -0
- package/vendor/ink/build/components/Newline.js +8 -0
- package/vendor/ink/build/components/Newline.js.map +1 -0
- package/vendor/ink/build/components/Spacer.d.ts +7 -0
- package/vendor/ink/build/components/Spacer.js +11 -0
- package/vendor/ink/build/components/Spacer.js.map +1 -0
- package/vendor/ink/build/components/Static.d.ts +24 -0
- package/vendor/ink/build/components/Static.js +28 -0
- package/vendor/ink/build/components/Static.js.map +1 -0
- package/vendor/ink/build/components/StderrContext.d.ts +15 -0
- package/vendor/ink/build/components/StderrContext.js +13 -0
- package/vendor/ink/build/components/StderrContext.js.map +1 -0
- package/vendor/ink/build/components/StdinContext.d.ts +22 -0
- package/vendor/ink/build/components/StdinContext.js +19 -0
- package/vendor/ink/build/components/StdinContext.js.map +1 -0
- package/vendor/ink/build/components/StdoutContext.d.ts +15 -0
- package/vendor/ink/build/components/StdoutContext.js +13 -0
- package/vendor/ink/build/components/StdoutContext.js.map +1 -0
- package/vendor/ink/build/components/Text.d.ts +55 -0
- package/vendor/ink/build/components/Text.js +50 -0
- package/vendor/ink/build/components/Text.js.map +1 -0
- package/vendor/ink/build/components/Transform.d.ts +16 -0
- package/vendor/ink/build/components/Transform.js +15 -0
- package/vendor/ink/build/components/Transform.js.map +1 -0
- package/vendor/ink/build/cursor-helpers.d.ts +38 -0
- package/vendor/ink/build/cursor-helpers.js +56 -0
- package/vendor/ink/build/cursor-helpers.js.map +1 -0
- package/vendor/ink/build/devtools-window-polyfill.d.ts +1 -0
- package/vendor/ink/build/devtools-window-polyfill.js +65 -0
- package/vendor/ink/build/devtools-window-polyfill.js.map +1 -0
- package/vendor/ink/build/devtools.d.ts +1 -0
- package/vendor/ink/build/devtools.js +11 -0
- package/vendor/ink/build/devtools.js.map +1 -0
- package/vendor/ink/build/dom.d.ts +56 -0
- package/vendor/ink/build/dom.js +124 -0
- package/vendor/ink/build/dom.js.map +1 -0
- package/vendor/ink/build/experimental/apply-style.js +140 -0
- package/vendor/ink/build/experimental/dom.js +123 -0
- package/vendor/ink/build/experimental/output.js +91 -0
- package/vendor/ink/build/experimental/reconciler.js +141 -0
- package/vendor/ink/build/experimental/renderer.js +81 -0
- package/vendor/ink/build/get-max-width.d.ts +3 -0
- package/vendor/ink/build/get-max-width.js +10 -0
- package/vendor/ink/build/get-max-width.js.map +1 -0
- package/vendor/ink/build/hooks/use-app.d.ts +5 -0
- package/vendor/ink/build/hooks/use-app.js +8 -0
- package/vendor/ink/build/hooks/use-app.js.map +1 -0
- package/vendor/ink/build/hooks/use-cursor.d.ts +12 -0
- package/vendor/ink/build/hooks/use-cursor.js +29 -0
- package/vendor/ink/build/hooks/use-cursor.js.map +1 -0
- package/vendor/ink/build/hooks/use-focus-manager.d.ts +28 -0
- package/vendor/ink/build/hooks/use-focus-manager.js +17 -0
- package/vendor/ink/build/hooks/use-focus-manager.js.map +1 -0
- package/vendor/ink/build/hooks/use-focus.d.ts +29 -0
- package/vendor/ink/build/hooks/use-focus.js +42 -0
- package/vendor/ink/build/hooks/use-focus.js.map +1 -0
- package/vendor/ink/build/hooks/use-input.d.ts +131 -0
- package/vendor/ink/build/hooks/use-input.js +124 -0
- package/vendor/ink/build/hooks/use-input.js.map +1 -0
- package/vendor/ink/build/hooks/use-is-screen-reader-enabled.d.ts +5 -0
- package/vendor/ink/build/hooks/use-is-screen-reader-enabled.js +11 -0
- package/vendor/ink/build/hooks/use-is-screen-reader-enabled.js.map +1 -0
- package/vendor/ink/build/hooks/use-stderr.d.ts +5 -0
- package/vendor/ink/build/hooks/use-stderr.js +8 -0
- package/vendor/ink/build/hooks/use-stderr.js.map +1 -0
- package/vendor/ink/build/hooks/use-stdin.d.ts +5 -0
- package/vendor/ink/build/hooks/use-stdin.js +8 -0
- package/vendor/ink/build/hooks/use-stdin.js.map +1 -0
- package/vendor/ink/build/hooks/use-stdout.d.ts +5 -0
- package/vendor/ink/build/hooks/use-stdout.js +8 -0
- package/vendor/ink/build/hooks/use-stdout.js.map +1 -0
- package/vendor/ink/build/hooks/useInput.js +38 -0
- package/vendor/ink/build/index.d.ts +34 -0
- package/vendor/ink/build/index.js +20 -0
- package/vendor/ink/build/index.js.map +1 -0
- package/vendor/ink/build/ink.d.ts +90 -0
- package/vendor/ink/build/ink.js +654 -0
- package/vendor/ink/build/ink.js.map +1 -0
- package/vendor/ink/build/input-parser.d.ts +7 -0
- package/vendor/ink/build/input-parser.js +154 -0
- package/vendor/ink/build/input-parser.js.map +1 -0
- package/vendor/ink/build/instance.js +205 -0
- package/vendor/ink/build/instances.d.ts +3 -0
- package/vendor/ink/build/instances.js +8 -0
- package/vendor/ink/build/instances.js.map +1 -0
- package/vendor/ink/build/kitty-keyboard.d.ts +23 -0
- package/vendor/ink/build/kitty-keyboard.js +32 -0
- package/vendor/ink/build/kitty-keyboard.js.map +1 -0
- package/vendor/ink/build/layout.d.ts +7 -0
- package/vendor/ink/build/layout.js +33 -0
- package/vendor/ink/build/layout.js.map +1 -0
- package/vendor/ink/build/log-update.d.ts +19 -0
- package/vendor/ink/build/log-update.js +243 -0
- package/vendor/ink/build/log-update.js.map +1 -0
- package/vendor/ink/build/measure-element.d.ts +16 -0
- package/vendor/ink/build/measure-element.js +9 -0
- package/vendor/ink/build/measure-element.js.map +1 -0
- package/vendor/ink/build/measure-text.d.ts +6 -0
- package/vendor/ink/build/measure-text.js +21 -0
- package/vendor/ink/build/measure-text.js.map +1 -0
- package/vendor/ink/build/options.d.ts +52 -0
- package/vendor/ink/build/options.js +2 -0
- package/vendor/ink/build/options.js.map +1 -0
- package/vendor/ink/build/output.d.ts +35 -0
- package/vendor/ink/build/output.js +183 -0
- package/vendor/ink/build/output.js.map +1 -0
- package/vendor/ink/build/parse-keypress.d.ts +22 -0
- package/vendor/ink/build/parse-keypress.js +493 -0
- package/vendor/ink/build/parse-keypress.js.map +1 -0
- package/vendor/ink/build/reconciler.d.ts +4 -0
- package/vendor/ink/build/reconciler.js +274 -0
- package/vendor/ink/build/reconciler.js.map +1 -0
- package/vendor/ink/build/render-background.d.ts +4 -0
- package/vendor/ink/build/render-background.js +25 -0
- package/vendor/ink/build/render-background.js.map +1 -0
- package/vendor/ink/build/render-border.d.ts +4 -0
- package/vendor/ink/build/render-border.js +73 -0
- package/vendor/ink/build/render-border.js.map +1 -0
- package/vendor/ink/build/render-node-to-output.d.ts +14 -0
- package/vendor/ink/build/render-node-to-output.js +147 -0
- package/vendor/ink/build/render-node-to-output.js.map +1 -0
- package/vendor/ink/build/render-to-string.d.ts +38 -0
- package/vendor/ink/build/render-to-string.js +115 -0
- package/vendor/ink/build/render-to-string.js.map +1 -0
- package/vendor/ink/build/render.d.ts +121 -0
- package/vendor/ink/build/render.js +55 -0
- package/vendor/ink/build/render.js.map +1 -0
- package/vendor/ink/build/renderer.d.ts +8 -0
- package/vendor/ink/build/renderer.js +55 -0
- package/vendor/ink/build/renderer.js.map +1 -0
- package/vendor/ink/build/sanitize-ansi.d.ts +2 -0
- package/vendor/ink/build/sanitize-ansi.js +27 -0
- package/vendor/ink/build/sanitize-ansi.js.map +1 -0
- package/vendor/ink/build/screen-reader-update.d.ts +13 -0
- package/vendor/ink/build/screen-reader-update.js +38 -0
- package/vendor/ink/build/screen-reader-update.js.map +1 -0
- package/vendor/ink/build/squash-text-nodes.d.ts +3 -0
- package/vendor/ink/build/squash-text-nodes.js +36 -0
- package/vendor/ink/build/squash-text-nodes.js.map +1 -0
- package/vendor/ink/build/styles.d.ts +240 -0
- package/vendor/ink/build/styles.js +232 -0
- package/vendor/ink/build/styles.js.map +1 -0
- package/vendor/ink/build/utils.d.ts +2 -0
- package/vendor/ink/build/utils.js +4 -0
- package/vendor/ink/build/utils.js.map +1 -0
- package/vendor/ink/build/wrap-text.d.ts +3 -0
- package/vendor/ink/build/wrap-text.js +31 -0
- package/vendor/ink/build/wrap-text.js.map +1 -0
- package/vendor/ink/build/write-synchronized.d.ts +4 -0
- package/vendor/ink/build/write-synchronized.js +7 -0
- package/vendor/ink/build/write-synchronized.js.map +1 -0
- package/vendor/ink/license +10 -0
- package/vendor/ink/node_modules/@types/node/LICENSE +21 -0
- package/vendor/ink/node_modules/@types/node/README.md +15 -0
- package/vendor/ink/node_modules/@types/node/assert/strict.d.ts +105 -0
- package/vendor/ink/node_modules/@types/node/assert.d.ts +955 -0
- package/vendor/ink/node_modules/@types/node/async_hooks.d.ts +623 -0
- package/vendor/ink/node_modules/@types/node/buffer.buffer.d.ts +466 -0
- package/vendor/ink/node_modules/@types/node/buffer.d.ts +1810 -0
- package/vendor/ink/node_modules/@types/node/child_process.d.ts +1428 -0
- package/vendor/ink/node_modules/@types/node/cluster.d.ts +486 -0
- package/vendor/ink/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/vendor/ink/node_modules/@types/node/console.d.ts +151 -0
- package/vendor/ink/node_modules/@types/node/constants.d.ts +20 -0
- package/vendor/ink/node_modules/@types/node/crypto.d.ts +4065 -0
- package/vendor/ink/node_modules/@types/node/dgram.d.ts +564 -0
- package/vendor/ink/node_modules/@types/node/diagnostics_channel.d.ts +576 -0
- package/vendor/ink/node_modules/@types/node/dns/promises.d.ts +503 -0
- package/vendor/ink/node_modules/@types/node/dns.d.ts +922 -0
- package/vendor/ink/node_modules/@types/node/domain.d.ts +166 -0
- package/vendor/ink/node_modules/@types/node/events.d.ts +1054 -0
- package/vendor/ink/node_modules/@types/node/fs/promises.d.ts +1329 -0
- package/vendor/ink/node_modules/@types/node/fs.d.ts +4676 -0
- package/vendor/ink/node_modules/@types/node/globals.d.ts +150 -0
- package/vendor/ink/node_modules/@types/node/globals.typedarray.d.ts +101 -0
- package/vendor/ink/node_modules/@types/node/http.d.ts +2167 -0
- package/vendor/ink/node_modules/@types/node/http2.d.ts +2480 -0
- package/vendor/ink/node_modules/@types/node/https.d.ts +405 -0
- package/vendor/ink/node_modules/@types/node/index.d.ts +115 -0
- package/vendor/ink/node_modules/@types/node/inspector/promises.d.ts +41 -0
- package/vendor/ink/node_modules/@types/node/inspector.d.ts +224 -0
- package/vendor/ink/node_modules/@types/node/inspector.generated.d.ts +4226 -0
- package/vendor/ink/node_modules/@types/node/module.d.ts +819 -0
- package/vendor/ink/node_modules/@types/node/net.d.ts +933 -0
- package/vendor/ink/node_modules/@types/node/os.d.ts +507 -0
- package/vendor/ink/node_modules/@types/node/package.json +155 -0
- package/vendor/ink/node_modules/@types/node/path/posix.d.ts +8 -0
- package/vendor/ink/node_modules/@types/node/path/win32.d.ts +8 -0
- package/vendor/ink/node_modules/@types/node/path.d.ts +187 -0
- package/vendor/ink/node_modules/@types/node/perf_hooks.d.ts +643 -0
- package/vendor/ink/node_modules/@types/node/process.d.ts +2156 -0
- package/vendor/ink/node_modules/@types/node/punycode.d.ts +117 -0
- package/vendor/ink/node_modules/@types/node/querystring.d.ts +152 -0
- package/vendor/ink/node_modules/@types/node/quic.d.ts +910 -0
- package/vendor/ink/node_modules/@types/node/readline/promises.d.ts +161 -0
- package/vendor/ink/node_modules/@types/node/readline.d.ts +541 -0
- package/vendor/ink/node_modules/@types/node/repl.d.ts +415 -0
- package/vendor/ink/node_modules/@types/node/sea.d.ts +162 -0
- package/vendor/ink/node_modules/@types/node/sqlite.d.ts +955 -0
- package/vendor/ink/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/vendor/ink/node_modules/@types/node/stream/promises.d.ts +211 -0
- package/vendor/ink/node_modules/@types/node/stream/web.d.ts +296 -0
- package/vendor/ink/node_modules/@types/node/stream.d.ts +1760 -0
- package/vendor/ink/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/vendor/ink/node_modules/@types/node/test/reporters.d.ts +96 -0
- package/vendor/ink/node_modules/@types/node/test.d.ts +2240 -0
- package/vendor/ink/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/vendor/ink/node_modules/@types/node/timers.d.ts +159 -0
- package/vendor/ink/node_modules/@types/node/tls.d.ts +1198 -0
- package/vendor/ink/node_modules/@types/node/trace_events.d.ts +197 -0
- package/vendor/ink/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
- package/vendor/ink/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/vendor/ink/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
- package/vendor/ink/node_modules/@types/node/ts5.6/index.d.ts +117 -0
- package/vendor/ink/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/vendor/ink/node_modules/@types/node/ts5.7/index.d.ts +117 -0
- package/vendor/ink/node_modules/@types/node/tty.d.ts +250 -0
- package/vendor/ink/node_modules/@types/node/url.d.ts +519 -0
- package/vendor/ink/node_modules/@types/node/util/types.d.ts +558 -0
- package/vendor/ink/node_modules/@types/node/util.d.ts +1662 -0
- package/vendor/ink/node_modules/@types/node/v8.d.ts +983 -0
- package/vendor/ink/node_modules/@types/node/vm.d.ts +1208 -0
- package/vendor/ink/node_modules/@types/node/wasi.d.ts +202 -0
- package/vendor/ink/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
- package/vendor/ink/node_modules/@types/node/web-globals/blob.d.ts +23 -0
- package/vendor/ink/node_modules/@types/node/web-globals/console.d.ts +9 -0
- package/vendor/ink/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
- package/vendor/ink/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/vendor/ink/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
- package/vendor/ink/node_modules/@types/node/web-globals/events.d.ts +106 -0
- package/vendor/ink/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
- package/vendor/ink/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
- package/vendor/ink/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
- package/vendor/ink/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/vendor/ink/node_modules/@types/node/web-globals/performance.d.ts +45 -0
- package/vendor/ink/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/vendor/ink/node_modules/@types/node/web-globals/streams.d.ts +115 -0
- package/vendor/ink/node_modules/@types/node/web-globals/timers.d.ts +44 -0
- package/vendor/ink/node_modules/@types/node/web-globals/url.d.ts +24 -0
- package/vendor/ink/node_modules/@types/node/worker_threads.d.ts +717 -0
- package/vendor/ink/node_modules/@types/node/zlib.d.ts +618 -0
- package/vendor/ink/node_modules/node-pty/LICENSE +69 -0
- package/vendor/ink/node_modules/node-pty/README.md +164 -0
- package/vendor/ink/node_modules/node-pty/binding.gyp +150 -0
- package/vendor/ink/node_modules/node-pty/lib/conpty_console_list_agent.js +25 -0
- package/vendor/ink/node_modules/node-pty/lib/eventEmitter2.js +47 -0
- package/vendor/ink/node_modules/node-pty/lib/index.js +52 -0
- package/vendor/ink/node_modules/node-pty/lib/interfaces.js +7 -0
- package/vendor/ink/node_modules/node-pty/lib/shared/conout.js +11 -0
- package/vendor/ink/node_modules/node-pty/lib/terminal.js +190 -0
- package/vendor/ink/node_modules/node-pty/lib/types.js +7 -0
- package/vendor/ink/node_modules/node-pty/lib/unixTerminal.js +349 -0
- package/vendor/ink/node_modules/node-pty/lib/utils.js +39 -0
- package/vendor/ink/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
- package/vendor/ink/node_modules/node-pty/lib/windowsPtyAgent.js +287 -0
- package/vendor/ink/node_modules/node-pty/lib/windowsTerminal.js +201 -0
- package/vendor/ink/node_modules/node-pty/lib/worker/conoutSocketWorker.js +22 -0
- package/vendor/ink/node_modules/node-pty/package.json +65 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/linux-arm64/pty.node +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/linux-x64/pty.node +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty.pdb +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty.pdb +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
- package/vendor/ink/node_modules/node-pty/scripts/post-install.js +76 -0
- package/vendor/ink/node_modules/node-pty/scripts/prebuild.js +34 -0
- package/vendor/ink/node_modules/node-pty/src/unix/pty.cc +875 -0
- package/vendor/ink/node_modules/node-pty/src/unix/spawn-helper.cc +23 -0
- package/vendor/ink/node_modules/node-pty/src/win/conpty.cc +582 -0
- package/vendor/ink/node_modules/node-pty/src/win/conpty.h +41 -0
- package/vendor/ink/node_modules/node-pty/src/win/conpty_console_list.cc +44 -0
- package/vendor/ink/node_modules/node-pty/src/win/path_util.cc +95 -0
- package/vendor/ink/node_modules/node-pty/src/win/path_util.h +26 -0
- package/vendor/ink/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
- package/vendor/ink/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/conpty.dll +0 -0
- package/vendor/ink/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
- package/vendor/ink/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
- package/vendor/ink/node_modules/node-pty/typings/node-pty.d.ts +215 -0
- package/vendor/ink/node_modules/undici-types/LICENSE +21 -0
- package/vendor/ink/node_modules/undici-types/README.md +6 -0
- package/vendor/ink/node_modules/undici-types/agent.d.ts +32 -0
- package/vendor/ink/node_modules/undici-types/api.d.ts +43 -0
- package/vendor/ink/node_modules/undici-types/balanced-pool.d.ts +30 -0
- package/vendor/ink/node_modules/undici-types/cache-interceptor.d.ts +173 -0
- package/vendor/ink/node_modules/undici-types/cache.d.ts +36 -0
- package/vendor/ink/node_modules/undici-types/client-stats.d.ts +15 -0
- package/vendor/ink/node_modules/undici-types/client.d.ts +108 -0
- package/vendor/ink/node_modules/undici-types/connector.d.ts +34 -0
- package/vendor/ink/node_modules/undici-types/content-type.d.ts +21 -0
- package/vendor/ink/node_modules/undici-types/cookies.d.ts +30 -0
- package/vendor/ink/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
- package/vendor/ink/node_modules/undici-types/dispatcher.d.ts +276 -0
- package/vendor/ink/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
- package/vendor/ink/node_modules/undici-types/errors.d.ts +161 -0
- package/vendor/ink/node_modules/undici-types/eventsource.d.ts +66 -0
- package/vendor/ink/node_modules/undici-types/fetch.d.ts +211 -0
- package/vendor/ink/node_modules/undici-types/formdata.d.ts +108 -0
- package/vendor/ink/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/vendor/ink/node_modules/undici-types/global-origin.d.ts +7 -0
- package/vendor/ink/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/vendor/ink/node_modules/undici-types/handlers.d.ts +15 -0
- package/vendor/ink/node_modules/undici-types/header.d.ts +160 -0
- package/vendor/ink/node_modules/undici-types/index.d.ts +88 -0
- package/vendor/ink/node_modules/undici-types/interceptors.d.ts +73 -0
- package/vendor/ink/node_modules/undici-types/mock-agent.d.ts +68 -0
- package/vendor/ink/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/vendor/ink/node_modules/undici-types/mock-client.d.ts +27 -0
- package/vendor/ink/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/vendor/ink/node_modules/undici-types/mock-interceptor.d.ts +94 -0
- package/vendor/ink/node_modules/undici-types/mock-pool.d.ts +27 -0
- package/vendor/ink/node_modules/undici-types/package.json +55 -0
- package/vendor/ink/node_modules/undici-types/patch.d.ts +29 -0
- package/vendor/ink/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/vendor/ink/node_modules/undici-types/pool.d.ts +41 -0
- package/vendor/ink/node_modules/undici-types/proxy-agent.d.ts +29 -0
- package/vendor/ink/node_modules/undici-types/readable.d.ts +68 -0
- package/vendor/ink/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/vendor/ink/node_modules/undici-types/retry-handler.d.ts +125 -0
- package/vendor/ink/node_modules/undici-types/round-robin-pool.d.ts +41 -0
- package/vendor/ink/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/vendor/ink/node_modules/undici-types/util.d.ts +18 -0
- package/vendor/ink/node_modules/undici-types/utility.d.ts +7 -0
- package/vendor/ink/node_modules/undici-types/webidl.d.ts +341 -0
- package/vendor/ink/node_modules/undici-types/websocket.d.ts +186 -0
- package/vendor/ink/package.json +201 -0
- package/vendor/ink/readme.md +2636 -0
- package/bin/swag-agent.js +0 -9
- package/dist/server/lib/pg-rate-limiter.d.ts +0 -21
- package/dist/server/lib/pg-rate-limiter.js +0 -86
|
@@ -1,727 +1,853 @@
|
|
|
1
1
|
// server/handlers/api-docs.ts — Static API documentation reference for agents
|
|
2
|
+
|
|
2
3
|
const GATEWAY_BASE_URL = "https://whale-gateway.fly.dev";
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// Types
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
|
|
3
9
|
// ---------------------------------------------------------------------------
|
|
4
10
|
// Endpoint registry — every public REST API route
|
|
5
11
|
// ---------------------------------------------------------------------------
|
|
12
|
+
|
|
6
13
|
const SECTIONS = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
14
|
+
products: {
|
|
15
|
+
name: "Products",
|
|
16
|
+
description: "Product catalog CRUD, variations, and categories",
|
|
17
|
+
base: "/v1/stores/:storeId/products",
|
|
18
|
+
endpoints: [{
|
|
19
|
+
method: "GET",
|
|
20
|
+
path: "/v1/stores/:storeId/products",
|
|
21
|
+
scope: "read:products",
|
|
22
|
+
description: "List products with pagination and filters",
|
|
23
|
+
params: {
|
|
24
|
+
limit: "Number (1-100, default 25)",
|
|
25
|
+
starting_after: "Product ID cursor for forward pagination",
|
|
26
|
+
ending_before: "Product ID cursor for backward pagination",
|
|
27
|
+
category_id: "Filter by category UUID",
|
|
28
|
+
status: "Filter by status: published, draft, archived",
|
|
29
|
+
type: "Filter by type: simple, variable, grouped",
|
|
30
|
+
search: "Full-text search on name and SKU",
|
|
31
|
+
include: "Set to 'none' to skip loading variations (faster for large catalogs)"
|
|
32
|
+
},
|
|
33
|
+
response: '{ object: "list", data: Product[], has_more: boolean, url: string }'
|
|
34
|
+
}, {
|
|
35
|
+
method: "GET",
|
|
36
|
+
path: "/v1/stores/:storeId/products/:id",
|
|
37
|
+
scope: "read:products",
|
|
38
|
+
description: "Get a single product with variations and inventory",
|
|
39
|
+
response: "Product (includes pricing_data, field_values, inventory, variations)"
|
|
40
|
+
}, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
path: "/v1/stores/:storeId/products",
|
|
43
|
+
scope: "write:products",
|
|
44
|
+
description: "Create a new product",
|
|
45
|
+
body: {
|
|
46
|
+
name: "Required. Product name",
|
|
47
|
+
sku: "SKU code",
|
|
48
|
+
category_id: "Category UUID",
|
|
49
|
+
status: "published | draft (default: draft)",
|
|
50
|
+
type: "simple | variable | grouped (default: simple)",
|
|
51
|
+
description: "Full description",
|
|
52
|
+
short_description: "Summary text",
|
|
53
|
+
cost_price: "Cost per unit",
|
|
54
|
+
pricing_data: "Pricing tiers JSON",
|
|
55
|
+
field_values: "Custom fields JSON (must match category field schema)",
|
|
56
|
+
featured_image: "Image URL",
|
|
57
|
+
image_gallery: "Array of image URLs",
|
|
58
|
+
manage_stock: "Boolean — track inventory",
|
|
59
|
+
stock_quantity: "Initial stock (if manage_stock)"
|
|
60
|
+
},
|
|
61
|
+
response: "Product"
|
|
62
|
+
}, {
|
|
63
|
+
method: "PATCH",
|
|
64
|
+
path: "/v1/stores/:storeId/products/:id",
|
|
65
|
+
scope: "write:products",
|
|
66
|
+
description: "Update an existing product (partial update)",
|
|
67
|
+
body: {
|
|
68
|
+
"...": "Any product fields to update"
|
|
69
|
+
},
|
|
70
|
+
response: "Product"
|
|
71
|
+
}, {
|
|
72
|
+
method: "DELETE",
|
|
73
|
+
path: "/v1/stores/:storeId/products/:id",
|
|
74
|
+
scope: "write:products",
|
|
75
|
+
description: "Archive a product (soft delete)",
|
|
76
|
+
response: "{ deleted: true }"
|
|
77
|
+
}, {
|
|
78
|
+
method: "GET",
|
|
79
|
+
path: "/v1/stores/:storeId/products/:id/variations",
|
|
80
|
+
scope: "read:products",
|
|
81
|
+
description: "List variations for a product",
|
|
82
|
+
response: '{ object: "list", data: Variation[] }'
|
|
83
|
+
}, {
|
|
84
|
+
method: "POST",
|
|
85
|
+
path: "/v1/stores/:storeId/products/:id/variations",
|
|
86
|
+
scope: "write:products",
|
|
87
|
+
description: "Create a product variation",
|
|
88
|
+
body: {
|
|
89
|
+
name: "Variation name (e.g. 'Small', '1oz')",
|
|
90
|
+
sku: "Variation SKU",
|
|
91
|
+
pricing_data: "Variation-specific pricing",
|
|
92
|
+
field_values: "Variation-specific field values",
|
|
93
|
+
stock_quantity: "Initial stock"
|
|
94
|
+
},
|
|
95
|
+
response: "Variation"
|
|
96
|
+
}, {
|
|
97
|
+
method: "PATCH",
|
|
98
|
+
path: "/v1/stores/:storeId/products/:id/variations/:variationId",
|
|
99
|
+
scope: "write:products",
|
|
100
|
+
description: "Update a variation",
|
|
101
|
+
body: {
|
|
102
|
+
"...": "Any variation fields"
|
|
103
|
+
},
|
|
104
|
+
response: "Variation"
|
|
105
|
+
}, {
|
|
106
|
+
method: "DELETE",
|
|
107
|
+
path: "/v1/stores/:storeId/products/:id/variations/:variationId",
|
|
108
|
+
scope: "write:products",
|
|
109
|
+
description: "Delete a variation",
|
|
110
|
+
response: "{ deleted: true }"
|
|
111
|
+
}]
|
|
112
|
+
},
|
|
113
|
+
orders: {
|
|
114
|
+
name: "Orders",
|
|
115
|
+
description: "Order management — list, view, update status, void, and refund",
|
|
116
|
+
base: "/v1/stores/:storeId/orders",
|
|
117
|
+
endpoints: [{
|
|
118
|
+
method: "GET",
|
|
119
|
+
path: "/v1/stores/:storeId/orders",
|
|
120
|
+
scope: "read:orders",
|
|
121
|
+
description: "List orders with pagination",
|
|
122
|
+
params: {
|
|
123
|
+
limit: "Number (1-100, default 25)",
|
|
124
|
+
starting_after: "Order ID cursor",
|
|
125
|
+
ending_before: "Order ID cursor",
|
|
126
|
+
status: "Filter: pending, confirmed, processing, shipped, delivered, cancelled",
|
|
127
|
+
customer_id: "Filter by customer UUID",
|
|
128
|
+
location_id: "Filter by location UUID",
|
|
129
|
+
created_after: "ISO datetime — filter orders created on or after this date",
|
|
130
|
+
created_before: "ISO datetime — filter orders created on or before this date"
|
|
131
|
+
},
|
|
132
|
+
response: '{ object: "list", data: Order[], has_more: boolean }'
|
|
133
|
+
}, {
|
|
134
|
+
method: "GET",
|
|
135
|
+
path: "/v1/stores/:storeId/orders/:id",
|
|
136
|
+
scope: "read:orders",
|
|
137
|
+
description: "Get a single order with line items",
|
|
138
|
+
response: "Order (includes line_items[], customer, payment_details)"
|
|
139
|
+
}, {
|
|
140
|
+
method: "PATCH",
|
|
141
|
+
path: "/v1/stores/:storeId/orders/:id",
|
|
142
|
+
scope: "write:orders",
|
|
143
|
+
description: "Update order status or fields",
|
|
144
|
+
body: {
|
|
145
|
+
status: "Order status: pending, confirmed, processing, preparing, packed, ready, shipped, in_transit, delivered, completed, cancelled, refunded",
|
|
146
|
+
fulfillment_status: "unfulfilled, partial, fulfilled, cancelled, shipped, in_transit, delivered, ready_for_pickup, ready",
|
|
147
|
+
tracking_number: "Shipping tracking number",
|
|
148
|
+
tracking_url: "Tracking URL",
|
|
149
|
+
shipping_service: "Carrier name",
|
|
150
|
+
shipping_method: "Shipping method",
|
|
151
|
+
staff_notes: "Internal notes"
|
|
152
|
+
},
|
|
153
|
+
response: "Order"
|
|
154
|
+
}, {
|
|
155
|
+
method: "POST",
|
|
156
|
+
path: "/v1/stores/:storeId/orders/:id/void",
|
|
157
|
+
scope: "write:orders",
|
|
158
|
+
description: "Void an unsettled order",
|
|
159
|
+
response: "Order (status: voided)",
|
|
160
|
+
notes: "Only works on orders where payment has not yet settled"
|
|
161
|
+
}, {
|
|
162
|
+
method: "POST",
|
|
163
|
+
path: "/v1/stores/:storeId/orders/:id/refund",
|
|
164
|
+
scope: "write:orders",
|
|
165
|
+
description: "Refund a settled order",
|
|
166
|
+
body: {
|
|
167
|
+
amount: "Partial refund amount (optional — omit for full refund)",
|
|
168
|
+
reason: "Refund reason"
|
|
169
|
+
},
|
|
170
|
+
response: "Order (includes refund details)"
|
|
171
|
+
}]
|
|
172
|
+
},
|
|
173
|
+
cart: {
|
|
174
|
+
name: "Cart",
|
|
175
|
+
description: "Shopping cart — create, add/update/remove items, view",
|
|
176
|
+
base: "/v1/stores/:storeId/cart",
|
|
177
|
+
endpoints: [{
|
|
178
|
+
method: "POST",
|
|
179
|
+
path: "/v1/stores/:storeId/cart",
|
|
180
|
+
scope: "write:cart",
|
|
181
|
+
description: "Create a new shopping cart",
|
|
182
|
+
body: {
|
|
183
|
+
customer_id: "Optional customer UUID",
|
|
184
|
+
location_id: "Optional location UUID (auto-resolves default)"
|
|
185
|
+
},
|
|
186
|
+
response: "Cart { id, items: [], totals }"
|
|
187
|
+
}, {
|
|
188
|
+
method: "GET",
|
|
189
|
+
path: "/v1/stores/:storeId/cart/:cartId",
|
|
190
|
+
scope: "read:cart",
|
|
191
|
+
description: "Get cart with all items and computed totals",
|
|
192
|
+
response: "Cart { id, items: CartItem[], totals: { subtotal, tax, total } }"
|
|
193
|
+
}, {
|
|
194
|
+
method: "POST",
|
|
195
|
+
path: "/v1/stores/:storeId/cart/:cartId/items",
|
|
196
|
+
scope: "write:cart",
|
|
197
|
+
description: "Add an item to the cart",
|
|
198
|
+
body: {
|
|
199
|
+
product_id: "Required. Product UUID",
|
|
200
|
+
quantity: "Required. Number of units",
|
|
201
|
+
variation_id: "Variation UUID (for variable products)",
|
|
202
|
+
tier: "Pricing tier name (e.g. 'retail', 'wholesale')",
|
|
203
|
+
unit_price: "Override price (optional — auto-resolved from pricing_data)"
|
|
204
|
+
},
|
|
205
|
+
response: 'CartItem { object: "cart_item", id, product_id, product_name, quantity, unit_price, line_total }'
|
|
206
|
+
}, {
|
|
207
|
+
method: "PATCH",
|
|
208
|
+
path: "/v1/stores/:storeId/cart/:cartId/items/:itemId",
|
|
209
|
+
scope: "write:cart",
|
|
210
|
+
description: "Update cart item quantity",
|
|
211
|
+
body: {
|
|
212
|
+
quantity: "New quantity (must be >= 1)"
|
|
213
|
+
},
|
|
214
|
+
response: 'CartItem { object: "cart_item", id, quantity, unit_price, line_total }'
|
|
215
|
+
}, {
|
|
216
|
+
method: "DELETE",
|
|
217
|
+
path: "/v1/stores/:storeId/cart/:cartId/items/:itemId",
|
|
218
|
+
scope: "write:cart",
|
|
219
|
+
description: "Remove an item from the cart",
|
|
220
|
+
response: '{ object: "cart_item", id, deleted: true }'
|
|
221
|
+
}]
|
|
222
|
+
},
|
|
223
|
+
checkout: {
|
|
224
|
+
name: "Checkout",
|
|
225
|
+
description: "E-commerce checkout and POS payment intents",
|
|
226
|
+
base: "/v1/stores/:storeId/checkout",
|
|
227
|
+
endpoints: [{
|
|
228
|
+
method: "POST",
|
|
229
|
+
path: "/v1/stores/:storeId/checkout",
|
|
230
|
+
scope: "write:checkout",
|
|
231
|
+
description: "Convert a cart into an order (e-commerce checkout)",
|
|
232
|
+
body: {
|
|
233
|
+
cart_id: "Required. Cart UUID",
|
|
234
|
+
customer_email: "Customer email (auto-creates customer if not found)",
|
|
235
|
+
customer_name: "Customer name",
|
|
236
|
+
customer_id: "Existing customer UUID",
|
|
237
|
+
payment_method: "Payment method identifier",
|
|
238
|
+
opaque_data: "Authorize.Net card token { dataDescriptor, dataValue }",
|
|
239
|
+
bill_to: "Billing address { firstName, lastName, address, city, state, zip, country }",
|
|
240
|
+
ship_to: "Shipping address (same shape as bill_to)",
|
|
241
|
+
loyalty_code: "Loyalty/discount code",
|
|
242
|
+
loyalty_points_redeemed: "Points to redeem (integer >= 0)",
|
|
243
|
+
loyalty_discount_amount: "Discount amount from loyalty (number >= 0)"
|
|
244
|
+
},
|
|
245
|
+
response: 'Order { object: "order", id, order_number, status: "completed" }',
|
|
246
|
+
notes: "Cart is consumed — cannot be reused after successful checkout. Supports idempotency (returns existing order on replay)."
|
|
247
|
+
}, {
|
|
248
|
+
method: "POST",
|
|
249
|
+
path: "/v1/stores/:storeId/checkout/intents",
|
|
250
|
+
scope: "write:checkout",
|
|
251
|
+
description: "Create a payment intent (POS terminal flow)",
|
|
252
|
+
body: {
|
|
253
|
+
cartItems: "Required. Array of cart items",
|
|
254
|
+
paymentMethod: "Payment method (card, cash, etc.)",
|
|
255
|
+
locationId: "Location UUID",
|
|
256
|
+
registerId: "POS register ID",
|
|
257
|
+
sessionId: "POS session ID",
|
|
258
|
+
customerId: "Customer UUID",
|
|
259
|
+
customerName: "Customer name",
|
|
260
|
+
userId: "Staff user UUID",
|
|
261
|
+
tipAmount: "Tip amount",
|
|
262
|
+
cashTendered: "Cash amount given (for cash payments)",
|
|
263
|
+
changeGiven: "Change returned",
|
|
264
|
+
idempotencyKey: "Idempotency key for safe retries"
|
|
265
|
+
},
|
|
266
|
+
response: "PaymentIntent { id, status: 'created', amount }"
|
|
267
|
+
}, {
|
|
268
|
+
method: "GET",
|
|
269
|
+
path: "/v1/stores/:storeId/checkout/intents/:id",
|
|
270
|
+
scope: "read:checkout",
|
|
271
|
+
description: "Get payment intent status",
|
|
272
|
+
response: "PaymentIntent { id, status, amount, created_at }"
|
|
273
|
+
}, {
|
|
274
|
+
method: "POST",
|
|
275
|
+
path: "/v1/stores/:storeId/checkout/intents/:id/capture",
|
|
276
|
+
scope: "write:checkout",
|
|
277
|
+
description: "Capture an authorized payment",
|
|
278
|
+
response: "PaymentIntent { status: 'captured' }"
|
|
279
|
+
}, {
|
|
280
|
+
method: "POST",
|
|
281
|
+
path: "/v1/stores/:storeId/checkout/intents/:id/cancel",
|
|
282
|
+
scope: "write:checkout",
|
|
283
|
+
description: "Cancel a payment intent",
|
|
284
|
+
response: "PaymentIntent { status: 'cancelled' }"
|
|
285
|
+
}, {
|
|
286
|
+
method: "POST",
|
|
287
|
+
path: "/v1/stores/:storeId/checkout/intents/:id/charge",
|
|
288
|
+
scope: "write:checkout",
|
|
289
|
+
description: "Charge via Dejavoo POS terminal",
|
|
290
|
+
body: {
|
|
291
|
+
terminal_id: "Dejavoo terminal ID"
|
|
292
|
+
},
|
|
293
|
+
response: "PaymentIntent (with terminal response)",
|
|
294
|
+
notes: "POS-specific — sends charge request to physical terminal"
|
|
295
|
+
}, {
|
|
296
|
+
method: "POST",
|
|
297
|
+
path: "/v1/stores/:storeId/checkout/intents/:id/abort",
|
|
298
|
+
scope: "write:checkout",
|
|
299
|
+
description: "Abort an in-progress terminal charge",
|
|
300
|
+
response: "PaymentIntent { status: 'aborted' }"
|
|
301
|
+
}]
|
|
302
|
+
},
|
|
303
|
+
customers: {
|
|
304
|
+
name: "Customers",
|
|
305
|
+
description: "Customer CRM — CRUD and search",
|
|
306
|
+
base: "/v1/stores/:storeId/customers",
|
|
307
|
+
endpoints: [{
|
|
308
|
+
method: "GET",
|
|
309
|
+
path: "/v1/stores/:storeId/customers",
|
|
310
|
+
scope: "read:customers",
|
|
311
|
+
description: "List customers with pagination and search",
|
|
312
|
+
params: {
|
|
313
|
+
limit: "Number (1-100, default 25)",
|
|
314
|
+
starting_after: "Customer ID cursor",
|
|
315
|
+
search: "Search by name, email, or phone"
|
|
316
|
+
},
|
|
317
|
+
response: '{ object: "list", data: Customer[], has_more: boolean }'
|
|
318
|
+
}, {
|
|
319
|
+
method: "GET",
|
|
320
|
+
path: "/v1/stores/:storeId/customers/:id",
|
|
321
|
+
scope: "read:customers",
|
|
322
|
+
description: "Get a single customer with full profile",
|
|
323
|
+
response: "Customer (includes loyalty_points, total_spent, total_orders)"
|
|
324
|
+
}, {
|
|
325
|
+
method: "POST",
|
|
326
|
+
path: "/v1/stores/:storeId/customers",
|
|
327
|
+
scope: "write:customers",
|
|
328
|
+
description: "Create a new customer",
|
|
329
|
+
body: {
|
|
330
|
+
first_name: "Required",
|
|
331
|
+
last_name: "Required",
|
|
332
|
+
email: "Email address",
|
|
333
|
+
phone: "Phone number",
|
|
334
|
+
date_of_birth: "YYYY-MM-DD"
|
|
335
|
+
},
|
|
336
|
+
response: "Customer"
|
|
337
|
+
}, {
|
|
338
|
+
method: "PATCH",
|
|
339
|
+
path: "/v1/stores/:storeId/customers/:id",
|
|
340
|
+
scope: "write:customers",
|
|
341
|
+
description: "Update a customer",
|
|
342
|
+
body: {
|
|
343
|
+
"...": "Any customer fields"
|
|
344
|
+
},
|
|
345
|
+
response: "Customer"
|
|
346
|
+
}]
|
|
347
|
+
},
|
|
348
|
+
inventory: {
|
|
349
|
+
name: "Inventory",
|
|
350
|
+
description: "Inventory levels, summaries, adjustments, and transfers",
|
|
351
|
+
base: "/v1/stores/:storeId/inventory",
|
|
352
|
+
endpoints: [{
|
|
353
|
+
method: "GET",
|
|
354
|
+
path: "/v1/stores/:storeId/inventory",
|
|
355
|
+
scope: "read:inventory",
|
|
356
|
+
description: "List inventory levels across locations",
|
|
357
|
+
params: {
|
|
358
|
+
limit: "Number (1-100, default 25)",
|
|
359
|
+
starting_after: "Cursor",
|
|
360
|
+
location_id: "Filter by location UUID",
|
|
361
|
+
product_id: "Filter by product UUID",
|
|
362
|
+
low_stock: "Set to 'true' to filter to low_stock or out_of_stock items only"
|
|
363
|
+
},
|
|
364
|
+
response: '{ object: "list", data: InventoryLevel[] }'
|
|
365
|
+
}, {
|
|
366
|
+
method: "GET",
|
|
367
|
+
path: "/v1/stores/:storeId/inventory/summary",
|
|
368
|
+
scope: "read:inventory",
|
|
369
|
+
description: "Inventory summary grouped by location",
|
|
370
|
+
response: "{ locations: [{ id, name, total_products, total_units, total_value }] }"
|
|
371
|
+
}, {
|
|
372
|
+
method: "POST",
|
|
373
|
+
path: "/v1/stores/:storeId/inventory/adjust",
|
|
374
|
+
scope: "write:inventory",
|
|
375
|
+
description: "Adjust inventory quantity for a product at a location",
|
|
376
|
+
body: {
|
|
377
|
+
product_id: "Required. Product UUID",
|
|
378
|
+
location_id: "Required. Location UUID",
|
|
379
|
+
quantity_change: "Required. Number (+/-) to adjust by",
|
|
380
|
+
reason: "Reason for adjustment (default: 'api_adjustment')"
|
|
381
|
+
},
|
|
382
|
+
response: '{ object: "inventory_adjustment", product_id, location_id, quantity_change, new_quantity, reason }'
|
|
383
|
+
}, {
|
|
384
|
+
method: "POST",
|
|
385
|
+
path: "/v1/stores/:storeId/inventory/transfer",
|
|
386
|
+
scope: "write:inventory",
|
|
387
|
+
description: "Transfer inventory between locations",
|
|
388
|
+
body: {
|
|
389
|
+
product_id: "Required. Product UUID",
|
|
390
|
+
from_location_id: "Required. Source location UUID",
|
|
391
|
+
to_location_id: "Required. Destination location UUID",
|
|
392
|
+
quantity: "Required. Number of units to transfer"
|
|
393
|
+
},
|
|
394
|
+
response: "{ from: InventoryLevel, to: InventoryLevel }"
|
|
395
|
+
}]
|
|
396
|
+
},
|
|
397
|
+
locations: {
|
|
398
|
+
name: "Locations",
|
|
399
|
+
description: "Store locations — list and view",
|
|
400
|
+
base: "/v1/stores/:storeId/locations",
|
|
401
|
+
endpoints: [{
|
|
402
|
+
method: "GET",
|
|
403
|
+
path: "/v1/stores/:storeId/locations",
|
|
404
|
+
scope: "read:locations",
|
|
405
|
+
description: "List all store locations",
|
|
406
|
+
response: '{ object: "list", data: Location[] }'
|
|
407
|
+
}, {
|
|
408
|
+
method: "GET",
|
|
409
|
+
path: "/v1/stores/:storeId/locations/:id",
|
|
410
|
+
scope: "read:locations",
|
|
411
|
+
description: "Get a single location",
|
|
412
|
+
response: "Location { id, name, address, city, state, zip, type, is_active }"
|
|
413
|
+
}]
|
|
414
|
+
},
|
|
415
|
+
analytics: {
|
|
416
|
+
name: "Analytics",
|
|
417
|
+
description: "Sales, inventory, traffic, customer, and product analytics",
|
|
418
|
+
base: "/v1/stores/:storeId/analytics",
|
|
419
|
+
endpoints: [{
|
|
420
|
+
method: "GET",
|
|
421
|
+
path: "/v1/stores/:storeId/analytics/sales",
|
|
422
|
+
scope: "read:analytics",
|
|
423
|
+
description: "Sales analytics summary",
|
|
424
|
+
params: {
|
|
425
|
+
start_date: "YYYY-MM-DD (default: 30 days ago)",
|
|
426
|
+
end_date: "YYYY-MM-DD (default: today)",
|
|
427
|
+
location_id: "Filter by location UUID"
|
|
428
|
+
},
|
|
429
|
+
response: '{ object: "analytics.sales", period: { start_date, end_date }, total_orders, completed_orders, total_revenue, total_tax, total_discount, average_order_value, gross_sales, net_sales, total_profit, profit_margin, unique_customers }'
|
|
430
|
+
}, {
|
|
431
|
+
method: "GET",
|
|
432
|
+
path: "/v1/stores/:storeId/analytics/sales/daily",
|
|
433
|
+
scope: "read:analytics",
|
|
434
|
+
description: "Daily sales breakdown",
|
|
435
|
+
params: {
|
|
436
|
+
start_date: "YYYY-MM-DD (default: 30 days ago)",
|
|
437
|
+
end_date: "YYYY-MM-DD (default: today)",
|
|
438
|
+
location_id: "Filter by location UUID"
|
|
439
|
+
},
|
|
440
|
+
response: "{ days: [{ date, revenue, orders, average_order_value }] }"
|
|
441
|
+
}, {
|
|
442
|
+
method: "GET",
|
|
443
|
+
path: "/v1/stores/:storeId/analytics/sales/weekly",
|
|
444
|
+
scope: "read:analytics",
|
|
445
|
+
description: "Weekly sales breakdown",
|
|
446
|
+
params: {
|
|
447
|
+
start_date: "YYYY-MM-DD (default: 30 days ago)",
|
|
448
|
+
end_date: "YYYY-MM-DD (default: today)",
|
|
449
|
+
location_id: "Filter by location UUID"
|
|
450
|
+
},
|
|
451
|
+
response: "{ weeks: [{ week_start, revenue, orders }] }"
|
|
452
|
+
}, {
|
|
453
|
+
method: "GET",
|
|
454
|
+
path: "/v1/stores/:storeId/analytics/inventory",
|
|
455
|
+
scope: "read:analytics",
|
|
456
|
+
description: "Inventory analytics — stock levels and velocity",
|
|
457
|
+
response: "{ total_value, low_stock[], out_of_stock[], velocity[] }"
|
|
458
|
+
}, {
|
|
459
|
+
method: "GET",
|
|
460
|
+
path: "/v1/stores/:storeId/analytics/traffic",
|
|
461
|
+
scope: "read:analytics",
|
|
462
|
+
description: "Storefront traffic analytics",
|
|
463
|
+
response: "{ sessions, page_views, bounce_rate, avg_session_duration }"
|
|
464
|
+
}, {
|
|
465
|
+
method: "GET",
|
|
466
|
+
path: "/v1/stores/:storeId/analytics/funnel",
|
|
467
|
+
scope: "read:analytics",
|
|
468
|
+
description: "Conversion funnel analytics",
|
|
469
|
+
response: "{ steps: [{ name, count, conversion_rate }] }"
|
|
470
|
+
}, {
|
|
471
|
+
method: "GET",
|
|
472
|
+
path: "/v1/stores/:storeId/analytics/customers",
|
|
473
|
+
scope: "read:analytics",
|
|
474
|
+
description: "Customer analytics — segments, retention, lifetime value",
|
|
475
|
+
response: "{ total_customers, new_customers, returning, avg_ltv, segments[] }"
|
|
476
|
+
}, {
|
|
477
|
+
method: "GET",
|
|
478
|
+
path: "/v1/stores/:storeId/analytics/products",
|
|
479
|
+
scope: "read:analytics",
|
|
480
|
+
description: "Per-product performance analytics",
|
|
481
|
+
params: {
|
|
482
|
+
limit: "Number of products",
|
|
483
|
+
category_id: "Filter by category"
|
|
484
|
+
},
|
|
485
|
+
response: "{ products: [{ id, name, revenue, units_sold, avg_price }] }"
|
|
486
|
+
}]
|
|
487
|
+
},
|
|
488
|
+
storefront: {
|
|
489
|
+
name: "Storefront",
|
|
490
|
+
description: "Storefront sessions, event tracking, and customer OTP authentication",
|
|
491
|
+
base: "/v1/stores/:storeId/storefront",
|
|
492
|
+
endpoints: [{
|
|
493
|
+
method: "GET",
|
|
494
|
+
path: "/v1/stores/:storeId/storefront/sessions",
|
|
495
|
+
scope: "read:storefront",
|
|
496
|
+
description: "List storefront sessions",
|
|
497
|
+
response: '{ object: "list", data: Session[] }'
|
|
498
|
+
}, {
|
|
499
|
+
method: "GET",
|
|
500
|
+
path: "/v1/stores/:storeId/storefront/sessions/:id",
|
|
501
|
+
scope: "read:storefront",
|
|
502
|
+
description: "Get a single session",
|
|
503
|
+
response: "Session { id, customer_id, events[], created_at }"
|
|
504
|
+
}, {
|
|
505
|
+
method: "POST",
|
|
506
|
+
path: "/v1/stores/:storeId/storefront/sessions",
|
|
507
|
+
scope: "write:storefront",
|
|
508
|
+
description: "Create a storefront session",
|
|
509
|
+
body: {
|
|
510
|
+
customer_id: "Optional customer UUID",
|
|
511
|
+
metadata: "Optional session metadata"
|
|
512
|
+
},
|
|
513
|
+
response: "Session"
|
|
514
|
+
}, {
|
|
515
|
+
method: "PATCH",
|
|
516
|
+
path: "/v1/stores/:storeId/storefront/sessions/:id",
|
|
517
|
+
scope: "write:storefront",
|
|
518
|
+
description: "Update a session",
|
|
519
|
+
body: {
|
|
520
|
+
metadata: "Updated metadata"
|
|
521
|
+
},
|
|
522
|
+
response: "Session"
|
|
523
|
+
}, {
|
|
524
|
+
method: "POST",
|
|
525
|
+
path: "/v1/stores/:storeId/storefront/events",
|
|
526
|
+
scope: "write:storefront",
|
|
527
|
+
description: "Track a storefront event",
|
|
528
|
+
body: {
|
|
529
|
+
session_id: "Session UUID",
|
|
530
|
+
event_type: "Event name (e.g. page_view, add_to_cart, purchase)",
|
|
531
|
+
event_data: "Event payload JSON"
|
|
532
|
+
},
|
|
533
|
+
response: "{ tracked: true }"
|
|
534
|
+
}, {
|
|
535
|
+
method: "POST",
|
|
536
|
+
path: "/v1/stores/:storeId/storefront/auth/send-code",
|
|
537
|
+
scope: "write:storefront",
|
|
538
|
+
description: "Send passwordless OTP to a customer",
|
|
539
|
+
body: {
|
|
540
|
+
email: "Customer email OR",
|
|
541
|
+
phone: "Customer phone"
|
|
542
|
+
},
|
|
543
|
+
response: "{ sent: true }",
|
|
544
|
+
notes: "Rate-limited to prevent abuse. Code expires in 10 minutes."
|
|
545
|
+
}, {
|
|
546
|
+
method: "POST",
|
|
547
|
+
path: "/v1/stores/:storeId/storefront/auth/verify-code",
|
|
548
|
+
scope: "write:storefront",
|
|
549
|
+
description: "Verify OTP code and authenticate customer",
|
|
550
|
+
body: {
|
|
551
|
+
email: "Customer email OR phone",
|
|
552
|
+
code: "6-digit OTP code"
|
|
553
|
+
},
|
|
554
|
+
response: "{ customer_id, session_token, expires_at }"
|
|
555
|
+
}]
|
|
556
|
+
},
|
|
557
|
+
coa: {
|
|
558
|
+
name: "COA (Certificates of Analysis)",
|
|
559
|
+
description: "Lab test results — list, verify, view, and embed",
|
|
560
|
+
base: "/v1/stores/:storeId/coa",
|
|
561
|
+
endpoints: [{
|
|
562
|
+
method: "GET",
|
|
563
|
+
path: "/v1/stores/:storeId/coa",
|
|
564
|
+
scope: "read:coa",
|
|
565
|
+
description: "List COAs (scoped to client)",
|
|
566
|
+
params: {
|
|
567
|
+
limit: "Number (1-100)",
|
|
568
|
+
starting_after: "Cursor"
|
|
569
|
+
},
|
|
570
|
+
response: '{ object: "list", data: COA[] }'
|
|
571
|
+
}, {
|
|
572
|
+
method: "GET",
|
|
573
|
+
path: "/v1/stores/:storeId/coa/verify",
|
|
574
|
+
scope: "read:coa",
|
|
575
|
+
description: "Verify a COA by sample ID",
|
|
576
|
+
params: {
|
|
577
|
+
sample_id: "Lab sample identifier"
|
|
578
|
+
},
|
|
579
|
+
response: "COA (with verification status)",
|
|
580
|
+
notes: "Public-facing verification — can be linked from product pages"
|
|
581
|
+
}, {
|
|
582
|
+
method: "GET",
|
|
583
|
+
path: "/v1/stores/:storeId/coa/:id",
|
|
584
|
+
scope: "read:coa",
|
|
585
|
+
description: "Get a single COA with full lab data",
|
|
586
|
+
response: "COA { id, product_name, batch_number, sample_id, cannabinoids, terpenes, ... }"
|
|
587
|
+
}, {
|
|
588
|
+
method: "GET",
|
|
589
|
+
path: "/v1/stores/:storeId/coa/:id/embed",
|
|
590
|
+
scope: "read:coa",
|
|
591
|
+
description: "Get embeddable COA data for iframes or widgets",
|
|
592
|
+
response: "{ html: string, data: COA }",
|
|
593
|
+
notes: "Use for embedding lab results on product detail pages"
|
|
594
|
+
}]
|
|
595
|
+
},
|
|
596
|
+
portal: {
|
|
597
|
+
name: "Customer Portal",
|
|
598
|
+
description: "B2B portal — authentication, profiles, and documents",
|
|
599
|
+
base: "/v1/stores/:storeId/portal",
|
|
600
|
+
endpoints: [{
|
|
601
|
+
method: "POST",
|
|
602
|
+
path: "/v1/stores/:storeId/portal/auth/send-code",
|
|
603
|
+
scope: "write:portal",
|
|
604
|
+
description: "Send portal login OTP",
|
|
605
|
+
body: {
|
|
606
|
+
email: "Customer email"
|
|
607
|
+
},
|
|
608
|
+
response: "{ sent: true }"
|
|
609
|
+
}, {
|
|
610
|
+
method: "POST",
|
|
611
|
+
path: "/v1/stores/:storeId/portal/auth/verify",
|
|
612
|
+
scope: "write:portal",
|
|
613
|
+
description: "Verify OTP and get portal session",
|
|
614
|
+
body: {
|
|
615
|
+
email: "Customer email",
|
|
616
|
+
code: "OTP code"
|
|
617
|
+
},
|
|
618
|
+
response: "{ customer_id, token, expires_at }"
|
|
619
|
+
}, {
|
|
620
|
+
method: "POST",
|
|
621
|
+
path: "/v1/stores/:storeId/portal/auth/refresh",
|
|
622
|
+
scope: "write:portal",
|
|
623
|
+
description: "Refresh portal session token",
|
|
624
|
+
body: {
|
|
625
|
+
token: "Current session token"
|
|
626
|
+
},
|
|
627
|
+
response: "{ token, expires_at }"
|
|
628
|
+
}, {
|
|
629
|
+
method: "GET",
|
|
630
|
+
path: "/v1/stores/:storeId/portal/stores",
|
|
631
|
+
scope: "read:portal",
|
|
632
|
+
description: "Get stores the customer belongs to",
|
|
633
|
+
response: "{ stores: Store[] }"
|
|
634
|
+
}, {
|
|
635
|
+
method: "GET",
|
|
636
|
+
path: "/v1/stores/:storeId/portal/profiles",
|
|
637
|
+
scope: "read:portal",
|
|
638
|
+
description: "List customer profiles",
|
|
639
|
+
response: "{ profiles: Profile[] }"
|
|
640
|
+
}, {
|
|
641
|
+
method: "GET",
|
|
642
|
+
path: "/v1/stores/:storeId/portal/documents",
|
|
643
|
+
scope: "read:portal",
|
|
644
|
+
description: "List customer documents",
|
|
645
|
+
response: '{ object: "list", data: Document[] }'
|
|
646
|
+
}, {
|
|
647
|
+
method: "GET",
|
|
648
|
+
path: "/v1/stores/:storeId/portal/documents/:id",
|
|
649
|
+
scope: "read:portal",
|
|
650
|
+
description: "Get a single document",
|
|
651
|
+
response: "Document { id, name, type, url, created_at }"
|
|
652
|
+
}, {
|
|
653
|
+
method: "GET",
|
|
654
|
+
path: "/v1/stores/:storeId/portal/api-key",
|
|
655
|
+
scope: "read:portal",
|
|
656
|
+
description: "Get customer's API key for portal access",
|
|
657
|
+
response: "{ api_key, scopes[], expires_at }"
|
|
658
|
+
}]
|
|
659
|
+
},
|
|
660
|
+
webhooks: {
|
|
661
|
+
name: "Webhooks",
|
|
662
|
+
description: "Inbound webhook ingestion — receives events from external services (HMAC-authenticated, no API key required)",
|
|
663
|
+
base: "/v1/webhooks",
|
|
664
|
+
endpoints: [{
|
|
665
|
+
method: "POST",
|
|
666
|
+
path: "/v1/webhooks/:slug",
|
|
667
|
+
scope: "(none — HMAC signature)",
|
|
668
|
+
description: "Receive an inbound webhook event",
|
|
669
|
+
body: {
|
|
670
|
+
timestamp: "Unix timestamp (optional — replay protection, rejects if > 5 min old)",
|
|
671
|
+
event: "Event type identifier (or 'type' field)",
|
|
672
|
+
"...": "All other fields pass through to webhook_events table"
|
|
673
|
+
},
|
|
674
|
+
response: '{ object: "webhook_event", received: true, event_type: string }',
|
|
675
|
+
notes: "Authenticated via HMAC sha256 signature from the webhook endpoint's signing_secret. No API key required."
|
|
676
|
+
}]
|
|
677
|
+
},
|
|
678
|
+
agent: {
|
|
679
|
+
name: "Agent",
|
|
680
|
+
description: "AI agent chat — SSE streaming proxy to the internal whale-agent service",
|
|
681
|
+
base: "/v1/stores/:storeId/agent",
|
|
682
|
+
endpoints: [{
|
|
683
|
+
method: "POST",
|
|
684
|
+
path: "/v1/stores/:storeId/agent/chat",
|
|
685
|
+
scope: "write:agent",
|
|
686
|
+
description: "Stream an AI agent response via Server-Sent Events",
|
|
687
|
+
body: {
|
|
688
|
+
message: "User message (string — either this or messages required)",
|
|
689
|
+
messages: "Array of { role: 'user'|'assistant'|'system', content: string }",
|
|
690
|
+
conversation_id: "Conversation ID for multi-turn context",
|
|
691
|
+
context: "Additional context object passed to the agent"
|
|
692
|
+
},
|
|
693
|
+
response: "SSE stream (text/event-stream) — streamed tokens from the agent",
|
|
694
|
+
notes: "Proxies to internal whale-agent service. 120s timeout (504 on timeout, 502 on connection failure)."
|
|
695
|
+
}]
|
|
696
|
+
},
|
|
697
|
+
telemetry: {
|
|
698
|
+
name: "Telemetry",
|
|
699
|
+
description: "SDK telemetry ingestion — errors, analytics events, Web Vitals, and AI/LLM call tracking",
|
|
700
|
+
base: "/v1/stores/:storeId/telemetry",
|
|
701
|
+
endpoints: [{
|
|
702
|
+
method: "POST",
|
|
703
|
+
path: "/v1/stores/:storeId/telemetry/ingest",
|
|
704
|
+
scope: "write:telemetry",
|
|
705
|
+
description: "Ingest a batch of telemetry data (errors, events, vitals, AI calls)",
|
|
706
|
+
body: {
|
|
707
|
+
session: "Required. { session_id, visitor_id, started_at, page_url, referrer, user_agent, screen_width, screen_height, device, language, utm_* }",
|
|
708
|
+
user: "Optional. { user_id, email?, name?, traits? }",
|
|
709
|
+
errors: "Array (max 50). Each: { error_type, error_message, fingerprint, occurred_at, severity?, stack_trace?, breadcrumbs? }",
|
|
710
|
+
events: "Array (max 100). Each: { event_name, properties, timestamp }",
|
|
711
|
+
vitals: "Array (max 20). Each: { name: CLS|FID|LCP|INP|TTFB|FCP, value, rating, timestamp }",
|
|
712
|
+
ai_calls: "Array (max 50). Each: { model, provider?, prompt_tokens?, completion_tokens?, cost?, duration_ms?, status?, agent_id? }"
|
|
713
|
+
},
|
|
714
|
+
response: '{ object: "telemetry_batch", accepted: { errors, events, vitals, ai_calls }, session_id }',
|
|
715
|
+
notes: "Used by @neowhale/telemetry SDK. Errors go to ClickHouse, events to Supabase, vitals and AI calls to ClickHouse."
|
|
716
|
+
}, {
|
|
717
|
+
method: "POST",
|
|
718
|
+
path: "/v1/native/telemetry",
|
|
719
|
+
scope: "(JWT-authenticated)",
|
|
720
|
+
description: "Ingest telemetry from native (macOS/iOS) apps",
|
|
721
|
+
body: {
|
|
722
|
+
"...": "Same batch format as /telemetry/ingest"
|
|
723
|
+
},
|
|
724
|
+
response: '{ object: "telemetry_batch", accepted: { ... } }',
|
|
725
|
+
notes: "Authenticated via JWT token (not API key). Bypasses standard API key middleware."
|
|
726
|
+
}]
|
|
727
|
+
},
|
|
728
|
+
media: {
|
|
729
|
+
name: "Media",
|
|
730
|
+
description: "Image and video proxy with on-the-fly transformations (HMAC-signed, no API key required)",
|
|
731
|
+
base: "/v1/stores/:storeId",
|
|
732
|
+
endpoints: [{
|
|
733
|
+
method: "GET",
|
|
734
|
+
path: "/v1/stores/:storeId/media",
|
|
735
|
+
scope: "(HMAC signature via 's' query param)",
|
|
736
|
+
description: "Proxy and transform an image (resize, format conversion, quality)",
|
|
737
|
+
params: {
|
|
738
|
+
url: "Required. Base64url-encoded source image URL",
|
|
739
|
+
w: "Width: 64, 96, 128, 256, 384, 640, 828, 1080, 1280, or 1920",
|
|
740
|
+
q: "Quality 1-100 (default: 80)",
|
|
741
|
+
f: "Format: avif, webp, jpeg, png (default: webp)",
|
|
742
|
+
s: "Required. HMAC signature"
|
|
743
|
+
},
|
|
744
|
+
response: "Binary image data with Cache-Control: public, max-age=86400, s-maxage=604800, immutable",
|
|
745
|
+
notes: "Max 8 concurrent transforms, queues for 5s then returns 503 with Retry-After: 2. Use WhaleClient.signMedia() to generate signatures."
|
|
746
|
+
}, {
|
|
747
|
+
method: "GET",
|
|
748
|
+
path: "/v1/stores/:storeId/video",
|
|
749
|
+
scope: "(HMAC signature via 's' query param)",
|
|
750
|
+
description: "Stream a video with HTTP range request support",
|
|
751
|
+
params: {
|
|
752
|
+
url: "Required. Base64url-encoded source video URL",
|
|
753
|
+
s: "Required. HMAC signature"
|
|
754
|
+
},
|
|
755
|
+
response: "Streamed video (supports Accept-Ranges: bytes for seeking). Auto-resolves optimized -web.mp4 variants.",
|
|
756
|
+
notes: "Cache-Control: public, max-age=86400, s-maxage=604800, immutable. X-Video-Source header indicates original vs optimized."
|
|
757
|
+
}]
|
|
758
|
+
},
|
|
759
|
+
infrastructure: {
|
|
760
|
+
name: "Infrastructure",
|
|
761
|
+
description: "Health checks, OpenAPI spec, and interactive documentation",
|
|
762
|
+
base: "",
|
|
763
|
+
endpoints: [{
|
|
764
|
+
method: "GET",
|
|
765
|
+
path: "/health",
|
|
766
|
+
scope: "(no auth)",
|
|
767
|
+
description: "Health check — simple or detailed with dependency status",
|
|
768
|
+
params: {
|
|
769
|
+
detailed: "Set to 'true' to check Supabase and ClickHouse dependencies"
|
|
770
|
+
},
|
|
771
|
+
response: '{ status: "ok"|"degraded"|"down", version: "2026-02-20", uptime_s?, dependencies?: { supabase, clickhouse } }',
|
|
772
|
+
notes: "Simple response: 200 always. Detailed: 503 if both dependencies are down. Cached for 10s."
|
|
773
|
+
}, {
|
|
774
|
+
method: "GET",
|
|
775
|
+
path: "/openapi.json",
|
|
776
|
+
scope: "(no auth)",
|
|
777
|
+
description: "OpenAPI 3.0 specification",
|
|
778
|
+
response: "OpenAPI JSON spec"
|
|
779
|
+
}, {
|
|
780
|
+
method: "GET",
|
|
781
|
+
path: "/docs",
|
|
782
|
+
scope: "(no auth)",
|
|
783
|
+
description: "Interactive API documentation page",
|
|
784
|
+
response: "HTML page"
|
|
785
|
+
}]
|
|
786
|
+
}
|
|
653
787
|
};
|
|
788
|
+
|
|
654
789
|
// ---------------------------------------------------------------------------
|
|
655
790
|
// Auth reference
|
|
656
791
|
// ---------------------------------------------------------------------------
|
|
792
|
+
|
|
657
793
|
const AUTH_GUIDE = {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
invalid_request_error: "400/405/409 — validation_error, method_not_allowed, conflict",
|
|
703
|
-
rate_limit_error: "429 — rate_limit_exceeded, auth_rate_limited (too many auth attempts)",
|
|
704
|
-
api_error: "500 — internal_error",
|
|
705
|
-
},
|
|
706
|
-
},
|
|
707
|
-
security_headers: {
|
|
708
|
-
cors: "Configurable per-store. Default: allow all origins",
|
|
709
|
-
idempotency: "Idempotency-Key header supported on all POST/PATCH requests",
|
|
710
|
-
versioning: "X-API-Version header (optional — latest version used if omitted)",
|
|
711
|
-
},
|
|
712
|
-
url_pattern: "All endpoints: /v1/stores/:storeId/<resource>",
|
|
713
|
-
note: "Replace :storeId with your store UUID. Get it from the WhaleTools dashboard or the store tool.",
|
|
794
|
+
base_url: GATEWAY_BASE_URL,
|
|
795
|
+
api_version: "2026-02-20",
|
|
796
|
+
api_version_header: "X-API-Version",
|
|
797
|
+
authentication: {
|
|
798
|
+
method: "API Key via header",
|
|
799
|
+
header: "x-api-key",
|
|
800
|
+
key_format: "wk_live_<32chars> (production) or wk_test_<32chars> (sandbox)",
|
|
801
|
+
how_to_get: "Use the api_keys tool (action: generate) or the WhaleTools dashboard under Settings → API Keys"
|
|
802
|
+
},
|
|
803
|
+
scopes: {
|
|
804
|
+
wildcard: "* (full access), read:* (all reads), write:* (all writes)",
|
|
805
|
+
per_resource: ["read:products", "write:products", "read:orders", "write:orders", "read:customers", "write:customers", "read:inventory", "write:inventory", "read:locations", "read:analytics", "read:cart", "write:cart", "read:checkout", "write:checkout", "read:storefront", "write:storefront", "read:portal", "write:portal", "read:coa"],
|
|
806
|
+
internal: ["write:agent", "write:telemetry"],
|
|
807
|
+
internal_note: "Agent chat and telemetry scopes are used by WhaleTools SDKs and internal services. Media/video endpoints use HMAC signatures instead of API keys."
|
|
808
|
+
},
|
|
809
|
+
rate_limits: {
|
|
810
|
+
default_per_minute: 60,
|
|
811
|
+
headers: "X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset",
|
|
812
|
+
exceeded_status: 429,
|
|
813
|
+
retry_header: "Retry-After (seconds)"
|
|
814
|
+
},
|
|
815
|
+
pagination: {
|
|
816
|
+
style: "Cursor-based",
|
|
817
|
+
params: "limit (1-100, default 25), starting_after (ID), ending_before (ID)",
|
|
818
|
+
response: '{ object: "list", data: [...], has_more: true|false, url: "..." }'
|
|
819
|
+
},
|
|
820
|
+
error_format: {
|
|
821
|
+
shape: '{ error: { type, message, code, param?, request_id? } }',
|
|
822
|
+
types: {
|
|
823
|
+
authentication_error: "401 — invalid_api_key (also returned for missing key)",
|
|
824
|
+
permission_error: "403 — insufficient_scope, store_mismatch",
|
|
825
|
+
not_found_error: "404 — resource_not_found",
|
|
826
|
+
invalid_request_error: "400/405/409 — validation_error, method_not_allowed, conflict",
|
|
827
|
+
rate_limit_error: "429 — rate_limit_exceeded, auth_rate_limited (too many auth attempts)",
|
|
828
|
+
api_error: "500 — internal_error"
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
security_headers: {
|
|
832
|
+
cors: "Configurable per-store. Default: allow all origins",
|
|
833
|
+
idempotency: "Idempotency-Key header supported on all POST/PATCH requests",
|
|
834
|
+
versioning: "X-API-Version header (optional — latest version used if omitted)"
|
|
835
|
+
},
|
|
836
|
+
url_pattern: "All endpoints: /v1/stores/:storeId/<resource>",
|
|
837
|
+
note: "Replace :storeId with your store UUID. Get it from the WhaleTools dashboard or the store tool."
|
|
714
838
|
};
|
|
839
|
+
|
|
715
840
|
// ---------------------------------------------------------------------------
|
|
716
841
|
// Code examples by section
|
|
717
842
|
// ---------------------------------------------------------------------------
|
|
843
|
+
|
|
718
844
|
function getExamples(section) {
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
845
|
+
const BASE = GATEWAY_BASE_URL;
|
|
846
|
+
const storeVar = "${STORE_ID}";
|
|
847
|
+
const keyVar = "${API_KEY}";
|
|
848
|
+
const templates = {
|
|
849
|
+
products: {
|
|
850
|
+
raw_fetch: `// List products
|
|
725
851
|
const res = await fetch("${BASE}/v1/stores/${storeVar}/products?limit=25&status=published", {
|
|
726
852
|
headers: { "x-api-key": "${keyVar}" }
|
|
727
853
|
});
|
|
@@ -731,7 +857,7 @@ const { data: products, has_more } = await res.json();
|
|
|
731
857
|
const product = await fetch("${BASE}/v1/stores/${storeVar}/products/\${productId}", {
|
|
732
858
|
headers: { "x-api-key": "${keyVar}" }
|
|
733
859
|
}).then(r => r.json());`,
|
|
734
|
-
|
|
860
|
+
nextjs_ssr: `// app/products/page.tsx (Next.js App Router — Server Component)
|
|
735
861
|
const API_KEY = process.env.WHALE_API_KEY!;
|
|
736
862
|
const STORE_ID = process.env.WHALE_STORE_ID!;
|
|
737
863
|
const BASE = "${BASE}";
|
|
@@ -765,7 +891,7 @@ export default async function ProductsPage({ searchParams }: { searchParams: { a
|
|
|
765
891
|
</div>
|
|
766
892
|
);
|
|
767
893
|
}`,
|
|
768
|
-
|
|
894
|
+
react_client: `// hooks/useProducts.ts (React client-side)
|
|
769
895
|
import { useState, useEffect } from "react";
|
|
770
896
|
|
|
771
897
|
const BASE = "${BASE}";
|
|
@@ -784,10 +910,10 @@ export function useProducts(storeId: string, apiKey: string) {
|
|
|
784
910
|
}, [storeId, apiKey]);
|
|
785
911
|
|
|
786
912
|
return { products, loading };
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
913
|
+
}`
|
|
914
|
+
},
|
|
915
|
+
cart: {
|
|
916
|
+
raw_fetch: `// Create cart
|
|
791
917
|
const cart = await fetch("${BASE}/v1/stores/${storeVar}/cart", {
|
|
792
918
|
method: "POST",
|
|
793
919
|
headers: { "x-api-key": "${keyVar}", "Content-Type": "application/json" },
|
|
@@ -805,7 +931,7 @@ await fetch("${BASE}/v1/stores/${storeVar}/cart/\${cart.id}/items", {
|
|
|
805
931
|
const fullCart = await fetch("${BASE}/v1/stores/${storeVar}/cart/\${cart.id}", {
|
|
806
932
|
headers: { "x-api-key": "${keyVar}" }
|
|
807
933
|
}).then(r => r.json());`,
|
|
808
|
-
|
|
934
|
+
nextjs_ssr: `// app/api/cart/route.ts (Next.js Route Handler — server-side proxy)
|
|
809
935
|
import { NextRequest, NextResponse } from "next/server";
|
|
810
936
|
|
|
811
937
|
const API_KEY = process.env.WHALE_API_KEY!;
|
|
@@ -821,7 +947,7 @@ export async function POST(req: NextRequest) {
|
|
|
821
947
|
});
|
|
822
948
|
return NextResponse.json(await res.json());
|
|
823
949
|
}`,
|
|
824
|
-
|
|
950
|
+
react_client: `// hooks/useCart.ts
|
|
825
951
|
import { useState, useCallback } from "react";
|
|
826
952
|
|
|
827
953
|
export function useCart(storeId: string, apiKey: string) {
|
|
@@ -860,10 +986,10 @@ export function useCart(storeId: string, apiKey: string) {
|
|
|
860
986
|
}, [storeId, cart]);
|
|
861
987
|
|
|
862
988
|
return { cart, createCart, addItem, removeItem };
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
989
|
+
}`
|
|
990
|
+
},
|
|
991
|
+
checkout: {
|
|
992
|
+
raw_fetch: `// E-commerce checkout (convert cart to order)
|
|
867
993
|
const order = await fetch("${BASE}/v1/stores/${storeVar}/checkout", {
|
|
868
994
|
method: "POST",
|
|
869
995
|
headers: { "x-api-key": "${keyVar}", "Content-Type": "application/json" },
|
|
@@ -886,7 +1012,7 @@ await fetch("${BASE}/v1/stores/${storeVar}/checkout/intents/\${intent.id}/captur
|
|
|
886
1012
|
method: "POST",
|
|
887
1013
|
headers: { "x-api-key": "${keyVar}" }
|
|
888
1014
|
});`,
|
|
889
|
-
|
|
1015
|
+
nextjs_ssr: `// app/api/checkout/route.ts (Server-side checkout — keep API key secret)
|
|
890
1016
|
import { NextRequest, NextResponse } from "next/server";
|
|
891
1017
|
|
|
892
1018
|
const API_KEY = process.env.WHALE_API_KEY!;
|
|
@@ -909,7 +1035,7 @@ export async function POST(req: NextRequest) {
|
|
|
909
1035
|
|
|
910
1036
|
return NextResponse.json(await res.json());
|
|
911
1037
|
}`,
|
|
912
|
-
|
|
1038
|
+
react_client: `// components/CheckoutButton.tsx
|
|
913
1039
|
"use client";
|
|
914
1040
|
import { useState } from "react";
|
|
915
1041
|
|
|
@@ -933,10 +1059,10 @@ export function CheckoutButton({ cartId }: { cartId: string }) {
|
|
|
933
1059
|
};
|
|
934
1060
|
|
|
935
1061
|
return <button onClick={handleCheckout} disabled={loading}>{loading ? "Processing..." : "Checkout"}</button>;
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1062
|
+
}`
|
|
1063
|
+
},
|
|
1064
|
+
orders: {
|
|
1065
|
+
raw_fetch: `// List orders
|
|
940
1066
|
const { data: orders } = await fetch("${BASE}/v1/stores/${storeVar}/orders?limit=25", {
|
|
941
1067
|
headers: { "x-api-key": "${keyVar}" }
|
|
942
1068
|
}).then(r => r.json());
|
|
@@ -952,7 +1078,7 @@ await fetch("${BASE}/v1/stores/${storeVar}/orders/\${orderId}", {
|
|
|
952
1078
|
headers: { "x-api-key": "${keyVar}", "Content-Type": "application/json" },
|
|
953
1079
|
body: JSON.stringify({ status: "shipped" })
|
|
954
1080
|
});`,
|
|
955
|
-
|
|
1081
|
+
nextjs_ssr: `// app/orders/page.tsx (Server Component)
|
|
956
1082
|
async function getOrders() {
|
|
957
1083
|
const res = await fetch(
|
|
958
1084
|
\`${BASE}/v1/stores/\${process.env.WHALE_STORE_ID}/orders?limit=50\`,
|
|
@@ -979,7 +1105,7 @@ export default async function OrdersPage() {
|
|
|
979
1105
|
</table>
|
|
980
1106
|
);
|
|
981
1107
|
}`,
|
|
982
|
-
|
|
1108
|
+
react_client: `// hooks/useOrders.ts
|
|
983
1109
|
import useSWR from "swr";
|
|
984
1110
|
|
|
985
1111
|
const fetcher = (url: string) => fetch(url).then(r => r.json());
|
|
@@ -988,10 +1114,10 @@ export function useOrders() {
|
|
|
988
1114
|
// Fetch via your own API route (keeps API key server-side)
|
|
989
1115
|
const { data, error, isLoading } = useSWR("/api/orders", fetcher);
|
|
990
1116
|
return { orders: data?.data ?? [], error, isLoading };
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1117
|
+
}`
|
|
1118
|
+
},
|
|
1119
|
+
customers: {
|
|
1120
|
+
raw_fetch: `// Search customers
|
|
995
1121
|
const { data: customers } = await fetch("${BASE}/v1/stores/${storeVar}/customers?search=john", {
|
|
996
1122
|
headers: { "x-api-key": "${keyVar}" }
|
|
997
1123
|
}).then(r => r.json());
|
|
@@ -1002,7 +1128,7 @@ const customer = await fetch("${BASE}/v1/stores/${storeVar}/customers", {
|
|
|
1002
1128
|
headers: { "x-api-key": "${keyVar}", "Content-Type": "application/json" },
|
|
1003
1129
|
body: JSON.stringify({ first_name: "John", last_name: "Doe", email: "john@example.com" })
|
|
1004
1130
|
}).then(r => r.json());`,
|
|
1005
|
-
|
|
1131
|
+
nextjs_ssr: `// app/api/customers/route.ts
|
|
1006
1132
|
import { NextRequest, NextResponse } from "next/server";
|
|
1007
1133
|
|
|
1008
1134
|
const headers = { "x-api-key": process.env.WHALE_API_KEY! };
|
|
@@ -1013,7 +1139,7 @@ export async function GET(req: NextRequest) {
|
|
|
1013
1139
|
const res = await fetch(\`\${base}/customers?search=\${encodeURIComponent(search)}\`, { headers });
|
|
1014
1140
|
return NextResponse.json(await res.json());
|
|
1015
1141
|
}`,
|
|
1016
|
-
|
|
1142
|
+
react_client: `// hooks/useCustomers.ts
|
|
1017
1143
|
import useSWR from "swr";
|
|
1018
1144
|
|
|
1019
1145
|
export function useCustomers(search: string) {
|
|
@@ -1022,10 +1148,10 @@ export function useCustomers(search: string) {
|
|
|
1022
1148
|
(url) => fetch(url).then(r => r.json())
|
|
1023
1149
|
);
|
|
1024
1150
|
return { customers: data?.data ?? [], isLoading };
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1151
|
+
}`
|
|
1152
|
+
},
|
|
1153
|
+
inventory: {
|
|
1154
|
+
raw_fetch: `// Get inventory summary
|
|
1029
1155
|
const summary = await fetch("${BASE}/v1/stores/${storeVar}/inventory/summary", {
|
|
1030
1156
|
headers: { "x-api-key": "${keyVar}" }
|
|
1031
1157
|
}).then(r => r.json());
|
|
@@ -1036,7 +1162,7 @@ await fetch("${BASE}/v1/stores/${storeVar}/inventory/adjust", {
|
|
|
1036
1162
|
headers: { "x-api-key": "${keyVar}", "Content-Type": "application/json" },
|
|
1037
1163
|
body: JSON.stringify({ product_id: "...", location_id: "...", adjustment: -5, reason: "Sold offline" })
|
|
1038
1164
|
});`,
|
|
1039
|
-
|
|
1165
|
+
nextjs_ssr: `// app/inventory/page.tsx
|
|
1040
1166
|
async function getInventory() {
|
|
1041
1167
|
const res = await fetch(
|
|
1042
1168
|
\`${BASE}/v1/stores/\${process.env.WHALE_STORE_ID}/inventory/summary\`,
|
|
@@ -1058,16 +1184,16 @@ export default async function InventoryPage() {
|
|
|
1058
1184
|
</div>
|
|
1059
1185
|
);
|
|
1060
1186
|
}`,
|
|
1061
|
-
|
|
1187
|
+
react_client: `// hooks/useInventory.ts
|
|
1062
1188
|
import useSWR from "swr";
|
|
1063
1189
|
|
|
1064
1190
|
export function useInventorySummary() {
|
|
1065
1191
|
const { data, isLoading } = useSWR("/api/inventory/summary", (url) => fetch(url).then(r => r.json()));
|
|
1066
1192
|
return { summary: data, isLoading };
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1193
|
+
}`
|
|
1194
|
+
},
|
|
1195
|
+
analytics: {
|
|
1196
|
+
raw_fetch: `// Sales analytics
|
|
1071
1197
|
const sales = await fetch("${BASE}/v1/stores/${storeVar}/analytics/sales?period=last_30", {
|
|
1072
1198
|
headers: { "x-api-key": "${keyVar}" }
|
|
1073
1199
|
}).then(r => r.json());
|
|
@@ -1081,7 +1207,7 @@ const daily = await fetch("${BASE}/v1/stores/${storeVar}/analytics/sales/daily?p
|
|
|
1081
1207
|
const topProducts = await fetch("${BASE}/v1/stores/${storeVar}/analytics/products?limit=10", {
|
|
1082
1208
|
headers: { "x-api-key": "${keyVar}" }
|
|
1083
1209
|
}).then(r => r.json());`,
|
|
1084
|
-
|
|
1210
|
+
nextjs_ssr: `// app/dashboard/page.tsx
|
|
1085
1211
|
async function getDashboard() {
|
|
1086
1212
|
const base = \`${BASE}/v1/stores/\${process.env.WHALE_STORE_ID}/analytics\`;
|
|
1087
1213
|
const headers = { "x-api-key": process.env.WHALE_API_KEY! };
|
|
@@ -1109,7 +1235,7 @@ export default async function DashboardPage() {
|
|
|
1109
1235
|
</div>
|
|
1110
1236
|
);
|
|
1111
1237
|
}`,
|
|
1112
|
-
|
|
1238
|
+
react_client: `// hooks/useAnalytics.ts
|
|
1113
1239
|
import useSWR from "swr";
|
|
1114
1240
|
|
|
1115
1241
|
export function useSalesAnalytics(period = "last_30") {
|
|
@@ -1118,14 +1244,14 @@ export function useSalesAnalytics(period = "last_30") {
|
|
|
1118
1244
|
(url) => fetch(url).then(r => r.json())
|
|
1119
1245
|
);
|
|
1120
1246
|
return { sales: data, isLoading };
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1247
|
+
}`
|
|
1248
|
+
},
|
|
1249
|
+
locations: {
|
|
1250
|
+
raw_fetch: `// List all locations
|
|
1125
1251
|
const { data: locations } = await fetch("${BASE}/v1/stores/${storeVar}/locations", {
|
|
1126
1252
|
headers: { "x-api-key": "${keyVar}" }
|
|
1127
1253
|
}).then(r => r.json());`,
|
|
1128
|
-
|
|
1254
|
+
nextjs_ssr: `// lib/api.ts — shared helper
|
|
1129
1255
|
export async function getLocations() {
|
|
1130
1256
|
const res = await fetch(
|
|
1131
1257
|
\`${BASE}/v1/stores/\${process.env.WHALE_STORE_ID}/locations\`,
|
|
@@ -1133,16 +1259,16 @@ export async function getLocations() {
|
|
|
1133
1259
|
);
|
|
1134
1260
|
return res.json().then(r => r.data);
|
|
1135
1261
|
}`,
|
|
1136
|
-
|
|
1262
|
+
react_client: `// hooks/useLocations.ts
|
|
1137
1263
|
import useSWR from "swr";
|
|
1138
1264
|
|
|
1139
1265
|
export function useLocations() {
|
|
1140
1266
|
const { data } = useSWR("/api/locations", (url) => fetch(url).then(r => r.json()));
|
|
1141
1267
|
return data?.data ?? [];
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1268
|
+
}`
|
|
1269
|
+
},
|
|
1270
|
+
storefront: {
|
|
1271
|
+
raw_fetch: `// Track page view event
|
|
1146
1272
|
await fetch("${BASE}/v1/stores/${storeVar}/storefront/events", {
|
|
1147
1273
|
method: "POST",
|
|
1148
1274
|
headers: { "x-api-key": "${keyVar}", "Content-Type": "application/json" },
|
|
@@ -1159,7 +1285,7 @@ await fetch("${BASE}/v1/stores/${storeVar}/storefront/auth/send-code", {
|
|
|
1159
1285
|
headers: { "x-api-key": "${keyVar}", "Content-Type": "application/json" },
|
|
1160
1286
|
body: JSON.stringify({ email: "customer@example.com" })
|
|
1161
1287
|
});`,
|
|
1162
|
-
|
|
1288
|
+
nextjs_ssr: `// app/api/auth/send-code/route.ts
|
|
1163
1289
|
import { NextRequest, NextResponse } from "next/server";
|
|
1164
1290
|
|
|
1165
1291
|
export async function POST(req: NextRequest) {
|
|
@@ -1174,7 +1300,7 @@ export async function POST(req: NextRequest) {
|
|
|
1174
1300
|
);
|
|
1175
1301
|
return NextResponse.json(await res.json(), { status: res.status });
|
|
1176
1302
|
}`,
|
|
1177
|
-
|
|
1303
|
+
react_client: `// hooks/useAuth.ts
|
|
1178
1304
|
import { useState } from "react";
|
|
1179
1305
|
|
|
1180
1306
|
export function useStorefrontAuth() {
|
|
@@ -1200,10 +1326,10 @@ export function useStorefrontAuth() {
|
|
|
1200
1326
|
};
|
|
1201
1327
|
|
|
1202
1328
|
return { sendCode, verifyCode, loading };
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1329
|
+
}`
|
|
1330
|
+
},
|
|
1331
|
+
coa: {
|
|
1332
|
+
raw_fetch: `// List COAs
|
|
1207
1333
|
const { data: coas } = await fetch("${BASE}/v1/stores/${storeVar}/coa?limit=50", {
|
|
1208
1334
|
headers: { "x-api-key": "${keyVar}" }
|
|
1209
1335
|
}).then(r => r.json());
|
|
@@ -1217,7 +1343,7 @@ const verified = await fetch("${BASE}/v1/stores/${storeVar}/coa/verify?sample_id
|
|
|
1217
1343
|
const embed = await fetch("${BASE}/v1/stores/${storeVar}/coa/\${coaId}/embed", {
|
|
1218
1344
|
headers: { "x-api-key": "${keyVar}" }
|
|
1219
1345
|
}).then(r => r.json());`,
|
|
1220
|
-
|
|
1346
|
+
nextjs_ssr: `// app/products/[id]/coa/page.tsx
|
|
1221
1347
|
async function getCOAEmbed(coaId: string) {
|
|
1222
1348
|
const res = await fetch(
|
|
1223
1349
|
\`${BASE}/v1/stores/\${process.env.WHALE_STORE_ID}/coa/\${coaId}/embed\`,
|
|
@@ -1235,7 +1361,7 @@ export default async function COAPage({ params }: { params: { id: string } }) {
|
|
|
1235
1361
|
</div>
|
|
1236
1362
|
);
|
|
1237
1363
|
}`,
|
|
1238
|
-
|
|
1364
|
+
react_client: `// components/COAViewer.tsx
|
|
1239
1365
|
"use client";
|
|
1240
1366
|
import { useEffect, useState } from "react";
|
|
1241
1367
|
|
|
@@ -1247,10 +1373,10 @@ export function COAViewer({ coaId }: { coaId: string }) {
|
|
|
1247
1373
|
}, [coaId]);
|
|
1248
1374
|
|
|
1249
1375
|
return <div dangerouslySetInnerHTML={{ __html: html }} />;
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1376
|
+
}`
|
|
1377
|
+
},
|
|
1378
|
+
portal: {
|
|
1379
|
+
raw_fetch: `// B2B portal login
|
|
1254
1380
|
await fetch("${BASE}/v1/stores/${storeVar}/portal/auth/send-code", {
|
|
1255
1381
|
method: "POST",
|
|
1256
1382
|
headers: { "x-api-key": "${keyVar}", "Content-Type": "application/json" },
|
|
@@ -1268,7 +1394,7 @@ const session = await fetch("${BASE}/v1/stores/${storeVar}/portal/auth/verify",
|
|
|
1268
1394
|
const { data: docs } = await fetch("${BASE}/v1/stores/${storeVar}/portal/documents", {
|
|
1269
1395
|
headers: { "x-api-key": "${keyVar}", "Authorization": "Bearer " + session.token }
|
|
1270
1396
|
}).then(r => r.json());`,
|
|
1271
|
-
|
|
1397
|
+
nextjs_ssr: `// app/portal/layout.tsx — server-side session check
|
|
1272
1398
|
import { cookies } from "next/headers";
|
|
1273
1399
|
import { redirect } from "next/navigation";
|
|
1274
1400
|
|
|
@@ -1277,7 +1403,7 @@ export default async function PortalLayout({ children }: { children: React.React
|
|
|
1277
1403
|
if (!token) redirect("/portal/login");
|
|
1278
1404
|
return <div className="portal-layout">{children}</div>;
|
|
1279
1405
|
}`,
|
|
1280
|
-
|
|
1406
|
+
react_client: `// hooks/usePortal.ts
|
|
1281
1407
|
import { useState } from "react";
|
|
1282
1408
|
|
|
1283
1409
|
export function usePortal() {
|
|
@@ -1302,49 +1428,47 @@ export function usePortal() {
|
|
|
1302
1428
|
};
|
|
1303
1429
|
|
|
1304
1430
|
return { token, login, getDocuments };
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1431
|
+
}`
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
return templates[section] ?? null;
|
|
1309
1435
|
}
|
|
1436
|
+
|
|
1310
1437
|
// ---------------------------------------------------------------------------
|
|
1311
1438
|
// Quick start guide
|
|
1312
1439
|
// ---------------------------------------------------------------------------
|
|
1440
|
+
|
|
1313
1441
|
const QUICK_START = {
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
code: `// Via dashboard: Settings → API Keys → Generate
|
|
1442
|
+
title: "WhaleTools API — Quick Start Guide",
|
|
1443
|
+
steps: [{
|
|
1444
|
+
step: 1,
|
|
1445
|
+
title: "Get your API key",
|
|
1446
|
+
description: "Generate an API key from the WhaleTools dashboard (Settings → API Keys) or use the api_keys MCP tool.",
|
|
1447
|
+
code: `// Via dashboard: Settings → API Keys → Generate
|
|
1321
1448
|
// Or programmatically:
|
|
1322
|
-
// api_keys tool: { action: "generate", name: "My Website", scopes: ["read:products", "read:cart", "write:cart", "write:checkout"] }
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
code: `# .env.local (Next.js) or .env
|
|
1449
|
+
// api_keys tool: { action: "generate", name: "My Website", scopes: ["read:products", "read:cart", "write:cart", "write:checkout"] }`
|
|
1450
|
+
}, {
|
|
1451
|
+
step: 2,
|
|
1452
|
+
title: "Set up environment variables",
|
|
1453
|
+
description: "Store your API key and store ID securely. Never expose the API key in client-side code.",
|
|
1454
|
+
code: `# .env.local (Next.js) or .env
|
|
1329
1455
|
WHALE_API_KEY=wk_live_abc123...
|
|
1330
|
-
WHALE_STORE_ID=your-store-uuid
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
code: `const res = await fetch(
|
|
1456
|
+
WHALE_STORE_ID=your-store-uuid`
|
|
1457
|
+
}, {
|
|
1458
|
+
step: 3,
|
|
1459
|
+
title: "Fetch products",
|
|
1460
|
+
description: "Make your first API call to list published products.",
|
|
1461
|
+
code: `const res = await fetch(
|
|
1337
1462
|
\`https://whale-gateway.fly.dev/v1/stores/\${process.env.WHALE_STORE_ID}/products?status=published&limit=25\`,
|
|
1338
1463
|
{ headers: { "x-api-key": process.env.WHALE_API_KEY } }
|
|
1339
1464
|
);
|
|
1340
1465
|
const { data: products, has_more } = await res.json();
|
|
1341
|
-
console.log(\`Loaded \${products.length} products\`)
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
code: `const cart = await fetch(
|
|
1466
|
+
console.log(\`Loaded \${products.length} products\`);`
|
|
1467
|
+
}, {
|
|
1468
|
+
step: 4,
|
|
1469
|
+
title: "Create a cart",
|
|
1470
|
+
description: "Start a shopping session by creating a cart.",
|
|
1471
|
+
code: `const cart = await fetch(
|
|
1348
1472
|
\`https://whale-gateway.fly.dev/v1/stores/\${STORE_ID}/cart\`,
|
|
1349
1473
|
{
|
|
1350
1474
|
method: "POST",
|
|
@@ -1352,26 +1476,24 @@ console.log(\`Loaded \${products.length} products\`);`,
|
|
|
1352
1476
|
body: JSON.stringify({})
|
|
1353
1477
|
}
|
|
1354
1478
|
).then(r => r.json());
|
|
1355
|
-
console.log("Cart ID:", cart.id)
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
code: `await fetch(
|
|
1479
|
+
console.log("Cart ID:", cart.id);`
|
|
1480
|
+
}, {
|
|
1481
|
+
step: 5,
|
|
1482
|
+
title: "Add items to cart",
|
|
1483
|
+
description: "Add products to the cart by product ID.",
|
|
1484
|
+
code: `await fetch(
|
|
1362
1485
|
\`https://whale-gateway.fly.dev/v1/stores/\${STORE_ID}/cart/\${cart.id}/items\`,
|
|
1363
1486
|
{
|
|
1364
1487
|
method: "POST",
|
|
1365
1488
|
headers: { "x-api-key": API_KEY, "Content-Type": "application/json" },
|
|
1366
1489
|
body: JSON.stringify({ product_id: products[0].id, quantity: 1 })
|
|
1367
1490
|
}
|
|
1368
|
-
)
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
code: `const order = await fetch(
|
|
1491
|
+
);`
|
|
1492
|
+
}, {
|
|
1493
|
+
step: 6,
|
|
1494
|
+
title: "Checkout",
|
|
1495
|
+
description: "Convert the cart into an order.",
|
|
1496
|
+
code: `const order = await fetch(
|
|
1375
1497
|
\`https://whale-gateway.fly.dev/v1/stores/\${STORE_ID}/checkout\`,
|
|
1376
1498
|
{
|
|
1377
1499
|
method: "POST",
|
|
@@ -1387,92 +1509,105 @@ console.log("Cart ID:", cart.id);`,
|
|
|
1387
1509
|
})
|
|
1388
1510
|
}
|
|
1389
1511
|
).then(r => r.json());
|
|
1390
|
-
console.log("Order created:", order.id, "Status:", order.status)
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
tips: [
|
|
1394
|
-
"Keep your API key server-side. Use Next.js Route Handlers or API routes as a proxy for client-side calls.",
|
|
1395
|
-
"Use cursor pagination (starting_after) instead of offset for consistent results.",
|
|
1396
|
-
"Set next: { revalidate: 60 } in Next.js fetch for automatic ISR (Incremental Static Regeneration).",
|
|
1397
|
-
"Idempotency-Key header prevents duplicate orders — always set it on checkout requests.",
|
|
1398
|
-
"All list endpoints return { object: 'list', data: [...], has_more: boolean }.",
|
|
1399
|
-
],
|
|
1512
|
+
console.log("Order created:", order.id, "Status:", order.status);`
|
|
1513
|
+
}],
|
|
1514
|
+
tips: ["Keep your API key server-side. Use Next.js Route Handlers or API routes as a proxy for client-side calls.", "Use cursor pagination (starting_after) instead of offset for consistent results.", "Set next: { revalidate: 60 } in Next.js fetch for automatic ISR (Incremental Static Regeneration).", "Idempotency-Key header prevents duplicate orders — always set it on checkout requests.", "All list endpoints return { object: 'list', data: [...], has_more: boolean }."]
|
|
1400
1515
|
};
|
|
1516
|
+
|
|
1401
1517
|
// ---------------------------------------------------------------------------
|
|
1402
1518
|
// Main handler
|
|
1403
1519
|
// ---------------------------------------------------------------------------
|
|
1520
|
+
|
|
1404
1521
|
export async function handleApiDocs(_sb, args, _storeId) {
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
error: `Unknown section "${section}". Available: ${Object.keys(SECTIONS).join(", ")}`,
|
|
1433
|
-
};
|
|
1434
|
-
}
|
|
1435
|
-
return {
|
|
1436
|
-
success: true,
|
|
1437
|
-
data: {
|
|
1438
|
-
section: s.name,
|
|
1439
|
-
description: s.description,
|
|
1440
|
-
base: s.base,
|
|
1441
|
-
endpoints: s.endpoints,
|
|
1442
|
-
},
|
|
1443
|
-
};
|
|
1522
|
+
const action = args.action;
|
|
1523
|
+
switch (action) {
|
|
1524
|
+
case "sections":
|
|
1525
|
+
{
|
|
1526
|
+
const sections = Object.entries(SECTIONS).map(([key, s]) => ({
|
|
1527
|
+
key,
|
|
1528
|
+
name: s.name,
|
|
1529
|
+
description: s.description,
|
|
1530
|
+
endpoint_count: s.endpoints.length
|
|
1531
|
+
}));
|
|
1532
|
+
return {
|
|
1533
|
+
success: true,
|
|
1534
|
+
data: {
|
|
1535
|
+
total_endpoints: sections.reduce((sum, s) => sum + s.endpoint_count, 0),
|
|
1536
|
+
sections,
|
|
1537
|
+
usage: 'Use api_docs with action "endpoints" and section "<key>" to see full endpoint details.'
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
case "endpoints":
|
|
1542
|
+
{
|
|
1543
|
+
const section = args.section;
|
|
1544
|
+
if (!section) {
|
|
1545
|
+
return {
|
|
1546
|
+
success: false,
|
|
1547
|
+
error: 'Missing required param "section". Use action "sections" to see available sections.'
|
|
1548
|
+
};
|
|
1444
1549
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1550
|
+
const s = SECTIONS[section];
|
|
1551
|
+
if (!s) {
|
|
1552
|
+
return {
|
|
1553
|
+
success: false,
|
|
1554
|
+
error: `Unknown section "${section}". Available: ${Object.keys(SECTIONS).join(", ")}`
|
|
1555
|
+
};
|
|
1447
1556
|
}
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1557
|
+
return {
|
|
1558
|
+
success: true,
|
|
1559
|
+
data: {
|
|
1560
|
+
section: s.name,
|
|
1561
|
+
description: s.description,
|
|
1562
|
+
base: s.base,
|
|
1563
|
+
endpoints: s.endpoints
|
|
1564
|
+
}
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
case "auth":
|
|
1568
|
+
{
|
|
1569
|
+
return {
|
|
1570
|
+
success: true,
|
|
1571
|
+
data: AUTH_GUIDE
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
case "examples":
|
|
1575
|
+
{
|
|
1576
|
+
const section = args.section;
|
|
1577
|
+
if (!section) {
|
|
1578
|
+
return {
|
|
1579
|
+
success: false,
|
|
1580
|
+
error: 'Missing required param "section". Use action "sections" to see available sections.'
|
|
1581
|
+
};
|
|
1468
1582
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1583
|
+
const examples = getExamples(section);
|
|
1584
|
+
if (!examples) {
|
|
1585
|
+
return {
|
|
1586
|
+
success: false,
|
|
1587
|
+
error: `No examples for section "${section}". Available: ${Object.keys(SECTIONS).join(", ")}`
|
|
1588
|
+
};
|
|
1471
1589
|
}
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1590
|
+
return {
|
|
1591
|
+
success: true,
|
|
1592
|
+
data: {
|
|
1593
|
+
section,
|
|
1594
|
+
examples,
|
|
1595
|
+
tip: "Always keep API keys server-side. Use Next.js Route Handlers or API routes as a proxy for client-side calls."
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
case "quick_start":
|
|
1600
|
+
{
|
|
1601
|
+
return {
|
|
1602
|
+
success: true,
|
|
1603
|
+
data: QUICK_START
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
default:
|
|
1607
|
+
return {
|
|
1608
|
+
success: false,
|
|
1609
|
+
error: `Unknown api_docs action: "${action}". Available: sections, endpoints, auth, examples, quick_start`
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1478
1612
|
}
|
|
1613
|
+
//# sourceMappingURL=api-docs.js.map
|