@superblocksteam/sdk-api 2.0.105 → 2.0.106-next.1

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.
Files changed (182) hide show
  1. package/README.md +439 -89
  2. package/dist/api/definition.d.ts +11 -6
  3. package/dist/api/definition.d.ts.map +1 -1
  4. package/dist/api/definition.js +19 -12
  5. package/dist/api/definition.js.map +1 -1
  6. package/dist/api/definition.test.js +39 -15
  7. package/dist/api/definition.test.js.map +1 -1
  8. package/dist/errors.d.ts +1 -1
  9. package/dist/errors.js +1 -1
  10. package/dist/index.d.ts +10 -11
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +9 -5
  13. package/dist/index.js.map +1 -1
  14. package/dist/integrations/base/index.d.ts +2 -1
  15. package/dist/integrations/base/index.d.ts.map +1 -1
  16. package/dist/integrations/base/index.js +1 -0
  17. package/dist/integrations/base/index.js.map +1 -1
  18. package/dist/integrations/base/rest-api-client-base.d.ts +48 -0
  19. package/dist/integrations/base/rest-api-client-base.d.ts.map +1 -0
  20. package/dist/integrations/base/rest-api-client-base.js +98 -0
  21. package/dist/integrations/base/rest-api-client-base.js.map +1 -0
  22. package/dist/integrations/base/rest-api-integration-client.d.ts +10 -20
  23. package/dist/integrations/base/rest-api-integration-client.d.ts.map +1 -1
  24. package/dist/integrations/base/rest-api-integration-client.js +10 -65
  25. package/dist/integrations/base/rest-api-integration-client.js.map +1 -1
  26. package/dist/integrations/box/types.d.ts +1 -1
  27. package/dist/integrations/declarations.d.ts +5 -73
  28. package/dist/integrations/declarations.d.ts.map +1 -1
  29. package/dist/integrations/declarations.js +5 -68
  30. package/dist/integrations/declarations.js.map +1 -1
  31. package/dist/integrations/documentation.test.js +0 -2
  32. package/dist/integrations/documentation.test.js.map +1 -1
  33. package/dist/integrations/googledrive/types.d.ts +1 -1
  34. package/dist/integrations/index.d.ts +1 -11
  35. package/dist/integrations/index.d.ts.map +1 -1
  36. package/dist/integrations/index.js +1 -7
  37. package/dist/integrations/index.js.map +1 -1
  38. package/dist/integrations/registry.d.ts +1 -11
  39. package/dist/integrations/registry.d.ts.map +1 -1
  40. package/dist/integrations/registry.js +0 -29
  41. package/dist/integrations/registry.js.map +1 -1
  42. package/dist/integrations/slack/client.d.ts +13 -9
  43. package/dist/integrations/slack/client.d.ts.map +1 -1
  44. package/dist/integrations/slack/client.js +60 -8
  45. package/dist/integrations/slack/client.js.map +1 -1
  46. package/dist/integrations/slack/client.test.d.ts +11 -0
  47. package/dist/integrations/slack/client.test.d.ts.map +1 -0
  48. package/dist/integrations/slack/client.test.js +368 -0
  49. package/dist/integrations/slack/client.test.js.map +1 -0
  50. package/dist/integrations/slack/index.d.ts +2 -1
  51. package/dist/integrations/slack/index.d.ts.map +1 -1
  52. package/dist/integrations/slack/index.js +1 -0
  53. package/dist/integrations/slack/index.js.map +1 -1
  54. package/dist/integrations/slack/types.d.ts +127 -28
  55. package/dist/integrations/slack/types.d.ts.map +1 -1
  56. package/dist/integrations/slack/types.js +27 -1
  57. package/dist/integrations/slack/types.js.map +1 -1
  58. package/dist/integrations/snowflake/client.d.ts +2 -2
  59. package/dist/integrations/snowflake/client.js +2 -2
  60. package/dist/runtime/context.d.ts +1 -1
  61. package/dist/runtime/executor.d.ts +2 -2
  62. package/dist/types.d.ts +15 -6
  63. package/dist/types.d.ts.map +1 -1
  64. package/package.json +2 -2
  65. package/src/api/definition.test.ts +40 -15
  66. package/src/api/definition.ts +19 -12
  67. package/src/errors.ts +1 -1
  68. package/src/index.ts +13 -33
  69. package/src/integrations/asana/README.md +12 -12
  70. package/src/integrations/base/index.ts +2 -1
  71. package/src/integrations/base/rest-api-client-base.ts +134 -0
  72. package/src/integrations/base/rest-api-integration-client.ts +12 -89
  73. package/src/integrations/bitbucket/README.md +19 -19
  74. package/src/integrations/box/README.md +24 -24
  75. package/src/integrations/box/types.ts +1 -1
  76. package/src/integrations/circleci/README.md +18 -18
  77. package/src/integrations/declarations.ts +5 -105
  78. package/src/integrations/documentation.test.ts +0 -2
  79. package/src/integrations/googledrive/README.md +25 -22
  80. package/src/integrations/googledrive/types.ts +1 -1
  81. package/src/integrations/graphql/README.md +2 -2
  82. package/src/integrations/groq/README.md +8 -8
  83. package/src/integrations/index.ts +0 -51
  84. package/src/integrations/mongodb/README.md +65 -12
  85. package/src/integrations/perplexity/README.md +39 -48
  86. package/src/integrations/registry.ts +1 -39
  87. package/src/integrations/salesforce/README.md +11 -9
  88. package/src/integrations/slack/README.md +62 -19
  89. package/src/integrations/slack/client.test.ts +553 -0
  90. package/src/integrations/slack/client.ts +92 -12
  91. package/src/integrations/slack/index.ts +6 -1
  92. package/src/integrations/slack/types.ts +142 -29
  93. package/src/integrations/snowflake/client.ts +2 -2
  94. package/src/integrations/zoom/README.md +15 -15
  95. package/src/runtime/context.ts +1 -1
  96. package/src/runtime/executor.ts +2 -2
  97. package/src/types.ts +15 -6
  98. package/dist/integrations/couchbase/client.d.ts +0 -36
  99. package/dist/integrations/couchbase/client.d.ts.map +0 -1
  100. package/dist/integrations/couchbase/client.js +0 -148
  101. package/dist/integrations/couchbase/client.js.map +0 -1
  102. package/dist/integrations/couchbase/index.d.ts +0 -8
  103. package/dist/integrations/couchbase/index.d.ts.map +0 -1
  104. package/dist/integrations/couchbase/index.js +0 -7
  105. package/dist/integrations/couchbase/index.js.map +0 -1
  106. package/dist/integrations/couchbase/types.d.ts +0 -100
  107. package/dist/integrations/couchbase/types.d.ts.map +0 -1
  108. package/dist/integrations/couchbase/types.js +0 -5
  109. package/dist/integrations/couchbase/types.js.map +0 -1
  110. package/dist/integrations/kafka/client.d.ts +0 -25
  111. package/dist/integrations/kafka/client.d.ts.map +0 -1
  112. package/dist/integrations/kafka/client.js +0 -124
  113. package/dist/integrations/kafka/client.js.map +0 -1
  114. package/dist/integrations/kafka/index.d.ts +0 -8
  115. package/dist/integrations/kafka/index.d.ts.map +0 -1
  116. package/dist/integrations/kafka/index.js +0 -7
  117. package/dist/integrations/kafka/index.js.map +0 -1
  118. package/dist/integrations/kafka/types.d.ts +0 -113
  119. package/dist/integrations/kafka/types.d.ts.map +0 -1
  120. package/dist/integrations/kafka/types.js +0 -5
  121. package/dist/integrations/kafka/types.js.map +0 -1
  122. package/dist/integrations/kinesis/client.d.ts +0 -31
  123. package/dist/integrations/kinesis/client.d.ts.map +0 -1
  124. package/dist/integrations/kinesis/client.js +0 -101
  125. package/dist/integrations/kinesis/client.js.map +0 -1
  126. package/dist/integrations/kinesis/index.d.ts +0 -8
  127. package/dist/integrations/kinesis/index.d.ts.map +0 -1
  128. package/dist/integrations/kinesis/index.js +0 -7
  129. package/dist/integrations/kinesis/index.js.map +0 -1
  130. package/dist/integrations/kinesis/types.d.ts +0 -97
  131. package/dist/integrations/kinesis/types.d.ts.map +0 -1
  132. package/dist/integrations/kinesis/types.js +0 -7
  133. package/dist/integrations/kinesis/types.js.map +0 -1
  134. package/dist/integrations/python/client.d.ts +0 -42
  135. package/dist/integrations/python/client.d.ts.map +0 -1
  136. package/dist/integrations/python/client.js +0 -89
  137. package/dist/integrations/python/client.js.map +0 -1
  138. package/dist/integrations/python/client.test.d.ts +0 -5
  139. package/dist/integrations/python/client.test.d.ts.map +0 -1
  140. package/dist/integrations/python/client.test.js +0 -214
  141. package/dist/integrations/python/client.test.js.map +0 -1
  142. package/dist/integrations/python/index.d.ts +0 -6
  143. package/dist/integrations/python/index.d.ts.map +0 -1
  144. package/dist/integrations/python/index.js +0 -5
  145. package/dist/integrations/python/index.js.map +0 -1
  146. package/dist/integrations/python/types.d.ts +0 -85
  147. package/dist/integrations/python/types.d.ts.map +0 -1
  148. package/dist/integrations/python/types.js +0 -5
  149. package/dist/integrations/python/types.js.map +0 -1
  150. package/dist/integrations/redis/client.d.ts +0 -43
  151. package/dist/integrations/redis/client.d.ts.map +0 -1
  152. package/dist/integrations/redis/client.js +0 -142
  153. package/dist/integrations/redis/client.js.map +0 -1
  154. package/dist/integrations/redis/index.d.ts +0 -8
  155. package/dist/integrations/redis/index.d.ts.map +0 -1
  156. package/dist/integrations/redis/index.js +0 -7
  157. package/dist/integrations/redis/index.js.map +0 -1
  158. package/dist/integrations/redis/types.d.ts +0 -137
  159. package/dist/integrations/redis/types.d.ts.map +0 -1
  160. package/dist/integrations/redis/types.js +0 -5
  161. package/dist/integrations/redis/types.js.map +0 -1
  162. package/src/integrations/couchbase/README.md +0 -138
  163. package/src/integrations/couchbase/client.ts +0 -225
  164. package/src/integrations/couchbase/index.ts +0 -8
  165. package/src/integrations/couchbase/types.ts +0 -126
  166. package/src/integrations/kafka/README.md +0 -144
  167. package/src/integrations/kafka/client.ts +0 -216
  168. package/src/integrations/kafka/index.ts +0 -14
  169. package/src/integrations/kafka/types.ts +0 -128
  170. package/src/integrations/kinesis/README.md +0 -153
  171. package/src/integrations/kinesis/client.ts +0 -146
  172. package/src/integrations/kinesis/index.ts +0 -14
  173. package/src/integrations/kinesis/types.ts +0 -114
  174. package/src/integrations/python/README.md +0 -566
  175. package/src/integrations/python/client.test.ts +0 -341
  176. package/src/integrations/python/client.ts +0 -136
  177. package/src/integrations/python/index.ts +0 -6
  178. package/src/integrations/python/types.ts +0 -92
  179. package/src/integrations/redis/README.md +0 -200
  180. package/src/integrations/redis/client.ts +0 -208
  181. package/src/integrations/redis/index.ts +0 -8
  182. package/src/integrations/redis/types.ts +0 -167
