@microsoft/1ds-core-js 4.1.1-nightly3.2403-02 → 4.1.1-nightly3.2403-04

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 (43) hide show
  1. package/bundle/es5/{ms.core-4.1.1-nightly3.2403-02.gbl.js → ms.core-4.1.1-nightly3.2403-04.gbl.js} +1600 -1025
  2. package/bundle/es5/ms.core-4.1.1-nightly3.2403-04.gbl.js.map +1 -0
  3. package/bundle/es5/ms.core-4.1.1-nightly3.2403-04.gbl.min.js +7 -0
  4. package/bundle/es5/ms.core-4.1.1-nightly3.2403-04.gbl.min.js.map +1 -0
  5. package/bundle/es5/ms.core-4.1.1-nightly3.2403-04.integrity.json +46 -0
  6. package/bundle/es5/{ms.core-4.1.1-nightly3.2403-02.js → ms.core-4.1.1-nightly3.2403-04.js} +1600 -1025
  7. package/bundle/es5/ms.core-4.1.1-nightly3.2403-04.js.map +1 -0
  8. package/bundle/es5/ms.core-4.1.1-nightly3.2403-04.min.js +7 -0
  9. package/bundle/es5/ms.core-4.1.1-nightly3.2403-04.min.js.map +1 -0
  10. package/bundle/es5/ms.core.gbl.js +1599 -1024
  11. package/bundle/es5/ms.core.gbl.js.map +1 -1
  12. package/bundle/es5/ms.core.gbl.min.js +2 -2
  13. package/bundle/es5/ms.core.gbl.min.js.map +1 -1
  14. package/bundle/es5/ms.core.integrity.json +17 -17
  15. package/bundle/es5/ms.core.js +1599 -1024
  16. package/bundle/es5/ms.core.js.map +1 -1
  17. package/bundle/es5/ms.core.min.js +2 -2
  18. package/bundle/es5/ms.core.min.js.map +1 -1
  19. package/dist/es5/ms.core.js +1597 -1022
  20. package/dist/es5/ms.core.js.map +1 -1
  21. package/dist/es5/ms.core.min.js +2 -2
  22. package/dist/es5/ms.core.min.js.map +1 -1
  23. package/dist-es5/AppInsightsCore.js +1 -1
  24. package/dist-es5/BaseCore.js +1 -1
  25. package/dist-es5/DataModels.js +1 -1
  26. package/dist-es5/Enums.js +1 -1
  27. package/dist-es5/Index.js +2 -2
  28. package/dist-es5/Index.js.map +1 -1
  29. package/dist-es5/InternalConstants.js +1 -1
  30. package/dist-es5/Utils.js +2 -2
  31. package/dist-es5/Utils.js.map +1 -1
  32. package/dist-es5/ValueSanitizer.js +1 -1
  33. package/dist-es5/__DynamicConstants.js +1 -1
  34. package/package.json +2 -2
  35. package/types/1ds-core-js.d.ts +49 -25
  36. package/types/1ds-core-js.namespaced.d.ts +230 -7
  37. package/bundle/es5/ms.core-4.1.1-nightly3.2403-02.gbl.js.map +0 -1
  38. package/bundle/es5/ms.core-4.1.1-nightly3.2403-02.gbl.min.js +0 -7
  39. package/bundle/es5/ms.core-4.1.1-nightly3.2403-02.gbl.min.js.map +0 -1
  40. package/bundle/es5/ms.core-4.1.1-nightly3.2403-02.integrity.json +0 -46
  41. package/bundle/es5/ms.core-4.1.1-nightly3.2403-02.js.map +0 -1
  42. package/bundle/es5/ms.core-4.1.1-nightly3.2403-02.min.js +0 -7
  43. package/bundle/es5/ms.core-4.1.1-nightly3.2403-02.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * 1DS JS SDK Core, 4.1.1-nightly3.2403-02
