@smplkit/sdk 3.0.83 → 3.0.85
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 +250 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -79
- package/dist/index.d.ts +89 -79
- package/dist/index.js +250 -214
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 {
|
|
@@ -17484,47 +17486,15 @@ var Config = class {
|
|
|
17484
17486
|
};
|
|
17485
17487
|
|
|
17486
17488
|
// src/config/proxy.ts
|
|
17487
|
-
function _unflattenDotNotation(flat) {
|
|
17488
|
-
const nested = {};
|
|
17489
|
-
for (const [key, value] of Object.entries(flat)) {
|
|
17490
|
-
const parts = key.split(".");
|
|
17491
|
-
let current = nested;
|
|
17492
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
17493
|
-
const part = parts[i];
|
|
17494
|
-
if (current[part] === void 0 || typeof current[part] !== "object" || current[part] === null) {
|
|
17495
|
-
current[part] = {};
|
|
17496
|
-
}
|
|
17497
|
-
current = current[part];
|
|
17498
|
-
}
|
|
17499
|
-
current[parts[parts.length - 1]] = value;
|
|
17500
|
-
}
|
|
17501
|
-
return nested;
|
|
17502
|
-
}
|
|
17503
17489
|
var LiveConfigProxy = class {
|
|
17504
17490
|
/** @internal */
|
|
17505
17491
|
_client;
|
|
17506
17492
|
/** @internal */
|
|
17507
17493
|
_key;
|
|
17508
|
-
|
|
17509
|
-
_model;
|
|
17510
|
-
constructor(client, key, model) {
|
|
17494
|
+
constructor(client, key) {
|
|
17511
17495
|
this._client = client;
|
|
17512
17496
|
this._key = key;
|
|
17513
|
-
|
|
17514
|
-
const ownMethods = /* @__PURE__ */ new Set([
|
|
17515
|
-
"keys",
|
|
17516
|
-
"values",
|
|
17517
|
-
"items",
|
|
17518
|
-
"get",
|
|
17519
|
-
"onChange",
|
|
17520
|
-
"getBool",
|
|
17521
|
-
"getInt",
|
|
17522
|
-
"getFloat",
|
|
17523
|
-
"getString",
|
|
17524
|
-
"getJson",
|
|
17525
|
-
"_currentValues",
|
|
17526
|
-
"_registerItem"
|
|
17527
|
-
]);
|
|
17497
|
+
const ownMethods = /* @__PURE__ */ new Set(["keys", "values", "items", "get", "onChange", "_currentValues"]);
|
|
17528
17498
|
return new Proxy(this, {
|
|
17529
17499
|
get(target, prop, receiver) {
|
|
17530
17500
|
if (typeof prop === "symbol" || prop === "constructor" || prop === "toJSON") {
|
|
@@ -17534,17 +17504,9 @@ var LiveConfigProxy = class {
|
|
|
17534
17504
|
return Reflect.get(target, prop, receiver);
|
|
17535
17505
|
}
|
|
17536
17506
|
const values = target._currentValues();
|
|
17537
|
-
if (target._model) {
|
|
17538
|
-
const nested = _unflattenDotNotation(values);
|
|
17539
|
-
const instance = new target._model(nested);
|
|
17540
|
-
return instance[prop];
|
|
17541
|
-
}
|
|
17542
17507
|
return values[prop];
|
|
17543
17508
|
},
|
|
17544
|
-
set(
|
|
17545
|
-
if (typeof prop === "string" && prop.startsWith("_")) {
|
|
17546
|
-
return Reflect.set(target, prop, value, receiver);
|
|
17547
|
-
}
|
|
17509
|
+
set(_target, prop) {
|
|
17548
17510
|
throw new Error(
|
|
17549
17511
|
`LiveConfigProxy is read-only; cannot set ${JSON.stringify(String(prop))}. Mutate config values via client.manage.config.*`
|
|
17550
17512
|
);
|
|
@@ -17599,74 +17561,6 @@ var LiveConfigProxy = class {
|
|
|
17599
17561
|
const values = this._currentValues();
|
|
17600
17562
|
return key in values ? values[key] : defaultValue;
|
|
17601
17563
|
}
|
|
17602
|
-
// ------------------------------------------------------------------
|
|
17603
|
-
// Typed getters (ADR-037 §2.13)
|
|
17604
|
-
//
|
|
17605
|
-
// Each registers the item (key, type, default, description) on first
|
|
17606
|
-
// call within the process, then returns the resolved value. When the
|
|
17607
|
-
// resolved value cannot be coerced to the getter's type — including
|
|
17608
|
-
// the "not yet set on the server" case — the in-code default is
|
|
17609
|
-
// returned and a structured warning is logged.
|
|
17610
|
-
// ------------------------------------------------------------------
|
|
17611
|
-
/** @internal */
|
|
17612
|
-
_registerItem(itemKey, itemType, defaultValue, description) {
|
|
17613
|
-
this._client._observeItemDeclaration(this._key, itemKey, itemType, defaultValue, description);
|
|
17614
|
-
}
|
|
17615
|
-
/** Read a BOOLEAN item, registering the declaration on first call. */
|
|
17616
|
-
getBool(key, defaultValue, options = {}) {
|
|
17617
|
-
this._registerItem(key, "BOOLEAN", defaultValue, options.description);
|
|
17618
|
-
const values = this._currentValues();
|
|
17619
|
-
if (!(key in values)) return defaultValue;
|
|
17620
|
-
const value = values[key];
|
|
17621
|
-
if (typeof value === "boolean") return value;
|
|
17622
|
-
console.warn(
|
|
17623
|
-
`[smplkit] config ${JSON.stringify(this._key)} item ${JSON.stringify(key)}: expected BOOLEAN, got ${typeof value}; returning default`
|
|
17624
|
-
);
|
|
17625
|
-
return defaultValue;
|
|
17626
|
-
}
|
|
17627
|
-
/** Read a NUMBER item as int, registering the declaration on first call. */
|
|
17628
|
-
getInt(key, defaultValue, options = {}) {
|
|
17629
|
-
this._registerItem(key, "NUMBER", defaultValue, options.description);
|
|
17630
|
-
const values = this._currentValues();
|
|
17631
|
-
if (!(key in values)) return defaultValue;
|
|
17632
|
-
const value = values[key];
|
|
17633
|
-
if (typeof value === "number" && Number.isInteger(value)) return value;
|
|
17634
|
-
console.warn(
|
|
17635
|
-
`[smplkit] config ${JSON.stringify(this._key)} item ${JSON.stringify(key)}: expected NUMBER (int), got ${typeof value}; returning default`
|
|
17636
|
-
);
|
|
17637
|
-
return defaultValue;
|
|
17638
|
-
}
|
|
17639
|
-
/** Read a NUMBER item as float, registering the declaration on first call. */
|
|
17640
|
-
getFloat(key, defaultValue, options = {}) {
|
|
17641
|
-
this._registerItem(key, "NUMBER", defaultValue, options.description);
|
|
17642
|
-
const values = this._currentValues();
|
|
17643
|
-
if (!(key in values)) return defaultValue;
|
|
17644
|
-
const value = values[key];
|
|
17645
|
-
if (typeof value === "number") return value;
|
|
17646
|
-
console.warn(
|
|
17647
|
-
`[smplkit] config ${JSON.stringify(this._key)} item ${JSON.stringify(key)}: expected NUMBER (float), got ${typeof value}; returning default`
|
|
17648
|
-
);
|
|
17649
|
-
return defaultValue;
|
|
17650
|
-
}
|
|
17651
|
-
/** Read a STRING item, registering the declaration on first call. */
|
|
17652
|
-
getString(key, defaultValue, options = {}) {
|
|
17653
|
-
this._registerItem(key, "STRING", defaultValue, options.description);
|
|
17654
|
-
const values = this._currentValues();
|
|
17655
|
-
if (!(key in values)) return defaultValue;
|
|
17656
|
-
const value = values[key];
|
|
17657
|
-
if (typeof value === "string") return value;
|
|
17658
|
-
console.warn(
|
|
17659
|
-
`[smplkit] config ${JSON.stringify(this._key)} item ${JSON.stringify(key)}: expected STRING, got ${typeof value}; returning default`
|
|
17660
|
-
);
|
|
17661
|
-
return defaultValue;
|
|
17662
|
-
}
|
|
17663
|
-
/** Read a JSON item, registering the declaration on first call. */
|
|
17664
|
-
getJson(key, defaultValue, options = {}) {
|
|
17665
|
-
this._registerItem(key, "JSON", defaultValue, options.description);
|
|
17666
|
-
const values = this._currentValues();
|
|
17667
|
-
if (!(key in values)) return defaultValue;
|
|
17668
|
-
return values[key];
|
|
17669
|
-
}
|
|
17670
17564
|
onChange(callbackOrItemKey, callback) {
|
|
17671
17565
|
if (typeof callbackOrItemKey === "function") {
|
|
17672
17566
|
this._client.onChange(this._key, callbackOrItemKey);
|
|
@@ -17719,6 +17613,7 @@ var ConfigChangeEvent = class {
|
|
|
17719
17613
|
}
|
|
17720
17614
|
};
|
|
17721
17615
|
var BASE_URL = "https://config.smplkit.com";
|
|
17616
|
+
var MISSING = /* @__PURE__ */ Symbol("smplkit.config.get.MISSING");
|
|
17722
17617
|
function extractItemValues(items) {
|
|
17723
17618
|
if (!items) return {};
|
|
17724
17619
|
const result = {};
|
|
@@ -17758,6 +17653,40 @@ function resourceToConfig(resource) {
|
|
|
17758
17653
|
updatedAt: attrs.updated_at ?? null
|
|
17759
17654
|
});
|
|
17760
17655
|
}
|
|
17656
|
+
function valueToItemType(value) {
|
|
17657
|
+
if (typeof value === "boolean") return "BOOLEAN";
|
|
17658
|
+
if (typeof value === "number") return "NUMBER";
|
|
17659
|
+
if (typeof value === "string") return "STRING";
|
|
17660
|
+
return "STRING";
|
|
17661
|
+
}
|
|
17662
|
+
function isPlainObject(value) {
|
|
17663
|
+
if (value === null || typeof value !== "object") return false;
|
|
17664
|
+
const proto = Object.getPrototypeOf(value);
|
|
17665
|
+
return proto === Object.prototype || proto === null;
|
|
17666
|
+
}
|
|
17667
|
+
function iterObjectItems(obj, prefix = "") {
|
|
17668
|
+
const out = [];
|
|
17669
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
17670
|
+
const flatKey = `${prefix}${key}`;
|
|
17671
|
+
if (isPlainObject(value)) {
|
|
17672
|
+
out.push(...iterObjectItems(value, `${flatKey}.`));
|
|
17673
|
+
continue;
|
|
17674
|
+
}
|
|
17675
|
+
out.push([flatKey, valueToItemType(value), value]);
|
|
17676
|
+
}
|
|
17677
|
+
return out;
|
|
17678
|
+
}
|
|
17679
|
+
function applyChangeToTarget(target, dottedKey, value) {
|
|
17680
|
+
const parts = dottedKey.split(".");
|
|
17681
|
+
let current = target;
|
|
17682
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
17683
|
+
const part = parts[i];
|
|
17684
|
+
if (current === null || typeof current !== "object" || !(part in current)) return;
|
|
17685
|
+
current = current[part];
|
|
17686
|
+
}
|
|
17687
|
+
if (current === null || typeof current !== "object") return;
|
|
17688
|
+
current[parts[parts.length - 1]] = value;
|
|
17689
|
+
}
|
|
17761
17690
|
var ConfigClient = class {
|
|
17762
17691
|
/** @internal */
|
|
17763
17692
|
_apiKey;
|
|
@@ -17778,10 +17707,11 @@ var ConfigClient = class {
|
|
|
17778
17707
|
* without a full re-list. Mirrors Python's `_raw_config_cache`. */
|
|
17779
17708
|
_configStore = {};
|
|
17780
17709
|
/** Cache of LiveConfigProxy instances by config id — ensures repeat
|
|
17781
|
-
* `
|
|
17782
|
-
* handle so callers can reference it as a parent via direct ref.
|
|
17783
|
-
* Mirrors Python's `_proxies`. */
|
|
17710
|
+
* `get(id)` calls return the same handle. */
|
|
17784
17711
|
_proxies = {};
|
|
17712
|
+
/** Bound targets (plain objects or class instances) keyed by config
|
|
17713
|
+
* id. WebSocket dispatch mutates these in place when values change. */
|
|
17714
|
+
_bindings = /* @__PURE__ */ new Map();
|
|
17785
17715
|
_initialized = false;
|
|
17786
17716
|
_listeners = [];
|
|
17787
17717
|
/** @internal */
|
|
@@ -17814,66 +17744,126 @@ var ConfigClient = class {
|
|
|
17814
17744
|
});
|
|
17815
17745
|
}
|
|
17816
17746
|
// ------------------------------------------------------------------
|
|
17817
|
-
//
|
|
17747
|
+
// Public API: bind, get
|
|
17818
17748
|
// ------------------------------------------------------------------
|
|
17819
17749
|
/**
|
|
17820
|
-
*
|
|
17750
|
+
* Bind an object to a config id; return the same object back, live.
|
|
17751
|
+
*
|
|
17752
|
+
* Declarative, code-first API. The object's keys are the schema; its
|
|
17753
|
+
* values are the in-code defaults. On first boot:
|
|
17821
17754
|
*
|
|
17822
|
-
*
|
|
17823
|
-
*
|
|
17824
|
-
*
|
|
17825
|
-
*
|
|
17755
|
+
* 1. Every leaf (recursively, through nested plain objects) is
|
|
17756
|
+
* registered with the server as a config item, with its value as
|
|
17757
|
+
* the in-code default and a type inferred from `typeof value`.
|
|
17758
|
+
* 2. After the SDK's cache is populated, any server-side overrides for
|
|
17759
|
+
* this config are applied to the bound object in place.
|
|
17826
17760
|
*
|
|
17827
|
-
*
|
|
17828
|
-
*
|
|
17829
|
-
*
|
|
17830
|
-
* in
|
|
17761
|
+
* On every WebSocket-delivered change thereafter the bound object is
|
|
17762
|
+
* mutated in place — readers of `obj.foo` and `obj["foo"]` always see
|
|
17763
|
+
* the current resolved value. The returned object is the same one you
|
|
17764
|
+
* passed in (referential identity preserved).
|
|
17831
17765
|
*
|
|
17832
|
-
*
|
|
17833
|
-
*
|
|
17766
|
+
* Idempotent. Repeated calls with the same id return the originally-
|
|
17767
|
+
* bound object; the new `config` argument is ignored.
|
|
17768
|
+
*
|
|
17769
|
+
* **Plain object literals vs. class instances.** Plain object literals
|
|
17770
|
+
* (e.g., `{ a: 1, b: { c: 2 } }`) are the recommended input shape —
|
|
17771
|
+
* their keys are the explicit override set, and omitted keys inherit
|
|
17772
|
+
* from `parent`. Class instances are also accepted, but every
|
|
17773
|
+
* enumerable property is registered as an explicit override (there is
|
|
17774
|
+
* no JS equivalent of Python's `model_fields_set`); to get omit-to-
|
|
17775
|
+
* inherit semantics, use a plain object literal.
|
|
17776
|
+
*
|
|
17777
|
+
* @param id - The config id to register under.
|
|
17778
|
+
* @param config - A plain object literal (recommended) or class
|
|
17779
|
+
* instance carrying the in-code defaults.
|
|
17780
|
+
* @param options - Optional `parent`: another object previously
|
|
17781
|
+
* returned from a {@link bind} call. Activates parent-chain
|
|
17782
|
+
* inheritance for keys the caller omitted.
|
|
17783
|
+
* @returns The same `config` object, registered and live.
|
|
17784
|
+
* @throws TypeError if `config` is not an object.
|
|
17785
|
+
* @throws Error if `parent` was not previously bound via {@link bind}.
|
|
17834
17786
|
*/
|
|
17835
|
-
async
|
|
17787
|
+
async bind(id, config, options = {}) {
|
|
17788
|
+
if (config === null || typeof config !== "object") {
|
|
17789
|
+
throw new TypeError(`bind() requires an object; got ${typeof config}`);
|
|
17790
|
+
}
|
|
17791
|
+
const existing = this._bindings.get(id);
|
|
17792
|
+
if (existing !== void 0) {
|
|
17793
|
+
return existing;
|
|
17794
|
+
}
|
|
17795
|
+
let parentId = null;
|
|
17796
|
+
if (options.parent !== void 0 && options.parent !== null) {
|
|
17797
|
+
parentId = this._configIdFor(options.parent);
|
|
17798
|
+
if (parentId === null) {
|
|
17799
|
+
throw new Error(
|
|
17800
|
+
"bind(): parent must be an object previously returned from client.config.bind(). Bind the parent first."
|
|
17801
|
+
);
|
|
17802
|
+
}
|
|
17803
|
+
}
|
|
17804
|
+
const ctor = config.constructor;
|
|
17805
|
+
const className = typeof ctor === "function" && ctor !== Object && typeof ctor.name === "string" && ctor.name ? ctor.name : null;
|
|
17806
|
+
this._observeConfigDeclaration(id, parentId, className, null);
|
|
17807
|
+
for (const [itemKey, itemType, value] of iterObjectItems(config)) {
|
|
17808
|
+
this._observeItemDeclaration(id, itemKey, itemType, value, void 0);
|
|
17809
|
+
}
|
|
17810
|
+
this._bindings.set(id, config);
|
|
17811
|
+
await this._ensureInitialized();
|
|
17812
|
+
this._syncTargetFromCache(config, id);
|
|
17813
|
+
return config;
|
|
17814
|
+
}
|
|
17815
|
+
async get(id, key, defaultValue = MISSING) {
|
|
17836
17816
|
await this._ensureInitialized();
|
|
17817
|
+
if (key === void 0) {
|
|
17818
|
+
if (!(id in this._configCache)) {
|
|
17819
|
+
throw new SmplNotFoundError(`Config with id '${id}' not found in cache`);
|
|
17820
|
+
}
|
|
17821
|
+
const metrics = this._parent?._metrics;
|
|
17822
|
+
if (metrics) {
|
|
17823
|
+
metrics.record("config.resolutions", 1, "resolutions", { config: id });
|
|
17824
|
+
}
|
|
17825
|
+
return this._cachedProxy(id);
|
|
17826
|
+
}
|
|
17827
|
+
const hasDefault = defaultValue !== MISSING;
|
|
17828
|
+
if (hasDefault) {
|
|
17829
|
+
this._observeConfigDeclaration(id, null, null, null);
|
|
17830
|
+
this._observeItemDeclaration(id, key, valueToItemType(defaultValue), defaultValue, void 0);
|
|
17831
|
+
}
|
|
17837
17832
|
if (!(id in this._configCache)) {
|
|
17833
|
+
if (hasDefault) return defaultValue;
|
|
17838
17834
|
throw new SmplNotFoundError(`Config with id '${id}' not found in cache`);
|
|
17839
17835
|
}
|
|
17840
|
-
const
|
|
17841
|
-
if (
|
|
17842
|
-
|
|
17836
|
+
const values = this._configCache[id];
|
|
17837
|
+
if (!(key in values)) {
|
|
17838
|
+
if (hasDefault) return defaultValue;
|
|
17839
|
+
throw new SmplNotFoundError(`Config item '${key}' not found in config '${id}'`);
|
|
17843
17840
|
}
|
|
17844
|
-
return
|
|
17841
|
+
return values[key];
|
|
17845
17842
|
}
|
|
17846
|
-
|
|
17847
|
-
|
|
17848
|
-
|
|
17849
|
-
|
|
17850
|
-
|
|
17851
|
-
|
|
17852
|
-
|
|
17853
|
-
|
|
17854
|
-
|
|
17855
|
-
|
|
17856
|
-
|
|
17857
|
-
|
|
17858
|
-
|
|
17859
|
-
|
|
17860
|
-
|
|
17861
|
-
|
|
17862
|
-
|
|
17863
|
-
const parent = options.parent;
|
|
17864
|
-
const parentId = parent instanceof LiveConfigProxy ? parent._key : parent ?? null;
|
|
17865
|
-
this._observeConfigDeclaration(id, parentId, options.name ?? null, options.description ?? null);
|
|
17866
|
-
await this._ensureInitialized();
|
|
17867
|
-
return this._cachedProxy(id, options.model);
|
|
17843
|
+
// ------------------------------------------------------------------
|
|
17844
|
+
// Internal: binding helpers
|
|
17845
|
+
// ------------------------------------------------------------------
|
|
17846
|
+
/** @internal — return the config_id this object was bound under, or null. */
|
|
17847
|
+
_configIdFor(target) {
|
|
17848
|
+
for (const [cid, bound] of this._bindings) {
|
|
17849
|
+
if (bound === target) return cid;
|
|
17850
|
+
}
|
|
17851
|
+
return null;
|
|
17852
|
+
}
|
|
17853
|
+
/** @internal — apply current cached values to a freshly-bound target. */
|
|
17854
|
+
_syncTargetFromCache(target, configId) {
|
|
17855
|
+
const cache = this._configCache[configId];
|
|
17856
|
+
if (!cache) return;
|
|
17857
|
+
for (const [dottedKey, value] of Object.entries(cache)) {
|
|
17858
|
+
applyChangeToTarget(target, dottedKey, value);
|
|
17859
|
+
}
|
|
17868
17860
|
}
|
|
17869
17861
|
/** @internal — return (and cache) the canonical proxy for a config id. */
|
|
17870
|
-
_cachedProxy(id
|
|
17862
|
+
_cachedProxy(id) {
|
|
17871
17863
|
let proxy = this._proxies[id];
|
|
17872
17864
|
if (!proxy) {
|
|
17873
|
-
proxy = new LiveConfigProxy(this, id
|
|
17865
|
+
proxy = new LiveConfigProxy(this, id);
|
|
17874
17866
|
this._proxies[id] = proxy;
|
|
17875
|
-
} else if (model !== void 0 && proxy._model === void 0) {
|
|
17876
|
-
proxy._model = model;
|
|
17877
17867
|
}
|
|
17878
17868
|
return proxy;
|
|
17879
17869
|
}
|
|
@@ -17941,7 +17931,7 @@ var ConfigClient = class {
|
|
|
17941
17931
|
*/
|
|
17942
17932
|
async refresh() {
|
|
17943
17933
|
if (!this._initialized) {
|
|
17944
|
-
throw new SmplError("Config not initialized. Call get() first.");
|
|
17934
|
+
throw new SmplError("Config not initialized. Call get() or bind() first.");
|
|
17945
17935
|
}
|
|
17946
17936
|
const environment = this._parent?._environment;
|
|
17947
17937
|
if (!environment) {
|
|
@@ -17965,10 +17955,6 @@ var ConfigClient = class {
|
|
|
17965
17955
|
* (set via `_resolveManagement`) so runtime + management share one HTTP
|
|
17966
17956
|
* client; falls back to a direct GET when running without `SmplClient`
|
|
17967
17957
|
* bootstrap (e.g. unit tests that construct `ConfigClient` directly).
|
|
17968
|
-
*
|
|
17969
|
-
* Pages through the server until a short page (less than the requested
|
|
17970
|
-
* size) is returned — accounts with more than 1000 configs would
|
|
17971
|
-
* otherwise silently lose everything past page one.
|
|
17972
17958
|
*/
|
|
17973
17959
|
async _listConfigs() {
|
|
17974
17960
|
const PAGE_SIZE = 1e3;
|
|
@@ -18010,7 +17996,8 @@ var ConfigClient = class {
|
|
|
18010
17996
|
* Eagerly initialize the config subclient — fetch all configs, resolve
|
|
18011
17997
|
* environment-scoped values into the local cache, and subscribe to the
|
|
18012
17998
|
* shared WebSocket for live updates. Idempotent. Called automatically
|
|
18013
|
-
* on first `client.config.get(...)` if not
|
|
17999
|
+
* on first `client.config.get(...)` / `client.config.bind(...)` if not
|
|
18000
|
+
* invoked manually.
|
|
18014
18001
|
*/
|
|
18015
18002
|
async start() {
|
|
18016
18003
|
return this._ensureInitialized();
|
|
@@ -18146,10 +18133,14 @@ var ConfigClient = class {
|
|
|
18146
18133
|
const oldItems = oldCache[cfgKey] ?? {};
|
|
18147
18134
|
const newItems = newCache[cfgKey] ?? {};
|
|
18148
18135
|
const allItemKeys = /* @__PURE__ */ new Set([...Object.keys(oldItems), ...Object.keys(newItems)]);
|
|
18136
|
+
const target = this._bindings.get(cfgKey);
|
|
18149
18137
|
for (const iKey of allItemKeys) {
|
|
18150
18138
|
const oldVal = iKey in oldItems ? oldItems[iKey] : null;
|
|
18151
18139
|
const newVal = iKey in newItems ? newItems[iKey] : null;
|
|
18152
18140
|
if (JSON.stringify(oldVal) !== JSON.stringify(newVal)) {
|
|
18141
|
+
if (target !== void 0) {
|
|
18142
|
+
applyChangeToTarget(target, iKey, newVal);
|
|
18143
|
+
}
|
|
18153
18144
|
const metrics = this._parent?._metrics;
|
|
18154
18145
|
if (metrics) {
|
|
18155
18146
|
metrics.record("config.changes", 1, "changes", { config: cfgKey });
|
|
@@ -18579,7 +18570,7 @@ var Environment = class {
|
|
|
18579
18570
|
* environment. Unmanaged environments are view-only — existing values
|
|
18580
18571
|
* render for comparison but no new values can be set. Managed
|
|
18581
18572
|
* environments count toward the account's `platform.managed_environments`
|
|
18582
|
-
* quota.
|
|
18573
|
+
* quota. `production` is always managed and cannot be demoted.
|
|
18583
18574
|
*/
|
|
18584
18575
|
managed;
|
|
18585
18576
|
/** When the environment was created. */
|
|
@@ -18965,8 +18956,17 @@ function wrapFetchError(err) {
|
|
|
18965
18956
|
`Request failed: ${err instanceof Error ? err.message : String(err)}`
|
|
18966
18957
|
);
|
|
18967
18958
|
}
|
|
18968
|
-
async function checkError(response) {
|
|
18969
|
-
|
|
18959
|
+
async function checkError(response, error) {
|
|
18960
|
+
let body = "";
|
|
18961
|
+
if (error !== void 0 && error !== null) {
|
|
18962
|
+
try {
|
|
18963
|
+
body = typeof error === "string" ? error : JSON.stringify(error);
|
|
18964
|
+
} catch {
|
|
18965
|
+
}
|
|
18966
|
+
}
|
|
18967
|
+
if (!body) {
|
|
18968
|
+
body = await response.text().catch(() => "");
|
|
18969
|
+
}
|
|
18970
18970
|
throwForStatus(response.status, body);
|
|
18971
18971
|
}
|
|
18972
18972
|
function buildBody(config) {
|
|
@@ -19121,7 +19121,7 @@ var ManagementConfigClient = class {
|
|
|
19121
19121
|
const result = await this._http.GET("/api/v1/configs", {
|
|
19122
19122
|
params: { query }
|
|
19123
19123
|
});
|
|
19124
|
-
if (!result.response.ok) await checkError(result.response);
|
|
19124
|
+
if (!result.response.ok) await checkError(result.response, result.error);
|
|
19125
19125
|
data = result.data;
|
|
19126
19126
|
} catch (err) {
|
|
19127
19127
|
wrapFetchError(err);
|
|
@@ -19136,7 +19136,7 @@ var ManagementConfigClient = class {
|
|
|
19136
19136
|
const result = await this._http.GET("/api/v1/configs/{id}", {
|
|
19137
19137
|
params: { path: { id } }
|
|
19138
19138
|
});
|
|
19139
|
-
if (!result.response.ok) await checkError(result.response);
|
|
19139
|
+
if (!result.response.ok) await checkError(result.response, result.error);
|
|
19140
19140
|
data = result.data;
|
|
19141
19141
|
} catch (err) {
|
|
19142
19142
|
wrapFetchError(err);
|
|
@@ -19157,7 +19157,7 @@ var ManagementConfigClient = class {
|
|
|
19157
19157
|
params: { path: { id } }
|
|
19158
19158
|
});
|
|
19159
19159
|
if (!result.response.ok && result.response.status !== 204) {
|
|
19160
|
-
await checkError(result.response);
|
|
19160
|
+
await checkError(result.response, result.error);
|
|
19161
19161
|
}
|
|
19162
19162
|
} catch (err) {
|
|
19163
19163
|
wrapFetchError(err);
|
|
@@ -19173,7 +19173,7 @@ var ManagementConfigClient = class {
|
|
|
19173
19173
|
let data;
|
|
19174
19174
|
try {
|
|
19175
19175
|
const result = await this._http.POST("/api/v1/configs", { body });
|
|
19176
|
-
if (!result.response.ok) await checkError(result.response);
|
|
19176
|
+
if (!result.response.ok) await checkError(result.response, result.error);
|
|
19177
19177
|
data = result.data;
|
|
19178
19178
|
} catch (err) {
|
|
19179
19179
|
wrapFetchError(err);
|
|
@@ -19191,7 +19191,7 @@ var ManagementConfigClient = class {
|
|
|
19191
19191
|
params: { path: { id: config.id } },
|
|
19192
19192
|
body
|
|
19193
19193
|
});
|
|
19194
|
-
if (!result.response.ok) await checkError(result.response);
|
|
19194
|
+
if (!result.response.ok) await checkError(result.response, result.error);
|
|
19195
19195
|
data = result.data;
|
|
19196
19196
|
} catch (err) {
|
|
19197
19197
|
wrapFetchError(err);
|
|
@@ -19205,8 +19205,17 @@ var ManagementConfigClient = class {
|
|
|
19205
19205
|
|
|
19206
19206
|
// src/management/flags.ts
|
|
19207
19207
|
var FLAG_REGISTRATION_FLUSH_SIZE = 50;
|
|
19208
|
-
async function checkError2(response) {
|
|
19209
|
-
|
|
19208
|
+
async function checkError2(response, error) {
|
|
19209
|
+
let body = "";
|
|
19210
|
+
if (error !== void 0 && error !== null) {
|
|
19211
|
+
try {
|
|
19212
|
+
body = typeof error === "string" ? error : JSON.stringify(error);
|
|
19213
|
+
} catch {
|
|
19214
|
+
}
|
|
19215
|
+
}
|
|
19216
|
+
if (!body) {
|
|
19217
|
+
body = await response.text().catch(() => "");
|
|
19218
|
+
}
|
|
19210
19219
|
throwForStatus(response.status, body);
|
|
19211
19220
|
}
|
|
19212
19221
|
function wrapFetchError2(err) {
|
|
@@ -19404,7 +19413,7 @@ var ManagementFlagsClient = class {
|
|
|
19404
19413
|
const result = await this._http.GET("/api/v1/flags/{id}", {
|
|
19405
19414
|
params: { path: { id } }
|
|
19406
19415
|
});
|
|
19407
|
-
if (!result.response.ok) await checkError2(result.response);
|
|
19416
|
+
if (!result.response.ok) await checkError2(result.response, result.error);
|
|
19408
19417
|
data = result.data;
|
|
19409
19418
|
} catch (err) {
|
|
19410
19419
|
wrapFetchError2(err);
|
|
@@ -19431,7 +19440,7 @@ var ManagementFlagsClient = class {
|
|
|
19431
19440
|
const result = await this._http.GET("/api/v1/flags", {
|
|
19432
19441
|
params: { query }
|
|
19433
19442
|
});
|
|
19434
|
-
if (!result.response.ok) await checkError2(result.response);
|
|
19443
|
+
if (!result.response.ok) await checkError2(result.response, result.error);
|
|
19435
19444
|
data = result.data;
|
|
19436
19445
|
} catch (err) {
|
|
19437
19446
|
wrapFetchError2(err);
|
|
@@ -19450,7 +19459,7 @@ var ManagementFlagsClient = class {
|
|
|
19450
19459
|
params: { path: { id } }
|
|
19451
19460
|
});
|
|
19452
19461
|
if (!result.response.ok && result.response.status !== 204) {
|
|
19453
|
-
await checkError2(result.response);
|
|
19462
|
+
await checkError2(result.response, result.error);
|
|
19454
19463
|
}
|
|
19455
19464
|
} catch (err) {
|
|
19456
19465
|
wrapFetchError2(err);
|
|
@@ -19495,7 +19504,7 @@ var ManagementFlagsClient = class {
|
|
|
19495
19504
|
let data;
|
|
19496
19505
|
try {
|
|
19497
19506
|
const result = await this._http.POST("/api/v1/flags", { body });
|
|
19498
|
-
if (!result.response.ok) await checkError2(result.response);
|
|
19507
|
+
if (!result.response.ok) await checkError2(result.response, result.error);
|
|
19499
19508
|
data = result.data;
|
|
19500
19509
|
} catch (err) {
|
|
19501
19510
|
wrapFetchError2(err);
|
|
@@ -19513,7 +19522,7 @@ var ManagementFlagsClient = class {
|
|
|
19513
19522
|
params: { path: { id: flag.id } },
|
|
19514
19523
|
body
|
|
19515
19524
|
});
|
|
19516
|
-
if (!result.response.ok) await checkError2(result.response);
|
|
19525
|
+
if (!result.response.ok) await checkError2(result.response, result.error);
|
|
19517
19526
|
data = result.data;
|
|
19518
19527
|
} catch (err) {
|
|
19519
19528
|
wrapFetchError2(err);
|
|
@@ -19833,8 +19842,17 @@ var LogGroup = class {
|
|
|
19833
19842
|
|
|
19834
19843
|
// src/management/logging.ts
|
|
19835
19844
|
var LOGGER_REGISTRATION_FLUSH_SIZE = 50;
|
|
19836
|
-
async function checkError3(response) {
|
|
19837
|
-
|
|
19845
|
+
async function checkError3(response, error) {
|
|
19846
|
+
let body = "";
|
|
19847
|
+
if (error !== void 0 && error !== null) {
|
|
19848
|
+
try {
|
|
19849
|
+
body = typeof error === "string" ? error : JSON.stringify(error);
|
|
19850
|
+
} catch {
|
|
19851
|
+
}
|
|
19852
|
+
}
|
|
19853
|
+
if (!body) {
|
|
19854
|
+
body = await response.text().catch(() => "");
|
|
19855
|
+
}
|
|
19838
19856
|
throwForStatus(response.status, body);
|
|
19839
19857
|
}
|
|
19840
19858
|
function wrapFetchError3(err) {
|
|
@@ -19969,7 +19987,7 @@ var LoggersClient = class {
|
|
|
19969
19987
|
const result = await this._http.GET("/api/v1/loggers", {
|
|
19970
19988
|
params: { query }
|
|
19971
19989
|
});
|
|
19972
|
-
if (!result.response.ok) await checkError3(result.response);
|
|
19990
|
+
if (!result.response.ok) await checkError3(result.response, result.error);
|
|
19973
19991
|
data = result.data;
|
|
19974
19992
|
} catch (err) {
|
|
19975
19993
|
wrapFetchError3(err);
|
|
@@ -19983,7 +20001,7 @@ var LoggersClient = class {
|
|
|
19983
20001
|
const result = await this._http.GET("/api/v1/loggers/{id}", {
|
|
19984
20002
|
params: { path: { id } }
|
|
19985
20003
|
});
|
|
19986
|
-
if (!result.response.ok) await checkError3(result.response);
|
|
20004
|
+
if (!result.response.ok) await checkError3(result.response, result.error);
|
|
19987
20005
|
data = result.data;
|
|
19988
20006
|
} catch (err) {
|
|
19989
20007
|
wrapFetchError3(err);
|
|
@@ -20003,7 +20021,7 @@ var LoggersClient = class {
|
|
|
20003
20021
|
params: { path: { id } }
|
|
20004
20022
|
});
|
|
20005
20023
|
if (!result.response.ok && result.response.status !== 204) {
|
|
20006
|
-
await checkError3(result.response);
|
|
20024
|
+
await checkError3(result.response, result.error);
|
|
20007
20025
|
}
|
|
20008
20026
|
} catch (err) {
|
|
20009
20027
|
wrapFetchError3(err);
|
|
@@ -20044,7 +20062,7 @@ var LoggersClient = class {
|
|
|
20044
20062
|
params: { path: { id: logger.id } },
|
|
20045
20063
|
body
|
|
20046
20064
|
});
|
|
20047
|
-
if (!result.response.ok) await checkError3(result.response);
|
|
20065
|
+
if (!result.response.ok) await checkError3(result.response, result.error);
|
|
20048
20066
|
data = result.data;
|
|
20049
20067
|
} catch (err) {
|
|
20050
20068
|
wrapFetchError3(err);
|
|
@@ -20087,7 +20105,7 @@ var LogGroupsClient = class {
|
|
|
20087
20105
|
const result = await this._http.GET("/api/v1/log_groups", {
|
|
20088
20106
|
params: { query }
|
|
20089
20107
|
});
|
|
20090
|
-
if (!result.response.ok) await checkError3(result.response);
|
|
20108
|
+
if (!result.response.ok) await checkError3(result.response, result.error);
|
|
20091
20109
|
data = result.data;
|
|
20092
20110
|
} catch (err) {
|
|
20093
20111
|
wrapFetchError3(err);
|
|
@@ -20101,7 +20119,7 @@ var LogGroupsClient = class {
|
|
|
20101
20119
|
const result = await this._http.GET("/api/v1/log_groups/{id}", {
|
|
20102
20120
|
params: { path: { id } }
|
|
20103
20121
|
});
|
|
20104
|
-
if (!result.response.ok) await checkError3(result.response);
|
|
20122
|
+
if (!result.response.ok) await checkError3(result.response, result.error);
|
|
20105
20123
|
data = result.data;
|
|
20106
20124
|
} catch (err) {
|
|
20107
20125
|
wrapFetchError3(err);
|
|
@@ -20121,7 +20139,7 @@ var LogGroupsClient = class {
|
|
|
20121
20139
|
params: { path: { id } }
|
|
20122
20140
|
});
|
|
20123
20141
|
if (!result.response.ok && result.response.status !== 204) {
|
|
20124
|
-
await checkError3(result.response);
|
|
20142
|
+
await checkError3(result.response, result.error);
|
|
20125
20143
|
}
|
|
20126
20144
|
} catch (err) {
|
|
20127
20145
|
wrapFetchError3(err);
|
|
@@ -20138,7 +20156,7 @@ var LogGroupsClient = class {
|
|
|
20138
20156
|
let data;
|
|
20139
20157
|
try {
|
|
20140
20158
|
const result = await this._http.POST("/api/v1/log_groups", { body });
|
|
20141
|
-
if (!result.response.ok) await checkError3(result.response);
|
|
20159
|
+
if (!result.response.ok) await checkError3(result.response, result.error);
|
|
20142
20160
|
data = result.data;
|
|
20143
20161
|
} catch (err) {
|
|
20144
20162
|
wrapFetchError3(err);
|
|
@@ -20156,7 +20174,7 @@ var LogGroupsClient = class {
|
|
|
20156
20174
|
params: { path: { id: group.id } },
|
|
20157
20175
|
body
|
|
20158
20176
|
});
|
|
20159
|
-
if (!result.response.ok) await checkError3(result.response);
|
|
20177
|
+
if (!result.response.ok) await checkError3(result.response, result.error);
|
|
20160
20178
|
data = result.data;
|
|
20161
20179
|
} catch (err) {
|
|
20162
20180
|
wrapFetchError3(err);
|
|
@@ -20305,8 +20323,17 @@ var Forwarder = class {
|
|
|
20305
20323
|
};
|
|
20306
20324
|
|
|
20307
20325
|
// src/management/audit.ts
|
|
20308
|
-
async function checkError4(response) {
|
|
20309
|
-
|
|
20326
|
+
async function checkError4(response, error) {
|
|
20327
|
+
let body = "";
|
|
20328
|
+
if (error !== void 0 && error !== null) {
|
|
20329
|
+
try {
|
|
20330
|
+
body = typeof error === "string" ? error : JSON.stringify(error);
|
|
20331
|
+
} catch {
|
|
20332
|
+
}
|
|
20333
|
+
}
|
|
20334
|
+
if (!body) {
|
|
20335
|
+
body = await response.text().catch(() => "");
|
|
20336
|
+
}
|
|
20310
20337
|
throwForStatus(response.status, body);
|
|
20311
20338
|
}
|
|
20312
20339
|
function wrapFetchError4(err) {
|
|
@@ -20462,7 +20489,7 @@ var ForwardersClient = class {
|
|
|
20462
20489
|
const result = await this._http.GET("/api/v1/forwarders", {
|
|
20463
20490
|
params: { query }
|
|
20464
20491
|
});
|
|
20465
|
-
if (!result.response.ok) await checkError4(result.response);
|
|
20492
|
+
if (!result.response.ok) await checkError4(result.response, result.error);
|
|
20466
20493
|
data = result.data;
|
|
20467
20494
|
} catch (err) {
|
|
20468
20495
|
wrapFetchError4(err);
|
|
@@ -20483,7 +20510,7 @@ var ForwardersClient = class {
|
|
|
20483
20510
|
const result = await this._http.GET("/api/v1/forwarders/{forwarder_id}", {
|
|
20484
20511
|
params: { path: { forwarder_id: forwarderId } }
|
|
20485
20512
|
});
|
|
20486
|
-
if (!result.response.ok) await checkError4(result.response);
|
|
20513
|
+
if (!result.response.ok) await checkError4(result.response, result.error);
|
|
20487
20514
|
data = result.data;
|
|
20488
20515
|
} catch (err) {
|
|
20489
20516
|
wrapFetchError4(err);
|
|
@@ -20497,7 +20524,7 @@ var ForwardersClient = class {
|
|
|
20497
20524
|
const result = await this._http.DELETE("/api/v1/forwarders/{forwarder_id}", {
|
|
20498
20525
|
params: { path: { forwarder_id: forwarderId } }
|
|
20499
20526
|
});
|
|
20500
|
-
if (result.response.status !== 204) await checkError4(result.response);
|
|
20527
|
+
if (result.response.status !== 204) await checkError4(result.response, result.error);
|
|
20501
20528
|
} catch (err) {
|
|
20502
20529
|
wrapFetchError4(err);
|
|
20503
20530
|
}
|
|
@@ -20512,7 +20539,7 @@ var ForwardersClient = class {
|
|
|
20512
20539
|
let data;
|
|
20513
20540
|
try {
|
|
20514
20541
|
const result = await this._http.POST("/api/v1/forwarders", { body });
|
|
20515
|
-
if (!result.response.ok) await checkError4(result.response);
|
|
20542
|
+
if (!result.response.ok) await checkError4(result.response, result.error);
|
|
20516
20543
|
data = result.data;
|
|
20517
20544
|
} catch (err) {
|
|
20518
20545
|
wrapFetchError4(err);
|
|
@@ -20539,7 +20566,7 @@ var ForwardersClient = class {
|
|
|
20539
20566
|
params: { path: { forwarder_id: forwarder.id } },
|
|
20540
20567
|
body
|
|
20541
20568
|
});
|
|
20542
|
-
if (!result.response.ok) await checkError4(result.response);
|
|
20569
|
+
if (!result.response.ok) await checkError4(result.response, result.error);
|
|
20543
20570
|
data = result.data;
|
|
20544
20571
|
} catch (err) {
|
|
20545
20572
|
wrapFetchError4(err);
|
|
@@ -20702,8 +20729,17 @@ function splitContextId(idOrType, key) {
|
|
|
20702
20729
|
}
|
|
20703
20730
|
return [idOrType, key];
|
|
20704
20731
|
}
|
|
20705
|
-
async function checkError5(response) {
|
|
20706
|
-
|
|
20732
|
+
async function checkError5(response, error) {
|
|
20733
|
+
let body = "";
|
|
20734
|
+
if (error !== void 0 && error !== null) {
|
|
20735
|
+
try {
|
|
20736
|
+
body = typeof error === "string" ? error : JSON.stringify(error);
|
|
20737
|
+
} catch {
|
|
20738
|
+
}
|
|
20739
|
+
}
|
|
20740
|
+
if (!body) {
|
|
20741
|
+
body = await response.text().catch(() => "");
|
|
20742
|
+
}
|
|
20707
20743
|
throwForStatus(response.status, body);
|
|
20708
20744
|
}
|
|
20709
20745
|
function wrapFetchError5(err) {
|
|
@@ -20804,7 +20840,7 @@ var EnvironmentsClient = class {
|
|
|
20804
20840
|
const result = await this._http.GET("/api/v1/environments", {
|
|
20805
20841
|
params: { query }
|
|
20806
20842
|
});
|
|
20807
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
20843
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
20808
20844
|
data = result.data;
|
|
20809
20845
|
} catch (err) {
|
|
20810
20846
|
wrapFetchError5(err);
|
|
@@ -20818,7 +20854,7 @@ var EnvironmentsClient = class {
|
|
|
20818
20854
|
const result = await this._http.GET("/api/v1/environments/{id}", {
|
|
20819
20855
|
params: { path: { id } }
|
|
20820
20856
|
});
|
|
20821
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
20857
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
20822
20858
|
data = result.data;
|
|
20823
20859
|
} catch (err) {
|
|
20824
20860
|
wrapFetchError5(err);
|
|
@@ -20833,7 +20869,7 @@ var EnvironmentsClient = class {
|
|
|
20833
20869
|
params: { path: { id } }
|
|
20834
20870
|
});
|
|
20835
20871
|
if (!result.response.ok && result.response.status !== 204) {
|
|
20836
|
-
await checkError5(result.response);
|
|
20872
|
+
await checkError5(result.response, result.error);
|
|
20837
20873
|
}
|
|
20838
20874
|
} catch (err) {
|
|
20839
20875
|
wrapFetchError5(err);
|
|
@@ -20856,7 +20892,7 @@ var EnvironmentsClient = class {
|
|
|
20856
20892
|
let data;
|
|
20857
20893
|
try {
|
|
20858
20894
|
const result = await this._http.POST("/api/v1/environments", { body });
|
|
20859
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
20895
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
20860
20896
|
data = result.data;
|
|
20861
20897
|
} catch (err) {
|
|
20862
20898
|
wrapFetchError5(err);
|
|
@@ -20885,7 +20921,7 @@ var EnvironmentsClient = class {
|
|
|
20885
20921
|
params: { path: { id: env.id } },
|
|
20886
20922
|
body
|
|
20887
20923
|
});
|
|
20888
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
20924
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
20889
20925
|
data = result.data;
|
|
20890
20926
|
} catch (err) {
|
|
20891
20927
|
wrapFetchError5(err);
|
|
@@ -20930,7 +20966,7 @@ var ContextTypesClient = class {
|
|
|
20930
20966
|
const result = await this._http.GET("/api/v1/context_types", {
|
|
20931
20967
|
params: { query }
|
|
20932
20968
|
});
|
|
20933
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
20969
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
20934
20970
|
data = result.data;
|
|
20935
20971
|
} catch (err) {
|
|
20936
20972
|
wrapFetchError5(err);
|
|
@@ -20944,7 +20980,7 @@ var ContextTypesClient = class {
|
|
|
20944
20980
|
const result = await this._http.GET("/api/v1/context_types/{id}", {
|
|
20945
20981
|
params: { path: { id } }
|
|
20946
20982
|
});
|
|
20947
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
20983
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
20948
20984
|
data = result.data;
|
|
20949
20985
|
} catch (err) {
|
|
20950
20986
|
wrapFetchError5(err);
|
|
@@ -20959,7 +20995,7 @@ var ContextTypesClient = class {
|
|
|
20959
20995
|
params: { path: { id } }
|
|
20960
20996
|
});
|
|
20961
20997
|
if (!result.response.ok && result.response.status !== 204) {
|
|
20962
|
-
await checkError5(result.response);
|
|
20998
|
+
await checkError5(result.response, result.error);
|
|
20963
20999
|
}
|
|
20964
21000
|
} catch (err) {
|
|
20965
21001
|
wrapFetchError5(err);
|
|
@@ -20980,7 +21016,7 @@ var ContextTypesClient = class {
|
|
|
20980
21016
|
let data;
|
|
20981
21017
|
try {
|
|
20982
21018
|
const result = await this._http.POST("/api/v1/context_types", { body });
|
|
20983
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
21019
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
20984
21020
|
data = result.data;
|
|
20985
21021
|
} catch (err) {
|
|
20986
21022
|
wrapFetchError5(err);
|
|
@@ -21007,7 +21043,7 @@ var ContextTypesClient = class {
|
|
|
21007
21043
|
params: { path: { id: ct.id } },
|
|
21008
21044
|
body
|
|
21009
21045
|
});
|
|
21010
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
21046
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
21011
21047
|
data = result.data;
|
|
21012
21048
|
} catch (err) {
|
|
21013
21049
|
wrapFetchError5(err);
|
|
@@ -21086,7 +21122,7 @@ var ContextsClient = class {
|
|
|
21086
21122
|
}))
|
|
21087
21123
|
}
|
|
21088
21124
|
});
|
|
21089
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
21125
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
21090
21126
|
} catch (err) {
|
|
21091
21127
|
wrapFetchError5(err);
|
|
21092
21128
|
}
|
|
@@ -21112,7 +21148,7 @@ var ContextsClient = class {
|
|
|
21112
21148
|
const result = await this._http.GET("/api/v1/contexts", {
|
|
21113
21149
|
params: { query }
|
|
21114
21150
|
});
|
|
21115
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
21151
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
21116
21152
|
data = result.data;
|
|
21117
21153
|
} catch (err) {
|
|
21118
21154
|
wrapFetchError5(err);
|
|
@@ -21129,7 +21165,7 @@ var ContextsClient = class {
|
|
|
21129
21165
|
const result = await this._http.GET("/api/v1/contexts/{id}", {
|
|
21130
21166
|
params: { path: { id: composite } }
|
|
21131
21167
|
});
|
|
21132
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
21168
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
21133
21169
|
data = result.data;
|
|
21134
21170
|
} catch (err) {
|
|
21135
21171
|
wrapFetchError5(err);
|
|
@@ -21147,7 +21183,7 @@ var ContextsClient = class {
|
|
|
21147
21183
|
params: { path: { id: composite } }
|
|
21148
21184
|
});
|
|
21149
21185
|
if (!result.response.ok && result.response.status !== 204) {
|
|
21150
|
-
await checkError5(result.response);
|
|
21186
|
+
await checkError5(result.response, result.error);
|
|
21151
21187
|
}
|
|
21152
21188
|
} catch (err) {
|
|
21153
21189
|
wrapFetchError5(err);
|
|
@@ -21177,7 +21213,7 @@ var ContextsClient = class {
|
|
|
21177
21213
|
params: { path: { id: ctx.id } },
|
|
21178
21214
|
body
|
|
21179
21215
|
});
|
|
21180
|
-
if (!result.response.ok) await checkError5(result.response);
|
|
21216
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
21181
21217
|
data = result.data;
|
|
21182
21218
|
} catch (err) {
|
|
21183
21219
|
wrapFetchError5(err);
|