@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.cjs CHANGED
@@ -16804,7 +16804,7 @@ var Config = class {
16804
16804
  description;
16805
16805
  /** Parent config UUID, or null if this is a root config. */
16806
16806
  parent;
16807
- /** Base key-value pairs (unwrapped from typed item definitions). */
16807
+ /** Base key-value pairs. */
16808
16808
  items;
16809
16809
  /**
16810
16810
  * Per-environment overrides.
@@ -17211,9 +17211,7 @@ var ConfigClient = class {
17211
17211
  /**
17212
17212
  * Resolve a config's values for the current environment.
17213
17213
  *
17214
- * Returns a flat dict of resolved key-value pairs with inherited
17215
- * values and environment overrides applied.
17216
- *
17214
+ * Returns the resolved key-value pairs for the given config.
17217
17215
  * Optionally pass a model class to map the resolved values.
17218
17216
  */
17219
17217
  async resolve(key, model) {
@@ -17228,8 +17226,8 @@ var ConfigClient = class {
17228
17226
  return values;
17229
17227
  }
17230
17228
  /**
17231
- * Subscribe to a config's values returns a live proxy that
17232
- * auto-updates when the underlying config changes.
17229
+ * Subscribe to a config's values. Returns a proxy whose properties
17230
+ * always reflect the latest resolved values.
17233
17231
  *
17234
17232
  * Optionally pass a model class to map the resolved values.
17235
17233
  */
@@ -17275,8 +17273,8 @@ var ConfigClient = class {
17275
17273
  // Runtime: refresh
17276
17274
  // ------------------------------------------------------------------
17277
17275
  /**
17278
- * Re-fetch all configs and re-resolve values.
17279
- * Fires change listeners for any values that differ.
17276
+ * Refresh all config values from the server.
17277
+ * Fires change listeners for any values that changed.
17280
17278
  */
17281
17279
  async refresh() {
17282
17280
  if (!this._initialized) {
@@ -17454,10 +17452,10 @@ var Flag = class {
17454
17452
  }
17455
17453
  }
17456
17454
  /**
17457
- * Add a rule to a specific environment (sync local mutation).
17455
+ * Add a rule to a specific environment.
17458
17456
  *
17459
17457
  * The built rule must include an `environment` key (set via
17460
- * `Rule(...).environment("env_key")`). No HTTP call is made.
17458
+ * `Rule(...).environment("env_key")`). Call `save()` to persist.
17461
17459
  *
17462
17460
  * @returns `this` for chaining.
17463
17461
  */
@@ -17478,7 +17476,7 @@ var Flag = class {
17478
17476
  this.environments = envs;
17479
17477
  return this;
17480
17478
  }
17481
- /** Enable or disable a flag in a specific environment (sync local mutation). */
17479
+ /** Enable or disable a flag in a specific environment. Call `save()` to persist. */
17482
17480
  setEnvironmentEnabled(envKey, enabled) {
17483
17481
  const envs = { ...this.environments };
17484
17482
  const envData = { ...envs[envKey] ?? { enabled: false, rules: [] } };
@@ -17486,7 +17484,7 @@ var Flag = class {
17486
17484
  envs[envKey] = envData;
17487
17485
  this.environments = envs;
17488
17486
  }
17489
- /** Set the default value for a specific environment (sync local mutation). */
17487
+ /** Set the default value for a specific environment. Call `save()` to persist. */
17490
17488
  setEnvironmentDefault(envKey, defaultValue) {
17491
17489
  const envs = { ...this.environments };
17492
17490
  const envData = { ...envs[envKey] ?? { enabled: false, rules: [] } };
@@ -17494,7 +17492,7 @@ var Flag = class {
17494
17492
  envs[envKey] = envData;
17495
17493
  this.environments = envs;
17496
17494
  }
17497
- /** Clear all rules for a specific environment (sync local mutation). */
17495
+ /** Clear all rules for a specific environment. Call `save()` to persist. */
17498
17496
  clearRules(envKey) {
17499
17497
  const envs = { ...this.environments };
17500
17498
  const envData = envs[envKey];
@@ -17504,9 +17502,9 @@ var Flag = class {
17504
17502
  }
17505
17503
  }
17506
17504
  /**
17507
- * Evaluate the flag locally.
17505
+ * Evaluate the flag and return its current value.
17508
17506
  *
17509
- * Requires `initialize()` to have been called.
17507
+ * Requires `initialize()` to have been called on the flags client.
17510
17508
  */
17511
17509
  get(options) {
17512
17510
  return this._client._evaluateHandle(this.key, this.default, options?.context ?? null);
@@ -18048,7 +18046,7 @@ var FlagsClient = class {
18048
18046
  // Runtime: initialize / disconnect / refresh
18049
18047
  // ------------------------------------------------------------------
18050
18048
  /**
18051
- * Initialize the flags runtime: fetch definitions and wire WebSocket.
18049
+ * Initialize the flags runtime.
18052
18050
  *
18053
18051
  * Idempotent — safe to call multiple times. Must be called (and awaited)
18054
18052
  * before using `.get()` on flag handles.
@@ -18063,7 +18061,7 @@ var FlagsClient = class {
18063
18061
  this._wsManager.on("flag_changed", this._handleFlagChanged);
18064
18062
  this._wsManager.on("flag_deleted", this._handleFlagDeleted);
18065
18063
  }
18066
- /** Disconnect: unregister from WebSocket, flush contexts, clear state. */
18064
+ /** Disconnect the flags runtime and release resources. */
18067
18065
  async disconnect() {
18068
18066
  if (this._wsManager !== null) {
18069
18067
  this._wsManager.off("flag_changed", this._handleFlagChanged);
@@ -18076,30 +18074,30 @@ var FlagsClient = class {
18076
18074
  this._initialized = false;
18077
18075
  this._environment = null;
18078
18076
  }
18079
- /** Re-fetch all flag definitions and clear cache. */
18077
+ /** Refresh all flag definitions from the server. */
18080
18078
  async refresh() {
18081
18079
  await this._fetchAllFlags();
18082
18080
  this._cache.clear();
18083
18081
  this._fireChangeListenersAll("manual");
18084
18082
  }
18085
- /** Return the current WebSocket connection status. */
18083
+ /** Return the current real-time connection status. */
18086
18084
  connectionStatus() {
18087
18085
  if (this._wsManager !== null) {
18088
18086
  return this._wsManager.connectionStatus;
18089
18087
  }
18090
18088
  return "disconnected";
18091
18089
  }
18092
- /** Return cache statistics. */
18090
+ /** Return evaluation statistics. */
18093
18091
  stats() {
18094
18092
  return new FlagStats(this._cache.cacheHits, this._cache.cacheMisses);
18095
18093
  }
18096
18094
  // ------------------------------------------------------------------
18097
- // Runtime: change listeners (dual-mode)
18095
+ // Runtime: change listeners
18098
18096
  // ------------------------------------------------------------------
18099
18097
  /**
18100
18098
  * Register a change listener.
18101
18099
  *
18102
- * - `onChange(callback)` — fires for any flag change (global).
18100
+ * - `onChange(callback)` — fires for any flag change.
18103
18101
  * - `onChange(key, callback)` — fires only for the specified flag key.
18104
18102
  */
18105
18103
  onChange(callbackOrKey, callback) {
@@ -18122,8 +18120,7 @@ var FlagsClient = class {
18122
18120
  /**
18123
18121
  * Register context(s) with the server.
18124
18122
  *
18125
- * Accepts a single Context or an array. Registration is asynchronous
18126
- * and never blocks. Works before `initialize()` is called.
18123
+ * Accepts a single Context or an array. Works before `initialize()` is called.
18127
18124
  */
18128
18125
  register(context) {
18129
18126
  if (Array.isArray(context)) {
@@ -18141,8 +18138,6 @@ var FlagsClient = class {
18141
18138
  // ------------------------------------------------------------------
18142
18139
  /**
18143
18140
  * Evaluate a flag with an explicit environment and context.
18144
- *
18145
- * Stateless — does not use the context provider or cached results.
18146
18141
  */
18147
18142
  async evaluate(key, options) {
18148
18143
  const evalDict = contextsToEvalDict(options.context);
@@ -18391,21 +18386,21 @@ var Logger = class {
18391
18386
  const saved = await this._client._saveLogger(this);
18392
18387
  this._apply(saved);
18393
18388
  }
18394
- /** Set the base log level (sync local mutation). */
18389
+ /** Set the base log level. Call `save()` to persist. */
18395
18390
  setLevel(level) {
18396
18391
  this.level = level;
18397
18392
  }
18398
- /** Clear the base log level (sync local mutation). */
18393
+ /** Clear the base log level. Call `save()` to persist. */
18399
18394
  clearLevel() {
18400
18395
  this.level = null;
18401
18396
  }
18402
- /** Set an environment-specific log level (sync local mutation). */
18397
+ /** Set an environment-specific log level. Call `save()` to persist. */
18403
18398
  setEnvironmentLevel(env, level) {
18404
18399
  const envs = { ...this.environments };
18405
18400
  envs[env] = { ...envs[env] ?? {}, level };
18406
18401
  this.environments = envs;
18407
18402
  }
18408
- /** Clear an environment-specific log level (sync local mutation). */
18403
+ /** Clear an environment-specific log level. Call `save()` to persist. */
18409
18404
  clearEnvironmentLevel(env) {
18410
18405
  const envs = { ...this.environments };
18411
18406
  if (envs[env]) {
@@ -18415,7 +18410,7 @@ var Logger = class {
18415
18410
  this.environments = envs;
18416
18411
  }
18417
18412
  }
18418
- /** Clear all environment-specific log levels (sync local mutation). */
18413
+ /** Clear all environment-specific log levels. Call `save()` to persist. */
18419
18414
  clearAllEnvironmentLevels() {
18420
18415
  this.environments = {};
18421
18416
  }
@@ -18476,21 +18471,21 @@ var LogGroup = class {
18476
18471
  const saved = await this._client._saveLogGroup(this);
18477
18472
  this._apply(saved);
18478
18473
  }
18479
- /** Set the base log level (sync local mutation). */
18474
+ /** Set the base log level. Call `save()` to persist. */
18480
18475
  setLevel(level) {
18481
18476
  this.level = level;
18482
18477
  }
18483
- /** Clear the base log level (sync local mutation). */
18478
+ /** Clear the base log level. Call `save()` to persist. */
18484
18479
  clearLevel() {
18485
18480
  this.level = null;
18486
18481
  }
18487
- /** Set an environment-specific log level (sync local mutation). */
18482
+ /** Set an environment-specific log level. Call `save()` to persist. */
18488
18483
  setEnvironmentLevel(env, level) {
18489
18484
  const envs = { ...this.environments };
18490
18485
  envs[env] = { ...envs[env] ?? {}, level };
18491
18486
  this.environments = envs;
18492
18487
  }
18493
- /** Clear an environment-specific log level (sync local mutation). */
18488
+ /** Clear an environment-specific log level. Call `save()` to persist. */
18494
18489
  clearEnvironmentLevel(env) {
18495
18490
  const envs = { ...this.environments };
18496
18491
  if (envs[env]) {
@@ -18500,7 +18495,7 @@ var LogGroup = class {
18500
18495
  this.environments = envs;
18501
18496
  }
18502
18497
  }
18503
- /** Clear all environment-specific log levels (sync local mutation). */
18498
+ /** Clear all environment-specific log levels. Call `save()` to persist. */
18504
18499
  clearAllEnvironmentLevels() {
18505
18500
  this.environments = {};
18506
18501
  }
@@ -18586,8 +18581,8 @@ var LoggingClient = class {
18586
18581
  /**
18587
18582
  * Register a logging framework adapter.
18588
18583
  *
18589
- * Must be called before `start()`. Disables auto-loading of built-in
18590
- * adapters — only explicitly registered adapters will be used.
18584
+ * Must be called before `start()`. When called, only explicitly
18585
+ * registered adapters will be used.
18591
18586
  */
18592
18587
  registerAdapter(adapter) {
18593
18588
  if (this._started) {
@@ -18814,12 +18809,9 @@ var LoggingClient = class {
18814
18809
  /**
18815
18810
  * Start the logging runtime.
18816
18811
  *
18817
- * Discovers loggers from registered adapters, syncs them with the
18818
- * server, applies server-side log levels, and subscribes to live
18819
- * level updates.
18820
- *
18821
- * Idempotent — safe to call multiple times.
18822
- * Management methods work without start().
18812
+ * Synchronizes loggers with the server and subscribes to live level
18813
+ * updates. Idempotent safe to call multiple times.
18814
+ * Management methods work without calling `start()`.
18823
18815
  */
18824
18816
  async start() {
18825
18817
  if (this._started) return;
@@ -18860,12 +18852,12 @@ var LoggingClient = class {
18860
18852
  this._started = true;
18861
18853
  }
18862
18854
  // ------------------------------------------------------------------
18863
- // Runtime: change listeners (dual-mode)
18855
+ // Runtime: change listeners
18864
18856
  // ------------------------------------------------------------------
18865
18857
  /**
18866
18858
  * Register a change listener.
18867
18859
  *
18868
- * - `onChange(callback)` — fires for any logger change (global).
18860
+ * - `onChange(callback)` — fires for any logger change.
18869
18861
  * - `onChange(key, callback)` — fires only for the specified logger key.
18870
18862
  */
18871
18863
  onChange(callbackOrKey, callback) {