@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.
Files changed (106) hide show
  1. package/README.md +58 -299
  2. package/dist/api/definition.js +1 -1
  3. package/dist/api/definition.js.map +1 -1
  4. package/dist/api/index.d.ts +0 -2
  5. package/dist/api/index.d.ts.map +1 -1
  6. package/dist/api/index.js +0 -2
  7. package/dist/api/index.js.map +1 -1
  8. package/dist/errors.d.ts +0 -44
  9. package/dist/errors.d.ts.map +1 -1
  10. package/dist/errors.js +0 -32
  11. package/dist/errors.js.map +1 -1
  12. package/dist/index.d.ts +5 -5
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +5 -9
  15. package/dist/index.js.map +1 -1
  16. package/dist/integrations/anthropic/types.d.ts +3 -22
  17. package/dist/integrations/anthropic/types.d.ts.map +1 -1
  18. package/dist/integrations/base/index.d.ts +1 -1
  19. package/dist/integrations/base/index.d.ts.map +1 -1
  20. package/dist/integrations/base/rest-api-integration-client.d.ts +4 -48
  21. package/dist/integrations/base/rest-api-integration-client.d.ts.map +1 -1
  22. package/dist/integrations/base/rest-api-integration-client.js +2 -110
  23. package/dist/integrations/base/rest-api-integration-client.js.map +1 -1
  24. package/dist/integrations/base/types.d.ts +1 -67
  25. package/dist/integrations/base/types.d.ts.map +1 -1
  26. package/dist/integrations/index.d.ts +1 -1
  27. package/dist/integrations/index.d.ts.map +1 -1
  28. package/dist/integrations/index.js.map +1 -1
  29. package/dist/integrations/openai_v2/types.d.ts +4 -22
  30. package/dist/integrations/openai_v2/types.d.ts.map +1 -1
  31. package/dist/integrations/registry.d.ts +0 -16
  32. package/dist/integrations/registry.d.ts.map +1 -1
  33. package/dist/integrations/registry.js +38 -38
  34. package/dist/integrations/registry.js.map +1 -1
  35. package/dist/integrations/registry.test.js +1 -3
  36. package/dist/integrations/registry.test.js.map +1 -1
  37. package/dist/integrations/restapiintegration/types.d.ts +2 -2
  38. package/dist/integrations/restapiintegration/types.d.ts.map +1 -1
  39. package/dist/integrations/snowflakecortex/client.d.ts +1 -2
  40. package/dist/integrations/snowflakecortex/client.d.ts.map +1 -1
  41. package/dist/integrations/snowflakecortex/client.js +1 -2
  42. package/dist/integrations/snowflakecortex/client.js.map +1 -1
  43. package/dist/integrations/snowflakecortex/types.d.ts +3 -4
  44. package/dist/integrations/snowflakecortex/types.d.ts.map +1 -1
  45. package/dist/runtime/index.d.ts +0 -3
  46. package/dist/runtime/index.d.ts.map +1 -1
  47. package/dist/runtime/index.js +1 -6
  48. package/dist/runtime/index.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/api/definition.ts +1 -1
  51. package/src/api/index.ts +0 -4
  52. package/src/errors.ts +0 -48
  53. package/src/index.ts +2 -28
  54. package/src/integrations/anthropic/README.md +5 -101
  55. package/src/integrations/anthropic/types.ts +3 -29
  56. package/src/integrations/base/index.ts +0 -2
  57. package/src/integrations/base/rest-api-integration-client.ts +4 -153
  58. package/src/integrations/base/types.ts +3 -74
  59. package/src/integrations/cohere/README.md +11 -11
  60. package/src/integrations/fireworks/README.md +43 -17
  61. package/src/integrations/googleanalytics/README.md +2 -2
  62. package/src/integrations/googledrive/README.md +2 -2
  63. package/src/integrations/groq/README.md +41 -34
  64. package/src/integrations/gsheets/README.md +2 -2
  65. package/src/integrations/index.ts +0 -1
  66. package/src/integrations/launchdarkly/README.md +2 -2
  67. package/src/integrations/mistral/README.md +39 -13
  68. package/src/integrations/openai_v2/README.md +44 -116
  69. package/src/integrations/openai_v2/types.ts +4 -29
  70. package/src/integrations/pagerduty/README.md +2 -2
  71. package/src/integrations/perplexity/README.md +2 -1
  72. package/src/integrations/registry.test.ts +1 -3
  73. package/src/integrations/registry.ts +38 -127
  74. package/src/integrations/restapiintegration/README.md +4 -43
  75. package/src/integrations/restapiintegration/types.ts +2 -8
  76. package/src/integrations/sendgrid/README.md +2 -2
  77. package/src/integrations/snowflakecortex/README.md +4 -53
  78. package/src/integrations/snowflakecortex/client.ts +2 -3
  79. package/src/integrations/snowflakecortex/types.ts +3 -11
  80. package/src/integrations/stabilityai/README.md +2 -2
  81. package/src/runtime/index.ts +1 -23
  82. package/dist/api/streaming.d.ts +0 -229
  83. package/dist/api/streaming.d.ts.map +0 -1
  84. package/dist/api/streaming.js +0 -107
  85. package/dist/api/streaming.js.map +0 -1
  86. package/dist/api/streaming.test.d.ts +0 -5
  87. package/dist/api/streaming.test.d.ts.map +0 -1
  88. package/dist/api/streaming.test.js +0 -364
  89. package/dist/api/streaming.test.js.map +0 -1
  90. package/dist/runtime/execute.d.ts +0 -128
  91. package/dist/runtime/execute.d.ts.map +0 -1
  92. package/dist/runtime/execute.js +0 -84
  93. package/dist/runtime/execute.js.map +0 -1
  94. package/dist/runtime/streaming-context.d.ts +0 -49
  95. package/dist/runtime/streaming-context.d.ts.map +0 -1
  96. package/dist/runtime/streaming-context.js +0 -71
  97. package/dist/runtime/streaming-context.js.map +0 -1
  98. package/dist/runtime/streaming-executor.d.ts +0 -159
  99. package/dist/runtime/streaming-executor.d.ts.map +0 -1
  100. package/dist/runtime/streaming-executor.js +0 -229
  101. package/dist/runtime/streaming-executor.js.map +0 -1
  102. package/src/api/streaming.test.ts +0 -433
  103. package/src/api/streaming.ts +0 -303
  104. package/src/runtime/execute.ts +0 -221
  105. package/src/runtime/streaming-context.ts +0 -164
  106. package/src/runtime/streaming-executor.ts +0 -367
