@openapi-typescript-infra/service 6.1.2 → 6.2.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 (88) hide show
  1. package/.yarn/patches/confit-npm-3.0.0-eade8c7ce1.patch +52 -0
  2. package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
  3. package/.yarn/releases/yarn-3.2.3.cjs +783 -0
  4. package/.yarnrc.yml +7 -0
  5. package/Makefile +3 -1
  6. package/__tests__/config.test.ts +53 -0
  7. package/__tests__/fake-serv/api/fake-serv.yaml +48 -0
  8. package/__tests__/fake-serv/config/config.json +13 -0
  9. package/__tests__/fake-serv/src/handlers/hello.ts +17 -0
  10. package/__tests__/fake-serv/src/index.ts +36 -0
  11. package/__tests__/fake-serv/src/routes/error.ts +16 -0
  12. package/__tests__/fake-serv/src/routes/index.ts +19 -0
  13. package/__tests__/fake-serv/src/routes/other/world.ts +7 -0
  14. package/__tests__/fake-serv.test.ts +119 -0
  15. package/__tests__/vitest.test-setup.ts +15 -0
  16. package/build/bin/start-service.js +1 -1
  17. package/build/bin/start-service.js.map +1 -1
  18. package/build/bootstrap.d.ts +1 -1
  19. package/build/bootstrap.js +0 -2
  20. package/build/bootstrap.js.map +1 -1
  21. package/build/config/index.d.ts +1 -1
  22. package/build/config/index.js +1 -1
  23. package/build/config/index.js.map +1 -1
  24. package/build/config/schema.d.ts +1 -1
  25. package/build/config/schema.js +0 -1
  26. package/build/config/shortstops.d.ts +17 -2
  27. package/build/config/shortstops.js.map +1 -1
  28. package/build/config/validation.d.ts +1 -1
  29. package/build/development/port-finder.js +0 -1
  30. package/build/development/port-finder.js.map +1 -1
  31. package/build/development/repl.d.ts +2 -2
  32. package/build/development/repl.js +11 -8
  33. package/build/development/repl.js.map +1 -1
  34. package/build/env.js +1 -0
  35. package/build/env.js.map +1 -1
  36. package/build/error.d.ts +1 -1
  37. package/build/express-app/app.d.ts +1 -1
  38. package/build/express-app/app.js +8 -9
  39. package/build/express-app/app.js.map +1 -1
  40. package/build/express-app/internal-server.d.ts +2 -2
  41. package/build/express-app/route-loader.d.ts +1 -1
  42. package/build/express-app/types.d.ts +1 -1
  43. package/build/express-app/types.js +0 -1
  44. package/build/hook.d.ts +1 -1
  45. package/build/openapi.d.ts +2 -2
  46. package/build/openapi.js +1 -0
  47. package/build/openapi.js.map +1 -1
  48. package/build/telemetry/DummyExporter.d.ts +1 -1
  49. package/build/telemetry/DummyExporter.js.map +1 -1
  50. package/build/telemetry/index.js +1 -2
  51. package/build/telemetry/index.js.map +1 -1
  52. package/build/telemetry/instrumentations.d.ts +4 -2
  53. package/build/telemetry/instrumentations.js +1 -1
  54. package/build/telemetry/instrumentations.js.map +1 -1
  55. package/build/telemetry/requestLogger.d.ts +3 -3
  56. package/build/telemetry/requestLogger.js.map +1 -1
  57. package/build/types.d.ts +6 -6
  58. package/build/types.js +0 -1
  59. package/package.json +31 -30
  60. package/src/bin/start-service.ts +1 -1
  61. package/src/bootstrap.ts +6 -6
  62. package/src/config/index.ts +2 -7
  63. package/src/config/schema.ts +1 -1
  64. package/src/config/shortstops.ts +3 -3
  65. package/src/config/validation.ts +1 -1
  66. package/src/development/port-finder.ts +0 -1
  67. package/src/development/repl.ts +14 -10
  68. package/src/env.ts +1 -0
  69. package/src/error.ts +1 -1
  70. package/src/express-app/app.ts +11 -12
  71. package/src/express-app/internal-server.ts +2 -2
  72. package/src/express-app/route-loader.ts +1 -1
  73. package/src/express-app/types.ts +1 -1
  74. package/src/hook.ts +1 -1
  75. package/src/openapi.ts +4 -3
  76. package/src/telemetry/DummyExporter.ts +2 -1
  77. package/src/telemetry/index.ts +2 -3
  78. package/src/telemetry/instrumentations.ts +5 -6
  79. package/src/telemetry/requestLogger.ts +7 -7
  80. package/src/types.ts +6 -6
  81. package/.commitlintrc.json +0 -5
  82. package/.eslintignore +0 -11
  83. package/.eslintrc.cjs +0 -14
  84. package/.prettierrc.cjs +0 -14
  85. package/build/tsconfig.build.tsbuildinfo +0 -1
  86. package/tsconfig.build.json +0 -11
  87. package/tsconfig.json +0 -35
  88. package/vitest.config.ts +0 -19
