@guidelytech/flags 0.0.0-stage → 0.7.0

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 ADDED
@@ -0,0 +1,125 @@
1
+ import {
2
+ DEFAULT_FLAGS_API_URL,
3
+ FLAGS_SDK_NAME,
4
+ FLAGS_SDK_VERSION,
5
+ FlagsClient,
6
+ createFlagsClient,
7
+ createStaticFlags,
8
+ isEncryptedPayload,
9
+ isFlagsPayload,
10
+ isRemoteResults,
11
+ parseUrlOverrides,
12
+ stableStringify
13
+ } from "./chunk-ZTY7K7P2.js";
14
+ import {
15
+ ARRAY_OPERATORS,
16
+ ATTRIBUTE_OPERATORS,
17
+ BOOLEAN_OPERATORS,
18
+ DATE_OPERATORS,
19
+ HASHED_OPERATORS,
20
+ NUMBER_OPERATORS,
21
+ PRESENCE_OPERATORS,
22
+ SEMVER_OPERATORS,
23
+ TEXT_OPERATORS,
24
+ __publicField,
25
+ compareSemver,
26
+ effectiveCoverage,
27
+ evaluateAllFlags,
28
+ evaluateFlag,
29
+ fnv1a32,
30
+ hashBucket,
31
+ hashConfidential,
32
+ hashConfidentialAffix,
33
+ instantOf,
34
+ isOn,
35
+ isScheduleActive,
36
+ jsonEquals,
37
+ lookupAttribute,
38
+ numberOf,
39
+ parseSemver,
40
+ sha256Hex,
41
+ textOf
42
+ } from "./chunk-OY4QS3WL.js";
43
+
44
+ // src/sticky.ts
45
+ var InMemoryStickyBucketStore = class {
46
+ constructor() {
47
+ __publicField(this, "docs", /* @__PURE__ */ new Map());
48
+ }
49
+ get(docKey) {
50
+ return this.docs.get(docKey) ?? null;
51
+ }
52
+ set(docKey, assignments) {
53
+ this.docs.set(docKey, { ...assignments });
54
+ }
55
+ };
56
+ var LocalStorageStickyBucketStore = class {
57
+ constructor(prefix = "guidely:sticky:") {
58
+ __publicField(this, "prefix", prefix);
59
+ __publicField(this, "memory", new InMemoryStickyBucketStore());
60
+ }
61
+ get storage() {
62
+ try {
63
+ return typeof localStorage !== "undefined" ? localStorage : null;
64
+ } catch {
65
+ return null;
66
+ }
67
+ }
68
+ get(docKey) {
69
+ try {
70
+ const raw = this.storage?.getItem(this.prefix + docKey);
71
+ if (raw) return JSON.parse(raw);
72
+ } catch {
73
+ }
74
+ return this.memory.get(docKey);
75
+ }
76
+ set(docKey, assignments) {
77
+ this.memory.set(docKey, assignments);
78
+ try {
79
+ this.storage?.setItem(this.prefix + docKey, JSON.stringify(assignments));
80
+ } catch {
81
+ }
82
+ }
83
+ };
84
+ export {
85
+ ARRAY_OPERATORS,
86
+ ATTRIBUTE_OPERATORS,
87
+ BOOLEAN_OPERATORS,
88
+ DATE_OPERATORS,
89
+ DEFAULT_FLAGS_API_URL,
90
+ FLAGS_SDK_NAME,
91
+ FLAGS_SDK_VERSION,
92
+ FlagsClient,
93
+ HASHED_OPERATORS,
94
+ InMemoryStickyBucketStore,
95
+ LocalStorageStickyBucketStore,
96
+ NUMBER_OPERATORS,
97
+ PRESENCE_OPERATORS,
98
+ SEMVER_OPERATORS,
99
+ TEXT_OPERATORS,
100
+ compareSemver,
101
+ createFlagsClient,
102
+ createStaticFlags,
103
+ effectiveCoverage,
104
+ evaluateAllFlags,
105
+ evaluateFlag,
106
+ fnv1a32,
107
+ hashBucket,
108
+ hashConfidential,
109
+ hashConfidentialAffix,
110
+ instantOf,
111
+ isEncryptedPayload,
112
+ isFlagsPayload,
113
+ isOn,
114
+ isRemoteResults,
115
+ isScheduleActive,
116
+ jsonEquals,
117
+ lookupAttribute,
118
+ numberOf,
119
+ parseSemver,
120
+ parseUrlOverrides,
121
+ sha256Hex,
122
+ stableStringify,
123
+ textOf
124
+ };
125
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sticky.ts"],"sourcesContent":["/** Sticky bucket stores (docs/feature-flags-spec.md §3.5): keep a user's experiment variation across config changes. */\nimport type { StickyAssignments, StickyBucketStore } from \"./types\";\n\n/** Keeps assignments in memory for the life of the process (servers, tests). */\nexport class InMemoryStickyBucketStore implements StickyBucketStore {\n private readonly docs = new Map<string, StickyAssignments>();\n get(docKey: string): StickyAssignments | null {\n return this.docs.get(docKey) ?? null;\n }\n set(docKey: string, assignments: StickyAssignments): void {\n this.docs.set(docKey, { ...assignments });\n }\n}\n\n/** Persists assignments in `localStorage` (browsers). Falls back to memory when storage is unavailable. */\nexport class LocalStorageStickyBucketStore implements StickyBucketStore {\n private readonly memory = new InMemoryStickyBucketStore();\n constructor(private readonly prefix = \"guidely:sticky:\") {}\n\n private get storage(): Storage | null {\n try {\n return typeof localStorage !== \"undefined\" ? localStorage : null;\n } catch {\n return null;\n }\n }\n\n get(docKey: string): StickyAssignments | null {\n try {\n const raw = this.storage?.getItem(this.prefix + docKey);\n if (raw) return JSON.parse(raw) as StickyAssignments;\n } catch {\n /* private mode, corrupt entry */\n }\n return this.memory.get(docKey);\n }\n\n set(docKey: string, assignments: StickyAssignments): void {\n this.memory.set(docKey, assignments);\n try {\n this.storage?.setItem(this.prefix + docKey, JSON.stringify(assignments));\n } catch {\n /* quota / private mode */\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,4BAAN,MAA6D;AAAA,EAA7D;AACL,wBAAiB,QAAO,oBAAI,IAA+B;AAAA;AAAA,EAC3D,IAAI,QAA0C;AAC5C,WAAO,KAAK,KAAK,IAAI,MAAM,KAAK;AAAA,EAClC;AAAA,EACA,IAAI,QAAgB,aAAsC;AACxD,SAAK,KAAK,IAAI,QAAQ,EAAE,GAAG,YAAY,CAAC;AAAA,EAC1C;AACF;AAGO,IAAM,gCAAN,MAAiE;AAAA,EAEtE,YAA6B,SAAS,mBAAmB;AAA5B;AAD7B,wBAAiB,UAAS,IAAI,0BAA0B;AAAA,EACE;AAAA,EAE1D,IAAY,UAA0B;AACpC,QAAI;AACF,aAAO,OAAO,iBAAiB,cAAc,eAAe;AAAA,IAC9D,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,IAAI,QAA0C;AAC5C,QAAI;AACF,YAAM,MAAM,KAAK,SAAS,QAAQ,KAAK,SAAS,MAAM;AACtD,UAAI,IAAK,QAAO,KAAK,MAAM,GAAG;AAAA,IAChC,QAAQ;AAAA,IAER;AACA,WAAO,KAAK,OAAO,IAAI,MAAM;AAAA,EAC/B;AAAA,EAEA,IAAI,QAAgB,aAAsC;AACxD,SAAK,OAAO,IAAI,QAAQ,WAAW;AACnC,QAAI;AACF,WAAK,SAAS,QAAQ,KAAK,SAAS,QAAQ,KAAK,UAAU,WAAW,CAAC;AAAA,IACzE,QAAQ;AAAA,IAER;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,69 @@
1
1
  {
2
2
  "name": "@guidelytech/flags",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.7.0",
4
+ "description": "Guidely feature flags and experiments for TypeScript: browsers, Node.js, Next.js, edge runtimes",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "main": "./dist/index.cjs",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.cjs"
16
+ },
17
+ "./evaluate": {
18
+ "types": "./dist/evaluate.d.ts",
19
+ "import": "./dist/evaluate.js",
20
+ "require": "./dist/evaluate.cjs"
21
+ }
22
+ },
23
+ "bin": {
24
+ "guidely-flags": "./dist/cli.js"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md"
29
+ ],
30
+ "devDependencies": {
31
+ "@eslint/js": "^9.39.5",
32
+ "@types/node": "^22.20.5",
33
+ "eslint": "^9.39.5",
34
+ "tsup": "^8.5.1",
35
+ "typescript": "^5.9.3",
36
+ "typescript-eslint": "^8.46.0",
37
+ "vitest": "^3.2.7",
38
+ "tsx": "^4.23.15"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/parmarg/Guidely.git",
46
+ "directory": "packages/flags"
47
+ },
48
+ "homepage": "https://github.com/parmarg/Guidely/tree/main/packages/flags#readme",
49
+ "bugs": {
50
+ "url": "https://github.com/parmarg/Guidely/issues"
51
+ },
52
+ "keywords": [
53
+ "guidely",
54
+ "feature-flags",
55
+ "feature-toggles",
56
+ "experiments",
57
+ "ab-testing",
58
+ "remote-config"
59
+ ],
60
+ "scripts": {
61
+ "build": "tsup",
62
+ "dev": "tsup --watch",
63
+ "typecheck": "tsc --noEmit",
64
+ "test": "vitest run",
65
+ "lint": "eslint src",
66
+ "clean": "rm -rf dist",
67
+ "vectors": "tsx scripts/generate-vectors.ts"
68
+ }
6
69
  }