@anabranch/eventlog 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -106
- package/esm/adapter.d.ts +83 -62
- package/esm/adapter.d.ts.map +1 -1
- package/esm/adapter.js +0 -9
- package/esm/errors.d.ts +2 -7
- package/esm/errors.d.ts.map +1 -1
- package/esm/errors.js +9 -21
- package/esm/eventlog.d.ts +74 -92
- package/esm/eventlog.d.ts.map +1 -1
- package/esm/eventlog.js +93 -113
- package/esm/in-memory.d.ts +15 -34
- package/esm/in-memory.d.ts.map +1 -1
- package/esm/in-memory.js +139 -167
- package/esm/index.d.ts +8 -8
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
# @anabranch/eventlog
|
|
2
2
|
|
|
3
|
-
Event log with
|
|
4
|
-
|
|
3
|
+
Event log with Task/Stream semantics for event-sourced systems with cursor-based
|
|
4
|
+
consumption.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
A high-level event log abstraction that integrates with anabranch's Task and
|
|
7
|
+
Stream types for composable error handling, concurrent processing, and reliable
|
|
8
|
+
consumer resumption.
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
representing log operations as **Tasks**, you get first-class support for
|
|
10
|
-
retries, timeouts, and `AbortSignal` propagation out of the box.
|
|
10
|
+
## Usage
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
execution patterns.
|
|
12
|
+
```ts
|
|
13
|
+
import { createInMemory, EventLog } from '@anabranch/eventlog'
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
const connector = createInMemory()
|
|
16
|
+
const log = await EventLog.connect(connector).run()
|
|
17
|
+
|
|
18
|
+
// Append an event
|
|
19
|
+
await log.append('users', { type: 'created', userId: 123 }).run()
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
// Consume events with cursor-based resumption
|
|
22
|
+
const { successes, errors } = await log
|
|
23
|
+
.consume('users', 'my-processor', { batchSize: 10 })
|
|
24
|
+
.withConcurrency(5)
|
|
25
|
+
.map(async (batch) => {
|
|
26
|
+
for (const event of batch.events) {
|
|
27
|
+
await handleEvent(event.data)
|
|
28
|
+
}
|
|
29
|
+
// Manual commit for at-least-once delivery
|
|
30
|
+
await log.commit(batch.topic, batch.consumerGroup, batch.cursor).run()
|
|
31
|
+
})
|
|
32
|
+
.partition()
|
|
33
|
+
```
|
|
26
34
|
|
|
27
35
|
## Installation
|
|
28
36
|
|
|
@@ -34,97 +42,23 @@ jsr add @anabranch/eventlog
|
|
|
34
42
|
deno add @anabranch/eventlog
|
|
35
43
|
```
|
|
36
44
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
import { createInMemory, EventLog } from "@anabranch/eventlog";
|
|
41
|
-
|
|
42
|
-
const connector = createInMemory();
|
|
43
|
-
|
|
44
|
-
// Compose your logic as a Task chain
|
|
45
|
-
const program = EventLog.connect(connector).flatMap((log) => {
|
|
46
|
-
return log
|
|
47
|
-
.append("users", { type: "signup", email: "alice@example.com" })
|
|
48
|
-
.tap(() => console.log("Event appended!"))
|
|
49
|
-
.flatMap(() => log.get("users", 0));
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// Execute the task at the edge of your application
|
|
53
|
-
const result = await program.result();
|
|
54
|
-
|
|
55
|
-
if (result.type === "success") {
|
|
56
|
-
console.log("User at sequence 0:", result.value);
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Reliable Consumption
|
|
61
|
-
|
|
62
|
-
The `.consume()` method returns a Stream of batches. To guarantee at-least-once
|
|
63
|
-
delivery, you manually commit the cursor after successful processing.
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
const log = await EventLog.connect(connector).run();
|
|
67
|
-
|
|
68
|
-
const consumer = log
|
|
69
|
-
.consume("users", "email-service", { batchSize: 10 })
|
|
70
|
-
.map(async (batch) => {
|
|
71
|
-
// 1. Process your events
|
|
72
|
-
for (const event of batch.events) {
|
|
73
|
-
await sendWelcomeEmail(event.data);
|
|
74
|
-
}
|
|
75
|
-
// 2. Commit the cursor only after success
|
|
76
|
-
await log.commit(batch.topic, batch.consumerGroup, batch.cursor).run();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// Run the consumer
|
|
80
|
-
await consumer.run();
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## API
|
|
84
|
-
|
|
85
|
-
### `EventLog.connect(adapter)`
|
|
86
|
-
|
|
87
|
-
Initializes the connection. Returns a
|
|
88
|
-
`Task<EventLog, EventLogConnectionFailed>`.
|
|
89
|
-
|
|
90
|
-
### `log.append(topic, data, options?)`
|
|
91
|
-
|
|
92
|
-
Appends an event. Options include `partitionKey` and `metadata`.\
|
|
93
|
-
Returns `Task<string, EventLogAppendFailed>`.
|
|
94
|
-
|
|
95
|
-
### `log.consume(topic, consumerGroup, options?)`
|
|
96
|
-
|
|
97
|
-
Returns a Stream of event batches. If a cursor is found for the group, it
|
|
98
|
-
resumes automatically.
|
|
99
|
-
|
|
100
|
-
### `log.commit(topic, consumerGroup, cursor)`
|
|
101
|
-
|
|
102
|
-
Persists the progress for a specific consumer group.
|
|
103
|
-
|
|
104
|
-
---
|
|
45
|
+
## Features
|
|
105
46
|
|
|
106
|
-
|
|
47
|
+
- **Cursor-Based Consumption**: Resume processing from any position without data
|
|
48
|
+
loss
|
|
49
|
+
- **At-Least-Once Delivery**: Manual commit gives you control over processing
|
|
50
|
+
guarantees
|
|
51
|
+
- **Task/Stream Integration**: Leverage Task's retry/timeout and Stream's error
|
|
52
|
+
collection
|
|
53
|
+
- **Multiple Adapters**: In-memory implementation included
|
|
107
54
|
|
|
108
|
-
|
|
55
|
+
## API Reference
|
|
109
56
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
attempts: 3,
|
|
114
|
-
delay: (n) => Math.pow(2, n) * 1000, // Exponential backoff
|
|
115
|
-
when: (err) => err instanceof EventLogAppendFailed,
|
|
116
|
-
})
|
|
117
|
-
.timeout(5000)
|
|
118
|
-
.recover((err) => {
|
|
119
|
-
console.error("Critical failure:", err);
|
|
120
|
-
return "FALLBACK_ID";
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
const eventId = await task.run();
|
|
124
|
-
```
|
|
57
|
+
See
|
|
58
|
+
[generated documentation](https://frodi-karlsson.github.io/anabranch/eventlog)
|
|
59
|
+
for full API details.
|
|
125
60
|
|
|
126
61
|
## Related
|
|
127
62
|
|
|
128
|
-
- [@anabranch/
|
|
129
|
-
|
|
130
|
-
processing
|
|
63
|
+
- [@anabranch/anabranch](https://jsr.io/@anabranch/anabranch) - Core Task/Stream
|
|
64
|
+
primitives
|
package/esm/adapter.d.ts
CHANGED
|
@@ -1,96 +1,117 @@
|
|
|
1
|
+
import { Promisable } from 'anabranch';
|
|
2
|
+
import { EventLogConsumeFailed } from './errors.js';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Implement this interface to create drivers for specific event stores.
|
|
5
|
-
* The EventLog class wraps adapters with Task/Stream semantics.
|
|
6
|
-
*
|
|
7
|
-
* For connection lifecycle management, use EventLogConnector which produces adapters.
|
|
8
|
-
* The adapter's close() method releases the connection rather than terminating it.
|
|
4
|
+
* A single event in the event log.
|
|
9
5
|
*/
|
|
10
|
-
/** A single event in the log. */
|
|
11
6
|
export interface Event<T = unknown> {
|
|
12
|
-
/** Unique
|
|
7
|
+
/** Unique identifier for this event. */
|
|
13
8
|
id: string;
|
|
14
|
-
/**
|
|
9
|
+
/** The topic this event belongs to. */
|
|
15
10
|
topic: string;
|
|
16
|
-
/**
|
|
11
|
+
/** The event data payload. */
|
|
17
12
|
data: T;
|
|
18
|
-
/** Partition key for ordering guarantees */
|
|
13
|
+
/** Partition key for ordering guarantees. */
|
|
19
14
|
partitionKey: string;
|
|
20
|
-
/**
|
|
21
|
-
sequenceNumber:
|
|
22
|
-
/**
|
|
15
|
+
/** Monotonically increasing sequence number within the topic. Represented as a string to support bigint while remaining serializable. */
|
|
16
|
+
sequenceNumber: string;
|
|
17
|
+
/** Unix timestamp in milliseconds when the event was created. */
|
|
23
18
|
timestamp: number;
|
|
24
|
-
/** Optional metadata
|
|
19
|
+
/** Optional metadata associated with the event. */
|
|
25
20
|
metadata?: Record<string, unknown>;
|
|
26
21
|
}
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
/**
|
|
23
|
+
* A batch of events delivered to a consumer.
|
|
24
|
+
*/
|
|
25
|
+
export interface EventBatch<T = unknown, Cursor = string> {
|
|
26
|
+
/** The topic this batch was received from. */
|
|
30
27
|
topic: string;
|
|
31
|
-
/**
|
|
28
|
+
/** The consumer group that received this batch. */
|
|
32
29
|
consumerGroup: string;
|
|
33
|
-
/** Events in this batch */
|
|
30
|
+
/** Events in this batch. */
|
|
34
31
|
events: Event<T>[];
|
|
35
|
-
/** Cursor position
|
|
36
|
-
cursor:
|
|
32
|
+
/** Cursor representing the position after this batch. Use for manual commits. */
|
|
33
|
+
cursor: Cursor;
|
|
34
|
+
/**
|
|
35
|
+
* Commit this batch's cursor to mark progress.
|
|
36
|
+
*
|
|
37
|
+
* After processing events successfully, call this to save the cursor position.
|
|
38
|
+
* On restart, the consumer will resume from this position.
|
|
39
|
+
*/
|
|
40
|
+
commit(): Promise<void>;
|
|
37
41
|
}
|
|
38
42
|
/**
|
|
39
|
-
*
|
|
43
|
+
* Low-level adapter interface for event log implementations.
|
|
44
|
+
*
|
|
45
|
+
* Adapters handle the actual communication with the underlying event store
|
|
46
|
+
* (in-memory, Kafka, etc.). Use connectors to create adapter instances.
|
|
40
47
|
*/
|
|
41
|
-
export interface EventLogAdapter {
|
|
42
|
-
/**
|
|
48
|
+
export interface EventLogAdapter<Cursor = string> {
|
|
49
|
+
/**
|
|
50
|
+
* Append an event to a topic.
|
|
51
|
+
*/
|
|
43
52
|
append<T>(topic: string, data: T, options?: AppendOptions): Promise<string>;
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
getCursor(topic: string, consumerGroup: string): Promise<
|
|
54
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Consume events from a topic.
|
|
55
|
+
*/
|
|
56
|
+
consume<T>(topic: string, consumerGroup: string, onBatch: (batch: EventBatch<T, Cursor>) => Promisable<void>, onError: (error: EventLogConsumeFailed) => Promisable<void>, options?: ConsumeOptions<Cursor>): {
|
|
57
|
+
close: () => Promise<void>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Get the last committed cursor for a consumer group.
|
|
61
|
+
*/
|
|
62
|
+
getCursor(topic: string, consumerGroup: string): Promise<Cursor | null>;
|
|
63
|
+
/**
|
|
64
|
+
* Commit a cursor for a consumer group.
|
|
65
|
+
*/
|
|
66
|
+
commitCursor(topic: string, consumerGroup: string, cursor: Cursor): Promise<void>;
|
|
67
|
+
/** Close the adapter and release resources. */
|
|
55
68
|
close(): Promise<void>;
|
|
56
69
|
}
|
|
57
|
-
/** Options for appending
|
|
70
|
+
/** Options for appending events. */
|
|
58
71
|
export interface AppendOptions {
|
|
59
|
-
/**
|
|
72
|
+
/** Key for partitioning and ordering. Events with the same key are ordered. */
|
|
60
73
|
partitionKey?: string;
|
|
61
|
-
/**
|
|
74
|
+
/** Custom metadata to attach to the event. */
|
|
62
75
|
metadata?: Record<string, unknown>;
|
|
63
|
-
/**
|
|
76
|
+
/** Custom timestamp in milliseconds. Defaults to Date.now(). */
|
|
64
77
|
timestamp?: number;
|
|
65
78
|
}
|
|
66
|
-
/** Options for listing events. */
|
|
67
|
-
export interface ListOptions {
|
|
68
|
-
/** Starting sequence number (inclusive) */
|
|
69
|
-
fromSequenceNumber?: number;
|
|
70
|
-
/** Maximum number of events to return */
|
|
71
|
-
limit?: number;
|
|
72
|
-
/** Filter by partition key */
|
|
73
|
-
partitionKey?: string;
|
|
74
|
-
}
|
|
75
79
|
/** Options for consuming events. */
|
|
76
|
-
export interface ConsumeOptions {
|
|
77
|
-
/**
|
|
80
|
+
export interface ConsumeOptions<Cursor = string> {
|
|
81
|
+
/** Abort signal to cancel consumption. */
|
|
78
82
|
signal?: AbortSignal;
|
|
79
|
-
/**
|
|
80
|
-
cursor?:
|
|
81
|
-
/**
|
|
83
|
+
/** Cursor to resume from. If null, starts from the beginning. */
|
|
84
|
+
cursor?: Cursor | null;
|
|
85
|
+
/** Maximum number of events per batch. Defaults to adapter-specific value. */
|
|
82
86
|
batchSize?: number;
|
|
87
|
+
/** Maximum number of batches to buffer. Defaults to adapter-specific value.
|
|
88
|
+
* When the buffer is full, new batches will be dropped and onError will be called with an EventLogConsumeFailed error.
|
|
89
|
+
* @default Infinity
|
|
90
|
+
*/
|
|
91
|
+
bufferSize?: number;
|
|
83
92
|
}
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Factory for creating event log connections.
|
|
95
|
+
*
|
|
96
|
+
* Connectors manage connection lifecycle and produce adapter instances.
|
|
97
|
+
* Use connectors in production code to properly manage resources.
|
|
98
|
+
*/
|
|
99
|
+
export interface EventLogConnector<Cursor = string> {
|
|
100
|
+
/**
|
|
101
|
+
* Connect to the event log.
|
|
102
|
+
*/
|
|
103
|
+
connect(signal?: AbortSignal): Promise<EventLogAdapter<Cursor>>;
|
|
104
|
+
/**
|
|
105
|
+
* End the connector and release all resources.
|
|
106
|
+
*
|
|
107
|
+
* After calling end(), all adapters created by this connector become
|
|
108
|
+
* invalid and subsequent connect() calls will fail.
|
|
109
|
+
*/
|
|
89
110
|
end(): Promise<void>;
|
|
90
111
|
}
|
|
91
|
-
/**
|
|
112
|
+
/** Configuration options for event log implementations. */
|
|
92
113
|
export interface EventLogOptions {
|
|
93
|
-
/** Default partition key
|
|
114
|
+
/** Default partition key for events without explicit keys. */
|
|
94
115
|
defaultPartitionKey?: string;
|
|
95
116
|
}
|
|
96
117
|
//# sourceMappingURL=adapter.d.ts.map
|
package/esm/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"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"}
|
package/esm/adapter.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event log adapter interface for event-sourced systems.
|
|
3
|
-
*
|
|
4
|
-
* Implement this interface to create drivers for specific event stores.
|
|
5
|
-
* The EventLog class wraps adapters with Task/Stream semantics.
|
|
6
|
-
*
|
|
7
|
-
* For connection lifecycle management, use EventLogConnector which produces adapters.
|
|
8
|
-
* The adapter's close() method releases the connection rather than terminating it.
|
|
9
|
-
*/
|
|
10
1
|
export {};
|
package/esm/errors.d.ts
CHANGED
|
@@ -10,13 +10,8 @@ export declare class EventLogAppendFailed extends Error {
|
|
|
10
10
|
name: string;
|
|
11
11
|
constructor(topic: string, message: string, cause?: unknown);
|
|
12
12
|
}
|
|
13
|
-
/** Error thrown when
|
|
14
|
-
export declare class
|
|
15
|
-
name: string;
|
|
16
|
-
constructor(topic: string, sequenceNumber: number, message: string, cause?: unknown);
|
|
17
|
-
}
|
|
18
|
-
/** Error thrown when listing events fails. */
|
|
19
|
-
export declare class EventLogListFailed extends Error {
|
|
13
|
+
/** Error thrown when consuming events fails. */
|
|
14
|
+
export declare class EventLogConsumeFailed extends Error {
|
|
20
15
|
name: string;
|
|
21
16
|
constructor(topic: string, message: string, cause?: unknown);
|
|
22
17
|
}
|
package/esm/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACxC,IAAI,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACxC,IAAI,SAA6B;gBAC9B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAG7C;AAED,mDAAmD;AACnD,qBAAa,oBAAqB,SAAQ,KAAK;IACpC,IAAI,SAAyB;gBAC1B,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAG5D;AAED,gDAAgD;AAChD,qBAAa,qBAAsB,SAAQ,KAAK;IACrC,IAAI,SAA0B;gBAC3B,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAG5D;AAED,mDAAmD;AACnD,qBAAa,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,SAA+B;gBAE1C,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO;CAOlB;AAED,gDAAgD;AAChD,qBAAa,uBAAwB,SAAQ,KAAK;IACvC,IAAI,SAA4B;gBAEvC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO;CAOlB;AAED,+DAA+D;AAC/D,qBAAa,mBAAoB,SAAQ,KAAK;IACnC,IAAI,SAAwB;gBACzB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAG7C"}
|
package/esm/errors.js
CHANGED
|
@@ -8,7 +8,7 @@ export class EventLogConnectionFailed extends Error {
|
|
|
8
8
|
enumerable: true,
|
|
9
9
|
configurable: true,
|
|
10
10
|
writable: true,
|
|
11
|
-
value:
|
|
11
|
+
value: 'EventLogConnectionFailed'
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -20,31 +20,19 @@ export class EventLogAppendFailed extends Error {
|
|
|
20
20
|
enumerable: true,
|
|
21
21
|
configurable: true,
|
|
22
22
|
writable: true,
|
|
23
|
-
value:
|
|
23
|
+
value: 'EventLogAppendFailed'
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
/** Error thrown when
|
|
28
|
-
export class
|
|
29
|
-
constructor(topic, sequenceNumber, message, cause) {
|
|
30
|
-
super(`Failed to get event ${sequenceNumber} from ${topic}: ${message}`, { cause });
|
|
31
|
-
Object.defineProperty(this, "name", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
configurable: true,
|
|
34
|
-
writable: true,
|
|
35
|
-
value: "EventLogGetFailed"
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/** Error thrown when listing events fails. */
|
|
40
|
-
export class EventLogListFailed extends Error {
|
|
27
|
+
/** Error thrown when consuming events fails. */
|
|
28
|
+
export class EventLogConsumeFailed extends Error {
|
|
41
29
|
constructor(topic, message, cause) {
|
|
42
|
-
super(`Failed to
|
|
30
|
+
super(`Failed to consume events from ${topic}: ${message}`, { cause });
|
|
43
31
|
Object.defineProperty(this, "name", {
|
|
44
32
|
enumerable: true,
|
|
45
33
|
configurable: true,
|
|
46
34
|
writable: true,
|
|
47
|
-
value:
|
|
35
|
+
value: 'EventLogConsumeFailed'
|
|
48
36
|
});
|
|
49
37
|
}
|
|
50
38
|
}
|
|
@@ -56,7 +44,7 @@ export class EventLogCommitCursorFailed extends Error {
|
|
|
56
44
|
enumerable: true,
|
|
57
45
|
configurable: true,
|
|
58
46
|
writable: true,
|
|
59
|
-
value:
|
|
47
|
+
value: 'EventLogCommitCursorFailed'
|
|
60
48
|
});
|
|
61
49
|
}
|
|
62
50
|
}
|
|
@@ -68,7 +56,7 @@ export class EventLogGetCursorFailed extends Error {
|
|
|
68
56
|
enumerable: true,
|
|
69
57
|
configurable: true,
|
|
70
58
|
writable: true,
|
|
71
|
-
value:
|
|
59
|
+
value: 'EventLogGetCursorFailed'
|
|
72
60
|
});
|
|
73
61
|
}
|
|
74
62
|
}
|
|
@@ -80,7 +68,7 @@ export class EventLogCloseFailed extends Error {
|
|
|
80
68
|
enumerable: true,
|
|
81
69
|
configurable: true,
|
|
82
70
|
writable: true,
|
|
83
|
-
value:
|
|
71
|
+
value: 'EventLogCloseFailed'
|
|
84
72
|
});
|
|
85
73
|
}
|
|
86
74
|
}
|