@tomgiee/tsdp 1.0.1 → 1.1.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.
- package/README.md +0 -39
- package/dist/src/builder/media-builder.d.ts.map +1 -1
- package/dist/src/builder/media-builder.js +5 -12
- package/dist/src/builder/session-builder.d.ts.map +1 -1
- package/dist/src/builder/session-builder.js +4 -14
- package/dist/src/index.d.ts +6 -10
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +37 -49
- package/dist/src/parser/core.d.ts +366 -0
- package/dist/src/parser/core.d.ts.map +1 -0
- package/dist/src/parser/core.js +802 -0
- package/dist/src/parser/field-parser.d.ts +51 -8
- package/dist/src/parser/field-parser.d.ts.map +1 -1
- package/dist/src/parser/field-parser.js +91 -23
- package/dist/src/parser/media-parser.d.ts +1 -1
- package/dist/src/parser/media-parser.d.ts.map +1 -1
- package/dist/src/parser/media-parser.js +9 -15
- package/dist/src/parser/session-parser.d.ts.map +1 -1
- package/dist/src/parser/session-parser.js +16 -17
- package/dist/src/parser/time-parser.d.ts +1 -1
- package/dist/src/parser/time-parser.d.ts.map +1 -1
- package/dist/src/parser/time-parser.js +8 -8
- package/dist/src/serializer/fields.d.ts +167 -0
- package/dist/src/serializer/fields.d.ts.map +1 -0
- package/dist/src/serializer/fields.js +320 -0
- package/dist/src/serializer/media-serializer.js +6 -7
- package/dist/src/serializer/session-serializer.js +13 -15
- package/dist/src/types/attributes.d.ts.map +1 -1
- package/dist/src/types/fields.d.ts +5 -5
- package/dist/src/types/fields.d.ts.map +1 -1
- package/dist/src/types/fields.js +4 -4
- package/dist/src/types/media.d.ts +9 -10
- package/dist/src/types/media.d.ts.map +1 -1
- package/dist/src/types/media.js +2 -4
- package/dist/src/types/network.d.ts +15 -56
- package/dist/src/types/network.d.ts.map +1 -1
- package/dist/src/types/network.js +3 -34
- package/dist/src/types/primitives.d.ts +3 -147
- package/dist/src/types/primitives.d.ts.map +1 -1
- package/dist/src/types/primitives.js +2 -171
- package/dist/src/types/session.d.ts +14 -14
- package/dist/src/types/session.d.ts.map +1 -1
- package/dist/src/types/time.d.ts +4 -4
- package/dist/src/types/time.d.ts.map +1 -1
- package/dist/src/types/time.js +8 -6
- package/dist/src/utils/address-parser.d.ts +4 -4
- package/dist/src/utils/address-parser.d.ts.map +1 -1
- package/dist/src/utils/address-parser.js +9 -16
- package/dist/src/validator/validator.d.ts +94 -0
- package/dist/src/validator/validator.d.ts.map +1 -0
- package/dist/src/validator/validator.js +573 -0
- package/dist/tests/unit/parser/attribute-parser.test.js +106 -107
- package/dist/tests/unit/parser/field-parser.test.js +66 -66
- package/dist/tests/unit/parser/media-parser.test.js +38 -38
- package/dist/tests/unit/parser/primitive-parser.test.js +89 -90
- package/dist/tests/unit/parser/scanner.test.js +32 -32
- package/dist/tests/unit/parser/time-parser.test.js +22 -22
- package/dist/tests/unit/serializer/attribute-serializer.test.js +22 -22
- package/dist/tests/unit/serializer/field-serializer.test.js +57 -57
- package/dist/tests/unit/serializer/media-serializer.test.js +5 -6
- package/dist/tests/unit/serializer/session-serializer.test.js +24 -24
- package/dist/tests/unit/serializer/time-serializer.test.js +16 -16
- package/dist/tests/unit/types/network.test.js +21 -56
- package/dist/tests/unit/types/primitives.test.js +0 -39
- package/dist/tests/unit/validator/media-validator.test.js +34 -35
- package/dist/tests/unit/validator/semantic-validator.test.js +36 -37
- package/dist/tests/unit/validator/session-validator.test.js +54 -54
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/types/fields.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/types/fields.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,iBAA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,CAQtE"}
|
package/dist/src/types/fields.js
CHANGED
|
@@ -16,9 +16,9 @@ exports.createBandwidth = createBandwidth;
|
|
|
16
16
|
*/
|
|
17
17
|
function createOrigin(username, sessId, sessVersion, netType, addrType, unicastAddress) {
|
|
18
18
|
return {
|
|
19
|
-
username
|
|
20
|
-
sessId
|
|
21
|
-
sessVersion
|
|
19
|
+
username,
|
|
20
|
+
sessId,
|
|
21
|
+
sessVersion,
|
|
22
22
|
netType,
|
|
23
23
|
addrType,
|
|
24
24
|
unicastAddress,
|
|
@@ -42,7 +42,7 @@ function createBandwidth(type, value) {
|
|
|
42
42
|
throw new Error('Bandwidth value must be non-negative');
|
|
43
43
|
}
|
|
44
44
|
return {
|
|
45
|
-
type
|
|
45
|
+
type,
|
|
46
46
|
value,
|
|
47
47
|
};
|
|
48
48
|
}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Defines types for media descriptions including media types, ports, protocols, and formats.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { Connection } from './fields';
|
|
8
|
-
import { Bandwidth } from './fields';
|
|
6
|
+
import { MediaType } from './primitives';
|
|
7
|
+
import { Bandwidth, Connection } from './fields';
|
|
9
8
|
import { Attribute } from './attributes';
|
|
10
9
|
/**
|
|
11
10
|
* Media Description (RFC 8866 Section 5.14)
|
|
@@ -26,7 +25,7 @@ export interface MediaDescription {
|
|
|
26
25
|
/**
|
|
27
26
|
* Media title/information (optional)
|
|
28
27
|
*/
|
|
29
|
-
readonly information?:
|
|
28
|
+
readonly information?: string;
|
|
30
29
|
/**
|
|
31
30
|
* Connection data for this media (optional if present at session level)
|
|
32
31
|
* May be multiple for hierarchical encoding schemes
|
|
@@ -39,7 +38,7 @@ export interface MediaDescription {
|
|
|
39
38
|
/**
|
|
40
39
|
* Encryption key (OBSOLETE per RFC 8866, but must support for compatibility)
|
|
41
40
|
*/
|
|
42
|
-
readonly key?:
|
|
41
|
+
readonly key?: string;
|
|
43
42
|
/**
|
|
44
43
|
* Media-level attributes (optional, multiple allowed)
|
|
45
44
|
*/
|
|
@@ -66,13 +65,13 @@ export interface Media {
|
|
|
66
65
|
* Transport protocol
|
|
67
66
|
* Examples: "RTP/AVP", "RTP/SAVP", "udp", "RTP/SAVPF"
|
|
68
67
|
*/
|
|
69
|
-
readonly proto:
|
|
68
|
+
readonly proto: string;
|
|
70
69
|
/**
|
|
71
70
|
* Media formats
|
|
72
71
|
* For RTP: payload type numbers
|
|
73
72
|
* For other protocols: format descriptions
|
|
74
73
|
*/
|
|
75
|
-
readonly formats: readonly
|
|
74
|
+
readonly formats: readonly string[];
|
|
76
75
|
}
|
|
77
76
|
/**
|
|
78
77
|
* Simple port - single port number
|
|
@@ -98,7 +97,7 @@ export type Port = SimplePort | PortRange;
|
|
|
98
97
|
/**
|
|
99
98
|
* Create a Media field
|
|
100
99
|
*/
|
|
101
|
-
export declare function createMedia(type: MediaType, port: Port, proto:
|
|
100
|
+
export declare function createMedia(type: MediaType, port: Port, proto: string, formats: string[]): Media;
|
|
102
101
|
/**
|
|
103
102
|
* Create a simple port
|
|
104
103
|
*/
|
|
@@ -111,10 +110,10 @@ export declare function createPortRange(base: number, count: number): PortRange;
|
|
|
111
110
|
* Create a MediaDescription
|
|
112
111
|
*/
|
|
113
112
|
export declare function createMediaDescription(media: Media, options?: {
|
|
114
|
-
information?:
|
|
113
|
+
information?: string;
|
|
115
114
|
connections?: Connection[];
|
|
116
115
|
bandwidths?: Bandwidth[];
|
|
117
|
-
key?:
|
|
116
|
+
key?: string;
|
|
118
117
|
attributes?: Attribute[];
|
|
119
118
|
}): MediaDescription;
|
|
120
119
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/types/media.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/types/media.ts"],"names":[],"mappings":"AA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AAM,IAAI,GAAG,UAAU,GAAG,SAAS,CAAC;AAM1C;;GAEG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,GAChB,KAAK,CAUP;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAQ1D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAetE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE;IACR,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;CAC1B,GACA,gBAAgB,CASlB;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,UAAU,CAE3D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,SAAS,CAEzD;AAMD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAUhD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAUnD"}
|
package/dist/src/types/media.js
CHANGED
|
@@ -109,8 +109,7 @@ function getPortNumber(port) {
|
|
|
109
109
|
case 'range':
|
|
110
110
|
return port.base;
|
|
111
111
|
default: {
|
|
112
|
-
|
|
113
|
-
return _exhaustive;
|
|
112
|
+
return port;
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
}
|
|
@@ -130,8 +129,7 @@ function getPortNumbers(port) {
|
|
|
130
129
|
case 'range':
|
|
131
130
|
return Array.from({ length: port.count }, (_, i) => port.base + i);
|
|
132
131
|
default: {
|
|
133
|
-
|
|
134
|
-
return _exhaustive;
|
|
132
|
+
return port;
|
|
135
133
|
}
|
|
136
134
|
}
|
|
137
135
|
}
|
|
@@ -1,47 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Network address types for SDP (RFC 8866)
|
|
3
3
|
*
|
|
4
|
-
* This module defines types for
|
|
5
|
-
*
|
|
4
|
+
* This module defines types for multicast addresses with TTL and numAddresses.
|
|
5
|
+
* Unicast addresses are plain strings.
|
|
6
6
|
*/
|
|
7
|
-
type Brand<T, B> = T & {
|
|
8
|
-
readonly __brand: B;
|
|
9
|
-
};
|
|
10
7
|
/**
|
|
11
|
-
* IPv4 address
|
|
12
|
-
* Each octet is 0-255
|
|
13
|
-
* Examples: "192.168.1.1", "198.51.100.1"
|
|
14
|
-
*/
|
|
15
|
-
export type IP4Address = Brand<string, 'IP4Address'>;
|
|
16
|
-
/**
|
|
17
|
-
* IPv6 address (RFC 5952 canonical format)
|
|
18
|
-
* Supports all 8 compression forms
|
|
19
|
-
* Examples: "2001:db8::1", "fe80::1", "::1"
|
|
20
|
-
*/
|
|
21
|
-
export type IP6Address = Brand<string, 'IP6Address'>;
|
|
22
|
-
/**
|
|
23
|
-
* Fully Qualified Domain Name
|
|
24
|
-
* RFC 1035 compliant domain name
|
|
25
|
-
* Examples: "example.com", "sip.example.org"
|
|
26
|
-
*/
|
|
27
|
-
export type FQDN = Brand<string, 'FQDN'>;
|
|
28
|
-
/**
|
|
29
|
-
* Extension address type (for future/custom address types)
|
|
30
|
-
* Used when addrtype is not IP4 or IP6
|
|
31
|
-
*/
|
|
32
|
-
export type ExtensionAddress = Brand<string, 'ExtensionAddress'>;
|
|
33
|
-
/**
|
|
34
|
-
* Unicast address - can be IPv4, IPv6, FQDN, or extension
|
|
8
|
+
* Unicast address - IPv4, IPv6, FQDN, or extension address as a string
|
|
35
9
|
* Used for origin field and unicast connection addresses
|
|
10
|
+
*
|
|
11
|
+
* Examples:
|
|
12
|
+
* - IPv4: "192.168.1.1", "198.51.100.1"
|
|
13
|
+
* - IPv6: "2001:db8::1", "fe80::1", "::1"
|
|
14
|
+
* - FQDN: "example.com", "sip.example.org"
|
|
36
15
|
*/
|
|
37
|
-
export type UnicastAddress =
|
|
16
|
+
export type UnicastAddress = string;
|
|
38
17
|
/**
|
|
39
18
|
* IPv4 multicast address (224.0.0.0 - 239.255.255.255)
|
|
40
19
|
* Requires TTL, optionally includes number of addresses for hierarchical encoding
|
|
41
20
|
*/
|
|
42
21
|
export interface IP4MulticastAddress {
|
|
43
22
|
readonly kind: 'ip4-multicast';
|
|
44
|
-
readonly address:
|
|
23
|
+
readonly address: string;
|
|
45
24
|
/** Time-to-live (0-255), required for IPv4 multicast */
|
|
46
25
|
readonly ttl: number;
|
|
47
26
|
/** Number of addresses for hierarchical encoding (optional) */
|
|
@@ -54,7 +33,7 @@ export interface IP4MulticastAddress {
|
|
|
54
33
|
*/
|
|
55
34
|
export interface IP6MulticastAddress {
|
|
56
35
|
readonly kind: 'ip6-multicast';
|
|
57
|
-
readonly address:
|
|
36
|
+
readonly address: string;
|
|
58
37
|
/** Number of addresses for hierarchical encoding (optional) */
|
|
59
38
|
readonly numAddresses?: number;
|
|
60
39
|
}
|
|
@@ -65,7 +44,7 @@ export interface IP6MulticastAddress {
|
|
|
65
44
|
*/
|
|
66
45
|
export interface FQDNMulticastAddress {
|
|
67
46
|
readonly kind: 'fqdn-multicast';
|
|
68
|
-
readonly address:
|
|
47
|
+
readonly address: string;
|
|
69
48
|
/** Time-to-live (optional for FQDN) */
|
|
70
49
|
readonly ttl?: number;
|
|
71
50
|
/** Number of addresses for hierarchical encoding (optional) */
|
|
@@ -81,37 +60,18 @@ export type MulticastAddress = IP4MulticastAddress | IP6MulticastAddress | FQDNM
|
|
|
81
60
|
* Used in connection field (c=)
|
|
82
61
|
*/
|
|
83
62
|
export type ConnectionAddress = UnicastAddress | MulticastAddress;
|
|
84
|
-
/**
|
|
85
|
-
* Create an IP4Address from a string
|
|
86
|
-
* Note: Validation should be done by address-parser utility
|
|
87
|
-
*/
|
|
88
|
-
export declare function createIP4Address(value: string): IP4Address;
|
|
89
|
-
/**
|
|
90
|
-
* Create an IP6Address from a string
|
|
91
|
-
* Note: Validation should be done by address-parser utility
|
|
92
|
-
*/
|
|
93
|
-
export declare function createIP6Address(value: string): IP6Address;
|
|
94
|
-
/**
|
|
95
|
-
* Create an FQDN from a string
|
|
96
|
-
* Note: Validation should be done by address-parser utility
|
|
97
|
-
*/
|
|
98
|
-
export declare function createFQDN(value: string): FQDN;
|
|
99
|
-
/**
|
|
100
|
-
* Create an ExtensionAddress from a string
|
|
101
|
-
*/
|
|
102
|
-
export declare function createExtensionAddress(value: string): ExtensionAddress;
|
|
103
63
|
/**
|
|
104
64
|
* Create an IPv4 multicast address
|
|
105
65
|
*/
|
|
106
|
-
export declare function createIP4MulticastAddress(address:
|
|
66
|
+
export declare function createIP4MulticastAddress(address: string, ttl: number, numAddresses?: number): IP4MulticastAddress;
|
|
107
67
|
/**
|
|
108
68
|
* Create an IPv6 multicast address
|
|
109
69
|
*/
|
|
110
|
-
export declare function createIP6MulticastAddress(address:
|
|
70
|
+
export declare function createIP6MulticastAddress(address: string, numAddresses?: number): IP6MulticastAddress;
|
|
111
71
|
/**
|
|
112
72
|
* Create an FQDN multicast address
|
|
113
73
|
*/
|
|
114
|
-
export declare function createFQDNMulticastAddress(address:
|
|
74
|
+
export declare function createFQDNMulticastAddress(address: string, ttl?: number, numAddresses?: number): FQDNMulticastAddress;
|
|
115
75
|
/**
|
|
116
76
|
* Check if an address is a multicast address
|
|
117
77
|
*/
|
|
@@ -132,5 +92,4 @@ export declare function isIP6MulticastAddress(addr: MulticastAddress): addr is I
|
|
|
132
92
|
* Check if a multicast address is FQDN-based
|
|
133
93
|
*/
|
|
134
94
|
export declare function isFQDNMulticastAddress(addr: MulticastAddress): addr is FQDNMulticastAddress;
|
|
135
|
-
export {};
|
|
136
95
|
//# sourceMappingURL=network.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../src/types/network.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../src/types/network.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAMpC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uCAAuC;IACvC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,CAAC;AAMzB;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAMlE;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,YAAY,CAAC,EAAE,MAAM,GACpB,mBAAmB,CAarB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,GACpB,mBAAmB,CASrB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,GACpB,oBAAoB,CAatB;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,IAAI,gBAAgB,CAEpF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,IAAI,cAAc,CAEhF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,IAAI,mBAAmB,CAEzF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,IAAI,mBAAmB,CAEzF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,IAAI,oBAAoB,CAE3F"}
|
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Network address types for SDP (RFC 8866)
|
|
4
4
|
*
|
|
5
|
-
* This module defines types for
|
|
6
|
-
*
|
|
5
|
+
* This module defines types for multicast addresses with TTL and numAddresses.
|
|
6
|
+
* Unicast addresses are plain strings.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.createIP4Address = createIP4Address;
|
|
10
|
-
exports.createIP6Address = createIP6Address;
|
|
11
|
-
exports.createFQDN = createFQDN;
|
|
12
|
-
exports.createExtensionAddress = createExtensionAddress;
|
|
13
9
|
exports.createIP4MulticastAddress = createIP4MulticastAddress;
|
|
14
10
|
exports.createIP6MulticastAddress = createIP6MulticastAddress;
|
|
15
11
|
exports.createFQDNMulticastAddress = createFQDNMulticastAddress;
|
|
@@ -19,35 +15,8 @@ exports.isIP4MulticastAddress = isIP4MulticastAddress;
|
|
|
19
15
|
exports.isIP6MulticastAddress = isIP6MulticastAddress;
|
|
20
16
|
exports.isFQDNMulticastAddress = isFQDNMulticastAddress;
|
|
21
17
|
// ============================================================================
|
|
22
|
-
// Helper Functions for Creating
|
|
18
|
+
// Helper Functions for Creating Multicast Addresses
|
|
23
19
|
// ============================================================================
|
|
24
|
-
/**
|
|
25
|
-
* Create an IP4Address from a string
|
|
26
|
-
* Note: Validation should be done by address-parser utility
|
|
27
|
-
*/
|
|
28
|
-
function createIP4Address(value) {
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Create an IP6Address from a string
|
|
33
|
-
* Note: Validation should be done by address-parser utility
|
|
34
|
-
*/
|
|
35
|
-
function createIP6Address(value) {
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Create an FQDN from a string
|
|
40
|
-
* Note: Validation should be done by address-parser utility
|
|
41
|
-
*/
|
|
42
|
-
function createFQDN(value) {
|
|
43
|
-
return value;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Create an ExtensionAddress from a string
|
|
47
|
-
*/
|
|
48
|
-
function createExtensionAddress(value) {
|
|
49
|
-
return value;
|
|
50
|
-
}
|
|
51
20
|
/**
|
|
52
21
|
* Create an IPv4 multicast address
|
|
53
22
|
*/
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Primitive types
|
|
3
|
-
*
|
|
4
|
-
* This module defines branded primitive types to ensure type safety at compile time
|
|
5
|
-
* and enums for various SDP field values.
|
|
2
|
+
* Primitive types for SDP (RFC 8866)
|
|
6
3
|
*/
|
|
7
4
|
/**
|
|
8
5
|
* Position in the input text for error reporting
|
|
@@ -15,49 +12,8 @@ export interface Position {
|
|
|
15
12
|
/** Column number (1-indexed) */
|
|
16
13
|
readonly column: number;
|
|
17
14
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Branded type to prevent mixing different string types
|
|
20
|
-
* Provides compile-time safety with no runtime overhead
|
|
21
|
-
*/
|
|
22
|
-
type Brand<T, B> = T & {
|
|
23
|
-
readonly __brand: B;
|
|
24
|
-
};
|
|
25
15
|
/** SDP version number (currently always 0) */
|
|
26
|
-
export type Version =
|
|
27
|
-
/** Session name (required field) */
|
|
28
|
-
export type SessionName = Brand<string, 'SessionName'>;
|
|
29
|
-
/** Username for origin field */
|
|
30
|
-
export type Username = Brand<string, 'Username'>;
|
|
31
|
-
/** Session ID (NTP timestamp) */
|
|
32
|
-
export type SessionId = Brand<string, 'SessionId'>;
|
|
33
|
-
/** Session version number (NTP timestamp) */
|
|
34
|
-
export type SessionVersion = Brand<string, 'SessionVersion'>;
|
|
35
|
-
/** Session or media information text */
|
|
36
|
-
export type Information = Brand<string, 'Information'>;
|
|
37
|
-
/** URI reference */
|
|
38
|
-
export type URI = Brand<string, 'URI'>;
|
|
39
|
-
/** Email address (with optional display name) */
|
|
40
|
-
export type Email = Brand<string, 'Email'>;
|
|
41
|
-
/** Phone number (with optional display name) */
|
|
42
|
-
export type Phone = Brand<string, 'Phone'>;
|
|
43
|
-
/** Encryption key (OBSOLETE per RFC 8866) */
|
|
44
|
-
export type Key = Brand<string, 'Key'>;
|
|
45
|
-
/** Bandwidth type (CT, AS, or extension) */
|
|
46
|
-
export type BandwidthType = Brand<string, 'BandwidthType'>;
|
|
47
|
-
/** Transport protocol (RTP/AVP, RTP/SAVP, udp, etc.) */
|
|
48
|
-
export type Protocol = Brand<string, 'Protocol'>;
|
|
49
|
-
/** Media format (payload type or media subtype) */
|
|
50
|
-
export type Format = Brand<string, 'Format'>;
|
|
51
|
-
/** Attribute name */
|
|
52
|
-
export type AttributeName = Brand<string, 'AttributeName'>;
|
|
53
|
-
/** Attribute value */
|
|
54
|
-
export type AttributeValue = Brand<string, 'AttributeValue'>;
|
|
55
|
-
/** Token (sequence of token-chars: ALPHA/DIGIT/special) */
|
|
56
|
-
export type Token = Brand<string, 'Token'>;
|
|
57
|
-
/** Byte string (sequence of bytes 0x01-0x09, 0x0B-0x0C, 0x0E-0xFF) */
|
|
58
|
-
export type ByteString = Brand<string, 'ByteString'>;
|
|
59
|
-
/** Non-whitespace string (sequence of non-whitespace chars) */
|
|
60
|
-
export type NonWSString = Brand<string, 'NonWSString'>;
|
|
16
|
+
export type Version = 0;
|
|
61
17
|
/**
|
|
62
18
|
* Network type (RFC 8866 Section 5.2)
|
|
63
19
|
* Currently only 'IN' (Internet) is defined, but extensible via IANA registration
|
|
@@ -70,19 +26,9 @@ export type NetType = 'IN' | string;
|
|
|
70
26
|
export type AddrType = 'IP4' | 'IP6' | string;
|
|
71
27
|
/**
|
|
72
28
|
* Media type (RFC 8866 Section 5.14)
|
|
73
|
-
* Defines the type of media in a media description
|
|
74
29
|
*/
|
|
75
30
|
export type MediaType = 'audio' | 'video' | 'text' | 'application' | 'message' | 'image' | string;
|
|
76
|
-
/**
|
|
77
|
-
* NTP timestamp (seconds since January 1, 1900 UTC)
|
|
78
|
-
* Special value 0 means "unbounded" or "permanent"
|
|
79
|
-
*
|
|
80
|
-
* RFC 8866 uses NTP time (epoch 1900) not Unix time (epoch 1970)
|
|
81
|
-
*/
|
|
82
|
-
export type NtpTime = Brand<number, 'NtpTime'>;
|
|
83
|
-
/**
|
|
84
|
-
* Time unit for typed time values
|
|
85
|
-
*/
|
|
31
|
+
/** Time unit for typed time values */
|
|
86
32
|
export type TimeUnit = 'days' | 'hours' | 'minutes' | 'seconds';
|
|
87
33
|
/**
|
|
88
34
|
* Typed time with unit suffix (d/h/m/s)
|
|
@@ -94,100 +40,10 @@ export interface TypedTime {
|
|
|
94
40
|
}
|
|
95
41
|
/**
|
|
96
42
|
* Check if a string contains only digits (0-9)
|
|
97
|
-
*
|
|
98
|
-
* Per RFC 8866 Section 9 (Grammar):
|
|
99
|
-
* - sess-id = 1*DIGIT
|
|
100
|
-
* - sess-version = 1*DIGIT
|
|
101
|
-
*
|
|
102
|
-
* @param value - String to validate
|
|
103
|
-
* @returns true if string contains one or more digits only
|
|
104
43
|
*/
|
|
105
44
|
export declare function isNumericString(value: string): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Create a Version (currently must be 0)
|
|
108
|
-
*/
|
|
109
|
-
export declare function createVersion(value: number): Version;
|
|
110
|
-
/**
|
|
111
|
-
* Create a SessionName from a string
|
|
112
|
-
*/
|
|
113
|
-
export declare function createSessionName(value: string): SessionName;
|
|
114
|
-
/**
|
|
115
|
-
* Create a Username from a string
|
|
116
|
-
*/
|
|
117
|
-
export declare function createUsername(value: string): Username;
|
|
118
|
-
/**
|
|
119
|
-
* Create a SessionId from a string
|
|
120
|
-
*/
|
|
121
|
-
export declare function createSessionId(value: string): SessionId;
|
|
122
|
-
/**
|
|
123
|
-
* Create a SessionVersion from a string
|
|
124
|
-
*/
|
|
125
|
-
export declare function createSessionVersion(value: string): SessionVersion;
|
|
126
|
-
/**
|
|
127
|
-
* Create an Information string
|
|
128
|
-
*/
|
|
129
|
-
export declare function createInformation(value: string): Information;
|
|
130
|
-
/**
|
|
131
|
-
* Create a URI
|
|
132
|
-
*/
|
|
133
|
-
export declare function createURI(value: string): URI;
|
|
134
|
-
/**
|
|
135
|
-
* Create an Email
|
|
136
|
-
*/
|
|
137
|
-
export declare function createEmail(value: string): Email;
|
|
138
|
-
/**
|
|
139
|
-
* Create a Phone
|
|
140
|
-
*/
|
|
141
|
-
export declare function createPhone(value: string): Phone;
|
|
142
|
-
/**
|
|
143
|
-
* Create a Key (OBSOLETE but must support for compatibility)
|
|
144
|
-
*/
|
|
145
|
-
export declare function createKey(value: string): Key;
|
|
146
|
-
/**
|
|
147
|
-
* Create a BandwidthType
|
|
148
|
-
*/
|
|
149
|
-
export declare function createBandwidthType(value: string): BandwidthType;
|
|
150
|
-
/**
|
|
151
|
-
* Create a MediaType
|
|
152
|
-
*/
|
|
153
|
-
export declare function createMediaType(value: string): MediaType;
|
|
154
|
-
/**
|
|
155
|
-
* Create a Protocol
|
|
156
|
-
*/
|
|
157
|
-
export declare function createProtocol(value: string): Protocol;
|
|
158
|
-
/**
|
|
159
|
-
* Create a Format
|
|
160
|
-
*/
|
|
161
|
-
export declare function createFormat(value: string): Format;
|
|
162
|
-
/**
|
|
163
|
-
* Create an AttributeName
|
|
164
|
-
*/
|
|
165
|
-
export declare function createAttributeName(value: string): AttributeName;
|
|
166
|
-
/**
|
|
167
|
-
* Create an AttributeValue
|
|
168
|
-
*/
|
|
169
|
-
export declare function createAttributeValue(value: string): AttributeValue;
|
|
170
|
-
/**
|
|
171
|
-
* Create a Token
|
|
172
|
-
*/
|
|
173
|
-
export declare function createToken(value: string): Token;
|
|
174
|
-
/**
|
|
175
|
-
* Create a ByteString
|
|
176
|
-
*/
|
|
177
|
-
export declare function createByteString(value: string): ByteString;
|
|
178
|
-
/**
|
|
179
|
-
* Create a NonWSString
|
|
180
|
-
*/
|
|
181
|
-
export declare function createNonWSString(value: string): NonWSString;
|
|
182
|
-
/**
|
|
183
|
-
* Create an NtpTime
|
|
184
|
-
*/
|
|
185
|
-
export declare function createNtpTime(value: number): NtpTime;
|
|
186
45
|
/**
|
|
187
46
|
* Create a TypedTime
|
|
188
|
-
*
|
|
189
|
-
* Note: Value can be negative for timezone offsets
|
|
190
47
|
*/
|
|
191
48
|
export declare function createTypedTime(value: number, unit: TimeUnit): TypedTime;
|
|
192
|
-
export {};
|
|
193
49
|
//# sourceMappingURL=primitives.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/types/primitives.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/types/primitives.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAMD,8CAA8C;AAC9C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC;AAExB;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC;AAEpC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,OAAO,GACP,MAAM,GACN,aAAa,GACb,SAAS,GACT,OAAO,GACP,MAAM,CAAC;AAMX,sCAAsC;AACtC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACzB;AAQD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAExE"}
|