@smplkit/sdk 1.6.1 → 1.6.2

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.
Files changed (2) hide show
  1. package/README.md +29 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -34,28 +34,49 @@ const client3 = new SmplClient();
34
34
 
35
35
  ## Configuration
36
36
 
37
- The API key is resolved using the following priority:
37
+ All settings are resolved from three sources, in order of precedence:
38
38
 
39
- 1. **Explicit argument:** Pass `apiKey` in the constructor options.
40
- 2. **Environment variable:** Set `SMPLKIT_API_KEY`.
41
- 3. **Configuration file:** Add `api_key` under `[default]` in `~/.smplkit`:
39
+ 1. **Constructor options** highest priority, always wins.
40
+ 2. **Environment variables** e.g. `SMPLKIT_API_KEY`, `SMPLKIT_ENVIRONMENT`.
41
+ 3. **Configuration file** (`~/.smplkit`) INI-format with profile support.
42
+ 4. **Defaults** — built-in SDK defaults.
43
+
44
+ ### Configuration File
45
+
46
+ The `~/.smplkit` file supports a `[common]` section (applied to all profiles) and named profiles:
42
47
 
43
48
  ```ini
44
- # ~/.smplkit
49
+ [common]
50
+ environment = production
51
+ service = my-app
45
52
 
46
53
  [default]
47
- api_key = sk_api_your_key_here
54
+ api_key = sk_api_abc123
55
+
56
+ [local]
57
+ base_domain = localhost
58
+ scheme = http
59
+ api_key = sk_api_local_xyz
60
+ environment = development
61
+ debug = true
48
62
  ```
49
63
 
50
- If none of these are set, the SDK throws `SmplError` with a message listing all three methods.
64
+ ### Constructor Examples
51
65
 
52
66
  ```typescript
67
+ // Use a named profile
68
+ const client = new SmplClient({ profile: "local" });
69
+
70
+ // Or configure explicitly
53
71
  const client = new SmplClient({
54
72
  apiKey: "sk_api_...",
55
- timeout: 30_000, // default (ms)
73
+ environment: "production",
74
+ service: "my-service",
56
75
  });
57
76
  ```
58
77
 
78
+ For the complete configuration reference, see the [Configuration Guide](https://docs.smplkit.com/getting-started/configuration).
79
+
59
80
  ## Config
60
81
 
61
82
  ### Runtime (resolve config values)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smplkit/sdk",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "type": "module",
5
5
  "description": "Official TypeScript SDK for the smplkit platform",
6
6
  "main": "./dist/index.cjs",