@routr/common 2.17.0 → 2.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 (91) hide show
  1. package/dist/connect/config.d.ts +5 -1
  2. package/dist/connect/mappers/agent.js +1 -0
  3. package/dist/connect/mappers/domain.js +1 -0
  4. package/dist/connect/mappers/peer.js +1 -0
  5. package/dist/connect/mappers/trunk.js +1 -0
  6. package/dist/connect/protos/agents.proto +7 -0
  7. package/dist/connect/protos/domains.proto +7 -0
  8. package/dist/connect/protos/peers.proto +7 -0
  9. package/dist/connect/protos/trace.proto +28 -0
  10. package/dist/connect/protos/trunks.proto +7 -0
  11. package/dist/connect/schemas/agent.d.ts +10 -0
  12. package/dist/connect/schemas/agent.js +8 -0
  13. package/dist/connect/schemas/domain.d.ts +10 -0
  14. package/dist/connect/schemas/domain.js +8 -0
  15. package/dist/connect/schemas/peer.d.ts +10 -0
  16. package/dist/connect/schemas/peer.js +8 -0
  17. package/dist/connect/schemas/trunk.d.ts +10 -0
  18. package/dist/connect/schemas/trunk.js +8 -0
  19. package/dist/connect/types.d.ts +7 -0
  20. package/dist/errors.d.ts +14 -0
  21. package/dist/errors.js +19 -1
  22. package/dist/helper.js +2 -1
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.js +2 -1
  25. package/dist/protos/processor.proto +4 -0
  26. package/dist/trace/compat.d.ts +37 -0
  27. package/dist/trace/compat.js +131 -0
  28. package/dist/trace/diff.d.ts +48 -0
  29. package/dist/trace/diff.js +152 -0
  30. package/dist/trace/index.d.ts +11 -0
  31. package/dist/trace/index.js +68 -0
  32. package/dist/trace/metadata.d.ts +28 -0
  33. package/dist/trace/metadata.js +75 -0
  34. package/dist/trace/normalize.d.ts +11 -0
  35. package/dist/trace/normalize.js +39 -0
  36. package/dist/trace/redact.d.ts +19 -0
  37. package/dist/trace/redact.js +52 -0
  38. package/dist/trace/rules/facts.d.ts +43 -0
  39. package/dist/trace/rules/facts.js +117 -0
  40. package/dist/trace/rules/index.d.ts +34 -0
  41. package/dist/trace/rules/index.js +153 -0
  42. package/dist/trace/rules/sip/ack-2xx.d.ts +2 -0
  43. package/dist/trace/rules/sip/ack-2xx.js +56 -0
  44. package/dist/trace/rules/sip/cancel-matches.d.ts +2 -0
  45. package/dist/trace/rules/sip/cancel-matches.js +46 -0
  46. package/dist/trace/rules/sip/credentials-stripped.d.ts +2 -0
  47. package/dist/trace/rules/sip/credentials-stripped.js +41 -0
  48. package/dist/trace/rules/sip/cseq-ack.d.ts +2 -0
  49. package/dist/trace/rules/sip/cseq-ack.js +40 -0
  50. package/dist/trace/rules/sip/cseq-monotonic.d.ts +2 -0
  51. package/dist/trace/rules/sip/cseq-monotonic.js +50 -0
  52. package/dist/trace/rules/sip/max-forwards.d.ts +2 -0
  53. package/dist/trace/rules/sip/max-forwards.js +47 -0
  54. package/dist/trace/rules/sip/private-address.d.ts +2 -0
  55. package/dist/trace/rules/sip/private-address.js +48 -0
  56. package/dist/trace/rules/sip/record-route-self.d.ts +2 -0
  57. package/dist/trace/rules/sip/record-route-self.js +46 -0
  58. package/dist/trace/rules/sip/register-ok.d.ts +2 -0
  59. package/dist/trace/rules/sip/register-ok.js +52 -0
  60. package/dist/trace/rules/sip/retransmission.d.ts +2 -0
  61. package/dist/trace/rules/sip/retransmission.js +47 -0
  62. package/dist/trace/rules/sip/route-self-removed.d.ts +2 -0
  63. package/dist/trace/rules/sip/route-self-removed.js +38 -0
  64. package/dist/trace/rules/sip/via.d.ts +2 -0
  65. package/dist/trace/rules/sip/via.js +50 -0
  66. package/dist/trace/rules/sip-connect/from-e164-or-anonymous.d.ts +2 -0
  67. package/dist/trace/rules/sip-connect/from-e164-or-anonymous.js +43 -0
  68. package/dist/trace/rules/sip-connect/pai-e164.d.ts +2 -0
  69. package/dist/trace/rules/sip-connect/pai-e164.js +44 -0
  70. package/dist/trace/rules/sip-connect/pai-single.d.ts +2 -0
  71. package/dist/trace/rules/sip-connect/pai-single.js +41 -0
  72. package/dist/trace/rules/sip-connect/privacy.d.ts +2 -0
  73. package/dist/trace/rules/sip-connect/privacy.js +50 -0
  74. package/dist/trace/rules/sip-connect/request-uri-e164.d.ts +2 -0
  75. package/dist/trace/rules/sip-connect/request-uri-e164.js +44 -0
  76. package/dist/trace/rules/sip-connect/scope.d.ts +11 -0
  77. package/dist/trace/rules/sip-connect/scope.js +19 -0
  78. package/dist/trace/rules/types.d.ts +34 -0
  79. package/dist/trace/rules/types.js +13 -0
  80. package/dist/trace/sanitize.d.ts +40 -0
  81. package/dist/trace/sanitize.js +85 -0
  82. package/dist/trace/schema.d.ts +338 -0
  83. package/dist/trace/schema.js +197 -0
  84. package/dist/trace/status.d.ts +15 -0
  85. package/dist/trace/status.js +102 -0
  86. package/dist/trace/types.d.ts +126 -0
  87. package/dist/trace/types.js +82 -0
  88. package/dist/trace/validate.d.ts +56 -0
  89. package/dist/trace/validate.js +140 -0
  90. package/dist/types.d.ts +2 -0
  91. package/package.json +2 -2
