protoc-gen-pothos 0.6.0 → 0.6.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.
- package/bin/protoc-gen-pothos.cjs +3 -0
- package/dist/{plugin.js → protoc-gen-pothos.cjs} +27 -42
- package/dist/protoc-gen-pothos.cjs.map +1 -0
- package/dist/protoc-gen-pothos.js +158 -187
- package/dist/protoc-gen-pothos.js.map +1 -1
- package/dist/src/dslgen/index.d.ts +1 -1
- package/dist/src/dslgen/index.d.ts.map +1 -1
- package/dist/src/dslgen/printers/enumType.d.ts +3 -2
- package/dist/src/dslgen/printers/enumType.d.ts.map +1 -1
- package/dist/src/dslgen/printers/field.d.ts +1 -1
- package/dist/src/dslgen/printers/field.d.ts.map +1 -1
- package/dist/src/dslgen/printers/fieldResolver/enumFieldResolver.d.ts.map +1 -1
- package/dist/src/dslgen/printers/index.d.ts +1 -1
- package/dist/src/dslgen/printers/index.d.ts.map +1 -1
- package/dist/src/dslgen/printers/inputObjectType.d.ts +3 -2
- package/dist/src/dslgen/printers/inputObjectType.d.ts.map +1 -1
- package/dist/src/dslgen/printers/objectType.d.ts +3 -2
- package/dist/src/dslgen/printers/objectType.d.ts.map +1 -1
- package/dist/src/dslgen/printers/oneofUnionType.d.ts +3 -2
- package/dist/src/dslgen/printers/oneofUnionType.d.ts.map +1 -1
- package/dist/src/plugin.d.ts.map +1 -1
- package/dist/src/printer.d.ts +3 -7
- package/dist/src/printer.d.ts.map +1 -1
- package/package.json +25 -20
- package/src/__snapshots__/plugin.test.ts.snap +3483 -1144
- package/src/dslgen/index.ts +1 -1
- package/src/dslgen/printers/enumType.ts +2 -2
- package/src/dslgen/printers/field.ts +4 -4
- package/src/dslgen/printers/fieldResolver/enumFieldResolver.ts +1 -2
- package/src/dslgen/printers/index.ts +5 -5
- package/src/dslgen/printers/inputObjectType.ts +4 -4
- package/src/dslgen/printers/objectType.ts +3 -4
- package/src/dslgen/printers/oneofUnionType.ts +8 -3
- package/src/plugin.ts +6 -5
- package/src/printer.ts +8 -8
- package/src/protoc-gen-pothos.ts +1 -1
- package/bin/protoc-gen-pothos +0 -3
- package/dist/dslgen/index.js +0 -542
- package/dist/dslgen/index.js.map +0 -1
- package/dist/dslgen/index.mjs +0 -507
- package/dist/dslgen/index.mjs.map +0 -1
- package/dist/dslgen/printers/enumType.js +0 -82
- package/dist/dslgen/printers/enumType.js.map +0 -1
- package/dist/dslgen/printers/enumType.mjs +0 -49
- package/dist/dslgen/printers/enumType.mjs.map +0 -1
- package/dist/dslgen/printers/field.js +0 -287
- package/dist/dslgen/printers/field.js.map +0 -1
- package/dist/dslgen/printers/field.mjs +0 -252
- package/dist/dslgen/printers/field.mjs.map +0 -1
- package/dist/dslgen/printers/fieldResolver/enumFieldResolver.js +0 -89
- package/dist/dslgen/printers/fieldResolver/enumFieldResolver.js.map +0 -1
- package/dist/dslgen/printers/fieldResolver/enumFieldResolver.mjs +0 -66
- package/dist/dslgen/printers/fieldResolver/enumFieldResolver.mjs.map +0 -1
- package/dist/dslgen/printers/fieldResolver/nonNullResolver.js +0 -38
- package/dist/dslgen/printers/fieldResolver/nonNullResolver.js.map +0 -1
- package/dist/dslgen/printers/fieldResolver/nonNullResolver.mjs +0 -15
- package/dist/dslgen/printers/fieldResolver/nonNullResolver.mjs.map +0 -1
- package/dist/dslgen/printers/fieldResolver/oneofUnionResolver.js +0 -119
- package/dist/dslgen/printers/fieldResolver/oneofUnionResolver.js.map +0 -1
- package/dist/dslgen/printers/fieldResolver/oneofUnionResolver.mjs +0 -96
- package/dist/dslgen/printers/fieldResolver/oneofUnionResolver.mjs.map +0 -1
- package/dist/dslgen/printers/index.js +0 -540
- package/dist/dslgen/printers/index.js.map +0 -1
- package/dist/dslgen/printers/index.mjs +0 -507
- package/dist/dslgen/printers/index.mjs.map +0 -1
- package/dist/dslgen/printers/inputObjectType.js +0 -413
- package/dist/dslgen/printers/inputObjectType.js.map +0 -1
- package/dist/dslgen/printers/inputObjectType.mjs +0 -380
- package/dist/dslgen/printers/inputObjectType.mjs.map +0 -1
- package/dist/dslgen/printers/objectType.js +0 -350
- package/dist/dslgen/printers/objectType.js.map +0 -1
- package/dist/dslgen/printers/objectType.mjs +0 -317
- package/dist/dslgen/printers/objectType.mjs.map +0 -1
- package/dist/dslgen/printers/oneofUnionType.js +0 -75
- package/dist/dslgen/printers/oneofUnionType.js.map +0 -1
- package/dist/dslgen/printers/oneofUnionType.mjs +0 -42
- package/dist/dslgen/printers/oneofUnionType.mjs.map +0 -1
- package/dist/dslgen/printers/util.js +0 -93
- package/dist/dslgen/printers/util.js.map +0 -1
- package/dist/dslgen/printers/util.mjs +0 -55
- package/dist/dslgen/printers/util.mjs.map +0 -1
- package/dist/plugin.js.map +0 -1
- package/dist/plugin.mjs +0 -575
- package/dist/plugin.mjs.map +0 -1
- package/dist/printer.js +0 -585
- package/dist/printer.js.map +0 -1
- package/dist/printer.mjs +0 -552
- package/dist/printer.mjs.map +0 -1
- package/dist/protoc-gen-pothos.mjs +0 -578
- package/dist/protoc-gen-pothos.mjs.map +0 -1
|
@@ -6,10 +6,6 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
9
|
var __copyProps = (to, from, except, desc) => {
|
|
14
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
11
|
for (let key of __getOwnPropNames(from))
|
|
@@ -26,19 +22,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
22
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
23
|
mod
|
|
28
24
|
));
|
|
29
|
-
|
|
25
|
+
|
|
26
|
+
// src/protoc-gen-pothos.ts
|
|
27
|
+
var import_protoplugin2 = require("@bufbuild/protoplugin");
|
|
30
28
|
|
|
31
29
|
// src/plugin.ts
|
|
32
|
-
var plugin_exports = {};
|
|
33
|
-
__export(plugin_exports, {
|
|
34
|
-
protocGenPothos: () => protocGenPothos
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(plugin_exports);
|
|
37
30
|
var import_protoplugin = require("@bufbuild/protoplugin");
|
|
38
31
|
var import_protoc_plugin_helpers = require("@proto-graphql/protoc-plugin-helpers");
|
|
39
32
|
|
|
40
33
|
// package.json
|
|
41
|
-
var version = "0.6.
|
|
34
|
+
var version = "0.6.2";
|
|
42
35
|
|
|
43
36
|
// src/printer.ts
|
|
44
37
|
var import_codegen_core10 = require("@proto-graphql/codegen-core");
|
|
@@ -51,7 +44,7 @@ var import_codegen_core2 = require("@proto-graphql/codegen-core");
|
|
|
51
44
|
var import_ts_poet2 = require("ts-poet");
|
|
52
45
|
|
|
53
46
|
// src/dslgen/printers/util.ts
|
|
54
|
-
var path = __toESM(require("path"));
|
|
47
|
+
var path = __toESM(require("path"), 1);
|
|
55
48
|
var import_codegen_core = require("@proto-graphql/codegen-core");
|
|
56
49
|
var import_ts_poet = require("ts-poet");
|
|
57
50
|
function pothosRef(type) {
|
|
@@ -72,8 +65,7 @@ function shapeTypeName(type) {
|
|
|
72
65
|
__name(shapeTypeName, "shapeTypeName");
|
|
73
66
|
function fieldTypeRef(field, opts) {
|
|
74
67
|
const importPath = (0, import_codegen_core.generatedGraphQLTypeImportPath)(field, opts);
|
|
75
|
-
if (importPath == null)
|
|
76
|
-
return pothosRef(field.type);
|
|
68
|
+
if (importPath == null) return pothosRef(field.type);
|
|
77
69
|
const imported = (0, import_ts_poet.imp)(`IMPORTED_PLACEHOLDER@${importPath}`);
|
|
78
70
|
imported.symbol = pothosRefName(field.type);
|
|
79
71
|
return import_ts_poet.code`${imported}`;
|
|
@@ -81,8 +73,7 @@ function fieldTypeRef(field, opts) {
|
|
|
81
73
|
__name(fieldTypeRef, "fieldTypeRef");
|
|
82
74
|
function fieldTypeShape(field, opts) {
|
|
83
75
|
const importPath = (0, import_codegen_core.generatedGraphQLTypeImportPath)(field, opts);
|
|
84
|
-
if (importPath == null)
|
|
85
|
-
return shapeType(field.type);
|
|
76
|
+
if (importPath == null) return shapeType(field.type);
|
|
86
77
|
const imported = (0, import_ts_poet.imp)(`IMPORTED_PLACEHOLDER@${importPath}`);
|
|
87
78
|
imported.symbol = shapeTypeName(field.type);
|
|
88
79
|
return import_ts_poet.code`${imported}`;
|
|
@@ -124,7 +115,6 @@ var import_codegen_core5 = require("@proto-graphql/codegen-core");
|
|
|
124
115
|
var import_ts_poet6 = require("ts-poet");
|
|
125
116
|
|
|
126
117
|
// src/dslgen/printers/fieldResolver/enumFieldResolver.ts
|
|
127
|
-
var import_ecmascript = require("@bufbuild/protoplugin/ecmascript");
|
|
128
118
|
var import_codegen_core3 = require("@proto-graphql/codegen-core");
|
|
129
119
|
var import_ts_poet3 = require("ts-poet");
|
|
130
120
|
function createEnumResolverCode(valueExpr, field, opts) {
|
|
@@ -139,8 +129,7 @@ function createEnumResolverCode(valueExpr, field, opts) {
|
|
|
139
129
|
`);
|
|
140
130
|
}
|
|
141
131
|
for (const ev of field.type.valuesWithIgnored) {
|
|
142
|
-
if (!ev.isIgnored())
|
|
143
|
-
continue;
|
|
132
|
+
if (!ev.isIgnored()) continue;
|
|
144
133
|
chunks.push(import_ts_poet3.code`
|
|
145
134
|
if (${valueExpr2} === ${(0, import_codegen_core3.protoType)(field.type.proto, opts)}.${enumValueJsName(field.type, ev, opts)}) {
|
|
146
135
|
throw new Error("${ev.name} is ignored in GraphQL schema");
|
|
@@ -170,7 +159,7 @@ function enumValueJsName(et, ev, opts) {
|
|
|
170
159
|
case "ts-proto":
|
|
171
160
|
return ev.proto.name;
|
|
172
161
|
case "protobuf-es": {
|
|
173
|
-
return
|
|
162
|
+
return ev.proto.localName;
|
|
174
163
|
}
|
|
175
164
|
case "protobufjs":
|
|
176
165
|
case "google-protobuf":
|
|
@@ -351,8 +340,7 @@ function createInputObjectTypeCode(type, registry, opts) {
|
|
|
351
340
|
let typeNode;
|
|
352
341
|
if (f.type instanceof import_codegen_core6.InputObjectType) {
|
|
353
342
|
typeNode = import_ts_poet7.code`${fieldTypeShape(f, opts)}`;
|
|
354
|
-
if (f.isList())
|
|
355
|
-
typeNode = import_ts_poet7.code`Array<${typeNode}>`;
|
|
343
|
+
if (f.isList()) typeNode = import_ts_poet7.code`Array<${typeNode}>`;
|
|
356
344
|
} else {
|
|
357
345
|
typeNode = import_ts_poet7.code`${(0, import_codegen_core6.protoType)(type.proto, opts)}[${(0, import_ts_poet7.literalOf)((0, import_codegen_core6.tsFieldName)(f.proto, opts))}]`;
|
|
358
346
|
}
|
|
@@ -385,8 +373,7 @@ __name(createInputObjectTypeCode, "createInputObjectTypeCode");
|
|
|
385
373
|
function createToProtoFuncCode(type, opts) {
|
|
386
374
|
const oneofFields = {};
|
|
387
375
|
for (const f of type.fields) {
|
|
388
|
-
if (f.proto.oneof == null)
|
|
389
|
-
continue;
|
|
376
|
+
if (f.proto.oneof == null) continue;
|
|
390
377
|
if (!(f.type instanceof import_codegen_core6.InputObjectType)) {
|
|
391
378
|
throw new Error("Oneof fields must be of message");
|
|
392
379
|
}
|
|
@@ -401,17 +388,17 @@ function createToProtoFuncCode(type, opts) {
|
|
|
401
388
|
${type.fields.filter((f) => f.proto.oneof == null).map((f) => {
|
|
402
389
|
switch (true) {
|
|
403
390
|
case f.type instanceof import_codegen_core6.InputObjectType: {
|
|
404
|
-
const
|
|
391
|
+
const localName = (0, import_codegen_core6.tsFieldName)(f.proto, opts);
|
|
405
392
|
const toProtoFunc = fieldToProtoFunc(f, opts);
|
|
406
393
|
if (f.isList()) {
|
|
407
|
-
return import_ts_poet7.code`${
|
|
394
|
+
return import_ts_poet7.code`${localName}: input?.${f.name}?.map(v => ${toProtoFunc}(v)),`;
|
|
408
395
|
}
|
|
409
|
-
return import_ts_poet7.code`${
|
|
396
|
+
return import_ts_poet7.code`${localName}: input?.${f.name} ? ${toProtoFunc}(input.${f.name}) : undefined,`;
|
|
410
397
|
}
|
|
411
398
|
case f.type instanceof import_codegen_core6.ScalarType:
|
|
412
399
|
case f.type instanceof import_codegen_core6.EnumType: {
|
|
413
|
-
const
|
|
414
|
-
return import_ts_poet7.code`${
|
|
400
|
+
const localName = (0, import_codegen_core6.tsFieldName)(f.proto, opts);
|
|
401
|
+
return import_ts_poet7.code`${localName}: input?.${f.name} ?? undefined,`;
|
|
415
402
|
}
|
|
416
403
|
default: {
|
|
417
404
|
f.type;
|
|
@@ -437,8 +424,7 @@ function toProtoFuncName(type) {
|
|
|
437
424
|
__name(toProtoFuncName, "toProtoFuncName");
|
|
438
425
|
function fieldToProtoFunc(field, opts) {
|
|
439
426
|
const importPath = (0, import_codegen_core6.generatedGraphQLTypeImportPath)(field, opts);
|
|
440
|
-
if (importPath == null)
|
|
441
|
-
return import_ts_poet7.code`${toProtoFuncName(field.type)}`;
|
|
427
|
+
if (importPath == null) return import_ts_poet7.code`${toProtoFuncName(field.type)}`;
|
|
442
428
|
const imported = (0, import_ts_poet7.imp)(`IMPORTED_PLACEHOLDER@${importPath}`);
|
|
443
429
|
imported.symbol = toProtoFuncName(field.type);
|
|
444
430
|
return import_ts_poet7.code`${imported}`;
|
|
@@ -508,7 +494,7 @@ var import_codegen_core8 = require("@proto-graphql/codegen-core");
|
|
|
508
494
|
var import_ts_poet9 = require("ts-poet");
|
|
509
495
|
function createOneofUnionTypeCode(type, registry, opts) {
|
|
510
496
|
const typeOpts = {
|
|
511
|
-
types: type.fields.map((f) =>
|
|
497
|
+
types: type.fields.map((f) => fieldTypeRef(f, opts)),
|
|
512
498
|
description: type.description,
|
|
513
499
|
extensions: (0, import_codegen_core8.protobufGraphQLExtensions)(type, registry)
|
|
514
500
|
};
|
|
@@ -549,7 +535,8 @@ var allowedProtobufs = [
|
|
|
549
535
|
"ts-proto",
|
|
550
536
|
"protobuf-es"
|
|
551
537
|
];
|
|
552
|
-
function generateFiles(schema, file
|
|
538
|
+
function generateFiles(schema, file) {
|
|
539
|
+
const opts = schema.options;
|
|
553
540
|
if (!allowedProtobufs.includes(opts.printer.protobuf)) {
|
|
554
541
|
opts.printer.protobuf = "ts-proto";
|
|
555
542
|
}
|
|
@@ -594,15 +581,13 @@ var protocGenPothos = (0, import_protoplugin.createEcmaScriptPlugin)({
|
|
|
594
581
|
generateFiles,
|
|
595
582
|
dsl: "pothos"
|
|
596
583
|
}),
|
|
597
|
-
|
|
598
|
-
},
|
|
584
|
+
parseOptions: import_protoc_plugin_helpers.parsePothosOptions,
|
|
599
585
|
// NOTE: force `target=ts`
|
|
600
|
-
transpile: (files) => {
|
|
586
|
+
transpile: /* @__PURE__ */ __name((files) => {
|
|
601
587
|
return files;
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
605
|
-
0 && (module.exports = {
|
|
606
|
-
protocGenPothos
|
|
588
|
+
}, "transpile")
|
|
607
589
|
});
|
|
608
|
-
|
|
590
|
+
|
|
591
|
+
// src/protoc-gen-pothos.ts
|
|
592
|
+
(0, import_protoplugin2.runNodeJs)(protocGenPothos);
|
|
593
|
+
//# sourceMappingURL=protoc-gen-pothos.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/protoc-gen-pothos.ts","../src/plugin.ts","../package.json","../src/printer.ts","../src/dslgen/printers/index.ts","../src/dslgen/printers/enumType.ts","../src/dslgen/printers/util.ts","../src/dslgen/printers/inputObjectType.ts","../src/dslgen/printers/field.ts","../src/dslgen/printers/fieldResolver/enumFieldResolver.ts","../src/dslgen/printers/fieldResolver/nonNullResolver.ts","../src/dslgen/printers/fieldResolver/oneofUnionResolver.ts","../src/dslgen/printers/objectType.ts","../src/dslgen/printers/oneofUnionType.ts"],"sourcesContent":["import { runNodeJs } from \"@bufbuild/protoplugin\";\n\nimport { protocGenPothos } from \"./plugin.js\";\n\nrunNodeJs(protocGenPothos);\n","import { createEcmaScriptPlugin } from \"@bufbuild/protoplugin\";\nimport {\n createTsGenerator,\n parsePothosOptions,\n} from \"@proto-graphql/protoc-plugin-helpers\";\n\nimport { version } from \"../package.json\";\nimport { generateFiles } from \"./printer.js\";\n\nexport const protocGenPothos = createEcmaScriptPlugin({\n name: \"protoc-gen-pothos\",\n version: `v${version}`,\n generateTs: createTsGenerator({\n generateFiles,\n dsl: \"pothos\",\n }),\n parseOptions: parsePothosOptions,\n // NOTE: force `target=ts`\n transpile: (files) => {\n return files;\n },\n});\n","{\n \"name\": \"protoc-gen-pothos\",\n \"version\": \"0.6.2\",\n \"description\": \"Generate DSL for Pothos GraphQL from Protocol Buffers IDL\",\n \"keywords\": [\n \"graphql\",\n \"grpc\",\n \"pothos\",\n \"protobuf\",\n \"typescript\"\n ],\n \"bin\": {\n \"protoc-gen-pothos\": \"./bin/protoc-gen-pothos.cjs\"\n },\n \"repository\": \"git@github.com:proto-graphql/proto-graphql-js.git\",\n \"author\": \"izumin5210 <m@izum.in>\",\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.cjs\"\n }\n }\n },\n \"files\": [\n \"bin/\",\n \"src/\",\n \"dist/\",\n \"!src/**/*.test.ts\",\n \"!src/**/__tests__/\"\n ],\n \"sideEffects\": false,\n \"private\": false,\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"engines\": {\n \"node\": \">= 14.0.0\"\n },\n \"dependencies\": {\n \"@bufbuild/protobuf\": \"catalog:\",\n \"@bufbuild/protoplugin\": \"catalog:\",\n \"@proto-graphql/codegen-core\": \"workspace:*\",\n \"@proto-graphql/proto-descriptors\": \"workspace:*\",\n \"@proto-graphql/protoc-plugin-helpers\": \"workspace:*\",\n \"ts-poet\": \"catalog:\"\n },\n \"devDependencies\": {\n \"@proto-graphql/testapis-proto\": \"workspace:*\",\n \"@proto-graphql/tsconfig\": \"workspace:*\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"test\": \"vitest run --passWithNoTests\"\n }\n}\n","import type { DescFile, Registry } from \"@bufbuild/protobuf\";\nimport type { Schema } from \"@bufbuild/protoplugin\";\nimport {\n collectTypesFromFile,\n createRegistryFromSchema,\n filename,\n filenameFromProtoFile,\n printCodes,\n} from \"@proto-graphql/codegen-core\";\nimport type { Options } from \"@proto-graphql/protoc-plugin-helpers\";\nimport type { Code } from \"ts-poet\";\n\nimport { createTypeDslCodes } from \"./dslgen/index.js\";\nimport type { PothosPrinterOptions } from \"./dslgen/printers/util.js\";\n\nconst allowedProtobufs = [\"ts-proto\", \"protobuf-es\"];\n\nexport function generateFiles(\n schema: Schema<Options<\"pothos\">>,\n file: DescFile,\n): void {\n const opts = schema.options;\n\n if (!allowedProtobufs.includes(opts.printer.protobuf)) {\n opts.printer.protobuf = \"ts-proto\"; // default\n }\n\n const registry = createRegistryFromSchema(schema);\n const types = collectTypesFromFile(file, opts.type, schema.allFiles);\n\n switch (opts.printer.fileLayout) {\n case \"proto_file\": {\n const f = schema.generateFile(filenameFromProtoFile(file, opts.printer));\n\n const code = printCodes(\n createCodes(types, registry, opts.printer),\n \"protoc-gen-pothos\",\n file,\n );\n f.print(code.trimEnd());\n break;\n }\n case \"graphql_type\": {\n for (const t of types) {\n const f = schema.generateFile(filename(t, opts.printer));\n const code = printCodes(\n createCodes([t], registry, opts.printer),\n \"protoc-gen-pothos\",\n file,\n );\n f.print(code.trimEnd());\n }\n break;\n }\n /* istanbul ignore next */\n default: {\n const _exhaustiveCheck: never = opts.printer.fileLayout;\n throw \"unreachable\";\n }\n }\n}\n\nfunction createCodes(\n types: ReturnType<typeof collectTypesFromFile>,\n registry: Registry,\n opts: PothosPrinterOptions,\n): Code[] {\n return [...createTypeDslCodes(types, registry, opts)];\n}\n","import type { createRegistry } from \"@bufbuild/protobuf\";\nimport {\n EnumType,\n InputObjectType,\n ObjectType,\n OneofUnionType,\n SquashedOneofUnionType,\n} from \"@proto-graphql/codegen-core\";\nimport type { Code } from \"ts-poet\";\n\nimport { createEnumTypeCode } from \"./enumType.js\";\nimport { createInputObjectTypeCode } from \"./inputObjectType.js\";\nimport { createObjectTypeCode } from \"./objectType.js\";\nimport { createOneofUnionTypeCode } from \"./oneofUnionType.js\";\nimport type { PothosPrinterOptions } from \"./util.js\";\n\nexport function createTypeDslCodes(\n types: (\n | ObjectType\n | InputObjectType\n | EnumType\n | OneofUnionType\n | SquashedOneofUnionType\n )[],\n registry: ReturnType<typeof createRegistry>,\n opts: PothosPrinterOptions,\n): Code[] {\n return types.flatMap((type) => {\n if (type instanceof ObjectType) {\n return createObjectTypeCode(type, registry, opts);\n }\n if (type instanceof InputObjectType) {\n return createInputObjectTypeCode(type, registry, opts);\n }\n if (type instanceof EnumType) {\n return [createEnumTypeCode(type, registry, opts)];\n }\n if (\n type instanceof OneofUnionType ||\n type instanceof SquashedOneofUnionType\n ) {\n return [createOneofUnionTypeCode(type, registry, opts)];\n }\n\n const _exhaustiveCheck: never = type;\n throw \"unreachable\";\n });\n}\n","import type { Registry } from \"@bufbuild/protobuf\";\nimport {\n type EnumType,\n compact,\n protoType,\n protobufGraphQLExtensions,\n} from \"@proto-graphql/codegen-core\";\nimport { type Code, code, imp, joinCode, literalOf } from \"ts-poet\";\n\nimport { type PothosPrinterOptions, pothosBuilder, pothosRef } from \"./util.js\";\n\n/**\n * @example\n * ```ts\n * export cosnt Hello$Ref: EnumRef<Hello, Hello> = builder.enumType(\"Hello\", {\n * values: [\n * // ...\n * ],\n * // ...\n * })\n * ```\n */\nexport function createEnumTypeCode(\n type: EnumType,\n registry: Registry,\n opts: PothosPrinterOptions,\n): Code {\n const typeOpts = {\n description: type.description,\n values: code`{${joinCode(\n type.values\n .filter((v) => !v.isIgnored() && !v.isUnespecified())\n .map(\n (ev) =>\n code`${ev.name}: ${literalOf(\n compact({\n description: ev.description,\n deprecationReason: ev.deprecationReason,\n value: ev.number,\n extensions: protobufGraphQLExtensions(ev, registry),\n }),\n )},`,\n ),\n )}} as const`,\n extensions: protobufGraphQLExtensions(type, registry),\n };\n\n const protoTypeExpr = protoType(type.proto, opts);\n // EnumRef<Hello, Hello>\n const refTypeExpr = code`${imp(\n \"EnumRef@@pothos/core\",\n )}<${protoTypeExpr}, ${protoTypeExpr}>`;\n\n return code`\n export const ${pothosRef(type)}: ${refTypeExpr} =\n ${pothosBuilder(type, opts)}.enumType(${literalOf(\n type.typeName,\n )}, ${literalOf(compact(typeOpts))});\n `;\n}\n","import * as path from \"node:path\";\n\nimport {\n type EnumType,\n type InputObjectField,\n type InputObjectType,\n type InterfaceType,\n type ObjectField,\n type ObjectOneofField,\n type ObjectType,\n type OneofUnionType,\n type PrinterOptions,\n type SquashedOneofUnionType,\n filename,\n generatedGraphQLTypeImportPath,\n} from \"@proto-graphql/codegen-core\";\nimport { type Code, code, imp } from \"ts-poet\";\n\nexport type PothosPrinterOptions = Extract<PrinterOptions, { dsl: \"pothos\" }>;\n\nexport function pothosRef(\n type:\n | ObjectType\n | InputObjectType\n | EnumType\n | OneofUnionType\n | SquashedOneofUnionType\n | InterfaceType,\n): Code {\n return code`${pothosRefName(type)}`;\n}\n\nfunction pothosRefName(\n type:\n | ObjectType\n | InputObjectType\n | EnumType\n | OneofUnionType\n | SquashedOneofUnionType\n | InterfaceType,\n): string {\n return `${type.typeName}$Ref`;\n}\n\nexport function shapeType(type: InputObjectType): Code {\n return code`${shapeTypeName(type)}`;\n}\n\nexport function shapeTypeName(type: InputObjectType): string {\n return `${type.typeName}$Shape`;\n}\n\nexport function fieldTypeRef(\n field:\n | ObjectField<\n ObjectType | EnumType | InterfaceType | SquashedOneofUnionType\n >\n | InputObjectField<InputObjectType | EnumType>\n | ObjectOneofField,\n opts: PothosPrinterOptions,\n): Code {\n const importPath = generatedGraphQLTypeImportPath(field, opts);\n if (importPath == null) return pothosRef(field.type);\n\n const imported = imp(`IMPORTED_PLACEHOLDER@${importPath}`);\n imported.symbol = pothosRefName(field.type); // NOTE: Workaround for ts-poet not recognizing \"$\" as an identifier\n return code`${imported}`;\n}\n\nexport function fieldTypeShape(\n field: InputObjectField<InputObjectType>,\n opts: PothosPrinterOptions,\n): Code {\n const importPath = generatedGraphQLTypeImportPath(field, opts);\n if (importPath == null) return shapeType(field.type);\n\n const imported = imp(`IMPORTED_PLACEHOLDER@${importPath}`);\n imported.symbol = shapeTypeName(field.type); // NOTE: Workaround for ts-poet not recognizing \"$\" as an identifier\n return code`${imported}`;\n}\n\nexport function pothosBuilder(\n type:\n | ObjectType\n | InputObjectType\n | EnumType\n | OneofUnionType\n | SquashedOneofUnionType,\n opts: Pick<\n PothosPrinterOptions,\n \"dsl\" | \"pothos\" | \"fileLayout\" | \"filenameSuffix\"\n >,\n): Code {\n const importPath = opts.pothos.builderPath.startsWith(\".\")\n ? path.relative(path.dirname(filename(type, opts)), opts.pothos.builderPath)\n : opts.pothos.builderPath;\n return code`${imp(`builder@${importPath}`)}`;\n}\n","import type { Registry } from \"@bufbuild/protobuf\";\nimport {\n EnumType,\n type InputObjectField,\n InputObjectType,\n ScalarType,\n compact,\n generatedGraphQLTypeImportPath,\n protoType,\n protobufGraphQLExtensions,\n tsFieldName,\n} from \"@proto-graphql/codegen-core\";\nimport { type Code, code, imp, joinCode, literalOf } from \"ts-poet\";\n\nimport { createFieldRefCode, createNoopFieldRefCode } from \"./field.js\";\nimport {\n type PothosPrinterOptions,\n fieldTypeShape,\n pothosBuilder,\n pothosRef,\n shapeType,\n} from \"./util.js\";\n\n/**\n * @example\n * ```ts\n * export type HelloInput$Shape = {\n * // ...\n * }\n * export const HelloInput$Ref: pothos.InputObjectRef<Hello$SHape> = builder.inputRef(\"HelloInput\").implement({\n * description: \"...\",\n * fields: (t) => ({\n * // ...\n * }),\n * })\n *\n * export function HelloInput$toProto () {\n * return {\n * // ...\n * }\n * }\n *\n * ```\n */\nexport function createInputObjectTypeCode(\n type: InputObjectType,\n registry: Registry,\n opts: PothosPrinterOptions,\n): Code {\n const shapeTypeCode = code`\n export type ${shapeType(type)} = {\n ${joinCode(\n type.fields.map((f) => {\n let typeNode: Code;\n if (f.type instanceof InputObjectType) {\n // @ts-expect-error f should be inferred as InputObjectField<InputObjectType>\n typeNode = code`${fieldTypeShape(f, opts)}`;\n if (f.isList()) typeNode = code`Array<${typeNode}>`;\n } else {\n typeNode = code`${protoType(type.proto, opts)}[${literalOf(\n tsFieldName(f.proto, opts),\n )}]`;\n }\n return f.isNullable()\n ? code`${f.name}?: ${typeNode} | null,`\n : code`${f.name}: ${\n f.type instanceof ScalarType && f.type.isCustomScalar()\n ? code`NonNullable<${typeNode}>`\n : typeNode\n },`;\n }),\n )}\n };\n `;\n\n const refCode = code`\n export const ${pothosRef(type)}: ${imp(\n \"InputObjectRef@@pothos/core\",\n )}<${shapeType(type)}> =\n ${pothosBuilder(type, opts)}.inputRef<${shapeType(type)}>(${literalOf(\n type.typeName,\n )}).implement(\n ${literalOf(\n compact({\n description: type.description,\n fields: code`t => ({${\n type.fields.length > 0\n ? type.fields.map(\n (f) =>\n code`${f.name}: ${createFieldRefCode(\n f,\n registry,\n opts,\n )},`,\n )\n : code`_: ${createNoopFieldRefCode({ input: true })}`\n }})`,\n extensions: protobufGraphQLExtensions(type, registry),\n }),\n )}\n );\n `;\n\n const codes = [shapeTypeCode, refCode];\n\n if (opts.protobuf === \"protobuf-es\") {\n codes.push(createToProtoFuncCode(type, opts));\n }\n\n return code` ${codes} `;\n}\n\nfunction createToProtoFuncCode(\n type: InputObjectType,\n opts: PothosPrinterOptions,\n): Code {\n const oneofFields: Record<string, InputObjectField<InputObjectType>[]> = {};\n for (const f of type.fields) {\n if (f.proto.oneof == null) continue;\n if (!(f.type instanceof InputObjectType)) {\n throw new Error(\"Oneof fields must be of message\");\n }\n\n oneofFields[f.proto.oneof.name] = [\n ...(oneofFields[f.proto.oneof.name] || []),\n f as InputObjectField<InputObjectType>,\n ];\n }\n\n return code`\n export function ${toProtoFuncName(type)} (input: ${shapeType(\n type,\n )} | null | undefined): ${protoType(type.proto, opts)} {\n return new ${protoType(type.proto, opts)}({\n ${type.fields\n .filter((f) => f.proto.oneof == null)\n .map((f) => {\n switch (true) {\n case f.type instanceof InputObjectType: {\n const localName = tsFieldName(f.proto, opts);\n const toProtoFunc = fieldToProtoFunc(\n f as InputObjectField<InputObjectType>,\n opts,\n );\n if (f.isList()) {\n return code`${localName}: input?.${f.name}?.map(v => ${toProtoFunc}(v)),`;\n }\n return code`${localName}: input?.${f.name} ? ${toProtoFunc}(input.${f.name}) : undefined,`;\n }\n case f.type instanceof ScalarType:\n case f.type instanceof EnumType: {\n const localName = tsFieldName(f.proto, opts);\n return code`${localName}: input?.${f.name} ?? undefined,`;\n }\n default: {\n f.type satisfies never;\n throw \"unreachable\";\n }\n }\n })}\n ${Object.values(oneofFields).map((fields) => {\n return code`${tsFieldName(\n // biome-ignore lint/style/noNonNullAssertion: we know it's not null\n fields[0]!.proto.oneof!,\n opts,\n )}:${fields.map(\n (f) =>\n code`input?.${f.name} ? { case: \"${tsFieldName(\n f.proto,\n opts,\n )}\", value: ${fieldToProtoFunc(f, opts)}(input.${f.name}) } :`,\n )} undefined,`;\n })}\n });\n }\n `;\n}\n\nfunction toProtoFuncName(type: InputObjectType): string {\n return `${type.typeName}$toProto`;\n}\n\nfunction fieldToProtoFunc(\n field: InputObjectField<InputObjectType>,\n opts: PothosPrinterOptions,\n): Code {\n const importPath = generatedGraphQLTypeImportPath(field, opts);\n if (importPath == null) return code`${toProtoFuncName(field.type)}`;\n\n const imported = imp(`IMPORTED_PLACEHOLDER@${importPath}`);\n imported.symbol = toProtoFuncName(field.type); // NOTE: Workaround for ts-poet not recognizing \"$\" as an identifier\n return code`${imported}`;\n}\n","import type { DescField, createRegistry } from \"@bufbuild/protobuf\";\nimport {\n EnumType,\n InputObjectField,\n ObjectField,\n ObjectOneofField,\n ObjectType,\n ScalarType,\n SquashedOneofUnionType,\n compact,\n createGetFieldValueCode,\n protobufGraphQLExtensions,\n tsFieldName,\n} from \"@proto-graphql/codegen-core\";\nimport { type Code, code, literalOf } from \"ts-poet\";\n\nimport { createEnumResolverCode } from \"./fieldResolver/enumFieldResolver.js\";\nimport { createNonNullResolverCode } from \"./fieldResolver/nonNullResolver.js\";\nimport { createOneofUnionResolverCode } from \"./fieldResolver/oneofUnionResolver.js\";\nimport { type PothosPrinterOptions, fieldTypeRef } from \"./util.js\";\n\n/**\n * @example\n * ```ts\n * t.expose(\"name\", {\n * type: \"Boolean\",\n * nullable: true,\n * description: \"...\",\n * })\n * ```\n * ```ts\n * t.field({\n * type: \"Boolean\",\n * nullable: true,\n * description: \"...\",\n * resolve() {\n * return true\n * }\n * })\n * ```\n */\nexport function createFieldRefCode(\n field: ObjectField<any> | ObjectOneofField | InputObjectField<any>,\n registry: ReturnType<typeof createRegistry>,\n opts: PothosPrinterOptions,\n): Code {\n const isInput = field instanceof InputObjectField;\n const baseType =\n field.type instanceof ScalarType\n ? literalOf(field.type.typeName)\n : fieldTypeRef(field, opts);\n\n const sourceExpr = code`source`;\n let resolverCode: Code | undefined;\n if (!isInput) {\n if (field instanceof ObjectOneofField) {\n resolverCode = createOneofUnionResolverCode(sourceExpr, field, opts);\n } else {\n const valueExpr = createGetFieldValueCode(sourceExpr, field.proto, opts);\n const nullableInProto =\n field.type instanceof ObjectType ||\n (field.type instanceof ScalarType &&\n !field.type.isPrimitive() &&\n !field.type.isWrapperType());\n if (nullableInProto && !field.isNullable()) {\n resolverCode = createNonNullResolverCode(valueExpr);\n }\n if (field.type instanceof EnumType && field instanceof ObjectField) {\n resolverCode = createEnumResolverCode(valueExpr, field, opts);\n }\n if (\n field.type instanceof SquashedOneofUnionType &&\n field instanceof ObjectField\n ) {\n resolverCode = createOneofUnionResolverCode(valueExpr, field, opts);\n }\n if (field.type instanceof ScalarType && field.type.isBytes()) {\n if (field.isList()) {\n resolverCode = code`return ${valueExpr}.map(v => Buffer.from(v));`;\n } else if (field.isNullable()) {\n resolverCode = code`return ${valueExpr} == null ? null : Buffer.from(${valueExpr});`;\n } else {\n resolverCode = code`return Buffer.from(${valueExpr});`;\n }\n }\n }\n }\n\n const nullableValue = isInput !== field.isNullable(); /* Logical XOR */\n const fieldOpts = {\n type: field.isList() ? code`[${baseType}]` : baseType,\n [isInput ? \"required\" : \"nullable\"]: field.isList()\n ? { list: nullableValue, items: isInput /* always non-null */ }\n : nullableValue,\n description: field.description,\n deprecationReason: field.deprecationReason,\n resolve: resolverCode ? code`${sourceExpr} => {${resolverCode}}` : null,\n extensions: protobufGraphQLExtensions(field, registry),\n };\n\n const shouldUseFieldFunc = isInput || resolverCode != null;\n return shouldUseFieldFunc\n ? code`t.field(${literalOf(compact(fieldOpts))})`\n : code`t.expose(${literalOf(\n tsFieldName(field.proto as DescField, opts),\n )}, ${literalOf(compact(fieldOpts))})`;\n}\n\n/**\n * @example\n * ```ts\n * t.field( {\n * type: \"Boolean\",\n * nullable: true,\n * description: \"noop field\",\n * resolve() {\n * return true\n * }\n * })\n * ```\n */\nexport function createNoopFieldRefCode(opts: { input: boolean }): Code {\n return code`\n t.field({\n type: \"Boolean\",\n ${opts.input ? \"required: false\" : \"nullable: true\"},\n description: \"noop field\",\n ${opts.input ? \"\" : \"resolve: () => true,\"}\n })\n `;\n}\n","import {\n type EnumType,\n type EnumTypeValue,\n type ObjectField,\n type PrinterOptions,\n protoType,\n} from \"@proto-graphql/codegen-core\";\nimport { type Code, code } from \"ts-poet\";\n\n/**\n * @example nullable\n * ```ts\n * if (!root.myEnum || root.myEnum === _$enums.myEnum.MY_ENUM_UNSPECIFIED) {\n * return null\n * }\n * return root.myEnum\n * ```\n * @example notNull\n * ```ts\n * if (!root.myEnum || root.myEnum === _$enums.myEnum.MY_ENUM_UNSPECIFIED) {\n * throw new Error(\"Message.field is required field. but got null or unspecified.\")\n * }\n * return root.myEnum\n * ```\n */\nexport function createEnumResolverCode(\n valueExpr: Code,\n field: ObjectField<EnumType>,\n opts: PrinterOptions,\n): Code {\n const createBlockStmtCodes = (valueExpr: Code): Code[] => {\n const chunks: Code[] = [];\n\n if (field.type.unspecifiedValue != null) {\n const escapeCode =\n field.isNullable() && !field.isList()\n ? code`return null;`\n : code`throw new Error(\"${field.name} is required field. But got unspecified.\");`;\n chunks.push(code`\n if (${valueExpr} === ${protoType(\n field.type.proto,\n opts,\n )}.${enumValueJsName(field.type, field.type.unspecifiedValue, opts)}) {\n ${escapeCode}\n }\n `);\n }\n for (const ev of field.type.valuesWithIgnored) {\n if (!ev.isIgnored()) continue;\n chunks.push(code`\n if (${valueExpr} === ${protoType(\n field.type.proto,\n opts,\n )}.${enumValueJsName(field.type, ev, opts)}) {\n throw new Error(\"${ev.name} is ignored in GraphQL schema\");\n }\n `);\n }\n\n return chunks;\n };\n\n if (field.isList()) {\n const stmts = createBlockStmtCodes(code`item`);\n if (stmts.length === 0) {\n return code`return ${valueExpr}`;\n }\n return code`return ${valueExpr}.map(item => {\n ${stmts}\n return item;\n })`;\n }\n\n return code`\n ${createBlockStmtCodes(valueExpr)}\n return ${valueExpr};\n `;\n}\n\nfunction enumValueJsName(\n et: EnumType,\n ev: EnumTypeValue,\n opts: PrinterOptions,\n): string {\n switch (opts.protobuf) {\n case \"ts-proto\":\n return ev.proto.name;\n case \"protobuf-es\": {\n return ev.proto.localName;\n }\n case \"protobufjs\":\n case \"google-protobuf\":\n throw new Error(`Unsupported protobuf: ${opts.protobuf}`);\n default: {\n opts satisfies never;\n throw \"unreachable\";\n }\n }\n}\n","import { type Code, code } from \"ts-poet\";\n\nexport function createNonNullResolverCode(valueExpr: Code): Code {\n return code`\n return ${valueExpr}!;\n `;\n}\n","import {\n ObjectField,\n ObjectOneofField,\n type PrinterOptions,\n type SquashedOneofUnionType,\n tsFieldName,\n} from \"@proto-graphql/codegen-core\";\nimport { type Code, code, joinCode } from \"ts-poet\";\n\n/**\n * @example nullable\n * ```ts\n * const value = source.v1 ?? source.v2 ?? source.v3;\n * if (value != null) {\n * throw new Error(\"...\");\n * }\n * return value\n * ```\n */\nexport function createOneofUnionResolverCode(\n sourceExpr: Code,\n field: ObjectOneofField | ObjectField<SquashedOneofUnionType>,\n opts: PrinterOptions,\n): Code {\n const createBlockStmtCode = (\n sourceExpr: Code,\n { nullable, list }: { nullable: boolean; list: boolean },\n ): Code => {\n switch (opts.protobuf) {\n case \"ts-proto\": {\n return createBlockStmtCodeForTsProto(sourceExpr, field, opts, {\n nullable,\n });\n }\n case \"protobuf-es\": {\n return createBlockStmtCodeForProtobufEs(sourceExpr, field, opts, {\n nullable,\n list,\n });\n }\n case \"google-protobuf\":\n case \"protobufjs\": {\n throw new Error(`Unsupported protobuf: ${opts.protobuf}`);\n }\n default: {\n opts satisfies never;\n throw \"unreachable\";\n }\n }\n };\n\n if (field instanceof ObjectField && field.isList()) {\n return code`\n return ${sourceExpr}.map(item => {\n ${createBlockStmtCode(code`item`, { nullable: false, list: true })}\n })\n `;\n }\n\n return createBlockStmtCode(sourceExpr, {\n nullable: field.isNullable(),\n list: false,\n });\n}\n\nfunction createBlockStmtCodeForTsProto(\n sourceExpr: Code,\n field: ObjectOneofField | ObjectField<SquashedOneofUnionType>,\n opts: PrinterOptions,\n { nullable }: { nullable: boolean },\n): Code {\n const createFieldExpr = (memberField: ObjectField<any>) => {\n if (field instanceof ObjectOneofField) {\n return code`${sourceExpr}.${tsFieldName(memberField.proto, opts)}`;\n }\n return code`${sourceExpr}?.${tsFieldName(memberField.proto, opts)}`;\n };\n\n return code`\n const value = ${joinCode(field.type.fields.map(createFieldExpr), {\n on: \"??\",\n })};\n if (value == null) {\n ${\n nullable\n ? \"return null\"\n : `throw new Error(\"${field.name} should not be null\")`\n };\n }\n return value;\n `;\n}\n\nfunction createBlockStmtCodeForProtobufEs(\n sourceExpr: Code,\n field: ObjectOneofField | ObjectField<SquashedOneofUnionType>,\n opts: PrinterOptions,\n { nullable, list }: { nullable: boolean; list: boolean },\n): Code {\n let valueExpr: Code;\n switch (true) {\n case field instanceof ObjectOneofField: {\n valueExpr = code`${sourceExpr}.${tsFieldName(field.proto, opts)}.value`;\n break;\n }\n case field instanceof ObjectField: {\n valueExpr = code`${sourceExpr}${list ? \"\" : \"?\"}.${tsFieldName(\n field.type.oneofUnionType.proto,\n opts,\n )}.value`;\n break;\n }\n default: {\n field satisfies never;\n throw \"unreachable\";\n }\n }\n if (nullable) {\n return code`return ${valueExpr};`;\n }\n return code`\n const value = ${valueExpr};\n if (value == null) {\n throw new Error(\"${field.name} should not be null\");\n }\n return value;\n `;\n}\n","import type { DescField, Registry } from \"@bufbuild/protobuf\";\nimport {\n InterfaceType,\n type ObjectType,\n compact,\n protoType,\n protobufGraphQLExtensions,\n tsFieldName,\n} from \"@proto-graphql/codegen-core\";\nimport { type Code, code, joinCode, literalOf } from \"ts-poet\";\n\nimport { createFieldRefCode, createNoopFieldRefCode } from \"./field.js\";\nimport { type PothosPrinterOptions, pothosBuilder, pothosRef } from \"./util.js\";\n\n/**\n * @example\n * ```ts\n * export const Hello$Ref = builder.objectRef<_$hello$hello_pb.Hello>(\"Hello\")\n * builder.objectType(Hello$Ref, {\n * name: \"Hello\",\n * // ...\n * })\n * ```\n */\nexport function createObjectTypeCode(\n type: ObjectType,\n registry: Registry,\n opts: PothosPrinterOptions,\n): Code {\n const isInterface = type instanceof InterfaceType;\n const typeOpts = {\n name: type.typeName,\n fields: code`t => ({${\n type.fields.length > 0\n ? joinCode(\n type.fields.map(\n (f) => code`${f.name}: ${createFieldRefCode(f, registry, opts)},`,\n ),\n )\n : code`_: ${createNoopFieldRefCode({ input: false })}`\n }})`,\n description: type.description,\n isTypeOf: isInterface\n ? undefined\n : createIsTypeOfFuncCode(type, registry, opts),\n extensions: protobufGraphQLExtensions(type, registry),\n };\n const buildRefFunc = code`${pothosBuilder(type, opts)}.${\n isInterface ? \"interface\" : \"object\"\n }Ref`;\n const buildTypeFunc = code`${pothosBuilder(type, opts)}.${\n isInterface ? \"interface\" : \"object\"\n }Type`;\n const refFuncTypeArg = isInterface\n ? code`\n Pick<\n ${protoType(type.proto, opts)},\n ${joinCode(\n type.fields.map(\n (f) =>\n code`${literalOf(tsFieldName(f.proto as DescField, opts))}`,\n ),\n { on: \"|\" },\n )}\n >`\n : protoType(type.proto, opts);\n\n return code`\n export const ${pothosRef(\n type,\n )} = ${buildRefFunc}<${refFuncTypeArg}>(${literalOf(type.typeName)});\n ${buildTypeFunc}(${pothosRef(type)}, ${literalOf(compact(typeOpts))});\n `;\n}\n\nfunction createIsTypeOfFuncCode(\n type: ObjectType,\n registry: Registry,\n opts: PothosPrinterOptions,\n): Code {\n switch (opts.protobuf) {\n case \"ts-proto\": {\n return code`\n (source) => {\n return (source as ${protoType(type.proto, opts)} | { $type: string & {} }).$type\n === ${literalOf(type.proto.typeName)};\n }\n `;\n }\n case \"protobuf-es\": {\n return code`\n (source) => {\n return source instanceof ${protoType(type.proto, opts)}\n }\n `;\n }\n case \"google-protobuf\":\n case \"protobufjs\": {\n throw new Error(`Unsupported protobuf lib: ${opts.protobuf}`);\n }\n default: {\n opts satisfies never;\n throw \"unreachable\";\n }\n }\n}\n","import type { Registry } from \"@bufbuild/protobuf\";\nimport {\n type OneofUnionType,\n type SquashedOneofUnionType,\n compact,\n protobufGraphQLExtensions,\n} from \"@proto-graphql/codegen-core\";\nimport { type Code, code, literalOf } from \"ts-poet\";\n\nimport {\n type PothosPrinterOptions,\n fieldTypeRef,\n pothosBuilder,\n pothosRef,\n} from \"./util.js\";\n\n/**\n * @example\n * ```ts\n * export cosnt Oneof = builder.unionType(\"Oneof\", {\n * types: [...],\n * // ...\n * })\n * ```\n */\nexport function createOneofUnionTypeCode(\n type: OneofUnionType | SquashedOneofUnionType,\n registry: Registry,\n opts: PothosPrinterOptions,\n): Code {\n const typeOpts = {\n types: type.fields.map((f) => fieldTypeRef(f, opts)),\n description: type.description,\n extensions: protobufGraphQLExtensions(type, registry),\n };\n return code`\n export const ${pothosRef(type)} =\n ${pothosBuilder(type, opts)}.unionType(${literalOf(\n type.typeName,\n )}, ${literalOf(compact(typeOpts))});\n `;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,sBAA0B;;;ACA1B,yBAAuC;AACvC,mCAGO;;;ACFL,cAAW;;;ACAb,IAAAC,wBAMO;;;ACPP,IAAAC,uBAMO;;;ACNP,IAAAC,uBAKO;AACP,IAAAC,kBAA0D;;;ACP1D,WAAsB;AAEtB,0BAaO;AACP,qBAAqC;AAI9B,SAASC,UACdC,MAMiB;AAEjB,SAAOC,sBAAOC,cAAcF,IAAAA,CAAAA;AAC9B;AAVgBD;AAYhB,SAASG,cACPF,MAMiB;AAEjB,SAAO,GAAGA,KAAKG,QAAQ;AACzB;AAVSD;AAYF,SAASE,UAAUJ,MAAqB;AAC7C,SAAOC,sBAAOI,cAAcL,IAAAA,CAAAA;AAC9B;AAFgBI;AAIT,SAASC,cAAcL,MAAqB;AACjD,SAAO,GAAGA,KAAKG,QAAQ;AACzB;AAFgBE;AAIT,SAASC,aACdC,OAMAC,MAA0B;AAE1B,QAAMC,iBAAaC,oDAA+BH,OAAOC,IAAAA;AACzD,MAAIC,cAAc,KAAM,QAAOV,UAAUQ,MAAMP,IAAI;AAEnD,QAAMW,eAAWC,oBAAI,wBAAwBH,UAAAA,EAAY;AACzDE,WAASE,SAASX,cAAcK,MAAMP,IAAI;AAC1C,SAAOC,sBAAOU,QAAAA;AAChB;AAfgBL;AAiBT,SAASQ,eACdP,OACAC,MAA0B;AAE1B,QAAMC,iBAAaC,oDAA+BH,OAAOC,IAAAA;AACzD,MAAIC,cAAc,KAAM,QAAOL,UAAUG,MAAMP,IAAI;AAEnD,QAAMW,eAAWC,oBAAI,wBAAwBH,UAAAA,EAAY;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AUC,eAAAA;","names":["import_protoplugin","import_codegen_core","import_codegen_core","import_codegen_core","import_ts_poet","pothosRef","type","code","pothosRefName","typeName","shapeType","shapeTypeName","fieldTypeRef","field","opts","importPath","generatedGraphQLTypeImportPath","imported","imp","symbol","fieldTypeShape","pothosBuilder","pothos","builderPath","startsWith","relative","dirname","filename","createEnumTypeCode","type","registry","opts","typeOpts","description","values","code","joinCode","filter","v","isIgnored","isUnespecified","map","ev","name","literalOf","compact","deprecationReason","value","number","extensions","protobufGraphQLExtensions","protoTypeExpr","protoType","proto","refTypeExpr","imp","pothosRef","pothosBuilder","typeName","import_codegen_core","import_ts_poet","import_codegen_core","import_ts_poet","import_codegen_core","import_ts_poet","createEnumResolverCode","valueExpr","field","opts","createBlockStmtCodes","chunks","type","unspecifiedValue","escapeCode","isNullable","isList","code","name","push","protoType","proto","enumValueJsName","ev","valuesWithIgnored","isIgnored","stmts","length","et","protobuf","localName","Error","import_ts_poet","createNonNullResolverCode","valueExpr","code","import_codegen_core","import_ts_poet","createOneofUnionResolverCode","sourceExpr","field","opts","createBlockStmtCode","nullable","list","protobuf","createBlockStmtCodeForTsProto","createBlockStmtCodeForProtobufEs","Error","ObjectField","isList","code","isNullable","createFieldExpr","memberField","ObjectOneofField","tsFieldName","proto","joinCode","type","fields","map","on","name","valueExpr","oneofUnionType","createFieldRefCode","field","registry","opts","isInput","InputObjectField","baseType","type","ScalarType","literalOf","typeName","fieldTypeRef","sourceExpr","code","resolverCode","ObjectOneofField","createOneofUnionResolverCode","valueExpr","createGetFieldValueCode","proto","nullableInProto","ObjectType","isPrimitive","isWrapperType","isNullable","createNonNullResolverCode","EnumType","ObjectField","createEnumResolverCode","SquashedOneofUnionType","isBytes","isList","nullableValue","fieldOpts","list","items","description","deprecationReason","resolve","extensions","protobufGraphQLExtensions","shouldUseFieldFunc","compact","tsFieldName","createNoopFieldRefCode","input","createInputObjectTypeCode","type","registry","opts","shapeTypeCode","code","shapeType","joinCode","fields","map","f","typeNode","InputObjectType","fieldTypeShape","isList","protoType","proto","literalOf","tsFieldName","isNullable","name","ScalarType","isCustomScalar","refCode","pothosRef","imp","pothosBuilder","typeName","compact","description","length","createFieldRefCode","createNoopFieldRefCode","input","extensions","protobufGraphQLExtensions","codes","protobuf","push","createToProtoFuncCode","oneofFields","oneof","Error","toProtoFuncName","filter","localName","toProtoFunc","fieldToProtoFunc","EnumType","Object","values","field","importPath","generatedGraphQLTypeImportPath","imported","symbol","import_codegen_core","import_ts_poet","createObjectTypeCode","type","registry","opts","isInterface","InterfaceType","typeOpts","name","typeName","fields","code","length","joinCode","map","f","createFieldRefCode","createNoopFieldRefCode","input","description","isTypeOf","undefined","createIsTypeOfFuncCode","extensions","protobufGraphQLExtensions","buildRefFunc","pothosBuilder","buildTypeFunc","refFuncTypeArg","protoType","proto","literalOf","tsFieldName","on","pothosRef","compact","protobuf","Error","import_codegen_core","import_ts_poet","createOneofUnionTypeCode","type","registry","opts","typeOpts","types","fields","map","f","fieldTypeRef","description","extensions","protobufGraphQLExtensions","code","pothosRef","pothosBuilder","literalOf","typeName","compact","createTypeDslCodes","types","registry","opts","flatMap","type","ObjectType","createObjectTypeCode","InputObjectType","createInputObjectTypeCode","EnumType","createEnumTypeCode","OneofUnionType","SquashedOneofUnionType","createOneofUnionTypeCode","_exhaustiveCheck","allowedProtobufs","generateFiles","schema","file","opts","options","includes","printer","protobuf","registry","createRegistryFromSchema","types","collectTypesFromFile","type","allFiles","fileLayout","f","generateFile","filenameFromProtoFile","code","printCodes","createCodes","print","trimEnd","t","filename","_exhaustiveCheck","createTypeDslCodes","protocGenPothos","createEcmaScriptPlugin","name","version","generateTs","createTsGenerator","generateFiles","dsl","parseOptions","parsePothosOptions","transpile","files","runNodeJs","protocGenPothos"]}
|