@superblocksteam/sdk-api 2.0.103 → 2.0.104-next.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 +58 -299
- package/dist/api/definition.js +1 -1
- package/dist/api/definition.js.map +1 -1
- package/dist/api/index.d.ts +0 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +0 -2
- package/dist/api/index.js.map +1 -1
- package/dist/errors.d.ts +0 -44
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +0 -32
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -9
- package/dist/index.js.map +1 -1
- package/dist/integrations/anthropic/types.d.ts +3 -22
- package/dist/integrations/anthropic/types.d.ts.map +1 -1
- package/dist/integrations/base/index.d.ts +1 -1
- package/dist/integrations/base/index.d.ts.map +1 -1
- package/dist/integrations/base/rest-api-integration-client.d.ts +4 -48
- package/dist/integrations/base/rest-api-integration-client.d.ts.map +1 -1
- package/dist/integrations/base/rest-api-integration-client.js +2 -110
- package/dist/integrations/base/rest-api-integration-client.js.map +1 -1
- package/dist/integrations/base/types.d.ts +1 -67
- package/dist/integrations/base/types.d.ts.map +1 -1
- package/dist/integrations/index.d.ts +1 -1
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/openai_v2/types.d.ts +4 -22
- package/dist/integrations/openai_v2/types.d.ts.map +1 -1
- package/dist/integrations/registry.d.ts +0 -16
- package/dist/integrations/registry.d.ts.map +1 -1
- package/dist/integrations/registry.js +38 -38
- package/dist/integrations/registry.js.map +1 -1
- package/dist/integrations/registry.test.js +1 -3
- package/dist/integrations/registry.test.js.map +1 -1
- package/dist/integrations/restapiintegration/types.d.ts +2 -2
- package/dist/integrations/restapiintegration/types.d.ts.map +1 -1
- package/dist/integrations/snowflakecortex/client.d.ts +1 -2
- package/dist/integrations/snowflakecortex/client.d.ts.map +1 -1
- package/dist/integrations/snowflakecortex/client.js +1 -2
- package/dist/integrations/snowflakecortex/client.js.map +1 -1
- package/dist/integrations/snowflakecortex/types.d.ts +3 -4
- package/dist/integrations/snowflakecortex/types.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +0 -3
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -6
- package/dist/runtime/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/definition.ts +1 -1
- package/src/api/index.ts +0 -4
- package/src/errors.ts +0 -48
- package/src/index.ts +2 -28
- package/src/integrations/anthropic/README.md +5 -101
- package/src/integrations/anthropic/types.ts +3 -29
- package/src/integrations/base/index.ts +0 -2
- package/src/integrations/base/rest-api-integration-client.ts +4 -153
- package/src/integrations/base/types.ts +3 -74
- package/src/integrations/cohere/README.md +11 -11
- package/src/integrations/fireworks/README.md +43 -17
- package/src/integrations/googleanalytics/README.md +2 -2
- package/src/integrations/googledrive/README.md +2 -2
- package/src/integrations/groq/README.md +41 -34
- package/src/integrations/gsheets/README.md +2 -2
- package/src/integrations/index.ts +0 -1
- package/src/integrations/launchdarkly/README.md +2 -2
- package/src/integrations/mistral/README.md +39 -13
- package/src/integrations/openai_v2/README.md +44 -116
- package/src/integrations/openai_v2/types.ts +4 -29
- package/src/integrations/pagerduty/README.md +2 -2
- package/src/integrations/perplexity/README.md +2 -1
- package/src/integrations/registry.test.ts +1 -3
- package/src/integrations/registry.ts +38 -127
- package/src/integrations/restapiintegration/README.md +4 -43
- package/src/integrations/restapiintegration/types.ts +2 -8
- package/src/integrations/sendgrid/README.md +2 -2
- package/src/integrations/snowflakecortex/README.md +4 -53
- package/src/integrations/snowflakecortex/client.ts +2 -3
- package/src/integrations/snowflakecortex/types.ts +3 -11
- package/src/integrations/stabilityai/README.md +2 -2
- package/src/runtime/index.ts +1 -23
- package/dist/api/streaming.d.ts +0 -229
- package/dist/api/streaming.d.ts.map +0 -1
- package/dist/api/streaming.js +0 -107
- package/dist/api/streaming.js.map +0 -1
- package/dist/api/streaming.test.d.ts +0 -5
- package/dist/api/streaming.test.d.ts.map +0 -1
- package/dist/api/streaming.test.js +0 -364
- package/dist/api/streaming.test.js.map +0 -1
- package/dist/runtime/execute.d.ts +0 -128
- package/dist/runtime/execute.d.ts.map +0 -1
- package/dist/runtime/execute.js +0 -84
- package/dist/runtime/execute.js.map +0 -1
- package/dist/runtime/streaming-context.d.ts +0 -49
- package/dist/runtime/streaming-context.d.ts.map +0 -1
- package/dist/runtime/streaming-context.js +0 -71
- package/dist/runtime/streaming-context.js.map +0 -1
- package/dist/runtime/streaming-executor.d.ts +0 -159
- package/dist/runtime/streaming-executor.d.ts.map +0 -1
- package/dist/runtime/streaming-executor.js +0 -229
- package/dist/runtime/streaming-executor.js.map +0 -1
- package/src/api/streaming.test.ts +0 -433
- package/src/api/streaming.ts +0 -303
- package/src/runtime/execute.ts +0 -221
- package/src/runtime/streaming-context.ts +0 -164
- package/src/runtime/streaming-executor.ts +0 -367
|
@@ -13,7 +13,7 @@ Create incidents, manage services, and interact with PagerDuty's incident manage
|
|
|
13
13
|
### Create an Incident
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import { api, z,
|
|
16
|
+
import { api, z, pagerDuty } from "@superblocksteam/sdk-api";
|
|
17
17
|
|
|
18
18
|
// Integration ID from the integrations panel
|
|
19
19
|
const PROD_PAGERDUTY = "a1b2c3d4-5678-90ab-cdef-pagerdu00001";
|
|
@@ -52,7 +52,7 @@ const CreateIncidentResponseSchema = z.object({
|
|
|
52
52
|
|
|
53
53
|
export default api({
|
|
54
54
|
integrations: {
|
|
55
|
-
pagerduty:
|
|
55
|
+
pagerduty: pagerDuty(PROD_PAGERDUTY),
|
|
56
56
|
},
|
|
57
57
|
name: "PagerDutyExample",
|
|
58
58
|
input: z.object({
|
|
@@ -231,10 +231,11 @@ if (sources.length === 0) {
|
|
|
231
231
|
|
|
232
232
|
### Model Naming Convention
|
|
233
233
|
|
|
234
|
-
Perplexity models follow a specific naming pattern:
|
|
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:
|
|
235
235
|
|
|
236
236
|
```typescript
|
|
237
237
|
// Pattern: llama-3.1-sonar-{size}-{context}-{type}
|
|
238
|
+
// These are examples — verify current model names in the Perplexity docs
|
|
238
239
|
const models = [
|
|
239
240
|
"llama-3.1-sonar-small-128k-online", // Small, online search
|
|
240
241
|
"llama-3.1-sonar-small-128k-chat", // Small, no search
|
|
@@ -13,9 +13,8 @@ describe("integration registry", () => {
|
|
|
13
13
|
expect(isPluginSupported(SUPPORTED_PLUGINS.snowflakecortex)).toBe(true);
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
it("creates a SnowflakeCortex client
|
|
16
|
+
it("creates a SnowflakeCortex client", () => {
|
|
17
17
|
const executeQuery = vi.fn();
|
|
18
|
-
const executeStreamingQuery = vi.fn();
|
|
19
18
|
|
|
20
19
|
const client = createClient({
|
|
21
20
|
config: {
|
|
@@ -25,7 +24,6 @@ describe("integration registry", () => {
|
|
|
25
24
|
configuration: {},
|
|
26
25
|
},
|
|
27
26
|
executeQuery,
|
|
28
|
-
executeStreamingQuery,
|
|
29
27
|
});
|
|
30
28
|
|
|
31
29
|
expect(client).toBeInstanceOf(SnowflakeCortexClientImpl);
|
|
@@ -197,21 +197,6 @@ export type QueryExecutor = (
|
|
|
197
197
|
metadata?: TraceMetadata,
|
|
198
198
|
) => Promise<unknown>;
|
|
199
199
|
|
|
200
|
-
/**
|
|
201
|
-
* Type for the streaming query executor function provided by the orchestrator.
|
|
202
|
-
*
|
|
203
|
-
* Similar to QueryExecutor but returns an AsyncIterable for streaming responses.
|
|
204
|
-
* Used for streaming operations like LLM token streaming.
|
|
205
|
-
*
|
|
206
|
-
* @param request - Plugin-specific request object matching the proto schema
|
|
207
|
-
* @param metadata - Optional trace metadata (label, description) for diagnostics
|
|
208
|
-
* @returns AsyncIterable yielding raw chunks from the stream
|
|
209
|
-
*/
|
|
210
|
-
export type StreamingQueryExecutor = (
|
|
211
|
-
request: Record<string, unknown>,
|
|
212
|
-
metadata?: TraceMetadata,
|
|
213
|
-
) => AsyncIterable<unknown>;
|
|
214
|
-
|
|
215
200
|
/**
|
|
216
201
|
* Options for creating an integration client.
|
|
217
202
|
*/
|
|
@@ -221,12 +206,6 @@ export interface CreateClientOptions {
|
|
|
221
206
|
|
|
222
207
|
/** Function to execute queries/operations against the integration */
|
|
223
208
|
executeQuery: QueryExecutor;
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Optional function to execute streaming queries/operations.
|
|
227
|
-
* If provided, enables streaming support for compatible clients.
|
|
228
|
-
*/
|
|
229
|
-
executeStreamingQuery?: StreamingQueryExecutor;
|
|
230
209
|
}
|
|
231
210
|
|
|
232
211
|
/**
|
|
@@ -255,189 +234,125 @@ export interface CreateClientOptions {
|
|
|
255
234
|
export function createClient(
|
|
256
235
|
options: CreateClientOptions,
|
|
257
236
|
): IntegrationClientImpl {
|
|
258
|
-
const { config, executeQuery
|
|
237
|
+
const { config, executeQuery } = options;
|
|
259
238
|
|
|
260
239
|
switch (config.pluginId) {
|
|
261
240
|
case SUPPORTED_PLUGINS.postgres:
|
|
262
241
|
return new PostgresClientImpl(config, executeQuery);
|
|
263
242
|
|
|
264
243
|
case SUPPORTED_PLUGINS.slack:
|
|
265
|
-
return new SlackClientImpl(config, executeQuery
|
|
244
|
+
return new SlackClientImpl(config, executeQuery);
|
|
266
245
|
|
|
267
246
|
case SUPPORTED_PLUGINS.openai_v2:
|
|
268
|
-
return new OpenAIClientImpl(config, executeQuery
|
|
247
|
+
return new OpenAIClientImpl(config, executeQuery);
|
|
269
248
|
|
|
270
249
|
case SUPPORTED_PLUGINS.anthropic:
|
|
271
|
-
return new AnthropicClientImpl(
|
|
272
|
-
config,
|
|
273
|
-
executeQuery,
|
|
274
|
-
executeStreamingQuery,
|
|
275
|
-
);
|
|
250
|
+
return new AnthropicClientImpl(config, executeQuery);
|
|
276
251
|
|
|
277
252
|
case SUPPORTED_PLUGINS.stripe:
|
|
278
|
-
return new StripeClientImpl(config, executeQuery
|
|
253
|
+
return new StripeClientImpl(config, executeQuery);
|
|
279
254
|
|
|
280
255
|
case SUPPORTED_PLUGINS.github:
|
|
281
|
-
return new GitHubClientImpl(config, executeQuery
|
|
256
|
+
return new GitHubClientImpl(config, executeQuery);
|
|
282
257
|
|
|
283
258
|
case SUPPORTED_PLUGINS.notion:
|
|
284
|
-
return new NotionClientImpl(config, executeQuery
|
|
259
|
+
return new NotionClientImpl(config, executeQuery);
|
|
285
260
|
|
|
286
261
|
case SUPPORTED_PLUGINS.snowflake:
|
|
287
262
|
return new SnowflakeClientImpl(config, executeQuery);
|
|
288
263
|
|
|
289
264
|
case SUPPORTED_PLUGINS.snowflakecortex:
|
|
290
|
-
return new SnowflakeCortexClientImpl(
|
|
291
|
-
config,
|
|
292
|
-
executeQuery,
|
|
293
|
-
executeStreamingQuery,
|
|
294
|
-
);
|
|
265
|
+
return new SnowflakeCortexClientImpl(config, executeQuery);
|
|
295
266
|
|
|
296
267
|
case SUPPORTED_PLUGINS.airtable:
|
|
297
|
-
return new AirtableClientImpl(
|
|
298
|
-
config,
|
|
299
|
-
executeQuery,
|
|
300
|
-
executeStreamingQuery,
|
|
301
|
-
);
|
|
268
|
+
return new AirtableClientImpl(config, executeQuery);
|
|
302
269
|
|
|
303
270
|
case SUPPORTED_PLUGINS.asana:
|
|
304
|
-
return new AsanaClientImpl(config, executeQuery
|
|
271
|
+
return new AsanaClientImpl(config, executeQuery);
|
|
305
272
|
|
|
306
273
|
case SUPPORTED_PLUGINS.bitbucket:
|
|
307
|
-
return new BitbucketClientImpl(
|
|
308
|
-
config,
|
|
309
|
-
executeQuery,
|
|
310
|
-
executeStreamingQuery,
|
|
311
|
-
);
|
|
274
|
+
return new BitbucketClientImpl(config, executeQuery);
|
|
312
275
|
|
|
313
276
|
case SUPPORTED_PLUGINS.box:
|
|
314
|
-
return new BoxClientImpl(config, executeQuery
|
|
277
|
+
return new BoxClientImpl(config, executeQuery);
|
|
315
278
|
|
|
316
279
|
case SUPPORTED_PLUGINS.circleci:
|
|
317
|
-
return new CircleCIClientImpl(
|
|
318
|
-
config,
|
|
319
|
-
executeQuery,
|
|
320
|
-
executeStreamingQuery,
|
|
321
|
-
);
|
|
280
|
+
return new CircleCIClientImpl(config, executeQuery);
|
|
322
281
|
|
|
323
282
|
case SUPPORTED_PLUGINS.cohere:
|
|
324
|
-
return new CohereClientImpl(config, executeQuery
|
|
283
|
+
return new CohereClientImpl(config, executeQuery);
|
|
325
284
|
|
|
326
285
|
case SUPPORTED_PLUGINS.confluence:
|
|
327
|
-
return new ConfluenceClientImpl(
|
|
328
|
-
config,
|
|
329
|
-
executeQuery,
|
|
330
|
-
executeStreamingQuery,
|
|
331
|
-
);
|
|
286
|
+
return new ConfluenceClientImpl(config, executeQuery);
|
|
332
287
|
|
|
333
288
|
case SUPPORTED_PLUGINS.datadog:
|
|
334
|
-
return new DatadogClientImpl(config, executeQuery
|
|
289
|
+
return new DatadogClientImpl(config, executeQuery);
|
|
335
290
|
|
|
336
291
|
case SUPPORTED_PLUGINS.dropbox:
|
|
337
|
-
return new DropboxClientImpl(config, executeQuery
|
|
292
|
+
return new DropboxClientImpl(config, executeQuery);
|
|
338
293
|
|
|
339
294
|
case SUPPORTED_PLUGINS.elasticsearch:
|
|
340
|
-
return new ElasticSearchClientImpl(
|
|
341
|
-
config,
|
|
342
|
-
executeQuery,
|
|
343
|
-
executeStreamingQuery,
|
|
344
|
-
);
|
|
295
|
+
return new ElasticSearchClientImpl(config, executeQuery);
|
|
345
296
|
|
|
346
297
|
case SUPPORTED_PLUGINS.fireworks:
|
|
347
|
-
return new FireworksClientImpl(
|
|
348
|
-
config,
|
|
349
|
-
executeQuery,
|
|
350
|
-
executeStreamingQuery,
|
|
351
|
-
);
|
|
298
|
+
return new FireworksClientImpl(config, executeQuery);
|
|
352
299
|
|
|
353
300
|
case SUPPORTED_PLUGINS.front:
|
|
354
|
-
return new FrontClientImpl(config, executeQuery
|
|
301
|
+
return new FrontClientImpl(config, executeQuery);
|
|
355
302
|
|
|
356
303
|
case SUPPORTED_PLUGINS.gemini:
|
|
357
|
-
return new GeminiClientImpl(config, executeQuery
|
|
304
|
+
return new GeminiClientImpl(config, executeQuery);
|
|
358
305
|
|
|
359
306
|
case SUPPORTED_PLUGINS.googleanalytics:
|
|
360
|
-
return new GoogleAnalyticsClientImpl(
|
|
361
|
-
config,
|
|
362
|
-
executeQuery,
|
|
363
|
-
executeStreamingQuery,
|
|
364
|
-
);
|
|
307
|
+
return new GoogleAnalyticsClientImpl(config, executeQuery);
|
|
365
308
|
|
|
366
309
|
case SUPPORTED_PLUGINS.googledrive:
|
|
367
|
-
return new GoogleDriveClientImpl(
|
|
368
|
-
config,
|
|
369
|
-
executeQuery,
|
|
370
|
-
executeStreamingQuery,
|
|
371
|
-
);
|
|
310
|
+
return new GoogleDriveClientImpl(config, executeQuery);
|
|
372
311
|
|
|
373
312
|
case SUPPORTED_PLUGINS.graphqlintegration:
|
|
374
313
|
return new GraphQLClientImpl(config, executeQuery);
|
|
375
314
|
|
|
376
315
|
case SUPPORTED_PLUGINS.groq:
|
|
377
|
-
return new GroqClientImpl(config, executeQuery
|
|
316
|
+
return new GroqClientImpl(config, executeQuery);
|
|
378
317
|
|
|
379
318
|
case SUPPORTED_PLUGINS.hubspot:
|
|
380
|
-
return new HubSpotClientImpl(config, executeQuery
|
|
319
|
+
return new HubSpotClientImpl(config, executeQuery);
|
|
381
320
|
|
|
382
321
|
case SUPPORTED_PLUGINS.intercom:
|
|
383
|
-
return new IntercomClientImpl(
|
|
384
|
-
config,
|
|
385
|
-
executeQuery,
|
|
386
|
-
executeStreamingQuery,
|
|
387
|
-
);
|
|
322
|
+
return new IntercomClientImpl(config, executeQuery);
|
|
388
323
|
|
|
389
324
|
case SUPPORTED_PLUGINS.jira:
|
|
390
|
-
return new JiraClientImpl(config, executeQuery
|
|
325
|
+
return new JiraClientImpl(config, executeQuery);
|
|
391
326
|
|
|
392
327
|
case SUPPORTED_PLUGINS.launchdarkly:
|
|
393
|
-
return new LaunchDarklyClientImpl(
|
|
394
|
-
config,
|
|
395
|
-
executeQuery,
|
|
396
|
-
executeStreamingQuery,
|
|
397
|
-
);
|
|
328
|
+
return new LaunchDarklyClientImpl(config, executeQuery);
|
|
398
329
|
|
|
399
330
|
case SUPPORTED_PLUGINS.mistral:
|
|
400
|
-
return new MistralClientImpl(config, executeQuery
|
|
331
|
+
return new MistralClientImpl(config, executeQuery);
|
|
401
332
|
|
|
402
333
|
case SUPPORTED_PLUGINS.pagerduty:
|
|
403
|
-
return new PagerDutyClientImpl(
|
|
404
|
-
config,
|
|
405
|
-
executeQuery,
|
|
406
|
-
executeStreamingQuery,
|
|
407
|
-
);
|
|
334
|
+
return new PagerDutyClientImpl(config, executeQuery);
|
|
408
335
|
|
|
409
336
|
case SUPPORTED_PLUGINS.perplexity:
|
|
410
|
-
return new PerplexityClientImpl(
|
|
411
|
-
config,
|
|
412
|
-
executeQuery,
|
|
413
|
-
executeStreamingQuery,
|
|
414
|
-
);
|
|
337
|
+
return new PerplexityClientImpl(config, executeQuery);
|
|
415
338
|
|
|
416
339
|
case SUPPORTED_PLUGINS.segment:
|
|
417
|
-
return new SegmentClientImpl(config, executeQuery
|
|
340
|
+
return new SegmentClientImpl(config, executeQuery);
|
|
418
341
|
|
|
419
342
|
case SUPPORTED_PLUGINS.sendgrid:
|
|
420
|
-
return new SendGridClientImpl(
|
|
421
|
-
config,
|
|
422
|
-
executeQuery,
|
|
423
|
-
executeStreamingQuery,
|
|
424
|
-
);
|
|
343
|
+
return new SendGridClientImpl(config, executeQuery);
|
|
425
344
|
|
|
426
345
|
case SUPPORTED_PLUGINS.stabilityai:
|
|
427
|
-
return new StabilityAIClientImpl(
|
|
428
|
-
config,
|
|
429
|
-
executeQuery,
|
|
430
|
-
executeStreamingQuery,
|
|
431
|
-
);
|
|
346
|
+
return new StabilityAIClientImpl(config, executeQuery);
|
|
432
347
|
|
|
433
348
|
case SUPPORTED_PLUGINS.twilio:
|
|
434
|
-
return new TwilioClientImpl(config, executeQuery
|
|
349
|
+
return new TwilioClientImpl(config, executeQuery);
|
|
435
350
|
|
|
436
351
|
case SUPPORTED_PLUGINS.zendesk:
|
|
437
|
-
return new ZendeskClientImpl(config, executeQuery
|
|
352
|
+
return new ZendeskClientImpl(config, executeQuery);
|
|
438
353
|
|
|
439
354
|
case SUPPORTED_PLUGINS.zoom:
|
|
440
|
-
return new ZoomClientImpl(config, executeQuery
|
|
355
|
+
return new ZoomClientImpl(config, executeQuery);
|
|
441
356
|
|
|
442
357
|
// SQL databases
|
|
443
358
|
case SUPPORTED_PLUGINS.mysql:
|
|
@@ -519,11 +434,7 @@ export function createClient(
|
|
|
519
434
|
return new SmtpClientImpl(config, executeQuery);
|
|
520
435
|
|
|
521
436
|
case SUPPORTED_PLUGINS.restapiintegration:
|
|
522
|
-
return new RestApiIntegrationPluginClientImpl(
|
|
523
|
-
config,
|
|
524
|
-
executeQuery,
|
|
525
|
-
executeStreamingQuery,
|
|
526
|
-
);
|
|
437
|
+
return new RestApiIntegrationPluginClientImpl(config, executeQuery);
|
|
527
438
|
|
|
528
439
|
case SUPPORTED_PLUGINS.python:
|
|
529
440
|
return new PythonClientImpl(config, executeQuery);
|
|
@@ -6,10 +6,9 @@ This is the generic REST API Integration plugin. Unlike named integrations (Slac
|
|
|
6
6
|
|
|
7
7
|
## Methods
|
|
8
8
|
|
|
9
|
-
| Method
|
|
10
|
-
|
|
|
11
|
-
| `apiRequest(options, schema, metadata?)`
|
|
12
|
-
| `streamApiRequest(options, schema, metadata?)` | Stream responses with real-time chunk validation |
|
|
9
|
+
| Method | Description |
|
|
10
|
+
| ---------------------------------------- | -------------------------------------------- |
|
|
11
|
+
| `apiRequest(options, schema, metadata?)` | Make any HTTP request with schema validation |
|
|
13
12
|
|
|
14
13
|
## Usage
|
|
15
14
|
|
|
@@ -188,44 +187,6 @@ export default api({
|
|
|
188
187
|
});
|
|
189
188
|
```
|
|
190
189
|
|
|
191
|
-
### Streaming Responses
|
|
192
|
-
|
|
193
|
-
For APIs that return streaming data (e.g., Server-Sent Events), use `streamApiRequest()`:
|
|
194
|
-
|
|
195
|
-
```typescript
|
|
196
|
-
import { streamingApi, z, restApiIntegration } from "@superblocksteam/sdk-api";
|
|
197
|
-
|
|
198
|
-
const MY_API = "a1b2c3d4-5678-90ab-cdef-111111111111";
|
|
199
|
-
|
|
200
|
-
const StreamChunkSchema = z.object({
|
|
201
|
-
id: z.string(),
|
|
202
|
-
data: z.string(),
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
export default streamingApi({
|
|
206
|
-
integrations: {
|
|
207
|
-
myApi: restApiIntegration(MY_API),
|
|
208
|
-
},
|
|
209
|
-
input: z.object({ prompt: z.string() }),
|
|
210
|
-
chunk: z.object({ text: z.string() }),
|
|
211
|
-
|
|
212
|
-
async *run(ctx, { prompt }) {
|
|
213
|
-
const stream = ctx.integrations.myApi.streamApiRequest(
|
|
214
|
-
{
|
|
215
|
-
method: "POST",
|
|
216
|
-
path: "/stream",
|
|
217
|
-
body: { prompt },
|
|
218
|
-
},
|
|
219
|
-
{ chunk: StreamChunkSchema },
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
for await (const chunk of stream) {
|
|
223
|
-
yield { text: chunk.data };
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
});
|
|
227
|
-
```
|
|
228
|
-
|
|
229
190
|
## Trace Metadata
|
|
230
191
|
|
|
231
192
|
All methods accept an optional `metadata` parameter as the last argument for diagnostics labeling. See the [root SDK README](../../../README.md#trace-metadata) for details.
|
|
@@ -242,7 +203,7 @@ const result = await ctx.integrations.myApi.apiRequest(
|
|
|
242
203
|
|
|
243
204
|
### No `.request()` Method
|
|
244
205
|
|
|
245
|
-
The only public
|
|
206
|
+
The only public method is `apiRequest()`. There is no `.request()` method:
|
|
246
207
|
|
|
247
208
|
```typescript
|
|
248
209
|
// WRONG - .request() does not exist
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { BaseIntegrationClient } from "../../types.js";
|
|
6
|
-
import type {
|
|
7
|
-
SupportsApiRequest,
|
|
8
|
-
SupportsStreamingApiRequest,
|
|
9
|
-
} from "../base/index.js";
|
|
6
|
+
import type { SupportsApiRequest } from "../base/index.js";
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* REST API Integration client for making HTTP requests to configured endpoints.
|
|
@@ -34,7 +31,4 @@ import type {
|
|
|
34
31
|
* ```
|
|
35
32
|
*/
|
|
36
33
|
export interface RestApiIntegrationPluginClient
|
|
37
|
-
extends
|
|
38
|
-
BaseIntegrationClient,
|
|
39
|
-
SupportsApiRequest,
|
|
40
|
-
SupportsStreamingApiRequest {}
|
|
34
|
+
extends BaseIntegrationClient, SupportsApiRequest {}
|
|
@@ -13,7 +13,7 @@ Send transactional emails, manage contacts, and interact with SendGrid's email A
|
|
|
13
13
|
### Send a Simple Email
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import { api, z,
|
|
16
|
+
import { api, z, sendGrid } from "@superblocksteam/sdk-api";
|
|
17
17
|
|
|
18
18
|
// Integration ID from the integrations panel
|
|
19
19
|
const PROD_SENDGRID = "a1b2c3d4-5678-90ab-cdef-sendgrid0001";
|
|
@@ -23,7 +23,7 @@ const SendEmailResponseSchema = z.object({}).optional();
|
|
|
23
23
|
|
|
24
24
|
export default api({
|
|
25
25
|
integrations: {
|
|
26
|
-
sendgrid:
|
|
26
|
+
sendgrid: sendGrid(PROD_SENDGRID),
|
|
27
27
|
},
|
|
28
28
|
name: "SendGridExample",
|
|
29
29
|
input: z.object({
|
|
@@ -4,10 +4,9 @@ Interact with Snowflake Cortex AI/ML inference endpoints for text generation, em
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `apiRequest(options, schema, metadata?)`
|
|
10
|
-
| `streamApiRequest(options, schema, metadata?)` | Stream responses with real-time chunk validation |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ---------------------------------------- | ------------------------------------------------------------ |
|
|
9
|
+
| `apiRequest(options, schema, metadata?)` | Make any Snowflake Cortex API request with schema validation |
|
|
11
10
|
|
|
12
11
|
## Usage
|
|
13
12
|
|
|
@@ -79,54 +78,6 @@ export default api({
|
|
|
79
78
|
});
|
|
80
79
|
```
|
|
81
80
|
|
|
82
|
-
### Streaming Completion
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
import { streamingApi, z, snowflakeCortex } from "@superblocksteam/sdk-api";
|
|
86
|
-
|
|
87
|
-
const CORTEX = "a1b2c3d4-5678-90ab-cdef-111111111111";
|
|
88
|
-
|
|
89
|
-
const StreamChunkSchema = z.object({
|
|
90
|
-
choices: z.array(
|
|
91
|
-
z.object({
|
|
92
|
-
delta: z.object({
|
|
93
|
-
content: z.string().optional(),
|
|
94
|
-
}),
|
|
95
|
-
}),
|
|
96
|
-
),
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
export default streamingApi({
|
|
100
|
-
integrations: {
|
|
101
|
-
cortex: snowflakeCortex(CORTEX),
|
|
102
|
-
},
|
|
103
|
-
input: z.object({ prompt: z.string() }),
|
|
104
|
-
chunk: z.object({ type: z.literal("text"), text: z.string() }),
|
|
105
|
-
|
|
106
|
-
async *run(ctx, { prompt }) {
|
|
107
|
-
const stream = ctx.integrations.cortex.streamApiRequest(
|
|
108
|
-
{
|
|
109
|
-
method: "POST",
|
|
110
|
-
path: "/api/v2/cortex/inference:complete",
|
|
111
|
-
body: {
|
|
112
|
-
model: "mistral-large2",
|
|
113
|
-
stream: true,
|
|
114
|
-
messages: [{ role: "user", content: prompt }],
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
{ chunk: StreamChunkSchema },
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
for await (const chunk of stream) {
|
|
121
|
-
const content = chunk.choices[0]?.delta?.content;
|
|
122
|
-
if (content) {
|
|
123
|
-
yield { type: "text" as const, text: content };
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
```
|
|
129
|
-
|
|
130
81
|
### Text Embedding
|
|
131
82
|
|
|
132
83
|
```typescript
|
|
@@ -159,7 +110,7 @@ All methods accept an optional `metadata` parameter as the last argument for dia
|
|
|
159
110
|
|
|
160
111
|
### No Specialized Methods
|
|
161
112
|
|
|
162
|
-
The Snowflake Cortex client only provides `apiRequest()
|
|
113
|
+
The Snowflake Cortex client only provides `apiRequest()`. There are no other specialized methods:
|
|
163
114
|
|
|
164
115
|
```typescript
|
|
165
116
|
// WRONG - These methods do not exist
|
|
@@ -11,12 +11,11 @@ import type { SnowflakeCortexClient } from "./types.js";
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal implementation of SnowflakeCortexClient.
|
|
13
13
|
*
|
|
14
|
-
* Extends RestApiIntegrationClient to inherit generic apiRequest()
|
|
15
|
-
* streamApiRequest() methods.
|
|
14
|
+
* Extends RestApiIntegrationClient to inherit generic apiRequest() method.
|
|
16
15
|
*/
|
|
17
16
|
export class SnowflakeCortexClientImpl
|
|
18
17
|
extends RestApiIntegrationClient
|
|
19
18
|
implements SnowflakeCortexClient {
|
|
20
|
-
// Inherits: name, pluginId, config, executeQuery, createParam(), apiRequest()
|
|
19
|
+
// Inherits: name, pluginId, config, executeQuery, createParam(), apiRequest()
|
|
21
20
|
// Can add Snowflake Cortex-specific methods here in the future if needed
|
|
22
21
|
}
|
|
@@ -3,22 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { BaseIntegrationClient } from "../../types.js";
|
|
6
|
-
import type {
|
|
7
|
-
SupportsApiRequest,
|
|
8
|
-
SupportsStreamingApiRequest,
|
|
9
|
-
} from "../base/index.js";
|
|
6
|
+
import type { SupportsApiRequest } from "../base/index.js";
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* Snowflake Cortex client for inference interactions.
|
|
13
10
|
*
|
|
14
|
-
* Provides the generic apiRequest() method for any Snowflake Cortex API endpoint
|
|
15
|
-
* and streamApiRequest() for streaming responses.
|
|
11
|
+
* Provides the generic apiRequest() method for any Snowflake Cortex API endpoint.
|
|
16
12
|
*/
|
|
17
13
|
export interface SnowflakeCortexClient
|
|
18
|
-
extends
|
|
19
|
-
BaseIntegrationClient,
|
|
20
|
-
SupportsApiRequest,
|
|
21
|
-
SupportsStreamingApiRequest {
|
|
14
|
+
extends BaseIntegrationClient, SupportsApiRequest {
|
|
22
15
|
// apiRequest() method inherited from SupportsApiRequest
|
|
23
|
-
// streamApiRequest() method inherited from SupportsStreamingApiRequest
|
|
24
16
|
}
|
|
@@ -13,7 +13,7 @@ Generate, edit, and upscale images using Stability AI's image generation models.
|
|
|
13
13
|
### Generate an Image (Text-to-Image)
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import { api, z,
|
|
16
|
+
import { api, z, stabilityAI } from "@superblocksteam/sdk-api";
|
|
17
17
|
|
|
18
18
|
// Integration ID from the integrations panel
|
|
19
19
|
const PROD_STABILITY = "a1b2c3d4-5678-90ab-cdef-stabilit0001";
|
|
@@ -30,7 +30,7 @@ const GenerationResponseSchema = z.object({
|
|
|
30
30
|
|
|
31
31
|
export default api({
|
|
32
32
|
integrations: {
|
|
33
|
-
stability:
|
|
33
|
+
stability: stabilityAI(PROD_STABILITY),
|
|
34
34
|
},
|
|
35
35
|
name: "StabilityAIExample",
|
|
36
36
|
input: z.object({
|
package/src/runtime/index.ts
CHANGED
|
@@ -5,15 +5,7 @@
|
|
|
5
5
|
* including context creation, validation, and error handling.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
//
|
|
9
|
-
export {
|
|
10
|
-
execute,
|
|
11
|
-
isStreamingApi,
|
|
12
|
-
type UnifiedExecuteApiRequest,
|
|
13
|
-
type AnyCompiledApi,
|
|
14
|
-
} from "./execute.js";
|
|
15
|
-
|
|
16
|
-
// Main executor (for non-streaming APIs)
|
|
8
|
+
// Main executor
|
|
17
9
|
export {
|
|
18
10
|
executeApi,
|
|
19
11
|
type ExecuteApiRequest,
|
|
@@ -22,22 +14,8 @@ export {
|
|
|
22
14
|
type ExecuteApiErrorResponse,
|
|
23
15
|
} from "./executor.js";
|
|
24
16
|
|
|
25
|
-
// Streaming executor (for streaming APIs)
|
|
26
|
-
export {
|
|
27
|
-
executeStreamingApi,
|
|
28
|
-
createStreamingApiGenerator,
|
|
29
|
-
type ExecuteStreamingApiRequest,
|
|
30
|
-
type StreamingApiCallbacks,
|
|
31
|
-
type StreamingApiError,
|
|
32
|
-
type ExecuteStreamingApiResult,
|
|
33
|
-
} from "./streaming-executor.js";
|
|
34
|
-
|
|
35
17
|
// Context factories
|
|
36
18
|
export { createApiContext, type CreateContextOptions } from "./context.js";
|
|
37
|
-
export {
|
|
38
|
-
createStreamingApiContext,
|
|
39
|
-
type CreateStreamingContextOptions,
|
|
40
|
-
} from "./streaming-context.js";
|
|
41
19
|
|
|
42
20
|
// Error types
|
|
43
21
|
export {
|