@opentelemetry/web-common 0.212.0 → 0.214.0

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 (121) hide show
  1. package/build/esm/DefaultIdGenerator.d.ts +1 -1
  2. package/build/esm/DefaultIdGenerator.js +1 -12
  3. package/build/esm/DefaultIdGenerator.js.map +1 -1
  4. package/build/esm/LocalStorageSessionStore.d.ts +2 -2
  5. package/build/esm/LocalStorageSessionStore.js +1 -12
  6. package/build/esm/LocalStorageSessionStore.js.map +1 -1
  7. package/build/esm/SessionLogRecordProcessor.d.ts +3 -3
  8. package/build/esm/SessionLogRecordProcessor.js +1 -12
  9. package/build/esm/SessionLogRecordProcessor.js.map +1 -1
  10. package/build/esm/SessionManager.d.ts +6 -6
  11. package/build/esm/SessionManager.js +1 -12
  12. package/build/esm/SessionManager.js.map +1 -1
  13. package/build/esm/SessionSpanProcessor.d.ts +3 -3
  14. package/build/esm/SessionSpanProcessor.js +1 -12
  15. package/build/esm/SessionSpanProcessor.js.map +1 -1
  16. package/build/esm/index.js +1 -12
  17. package/build/esm/index.js.map +1 -1
  18. package/build/esm/semconv.js +1 -12
  19. package/build/esm/semconv.js.map +1 -1
  20. package/build/esm/types/Session.js +1 -12
  21. package/build/esm/types/Session.js.map +1 -1
  22. package/build/esm/types/SessionIdGenerator.js +1 -12
  23. package/build/esm/types/SessionIdGenerator.js.map +1 -1
  24. package/build/esm/types/SessionObserver.d.ts +1 -1
  25. package/build/esm/types/SessionObserver.js +1 -12
  26. package/build/esm/types/SessionObserver.js.map +1 -1
  27. package/build/esm/types/SessionProvider.js +1 -12
  28. package/build/esm/types/SessionProvider.js.map +1 -1
  29. package/build/esm/types/SessionPublisher.d.ts +1 -1
  30. package/build/esm/types/SessionPublisher.js +1 -12
  31. package/build/esm/types/SessionPublisher.js.map +1 -1
  32. package/build/esm/types/SessionStore.d.ts +1 -1
  33. package/build/esm/types/SessionStore.js +1 -12
  34. package/build/esm/types/SessionStore.js.map +1 -1
  35. package/build/esm/utils.d.ts +7 -6
  36. package/build/esm/utils.js +1 -12
  37. package/build/esm/utils.js.map +1 -1
  38. package/build/esm/version.d.ts +1 -1
  39. package/build/esm/version.js +2 -13
  40. package/build/esm/version.js.map +1 -1
  41. package/build/esnext/DefaultIdGenerator.d.ts +1 -1
  42. package/build/esnext/DefaultIdGenerator.js +1 -12
  43. package/build/esnext/DefaultIdGenerator.js.map +1 -1
  44. package/build/esnext/LocalStorageSessionStore.d.ts +2 -2
  45. package/build/esnext/LocalStorageSessionStore.js +1 -12
  46. package/build/esnext/LocalStorageSessionStore.js.map +1 -1
  47. package/build/esnext/SessionLogRecordProcessor.d.ts +3 -3
  48. package/build/esnext/SessionLogRecordProcessor.js +1 -12
  49. package/build/esnext/SessionLogRecordProcessor.js.map +1 -1
  50. package/build/esnext/SessionManager.d.ts +6 -6
  51. package/build/esnext/SessionManager.js +1 -12
  52. package/build/esnext/SessionManager.js.map +1 -1
  53. package/build/esnext/SessionSpanProcessor.d.ts +3 -3
  54. package/build/esnext/SessionSpanProcessor.js +1 -12
  55. package/build/esnext/SessionSpanProcessor.js.map +1 -1
  56. package/build/esnext/index.js +1 -12
  57. package/build/esnext/index.js.map +1 -1
  58. package/build/esnext/semconv.js +1 -12
  59. package/build/esnext/semconv.js.map +1 -1
  60. package/build/esnext/types/Session.js +1 -12
  61. package/build/esnext/types/Session.js.map +1 -1
  62. package/build/esnext/types/SessionIdGenerator.js +1 -12
  63. package/build/esnext/types/SessionIdGenerator.js.map +1 -1
  64. package/build/esnext/types/SessionObserver.d.ts +1 -1
  65. package/build/esnext/types/SessionObserver.js +1 -12
  66. package/build/esnext/types/SessionObserver.js.map +1 -1
  67. package/build/esnext/types/SessionProvider.js +1 -12
  68. package/build/esnext/types/SessionProvider.js.map +1 -1
  69. package/build/esnext/types/SessionPublisher.d.ts +1 -1
  70. package/build/esnext/types/SessionPublisher.js +1 -12
  71. package/build/esnext/types/SessionPublisher.js.map +1 -1
  72. package/build/esnext/types/SessionStore.d.ts +1 -1
  73. package/build/esnext/types/SessionStore.js +1 -12
  74. package/build/esnext/types/SessionStore.js.map +1 -1
  75. package/build/esnext/utils.d.ts +7 -6
  76. package/build/esnext/utils.js +1 -12
  77. package/build/esnext/utils.js.map +1 -1
  78. package/build/esnext/version.d.ts +1 -1
  79. package/build/esnext/version.js +2 -13
  80. package/build/esnext/version.js.map +1 -1
  81. package/build/src/DefaultIdGenerator.d.ts +1 -1
  82. package/build/src/DefaultIdGenerator.js +1 -12
  83. package/build/src/DefaultIdGenerator.js.map +1 -1
  84. package/build/src/LocalStorageSessionStore.d.ts +2 -2
  85. package/build/src/LocalStorageSessionStore.js +1 -12
  86. package/build/src/LocalStorageSessionStore.js.map +1 -1
  87. package/build/src/SessionLogRecordProcessor.d.ts +3 -3
  88. package/build/src/SessionLogRecordProcessor.js +1 -12
  89. package/build/src/SessionLogRecordProcessor.js.map +1 -1
  90. package/build/src/SessionManager.d.ts +6 -6
  91. package/build/src/SessionManager.js +1 -12
  92. package/build/src/SessionManager.js.map +1 -1
  93. package/build/src/SessionSpanProcessor.d.ts +3 -3
  94. package/build/src/SessionSpanProcessor.js +1 -12
  95. package/build/src/SessionSpanProcessor.js.map +1 -1
  96. package/build/src/index.js +1 -12
  97. package/build/src/index.js.map +1 -1
  98. package/build/src/semconv.js +1 -12
  99. package/build/src/semconv.js.map +1 -1
  100. package/build/src/types/Session.js +1 -12
  101. package/build/src/types/Session.js.map +1 -1
  102. package/build/src/types/SessionIdGenerator.js +1 -12
  103. package/build/src/types/SessionIdGenerator.js.map +1 -1
  104. package/build/src/types/SessionObserver.d.ts +1 -1
  105. package/build/src/types/SessionObserver.js +1 -12
  106. package/build/src/types/SessionObserver.js.map +1 -1
  107. package/build/src/types/SessionProvider.js +1 -12
  108. package/build/src/types/SessionProvider.js.map +1 -1
  109. package/build/src/types/SessionPublisher.d.ts +1 -1
  110. package/build/src/types/SessionPublisher.js +1 -12
  111. package/build/src/types/SessionPublisher.js.map +1 -1
  112. package/build/src/types/SessionStore.d.ts +1 -1
  113. package/build/src/types/SessionStore.js +1 -12
  114. package/build/src/types/SessionStore.js.map +1 -1
  115. package/build/src/utils.d.ts +7 -6
  116. package/build/src/utils.js +1 -12
  117. package/build/src/utils.js.map +1 -1
  118. package/build/src/version.d.ts +1 -1
  119. package/build/src/version.js +2 -13
  120. package/build/src/version.js.map +1 -1
  121. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultIdGenerator.js","sourceRoot":"","sources":["../../src/DefaultIdGenerator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,MAAa,kBAAkB;IAC7B,iBAAiB,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;CACxC;AAFD,gDAEC;AAED,MAAM,uBAAuB,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;AAC1C,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,SAAS,UAAU;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAClC,uBAAuB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;YACjE,qDAAqD;YACrD,IAAI,uBAAuB,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;gBACpC,uBAAuB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aAClC;SACF;QACD,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,CAC9B,IAAI,EACJ,uBAAuB,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAC5C,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SessionIdGenerator } from './types/SessionIdGenerator';\n\nexport class DefaultIdGenerator implements SessionIdGenerator {\n generateSessionId = getIdGenerator(16);\n}\n\nconst SHARED_CHAR_CODES_ARRAY = Array(32);\nfunction getIdGenerator(bytes: number): () => string {\n return function generateId() {\n for (let i = 0; i < bytes * 2; i++) {\n SHARED_CHAR_CODES_ARRAY[i] = Math.floor(Math.random() * 16) + 48;\n // valid hex characters in the range 48-57 and 97-102\n if (SHARED_CHAR_CODES_ARRAY[i] >= 58) {\n SHARED_CHAR_CODES_ARRAY[i] += 39;\n }\n }\n return String.fromCharCode.apply(\n null,\n SHARED_CHAR_CODES_ARRAY.slice(0, bytes * 2)\n );\n };\n}\n"]}
1
+ {"version":3,"file":"DefaultIdGenerator.js","sourceRoot":"","sources":["../../src/DefaultIdGenerator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,MAAa,kBAAkB;IAC7B,iBAAiB,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;CACxC;AAFD,gDAEC;AAED,MAAM,uBAAuB,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;AAC1C,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,SAAS,UAAU;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAClC,uBAAuB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;YACjE,qDAAqD;YACrD,IAAI,uBAAuB,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;gBACpC,uBAAuB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aAClC;SACF;QACD,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,CAC9B,IAAI,EACJ,uBAAuB,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAC5C,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SessionIdGenerator } from './types/SessionIdGenerator';\n\nexport class DefaultIdGenerator implements SessionIdGenerator {\n generateSessionId = getIdGenerator(16);\n}\n\nconst SHARED_CHAR_CODES_ARRAY = Array(32);\nfunction getIdGenerator(bytes: number): () => string {\n return function generateId() {\n for (let i = 0; i < bytes * 2; i++) {\n SHARED_CHAR_CODES_ARRAY[i] = Math.floor(Math.random() * 16) + 48;\n // valid hex characters in the range 48-57 and 97-102\n if (SHARED_CHAR_CODES_ARRAY[i] >= 58) {\n SHARED_CHAR_CODES_ARRAY[i] += 39;\n }\n }\n return String.fromCharCode.apply(\n null,\n SHARED_CHAR_CODES_ARRAY.slice(0, bytes * 2)\n );\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { Session } from './types/Session';
2
- import { SessionStore } from './types/SessionStore';
1
+ import type { Session } from './types/Session';
2
+ import type { SessionStore } from './types/SessionStore';
3
3
  export declare class LocalStorageSessionStore implements SessionStore {
4
4
  save(session: Session): Promise<void>;
5
5
  get(): Promise<Session | null>;
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.LocalStorageSessionStore = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"LocalStorageSessionStore.js","sourceRoot":"","sources":["../../src/LocalStorageSessionStore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAEpD,MAAa,wBAAwB;IACnC,IAAI,CAAC,OAAgB;QACnB,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;YACvC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC1B;QAED,YAAY,CAAC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAEnE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,GAAG;QACD,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;YACvC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC9B;QAED,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAC9D,IAAI,WAAW,EAAE;YACf,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAY,CAAC,CAAC;SAC5D;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AAtBD,4DAsBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Session } from './types/Session';\nimport { SessionStore } from './types/SessionStore';\n\nconst SESSION_STORAGE_KEY = 'opentelemetry-session';\n\nexport class LocalStorageSessionStore implements SessionStore {\n save(session: Session): Promise<void> {\n if (typeof localStorage === 'undefined') {\n return Promise.resolve();\n }\n\n localStorage.setItem(SESSION_STORAGE_KEY, JSON.stringify(session));\n\n return Promise.resolve();\n }\n\n get(): Promise<Session | null> {\n if (typeof localStorage === 'undefined') {\n return Promise.resolve(null);\n }\n\n const sessionData = localStorage.getItem(SESSION_STORAGE_KEY);\n if (sessionData) {\n return Promise.resolve(JSON.parse(sessionData) as Session);\n }\n return Promise.resolve(null);\n }\n}\n"]}
1
+ {"version":3,"file":"LocalStorageSessionStore.js","sourceRoot":"","sources":["../../src/LocalStorageSessionStore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAEpD,MAAa,wBAAwB;IACnC,IAAI,CAAC,OAAgB;QACnB,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;YACvC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC1B;QAED,YAAY,CAAC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAEnE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,GAAG;QACD,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;YACvC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC9B;QAED,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAC9D,IAAI,WAAW,EAAE;YACf,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAY,CAAC,CAAC;SAC5D;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AAtBD,4DAsBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Session } from './types/Session';\nimport type { SessionStore } from './types/SessionStore';\n\nconst SESSION_STORAGE_KEY = 'opentelemetry-session';\n\nexport class LocalStorageSessionStore implements SessionStore {\n save(session: Session): Promise<void> {\n if (typeof localStorage === 'undefined') {\n return Promise.resolve();\n }\n\n localStorage.setItem(SESSION_STORAGE_KEY, JSON.stringify(session));\n\n return Promise.resolve();\n }\n\n get(): Promise<Session | null> {\n if (typeof localStorage === 'undefined') {\n return Promise.resolve(null);\n }\n\n const sessionData = localStorage.getItem(SESSION_STORAGE_KEY);\n if (sessionData) {\n return Promise.resolve(JSON.parse(sessionData) as Session);\n }\n return Promise.resolve(null);\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { Context } from '@opentelemetry/api';
2
- import { SdkLogRecord, LogRecordProcessor } from '@opentelemetry/sdk-logs';
3
- import { SessionProvider } from './types/SessionProvider';
1
+ import type { Context } from '@opentelemetry/api';
2
+ import type { SdkLogRecord, LogRecordProcessor } from '@opentelemetry/sdk-logs';
3
+ import type { SessionProvider } from './types/SessionProvider';
4
4
  /**
5
5
  * SessionLogRecordProcessor is a {@link SpanProcessor} adds the session.id attribute
6
6
  */
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.SessionLogRecordProcessor = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"SessionLogRecordProcessor.js","sourceRoot":"","sources":["../../src/SessionLogRecordProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,uCAA4C;AAG5C;;GAEG;AACH,MAAa,yBAAyB;IAC5B,kBAAkB,CAAkB;IAE5C,YAAY,iBAAkC;QAC5C,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,SAAuB,EAAE,QAA8B;QAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,EAAE,YAAY,EAAE,CAAC;QAC1D,IAAI,SAAS,EAAE;YACb,SAAS,CAAC,YAAY,CAAC,yBAAe,EAAE,SAAS,CAAC,CAAC;SACpD;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,KAAmB,CAAC;IAEpC;;;OAGG;IACH,KAAK,CAAC,QAAQ,KAAmB,CAAC;CACnC;AAxBD,8DAwBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Context } from '@opentelemetry/api';\nimport { SdkLogRecord, LogRecordProcessor } from '@opentelemetry/sdk-logs';\nimport { ATTR_SESSION_ID } from './semconv';\nimport { SessionProvider } from './types/SessionProvider';\n\n/**\n * SessionLogRecordProcessor is a {@link SpanProcessor} adds the session.id attribute\n */\nexport class SessionLogRecordProcessor implements LogRecordProcessor {\n private _sessionIdProvider: SessionProvider;\n\n constructor(sessionIdProvider: SessionProvider) {\n this._sessionIdProvider = sessionIdProvider;\n }\n\n onEmit(logRecord: SdkLogRecord, _context?: Context | undefined): void {\n const sessionId = this._sessionIdProvider?.getSessionId();\n if (sessionId) {\n logRecord.setAttribute(ATTR_SESSION_ID, sessionId);\n }\n }\n\n /**\n * Forces to export all finished spans\n */\n async forceFlush(): Promise<void> {}\n\n /**\n * Shuts down the processor. Called when SDK is shut down. This is an\n * opportunity for processor to do any cleanup required.\n */\n async shutdown(): Promise<void> {}\n}\n"]}
1
+ {"version":3,"file":"SessionLogRecordProcessor.js","sourceRoot":"","sources":["../../src/SessionLogRecordProcessor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,uCAA4C;AAG5C;;GAEG;AACH,MAAa,yBAAyB;IAC5B,kBAAkB,CAAkB;IAE5C,YAAY,iBAAkC;QAC5C,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,SAAuB,EAAE,QAA8B;QAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,EAAE,YAAY,EAAE,CAAC;QAC1D,IAAI,SAAS,EAAE;YACb,SAAS,CAAC,YAAY,CAAC,yBAAe,EAAE,SAAS,CAAC,CAAC;SACpD;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,KAAmB,CAAC;IAEpC;;;OAGG;IACH,KAAK,CAAC,QAAQ,KAAmB,CAAC;CACnC;AAxBD,8DAwBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '@opentelemetry/api';\nimport type { SdkLogRecord, LogRecordProcessor } from '@opentelemetry/sdk-logs';\nimport { ATTR_SESSION_ID } from './semconv';\nimport type { SessionProvider } from './types/SessionProvider';\n\n/**\n * SessionLogRecordProcessor is a {@link SpanProcessor} adds the session.id attribute\n */\nexport class SessionLogRecordProcessor implements LogRecordProcessor {\n private _sessionIdProvider: SessionProvider;\n\n constructor(sessionIdProvider: SessionProvider) {\n this._sessionIdProvider = sessionIdProvider;\n }\n\n onEmit(logRecord: SdkLogRecord, _context?: Context | undefined): void {\n const sessionId = this._sessionIdProvider?.getSessionId();\n if (sessionId) {\n logRecord.setAttribute(ATTR_SESSION_ID, sessionId);\n }\n }\n\n /**\n * Forces to export all finished spans\n */\n async forceFlush(): Promise<void> {}\n\n /**\n * Shuts down the processor. Called when SDK is shut down. This is an\n * opportunity for processor to do any cleanup required.\n */\n async shutdown(): Promise<void> {}\n}\n"]}
@@ -1,9 +1,9 @@
1
- import { SessionIdGenerator } from './types/SessionIdGenerator';
2
- import { Session } from './types/Session';
3
- import { SessionProvider } from './types/SessionProvider';
4
- import { SessionObserver } from './types/SessionObserver';
5
- import { SessionStore } from './types/SessionStore';
6
- import { SessionPublisher } from './types/SessionPublisher';
1
+ import type { SessionIdGenerator } from './types/SessionIdGenerator';
2
+ import type { Session } from './types/Session';
3
+ import type { SessionProvider } from './types/SessionProvider';
4
+ import type { SessionObserver } from './types/SessionObserver';
5
+ import type { SessionStore } from './types/SessionStore';
6
+ import type { SessionPublisher } from './types/SessionPublisher';
7
7
  export interface SessionManagerConfig {
8
8
  /** Class responsible for generating a session ID */
9
9
  sessionIdGenerator: SessionIdGenerator;
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.SessionManager = void 0;
@@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IC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SessionIdGenerator } from './types/SessionIdGenerator';\nimport { Session } from './types/Session';\nimport { SessionProvider } from './types/SessionProvider';\nimport { SessionObserver } from './types/SessionObserver';\nimport { SessionStore } from './types/SessionStore';\nimport { SessionPublisher } from './types/SessionPublisher';\n\nexport interface SessionManagerConfig {\n /** Class responsible for generating a session ID */\n sessionIdGenerator: SessionIdGenerator;\n /** Class responsible for storing session data over multiple page loads. */\n sessionStore: SessionStore;\n /** Maximum duration of a session in seconds */\n maxDuration?: number;\n /** Maximum time without a user activity after which a session should be expired, in seconds */\n inactivityTimeout?: number;\n}\n\n/**\n * SessionManager is responsible for managing the active session including starting,\n * resetting, and persisting.\n */\nexport class SessionManager implements SessionProvider, SessionPublisher {\n private _session: Session | null | undefined;\n private _idGenerator: SessionIdGenerator;\n private _store: SessionStore;\n private _observers: SessionObserver[];\n\n private _maxDuration?: number;\n private _maxDurationTimeoutId?: ReturnType<typeof setTimeout>;\n\n private _inactivityTimeout?: number;\n private _inactivityTimeoutId?: ReturnType<typeof setTimeout>;\n private _lastActivityTimestamp: number = 0;\n private _inactivityResetDelay: number = 5000; // minimum time in ms between activities before timer is reset\n\n constructor(config: SessionManagerConfig) {\n this._idGenerator = config.sessionIdGenerator;\n this._store = config.sessionStore;\n this._maxDuration = config.maxDuration;\n this._inactivityTimeout = config.inactivityTimeout;\n this._observers = [];\n }\n\n async start(): Promise<void> {\n this._session = await this._store.get();\n if (!this._session) {\n this._session = await this.startSession();\n }\n this.resetTimers();\n }\n\n addObserver(observer: SessionObserver): void {\n this._observers.push(observer);\n }\n\n getSessionId(): string | null {\n return this.getSession().id;\n }\n\n getSession(): Session {\n if (!this._session) {\n this._session = this.startSession();\n this.resetTimers();\n }\n\n if (this._inactivityTimeout) {\n if (\n Date.now() - this._lastActivityTimestamp >\n this._inactivityResetDelay\n ) {\n this.resetInactivityTimer();\n this._lastActivityTimestamp = Date.now();\n }\n }\n\n return this._session;\n }\n\n shutdown(): void {\n if (this._inactivityTimeoutId) {\n clearTimeout(this._inactivityTimeoutId);\n }\n\n if (this._maxDurationTimeoutId) {\n clearTimeout(this._maxDurationTimeoutId);\n }\n }\n\n private startSession(): Session {\n const sessionId = this._idGenerator.generateSessionId();\n\n const session: Session = {\n id: sessionId,\n startTimestamp: Date.now(),\n };\n\n // this is async call, but we don't wait for it\n void this._store.save(session);\n\n for (const observer of this._observers) {\n observer.onSessionStarted(session, this._session ?? undefined);\n }\n\n this._session = session;\n\n return session;\n }\n\n private endSession(): void {\n if (this._session) {\n for (const observer of this._observers) {\n observer.onSessionEnded(this._session);\n }\n }\n\n if (this._inactivityTimeoutId) {\n clearTimeout(this._inactivityTimeoutId);\n this._inactivityTimeoutId = undefined;\n }\n }\n\n private resetSession(): void {\n this.endSession();\n this.startSession();\n this.resetTimers();\n }\n\n private resetTimers() {\n this.resetInactivityTimer();\n this.resetMaxDurationTimer();\n }\n\n private resetInactivityTimer() {\n if (!this._inactivityTimeout) {\n return;\n }\n\n if (this._inactivityTimeoutId) {\n clearTimeout(this._inactivityTimeoutId);\n }\n\n this._inactivityTimeoutId = setTimeout(() => {\n this.resetSession();\n }, this._inactivityTimeout * 1000);\n }\n\n private resetMaxDurationTimer() {\n if (!this._maxDuration || !this._session) {\n return;\n }\n\n if (this._maxDurationTimeoutId) {\n clearTimeout(this._maxDurationTimeoutId);\n }\n\n const timeoutIn =\n this._maxDuration * 1000 - (Date.now() - this._session?.startTimestamp);\n\n this._maxDurationTimeoutId = setTimeout(() => {\n this.resetSession();\n }, time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sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SessionIdGenerator } from './types/SessionIdGenerator';\nimport type { Session } from './types/Session';\nimport type { SessionProvider } from './types/SessionProvider';\nimport type { SessionObserver } from './types/SessionObserver';\nimport type { SessionStore } from './types/SessionStore';\nimport type { SessionPublisher } from './types/SessionPublisher';\n\nexport interface SessionManagerConfig {\n /** Class responsible for generating a session ID */\n sessionIdGenerator: SessionIdGenerator;\n /** Class responsible for storing session data over multiple page loads. */\n sessionStore: SessionStore;\n /** Maximum duration of a session in seconds */\n maxDuration?: number;\n /** Maximum time without a user activity after which a session should be expired, in seconds */\n inactivityTimeout?: number;\n}\n\n/**\n * SessionManager is responsible for managing the active session including starting,\n * resetting, and persisting.\n */\nexport class SessionManager implements SessionProvider, SessionPublisher {\n private _session: Session | null | undefined;\n private _idGenerator: SessionIdGenerator;\n private _store: SessionStore;\n private _observers: SessionObserver[];\n\n private _maxDuration?: number;\n private _maxDurationTimeoutId?: ReturnType<typeof setTimeout>;\n\n private _inactivityTimeout?: number;\n private _inactivityTimeoutId?: ReturnType<typeof setTimeout>;\n private _lastActivityTimestamp: number = 0;\n private _inactivityResetDelay: number = 5000; // minimum time in ms between activities before timer is reset\n\n constructor(config: SessionManagerConfig) {\n this._idGenerator = config.sessionIdGenerator;\n this._store = config.sessionStore;\n this._maxDuration = config.maxDuration;\n this._inactivityTimeout = config.inactivityTimeout;\n this._observers = [];\n }\n\n async start(): Promise<void> {\n this._session = await this._store.get();\n if (!this._session) {\n this._session = await this.startSession();\n }\n this.resetTimers();\n }\n\n addObserver(observer: SessionObserver): void {\n this._observers.push(observer);\n }\n\n getSessionId(): string | null {\n return this.getSession().id;\n }\n\n getSession(): Session {\n if (!this._session) {\n this._session = this.startSession();\n this.resetTimers();\n }\n\n if (this._inactivityTimeout) {\n if (\n Date.now() - this._lastActivityTimestamp >\n this._inactivityResetDelay\n ) {\n this.resetInactivityTimer();\n this._lastActivityTimestamp = Date.now();\n }\n }\n\n return this._session;\n }\n\n shutdown(): void {\n if (this._inactivityTimeoutId) {\n clearTimeout(this._inactivityTimeoutId);\n }\n\n if (this._maxDurationTimeoutId) {\n clearTimeout(this._maxDurationTimeoutId);\n }\n }\n\n private startSession(): Session {\n const sessionId = this._idGenerator.generateSessionId();\n\n const session: Session = {\n id: sessionId,\n startTimestamp: Date.now(),\n };\n\n // this is async call, but we don't wait for it\n void this._store.save(session);\n\n for (const observer of this._observers) {\n observer.onSessionStarted(session, this._session ?? undefined);\n }\n\n this._session = session;\n\n return session;\n }\n\n private endSession(): void {\n if (this._session) {\n for (const observer of this._observers) {\n observer.onSessionEnded(this._session);\n }\n }\n\n if (this._inactivityTimeoutId) {\n clearTimeout(this._inactivityTimeoutId);\n this._inactivityTimeoutId = undefined;\n }\n }\n\n private resetSession(): void {\n this.endSession();\n this.startSession();\n this.resetTimers();\n }\n\n private resetTimers() {\n this.resetInactivityTimer();\n this.resetMaxDurationTimer();\n }\n\n private resetInactivityTimer() {\n if (!this._inactivityTimeout) {\n return;\n }\n\n if (this._inactivityTimeoutId) {\n clearTimeout(this._inactivityTimeoutId);\n }\n\n this._inactivityTimeoutId = setTimeout(() => {\n this.resetSession();\n }, this._inactivityTimeout * 1000);\n }\n\n private resetMaxDurationTimer() {\n if (!this._maxDuration || !this._session) {\n return;\n }\n\n if (this._maxDurationTimeoutId) {\n clearTimeout(this._maxDurationTimeoutId);\n }\n\n const timeoutIn =\n this._maxDuration * 1000 - (Date.now() - this._session?.startTimestamp);\n\n this._maxDurationTimeoutId = setTimeout(() => {\n this.resetSession();\n }, timeoutIn);\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { Context } from '@opentelemetry/api';
2
- import { SpanProcessor, Span, ReadableSpan } from '@opentelemetry/sdk-trace-base';
3
- import { SessionProvider } from './types/SessionProvider';
1
+ import type { Context } from '@opentelemetry/api';
2
+ import type { SpanProcessor, Span, ReadableSpan } from '@opentelemetry/sdk-trace-base';
3
+ import type { SessionProvider } from './types/SessionProvider';
4
4
  /**
5
5
  * SessionSpanProcessor is a {@link SpanProcessor} that adds the session.id attribute
6
6
  */
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.SessionSpanProcessor = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"SessionSpanProcessor.js","sourceRoot":"","sources":["../../src/SessionSpanProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAQH,uCAA4C;AAG5C;;GAEG;AACH,MAAa,oBAAoB;IACvB,kBAAkB,CAAkB;IAE5C,YAAY,iBAAkC;QAC5C,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,KAAmB,CAAC;IAEpC;;;;OAIG;IACH,OAAO,CAAC,IAAU,EAAE,cAAuB;QACzC,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,EAAE,YAAY,EAAE,CAAC;QAC1D,IAAI,SAAS,EAAE;YACb,IAAI,CAAC,YAAY,CAAC,yBAAe,EAAE,SAAS,CAAC,CAAC;SAC/C;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,CAAe;QACnB,QAAQ;IACV,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ,KAAmB,CAAC;CACnC;AAtCD,oDAsCC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Context } from '@opentelemetry/api';\nimport {\n SpanProcessor,\n Span,\n ReadableSpan,\n} from '@opentelemetry/sdk-trace-base';\nimport { ATTR_SESSION_ID } from './semconv';\nimport { SessionProvider } from './types/SessionProvider';\n\n/**\n * SessionSpanProcessor is a {@link SpanProcessor} that adds the session.id attribute\n */\nexport class SessionSpanProcessor implements SpanProcessor {\n private _sessionIdProvider: SessionProvider;\n\n constructor(sessionIdProvider: SessionProvider) {\n this._sessionIdProvider = sessionIdProvider;\n }\n\n /**\n * Forces to export all finished spans\n */\n async forceFlush(): Promise<void> {}\n\n /**\n * Called when a {@link Span} is started, if the `span.isRecording()`\n * returns true.\n * @param span the Span that just started.\n */\n onStart(span: Span, _parentContext: Context): void {\n const sessionId = this._sessionIdProvider?.getSessionId();\n if (sessionId) {\n span.setAttribute(ATTR_SESSION_ID, sessionId);\n }\n }\n\n /**\n * Called when a {@link ReadableSpan} is ended, if the `span.isRecording()`\n * returns true.\n * @param span the Span that just ended.\n */\n onEnd(_: ReadableSpan): void {\n // no-op\n }\n\n /**\n * Shuts down the processor. Called when SDK is shut down. This is an\n * opportunity for processor to do any cleanup required.\n */\n async shutdown(): Promise<void> {}\n}\n"]}
1
+ {"version":3,"file":"SessionSpanProcessor.js","sourceRoot":"","sources":["../../src/SessionSpanProcessor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,uCAA4C;AAG5C;;GAEG;AACH,MAAa,oBAAoB;IACvB,kBAAkB,CAAkB;IAE5C,YAAY,iBAAkC;QAC5C,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,KAAmB,CAAC;IAEpC;;;;OAIG;IACH,OAAO,CAAC,IAAU,EAAE,cAAuB;QACzC,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,EAAE,YAAY,EAAE,CAAC;QAC1D,IAAI,SAAS,EAAE;YACb,IAAI,CAAC,YAAY,CAAC,yBAAe,EAAE,SAAS,CAAC,CAAC;SAC/C;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,CAAe;QACnB,QAAQ;IACV,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ,KAAmB,CAAC;CACnC;AAtCD,oDAsCC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '@opentelemetry/api';\nimport type {\n SpanProcessor,\n Span,\n ReadableSpan,\n} from '@opentelemetry/sdk-trace-base';\nimport { ATTR_SESSION_ID } from './semconv';\nimport type { SessionProvider } from './types/SessionProvider';\n\n/**\n * SessionSpanProcessor is a {@link SpanProcessor} that adds the session.id attribute\n */\nexport class SessionSpanProcessor implements SpanProcessor {\n private _sessionIdProvider: SessionProvider;\n\n constructor(sessionIdProvider: SessionProvider) {\n this._sessionIdProvider = sessionIdProvider;\n }\n\n /**\n * Forces to export all finished spans\n */\n async forceFlush(): Promise<void> {}\n\n /**\n * Called when a {@link Span} is started, if the `span.isRecording()`\n * returns true.\n * @param span the Span that just started.\n */\n onStart(span: Span, _parentContext: Context): void {\n const sessionId = this._sessionIdProvider?.getSessionId();\n if (sessionId) {\n span.setAttribute(ATTR_SESSION_ID, sessionId);\n }\n }\n\n /**\n * Called when a {@link ReadableSpan} is ended, if the `span.isRecording()`\n * returns true.\n * @param span the Span that just ended.\n */\n onEnd(_: ReadableSpan): void {\n // no-op\n }\n\n /**\n * Shuts down the processor. Called when SDK is shut down. This is an\n * opportunity for processor to do any cleanup required.\n */\n async shutdown(): Promise<void> {}\n}\n"]}
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.createLocalStorageSessionStore = exports.createDefaultSessionIdGenerator = exports.createSessionManager = exports.createSessionLogRecordProcessor = exports.createSessionSpanProcessor = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,iCAMiB;AALf,mHAAA,0BAA0B,OAAA;AAC1B,wHAAA,+BAA+B,OAAA;AAC/B,6GAAA,oBAAoB,OAAA;AACpB,wHAAA,+BAA+B,OAAA;AAC/B,uHAAA,8BAA8B,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type { SessionProvider } from './types/SessionProvider';\nexport {\n createSessionSpanProcessor,\n createSessionLogRecordProcessor,\n createSessionManager,\n createDefaultSessionIdGenerator,\n createLocalStorageSessionStore,\n} from './utils';\nexport type { Session } from './types/Session';\nexport type { SessionIdGenerator } from './types/SessionIdGenerator';\nexport type { SessionPublisher } from './types/SessionPublisher';\nexport type { SessionObserver } from './types/SessionObserver';\nexport type { SessionStore } from './types/SessionStore';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iCAMiB;AALf,mHAAA,0BAA0B,OAAA;AAC1B,wHAAA,+BAA+B,OAAA;AAC/B,6GAAA,oBAAoB,OAAA;AACpB,wHAAA,+BAA+B,OAAA;AAC/B,uHAAA,8BAA8B,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport type { SessionProvider } from './types/SessionProvider';\nexport {\n createSessionSpanProcessor,\n createSessionLogRecordProcessor,\n createSessionManager,\n createDefaultSessionIdGenerator,\n createLocalStorageSessionStore,\n} from './utils';\nexport type { Session } from './types/Session';\nexport type { SessionIdGenerator } from './types/SessionIdGenerator';\nexport type { SessionPublisher } from './types/SessionPublisher';\nexport type { SessionObserver } from './types/SessionObserver';\nexport type { SessionStore } from './types/SessionStore';\n"]}
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.ATTR_SESSION_ID = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AACU,QAAA,eAAe,GAAG,YAAqB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A unique id to identify a session.\n *\n * @example \"00112233-4455-6677-8899-aabbccddeeff\"\n */\nexport const ATTR_SESSION_ID = 'session.id' as const;\n"]}
1
+ {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AACU,QAAA,eAAe,GAAG,YAAqB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A unique id to identify a session.\n *\n * @example \"00112233-4455-6677-8899-aabbccddeeff\"\n */\nexport const ATTR_SESSION_ID = 'session.id' as const;\n"]}
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  //# sourceMappingURL=Session.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Session.js","sourceRoot":"","sources":["../../../src/types/Session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface Session {\n id: string;\n startTimestamp: number; // epoch milliseconds\n}\n"]}
1
+ {"version":3,"file":"Session.js","sourceRoot":"","sources":["../../../src/types/Session.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport interface Session {\n id: string;\n startTimestamp: number; // epoch milliseconds\n}\n"]}
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  //# sourceMappingURL=SessionIdGenerator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionIdGenerator.js","sourceRoot":"","sources":["../../../src/types/SessionIdGenerator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface SessionIdGenerator {\n generateSessionId(): string;\n}\n"]}
1
+ {"version":3,"file":"SessionIdGenerator.js","sourceRoot":"","sources":["../../../src/types/SessionIdGenerator.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport interface SessionIdGenerator {\n generateSessionId(): string;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Session } from './Session';
1
+ import type { Session } from './Session';
2
2
  export interface SessionObserver {
3
3
  onSessionStarted(newSession: Session, previousSession?: Session): void;
4
4
  onSessionEnded(session: Session): void;
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  //# sourceMappingURL=SessionObserver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionObserver.js","sourceRoot":"","sources":["../../../src/types/SessionObserver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Session } from './Session';\n\nexport interface SessionObserver {\n onSessionStarted(newSession: Session, previousSession?: Session): void;\n onSessionEnded(session: Session): void;\n}\n"]}
1
+ {"version":3,"file":"SessionObserver.js","sourceRoot":"","sources":["../../../src/types/SessionObserver.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Session } from './Session';\n\nexport interface SessionObserver {\n onSessionStarted(newSession: Session, previousSession?: Session): void;\n onSessionEnded(session: Session): void;\n}\n"]}
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  //# sourceMappingURL=SessionProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionProvider.js","sourceRoot":"","sources":["../../../src/types/SessionProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface SessionProvider {\n getSessionId(): string | null;\n}\n"]}
1
+ {"version":3,"file":"SessionProvider.js","sourceRoot":"","sources":["../../../src/types/SessionProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport interface SessionProvider {\n getSessionId(): string | null;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { SessionObserver } from './SessionObserver';
1
+ import type { SessionObserver } from './SessionObserver';
2
2
  export interface SessionPublisher {
3
3
  addObserver(observer: SessionObserver): void;
4
4
  }
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  //# sourceMappingURL=SessionPublisher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionPublisher.js","sourceRoot":"","sources":["../../../src/types/SessionPublisher.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SessionObserver } from './SessionObserver';\n\nexport interface SessionPublisher {\n addObserver(observer: SessionObserver): void;\n}\n"]}
1
+ {"version":3,"file":"SessionPublisher.js","sourceRoot":"","sources":["../../../src/types/SessionPublisher.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SessionObserver } from './SessionObserver';\n\nexport interface SessionPublisher {\n addObserver(observer: SessionObserver): void;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Session } from './Session';
1
+ import type { Session } from './Session';
2
2
  export interface SessionStore {
3
3
  save(session: Session): Promise<void>;
4
4
  get(): Promise<Session | null>;
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  //# sourceMappingURL=SessionStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionStore.js","sourceRoot":"","sources":["../../../src/types/SessionStore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Session } from './Session';\n\nexport interface SessionStore {\n save(session: Session): Promise<void>;\n get(): Promise<Session | null>;\n}\n"]}
1
+ {"version":3,"file":"SessionStore.js","sourceRoot":"","sources":["../../../src/types/SessionStore.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Session } from './Session';\n\nexport interface SessionStore {\n save(session: Session): Promise<void>;\n get(): Promise<Session | null>;\n}\n"]}
@@ -1,9 +1,10 @@
1
- import { SessionProvider } from './types/SessionProvider';
2
- import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
3
- import { LogRecordProcessor } from '@opentelemetry/sdk-logs';
4
- import { SessionManager, SessionManagerConfig } from './SessionManager';
5
- import { SessionIdGenerator } from './types/SessionIdGenerator';
6
- import { SessionStore } from './types/SessionStore';
1
+ import type { SessionProvider } from './types/SessionProvider';
2
+ import type { SpanProcessor } from '@opentelemetry/sdk-trace-base';
3
+ import type { LogRecordProcessor } from '@opentelemetry/sdk-logs';
4
+ import type { SessionManagerConfig } from './SessionManager';
5
+ import { SessionManager } from './SessionManager';
6
+ import type { SessionIdGenerator } from './types/SessionIdGenerator';
7
+ import type { SessionStore } from './types/SessionStore';
7
8
  export declare function createSessionSpanProcessor(sessionProvider: SessionProvider): SpanProcessor;
8
9
  export declare function createSessionLogRecordProcessor(sessionProvider: SessionProvider): LogRecordProcessor;
9
10
  export declare function createSessionManager(config: SessionManagerConfig): SessionManager;
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.createLocalStorageSessionStore = exports.createDefaultSessionIdGenerator = exports.createSessionManager = exports.createSessionLogRecordProcessor = exports.createSessionSpanProcessor = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,iEAA8D;AAE9D,2EAAwE;AACxE,qDAAwE;AAExE,6DAA0D;AAE1D,yEAAsE;AAEtE,SAAgB,0BAA0B,CACxC,eAAgC;IAEhC,OAAO,IAAI,2CAAoB,CAAC,eAAe,CAAC,CAAC;AACnD,CAAC;AAJD,gEAIC;AAED,SAAgB,+BAA+B,CAC7C,eAAgC;IAEhC,OAAO,IAAI,qDAAyB,CAAC,eAAe,CAAC,CAAC;AACxD,CAAC;AAJD,0EAIC;AAED,SAAgB,oBAAoB,CAClC,MAA4B;IAE5B,MAAM,OAAO,GAAG,IAAI,+BAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,OAAO,CAAC;AACjB,CAAC;AALD,oDAKC;AAED,SAAgB,+BAA+B;IAC7C,OAAO,IAAI,uCAAkB,EAAE,CAAC;AAClC,CAAC;AAFD,0EAEC;AAED,SAAgB,8BAA8B;IAC5C,OAAO,IAAI,mDAAwB,EAAE,CAAC;AACxC,CAAC;AAFD,wEAEC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SessionProvider } from './types/SessionProvider';\nimport { SpanProcessor } from '@opentelemetry/sdk-trace-base';\nimport { SessionSpanProcessor } from './SessionSpanProcessor';\nimport { LogRecordProcessor } from '@opentelemetry/sdk-logs';\nimport { SessionLogRecordProcessor } from './SessionLogRecordProcessor';\nimport { SessionManager, SessionManagerConfig } from './SessionManager';\nimport { SessionIdGenerator } from './types/SessionIdGenerator';\nimport { DefaultIdGenerator } from './DefaultIdGenerator';\nimport { SessionStore } from './types/SessionStore';\nimport { LocalStorageSessionStore } from './LocalStorageSessionStore';\n\nexport function createSessionSpanProcessor(\n sessionProvider: SessionProvider\n): SpanProcessor {\n return new SessionSpanProcessor(sessionProvider);\n}\n\nexport function createSessionLogRecordProcessor(\n sessionProvider: SessionProvider\n): LogRecordProcessor {\n return new SessionLogRecordProcessor(sessionProvider);\n}\n\nexport function createSessionManager(\n config: SessionManagerConfig\n): SessionManager {\n const manager = new SessionManager(config);\n return manager;\n}\n\nexport function createDefaultSessionIdGenerator(): SessionIdGenerator {\n return new DefaultIdGenerator();\n}\n\nexport function createLocalStorageSessionStore(): SessionStore {\n return new LocalStorageSessionStore();\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAA8D;AAE9D,2EAAwE;AAExE,qDAAkD;AAElD,6DAA0D;AAE1D,yEAAsE;AAEtE,SAAgB,0BAA0B,CACxC,eAAgC;IAEhC,OAAO,IAAI,2CAAoB,CAAC,eAAe,CAAC,CAAC;AACnD,CAAC;AAJD,gEAIC;AAED,SAAgB,+BAA+B,CAC7C,eAAgC;IAEhC,OAAO,IAAI,qDAAyB,CAAC,eAAe,CAAC,CAAC;AACxD,CAAC;AAJD,0EAIC;AAED,SAAgB,oBAAoB,CAClC,MAA4B;IAE5B,MAAM,OAAO,GAAG,IAAI,+BAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,OAAO,CAAC;AACjB,CAAC;AALD,oDAKC;AAED,SAAgB,+BAA+B;IAC7C,OAAO,IAAI,uCAAkB,EAAE,CAAC;AAClC,CAAC;AAFD,0EAEC;AAED,SAAgB,8BAA8B;IAC5C,OAAO,IAAI,mDAAwB,EAAE,CAAC;AACxC,CAAC;AAFD,wEAEC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SessionProvider } from './types/SessionProvider';\nimport type { SpanProcessor } from '@opentelemetry/sdk-trace-base';\nimport { SessionSpanProcessor } from './SessionSpanProcessor';\nimport type { LogRecordProcessor } from '@opentelemetry/sdk-logs';\nimport { SessionLogRecordProcessor } from './SessionLogRecordProcessor';\nimport type { SessionManagerConfig } from './SessionManager';\nimport { SessionManager } from './SessionManager';\nimport type { SessionIdGenerator } from './types/SessionIdGenerator';\nimport { DefaultIdGenerator } from './DefaultIdGenerator';\nimport type { SessionStore } from './types/SessionStore';\nimport { LocalStorageSessionStore } from './LocalStorageSessionStore';\n\nexport function createSessionSpanProcessor(\n sessionProvider: SessionProvider\n): SpanProcessor {\n return new SessionSpanProcessor(sessionProvider);\n}\n\nexport function createSessionLogRecordProcessor(\n sessionProvider: SessionProvider\n): LogRecordProcessor {\n return new SessionLogRecordProcessor(sessionProvider);\n}\n\nexport function createSessionManager(\n config: SessionManagerConfig\n): SessionManager {\n const manager = new SessionManager(config);\n return manager;\n}\n\nexport function createDefaultSessionIdGenerator(): SessionIdGenerator {\n return new DefaultIdGenerator();\n}\n\nexport function createLocalStorageSessionStore(): SessionStore {\n return new LocalStorageSessionStore();\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.212.0";
1
+ export declare const VERSION = "0.214.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,21 +1,10 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.VERSION = void 0;
19
8
  // this is autogenerated file, see scripts/version-update.js
20
- exports.VERSION = '0.212.0';
9
+ exports.VERSION = '0.214.0';
21
10
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.212.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.214.0';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/web-common",
3
- "version": "0.212.0",
3
+ "version": "0.214.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -63,14 +63,14 @@
63
63
  "@opentelemetry/api": ">=1.4.0 <1.10.0"
64
64
  },
65
65
  "dependencies": {
66
- "@opentelemetry/sdk-logs": "0.212.0",
67
- "@opentelemetry/sdk-trace-base": "2.5.1",
66
+ "@opentelemetry/sdk-logs": "0.214.0",
67
+ "@opentelemetry/sdk-trace-base": "2.6.1",
68
68
  "@opentelemetry/semantic-conventions": "^1.29.0"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@babel/core": "7.27.1",
72
- "@opentelemetry/api": "1.9.0",
73
- "@opentelemetry/api-logs": "0.212.0",
72
+ "@opentelemetry/api": "1.9.1",
73
+ "@opentelemetry/api-logs": "0.214.0",
74
74
  "@types/mocha": "10.0.10",
75
75
  "@types/node": "18.19.130",
76
76
  "@types/sinon": "17.0.4",
@@ -89,7 +89,7 @@
89
89
  "ts-loader": "9.5.4",
90
90
  "typescript": "5.0.4",
91
91
  "webpack": "5.104.1",
92
- "webpack-cli": "6.0.1"
92
+ "webpack-cli": "7.0.2"
93
93
  },
94
- "gitHead": "ad92be4c2c1094745a85b0b7eeff1444a11b1b4a"
94
+ "gitHead": "7e74509a4d848e94b2970bb5262dd3e8efeed0a2"
95
95
  }