@microsoft/applicationinsights-osplugin-js 3.1.3-nightly3.2404-12

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/README.md +81 -0
  2. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.cjs.js +3487 -0
  3. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.cjs.js.map +1 -0
  4. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.cjs.min.js +6 -0
  5. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.cjs.min.js.map +1 -0
  6. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.gbl.js +3510 -0
  7. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.gbl.js.map +1 -0
  8. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.gbl.min.js +6 -0
  9. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.gbl.min.js.map +1 -0
  10. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.integrity.json +66 -0
  11. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.js +3514 -0
  12. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.js.map +1 -0
  13. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.min.js +6 -0
  14. package/browser/es5/ai.osplugin.3.1.3-nightly3.2404-12.min.js.map +1 -0
  15. package/browser/es5/ai.osplugin.3.cjs.js +3487 -0
  16. package/browser/es5/ai.osplugin.3.cjs.js.map +1 -0
  17. package/browser/es5/ai.osplugin.3.cjs.min.js +6 -0
  18. package/browser/es5/ai.osplugin.3.cjs.min.js.map +1 -0
  19. package/browser/es5/ai.osplugin.3.gbl.js +3510 -0
  20. package/browser/es5/ai.osplugin.3.gbl.js.map +1 -0
  21. package/browser/es5/ai.osplugin.3.gbl.min.js +6 -0
  22. package/browser/es5/ai.osplugin.3.gbl.min.js.map +1 -0
  23. package/browser/es5/ai.osplugin.3.integrity.json +66 -0
  24. package/browser/es5/ai.osplugin.3.js +3514 -0
  25. package/browser/es5/ai.osplugin.3.js.map +1 -0
  26. package/browser/es5/ai.osplugin.3.min.js +6 -0
  27. package/browser/es5/ai.osplugin.3.min.js.map +1 -0
  28. package/dist/es5/applicationinsights-osplugin-js.js +3492 -0
  29. package/dist/es5/applicationinsights-osplugin-js.js.map +1 -0
  30. package/dist/es5/applicationinsights-osplugin-js.min.js +6 -0
  31. package/dist/es5/applicationinsights-osplugin-js.min.js.map +1 -0
  32. package/dist-es5/DataModels.js +12 -0
  33. package/dist-es5/DataModels.js.map +1 -0
  34. package/dist-es5/OsPlugin.js +221 -0
  35. package/dist-es5/OsPlugin.js.map +1 -0
  36. package/dist-es5/__DynamicConstants.js +17 -0
  37. package/dist-es5/__DynamicConstants.js.map +1 -0
  38. package/dist-es5/applicationinsights-osplugin-js.js +9 -0
  39. package/dist-es5/applicationinsights-osplugin-js.js.map +1 -0
  40. package/package.json +59 -0
  41. package/tsconfig.json +28 -0
  42. package/types/applicationinsights-osplugin-js.d.ts +67 -0
  43. package/types/applicationinsights-osplugin-js.namespaced.d.ts +2491 -0
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Application Insights JavaScript SDK - OS Plugin, 3.1.3-nightly3.2404-12
3
+ * Copyright (c) Microsoft and contributors. All rights reserved.
4
+ */
5
+ /**
6
+ * DataModels.ts
7
+ * @author Siyu Niu (siyuniu)
8
+ * @copyright Microsoft 2024
9
+ * File containing the interfaces for OS Plugin SDK.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=DataModels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataModels.js.map","sources":["DataModels.js"],"sourcesContent":["/**\r\n* DataModels.ts\r\n* @author Siyu Niu (siyuniu)\r\n* @copyright Microsoft 2024\r\n* File containing the interfaces for OS Plugin SDK.\r\n*/\r\nexport {};\r\n//# sourceMappingURL=DataModels.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -0,0 +1,221 @@
1
+ /*
2
+ * Application Insights JavaScript SDK - OS Plugin, 3.1.3-nightly3.2404-12
3
+ * Copyright (c) Microsoft and contributors. All rights reserved.
4
+ */
5
+ import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
6
+ /**
7
+ * OsPlugin.ts
8
+ * @author Siyu Niu (siyuniu)
9
+ * @copyright Microsoft 2024
10
+ */
11
+ import dynamicProto from "@microsoft/dynamicproto-js";
12
+ import { Extensions, utlCanUseSessionStorage, utlGetSessionStorage, utlSetSessionStorage } from "@microsoft/applicationinsights-common";
13
+ import { BaseTelemetryPlugin, _throwInternal, addPageHideEventListener, addPageUnloadEventListener, arrForEach, createProcessTelemetryContext, createUniqueNamespace, getSetValue, mergeEvtNamespace, onConfigChange, removePageHideEventListener, removePageUnloadEventListener, setValue } from "@microsoft/applicationinsights-core-js";
14
+ import { doAwaitResponse } from "@nevware21/ts-async";
15
+ import { isString, objDeepFreeze, scheduleTimeout } from "@nevware21/ts-utils";
16
+ import { _DYN_MERGE_OS_NAME_VERSIO0, _DYN_PLATFORM, _DYN_PLATFORM_VERSION } from "./__DynamicConstants";
17
+ var defaultMaxTimeout = 200;
18
+ var strExt = "ext";
19
+ var defaultOSConfig = objDeepFreeze({
20
+ maxTimeout: defaultMaxTimeout,
21
+ mergeOsNameVersion: undefined
22
+ });
23
+ var OsPlugin = /** @class */ (function (_super) {
24
+ __extends(OsPlugin, _super);
25
+ function OsPlugin() {
26
+ var _this = _super.call(this) || this;
27
+ _this.identifier = "OsPlugin";
28
+ _this.priority = 195;
29
+ _this.version = '3.1.3-nightly3.2404-12';
30
+ var _core;
31
+ var _ocConfig;
32
+ var _getOSInProgress;
33
+ var _getOSTimeout;
34
+ var _maxTimeout;
35
+ var _platformVersionResponse;
36
+ var _retrieveFullVersion;
37
+ var _mergeOsNameVersion;
38
+ var _eventQueue;
39
+ var _evtNamespace;
40
+ var _excludePageUnloadEvents;
41
+ var _os;
42
+ var _osVer;
43
+ var _firstAttempt;
44
+ dynamicProto(OsPlugin, _this, function (_self, _base) {
45
+ _initDefaults();
46
+ _self.initialize = function (coreConfig, core, extensions) {
47
+ var _self = _this;
48
+ _core = core;
49
+ _super.prototype.initialize.call(_this, coreConfig, core, extensions);
50
+ var identifier = _self.identifier;
51
+ _evtNamespace = mergeEvtNamespace(createUniqueNamespace(identifier), core.evtNamespace && core.evtNamespace());
52
+ if (utlCanUseSessionStorage) {
53
+ try {
54
+ _platformVersionResponse = JSON.parse(utlGetSessionStorage(core.logger, "ai_osplugin"));
55
+ }
56
+ catch (error) {
57
+ // do nothing
58
+ }
59
+ }
60
+ if (_platformVersionResponse) {
61
+ _retrieveFullVersion = true;
62
+ _osVer = parseInt(_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */]);
63
+ _os = _platformVersionResponse[_DYN_PLATFORM /* @min:%2eplatform */];
64
+ }
65
+ _self._addHook(onConfigChange(coreConfig, function (details) {
66
+ var coreConfig = details.cfg;
67
+ var ctx = createProcessTelemetryContext(null, coreConfig, core);
68
+ _ocConfig = ctx.getExtCfg(identifier, defaultOSConfig);
69
+ _maxTimeout = _ocConfig.maxTimeout;
70
+ if (_ocConfig[_DYN_MERGE_OS_NAME_VERSIO0 /* @min:%2emergeOsNameVersion */] !== undefined) {
71
+ _mergeOsNameVersion = _ocConfig[_DYN_MERGE_OS_NAME_VERSIO0 /* @min:%2emergeOsNameVersion */];
72
+ }
73
+ else if (core.getPlugin("Sender").plugin) {
74
+ _mergeOsNameVersion = true;
75
+ }
76
+ else {
77
+ _mergeOsNameVersion = false;
78
+ }
79
+ var excludePageUnloadEvents = coreConfig.disablePageUnloadEvents || [];
80
+ if (_excludePageUnloadEvents && _excludePageUnloadEvents !== excludePageUnloadEvents) {
81
+ removePageUnloadEventListener(null, _evtNamespace);
82
+ removePageHideEventListener(null, _evtNamespace);
83
+ _excludePageUnloadEvents = null;
84
+ }
85
+ if (!_excludePageUnloadEvents) {
86
+ // If page is closed release queue
87
+ addPageUnloadEventListener(_doUnload, excludePageUnloadEvents, _evtNamespace);
88
+ addPageHideEventListener(_doUnload, excludePageUnloadEvents, _evtNamespace);
89
+ }
90
+ _excludePageUnloadEvents = excludePageUnloadEvents;
91
+ }));
92
+ function _doUnload() {
93
+ _releaseEventQueue();
94
+ }
95
+ };
96
+ _self.processTelemetry = function (event, itemCtx) {
97
+ itemCtx = _self._getTelCtx(itemCtx);
98
+ if (!_retrieveFullVersion && !_getOSInProgress && _firstAttempt) {
99
+ // Start Requesting OS version process
100
+ _getOSInProgress = true;
101
+ startRetrieveOsVersion();
102
+ _firstAttempt = false;
103
+ }
104
+ if (_getOSInProgress) {
105
+ _eventQueue.push({
106
+ ctx: itemCtx,
107
+ item: event
108
+ });
109
+ }
110
+ else {
111
+ updateTeleItemWithOs(event);
112
+ _self.processNext(event, itemCtx);
113
+ }
114
+ };
115
+ _self._doTeardown = function (unloadCtx, unloadState) {
116
+ _completeOsRetrieve();
117
+ removePageUnloadEventListener(null, _evtNamespace);
118
+ removePageHideEventListener(null, _evtNamespace);
119
+ // Just register to remove all events associated with this namespace
120
+ _initDefaults();
121
+ };
122
+ /**
123
+ * Wait for the response from the browser for the OS version and store info in the session storage
124
+ */
125
+ function startRetrieveOsVersion() {
126
+ // Timeout request if it takes more than 5 seconds (by default)
127
+ var _a;
128
+ _getOSTimeout = scheduleTimeout(function () {
129
+ _completeOsRetrieve();
130
+ }, _maxTimeout);
131
+ if (navigator.userAgent) {
132
+ var getHighEntropyValues = (_a = navigator.userAgentData) === null || _a === void 0 ? void 0 : _a.getHighEntropyValues;
133
+ if (getHighEntropyValues) {
134
+ doAwaitResponse(navigator.userAgentData.getHighEntropyValues(["platformVersion"]), function (response) {
135
+ if (!response.rejected) {
136
+ _platformVersionResponse = response.value;
137
+ _retrieveFullVersion = true;
138
+ if (_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */] && _platformVersionResponse[_DYN_PLATFORM /* @min:%2eplatform */]) {
139
+ _os = _platformVersionResponse[_DYN_PLATFORM /* @min:%2eplatform */];
140
+ _osVer = parseInt(_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */]);
141
+ if (_os === "Windows") {
142
+ if (_osVer == 0) {
143
+ _osVer = 8;
144
+ }
145
+ else if (_osVer < 13) {
146
+ _osVer = 10;
147
+ }
148
+ else {
149
+ _osVer = 11;
150
+ }
151
+ }
152
+ utlSetSessionStorage(_core.logger, "ai_osplugin", JSON.stringify({ platform: _os, platformVersion: _osVer }));
153
+ }
154
+ }
155
+ else {
156
+ _throwInternal(_core.logger, 1 /* eLoggingSeverity.CRITICAL */, 73 /* _eInternalMessageId.PluginException */, "Could not retrieve operating system: " + response.reason);
157
+ }
158
+ _completeOsRetrieve();
159
+ });
160
+ }
161
+ }
162
+ }
163
+ function updateTeleItemWithOs(event) {
164
+ if (_retrieveFullVersion) {
165
+ var extOS = getSetValue(getSetValue(event, strExt), Extensions.OSExt);
166
+ if (_mergeOsNameVersion) {
167
+ setValue(extOS, "osVer", _os + _osVer, isString);
168
+ }
169
+ else {
170
+ setValue(extOS, "osVer", _osVer);
171
+ setValue(extOS, "os", _os, isString);
172
+ }
173
+ }
174
+ }
175
+ /**
176
+ * Complete retrieving operating system info process, cleanup and release the event queue
177
+ */
178
+ function _completeOsRetrieve() {
179
+ if (_getOSTimeout) {
180
+ _getOSTimeout.cancel();
181
+ }
182
+ _getOSInProgress = false;
183
+ _releaseEventQueue();
184
+ }
185
+ /**
186
+ * Release internal event queue
187
+ */
188
+ function _releaseEventQueue() {
189
+ arrForEach(_eventQueue, function (evt) {
190
+ updateTeleItemWithOs(evt.item);
191
+ _self.processNext(evt.item, evt.ctx);
192
+ });
193
+ _eventQueue = [];
194
+ }
195
+ function _initDefaults() {
196
+ _core = null;
197
+ _ocConfig = null;
198
+ _getOSInProgress = false;
199
+ _getOSTimeout = null;
200
+ _maxTimeout = null;
201
+ _retrieveFullVersion = false;
202
+ _eventQueue = [];
203
+ _firstAttempt = true;
204
+ }
205
+ // Special internal method to allow the DebugPlugin to hook embedded objects
206
+ _self["_getDbgPlgTargets"] = function () {
207
+ return [_platformVersionResponse, _eventQueue, _getOSInProgress];
208
+ };
209
+ });
210
+ return _this;
211
+ }
212
+ // Removed Stub for OsPlugin.prototype.initialize.
213
+ // Removed Stub for OsPlugin.prototype.processTelemetry.
214
+ // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
215
+ // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
216
+ OsPlugin.__ieDyn=1;
217
+
218
+ return OsPlugin;
219
+ }(BaseTelemetryPlugin));
220
+ export { OsPlugin };
221
+ //# sourceMappingURL=OsPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OsPlugin.js.map","sources":["OsPlugin.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\n/**\r\n* OsPlugin.ts\r\n* @author Siyu Niu (siyuniu)\r\n* @copyright Microsoft 2024\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { Extensions, utlCanUseSessionStorage, utlGetSessionStorage, utlSetSessionStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, _throwInternal, addPageHideEventListener, addPageUnloadEventListener, arrForEach, createProcessTelemetryContext, createUniqueNamespace, getSetValue, mergeEvtNamespace, onConfigChange, removePageHideEventListener, removePageUnloadEventListener, setValue } from \"@microsoft/applicationinsights-core-js\";\r\nimport { doAwaitResponse } from \"@nevware21/ts-async\";\r\nimport { isString, objDeepFreeze, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { _DYN_MERGE_OS_NAME_VERSIO0, _DYN_PLATFORM, _DYN_PLATFORM_VERSION } from \"./__DynamicConstants\";\r\nvar defaultMaxTimeout = 200;\r\nvar strExt = \"ext\";\r\nvar defaultOSConfig = objDeepFreeze({\r\n maxTimeout: defaultMaxTimeout,\r\n mergeOsNameVersion: undefined\r\n});\r\nvar OsPlugin = /** @class */ (function (_super) {\r\n __extends(OsPlugin, _super);\r\n function OsPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"OsPlugin\";\r\n _this.priority = 195;\r\n _this.version = '3.1.3-nightly3.2404-12';\r\n var _core;\r\n var _ocConfig;\r\n var _getOSInProgress;\r\n var _getOSTimeout;\r\n var _maxTimeout;\r\n var _platformVersionResponse;\r\n var _retrieveFullVersion;\r\n var _mergeOsNameVersion;\r\n var _eventQueue;\r\n var _evtNamespace;\r\n var _excludePageUnloadEvents;\r\n var _os;\r\n var _osVer;\r\n var _firstAttempt;\r\n dynamicProto(OsPlugin, _this, function (_self, _base) {\r\n _initDefaults();\r\n _self.initialize = function (coreConfig, core, extensions) {\r\n var _self = _this;\r\n _core = core;\r\n _super.prototype.initialize.call(_this, coreConfig, core, extensions);\r\n var identifier = _self.identifier;\r\n _evtNamespace = mergeEvtNamespace(createUniqueNamespace(identifier), core.evtNamespace && core.evtNamespace());\r\n if (utlCanUseSessionStorage) {\r\n try {\r\n _platformVersionResponse = JSON.parse(utlGetSessionStorage(core.logger, \"ai_osplugin\"));\r\n }\r\n catch (error) {\r\n // do nothing\r\n }\r\n }\r\n if (_platformVersionResponse) {\r\n _retrieveFullVersion = true;\r\n _osVer = parseInt(_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */]);\r\n _os = _platformVersionResponse[_DYN_PLATFORM /* @min:%2eplatform */];\r\n }\r\n _self._addHook(onConfigChange(coreConfig, function (details) {\r\n var coreConfig = details.cfg;\r\n var ctx = createProcessTelemetryContext(null, coreConfig, core);\r\n _ocConfig = ctx.getExtCfg(identifier, defaultOSConfig);\r\n _maxTimeout = _ocConfig.maxTimeout;\r\n if (_ocConfig[_DYN_MERGE_OS_NAME_VERSIO0 /* @min:%2emergeOsNameVersion */] !== undefined) {\r\n _mergeOsNameVersion = _ocConfig[_DYN_MERGE_OS_NAME_VERSIO0 /* @min:%2emergeOsNameVersion */];\r\n }\r\n else if (core.getPlugin(\"Sender\").plugin) {\r\n _mergeOsNameVersion = true;\r\n }\r\n else {\r\n _mergeOsNameVersion = false;\r\n }\r\n var excludePageUnloadEvents = coreConfig.disablePageUnloadEvents || [];\r\n if (_excludePageUnloadEvents && _excludePageUnloadEvents !== excludePageUnloadEvents) {\r\n removePageUnloadEventListener(null, _evtNamespace);\r\n removePageHideEventListener(null, _evtNamespace);\r\n _excludePageUnloadEvents = null;\r\n }\r\n if (!_excludePageUnloadEvents) {\r\n // If page is closed release queue\r\n addPageUnloadEventListener(_doUnload, excludePageUnloadEvents, _evtNamespace);\r\n addPageHideEventListener(_doUnload, excludePageUnloadEvents, _evtNamespace);\r\n }\r\n _excludePageUnloadEvents = excludePageUnloadEvents;\r\n }));\r\n function _doUnload() {\r\n _releaseEventQueue();\r\n }\r\n };\r\n _self.processTelemetry = function (event, itemCtx) {\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n if (!_retrieveFullVersion && !_getOSInProgress && _firstAttempt) {\r\n // Start Requesting OS version process\r\n _getOSInProgress = true;\r\n startRetrieveOsVersion();\r\n _firstAttempt = false;\r\n }\r\n if (_getOSInProgress) {\r\n _eventQueue.push({\r\n ctx: itemCtx,\r\n item: event\r\n });\r\n }\r\n else {\r\n updateTeleItemWithOs(event);\r\n _self.processNext(event, itemCtx);\r\n }\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n _completeOsRetrieve();\r\n removePageUnloadEventListener(null, _evtNamespace);\r\n removePageHideEventListener(null, _evtNamespace);\r\n // Just register to remove all events associated with this namespace\r\n _initDefaults();\r\n };\r\n /**\r\n * Wait for the response from the browser for the OS version and store info in the session storage\r\n */\r\n function startRetrieveOsVersion() {\r\n // Timeout request if it takes more than 5 seconds (by default)\r\n var _a;\r\n _getOSTimeout = scheduleTimeout(function () {\r\n _completeOsRetrieve();\r\n }, _maxTimeout);\r\n if (navigator.userAgent) {\r\n var getHighEntropyValues = (_a = navigator.userAgentData) === null || _a === void 0 ? void 0 : _a.getHighEntropyValues;\r\n if (getHighEntropyValues) {\r\n doAwaitResponse(navigator.userAgentData.getHighEntropyValues([\"platformVersion\"]), function (response) {\r\n if (!response.rejected) {\r\n _platformVersionResponse = response.value;\r\n _retrieveFullVersion = true;\r\n if (_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */] && _platformVersionResponse[_DYN_PLATFORM /* @min:%2eplatform */]) {\r\n _os = _platformVersionResponse[_DYN_PLATFORM /* @min:%2eplatform */];\r\n _osVer = parseInt(_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */]);\r\n if (_os === \"Windows\") {\r\n if (_osVer == 0) {\r\n _osVer = 8;\r\n }\r\n else if (_osVer < 13) {\r\n _osVer = 10;\r\n }\r\n else {\r\n _osVer = 11;\r\n }\r\n }\r\n utlSetSessionStorage(_core.logger, \"ai_osplugin\", JSON.stringify({ platform: _os, platformVersion: _osVer }));\r\n }\r\n }\r\n else {\r\n _throwInternal(_core.logger, 1 /* eLoggingSeverity.CRITICAL */, 73 /* _eInternalMessageId.PluginException */, \"Could not retrieve operating system: \" + response.reason);\r\n }\r\n _completeOsRetrieve();\r\n });\r\n }\r\n }\r\n }\r\n function updateTeleItemWithOs(event) {\r\n if (_retrieveFullVersion) {\r\n var extOS = getSetValue(getSetValue(event, strExt), Extensions.OSExt);\r\n if (_mergeOsNameVersion) {\r\n setValue(extOS, \"osVer\", _os + _osVer, isString);\r\n }\r\n else {\r\n setValue(extOS, \"osVer\", _osVer);\r\n setValue(extOS, \"os\", _os, isString);\r\n }\r\n }\r\n }\r\n /**\r\n * Complete retrieving operating system info process, cleanup and release the event queue\r\n */\r\n function _completeOsRetrieve() {\r\n if (_getOSTimeout) {\r\n _getOSTimeout.cancel();\r\n }\r\n _getOSInProgress = false;\r\n _releaseEventQueue();\r\n }\r\n /**\r\n * Release internal event queue\r\n */\r\n function _releaseEventQueue() {\r\n arrForEach(_eventQueue, function (evt) {\r\n updateTeleItemWithOs(evt.item);\r\n _self.processNext(evt.item, evt.ctx);\r\n });\r\n _eventQueue = [];\r\n }\r\n function _initDefaults() {\r\n _core = null;\r\n _ocConfig = null;\r\n _getOSInProgress = false;\r\n _getOSTimeout = null;\r\n _maxTimeout = null;\r\n _retrieveFullVersion = false;\r\n _eventQueue = [];\r\n _firstAttempt = true;\r\n }\r\n // Special internal method to allow the DebugPlugin to hook embedded objects\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_platformVersionResponse, _eventQueue, _getOSInProgress];\r\n };\r\n });\r\n return _this;\r\n }\r\n OsPlugin.prototype.initialize = function (config, core, extensions) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Process the event and add it to an internal queue if handshake in process\r\n * @param event - The event to process\r\n * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances\r\n * can optionally use this to access the current core instance or define / pass additional information\r\n * to later plugins (vs appending items to the telemetry item)\r\n */\r\n OsPlugin.prototype.processTelemetry = function (event, itemCtx) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n return OsPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { OsPlugin };\r\n//# sourceMappingURL=OsPlugin.js.map"],"names":[],"mappings":";;;;AAAA,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;wDAYM,CAAC;;;;;oBACa;AACpB;AACA;AACA"}
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Application Insights JavaScript SDK - OS Plugin, 3.1.3-nightly3.2404-12
3
+ * Copyright (c) Microsoft and contributors. All rights reserved.
4
+ */
5
+
6
+
7
+ // @skip-file-minify
8
+ // ##############################################################
9
+ // AUTO GENERATED FILE: This file is Auto Generated during build.
10
+ // ##############################################################
11
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
+ // 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!!!
13
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14
+ export var _DYN_PLATFORM_VERSION = "platformVersion"; // Count: 4
15
+ export var _DYN_PLATFORM = "platform"; // Count: 3
16
+ export var _DYN_MERGE_OS_NAME_VERSIO0 = "mergeOsNameVersion"; // Count: 3
17
+ //# sourceMappingURL=__DynamicConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// 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!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_PLATFORM_VERSION = \"platformVersion\"; // Count: 4\r\nexport var _DYN_PLATFORM = \"platform\"; // Count: 3\r\nexport var _DYN_MERGE_OS_NAME_VERSIO0 = \"mergeOsNameVersion\"; // Count: 3\r\n//# sourceMappingURL=__DynamicConstants.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Application Insights JavaScript SDK - OS Plugin, 3.1.3-nightly3.2404-12
3
+ * Copyright (c) Microsoft and contributors. All rights reserved.
4
+ */
5
+
6
+
7
+ import { OsPlugin } from "./OsPlugin";
8
+ export { OsPlugin };
9
+ //# sourceMappingURL=applicationinsights-osplugin-js.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applicationinsights-osplugin-js.js.map","sources":["applicationinsights-osplugin-js.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { OsPlugin } from \"./OsPlugin\";\r\nexport { OsPlugin };\r\n//# sourceMappingURL=applicationinsights-osplugin-js.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@microsoft/applicationinsights-osplugin-js",
3
+ "version": "3.1.3-nightly3.2404-12",
4
+ "description": "Microsoft Application Insights OS Plugin",
5
+ "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
6
+ "author": "Microsoft Application Insights Team",
7
+ "main": "dist/es5/applicationinsights-osplugin-js.js",
8
+ "module": "dist-es5/applicationinsights-osplugin-js.js",
9
+ "types": "types/applicationinsights-osplugin-js.d.ts",
10
+ "sideEffects": false,
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/microsoft/ApplicationInsights-JS/tree/main/extensions/applicationinsights-osplugin-js"
14
+ },
15
+ "scripts": {
16
+ "clean": "git clean -xdf",
17
+ "build": "npm run build:esm && npm run build:browser && npm run sri && npm run dtsgen",
18
+ "build:esm": "grunt osplugin",
19
+ "build:browser": "rollup -c rollup.config.js --bundleConfigAsCjs",
20
+ "rebuild": "npm run build",
21
+ "test": "grunt osplugintests",
22
+ "mintest": "grunt osplugin-mintests",
23
+ "lint": "tslint -p tsconfig.json",
24
+ "dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights osplugin plugin\"",
25
+ "sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js",
26
+ "ai-min": "grunt osplugin-min",
27
+ "ai-restore": "grunt osplugin-restore",
28
+ "npm-pack": "npm pack",
29
+ "api-docs": "typedoc"
30
+ },
31
+ "dependencies": {
32
+ "@microsoft/applicationinsights-shims": "3.0.1",
33
+ "@microsoft/applicationinsights-common": "3.1.3-nightly3.2404-12",
34
+ "@microsoft/dynamicproto-js": "^2.0.3",
35
+ "@microsoft/applicationinsights-core-js": "3.1.3-nightly3.2404-12",
36
+ "@nevware21/ts-utils": ">= 0.11.0 < 2.x",
37
+ "@nevware21/ts-async": ">= 0.3.0 < 2.x"
38
+ },
39
+ "devDependencies": {
40
+ "@microsoft/ai-test-framework": "0.0.1",
41
+ "@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
42
+ "@microsoft/applicationinsights-rollup-es5": "1.0.2",
43
+ "@microsoft/api-extractor": "^7.40.0",
44
+ "@types/sinon": "4.3.3",
45
+ "grunt": "^1.5.3",
46
+ "sinon": "^7.3.1",
47
+ "globby": "^11.0.0",
48
+ "@rollup/plugin-commonjs": "^24.0.0",
49
+ "@rollup/plugin-node-resolve": "^15.0.1",
50
+ "@rollup/plugin-replace": "^5.0.2",
51
+ "rollup-plugin-cleanup": "^3.2.1",
52
+ "rollup": "^3.20.0",
53
+ "typescript": "^4.9.3"
54
+ },
55
+ "license": "MIT",
56
+ "publishConfig": {
57
+ "tag": "nightly3"
58
+ }
59
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "sourceMap": true,
4
+ "inlineSources": true,
5
+ "noImplicitAny": true,
6
+ "module": "es6",
7
+ "moduleResolution": "Node",
8
+ "target": "es5",
9
+ "alwaysStrict": true,
10
+ "suppressImplicitAnyIndexErrors": true,
11
+ "allowSyntheticDefaultImports": true,
12
+ "importHelpers": true,
13
+ "noEmitHelpers": true,
14
+ "skipLibCheck": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "declaration": true,
17
+ "declarationDir": "build/types",
18
+ "outDir": "dist-es5",
19
+ "rootDir": "./src",
20
+ "removeComments": false
21
+ },
22
+ "include": [
23
+ "./src/**/*.ts"
24
+ ],
25
+ "exclude": [
26
+ "./node_modules/**"
27
+ ]
28
+ }
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Microsoft Application Insights osplugin plugin, 3.1.3-nightly3.2404-12
3
+ * Copyright (c) Microsoft and contributors. All rights reserved.
4
+ *
5
+ * Microsoft Application Insights Team
6
+ * https://github.com/microsoft/ApplicationInsights-JS#readme
7
+ *
8
+ * ---------------------------------------------------------------------------
9
+ * This is a single combined (rollup) declaration file for the package,
10
+ * if you require a namespace wrapped version it is also available.
11
+ * - Namespaced version: types/applicationinsights-osplugin-js.namespaced.d.ts
12
+ * ---------------------------------------------------------------------------
13
+ */
14
+
15
+ import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
16
+ import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
17
+ import { IConfig } from '@microsoft/applicationinsights-common';
18
+ import { IConfiguration } from '@microsoft/applicationinsights-core-js';
19
+ import { IPlugin } from '@microsoft/applicationinsights-core-js';
20
+ import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
21
+ import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
22
+
23
+ /**
24
+ * DataModels.ts
25
+ * @author Siyu Niu (siyuniu)
26
+ * @copyright Microsoft 2024
27
+ * File containing the interfaces for OS Plugin SDK.
28
+ */
29
+ /**
30
+ * Interface for OS Plugin SDK config
31
+ * @maxTimeout: Maximum time to wait for the OS plugin to return the OS information
32
+ * @mergeOsNameVersion: Whether to merge the OS name and version into one field
33
+ */
34
+ export declare interface IOSPluginConfiguration {
35
+ /**
36
+ * Maximum time to wait for the OS plugin to return the OS information
37
+ * Default: 200
38
+ * @type {number}
39
+ * @memberof IOSPluginConfiguration
40
+ */
41
+ maxTimeout?: number;
42
+ /**
43
+ * Whether to merge the OS name and version into one field
44
+ * Default: undefined
45
+ * @type {boolean}
46
+ * @memberof IOSPluginConfiguration
47
+ */
48
+ mergeOsNameVersion?: boolean;
49
+ }
50
+
51
+ export declare class OsPlugin extends BaseTelemetryPlugin {
52
+ identifier: string;
53
+ priority: number;
54
+ version: string;
55
+ constructor();
56
+ initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[]): void;
57
+ /**
58
+ * Process the event and add it to an internal queue if handshake in process
59
+ * @param event - The event to process
60
+ * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
61
+ * can optionally use this to access the current core instance or define / pass additional information
62
+ * to later plugins (vs appending items to the telemetry item)
63
+ */
64
+ processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
65
+ }
66
+
67
+ export { }