@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,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
|
* Python code execution client.
|
|
@@ -46,9 +47,25 @@ export interface PythonClient extends BaseIntegrationClient {
|
|
|
46
47
|
* Bindings are referenced using {{key}} syntax and resolved by the
|
|
47
48
|
* orchestrator before execution.
|
|
48
49
|
*
|
|
50
|
+
* **Important:** The parameter order is `(code, schema, bindings?, metadata?)`.
|
|
51
|
+
* Because `bindings` is `Record<string, unknown>`, it is structurally
|
|
52
|
+
* compatible with `TraceMetadata`. Take care not to pass a metadata object
|
|
53
|
+
* as the third argument -- if you only need metadata and no bindings, pass
|
|
54
|
+
* `undefined` for `bindings` explicitly:
|
|
55
|
+
*
|
|
56
|
+
* ```typescript
|
|
57
|
+
* // Correct: skip bindings, pass metadata
|
|
58
|
+
* await python.run(code, schema, undefined, { label: "my label" });
|
|
59
|
+
*
|
|
60
|
+
* // Wrong: metadata is accidentally treated as bindings
|
|
61
|
+
* await python.run(code, schema, { label: "my label" });
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
49
64
|
* @param code - Python script to execute (use {{key}} for bindings)
|
|
50
65
|
* @param schema - Zod schema for validating the return value
|
|
51
|
-
* @param bindings - Optional key/value pairs accessible via {{key}} in code
|
|
66
|
+
* @param bindings - Optional key/value pairs accessible via {{key}} in code.
|
|
67
|
+
* Do not pass `TraceMetadata` here; use the `metadata` parameter instead.
|
|
68
|
+
* @param metadata - Optional trace metadata for diagnostics labeling
|
|
52
69
|
* @returns Validated result matching the schema
|
|
53
70
|
*
|
|
54
71
|
* @throws {CodeExecutionError} If execution fails or validation fails
|
|
@@ -69,5 +86,6 @@ export interface PythonClient extends BaseIntegrationClient {
|
|
|
69
86
|
code: string,
|
|
70
87
|
schema: z.ZodSchema<T>,
|
|
71
88
|
bindings?: Record<string, unknown>,
|
|
89
|
+
metadata?: TraceMetadata,
|
|
72
90
|
): Promise<T>;
|
|
73
91
|
}
|
|
@@ -4,9 +4,9 @@ Execute Redis commands with full type safety and runtime validation.
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `command(command, schema)` | Execute a raw Redis command |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ------------------------------------- | --------------------------- |
|
|
9
|
+
| `command(command, schema, metadata?)` | Execute a raw Redis command |
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
@@ -142,6 +142,10 @@ await ctx.integrations.redis.command("EXPIRE mykey 3600", z.number());
|
|
|
142
142
|
const ttl = await ctx.integrations.redis.command("TTL mykey", z.number());
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
## Trace Metadata
|
|
146
|
+
|
|
147
|
+
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.
|
|
148
|
+
|
|
145
149
|
## Common Pitfalls
|
|
146
150
|
|
|
147
151
|
### Quote String Values
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import type { z } from "zod";
|
|
14
14
|
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
15
|
-
import type { QueryExecutor } from "../registry.js";
|
|
15
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
16
16
|
import { RestApiValidationError } from "../../errors.js";
|
|
17
17
|
import { IntegrationError } from "../../runtime/errors.js";
|
|
18
18
|
import type { RedisClient } from "./types.js";
|
|
@@ -81,9 +81,10 @@ export class RedisClientImpl implements RedisClient, IntegrationClientImpl {
|
|
|
81
81
|
private async exec(
|
|
82
82
|
request: Record<string, unknown>,
|
|
83
83
|
operation: string,
|
|
84
|
+
metadata?: TraceMetadata,
|
|
84
85
|
): Promise<unknown> {
|
|
85
86
|
try {
|
|
86
|
-
return await this.executeQuery(request);
|
|
87
|
+
return await this.executeQuery(request, undefined, metadata);
|
|
87
88
|
} catch (error) {
|
|
88
89
|
if (
|
|
89
90
|
error instanceof RestApiValidationError ||
|
|
@@ -96,9 +97,13 @@ export class RedisClientImpl implements RedisClient, IntegrationClientImpl {
|
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
async command<T>(
|
|
100
|
+
async command<T>(
|
|
101
|
+
command: string,
|
|
102
|
+
schema: z.ZodSchema<T>,
|
|
103
|
+
metadata?: TraceMetadata,
|
|
104
|
+
): Promise<T> {
|
|
100
105
|
const request = buildRawRequest(command);
|
|
101
|
-
const result = await this.exec(request, "command");
|
|
106
|
+
const result = await this.exec(request, "command", metadata);
|
|
102
107
|
|
|
103
108
|
const parseResult = schema.safeParse(result);
|
|
104
109
|
|
|
@@ -115,61 +120,79 @@ export class RedisClientImpl implements RedisClient, IntegrationClientImpl {
|
|
|
115
120
|
return parseResult.data;
|
|
116
121
|
}
|
|
117
122
|
|
|
118
|
-
async get(key: string): Promise<unknown> {
|
|
123
|
+
async get(key: string, metadata?: TraceMetadata): Promise<unknown> {
|
|
119
124
|
const request = buildStructuredRequest("get", { key });
|
|
120
|
-
return this.exec(request, "get");
|
|
125
|
+
return this.exec(request, "get", metadata);
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
async set(
|
|
124
129
|
key: string,
|
|
125
130
|
value: string,
|
|
126
131
|
expirationMs?: number,
|
|
132
|
+
metadata?: TraceMetadata,
|
|
127
133
|
): Promise<unknown> {
|
|
128
134
|
const params: Record<string, unknown> = { key, value };
|
|
129
135
|
if (expirationMs !== undefined) {
|
|
130
136
|
params.expirationMs = expirationMs;
|
|
131
137
|
}
|
|
132
138
|
const request = buildStructuredRequest("set", params);
|
|
133
|
-
return this.exec(request, "set");
|
|
139
|
+
return this.exec(request, "set", metadata);
|
|
134
140
|
}
|
|
135
141
|
|
|
136
|
-
async del(key: string): Promise<unknown> {
|
|
142
|
+
async del(key: string, metadata?: TraceMetadata): Promise<unknown> {
|
|
137
143
|
const request = buildStructuredRequest("del", { key });
|
|
138
|
-
return this.exec(request, "del");
|
|
144
|
+
return this.exec(request, "del", metadata);
|
|
139
145
|
}
|
|
140
146
|
|
|
141
|
-
async keys(pattern: string): Promise<unknown> {
|
|
147
|
+
async keys(pattern: string, metadata?: TraceMetadata): Promise<unknown> {
|
|
142
148
|
const request = buildStructuredRequest("keys", { pattern });
|
|
143
|
-
return this.exec(request, "keys");
|
|
149
|
+
return this.exec(request, "keys", metadata);
|
|
144
150
|
}
|
|
145
151
|
|
|
146
|
-
async hget(
|
|
152
|
+
async hget(
|
|
153
|
+
key: string,
|
|
154
|
+
field: string,
|
|
155
|
+
metadata?: TraceMetadata,
|
|
156
|
+
): Promise<unknown> {
|
|
147
157
|
const request = buildStructuredRequest("hget", { key, field });
|
|
148
|
-
return this.exec(request, "hget");
|
|
158
|
+
return this.exec(request, "hget", metadata);
|
|
149
159
|
}
|
|
150
160
|
|
|
151
|
-
async hset(
|
|
161
|
+
async hset(
|
|
162
|
+
key: string,
|
|
163
|
+
field: string,
|
|
164
|
+
value: string,
|
|
165
|
+
metadata?: TraceMetadata,
|
|
166
|
+
): Promise<unknown> {
|
|
152
167
|
const request = buildStructuredRequest("hset", { key, field, value });
|
|
153
|
-
return this.exec(request, "hset");
|
|
168
|
+
return this.exec(request, "hset", metadata);
|
|
154
169
|
}
|
|
155
170
|
|
|
156
|
-
async hgetall(key: string): Promise<unknown> {
|
|
171
|
+
async hgetall(key: string, metadata?: TraceMetadata): Promise<unknown> {
|
|
157
172
|
const request = buildStructuredRequest("hgetall", { key });
|
|
158
|
-
return this.exec(request, "hgetall");
|
|
173
|
+
return this.exec(request, "hgetall", metadata);
|
|
159
174
|
}
|
|
160
175
|
|
|
161
|
-
async hdel(
|
|
176
|
+
async hdel(
|
|
177
|
+
key: string,
|
|
178
|
+
field: string,
|
|
179
|
+
metadata?: TraceMetadata,
|
|
180
|
+
): Promise<unknown> {
|
|
162
181
|
const request = buildStructuredRequest("hdel", { key, field });
|
|
163
|
-
return this.exec(request, "hdel");
|
|
182
|
+
return this.exec(request, "hdel", metadata);
|
|
164
183
|
}
|
|
165
184
|
|
|
166
|
-
async expire(
|
|
185
|
+
async expire(
|
|
186
|
+
key: string,
|
|
187
|
+
seconds: number,
|
|
188
|
+
metadata?: TraceMetadata,
|
|
189
|
+
): Promise<unknown> {
|
|
167
190
|
const request = buildStructuredRequest("expire", { key, seconds });
|
|
168
|
-
return this.exec(request, "expire");
|
|
191
|
+
return this.exec(request, "expire", metadata);
|
|
169
192
|
}
|
|
170
193
|
|
|
171
|
-
async ttl(key: string): Promise<unknown> {
|
|
194
|
+
async ttl(key: string, metadata?: TraceMetadata): Promise<unknown> {
|
|
172
195
|
const request = buildStructuredRequest("ttl", { key });
|
|
173
|
-
return this.exec(request, "ttl");
|
|
196
|
+
return this.exec(request, "ttl", metadata);
|
|
174
197
|
}
|
|
175
198
|
}
|
|
@@ -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
|
* Redis client for executing commands.
|
|
@@ -46,15 +47,20 @@ export interface RedisClient extends BaseIntegrationClient {
|
|
|
46
47
|
* @param schema - Zod schema for validating the result
|
|
47
48
|
* @returns The validated result
|
|
48
49
|
*/
|
|
49
|
-
command<T>(
|
|
50
|
+
command<T>(
|
|
51
|
+
command: string,
|
|
52
|
+
schema: z.ZodSchema<T>,
|
|
53
|
+
metadata?: TraceMetadata,
|
|
54
|
+
): Promise<T>;
|
|
50
55
|
|
|
51
56
|
/**
|
|
52
57
|
* Get the value of a key.
|
|
53
58
|
*
|
|
54
59
|
* @param key - The key to get
|
|
60
|
+
* @param metadata - Optional trace metadata for diagnostics
|
|
55
61
|
* @returns The value, or null if the key does not exist
|
|
56
62
|
*/
|
|
57
|
-
get(key: string): Promise<unknown>;
|
|
63
|
+
get(key: string, metadata?: TraceMetadata): Promise<unknown>;
|
|
58
64
|
|
|
59
65
|
/**
|
|
60
66
|
* Set the value of a key.
|
|
@@ -62,34 +68,43 @@ export interface RedisClient extends BaseIntegrationClient {
|
|
|
62
68
|
* @param key - The key to set
|
|
63
69
|
* @param value - The value to set
|
|
64
70
|
* @param expirationMs - Optional expiration time in milliseconds
|
|
71
|
+
* @param metadata - Optional trace metadata for diagnostics
|
|
65
72
|
* @returns The result (typically "OK")
|
|
66
73
|
*/
|
|
67
|
-
set(
|
|
74
|
+
set(
|
|
75
|
+
key: string,
|
|
76
|
+
value: string,
|
|
77
|
+
expirationMs?: number,
|
|
78
|
+
metadata?: TraceMetadata,
|
|
79
|
+
): Promise<unknown>;
|
|
68
80
|
|
|
69
81
|
/**
|
|
70
82
|
* Delete a key.
|
|
71
83
|
*
|
|
72
84
|
* @param key - The key to delete
|
|
85
|
+
* @param metadata - Optional trace metadata for diagnostics
|
|
73
86
|
* @returns The number of keys removed
|
|
74
87
|
*/
|
|
75
|
-
del(key: string): Promise<unknown>;
|
|
88
|
+
del(key: string, metadata?: TraceMetadata): Promise<unknown>;
|
|
76
89
|
|
|
77
90
|
/**
|
|
78
91
|
* Find all keys matching a pattern.
|
|
79
92
|
*
|
|
80
93
|
* @param pattern - The glob-style pattern to match (e.g., "user:*")
|
|
94
|
+
* @param metadata - Optional trace metadata for diagnostics
|
|
81
95
|
* @returns Array of matching keys
|
|
82
96
|
*/
|
|
83
|
-
keys(pattern: string): Promise<unknown>;
|
|
97
|
+
keys(pattern: string, metadata?: TraceMetadata): Promise<unknown>;
|
|
84
98
|
|
|
85
99
|
/**
|
|
86
100
|
* Get the value of a hash field.
|
|
87
101
|
*
|
|
88
102
|
* @param key - The hash key
|
|
89
103
|
* @param field - The field name
|
|
104
|
+
* @param metadata - Optional trace metadata for diagnostics
|
|
90
105
|
* @returns The field value, or null if the field does not exist
|
|
91
106
|
*/
|
|
92
|
-
hget(key: string, field: string): Promise<unknown>;
|
|
107
|
+
hget(key: string, field: string, metadata?: TraceMetadata): Promise<unknown>;
|
|
93
108
|
|
|
94
109
|
/**
|
|
95
110
|
* Set the value of a hash field.
|
|
@@ -97,41 +112,55 @@ export interface RedisClient extends BaseIntegrationClient {
|
|
|
97
112
|
* @param key - The hash key
|
|
98
113
|
* @param field - The field name
|
|
99
114
|
* @param value - The value to set
|
|
115
|
+
* @param metadata - Optional trace metadata for diagnostics
|
|
100
116
|
* @returns The number of fields that were added
|
|
101
117
|
*/
|
|
102
|
-
hset(
|
|
118
|
+
hset(
|
|
119
|
+
key: string,
|
|
120
|
+
field: string,
|
|
121
|
+
value: string,
|
|
122
|
+
metadata?: TraceMetadata,
|
|
123
|
+
): Promise<unknown>;
|
|
103
124
|
|
|
104
125
|
/**
|
|
105
126
|
* Get all fields and values of a hash.
|
|
106
127
|
*
|
|
107
128
|
* @param key - The hash key
|
|
129
|
+
* @param metadata - Optional trace metadata for diagnostics
|
|
108
130
|
* @returns Object with all field-value pairs
|
|
109
131
|
*/
|
|
110
|
-
hgetall(key: string): Promise<unknown>;
|
|
132
|
+
hgetall(key: string, metadata?: TraceMetadata): Promise<unknown>;
|
|
111
133
|
|
|
112
134
|
/**
|
|
113
135
|
* Delete a hash field.
|
|
114
136
|
*
|
|
115
137
|
* @param key - The hash key
|
|
116
138
|
* @param field - The field to delete
|
|
139
|
+
* @param metadata - Optional trace metadata for diagnostics
|
|
117
140
|
* @returns The number of fields that were removed
|
|
118
141
|
*/
|
|
119
|
-
hdel(key: string, field: string): Promise<unknown>;
|
|
142
|
+
hdel(key: string, field: string, metadata?: TraceMetadata): Promise<unknown>;
|
|
120
143
|
|
|
121
144
|
/**
|
|
122
145
|
* Set expiration on a key.
|
|
123
146
|
*
|
|
124
147
|
* @param key - The key to set expiration on
|
|
125
148
|
* @param seconds - Time to live in seconds
|
|
149
|
+
* @param metadata - Optional trace metadata for diagnostics
|
|
126
150
|
* @returns 1 if timeout was set, 0 if key does not exist
|
|
127
151
|
*/
|
|
128
|
-
expire(
|
|
152
|
+
expire(
|
|
153
|
+
key: string,
|
|
154
|
+
seconds: number,
|
|
155
|
+
metadata?: TraceMetadata,
|
|
156
|
+
): Promise<unknown>;
|
|
129
157
|
|
|
130
158
|
/**
|
|
131
159
|
* Get the remaining time to live of a key.
|
|
132
160
|
*
|
|
133
161
|
* @param key - The key to check
|
|
162
|
+
* @param metadata - Optional trace metadata for diagnostics
|
|
134
163
|
* @returns TTL in seconds, -2 if key does not exist, -1 if no expiration
|
|
135
164
|
*/
|
|
136
|
-
ttl(key: string): Promise<unknown>;
|
|
165
|
+
ttl(key: string, metadata?: TraceMetadata): Promise<unknown>;
|
|
137
166
|
}
|
|
@@ -4,10 +4,10 @@ Execute SQL queries and statements against Amazon Redshift data warehouses with
|
|
|
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.redshift.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 RedshiftPlugin } from "@superblocksteam/types/dist/src/plugins/redshift/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";
|
|
@@ -64,11 +64,12 @@ export class RedshiftClientImpl
|
|
|
64
64
|
sql: string,
|
|
65
65
|
schema: z.ZodSchema<T>,
|
|
66
66
|
params?: unknown[],
|
|
67
|
+
metadata?: TraceMetadata,
|
|
67
68
|
): Promise<T[]> {
|
|
68
69
|
const request = this.buildRequest(sql, params);
|
|
69
70
|
|
|
70
71
|
try {
|
|
71
|
-
const result = await this.executeQuery(request);
|
|
72
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
72
73
|
|
|
73
74
|
if (!Array.isArray(result)) {
|
|
74
75
|
throw new IntegrationError(
|
|
@@ -116,11 +117,12 @@ export class RedshiftClientImpl
|
|
|
116
117
|
async execute(
|
|
117
118
|
sql: string,
|
|
118
119
|
params?: unknown[],
|
|
120
|
+
metadata?: TraceMetadata,
|
|
119
121
|
): Promise<{ rowCount: number }> {
|
|
120
122
|
const request = this.buildRequest(sql, params);
|
|
121
123
|
|
|
122
124
|
try {
|
|
123
|
-
const result = await this.executeQuery(request);
|
|
125
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
124
126
|
|
|
125
127
|
if (
|
|
126
128
|
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 Redshift queries with type-safe validation.
|
|
@@ -45,6 +46,7 @@ export interface RedshiftClient 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 RedshiftClient 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
|
}
|
|
@@ -155,6 +155,24 @@ export const SUPPORTED_PLUGINS = {
|
|
|
155
155
|
export type SupportedPluginId =
|
|
156
156
|
(typeof SUPPORTED_PLUGINS)[keyof typeof SUPPORTED_PLUGINS];
|
|
157
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Optional metadata attached to an integration call for diagnostics.
|
|
160
|
+
*
|
|
161
|
+
* When `includeDiagnostics` is enabled, the `label` and `description`
|
|
162
|
+
* are captured alongside the standard timing/input/output data and
|
|
163
|
+
* surfaced in the Trace View UI.
|
|
164
|
+
*
|
|
165
|
+
* **Security:** Do not include secrets, passwords, access tokens, or other
|
|
166
|
+
* sensitive/PII data in trace metadata, as it may be stored in logs or trace
|
|
167
|
+
* payloads and visible to others with access to diagnostics.
|
|
168
|
+
*/
|
|
169
|
+
export interface TraceMetadata {
|
|
170
|
+
/** Short human-readable label for this call (e.g., "Fetch active users"). */
|
|
171
|
+
label?: string;
|
|
172
|
+
/** Longer description of what this call does and why. */
|
|
173
|
+
description?: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
158
176
|
/**
|
|
159
177
|
* Type for the query executor function provided by the orchestrator.
|
|
160
178
|
*
|
|
@@ -166,11 +184,13 @@ export type SupportedPluginId =
|
|
|
166
184
|
*
|
|
167
185
|
* @param request - Plugin-specific request object matching the proto schema
|
|
168
186
|
* @param bindings - Optional bindings data for binding resolution (e.g., Python/JavaScript bindings)
|
|
187
|
+
* @param metadata - Optional trace metadata (label, description) for diagnostics
|
|
169
188
|
* @returns Promise resolving to the operation result
|
|
170
189
|
*/
|
|
171
190
|
export type QueryExecutor = (
|
|
172
191
|
request: Record<string, unknown>,
|
|
173
192
|
bindings?: Record<string, unknown>,
|
|
193
|
+
metadata?: TraceMetadata,
|
|
174
194
|
) => Promise<unknown>;
|
|
175
195
|
|
|
176
196
|
/**
|
|
@@ -180,10 +200,12 @@ export type QueryExecutor = (
|
|
|
180
200
|
* Used for streaming operations like LLM token streaming.
|
|
181
201
|
*
|
|
182
202
|
* @param request - Plugin-specific request object matching the proto schema
|
|
203
|
+
* @param metadata - Optional trace metadata (label, description) for diagnostics
|
|
183
204
|
* @returns AsyncIterable yielding raw chunks from the stream
|
|
184
205
|
*/
|
|
185
206
|
export type StreamingQueryExecutor = (
|
|
186
207
|
request: Record<string, unknown>,
|
|
208
|
+
metadata?: TraceMetadata,
|
|
187
209
|
) => AsyncIterable<unknown>;
|
|
188
210
|
|
|
189
211
|
/**
|
|
@@ -4,15 +4,15 @@ Interact with Amazon S3 buckets with full type safety and runtime validation.
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
| Method
|
|
8
|
-
|
|
|
9
|
-
| `listBuckets(schema)` | List all buckets |
|
|
10
|
-
| `listObjects(bucket, schema, options?)` | List objects in a bucket |
|
|
11
|
-
| `getObject(bucket, path, schema, options?)` | Get an object |
|
|
12
|
-
| `deleteObject(bucket, path)` | Delete an object |
|
|
13
|
-
| `uploadObject(bucket, path, body)` | Upload a single object |
|
|
14
|
-
| `uploadMultipleObjects(bucket, fileObjects)` | Upload multiple objects |
|
|
15
|
-
| `generatePresignedUrl(bucket, path, schema)` | Generate a presigned URL |
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ------------------------------------------------------- | ------------------------ |
|
|
9
|
+
| `listBuckets(schema, metadata?)` | List all buckets |
|
|
10
|
+
| `listObjects(bucket, schema, options?, metadata?)` | List objects in a bucket |
|
|
11
|
+
| `getObject(bucket, path, schema, options?, metadata?)` | Get an object |
|
|
12
|
+
| `deleteObject(bucket, path, metadata?)` | Delete an object |
|
|
13
|
+
| `uploadObject(bucket, path, body, metadata?)` | Upload a single object |
|
|
14
|
+
| `uploadMultipleObjects(bucket, fileObjects, metadata?)` | Upload multiple objects |
|
|
15
|
+
| `generatePresignedUrl(bucket, path, schema, metadata?)` | Generate a presigned URL |
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
@@ -104,6 +104,10 @@ const url = await ctx.integrations.storage.generatePresignedUrl(
|
|
|
104
104
|
);
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
+
## Trace Metadata
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
107
111
|
## Error Handling
|
|
108
112
|
|
|
109
113
|
```typescript
|