@openapi-typescript-infra/service 4.3.4 → 4.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openapi-typescript-infra/service",
3
- "version": "4.3.4",
3
+ "version": "4.4.0",
4
4
  "description": "An opinionated framework for building configuration driven services - web, api, or ob. Uses OpenAPI, pino logging, express, confit, Typescript and vitest.",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -17,7 +17,6 @@
17
17
  "url": "git+https://github.com/openapi-typescript-infra/service.git"
18
18
  },
19
19
  "bin": {
20
- "generate-config-schema": "./build/bin/generate-config-schema.js",
21
20
  "start-service": "./build/bin/start-service.js"
22
21
  },
23
22
  "config": {
@@ -81,7 +80,7 @@
81
80
  "@opentelemetry/sdk-node": "^0.43.0",
82
81
  "@opentelemetry/sdk-trace-base": "^1.17.1",
83
82
  "@opentelemetry/semantic-conventions": "^1.17.1",
84
- "@sesamecare-oss/confit": "^2.0.1",
83
+ "@sesamecare-oss/confit": "^2.0.2",
85
84
  "@sesamecare-oss/opentelemetry-node-metrics": "^1.0.1",
86
85
  "ajv": "^8.12.0",
87
86
  "cookie-parser": "^1.4.6",
@@ -65,7 +65,7 @@ export interface ConfigurationSchema extends BaseConfitSchema {
65
65
  // actual key material (not the path). Use shortstop file: handler.
66
66
  // Note that generally it's better to offload tls termination,
67
67
  // but this is useful for dev.
68
- key?: string;
68
+ key?: string | Uint8Array;
69
69
  certificate?: string;
70
70
  // If you have an alternate host name (other than localhost) that
71
71
  // should be used when referring to this service, set it here.
@@ -270,7 +270,7 @@ function httpServer<
270
270
 
271
271
  return https.createServer(
272
272
  {
273
- key: config.key,
273
+ key: config.key ? Buffer.from(config.key) : undefined,
274
274
  cert: config.certificate,
275
275
  },
276
276
  app,
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const fs_1 = __importDefault(require("fs"));
8
- const child_process_1 = require("child_process");
9
- const ajv_1 = __importDefault(require("ajv"));
10
- const standalone_1 = __importDefault(require("ajv/dist/standalone"));
11
- const minimist_1 = __importDefault(require("minimist"));
12
- // Generate an AJV validator from a Typescript type
13
- // This is mostly included since we already have AJV,
14
- // and we want you to use it to validate configurations.
15
- const argv = (0, minimist_1.default)(process.argv.slice(2));
16
- async function run() {
17
- // First we need to run typescript-json-schema to
18
- // generate the JSON schema. We use npx to avoid the
19
- // runtime dependency.
20
- const tsJsonSchema = (0, child_process_1.spawnSync)('npx', [
21
- '-y',
22
- 'typescript-json-schema',
23
- argv.tsconfig || 'tsconfig.build.json',
24
- argv.type,
25
- '--required',
26
- '--noExtraProps',
27
- '--strictNullChecks',
28
- '--include',
29
- argv.source || 'src/types/config.ts',
30
- ], {
31
- stdio: 'pipe',
32
- encoding: 'utf-8',
33
- });
34
- if (tsJsonSchema.status !== 0) {
35
- console.error(tsJsonSchema.stderr);
36
- process.exit(1);
37
- }
38
- const schema = JSON.parse(tsJsonSchema.stdout);
39
- const ajv = new ajv_1.default({ code: { source: true, esm: true } });
40
- const validate = ajv.compile(schema);
41
- const moduleCode = (0, standalone_1.default)(ajv, validate);
42
- if (argv.output) {
43
- fs_1.default.writeFileSync(argv.output, `// @ts-nocheck\n${moduleCode}\n`);
44
- }
45
- else {
46
- console.log(moduleCode);
47
- }
48
- }
49
- run().catch((err) => {
50
- console.error(err);
51
- process.exit(1);
52
- });
53
- //# sourceMappingURL=generate-config-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-config-schema.js","sourceRoot":"","sources":["../../src/bin/generate-config-schema.ts"],"names":[],"mappings":";;;;;;AACA,4CAAoB;AACpB,iDAA0C;AAE1C,8CAAsB;AAC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AAU,CAAC,CAAC;KACzB;AACH,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAClB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -1,55 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from 'fs';
3
- import { spawnSync } from 'child_process';
4
-
5
- import Ajv from 'ajv';
6
- import standaloneCode from 'ajv/dist/standalone';
7
- import minimist from 'minimist';
8
-
9
- // Generate an AJV validator from a Typescript type
10
- // This is mostly included since we already have AJV,
11
- // and we want you to use it to validate configurations.
12
- const argv = minimist(process.argv.slice(2));
13
-
14
- async function run() {
15
- // First we need to run typescript-json-schema to
16
- // generate the JSON schema. We use npx to avoid the
17
- // runtime dependency.
18
- const tsJsonSchema = spawnSync(
19
- 'npx',
20
- [
21
- '-y',
22
- 'typescript-json-schema',
23
- argv.tsconfig || 'tsconfig.build.json',
24
- argv.type,
25
- '--required',
26
- '--noExtraProps',
27
- '--strictNullChecks',
28
- '--include',
29
- argv.source || 'src/types/config.ts',
30
- ],
31
- {
32
- stdio: 'pipe',
33
- encoding: 'utf-8',
34
- },
35
- );
36
- if (tsJsonSchema.status !== 0) {
37
- console.error(tsJsonSchema.stderr);
38
- process.exit(1);
39
- }
40
- const schema = JSON.parse(tsJsonSchema.stdout);
41
-
42
- const ajv = new Ajv({ code: { source: true, esm: true } });
43
- const validate = ajv.compile(schema);
44
- const moduleCode = standaloneCode(ajv, validate);
45
- if (argv.output) {
46
- fs.writeFileSync(argv.output, `// @ts-nocheck\n${moduleCode}\n`);
47
- } else {
48
- console.log(moduleCode);
49
- }
50
- }
51
-
52
- run().catch((err) => {
53
- console.error(err);
54
- process.exit(1);
55
- });