@@ -79,16 +79,21 @@ const UserSchema = z
79
79
  name: z.string(),
80
80
  email: z.string(),
81
81
  })
82
- .nullable();
82
+ .nullable()
83
+ .optional();
83
84
 
84
85
  const user = await ctx.integrations.mongodb.run(
85
86
  "users",
86
87
  "findOne",
87
88
  UserSchema,
88
89
  {
89
- query: { _id: userId },
90
+ query: { _id: { $oid: userId } },
90
91
  },
91
92
  );
93
+
94
+ // findOne returns undefined (not null) when no document matches,
95
+ // so use .nullable().optional() and coalesce if needed:
96
+ const result = user ?? null;
92
97
  ```
93
98
 
94
99
  ### Insert Document
@@ -116,8 +121,8 @@ const result = await ctx.integrations.mongodb.run(
116
121
 
117
122
  ```typescript
118
123
  const UpdateResultSchema = z.object({
119
- matchedCount: z.number(),
120
- modifiedCount: z.number(),
124
+ matchedCount: z.coerce.number(),
125
+ modifiedCount: z.coerce.number(),
121
126
  });
122
127
 
123
128
  const result = await ctx.integrations.mongodb.run(
@@ -125,7 +130,7 @@ const result = await ctx.integrations.mongodb.run(
125
130
  "updateOne",
126
131
  UpdateResultSchema,
127
132
  {
128
- filter: { _id: userId },
133
+ filter: { _id: { $oid: userId } },
129
134
  update: {
130
135
  $set: { status: "active", updatedAt: new Date().toISOString() },
131
136
  },
@@ -137,7 +142,7 @@ const result = await ctx.integrations.mongodb.run(
137
142
 
138
143
  ```typescript
139
144
  const DeleteResultSchema = z.object({
140
- deletedCount: z.number(),
145
+ deletedCount: z.coerce.number(),
141
146
  });
142
147
 
143
148
  const result = await ctx.integrations.mongodb.run(
@@ -145,7 +150,7 @@ const result = await ctx.integrations.mongodb.run(
145
150
  "deleteOne",
146
151
  DeleteResultSchema,
147
152
  {
148
- filter: { _id: userId },
153
+ filter: { _id: { $oid: userId } },
149
154
  },
150
155
  );
151
156
  ```
@@ -156,8 +161,8 @@ const result = await ctx.integrations.mongodb.run(
156
161
  const AggregateResultSchema = z.array(
157
162
  z.object({
158
163
  _id: z.string(),
159
- count: z.number(),
160
- totalAmount: z.number(),
164
+ count: z.coerce.number(),
165
+ totalAmount: z.coerce.number(),
161
166
  }),
162
167
  );
163
168
 
@@ -183,9 +188,14 @@ const result = await ctx.integrations.mongodb.run(
183
188
  ### Count Documents
184
189
 
185
190
  ```typescript
186
- const count = await ctx.integrations.mongodb.run("users", "count", z.number(), {
187
- query: { status: "active" },
188
- });
191
+ const count = await ctx.integrations.mongodb.run(
192
+ "users",
193
+ "count",
194
+ z.coerce.number(),
195
+ {
196
+ query: { status: "active" },
197
+ },
198
+ );
189
199
  ```
190
200
 
191
201
  ### Find with Projection and Sort
@@ -245,6 +255,49 @@ try {
245
255
  }
246
256
  ```
247
257
 
258
+ ## Gotchas
259
+
260
+ ### Numeric fields are returned as strings
261
+
262
+ MongoDB numeric values (e.g. `int32`, `int64`, `double`) are returned as strings by the integration. Using `z.number()` in your schema will fail with `"Expected number, received string"`. Use `z.coerce.number()` instead to automatically convert string values to numbers:
263
+
264
+ ```typescript
265
+ // ❌ Will fail — MongoDB returns numbers as strings
266
+ const Schema = z.object({ rating: z.number() });
267
+
268
+ // ✅ Correct — coerces string values to numbers
269
+ const Schema = z.object({ rating: z.coerce.number() });
270
+ ```
271
+
272
+ ### ObjectId fields require `$oid` syntax
273
+
274
+ When querying by `_id` or any ObjectId field, passing a plain string does not match. You must wrap the value using MongoDB Extended JSON `$oid` syntax:
275
+
276
+ ```typescript
277
+ // ❌ Will not match — returns null/undefined
278
+ const bad = { query: { _id: userId } };
279
+
280
+ // ✅ Correct — uses Extended JSON $oid wrapper
281
+ const good = { query: { _id: { $oid: userId } } };
282
+ ```
283
+
284
+ This applies to `findOne`, `updateOne`, `deleteOne`, and any operation filtering by ObjectId fields.
285
+
286
+ ### `findOne` returns `undefined` when no document matches
287
+
288
+ When no document is found, `findOne` returns `undefined` rather than `null`. If your schema uses only `.nullable()`, Zod will reject `undefined` with `"Expected object, received undefined"`. Use `.nullable().optional()` to handle both cases:
289
+
290
+ ```typescript
291
+ // ❌ Will fail when no document matches
292
+ const Schema = z.object({ name: z.string() }).nullable();
293
+
294
+ // ✅ Correct — handles both null and undefined
295
+ const Schema = z.object({ name: z.string() }).nullable().optional();
296
+
297
+ // Coalesce to null if needed
298
+ const result = (await ctx.integrations.mongodb.run(...)) ?? null;
299
+ ```
300
+
248
301
  ## API Reference
249
302
 
250
303
  - [MongoDB Manual](https://www.mongodb.com/docs/manual/)
@@ -58,7 +58,7 @@ export default api({
58
58
  method: "POST",
59
59
  path: "/chat/completions",
60
60
  body: {
61
- model: "llama-3.1-sonar-large-128k-online",
61
+ model: "sonar-pro",
62
62
  messages: [
63
63
  {
64
64
  role: "system",
@@ -82,40 +82,40 @@ export default api({
82
82
  ### Using Different Models
83
83
 
84
84
  ```typescript
85
- // Online models - With real-time search
86
- const onlineResult = await ctx.integrations.perplexity.apiRequest(
85
+ // Standard search model - Fast, lightweight
86
+ const result = await ctx.integrations.perplexity.apiRequest(
87
87
  {
88
88
  method: "POST",
89
89
  path: "/chat/completions",
90
90
  body: {
91
- model: "llama-3.1-sonar-large-128k-online", // Real-time search
91
+ model: "sonar", // Fast search
92
92
  messages: [{ role: "user", content: "What's the latest news about AI?" }],
93
93
  },
94
94
  },
95
95
  { response: ChatCompletionResponseSchema },
96
96
  );
97
97
 
98
- // Chat models - Without search, faster
99
- const chatResult = await ctx.integrations.perplexity.apiRequest(
98
+ // Pro search model - Deeper content understanding
99
+ const proResult = await ctx.integrations.perplexity.apiRequest(
100
100
  {
101
101
  method: "POST",
102
102
  path: "/chat/completions",
103
103
  body: {
104
- model: "llama-3.1-sonar-large-128k-chat", // No search
104
+ model: "sonar-pro", // Advanced search
105
105
  messages: [{ role: "user", content: "Explain quantum computing" }],
106
106
  },
107
107
  },
108
108
  { response: ChatCompletionResponseSchema },
109
109
  );
110
110
 
111
- // Small models - Faster, lower cost
112
- const smallResult = await ctx.integrations.perplexity.apiRequest(
111
+ // Reasoning model - Multi-step Chain-of-Thought
112
+ const reasoningResult = await ctx.integrations.perplexity.apiRequest(
113
113
  {
114
114
  method: "POST",
115
115
  path: "/chat/completions",
116
116
  body: {
117
- model: "llama-3.1-sonar-small-128k-online",
118
- messages: [{ role: "user", content: "Quick fact check..." }],
117
+ model: "sonar-reasoning-pro",
118
+ messages: [{ role: "user", content: "Analyze the pros and cons of..." }],
119
119
  },
120
120
  },
121
121
  { response: ChatCompletionResponseSchema },
@@ -130,7 +130,7 @@ const result = await ctx.integrations.perplexity.apiRequest(
130
130
  method: "POST",
131
131
  path: "/chat/completions",
132
132
  body: {
133
- model: "llama-3.1-sonar-large-128k-online",
133
+ model: "sonar-pro",
134
134
  messages: [
135
135
  {
136
136
  role: "user",
@@ -152,7 +152,7 @@ const result = await ctx.integrations.perplexity.apiRequest(
152
152
  method: "POST",
153
153
  path: "/chat/completions",
154
154
  body: {
155
- model: "llama-3.1-sonar-large-128k-online",
155
+ model: "sonar-pro",
156
156
  messages: [
157
157
  { role: "user", content: "Recent developments in electric vehicles" },
158
158
  ],
@@ -171,7 +171,7 @@ const result = await ctx.integrations.perplexity.apiRequest(
171
171
  method: "POST",
172
172
  path: "/chat/completions",
173
173
  body: {
174
- model: "llama-3.1-sonar-large-128k-online",
174
+ model: "sonar",
175
175
  messages: [
176
176
  { role: "user", content: "What is the capital of France?" },
177
177
  { role: "assistant", content: "The capital of France is Paris." },
@@ -203,16 +203,22 @@ await ctx.integrations.perplexity.apiRequest(
203
203
  );
204
204
  ```
205
205
 
206
- ### Online vs Chat Models
206
+ ### Model Selection
207
207
 
208
- Online models perform real-time search, chat models don't:
208
+ Choose the right model for your use case:
209
209
 
210
210
  ```typescript
211
- // For questions requiring current information
212
- const model = "llama-3.1-sonar-large-128k-online";
211
+ // For quick answers with web search
212
+ const model = "sonar";
213
+
214
+ // For complex queries requiring deeper understanding
215
+ const model = "sonar-pro";
213
216
 
214
- // For general knowledge (faster, no search)
215
- const model = "llama-3.1-sonar-large-128k-chat";
217
+ // For multi-step reasoning tasks
218
+ const model = "sonar-reasoning-pro";
219
+
220
+ // For in-depth research
221
+ const model = "sonar-deep-research";
216
222
  ```
217
223
 
218
224
  ### Citations May Be Empty
@@ -229,47 +235,32 @@ if (sources.length === 0) {
229
235
  }
230
236
  ```
231
237
 
232
- ### Model Naming Convention
238
+ ### Available Models
233
239
 
234
- Perplexity models follow a specific naming pattern. Note that available models change over time — check the [Perplexity model cards](https://docs.perplexity.ai/docs/model-cards) for current options:
240
+ Perplexity offers the following Sonar models. Check the [Perplexity models page](https://docs.perplexity.ai/docs/sonar/models) for the latest options:
235
241
 
236
242
  ```typescript
237
- // Pattern: llama-3.1-sonar-{size}-{context}-{type}
238
- // These are examples — verify current model names in the Perplexity docs
239
243
  const models = [
240
- "llama-3.1-sonar-small-128k-online", // Small, online search
241
- "llama-3.1-sonar-small-128k-chat", // Small, no search
242
- "llama-3.1-sonar-large-128k-online", // Large, online search
243
- "llama-3.1-sonar-large-128k-chat", // Large, no search
244
+ "sonar", // Fast, lightweight search
245
+ "sonar-pro", // Advanced search with deeper understanding
246
+ "sonar-reasoning-pro", // Multi-step Chain-of-Thought reasoning
247
+ "sonar-deep-research", // In-depth research for complex queries
244
248
  ];
245
249
  ```
246
250
 
247
- ### Search Parameters Only Work with Online Models
251
+ ### Search Parameters
248
252
 
249
- ```typescript
250
- // WRONG - search_domain_filter with chat model
251
- await ctx.integrations.perplexity.apiRequest(
252
- {
253
- method: "POST",
254
- path: "/chat/completions",
255
- body: {
256
- model: "llama-3.1-sonar-large-128k-chat", // Chat model
257
- messages: [...],
258
- search_domain_filter: ["example.com"], // Ignored!
259
- },
260
- },
261
- { response: schema }
262
- );
253
+ All Sonar models support search by default. You can use search filters to refine results:
263
254
 
264
- // CORRECT - search_domain_filter with online model
255
+ ```typescript
265
256
  await ctx.integrations.perplexity.apiRequest(
266
257
  {
267
258
  method: "POST",
268
259
  path: "/chat/completions",
269
260
  body: {
270
- model: "llama-3.1-sonar-large-128k-online", // Online model
261
+ model: "sonar-pro",
271
262
  messages: [...],
272
- search_domain_filter: ["example.com"], // Works!
263
+ search_domain_filter: ["example.com"], // Limit search to specific domains
273
264
  },
274
265
  },
275
266
  { response: schema }
@@ -296,5 +287,5 @@ try {
296
287
  ## API Reference
297
288
 
298
289
  - [Perplexity API Documentation](https://docs.perplexity.ai/)
299
- - [Chat Completions](https://docs.perplexity.ai/reference/post_chat_completions)
300
- - [Models](https://docs.perplexity.ai/docs/model-cards)
290
+ - [Sonar API](https://docs.perplexity.ai/api-reference/sonar-post)
291
+ - [Models](https://docs.perplexity.ai/docs/sonar/models)
@@ -57,15 +57,11 @@ import { OracleDBClientImpl } from "./oracledb/index.js";
57
57
  import { RedshiftClientImpl } from "./redshift/index.js";
58
58
  // REST API clients
59
59
  import { CosmosDBClientImpl } from "./cosmosdb/index.js";
60
- import { CouchbaseClientImpl } from "./couchbase/index.js";
61
60
  import { DynamoDBClientImpl } from "./dynamodb/index.js";
62
61
  import { GCSClientImpl } from "./gcs/index.js";
63
62
  import { GoogleSheetsClientImpl } from "./gsheets/index.js";
64
- import { KafkaClientImpl } from "./kafka/index.js";
65
- import { KinesisClientImpl } from "./kinesis/index.js";
66
63
  import { LakebaseClientImpl } from "./lakebase/index.js";
67
64
  import { MongoDBClientImpl } from "./mongodb/index.js";
68
- import { RedisClientImpl } from "./redis/index.js";
69
65
  import { S3ClientImpl } from "./s3/index.js";
70
66
  import { SalesforceClientImpl } from "./salesforce/index.js";
71
67
  import { SmtpClientImpl } from "./smtp/index.js";
@@ -73,8 +69,6 @@ import { SnowflakePostgresClientImpl } from "./snowflakepostgres/index.js";
73
69
  import { SuperblocksOCRClientImpl } from "./superblocks-ocr/index.js";
74
70
  // REST API plugins
75
71
  import { RestApiIntegrationPluginClientImpl } from "./restapiintegration/index.js";
76
- // Code execution clients
77
- import { PythonClientImpl } from "./python/index.js";
78
72
 
79
73
  /**
80
74
  * Supported plugin IDs mapped to their client constructors.
@@ -133,18 +127,11 @@ export const SUPPORTED_PLUGINS = {
133
127
  mongodb: "mongodb",
134
128
  dynamodb: "dynamodb",
135
129
  cosmosdb: "cosmosdb",
136
- couchbase: "couchbase",
137
130
  s3: "s3",
138
131
  gcs: "gcs",
139
132
  gsheets: "gsheets",
140
- kafka: "kafka",
141
- kinesis: "kinesis",
142
133
  salesforce: "salesforce",
143
- redis: "redis",
144
134
  "superblocks-ocr": "superblocks-ocr",
145
- // Kafka-compatible streaming
146
- confluent: "confluent",
147
- redpanda: "redpanda",
148
135
  // SQL databases (continued)
149
136
  lakebase: "lakebase",
150
137
  snowflakepostgres: "snowflakepostgres",
@@ -152,8 +139,6 @@ export const SUPPORTED_PLUGINS = {
152
139
  smtp: "smtp",
153
140
  // REST API plugins
154
141
  restapiintegration: "restapiintegration",
155
- // Code execution
156
- python: "python",
157
142
  } as const;
158
143
 
159
144
  export type SupportedPluginId =
@@ -183,11 +168,8 @@ export interface TraceMetadata {
183
168
  * Accepts a plugin request object that matches the protobuf Plugin definition
184
169
  * for the specific integration type (e.g., postgresql.v1.Plugin, restapi.v1.Plugin).
185
170
  *
186
- * For language plugins (Python, JavaScript), the bindings parameter should be passed
187
- * to the API execution request as `input` or `inputs` field for binding resolution.
188
- *
189
171
  * @param request - Plugin-specific request object matching the proto schema
190
- * @param bindings - Optional bindings data for binding resolution (e.g., Python/JavaScript bindings)
172
+ * @param bindings - Optional bindings data for binding resolution
191
173
  * @param metadata - Optional trace metadata (label, description) for diagnostics
192
174
  * @returns Promise resolving to the operation result
193
175
  */
@@ -392,9 +374,6 @@ export function createClient(
392
374
  case SUPPORTED_PLUGINS.cosmosdb:
393
375
  return new CosmosDBClientImpl(config, executeQuery);
394
376
 
395
- case SUPPORTED_PLUGINS.couchbase:
396
- return new CouchbaseClientImpl(config, executeQuery);
397
-
398
377
  case SUPPORTED_PLUGINS.s3:
399
378
  return new S3ClientImpl(config, executeQuery);
400
379
 
@@ -404,26 +383,12 @@ export function createClient(
404
383
  case SUPPORTED_PLUGINS.gsheets:
405
384
  return new GoogleSheetsClientImpl(config, executeQuery);
406
385
 
407
- case SUPPORTED_PLUGINS.kafka:
408
- return new KafkaClientImpl(config, executeQuery);
409
-
410
- case SUPPORTED_PLUGINS.kinesis:
411
- return new KinesisClientImpl(config, executeQuery);
412
-
413
386
  case SUPPORTED_PLUGINS.salesforce:
414
387
  return new SalesforceClientImpl(config, executeQuery);
415
388
 
416
- case SUPPORTED_PLUGINS.redis:
417
- return new RedisClientImpl(config, executeQuery);
418
-
419
389
  case SUPPORTED_PLUGINS["superblocks-ocr"]:
420
390
  return new SuperblocksOCRClientImpl(config, executeQuery);
421
391
 
422
- // Confluent and Redpanda use the same Kafka plugin proto
423
- case SUPPORTED_PLUGINS.confluent:
424
- case SUPPORTED_PLUGINS.redpanda:
425
- return new KafkaClientImpl(config, executeQuery);
426
-
427
392
  case SUPPORTED_PLUGINS.lakebase:
428
393
  return new LakebaseClientImpl(config, executeQuery);
429
394
 
@@ -436,9 +401,6 @@ export function createClient(
436
401
  case SUPPORTED_PLUGINS.restapiintegration:
437
402
  return new RestApiIntegrationPluginClientImpl(config, executeQuery);
438
403
 
439
- case SUPPORTED_PLUGINS.python:
440
- return new PythonClientImpl(config, executeQuery);
441
-
442
404
  default:
443
405
  throw new Error(
444
406
  `Unsupported plugin: ${config.pluginId}. ` +
@@ -77,7 +77,7 @@ const opportunities = await ctx.integrations.salesforce.query(
77
77
  ### Create a Record
78
78
 
79
79
  ```typescript
80
- await salesforce.create("Account", {
80
+ await ctx.integrations.salesforce.create("Account", {
81
81
  Name: "Acme Corp",
82
82
  Industry: "Technology",
83
83
  Website: "https://acme.example.com",
@@ -87,7 +87,7 @@ await salesforce.create("Account", {
87
87
  ### Read a Record by ID
88
88
 
89
89
  ```typescript
90
- const account = await salesforce.read(
90
+ const account = await ctx.integrations.salesforce.read(
91
91
  "Account",
92
92
  "001xx000003DGb2AAG",
93
93
  z.object({
@@ -101,7 +101,7 @@ const account = await salesforce.read(
101
101
  ### Update a Record
102
102
 
103
103
  ```typescript
104
- await salesforce.update("Account", "001xx000003DGb2AAG", {
104
+ await ctx.integrations.salesforce.update("Account", "001xx000003DGb2AAG", {
105
105
  Name: "Acme Corp (Updated)",
106
106
  Industry: "Software",
107
107
  });
@@ -116,7 +116,7 @@ await ctx.integrations.salesforce.remove("Account", "001xx000003DGb2AAG");
116
116
  ### Bulk Create
117
117
 
118
118
  ```typescript
119
- await salesforce.bulkCreate("Contact", [
119
+ await ctx.integrations.salesforce.bulkCreate("Contact", [
120
120
  { FirstName: "Alice", LastName: "Smith", Email: "alice@example.com" },
121
121
  { FirstName: "Bob", LastName: "Jones", Email: "bob@example.com" },
122
122
  { FirstName: "Charlie", LastName: "Lee", Email: "charlie@example.com" },
@@ -126,7 +126,7 @@ await salesforce.bulkCreate("Contact", [
126
126
  ### Bulk Update
127
127
 
128
128
  ```typescript
129
- await salesforce.bulkUpdate("Contact", [
129
+ await ctx.integrations.salesforce.bulkUpdate("Contact", [
130
130
  { Id: "003xx000004TmiQAAS", Email: "alice-new@example.com" },
131
131
  { Id: "003xx000004TmiRAAS", Email: "bob-new@example.com" },
132
132
  ]);
@@ -135,7 +135,7 @@ await salesforce.bulkUpdate("Contact", [
135
135
  ### Bulk Delete
136
136
 
137
137
  ```typescript
138
- await salesforce.bulkDelete("Contact", [
138
+ await ctx.integrations.salesforce.bulkDelete("Contact", [
139
139
  { Id: "003xx000004TmiQAAS" },
140
140
  { Id: "003xx000004TmiRAAS" },
141
141
  ]);
@@ -144,7 +144,7 @@ await salesforce.bulkDelete("Contact", [
144
144
  ### Bulk Upsert
145
145
 
146
146
  ```typescript
147
- await salesforce.bulkUpsert(
147
+ await ctx.integrations.salesforce.bulkUpsert(
148
148
  "Account",
149
149
  [
150
150
  { ExternalId__c: "EXT-001", Name: "Acme Corp", Industry: "Tech" },
@@ -198,12 +198,14 @@ Bulk update and delete records must include the `Id` field:
198
198
 
199
199
  ```typescript
200
200
  // CORRECT
201
- await salesforce.bulkUpdate("Contact", [
201
+ await ctx.integrations.salesforce.bulkUpdate("Contact", [
202
202
  { Id: "003xx000004TmiQAAS", Email: "new@example.com" },
203
203
  ]);
204
204
 
205
205
  // WRONG - Missing Id field
206
- await salesforce.bulkUpdate("Contact", [{ Email: "new@example.com" }]);
206
+ await ctx.integrations.salesforce.bulkUpdate("Contact", [
207
+ { Email: "new@example.com" },
208
+ ]);
207
209
  ```
208
210
 
209
211
  ## Error Handling
@@ -16,7 +16,6 @@ Send messages, manage channels, and interact with Slack workspaces.
16
16
  import { api, z, slack } from "@superblocksteam/sdk-api";
17
17
 
18
18
  const PostMessageResponseSchema = z.object({
19
- ok: z.boolean(),
20
19
  channel: z.string(),
21
20
  ts: z.string(), // Message timestamp (unique ID)
22
21
  message: z.object({
@@ -55,6 +54,10 @@ export default api({
55
54
  { response: PostMessageResponseSchema },
56
55
  );
57
56
 
57
+ if (!result.ok) {
58
+ throw new Error(`Slack API error: ${result.error}`);
59
+ }
60
+
58
61
  return { messageId: result.ts };
59
62
  },
60
63
  });
@@ -106,7 +109,6 @@ const result = await ctx.integrations.slack.apiRequest(
106
109
 
107
110
  ```typescript
108
111
  const ListChannelsResponseSchema = z.object({
109
- ok: z.boolean(),
110
112
  channels: z.array(
111
113
  z.object({
112
114
  id: z.string(),
@@ -135,6 +137,10 @@ const result = await ctx.integrations.slack.apiRequest(
135
137
  { response: ListChannelsResponseSchema },
136
138
  );
137
139
 
140
+ if (!result.ok) {
141
+ throw new Error(`Slack API error: ${result.error}`);
142
+ }
143
+
138
144
  result.channels.forEach((channel) => {
139
145
  console.log(`#${channel.name} (${channel.id})`);
140
146
  });
@@ -144,7 +150,6 @@ result.channels.forEach((channel) => {
144
150
 
145
151
  ```typescript
146
152
  const UserInfoResponseSchema = z.object({
147
- ok: z.boolean(),
148
153
  user: z.object({
149
154
  id: z.string(),
150
155
  name: z.string(),
@@ -167,6 +172,10 @@ const result = await ctx.integrations.slack.apiRequest(
167
172
  { response: UserInfoResponseSchema },
168
173
  );
169
174
 
175
+ if (!result.ok) {
176
+ throw new Error(`Slack API error: ${result.error}`);
177
+ }
178
+
170
179
  console.log(`User: ${result.user.real_name} (${result.user.profile.email})`);
171
180
  ```
172
181
 
@@ -174,7 +183,6 @@ console.log(`User: ${result.user.real_name} (${result.user.profile.email})`);
174
183
 
175
184
  ```typescript
176
185
  const FileUploadResponseSchema = z.object({
177
- ok: z.boolean(),
178
186
  file: z.object({
179
187
  id: z.string(),
180
188
  name: z.string(),
@@ -197,6 +205,10 @@ const result = await ctx.integrations.slack.apiRequest(
197
205
  { response: FileUploadResponseSchema },
198
206
  );
199
207
 
208
+ if (!result.ok) {
209
+ throw new Error(`Slack API error: ${result.error}`);
210
+ }
211
+
200
212
  console.log(`File uploaded: ${result.file.permalink}`);
201
213
  ```
202
214
 
@@ -221,7 +233,6 @@ const result = await ctx.integrations.slack.apiRequest(
221
233
 
222
234
  ```typescript
223
235
  const UpdateMessageResponseSchema = z.object({
224
- ok: z.boolean(),
225
236
  channel: z.string(),
226
237
  ts: z.string(),
227
238
  text: z.string(),
@@ -333,6 +344,10 @@ async function getAllChannels(slack: SlackClient) {
333
344
  { response: ListChannelsResponseSchema },
334
345
  );
335
346
 
347
+ if (!result.ok) {
348
+ throw new Error(`Slack API error: ${result.error}`);
349
+ }
350
+
336
351
  allChannels.push(...result.channels);
337
352
  cursor = result.response_metadata?.next_cursor;
338
353
  } while (cursor);
@@ -371,30 +386,58 @@ Code block
371
386
 
372
387
  ## Error Handling
373
388
 
389
+ Slack returns API errors as HTTP 200 with `{ ok: false, error: "error_code" }` instead of HTTP error status codes. The SDK surfaces these as the `SlackErrorResponse` branch of a discriminated union (`SlackResponse<T>`) — no exceptions, just check `result.ok`:
390
+
374
391
  ```typescript
375
- import { RestApiValidationError } from "@superblocksteam/sdk-api";
392
+ import type { SlackResponse } from "@superblocksteam/sdk-api";
393
+
394
+ const result = await ctx.integrations.slack.apiRequest(
395
+ { method: "POST", path: "/chat.postMessage", body: { channel, text } },
396
+ { response: PostMessageResponseSchema },
397
+ );
376
398
 
377
- try {
378
- const result = await ctx.integrations.slack.apiRequest(
379
- { method: "POST", path: "/chat.postMessage", body: { ... } },
380
- { response: PostMessageResponseSchema }
381
- );
399
+ if (!result.ok) {
400
+ // TypeScript narrows to SlackErrorResponse
401
+ console.error(`Slack error: ${result.error}`);
402
+ // e.g. "missing_scope", "channel_not_found", "not_authed"
382
403
 
383
- // Slack returns ok: false for API errors (not HTTP errors)
384
- if (!result.ok) {
385
- console.error("Slack API error");
386
- }
387
- } catch (error) {
388
- if (error instanceof RestApiValidationError) {
389
- console.error("Validation failed:", error.details.zodError);
404
+ if (result.needed) {
405
+ console.error(`Required scopes: ${result.needed}`);
406
+ // e.g. "chat:write"
390
407
  }
408
+ return;
391
409
  }
410
+
411
+ // TypeScript narrows to T & { ok: true } — all success fields accessible
412
+ console.log(`Sent message: ${result.ts}`);
392
413
  ```
393
414
 
415
+ ### SlackResponse\<T\>
416
+
417
+ Every `apiRequest` call returns `SlackResponse<T>`, a discriminated union:
418
+
419
+ | Branch | Shape | When |
420
+ | ------- | -------------------- | -------------------------------------------------------------------------- |
421
+ | Success | `T & { ok: true }` | Slack returned `ok: true`; response validated against your Zod schema |
422
+ | Error | `SlackErrorResponse` | Slack returned `ok: false`; contains `error`, optional `needed`/`provided` |
423
+
424
+ `T` is your payload schema output. Define payload fields only (do not include `ok` in your response schema) and the SDK injects `ok: true` for the discriminant on success.
425
+
426
+ **`SlackErrorResponse` fields:**
427
+
428
+ | Field | Type | Description |
429
+ | ---------- | --------- | ------------------------------------------------------------ |
430
+ | `ok` | `false` | Discriminant |
431
+ | `error` | `string` | Slack error code (e.g. `missing_scope`, `channel_not_found`) |
432
+ | `needed` | `string?` | Required OAuth scopes (present on `missing_scope` errors) |
433
+ | `provided` | `string?` | Current token scopes (present on `missing_scope` errors) |
434
+
435
+ Schema validation errors (Zod mismatch on a _success_ response) still throw `RestApiValidationError`. Body validation errors also throw. Only Slack's own `ok: false` errors are returned as values.
436
+
394
437
  ## API Reference
395
438
 
396
439
  - [Slack API Documentation](https://api.slack.com/methods)
397
440
  - [chat.postMessage](https://api.slack.com/methods/chat.postMessage)
398
441
  - [conversations.list](https://api.slack.com/methods/conversations.list)
399
- - [Block Kit Builder](https://app.slack.com/block-kit-builder)
400
442
  - [OAuth Scopes](https://api.slack.com/scopes)
443
+ - [Block Kit Builder](https://app.slack.com/block-kit-builder)