@featurevisor/sdk 0.14.0 → 0.15.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/CHANGELOG.md +19 -0
- package/dist/index.js.gz +0 -0
- package/package.json +3 -3
- package/src/createInstance.spec.ts +15 -24
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.15.0](https://github.com/fahad19/featurevisor/compare/v0.14.1...v0.15.0) (2023-04-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @featurevisor/sdk
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.14.1](https://github.com/fahad19/featurevisor/compare/v0.14.0...v0.14.1) (2023-04-22)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* do not require variation type in Feature's YAML ([#57](https://github.com/fahad19/featurevisor/issues/57)) ([2e7c0cf](https://github.com/fahad19/featurevisor/commit/2e7c0cfb441a60beffa14dae17152257d97862b0))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [0.14.0](https://github.com/fahad19/featurevisor/compare/v0.13.1...v0.14.0) (2023-04-21)
|
|
7
26
|
|
|
8
27
|
|
package/dist/index.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@featurevisor/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Featurevisor SDK for Node.js and the browser",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"license": "MIT",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@featurevisor/types": "^0.
|
|
45
|
+
"@featurevisor/types": "^0.15.0",
|
|
46
46
|
"compare-versions": "^6.0.0-rc.1",
|
|
47
47
|
"murmurhash": "^2.0.1"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "254d79ee3bcbd5d9c2f771f66e653ffe5512176e"
|
|
50
50
|
}
|
|
@@ -2,12 +2,12 @@ import { DatafileContent } from "@featurevisor/types";
|
|
|
2
2
|
|
|
3
3
|
import { createInstance } from "./createInstance";
|
|
4
4
|
|
|
5
|
-
describe("sdk: createInstance", function() {
|
|
6
|
-
it("should be a function", function() {
|
|
5
|
+
describe("sdk: createInstance", function () {
|
|
6
|
+
it("should be a function", function () {
|
|
7
7
|
expect(typeof createInstance).toEqual("function");
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
it("should create instance with datafile content", function() {
|
|
10
|
+
it("should create instance with datafile content", function () {
|
|
11
11
|
const sdk = createInstance({
|
|
12
12
|
datafile: {
|
|
13
13
|
schemaVersion: "1",
|
|
@@ -21,7 +21,7 @@ describe("sdk: createInstance", function() {
|
|
|
21
21
|
expect(typeof sdk.getVariation).toEqual("function");
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
it("should trigger onReady event once", function(done) {
|
|
24
|
+
it("should trigger onReady event once", function (done) {
|
|
25
25
|
let readyCount = 0;
|
|
26
26
|
|
|
27
27
|
const sdk = createInstance({
|
|
@@ -43,7 +43,7 @@ describe("sdk: createInstance", function() {
|
|
|
43
43
|
}, 0);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
it("should intercept attributes", function() {
|
|
46
|
+
it("should intercept attributes", function () {
|
|
47
47
|
let intercepted = false;
|
|
48
48
|
|
|
49
49
|
const sdk = createInstance({
|
|
@@ -55,10 +55,7 @@ describe("sdk: createInstance", function() {
|
|
|
55
55
|
key: "test",
|
|
56
56
|
defaultVariation: false,
|
|
57
57
|
bucketBy: "userId",
|
|
58
|
-
variations: [
|
|
59
|
-
{ type: "boolean", value: true },
|
|
60
|
-
{ type: "boolean", value: false },
|
|
61
|
-
],
|
|
58
|
+
variations: [{ value: true }, { value: false }],
|
|
62
59
|
traffic: [
|
|
63
60
|
{
|
|
64
61
|
key: "1",
|
|
@@ -75,7 +72,7 @@ describe("sdk: createInstance", function() {
|
|
|
75
72
|
attributes: [],
|
|
76
73
|
segments: [],
|
|
77
74
|
},
|
|
78
|
-
interceptAttributes: function(attributes) {
|
|
75
|
+
interceptAttributes: function (attributes) {
|
|
79
76
|
intercepted = true;
|
|
80
77
|
|
|
81
78
|
return {
|
|
@@ -92,7 +89,7 @@ describe("sdk: createInstance", function() {
|
|
|
92
89
|
expect(intercepted).toEqual(true);
|
|
93
90
|
});
|
|
94
91
|
|
|
95
|
-
it("should activate feature", function() {
|
|
92
|
+
it("should activate feature", function () {
|
|
96
93
|
let activated = false;
|
|
97
94
|
|
|
98
95
|
const sdk = createInstance({
|
|
@@ -104,10 +101,7 @@ describe("sdk: createInstance", function() {
|
|
|
104
101
|
key: "test",
|
|
105
102
|
defaultVariation: false,
|
|
106
103
|
bucketBy: "userId",
|
|
107
|
-
variations: [
|
|
108
|
-
{ type: "boolean", value: true },
|
|
109
|
-
{ type: "boolean", value: false },
|
|
110
|
-
],
|
|
104
|
+
variations: [{ value: true }, { value: false }],
|
|
111
105
|
traffic: [
|
|
112
106
|
{
|
|
113
107
|
key: "1",
|
|
@@ -124,7 +118,7 @@ describe("sdk: createInstance", function() {
|
|
|
124
118
|
attributes: [],
|
|
125
119
|
segments: [],
|
|
126
120
|
},
|
|
127
|
-
onActivation: function(featureKey) {
|
|
121
|
+
onActivation: function (featureKey) {
|
|
128
122
|
activated = true;
|
|
129
123
|
},
|
|
130
124
|
});
|
|
@@ -144,7 +138,7 @@ describe("sdk: createInstance", function() {
|
|
|
144
138
|
expect(activatedVariation).toEqual(true);
|
|
145
139
|
});
|
|
146
140
|
|
|
147
|
-
it("should refresh datafile", function(done) {
|
|
141
|
+
it("should refresh datafile", function (done) {
|
|
148
142
|
let revision = 1;
|
|
149
143
|
let refreshed = false;
|
|
150
144
|
let updated = false;
|
|
@@ -158,10 +152,7 @@ describe("sdk: createInstance", function() {
|
|
|
158
152
|
key: "test",
|
|
159
153
|
defaultVariation: false,
|
|
160
154
|
bucketBy: "userId",
|
|
161
|
-
variations: [
|
|
162
|
-
{ type: "boolean", value: true },
|
|
163
|
-
{ type: "boolean", value: false },
|
|
164
|
-
],
|
|
155
|
+
variations: [{ value: true }, { value: false }],
|
|
165
156
|
traffic: [
|
|
166
157
|
{
|
|
167
158
|
key: "1",
|
|
@@ -186,8 +177,8 @@ describe("sdk: createInstance", function() {
|
|
|
186
177
|
|
|
187
178
|
const sdk = createInstance({
|
|
188
179
|
datafileUrl: "http://localhost:3000/datafile.json",
|
|
189
|
-
handleDatafileFetch: function(datafileUrl) {
|
|
190
|
-
return new Promise(function(resolve, reject) {
|
|
180
|
+
handleDatafileFetch: function (datafileUrl) {
|
|
181
|
+
return new Promise(function (resolve, reject) {
|
|
191
182
|
resolve(getDatafileContent());
|
|
192
183
|
});
|
|
193
184
|
},
|
|
@@ -202,7 +193,7 @@ describe("sdk: createInstance", function() {
|
|
|
202
193
|
|
|
203
194
|
expect(sdk.isReady()).toEqual(false);
|
|
204
195
|
|
|
205
|
-
setTimeout(function() {
|
|
196
|
+
setTimeout(function () {
|
|
206
197
|
expect(refreshed).toEqual(true);
|
|
207
198
|
expect(updated).toEqual(true);
|
|
208
199
|
|