@elevasis/sdk 0.5.12 → 0.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +144 -118
- package/dist/index.d.ts +19 -253
- package/dist/index.js +20 -9
- package/dist/templates.js +62 -59
- package/dist/types/worker/adapters/index.d.ts +0 -1
- package/dist/worker/index.js +47 -53
- package/package.json +1 -1
- package/reference/_navigation.md +13 -57
- package/reference/{cli/index.mdx → cli.mdx} +568 -505
- package/reference/concepts.mdx +164 -0
- package/reference/deployment/api.mdx +297 -297
- package/reference/deployment/command-center.mdx +226 -0
- package/reference/deployment/index.mdx +158 -153
- package/reference/framework/agent.mdx +156 -151
- package/reference/framework/index.mdx +182 -103
- package/reference/{developer → framework}/interaction-guidance.mdx +182 -182
- package/reference/framework/memory.mdx +326 -347
- package/reference/framework/project-structure.mdx +277 -298
- package/reference/framework/tutorial-system.mdx +222 -0
- package/reference/{getting-started/index.mdx → getting-started.mdx} +152 -148
- package/reference/index.mdx +131 -114
- package/reference/platform-tools/adapters.mdx +868 -929
- package/reference/platform-tools/index.mdx +354 -195
- package/reference/resources/index.mdx +339 -336
- package/reference/resources/patterns.mdx +355 -354
- package/reference/resources/types.mdx +207 -207
- package/reference/{roadmap/index.mdx → roadmap.mdx} +163 -147
- package/reference/{runtime/index.mdx → runtime.mdx} +173 -141
- package/reference/{troubleshooting/common-errors.mdx → troubleshooting.mdx} +223 -210
- package/dist/types/worker/adapters/trello.d.ts +0 -14
- package/reference/concepts/index.mdx +0 -203
- package/reference/deployment/command-center-ui.mdx +0 -151
- package/reference/deployment/command-view.mdx +0 -154
- package/reference/framework/documentation.mdx +0 -92
- package/reference/platform-tools/examples.mdx +0 -170
- package/reference/runtime/limits.mdx +0 -75
- package/reference/security/credentials.mdx +0 -141
|
@@ -1,195 +1,354 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Platform Tools
|
|
3
|
-
description: Access 70+ tools across integration adapters and platform services from your SDK workflows -- typed adapters
|
|
4
|
-
loadWhen: "Connecting to external services"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
Your SDK workflows have access to 70+ tools -- Gmail, Stripe, Google Sheets, PDF generation, human-in-the-loop approvals, storage, scheduling, and more. Credentials are managed server-side and never appear in your code.
|
|
8
|
-
|
|
9
|
-
**Typed adapters** are the recommended way to call tools. They provide full TypeScript autocomplete, compile-time method checking, and eliminate boilerplate. Use `platform.call()` only for tools that don't have an adapter yet.
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
**Preferred: Typed adapters** (available for all integration tools + key platform services)
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { createResendAdapter, scheduler, llm } from '@elevasis/sdk/worker'
|
|
17
|
-
|
|
18
|
-
// Integration tools: factory pattern (credential bound once)
|
|
19
|
-
const resend = createResendAdapter('my-resend')
|
|
20
|
-
await resend.sendEmail({ from: 'hi@app.com', to: 'user@example.com', subject: '...' })
|
|
21
|
-
|
|
22
|
-
// Platform services: singleton (no credential needed)
|
|
23
|
-
await scheduler.createSchedule({ ... })
|
|
24
|
-
const result = await llm.generate({ messages: [...] })
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Fallback: `platform.call()`** (for tools without typed adapters)
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
import { platform } from '@elevasis/sdk/worker'
|
|
31
|
-
|
|
32
|
-
const result = await platform.call({
|
|
33
|
-
tool: 'lead', // tool name
|
|
34
|
-
method: 'upsertDeal', // method exposed by that tool
|
|
35
|
-
params: { ... }, // method-specific parameters
|
|
36
|
-
})
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Both patterns return a Promise that resolves with the tool result or rejects with a `PlatformToolError` containing a message, error code, and a `retryable` flag.
|
|
40
|
-
|
|
41
|
-
## Integration Adapters
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
| Adapter
|
|
46
|
-
|
|
|
47
|
-
| Attio
|
|
48
|
-
| Google Sheets | 13 (read/write/filter/upsert) | OAuth2 / service account |
|
|
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
|
-
const
|
|
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
|
-
|
|
1
|
+
---
|
|
2
|
+
title: Platform Tools
|
|
3
|
+
description: Access 70+ tools across integration adapters and platform services from your SDK workflows -- typed adapters, credential security model, and working code examples
|
|
4
|
+
loadWhen: "Connecting to external services"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Your SDK workflows have access to 70+ tools -- Gmail, Stripe, Google Sheets, PDF generation, human-in-the-loop approvals, storage, scheduling, and more. Credentials are managed server-side and never appear in your code.
|
|
8
|
+
|
|
9
|
+
**Typed adapters** are the recommended way to call tools. They provide full TypeScript autocomplete, compile-time method checking, and eliminate boilerplate. Use `platform.call()` only for tools that don't have an adapter yet.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
**Preferred: Typed adapters** (available for all integration tools + key platform services)
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createResendAdapter, scheduler, llm } from '@elevasis/sdk/worker'
|
|
17
|
+
|
|
18
|
+
// Integration tools: factory pattern (credential bound once)
|
|
19
|
+
const resend = createResendAdapter('my-resend')
|
|
20
|
+
await resend.sendEmail({ from: 'hi@app.com', to: 'user@example.com', subject: '...' })
|
|
21
|
+
|
|
22
|
+
// Platform services: singleton (no credential needed)
|
|
23
|
+
await scheduler.createSchedule({ ... })
|
|
24
|
+
const result = await llm.generate({ messages: [...] })
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Fallback: `platform.call()`** (for tools without typed adapters)
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { platform } from '@elevasis/sdk/worker'
|
|
31
|
+
|
|
32
|
+
const result = await platform.call({
|
|
33
|
+
tool: 'lead', // tool name
|
|
34
|
+
method: 'upsertDeal', // method exposed by that tool
|
|
35
|
+
params: { ... }, // method-specific parameters
|
|
36
|
+
})
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Both patterns return a Promise that resolves with the tool result or rejects with a `PlatformToolError` containing a message, error code, and a `retryable` flag.
|
|
40
|
+
|
|
41
|
+
## Integration Adapters
|
|
42
|
+
|
|
43
|
+
Eleven integration adapters give you access to 55+ tool methods covering third-party APIs. Pass the `credential` field with the name of the stored credential for that service. Supabase is listed separately under [Database Access](#database-access) below.
|
|
44
|
+
|
|
45
|
+
| Adapter | Tools | Credential Shape |
|
|
46
|
+
| ------------- | ----------------------------- | ------------------------ |
|
|
47
|
+
| Attio | 12 (CRUD + schema + notes) | `{ apiKey }` |
|
|
48
|
+
| Google Sheets | 13 (read/write/filter/upsert) | OAuth2 / service account |
|
|
49
|
+
| Notion | 8 (pages + blocks) | `{ token }` |
|
|
50
|
+
| Stripe | 6 (payment links + checkout) | `{ secretKey }` |
|
|
51
|
+
| Instantly | 5 (email campaigns) | `{ apiKey }` |
|
|
52
|
+
| Gmail | 2 (send email) | OAuth2 / service account |
|
|
53
|
+
| Resend | 2 (send/get email) | `{ apiKey }` |
|
|
54
|
+
| SignatureAPI | 4 (envelopes) | `{ apiKey }` |
|
|
55
|
+
| Dropbox | 2 (upload/folder) | `{ accessToken }` |
|
|
56
|
+
| Apify | 1 (run actor) | `{ token }` |
|
|
57
|
+
| Mailso | 1 (verify email) | `{ apiKey }` |
|
|
58
|
+
|
|
59
|
+
## Credential Security
|
|
60
|
+
|
|
61
|
+
Integration credentials are never stored in `.env` and never available via `process.env` inside worker threads. Credentials live in the platform credential system (created via the command center UI or CLI) and are accessed through three controlled channels.
|
|
62
|
+
|
|
63
|
+
### Layer 1: Platform Tools (Default)
|
|
64
|
+
|
|
65
|
+
All platform tools resolve credentials server-side. The credential value never crosses the postMessage boundary into the worker.
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
// Credential 'my-gmail' is resolved server-side -- value never enters worker memory
|
|
69
|
+
const result = await platform.call({
|
|
70
|
+
tool: 'gmail',
|
|
71
|
+
method: 'sendEmail',
|
|
72
|
+
credential: 'my-gmail',
|
|
73
|
+
params: { to: '...', subject: '...', body: '...' },
|
|
74
|
+
})
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Layer 2: HTTP Platform Tool
|
|
78
|
+
|
|
79
|
+
For APIs without a dedicated adapter, use the `http` platform tool. Credentials are injected server-side before the outgoing request.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const result = await platform.call({
|
|
83
|
+
tool: 'http',
|
|
84
|
+
method: 'request',
|
|
85
|
+
credential: 'my-custom-api',
|
|
86
|
+
params: {
|
|
87
|
+
url: 'https://api.example.com/v1/data',
|
|
88
|
+
method: 'GET',
|
|
89
|
+
headers: { 'Content-Type': 'application/json' },
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Supported injection patterns:**
|
|
95
|
+
|
|
96
|
+
| Pattern | Credential Config | How Injected |
|
|
97
|
+
| --------------- | ---------------------------------------------------------------- | ---------------------------------------- |
|
|
98
|
+
| Bearer token | `{ type: 'bearer', token: 'sk_...' }` | `Authorization: Bearer sk_...` header |
|
|
99
|
+
| API key header | `{ type: 'api-key-header', header: 'X-API-Key', key: 'ak_...' }` | Custom header |
|
|
100
|
+
| Basic auth | `{ type: 'basic', username: '...', password: '...' }` | `Authorization: Basic base64(user:pass)` |
|
|
101
|
+
| Query parameter | `{ type: 'query-param', param: 'api_key', value: 'ak_...' }` | Appended to URL |
|
|
102
|
+
| Body field | `{ type: 'body-field', field: 'apiKey', value: 'ak_...' }` | Merged into JSON body |
|
|
103
|
+
| Custom header | `{ type: 'custom-header', header: 'X-Custom', value: '...' }` | Arbitrary header |
|
|
104
|
+
|
|
105
|
+
### Layer 3: getCredential() (Explicit Opt-In)
|
|
106
|
+
|
|
107
|
+
For third-party SDKs that require a raw key (e.g., `new Stripe(key)`), use `platform.getCredential()`. This explicitly causes the credential value to enter worker memory.
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { platform } from '@elevasis/sdk/worker'
|
|
111
|
+
|
|
112
|
+
const cred = await platform.getCredential('my-stripe-key')
|
|
113
|
+
const stripe = new Stripe(cred.credentials.secretKey)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
All `getCredential()` calls are logged. Use `platform.call()` with the `http` tool when possible.
|
|
117
|
+
|
|
118
|
+
### Credential Setup
|
|
119
|
+
|
|
120
|
+
Credentials are created in the command center UI: navigate to Credentials → Add Credential → select type → enter values → save. The name you give the credential is what you pass as `credential: 'my-cred-name'` in `platform.call()`. Credential names are case-sensitive -- a mismatch causes `PlatformToolError: credential not found`.
|
|
121
|
+
|
|
122
|
+
### Choosing a Pattern
|
|
123
|
+
|
|
124
|
+
| Situation | Pattern |
|
|
125
|
+
| ------------------------------------------------------ | --------------------------------------- |
|
|
126
|
+
| Using a supported adapter (Gmail, Attio, Stripe, etc.) | `platform.call()` with the adapter tool |
|
|
127
|
+
| Calling an API not in the catalog | `platform.call()` with `tool: 'http'` |
|
|
128
|
+
| Third-party SDK that requires a raw key | `platform.getCredential()` |
|
|
129
|
+
|
|
130
|
+
`.env` contains only `ELEVASIS_PLATFORM_KEY` for CLI authentication -- never integration credentials.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Platform Services
|
|
135
|
+
|
|
136
|
+
Nine built-in platform services are available without a `credential` field. All have typed singleton adapters imported from `@elevasis/sdk/worker`.
|
|
137
|
+
|
|
138
|
+
| Tool Key | Methods | Purpose |
|
|
139
|
+
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
140
|
+
| `lead` | 35 methods (CRUD + sync) | Lead management -- `lead` singleton adapter |
|
|
141
|
+
| `email` | `send` | Send platform email to org members -- `email` singleton adapter |
|
|
142
|
+
| `storage` | `upload`, `download`, `createSignedUrl`, `delete`, `list` | File storage -- `storage` singleton adapter |
|
|
143
|
+
| `pdf` | `render`, `renderToBuffer` | PDF rendering -- `pdf` singleton adapter |
|
|
144
|
+
| `notification` | `create` | In-app notifications -- `notifications` singleton adapter |
|
|
145
|
+
| `approval` | `create`, `deleteByMetadata` | HITL approval gates -- `approval` singleton adapter |
|
|
146
|
+
| `scheduler` | `createSchedule`, `updateAnchor`, `deleteSchedule`, `findByIdempotencyKey`, `deleteScheduleByIdempotencyKey`, `listSchedules`, `getSchedule`, `cancelSchedule`, `cancelSchedulesByMetadata` | Task scheduling -- `scheduler` singleton adapter |
|
|
147
|
+
| `llm` | `generate` | LLM inference -- `llm` singleton adapter |
|
|
148
|
+
| `execution` | `trigger` | Nested child execution -- `execution` singleton adapter |
|
|
149
|
+
|
|
150
|
+
## LLM Tool
|
|
151
|
+
|
|
152
|
+
Call any supported LLM from your workflow with no API keys required. Keys are resolved server-side from environment variables.
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
import { llm } from '@elevasis/sdk/worker'
|
|
156
|
+
|
|
157
|
+
const result = await llm.generate({
|
|
158
|
+
provider: 'google',
|
|
159
|
+
model: 'gemini-3-flash-preview',
|
|
160
|
+
messages: [
|
|
161
|
+
{ role: 'system', content: 'Classify this email reply.' },
|
|
162
|
+
{ role: 'user', content: emailText }
|
|
163
|
+
],
|
|
164
|
+
responseSchema: {
|
|
165
|
+
type: 'object',
|
|
166
|
+
properties: {
|
|
167
|
+
category: { type: 'string', enum: ['interested', 'not-interested', 'bounced'] },
|
|
168
|
+
confidence: { type: 'number', minimum: 0, maximum: 1 }
|
|
169
|
+
},
|
|
170
|
+
required: ['category', 'confidence']
|
|
171
|
+
},
|
|
172
|
+
temperature: 0.2
|
|
173
|
+
})
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Supported models:**
|
|
177
|
+
|
|
178
|
+
| Provider | Models |
|
|
179
|
+
| ------------ | -------------------------------------------------------------------------------------------------------------- |
|
|
180
|
+
| `google` | `gemini-3-flash-preview` |
|
|
181
|
+
| `openai` | `gpt-5`, `gpt-5-mini` |
|
|
182
|
+
| `anthropic` | `claude-opus-4-5`, `claude-sonnet-4-5`, `claude-haiku-4-5` |
|
|
183
|
+
| `openrouter` | `openrouter/anthropic/claude-sonnet-4.5`, `openrouter/deepseek/deepseek-v3.2`, `openrouter/x-ai/grok-4.1-fast` |
|
|
184
|
+
|
|
185
|
+
**Key params:** `provider`, `model`, `messages` (`{ role, content }[]`), `responseSchema` (optional JSON Schema), `temperature` (optional).
|
|
186
|
+
|
|
187
|
+
## Execution Tool
|
|
188
|
+
|
|
189
|
+
Trigger another resource as a nested child of the current execution. The child runs synchronously and its result is returned. Maximum depth: 5 levels.
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
import { execution } from '@elevasis/sdk/worker'
|
|
193
|
+
|
|
194
|
+
const result = await execution.trigger({
|
|
195
|
+
resourceId: 'my-other-workflow',
|
|
196
|
+
input: { key: 'value' },
|
|
197
|
+
})
|
|
198
|
+
// result = { success: true, executionId: '...', output: { ... }, error: undefined }
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The invoked resource must belong to the same organization.
|
|
202
|
+
|
|
203
|
+
## Database Access
|
|
204
|
+
|
|
205
|
+
Supabase is a first-class integration adapter for persistent storage. Pass the `credential` field with your stored Supabase credential name.
|
|
206
|
+
|
|
207
|
+
**Methods:** `insert`, `select`, `update`, `delete`, `upsert`, `rpc`, `count`
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
const qualified = await platform.call({
|
|
211
|
+
tool: 'supabase',
|
|
212
|
+
credential: 'my-database',
|
|
213
|
+
method: 'select',
|
|
214
|
+
params: {
|
|
215
|
+
table: 'leads',
|
|
216
|
+
filter: { status: 'eq.qualified', score: 'gte.80' },
|
|
217
|
+
order: { column: 'score', ascending: false },
|
|
218
|
+
limit: 50,
|
|
219
|
+
},
|
|
220
|
+
})
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**Filter syntax** uses PostgREST format (`operator.value`):
|
|
224
|
+
|
|
225
|
+
| Filter | Example | Meaning |
|
|
226
|
+
| ------------------------ | ---------------------------------- | ------------- |
|
|
227
|
+
| `eq` | `{ status: 'eq.qualified' }` | Equals |
|
|
228
|
+
| `neq` | `{ status: 'neq.lost' }` | Not equals |
|
|
229
|
+
| `gt`, `gte`, `lt`, `lte` | `{ score: 'gte.80' }` | Comparisons |
|
|
230
|
+
| `like`, `ilike` | `{ name: 'ilike.%jane%' }` | Pattern match |
|
|
231
|
+
| `in` | `{ status: 'in.(new,contacted)' }` | In set |
|
|
232
|
+
| `is` | `{ deleted_at: 'is.null' }` | Null check |
|
|
233
|
+
|
|
234
|
+
**Credential setup:** Create a credential with provider `supabase` — config fields are `url` and `serviceRoleKey`. Workflows always use the service role key (server-side, no RLS).
|
|
235
|
+
|
|
236
|
+
**`/database init`:** Guided setup that stores your Supabase credential, generates `data/schema.ts`, and creates `docs/database.mdx`.
|
|
237
|
+
|
|
238
|
+
**`data/schema.ts`:** An agent-readable Zod schema documenting your table structure. Not deployed or executed — the agent reads it to understand your data model.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Code Examples
|
|
243
|
+
|
|
244
|
+
### Email via Resend
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
import { createResendAdapter } from '@elevasis/sdk/worker'
|
|
248
|
+
|
|
249
|
+
const resend = createResendAdapter('resend')
|
|
250
|
+
await resend.sendEmail({
|
|
251
|
+
from: 'hello@yourapp.com',
|
|
252
|
+
to: 'customer@example.com',
|
|
253
|
+
subject: 'Your order is confirmed',
|
|
254
|
+
html: '\<p\>Thank you for your order!\</p\>',
|
|
255
|
+
})
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### CRM Record via Attio
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
import { createAttioAdapter } from '@elevasis/sdk/worker'
|
|
262
|
+
|
|
263
|
+
const attio = createAttioAdapter('attio')
|
|
264
|
+
const result = await attio.createRecord({
|
|
265
|
+
object: 'people',
|
|
266
|
+
values: {
|
|
267
|
+
name: [{ full_name: 'Jane Smith' }],
|
|
268
|
+
email_addresses: [{ email_address: 'jane@example.com' }],
|
|
269
|
+
},
|
|
270
|
+
})
|
|
271
|
+
const recordId = result.data.id
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### PDF Generation
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
import { pdf, storage } from '@elevasis/sdk/worker'
|
|
278
|
+
|
|
279
|
+
// Render to storage directly
|
|
280
|
+
const result = await pdf.render({
|
|
281
|
+
document: proposalDocument,
|
|
282
|
+
storage: { bucket: 'invoices', path: 'invoice-1042.pdf' },
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
// Or render to buffer for inline processing
|
|
286
|
+
const { buffer } = await pdf.renderToBuffer({ document: proposalDocument })
|
|
287
|
+
await storage.upload({ bucket: 'invoices', path: 'invoice-1042.pdf', content: buffer, contentType: 'application/pdf' })
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### LLM with Structured Output
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
import { llm } from '@elevasis/sdk/worker'
|
|
294
|
+
|
|
295
|
+
interface TicketClassification {
|
|
296
|
+
priority: 'low' | 'medium' | 'high' | 'critical'
|
|
297
|
+
category: 'billing' | 'technical' | 'account' | 'other'
|
|
298
|
+
summary: string
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const response = await llm.generate\<TicketClassification\>({
|
|
302
|
+
provider: 'anthropic',
|
|
303
|
+
model: 'claude-sonnet-4-5',
|
|
304
|
+
messages: [
|
|
305
|
+
{ role: 'system', content: 'Extract structured data from support tickets.' },
|
|
306
|
+
{ role: 'user', content: ticketText },
|
|
307
|
+
],
|
|
308
|
+
responseSchema: {
|
|
309
|
+
type: 'object',
|
|
310
|
+
properties: {
|
|
311
|
+
priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
|
|
312
|
+
category: { type: 'string', enum: ['billing', 'technical', 'account', 'other'] },
|
|
313
|
+
summary: { type: 'string' },
|
|
314
|
+
},
|
|
315
|
+
required: ['priority', 'category', 'summary'],
|
|
316
|
+
},
|
|
317
|
+
temperature: 0.1,
|
|
318
|
+
})
|
|
319
|
+
const { priority, category, summary } = response.output
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Triggering Another Resource
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
import { execution } from '@elevasis/sdk/worker'
|
|
326
|
+
|
|
327
|
+
const outcome = await execution.trigger({
|
|
328
|
+
resourceId: 'send-welcome-sequence',
|
|
329
|
+
input: { userId: newUser.id, email: newUser.email, plan: 'pro' },
|
|
330
|
+
})
|
|
331
|
+
if (!outcome.success) throw new Error(`Child workflow failed: ${outcome.error}`)
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### File Storage
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
import { storage } from '@elevasis/sdk/worker'
|
|
338
|
+
|
|
339
|
+
const reportPath = `exports/report-${Date.now()}.csv`
|
|
340
|
+
await storage.upload({ bucket: 'exports', path: reportPath, content: csvContent, contentType: 'text/csv' })
|
|
341
|
+
|
|
342
|
+
const { signedUrl } = await storage.createSignedUrl({ bucket: 'exports', path: reportPath })
|
|
343
|
+
// signedUrl is valid for 1 hour (3600 seconds) -- share with user or include in email
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Documentation
|
|
349
|
+
|
|
350
|
+
- [Typed Adapters](adapters.mdx) - Type-safe wrappers for all 11 integrations + 9 platform services with full autocomplete (recommended)
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
**Last Updated:** 2026-03-06
|