@svta/cml-cmcd 0.19.0 → 0.20.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 (275) hide show
  1. package/README.md +26 -0
  2. package/dist/index.d.ts +1528 -72
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1001 -56
  5. package/dist/index.js.map +1 -1
  6. package/package.json +8 -27
  7. package/dist/CMCD_COMMON_KEYS.d.ts +0 -8
  8. package/dist/CMCD_COMMON_KEYS.d.ts.map +0 -1
  9. package/dist/CMCD_COMMON_KEYS.js +0 -39
  10. package/dist/CMCD_COMMON_KEYS.js.map +0 -1
  11. package/dist/CMCD_DEFAULT_TIME_INTERVAL.d.ts +0 -8
  12. package/dist/CMCD_DEFAULT_TIME_INTERVAL.d.ts.map +0 -1
  13. package/dist/CMCD_DEFAULT_TIME_INTERVAL.js +0 -8
  14. package/dist/CMCD_DEFAULT_TIME_INTERVAL.js.map +0 -1
  15. package/dist/CMCD_EVENT_KEYS.d.ts +0 -8
  16. package/dist/CMCD_EVENT_KEYS.d.ts.map +0 -1
  17. package/dist/CMCD_EVENT_KEYS.js +0 -10
  18. package/dist/CMCD_EVENT_KEYS.js.map +0 -1
  19. package/dist/CMCD_EVENT_MODE.d.ts +0 -8
  20. package/dist/CMCD_EVENT_MODE.d.ts.map +0 -1
  21. package/dist/CMCD_EVENT_MODE.js +0 -8
  22. package/dist/CMCD_EVENT_MODE.js.map +0 -1
  23. package/dist/CMCD_FORMATTER_MAP.d.ts +0 -9
  24. package/dist/CMCD_FORMATTER_MAP.d.ts.map +0 -1
  25. package/dist/CMCD_FORMATTER_MAP.js +0 -71
  26. package/dist/CMCD_FORMATTER_MAP.js.map +0 -1
  27. package/dist/CMCD_HEADERS.d.ts +0 -8
  28. package/dist/CMCD_HEADERS.d.ts.map +0 -1
  29. package/dist/CMCD_HEADERS.js +0 -8
  30. package/dist/CMCD_HEADERS.js.map +0 -1
  31. package/dist/CMCD_HEADER_MAP.d.ts +0 -10
  32. package/dist/CMCD_HEADER_MAP.d.ts.map +0 -1
  33. package/dist/CMCD_HEADER_MAP.js +0 -64
  34. package/dist/CMCD_HEADER_MAP.js.map +0 -1
  35. package/dist/CMCD_JSON.d.ts +0 -10
  36. package/dist/CMCD_JSON.d.ts.map +0 -1
  37. package/dist/CMCD_JSON.js +0 -10
  38. package/dist/CMCD_JSON.js.map +0 -1
  39. package/dist/CMCD_KEYS.d.ts +0 -9
  40. package/dist/CMCD_KEYS.d.ts.map +0 -1
  41. package/dist/CMCD_KEYS.js +0 -14
  42. package/dist/CMCD_KEYS.js.map +0 -1
  43. package/dist/CMCD_OBJECT.d.ts +0 -8
  44. package/dist/CMCD_OBJECT.d.ts.map +0 -1
  45. package/dist/CMCD_OBJECT.js +0 -8
  46. package/dist/CMCD_OBJECT.js.map +0 -1
  47. package/dist/CMCD_PARAM.d.ts +0 -8
  48. package/dist/CMCD_PARAM.d.ts.map +0 -1
  49. package/dist/CMCD_PARAM.js +0 -8
  50. package/dist/CMCD_PARAM.js.map +0 -1
  51. package/dist/CMCD_QUERY.d.ts +0 -8
  52. package/dist/CMCD_QUERY.d.ts.map +0 -1
  53. package/dist/CMCD_QUERY.js +0 -8
  54. package/dist/CMCD_QUERY.js.map +0 -1
  55. package/dist/CMCD_REQUEST.d.ts +0 -8
  56. package/dist/CMCD_REQUEST.d.ts.map +0 -1
  57. package/dist/CMCD_REQUEST.js +0 -8
  58. package/dist/CMCD_REQUEST.js.map +0 -1
  59. package/dist/CMCD_REQUEST_KEYS.d.ts +0 -8
  60. package/dist/CMCD_REQUEST_KEYS.d.ts.map +0 -1
  61. package/dist/CMCD_REQUEST_KEYS.js +0 -15
  62. package/dist/CMCD_REQUEST_KEYS.js.map +0 -1
  63. package/dist/CMCD_REQUEST_MODE.d.ts +0 -8
  64. package/dist/CMCD_REQUEST_MODE.d.ts.map +0 -1
  65. package/dist/CMCD_REQUEST_MODE.js +0 -8
  66. package/dist/CMCD_REQUEST_MODE.js.map +0 -1
  67. package/dist/CMCD_RESPONSE_KEYS.d.ts +0 -8
  68. package/dist/CMCD_RESPONSE_KEYS.d.ts.map +0 -1
  69. package/dist/CMCD_RESPONSE_KEYS.js +0 -17
  70. package/dist/CMCD_RESPONSE_KEYS.js.map +0 -1
  71. package/dist/CMCD_RESPONSE_MODE.d.ts +0 -8
  72. package/dist/CMCD_RESPONSE_MODE.d.ts.map +0 -1
  73. package/dist/CMCD_RESPONSE_MODE.js +0 -8
  74. package/dist/CMCD_RESPONSE_MODE.js.map +0 -1
  75. package/dist/CMCD_SESSION.d.ts +0 -8
  76. package/dist/CMCD_SESSION.d.ts.map +0 -1
  77. package/dist/CMCD_SESSION.js +0 -8
  78. package/dist/CMCD_SESSION.js.map +0 -1
  79. package/dist/CMCD_STATUS.d.ts +0 -8
  80. package/dist/CMCD_STATUS.d.ts.map +0 -1
  81. package/dist/CMCD_STATUS.js +0 -8
  82. package/dist/CMCD_STATUS.js.map +0 -1
  83. package/dist/CMCD_V1.d.ts +0 -8
  84. package/dist/CMCD_V1.d.ts.map +0 -1
  85. package/dist/CMCD_V1.js +0 -8
  86. package/dist/CMCD_V1.js.map +0 -1
  87. package/dist/CMCD_V1_KEYS.d.ts +0 -8
  88. package/dist/CMCD_V1_KEYS.d.ts.map +0 -1
  89. package/dist/CMCD_V1_KEYS.js +0 -27
  90. package/dist/CMCD_V1_KEYS.js.map +0 -1
  91. package/dist/CMCD_V2.d.ts +0 -8
  92. package/dist/CMCD_V2.d.ts.map +0 -1
  93. package/dist/CMCD_V2.js +0 -8
  94. package/dist/CMCD_V2.js.map +0 -1
  95. package/dist/Cmcd.d.ts +0 -214
  96. package/dist/Cmcd.d.ts.map +0 -1
  97. package/dist/Cmcd.js +0 -2
  98. package/dist/Cmcd.js.map +0 -1
  99. package/dist/CmcdCustomKey.d.ts +0 -11
  100. package/dist/CmcdCustomKey.d.ts.map +0 -1
  101. package/dist/CmcdCustomKey.js +0 -2
  102. package/dist/CmcdCustomKey.js.map +0 -1
  103. package/dist/CmcdData.d.ts +0 -12
  104. package/dist/CmcdData.d.ts.map +0 -1
  105. package/dist/CmcdData.js +0 -2
  106. package/dist/CmcdData.js.map +0 -1
  107. package/dist/CmcdEncodeOptions.d.ts +0 -45
  108. package/dist/CmcdEncodeOptions.d.ts.map +0 -1
  109. package/dist/CmcdEncodeOptions.js +0 -2
  110. package/dist/CmcdEncodeOptions.js.map +0 -1
  111. package/dist/CmcdEncoding.d.ts +0 -20
  112. package/dist/CmcdEncoding.d.ts.map +0 -1
  113. package/dist/CmcdEncoding.js +0 -15
  114. package/dist/CmcdEncoding.js.map +0 -1
  115. package/dist/CmcdEvent.d.ts +0 -49
  116. package/dist/CmcdEvent.d.ts.map +0 -1
  117. package/dist/CmcdEvent.js +0 -2
  118. package/dist/CmcdEvent.js.map +0 -1
  119. package/dist/CmcdEventExcludedKeys.d.ts +0 -8
  120. package/dist/CmcdEventExcludedKeys.d.ts.map +0 -1
  121. package/dist/CmcdEventExcludedKeys.js +0 -2
  122. package/dist/CmcdEventExcludedKeys.js.map +0 -1
  123. package/dist/CmcdEventType.d.ts +0 -52
  124. package/dist/CmcdEventType.d.ts.map +0 -1
  125. package/dist/CmcdEventType.js +0 -47
  126. package/dist/CmcdEventType.js.map +0 -1
  127. package/dist/CmcdFormatter.d.ts +0 -16
  128. package/dist/CmcdFormatter.d.ts.map +0 -1
  129. package/dist/CmcdFormatter.js +0 -2
  130. package/dist/CmcdFormatter.js.map +0 -1
  131. package/dist/CmcdFormatterMap.d.ts +0 -10
  132. package/dist/CmcdFormatterMap.d.ts.map +0 -1
  133. package/dist/CmcdFormatterMap.js +0 -2
  134. package/dist/CmcdFormatterMap.js.map +0 -1
  135. package/dist/CmcdFormatterOptions.d.ts +0 -22
  136. package/dist/CmcdFormatterOptions.d.ts.map +0 -1
  137. package/dist/CmcdFormatterOptions.js +0 -2
  138. package/dist/CmcdFormatterOptions.js.map +0 -1
  139. package/dist/CmcdFormatters.d.ts +0 -11
  140. package/dist/CmcdFormatters.d.ts.map +0 -1
  141. package/dist/CmcdFormatters.js +0 -11
  142. package/dist/CmcdFormatters.js.map +0 -1
  143. package/dist/CmcdHeaderField.d.ts +0 -36
  144. package/dist/CmcdHeaderField.d.ts.map +0 -1
  145. package/dist/CmcdHeaderField.js +0 -31
  146. package/dist/CmcdHeaderField.js.map +0 -1
  147. package/dist/CmcdHeaderMap.d.ts +0 -10
  148. package/dist/CmcdHeaderMap.d.ts.map +0 -1
  149. package/dist/CmcdHeaderMap.js +0 -2
  150. package/dist/CmcdHeaderMap.js.map +0 -1
  151. package/dist/CmcdHeadersMap.d.ts +0 -12
  152. package/dist/CmcdHeadersMap.d.ts.map +0 -1
  153. package/dist/CmcdHeadersMap.js +0 -2
  154. package/dist/CmcdHeadersMap.js.map +0 -1
  155. package/dist/CmcdKey.d.ts +0 -9
  156. package/dist/CmcdKey.d.ts.map +0 -1
  157. package/dist/CmcdKey.js +0 -2
  158. package/dist/CmcdKey.js.map +0 -1
  159. package/dist/CmcdObjectType.d.ts +0 -15
  160. package/dist/CmcdObjectType.d.ts.map +0 -1
  161. package/dist/CmcdObjectType.js +0 -11
  162. package/dist/CmcdObjectType.js.map +0 -1
  163. package/dist/CmcdPlayerState.d.ts +0 -56
  164. package/dist/CmcdPlayerState.d.ts.map +0 -1
  165. package/dist/CmcdPlayerState.js +0 -51
  166. package/dist/CmcdPlayerState.js.map +0 -1
  167. package/dist/CmcdReportTarget.d.ts +0 -44
  168. package/dist/CmcdReportTarget.d.ts.map +0 -1
  169. package/dist/CmcdReportTarget.js +0 -2
  170. package/dist/CmcdReportTarget.js.map +0 -1
  171. package/dist/CmcdReportingMode.d.ts +0 -31
  172. package/dist/CmcdReportingMode.d.ts.map +0 -1
  173. package/dist/CmcdReportingMode.js +0 -26
  174. package/dist/CmcdReportingMode.js.map +0 -1
  175. package/dist/CmcdRequest.d.ts +0 -222
  176. package/dist/CmcdRequest.d.ts.map +0 -1
  177. package/dist/CmcdRequest.js +0 -2
  178. package/dist/CmcdRequest.js.map +0 -1
  179. package/dist/CmcdResponse.d.ts +0 -84
  180. package/dist/CmcdResponse.d.ts.map +0 -1
  181. package/dist/CmcdResponse.js +0 -2
  182. package/dist/CmcdResponse.js.map +0 -1
  183. package/dist/CmcdStreamType.d.ts +0 -15
  184. package/dist/CmcdStreamType.d.ts.map +0 -1
  185. package/dist/CmcdStreamType.js +0 -11
  186. package/dist/CmcdStreamType.js.map +0 -1
  187. package/dist/CmcdStreamingFormat.d.ts +0 -15
  188. package/dist/CmcdStreamingFormat.d.ts.map +0 -1
  189. package/dist/CmcdStreamingFormat.js +0 -11
  190. package/dist/CmcdStreamingFormat.js.map +0 -1
  191. package/dist/CmcdTransmissionMode.d.ts +0 -33
  192. package/dist/CmcdTransmissionMode.d.ts.map +0 -1
  193. package/dist/CmcdTransmissionMode.js +0 -28
  194. package/dist/CmcdTransmissionMode.js.map +0 -1
  195. package/dist/CmcdValue.d.ts +0 -13
  196. package/dist/CmcdValue.d.ts.map +0 -1
  197. package/dist/CmcdValue.js +0 -2
  198. package/dist/CmcdValue.js.map +0 -1
  199. package/dist/appendCmcdHeaders.d.ts +0 -19
  200. package/dist/appendCmcdHeaders.d.ts.map +0 -1
  201. package/dist/appendCmcdHeaders.js +0 -20
  202. package/dist/appendCmcdHeaders.js.map +0 -1
  203. package/dist/appendCmcdQuery.d.ts +0 -19
  204. package/dist/appendCmcdQuery.d.ts.map +0 -1
  205. package/dist/appendCmcdQuery.js +0 -31
  206. package/dist/appendCmcdQuery.js.map +0 -1
  207. package/dist/decodeCmcd.d.ts +0 -16
  208. package/dist/decodeCmcd.d.ts.map +0 -1
  209. package/dist/decodeCmcd.js +0 -45
  210. package/dist/decodeCmcd.js.map +0 -1
  211. package/dist/encodeCmcd.d.ts +0 -18
  212. package/dist/encodeCmcd.d.ts.map +0 -1
  213. package/dist/encodeCmcd.js +0 -23
  214. package/dist/encodeCmcd.js.map +0 -1
  215. package/dist/fromCmcdHeaders.d.ts +0 -16
  216. package/dist/fromCmcdHeaders.d.ts.map +0 -1
  217. package/dist/fromCmcdHeaders.js +0 -29
  218. package/dist/fromCmcdHeaders.js.map +0 -1
  219. package/dist/fromCmcdQuery.d.ts +0 -16
  220. package/dist/fromCmcdQuery.d.ts.map +0 -1
  221. package/dist/fromCmcdQuery.js +0 -23
  222. package/dist/fromCmcdQuery.js.map +0 -1
  223. package/dist/fromCmcdUrl.d.ts +0 -16
  224. package/dist/fromCmcdUrl.d.ts.map +0 -1
  225. package/dist/fromCmcdUrl.js +0 -18
  226. package/dist/fromCmcdUrl.js.map +0 -1
  227. package/dist/groupCmcdHeaders.d.ts +0 -16
  228. package/dist/groupCmcdHeaders.d.ts.map +0 -1
  229. package/dist/groupCmcdHeaders.js +0 -37
  230. package/dist/groupCmcdHeaders.js.map +0 -1
  231. package/dist/isCmcdCustomKey.d.ts +0 -13
  232. package/dist/isCmcdCustomKey.d.ts.map +0 -1
  233. package/dist/isCmcdCustomKey.js +0 -15
  234. package/dist/isCmcdCustomKey.js.map +0 -1
  235. package/dist/isCmcdEventKey.d.ts +0 -16
  236. package/dist/isCmcdEventKey.d.ts.map +0 -1
  237. package/dist/isCmcdEventKey.js +0 -22
  238. package/dist/isCmcdEventKey.js.map +0 -1
  239. package/dist/isCmcdRequestKey.d.ts +0 -16
  240. package/dist/isCmcdRequestKey.d.ts.map +0 -1
  241. package/dist/isCmcdRequestKey.js +0 -22
  242. package/dist/isCmcdRequestKey.js.map +0 -1
  243. package/dist/isCmcdResponseKey.d.ts +0 -16
  244. package/dist/isCmcdResponseKey.d.ts.map +0 -1
  245. package/dist/isCmcdResponseKey.js +0 -24
  246. package/dist/isCmcdResponseKey.js.map +0 -1
  247. package/dist/isCmcdV1Key.d.ts +0 -16
  248. package/dist/isCmcdV1Key.d.ts.map +0 -1
  249. package/dist/isCmcdV1Key.js +0 -19
  250. package/dist/isCmcdV1Key.js.map +0 -1
  251. package/dist/prepareCmcdData.d.ts +0 -13
  252. package/dist/prepareCmcdData.d.ts.map +0 -1
  253. package/dist/prepareCmcdData.js +0 -88
  254. package/dist/prepareCmcdData.js.map +0 -1
  255. package/dist/toCmcdHeaders.d.ts +0 -19
  256. package/dist/toCmcdHeaders.d.ts.map +0 -1
  257. package/dist/toCmcdHeaders.js +0 -34
  258. package/dist/toCmcdHeaders.js.map +0 -1
  259. package/dist/toCmcdJson.d.ts +0 -17
  260. package/dist/toCmcdJson.d.ts.map +0 -1
  261. package/dist/toCmcdJson.js +0 -21
  262. package/dist/toCmcdJson.js.map +0 -1
  263. package/dist/toCmcdQuery.d.ts +0 -18
  264. package/dist/toCmcdQuery.d.ts.map +0 -1
  265. package/dist/toCmcdQuery.js +0 -24
  266. package/dist/toCmcdQuery.js.map +0 -1
  267. package/dist/toCmcdReport.d.ts +0 -22
  268. package/dist/toCmcdReport.d.ts.map +0 -1
  269. package/dist/toCmcdReport.js +0 -52
  270. package/dist/toCmcdReport.js.map +0 -1
  271. package/dist/toCmcdUrl.d.ts +0 -15
  272. package/dist/toCmcdUrl.d.ts.map +0 -1
  273. package/dist/toCmcdUrl.js +0 -20
  274. package/dist/toCmcdUrl.js.map +0 -1
  275. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,11 +0,0 @@
