@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.
Files changed (68) hide show
  1. package/README.md +0 -39
  2. package/dist/src/builder/media-builder.d.ts.map +1 -1
  3. package/dist/src/builder/media-builder.js +5 -12
  4. package/dist/src/builder/session-builder.d.ts.map +1 -1
  5. package/dist/src/builder/session-builder.js +4 -14
  6. package/dist/src/index.d.ts +6 -10
  7. package/dist/src/index.d.ts.map +1 -1
  8. package/dist/src/index.js +37 -49
  9. package/dist/src/parser/core.d.ts +366 -0
  10. package/dist/src/parser/core.d.ts.map +1 -0
  11. package/dist/src/parser/core.js +802 -0
  12. package/dist/src/parser/field-parser.d.ts +51 -8
  13. package/dist/src/parser/field-parser.d.ts.map +1 -1
  14. package/dist/src/parser/field-parser.js +91 -23
  15. package/dist/src/parser/media-parser.d.ts +1 -1
  16. package/dist/src/parser/media-parser.d.ts.map +1 -1
  17. package/dist/src/parser/media-parser.js +9 -15
  18. package/dist/src/parser/session-parser.d.ts.map +1 -1
  19. package/dist/src/parser/session-parser.js +16 -17
  20. package/dist/src/parser/time-parser.d.ts +1 -1
  21. package/dist/src/parser/time-parser.d.ts.map +1 -1
  22. package/dist/src/parser/time-parser.js +8 -8
  23. package/dist/src/serializer/fields.d.ts +167 -0
  24. package/dist/src/serializer/fields.d.ts.map +1 -0
  25. package/dist/src/serializer/fields.js +320 -0
  26. package/dist/src/serializer/media-serializer.js +6 -7
  27. package/dist/src/serializer/session-serializer.js +13 -15
  28. package/dist/src/types/attributes.d.ts.map +1 -1
  29. package/dist/src/types/fields.d.ts +5 -5
  30. package/dist/src/types/fields.d.ts.map +1 -1
  31. package/dist/src/types/fields.js +4 -4
  32. package/dist/src/types/media.d.ts +9 -10
  33. package/dist/src/types/media.d.ts.map +1 -1
  34. package/dist/src/types/media.js +2 -4
  35. package/dist/src/types/network.d.ts +15 -56
  36. package/dist/src/types/network.d.ts.map +1 -1
  37. package/dist/src/types/network.js +3 -34
  38. package/dist/src/types/primitives.d.ts +3 -147
  39. package/dist/src/types/primitives.d.ts.map +1 -1
  40. package/dist/src/types/primitives.js +2 -171
  41. package/dist/src/types/session.d.ts +14 -14
  42. package/dist/src/types/session.d.ts.map +1 -1
  43. package/dist/src/types/time.d.ts +4 -4
  44. package/dist/src/types/time.d.ts.map +1 -1
  45. package/dist/src/types/time.js +8 -6
  46. package/dist/src/utils/address-parser.d.ts +4 -4
  47. package/dist/src/utils/address-parser.d.ts.map +1 -1
  48. package/dist/src/utils/address-parser.js +9 -16
  49. package/dist/src/validator/validator.d.ts +94 -0
  50. package/dist/src/validator/validator.d.ts.map +1 -0
  51. package/dist/src/validator/validator.js +573 -0
  52. package/dist/tests/unit/parser/attribute-parser.test.js +106 -107
  53. package/dist/tests/unit/parser/field-parser.test.js +66 -66
  54. package/dist/tests/unit/parser/media-parser.test.js +38 -38
  55. package/dist/tests/unit/parser/primitive-parser.test.js +89 -90
  56. package/dist/tests/unit/parser/scanner.test.js +32 -32
  57. package/dist/tests/unit/parser/time-parser.test.js +22 -22
  58. package/dist/tests/unit/serializer/attribute-serializer.test.js +22 -22
  59. package/dist/tests/unit/serializer/field-serializer.test.js +57 -57
  60. package/dist/tests/unit/serializer/media-serializer.test.js +5 -6
  61. package/dist/tests/unit/serializer/session-serializer.test.js +24 -24
  62. package/dist/tests/unit/serializer/time-serializer.test.js +16 -16
  63. package/dist/tests/unit/types/network.test.js +21 -56
  64. package/dist/tests/unit/types/primitives.test.js +0 -39
  65. package/dist/tests/unit/validator/media-validator.test.js +34 -35
  66. package/dist/tests/unit/validator/semantic-validator.test.js +36 -37
  67. package/dist/tests/unit/validator/session-validator.test.js +54 -54
  68. package/package.json +1 -1
