Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): v0.30.0 #186

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ Each protocol has its own limitations, corner cases, and features; thus, each ha
- [MQTT](./protocols/mqtt.md)
- [EventSource](./protocols/eventsource.md)


1 change: 1 addition & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,4 @@ Prefix that follows specification is not enough though. Remember that the title




6 changes: 3 additions & 3 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $ npm install -g @the-codegen-project/cli
$ codegen COMMAND
running command...
$ codegen (--version)
@the-codegen-project/cli/0.29.0 linux-x64 node-v18.20.6
@the-codegen-project/cli/0.30.0 linux-x64 node-v18.20.6
$ codegen --help [COMMAND]
USAGE
$ codegen COMMAND
Expand Down Expand Up @@ -81,7 +81,7 @@ DESCRIPTION
Generate code based on your configuration, use `init` to get started.
```

_See code: [src/commands/generate.ts](https://github.com/the-codegen-project/cli/blob/v0.29.0/src/commands/generate.ts)_
_See code: [src/commands/generate.ts](https://github.com/the-codegen-project/cli/blob/v0.30.0/src/commands/generate.ts)_

## `codegen help [COMMAND]`

Expand Down Expand Up @@ -139,7 +139,7 @@ DESCRIPTION
Initialize The Codegen Project in your project
```

_See code: [src/commands/init.ts](https://github.com/the-codegen-project/cli/blob/v0.29.0/src/commands/init.ts)_
_See code: [src/commands/init.ts](https://github.com/the-codegen-project/cli/blob/v0.30.0/src/commands/init.ts)_

## `codegen version`

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@the-codegen-project/cli",
"description": "CLI to work with code generation in any environment",
"version": "0.29.0",
"version": "0.30.0",
"bin": {
"codegen": "./bin/run.mjs"
},
Expand Down
12 changes: 9 additions & 3 deletions schemas/configuration-schema-0.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@
"kafka",
"mqtt",
"amqp",
"event_source_client"
"event_source"
]
},
"default": [
"nats",
"kafka",
"mqtt",
"amqp",
"event_source_client"
"event_source"
]
},
"parameterGeneratorId": {
Expand Down Expand Up @@ -223,7 +223,8 @@
"kafka_subscribe",
"amqp_queue_publish",
"amqp_exchange_publish",
"event_source_fetch"
"event_source_fetch",
"event_source_express"
]
}
}
Expand All @@ -237,6 +238,11 @@
"default": ".",
"description": "Used with AsyncAPI to ensure the right character separate topics, example if address is my/resource/path it will be converted to my.resource.path"
},
"eventSourceDependency": {
"type": "string",
"default": "@microsoft/fetch-event-source",
"description": "Change the fork/dependency as @microsoft/fetch-event-source"
},
"language": {
"type": "string",
"const": "typescript",
Expand Down
14 changes: 12 additions & 2 deletions src/codegen/generators/typescript/channels/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,12 @@ export async function generateTypeScriptChannels(
)
) {
renders.push(
EventSourceRenderer.renderFetch({...eventSourceContext, additionalProperties: {fetchDependency: context.generator.eventSourceDependency}})
EventSourceRenderer.renderFetch({
...eventSourceContext,
additionalProperties: {
fetchDependency: context.generator.eventSourceDependency
}
})
);
}
if (
Expand Down Expand Up @@ -746,7 +751,12 @@ export async function generateTypeScriptChannels(
)
) {
renders.push(
EventSourceRenderer.renderFetch({...eventSourceContext, additionalProperties: {fetchDependency: context.generator.eventSourceDependency}})
EventSourceRenderer.renderFetch({
...eventSourceContext,
additionalProperties: {
fetchDependency: context.generator.eventSourceDependency
}
})
);
}
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export function renderExpress({
functionName = `register${subName}`
}: RenderRegularParameters): SingleFunctionRenderType {
let addressToUse = topic.replace(/{([^}]+)}/g, ':$1');
addressToUse = addressToUse.startsWith('/') ? addressToUse : `/${addressToUse}`;
addressToUse = addressToUse.startsWith('/')
? addressToUse
: `/${addressToUse}`;
let messageMarshalling = 'message.marshal()';
if (messageModule) {
messageMarshalling = `${messageModule}.marshal(message)`;
Expand All @@ -37,13 +39,15 @@ export function renderExpress({
? [
{
parameter: `parameters: ${channelParameters.type}`,
jsDoc: ' * @param parameters that was received when client made the connection'
jsDoc:
' * @param parameters that was received when client made the connection'
}
]
: []),
{
parameter: `sendEvent: (message: ${messageType}) => void`,
jsDoc: ' * @param sendEvent callback you can use to send message to the client'
jsDoc:
' * @param sendEvent callback you can use to send message to the client'
}
];
const functionParameters = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import {ChannelFunctionTypes} from '../..';
import {SingleFunctionRenderType} from '../../../../../types';
import {pascalCase} from '../../../utils';
import {defaultTypeScriptChannelsGenerator, RenderRegularParameters} from '../../types';
import {
defaultTypeScriptChannelsGenerator,
RenderRegularParameters
} from '../../types';

export function renderFetch({
topic,
Expand All @@ -14,7 +17,9 @@ export function renderFetch({
additionalProperties = {
fetchDependency: defaultTypeScriptChannelsGenerator.eventSourceDependency
}
}: RenderRegularParameters<{fetchDependency: string}>): SingleFunctionRenderType {
}: RenderRegularParameters<{
fetchDependency: string;
}>): SingleFunctionRenderType {
const addressToUse = channelParameters
? `parameters.getChannelWithParameters('${topic}')`
: `'${topic}'`;
Expand Down
4 changes: 1 addition & 3 deletions src/codegen/generators/typescript/channels/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ export const zodTypescriptChannelsGenerator = z.object({
.string()
.optional()
.default('@microsoft/fetch-event-source')
.describe(
'Change the fork/dependency as @microsoft/fetch-event-source'
),
.describe('Change the fork/dependency as @microsoft/fetch-event-source'),
language: z.literal('typescript').optional().default('typescript')
});

Expand Down