@splitsoftware/splitio-browserjs 0.3.0 → 0.4.1-rc.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/CHANGES.txt CHANGED
@@ -1,7 +1,14 @@
1
+ 0.4.1 (February 22, 2022)
2
+ - Updated karma and some transitive dependencies for vulnerability fixes.
3
+
4
+ 0.4.0 (January 19, 2022)
5
+ - Added support to SDK clients on browser to optionally bind attributes to the client, keeping these loaded within the SDK along with the user ID, for easier usage when requesting flag.
6
+ - Updated some transitive dependencies for vulnerability fixes.
7
+
1
8
  0.3.0 (January 11, 2022)
2
9
  - Added support for the SDK to run in "consumer" and "partial consumer" modes, with a pluggable implementation of it's internal storage,
3
10
  enabling customers to implement this caching with any storage technology of choice and connect it to the SDK instance to be used instead of
4
- its in-memory storage (Read more in our docs here: https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#advanced-consumer-mode).
11
+ its in-memory storage (Read more in our docs here: https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage).
5
12
  - Updated @splitsoftware/splitio-commons dependency to version 1.1.0, which includes:
6
13
  - Updated multiple modules due to general polishing and improvements, including the replacement of default exports with named exports,
7
14
  to avoid runtime errors with some particular configurations of Webpack projects.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaults = void 0;
4
4
  var index_1 = require("@splitsoftware/splitio-commons/cjs/logger/index");
5
- var packageVersion = '0.3.0';
5
+ var packageVersion = '0.4.1-rc.0';
6
6
  /**
7
7
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
8
8
  * Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
@@ -1,5 +1,5 @@
1
1
  import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/esm/logger/index';
2
- var packageVersion = '0.3.0';
2
+ var packageVersion = '0.4.1-rc.0';
3
3
  /**
4
4
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
5
5
  * Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-browserjs",
3
- "version": "0.3.0",
3
+ "version": "0.4.1-rc.0",
4
4
  "description": "Split SDK for Javascript on Browser",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -61,7 +61,7 @@
61
61
  "bugs": "https://github.com/splitio/javascript-browser-client/issues",
62
62
  "homepage": "https://github.com/splitio/javascript-browser-client#readme",
63
63
  "dependencies": {
64
- "@splitsoftware/splitio-commons": "^1.1.0",
64
+ "@splitsoftware/splitio-commons": "^1.2.0",
65
65
  "@types/google.analytics": "0.0.40"
66
66
  },
67
67
  "devDependencies": {
@@ -77,7 +77,7 @@
77
77
  "eslint-plugin-import": "^2.25.4",
78
78
  "fetch-mock": "^9.11.0",
79
79
  "jest": "^27.2.3",
80
- "karma": "^6.3.2",
80
+ "karma": "^6.3.16",
81
81
  "karma-chrome-launcher": "^3.1.0",
82
82
  "karma-rollup-preprocessor": "^7.0.5",
83
83
  "karma-tap": "^4.2.0",
@@ -1,7 +1,7 @@
1
1
  import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/logger/index';
2
2
  import { LogLevel } from '@splitsoftware/splitio-commons/src/types';
3
3
 
4
- const packageVersion = '0.3.0';
4
+ const packageVersion = '0.4.1-rc.0';
5
5
 
6
6
  /**
7
7
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
@@ -28,7 +28,7 @@ declare module JsSdk {
28
28
  /**
29
29
  * Pluggable storage to use the SDK in consumer mode.
30
30
  *
31
- * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#advanced-consumer-mode}
31
+ * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage}
32
32
  */
33
33
  export function PluggableStorage(options: SplitIO.PluggableStorageOptions): SplitIO.StorageAsyncFactory;
34
34
 
package/types/index.d.ts CHANGED
@@ -28,7 +28,7 @@ declare module JsSdk {
28
28
  /**
29
29
  * Pluggable storage to use the SDK in consumer mode.
30
30
  *
31
- * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#advanced-consumer-mode}
31
+ * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage}
32
32
  */
33
33
  export function PluggableStorage(options: SplitIO.PluggableStorageOptions): SplitIO.StorageAsyncFactory;
34
34
 
@@ -342,12 +342,17 @@ declare namespace SplitIO {
342
342
  type Event = 'init::timeout' | 'init::ready' | 'init::cache-ready' | 'state::update';
343
343
  /**
344
344
  * Split attributes should be on object with values of type string or number (dates should be sent as millis since epoch).
345
- * @typedef {Object.<number, string, boolean, string[], number[]>} Attributes
345
+ * @typedef {Object.<AttributeType>} Attributes
346
346
  * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#attribute-syntax}
347
347
  */
348
348
  type Attributes = {
349
- [attributeName: string]: string | number | boolean | Array<string | number>
349
+ [attributeName: string]: AttributeType
350
350
  };
351
+ /**
352
+ * Type of an attribute value
353
+ * @typedef {string | number | boolean | Array<string | number>} AttributeType
354
+ */
355
+ type AttributeType = string | number | boolean | Array<string | number>;
351
356
  /**
352
357
  * Split properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb.
353
358
  * @typedef {Object.<number, string, boolean, null>} Attributes
@@ -918,7 +923,7 @@ declare namespace SplitIO {
918
923
  /**
919
924
  * The SDK mode. When using `PluggableStorage` as storage, the possible values are "consumer" and "consumer_partial".
920
925
  *
921
- * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#advanced-consumer-mode}
926
+ * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage}
922
927
  *
923
928
  * @property {'consumer' | 'consumer_partial'} mode
924
929
  */
@@ -1199,6 +1204,47 @@ declare namespace SplitIO {
1199
1204
  * @returns {boolean} Whether the event was added to the queue successfully or not.
1200
1205
  */
1201
1206
  track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
1207
+ /**
1208
+ * Add an attribute to client's in memory attributes storage.
1209
+ *
1210
+ * @param {string} attributeName Attrinute name
1211
+ * @param {AttributeType} attributeValue Attribute value
1212
+ * @returns {boolean} true if the attribute was stored and false otherwise
1213
+ */
1214
+ setAttribute(attributeName: string, attributeValue: AttributeType): boolean,
1215
+ /**
1216
+ * Returns the attribute with the given key.
1217
+ *
1218
+ * @param {string} attributeName Attribute name
1219
+ * @returns {AttributeType} Attribute with the given key
1220
+ */
1221
+ getAttribute(attributeName: string): AttributeType,
1222
+ /**
1223
+ * Removes from client's in memory attributes storage the attribute with the given key.
1224
+ *
1225
+ * @param {string} attributeName
1226
+ * @returns {boolean} true if attribute was removed and false otherwise
1227
+ */
1228
+ removeAttribute(attributeName: string): boolean,
1229
+ /**
1230
+ * Add to client's in memory attributes storage the attributes in 'attributes'.
1231
+ *
1232
+ * @param {Attributes} attributes Object with attributes to store
1233
+ * @returns true if attributes were stored an false otherwise
1234
+ */
1235
+ setAttributes(attributes: Attributes): boolean,
1236
+ /**
1237
+ * Return all the attributes stored in client's in memory attributes storage.
1238
+ *
1239
+ * @returns {Attributes} returns all the stored attributes
1240
+ */
1241
+ getAttributes(): Attributes,
1242
+ /**
1243
+ * Remove all the stored attributes in the client's in memory attribute storage.
1244
+ *
1245
+ * @returns {boolean} true if all attribute were removed and false otherwise
1246
+ */
1247
+ clearAttributes(): boolean
1202
1248
  }
1203
1249
  /**
1204
1250
  * This represents the interface for the Client instance with asynchronous storage for client-side SDK, where each client has associated a key.
@@ -1248,6 +1294,47 @@ declare namespace SplitIO {
1248
1294
  * @returns {boolean} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
1249
1295
  */
1250
1296
  track(trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>,
1297
+ /**
1298
+ * Add an attribute to client's in memory attributes storage.
1299
+ *
1300
+ * @param {string} attributeName Attrinute name
1301
+ * @param {AttributeType} attributeValue Attribute value
1302
+ * @returns {boolean} true if the attribute was stored and false otherwise
1303
+ */
1304
+ setAttribute(attributeName: string, attributeValue: AttributeType): boolean,
1305
+ /**
1306
+ * Returns the attribute with the given key.
1307
+ *
1308
+ * @param {string} attributeName Attribute name
1309
+ * @returns {AttributeType} Attribute with the given key
1310
+ */
1311
+ getAttribute(attributeName: string): AttributeType,
1312
+ /**
1313
+ * Removes from client's in memory attributes storage the attribute with the given key.
1314
+ *
1315
+ * @param {string} attributeName
1316
+ * @returns {boolean} true if attribute was removed and false otherwise
1317
+ */
1318
+ removeAttribute(attributeName: string): boolean,
1319
+ /**
1320
+ * Add to client's in memory attributes storage the attributes in 'attributes'.
1321
+ *
1322
+ * @param {Attributes} attributes Object with attributes to store
1323
+ * @returns true if attributes were stored an false otherwise
1324
+ */
1325
+ setAttributes(attributes: Attributes): boolean,
1326
+ /**
1327
+ * Return all the attributes stored in client's in memory attributes storage.
1328
+ *
1329
+ * @returns {Attributes} returns all the stored attributes
1330
+ */
1331
+ getAttributes(): Attributes,
1332
+ /**
1333
+ * Remove all the stored attributes in the client's in memory attribute storage.
1334
+ *
1335
+ * @returns {boolean} true if all attribute were removed and false otherwise
1336
+ */
1337
+ clearAttributes(): boolean
1251
1338
  }
1252
1339
  /**
1253
1340
  * Representation of a manager instance with synchronous storage of the SDK.