@@ -1,364 +0,0 @@
1
- /**
2
- * Tests for streaming API definition.
3
- */
4
- import { describe, it, expect, vi } from "vitest";
5
- import { z } from "zod";
6
- import { postgres, anthropic } from "../integrations/declarations.js";
7
- import { api, __setEntryPoint } from "./definition.js";
8
- import { streamingApi, isStreamingApi } from "./streaming.js";
9
- describe("streamingApi()", () => {
10
- describe("basic creation", () => {
11
- it("creates a streaming API with input and chunk schemas", () => {
12
- const inputSchema = z.object({ prompt: z.string() });
13
- const chunkSchema = z.object({ text: z.string() });
14
- const streamingApiDef = streamingApi({
15
- name: "TestStreamingApi",
16
- input: inputSchema,
17
- chunk: chunkSchema,
18
- async *run() {
19
- yield { text: "Hello" };
20
- yield { text: " World" };
21
- },
22
- });
23
- expect(streamingApiDef.inputSchema).toBe(inputSchema);
24
- expect(streamingApiDef.chunkSchema).toBe(chunkSchema);
25
- expect(streamingApiDef.isStreaming).toBe(true);
26
- expect(typeof streamingApiDef.run).toBe("function");
27
- });
28
- it("creates a streaming API with integrations", () => {
29
- const inputSchema = z.object({ prompt: z.string() });
30
- const chunkSchema = z.object({ text: z.string() });
31
- const streamingApiDef = streamingApi({
32
- name: "TestStreamingApi",
33
- integrations: {
34
- ai: anthropic("Production Anthropic"),
35
- },
36
- input: inputSchema,
37
- chunk: chunkSchema,
38
- async *run() {
39
- yield { text: "test" };
40
- },
41
- });
42
- expect(streamingApiDef.integrations).toHaveLength(1);
43
- expect(streamingApiDef.integrations[0]).toMatchObject({
44
- key: "ai",
45
- pluginId: "anthropic",
46
- id: "Production Anthropic",
47
- });
48
- });
49
- it("has empty integrations array when none declared", () => {
50
- const streamingApiDef = streamingApi({
51
- name: "TestStreamingApi",
52
- input: z.object({ prompt: z.string() }),
53
- chunk: z.object({ text: z.string() }),
54
- async *run() {
55
- yield { text: "test" };
56
- },
57
- });
58
- expect(streamingApiDef.integrations).toEqual([]);
59
- });
60
- });
61
- describe("async generator execution", () => {
62
- it("run function returns an async iterable", async () => {
63
- const streamingApiDef = streamingApi({
64
- name: "TestStreamingApi",
65
- input: z.object({ prompt: z.string() }),
66
- chunk: z.object({ text: z.string() }),
67
- async *run() {
68
- yield { text: "Hello" };
69
- yield { text: " World" };
70
- },
71
- });
72
- const mockContext = {
73
- integrations: {},
74
- log: {
75
- info: vi.fn(),
76
- warn: vi.fn(),
77
- error: vi.fn(),
78
- debug: vi.fn(),
79
- },
80
- env: {},
81
- };
82
- const iterator = streamingApiDef.run(mockContext, { prompt: "test" });
83
- expect(Symbol.asyncIterator in iterator).toBe(true);
84
- const chunks = [];
85
- for await (const chunk of iterator) {
86
- chunks.push(chunk);
87
- }
88
- expect(chunks).toEqual([{ text: "Hello" }, { text: " World" }]);
89
- });
90
- it("can access input in the run function", async () => {
91
- const inputCapture = [];
92
- const streamingApiDef = streamingApi({
93
- name: "TestStreamingApi",
94
- input: z.object({ prompt: z.string() }),
95
- chunk: z.object({ text: z.string() }),
96
- async *run(ctx, { prompt }) {
97
- inputCapture.push(prompt);
98
- yield { text: prompt };
99
- },
100
- });
101
- const mockContext = {
102
- integrations: {},
103
- log: {
104
- info: vi.fn(),
105
- warn: vi.fn(),
106
- error: vi.fn(),
107
- debug: vi.fn(),
108
- },
109
- env: {},
110
- };
111
- const iterator = streamingApiDef.run(mockContext, { prompt: "Hello, AI!" });
112
- const chunks = [];
113
- for await (const chunk of iterator) {
114
- chunks.push(chunk);
115
- }
116
- expect(inputCapture).toEqual(["Hello, AI!"]);
117
- expect(chunks).toEqual([{ text: "Hello, AI!" }]);
118
- });
119
- it("yields multiple chunks over time", async () => {
120
- const streamingApiDef = streamingApi({
121
- name: "TestStreamingApi",
122
- input: z.object({ count: z.number() }),
123
- chunk: z.object({ index: z.number(), text: z.string() }),
124
- async *run(ctx, { count }) {
125
- for (let i = 0; i < count; i++) {
126
- yield { index: i, text: `Chunk ${i}` };
127
- }
128
- },
129
- });
130
- const mockContext = {
131
- integrations: {},
132
- log: {
133
- info: vi.fn(),
134
- warn: vi.fn(),
135
- error: vi.fn(),
136
- debug: vi.fn(),
137
- },
138
- env: {},
139
- };
140
- const iterator = streamingApiDef.run(mockContext, { count: 5 });
141
- const chunks = [];
142
- for await (const chunk of iterator) {
143
- chunks.push(chunk);
144
- }
145
- expect(chunks).toHaveLength(5);
146
- expect(chunks[0]).toEqual({ index: 0, text: "Chunk 0" });
147
- expect(chunks[4]).toEqual({ index: 4, text: "Chunk 4" });
148
- });
149
- });
150
- describe("readonly properties", () => {
151
- it("inputSchema is readonly", () => {
152
- const streamingApiDef = streamingApi({
153
- name: "TestStreamingApi",
154
- input: z.object({ prompt: z.string() }),
155
- chunk: z.object({ text: z.string() }),
156
- async *run() {
157
- yield { text: "test" };
158
- },
159
- });
160
- expect(streamingApiDef.inputSchema).toBeDefined();
161
- });
162
- it("chunkSchema is readonly", () => {
163
- const streamingApiDef = streamingApi({
164
- name: "TestStreamingApi",
165
- input: z.object({ prompt: z.string() }),
166
- chunk: z.object({ text: z.string() }),
167
- async *run() {
168
- yield { text: "test" };
169
- },
170
- });
171
- expect(streamingApiDef.chunkSchema).toBeDefined();
172
- });
173
- it("isStreaming is always true", () => {
174
- const streamingApiDef = streamingApi({
175
- name: "TestStreamingApi",
176
- input: z.object({ prompt: z.string() }),
177
- chunk: z.object({ text: z.string() }),
178
- async *run() {
179
- yield { text: "test" };
180
- },
181
- });
182
- expect(streamingApiDef.isStreaming).toBe(true);
183
- });
184
- });
185
- });
186
- describe("isStreamingApi()", () => {
187
- describe("with streaming APIs", () => {
188
- it("returns true for streaming API", () => {
189
- const streamingApiDef = streamingApi({
190
- name: "TestStreamingApi",
191
- input: z.object({ prompt: z.string() }),
192
- chunk: z.object({ text: z.string() }),
193
- async *run() {
194
- yield { text: "test" };
195
- },
196
- });
197
- expect(isStreamingApi(streamingApiDef)).toBe(true);
198
- });
199
- });
200
- describe("with regular APIs", () => {
201
- it("returns false for regular API", () => {
202
- const regularApi = api({
203
- name: "RegularApi",
204
- input: z.object({ userId: z.string() }),
205
- output: z.object({ name: z.string() }),
206
- async run() {
207
- return { name: "Test" };
208
- },
209
- });
210
- expect(isStreamingApi(regularApi)).toBe(false);
211
- });
212
- });
213
- describe("with non-API values", () => {
214
- it("returns false for null", () => {
215
- expect(isStreamingApi(null)).toBe(false);
216
- });
217
- it("returns false for undefined", () => {
218
- expect(isStreamingApi(undefined)).toBe(false);
219
- });
220
- it("returns false for plain object", () => {
221
- expect(isStreamingApi({ isStreaming: false })).toBe(false);
222
- });
223
- it("returns false for number", () => {
224
- expect(isStreamingApi(42)).toBe(false);
225
- });
226
- it("returns false for string", () => {
227
- expect(isStreamingApi("streaming")).toBe(false);
228
- });
229
- it("returns false for object without isStreaming property", () => {
230
- expect(isStreamingApi({ inputSchema: z.string() })).toBe(false);
231
- });
232
- it("returns false for object with only isStreaming true but missing required fields", () => {
233
- expect(isStreamingApi({ isStreaming: true })).toBe(false);
234
- });
235
- it("returns true for object with isStreaming true and all required fields", () => {
236
- expect(isStreamingApi({
237
- isStreaming: true,
238
- inputSchema: z.string(),
239
- chunkSchema: z.string(),
240
- run: () => { },
241
- })).toBe(true);
242
- });
243
- });
244
- });
245
- describe("type inference", () => {
246
- it("infers input type from schema", () => {
247
- const streamingApiDef = streamingApi({
248
- name: "TestStreamingApi",
249
- input: z.object({
250
- prompt: z.string(),
251
- maxTokens: z.number().optional(),
252
- }),
253
- chunk: z.object({ text: z.string() }),
254
- async *run(ctx, { prompt, maxTokens }) {
255
- const p = prompt;
256
- const m = maxTokens;
257
- yield { text: `${p} ${m ?? 100}` };
258
- },
259
- });
260
- expect(streamingApiDef).toBeDefined();
261
- });
262
- it("infers chunk type from schema", () => {
263
- const streamingApiDef = streamingApi({
264
- name: "TestStreamingApi",
265
- input: z.object({ prompt: z.string() }),
266
- chunk: z.object({
267
- type: z.literal("text-delta"),
268
- text: z.string(),
269
- index: z.number(),
270
- }),
271
- async *run() {
272
- yield {
273
- type: "text-delta",
274
- text: "Hello",
275
- index: 0,
276
- };
277
- },
278
- });
279
- expect(streamingApiDef.chunkSchema).toBeDefined();
280
- });
281
- it("infers integration types", () => {
282
- const streamingApiDef = streamingApi({
283
- name: "TestStreamingApi",
284
- integrations: {
285
- ai: anthropic("AI Service"),
286
- db: postgres("Database"),
287
- },
288
- input: z.object({ prompt: z.string() }),
289
- chunk: z.object({ text: z.string() }),
290
- async *run() {
291
- yield { text: "test" };
292
- },
293
- });
294
- expect(streamingApiDef.integrations).toHaveLength(2);
295
- });
296
- });
297
- describe("entryPoint mechanism", () => {
298
- it("streamingApi() has no entryPoint when __setEntryPoint was not called", () => {
299
- const compiled = streamingApi({
300
- name: "NoEntryPoint",
301
- input: z.object({}),
302
- chunk: z.object({ text: z.string() }),
303
- async *run() {
304
- yield { text: "hello" };
305
- },
306
- });
307
- expect(compiled.entryPoint).toBeUndefined();
308
- });
309
- it("streamingApi() picks up entryPoint set via __setEntryPoint", () => {
310
- __setEntryPoint("server/apis/Chat/api.ts");
311
- const compiled = streamingApi({
312
- name: "Chat",
313
- input: z.object({ prompt: z.string() }),
314
- chunk: z.object({ text: z.string() }),
315
- async *run() {
316
- yield { text: "hello" };
317
- },
318
- });
319
- expect(compiled.entryPoint).toBe("server/apis/Chat/api.ts");
320
- });
321
- it("entryPoint is consumed once — second streamingApi() call gets undefined", () => {
322
- __setEntryPoint("server/apis/Stream/api.ts");
323
- const first = streamingApi({
324
- name: "Stream",
325
- input: z.object({}),
326
- chunk: z.object({ text: z.string() }),
327
- async *run() {
328
- yield { text: "a" };
329
- },
330
- });
331
- const second = streamingApi({
332
- name: "Stream2",
333
- input: z.object({}),
334
- chunk: z.object({ text: z.string() }),
335
- async *run() {
336
- yield { text: "b" };
337
- },
338
- });
339
- expect(first.entryPoint).toBe("server/apis/Stream/api.ts");
340
- expect(second.entryPoint).toBeUndefined();
341
- });
342
- it("__setEntryPoint works across api() and streamingApi()", () => {
343
- __setEntryPoint("server/apis/Mixed/api.ts");
344
- const compiled = streamingApi({
345
- name: "Mixed",
346
- input: z.object({}),
347
- chunk: z.object({ text: z.string() }),
348
- async *run() {
349
- yield { text: "mixed" };
350
- },
351
- });
352
- expect(compiled.entryPoint).toBe("server/apis/Mixed/api.ts");
353
- const afterConsume = api({
354
- name: "After",
355
- input: z.object({}),
356
- output: z.object({}),
357
- async run() {
358
- return {};
359
- },
360
- });
361
- expect(afterConsume.entryPoint).toBeUndefined();
362
- });
363
- });
364
- //# sourceMappingURL=streaming.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"streaming.test.js","sourceRoot":"","sources":["../../src/api/streaming.test.ts"],"names":[],"mappings":"AAAA;;GAEG;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Aa,EAAE,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,128 +0,0 @@
1
- /**
2
- * Unified API execution function.
3
- *
4
- * Provides a single `execute()` function that handles both regular and streaming APIs,
5
- * detecting the API type at runtime and returning appropriate result types.
6
- */
7
- import type { CompiledApi } from "../api/definition.js";
8
- import { isStreamingApi, type CompiledStreamingApi } from "../api/streaming.js";
9
- import type { TraceMetadata } from "../integrations/registry.js";
10
- import type { IntegrationConfig } from "../integrations/types.js";
11
- import type { ApiUser } from "../types.js";
12
- import { type ExecuteApiResponse } from "./executor.js";
13
- /**
14
- * Unified request for executing any API (regular or streaming).
15
- *
16
- * This interface combines the fields from both `ExecuteApiRequest` and
17
- * `ExecuteStreamingApiRequest` into a single type. The `executeStreamingQuery`
18
- * field is only required when executing streaming APIs that use streaming
19
- * integration support.
20
- */
21
- export interface UnifiedExecuteApiRequest {
22
- /** Raw input data to be validated */
23
- input: unknown;
24
- /** Available integration configurations */
25
- integrations: IntegrationConfig[];
26
- /** Unique execution ID for tracing */
27
- executionId: string;
28
- /** Environment variables available to the API */
29
- env: Record<string, string>;
30
- /** User information extracted from the Superblocks JWT */
31
- user: ApiUser;
32
- /**
33
- * Function to execute integration operations (non-streaming).
34
- *
35
- * @param integrationId - The integration ID
36
- * @param request - Plugin-specific request object
37
- * @param bindings - Optional bindings for language plugins
38
- * @returns Promise resolving to the operation result
39
- */
40
- executeQuery: (integrationId: string, request: Record<string, unknown>, bindings?: Record<string, unknown>, metadata?: TraceMetadata) => Promise<unknown>;
41
- /**
42
- * Function to execute streaming integration operations.
43
- * Optional - only needed for streaming APIs that use streaming integrations.
44
- *
45
- * @param integrationId - The integration ID
46
- * @param request - Plugin-specific request object
47
- * @param metadata - Optional trace metadata for diagnostics
48
- * @returns AsyncIterable yielding raw chunks
49
- */
50
- executeStreamingQuery?: (integrationId: string, request: Record<string, unknown>, metadata?: TraceMetadata) => AsyncIterable<unknown>;
51
- }
52
- /**
53
- * Union type for any compiled API (regular or streaming).
54
- *
55
- * Note: This is a permissive type for runtime use. The `execute` function
56
- * provides overloads for proper type inference.
57
- */
58
- export type AnyCompiledApi = CompiledApi<any, any> | CompiledStreamingApi<any, any>;
59
- /**
60
- * Execute a regular (non-streaming) compiled API.
61
- *
62
- * @param api - The compiled API definition
63
- * @param request - The execution request
64
- * @returns Promise resolving to execution response with success/error and output
65
- *
66
- * @example
67
- * ```typescript
68
- * const response = await execute(myApi, {
69
- * input: { userId: '123' },
70
- * integrations: [...],
71
- * executionId: 'exec_abc',
72
- * env: {},
73
- * executeQuery: async (id, req) => orchestrator.execute(id, req),
74
- * });
75
- *
76
- * if (response.success) {
77
- * console.log(response.output);
78
- * } else {
79
- * console.error(response.error);
80
- * }
81
- * ```
82
- */
83
- export declare function execute<TInput, TOutput>(api: CompiledApi<TInput, TOutput>, request: UnifiedExecuteApiRequest): Promise<ExecuteApiResponse<TOutput>>;
84
- /**
85
- * Execute a streaming compiled API.
86
- *
87
- * @param api - The compiled streaming API definition
88
- * @param request - The execution request
89
- * @returns AsyncGenerator that yields validated chunks
90
- *
91
- * @example
92
- * ```typescript
93
- * const stream = execute(myStreamingApi, {
94
- * input: { prompt: 'Hello' },
95
- * integrations: [...],
96
- * executionId: 'exec_abc',
97
- * env: {},
98
- * executeQuery: async (id, req) => orchestrator.execute(id, req),
99
- * executeStreamingQuery: (id, req) => orchestrator.stream(id, req),
100
- * });
101
- *
102
- * for await (const chunk of stream) {
103
- * console.log(chunk.text);
104
- * }
105
- * ```
106
- */
107
- export declare function execute<TInput, TChunk>(api: CompiledStreamingApi<TInput, TChunk>, request: UnifiedExecuteApiRequest): AsyncGenerator<TChunk, void, undefined>;
108
- /**
109
- * Type guard to check if an API is a streaming API.
110
- *
111
- * Use this to determine which result type you'll get from `execute()`.
112
- *
113
- * @param api - The API to check
114
- * @returns `true` if the API is a streaming API
115
- *
116
- * @example
117
- * ```typescript
118
- * if (isStreamingApi(api)) {
119
- * const stream = execute(api, request);
120
- * for await (const chunk of stream) { ... }
121
- * } else {
122
- * const response = await execute(api, request);
123
- * if (response.success) { ... }
124
- * }
125
- * ```
126
- */
127
- export { isStreamingApi };
128
- //# sourceMappingURL=execute.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/runtime/execute.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAc,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGpE;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,qCAAqC;IACrC,KAAK,EAAE,OAAO,CAAC;IAEf,2CAA2C;IAC3C,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAElC,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IAEpB,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE5B,0DAA0D;IAC1D,IAAI,EAAE,OAAO,CAAC;IAEd;;;;;;;OAOG;IACH,YAAY,EAAE,CACZ,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,QAAQ,CAAC,EAAE,aAAa,KACrB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtB;;;;;;;;OAQG;IACH,qBAAqB,CAAC,EAAE,CACtB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,CAAC,EAAE,aAAa,KACrB,aAAa,CAAC,OAAO,CAAC,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAEtB,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,GAErB,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,EACrC,GAAG,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EACpC,GAAG,EAAE,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,OAAO,EAAE,wBAAwB,GAChC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAgE3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,84 +0,0 @@
1
- /**
2
- * Unified API execution function.
3
- *
4
- * Provides a single `execute()` function that handles both regular and streaming APIs,
5
- * detecting the API type at runtime and returning appropriate result types.
6
- */
7
- import { isStreamingApi } from "../api/streaming.js";
8
- import { executeApi } from "./executor.js";
9
- import { createStreamingApiGenerator } from "./streaming-executor.js";
10
- /**
11
- * Execute any compiled API (regular or streaming).
12
- *
13
- * This unified function detects whether the API is streaming or regular
14
- * and returns the appropriate result type:
15
- *
16
- * - **Regular APIs**: Returns `Promise<ExecuteApiResponse<TOutput>>`
17
- * - **Streaming APIs**: Returns `AsyncGenerator<TChunk>`
18
- *
19
- * @param api - The compiled API definition (regular or streaming)
20
- * @param request - The execution request
21
- * @returns Promise for regular APIs, AsyncGenerator for streaming APIs
22
- *
23
- * @example Regular API
24
- * ```typescript
25
- * const response = await execute(myApi, {
26
- * input: { userId: '123' },
27
- * integrations: [...],
28
- * executionId: 'exec_abc',
29
- * env: {},
30
- * executeQuery: async (id, req) => orchestrator.execute(id, req),
31
- * });
32
- *
33
- * if (response.success) {
34
- * console.log(response.output);
35
- * }
36
- * ```
37
- *
38
- * @example Streaming API
39
- * ```typescript
40
- * const stream = execute(myStreamingApi, {
41
- * input: { prompt: 'Hello' },
42
- * integrations: [...],
43
- * executionId: 'exec_abc',
44
- * env: {},
45
- * executeQuery: async (id, req) => orchestrator.execute(id, req),
46
- * executeStreamingQuery: (id, req) => orchestrator.stream(id, req),
47
- * });
48
- *
49
- * for await (const chunk of stream) {
50
- * console.log(chunk.text);
51
- * }
52
- * ```
53
- */
54
- export function execute(api, request) {
55
- if (isStreamingApi(api)) {
56
- // Streaming API - return generator directly
57
- return createStreamingApiGenerator(api, request);
58
- }
59
- else {
60
- // Regular API - return promise
61
- return executeApi(api, request);
62
- }
63
- }
64
- /**
65
- * Type guard to check if an API is a streaming API.
66
- *
67
- * Use this to determine which result type you'll get from `execute()`.
68
- *
69
- * @param api - The API to check
70
- * @returns `true` if the API is a streaming API
71
- *
72
- * @example
73
- * ```typescript
74
- * if (isStreamingApi(api)) {
75
- * const stream = execute(api, request);
76
- * for await (const chunk of stream) { ... }
77
- * } else {
78
- * const response = await execute(api, request);
79
- * if (response.success) { ... }
80
- * }
81
- * ```
82
- */
83
- export { isStreamingApi };
84
- //# sourceMappingURL=execute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/runtime/execute.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAA6B,MAAM,qBAAqB,CAAC;AAIhF,OAAO,EAAE,UAAU,EAA2B,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AA8HtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,OAAO,CACrB,GAAmB,EACnB,OAAiC;IAIjC,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,4CAA4C;QAC5C,OAAO,2BAA2B,CAChC,GAA6C,EAC7C,OAAO,CACR,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,+BAA+B;QAC/B,OAAO,UAAU,CAAC,GAAoC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,49 +0,0 @@
1
- /**
2
- * Streaming API execution context factory.
3
- *
4
- * Creates the context object for streaming API functions, providing
5
- * access to integrations (with streaming support), logging, and environment.
6
- */
7
- import type { IntegrationDeclaration } from "../integrations/declarations.js";
8
- import { type TraceMetadata } from "../integrations/registry.js";
9
- import type { IntegrationConfig } from "../integrations/types.js";
10
- import type { ApiContext, ApiUser, Logger, AnyIntegrationRef } from "../types.js";
11
- /**
12
- * Options for creating a streaming API execution context.
13
- */
14
- export interface CreateStreamingContextOptions {
15
- /** Available integration configurations keyed by id */
16
- integrations: Map<string, IntegrationConfig>;
17
- /**
18
- * Declared integrations from the API config.
19
- */
20
- integrationDeclarations: IntegrationDeclaration[];
21
- /**
22
- * Function to execute integration operations (non-streaming).
23
- */
24
- executeQuery: (integrationId: string, request: Record<string, unknown>, bindings?: Record<string, unknown>, metadata?: TraceMetadata) => Promise<unknown>;
25
- /**
26
- * Function to execute streaming integration operations.
27
- * Optional - if not provided, streaming operations will throw an error.
28
- */
29
- executeStreamingQuery?: (integrationId: string, request: Record<string, unknown>, metadata?: TraceMetadata) => AsyncIterable<unknown>;
30
- /** Execution ID for logging correlation */
31
- executionId: string;
32
- /** Environment variables */
33
- env: Record<string, string>;
34
- /** User information from JWT */
35
- user: ApiUser;
36
- /** Optional custom logger */
37
- logger?: Logger;
38
- }
39
- /**
40
- * Creates a streaming API execution context.
41
- *
42
- * Similar to createApiContext but supports streaming query execution
43
- * for integration clients that support it.
44
- *
45
- * @param options - Context creation options
46
- * @returns The API context for streaming API execution
47
- */
48
- export declare function createStreamingApiContext(options: CreateStreamingContextOptions): ApiContext<Record<string, AnyIntegrationRef>>;
49
- //# sourceMappingURL=streaming-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"streaming-context.d.ts","sourceRoot":"","sources":["../../src/runtime/streaming-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,MAAM,EACN,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,uDAAuD;IACvD,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAE7C;;OAEG;IACH,uBAAuB,EAAE,sBAAsB,EAAE,CAAC;IAElD;;OAEG;IACH,YAAY,EAAE,CACZ,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,QAAQ,CAAC,EAAE,aAAa,KACrB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,CACtB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,CAAC,EAAE,aAAa,KACrB,aAAa,CAAC,OAAO,CAAC,CAAC;IAE5B,2CA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