@smplkit/sdk 3.0.48 → 3.0.49
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/dist/index.cjs +226 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -10
- package/dist/index.d.ts +92 -10
- package/dist/index.js +226 -54
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17742,18 +17742,43 @@ var ConfigClient = class {
|
|
|
17742
17742
|
* (set via `_resolveManagement`) so runtime + management share one HTTP
|
|
17743
17743
|
* client; falls back to a direct GET when running without `SmplClient`
|
|
17744
17744
|
* bootstrap (e.g. unit tests that construct `ConfigClient` directly).
|
|
17745
|
+
*
|
|
17746
|
+
* Pages through the server until a short page (less than the requested
|
|
17747
|
+
* size) is returned — accounts with more than 1000 configs would
|
|
17748
|
+
* otherwise silently lose everything past page one.
|
|
17745
17749
|
*/
|
|
17746
17750
|
async _listConfigs() {
|
|
17747
|
-
|
|
17748
|
-
|
|
17749
|
-
|
|
17750
|
-
|
|
17751
|
-
|
|
17752
|
-
|
|
17751
|
+
const PAGE_SIZE = 1e3;
|
|
17752
|
+
const all = [];
|
|
17753
|
+
let page = 1;
|
|
17754
|
+
let lastPageWasFull = true;
|
|
17755
|
+
while (lastPageWasFull) {
|
|
17756
|
+
let rows;
|
|
17757
|
+
if (this._resolveManagement) {
|
|
17758
|
+
rows = await this._resolveManagement().config.list({
|
|
17759
|
+
pageNumber: page,
|
|
17760
|
+
pageSize: PAGE_SIZE
|
|
17761
|
+
});
|
|
17762
|
+
} else {
|
|
17763
|
+
const result = await this._http.GET("/api/v1/configs", {
|
|
17764
|
+
params: {
|
|
17765
|
+
query: {
|
|
17766
|
+
"page[number]": page,
|
|
17767
|
+
"page[size]": PAGE_SIZE
|
|
17768
|
+
}
|
|
17769
|
+
}
|
|
17770
|
+
});
|
|
17771
|
+
if (!result.response.ok) {
|
|
17772
|
+
throw new SmplError(`Failed to list configs: ${result.response.status}`);
|
|
17773
|
+
}
|
|
17774
|
+
const data = result.data;
|
|
17775
|
+
rows = data ? data.data.map((r) => resourceToConfig(r)) : [];
|
|
17776
|
+
}
|
|
17777
|
+
all.push(...rows);
|
|
17778
|
+
lastPageWasFull = rows.length === PAGE_SIZE;
|
|
17779
|
+
page++;
|
|
17753
17780
|
}
|
|
17754
|
-
|
|
17755
|
-
if (!data) return [];
|
|
17756
|
-
return data.data.map((r) => resourceToConfig(r));
|
|
17781
|
+
return all;
|
|
17757
17782
|
}
|
|
17758
17783
|
// ------------------------------------------------------------------
|
|
17759
17784
|
// Runtime: lazy initialization
|
|
@@ -18747,11 +18772,23 @@ var ManagementConfigClient = class {
|
|
|
18747
18772
|
updatedAt: null
|
|
18748
18773
|
});
|
|
18749
18774
|
}
|
|
18750
|
-
/**
|
|
18751
|
-
|
|
18775
|
+
/**
|
|
18776
|
+
* List configs.
|
|
18777
|
+
*
|
|
18778
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
18779
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
18780
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
18781
|
+
* customer chooses how to paginate.
|
|
18782
|
+
*/
|
|
18783
|
+
async list(params = {}) {
|
|
18784
|
+
const query = {};
|
|
18785
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
18786
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
18752
18787
|
let data;
|
|
18753
18788
|
try {
|
|
18754
|
-
const result = await this._http.GET("/api/v1/configs", {
|
|
18789
|
+
const result = await this._http.GET("/api/v1/configs", {
|
|
18790
|
+
params: { query }
|
|
18791
|
+
});
|
|
18755
18792
|
if (!result.response.ok) await checkError(result.response);
|
|
18756
18793
|
data = result.data;
|
|
18757
18794
|
} catch (err) {
|
|
@@ -19045,11 +19082,23 @@ var ManagementFlagsClient = class {
|
|
|
19045
19082
|
}
|
|
19046
19083
|
return resourceToFlag(data.data, this);
|
|
19047
19084
|
}
|
|
19048
|
-
/**
|
|
19049
|
-
|
|
19085
|
+
/**
|
|
19086
|
+
* List flags.
|
|
19087
|
+
*
|
|
19088
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
19089
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
19090
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
19091
|
+
* customer chooses how to paginate.
|
|
19092
|
+
*/
|
|
19093
|
+
async list(params = {}) {
|
|
19094
|
+
const query = {};
|
|
19095
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
19096
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
19050
19097
|
let data;
|
|
19051
19098
|
try {
|
|
19052
|
-
const result = await this._http.GET("/api/v1/flags", {
|
|
19099
|
+
const result = await this._http.GET("/api/v1/flags", {
|
|
19100
|
+
params: { query }
|
|
19101
|
+
});
|
|
19053
19102
|
if (!result.response.ok) await checkError2(result.response);
|
|
19054
19103
|
data = result.data;
|
|
19055
19104
|
} catch (err) {
|
|
@@ -19574,10 +19623,23 @@ var LoggersClient = class {
|
|
|
19574
19623
|
updatedAt: null
|
|
19575
19624
|
});
|
|
19576
19625
|
}
|
|
19577
|
-
|
|
19626
|
+
/**
|
|
19627
|
+
* List loggers.
|
|
19628
|
+
*
|
|
19629
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
19630
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
19631
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
19632
|
+
* customer chooses how to paginate.
|
|
19633
|
+
*/
|
|
19634
|
+
async list(params = {}) {
|
|
19635
|
+
const query = {};
|
|
19636
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
19637
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
19578
19638
|
let data;
|
|
19579
19639
|
try {
|
|
19580
|
-
const result = await this._http.GET("/api/v1/loggers", {
|
|
19640
|
+
const result = await this._http.GET("/api/v1/loggers", {
|
|
19641
|
+
params: { query }
|
|
19642
|
+
});
|
|
19581
19643
|
if (!result.response.ok) await checkError3(result.response);
|
|
19582
19644
|
data = result.data;
|
|
19583
19645
|
} catch (err) {
|
|
@@ -19679,10 +19741,23 @@ var LogGroupsClient = class {
|
|
|
19679
19741
|
updatedAt: null
|
|
19680
19742
|
});
|
|
19681
19743
|
}
|
|
19682
|
-
|
|
19744
|
+
/**
|
|
19745
|
+
* List log groups.
|
|
19746
|
+
*
|
|
19747
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
19748
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
19749
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
19750
|
+
* customer chooses how to paginate.
|
|
19751
|
+
*/
|
|
19752
|
+
async list(params = {}) {
|
|
19753
|
+
const query = {};
|
|
19754
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
19755
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
19683
19756
|
let data;
|
|
19684
19757
|
try {
|
|
19685
|
-
const result = await this._http.GET("/api/v1/log_groups", {
|
|
19758
|
+
const result = await this._http.GET("/api/v1/log_groups", {
|
|
19759
|
+
params: { query }
|
|
19760
|
+
});
|
|
19686
19761
|
if (!result.response.ok) await checkError3(result.response);
|
|
19687
19762
|
data = result.data;
|
|
19688
19763
|
} catch (err) {
|
|
@@ -20167,10 +20242,23 @@ var EnvironmentsClient = class {
|
|
|
20167
20242
|
updatedAt: null
|
|
20168
20243
|
});
|
|
20169
20244
|
}
|
|
20170
|
-
|
|
20245
|
+
/**
|
|
20246
|
+
* List environments.
|
|
20247
|
+
*
|
|
20248
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
20249
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
20250
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
20251
|
+
* customer chooses how to paginate.
|
|
20252
|
+
*/
|
|
20253
|
+
async list(params = {}) {
|
|
20254
|
+
const query = {};
|
|
20255
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
20256
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
20171
20257
|
let data;
|
|
20172
20258
|
try {
|
|
20173
|
-
const result = await this._http.GET("/api/v1/environments", {
|
|
20259
|
+
const result = await this._http.GET("/api/v1/environments", {
|
|
20260
|
+
params: { query }
|
|
20261
|
+
});
|
|
20174
20262
|
if (!result.response.ok) await checkError5(result.response);
|
|
20175
20263
|
data = result.data;
|
|
20176
20264
|
} catch (err) {
|
|
@@ -20278,10 +20366,23 @@ var ContextTypesClient = class {
|
|
|
20278
20366
|
updatedAt: null
|
|
20279
20367
|
});
|
|
20280
20368
|
}
|
|
20281
|
-
|
|
20369
|
+
/**
|
|
20370
|
+
* List context types.
|
|
20371
|
+
*
|
|
20372
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
20373
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
20374
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
20375
|
+
* customer chooses how to paginate.
|
|
20376
|
+
*/
|
|
20377
|
+
async list(params = {}) {
|
|
20378
|
+
const query = {};
|
|
20379
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
20380
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
20282
20381
|
let data;
|
|
20283
20382
|
try {
|
|
20284
|
-
const result = await this._http.GET("/api/v1/context_types", {
|
|
20383
|
+
const result = await this._http.GET("/api/v1/context_types", {
|
|
20384
|
+
params: { query }
|
|
20385
|
+
});
|
|
20285
20386
|
if (!result.response.ok) await checkError5(result.response);
|
|
20286
20387
|
data = result.data;
|
|
20287
20388
|
} catch (err) {
|
|
@@ -20447,12 +20548,22 @@ var ContextsClient = class {
|
|
|
20447
20548
|
get pendingCount() {
|
|
20448
20549
|
return this._buffer.pendingCount;
|
|
20449
20550
|
}
|
|
20450
|
-
/**
|
|
20451
|
-
|
|
20551
|
+
/**
|
|
20552
|
+
* List contexts of a given type.
|
|
20553
|
+
*
|
|
20554
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
20555
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
20556
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
20557
|
+
* customer chooses how to paginate.
|
|
20558
|
+
*/
|
|
20559
|
+
async list(type, params = {}) {
|
|
20560
|
+
const query = { "filter[context_type]": type };
|
|
20561
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
20562
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
20452
20563
|
let data;
|
|
20453
20564
|
try {
|
|
20454
20565
|
const result = await this._http.GET("/api/v1/contexts", {
|
|
20455
|
-
params: { query
|
|
20566
|
+
params: { query }
|
|
20456
20567
|
});
|
|
20457
20568
|
if (!result.response.ok) await checkError5(result.response);
|
|
20458
20569
|
data = result.data;
|
|
@@ -21483,19 +21594,34 @@ var FlagsClient = class {
|
|
|
21483
21594
|
}
|
|
21484
21595
|
}
|
|
21485
21596
|
async _fetchFlagsList() {
|
|
21486
|
-
|
|
21487
|
-
|
|
21488
|
-
|
|
21489
|
-
|
|
21490
|
-
|
|
21491
|
-
|
|
21492
|
-
|
|
21493
|
-
|
|
21597
|
+
const PAGE_SIZE = 1e3;
|
|
21598
|
+
const all = [];
|
|
21599
|
+
let page = 1;
|
|
21600
|
+
let lastPageWasFull = true;
|
|
21601
|
+
while (lastPageWasFull) {
|
|
21602
|
+
debug("api", `GET /api/v1/flags?page[number]=${page}&page[size]=${PAGE_SIZE}`);
|
|
21603
|
+
let data;
|
|
21604
|
+
try {
|
|
21605
|
+
const result = await this._http.GET("/api/v1/flags", {
|
|
21606
|
+
params: {
|
|
21607
|
+
query: {
|
|
21608
|
+
"page[number]": page,
|
|
21609
|
+
"page[size]": PAGE_SIZE
|
|
21610
|
+
}
|
|
21611
|
+
}
|
|
21612
|
+
});
|
|
21613
|
+
if (!result.response.ok) await checkError6(result.response, "Failed to list flags");
|
|
21614
|
+
data = result.data;
|
|
21615
|
+
} catch (err) {
|
|
21616
|
+
wrapFetchError6(err);
|
|
21617
|
+
}
|
|
21618
|
+
const rows = data?.data ?? [];
|
|
21619
|
+
for (const r of rows) all.push(this._resourceToPlainDict(r));
|
|
21620
|
+
lastPageWasFull = rows.length === PAGE_SIZE;
|
|
21621
|
+
page++;
|
|
21494
21622
|
}
|
|
21495
|
-
|
|
21496
|
-
|
|
21497
|
-
debug("api", `GET /api/v1/flags -> ${flags.length} flag(s)`);
|
|
21498
|
-
return flags;
|
|
21623
|
+
debug("api", `GET /api/v1/flags -> ${all.length} flag(s)`);
|
|
21624
|
+
return all;
|
|
21499
21625
|
}
|
|
21500
21626
|
// ------------------------------------------------------------------
|
|
21501
21627
|
// Internal: change listeners
|
|
@@ -21678,29 +21804,75 @@ var LoggingClient = class {
|
|
|
21678
21804
|
* (set via `_resolveManagement`); falls back to a direct GET when running
|
|
21679
21805
|
* without `SmplClient` bootstrap (e.g. unit tests that construct
|
|
21680
21806
|
* `LoggingClient` directly).
|
|
21807
|
+
*
|
|
21808
|
+
* Pages through the server until a short page (less than the requested
|
|
21809
|
+
* size) is returned — accounts with more than 1000 loggers would
|
|
21810
|
+
* otherwise silently lose everything past page one.
|
|
21681
21811
|
*/
|
|
21682
21812
|
async _listLoggers() {
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
|
|
21686
|
-
|
|
21687
|
-
|
|
21688
|
-
|
|
21813
|
+
const PAGE_SIZE = 1e3;
|
|
21814
|
+
const all = [];
|
|
21815
|
+
let page = 1;
|
|
21816
|
+
let lastPageWasFull = true;
|
|
21817
|
+
while (lastPageWasFull) {
|
|
21818
|
+
let rows;
|
|
21819
|
+
if (this._resolveManagement) {
|
|
21820
|
+
rows = await this._resolveManagement().loggers.list({
|
|
21821
|
+
pageNumber: page,
|
|
21822
|
+
pageSize: PAGE_SIZE
|
|
21823
|
+
});
|
|
21824
|
+
} else {
|
|
21825
|
+
const result = await this._http.GET("/api/v1/loggers", {
|
|
21826
|
+
params: {
|
|
21827
|
+
query: {
|
|
21828
|
+
"page[number]": page,
|
|
21829
|
+
"page[size]": PAGE_SIZE
|
|
21830
|
+
}
|
|
21831
|
+
}
|
|
21832
|
+
});
|
|
21833
|
+
if (result.error !== void 0) {
|
|
21834
|
+
throw new SmplError(`Failed to list loggers: ${result.response.status}`);
|
|
21835
|
+
}
|
|
21836
|
+
rows = result.data ? result.data.data.map((r) => this._loggerToModel(r)) : [];
|
|
21837
|
+
}
|
|
21838
|
+
all.push(...rows);
|
|
21839
|
+
lastPageWasFull = rows.length === PAGE_SIZE;
|
|
21840
|
+
page++;
|
|
21689
21841
|
}
|
|
21690
|
-
|
|
21691
|
-
return result.data.data.map((r) => this._loggerToModel(r));
|
|
21842
|
+
return all;
|
|
21692
21843
|
}
|
|
21693
21844
|
/** @internal — see {@link _listLoggers}. */
|
|
21694
21845
|
async _listLogGroups() {
|
|
21695
|
-
|
|
21696
|
-
|
|
21697
|
-
|
|
21698
|
-
|
|
21699
|
-
|
|
21700
|
-
|
|
21846
|
+
const PAGE_SIZE = 1e3;
|
|
21847
|
+
const all = [];
|
|
21848
|
+
let page = 1;
|
|
21849
|
+
let lastPageWasFull = true;
|
|
21850
|
+
while (lastPageWasFull) {
|
|
21851
|
+
let rows;
|
|
21852
|
+
if (this._resolveManagement) {
|
|
21853
|
+
rows = await this._resolveManagement().logGroups.list({
|
|
21854
|
+
pageNumber: page,
|
|
21855
|
+
pageSize: PAGE_SIZE
|
|
21856
|
+
});
|
|
21857
|
+
} else {
|
|
21858
|
+
const result = await this._http.GET("/api/v1/log_groups", {
|
|
21859
|
+
params: {
|
|
21860
|
+
query: {
|
|
21861
|
+
"page[number]": page,
|
|
21862
|
+
"page[size]": PAGE_SIZE
|
|
21863
|
+
}
|
|
21864
|
+
}
|
|
21865
|
+
});
|
|
21866
|
+
if (result.error !== void 0) {
|
|
21867
|
+
throw new SmplError(`Failed to list log groups: ${result.response.status}`);
|
|
21868
|
+
}
|
|
21869
|
+
rows = result.data ? result.data.data.map((r) => this._groupToModel(r)) : [];
|
|
21870
|
+
}
|
|
21871
|
+
all.push(...rows);
|
|
21872
|
+
lastPageWasFull = rows.length === PAGE_SIZE;
|
|
21873
|
+
page++;
|
|
21701
21874
|
}
|
|
21702
|
-
|
|
21703
|
-
return result.data.data.map((r) => this._groupToModel(r));
|
|
21875
|
+
return all;
|
|
21704
21876
|
}
|
|
21705
21877
|
// ------------------------------------------------------------------
|
|
21706
21878
|
// Runtime: install
|