@dxos/protobuf-compiler 2.33.5-dev.b7c9d504 → 2.33.5-dev.b9f5bea6
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/dist/src/configure.d.ts +1 -1
- package/dist/src/configure.d.ts.map +1 -1
- package/dist/src/configure.js +2 -2
- package/dist/src/configure.js.map +1 -1
- package/dist/src/generator/declaration-generator.d.ts +1 -1
- package/dist/src/generator/declaration-generator.d.ts.map +1 -1
- package/dist/src/generator/declaration-generator.js +3 -5
- package/dist/src/generator/declaration-generator.js.map +1 -1
- package/dist/src/generator/doc-comment.d.ts +1 -1
- package/dist/src/generator/doc-comment.d.ts.map +1 -1
- package/dist/src/generator/doc-comment.js +1 -3
- package/dist/src/generator/doc-comment.js.map +1 -1
- package/dist/src/generator/enum.d.ts +1 -1
- package/dist/src/generator/enum.d.ts.map +1 -1
- package/dist/src/generator/enum.js +1 -3
- package/dist/src/generator/enum.js.map +1 -1
- package/dist/src/generator/field.d.ts +2 -2
- package/dist/src/generator/field.d.ts.map +1 -1
- package/dist/src/generator/field.js +7 -7
- package/dist/src/generator/field.js.map +1 -1
- package/dist/src/generator/file-generator.d.ts +3 -3
- package/dist/src/generator/file-generator.d.ts.map +1 -1
- package/dist/src/generator/file-generator.js +14 -20
- package/dist/src/generator/file-generator.js.map +1 -1
- package/dist/src/generator/message.d.ts +1 -1
- package/dist/src/generator/message.d.ts.map +1 -1
- package/dist/src/generator/message.js +4 -4
- package/dist/src/generator/message.js.map +1 -1
- package/dist/src/generator/serializer-definition-generator.d.ts +2 -1
- package/dist/src/generator/serializer-definition-generator.d.ts.map +1 -1
- package/dist/src/generator/serializer-definition-generator.js +2 -2
- package/dist/src/generator/serializer-definition-generator.js.map +1 -1
- package/dist/src/generator/service.d.ts +2 -2
- package/dist/src/generator/service.d.ts.map +1 -1
- package/dist/src/generator/service.js +10 -14
- package/dist/src/generator/service.js.map +1 -1
- package/dist/src/generator/types.d.ts +2 -2
- package/dist/src/generator/types.d.ts.map +1 -1
- package/dist/src/generator/types.js +8 -10
- package/dist/src/generator/types.js.map +1 -1
- package/dist/src/module-specifier.js +4 -4
- package/dist/src/module-specifier.js.map +1 -1
- package/dist/src/namespaces.d.ts +10 -10
- package/dist/src/namespaces.d.ts.map +1 -1
- package/dist/src/namespaces.js +26 -34
- package/dist/src/namespaces.js.map +1 -1
- package/dist/src/parser/resolver.d.ts +1 -1
- package/dist/src/parser/resolver.d.ts.map +1 -1
- package/dist/src/parser/resolver.js +2 -2
- package/dist/src/parser/resolver.js.map +1 -1
- package/dist/src/parser/substitutions-parser.d.ts +1 -1
- package/dist/src/parser/substitutions-parser.d.ts.map +1 -1
- package/dist/src/parser/substitutions-parser.js +4 -4
- package/dist/src/parser/substitutions-parser.js.map +1 -1
- package/dist/src/protobuf-json.d.ts +1 -1
- package/dist/src/protobuf-json.d.ts.map +1 -1
- package/dist/src/protobuf-json.js +3 -5
- package/dist/src/protobuf-json.js.map +1 -1
- package/dist/src/type-generator.d.ts +2 -2
- package/dist/src/type-generator.d.ts.map +1 -1
- package/dist/src/type-generator.js +11 -6
- package/dist/src/type-generator.js.map +1 -1
- package/dist/src/util.d.ts +1 -1
- package/dist/src/util.d.ts.map +1 -1
- package/dist/src/util.js +2 -2
- package/dist/src/util.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/configure.ts +2 -2
- package/src/generator/declaration-generator.ts +15 -17
- package/src/generator/doc-comment.ts +4 -6
- package/src/generator/enum.ts +9 -11
- package/src/generator/field.ts +4 -4
- package/src/generator/file-generator.ts +28 -41
- package/src/generator/message.ts +4 -4
- package/src/generator/serializer-definition-generator.ts +2 -6
- package/src/generator/service.ts +22 -26
- package/src/generator/types.ts +16 -18
- package/src/module-specifier.ts +4 -4
- package/src/namespaces.ts +18 -26
- package/src/parser/resolver.ts +2 -2
- package/src/parser/substitutions-parser.ts +4 -4
- package/src/protobuf-json.ts +3 -5
- package/src/type-generator.ts +12 -6
- package/src/util.ts +2 -2
package/dist/src/configure.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/configure.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/configure.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,sBAAsB,YAGlC,CAAC"}
|
package/dist/src/configure.js
CHANGED
|
@@ -11,9 +11,9 @@ const protobufjs_1 = __importDefault(require("protobufjs"));
|
|
|
11
11
|
/**
|
|
12
12
|
* Manually adds descriptor proto to the list of common protobuf definitions.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
const preconfigureProtobufjs = () => {
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
16
16
|
protobufjs_1.default.common('descriptor', require('protobufjs/google/protobuf/descriptor.json').nested.google.nested.protobuf.nested);
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
18
|
exports.preconfigureProtobufjs = preconfigureProtobufjs;
|
|
19
19
|
//# sourceMappingURL=configure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/configure.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,4DAA4B;AAE5B;;GAEG;
|
|
1
|
+
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/configure.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,4DAA4B;AAE5B;;GAEG;AACI,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACzC,8DAA8D;IAC9D,oBAAE,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,4CAA4C,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACtH,CAAC,CAAC;AAHW,QAAA,sBAAsB,0BAGjC"}
|
|
@@ -2,5 +2,5 @@ import * as protobufjs from 'protobufjs';
|
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
3
|
import { SubstitutionsMap } from '../parser';
|
|
4
4
|
export declare function createDeclarations(types: protobufjs.ReflectionObject[], subs: SubstitutionsMap): Generator<ts.Statement>;
|
|
5
|
-
export declare
|
|
5
|
+
export declare const createTypeDictionary: (root: protobufjs.NamespaceBase) => ts.InterfaceDeclaration;
|
|
6
6
|
//# sourceMappingURL=declaration-generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration-generator.d.ts","sourceRoot":"","sources":["../../../src/generator/declaration-generator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAQ7C,wBAAkB,kBAAkB,CAAE,KAAK,EAAE,UAAU,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,gBAAgB,GAAG,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,CAuB3H;AAeD,
|
|
1
|
+
{"version":3,"file":"declaration-generator.d.ts","sourceRoot":"","sources":["../../../src/generator/declaration-generator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAQ7C,wBAAkB,kBAAkB,CAAE,KAAK,EAAE,UAAU,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,gBAAgB,GAAG,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,CAuB3H;AAeD,eAAO,MAAM,oBAAoB,SAAU,WAAW,aAAa,4BAclE,CAAC"}
|
|
@@ -66,10 +66,8 @@ function* getRegisteredTypes(root) {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
.map(type => f.createPropertySignature(undefined, f.createStringLiteral((0, namespaces_1.normalizeFullyQualifiedName)(type.fullName)), undefined, (0, types_1.getTypeReference)(type))));
|
|
73
|
-
}
|
|
69
|
+
const createTypeDictionary = (root) => f.createInterfaceDeclaration(undefined, [f.createToken(ts.SyntaxKind.ExportKeyword)], 'TYPES', undefined, undefined, Array.from(getRegisteredTypes(root))
|
|
70
|
+
.sort((b, a) => b.fullName.localeCompare(a.fullName))
|
|
71
|
+
.map(type => f.createPropertySignature(undefined, f.createStringLiteral((0, namespaces_1.normalizeFullyQualifiedName)(type.fullName)), undefined, (0, types_1.getTypeReference)(type))));
|
|
74
72
|
exports.createTypeDictionary = createTypeDictionary;
|
|
75
73
|
//# sourceMappingURL=declaration-generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration-generator.js","sourceRoot":"","sources":["../../../src/generator/declaration-generator.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;AAEF,uDAAyC;AACzC,+CAAiC;AAEjC,8CAA4D;AAE5D,iCAA+C;AAC/C,uCAAqD;AACrD,uCAAqD;AACrD,mCAA2C;AAE3C,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;AAErB,QAAgB,CAAC,CAAC,kBAAkB,CAAE,KAAoC,EAAE,IAAsB;IAChG,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;QACvB,IAAI,GAAG,YAAY,UAAU,CAAC,IAAI,EAAE;YAClC,MAAM,IAAA,4BAAqB,EAAC,GAAG,CAAC,CAAC;SAClC;aAAM,IAAI,GAAG,YAAY,UAAU,CAAC,OAAO,EAAE;YAC5C,MAAM,IAAA,kCAAwB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC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src/generator/doc-comment.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,
|
|
1
|
+
{"version":3,"file":"doc-comment.d.ts","sourceRoot":"","sources":["../../../src/generator/doc-comment.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,eAAO,MAAM,gBAAgB,wCAAyC,MAAM,MAK3E,CAAC"}
|
|
@@ -8,8 +8,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.attachDocComment = void 0;
|
|
10
10
|
const typescript_1 = __importDefault(require("typescript"));
|
|
11
|
-
|
|
12
|
-
return typescript_1.default.addSyntheticLeadingComment(node, typescript_1.default.SyntaxKind.MultiLineCommentTrivia, `*\n${comment.split('\n').map(line => ` * ${line}`).join('\n')}\n `, true);
|
|
13
|
-
}
|
|
11
|
+
const attachDocComment = (node, comment) => typescript_1.default.addSyntheticLeadingComment(node, typescript_1.default.SyntaxKind.MultiLineCommentTrivia, `*\n${comment.split('\n').map(line => ` * ${line}`).join('\n')}\n `, true);
|
|
14
12
|
exports.attachDocComment = attachDocComment;
|
|
15
13
|
//# sourceMappingURL=doc-comment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-comment.js","sourceRoot":"","sources":["../../../src/generator/doc-comment.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,4DAA4B;
|
|
1
|
+
{"version":3,"file":"doc-comment.js","sourceRoot":"","sources":["../../../src/generator/doc-comment.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,4DAA4B;AAErB,MAAM,gBAAgB,GAAG,CAAoB,IAAO,EAAE,OAAe,EAAK,EAAE,CAAC,oBAAE,CAAC,0BAA0B,CAC/G,IAAI,EACJ,oBAAE,CAAC,UAAU,CAAC,sBAAsB,EAClC,MAAM,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EACnE,IAAI,CACP,CAAC;AALW,QAAA,gBAAgB,oBAK3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as protobufjs from 'protobufjs';
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const createEnumDeclaration: (type: protobufjs.Enum) => ts.EnumDeclaration;
|
|
4
4
|
//# sourceMappingURL=enum.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/generator/enum.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,
|
|
1
|
+
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/generator/enum.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,eAAO,MAAM,qBAAqB,SAAU,WAAW,IAAI,uBAQ1D,CAAC"}
|
|
@@ -25,8 +25,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.createEnumDeclaration = void 0;
|
|
26
26
|
const ts = __importStar(require("typescript"));
|
|
27
27
|
const f = ts.factory;
|
|
28
|
-
|
|
29
|
-
return f.createEnumDeclaration(undefined, [f.createToken(ts.SyntaxKind.ExportKeyword)], type.name, Object.entries(type.values).map(([name, id]) => f.createEnumMember(name, f.createNumericLiteral(id))));
|
|
30
|
-
}
|
|
28
|
+
const createEnumDeclaration = (type) => f.createEnumDeclaration(undefined, [f.createToken(ts.SyntaxKind.ExportKeyword)], type.name, Object.entries(type.values).map(([name, id]) => f.createEnumMember(name, f.createNumericLiteral(id))));
|
|
31
29
|
exports.createEnumDeclaration = createEnumDeclaration;
|
|
32
30
|
//# sourceMappingURL=enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/generator/enum.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;AAGF,+CAAiC;AAEjC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/generator/enum.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;AAGF,+CAAiC;AAEjC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;AAEd,MAAM,qBAAqB,GAAG,CAAC,IAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,qBAAqB,CACrF,SAAS,EACT,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EAC5C,IAAI,CAAC,IAAI,EACT,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAChE,IAAI,EACJ,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAC3B,CAAC,CACH,CAAC;AARW,QAAA,qBAAqB,yBAQhC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as protobufjs from 'protobufjs';
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
3
|
import { SubstitutionsMap } from '../parser';
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
4
|
+
export declare const getFieldType: (field: protobufjs.Field, subs: SubstitutionsMap) => ts.TypeNode;
|
|
5
|
+
export declare const getScalarFieldType: (field: protobufjs.Field, subs: SubstitutionsMap) => ts.TypeNode;
|
|
6
6
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/generator/field.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAK7C,
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/generator/field.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAK7C,eAAO,MAAM,YAAY,UAAW,WAAW,KAAK,QAAQ,gBAAgB,KAAG,GAAG,QAWjF,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAAW,WAAW,KAAK,QAAQ,gBAAgB,KAAG,GAAG,QAIvF,CAAC"}
|
|
@@ -31,26 +31,26 @@ const protobufjs = __importStar(require("protobufjs"));
|
|
|
31
31
|
const ts = __importStar(require("typescript"));
|
|
32
32
|
const types_1 = require("./types");
|
|
33
33
|
const f = ts.factory;
|
|
34
|
-
|
|
34
|
+
const getFieldType = (field, subs) => {
|
|
35
35
|
if (field.repeated) {
|
|
36
|
-
return f.createArrayTypeNode(getScalarFieldType(field, subs));
|
|
36
|
+
return f.createArrayTypeNode((0, exports.getScalarFieldType)(field, subs));
|
|
37
37
|
}
|
|
38
38
|
else if (field.map && field instanceof protobufjs.MapField) {
|
|
39
39
|
return f.createTypeReferenceNode('Partial', [f.createTypeReferenceNode('Record', [
|
|
40
40
|
f.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
|
|
41
|
-
getScalarFieldType(field, subs)
|
|
41
|
+
(0, exports.getScalarFieldType)(field, subs)
|
|
42
42
|
])]);
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
return getScalarFieldType(field, subs);
|
|
45
|
+
return (0, exports.getScalarFieldType)(field, subs);
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
};
|
|
48
48
|
exports.getFieldType = getFieldType;
|
|
49
|
-
|
|
49
|
+
const getScalarFieldType = (field, subs) => {
|
|
50
50
|
var _a;
|
|
51
51
|
(0, assert_1.default)(field.message);
|
|
52
52
|
field.resolve();
|
|
53
53
|
return (0, types_1.types)((_a = field.resolvedType) !== null && _a !== void 0 ? _a : field.type, field.message, subs);
|
|
54
|
-
}
|
|
54
|
+
};
|
|
55
55
|
exports.getScalarFieldType = getScalarFieldType;
|
|
56
56
|
//# sourceMappingURL=field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sourceRoot":"","sources":["../../../src/generator/field.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,oDAA4B;AAC5B,uDAAyC;AACzC,+CAAiC;AAGjC,mCAAgC;AAEhC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"field.js","sourceRoot":"","sources":["../../../src/generator/field.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,oDAA4B;AAC5B,uDAAyC;AACzC,+CAAiC;AAGjC,mCAAgC;AAEhC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;AAEd,MAAM,YAAY,GAAG,CAAC,KAAuB,EAAE,IAAsB,EAAe,EAAE;IAC3F,IAAI,KAAK,CAAC,QAAQ,EAAE;QAClB,OAAO,CAAC,CAAC,mBAAmB,CAAC,IAAA,0BAAkB,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;KAC/D;SAAM,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,YAAY,UAAU,CAAC,QAAQ,EAAE;QAC5D,OAAO,CAAC,CAAC,uBAAuB,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC,QAAQ,EAAE;gBAC/E,CAAC,CAAC,qBAAqB,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC;gBACpD,IAAA,0BAAkB,EAAC,KAAK,EAAE,IAAI,CAAC;aAChC,CAAC,CAAC,CAAC,CAAC;KACN;SAAM;QACL,OAAO,IAAA,0BAAkB,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KACxC;AACH,CAAC,CAAC;AAXW,QAAA,YAAY,gBAWvB;AAEK,MAAM,kBAAkB,GAAG,CAAC,KAAuB,EAAE,IAAsB,EAAe,EAAE;;IACjG,IAAA,gBAAM,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACtB,KAAK,CAAC,OAAO,EAAE,CAAC;IAChB,OAAO,IAAA,aAAK,EAAC,MAAA,KAAK,CAAC,YAAY,mCAAI,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACtE,CAAC,CAAC;AAJW,QAAA,kBAAkB,sBAI7B"}
|
|
@@ -2,7 +2,7 @@ import pb from 'protobufjs';
|
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
3
|
import { ModuleSpecifier } from '../module-specifier';
|
|
4
4
|
import { SubstitutionsMap } from '../parser';
|
|
5
|
-
export declare
|
|
6
|
-
export declare
|
|
7
|
-
export declare
|
|
5
|
+
export declare const createNamespaceSourceFile: (types: pb.ReflectionObject[], substitutions: SubstitutionsMap, outDir: string, namespace: string, substitutionsModule: ModuleSpecifier | undefined, otherNamespaces: string[]) => ts.SourceFile;
|
|
6
|
+
export declare const createIndexSourceFile: (substitutionsModule: ModuleSpecifier | undefined, root: pb.Root, outDirPath: string, namespaces: string[]) => ts.SourceFile;
|
|
7
|
+
export declare const getFileNameForNamespace: (namespace: string) => string;
|
|
8
8
|
//# sourceMappingURL=file-generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-generator.d.ts","sourceRoot":"","sources":["../../../src/generator/file-generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAgB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"file-generator.d.ts","sourceRoot":"","sources":["../../../src/generator/file-generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAgB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAc7C,eAAO,MAAM,yBAAyB,UAAW,GAAG,gBAAgB,EAAE,iBAAiB,gBAAgB,UAAU,MAAM,aAAa,MAAM,uBAAuB,eAAe,GAAG,SAAS,mBAAmB,MAAM,EAAE,kBAkBtN,CAAC;AAEF,eAAO,MAAM,qBAAqB,wBAAyB,eAAe,GAAG,SAAS,QAAQ,GAAG,IAAI,cAAc,MAAM,cAAc,MAAM,EAAE,kBAqB9I,CAAC;AAWF,eAAO,MAAM,uBAAuB,cAAe,MAAM,WAGxD,CAAC"}
|
|
@@ -31,11 +31,9 @@ const declaration_generator_1 = require("./declaration-generator");
|
|
|
31
31
|
const serializer_definition_generator_1 = require("./serializer-definition-generator");
|
|
32
32
|
const service_1 = require("./service");
|
|
33
33
|
const f = ts.factory;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function createNamespaceSourceFile(types, substitutions, outDir, namespace, substitutionsModule, otherNamespaces) {
|
|
38
|
-
const outFile = (0, path_1.join)(outDir, getFileNameForNamespace(namespace));
|
|
34
|
+
const createSubstitutionsImport = (substitutionsModule, context) => substitutionsModule && ts.factory.createImportDeclaration([], [], ts.factory.createImportClause(false, ts.factory.createIdentifier('substitutions'), undefined), ts.factory.createStringLiteral(substitutionsModule.importSpecifier(context)));
|
|
35
|
+
const createNamespaceSourceFile = (types, substitutions, outDir, namespace, substitutionsModule, otherNamespaces) => {
|
|
36
|
+
const outFile = (0, path_1.join)(outDir, (0, exports.getFileNameForNamespace)(namespace));
|
|
39
37
|
const declarations = Array.from((0, declaration_generator_1.createDeclarations)(types, substitutions));
|
|
40
38
|
const substitutionsImport = substitutionsModule && createSubstitutionsImport(substitutionsModule, (0, path_1.dirname)(outFile));
|
|
41
39
|
const otherNamespaceImports = createNamespaceImports(otherNamespaces.filter(ns => ns !== namespace), outDir, (0, path_1.dirname)(outFile));
|
|
@@ -45,9 +43,9 @@ function createNamespaceSourceFile(types, substitutions, outDir, namespace, subs
|
|
|
45
43
|
...otherNamespaceImports,
|
|
46
44
|
...declarations
|
|
47
45
|
], ts.factory.createToken(ts.SyntaxKind.EndOfFileToken), ts.NodeFlags.None);
|
|
48
|
-
}
|
|
46
|
+
};
|
|
49
47
|
exports.createNamespaceSourceFile = createNamespaceSourceFile;
|
|
50
|
-
|
|
48
|
+
const createIndexSourceFile = (substitutionsModule, root, outDirPath, namespaces) => {
|
|
51
49
|
const { imports: schemaImports, exports: schemaExports } = (0, serializer_definition_generator_1.createSerializerDefinition)(substitutionsModule, root, outDirPath);
|
|
52
50
|
const substitutionsImport = substitutionsModule && createSubstitutionsImport(substitutionsModule, outDirPath);
|
|
53
51
|
const otherNamespaceImports = createNamespaceImports(namespaces, outDirPath, outDirPath);
|
|
@@ -59,21 +57,17 @@ function createIndexSourceFile(substitutionsModule, root, outDirPath, namespaces
|
|
|
59
57
|
(0, service_1.createServicesDictionary)(root),
|
|
60
58
|
...schemaExports
|
|
61
59
|
], ts.factory.createToken(ts.SyntaxKind.EndOfFileToken), ts.NodeFlags.None);
|
|
62
|
-
}
|
|
60
|
+
};
|
|
63
61
|
exports.createIndexSourceFile = createIndexSourceFile;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
function getFileNameForNamespace(namespace) {
|
|
62
|
+
const createNamespaceImports = (namespaces, outDirPath, context) => namespaces
|
|
63
|
+
.sort((b, a) => b.localeCompare(a))
|
|
64
|
+
.map(ns => f.createImportDeclaration([], [], f.createImportClause(false, undefined, f.createNamespaceImport(f.createIdentifier((0, namespaces_1.getSafeNamespaceIdentifier)((0, namespaces_1.parseFullyQualifiedName)(ns))))), f.createStringLiteral(module_specifier_1.ModuleSpecifier.resolveFromFilePath((0, exports.getFileNameForNamespace)(ns), outDirPath).importSpecifier(context))));
|
|
65
|
+
const getFileNameForNamespace = (namespace) => {
|
|
70
66
|
const name = (0, namespaces_1.parseFullyQualifiedName)(namespace);
|
|
71
67
|
return `${name.join('/')}.ts`;
|
|
72
|
-
}
|
|
68
|
+
};
|
|
73
69
|
exports.getFileNameForNamespace = getFileNameForNamespace;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
])), f.createStringLiteral(module_specifier_1.CODEC_MODULE.importSpecifier('')));
|
|
78
|
-
}
|
|
70
|
+
const createStreamImport = () => f.createImportDeclaration([], [], f.createImportClause(true, undefined, f.createNamedImports([
|
|
71
|
+
f.createImportSpecifier(false, undefined, f.createIdentifier('Stream'))
|
|
72
|
+
])), f.createStringLiteral(module_specifier_1.CODEC_MODULE.importSpecifier('')));
|
|
79
73
|
//# sourceMappingURL=file-generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-generator.js","sourceRoot":"","sources":["../../../src/generator/file-generator.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;AAEF,+BAAqC;AAErC,+CAAiC;AAEjC,0DAAoE;AAC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AC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;CACxE,CAAC,CAAC,EACH,CAAC,CAAC,mBAAmB,CAAC,+BAAY,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CACxD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as protobufjs from 'protobufjs';
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
3
|
import { SubstitutionsMap } from '../parser';
|
|
4
|
-
export declare
|
|
4
|
+
export declare const createMessageDeclaration: (type: protobufjs.Type, subs: SubstitutionsMap) => ts.InterfaceDeclaration;
|
|
5
5
|
//# sourceMappingURL=message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/generator/message.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAM7C,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/generator/message.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAM7C,eAAO,MAAM,wBAAwB,SAAU,WAAW,IAAI,QAAQ,gBAAgB,4BAyBrF,CAAC"}
|
|
@@ -27,7 +27,7 @@ const ts = __importStar(require("typescript"));
|
|
|
27
27
|
const doc_comment_1 = require("./doc-comment");
|
|
28
28
|
const field_1 = require("./field");
|
|
29
29
|
const f = ts.factory;
|
|
30
|
-
|
|
30
|
+
const createMessageDeclaration = (type, subs) => {
|
|
31
31
|
const declaration = f.createInterfaceDeclaration(undefined, [f.createToken(ts.SyntaxKind.ExportKeyword)], type.name, undefined, undefined, type.fieldsArray.map(field => {
|
|
32
32
|
const signature = f.createPropertySignature(undefined, field.name.includes('.') ? f.createStringLiteral(field.name) : field.name, field.required ? undefined : f.createToken(ts.SyntaxKind.QuestionToken), (0, field_1.getFieldType)(field, subs));
|
|
33
33
|
const docComment = getFieldDocComment(field);
|
|
@@ -37,9 +37,9 @@ function createMessageDeclaration(type, subs) {
|
|
|
37
37
|
return declaration;
|
|
38
38
|
}
|
|
39
39
|
return (0, doc_comment_1.attachDocComment)(declaration, type.comment);
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
41
|
exports.createMessageDeclaration = createMessageDeclaration;
|
|
42
|
-
|
|
42
|
+
const getFieldDocComment = (field) => {
|
|
43
43
|
const sections = [];
|
|
44
44
|
if (field.comment) {
|
|
45
45
|
sections.push(field.comment);
|
|
@@ -53,5 +53,5 @@ function getFieldDocComment(field) {
|
|
|
53
53
|
else {
|
|
54
54
|
return sections.join('\n\n');
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
57
|
//# sourceMappingURL=message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/generator/message.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;AAGF,+CAAiC;AAGjC,+CAAiD;AACjD,mCAAuC;AAEvC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/generator/message.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;AAGF,+CAAiC;AAGjC,+CAAiD;AACjD,mCAAuC;AAEvC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;AAEd,MAAM,wBAAwB,GAAG,CAAC,IAAqB,EAAE,IAAsB,EAAE,EAAE;IACxF,MAAM,WA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KAAK,CAAC,OAAO,EAAE;QACjB,QAAQ,CAAC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACvI;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;SAAM;QACL,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAC9B;AACH,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import protobufjs from 'protobufjs';
|
|
2
3
|
import * as ts from 'typescript';
|
|
3
4
|
import { ModuleSpecifier } from '../module-specifier';
|
|
4
|
-
export declare
|
|
5
|
+
export declare const createSerializerDefinition: (substitutionsModule: ModuleSpecifier | undefined, root: protobufjs.Root, outFileDir: string) => {
|
|
5
6
|
imports: ts.Statement[];
|
|
6
7
|
exports: ts.Statement[];
|
|
7
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer-definition-generator.d.ts","sourceRoot":"","sources":["../../../src/generator/serializer-definition-generator.ts"],"names":[],"mappings":"AAIA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAgB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAKpE,
|
|
1
|
+
{"version":3,"file":"serializer-definition-generator.d.ts","sourceRoot":"","sources":["../../../src/generator/serializer-definition-generator.ts"],"names":[],"mappings":";AAIA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAgB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAKpE,eAAO,MAAM,0BAA0B,wBAAyB,eAAe,GAAG,SAAS,QAAQ,WAAW,IAAI,cAAc,MAAM,KAAG;IAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAC;IAAC,SAAS,GAAG,SAAS,EAAE,CAAA;CAmD1L,CAAC"}
|
|
@@ -27,7 +27,7 @@ const ts = __importStar(require("typescript"));
|
|
|
27
27
|
const module_specifier_1 = require("../module-specifier");
|
|
28
28
|
const protobuf_json_1 = require("../protobuf-json");
|
|
29
29
|
const f = ts.factory;
|
|
30
|
-
|
|
30
|
+
const createSerializerDefinition = (substitutionsModule, root, outFileDir) => {
|
|
31
31
|
const schemaIdentifier = f.createIdentifier('Schema');
|
|
32
32
|
const schemaImport = f.createImportDeclaration([], [], f.createImportClause(false, undefined, f.createNamedImports([
|
|
33
33
|
f.createImportSpecifier(false, undefined, schemaIdentifier)
|
|
@@ -44,6 +44,6 @@ function createSerializerDefinition(substitutionsModule, root, outFileDir) {
|
|
|
44
44
|
imports: [schemaImport],
|
|
45
45
|
exports: [schemaJsonExport, schemaExport]
|
|
46
46
|
};
|
|
47
|
-
}
|
|
47
|
+
};
|
|
48
48
|
exports.createSerializerDefinition = createSerializerDefinition;
|
|
49
49
|
//# sourceMappingURL=serializer-definition-generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer-definition-generator.js","sourceRoot":"","sources":["../../../src/generator/serializer-definition-generator.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;AAGF,+CAAiC;AAEjC,0DAAoE;AACpE,oDAAyD;AAEzD,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"serializer-definition-generator.js","sourceRoot":"","sources":["../../../src/generator/serializer-definition-generator.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B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EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CACvB,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,CAAC,uBAAuB,CAC5C,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EAC5C,CAAC,CAAC,6BAA6B,CAAC;QAC9B,CAAC,CAAC,yBAAyB,CACzB,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAC5B,SAAS,EACT,SAAS,EACT,CAAC,CAAC,oBAAoB,CACpB,CAAC,CAAC,8BAA8B,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC9D,CAAC,CAAC,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC,EAC3E,mBAAmB,CAAC,CAAC,CAAC,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAC/F,CACF;KACF,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CACvB,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,CAAC,YAAY,CAAC;QACvB,OAAO,EAAE,CAAC,gBAAgB,EAAE,YAAY,CAAC;KAC1C,CAAC;AACJ,CAAC,CAAC;AAnDW,QAAA,0BAA0B,8BAmDrC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as protobufjs from 'protobufjs';
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
3
|
import { SubstitutionsMap } from '../parser';
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
4
|
+
export declare const createServiceDeclaration: (type: protobufjs.Service, subs: SubstitutionsMap) => ts.InterfaceDeclaration;
|
|
5
|
+
export declare const createServicesDictionary: (root: protobufjs.NamespaceBase) => ts.InterfaceDeclaration;
|
|
6
6
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/generator/service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAsC7C,
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/generator/service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAsC7C,eAAO,MAAM,wBAAwB,SAAU,WAAW,OAAO,QAAQ,gBAAgB,KAAG,GAAG,oBAsB9F,CAAC;AAaF,eAAO,MAAM,wBAAwB,SAAU,WAAW,aAAa,4BActE,CAAC"}
|
|
@@ -33,21 +33,21 @@ const namespaces_1 = require("../namespaces");
|
|
|
33
33
|
const doc_comment_1 = require("./doc-comment");
|
|
34
34
|
const types_1 = require("./types");
|
|
35
35
|
const f = ts.factory;
|
|
36
|
-
|
|
36
|
+
const getRpcTypes = (method, service, subs) => {
|
|
37
37
|
var _a, _b;
|
|
38
38
|
method.resolve();
|
|
39
39
|
return [
|
|
40
40
|
(0, types_1.types)((_a = method.resolvedRequestType) !== null && _a !== void 0 ? _a : method.requestType, service, subs),
|
|
41
41
|
(0, types_1.types)((_b = method.resolvedResponseType) !== null && _b !== void 0 ? _b : method.responseType, service, subs)
|
|
42
42
|
];
|
|
43
|
-
}
|
|
44
|
-
|
|
43
|
+
};
|
|
44
|
+
const createRpcMethodType = (method, service, subs) => {
|
|
45
45
|
(0, assert_1.default)(!method.requestStream, 'Streaming RPC requests are not supported.');
|
|
46
46
|
const [requestType, responseType] = getRpcTypes(method, service, subs);
|
|
47
47
|
const outputTypeMonad = method.responseStream ? f.createIdentifier('Stream') : f.createIdentifier('Promise');
|
|
48
48
|
return f.createFunctionTypeNode(undefined, [f.createParameterDeclaration(undefined, undefined, undefined, 'request', undefined, requestType)], f.createTypeReferenceNode(outputTypeMonad, [responseType]));
|
|
49
|
-
}
|
|
50
|
-
|
|
49
|
+
};
|
|
50
|
+
const createServiceDeclaration = (type, subs) => {
|
|
51
51
|
const declaration = f.createInterfaceDeclaration(undefined, [f.createToken(ts.SyntaxKind.ExportKeyword)], type.name, undefined, undefined, type.methodsArray
|
|
52
52
|
.filter(m => !m.requestStream)
|
|
53
53
|
.map(method => {
|
|
@@ -55,7 +55,7 @@ function createServiceDeclaration(type, subs) {
|
|
|
55
55
|
return method.comment ? (0, doc_comment_1.attachDocComment)(sig, method.comment) : sig;
|
|
56
56
|
}));
|
|
57
57
|
return type.comment ? (0, doc_comment_1.attachDocComment)(declaration, type.comment) : declaration;
|
|
58
|
-
}
|
|
58
|
+
};
|
|
59
59
|
exports.createServiceDeclaration = createServiceDeclaration;
|
|
60
60
|
function* getServices(root) {
|
|
61
61
|
for (const obj of root.nestedArray) {
|
|
@@ -68,13 +68,9 @@ function* getServices(root) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.map(type => f.createPropertySignature(undefined, f.createStringLiteral((0, namespaces_1.normalizeFullyQualifiedName)(type.fullName)), undefined, (0, types_1.getTypeReference)(type))));
|
|
75
|
-
}
|
|
71
|
+
const createServicesDictionary = (root) => f.createInterfaceDeclaration(undefined, [f.createToken(ts.SyntaxKind.ExportKeyword)], 'SERVICES', undefined, undefined, Array.from(getServices(root))
|
|
72
|
+
.sort((b, a) => b.fullName.localeCompare(a.fullName))
|
|
73
|
+
.map(type => f.createPropertySignature(undefined, f.createStringLiteral((0, namespaces_1.normalizeFullyQualifiedName)(type.fullName)), undefined, (0, types_1.getTypeReference)(type))));
|
|
76
74
|
exports.createServicesDictionary = createServicesDictionary;
|
|
77
|
-
|
|
78
|
-
return name[0].toLocaleLowerCase() + name.substring(1);
|
|
79
|
-
}
|
|
75
|
+
const mapRpcMethodName = (name) => name[0].toLocaleLowerCase() + name.substring(1);
|
|
80
76
|
//# sourceMappingURL=service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/generator/service.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,oDAA4B;AAC5B,uDAAyC;AACzC,+CAAiC;AAEjC,8CAA4D;AAE5D,+CAAiD;AACjD,mCAAkD;AAElD,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;AAErB,
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/generator/service.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,oDAA4B;AAC5B,uDAAyC;AACzC,+CAAiC;AAEjC,8CAA4D;AAE5D,+CAAiD;AACjD,mCAAkD;AAElD,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;AAErB,MAAM,WAAW,GAAG,CAAC,MAAyB,EAAE,OAA2B,EAAE,IAAsB,EAA8B,EAAE;;IACjI,MAAM,CAAC,OAAO,EAAE,CAAC;IACjB,OAAO;QACL,IAAA,aAAK,EAAC,MAAA,MAAM,CAAC,mBAAmB,mCAAI,MAAM,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC;QACtE,IAAA,aAAK,EAAC,MAAA,MAAM,CAAC,oBAAoB,mCAAI,MAAM,CAAC,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC;KACzE,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,MAAyB,EAAE,OAA2B,EAAE,IAAsB,EAAE,EAAE;IAC7G,IAAA,gBAAM,EAAC,CAAC,MAAM,CAAC,aAAa,EAAE,2CAA2C,CAAC,CAAC;IAE3E,MAAM,CA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E,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@ import * as protobufjs from 'protobufjs';
|
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
3
|
import { SubstitutionsMap } from '../parser';
|
|
4
4
|
declare type PbType = protobufjs.Enum | protobufjs.Type | string;
|
|
5
|
-
export declare
|
|
6
|
-
export declare
|
|
5
|
+
export declare const types: (type: PbType, containingObject: protobufjs.ReflectionObject, subs: SubstitutionsMap) => ts.TypeNode;
|
|
6
|
+
export declare const getTypeReference: (to: protobufjs.ReflectionObject, from?: protobufjs.ReflectionObject | undefined) => ts.TypeReferenceNode;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/generator/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAUjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/generator/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAUjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAoD7C,aAAK,MAAM,GAAG,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,GAAG,MAAM,CAAA;AAExD,eAAO,MAAM,KAAK,SAAU,MAAM,oBAAoB,WAAW,gBAAgB,QAAQ,gBAAgB,gBAUxG,CAAC;AAEF,eAAO,MAAM,gBAAgB,OAAQ,WAAW,gBAAgB,yEAW/D,CAAC"}
|
|
@@ -26,10 +26,8 @@ exports.getTypeReference = exports.types = void 0;
|
|
|
26
26
|
const ts = __importStar(require("typescript"));
|
|
27
27
|
const namespaces_1 = require("../namespaces");
|
|
28
28
|
const f = ts.factory;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
function getPrimitiveType(type) {
|
|
29
|
+
const createSubstitutionsReference = (type) => f.createTypeReferenceNode(f.createIdentifier('ReturnType'), [f.createIndexedAccessTypeNode(f.createIndexedAccessTypeNode(f.createTypeQueryNode(f.createIdentifier('substitutions')), f.createLiteralTypeNode(f.createStringLiteral(type))), f.createLiteralTypeNode(f.createStringLiteral('decode')))]);
|
|
30
|
+
const getPrimitiveType = (type) => {
|
|
33
31
|
switch (type) {
|
|
34
32
|
case 'double':
|
|
35
33
|
return f.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword);
|
|
@@ -64,8 +62,8 @@ function getPrimitiveType(type) {
|
|
|
64
62
|
default:
|
|
65
63
|
return f.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword);
|
|
66
64
|
}
|
|
67
|
-
}
|
|
68
|
-
|
|
65
|
+
};
|
|
66
|
+
const types = (type, containingObject, subs) => {
|
|
69
67
|
if (typeof type === 'string') {
|
|
70
68
|
return getPrimitiveType(type);
|
|
71
69
|
}
|
|
@@ -76,11 +74,11 @@ function types(type, containingObject, subs) {
|
|
|
76
74
|
return createSubstitutionsReference(type.fullName.slice(1));
|
|
77
75
|
}
|
|
78
76
|
else {
|
|
79
|
-
return getTypeReference(type, containingObject);
|
|
77
|
+
return (0, exports.getTypeReference)(type, containingObject);
|
|
80
78
|
}
|
|
81
|
-
}
|
|
79
|
+
};
|
|
82
80
|
exports.types = types;
|
|
83
|
-
|
|
81
|
+
const getTypeReference = (to, from) => {
|
|
84
82
|
const toNamespace = (0, namespaces_1.getNamespaceName)(to);
|
|
85
83
|
const fromNamespace = from && (0, namespaces_1.getNamespaceName)(from);
|
|
86
84
|
if (fromNamespace && (0, namespaces_1.namesEqual)(toNamespace, fromNamespace)) {
|
|
@@ -91,6 +89,6 @@ function getTypeReference(to, from) {
|
|
|
91
89
|
const name = [(0, namespaces_1.getSafeNamespaceIdentifier)(toNamespace), ...(0, namespaces_1.getFullNestedTypeName)(to)];
|
|
92
90
|
return f.createTypeReferenceNode((0, namespaces_1.convertNameToIdentifier)(name));
|
|
93
91
|
}
|
|
94
|
-
}
|
|
92
|
+
};
|
|
95
93
|
exports.getTypeReference = getTypeReference;
|
|
96
94
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/generator/types.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;AAGF,+CAAiC;AAEjC,8CAOuB;AAGvB,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;AAErB,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/generator/types.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;AAGF,+CAAiC;AAEjC,8CAOuB;AAGvB,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;AAErB,MAAM,4BAA4B,GAAG,CAAC,IAAY,EAAe,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAC3F,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAChC,CAAC,CAAC,CAAC,2BAA2B,CAC5B,CAAC,CAAC,2BAA2B,CAC3B,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,EAC1D,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CACrD,EACD,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CACzD,CAAC,CACH,CAAC;AAEF,MAAM,gBA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