@launchdarkly/js-client-sdk-common 0.1.0-alpha → 0.1.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ ## [0.1.2](https://github.com/launchdarkly/js-core/compare/js-client-sdk-common-v0.1.1...js-client-sdk-common-v0.1.2) (2024-01-16)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @launchdarkly/js-sdk-common bumped from 2.1.0 to 2.1.1
11
+
12
+ ## [0.1.1](https://github.com/launchdarkly/js-core/compare/js-client-sdk-common-v0.1.0...js-client-sdk-common-v0.1.1) (2023-12-28)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * Remove beta warning for sdk-server. Added tsdoc comments for rn sdk. Added README for sdk-client. ([#334](https://github.com/launchdarkly/js-core/issues/334)) ([bb7c3b4](https://github.com/launchdarkly/js-core/commit/bb7c3b45a72d203ad7209def3982d9094fb4cbc9))
18
+ * Remove release-as for sdk-client and rn sdk and updated READMEs. ([#337](https://github.com/launchdarkly/js-core/issues/337)) ([52bf088](https://github.com/launchdarkly/js-core/commit/52bf088bd9c7a75f673e37de829459bbad4deb90))
19
+
20
+ ## [0.1.0](https://github.com/launchdarkly/js-core/compare/js-client-sdk-common-v0.1.0...js-client-sdk-common-v0.1.0) (2023-12-28)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * Remove beta warning for sdk-server. Added tsdoc comments for rn sdk. Added README for sdk-client. ([#334](https://github.com/launchdarkly/js-core/issues/334)) ([bb7c3b4](https://github.com/launchdarkly/js-core/commit/bb7c3b45a72d203ad7209def3982d9094fb4cbc9))
26
+
27
+ ## 0.1.0 (2023-12-27)
28
+
29
+
30
+ ### ⚠ BREAKING CHANGES
31
+
32
+ * Implement Migrations. Refactor for client SDKs. ([#293](https://github.com/launchdarkly/js-core/issues/293))
33
+
34
+ ### Features
35
+
36
+ * Implement Migrations. Refactor for client SDKs. ([#293](https://github.com/launchdarkly/js-core/issues/293)) ([c66aa6e](https://github.com/launchdarkly/js-core/commit/c66aa6ea0d12e1e4e565cb8378d367c31fab9c1b))
package/README.md CHANGED
@@ -1 +1,37 @@
1
- # sdk-client
1
+ # LaunchDarkly SDK JavaScript Common Client Code
2
+
3
+ [![NPM][js-client-sdk-common-npm-badge]][js-client-sdk-common-npm-link]
4
+ [![Actions Status][shared-sdk-client-ci-badge]][shared-sdk-client-ci]
5
+ [![Documentation][shared-sdk-client-ghp-badge]][shared-sdk-client-ghp-link]
6
+
7
+ > [!CAUTION]
8
+ > This package is for internal use only. Do not use it directly.
9
+
10
+ This project contains Typescript classes and interfaces that are applicable to client-side SDKs.
11
+
12
+ This library is a beta version and should not be considered ready for production use while this message is visible.
13
+
14
+ ## Contributing
15
+
16
+ See [Contributing](../CONTRIBUTING.md).
17
+
18
+ ## About LaunchDarkly
19
+
20
+ - LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
21
+ - Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
22
+ - Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
23
+ - Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
24
+ - Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
25
+ - LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
26
+ - Explore LaunchDarkly
27
+ - [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information
28
+ - [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides
29
+ - [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation
30
+ - [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates
31
+
32
+ [js-client-sdk-common-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/js-client-sdk-common.svg?style=flat-square
33
+ [js-client-sdk-common-npm-link]: https://www.npmjs.com/package/@launchdarkly/js-client-sdk-common
34
+ [shared-sdk-client-ci-badge]: https://github.com/launchdarkly/js-core/actions/workflows/sdk-client.yml/badge.svg
35
+ [shared-sdk-client-ci]: https://github.com/launchdarkly/js-core/actions/workflows/sdk-client.yml
36
+ [shared-sdk-client-ghp-badge]: https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8
37
+ [shared-sdk-client-ghp-link]: https://launchdarkly.github.io/js-core/packages/shared/sdk-client/docs/
@@ -2,11 +2,41 @@ import type { LDFlagSet, LDLogger } from '@launchdarkly/js-sdk-common';
2
2
  import type { LDInspection } from './LDInspection';
3
3
  export interface LDOptions {
4
4
  /**
5
- * An object that will perform logging for the client.
5
+ * Whether all context attributes (except the context key) should be marked as private, and
6
+ * not sent to LaunchDarkly in analytics events.
6
7
  *
7
- * If not specified, the default is to use `basicLogger`.
8
+ * By default, this is false.
8
9
  */
9
- logger?: LDLogger;
10
+ allAttributesPrivate?: boolean;
11
+ /**
12
+ * Information about the application where the LaunchDarkly SDK is running.
13
+ */
14
+ application?: {
15
+ /**
16
+ * A unique identifier representing the application where the LaunchDarkly SDK is running.
17
+ *
18
+ * This can be specified as any string value as long as it only uses the following characters: ASCII letters,
19
+ * ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored.
20
+ *
21
+ * Example: `authentication-service`
22
+ */
23
+ id?: string;
24
+ /**
25
+ * A unique identifier representing the version of the application where the LaunchDarkly SDK is running.
26
+ *
27
+ * This can be specified as any string value as long as it only uses the following characters: ASCII letters,
28
+ * ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored.
29
+ *
30
+ * Example: `1.0.0` (standard version string) or `abcdef` (sha prefix)
31
+ */
32
+ version?: string;
33
+ };
34
+ /**
35
+ * The base uri for the LaunchDarkly server.
36
+ *
37
+ * Most users should use the default value.
38
+ */
39
+ baseUri?: string;
10
40
  /**
11
41
  * The initial set of flags to use until the remote set is retrieved.
12
42
  *
@@ -20,11 +50,35 @@ export interface LDOptions {
20
50
  */
21
51
  bootstrap?: 'localStorage' | LDFlagSet;
22
52
  /**
23
- * The base uri for the LaunchDarkly server.
53
+ * The capacity of the analytics events queue.
24
54
  *
25
- * Most users should use the default value.
55
+ * The client buffers up to this many events in memory before flushing. If the capacity is exceeded
56
+ * before the queue is flushed, events will be discarded. Increasing the capacity means that events
57
+ * are less likely to be discarded, at the cost of consuming more memory. Note that in regular usage
58
+ * flag evaluations do not produce individual events, only summary counts, so you only need a large
59
+ * capacity if you are generating a large number of click, pageview, or identify events (or if you
60
+ * are using the event debugger).
61
+ *
62
+ * The default value is 100.
26
63
  */
27
- baseUri?: string;
64
+ capacity?: number;
65
+ /**
66
+ * Set to true to opt out of sending diagnostics data.
67
+ *
68
+ * Unless `diagnosticOptOut` is set to true, the client will send some diagnostics data to the LaunchDarkly
69
+ * servers in order to assist in the development of future SDK improvements. These diagnostics consist of
70
+ * an initial payload containing some details of SDK in use, the SDK's configuration, and the platform the
71
+ * SDK is being run on, as well as payloads sent periodically with information on irregular occurrences such
72
+ * as dropped events.
73
+ */
74
+ diagnosticOptOut?: boolean;
75
+ /**
76
+ * The interval at which periodic diagnostic data is sent, in seconds.
77
+ *
78
+ * The default is 900 (every 15 minutes) and the minimum value is 6. See {@link diagnosticOptOut}
79
+ * for more information on the diagnostics data being sent.
80
+ */
81
+ diagnosticRecordingInterval?: number;
28
82
  /**
29
83
  * The base uri for the LaunchDarkly events server.
30
84
  *
@@ -32,31 +86,28 @@ export interface LDOptions {
32
86
  */
33
87
  eventsUri?: string;
34
88
  /**
35
- * The base uri for the LaunchDarkly streaming server.
89
+ * The interval in between flushes of the analytics events queue, in seconds.
36
90
  *
37
- * Most users should use the default value.
91
+ * The default value is 2s.
38
92
  */
39
- streamUri?: string;
93
+ flushInterval?: number;
40
94
  /**
41
- * Whether LaunchDarkly should provide additional information about how flag values were
42
- * calculated.
95
+ * The signed context key for Secure Mode.
43
96
  *
44
- * The additional information will then be available through the client's
45
- * {@link LDClient.variationDetail} method. Since this increases the size of network requests,
46
- * such information is not sent unless you set this option to true.
97
+ * For more information, see the JavaScript SDK Reference Guide on
98
+ * [Secure mode](https://docs.launchdarkly.com/sdk/features/secure-mode#configuring-secure-mode-in-the-javascript-client-side-sdk).
47
99
  */
48
- withReasons?: boolean;
100
+ hash?: string;
49
101
  /**
50
- * Whether to send analytics events back to LaunchDarkly. By default, this is true.
102
+ * Inspectors can be used for collecting information for monitoring, analytics, and debugging.
51
103
  */
52
- sendEvents?: boolean;
104
+ inspectors?: LDInspection[];
53
105
  /**
54
- * Whether all context attributes (except the context key) should be marked as private, and
55
- * not sent to LaunchDarkly in analytics events.
106
+ * An object that will perform logging for the client.
56
107
  *
57
- * By default, this is false.
108
+ * If not specified, the default is to use `basicLogger`.
58
109
  */
59
- allAttributesPrivate?: boolean;
110
+ logger?: LDLogger;
60
111
  /**
61
112
  * Specifies a list of attribute names (either built-in or custom) which should be marked as
62
113
  * private, and not sent to LaunchDarkly in analytics events. You can also specify this on a
@@ -76,24 +127,9 @@ export interface LDOptions {
76
127
  */
77
128
  privateAttributes?: Array<string>;
78
129
  /**
79
- * The capacity of the analytics events queue.
80
- *
81
- * The client buffers up to this many events in memory before flushing. If the capacity is exceeded
82
- * before the queue is flushed, events will be discarded. Increasing the capacity means that events
83
- * are less likely to be discarded, at the cost of consuming more memory. Note that in regular usage
84
- * flag evaluations do not produce individual events, only summary counts, so you only need a large
85
- * capacity if you are generating a large number of click, pageview, or identify events (or if you
86
- * are using the event debugger).
87
- *
88
- * The default value is 100.
89
- */
90
- capacity?: number;
91
- /**
92
- * The interval in between flushes of the analytics events queue, in seconds.
93
- *
94
- * The default value is 2s.
130
+ * Whether to send analytics events back to LaunchDarkly. By default, this is true.
95
131
  */
96
- flushInterval?: number;
132
+ sendEvents?: boolean;
97
133
  /**
98
134
  * Sets the initial reconnect delay for the streaming connection, in seconds.
99
135
  *
@@ -105,22 +141,20 @@ export interface LDOptions {
105
141
  */
106
142
  streamInitialReconnectDelay?: number;
107
143
  /**
108
- * Set to true to opt out of sending diagnostics data.
144
+ * The base uri for the LaunchDarkly streaming server.
109
145
  *
110
- * Unless `diagnosticOptOut` is set to true, the client will send some diagnostics data to the LaunchDarkly
111
- * servers in order to assist in the development of future SDK improvements. These diagnostics consist of
112
- * an initial payload containing some details of SDK in use, the SDK's configuration, and the platform the
113
- * SDK is being run on, as well as payloads sent periodically with information on irregular occurrences such
114
- * as dropped events.
146
+ * Most users should use the default value.
115
147
  */
116
- diagnosticOptOut?: boolean;
148
+ streamUri?: string;
117
149
  /**
118
- * The interval at which periodic diagnostic data is sent, in seconds.
150
+ * Whether LaunchDarkly should provide additional information about how flag values were
151
+ * calculated.
119
152
  *
120
- * The default is 900 (every 15 minutes) and the minimum value is 6. See {@link diagnosticOptOut}
121
- * for more information on the diagnostics data being sent.
153
+ * The additional information will then be available through the client's
154
+ * {@link LDClient.variationDetail} method. Since this increases the size of network requests,
155
+ * such information is not sent unless you set this option to true.
122
156
  */
123
- diagnosticRecordingInterval?: number;
157
+ withReasons?: boolean;
124
158
  /**
125
159
  * For use by wrapper libraries to set an identifying name for the wrapper being used.
126
160
  *
@@ -134,39 +168,5 @@ export interface LDOptions {
134
168
  * If `wrapperName` is unset, this field will be ignored.
135
169
  */
136
170
  wrapperVersion?: string;
137
- /**
138
- * Information about the application where the LaunchDarkly SDK is running.
139
- */
140
- application?: {
141
- /**
142
- * A unique identifier representing the application where the LaunchDarkly SDK is running.
143
- *
144
- * This can be specified as any string value as long as it only uses the following characters: ASCII letters,
145
- * ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored.
146
- *
147
- * Example: `authentication-service`
148
- */
149
- id?: string;
150
- /**
151
- * A unique identifier representing the version of the application where the LaunchDarkly SDK is running.
152
- *
153
- * This can be specified as any string value as long as it only uses the following characters: ASCII letters,
154
- * ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored.
155
- *
156
- * Example: `1.0.0` (standard version string) or `abcdef` (sha prefix)
157
- */
158
- version?: string;
159
- };
160
- /**
161
- * Inspectors can be used for collecting information for monitoring, analytics, and debugging.
162
- */
163
- inspectors?: LDInspection[];
164
- /**
165
- * The signed context key for Secure Mode.
166
- *
167
- * For more information, see the JavaScript SDK Reference Guide on
168
- * [Secure mode](https://docs.launchdarkly.com/sdk/features/secure-mode#configuring-secure-mode-in-the-javascript-client-side-sdk).
169
- */
170
- hash?: string;
171
171
  }
172
172
  //# sourceMappingURL=LDOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LDOptions.d.ts","sourceRoot":"","sources":["../../src/api/LDOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC;IAElB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAEvC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;OAKG;IACH,o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IG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAEvC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;OAKG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAErC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC;IAE5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC;IAElB;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAElC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;OAQG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAErC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@launchdarkly/js-client-sdk-common",
3
- "version": "0.1.0-alpha",
3
+ "version": "0.1.2",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "license": "Apache-2.0",
32
32
  "dependencies": {
33
- "@launchdarkly/js-sdk-common": "2.2.0-alpha"
33
+ "@launchdarkly/js-sdk-common": "2.1.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@launchdarkly/private-js-mocks": "0.0.1",