@@ -2,13 +2,8 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
 
5
- import {
6
- BaseConfitSchema,
7
- Confit,
8
- Factory,
9
- ShortstopHandler,
10
- confit,
11
- } from '@sesamecare-oss/confit';
5
+ import type { BaseConfitSchema, Confit, Factory, ShortstopHandler } from '@sesamecare-oss/confit';
6
+ import { confit } from '@sesamecare-oss/confit';
12
7
 
13
8
  import { getAvailablePort } from '../development/port-finder.js';
14
9
 
@@ -1,7 +1,7 @@
1
1
  import type { BaseConfitSchema } from '@sesamecare-oss/confit';
2
2
  import type { middleware } from 'express-openapi-validator';
3
3
  import type { Level } from 'pino';
4
- import bodyParser from 'body-parser';
4
+ import type bodyParser from 'body-parser';
5
5
 
6
6
  export interface ConfigurationItemEnabled {
7
7
  enabled?: boolean;
@@ -144,12 +144,12 @@ export function shortstops(service: { name: string }, sourcedir: string) {
144
144
  servicetype: serviceTypeFactory(service.name),
145
145
  servicename: (v: string) => v.replace(/\$\{name\}/g, service.name),
146
146
 
147
- os(p: keyof typeof osMethods) {
148
- return osMethods[p]();
147
+ os(p: string) {
148
+ return osMethods[p as keyof typeof osMethods]();
149
149
  },
150
150
  // No-op in case you have values that start with a shortstop handler name (and colon)
151
151
  literal(v: string) {
152
152
  return v;
153
153
  },
154
- } as Record<string, ShortstopHandler<string, unknown>>;
154
+ } satisfies Record<string, ShortstopHandler<string, unknown>>;
155
155
  }
@@ -1,4 +1,4 @@
1
- import { ConfigurationSchema } from './schema.js';
1
+ import type { ConfigurationSchema } from './schema.js';
2
2
 
