@platformatic/config
Advanced tools
Comparing version 1.5.2 to 1.6.0
'use strict' | ||
const { basename, join, resolve, dirname, parse } = require('path') | ||
const { readFile, access } = require('fs/promises') | ||
const EventEmitter = require('events') | ||
const { basename, join, resolve, dirname, parse } = require('node:path') | ||
const { readFile, access } = require('node:fs/promises') | ||
const EventEmitter = require('node:events') | ||
const { createRequire } = require('node:module') | ||
const Ajv = require('ajv') | ||
@@ -150,2 +151,3 @@ const fastifyPlugin = require('./plugin') | ||
} | ||
/* c8 ignore next 3 */ | ||
} catch { | ||
@@ -196,2 +198,23 @@ // Ignore error. | ||
}) | ||
ajv.addKeyword({ | ||
keyword: 'resolveModule', | ||
type: 'string', | ||
schemaType: 'boolean', | ||
// TODO: figure out how to implement this via the new `code` | ||
// option in Ajv | ||
validate: (schema, path, parentSchema, data) => { | ||
if (typeof path !== 'string' || path.trim() === '') { | ||
return false | ||
} | ||
const toRequire = this.fullPath || join(this.dirname, 'foo') | ||
const _require = createRequire(toRequire) | ||
try { | ||
const resolved = _require.resolve(path) | ||
data.parentData[data.parentDataProperty] = resolved | ||
return true | ||
} catch { | ||
return false | ||
} | ||
} | ||
}) | ||
const ajvValidate = ajv.compile(this.schema) | ||
@@ -213,3 +236,3 @@ | ||
/* istanbul ignore next */ | ||
/* c8 ignore next 8 */ | ||
async parseAndValidate () { | ||
@@ -216,0 +239,0 @@ const validationResult = await this.parse() |
{ | ||
"name": "@platformatic/config", | ||
"version": "1.5.2", | ||
"version": "1.6.0", | ||
"description": "Platformatic DB Config Manager", | ||
@@ -35,9 +35,9 @@ "main": "index.js", | ||
"undici": "^5.25.4", | ||
"@platformatic/metaconfig": "1.5.2", | ||
"@platformatic/utils": "1.5.2" | ||
"@platformatic/metaconfig": "1.6.0", | ||
"@platformatic/utils": "1.6.0" | ||
}, | ||
"scripts": { | ||
"test": "standard | snazzy && c8 node ./test/runner.js", | ||
"test": "standard | snazzy && c8 --100 node ./test/runner.js", | ||
"lint": "standard | snazzy" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35260
643
6
+ Added@platformatic/metaconfig@1.6.0(transitive)
+ Added@platformatic/utils@1.6.0(transitive)
- Removed@platformatic/metaconfig@1.5.2(transitive)
- Removed@platformatic/utils@1.5.2(transitive)
Updated@platformatic/utils@1.6.0