@svta/cml-cmsd 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +22 -37
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -16
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,10 @@ import { SfItem, SfToken } from "@svta/cml-structured-field-values";
|
|
|
3
3
|
import { ValueOf } from "@svta/cml-utils";
|
|
4
4
|
|
|
5
5
|
//#region src/CMSD_DYNAMIC.d.ts
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* CMSD dynamic header name.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
* @beta
|
|
9
|
+
* @public
|
|
12
10
|
*/
|
|
13
11
|
declare const CMSD_DYNAMIC = "CMSD-Dynamic";
|
|
14
12
|
//#endregion
|
|
@@ -16,8 +14,7 @@ declare const CMSD_DYNAMIC = "CMSD-Dynamic";
|
|
|
16
14
|
/**
|
|
17
15
|
* CMSD static header name.
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
* @beta
|
|
17
|
+
* @public
|
|
21
18
|
*/
|
|
22
19
|
declare const CMSD_STATIC = "CMSD-Static";
|
|
23
20
|
//#endregion
|
|
@@ -25,8 +22,7 @@ declare const CMSD_STATIC = "CMSD-Static";
|
|
|
25
22
|
/**
|
|
26
23
|
* CMSD Version 1
|
|
27
24
|
*
|
|
28
|
-
*
|
|
29
|
-
* @beta
|
|
25
|
+
* @public
|
|
30
26
|
*/
|
|
31
27
|
declare const CMSD_V1 = 1;
|
|
32
28
|
//#endregion
|
|
@@ -37,8 +33,7 @@ declare const CMSD_V1 = 1;
|
|
|
37
33
|
* revisions to this specification. Clients SHOULD use a reverse-DNS
|
|
38
34
|
* syntax when defining their own prefix.
|
|
39
35
|
*
|
|
40
|
-
*
|
|
41
|
-
* @beta
|
|
36
|
+
* @public
|
|
42
37
|
*/
|
|
43
38
|
type CmsdCustomKey = `${string}-${string}`;
|
|
44
39
|
//#endregion
|
|
@@ -49,11 +44,11 @@ type CmsdCustomKey = `${string}-${string}`;
|
|
|
49
44
|
*
|
|
50
45
|
* @enum
|
|
51
46
|
*
|
|
52
|
-
* @
|
|
47
|
+
* @public
|
|
53
48
|
*/
|
|
54
49
|
declare const CmsdObjectType: typeof CmObjectType;
|
|
55
50
|
/**
|
|
56
|
-
* @
|
|
51
|
+
* @public
|
|
57
52
|
*/
|
|
58
53
|
type CmsdObjectType = CmObjectType;
|
|
59
54
|
//#endregion
|
|
@@ -64,11 +59,11 @@ type CmsdObjectType = CmObjectType;
|
|
|
64
59
|
*
|
|
65
60
|
* @enum
|
|
66
61
|
*
|
|
67
|
-
* @
|
|
62
|
+
* @public
|
|
68
63
|
*/
|
|
69
64
|
declare const CmsdStreamType: typeof CmStreamType;
|
|
70
65
|
/**
|
|
71
|
-
* @
|
|
66
|
+
* @public
|
|
72
67
|
*/
|
|
73
68
|
type CmsdStreamType = CmStreamType;
|
|
74
69
|
//#endregion
|
|
@@ -79,11 +74,11 @@ type CmsdStreamType = CmStreamType;
|
|
|
79
74
|
*
|
|
80
75
|
* @enum
|
|
81
76
|
*
|
|
82
|
-
* @
|
|
77
|
+
* @public
|
|
83
78
|
*/
|
|
84
79
|
declare const CmsdStreamingFormat: typeof CmStreamingFormat;
|
|
85
80
|
/**
|
|
86
|
-
* @
|
|
81
|
+
* @public
|
|
87
82
|
*/
|
|
88
83
|
type CmsdStreamingFormat = CmStreamingFormat;
|
|
89
84
|
//#endregion
|
|
@@ -91,8 +86,7 @@ type CmsdStreamingFormat = CmStreamingFormat;
|
|
|
91
86
|
/**
|
|
92
87
|
* CMSD Value
|
|
93
88
|
*
|
|
94
|
-
*
|
|
95
|
-
* @beta
|
|
89
|
+
* @public
|
|
96
90
|
*/
|
|
97
91
|
type CmsdValue = CmsdObjectType | CmsdStreamingFormat | CmsdStreamType | string | number | boolean | symbol | SfToken;
|
|
98
92
|
//#endregion
|
|
@@ -102,8 +96,7 @@ type CmsdValue = CmsdObjectType | CmsdStreamingFormat | CmsdStreamType | string
|
|
|
102
96
|
*
|
|
103
97
|
* @see {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5006-final.pdf|CMSD Spec}
|
|
104
98
|
*
|
|
105
|
-
*
|
|
106
|
-
* @beta
|
|
99
|
+
* @public
|
|
107
100
|
*/
|
|
108
101
|
type CmsdDynamicParams = {
|
|
109
102
|
/**
|
|
@@ -176,8 +169,7 @@ type CmsdDynamicParams = {
|
|
|
176
169
|
*
|
|
177
170
|
* @see {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5006-final.pdf|CMSD Spec}
|
|
178
171
|
*
|
|
179
|
-
*
|
|
180
|
-
* @beta
|
|
172
|
+
* @public
|
|
181
173
|
*/
|
|
182
174
|
type CmsdDynamic = {
|
|
183
175
|
/**
|
|
@@ -194,8 +186,7 @@ type CmsdDynamic = {
|
|
|
194
186
|
/**
|
|
195
187
|
* Options for encoding CMCD values.
|
|
196
188
|
*
|
|
197
|
-
*
|
|
198
|
-
* @beta
|
|
189
|
+
* @public
|
|
199
190
|
*/
|
|
200
191
|
type CmsdEncodeOptions = {
|
|
201
192
|
/**
|
|
@@ -213,7 +204,7 @@ type CmsdEncodeOptions = {
|
|
|
213
204
|
*
|
|
214
205
|
* @enum
|
|
215
206
|
*
|
|
216
|
-
* @
|
|
207
|
+
* @public
|
|
217
208
|
*/
|
|
218
209
|
declare const CmsdHeaderField: {
|
|
219
210
|
/**
|
|
@@ -228,7 +219,7 @@ declare const CmsdHeaderField: {
|
|
|
228
219
|
readonly DYNAMIC: typeof CMSD_DYNAMIC;
|
|
229
220
|
};
|
|
230
221
|
/**
|
|
231
|
-
* @
|
|
222
|
+
* @public
|
|
232
223
|
*/
|
|
233
224
|
type CmsdHeaderField = ValueOf<typeof CmsdHeaderField>;
|
|
234
225
|
//#endregion
|
|
@@ -238,8 +229,7 @@ type CmsdHeaderField = ValueOf<typeof CmsdHeaderField>;
|
|
|
238
229
|
*
|
|
239
230
|
* @see {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5006-final.pdf|CMSD Spec}
|
|
240
231
|
*
|
|
241
|
-
*
|
|
242
|
-
* @beta
|
|
232
|
+
* @public
|
|
243
233
|
*/
|
|
244
234
|
type CmsdStatic = {
|
|
245
235
|
/**
|
|
@@ -390,8 +380,7 @@ type CmsdStatic = {
|
|
|
390
380
|
*
|
|
391
381
|
* @returns The decoded CMSD object.
|
|
392
382
|
*
|
|
393
|
-
*
|
|
394
|
-
* @beta
|
|
383
|
+
* @public
|
|
395
384
|
*/
|
|
396
385
|
declare function decodeCmsdDynamic(cmsd: string): CmsdDynamic[];
|
|
397
386
|
//#endregion
|
|
@@ -403,8 +392,7 @@ declare function decodeCmsdDynamic(cmsd: string): CmsdDynamic[];
|
|
|
403
392
|
*
|
|
404
393
|
* @returns The decoded CMSD object.
|
|
405
394
|
*
|
|
406
|
-
*
|
|
407
|
-
* @beta
|
|
395
|
+
* @public
|
|
408
396
|
*/
|
|
409
397
|
declare function decodeCmsdStatic(cmsd: string): CmsdStatic;
|
|
410
398
|
//#endregion
|
|
@@ -416,8 +404,7 @@ declare function decodeCmsdStatic(cmsd: string): CmsdStatic;
|
|
|
416
404
|
*
|
|
417
405
|
* @returns The encoded CMSD string.
|
|
418
406
|
*
|
|
419
|
-
*
|
|
420
|
-
* @beta
|
|
407
|
+
* @public
|
|
421
408
|
*/
|
|
422
409
|
declare function encodeCmsdDynamic(value: SfItem[]): string;
|
|
423
410
|
/**
|
|
@@ -428,8 +415,7 @@ declare function encodeCmsdDynamic(value: SfItem[]): string;
|
|
|
428
415
|
*
|
|
429
416
|
* @returns The encoded CMSD string.
|
|
430
417
|
*
|
|
431
|
-
*
|
|
432
|
-
* @beta
|
|
418
|
+
* @public
|
|
433
419
|
*/
|
|
434
420
|
declare function encodeCmsdDynamic(value: string, cmsd: CmsdDynamic): string;
|
|
435
421
|
//#endregion
|
|
@@ -442,8 +428,7 @@ declare function encodeCmsdDynamic(value: string, cmsd: CmsdDynamic): string;
|
|
|
442
428
|
*
|
|
443
429
|
* @returns The encoded CMSD string.
|
|
444
430
|
*
|
|
445
|
-
*
|
|
446
|
-
* @beta
|
|
431
|
+
* @public
|
|
447
432
|
*/
|
|
448
433
|
declare function encodeCmsdStatic(cmsd: CmsdStatic, options?: CmsdEncodeOptions): string;
|
|
449
434
|
//#endregion
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/CMSD_DYNAMIC.ts","../src/CMSD_STATIC.ts","../src/CMSD_V1.ts","../src/CmsdCustomKey.ts","../src/CmsdObjectType.ts","../src/CmsdStreamType.ts","../src/CmsdStreamingFormat.ts","../src/CmsdValue.ts","../src/CmsdDynamicParams.ts","../src/CmsdDynamic.ts","../src/CmsdEncodeOptions.ts","../src/CmsdHeaderField.ts","../src/CmsdStatic.ts","../src/decodeCmsdDynamic.ts","../src/decodeCmsdStatic.ts","../src/encodeCmsdDynamic.ts","../src/encodeCmsdStatic.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/CMSD_DYNAMIC.ts","../src/CMSD_STATIC.ts","../src/CMSD_V1.ts","../src/CmsdCustomKey.ts","../src/CmsdObjectType.ts","../src/CmsdStreamType.ts","../src/CmsdStreamingFormat.ts","../src/CmsdValue.ts","../src/CmsdDynamicParams.ts","../src/CmsdDynamic.ts","../src/CmsdEncodeOptions.ts","../src/CmsdHeaderField.ts","../src/CmsdStatic.ts","../src/decodeCmsdDynamic.ts","../src/decodeCmsdStatic.ts","../src/encodeCmsdDynamic.ts","../src/encodeCmsdStatic.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAKa,cAAA,YAAA,GAAA,cAAA;;;;;;;;AAAA,cCAA,WAAA,GDAA,aAAA;;;;;;;;AAAA,cEAA,OAAA,GFAA,CAAA;;;;;;;;AAAb;;;KGGY,aAAA;;;;;;;AHHZ;;;;ACAa,cGKA,cHLA,EAAA,OGKwC,YHLxC;;;;ACAA,KEUD,cAAA,GAAiB,YFVhB;;;;;;;AFAb;;;;ACAa,cIKA,cJLA,EAAA,OIKwC,YJLxC;;;;ACAA,KGUD,cAAA,GAAiB,YHVhB;;;;;;;AFAb;;;;ACAa,cKKA,mBLLA,EAAA,OKKkD,iBLLlD;;;;ACAA,KIUD,mBAAA,GAAsB,iBJVrB;;;;AFAb;;;;ACAa,KMKD,SAAA,GAAY,cNLX,GMK4B,mBNL5B,GMKkD,cNLlD,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,MAAA,GMKwG,ONLxG;;;;;;ADAb;;;;ACAa,KOKD,iBAAA,GPLC;;;;ACAb;UMUS,gBAAgB;;;ALPzB;;;;ACEA;AAKA;;;;ACLA;AAKA;;;;ACLA;AAKA;;;;ACLA;;;;;;;;;ACAA;;;;ACDA;;;;ECJA;;;;ACOA;AAiBA;;;;EChBA;;;;;;;;;;ACDA,CAAA;;;;;;;AbPA;;;KSIY,WAAA;ERJZ;;;;ECAA;;;UOaS;ANVT,CAAA;;;;;;;;AHHa,KUAD,iBAAA,GVAC;;;;ACAb;;;;;;;;ADAA;;;;ACAA;;cUOa;;ATPb;;0BSW+B;;ARR/B;;;;ECEA,SAAa,OAAA,EAAA,OOaoB,YPboB;AAKrD,CAAA;;;;ACLa,KMmBD,eAAA,GAAkB,ONnBuB,CAAA,OMmBR,eNnBQ,CAAA;;;ALLrD;;;;ACAA;;;KWQY,UAAA;EVRZ;;;;ECGA,CAAA,KAAY,ESWH,aTXG,CAAA,ESWa,STXb;;;;ACEZ;AAKA;;;;ACLA;EAKA,EAAA,CAAY,EAAA,MAAA;;;;ACLZ;AAKA;;;;ACLA;EAAwB,EAAA,CAAA,EAAA,MAAA;EAAiB;;;;;;;ACAzC;;;;ACDA;;;;ACJA;;;;ECOA;AAiBA;;;;AChBA;;;EA0GM,CAAA,CAAA,EAAA,MAAA;EAgBA;;;;;;AC3HN;;;;ECAA;;;;ACAA;AAYA;;;;ACTA;;;;;;;;;;;;;;;;;;;;;;;;OJwGM;;;;;;;;;;;;;;;OAgBA;;;;;;;;OASA;;;;;;;;;;;;;;;;;;;;;;;;;;AZ3IN;;;;ACAA;iBYOgB,iBAAA,gBAAiC;;;;;;;AbPjD;;;;ACAA;iBaOgB,gBAAA,gBAAgC;;;;;;AdPhD;;;;ACAA;;iBcOgB,iBAAA,QAAyB;;AbPzC;;;;ACGA;;;;ACEA;AAKY,iBWSI,iBAAA,CXTa,KAAA,EAAA,MAAA,EAAA,IAAA,EWS0B,WXT1B,CAAA,EAAA,MAAA;;;;;;AJV7B;;;;ACAA;;;iBeUgB,gBAAA,OAAuB,sBAAsB"}
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,7 @@ import { SfItem, SfToken, decodeSfDict, decodeSfList, encodeSfDict, encodeSfList
|
|
|
5
5
|
/**
|
|
6
6
|
* CMSD dynamic header name.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* @beta
|
|
8
|
+
* @public
|
|
10
9
|
*/
|
|
11
10
|
const CMSD_DYNAMIC = "CMSD-Dynamic";
|
|
12
11
|
|
|
@@ -15,8 +14,7 @@ const CMSD_DYNAMIC = "CMSD-Dynamic";
|
|
|
15
14
|
/**
|
|
16
15
|
* CMSD static header name.
|
|
17
16
|
*
|
|
18
|
-
*
|
|
19
|
-
* @beta
|
|
17
|
+
* @public
|
|
20
18
|
*/
|
|
21
19
|
const CMSD_STATIC = "CMSD-Static";
|
|
22
20
|
|
|
@@ -25,8 +23,7 @@ const CMSD_STATIC = "CMSD-Static";
|
|
|
25
23
|
/**
|
|
26
24
|
* CMSD Version 1
|
|
27
25
|
*
|
|
28
|
-
*
|
|
29
|
-
* @beta
|
|
26
|
+
* @public
|
|
30
27
|
*/
|
|
31
28
|
const CMSD_V1 = 1;
|
|
32
29
|
|
|
@@ -38,7 +35,7 @@ const CMSD_V1 = 1;
|
|
|
38
35
|
*
|
|
39
36
|
* @enum
|
|
40
37
|
*
|
|
41
|
-
* @
|
|
38
|
+
* @public
|
|
42
39
|
*/
|
|
43
40
|
const CmsdHeaderField = {
|
|
44
41
|
STATIC: CMSD_STATIC,
|
|
@@ -53,7 +50,7 @@ const CmsdHeaderField = {
|
|
|
53
50
|
*
|
|
54
51
|
* @enum
|
|
55
52
|
*
|
|
56
|
-
* @
|
|
53
|
+
* @public
|
|
57
54
|
*/
|
|
58
55
|
const CmsdObjectType = CmObjectType;
|
|
59
56
|
|
|
@@ -65,7 +62,7 @@ const CmsdObjectType = CmObjectType;
|
|
|
65
62
|
*
|
|
66
63
|
* @enum
|
|
67
64
|
*
|
|
68
|
-
* @
|
|
65
|
+
* @public
|
|
69
66
|
*/
|
|
70
67
|
const CmsdStreamingFormat = CmStreamingFormat;
|
|
71
68
|
|
|
@@ -77,7 +74,7 @@ const CmsdStreamingFormat = CmStreamingFormat;
|
|
|
77
74
|
*
|
|
78
75
|
* @enum
|
|
79
76
|
*
|
|
80
|
-
* @
|
|
77
|
+
* @public
|
|
81
78
|
*/
|
|
82
79
|
const CmsdStreamType = CmStreamType;
|
|
83
80
|
|
|
@@ -90,8 +87,7 @@ const CmsdStreamType = CmStreamType;
|
|
|
90
87
|
*
|
|
91
88
|
* @returns The decoded CMSD object.
|
|
92
89
|
*
|
|
93
|
-
*
|
|
94
|
-
* @beta
|
|
90
|
+
* @public
|
|
95
91
|
*/
|
|
96
92
|
function decodeCmsdDynamic(cmsd) {
|
|
97
93
|
if (!cmsd) return [];
|
|
@@ -107,8 +103,7 @@ function decodeCmsdDynamic(cmsd) {
|
|
|
107
103
|
*
|
|
108
104
|
* @returns The decoded CMSD object.
|
|
109
105
|
*
|
|
110
|
-
*
|
|
111
|
-
* @beta
|
|
106
|
+
* @public
|
|
112
107
|
*/
|
|
113
108
|
function decodeCmsdStatic(cmsd) {
|
|
114
109
|
if (!cmsd) return {};
|
|
@@ -157,8 +152,7 @@ function processCmsd(obj, options) {
|
|
|
157
152
|
*
|
|
158
153
|
* @returns The encoded CMSD string.
|
|
159
154
|
*
|
|
160
|
-
*
|
|
161
|
-
* @beta
|
|
155
|
+
* @public
|
|
162
156
|
*/
|
|
163
157
|
function encodeCmsdStatic(cmsd, options) {
|
|
164
158
|
if (!cmsd) return "";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["results: CmsdStatic"],"sources":["../src/CMSD_DYNAMIC.ts","../src/CMSD_STATIC.ts","../src/CMSD_V1.ts","../src/CmsdHeaderField.ts","../src/CmsdObjectType.ts","../src/CmsdStreamingFormat.ts","../src/CmsdStreamType.ts","../src/decodeCmsdDynamic.ts","../src/decodeCmsdStatic.ts","../src/encodeCmsdDynamic.ts","../src/utils/processCmsd.ts","../src/encodeCmsdStatic.ts"],"sourcesContent":["/**\n * CMSD dynamic header name.\n *\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["results: CmsdStatic"],"sources":["../src/CMSD_DYNAMIC.ts","../src/CMSD_STATIC.ts","../src/CMSD_V1.ts","../src/CmsdHeaderField.ts","../src/CmsdObjectType.ts","../src/CmsdStreamingFormat.ts","../src/CmsdStreamType.ts","../src/decodeCmsdDynamic.ts","../src/decodeCmsdStatic.ts","../src/encodeCmsdDynamic.ts","../src/utils/processCmsd.ts","../src/encodeCmsdStatic.ts"],"sourcesContent":["/**\n * CMSD dynamic header name.\n *\n * @public\n */\nexport const CMSD_DYNAMIC = 'CMSD-Dynamic'\n","/**\n * CMSD static header name.\n *\n * @public\n */\nexport const CMSD_STATIC = 'CMSD-Static'\n","/**\n * CMSD Version 1\n *\n * @public\n */\nexport const CMSD_V1 = 1\n","import type { ValueOf } from '@svta/cml-utils'\nimport { CMSD_DYNAMIC } from './CMSD_DYNAMIC.ts'\nimport { CMSD_STATIC } from './CMSD_STATIC.ts'\n\n/**\n * CMSD header fields.\n *\n *\n * @enum\n *\n * @public\n */\nexport const CmsdHeaderField = {\n\t/**\n\t * Keys whose values persist over multiple requests for the object.\n\t */\n\tSTATIC: CMSD_STATIC as typeof CMSD_STATIC,\n\n\t/**\n\t * Keys whose values apply only to the next transmission hop. Typically a\n\t * new CMSD-Dynamic header instance will be added by each intermediary\n\t * participating in the delivery.\n\t */\n\tDYNAMIC: CMSD_DYNAMIC as typeof CMSD_DYNAMIC,\n} as const\n\n/**\n * @public\n */\nexport type CmsdHeaderField = ValueOf<typeof CmsdHeaderField>;\n","import { CmObjectType } from '@svta/cml-cta'\n\n/**\n * Common Media Server Data Object Type\n *\n *\n * @enum\n *\n * @public\n */\nexport const CmsdObjectType = CmObjectType as typeof CmObjectType\n\n/**\n * @public\n */\nexport type CmsdObjectType = CmObjectType;\n","import { CmStreamingFormat } from '@svta/cml-cta'\n\n/**\n * Common Media Server Data Streaming Format\n *\n *\n * @enum\n *\n * @public\n */\nexport const CmsdStreamingFormat = CmStreamingFormat as typeof CmStreamingFormat\n\n/**\n * @public\n */\nexport type CmsdStreamingFormat = CmStreamingFormat;\n","import { CmStreamType } from '@svta/cml-cta'\n\n/**\n * Common Media Server Data Stream Type\n *\n *\n * @enum\n *\n * @public\n */\nexport const CmsdStreamType = CmStreamType as typeof CmStreamType\n\n/**\n * @public\n */\nexport type CmsdStreamType = CmStreamType;\n","import { decodeSfList } from '@svta/cml-structured-field-values'\nimport type { CmsdDynamic } from './CmsdDynamic.ts'\n\n/**\n * Decode a CMSD dynamic string to an object.\n *\n * @param cmsd - The CMSD string to decode.\n *\n * @returns The decoded CMSD object.\n *\n * @public\n */\nexport function decodeCmsdDynamic(cmsd: string): CmsdDynamic[] {\n\tif (!cmsd) {\n\t\treturn []\n\t}\n\n\tconst sfDict = decodeSfList(cmsd)\n\n\treturn sfDict as CmsdDynamic[]\n}\n","import { decodeSfDict, symbolToStr } from '@svta/cml-structured-field-values'\nimport type { CmsdStatic } from './CmsdStatic.ts'\n\n/**\n * Decode a CMSD Static dict string to an object.\n *\n * @param cmsd - The CMSD string to decode.\n *\n * @returns The decoded CMSD object.\n *\n * @public\n */\nexport function decodeCmsdStatic(cmsd: string): CmsdStatic {\n\tif (!cmsd) {\n\t\treturn {}\n\t}\n\n\treturn Object\n\t\t.entries(decodeSfDict(cmsd))\n\t\t.reduce((acc, [key, item]) => {\n\t\t\tconst { value }: any = item\n\t\t\tacc[key as any] = (typeof value === 'symbol' ? symbolToStr(value) : value) as any\n\t\t\treturn acc\n\t\t}, {} as CmsdStatic)\n}\n","import { encodeSfList, SfItem } from '@svta/cml-structured-field-values'\nimport type { CmsdDynamic } from './CmsdDynamic.ts'\n\n/**\n * Encode a list of CMSD Dynamic objects.\n *\n * @param value - The list of `SfItems` to encode.\n *\n * @returns The encoded CMSD string.\n *\n * @public\n */\nexport function encodeCmsdDynamic(value: SfItem[]): string;\n\n/**\n * Encode a single CMSD Dynamic object.\n *\n * @param value - The server name\n * @param cmsd - The CMSD object to encode.\n *\n * @returns The encoded CMSD string.\n *\n * @public\n */\nexport function encodeCmsdDynamic(value: string, cmsd: CmsdDynamic): string;\n\nexport function encodeCmsdDynamic(value: string | SfItem[], cmsd?: CmsdDynamic): string {\n\tif (!value) {\n\t\treturn ''\n\t}\n\n\tif (typeof value === 'string') {\n\t\tif (!cmsd) {\n\t\t\treturn ''\n\t\t}\n\n\t\tvalue = [new SfItem(value, cmsd as any)]\n\t}\n\n\treturn encodeSfList(value, { whitespace: false })\n}\n","import type { CmValue } from '@svta/cml-cta'\nimport { isTokenField, isValid } from '@svta/cml-cta'\nimport { SfToken } from '@svta/cml-structured-field-values'\nimport type { CmsdEncodeOptions } from '../CmsdEncodeOptions.ts'\nimport type { CmsdStatic } from '../CmsdStatic.ts'\n\nexport function processCmsd(obj: CmsdStatic, options?: CmsdEncodeOptions): CmsdStatic {\n\tconst results: CmsdStatic = {}\n\n\tif (obj == null || typeof obj !== 'object') {\n\t\treturn results\n\t}\n\n\tconst keys = Object.keys(obj) as (keyof CmsdStatic)[]\n\tconst useSymbol = options?.useSymbol !== false\n\n\tkeys.forEach(key => {\n\t\tlet value = obj[key] as CmValue\n\n\t\t// Version should only be reported if not equal to 1.\n\t\tif (key === 'v' && value === 1) {\n\t\t\treturn\n\t\t}\n\n\t\t// ignore invalid values\n\t\tif (!isValid(value)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (isTokenField(key) && typeof value === 'string') {\n\t\t\tvalue = useSymbol ? Symbol.for(value) : new SfToken(value)\n\t\t}\n\n\t\tresults[key as any] = value as any\n\t})\n\n\treturn results\n}\n","import { encodeSfDict } from '@svta/cml-structured-field-values'\nimport type { CmsdEncodeOptions } from './CmsdEncodeOptions.ts'\nimport type { CmsdStatic } from './CmsdStatic.ts'\nimport { processCmsd } from './utils/processCmsd.ts'\n\n/**\n * Encode a CMSD Static object.\n *\n * @param cmsd - The CMSD object to encode.\n * @param options - Encoding options\n *\n * @returns The encoded CMSD string.\n *\n * @public\n */\nexport function encodeCmsdStatic(cmsd: CmsdStatic, options?: CmsdEncodeOptions): string {\n\tif (!cmsd) {\n\t\treturn ''\n\t}\n\n\treturn encodeSfDict(processCmsd(cmsd, options), { whitespace: false })\n}\n"],"mappings":";;;;;;;;;AAKA,MAAa,eAAe;;;;;;;;;ACA5B,MAAa,cAAc;;;;;;;;;ACA3B,MAAa,UAAU;;;;;;;;;;;;ACOvB,MAAa,kBAAkB;CAI9B,QAAQ;CAOR,SAAS;CACT;;;;;;;;;;;;ACdD,MAAa,iBAAiB;;;;;;;;;;;;ACA9B,MAAa,sBAAsB;;;;;;;;;;;;ACAnC,MAAa,iBAAiB;;;;;;;;;;;;;ACE9B,SAAgB,kBAAkB,MAA6B;AAC9D,KAAI,CAAC,KACJ,QAAO,EAAE;AAKV,QAFe,aAAa,KAAK;;;;;;;;;;;;;;ACLlC,SAAgB,iBAAiB,MAA0B;AAC1D,KAAI,CAAC,KACJ,QAAO,EAAE;AAGV,QAAO,OACL,QAAQ,aAAa,KAAK,CAAC,CAC3B,QAAQ,KAAK,CAAC,KAAK,UAAU;EAC7B,MAAM,EAAE,UAAe;AACvB,MAAI,OAAe,OAAO,UAAU,WAAW,YAAY,MAAM,GAAG;AACpE,SAAO;IACL,EAAE,CAAe;;;;;ACGtB,SAAgB,kBAAkB,OAA0B,MAA4B;AACvF,KAAI,CAAC,MACJ,QAAO;AAGR,KAAI,OAAO,UAAU,UAAU;AAC9B,MAAI,CAAC,KACJ,QAAO;AAGR,UAAQ,CAAC,IAAI,OAAO,OAAO,KAAY,CAAC;;AAGzC,QAAO,aAAa,OAAO,EAAE,YAAY,OAAO,CAAC;;;;;ACjClD,SAAgB,YAAY,KAAiB,SAAyC;CACrF,MAAMA,UAAsB,EAAE;AAE9B,KAAI,OAAO,QAAQ,OAAO,QAAQ,SACjC,QAAO;CAGR,MAAM,OAAO,OAAO,KAAK,IAAI;CAC7B,MAAM,YAAY,SAAS,cAAc;AAEzC,MAAK,SAAQ,QAAO;EACnB,IAAI,QAAQ,IAAI;AAGhB,MAAI,QAAQ,OAAO,UAAU,EAC5B;AAID,MAAI,CAAC,QAAQ,MAAM,CAClB;AAGD,MAAI,aAAa,IAAI,IAAI,OAAO,UAAU,SACzC,SAAQ,YAAY,OAAO,IAAI,MAAM,GAAG,IAAI,QAAQ,MAAM;AAG3D,UAAQ,OAAc;GACrB;AAEF,QAAO;;;;;;;;;;;;;;;ACrBR,SAAgB,iBAAiB,MAAkB,SAAqC;AACvF,KAAI,CAAC,KACJ,QAAO;AAGR,QAAO,aAAa,YAAY,MAAM,QAAQ,EAAE,EAAE,YAAY,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svta/cml-cmsd",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Common Media Server Data (CMSD) encoding and decoding",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@svta/cml-cta": "1.0.
|
|
56
|
-
"@svta/cml-structured-field-values": "1.0
|
|
57
|
-
"@svta/cml-utils": "1.0
|
|
55
|
+
"@svta/cml-cta": "1.0.3",
|
|
56
|
+
"@svta/cml-structured-field-values": "1.1.0",
|
|
57
|
+
"@svta/cml-utils": "1.2.0"
|
|
58
58
|
}
|
|
59
59
|
}
|