@superblocksteam/sdk-api 2.0.96 → 2.0.97-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 +68 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/athena/client.d.ts +3 -3
- package/dist/integrations/athena/client.d.ts.map +1 -1
- package/dist/integrations/athena/client.js +4 -4
- package/dist/integrations/athena/client.js.map +1 -1
- package/dist/integrations/athena/types.d.ts +3 -2
- package/dist/integrations/athena/types.d.ts.map +1 -1
- package/dist/integrations/base/graphql-integration-client.d.ts +5 -3
- package/dist/integrations/base/graphql-integration-client.d.ts.map +1 -1
- package/dist/integrations/base/graphql-integration-client.js +8 -6
- package/dist/integrations/base/graphql-integration-client.js.map +1 -1
- package/dist/integrations/base/rest-api-integration-client.d.ts +6 -4
- package/dist/integrations/base/rest-api-integration-client.d.ts.map +1 -1
- package/dist/integrations/base/rest-api-integration-client.js +7 -5
- package/dist/integrations/base/rest-api-integration-client.js.map +1 -1
- package/dist/integrations/base/types.d.ts +9 -4
- package/dist/integrations/base/types.d.ts.map +1 -1
- package/dist/integrations/bigquery/client.d.ts +3 -3
- package/dist/integrations/bigquery/client.d.ts.map +1 -1
- package/dist/integrations/bigquery/client.js +4 -4
- package/dist/integrations/bigquery/client.js.map +1 -1
- package/dist/integrations/bigquery/types.d.ts +3 -2
- package/dist/integrations/bigquery/types.d.ts.map +1 -1
- package/dist/integrations/cockroachdb/client.d.ts +3 -3
- package/dist/integrations/cockroachdb/client.d.ts.map +1 -1
- package/dist/integrations/cockroachdb/client.js +4 -4
- package/dist/integrations/cockroachdb/client.js.map +1 -1
- package/dist/integrations/cockroachdb/types.d.ts +3 -2
- package/dist/integrations/cockroachdb/types.d.ts.map +1 -1
- package/dist/integrations/cosmosdb/client.d.ts +7 -7
- package/dist/integrations/cosmosdb/client.d.ts.map +1 -1
- package/dist/integrations/cosmosdb/client.js +14 -14
- package/dist/integrations/cosmosdb/client.js.map +1 -1
- package/dist/integrations/cosmosdb/types.d.ts +12 -6
- package/dist/integrations/cosmosdb/types.d.ts.map +1 -1
- package/dist/integrations/couchbase/client.d.ts +5 -5
- package/dist/integrations/couchbase/client.d.ts.map +1 -1
- package/dist/integrations/couchbase/client.js +8 -8
- package/dist/integrations/couchbase/client.js.map +1 -1
- package/dist/integrations/couchbase/types.d.ts +8 -4
- package/dist/integrations/couchbase/types.d.ts.map +1 -1
- package/dist/integrations/databricks/client.d.ts +3 -3
- package/dist/integrations/databricks/client.d.ts.map +1 -1
- package/dist/integrations/databricks/client.js +4 -4
- package/dist/integrations/databricks/client.js.map +1 -1
- package/dist/integrations/databricks/types.d.ts +3 -2
- package/dist/integrations/databricks/types.d.ts.map +1 -1
- package/dist/integrations/dynamodb/client.d.ts +12 -12
- package/dist/integrations/dynamodb/client.d.ts.map +1 -1
- package/dist/integrations/dynamodb/client.js +24 -24
- package/dist/integrations/dynamodb/client.js.map +1 -1
- package/dist/integrations/dynamodb/types.d.ts +28 -14
- package/dist/integrations/dynamodb/types.d.ts.map +1 -1
- package/dist/integrations/gcs/client.d.ts +8 -8
- package/dist/integrations/gcs/client.d.ts.map +1 -1
- package/dist/integrations/gcs/client.js +16 -16
- package/dist/integrations/gcs/client.js.map +1 -1
- package/dist/integrations/gcs/types.d.ts +14 -7
- package/dist/integrations/gcs/types.d.ts.map +1 -1
- package/dist/integrations/graphql/types.d.ts +11 -4
- package/dist/integrations/graphql/types.d.ts.map +1 -1
- package/dist/integrations/gsheets/client.d.ts +2 -2
- package/dist/integrations/gsheets/client.d.ts.map +1 -1
- package/dist/integrations/gsheets/client.js +2 -2
- package/dist/integrations/gsheets/client.js.map +1 -1
- package/dist/integrations/gsheets/types.d.ts +2 -1
- package/dist/integrations/gsheets/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/kafka/client.d.ts +3 -3
- package/dist/integrations/kafka/client.d.ts.map +1 -1
- package/dist/integrations/kafka/client.js +6 -6
- package/dist/integrations/kafka/client.js.map +1 -1
- package/dist/integrations/kafka/types.d.ts +4 -2
- package/dist/integrations/kafka/types.d.ts.map +1 -1
- package/dist/integrations/kinesis/client.d.ts +3 -3
- package/dist/integrations/kinesis/client.d.ts.map +1 -1
- package/dist/integrations/kinesis/client.js +6 -6
- package/dist/integrations/kinesis/client.js.map +1 -1
- package/dist/integrations/kinesis/types.d.ts +4 -2
- package/dist/integrations/kinesis/types.d.ts.map +1 -1
- package/dist/integrations/lakebase/client.d.ts +3 -3
- package/dist/integrations/lakebase/client.d.ts.map +1 -1
- package/dist/integrations/lakebase/client.js +4 -4
- package/dist/integrations/lakebase/client.js.map +1 -1
- package/dist/integrations/lakebase/types.d.ts +3 -2
- package/dist/integrations/lakebase/types.d.ts.map +1 -1
- package/dist/integrations/mariadb/client.d.ts +3 -3
- package/dist/integrations/mariadb/client.d.ts.map +1 -1
- package/dist/integrations/mariadb/client.js +4 -4
- package/dist/integrations/mariadb/client.js.map +1 -1
- package/dist/integrations/mariadb/types.d.ts +3 -2
- package/dist/integrations/mariadb/types.d.ts.map +1 -1
- package/dist/integrations/mongodb/client.d.ts +2 -2
- package/dist/integrations/mongodb/client.d.ts.map +1 -1
- package/dist/integrations/mongodb/client.js +2 -2
- package/dist/integrations/mongodb/client.js.map +1 -1
- package/dist/integrations/mongodb/types.d.ts +2 -1
- package/dist/integrations/mongodb/types.d.ts.map +1 -1
- package/dist/integrations/mssql/client.d.ts +3 -3
- package/dist/integrations/mssql/client.d.ts.map +1 -1
- package/dist/integrations/mssql/client.js +4 -4
- package/dist/integrations/mssql/client.js.map +1 -1
- package/dist/integrations/mssql/types.d.ts +3 -2
- package/dist/integrations/mssql/types.d.ts.map +1 -1
- package/dist/integrations/mysql/client.d.ts +3 -3
- package/dist/integrations/mysql/client.d.ts.map +1 -1
- package/dist/integrations/mysql/client.js +4 -4
- package/dist/integrations/mysql/client.js.map +1 -1
- package/dist/integrations/mysql/types.d.ts +3 -2
- package/dist/integrations/mysql/types.d.ts.map +1 -1
- package/dist/integrations/oracledb/client.d.ts +3 -3
- package/dist/integrations/oracledb/client.d.ts.map +1 -1
- package/dist/integrations/oracledb/client.js +4 -4
- package/dist/integrations/oracledb/client.js.map +1 -1
- package/dist/integrations/oracledb/types.d.ts +3 -2
- package/dist/integrations/oracledb/types.d.ts.map +1 -1
- package/dist/integrations/postgres/client.d.ts +3 -3
- package/dist/integrations/postgres/client.d.ts.map +1 -1
- package/dist/integrations/postgres/client.js +4 -4
- package/dist/integrations/postgres/client.js.map +1 -1
- package/dist/integrations/postgres/types.d.ts +3 -2
- package/dist/integrations/postgres/types.d.ts.map +1 -1
- package/dist/integrations/python/client.d.ts +2 -2
- package/dist/integrations/python/client.d.ts.map +1 -1
- package/dist/integrations/python/client.js +2 -2
- package/dist/integrations/python/client.js.map +1 -1
- package/dist/integrations/python/types.d.ts +19 -2
- package/dist/integrations/python/types.d.ts.map +1 -1
- package/dist/integrations/redis/client.d.ts +12 -12
- package/dist/integrations/redis/client.d.ts.map +1 -1
- package/dist/integrations/redis/client.js +24 -24
- package/dist/integrations/redis/client.js.map +1 -1
- package/dist/integrations/redis/types.d.ts +22 -11
- package/dist/integrations/redis/types.d.ts.map +1 -1
- package/dist/integrations/redshift/client.d.ts +3 -3
- package/dist/integrations/redshift/client.d.ts.map +1 -1
- package/dist/integrations/redshift/client.js +4 -4
- package/dist/integrations/redshift/client.js.map +1 -1
- package/dist/integrations/redshift/types.d.ts +3 -2
- package/dist/integrations/redshift/types.d.ts.map +1 -1
- package/dist/integrations/registry.d.ts +21 -2
- package/dist/integrations/registry.d.ts.map +1 -1
- package/dist/integrations/registry.js.map +1 -1
- package/dist/integrations/s3/client.d.ts +8 -8
- package/dist/integrations/s3/client.d.ts.map +1 -1
- package/dist/integrations/s3/client.js +16 -16
- package/dist/integrations/s3/client.js.map +1 -1
- package/dist/integrations/s3/types.d.ts +14 -7
- package/dist/integrations/s3/types.d.ts.map +1 -1
- package/dist/integrations/salesforce/client.d.ts +10 -10
- package/dist/integrations/salesforce/client.d.ts.map +1 -1
- package/dist/integrations/salesforce/client.js +20 -20
- package/dist/integrations/salesforce/client.js.map +1 -1
- package/dist/integrations/salesforce/types.d.ts +18 -9
- package/dist/integrations/salesforce/types.d.ts.map +1 -1
- package/dist/integrations/smtp/client.d.ts +2 -2
- package/dist/integrations/smtp/client.d.ts.map +1 -1
- package/dist/integrations/smtp/client.js +2 -2
- package/dist/integrations/smtp/client.js.map +1 -1
- package/dist/integrations/smtp/types.d.ts +2 -1
- package/dist/integrations/smtp/types.d.ts.map +1 -1
- package/dist/integrations/snowflake/client.d.ts +3 -3
- package/dist/integrations/snowflake/client.d.ts.map +1 -1
- package/dist/integrations/snowflake/client.js +4 -4
- package/dist/integrations/snowflake/client.js.map +1 -1
- package/dist/integrations/snowflake/types.d.ts +3 -2
- package/dist/integrations/snowflake/types.d.ts.map +1 -1
- package/dist/integrations/snowflakepostgres/types.d.ts +3 -2
- package/dist/integrations/snowflakepostgres/types.d.ts.map +1 -1
- package/dist/runtime/context.d.ts +2 -1
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js +2 -2
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/execute.d.ts +4 -2
- package/dist/runtime/execute.d.ts.map +1 -1
- package/dist/runtime/execute.js.map +1 -1
- package/dist/runtime/executor.d.ts +2 -1
- package/dist/runtime/executor.d.ts.map +1 -1
- package/dist/runtime/executor.js.map +1 -1
- package/dist/runtime/streaming-context.d.ts +3 -2
- package/dist/runtime/streaming-context.d.ts.map +1 -1
- package/dist/runtime/streaming-context.js +2 -2
- package/dist/runtime/streaming-context.js.map +1 -1
- package/dist/runtime/streaming-executor.d.ts +4 -2
- package/dist/runtime/streaming-executor.d.ts.map +1 -1
- package/dist/runtime/streaming-executor.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/integrations/airtable/README.md +7 -3
- package/src/integrations/anthropic/README.md +8 -4
- package/src/integrations/asana/README.md +7 -3
- package/src/integrations/athena/README.md +8 -4
- package/src/integrations/athena/client.ts +5 -3
- package/src/integrations/athena/types.ts +7 -1
- package/src/integrations/base/graphql-integration-client.ts +9 -4
- package/src/integrations/base/rest-api-integration-client.ts +16 -3
- package/src/integrations/base/types.ts +9 -2
- package/src/integrations/bigquery/README.md +8 -4
- package/src/integrations/bigquery/client.ts +5 -3
- package/src/integrations/bigquery/types.ts +7 -1
- package/src/integrations/bitbucket/README.md +7 -3
- package/src/integrations/box/README.md +7 -3
- package/src/integrations/circleci/README.md +7 -3
- package/src/integrations/cockroachdb/README.md +8 -4
- package/src/integrations/cockroachdb/client.ts +5 -3
- package/src/integrations/cockroachdb/types.ts +7 -1
- package/src/integrations/cohere/README.md +7 -3
- package/src/integrations/confluence/README.md +7 -3
- package/src/integrations/cosmosdb/README.md +7 -3
- package/src/integrations/cosmosdb/client.ts +19 -8
- package/src/integrations/cosmosdb/types.ts +12 -0
- package/src/integrations/couchbase/README.md +10 -6
- package/src/integrations/couchbase/client.ts +23 -4
- package/src/integrations/couchbase/types.ts +12 -1
- package/src/integrations/databricks/README.md +8 -4
- package/src/integrations/databricks/client.ts +5 -3
- package/src/integrations/databricks/types.ts +7 -1
- package/src/integrations/datadog/README.md +7 -3
- package/src/integrations/dropbox/README.md +7 -3
- package/src/integrations/dynamodb/README.md +17 -13
- package/src/integrations/dynamodb/client.ts +52 -15
- package/src/integrations/dynamodb/types.ts +32 -6
- package/src/integrations/elasticsearch/README.md +7 -3
- package/src/integrations/fireworks/README.md +7 -3
- package/src/integrations/front/README.md +7 -3
- package/src/integrations/gcs/README.md +13 -9
- package/src/integrations/gcs/client.ts +61 -24
- package/src/integrations/gcs/types.ts +27 -4
- package/src/integrations/gemini/README.md +7 -3
- package/src/integrations/github/README.md +7 -3
- package/src/integrations/googleanalytics/README.md +7 -3
- package/src/integrations/googledrive/README.md +7 -3
- package/src/integrations/graphql/README.md +8 -4
- package/src/integrations/graphql/types.ts +11 -2
- package/src/integrations/groq/README.md +7 -3
- package/src/integrations/gsheets/README.md +7 -3
- package/src/integrations/gsheets/client.ts +4 -1
- package/src/integrations/gsheets/types.ts +2 -0
- package/src/integrations/hubspot/README.md +7 -3
- package/src/integrations/index.ts +1 -0
- package/src/integrations/intercom/README.md +7 -3
- package/src/integrations/jira/README.md +7 -3
- package/src/integrations/kafka/README.md +8 -4
- package/src/integrations/kafka/client.ts +8 -3
- package/src/integrations/kafka/types.ts +12 -2
- package/src/integrations/kinesis/README.md +8 -4
- package/src/integrations/kinesis/client.ts +13 -4
- package/src/integrations/kinesis/types.ts +10 -2
- package/src/integrations/lakebase/client.ts +7 -1
- package/src/integrations/lakebase/types.ts +7 -1
- package/src/integrations/launchdarkly/README.md +7 -3
- package/src/integrations/mariadb/README.md +8 -4
- package/src/integrations/mariadb/client.ts +5 -3
- package/src/integrations/mariadb/types.ts +7 -1
- package/src/integrations/mistral/README.md +7 -3
- package/src/integrations/mongodb/README.md +7 -3
- package/src/integrations/mongodb/client.ts +4 -1
- package/src/integrations/mongodb/types.ts +2 -0
- package/src/integrations/mssql/README.md +8 -4
- package/src/integrations/mssql/client.ts +5 -3
- package/src/integrations/mssql/types.ts +7 -1
- package/src/integrations/mysql/README.md +8 -4
- package/src/integrations/mysql/client.ts +5 -3
- package/src/integrations/mysql/types.ts +7 -1
- package/src/integrations/notion/README.md +7 -3
- package/src/integrations/openai_v2/README.md +8 -4
- package/src/integrations/oracledb/README.md +8 -4
- package/src/integrations/oracledb/client.ts +5 -3
- package/src/integrations/oracledb/types.ts +7 -1
- package/src/integrations/pagerduty/README.md +7 -3
- package/src/integrations/perplexity/README.md +7 -3
- package/src/integrations/postgres/README.md +28 -4
- package/src/integrations/postgres/client.ts +5 -3
- package/src/integrations/postgres/types.ts +7 -1
- package/src/integrations/python/README.md +20 -5
- package/src/integrations/python/client.ts +4 -1
- package/src/integrations/python/types.ts +19 -1
- package/src/integrations/redis/README.md +7 -3
- package/src/integrations/redis/client.ts +46 -23
- package/src/integrations/redis/types.ts +40 -11
- package/src/integrations/redshift/README.md +8 -4
- package/src/integrations/redshift/client.ts +5 -3
- package/src/integrations/redshift/types.ts +7 -1
- package/src/integrations/registry.ts +22 -0
- package/src/integrations/s3/README.md +13 -9
- package/src/integrations/s3/client.ts +61 -24
- package/src/integrations/s3/types.ts +27 -4
- package/src/integrations/salesforce/README.md +15 -11
- package/src/integrations/salesforce/client.ts +29 -12
- package/src/integrations/salesforce/types.ts +30 -3
- package/src/integrations/segment/README.md +7 -3
- package/src/integrations/sendgrid/README.md +7 -3
- package/src/integrations/slack/README.md +7 -3
- package/src/integrations/smtp/client.ts +10 -3
- package/src/integrations/smtp/types.ts +2 -1
- package/src/integrations/snowflake/README.md +8 -4
- package/src/integrations/snowflake/client.ts +5 -3
- package/src/integrations/snowflake/types.ts +7 -1
- package/src/integrations/snowflakepostgres/types.ts +7 -1
- package/src/integrations/stabilityai/README.md +7 -3
- package/src/integrations/stripe/README.md +7 -3
- package/src/integrations/superblocks-ocr/README.md +7 -3
- package/src/integrations/twilio/README.md +7 -3
- package/src/integrations/zendesk/README.md +7 -3
- package/src/integrations/zoom/README.md +7 -3
- package/src/runtime/context.ts +8 -2
- package/src/runtime/execute.ts +4 -0
- package/src/runtime/executor.ts +2 -0
- package/src/runtime/streaming-context.ts +7 -3
- package/src/runtime/streaming-executor.ts +4 -0
|
@@ -4,9 +4,9 @@ Execute MongoDB operations with full type safety and runtime validation.
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `run(collection, action, schema, params)` | Execute a MongoDB operation |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ---------------------------------------------------- | --------------------------- |
|
|
9
|
+
| `run(collection, action, schema, params, metadata?)` | Execute a MongoDB operation |
|
|
10
10
|
|
|
11
11
|
## Actions
|
|
12
12
|
|
|
@@ -215,6 +215,10 @@ const users = await ctx.integrations.mongodb.run("users", "find", UserSchema, {
|
|
|
215
215
|
| `skip` | `number` | Documents to skip |
|
|
216
216
|
| `field` | `string` | Field for distinct operation |
|
|
217
217
|
|
|
218
|
+
## Trace Metadata
|
|
219
|
+
|
|
220
|
+
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.
|
|
221
|
+
|
|
218
222
|
## Error Handling
|
|
219
223
|
|
|
220
224
|
```typescript
|
|
@@ -8,7 +8,7 @@ import type { z } from "zod";
|
|
|
8
8
|
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
9
9
|
import type { Plugin as MongoDBPlugin } from "@superblocksteam/types/dist/src/plugins/mongodb/v1/plugin_pb";
|
|
10
10
|
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
11
|
-
import type { QueryExecutor } from "../registry.js";
|
|
11
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
12
12
|
import { RestApiValidationError } from "../../errors.js";
|
|
13
13
|
import { IntegrationError } from "../../runtime/errors.js";
|
|
14
14
|
import type { MongoDBClient, MongoDBAction, MongoDBParams } from "./types.js";
|
|
@@ -98,12 +98,15 @@ export class MongoDBClientImpl implements MongoDBClient, IntegrationClientImpl {
|
|
|
98
98
|
action: MongoDBAction,
|
|
99
99
|
schema: z.ZodSchema<T>,
|
|
100
100
|
params?: MongoDBParams,
|
|
101
|
+
metadata?: TraceMetadata,
|
|
101
102
|
): Promise<T> {
|
|
102
103
|
const request = this.buildRequest(collection, action, params);
|
|
103
104
|
|
|
104
105
|
try {
|
|
105
106
|
const result = await this.executeQuery(
|
|
106
107
|
request as Record<string, unknown>,
|
|
108
|
+
undefined,
|
|
109
|
+
metadata,
|
|
107
110
|
);
|
|
108
111
|
|
|
109
112
|
// Validate result against schema
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type { z } from "zod";
|
|
6
6
|
import type { BaseIntegrationClient } from "../../types.js";
|
|
7
|
+
import type { TraceMetadata } from "../registry.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* MongoDB operation types.
|
|
@@ -99,5 +100,6 @@ export interface MongoDBClient extends BaseIntegrationClient {
|
|
|
99
100
|
action: MongoDBAction,
|
|
100
101
|
schema: z.ZodSchema<T>,
|
|
101
102
|
params?: MongoDBParams,
|
|
103
|
+
metadata?: TraceMetadata,
|
|
102
104
|
): Promise<T>;
|
|
103
105
|
}
|
|
@@ -4,10 +4,10 @@ Execute SQL queries and statements against Microsoft SQL Server databases with f
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `query<T>(sql, schema, params?)` | Execute a SELECT query and return validated, typed results |
|
|
10
|
-
| `execute(sql, params?)` | Execute a statement (INSERT, UPDATE, DELETE) and return affected row count |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ------------------------------------------- | -------------------------------------------------------------------------- |
|
|
9
|
+
| `query<T>(sql, schema, params?, metadata?)` | Execute a SELECT query and return validated, typed results |
|
|
10
|
+
| `execute(sql, params?, metadata?)` | Execute a statement (INSERT, UPDATE, DELETE) and return affected row count |
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
@@ -94,6 +94,10 @@ const analytics = await ctx.integrations.mssql.query(
|
|
|
94
94
|
);
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
## Trace Metadata
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
97
101
|
## Common Pitfalls
|
|
98
102
|
|
|
99
103
|
### BIGINT Values Returned as Strings
|
|
@@ -9,7 +9,7 @@ import type { z } from "zod";
|
|
|
9
9
|
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
10
10
|
import type { Plugin as MSSQLPlugin } from "@superblocksteam/types/dist/src/plugins/mssql/v1/plugin_pb";
|
|
11
11
|
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
12
|
-
import type { QueryExecutor } from "../registry.js";
|
|
12
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
13
13
|
import { QueryValidationError } from "../../errors.js";
|
|
14
14
|
import { IntegrationError } from "../../runtime/errors.js";
|
|
15
15
|
import { describeType } from "../utils.js";
|
|
@@ -62,11 +62,12 @@ export class MSSQLClientImpl implements MSSQLClient, IntegrationClientImpl {
|
|
|
62
62
|
sql: string,
|
|
63
63
|
schema: z.ZodSchema<T>,
|
|
64
64
|
params?: unknown[],
|
|
65
|
+
metadata?: TraceMetadata,
|
|
65
66
|
): Promise<T[]> {
|
|
66
67
|
const request = this.buildRequest(sql, params);
|
|
67
68
|
|
|
68
69
|
try {
|
|
69
|
-
const result = await this.executeQuery(request);
|
|
70
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
70
71
|
|
|
71
72
|
if (!Array.isArray(result)) {
|
|
72
73
|
throw new IntegrationError(
|
|
@@ -114,11 +115,12 @@ export class MSSQLClientImpl implements MSSQLClient, IntegrationClientImpl {
|
|
|
114
115
|
async execute(
|
|
115
116
|
sql: string,
|
|
116
117
|
params?: unknown[],
|
|
118
|
+
metadata?: TraceMetadata,
|
|
117
119
|
): Promise<{ rowCount: number }> {
|
|
118
120
|
const request = this.buildRequest(sql, params);
|
|
119
121
|
|
|
120
122
|
try {
|
|
121
|
-
const result = await this.executeQuery(request);
|
|
123
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
122
124
|
|
|
123
125
|
if (
|
|
124
126
|
typeof result === "object" &&
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import type { z } from "zod";
|
|
8
8
|
import type { BaseIntegrationClient } from "../../types.js";
|
|
9
|
+
import type { TraceMetadata } from "../registry.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Client for executing MSSQL queries with type-safe validation.
|
|
@@ -45,6 +46,7 @@ export interface MSSQLClient extends BaseIntegrationClient {
|
|
|
45
46
|
sql: string,
|
|
46
47
|
schema: z.ZodSchema<T>,
|
|
47
48
|
params?: unknown[],
|
|
49
|
+
metadata?: TraceMetadata,
|
|
48
50
|
): Promise<T[]>;
|
|
49
51
|
|
|
50
52
|
/**
|
|
@@ -54,5 +56,9 @@ export interface MSSQLClient extends BaseIntegrationClient {
|
|
|
54
56
|
* @param params - Optional parameters for prepared statements
|
|
55
57
|
* @returns Promise resolving to execution result with row count
|
|
56
58
|
*/
|
|
57
|
-
execute(
|
|
59
|
+
execute(
|
|
60
|
+
sql: string,
|
|
61
|
+
params?: unknown[],
|
|
62
|
+
metadata?: TraceMetadata,
|
|
63
|
+
): Promise<{ rowCount: number }>;
|
|
58
64
|
}
|
|
@@ -4,10 +4,10 @@ Execute SQL queries and statements against MySQL databases with full type safety
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `query<T>(sql, schema, params?)` | Execute a SELECT query and return validated, typed results |
|
|
10
|
-
| `execute(sql, params?)` | Execute a statement (INSERT, UPDATE, DELETE) and return affected row count |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ------------------------------------------- | -------------------------------------------------------------------------- |
|
|
9
|
+
| `query<T>(sql, schema, params?, metadata?)` | Execute a SELECT query and return validated, typed results |
|
|
10
|
+
| `execute(sql, params?, metadata?)` | Execute a statement (INSERT, UPDATE, DELETE) and return affected row count |
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
@@ -96,6 +96,10 @@ const orders = await ctx.integrations.mysql.query(
|
|
|
96
96
|
);
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
+
## Trace Metadata
|
|
100
|
+
|
|
101
|
+
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.
|
|
102
|
+
|
|
99
103
|
## Common Pitfalls
|
|
100
104
|
|
|
101
105
|
### BIGINT Values Returned as Strings
|
|
@@ -9,7 +9,7 @@ import type { z } from "zod";
|
|
|
9
9
|
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
10
10
|
import type { Plugin as MySQLPlugin } from "@superblocksteam/types/dist/src/plugins/mysql/v1/plugin_pb";
|
|
11
11
|
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
12
|
-
import type { QueryExecutor } from "../registry.js";
|
|
12
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
13
13
|
import { QueryValidationError } from "../../errors.js";
|
|
14
14
|
import { IntegrationError } from "../../runtime/errors.js";
|
|
15
15
|
import { describeType } from "../utils.js";
|
|
@@ -62,11 +62,12 @@ export class MySQLClientImpl implements MySQLClient, IntegrationClientImpl {
|
|
|
62
62
|
sql: string,
|
|
63
63
|
schema: z.ZodSchema<T>,
|
|
64
64
|
params?: unknown[],
|
|
65
|
+
metadata?: TraceMetadata,
|
|
65
66
|
): Promise<T[]> {
|
|
66
67
|
const request = this.buildRequest(sql, params);
|
|
67
68
|
|
|
68
69
|
try {
|
|
69
|
-
const result = await this.executeQuery(request);
|
|
70
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
70
71
|
|
|
71
72
|
if (!Array.isArray(result)) {
|
|
72
73
|
throw new IntegrationError(
|
|
@@ -114,11 +115,12 @@ export class MySQLClientImpl implements MySQLClient, IntegrationClientImpl {
|
|
|
114
115
|
async execute(
|
|
115
116
|
sql: string,
|
|
116
117
|
params?: unknown[],
|
|
118
|
+
metadata?: TraceMetadata,
|
|
117
119
|
): Promise<{ rowCount: number }> {
|
|
118
120
|
const request = this.buildRequest(sql, params);
|
|
119
121
|
|
|
120
122
|
try {
|
|
121
|
-
const result = await this.executeQuery(request);
|
|
123
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
122
124
|
|
|
123
125
|
if (
|
|
124
126
|
typeof result === "object" &&
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import type { z } from "zod";
|
|
8
8
|
import type { BaseIntegrationClient } from "../../types.js";
|
|
9
|
+
import type { TraceMetadata } from "../registry.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Client for executing MySQL queries with type-safe validation.
|
|
@@ -60,6 +61,7 @@ export interface MySQLClient extends BaseIntegrationClient {
|
|
|
60
61
|
sql: string,
|
|
61
62
|
schema: z.ZodSchema<T>,
|
|
62
63
|
params?: unknown[],
|
|
64
|
+
metadata?: TraceMetadata,
|
|
63
65
|
): Promise<T[]>;
|
|
64
66
|
|
|
65
67
|
/**
|
|
@@ -78,5 +80,9 @@ export interface MySQLClient extends BaseIntegrationClient {
|
|
|
78
80
|
* console.log(`Updated ${result.rowCount} rows`);
|
|
79
81
|
* ```
|
|
80
82
|
*/
|
|
81
|
-
execute(
|
|
83
|
+
execute(
|
|
84
|
+
sql: string,
|
|
85
|
+
params?: unknown[],
|
|
86
|
+
metadata?: TraceMetadata,
|
|
87
|
+
): Promise<{ rowCount: number }>;
|
|
82
88
|
}
|
|
@@ -4,9 +4,9 @@ Query databases, create pages, and manage content in Notion workspaces.
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `apiRequest(options, schema)` | Make any Notion API request with schema validation |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ---------------------------------------- | -------------------------------------------------- |
|
|
9
|
+
| `apiRequest(options, schema, metadata?)` | Make any Notion API request with schema validation |
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
@@ -250,6 +250,10 @@ const result = await ctx.integrations.notion.apiRequest(
|
|
|
250
250
|
console.log("Properties:", Object.keys(result.properties));
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
+
## Trace Metadata
|
|
254
|
+
|
|
255
|
+
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.
|
|
256
|
+
|
|
253
257
|
## Common Pitfalls
|
|
254
258
|
|
|
255
259
|
### No Specialized Methods
|
|
@@ -4,10 +4,10 @@ Interact with OpenAI's APIs for chat completions, embeddings, image generation,
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `apiRequest(options, schema)` | Make any OpenAI API request with schema validation |
|
|
10
|
-
| `streamApiRequest(options, schema)` | Stream responses with real-time chunk validation |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ---------------------------------------------- | -------------------------------------------------- |
|
|
9
|
+
| `apiRequest(options, schema, metadata?)` | Make any OpenAI API request with schema validation |
|
|
10
|
+
| `streamApiRequest(options, schema, metadata?)` | Stream responses with real-time chunk validation |
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
@@ -311,6 +311,10 @@ OpenAI's streaming chunks have this structure:
|
|
|
311
311
|
}
|
|
312
312
|
```
|
|
313
313
|
|
|
314
|
+
## Trace Metadata
|
|
315
|
+
|
|
316
|
+
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.
|
|
317
|
+
|
|
314
318
|
## Common Pitfalls
|
|
315
319
|
|
|
316
320
|
### No Specialized Methods
|
|
@@ -4,10 +4,10 @@ Execute SQL queries and statements against Oracle databases with full type safet
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `query<T>(sql, schema, params?)` | Execute a SELECT query and return validated, typed results |
|
|
10
|
-
| `execute(sql, params?)` | Execute a statement (INSERT, UPDATE, DELETE) and return affected row count |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ------------------------------------------- | -------------------------------------------------------------------------- |
|
|
9
|
+
| `query<T>(sql, schema, params?, metadata?)` | Execute a SELECT query and return validated, typed results |
|
|
10
|
+
| `execute(sql, params?, metadata?)` | Execute a statement (INSERT, UPDATE, DELETE) and return affected row count |
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
@@ -94,6 +94,10 @@ const analytics = await ctx.integrations.oracledb.query(
|
|
|
94
94
|
);
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
## Trace Metadata
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
97
101
|
## Common Pitfalls
|
|
98
102
|
|
|
99
103
|
### Uppercase Column Names
|
|
@@ -9,7 +9,7 @@ import type { z } from "zod";
|
|
|
9
9
|
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
10
10
|
import type { Plugin as OracleDBPlugin } from "@superblocksteam/types/dist/src/plugins/oracledb/v1/plugin_pb";
|
|
11
11
|
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
12
|
-
import type { QueryExecutor } from "../registry.js";
|
|
12
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
13
13
|
import { QueryValidationError } from "../../errors.js";
|
|
14
14
|
import { IntegrationError } from "../../runtime/errors.js";
|
|
15
15
|
import { describeType } from "../utils.js";
|
|
@@ -66,11 +66,12 @@ export class OracleDBClientImpl
|
|
|
66
66
|
sql: string,
|
|
67
67
|
schema: z.ZodSchema<T>,
|
|
68
68
|
params?: unknown[],
|
|
69
|
+
metadata?: TraceMetadata,
|
|
69
70
|
): Promise<T[]> {
|
|
70
71
|
const request = this.buildRequest(sql, params);
|
|
71
72
|
|
|
72
73
|
try {
|
|
73
|
-
const result = await this.executeQuery(request);
|
|
74
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
74
75
|
|
|
75
76
|
if (!Array.isArray(result)) {
|
|
76
77
|
throw new IntegrationError(
|
|
@@ -118,11 +119,12 @@ export class OracleDBClientImpl
|
|
|
118
119
|
async execute(
|
|
119
120
|
sql: string,
|
|
120
121
|
params?: unknown[],
|
|
122
|
+
metadata?: TraceMetadata,
|
|
121
123
|
): Promise<{ rowCount: number }> {
|
|
122
124
|
const request = this.buildRequest(sql, params);
|
|
123
125
|
|
|
124
126
|
try {
|
|
125
|
-
const result = await this.executeQuery(request);
|
|
127
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
126
128
|
|
|
127
129
|
if (
|
|
128
130
|
typeof result === "object" &&
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import type { z } from "zod";
|
|
8
8
|
import type { BaseIntegrationClient } from "../../types.js";
|
|
9
|
+
import type { TraceMetadata } from "../registry.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Client for executing OracleDB queries with type-safe validation.
|
|
@@ -45,6 +46,7 @@ export interface OracleDBClient extends BaseIntegrationClient {
|
|
|
45
46
|
sql: string,
|
|
46
47
|
schema: z.ZodSchema<T>,
|
|
47
48
|
params?: unknown[],
|
|
49
|
+
metadata?: TraceMetadata,
|
|
48
50
|
): Promise<T[]>;
|
|
49
51
|
|
|
50
52
|
/**
|
|
@@ -54,5 +56,9 @@ export interface OracleDBClient extends BaseIntegrationClient {
|
|
|
54
56
|
* @param params - Optional parameters for prepared statements
|
|
55
57
|
* @returns Promise resolving to execution result with row count
|
|
56
58
|
*/
|
|
57
|
-
execute(
|
|
59
|
+
execute(
|
|
60
|
+
sql: string,
|
|
61
|
+
params?: unknown[],
|
|
62
|
+
metadata?: TraceMetadata,
|
|
63
|
+
): Promise<{ rowCount: number }>;
|
|
58
64
|
}
|
|
@@ -4,9 +4,9 @@ Create incidents, manage services, and interact with PagerDuty's incident manage
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `apiRequest(options, schema)` | Make any PagerDuty API request with schema validation |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ---------------------------------------- | ----------------------------------------------------- |
|
|
9
|
+
| `apiRequest(options, schema, metadata?)` | Make any PagerDuty API request with schema validation |
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
@@ -315,6 +315,10 @@ await ctx.integrations.pagerduty.apiRequest(
|
|
|
315
315
|
);
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
+
## Trace Metadata
|
|
319
|
+
|
|
320
|
+
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.
|
|
321
|
+
|
|
318
322
|
## Common Pitfalls
|
|
319
323
|
|
|
320
324
|
### No Specialized Methods
|
|
@@ -4,9 +4,9 @@ Interact with Perplexity's search-augmented AI for real-time information retriev
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `apiRequest(options, schema)` | Make any Perplexity API request with schema validation |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ---------------------------------------- | ------------------------------------------------------ |
|
|
9
|
+
| `apiRequest(options, schema, metadata?)` | Make any Perplexity API request with schema validation |
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
@@ -183,6 +183,10 @@ const result = await ctx.integrations.perplexity.apiRequest(
|
|
|
183
183
|
);
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
+
## Trace Metadata
|
|
187
|
+
|
|
188
|
+
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.
|
|
189
|
+
|
|
186
190
|
## Common Pitfalls
|
|
187
191
|
|
|
188
192
|
### No Specialized Methods
|
|
@@ -4,10 +4,10 @@ Execute SQL queries and statements against PostgreSQL databases with full type s
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `query<T>(sql, schema, params?)` | Execute a SELECT query and return validated, typed results |
|
|
10
|
-
| `execute(sql, params?)` | Execute a statement (INSERT, UPDATE, DELETE) and return affected row count |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ------------------------------------------- | -------------------------------------------------------------------------- |
|
|
9
|
+
| `query<T>(sql, schema, params?, metadata?)` | Execute a SELECT query and return validated, typed results |
|
|
10
|
+
| `execute(sql, params?, metadata?)` | Execute a statement (INSERT, UPDATE, DELETE) and return affected row count |
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
@@ -173,6 +173,30 @@ const users = await ctx.integrations.db.query(
|
|
|
173
173
|
);
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
+
## Trace Metadata
|
|
177
|
+
|
|
178
|
+
All methods accept an optional `metadata` parameter as the last argument for diagnostics labeling:
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
const users = await ctx.integrations.db.query(
|
|
182
|
+
"SELECT * FROM users WHERE status = $1",
|
|
183
|
+
UserSchema,
|
|
184
|
+
["active"],
|
|
185
|
+
{
|
|
186
|
+
label: "Fetch active users",
|
|
187
|
+
description: "Paginated user list for dashboard",
|
|
188
|
+
},
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
await ctx.integrations.db.execute(
|
|
192
|
+
"DELETE FROM sessions WHERE expires_at < NOW()",
|
|
193
|
+
undefined, // no params
|
|
194
|
+
{ label: "Clean expired sessions" },
|
|
195
|
+
);
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
When `includeDiagnostics` is enabled, `label` and `description` appear in the trace view. See the [root SDK README](../../../README.md#trace-metadata) for details.
|
|
199
|
+
|
|
176
200
|
## Common Pitfalls
|
|
177
201
|
|
|
178
202
|
### Aggregate Functions (COUNT, SUM) Return Strings
|
|
@@ -9,7 +9,7 @@ import type { z } from "zod";
|
|
|
9
9
|
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
10
10
|
import type { Plugin as PostgresPlugin } from "@superblocksteam/types/dist/src/plugins/postgresql/v1/plugin_pb";
|
|
11
11
|
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
12
|
-
import type { QueryExecutor } from "../registry.js";
|
|
12
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
13
13
|
import type { PostgresClient } from "./types.js";
|
|
14
14
|
import { QueryValidationError } from "../../errors.js";
|
|
15
15
|
import { IntegrationError } from "../../runtime/errors.js";
|
|
@@ -68,11 +68,12 @@ export class PostgresClientImpl
|
|
|
68
68
|
sql: string,
|
|
69
69
|
schema: z.ZodSchema<T>,
|
|
70
70
|
params?: unknown[],
|
|
71
|
+
metadata?: TraceMetadata,
|
|
71
72
|
): Promise<T[]> {
|
|
72
73
|
const request = this.buildRequest(sql, params);
|
|
73
74
|
|
|
74
75
|
try {
|
|
75
|
-
const result = await this.executeQuery(request);
|
|
76
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
76
77
|
|
|
77
78
|
if (!Array.isArray(result)) {
|
|
78
79
|
throw new IntegrationError(
|
|
@@ -117,11 +118,12 @@ export class PostgresClientImpl
|
|
|
117
118
|
async execute(
|
|
118
119
|
sql: string,
|
|
119
120
|
params?: unknown[],
|
|
121
|
+
metadata?: TraceMetadata,
|
|
120
122
|
): Promise<{ rowCount: number }> {
|
|
121
123
|
const request = this.buildRequest(sql, params);
|
|
122
124
|
|
|
123
125
|
try {
|
|
124
|
-
const result = await this.executeQuery(request);
|
|
126
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
125
127
|
|
|
126
128
|
if (
|
|
127
129
|
typeof result === "object" &&
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type { z } from "zod";
|
|
6
6
|
import type { BaseIntegrationClient } from "../../types.js";
|
|
7
|
+
import type { TraceMetadata } from "../registry.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* PostgreSQL client for database operations.
|
|
@@ -76,6 +77,7 @@ export interface PostgresClient extends BaseIntegrationClient {
|
|
|
76
77
|
sql: string,
|
|
77
78
|
schema: z.ZodSchema<T>,
|
|
78
79
|
params?: unknown[],
|
|
80
|
+
metadata?: TraceMetadata,
|
|
79
81
|
): Promise<T[]>;
|
|
80
82
|
|
|
81
83
|
/**
|
|
@@ -96,5 +98,9 @@ export interface PostgresClient extends BaseIntegrationClient {
|
|
|
96
98
|
* console.log(`Deleted ${result.rowCount} expired sessions`);
|
|
97
99
|
* ```
|
|
98
100
|
*/
|
|
99
|
-
execute(
|
|
101
|
+
execute(
|
|
102
|
+
sql: string,
|
|
103
|
+
params?: unknown[],
|
|
104
|
+
metadata?: TraceMetadata,
|
|
105
|
+
): Promise<{ rowCount: number }>;
|
|
100
106
|
}
|
|
@@ -63,7 +63,7 @@ export default api({
|
|
|
63
63
|
|
|
64
64
|
## API Reference
|
|
65
65
|
|
|
66
|
-
### `ctx.integrations.<name>.run<T>(code, schema, bindings?): Promise<T>`
|
|
66
|
+
### `ctx.integrations.<name>.run<T>(code, schema, bindings?, metadata?): Promise<T>`
|
|
67
67
|
|
|
68
68
|
Executes Python code with validated output. Use the **key name** you declared in `integrations` (e.g. `ctx.integrations.runtime.run(...)` if you declared `runtime: python(...)`).
|
|
69
69
|
|
|
@@ -71,7 +71,8 @@ Executes Python code with validated output. Use the **key name** you declared in
|
|
|
71
71
|
|
|
72
72
|
- `code` (string): Python script to execute. Bindings are automatically injected as Python variables.
|
|
73
73
|
- `schema` (ZodSchema<T>): **Required** Zod schema for validating the return value.
|
|
74
|
-
- `bindings` (Record<string, unknown>, optional): Key/value pairs that become Python variables in your code.
|
|
74
|
+
- `bindings` (Record<string, unknown>, optional): Key/value pairs that become Python variables in your code. Do not pass `TraceMetadata` here; use the `metadata` parameter instead.
|
|
75
|
+
- `metadata` (TraceMetadata, optional): Trace metadata for diagnostics labeling (see [Trace Metadata](#trace-metadata)).
|
|
75
76
|
|
|
76
77
|
**Returns:** Promise resolving to validated result matching the schema.
|
|
77
78
|
|
|
@@ -79,6 +80,16 @@ Executes Python code with validated output. Use the **key name** you declared in
|
|
|
79
80
|
|
|
80
81
|
**Important:** Your Python code must use a `return` statement to return a value.
|
|
81
82
|
|
|
83
|
+
> **Note:** Because `bindings` and `metadata` are both plain objects, take care not
|
|
84
|
+
> to pass metadata as the third argument. If you need metadata but no bindings,
|
|
85
|
+
> pass `undefined` for `bindings` explicitly:
|
|
86
|
+
>
|
|
87
|
+
> ```typescript
|
|
88
|
+
> await ctx.integrations.runtime.run(code, schema, undefined, {
|
|
89
|
+
> label: "My trace label",
|
|
90
|
+
> });
|
|
91
|
+
> ```
|
|
92
|
+
|
|
82
93
|
## Binding Syntax
|
|
83
94
|
|
|
84
95
|
Bindings are passed as a map and automatically injected as Python variables. Reference them directly in your code by their key names:
|
|
@@ -302,6 +313,10 @@ export default api({
|
|
|
302
313
|
});
|
|
303
314
|
```
|
|
304
315
|
|
|
316
|
+
## Trace Metadata
|
|
317
|
+
|
|
318
|
+
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.
|
|
319
|
+
|
|
305
320
|
## Error Handling
|
|
306
321
|
|
|
307
322
|
The client throws `CodeExecutionError` when execution or validation fails:
|
|
@@ -546,6 +561,6 @@ For specific package requirements, consult your Superblocks environment document
|
|
|
546
561
|
|
|
547
562
|
## See Also
|
|
548
563
|
|
|
549
|
-
- [API Reference](
|
|
550
|
-
- [Error Handling](
|
|
551
|
-
- [Best Practices](
|
|
564
|
+
- [API Reference](../../../README.md) - Main SDK documentation
|
|
565
|
+
- [Error Handling](../../../README.md#error-handling) - Error types and handling strategies
|
|
566
|
+
- [Best Practices](../../../README.md#best-practices) - General SDK best practices
|
|
@@ -8,7 +8,7 @@ import type { z } from "zod";
|
|
|
8
8
|
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
9
9
|
import type { Plugin as PythonPlugin } from "@superblocksteam/types/dist/src/plugins/python/v1/plugin_pb";
|
|
10
10
|
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
11
|
-
import type { QueryExecutor } from "../registry.js";
|
|
11
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
12
12
|
import type { PythonClient } from "./types.js";
|
|
13
13
|
import { CodeExecutionError } from "../../errors.js";
|
|
14
14
|
|
|
@@ -89,6 +89,7 @@ export class PythonClientImpl implements PythonClient, IntegrationClientImpl {
|
|
|
89
89
|
code: string,
|
|
90
90
|
schema: z.ZodSchema<T>,
|
|
91
91
|
bindings?: Record<string, unknown>,
|
|
92
|
+
metadata?: TraceMetadata,
|
|
92
93
|
): Promise<T> {
|
|
93
94
|
// Build request with bindings injected as Python variables
|
|
94
95
|
const request = this.buildRequest(code, bindings);
|
|
@@ -98,6 +99,8 @@ export class PythonClientImpl implements PythonClient, IntegrationClientImpl {
|
|
|
98
99
|
// No need to pass bindings as input since they're already in the code
|
|
99
100
|
const result = await this.executeQuery(
|
|
100
101
|
request as unknown as Record<string, unknown>,
|
|
102
|
+
undefined,
|
|
103
|
+
metadata,
|
|
101
104
|
);
|
|
102
105
|
|
|
103
106
|
// Validate result against schema
|