Skip to content

Add examples to the project#277

Merged
kibertoad merged 7 commits into
mainfrom
doc/example
May 19, 2025
Merged

Add examples to the project#277
kibertoad merged 7 commits into
mainfrom
doc/example

Conversation

@kibertoad

Copy link
Copy Markdown
Owner

No description provided.

@kibertoad kibertoad requested a review from CarlosGamero May 19, 2025 00:42
import type { CommonEventDefinition } from '../events/eventTypes.ts'

export type SnsAwareEventDefinition = {
schemaVersion?: string

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was redundant

* Resolves schema of all possible publisher messages for a given list of event definitions
*/
export type allPublisherMessageSchemas<MessageDefinitionTypes extends CommonEventDefinition[]> =
export type AllPublisherMessageSchemas<MessageDefinitionTypes extends CommonEventDefinition[]> =

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a typo

export type CommonEventDefinition = {
consumerSchema: ZodObject<
Omit<(typeof CONSUMER_BASE_EVENT_SCHEMA)['shape'], 'payload'> & {
Omit<(typeof CONSUMER_BASE_EVENT_SCHEMA)['shape'], 'payload' | 'metadata'> & {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensuring that metadata here and in baseMessageSchema come from the same place make IDE much happier about infering types for whatever reason

import type { CommonEventDefinition } from '@message-queue-toolkit/schemas'
import { z } from 'zod'

type AllConsumerMessageSchemas<MessageDefinitionTypes extends CommonEventDefinition[]> = z.infer<

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will switch to the one from the library after it is released

Comment thread .github/workflows/ci.yml Outdated
'@message-queue-toolkit/sns',
'@message-queue-toolkit/sqs'
]
fail-fast: false

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to execute all actions even when there is already one failing? Having it enabled is useful to save resources, but no strong opinion here

Comment on lines +7 to +13
export function userUpdatedHandler(
message: z.infer<typeof UserEvents.updated.consumerSchema>,
): Promise<Either<'retryLater', 'success'>> {
_latestData = message.payload

return Promise.resolve({ result: 'success' })
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not have to be in this PR, but would be nice to show how to use barrier pattern and pre-handlers

Comment on lines 7 to -12
watch: false,
restoreMocks: true,
pool: 'threads',
poolOptions: {
threads: { singleThread: true },
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I'm reading it correctly, but to confirm, are we moving amqp/vitest.config to the new examples? is this intentional?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see the suddenly flaky RabbitMQ tests (despite no changes in this PR)

happy to remove after it goes away

@kibertoad kibertoad merged commit 1fad912 into main May 19, 2025
31 checks passed
@kibertoad kibertoad deleted the doc/example branch May 19, 2025 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants