launchdarkly-js-sdk-common 3.6.0 → 3.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "launchdarkly-js-sdk-common",
3
- "version": "3.6.0",
3
+ "version": "3.8.0",
4
4
  "description": "LaunchDarkly SDK for JavaScript - common code",
5
5
  "author": "LaunchDarkly <team@launchdarkly.com>",
6
6
  "license": "Apache-2.0",
package/typings.d.ts CHANGED
@@ -191,10 +191,13 @@ declare module 'launchdarkly-js-sdk-common' {
191
191
  inlineUsersInEvents?: boolean;
192
192
 
193
193
  /**
194
- * Whether or not to send an analytics event for a flag evaluation even if the same flag was
195
- * evaluated with the same value within the last five minutes.
194
+ * This option is deprecated, and setting it has no effect.
196
195
  *
197
- * By default, this is false (duplicate events within five minutes will be dropped).
196
+ * The behavior is now to allow frequent duplicate events.
197
+ *
198
+ * This is not a problem because most events will be summarized, and
199
+ * events which are not summarized are important to the operation of features such as
200
+ * experimentation.
198
201
  */
199
202
  allowFrequentDuplicateEvents?: boolean;
200
203
 
@@ -313,6 +316,11 @@ declare module 'launchdarkly-js-sdk-common' {
313
316
  */
314
317
  version?: string;
315
318
  }
319
+
320
+ /**
321
+ * Inspectors can be used for collecting information for monitoring, analytics, and debugging.
322
+ */
323
+ inspectors?: LDInspection[];
316
324
  }
317
325
 
318
326
  /**
@@ -856,4 +864,105 @@ declare module 'launchdarkly-js-sdk-common' {
856
864
  * You can also specify `'none'` instead to disable all logging.
857
865
  */
858
866
  export type LDLogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';
867
+
868
+ /**
869
+ * Callback interface for collecting information about the SDK at runtime.
870
+ *
871
+ * This interface is used to collect information about flag usage.
872
+ *
873
+ * This interface should not be used by the application to access flags for the purpose of controlling application
874
+ * flow. It is intended for monitoring, analytics, or debugging purposes.
875
+ */
876
+ interface LDInspectionFlagUsedHandler {
877
+ type: 'flag-used',
878
+
879
+ /**
880
+ * Name of the inspector. Will be used for logging issues with the inspector.
881
+ */
882
+ name: string,
883
+
884
+ /**
885
+ * This method is called when a flag is accessed via a variation method, or it can be called based on actions in
886
+ * wrapper SDKs which have different methods of tracking when a flag was accessed. It is not called when a call is made
887
+ * to allFlags.
888
+ */
889
+ method: (flagKey: string, flagDetail: LDEvaluationDetail, user: LDUser) => void;
890
+ }
891
+
892
+ /**
893
+ * Callback interface for collecting information about the SDK at runtime.
894
+ *
895
+ * This interface is used to collect information about flag data. In order to understand the
896
+ * current flag state it should be combined with {@link LDInspectionFlagValueChangedHandler}.
897
+ * This interface will get the initial flag information, and
898
+ * {@link LDInspectionFlagValueChangedHandler} will provide changes to individual flags.
899
+ *
900
+ * This interface should not be used by the application to access flags for the purpose of controlling application
901
+ * flow. It is intended for monitoring, analytics, or debugging purposes.
902
+ */
903
+ interface LDInspectionFlagDetailsChangedHandler {
904
+ type: 'flag-details-changed',
905
+
906
+ /**
907
+ * Name of the inspector. Will be used for logging issues with the inspector.
908
+ */
909
+ name: string,
910
+
911
+ /**
912
+ * This method is called when the flags in the store are replaced with new flags. It will contain all flags
913
+ * regardless of if they have been evaluated.
914
+ */
915
+ method: (details: Record<string, LDEvaluationDetail>) => void;
916
+ }
917
+
918
+
919
+ /**
920
+ * Callback interface for collecting information about the SDK at runtime.
921
+ *
922
+ * This interface is used to collect changes to flag data, but does not provide the initial
923
+ * data. It can be combined with {@link LDInspectionFlagValuesChangedHandler} to track the
924
+ * entire flag state.
925
+ *
926
+ * This interface should not be used by the application to access flags for the purpose of controlling application
927
+ * flow. It is intended for monitoring, analytics, or debugging purposes.
928
+ */
929
+ interface LDInspectionFlagDetailChangedHandler {
930
+ type: 'flag-detail-changed',
931
+
932
+ /**
933
+ * Name of the inspector. Will be used for logging issues with the inspector.
934
+ */
935
+ name: string,
936
+
937
+ /**
938
+ * This method is called when a flag is updated. It will not be called
939
+ * when all flags are updated.
940
+ */
941
+ method: (flagKey: string, detail: LDEvaluationDetail) => void;
942
+ }
943
+
944
+ /**
945
+ * Callback interface for collecting information about the SDK at runtime.
946
+ *
947
+ * This interface is used to track current identity state of the SDK.
948
+ *
949
+ * This interface should not be used by the application to access flags for the purpose of controlling application
950
+ * flow. It is intended for monitoring, analytics, or debugging purposes.
951
+ */
952
+ interface LDInspectionIdentifyHandler {
953
+ type: 'client-identity-changed',
954
+
955
+ /**
956
+ * Name of the inspector. Will be used for logging issues with the inspector.
957
+ */
958
+ name: string,
959
+
960
+ /**
961
+ * This method will be called when an identify operation completes.
962
+ */
963
+ method: (user: LDUser) => void;
964
+ }
965
+
966
+ type LDInspection = LDInspectionFlagUsedHandler | LDInspectionFlagDetailsChangedHandler
967
+ | LDInspectionFlagDetailChangedHandler | LDInspectionIdentifyHandler;
859
968
  }