@amritk/generate-parsers 0.25.0 → 0.25.1
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/README.md +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @amritk/generate-parsers
|
|
2
2
|
|
|
3
|
-
> **Deprecated.** Use [`@amritk/
|
|
3
|
+
> **Deprecated.** Use [`@amritk/validation`](https://www.npmjs.com/package/@amritk/validation) instead.
|
|
4
4
|
>
|
|
5
5
|
> This release is a compatibility shim: `buildSchema` keeps its signature and emits
|
|
6
6
|
> byte-identical output, so upgrading to it breaks nothing. It is the last
|
|
@@ -16,7 +16,7 @@ for types only, a parser function for it.
|
|
|
16
16
|
## What replaces it
|
|
17
17
|
|
|
18
18
|
The engine did not go away — it moved. It now lives inside
|
|
19
|
-
[`@amritk/
|
|
19
|
+
[`@amritk/validation`](https://github.com/amritk/mjst/tree/main/packages/validation),
|
|
20
20
|
behind a single `generate()` call that reaches every mode this package had plus
|
|
21
21
|
the others, over one shared type declaration:
|
|
22
22
|
|
|
@@ -42,14 +42,14 @@ const files = await buildSchema(schema, 'Document')
|
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
44
|
// after
|
|
45
|
-
import { generate } from '@amritk/
|
|
45
|
+
import { generate } from '@amritk/validation'
|
|
46
46
|
|
|
47
47
|
const files = await generate(schema, 'Document', { modes: ['types', 'parse'] })
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
Both hand back `{ filename, content }[]`. The positional arguments become named
|
|
51
51
|
options — see the
|
|
52
|
-
[`@amritk/
|
|
52
|
+
[`@amritk/validation` README](https://github.com/amritk/mjst/tree/main/packages/validation#readme)
|
|
53
53
|
for the full table.
|
|
54
54
|
|
|
55
55
|
The three shapes `buildSchema` chose between are now modes: the default coercing
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { UnknownKeysStrategy } from '@amritk/helpers/unknown-keys-strategy';
|
|
2
|
-
import { type GeneratedFile, type GenerateOptions, type ImportExtension } from '@amritk/
|
|
2
|
+
import { type GeneratedFile, type GenerateOptions, type ImportExtension } from '@amritk/validation';
|
|
3
3
|
import type { JSONSchema } from 'json-schema-typed/draft-2020-12';
|
|
4
4
|
export type { GeneratedFile, ImportExtension };
|
|
5
5
|
/**
|
|
6
6
|
* A compatibility shim, kept only so this package can be retired without
|
|
7
7
|
* breaking anyone mid-upgrade.
|
|
8
8
|
*
|
|
9
|
-
* The parser and type engine moved into `@amritk/
|
|
9
|
+
* The parser and type engine moved into `@amritk/validation`, which reaches it —
|
|
10
10
|
* and every other mode — through one `generate()` call. Rather than re-export an
|
|
11
11
|
* internal module across the package boundary, this maps the old positional
|
|
12
|
-
* signature onto the public API, so `@amritk/
|
|
12
|
+
* signature onto the public API, so `@amritk/validation` keeps exactly one public
|
|
13
13
|
* entry point and the engine stays an implementation detail of it.
|
|
14
14
|
*
|
|
15
15
|
* The output is byte-identical to what this package emitted before, barrel
|
|
16
16
|
* included, which `index.test.ts` pins against the real pre-retirement engine
|
|
17
17
|
* rather than against this shim's own idea of the answer.
|
|
18
18
|
*
|
|
19
|
-
* @deprecated Use `generate` from `@amritk/
|
|
19
|
+
* @deprecated Use `generate` from `@amritk/validation`:
|
|
20
20
|
* `generate(schema, name, { modes: ['types', 'parse'] })`.
|
|
21
21
|
*/
|
|
22
22
|
export declare const buildSchema: (rootSchema: JSONSchema, rootTypeName: string, extensions?: GenerateOptions['extensions'], typesOnly?: boolean, logWarnings?: boolean, strict?: boolean, helpersMode?: 'package' | 'embedded', helpersImportPrefix?: string, readonly?: boolean, stripUnknown?: boolean, typeSuffix?: string, importExt?: ImportExtension, caseInsensitive?: boolean, schemas?: Readonly<Record<string, unknown>>, unknownKeys?: UnknownKeysStrategy) => Promise<GeneratedFile[]>;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generate } from "@amritk/
|
|
1
|
+
import { generate } from "@amritk/validation";
|
|
2
2
|
const buildSchema = async (rootSchema, rootTypeName, extensions, typesOnly, logWarnings, strict, helpersMode = "package", helpersImportPrefix = "./", readonly = false, stripUnknown = false, typeSuffix = "", importExt = "js", caseInsensitive = false, schemas, unknownKeys) => {
|
|
3
3
|
const modes = typesOnly === true ? ["types"] : ["types", strict === true ? "parseStrict" : "parse"];
|
|
4
4
|
return generate(rootSchema, rootTypeName, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amritk/generate-parsers",
|
|
3
|
-
"version": "0.25.
|
|
4
|
-
"description": "Deprecated — merged into @amritk/
|
|
3
|
+
"version": "0.25.1",
|
|
4
|
+
"description": "Deprecated — merged into @amritk/validation. Kept as a compatibility shim; use `generate` instead.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "amritk",
|
|
7
7
|
"repository": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@amritk/helpers": "^0.23.
|
|
44
|
-
"@amritk/
|
|
43
|
+
"@amritk/helpers": "^0.23.1",
|
|
44
|
+
"@amritk/validation": "^0.3.0",
|
|
45
45
|
"json-schema-typed": "^8.0.1"
|
|
46
46
|
}
|
|
47
47
|
}
|