@anthropic-ai/aws-sdk 0.2.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 +15 -0
- package/LICENSE +8 -0
- package/README.md +0 -0
- package/client.d.mts +109 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +109 -0
- package/client.d.ts.map +1 -0
- package/client.js +158 -0
- package/client.js.map +1 -0
- package/client.mjs +120 -0
- package/client.mjs.map +1 -0
- package/core/auth.d.mts +15 -0
- package/core/auth.d.mts.map +1 -0
- package/core/auth.d.ts +15 -0
- package/core/auth.d.ts.map +1 -0
- package/core/auth.js +113 -0
- package/core/auth.js.map +1 -0
- package/core/auth.mjs +73 -0
- package/core/auth.mjs.map +1 -0
- package/core/error.d.mts +2 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +2 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +18 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +2 -0
- package/core/error.mjs.map +1 -0
- package/core/pagination.d.mts +2 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +2 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +18 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +2 -0
- package/core/pagination.mjs.map +1 -0
- package/core/streaming.d.mts +2 -0
- package/core/streaming.d.mts.map +1 -0
- package/core/streaming.d.ts +2 -0
- package/core/streaming.d.ts.map +1 -0
- package/core/streaming.js +18 -0
- package/core/streaming.js.map +1 -0
- package/core/streaming.mjs +2 -0
- package/core/streaming.mjs.map +1 -0
- package/index.d.mts +4 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -0
- package/index.js +25 -0
- package/index.js.map +1 -0
- package/index.mjs +3 -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 +123 -0
- package/internal/decoders/line.js.map +1 -0
- package/internal/decoders/line.mjs +118 -0
- package/internal/decoders/line.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/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 +25 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +9 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +87 -0
- package/src/client.ts +239 -0
- package/src/core/auth.ts +101 -0
- package/src/core/error.ts +1 -0
- package/src/core/pagination.ts +1 -0
- package/src/core/streaming.ts +1 -0
- package/src/index.ts +4 -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/tsconfig.json +11 -0
package/core/auth.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getAuthHeaders = void 0;
|
|
40
|
+
const sha256_js_1 = require("@aws-crypto/sha256-js");
|
|
41
|
+
const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
|
|
42
|
+
const protocol_http_1 = require("@smithy/protocol-http");
|
|
43
|
+
const signature_v4_1 = require("@smithy/signature-v4");
|
|
44
|
+
const assert_1 = __importDefault(require("assert"));
|
|
45
|
+
const defaultProviderChainResolver = (profile) => Promise.resolve().then(() => __importStar(require('@aws-sdk/credential-providers'))).then(({ fromNodeProviderChain }) => fromNodeProviderChain({
|
|
46
|
+
...(profile != null ? { profile } : {}),
|
|
47
|
+
clientConfig: {
|
|
48
|
+
requestHandler: new fetch_http_handler_1.FetchHttpHandler({
|
|
49
|
+
requestInit: (httpRequest) => {
|
|
50
|
+
return {
|
|
51
|
+
...httpRequest,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
}))
|
|
57
|
+
.catch((error) => {
|
|
58
|
+
throw new Error(`Failed to import '@aws-sdk/credential-providers'. ` +
|
|
59
|
+
`You can provide a custom \`providerChainResolver\` in the client options if your runtime does not have access to '@aws-sdk/credential-providers': ` +
|
|
60
|
+
`\`new AnthropicAws({ providerChainResolver })\` ` +
|
|
61
|
+
`Original error: ${error.message}`);
|
|
62
|
+
});
|
|
63
|
+
const getAuthHeaders = async (req, props) => {
|
|
64
|
+
(0, assert_1.default)(req.method, 'Expected request method property to be set');
|
|
65
|
+
let credentials;
|
|
66
|
+
if (props.awsAccessKey && props.awsSecretAccessKey) {
|
|
67
|
+
credentials = {
|
|
68
|
+
accessKeyId: props.awsAccessKey,
|
|
69
|
+
secretAccessKey: props.awsSecretAccessKey,
|
|
70
|
+
...(props.awsSessionToken != null && { sessionToken: props.awsSessionToken }),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
else if (props.providerChainResolver) {
|
|
74
|
+
const provider = await props.providerChainResolver();
|
|
75
|
+
credentials = await provider();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const provider = await defaultProviderChainResolver(props.awsProfile);
|
|
79
|
+
credentials = await provider();
|
|
80
|
+
}
|
|
81
|
+
const signer = new signature_v4_1.SignatureV4({
|
|
82
|
+
service: props.serviceName,
|
|
83
|
+
region: props.regionName,
|
|
84
|
+
credentials,
|
|
85
|
+
sha256: sha256_js_1.Sha256,
|
|
86
|
+
});
|
|
87
|
+
const url = new URL(props.url);
|
|
88
|
+
const headers = !req.headers ? {}
|
|
89
|
+
: Symbol.iterator in req.headers ?
|
|
90
|
+
Object.fromEntries(Array.from(req.headers).map((header) => [...header]))
|
|
91
|
+
: { ...req.headers };
|
|
92
|
+
// The connection header may be stripped by a proxy somewhere, so the receiver
|
|
93
|
+
// of this message may not see this header, so we remove it from the set of headers
|
|
94
|
+
// that are signed.
|
|
95
|
+
delete headers['connection'];
|
|
96
|
+
headers['host'] = url.hostname;
|
|
97
|
+
const query = {};
|
|
98
|
+
url.searchParams.forEach((value, key) => {
|
|
99
|
+
query[key] = value;
|
|
100
|
+
});
|
|
101
|
+
const request = new protocol_http_1.HttpRequest({
|
|
102
|
+
method: req.method.toUpperCase(),
|
|
103
|
+
protocol: url.protocol,
|
|
104
|
+
path: url.pathname,
|
|
105
|
+
query,
|
|
106
|
+
headers,
|
|
107
|
+
body: req.body,
|
|
108
|
+
});
|
|
109
|
+
const signed = await signer.sign(request);
|
|
110
|
+
return signed.headers;
|
|
111
|
+
};
|
|
112
|
+
exports.getAuthHeaders = getAuthHeaders;
|
|
113
|
+
//# sourceMappingURL=auth.js.map
|
package/core/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/core/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA+C;AAC/C,mEAA8D;AAC9D,yDAAoD;AACpD,uDAAmD;AAEnD,oDAA4B;AAe5B,MAAM,4BAA4B,GAAG,CAAC,OAAuB,EAA0C,EAAE,CACvG,kDAAO,+BAA+B,IACnC,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAClC,qBAAqB,CAAC;IACpB,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,YAAY,EAAE;QACZ,cAAc,EAAE,IAAI,qCAAgB,CAAC;YACnC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;gBAC3B,OAAO;oBACL,GAAG,WAAW;iBACA,CAAC;YACnB,CAAC;SACF,CAAC;KACH;CACF,CAAC,CACH;KACA,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACf,MAAM,IAAI,KAAK,CACb,oDAAoD;QAClD,oJAAoJ;QACpJ,kDAAkD;QAClD,mBAAmB,KAAK,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,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;YAC1E,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAEvB,8EAA8E;IAC9E,mFAAmF;IACnF,mBAAmB;IACnB,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7B,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC;IAE/B,MAAM,KAAK,GAA2B,EAAE,CAAC;IACzC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACtC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,IAAI,2BAAW,CAAC;QAC9B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE;QAChC,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,IAAI,EAAE,GAAG,CAAC,QAAQ;QAClB,KAAK;QACL,OAAO;QACP,IAAI,EAAE,GAAG,CAAC,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,OAAO,CAAC;AACxB,CAAC,CAAC;AAvDW,QAAA,cAAc,kBAuDzB"}
|
package/core/auth.mjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Sha256 } from '@aws-crypto/sha256-js';
|
|
2
|
+
import { FetchHttpHandler } from '@smithy/fetch-http-handler';
|
|
3
|
+
import { HttpRequest } from '@smithy/protocol-http';
|
|
4
|
+
import { SignatureV4 } from '@smithy/signature-v4';
|
|
5
|
+
import assert from 'assert';
|
|
6
|
+
const defaultProviderChainResolver = (profile) => import('@aws-sdk/credential-providers').then(({ fromNodeProviderChain }) => fromNodeProviderChain({
|
|
7
|
+
...(profile != null ? { profile } : {}),
|
|
8
|
+
clientConfig: {
|
|
9
|
+
requestHandler: new FetchHttpHandler({
|
|
10
|
+
requestInit: (httpRequest) => {
|
|
11
|
+
return {
|
|
12
|
+
...httpRequest,
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
}),
|
|
16
|
+
},
|
|
17
|
+
}))
|
|
18
|
+
.catch((error) => {
|
|
19
|
+
throw new Error(`Failed to import '@aws-sdk/credential-providers'. ` +
|
|
20
|
+
`You can provide a custom \`providerChainResolver\` in the client options if your runtime does not have access to '@aws-sdk/credential-providers': ` +
|
|
21
|
+
`\`new AnthropicAws({ providerChainResolver })\` ` +
|
|
22
|
+
`Original error: ${error.message}`);
|
|
23
|
+
});
|
|
24
|
+
export const getAuthHeaders = async (req, props) => {
|
|
25
|
+
assert(req.method, 'Expected request method property to be set');
|
|
26
|
+
let credentials;
|
|
27
|
+
if (props.awsAccessKey && props.awsSecretAccessKey) {
|
|
28
|
+
credentials = {
|
|
29
|
+
accessKeyId: props.awsAccessKey,
|
|
30
|
+
secretAccessKey: props.awsSecretAccessKey,
|
|
31
|
+
...(props.awsSessionToken != null && { sessionToken: props.awsSessionToken }),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
else if (props.providerChainResolver) {
|
|
35
|
+
const provider = await props.providerChainResolver();
|
|
36
|
+
credentials = await provider();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const provider = await defaultProviderChainResolver(props.awsProfile);
|
|
40
|
+
credentials = await provider();
|
|
41
|
+
}
|
|
42
|
+
const signer = new SignatureV4({
|
|
43
|
+
service: props.serviceName,
|
|
44
|
+
region: props.regionName,
|
|
45
|
+
credentials,
|
|
46
|
+
sha256: Sha256,
|
|
47
|
+
});
|
|
48
|
+
const url = new URL(props.url);
|
|
49
|
+
const headers = !req.headers ? {}
|
|
50
|
+
: Symbol.iterator in req.headers ?
|
|
51
|
+
Object.fromEntries(Array.from(req.headers).map((header) => [...header]))
|
|
52
|
+
: { ...req.headers };
|
|
53
|
+
// The connection header may be stripped by a proxy somewhere, so the receiver
|
|
54
|
+
// of this message may not see this header, so we remove it from the set of headers
|
|
55
|
+
// that are signed.
|
|
56
|
+
delete headers['connection'];
|
|
57
|
+
headers['host'] = url.hostname;
|
|
58
|
+
const query = {};
|
|
59
|
+
url.searchParams.forEach((value, key) => {
|
|
60
|
+
query[key] = value;
|
|
61
|
+
});
|
|
62
|
+
const request = new HttpRequest({
|
|
63
|
+
method: req.method.toUpperCase(),
|
|
64
|
+
protocol: url.protocol,
|
|
65
|
+
path: url.pathname,
|
|
66
|
+
query,
|
|
67
|
+
headers,
|
|
68
|
+
body: req.body,
|
|
69
|
+
});
|
|
70
|
+
const signed = await signer.sign(request);
|
|
71
|
+
return signed.headers;
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=auth.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.mjs","sourceRoot":"","sources":["../src/core/auth.ts"],"names":[],"mappings":"OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB;OACvC,EAAE,gBAAgB,EAAE,MAAM,4BAA4B;OACtD,EAAE,WAAW,EAAE,MAAM,uBAAuB;OAC5C,EAAE,WAAW,EAAE,MAAM,sBAAsB;OAE3C,MAAM,MAAM,QAAQ;AAe3B,MAAM,4BAA4B,GAAG,CAAC,OAAuB,EAA0C,EAAE,CACvG,MAAM,CAAC,+BAA+B,EACnC,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAClC,qBAAqB,CAAC;IACpB,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,YAAY,EAAE;QACZ,cAAc,EAAE,IAAI,gBAAgB,CAAC;YACnC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;gBAC3B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[],"mappings":"cAAc,8BAA8B"}
|
package/core/error.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/core/error.ts"],"names":[],"mappings":"cAAc,8BAA8B"}
|
package/core/error.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("@anthropic-ai/sdk/core/error"), exports);
|
|
18
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/core/error.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C"}
|
package/core/error.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.mjs","sourceRoot":"","sources":["../src/core/error.ts"],"names":[],"mappings":"cAAc,8BAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.mts","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":"cAAc,mCAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":"cAAc,mCAAmC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("@anthropic-ai/sdk/core/pagination"), exports);
|
|
18
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oEAAkD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.mjs","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":"cAAc,mCAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming.d.mts","sourceRoot":"","sources":["../src/core/streaming.ts"],"names":[],"mappings":"cAAc,kCAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../src/core/streaming.ts"],"names":[],"mappings":"cAAc,kCAAkC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("@anthropic-ai/sdk/core/streaming"), exports);
|
|
18
|
+
//# sourceMappingURL=streaming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming.js","sourceRoot":"","sources":["../src/core/streaming.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming.mjs","sourceRoot":"","sources":["../src/core/streaming.ts"],"names":[],"mappings":"cAAc,kCAAkC"}
|
package/index.d.mts
ADDED
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,YAAY,IAAI,OAAO,EAAE;YACtB,EAAE,gBAAgB,EAAE"}
|
package/index.d.ts
ADDED
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,YAAY,IAAI,OAAO,EAAE;YACtB,EAAE,gBAAgB,EAAE"}
|
package/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
exports = module.exports = function (...args) {
|
|
17
|
+
return new exports.default(...args)
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.default = void 0;
|
|
21
|
+
// Auth internals are shared via symlink, not via package exports.
|
|
22
|
+
__exportStar(require("./client.js"), exports);
|
|
23
|
+
var client_1 = require("./client.js");
|
|
24
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.AnthropicAws; } });
|
|
25
|
+
//# 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,kEAAkE;AAClE,8CAAyB;AACzB,sCAAmD;AAA1C,iGAAA,YAAY,OAAW"}
|
package/index.mjs
ADDED
package/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";OAEO,EAAE,YAAY,IAAI,OAAO,EAAE"}
|
|
@@ -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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-types.js","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":";AAAA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-types.mjs","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/internal/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAS5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/internal/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAS5D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File containing shared constants
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MODEL_NONSTREAMING_TOKENS = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Model-specific timeout constraints for non-streaming requests
|
|
7
|
+
*/
|
|
8
|
+
exports.MODEL_NONSTREAMING_TOKENS = {
|
|
9
|
+
'claude-opus-4-20250514': 8192,
|
|
10
|
+
'claude-opus-4-0': 8192,
|
|
11
|
+
'claude-4-opus-20250514': 8192,
|
|
12
|
+
'anthropic.claude-opus-4-20250514-v1:0': 8192,
|
|
13
|
+
'claude-opus-4@20250514': 8192,
|
|
14
|
+
'claude-opus-4-1-20250805': 8192,
|
|
15
|
+
'anthropic.claude-opus-4-1-20250805-v1:0': 8192,
|
|
16
|
+
'claude-opus-4-1@20250805': 8192,
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/internal/constants.ts"],"names":[],"mappings":";AAAA,mCAAmC;;;AAEnC;;GAEG;AACU,QAAA,yBAAyB,GAA2B;IAC/D,wBAAwB,EAAE,IAAI;IAC9B,iBAAiB,EAAE,IAAI;IACvB,wBAAwB,EAAE,IAAI;IAC9B,uCAAuC,EAAE,IAAI;IAC7C,wBAAwB,EAAE,IAAI;IAC9B,0BAA0B,EAAE,IAAI;IAChC,yCAAyC,EAAE,IAAI;IAC/C,0BAA0B,EAAE,IAAI;CACjC,CAAC"}
|