bem-ai-sdk 0.0.4
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/CHANGELOG.md +28 -0
- package/LICENSE +201 -0
- package/README.md +399 -0
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +260 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +260 -0
- package/client.d.ts.map +1 -0
- package/client.js +538 -0
- package/client.js.map +1 -0
- package/client.mjs +534 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/pagination.d.mts +135 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +135 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +305 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +294 -0
- package/core/pagination.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +7 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +7 -0
- package/index.d.ts.map +1 -0
- package/index.js +32 -0
- package/index.js.map +1 -0
- package/index.mjs +8 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +40 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +37 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +86 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +80 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +8 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +8 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +12 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +9 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +153 -0
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/calls.d.mts +216 -0
- package/resources/calls.d.mts.map +1 -0
- package/resources/calls.d.ts +216 -0
- package/resources/calls.d.ts.map +1 -0
- package/resources/calls.js +64 -0
- package/resources/calls.js.map +1 -0
- package/resources/calls.mjs +60 -0
- package/resources/calls.mjs.map +1 -0
- package/resources/errors.d.mts +150 -0
- package/resources/errors.d.mts.map +1 -0
- package/resources/errors.d.ts +150 -0
- package/resources/errors.d.ts.map +1 -0
- package/resources/errors.js +47 -0
- package/resources/errors.js.map +1 -0
- package/resources/errors.mjs +43 -0
- package/resources/errors.mjs.map +1 -0
- package/resources/functions/copy.d.mts +81 -0
- package/resources/functions/copy.d.mts.map +1 -0
- package/resources/functions/copy.d.ts +81 -0
- package/resources/functions/copy.d.ts.map +1 -0
- package/resources/functions/copy.js +28 -0
- package/resources/functions/copy.js.map +1 -0
- package/resources/functions/copy.mjs +24 -0
- package/resources/functions/copy.mjs.map +1 -0
- package/resources/functions/functions.d.mts +1469 -0
- package/resources/functions/functions.d.mts.map +1 -0
- package/resources/functions/functions.d.ts +1469 -0
- package/resources/functions/functions.d.ts.map +1 -0
- package/resources/functions/functions.js +70 -0
- package/resources/functions/functions.js.map +1 -0
- package/resources/functions/functions.mjs +65 -0
- package/resources/functions/functions.mjs.map +1 -0
- package/resources/functions/index.d.mts +4 -0
- package/resources/functions/index.d.mts.map +1 -0
- package/resources/functions/index.d.ts +4 -0
- package/resources/functions/index.d.ts.map +1 -0
- package/resources/functions/index.js +11 -0
- package/resources/functions/index.js.map +1 -0
- package/resources/functions/index.mjs +5 -0
- package/resources/functions/index.mjs.map +1 -0
- package/resources/functions/versions.d.mts +419 -0
- package/resources/functions/versions.d.mts.map +1 -0
- package/resources/functions/versions.d.ts +419 -0
- package/resources/functions/versions.d.ts.map +1 -0
- package/resources/functions/versions.js +36 -0
- package/resources/functions/versions.js.map +1 -0
- package/resources/functions/versions.mjs +32 -0
- package/resources/functions/versions.mjs.map +1 -0
- package/resources/functions.d.mts +2 -0
- package/resources/functions.d.mts.map +1 -0
- package/resources/functions.d.ts +2 -0
- package/resources/functions.d.ts.map +1 -0
- package/resources/functions.js +6 -0
- package/resources/functions.js.map +1 -0
- package/resources/functions.mjs +3 -0
- package/resources/functions.mjs.map +1 -0
- package/resources/index.d.mts +6 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +6 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +15 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +7 -0
- package/resources/index.mjs.map +1 -0
- package/resources/outputs.d.mts +737 -0
- package/resources/outputs.d.mts.map +1 -0
- package/resources/outputs.d.ts +737 -0
- package/resources/outputs.d.ts.map +1 -0
- package/resources/outputs.js +54 -0
- package/resources/outputs.js.map +1 -0
- package/resources/outputs.mjs +50 -0
- package/resources/outputs.mjs.map +1 -0
- package/resources/workflows/index.d.mts +3 -0
- package/resources/workflows/index.d.mts.map +1 -0
- package/resources/workflows/index.d.ts +3 -0
- package/resources/workflows/index.d.ts.map +1 -0
- package/resources/workflows/index.js +9 -0
- package/resources/workflows/index.js.map +1 -0
- package/resources/workflows/index.mjs +4 -0
- package/resources/workflows/index.mjs.map +1 -0
- package/resources/workflows/versions.d.mts +37 -0
- package/resources/workflows/versions.d.mts.map +1 -0
- package/resources/workflows/versions.d.ts +37 -0
- package/resources/workflows/versions.d.ts.map +1 -0
- package/resources/workflows/versions.js +27 -0
- package/resources/workflows/versions.js.map +1 -0
- package/resources/workflows/versions.mjs +23 -0
- package/resources/workflows/versions.mjs.map +1 -0
- package/resources/workflows/workflows.d.mts +366 -0
- package/resources/workflows/workflows.d.mts.map +1 -0
- package/resources/workflows/workflows.d.ts +366 -0
- package/resources/workflows/workflows.d.ts.map +1 -0
- package/resources/workflows/workflows.js +88 -0
- package/resources/workflows/workflows.js.map +1 -0
- package/resources/workflows/workflows.mjs +83 -0
- package/resources/workflows/workflows.mjs.map +1 -0
- package/resources/workflows.d.mts +2 -0
- package/resources/workflows.d.mts.map +1 -0
- package/resources/workflows.d.ts +2 -0
- package/resources/workflows.d.ts.map +1 -0
- package/resources/workflows.js +6 -0
- package/resources/workflows.js.map +1 -0
- package/resources/workflows.mjs +3 -0
- package/resources/workflows.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +970 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +89 -0
- package/src/core/error.ts +130 -0
- package/src/core/pagination.ts +512 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/index.ts +23 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +56 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +127 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +9 -0
- package/src/lib/.keep +4 -0
- package/src/pagination.ts +2 -0
- package/src/resource.ts +2 -0
- package/src/resources/calls.ts +264 -0
- package/src/resources/errors.ts +199 -0
- package/src/resources/functions/copy.ts +96 -0
- package/src/resources/functions/functions.ts +1892 -0
- package/src/resources/functions/index.ts +30 -0
- package/src/resources/functions/versions.ts +533 -0
- package/src/resources/functions.ts +3 -0
- package/src/resources/index.ts +56 -0
- package/src/resources/outputs.ts +987 -0
- package/src/resources/workflows/index.ts +25 -0
- package/src/resources/workflows/versions.ts +68 -0
- package/src/resources/workflows/workflows.ts +505 -0
- package/src/resources/workflows.ts +3 -0
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
package/src/client.ts
ADDED
|
@@ -0,0 +1,970 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import type { RequestInit, RequestInfo, BodyInit } from './internal/builtin-types';
|
|
4
|
+
import type { HTTPMethod, PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from './internal/types';
|
|
5
|
+
import { uuid4 } from './internal/utils/uuid';
|
|
6
|
+
import { validatePositiveInteger, isAbsoluteURL, safeJSON } from './internal/utils/values';
|
|
7
|
+
import { sleep } from './internal/utils/sleep';
|
|
8
|
+
export type { Logger, LogLevel } from './internal/utils/log';
|
|
9
|
+
import { castToError, isAbortError } from './internal/errors';
|
|
10
|
+
import type { APIResponseProps } from './internal/parse';
|
|
11
|
+
import { getPlatformHeaders } from './internal/detect-platform';
|
|
12
|
+
import * as Shims from './internal/shims';
|
|
13
|
+
import * as Opts from './internal/request-options';
|
|
14
|
+
import { stringifyQuery } from './internal/utils/query';
|
|
15
|
+
import { VERSION } from './version';
|
|
16
|
+
import * as Errors from './core/error';
|
|
17
|
+
import * as Pagination from './core/pagination';
|
|
18
|
+
import {
|
|
19
|
+
AbstractPage,
|
|
20
|
+
type CallsPageParams,
|
|
21
|
+
CallsPageResponse,
|
|
22
|
+
type ErrorsPageParams,
|
|
23
|
+
ErrorsPageResponse,
|
|
24
|
+
type FunctionsPageParams,
|
|
25
|
+
FunctionsPageResponse,
|
|
26
|
+
type OutputsPageParams,
|
|
27
|
+
OutputsPageResponse,
|
|
28
|
+
type WorkflowVersionsPageParams,
|
|
29
|
+
WorkflowVersionsPageResponse,
|
|
30
|
+
type WorkflowsPageParams,
|
|
31
|
+
WorkflowsPageResponse,
|
|
32
|
+
} from './core/pagination';
|
|
33
|
+
import * as Uploads from './core/uploads';
|
|
34
|
+
import * as API from './resources/index';
|
|
35
|
+
import { APIPromise } from './core/api-promise';
|
|
36
|
+
import { Call, CallGetResponse, CallListParams, Calls, CallsCallsPage } from './resources/calls';
|
|
37
|
+
import {
|
|
38
|
+
ErrorEvent,
|
|
39
|
+
ErrorEventsErrorsPage,
|
|
40
|
+
ErrorListParams,
|
|
41
|
+
ErrorRetrieveResponse,
|
|
42
|
+
Errors as ErrorsAPIErrors,
|
|
43
|
+
InboundEmailEvent,
|
|
44
|
+
} from './resources/errors';
|
|
45
|
+
import {
|
|
46
|
+
AnyType,
|
|
47
|
+
Event,
|
|
48
|
+
EventsOutputsPage,
|
|
49
|
+
OutputListParams,
|
|
50
|
+
OutputRetrieveResponse,
|
|
51
|
+
Outputs,
|
|
52
|
+
} from './resources/outputs';
|
|
53
|
+
import {
|
|
54
|
+
CreateFunction,
|
|
55
|
+
EnrichConfig,
|
|
56
|
+
EnrichStep,
|
|
57
|
+
Function,
|
|
58
|
+
FunctionAudit,
|
|
59
|
+
FunctionCreateParams,
|
|
60
|
+
FunctionListParams,
|
|
61
|
+
FunctionResponse,
|
|
62
|
+
FunctionType,
|
|
63
|
+
FunctionUpdateParams,
|
|
64
|
+
Functions,
|
|
65
|
+
FunctionsFunctionsPage,
|
|
66
|
+
ListFunctionsResponse,
|
|
67
|
+
RouteListItem,
|
|
68
|
+
SplitFunctionSemanticPageItemClass,
|
|
69
|
+
UpdateFunction,
|
|
70
|
+
UserActionSummary,
|
|
71
|
+
WorkflowUsageInfo,
|
|
72
|
+
} from './resources/functions/functions';
|
|
73
|
+
import {
|
|
74
|
+
FunctionVersionIdentifier,
|
|
75
|
+
Workflow,
|
|
76
|
+
WorkflowCallParams,
|
|
77
|
+
WorkflowCopyParams,
|
|
78
|
+
WorkflowCopyResponse,
|
|
79
|
+
WorkflowCreateParams,
|
|
80
|
+
WorkflowCreateResponse,
|
|
81
|
+
WorkflowListParams,
|
|
82
|
+
WorkflowRequestRelationship,
|
|
83
|
+
WorkflowRetrieveResponse,
|
|
84
|
+
WorkflowUpdateParams,
|
|
85
|
+
WorkflowUpdateResponse,
|
|
86
|
+
Workflows,
|
|
87
|
+
WorkflowsWorkflowsPage,
|
|
88
|
+
} from './resources/workflows/workflows';
|
|
89
|
+
import { type Fetch } from './internal/builtin-types';
|
|
90
|
+
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
91
|
+
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
92
|
+
import { readEnv } from './internal/utils/env';
|
|
93
|
+
import {
|
|
94
|
+
type LogLevel,
|
|
95
|
+
type Logger,
|
|
96
|
+
formatRequestDetails,
|
|
97
|
+
loggerFor,
|
|
98
|
+
parseLogLevel,
|
|
99
|
+
} from './internal/utils/log';
|
|
100
|
+
import { isEmptyObj } from './internal/utils/values';
|
|
101
|
+
|
|
102
|
+
export interface ClientOptions {
|
|
103
|
+
/**
|
|
104
|
+
* Authenticate using API Key in request header
|
|
105
|
+
*/
|
|
106
|
+
apiKey?: string | undefined;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
110
|
+
*
|
|
111
|
+
* Defaults to process.env['BEM_BASE_URL'].
|
|
112
|
+
*/
|
|
113
|
+
baseURL?: string | null | undefined;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
117
|
+
* from the server before timing out a single request.
|
|
118
|
+
*
|
|
119
|
+
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
120
|
+
* much longer than this timeout before the promise succeeds or fails.
|
|
121
|
+
*
|
|
122
|
+
* @unit milliseconds
|
|
123
|
+
*/
|
|
124
|
+
timeout?: number | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Additional `RequestInit` options to be passed to `fetch` calls.
|
|
127
|
+
* Properties will be overridden by per-request `fetchOptions`.
|
|
128
|
+
*/
|
|
129
|
+
fetchOptions?: MergedRequestInit | undefined;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Specify a custom `fetch` function implementation.
|
|
133
|
+
*
|
|
134
|
+
* If not provided, we expect that `fetch` is defined globally.
|
|
135
|
+
*/
|
|
136
|
+
fetch?: Fetch | undefined;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The maximum number of times that the client will retry a request in case of a
|
|
140
|
+
* temporary failure, like a network error or a 5XX error from the server.
|
|
141
|
+
*
|
|
142
|
+
* @default 2
|
|
143
|
+
*/
|
|
144
|
+
maxRetries?: number | undefined;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Default headers to include with every request to the API.
|
|
148
|
+
*
|
|
149
|
+
* These can be removed in individual requests by explicitly setting the
|
|
150
|
+
* header to `null` in request options.
|
|
151
|
+
*/
|
|
152
|
+
defaultHeaders?: HeadersLike | undefined;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Default query parameters to include with every request to the API.
|
|
156
|
+
*
|
|
157
|
+
* These can be removed in individual requests by explicitly setting the
|
|
158
|
+
* param to `undefined` in request options.
|
|
159
|
+
*/
|
|
160
|
+
defaultQuery?: Record<string, string | undefined> | undefined;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Set the log level.
|
|
164
|
+
*
|
|
165
|
+
* Defaults to process.env['BEM_LOG'] or 'warn' if it isn't set.
|
|
166
|
+
*/
|
|
167
|
+
logLevel?: LogLevel | undefined;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Set the logger.
|
|
171
|
+
*
|
|
172
|
+
* Defaults to globalThis.console.
|
|
173
|
+
*/
|
|
174
|
+
logger?: Logger | undefined;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* API Client for interfacing with the Bem API.
|
|
179
|
+
*/
|
|
180
|
+
export class Bem {
|
|
181
|
+
apiKey: string;
|
|
182
|
+
|
|
183
|
+
baseURL: string;
|
|
184
|
+
maxRetries: number;
|
|
185
|
+
timeout: number;
|
|
186
|
+
logger: Logger;
|
|
187
|
+
logLevel: LogLevel | undefined;
|
|
188
|
+
fetchOptions: MergedRequestInit | undefined;
|
|
189
|
+
|
|
190
|
+
private fetch: Fetch;
|
|
191
|
+
#encoder: Opts.RequestEncoder;
|
|
192
|
+
protected idempotencyHeader?: string;
|
|
193
|
+
private _options: ClientOptions;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* API Client for interfacing with the Bem API.
|
|
197
|
+
*
|
|
198
|
+
* @param {string | undefined} [opts.apiKey=process.env['BEM_API_KEY'] ?? undefined]
|
|
199
|
+
* @param {string} [opts.baseURL=process.env['BEM_BASE_URL'] ?? https://api.bem.ai] - Override the default base URL for the API.
|
|
200
|
+
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
201
|
+
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
202
|
+
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
203
|
+
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
204
|
+
* @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
205
|
+
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
206
|
+
*/
|
|
207
|
+
constructor({
|
|
208
|
+
baseURL = readEnv('BEM_BASE_URL'),
|
|
209
|
+
apiKey = readEnv('BEM_API_KEY'),
|
|
210
|
+
...opts
|
|
211
|
+
}: ClientOptions = {}) {
|
|
212
|
+
if (apiKey === undefined) {
|
|
213
|
+
throw new Errors.BemError(
|
|
214
|
+
"The BEM_API_KEY environment variable is missing or empty; either provide it, or instantiate the Bem client with an apiKey option, like new Bem({ apiKey: 'My API Key' }).",
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const options: ClientOptions = {
|
|
219
|
+
apiKey,
|
|
220
|
+
...opts,
|
|
221
|
+
baseURL: baseURL || `https://api.bem.ai`,
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
this.baseURL = options.baseURL!;
|
|
225
|
+
this.timeout = options.timeout ?? Bem.DEFAULT_TIMEOUT /* 1 minute */;
|
|
226
|
+
this.logger = options.logger ?? console;
|
|
227
|
+
const defaultLogLevel = 'warn';
|
|
228
|
+
// Set default logLevel early so that we can log a warning in parseLogLevel.
|
|
229
|
+
this.logLevel = defaultLogLevel;
|
|
230
|
+
this.logLevel =
|
|
231
|
+
parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
|
|
232
|
+
parseLogLevel(readEnv('BEM_LOG'), "process.env['BEM_LOG']", this) ??
|
|
233
|
+
defaultLogLevel;
|
|
234
|
+
this.fetchOptions = options.fetchOptions;
|
|
235
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
236
|
+
this.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
237
|
+
this.#encoder = Opts.FallbackEncoder;
|
|
238
|
+
|
|
239
|
+
this._options = options;
|
|
240
|
+
|
|
241
|
+
this.apiKey = apiKey;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
246
|
+
*/
|
|
247
|
+
withOptions(options: Partial<ClientOptions>): this {
|
|
248
|
+
const client = new (this.constructor as any as new (props: ClientOptions) => typeof this)({
|
|
249
|
+
...this._options,
|
|
250
|
+
baseURL: this.baseURL,
|
|
251
|
+
maxRetries: this.maxRetries,
|
|
252
|
+
timeout: this.timeout,
|
|
253
|
+
logger: this.logger,
|
|
254
|
+
logLevel: this.logLevel,
|
|
255
|
+
fetch: this.fetch,
|
|
256
|
+
fetchOptions: this.fetchOptions,
|
|
257
|
+
apiKey: this.apiKey,
|
|
258
|
+
...options,
|
|
259
|
+
});
|
|
260
|
+
return client;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Check whether the base URL is set to its default.
|
|
265
|
+
*/
|
|
266
|
+
#baseURLOverridden(): boolean {
|
|
267
|
+
return this.baseURL !== 'https://api.bem.ai';
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
protected defaultQuery(): Record<string, string | undefined> | undefined {
|
|
271
|
+
return this._options.defaultQuery;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
protected validateHeaders({ values, nulls }: NullableHeaders) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
protected async authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
|
|
279
|
+
return buildHeaders([{ 'x-api-key': this.apiKey }]);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
protected stringifyQuery(query: object | Record<string, unknown>): string {
|
|
283
|
+
return stringifyQuery(query);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
private getUserAgent(): string {
|
|
287
|
+
return `${this.constructor.name}/JS ${VERSION}`;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
protected defaultIdempotencyKey(): string {
|
|
291
|
+
return `stainless-node-retry-${uuid4()}`;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
protected makeStatusError(
|
|
295
|
+
status: number,
|
|
296
|
+
error: Object,
|
|
297
|
+
message: string | undefined,
|
|
298
|
+
headers: Headers,
|
|
299
|
+
): Errors.APIError {
|
|
300
|
+
return Errors.APIError.generate(status, error, message, headers);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
buildURL(
|
|
304
|
+
path: string,
|
|
305
|
+
query: Record<string, unknown> | null | undefined,
|
|
306
|
+
defaultBaseURL?: string | undefined,
|
|
307
|
+
): string {
|
|
308
|
+
const baseURL = (!this.#baseURLOverridden() && defaultBaseURL) || this.baseURL;
|
|
309
|
+
const url =
|
|
310
|
+
isAbsoluteURL(path) ?
|
|
311
|
+
new URL(path)
|
|
312
|
+
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
313
|
+
|
|
314
|
+
const defaultQuery = this.defaultQuery();
|
|
315
|
+
const pathQuery = Object.fromEntries(url.searchParams);
|
|
316
|
+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
317
|
+
query = { ...pathQuery, ...defaultQuery, ...query };
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
321
|
+
url.search = this.stringifyQuery(query);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return url.toString();
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
329
|
+
*/
|
|
330
|
+
protected async prepareOptions(options: FinalRequestOptions): Promise<void> {}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Used as a callback for mutating the given `RequestInit` object.
|
|
334
|
+
*
|
|
335
|
+
* This is useful for cases where you want to add certain headers based off of
|
|
336
|
+
* the request properties, e.g. `method` or `url`.
|
|
337
|
+
*/
|
|
338
|
+
protected async prepareRequest(
|
|
339
|
+
request: RequestInit,
|
|
340
|
+
{ url, options }: { url: string; options: FinalRequestOptions },
|
|
341
|
+
): Promise<void> {}
|
|
342
|
+
|
|
343
|
+
get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
|
|
344
|
+
return this.methodRequest('get', path, opts);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
|
|
348
|
+
return this.methodRequest('post', path, opts);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
|
|
352
|
+
return this.methodRequest('patch', path, opts);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
|
|
356
|
+
return this.methodRequest('put', path, opts);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
|
|
360
|
+
return this.methodRequest('delete', path, opts);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
private methodRequest<Rsp>(
|
|
364
|
+
method: HTTPMethod,
|
|
365
|
+
path: string,
|
|
366
|
+
opts?: PromiseOrValue<RequestOptions>,
|
|
367
|
+
): APIPromise<Rsp> {
|
|
368
|
+
return this.request(
|
|
369
|
+
Promise.resolve(opts).then((opts) => {
|
|
370
|
+
return { method, path, ...opts };
|
|
371
|
+
}),
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
request<Rsp>(
|
|
376
|
+
options: PromiseOrValue<FinalRequestOptions>,
|
|
377
|
+
remainingRetries: number | null = null,
|
|
378
|
+
): APIPromise<Rsp> {
|
|
379
|
+
return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined));
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
private async makeRequest(
|
|
383
|
+
optionsInput: PromiseOrValue<FinalRequestOptions>,
|
|
384
|
+
retriesRemaining: number | null,
|
|
385
|
+
retryOfRequestLogID: string | undefined,
|
|
386
|
+
): Promise<APIResponseProps> {
|
|
387
|
+
const options = await optionsInput;
|
|
388
|
+
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
389
|
+
if (retriesRemaining == null) {
|
|
390
|
+
retriesRemaining = maxRetries;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
await this.prepareOptions(options);
|
|
394
|
+
|
|
395
|
+
const { req, url, timeout } = await this.buildRequest(options, {
|
|
396
|
+
retryCount: maxRetries - retriesRemaining,
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
await this.prepareRequest(req, { url, options });
|
|
400
|
+
|
|
401
|
+
/** Not an API request ID, just for correlating local log entries. */
|
|
402
|
+
const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
|
|
403
|
+
const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
|
|
404
|
+
const startTime = Date.now();
|
|
405
|
+
|
|
406
|
+
loggerFor(this).debug(
|
|
407
|
+
`[${requestLogID}] sending request`,
|
|
408
|
+
formatRequestDetails({
|
|
409
|
+
retryOfRequestLogID,
|
|
410
|
+
method: options.method,
|
|
411
|
+
url,
|
|
412
|
+
options,
|
|
413
|
+
headers: req.headers,
|
|
414
|
+
}),
|
|
415
|
+
);
|
|
416
|
+
|
|
417
|
+
if (options.signal?.aborted) {
|
|
418
|
+
throw new Errors.APIUserAbortError();
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const controller = new AbortController();
|
|
422
|
+
const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
|
|
423
|
+
const headersTime = Date.now();
|
|
424
|
+
|
|
425
|
+
if (response instanceof globalThis.Error) {
|
|
426
|
+
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
427
|
+
if (options.signal?.aborted) {
|
|
428
|
+
throw new Errors.APIUserAbortError();
|
|
429
|
+
}
|
|
430
|
+
// detect native connection timeout errors
|
|
431
|
+
// deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
|
|
432
|
+
// undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
|
|
433
|
+
// others do not provide enough information to distinguish timeouts from other connection errors
|
|
434
|
+
const isTimeout =
|
|
435
|
+
isAbortError(response) ||
|
|
436
|
+
/timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
|
|
437
|
+
if (retriesRemaining) {
|
|
438
|
+
loggerFor(this).info(
|
|
439
|
+
`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`,
|
|
440
|
+
);
|
|
441
|
+
loggerFor(this).debug(
|
|
442
|
+
`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`,
|
|
443
|
+
formatRequestDetails({
|
|
444
|
+
retryOfRequestLogID,
|
|
445
|
+
url,
|
|
446
|
+
durationMs: headersTime - startTime,
|
|
447
|
+
message: response.message,
|
|
448
|
+
}),
|
|
449
|
+
);
|
|
450
|
+
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
|
|
451
|
+
}
|
|
452
|
+
loggerFor(this).info(
|
|
453
|
+
`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`,
|
|
454
|
+
);
|
|
455
|
+
loggerFor(this).debug(
|
|
456
|
+
`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`,
|
|
457
|
+
formatRequestDetails({
|
|
458
|
+
retryOfRequestLogID,
|
|
459
|
+
url,
|
|
460
|
+
durationMs: headersTime - startTime,
|
|
461
|
+
message: response.message,
|
|
462
|
+
}),
|
|
463
|
+
);
|
|
464
|
+
if (isTimeout) {
|
|
465
|
+
throw new Errors.APIConnectionTimeoutError();
|
|
466
|
+
}
|
|
467
|
+
throw new Errors.APIConnectionError({ cause: response });
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${
|
|
471
|
+
response.ok ? 'succeeded' : 'failed'
|
|
472
|
+
} with status ${response.status} in ${headersTime - startTime}ms`;
|
|
473
|
+
|
|
474
|
+
if (!response.ok) {
|
|
475
|
+
const shouldRetry = await this.shouldRetry(response);
|
|
476
|
+
if (retriesRemaining && shouldRetry) {
|
|
477
|
+
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
478
|
+
|
|
479
|
+
// We don't need the body of this response.
|
|
480
|
+
await Shims.CancelReadableStream(response.body);
|
|
481
|
+
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
482
|
+
loggerFor(this).debug(
|
|
483
|
+
`[${requestLogID}] response error (${retryMessage})`,
|
|
484
|
+
formatRequestDetails({
|
|
485
|
+
retryOfRequestLogID,
|
|
486
|
+
url: response.url,
|
|
487
|
+
status: response.status,
|
|
488
|
+
headers: response.headers,
|
|
489
|
+
durationMs: headersTime - startTime,
|
|
490
|
+
}),
|
|
491
|
+
);
|
|
492
|
+
return this.retryRequest(
|
|
493
|
+
options,
|
|
494
|
+
retriesRemaining,
|
|
495
|
+
retryOfRequestLogID ?? requestLogID,
|
|
496
|
+
response.headers,
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
|
|
501
|
+
|
|
502
|
+
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
503
|
+
|
|
504
|
+
const errText = await response.text().catch((err: any) => castToError(err).message);
|
|
505
|
+
const errJSON = safeJSON(errText) as any;
|
|
506
|
+
const errMessage = errJSON ? undefined : errText;
|
|
507
|
+
|
|
508
|
+
loggerFor(this).debug(
|
|
509
|
+
`[${requestLogID}] response error (${retryMessage})`,
|
|
510
|
+
formatRequestDetails({
|
|
511
|
+
retryOfRequestLogID,
|
|
512
|
+
url: response.url,
|
|
513
|
+
status: response.status,
|
|
514
|
+
headers: response.headers,
|
|
515
|
+
message: errMessage,
|
|
516
|
+
durationMs: Date.now() - startTime,
|
|
517
|
+
}),
|
|
518
|
+
);
|
|
519
|
+
|
|
520
|
+
const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
|
|
521
|
+
throw err;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
loggerFor(this).info(responseInfo);
|
|
525
|
+
loggerFor(this).debug(
|
|
526
|
+
`[${requestLogID}] response start`,
|
|
527
|
+
formatRequestDetails({
|
|
528
|
+
retryOfRequestLogID,
|
|
529
|
+
url: response.url,
|
|
530
|
+
status: response.status,
|
|
531
|
+
headers: response.headers,
|
|
532
|
+
durationMs: headersTime - startTime,
|
|
533
|
+
}),
|
|
534
|
+
);
|
|
535
|
+
|
|
536
|
+
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
|
|
540
|
+
path: string,
|
|
541
|
+
Page: new (...args: any[]) => PageClass,
|
|
542
|
+
opts?: PromiseOrValue<RequestOptions>,
|
|
543
|
+
): Pagination.PagePromise<PageClass, Item> {
|
|
544
|
+
return this.requestAPIList(
|
|
545
|
+
Page,
|
|
546
|
+
opts && 'then' in opts ?
|
|
547
|
+
opts.then((opts) => ({ method: 'get', path, ...opts }))
|
|
548
|
+
: { method: 'get', path, ...opts },
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
requestAPIList<
|
|
553
|
+
Item = unknown,
|
|
554
|
+
PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
|
|
555
|
+
>(
|
|
556
|
+
Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
|
|
557
|
+
options: PromiseOrValue<FinalRequestOptions>,
|
|
558
|
+
): Pagination.PagePromise<PageClass, Item> {
|
|
559
|
+
const request = this.makeRequest(options, null, undefined);
|
|
560
|
+
return new Pagination.PagePromise<PageClass, Item>(this as any as Bem, request, Page);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
async fetchWithTimeout(
|
|
564
|
+
url: RequestInfo,
|
|
565
|
+
init: RequestInit | undefined,
|
|
566
|
+
ms: number,
|
|
567
|
+
controller: AbortController,
|
|
568
|
+
): Promise<Response> {
|
|
569
|
+
const { signal, method, ...options } = init || {};
|
|
570
|
+
const abort = this._makeAbort(controller);
|
|
571
|
+
if (signal) signal.addEventListener('abort', abort, { once: true });
|
|
572
|
+
|
|
573
|
+
const timeout = setTimeout(abort, ms);
|
|
574
|
+
|
|
575
|
+
const isReadableBody =
|
|
576
|
+
((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
|
|
577
|
+
(typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
|
|
578
|
+
|
|
579
|
+
const fetchOptions: RequestInit = {
|
|
580
|
+
signal: controller.signal as any,
|
|
581
|
+
...(isReadableBody ? { duplex: 'half' } : {}),
|
|
582
|
+
method: 'GET',
|
|
583
|
+
...options,
|
|
584
|
+
};
|
|
585
|
+
if (method) {
|
|
586
|
+
// Custom methods like 'patch' need to be uppercased
|
|
587
|
+
// See https://github.com/nodejs/undici/issues/2294
|
|
588
|
+
fetchOptions.method = method.toUpperCase();
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
try {
|
|
592
|
+
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
|
|
593
|
+
return await this.fetch.call(undefined, url, fetchOptions);
|
|
594
|
+
} finally {
|
|
595
|
+
clearTimeout(timeout);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
private async shouldRetry(response: Response): Promise<boolean> {
|
|
600
|
+
// Note this is not a standard header.
|
|
601
|
+
const shouldRetryHeader = response.headers.get('x-should-retry');
|
|
602
|
+
|
|
603
|
+
// If the server explicitly says whether or not to retry, obey.
|
|
604
|
+
if (shouldRetryHeader === 'true') return true;
|
|
605
|
+
if (shouldRetryHeader === 'false') return false;
|
|
606
|
+
|
|
607
|
+
// Retry on request timeouts.
|
|
608
|
+
if (response.status === 408) return true;
|
|
609
|
+
|
|
610
|
+
// Retry on lock timeouts.
|
|
611
|
+
if (response.status === 409) return true;
|
|
612
|
+
|
|
613
|
+
// Retry on rate limits.
|
|
614
|
+
if (response.status === 429) return true;
|
|
615
|
+
|
|
616
|
+
// Retry internal errors.
|
|
617
|
+
if (response.status >= 500) return true;
|
|
618
|
+
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
private async retryRequest(
|
|
623
|
+
options: FinalRequestOptions,
|
|
624
|
+
retriesRemaining: number,
|
|
625
|
+
requestLogID: string,
|
|
626
|
+
responseHeaders?: Headers | undefined,
|
|
627
|
+
): Promise<APIResponseProps> {
|
|
628
|
+
let timeoutMillis: number | undefined;
|
|
629
|
+
|
|
630
|
+
// Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
|
|
631
|
+
const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
|
|
632
|
+
if (retryAfterMillisHeader) {
|
|
633
|
+
const timeoutMs = parseFloat(retryAfterMillisHeader);
|
|
634
|
+
if (!Number.isNaN(timeoutMs)) {
|
|
635
|
+
timeoutMillis = timeoutMs;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
// About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
640
|
+
const retryAfterHeader = responseHeaders?.get('retry-after');
|
|
641
|
+
if (retryAfterHeader && !timeoutMillis) {
|
|
642
|
+
const timeoutSeconds = parseFloat(retryAfterHeader);
|
|
643
|
+
if (!Number.isNaN(timeoutSeconds)) {
|
|
644
|
+
timeoutMillis = timeoutSeconds * 1000;
|
|
645
|
+
} else {
|
|
646
|
+
timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// If the API asks us to wait a certain amount of time, just do what it
|
|
651
|
+
// says, but otherwise calculate a default
|
|
652
|
+
if (timeoutMillis === undefined) {
|
|
653
|
+
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
654
|
+
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
655
|
+
}
|
|
656
|
+
await sleep(timeoutMillis);
|
|
657
|
+
|
|
658
|
+
return this.makeRequest(options, retriesRemaining - 1, requestLogID);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
private calculateDefaultRetryTimeoutMillis(retriesRemaining: number, maxRetries: number): number {
|
|
662
|
+
const initialRetryDelay = 0.5;
|
|
663
|
+
const maxRetryDelay = 8.0;
|
|
664
|
+
|
|
665
|
+
const numRetries = maxRetries - retriesRemaining;
|
|
666
|
+
|
|
667
|
+
// Apply exponential backoff, but not more than the max.
|
|
668
|
+
const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
|
|
669
|
+
|
|
670
|
+
// Apply some jitter, take up to at most 25 percent of the retry time.
|
|
671
|
+
const jitter = 1 - Math.random() * 0.25;
|
|
672
|
+
|
|
673
|
+
return sleepSeconds * jitter * 1000;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
async buildRequest(
|
|
677
|
+
inputOptions: FinalRequestOptions,
|
|
678
|
+
{ retryCount = 0 }: { retryCount?: number } = {},
|
|
679
|
+
): Promise<{ req: FinalizedRequestInit; url: string; timeout: number }> {
|
|
680
|
+
const options = { ...inputOptions };
|
|
681
|
+
const { method, path, query, defaultBaseURL } = options;
|
|
682
|
+
|
|
683
|
+
const url = this.buildURL(path!, query as Record<string, unknown>, defaultBaseURL);
|
|
684
|
+
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
|
|
685
|
+
options.timeout = options.timeout ?? this.timeout;
|
|
686
|
+
const { bodyHeaders, body } = this.buildBody({ options });
|
|
687
|
+
const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
|
|
688
|
+
|
|
689
|
+
const req: FinalizedRequestInit = {
|
|
690
|
+
method,
|
|
691
|
+
headers: reqHeaders,
|
|
692
|
+
...(options.signal && { signal: options.signal }),
|
|
693
|
+
...((globalThis as any).ReadableStream &&
|
|
694
|
+
body instanceof (globalThis as any).ReadableStream && { duplex: 'half' }),
|
|
695
|
+
...(body && { body }),
|
|
696
|
+
...((this.fetchOptions as any) ?? {}),
|
|
697
|
+
...((options.fetchOptions as any) ?? {}),
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
return { req, url, timeout: options.timeout };
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
private async buildHeaders({
|
|
704
|
+
options,
|
|
705
|
+
method,
|
|
706
|
+
bodyHeaders,
|
|
707
|
+
retryCount,
|
|
708
|
+
}: {
|
|
709
|
+
options: FinalRequestOptions;
|
|
710
|
+
method: HTTPMethod;
|
|
711
|
+
bodyHeaders: HeadersLike;
|
|
712
|
+
retryCount: number;
|
|
713
|
+
}): Promise<Headers> {
|
|
714
|
+
let idempotencyHeaders: HeadersLike = {};
|
|
715
|
+
if (this.idempotencyHeader && method !== 'get') {
|
|
716
|
+
if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();
|
|
717
|
+
idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
const headers = buildHeaders([
|
|
721
|
+
idempotencyHeaders,
|
|
722
|
+
{
|
|
723
|
+
Accept: 'application/json',
|
|
724
|
+
'User-Agent': this.getUserAgent(),
|
|
725
|
+
'X-Stainless-Retry-Count': String(retryCount),
|
|
726
|
+
...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
|
|
727
|
+
...getPlatformHeaders(),
|
|
728
|
+
},
|
|
729
|
+
await this.authHeaders(options),
|
|
730
|
+
this._options.defaultHeaders,
|
|
731
|
+
bodyHeaders,
|
|
732
|
+
options.headers,
|
|
733
|
+
]);
|
|
734
|
+
|
|
735
|
+
this.validateHeaders(headers);
|
|
736
|
+
|
|
737
|
+
return headers.values;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
private _makeAbort(controller: AbortController) {
|
|
741
|
+
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
|
|
742
|
+
// would capture all request options, and cause a memory leak.
|
|
743
|
+
return () => controller.abort();
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
|
|
747
|
+
bodyHeaders: HeadersLike;
|
|
748
|
+
body: BodyInit | undefined;
|
|
749
|
+
} {
|
|
750
|
+
if (!body) {
|
|
751
|
+
return { bodyHeaders: undefined, body: undefined };
|
|
752
|
+
}
|
|
753
|
+
const headers = buildHeaders([rawHeaders]);
|
|
754
|
+
if (
|
|
755
|
+
// Pass raw type verbatim
|
|
756
|
+
ArrayBuffer.isView(body) ||
|
|
757
|
+
body instanceof ArrayBuffer ||
|
|
758
|
+
body instanceof DataView ||
|
|
759
|
+
(typeof body === 'string' &&
|
|
760
|
+
// Preserve legacy string encoding behavior for now
|
|
761
|
+
headers.values.has('content-type')) ||
|
|
762
|
+
// `Blob` is superset of `File`
|
|
763
|
+
((globalThis as any).Blob && body instanceof (globalThis as any).Blob) ||
|
|
764
|
+
// `FormData` -> `multipart/form-data`
|
|
765
|
+
body instanceof FormData ||
|
|
766
|
+
// `URLSearchParams` -> `application/x-www-form-urlencoded`
|
|
767
|
+
body instanceof URLSearchParams ||
|
|
768
|
+
// Send chunked stream (each chunk has own `length`)
|
|
769
|
+
((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream)
|
|
770
|
+
) {
|
|
771
|
+
return { bodyHeaders: undefined, body: body as BodyInit };
|
|
772
|
+
} else if (
|
|
773
|
+
typeof body === 'object' &&
|
|
774
|
+
(Symbol.asyncIterator in body ||
|
|
775
|
+
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
|
|
776
|
+
) {
|
|
777
|
+
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
|
|
778
|
+
} else if (
|
|
779
|
+
typeof body === 'object' &&
|
|
780
|
+
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
|
|
781
|
+
) {
|
|
782
|
+
return {
|
|
783
|
+
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
784
|
+
body: this.stringifyQuery(body),
|
|
785
|
+
};
|
|
786
|
+
} else {
|
|
787
|
+
return this.#encoder({ body, headers });
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
static Bem = this;
|
|
792
|
+
static DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
793
|
+
|
|
794
|
+
static BemError = Errors.BemError;
|
|
795
|
+
static APIError = Errors.APIError;
|
|
796
|
+
static APIConnectionError = Errors.APIConnectionError;
|
|
797
|
+
static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
798
|
+
static APIUserAbortError = Errors.APIUserAbortError;
|
|
799
|
+
static NotFoundError = Errors.NotFoundError;
|
|
800
|
+
static ConflictError = Errors.ConflictError;
|
|
801
|
+
static RateLimitError = Errors.RateLimitError;
|
|
802
|
+
static BadRequestError = Errors.BadRequestError;
|
|
803
|
+
static AuthenticationError = Errors.AuthenticationError;
|
|
804
|
+
static InternalServerError = Errors.InternalServerError;
|
|
805
|
+
static PermissionDeniedError = Errors.PermissionDeniedError;
|
|
806
|
+
static UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
807
|
+
|
|
808
|
+
static toFile = Uploads.toFile;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Functions are the core building blocks of data transformation in Bem. Each function type serves a specific purpose:
|
|
812
|
+
*
|
|
813
|
+
* - **Transform**: Extract structured JSON data from unstructured documents (PDFs, emails, images)
|
|
814
|
+
* - **Analyze**: Perform visual analysis on documents to extract layout-aware information
|
|
815
|
+
* - **Route**: Direct data to different processing paths based on conditions
|
|
816
|
+
* - **Split**: Break multi-page documents into individual pages for parallel processing
|
|
817
|
+
* - **Join**: Combine outputs from multiple function calls into a single result
|
|
818
|
+
* - **Payload Shaping**: Transform and restructure data using JMESPath expressions
|
|
819
|
+
* - **Enrich**: Enhance data with semantic search against collections
|
|
820
|
+
*
|
|
821
|
+
* Use these endpoints to create, update, list, and manage your functions.
|
|
822
|
+
*/
|
|
823
|
+
functions: API.Functions = new API.Functions(this);
|
|
824
|
+
/**
|
|
825
|
+
* The Calls API provides a unified interface for invoking both **Workflows** and **Functions**.
|
|
826
|
+
*
|
|
827
|
+
* Use this API when you want to:
|
|
828
|
+
* - Execute a complete workflow that chains multiple functions together
|
|
829
|
+
* - Call a single function directly without defining a workflow
|
|
830
|
+
* - Submit batch requests with multiple inputs in a single API call
|
|
831
|
+
* - Track execution status using call reference IDs
|
|
832
|
+
*
|
|
833
|
+
* **Key Difference**: Calls vs Function Calls
|
|
834
|
+
* - **Calls API** (`/v3/calls`): High-level API for invoking workflows or functions by name/ID. Supports batch processing and workflow orchestration.
|
|
835
|
+
* - **Function Calls API** (`/v3/functions/{functionName}/call`): Direct function invocation with function-type-specific arguments. Better for granular control over individual function calls.
|
|
836
|
+
*/
|
|
837
|
+
calls: API.Calls = new API.Calls(this);
|
|
838
|
+
/**
|
|
839
|
+
* Retrieve terminal error events from workflow calls.
|
|
840
|
+
*
|
|
841
|
+
* Errors are events produced by function steps that failed during processing. A single workflow
|
|
842
|
+
* call may produce multiple error events if several steps fail independently.
|
|
843
|
+
*
|
|
844
|
+
* Errors and outputs from the same call are not mutually exclusive: a partially-completed
|
|
845
|
+
* workflow may have both.
|
|
846
|
+
*
|
|
847
|
+
* Use `GET /v3/errors` to list errors across calls, or `GET /v3/errors/{eventID}` to retrieve
|
|
848
|
+
* a specific error. To get errors scoped to a single call, filter by `callIDs`.
|
|
849
|
+
*/
|
|
850
|
+
errors: API.Errors = new API.Errors(this);
|
|
851
|
+
/**
|
|
852
|
+
* Retrieve terminal non-error output events from workflow calls.
|
|
853
|
+
*
|
|
854
|
+
* Outputs are events produced by successful terminal function steps — steps that completed
|
|
855
|
+
* without errors and did not spawn further downstream function calls. A single workflow call
|
|
856
|
+
* may produce multiple outputs (e.g. from a split-then-transform pipeline).
|
|
857
|
+
*
|
|
858
|
+
* Outputs and errors from the same call are not mutually exclusive: a partially-completed
|
|
859
|
+
* workflow may have both.
|
|
860
|
+
*
|
|
861
|
+
* Use `GET /v3/outputs` to list outputs across calls, or `GET /v3/outputs/{eventID}` to
|
|
862
|
+
* retrieve a specific output. To get outputs scoped to a single call, filter by `callIDs`.
|
|
863
|
+
*/
|
|
864
|
+
outputs: API.Outputs = new API.Outputs(this);
|
|
865
|
+
/**
|
|
866
|
+
* Workflow operations
|
|
867
|
+
*/
|
|
868
|
+
workflows: API.Workflows = new API.Workflows(this);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
Bem.Functions = Functions;
|
|
872
|
+
Bem.Calls = Calls;
|
|
873
|
+
Bem.Errors = ErrorsAPIErrors;
|
|
874
|
+
Bem.Outputs = Outputs;
|
|
875
|
+
Bem.Workflows = Workflows;
|
|
876
|
+
|
|
877
|
+
export declare namespace Bem {
|
|
878
|
+
export type RequestOptions = Opts.RequestOptions;
|
|
879
|
+
|
|
880
|
+
export import FunctionsPage = Pagination.FunctionsPage;
|
|
881
|
+
export {
|
|
882
|
+
type FunctionsPageParams as FunctionsPageParams,
|
|
883
|
+
type FunctionsPageResponse as FunctionsPageResponse,
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
export import WorkflowsPage = Pagination.WorkflowsPage;
|
|
887
|
+
export {
|
|
888
|
+
type WorkflowsPageParams as WorkflowsPageParams,
|
|
889
|
+
type WorkflowsPageResponse as WorkflowsPageResponse,
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
export import CallsPage = Pagination.CallsPage;
|
|
893
|
+
export { type CallsPageParams as CallsPageParams, type CallsPageResponse as CallsPageResponse };
|
|
894
|
+
|
|
895
|
+
export import OutputsPage = Pagination.OutputsPage;
|
|
896
|
+
export { type OutputsPageParams as OutputsPageParams, type OutputsPageResponse as OutputsPageResponse };
|
|
897
|
+
|
|
898
|
+
export import ErrorsPage = Pagination.ErrorsPage;
|
|
899
|
+
export { type ErrorsPageParams as ErrorsPageParams, type ErrorsPageResponse as ErrorsPageResponse };
|
|
900
|
+
|
|
901
|
+
export import WorkflowVersionsPage = Pagination.WorkflowVersionsPage;
|
|
902
|
+
export {
|
|
903
|
+
type WorkflowVersionsPageParams as WorkflowVersionsPageParams,
|
|
904
|
+
type WorkflowVersionsPageResponse as WorkflowVersionsPageResponse,
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
export {
|
|
908
|
+
Functions as Functions,
|
|
909
|
+
type CreateFunction as CreateFunction,
|
|
910
|
+
type EnrichConfig as EnrichConfig,
|
|
911
|
+
type EnrichStep as EnrichStep,
|
|
912
|
+
type Function as Function,
|
|
913
|
+
type FunctionAudit as FunctionAudit,
|
|
914
|
+
type FunctionResponse as FunctionResponse,
|
|
915
|
+
type FunctionType as FunctionType,
|
|
916
|
+
type ListFunctionsResponse as ListFunctionsResponse,
|
|
917
|
+
type RouteListItem as RouteListItem,
|
|
918
|
+
type SplitFunctionSemanticPageItemClass as SplitFunctionSemanticPageItemClass,
|
|
919
|
+
type UpdateFunction as UpdateFunction,
|
|
920
|
+
type UserActionSummary as UserActionSummary,
|
|
921
|
+
type WorkflowUsageInfo as WorkflowUsageInfo,
|
|
922
|
+
type FunctionsFunctionsPage as FunctionsFunctionsPage,
|
|
923
|
+
type FunctionCreateParams as FunctionCreateParams,
|
|
924
|
+
type FunctionUpdateParams as FunctionUpdateParams,
|
|
925
|
+
type FunctionListParams as FunctionListParams,
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
export {
|
|
929
|
+
Calls as Calls,
|
|
930
|
+
type Call as Call,
|
|
931
|
+
type CallGetResponse as CallGetResponse,
|
|
932
|
+
type CallsCallsPage as CallsCallsPage,
|
|
933
|
+
type CallListParams as CallListParams,
|
|
934
|
+
};
|
|
935
|
+
|
|
936
|
+
export {
|
|
937
|
+
ErrorsAPIErrors as Errors,
|
|
938
|
+
type ErrorEvent as ErrorEvent,
|
|
939
|
+
type InboundEmailEvent as InboundEmailEvent,
|
|
940
|
+
type ErrorRetrieveResponse as ErrorRetrieveResponse,
|
|
941
|
+
type ErrorEventsErrorsPage as ErrorEventsErrorsPage,
|
|
942
|
+
type ErrorListParams as ErrorListParams,
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
export {
|
|
946
|
+
Outputs as Outputs,
|
|
947
|
+
type AnyType as AnyType,
|
|
948
|
+
type Event as Event,
|
|
949
|
+
type OutputRetrieveResponse as OutputRetrieveResponse,
|
|
950
|
+
type EventsOutputsPage as EventsOutputsPage,
|
|
951
|
+
type OutputListParams as OutputListParams,
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
export {
|
|
955
|
+
Workflows as Workflows,
|
|
956
|
+
type FunctionVersionIdentifier as FunctionVersionIdentifier,
|
|
957
|
+
type Workflow as Workflow,
|
|
958
|
+
type WorkflowRequestRelationship as WorkflowRequestRelationship,
|
|
959
|
+
type WorkflowCreateResponse as WorkflowCreateResponse,
|
|
960
|
+
type WorkflowRetrieveResponse as WorkflowRetrieveResponse,
|
|
961
|
+
type WorkflowUpdateResponse as WorkflowUpdateResponse,
|
|
962
|
+
type WorkflowCopyResponse as WorkflowCopyResponse,
|
|
963
|
+
type WorkflowsWorkflowsPage as WorkflowsWorkflowsPage,
|
|
964
|
+
type WorkflowCreateParams as WorkflowCreateParams,
|
|
965
|
+
type WorkflowUpdateParams as WorkflowUpdateParams,
|
|
966
|
+
type WorkflowListParams as WorkflowListParams,
|
|
967
|
+
type WorkflowCallParams as WorkflowCallParams,
|
|
968
|
+
type WorkflowCopyParams as WorkflowCopyParams,
|
|
969
|
+
};
|
|
970
|
+
}
|