@smplkit/sdk 1.3.23 → 1.3.24

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.js CHANGED
@@ -16766,7 +16766,7 @@ var Config = class {
16766
16766
  description;
16767
16767
  /** Parent config UUID, or null if this is a root config. */
16768
16768
  parent;
16769
- /** Base key-value pairs (unwrapped from typed item definitions). */
16769
+ /** Base key-value pairs. */
16770
16770
  items;
16771
16771
  /**
16772
16772
  * Per-environment overrides.
@@ -17173,9 +17173,7 @@ var ConfigClient = class {
17173
17173
  /**
17174
17174
  * Resolve a config's values for the current environment.
17175
17175
  *
17176
- * Returns a flat dict of resolved key-value pairs with inherited
17177
- * values and environment overrides applied.
17178
- *
17176
+ * Returns the resolved key-value pairs for the given config.
17179
17177
  * Optionally pass a model class to map the resolved values.
17180
17178
  */
17181
17179
  async resolve(key, model) {
@@ -17190,8 +17188,8 @@ var ConfigClient = class {
17190
17188
  return values;
17191
17189
  }
17192
17190
  /**
17193
- * Subscribe to a config's values returns a live proxy that
17194
- * auto-updates when the underlying config changes.
17191
+ * Subscribe to a config's values. Returns a proxy whose properties
17192
+ * always reflect the latest resolved values.
17195
17193
  *
17196
17194
  * Optionally pass a model class to map the resolved values.
17197
17195
  */
@@ -17237,8 +17235,8 @@ var ConfigClient = class {
17237
17235
  // Runtime: refresh
17238
17236
  // ------------------------------------------------------------------
17239
17237
  /**
17240
- * Re-fetch all configs and re-resolve values.
17241
- * Fires change listeners for any values that differ.
17238
+ * Refresh all config values from the server.
17239
+ * Fires change listeners for any values that changed.
17242
17240
  */
17243
17241
  async refresh() {
17244
17242
  if (!this._initialized) {
@@ -17416,10 +17414,10 @@ var Flag = class {
17416
17414
  }
17417
17415
  }
17418
17416
  /**
17419
- * Add a rule to a specific environment (sync local mutation).
17417
+ * Add a rule to a specific environment.
17420
17418
  *
17421
17419
  * The built rule must include an `environment` key (set via
17422
- * `Rule(...).environment("env_key")`). No HTTP call is made.
17420
+ * `Rule(...).environment("env_key")`). Call `save()` to persist.
17423
17421
  *
17424
17422
  * @returns `this` for chaining.
17425
17423
  */
@@ -17440,7 +17438,7 @@ var Flag = class {
17440
17438
  this.environments = envs;
17441
17439
  return this;
17442
17440
  }
17443
- /** Enable or disable a flag in a specific environment (sync local mutation). */
17441
+ /** Enable or disable a flag in a specific environment. Call `save()` to persist. */
17444
17442
  setEnvironmentEnabled(envKey, enabled) {
17445
17443
  const envs = { ...this.environments };
17446
17444
  const envData = { ...envs[envKey] ?? { enabled: false, rules: [] } };
@@ -17448,7 +17446,7 @@ var Flag = class {
17448
17446
  envs[envKey] = envData;
17449
17447
  this.environments = envs;
17450
17448
  }
17451
- /** Set the default value for a specific environment (sync local mutation). */
17449
+ /** Set the default value for a specific environment. Call `save()` to persist. */
17452
17450
  setEnvironmentDefault(envKey, defaultValue) {
17453
17451
  const envs = { ...this.environments };
17454
17452
  const envData = { ...envs[envKey] ?? { enabled: false, rules: [] } };
@@ -17456,7 +17454,7 @@ var Flag = class {
17456
17454
  envs[envKey] = envData;
17457
17455
  this.environments = envs;
17458
17456
  }
17459
- /** Clear all rules for a specific environment (sync local mutation). */
17457
+ /** Clear all rules for a specific environment. Call `save()` to persist. */
17460
17458
  clearRules(envKey) {
17461
17459
  const envs = { ...this.environments };
17462
17460
  const envData = envs[envKey];
@@ -17466,9 +17464,9 @@ var Flag = class {
17466
17464
  }
17467
17465
  }
17468
17466
  /**
17469
- * Evaluate the flag locally.
17467
+ * Evaluate the flag and return its current value.
17470
17468
  *
17471
- * Requires `initialize()` to have been called.
17469
+ * Requires `initialize()` to have been called on the flags client.
17472
17470
  */
17473
17471
  get(options) {
17474
17472
  return this._client._evaluateHandle(this.key, this.default, options?.context ?? null);
@@ -18010,7 +18008,7 @@ var FlagsClient = class {
18010
18008
  // Runtime: initialize / disconnect / refresh
18011
18009
  // ------------------------------------------------------------------
18012
18010
  /**
18013
- * Initialize the flags runtime: fetch definitions and wire WebSocket.
18011
+ * Initialize the flags runtime.
18014
18012
  *
18015
18013
  * Idempotent — safe to call multiple times. Must be called (and awaited)
18016
18014
  * before using `.get()` on flag handles.
@@ -18025,7 +18023,7 @@ var FlagsClient = class {
18025
18023
  this._wsManager.on("flag_changed", this._handleFlagChanged);
18026
18024
  this._wsManager.on("flag_deleted", this._handleFlagDeleted);
18027
18025
  }
18028
- /** Disconnect: unregister from WebSocket, flush contexts, clear state. */
18026
+ /** Disconnect the flags runtime and release resources. */
18029
18027
  async disconnect() {
18030
18028
  if (this._wsManager !== null) {
18031
18029
  this._wsManager.off("flag_changed", this._handleFlagChanged);
@@ -18038,30 +18036,30 @@ var FlagsClient = class {
18038
18036
  this._initialized = false;
18039
18037
  this._environment = null;
18040
18038
  }
18041
- /** Re-fetch all flag definitions and clear cache. */
18039
+ /** Refresh all flag definitions from the server. */
18042
18040
  async refresh() {
18043
18041
  await this._fetchAllFlags();
18044
18042
  this._cache.clear();
18045
18043
  this._fireChangeListenersAll("manual");
18046
18044
  }
18047
- /** Return the current WebSocket connection status. */
18045
+ /** Return the current real-time connection status. */
18048
18046
  connectionStatus() {
18049
18047
  if (this._wsManager !== null) {
18050
18048
  return this._wsManager.connectionStatus;
18051
18049
  }
18052
18050
  return "disconnected";
18053
18051
  }
18054
- /** Return cache statistics. */
18052
+ /** Return evaluation statistics. */
18055
18053
  stats() {
18056
18054
  return new FlagStats(this._cache.cacheHits, this._cache.cacheMisses);
18057
18055
  }
18058
18056
  // ------------------------------------------------------------------
18059
- // Runtime: change listeners (dual-mode)
18057
+ // Runtime: change listeners
18060
18058
  // ------------------------------------------------------------------
18061
18059
  /**
18062
18060
  * Register a change listener.
18063
18061
  *
18064
- * - `onChange(callback)` — fires for any flag change (global).
18062
+ * - `onChange(callback)` — fires for any flag change.
18065
18063
  * - `onChange(key, callback)` — fires only for the specified flag key.
18066
18064
  */
18067
18065
  onChange(callbackOrKey, callback) {
@@ -18084,8 +18082,7 @@ var FlagsClient = class {
18084
18082
  /**
18085
18083
  * Register context(s) with the server.
18086
18084
  *
18087
- * Accepts a single Context or an array. Registration is asynchronous
18088
- * and never blocks. Works before `initialize()` is called.
18085
+ * Accepts a single Context or an array. Works before `initialize()` is called.
18089
18086
  */
18090
18087
  register(context) {
18091
18088
  if (Array.isArray(context)) {
@@ -18103,8 +18100,6 @@ var FlagsClient = class {
18103
18100
  // ------------------------------------------------------------------
18104
18101
  /**
18105
18102
  * Evaluate a flag with an explicit environment and context.
18106
- *
18107
- * Stateless — does not use the context provider or cached results.
18108
18103
  */
18109
18104
  async evaluate(key, options) {
18110
18105
  const evalDict = contextsToEvalDict(options.context);
@@ -18353,21 +18348,21 @@ var Logger = class {
18353
18348
  const saved = await this._client._saveLogger(this);
18354
18349
  this._apply(saved);
18355
18350
  }
18356
- /** Set the base log level (sync local mutation). */
18351
+ /** Set the base log level. Call `save()` to persist. */
18357
18352
  setLevel(level) {
18358
18353
  this.level = level;
18359
18354
  }
18360
- /** Clear the base log level (sync local mutation). */
18355
+ /** Clear the base log level. Call `save()` to persist. */
18361
18356
  clearLevel() {
18362
18357
  this.level = null;
18363
18358
  }
18364
- /** Set an environment-specific log level (sync local mutation). */
18359
+ /** Set an environment-specific log level. Call `save()` to persist. */
18365
18360
  setEnvironmentLevel(env, level) {
18366
18361
  const envs = { ...this.environments };
18367
18362
  envs[env] = { ...envs[env] ?? {}, level };
18368
18363
  this.environments = envs;
18369
18364
  }
18370
- /** Clear an environment-specific log level (sync local mutation). */
18365
+ /** Clear an environment-specific log level. Call `save()` to persist. */
18371
18366
  clearEnvironmentLevel(env) {
18372
18367
  const envs = { ...this.environments };
18373
18368
  if (envs[env]) {
@@ -18377,7 +18372,7 @@ var Logger = class {
18377
18372
  this.environments = envs;
18378
18373
  }
18379
18374
  }
18380
- /** Clear all environment-specific log levels (sync local mutation). */
18375
+ /** Clear all environment-specific log levels. Call `save()` to persist. */
18381
18376
  clearAllEnvironmentLevels() {
18382
18377
  this.environments = {};
18383
18378
  }
@@ -18438,21 +18433,21 @@ var LogGroup = class {
18438
18433
  const saved = await this._client._saveLogGroup(this);
18439
18434
  this._apply(saved);
18440
18435
  }
18441
- /** Set the base log level (sync local mutation). */
18436
+ /** Set the base log level. Call `save()` to persist. */
18442
18437
  setLevel(level) {
18443
18438
  this.level = level;
18444
18439
  }
18445
- /** Clear the base log level (sync local mutation). */
18440
+ /** Clear the base log level. Call `save()` to persist. */
18446
18441
  clearLevel() {
18447
18442
  this.level = null;
18448
18443
  }
18449
- /** Set an environment-specific log level (sync local mutation). */
18444
+ /** Set an environment-specific log level. Call `save()` to persist. */
18450
18445
  setEnvironmentLevel(env, level) {
18451
18446
  const envs = { ...this.environments };
18452
18447
  envs[env] = { ...envs[env] ?? {}, level };
18453
18448
  this.environments = envs;
18454
18449
  }
18455
- /** Clear an environment-specific log level (sync local mutation). */
18450
+ /** Clear an environment-specific log level. Call `save()` to persist. */
18456
18451
  clearEnvironmentLevel(env) {
18457
18452
  const envs = { ...this.environments };
18458
18453
  if (envs[env]) {
@@ -18462,7 +18457,7 @@ var LogGroup = class {
18462
18457
  this.environments = envs;
18463
18458
  }
18464
18459
  }
18465
- /** Clear all environment-specific log levels (sync local mutation). */
18460
+ /** Clear all environment-specific log levels. Call `save()` to persist. */
18466
18461
  clearAllEnvironmentLevels() {
18467
18462
  this.environments = {};
18468
18463
  }
@@ -18548,8 +18543,8 @@ var LoggingClient = class {
18548
18543
  /**
18549
18544
  * Register a logging framework adapter.
18550
18545
  *
18551
- * Must be called before `start()`. Disables auto-loading of built-in
18552
- * adapters — only explicitly registered adapters will be used.
18546
+ * Must be called before `start()`. When called, only explicitly
18547
+ * registered adapters will be used.
18553
18548
  */
18554
18549
  registerAdapter(adapter) {
18555
18550
  if (this._started) {
@@ -18776,12 +18771,9 @@ var LoggingClient = class {
18776
18771
  /**
18777
18772
  * Start the logging runtime.
18778
18773
  *
18779
- * Discovers loggers from registered adapters, syncs them with the
18780
- * server, applies server-side log levels, and subscribes to live
18781
- * level updates.
18782
- *
18783
- * Idempotent — safe to call multiple times.
18784
- * Management methods work without start().
18774
+ * Synchronizes loggers with the server and subscribes to live level
18775
+ * updates. Idempotent safe to call multiple times.
18776
+ * Management methods work without calling `start()`.
18785
18777
  */
18786
18778
  async start() {
18787
18779
  if (this._started) return;
@@ -18822,12 +18814,12 @@ var LoggingClient = class {
18822
18814
  this._started = true;
18823
18815
  }
18824
18816
  // ------------------------------------------------------------------
18825
- // Runtime: change listeners (dual-mode)
18817
+ // Runtime: change listeners
18826
18818
  // ------------------------------------------------------------------
18827
18819
  /**
18828
18820
  * Register a change listener.
18829
18821
  *
18830
- * - `onChange(callback)` — fires for any logger change (global).
18822
+ * - `onChange(callback)` — fires for any logger change.
18831
18823
  * - `onChange(key, callback)` — fires only for the specified logger key.
18832
18824
  */
18833
18825
  onChange(callbackOrKey, callback) {