@superblocksteam/sdk-api 0.0.6 → 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 -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
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Couchbase client types.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { z } from "zod";
|
|
6
|
-
import type { BaseIntegrationClient } from "../../types.js";
|
|
7
|
-
import type { TraceMetadata } from "../registry.js";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Parameters for identifying a Couchbase document location.
|
|
11
|
-
*
|
|
12
|
-
* All Couchbase operations require a bucket name. Key-value operations
|
|
13
|
-
* (insert, get, remove) additionally require a scope and collection.
|
|
14
|
-
*/
|
|
15
|
-
export interface CouchbaseIdentifier {
|
|
16
|
-
/** The bucket name (required for all operations) */
|
|
17
|
-
bucket: string;
|
|
18
|
-
/** The scope name */
|
|
19
|
-
scope: string;
|
|
20
|
-
/** The collection name */
|
|
21
|
-
collection: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Couchbase client for document and query operations.
|
|
26
|
-
*
|
|
27
|
-
* Provides methods for SQL++ queries, document insertion, retrieval,
|
|
28
|
-
* and removal in Couchbase buckets.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* // Declare in api(): integrations: { cb: couchbase(INTEGRATION_ID) }
|
|
33
|
-
* // In run(), access via ctx.integrations.cb
|
|
34
|
-
*
|
|
35
|
-
* // Run a SQL++ query
|
|
36
|
-
* const users = await ctx.integrations.cb.query(
|
|
37
|
-
* 'my-bucket',
|
|
38
|
-
* 'SELECT * FROM bucket WHERE status = "active"',
|
|
39
|
-
* UserSchema,
|
|
40
|
-
* );
|
|
41
|
-
*
|
|
42
|
-
* // Insert a document
|
|
43
|
-
* await ctx.integrations.cb.insert('user::123', { name: 'Alice' }, {
|
|
44
|
-
* bucket: 'my-bucket',
|
|
45
|
-
* scope: '_default',
|
|
46
|
-
* collection: '_default',
|
|
47
|
-
* });
|
|
48
|
-
*
|
|
49
|
-
* // Get a document
|
|
50
|
-
* const doc = await ctx.integrations.cb.get('user::123', DocSchema, {
|
|
51
|
-
* bucket: 'my-bucket',
|
|
52
|
-
* scope: '_default',
|
|
53
|
-
* collection: '_default',
|
|
54
|
-
* });
|
|
55
|
-
*
|
|
56
|
-
* // Remove a document
|
|
57
|
-
* await ctx.integrations.cb.remove('user::123', {
|
|
58
|
-
* bucket: 'my-bucket',
|
|
59
|
-
* scope: '_default',
|
|
60
|
-
* collection: '_default',
|
|
61
|
-
* });
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export interface CouchbaseClient extends BaseIntegrationClient {
|
|
65
|
-
/**
|
|
66
|
-
* Execute a SQL++ query against Couchbase.
|
|
67
|
-
*
|
|
68
|
-
* @param bucket - The bucket name to query against
|
|
69
|
-
* @param sql - The SQL++ query string (with optional $1, $2 placeholders when parameterized)
|
|
70
|
-
* @param schema - Zod schema for validating result rows
|
|
71
|
-
* @param params - Optional array of parameter values for server-side binding
|
|
72
|
-
* @returns Array of validated result rows
|
|
73
|
-
*/
|
|
74
|
-
query<T>(
|
|
75
|
-
bucket: string,
|
|
76
|
-
sql: string,
|
|
77
|
-
schema: z.ZodSchema<T>,
|
|
78
|
-
params?: unknown[],
|
|
79
|
-
metadata?: TraceMetadata,
|
|
80
|
-
): Promise<T[]>;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Insert a document into a collection.
|
|
84
|
-
*
|
|
85
|
-
* @param key - The document key
|
|
86
|
-
* @param value - The document value (will be JSON-serialized)
|
|
87
|
-
* @param identifier - The bucket, scope, and collection to insert into
|
|
88
|
-
* @param metadata - Optional trace metadata for diagnostics
|
|
89
|
-
*/
|
|
90
|
-
insert(
|
|
91
|
-
key: string,
|
|
92
|
-
value: unknown,
|
|
93
|
-
identifier: CouchbaseIdentifier,
|
|
94
|
-
metadata?: TraceMetadata,
|
|
95
|
-
): Promise<void>;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Get a document by key from a collection.
|
|
99
|
-
*
|
|
100
|
-
* @param key - The document key
|
|
101
|
-
* @param schema - Zod schema for validating the result
|
|
102
|
-
* @param identifier - The bucket, scope, and collection to get from
|
|
103
|
-
* @param metadata - Optional trace metadata for diagnostics
|
|
104
|
-
* @returns The validated document
|
|
105
|
-
*/
|
|
106
|
-
get<T>(
|
|
107
|
-
key: string,
|
|
108
|
-
schema: z.ZodSchema<T>,
|
|
109
|
-
identifier: CouchbaseIdentifier,
|
|
110
|
-
metadata?: TraceMetadata,
|
|
111
|
-
): Promise<T>;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Remove a document by key from a collection.
|
|
115
|
-
*
|
|
116
|
-
* @param key - The document key
|
|
117
|
-
* @param identifier - The bucket, scope, and collection to remove from
|
|
118
|
-
* @param metadata - Optional trace metadata for diagnostics
|
|
119
|
-
*/
|
|
120
|
-
remove(
|
|
121
|
-
key: string,
|
|
122
|
-
identifier: CouchbaseIdentifier,
|
|
123
|
-
metadata?: TraceMetadata,
|
|
124
|
-
): Promise<void>;
|
|
125
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
# Kafka Client
|
|
2
|
-
|
|
3
|
-
Interact with Apache Kafka with full type safety and runtime validation.
|
|
4
|
-
|
|
5
|
-
## Methods
|
|
6
|
-
|
|
7
|
-
| Method | Description |
|
|
8
|
-
| ------------------------------------ | ----------------------------------- |
|
|
9
|
-
| `consume(schema, params, metadata?)` | Consume messages from a Kafka topic |
|
|
10
|
-
| `produce(schema, params, metadata?)` | Produce messages to Kafka topics |
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
|
|
14
|
-
### Consume Messages
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
import { api, z, kafka } from "@superblocksteam/sdk-api";
|
|
18
|
-
|
|
19
|
-
// Integration ID from the integrations panel
|
|
20
|
-
const PROD_KAFKA = "a1b2c3d4-5678-90ab-cdef-kafka0000001";
|
|
21
|
-
|
|
22
|
-
const MessageSchema = z.array(
|
|
23
|
-
z.object({
|
|
24
|
-
topic: z.string(),
|
|
25
|
-
partition: z.number(),
|
|
26
|
-
offset: z.number(),
|
|
27
|
-
value: z.unknown(),
|
|
28
|
-
}),
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
export default api({
|
|
32
|
-
integrations: {
|
|
33
|
-
kafka: kafka(PROD_KAFKA),
|
|
34
|
-
},
|
|
35
|
-
name: "KafkaExample",
|
|
36
|
-
input: z.object({
|
|
37
|
-
topic: z.string(),
|
|
38
|
-
}),
|
|
39
|
-
output: z.object({
|
|
40
|
-
messages: MessageSchema,
|
|
41
|
-
}),
|
|
42
|
-
async run(ctx, { topic }) {
|
|
43
|
-
const messages = await kafka.consume(MessageSchema, {
|
|
44
|
-
topic: topic,
|
|
45
|
-
from: "LATEST",
|
|
46
|
-
groupId: "my-consumer-group",
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
return { messages };
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Consume from Beginning
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
const messages = await kafka.consume(MessageSchema, {
|
|
58
|
-
topic: "my-topic",
|
|
59
|
-
from: "BEGINNING",
|
|
60
|
-
groupId: "my-consumer-group",
|
|
61
|
-
});
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Produce Messages
|
|
65
|
-
|
|
66
|
-
```typescript
|
|
67
|
-
const ProduceResultSchema = z.any();
|
|
68
|
-
|
|
69
|
-
const result = await ctx.integrations.kafka.produce(ProduceResultSchema, {
|
|
70
|
-
messages: JSON.stringify([
|
|
71
|
-
{ topic: "my-topic", value: { event: "purchase", amount: 99.99 } },
|
|
72
|
-
{ topic: "my-topic", value: { event: "signup", userId: "123" } },
|
|
73
|
-
]),
|
|
74
|
-
});
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Produce with Options
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
const result = await ctx.integrations.kafka.produce(ProduceResultSchema, {
|
|
81
|
-
messages: JSON.stringify([
|
|
82
|
-
{ topic: "my-topic", key: "user-123", value: { data: "payload" } },
|
|
83
|
-
]),
|
|
84
|
-
acks: "ALL",
|
|
85
|
-
compression: "GZIP",
|
|
86
|
-
autoCreateTopic: true,
|
|
87
|
-
transaction: true,
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## Consume Parameters
|
|
92
|
-
|
|
93
|
-
| Parameter | Type | Description |
|
|
94
|
-
| ----------------- | ----------------------------------- | ------------------------------------ |
|
|
95
|
-
| `topic` | `string` | Topic to consume from |
|
|
96
|
-
| `from` | `'BEGINNING' \| 'LATEST' \| 'SEEK'` | Where to start consuming from |
|
|
97
|
-
| `groupId` | `string` | Consumer group ID |
|
|
98
|
-
| `clientId` | `string` | Client ID |
|
|
99
|
-
| `readUncommitted` | `boolean` | Whether to read uncommitted messages |
|
|
100
|
-
| `seek` | `object` | Seek position for SEEK mode |
|
|
101
|
-
|
|
102
|
-
## Produce Parameters
|
|
103
|
-
|
|
104
|
-
| Parameter | Type | Description |
|
|
105
|
-
| ----------------- | --------------------------------------- | ----------------------------- |
|
|
106
|
-
| `messages` | `string` | JSON string array of messages |
|
|
107
|
-
| `acks` | `'NONE' \| 'LEADER' \| 'ALL'` | Acknowledgment level |
|
|
108
|
-
| `compression` | `'GZIP' \| 'SNAPPY' \| 'LZ4' \| 'ZSTD'` | Compression type |
|
|
109
|
-
| `autoCreateTopic` | `boolean` | Auto-create topic if missing |
|
|
110
|
-
| `transaction` | `boolean` | Use transactions |
|
|
111
|
-
| `idempotent` | `boolean` | Enable idempotent delivery |
|
|
112
|
-
| `clientId` | `string` | Client ID |
|
|
113
|
-
| `timeout` | `number` | Timeout in milliseconds |
|
|
114
|
-
|
|
115
|
-
## Trace Metadata
|
|
116
|
-
|
|
117
|
-
All methods accept an optional `metadata` parameter as the last argument for diagnostics labeling. See the [root SDK README](../../../README.md#trace-metadata) for details.
|
|
118
|
-
|
|
119
|
-
## Error Handling
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
import {
|
|
123
|
-
RestApiValidationError,
|
|
124
|
-
IntegrationError,
|
|
125
|
-
} from "@superblocksteam/sdk-api";
|
|
126
|
-
|
|
127
|
-
try {
|
|
128
|
-
const messages = await kafka.consume(MessageSchema, {
|
|
129
|
-
topic: "my-topic",
|
|
130
|
-
from: "LATEST",
|
|
131
|
-
});
|
|
132
|
-
} catch (error) {
|
|
133
|
-
if (error instanceof RestApiValidationError) {
|
|
134
|
-
console.error("Validation failed:", error.details.zodError);
|
|
135
|
-
} else if (error instanceof IntegrationError) {
|
|
136
|
-
console.error("Kafka error:", error.message);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## API Reference
|
|
142
|
-
|
|
143
|
-
- [Apache Kafka Documentation](https://kafka.apache.org/documentation/)
|
|
144
|
-
- [Confluent Documentation](https://docs.confluent.io/)
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kafka client implementation.
|
|
3
|
-
*
|
|
4
|
-
* Constructs request objects matching the expected backend format.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { z } from "zod";
|
|
8
|
-
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
9
|
-
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
10
|
-
import { RestApiValidationError } from "../../errors.js";
|
|
11
|
-
import { IntegrationError } from "../../runtime/errors.js";
|
|
12
|
-
import type {
|
|
13
|
-
KafkaClient,
|
|
14
|
-
KafkaConsumeParams,
|
|
15
|
-
KafkaProduceParams,
|
|
16
|
-
} from "./types.js";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Consume request structure.
|
|
20
|
-
*/
|
|
21
|
-
interface KafkaConsumeRequest {
|
|
22
|
-
operation: "OPERATION_CONSUME";
|
|
23
|
-
consume: {
|
|
24
|
-
topic: string;
|
|
25
|
-
from: string;
|
|
26
|
-
groupId?: string;
|
|
27
|
-
clientId?: string;
|
|
28
|
-
readUncommitted?: boolean;
|
|
29
|
-
seek?: {
|
|
30
|
-
topic?: string;
|
|
31
|
-
offset?: string;
|
|
32
|
-
partition?: number;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Produce request structure.
|
|
39
|
-
*/
|
|
40
|
-
interface KafkaProduceRequest {
|
|
41
|
-
operation: "OPERATION_PRODUCE";
|
|
42
|
-
produce: {
|
|
43
|
-
messages: string;
|
|
44
|
-
acks?: string;
|
|
45
|
-
clientId?: string;
|
|
46
|
-
timeout?: number;
|
|
47
|
-
compression?: string;
|
|
48
|
-
transactionId?: string;
|
|
49
|
-
autoCreateTopic?: boolean;
|
|
50
|
-
idempotent?: boolean;
|
|
51
|
-
transaction?: boolean;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Kafka plugin request - discriminated union on operation.
|
|
57
|
-
*/
|
|
58
|
-
type KafkaRequest = KafkaConsumeRequest | KafkaProduceRequest;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Operation string values expected by the Kafka plugin.
|
|
62
|
-
*/
|
|
63
|
-
const OPERATION = {
|
|
64
|
-
CONSUME: "OPERATION_CONSUME",
|
|
65
|
-
PRODUCE: "OPERATION_PRODUCE",
|
|
66
|
-
} as const;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Consume from string values.
|
|
70
|
-
*/
|
|
71
|
-
const CONSUME_FROM = {
|
|
72
|
-
BEGINNING: "FROM_BEGINNING",
|
|
73
|
-
LATEST: "FROM_LATEST",
|
|
74
|
-
SEEK: "FROM_SEEK",
|
|
75
|
-
} as const;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Acks string values.
|
|
79
|
-
*/
|
|
80
|
-
const ACKS = {
|
|
81
|
-
NONE: "ACKS_NONE",
|
|
82
|
-
LEADER: "ACKS_LEADER",
|
|
83
|
-
ALL: "ACKS_ALL",
|
|
84
|
-
} as const;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Compression string values.
|
|
88
|
-
*/
|
|
89
|
-
const COMPRESSION = {
|
|
90
|
-
GZIP: "COMPRESSION_GZIP",
|
|
91
|
-
SNAPPY: "COMPRESSION_SNAPPY",
|
|
92
|
-
LZ4: "COMPRESSION_LZ4",
|
|
93
|
-
ZSTD: "COMPRESSION_ZSTD",
|
|
94
|
-
} as const;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Internal implementation of KafkaClient.
|
|
98
|
-
*/
|
|
99
|
-
export class KafkaClientImpl implements KafkaClient, IntegrationClientImpl {
|
|
100
|
-
readonly config: IntegrationConfig;
|
|
101
|
-
private readonly executeQuery: QueryExecutor;
|
|
102
|
-
|
|
103
|
-
constructor(config: IntegrationConfig, executeQuery: QueryExecutor) {
|
|
104
|
-
this.config = config;
|
|
105
|
-
this.executeQuery = executeQuery;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
get name(): string {
|
|
109
|
-
return this.config.name;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
get pluginId(): string {
|
|
113
|
-
return this.config.pluginId;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
private buildConsumeRequest(params: KafkaConsumeParams): KafkaConsumeRequest {
|
|
117
|
-
const request: KafkaConsumeRequest = {
|
|
118
|
-
operation: OPERATION.CONSUME,
|
|
119
|
-
consume: {
|
|
120
|
-
topic: params.topic,
|
|
121
|
-
from: params.from ? CONSUME_FROM[params.from] : CONSUME_FROM.LATEST,
|
|
122
|
-
groupId: params.groupId,
|
|
123
|
-
clientId: params.clientId,
|
|
124
|
-
readUncommitted: params.readUncommitted ?? false,
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
if (params.seek && request.consume) {
|
|
129
|
-
request.consume.seek = {
|
|
130
|
-
topic: params.seek.topic,
|
|
131
|
-
offset: String(params.seek.offset),
|
|
132
|
-
partition: params.seek.partition,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return request;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
private buildProduceRequest(params: KafkaProduceParams): KafkaProduceRequest {
|
|
140
|
-
const request: KafkaProduceRequest = {
|
|
141
|
-
operation: OPERATION.PRODUCE,
|
|
142
|
-
produce: {
|
|
143
|
-
messages: params.messages,
|
|
144
|
-
acks: params.acks ? ACKS[params.acks] : ACKS.ALL,
|
|
145
|
-
clientId: params.clientId,
|
|
146
|
-
timeout: params.timeout,
|
|
147
|
-
compression: params.compression
|
|
148
|
-
? COMPRESSION[params.compression]
|
|
149
|
-
: undefined,
|
|
150
|
-
transactionId: params.transactionId,
|
|
151
|
-
autoCreateTopic: params.autoCreateTopic ?? false,
|
|
152
|
-
idempotent: params.idempotent ?? false,
|
|
153
|
-
transaction: params.transaction ?? false,
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
return request;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
private async executeAndValidate<T>(
|
|
161
|
-
request: KafkaRequest,
|
|
162
|
-
schema: z.ZodSchema<T>,
|
|
163
|
-
operation: string,
|
|
164
|
-
metadata?: TraceMetadata,
|
|
165
|
-
): Promise<T> {
|
|
166
|
-
try {
|
|
167
|
-
const result = await this.executeQuery(
|
|
168
|
-
request as unknown as Record<string, unknown>,
|
|
169
|
-
undefined,
|
|
170
|
-
metadata,
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
const parseResult = schema.safeParse(result);
|
|
174
|
-
|
|
175
|
-
if (!parseResult.success) {
|
|
176
|
-
throw new RestApiValidationError(
|
|
177
|
-
`Result validation failed: ${parseResult.error.message}`,
|
|
178
|
-
{
|
|
179
|
-
zodError: parseResult.error,
|
|
180
|
-
data: result,
|
|
181
|
-
},
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return parseResult.data;
|
|
186
|
-
} catch (error) {
|
|
187
|
-
if (
|
|
188
|
-
error instanceof RestApiValidationError ||
|
|
189
|
-
error instanceof IntegrationError
|
|
190
|
-
) {
|
|
191
|
-
throw error;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
throw new IntegrationError(this.config.name, operation, error);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
async consume<T>(
|
|
199
|
-
schema: z.ZodSchema<T>,
|
|
200
|
-
params: KafkaConsumeParams,
|
|
201
|
-
metadata?: TraceMetadata,
|
|
202
|
-
): Promise<T> {
|
|
203
|
-
const request = this.buildConsumeRequest(params);
|
|
204
|
-
return this.executeAndValidate(request, schema, "consume", metadata);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
async produce<T>(
|
|
208
|
-
schema: z.ZodSchema<T>,
|
|
209
|
-
params: KafkaProduceParams,
|
|
210
|
-
metadata?: TraceMetadata,
|
|
211
|
-
): Promise<T> {
|
|
212
|
-
const request = this.buildProduceRequest(params);
|
|
213
|
-
return this.executeAndValidate(request, schema, "produce", metadata);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kafka client types.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { z } from "zod";
|
|
6
|
-
import type { BaseIntegrationClient } from "../../types.js";
|
|
7
|
-
import type { TraceMetadata } from "../registry.js";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Kafka operation types.
|
|
11
|
-
*/
|
|
12
|
-
export type KafkaOperation = "CONSUME" | "PRODUCE";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Seek position for consuming from a specific offset.
|
|
16
|
-
*/
|
|
17
|
-
export interface KafkaSeek {
|
|
18
|
-
/** Topic name */
|
|
19
|
-
topic: string;
|
|
20
|
-
/** Offset to start from */
|
|
21
|
-
offset: number;
|
|
22
|
-
/** Partition to consume from */
|
|
23
|
-
partition: number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Parameters for Kafka consume operation.
|
|
28
|
-
*/
|
|
29
|
-
export interface KafkaConsumeParams {
|
|
30
|
-
/** Topic to consume from */
|
|
31
|
-
topic: string;
|
|
32
|
-
/** Where to start consuming from */
|
|
33
|
-
from?: "BEGINNING" | "LATEST" | "SEEK";
|
|
34
|
-
/** Consumer group ID */
|
|
35
|
-
groupId?: string;
|
|
36
|
-
/** Client ID */
|
|
37
|
-
clientId?: string;
|
|
38
|
-
/** Seek position for SEEK mode */
|
|
39
|
-
seek?: KafkaSeek;
|
|
40
|
-
/** Whether to read uncommitted messages */
|
|
41
|
-
readUncommitted?: boolean;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Parameters for Kafka produce operation.
|
|
46
|
-
*/
|
|
47
|
-
export interface KafkaProduceParams {
|
|
48
|
-
/** Messages to produce (JSON string) */
|
|
49
|
-
messages: string;
|
|
50
|
-
/** Acknowledgment level */
|
|
51
|
-
acks?: "NONE" | "LEADER" | "ALL";
|
|
52
|
-
/** Client ID */
|
|
53
|
-
clientId?: string;
|
|
54
|
-
/** Timeout in milliseconds */
|
|
55
|
-
timeout?: number;
|
|
56
|
-
/** Compression type */
|
|
57
|
-
compression?: "GZIP" | "SNAPPY" | "LZ4" | "ZSTD";
|
|
58
|
-
/** Transaction ID for transactional produce */
|
|
59
|
-
transactionId?: string;
|
|
60
|
-
/** Whether to auto-create topic */
|
|
61
|
-
autoCreateTopic?: boolean;
|
|
62
|
-
/** Whether to enable idempotent delivery */
|
|
63
|
-
idempotent?: boolean;
|
|
64
|
-
/** Whether to use transactions */
|
|
65
|
-
transaction?: boolean;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Kafka client for message streaming operations.
|
|
70
|
-
*
|
|
71
|
-
* Provides consume() and produce() methods for Kafka operations.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* // Declare in api(): integrations: { kafka: kafka(INTEGRATION_ID) }
|
|
76
|
-
* // In run(), access via ctx.integrations.kafka
|
|
77
|
-
*
|
|
78
|
-
* // Consume messages
|
|
79
|
-
* const MessageSchema = z.array(z.object({
|
|
80
|
-
* topic: z.string(),
|
|
81
|
-
* partition: z.number(),
|
|
82
|
-
* offset: z.number(),
|
|
83
|
-
* value: z.unknown(),
|
|
84
|
-
* }));
|
|
85
|
-
*
|
|
86
|
-
* const messages = await kafka.consume(MessageSchema, {
|
|
87
|
-
* topic: 'my-topic',
|
|
88
|
-
* from: 'LATEST',
|
|
89
|
-
* groupId: 'my-consumer-group',
|
|
90
|
-
* });
|
|
91
|
-
*
|
|
92
|
-
* // Produce messages
|
|
93
|
-
* const result = await kafka.produce(z.any(), {
|
|
94
|
-
* messages: JSON.stringify([
|
|
95
|
-
* { topic: 'my-topic', value: { key: 'value' } }
|
|
96
|
-
* ]),
|
|
97
|
-
* });
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
export interface KafkaClient extends BaseIntegrationClient {
|
|
101
|
-
/**
|
|
102
|
-
* Consume messages from Kafka.
|
|
103
|
-
*
|
|
104
|
-
* @param schema - Zod schema for validating the result
|
|
105
|
-
* @param params - Consume parameters
|
|
106
|
-
* @returns The validated result
|
|
107
|
-
*/
|
|
108
|
-
consume<T>(
|
|
109
|
-
schema: z.ZodSchema<T>,
|
|
110
|
-
params: KafkaConsumeParams,
|
|
111
|
-
metadata?: TraceMetadata,
|
|
112
|
-
): Promise<T>;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Produce messages to Kafka.
|
|
116
|
-
*
|
|
117
|
-
* @param schema - Zod schema for validating the result
|
|
118
|
-
* @param params - Produce parameters
|
|
119
|
-
* @param metadata - Optional trace metadata for diagnostics
|
|
120
|
-
* @returns The validated result
|
|
121
|
-
*/
|
|
122
|
-
produce<T>(
|
|
123
|
-
schema: z.ZodSchema<T>,
|
|
124
|
-
params: KafkaProduceParams,
|
|
125
|
-
metadata?: TraceMetadata,
|
|
126
|
-
): Promise<T>;
|
|
127
|
-
}
|