@launchdarkly/js-sdk-common 2.18.0 → 2.20.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/api/platform/Requests.d.ts +1 -0
  3. package/dist/cjs/api/platform/Requests.d.ts.map +1 -1
  4. package/dist/cjs/api/subsystem/DataSystem/CallbackHandler.d.ts.map +1 -1
  5. package/dist/cjs/api/subsystem/DataSystem/DataSource.d.ts +17 -1
  6. package/dist/cjs/api/subsystem/DataSystem/DataSource.d.ts.map +1 -1
  7. package/dist/cjs/datasource/CompositeDataSource.d.ts +7 -2
  8. package/dist/cjs/datasource/CompositeDataSource.d.ts.map +1 -1
  9. package/dist/cjs/datasource/errors.d.ts +9 -0
  10. package/dist/cjs/datasource/errors.d.ts.map +1 -1
  11. package/dist/cjs/datasource/index.d.ts +2 -2
  12. package/dist/cjs/datasource/index.d.ts.map +1 -1
  13. package/dist/cjs/index.cjs +141 -40
  14. package/dist/cjs/index.cjs.map +1 -1
  15. package/dist/cjs/index.d.ts +2 -2
  16. package/dist/cjs/index.d.ts.map +1 -1
  17. package/dist/cjs/internal/fdv2/FDv1PayloadAdaptor.d.ts +43 -0
  18. package/dist/cjs/internal/fdv2/FDv1PayloadAdaptor.d.ts.map +1 -0
  19. package/dist/cjs/internal/fdv2/index.d.ts +2 -1
  20. package/dist/cjs/internal/fdv2/index.d.ts.map +1 -1
  21. package/dist/cjs/internal/fdv2/payloadProcessor.d.ts.map +1 -1
  22. package/dist/cjs/internal/fdv2/proto.d.ts +18 -6
  23. package/dist/cjs/internal/fdv2/proto.d.ts.map +1 -1
  24. package/dist/cjs/options/ServiceEndpoints.d.ts +2 -2
  25. package/dist/cjs/options/ServiceEndpoints.d.ts.map +1 -1
  26. package/dist/esm/api/platform/Requests.d.ts +1 -0
  27. package/dist/esm/api/platform/Requests.d.ts.map +1 -1
  28. package/dist/esm/api/subsystem/DataSystem/CallbackHandler.d.ts.map +1 -1
  29. package/dist/esm/api/subsystem/DataSystem/DataSource.d.ts +17 -1
  30. package/dist/esm/api/subsystem/DataSystem/DataSource.d.ts.map +1 -1
  31. package/dist/esm/datasource/CompositeDataSource.d.ts +7 -2
  32. package/dist/esm/datasource/CompositeDataSource.d.ts.map +1 -1
  33. package/dist/esm/datasource/errors.d.ts +9 -0
  34. package/dist/esm/datasource/errors.d.ts.map +1 -1
  35. package/dist/esm/datasource/index.d.ts +2 -2
  36. package/dist/esm/datasource/index.d.ts.map +1 -1
  37. package/dist/esm/index.d.ts +2 -2
  38. package/dist/esm/index.d.ts.map +1 -1
  39. package/dist/esm/index.mjs +141 -41
  40. package/dist/esm/index.mjs.map +1 -1
  41. package/dist/esm/internal/fdv2/FDv1PayloadAdaptor.d.ts +43 -0
  42. package/dist/esm/internal/fdv2/FDv1PayloadAdaptor.d.ts.map +1 -0
  43. package/dist/esm/internal/fdv2/index.d.ts +2 -1
  44. package/dist/esm/internal/fdv2/index.d.ts.map +1 -1
  45. package/dist/esm/internal/fdv2/payloadProcessor.d.ts.map +1 -1
  46. package/dist/esm/internal/fdv2/proto.d.ts +18 -6
  47. package/dist/esm/internal/fdv2/proto.d.ts.map +1 -1
  48. package/dist/esm/options/ServiceEndpoints.d.ts +2 -2
  49. package/dist/esm/options/ServiceEndpoints.d.ts.map +1 -1
  50. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to `@launchdarkly/js-sdk-common` will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## [2.20.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.19.0...js-sdk-common-v2.20.0) (2025-12-05)
