@nexus-rpc/gen-core 0.1.0-alpha1 → 0.1.0-alpha2
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 +5 -0
- package/dist/parser.js +1 -1
- package/package.json +4 -2
- package/schemas/nexus-rpc-gen.json +98 -0
- package/src/parser.ts +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @nexus-rpc/gen-core
|
|
2
|
+
|
|
3
|
+
Core library for Nexus RPC code generation. This package provides the parsing, generation, and language-specific rendering logic used by the Nexus RPC code generator.
|
|
4
|
+
|
|
5
|
+
For installation, usage, and detailed documentation, see the [main repository README](https://github.com/nexus-rpc/nexus-rpc-gen/blob/main/README.md).
|
package/dist/parser.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-rpc/gen-core",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-alpha2",
|
|
4
4
|
"description": "Nexus code generation (core library)",
|
|
5
5
|
"author": "Temporal Technologies Inc. <sdk@temporal.io>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,8 +24,10 @@
|
|
|
24
24
|
"yaml": "^2.8.1"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
|
+
"README.md",
|
|
27
28
|
"src",
|
|
28
|
-
"dist"
|
|
29
|
+
"dist",
|
|
30
|
+
"schemas"
|
|
29
31
|
],
|
|
30
32
|
"publishConfig": {
|
|
31
33
|
"access": "public"
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$ref": "#/$defs/DefinitionFile",
|
|
4
|
+
"$defs": {
|
|
5
|
+
"DefinitionFile": {
|
|
6
|
+
"title": "Nexus RPC Definition Schema",
|
|
7
|
+
"description": "Definition for Nexus RPC services and operations",
|
|
8
|
+
"type": "object",
|
|
9
|
+
"required": [
|
|
10
|
+
"nexusrpc"
|
|
11
|
+
],
|
|
12
|
+
"additionalProperties": false,
|
|
13
|
+
"properties": {
|
|
14
|
+
"nexusrpc": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"pattern": "^1\\.\\d+\\.\\d+$"
|
|
17
|
+
},
|
|
18
|
+
"services": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"additionalProperties": {
|
|
21
|
+
"$ref": "#/$defs/Service"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"types": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": {
|
|
27
|
+
"$ref": "#/$defs/DataType"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"Service": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"required": [
|
|
35
|
+
"operations"
|
|
36
|
+
],
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"properties": {
|
|
39
|
+
"description": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
42
|
+
"operations": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"additionalProperties": {
|
|
45
|
+
"$ref": "#/$defs/Operation"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"Operation": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"properties": {
|
|
54
|
+
"description": {
|
|
55
|
+
"type": "string"
|
|
56
|
+
},
|
|
57
|
+
"input": {
|
|
58
|
+
"$ref": "#/$defs/DataType"
|
|
59
|
+
},
|
|
60
|
+
"output": {
|
|
61
|
+
"$ref": "#/$defs/DataType"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"DataType": {
|
|
66
|
+
"allOf": [
|
|
67
|
+
{
|
|
68
|
+
"$ref": "http://json-schema.org/draft-07/schema"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"type": "object",
|
|
72
|
+
"properties": {
|
|
73
|
+
"$csharpRef": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"description": ".NET type name, fully qualified unless in the same namespace as the service.\n"
|
|
76
|
+
},
|
|
77
|
+
"$goRef": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"description": "Go type name, fully qualified unless in the same package as the service. For example, \"github.com/my-org/my-repo/my-package.MyType\".\n"
|
|
80
|
+
},
|
|
81
|
+
"$javaRef": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"description": "Java type name, fully qualified unless in the same package as the service.\n"
|
|
84
|
+
},
|
|
85
|
+
"$pythonRef": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"description": "Fully qualified Python type name.\n"
|
|
88
|
+
},
|
|
89
|
+
"$typescriptRef": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"description": "TypeScript type name. Can be prepended with the import + \"#\" to fully qualify it and have the \"import type\" emitted. For example, \"MyType\" would be no import, but \"node:url#URL\" would import that from \"node:url\". Similarly, it may be local and suffixed with a file extension, e.g. \"./my-types.js#MyType\". There is currently no way to represent an \"import * from\".\n"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
package/src/parser.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DefinitionSchema } from "./definition-schema.js";
|
|
2
2
|
|
|
3
|
-
import jsonSchema from "
|
|
3
|
+
import jsonSchema from "../schemas/nexus-rpc-gen.json" with { type: "json" };
|
|
4
4
|
import Ajv from "ajv";
|
|
5
5
|
import addFormats from "ajv-formats";
|
|
6
6
|
import yaml from "yaml";
|