@superblocksteam/sdk-api 0.0.6 → 0.0.8
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 +118 -0
- package/dist/integrations/base/rest-api-client-base.js.map +1 -0
- package/dist/integrations/base/rest-api-integration-client.d.ts +18 -66
- package/dist/integrations/base/rest-api-integration-client.d.ts.map +1 -1
- package/dist/integrations/base/rest-api-integration-client.js +38 -173
- package/dist/integrations/base/rest-api-integration-client.js.map +1 -1
- package/dist/integrations/base/types.d.ts +59 -59
- package/dist/integrations/base/types.d.ts.map +1 -1
- package/dist/integrations/base/types.js +23 -1
- package/dist/integrations/base/types.js.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 +774 -0
- package/dist/integrations/documentation-resolver.test.js.map +1 -0
- package/dist/integrations/documentation.d.ts +9 -0
- package/dist/integrations/documentation.d.ts.map +1 -0
- package/dist/integrations/documentation.js +300 -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 +1 -8
- 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/client.test.d.ts +12 -0
- package/dist/integrations/restapiintegration/client.test.d.ts.map +1 -0
- package/dist/integrations/restapiintegration/client.test.js +236 -0
- package/dist/integrations/restapiintegration/client.test.js.map +1 -0
- 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 +7 -7
- 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 +3 -3
- package/src/integrations/base/rest-api-client-base.ts +158 -0
- package/src/integrations/base/rest-api-integration-client.ts +62 -237
- package/src/integrations/base/types.ts +68 -64
- 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 +893 -0
- package/src/integrations/documentation.test.ts +120 -0
- package/src/integrations/documentation.ts +473 -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 +10 -0
- package/src/integrations/graphql/overlays/dynamic-headers.md +34 -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 +7 -5
- 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/client.test.ts +359 -0
- package/src/integrations/restapiintegration/docs.manifest.json +14 -0
- package/src/integrations/restapiintegration/overlays/response-types-unsupported.md +5 -0
- package/src/integrations/restapiintegration/overlays/response-types.md +26 -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 -36
- package/dist/integrations/couchbase/client.d.ts.map +0 -1
- package/dist/integrations/couchbase/client.js +0 -148
- 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 -224
- 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
|
@@ -66,18 +66,11 @@ export {
|
|
|
66
66
|
mongodb,
|
|
67
67
|
dynamodb,
|
|
68
68
|
cosmosdb,
|
|
69
|
-
couchbase,
|
|
70
69
|
s3,
|
|
71
70
|
gcs,
|
|
72
71
|
googleSheets,
|
|
73
|
-
kafka,
|
|
74
|
-
kinesis,
|
|
75
72
|
salesforce,
|
|
76
|
-
redis,
|
|
77
73
|
superblocksOcr,
|
|
78
|
-
python,
|
|
79
|
-
confluent,
|
|
80
|
-
redpanda,
|
|
81
74
|
lakebase,
|
|
82
75
|
snowflakePostgres,
|
|
83
76
|
smtp,
|
|
@@ -143,18 +136,11 @@ export {
|
|
|
143
136
|
type MongoDBRef,
|
|
144
137
|
type DynamoDBRef,
|
|
145
138
|
type CosmosDBRef,
|
|
146
|
-
type CouchbaseRef,
|
|
147
139
|
type S3Ref,
|
|
148
140
|
type GCSRef,
|
|
149
141
|
type GoogleSheetsRef,
|
|
150
|
-
type KafkaRef,
|
|
151
|
-
type KinesisRef,
|
|
152
142
|
type SalesforceRef,
|
|
153
|
-
type RedisRef,
|
|
154
143
|
type SuperblocksOCRRef,
|
|
155
|
-
type PythonRef,
|
|
156
|
-
type ConfluentRef,
|
|
157
|
-
type RedpandaRef,
|
|
158
144
|
type LakebaseRef,
|
|
159
145
|
type SnowflakePostgresRef,
|
|
160
146
|
type SmtpRef,
|
|
@@ -166,9 +152,9 @@ export {
|
|
|
166
152
|
createClient,
|
|
167
153
|
isPluginSupported,
|
|
168
154
|
SUPPORTED_PLUGINS,
|
|
155
|
+
SUPPORTED_PLUGIN_IDS,
|
|
169
156
|
type SupportedPluginId,
|
|
170
157
|
type QueryExecutor,
|
|
171
|
-
type StreamingQueryExecutor,
|
|
172
158
|
type TraceMetadata,
|
|
173
159
|
type CreateClientOptions,
|
|
174
160
|
} from "./registry.js";
|
|
@@ -384,13 +370,6 @@ export { DynamoDBClientImpl } from "./dynamodb/index.js";
|
|
|
384
370
|
export type { CosmosDBClient, CosmosDBQueryOptions } from "./cosmosdb/index.js";
|
|
385
371
|
export { CosmosDBClientImpl } from "./cosmosdb/index.js";
|
|
386
372
|
|
|
387
|
-
// Couchbase client
|
|
388
|
-
export type {
|
|
389
|
-
CouchbaseClient,
|
|
390
|
-
CouchbaseIdentifier,
|
|
391
|
-
} from "./couchbase/index.js";
|
|
392
|
-
export { CouchbaseClientImpl } from "./couchbase/index.js";
|
|
393
|
-
|
|
394
373
|
// S3 client
|
|
395
374
|
export type {
|
|
396
375
|
S3Client,
|
|
@@ -417,26 +396,6 @@ export type {
|
|
|
417
396
|
} from "./gsheets/index.js";
|
|
418
397
|
export { GoogleSheetsClientImpl } from "./gsheets/index.js";
|
|
419
398
|
|
|
420
|
-
// Kafka client
|
|
421
|
-
export type {
|
|
422
|
-
KafkaClient,
|
|
423
|
-
KafkaOperation,
|
|
424
|
-
KafkaSeek,
|
|
425
|
-
KafkaConsumeParams,
|
|
426
|
-
KafkaProduceParams,
|
|
427
|
-
} from "./kafka/index.js";
|
|
428
|
-
export { KafkaClientImpl } from "./kafka/index.js";
|
|
429
|
-
|
|
430
|
-
// Kinesis client
|
|
431
|
-
export type {
|
|
432
|
-
KinesisClient,
|
|
433
|
-
KinesisPutParams,
|
|
434
|
-
KinesisGetParams,
|
|
435
|
-
KinesisStreamIdentifier,
|
|
436
|
-
KinesisShardIteratorType,
|
|
437
|
-
} from "./kinesis/index.js";
|
|
438
|
-
export { KinesisClientImpl } from "./kinesis/index.js";
|
|
439
|
-
|
|
440
399
|
// Salesforce client
|
|
441
400
|
export type {
|
|
442
401
|
SalesforceClient,
|
|
@@ -445,18 +404,10 @@ export type {
|
|
|
445
404
|
} from "./salesforce/index.js";
|
|
446
405
|
export { SalesforceClientImpl } from "./salesforce/index.js";
|
|
447
406
|
|
|
448
|
-
// Redis client
|
|
449
|
-
export type { RedisClient } from "./redis/index.js";
|
|
450
|
-
export { RedisClientImpl } from "./redis/index.js";
|
|
451
|
-
|
|
452
407
|
// Superblocks OCR client
|
|
453
408
|
export type { SuperblocksOCRClient } from "./superblocks-ocr/index.js";
|
|
454
409
|
export { SuperblocksOCRClientImpl } from "./superblocks-ocr/index.js";
|
|
455
410
|
|
|
456
|
-
// Python client
|
|
457
|
-
export type { PythonClient } from "./python/index.js";
|
|
458
|
-
export { PythonClientImpl } from "./python/index.js";
|
|
459
|
-
|
|
460
411
|
// Lakebase client
|
|
461
412
|
export type { LakebaseClient } from "./lakebase/index.js";
|
|
462
413
|
export { LakebaseClientImpl } from "./lakebase/index.js";
|
|
@@ -472,5 +423,3 @@ export { SmtpClientImpl } from "./smtp/index.js";
|
|
|
472
423
|
// REST API Integration client
|
|
473
424
|
export type { RestApiIntegrationPluginClient } from "./restapiintegration/index.js";
|
|
474
425
|
export { RestApiIntegrationPluginClientImpl } from "./restapiintegration/index.js";
|
|
475
|
-
|
|
476
|
-
// Confluent and Redpanda reuse the Kafka client (same proto)
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# Lakebase Client
|
|
2
|
+
|
|
3
|
+
Execute SQL queries and statements against Lakebase databases with full type safety and runtime validation.
|
|
4
|
+
|
|
5
|
+
## Methods
|
|
6
|
+
|
|
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
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Basic Query with Schema Validation
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { api, z, lakebase } from "@superblocksteam/sdk-api";
|
|
18
|
+
|
|
19
|
+
// Integration ID from the integrations panel
|
|
20
|
+
const LAKEBASE_DB = "a1b2c3d4-5678-90ab-cdef-111111111111";
|
|
21
|
+
|
|
22
|
+
const UserSchema = z.object({
|
|
23
|
+
id: z.string(),
|
|
24
|
+
name: z.string(),
|
|
25
|
+
email: z.string(),
|
|
26
|
+
created_at: z.string(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export default api({
|
|
30
|
+
name: "GetUsers",
|
|
31
|
+
integrations: {
|
|
32
|
+
db: lakebase(LAKEBASE_DB),
|
|
33
|
+
},
|
|
34
|
+
input: z.object({
|
|
35
|
+
status: z.string(),
|
|
36
|
+
}),
|
|
37
|
+
output: z.object({
|
|
38
|
+
users: z.array(UserSchema),
|
|
39
|
+
}),
|
|
40
|
+
async run(ctx, { status }) {
|
|
41
|
+
const users = await ctx.integrations.db.query(
|
|
42
|
+
"SELECT id, name, email, created_at FROM users WHERE status = $1",
|
|
43
|
+
UserSchema,
|
|
44
|
+
[status],
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return { users };
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Executing INSERT, UPDATE, DELETE Statements
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { api, z, lakebase } from "@superblocksteam/sdk-api";
|
|
56
|
+
|
|
57
|
+
const LAKEBASE_DB = "a1b2c3d4-5678-90ab-cdef-111111111111";
|
|
58
|
+
|
|
59
|
+
export default api({
|
|
60
|
+
name: "ManageUsers",
|
|
61
|
+
integrations: {
|
|
62
|
+
db: lakebase(LAKEBASE_DB),
|
|
63
|
+
},
|
|
64
|
+
input: z.object({
|
|
65
|
+
name: z.string(),
|
|
66
|
+
email: z.string(),
|
|
67
|
+
}),
|
|
68
|
+
output: z.object({ success: z.boolean() }),
|
|
69
|
+
|
|
70
|
+
async run(ctx, { name, email }) {
|
|
71
|
+
// INSERT
|
|
72
|
+
await ctx.integrations.db.execute(
|
|
73
|
+
"INSERT INTO users (name, email) VALUES ($1, $2)",
|
|
74
|
+
[name, email],
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// UPDATE
|
|
78
|
+
const updateResult = await ctx.integrations.db.execute(
|
|
79
|
+
"UPDATE users SET last_login = NOW() WHERE email = $1",
|
|
80
|
+
[email],
|
|
81
|
+
);
|
|
82
|
+
console.log(`Updated ${updateResult.rowCount} rows`);
|
|
83
|
+
|
|
84
|
+
// DELETE
|
|
85
|
+
const deleteResult = await ctx.integrations.db.execute(
|
|
86
|
+
"DELETE FROM sessions WHERE expires_at < NOW()",
|
|
87
|
+
);
|
|
88
|
+
console.log(`Deleted ${deleteResult.rowCount} expired sessions`);
|
|
89
|
+
|
|
90
|
+
return { success: true };
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Query with JOIN
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const OrderSchema = z.object({
|
|
99
|
+
order_id: z.string(),
|
|
100
|
+
customer_name: z.string(),
|
|
101
|
+
total: z.string(), // NUMERIC as string
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const orders = await ctx.integrations.db.query(
|
|
105
|
+
`SELECT o.id as order_id, c.name as customer_name, o.total
|
|
106
|
+
FROM orders o
|
|
107
|
+
JOIN customers c ON o.customer_id = c.id
|
|
108
|
+
WHERE o.status = $1`,
|
|
109
|
+
OrderSchema,
|
|
110
|
+
["pending"],
|
|
111
|
+
);
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Trace Metadata
|
|
115
|
+
|
|
116
|
+
All methods accept an optional `metadata` parameter as the last argument for diagnostics labeling:
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
const users = await ctx.integrations.db.query(
|
|
120
|
+
"SELECT * FROM users WHERE status = $1",
|
|
121
|
+
UserSchema,
|
|
122
|
+
["active"],
|
|
123
|
+
{ label: "Fetch active users" },
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
await ctx.integrations.db.execute(
|
|
127
|
+
"DELETE FROM sessions WHERE expires_at < NOW()",
|
|
128
|
+
undefined, // no params
|
|
129
|
+
{ label: "Clean expired sessions" },
|
|
130
|
+
);
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
When `includeDiagnostics` is enabled, `label` and `description` appear in the trace view. See the [root SDK README](../../../README.md#trace-metadata) for details.
|
|
134
|
+
|
|
135
|
+
## Common Pitfalls
|
|
136
|
+
|
|
137
|
+
### Uses `$1` Placeholders (PostgreSQL-Style)
|
|
138
|
+
|
|
139
|
+
Lakebase uses `$1, $2, ...` for parameter placeholders, following PostgreSQL conventions:
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
// WRONG - Question-mark placeholders
|
|
143
|
+
const users = await ctx.integrations.db.query(
|
|
144
|
+
"SELECT * FROM users WHERE name = ? AND status = ?",
|
|
145
|
+
UserSchema,
|
|
146
|
+
[name, status],
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
// CORRECT - Use $1, $2, ... placeholders
|
|
150
|
+
const users = await ctx.integrations.db.query(
|
|
151
|
+
"SELECT * FROM users WHERE name = $1 AND status = $2",
|
|
152
|
+
UserSchema,
|
|
153
|
+
[name, status],
|
|
154
|
+
);
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Schema Parameter is Required
|
|
158
|
+
|
|
159
|
+
The `query()` method requires a Zod schema for runtime validation:
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
// WRONG - Missing schema parameter
|
|
163
|
+
const users = await ctx.integrations.db.query(
|
|
164
|
+
"SELECT * FROM users",
|
|
165
|
+
[
|
|
166
|
+
/* params */
|
|
167
|
+
], // This is wrong - params are 3rd argument
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
// CORRECT - Schema is the second parameter
|
|
171
|
+
const users = await ctx.integrations.db.query(
|
|
172
|
+
"SELECT * FROM users WHERE id = $1",
|
|
173
|
+
UserSchema, // Schema is required
|
|
174
|
+
[userId], // Params are optional, third argument
|
|
175
|
+
);
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Use Parameterized Queries to Prevent SQL Injection
|
|
179
|
+
|
|
180
|
+
Always use `$1, $2, ...` placeholders instead of string interpolation:
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
// WRONG - SQL injection vulnerability
|
|
184
|
+
const users = await ctx.integrations.db.query(
|
|
185
|
+
`SELECT * FROM users WHERE name = '${userName}'`, // DANGEROUS!
|
|
186
|
+
UserSchema,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
// CORRECT - Use parameterized queries
|
|
190
|
+
const users = await ctx.integrations.db.query(
|
|
191
|
+
"SELECT * FROM users WHERE name = $1",
|
|
192
|
+
UserSchema,
|
|
193
|
+
[userName], // Safe - value is escaped
|
|
194
|
+
);
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### NUMERIC/DECIMAL Values Returned as Strings
|
|
198
|
+
|
|
199
|
+
Large `NUMERIC` and `DECIMAL` columns are returned as strings to preserve precision:
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
// WRONG - May lose precision
|
|
203
|
+
const schema = z.object({ price: z.number() });
|
|
204
|
+
|
|
205
|
+
// CORRECT - Keep as string or transform
|
|
206
|
+
const schema = z.object({
|
|
207
|
+
price: z.string().transform((val) => parseFloat(val)),
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Handling NULL Values
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
// WRONG - Will fail if column contains NULL
|
|
215
|
+
const schema = z.object({ bio: z.string() });
|
|
216
|
+
|
|
217
|
+
// CORRECT - Mark nullable columns
|
|
218
|
+
const schema = z.object({ bio: z.string().nullable() });
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Error Handling
|
|
222
|
+
|
|
223
|
+
### QueryValidationError
|
|
224
|
+
|
|
225
|
+
Thrown when query results fail schema validation:
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
import { QueryValidationError } from "@superblocksteam/sdk-api";
|
|
229
|
+
|
|
230
|
+
try {
|
|
231
|
+
const users = await ctx.integrations.db.query(
|
|
232
|
+
"SELECT * FROM users",
|
|
233
|
+
UserSchema,
|
|
234
|
+
);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
if (error instanceof QueryValidationError) {
|
|
237
|
+
console.error("Row index:", error.details.rowIndex);
|
|
238
|
+
console.error("Validation errors:", error.details.errors);
|
|
239
|
+
console.error("Actual row data:", error.details.row);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
@@ -5,15 +5,17 @@
|
|
|
5
5
|
* Supports server-side parameterized SQL queries via the `parameters` field.
|
|
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 LakebasePlugin } from "@superblocksteam/types/dist/src/plugins/lakebase/v1/plugin_pb";
|
|
11
|
-
|
|
12
|
-
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
13
|
-
import type { LakebaseClient } from "./types.js";
|
|
12
|
+
|
|
14
13
|
import { QueryValidationError } from "../../errors.js";
|
|
15
14
|
import { IntegrationError } from "../../runtime/errors.js";
|
|
15
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
16
|
+
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
16
17
|
import { describeType } from "../utils.js";
|
|
18
|
+
import type { LakebaseClient } from "./types.js";
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* Lakebase request type derived from proto definition.
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { z } from "zod";
|
|
9
|
+
|
|
9
10
|
import type { BaseIntegrationClient } from "../../types.js";
|
|
10
11
|
import type { TraceMetadata } from "../registry.js";
|
|
11
12
|
|
|
@@ -18,14 +19,14 @@ import type { TraceMetadata } from "../registry.js";
|
|
|
18
19
|
*
|
|
19
20
|
* // Parameterized query
|
|
20
21
|
* const users = await lb.query(
|
|
21
|
-
* 'SELECT * FROM users WHERE status =
|
|
22
|
+
* 'SELECT * FROM users WHERE status = $1',
|
|
22
23
|
* UserSchema,
|
|
23
24
|
* ['active'],
|
|
24
25
|
* );
|
|
25
26
|
*
|
|
26
27
|
* // Execute a mutation
|
|
27
28
|
* const result = await lb.execute(
|
|
28
|
-
* 'INSERT INTO users (name, email) VALUES (
|
|
29
|
+
* 'INSERT INTO users (name, email) VALUES ($1, $2)',
|
|
29
30
|
* ['Alice', 'alice@example.com'],
|
|
30
31
|
* );
|
|
31
32
|
* ```
|
|
@@ -34,7 +35,7 @@ export interface LakebaseClient extends BaseIntegrationClient {
|
|
|
34
35
|
/**
|
|
35
36
|
* Execute a SQL query and return validated rows.
|
|
36
37
|
*
|
|
37
|
-
* @param sql - SQL query string with
|
|
38
|
+
* @param sql - SQL query string with `$1`, `$2` placeholders for parameters
|
|
38
39
|
* @param schema - Zod schema for validating each result row
|
|
39
40
|
* @param params - Optional query parameters for server-side binding
|
|
40
41
|
* @returns Array of validated rows
|
|
@@ -49,7 +50,7 @@ export interface LakebaseClient extends BaseIntegrationClient {
|
|
|
49
50
|
/**
|
|
50
51
|
* Execute a SQL statement (INSERT, UPDATE, DELETE).
|
|
51
52
|
*
|
|
52
|
-
* @param sql - SQL statement with
|
|
53
|
+
* @param sql - SQL statement with `$1`, `$2` placeholders for parameters
|
|
53
54
|
* @param params - Optional query parameters for server-side binding
|
|
54
55
|
* @returns The affected row count
|
|
55
56
|
*/
|
|
@@ -13,7 +13,7 @@ Manage feature flags, get flag evaluations, and interact with LaunchDarkly's fea
|
|
|
13
13
|
### Get Feature Flag
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import { api, z,
|
|
16
|
+
import { api, z, launchDarkly } from "@superblocksteam/sdk-api";
|
|
17
17
|
|
|
18
18
|
// Integration ID from the integrations panel
|
|
19
19
|
const PROD_LAUNCHDARKLY = "a1b2c3d4-5678-90ab-cdef-launchda0001";
|
|
@@ -44,7 +44,7 @@ const FlagSchema = z.object({
|
|
|
44
44
|
|
|
45
45
|
export default api({
|
|
46
46
|
integrations: {
|
|
47
|
-
launchdarkly:
|
|
47
|
+
launchdarkly: launchDarkly(PROD_LAUNCHDARKLY),
|
|
48
48
|
},
|
|
49
49
|
name: "LaunchDarklyExample",
|
|
50
50
|
input: z.object({
|
|
@@ -39,7 +39,7 @@ export default api({
|
|
|
39
39
|
}),
|
|
40
40
|
async run(ctx, { status }) {
|
|
41
41
|
const users = await ctx.integrations.mariadb.query(
|
|
42
|
-
"SELECT id, name, email, created_at FROM users WHERE status =
|
|
42
|
+
"SELECT id, name, email, created_at FROM users WHERE status = ?",
|
|
43
43
|
UserSchema,
|
|
44
44
|
[status],
|
|
45
45
|
);
|
|
@@ -54,13 +54,13 @@ export default api({
|
|
|
54
54
|
```typescript
|
|
55
55
|
// INSERT
|
|
56
56
|
await ctx.integrations.mariadb.execute(
|
|
57
|
-
"INSERT INTO users (name, email) VALUES (
|
|
57
|
+
"INSERT INTO users (name, email) VALUES (?, ?)",
|
|
58
58
|
["John Doe", "john@example.com"],
|
|
59
59
|
);
|
|
60
60
|
|
|
61
61
|
// UPDATE
|
|
62
62
|
const updateResult = await ctx.integrations.mariadb.execute(
|
|
63
|
-
"UPDATE users SET last_login = NOW() WHERE id =
|
|
63
|
+
"UPDATE users SET last_login = NOW() WHERE id = ?",
|
|
64
64
|
[userId],
|
|
65
65
|
);
|
|
66
66
|
console.log(`Updated ${updateResult.rowCount} rows`);
|
|
@@ -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 MariaDBPlugin } from "@superblocksteam/types/dist/src/plugins/mariadb/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 { MariaDBClient } from "./types.js";
|
|
17
19
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { z } from "zod";
|
|
8
|
+
|
|
8
9
|
import type { BaseIntegrationClient } from "../../types.js";
|
|
9
10
|
import type { TraceMetadata } from "../registry.js";
|
|
10
11
|
|
|
@@ -24,7 +25,7 @@ import type { TraceMetadata } from "../registry.js";
|
|
|
24
25
|
* });
|
|
25
26
|
*
|
|
26
27
|
* const users = await mariadb.query(
|
|
27
|
-
* 'SELECT * FROM users WHERE status =
|
|
28
|
+
* 'SELECT * FROM users WHERE status = ?',
|
|
28
29
|
* UserSchema,
|
|
29
30
|
* ['active']
|
|
30
31
|
* );
|
|
@@ -34,7 +35,7 @@ export interface MariaDBClient extends BaseIntegrationClient {
|
|
|
34
35
|
/**
|
|
35
36
|
* Execute a SQL query and validate results against a Zod schema.
|
|
36
37
|
*
|
|
37
|
-
* @param sql - SQL query string (use
|
|
38
|
+
* @param sql - SQL query string (use ? placeholders for parameters)
|
|
38
39
|
* @param schema - Zod schema to validate the query results
|
|
39
40
|
* @param params - Optional query parameters
|
|
40
41
|
* @returns Promise resolving to validated query results
|
|
@@ -10,7 +10,9 @@ Interact with Mistral AI's APIs for chat completions, embeddings, and code gener
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### Step 1: List Available Models
|
|
14
|
+
|
|
15
|
+
Model availability varies by account and API plan. Before making requests, validate which models you can access:
|
|
14
16
|
|
|
15
17
|
```typescript
|
|
16
18
|
import { api, z, mistral } from "@superblocksteam/sdk-api";
|
|
@@ -18,6 +20,30 @@ import { api, z, mistral } from "@superblocksteam/sdk-api";
|
|
|
18
20
|
// Integration ID from the integrations panel
|
|
19
21
|
const PROD_MISTRAL = "a1b2c3d4-5678-90ab-cdef-mistral00001";
|
|
20
22
|
|
|
23
|
+
const ModelsResponseSchema = z.object({
|
|
24
|
+
data: z.array(
|
|
25
|
+
z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
object: z.string(),
|
|
28
|
+
}),
|
|
29
|
+
),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const models = await ctx.integrations.mistral.apiRequest(
|
|
33
|
+
{
|
|
34
|
+
method: "GET",
|
|
35
|
+
path: "/models",
|
|
36
|
+
},
|
|
37
|
+
{ response: ModelsResponseSchema },
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// Use a model ID from the response in subsequent requests
|
|
41
|
+
const availableModelId = models.data[0]?.id;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Chat Completion
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
21
47
|
const ChatCompletionResponseSchema = z.object({
|
|
22
48
|
id: z.string(),
|
|
23
49
|
object: z.string(),
|
|
@@ -55,7 +81,7 @@ export default api({
|
|
|
55
81
|
const result = await ctx.integrations.mistral.apiRequest(
|
|
56
82
|
{
|
|
57
83
|
method: "POST",
|
|
58
|
-
path: "/
|
|
84
|
+
path: "/chat/completions",
|
|
59
85
|
body: {
|
|
60
86
|
model: "mistral-large-latest",
|
|
61
87
|
messages: [{ role: "user", content: prompt }],
|
|
@@ -76,7 +102,7 @@ export default api({
|
|
|
76
102
|
const large = await ctx.integrations.mistral.apiRequest(
|
|
77
103
|
{
|
|
78
104
|
method: "POST",
|
|
79
|
-
path: "/
|
|
105
|
+
path: "/chat/completions",
|
|
80
106
|
body: {
|
|
81
107
|
model: "mistral-large-latest",
|
|
82
108
|
messages: [{ role: "user", content: "Complex analysis..." }],
|
|
@@ -89,7 +115,7 @@ const large = await ctx.integrations.mistral.apiRequest(
|
|
|
89
115
|
const medium = await ctx.integrations.mistral.apiRequest(
|
|
90
116
|
{
|
|
91
117
|
method: "POST",
|
|
92
|
-
path: "/
|
|
118
|
+
path: "/chat/completions",
|
|
93
119
|
body: {
|
|
94
120
|
model: "mistral-medium-latest",
|
|
95
121
|
messages: [{ role: "user", content: "General task..." }],
|
|
@@ -102,7 +128,7 @@ const medium = await ctx.integrations.mistral.apiRequest(
|
|
|
102
128
|
const small = await ctx.integrations.mistral.apiRequest(
|
|
103
129
|
{
|
|
104
130
|
method: "POST",
|
|
105
|
-
path: "/
|
|
131
|
+
path: "/chat/completions",
|
|
106
132
|
body: {
|
|
107
133
|
model: "mistral-small-latest",
|
|
108
134
|
messages: [{ role: "user", content: "Simple task..." }],
|
|
@@ -115,7 +141,7 @@ const small = await ctx.integrations.mistral.apiRequest(
|
|
|
115
141
|
const codestral = await ctx.integrations.mistral.apiRequest(
|
|
116
142
|
{
|
|
117
143
|
method: "POST",
|
|
118
|
-
path: "/
|
|
144
|
+
path: "/chat/completions",
|
|
119
145
|
body: {
|
|
120
146
|
model: "codestral-latest",
|
|
121
147
|
messages: [{ role: "user", content: "Write a function to..." }],
|
|
@@ -148,7 +174,7 @@ const EmbeddingsResponseSchema = z.object({
|
|
|
148
174
|
const result = await ctx.integrations.mistral.apiRequest(
|
|
149
175
|
{
|
|
150
176
|
method: "POST",
|
|
151
|
-
path: "/
|
|
177
|
+
path: "/embeddings",
|
|
152
178
|
body: {
|
|
153
179
|
model: "mistral-embed",
|
|
154
180
|
input: ["Hello world", "Bonjour le monde"],
|
|
@@ -193,7 +219,7 @@ const FunctionCallResponseSchema = z.object({
|
|
|
193
219
|
const result = await ctx.integrations.mistral.apiRequest(
|
|
194
220
|
{
|
|
195
221
|
method: "POST",
|
|
196
|
-
path: "/
|
|
222
|
+
path: "/chat/completions",
|
|
197
223
|
body: {
|
|
198
224
|
model: "mistral-large-latest",
|
|
199
225
|
messages: [{ role: "user", content: "What's the weather in London?" }],
|
|
@@ -227,7 +253,7 @@ const result = await ctx.integrations.mistral.apiRequest(
|
|
|
227
253
|
const result = await ctx.integrations.mistral.apiRequest(
|
|
228
254
|
{
|
|
229
255
|
method: "POST",
|
|
230
|
-
path: "/
|
|
256
|
+
path: "/chat/completions",
|
|
231
257
|
body: {
|
|
232
258
|
model: "mistral-large-latest",
|
|
233
259
|
messages: [
|
|
@@ -260,7 +286,7 @@ await mistral.embed({ ... });
|
|
|
260
286
|
|
|
261
287
|
// CORRECT - Use apiRequest
|
|
262
288
|
await ctx.integrations.mistral.apiRequest(
|
|
263
|
-
{ method: "POST", path: "/
|
|
289
|
+
{ method: "POST", path: "/chat/completions", body: { ... } },
|
|
264
290
|
{ response: ChatCompletionResponseSchema }
|
|
265
291
|
);
|
|
266
292
|
```
|
|
@@ -288,7 +314,7 @@ Mistral has a safe mode for content moderation:
|
|
|
288
314
|
const result = await ctx.integrations.mistral.apiRequest(
|
|
289
315
|
{
|
|
290
316
|
method: "POST",
|
|
291
|
-
path: "/
|
|
317
|
+
path: "/chat/completions",
|
|
292
318
|
body: {
|
|
293
319
|
model: "mistral-large-latest",
|
|
294
320
|
messages: [{ role: "user", content: "..." }],
|
|
@@ -307,7 +333,7 @@ Mistral supports system messages:
|
|
|
307
333
|
const result = await ctx.integrations.mistral.apiRequest(
|
|
308
334
|
{
|
|
309
335
|
method: "POST",
|
|
310
|
-
path: "/
|
|
336
|
+
path: "/chat/completions",
|
|
311
337
|
body: {
|
|
312
338
|
model: "mistral-large-latest",
|
|
313
339
|
messages: [
|
|
@@ -327,7 +353,7 @@ import { RestApiValidationError } from "@superblocksteam/sdk-api";
|
|
|
327
353
|
|
|
328
354
|
try {
|
|
329
355
|
const result = await ctx.integrations.mistral.apiRequest(
|
|
330
|
-
{ method: "POST", path: "/
|
|
356
|
+
{ method: "POST", path: "/chat/completions", body: { ... } },
|
|
331
357
|
{ response: ChatCompletionResponseSchema }
|
|
332
358
|
);
|
|
333
359
|
} catch (error) {
|