@nirvana-labs/nirvana 1.20.2 → 1.21.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/CHANGELOG.md +45 -0
- package/README.md +31 -0
- package/client.d.mts +7 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +7 -0
- package/client.d.ts.map +1 -1
- package/client.js +8 -0
- package/client.js.map +1 -1
- package/client.mjs +8 -0
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +61 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +61 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +101 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +95 -0
- package/core/pagination.mjs.map +1 -0
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/internal/tslib.js +18 -18
- package/package.json +11 -1
- 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/resources/api-keys.d.mts +16 -4
- package/resources/api-keys.d.mts.map +1 -1
- package/resources/api-keys.d.ts +16 -4
- package/resources/api-keys.d.ts.map +1 -1
- package/resources/api-keys.js +8 -4
- package/resources/api-keys.js.map +1 -1
- package/resources/api-keys.mjs +8 -4
- package/resources/api-keys.mjs.map +1 -1
- package/resources/compute/compute.d.mts +4 -4
- package/resources/compute/compute.d.mts.map +1 -1
- package/resources/compute/compute.d.ts +4 -4
- package/resources/compute/compute.d.ts.map +1 -1
- package/resources/compute/compute.js.map +1 -1
- package/resources/compute/compute.mjs.map +1 -1
- package/resources/compute/index.d.mts +2 -2
- package/resources/compute/index.d.mts.map +1 -1
- package/resources/compute/index.d.ts +2 -2
- package/resources/compute/index.d.ts.map +1 -1
- package/resources/compute/index.js.map +1 -1
- package/resources/compute/index.mjs.map +1 -1
- package/resources/compute/vms/index.d.mts +2 -2
- package/resources/compute/vms/index.d.mts.map +1 -1
- package/resources/compute/vms/index.d.ts +2 -2
- package/resources/compute/vms/index.d.ts.map +1 -1
- package/resources/compute/vms/index.js.map +1 -1
- package/resources/compute/vms/index.mjs.map +1 -1
- package/resources/compute/vms/vms.d.mts +16 -5
- package/resources/compute/vms/vms.d.mts.map +1 -1
- package/resources/compute/vms/vms.d.ts +16 -5
- package/resources/compute/vms/vms.d.ts.map +1 -1
- package/resources/compute/vms/vms.js +7 -3
- package/resources/compute/vms/vms.js.map +1 -1
- package/resources/compute/vms/vms.mjs +7 -3
- package/resources/compute/vms/vms.mjs.map +1 -1
- package/resources/compute/vms/volumes.d.mts +15 -5
- package/resources/compute/vms/volumes.d.mts.map +1 -1
- package/resources/compute/vms/volumes.d.ts +15 -5
- package/resources/compute/vms/volumes.d.ts.map +1 -1
- package/resources/compute/vms/volumes.js +11 -4
- package/resources/compute/vms/volumes.js.map +1 -1
- package/resources/compute/vms/volumes.mjs +11 -4
- package/resources/compute/vms/volumes.mjs.map +1 -1
- package/resources/compute/volumes/index.d.mts +1 -1
- package/resources/compute/volumes/index.d.mts.map +1 -1
- package/resources/compute/volumes/index.d.ts +1 -1
- package/resources/compute/volumes/index.d.ts.map +1 -1
- package/resources/compute/volumes/index.js.map +1 -1
- package/resources/compute/volumes/index.mjs.map +1 -1
- package/resources/compute/volumes/volumes.d.mts +14 -3
- package/resources/compute/volumes/volumes.d.mts.map +1 -1
- package/resources/compute/volumes/volumes.d.ts +14 -3
- package/resources/compute/volumes/volumes.d.ts.map +1 -1
- package/resources/compute/volumes/volumes.js +7 -3
- package/resources/compute/volumes/volumes.js.map +1 -1
- package/resources/compute/volumes/volumes.mjs +7 -3
- package/resources/compute/volumes/volumes.mjs.map +1 -1
- package/resources/networking/connect/connect.d.mts +15 -4
- package/resources/networking/connect/connect.d.mts.map +1 -1
- package/resources/networking/connect/connect.d.ts +15 -4
- package/resources/networking/connect/connect.d.ts.map +1 -1
- package/resources/networking/connect/connect.js.map +1 -1
- package/resources/networking/connect/connect.mjs +1 -1
- package/resources/networking/connect/connect.mjs.map +1 -1
- package/resources/networking/connect/connections.d.mts +11 -4
- package/resources/networking/connect/connections.d.mts.map +1 -1
- package/resources/networking/connect/connections.d.ts +11 -4
- package/resources/networking/connect/connections.d.ts.map +1 -1
- package/resources/networking/connect/connections.js +7 -4
- package/resources/networking/connect/connections.js.map +1 -1
- package/resources/networking/connect/connections.mjs +7 -4
- package/resources/networking/connect/connections.mjs.map +1 -1
- package/resources/networking/connect/index.d.mts +3 -3
- package/resources/networking/connect/index.d.mts.map +1 -1
- package/resources/networking/connect/index.d.ts +3 -3
- package/resources/networking/connect/index.d.ts.map +1 -1
- package/resources/networking/connect/index.js.map +1 -1
- package/resources/networking/connect/index.mjs +1 -1
- package/resources/networking/connect/index.mjs.map +1 -1
- package/resources/networking/connect/routes.d.mts +13 -4
- package/resources/networking/connect/routes.d.mts.map +1 -1
- package/resources/networking/connect/routes.d.ts +13 -4
- package/resources/networking/connect/routes.d.ts.map +1 -1
- package/resources/networking/connect/routes.js +10 -4
- package/resources/networking/connect/routes.js.map +1 -1
- package/resources/networking/connect/routes.mjs +10 -4
- package/resources/networking/connect/routes.mjs.map +1 -1
- package/resources/networking/firewall-rules.d.mts +16 -4
- package/resources/networking/firewall-rules.d.mts.map +1 -1
- package/resources/networking/firewall-rules.d.ts +16 -4
- package/resources/networking/firewall-rules.d.ts.map +1 -1
- package/resources/networking/firewall-rules.js +12 -4
- package/resources/networking/firewall-rules.js.map +1 -1
- package/resources/networking/firewall-rules.mjs +12 -4
- package/resources/networking/firewall-rules.mjs.map +1 -1
- package/resources/networking/index.d.mts +3 -3
- package/resources/networking/index.d.mts.map +1 -1
- package/resources/networking/index.d.ts +3 -3
- package/resources/networking/index.d.ts.map +1 -1
- package/resources/networking/index.js.map +1 -1
- package/resources/networking/index.mjs.map +1 -1
- package/resources/networking/networking.d.mts +4 -4
- package/resources/networking/networking.d.mts.map +1 -1
- package/resources/networking/networking.d.ts +4 -4
- package/resources/networking/networking.d.ts.map +1 -1
- package/resources/networking/networking.js.map +1 -1
- package/resources/networking/networking.mjs +1 -1
- package/resources/networking/networking.mjs.map +1 -1
- package/resources/networking/vpcs/index.d.mts +1 -1
- package/resources/networking/vpcs/index.d.mts.map +1 -1
- package/resources/networking/vpcs/index.d.ts +1 -1
- package/resources/networking/vpcs/index.d.ts.map +1 -1
- package/resources/networking/vpcs/index.js.map +1 -1
- package/resources/networking/vpcs/index.mjs.map +1 -1
- package/resources/networking/vpcs/vpcs.d.mts +14 -3
- package/resources/networking/vpcs/vpcs.d.mts.map +1 -1
- package/resources/networking/vpcs/vpcs.d.ts +14 -3
- package/resources/networking/vpcs/vpcs.d.ts.map +1 -1
- package/resources/networking/vpcs/vpcs.js +7 -3
- package/resources/networking/vpcs/vpcs.js.map +1 -1
- package/resources/networking/vpcs/vpcs.mjs +7 -3
- package/resources/networking/vpcs/vpcs.mjs.map +1 -1
- package/resources/operations.d.mts +11 -2
- package/resources/operations.d.mts.map +1 -1
- package/resources/operations.d.ts +11 -2
- package/resources/operations.d.ts.map +1 -1
- package/resources/operations.js +3 -2
- package/resources/operations.js.map +1 -1
- package/resources/operations.mjs +3 -2
- package/resources/operations.mjs.map +1 -1
- package/resources/rpc-nodes/dedicated/blockchains.d.mts +13 -4
- package/resources/rpc-nodes/dedicated/blockchains.d.mts.map +1 -1
- package/resources/rpc-nodes/dedicated/blockchains.d.ts +13 -4
- package/resources/rpc-nodes/dedicated/blockchains.d.ts.map +1 -1
- package/resources/rpc-nodes/dedicated/blockchains.js +7 -4
- package/resources/rpc-nodes/dedicated/blockchains.js.map +1 -1
- package/resources/rpc-nodes/dedicated/blockchains.mjs +7 -4
- package/resources/rpc-nodes/dedicated/blockchains.mjs.map +1 -1
- package/resources/rpc-nodes/dedicated/dedicated.d.mts +22 -6
- package/resources/rpc-nodes/dedicated/dedicated.d.mts.map +1 -1
- package/resources/rpc-nodes/dedicated/dedicated.d.ts +22 -6
- package/resources/rpc-nodes/dedicated/dedicated.d.ts.map +1 -1
- package/resources/rpc-nodes/dedicated/dedicated.js +7 -4
- package/resources/rpc-nodes/dedicated/dedicated.js.map +1 -1
- package/resources/rpc-nodes/dedicated/dedicated.mjs +7 -4
- package/resources/rpc-nodes/dedicated/dedicated.mjs.map +1 -1
- package/resources/rpc-nodes/dedicated/index.d.mts +2 -2
- package/resources/rpc-nodes/dedicated/index.d.mts.map +1 -1
- package/resources/rpc-nodes/dedicated/index.d.ts +2 -2
- package/resources/rpc-nodes/dedicated/index.d.ts.map +1 -1
- package/resources/rpc-nodes/dedicated/index.js.map +1 -1
- package/resources/rpc-nodes/dedicated/index.mjs.map +1 -1
- package/resources/rpc-nodes/flex/blockchains.d.mts +13 -4
- package/resources/rpc-nodes/flex/blockchains.d.mts.map +1 -1
- package/resources/rpc-nodes/flex/blockchains.d.ts +13 -4
- package/resources/rpc-nodes/flex/blockchains.d.ts.map +1 -1
- package/resources/rpc-nodes/flex/blockchains.js +10 -4
- package/resources/rpc-nodes/flex/blockchains.js.map +1 -1
- package/resources/rpc-nodes/flex/blockchains.mjs +10 -4
- package/resources/rpc-nodes/flex/blockchains.mjs.map +1 -1
- package/resources/rpc-nodes/flex/flex.d.mts +22 -5
- package/resources/rpc-nodes/flex/flex.d.mts.map +1 -1
- package/resources/rpc-nodes/flex/flex.d.ts +22 -5
- package/resources/rpc-nodes/flex/flex.d.ts.map +1 -1
- package/resources/rpc-nodes/flex/flex.js +7 -3
- package/resources/rpc-nodes/flex/flex.js.map +1 -1
- package/resources/rpc-nodes/flex/flex.mjs +7 -3
- package/resources/rpc-nodes/flex/flex.mjs.map +1 -1
- package/resources/rpc-nodes/flex/index.d.mts +2 -2
- package/resources/rpc-nodes/flex/index.d.mts.map +1 -1
- package/resources/rpc-nodes/flex/index.d.ts +2 -2
- package/resources/rpc-nodes/flex/index.d.ts.map +1 -1
- package/resources/rpc-nodes/flex/index.js.map +1 -1
- package/resources/rpc-nodes/flex/index.mjs.map +1 -1
- package/resources/rpc-nodes/index.d.mts +2 -2
- package/resources/rpc-nodes/index.d.mts.map +1 -1
- package/resources/rpc-nodes/index.d.ts +2 -2
- package/resources/rpc-nodes/index.d.ts.map +1 -1
- package/resources/rpc-nodes/index.js.map +1 -1
- package/resources/rpc-nodes/index.mjs.map +1 -1
- package/resources/rpc-nodes/rpc-nodes.d.mts +4 -4
- package/resources/rpc-nodes/rpc-nodes.d.mts.map +1 -1
- package/resources/rpc-nodes/rpc-nodes.d.ts +4 -4
- package/resources/rpc-nodes/rpc-nodes.d.ts.map +1 -1
- package/resources/rpc-nodes/rpc-nodes.js.map +1 -1
- package/resources/rpc-nodes/rpc-nodes.mjs.map +1 -1
- package/resources/shared.d.mts +8 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +8 -0
- package/resources/shared.d.ts.map +1 -1
- package/src/client.ts +25 -0
- package/src/core/pagination.ts +167 -0
- package/src/index.ts +1 -0
- package/src/pagination.ts +2 -0
- package/src/resources/api-keys.ts +23 -4
- package/src/resources/compute/compute.ts +8 -0
- package/src/resources/compute/index.ts +4 -0
- package/src/resources/compute/vms/index.ts +3 -1
- package/src/resources/compute/vms/vms.ts +20 -5
- package/src/resources/compute/vms/volumes.ts +25 -6
- package/src/resources/compute/volumes/index.ts +2 -0
- package/src/resources/compute/volumes/volumes.ts +21 -3
- package/src/resources/networking/connect/connect.ts +24 -3
- package/src/resources/networking/connect/connections.ts +20 -4
- package/src/resources/networking/connect/index.ts +9 -2
- package/src/resources/networking/connect/routes.ts +22 -5
- package/src/resources/networking/firewall-rules.ts +27 -4
- package/src/resources/networking/index.ts +6 -0
- package/src/resources/networking/networking.ts +16 -1
- package/src/resources/networking/vpcs/index.ts +2 -0
- package/src/resources/networking/vpcs/vpcs.ts +18 -3
- package/src/resources/operations.ts +18 -2
- package/src/resources/rpc-nodes/dedicated/blockchains.ts +23 -5
- package/src/resources/rpc-nodes/dedicated/dedicated.ts +31 -6
- package/src/resources/rpc-nodes/dedicated/index.ts +4 -1
- package/src/resources/rpc-nodes/flex/blockchains.ts +22 -5
- package/src/resources/rpc-nodes/flex/flex.ts +31 -5
- package/src/resources/rpc-nodes/flex/index.ts +4 -1
- package/src/resources/rpc-nodes/index.ts +6 -0
- package/src/resources/rpc-nodes/rpc-nodes.ts +8 -0
- package/src/resources/shared.ts +11 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var _AbstractPage_client;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.Cursor = exports.PagePromise = exports.AbstractPage = void 0;
|
|
6
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
7
|
+
const error_1 = require("./error.js");
|
|
8
|
+
const parse_1 = require("../internal/parse.js");
|
|
9
|
+
const api_promise_1 = require("./api-promise.js");
|
|
10
|
+
const values_1 = require("../internal/utils/values.js");
|
|
11
|
+
class AbstractPage {
|
|
12
|
+
constructor(client, response, body, options) {
|
|
13
|
+
_AbstractPage_client.set(this, void 0);
|
|
14
|
+
tslib_1.__classPrivateFieldSet(this, _AbstractPage_client, client, "f");
|
|
15
|
+
this.options = options;
|
|
16
|
+
this.response = response;
|
|
17
|
+
this.body = body;
|
|
18
|
+
}
|
|
19
|
+
hasNextPage() {
|
|
20
|
+
const items = this.getPaginatedItems();
|
|
21
|
+
if (!items.length)
|
|
22
|
+
return false;
|
|
23
|
+
return this.nextPageRequestOptions() != null;
|
|
24
|
+
}
|
|
25
|
+
async getNextPage() {
|
|
26
|
+
const nextOptions = this.nextPageRequestOptions();
|
|
27
|
+
if (!nextOptions) {
|
|
28
|
+
throw new error_1.NirvanaLabsError('No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.');
|
|
29
|
+
}
|
|
30
|
+
return await tslib_1.__classPrivateFieldGet(this, _AbstractPage_client, "f").requestAPIList(this.constructor, nextOptions);
|
|
31
|
+
}
|
|
32
|
+
async *iterPages() {
|
|
33
|
+
let page = this;
|
|
34
|
+
yield page;
|
|
35
|
+
while (page.hasNextPage()) {
|
|
36
|
+
page = await page.getNextPage();
|
|
37
|
+
yield page;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async *[(_AbstractPage_client = new WeakMap(), Symbol.asyncIterator)]() {
|
|
41
|
+
for await (const page of this.iterPages()) {
|
|
42
|
+
for (const item of page.getPaginatedItems()) {
|
|
43
|
+
yield item;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.AbstractPage = AbstractPage;
|
|
49
|
+
/**
|
|
50
|
+
* This subclass of Promise will resolve to an instantiated Page once the request completes.
|
|
51
|
+
*
|
|
52
|
+
* It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
|
|
53
|
+
*
|
|
54
|
+
* for await (const item of client.items.list()) {
|
|
55
|
+
* console.log(item)
|
|
56
|
+
* }
|
|
57
|
+
*/
|
|
58
|
+
class PagePromise extends api_promise_1.APIPromise {
|
|
59
|
+
constructor(client, request, Page) {
|
|
60
|
+
super(client, request, async (client, props) => new Page(client, props.response, await (0, parse_1.defaultParseResponse)(client, props), props.options));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Allow auto-paginating iteration on an unawaited list call, eg:
|
|
64
|
+
*
|
|
65
|
+
* for await (const item of client.items.list()) {
|
|
66
|
+
* console.log(item)
|
|
67
|
+
* }
|
|
68
|
+
*/
|
|
69
|
+
async *[Symbol.asyncIterator]() {
|
|
70
|
+
const page = await this;
|
|
71
|
+
for await (const item of page) {
|
|
72
|
+
yield item;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.PagePromise = PagePromise;
|
|
77
|
+
class Cursor extends AbstractPage {
|
|
78
|
+
constructor(client, response, body, options) {
|
|
79
|
+
super(client, response, body, options);
|
|
80
|
+
this.items = body.items || [];
|
|
81
|
+
this.pagination = body.pagination || null;
|
|
82
|
+
}
|
|
83
|
+
getPaginatedItems() {
|
|
84
|
+
return this.items ?? [];
|
|
85
|
+
}
|
|
86
|
+
nextPageRequestOptions() {
|
|
87
|
+
const cursor = this.pagination?.next_cursor;
|
|
88
|
+
if (!cursor) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
...this.options,
|
|
93
|
+
query: {
|
|
94
|
+
...(0, values_1.maybeObj)(this.options.query),
|
|
95
|
+
cursor,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.Cursor = Cursor;
|
|
101
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;AAEtF,sCAA2C;AAE3C,gDAAyD;AAEzD,kDAA2C;AAE3C,wDAAoD;AAIpD,MAAsB,YAAY;IAOhC,YAAY,MAAmB,EAAE,QAAkB,EAAE,IAAa,EAAE,OAA4B;QANhG,uCAAqB;QAOnB,+BAAA,IAAI,wBAAW,MAAM,MAAA,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAMD,WAAW;QACT,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvC,IAAI,CAAC,KAAK,CAAC,MAAM;Y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AAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QAC3B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;QACxB,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,CAAC;QACb,CAAC;IACH,CAAC;CACF;AAjCD,kCAiCC;AAwBD,MAAa,MAAa,SAAQ,YAAkB;IAKlD,YACE,MAAmB,EACnB,QAAkB,EAClB,IAA0B,EAC1B,OAA4B;QAE5B,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEvC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC;IAC5C,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED,sBAAsB;QACpB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC;QAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,GAAG,IAAI,CAAC,OAAO;YACf,KAAK,EAAE;gBACL,GAAG,IAAA,iBAAQ,EAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC/B,MAAM;aACP;SACF,CAAC;IACJ,CAAC;CACF;AAnCD,wBAmCC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
var _AbstractPage_client;
|
|
3
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "../internal/tslib.mjs";
|
|
4
|
+
import { NirvanaLabsError } from "./error.mjs";
|
|
5
|
+
import { defaultParseResponse } from "../internal/parse.mjs";
|
|
6
|
+
import { APIPromise } from "./api-promise.mjs";
|
|
7
|
+
import { maybeObj } from "../internal/utils/values.mjs";
|
|
8
|
+
export class AbstractPage {
|
|
9
|
+
constructor(client, response, body, options) {
|
|
10
|
+
_AbstractPage_client.set(this, void 0);
|
|
11
|
+
__classPrivateFieldSet(this, _AbstractPage_client, client, "f");
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.response = response;
|
|
14
|
+
this.body = body;
|
|
15
|
+
}
|
|
16
|
+
hasNextPage() {
|
|
17
|
+
const items = this.getPaginatedItems();
|
|
18
|
+
if (!items.length)
|
|
19
|
+
return false;
|
|
20
|
+
return this.nextPageRequestOptions() != null;
|
|
21
|
+
}
|
|
22
|
+
async getNextPage() {
|
|
23
|
+
const nextOptions = this.nextPageRequestOptions();
|
|
24
|
+
if (!nextOptions) {
|
|
25
|
+
throw new NirvanaLabsError('No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.');
|
|
26
|
+
}
|
|
27
|
+
return await __classPrivateFieldGet(this, _AbstractPage_client, "f").requestAPIList(this.constructor, nextOptions);
|
|
28
|
+
}
|
|
29
|
+
async *iterPages() {
|
|
30
|
+
let page = this;
|
|
31
|
+
yield page;
|
|
32
|
+
while (page.hasNextPage()) {
|
|
33
|
+
page = await page.getNextPage();
|
|
34
|
+
yield page;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async *[(_AbstractPage_client = new WeakMap(), Symbol.asyncIterator)]() {
|
|
38
|
+
for await (const page of this.iterPages()) {
|
|
39
|
+
for (const item of page.getPaginatedItems()) {
|
|
40
|
+
yield item;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* This subclass of Promise will resolve to an instantiated Page once the request completes.
|
|
47
|
+
*
|
|
48
|
+
* It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
|
|
49
|
+
*
|
|
50
|
+
* for await (const item of client.items.list()) {
|
|
51
|
+
* console.log(item)
|
|
52
|
+
* }
|
|
53
|
+
*/
|
|
54
|
+
export class PagePromise extends APIPromise {
|
|
55
|
+
constructor(client, request, Page) {
|
|
56
|
+
super(client, request, async (client, props) => new Page(client, props.response, await defaultParseResponse(client, props), props.options));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Allow auto-paginating iteration on an unawaited list call, eg:
|
|
60
|
+
*
|
|
61
|
+
* for await (const item of client.items.list()) {
|
|
62
|
+
* console.log(item)
|
|
63
|
+
* }
|
|
64
|
+
*/
|
|
65
|
+
async *[Symbol.asyncIterator]() {
|
|
66
|
+
const page = await this;
|
|
67
|
+
for await (const item of page) {
|
|
68
|
+
yield item;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export class Cursor extends AbstractPage {
|
|
73
|
+
constructor(client, response, body, options) {
|
|
74
|
+
super(client, response, body, options);
|
|
75
|
+
this.items = body.items || [];
|
|
76
|
+
this.pagination = body.pagination || null;
|
|
77
|
+
}
|
|
78
|
+
getPaginatedItems() {
|
|
79
|
+
return this.items ?? [];
|
|
80
|
+
}
|
|
81
|
+
nextPageRequestOptions() {
|
|
82
|
+
const cursor = this.pagination?.next_cursor;
|
|
83
|
+
if (!cursor) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
...this.options,
|
|
88
|
+
query: {
|
|
89
|
+
...maybeObj(this.options.query),
|
|
90
|
+
cursor,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=pagination.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.mjs","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":"AAAA,sFAAsF;;;OAE/E,EAAE,gBAAgB,EAAE;OAEpB,EAAE,oBAAoB,EAAE;OAExB,EAAE,UAAU,EAAE;OAEd,EAAE,QAAQ,EAAE;A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AAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC/B,MAAM;aACP;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/index.d.mts
CHANGED
|
@@ -2,5 +2,6 @@ export { NirvanaLabs as default } from "./client.mjs";
|
|
|
2
2
|
export { type Uploadable, toFile } from "./core/uploads.mjs";
|
|
3
3
|
export { APIPromise } from "./core/api-promise.mjs";
|
|
4
4
|
export { NirvanaLabs, type ClientOptions } from "./client.mjs";
|
|
5
|
+
export { PagePromise } from "./core/pagination.mjs";
|
|
5
6
|
export { NirvanaLabsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
6
7
|
//# sourceMappingURL=index.d.mts.map
|
package/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,IAAI,OAAO,EAAE;OAE1B,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE;OACnC,EACL,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,IAAI,OAAO,EAAE;OAE1B,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE;OACnC,EAAE,WAAW,EAAE;OACf,EACL,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
package/index.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ export { NirvanaLabs as default } from "./client.js";
|
|
|
2
2
|
export { type Uploadable, toFile } from "./core/uploads.js";
|
|
3
3
|
export { APIPromise } from "./core/api-promise.js";
|
|
4
4
|
export { NirvanaLabs, type ClientOptions } from "./client.js";
|
|
5
|
+
export { PagePromise } from "./core/pagination.js";
|
|
5
6
|
export { NirvanaLabsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.js";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,IAAI,OAAO,EAAE;OAE1B,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE;OACnC,EACL,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,IAAI,OAAO,EAAE;OAE1B,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE;OACnC,EAAE,WAAW,EAAE;OACf,EACL,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ exports = module.exports = function (...args) {
|
|
|
4
4
|
return new exports.default(...args)
|
|
5
5
|
}
|
|
6
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.NirvanaLabsError = exports.NirvanaLabs = exports.APIPromise = exports.toFile = exports.default = void 0;
|
|
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.NirvanaLabsError = exports.PagePromise = exports.NirvanaLabs = exports.APIPromise = exports.toFile = exports.default = void 0;
|
|
8
8
|
var client_1 = require("./client.js");
|
|
9
9
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.NirvanaLabs; } });
|
|
10
10
|
var uploads_1 = require("./core/uploads.js");
|
|
@@ -13,6 +13,8 @@ var api_promise_1 = require("./core/api-promise.js");
|
|
|
13
13
|
Object.defineProperty(exports, "APIPromise", { enumerable: true, get: function () { return api_promise_1.APIPromise; } });
|
|
14
14
|
var client_2 = require("./client.js");
|
|
15
15
|
Object.defineProperty(exports, "NirvanaLabs", { enumerable: true, get: function () { return client_2.NirvanaLabs; } });
|
|
16
|
+
var pagination_1 = require("./core/pagination.js");
|
|
17
|
+
Object.defineProperty(exports, "PagePromise", { enumerable: true, get: function () { return pagination_1.PagePromise; } });
|
|
16
18
|
var error_1 = require("./core/error.js");
|
|
17
19
|
Object.defineProperty(exports, "NirvanaLabsError", { enumerable: true, get: function () { return error_1.NirvanaLabsError; } });
|
|
18
20
|
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAAkD;AAAzC,iGAAA,WAAW,OAAW;AAE/B,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAA2D;AAAlD,qGAAA,WAAW,OAAA;AACpB,yCAcsB;AAbpB,yGAAA,gBAAgB,OAAA;AAChB,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"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAAkD;AAAzC,iGAAA,WAAW,OAAW;AAE/B,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAA2D;AAAlD,qGAAA,WAAW,OAAA;AACpB,mDAAgD;AAAvC,yGAAA,WAAW,OAAA;AACpB,yCAcsB;AAbpB,yGAAA,gBAAgB,OAAA;AAChB,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
CHANGED
|
@@ -3,5 +3,6 @@ export { NirvanaLabs as default } from "./client.mjs";
|
|
|
3
3
|
export { toFile } from "./core/uploads.mjs";
|
|
4
4
|
export { APIPromise } from "./core/api-promise.mjs";
|
|
5
5
|
export { NirvanaLabs } from "./client.mjs";
|
|
6
|
+
export { PagePromise } from "./core/pagination.mjs";
|
|
6
7
|
export { NirvanaLabsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
7
8
|
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,IAAI,OAAO,EAAE;OAE1B,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAsB;OACnC,EACL,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,IAAI,OAAO,EAAE;OAE1B,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAsB;OACnC,EAAE,WAAW,EAAE;OACf,EACL,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
package/internal/tslib.js
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.__setModuleDefault = exports.__createBinding = void 0;
|
|
4
|
-
exports.__importStar = __importStar;
|
|
5
|
-
exports.__exportStar = __exportStar;
|
|
6
4
|
exports.__classPrivateFieldSet = __classPrivateFieldSet;
|
|
7
5
|
exports.__classPrivateFieldGet = __classPrivateFieldGet;
|
|
6
|
+
exports.__importStar = __importStar;
|
|
7
|
+
exports.__exportStar = __exportStar;
|
|
8
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
9
|
+
if (kind === "m")
|
|
10
|
+
throw new TypeError("Private method is not writable");
|
|
11
|
+
if (kind === "a" && !f)
|
|
12
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
14
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
15
|
+
return kind === "a" ? f.call(receiver, value) : f ? (f.value = value) : state.set(receiver, value), value;
|
|
16
|
+
}
|
|
17
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
18
|
+
if (kind === "a" && !f)
|
|
19
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
20
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
21
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
22
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
23
|
+
}
|
|
8
24
|
var __createBinding = Object.create
|
|
9
25
|
? function (o, m, k, k2) {
|
|
10
26
|
if (k2 === void 0)
|
|
@@ -63,19 +79,3 @@ function __exportStar(m, o) {
|
|
|
63
79
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
64
80
|
__createBinding(o, m, p);
|
|
65
81
|
}
|
|
66
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
67
|
-
if (kind === "m")
|
|
68
|
-
throw new TypeError("Private method is not writable");
|
|
69
|
-
if (kind === "a" && !f)
|
|
70
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
71
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
72
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
73
|
-
return kind === "a" ? f.call(receiver, value) : f ? (f.value = value) : state.set(receiver, value), value;
|
|
74
|
-
}
|
|
75
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
76
|
-
if (kind === "a" && !f)
|
|
77
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
78
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
79
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
80
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
81
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nirvana-labs/nirvana",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "The official TypeScript library for the Nirvana Labs API",
|
|
5
5
|
"author": "Nirvana Labs <engineering@nirvanalabs.io>",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -87,6 +87,16 @@
|
|
|
87
87
|
"./index.mjs": {
|
|
88
88
|
"default": "./index.mjs"
|
|
89
89
|
},
|
|
90
|
+
"./pagination": {
|
|
91
|
+
"import": "./pagination.mjs",
|
|
92
|
+
"require": "./pagination.js"
|
|
93
|
+
},
|
|
94
|
+
"./pagination.js": {
|
|
95
|
+
"default": "./pagination.js"
|
|
96
|
+
},
|
|
97
|
+
"./pagination.mjs": {
|
|
98
|
+
"default": "./pagination.mjs"
|
|
99
|
+
},
|
|
90
100
|
"./resource": {
|
|
91
101
|
"import": "./resource.mjs",
|
|
92
102
|
"require": "./resource.js"
|
package/pagination.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.mts","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":""}
|
package/pagination.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":""}
|
package/pagination.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("./internal/tslib.js");
|
|
4
|
+
/** @deprecated Import from ./core/pagination instead */
|
|
5
|
+
tslib_1.__exportStar(require("./core/pagination.js"), exports);
|
|
6
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,+DAAkC"}
|
package/pagination.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.mjs","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":""}
|
package/resources/api-keys.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import * as Shared from "./shared.mjs";
|
|
2
3
|
import { APIPromise } from "../core/api-promise.mjs";
|
|
4
|
+
import { Cursor, type CursorParams, PagePromise } from "../core/pagination.mjs";
|
|
3
5
|
import { RequestOptions } from "../internal/request-options.mjs";
|
|
4
6
|
export declare class APIKeys extends APIResource {
|
|
5
7
|
/**
|
|
@@ -9,7 +11,7 @@ export declare class APIKeys extends APIResource {
|
|
|
9
11
|
* ```ts
|
|
10
12
|
* const apiKey = await client.apiKeys.create({
|
|
11
13
|
* expires_at: '2025-12-31T23:59:59Z',
|
|
12
|
-
* name: '
|
|
14
|
+
* name: 'My API Key',
|
|
13
15
|
* });
|
|
14
16
|
* ```
|
|
15
17
|
*/
|
|
@@ -28,10 +30,13 @@ export declare class APIKeys extends APIResource {
|
|
|
28
30
|
*
|
|
29
31
|
* @example
|
|
30
32
|
* ```ts
|
|
31
|
-
*
|
|
33
|
+
* // Automatically fetches more pages as needed.
|
|
34
|
+
* for await (const apiKey of client.apiKeys.list()) {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
32
37
|
* ```
|
|
33
38
|
*/
|
|
34
|
-
list(options?: RequestOptions):
|
|
39
|
+
list(query?: APIKeyListParams | null | undefined, options?: RequestOptions): PagePromise<APIKeysCursor, APIKey>;
|
|
35
40
|
/**
|
|
36
41
|
* Delete an API key
|
|
37
42
|
*
|
|
@@ -51,6 +56,7 @@ export declare class APIKeys extends APIResource {
|
|
|
51
56
|
*/
|
|
52
57
|
get(apiKeyID: string, options?: RequestOptions): APIPromise<APIKey>;
|
|
53
58
|
}
|
|
59
|
+
export type APIKeysCursor = Cursor<APIKey>;
|
|
54
60
|
/**
|
|
55
61
|
* API Key response.
|
|
56
62
|
*/
|
|
@@ -94,6 +100,10 @@ export interface APIKey {
|
|
|
94
100
|
}
|
|
95
101
|
export interface APIKeyList {
|
|
96
102
|
items: Array<APIKey>;
|
|
103
|
+
/**
|
|
104
|
+
* Pagination response details.
|
|
105
|
+
*/
|
|
106
|
+
pagination: Shared.Pagination;
|
|
97
107
|
}
|
|
98
108
|
export interface APIKeyCreateParams {
|
|
99
109
|
/**
|
|
@@ -123,7 +133,9 @@ export interface APIKeyUpdateParams {
|
|
|
123
133
|
*/
|
|
124
134
|
tags?: Array<string>;
|
|
125
135
|
}
|
|
136
|
+
export interface APIKeyListParams extends CursorParams {
|
|
137
|
+
}
|
|
126
138
|
export declare namespace APIKeys {
|
|
127
|
-
export { type APIKey as APIKey, type APIKeyList as APIKeyList, type APIKeyCreateParams as APIKeyCreateParams, type APIKeyUpdateParams as APIKeyUpdateParams, };
|
|
139
|
+
export { type APIKey as APIKey, type APIKeyList as APIKeyList, type APIKeysCursor as APIKeysCursor, type APIKeyCreateParams as APIKeyCreateParams, type APIKeyUpdateParams as APIKeyUpdateParams, type APIKeyListParams as APIKeyListParams, };
|
|
128
140
|
}
|
|
129
141
|
//# sourceMappingURL=api-keys.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.d.mts","sourceRoot":"","sources":["../src/resources/api-keys.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"api-keys.d.mts","sourceRoot":"","sources":["../src/resources/api-keys.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE;OAE1C,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAI9E;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAIhG;;;;;;;;;;OAUG;IACH,IAAI,CACF,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AK,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;CAAG;AAEzD,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
package/resources/api-keys.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import * as Shared from "./shared.js";
|
|
2
3
|
import { APIPromise } from "../core/api-promise.js";
|
|
4
|
+
import { Cursor, type CursorParams, PagePromise } from "../core/pagination.js";
|
|
3
5
|
import { RequestOptions } from "../internal/request-options.js";
|
|
4
6
|
export declare class APIKeys extends APIResource {
|
|
5
7
|
/**
|
|
@@ -9,7 +11,7 @@ export declare class APIKeys extends APIResource {
|
|
|
9
11
|
* ```ts
|
|
10
12
|
* const apiKey = await client.apiKeys.create({
|
|
11
13
|
* expires_at: '2025-12-31T23:59:59Z',
|
|
12
|
-
* name: '
|
|
14
|
+
* name: 'My API Key',
|
|
13
15
|
* });
|
|
14
16
|
* ```
|
|
15
17
|
*/
|
|
@@ -28,10 +30,13 @@ export declare class APIKeys extends APIResource {
|
|
|
28
30
|
*
|
|
29
31
|
* @example
|
|
30
32
|
* ```ts
|
|
31
|
-
*
|
|
33
|
+
* // Automatically fetches more pages as needed.
|
|
34
|
+
* for await (const apiKey of client.apiKeys.list()) {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
32
37
|
* ```
|
|
33
38
|
*/
|
|
34
|
-
list(options?: RequestOptions):
|
|
39
|
+
list(query?: APIKeyListParams | null | undefined, options?: RequestOptions): PagePromise<APIKeysCursor, APIKey>;
|
|
35
40
|
/**
|
|
36
41
|
* Delete an API key
|
|
37
42
|
*
|
|
@@ -51,6 +56,7 @@ export declare class APIKeys extends APIResource {
|
|
|
51
56
|
*/
|
|
52
57
|
get(apiKeyID: string, options?: RequestOptions): APIPromise<APIKey>;
|
|
53
58
|
}
|
|
59
|
+
export type APIKeysCursor = Cursor<APIKey>;
|
|
54
60
|
/**
|
|
55
61
|
* API Key response.
|
|
56
62
|
*/
|
|
@@ -94,6 +100,10 @@ export interface APIKey {
|
|
|
94
100
|
}
|
|
95
101
|
export interface APIKeyList {
|
|
96
102
|
items: Array<APIKey>;
|
|
103
|
+
/**
|
|
104
|
+
* Pagination response details.
|
|
105
|
+
*/
|
|
106
|
+
pagination: Shared.Pagination;
|
|
97
107
|
}
|
|
98
108
|
export interface APIKeyCreateParams {
|
|
99
109
|
/**
|
|
@@ -123,7 +133,9 @@ export interface APIKeyUpdateParams {
|
|
|
123
133
|
*/
|
|
124
134
|
tags?: Array<string>;
|
|
125
135
|
}
|
|
136
|
+
export interface APIKeyListParams extends CursorParams {
|
|
137
|
+
}
|
|
126
138
|
export declare namespace APIKeys {
|
|
127
|
-
export { type APIKey as APIKey, type APIKeyList as APIKeyList, type APIKeyCreateParams as APIKeyCreateParams, type APIKeyUpdateParams as APIKeyUpdateParams, };
|
|
139
|
+
export { type APIKey as APIKey, type APIKeyList as APIKeyList, type APIKeysCursor as APIKeysCursor, type APIKeyCreateParams as APIKeyCreateParams, type APIKeyUpdateParams as APIKeyUpdateParams, type APIKeyListParams as APIKeyListParams, };
|
|
128
140
|
}
|
|
129
141
|
//# sourceMappingURL=api-keys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../src/resources/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|
exports.APIKeys = void 0;
|
|
5
5
|
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const pagination_1 = require("../core/pagination.js");
|
|
6
7
|
const headers_1 = require("../internal/headers.js");
|
|
7
8
|
const path_1 = require("../internal/utils/path.js");
|
|
8
9
|
class APIKeys extends resource_1.APIResource {
|
|
@@ -13,7 +14,7 @@ class APIKeys extends resource_1.APIResource {
|
|
|
13
14
|
* ```ts
|
|
14
15
|
* const apiKey = await client.apiKeys.create({
|
|
15
16
|
* expires_at: '2025-12-31T23:59:59Z',
|
|
16
|
-
* name: '
|
|
17
|
+
* name: 'My API Key',
|
|
17
18
|
* });
|
|
18
19
|
* ```
|
|
19
20
|
*/
|
|
@@ -36,11 +37,14 @@ class APIKeys extends resource_1.APIResource {
|
|
|
36
37
|
*
|
|
37
38
|
* @example
|
|
38
39
|
* ```ts
|
|
39
|
-
*
|
|
40
|
+
* // Automatically fetches more pages as needed.
|
|
41
|
+
* for await (const apiKey of client.apiKeys.list()) {
|
|
42
|
+
* // ...
|
|
43
|
+
* }
|
|
40
44
|
* ```
|
|
41
45
|
*/
|
|
42
|
-
list(options) {
|
|
43
|
-
return this._client.
|
|
46
|
+
list(query = {}, options) {
|
|
47
|
+
return this._client.getAPIList('/v1/api_keys', (pagination_1.Cursor), { query, ...options });
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* Delete an API key
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../src/resources/api-keys.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;
|
|
1
|
+
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../src/resources/api-keys.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,sDAA4E;AAC5E,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,QAAgB,EAAE,IAAwB,EAAE,OAAwB;QACzE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,gBAAgB,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,QAA6C,EAAE,EAC/C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAA,mBAAc,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,QAAgB,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,gBAAgB,QAAQ,EAAE,EAAE;YACzD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,GAAG,CAAC,QAAgB,EAAE,OAAwB;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;CACF;AAxED,0BAwEC"}
|
package/resources/api-keys.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { Cursor } from "../core/pagination.mjs";
|
|
3
4
|
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
5
|
import { path } from "../internal/utils/path.mjs";
|
|
5
6
|
export class APIKeys extends APIResource {
|
|
@@ -10,7 +11,7 @@ export class APIKeys extends APIResource {
|
|
|
10
11
|
* ```ts
|
|
11
12
|
* const apiKey = await client.apiKeys.create({
|
|
12
13
|
* expires_at: '2025-12-31T23:59:59Z',
|
|
13
|
-
* name: '
|
|
14
|
+
* name: 'My API Key',
|
|
14
15
|
* });
|
|
15
16
|
* ```
|
|
16
17
|
*/
|
|
@@ -33,11 +34,14 @@ export class APIKeys extends APIResource {
|
|
|
33
34
|
*
|
|
34
35
|
* @example
|
|
35
36
|
* ```ts
|
|
36
|
-
*
|
|
37
|
+
* // Automatically fetches more pages as needed.
|
|
38
|
+
* for await (const apiKey of client.apiKeys.list()) {
|
|
39
|
+
* // ...
|
|
40
|
+
* }
|
|
37
41
|
* ```
|
|
38
42
|
*/
|
|
39
|
-
list(options) {
|
|
40
|
-
return this._client.
|
|
43
|
+
list(query = {}, options) {
|
|
44
|
+
return this._client.getAPIList('/v1/api_keys', (Cursor), { query, ...options });
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* Delete an API key
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.mjs","sourceRoot":"","sources":["../src/resources/api-keys.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"api-keys.mjs","sourceRoot":"","sources":["../src/resources/api-keys.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,MAAM,EAAkC;OAC1C,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAA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