3
3
  export interface ConfigValidationError {
4
4
  path: string;
@@ -33,7 +33,6 @@ async function isAvailable(port: number) {
33
33
 
34
34
  async function findPort(start: number) {
35
35
  for (let p = start; p < start + 1000; p += 1) {
36
- // eslint-disable-next-line no-await-in-loop
37
36
  if (await isAvailable(p)) {
38
37
  return p;
39
38
  }
@@ -1,12 +1,13 @@
1
- import repl, { REPLServer } from 'repl';
2
- import fs from 'fs';
3
- import path from 'path';
1
+ import type { REPLServer } from 'node:repl';
2
+ import repl from 'node:repl';
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
4
5
 
5
6
  import { glob } from 'glob';
6
7
  import { set } from 'moderndash';
7
8
 
8
- import { AnyServiceLocals, ServiceExpress, ServiceLocals } from '../types.js';
9
- import { ConfigurationSchema } from '../config/schema.js';
9
+ import type { AnyServiceLocals, ServiceExpress, ServiceLocals } from '../types.js';
10
+ import type { ConfigurationSchema } from '../config/schema.js';
10
11
 
11
12
  const REPL_PROP = '$$repl$$';
12
13
 
@@ -37,7 +38,6 @@ export function serviceRepl<SLocals extends AnyServiceLocals = ServiceLocals<Con
37
38
  app,
38
39
  req: new FakeReq('/'),
39
40
  dump(o: unknown) {
40
- // eslint-disable-next-line no-console
41
41
  console.log(JSON.stringify(o, null, '\t'));
42
42
  },
43
43
  // Use iTerm2's escape code to copy to clipboard
@@ -54,7 +54,10 @@ export function serviceRepl<SLocals extends AnyServiceLocals = ServiceLocals<Con
54
54
  });
55
55
  app.locals.service.attachRepl?.(app, rl);
56
56
 
57
- loadReplFunctions(app, codepath, rl);
57
+ loadReplFunctions(app, codepath, rl).catch((error) => {
58
+ // eslint-disable-next-line no-console
59
+ console.error('Failed to load REPL functions', error);
60
+ });
58
61
 
59
62
  rl.on('exit', onExit);
60
63
  }
@@ -78,9 +81,9 @@ async function loadReplFunctions<
78
81
  const module = await import(path.resolve(file));
79
82
 
80
83
  // Look for functions with the REPL_PROP marker
81
- Object.values(module).forEach((exported) => {
84
+ for (const exported of Object.values(module as Record<string, unknown>)) {
82
85
  if (!exported) {
83
- return;
86
+ continue;
84
87
  }
85
88
  if (typeof exported === 'function') {
86
89
  const replName = (exported as WithReplProp)[REPL_PROP];
@@ -88,9 +91,10 @@ async function loadReplFunctions<
88
91
  set(rl.context, replName, exported.bind(null, app));
89
92
  }
90
93
  }
91
- });
94
+ }
92
95
  }
93
96
  } catch (err) {
97
+ // eslint-disable-next-line no-console
94
98
  console.error(`Failed to load REPL functions from ${file}:`, err);
95
99
  }
96
100
  }
package/src/env.ts CHANGED
@@ -6,6 +6,7 @@ export function getNodeEnv(): ValidEnv {
6
6
  case 'staging':
7
7
  case 'test':
8
8
  return (process.env.APP_ENV || process.env.NODE_ENV) as ValidEnv;
9
+ case undefined:
9
10
  default:
10
11
  return 'development';
11
12
  }
package/src/error.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConfigurationSchema } from './config/schema.js';
1
+ import type { ConfigurationSchema } from './config/schema.js';
2
2
  import type { AnyServiceLocals, ServiceLike, ServiceLocals } from './types.js';
3
3
 
4
4
  export interface ServiceErrorSpec {
@@ -26,7 +26,7 @@ import type {
26
26
  ServiceOptions,
27
27
  ServiceStartOptions,
28
28
  } from '../types.js';
29
- import { ConfigurationSchema } from '../config/schema.js';
29
+ import type { ConfigurationSchema } from '../config/schema.js';
30
30
  import { shortstops } from '../config/shortstops.js';
31
31
  import { getNodeEnv, isDev } from '../env.js';
32
32
  import { getGlobalPrometheusExporter } from '../telemetry/index.js';
@@ -156,20 +156,19 @@ export async function startApp<
156
156
  // so that the req can decide whether to save the raw request body or not.
157
157
  const attachServiceLocals: RequestHandler = (req, res, next) => {
158
158
  res.locals.logger = logger;
159
- let maybePromise: Promise<void> | void | undefined;
160
159
  try {
161
- maybePromise = serviceImpl.onRequest?.(
160
+ const result = serviceImpl.onRequest?.(
162
161
  req as RequestWithApp<SLocals>,
163
162
  res as Response<unknown, RLocals>,
164
163
  );
164
+ if (result !== undefined && result !== null && typeof result.then === 'function') {
165
+ void result.catch(next).then(next);
166
+ } else {
167
+ next();
168
+ }
165
169
  } catch (error) {
166
170
  next(error);
167
171
  }
168
- if (maybePromise) {
169
- maybePromise.catch(next).then(next);
170
- } else {
171
- next();
172
- }
173
172
  };
174
173
  app.use(attachServiceLocals);
175
174
 
@@ -322,7 +321,7 @@ function httpServer<
322
321
  );
323
322
  }
