@smplkit/sdk 3.0.82 → 3.0.84

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 CHANGED
@@ -16767,9 +16767,11 @@ function parseJsonApiErrors(body) {
16767
16767
  if (parsed && Array.isArray(parsed.errors)) {
16768
16768
  return parsed.errors.map((e) => ({
16769
16769
  ...e.status !== void 0 ? { status: String(e.status) } : {},
16770
+ ...e.code !== void 0 ? { code: String(e.code) } : {},
16770
16771
  ...e.title !== void 0 ? { title: String(e.title) } : {},
16771
16772
  ...e.detail !== void 0 ? { detail: String(e.detail) } : {},
16772
- ...e.source !== void 0 && typeof e.source === "object" && e.source !== null ? { source: e.source } : {}
16773
+ ...e.source !== void 0 && typeof e.source === "object" && e.source !== null ? { source: e.source } : {},
16774
+ ...e.meta !== void 0 && typeof e.meta === "object" && e.meta !== null ? { meta: e.meta } : {}
16773
16775
  }));
16774
16776
  }
16775
16777
  } catch {
@@ -18579,7 +18581,7 @@ var Environment = class {
18579
18581
  * environment. Unmanaged environments are view-only — existing values
18580
18582
  * render for comparison but no new values can be set. Managed
18581
18583
  * environments count toward the account's `platform.managed_environments`
18582
- * quota.
18584
+ * quota. `production` is always managed and cannot be demoted.
18583
18585
  */
18584
18586
  managed;
18585
18587
  /** When the environment was created. */
@@ -18965,8 +18967,17 @@ function wrapFetchError(err) {
18965
18967
  `Request failed: ${err instanceof Error ? err.message : String(err)}`
18966
18968
  );
18967
18969
  }
18968
- async function checkError(response) {
18969
- const body = await response.text().catch(() => "");
18970
+ async function checkError(response, error) {
18971
+ let body = "";
18972
+ if (error !== void 0 && error !== null) {
18973
+ try {
18974
+ body = typeof error === "string" ? error : JSON.stringify(error);
18975
+ } catch {
18976
+ }
18977
+ }
18978
+ if (!body) {
18979
+ body = await response.text().catch(() => "");
18980
+ }
18970
18981
  throwForStatus(response.status, body);
18971
18982
  }
18972
18983
  function buildBody(config) {
@@ -19121,7 +19132,7 @@ var ManagementConfigClient = class {
19121
19132
  const result = await this._http.GET("/api/v1/configs", {
19122
19133
  params: { query }
19123
19134
  });
19124
- if (!result.response.ok) await checkError(result.response);
19135
+ if (!result.response.ok) await checkError(result.response, result.error);
19125
19136
  data = result.data;
19126
19137
  } catch (err) {
19127
19138
  wrapFetchError(err);
@@ -19136,7 +19147,7 @@ var ManagementConfigClient = class {
19136
19147
  const result = await this._http.GET("/api/v1/configs/{id}", {
19137
19148
  params: { path: { id } }
19138
19149
  });
19139
- if (!result.response.ok) await checkError(result.response);
19150
+ if (!result.response.ok) await checkError(result.response, result.error);
19140
19151
  data = result.data;
19141
19152
  } catch (err) {
19142
19153
  wrapFetchError(err);
@@ -19157,7 +19168,7 @@ var ManagementConfigClient = class {
19157
19168
  params: { path: { id } }
19158
19169
  });
19159
19170
  if (!result.response.ok && result.response.status !== 204) {
19160
- await checkError(result.response);
19171
+ await checkError(result.response, result.error);
19161
19172
  }
19162
19173
  } catch (err) {
19163
19174
  wrapFetchError(err);
@@ -19173,7 +19184,7 @@ var ManagementConfigClient = class {
19173
19184
  let data;
19174
19185
  try {
19175
19186
  const result = await this._http.POST("/api/v1/configs", { body });
19176
- if (!result.response.ok) await checkError(result.response);
19187
+ if (!result.response.ok) await checkError(result.response, result.error);
19177
19188
  data = result.data;
19178
19189
  } catch (err) {
19179
19190
  wrapFetchError(err);
@@ -19191,7 +19202,7 @@ var ManagementConfigClient = class {
19191
19202
  params: { path: { id: config.id } },
19192
19203
  body
19193
19204
  });
19194
- if (!result.response.ok) await checkError(result.response);
19205
+ if (!result.response.ok) await checkError(result.response, result.error);
19195
19206
  data = result.data;
19196
19207
  } catch (err) {
19197
19208
  wrapFetchError(err);
@@ -19205,8 +19216,17 @@ var ManagementConfigClient = class {
19205
19216
 
19206
19217
  // src/management/flags.ts
19207
19218
  var FLAG_REGISTRATION_FLUSH_SIZE = 50;
19208
- async function checkError2(response) {
19209
- const body = await response.text().catch(() => "");
19219
+ async function checkError2(response, error) {
19220
+ let body = "";
19221
+ if (error !== void 0 && error !== null) {
19222
+ try {
19223
+ body = typeof error === "string" ? error : JSON.stringify(error);
19224
+ } catch {
19225
+ }
19226
+ }
19227
+ if (!body) {
19228
+ body = await response.text().catch(() => "");
19229
+ }
19210
19230
  throwForStatus(response.status, body);
19211
19231
  }
19212
19232
  function wrapFetchError2(err) {
@@ -19404,7 +19424,7 @@ var ManagementFlagsClient = class {
19404
19424
  const result = await this._http.GET("/api/v1/flags/{id}", {
19405
19425
  params: { path: { id } }
19406
19426
  });
19407
- if (!result.response.ok) await checkError2(result.response);
19427
+ if (!result.response.ok) await checkError2(result.response, result.error);
19408
19428
  data = result.data;
19409
19429
  } catch (err) {
19410
19430
  wrapFetchError2(err);
@@ -19431,7 +19451,7 @@ var ManagementFlagsClient = class {
19431
19451
  const result = await this._http.GET("/api/v1/flags", {
19432
19452
  params: { query }
19433
19453
  });
19434
- if (!result.response.ok) await checkError2(result.response);
19454
+ if (!result.response.ok) await checkError2(result.response, result.error);
19435
19455
  data = result.data;
19436
19456
  } catch (err) {
19437
19457
  wrapFetchError2(err);
@@ -19450,7 +19470,7 @@ var ManagementFlagsClient = class {
19450
19470
  params: { path: { id } }
19451
19471
  });
19452
19472
  if (!result.response.ok && result.response.status !== 204) {
19453
- await checkError2(result.response);
19473
+ await checkError2(result.response, result.error);
19454
19474
  }
19455
19475
  } catch (err) {
19456
19476
  wrapFetchError2(err);
@@ -19495,7 +19515,7 @@ var ManagementFlagsClient = class {
19495
19515
  let data;
19496
19516
  try {
19497
19517
  const result = await this._http.POST("/api/v1/flags", { body });
19498
- if (!result.response.ok) await checkError2(result.response);
19518
+ if (!result.response.ok) await checkError2(result.response, result.error);
19499
19519
  data = result.data;
19500
19520
  } catch (err) {
19501
19521
  wrapFetchError2(err);
@@ -19513,7 +19533,7 @@ var ManagementFlagsClient = class {
19513
19533
  params: { path: { id: flag.id } },
19514
19534
  body
19515
19535
  });
19516
- if (!result.response.ok) await checkError2(result.response);
19536
+ if (!result.response.ok) await checkError2(result.response, result.error);
19517
19537
  data = result.data;
19518
19538
  } catch (err) {
19519
19539
  wrapFetchError2(err);
@@ -19833,8 +19853,17 @@ var LogGroup = class {
19833
19853
 
19834
19854
  // src/management/logging.ts
19835
19855
  var LOGGER_REGISTRATION_FLUSH_SIZE = 50;
19836
- async function checkError3(response) {
19837
- const body = await response.text().catch(() => "");
19856
+ async function checkError3(response, error) {
19857
+ let body = "";
19858
+ if (error !== void 0 && error !== null) {
19859
+ try {
19860
+ body = typeof error === "string" ? error : JSON.stringify(error);
19861
+ } catch {
19862
+ }
19863
+ }
19864
+ if (!body) {
19865
+ body = await response.text().catch(() => "");
19866
+ }
19838
19867
  throwForStatus(response.status, body);
19839
19868
  }
19840
19869
  function wrapFetchError3(err) {
@@ -19969,7 +19998,7 @@ var LoggersClient = class {
19969
19998
  const result = await this._http.GET("/api/v1/loggers", {
19970
19999
  params: { query }
19971
20000
  });
19972
- if (!result.response.ok) await checkError3(result.response);
20001
+ if (!result.response.ok) await checkError3(result.response, result.error);
19973
20002
  data = result.data;
19974
20003
  } catch (err) {
19975
20004
  wrapFetchError3(err);
@@ -19983,7 +20012,7 @@ var LoggersClient = class {
19983
20012
  const result = await this._http.GET("/api/v1/loggers/{id}", {
19984
20013
  params: { path: { id } }
19985
20014
  });
19986
- if (!result.response.ok) await checkError3(result.response);
20015
+ if (!result.response.ok) await checkError3(result.response, result.error);
19987
20016
  data = result.data;
19988
20017
  } catch (err) {
19989
20018
  wrapFetchError3(err);
@@ -20003,7 +20032,7 @@ var LoggersClient = class {
20003
20032
  params: { path: { id } }
20004
20033
  });
20005
20034
  if (!result.response.ok && result.response.status !== 204) {
20006
- await checkError3(result.response);
20035
+ await checkError3(result.response, result.error);
20007
20036
  }
20008
20037
  } catch (err) {
20009
20038
  wrapFetchError3(err);
@@ -20044,7 +20073,7 @@ var LoggersClient = class {
20044
20073
  params: { path: { id: logger.id } },
20045
20074
  body
20046
20075
  });
20047
- if (!result.response.ok) await checkError3(result.response);
20076
+ if (!result.response.ok) await checkError3(result.response, result.error);
20048
20077
  data = result.data;
20049
20078
  } catch (err) {
20050
20079
  wrapFetchError3(err);
@@ -20087,7 +20116,7 @@ var LogGroupsClient = class {
20087
20116
  const result = await this._http.GET("/api/v1/log_groups", {
20088
20117
  params: { query }
20089
20118
  });
20090
- if (!result.response.ok) await checkError3(result.response);
20119
+ if (!result.response.ok) await checkError3(result.response, result.error);
20091
20120
  data = result.data;
20092
20121
  } catch (err) {
20093
20122
  wrapFetchError3(err);
@@ -20101,7 +20130,7 @@ var LogGroupsClient = class {
20101
20130
  const result = await this._http.GET("/api/v1/log_groups/{id}", {
20102
20131
  params: { path: { id } }
20103
20132
  });
20104
- if (!result.response.ok) await checkError3(result.response);
20133
+ if (!result.response.ok) await checkError3(result.response, result.error);
20105
20134
  data = result.data;
20106
20135
  } catch (err) {
20107
20136
  wrapFetchError3(err);
@@ -20121,7 +20150,7 @@ var LogGroupsClient = class {
20121
20150
  params: { path: { id } }
20122
20151
  });
20123
20152
  if (!result.response.ok && result.response.status !== 204) {
20124
- await checkError3(result.response);
20153
+ await checkError3(result.response, result.error);
20125
20154
  }
20126
20155
  } catch (err) {
20127
20156
  wrapFetchError3(err);
@@ -20138,7 +20167,7 @@ var LogGroupsClient = class {
20138
20167
  let data;
20139
20168
  try {
20140
20169
  const result = await this._http.POST("/api/v1/log_groups", { body });
20141
- if (!result.response.ok) await checkError3(result.response);
20170
+ if (!result.response.ok) await checkError3(result.response, result.error);
20142
20171
  data = result.data;
20143
20172
  } catch (err) {
20144
20173
  wrapFetchError3(err);
@@ -20156,7 +20185,7 @@ var LogGroupsClient = class {
20156
20185
  params: { path: { id: group.id } },
20157
20186
  body
20158
20187
  });
20159
- if (!result.response.ok) await checkError3(result.response);
20188
+ if (!result.response.ok) await checkError3(result.response, result.error);
20160
20189
  data = result.data;
20161
20190
  } catch (err) {
20162
20191
  wrapFetchError3(err);
@@ -20305,8 +20334,17 @@ var Forwarder = class {
20305
20334
  };
20306
20335
 
20307
20336
  // src/management/audit.ts
20308
- async function checkError4(response) {
20309
- const body = await response.text().catch(() => "");
20337
+ async function checkError4(response, error) {
20338
+ let body = "";
20339
+ if (error !== void 0 && error !== null) {
20340
+ try {
20341
+ body = typeof error === "string" ? error : JSON.stringify(error);
20342
+ } catch {
20343
+ }
20344
+ }
20345
+ if (!body) {
20346
+ body = await response.text().catch(() => "");
20347
+ }
20310
20348
  throwForStatus(response.status, body);
20311
20349
  }
20312
20350
  function wrapFetchError4(err) {
@@ -20462,7 +20500,7 @@ var ForwardersClient = class {
20462
20500
  const result = await this._http.GET("/api/v1/forwarders", {
20463
20501
  params: { query }
20464
20502
  });
20465
- if (!result.response.ok) await checkError4(result.response);
20503
+ if (!result.response.ok) await checkError4(result.response, result.error);
20466
20504
  data = result.data;
20467
20505
  } catch (err) {
20468
20506
  wrapFetchError4(err);
@@ -20483,7 +20521,7 @@ var ForwardersClient = class {
20483
20521
  const result = await this._http.GET("/api/v1/forwarders/{forwarder_id}", {
20484
20522
  params: { path: { forwarder_id: forwarderId } }
20485
20523
  });
20486
- if (!result.response.ok) await checkError4(result.response);
20524
+ if (!result.response.ok) await checkError4(result.response, result.error);
20487
20525
  data = result.data;
20488
20526
  } catch (err) {
20489
20527
  wrapFetchError4(err);
@@ -20497,7 +20535,7 @@ var ForwardersClient = class {
20497
20535
  const result = await this._http.DELETE("/api/v1/forwarders/{forwarder_id}", {
20498
20536
  params: { path: { forwarder_id: forwarderId } }
20499
20537
  });
20500
- if (result.response.status !== 204) await checkError4(result.response);
20538
+ if (result.response.status !== 204) await checkError4(result.response, result.error);
20501
20539
  } catch (err) {
20502
20540
  wrapFetchError4(err);
20503
20541
  }
@@ -20512,7 +20550,7 @@ var ForwardersClient = class {
20512
20550
  let data;
20513
20551
  try {
20514
20552
  const result = await this._http.POST("/api/v1/forwarders", { body });
20515
- if (!result.response.ok) await checkError4(result.response);
20553
+ if (!result.response.ok) await checkError4(result.response, result.error);
20516
20554
  data = result.data;
20517
20555
  } catch (err) {
20518
20556
  wrapFetchError4(err);
@@ -20539,7 +20577,7 @@ var ForwardersClient = class {
20539
20577
  params: { path: { forwarder_id: forwarder.id } },
20540
20578
  body
20541
20579
  });
20542
- if (!result.response.ok) await checkError4(result.response);
20580
+ if (!result.response.ok) await checkError4(result.response, result.error);
20543
20581
  data = result.data;
20544
20582
  } catch (err) {
20545
20583
  wrapFetchError4(err);
@@ -20702,8 +20740,17 @@ function splitContextId(idOrType, key) {
20702
20740
  }
20703
20741
  return [idOrType, key];
20704
20742
  }
20705
- async function checkError5(response) {
20706
- const body = await response.text().catch(() => "");
20743
+ async function checkError5(response, error) {
20744
+ let body = "";
20745
+ if (error !== void 0 && error !== null) {
20746
+ try {
20747
+ body = typeof error === "string" ? error : JSON.stringify(error);
20748
+ } catch {
20749
+ }
20750
+ }
20751
+ if (!body) {
20752
+ body = await response.text().catch(() => "");
20753
+ }
20707
20754
  throwForStatus(response.status, body);
20708
20755
  }
20709
20756
  function wrapFetchError5(err) {
@@ -20804,7 +20851,7 @@ var EnvironmentsClient = class {
20804
20851
  const result = await this._http.GET("/api/v1/environments", {
20805
20852
  params: { query }
20806
20853
  });
20807
- if (!result.response.ok) await checkError5(result.response);
20854
+ if (!result.response.ok) await checkError5(result.response, result.error);
20808
20855
  data = result.data;
20809
20856
  } catch (err) {
20810
20857
  wrapFetchError5(err);
@@ -20818,7 +20865,7 @@ var EnvironmentsClient = class {
20818
20865
  const result = await this._http.GET("/api/v1/environments/{id}", {
20819
20866
  params: { path: { id } }
20820
20867
  });
20821
- if (!result.response.ok) await checkError5(result.response);
20868
+ if (!result.response.ok) await checkError5(result.response, result.error);
20822
20869
  data = result.data;
20823
20870
  } catch (err) {
20824
20871
  wrapFetchError5(err);
@@ -20833,7 +20880,7 @@ var EnvironmentsClient = class {
20833
20880
  params: { path: { id } }
20834
20881
  });
20835
20882
  if (!result.response.ok && result.response.status !== 204) {
20836
- await checkError5(result.response);
20883
+ await checkError5(result.response, result.error);
20837
20884
  }
20838
20885
  } catch (err) {
20839
20886
  wrapFetchError5(err);
@@ -20856,7 +20903,7 @@ var EnvironmentsClient = class {
20856
20903
  let data;
20857
20904
  try {
20858
20905
  const result = await this._http.POST("/api/v1/environments", { body });
20859
- if (!result.response.ok) await checkError5(result.response);
20906
+ if (!result.response.ok) await checkError5(result.response, result.error);
20860
20907
  data = result.data;
20861
20908
  } catch (err) {
20862
20909
  wrapFetchError5(err);
@@ -20885,7 +20932,7 @@ var EnvironmentsClient = class {
20885
20932
  params: { path: { id: env.id } },
20886
20933
  body
20887
20934
  });
20888
- if (!result.response.ok) await checkError5(result.response);
20935
+ if (!result.response.ok) await checkError5(result.response, result.error);
20889
20936
  data = result.data;
20890
20937
  } catch (err) {
20891
20938
  wrapFetchError5(err);
@@ -20930,7 +20977,7 @@ var ContextTypesClient = class {
20930
20977
  const result = await this._http.GET("/api/v1/context_types", {
20931
20978
  params: { query }
20932
20979
  });
20933
- if (!result.response.ok) await checkError5(result.response);
20980
+ if (!result.response.ok) await checkError5(result.response, result.error);
20934
20981
  data = result.data;
20935
20982
  } catch (err) {
20936
20983
  wrapFetchError5(err);
@@ -20944,7 +20991,7 @@ var ContextTypesClient = class {
20944
20991
  const result = await this._http.GET("/api/v1/context_types/{id}", {
20945
20992
  params: { path: { id } }
20946
20993
  });
20947
- if (!result.response.ok) await checkError5(result.response);
20994
+ if (!result.response.ok) await checkError5(result.response, result.error);
20948
20995
  data = result.data;
20949
20996
  } catch (err) {
20950
20997
  wrapFetchError5(err);
@@ -20959,7 +21006,7 @@ var ContextTypesClient = class {
20959
21006
  params: { path: { id } }
20960
21007
  });
20961
21008
  if (!result.response.ok && result.response.status !== 204) {
20962
- await checkError5(result.response);
21009
+ await checkError5(result.response, result.error);
20963
21010
  }
20964
21011
  } catch (err) {
20965
21012
  wrapFetchError5(err);
@@ -20980,7 +21027,7 @@ var ContextTypesClient = class {
20980
21027
  let data;
20981
21028
  try {
20982
21029
  const result = await this._http.POST("/api/v1/context_types", { body });
20983
- if (!result.response.ok) await checkError5(result.response);
21030
+ if (!result.response.ok) await checkError5(result.response, result.error);
20984
21031
  data = result.data;
20985
21032
  } catch (err) {
20986
21033
  wrapFetchError5(err);
@@ -21007,7 +21054,7 @@ var ContextTypesClient = class {
21007
21054
  params: { path: { id: ct.id } },
21008
21055
  body
21009
21056
  });
21010
- if (!result.response.ok) await checkError5(result.response);
21057
+ if (!result.response.ok) await checkError5(result.response, result.error);
21011
21058
  data = result.data;
21012
21059
  } catch (err) {
21013
21060
  wrapFetchError5(err);
@@ -21086,7 +21133,7 @@ var ContextsClient = class {
21086
21133
  }))
21087
21134
  }
21088
21135
  });
21089
- if (!result.response.ok) await checkError5(result.response);
21136
+ if (!result.response.ok) await checkError5(result.response, result.error);
21090
21137
  } catch (err) {
21091
21138
  wrapFetchError5(err);
21092
21139
  }
@@ -21112,7 +21159,7 @@ var ContextsClient = class {
21112
21159
  const result = await this._http.GET("/api/v1/contexts", {
21113
21160
  params: { query }
21114
21161
  });
21115
- if (!result.response.ok) await checkError5(result.response);
21162
+ if (!result.response.ok) await checkError5(result.response, result.error);
21116
21163
  data = result.data;
21117
21164
  } catch (err) {
21118
21165
  wrapFetchError5(err);
@@ -21129,7 +21176,7 @@ var ContextsClient = class {
21129
21176
  const result = await this._http.GET("/api/v1/contexts/{id}", {
21130
21177
  params: { path: { id: composite } }
21131
21178
  });
21132
- if (!result.response.ok) await checkError5(result.response);
21179
+ if (!result.response.ok) await checkError5(result.response, result.error);
21133
21180
  data = result.data;
21134
21181
  } catch (err) {
21135
21182
  wrapFetchError5(err);
@@ -21147,7 +21194,7 @@ var ContextsClient = class {
21147
21194
  params: { path: { id: composite } }
21148
21195
  });
21149
21196
  if (!result.response.ok && result.response.status !== 204) {
21150
- await checkError5(result.response);
21197
+ await checkError5(result.response, result.error);
21151
21198
  }
21152
21199
  } catch (err) {
21153
21200
  wrapFetchError5(err);
@@ -21177,7 +21224,7 @@ var ContextsClient = class {
21177
21224
  params: { path: { id: ctx.id } },
21178
21225
  body
21179
21226
  });
21180
- if (!result.response.ok) await checkError5(result.response);
21227
+ if (!result.response.ok) await checkError5(result.response, result.error);
21181
21228
  data = result.data;
21182
21229
  } catch (err) {
21183
21230
  wrapFetchError5(err);