Skip to content

Commit

Permalink
Merge pull request #7 from inaiat/feat/remove-const-enum
Browse files Browse the repository at this point in the history
Remove const enums from TypeScript-generated files
  • Loading branch information
inaiat authored Aug 20, 2024
2 parents 6fe5f2f + 2188dbd commit 81a679b
Show file tree
Hide file tree
Showing 5 changed files with 397 additions and 262 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9.7.1
run_install: true
- name: Install
uses: dtolnay/rust-toolchain@stable
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["json"] }

[build-dependencies]
napi-build = "2.0.1"
napi-build = "2.1"

[profile.release]
lto = true
Expand Down
16 changes: 8 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/* auto-generated by NAPI-RS */

export const enum ConsumerResult {
export enum ConsumerResult {
Ok = 'Ok',
Retry = 'Retry'
}
Expand All @@ -26,7 +26,7 @@ export interface RetryStrategy {
offset?: OffsetModel
configuration?: Record<string, string>
}
export const enum CommitMode {
export enum CommitMode {
Sync = 0,
Async = 1
}
Expand All @@ -37,7 +37,7 @@ export interface ConsumerConfiguration {
configuration?: Record<string, string>
fecthMetadataTimeout?: number
}
export const enum PartitionPosition {
export enum PartitionPosition {
Beginning = 'Beginning',
End = 'End',
Stored = 'Stored'
Expand All @@ -55,7 +55,7 @@ export interface TopicPartitionConfig {
allOffsets?: OffsetModel
partitionOffset?: Array<PartitionOffset>
}
export const enum SecurityProtocol {
export enum SecurityProtocol {
Plaintext = 'Plaintext',
Ssl = 'Ssl',
SaslPlaintext = 'SaslPlaintext',
Expand Down Expand Up @@ -109,23 +109,23 @@ export interface KafkaCrabError {
code: number
message: string
}
export class KafkaConsumer {
export declare class KafkaConsumer {
startConsumer(callback: (error: Error | undefined, result: Payload) => Promise<ConsumerResult | undefined>): Promise<void>
}
export class KafkaStreamConsumer {
export declare class KafkaStreamConsumer {
subscribe(topicConfigs: string | Array<TopicPartitionConfig>): Promise<void>
unsubscribe(): void
seek(topic: string, partition: number, offsetModel: OffsetModel, timeout?: number | undefined | null): void
recv(): Promise<Message>
commit(topic: string, partition: number, offset: number, commit: CommitMode): void
}
export class KafkaClient {
export declare class KafkaClient {
readonly kafkaConfiguration: KafkaConfiguration
constructor(kafkaConfiguration: KafkaConfiguration)
createProducer(producerConfiguration: ProducerConfiguration): KafkaProducer
createConsumer(consumerConfiguration: KafkaConsumerConfiguration): KafkaConsumer
createStreamConsumer(consumerConfiguration: ConsumerConfiguration): KafkaStreamConsumer
}
export class KafkaProducer {
export declare class KafkaProducer {
send(producerRecord: ProducerRecord): Promise<Array<RecordMetadata>>
}
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kafka-crab-js",
"version": "0.7.0",
"version": "0.8.0",
"main": "index.js",
"types": "index.d.ts",
"napi": {
Expand Down Expand Up @@ -30,12 +30,12 @@
},
"devDependencies": {
"@faker-js/faker": "^8.4.1",
"@napi-rs/cli": "^2.18.3",
"@types/node": "^20.12.12",
"ava": "^6.1.2",
"@napi-rs/cli": "^2.18.4",
"@types/node": "^22.4.1",
"ava": "^6.1.3",
"nanoid": "^5.0.7",
"typescript": "^5.4.5",
"xo": "^0.58.0"
"xo": "^0.59.3"
},
"ava": {
"timeout": "3m"
Expand All @@ -52,12 +52,12 @@
},
"scripts": {
"artifacts": "napi artifacts",
"build": "napi build --platform --release",
"build": "napi build --no-const-enum --platform --release",
"build:debug": "napi build --platform",
"prepublishOnly": "napi prepublish -t npm",
"test": "ava",
"universal": "napi universal",
"version": "napi version"
},
"packageManager": "pnpm@9.1.1"
"packageManager": "pnpm@9.7.1"
}
Loading

0 comments on commit 81a679b

Please sign in to comment.