Add system Nexus signalWithStartWorkflow API#2127
Conversation
8e24cfd to
da9a5ac
Compare
| function nexGenCommand(): string { | ||
| if (process.env.NEX_GEN_BIN) return process.env.NEX_GEN_BIN; | ||
| if (!commandExists('nex-gen')) { | ||
| run('cargo', ['install', '--locked', 'nex-gen', '--force']); |
There was a problem hiding this comment.
I'd prefer we don't have gen scripts mess with host systems. I think erroring in this case with how to install is just fine.
| resolve(workflowOutputDir, 'operations/signal-with-start-workflow.ts'), | ||
| ]) { | ||
| let source = readFileSync(path, 'utf8'); | ||
| source = source.replace(/((?:from|export .* from) ['"]\.{1,2}[^'"]*)\.ts(['"])/g, '$1$2'); |
There was a problem hiding this comment.
Is there a reason why nexus-gen creates these files with imports that specify .ts as the extension? I don't think that is correct unless we run TS files directly instead of building them to JS first.
| "dependencies": { | ||
| "@temporalio/common": "workspace:*", | ||
| "@temporalio/proto": "workspace:*", | ||
| "long": "^5.2.3", |
There was a problem hiding this comment.
From what I can see we only use this for a type reference. If so we can move it to devDependency
| ); | ||
| } | ||
|
|
||
| function postProcessGeneratedWorkflowFiles(): void { |
There was a problem hiding this comment.
Would appreciate comment describing what/why post processing is necessary
| import type Long from "long"; | ||
|
|
||
| function int64ToNumber( | ||
| value: Long | number | string | object | null | undefined, |
There was a problem hiding this comment.
Is there a reason why this helper accepts so many types, but it looks like Long | null | undefined are the only ones ever passed?
| }); | ||
| } | ||
|
|
||
| function generateWorkerVisitor(operations: OperationInfo[], messages: Map<string, MessageInfo>): void { |
There was a problem hiding this comment.
Unsure how I feel about this. Could we piggyback on protobufjs reflection to just directly implement this instead of generating it?
Summary
Validation
Notes