@arrirpc/codegen-utils 0.55.0 → 0.57.2

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.
Files changed (2) hide show
  1. package/README.md +89 -5
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,11 +1,95 @@
1
1
  # @arrirpc/codegen-utils
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ This library contains a number of utilities that to assist in creating generators for Arri RPC. To See more complete usage example checkout one of the official arri client generators.
4
4
 
5
- ## Building
5
+ ## Creating a Generator Plugin
6
6
 
7
- Run `nx build @arrirpc/codegen-utils` to build the library.
7
+ ```ts
8
+ import { defineGeneratorPlugin } from "@arrirpc/codegen-utils";
8
9
 
9
- ## Running unit tests
10
+ // add any options needed for your plugin here
11
+ export interface MyPluginOptions {
12
+ a: string;
13
+ b: string;
14
+ }
10
15
 
11
- Run `nx test @arrirpc/codegen-utils` to execute the unit tests via [Vitest](https://vitest.dev).
16
+ export default defineGeneratorPlugin((options: MyPluginOptions) => {
17
+ return {
18
+ options,
19
+ generator: async (appDef, isDevServer) => {
20
+ // generate something using the app definition and the specified options
21
+ },
22
+ };
23
+ });
24
+ ```
25
+
26
+ ## Other Utilities
27
+
28
+ ```ts
29
+ // type guards
30
+ isAddDefinition(input);
31
+ isRpcDefinition(input);
32
+ isServiceDefinition(input);
33
+ isSchema(input);
34
+ isSchemaFormEmpty(input);
35
+ isSchemaFormType(input);
36
+ isSchemaFormEnum(input);
37
+ isSchemaFormElements(inputs);
38
+ isSchemaFormProperties(input);
39
+ isSchemaFormValues(input);
40
+ isSchemaFormDiscriminator(input);
41
+ isSchemaFormRef(input);
42
+
43
+ unflattenProcedures({
44
+ "v1.users.getUser": {
45
+ transport: "http",
46
+ path: "/v1/users/get-user",
47
+ method: "get",
48
+ },
49
+ "v1.users.createUser": {
50
+ transport: "http",
51
+ path: "/v1/users/create-user",
52
+ method: "post",
53
+ },
54
+ });
55
+ /**
56
+ * outputs the following
57
+ * {
58
+ * v1: {
59
+ * users: {
60
+ * getUser: {
61
+ * transport: "http",
62
+ * path: "/v1/users/get-user",
63
+ * method: "get",
64
+ * },
65
+ * createUser: {
66
+ * transport: "http",
67
+ * path: "/v1/users/create-user",
68
+ * method: "post",
69
+ * }
70
+ * }
71
+ * }
72
+ * }
73
+ */
74
+
75
+ removeDisallowedChars(input, disallowedChars);
76
+ camelCase(input, opts);
77
+ kebabCase(input);
78
+ pascalCase(input, opts);
79
+ snakeCase(input, opts);
80
+ titleCase(input, opts);
81
+ flatCase(input, opts);
82
+ upperFirst(input);
83
+ lowerFirst(input);
84
+ isUppercase(input);
85
+ ```
86
+
87
+ ## Development
88
+
89
+ ### Building
90
+
91
+ Run `pnpm nx build codegen-utils` to build the library.
92
+
93
+ ### Running unit tests
94
+
95
+ Run `pnpm nx test codegen-utils` to execute the unit tests via [Vitest](https://vitest.dev).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-utils",
3
- "version": "0.55.0",
3
+ "version": "0.57.2",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "joshmossas",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "scule": "^1.3.0",
26
- "@arrirpc/schema": "0.55.0",
27
- "jtd-utils": "0.55.0"
26
+ "@arrirpc/schema": "0.57.2",
27
+ "jtd-utils": "0.57.2"
28
28
  }
29
29
  }