@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
|
@@ -1,71 +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 { createClient, } from "../integrations/registry.js";
|
|
8
|
-
import { createDefaultLogger } from "./logger.js";
|
|
9
|
-
/**
|
|
10
|
-
* Creates a streaming API execution context.
|
|
11
|
-
*
|
|
12
|
-
* Similar to createApiContext but supports streaming query execution
|
|
13
|
-
* for integration clients that support it.
|
|
14
|
-
*
|
|
15
|
-
* @param options - Context creation options
|
|
16
|
-
* @returns The API context for streaming API execution
|
|
17
|
-
*/
|
|
18
|
-
export function createStreamingApiContext(options) {
|
|
19
|
-
const { integrations, integrationDeclarations, executeQuery, executeStreamingQuery, executionId, env, user, logger, } = options;
|
|
20
|
-
// Cache for created integration clients
|
|
21
|
-
const clientCache = new Map();
|
|
22
|
-
// Create logger
|
|
23
|
-
const log = logger ?? createDefaultLogger(executionId);
|
|
24
|
-
/**
|
|
25
|
-
* Gets or creates a typed integration client by id and plugin ID.
|
|
26
|
-
* Supports streaming execution if provided.
|
|
27
|
-
*/
|
|
28
|
-
function getTypedClient(id, pluginId) {
|
|
29
|
-
const cached = clientCache.get(id);
|
|
30
|
-
if (cached) {
|
|
31
|
-
return cached;
|
|
32
|
-
}
|
|
33
|
-
const config = integrations.get(id);
|
|
34
|
-
// Create executor bound to this integration
|
|
35
|
-
const boundExecutor = (request, bindings, metadata) => executeQuery(id, request, bindings, metadata);
|
|
36
|
-
// Create streaming executor if provided
|
|
37
|
-
const boundStreamingExecutor = executeStreamingQuery
|
|
38
|
-
? (request, metadata) => executeStreamingQuery(id, request, metadata)
|
|
39
|
-
: undefined;
|
|
40
|
-
const clientConfig = config ?? {
|
|
41
|
-
id,
|
|
42
|
-
name: id,
|
|
43
|
-
pluginId,
|
|
44
|
-
configuration: {},
|
|
45
|
-
};
|
|
46
|
-
// Create client with streaming support
|
|
47
|
-
const client = createClient({
|
|
48
|
-
config: clientConfig,
|
|
49
|
-
executeQuery: boundExecutor,
|
|
50
|
-
executeStreamingQuery: boundStreamingExecutor,
|
|
51
|
-
});
|
|
52
|
-
clientCache.set(id, client);
|
|
53
|
-
return client;
|
|
54
|
-
}
|
|
55
|
-
// Build the integrations object from declarations
|
|
56
|
-
const integrationsObject = {};
|
|
57
|
-
for (const declaration of integrationDeclarations) {
|
|
58
|
-
Object.defineProperty(integrationsObject, declaration.key, {
|
|
59
|
-
get: () => getTypedClient(declaration.id, declaration.pluginId),
|
|
60
|
-
enumerable: true,
|
|
61
|
-
configurable: false,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
integrations: integrationsObject,
|
|
66
|
-
log,
|
|
67
|
-
env: Object.freeze({ ...env }),
|
|
68
|
-
user,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=streaming-context.js.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YAChD,EAAE;YACF,IAAI,EAAE,EAAE;YACR,QAAQ;YACR,aAAa,EAAE,EAAE;SAClB,CAAC;QAEF,uCAAuC;QACvC,MAAM,MAAM,GAAG,YAAY,CAAC;YAC1B,MAAM,EAAE,YAAY;YACpB,YAAY,EAAE,aAAa;YAC3B,qBAAqB,EAAE,sBAAsB;SAC9C,CAAC,CAAC;QAEH,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,kDAAkD;IAClD,MAAM,kBAAkB,GAA0C,EAAE,CAAC;IAErE,KAAK,MAAM,WAAW,IAAI,uBAAuB,EAAE,CAAC;QAClD,MAAM,CAAC,cAAc,CAAC,kBAAkB,EAAE,WAAW,CAAC,GAAG,EAAE;YACzD,GAAG,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,EAAE,WAAW,CAAC,QAAQ,CAAC;YAC/D,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,YAAY,EAAE,kBAEG;QACjB,GAAG;QACH,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC;QAC9B,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Streaming API execution engine.
|
|
3
|
-
*
|
|
4
|
-
* Provides the entry point for executing compiled streaming APIs,
|
|
5
|
-
* handling input validation, chunk validation, and error management.
|
|
6
|
-
*/
|
|
7
|
-
import type { CompiledStreamingApi } from "../api/streaming.js";
|
|
8
|
-
import type { TraceMetadata } from "../integrations/registry.js";
|
|
9
|
-
import type { IntegrationConfig } from "../integrations/types.js";
|
|
10
|
-
import type { ApiUser } from "../types.js";
|
|
11
|
-
import { type ErrorCodeType } from "./errors.js";
|
|
12
|
-
/**
|
|
13
|
-
* Request to execute a streaming API.
|
|
14
|
-
*/
|
|
15
|
-
export interface ExecuteStreamingApiRequest {
|
|
16
|
-
/** Raw input data to be validated */
|
|
17
|
-
input: unknown;
|
|
18
|
-
/** Available integration configurations */
|
|
19
|
-
integrations: IntegrationConfig[];
|
|
20
|
-
/** Unique execution ID for tracing */
|
|
21
|
-
executionId: string;
|
|
22
|
-
/** Environment variables available to the API */
|
|
23
|
-
env: Record<string, string>;
|
|
24
|
-
/** User information extracted from the Superblocks JWT */
|
|
25
|
-
user: ApiUser;
|
|
26
|
-
/**
|
|
27
|
-
* Function to execute integration operations (non-streaming).
|
|
28
|
-
*
|
|
29
|
-
* @param integrationId - The integration ID
|
|
30
|
-
* @param request - Plugin-specific request object
|
|
31
|
-
* @param bindings - Optional bindings for language plugins
|
|
32
|
-
* @returns Promise resolving to the operation result
|
|
33
|
-
*/
|
|
34
|
-
executeQuery: (integrationId: string, request: Record<string, unknown>, bindings?: Record<string, unknown>, metadata?: TraceMetadata) => Promise<unknown>;
|
|
35
|
-
/**
|
|
36
|
-
* Function to execute streaming integration operations.
|
|
37
|
-
*
|
|
38
|
-
* @param integrationId - The integration ID
|
|
39
|
-
* @param request - Plugin-specific request object
|
|
40
|
-
* @param metadata - Optional trace metadata for diagnostics
|
|
41
|
-
* @returns AsyncIterable yielding raw chunks
|
|
42
|
-
*/
|
|
43
|
-
executeStreamingQuery?: (integrationId: string, request: Record<string, unknown>, metadata?: TraceMetadata) => AsyncIterable<unknown>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Callback handlers for streaming API execution.
|
|
47
|
-
*/
|
|
48
|
-
export interface StreamingApiCallbacks<TChunk = unknown> {
|
|
49
|
-
/**
|
|
50
|
-
* Called for each validated chunk.
|
|
51
|
-
*
|
|
52
|
-
* @param chunk - The validated chunk
|
|
53
|
-
* @param index - Zero-based index of this chunk
|
|
54
|
-
*/
|
|
55
|
-
onChunk: (chunk: TChunk, index: number) => void;
|
|
56
|
-
/**
|
|
57
|
-
* Called when the stream completes successfully.
|
|
58
|
-
*
|
|
59
|
-
* @param totalChunks - Total number of chunks yielded
|
|
60
|
-
*/
|
|
61
|
-
onComplete?: (totalChunks: number) => void;
|
|
62
|
-
/**
|
|
63
|
-
* Called when an error occurs.
|
|
64
|
-
*
|
|
65
|
-
* @param error - The error that occurred
|
|
66
|
-
*/
|
|
67
|
-
onError?: (error: StreamingApiError) => void;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Error details for streaming API execution.
|
|
71
|
-
*/
|
|
72
|
-
export interface StreamingApiError {
|
|
73
|
-
code: ErrorCodeType;
|
|
74
|
-
message: string;
|
|
75
|
-
details?: unknown;
|
|
76
|
-
/** Number of chunks successfully yielded before the error */
|
|
77
|
-
chunksYielded?: number;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Result of streaming API execution.
|
|
81
|
-
*
|
|
82
|
-
* Uses a discriminated union to prevent impossible states
|
|
83
|
-
* like `{ success: true, error: {...} }`.
|
|
84
|
-
*/
|
|
85
|
-
export type ExecuteStreamingApiResult = {
|
|
86
|
-
success: true;
|
|
87
|
-
totalChunks: number;
|
|
88
|
-
} | {
|
|
89
|
-
success: false;
|
|
90
|
-
totalChunks: number;
|
|
91
|
-
error: StreamingApiError;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Executes a compiled streaming API with the given request.
|
|
95
|
-
*
|
|
96
|
-
* This function handles:
|
|
97
|
-
* 1. Input validation against the API's Zod schema
|
|
98
|
-
* 2. Context creation with integration clients
|
|
99
|
-
* 3. Iterating over the async generator
|
|
100
|
-
* 4. Chunk validation against the API's chunk schema
|
|
101
|
-
* 5. Calling callbacks for chunks, completion, and errors
|
|
102
|
-
*
|
|
103
|
-
* @param api - The compiled streaming API definition
|
|
104
|
-
* @param request - The execution request
|
|
105
|
-
* @param callbacks - Callbacks for chunks, completion, and errors
|
|
106
|
-
* @returns Promise resolving to execution result
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```typescript
|
|
110
|
-
* import { streamingApi, z, executeStreamingApi } from '@superblocksteam/sdk-api';
|
|
111
|
-
*
|
|
112
|
-
* const myApi = streamingApi({
|
|
113
|
-
* input: z.object({ prompt: z.string() }),
|
|
114
|
-
* chunk: z.object({ text: z.string() }),
|
|
115
|
-
* async *run(ctx) {
|
|
116
|
-
* yield { text: 'Hello' };
|
|
117
|
-
* yield { text: ' World' };
|
|
118
|
-
* },
|
|
119
|
-
* });
|
|
120
|
-
*
|
|
121
|
-
* const result = await executeStreamingApi(
|
|
122
|
-
* myApi,
|
|
123
|
-
* {
|
|
124
|
-
* input: { prompt: 'Hi' },
|
|
125
|
-
* integrations: [],
|
|
126
|
-
* executionId: 'exec_123',
|
|
127
|
-
* env: {},
|
|
128
|
-
* executeQuery: async () => ({}),
|
|
129
|
-
* },
|
|
130
|
-
* {
|
|
131
|
-
* onChunk: (chunk, index) => console.log(`Chunk ${index}:`, chunk),
|
|
132
|
-
* onComplete: (total) => console.log(`Stream completed with ${total} chunks`),
|
|
133
|
-
* onError: (error) => console.error('Stream error:', error),
|
|
134
|
-
* }
|
|
135
|
-
* );
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
export declare function executeStreamingApi<TInput = unknown, TChunk = unknown>(api: CompiledStreamingApi<TInput, TChunk>, request: ExecuteStreamingApiRequest, callbacks: StreamingApiCallbacks<TChunk>): Promise<ExecuteStreamingApiResult>;
|
|
139
|
-
/**
|
|
140
|
-
* Creates an async generator that wraps streaming API execution.
|
|
141
|
-
*
|
|
142
|
-
* This is an alternative interface for consuming streaming APIs that returns
|
|
143
|
-
* an AsyncGenerator directly, rather than using callbacks.
|
|
144
|
-
*
|
|
145
|
-
* @param api - The compiled streaming API definition
|
|
146
|
-
* @param request - The execution request
|
|
147
|
-
* @returns AsyncGenerator yielding validated chunks
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```typescript
|
|
151
|
-
* const generator = createStreamingApiGenerator(myApi, request);
|
|
152
|
-
*
|
|
153
|
-
* for await (const chunk of generator) {
|
|
154
|
-
* console.log('Received chunk:', chunk);
|
|
155
|
-
* }
|
|
156
|
-
* ```
|
|
157
|
-
*/
|
|
158
|
-
export declare function createStreamingApiGenerator<TInput = unknown, TChunk = unknown>(api: CompiledStreamingApi<TInput, TChunk>, request: ExecuteStreamingApiRequest): AsyncGenerator<TChunk, void, undefined>;
|
|
159
|
-
//# sourceMappingURL=streaming-executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-executor.d.ts","sourceRoot":"","sources":["../../src/runtime/streaming-executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,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,EAKL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAMrB;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,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,KACr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,MAAM,CAAC,GACvC,OAAO,CAAC,yBAAyB,CAAC,CAkHpC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAuB,2BAA2B,CAChD,MAAM,GAAG,OAAO,EAChB,MAAM,GAAG,OAAO,EAEhB,GAAG,EAAE,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,OAAO,EAAE,0BAA0B,GAClC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAuDzC"}
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Streaming API execution engine.
|
|
3
|
-
*
|
|
4
|
-
* Provides the entry point for executing compiled streaming APIs,
|
|
5
|
-
* handling input validation, chunk validation, and error management.
|
|
6
|
-
*/
|
|
7
|
-
import { getIntegrationDeclarations } from "../integrations/declarations.js";
|
|
8
|
-
import { SdkError, InputValidationError, ExecutionError, ErrorCode, } from "./errors.js";
|
|
9
|
-
import { createStreamingApiContext, } from "./streaming-context.js";
|
|
10
|
-
/**
|
|
11
|
-
* Executes a compiled streaming API with the given request.
|
|
12
|
-
*
|
|
13
|
-
* This function handles:
|
|
14
|
-
* 1. Input validation against the API's Zod schema
|
|
15
|
-
* 2. Context creation with integration clients
|
|
16
|
-
* 3. Iterating over the async generator
|
|
17
|
-
* 4. Chunk validation against the API's chunk schema
|
|
18
|
-
* 5. Calling callbacks for chunks, completion, and errors
|
|
19
|
-
*
|
|
20
|
-
* @param api - The compiled streaming API definition
|
|
21
|
-
* @param request - The execution request
|
|
22
|
-
* @param callbacks - Callbacks for chunks, completion, and errors
|
|
23
|
-
* @returns Promise resolving to execution result
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```typescript
|
|
27
|
-
* import { streamingApi, z, executeStreamingApi } from '@superblocksteam/sdk-api';
|
|
28
|
-
*
|
|
29
|
-
* const myApi = streamingApi({
|
|
30
|
-
* input: z.object({ prompt: z.string() }),
|
|
31
|
-
* chunk: z.object({ text: z.string() }),
|
|
32
|
-
* async *run(ctx) {
|
|
33
|
-
* yield { text: 'Hello' };
|
|
34
|
-
* yield { text: ' World' };
|
|
35
|
-
* },
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* const result = await executeStreamingApi(
|
|
39
|
-
* myApi,
|
|
40
|
-
* {
|
|
41
|
-
* input: { prompt: 'Hi' },
|
|
42
|
-
* integrations: [],
|
|
43
|
-
* executionId: 'exec_123',
|
|
44
|
-
* env: {},
|
|
45
|
-
* executeQuery: async () => ({}),
|
|
46
|
-
* },
|
|
47
|
-
* {
|
|
48
|
-
* onChunk: (chunk, index) => console.log(`Chunk ${index}:`, chunk),
|
|
49
|
-
* onComplete: (total) => console.log(`Stream completed with ${total} chunks`),
|
|
50
|
-
* onError: (error) => console.error('Stream error:', error),
|
|
51
|
-
* }
|
|
52
|
-
* );
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export async function executeStreamingApi(api, request, callbacks) {
|
|
56
|
-
let totalChunks = 0;
|
|
57
|
-
try {
|
|
58
|
-
// 1. Validate input
|
|
59
|
-
const inputResult = api.inputSchema.safeParse(request.input);
|
|
60
|
-
if (!inputResult.success) {
|
|
61
|
-
const error = {
|
|
62
|
-
code: ErrorCode.INPUT_VALIDATION,
|
|
63
|
-
message: "Input validation failed",
|
|
64
|
-
details: { issues: inputResult.error.issues },
|
|
65
|
-
chunksYielded: 0,
|
|
66
|
-
};
|
|
67
|
-
callbacks.onError?.(error);
|
|
68
|
-
return { success: false, totalChunks: 0, error };
|
|
69
|
-
}
|
|
70
|
-
// 2. Build integration map (keyed by id)
|
|
71
|
-
const integrations = new Map();
|
|
72
|
-
for (const config of request.integrations) {
|
|
73
|
-
integrations.set(config.id, config);
|
|
74
|
-
}
|
|
75
|
-
// 3. Create execution context with streaming support
|
|
76
|
-
const contextOptions = {
|
|
77
|
-
integrations,
|
|
78
|
-
integrationDeclarations: getIntegrationDeclarations(api),
|
|
79
|
-
executeQuery: request.executeQuery,
|
|
80
|
-
executeStreamingQuery: request.executeStreamingQuery,
|
|
81
|
-
executionId: request.executionId,
|
|
82
|
-
env: request.env,
|
|
83
|
-
user: request.user,
|
|
84
|
-
};
|
|
85
|
-
const ctx = createStreamingApiContext(contextOptions);
|
|
86
|
-
// 4. Execute the streaming API
|
|
87
|
-
let iterator;
|
|
88
|
-
try {
|
|
89
|
-
iterator = api.run(ctx, inputResult.data);
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
if (err instanceof SdkError) {
|
|
93
|
-
const error = {
|
|
94
|
-
code: err.code,
|
|
95
|
-
message: err.message,
|
|
96
|
-
details: err.details,
|
|
97
|
-
chunksYielded: 0,
|
|
98
|
-
};
|
|
99
|
-
callbacks.onError?.(error);
|
|
100
|
-
return { success: false, totalChunks: 0, error };
|
|
101
|
-
}
|
|
102
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
103
|
-
const error = {
|
|
104
|
-
code: ErrorCode.EXECUTION_ERROR,
|
|
105
|
-
message,
|
|
106
|
-
details: { cause: err },
|
|
107
|
-
chunksYielded: 0,
|
|
108
|
-
};
|
|
109
|
-
callbacks.onError?.(error);
|
|
110
|
-
return { success: false, totalChunks: 0, error };
|
|
111
|
-
}
|
|
112
|
-
// 5. Iterate over chunks, validate, and call callbacks
|
|
113
|
-
for await (const rawChunk of iterator) {
|
|
114
|
-
// Validate chunk against schema
|
|
115
|
-
const chunkResult = api.chunkSchema.safeParse(rawChunk);
|
|
116
|
-
if (!chunkResult.success) {
|
|
117
|
-
const error = {
|
|
118
|
-
code: ErrorCode.OUTPUT_VALIDATION,
|
|
119
|
-
message: `Chunk validation failed at index ${totalChunks}`,
|
|
120
|
-
details: {
|
|
121
|
-
issues: chunkResult.error.issues,
|
|
122
|
-
chunkIndex: totalChunks,
|
|
123
|
-
rawChunk,
|
|
124
|
-
},
|
|
125
|
-
chunksYielded: totalChunks,
|
|
126
|
-
};
|
|
127
|
-
callbacks.onError?.(error);
|
|
128
|
-
return { success: false, totalChunks, error };
|
|
129
|
-
}
|
|
130
|
-
// Call chunk callback
|
|
131
|
-
callbacks.onChunk(chunkResult.data, totalChunks);
|
|
132
|
-
totalChunks++;
|
|
133
|
-
}
|
|
134
|
-
// 6. Stream completed successfully
|
|
135
|
-
callbacks.onComplete?.(totalChunks);
|
|
136
|
-
return { success: true, totalChunks };
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
// Handle unexpected errors
|
|
140
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
141
|
-
let error;
|
|
142
|
-
if (err instanceof SdkError) {
|
|
143
|
-
error = {
|
|
144
|
-
code: err.code,
|
|
145
|
-
message: err.message,
|
|
146
|
-
details: err.details,
|
|
147
|
-
chunksYielded: totalChunks,
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
error = {
|
|
152
|
-
code: ErrorCode.INTERNAL_ERROR,
|
|
153
|
-
message: `Unexpected error: ${message}`,
|
|
154
|
-
details: err instanceof Error ? { stack: err.stack } : undefined,
|
|
155
|
-
chunksYielded: totalChunks,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
callbacks.onError?.(error);
|
|
159
|
-
return { success: false, totalChunks, error };
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Creates an async generator that wraps streaming API execution.
|
|
164
|
-
*
|
|
165
|
-
* This is an alternative interface for consuming streaming APIs that returns
|
|
166
|
-
* an AsyncGenerator directly, rather than using callbacks.
|
|
167
|
-
*
|
|
168
|
-
* @param api - The compiled streaming API definition
|
|
169
|
-
* @param request - The execution request
|
|
170
|
-
* @returns AsyncGenerator yielding validated chunks
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* ```typescript
|
|
174
|
-
* const generator = createStreamingApiGenerator(myApi, request);
|
|
175
|
-
*
|
|
176
|
-
* for await (const chunk of generator) {
|
|
177
|
-
* console.log('Received chunk:', chunk);
|
|
178
|
-
* }
|
|
179
|
-
* ```
|
|
180
|
-
*/
|
|
181
|
-
export async function* createStreamingApiGenerator(api, request) {
|
|
182
|
-
// Validate input
|
|
183
|
-
const inputResult = api.inputSchema.safeParse(request.input);
|
|
184
|
-
if (!inputResult.success) {
|
|
185
|
-
throw new InputValidationError("Input validation failed", {
|
|
186
|
-
issues: inputResult.error.issues,
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
// Build integration map
|
|
190
|
-
const integrations = new Map();
|
|
191
|
-
for (const config of request.integrations) {
|
|
192
|
-
integrations.set(config.id, config);
|
|
193
|
-
}
|
|
194
|
-
// Create execution context
|
|
195
|
-
const ctx = createStreamingApiContext({
|
|
196
|
-
integrations,
|
|
197
|
-
integrationDeclarations: getIntegrationDeclarations(api),
|
|
198
|
-
executeQuery: request.executeQuery,
|
|
199
|
-
executeStreamingQuery: request.executeStreamingQuery,
|
|
200
|
-
executionId: request.executionId,
|
|
201
|
-
env: request.env,
|
|
202
|
-
user: request.user,
|
|
203
|
-
});
|
|
204
|
-
// Execute and yield validated chunks
|
|
205
|
-
let chunkIndex = 0;
|
|
206
|
-
try {
|
|
207
|
-
const iterator = api.run(ctx, inputResult.data);
|
|
208
|
-
for await (const rawChunk of iterator) {
|
|
209
|
-
const chunkResult = api.chunkSchema.safeParse(rawChunk);
|
|
210
|
-
if (!chunkResult.success) {
|
|
211
|
-
throw new SdkError(ErrorCode.OUTPUT_VALIDATION, `Chunk validation failed at index ${chunkIndex}`, {
|
|
212
|
-
issues: chunkResult.error.issues,
|
|
213
|
-
chunkIndex,
|
|
214
|
-
rawChunk,
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
yield chunkResult.data;
|
|
218
|
-
chunkIndex++;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
catch (err) {
|
|
222
|
-
if (err instanceof SdkError) {
|
|
223
|
-
throw err;
|
|
224
|
-
}
|
|
225
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
226
|
-
throw new ExecutionError(message, err);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
//# sourceMappingURL=streaming-executor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-executor.js","sourceRoot":"","sources":["../../src/runtime/streaming-executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAI7E,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,cAAc,EACd,SAAS,GAEV,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,yBAAyB,GAE1B,MAAM,wBAAwB,CAAC;AAmGhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAyC,EACzC,OAAmC,EACnC,SAAwC;IAExC,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,IAAI,CAAC;QACH,oBAAoB;QACpB,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC7D,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YACzB,MAAM,KAAK,GAAsB;gBAC/B,IAAI,EAAE,SAAS,CAAC,gBAAgB;gBAChC,OAAO,EAAE,yBAAyB;gBAClC,OAAO,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE;gBAC7C,aAAa,EAAE,CAAC;aACjB,CAAC;YACF,SAAS,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YAC3B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;QACnD,CAAC;QAED,yCAAyC;QACzC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA6B,CAAC;QAC1D,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YAC1C,YAAY,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