6
+
7
+
8
+ ### Features
9
+
10
+ * add FDv2 FileDataSource initializer ([#1010](https://github.com/launchdarkly/js-core/issues/1010)) ([99931f0](https://github.com/launchdarkly/js-core/commit/99931f0706c0202390e3b68e3701ba0fb8aba124))
11
+
12
+ ## [2.19.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.18.0...js-sdk-common-v2.19.0) (2025-07-23)
13
+
14
+
15
+ ### Features
16
+
17
+ * additional FDv2 functionality ([#898](https://github.com/launchdarkly/js-core/issues/898)) ([9ede15c](https://github.com/launchdarkly/js-core/commit/9ede15c757ed1b8c57b090716d44cf60a03da409))
18
+
5
19
  ## [2.18.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.17.0...js-sdk-common-v2.18.0) (2025-05-21)
6
20
 
7
21
 
@@ -108,5 +108,6 @@ export interface Requests {
108
108
  export interface HttpErrorResponse {
109
109
  message: string;
110
110
  status?: number;
111
+ headers?: Record<string, string>;
111
112
  }
112
113
  //# sourceMappingURL=Requests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Requests.d.ts","sourceRoot":"","sources":["../../../src/api/platform/Requests.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAOtE;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;;;;;OAMG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;;;OAMG;IACH,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEzB;;;;;OAKG;IACH,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE3B;;;;;OAKG;IACH,OAAO,IAAI,QAAQ,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEtC;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAExB;;OAEG;IAC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B,IAAI,uBAAuB,CAAC;IAEtD;;OAEG;IACH,UAAU,CAAC,IAAI,OAAO,CAAC;IAEvB;;OAEG;IACH,cAAc,CAAC,IAAI,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CallbackHandler.d.ts","sourceRoot":"","sources":["../../../../src/api/subsystem/DataSystem/CallbackHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;GAIG;AACH,qBAAa,eAAe;IAIxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAJlC,OAAO,CAAC,SAAS,CAAkB;gBAGhB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,EAClD,eAAe,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI;IAGhF,OAAO;IAID,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG;IAUrC,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,GAAG;CAOvD"}
1
+ {"version":3,"file":"CallbackHandler.d.ts","sourceRoot":"","sources":["../../../../src/api/subsystem/DataSystem/CallbackHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;GAIG;AACH,qBAAa,eAAe;IAIxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAJlC,OAAO,CAAC,SAAS,CAAkB;gBAGhB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,EAClD,eAAe,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI;IAGhF,OAAO;IAID,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG;IAQrC,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,GAAG;CAOvD"}
@@ -1,21 +1,37 @@
1
+ /**
2
+ * @experimental
3
+ * This feature is not stable and not subject to any backwards compatibility guarantees or semantic
4
+ * versioning. It is not suitable for production usage.
5
+ */
1
6
  export declare enum DataSourceState {
2
7
  Valid = 0,
3
8
  Initializing = 1,
4
9
  Interrupted = 2,
5
10
  Closed = 3
6
11
  }
12
+ /**
13
+ * @experimental
14
+ * This feature is not stable and not subject to any backwards compatibility guarantees or semantic
15
+ * versioning. It is not suitable for production usage.
16
+ */
7
17
  export interface DataSource {
8
18
  /**
9
19
  * May be called any number of times, if already started, has no effect
10
20
  * @param dataCallback that will be called when data arrives, may be called multiple times.
11
21
  * @param statusCallback that will be called when data source state changes or an unrecoverable error
12
22
  * has been encountered.
23
+ * @param selectorGetter that can be invoked to provide the FDv2 selector/basis if one exists
13
24
  */
14
- start(dataCallback: (basis: boolean, data: any) => void, statusCallback: (status: DataSourceState, err?: any) => void): void;
25
+ start(dataCallback: (basis: boolean, data: any) => void, statusCallback: (status: DataSourceState, err?: any) => void, selectorGetter?: () => string | undefined): void;
15
26
  /**
16
27
  * May be called any number of times, if already stopped, has no effect. Datasource will not make any additional callbacks after stop returns.
17
28
  */
18
29
  stop(): void;
19
30
  }
31
+ /**
32
+ * @experimental
33
+ * This feature is not stable and not subject to any backwards compatibility guarantees or semantic
34
+ * versioning. It is not suitable for production usage.
35
+ */
20
36
  export type LDDataSourceFactory = () => DataSource;
21
37
  //# sourceMappingURL=DataSource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataSource.d.ts","sourceRoot":"","sources":["../../../../src/api/subsystem/DataSystem/DataSource.ts"],"names":[],"mappings":"AACA,oBAAY,eAAe;IAEzB,KAAK,IAAA;IAEL,YAAY,IAAA;IAEZ,WAAW,IAAA;IAEX,MAAM,IAAA;CACP;AAED,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,KAAK,CACH,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,EACjD,cAAc,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,GAC3D,IAAI,CAAC;IAER;;OAEG;IACH,IAAI,IAAI,IAAI,CAAC;CACd;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"DataSource.d.ts","sourceRoot":"","sources":["../../../../src/api/subsystem/DataSystem/DataSource.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,oBAAY,eAAe;IAEzB,KAAK,IAAA;IAEL,YAAY,IAAA;IAEZ,WAAW,IAAA;IAEX,MAAM,IAAA;CACP;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,KAAK,CACH,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,EACjD,cAAc,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,EAC5D,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,GACxC,IAAI,CAAC;IAER;;OAEG;IACH,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,UAAU,CAAC"}
@@ -25,6 +25,7 @@ export declare class CompositeDataSource implements DataSource {
25
25
  private _initPhaseActive;
26
26
  private _initFactories;
27
27
  private _syncFactories;
28
+ private _fdv1Synchronizers;
28
29
  private _stopped;
29
30
  private _externalTransitionPromise;
30
31
  private _externalTransitionResolve?;
@@ -32,9 +33,13 @@ export declare class CompositeDataSource implements DataSource {
32
33
  /**
33
34
  * @param initializers factories to create {@link DataSystemInitializer}s, in priority order.
34
35
  * @param synchronizers factories to create {@link DataSystemSynchronizer}s, in priority order.
36
+ * @param fdv1Synchronizers factories to fallback to if we need to fallback to FDv1.
37
+ * @param _logger for logging
38
+ * @param _transitionConditions to control automated transition between datasources. Typically only used for testing.
39
+ * @param _backoff to control delay between transitions. Typically only used for testing.
35
40
  */
36
- constructor(initializers: LDDataSourceFactory[], synchronizers: LDDataSourceFactory[], _logger?: LDLogger | undefined, _transitionConditions?: TransitionConditions, _backoff?: Backoff);
37
- start(dataCallback: (basis: boolean, data: any) => void, statusCallback: (status: DataSourceState, err?: any) => void): Promise<void>;
41
+ constructor(initializers: LDDataSourceFactory[], synchronizers: LDDataSourceFactory[], fdv1Synchronizers: LDDataSourceFactory[], _logger?: LDLogger | undefined, _transitionConditions?: TransitionConditions, _backoff?: Backoff);
42
+ start(dataCallback: (basis: boolean, data: any) => void, statusCallback: (status: DataSourceState, err?: any) => void, selectorGetter?: () => string | undefined): Promise<void>;
38
43
  stop(): Promise<void>;
39
44
  private _reset;
40
45
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"CompositeDataSource.d.ts","sourceRoot":"","sources":["../../src/datasource/CompositeDataSource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EACL,UAAU,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAMpD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;KAChC,CAAC,IAAI,eAAe,CAAC,CAAC,EAAE;Q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GAAG,SAAS,GACxC,OAAO,CAAC,IAAI,CAAC;IAwJV,IAAI;IAMV,OAAO,CAAC,MAAM;IAYd;;;;OAIG;IACH,OAAO,CAAC,eAAe;IA0DvB;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,iBAAiB,CAcvB;IAEF,OAAO,CAAC,mBAAmB;IAQ3B;;;;;;OAMG;IACH,OAAO,CAAC,gCAAgC;CAgCzC"}
@@ -14,5 +14,14 @@ export declare class LDStreamingError extends Error {
14
14
  readonly recoverable: boolean;
15
15
  constructor(kind: DataSourceErrorKind, message: string, code?: number, recoverable?: boolean);
16
16
  }
17
+ /**
18
+ * This is a short term error and will be removed once FDv2 adoption is sufficient.
19
+ */
20
+ export declare class LDFlagDeliveryFallbackError extends Error {
21
+ readonly kind: DataSourceErrorKind;
22
+ readonly code?: number;
23
+ readonly recoverable: boolean;
24
+ constructor(kind: DataSourceErrorKind, message: string, code?: number);
25
+ }
17
26
  export type StreamingErrorHandler = (err: LDStreamingError) => void;
18
27
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/datasource/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,SAAgB,IAAI,EAAE,mBAAmB,CAAC;IAC1C,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChC,SAAgB,WAAW,EAAE,OAAO,CAAC;gBAEzB,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,UAAO;CAO5F;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,SAAgB,IAAI,EAAE,mBAAmB,CAAC;IAC1C,SAAgB,IAAI,CAA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M,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { Backoff, DefaultBackoff } from './Backoff';
2
2
  import { CompositeDataSource } from './CompositeDataSource';
3
3
  import { DataSourceErrorKind } from './DataSourceErrorKinds';
4
- import { LDFileDataSourceError, LDPollingError, LDStreamingError, StreamingErrorHandler } from './errors';
5
- export { Backoff, CompositeDataSource, DefaultBackoff, DataSourceErrorKind, LDFileDataSourceError, LDPollingError, LDStreamingError, StreamingErrorHandler, };
4
+ import { LDFileDataSourceError, LDFlagDeliveryFallbackError, LDPollingError, LDStreamingError, StreamingErrorHandler } from './errors';
5
+ export { Backoff, CompositeDataSource, DefaultBackoff, DataSourceErrorKind, LDFileDataSourceError, LDFlagDeliveryFallbackError, LDPollingError, LDStreamingError, StreamingErrorHandler, };
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/datasource/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,GACtB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/datasource/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,2BAA2B,EAC3B,cAAc,EACd,gBAAgB,EAChB,qBAAqB,GACtB,CAAC"}
@@ -951,8 +951,6 @@ class CallbackHandler {
951
951
  if (this._disabled) {
952
952
  return;
953
953
  }
954
- // TODO: SDK-1044 track selector for future synchronizer to use
955
- // report data up
956
954
  this._dataCallback(basis, data);
957
955
  }
958
956
  async statusHandler(status, err) {
@@ -964,6 +962,11 @@ class CallbackHandler {
964
962
  }
965
963
 
966
964
  // TODO: refactor client-sdk to use this enum
965
+ /**
966
+ * @experimental
967
+ * This feature is not stable and not subject to any backwards compatibility guarantees or semantic
968
+ * versioning. It is not suitable for production usage.
969
+ */
967
970
  var DataSourceState;
968
971
  (function (DataSourceState) {
969
972
  // Positive confirmation of connection/data receipt
@@ -1064,6 +1067,43 @@ class DataSourceList {
1064
1067
  }
1065
1068
  }
1066
1069
 
1070
+ class LDFileDataSourceError extends Error {
1071
+ constructor(message) {
1072
+ super(message);
1073
+ this.name = 'LaunchDarklyFileDataSourceError';
1074
+ }
1075
+ }
1076
+ class LDPollingError extends Error {
1077
+ constructor(kind, message, status, recoverable = true) {
1078
+ super(message);
1079
+ this.kind = kind;
1080
+ this.status = status;
1081
+ this.name = 'LaunchDarklyPollingError';
1082
+ this.recoverable = recoverable;
1083
+ }
1084
+ }
1085
+ class LDStreamingError extends Error {
1086
+ constructor(kind, message, code, recoverable = true) {
1087
+ super(message);
1088
+ this.kind = kind;
1089
+ this.code = code;
1090
+ this.name = 'LaunchDarklyStreamingError';
1091
+ this.recoverable = recoverable;
1092
+ }
1093
+ }
1094
+ /**
1095
+ * This is a short term error and will be removed once FDv2 adoption is sufficient.
1096
+ */
1097
+ class LDFlagDeliveryFallbackError extends Error {
1098
+ constructor(kind, message, code) {
1099
+ super(message);
1100
+ this.kind = kind;
1101
+ this.code = code;
1102
+ this.name = 'LDFlagDeliveryFallbackError';
1103
+ this.recoverable = false;
1104
+ }
1105
+ }
1106
+
1067
1107
  const DEFAULT_FALLBACK_TIME_MS = 2 * 60 * 1000;
1068
1108
  const DEFAULT_RECOVERY_TIME_MS = 5 * 60 * 1000;
1069
1109
  /**
@@ -1074,8 +1114,12 @@ class CompositeDataSource {
1074
1114
  /**
1075
1115
  * @param initializers factories to create {@link DataSystemInitializer}s, in priority order.
1076
1116
  * @param synchronizers factories to create {@link DataSystemSynchronizer}s, in priority order.
1117
+ * @param fdv1Synchronizers factories to fallback to if we need to fallback to FDv1.
1118
+ * @param _logger for logging
1119
+ * @param _transitionConditions to control automated transition between datasources. Typically only used for testing.
1120
+ * @param _backoff to control delay between transitions. Typically only used for testing.
1077
1121
  */
1078
- constructor(initializers, synchronizers, _logger, _transitionConditions = {
1122
+ constructor(initializers, synchronizers, fdv1Synchronizers, _logger, _transitionConditions = {
1079
1123
  [DataSourceState.Valid]: {
1080
1124
  durationMS: DEFAULT_RECOVERY_TIME_MS,
1081
1125
  transition: 'recover',
@@ -1111,8 +1155,9 @@ class CompositeDataSource {
1111
1155
  this._initPhaseActive = initializers.length > 0; // init phase if we have initializers
1112
1156
  this._initFactories = new DataSourceList(false, initializers);
1113
1157
  this._syncFactories = new DataSourceList(true, synchronizers);
1158
+ this._fdv1Synchronizers = new DataSourceList(true, fdv1Synchronizers);
1114
1159
  }
1115
- async start(dataCallback, statusCallback) {
1160
+ async start(dataCallback, statusCallback, selectorGetter) {
1116
1161
  if (!this._stopped) {
1117
1162
  // don't allow multiple simultaneous runs
1118
1163
  this._logger?.info('CompositeDataSource already running. Ignoring call to start.');
@@ -1149,12 +1194,18 @@ class CompositeDataSource {
1149
1194
  // When we get a status update, we want to fallback if it is an error. We also want to schedule a transition for some
1150
1195
  // time in the future if this status remains for some duration (ex: Recover to primary synchronizer after the secondary
1151
1196
  // synchronizer has been Valid for some time). These scheduled transitions are configurable in the constructor.
1152
- this._logger?.debug(`CompositeDataSource received state ${state} from underlying data source.`);
1197
+ this._logger?.debug(`CompositeDataSource received state ${state} from underlying data source. Err is ${err}`);
1153
1198
  if (err || state === DataSourceState.Closed) {
1154
1199
  callbackHandler.disable();
1155
- if (err.recoverable === false) {
1200
+ if (err?.recoverable === false) {
1156
1201
  // don't use this datasource's factory again
1202
+ this._logger?.debug(`Culling data source due to err ${err}`);
1157
1203
  cullDSFactory?.();
1204
+ // this error indicates we should fallback to only using FDv1 synchronizers
1205
+ if (err instanceof LDFlagDeliveryFallbackError) {
1206
+ this._logger?.debug(`Falling back to FDv1`);
1207
+ this._syncFactories = this._fdv1Synchronizers;
1208
+ }
1158
1209
  }
1159
1210
  sanitizedStatusCallback(state, err);
1160
1211
  this._consumeCancelToken(cancelScheduledTransition);
@@ -1181,7 +1232,7 @@ class CompositeDataSource {
1181
1232
  }
1182
1233
  }
1183
1234
  });
1184
- currentDS.start((basis, data) => callbackHandler.dataHandler(basis, data), (status, err) => callbackHandler.statusHandler(status, err));
1235
+ currentDS.start((basis, data) => callbackHandler.dataHandler(basis, data), (status, err) => callbackHandler.statusHandler(status, err), selectorGetter);
1185
1236
  }
1186
1237
  else {
1187
1238
  // we don't have a data source to use!
@@ -1202,8 +1253,8 @@ class CompositeDataSource {
1202
1253
  // stop the underlying datasource before transitioning to next state
1203
1254
  currentDS?.stop();
1204
1255
  if (transitionRequest.err && transitionRequest.transition !== 'stop') {
1205
- // if the transition was due to an error, throttle the transition
1206
- const delay = this._backoff.fail();
1256
+ // if the transition was due to an error we're not in the initializer phase, throttle the transition. Fallback between initializers is not throttled.
1257
+ const delay = this._initPhaseActive ? 0 : this._backoff.fail();
1207
1258
  const { promise, cancel: cancelDelay } = this._cancellableDelay(delay);
1208
1259
  this._cancelTokens.push(cancelDelay);
1209
1260
  const delayedTransition = promise.then(() => {
@@ -1238,6 +1289,7 @@ class CompositeDataSource {
1238
1289
  this._initPhaseActive = this._initFactories.length() > 0; // init phase if we have initializers;
1239
1290
  this._initFactories.reset();
1240
1291
  this._syncFactories.reset();
1292
+ this._fdv1Synchronizers.reset();
1241
1293
  this._externalTransitionPromise = new Promise((tr) => {
1242
1294
  this._externalTransitionResolve = tr;
1243
1295
  });
@@ -1272,6 +1324,11 @@ class CompositeDataSource {
1272
1324
  break;
1273
1325
  case 'fallback':
1274
1326
  default:
1327
+ // if asked to fallback after using all init factories, switch to sync factories
1328
+ if (this._initPhaseActive && this._initFactories.pos() >= this._initFactories.length()) {
1329
+ this._initPhaseActive = false;
1330
+ this._syncFactories.reset();
1331
+ }
1275
1332
  if (this._initPhaseActive) {
1276
1333
  isPrimary = this._initFactories.pos() === 0;
1277
1334
  factory = this._initFactories.next();
@@ -1363,31 +1420,6 @@ exports.DataSourceErrorKind = void 0;
1363
1420
  DataSourceErrorKind["InvalidData"] = "INVALID_DATA";
1364
1421
  })(exports.DataSourceErrorKind || (exports.DataSourceErrorKind = {}));
1365
1422
 
1366
- class LDFileDataSourceError extends Error {
1367
- constructor(message) {
1368
- super(message);
1369
- this.name = 'LaunchDarklyFileDataSourceError';
1370
- }
1371
- }
1372
- class LDPollingError extends Error {
1373
- constructor(kind, message, status, recoverable = true) {
1374
- super(message);
1375
- this.kind = kind;
1376
- this.status = status;
1377
- this.name = 'LaunchDarklyPollingError';
1378
- this.recoverable = recoverable;
1379
- }
1380
- }
1381
- class LDStreamingError extends Error {
1382
- constructor(kind, message, code, recoverable = true) {
1383
- super(message);
1384
- this.kind = kind;
1385
- this.code = code;
1386
- this.name = 'LaunchDarklyStreamingError';
1387
- this.recoverable = recoverable;
1388
- }
1389
- }
1390
-
1391
1423
  /* eslint-disable import/prefer-default-export */
1392
1424
  /**
1393
1425
  * Enable / disable Auto environment attributes. When enabled, the SDK will automatically
@@ -1870,7 +1902,7 @@ class ServiceEndpoints {
1870
1902
  }
1871
1903
  // eslint-disable-next-line @typescript-eslint/naming-convention
1872
1904
  ServiceEndpoints.DEFAULT_EVENTS = 'https://events.launchdarkly.com';
1873
- function getWithParams(uri, parameters) {
1905
+ function getWithParams(uri, parameters = []) {
1874
1906
  if (parameters.length === 0) {
1875
1907
  return uri;
1876
1908
  }
@@ -1899,7 +1931,7 @@ function getStreamingUri(endpoints, path, parameters) {
1899
1931
  * @param path The path to the resource, devoid of any query parameters or hrefs.
1900
1932
  * @param parameters The query parameters. These query parameters must already have the appropriate encoding applied. This function WILL NOT apply it for you.
1901
1933
  */
1902
- function getPollingUri(endpoints, path, parameters) {
1934
+ function getPollingUri(endpoints, path, parameters = []) {
1903
1935
  const canonicalizedPath = canonicalizePath(path);
1904
1936
  const combinedParameters = [...parameters];
1905
1937
  if (endpoints.payloadFilterKey) {
@@ -1914,7 +1946,7 @@ function getPollingUri(endpoints, path, parameters) {
1914
1946
  * @param path The path to the resource, devoid of any query parameters or hrefs.
1915
1947
  * @param parameters The query parameters. These query parameters must already have the appropriate encoding applied. This function WILL NOT apply it for you.
1916
1948
  */
1917
- function getEventsUri(endpoints, path, parameters) {
1949
+ function getEventsUri(endpoints, path, parameters = []) {
1918
1950
  const canonicalizedPath = canonicalizePath(path);
1919
1951
  return getWithParams(`${endpoints.events}/${canonicalizedPath}`, parameters);
1920
1952
  }
@@ -2924,6 +2956,68 @@ class EventFactoryBase {
2924
2956
  }
2925
2957
  }
2926
2958
 
2959
+ const PAYLOAD_ID = 'FDv1Fallback';
2960
+ function fdv1PayloadAdaptor(processor) {
2961
+ return {
2962
+ _processor: processor,
2963
+ _selector: '',
2964
+ useSelector(selector) {
2965
+ this._selector = selector;
2966
+ return this;
2967
+ },
2968
+ processFullTransfer(data) {
2969
+ const events = [
2970
+ {
2971
+ event: 'server-intent',
2972
+ data: {
2973
+ payloads: [
2974
+ {
2975
+ id: PAYLOAD_ID,
2976
+ target: 1,
2977
+ intentCode: 'xfer-full',
2978
+ reason: 'payload-missing',
2979
+ },
2980
+ ],
2981
+ },
2982
+ },
2983
+ ];
2984
+ Object.entries(data?.flags || []).forEach(([key, flag]) => {
2985
+ events.push({
2986
+ event: 'put-object',
2987
+ data: {
2988
+ kind: 'flag',
2989
+ key,
2990
+ version: flag.version || 1,
2991
+ object: flag,
2992
+ },
2993
+ });
2994
+ });
2995
+ Object.entries(data?.segments || []).forEach(([key, segment]) => {
2996
+ events.push({
2997
+ event: 'put-object',
2998
+ data: {
2999
+ kind: 'segment',
3000
+ key,
3001
+ version: segment.version || 1,
3002
+ object: segment,
3003
+ },
3004
+ });
3005
+ });
3006
+ events.push({
3007
+ event: 'payload-transferred',
3008
+ data: {
3009
+ // IMPORTANT: the selector MUST be empty or "live" data synchronizers
3010
+ // will not work as it would try to resume from a bogus state.
3011
+ state: this._selector,
3012
+ version: 1,
3013
+ id: PAYLOAD_ID,
3014
+ },
3015
+ });
3016
+ this._processor.processEvents(events);
3017
+ },
3018
+ };
3019
+ }
3020
+
2927
3021
  /**
2928
3022
  * A FDv2 PayloadProcessor can be used to parse payloads from a stream of FDv2 events. It will send payloads
2929
3023
  * to the PayloadListeners as the payloads are received. Invalid series of events may be dropped silently,
@@ -2954,7 +3048,7 @@ class PayloadProcessor {
2954
3048
  }
2955
3049
  // at the time of writing this, it was agreed upon that SDKs could assume exactly 1 element in this list. In the future, a negotiation of protocol version will be required to remove this assumption.
2956
3050
  const payload = data.payloads[0];
2957
- switch (payload?.code) {
3051
+ switch (payload?.intentCode) {
2958
3052
  case 'xfer-full':
2959
3053
  this._tempBasis = true;
2960
3054
  break;
@@ -2967,6 +3061,7 @@ class PayloadProcessor {
2967
3061
  break;
2968
3062
  default:
2969
3063
  // unrecognized intent code, return
3064
+ this._logger?.warn(`Unable to process intent code '${payload?.intentCode}'.`);
2970
3065
  return;
2971
3066
  }
2972
3067
  this._tempId = payload?.id;
@@ -3024,8 +3119,12 @@ class PayloadProcessor {
3024
3119
  };
3025
3120
  this._processPayloadTransferred = (data) => {
3026
3121
  // if the following properties haven't been provided by now, we should reset
3027
- if (!this._tempId || // server intent hasn't been received yet.
3028
- !data.state ||
3122
+ if (
3123
+ // server intent hasn't been received yet.
3124
+ !this._tempId ||
3125
+ // selector can be an empty string if we are using a file data initilizer
3126
+ data.state === null ||
3127
+ data.state === undefined ||
3029
3128
  !data.version) {
3030
3129
  this._resetAll(); // a reset is best defensive action since payload transferred terminates a payload
3031
3130
  return;
@@ -3228,6 +3327,7 @@ var index = /*#__PURE__*/Object.freeze({
3228
3327
  ErrorKinds: ErrorKinds$1,
3229
3328
  EventFactoryBase: EventFactoryBase,
3230
3329
  EventProcessor: EventProcessor,
3330
+ FDv1PayloadAdaptor: fdv1PayloadAdaptor,
3231
3331
  InputCustomEvent: InputCustomEvent,
3232
3332
  InputEvalEvent: InputEvalEvent,
3233
3333
  InputIdentifyEvent: InputIdentifyEvent,
@@ -3259,6 +3359,7 @@ exports.Function = Function;
3259
3359
  exports.KindValidator = KindValidator;
3260
3360
  exports.LDClientError = LDClientError;
3261
3361
  exports.LDFileDataSourceError = LDFileDataSourceError;
3362
+ exports.LDFlagDeliveryFallbackError = LDFlagDeliveryFallbackError;
3262
3363
  exports.LDPollingError = LDPollingError;
3263
3364
  exports.LDStreamingError = LDStreamingError;
3264
3365
  exports.LDTimeoutError = LDTimeoutError;