@openapi-typescript-infra/service 6.1.3 → 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.
- package/.yarn/patches/confit-npm-3.0.0-eade8c7ce1.patch +52 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
- package/.yarn/releases/yarn-3.2.3.cjs +783 -0
- package/.yarnrc.yml +7 -0
- package/__tests__/config.test.ts +53 -0
- package/__tests__/fake-serv/api/fake-serv.yaml +48 -0
- package/__tests__/fake-serv/config/config.json +13 -0
- package/__tests__/fake-serv/src/handlers/hello.ts +17 -0
- package/__tests__/fake-serv/src/index.ts +36 -0
- package/__tests__/fake-serv/src/routes/error.ts +16 -0
- package/__tests__/fake-serv/src/routes/index.ts +19 -0
- package/__tests__/fake-serv/src/routes/other/world.ts +7 -0
- package/__tests__/fake-serv.test.ts +119 -0
- package/__tests__/vitest.test-setup.ts +15 -0
- package/build/bin/start-service.js +1 -1
- package/build/bin/start-service.js.map +1 -1
- package/build/bootstrap.d.ts +1 -1
- package/build/bootstrap.js +0 -2
- package/build/bootstrap.js.map +1 -1
- package/build/config/index.d.ts +1 -1
- package/build/config/index.js +1 -1
- package/build/config/index.js.map +1 -1
- package/build/config/schema.d.ts +1 -1
- package/build/config/schema.js +0 -1
- package/build/config/shortstops.d.ts +17 -2
- package/build/config/shortstops.js.map +1 -1
- package/build/config/validation.d.ts +1 -1
- package/build/development/port-finder.js +0 -1
- package/build/development/port-finder.js.map +1 -1
- package/build/development/repl.d.ts +2 -2
- package/build/development/repl.js +11 -8
- package/build/development/repl.js.map +1 -1
- package/build/env.js +1 -0
- package/build/env.js.map +1 -1
- package/build/error.d.ts +1 -1
- package/build/express-app/app.d.ts +1 -1
- package/build/express-app/app.js +8 -9
- package/build/express-app/app.js.map +1 -1
- package/build/express-app/internal-server.d.ts +2 -2
- package/build/express-app/route-loader.d.ts +1 -1
- package/build/express-app/types.d.ts +1 -1
- package/build/express-app/types.js +0 -1
- package/build/hook.d.ts +1 -1
- package/build/openapi.d.ts +2 -2
- package/build/openapi.js +1 -0
- package/build/openapi.js.map +1 -1
- package/build/telemetry/DummyExporter.d.ts +1 -1
- package/build/telemetry/DummyExporter.js.map +1 -1
- package/build/telemetry/index.js +1 -2
- package/build/telemetry/index.js.map +1 -1
- package/build/telemetry/instrumentations.d.ts +4 -2
- package/build/telemetry/instrumentations.js +1 -1
- package/build/telemetry/instrumentations.js.map +1 -1
- package/build/telemetry/requestLogger.d.ts +3 -3
- package/build/telemetry/requestLogger.js.map +1 -1
- package/build/types.d.ts +6 -6
- package/build/types.js +0 -1
- package/package.json +31 -30
- package/src/bin/start-service.ts +1 -1
- package/src/bootstrap.ts +6 -6
- package/src/config/index.ts +2 -7
- package/src/config/schema.ts +1 -1
- package/src/config/shortstops.ts +3 -3
- package/src/config/validation.ts +1 -1
- package/src/development/port-finder.ts +0 -1
- package/src/development/repl.ts +14 -10
- package/src/env.ts +1 -0
- package/src/error.ts +1 -1
- package/src/express-app/app.ts +11 -12
- package/src/express-app/internal-server.ts +2 -2
- package/src/express-app/route-loader.ts +1 -1
- package/src/express-app/types.ts +1 -1
- package/src/hook.ts +1 -1
- package/src/openapi.ts +4 -3
- package/src/telemetry/DummyExporter.ts +2 -1
- package/src/telemetry/index.ts +2 -3
- package/src/telemetry/instrumentations.ts +5 -6
- package/src/telemetry/requestLogger.ts +7 -7
- package/src/types.ts +6 -6
- package/.commitlintrc.json +0 -5
- package/.eslintignore +0 -11
- package/.eslintrc.cjs +0 -14
- package/.prettierrc.cjs +0 -14
- package/build/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.build.json +0 -11
- package/tsconfig.json +0 -35
- package/vitest.config.ts +0 -19
package/src/development/repl.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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)
|
|
84
|
+
for (const exported of Object.values(module as Record<string, unknown>)) {
|
|
82
85
|
if (!exported) {
|
|
83
|
-
|
|
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
package/src/error.ts
CHANGED
package/src/express-app/app.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
|
package/src/express-app/types.ts
CHANGED
|
@@ -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
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
|
-
{}
|
|
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
|
|
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 {
|
package/src/telemetry/index.ts
CHANGED
|
@@ -83,7 +83,7 @@ export async function startGlobalTelemetry(
|
|
|
83
83
|
if (!prometheusExporter) {
|
|
84
84
|
const { metrics, logs, NodeSDK } = opentelemetry;
|
|
85
85
|
|
|
86
|
-
const resource =
|
|
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 {
|
|
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
|
-
|
|
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
|
|
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?:
|
|
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
|
|
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
|
|
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
|
|
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
|
package/.commitlintrc.json
DELETED
package/.eslintignore
DELETED
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;
|