@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
|
@@ -3,8 +3,38 @@
|
|
|
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
|
+
|
|
12
|
+
/**
|
|
13
|
+
* How the orchestrator should decode the HTTP response body.
|
|
14
|
+
*
|
|
15
|
+
* - `"json"` (default): parse the response as JSON; fails on non-JSON bodies
|
|
16
|
+
* - `"text"`: return the decoded response body as a string (XML, CSV, HTML, ...)
|
|
17
|
+
*
|
|
18
|
+
* The orchestrator also implements `"auto"`, `"binary"`, and `"raw"` wire
|
|
19
|
+
* values; they are deliberately not exposed here (widening this union later
|
|
20
|
+
* is backward-compatible, narrowing it is not):
|
|
21
|
+
*
|
|
22
|
+
* - `"auto"` returns parsed JSON whenever the body happens to parse, which
|
|
23
|
+
* would let JSON responses bypass schema validation via the schema-less
|
|
24
|
+
* overload
|
|
25
|
+
* - `"binary"` would freeze the worker's internal Buffer JSON encoding
|
|
26
|
+
* (`{ type: "Buffer", data: number[] }`, ~4x payload inflation) into the
|
|
27
|
+
* public SDK contract
|
|
28
|
+
* - `"raw"` is rejected by the orchestrator for non-streaming requests
|
|
29
|
+
*
|
|
30
|
+
* The runtime tuple backs the request-time guard in `executeApiRequest`:
|
|
31
|
+
* the type-level union is erased in the bundled JS user APIs run as, so
|
|
32
|
+
* values outside it must also be rejected at runtime.
|
|
33
|
+
*/
|
|
34
|
+
export const REST_API_RESPONSE_TYPES = ["json", "text"] as const;
|
|
35
|
+
|
|
36
|
+
export type RestApiResponseType = (typeof REST_API_RESPONSE_TYPES)[number];
|
|
37
|
+
|
|
8
38
|
/**
|
|
9
39
|
* Options for making a generic REST API request.
|
|
10
40
|
*/
|
|
@@ -34,6 +64,15 @@ export interface ApiRequestOptions<TBody = unknown> {
|
|
|
34
64
|
* Optional HTTP headers
|
|
35
65
|
*/
|
|
36
66
|
headers?: Record<string, string>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* How the response body should be decoded. Defaults to `"json"`.
|
|
70
|
+
*
|
|
71
|
+
* Use `"text"` for endpoints that return non-JSON payloads such as
|
|
72
|
+
* XML. When requesting a text response, omit the response schema (or
|
|
73
|
+
* use one matching the decoded string, e.g. `z.string()`).
|
|
74
|
+
*/
|
|
75
|
+
responseType?: RestApiResponseType;
|
|
37
76
|
}
|
|
38
77
|
|
|
39
78
|
/**
|
|
@@ -42,7 +81,7 @@ export interface ApiRequestOptions<TBody = unknown> {
|
|
|
42
81
|
export interface ApiRequestSchema<TBody = unknown, TResponse = unknown> {
|
|
43
82
|
/**
|
|
44
83
|
* Optional Zod schema for request body validation.
|
|
45
|
-
*
|
|
84
|
+
* When omitted, `options.body` is sent without validation.
|
|
46
85
|
*/
|
|
47
86
|
body?: z.ZodSchema<TBody>;
|
|
48
87
|
|
|
@@ -56,14 +95,18 @@ export interface ApiRequestSchema<TBody = unknown, TResponse = unknown> {
|
|
|
56
95
|
/**
|
|
57
96
|
* Interface for integration clients that support generic API requests.
|
|
58
97
|
*
|
|
59
|
-
*
|
|
98
|
+
* Providing a response schema gives type-safe, validated results. Omitting
|
|
99
|
+
* it returns the raw response as `unknown`. For non-JSON payloads (e.g.
|
|
100
|
+
* `responseType: "text"` for XML), either omit the schema or supply one
|
|
101
|
+
* matching the decoded value (e.g. `z.string()` for text) — object schemas
|
|
102
|
+
* only make sense for JSON-shaped results.
|
|
60
103
|
*/
|
|
61
104
|
export interface SupportsApiRequest {
|
|
62
105
|
/**
|
|
63
106
|
* Execute a generic API request with type-safe validation.
|
|
64
107
|
*
|
|
65
108
|
* @param options - Request configuration including method, path, params, and body
|
|
66
|
-
* @param schema - Zod schemas for request body and response validation
|
|
109
|
+
* @param schema - Zod schemas for request body and response validation
|
|
67
110
|
* @param metadata - Optional trace metadata for observability (label, description)
|
|
68
111
|
* @returns Validated response data
|
|
69
112
|
*
|
|
@@ -99,78 +142,39 @@ export interface SupportsApiRequest {
|
|
|
99
142
|
},
|
|
100
143
|
metadata?: TraceMetadata,
|
|
101
144
|
): Promise<TResponse>;
|
|
102
|
-
}
|
|
103
145
|
|
|
104
|
-
/**
|
|
105
|
-
* Schema configuration for streaming API request validation.
|
|
106
|
-
*/
|
|
107
|
-
export interface StreamApiRequestSchema<TBody = unknown, TChunk = unknown> {
|
|
108
146
|
/**
|
|
109
|
-
*
|
|
110
|
-
* Required if body is provided in options.
|
|
111
|
-
*/
|
|
112
|
-
body?: z.ZodSchema<TBody>;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Zod schema for validating each streamed chunk.
|
|
147
|
+
* Execute a generic API request without response validation.
|
|
116
148
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
|
|
120
|
-
|
|
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.
|
|
149
|
+
* This overload requires an explicit non-JSON `responseType` — JSON
|
|
150
|
+
* responses must always be consumed through the schema overload above,
|
|
151
|
+
* so "unvalidated JSON" is unrepresentable. The decoded non-JSON
|
|
152
|
+
* response is returned as-is, typed `unknown`.
|
|
132
153
|
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
154
|
+
* Note: request-body validation is opt-in — it runs only when
|
|
155
|
+
* `schema.body` is provided. Omitting `schema` sends `options.body`
|
|
156
|
+
* without validation.
|
|
135
157
|
*
|
|
136
|
-
* @param options - Request configuration
|
|
137
|
-
* @param schema - Zod
|
|
158
|
+
* @param options - Request configuration; `responseType` must be "text"
|
|
159
|
+
* @param schema - Optional Zod schema for request body validation
|
|
138
160
|
* @param metadata - Optional trace metadata for observability (label, description)
|
|
139
|
-
* @returns
|
|
161
|
+
* @returns The raw response from the integration
|
|
140
162
|
*
|
|
141
163
|
* @example
|
|
142
164
|
* ```typescript
|
|
143
|
-
* const
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* content: z.string().optional(),
|
|
148
|
-
* }),
|
|
149
|
-
* })),
|
|
165
|
+
* const xml = await ctx.integrations.legacyApi.apiRequest({
|
|
166
|
+
* method: 'GET',
|
|
167
|
+
* path: '/report.xml',
|
|
168
|
+
* responseType: 'text',
|
|
150
169
|
* });
|
|
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
|
-
* }
|
|
170
|
+
* // xml is the raw XML string
|
|
169
171
|
* ```
|
|
170
172
|
*/
|
|
171
|
-
|
|
172
|
-
options: ApiRequestOptions<TBody
|
|
173
|
-
|
|
173
|
+
apiRequest<TBody>(
|
|
174
|
+
options: ApiRequestOptions<TBody> & {
|
|
175
|
+
responseType: Exclude<RestApiResponseType, "json">;
|
|
176
|
+
},
|
|
177
|
+
schema?: ApiRequestSchema<TBody, unknown>,
|
|
174
178
|
metadata?: TraceMetadata,
|
|
175
|
-
):
|
|
179
|
+
): Promise<unknown>;
|
|
176
180
|
}
|
|
@@ -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) {
|
|
@@ -75,7 +75,7 @@ export default api({
|
|
|
75
75
|
const result = await ctx.integrations.box.apiRequest(
|
|
76
76
|
{
|
|
77
77
|
method: "GET",
|
|
78
|
-
path: `/
|
|
78
|
+
path: `/folders/${folderId}/items`,
|
|
79
79
|
params: {
|
|
80
80
|
limit: limit,
|
|
81
81
|
offset: 0,
|
|
@@ -133,7 +133,7 @@ const FileInfoSchema = z.object({
|
|
|
133
133
|
const file = await ctx.integrations.box.apiRequest(
|
|
134
134
|
{
|
|
135
135
|
method: "GET",
|
|
136
|
-
path: `/
|
|
136
|
+
path: `/files/${fileId}`,
|
|
137
137
|
params: {
|
|
138
138
|
fields:
|
|
139
139
|
"id,name,size,created_at,modified_at,created_by,modified_by,parent,sha1,shared_link",
|
|
@@ -154,7 +154,7 @@ const DownloadUrlResponseSchema = z.string();
|
|
|
154
154
|
const content = await ctx.integrations.box.apiRequest(
|
|
155
155
|
{
|
|
156
156
|
method: "GET",
|
|
157
|
-
path: `/
|
|
157
|
+
path: `/files/${fileId}/content`,
|
|
158
158
|
},
|
|
159
159
|
{ response: DownloadUrlResponseSchema },
|
|
160
160
|
);
|
|
@@ -172,7 +172,7 @@ const UploadResponseSchema = z.object({
|
|
|
172
172
|
const result = await ctx.integrations.box.apiRequest(
|
|
173
173
|
{
|
|
174
174
|
method: "POST",
|
|
175
|
-
path: "/
|
|
175
|
+
path: "/files/content",
|
|
176
176
|
headers: {
|
|
177
177
|
"Content-Type": "multipart/form-data",
|
|
178
178
|
},
|
|
@@ -209,7 +209,7 @@ const FolderInfoSchema = z.object({
|
|
|
209
209
|
const folder = await ctx.integrations.box.apiRequest(
|
|
210
210
|
{
|
|
211
211
|
method: "POST",
|
|
212
|
-
path: "/
|
|
212
|
+
path: "/folders",
|
|
213
213
|
body: {
|
|
214
214
|
name: "New Folder",
|
|
215
215
|
parent: {
|
|
@@ -229,7 +229,7 @@ console.log(`Created folder: ${folder.name} (${folder.id})`);
|
|
|
229
229
|
const copiedFile = await ctx.integrations.box.apiRequest(
|
|
230
230
|
{
|
|
231
231
|
method: "POST",
|
|
232
|
-
path: `/
|
|
232
|
+
path: `/files/${fileId}/copy`,
|
|
233
233
|
body: {
|
|
234
234
|
parent: {
|
|
235
235
|
id: destinationFolderId,
|
|
@@ -247,7 +247,7 @@ const copiedFile = await ctx.integrations.box.apiRequest(
|
|
|
247
247
|
const movedFile = await ctx.integrations.box.apiRequest(
|
|
248
248
|
{
|
|
249
249
|
method: "PUT",
|
|
250
|
-
path: `/
|
|
250
|
+
path: `/files/${fileId}`,
|
|
251
251
|
body: {
|
|
252
252
|
parent: {
|
|
253
253
|
id: newParentFolderId,
|
|
@@ -264,7 +264,7 @@ const movedFile = await ctx.integrations.box.apiRequest(
|
|
|
264
264
|
const updatedFile = await ctx.integrations.box.apiRequest(
|
|
265
265
|
{
|
|
266
266
|
method: "PUT",
|
|
267
|
-
path: `/
|
|
267
|
+
path: `/files/${fileId}`,
|
|
268
268
|
body: {
|
|
269
269
|
name: "renamed-file.txt",
|
|
270
270
|
description: "Updated file description",
|
|
@@ -281,7 +281,7 @@ const updatedFile = await ctx.integrations.box.apiRequest(
|
|
|
281
281
|
await ctx.integrations.box.apiRequest(
|
|
282
282
|
{
|
|
283
283
|
method: "DELETE",
|
|
284
|
-
path: `/
|
|
284
|
+
path: `/files/${fileId}`,
|
|
285
285
|
},
|
|
286
286
|
{ response: z.void() },
|
|
287
287
|
);
|
|
@@ -304,7 +304,7 @@ const SharedLinkSchema = z.object({
|
|
|
304
304
|
const file = await ctx.integrations.box.apiRequest(
|
|
305
305
|
{
|
|
306
306
|
method: "PUT",
|
|
307
|
-
path: `/
|
|
307
|
+
path: `/files/${fileId}`,
|
|
308
308
|
params: {
|
|
309
309
|
fields: "shared_link",
|
|
310
310
|
},
|
|
@@ -337,7 +337,7 @@ const SearchResponseSchema = z.object({
|
|
|
337
337
|
const result = await ctx.integrations.box.apiRequest(
|
|
338
338
|
{
|
|
339
339
|
method: "GET",
|
|
340
|
-
path: "/
|
|
340
|
+
path: "/search",
|
|
341
341
|
params: {
|
|
342
342
|
query: "quarterly report",
|
|
343
343
|
type: "file",
|
|
@@ -372,7 +372,7 @@ const CommentSchema = z.object({
|
|
|
372
372
|
const comment = await ctx.integrations.box.apiRequest(
|
|
373
373
|
{
|
|
374
374
|
method: "POST",
|
|
375
|
-
path: "/
|
|
375
|
+
path: "/comments",
|
|
376
376
|
body: {
|
|
377
377
|
item: {
|
|
378
378
|
type: "file",
|
|
@@ -400,22 +400,22 @@ await box.uploadFile({ ... });
|
|
|
400
400
|
|
|
401
401
|
// CORRECT - Use apiRequest
|
|
402
402
|
await ctx.integrations.box.apiRequest(
|
|
403
|
-
{ method: "GET", path: `/
|
|
403
|
+
{ method: "GET", path: `/folders/${folderId}/items`, params: { ... } },
|
|
404
404
|
{ response: ListItemsResponseSchema }
|
|
405
405
|
);
|
|
406
406
|
```
|
|
407
407
|
|
|
408
408
|
### API Version in Path
|
|
409
409
|
|
|
410
|
-
|
|
410
|
+
The base URL already includes `/2.0`, so do not repeat it in paths:
|
|
411
411
|
|
|
412
412
|
```typescript
|
|
413
|
-
// CORRECT -
|
|
414
|
-
const path = "/2.0/files/123";
|
|
415
|
-
const path = "/2.0/folders/0/items";
|
|
416
|
-
|
|
417
|
-
// WRONG - Missing version
|
|
413
|
+
// CORRECT - No version prefix (base URL already has /2.0)
|
|
418
414
|
const path = "/files/123";
|
|
415
|
+
const path = "/folders/0/items";
|
|
416
|
+
|
|
417
|
+
// WRONG - Duplicates version from base URL
|
|
418
|
+
const path = "/2.0/files/123";
|
|
419
419
|
```
|
|
420
420
|
|
|
421
421
|
### Root Folder ID is "0"
|
|
@@ -437,7 +437,7 @@ Use `fields` to get specific data:
|
|
|
437
437
|
```typescript
|
|
438
438
|
// Without fields, you get minimal data
|
|
439
439
|
const result = await ctx.integrations.box.apiRequest(
|
|
440
|
-
{ method: "GET", path: `/
|
|
440
|
+
{ method: "GET", path: `/files/${fileId}` },
|
|
441
441
|
{ response: FileSchema },
|
|
442
442
|
);
|
|
443
443
|
|
|
@@ -445,7 +445,7 @@ const result = await ctx.integrations.box.apiRequest(
|
|
|
445
445
|
const result = await ctx.integrations.box.apiRequest(
|
|
446
446
|
{
|
|
447
447
|
method: "GET",
|
|
448
|
-
path: `/
|
|
448
|
+
path: `/files/${fileId}`,
|
|
449
449
|
params: {
|
|
450
450
|
fields: "id,name,size,created_at,modified_at,parent,shared_link",
|
|
451
451
|
},
|
|
@@ -477,7 +477,7 @@ Use `If-Match` with etag for safe updates:
|
|
|
477
477
|
const result = await ctx.integrations.box.apiRequest(
|
|
478
478
|
{
|
|
479
479
|
method: "PUT",
|
|
480
|
-
path: `/
|
|
480
|
+
path: `/files/${fileId}`,
|
|
481
481
|
headers: {
|
|
482
482
|
"If-Match": file.etag, // Prevents overwriting concurrent changes
|
|
483
483
|
},
|
|
@@ -503,7 +503,7 @@ async function getAllItems(box: BoxClient, folderId: string) {
|
|
|
503
503
|
const result = await ctx.integrations.box.apiRequest(
|
|
504
504
|
{
|
|
505
505
|
method: "GET",
|
|
506
|
-
path: `/
|
|
506
|
+
path: `/folders/${folderId}/items`,
|
|
507
507
|
params: { limit, offset, fields: "id,name,type" },
|
|
508
508
|
},
|
|
509
509
|
{ response: ListItemsResponseSchema },
|
|
@@ -557,7 +557,7 @@ import { RestApiValidationError } from "@superblocksteam/sdk-api";
|
|
|
557
557
|
|
|
558
558
|
try {
|
|
559
559
|
const result = await ctx.integrations.box.apiRequest(
|
|
560
|
-
{ method: "GET", path: `/
|
|
560
|
+
{ method: "GET", path: `/folders/${folderId}/items`, params: { ... } },
|
|
561
561
|
{ response: ListItemsResponseSchema }
|
|
562
562
|
);
|
|
563
563
|
} catch (error) {
|