@recursiv/sdk 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +105 -0
- package/README.md +331 -0
- package/dist/client.d.ts +22 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +192 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +29 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +60 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +184 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/sse.d.ts +6 -0
- package/dist/lib/sse.d.ts.map +1 -0
- package/dist/lib/sse.js +52 -0
- package/dist/lib/sse.js.map +1 -0
- package/dist/lib/webhooks.d.ts +41 -0
- package/dist/lib/webhooks.d.ts.map +1 -0
- package/dist/lib/webhooks.js +91 -0
- package/dist/lib/webhooks.js.map +1 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +2 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/useChat.d.ts +26 -0
- package/dist/react/useChat.d.ts.map +1 -0
- package/dist/react/useChat.js +111 -0
- package/dist/react/useChat.js.map +1 -0
- package/dist/realtime.d.ts +67 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/realtime.js +104 -0
- package/dist/realtime.js.map +1 -0
- package/dist/resources/admin.d.ts +287 -0
- package/dist/resources/admin.d.ts.map +1 -0
- package/dist/resources/admin.js +110 -0
- package/dist/resources/admin.js.map +1 -0
- package/dist/resources/agents.d.ts +136 -0
- package/dist/resources/agents.d.ts.map +1 -0
- package/dist/resources/agents.js +113 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/auth.d.ts +68 -0
- package/dist/resources/auth.d.ts.map +1 -0
- package/dist/resources/auth.js +231 -0
- package/dist/resources/auth.js.map +1 -0
- package/dist/resources/billing.d.ts +143 -0
- package/dist/resources/billing.d.ts.map +1 -0
- package/dist/resources/billing.js +55 -0
- package/dist/resources/billing.js.map +1 -0
- package/dist/resources/brain.d.ts +26 -0
- package/dist/resources/brain.d.ts.map +1 -0
- package/dist/resources/brain.js +11 -0
- package/dist/resources/brain.js.map +1 -0
- package/dist/resources/chat.d.ts +52 -0
- package/dist/resources/chat.d.ts.map +1 -0
- package/dist/resources/chat.js +59 -0
- package/dist/resources/chat.js.map +1 -0
- package/dist/resources/commands.d.ts +41 -0
- package/dist/resources/commands.d.ts.map +1 -0
- package/dist/resources/commands.js +15 -0
- package/dist/resources/commands.js.map +1 -0
- package/dist/resources/communities.d.ts +19 -0
- package/dist/resources/communities.d.ts.map +1 -0
- package/dist/resources/communities.js +31 -0
- package/dist/resources/communities.js.map +1 -0
- package/dist/resources/databases.d.ts +58 -0
- package/dist/resources/databases.d.ts.map +1 -0
- package/dist/resources/databases.js +27 -0
- package/dist/resources/databases.js.map +1 -0
- package/dist/resources/deployments.d.ts +57 -0
- package/dist/resources/deployments.d.ts.map +1 -0
- package/dist/resources/deployments.js +31 -0
- package/dist/resources/deployments.js.map +1 -0
- package/dist/resources/dispatcher.d.ts +330 -0
- package/dist/resources/dispatcher.d.ts.map +1 -0
- package/dist/resources/dispatcher.js +155 -0
- package/dist/resources/dispatcher.js.map +1 -0
- package/dist/resources/email.d.ts +136 -0
- package/dist/resources/email.d.ts.map +1 -0
- package/dist/resources/email.js +51 -0
- package/dist/resources/email.js.map +1 -0
- package/dist/resources/free-tier.d.ts +59 -0
- package/dist/resources/free-tier.d.ts.map +1 -0
- package/dist/resources/free-tier.js +27 -0
- package/dist/resources/free-tier.js.map +1 -0
- package/dist/resources/github.d.ts +55 -0
- package/dist/resources/github.d.ts.map +1 -0
- package/dist/resources/github.js +23 -0
- package/dist/resources/github.js.map +1 -0
- package/dist/resources/inbox.d.ts +13 -0
- package/dist/resources/inbox.d.ts.map +1 -0
- package/dist/resources/inbox.js +11 -0
- package/dist/resources/inbox.js.map +1 -0
- package/dist/resources/integrations.d.ts +158 -0
- package/dist/resources/integrations.d.ts.map +1 -0
- package/dist/resources/integrations.js +78 -0
- package/dist/resources/integrations.js.map +1 -0
- package/dist/resources/invite-codes-admin.d.ts +69 -0
- package/dist/resources/invite-codes-admin.d.ts.map +1 -0
- package/dist/resources/invite-codes-admin.js +31 -0
- package/dist/resources/invite-codes-admin.js.map +1 -0
- package/dist/resources/invite-codes.d.ts +166 -0
- package/dist/resources/invite-codes.d.ts.map +1 -0
- package/dist/resources/invite-codes.js +69 -0
- package/dist/resources/invite-codes.js.map +1 -0
- package/dist/resources/jobs.d.ts +40 -0
- package/dist/resources/jobs.d.ts.map +1 -0
- package/dist/resources/jobs.js +23 -0
- package/dist/resources/jobs.js.map +1 -0
- package/dist/resources/media.d.ts +21 -0
- package/dist/resources/media.d.ts.map +1 -0
- package/dist/resources/media.js +11 -0
- package/dist/resources/media.js.map +1 -0
- package/dist/resources/memory.d.ts +116 -0
- package/dist/resources/memory.d.ts.map +1 -0
- package/dist/resources/memory.js +57 -0
- package/dist/resources/memory.js.map +1 -0
- package/dist/resources/network.d.ts +24 -0
- package/dist/resources/network.d.ts.map +1 -0
- package/dist/resources/network.js +11 -0
- package/dist/resources/network.js.map +1 -0
- package/dist/resources/notifications.d.ts +11 -0
- package/dist/resources/notifications.d.ts.map +1 -0
- package/dist/resources/notifications.js +36 -0
- package/dist/resources/notifications.js.map +1 -0
- package/dist/resources/organization-security.d.ts +29 -0
- package/dist/resources/organization-security.d.ts.map +1 -0
- package/dist/resources/organization-security.js +15 -0
- package/dist/resources/organization-security.js.map +1 -0
- package/dist/resources/organization-settings.d.ts +80 -0
- package/dist/resources/organization-settings.d.ts.map +1 -0
- package/dist/resources/organization-settings.js +35 -0
- package/dist/resources/organization-settings.js.map +1 -0
- package/dist/resources/organizations.d.ts +73 -0
- package/dist/resources/organizations.d.ts.map +1 -0
- package/dist/resources/organizations.js +63 -0
- package/dist/resources/organizations.js.map +1 -0
- package/dist/resources/posts.d.ts +28 -0
- package/dist/resources/posts.d.ts.map +1 -0
- package/dist/resources/posts.js +39 -0
- package/dist/resources/posts.js.map +1 -0
- package/dist/resources/profiles.d.ts +45 -0
- package/dist/resources/profiles.d.ts.map +1 -0
- package/dist/resources/profiles.js +55 -0
- package/dist/resources/profiles.js.map +1 -0
- package/dist/resources/project-brain.d.ts +239 -0
- package/dist/resources/project-brain.d.ts.map +1 -0
- package/dist/resources/project-brain.js +83 -0
- package/dist/resources/project-brain.js.map +1 -0
- package/dist/resources/projects.d.ts +37 -0
- package/dist/resources/projects.d.ts.map +1 -0
- package/dist/resources/projects.js +55 -0
- package/dist/resources/projects.js.map +1 -0
- package/dist/resources/protocols.d.ts +66 -0
- package/dist/resources/protocols.d.ts.map +1 -0
- package/dist/resources/protocols.js +31 -0
- package/dist/resources/protocols.js.map +1 -0
- package/dist/resources/sandbox.d.ts +12 -0
- package/dist/resources/sandbox.d.ts.map +1 -0
- package/dist/resources/sandbox.js +14 -0
- package/dist/resources/sandbox.js.map +1 -0
- package/dist/resources/settings.d.ts +52 -0
- package/dist/resources/settings.d.ts.map +1 -0
- package/dist/resources/settings.js +66 -0
- package/dist/resources/settings.js.map +1 -0
- package/dist/resources/simulator.d.ts +20 -0
- package/dist/resources/simulator.d.ts.map +1 -0
- package/dist/resources/simulator.js +23 -0
- package/dist/resources/simulator.js.map +1 -0
- package/dist/resources/storage.d.ts +82 -0
- package/dist/resources/storage.d.ts.map +1 -0
- package/dist/resources/storage.js +43 -0
- package/dist/resources/storage.js.map +1 -0
- package/dist/resources/swarms.d.ts +98 -0
- package/dist/resources/swarms.d.ts.map +1 -0
- package/dist/resources/swarms.js +53 -0
- package/dist/resources/swarms.js.map +1 -0
- package/dist/resources/tags.d.ts +19 -0
- package/dist/resources/tags.d.ts.map +1 -0
- package/dist/resources/tags.js +23 -0
- package/dist/resources/tags.js.map +1 -0
- package/dist/resources/templates.d.ts +62 -0
- package/dist/resources/templates.d.ts.map +1 -0
- package/dist/resources/templates.js +36 -0
- package/dist/resources/templates.js.map +1 -0
- package/dist/resources/uploads.d.ts +43 -0
- package/dist/resources/uploads.d.ts.map +1 -0
- package/dist/resources/uploads.js +39 -0
- package/dist/resources/uploads.js.map +1 -0
- package/dist/resources/users.d.ts +15 -0
- package/dist/resources/users.d.ts.map +1 -0
- package/dist/resources/users.js +23 -0
- package/dist/resources/users.js.map +1 -0
- package/dist/resources/wallet.d.ts +57 -0
- package/dist/resources/wallet.d.ts.map +1 -0
- package/dist/resources/wallet.js +43 -0
- package/dist/resources/wallet.js.map +1 -0
- package/dist/resources/webhooks.d.ts +29 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks.js +19 -0
- package/dist/resources/webhooks.js.map +1 -0
- package/dist/types.d.ts +703 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/llm.md +532 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-ALv2
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 social.dev (recursivlabs)
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# @recursiv/sdk
|
|
2
|
+
|
|
3
|
+
**Infrastructure for AI agents and the apps that use them.** Databases, deploy, file storage, AI agents with memory, auth, and social primitives. One SDK. Zero dependencies.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @recursiv/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Node.js >= 18. ESM only. Zero runtime dependencies.
|
|
12
|
+
|
|
13
|
+
## 60-second quickstart
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { Recursiv } from '@recursiv/sdk'
|
|
17
|
+
|
|
18
|
+
const r = new Recursiv() // reads RECURSIV_API_KEY from env
|
|
19
|
+
|
|
20
|
+
// Provision a database
|
|
21
|
+
const { data: db } = await r.databases.ensure({ name: 'my-app', project_id: 'proj_1' })
|
|
22
|
+
const { data: creds } = await r.databases.getCredentials({ project_id: 'proj_1', name: 'my-app' })
|
|
23
|
+
console.log(creds.connection_string) // postgresql://...
|
|
24
|
+
|
|
25
|
+
// Create an AI agent
|
|
26
|
+
const { data: agent } = await r.agents.create({
|
|
27
|
+
name: 'Assistant',
|
|
28
|
+
username: 'assistant_1',
|
|
29
|
+
model: 'anthropic/claude-sonnet-4',
|
|
30
|
+
system_prompt: 'You are a helpful assistant.',
|
|
31
|
+
organization_id: 'org_xxx',
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
// Stream agent responses
|
|
35
|
+
for await (const chunk of r.agents.chatStream(agent.id, { message: 'Hello!' })) {
|
|
36
|
+
process.stdout.write(chunk.delta ?? '')
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## What can you build?
|
|
41
|
+
|
|
42
|
+
| App type | Recursiv gives you | Example |
|
|
43
|
+
|----------|-------------------|---------|
|
|
44
|
+
| **AI-native app** | Database + AI agent + file storage + auth | Home maintenance tracker, AI CRM, smart inventory |
|
|
45
|
+
| **Autonomous agent** | Agent with its own Postgres, memory, and code execution | Research agent, data pipeline agent, ops bot |
|
|
46
|
+
| **Social platform** | Posts, communities, chat, profiles, follow graph | Team forum, community hub, social network |
|
|
47
|
+
| **Code playground** | Sandboxes, deploy, AI coding assistant, live preview | Vibe coding tool, learning platform, code editor |
|
|
48
|
+
| **Any app that needs a backend** | Auth + database + storage + billing | Skip Firebase/Supabase — one SDK covers it all |
|
|
49
|
+
|
|
50
|
+
## Choose the right primitive
|
|
51
|
+
|
|
52
|
+
| Your app needs... | Use this | Not this |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| Structured data (users, records, tasks) | `r.databases` | `r.posts` with JSON blobs |
|
|
55
|
+
| Social content, feeds, discussions | `r.posts` + `r.communities` | `r.databases` for feeds |
|
|
56
|
+
| File uploads (photos, docs, media) | `r.storage` | `r.uploads` (legacy) |
|
|
57
|
+
| User auth and API keys | `r.auth` | Raw fetch to auth endpoints |
|
|
58
|
+
| AI agent with a model | `r.agents` | Direct LLM API calls |
|
|
59
|
+
| Run code in a sandbox | `r.projects.executeCode()` | External sandbox services |
|
|
60
|
+
| Deploy to production | `r.projects.deploy()` | Manual CI/CD |
|
|
61
|
+
|
|
62
|
+
## API overview
|
|
63
|
+
|
|
64
|
+
### Infrastructure
|
|
65
|
+
| Resource | Key methods |
|
|
66
|
+
|----------|------------|
|
|
67
|
+
| `r.databases` | `ensure`, `create`, `list`, `getCredentials` |
|
|
68
|
+
| `r.projects` | `create`, `deploy`, `executeCode`, `createSandbox`, `stopSandbox`, `deploymentLogs` |
|
|
69
|
+
| `r.storage` | `ensureBucket`, `getUploadUrl`, `getDownloadUrl`, `listItems`, `deleteObject` |
|
|
70
|
+
| `r.sandbox` | `execute` (anonymous, no API key needed) |
|
|
71
|
+
|
|
72
|
+
### AI Agents
|
|
73
|
+
| Resource | Key methods |
|
|
74
|
+
|----------|------------|
|
|
75
|
+
| `r.agents` | `create`, `update`, `chat`, `chatStream`, `grantProjectAccess`, `conversations` |
|
|
76
|
+
| `r.brain` | `sendMessage` |
|
|
77
|
+
| `r.commands` | `execute`, `gatePrompt` |
|
|
78
|
+
| `r.projectBrain` | `tasks`, `decisions`, `milestones`, `completeTask`, `usage` |
|
|
79
|
+
|
|
80
|
+
### Identity & Auth
|
|
81
|
+
| Resource | Key methods |
|
|
82
|
+
|----------|------------|
|
|
83
|
+
| `r.auth` | `signUp`, `signIn`, `signOut`, `createApiKey` |
|
|
84
|
+
| `r.users` | `me`, `get` |
|
|
85
|
+
| `r.organizations` | `create`, `members`, `addMember`, `invite` |
|
|
86
|
+
| `r.profiles` | `me`, `get`, `search`, `follow`, `unfollow` |
|
|
87
|
+
|
|
88
|
+
### Social
|
|
89
|
+
| Resource | Key methods |
|
|
90
|
+
|----------|------------|
|
|
91
|
+
| `r.posts` | `create`, `update`, `list`, `search`, `react` |
|
|
92
|
+
| `r.communities` | `create`, `join`, `members` |
|
|
93
|
+
| `r.chat` | `send`, `dm`, `createGroup`, `messages` |
|
|
94
|
+
| `r.tags` | `create`, `list` |
|
|
95
|
+
|
|
96
|
+
### Platform
|
|
97
|
+
| Resource | Purpose |
|
|
98
|
+
|----------|---------|
|
|
99
|
+
| `r.settings` | User preferences, sessions, password management |
|
|
100
|
+
| `r.billing` | Usage tracking, subscriptions, checkout |
|
|
101
|
+
| `r.notifications` | Push notification tokens |
|
|
102
|
+
| `r.github` | GitHub integration |
|
|
103
|
+
| `r.integrations` | External service connections |
|
|
104
|
+
| `r.dispatcher` | Task queue, claims, signals, outcomes, webhooks |
|
|
105
|
+
|
|
106
|
+
Full reference: see [llm.md](./llm.md) (ships with this package) or the type definitions in `dist/`.
|
|
107
|
+
|
|
108
|
+
## Configuration
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
const r = new Recursiv({
|
|
112
|
+
apiKey: 'sk_live_...', // or set RECURSIV_API_KEY env var
|
|
113
|
+
baseUrl: 'https://recursiv.io/api/v1', // default
|
|
114
|
+
timeout: 30000, // request timeout in ms
|
|
115
|
+
maxRetries: 2, // auto-retry on 429/5xx
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
// Zero-arg works when RECURSIV_API_KEY is set
|
|
119
|
+
const r = new Recursiv()
|
|
120
|
+
|
|
121
|
+
// Anonymous sandbox (no API key needed)
|
|
122
|
+
const r = new Recursiv({ anonymous: true })
|
|
123
|
+
|
|
124
|
+
// Self-hosted
|
|
125
|
+
const r = new Recursiv({ baseUrl: 'https://my-instance.com/api/v1' })
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Projects & deploy
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
// Deploy to production
|
|
132
|
+
const { data: deployment } = await r.projects.deploy('proj_1', {
|
|
133
|
+
branch: 'main',
|
|
134
|
+
type: 'production',
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
// Execute code in a sandbox
|
|
138
|
+
const { data: result } = await r.projects.executeCode('proj_1', {
|
|
139
|
+
code: 'console.log("hello")',
|
|
140
|
+
language: 'typescript',
|
|
141
|
+
})
|
|
142
|
+
console.log(result.output) // "hello\n"
|
|
143
|
+
|
|
144
|
+
// Get deployment logs
|
|
145
|
+
const { data: logs } = await r.projects.deploymentLogs('proj_1', deployment.id)
|
|
146
|
+
|
|
147
|
+
// Start/stop sandboxes
|
|
148
|
+
await r.projects.createSandbox('proj_1')
|
|
149
|
+
await r.projects.stopSandbox('proj_1')
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## AI agents
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
// Create an agent
|
|
156
|
+
const { data: agent } = await r.agents.create({
|
|
157
|
+
name: 'Research Bot',
|
|
158
|
+
username: 'researcher',
|
|
159
|
+
model: 'anthropic/claude-sonnet-4',
|
|
160
|
+
system_prompt: 'You help users find information.',
|
|
161
|
+
tool_mode: 'autonomous',
|
|
162
|
+
organization_id: 'org_xxx',
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
// Chat (async — agent responds asynchronously)
|
|
166
|
+
const { data: reply } = await r.agents.chat(agent.id, {
|
|
167
|
+
message: 'What are the latest trends in AI?',
|
|
168
|
+
})
|
|
169
|
+
// reply: { message_id, conversation_id, content, created_at }
|
|
170
|
+
|
|
171
|
+
// Stream (token-by-token)
|
|
172
|
+
for await (const chunk of r.agents.chatStream(agent.id, {
|
|
173
|
+
message: 'Tell me more about transformer architectures',
|
|
174
|
+
})) {
|
|
175
|
+
process.stdout.write(chunk.delta ?? '')
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Give agent access to project infrastructure
|
|
179
|
+
await r.agents.grantProjectAccess(agent.id, {
|
|
180
|
+
project_id: 'proj_1',
|
|
181
|
+
permissions: ['execute_code', 'read_files', 'write_files'],
|
|
182
|
+
})
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Social primitives
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
// Posts
|
|
189
|
+
const { data: post } = await r.posts.create({
|
|
190
|
+
content: '# Shipped!\n\nNew deploy is live.',
|
|
191
|
+
content_format: 'markdown',
|
|
192
|
+
community_id: 'comm_abc',
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
// Chat
|
|
196
|
+
const { data: dm } = await r.chat.dm({ user_id: 'user_abc' })
|
|
197
|
+
await r.chat.send({ conversation_id: dm.id, content: 'Hello!' })
|
|
198
|
+
|
|
199
|
+
// Communities
|
|
200
|
+
const { data: community } = await r.communities.create({
|
|
201
|
+
name: 'TypeScript Devs',
|
|
202
|
+
slug: 'ts-devs',
|
|
203
|
+
privacy: 'public',
|
|
204
|
+
})
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Real-time Chat (React / React Native)
|
|
208
|
+
|
|
209
|
+
The SDK provides a ready-to-use WebSocket hook for building chat applications without REST polling.
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
import { Recursiv } from '@recursiv/sdk'
|
|
213
|
+
import { useChat } from '@recursiv/sdk/react'
|
|
214
|
+
|
|
215
|
+
const r = new Recursiv()
|
|
216
|
+
|
|
217
|
+
function ChatRoom({ conversationId }) {
|
|
218
|
+
const { isConnected, error, sendTyping, sendMessage } = useChat(r, {
|
|
219
|
+
conversationId,
|
|
220
|
+
onMessage: (msg) => {
|
|
221
|
+
console.log('New message received:', msg.text)
|
|
222
|
+
},
|
|
223
|
+
onTyping: (evt) => {
|
|
224
|
+
console.log(`${evt.userName} is typing...`)
|
|
225
|
+
},
|
|
226
|
+
onAgentThinking: (evt) => {
|
|
227
|
+
console.log(`Agent ${evt.agentName} status: ${evt.status}`)
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
// Automatically connects, joins room, and listens to events!
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
<div>
|
|
235
|
+
{isConnected ? '🟢 Connected' : '🔴 Disconnected'}
|
|
236
|
+
<button onClick={() => sendMessage('Hello world!')}>Send</button>
|
|
237
|
+
</div>
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Error handling
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
import {
|
|
246
|
+
Recursiv,
|
|
247
|
+
AuthenticationError, // 401 — missing or invalid API key
|
|
248
|
+
AuthorizationError, // 403 — API key lacks required scope
|
|
249
|
+
NotFoundError, // 404
|
|
250
|
+
ValidationError, // 400 — check error.details
|
|
251
|
+
RateLimitError, // 429 — includes retryAfter, upgradeUrl
|
|
252
|
+
ConflictError, // 409
|
|
253
|
+
} from '@recursiv/sdk'
|
|
254
|
+
|
|
255
|
+
try {
|
|
256
|
+
await r.projects.deploy('proj_1', { branch: 'main' })
|
|
257
|
+
} catch (err) {
|
|
258
|
+
if (err instanceof RateLimitError) {
|
|
259
|
+
console.log(`Retry after ${err.retryAfter}s`)
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Auto-retry is built in. 429 and 5xx responses retry with exponential backoff (configurable via `maxRetries`, default 2).
|
|
265
|
+
|
|
266
|
+
## Pagination
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
const page1 = await r.posts.list({ limit: 20 })
|
|
270
|
+
if (page1.meta.has_more) {
|
|
271
|
+
const page2 = await r.posts.list({ limit: 20, offset: 20 })
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Response shapes
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
{ data: T[], meta: { limit, offset, has_more } } // list
|
|
279
|
+
{ data: T } // single
|
|
280
|
+
{ data: { deleted: true } } // delete
|
|
281
|
+
{ data: { success: true } } // success
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Works everywhere
|
|
285
|
+
|
|
286
|
+
| Environment | Status | Notes |
|
|
287
|
+
|-------------|--------|-------|
|
|
288
|
+
| Node.js >= 18 | Full support | ESM only. Uses native fetch. |
|
|
289
|
+
| Next.js | Full support | Works in both server components and API routes |
|
|
290
|
+
| React (Vite, CRA) | Full support | Bundle-friendly, zero dependencies |
|
|
291
|
+
| React Native / Expo | Supported with caveats | `chatStream()` requires manual SSE handling. See [React Native guide](./docs/guide-react-native.md). |
|
|
292
|
+
| Deno | Full support | ESM native, fetch native |
|
|
293
|
+
| Bun | Full support | ESM native, fetch native |
|
|
294
|
+
| Browser (direct) | Full support | Uses native fetch. CORS must be configured for your domain. |
|
|
295
|
+
|
|
296
|
+
## AI assistant reference
|
|
297
|
+
|
|
298
|
+
This package includes [`llm.md`](./llm.md) — a complete reference designed for AI coding assistants (Claude, Cursor, Copilot). It covers all resources with decision rules, working examples, and known gotchas. Your AI assistant will read it automatically when it encounters this SDK.
|
|
299
|
+
|
|
300
|
+
## Types
|
|
301
|
+
|
|
302
|
+
All request and response types are exported:
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
import type {
|
|
306
|
+
Project, Deployment, DeployInput, ExecuteCodeInput,
|
|
307
|
+
Agent, StreamChunk, AgentChatInput,
|
|
308
|
+
Post, Community, Message, Conversation,
|
|
309
|
+
PaginatedResponse, SingleResponse,
|
|
310
|
+
} from '@recursiv/sdk'
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Guides
|
|
314
|
+
|
|
315
|
+
- [Build an AI-native app](./docs/guide-ai-app.md) — Database + agent + storage + auth
|
|
316
|
+
- [Build a social platform](./docs/guide-social.md) — Posts, communities, chat, profiles
|
|
317
|
+
- [Build a code playground](./docs/guide-vibe-coding.md) — Sandboxes, AI coding, deploy
|
|
318
|
+
- [Give an agent its own infrastructure](./docs/guide-autonomous-agent.md) — Database + memory + code execution
|
|
319
|
+
- [Mobile / React Native setup](./docs/guide-react-native.md) — Expo, streaming workarounds, auth flow
|
|
320
|
+
- [Error reference](./docs/errors.md) — Every error type, what causes it, how to fix it
|
|
321
|
+
|
|
322
|
+
## Links
|
|
323
|
+
|
|
324
|
+
- [npm](https://www.npmjs.com/package/@recursiv/sdk)
|
|
325
|
+
- [API Docs](https://docs.recursiv.io)
|
|
326
|
+
- [GitHub](https://github.com/recursivlabs/recursiv)
|
|
327
|
+
- [Website](https://recursiv.io)
|
|
328
|
+
|
|
329
|
+
## License
|
|
330
|
+
|
|
331
|
+
FSL-1.1-ALv2 — source-available, converts to Apache 2.0 after 2 years.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RecursivConfig } from './types.js';
|
|
2
|
+
export declare class HttpClient {
|
|
3
|
+
readonly apiKey: string;
|
|
4
|
+
private baseUrl;
|
|
5
|
+
readonly baseOrigin: string;
|
|
6
|
+
private timeout;
|
|
7
|
+
private maxRetries;
|
|
8
|
+
private anonymous;
|
|
9
|
+
constructor(config?: Partial<RecursivConfig>);
|
|
10
|
+
private fetchWithTimeout;
|
|
11
|
+
private fetchWithRetry;
|
|
12
|
+
buildUrl(path: string, params?: Record<string, unknown>): string;
|
|
13
|
+
private getAuthHeaders;
|
|
14
|
+
private handleResponse;
|
|
15
|
+
get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
|
|
16
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
17
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
18
|
+
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
19
|
+
delete<T>(path: string): Promise<T>;
|
|
20
|
+
fetchRaw(path: string, options: RequestInit): Promise<Response>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,YAAY,CAAC;AAa/D,qBAAa,UAAU;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAU;gBAEf,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;YA6B9B,gBAAgB;YAUhB,cAAc;IAsB5B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAYhE,OAAO,CAAC,cAAc;YAQR,cAAc;IA+CtB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IASlE,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAajD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAahD,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAalD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IASnC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;CAUtE"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { RecursivError, AuthenticationError, AuthorizationError, NotFoundError, ValidationError, RateLimitError, ConflictError, } from './errors.js';
|
|
2
|
+
const DEFAULT_BASE_URL = 'https://api.recursiv.io/api/v1';
|
|
3
|
+
export class HttpClient {
|
|
4
|
+
apiKey;
|
|
5
|
+
baseUrl;
|
|
6
|
+
baseOrigin;
|
|
7
|
+
timeout;
|
|
8
|
+
maxRetries;
|
|
9
|
+
anonymous;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
const apiKey = config?.apiKey ||
|
|
12
|
+
(typeof process !== 'undefined' ? process.env?.RECURSIV_API_KEY : undefined) ||
|
|
13
|
+
(typeof process !== 'undefined' ? process.env?.SOCIAL_DEV_API_KEY : undefined);
|
|
14
|
+
this.anonymous = config?.anonymous ?? false;
|
|
15
|
+
if (!apiKey && !this.anonymous) {
|
|
16
|
+
throw new RecursivError(0, {
|
|
17
|
+
type: 'config_error',
|
|
18
|
+
message: 'No API key found. Set RECURSIV_API_KEY environment variable or pass apiKey to constructor.',
|
|
19
|
+
code: 'missing_api_key',
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
this.apiKey = apiKey || '';
|
|
23
|
+
this.baseUrl = (config?.baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, '');
|
|
24
|
+
// Derive origin for auth endpoints (e.g., "http://localhost:3000/api/v1" → "http://localhost:3000")
|
|
25
|
+
try {
|
|
26
|
+
this.baseOrigin = new URL(this.baseUrl).origin;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
this.baseOrigin = this.baseUrl;
|
|
30
|
+
}
|
|
31
|
+
this.timeout = config?.timeout ?? 30000;
|
|
32
|
+
this.maxRetries = config?.maxRetries ?? 2;
|
|
33
|
+
}
|
|
34
|
+
async fetchWithTimeout(url, options) {
|
|
35
|
+
const controller = new AbortController();
|
|
36
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
37
|
+
try {
|
|
38
|
+
return await fetch(url, { ...options, signal: controller.signal });
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
clearTimeout(timer);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async fetchWithRetry(url, options) {
|
|
45
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
46
|
+
const response = await this.fetchWithTimeout(url, options);
|
|
47
|
+
if (response.status === 429 || response.status >= 500) {
|
|
48
|
+
if (attempt === this.maxRetries)
|
|
49
|
+
return response;
|
|
50
|
+
const retryAfter = response.headers.get('retry-after');
|
|
51
|
+
const delay = retryAfter
|
|
52
|
+
? parseInt(retryAfter, 10) * 1000
|
|
53
|
+
: Math.min(1000 * 2 ** attempt, 10000);
|
|
54
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
return response;
|
|
58
|
+
}
|
|
59
|
+
// Unreachable, but TypeScript wants it
|
|
60
|
+
throw new RecursivError(0, {
|
|
61
|
+
type: 'api_error',
|
|
62
|
+
message: 'Max retries exceeded',
|
|
63
|
+
code: 'max_retries',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
buildUrl(path, params) {
|
|
67
|
+
const url = new URL(`${this.baseUrl}${path}`);
|
|
68
|
+
if (params) {
|
|
69
|
+
for (const [key, value] of Object.entries(params)) {
|
|
70
|
+
if (value !== undefined && value !== null) {
|
|
71
|
+
url.searchParams.set(key, String(value));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return url.toString();
|
|
76
|
+
}
|
|
77
|
+
getAuthHeaders() {
|
|
78
|
+
const headers = { Accept: 'application/json' };
|
|
79
|
+
if (this.apiKey) {
|
|
80
|
+
headers.Authorization = `Bearer ${this.apiKey}`;
|
|
81
|
+
}
|
|
82
|
+
return headers;
|
|
83
|
+
}
|
|
84
|
+
async handleResponse(response) {
|
|
85
|
+
if (!response) {
|
|
86
|
+
throw new RecursivError(0, {
|
|
87
|
+
type: 'api_error',
|
|
88
|
+
message: 'No response received from server. The server may be unreachable.',
|
|
89
|
+
code: 'no_response',
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (response.ok) {
|
|
93
|
+
return response.json();
|
|
94
|
+
}
|
|
95
|
+
let body;
|
|
96
|
+
try {
|
|
97
|
+
body = await response.json();
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
throw new RecursivError(response.status, {
|
|
101
|
+
type: 'api_error',
|
|
102
|
+
message: `HTTP ${response.status}: ${response.statusText}`,
|
|
103
|
+
code: 'unknown_error',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// Handle both { error: { message, type, code } } (standard) and
|
|
107
|
+
// { error: "string" } (legacy dispatcher routes) response formats
|
|
108
|
+
const rawErr = body.error;
|
|
109
|
+
const err = typeof rawErr === 'string'
|
|
110
|
+
? { type: 'api_error', message: rawErr, code: 'unknown_error' }
|
|
111
|
+
: rawErr;
|
|
112
|
+
switch (response.status) {
|
|
113
|
+
case 400:
|
|
114
|
+
throw new ValidationError(err);
|
|
115
|
+
case 401:
|
|
116
|
+
throw new AuthenticationError(err);
|
|
117
|
+
case 403:
|
|
118
|
+
throw new AuthorizationError(err);
|
|
119
|
+
case 404:
|
|
120
|
+
throw new NotFoundError(err);
|
|
121
|
+
case 409:
|
|
122
|
+
throw new ConflictError(err);
|
|
123
|
+
case 429:
|
|
124
|
+
throw new RateLimitError(err);
|
|
125
|
+
default:
|
|
126
|
+
throw new RecursivError(response.status, err);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async get(path, params) {
|
|
130
|
+
const url = this.buildUrl(path, params);
|
|
131
|
+
const response = await this.fetchWithRetry(url, {
|
|
132
|
+
method: 'GET',
|
|
133
|
+
headers: this.getAuthHeaders(),
|
|
134
|
+
});
|
|
135
|
+
return this.handleResponse(response);
|
|
136
|
+
}
|
|
137
|
+
async post(path, body) {
|
|
138
|
+
const url = this.buildUrl(path);
|
|
139
|
+
const response = await this.fetchWithRetry(url, {
|
|
140
|
+
method: 'POST',
|
|
141
|
+
headers: {
|
|
142
|
+
...this.getAuthHeaders(),
|
|
143
|
+
'Content-Type': 'application/json',
|
|
144
|
+
},
|
|
145
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
146
|
+
});
|
|
147
|
+
return this.handleResponse(response);
|
|
148
|
+
}
|
|
149
|
+
async put(path, body) {
|
|
150
|
+
const url = this.buildUrl(path);
|
|
151
|
+
const response = await this.fetchWithRetry(url, {
|
|
152
|
+
method: 'PUT',
|
|
153
|
+
headers: {
|
|
154
|
+
...this.getAuthHeaders(),
|
|
155
|
+
'Content-Type': 'application/json',
|
|
156
|
+
},
|
|
157
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
158
|
+
});
|
|
159
|
+
return this.handleResponse(response);
|
|
160
|
+
}
|
|
161
|
+
async patch(path, body) {
|
|
162
|
+
const url = this.buildUrl(path);
|
|
163
|
+
const response = await this.fetchWithRetry(url, {
|
|
164
|
+
method: 'PATCH',
|
|
165
|
+
headers: {
|
|
166
|
+
...this.getAuthHeaders(),
|
|
167
|
+
'Content-Type': 'application/json',
|
|
168
|
+
},
|
|
169
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
170
|
+
});
|
|
171
|
+
return this.handleResponse(response);
|
|
172
|
+
}
|
|
173
|
+
async delete(path) {
|
|
174
|
+
const url = this.buildUrl(path);
|
|
175
|
+
const response = await this.fetchWithRetry(url, {
|
|
176
|
+
method: 'DELETE',
|
|
177
|
+
headers: this.getAuthHeaders(),
|
|
178
|
+
});
|
|
179
|
+
return this.handleResponse(response);
|
|
180
|
+
}
|
|
181
|
+
async fetchRaw(path, options) {
|
|
182
|
+
const url = this.buildUrl(path);
|
|
183
|
+
return this.fetchWithTimeout(url, {
|
|
184
|
+
...options,
|
|
185
|
+
headers: {
|
|
186
|
+
...this.getAuthHeaders(),
|
|
187
|
+
...options.headers,
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,MAAM,gBAAgB,GAAG,gCAAgC,CAAC;AAE1D,MAAM,OAAO,UAAU;IACZ,MAAM,CAAS;IAChB,OAAO,CAAS;IACf,UAAU,CAAS;IACpB,OAAO,CAAS;IAChB,UAAU,CAAS;IACnB,SAAS,CAAU;IAE3B,YAAY,MAAgC;QAC1C,MAAM,MAAM,GACV,MAAM,EAAE,MAAM;YACd,CAAC,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;YAC5E,CAAC,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAEjF,IAAI,CAAC,SAAS,GAAG,MAAM,EAAE,SAAS,IAAI,KAAK,CAAC;QAE5C,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,aAAa,CAAC,CAAC,EAAE;gBACzB,IAAI,EAAE,cAAc;gBACpB,OAAO,EACL,4FAA4F;gBAC9F,IAAI,EAAE,iBAAiB;aACxB,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;QAC3B,IAA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