@@ -3,28 +3,28 @@
3
3
  * Tests for field-parser.ts
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const scanner_1 = require("../../../src/parser/scanner");
6
+ const core_1 = require("../../../src/parser/core");
7
7
  const field_parser_1 = require("../../../src/parser/field-parser");
8
8
  const errors_1 = require("../../../src/types/errors");
9
9
  describe('field-parser', () => {
10
10
  describe('parseVersionField', () => {
11
11
  it('should parse version 0', () => {
12
- const scanner = new scanner_1.Scanner('0');
12
+ const scanner = new core_1.Scanner('0');
13
13
  const version = (0, field_parser_1.parseVersionField)(scanner);
14
14
  expect(version).toBe(0);
15
15
  });
16
16
  it('should throw for non-zero version', () => {
17
- expect(() => (0, field_parser_1.parseVersionField)(new scanner_1.Scanner('1'))).toThrow(errors_1.ParseError);
18
- expect(() => (0, field_parser_1.parseVersionField)(new scanner_1.Scanner('1'))).toThrow('Unsupported SDP version');
17
+ expect(() => (0, field_parser_1.parseVersionField)(new core_1.Scanner('1'))).toThrow(errors_1.ParseError);
18
+ expect(() => (0, field_parser_1.parseVersionField)(new core_1.Scanner('1'))).toThrow('Unsupported SDP version');
19
19
  });
20
20
  it('should throw for invalid version', () => {
21
- const scanner = new scanner_1.Scanner('abc');
21
+ const scanner = new core_1.Scanner('abc');
22
22
  expect(() => (0, field_parser_1.parseVersionField)(scanner)).toThrow(errors_1.ParseError);
23
23
  });
24
24
  });
25
25
  describe('parseOriginField', () => {
26
26
  it('should parse valid origin field', () => {
27
- const scanner = new scanner_1.Scanner('jdoe 2890844526 2890842807 IN IP4 10.47.16.5');
27
+ const scanner = new core_1.Scanner('jdoe 2890844526 2890842807 IN IP4 10.47.16.5');
28
28
  const origin = (0, field_parser_1.parseOriginField)(scanner);
29
29
  expect(origin.username).toBe('jdoe');
30
30
  expect(origin.sessId).toBe('2890844526');
@@ -34,14 +34,14 @@ describe('field-parser', () => {
34
34
  expect(origin.unicastAddress).toBe('10.47.16.5');
35
35
  });
36
36
  it('should parse origin with hyphen username', () => {
37
- const scanner = new scanner_1.Scanner('- 123456 789012 IN IP4 192.168.1.1');
37
+ const scanner = new core_1.Scanner('- 123456 789012 IN IP4 192.168.1.1');
38
38
  const origin = (0, field_parser_1.parseOriginField)(scanner);
39
39
  expect(origin.username).toBe('-');
40
40
  expect(origin.sessId).toBe('123456');
41
41
  expect(origin.sessVersion).toBe('789012');
42
42
  });
43
43
  it('should parse origin with IPv6', () => {
44
- const scanner = new scanner_1.Scanner('alice 123 456 IN IP6 2001:db8::1');
44
+ const scanner = new core_1.Scanner('alice 123 456 IN IP6 2001:db8::1');
45
45
  const origin = (0, field_parser_1.parseOriginField)(scanner);
46
46
  expect(origin.username).toBe('alice');
47
47
  expect(origin.netType).toBe('IN');
@@ -49,131 +49,131 @@ describe('field-parser', () => {
49
49
  expect(origin.unicastAddress).toBe('2001:db8::1');
50
50
  });
51
51
  it('should parse origin with FQDN', () => {
52
- const scanner = new scanner_1.Scanner('bob 999 888 IN IP4 example.com');
52
+ const scanner = new core_1.Scanner('bob 999 888 IN IP4 example.com');
53
53
  const origin = (0, field_parser_1.parseOriginField)(scanner);
54
54
  expect(origin.username).toBe('bob');
55
55
  expect(origin.unicastAddress).toBe('example.com');
56
56
  });
57
57
  it('should throw for missing fields', () => {
58
- expect(() => (0, field_parser_1.parseOriginField)(new scanner_1.Scanner('jdoe'))).toThrow(errors_1.ParseError);
59
- expect(() => (0, field_parser_1.parseOriginField)(new scanner_1.Scanner('jdoe 123'))).toThrow(errors_1.ParseError);
60
- expect(() => (0, field_parser_1.parseOriginField)(new scanner_1.Scanner('jdoe 123 456'))).toThrow(errors_1.ParseError);
58
+ expect(() => (0, field_parser_1.parseOriginField)(new core_1.Scanner('jdoe'))).toThrow(errors_1.ParseError);
59
+ expect(() => (0, field_parser_1.parseOriginField)(new core_1.Scanner('jdoe 123'))).toThrow(errors_1.ParseError);
60
+ expect(() => (0, field_parser_1.parseOriginField)(new core_1.Scanner('jdoe 123 456'))).toThrow(errors_1.ParseError);
61
61
  });
62
62
  });
63
63
  describe('parseSessionNameField', () => {
64
64
  it('should parse session name', () => {
65
- const scanner = new scanner_1.Scanner('SDP Seminar');
65
+ const scanner = new core_1.Scanner('SDP Seminar');
66
66
  const name = (0, field_parser_1.parseSessionNameField)(scanner);
67
67
  expect(name).toBe('SDP Seminar');
68
68
  });
69
69
  it('should parse single space as session name', () => {
70
- const scanner = new scanner_1.Scanner(' ');
70
+ const scanner = new core_1.Scanner(' ');
71
71
  const name = (0, field_parser_1.parseSessionNameField)(scanner);
72
72
  expect(name).toBe(' ');
73
73
  });
74
74
  it('should parse session name with special characters', () => {
75
- const scanner = new scanner_1.Scanner('My Conference Call #123');
75
+ const scanner = new core_1.Scanner('My Conference Call #123');
76
76
  const name = (0, field_parser_1.parseSessionNameField)(scanner);
77
77
  expect(name).toBe('My Conference Call #123');
78
78
  });
79
79
  it('should throw for empty session name', () => {
80
- const scanner = new scanner_1.Scanner('');
80
+ const scanner = new core_1.Scanner('');
81
81
  expect(() => (0, field_parser_1.parseSessionNameField)(scanner)).toThrow(errors_1.ParseError);
82
82
  expect(() => (0, field_parser_1.parseSessionNameField)(scanner)).toThrow('cannot be empty');
83
83
  });
84
84
  });
85
85
  describe('parseInformationField', () => {
86
86
  it('should parse information text', () => {
87
- const scanner = new scanner_1.Scanner('A Seminar on the session description protocol');
87
+ const scanner = new core_1.Scanner('A Seminar on the session description protocol');
88
88
  const info = (0, field_parser_1.parseInformationField)(scanner);
89
89
  expect(info).toBe('A Seminar on the session description protocol');
90
90
  });
91
91
  it('should parse empty information', () => {
92
- const scanner = new scanner_1.Scanner('');
92
+ const scanner = new core_1.Scanner('');
93
93
  const info = (0, field_parser_1.parseInformationField)(scanner);
94
94
  expect(info).toBe('');
95
95
  });
96
96
  it('should stop at newline', () => {
97
- const scanner = new scanner_1.Scanner('Session info\r\nnext line');
97
+ const scanner = new core_1.Scanner('Session info\r\nnext line');
98
98
  const info = (0, field_parser_1.parseInformationField)(scanner);
99
99
  expect(info).toBe('Session info');
100
100
  });
101
101
  });
102
102
  describe('parseUriField', () => {
103
103
  it('should parse HTTP URI', () => {
104
- const scanner = new scanner_1.Scanner('http://example.com/session');
104
+ const scanner = new core_1.Scanner('http://example.com/session');
105
105
  const uri = (0, field_parser_1.parseUriField)(scanner);
106
106
  expect(uri).toBe('http://example.com/session');
107
107
  });
108
108
  it('should parse HTTPS URI', () => {
109
- const scanner = new scanner_1.Scanner('https://example.com:8080/path?query=value');
109
+ const scanner = new core_1.Scanner('https://example.com:8080/path?query=value');
110
110
  const uri = (0, field_parser_1.parseUriField)(scanner);
111
111
  expect(uri).toBe('https://example.com:8080/path?query=value');
112
112
  });
113
113
  it('should stop at newline', () => {
114
- const scanner = new scanner_1.Scanner('http://example.com\r\n');
114
+ const scanner = new core_1.Scanner('http://example.com\r\n');
115
115
  const uri = (0, field_parser_1.parseUriField)(scanner);
116
116
  expect(uri).toBe('http://example.com');
117
117
  });
118
118
  });
119
119
  describe('parseEmailField', () => {
120
120
  it('should parse email address', () => {
121
- const scanner = new scanner_1.Scanner('user@example.com');
121
+ const scanner = new core_1.Scanner('user@example.com');
122
122
  const email = (0, field_parser_1.parseEmailField)(scanner);
123
123
  expect(email).toBe('user@example.com');
124
124
  });
125
125
  it('should parse email with display name', () => {
126
- const scanner = new scanner_1.Scanner('John Doe <john@example.com>');
126
+ const scanner = new core_1.Scanner('John Doe <john@example.com>');
127
127
  const email = (0, field_parser_1.parseEmailField)(scanner);
128
128
  expect(email).toBe('John Doe <john@example.com>');
129
129
  });
130
130
  it('should stop at newline', () => {
131
- const scanner = new scanner_1.Scanner('user@example.com\r\n');
131
+ const scanner = new core_1.Scanner('user@example.com\r\n');
132
132
  const email = (0, field_parser_1.parseEmailField)(scanner);
133
133
  expect(email).toBe('user@example.com');
134
134
  });
135
135
  });
136
136
  describe('parsePhoneField', () => {
137
137
  it('should parse phone number', () => {
138
- const scanner = new scanner_1.Scanner('+1-555-1234');
138
+ const scanner = new core_1.Scanner('+1-555-1234');
139
139
  const phone = (0, field_parser_1.parsePhoneField)(scanner);
140
140
  expect(phone).toBe('+1-555-1234');
141
141
  });
142
142
  it('should parse phone with display name', () => {
143
- const scanner = new scanner_1.Scanner('John Doe +1-555-1234');
143
+ const scanner = new core_1.Scanner('John Doe +1-555-1234');
144
144
  const phone = (0, field_parser_1.parsePhoneField)(scanner);
145
145
  expect(phone).toBe('John Doe +1-555-1234');
146
146
  });
147
147
  it('should stop at newline', () => {
148
- const scanner = new scanner_1.Scanner('+1-555-1234\r\n');
148
+ const scanner = new core_1.Scanner('+1-555-1234\r\n');
149
149
  const phone = (0, field_parser_1.parsePhoneField)(scanner);
150
150
  expect(phone).toBe('+1-555-1234');
151
151
  });
152
152
  });
153
153
  describe('parseConnectionField', () => {
154
154
  it('should parse unicast IPv4 connection', () => {
155
- const scanner = new scanner_1.Scanner('IN IP4 192.168.1.100');
155
+ const scanner = new core_1.Scanner('IN IP4 192.168.1.100');
156
156
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
157
157
  expect(conn.netType).toBe('IN');
158
158
  expect(conn.addrType).toBe('IP4');
159
159
  expect(conn.connectionAddress).toBe('192.168.1.100');
160
160
  });
161
161
  it('should parse unicast IPv6 connection', () => {
162
- const scanner = new scanner_1.Scanner('IN IP6 2001:db8::1');
162
+ const scanner = new core_1.Scanner('IN IP6 2001:db8::1');
163
163
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
164
164
  expect(conn.netType).toBe('IN');
165
165
  expect(conn.addrType).toBe('IP6');
166
166
  expect(conn.connectionAddress).toBe('2001:db8::1');
167
167
  });
168
168
  it('should parse unicast FQDN connection', () => {
169
- const scanner = new scanner_1.Scanner('IN IP4 example.com');
169
+ const scanner = new core_1.Scanner('IN IP4 example.com');
170
170
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
171
171
  expect(conn.netType).toBe('IN');
172
172
  expect(conn.addrType).toBe('IP4');
173
173
  expect(conn.connectionAddress).toBe('example.com');
174
174
  });
175
175
  it('should parse IPv4 multicast with TTL', () => {
176
- const scanner = new scanner_1.Scanner('IN IP4 224.2.36.42/127');
176
+ const scanner = new core_1.Scanner('IN IP4 224.2.36.42/127');
177
177
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
178
178
  expect(conn.netType).toBe('IN');
179
179
  expect(conn.addrType).toBe('IP4');
@@ -184,7 +184,7 @@ describe('field-parser', () => {
184
184
  });
185
185
  });
186
186
  it('should parse IPv4 multicast with TTL and numAddresses', () => {
187
- const scanner = new scanner_1.Scanner('IN IP4 224.2.1.1/127/3');
187
+ const scanner = new core_1.Scanner('IN IP4 224.2.1.1/127/3');
188
188
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
189
189
  expect(conn.connectionAddress).toEqual({
190
190
  kind: 'ip4-multicast',
@@ -194,7 +194,7 @@ describe('field-parser', () => {
194
194
  });
195
195
  });
196
196
  it('should parse IPv6 multicast with numAddresses', () => {
197
- const scanner = new scanner_1.Scanner('IN IP6 ff15::101/3');
197
+ const scanner = new core_1.Scanner('IN IP6 ff15::101/3');
198
198
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
199
199
  expect(conn.connectionAddress).toEqual({
200
200
  kind: 'ip6-multicast',
@@ -203,7 +203,7 @@ describe('field-parser', () => {
203
203
  });
204
204
  });
205
205
  it('should parse FQDN multicast with TTL', () => {
206
- const scanner = new scanner_1.Scanner('IN IP4 example.com/127');
206
+ const scanner = new core_1.Scanner('IN IP4 example.com/127');
207
207
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
208
208
  expect(conn.connectionAddress).toEqual({
209
209
  kind: 'fqdn-multicast',
@@ -212,7 +212,7 @@ describe('field-parser', () => {
212
212
  });
213
213
  });
214
214
  it('should parse FQDN multicast with TTL and numAddresses', () => {
215
- const scanner = new scanner_1.Scanner('IN IP4 example.com/64/5');
215
+ const scanner = new core_1.Scanner('IN IP4 example.com/64/5');
216
216
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
217
217
  expect(conn.connectionAddress).toEqual({
218
218
  kind: 'fqdn-multicast',
@@ -222,35 +222,35 @@ describe('field-parser', () => {
222
222
  });
223
223
  });
224
224
  it('should throw for IPv6 multicast with TTL', () => {
225
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP6 ff15::101/127/3'))).toThrow(errors_1.ParseError);
226
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP6 ff15::101/127/3'))).toThrow('cannot have TTL');
225
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP6 ff15::101/127/3'))).toThrow(errors_1.ParseError);
226
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP6 ff15::101/127/3'))).toThrow('cannot have TTL');
227
227
  });
228
228
  it('should throw for missing address', () => {
229
- const scanner = new scanner_1.Scanner('IN IP4 ');
229
+ const scanner = new core_1.Scanner('IN IP4 ');
230
230
  expect(() => (0, field_parser_1.parseConnectionField)(scanner)).toThrow(errors_1.ParseError);
231
231
  });
232
232
  it('should throw for invalid IPv4', () => {
233
- const scanner = new scanner_1.Scanner('IN IP4 -invalid-');
233
+ const scanner = new core_1.Scanner('IN IP4 -invalid-');
234
234
  expect(() => (0, field_parser_1.parseConnectionField)(scanner)).toThrow(errors_1.ParseError);
235
235
  });
236
236
  it('should throw for unicast IPv4 address with TTL (RFC 8866 Section 5.7)', () => {
237
237
  // 192.168.1.1 is a unicast address, not multicast
238
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP4 192.168.1.1/127'))).toThrow(errors_1.ParseError);
239
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP4 192.168.1.1/127'))).toThrow('must be a multicast address');
238
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP4 192.168.1.1/127'))).toThrow(errors_1.ParseError);
239
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP4 192.168.1.1/127'))).toThrow('must be a multicast address');
240
240
  });
241
241
  it('should throw for unicast IPv4 address with TTL and numAddresses', () => {
242
242
  // 10.0.0.1 is a unicast address, not multicast
243
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP4 10.0.0.1/64/3'))).toThrow(errors_1.ParseError);
244
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP4 10.0.0.1/64/3'))).toThrow('must be a multicast address');
243
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP4 10.0.0.1/64/3'))).toThrow(errors_1.ParseError);
244
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP4 10.0.0.1/64/3'))).toThrow('must be a multicast address');
245
245
  });
246
246
  it('should throw for unicast IPv6 address with numAddresses (RFC 8866 Section 5.7)', () => {
247
247
  // 2001:db8::1 is a unicast address, not multicast
248
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP6 2001:db8::1/3'))).toThrow(errors_1.ParseError);
249
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP6 2001:db8::1/3'))).toThrow('must be a multicast address');
248
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP6 2001:db8::1/3'))).toThrow(errors_1.ParseError);
249
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP6 2001:db8::1/3'))).toThrow('must be a multicast address');
250
250
  });
251
251
  it('should accept valid IPv4 multicast address with TTL', () => {
252
252
  // 224.0.0.1 is a valid multicast address
253
- const scanner = new scanner_1.Scanner('IN IP4 224.0.0.1/127');
253
+ const scanner = new core_1.Scanner('IN IP4 224.0.0.1/127');
254
254
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
255
255
  expect(conn.connectionAddress).toEqual({
256
256
  kind: 'ip4-multicast',
@@ -260,7 +260,7 @@ describe('field-parser', () => {
260
260
  });
261
261
  it('should accept valid IPv4 multicast address in range 224-239', () => {
262
262
  // 239.255.255.255 is at the top of the multicast range
263
- const scanner = new scanner_1.Scanner('IN IP4 239.255.255.255/64');
263
+ const scanner = new core_1.Scanner('IN IP4 239.255.255.255/64');
264
264
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
265
265
  expect(conn.connectionAddress).toEqual({
266
266
  kind: 'ip4-multicast',
@@ -270,7 +270,7 @@ describe('field-parser', () => {
270
270
  });
271
271
  it('should accept valid IPv6 multicast address with numAddresses', () => {
272
272
  // FF02::1 is a valid IPv6 multicast address
273
- const scanner = new scanner_1.Scanner('IN IP6 FF02::1/5');
273
+ const scanner = new core_1.Scanner('IN IP6 FF02::1/5');
274
274
  const conn = (0, field_parser_1.parseConnectionField)(scanner);
275
275
  expect(conn.connectionAddress).toEqual({
276
276
  kind: 'ip6-multicast',
@@ -280,74 +280,74 @@ describe('field-parser', () => {
280
280
  });
281
281
  it('should reject IPv4 address just below multicast range with TTL', () => {
282
282
  // 223.255.255.255 is just below the multicast range (224-239)
283
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP4 223.255.255.255/127'))).toThrow(errors_1.ParseError);
284
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP4 223.255.255.255/127'))).toThrow('must be a multicast address');
283
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP4 223.255.255.255/127'))).toThrow(errors_1.ParseError);
284
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP4 223.255.255.255/127'))).toThrow('must be a multicast address');
285
285
  });
286
286
  it('should reject IPv4 address just above multicast range with TTL', () => {
287
287
  // 240.0.0.0 is just above the multicast range (224-239)
288
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP4 240.0.0.0/127'))).toThrow(errors_1.ParseError);
289
- expect(() => (0, field_parser_1.parseConnectionField)(new scanner_1.Scanner('IN IP4 240.0.0.0/127'))).toThrow('must be a multicast address');
288
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP4 240.0.0.0/127'))).toThrow(errors_1.ParseError);
289
+ expect(() => (0, field_parser_1.parseConnectionField)(new core_1.Scanner('IN IP4 240.0.0.0/127'))).toThrow('must be a multicast address');
290
290
  });
291
291
  });
292
292
  describe('parseBandwidthField', () => {
293
293
  it('should parse CT bandwidth', () => {
294
- const scanner = new scanner_1.Scanner('CT:1000');
294
+ const scanner = new core_1.Scanner('CT:1000');
295
295
  const bw = (0, field_parser_1.parseBandwidthField)(scanner);
296
296
  expect(bw.type).toBe('CT');
297
297
  expect(bw.value).toBe(1000);
298
298
  });
299
299
  it('should parse AS bandwidth', () => {
300
- const scanner = new scanner_1.Scanner('AS:128');
300
+ const scanner = new core_1.Scanner('AS:128');
301
301
  const bw = (0, field_parser_1.parseBandwidthField)(scanner);
302
302
  expect(bw.type).toBe('AS');
303
303
  expect(bw.value).toBe(128);
304
304
  });
305
305
  it('should parse extension bandwidth type', () => {
306
- const scanner = new scanner_1.Scanner('TIAS:64000');
306
+ const scanner = new core_1.Scanner('TIAS:64000');
307
307
  const bw = (0, field_parser_1.parseBandwidthField)(scanner);
308
308
  expect(bw.type).toBe('TIAS');
309
309
  expect(bw.value).toBe(64000);
310
310
  });
311
311
  it('should parse zero bandwidth', () => {
312
- const scanner = new scanner_1.Scanner('AS:0');
312
+ const scanner = new core_1.Scanner('AS:0');
313
313
  const bw = (0, field_parser_1.parseBandwidthField)(scanner);
314
314
  expect(bw.value).toBe(0);
315
315
  });
316
316
  it('should throw for missing colon', () => {
317
- expect(() => (0, field_parser_1.parseBandwidthField)(new scanner_1.Scanner('CT 1000'))).toThrow(errors_1.ParseError);
318
- expect(() => (0, field_parser_1.parseBandwidthField)(new scanner_1.Scanner('CT 1000'))).toThrow('Expected \':\'');
317
+ expect(() => (0, field_parser_1.parseBandwidthField)(new core_1.Scanner('CT 1000'))).toThrow(errors_1.ParseError);
318
+ expect(() => (0, field_parser_1.parseBandwidthField)(new core_1.Scanner('CT 1000'))).toThrow('Expected \':\'');
319
319
  });
320
320
  it('should throw for missing value', () => {
321
- const scanner = new scanner_1.Scanner('CT:');
321
+ const scanner = new core_1.Scanner('CT:');
322
322
  expect(() => (0, field_parser_1.parseBandwidthField)(scanner)).toThrow(errors_1.ParseError);
323
323
  });
324
324
  it('should throw for negative bandwidth', () => {
325
- expect(() => (0, field_parser_1.parseBandwidthField)(new scanner_1.Scanner('CT:-100'))).toThrow();
325
+ expect(() => (0, field_parser_1.parseBandwidthField)(new core_1.Scanner('CT:-100'))).toThrow();
326
326
  });
327
327
  });
328
328
  describe('parseKeyField', () => {
329
329
  it('should parse clear key', () => {
330
- const scanner = new scanner_1.Scanner('clear:mypassword123');
330
+ const scanner = new core_1.Scanner('clear:mypassword123');
331
331
  const key = (0, field_parser_1.parseKeyField)(scanner);
332
332
  expect(key).toBe('clear:mypassword123');
333
333
  });
334
334
  it('should parse base64 key', () => {
335
- const scanner = new scanner_1.Scanner('base64:dGVzdGtleQ==');
335
+ const scanner = new core_1.Scanner('base64:dGVzdGtleQ==');
336
336
  const key = (0, field_parser_1.parseKeyField)(scanner);
337
337
  expect(key).toBe('base64:dGVzdGtleQ==');
338
338
  });
339
339
  it('should parse uri key', () => {
340
- const scanner = new scanner_1.Scanner('uri:http://example.com/key');
340
+ const scanner = new core_1.Scanner('uri:http://example.com/key');
341
341
  const key = (0, field_parser_1.parseKeyField)(scanner);
342
342
  expect(key).toBe('uri:http://example.com/key');
343
343
  });
344
344
  it('should parse prompt key', () => {
345
- const scanner = new scanner_1.Scanner('prompt');
345
+ const scanner = new core_1.Scanner('prompt');
346
346
  const key = (0, field_parser_1.parseKeyField)(scanner);
347
347
  expect(key).toBe('prompt');
348
348
  });
349
349
  it('should stop at newline', () => {
350
- const scanner = new scanner_1.Scanner('clear:key123\r\n');
350
+ const scanner = new core_1.Scanner('clear:key123\r\n');
351
351
  const key = (0, field_parser_1.parseKeyField)(scanner);
352
352
  expect(key).toBe('clear:key123');
353
353
  });