324
323
 
325
- function url(config: ConfigurationSchema['server'], port: number) {
324
+ function url(config: ConfigurationSchema['server'], port?: number) {
326
325
  if (config.certificate) {
327
326
  return `https://${config.hostname}${port === 443 ? '' : `:${port}`}`;
328
327
  }
@@ -333,7 +332,7 @@ export async function listen<SLocals extends AnyServiceLocals = ServiceLocals<Co
333
332
  app: ServiceExpress<SLocals>,
334
333
  shutdownHandler?: () => Promise<void>,
335
334
  ) {
336
- const config = app.locals.config.server || {};
335
+ const config: ConfigurationSchema['server'] = app.locals.config.server || {};
337
336
  const { port } = config;
338
337
 
339
338
  const { service, logger } = app.locals;
@@ -384,7 +383,7 @@ export async function listen<SLocals extends AnyServiceLocals = ServiceLocals<Co
384
383
  app.locals.internalApp.locals.server?.close();
385
384
  }
386
385
  }
387
- shutdownApp(app);
386
+ void shutdownApp(app);
388
387
  }
389
388
  });
390
389
 
@@ -401,7 +400,7 @@ export async function listen<SLocals extends AnyServiceLocals = ServiceLocals<Co
401
400
  const serverConfig = app.locals.config.server;
402
401
  // Ok now start the internal port if we have one.
