@multiplayer-app/session-recorder-common 0.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.
- package/LICENSE +22 -0
- package/README.md +230 -0
- package/dist/esm/SessionRecorderHttpInstrumentationHooksNode.d.ts +35 -0
- package/dist/esm/SessionRecorderHttpInstrumentationHooksNode.d.ts.map +1 -0
- package/dist/esm/SessionRecorderHttpInstrumentationHooksNode.js +355 -0
- package/dist/esm/SessionRecorderHttpInstrumentationHooksNode.js.map +1 -0
- package/dist/esm/SessionRecorderHttpTraceExporterBrowser.d.ts +26 -0
- package/dist/esm/SessionRecorderHttpTraceExporterBrowser.d.ts.map +1 -0
- package/dist/esm/SessionRecorderHttpTraceExporterBrowser.js +116 -0
- package/dist/esm/SessionRecorderHttpTraceExporterBrowser.js.map +1 -0
- package/dist/esm/SessionRecorderIdGenerator.d.ts +15 -0
- package/dist/esm/SessionRecorderIdGenerator.d.ts.map +1 -0
- package/dist/esm/SessionRecorderIdGenerator.js +63 -0
- package/dist/esm/SessionRecorderIdGenerator.js.map +1 -0
- package/dist/esm/SessionRecorderJsonTraceSerializer.d.ts +4 -0
- package/dist/esm/SessionRecorderJsonTraceSerializer.d.ts.map +1 -0
- package/dist/esm/SessionRecorderJsonTraceSerializer.js +26 -0
- package/dist/esm/SessionRecorderJsonTraceSerializer.js.map +1 -0
- package/dist/esm/SessionRecorderTraceIdRatioBasedSampler.d.ts +11 -0
- package/dist/esm/SessionRecorderTraceIdRatioBasedSampler.d.ts.map +1 -0
- package/dist/esm/SessionRecorderTraceIdRatioBasedSampler.js +45 -0
- package/dist/esm/SessionRecorderTraceIdRatioBasedSampler.js.map +1 -0
- package/dist/esm/constants.base.d.ts +32 -0
- package/dist/esm/constants.base.d.ts.map +1 -0
- package/dist/esm/constants.base.js +32 -0
- package/dist/esm/constants.base.js.map +1 -0
- package/dist/esm/constants.browser.d.ts +2 -0
- package/dist/esm/constants.browser.d.ts.map +1 -0
- package/dist/esm/constants.browser.js +2 -0
- package/dist/esm/constants.browser.js.map +1 -0
- package/dist/esm/constants.node.d.ts +3 -0
- package/dist/esm/constants.node.d.ts.map +1 -0
- package/dist/esm/constants.node.js +5 -0
- package/dist/esm/constants.node.js.map +1 -0
- package/dist/esm/index-browser.d.ts +8 -0
- package/dist/esm/index-browser.d.ts.map +1 -0
- package/dist/esm/index-browser.js +9 -0
- package/dist/esm/index-browser.js.map +1 -0
- package/dist/esm/index-node.d.ts +8 -0
- package/dist/esm/index-node.d.ts.map +1 -0
- package/dist/esm/index-node.js +9 -0
- package/dist/esm/index-node.js.map +1 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/sdk/capture-exception.d.ts +7 -0
- package/dist/esm/sdk/capture-exception.d.ts.map +1 -0
- package/dist/esm/sdk/capture-exception.js +19 -0
- package/dist/esm/sdk/capture-exception.js.map +1 -0
- package/dist/esm/sdk/id-generator.d.ts +2 -0
- package/dist/esm/sdk/id-generator.d.ts.map +1 -0
- package/dist/esm/sdk/id-generator.js +14 -0
- package/dist/esm/sdk/id-generator.js.map +1 -0
- package/dist/esm/sdk/index.d.ts +8 -0
- package/dist/esm/sdk/index.d.ts.map +1 -0
- package/dist/esm/sdk/index.js +8 -0
- package/dist/esm/sdk/index.js.map +1 -0
- package/dist/esm/sdk/is-gzip.d.ts +2 -0
- package/dist/esm/sdk/is-gzip.d.ts.map +1 -0
- package/dist/esm/sdk/is-gzip.js +7 -0
- package/dist/esm/sdk/is-gzip.js.map +1 -0
- package/dist/esm/sdk/mask.d.ts +6 -0
- package/dist/esm/sdk/mask.d.ts.map +1 -0
- package/dist/esm/sdk/mask.js +148 -0
- package/dist/esm/sdk/mask.js.map +1 -0
- package/dist/esm/sdk/save-continuous-deb-session.d.ts +7 -0
- package/dist/esm/sdk/save-continuous-deb-session.d.ts.map +1 -0
- package/dist/esm/sdk/save-continuous-deb-session.js +21 -0
- package/dist/esm/sdk/save-continuous-deb-session.js.map +1 -0
- package/dist/esm/sdk/schemify.d.ts +4 -0
- package/dist/esm/sdk/schemify.d.ts.map +1 -0
- package/dist/esm/sdk/schemify.js +51 -0
- package/dist/esm/sdk/schemify.js.map +1 -0
- package/dist/esm/sdk/set-attribute.d.ts +90 -0
- package/dist/esm/sdk/set-attribute.d.ts.map +1 -0
- package/dist/esm/sdk/set-attribute.js +160 -0
- package/dist/esm/sdk/set-attribute.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/esm/type/index.d.ts +2 -0
- package/dist/esm/type/index.d.ts.map +1 -0
- package/dist/esm/type/index.js +2 -0
- package/dist/esm/type/index.js.map +1 -0
- package/dist/esm/type/session-type.enum.d.ts +5 -0
- package/dist/esm/type/session-type.enum.d.ts.map +1 -0
- package/dist/esm/type/session-type.enum.js +6 -0
- package/dist/esm/type/session-type.enum.js.map +1 -0
- package/dist/esnext/SessionRecorderHttpInstrumentationHooksNode.d.ts +35 -0
- package/dist/esnext/SessionRecorderHttpInstrumentationHooksNode.d.ts.map +1 -0
- package/dist/esnext/SessionRecorderHttpInstrumentationHooksNode.js +221 -0
- package/dist/esnext/SessionRecorderHttpInstrumentationHooksNode.js.map +1 -0
- package/dist/esnext/SessionRecorderHttpTraceExporterBrowser.d.ts +26 -0
- package/dist/esnext/SessionRecorderHttpTraceExporterBrowser.d.ts.map +1 -0
- package/dist/esnext/SessionRecorderHttpTraceExporterBrowser.js +82 -0
- package/dist/esnext/SessionRecorderHttpTraceExporterBrowser.js.map +1 -0
- package/dist/esnext/SessionRecorderIdGenerator.d.ts +15 -0
- package/dist/esnext/SessionRecorderIdGenerator.d.ts.map +1 -0
- package/dist/esnext/SessionRecorderIdGenerator.js +42 -0
- package/dist/esnext/SessionRecorderIdGenerator.js.map +1 -0
- package/dist/esnext/SessionRecorderJsonTraceSerializer.d.ts +4 -0
- package/dist/esnext/SessionRecorderJsonTraceSerializer.d.ts.map +1 -0
- package/dist/esnext/SessionRecorderJsonTraceSerializer.js +26 -0
- package/dist/esnext/SessionRecorderJsonTraceSerializer.js.map +1 -0
- package/dist/esnext/SessionRecorderTraceIdRatioBasedSampler.d.ts +11 -0
- package/dist/esnext/SessionRecorderTraceIdRatioBasedSampler.d.ts.map +1 -0
- package/dist/esnext/SessionRecorderTraceIdRatioBasedSampler.js +42 -0
- package/dist/esnext/SessionRecorderTraceIdRatioBasedSampler.js.map +1 -0
- package/dist/esnext/constants.base.d.ts +32 -0
- package/dist/esnext/constants.base.d.ts.map +1 -0
- package/dist/esnext/constants.base.js +32 -0
- package/dist/esnext/constants.base.js.map +1 -0
- package/dist/esnext/constants.browser.d.ts +2 -0
- package/dist/esnext/constants.browser.d.ts.map +1 -0
- package/dist/esnext/constants.browser.js +2 -0
- package/dist/esnext/constants.browser.js.map +1 -0
- package/dist/esnext/constants.node.d.ts +3 -0
- package/dist/esnext/constants.node.d.ts.map +1 -0
- package/dist/esnext/constants.node.js +5 -0
- package/dist/esnext/constants.node.js.map +1 -0
- package/dist/esnext/index-browser.d.ts +8 -0
- package/dist/esnext/index-browser.d.ts.map +1 -0
- package/dist/esnext/index-browser.js +8 -0
- package/dist/esnext/index-browser.js.map +1 -0
- package/dist/esnext/index-node.d.ts +8 -0
- package/dist/esnext/index-node.d.ts.map +1 -0
- package/dist/esnext/index-node.js +8 -0
- package/dist/esnext/index-node.js.map +1 -0
- package/dist/esnext/index.d.ts +9 -0
- package/dist/esnext/index.d.ts.map +1 -0
- package/dist/esnext/index.js +9 -0
- package/dist/esnext/index.js.map +1 -0
- package/dist/esnext/sdk/capture-exception.d.ts +7 -0
- package/dist/esnext/sdk/capture-exception.d.ts.map +1 -0
- package/dist/esnext/sdk/capture-exception.js +19 -0
- package/dist/esnext/sdk/capture-exception.js.map +1 -0
- package/dist/esnext/sdk/id-generator.d.ts +2 -0
- package/dist/esnext/sdk/id-generator.d.ts.map +1 -0
- package/dist/esnext/sdk/id-generator.js +14 -0
- package/dist/esnext/sdk/id-generator.js.map +1 -0
- package/dist/esnext/sdk/index.d.ts +8 -0
- package/dist/esnext/sdk/index.d.ts.map +1 -0
- package/dist/esnext/sdk/index.js +8 -0
- package/dist/esnext/sdk/index.js.map +1 -0
- package/dist/esnext/sdk/is-gzip.d.ts +2 -0
- package/dist/esnext/sdk/is-gzip.d.ts.map +1 -0
- package/dist/esnext/sdk/is-gzip.js +7 -0
- package/dist/esnext/sdk/is-gzip.js.map +1 -0
- package/dist/esnext/sdk/mask.d.ts +6 -0
- package/dist/esnext/sdk/mask.d.ts.map +1 -0
- package/dist/esnext/sdk/mask.js +144 -0
- package/dist/esnext/sdk/mask.js.map +1 -0
- package/dist/esnext/sdk/save-continuous-deb-session.d.ts +7 -0
- package/dist/esnext/sdk/save-continuous-deb-session.d.ts.map +1 -0
- package/dist/esnext/sdk/save-continuous-deb-session.js +21 -0
- package/dist/esnext/sdk/save-continuous-deb-session.js.map +1 -0
- package/dist/esnext/sdk/schemify.d.ts +4 -0
- package/dist/esnext/sdk/schemify.d.ts.map +1 -0
- package/dist/esnext/sdk/schemify.js +49 -0
- package/dist/esnext/sdk/schemify.js.map +1 -0
- package/dist/esnext/sdk/set-attribute.d.ts +90 -0
- package/dist/esnext/sdk/set-attribute.d.ts.map +1 -0
- package/dist/esnext/sdk/set-attribute.js +151 -0
- package/dist/esnext/sdk/set-attribute.js.map +1 -0
- package/dist/esnext/tsconfig.esnext.tsbuildinfo +1 -0
- package/dist/esnext/type/index.d.ts +2 -0
- package/dist/esnext/type/index.d.ts.map +1 -0
- package/dist/esnext/type/index.js +2 -0
- package/dist/esnext/type/index.js.map +1 -0
- package/dist/esnext/type/session-type.enum.d.ts +5 -0
- package/dist/esnext/type/session-type.enum.d.ts.map +1 -0
- package/dist/esnext/type/session-type.enum.js +6 -0
- package/dist/esnext/type/session-type.enum.js.map +1 -0
- package/dist/src/SessionRecorderHttpInstrumentationHooksNode.d.ts +35 -0
- package/dist/src/SessionRecorderHttpInstrumentationHooksNode.d.ts.map +1 -0
- package/dist/src/SessionRecorderHttpInstrumentationHooksNode.js +224 -0
- package/dist/src/SessionRecorderHttpInstrumentationHooksNode.js.map +1 -0
- package/dist/src/SessionRecorderHttpTraceExporterBrowser.d.ts +26 -0
- package/dist/src/SessionRecorderHttpTraceExporterBrowser.d.ts.map +1 -0
- package/dist/src/SessionRecorderHttpTraceExporterBrowser.js +86 -0
- package/dist/src/SessionRecorderHttpTraceExporterBrowser.js.map +1 -0
- package/dist/src/SessionRecorderIdGenerator.d.ts +15 -0
- package/dist/src/SessionRecorderIdGenerator.d.ts.map +1 -0
- package/dist/src/SessionRecorderIdGenerator.js +46 -0
- package/dist/src/SessionRecorderIdGenerator.js.map +1 -0
- package/dist/src/SessionRecorderJsonTraceSerializer.d.ts +4 -0
- package/dist/src/SessionRecorderJsonTraceSerializer.d.ts.map +1 -0
- package/dist/src/SessionRecorderJsonTraceSerializer.js +29 -0
- package/dist/src/SessionRecorderJsonTraceSerializer.js.map +1 -0
- package/dist/src/SessionRecorderTraceIdRatioBasedSampler.d.ts +11 -0
- package/dist/src/SessionRecorderTraceIdRatioBasedSampler.d.ts.map +1 -0
- package/dist/src/SessionRecorderTraceIdRatioBasedSampler.js +46 -0
- package/dist/src/SessionRecorderTraceIdRatioBasedSampler.js.map +1 -0
- package/dist/src/constants.base.d.ts +32 -0
- package/dist/src/constants.base.d.ts.map +1 -0
- package/dist/src/constants.base.js +35 -0
- package/dist/src/constants.base.js.map +1 -0
- package/dist/src/constants.browser.d.ts +2 -0
- package/dist/src/constants.browser.d.ts.map +1 -0
- package/dist/src/constants.browser.js +18 -0
- package/dist/src/constants.browser.js.map +1 -0
- package/dist/src/constants.node.d.ts +3 -0
- package/dist/src/constants.node.d.ts.map +1 -0
- package/dist/src/constants.node.js +22 -0
- package/dist/src/constants.node.js.map +1 -0
- package/dist/src/index-browser.d.ts +8 -0
- package/dist/src/index-browser.d.ts.map +1 -0
- package/dist/src/index-browser.js +29 -0
- package/dist/src/index-browser.js.map +1 -0
- package/dist/src/index-node.d.ts +8 -0
- package/dist/src/index-node.d.ts.map +1 -0
- package/dist/src/index-node.js +29 -0
- package/dist/src/index-node.js.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +31 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/sdk/capture-exception.d.ts +7 -0
- package/dist/src/sdk/capture-exception.d.ts.map +1 -0
- package/dist/src/sdk/capture-exception.js +23 -0
- package/dist/src/sdk/capture-exception.js.map +1 -0
- package/dist/src/sdk/id-generator.d.ts +2 -0
- package/dist/src/sdk/id-generator.d.ts.map +1 -0
- package/dist/src/sdk/id-generator.js +18 -0
- package/dist/src/sdk/id-generator.js.map +1 -0
- package/dist/src/sdk/index.d.ts +8 -0
- package/dist/src/sdk/index.d.ts.map +1 -0
- package/dist/src/sdk/index.js +29 -0
- package/dist/src/sdk/index.js.map +1 -0
- package/dist/src/sdk/is-gzip.d.ts +2 -0
- package/dist/src/sdk/is-gzip.d.ts.map +1 -0
- package/dist/src/sdk/is-gzip.js +11 -0
- package/dist/src/sdk/is-gzip.js.map +1 -0
- package/dist/src/sdk/mask.d.ts +6 -0
- package/dist/src/sdk/mask.d.ts.map +1 -0
- package/dist/src/sdk/mask.js +147 -0
- package/dist/src/sdk/mask.js.map +1 -0
- package/dist/src/sdk/save-continuous-deb-session.d.ts +7 -0
- package/dist/src/sdk/save-continuous-deb-session.d.ts.map +1 -0
- package/dist/src/sdk/save-continuous-deb-session.js +25 -0
- package/dist/src/sdk/save-continuous-deb-session.js.map +1 -0
- package/dist/src/sdk/schemify.d.ts +4 -0
- package/dist/src/sdk/schemify.d.ts.map +1 -0
- package/dist/src/sdk/schemify.js +51 -0
- package/dist/src/sdk/schemify.js.map +1 -0
- package/dist/src/sdk/set-attribute.d.ts +90 -0
- package/dist/src/sdk/set-attribute.d.ts.map +1 -0
- package/dist/src/sdk/set-attribute.js +164 -0
- package/dist/src/sdk/set-attribute.js.map +1 -0
- package/dist/src/type/index.d.ts +2 -0
- package/dist/src/type/index.d.ts.map +1 -0
- package/dist/src/type/index.js +18 -0
- package/dist/src/type/index.js.map +1 -0
- package/dist/src/type/session-type.enum.d.ts +5 -0
- package/dist/src/type/session-type.enum.d.ts.map +1 -0
- package/dist/src/type/session-type.enum.js +9 -0
- package/dist/src/type/session-type.enum.js.map +1 -0
- package/package.json +50 -0
- package/src/SessionRecorderHttpInstrumentationHooksNode.ts +362 -0
- package/src/SessionRecorderHttpTraceExporterBrowser.ts +123 -0
- package/src/SessionRecorderIdGenerator.ts +72 -0
- package/src/SessionRecorderJsonTraceSerializer.ts +43 -0
- package/src/SessionRecorderTraceIdRatioBasedSampler.ts +57 -0
- package/src/constants.base.ts +61 -0
- package/src/constants.browser.ts +1 -0
- package/src/constants.node.ts +5 -0
- package/src/index-browser.ts +7 -0
- package/src/index-node.ts +7 -0
- package/src/index.ts +8 -0
- package/src/sdk/capture-exception.ts +19 -0
- package/src/sdk/id-generator.ts +17 -0
- package/src/sdk/index.ts +7 -0
- package/src/sdk/is-gzip.ts +7 -0
- package/src/sdk/mask.ts +161 -0
- package/src/sdk/save-continuous-deb-session.ts +28 -0
- package/src/sdk/schemify.ts +58 -0
- package/src/sdk/set-attribute.ts +210 -0
- package/src/type/index.ts +1 -0
- package/src/type/session-type.enum.ts +4 -0
- package/tsconfig.base.es5.json +8 -0
- package/tsconfig.base.esm.json +7 -0
- package/tsconfig.base.esnext.json +10 -0
- package/tsconfig.base.json +35 -0
- package/tsconfig.esm.json +12 -0
- package/tsconfig.esnext.json +12 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveContinuousSession = void 0;
|
|
4
|
+
const api_1 = require("@opentelemetry/api");
|
|
5
|
+
const constants_base_1 = require("../constants.base");
|
|
6
|
+
/**
|
|
7
|
+
* @description Set auto save attribute to span
|
|
8
|
+
* @param {String} reason
|
|
9
|
+
* @returns {void}
|
|
10
|
+
*/
|
|
11
|
+
const saveContinuousSession = (reason) => {
|
|
12
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
13
|
+
if (!span) {
|
|
14
|
+
return;
|
|
15
|
+
// create span
|
|
16
|
+
}
|
|
17
|
+
span === null || span === void 0 ? void 0 : span.setAttribute(constants_base_1.ATTR_MULTIPLAYER_CONTINUOUS_SESSION_AUTO_SAVE, true);
|
|
18
|
+
if (reason === null || reason === void 0 ? void 0 : reason.length) {
|
|
19
|
+
span === null || span === void 0 ? void 0 : span.addEvent(constants_base_1.ATTR_MULTIPLAYER_CONTINUOUS_SESSION_AUTO_SAVE_REASON, {
|
|
20
|
+
reason
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.saveContinuousSession = saveContinuousSession;
|
|
25
|
+
//# sourceMappingURL=save-continuous-deb-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-continuous-deb-session.js","sourceRoot":"","sources":["../../../src/sdk/save-continuous-deb-session.ts"],"names":[],"mappings":";;;AAAA,4CAAmD;AACnD,sDAG2B;AAC3B;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CACjC,MAAe,EACjB,EAAE;IACA,MAAM,IAAI,GAAG,WAAK,CAAC,OAAO,CAAC,aAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAE5C,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAM;QACN,cAAc;IAClB,CAAC;IAED,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,CAAC,8DAA6C,EAAE,IAAI,CAAC,CAAA;IAEvE,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE,CAAC;QACjB,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAC,qEAAoD,EAAE;YACjE,MAAM;SACT,CAAC,CAAA;IACN,CAAC;AACL,CAAC,CAAA;AAjBY,QAAA,qBAAqB,yBAiBjC","sourcesContent":["import { context, trace } from '@opentelemetry/api'\nimport { \n ATTR_MULTIPLAYER_CONTINUOUS_SESSION_AUTO_SAVE,\n ATTR_MULTIPLAYER_CONTINUOUS_SESSION_AUTO_SAVE_REASON\n } from '../constants.base'\n/**\n * @description Set auto save attribute to span\n * @param {String} reason \n * @returns {void}\n */\nexport const saveContinuousSession = (\n reason?: string\n) => {\n const span = trace.getSpan(context.active())\n\n if (!span) {\n return\n // create span\n }\n\n span?.setAttribute(ATTR_MULTIPLAYER_CONTINUOUS_SESSION_AUTO_SAVE, true)\n\n if (reason?.length) {\n span?.addEvent(ATTR_MULTIPLAYER_CONTINUOUS_SESSION_AUTO_SAVE_REASON, {\n reason\n })\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemify.d.ts","sourceRoot":"","sources":["../../../src/sdk/schemify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAA;kCAuBpC,MAAM,GAAG,MAAM,GAAG,SAAS,iCAE3B,aAAa,CAAC,OAAO,KAC7B,GAAG;AAJN,wBAmCC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _toJsonSchema = require("to-json-schema");
|
|
4
|
+
// eslint-disable-next-line
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
const toJsonSchema = (_toJsonSchema === null || _toJsonSchema === void 0 ? void 0 : _toJsonSchema.default) || _toJsonSchema;
|
|
7
|
+
const defaultSchemifyOptions = {
|
|
8
|
+
strings: {
|
|
9
|
+
preProcessFnc: (value, defaultFnc) => {
|
|
10
|
+
if ((value === null || value === void 0 ? void 0 : value.length) >= 30) {
|
|
11
|
+
return defaultFnc('some_string');
|
|
12
|
+
}
|
|
13
|
+
return defaultFnc(value);
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
arrays: {
|
|
17
|
+
mode: 'first',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
exports.default = (payload, stringify = true, options = defaultSchemifyOptions) => {
|
|
21
|
+
if (!payload) {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
let payloadJson;
|
|
25
|
+
if (typeof payload === 'string') {
|
|
26
|
+
try {
|
|
27
|
+
payloadJson = JSON.parse(payload);
|
|
28
|
+
}
|
|
29
|
+
catch (_a) {
|
|
30
|
+
return payload;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (typeof payload === 'object') {
|
|
34
|
+
payloadJson = payload;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return payload;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const schema = toJsonSchema(payloadJson, options);
|
|
41
|
+
if (stringify) {
|
|
42
|
+
return JSON.stringify(schema);
|
|
43
|
+
}
|
|
44
|
+
return schema;
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
// error can happen when array has items like ['test', 'asd', '1'], type for '1' is null
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=schemify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemify.js","sourceRoot":"","sources":["../../../src/sdk/schemify.ts"],"names":[],"mappings":";;AAAA,gDAA+C;AAE/C,2BAA2B;AAC3B,aAAa;AACb,MAAM,YAAY,GAAG,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,KAAI,aAAa,CAAA;AAE5D,MAAM,sBAAsB,GAA0B;IACpD,OAAO,EAAE;QACP,aAAa,EAAE,CAAC,KAAa,EAAE,UAAe,EAAE,EAAE;YAChD,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,KAAI,EAAE,EAAE,CAAC;gBACxB,OAAO,UAAU,CAAC,aAAa,CAAC,CAAA;YAClC,CAAC;YAGD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAA;QAC1B,CAAC;KACF;IACD,MAAM,EAAE;QACN,IAAI,EAAE,OAAO;KACd;CACF,CAAA;AAED,kBAAe,CACb,OAAoC,EACpC,SAAS,GAAG,IAAI,EAChB,UAAiC,sBAAsB,EAClD,EAAE;IACP,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,CAAA;IACX,CAAC;IAED,IAAI,WAAgB,CAAA;IAEpB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,IAAI,CAAC;YACH,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACnC,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,OAAO,CAAA;QAChB,CAAC;IACH,CAAC;SAAM,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QACvC,WAAW,GAAG,OAAO,CAAA;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAEjD,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAC/B,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,wFAAwF;QACxF,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC,CAAA","sourcesContent":["import * as _toJsonSchema from 'to-json-schema'\n\n// eslint-disable-next-line\n// @ts-ignore\nconst toJsonSchema = _toJsonSchema?.default || _toJsonSchema\n\nconst defaultSchemifyOptions: _toJsonSchema.Options = {\n strings: {\n preProcessFnc: (value: string, defaultFnc: any) => {\n if (value?.length >= 30) {\n return defaultFnc('some_string')\n }\n\n\n return defaultFnc(value)\n },\n },\n arrays: {\n mode: 'first',\n },\n}\n\nexport default (\n payload: string | object | undefined,\n stringify = true,\n options: _toJsonSchema.Options = defaultSchemifyOptions,\n): any => {\n if (!payload) {\n return ''\n }\n\n let payloadJson: any\n\n if (typeof payload === 'string') {\n try {\n payloadJson = JSON.parse(payload)\n } catch {\n return payload\n }\n } else if (typeof payload === 'object') {\n payloadJson = payload\n } else {\n return payload\n }\n\n try {\n const schema = toJsonSchema(payloadJson, options)\n\n if (stringify) {\n return JSON.stringify(schema)\n }\n\n return schema\n } catch (err) {\n // error can happen when array has items like ['test', 'asd', '1'], type for '1' is null\n return ''\n }\n}\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { AttributeValue } from '@opentelemetry/api';
|
|
2
|
+
/**
|
|
3
|
+
* @description Set attribute to current span
|
|
4
|
+
* @param {string} key
|
|
5
|
+
* @param {AttributeValue} value
|
|
6
|
+
* @returns {void}
|
|
7
|
+
*/
|
|
8
|
+
export declare const setAttribute: (key: string, value: AttributeValue) => void;
|
|
9
|
+
/**
|
|
10
|
+
* @description Set request body to current span attributes
|
|
11
|
+
* @param body
|
|
12
|
+
* @param {{ mask: boolean }} options
|
|
13
|
+
* @returns {void}
|
|
14
|
+
*/
|
|
15
|
+
export declare const setHttpRequestBody: (body: any, options?: {
|
|
16
|
+
mask: boolean;
|
|
17
|
+
}) => void;
|
|
18
|
+
/**
|
|
19
|
+
* @description Set request headers to current span attributes
|
|
20
|
+
* @param body
|
|
21
|
+
* @param {{ mask: boolean }} options
|
|
22
|
+
* @returns {void}
|
|
23
|
+
*/
|
|
24
|
+
export declare const setHttpRequestHeaders: (body: any, options?: {
|
|
25
|
+
mask: boolean;
|
|
26
|
+
}) => void;
|
|
27
|
+
/**
|
|
28
|
+
* @description Set response body to current span attributes
|
|
29
|
+
* @param body
|
|
30
|
+
* @param {{ mask: boolean }} options
|
|
31
|
+
* @returns {void}
|
|
32
|
+
*/
|
|
33
|
+
export declare const setHttpResponseBody: (body: any, options?: {
|
|
34
|
+
mask: boolean;
|
|
35
|
+
}) => void;
|
|
36
|
+
/**
|
|
37
|
+
* @description Set response body to current span attributes
|
|
38
|
+
* @param body
|
|
39
|
+
* @param {{ mask: boolean }} options
|
|
40
|
+
* @returns {void}
|
|
41
|
+
*/
|
|
42
|
+
export declare const setHttpResponseHeaders: (body: any, options?: {
|
|
43
|
+
mask: boolean;
|
|
44
|
+
}) => void;
|
|
45
|
+
/**
|
|
46
|
+
* @description Set message body to current span attributes
|
|
47
|
+
* @param body
|
|
48
|
+
* @param {{ mask: boolean }} options
|
|
49
|
+
* @returns {void}
|
|
50
|
+
*/
|
|
51
|
+
export declare const setMessageBody: (body: any, options?: {
|
|
52
|
+
mask: boolean;
|
|
53
|
+
}) => void;
|
|
54
|
+
/**
|
|
55
|
+
* @description Set rpc request message to current span attributes
|
|
56
|
+
* @param body
|
|
57
|
+
* @param {{ mask: boolean }} options
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
export declare const setRpcRequestMessage: (body: any, options?: {
|
|
61
|
+
mask: boolean;
|
|
62
|
+
}) => void;
|
|
63
|
+
/**
|
|
64
|
+
* @description Set rpc response message to current span attributes
|
|
65
|
+
* @param body
|
|
66
|
+
* @param {{ mask: boolean }} options
|
|
67
|
+
* @returns {void}
|
|
68
|
+
*/
|
|
69
|
+
export declare const setRpcResponseMessage: (body: any, options?: {
|
|
70
|
+
mask: boolean;
|
|
71
|
+
}) => void;
|
|
72
|
+
/**
|
|
73
|
+
* @description Set grpc request message to current span attributes
|
|
74
|
+
* @param body
|
|
75
|
+
* @param {{ mask: boolean }} options
|
|
76
|
+
* @returns {void}
|
|
77
|
+
*/
|
|
78
|
+
export declare const setGrpcRequestMessage: (body: any, options?: {
|
|
79
|
+
mask: boolean;
|
|
80
|
+
}) => void;
|
|
81
|
+
/**
|
|
82
|
+
* @description Set grpc response message to current span attributes
|
|
83
|
+
* @param body
|
|
84
|
+
* @param {{ mask: boolean }} options
|
|
85
|
+
* @returns {void}
|
|
86
|
+
*/
|
|
87
|
+
export declare const setGrpcResponseMessage: (body: any, options?: {
|
|
88
|
+
mask: boolean;
|
|
89
|
+
}) => void;
|
|
90
|
+
//# sourceMappingURL=set-attribute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-attribute.d.ts","sourceRoot":"","sources":["../../../src/sdk/set-attribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEf,MAAM,oBAAoB,CAAA;AAc3B;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAS,MAAM,SAAS,cAAc,SAK9D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,SACvB,GAAG,YACA;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,SAU3B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,SAC1B,GAAG,YACA;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,SAU3B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,SACxB,GAAG,YACA;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,SAU3B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,SAC3B,GAAG,YACA;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,SAU3B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,SACnB,GAAG,YACA;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,SAU3B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,SACzB,GAAG,YACA;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,SAU3B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,SAC1B,GAAG,YACA;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,SAU3B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,SAC1B,GAAG,YACA;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,SAU3B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,SAC3B,GAAG,YACA;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,SAU3B,CAAA"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setGrpcResponseMessage = exports.setGrpcRequestMessage = exports.setRpcResponseMessage = exports.setRpcRequestMessage = exports.setMessageBody = exports.setHttpResponseHeaders = exports.setHttpResponseBody = exports.setHttpRequestHeaders = exports.setHttpRequestBody = exports.setAttribute = void 0;
|
|
4
|
+
const api_1 = require("@opentelemetry/api");
|
|
5
|
+
const constants_base_1 = require("../constants.base");
|
|
6
|
+
const mask_1 = require("./mask");
|
|
7
|
+
/**
|
|
8
|
+
* @description Set attribute to current span
|
|
9
|
+
* @param {string} key
|
|
10
|
+
* @param {AttributeValue} value
|
|
11
|
+
* @returns {void}
|
|
12
|
+
*/
|
|
13
|
+
const setAttribute = (key, value) => {
|
|
14
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
15
|
+
if (!span)
|
|
16
|
+
return;
|
|
17
|
+
span.setAttribute(key, value);
|
|
18
|
+
};
|
|
19
|
+
exports.setAttribute = setAttribute;
|
|
20
|
+
/**
|
|
21
|
+
* @description Set request body to current span attributes
|
|
22
|
+
* @param body
|
|
23
|
+
* @param {{ mask: boolean }} options
|
|
24
|
+
* @returns {void}
|
|
25
|
+
*/
|
|
26
|
+
const setHttpRequestBody = (body, options = { mask: true }) => {
|
|
27
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
28
|
+
if (!span)
|
|
29
|
+
return;
|
|
30
|
+
if (options === null || options === void 0 ? void 0 : options.mask) {
|
|
31
|
+
body = (0, mask_1.default)(mask_1.sensitiveFields)(body, span);
|
|
32
|
+
}
|
|
33
|
+
span.setAttribute(constants_base_1.ATTR_MULTIPLAYER_HTTP_REQUEST_BODY, body);
|
|
34
|
+
};
|
|
35
|
+
exports.setHttpRequestBody = setHttpRequestBody;
|
|
36
|
+
/**
|
|
37
|
+
* @description Set request headers to current span attributes
|
|
38
|
+
* @param body
|
|
39
|
+
* @param {{ mask: boolean }} options
|
|
40
|
+
* @returns {void}
|
|
41
|
+
*/
|
|
42
|
+
const setHttpRequestHeaders = (body, options = { mask: true }) => {
|
|
43
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
44
|
+
if (!span)
|
|
45
|
+
return;
|
|
46
|
+
if (options === null || options === void 0 ? void 0 : options.mask) {
|
|
47
|
+
body = (0, mask_1.default)(mask_1.sensitiveHeaders)(body, span);
|
|
48
|
+
}
|
|
49
|
+
span.setAttribute(constants_base_1.ATTR_MULTIPLAYER_HTTP_REQUEST_HEADERS, body);
|
|
50
|
+
};
|
|
51
|
+
exports.setHttpRequestHeaders = setHttpRequestHeaders;
|
|
52
|
+
/**
|
|
53
|
+
* @description Set response body to current span attributes
|
|
54
|
+
* @param body
|
|
55
|
+
* @param {{ mask: boolean }} options
|
|
56
|
+
* @returns {void}
|
|
57
|
+
*/
|
|
58
|
+
const setHttpResponseBody = (body, options = { mask: true }) => {
|
|
59
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
60
|
+
if (!span)
|
|
61
|
+
return;
|
|
62
|
+
if (options === null || options === void 0 ? void 0 : options.mask) {
|
|
63
|
+
body = (0, mask_1.default)(mask_1.sensitiveFields)(body, span);
|
|
64
|
+
}
|
|
65
|
+
span.setAttribute(constants_base_1.ATTR_MULTIPLAYER_HTTP_RESPONSE_BODY, body);
|
|
66
|
+
};
|
|
67
|
+
exports.setHttpResponseBody = setHttpResponseBody;
|
|
68
|
+
/**
|
|
69
|
+
* @description Set response body to current span attributes
|
|
70
|
+
* @param body
|
|
71
|
+
* @param {{ mask: boolean }} options
|
|
72
|
+
* @returns {void}
|
|
73
|
+
*/
|
|
74
|
+
const setHttpResponseHeaders = (body, options = { mask: true }) => {
|
|
75
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
76
|
+
if (!span)
|
|
77
|
+
return;
|
|
78
|
+
if (options === null || options === void 0 ? void 0 : options.mask) {
|
|
79
|
+
body = (0, mask_1.default)(mask_1.sensitiveFields)(body, span);
|
|
80
|
+
}
|
|
81
|
+
span.setAttribute(constants_base_1.ATTR_MULTIPLAYER_HTTP_RESPONSE_HEADERS, body);
|
|
82
|
+
};
|
|
83
|
+
exports.setHttpResponseHeaders = setHttpResponseHeaders;
|
|
84
|
+
/**
|
|
85
|
+
* @description Set message body to current span attributes
|
|
86
|
+
* @param body
|
|
87
|
+
* @param {{ mask: boolean }} options
|
|
88
|
+
* @returns {void}
|
|
89
|
+
*/
|
|
90
|
+
const setMessageBody = (body, options = { mask: true }) => {
|
|
91
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
92
|
+
if (!span)
|
|
93
|
+
return;
|
|
94
|
+
if (options === null || options === void 0 ? void 0 : options.mask) {
|
|
95
|
+
body = (0, mask_1.default)(mask_1.sensitiveFields)(body, span);
|
|
96
|
+
}
|
|
97
|
+
span.setAttribute(constants_base_1.ATTR_MULTIPLAYER_MESSAGING_MESSAGE_BODY, body);
|
|
98
|
+
};
|
|
99
|
+
exports.setMessageBody = setMessageBody;
|
|
100
|
+
/**
|
|
101
|
+
* @description Set rpc request message to current span attributes
|
|
102
|
+
* @param body
|
|
103
|
+
* @param {{ mask: boolean }} options
|
|
104
|
+
* @returns {void}
|
|
105
|
+
*/
|
|
106
|
+
const setRpcRequestMessage = (body, options = { mask: true }) => {
|
|
107
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
108
|
+
if (!span)
|
|
109
|
+
return;
|
|
110
|
+
if (options === null || options === void 0 ? void 0 : options.mask) {
|
|
111
|
+
body = (0, mask_1.default)(mask_1.sensitiveFields)(body, span);
|
|
112
|
+
}
|
|
113
|
+
span.setAttribute(constants_base_1.ATTR_MULTIPLAYER_RPC_REQUEST_MESSAGE, body);
|
|
114
|
+
};
|
|
115
|
+
exports.setRpcRequestMessage = setRpcRequestMessage;
|
|
116
|
+
/**
|
|
117
|
+
* @description Set rpc response message to current span attributes
|
|
118
|
+
* @param body
|
|
119
|
+
* @param {{ mask: boolean }} options
|
|
120
|
+
* @returns {void}
|
|
121
|
+
*/
|
|
122
|
+
const setRpcResponseMessage = (body, options = { mask: true }) => {
|
|
123
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
124
|
+
if (!span)
|
|
125
|
+
return;
|
|
126
|
+
if (options === null || options === void 0 ? void 0 : options.mask) {
|
|
127
|
+
body = (0, mask_1.default)(mask_1.sensitiveFields)(body, span);
|
|
128
|
+
}
|
|
129
|
+
span.setAttribute(constants_base_1.ATTR_MULTIPLAYER_RPC_RESPONSE_MESSAGE, body);
|
|
130
|
+
};
|
|
131
|
+
exports.setRpcResponseMessage = setRpcResponseMessage;
|
|
132
|
+
/**
|
|
133
|
+
* @description Set grpc request message to current span attributes
|
|
134
|
+
* @param body
|
|
135
|
+
* @param {{ mask: boolean }} options
|
|
136
|
+
* @returns {void}
|
|
137
|
+
*/
|
|
138
|
+
const setGrpcRequestMessage = (body, options = { mask: true }) => {
|
|
139
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
140
|
+
if (!span)
|
|
141
|
+
return;
|
|
142
|
+
if (options === null || options === void 0 ? void 0 : options.mask) {
|
|
143
|
+
body = (0, mask_1.default)(mask_1.sensitiveFields)(body, span);
|
|
144
|
+
}
|
|
145
|
+
span.setAttribute(constants_base_1.ATTR_MULTIPLAYER_GRPC_REQUEST_MESSAGE, body);
|
|
146
|
+
};
|
|
147
|
+
exports.setGrpcRequestMessage = setGrpcRequestMessage;
|
|
148
|
+
/**
|
|
149
|
+
* @description Set grpc response message to current span attributes
|
|
150
|
+
* @param body
|
|
151
|
+
* @param {{ mask: boolean }} options
|
|
152
|
+
* @returns {void}
|
|
153
|
+
*/
|
|
154
|
+
const setGrpcResponseMessage = (body, options = { mask: true }) => {
|
|
155
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
156
|
+
if (!span)
|
|
157
|
+
return;
|
|
158
|
+
if (options === null || options === void 0 ? void 0 : options.mask) {
|
|
159
|
+
body = (0, mask_1.default)(mask_1.sensitiveFields)(body, span);
|
|
160
|
+
}
|
|
161
|
+
span.setAttribute(constants_base_1.ATTR_MULTIPLAYER_GRPC_RESPONSE_MESSAGE, body);
|
|
162
|
+
};
|
|
163
|
+
exports.setGrpcResponseMessage = setGrpcResponseMessage;
|
|
164
|
+
//# sourceMappingURL=set-attribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-attribute.js","sourceRoot":"","sources":["../../../src/sdk/set-attribute.ts"],"names":[],"mappings":";;;AAAA,4CAI2B;AAC3B,sDAU0B;AAC1B,iCAAgE;AAEhE;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,KAAqB,EAAE,EAAE;IACjE,MAAM,IAAI,GAAG,WAAK,CAAC,OAAO,CAAC,aAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC5C,IAAI,CAAC,IAAI;QAAE,OAAM;IAEjB,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AAC/B,CAAC,CAAA;AALY,QAAA,YAAY,gBAKxB;AAED;;;;;GAKG;AACI,MAAM,kBAAkB,GAAG,CAChC,IAAS,EACT,UAA6B,EAAE,IAAI,EAAE,IAAI,EAAE,EAC3C,EAAE;IACF,MAAM,IAAI,GAAG,WAAK,CAAC,OAAO,CAAC,aAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC5C,IAAI,CAAC,IAAI;QAAE,OAAM;IAEjB,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE,CAAC;QAClB,IAAI,GAAG,IAAA,cAAI,EAAC,sBAAe,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC;IAED,IAAI,CAAC,YAAY,CAAC,mDAA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AE,EAC3C,EAAE;IACF,MAAM,IAAI,GAAG,WAAK,CAAC,OAAO,CAAC,aAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC5C,IAAI,CAAC,IAAI;QAAE,OAAM;IAEjB,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE,CAAC;QAClB,IAAI,GAAG,IAAA,cAAI,EAAC,sBAAe,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC;IAED,IAAI,CAAC,YAAY,CAAC,uDAAsC,EAAE,IAAI,CAAC,CAAA;AACjE,CAAC,CAAA;AAZY,QAAA,sBAAsB,0BAYlC","sourcesContent":["import {\n trace,\n AttributeValue,\n context\n} from '@opentelemetry/api'\nimport {\n ATTR_MULTIPLAYER_HTTP_RESPONSE_BODY,\n ATTR_MULTIPLAYER_HTTP_RESPONSE_HEADERS,\n ATTR_MULTIPLAYER_HTTP_REQUEST_BODY,\n ATTR_MULTIPLAYER_HTTP_REQUEST_HEADERS,\n ATTR_MULTIPLAYER_RPC_REQUEST_MESSAGE,\n ATTR_MULTIPLAYER_RPC_RESPONSE_MESSAGE,\n ATTR_MULTIPLAYER_GRPC_REQUEST_MESSAGE,\n ATTR_MULTIPLAYER_GRPC_RESPONSE_MESSAGE,\n ATTR_MULTIPLAYER_MESSAGING_MESSAGE_BODY\n} from '../constants.base'\nimport mask, { sensitiveFields, sensitiveHeaders } from './mask'\n\n/**\n * @description Set attribute to current span\n * @param {string} key\n * @param {AttributeValue} value\n * @returns {void}\n */\nexport const setAttribute = (key: string, value: AttributeValue) => {\n const span = trace.getSpan(context.active())\n if (!span) return\n\n span.setAttribute(key, value)\n}\n\n/**\n * @description Set request body to current span attributes\n * @param body\n * @param {{ mask: boolean }} options\n * @returns {void}\n */\nexport const setHttpRequestBody = (\n body: any,\n options: { mask: boolean } = { mask: true }\n) => {\n const span = trace.getSpan(context.active())\n if (!span) return\n\n if (options?.mask) {\n body = mask(sensitiveFields)(body, span)\n }\n\n span.setAttribute(ATTR_MULTIPLAYER_HTTP_REQUEST_BODY, body)\n}\n\n/**\n * @description Set request headers to current span attributes\n * @param body\n * @param {{ mask: boolean }} options\n * @returns {void}\n */\nexport const setHttpRequestHeaders = (\n body: any,\n options: { mask: boolean } = { mask: true }\n) => {\n const span = trace.getSpan(context.active())\n if (!span) return\n\n if (options?.mask) {\n body = mask(sensitiveHeaders)(body, span)\n }\n\n span.setAttribute(ATTR_MULTIPLAYER_HTTP_REQUEST_HEADERS, body)\n}\n\n/**\n * @description Set response body to current span attributes\n * @param body\n * @param {{ mask: boolean }} options\n * @returns {void}\n */\nexport const setHttpResponseBody = (\n body: any,\n options: { mask: boolean } = { mask: true }\n) => {\n const span = trace.getSpan(context.active())\n if (!span) return\n\n if (options?.mask) {\n body = mask(sensitiveFields)(body, span)\n }\n\n span.setAttribute(ATTR_MULTIPLAYER_HTTP_RESPONSE_BODY, body)\n}\n\n/**\n * @description Set response body to current span attributes\n * @param body\n * @param {{ mask: boolean }} options\n * @returns {void}\n */\nexport const setHttpResponseHeaders = (\n body: any,\n options: { mask: boolean } = { mask: true }\n) => {\n const span = trace.getSpan(context.active())\n if (!span) return\n\n if (options?.mask) {\n body = mask(sensitiveFields)(body, span)\n }\n\n span.setAttribute(ATTR_MULTIPLAYER_HTTP_RESPONSE_HEADERS, body)\n}\n\n/**\n * @description Set message body to current span attributes\n * @param body\n * @param {{ mask: boolean }} options\n * @returns {void}\n */\nexport const setMessageBody = (\n body: any,\n options: { mask: boolean } = { mask: true }\n) => {\n const span = trace.getSpan(context.active())\n if (!span) return\n\n if (options?.mask) {\n body = mask(sensitiveFields)(body, span)\n }\n\n span.setAttribute(ATTR_MULTIPLAYER_MESSAGING_MESSAGE_BODY, body)\n}\n\n/**\n * @description Set rpc request message to current span attributes\n * @param body\n * @param {{ mask: boolean }} options\n * @returns {void}\n */\nexport const setRpcRequestMessage = (\n body: any,\n options: { mask: boolean } = { mask: true }\n) => {\n const span = trace.getSpan(context.active())\n if (!span) return\n\n if (options?.mask) {\n body = mask(sensitiveFields)(body, span)\n }\n\n span.setAttribute(ATTR_MULTIPLAYER_RPC_REQUEST_MESSAGE, body)\n}\n\n/**\n * @description Set rpc response message to current span attributes\n * @param body\n * @param {{ mask: boolean }} options\n * @returns {void}\n */\nexport const setRpcResponseMessage = (\n body: any,\n options: { mask: boolean } = { mask: true }\n) => {\n const span = trace.getSpan(context.active())\n if (!span) return\n\n if (options?.mask) {\n body = mask(sensitiveFields)(body, span)\n }\n\n span.setAttribute(ATTR_MULTIPLAYER_RPC_RESPONSE_MESSAGE, body)\n}\n\n/**\n * @description Set grpc request message to current span attributes\n * @param body\n * @param {{ mask: boolean }} options\n * @returns {void}\n */\nexport const setGrpcRequestMessage = (\n body: any,\n options: { mask: boolean } = { mask: true }\n) => {\n const span = trace.getSpan(context.active())\n if (!span) return\n\n if (options?.mask) {\n body = mask(sensitiveFields)(body, span)\n }\n\n span.setAttribute(ATTR_MULTIPLAYER_GRPC_REQUEST_MESSAGE, body)\n}\n\n/**\n * @description Set grpc response message to current span attributes\n * @param body\n * @param {{ mask: boolean }} options\n * @returns {void}\n */\nexport const setGrpcResponseMessage = (\n body: any,\n options: { mask: boolean } = { mask: true }\n) => {\n const span = trace.getSpan(context.active())\n if (!span) return\n\n if (options?.mask) {\n body = mask(sensitiveFields)(body, span)\n }\n\n span.setAttribute(ATTR_MULTIPLAYER_GRPC_RESPONSE_MESSAGE, body)\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/type/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./session-type.enum"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/type/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC","sourcesContent":["export * from './session-type.enum'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-type.enum.d.ts","sourceRoot":"","sources":["../../../src/type/session-type.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,UAAU,eAAe;IACzB,KAAK,WAAW;CACjB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionType = void 0;
|
|
4
|
+
var SessionType;
|
|
5
|
+
(function (SessionType) {
|
|
6
|
+
SessionType["CONTINUOUS"] = "CONTINUOUS";
|
|
7
|
+
SessionType["PLAIN"] = "MANUAL";
|
|
8
|
+
})(SessionType || (exports.SessionType = SessionType = {}));
|
|
9
|
+
//# sourceMappingURL=session-type.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-type.enum.js","sourceRoot":"","sources":["../../../src/type/session-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,+BAAgB,CAAA;AAClB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB","sourcesContent":["export enum SessionType {\n CONTINUOUS = 'CONTINUOUS',\n PLAIN = 'MANUAL'\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@multiplayer-app/session-recorder-common",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Multiplayer Fullstack Session Recorder - opentelemetry",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Multiplayer Software, Inc.",
|
|
7
|
+
"url": "https://www.multiplayer.app"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"main": "dist/src/index.js",
|
|
11
|
+
"module": "dist/esm/index.js",
|
|
12
|
+
"esnext": "dist/esnext/index.js",
|
|
13
|
+
"types": "dist/src/index.d.ts",
|
|
14
|
+
"browser": {
|
|
15
|
+
"./src/index.ts": "./src/index-browser.ts",
|
|
16
|
+
"./dist/esm/index.js": "./dist/esm/index-browser.js",
|
|
17
|
+
"./dist/esnext/index.js": "./dist/esnext/index-browser.js",
|
|
18
|
+
"./dist/src/index.js": "./dist/src/index-browser.js"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18",
|
|
22
|
+
"npm": ">=8"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"multiplayer",
|
|
26
|
+
"opentelemetry",
|
|
27
|
+
"otlp"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"lint": "eslint src/**/*.ts --config ../../.eslintrc",
|
|
31
|
+
"preversion": "npm run lint",
|
|
32
|
+
"postversion:skip": "git push && git push --tags",
|
|
33
|
+
"build": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
|
34
|
+
"prepublishOnly": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@opentelemetry/api": "^1.9.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@opentelemetry/core": "^1.29.0",
|
|
41
|
+
"@opentelemetry/otlp-exporter-base": "^0.56.0",
|
|
42
|
+
"@opentelemetry/otlp-transformer": "^0.56.0",
|
|
43
|
+
"@opentelemetry/sdk-trace-base": "^1.29.0",
|
|
44
|
+
"to-json-schema": "^0.2.5"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/to-json-schema": "0.2.4",
|
|
48
|
+
"typescript": "5.8.3"
|
|
49
|
+
}
|
|
50
|
+
}
|