1
- import { CmStreamType } from '@svta/cml-cta/CmStreamType.js';
2
- /**
3
- * Common Media Client Data Stream Type
4
- *
5
- *
6
- * @enum
7
- *
8
- * @beta
9
- */
10
- export const CmcdStreamType = CmStreamType;
11
- //# sourceMappingURL=CmcdStreamType.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CmcdStreamType.js","sourceRoot":"","sources":["../src/CmcdStreamType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,YAAmC,CAAC","sourcesContent":["import { CmStreamType } from '@svta/cml-cta/CmStreamType.js';\n\n/**\n * Common Media Client Data Stream Type\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdStreamType = CmStreamType as typeof CmStreamType;\n\n/**\n * @beta\n */\nexport type CmcdStreamType = CmStreamType;\n"]}
@@ -1,15 +0,0 @@
1
- import { CmStreamingFormat } from '@svta/cml-cta/CmStreamingFormat.js';
2
- /**
3
- * Common Media Client Data Streaming Format
4
- *
5
- *
6
- * @enum
7
- *
8
- * @beta
9
- */
10
- export declare const CmcdStreamingFormat: typeof CmStreamingFormat;
11
- /**
12
- * @beta
13
- */
14
- export type CmcdStreamingFormat = CmStreamingFormat;
15
- //# sourceMappingURL=CmcdStreamingFormat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CmcdStreamingFormat.d.ts","sourceRoot":"","sources":["../src/CmcdStreamingFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAwB,OAAO,iBAAiB,CAAC;AAEjF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC"}
@@ -1,11 +0,0 @@
1
- import { CmStreamingFormat } from '@svta/cml-cta/CmStreamingFormat.js';
2
- /**
3
- * Common Media Client Data Streaming Format
4
- *
5
- *
6
- * @enum
7
- *
8
- * @beta
9
- */
10
- export const CmcdStreamingFormat = CmStreamingFormat;
11
- //# sourceMappingURL=CmcdStreamingFormat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CmcdStreamingFormat.js","sourceRoot":"","sources":["../src/CmcdStreamingFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAA6C,CAAC","sourcesContent":["import { CmStreamingFormat } from '@svta/cml-cta/CmStreamingFormat.js';\n\n/**\n * Common Media Client Data Streaming Format\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdStreamingFormat = CmStreamingFormat as typeof CmStreamingFormat;\n\n/**\n * @beta\n */\nexport type CmcdStreamingFormat = CmStreamingFormat;\n"]}
@@ -1,33 +0,0 @@
1
- import type { ValueOf } from '@svta/cml-utils/ValueOf.js';
2
- import { CMCD_HEADERS } from './CMCD_HEADERS.js';
3
- import { CMCD_JSON } from './CMCD_JSON.js';
4
- import { CMCD_QUERY } from './CMCD_QUERY.js';
5
- /**
6
- * CMCD transmission modes.
7
- *
8
- *
9
- * @enum
10
- *
11
- * @beta
12
- */
13
- export declare const CmcdTransmissionMode: {
14
- /**
15
- * JSON
16
- *
17
- * @deprecated JSON transmission mode is deprecated and will be removed in future versions.
18
- */
19
- readonly JSON: typeof CMCD_JSON;
20
- /**
21
- * Query string
22
- */
23
- readonly QUERY: typeof CMCD_QUERY;
24
- /**
25
- * Request headers
26
- */
27
- readonly HEADERS: typeof CMCD_HEADERS;
28
- };
29
- /**
30
- * @beta
31
- */
32
- export type CmcdTransmissionMode = ValueOf<typeof CmcdTransmissionMode>;
33
- //# sourceMappingURL=CmcdTransmissionMode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CmcdTransmissionMode.d.ts","sourceRoot":"","sources":["../src/CmcdTransmissionMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;IAChC;;;;OAIG;mBACgB,OAAO,SAAS;IAEnC;;OAEG;oBACkB,OAAO,UAAU;IAEtC;;OAEG;sBACsB,OAAO,YAAY;CAEnC,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,28 +0,0 @@
1
- import { CMCD_HEADERS } from './CMCD_HEADERS.js';
2
- import { CMCD_JSON } from './CMCD_JSON.js';
3
- import { CMCD_QUERY } from './CMCD_QUERY.js';
4
- /**
5
- * CMCD transmission modes.
6
- *
7
- *
8
- * @enum
9
- *
10
- * @beta
11
- */
12
- export const CmcdTransmissionMode = {
13
- /**
14
- * JSON
15
- *
16
- * @deprecated JSON transmission mode is deprecated and will be removed in future versions.
17
- */
18
- JSON: CMCD_JSON,
19
- /**
20
- * Query string
21
- */
22
- QUERY: CMCD_QUERY,
23
- /**
24
- * Request headers
25
- */
26
- HEADERS: CMCD_HEADERS,
27
- };
28
- //# sourceMappingURL=CmcdTransmissionMode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CmcdTransmissionMode.js","sourceRoot":"","sources":["../src/CmcdTransmissionMode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC;;;;OAIG;IACH,IAAI,EAAE,SAA6B;IAEnC;;OAEG;IACH,KAAK,EAAE,UAA+B;IAEtC;;OAEG;IACH,OAAO,EAAE,YAAmC;CAEnC,CAAC","sourcesContent":["import type { ValueOf } from '@svta/cml-utils/ValueOf.js';\nimport { CMCD_HEADERS } from './CMCD_HEADERS.js';\nimport { CMCD_JSON } from './CMCD_JSON.js';\nimport { CMCD_QUERY } from './CMCD_QUERY.js';\n\n/**\n * CMCD transmission modes.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const CmcdTransmissionMode = {\n\t/**\n\t * JSON\n\t *\n\t * @deprecated JSON transmission mode is deprecated and will be removed in future versions.\n\t */\n\tJSON: CMCD_JSON as typeof CMCD_JSON,\n\n\t/**\n\t * Query string\n\t */\n\tQUERY: CMCD_QUERY as typeof CMCD_QUERY,\n\n\t/**\n\t * Request headers\n\t */\n\tHEADERS: CMCD_HEADERS as typeof CMCD_HEADERS,\n\n} as const;\n\n/**\n * @beta\n */\nexport type CmcdTransmissionMode = ValueOf<typeof CmcdTransmissionMode>;\n"]}
@@ -1,13 +0,0 @@
1
- import type { SfItem } from '@svta/cml-structured-field-values/SfItem.js';
2
- import type { SfToken } from '@svta/cml-structured-field-values/SfToken.js';
3
- import type { CmcdObjectType } from './CmcdObjectType.js';
4
- import type { CmcdStreamType } from './CmcdStreamType.js';
5
- import type { CmcdStreamingFormat } from './CmcdStreamingFormat.js';
6
- /**
7
- * CMCD Value
8
- *
9
- *
10
- * @beta
11
- */
12
- export type CmcdValue = CmcdObjectType | CmcdStreamingFormat | CmcdStreamType | string | string[] | number | number[] | boolean | symbol | SfToken | SfItem | SfItem[];
13
- //# sourceMappingURL=CmcdValue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CmcdValue.d.ts","sourceRoot":"","sources":["../src/CmcdValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6CAA6C,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAClB,cAAc,GACd,mBAAmB,GACnB,cAAc,GACd,MAAM,GACN,MAAM,EAAE,GACR,MAAM,GACN,MAAM,EAAE,GACR,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,EAAE,CAAC"}
package/dist/CmcdValue.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=CmcdValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CmcdValue.js","sourceRoot":"","sources":["../src/CmcdValue.ts"],"names":[],"mappings":"","sourcesContent":["import type { SfItem } from '@svta/cml-structured-field-values/SfItem.js';\nimport type { SfToken } from '@svta/cml-structured-field-values/SfToken.js';\nimport type { CmcdObjectType } from './CmcdObjectType.js';\nimport type { CmcdStreamType } from './CmcdStreamType.js';\nimport type { CmcdStreamingFormat } from './CmcdStreamingFormat.js';\n\n/**\n * CMCD Value\n *\n *\n * @beta\n */\nexport type CmcdValue =\n\t| CmcdObjectType\n\t| CmcdStreamingFormat\n\t| CmcdStreamType\n\t| string\n\t| string[]\n\t| number\n\t| number[]\n\t| boolean\n\t| symbol\n\t| SfToken\n\t| SfItem\n\t| SfItem[];\n"]}
@@ -1,19 +0,0 @@
1
- import type { Cmcd } from './Cmcd.js';
2
- import type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';
3
- /**
4
- * Append CMCD query args to a header object.
5
- *
6
- * @param headers - The headers to append to.
7
- * @param cmcd - The CMCD object to append.
8
- * @param options - Encode options.
9
- *
10
- * @returns The headers with the CMCD header shards appended.
11
- *
12
- *
13
- * @beta
14
- *
15
- * @example
16
- * {@includeCode ../test/appendCmcdHeaders.test.ts#example}
17
- */
18
- export declare function appendCmcdHeaders(headers: Record<string, string>, cmcd: Cmcd, options?: CmcdEncodeOptions): Record<string, string>;
19
- //# sourceMappingURL=appendCmcdHeaders.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appendCmcdHeaders.d.ts","sourceRoot":"","sources":["../src/appendCmcdHeaders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAElI"}
@@ -1,20 +0,0 @@
1
- import { toCmcdHeaders } from './toCmcdHeaders.js';
2
- /**
3
- * Append CMCD query args to a header object.
4
- *
5
- * @param headers - The headers to append to.
6
- * @param cmcd - The CMCD object to append.
7
- * @param options - Encode options.
8
- *
9
- * @returns The headers with the CMCD header shards appended.
10
- *
11
- *
12
- * @beta
13
- *
14
- * @example
15
- * {@includeCode ../test/appendCmcdHeaders.test.ts#example}
16
- */
17
- export function appendCmcdHeaders(headers, cmcd, options) {
18
- return Object.assign(headers, toCmcdHeaders(cmcd, options));
19
- }
20
- //# sourceMappingURL=appendCmcdHeaders.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appendCmcdHeaders.js","sourceRoot":"","sources":["../src/appendCmcdHeaders.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA+B,EAAE,IAAU,EAAE,OAA2B;IACzG,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import type { Cmcd } from './Cmcd.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport { toCmcdHeaders } from './toCmcdHeaders.js';\n\n/**\n * Append CMCD query args to a header object.\n *\n * @param headers - The headers to append to.\n * @param cmcd - The CMCD object to append.\n * @param options - Encode options.\n *\n * @returns The headers with the CMCD header shards appended.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/appendCmcdHeaders.test.ts#example}\n */\nexport function appendCmcdHeaders(headers: Record<string, string>, cmcd: Cmcd, options?: CmcdEncodeOptions): Record<string, string> {\n\treturn Object.assign(headers, toCmcdHeaders(cmcd, options));\n}\n"]}
@@ -1,19 +0,0 @@
1
- import type { Cmcd } from './Cmcd.js';
2
- import type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';
3
- /**
4
- * Append CMCD query args to a URL.
5
- *
6
- * @param url - The URL to append to.
7
- * @param cmcd - The CMCD object to append.
8
- * @param options - Options for encoding the CMCD object.
9
- *
10
- * @returns The URL with the CMCD query args appended.
11
- *
12
- *
13
- * @beta
14
- *
15
- * @example
16
- * {@includeCode ../test/appendCmcdQuery.test.ts#example}
17
- */
18
- export declare function appendCmcdQuery(url: string, cmcd: Cmcd, options?: CmcdEncodeOptions): string;
19
- //# sourceMappingURL=appendCmcdQuery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appendCmcdQuery.d.ts","sourceRoot":"","sources":["../src/appendCmcdQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAKhE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAe5F"}
@@ -1,31 +0,0 @@
1
- import { toCmcdQuery } from './toCmcdQuery.js';
2
- const REGEX = /CMCD=[^&#]+/;
3
- /**
4
- * Append CMCD query args to a URL.
5
- *
6
- * @param url - The URL to append to.
7
- * @param cmcd - The CMCD object to append.
8
- * @param options - Options for encoding the CMCD object.
9
- *
10
- * @returns The URL with the CMCD query args appended.
11
- *
12
- *
13
- * @beta
14
- *
15
- * @example
16
- * {@includeCode ../test/appendCmcdQuery.test.ts#example}
17
- */
18
- export function appendCmcdQuery(url, cmcd, options) {
19
- // TODO: Replace with URLSearchParams once we drop Safari < 10.1 & Chrome < 49 support.
20
- // https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
21
- const query = toCmcdQuery(cmcd, options);
22
- if (!query) {
23
- return url;
24
- }
25
- if (REGEX.test(url)) {
26
- return url.replace(REGEX, query);
27
- }
28
- const separator = url.includes('?') ? '&' : '?';
29
- return `${url}${separator}${query}`;
30
- }
31
- //# sourceMappingURL=appendCmcdQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appendCmcdQuery.js","sourceRoot":"","sources":["../src/appendCmcdQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,KAAK,GAAG,aAAa,CAAC;AAE5B;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,IAAU,EAAE,OAA2B;IACnF,uFAAuF;IACvF,mEAAmE;IAEnE,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,GAAG,CAAC;IACZ,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAChD,OAAO,GAAG,GAAG,GAAG,SAAS,GAAG,KAAK,EAAE,CAAC;AACrC,CAAC","sourcesContent":["import type { Cmcd } from './Cmcd.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport { toCmcdQuery } from './toCmcdQuery.js';\n\nconst REGEX = /CMCD=[^&#]+/;\n\n/**\n * Append CMCD query args to a URL.\n *\n * @param url - The URL to append to.\n * @param cmcd - The CMCD object to append.\n * @param options - Options for encoding the CMCD object.\n *\n * @returns The URL with the CMCD query args appended.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/appendCmcdQuery.test.ts#example}\n */\nexport function appendCmcdQuery(url: string, cmcd: Cmcd, options?: CmcdEncodeOptions): string {\n\t// TODO: Replace with URLSearchParams once we drop Safari < 10.1 & Chrome < 49 support.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams\n\n\tconst query = toCmcdQuery(cmcd, options);\n\tif (!query) {\n\t\treturn url;\n\t}\n\n\tif (REGEX.test(url)) {\n\t\treturn url.replace(REGEX, query);\n\t}\n\n\tconst separator = url.includes('?') ? '&' : '?';\n\treturn `${url}${separator}${query}`;\n}\n"]}
@@ -1,16 +0,0 @@
1
- import type { CmcdData } from './CmcdData.js';
2
- /**
3
- * Decode a CMCD string to an object.
4
- *
5
- * @param cmcd - The CMCD string to decode.
6
- *
7
- * @returns The decoded CMCD object.
8
- *
9
- *
10
- * @beta
11
- *
12
- * @example
13
- * {@includeCode ../test/decodeCmcd.test.ts#example}
14
- */
15
- export declare function decodeCmcd<T extends CmcdData = CmcdData>(cmcd: string): T;
16
- //# sourceMappingURL=decodeCmcd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decodeCmcd.d.ts","sourceRoot":"","sources":["../src/decodeCmcd.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA6B9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAazE"}
@@ -1,45 +0,0 @@
1
- import { SfItem } from '@svta/cml-structured-field-values/SfItem.js';
2
- import { decodeSfDict } from '@svta/cml-structured-field-values/decodeSfDict.js';
3
- import { symbolToStr } from '@svta/cml-structured-field-values/utils/symbolToStr.js';
4
- function reduceValue(value) {
5
- if (Array.isArray(value)) {
6
- return value.map(reduceValue);
7
- }
8
- if (typeof value === 'symbol') {
9
- return symbolToStr(value);
10
- }
11
- if (value instanceof SfItem && !value.params) {
12
- return reduceValue(value.value);
13
- }
14
- if (typeof value === 'string') {
15
- return decodeURIComponent(value);
16
- }
17
- return value;
18
- }
19
- ;
20
- /**
21
- * Decode a CMCD string to an object.
22
- *
23
- * @param cmcd - The CMCD string to decode.
24
- *
25
- * @returns The decoded CMCD object.
26
- *
27
- *
28
- * @beta
29
- *
30
- * @example
31
- * {@includeCode ../test/decodeCmcd.test.ts#example}
32
- */
33
- export function decodeCmcd(cmcd) {
34
- if (!cmcd) {
35
- return {};
36
- }
37
- const sfDict = decodeSfDict(cmcd);
38
- return Object
39
- .entries(sfDict)
40
- .reduce((acc, [key, item]) => {
41
- acc[key] = reduceValue(item.value);
42
- return acc;
43
- }, {});
44
- }
45
- //# sourceMappingURL=decodeCmcd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decodeCmcd.js","sourceRoot":"","sources":["../src/decodeCmcd.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,6CAA6C,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,wDAAwD,CAAC;AAUrF,SAAS,WAAW,CAAC,KAAuB;IAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,KAAK,YAAY,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAC9C,OAAO,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,KAA0B,CAAC;AACnC,CAAC;AAAA,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,UAAU,CAAgC,IAAY;IACrE,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,EAAO,CAAC;IAChB,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAElC,OAAO,MAAM;SACX,OAAO,CAAS,MAAa,CAAC;SAC9B,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;QAC5B,GAAG,CAAC,GAAc,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAe,CAAC;QAC5D,OAAO,GAAG,CAAC;IACZ,CAAC,EAAE,EAAO,CAAC,CAAC;AACd,CAAC","sourcesContent":["import type { SfBareItem } from '@svta/cml-structured-field-values/SfBareItem.js';\nimport { SfItem } from '@svta/cml-structured-field-values/SfItem.js';\nimport { decodeSfDict } from '@svta/cml-structured-field-values/decodeSfDict.js';\nimport { symbolToStr } from '@svta/cml-structured-field-values/utils/symbolToStr.js';\nimport type { CmcdData } from './CmcdData.js';\nimport type { CmcdValue } from './CmcdValue.js';\n\n// Define the input type for reduceValue\ntype ReduceValueInput = SfBareItem | SfItem | ReduceValueInput[];\n\n// Define the output type for reduceValue - matches what CMCD values can be, including arrays\ntype ReduceValueOutput = CmcdValue | ReduceValueOutput[];\n\nfunction reduceValue(value: ReduceValueInput): ReduceValueOutput {\n\tif (Array.isArray(value)) {\n\t\treturn value.map(reduceValue);\n\t}\n\n\tif (typeof value === 'symbol') {\n\t\treturn symbolToStr(value);\n\t}\n\n\tif (value instanceof SfItem && !value.params) {\n\t\treturn reduceValue(value.value);\n\t}\n\n\tif (typeof value === 'string') {\n\t\treturn decodeURIComponent(value);\n\t}\n\n\treturn value as ReduceValueOutput;\n};\n\n/**\n * Decode a CMCD string to an object.\n *\n * @param cmcd - The CMCD string to decode.\n *\n * @returns The decoded CMCD object.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/decodeCmcd.test.ts#example}\n */\nexport function decodeCmcd<T extends CmcdData = CmcdData>(cmcd: string): T {\n\tif (!cmcd) {\n\t\treturn {} as T;\n\t}\n\n\tconst sfDict = decodeSfDict(cmcd);\n\n\treturn Object\n\t\t.entries<SfItem>(sfDict as any)\n\t\t.reduce((acc, [key, item]) => {\n\t\t\tacc[key as keyof T] = reduceValue(item.value) as T[keyof T];\n\t\t\treturn acc;\n\t\t}, {} as T);\n}\n"]}
@@ -1,18 +0,0 @@
1
- import type { CmcdData } from './CmcdData.js';
2
- import type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';
3
- /**
4
- * Encode a CMCD object to a string.
5
- *
6
- * @param cmcd - The CMCD object to encode.
7
- * @param options - Options for encoding.
8
- *
9
- * @returns The encoded CMCD string.
10
- *
11
- *
12
- * @beta
13
- *
14
- * @example
15
- * {@includeCode ../test/encodeCmcd.test.ts#example}
16
- */
17
- export declare function encodeCmcd(cmcd: CmcdData, options?: CmcdEncodeOptions): string;
18
- //# sourceMappingURL=encodeCmcd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encodeCmcd.d.ts","sourceRoot":"","sources":["../src/encodeCmcd.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAMlF"}
@@ -1,23 +0,0 @@
1
- import { encodeSfDict } from '@svta/cml-structured-field-values/encodeSfDict.js';
2
- import { prepareCmcdData } from './prepareCmcdData.js';
3
- /**
4
- * Encode a CMCD object to a string.
5
- *
6
- * @param cmcd - The CMCD object to encode.
7
- * @param options - Options for encoding.
8
- *
9
- * @returns The encoded CMCD string.
10
- *
11
- *
12
- * @beta
13
- *
14
- * @example
15
- * {@includeCode ../test/encodeCmcd.test.ts#example}
16
- */
17
- export function encodeCmcd(cmcd, options = {}) {
18
- if (!cmcd) {
19
- return '';
20
- }
21
- return encodeSfDict(prepareCmcdData(cmcd, options), { whitespace: false });
22
- }
23
- //# sourceMappingURL=encodeCmcd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encodeCmcd.js","sourceRoot":"","sources":["../src/encodeCmcd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAGjF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,UAAU,CAAC,IAAc,EAAE,UAA6B,EAAE;IACzE,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACX,CAAC;IAED,OAAO,YAAY,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import { encodeSfDict } from '@svta/cml-structured-field-values/encodeSfDict.js';\nimport type { CmcdData } from './CmcdData.js';\nimport type { CmcdEncodeOptions } from './CmcdEncodeOptions.js';\nimport { prepareCmcdData } from './prepareCmcdData.js';\n\n/**\n * Encode a CMCD object to a string.\n *\n * @param cmcd - The CMCD object to encode.\n * @param options - Options for encoding.\n *\n * @returns The encoded CMCD string.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/encodeCmcd.test.ts#example}\n */\nexport function encodeCmcd(cmcd: CmcdData, options: CmcdEncodeOptions = {}): string {\n\tif (!cmcd) {\n\t\treturn '';\n\t}\n\n\treturn encodeSfDict(prepareCmcdData(cmcd, options), { whitespace: false });\n}\n"]}
@@ -1,16 +0,0 @@
1
- import type { CmcdData } from './CmcdData.js';
2
- /**
3
- * Decode CMCD data from request headers.
4
- *
5
- * @param headers - The request headers to decode.
6
- *
7
- * @returns The decoded CMCD data.
8
- *
9
- *
10
- * @beta
11
- *
12
- * @example
13
- * {@includeCode ../test/fromCmcdHeaders.test.ts#example}
14
- */
15
- export declare function fromCmcdHeaders(headers: Record<string, string> | Headers): CmcdData;
16
- //# sourceMappingURL=fromCmcdHeaders.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fromCmcdHeaders.d.ts","sourceRoot":"","sources":["../src/fromCmcdHeaders.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAK9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,GAAG,QAAQ,CASnF"}
@@ -1,29 +0,0 @@
1
- import { CMCD_OBJECT } from './CMCD_OBJECT.js';
2
- import { CMCD_REQUEST } from './CMCD_REQUEST.js';
3
- import { CMCD_SESSION } from './CMCD_SESSION.js';
4
- import { CMCD_STATUS } from './CMCD_STATUS.js';
5
- import { decodeCmcd } from './decodeCmcd.js';
6
- const keys = [CMCD_OBJECT, CMCD_REQUEST, CMCD_SESSION, CMCD_STATUS];
7
- /**
8
- * Decode CMCD data from request headers.
9
- *
10
- * @param headers - The request headers to decode.
11
- *
12
- * @returns The decoded CMCD data.
13
- *
14
- *
15
- * @beta
16
- *
17
- * @example
18
- * {@includeCode ../test/fromCmcdHeaders.test.ts#example}
19
- */
20
- export function fromCmcdHeaders(headers) {
21
- if (!(headers instanceof Headers)) {
22
- headers = new Headers(headers);
23
- }
24
- return keys.reduce((acc, key) => {
25
- const value = headers.get(key);
26
- return Object.assign(acc, decodeCmcd(value));
27
- }, {});
28
- }
29
- //# sourceMappingURL=fromCmcdHeaders.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fromCmcdHeaders.js","sourceRoot":"","sources":["../src/fromCmcdHeaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAAC,OAAyC;IACxE,IAAI,CAAC,CAAC,OAAO,YAAY,OAAO,CAAC,EAAE,CAAC;QACnC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,KAAe,CAAC,CAAC,CAAC;IACxD,CAAC,EAAE,EAAc,CAAC,CAAC;AACpB,CAAC","sourcesContent":["import { CMCD_OBJECT } from './CMCD_OBJECT.js';\nimport { CMCD_REQUEST } from './CMCD_REQUEST.js';\nimport { CMCD_SESSION } from './CMCD_SESSION.js';\nimport { CMCD_STATUS } from './CMCD_STATUS.js';\nimport type { CmcdData } from './CmcdData.js';\nimport { decodeCmcd } from './decodeCmcd.js';\n\nconst keys = [CMCD_OBJECT, CMCD_REQUEST, CMCD_SESSION, CMCD_STATUS];\n\n/**\n * Decode CMCD data from request headers.\n *\n * @param headers - The request headers to decode.\n *\n * @returns The decoded CMCD data.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/fromCmcdHeaders.test.ts#example}\n */\nexport function fromCmcdHeaders(headers: Record<string, string> | Headers): CmcdData {\n\tif (!(headers instanceof Headers)) {\n\t\theaders = new Headers(headers);\n\t}\n\n\treturn keys.reduce((acc, key) => {\n\t\tconst value = headers.get(key);\n\t\treturn Object.assign(acc, decodeCmcd(value as string));\n\t}, {} as CmcdData);\n}\n"]}
@@ -1,16 +0,0 @@
1
- import type { Cmcd } from './Cmcd.js';
2
- /**
3
- * Decode CMCD data from a query string.
4
- *
5
- * @param query - The query string to decode.
6
- *
7
- * @returns The decoded CMCD data.
8
- *
9
- *
10
- * @beta
11
- *
12
- * @example
13
- * {@includeCode ../test/fromCmcdQuery.test.ts#example}
14
- */
15
- export declare function fromCmcdQuery(query: string | URLSearchParams): Cmcd;
16
- //# sourceMappingURL=fromCmcdQuery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fromCmcdQuery.d.ts","sourceRoot":"","sources":["../src/fromCmcdQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAQnE"}
@@ -1,23 +0,0 @@
1
- import { CMCD_PARAM } from './CMCD_PARAM.js';
2
- import { decodeCmcd } from './decodeCmcd.js';
3
- /**
4
- * Decode CMCD data from a query string.
5
- *
6
- * @param query - The query string to decode.
7
- *
8
- * @returns The decoded CMCD data.
9
- *
10
- *
11
- * @beta
12
- *
13
- * @example
14
- * {@includeCode ../test/fromCmcdQuery.test.ts#example}
15
- */
16
- export function fromCmcdQuery(query) {
17
- if (typeof query === 'string') {
18
- query = new URLSearchParams(query);
19
- }
20
- const value = query.get(CMCD_PARAM);
21
- return decodeCmcd(value);
22
- }
23
- //# sourceMappingURL=fromCmcdQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fromCmcdQuery.js","sourceRoot":"","sources":["../src/fromCmcdQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,KAA+B;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,KAAK,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEpC,OAAO,UAAU,CAAC,KAAe,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import type { Cmcd } from './Cmcd.js';\nimport { CMCD_PARAM } from './CMCD_PARAM.js';\nimport { decodeCmcd } from './decodeCmcd.js';\n\n/**\n * Decode CMCD data from a query string.\n *\n * @param query - The query string to decode.\n *\n * @returns The decoded CMCD data.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/fromCmcdQuery.test.ts#example}\n */\nexport function fromCmcdQuery(query: string | URLSearchParams): Cmcd {\n\tif (typeof query === 'string') {\n\t\tquery = new URLSearchParams(query);\n\t}\n\n\tconst value = query.get(CMCD_PARAM);\n\n\treturn decodeCmcd(value as string);\n}\n"]}
@@ -1,16 +0,0 @@
1
- import type { Cmcd } from './Cmcd.js';
2
- /**
3
- * Decode CMCD data from a url encoded string.
4
- *
5
- * @param url - The url encoded string to decode.
6
- *
7
- * @returns The decoded CMCD data.
8
- *
9
- *
10
- * @beta
11
- *
12
- * @example
13
- * {@includeCode ../test/fromCmcdUrl.test.ts#example}
14
- */
15
- export declare function fromCmcdUrl(url: string): Cmcd;
16
- //# sourceMappingURL=fromCmcdUrl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fromCmcdUrl.d.ts","sourceRoot":"","sources":["../src/fromCmcdUrl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE7C"}
@@ -1,18 +0,0 @@
1
- import { decodeCmcd } from './decodeCmcd.js';
2
- /**
3
- * Decode CMCD data from a url encoded string.
4
- *
5
- * @param url - The url encoded string to decode.
6
- *
7
- * @returns The decoded CMCD data.
8
- *
9
- *
10
- * @beta
11
- *
12
- * @example
13
- * {@includeCode ../test/fromCmcdUrl.test.ts#example}
14
- */
15
- export function fromCmcdUrl(url) {
16
- return decodeCmcd(decodeURIComponent(url.replace(/^CMCD=/, '')));
17
- }
18
- //# sourceMappingURL=fromCmcdUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fromCmcdUrl.js","sourceRoot":"","sources":["../src/fromCmcdUrl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACtC,OAAO,UAAU,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import type { Cmcd } from './Cmcd.js';\nimport { decodeCmcd } from './decodeCmcd.js';\n\n/**\n * Decode CMCD data from a url encoded string.\n *\n * @param url - The url encoded string to decode.\n *\n * @returns The decoded CMCD data.\n *\n *\n * @beta\n *\n * @example\n * {@includeCode ../test/fromCmcdUrl.test.ts#example}\n */\nexport function fromCmcdUrl(url: string): Cmcd {\n\treturn decodeCmcd(decodeURIComponent(url.replace(/^CMCD=/, '')));\n}\n"]}
@@ -1,16 +0,0 @@
1
- import type { CmcdData } from './CmcdData.js';
2
- import { CmcdHeaderField } from './CmcdHeaderField.js';
3
- import type { CmcdHeaderMap } from './CmcdHeaderMap.js';
4
- /**
5
- * Group a CMCD data object into header shards
6
- *
7
- * @param cmcd - The CMCD data object to convert.
8
- * @param customHeaderMap - A map of CMCD header fields to custom CMCD keys.
9
- *
10
- * @returns The CMCD header shards.
11
- *
12
- *
13
- * @beta
14
- */
15
- export declare function groupCmcdHeaders(cmcd: CmcdData, customHeaderMap?: Partial<CmcdHeaderMap>): Record<CmcdHeaderField, CmcdData>;
16
- //# sourceMappingURL=groupCmcdHeaders.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"groupCmcdHeaders.d.ts","sourceRoot":"","sources":["../src/groupCmcdHeaders.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAWxD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,CAgB5H"}
@@ -1,37 +0,0 @@
1
- import { CMCD_HEADER_MAP } from './CMCD_HEADER_MAP.js';
2
- import { CmcdHeaderField } from './CmcdHeaderField.js';
3
- function createHeaderMap(headerMap) {
4
- return Object.keys(headerMap)
5
- .reduce((acc, field) => {
6
- var _a;
7
- (_a = headerMap[field]) === null || _a === void 0 ? void 0 : _a.forEach(key => acc[key] = field);
8
- return acc;
9
- }, {});
10
- }
11
- /**
12
- * Group a CMCD data object into header shards
13
- *
14
- * @param cmcd - The CMCD data object to convert.
15
- * @param customHeaderMap - A map of CMCD header fields to custom CMCD keys.
16
- *
17
- * @returns The CMCD header shards.
18
- *
19
- *
20
- * @beta
21
- */
22
- export function groupCmcdHeaders(cmcd, customHeaderMap) {
23
- const result = {};
24
- if (!cmcd) {
25
- return result;
26
- }
27
- const keys = Object.keys(cmcd);
28
- const custom = customHeaderMap ? createHeaderMap(customHeaderMap) : {};
29
- return keys.reduce((acc, key) => {
30
- var _a;
31
- const field = CMCD_HEADER_MAP[key] || custom[key] || CmcdHeaderField.REQUEST;
32
- const data = (_a = acc[field]) !== null && _a !== void 0 ? _a : (acc[field] = {});
33
- data[key] = cmcd[key];
34
- return acc;
35
- }, result);
36
- }
37
- //# sourceMappingURL=groupCmcdHeaders.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"groupCmcdHeaders.js","sourceRoot":"","sources":["../src/groupCmcdHeaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIvD,SAAS,eAAe,CAAC,SAAiC;IACzD,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;SAC3B,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;;QACtB,MAAA,SAAS,CAAC,KAAwB,CAAC,0CAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAwB,CAAC,CAAC;QACzF,OAAO,GAAG,CAAC;IACZ,CAAC,EAAE,EAAsC,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAc,EAAE,eAAwC;IACxF,MAAM,MAAM,GAAG,EAAuC,CAAC;IAEvD,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,MAAM,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAc,CAAC;IAC5C,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAsC,CAAC;IAE3G,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAsC,EAAE,GAAY,EAAE,EAAE;;QAC3E,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC;QAC7E,MAAM,IAAI,SAAG,GAAG,CAAC,KAAK,qCAAT,GAAG,CAAC,KAAK,IAAM,EAAE,CAAA,CAAC;QAC9B,IAAY,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/B,OAAO,GAAG,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import { CMCD_HEADER_MAP } from './CMCD_HEADER_MAP.js';\nimport type { CmcdData } from './CmcdData.js';\nimport { CmcdHeaderField } from './CmcdHeaderField.js';\nimport type { CmcdHeaderMap } from './CmcdHeaderMap.js';\nimport type { CmcdKey } from './CmcdKey.js';\n\nfunction createHeaderMap(headerMap: Partial<CmcdHeaderMap>): Record<CmcdKey, CmcdHeaderField> {\n\treturn Object.keys(headerMap)\n\t\t.reduce((acc, field) => {\n\t\t\theaderMap[field as CmcdHeaderField]?.forEach(key => acc[key] = field as CmcdHeaderField);\n\t\t\treturn acc;\n\t\t}, {} as Record<CmcdKey, CmcdHeaderField>);\n}\n\n/**\n * Group a CMCD data object into header shards\n *\n * @param cmcd - The CMCD data object to convert.\n * @param customHeaderMap - A map of CMCD header fields to custom CMCD keys.\n *\n * @returns The CMCD header shards.\n *\n *\n * @beta\n */\nexport function groupCmcdHeaders(cmcd: CmcdData, customHeaderMap?: Partial<CmcdHeaderMap>): Record<CmcdHeaderField, CmcdData> {\n\tconst result = {} as Record<CmcdHeaderField, CmcdData>;\n\n\tif (!cmcd) {\n\t\treturn result;\n\t}\n\n\tconst keys = Object.keys(cmcd) as CmcdKey[];\n\tconst custom = customHeaderMap ? createHeaderMap(customHeaderMap) : {} as Record<CmcdKey, CmcdHeaderField>;\n\n\treturn keys.reduce((acc: Record<CmcdHeaderField, CmcdData>, key: CmcdKey) => {\n\t\tconst field = CMCD_HEADER_MAP[key] || custom[key] || CmcdHeaderField.REQUEST;\n\t\tconst data = acc[field] ??= {};\n\t\t(data as any)[key] = cmcd[key];\n\t\treturn acc;\n\t}, result);\n}\n"]}
@@ -1,13 +0,0 @@
1
- import type { CmcdKey } from './CmcdKey.js';
2
- /**
3
- * Check if a key is a custom key.
4
- *
5
- * @param key - The key to check.
6
- *
7
- * @returns `true` if the key is a custom key, `false` otherwise.
8
- *
9
- *
10
- * @beta
11
- */
12
- export declare function isCmcdCustomKey(key: CmcdKey): boolean;
13
- //# sourceMappingURL=isCmcdCustomKey.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isCmcdCustomKey.d.ts","sourceRoot":"","sources":["../src/isCmcdCustomKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAErD"}