@microsoft/1ds-post-js 3.2.12 → 4.0.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.
Files changed (105) hide show
  1. package/README.md +1 -1
  2. package/bundle/es5/ms.post-4.0.1.gbl.js +5918 -0
  3. package/bundle/es5/ms.post-4.0.1.gbl.js.map +1 -0
  4. package/bundle/es5/ms.post-4.0.1.gbl.min.js +7 -0
  5. package/bundle/es5/ms.post-4.0.1.gbl.min.js.map +1 -0
  6. package/bundle/es5/ms.post-4.0.1.integrity.json +46 -0
  7. package/bundle/es5/ms.post-4.0.1.js +5922 -0
  8. package/bundle/es5/ms.post-4.0.1.js.map +1 -0
  9. package/bundle/es5/ms.post-4.0.1.min.js +7 -0
  10. package/bundle/es5/ms.post-4.0.1.min.js.map +1 -0
  11. package/bundle/es5/ms.post.gbl.js +5918 -0
  12. package/bundle/es5/ms.post.gbl.js.map +1 -0
  13. package/bundle/es5/ms.post.gbl.min.js +7 -0
  14. package/bundle/es5/ms.post.gbl.min.js.map +1 -0
  15. package/bundle/es5/ms.post.integrity.json +46 -0
  16. package/bundle/es5/ms.post.js +5922 -0
  17. package/bundle/es5/ms.post.js.map +1 -0
  18. package/bundle/es5/ms.post.min.js +7 -0
  19. package/bundle/es5/ms.post.min.js.map +1 -0
  20. package/{bundle → dist/es5}/ms.post.js +3026 -1652
  21. package/dist/es5/ms.post.js.map +1 -0
  22. package/dist/es5/ms.post.min.js +7 -0
  23. package/dist/es5/ms.post.min.js.map +1 -0
  24. package/{dist-esm/src → dist-es5}/BatchNotificationActions.js +1 -1
  25. package/{dist-esm/src → dist-es5}/ClockSkewManager.js +2 -2
  26. package/{dist-esm/src → dist-es5}/ClockSkewManager.js.map +1 -1
  27. package/{dist-esm/src → dist-es5}/DataModels.js +1 -1
  28. package/{dist-esm/src → dist-es5}/EventBatch.js +1 -1
  29. package/{dist-esm/src → dist-es5}/HttpManager.js +175 -94
  30. package/dist-es5/HttpManager.js.map +1 -0
  31. package/{dist-esm/src → dist-es5}/Index.js +2 -2
  32. package/dist-es5/Index.js.map +1 -0
  33. package/{dist-esm/src → dist-es5}/InternalConstants.js +1 -1
  34. package/{dist-esm/src → dist-es5}/KillSwitch.js +2 -2
  35. package/{dist-esm/src → dist-es5}/KillSwitch.js.map +1 -1
  36. package/{dist-esm/src → dist-es5}/PostChannel.js +166 -144
  37. package/dist-es5/PostChannel.js.map +1 -0
  38. package/{dist-esm/src → dist-es5}/RetryPolicy.js +1 -1
  39. package/{dist-esm/src → dist-es5}/Serializer.js +3 -2
  40. package/dist-es5/Serializer.js.map +1 -0
  41. package/dist-es5/TimeoutOverrideWrapper.js +24 -0
  42. package/dist-es5/TimeoutOverrideWrapper.js.map +1 -0
  43. package/{dist-esm/src → dist-es5}/typings/XDomainRequest.js +1 -1
  44. package/package.json +15 -10
  45. package/tsconfig.json +5 -2
  46. package/{src/DataModels.ts → types/1ds-post-js.d.ts} +408 -467
  47. package/types/1ds-post-js.namespaced.d.ts +404 -0
  48. package/bundle/ms.post-3.2.12.gbl.js +0 -4524
  49. package/bundle/ms.post-3.2.12.gbl.js.map +0 -1
  50. package/bundle/ms.post-3.2.12.gbl.min.js +0 -7
  51. package/bundle/ms.post-3.2.12.gbl.min.js.map +0 -1
  52. package/bundle/ms.post-3.2.12.integrity.json +0 -46
  53. package/bundle/ms.post-3.2.12.js +0 -4527
  54. package/bundle/ms.post-3.2.12.js.map +0 -1
  55. package/bundle/ms.post-3.2.12.min.js +0 -7
  56. package/bundle/ms.post-3.2.12.min.js.map +0 -1
  57. package/bundle/ms.post.gbl.js +0 -4524
  58. package/bundle/ms.post.gbl.js.map +0 -1
  59. package/bundle/ms.post.gbl.min.js +0 -7
  60. package/bundle/ms.post.gbl.min.js.map +0 -1
  61. package/bundle/ms.post.integrity.json +0 -46
  62. package/bundle/ms.post.js.map +0 -1
  63. package/bundle/ms.post.min.js +0 -7
  64. package/bundle/ms.post.min.js.map +0 -1
  65. package/dist/ms.post.js +0 -2144
  66. package/dist/ms.post.js.map +0 -1
  67. package/dist/ms.post.min.js +0 -7
  68. package/dist/ms.post.min.js.map +0 -1
  69. package/dist-esm/src/BatchNotificationActions.d.ts +0 -36
  70. package/dist-esm/src/ClockSkewManager.d.ts +0 -38
  71. package/dist-esm/src/DataModels.d.ts +0 -405
  72. package/dist-esm/src/EventBatch.d.ts +0 -47
  73. package/dist-esm/src/HttpManager.d.ts +0 -88
  74. package/dist-esm/src/HttpManager.js.map +0 -1
  75. package/dist-esm/src/Index.d.ts +0 -9
  76. package/dist-esm/src/Index.js.map +0 -1
  77. package/dist-esm/src/InternalConstants.d.ts +0 -28
  78. package/dist-esm/src/KillSwitch.d.ts +0 -26
  79. package/dist-esm/src/PostChannel.d.ts +0 -101
  80. package/dist-esm/src/PostChannel.js.map +0 -1
  81. package/dist-esm/src/RetryPolicy.d.ts +0 -21
  82. package/dist-esm/src/Serializer.d.ts +0 -108
  83. package/dist-esm/src/Serializer.js.map +0 -1
  84. package/dist-esm/src/TimeoutOverrideWrapper.d.ts +0 -18
  85. package/dist-esm/src/TimeoutOverrideWrapper.js +0 -28
  86. package/dist-esm/src/TimeoutOverrideWrapper.js.map +0 -1
  87. package/dist-esm/src/typings/XDomainRequest.d.ts +0 -17
  88. package/src/BatchNotificationActions.ts +0 -44
  89. package/src/ClockSkewManager.ts +0 -127
  90. package/src/EventBatch.ts +0 -137
  91. package/src/HttpManager.ts +0 -1379
  92. package/src/Index.ts +0 -18
  93. package/src/InternalConstants.ts +0 -42
  94. package/src/KillSwitch.ts +0 -84
  95. package/src/PostChannel.ts +0 -1163
  96. package/src/RetryPolicy.ts +0 -46
  97. package/src/Serializer.ts +0 -487
  98. package/src/TimeoutOverrideWrapper.ts +0 -29
  99. package/src/typings/XDomainRequest.ts +0 -23
  100. /package/{dist-esm/src → dist-es5}/BatchNotificationActions.js.map +0 -0
  101. /package/{dist-esm/src → dist-es5}/DataModels.js.map +0 -0
  102. /package/{dist-esm/src → dist-es5}/EventBatch.js.map +0 -0
  103. /package/{dist-esm/src → dist-es5}/InternalConstants.js.map +0 -0
  104. /package/{dist-esm/src → dist-es5}/RetryPolicy.js.map +0 -0
  105. /package/{dist-esm/src → dist-es5}/typings/XDomainRequest.js.map +0 -0
