@ainative/cody-sdk 0.1.0
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/.github/logo.svg +3 -0
- package/CHANGELOG.md +2345 -0
- package/LICENSE +8 -0
- package/README.md +45 -0
- package/_vendor/partial-json-parser/parser.d.mts +3 -0
- package/_vendor/partial-json-parser/parser.d.mts.map +1 -0
- package/_vendor/partial-json-parser/parser.d.ts +3 -0
- package/_vendor/partial-json-parser/parser.d.ts.map +1 -0
- package/_vendor/partial-json-parser/parser.js +226 -0
- package/_vendor/partial-json-parser/parser.js.map +1 -0
- package/_vendor/partial-json-parser/parser.mjs +223 -0
- package/_vendor/partial-json-parser/parser.mjs.map +1 -0
- package/ainative.d.mts +32 -0
- package/ainative.d.mts.map +1 -0
- package/ainative.d.ts +32 -0
- package/ainative.d.ts.map +1 -0
- package/ainative.js +78 -0
- package/ainative.js.map +1 -0
- package/ainative.mjs +71 -0
- package/ainative.mjs.map +1 -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/bin/cli +53 -0
- package/bin/migration-config.json +82 -0
- package/client.d.mts +247 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +247 -0
- package/client.d.ts.map +1 -0
- package/client.js +567 -0
- package/client.js.map +1 -0
- package/client.mjs +562 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +49 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +49 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +76 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +72 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +50 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +50 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +116 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +100 -0
- package/core/error.mjs.map +1 -0
- package/core/pagination.d.mts +105 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +105 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +185 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +177 -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/streaming.d.mts +33 -0
- package/core/streaming.d.mts.map +1 -0
- package/core/streaming.d.ts +33 -0
- package/core/streaming.d.ts.map +1 -0
- package/core/streaming.js +290 -0
- package/core/streaming.js.map +1 -0
- package/core/streaming.mjs +285 -0
- package/core/streaming.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/helpers/beta/json-schema.d.mts +31 -0
- package/helpers/beta/json-schema.d.mts.map +1 -0
- package/helpers/beta/json-schema.d.ts +31 -0
- package/helpers/beta/json-schema.d.ts.map +1 -0
- package/helpers/beta/json-schema.js +56 -0
- package/helpers/beta/json-schema.js.map +1 -0
- package/helpers/beta/json-schema.mjs +52 -0
- package/helpers/beta/json-schema.mjs.map +1 -0
- package/helpers/beta/mcp.d.mts +303 -0
- package/helpers/beta/mcp.d.mts.map +1 -0
- package/helpers/beta/mcp.d.ts +303 -0
- package/helpers/beta/mcp.d.ts.map +1 -0
- package/helpers/beta/mcp.js +419 -0
- package/helpers/beta/mcp.js.map +1 -0
- package/helpers/beta/mcp.mjs +406 -0
- package/helpers/beta/mcp.mjs.map +1 -0
- package/helpers/beta/memory.d.mts +11 -0
- package/helpers/beta/memory.d.mts.map +1 -0
- package/helpers/beta/memory.d.ts +11 -0
- package/helpers/beta/memory.d.ts.map +1 -0
- package/helpers/beta/memory.js +18 -0
- package/helpers/beta/memory.js.map +1 -0
- package/helpers/beta/memory.mjs +15 -0
- package/helpers/beta/memory.mjs.map +1 -0
- package/helpers/beta/zod.d.mts +27 -0
- package/helpers/beta/zod.d.mts.map +1 -0
- package/helpers/beta/zod.d.ts +27 -0
- package/helpers/beta/zod.d.ts.map +1 -0
- package/helpers/beta/zod.js +57 -0
- package/helpers/beta/zod.js.map +1 -0
- package/helpers/beta/zod.mjs +52 -0
- package/helpers/beta/zod.mjs.map +1 -0
- package/helpers/index.d.mts +3 -0
- package/helpers/index.d.mts.map +1 -0
- package/helpers/index.d.ts +3 -0
- package/helpers/index.d.ts.map +1 -0
- package/helpers/index.js +8 -0
- package/helpers/index.js.map +1 -0
- package/helpers/index.mjs +3 -0
- package/helpers/index.mjs.map +1 -0
- package/helpers/json-schema.d.mts +18 -0
- package/helpers/json-schema.d.mts.map +1 -0
- package/helpers/json-schema.d.ts +18 -0
- package/helpers/json-schema.d.ts.map +1 -0
- package/helpers/json-schema.js +37 -0
- package/helpers/json-schema.js.map +1 -0
- package/helpers/json-schema.mjs +34 -0
- package/helpers/json-schema.mjs.map +1 -0
- package/helpers/zod.d.mts +13 -0
- package/helpers/zod.d.mts.map +1 -0
- package/helpers/zod.d.ts +13 -0
- package/helpers/zod.d.ts.map +1 -0
- package/helpers/zod.js +47 -0
- package/helpers/zod.js.map +1 -0
- package/helpers/zod.mjs +43 -0
- package/helpers/zod.mjs.map +1 -0
- package/index.d.mts +9 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +9 -0
- package/index.d.ts.map +1 -0
- package/index.js +42 -0
- package/index.js.map +1 -0
- package/index.mjs +9 -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/constants.d.mts +5 -0
- package/internal/constants.d.mts.map +1 -0
- package/internal/constants.d.ts +5 -0
- package/internal/constants.d.ts.map +1 -0
- package/internal/constants.js +18 -0
- package/internal/constants.js.map +1 -0
- package/internal/constants.mjs +15 -0
- package/internal/constants.mjs.map +1 -0
- package/internal/decoders/jsonl.d.mts +10 -0
- package/internal/decoders/jsonl.d.mts.map +1 -0
- package/internal/decoders/jsonl.d.ts +10 -0
- package/internal/decoders/jsonl.d.ts.map +1 -0
- package/internal/decoders/jsonl.js +39 -0
- package/internal/decoders/jsonl.js.map +1 -0
- package/internal/decoders/jsonl.mjs +35 -0
- package/internal/decoders/jsonl.mjs.map +1 -0
- package/internal/decoders/line.d.mts +17 -0
- package/internal/decoders/line.d.mts.map +1 -0
- package/internal/decoders/line.d.ts +17 -0
- package/internal/decoders/line.d.ts.map +1 -0
- package/internal/decoders/line.js +113 -0
- package/internal/decoders/line.js.map +1 -0
- package/internal/decoders/line.mjs +108 -0
- package/internal/decoders/line.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 +22 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +22 -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 +17 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +17 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +60 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +56 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +77 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +77 -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/stream-utils.d.mts +8 -0
- package/internal/stream-utils.d.mts.map +1 -0
- package/internal/stream-utils.d.ts +8 -0
- package/internal/stream-utils.d.ts.map +1 -0
- package/internal/stream-utils.js +38 -0
- package/internal/stream-utils.js.map +1 -0
- package/internal/stream-utils.mjs +35 -0
- package/internal/stream-utils.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 +96 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +93 -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 +145 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +135 -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 +5 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +5 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +23 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +20 -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 +19 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +19 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +119 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +100 -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/lib/BetaMessageStream.d.mts +122 -0
- package/lib/BetaMessageStream.d.mts.map +1 -0
- package/lib/BetaMessageStream.d.ts +122 -0
- package/lib/BetaMessageStream.d.ts.map +1 -0
- package/lib/BetaMessageStream.js +620 -0
- package/lib/BetaMessageStream.js.map +1 -0
- package/lib/BetaMessageStream.mjs +616 -0
- package/lib/BetaMessageStream.mjs.map +1 -0
- package/lib/MessageStream.d.mts +121 -0
- package/lib/MessageStream.d.mts.map +1 -0
- package/lib/MessageStream.d.ts +121 -0
- package/lib/MessageStream.d.ts.map +1 -0
- package/lib/MessageStream.js +595 -0
- package/lib/MessageStream.js.map +1 -0
- package/lib/MessageStream.mjs +591 -0
- package/lib/MessageStream.mjs.map +1 -0
- package/lib/beta-parser.d.mts +37 -0
- package/lib/beta-parser.d.mts.map +1 -0
- package/lib/beta-parser.d.ts +37 -0
- package/lib/beta-parser.d.ts.map +1 -0
- package/lib/beta-parser.js +79 -0
- package/lib/beta-parser.js.map +1 -0
- package/lib/beta-parser.mjs +75 -0
- package/lib/beta-parser.mjs.map +1 -0
- package/lib/parser.d.mts +32 -0
- package/lib/parser.d.mts.map +1 -0
- package/lib/parser.d.ts +32 -0
- package/lib/parser.d.ts.map +1 -0
- package/lib/parser.js +66 -0
- package/lib/parser.js.map +1 -0
- package/lib/parser.mjs +62 -0
- package/lib/parser.mjs.map +1 -0
- package/lib/stainless-helper-header.d.mts +34 -0
- package/lib/stainless-helper-header.d.mts.map +1 -0
- package/lib/stainless-helper-header.d.ts +34 -0
- package/lib/stainless-helper-header.d.ts.map +1 -0
- package/lib/stainless-helper-header.js +70 -0
- package/lib/stainless-helper-header.js.map +1 -0
- package/lib/stainless-helper-header.mjs +63 -0
- package/lib/stainless-helper-header.mjs.map +1 -0
- package/lib/tools/BetaRunnableTool.d.mts +12 -0
- package/lib/tools/BetaRunnableTool.d.mts.map +1 -0
- package/lib/tools/BetaRunnableTool.d.ts +12 -0
- package/lib/tools/BetaRunnableTool.d.ts.map +1 -0
- package/lib/tools/BetaRunnableTool.js +3 -0
- package/lib/tools/BetaRunnableTool.js.map +1 -0
- package/lib/tools/BetaRunnableTool.mjs +2 -0
- package/lib/tools/BetaRunnableTool.mjs.map +1 -0
- package/lib/tools/BetaToolRunner.d.mts +141 -0
- package/lib/tools/BetaToolRunner.d.mts.map +1 -0
- package/lib/tools/BetaToolRunner.d.ts +141 -0
- package/lib/tools/BetaToolRunner.d.ts.map +1 -0
- package/lib/tools/BetaToolRunner.js +381 -0
- package/lib/tools/BetaToolRunner.js.map +1 -0
- package/lib/tools/BetaToolRunner.mjs +377 -0
- package/lib/tools/BetaToolRunner.mjs.map +1 -0
- package/lib/tools/CompactionControl.d.mts +30 -0
- package/lib/tools/CompactionControl.d.mts.map +1 -0
- package/lib/tools/CompactionControl.d.ts +30 -0
- package/lib/tools/CompactionControl.d.ts.map +1 -0
- package/lib/tools/CompactionControl.js +28 -0
- package/lib/tools/CompactionControl.js.map +1 -0
- package/lib/tools/CompactionControl.mjs +25 -0
- package/lib/tools/CompactionControl.mjs.map +1 -0
- package/lib/tools/ToolError.d.mts +33 -0
- package/lib/tools/ToolError.d.mts.map +1 -0
- package/lib/tools/ToolError.d.ts +33 -0
- package/lib/tools/ToolError.d.ts.map +1 -0
- package/lib/tools/ToolError.js +42 -0
- package/lib/tools/ToolError.js.map +1 -0
- package/lib/tools/ToolError.mjs +38 -0
- package/lib/tools/ToolError.mjs.map +1 -0
- package/lib/tools/ToolRunner.d.mts +132 -0
- package/lib/tools/ToolRunner.d.mts.map +1 -0
- package/lib/tools/ToolRunner.d.ts +132 -0
- package/lib/tools/ToolRunner.d.ts.map +1 -0
- package/lib/tools/ToolRunner.js +294 -0
- package/lib/tools/ToolRunner.js.map +1 -0
- package/lib/tools/ToolRunner.mjs +290 -0
- package/lib/tools/ToolRunner.mjs.map +1 -0
- package/lib/transform-json-schema.d.mts +3 -0
- package/lib/transform-json-schema.d.mts.map +1 -0
- package/lib/transform-json-schema.d.ts +3 -0
- package/lib/transform-json-schema.d.ts.map +1 -0
- package/lib/transform-json-schema.js +114 -0
- package/lib/transform-json-schema.js.map +1 -0
- package/lib/transform-json-schema.mjs +111 -0
- package/lib/transform-json-schema.mjs.map +1 -0
- package/package.json +246 -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/beta/beta.d.mts +66 -0
- package/resources/beta/beta.d.mts.map +1 -0
- package/resources/beta/beta.d.ts +66 -0
- package/resources/beta/beta.d.ts.map +1 -0
- package/resources/beta/beta.js +29 -0
- package/resources/beta/beta.js.map +1 -0
- package/resources/beta/beta.mjs +24 -0
- package/resources/beta/beta.mjs.map +1 -0
- package/resources/beta/files.d.mts +151 -0
- package/resources/beta/files.d.mts.map +1 -0
- package/resources/beta/files.d.ts +151 -0
- package/resources/beta/files.d.ts.map +1 -0
- package/resources/beta/files.js +124 -0
- package/resources/beta/files.js.map +1 -0
- package/resources/beta/files.mjs +120 -0
- package/resources/beta/files.mjs.map +1 -0
- package/resources/beta/index.d.mts +6 -0
- package/resources/beta/index.d.mts.map +1 -0
- package/resources/beta/index.d.ts +6 -0
- package/resources/beta/index.d.ts.map +1 -0
- package/resources/beta/index.js +15 -0
- package/resources/beta/index.js.map +1 -0
- package/resources/beta/index.mjs +7 -0
- package/resources/beta/index.mjs.map +1 -0
- package/resources/beta/messages/batches.d.mts +646 -0
- package/resources/beta/messages/batches.d.mts.map +1 -0
- package/resources/beta/messages/batches.d.ts +646 -0
- package/resources/beta/messages/batches.d.ts.map +1 -0
- package/resources/beta/messages/batches.js +204 -0
- package/resources/beta/messages/batches.js.map +1 -0
- package/resources/beta/messages/batches.mjs +200 -0
- package/resources/beta/messages/batches.mjs.map +1 -0
- package/resources/beta/messages/index.d.mts +4 -0
- package/resources/beta/messages/index.d.mts.map +1 -0
- package/resources/beta/messages/index.d.ts +4 -0
- package/resources/beta/messages/index.d.ts.map +1 -0
- package/resources/beta/messages/index.js +12 -0
- package/resources/beta/messages/index.js.map +1 -0
- package/resources/beta/messages/index.mjs +5 -0
- package/resources/beta/messages/index.mjs.map +1 -0
- package/resources/beta/messages/messages.d.mts +2993 -0
- package/resources/beta/messages/messages.d.mts.map +1 -0
- package/resources/beta/messages/messages.d.ts +2993 -0
- package/resources/beta/messages/messages.d.ts.map +1 -0
- package/resources/beta/messages/messages.js +163 -0
- package/resources/beta/messages/messages.js.map +1 -0
- package/resources/beta/messages/messages.mjs +156 -0
- package/resources/beta/messages/messages.mjs.map +1 -0
- package/resources/beta/messages.d.mts +2 -0
- package/resources/beta/messages.d.mts.map +1 -0
- package/resources/beta/messages.d.ts +2 -0
- package/resources/beta/messages.d.ts.map +1 -0
- package/resources/beta/messages.js +6 -0
- package/resources/beta/messages.js.map +1 -0
- package/resources/beta/messages.mjs +3 -0
- package/resources/beta/messages.mjs.map +1 -0
- package/resources/beta/models.d.mts +208 -0
- package/resources/beta/models.d.mts.map +1 -0
- package/resources/beta/models.d.ts +208 -0
- package/resources/beta/models.d.ts.map +1 -0
- package/resources/beta/models.js +60 -0
- package/resources/beta/models.js.map +1 -0
- package/resources/beta/models.mjs +56 -0
- package/resources/beta/models.mjs.map +1 -0
- package/resources/beta/skills/index.d.mts +3 -0
- package/resources/beta/skills/index.d.mts.map +1 -0
- package/resources/beta/skills/index.d.ts +3 -0
- package/resources/beta/skills/index.d.ts.map +1 -0
- package/resources/beta/skills/index.js +9 -0
- package/resources/beta/skills/index.js.map +1 -0
- package/resources/beta/skills/index.mjs +4 -0
- package/resources/beta/skills/index.mjs.map +1 -0
- package/resources/beta/skills/skills.d.mts +249 -0
- package/resources/beta/skills/skills.d.mts.map +1 -0
- package/resources/beta/skills/skills.d.ts +249 -0
- package/resources/beta/skills/skills.d.ts.map +1 -0
- package/resources/beta/skills/skills.js +98 -0
- package/resources/beta/skills/skills.js.map +1 -0
- package/resources/beta/skills/skills.mjs +93 -0
- package/resources/beta/skills/skills.mjs.map +1 -0
- package/resources/beta/skills/versions.d.mts +257 -0
- package/resources/beta/skills/versions.d.mts.map +1 -0
- package/resources/beta/skills/versions.d.ts +257 -0
- package/resources/beta/skills/versions.d.ts.map +1 -0
- package/resources/beta/skills/versions.js +100 -0
- package/resources/beta/skills/versions.js.map +1 -0
- package/resources/beta/skills/versions.mjs +96 -0
- package/resources/beta/skills/versions.mjs.map +1 -0
- package/resources/beta/skills.d.mts +2 -0
- package/resources/beta/skills.d.mts.map +1 -0
- package/resources/beta/skills.d.ts +2 -0
- package/resources/beta/skills.d.ts.map +1 -0
- package/resources/beta/skills.js +6 -0
- package/resources/beta/skills.js.map +1 -0
- package/resources/beta/skills.mjs +3 -0
- package/resources/beta/skills.mjs.map +1 -0
- package/resources/beta.d.mts +2 -0
- package/resources/beta.d.mts.map +1 -0
- package/resources/beta.d.ts +2 -0
- package/resources/beta.d.ts.map +1 -0
- package/resources/beta.js +6 -0
- package/resources/beta.js.map +1 -0
- package/resources/beta.mjs +3 -0
- package/resources/beta.mjs.map +1 -0
- package/resources/completions.d.mts +182 -0
- package/resources/completions.d.mts.map +1 -0
- package/resources/completions.d.ts +182 -0
- package/resources/completions.d.ts.map +1 -0
- package/resources/completions.js +23 -0
- package/resources/completions.js.map +1 -0
- package/resources/completions.mjs +19 -0
- package/resources/completions.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/messages/batches.d.mts +304 -0
- package/resources/messages/batches.d.mts.map +1 -0
- package/resources/messages/batches.d.ts +304 -0
- package/resources/messages/batches.d.ts.map +1 -0
- package/resources/messages/batches.js +153 -0
- package/resources/messages/batches.js.map +1 -0
- package/resources/messages/batches.mjs +149 -0
- package/resources/messages/batches.mjs.map +1 -0
- package/resources/messages/index.d.mts +3 -0
- package/resources/messages/index.d.mts.map +1 -0
- package/resources/messages/index.d.ts +3 -0
- package/resources/messages/index.d.ts.map +1 -0
- package/resources/messages/index.js +9 -0
- package/resources/messages/index.js.map +1 -0
- package/resources/messages/index.mjs +4 -0
- package/resources/messages/index.mjs.map +1 -0
- package/resources/messages/messages.d.mts +2285 -0
- package/resources/messages/messages.d.mts.map +1 -0
- package/resources/messages/messages.d.ts +2285 -0
- package/resources/messages/messages.d.ts.map +1 -0
- package/resources/messages/messages.js +128 -0
- package/resources/messages/messages.js.map +1 -0
- package/resources/messages/messages.mjs +123 -0
- package/resources/messages/messages.mjs.map +1 -0
- package/resources/messages.d.mts +2 -0
- package/resources/messages.d.mts.map +1 -0
- package/resources/messages.d.ts +2 -0
- package/resources/messages.d.ts.map +1 -0
- package/resources/messages.js +6 -0
- package/resources/messages.js.map +1 -0
- package/resources/messages.mjs +3 -0
- package/resources/messages.mjs.map +1 -0
- package/resources/models.d.mts +193 -0
- package/resources/models.d.mts.map +1 -0
- package/resources/models.d.ts +193 -0
- package/resources/models.d.ts.map +1 -0
- package/resources/models.js +45 -0
- package/resources/models.js.map +1 -0
- package/resources/models.mjs +41 -0
- package/resources/models.mjs.map +1 -0
- package/resources/shared.d.mts +44 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +44 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/top-level.d.mts +2 -0
- package/resources/top-level.d.mts.map +1 -0
- package/resources/top-level.d.ts +2 -0
- package/resources/top-level.d.ts.map +1 -0
- package/resources/top-level.js +4 -0
- package/resources/top-level.js.map +1 -0
- package/resources/top-level.mjs +3 -0
- package/resources/top-level.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/_vendor/partial-json-parser/README.md +3 -0
- package/src/_vendor/partial-json-parser/parser.ts +264 -0
- package/src/ainative.ts +85 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +1326 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +101 -0
- package/src/core/error.ts +145 -0
- package/src/core/pagination.ts +331 -0
- package/src/core/resource.ts +11 -0
- package/src/core/streaming.ts +348 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/helpers/beta/json-schema.ts +75 -0
- package/src/helpers/beta/mcp.ts +624 -0
- package/src/helpers/beta/memory.ts +28 -0
- package/src/helpers/beta/zod.ts +72 -0
- package/src/helpers/index.ts +2 -0
- package/src/helpers/json-schema.ts +48 -0
- package/src/helpers/zod.ts +58 -0
- package/src/index.ts +40 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/constants.ts +15 -0
- package/src/internal/decoders/jsonl.ts +48 -0
- package/src/internal/decoders/line.ts +135 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +99 -0
- package/src/internal/parse.ts +90 -0
- package/src/internal/request-options.ts +93 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/stream-utils.ts +32 -0
- package/src/internal/to-file.ts +159 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +204 -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 +23 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +112 -0
- package/src/internal/utils.ts +9 -0
- package/src/lib/.keep +4 -0
- package/src/lib/BetaMessageStream.ts +764 -0
- package/src/lib/MessageStream.ts +743 -0
- package/src/lib/beta-parser.ts +148 -0
- package/src/lib/parser.ts +125 -0
- package/src/lib/stainless-helper-header.ts +80 -0
- package/src/lib/tools/BetaRunnableTool.ts +40 -0
- package/src/lib/tools/BetaToolRunner.ts +494 -0
- package/src/lib/tools/CompactionControl.ts +57 -0
- package/src/lib/tools/ToolError.ts +47 -0
- package/src/lib/tools/ToolRunner.ts +381 -0
- package/src/lib/transform-json-schema.ts +124 -0
- package/src/pagination.ts +2 -0
- package/src/resource.ts +2 -0
- package/src/resources/beta/beta.ts +603 -0
- package/src/resources/beta/files.ts +261 -0
- package/src/resources/beta/index.ts +259 -0
- package/src/resources/beta/messages/batches.ts +827 -0
- package/src/resources/beta/messages/index.ts +229 -0
- package/src/resources/beta/messages/messages.ts +4372 -0
- package/src/resources/beta/messages.ts +3 -0
- package/src/resources/beta/models.ts +284 -0
- package/src/resources/beta/skills/index.ts +26 -0
- package/src/resources/beta/skills/skills.ts +384 -0
- package/src/resources/beta/skills/versions.ts +374 -0
- package/src/resources/beta/skills.ts +3 -0
- package/src/resources/beta.ts +3 -0
- package/src/resources/completions.ts +230 -0
- package/src/resources/index.ts +206 -0
- package/src/resources/messages/batches.ts +396 -0
- package/src/resources/messages/index.ts +189 -0
- package/src/resources/messages/messages.ts +3361 -0
- package/src/resources/messages.ts +3 -0
- package/src/resources/models.ts +269 -0
- package/src/resources/shared.ts +85 -0
- package/src/resources/top-level.ts +3 -0
- package/src/resources.ts +1 -0
- package/src/streaming.ts +2 -0
- package/src/tools/memory/node.ts +392 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/streaming.d.mts +2 -0
- package/streaming.d.mts.map +1 -0
- package/streaming.d.ts +2 -0
- package/streaming.d.ts.map +1 -0
- package/streaming.js +6 -0
- package/streaming.js.map +1 -0
- package/streaming.mjs +2 -0
- package/streaming.mjs.map +1 -0
- package/tools/memory/node.d.mts +18 -0
- package/tools/memory/node.d.mts.map +1 -0
- package/tools/memory/node.d.ts +18 -0
- package/tools/memory/node.d.ts.map +1 -0
- package/tools/memory/node.js +324 -0
- package/tools/memory/node.js.map +1 -0
- package/tools/memory/node.mjs +318 -0
- package/tools/memory/node.mjs.map +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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { transformJSONSchema } from "../..//lib/transform-json-schema.mjs";
|
|
2
|
+
import * as z from 'zod/v4';
|
|
3
|
+
import { AnthropicError } from "../../core/error.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a JSON schema output format object from the given Zod schema.
|
|
6
|
+
*
|
|
7
|
+
* If this is passed to the `.parse()` method then the response message will contain a
|
|
8
|
+
* `.parsed_output` property that is the result of parsing the content with the given Zod object.
|
|
9
|
+
*
|
|
10
|
+
* This can be passed directly to the `.create()` method but will not
|
|
11
|
+
* result in any automatic parsing, you'll have to parse the response yourself.
|
|
12
|
+
*/
|
|
13
|
+
export function betaZodOutputFormat(zodObject) {
|
|
14
|
+
let jsonSchema = z.toJSONSchema(zodObject, { reused: 'ref' });
|
|
15
|
+
jsonSchema = transformJSONSchema(jsonSchema);
|
|
16
|
+
return {
|
|
17
|
+
type: 'json_schema',
|
|
18
|
+
schema: {
|
|
19
|
+
...jsonSchema,
|
|
20
|
+
},
|
|
21
|
+
parse: (content) => {
|
|
22
|
+
const output = zodObject.safeParse(JSON.parse(content));
|
|
23
|
+
if (!output.success) {
|
|
24
|
+
throw new AnthropicError(`Failed to parse structured output: ${output.error.message} cause: ${output.error.issues}`);
|
|
25
|
+
}
|
|
26
|
+
return output.data;
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Creates a tool using the provided Zod schema that can be passed
|
|
32
|
+
* into the `.toolRunner()` method. The Zod schema will automatically be
|
|
33
|
+
* converted into JSON Schema when passed to the API. The provided function's
|
|
34
|
+
* input arguments will also be validated against the provided schema.
|
|
35
|
+
*/
|
|
36
|
+
export function betaZodTool(options) {
|
|
37
|
+
const jsonSchema = z.toJSONSchema(options.inputSchema, { reused: 'ref' });
|
|
38
|
+
if (jsonSchema.type !== 'object') {
|
|
39
|
+
throw new Error(`Zod schema for tool "${options.name}" must be an object, but got ${jsonSchema.type}`);
|
|
40
|
+
}
|
|
41
|
+
// TypeScript doesn't narrow the type after the runtime check, so we need to assert it
|
|
42
|
+
const objectSchema = jsonSchema;
|
|
43
|
+
return {
|
|
44
|
+
type: 'custom',
|
|
45
|
+
name: options.name,
|
|
46
|
+
input_schema: objectSchema,
|
|
47
|
+
description: options.description,
|
|
48
|
+
run: options.run,
|
|
49
|
+
parse: (args) => options.inputSchema.parse(args),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=zod.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.mjs","sourceRoot":"","sources":["../../src/helpers/beta/zod.ts"],"names":[],"mappings":"OAAO,EAAE,mBAAmB,EAAE;OAEvB,KAAK,CAAC,MAAM,QAAQ;OACpB,EAAE,cAAc,EAAE;AAIzB;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAAmB;IAEnB,IAAI,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAE9D,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAE7C,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE;YACN,GAAG,UAAU;SACd;QACD,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE;YACjB,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YAExD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,IAAI,cAAc,CACtB,sCAAsC,MAAM,CAAC,KAAK,CAAC,OAAO,WAAW,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAC3F,CAAC;YACJ,CAAC;YAED,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAA8B,OAKxD;IACC,MAAM,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAE1E,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,CAAC,IAAI,gCAAgC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IACzG,CAAC;IAED,sFAAsF;IACtF,MAAM,YAAY,GAAG,UAAoD,CAAC;IAE1E,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,YAAY,EAAE,YAAY;QAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,KAAK,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAA0B;KACnF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/helpers/index.ts"],"names":[],"mappings":"OAAO,EAAE,sBAAsB,EAAE;OAC1B,EAAE,eAAe,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/helpers/index.ts"],"names":[],"mappings":"OAAO,EAAE,sBAAsB,EAAE;OAC1B,EAAE,eAAe,EAAE"}
|
package/helpers/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.zodOutputFormat = exports.jsonSchemaOutputFormat = void 0;
|
|
4
|
+
var json_schema_1 = require("./json-schema.js");
|
|
5
|
+
Object.defineProperty(exports, "jsonSchemaOutputFormat", { enumerable: true, get: function () { return json_schema_1.jsonSchemaOutputFormat; } });
|
|
6
|
+
var zod_1 = require("./zod.js");
|
|
7
|
+
Object.defineProperty(exports, "zodOutputFormat", { enumerable: true, get: function () { return zod_1.zodOutputFormat; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/helpers/index.ts"],"names":[],"mappings":";;;AAAA,gDAAuD;AAA9C,qHAAA,sBAAsB,OAAA;AAC/B,gCAAwC;AAA/B,sGAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/helpers/index.ts"],"names":[],"mappings":"OAAO,EAAE,sBAAsB,EAAE;OAC1B,EAAE,eAAe,EAAE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|
2
|
+
import { AutoParseableOutputFormat } from "../lib/parser.mjs";
|
|
3
|
+
type NoInfer<T> = T extends infer R ? R : never;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a JSON schema output format object from the given JSON schema.
|
|
6
|
+
* If this is passed to the `.parse()` method then the response message will contain a
|
|
7
|
+
* `.parsed_output` property that is the result of parsing the content with the given JSON schema.
|
|
8
|
+
*
|
|
9
|
+
* Note: When `transform` is enabled (the default), the schema is deep-cloned before transformation,
|
|
10
|
+
* so the original schema object is not modified.
|
|
11
|
+
*/
|
|
12
|
+
export declare function jsonSchemaOutputFormat<const Schema extends Exclude<JSONSchema, boolean> & {
|
|
13
|
+
type: 'object';
|
|
14
|
+
}>(jsonSchema: Schema, options?: {
|
|
15
|
+
transform?: boolean;
|
|
16
|
+
}): AutoParseableOutputFormat<NoInfer<FromSchema<Schema>>>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=json-schema.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema.d.mts","sourceRoot":"","sources":["../src/helpers/json-schema.ts"],"names":[],"mappings":"OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB;OACnD,EAAE,yBAAyB,EAAE;AAIpC,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEhD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,CAAC,MAAM,SAAS,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,EAEtE,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACA,yBAAyB,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAyBxD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|
2
|
+
import { AutoParseableOutputFormat } from "../lib/parser.js";
|
|
3
|
+
type NoInfer<T> = T extends infer R ? R : never;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a JSON schema output format object from the given JSON schema.
|
|
6
|
+
* If this is passed to the `.parse()` method then the response message will contain a
|
|
7
|
+
* `.parsed_output` property that is the result of parsing the content with the given JSON schema.
|
|
8
|
+
*
|
|
9
|
+
* Note: When `transform` is enabled (the default), the schema is deep-cloned before transformation,
|
|
10
|
+
* so the original schema object is not modified.
|
|
11
|
+
*/
|
|
12
|
+
export declare function jsonSchemaOutputFormat<const Schema extends Exclude<JSONSchema, boolean> & {
|
|
13
|
+
type: 'object';
|
|
14
|
+
}>(jsonSchema: Schema, options?: {
|
|
15
|
+
transform?: boolean;
|
|
16
|
+
}): AutoParseableOutputFormat<NoInfer<FromSchema<Schema>>>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=json-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../src/helpers/json-schema.ts"],"names":[],"mappings":"OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB;OACnD,EAAE,yBAAyB,EAAE;AAIpC,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEhD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,CAAC,MAAM,SAAS,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,EAEtE,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACA,yBAAyB,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAyBxD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonSchemaOutputFormat = jsonSchemaOutputFormat;
|
|
4
|
+
const error_1 = require("../core/error.js");
|
|
5
|
+
const transform_json_schema_1 = require("../lib/transform-json-schema.js");
|
|
6
|
+
/**
|
|
7
|
+
* Creates a JSON schema output format object from the given JSON schema.
|
|
8
|
+
* If this is passed to the `.parse()` method then the response message will contain a
|
|
9
|
+
* `.parsed_output` property that is the result of parsing the content with the given JSON schema.
|
|
10
|
+
*
|
|
11
|
+
* Note: When `transform` is enabled (the default), the schema is deep-cloned before transformation,
|
|
12
|
+
* so the original schema object is not modified.
|
|
13
|
+
*/
|
|
14
|
+
function jsonSchemaOutputFormat(jsonSchema, options) {
|
|
15
|
+
if (jsonSchema.type !== 'object') {
|
|
16
|
+
throw new Error(`JSON schema must be an object, but got ${jsonSchema.type}`);
|
|
17
|
+
}
|
|
18
|
+
const transform = options?.transform ?? true;
|
|
19
|
+
if (transform) {
|
|
20
|
+
jsonSchema = (0, transform_json_schema_1.transformJSONSchema)(jsonSchema);
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
type: 'json_schema',
|
|
24
|
+
schema: {
|
|
25
|
+
...jsonSchema,
|
|
26
|
+
},
|
|
27
|
+
parse: (content) => {
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(content);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
throw new error_1.AnthropicError(`Failed to parse structured output: ${error instanceof Error ? error.message : String(error)}`);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=json-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../src/helpers/json-schema.ts"],"names":[],"mappings":";;AAeA,wDAgCC;AA7CD,4CAA+C;AAC/C,2EAAmE;AAInE;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAGpC,UAAkB,EAClB,OAEC;IAED,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,0CAA0C,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,IAAI,CAAC;IAC7C,IAAI,SAAS,EAAE,CAAC;QACd,UAAU,GAAG,IAAA,2CAAmB,EAAC,UAAU,CAAW,CAAC;IACzD,CAAC;IAED,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE;YACN,GAAG,UAAU;SACd;QACD,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE;YACjB,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,sBAAc,CACtB,sCAAsC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC/F,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AnthropicError } from "../core/error.mjs";
|
|
2
|
+
import { transformJSONSchema } from "../lib/transform-json-schema.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a JSON schema output format object from the given JSON schema.
|
|
5
|
+
* If this is passed to the `.parse()` method then the response message will contain a
|
|
6
|
+
* `.parsed_output` property that is the result of parsing the content with the given JSON schema.
|
|
7
|
+
*
|
|
8
|
+
* Note: When `transform` is enabled (the default), the schema is deep-cloned before transformation,
|
|
9
|
+
* so the original schema object is not modified.
|
|
10
|
+
*/
|
|
11
|
+
export function jsonSchemaOutputFormat(jsonSchema, options) {
|
|
12
|
+
if (jsonSchema.type !== 'object') {
|
|
13
|
+
throw new Error(`JSON schema must be an object, but got ${jsonSchema.type}`);
|
|
14
|
+
}
|
|
15
|
+
const transform = options?.transform ?? true;
|
|
16
|
+
if (transform) {
|
|
17
|
+
jsonSchema = transformJSONSchema(jsonSchema);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
type: 'json_schema',
|
|
21
|
+
schema: {
|
|
22
|
+
...jsonSchema,
|
|
23
|
+
},
|
|
24
|
+
parse: (content) => {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(content);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw new AnthropicError(`Failed to parse structured output: ${error instanceof Error ? error.message : String(error)}`);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=json-schema.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema.mjs","sourceRoot":"","sources":["../src/helpers/json-schema.ts"],"names":[],"mappings":"OAEO,EAAE,cAAc,EAAE;OAClB,EAAE,mBAAmB,EAAE;AAI9B;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAGpC,UAAkB,EAClB,OAEC;IAED,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,0CAA0C,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,IAAI,CAAC;IAC7C,IAAI,SAAS,EAAE,CAAC;QACd,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAW,CAAC;IACzD,CAAC;IAED,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE;YACN,GAAG,UAAU;SACd;QACD,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE;YACjB,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,cAAc,CACtB,sCAAsC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC/F,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { infer as zodInfer, ZodType } from 'zod';
|
|
2
|
+
import { AutoParseableOutputFormat } from "../lib/parser.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a JSON schema output format object from the given Zod schema.
|
|
5
|
+
*
|
|
6
|
+
* If this is passed to the `.parse()` method then the response message will contain a
|
|
7
|
+
* `.parsed_output` property that is the result of parsing the content with the given Zod object.
|
|
8
|
+
*
|
|
9
|
+
* This can be passed directly to the `.create()` method but will not
|
|
10
|
+
* result in any automatic parsing, you'll have to parse the response yourself.
|
|
11
|
+
*/
|
|
12
|
+
export declare function zodOutputFormat<ZodInput extends ZodType>(zodObject: ZodInput): AutoParseableOutputFormat<zodInfer<ZodInput>>;
|
|
13
|
+
//# sourceMappingURL=zod.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.d.mts","sourceRoot":"","sources":["../src/helpers/zod.ts"],"names":[],"mappings":"OACO,KAAK,EAAE,KAAK,IAAI,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK;OAG9C,EAAE,yBAAyB,EAAE;AAEpC;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,OAAO,EACtD,SAAS,EAAE,QAAQ,GAClB,yBAAyB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAwC/C"}
|
package/helpers/zod.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { infer as zodInfer, ZodType } from 'zod';
|
|
2
|
+
import { AutoParseableOutputFormat } from "../lib/parser.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a JSON schema output format object from the given Zod schema.
|
|
5
|
+
*
|
|
6
|
+
* If this is passed to the `.parse()` method then the response message will contain a
|
|
7
|
+
* `.parsed_output` property that is the result of parsing the content with the given Zod object.
|
|
8
|
+
*
|
|
9
|
+
* This can be passed directly to the `.create()` method but will not
|
|
10
|
+
* result in any automatic parsing, you'll have to parse the response yourself.
|
|
11
|
+
*/
|
|
12
|
+
export declare function zodOutputFormat<ZodInput extends ZodType>(zodObject: ZodInput): AutoParseableOutputFormat<zodInfer<ZodInput>>;
|
|
13
|
+
//# sourceMappingURL=zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../src/helpers/zod.ts"],"names":[],"mappings":"OACO,KAAK,EAAE,KAAK,IAAI,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK;OAG9C,EAAE,yBAAyB,EAAE;AAEpC;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,OAAO,EACtD,SAAS,EAAE,QAAQ,GAClB,yBAAyB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAwC/C"}
|
package/helpers/zod.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.zodOutputFormat = zodOutputFormat;
|
|
4
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
const transform_json_schema_1 = require("../lib/transform-json-schema.js");
|
|
6
|
+
const z = tslib_1.__importStar(require("zod/v4"));
|
|
7
|
+
const error_1 = require("../core/error.js");
|
|
8
|
+
/**
|
|
9
|
+
* Creates a JSON schema output format object from the given Zod schema.
|
|
10
|
+
*
|
|
11
|
+
* If this is passed to the `.parse()` method then the response message will contain a
|
|
12
|
+
* `.parsed_output` property that is the result of parsing the content with the given Zod object.
|
|
13
|
+
*
|
|
14
|
+
* This can be passed directly to the `.create()` method but will not
|
|
15
|
+
* result in any automatic parsing, you'll have to parse the response yourself.
|
|
16
|
+
*/
|
|
17
|
+
function zodOutputFormat(zodObject) {
|
|
18
|
+
let jsonSchema = z.toJSONSchema(zodObject, { reused: 'ref' });
|
|
19
|
+
jsonSchema = (0, transform_json_schema_1.transformJSONSchema)(jsonSchema);
|
|
20
|
+
return {
|
|
21
|
+
type: 'json_schema',
|
|
22
|
+
schema: {
|
|
23
|
+
...jsonSchema,
|
|
24
|
+
},
|
|
25
|
+
parse: (content) => {
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = JSON.parse(content);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
throw new error_1.AnthropicError(`Failed to parse structured output as JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
32
|
+
}
|
|
33
|
+
const output = zodObject.safeParse(parsed);
|
|
34
|
+
if (!output.success) {
|
|
35
|
+
const formattedIssues = output.error.issues
|
|
36
|
+
.slice(0, 5)
|
|
37
|
+
.map((issue) => ` - ${issue.path.join('.')}: ${issue.message}`)
|
|
38
|
+
.join('\n');
|
|
39
|
+
const issueCount = output.error.issues.length;
|
|
40
|
+
const suffix = issueCount > 5 ? `\n ... and ${issueCount - 5} more issue(s)` : '';
|
|
41
|
+
throw new error_1.AnthropicError(`Failed to parse structured output: ${output.error.message}\nValidation issues:\n${formattedIssues}${suffix}`);
|
|
42
|
+
}
|
|
43
|
+
return output.data;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=zod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.js","sourceRoot":"","sources":["../src/helpers/zod.ts"],"names":[],"mappings":";;AAeA,0CA0CC;;AAzDD,2EAAmE;AAEnE,kDAA4B;AAC5B,4CAA+C;AAG/C;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAC7B,SAAmB;IAEnB,IAAI,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAE9D,UAAU,GAAG,IAAA,2CAAmB,EAAC,UAAU,CAAC,CAAC;IAE7C,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE;YACN,GAAG,UAAU;SACd;QACD,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE;YACjB,IAAI,MAAe,CAAC;YACpB,IAAI,CAAC;gBACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,sBAAc,CACtB,8CACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAE3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;qBACxC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;qBACX,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;qBAC/D,IAAI,CAAC,IAAI,CAAC,CAAC;gBACd,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC9C,MAAM,MAAM,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe,UAAU,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;gBAEnF,MAAM,IAAI,sBAAc,CACtB,sCAAsC,MAAM,CAAC,KAAK,CAAC,OAAO,yBAAyB,eAAe,GAAG,MAAM,EAAE,CAC9G,CAAC;YACJ,CAAC;YAED,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/helpers/zod.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { transformJSONSchema } from "../lib/transform-json-schema.mjs";
|
|
2
|
+
import * as z from 'zod/v4';
|
|
3
|
+
import { AnthropicError } from "../core/error.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a JSON schema output format object from the given Zod schema.
|
|
6
|
+
*
|
|
7
|
+
* If this is passed to the `.parse()` method then the response message will contain a
|
|
8
|
+
* `.parsed_output` property that is the result of parsing the content with the given Zod object.
|
|
9
|
+
*
|
|
10
|
+
* This can be passed directly to the `.create()` method but will not
|
|
11
|
+
* result in any automatic parsing, you'll have to parse the response yourself.
|
|
12
|
+
*/
|
|
13
|
+
export function zodOutputFormat(zodObject) {
|
|
14
|
+
let jsonSchema = z.toJSONSchema(zodObject, { reused: 'ref' });
|
|
15
|
+
jsonSchema = transformJSONSchema(jsonSchema);
|
|
16
|
+
return {
|
|
17
|
+
type: 'json_schema',
|
|
18
|
+
schema: {
|
|
19
|
+
...jsonSchema,
|
|
20
|
+
},
|
|
21
|
+
parse: (content) => {
|
|
22
|
+
let parsed;
|
|
23
|
+
try {
|
|
24
|
+
parsed = JSON.parse(content);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new AnthropicError(`Failed to parse structured output as JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
28
|
+
}
|
|
29
|
+
const output = zodObject.safeParse(parsed);
|
|
30
|
+
if (!output.success) {
|
|
31
|
+
const formattedIssues = output.error.issues
|
|
32
|
+
.slice(0, 5)
|
|
33
|
+
.map((issue) => ` - ${issue.path.join('.')}: ${issue.message}`)
|
|
34
|
+
.join('\n');
|
|
35
|
+
const issueCount = output.error.issues.length;
|
|
36
|
+
const suffix = issueCount > 5 ? `\n ... and ${issueCount - 5} more issue(s)` : '';
|
|
37
|
+
throw new AnthropicError(`Failed to parse structured output: ${output.error.message}\nValidation issues:\n${formattedIssues}${suffix}`);
|
|
38
|
+
}
|
|
39
|
+
return output.data;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=zod.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.mjs","sourceRoot":"","sources":["../src/helpers/zod.ts"],"names":[],"mappings":"OAAO,EAAE,mBAAmB,EAAE;OAEvB,KAAK,CAAC,MAAM,QAAQ;OACpB,EAAE,cAAc,EAAE;AAGzB;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,SAAmB;IAEnB,IAAI,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAE9D,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAE7C,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE;YACN,GAAG,UAAU;SACd;QACD,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE;YACjB,IAAI,MAAe,CAAC;YACpB,IAAI,CAAC;gBACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,cAAc,CACtB,8CACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAE3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;qBACxC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;qBACX,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;qBAC/D,IAAI,CAAC,IAAI,CAAC,CAAC;gBACd,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC9C,MAAM,MAAM,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe,UAAU,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;gBAEnF,MAAM,IAAI,cAAc,CACtB,sCAAsC,MAAM,CAAC,KAAK,CAAC,OAAO,yBAAyB,eAAe,GAAG,MAAM,EAAE,CAC9G,CAAC;YACJ,CAAC;YAED,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/index.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Anthropic as default } from "./client.mjs";
|
|
2
|
+
export { isAINativeModel, isClaudeModel, getBaseURLForModel, getApiKeyForModel, createTrackedFetch, } from "./ainative.mjs";
|
|
3
|
+
export { type Uploadable, toFile } from "./core/uploads.mjs";
|
|
4
|
+
export { APIPromise } from "./core/api-promise.mjs";
|
|
5
|
+
export { BaseAnthropic, Anthropic, type ClientOptions, HUMAN_PROMPT, AI_PROMPT } from "./client.mjs";
|
|
6
|
+
export { PagePromise } from "./core/pagination.mjs";
|
|
7
|
+
export { AnthropicError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
8
|
+
export type { AutoParseableOutputFormat, ParsedMessage, ParsedContentBlock, ParseableMessageCreateParams, ExtractParsedContentFromParams, } from "./lib/parser.mjs";
|
|
9
|
+
//# sourceMappingURL=index.d.mts.map
|
package/index.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,SAAS,IAAI,OAAO,EAAE;OAGxB,EACL,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,GACnB;OAEM,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE;OACzE,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;YAEW,EACV,yBAAyB,EACzB,aAAa,EACb,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,GAC/B"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Anthropic as default } from "./client.js";
|
|
2
|
+
export { isAINativeModel, isClaudeModel, getBaseURLForModel, getApiKeyForModel, createTrackedFetch, } from "./ainative.js";
|
|
3
|
+
export { type Uploadable, toFile } from "./core/uploads.js";
|
|
4
|
+
export { APIPromise } from "./core/api-promise.js";
|
|
5
|
+
export { BaseAnthropic, Anthropic, type ClientOptions, HUMAN_PROMPT, AI_PROMPT } from "./client.js";
|
|
6
|
+
export { PagePromise } from "./core/pagination.js";
|
|
7
|
+
export { AnthropicError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.js";
|
|
8
|
+
export type { AutoParseableOutputFormat, ParsedMessage, ParsedContentBlock, ParseableMessageCreateParams, ExtractParsedContentFromParams, } from "./lib/parser.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,SAAS,IAAI,OAAO,EAAE;OAGxB,EACL,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,GACnB;OAEM,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE;OACzE,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;YAEW,EACV,yBAAyB,EACzB,aAAa,EACb,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,GAC/B"}
|
package/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
exports = module.exports = function (...args) {
|
|
4
|
+
return new exports.default(...args)
|
|
5
|
+
}
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.AnthropicError = exports.PagePromise = exports.AI_PROMPT = exports.HUMAN_PROMPT = exports.Anthropic = exports.BaseAnthropic = exports.APIPromise = exports.toFile = exports.createTrackedFetch = exports.getApiKeyForModel = exports.getBaseURLForModel = exports.isClaudeModel = exports.isAINativeModel = exports.default = void 0;
|
|
8
|
+
var client_1 = require("./client.js");
|
|
9
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.Anthropic; } });
|
|
10
|
+
// AINative Cody SDK extensions
|
|
11
|
+
var ainative_1 = require("./ainative.js");
|
|
12
|
+
Object.defineProperty(exports, "isAINativeModel", { enumerable: true, get: function () { return ainative_1.isAINativeModel; } });
|
|
13
|
+
Object.defineProperty(exports, "isClaudeModel", { enumerable: true, get: function () { return ainative_1.isClaudeModel; } });
|
|
14
|
+
Object.defineProperty(exports, "getBaseURLForModel", { enumerable: true, get: function () { return ainative_1.getBaseURLForModel; } });
|
|
15
|
+
Object.defineProperty(exports, "getApiKeyForModel", { enumerable: true, get: function () { return ainative_1.getApiKeyForModel; } });
|
|
16
|
+
Object.defineProperty(exports, "createTrackedFetch", { enumerable: true, get: function () { return ainative_1.createTrackedFetch; } });
|
|
17
|
+
var uploads_1 = require("./core/uploads.js");
|
|
18
|
+
Object.defineProperty(exports, "toFile", { enumerable: true, get: function () { return uploads_1.toFile; } });
|
|
19
|
+
var api_promise_1 = require("./core/api-promise.js");
|
|
20
|
+
Object.defineProperty(exports, "APIPromise", { enumerable: true, get: function () { return api_promise_1.APIPromise; } });
|
|
21
|
+
var client_2 = require("./client.js");
|
|
22
|
+
Object.defineProperty(exports, "BaseAnthropic", { enumerable: true, get: function () { return client_2.BaseAnthropic; } });
|
|
23
|
+
Object.defineProperty(exports, "Anthropic", { enumerable: true, get: function () { return client_2.Anthropic; } });
|
|
24
|
+
Object.defineProperty(exports, "HUMAN_PROMPT", { enumerable: true, get: function () { return client_2.HUMAN_PROMPT; } });
|
|
25
|
+
Object.defineProperty(exports, "AI_PROMPT", { enumerable: true, get: function () { return client_2.AI_PROMPT; } });
|
|
26
|
+
var pagination_1 = require("./core/pagination.js");
|
|
27
|
+
Object.defineProperty(exports, "PagePromise", { enumerable: true, get: function () { return pagination_1.PagePromise; } });
|
|
28
|
+
var error_1 = require("./core/error.js");
|
|
29
|
+
Object.defineProperty(exports, "AnthropicError", { enumerable: true, get: function () { return error_1.AnthropicError; } });
|
|
30
|
+
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
|
|
31
|
+
Object.defineProperty(exports, "APIConnectionError", { enumerable: true, get: function () { return error_1.APIConnectionError; } });
|
|
32
|
+
Object.defineProperty(exports, "APIConnectionTimeoutError", { enumerable: true, get: function () { return error_1.APIConnectionTimeoutError; } });
|
|
33
|
+
Object.defineProperty(exports, "APIUserAbortError", { enumerable: true, get: function () { return error_1.APIUserAbortError; } });
|
|
34
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return error_1.NotFoundError; } });
|
|
35
|
+
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return error_1.ConflictError; } });
|
|
36
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return error_1.RateLimitError; } });
|
|
37
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return error_1.BadRequestError; } });
|
|
38
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return error_1.AuthenticationError; } });
|
|
39
|
+
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
|
|
40
|
+
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return error_1.PermissionDeniedError; } });
|
|
41
|
+
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAAgD;AAAvC,iGAAA,SAAS,OAAW;AAE7B,+BAA+B;AAC/B,0CAMoB;AALlB,2GAAA,eAAe,OAAA;AACf,yGAAA,aAAa,OAAA;AACb,8GAAA,kBAAkB,OAAA;AAClB,6GAAA,iBAAiB,OAAA;AACjB,8GAAA,kBAAkB,OAAA;AAGpB,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAAiG;AAAxF,uGAAA,aAAa,OAAA;AAAE,mGAAA,SAAS,OAAA;AAAsB,sGAAA,YAAY,OAAA;AAAE,mGAAA,SAAS,OAAA;AAC9E,mDAAgD;AAAvC,yGAAA,WAAW,OAAA;AACpB,yCAcsB;AAbpB,uGAAA,cAAc,OAAA;AACd,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA"}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
export { Anthropic as default } from "./client.mjs";
|
|
3
|
+
export { isAINativeModel, isClaudeModel, getBaseURLForModel, getApiKeyForModel, createTrackedFetch, } from "./ainative.mjs";
|
|
4
|
+
export { toFile } from "./core/uploads.mjs";
|
|
5
|
+
export { APIPromise } from "./core/api-promise.mjs";
|
|
6
|
+
export { BaseAnthropic, Anthropic, HUMAN_PROMPT, AI_PROMPT } from "./client.mjs";
|
|
7
|
+
export { PagePromise } from "./core/pagination.mjs";
|
|
8
|
+
export { AnthropicError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,SAAS,IAAI,OAAO,EAAE;OAGxB,EACL,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,GACnB;OAEM,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE,SAAS,EAAsB,YAAY,EAAE,SAAS,EAAE;OACzE,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
2
|
+
/**
|
|
3
|
+
* An alias to the builtin `RequestInit` type so we can
|
|
4
|
+
* easily alias it in import statements if there are name clashes.
|
|
5
|
+
*
|
|
6
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit
|
|
7
|
+
*/
|
|
8
|
+
type _RequestInit = RequestInit;
|
|
9
|
+
/**
|
|
10
|
+
* An alias to the builtin `Response` type so we can
|
|
11
|
+
* easily alias it in import statements if there are name clashes.
|
|
12
|
+
*
|
|
13
|
+
* https://developer.mozilla.org/docs/Web/API/Response
|
|
14
|
+
*/
|
|
15
|
+
type _Response = Response;
|
|
16
|
+
/**
|
|
17
|
+
* The type for the first argument to `fetch`.
|
|
18
|
+
*
|
|
19
|
+
* https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
|
|
20
|
+
*/
|
|
21
|
+
type _RequestInfo = Request | URL | string;
|
|
22
|
+
/**
|
|
23
|
+
* The type for constructing `RequestInit` Headers.
|
|
24
|
+
*
|
|
25
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit#setting_headers
|
|
26
|
+
*/
|
|
27
|
+
type _HeadersInit = RequestInit['headers'];
|
|
28
|
+
/**
|
|
29
|
+
* The type for constructing `RequestInit` body.
|
|
30
|
+
*
|
|
31
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit#body
|
|
32
|
+
*/
|
|
33
|
+
type _BodyInit = RequestInit['body'];
|
|
34
|
+
/**
|
|
35
|
+
* An alias to the builtin `Array<T>` type so we can
|
|
36
|
+
* easily alias it in import statements if there are name clashes.
|
|
37
|
+
*/
|
|
38
|
+
type _Array<T> = Array<T>;
|
|
39
|
+
/**
|
|
40
|
+
* An alias to the builtin `Record<K, T>` type so we can
|
|
41
|
+
* easily alias it in import statements if there are name clashes.
|
|
42
|
+
*/
|
|
43
|
+
type _Record<K extends keyof any, T> = Record<K, T>;
|
|
44
|
+
export type { _Array as Array, _BodyInit as BodyInit, _HeadersInit as HeadersInit, _Record as Record, _RequestInfo as RequestInfo, _RequestInit as RequestInit, _Response as Response, };
|
|
45
|
+
/**
|
|
46
|
+
* A copy of the builtin `EndingType` type as it isn't fully supported in certain
|
|
47
|
+
* environments and attempting to reference the global version will error.
|
|
48
|
+
*
|
|
49
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L27941
|
|
50
|
+
*/
|
|
51
|
+
type EndingType = 'native' | 'transparent';
|
|
52
|
+
/**
|
|
53
|
+
* A copy of the builtin `BlobPropertyBag` type as it isn't fully supported in certain
|
|
54
|
+
* environments and attempting to reference the global version will error.
|
|
55
|
+
*
|
|
56
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L154
|
|
57
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#options
|
|
58
|
+
*/
|
|
59
|
+
export interface BlobPropertyBag {
|
|
60
|
+
endings?: EndingType;
|
|
61
|
+
type?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A copy of the builtin `FilePropertyBag` type as it isn't fully supported in certain
|
|
65
|
+
* environments and attempting to reference the global version will error.
|
|
66
|
+
*
|
|
67
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L503
|
|
68
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/File/File#options
|
|
69
|
+
*/
|
|
70
|
+
export interface FilePropertyBag extends BlobPropertyBag {
|
|
71
|
+
lastModified?: number;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=builtin-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-types.d.mts","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7F;;;;;GAKG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC;AAEhC;;;;;GAKG;AACH,KAAK,SAAS,GAAG,QAAQ,CAAC;AAE1B;;;;GAIG;AACH,KAAK,YAAY,GAAG,OAAO,GAAG,GAAG,GAAG,MAAM,CAAC;AAE3C;;;;GAIG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAE3C;;;;GAIG;AACH,KAAK,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAErC;;;GAGG;AACH,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1B;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpD,YAAY,EACV,MAAM,IAAI,KAAK,EACf,SAAS,IAAI,QAAQ,EACrB,YAAY,IAAI,WAAW,EAC3B,OAAO,IAAI,MAAM,EACjB,YAAY,IAAI,WAAW,EAC3B,YAAY,IAAI,WAAW,EAC3B,SAAS,IAAI,QAAQ,GACtB,CAAC;AAEF;;;;;GAKG;AACH,KAAK,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
2
|
+
/**
|
|
3
|
+
* An alias to the builtin `RequestInit` type so we can
|
|
4
|
+
* easily alias it in import statements if there are name clashes.
|
|
5
|
+
*
|
|
6
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit
|
|
7
|
+
*/
|
|
8
|
+
type _RequestInit = RequestInit;
|
|
9
|
+
/**
|
|
10
|
+
* An alias to the builtin `Response` type so we can
|
|
11
|
+
* easily alias it in import statements if there are name clashes.
|
|
12
|
+
*
|
|
13
|
+
* https://developer.mozilla.org/docs/Web/API/Response
|
|
14
|
+
*/
|
|
15
|
+
type _Response = Response;
|
|
16
|
+
/**
|
|
17
|
+
* The type for the first argument to `fetch`.
|
|
18
|
+
*
|
|
19
|
+
* https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
|
|
20
|
+
*/
|
|
21
|
+
type _RequestInfo = Request | URL | string;
|
|
22
|
+
/**
|
|
23
|
+
* The type for constructing `RequestInit` Headers.
|
|
24
|
+
*
|
|
25
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit#setting_headers
|
|
26
|
+
*/
|
|
27
|
+
type _HeadersInit = RequestInit['headers'];
|
|
28
|
+
/**
|
|
29
|
+
* The type for constructing `RequestInit` body.
|
|
30
|
+
*
|
|
31
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit#body
|
|
32
|
+
*/
|
|
33
|
+
type _BodyInit = RequestInit['body'];
|
|
34
|
+
/**
|
|
35
|
+
* An alias to the builtin `Array<T>` type so we can
|
|
36
|
+
* easily alias it in import statements if there are name clashes.
|
|
37
|
+
*/
|
|
38
|
+
type _Array<T> = Array<T>;
|
|
39
|
+
/**
|
|
40
|
+
* An alias to the builtin `Record<K, T>` type so we can
|
|
41
|
+
* easily alias it in import statements if there are name clashes.
|
|
42
|
+
*/
|
|
43
|
+
type _Record<K extends keyof any, T> = Record<K, T>;
|
|
44
|
+
export type { _Array as Array, _BodyInit as BodyInit, _HeadersInit as HeadersInit, _Record as Record, _RequestInfo as RequestInfo, _RequestInit as RequestInit, _Response as Response, };
|
|
45
|
+
/**
|
|
46
|
+
* A copy of the builtin `EndingType` type as it isn't fully supported in certain
|
|
47
|
+
* environments and attempting to reference the global version will error.
|
|
48
|
+
*
|
|
49
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L27941
|
|
50
|
+
*/
|
|
51
|
+
type EndingType = 'native' | 'transparent';
|
|
52
|
+
/**
|
|
53
|
+
* A copy of the builtin `BlobPropertyBag` type as it isn't fully supported in certain
|
|
54
|
+
* environments and attempting to reference the global version will error.
|
|
55
|
+
*
|
|
56
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L154
|
|
57
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#options
|
|
58
|
+
*/
|
|
59
|
+
export interface BlobPropertyBag {
|
|
60
|
+
endings?: EndingType;
|
|
61
|
+
type?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A copy of the builtin `FilePropertyBag` type as it isn't fully supported in certain
|
|
65
|
+
* environments and attempting to reference the global version will error.
|
|
66
|
+
*
|
|
67
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L503
|
|
68
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/File/File#options
|
|
69
|
+
*/
|
|
70
|
+
export interface FilePropertyBag extends BlobPropertyBag {
|
|
71
|
+
lastModified?: number;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=builtin-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-types.d.ts","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7F;;;;;GAKG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC;AAEhC;;;;;GAKG;AACH,KAAK,SAAS,GAAG,QAAQ,CAAC;AAE1B;;;;GAIG;AACH,KAAK,YAAY,GAAG,OAAO,GAAG,GAAG,GAAG,MAAM,CAAC;AAE3C;;;;GAIG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAE3C;;;;GAIG;AACH,KAAK,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAErC;;;GAGG;AACH,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1B;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpD,YAAY,EACV,MAAM,IAAI,KAAK,EACf,SAAS,IAAI,QAAQ,EACrB,YAAY,IAAI,WAAW,EAC3B,OAAO,IAAI,MAAM,EACjB,YAAY,IAAI,WAAW,EAC3B,YAAY,IAAI,WAAW,EAC3B,SAAS,IAAI,QAAQ,GACtB,CAAC;AAEF;;;;;GAKG;AACH,KAAK,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|