@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,75 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Generic REST API Integration client with Zod response validation.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Extends RestApiClientBase with an apiRequest() that validates the
|
|
5
|
+
* full response against a caller-supplied Zod schema and throws
|
|
6
|
+
* RestApiValidationError on mismatch.
|
|
5
7
|
*/
|
|
6
8
|
|
|
7
|
-
import type {
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import type {
|
|
11
|
-
import
|
|
12
|
-
QueryExecutor,
|
|
13
|
-
StreamingQueryExecutor,
|
|
14
|
-
TraceMetadata,
|
|
15
|
-
} from "../registry.js";
|
|
9
|
+
import type { z } from "zod";
|
|
10
|
+
|
|
11
|
+
import { RestApiValidationError } from "../../errors.js";
|
|
12
|
+
import type { TraceMetadata } from "../registry.js";
|
|
13
|
+
import { RestApiClientBase } from "./rest-api-client-base.js";
|
|
16
14
|
import type {
|
|
17
15
|
ApiRequestOptions,
|
|
18
16
|
ApiRequestSchema,
|
|
19
17
|
SupportsApiRequest,
|
|
20
|
-
StreamApiRequestSchema,
|
|
21
|
-
SupportsStreamingApiRequest,
|
|
22
18
|
} from "./types.js";
|
|
23
|
-
import {
|
|
24
|
-
RestApiValidationError,
|
|
25
|
-
StreamChunkValidationError,
|
|
26
|
-
} from "../../errors.js";
|
|
27
|
-
import type { z } from "zod";
|
|
28
|
-
|
|
29
|
-
export type RestApiRequest = PartialMessage<RestApiIntegrationPlugin>;
|
|
30
19
|
|
|
31
20
|
/**
|
|
32
21
|
* Base implementation for REST API Integration clients.
|
|
33
22
|
*
|
|
34
|
-
* All OpenAPI-based integration clients
|
|
35
|
-
*
|
|
36
|
-
*
|
|
23
|
+
* All OpenAPI-based integration clients (except those with
|
|
24
|
+
* integration-specific response handling) extend this class to
|
|
25
|
+
* inherit the generic apiRequest() method with runtime Zod validation.
|
|
37
26
|
*/
|
|
38
27
|
export abstract class RestApiIntegrationClient
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
SupportsApiRequest,
|
|
42
|
-
SupportsStreamingApiRequest
|
|
28
|
+
extends RestApiClientBase
|
|
29
|
+
implements SupportsApiRequest
|
|
43
30
|
{
|
|
44
|
-
readonly name: string;
|
|
45
|
-
readonly pluginId: string;
|
|
46
|
-
readonly config: IntegrationConfig;
|
|
47
|
-
|
|
48
|
-
protected readonly executeQuery: QueryExecutor;
|
|
49
|
-
protected readonly executeStreamingQuery?: StreamingQueryExecutor;
|
|
50
|
-
|
|
51
|
-
constructor(
|
|
52
|
-
config: IntegrationConfig,
|
|
53
|
-
executeQuery: QueryExecutor,
|
|
54
|
-
executeStreamingQuery?: StreamingQueryExecutor,
|
|
55
|
-
) {
|
|
56
|
-
this.name = config.name;
|
|
57
|
-
this.pluginId = config.pluginId;
|
|
58
|
-
this.config = config;
|
|
59
|
-
this.executeQuery = executeQuery;
|
|
60
|
-
this.executeStreamingQuery = executeStreamingQuery;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Helper to create a Property object for params.
|
|
65
|
-
*/
|
|
66
|
-
protected createParam(key: string, value: unknown): PartialMessage<Property> {
|
|
67
|
-
return {
|
|
68
|
-
key,
|
|
69
|
-
value: typeof value === "string" ? value : JSON.stringify(value),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
31
|
async apiRequest<TBody, TResponse>(
|
|
74
32
|
options: ApiRequestOptions<TBody>,
|
|
75
33
|
schema: ApiRequestSchema<TBody, TResponse> & {
|
|
@@ -77,59 +35,7 @@ export abstract class RestApiIntegrationClient
|
|
|
77
35
|
},
|
|
78
36
|
metadata?: TraceMetadata,
|
|
79
37
|
): Promise<TResponse> {
|
|
80
|
-
|
|
81
|
-
// Body schema is optional — if not provided, the body is sent unvalidated.
|
|
82
|
-
if (options.body !== undefined && schema?.body) {
|
|
83
|
-
const bodyParseResult = schema.body.safeParse(options.body);
|
|
84
|
-
if (!bodyParseResult.success) {
|
|
85
|
-
throw new RestApiValidationError(
|
|
86
|
-
`Request body validation failed: ${bodyParseResult.error.message}`,
|
|
87
|
-
{
|
|
88
|
-
zodError: bodyParseResult.error,
|
|
89
|
-
data: options.body,
|
|
90
|
-
},
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Convert headers to Property array
|
|
96
|
-
const headers: PartialMessage<Property>[] = [];
|
|
97
|
-
if (options.headers) {
|
|
98
|
-
for (const [key, value] of Object.entries(options.headers)) {
|
|
99
|
-
headers.push(this.createParam(key, value));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Convert query params to Property array
|
|
104
|
-
const params: PartialMessage<Property>[] = [];
|
|
105
|
-
if (options.params) {
|
|
106
|
-
for (const [key, value] of Object.entries(options.params)) {
|
|
107
|
-
params.push(this.createParam(key, value));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Build the request using raw HTTP mode
|
|
112
|
-
const request: RestApiRequest = {
|
|
113
|
-
openApiAction: "genericHttpRequest",
|
|
114
|
-
httpMethod: options.method.toUpperCase(),
|
|
115
|
-
urlPath: options.path,
|
|
116
|
-
headers,
|
|
117
|
-
params,
|
|
118
|
-
responseType: "json",
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
// Add body if provided
|
|
122
|
-
if (options.body !== undefined) {
|
|
123
|
-
request.body = JSON.stringify(options.body);
|
|
124
|
-
request.bodyType = "jsonBody";
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// Execute the request
|
|
128
|
-
const result = await this.executeQuery(
|
|
129
|
-
request as Record<string, unknown>,
|
|
130
|
-
undefined,
|
|
131
|
-
metadata,
|
|
132
|
-
);
|
|
38
|
+
const result = await this.executeApiRequest(options, schema.body, metadata);
|
|
133
39
|
|
|
134
40
|
// Response schema is REQUIRED - always validate
|
|
135
41
|
const responseParseResult = schema.response.safeParse(result);
|
|
@@ -146,134 +52,4 @@ export abstract class RestApiIntegrationClient
|
|
|
146
52
|
|
|
147
53
|
return responseParseResult.data;
|
|
148
54
|
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Execute a streaming API request with type-safe chunk validation.
|
|
152
|
-
*
|
|
153
|
-
* Returns an AsyncIterable that yields validated chunks as they arrive.
|
|
154
|
-
* Each chunk is validated against the provided schema before being yielded.
|
|
155
|
-
*
|
|
156
|
-
* @param options - Request configuration including method, path, params, and body
|
|
157
|
-
* @param schema - Zod schemas for request body and chunk validation
|
|
158
|
-
* @param metadata - Optional trace metadata for observability (label, description)
|
|
159
|
-
* @returns AsyncIterable yielding validated chunks
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```typescript
|
|
163
|
-
* const ChunkSchema = z.object({
|
|
164
|
-
* id: z.string(),
|
|
165
|
-
* choices: z.array(z.object({
|
|
166
|
-
* delta: z.object({
|
|
167
|
-
* content: z.string().optional(),
|
|
168
|
-
* }),
|
|
169
|
-
* })),
|
|
170
|
-
* });
|
|
171
|
-
*
|
|
172
|
-
* const stream = client.streamApiRequest(
|
|
173
|
-
* {
|
|
174
|
-
* method: 'POST',
|
|
175
|
-
* path: '/v1/chat/completions',
|
|
176
|
-
* body: {
|
|
177
|
-
* model: 'gpt-4',
|
|
178
|
-
* stream: true,
|
|
179
|
-
* messages: [{ role: 'user', content: 'Hello!' }],
|
|
180
|
-
* },
|
|
181
|
-
* },
|
|
182
|
-
* { chunk: ChunkSchema },
|
|
183
|
-
* { label: 'openai.chatCompletions', description: 'Stream chat completion' }
|
|
184
|
-
* );
|
|
185
|
-
*
|
|
186
|
-
* for await (const chunk of stream) {
|
|
187
|
-
* console.log(chunk.choices[0]?.delta?.content);
|
|
188
|
-
* }
|
|
189
|
-
* ```
|
|
190
|
-
*/
|
|
191
|
-
async *streamApiRequest<TBody, TChunk>(
|
|
192
|
-
options: ApiRequestOptions<TBody>,
|
|
193
|
-
schema: StreamApiRequestSchema<TBody, TChunk>,
|
|
194
|
-
metadata?: TraceMetadata,
|
|
195
|
-
): AsyncIterable<TChunk> {
|
|
196
|
-
// Validate that streaming is supported
|
|
197
|
-
if (!this.executeStreamingQuery) {
|
|
198
|
-
throw new Error(
|
|
199
|
-
`Streaming is not supported for integration "${this.name}". ` +
|
|
200
|
-
"The orchestrator must provide a streaming query executor.",
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Validate request body against schema if both are present.
|
|
205
|
-
// Body schema is optional — if not provided, the body is sent unvalidated.
|
|
206
|
-
if (options.body !== undefined && schema?.body) {
|
|
207
|
-
const bodyParseResult = schema.body.safeParse(options.body);
|
|
208
|
-
if (!bodyParseResult.success) {
|
|
209
|
-
throw new RestApiValidationError(
|
|
210
|
-
`Request body validation failed: ${bodyParseResult.error.message}`,
|
|
211
|
-
{
|
|
212
|
-
zodError: bodyParseResult.error,
|
|
213
|
-
data: options.body,
|
|
214
|
-
},
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Convert headers to Property array
|
|
220
|
-
const headers: PartialMessage<Property>[] = [];
|
|
221
|
-
if (options.headers) {
|
|
222
|
-
for (const [key, value] of Object.entries(options.headers)) {
|
|
223
|
-
headers.push(this.createParam(key, value));
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// Convert query params to Property array
|
|
228
|
-
const params: PartialMessage<Property>[] = [];
|
|
229
|
-
if (options.params) {
|
|
230
|
-
for (const [key, value] of Object.entries(options.params)) {
|
|
231
|
-
params.push(this.createParam(key, value));
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Build the request using raw HTTP mode with streaming response
|
|
236
|
-
// Note: responseType must be "raw" for streaming - the orchestrator's
|
|
237
|
-
// Stream block expects SSE responses and only works with "raw" type.
|
|
238
|
-
const request: RestApiRequest = {
|
|
239
|
-
openApiAction: "genericHttpRequest",
|
|
240
|
-
httpMethod: options.method.toUpperCase(),
|
|
241
|
-
urlPath: options.path,
|
|
242
|
-
headers,
|
|
243
|
-
params,
|
|
244
|
-
responseType: "raw",
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
// Add body if provided
|
|
248
|
-
if (options.body !== undefined) {
|
|
249
|
-
request.body = JSON.stringify(options.body);
|
|
250
|
-
request.bodyType = "jsonBody";
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Execute the streaming request
|
|
254
|
-
const stream = this.executeStreamingQuery(
|
|
255
|
-
request as Record<string, unknown>,
|
|
256
|
-
metadata,
|
|
257
|
-
);
|
|
258
|
-
|
|
259
|
-
// Validate and yield each chunk
|
|
260
|
-
let chunkIndex = 0;
|
|
261
|
-
for await (const rawChunk of stream) {
|
|
262
|
-
const parseResult = schema.chunk.safeParse(rawChunk);
|
|
263
|
-
|
|
264
|
-
if (!parseResult.success) {
|
|
265
|
-
throw new StreamChunkValidationError(
|
|
266
|
-
`Chunk validation failed at index ${chunkIndex}: ${parseResult.error.message}`,
|
|
267
|
-
{
|
|
268
|
-
chunkIndex,
|
|
269
|
-
chunk: rawChunk,
|
|
270
|
-
zodError: parseResult.error,
|
|
271
|
-
},
|
|
272
|
-
);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
yield parseResult.data;
|
|
276
|
-
chunkIndex++;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
55
|
}
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { z } from "zod";
|
|
6
|
+
|
|
6
7
|
import type { TraceMetadata } from "../registry.js";
|
|
7
8
|
|
|
9
|
+
// Re-export for backwards compatibility
|
|
10
|
+
export type { TraceMetadata };
|
|
11
|
+
|
|
8
12
|
/**
|
|
9
13
|
* Options for making a generic REST API request.
|
|
10
14
|
*/
|
|
@@ -100,77 +104,3 @@ export interface SupportsApiRequest {
|
|
|
100
104
|
metadata?: TraceMetadata,
|
|
101
105
|
): Promise<TResponse>;
|
|
102
106
|
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Schema configuration for streaming API request validation.
|
|
106
|
-
*/
|
|
107
|
-
export interface StreamApiRequestSchema<TBody = unknown, TChunk = unknown> {
|
|
108
|
-
/**
|
|
109
|
-
* Optional Zod schema for request body validation.
|
|
110
|
-
* Required if body is provided in options.
|
|
111
|
-
*/
|
|
112
|
-
body?: z.ZodSchema<TBody>;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Zod schema for validating each streamed chunk.
|
|
116
|
-
*
|
|
117
|
-
* Every chunk received from the stream is validated against this schema.
|
|
118
|
-
* Validation errors will terminate the stream.
|
|
119
|
-
*/
|
|
120
|
-
chunk: z.ZodSchema<TChunk>;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Interface for integration clients that support streaming API requests.
|
|
125
|
-
*
|
|
126
|
-
* Streaming API requests return an AsyncIterable of validated chunks,
|
|
127
|
-
* enabling real-time data streaming from LLMs and other sources.
|
|
128
|
-
*/
|
|
129
|
-
export interface SupportsStreamingApiRequest {
|
|
130
|
-
/**
|
|
131
|
-
* Execute a streaming API request with type-safe chunk validation.
|
|
132
|
-
*
|
|
133
|
-
* Returns an AsyncIterable that yields validated chunks as they arrive.
|
|
134
|
-
* Each chunk is validated against the provided schema before being yielded.
|
|
135
|
-
*
|
|
136
|
-
* @param options - Request configuration including method, path, params, and body
|
|
137
|
-
* @param schema - Zod schemas for request body and chunk validation (chunk schema REQUIRED)
|
|
138
|
-
* @param metadata - Optional trace metadata for observability (label, description)
|
|
139
|
-
* @returns AsyncIterable yielding validated chunks
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* ```typescript
|
|
143
|
-
* const ChunkSchema = z.object({
|
|
144
|
-
* id: z.string(),
|
|
145
|
-
* choices: z.array(z.object({
|
|
146
|
-
* delta: z.object({
|
|
147
|
-
* content: z.string().optional(),
|
|
148
|
-
* }),
|
|
149
|
-
* })),
|
|
150
|
-
* });
|
|
151
|
-
*
|
|
152
|
-
* const stream = client.streamApiRequest(
|
|
153
|
-
* {
|
|
154
|
-
* method: 'POST',
|
|
155
|
-
* path: '/v1/chat/completions',
|
|
156
|
-
* body: {
|
|
157
|
-
* model: 'gpt-4',
|
|
158
|
-
* stream: true,
|
|
159
|
-
* messages: [{ role: 'user', content: 'Hello!' }],
|
|
160
|
-
* },
|
|
161
|
-
* },
|
|
162
|
-
* { chunk: ChunkSchema },
|
|
163
|
-
* { label: 'openai.chatCompletions', description: 'Stream chat completion' }
|
|
164
|
-
* );
|
|
165
|
-
*
|
|
166
|
-
* for await (const chunk of stream) {
|
|
167
|
-
* console.log(chunk.choices[0]?.delta?.content);
|
|
168
|
-
* }
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
streamApiRequest<TBody, TChunk>(
|
|
172
|
-
options: ApiRequestOptions<TBody>,
|
|
173
|
-
schema: StreamApiRequestSchema<TBody, TChunk>,
|
|
174
|
-
metadata?: TraceMetadata,
|
|
175
|
-
): AsyncIterable<TChunk>;
|
|
176
|
-
}
|
|
@@ -40,7 +40,7 @@ export default api({
|
|
|
40
40
|
const events = await ctx.integrations.bigquery.query(
|
|
41
41
|
`SELECT event_id, event_name, user_id, timestamp
|
|
42
42
|
FROM \`project.dataset.events\`
|
|
43
|
-
WHERE event_name =
|
|
43
|
+
WHERE event_name = ?
|
|
44
44
|
LIMIT 100`,
|
|
45
45
|
EventSchema,
|
|
46
46
|
[event_name],
|
|
@@ -51,12 +51,16 @@ export default api({
|
|
|
51
51
|
});
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
The SDK currently binds BigQuery parameters from the positional `params` array.
|
|
55
|
+
Even though native BigQuery also supports named parameters like `@event_name`,
|
|
56
|
+
use `?` placeholders in SDK queries and pass values in array order.
|
|
57
|
+
|
|
54
58
|
### Executing INSERT, UPDATE, DELETE Statements
|
|
55
59
|
|
|
56
60
|
```typescript
|
|
57
61
|
// INSERT
|
|
58
62
|
await ctx.integrations.bigquery.execute(
|
|
59
|
-
"INSERT INTO `project.dataset.metrics` (name, value, timestamp) VALUES (
|
|
63
|
+
"INSERT INTO `project.dataset.metrics` (name, value, timestamp) VALUES (?, ?, CURRENT_TIMESTAMP())",
|
|
60
64
|
["cpu_usage", "75.5"],
|
|
61
65
|
);
|
|
62
66
|
```
|
|
@@ -116,6 +120,27 @@ All methods accept an optional `metadata` parameter as the last argument for dia
|
|
|
116
120
|
|
|
117
121
|
## Common Pitfalls
|
|
118
122
|
|
|
123
|
+
### SDK Parameters Are Positional
|
|
124
|
+
|
|
125
|
+
The SDK accepts an array of parameter values and binds them server-side in
|
|
126
|
+
order. When you need parameters, use `?` placeholders in the SQL text:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// WRONG - Native BigQuery named parameter syntax is not the SDK contract
|
|
130
|
+
await ctx.integrations.bigquery.query(
|
|
131
|
+
"SELECT * FROM `project.dataset.events` WHERE event_name = @event_name",
|
|
132
|
+
EventSchema,
|
|
133
|
+
["signup"],
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
// CORRECT - Use positional params with ? placeholders
|
|
137
|
+
await ctx.integrations.bigquery.query(
|
|
138
|
+
"SELECT * FROM `project.dataset.events` WHERE event_name = ?",
|
|
139
|
+
EventSchema,
|
|
140
|
+
["signup"],
|
|
141
|
+
);
|
|
142
|
+
```
|
|
143
|
+
|
|
119
144
|
### Backtick Table References
|
|
120
145
|
|
|
121
146
|
BigQuery uses backticks for fully-qualified table names:
|
|
@@ -165,7 +190,7 @@ BigQuery charges by data scanned. Use partitions and column selection:
|
|
|
165
190
|
const query = `
|
|
166
191
|
SELECT event_id, event_name
|
|
167
192
|
FROM \`project.dataset.events\`
|
|
168
|
-
WHERE _PARTITIONDATE =
|
|
193
|
+
WHERE _PARTITIONDATE = ?
|
|
169
194
|
`;
|
|
170
195
|
```
|
|
171
196
|
|
|
@@ -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 BigQueryPlugin } from "@superblocksteam/types/dist/src/plugins/bigquery/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 { BigQueryClient } 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 events = await bigquery.query(
|
|
27
|
-
* 'SELECT * FROM events WHERE date =
|
|
28
|
+
* 'SELECT * FROM events WHERE date = ?',
|
|
28
29
|
* EventSchema,
|
|
29
30
|
* ['2024-01-01']
|
|
30
31
|
* );
|
|
@@ -34,9 +35,9 @@ export interface BigQueryClient 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
|
-
* @param params - Optional query parameters
|
|
40
|
+
* @param params - Optional query parameters, bound positionally from the provided array
|
|
40
41
|
* @returns Promise resolving to validated query results
|
|
41
42
|
*
|
|
42
43
|
* @throws {QueryValidationError} If results don't match schema
|
|
@@ -54,7 +54,7 @@ export default api({
|
|
|
54
54
|
const result = await ctx.integrations.bitbucket.apiRequest(
|
|
55
55
|
{
|
|
56
56
|
method: "GET",
|
|
57
|
-
path: `/
|
|
57
|
+
path: `/repositories/${workspace}`,
|
|
58
58
|
params: {
|
|
59
59
|
pagelen: 50,
|
|
60
60
|
},
|
|
@@ -78,7 +78,7 @@ export default api({
|
|
|
78
78
|
const repo = await ctx.integrations.bitbucket.apiRequest(
|
|
79
79
|
{
|
|
80
80
|
method: "GET",
|
|
81
|
-
path: `/
|
|
81
|
+
path: `/repositories/${workspace}/${repoSlug}`,
|
|
82
82
|
},
|
|
83
83
|
{ response: RepositorySchema },
|
|
84
84
|
);
|
|
@@ -111,7 +111,7 @@ const PullRequestSchema = z.object({
|
|
|
111
111
|
const pr = await ctx.integrations.bitbucket.apiRequest(
|
|
112
112
|
{
|
|
113
113
|
method: "POST",
|
|
114
|
-
path: `/
|
|
114
|
+
path: `/repositories/${workspace}/${repoSlug}/pullrequests`,
|
|
115
115
|
body: {
|
|
116
116
|
title: "Add new feature",
|
|
117
117
|
description: "This PR adds...",
|
|
@@ -143,7 +143,7 @@ const ListPRsResponseSchema = z.object({
|
|
|
143
143
|
const result = await ctx.integrations.bitbucket.apiRequest(
|
|
144
144
|
{
|
|
145
145
|
method: "GET",
|
|
146
|
-
path: `/
|
|
146
|
+
path: `/repositories/${workspace}/${repoSlug}/pullrequests`,
|
|
147
147
|
params: {
|
|
148
148
|
state: "OPEN", // OPEN, MERGED, DECLINED, SUPERSEDED
|
|
149
149
|
pagelen: 25,
|
|
@@ -172,7 +172,7 @@ const MergeResponseSchema = z.object({
|
|
|
172
172
|
const result = await ctx.integrations.bitbucket.apiRequest(
|
|
173
173
|
{
|
|
174
174
|
method: "POST",
|
|
175
|
-
path: `/
|
|
175
|
+
path: `/repositories/${workspace}/${repoSlug}/pullrequests/${prId}/merge`,
|
|
176
176
|
body: {
|
|
177
177
|
type: "pullrequest",
|
|
178
178
|
message: "Merge pull request #123",
|
|
@@ -209,7 +209,7 @@ const ListCommitsResponseSchema = z.object({
|
|
|
209
209
|
const result = await ctx.integrations.bitbucket.apiRequest(
|
|
210
210
|
{
|
|
211
211
|
method: "GET",
|
|
212
|
-
path: `/
|
|
212
|
+
path: `/repositories/${workspace}/${repoSlug}/commits`,
|
|
213
213
|
params: {
|
|
214
214
|
branch: "main",
|
|
215
215
|
pagelen: 10,
|
|
@@ -232,7 +232,7 @@ const BranchSchema = z.object({
|
|
|
232
232
|
const branch = await ctx.integrations.bitbucket.apiRequest(
|
|
233
233
|
{
|
|
234
234
|
method: "POST",
|
|
235
|
-
path: `/
|
|
235
|
+
path: `/repositories/${workspace}/${repoSlug}/refs/branches`,
|
|
236
236
|
body: {
|
|
237
237
|
name: "feature/new-feature",
|
|
238
238
|
target: {
|
|
@@ -251,7 +251,7 @@ const branch = await ctx.integrations.bitbucket.apiRequest(
|
|
|
251
251
|
const content = await ctx.integrations.bitbucket.apiRequest(
|
|
252
252
|
{
|
|
253
253
|
method: "GET",
|
|
254
|
-
path: `/
|
|
254
|
+
path: `/repositories/${workspace}/${repoSlug}/src/main/README.md`,
|
|
255
255
|
},
|
|
256
256
|
{ response: z.string() },
|
|
257
257
|
);
|
|
@@ -274,7 +274,7 @@ const CommentSchema = z.object({
|
|
|
274
274
|
const comment = await ctx.integrations.bitbucket.apiRequest(
|
|
275
275
|
{
|
|
276
276
|
method: "POST",
|
|
277
|
-
path: `/
|
|
277
|
+
path: `/repositories/${workspace}/${repoSlug}/pullrequests/${prId}/comments`,
|
|
278
278
|
body: {
|
|
279
279
|
content: {
|
|
280
280
|
raw: "LGTM! :+1:",
|
|
@@ -300,20 +300,20 @@ await bitbucket.listRepos();
|
|
|
300
300
|
|
|
301
301
|
// CORRECT - Use apiRequest
|
|
302
302
|
await ctx.integrations.bitbucket.apiRequest(
|
|
303
|
-
{ method: "POST", path: `/
|
|
303
|
+
{ method: "POST", path: `/repositories/${workspace}/${repo}/pullrequests`, body: { ... } },
|
|
304
304
|
{ response: PullRequestSchema }
|
|
305
305
|
);
|
|
306
306
|
```
|
|
307
307
|
|
|
308
308
|
### API Version in Path
|
|
309
309
|
|
|
310
|
-
|
|
310
|
+
The base URL already includes `/2.0`, so do not repeat it in paths:
|
|
311
311
|
|
|
312
312
|
```typescript
|
|
313
|
-
//
|
|
313
|
+
// CORRECT - No version prefix (base URL already has /2.0)
|
|
314
314
|
const path = `/repositories/${workspace}/${repo}`;
|
|
315
315
|
|
|
316
|
-
//
|
|
316
|
+
// WRONG - Duplicates version from base URL
|
|
317
317
|
const path = `/2.0/repositories/${workspace}/${repo}`;
|
|
318
318
|
```
|
|
319
319
|
|
|
@@ -323,10 +323,10 @@ Use workspace slug for API calls:
|
|
|
323
323
|
|
|
324
324
|
```typescript
|
|
325
325
|
// Workspace slug (preferred)
|
|
326
|
-
const path = `/
|
|
326
|
+
const path = `/repositories/myworkspace/myrepo`;
|
|
327
327
|
|
|
328
328
|
// Can also be username for personal repos
|
|
329
|
-
const path = `/
|
|
329
|
+
const path = `/repositories/myusername/myrepo`;
|
|
330
330
|
```
|
|
331
331
|
|
|
332
332
|
### Pagination
|
|
@@ -340,7 +340,7 @@ async function getAllPRs(
|
|
|
340
340
|
repo: string,
|
|
341
341
|
) {
|
|
342
342
|
const allPRs: PullRequest[] = [];
|
|
343
|
-
let url = `/
|
|
343
|
+
let url = `/repositories/${workspace}/${repo}/pullrequests`;
|
|
344
344
|
|
|
345
345
|
while (url) {
|
|
346
346
|
const result = await ctx.integrations.bitbucket.apiRequest(
|
|
@@ -385,7 +385,7 @@ Branch names with slashes need encoding:
|
|
|
385
385
|
```typescript
|
|
386
386
|
// Branch name: feature/my-feature
|
|
387
387
|
const branchName = encodeURIComponent("feature/my-feature");
|
|
388
|
-
const path = `/
|
|
388
|
+
const path = `/repositories/${workspace}/${repo}/src/${branchName}/file.txt`;
|
|
389
389
|
```
|
|
390
390
|
|
|
391
391
|
### Raw File Content
|
|
@@ -397,7 +397,7 @@ File content endpoints return raw text, not JSON:
|
|
|
397
397
|
const content = await ctx.integrations.bitbucket.apiRequest(
|
|
398
398
|
{
|
|
399
399
|
method: "GET",
|
|
400
|
-
path: `/
|
|
400
|
+
path: `/repositories/${workspace}/${repo}/src/main/file.txt`,
|
|
401
401
|
},
|
|
402
402
|
{ response: z.string() }, // Not a JSON schema
|
|
403
403
|
);
|
|
@@ -410,7 +410,7 @@ import { RestApiValidationError } from "@superblocksteam/sdk-api";
|
|
|
410
410
|
|
|
411
411
|
try {
|
|
412
412
|
const result = await ctx.integrations.bitbucket.apiRequest(
|
|
413
|
-
{ method: "GET", path: `/
|
|
413
|
+
{ method: "GET", path: `/repositories/${workspace}/${repo}` },
|
|
414
414
|
{ response: RepositorySchema },
|
|
415
415
|
);
|
|
416
416
|
} catch (error) {
|