@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.cjs
CHANGED
|
@@ -17812,18 +17812,43 @@ var ConfigClient = class {
|
|
|
17812
17812
|
* (set via `_resolveManagement`) so runtime + management share one HTTP
|
|
17813
17813
|
* client; falls back to a direct GET when running without `SmplClient`
|
|
17814
17814
|
* bootstrap (e.g. unit tests that construct `ConfigClient` directly).
|
|
17815
|
+
*
|
|
17816
|
+
* Pages through the server until a short page (less than the requested
|
|
17817
|
+
* size) is returned — accounts with more than 1000 configs would
|
|
17818
|
+
* otherwise silently lose everything past page one.
|
|
17815
17819
|
*/
|
|
17816
17820
|
async _listConfigs() {
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
|
|
17821
|
+
const PAGE_SIZE = 1e3;
|
|
17822
|
+
const all = [];
|
|
17823
|
+
let page = 1;
|
|
17824
|
+
let lastPageWasFull = true;
|
|
17825
|
+
while (lastPageWasFull) {
|
|
17826
|
+
let rows;
|
|
17827
|
+
if (this._resolveManagement) {
|
|
17828
|
+
rows = await this._resolveManagement().config.list({
|
|
17829
|
+
pageNumber: page,
|
|
17830
|
+
pageSize: PAGE_SIZE
|
|
17831
|
+
});
|
|
17832
|
+
} else {
|
|
17833
|
+
const result = await this._http.GET("/api/v1/configs", {
|
|
17834
|
+
params: {
|
|
17835
|
+
query: {
|
|
17836
|
+
"page[number]": page,
|
|
17837
|
+
"page[size]": PAGE_SIZE
|
|
17838
|
+
}
|
|
17839
|
+
}
|
|
17840
|
+
});
|
|
17841
|
+
if (!result.response.ok) {
|
|
17842
|
+
throw new SmplError(`Failed to list configs: ${result.response.status}`);
|
|
17843
|
+
}
|
|
17844
|
+
const data = result.data;
|
|
17845
|
+
rows = data ? data.data.map((r) => resourceToConfig(r)) : [];
|
|
17846
|
+
}
|
|
17847
|
+
all.push(...rows);
|
|
17848
|
+
lastPageWasFull = rows.length === PAGE_SIZE;
|
|
17849
|
+
page++;
|
|
17823
17850
|
}
|
|
17824
|
-
|
|
17825
|
-
if (!data) return [];
|
|
17826
|
-
return data.data.map((r) => resourceToConfig(r));
|
|
17851
|
+
return all;
|
|
17827
17852
|
}
|
|
17828
17853
|
// ------------------------------------------------------------------
|
|
17829
17854
|
// Runtime: lazy initialization
|
|
@@ -18817,11 +18842,23 @@ var ManagementConfigClient = class {
|
|
|
18817
18842
|
updatedAt: null
|
|
18818
18843
|
});
|
|
18819
18844
|
}
|
|
18820
|
-
/**
|
|
18821
|
-
|
|
18845
|
+
/**
|
|
18846
|
+
* List configs.
|
|
18847
|
+
*
|
|
18848
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
18849
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
18850
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
18851
|
+
* customer chooses how to paginate.
|
|
18852
|
+
*/
|
|
18853
|
+
async list(params = {}) {
|
|
18854
|
+
const query = {};
|
|
18855
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
18856
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
18822
18857
|
let data;
|
|
18823
18858
|
try {
|
|
18824
|
-
const result = await this._http.GET("/api/v1/configs", {
|
|
18859
|
+
const result = await this._http.GET("/api/v1/configs", {
|
|
18860
|
+
params: { query }
|
|
18861
|
+
});
|
|
18825
18862
|
if (!result.response.ok) await checkError(result.response);
|
|
18826
18863
|
data = result.data;
|
|
18827
18864
|
} catch (err) {
|
|
@@ -19115,11 +19152,23 @@ var ManagementFlagsClient = class {
|
|
|
19115
19152
|
}
|
|
19116
19153
|
return resourceToFlag(data.data, this);
|
|
19117
19154
|
}
|
|
19118
|
-
/**
|
|
19119
|
-
|
|
19155
|
+
/**
|
|
19156
|
+
* List flags.
|
|
19157
|
+
*
|
|
19158
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
19159
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
19160
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
19161
|
+
* customer chooses how to paginate.
|
|
19162
|
+
*/
|
|
19163
|
+
async list(params = {}) {
|
|
19164
|
+
const query = {};
|
|
19165
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
19166
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
19120
19167
|
let data;
|
|
19121
19168
|
try {
|
|
19122
|
-
const result = await this._http.GET("/api/v1/flags", {
|
|
19169
|
+
const result = await this._http.GET("/api/v1/flags", {
|
|
19170
|
+
params: { query }
|
|
19171
|
+
});
|
|
19123
19172
|
if (!result.response.ok) await checkError2(result.response);
|
|
19124
19173
|
data = result.data;
|
|
19125
19174
|
} catch (err) {
|
|
@@ -19644,10 +19693,23 @@ var LoggersClient = class {
|
|
|
19644
19693
|
updatedAt: null
|
|
19645
19694
|
});
|
|
19646
19695
|
}
|
|
19647
|
-
|
|
19696
|
+
/**
|
|
19697
|
+
* List loggers.
|
|
19698
|
+
*
|
|
19699
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
19700
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
19701
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
19702
|
+
* customer chooses how to paginate.
|
|
19703
|
+
*/
|
|
19704
|
+
async list(params = {}) {
|
|
19705
|
+
const query = {};
|
|
19706
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
19707
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
19648
19708
|
let data;
|
|
19649
19709
|
try {
|
|
19650
|
-
const result = await this._http.GET("/api/v1/loggers", {
|
|
19710
|
+
const result = await this._http.GET("/api/v1/loggers", {
|
|
19711
|
+
params: { query }
|
|
19712
|
+
});
|
|
19651
19713
|
if (!result.response.ok) await checkError3(result.response);
|
|
19652
19714
|
data = result.data;
|
|
19653
19715
|
} catch (err) {
|
|
@@ -19749,10 +19811,23 @@ var LogGroupsClient = class {
|
|
|
19749
19811
|
updatedAt: null
|
|
19750
19812
|
});
|
|
19751
19813
|
}
|
|
19752
|
-
|
|
19814
|
+
/**
|
|
19815
|
+
* List log groups.
|
|
19816
|
+
*
|
|
19817
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
19818
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
19819
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
19820
|
+
* customer chooses how to paginate.
|
|
19821
|
+
*/
|
|
19822
|
+
async list(params = {}) {
|
|
19823
|
+
const query = {};
|
|
19824
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
19825
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
19753
19826
|
let data;
|
|
19754
19827
|
try {
|
|
19755
|
-
const result = await this._http.GET("/api/v1/log_groups", {
|
|
19828
|
+
const result = await this._http.GET("/api/v1/log_groups", {
|
|
19829
|
+
params: { query }
|
|
19830
|
+
});
|
|
19756
19831
|
if (!result.response.ok) await checkError3(result.response);
|
|
19757
19832
|
data = result.data;
|
|
19758
19833
|
} catch (err) {
|
|
@@ -20237,10 +20312,23 @@ var EnvironmentsClient = class {
|
|
|
20237
20312
|
updatedAt: null
|
|
20238
20313
|
});
|
|
20239
20314
|
}
|
|
20240
|
-
|
|
20315
|
+
/**
|
|
20316
|
+
* List environments.
|
|
20317
|
+
*
|
|
20318
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
20319
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
20320
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
20321
|
+
* customer chooses how to paginate.
|
|
20322
|
+
*/
|
|
20323
|
+
async list(params = {}) {
|
|
20324
|
+
const query = {};
|
|
20325
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
20326
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
20241
20327
|
let data;
|
|
20242
20328
|
try {
|
|
20243
|
-
const result = await this._http.GET("/api/v1/environments", {
|
|
20329
|
+
const result = await this._http.GET("/api/v1/environments", {
|
|
20330
|
+
params: { query }
|
|
20331
|
+
});
|
|
20244
20332
|
if (!result.response.ok) await checkError5(result.response);
|
|
20245
20333
|
data = result.data;
|
|
20246
20334
|
} catch (err) {
|
|
@@ -20348,10 +20436,23 @@ var ContextTypesClient = class {
|
|
|
20348
20436
|
updatedAt: null
|
|
20349
20437
|
});
|
|
20350
20438
|
}
|
|
20351
|
-
|
|
20439
|
+
/**
|
|
20440
|
+
* List context types.
|
|
20441
|
+
*
|
|
20442
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
20443
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
20444
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
20445
|
+
* customer chooses how to paginate.
|
|
20446
|
+
*/
|
|
20447
|
+
async list(params = {}) {
|
|
20448
|
+
const query = {};
|
|
20449
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
20450
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
20352
20451
|
let data;
|
|
20353
20452
|
try {
|
|
20354
|
-
const result = await this._http.GET("/api/v1/context_types", {
|
|
20453
|
+
const result = await this._http.GET("/api/v1/context_types", {
|
|
20454
|
+
params: { query }
|
|
20455
|
+
});
|
|
20355
20456
|
if (!result.response.ok) await checkError5(result.response);
|
|
20356
20457
|
data = result.data;
|
|
20357
20458
|
} catch (err) {
|
|
@@ -20517,12 +20618,22 @@ var ContextsClient = class {
|
|
|
20517
20618
|
get pendingCount() {
|
|
20518
20619
|
return this._buffer.pendingCount;
|
|
20519
20620
|
}
|
|
20520
|
-
/**
|
|
20521
|
-
|
|
20621
|
+
/**
|
|
20622
|
+
* List contexts of a given type.
|
|
20623
|
+
*
|
|
20624
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
20625
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
20626
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
20627
|
+
* customer chooses how to paginate.
|
|
20628
|
+
*/
|
|
20629
|
+
async list(type, params = {}) {
|
|
20630
|
+
const query = { "filter[context_type]": type };
|
|
20631
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
20632
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
20522
20633
|
let data;
|
|
20523
20634
|
try {
|
|
20524
20635
|
const result = await this._http.GET("/api/v1/contexts", {
|
|
20525
|
-
params: { query
|
|
20636
|
+
params: { query }
|
|
20526
20637
|
});
|
|
20527
20638
|
if (!result.response.ok) await checkError5(result.response);
|
|
20528
20639
|
data = result.data;
|
|
@@ -21553,19 +21664,34 @@ var FlagsClient = class {
|
|
|
21553
21664
|
}
|
|
21554
21665
|
}
|
|
21555
21666
|
async _fetchFlagsList() {
|
|
21556
|
-
|
|
21557
|
-
|
|
21558
|
-
|
|
21559
|
-
|
|
21560
|
-
|
|
21561
|
-
|
|
21562
|
-
|
|
21563
|
-
|
|
21667
|
+
const PAGE_SIZE = 1e3;
|
|
21668
|
+
const all = [];
|
|
21669
|
+
let page = 1;
|
|
21670
|
+
let lastPageWasFull = true;
|
|
21671
|
+
while (lastPageWasFull) {
|
|
21672
|
+
debug("api", `GET /api/v1/flags?page[number]=${page}&page[size]=${PAGE_SIZE}`);
|
|
21673
|
+
let data;
|
|
21674
|
+
try {
|
|
21675
|
+
const result = await this._http.GET("/api/v1/flags", {
|
|
21676
|
+
params: {
|
|
21677
|
+
query: {
|
|
21678
|
+
"page[number]": page,
|
|
21679
|
+
"page[size]": PAGE_SIZE
|
|
21680
|
+
}
|
|
21681
|
+
}
|
|
21682
|
+
});
|
|
21683
|
+
if (!result.response.ok) await checkError6(result.response, "Failed to list flags");
|
|
21684
|
+
data = result.data;
|
|
21685
|
+
} catch (err) {
|
|
21686
|
+
wrapFetchError6(err);
|
|
21687
|
+
}
|
|
21688
|
+
const rows = data?.data ?? [];
|
|
21689
|
+
for (const r of rows) all.push(this._resourceToPlainDict(r));
|
|
21690
|
+
lastPageWasFull = rows.length === PAGE_SIZE;
|
|
21691
|
+
page++;
|
|
21564
21692
|
}
|
|
21565
|
-
|
|
21566
|
-
|
|
21567
|
-
debug("api", `GET /api/v1/flags -> ${flags.length} flag(s)`);
|
|
21568
|
-
return flags;
|
|
21693
|
+
debug("api", `GET /api/v1/flags -> ${all.length} flag(s)`);
|
|
21694
|
+
return all;
|
|
21569
21695
|
}
|
|
21570
21696
|
// ------------------------------------------------------------------
|
|
21571
21697
|
// Internal: change listeners
|
|
@@ -21748,29 +21874,75 @@ var LoggingClient = class {
|
|
|
21748
21874
|
* (set via `_resolveManagement`); falls back to a direct GET when running
|
|
21749
21875
|
* without `SmplClient` bootstrap (e.g. unit tests that construct
|
|
21750
21876
|
* `LoggingClient` directly).
|
|
21877
|
+
*
|
|
21878
|
+
* Pages through the server until a short page (less than the requested
|
|
21879
|
+
* size) is returned — accounts with more than 1000 loggers would
|
|
21880
|
+
* otherwise silently lose everything past page one.
|
|
21751
21881
|
*/
|
|
21752
21882
|
async _listLoggers() {
|
|
21753
|
-
|
|
21754
|
-
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
|
|
21758
|
-
|
|
21883
|
+
const PAGE_SIZE = 1e3;
|
|
21884
|
+
const all = [];
|
|
21885
|
+
let page = 1;
|
|
21886
|
+
let lastPageWasFull = true;
|
|
21887
|
+
while (lastPageWasFull) {
|
|
21888
|
+
let rows;
|
|
21889
|
+
if (this._resolveManagement) {
|
|
21890
|
+
rows = await this._resolveManagement().loggers.list({
|
|
21891
|
+
pageNumber: page,
|
|
21892
|
+
pageSize: PAGE_SIZE
|
|
21893
|
+
});
|
|
21894
|
+
} else {
|
|
21895
|
+
const result = await this._http.GET("/api/v1/loggers", {
|
|
21896
|
+
params: {
|
|
21897
|
+
query: {
|
|
21898
|
+
"page[number]": page,
|
|
21899
|
+
"page[size]": PAGE_SIZE
|
|
21900
|
+
}
|
|
21901
|
+
}
|
|
21902
|
+
});
|
|
21903
|
+
if (result.error !== void 0) {
|
|
21904
|
+
throw new SmplError(`Failed to list loggers: ${result.response.status}`);
|
|
21905
|
+
}
|
|
21906
|
+
rows = result.data ? result.data.data.map((r) => this._loggerToModel(r)) : [];
|
|
21907
|
+
}
|
|
21908
|
+
all.push(...rows);
|
|
21909
|
+
lastPageWasFull = rows.length === PAGE_SIZE;
|
|
21910
|
+
page++;
|
|
21759
21911
|
}
|
|
21760
|
-
|
|
21761
|
-
return result.data.data.map((r) => this._loggerToModel(r));
|
|
21912
|
+
return all;
|
|
21762
21913
|
}
|
|
21763
21914
|
/** @internal — see {@link _listLoggers}. */
|
|
21764
21915
|
async _listLogGroups() {
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21916
|
+
const PAGE_SIZE = 1e3;
|
|
21917
|
+
const all = [];
|
|
21918
|
+
let page = 1;
|
|
21919
|
+
let lastPageWasFull = true;
|
|
21920
|
+
while (lastPageWasFull) {
|
|
21921
|
+
let rows;
|
|
21922
|
+
if (this._resolveManagement) {
|
|
21923
|
+
rows = await this._resolveManagement().logGroups.list({
|
|
21924
|
+
pageNumber: page,
|
|
21925
|
+
pageSize: PAGE_SIZE
|
|
21926
|
+
});
|
|
21927
|
+
} else {
|
|
21928
|
+
const result = await this._http.GET("/api/v1/log_groups", {
|
|
21929
|
+
params: {
|
|
21930
|
+
query: {
|
|
21931
|
+
"page[number]": page,
|
|
21932
|
+
"page[size]": PAGE_SIZE
|
|
21933
|
+
}
|
|
21934
|
+
}
|
|
21935
|
+
});
|
|
21936
|
+
if (result.error !== void 0) {
|
|
21937
|
+
throw new SmplError(`Failed to list log groups: ${result.response.status}`);
|
|
21938
|
+
}
|
|
21939
|
+
rows = result.data ? result.data.data.map((r) => this._groupToModel(r)) : [];
|
|
21940
|
+
}
|
|
21941
|
+
all.push(...rows);
|
|
21942
|
+
lastPageWasFull = rows.length === PAGE_SIZE;
|
|
21943
|
+
page++;
|
|
21771
21944
|
}
|
|
21772
|
-
|
|
21773
|
-
return result.data.data.map((r) => this._groupToModel(r));
|
|
21945
|
+
return all;
|
|
21774
21946
|
}
|
|
21775
21947
|
// ------------------------------------------------------------------
|
|
21776
21948
|
// Runtime: install
|