exponential-sdk 1.0.0 → 1.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/README.md +179 -0
- package/dist/index.d.ts +1125 -1
- package/dist/index.js +261 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Exponential SDK
|
|
2
|
+
|
|
3
|
+
The official TypeScript SDK for [Exponential](https://exponential.im) — the AI-powered alignment layer where your goals, your team, and your AI stay in sync.
|
|
4
|
+
|
|
5
|
+
Build integrations that connect daily work to meaningful outcomes. Manage workspaces, projects, and actions programmatically.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install exponential-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { ExponentialClient, saveConfig, loadConfig } from "exponential-sdk";
|
|
17
|
+
|
|
18
|
+
// Persist your credentials
|
|
19
|
+
saveConfig({
|
|
20
|
+
apiUrl: "https://exponential.im",
|
|
21
|
+
token: "your-bearer-token",
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Initialize the client
|
|
25
|
+
const config = loadConfig();
|
|
26
|
+
const client = new ExponentialClient({
|
|
27
|
+
token: config.token,
|
|
28
|
+
apiUrl: config.apiUrl,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// List your workspaces
|
|
32
|
+
const workspaces = await client.workspaces.list();
|
|
33
|
+
|
|
34
|
+
// Get today's actions
|
|
35
|
+
const today = await client.actions.getToday(workspaces[0].id);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## API Reference
|
|
39
|
+
|
|
40
|
+
### `ExponentialClient`
|
|
41
|
+
|
|
42
|
+
Create a client with your API token:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
const client = new ExponentialClient({
|
|
46
|
+
token: "your-bearer-token",
|
|
47
|
+
apiUrl: "https://exponential.im",
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### Workspaces
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
const workspaces = await client.workspaces.list();
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Returns all workspaces you have access to.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
### Projects
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// List all projects
|
|
67
|
+
const projects = await client.projects.list();
|
|
68
|
+
|
|
69
|
+
// Filter by workspace
|
|
70
|
+
const projects = await client.projects.list({
|
|
71
|
+
workspaceId: "ws-123",
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Include nested actions
|
|
75
|
+
const projects = await client.projects.list({
|
|
76
|
+
workspaceId: "ws-123",
|
|
77
|
+
includeActions: true,
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### Actions
|
|
84
|
+
|
|
85
|
+
Actions are the core work items in Exponential — tasks connected to outcomes that move the needle.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// List active actions (excludes DONE & CANCELLED by default)
|
|
89
|
+
const actions = await client.actions.list();
|
|
90
|
+
|
|
91
|
+
// Filter by status, project, or assignee
|
|
92
|
+
const actions = await client.actions.list({
|
|
93
|
+
status: "IN_PROGRESS",
|
|
94
|
+
projectId: "proj-123",
|
|
95
|
+
assigneeId: "user-456",
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Get today's actions for a workspace
|
|
99
|
+
const today = await client.actions.getToday("ws-123");
|
|
100
|
+
|
|
101
|
+
// Get actions within a date range
|
|
102
|
+
const upcoming = await client.actions.getByDateRange(
|
|
103
|
+
new Date("2025-01-01"),
|
|
104
|
+
new Date("2025-01-31"),
|
|
105
|
+
"ws-123"
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// Get actions by kanban status
|
|
109
|
+
const todo = await client.actions.getKanban({ status: "TODO" });
|
|
110
|
+
|
|
111
|
+
// Get all actions for a project
|
|
112
|
+
const projectActions = await client.actions.getProjectActions("proj-123");
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### Kanban Statuses
|
|
116
|
+
|
|
117
|
+
`BACKLOG` · `TODO` · `IN_PROGRESS` · `IN_REVIEW` · `DONE` · `CANCELLED`
|
|
118
|
+
|
|
119
|
+
#### Priorities
|
|
120
|
+
|
|
121
|
+
`Quick` · `Scheduled` · `1st Priority` · `2nd Priority` · `3rd Priority` · `4th Priority` · `5th Priority` · `Errand` · `Remember` · `Watch` · `Someday Maybe`
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### Configuration
|
|
126
|
+
|
|
127
|
+
Credentials are stored persistently using the OS keychain via [`conf`](https://github.com/sindresorhus/conf).
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import {
|
|
131
|
+
saveConfig,
|
|
132
|
+
loadConfig,
|
|
133
|
+
clearConfig,
|
|
134
|
+
isAuthenticated,
|
|
135
|
+
getConfigPath,
|
|
136
|
+
} from "exponential-sdk";
|
|
137
|
+
|
|
138
|
+
saveConfig({
|
|
139
|
+
apiUrl: "https://exponential.im",
|
|
140
|
+
token: "your-bearer-token",
|
|
141
|
+
defaultWorkspaceId: "ws-123",
|
|
142
|
+
defaultWorkspaceSlug: "my-team",
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
if (isAuthenticated()) {
|
|
146
|
+
const config = loadConfig();
|
|
147
|
+
console.log(config.token);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// For multi-project setups, create isolated config stores
|
|
151
|
+
import { createConfigStore } from "exponential-sdk";
|
|
152
|
+
|
|
153
|
+
const store = createConfigStore({ projectName: "my-app" });
|
|
154
|
+
store.saveConfig({ apiUrl: "...", token: "..." });
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### Error Handling
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
import { isTRPCError } from "exponential-sdk";
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
const actions = await client.actions.list();
|
|
166
|
+
} catch (error) {
|
|
167
|
+
if (isTRPCError(error)) {
|
|
168
|
+
console.error("API error:", error.message);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Requirements
|
|
174
|
+
|
|
175
|
+
- Node.js >= 18.0.0
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT
|