launchdarkly-js-sdk-common 3.7.0 → 3.8.1

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.7.0",
3
+ "version": "3.8.1",
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
@@ -316,6 +316,11 @@ declare module 'launchdarkly-js-sdk-common' {
316
316
  */
317
317
  version?: string;
318
318
  }
319
+
320
+ /**
321
+ * Inspectors can be used for collecting information for monitoring, analytics, and debugging.
322
+ */
323
+ inspectors?: LDInspection[];
319
324
  }
320
325
 
321
326
  /**
@@ -859,4 +864,105 @@ declare module 'launchdarkly-js-sdk-common' {
859
864
  * You can also specify `'none'` instead to disable all logging.
860
865
  */
861
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;
862
968
  }