@smplkit/sdk 1.3.27 → 1.3.28

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.d.ts CHANGED
@@ -79,15 +79,13 @@ declare class SharedWebSocket {
79
79
  * Creates if new, updates if existing.
80
80
  */
81
81
  declare class Config {
82
- /** UUID of the config, or `null` if unsaved. */
82
+ /** Unique identifier (slug, e.g. `"user-service"`). */
83
83
  id: string | null;
84
- /** Human-readable key (e.g. `"user-service"`). */
85
- key: string;
86
84
  /** Display name. */
87
85
  name: string;
88
86
  /** Optional description. */
89
87
  description: string | null;
90
- /** Parent config UUID, or null if this is a root config. */
88
+ /** Parent config id (slug), or null if this is a root config. */
91
89
  parent: string | null;
92
90
  /** Base key-value pairs. */
93
91
  items: Record<string, unknown>;
@@ -105,7 +103,6 @@ declare class Config {
105
103
  /** @internal */
106
104
  constructor(client: ConfigClient, fields: {
107
105
  id: string | null;
108
- key: string;
109
106
  name: string;
110
107
  description: string | null;
111
108
  parent: string | null;
@@ -168,8 +165,8 @@ declare class LiveConfigProxy<T = Record<string, unknown>> {
168
165
 
169
166
  /** Describes a single config value change detected on refresh. */
170
167
  interface ConfigChangeEvent {
171
- /** The config key that changed. */
172
- configKey: string;
168
+ /** The config id that changed. */
169
+ configId: string;
173
170
  /** The item key within the config that changed. */
174
171
  itemKey: string;
175
172
  /** The previous value (null if the key was absent). */
@@ -205,45 +202,45 @@ declare class ConfigClient {
205
202
  /** @internal */
206
203
  constructor(apiKey: string, timeout?: number);
207
204
  /** Create an unsaved config. Call `.save()` to persist. */
208
- new(key: string, options?: {
205
+ new(id: string, options?: {
209
206
  name?: string;
210
207
  description?: string;
211
208
  parent?: string;
212
209
  }): Config;
213
- /** Fetch a config by key. */
214
- get(key: string): Promise<Config>;
210
+ /** Fetch a config by id. */
211
+ get(id: string): Promise<Config>;
215
212
  /** List all configs. */
216
213
  list(): Promise<Config[]>;
217
- /** Delete a config by key. */
218
- delete(key: string): Promise<void>;
214
+ /** Delete a config by id. */
215
+ delete(id: string): Promise<void>;
219
216
  /** @internal — POST a new config. */
220
217
  _createConfig(config: Config): Promise<Config>;
221
218
  /** @internal — PUT a config update. */
222
219
  _updateConfig(config: Config): Promise<Config>;
223
- /** @internal — fetch a config by UUID. */
224
- _getById(configId: string): Promise<Config>;
220
+ /** @internal — fetch a config by id. */
221
+ _getById(id: string): Promise<Config>;
225
222
  /**
226
223
  * Resolve a config's values for the current environment.
227
224
  *
228
225
  * Returns the resolved key-value pairs for the given config.
229
226
  * Optionally pass a model class to map the resolved values.
230
227
  */
231
- resolve<T = Record<string, unknown>>(key: string, model?: new (data: any) => T): Promise<T>;
228
+ resolve<T = Record<string, unknown>>(id: string, model?: new (data: any) => T): Promise<T>;
232
229
  /**
233
230
  * Subscribe to a config's values. Returns a proxy whose properties
234
231
  * always reflect the latest resolved values.
235
232
  *
236
233
  * Optionally pass a model class to map the resolved values.
237
234
  */
238
- subscribe<T = Record<string, unknown>>(key: string, model?: new (data: any) => T): Promise<LiveConfigProxy<T>>;
235
+ subscribe<T = Record<string, unknown>>(id: string, model?: new (data: any) => T): Promise<LiveConfigProxy<T>>;
239
236
  /**
240
237
  * Register a change listener.
241
238
  *
242
239
  * - `onChange(callback)` — fires for any config change (global).
243
- * - `onChange(configKey, callback)` — fires for changes to a specific config.
244
- * - `onChange(configKey, itemKey, callback)` — fires for a specific item.
240
+ * - `onChange(configId, callback)` — fires for changes to a specific config.
241
+ * - `onChange(configId, itemKey, callback)` — fires for a specific item.
245
242
  */
246
- onChange(callbackOrConfigKey: string | ((event: ConfigChangeEvent) => void), callbackOrItemKey?: string | ((event: ConfigChangeEvent) => void), callback?: (event: ConfigChangeEvent) => void): void;
243
+ onChange(callbackOrConfigId: string | ((event: ConfigChangeEvent) => void), callbackOrItemKey?: string | ((event: ConfigChangeEvent) => void), callback?: (event: ConfigChangeEvent) => void): void;
247
244
  /**
248
245
  * Refresh all config values from the server.
249
246
  * Fires change listeners for any values that changed.
@@ -258,7 +255,6 @@ declare class ConfigClient {
258
255
  private _handleConfigChanged;
259
256
  /** @internal */
260
257
  private _diffAndFire;
261
- private _getByKey;
262
258
  }
263
259
 
264
260
  interface components {
@@ -291,7 +287,6 @@ interface components {
291
287
  * "rules": []
292
288
  * }
293
289
  * },
294
- * "key": "dark_mode",
295
290
  * "name": "Dark Mode",
296
291
  * "type": "BOOLEAN",
297
292
  * "updated_at": "2026-03-27T10:00:00Z",
@@ -308,11 +303,8 @@ interface components {
308
303
  * }
309
304
  */
310
305
  Flag: {
311
- /**
312
- * Key
313
- * @description Unique key within account
314
- */
315
- key: string;
306
+ /** Id */
307
+ id?: string | null;
316
308
  /**
317
309
  * Name
318
310
  * @description Human-readable display name
@@ -388,7 +380,6 @@ interface components {
388
380
  * ]
389
381
  * }
390
382
  * },
391
- * "key": "dark_mode",
392
383
  * "name": "Dark Mode",
393
384
  * "type": "BOOLEAN",
394
385
  * "updated_at": "2026-03-27T10:00:00Z",
@@ -403,7 +394,7 @@ interface components {
403
394
  * }
404
395
  * ]
405
396
  * },
406
- * "id": "550e8400-e29b-41d4-a716-446655440000",
397
+ * "id": "dark_mode",
407
398
  * "type": "flag"
408
399
  * }
409
400
  */
@@ -542,10 +533,8 @@ declare class Rule {
542
533
  * Call `save()` to persist changes. Call `get()` to evaluate the flag.
543
534
  */
544
535
  declare class Flag {
545
- /** UUID of the flag, or `null` if unsaved. */
536
+ /** Unique identifier (slug) within the account. */
546
537
  id: string | null;
547
- /** Unique key within the account. */
548
- key: string;
549
538
  /** Human-readable display name. */
550
539
  name: string;
551
540
  /** Value type: BOOLEAN, STRING, NUMERIC, or JSON. */
@@ -570,7 +559,6 @@ declare class Flag {
570
559
  /** @internal */
571
560
  constructor(client: FlagsClient, fields: {
572
561
  id: string | null;
573
- key: string;
574
562
  name: string;
575
563
  type: string;
576
564
  default: unknown;
@@ -649,9 +637,9 @@ declare class JsonFlag extends Flag {
649
637
  type FlagResource = components["schemas"]["FlagResource"];
650
638
  /** Describes a flag definition change. */
651
639
  declare class FlagChangeEvent {
652
- readonly key: string;
640
+ readonly id: string;
653
641
  readonly source: string;
654
- constructor(key: string, source: string);
642
+ constructor(id: string, source: string);
655
643
  }
656
644
  /** Evaluation statistics for the flags runtime. */
657
645
  declare class FlagStats {
@@ -693,13 +681,13 @@ declare class FlagsClient {
693
681
  /** @internal */
694
682
  constructor(apiKey: string, ensureWs: () => SharedWebSocket, timeout?: number);
695
683
  /** Create an unsaved boolean flag. Call `.save()` to persist. */
696
- newBooleanFlag(key: string, options: {
684
+ newBooleanFlag(id: string, options: {
697
685
  default: boolean;
698
686
  name?: string;
699
687
  description?: string;
700
688
  }): BooleanFlag;
701
689
  /** Create an unsaved string flag. Call `.save()` to persist. */
702
- newStringFlag(key: string, options: {
690
+ newStringFlag(id: string, options: {
703
691
  default: string;
704
692
  name?: string;
705
693
  description?: string;
@@ -709,7 +697,7 @@ declare class FlagsClient {
709
697
  }>;
710
698
  }): StringFlag;
711
699
  /** Create an unsaved number flag. Call `.save()` to persist. */
712
- newNumberFlag(key: string, options: {
700
+ newNumberFlag(id: string, options: {
713
701
  default: number;
714
702
  name?: string;
715
703
  description?: string;
@@ -719,7 +707,7 @@ declare class FlagsClient {
719
707
  }>;
720
708
  }): NumberFlag;
721
709
  /** Create an unsaved JSON flag. Call `.save()` to persist. */
722
- newJsonFlag(key: string, options: {
710
+ newJsonFlag(id: string, options: {
723
711
  default: Record<string, any>;
724
712
  name?: string;
725
713
  description?: string;
@@ -728,24 +716,24 @@ declare class FlagsClient {
728
716
  value: unknown;
729
717
  }>;
730
718
  }): JsonFlag;
731
- /** Fetch a flag by key. */
732
- get(key: string): Promise<Flag>;
719
+ /** Fetch a flag by id. */
720
+ get(id: string): Promise<Flag>;
733
721
  /** List all flags. */
734
722
  list(): Promise<Flag[]>;
735
- /** Delete a flag by key. */
736
- delete(key: string): Promise<void>;
723
+ /** Delete a flag by id. */
724
+ delete(id: string): Promise<void>;
737
725
  /** @internal — POST a new flag. */
738
726
  _createFlag(flag: Flag): Promise<Flag>;
739
727
  /** @internal — PUT a flag update. */
740
728
  _updateFlag(flag: Flag): Promise<Flag>;
741
729
  /** Declare a boolean flag handle for runtime evaluation. */
742
- booleanFlag(key: string, defaultValue: boolean): BooleanFlag;
730
+ booleanFlag(id: string, defaultValue: boolean): BooleanFlag;
743
731
  /** Declare a string flag handle for runtime evaluation. */
744
- stringFlag(key: string, defaultValue: string): StringFlag;
732
+ stringFlag(id: string, defaultValue: string): StringFlag;
745
733
  /** Declare a numeric flag handle for runtime evaluation. */
746
- numberFlag(key: string, defaultValue: number): NumberFlag;
734
+ numberFlag(id: string, defaultValue: number): NumberFlag;
747
735
  /** Declare a JSON flag handle for runtime evaluation. */
748
- jsonFlag(key: string, defaultValue: Record<string, any>): JsonFlag;
736
+ jsonFlag(id: string, defaultValue: Record<string, any>): JsonFlag;
749
737
  /**
750
738
  * Register a context provider function.
751
739
  *
@@ -775,9 +763,9 @@ declare class FlagsClient {
775
763
  * Register a change listener.
776
764
  *
777
765
  * - `onChange(callback)` — fires for any flag change.
778
- * - `onChange(key, callback)` — fires only for the specified flag key.
766
+ * - `onChange(id, callback)` — fires only for the specified flag id.
779
767
  */
780
- onChange(callbackOrKey: string | ((event: FlagChangeEvent) => void), callback?: (event: FlagChangeEvent) => void): void;
768
+ onChange(callbackOrId: string | ((event: FlagChangeEvent) => void), callback?: (event: FlagChangeEvent) => void): void;
781
769
  /**
782
770
  * Register context(s) with the server.
783
771
  *
@@ -789,7 +777,7 @@ declare class FlagsClient {
789
777
  /**
790
778
  * Evaluate a flag with an explicit environment and context.
791
779
  */
792
- evaluate(key: string, options: {
780
+ evaluate(id: string, options: {
793
781
  environment: string;
794
782
  context: Context[];
795
783
  }): Promise<any>;
@@ -824,8 +812,8 @@ declare enum LogLevel {
824
812
  }
825
813
  /** Describes a logger configuration change. */
826
814
  interface LoggerChangeEvent {
827
- /** The logger key that changed. */
828
- key: string;
815
+ /** The logger id that changed. */
816
+ id: string;
829
817
  /** The new effective log level, or null if removed. */
830
818
  level: LogLevel | null;
831
819
  /** How the change was delivered. */
@@ -842,15 +830,13 @@ interface LoggerChangeEvent {
842
830
  * Mutate properties or use convenience methods, then call `save()` to persist.
843
831
  */
844
832
  declare class Logger {
845
- /** UUID of the logger, or `null` if unsaved. */
833
+ /** Unique identifier (dot-separated hierarchy, e.g. `"sqlalchemy.engine"`). */
846
834
  id: string | null;
847
- /** Unique key (dot-separated hierarchy). */
848
- key: string;
849
835
  /** Human-readable display name. */
850
836
  name: string;
851
837
  /** Base log level, or null if inherited. */
852
838
  level: string | null;
853
- /** UUID of the parent log group, or null. */
839
+ /** Id of the parent log group, or null. */
854
840
  group: string | null;
855
841
  /** Whether this logger is managed by the platform. */
856
842
  managed: boolean;
@@ -867,7 +853,6 @@ declare class Logger {
867
853
  /** @internal */
868
854
  constructor(client: LoggingClient, fields: {
869
855
  id: string | null;
870
- key: string;
871
856
  name: string;
872
857
  level: string | null;
873
858
  group: string | null;
@@ -903,15 +888,13 @@ declare class Logger {
903
888
  * Management: mutate properties and call `save()` to persist.
904
889
  */
905
890
  declare class LogGroup {
906
- /** UUID of the log group, or `null` if unsaved. */
891
+ /** Unique identifier (slug), or `null` if unsaved. */
907
892
  id: string | null;
908
- /** Unique key. */
909
- key: string;
910
893
  /** Human-readable display name. */
911
894
  name: string;
912
895
  /** Base log level, or null if inherited. */
913
896
  level: string | null;
914
- /** UUID of the parent log group, or null. */
897
+ /** Id of the parent log group, or null. */
915
898
  group: string | null;
916
899
  /** Per-environment level overrides. */
917
900
  environments: Record<string, any>;
@@ -924,7 +907,6 @@ declare class LogGroup {
924
907
  /** @internal */
925
908
  constructor(client: LoggingClient, fields: {
926
909
  id: string | null;
927
- key: string;
928
910
  name: string;
929
911
  level: string | null;
930
912
  group: string | null;
@@ -1021,27 +1003,27 @@ declare class LoggingClient {
1021
1003
  */
1022
1004
  registerAdapter(adapter: LoggingAdapter): void;
1023
1005
  /** Create an unsaved logger. Call `.save()` to persist. */
1024
- new(key: string, options?: {
1006
+ new(id: string, options?: {
1025
1007
  name?: string;
1026
1008
  managed?: boolean;
1027
1009
  }): Logger;
1028
- /** Fetch a logger by key. */
1029
- get(key: string): Promise<Logger>;
1010
+ /** Fetch a logger by id. */
1011
+ get(id: string): Promise<Logger>;
1030
1012
  /** List all loggers. */
1031
1013
  list(): Promise<Logger[]>;
1032
- /** Delete a logger by key. */
1033
- delete(key: string): Promise<void>;
1014
+ /** Delete a logger by id. */
1015
+ delete(id: string): Promise<void>;
1034
1016
  /** Create an unsaved log group. Call `.save()` to persist. */
1035
- newGroup(key: string, options?: {
1017
+ newGroup(id: string, options?: {
1036
1018
  name?: string;
1037
1019
  group?: string;
1038
1020
  }): LogGroup;
1039
- /** Fetch a log group by key. */
1040
- getGroup(key: string): Promise<LogGroup>;
1021
+ /** Fetch a log group by id. */
1022
+ getGroup(id: string): Promise<LogGroup>;
1041
1023
  /** List all log groups. */
1042
1024
  listGroups(): Promise<LogGroup[]>;
1043
- /** Delete a log group by key. */
1044
- deleteGroup(key: string): Promise<void>;
1025
+ /** Delete a log group by id. */
1026
+ deleteGroup(id: string): Promise<void>;
1045
1027
  /** @internal — POST or PUT a logger. */
1046
1028
  _saveLogger(logger: Logger): Promise<Logger>;
1047
1029
  /** @internal — POST or PUT a log group. */
@@ -1058,9 +1040,9 @@ declare class LoggingClient {
1058
1040
  * Register a change listener.
1059
1041
  *
1060
1042
  * - `onChange(callback)` — fires for any logger change.
1061
- * - `onChange(key, callback)` — fires only for the specified logger key.
1043
+ * - `onChange(id, callback)` — fires only for the specified logger id.
1062
1044
  */
1063
- onChange(callbackOrKey: string | ((event: LoggerChangeEvent) => void), callback?: (event: LoggerChangeEvent) => void): void;
1045
+ onChange(callbackOrId: string | ((event: LoggerChangeEvent) => void), callback?: (event: LoggerChangeEvent) => void): void;
1064
1046
  /** @internal */
1065
1047
  _close(): void;
1066
1048
  /** Auto-load built-in adapters by attempting to require each framework. */