@microsoft/applicationinsights-web-basic 2.8.0-beta.2203-02 → 2.8.0-beta.2203-03

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.
@@ -705,6 +705,130 @@
705
705
  ],
706
706
  "name": "addNotificationListener"
707
707
  },
708
+ {
709
+ "kind": "MethodSignature",
710
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#addPlugin:member(1)",
711
+ "docComment": "/**\n * Add a new plugin to the installation\n *\n * @param plugin - The new plugin to add\n *\n * @param replaceExisting - should any existing plugin be replaced\n *\n * @param doAsync - Should the add be performed asynchronously\n */\n",
712
+ "excerptTokens": [
713
+ {
714
+ "kind": "Content",
715
+ "text": "addPlugin<T extends "
716
+ },
717
+ {
718
+ "kind": "Reference",
719
+ "text": "IPlugin",
720
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!IPlugin:interface"
721
+ },
722
+ {
723
+ "kind": "Content",
724
+ "text": " "
725
+ },
726
+ {
727
+ "kind": "Content",
728
+ "text": "= "
729
+ },
730
+ {
731
+ "kind": "Reference",
732
+ "text": "ITelemetryPlugin",
733
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!ITelemetryPlugin:interface"
734
+ },
735
+ {
736
+ "kind": "Content",
737
+ "text": ">(plugin: "
738
+ },
739
+ {
740
+ "kind": "Content",
741
+ "text": "T"
742
+ },
743
+ {
744
+ "kind": "Content",
745
+ "text": ", replaceExisting: "
746
+ },
747
+ {
748
+ "kind": "Content",
749
+ "text": "boolean"
750
+ },
751
+ {
752
+ "kind": "Content",
753
+ "text": ", doAsync: "
754
+ },
755
+ {
756
+ "kind": "Content",
757
+ "text": "boolean"
758
+ },
759
+ {
760
+ "kind": "Content",
761
+ "text": ", addCb?: "
762
+ },
763
+ {
764
+ "kind": "Content",
765
+ "text": "(added?: boolean) => void"
766
+ },
767
+ {
768
+ "kind": "Content",
769
+ "text": "): "
770
+ },
771
+ {
772
+ "kind": "Content",
773
+ "text": "void"
774
+ },
775
+ {
776
+ "kind": "Content",
777
+ "text": ";"
778
+ }
779
+ ],
780
+ "isOptional": false,
781
+ "returnTypeTokenRange": {
782
+ "startIndex": 14,
783
+ "endIndex": 15
784
+ },
785
+ "releaseTag": "Public",
786
+ "overloadIndex": 1,
787
+ "parameters": [
788
+ {
789
+ "parameterName": "plugin",
790
+ "parameterTypeTokenRange": {
791
+ "startIndex": 6,
792
+ "endIndex": 7
793
+ }
794
+ },
795
+ {
796
+ "parameterName": "replaceExisting",
797
+ "parameterTypeTokenRange": {
798
+ "startIndex": 8,
799
+ "endIndex": 9
800
+ }
801
+ },
802
+ {
803
+ "parameterName": "doAsync",
804
+ "parameterTypeTokenRange": {
805
+ "startIndex": 10,
806
+ "endIndex": 11
807
+ }
808
+ },
809
+ {
810
+ "parameterName": "addCb",
811
+ "parameterTypeTokenRange": {
812
+ "startIndex": 12,
813
+ "endIndex": 13
814
+ }
815
+ }
816
+ ],
817
+ "typeParameters": [
818
+ {
819
+ "typeParameterName": "T",
820
+ "constraintTokenRange": {
821
+ "startIndex": 1,
822
+ "endIndex": 3
823
+ },
824
+ "defaultTypeTokenRange": {
825
+ "startIndex": 4,
826
+ "endIndex": 5
827
+ }
828
+ }
829
+ ],
830
+ "name": "addPlugin"
831
+ },
708
832
  {
709
833
  "kind": "MethodSignature",
710
834
  "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#addTelemetryInitializer:member(1)",
@@ -755,6 +879,51 @@
755
879
  ],
756
880
  "name": "addTelemetryInitializer"
757
881
  },
