apiwork 0.0.0 → 0.0.3
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 +311 -0
- package/dist/bin/apiwork.d.ts +1 -0
- package/dist/bin/apiwork.js +59 -0
- package/dist/chunk-4AJOYIJC.js +37 -0
- package/dist/chunk-7NDS6XB6.js +57 -0
- package/dist/chunk-MWFEILAW.js +28 -0
- package/dist/chunk-NQPUJJ3O.js +37 -0
- package/dist/chunk-QGKZLUZR.js +1151 -0
- package/dist/chunk-ZP6ZWEPI.js +127 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +9 -0
- package/dist/options-BDcqBI1C.d.ts +392 -0
- package/dist/sorbus/index.d.ts +49 -0
- package/dist/sorbus/index.js +8 -0
- package/dist/typescript/index.d.ts +36 -0
- package/dist/typescript/index.js +8 -0
- package/dist/zod/index.d.ts +42 -0
- package/dist/zod/index.js +8 -0
- package/package.json +57 -4
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { G as GenerateOptions, S as Schema } from '../options-BDcqBI1C.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for the Zod generator.
|
|
5
|
+
*/
|
|
6
|
+
interface ZodGenerateOptions extends GenerateOptions {
|
|
7
|
+
/** TypeScript output configuration. */
|
|
8
|
+
typescript?: {
|
|
9
|
+
/** Target TypeScript major version. Defaults to `5`. */
|
|
10
|
+
version?: 5;
|
|
11
|
+
};
|
|
12
|
+
/** Target Zod major version. Defaults to `4`. */
|
|
13
|
+
version?: 4;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Generates Zod schemas from the Apiwork schema.
|
|
17
|
+
*
|
|
18
|
+
* @param schema - The parsed schema.
|
|
19
|
+
* @param options - The generator options.
|
|
20
|
+
* @returns The generated files, keyed by file path.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { parse } from 'apiwork';
|
|
25
|
+
* import { generate } from 'apiwork/zod';
|
|
26
|
+
*
|
|
27
|
+
* const schema = await parse.url('http://localhost:3000/api/v1/.apiwork');
|
|
28
|
+
* const files = generate(schema, {
|
|
29
|
+
* version: 4,
|
|
30
|
+
* typescript: { version: 5 },
|
|
31
|
+
* fileCase: 'kebab',
|
|
32
|
+
* importExtension: '.js',
|
|
33
|
+
* transformIdentifier: (identifier, source) => {
|
|
34
|
+
* if (source === 'api') return `Api${identifier}`;
|
|
35
|
+
* return identifier;
|
|
36
|
+
* },
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare function generate(schema: Schema, options?: ZodGenerateOptions): Map<string, string>;
|
|
41
|
+
|
|
42
|
+
export { type ZodGenerateOptions, generate };
|
package/package.json
CHANGED
|
@@ -1,7 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "apiwork",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"description": "Codegen for Apiwork APIs",
|
|
5
2
|
"author": "Skiftle",
|
|
6
|
-
"
|
|
3
|
+
"bin": {
|
|
4
|
+
"apiwork": "./dist/bin/apiwork.js"
|
|
5
|
+
},
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/skiftle/apiwork-js/issues"
|
|
8
|
+
},
|
|
9
|
+
"description": "JavaScript toolkit for Apiwork.",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@biomejs/biome": "2.4.12",
|
|
12
|
+
"@skiftle/biome-config": "0.0.7",
|
|
13
|
+
"@types/node": "25.6.0",
|
|
14
|
+
"tsup": "8.5.1",
|
|
15
|
+
"typescript": "6.0.2",
|
|
16
|
+
"vitest": "4.1.4"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./sorbus": {
|
|
27
|
+
"import": "./dist/sorbus/index.js",
|
|
28
|
+
"types": "./dist/sorbus/index.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./typescript": {
|
|
31
|
+
"import": "./dist/typescript/index.js",
|
|
32
|
+
"types": "./dist/typescript/index.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./zod": {
|
|
35
|
+
"import": "./dist/zod/index.js",
|
|
36
|
+
"types": "./dist/zod/index.d.ts"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"homepage": "https://github.com/skiftle/apiwork-js",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"name": "apiwork",
|
|
45
|
+
"packageManager": "pnpm@10.33.0",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/skiftle/apiwork-js.git"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup",
|
|
52
|
+
"check": "biome check .",
|
|
53
|
+
"check:write": "biome check --write .",
|
|
54
|
+
"prepublishOnly": "npm run build",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"typecheck": "tsc --noEmit"
|
|
57
|
+
},
|
|
58
|
+
"type": "module",
|
|
59
|
+
"version": "0.0.3"
|
|
7
60
|
}
|