2
+ * 1DS JS SDK Core, 4.1.1-nightly3.2403-04
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -76,6 +76,12 @@ declare namespace oneDS {
76
76
  */
77
77
  function addPageUnloadEventListener(listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
78
78
 
79
+ /**
80
+ * append the XHR headers.
81
+ * @internal
82
+ */
83
+ function _appendHeader(theHeaders: any, xhr: XMLHttpRequest, name: string): any;
84
+
79
85
  /**
80
86
  * @group Classes
81
87
  * @group Entrypoint
@@ -492,6 +498,14 @@ declare namespace oneDS {
492
498
  */
493
499
  function blockDynamicConversion<T>(value: T): T;
494
500
 
501
+ /**
502
+ * Converts the XHR getAllResponseHeaders to a map containing the header key and value.
503
+ * @internal
504
+ */
505
+ function convertAllHeadersToMap(headersString: string): {
506
+ [headerName: string]: string;
507
+ };
508
+
495
509
  function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
496
510
 
497
511
  /**
@@ -1183,6 +1197,10 @@ declare namespace oneDS {
1183
1197
  */
1184
1198
  function forceDynamicConversion<T>(value: T): T;
1185
1199
 
1200
+ function formatErrorMessageXdr(xdr: IXDomainRequest, message?: string): string;
1201
+
1202
+ function formatErrorMessageXhr(xhr: XMLHttpRequest, message?: string): string;
1203
+
1186
1204
  /**
1187
1205
  * Format the ITraceParent value as a string using the supported and know version formats.
1188
1206
  * So even if the passed traceParent is a later version the string value returned from this
@@ -1200,6 +1218,12 @@ declare namespace oneDS {
1200
1218
  */
1201
1219
  function generateW3CId(): string;
1202
1220
 
1221
+ /**
1222
+ * get the XHR getAllResponseHeaders.
1223
+ * @internal
1224
+ */
1225
+ function _getAllResponseHeaders(xhr: XMLHttpRequest, isOneDs?: boolean): {};
1226
+
1203
1227
  function getCommonSchemaMetaData(value: string | boolean | number | string[] | number[] | boolean[] | undefined, kind: number | undefined, type?: number | undefined): number;
1204
1228
 
1205
1229
  /**
@@ -1343,6 +1367,8 @@ declare namespace oneDS {
1343
1367
  */
1344
1368
  function getPerformance(): Performance;
1345
1369
 
1370
+ function getResponseText(xhr: XMLHttpRequest | IXDomainRequest): string;
1371
+
1346
1372
  /**
1347
1373
  * Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it
1348
1374
  * @param target - The target object to return or set the default value
@@ -1589,6 +1615,25 @@ declare namespace oneDS {
1589
1615
  getWParam: () => number;
1590
1616
  }
1591
1617
 
1618
+ interface IBackendResponse {
1619
+ /**
1620
+ * Number of items received by the backend
1621
+ */
1622
+ readonly itemsReceived: number;
1623
+ /**
1624
+ * Number of items succesfuly accepted by the backend
1625
+ */
1626
+ readonly itemsAccepted: number;
1627
+ /**
1628
+ * List of errors for items which were not accepted
1629
+ */
1630
+ readonly errors: IResponseError[];
1631
+ /**
1632
+ * App id returned by the backend - not necessary returned, but we don't need it with each response.
1633
+ */
1634
+ readonly appId?: string;
1635
+ }
1636
+
1592
1637
  interface IBaseProcessingContext {
1593
1638
  /**
1594
1639
  * The current core instance for the request
@@ -2496,6 +2541,17 @@ declare namespace oneDS {
2496
2541
  shouldProcess?: (evt: ITelemetryItem) => boolean;
2497
2542
  }
2498
2543
 
2544
+ /**
2545
+ * Internal interface
2546
+ * internal sendpost interface
2547
+ * @internal
2548
+ * @since version after 3.1.0
2549
+ */
2550
+ interface _IInternalXhrOverride extends IXHROverride {
2551
+ _transport?: TransportType;
2552
+ _isSync?: boolean;
2553
+ }
2554
+
2499
2555
  /**
2500
2556
  * An alternate interface which provides automatic removal during unloading of the component
2501
2557
  */
@@ -3266,6 +3322,12 @@ declare namespace oneDS {
3266
3322
  handler: any;
3267
3323
  }
3268
3324
 
3325
+ interface IResponseError {
3326
+ readonly index: number;
3327
+ readonly statusCode: number;
3328
+ readonly message: string;
3329
+ }
3330
+
3269
3331
  /**
3270
3332
  * Checks if the type of value is an Array.
3271
3333
  *
@@ -3334,6 +3396,114 @@ declare namespace oneDS {
3334
3396
  */
3335
3397
  const isDocumentObjectAvailable: boolean;
3336
3398
 
3399
+ /**
3400
+ * internal interface
3401
+ * Define functions when xhr/xdr/fetch requests are successfully returned. If they are not defined, oncomplete with be called instead
3402
+ * @internal for internal use only
3403
+ */
3404
+ interface _ISenderOnComplete {
3405
+ /**
3406
+ * defined xdr onload function to handle response
3407
+ * @param dxr xdr request object
3408
+ * @param oncomplete oncomplete function
3409
+ * @since version after 3.1.0
3410
+ */
3411
+ xdrOnComplete?(xdr: IXDomainRequest, onComplete: OnCompleteCallback, payload?: IPayloadData): void;
3412
+ /**
3413
+ * defined fetch on complete function to handle response
3414
+ * @param response response object
3415
+ * @param onComplete oncomplete function
3416
+ * @param resValue response.text().value
3417
+ * @since version after 3.1.0
3418
+ */
3419
+ fetchOnComplete?(response: Response, onComplete: OnCompleteCallback, resValue?: string, payload?: IPayloadData): void;
3420
+ /**
3421
+ * defined xhr onreadystatechange function to handle response
3422
+ * @param request request object
3423
+ * @param oncomplete oncomplete function
3424
+ * @since version after 3.1.0
3425
+ */
3426
+ xhrOnComplete?(request: XMLHttpRequest, onComplete: OnCompleteCallback, payload?: IPayloadData): void;
3427
+ /**
3428
+ * Define functions during beacon can not send payload after first attempt. If not defined, will be apyload will be retried with fallback sender.
3429
+ * @param data payload data
3430
+ * @param onComplete oncomplete function
3431
+ * @param canSend can the current data sent by beacon sender
3432
+ * @since version after 3.1.0
3433
+ */
3434
+ beaconOnRetry?(data: IPayloadData, onComplete: OnCompleteCallback, canSend: (payload: IPayloadData, oncomplete: OnCompleteCallback, sync?: boolean) => boolean): void;
3435
+ }
3436
+
3437
+ /**
3438
+ * Internal interface for SendPostMnager
3439
+ * @internal for internal use only
3440
+ */
3441
+ interface _ISendPostMgrConfig {
3442
+ /**
3443
+ * Enable the sender interface to return a promise
3444
+ * Note: Enabling this may cause unhandled promise rejection errors to occur if you do not listen and handle any rejection response,
3445
+ * Defaults to false
3446
+ * @since version after 3.1.0
3447
+ */
3448
+ enableSendPromise?: boolean;
3449
+ /**
3450
+ * Identifies if the sender is 1ds post channel
3451
+ * Default is false
3452
+ * @since version after 3.1.0
3453
+ */
3454
+ isOneDs?: boolean;
3455
+ /**
3456
+ * Identify if Credentials should be disabled for 1ds post channel, application insights sender will igore this config
3457
+ * Default is false
3458
+ * @since version after 3.1.0
3459
+ */
3460
+ disableCredentials?: boolean;
3461
+ /**
3462
+ * Identifies if XMLHttpRequest or XDomainRequest (for IE < 9) should be used
3463
+ * Default: false
3464
+ * @since version after 3.1.0
3465
+ */
3466
+ disableXhr?: boolean;
3467
+ /**
3468
+ * Is beacon disabled during async sending
3469
+ * Default: false
3470
+ * @since version after 3.1.0
3471
+ */
3472
+ disableBeacon?: boolean;
3473
+ /**
3474
+ * Is beacon disabled during sync sending
3475
+ * Default: false
3476
+ * @since version after 3.1.0
3477
+ */
3478
+ disableBeaconSync?: boolean;
3479
+ /**
3480
+ * Is FetchKeepAlive disabled during sync sending
3481
+ * Default: false
3482
+ * @since version after 3.1.0
3483
+ */
3484
+ disableFetchKeepAlive?: boolean;
3485
+ /**
3486
+ * Identifies functions when xhr/xdr/fetch requests are successfully returned. If they are not defined, oncomplete with be called instead
3487
+ * @since version after 3.1.0
3488
+ */
3489
+ senderOnCompleteCallBack?: _ISenderOnComplete;
3490
+ /**
3491
+ * time wrapper to handle payload timeout
3492
+ * this is for 1ds post channel only
3493
+ * Default: null
3494
+ * @since version after 3.1.0
3495
+ */
3496
+ timeWrapper?: _ITimeoutOverrideWrapper;
3497
+ /**
3498
+ * [Optional] flag to indicate whether the sendBeacon and fetch (with keep-alive flag) should add the "NoResponseBody" query string
3499
+ * value to indicate that the server should return a 204 for successful requests. Defaults to true
3500
+ * this is for 1ds post channel only
3501
+ * Default: true
3502
+ * @since version after 3.1.0
3503
+ */
3504
+ addNoResponse?: boolean;
3505
+ }
3506
+
3337
3507
  /**
3338
3508
  * Checks if the type of value is a Error object.
3339
3509
  * @group Type Identity
@@ -3752,6 +3922,16 @@ declare namespace oneDS {
3752
3922
  removed?: IPlugin[];
3753
3923
  }
3754
3924
 
3925
+ /**
3926
+ * Internal interface
3927
+ * Simple internal timeout wrapper
3928
+ * @internal
3929
+ * @since version after 3.1.0
3930
+ */
3931
+ interface _ITimeoutOverrideWrapper {
3932
+ set: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => ITimerHandler;
3933
+ }
3934
+
3755
3935
  /**
3756
3936
  * A Timer handler which is returned from {@link scheduleTimeout} which contains functions to
3757
3937
  * cancel or restart (refresh) the timeout function.
@@ -4024,6 +4204,17 @@ declare namespace oneDS {
4024
4204
  rm: () => void;
4025
4205
  }
4026
4206
 
4207
+ interface IXDomainRequest extends XMLHttpRequestEventTarget {
4208
+ readonly responseText: string;
4209
+ send(payload: string): void;
4210
+ open(method: string, url: string): void;
4211
+ timeout: number;
4212
+ contentType: string;
4213
+ addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
4214
+ addEventListener(type: "load" | "timeout", listener: (ev: Event) => any, useCapture?: boolean): void;
4215
+ addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
4216
+ }
4217
+
4027
4218
  /**
4028
4219
  * The IXHROverride interface overrides the way HTTP requests are sent.
4029
4220
  */
@@ -4281,6 +4472,12 @@ declare namespace oneDS {
4281
4472
  */
4282
4473
  function optimizeObject<T>(theObject: T): T;
4283
4474
 
4475
+ /**
4476
+ * Parses the response from the backend.
4477
+ * @param response - XMLHttpRequest or XDomainRequest response
4478
+ */
4479
+ function parseResponse(response: any, diagLog?: IDiagnosticLogger): IBackendResponse;
4480
+
4284
4481
  /**
4285
4482
  * Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)
4286
4483
  *
@@ -4380,6 +4577,8 @@ declare namespace oneDS {
4380
4577
  */
4381
4578
  function perfNow(): number;
4382
4579
 
4580
+ function prependTransports(theTransports: TransportType[], newTransports: TransportType | TransportType[]): TransportType[];
4581
+
4383
4582
  /**
4384
4583
  * This class will be removed!
4385
4584
  * @deprecated use createProcessTelemetryContext() instead
@@ -4580,6 +4779,35 @@ declare namespace oneDS {
4580
4779
  */
4581
4780
  function sanitizeProperty(name: string, property: string | number | boolean | string[] | number[] | boolean[] | object | IEventProperty, stringifyObjects?: boolean): IEventProperty | null;
4582
4781
 
4782
+ /**
4783
+ * This Internal component
4784
+ * Manager SendPost functions
4785
+ * SendPostManger
4786
+ * @internal for internal use only
4787
+ */
4788
+ class SenderPostManager {
4789
+ constructor();
4790
+ initialize(config: _ISendPostMgrConfig, diagLog: IDiagnosticLogger): void;
4791
+ /**
4792
+ * Get size of current sync fetch payload
4793
+ */
4794
+ getSyncFetchPayload(): number;
4795
+ /**
4796
+ * reset Config
4797
+ * @returns True if set is successfully
4798
+ */
4799
+ SetConfig(config: _ISendPostMgrConfig): boolean;
4800
+ /**
4801
+ * Get current xhr instance
4802
+ */
4803
+ getSenderInst(transports: TransportType[], sync?: boolean): IXHROverride;
4804
+ /**
4805
+ * Get current fallback sender instance
4806
+ */
4807
+ getFallbackInst(): IXHROverride;
4808
+ _doTeardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void;
4809
+ }
4810
+
4583
4811
  /**
4584
4812
  * SendPOSTFunction type defines how an HTTP POST request is sent to an ingestion server
4585
4813
  * @param payload - The payload object that should be sent, contains the url, bytes/string and headers for the request
@@ -4782,11 +5010,6 @@ declare namespace oneDS {
4782
5010
 
4783
5011
  type TraceLevel = number | eTraceLevel;
4784
5012
 
4785
- /**
4786
- * An enumeration that identifies the transport type that are requested to be used, if the requested
4787
- * transport is not available ir supported the SDK may choose the first available transport or it
4788
- * will log a warning to the diagnostic logger.
4789
- */
4790
5013
  const enum TransportType {
4791
5014
  /**
4792
5015
  * Use the default available api
@@ -4874,7 +5097,7 @@ declare namespace oneDS {
4874
5097
  constructor(fieldSanitizerProvider?: IFieldValueSanitizerProvider);
4875
5098
  }
4876
5099
 
4877
- const Version = "4.1.1-nightly3.2403-02";
5100
+ const Version = "4.1.1-nightly3.2403-04";
4878
5101
 
4879
5102
  /**
4880
5103
  * This is a helper method which will call warnToConsole on the passed logger with the provided message.