882
+ {
883
+ "kind": "MethodSignature",
884
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#addUnloadCb:member(1)",
885
+ "docComment": "/**\n * Add a handler that will be called when the SDK is being unloaded\n *\n * @param handler - the handler\n */\n",
886
+ "excerptTokens": [
887
+ {
888
+ "kind": "Content",
889
+ "text": "addUnloadCb(handler: "
890
+ },
891
+ {
892
+ "kind": "Reference",
893
+ "text": "UnloadHandler",
894
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!UnloadHandler:type"
895
+ },
896
+ {
897
+ "kind": "Content",
898
+ "text": "): "
899
+ },
900
+ {
901
+ "kind": "Content",
902
+ "text": "void"
903
+ },
904
+ {
905
+ "kind": "Content",
906
+ "text": ";"
907
+ }
908
+ ],
909
+ "isOptional": false,
910
+ "returnTypeTokenRange": {
911
+ "startIndex": 3,
912
+ "endIndex": 4
913
+ },
914
+ "releaseTag": "Public",
915
+ "overloadIndex": 1,
916
+ "parameters": [
917
+ {
918
+ "parameterName": "handler",
919
+ "parameterTypeTokenRange": {
920
+ "startIndex": 1,
921
+ "endIndex": 2
922
+ }
923
+ }
924
+ ],
925
+ "name": "addUnloadCb"
926
+ },
758
927
  {
759
928
  "kind": "PropertySignature",
760
929
  "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#config:member",
@@ -1370,6 +1539,65 @@
1370
1539
  }
1371
1540
  ],
1372
1541
  "name": "track"
1542
+ },
1543
+ {
1544
+ "kind": "MethodSignature",
1545
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#unload:member(1)",
1546
+ "docComment": "/**\n * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous unload call return `true` stating that all plugins reported that they also unloaded, the recommended approach is to create a new instance and initialize that instance. This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable to successfully remove any global references or they may just be completing the unload process asynchronously.\n */\n",
1547
+ "excerptTokens": [
1548
+ {
1549
+ "kind": "Content",
1550
+ "text": "unload(isAsync?: "
1551
+ },
1552
+ {
1553
+ "kind": "Content",
1554
+ "text": "boolean"
1555
+ },
1556
+ {
1557
+ "kind": "Content",
1558
+ "text": ", unloadComplete?: "
1559
+ },
1560
+ {
1561
+ "kind": "Content",
1562
+ "text": "() => void"
1563
+ },
1564
+ {
1565
+ "kind": "Content",
1566
+ "text": "): "
1567
+ },
1568
+ {
1569
+ "kind": "Content",
1570
+ "text": "void"
1571
+ },
1572
+ {
1573
+ "kind": "Content",
1574
+ "text": ";"
1575
+ }
1576
+ ],
1577
+ "isOptional": false,
1578
+ "returnTypeTokenRange": {
1579
+ "startIndex": 5,
1580
+ "endIndex": 6
1581
+ },
1582
+ "releaseTag": "Public",
1583
+ "overloadIndex": 1,
1584
+ "parameters": [
1585
+ {
1586
+ "parameterName": "isAsync",
1587
+ "parameterTypeTokenRange": {
1588
+ "startIndex": 1,
1589
+ "endIndex": 2
1590
+ }
1591
+ },
1592
+ {
1593
+ "parameterName": "unloadComplete",
1594
+ "parameterTypeTokenRange": {
1595
+ "startIndex": 3,
1596
+ "endIndex": 4
1597
+ }
1598
+ }
1599
+ ],
1600
+ "name": "unload"
1373
1601
  }
1374
1602
  ],
