@volant-autonomy/via-sdk 1.0.2 → 1.2801.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 +17 -1
- package/dist/composite.d.ts +30 -0
- package/dist/composite.js +12 -0
- package/dist/direct.d.ts +326 -48
- package/dist/direct.js +97 -10
- package/dist/docstringTransformer.js +5 -0
- package/dist/types.d.ts +3 -3
- package/dist/volant-schema.d.ts +1103 -229
- package/package.json +4 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
4
|
+
let schemaLocated = false;
|
|
4
5
|
/**
|
|
5
6
|
* Follows the 'paths' import to get a mapping of endpoint -> docstrings from the schema file.
|
|
6
7
|
* The relevant part of the schema is in the shape below
|
|
@@ -29,6 +30,7 @@ function gatherDocstrings(node, tsInstance, program) {
|
|
|
29
30
|
// if this import is not the schema, stop
|
|
30
31
|
if (!(importSymbol === null || importSymbol === void 0 ? void 0 : importSymbol.getName().includes('schema')))
|
|
31
32
|
return;
|
|
33
|
+
schemaLocated = true;
|
|
32
34
|
const exportSymbols = typeChecker.getExportsOfModule(importSymbol);
|
|
33
35
|
for (const rootSymbol of exportSymbols) {
|
|
34
36
|
if (rootSymbol.getName() === 'paths') {
|
|
@@ -146,6 +148,9 @@ function default_1(program, _pluginConfig, { ts: tsInstance }) {
|
|
|
146
148
|
const endpointDocstrings = gatherDocstrings(sourceFile, tsInstance, program);
|
|
147
149
|
if (endpointDocstrings === undefined) {
|
|
148
150
|
console.error('endpoint docstrings were not found');
|
|
151
|
+
if (!schemaLocated) {
|
|
152
|
+
console.error('the schema file was not found at all, file is likely missing (try npm run gen-schema)');
|
|
153
|
+
}
|
|
149
154
|
return sourceFile;
|
|
150
155
|
}
|
|
151
156
|
const endpointIdentifiers = gatherIdentifiers(sourceFile, {}, tsInstance, program);
|
package/dist/types.d.ts
CHANGED
|
@@ -37,18 +37,18 @@ export type bodyOf<T> = T extends {
|
|
|
37
37
|
/** Gets the type of the query input for an endpoint */
|
|
38
38
|
export type queryOf<T> = T extends {
|
|
39
39
|
parameters: {
|
|
40
|
-
query
|
|
40
|
+
query?: infer P;
|
|
41
41
|
};
|
|
42
42
|
} ? P : never;
|
|
43
43
|
/** Gets the type of the path input for an endpoint */
|
|
44
44
|
export type pathOf<T> = T extends {
|
|
45
45
|
parameters: {
|
|
46
|
-
path
|
|
46
|
+
path?: infer P;
|
|
47
47
|
};
|
|
48
48
|
} ? P : never;
|
|
49
49
|
/** Gets the type of the header input for an endpoint */
|
|
50
50
|
export type headerOf<T> = T extends {
|
|
51
51
|
parameters: {
|
|
52
|
-
header
|
|
52
|
+
header?: infer P;
|
|
53
53
|
};
|
|
54
54
|
} ? P : never;
|