403
402
  if (serverConfig?.internalPort || serverConfig?.internalPort === 0) {
404
- startInternalApp(app, serverConfig.internalPort)
403
+ startInternalApp(app, serverConfig.internalPort as number)
405
404
  .then((internalApp) => {
406
405
  locals.internalApp = internalApp;
407
406
  const prometheusExporter = getGlobalPrometheusExporter();
@@ -1,9 +1,9 @@
1
1
  import express from 'express';
2
2
  import type { Application } from 'express-serve-static-core';
3
3
 
4
- import { AnyServiceLocals, InternalLocals, ServiceExpress, ServiceLocals } from '../types.js';
4
+ import type { AnyServiceLocals, InternalLocals, ServiceExpress, ServiceLocals } from '../types.js';
5
5
  import { getAvailablePort } from '../development/port-finder.js';
6
- import { ConfigurationSchema } from '../config/schema.js';
6
+ import type { ConfigurationSchema } from '../config/schema.js';
7
7
 
8
8
  export async function startInternalApp<
9
9
  SLocals extends AnyServiceLocals = ServiceLocals<ConfigurationSchema>,
@@ -3,7 +3,7 @@ import path from 'path';
3
3
  import { Router } from 'express';
4
4
 
5
5
  import type { AnyServiceLocals, ServiceExpress, ServiceLocals } from '../types.js';
6
- import { ConfigurationSchema } from '../config/schema.js';
6
+ import type { ConfigurationSchema } from '../config/schema.js';
7
7
 
8
8
  import { getFilesInDir } from './modules.js';
9
9
 
@@ -1,7 +1,7 @@
1
1
  import type { NextFunction, Response } from 'express';
2
2
 
3
3
  import type { AnyServiceLocals, RequestLocals, RequestWithApp, ServiceLocals } from '../types.js';
4
- import { ConfigurationSchema } from '../config/schema.js';
4
+ import type { ConfigurationSchema } from '../config/schema.js';
5
5
 
6
6
  export type ServiceHandler<
7
7
  SLocals extends AnyServiceLocals = ServiceLocals<ConfigurationSchema>,
package/src/hook.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConfigurationSchema } from './config/schema.js';
1
+ import type { ConfigurationSchema } from './config/schema.js';
2
2
  import type { AnyServiceLocals, RequestLocals, Service, ServiceLocals } from './types.js';
3
3
 
4
4
  /**
package/src/openapi.ts CHANGED
@@ -8,7 +8,7 @@ import type { Handler, Request, RequestHandler } from 'express';
8
8
  import type { AnyServiceLocals, ServiceExpress, ServiceLocals } from './types.js';
9
9
  import { getNodeEnv } from './env.js';
10
10
  import { getFilesInDir } from './express-app/modules.js';
11
- import { ConfigurationSchema } from './config/schema.js';
11
+ import type { ConfigurationSchema } from './config/schema.js';
12
12
 
13
13
  const notImplementedHandler: Handler = (req, res) => {
14
14
  res.status(501).json({
@@ -55,7 +55,7 @@ export async function openApi<
55
55
  });
56
56
  }),
57
57
  );
58
- const modulesByPath = moduleFiles.reduce(
58
+ const modulesByPath = moduleFiles.reduce<Record<string, Record<string, unknown>>>(
59
59
  (acc, file, index) => {
60
60
  const m = preloadedModules[index];
61
61
  if (m) {
@@ -63,7 +63,7 @@ export async function openApi<
63
63
  }
64
64
  return acc;
65
65
  },
66
- {} as Record<string, Record<string, unknown>>,
66
+ {},
67
67
  );
68
68
 
69
69
  // This is nuts, but there are testing frameworks or some other things
@@ -134,6 +134,7 @@ export async function openApi<
134
134
  onError(error: Error, body: unknown, req: Request) {
135
135
  console.log('Response body fails validation: ', error);
136
136
  console.log('Emitted from:', req.originalUrl);
137
+ // eslint-disable-next-line no-console
137
138
  console.debug(body);
138
139
  throw error;
139
140
  },
@@ -1,4 +1,5 @@
1
- import { ExportResult, ExportResultCode } from '@opentelemetry/core';
1
+ import type { ExportResult } from '@opentelemetry/core';
2
+ import { ExportResultCode } from '@opentelemetry/core';
2
3
  import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
3
4
 
4
5
  export class DummySpanExporter implements SpanExporter {
@@ -83,7 +83,7 @@ export async function startGlobalTelemetry(
83
83
  if (!prometheusExporter) {
84
84
  const { metrics, logs, NodeSDK } = opentelemetry;
85
85
 
86
- const resource = await detectResources({
86
+ const resource = detectResources({
87
87
  detectors: [
88
88
  envDetector,
89
89
  hostDetector,
@@ -144,7 +144,6 @@ export async function startWithTelemetry<
144
144
  >(options: DelayLoadServiceStartOptions) {
145
145
  await startGlobalTelemetry(options.name, options.customizer);
146
146
 
147
- // eslint-disable-next-line import/no-unresolved, @typescript-eslint/no-var-requires
148
147
  const { startApp, listen } = (await import('../express-app/app.js')) as {
149
148
  startApp: StartAppFn<SLocals, RLocals>;
150
149
  listen: ListenFn<SLocals>;
@@ -154,7 +153,7 @@ export async function startWithTelemetry<
154
153
  const startOptions: ServiceStartOptions<SLocals> = {
155
154
  ...options,
156
155
  service,
157
- locals: { ...options.locals } as Partial<SLocals>,
156
+ locals: { ...options.locals } as unknown as Partial<SLocals>,
158
157
  };
159
158
  const app = await startApp(startOptions);
160
159
  app.locals.logger.info('OpenTelemetry enabled');
@@ -1,12 +1,11 @@
1
1
  import type { Instrumentation } from '@opentelemetry/instrumentation';
2
2
  import { DnsInstrumentation } from '@opentelemetry/instrumentation-dns';
3
- import { ExpressInstrumentation, SpanNameHook } from '@opentelemetry/instrumentation-express';
3
+ import type { SpanNameHook } from '@opentelemetry/instrumentation-express';
4
+ import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
4
5
  import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';
5
6
  import { GenericPoolInstrumentation } from '@opentelemetry/instrumentation-generic-pool';
6
- import {
7
- HttpInstrumentation,
8
- IgnoreIncomingRequestFunction,
9
- } from '@opentelemetry/instrumentation-http';
7
+ import type { IgnoreIncomingRequestFunction } from '@opentelemetry/instrumentation-http';
8
+ import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
10
9
  import { RedisInstrumentation } from '@opentelemetry/instrumentation-redis';
11
10
  import { NetInstrumentation } from '@opentelemetry/instrumentation-net';
12
11
  import { GraphQLInstrumentation } from '@opentelemetry/instrumentation-graphql';
@@ -85,7 +84,7 @@ const defaultConfigs: InstrumentationConfigMap = {
85
84
  export function getAutoInstrumentations(
86
85
  inputConfigs: InstrumentationConfigMap = defaultConfigs,
87
86
  ): Instrumentation[] {
88
- const keys = Object.keys(InstrumentationMap) as Array<keyof typeof InstrumentationMap>;
87
+ const keys = Object.keys(InstrumentationMap) as (keyof typeof InstrumentationMap)[];
89
88
  return keys
90
89
  .map((name) => {
91
90
  const Instance = InstrumentationMap[name];
@@ -1,12 +1,12 @@
1
1
  import type { RequestHandler, Request, Response, ErrorRequestHandler } from 'express';
2
2
  import { getClientIp } from 'request-ip';
3
- import { Histogram } from '@opentelemetry/api';
3
+ import type { Histogram } from '@opentelemetry/api';
4
4
  import cleanStack from 'clean-stack';
5
5
 
6
6
  import { ServiceError } from '../error.js';
7
7
  import type { AnyServiceLocals, RequestWithApp, ServiceExpress, ServiceLocals } from '../types.js';
8
8
  import type { ServiceHandler } from '../express-app/types.js';
9
- import { ConfigurationSchema } from '../config/schema.js';
9
+ import type { ConfigurationSchema } from '../config/schema.js';
10
10
  import { getNodeEnv } from '../env.js';
11
11
 
12
12
  const LOG_PREFS = Symbol('Logging information');
@@ -15,7 +15,7 @@ const LOGGED_SEMAPHORE = Symbol('Logged semaphore');
15
15
  interface LogPrefs {
16
16
  start: [number, number];
17
17
  logRequests?: boolean;
18
- chunks?: Array<Buffer>;
18
+ chunks?: Buffer[];
19
19
  logged: boolean;
20
20
  }
21
21
 
@@ -80,7 +80,7 @@ function finishLog<SLocals extends AnyServiceLocals = ServiceLocals<Configuratio
80
80
  }
81
81
  const [url, preInfo] = getBasicInfo(req);
82
82
 
83
- let responseType: string = 'finished';
83
+ let responseType = 'finished';
84
84
 
85
85
  // ts warning is known and incorrect—`aborted` is a subset of `destroyed`
86
86
  if (req.aborted) {
@@ -178,13 +178,13 @@ export function loggerMiddleware<
178
178
  const oldEnd = res.end;
179
179
  res.write = ((...args: Parameters<(typeof res)['write']>) => {
180
180
  if (prefs.chunks) {
181
- prefs.chunks.push(Buffer.isBuffer(args[0]) ? args[0] : Buffer.from(args[0]));
181
+ prefs.chunks.push(Buffer.isBuffer(args[0]) ? args[0] : Buffer.from(args[0] as string));
182
182
  }
183
183
  return (oldWrite as (typeof res)['write']).apply(res, args);
184
184
  }) as (typeof res)['write'];
185
185
  res.end = ((...args: Parameters<(typeof res)['end']>) => {
186
186
  if (args[0] && prefs.chunks) {
187
- prefs.chunks.push(Buffer.isBuffer(args[0]) ? args[0] : Buffer.from(args[0]));
187
+ prefs.chunks.push(Buffer.isBuffer(args[0]) ? args[0] : Buffer.from(args[0] as string));
188
188
  }
189
189
  return oldEnd.apply(res, args);
190
190
  }) as (typeof res)['end'];
@@ -230,7 +230,7 @@ export function errorHandlerMiddleware<
230
230
  // Set the status to error, even if we aren't going to render the error.
231
231
  res.status(loggable.status || 500);
232
232
  if (returnError) {
233
- finishLog(app, error, req, res, histogram);
233
+ finishLog(app, error as Error, req, res, histogram);
234
234
  const prefs = (res.locals as WithLogPrefs)[LOG_PREFS];
235
235
  prefs.logged = true;
236
236
  res.json({
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Server } from 'http';
2
- import type { REPLServer } from 'repl';
1
+ import type { Server } from 'node:http';
2
+ import type { REPLServer } from 'node:repl';
3
3
 
4
4
  import type { BaseLogger, Logger } from 'pino';
5
5
  import type { Request, Response } from 'express';
@@ -7,9 +7,9 @@ import type { Application } from 'express-serve-static-core';
7
7
  import type { middleware } from 'express-openapi-validator';
8
8
  import type { Meter } from '@opentelemetry/api';
9
9
  import type { NodeSDKConfiguration } from '@opentelemetry/sdk-node';
10
- import { ShortstopHandler } from '@sesamecare-oss/confit';
10
+ import type { ShortstopHandler } from '@sesamecare-oss/confit';
11
11
 
12
- import { ConfigurationSchema } from './config/schema.js';
12
+ import type { ConfigurationSchema } from './config/schema.js';
13
13
 
14
14
  export interface InternalLocals<
15
15
  SLocals extends AnyServiceLocals = ServiceLocals<ConfigurationSchema>,
@@ -82,7 +82,7 @@ export interface Service<
82
82
  // Called after the server is listening
83
83
  onListening?: (
84
84
  app: ServiceExpress<SLocals>,
85
- info: { port: number; protocol: 'http' | 'https' },
85
+ info: { port?: number; protocol: 'http' | 'https' },
86
86
  ) => void | Promise<void>;
87
87
 
88
88
  start(app: ServiceExpress<SLocals>): void | Promise<void>;
@@ -110,7 +110,7 @@ export interface Service<
110
110
  getLogFields?(
111
111
  req: RequestWithApp<SLocals>,
112
112
  values: Record<string, string | string[] | number | undefined>,
113
- ): string | undefined | void;
113
+ ): string | undefined;
114
114
 
115
115
  // The repl is a useful tool for diagnosing issues in non-dev environments.
116
116
  // The attachRepl method provides a way to add custom functionality
@@ -1,5 +0,0 @@
1
- {
2
- "extends": [
3
- "@commitlint/config-conventional"
4
- ]
5
- }
package/.eslintignore DELETED
@@ -1,11 +0,0 @@
1
- build/
2
- coverage
3
- jest.config.js
4
- vitest.config.?s
5
- .eslintrc.js
6
- coconfig.?s
7
- src/generated
8
- node_modules
9
- migrations/
10
- .yarn/
11
- **/*.k6.js
package/.eslintrc.cjs DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is generated by coconfig. Do not edit it directly.
3
- * Instead, edit the coconfig.js or coconfig.ts file in your project root.
4
- *
5
- * See https://github.com/gas-buddy/coconfig for more information.
6
- * @version coconfig@1.6.2
7
- */
8
- const configModule = require('@openapi-typescript-infra/coconfig');
9
-
10
- const configItem = configModule.default || configModule.config || configModule;
11
- const { configuration } = configItem && configItem['.eslintrc.cjs'];
12
- const resolved = typeof configuration === 'function' ? configuration() : configuration;
13
-
14
- module.exports = resolved;
package/.prettierrc.cjs DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is generated by coconfig. Do not edit it directly.
3
- * Instead, edit the coconfig.js or coconfig.ts file in your project root.
4
- *
5
- * See https://github.com/gas-buddy/coconfig for more information.
6
- * @version coconfig@1.6.2
7
- */
8
- const configModule = require('@openapi-typescript-infra/coconfig');
9
-
10
- const configItem = configModule.default || configModule.config || configModule;
11
- const { configuration } = configItem && configItem['.prettierrc.cjs'];
12
- const resolved = typeof configuration === 'function' ? configuration() : configuration;
13
-
14
- module.exports = resolved;