1375
1603
  "extendsTokenRanges": [
@@ -44,9 +44,13 @@ export const CoreUtils: ICoreUtils;
44
44
  export interface IAppInsightsCore extends IPerfManagerProvider {
45
45
  // Warning: (ae-forgotten-export) The symbol "INotificationListener" needs to be exported by the entry point index.d.ts
46
46
  addNotificationListener?(listener: INotificationListener): void;
47
+ // Warning: (ae-forgotten-export) The symbol "ITelemetryPlugin" needs to be exported by the entry point index.d.ts
48
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
47
49
  // Warning: (ae-forgotten-export) The symbol "TelemetryInitializerFunction" needs to be exported by the entry point index.d.ts
48
50
  // Warning: (ae-forgotten-export) The symbol "ITelemetryInitializerHandler" needs to be exported by the entry point index.d.ts
49
51
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
52
+ // Warning: (ae-forgotten-export) The symbol "UnloadHandler" needs to be exported by the entry point index.d.ts
53
+ addUnloadCb(handler: UnloadHandler): void;
50
54
  // (undocumented)
51
55
  config: IConfiguration;
52
56
  evtNamespace(): string;
@@ -74,6 +78,7 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
74
78
  stopPollingInternalLogs?(): void;
75
79
  // (undocumented)
76
80
  track(telemetryItem: ITelemetryItem): void;
81
+ unload(isAsync?: boolean, unloadComplete?: () => void): void;
77
82
  }
78
83
 
79
84
  // @public
@@ -112,7 +117,6 @@ export interface IConfiguration {
112
117
  extensionConfig?: {
113
118
  [key: string]: any;
114
119
  };
115
- // Warning: (ae-forgotten-export) The symbol "ITelemetryPlugin" needs to be exported by the entry point index.d.ts
116
120
  extensions?: ITelemetryPlugin[];
117
121
  idLength?: number;
118
122
  instrumentationKey?: string;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 2.8.0-beta.2203-02
2
+ * Microsoft.ApplicationInsights, 2.8.0-beta.2203-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -100,11 +100,26 @@ declare namespace ApplicationInsights {
100
100
  * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
101
101
  */
102
102
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
103
+ /**
104
+ * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
105
+ * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
106
+ * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
107
+ * approach is to create a new instance and initialize that instance.
108
+ * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
109
+ * to successfully remove any global references or they may just be completing the unload process asynchronously.
110
+ */
111
+ unload(isAsync?: boolean, unloadComplete?: () => void): void;
103
112
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
113
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
104
114
  /**
105
115
  * Returns the unique event namespace that should be used
106
116
  */
107
117
  evtNamespace(): string;
118
+ /**
119
+ * Add an unload handler that will be called when the SDK is being unloaded
120
+ * @param handler - the handler
121
+ */
122
+ addUnloadCb(handler: UnloadHandler): void;
108
123
  protected releaseQueue(): void;
109
124
  }
110
125
 
@@ -174,6 +189,11 @@ declare namespace ApplicationInsights {
174
189
  */
175
190
  teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
176
191
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
192
+ /**
193
+ * Add an unload handler that will be called when the SDK is being unloaded
194
+ * @param handler - the handler
195
+ */
196
+ protected _addUnloadCb(handler: UnloadHandler): void;
177
197
  /**
178
198
  * Add this hook so that it is automatically removed during unloading
179
199
  * @param hooks - The single hook or an array of IInstrumentHook objects
@@ -361,15 +381,36 @@ declare namespace ApplicationInsights {
361
381
  * Return a new instance of the IProcessTelemetryContext for processing events
362
382
  */
363
383
  getProcessTelContext(): IProcessTelemetryContext;
384
+ /**
385
+ * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
386
+ * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
387
+ * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
388
+ * approach is to create a new instance and initialize that instance.
389
+ * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
390
+ * to successfully remove any global references or they may just be completing the unload process asynchronously.
391
+ */
392
+ unload(isAsync?: boolean, unloadComplete?: () => void): void;
364
393
  /**
365
394
  * Find and return the (first) plugin with the specified identifier if present
366
395
  * @param pluginIdentifier
367
396
  */
368
397
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
398
+ /**
399
+ * Add a new plugin to the installation
400
+ * @param plugin - The new plugin to add
401
+ * @param replaceExisting - should any existing plugin be replaced
402
+ * @param doAsync - Should the add be performed asynchronously
403
+ */
404
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
369
405
  /**
370
406
  * Returns the unique event namespace that should be used when registering events
371
407
  */
372
408
  evtNamespace(): string;
409
+ /**
410
+ * Add a handler that will be called when the SDK is being unloaded
411
+ * @param handler - the handler
412
+ */
413
+ addUnloadCb(handler: UnloadHandler): void;
373
414
  }
374
415
 
375
416
  /**
@@ -1460,6 +1501,7 @@ declare namespace ApplicationInsights {
1460
1501
  * (unless it's also been re-initialized)
1461
1502
  */
1462
1503
  setEnabled: (isEnabled: boolean) => void;
1504
+ remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
1463
1505
  }
1464
1506
 
1465
1507
  interface IMetricTelemetry extends IPartC {
@@ -2342,6 +2384,10 @@ declare namespace ApplicationInsights {
2342
2384
  * The event(s) being sent as a retry
2343
2385
  */
2344
2386
  Retry = 5,
2387
+ /**
2388
+ * The SDK is unloading
2389
+ */
2390
+ SdkUnload = 6,
2345
2391
  /**
2346
2392
  * Maximum batch size would be exceeded
2347
2393
  */
@@ -2376,9 +2422,23 @@ declare namespace ApplicationInsights {
2376
2422
  /**
2377
2423
  * Teardown has been called without any context.
2378
2424
  */
2379
- ManualTeardown = 0
2425
+ ManualTeardown = 0,
2426
+ /**
2427
+ * Just this plugin is being removed
2428
+ */
2429
+ PluginUnload = 1,
2430
+ /**
2431
+ * This instance of the plugin is being removed and replaced
2432
+ */
2433
+ PluginReplace = 2,
2434
+ /**
2435
+ * The entire SDK is being unloaded
2436
+ */
2437
+ SdkUnload = 50
2380
2438
  }
2381
2439
 
2440
+ type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2441
+
2382
2442
  interface XDomainRequest extends XMLHttpRequestEventTarget {
2383
2443
  readonly responseText: string;
2384
2444
  send(payload: string): void;