Skip to content

Commit

Permalink
Merge pull request #54 from bugwheels94/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
bugwheels94 authored May 12, 2024
2 parents 2f3b55f + 2a69c56 commit 7653d39
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 17 deletions.
3 changes: 1 addition & 2 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
[
"@semantic-release/github",
{
Expand All @@ -14,4 +13,4 @@
}
]
]
}
}
14 changes: 0 additions & 14 deletions src/distributor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,8 @@ export interface MessageDistributor<T extends AllowedType, ListType = Iterable<s
}

export { InMemoryMessageDistributor } from './inMemory';
type Values = string | Uint8Array;

// Define a helper type that maps 'AllowedType' to corresponding 'Values'
type DataMapping<T> = T extends 'string' ? string : T extends 'binary' ? Uint8Array : never;

class X<MessageType extends AllowedType> {
data: DataMapping<MessageType>;

constructor(data: DataMapping<MessageType>) {
this.data = data;
}
}

// Usage examples
const instanceWithString = new X<'string'>('hello world');
const instanceWithUint8Array = new X<'binary'>(new Uint8Array([1, 2, 3]));

console.log(instanceWithString.data); // data is string
console.log(instanceWithUint8Array.data);
1 change: 0 additions & 1 deletion src/distributor/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export class RedisMessageDistributor<T extends AllowedType = 'string'> implement
}
}
async enqueueString(queueId: string, message: string) {
console.log('distributor sending to', queueId, message);
this.redisClient.publish(queueId, message);
}
async enqueueBuffer(queueId: string, message: Uint8Array) {
Expand Down

0 comments on commit 7653d39

Please sign in to comment.