@togglely/sdk-core 1.1.1 → 1.1.3

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 +10 -0
  2. package/package.json +30 -30
package/README.md CHANGED
@@ -31,6 +31,16 @@ const limit = await client.getNumber('max-items', 10);
31
31
  // Get JSON value
32
32
  const config = await client.getJSON('app-config', {});
33
33
 
34
+ // Set context (useful for multi-tenant and targeting)
35
+ client.setContext({
36
+ userId: 'user-123',
37
+ tenantId: 'customer-abc',
38
+ plan: 'premium'
39
+ });
40
+
41
+ // Flags will now be evaluated against this context
42
+ const isPremiumFeature = await client.isEnabled('premium-feature', false);
43
+
34
44
  // Listen to events
35
45
  client.on('ready', () => console.log('Toggles loaded!'));
36
46
  client.on('offline', () => console.log('Using offline toggles'));
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
- {
2
- "name": "@togglely/sdk-core",
3
- "version": "1.1.1",
4
- "description": "Core SDK for Togglely - Framework agnostic",
5
- "main": "dist/index.js",
6
- "module": "dist/index.esm.js",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "scripts": {
12
- "build": "tsc && rollup -c",
13
- "test": "jest"
14
- },
15
- "keywords": [
16
- "feature-flags",
17
- "feature-toggles",
18
- "togglely",
19
- "core"
20
- ],
21
- "author": "Togglely",
22
- "license": "MIT",
23
- "devDependencies": {
24
- "@rollup/plugin-typescript": "^11.1.5",
25
- "@types/node": "^20.10.4",
26
- "rollup": "^4.9.1",
27
- "tslib": "^2.6.2",
28
- "typescript": "^5.3.3"
29
- }
30
- }
1
+ {
2
+ "name": "@togglely/sdk-core",
3
+ "version": "1.1.3",
4
+ "description": "Core SDK for Togglely - Framework agnostic",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc && rollup -c",
13
+ "test": "jest"
14
+ },
15
+ "keywords": [
16
+ "feature-flags",
17
+ "feature-toggles",
18
+ "togglely",
19
+ "core"
20
+ ],
21
+ "author": "Togglely",
22
+ "license": "MIT",
23
+ "devDependencies": {
24
+ "@rollup/plugin-typescript": "^11.1.5",
25
+ "@types/node": "^20.10.4",
26
+ "rollup": "^4.9.1",
27
+ "tslib": "^2.6.2",
28
+ "typescript": "^5.3.3"
29
+ }
30
+ }