/opt/canhelp/node_modules/@anthropic-ai/sdk/core
NameSizeModeActions
api-promise.d.mts24260644editdlrm
api-promise.d.mts.map15040644editdlrm
api-promise.d.ts24220644editdlrm
api-promise.d.ts.map15030644editdlrm
api-promise.js31890644editdlrm
api-promise.js.map17160644editdlrm
api-promise.mjs30800644editdlrm
api-promise.mjs.map17200644editdlrm
error.d.mts20400644editdlrm
error.d.mts.map16980644editdlrm
error.d.ts20390644editdlrm
error.d.ts.map16970644editdlrm
error.js43770644editdlrm
error.js.map32860644editdlrm
error.mjs34010644editdlrm
error.mjs.map31880644editdlrm
pagination.d.mts39140644editdlrm
pagination.d.mts.map31810644editdlrm
pagination.d.ts39090644editdlrm
pagination.d.ts.map31800644editdlrm
pagination.js58350644editdlrm
pagination.js.map45840644editdlrm
pagination.mjs54770644editdlrm
pagination.mjs.map45450644editdlrm
resource.d.mts2100644editdlrm
resource.d.mts.map2170644editdlrm
resource.d.ts2080644editdlrm
resource.d.ts.map2160644editdlrm
resource.js3500644editdlrm
resource.js.map2240644editdlrm
resource.mjs2160644editdlrm
resource.mjs.map2160644editdlrm
streaming.d.mts14860644editdlrm
streaming.d.mts.map10500644editdlrm
streaming.d.ts14830644editdlrm
streaming.d.ts.map10490644editdlrm
streaming.js106310644editdlrm
streaming.js.map83300644editdlrm
streaming.mjs103860644editdlrm
streaming.mjs.map83390644editdlrm
uploads.d.mts1650644editdlrm
uploads.d.mts.map1740644editdlrm
uploads.d.ts1620644editdlrm
uploads.d.ts.map1730644editdlrm
uploads.js2990644editdlrm
uploads.js.map1470644editdlrm
uploads.mjs860644editdlrm
uploads.mjs.map1320644editdlrm
Edit: /opt/canhelp/node_modules/@anthropic-ai/sdk/core/api-promise.js (3189B)
"use strict"; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. var _APIPromise_client; Object.defineProperty(exports, "__esModule", { value: true }); exports.APIPromise = void 0; const tslib_1 = require("../internal/tslib.js"); const parse_1 = require("../internal/parse.js"); /** * A subclass of `Promise` providing additional helper methods * for interacting with the SDK. */ class APIPromise extends Promise { constructor(client, responsePromise, parseResponse = parse_1.defaultParseResponse) { super((resolve) => { // this is maybe a bit weird but this has to be a no-op to not implicitly // parse the response body; instead .then, .catch, .finally are overridden // to parse the response resolve(null); }); this.responsePromise = responsePromise; this.parseResponse = parseResponse; _APIPromise_client.set(this, void 0); tslib_1.__classPrivateFieldSet(this, _APIPromise_client, client, "f"); } _thenUnwrap(transform) { return new APIPromise(tslib_1.__classPrivateFieldGet(this, _APIPromise_client, "f"), this.responsePromise, async (client, props) => (0, parse_1.addRequestID)(transform(await this.parseResponse(client, props), props), props.response)); } /** * Gets the raw `Response` instance instead of parsing the response * data. * * If you want to parse the response body but still get the `Response` * instance, you can use {@link withResponse()}. * * 👋 Getting the wrong TypeScript type for `Response`? * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` * to your `tsconfig.json`. */ asResponse() { return this.responsePromise.then((p) => p.response); } /** * Gets the parsed response data, the raw `Response` instance and the ID of the request, * returned via the `request-id` header which is useful for debugging requests and resporting * issues to Anthropic. * * If you just want to get the raw `Response` instance without parsing it, * you can use {@link asResponse()}. * * 👋 Getting the wrong TypeScript type for `Response`? * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` * to your `tsconfig.json`. */ async withResponse() { const [data, response] = await Promise.all([this.parse(), this.asResponse()]); return { data, response, request_id: response.headers.get('request-id') }; } parse() { if (!this.parsedPromise) { this.parsedPromise = this.responsePromise.then((data) => this.parseResponse(tslib_1.__classPrivateFieldGet(this, _APIPromise_client, "f"), data)); } return this.parsedPromise; } then(onfulfilled, onrejected) { return this.parse().then(onfulfilled, onrejected); } catch(onrejected) { return this.parse().catch(onrejected); } finally(onfinally) { return this.parse().finally(onfinally); } } exports.APIPromise = APIPromise; _APIPromise_client = new WeakMap(); //# sourceMappingURL=api-promise.js.map