@coobaha/typed-fastify
Advanced tools
Comparing version 2.0.0-rc.1 to 2.0.0
@@ -36,2 +36,4 @@ "use strict"; | ||
const json_schema_merge_allof_1 = __importDefault(require("json-schema-merge-allof")); | ||
const std_env_1 = require("std-env"); | ||
const doNotUpdateHash = std_env_1.isCI || std_env_1.isTest; | ||
const revision = '__v' + require('../package.json').version; // + Date.now(); | ||
@@ -163,6 +165,9 @@ async function normalizeSchema(originalSchema, rootId, newRootId) { | ||
const savedExists = fs_1.default.existsSync(saved); | ||
const $hash = (0, sha256_1.default)(contents).toString() + revision; | ||
let $hash = (0, sha256_1.default)(contents).toString() + revision; | ||
try { | ||
if (savedExists) { | ||
const existing = JSON.parse(await fs_1.promises.readFile(saved, 'utf-8')); | ||
if (doNotUpdateHash) { | ||
$hash = existing.$hash; | ||
} | ||
if (existing.$hash === $hash) { | ||
@@ -169,0 +174,0 @@ continue; |
@@ -9,3 +9,3 @@ import type { PositiveInfinity, NegativeInfinity, JsonPrimitive, JsonValue, EmptyObject, TypedArray, WritableDeep, IsNever, IsUnknown } from 'type-fest'; | ||
type IsNotJsonableError<T> = Invalid<`${Extract<T, string>} is not Json-like`> & {}; | ||
type NotJsonable = ((...arguments_: any[]) => any) | undefined | symbol | RegExp | Function; | ||
type NotJsonable = ((...arguments_: any[]) => any) | symbol | RegExp | Function; | ||
type NeverToNull<T> = IsNever<T> extends true ? null : T; | ||
@@ -18,3 +18,3 @@ type JsonCastBehavior = 'cast' | 'combine'; | ||
[K in keyof T]: [T[K]] extends [NotJsonable] | [never] ? IsNotJsonableError<K> : Jsonlike<T[K], CastBehavior>; | ||
} : IsNotJsonableError<'Passed value'>; | ||
} : T extends undefined ? T : IsNotJsonableError<'Passed value'>; | ||
export interface Invalid<msg = any> { | ||
@@ -21,0 +21,0 @@ readonly __INVALID__: unique symbol; |
{ | ||
"name": "@coobaha/typed-fastify", | ||
"description": "opinionated types for fastify", | ||
"version": "2.0.0-rc.1", | ||
"version": "2.0.0", | ||
"bin": { | ||
@@ -40,2 +40,3 @@ "tfs": "bin/gen.bin.js", | ||
"split2": "^4.2.0", | ||
"std-env": "3.4.3", | ||
"syncpack": "^11.2.1", | ||
@@ -77,8 +78,8 @@ "tap": "^16.3.8", | ||
"scripts": { | ||
"build": "tsc -p src && tsc -p generator", | ||
"_postinstall": "husky install", | ||
"build": "tsc -p src && tsc -p generator", | ||
"preserver": "tsnd generator/gen.bin.ts gen 'test/test_schema.ts'", | ||
"pretest": "tsnd generator/gen.bin.ts gen 'test/test_schema.ts'", | ||
"server": "pnpm preserver && tsnd test/server.ts", | ||
"test": "pnpm pretest && pnpm test:types && pnpm test:integration", | ||
"test": "NODE_ENV=test pnpm pretest && pnpm test:types && pnpm test:integration", | ||
"test:integration": "TAP_TS=1 tap test/*.test.ts -R dot", | ||
@@ -85,0 +86,0 @@ "test:types": "tsc -p test/tsconfig.test.json" |
@@ -19,3 +19,3 @@ import type { | ||
type NotJsonable = ((...arguments_: any[]) => any) | undefined | symbol | RegExp | Function; | ||
type NotJsonable = ((...arguments_: any[]) => any) | symbol | RegExp | Function; | ||
@@ -70,4 +70,6 @@ type NeverToNull<T> = IsNever<T> extends true ? null : T; | ||
? { | ||
[K in keyof T]: [T[K]] extends [NotJsonable] | [never] ? IsNotJsonableError<K> : Jsonlike<T[K], CastBehavior>; | ||
} // JsonifyObject recursive call for its children | ||
[K in keyof T]: [T[K]] extends [NotJsonable] | [never] ? IsNotJsonableError<K> : Jsonlike<T[K], CastBehavior>; // JsonifyObject recursive call for its children | ||
} | ||
: T extends undefined | ||
? T | ||
: IsNotJsonableError<'Passed value'>; | ||
@@ -74,0 +76,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
102521
1283
0
26