@superblocksteam/sdk-api 0.0.5 → 0.0.7
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 +351 -427
- package/dist/api/definition.d.ts +12 -7
- package/dist/api/definition.d.ts.map +1 -1
- package/dist/api/definition.js +19 -12
- package/dist/api/definition.js.map +1 -1
- package/dist/api/definition.test.js +39 -15
- package/dist/api/definition.test.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 +1 -45
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -33
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +16 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -15
- 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/athena/client.d.ts +1 -1
- package/dist/integrations/athena/client.d.ts.map +1 -1
- package/dist/integrations/athena/client.js.map +1 -1
- package/dist/integrations/athena/types.d.ts +2 -2
- package/dist/integrations/athena/types.d.ts.map +1 -1
- package/dist/integrations/base/graphql-integration-client.d.ts +8 -4
- package/dist/integrations/base/graphql-integration-client.d.ts.map +1 -1
- package/dist/integrations/base/graphql-integration-client.js +18 -5
- package/dist/integrations/base/graphql-integration-client.js.map +1 -1
- package/dist/integrations/base/index.d.ts +3 -2
- package/dist/integrations/base/index.d.ts.map +1 -1
- package/dist/integrations/base/index.js +1 -0
- package/dist/integrations/base/index.js.map +1 -1
- package/dist/integrations/base/rest-api-client-base.d.ts +48 -0
- package/dist/integrations/base/rest-api-client-base.d.ts.map +1 -0
- package/dist/integrations/base/rest-api-client-base.js +98 -0
- package/dist/integrations/base/rest-api-client-base.js.map +1 -0
- package/dist/integrations/base/rest-api-integration-client.d.ts +11 -65
- package/dist/integrations/base/rest-api-integration-client.d.ts.map +1 -1
- package/dist/integrations/base/rest-api-integration-client.js +11 -174
- 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/bigquery/client.d.ts +1 -1
- package/dist/integrations/bigquery/client.d.ts.map +1 -1
- package/dist/integrations/bigquery/client.js.map +1 -1
- package/dist/integrations/bigquery/types.d.ts +3 -3
- package/dist/integrations/bigquery/types.d.ts.map +1 -1
- package/dist/integrations/box/types.d.ts +1 -1
- package/dist/integrations/cockroachdb/client.d.ts +1 -1
- package/dist/integrations/cockroachdb/client.d.ts.map +1 -1
- package/dist/integrations/cockroachdb/client.js.map +1 -1
- package/dist/integrations/cockroachdb/types.d.ts.map +1 -1
- package/dist/integrations/cosmosdb/client.d.ts +1 -1
- package/dist/integrations/cosmosdb/client.d.ts.map +1 -1
- package/dist/integrations/cosmosdb/client.js.map +1 -1
- package/dist/integrations/cosmosdb/client.test.js.map +1 -1
- package/dist/integrations/cosmosdb/types.d.ts.map +1 -1
- package/dist/integrations/databricks/client.d.ts +1 -1
- package/dist/integrations/databricks/client.d.ts.map +1 -1
- package/dist/integrations/databricks/client.js.map +1 -1
- package/dist/integrations/databricks/types.d.ts +3 -3
- package/dist/integrations/databricks/types.d.ts.map +1 -1
- package/dist/integrations/declarations.d.ts +36 -104
- package/dist/integrations/declarations.d.ts.map +1 -1
- package/dist/integrations/declarations.js +5 -68
- package/dist/integrations/declarations.js.map +1 -1
- package/dist/integrations/declarations.test.js.map +1 -1
- package/dist/integrations/documentation-resolver.test.d.ts +2 -0
- package/dist/integrations/documentation-resolver.test.d.ts.map +1 -0
- package/dist/integrations/documentation-resolver.test.js +608 -0
- package/dist/integrations/documentation-resolver.test.js.map +1 -0
- package/dist/integrations/documentation.d.ts +8 -0
- package/dist/integrations/documentation.d.ts.map +1 -0
- package/dist/integrations/documentation.js +277 -0
- package/dist/integrations/documentation.js.map +1 -0
- package/dist/integrations/documentation.test.d.ts +2 -0
- package/dist/integrations/documentation.test.d.ts.map +1 -0
- package/dist/integrations/documentation.test.js +81 -0
- package/dist/integrations/documentation.test.js.map +1 -0
- package/dist/integrations/dynamodb/client.d.ts +1 -1
- package/dist/integrations/dynamodb/client.d.ts.map +1 -1
- package/dist/integrations/dynamodb/client.js.map +1 -1
- package/dist/integrations/dynamodb/types.d.ts.map +1 -1
- package/dist/integrations/gcs/client.d.ts +1 -1
- package/dist/integrations/gcs/client.d.ts.map +1 -1
- package/dist/integrations/gcs/client.js.map +1 -1
- package/dist/integrations/gcs/types.d.ts.map +1 -1
- package/dist/integrations/googledrive/types.d.ts +1 -1
- package/dist/integrations/graphql/client.test.d.ts +15 -0
- package/dist/integrations/graphql/client.test.d.ts.map +1 -0
- package/dist/integrations/graphql/client.test.js +148 -0
- package/dist/integrations/graphql/client.test.js.map +1 -0
- package/dist/integrations/graphql/types.d.ts +22 -3
- package/dist/integrations/graphql/types.d.ts.map +1 -1
- package/dist/integrations/gsheets/client.d.ts +1 -1
- package/dist/integrations/gsheets/client.d.ts.map +1 -1
- package/dist/integrations/gsheets/client.js.map +1 -1
- package/dist/integrations/gsheets/types.d.ts.map +1 -1
- package/dist/integrations/index.d.ts +2 -12
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +2 -8
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/lakebase/client.d.ts +1 -1
- package/dist/integrations/lakebase/client.d.ts.map +1 -1
- package/dist/integrations/lakebase/client.js.map +1 -1
- package/dist/integrations/lakebase/types.d.ts +4 -4
- package/dist/integrations/lakebase/types.d.ts.map +1 -1
- package/dist/integrations/mariadb/client.d.ts +1 -1
- package/dist/integrations/mariadb/client.d.ts.map +1 -1
- package/dist/integrations/mariadb/client.js.map +1 -1
- package/dist/integrations/mariadb/types.d.ts +2 -2
- package/dist/integrations/mariadb/types.d.ts.map +1 -1
- package/dist/integrations/mongodb/client.d.ts +1 -1
- package/dist/integrations/mongodb/client.d.ts.map +1 -1
- package/dist/integrations/mongodb/client.js.map +1 -1
- package/dist/integrations/mongodb/types.d.ts.map +1 -1
- package/dist/integrations/mssql/client.d.ts +1 -1
- package/dist/integrations/mssql/client.d.ts.map +1 -1
- package/dist/integrations/mssql/client.js.map +1 -1
- package/dist/integrations/mssql/types.d.ts +2 -2
- package/dist/integrations/mssql/types.d.ts.map +1 -1
- package/dist/integrations/mysql/client.d.ts +1 -1
- package/dist/integrations/mysql/client.d.ts.map +1 -1
- package/dist/integrations/mysql/client.js.map +1 -1
- package/dist/integrations/mysql/types.d.ts +4 -4
- package/dist/integrations/mysql/types.d.ts.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/oracledb/client.d.ts +1 -1
- package/dist/integrations/oracledb/client.d.ts.map +1 -1
- package/dist/integrations/oracledb/client.js.map +1 -1
- package/dist/integrations/oracledb/types.d.ts +2 -2
- package/dist/integrations/oracledb/types.d.ts.map +1 -1
- package/dist/integrations/postgres/client.d.ts +2 -2
- package/dist/integrations/postgres/client.d.ts.map +1 -1
- package/dist/integrations/postgres/client.js.map +1 -1
- package/dist/integrations/postgres/types.d.ts.map +1 -1
- package/dist/integrations/redshift/client.d.ts +1 -1
- package/dist/integrations/redshift/client.d.ts.map +1 -1
- package/dist/integrations/redshift/client.js.map +1 -1
- package/dist/integrations/redshift/types.d.ts.map +1 -1
- package/dist/integrations/registry.d.ts +6 -27
- package/dist/integrations/registry.d.ts.map +1 -1
- package/dist/integrations/registry.js +64 -88
- 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/s3/client.d.ts +1 -1
- package/dist/integrations/s3/client.d.ts.map +1 -1
- package/dist/integrations/s3/client.js.map +1 -1
- package/dist/integrations/s3/types.d.ts +3 -1
- package/dist/integrations/s3/types.d.ts.map +1 -1
- package/dist/integrations/salesforce/client.d.ts +1 -1
- package/dist/integrations/salesforce/client.d.ts.map +1 -1
- package/dist/integrations/salesforce/client.js.map +1 -1
- package/dist/integrations/salesforce/types.d.ts.map +1 -1
- package/dist/integrations/slack/client.d.ts +13 -9
- package/dist/integrations/slack/client.d.ts.map +1 -1
- package/dist/integrations/slack/client.js +60 -8
- package/dist/integrations/slack/client.js.map +1 -1
- package/dist/integrations/slack/client.test.d.ts +11 -0
- package/dist/integrations/slack/client.test.d.ts.map +1 -0
- package/dist/integrations/slack/client.test.js +368 -0
- package/dist/integrations/slack/client.test.js.map +1 -0
- package/dist/integrations/slack/index.d.ts +2 -1
- package/dist/integrations/slack/index.d.ts.map +1 -1
- package/dist/integrations/slack/index.js +1 -0
- package/dist/integrations/slack/index.js.map +1 -1
- package/dist/integrations/slack/types.d.ts +127 -28
- package/dist/integrations/slack/types.d.ts.map +1 -1
- package/dist/integrations/slack/types.js +27 -1
- package/dist/integrations/slack/types.js.map +1 -1
- package/dist/integrations/smtp/client.d.ts +1 -1
- package/dist/integrations/smtp/client.d.ts.map +1 -1
- package/dist/integrations/smtp/client.js.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 +2 -2
- package/dist/integrations/snowflake/client.js.map +1 -1
- package/dist/integrations/snowflake/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/integrations/snowflakepostgres/client.d.ts +1 -1
- package/dist/integrations/snowflakepostgres/client.d.ts.map +1 -1
- package/dist/integrations/snowflakepostgres/client.js.map +1 -1
- package/dist/integrations/snowflakepostgres/types.d.ts.map +1 -1
- package/dist/runtime/context.d.ts +3 -3
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/executor.d.ts +2 -2
- 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/dist/types.d.ts +15 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/api/definition.test.ts +41 -15
- package/src/api/definition.ts +20 -13
- package/src/api/index.ts +0 -4
- package/src/errors.ts +1 -49
- package/src/index.ts +20 -61
- package/src/integrations/airtable/docs.manifest.json +5 -0
- package/src/integrations/anthropic/README.md +5 -101
- package/src/integrations/anthropic/docs.manifest.json +5 -0
- package/src/integrations/anthropic/types.ts +3 -29
- package/src/integrations/asana/README.md +12 -12
- package/src/integrations/asana/docs.manifest.json +5 -0
- package/src/integrations/athena/README.md +4 -4
- package/src/integrations/athena/client.ts +5 -3
- package/src/integrations/athena/docs.manifest.json +5 -0
- package/src/integrations/athena/types.ts +3 -2
- package/src/integrations/base/graphql-integration-client.ts +27 -5
- package/src/integrations/base/index.ts +2 -3
- package/src/integrations/base/rest-api-client-base.ts +134 -0
- package/src/integrations/base/rest-api-integration-client.ts +15 -239
- package/src/integrations/base/types.ts +4 -74
- package/src/integrations/bigquery/README.md +28 -3
- package/src/integrations/bigquery/client.ts +5 -3
- package/src/integrations/bigquery/docs.manifest.json +5 -0
- package/src/integrations/bigquery/types.ts +4 -3
- package/src/integrations/bitbucket/README.md +19 -19
- package/src/integrations/bitbucket/docs.manifest.json +5 -0
- package/src/integrations/box/README.md +24 -24
- package/src/integrations/box/docs.manifest.json +5 -0
- package/src/integrations/box/types.ts +1 -1
- package/src/integrations/circleci/README.md +18 -18
- package/src/integrations/circleci/docs.manifest.json +5 -0
- package/src/integrations/cockroachdb/client.ts +5 -3
- package/src/integrations/cockroachdb/docs.manifest.json +5 -0
- package/src/integrations/cockroachdb/types.ts +1 -0
- package/src/integrations/cohere/README.md +11 -11
- package/src/integrations/cohere/docs.manifest.json +5 -0
- package/src/integrations/confluence/docs.manifest.json +5 -0
- package/src/integrations/cosmosdb/client.test.ts +2 -1
- package/src/integrations/cosmosdb/client.ts +5 -3
- package/src/integrations/cosmosdb/docs.manifest.json +5 -0
- package/src/integrations/cosmosdb/types.ts +1 -0
- package/src/integrations/databricks/README.md +29 -4
- package/src/integrations/databricks/client.ts +5 -3
- package/src/integrations/databricks/docs.manifest.json +5 -0
- package/src/integrations/databricks/types.ts +4 -3
- package/src/integrations/datadog/docs.manifest.json +5 -0
- package/src/integrations/declarations.test.ts +1 -0
- package/src/integrations/declarations.ts +36 -136
- package/src/integrations/documentation-resolver.test.ts +704 -0
- package/src/integrations/documentation.test.ts +120 -0
- package/src/integrations/documentation.ts +421 -0
- package/src/integrations/dropbox/docs.manifest.json +5 -0
- package/src/integrations/dynamodb/client.ts +3 -2
- package/src/integrations/dynamodb/docs.manifest.json +5 -0
- package/src/integrations/dynamodb/types.ts +1 -0
- package/src/integrations/elasticsearch/docs.manifest.json +5 -0
- package/src/integrations/fireworks/README.md +43 -17
- package/src/integrations/fireworks/docs.manifest.json +5 -0
- package/src/integrations/front/docs.manifest.json +5 -0
- package/src/integrations/gcs/client.ts +5 -3
- package/src/integrations/gcs/docs.manifest.json +5 -0
- package/src/integrations/gcs/types.ts +1 -0
- package/src/integrations/gemini/docs.manifest.json +5 -0
- package/src/integrations/github/docs.manifest.json +5 -0
- package/src/integrations/googleanalytics/README.md +2 -2
- package/src/integrations/googleanalytics/docs.manifest.json +5 -0
- package/src/integrations/googledrive/README.md +27 -24
- package/src/integrations/googledrive/docs.manifest.json +5 -0
- package/src/integrations/googledrive/types.ts +1 -1
- package/src/integrations/graphql/README.md +2 -2
- package/src/integrations/graphql/client.test.ts +220 -0
- package/src/integrations/graphql/docs.manifest.json +5 -0
- package/src/integrations/graphql/types.ts +23 -1
- package/src/integrations/groq/README.md +49 -42
- package/src/integrations/groq/docs.manifest.json +5 -0
- package/src/integrations/gsheets/README.md +2 -2
- package/src/integrations/gsheets/client.ts +5 -3
- package/src/integrations/gsheets/docs.manifest.json +5 -0
- package/src/integrations/gsheets/types.ts +1 -0
- package/src/integrations/hubspot/docs.manifest.json +5 -0
- package/src/integrations/index.ts +1 -52
- package/src/integrations/intercom/docs.manifest.json +5 -0
- package/src/integrations/jira/docs.manifest.json +5 -0
- package/src/integrations/lakebase/README.md +242 -0
- package/src/integrations/lakebase/client.ts +6 -4
- package/src/integrations/lakebase/docs.manifest.json +5 -0
- package/src/integrations/lakebase/types.ts +5 -4
- package/src/integrations/launchdarkly/README.md +2 -2
- package/src/integrations/launchdarkly/docs.manifest.json +5 -0
- package/src/integrations/mariadb/README.md +3 -3
- package/src/integrations/mariadb/client.ts +5 -3
- package/src/integrations/mariadb/docs.manifest.json +5 -0
- package/src/integrations/mariadb/types.ts +3 -2
- package/src/integrations/mistral/README.md +39 -13
- package/src/integrations/mistral/docs.manifest.json +5 -0
- package/src/integrations/mongodb/README.md +65 -12
- package/src/integrations/mongodb/client.ts +5 -3
- package/src/integrations/mongodb/docs.manifest.json +5 -0
- package/src/integrations/mongodb/types.ts +1 -0
- package/src/integrations/mssql/README.md +3 -3
- package/src/integrations/mssql/client.ts +5 -3
- package/src/integrations/mssql/docs.manifest.json +5 -0
- package/src/integrations/mssql/types.ts +3 -2
- package/src/integrations/mysql/README.md +4 -4
- package/src/integrations/mysql/client.ts +5 -3
- package/src/integrations/mysql/docs.manifest.json +5 -0
- package/src/integrations/mysql/types.ts +5 -4
- package/src/integrations/notion/docs.manifest.json +5 -0
- package/src/integrations/openai_v2/README.md +44 -116
- package/src/integrations/openai_v2/docs.manifest.json +5 -0
- package/src/integrations/openai_v2/types.ts +4 -29
- package/src/integrations/oracledb/README.md +3 -3
- package/src/integrations/oracledb/client.ts +5 -3
- package/src/integrations/oracledb/docs.manifest.json +5 -0
- package/src/integrations/oracledb/types.ts +3 -2
- package/src/integrations/pagerduty/README.md +2 -2
- package/src/integrations/pagerduty/docs.manifest.json +5 -0
- package/src/integrations/perplexity/README.md +39 -47
- package/src/integrations/perplexity/docs.manifest.json +5 -0
- package/src/integrations/postgres/client.ts +6 -4
- package/src/integrations/postgres/docs.manifest.json +5 -0
- package/src/integrations/postgres/types.ts +1 -0
- package/src/integrations/redshift/client.ts +5 -3
- package/src/integrations/redshift/docs.manifest.json +5 -0
- package/src/integrations/redshift/types.ts +1 -0
- package/src/integrations/registry.test.ts +2 -3
- package/src/integrations/registry.ts +69 -188
- package/src/integrations/restapiintegration/README.md +320 -0
- package/src/integrations/restapiintegration/docs.manifest.json +5 -0
- package/src/integrations/restapiintegration/types.ts +2 -8
- package/src/integrations/s3/client.ts +5 -3
- package/src/integrations/s3/docs.manifest.json +5 -0
- package/src/integrations/s3/types.ts +4 -1
- package/src/integrations/salesforce/README.md +11 -9
- package/src/integrations/salesforce/client.ts +3 -2
- package/src/integrations/salesforce/docs.manifest.json +5 -0
- package/src/integrations/salesforce/types.ts +1 -0
- package/src/integrations/segment/docs.manifest.json +5 -0
- package/src/integrations/sendgrid/README.md +2 -2
- package/src/integrations/sendgrid/docs.manifest.json +5 -0
- package/src/integrations/slack/README.md +62 -19
- package/src/integrations/slack/client.test.ts +553 -0
- package/src/integrations/slack/client.ts +92 -12
- package/src/integrations/slack/docs.manifest.json +5 -0
- package/src/integrations/slack/index.ts +6 -1
- package/src/integrations/slack/types.ts +142 -29
- package/src/integrations/smtp/README.md +220 -0
- package/src/integrations/smtp/client.ts +4 -2
- package/src/integrations/smtp/docs.manifest.json +5 -0
- package/src/integrations/snowflake/client.ts +7 -5
- package/src/integrations/snowflake/docs.manifest.json +5 -0
- package/src/integrations/snowflake/types.ts +1 -0
- package/src/integrations/snowflakecortex/README.md +167 -0
- package/src/integrations/snowflakecortex/client.ts +2 -3
- package/src/integrations/snowflakecortex/docs.manifest.json +5 -0
- package/src/integrations/snowflakecortex/types.ts +3 -11
- package/src/integrations/snowflakepostgres/README.md +233 -0
- package/src/integrations/snowflakepostgres/client.ts +1 -1
- package/src/integrations/snowflakepostgres/docs.manifest.json +5 -0
- package/src/integrations/snowflakepostgres/types.ts +1 -0
- package/src/integrations/stabilityai/README.md +2 -2
- package/src/integrations/stabilityai/docs.manifest.json +5 -0
- package/src/integrations/stripe/docs.manifest.json +5 -0
- package/src/integrations/superblocks-ocr/docs.manifest.json +5 -0
- package/src/integrations/twilio/docs.manifest.json +5 -0
- package/src/integrations/zendesk/docs.manifest.json +5 -0
- package/src/integrations/zoom/README.md +15 -15
- package/src/integrations/zoom/docs.manifest.json +5 -0
- package/src/runtime/context.ts +11 -11
- package/src/runtime/executor.ts +2 -2
- package/src/runtime/index.ts +1 -23
- package/src/types.ts +16 -6
- 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/integrations/couchbase/client.d.ts +0 -30
- package/dist/integrations/couchbase/client.d.ts.map +0 -1
- package/dist/integrations/couchbase/client.js +0 -154
- package/dist/integrations/couchbase/client.js.map +0 -1
- package/dist/integrations/couchbase/index.d.ts +0 -8
- package/dist/integrations/couchbase/index.d.ts.map +0 -1
- package/dist/integrations/couchbase/index.js +0 -7
- package/dist/integrations/couchbase/index.js.map +0 -1
- package/dist/integrations/couchbase/types.d.ts +0 -100
- package/dist/integrations/couchbase/types.d.ts.map +0 -1
- package/dist/integrations/couchbase/types.js +0 -5
- package/dist/integrations/couchbase/types.js.map +0 -1
- package/dist/integrations/kafka/client.d.ts +0 -25
- package/dist/integrations/kafka/client.d.ts.map +0 -1
- package/dist/integrations/kafka/client.js +0 -124
- package/dist/integrations/kafka/client.js.map +0 -1
- package/dist/integrations/kafka/index.d.ts +0 -8
- package/dist/integrations/kafka/index.d.ts.map +0 -1
- package/dist/integrations/kafka/index.js +0 -7
- package/dist/integrations/kafka/index.js.map +0 -1
- package/dist/integrations/kafka/types.d.ts +0 -113
- package/dist/integrations/kafka/types.d.ts.map +0 -1
- package/dist/integrations/kafka/types.js +0 -5
- package/dist/integrations/kafka/types.js.map +0 -1
- package/dist/integrations/kinesis/client.d.ts +0 -31
- package/dist/integrations/kinesis/client.d.ts.map +0 -1
- package/dist/integrations/kinesis/client.js +0 -101
- package/dist/integrations/kinesis/client.js.map +0 -1
- package/dist/integrations/kinesis/index.d.ts +0 -8
- package/dist/integrations/kinesis/index.d.ts.map +0 -1
- package/dist/integrations/kinesis/index.js +0 -7
- package/dist/integrations/kinesis/index.js.map +0 -1
- package/dist/integrations/kinesis/types.d.ts +0 -97
- package/dist/integrations/kinesis/types.d.ts.map +0 -1
- package/dist/integrations/kinesis/types.js +0 -7
- package/dist/integrations/kinesis/types.js.map +0 -1
- package/dist/integrations/python/client.d.ts +0 -42
- package/dist/integrations/python/client.d.ts.map +0 -1
- package/dist/integrations/python/client.js +0 -89
- package/dist/integrations/python/client.js.map +0 -1
- package/dist/integrations/python/client.test.d.ts +0 -5
- package/dist/integrations/python/client.test.d.ts.map +0 -1
- package/dist/integrations/python/client.test.js +0 -214
- package/dist/integrations/python/client.test.js.map +0 -1
- package/dist/integrations/python/index.d.ts +0 -6
- package/dist/integrations/python/index.d.ts.map +0 -1
- package/dist/integrations/python/index.js +0 -5
- package/dist/integrations/python/index.js.map +0 -1
- package/dist/integrations/python/types.d.ts +0 -85
- package/dist/integrations/python/types.d.ts.map +0 -1
- package/dist/integrations/python/types.js +0 -5
- package/dist/integrations/python/types.js.map +0 -1
- package/dist/integrations/redis/client.d.ts +0 -43
- package/dist/integrations/redis/client.d.ts.map +0 -1
- package/dist/integrations/redis/client.js +0 -142
- package/dist/integrations/redis/client.js.map +0 -1
- package/dist/integrations/redis/index.d.ts +0 -8
- package/dist/integrations/redis/index.d.ts.map +0 -1
- package/dist/integrations/redis/index.js +0 -7
- package/dist/integrations/redis/index.js.map +0 -1
- package/dist/integrations/redis/types.d.ts +0 -137
- package/dist/integrations/redis/types.d.ts.map +0 -1
- package/dist/integrations/redis/types.js +0 -5
- package/dist/integrations/redis/types.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 -432
- package/src/api/streaming.ts +0 -302
- package/src/integrations/couchbase/README.md +0 -138
- package/src/integrations/couchbase/client.ts +0 -237
- package/src/integrations/couchbase/index.ts +0 -8
- package/src/integrations/couchbase/types.ts +0 -125
- package/src/integrations/kafka/README.md +0 -144
- package/src/integrations/kafka/client.ts +0 -215
- package/src/integrations/kafka/index.ts +0 -14
- package/src/integrations/kafka/types.ts +0 -127
- package/src/integrations/kinesis/README.md +0 -153
- package/src/integrations/kinesis/client.ts +0 -146
- package/src/integrations/kinesis/index.ts +0 -14
- package/src/integrations/kinesis/types.ts +0 -114
- package/src/integrations/python/README.md +0 -566
- package/src/integrations/python/client.test.ts +0 -340
- package/src/integrations/python/client.ts +0 -134
- package/src/integrations/python/index.ts +0 -6
- package/src/integrations/python/types.ts +0 -91
- package/src/integrations/redis/README.md +0 -200
- package/src/integrations/redis/client.ts +0 -207
- package/src/integrations/redis/index.ts +0 -8
- package/src/integrations/redis/types.ts +0 -166
- package/src/runtime/execute.ts +0 -221
- package/src/runtime/streaming-context.ts +0 -164
- package/src/runtime/streaming-executor.ts +0 -367
|
@@ -1,50 +1,163 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Slack client types.
|
|
3
|
+
*
|
|
4
|
+
* Defines the SlackResponse<T> discriminated union that wraps every
|
|
5
|
+
* Slack API call, plus the SlackClient interface consumers interact with.
|
|
3
6
|
*/
|
|
4
7
|
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
|
|
5
10
|
import type { BaseIntegrationClient } from "../../types.js";
|
|
6
|
-
import type {
|
|
11
|
+
import type { ApiRequestOptions, TraceMetadata } from "../base/types.js";
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
14
|
+
* Zod schema for Slack API error responses.
|
|
15
|
+
*
|
|
16
|
+
* Slack returns errors as HTTP 200 with `{ ok: false, error: "..." }`.
|
|
17
|
+
* For `missing_scope` errors, `needed` and `provided` list the
|
|
18
|
+
* required vs current OAuth scopes.
|
|
19
|
+
*/
|
|
20
|
+
export const SlackErrorSchema = z.object({
|
|
21
|
+
ok: z.literal(false),
|
|
22
|
+
error: z.string(),
|
|
23
|
+
needed: z.string().optional(),
|
|
24
|
+
provided: z.string().optional(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/** Slack API error response, derived from {@link SlackErrorSchema}. */
|
|
28
|
+
export type SlackErrorResponse = z.infer<typeof SlackErrorSchema>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Zod schema for Slack success envelopes.
|
|
32
|
+
*
|
|
33
|
+
* Success responses from Slack include `{ ok: true, ...payload }`.
|
|
34
|
+
* Callers provide schemas for the payload fields only; the SDK validates
|
|
35
|
+
* this envelope separately and injects `ok: true` in the returned type.
|
|
36
|
+
*/
|
|
37
|
+
export const SlackSuccessEnvelopeSchema = z.object({
|
|
38
|
+
ok: z.literal(true),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Enforce that caller-provided success schemas do not define `ok`.
|
|
10
43
|
*
|
|
11
|
-
*
|
|
12
|
-
|
|
44
|
+
* The `ok` field belongs to the Slack envelope and is injected by the SDK.
|
|
45
|
+
*/
|
|
46
|
+
type SlackSuccessSchemaHasExplicitOkKey<TSchema extends z.AnyZodObject> =
|
|
47
|
+
TSchema extends z.ZodObject<
|
|
48
|
+
infer TShape,
|
|
49
|
+
z.UnknownKeysParam,
|
|
50
|
+
z.ZodTypeAny,
|
|
51
|
+
unknown,
|
|
52
|
+
unknown
|
|
53
|
+
>
|
|
54
|
+
? "ok" extends keyof TShape
|
|
55
|
+
? true
|
|
56
|
+
: false
|
|
57
|
+
: false;
|
|
58
|
+
|
|
59
|
+
export type SlackSuccessSchema<TSchema extends z.AnyZodObject> =
|
|
60
|
+
SlackSuccessSchemaHasExplicitOkKey<TSchema> extends true ? never : TSchema;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Schema configuration for Slack API requests.
|
|
64
|
+
*
|
|
65
|
+
* Response schema must be an object payload schema (without `ok`).
|
|
66
|
+
*/
|
|
67
|
+
export interface SlackApiRequestSchema<
|
|
68
|
+
TBody,
|
|
69
|
+
TResponseSchema extends z.AnyZodObject,
|
|
70
|
+
> {
|
|
71
|
+
body?: z.ZodSchema<TBody>;
|
|
72
|
+
response: SlackSuccessSchema<TResponseSchema>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Slack success response shape with injected discriminant. */
|
|
76
|
+
export type SlackSuccessResponse<T extends Record<string, unknown>> = T & {
|
|
77
|
+
readonly ok: true;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Discriminated union of a Slack success response and error response.
|
|
82
|
+
*
|
|
83
|
+
* On success (`ok: true`), the type is `T & { ok: true }` — the
|
|
84
|
+
* validated schema output intersected with a literal `true` discriminant.
|
|
85
|
+
* On failure (`ok: false`), the type is {@link SlackErrorResponse}.
|
|
86
|
+
*
|
|
87
|
+
* Use the `ok` field as a discriminant for type narrowing:
|
|
13
88
|
*
|
|
14
89
|
* @example
|
|
15
90
|
* ```typescript
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* {
|
|
20
|
-
* method: 'POST',
|
|
21
|
-
* path: '/chat.postMessage',
|
|
22
|
-
* body: {
|
|
23
|
-
* channel: '#alerts',
|
|
24
|
-
* text: 'Deployment completed!',
|
|
25
|
-
* },
|
|
26
|
-
* },
|
|
27
|
-
* { response: PostMessageResponseSchema }
|
|
91
|
+
* const result = await ctx.integrations.slack.apiRequest(
|
|
92
|
+
* { method: "GET", path: "/conversations.list", params: { limit: 100 } },
|
|
93
|
+
* { response: ListChannelsSchema },
|
|
28
94
|
* );
|
|
29
95
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* })),
|
|
36
|
-
* });
|
|
96
|
+
* if (!result.ok) {
|
|
97
|
+
* // TypeScript narrows to SlackErrorResponse
|
|
98
|
+
* console.error(`Slack error: ${result.error}`);
|
|
99
|
+
* return;
|
|
100
|
+
* }
|
|
37
101
|
*
|
|
102
|
+
* // TypeScript narrows to T & { ok: true }
|
|
103
|
+
* result.channels.forEach(ch => console.log(ch.name));
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export type SlackResponse<T extends Record<string, unknown>> =
|
|
107
|
+
| SlackSuccessResponse<T>
|
|
108
|
+
| SlackErrorResponse;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Slack client for API interactions.
|
|
112
|
+
*
|
|
113
|
+
* Returns {@link SlackResponse}<T> from `apiRequest` — a discriminated
|
|
114
|
+
* union that encapsulates both Slack success and error responses. This
|
|
115
|
+
* avoids confusing Zod validation errors when Slack returns `ok: false`
|
|
116
|
+
* (which is an HTTP 200 with no success-specific fields).
|
|
117
|
+
*
|
|
118
|
+
* Note: SlackClient intentionally does not extend `SupportsApiRequest`.
|
|
119
|
+
* `SupportsApiRequest.apiRequest` returns `Promise<TResponse>`, while
|
|
120
|
+
* Slack returns `Promise<SlackResponse<T>>` by design.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
38
124
|
* const result = await ctx.integrations.slack.apiRequest(
|
|
39
125
|
* {
|
|
40
|
-
* method:
|
|
41
|
-
* path:
|
|
42
|
-
*
|
|
126
|
+
* method: "POST",
|
|
127
|
+
* path: "/chat.postMessage",
|
|
128
|
+
* body: { channel: "#alerts", text: "Deployed!" },
|
|
43
129
|
* },
|
|
44
|
-
* { response:
|
|
130
|
+
* { response: PostMessageResponseSchema },
|
|
45
131
|
* );
|
|
132
|
+
*
|
|
133
|
+
* if (!result.ok) {
|
|
134
|
+
* throw new Error(`Slack API error: ${result.error}`);
|
|
135
|
+
* }
|
|
136
|
+
*
|
|
137
|
+
* console.log(`Message sent: ${result.ts}`);
|
|
46
138
|
* ```
|
|
47
139
|
*/
|
|
48
|
-
export interface SlackClient extends BaseIntegrationClient
|
|
49
|
-
|
|
140
|
+
export interface SlackClient extends BaseIntegrationClient {
|
|
141
|
+
/**
|
|
142
|
+
* Execute a Slack API request with type-safe response handling.
|
|
143
|
+
*
|
|
144
|
+
* Returns a {@link SlackResponse}<TResponse> discriminated union:
|
|
145
|
+
* - On success: the Zod-validated payload with injected `ok: true`
|
|
146
|
+
* - On failure: a {@link SlackErrorResponse} with `ok: false` and the Slack error code
|
|
147
|
+
*
|
|
148
|
+
* Body validation still throws {@link RestApiValidationError} if the
|
|
149
|
+
* request body fails its Zod schema.
|
|
150
|
+
*
|
|
151
|
+
* @param options - Request configuration (method, path, params, body, headers)
|
|
152
|
+
* @param schema - Zod schemas for body and response validation (response REQUIRED)
|
|
153
|
+
* - `response` must be `z.object(...)`
|
|
154
|
+
* - `response` should define payload fields only (MUST NOT define `ok`)
|
|
155
|
+
* @param metadata - Optional trace metadata for observability
|
|
156
|
+
* @returns Discriminated union — check `result.ok` before accessing fields
|
|
157
|
+
*/
|
|
158
|
+
apiRequest<TBody, TResponseSchema extends z.AnyZodObject>(
|
|
159
|
+
options: ApiRequestOptions<TBody>,
|
|
160
|
+
schema: SlackApiRequestSchema<TBody, TResponseSchema>,
|
|
161
|
+
metadata?: TraceMetadata,
|
|
162
|
+
): Promise<SlackResponse<z.output<TResponseSchema>>>;
|
|
50
163
|
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# SMTP Client
|
|
2
|
+
|
|
3
|
+
Send emails via SMTP with support for HTML content, CC/BCC, reply-to, and attachments.
|
|
4
|
+
|
|
5
|
+
## Methods
|
|
6
|
+
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| -------------------------- | ---------------------- |
|
|
9
|
+
| `send(options, metadata?)` | Send an email via SMTP |
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Send a Simple Email
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { api, z, smtp } from "@superblocksteam/sdk-api";
|
|
17
|
+
|
|
18
|
+
// Integration ID from the integrations panel
|
|
19
|
+
const MAILER = "a1b2c3d4-5678-90ab-cdef-111111111111";
|
|
20
|
+
|
|
21
|
+
export default api({
|
|
22
|
+
name: "SendEmail",
|
|
23
|
+
integrations: {
|
|
24
|
+
mailer: smtp(MAILER),
|
|
25
|
+
},
|
|
26
|
+
input: z.object({
|
|
27
|
+
to: z.string(),
|
|
28
|
+
subject: z.string(),
|
|
29
|
+
body: z.string(),
|
|
30
|
+
}),
|
|
31
|
+
output: z.object({ success: z.boolean() }),
|
|
32
|
+
|
|
33
|
+
async run(ctx, { to, subject, body }) {
|
|
34
|
+
await ctx.integrations.mailer.send({
|
|
35
|
+
from: "noreply@example.com",
|
|
36
|
+
to,
|
|
37
|
+
subject,
|
|
38
|
+
body,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return { success: true };
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Send HTML Email
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
await ctx.integrations.mailer.send({
|
|
50
|
+
from: "noreply@example.com",
|
|
51
|
+
to: "user@example.com",
|
|
52
|
+
subject: "Welcome!",
|
|
53
|
+
body: "<h1>Welcome!</h1><p>Thank you for signing up.</p>",
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Send with CC and BCC
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
await ctx.integrations.mailer.send({
|
|
61
|
+
from: "noreply@example.com",
|
|
62
|
+
to: "user@example.com",
|
|
63
|
+
subject: "Team Update",
|
|
64
|
+
body: "Hello team!",
|
|
65
|
+
cc: "manager@example.com,lead@example.com",
|
|
66
|
+
bcc: "archive@example.com",
|
|
67
|
+
replyTo: "support@example.com",
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Send to Multiple Recipients
|
|
72
|
+
|
|
73
|
+
Use comma-separated email addresses:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
await ctx.integrations.mailer.send({
|
|
77
|
+
from: "noreply@example.com",
|
|
78
|
+
to: "user1@example.com,user2@example.com,user3@example.com",
|
|
79
|
+
subject: "Announcement",
|
|
80
|
+
body: "<p>Important update for the team.</p>",
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Send with Attachments
|
|
85
|
+
|
|
86
|
+
Attachments are passed as a JSON string containing an array of objects with `content` (base64-encoded), `name` (filename), and `type` (MIME type):
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const attachments = JSON.stringify([
|
|
90
|
+
{
|
|
91
|
+
content: base64EncodedPdf, // Base64-encoded file content
|
|
92
|
+
name: "report.pdf",
|
|
93
|
+
type: "application/pdf",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
content: base64EncodedCsv,
|
|
97
|
+
name: "data.csv",
|
|
98
|
+
type: "text/csv",
|
|
99
|
+
},
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
await ctx.integrations.mailer.send({
|
|
103
|
+
from: "reports@example.com",
|
|
104
|
+
to: "user@example.com",
|
|
105
|
+
subject: "Your Report",
|
|
106
|
+
body: "<p>Please find the attached report.</p>",
|
|
107
|
+
attachments,
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Trace Metadata
|
|
112
|
+
|
|
113
|
+
The `send` method accepts an optional `metadata` parameter as the last argument for diagnostics labeling:
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
await ctx.integrations.mailer.send(
|
|
117
|
+
{
|
|
118
|
+
from: "noreply@example.com",
|
|
119
|
+
to: "user@example.com",
|
|
120
|
+
subject: "Welcome",
|
|
121
|
+
body: "Hello!",
|
|
122
|
+
},
|
|
123
|
+
{ label: "Send welcome email" },
|
|
124
|
+
);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
When `includeDiagnostics` is enabled, `label` and `description` appear in the trace view. See the [root SDK README](../../../README.md#trace-metadata) for details.
|
|
128
|
+
|
|
129
|
+
## Send Options Reference
|
|
130
|
+
|
|
131
|
+
| Option | Type | Required | Description |
|
|
132
|
+
| ------------- | -------- | -------- | --------------------------------------------- |
|
|
133
|
+
| `from` | `string` | Yes | Sender email address |
|
|
134
|
+
| `to` | `string` | Yes | Recipient(s), comma-separated for multiple |
|
|
135
|
+
| `subject` | `string` | Yes | Email subject line |
|
|
136
|
+
| `body` | `string` | Yes | Email body (HTML or plain text) |
|
|
137
|
+
| `cc` | `string` | No | CC recipient(s), comma-separated |
|
|
138
|
+
| `bcc` | `string` | No | BCC recipient(s), comma-separated |
|
|
139
|
+
| `replyTo` | `string` | No | Reply-to email address |
|
|
140
|
+
| `attachments` | `string` | No | JSON array of `{content, name, type}` objects |
|
|
141
|
+
|
|
142
|
+
## Common Pitfalls
|
|
143
|
+
|
|
144
|
+
### Use the `send` Method, Not `apiRequest`
|
|
145
|
+
|
|
146
|
+
Unlike most integrations, SMTP has a dedicated `send()` method:
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
// WRONG - apiRequest does not exist on SmtpClient
|
|
150
|
+
await ctx.integrations.mailer.apiRequest({ ... });
|
|
151
|
+
|
|
152
|
+
// CORRECT - Use send()
|
|
153
|
+
await ctx.integrations.mailer.send({
|
|
154
|
+
from: "noreply@example.com",
|
|
155
|
+
to: "user@example.com",
|
|
156
|
+
subject: "Hello",
|
|
157
|
+
body: "World",
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Attachments Must Be a JSON String
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
// WRONG - Passing an array directly
|
|
165
|
+
await ctx.integrations.mailer.send({
|
|
166
|
+
from: "noreply@example.com",
|
|
167
|
+
to: "user@example.com",
|
|
168
|
+
subject: "Report",
|
|
169
|
+
body: "See attached",
|
|
170
|
+
attachments: [{ content: "...", name: "file.pdf", type: "application/pdf" }],
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// CORRECT - JSON.stringify the array
|
|
174
|
+
await ctx.integrations.mailer.send({
|
|
175
|
+
from: "noreply@example.com",
|
|
176
|
+
to: "user@example.com",
|
|
177
|
+
subject: "Report",
|
|
178
|
+
body: "See attached",
|
|
179
|
+
attachments: JSON.stringify([
|
|
180
|
+
{ content: "...", name: "file.pdf", type: "application/pdf" },
|
|
181
|
+
]),
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Multiple Recipients Use Comma Separation
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
// WRONG - Array of recipients
|
|
189
|
+
await ctx.integrations.mailer.send({
|
|
190
|
+
to: ["user1@example.com", "user2@example.com"],
|
|
191
|
+
// ...
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// CORRECT - Comma-separated string
|
|
195
|
+
await ctx.integrations.mailer.send({
|
|
196
|
+
to: "user1@example.com,user2@example.com",
|
|
197
|
+
// ...
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Error Handling
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
import { IntegrationError } from "@superblocksteam/sdk-api";
|
|
205
|
+
|
|
206
|
+
try {
|
|
207
|
+
await ctx.integrations.mailer.send({
|
|
208
|
+
from: "noreply@example.com",
|
|
209
|
+
to: "user@example.com",
|
|
210
|
+
subject: "Test",
|
|
211
|
+
body: "Hello",
|
|
212
|
+
});
|
|
213
|
+
} catch (error) {
|
|
214
|
+
if (error instanceof IntegrationError) {
|
|
215
|
+
console.error(
|
|
216
|
+
`SMTP error in ${error.integrationName}.${error.method}: ${error.message}`,
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
9
|
+
|
|
9
10
|
import type { Plugin as SmtpPlugin } from "@superblocksteam/types/dist/src/plugins/smtp/v1/plugin_pb";
|
|
10
|
-
|
|
11
|
-
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
11
|
+
|
|
12
12
|
import { IntegrationError } from "../../runtime/errors.js";
|
|
13
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
14
|
+
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
13
15
|
import type { SmtpClient, SmtpSendOptions } from "./types.js";
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
* runtime validation using Zod schemas.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { z } from "zod";
|
|
9
8
|
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
9
|
+
import type { z } from "zod";
|
|
10
|
+
|
|
10
11
|
import type { Plugin as SnowflakePlugin } from "@superblocksteam/types/dist/src/plugins/snowflake/v1/plugin_pb";
|
|
11
|
-
|
|
12
|
-
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
12
|
+
|
|
13
13
|
import { QueryValidationError } from "../../errors.js";
|
|
14
14
|
import { IntegrationError } from "../../runtime/errors.js";
|
|
15
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
16
|
+
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
15
17
|
import { describeType } from "../utils.js";
|
|
16
18
|
import type { SnowflakeClient } from "./types.js";
|
|
17
19
|
|
|
@@ -41,10 +43,10 @@ export class SnowflakeClientImpl
|
|
|
41
43
|
* Builds a Snowflake request object from SQL and parameters.
|
|
42
44
|
*
|
|
43
45
|
* When params are provided, the SQL body is sent with placeholders intact
|
|
44
|
-
* (e.g.
|
|
46
|
+
* (e.g. ?) and the parameter values are passed via the `parameters`
|
|
45
47
|
* field as a JSON-stringified array for server-side binding.
|
|
46
48
|
*
|
|
47
|
-
* @param sql - The SQL query with optional
|
|
49
|
+
* @param sql - The SQL query with optional ? placeholders
|
|
48
50
|
* @param params - Optional array of parameter values for server-side binding
|
|
49
51
|
* @returns The plugin request object
|
|
50
52
|
*/
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Snowflake Cortex Client
|
|
2
|
+
|
|
3
|
+
Interact with Snowflake Cortex AI/ML inference endpoints for text generation, embeddings, and other AI capabilities.
|
|
4
|
+
|
|
5
|
+
## Methods
|
|
6
|
+
|
|
7
|
+
| Method | Description |
|
|
8
|
+
| ---------------------------------------- | ------------------------------------------------------------ |
|
|
9
|
+
| `apiRequest(options, schema, metadata?)` | Make any Snowflake Cortex API request with schema validation |
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Text Completion
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { api, z, snowflakeCortex } from "@superblocksteam/sdk-api";
|
|
17
|
+
|
|
18
|
+
// Integration ID from the integrations panel
|
|
19
|
+
const CORTEX = "a1b2c3d4-5678-90ab-cdef-111111111111";
|
|
20
|
+
|
|
21
|
+
const CompletionResponseSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
choices: z
|
|
24
|
+
.array(
|
|
25
|
+
z
|
|
26
|
+
.object({
|
|
27
|
+
message: z
|
|
28
|
+
.object({
|
|
29
|
+
content: z.string().optional(),
|
|
30
|
+
})
|
|
31
|
+
.passthrough()
|
|
32
|
+
.optional(),
|
|
33
|
+
})
|
|
34
|
+
.passthrough(),
|
|
35
|
+
)
|
|
36
|
+
.optional(),
|
|
37
|
+
})
|
|
38
|
+
.passthrough();
|
|
39
|
+
|
|
40
|
+
export default api({
|
|
41
|
+
name: "CortexCompletion",
|
|
42
|
+
integrations: {
|
|
43
|
+
cortex: snowflakeCortex(CORTEX),
|
|
44
|
+
},
|
|
45
|
+
input: z.object({
|
|
46
|
+
prompt: z.string(),
|
|
47
|
+
}),
|
|
48
|
+
output: z.object({
|
|
49
|
+
response: z.string(),
|
|
50
|
+
}),
|
|
51
|
+
async run(ctx, { prompt }) {
|
|
52
|
+
const result = await ctx.integrations.cortex.apiRequest(
|
|
53
|
+
{
|
|
54
|
+
method: "POST",
|
|
55
|
+
path: "/api/v2/cortex/inference:complete",
|
|
56
|
+
body: {
|
|
57
|
+
model: "llama3.1-8b",
|
|
58
|
+
messages: [{ role: "user", content: prompt }],
|
|
59
|
+
stream: false,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
body: z.object({
|
|
64
|
+
model: z.string(),
|
|
65
|
+
messages: z.array(
|
|
66
|
+
z.object({ role: z.string(), content: z.string() }),
|
|
67
|
+
),
|
|
68
|
+
stream: z.boolean(),
|
|
69
|
+
}),
|
|
70
|
+
response: CompletionResponseSchema,
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
response: result.choices?.[0]?.message?.content ?? "",
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Text Embedding
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
const EmbeddingResponseSchema = z.object({
|
|
85
|
+
data: z.array(
|
|
86
|
+
z.object({
|
|
87
|
+
embedding: z.array(z.number()),
|
|
88
|
+
}),
|
|
89
|
+
),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const embeddings = await ctx.integrations.cortex.apiRequest(
|
|
93
|
+
{
|
|
94
|
+
method: "POST",
|
|
95
|
+
path: "/api/v2/cortex/inference:embed",
|
|
96
|
+
body: {
|
|
97
|
+
model: "e5-base-v2",
|
|
98
|
+
input: ["Hello world", "How are you?"],
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{ response: EmbeddingResponseSchema },
|
|
102
|
+
);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Trace Metadata
|
|
106
|
+
|
|
107
|
+
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.
|
|
108
|
+
|
|
109
|
+
## Common Pitfalls
|
|
110
|
+
|
|
111
|
+
### No Specialized Methods
|
|
112
|
+
|
|
113
|
+
The Snowflake Cortex client only provides `apiRequest()`. There are no other specialized methods:
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
// WRONG - These methods do not exist
|
|
117
|
+
await cortex.complete({ ... });
|
|
118
|
+
await cortex.embed({ ... });
|
|
119
|
+
|
|
120
|
+
// CORRECT - Use apiRequest for all operations
|
|
121
|
+
await ctx.integrations.cortex.apiRequest(
|
|
122
|
+
{ method: "POST", path: "/api/v2/cortex/inference:complete", body: { ... } },
|
|
123
|
+
{ response: ResponseSchema }
|
|
124
|
+
);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Response Schema is Required
|
|
128
|
+
|
|
129
|
+
You must always provide a schema object with at least a `response` schema. The `body` schema is optional but recommended for request validation:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
// WRONG - Missing schema object entirely
|
|
133
|
+
const result = await ctx.integrations.cortex.apiRequest({
|
|
134
|
+
method: "POST",
|
|
135
|
+
path: "/api/v2/cortex/inference:complete",
|
|
136
|
+
body: { ... },
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// CORRECT - Include at least a response schema
|
|
140
|
+
const result = await ctx.integrations.cortex.apiRequest(
|
|
141
|
+
{ method: "POST", path: "/api/v2/cortex/inference:complete", body: { ... } },
|
|
142
|
+
{ response: CompletionResponseSchema }
|
|
143
|
+
);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Error Handling
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import { RestApiValidationError } from "@superblocksteam/sdk-api";
|
|
150
|
+
|
|
151
|
+
try {
|
|
152
|
+
const result = await ctx.integrations.cortex.apiRequest(
|
|
153
|
+
{ method: "POST", path: "/api/v2/cortex/inference:complete", body: { ... } },
|
|
154
|
+
{ response: CompletionResponseSchema }
|
|
155
|
+
);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
if (error instanceof RestApiValidationError) {
|
|
158
|
+
console.error("Validation failed:", error.details.zodError);
|
|
159
|
+
console.error("Actual response:", error.details.data);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## API Reference
|
|
165
|
+
|
|
166
|
+
- [Snowflake Cortex Documentation](https://docs.snowflake.com/en/user-guide/snowflake-cortex/overview)
|
|
167
|
+
- [Cortex LLM Functions](https://docs.snowflake.com/en/user-guide/snowflake-cortex/llm-functions)
|
|
@@ -11,12 +11,11 @@ import type { SnowflakeCortexClient } from "./types.js";
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal implementation of SnowflakeCortexClient.
|
|
13
13
|
*
|
|
14
|
-
* Extends RestApiIntegrationClient to inherit generic apiRequest()
|
|
15
|
-
* streamApiRequest() methods.
|
|
14
|
+
* Extends RestApiIntegrationClient to inherit generic apiRequest() method.
|
|
16
15
|
*/
|
|
17
16
|
export class SnowflakeCortexClientImpl
|
|
18
17
|
extends RestApiIntegrationClient
|
|
19
18
|
implements SnowflakeCortexClient {
|
|
20
|
-
// Inherits: name, pluginId, config, executeQuery, createParam(), apiRequest()
|
|
19
|
+
// Inherits: name, pluginId, config, executeQuery, createParam(), apiRequest()
|
|
21
20
|
// Can add Snowflake Cortex-specific methods here in the future if needed
|
|
22
21
|
}
|