@@ -0,0 +1,40 @@
1
+ import { TraceRecord } from "./types";
2
+ export interface Credential {
3
+ username: string;
4
+ password: string;
5
+ }
6
+ export interface SanitizeOptions {
7
+ credentials: Credential[];
8
+ rewrites?: [string, string][];
9
+ }
10
+ /**
11
+ * Thrown when a record carries an Authorization whose username has no
12
+ * test credential: the file would not replay.
13
+ */
14
+ export declare class UnknownCredentialError extends Error {
15
+ readonly username: string;
16
+ /**
17
+ * @param {string} username - The digest username without a credential
18
+ * @param {number} seq - The record it appears on
19
+ */
20
+ constructor(username: string, seq: number);
21
+ }
22
+ /**
23
+ * Makes a recording committable as a known-good: every digest response is
24
+ * recomputed with the test password for its username (the digest is
25
+ * stateless, so the record keeps authenticating), then each rewrite is
26
+ * applied to every string so numbers, hosts and addresses stay consistent
27
+ * across the file.
28
+ *
29
+ * @param {TraceRecord} record - A record, redacted or not
30
+ * @param {SanitizeOptions} options - Credentials and rewrites
31
+ * @return {TraceRecord} A sanitized copy
32
+ */
33
+ export declare function sanitizeRecord(record: TraceRecord, options: SanitizeOptions): TraceRecord;
34
+ /**
35
+ * Reads credentials out of a simpledata credentials.yaml already parsed.
36
+ *
37
+ * @param {unknown} parsed - The parsed YAML (a list of Credentials resources)
38
+ * @return {Credential[]} username and password pairs
39
+ */
40
+ export declare function credentialsFromResources(parsed: unknown): Credential[];
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnknownCredentialError = void 0;
4
+ exports.sanitizeRecord = sanitizeRecord;
5
+ exports.credentialsFromResources = credentialsFromResources;
6
+ /*
7
+ * Copyright (C) 2026 by Fonoster Inc (https://fonoster.com)
8
+ * http://github.com/fonoster/routr
9
+ *
10
+ * This file is part of Routr.
11
+ *
12
+ * Licensed under the MIT License (the "License");
13
+ * you may not use this file except in compliance with
14
+ * the License. You may obtain a copy of the License at
15
+ *
16
+ * https://opensource.org/licenses/MIT
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ const auth_1 = require("../auth");
25
+ /**
26
+ * Thrown when a record carries an Authorization whose username has no
27
+ * test credential: the file would not replay.
28
+ */
29
+ class UnknownCredentialError extends Error {
30
+ /**
31
+ * @param {string} username - The digest username without a credential
32
+ * @param {number} seq - The record it appears on
33
+ */
34
+ constructor(username, seq) {
35
+ super(`record ${seq}: no credential for digest username "${username}"`);
36
+ this.name = "UnknownCredentialError";
37
+ this.username = username;
38
+ }
39
+ }
40
+ exports.UnknownCredentialError = UnknownCredentialError;
41
+ /**
42
+ * Makes a recording committable as a known-good: every digest response is
43
+ * recomputed with the test password for its username (the digest is
44
+ * stateless, so the record keeps authenticating), then each rewrite is
45
+ * applied to every string so numbers, hosts and addresses stay consistent
46
+ * across the file.
47
+ *
48
+ * @param {TraceRecord} record - A record, redacted or not
49
+ * @param {SanitizeOptions} options - Credentials and rewrites
50
+ * @return {TraceRecord} A sanitized copy
51
+ */
52
+ function sanitizeRecord(record, options) {
53
+ var _a, _b;
54
+ const copy = JSON.parse(JSON.stringify(record));
55
+ const messages = [copy.request.message, (_a = copy.response) === null || _a === void 0 ? void 0 : _a.message].filter(Boolean);
56
+ messages.forEach((m) => {
57
+ var _a;
58
+ const auth = m.authorization;
59
+ if (!(auth === null || auth === void 0 ? void 0 : auth.username))
60
+ return;
61
+ const cred = options.credentials.find((c) => c.username === auth.username);
62
+ if (!cred)
63
+ throw new UnknownCredentialError(auth.username, record.seq);
64
+ const method = ((_a = auth.method) !== null && _a !== void 0 ? _a : copy.method);
65
+ auth.response = (0, auth_1.calculateAuthResponse)(Object.assign(Object.assign({}, auth), { method }), { username: cred.username, secret: cred.password });
66
+ });
67
+ const rewrites = (_b = options.rewrites) !== null && _b !== void 0 ? _b : [];
68
+ if (!rewrites.length)
69
+ return copy;
70
+ const text = rewrites.reduce((acc, [from, to]) => acc.split(from).join(to), JSON.stringify(copy));
71
+ return JSON.parse(text);
72
+ }
73
+ /**
74
+ * Reads credentials out of a simpledata credentials.yaml already parsed.
75
+ *
76
+ * @param {unknown} parsed - The parsed YAML (a list of Credentials resources)
77
+ * @return {Credential[]} username and password pairs
78
+ */
79
+ function credentialsFromResources(parsed) {
80
+ if (!Array.isArray(parsed))
81
+ return [];
82
+ return parsed
83
+ .map((r) => { var _a; return (_a = r === null || r === void 0 ? void 0 : r.spec) === null || _a === void 0 ? void 0 : _a.credentials; })
84
+ .filter((c) => !!(c === null || c === void 0 ? void 0 : c.username) && !!(c === null || c === void 0 ? void 0 : c.password));
85
+ }
@@ -0,0 +1,338 @@
1
+ import { HopAction, HopKind, Profile, Severity, TraceKind, TraceOutcome } from "./types";
2
+ /**
3
+ * JSON Schema (draft-07) for one line of a trace file, traceVersion 1.
4
+ * The envelope is strict; the SIP message payloads mirror the processor
5
+ * proto and are validated only for shape.
6
+ */
7
+ export declare const traceRecordSchema: {
8
+ title: string;
9
+ type: string;
10
+ properties: {
11
+ traceVersion: {
12
+ type: string;
13
+ const: number;
14
+ };
15
+ recordedAt: {
16
+ type: string;
17
+ pattern: string;
18
+ };
19
+ callId: {
20
+ type: string;
21
+ minLength: number;
22
+ };
23
+ seq: {
24
+ type: string;
25
+ minimum: number;
26
+ };
27
+ tOffsetMs: {
28
+ type: string;
29
+ minimum: number;
30
+ };
31
+ kind: {
32
+ type: string;
33
+ enum: TraceKind[];
34
+ };
35
+ method: {
36
+ type: string;
37
+ minLength: number;
38
+ };
39
+ status: {
40
+ type: string;
41
+ minimum: number;
42
+ maximum: number;
43
+ };
44
+ edgePort: {
45
+ type: string;
46
+ properties: {
47
+ ref: {
48
+ type: string;
49
+ };
50
+ version: {
51
+ type: string;
52
+ };
53
+ };
54
+ required: string[];
55
+ additionalProperties: boolean;
56
+ };
57
+ dispatcher: {
58
+ type: string;
59
+ properties: {
60
+ ref: {
61
+ type: string;
62
+ };
63
+ version: {
64
+ type: string;
65
+ };
66
+ };
67
+ required: string[];
68
+ additionalProperties: boolean;
69
+ };
70
+ trunkRef: {
71
+ type: string;
72
+ };
73
+ request: {
74
+ type: string;
75
+ properties: {
76
+ ref: {
77
+ type: string;
78
+ };
79
+ edgePortRef: {
80
+ type: string;
81
+ };
82
+ method: {
83
+ type: string;
84
+ };
85
+ sender: {
86
+ type: string;
87
+ };
88
+ listeningPoints: {
89
+ type: string;
90
+ };
91
+ externalAddrs: {
92
+ type: string;
93
+ items: {
94
+ type: string;
95
+ };
96
+ };
97
+ localnets: {
98
+ type: string;
99
+ items: {
100
+ type: string;
101
+ };
102
+ };
103
+ message: {
104
+ type: string;
105
+ properties: {
106
+ messageType: {
107
+ type: string;
108
+ };
109
+ from: {
110
+ type: string[];
111
+ };
112
+ to: {
113
+ type: string[];
114
+ };
115
+ via: {
116
+ type: string;
117
+ };
118
+ extensions: {
119
+ type: string;
120
+ };
121
+ };
122
+ };
123
+ metadata: {
124
+ type: string;
125
+ additionalProperties: {
126
+ type: string;
127
+ };
128
+ };
129
+ edgePortVersion: {
130
+ type: string;
131
+ };
132
+ receivedOn: {
133
+ type: string;
134
+ properties: {
135
+ host: {
136
+ type: string;
137
+ };
138
+ port: {
139
+ type: string;
140
+ };
141
+ transport: {
142
+ type: string;
143
+ };
144
+ };
145
+ required: string[];
146
+ };
147
+ };
148
+ required: string[];
149
+ };
150
+ hops: {
151
+ type: string;
152
+ items: {
153
+ type: string;
154
+ properties: {
155
+ component: {
156
+ type: string;
157
+ minLength: number;
158
+ };
159
+ kind: {
160
+ type: string;
161
+ enum: HopKind[];
162
+ };
163
+ version: {
164
+ type: string;
165
+ };
166
+ durationMs: {
167
+ type: string;
168
+ minimum: number;
169
+ };
170
+ action: {
171
+ type: string;
172
+ enum: HopAction[];
173
+ };
174
+ diff: {
175
+ type: string;
176
+ properties: {
177
+ requestUri: {
178
+ type: string;
179
+ properties: {
180
+ from: {
181
+ type: string;
182
+ };
183
+ to: {
184
+ type: string;
185
+ };
186
+ };
187
+ required: string[];
188
+ additionalProperties: boolean;
189
+ };
190
+ headers: {
191
+ type: string;
192
+ properties: {
193
+ added: {
194
+ type: string;
195
+ additionalProperties: {
196
+ type: string;
197
+ };
198
+ };
199
+ removed: {
200
+ type: string;
201
+ additionalProperties: {
202
+ type: string;
203
+ };
204
+ };
205
+ changed: {
206
+ type: string;
207
+ additionalProperties: {
208
+ type: string;
209
+ properties: {
210
+ from: {
211
+ type: string;
212
+ };
213
+ to: {
214
+ type: string;
215
+ };
216
+ };
217
+ required: string[];
218
+ additionalProperties: boolean;
219
+ };
220
+ };
221
+ };
222
+ required: string[];
223
+ additionalProperties: boolean;
224
+ };
225
+ };
226
+ required: string[];
227
+ additionalProperties: boolean;
228
+ };
229
+ error: {
230
+ type: string;
231
+ };
232
+ metadata: {
233
+ type: string;
234
+ additionalProperties: {
235
+ type: string;
236
+ };
237
+ };
238
+ };
239
+ required: string[];
240
+ additionalProperties: boolean;
241
+ };
242
+ };
243
+ response: {
244
+ type: string[];
245
+ properties: {
246
+ message: {
247
+ type: string;
248
+ properties: {
249
+ messageType: {
250
+ type: string;
251
+ };
252
+ from: {
253
+ type: string[];
254
+ };
255
+ to: {
256
+ type: string[];
257
+ };
258
+ via: {
259
+ type: string;
260
+ };
261
+ extensions: {
262
+ type: string;
263
+ };
264
+ };
265
+ };
266
+ metadata: {
267
+ type: string;
268
+ additionalProperties: {
269
+ type: string;
270
+ };
271
+ };
272
+ };
273
+ required: string[];
274
+ };
275
+ outcome: {
276
+ type: string;
277
+ enum: TraceOutcome[];
278
+ };
279
+ totalMs: {
280
+ type: string;
281
+ minimum: number;
282
+ };
283
+ lint: {
284
+ type: string;
285
+ properties: {
286
+ version: {
287
+ type: string;
288
+ };
289
+ profiles: {
290
+ type: string;
291
+ items: {
292
+ type: string;
293
+ enum: Profile[];
294
+ };
295
+ };
296
+ };
297
+ required: string[];
298
+ additionalProperties: boolean;
299
+ };
300
+ findings: {
301
+ type: string;
302
+ items: {
303
+ type: string;
304
+ properties: {
305
+ rule: {
306
+ type: string;
307
+ minLength: number;
308
+ };
309
+ profile: {
310
+ type: string;
311
+ enum: Profile[];
312
+ };
313
+ severity: {
314
+ type: string;
315
+ enum: Severity[];
316
+ };
317
+ spec: {
318
+ type: string;
319
+ };
320
+ message: {
321
+ type: string;
322
+ };
323
+ side: {
324
+ type: string;
325
+ enum: string[];
326
+ };
327
+ header: {
328
+ type: string;
329
+ };
330
+ };
331
+ required: string[];
332
+ additionalProperties: boolean;
333
+ };
334
+ };
335
+ };
336
+ required: string[];
337
+ additionalProperties: boolean;
338
+ };
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.traceRecordSchema = void 0;
4
+ /*
5
+ * Copyright (C) 2026 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/routr
7
+ *
8
+ * This file is part of Routr.
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const types_1 = require("./types");
23
+ const headerChange = {
24
+ type: "object",
25
+ properties: {
26
+ from: { type: "string" },
27
+ to: { type: "string" }
28
+ },
29
+ required: ["from", "to"],
30
+ additionalProperties: false
31
+ };
32
+ const stringMap = {
33
+ type: "object",
34
+ additionalProperties: { type: "string" }
35
+ };
36
+ const component = {
37
+ type: "object",
38
+ properties: {
39
+ ref: { type: "string" },
40
+ version: { type: "string" }
41
+ },
42
+ required: ["ref"],
43
+ additionalProperties: false
44
+ };
45
+ const diff = {
46
+ type: "object",
47
+ properties: {
48
+ requestUri: headerChange,
49
+ headers: {
50
+ type: "object",
51
+ properties: {
52
+ added: stringMap,
53
+ removed: stringMap,
54
+ changed: { type: "object", additionalProperties: headerChange }
55
+ },
56
+ required: ["added", "removed", "changed"],
57
+ additionalProperties: false
58
+ }
59
+ },
60
+ required: ["headers"],
61
+ additionalProperties: false
62
+ };
63
+ const hop = {
64
+ type: "object",
65
+ properties: {
66
+ component: { type: "string", minLength: 1 },
67
+ kind: { type: "string", enum: Object.values(types_1.HopKind) },
68
+ version: { type: "string" },
69
+ durationMs: { type: "number", minimum: 0 },
70
+ action: { type: "string", enum: Object.values(types_1.HopAction) },
71
+ diff,
72
+ error: { type: "string" },
73
+ metadata: stringMap
74
+ },
75
+ required: ["component", "kind", "durationMs", "action"],
76
+ additionalProperties: false
77
+ };
78
+ // A processor-generated response (a 401 challenge, a 404) carries only the
79
+ // fields the processor set; the EdgePort completes it from the request.
80
+ // So only the shape is checked here, no header is required.
81
+ const sipMessage = {
82
+ type: "object",
83
+ properties: {
84
+ messageType: { type: "string" },
85
+ // proto-loader emits null for unset message fields
86
+ from: { type: ["object", "null"] },
87
+ to: { type: ["object", "null"] },
88
+ via: { type: "array" },
89
+ extensions: { type: "array" }
90
+ }
91
+ };
92
+ const netInterface = {
93
+ type: "object",
94
+ properties: {
95
+ host: { type: "string" },
96
+ port: { type: "integer" },
97
+ transport: { type: "string" }
98
+ },
99
+ required: ["host", "port", "transport"]
100
+ };
101
+ const request = {
102
+ type: "object",
103
+ properties: {
104
+ ref: { type: "string" },
105
+ edgePortRef: { type: "string" },
106
+ method: { type: "string" },
107
+ sender: { type: "object" },
108
+ listeningPoints: { type: "array" },
109
+ externalAddrs: { type: "array", items: { type: "string" } },
110
+ localnets: { type: "array", items: { type: "string" } },
111
+ message: sipMessage,
112
+ metadata: stringMap,
113
+ edgePortVersion: { type: "string" },
114
+ receivedOn: netInterface
115
+ },
116
+ required: ["ref", "edgePortRef", "method", "sender", "message"]
117
+ };
118
+ const finding = {
119
+ type: "object",
120
+ properties: {
121
+ rule: { type: "string", minLength: 1 },
122
+ profile: { type: "string", enum: Object.values(types_1.Profile) },
123
+ severity: { type: "string", enum: Object.values(types_1.Severity) },
124
+ spec: { type: "string" },
125
+ message: { type: "string" },
126
+ side: { type: "string", enum: ["in", "out", "call"] },
127
+ header: { type: "string" }
128
+ },
129
+ required: ["rule", "profile", "severity", "spec", "message", "side"],
130
+ additionalProperties: false
131
+ };
132
+ const lint = {
133
+ type: "object",
134
+ properties: {
135
+ version: { type: "string" },
136
+ profiles: {
137
+ type: "array",
138
+ items: { type: "string", enum: Object.values(types_1.Profile) }
139
+ }
140
+ },
141
+ required: ["version", "profiles"],
142
+ additionalProperties: false
143
+ };
144
+ const response = {
145
+ type: ["object", "null"],
146
+ properties: {
147
+ message: sipMessage,
148
+ metadata: stringMap
149
+ },
150
+ required: ["message"]
151
+ };
152
+ /**
153
+ * JSON Schema (draft-07) for one line of a trace file, traceVersion 1.
154
+ * The envelope is strict; the SIP message payloads mirror the processor
155
+ * proto and are validated only for shape.
156
+ */
157
+ exports.traceRecordSchema = {
158
+ title: "Routr trace record",
159
+ type: "object",
160
+ properties: {
161
+ traceVersion: { type: "integer", const: 1 },
162
+ recordedAt: { type: "string", pattern: "^\\d{4}-\\d{2}-\\d{2}T" },
163
+ callId: { type: "string", minLength: 1 },
164
+ seq: { type: "integer", minimum: 1 },
165
+ tOffsetMs: { type: "number", minimum: 0 },
166
+ kind: { type: "string", enum: Object.values(types_1.TraceKind) },
167
+ method: { type: "string", minLength: 1 },
168
+ status: { type: "integer", minimum: 100, maximum: 699 },
169
+ edgePort: component,
170
+ dispatcher: component,
171
+ trunkRef: { type: "string" },
172
+ request,
173
+ hops: { type: "array", items: hop },
174
+ response,
175
+ outcome: { type: "string", enum: Object.values(types_1.TraceOutcome) },
176
+ totalMs: { type: "number", minimum: 0 },
177
+ lint,
178
+ findings: { type: "array", items: finding }
179
+ },
180
+ required: [
181
+ "traceVersion",
182
+ "recordedAt",
183
+ "callId",
184
+ "seq",
185
+ "tOffsetMs",
186
+ "kind",
187
+ "method",
188
+ "edgePort",
189
+ "dispatcher",
190
+ "request",
191
+ "hops",
192
+ "response",
193
+ "outcome",
194
+ "totalMs"
195
+ ],
196
+ additionalProperties: false
197
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Returns the numeric SIP status for a response type, or undefined when the
3
+ * type is unknown.
4
+ *
5
+ * @param {string} responseType - A ResponseType name as carried by the proto
6
+ * @return {number | undefined} The status code
7
+ */
8
+ export declare function statusCodeOf(responseType?: string): number | undefined;
9
+ /**
10
+ * Returns a lowercase reason phrase for a response type, e.g. "ringing".
11
+ *
12
+ * @param {string} responseType - A ResponseType name as carried by the proto
13
+ * @return {string} The phrase
14
+ */
15
+ export declare function reasonPhraseOf(responseType?: string): string;