package/src/Index.ts DELETED
@@ -1,18 +0,0 @@
1
- /**
2
- * @name Index.ts
3
- * @author Abhilash Panwar (abpanwar)
4
- * @copyright Microsoft 2018
5
- * File to export public classes.
6
- */
7
-
8
- import PostChannel from "./PostChannel";
9
- import {
10
- IChannelConfiguration, IXHROverride, BE_PROFILE, NRT_PROFILE, RT_PROFILE, IPostChannel,
11
- SendPOSTFunction, IPayloadData, PayloadPreprocessorFunction, PayloadListenerFunction,
12
- } from "./DataModels";
13
-
14
- export {
15
- PostChannel, IChannelConfiguration,
16
- BE_PROFILE, NRT_PROFILE, RT_PROFILE, IXHROverride, IPostChannel,
17
- SendPOSTFunction, IPayloadData, PayloadPreprocessorFunction, PayloadListenerFunction,
18
- };
@@ -1,42 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5
- // Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!
6
- // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7
-
8
- // Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)
9
- // as when using "short" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.
10
-
11
- export const STR_EMPTY = "";
12
- export const STR_POST_METHOD = "POST";
13
- export const STR_DISABLED_PROPERTY_NAME: string = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
14
-
15
- export const STR_DROPPED = "drop";
16
- export const STR_SENDING = "send";
17
- export const STR_REQUEUE = "requeue";
18
- export const STR_RESPONSE_FAIL = "rspFail";
19
- export const STR_OTHER = "oth";
20
-
21
- export const DEFAULT_CACHE_CONTROL = "no-cache, no-store";
22
- export const DEFAULT_CONTENT_TYPE = "application/x-json-stream";
23
- export const STR_CACHE_CONTROL = "cache-control";
24
- export const STR_CONTENT_TYPE_HEADER = "content-type";
25
- export const STR_KILL_TOKENS_HEADER = "kill-tokens";
26
- export const STR_KILL_DURATION_HEADER = "kill-duration";
27
- export const STR_KILL_DURATION_SECONDS_HEADER = "kill-duration-seconds";
28
- export const STR_TIME_DELTA_HEADER = "time-delta-millis";
29
- export const STR_CLIENT_VERSION = "client-version";
30
- export const STR_CLIENT_ID = "client-id";
31
- export const STR_TIME_DELTA_TO_APPLY = "time-delta-to-apply-millis";
32
- export const STR_UPLOAD_TIME = "upload-time";
33
- export const STR_API_KEY = "apikey";
34
- export const STR_MSA_DEVICE_TICKET = "AuthMsaDeviceTicket";
35
- export const STR_AUTH_XTOKEN = "AuthXToken";
36
- export const STR_SDK_VERSION = "sdk-version";
37
- export const STR_NO_RESPONSE_BODY = "NoResponseBody";
38
-
39
- export const STR_MSFPC = "msfpc";
40
-
41
- export const STR_TRACE = "trace";
42
- export const STR_USER = "user";
package/src/KillSwitch.ts DELETED
@@ -1,84 +0,0 @@
1
- /**
2
- * KillSwitch.ts
3
- * @author Abhilash Panwar (abpanwar)
4
- * @copyright Microsoft 2018
5
- */
6
-
7
- import dynamicProto from "@microsoft/dynamicproto-js";
8
- import { arrForEach, dateNow, strTrim } from "@microsoft/1ds-core-js";
9
-
10
- const SecToMsMultiplier = 1000;
11
-
12
- /**
13
- * Class to stop certain tenants sending events.
14
- */
15
- export default class KillSwitch {
16
-
17
- constructor() {
18
- let _killedTokenDictionary: { [token: string]: number } = {};
19
-
20
- function _normalizeTenants(values: string[]) {
21
- let result: string[] = [];
22
- if (values) {
23
- arrForEach(values, (value) => {
24
- result.push(strTrim(value));
25
- });
26
- }
27
-
28
- return result;
29
- }
30
-
31
- dynamicProto(KillSwitch, this, (_self) => {
32
- _self.setKillSwitchTenants = (killTokens: string, killDuration: string): string[] => {
33
- if (killTokens && killDuration) {
34
- try {
35
- let killedTokens: string[] = _normalizeTenants(killTokens.split(","));
36
- if (killDuration === "this-request-only") {
37
- return killedTokens;
38
- }
39
- const durationMs = parseInt(killDuration, 10) * SecToMsMultiplier;
40
- for (let i = 0; i < killedTokens.length; ++i) {
41
- _killedTokenDictionary[killedTokens[i]] = dateNow() + durationMs;
42
- }
43
- } catch (ex) {
44
- return [];
45
- }
46
- }
47
- return [];
48
- };
49
-
50
- _self.isTenantKilled = (tenantToken: string): boolean => {
51
- let killDictionary = _killedTokenDictionary;
52
- let name = strTrim(tenantToken);
53
- if (killDictionary[name] !== undefined && killDictionary[name] > dateNow()) {
54
- return true;
55
- }
56
- delete killDictionary[name];
57
- return false;
58
- };
59
- });
60
- }
61
-
62
- /**
63
- * Set the tenants that are to be killed along with the duration. If the duration is
64
- * a special value identifying that the tokens are too be killed for only this request, then
65
- * a array of tokens is returned.
66
- * @param killedTokens - Tokens that are too be marked to be killed.
67
- * @param killDuration - The duration for which the tokens are to be killed.
68
- * @returns The tokens that are killed only for this given request.
69
- */
70
- public setKillSwitchTenants(killTokens: string, killDuration: string): string[] {
71
- // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging
72
- return [];
73
- }
74
-
75
- /**
76
- * Determing if the given tenant token has been killed for the moment.
77
- * @param tenantToken - The token to be checked.
78
- * @returns True if token has been killed, false otherwise.
79
- */
80
- public isTenantKilled(tenantToken: string): boolean {
81
- // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging
82
- return false;
83
- }
84
- }