(private readonly options: RestApiHandlerOptions<Schema>)
| 278 | private nestedRoutes: boolean; |
| 279 | |
| 280 | constructor(private readonly options: RestApiHandlerOptions<Schema>) { |
| 281 | this.validateOptions(options); |
| 282 | |
| 283 | this.idDivider = options.idDivider ?? DEFAULT_ID_DIVIDER; |
| 284 | const segmentCharset = options.urlSegmentCharset ?? 'a-zA-Z0-9-_~ %'; |
| 285 | |
| 286 | this.modelNameMapping = options.modelNameMapping ?? {}; |
| 287 | this.modelNameMapping = Object.fromEntries( |
| 288 | Object.entries(this.modelNameMapping).map(([k, v]) => [lowerCaseFirst(k), v]), |
| 289 | ); |
| 290 | this.reverseModelNameMapping = Object.fromEntries( |
| 291 | Object.entries(this.modelNameMapping).map(([k, v]) => [v, k]), |
| 292 | ); |
| 293 | |
| 294 | this.externalIdMapping = options.externalIdMapping ?? {}; |
| 295 | this.externalIdMapping = Object.fromEntries( |
| 296 | Object.entries(this.externalIdMapping).map(([k, v]) => [lowerCaseFirst(k), v]), |
| 297 | ); |
| 298 | |
| 299 | this.nestedRoutes = options.nestedRoutes ?? false; |
| 300 | |
| 301 | this.urlPatternMap = this.buildUrlPatternMap(segmentCharset); |
| 302 | |
| 303 | this.buildTypeMap(); |
| 304 | this.buildSerializers(); |
| 305 | } |
| 306 | |
| 307 | private validateOptions(options: RestApiHandlerOptions<Schema>) { |
| 308 | const schema = z.strictObject({ |
nothing calls this directly
no test coverage detected