/
opt
/
canhelp
/
node_modules
/
@anthropic-ai
/
sdk
/
core
/
/opt/canhelp/node_modules/@anthropic-ai/sdk/core
mkdir
upload
Name
Size
Mode
Actions
api-promise.d.mts
2426
0644
edit
dl
rm
api-promise.d.mts.map
1504
0644
edit
dl
rm
api-promise.d.ts
2422
0644
edit
dl
rm
api-promise.d.ts.map
1503
0644
edit
dl
rm
api-promise.js
3189
0644
edit
dl
rm
api-promise.js.map
1716
0644
edit
dl
rm
api-promise.mjs
3080
0644
edit
dl
rm
api-promise.mjs.map
1720
0644
edit
dl
rm
error.d.mts
2040
0644
edit
dl
rm
error.d.mts.map
1698
0644
edit
dl
rm
error.d.ts
2039
0644
edit
dl
rm
error.d.ts.map
1697
0644
edit
dl
rm
error.js
4377
0644
edit
dl
rm
error.js.map
3286
0644
edit
dl
rm
error.mjs
3401
0644
edit
dl
rm
error.mjs.map
3188
0644
edit
dl
rm
pagination.d.mts
3914
0644
edit
dl
rm
pagination.d.mts.map
3181
0644
edit
dl
rm
pagination.d.ts
3909
0644
edit
dl
rm
pagination.d.ts.map
3180
0644
edit
dl
rm
pagination.js
5835
0644
edit
dl
rm
pagination.js.map
4584
0644
edit
dl
rm
pagination.mjs
5477
0644
edit
dl
rm
pagination.mjs.map
4545
0644
edit
dl
rm
resource.d.mts
210
0644
edit
dl
rm
resource.d.mts.map
217
0644
edit
dl
rm
resource.d.ts
208
0644
edit
dl
rm
resource.d.ts.map
216
0644
edit
dl
rm
resource.js
350
0644
edit
dl
rm
resource.js.map
224
0644
edit
dl
rm
resource.mjs
216
0644
edit
dl
rm
resource.mjs.map
216
0644
edit
dl
rm
streaming.d.mts
1486
0644
edit
dl
rm
streaming.d.mts.map
1050
0644
edit
dl
rm
streaming.d.ts
1483
0644
edit
dl
rm
streaming.d.ts.map
1049
0644
edit
dl
rm
streaming.js
10631
0644
edit
dl
rm
streaming.js.map
8330
0644
edit
dl
rm
streaming.mjs
10386
0644
edit
dl
rm
streaming.mjs.map
8339
0644
edit
dl
rm
uploads.d.mts
165
0644
edit
dl
rm
uploads.d.mts.map
174
0644
edit
dl
rm
uploads.d.ts
162
0644
edit
dl
rm
uploads.d.ts.map
173
0644
edit
dl
rm
uploads.js
299
0644
edit
dl
rm
uploads.js.map
147
0644
edit
dl
rm
uploads.mjs
86
0644
edit
dl
rm
uploads.mjs.map
132
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/@anthropic-ai/sdk/core/pagination.js
(5835B)
"use strict"; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. var _AbstractPage_client; Object.defineProperty(exports, "__esModule", { value: true }); exports.PageCursor = exports.TokenPage = exports.Page = exports.PagePromise = exports.AbstractPage = void 0; const tslib_1 = require("../internal/tslib.js"); const error_1 = require("./error.js"); const parse_1 = require("../internal/parse.js"); const api_promise_1 = require("./api-promise.js"); const values_1 = require("../internal/utils/values.js"); class AbstractPage { constructor(client, response, body, options) { _AbstractPage_client.set(this, void 0); tslib_1.__classPrivateFieldSet(this, _AbstractPage_client, client, "f"); this.options = options; this.response = response; this.body = body; } hasNextPage() { const items = this.getPaginatedItems(); if (!items.length) return false; return this.nextPageRequestOptions() != null; } async getNextPage() { const nextOptions = this.nextPageRequestOptions(); if (!nextOptions) { throw new error_1.AnthropicError('No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.'); } return await tslib_1.__classPrivateFieldGet(this, _AbstractPage_client, "f").requestAPIList(this.constructor, nextOptions); } async *iterPages() { let page = this; yield page; while (page.hasNextPage()) { page = await page.getNextPage(); yield page; } } async *[(_AbstractPage_client = new WeakMap(), Symbol.asyncIterator)]() { for await (const page of this.iterPages()) { for (const item of page.getPaginatedItems()) { yield item; } } } } exports.AbstractPage = AbstractPage; /** * This subclass of Promise will resolve to an instantiated Page once the request completes. * * It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg: * * for await (const item of client.items.list()) { * console.log(item) * } */ class PagePromise extends api_promise_1.APIPromise { constructor(client, request, Page) { super(client, request, async (client, props) => new Page(client, props.response, await (0, parse_1.defaultParseResponse)(client, props), props.options)); } /** * Allow auto-paginating iteration on an unawaited list call, eg: * * for await (const item of client.items.list()) { * console.log(item) * } */ async *[Symbol.asyncIterator]() { const page = await this; for await (const item of page) { yield item; } } } exports.PagePromise = PagePromise; class Page extends AbstractPage { constructor(client, response, body, options) { super(client, response, body, options); this.data = body.data || []; this.has_more = body.has_more || false; this.first_id = body.first_id || null; this.last_id = body.last_id || null; } getPaginatedItems() { return this.data ?? []; } hasNextPage() { if (this.has_more === false) { return false; } return super.hasNextPage(); } nextPageRequestOptions() { if (this.options.query?.['before_id']) { // in reverse const first_id = this.first_id; if (!first_id) { return null; } return { ...this.options, query: { ...(0, values_1.maybeObj)(this.options.query), before_id: first_id, }, }; } const cursor = this.last_id; if (!cursor) { return null; } return { ...this.options, query: { ...(0, values_1.maybeObj)(this.options.query), after_id: cursor, }, }; } } exports.Page = Page; class TokenPage extends AbstractPage { constructor(client, response, body, options) { super(client, response, body, options); this.data = body.data || []; this.has_more = body.has_more || false; this.next_page = body.next_page || null; } getPaginatedItems() { return this.data ?? []; } hasNextPage() { if (this.has_more === false) { return false; } return super.hasNextPage(); } nextPageRequestOptions() { const cursor = this.next_page; if (!cursor) { return null; } return { ...this.options, query: { ...(0, values_1.maybeObj)(this.options.query), page_token: cursor, }, }; } } exports.TokenPage = TokenPage; class PageCursor extends AbstractPage { constructor(client, response, body, options) { super(client, response, body, options); this.data = body.data || []; this.has_more = body.has_more || false; this.next_page = body.next_page || null; } getPaginatedItems() { return this.data ?? []; } hasNextPage() { if (this.has_more === false) { return false; } return super.hasNextPage(); } nextPageRequestOptions() { const cursor = this.next_page; if (!cursor) { return null; } return { ...this.options, query: { ...(0, values_1.maybeObj)(this.options.query), page: cursor, }, }; } } exports.PageCursor = PageCursor; //# sourceMappingURL=pagination.js.map
Save
cmd:
run