skuba 6.0.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.
- package/lib/api/github/checkRun.d.ts +1 -1
- package/lib/api/github/checkRun.js.map +1 -1
- package/lib/api/jest/index.d.ts +4 -1
- package/lib/cli/adapter/eslint.js +0 -24
- package/lib/cli/adapter/eslint.js.map +2 -2
- package/lib/cli/build/assets.d.ts +10 -0
- package/lib/cli/build/assets.js +107 -0
- package/lib/cli/build/assets.js.map +7 -0
- package/lib/cli/build/esbuild.js +3 -42
- package/lib/cli/build/esbuild.js.map +3 -3
- package/lib/cli/build/index.js +12 -2
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/build/tsc.d.ts +3 -0
- package/lib/cli/build/tsc.js +66 -0
- package/lib/cli/build/tsc.js.map +3 -3
- package/lib/cli/buildPackage.js +13 -0
- package/lib/cli/buildPackage.js.map +2 -2
- package/lib/cli/test/reporters/github/index.js +0 -2
- package/lib/utils/copy.d.ts +1 -0
- package/lib/utils/copy.js +6 -1
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.d.ts +2 -1
- package/lib/utils/dir.js +2 -2
- package/lib/utils/dir.js.map +2 -2
- package/lib/utils/manifest.d.ts +1 -0
- package/lib/utils/manifest.js +8 -2
- package/lib/utils/manifest.js.map +2 -2
- package/lib/utils/validation.d.ts +2 -2
- package/lib/utils/validation.js.map +2 -2
- package/lib/wrapper/requestListener.js +3 -0
- package/lib/wrapper/requestListener.js.map +2 -2
- package/package.json +14 -14
- package/template/base/.github/CODEOWNERS +0 -4
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/gantry.apply.yml +0 -2
- package/template/express-rest-api/package.json +1 -1
- package/template/express-rest-api/src/api/healthCheck.ts +1 -1
- package/template/express-rest-api/src/api/smokeTest.ts +1 -1
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/gantry.apply.yml +0 -2
- package/template/koa-rest-api/package.json +4 -4
- package/template/koa-rest-api/src/api/healthCheck.ts +1 -1
- package/template/koa-rest-api/src/api/jobs/getJobs.ts +1 -1
- package/template/koa-rest-api/src/api/jobs/postJob.ts +1 -1
- package/template/koa-rest-api/src/api/smokeTest.ts +1 -1
- package/template/koa-rest-api/src/framework/server.test.ts +1 -1
- package/template/koa-rest-api/src/framework/validation.ts +2 -2
- package/template/koa-rest-api/src/storage/jobs.ts +1 -1
- package/template/koa-rest-api/src/testing/server.ts +2 -2
- package/template/koa-rest-api/src/testing/types.ts +1 -1
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker/package.json +3 -3
- package/template/lambda-sqs-worker/src/app.ts +1 -1
- package/template/lambda-sqs-worker/src/framework/validation.ts +1 -1
- package/template/lambda-sqs-worker/src/mapping/jobScorer.ts +5 -2
- package/template/lambda-sqs-worker/src/services/jobScorer.ts +6 -6
- package/template/lambda-sqs-worker/src/testing/handler.ts +1 -1
- package/template/lambda-sqs-worker/src/testing/types.ts +1 -1
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
- package/template/lambda-sqs-worker-cdk/package.json +1 -1
- package/template/lambda-sqs-worker-cdk/src/app.ts +1 -1
package/lib/utils/copy.js
CHANGED
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var copy_exports = {};
|
|
30
30
|
__export(copy_exports, {
|
|
31
|
+
copyFile: () => copyFile,
|
|
31
32
|
copyFiles: () => copyFiles,
|
|
32
33
|
createEjsRenderer: () => createEjsRenderer,
|
|
33
34
|
createStringReplacer: () => createStringReplacer
|
|
@@ -38,7 +39,10 @@ var import_ejs = __toESM(require("ejs"));
|
|
|
38
39
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
39
40
|
var import_error = require("./error");
|
|
40
41
|
var import_logging = require("./logging");
|
|
41
|
-
const copyFile = async (sourcePath, destinationPath, {
|
|
42
|
+
const copyFile = async (sourcePath, destinationPath, {
|
|
43
|
+
overwrite = true,
|
|
44
|
+
processors
|
|
45
|
+
}) => {
|
|
42
46
|
const oldContents = await import_fs_extra.default.promises.readFile(sourcePath, "utf8");
|
|
43
47
|
const newContents = processors.reduce(
|
|
44
48
|
(contents, process) => process(contents),
|
|
@@ -93,6 +97,7 @@ const copyFiles = async (opts, currentSourceDir = opts.sourceRoot, currentDestin
|
|
|
93
97
|
};
|
|
94
98
|
// Annotate the CommonJS export names for ESM import in node:
|
|
95
99
|
0 && (module.exports = {
|
|
100
|
+
copyFile,
|
|
96
101
|
copyFiles,
|
|
97
102
|
createEjsRenderer,
|
|
98
103
|
createStringReplacer
|
package/lib/utils/copy.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/copy.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport ejs from 'ejs';\nimport fs from 'fs-extra';\n\nimport { isErrorWithCode } from './error';\nimport { log } from './logging';\n\nexport type TextProcessor = (contents: string) => string;\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,iBAAgB;AAChB,sBAAe;AAEf,mBAAgC;AAChC,qBAAoB;
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport ejs from 'ejs';\nimport fs from 'fs-extra';\n\nimport { isErrorWithCode } from './error';\nimport { log } from './logging';\n\nexport type TextProcessor = (contents: string) => string;\n\nexport const copyFile = async (\n sourcePath: string,\n destinationPath: string,\n {\n overwrite = true,\n processors,\n }: Pick<CopyFilesOptions, 'overwrite' | 'processors'>,\n) => {\n const oldContents = await fs.promises.readFile(sourcePath, 'utf8');\n\n const newContents = processors.reduce(\n (contents, process) => process(contents),\n oldContents,\n );\n\n if (oldContents === newContents && sourcePath === destinationPath) {\n return;\n }\n\n try {\n await fs.promises.writeFile(destinationPath, newContents, {\n flag: overwrite ? 'w' : 'wx',\n });\n } catch (err) {\n if (isErrorWithCode(err, 'EEXIST')) {\n return;\n }\n\n throw err;\n }\n};\n\ninterface CopyFilesOptions {\n sourceRoot: string;\n destinationRoot: string;\n\n include: (pathname: string) => boolean;\n overwrite?: boolean;\n processors: Array<TextProcessor>;\n stripUnderscorePrefix?: boolean;\n}\n\nexport const createEjsRenderer =\n (templateData: Record<string, unknown>): TextProcessor =>\n (contents) =>\n ejs.render(contents, templateData);\n\nexport const createStringReplacer =\n (\n replacements: Array<{\n input: RegExp;\n output: string;\n }>,\n ): TextProcessor =>\n (contents) =>\n replacements.reduce(\n (newContents, { input, output }) => newContents.replace(input, output),\n contents,\n );\n\nexport const copyFiles = async (\n opts: CopyFilesOptions,\n currentSourceDir: string = opts.sourceRoot,\n currentDestinationDir: string = opts.destinationRoot,\n) => {\n const filenames = await fs.promises.readdir(currentSourceDir);\n\n const toDestinationPath = (filename: string) =>\n path.join(\n currentDestinationDir,\n opts.stripUnderscorePrefix\n ? filename\n .replace(/^_\\./, '.')\n .replace(/^_package\\.json/, 'package.json')\n : filename,\n );\n\n const filteredFilenames = filenames.filter((filename) =>\n opts.include(\n path.relative(opts.destinationRoot, toDestinationPath(filename)),\n ),\n );\n\n await Promise.all(\n filteredFilenames.map(async (filename) => {\n const sourcePath = path.join(currentSourceDir, filename);\n const destinationPath = toDestinationPath(filename);\n\n try {\n await copyFile(sourcePath, destinationPath, opts);\n } catch (err) {\n if (isErrorWithCode(err, 'EISDIR')) {\n await fs.promises.mkdir(destinationPath, { recursive: true });\n return copyFiles(opts, sourcePath, destinationPath);\n }\n\n log.err('Failed to render', log.bold(sourcePath));\n\n throw err;\n }\n }),\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,iBAAgB;AAChB,sBAAe;AAEf,mBAAgC;AAChC,qBAAoB;AAIb,MAAM,WAAW,OACtB,YACA,iBACA;AAAA,EACE,YAAY;AAAA,EACZ;AACF,MACG;AACH,QAAM,cAAc,MAAM,gBAAAA,QAAG,SAAS,SAAS,YAAY,MAAM;AAEjE,QAAM,cAAc,WAAW;AAAA,IAC7B,CAAC,UAAU,YAAY,QAAQ,QAAQ;AAAA,IACvC;AAAA,EACF;AAEA,MAAI,gBAAgB,eAAe,eAAe,iBAAiB;AACjE;AAAA,EACF;AAEA,MAAI;AACF,UAAM,gBAAAA,QAAG,SAAS,UAAU,iBAAiB,aAAa;AAAA,MACxD,MAAM,YAAY,MAAM;AAAA,IAC1B,CAAC;AAAA,EACH,SAAS,KAAP;AACA,YAAI,8BAAgB,KAAK,QAAQ,GAAG;AAClC;AAAA,IACF;AAEA,UAAM;AAAA,EACR;AACF;AAYO,MAAM,oBACX,CAAC,iBACD,CAAC,aACC,WAAAC,QAAI,OAAO,UAAU,YAAY;AAE9B,MAAM,uBACX,CACE,iBAKF,CAAC,aACC,aAAa;AAAA,EACX,CAAC,aAAa,EAAE,OAAO,OAAO,MAAM,YAAY,QAAQ,OAAO,MAAM;AAAA,EACrE;AACF;AAEG,MAAM,YAAY,OACvB,MACA,mBAA2B,KAAK,YAChC,wBAAgC,KAAK,oBAClC;AACH,QAAM,YAAY,MAAM,gBAAAD,QAAG,SAAS,QAAQ,gBAAgB;AAE5D,QAAM,oBAAoB,CAAC,aACzB,YAAAE,QAAK;AAAA,IACH;AAAA,IACA,KAAK,wBACD,SACG,QAAQ,QAAQ,GAAG,EACnB,QAAQ,mBAAmB,cAAc,IAC5C;AAAA,EACN;AAEF,QAAM,oBAAoB,UAAU;AAAA,IAAO,CAAC,aAC1C,KAAK;AAAA,MACH,YAAAA,QAAK,SAAS,KAAK,iBAAiB,kBAAkB,QAAQ,CAAC;AAAA,IACjE;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,kBAAkB,IAAI,OAAO,aAAa;AACxC,YAAM,aAAa,YAAAA,QAAK,KAAK,kBAAkB,QAAQ;AACvD,YAAM,kBAAkB,kBAAkB,QAAQ;AAElD,UAAI;AACF,cAAM,SAAS,YAAY,iBAAiB,IAAI;AAAA,MAClD,SAAS,KAAP;AACA,gBAAI,8BAAgB,KAAK,QAAQ,GAAG;AAClC,gBAAM,gBAAAF,QAAG,SAAS,MAAM,iBAAiB,EAAE,WAAW,KAAK,CAAC;AAC5D,iBAAO,UAAU,MAAM,YAAY,eAAe;AAAA,QACpD;AAEA,2BAAI,IAAI,oBAAoB,mBAAI,KAAK,UAAU,CAAC;AAEhD,cAAM;AAAA,MACR;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": ["fs", "ejs", "path"]
|
|
7
7
|
}
|
package/lib/utils/dir.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import picomatch from 'picomatch';
|
|
1
2
|
/**
|
|
2
3
|
* Build a map that associates each glob pattern with its matching filepaths.
|
|
3
4
|
*/
|
|
4
|
-
export declare const buildPatternToFilepathMap: (patterns: string[], allFilepaths: string[]) => {
|
|
5
|
+
export declare const buildPatternToFilepathMap: (patterns: string[], allFilepaths: string[], options?: picomatch.PicomatchOptions) => {
|
|
5
6
|
[k: string]: string[];
|
|
6
7
|
};
|
|
7
8
|
/**
|
package/lib/utils/dir.js
CHANGED
|
@@ -39,9 +39,9 @@ var import_fs_extra = __toESM(require("fs-extra"));
|
|
|
39
39
|
var import_ignore = __toESM(require("ignore"));
|
|
40
40
|
var import_picomatch = __toESM(require("picomatch"));
|
|
41
41
|
var import_error = require("./error");
|
|
42
|
-
const buildPatternToFilepathMap = (patterns, allFilepaths) => Object.fromEntries(
|
|
42
|
+
const buildPatternToFilepathMap = (patterns, allFilepaths, options) => Object.fromEntries(
|
|
43
43
|
patterns.map((pattern) => {
|
|
44
|
-
const isMatch = (0, import_picomatch.default)(pattern);
|
|
44
|
+
const isMatch = (0, import_picomatch.default)(pattern, options);
|
|
45
45
|
const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));
|
|
46
46
|
return [pattern, filepaths];
|
|
47
47
|
})
|
package/lib/utils/dir.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/dir.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport { fdir as FDir } from 'fdir';\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport picomatch from 'picomatch';\n\nimport { isErrorWithCode } from './error';\n\n/**\n * Build a map that associates each glob pattern with its matching filepaths.\n */\nexport const buildPatternToFilepathMap = (\n patterns: string[],\n allFilepaths: string[],\n) =>\n Object.fromEntries(\n patterns.map((pattern) => {\n const isMatch = picomatch(pattern);\n\n const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));\n\n return [pattern, filepaths] as const;\n }),\n );\n\n/**\n * List relative filepaths contained within a directory root.\n *\n * This excludes:\n *\n * - Patterns in the ignore files specified in `ignoreFilenames`\n * - `.git` subdirectories\n * - `node_modules` subdirectories\n */\nexport const crawlDirectory = async (\n root: string,\n ignoreFilename = '.gitignore',\n) => {\n const ignoreFileFilter = await createInclusionFilter([\n path.join(root, ignoreFilename),\n ]);\n\n const output = await new FDir()\n .crawlWithOptions(root, {\n exclude: (dirname) => ['.git', 'node_modules'].includes(dirname),\n filters: [\n (pathname) => {\n const relativePathname = path.relative(root, pathname);\n\n return ignoreFileFilter(relativePathname);\n },\n ],\n includeBasePath: true,\n })\n .withPromise();\n\n // Patch over non-specific `fdir` typings.\n const absoluteFilenames = output as string[];\n\n const relativeFilepaths = absoluteFilenames.map((filepath) =>\n path.relative(root, filepath),\n );\n\n return relativeFilepaths;\n};\n\n/**\n * Create a filter function that excludes filepaths based on ignore files like\n * `.gitignore` and `.prettierignore`.\n */\nexport const createInclusionFilter = async (ignoreFilepaths: string[]) => {\n const ignoreFiles = await Promise.all(\n ignoreFilepaths.map(async (ignoreFilepath) => {\n try {\n return await fs.promises.readFile(ignoreFilepath, 'utf8');\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return;\n }\n\n throw err;\n }\n }),\n );\n\n const managers = ignoreFiles\n .filter((value): value is string => typeof value === 'string')\n .map((value) => ignore().add(value));\n\n return ignore().add('.git').add(managers).createFilter();\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,kBAA6B;AAC7B,sBAAe;AACf,oBAAmB;AACnB,uBAAsB;AAEtB,mBAAgC;AAKzB,MAAM,4BAA4B,CACvC,UACA,
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport { fdir as FDir } from 'fdir';\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport picomatch from 'picomatch';\n\nimport { isErrorWithCode } from './error';\n\n/**\n * Build a map that associates each glob pattern with its matching filepaths.\n */\nexport const buildPatternToFilepathMap = (\n patterns: string[],\n allFilepaths: string[],\n options?: picomatch.PicomatchOptions,\n) =>\n Object.fromEntries(\n patterns.map((pattern) => {\n const isMatch = picomatch(pattern, options);\n\n const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));\n\n return [pattern, filepaths] as const;\n }),\n );\n\n/**\n * List relative filepaths contained within a directory root.\n *\n * This excludes:\n *\n * - Patterns in the ignore files specified in `ignoreFilenames`\n * - `.git` subdirectories\n * - `node_modules` subdirectories\n */\nexport const crawlDirectory = async (\n root: string,\n ignoreFilename = '.gitignore',\n) => {\n const ignoreFileFilter = await createInclusionFilter([\n path.join(root, ignoreFilename),\n ]);\n\n const output = await new FDir()\n .crawlWithOptions(root, {\n exclude: (dirname) => ['.git', 'node_modules'].includes(dirname),\n filters: [\n (pathname) => {\n const relativePathname = path.relative(root, pathname);\n\n return ignoreFileFilter(relativePathname);\n },\n ],\n includeBasePath: true,\n })\n .withPromise();\n\n // Patch over non-specific `fdir` typings.\n const absoluteFilenames = output as string[];\n\n const relativeFilepaths = absoluteFilenames.map((filepath) =>\n path.relative(root, filepath),\n );\n\n return relativeFilepaths;\n};\n\n/**\n * Create a filter function that excludes filepaths based on ignore files like\n * `.gitignore` and `.prettierignore`.\n */\nexport const createInclusionFilter = async (ignoreFilepaths: string[]) => {\n const ignoreFiles = await Promise.all(\n ignoreFilepaths.map(async (ignoreFilepath) => {\n try {\n return await fs.promises.readFile(ignoreFilepath, 'utf8');\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return;\n }\n\n throw err;\n }\n }),\n );\n\n const managers = ignoreFiles\n .filter((value): value is string => typeof value === 'string')\n .map((value) => ignore().add(value));\n\n return ignore().add('.git').add(managers).createFilter();\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,kBAA6B;AAC7B,sBAAe;AACf,oBAAmB;AACnB,uBAAsB;AAEtB,mBAAgC;AAKzB,MAAM,4BAA4B,CACvC,UACA,cACA,YAEA,OAAO;AAAA,EACL,SAAS,IAAI,CAAC,YAAY;AACxB,UAAM,cAAU,iBAAAA,SAAU,SAAS,OAAO;AAE1C,UAAM,YAAY,aAAa,OAAO,CAAC,aAAa,QAAQ,QAAQ,CAAC;AAErE,WAAO,CAAC,SAAS,SAAS;AAAA,EAC5B,CAAC;AACH;AAWK,MAAM,iBAAiB,OAC5B,MACA,iBAAiB,iBACd;AACH,QAAM,mBAAmB,MAAM,sBAAsB;AAAA,IACnD,YAAAC,QAAK,KAAK,MAAM,cAAc;AAAA,EAChC,CAAC;AAED,QAAM,SAAS,MAAM,IAAI,YAAAC,KAAK,EAC3B,iBAAiB,MAAM;AAAA,IACtB,SAAS,CAAC,YAAY,CAAC,QAAQ,cAAc,EAAE,SAAS,OAAO;AAAA,IAC/D,SAAS;AAAA,MACP,CAAC,aAAa;AACZ,cAAM,mBAAmB,YAAAD,QAAK,SAAS,MAAM,QAAQ;AAErD,eAAO,iBAAiB,gBAAgB;AAAA,MAC1C;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,EACnB,CAAC,EACA,YAAY;AAGf,QAAM,oBAAoB;AAE1B,QAAM,oBAAoB,kBAAkB;AAAA,IAAI,CAAC,aAC/C,YAAAA,QAAK,SAAS,MAAM,QAAQ;AAAA,EAC9B;AAEA,SAAO;AACT;AAMO,MAAM,wBAAwB,OAAO,oBAA8B;AACxE,QAAM,cAAc,MAAM,QAAQ;AAAA,IAChC,gBAAgB,IAAI,OAAO,mBAAmB;AAC5C,UAAI;AACF,eAAO,MAAM,gBAAAE,QAAG,SAAS,SAAS,gBAAgB,MAAM;AAAA,MAC1D,SAAS,KAAP;AACA,gBAAI,8BAAgB,KAAK,QAAQ,GAAG;AAClC;AAAA,QACF;AAEA,cAAM;AAAA,MACR;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,YACd,OAAO,CAAC,UAA2B,OAAO,UAAU,QAAQ,EAC5D,IAAI,CAAC,cAAU,cAAAC,SAAO,EAAE,IAAI,KAAK,CAAC;AAErC,aAAO,cAAAA,SAAO,EAAE,IAAI,MAAM,EAAE,IAAI,QAAQ,EAAE,aAAa;AACzD;",
|
|
6
6
|
"names": ["picomatch", "path", "FDir", "fs", "ignore"]
|
|
7
7
|
}
|
package/lib/utils/manifest.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export declare const ProjectType: t.Union<[t.Literal<"application">, t.Literal<"
|
|
|
6
6
|
export declare const PROJECT_TYPES: readonly ["application", "package"];
|
|
7
7
|
export declare const getSkubaManifest: () => Promise<NormalizedPackageJson>;
|
|
8
8
|
export declare const getConsumerManifest: () => Promise<readPkgUp.NormalizedReadResult | undefined>;
|
|
9
|
+
export declare const getPropFromConsumerManifest: <T extends string, V = unknown>(prop: T) => Promise<V | undefined>;
|
|
9
10
|
export declare const getStringPropFromConsumerManifest: <T extends string>(prop: T) => Promise<string | undefined>;
|
|
10
11
|
export declare const getEntryPointFromManifest: () => Promise<string>;
|
package/lib/utils/manifest.js
CHANGED
|
@@ -32,6 +32,7 @@ __export(manifest_exports, {
|
|
|
32
32
|
ProjectType: () => ProjectType,
|
|
33
33
|
getConsumerManifest: () => getConsumerManifest,
|
|
34
34
|
getEntryPointFromManifest: () => getEntryPointFromManifest,
|
|
35
|
+
getPropFromConsumerManifest: () => getPropFromConsumerManifest,
|
|
35
36
|
getSkubaManifest: () => getSkubaManifest,
|
|
36
37
|
getStringPropFromConsumerManifest: () => getStringPropFromConsumerManifest
|
|
37
38
|
});
|
|
@@ -57,9 +58,13 @@ const getSkubaManifest = async () => {
|
|
|
57
58
|
return skubaManifest = result.packageJson;
|
|
58
59
|
};
|
|
59
60
|
const getConsumerManifest = () => (0, import_read_pkg_up.default)();
|
|
60
|
-
const
|
|
61
|
+
const getPropFromConsumerManifest = async (prop) => {
|
|
61
62
|
const result = await getConsumerManifest();
|
|
62
|
-
return result !== void 0 && (0, import_validation.
|
|
63
|
+
return result !== void 0 && (0, import_validation.hasProp)(result.packageJson.skuba, prop) ? result.packageJson.skuba[prop] : void 0;
|
|
64
|
+
};
|
|
65
|
+
const getStringPropFromConsumerManifest = async (prop) => {
|
|
66
|
+
const result = await getPropFromConsumerManifest(prop);
|
|
67
|
+
return typeof result === "string" ? result : void 0;
|
|
63
68
|
};
|
|
64
69
|
const getEntryPointFromManifest = async () => {
|
|
65
70
|
const entryPoint = await getStringPropFromConsumerManifest("entryPoint");
|
|
@@ -71,6 +76,7 @@ const getEntryPointFromManifest = async () => {
|
|
|
71
76
|
ProjectType,
|
|
72
77
|
getConsumerManifest,
|
|
73
78
|
getEntryPointFromManifest,
|
|
79
|
+
getPropFromConsumerManifest,
|
|
74
80
|
getSkubaManifest,
|
|
75
81
|
getStringPropFromConsumerManifest
|
|
76
82
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/manifest.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable new-cap */\n\nimport type { NormalizedPackageJson } from 'read-pkg-up';\nimport readPkgUp from 'read-pkg-up';\nimport * as t from 'runtypes';\n\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAAsB;AACtB,QAAmB;AAEnB,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable new-cap */\n\nimport type { NormalizedPackageJson } from 'read-pkg-up';\nimport readPkgUp from 'read-pkg-up';\nimport * as t from 'runtypes';\n\nimport { hasProp } from './validation';\n\nexport type ProjectType = t.Static<typeof ProjectType>;\n\nexport const ProjectType = t.Union(\n t.Literal('application'),\n t.Literal('package'),\n);\n\nexport const PROJECT_TYPES = ['application', 'package'] as const;\n\nconst DEFAULT_ENTRY_POINT = 'src/app.ts';\n\nlet skubaManifest: NormalizedPackageJson | undefined;\n\nexport const getSkubaManifest = async (): Promise<NormalizedPackageJson> => {\n if (skubaManifest !== undefined) {\n return skubaManifest;\n }\n\n const result = await readPkgUp({ cwd: __dirname });\n\n if (result === undefined) {\n throw Error('skuba could not find its own manifest');\n }\n\n return (skubaManifest = result.packageJson);\n};\n\nexport const getConsumerManifest = () => readPkgUp();\n\nexport const getPropFromConsumerManifest = async <\n T extends string,\n V = unknown,\n>(\n prop: T,\n): Promise<V | undefined> => {\n const result = await getConsumerManifest();\n\n return result !== undefined && hasProp<T, V>(result.packageJson.skuba, prop)\n ? result.packageJson.skuba[prop]\n : undefined;\n};\n\nexport const getStringPropFromConsumerManifest = async <T extends string>(\n prop: T,\n): Promise<string | undefined> => {\n const result = await getPropFromConsumerManifest(prop);\n\n return typeof result === 'string' ? result : undefined;\n};\n\nexport const getEntryPointFromManifest = async (): Promise<string> => {\n const entryPoint = await getStringPropFromConsumerManifest('entryPoint');\n\n return entryPoint ?? DEFAULT_ENTRY_POINT;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAAsB;AACtB,QAAmB;AAEnB,wBAAwB;AAIjB,MAAM,cAAc,EAAE;AAAA,EAC3B,EAAE,QAAQ,aAAa;AAAA,EACvB,EAAE,QAAQ,SAAS;AACrB;AAEO,MAAM,gBAAgB,CAAC,eAAe,SAAS;AAEtD,MAAM,sBAAsB;AAE5B,IAAI;AAEG,MAAM,mBAAmB,YAA4C;AAC1E,MAAI,kBAAkB,QAAW;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAM,mBAAAA,SAAU,EAAE,KAAK,UAAU,CAAC;AAEjD,MAAI,WAAW,QAAW;AACxB,UAAM,MAAM,uCAAuC;AAAA,EACrD;AAEA,SAAQ,gBAAgB,OAAO;AACjC;AAEO,MAAM,sBAAsB,UAAM,mBAAAA,SAAU;AAE5C,MAAM,8BAA8B,OAIzC,SAC2B;AAC3B,QAAM,SAAS,MAAM,oBAAoB;AAEzC,SAAO,WAAW,cAAa,2BAAc,OAAO,YAAY,OAAO,IAAI,IACvE,OAAO,YAAY,MAAM,IAAI,IAC7B;AACN;AAEO,MAAM,oCAAoC,OAC/C,SACgC;AAChC,QAAM,SAAS,MAAM,4BAA4B,IAAI;AAErD,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAEO,MAAM,4BAA4B,YAA6B;AACpE,QAAM,aAAa,MAAM,kCAAkC,YAAY;AAEvE,SAAO,cAAc;AACvB;",
|
|
6
6
|
"names": ["readPkgUp"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const isFunction: (data: unknown) => data is (...args: unknown[]) => unknown | Promise<unknown>;
|
|
2
2
|
export declare const isIpPort: (value: unknown) => value is number;
|
|
3
3
|
export declare const isObject: (value: unknown) => value is Record<PropertyKey, unknown>;
|
|
4
|
-
export declare const hasProp: <P extends PropertyKey>(value: unknown, prop: P) => value is Record<P,
|
|
5
|
-
export declare const hasNumberProp: <P extends PropertyKey>(value: unknown, prop: P) => value is Record<P,
|
|
4
|
+
export declare const hasProp: <P extends PropertyKey, V = unknown>(value: unknown, prop: P) => value is Record<P, V>;
|
|
5
|
+
export declare const hasNumberProp: <P extends PropertyKey>(value: unknown, prop: P) => value is Record<P, number>;
|
|
6
6
|
export declare const hasStringProp: <P extends PropertyKey>(value: unknown, prop: P) => value is Record<P, string>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/validation.ts"],
|
|
4
|
-
"sourcesContent": ["export const isFunction = (\n data: unknown,\n): data is (...args: unknown[]) => unknown | Promise<unknown> =>\n typeof data === 'function';\n\nexport const isIpPort = (value: unknown): value is number =>\n typeof value === 'number' &&\n Number.isSafeInteger(value) &&\n value >= 0 &&\n value <= 65535;\n\nexport const isObject = (\n value: unknown,\n): value is Record<PropertyKey, unknown> =>\n typeof value === 'object' && value !== null;\n\nexport const hasProp = <P extends PropertyKey>(\n value: unknown,\n prop: P,\n): value is Record<P,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAa,CACxB,SAEA,OAAO,SAAS;AAEX,MAAM,WAAW,CAAC,UACvB,OAAO,UAAU,YACjB,OAAO,cAAc,KAAK,KAC1B,SAAS,KACT,SAAS;AAEJ,MAAM,WAAW,CACtB,UAEA,OAAO,UAAU,YAAY,UAAU;AAElC,MAAM,UAAU,CACrB,OACA,
|
|
4
|
+
"sourcesContent": ["export const isFunction = (\n data: unknown,\n): data is (...args: unknown[]) => unknown | Promise<unknown> =>\n typeof data === 'function';\n\nexport const isIpPort = (value: unknown): value is number =>\n typeof value === 'number' &&\n Number.isSafeInteger(value) &&\n value >= 0 &&\n value <= 65535;\n\nexport const isObject = (\n value: unknown,\n): value is Record<PropertyKey, unknown> =>\n typeof value === 'object' && value !== null;\n\nexport const hasProp = <P extends PropertyKey, V = unknown>(\n value: unknown,\n prop: P,\n): value is Record<P, V> => isObject(value) && value.hasOwnProperty(prop);\n\nexport const hasNumberProp = <P extends PropertyKey>(\n value: unknown,\n prop: P,\n): value is Record<P, number> =>\n isObject(value) && typeof value[prop] === 'number';\n\nexport const hasStringProp = <P extends PropertyKey>(\n value: unknown,\n prop: P,\n): value is Record<P, string> =>\n isObject(value) && typeof value[prop] === 'string';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAa,CACxB,SAEA,OAAO,SAAS;AAEX,MAAM,WAAW,CAAC,UACvB,OAAO,UAAU,YACjB,OAAO,cAAc,KAAK,KAC1B,SAAS,KACT,SAAS;AAEJ,MAAM,WAAW,CACtB,UAEA,OAAO,UAAU,YAAY,UAAU;AAElC,MAAM,UAAU,CACrB,OACA,SAC0B,SAAS,KAAK,KAAK,MAAM,eAAe,IAAI;AAEjE,MAAM,gBAAgB,CAC3B,OACA,SAEA,SAAS,KAAK,KAAK,OAAO,MAAM,IAAI,MAAM;AAErC,MAAM,gBAAgB,CAC3B,OACA,SAEA,SAAS,KAAK,KAAK,OAAO,MAAM,IAAI,MAAM;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -50,6 +50,9 @@ const runRequestListener = async ({
|
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
const port = (0, import_validation.isIpPort)(config.port) ? config.port : availablePort;
|
|
53
|
+
if (typeof config !== "function" && config instanceof import_http.default.Server) {
|
|
54
|
+
return (0, import_http2.startServer)(config, port);
|
|
55
|
+
}
|
|
53
56
|
if (typeof config !== "function" && config.server && config.server instanceof import_http.default.Server) {
|
|
54
57
|
return (0, import_http2.startServer)(config.server, port);
|
|
55
58
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapper/requestListener.ts"],
|
|
4
|
-
"sourcesContent": ["import http from 'http';\n\nimport { isFunction, isIpPort, isObject } from '../utils/validation';\n\nimport { serveRequestListener, startServer } from './http';\n\n// Express compatibility\ninterface FunctionConfig extends http.RequestListener {\n port?: number;\n}\n\ninterface ObjectConfig {\n // Koa compatibility\n callback?: () => http.RequestListener;\n\n requestListener?: http.RequestListener;\n\n // Fastify compatibility\n server?: http.Server;\n\n default?: Promise<unknown>;\n port?: unknown;\n}\n\nconst isConfig = (\n data: unknown,\n): data is Promise<FunctionConfig> | Promise<ObjectConfig> =>\n isFunction(data) || isObject(data);\n\ninterface Args {\n availablePort?: number;\n entryPoint: unknown;\n}\n\n/**\n * Create an HTTP server that calls into an exported `http.RequestListener`.\n *\n * This supports Express and Koa applications out of the box.\n */\nexport const runRequestListener = async ({\n availablePort,\n entryPoint,\n}: Args): Promise<void> => {\n if (!isConfig(entryPoint)) {\n // Assume an executable script with weird exports\n return;\n }\n\n let config: FunctionConfig | ObjectConfig = await entryPoint;\n\n if (typeof config === 'object' && isConfig(config.default)) {\n // Prefer `export default` over `export =`\n config = await config.default;\n }\n\n if (Object.keys(config).length === 0) {\n // Assume an executable script with no exports\n return;\n }\n\n const port = isIpPort(config.port) ? config.port : availablePort;\n\n // Fastify workaround\n if (\n typeof config !== 'function' &&\n config.server &&\n config.server instanceof http.Server\n ) {\n return startServer(config.server, port);\n }\n\n const requestListener =\n typeof config === 'function'\n ? config\n : config.requestListener ?? config.callback?.();\n\n if (typeof requestListener !== 'function') {\n // Assume an executable script with non-request listener exports\n return;\n }\n\n return serveRequestListener(requestListener, port);\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,wBAA+C;AAE/C,IAAAA,eAAkD;AAoBlD,MAAM,WAAW,CACf,aAEA,8BAAW,IAAI,SAAK,4BAAS,IAAI;AAY5B,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,CAAC,SAAS,UAAU,GAAG;AAEzB;AAAA,EACF;AAEA,MAAI,SAAwC,MAAM;AAElD,MAAI,OAAO,WAAW,YAAY,SAAS,OAAO,OAAO,GAAG;AAE1D,aAAS,MAAM,OAAO;AAAA,EACxB;AAEA,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AAEpC;AAAA,EACF;AAEA,QAAM,WAAO,4BAAS,OAAO,IAAI,IAAI,OAAO,OAAO;AAGnD,MACE,OAAO,WAAW,cAClB,OAAO,UACP,OAAO,kBAAkB,
|
|
4
|
+
"sourcesContent": ["import http from 'http';\n\nimport { isFunction, isIpPort, isObject } from '../utils/validation';\n\nimport { serveRequestListener, startServer } from './http';\n\n// Express compatibility\ninterface FunctionConfig extends http.RequestListener {\n port?: number;\n}\n\ninterface ObjectConfig {\n // Koa compatibility\n callback?: () => http.RequestListener;\n\n requestListener?: http.RequestListener;\n\n // Fastify compatibility\n server?: http.Server;\n\n default?: Promise<unknown>;\n port?: unknown;\n}\n\nconst isConfig = (\n data: unknown,\n): data is Promise<FunctionConfig> | Promise<ObjectConfig> =>\n isFunction(data) || isObject(data);\n\ninterface Args {\n availablePort?: number;\n entryPoint: unknown;\n}\n\n/**\n * Create an HTTP server that calls into an exported `http.RequestListener`.\n *\n * This supports Express and Koa applications out of the box.\n */\nexport const runRequestListener = async ({\n availablePort,\n entryPoint,\n}: Args): Promise<void> => {\n if (!isConfig(entryPoint)) {\n // Assume an executable script with weird exports\n return;\n }\n\n let config: FunctionConfig | ObjectConfig = await entryPoint;\n\n if (typeof config === 'object' && isConfig(config.default)) {\n // Prefer `export default` over `export =`\n config = await config.default;\n }\n\n if (Object.keys(config).length === 0) {\n // Assume an executable script with no exports\n return;\n }\n\n const port = isIpPort(config.port) ? config.port : availablePort;\n\n // http.Server support\n if (typeof config !== 'function' && config instanceof http.Server) {\n return startServer(config, port);\n }\n\n // Fastify workaround\n if (\n typeof config !== 'function' &&\n config.server &&\n config.server instanceof http.Server\n ) {\n return startServer(config.server, port);\n }\n\n const requestListener =\n typeof config === 'function'\n ? config\n : config.requestListener ?? config.callback?.();\n\n if (typeof requestListener !== 'function') {\n // Assume an executable script with non-request listener exports\n return;\n }\n\n return serveRequestListener(requestListener, port);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,wBAA+C;AAE/C,IAAAA,eAAkD;AAoBlD,MAAM,WAAW,CACf,aAEA,8BAAW,IAAI,SAAK,4BAAS,IAAI;AAY5B,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,CAAC,SAAS,UAAU,GAAG;AAEzB;AAAA,EACF;AAEA,MAAI,SAAwC,MAAM;AAElD,MAAI,OAAO,WAAW,YAAY,SAAS,OAAO,OAAO,GAAG;AAE1D,aAAS,MAAM,OAAO;AAAA,EACxB;AAEA,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AAEpC;AAAA,EACF;AAEA,QAAM,WAAO,4BAAS,OAAO,IAAI,IAAI,OAAO,OAAO;AAGnD,MAAI,OAAO,WAAW,cAAc,kBAAkB,YAAAC,QAAK,QAAQ;AACjE,eAAO,0BAAY,QAAQ,IAAI;AAAA,EACjC;AAGA,MACE,OAAO,WAAW,cAClB,OAAO,UACP,OAAO,kBAAkB,YAAAA,QAAK,QAC9B;AACA,eAAO,0BAAY,OAAO,QAAQ,IAAI;AAAA,EACxC;AAEA,QAAM,kBACJ,OAAO,WAAW,aACd,SACA,OAAO,mBAAmB,OAAO,WAAW;AAElD,MAAI,OAAO,oBAAoB,YAAY;AAEzC;AAAA,EACF;AAEA,aAAO,mCAAqB,iBAAiB,IAAI;AACnD;",
|
|
6
6
|
"names": ["import_http", "http"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skuba",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "SEEK development toolkit for backend applications and packages",
|
|
6
6
|
"homepage": "https://github.com/seek-oss/skuba#readme",
|
|
@@ -71,19 +71,19 @@
|
|
|
71
71
|
"@esbuild-plugins/tsconfig-paths": "^0.1.0",
|
|
72
72
|
"@jest/types": "^29.0.0",
|
|
73
73
|
"@octokit/graphql": "^5.0.0",
|
|
74
|
-
"@octokit/graphql-schema": "^
|
|
75
|
-
"@octokit/rest": "^19.0.
|
|
74
|
+
"@octokit/graphql-schema": "^14.5.0",
|
|
75
|
+
"@octokit/rest": "^19.0.8",
|
|
76
76
|
"@octokit/types": "^9.0.0",
|
|
77
77
|
"@types/jest": "^29.0.0",
|
|
78
78
|
"@types/node": ">=16.11",
|
|
79
79
|
"chalk": "^4.1.0",
|
|
80
|
-
"concurrently": "^
|
|
80
|
+
"concurrently": "^8.0.0",
|
|
81
81
|
"dotenv": "^16.0.0",
|
|
82
82
|
"ejs": "^3.1.6",
|
|
83
83
|
"enquirer": "^2.3.6",
|
|
84
84
|
"esbuild": "~0.17.0",
|
|
85
85
|
"eslint": "^8.11.0",
|
|
86
|
-
"eslint-config-skuba": "
|
|
86
|
+
"eslint-config-skuba": "2.0.2",
|
|
87
87
|
"execa": "^5.0.0",
|
|
88
88
|
"fdir": "^6.0.0",
|
|
89
89
|
"fs-extra": "^11.0.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"sort-package-json": "^1.57.0",
|
|
112
112
|
"strip-ansi": "^6.0.1",
|
|
113
113
|
"ts-dedent": "^2.2.0",
|
|
114
|
-
"ts-jest": "^29.0
|
|
114
|
+
"ts-jest": "^29.1.0",
|
|
115
115
|
"ts-node": "^10.7.0",
|
|
116
116
|
"ts-node-dev": "^2.0.0",
|
|
117
117
|
"tsconfig-paths": "^4.0.0",
|
|
@@ -120,13 +120,13 @@
|
|
|
120
120
|
"validate-npm-package-name": "^5.0.0"
|
|
121
121
|
},
|
|
122
122
|
"devDependencies": {
|
|
123
|
-
"@changesets/cli": "2.26.
|
|
123
|
+
"@changesets/cli": "2.26.1",
|
|
124
124
|
"@changesets/get-github-info": "0.5.2",
|
|
125
|
-
"@jest/reporters": "29.
|
|
125
|
+
"@jest/reporters": "29.5.0",
|
|
126
126
|
"@types/ejs": "3.1.2",
|
|
127
127
|
"@types/express": "4.17.17",
|
|
128
128
|
"@types/fs-extra": "11.0.1",
|
|
129
|
-
"@types/koa": "2.13.
|
|
129
|
+
"@types/koa": "2.13.6",
|
|
130
130
|
"@types/libnpmsearch": "2.0.3",
|
|
131
131
|
"@types/lodash.mergewith": "4.6.7",
|
|
132
132
|
"@types/module-alias": "2.0.1",
|
|
@@ -134,15 +134,15 @@
|
|
|
134
134
|
"@types/picomatch": "2.3.0",
|
|
135
135
|
"@types/supertest": "2.0.12",
|
|
136
136
|
"@types/validate-npm-package-name": "4.0.0",
|
|
137
|
-
"enhanced-resolve": "5.
|
|
137
|
+
"enhanced-resolve": "5.13.0",
|
|
138
138
|
"express": "4.18.2",
|
|
139
|
-
"fastify": "4.
|
|
139
|
+
"fastify": "4.17.0",
|
|
140
140
|
"jsonfile": "6.1.0",
|
|
141
|
-
"koa": "2.14.
|
|
142
|
-
"memfs": "3.
|
|
141
|
+
"koa": "2.14.2",
|
|
142
|
+
"memfs": "3.5.1",
|
|
143
143
|
"remark-cli": "11.0.0",
|
|
144
144
|
"remark-preset-lint-recommended": "6.1.2",
|
|
145
|
-
"semver": "7.
|
|
145
|
+
"semver": "7.5.0",
|
|
146
146
|
"supertest": "6.3.3",
|
|
147
147
|
"type-fest": "2.19.0"
|
|
148
148
|
},
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@koa/router": "^12.0.0",
|
|
16
16
|
"@opentelemetry/api": "^1.1.0",
|
|
17
|
-
"@opentelemetry/exporter-trace-otlp-grpc": "^0.
|
|
17
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.39.0",
|
|
18
18
|
"@opentelemetry/instrumentation-aws-sdk": "^0.34.0",
|
|
19
|
-
"@opentelemetry/instrumentation-http": "^0.
|
|
20
|
-
"@opentelemetry/sdk-node": "^0.
|
|
21
|
-
"@seek/logger": "^
|
|
19
|
+
"@opentelemetry/instrumentation-http": "^0.39.0",
|
|
20
|
+
"@opentelemetry/sdk-node": "^0.39.0",
|
|
21
|
+
"@seek/logger": "^6.0.0",
|
|
22
22
|
"aws-sdk": "^2.1039.0",
|
|
23
23
|
"hot-shots": "^10.0.0",
|
|
24
24
|
"koa": "^2.13.4",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logger } from 'src/framework/logging';
|
|
2
2
|
import { metricsClient } from 'src/framework/metrics';
|
|
3
3
|
import * as storage from 'src/storage/jobs';
|
|
4
|
-
import { Middleware } from 'src/types/koa';
|
|
4
|
+
import type { Middleware } from 'src/types/koa';
|
|
5
5
|
|
|
6
6
|
export const getJobsHandler: Middleware = async (ctx) => {
|
|
7
7
|
const jobs = await storage.readJobs();
|
|
@@ -3,7 +3,7 @@ import { metricsClient } from 'src/framework/metrics';
|
|
|
3
3
|
import { validateRequestBody } from 'src/framework/validation';
|
|
4
4
|
import * as storage from 'src/storage/jobs';
|
|
5
5
|
import { JobInputSchema } from 'src/types/jobs';
|
|
6
|
-
import { Middleware } from 'src/types/koa';
|
|
6
|
+
import type { Middleware } from 'src/types/koa';
|
|
7
7
|
|
|
8
8
|
export const postJobHandler: Middleware = async (ctx) => {
|
|
9
9
|
const jobInput = validateRequestBody(ctx, JobInputSchema);
|
|
@@ -4,7 +4,7 @@ import { logger } from 'src/testing/logging';
|
|
|
4
4
|
import { metricsClient } from 'src/testing/metrics';
|
|
5
5
|
import { agentFromRouter } from 'src/testing/server';
|
|
6
6
|
import { chance } from 'src/testing/types';
|
|
7
|
-
import { Middleware } from 'src/types/koa';
|
|
7
|
+
import type { Middleware } from 'src/types/koa';
|
|
8
8
|
|
|
9
9
|
const middleware = jest.fn<void, Parameters<Middleware>>();
|
|
10
10
|
|
|
@@ -32,7 +32,7 @@ configs:
|
|
|
32
32
|
- *aws-sm
|
|
33
33
|
- *private-npm
|
|
34
34
|
- *docker-ecr-cache
|
|
35
|
-
- docker-compose#v4.
|
|
35
|
+
- docker-compose#v4.12.0:
|
|
36
36
|
dependencies: false
|
|
37
37
|
run: app
|
|
38
38
|
retry:
|
|
@@ -60,7 +60,7 @@ steps:
|
|
|
60
60
|
- *aws-sm
|
|
61
61
|
- *private-npm
|
|
62
62
|
- *docker-ecr-cache
|
|
63
|
-
- docker-compose#v4.
|
|
63
|
+
- docker-compose#v4.12.0:
|
|
64
64
|
run: app
|
|
65
65
|
timeout_in_minutes: 10
|
|
66
66
|
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"@aws-sdk/client-lambda": "^3.259.0",
|
|
19
19
|
"@aws-sdk/client-sns": "^3.259.0",
|
|
20
20
|
"@aws-sdk/util-utf8-node": "^3.259.0",
|
|
21
|
-
"@seek/logger": "^
|
|
22
|
-
"datadog-lambda-js": "^
|
|
23
|
-
"dd-trace": "^
|
|
21
|
+
"@seek/logger": "^6.0.0",
|
|
22
|
+
"datadog-lambda-js": "^7.0.0",
|
|
23
|
+
"dd-trace": "^4.0.0",
|
|
24
24
|
"skuba-dive": "^2.0.0",
|
|
25
25
|
"zod": "^3.19.1"
|
|
26
26
|
},
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { JobScorerInput, JobScorerOutput } from 'src/types/jobScorer';
|
|
2
|
-
import {
|
|
1
|
+
import type { JobScorerInput, JobScorerOutput } from 'src/types/jobScorer';
|
|
2
|
+
import type {
|
|
3
|
+
JobPublishedEvent,
|
|
4
|
+
JobScoredEvent,
|
|
5
|
+
} from 'src/types/pipelineEvents';
|
|
3
6
|
|
|
4
7
|
export const jobPublishedEventToScorerInput = (
|
|
5
8
|
record: JobPublishedEvent,
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
jobPublishedEventToScorerInput,
|
|
3
3
|
jobScorerOutputToScoredEvent,
|
|
4
4
|
} from 'src/mapping/jobScorer';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import type { JobScorerInput, JobScorerOutput } from 'src/types/jobScorer';
|
|
6
|
+
import { JobScorerOutputSchema } from 'src/types/jobScorer';
|
|
7
|
+
import type {
|
|
8
|
+
JobPublishedEvent,
|
|
9
|
+
JobScoredEvent,
|
|
10
|
+
} from 'src/types/pipelineEvents';
|
|
11
11
|
|
|
12
12
|
/* istanbul ignore next: simulation of an external service */
|
|
13
13
|
export const scoringService = {
|
|
@@ -32,7 +32,7 @@ configs:
|
|
|
32
32
|
- *aws-sm
|
|
33
33
|
- *private-npm
|
|
34
34
|
- *docker-ecr-cache
|
|
35
|
-
- docker-compose#v4.
|
|
35
|
+
- docker-compose#v4.12.0:
|
|
36
36
|
dependencies: false
|
|
37
37
|
run: app
|
|
38
38
|
retry:
|
|
@@ -57,7 +57,7 @@ steps:
|
|
|
57
57
|
- *aws-sm
|
|
58
58
|
- *private-npm
|
|
59
59
|
- *docker-ecr-cache
|
|
60
|
-
- docker-compose#v4.
|
|
60
|
+
- docker-compose#v4.12.0:
|
|
61
61
|
run: app
|
|
62
62
|
timeout_in_minutes: 10
|
|
63
63
|
|