Skip to content

Commit a1df68a

Browse files
committed
1 parent bd381de commit a1df68a

12 files changed

+162
-51
lines changed

dist/exceptionless.d.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,10 @@ export interface IRequestInfoCollector {
6868
getRequestInfo(context: EventPluginContext): IRequestInfo;
6969
}
7070
export interface IStorage<T> {
71-
save<T>(path: string, value: T): boolean;
71+
save(path: string, value: T): boolean;
7272
get(path: string): T;
73-
getList(searchPattern?: string, limit?: number): {
74-
path: string;
7573
value: T;
76-
}[];
74+
getList(searchPattern?: string, limit?: number): IStorageItem<T>[];
7775
remove(path: string): void;
7876
}
7977
export interface ISubmissionClient {
@@ -168,12 +166,11 @@ export declare class DefaultEventQueue implements IEventQueue {
168166
}
169167
export declare class InMemoryStorage<T> implements IStorage<T> {
170168
private _items;
171-
save<T>(path: string, value: T): boolean;
169+
private _maxItems;
170+
constructor(maxItems?: number);
171+
save(path: string, value: T): boolean;
172172
get(path: string): T;
173-
getList(searchPattern?: string, limit?: number): {
174-
path: string;
175-
value: T;
176-
}[];
173+
getList(searchPattern?: string, limit?: number): IStorageItem<T>[];
177174
remove(path: string): void;
178175
}
179176
export declare class Utils {
@@ -384,6 +381,11 @@ export declare class SubmissionMethodPlugin implements IEventPlugin {
384381
name: string;
385382
run(context: EventPluginContext, next?: () => void): void;
386383
}
384+
export interface IStorageItem<T> {
385+
created: number;
386+
path: string;
387+
value: T;
388+
}
387389
export declare class SettingsResponse {
388390
success: boolean;
389391
settings: any;

dist/exceptionless.js

Lines changed: 26 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.4.1",
44
"description": "JavaScript client for Exceptionless",
55
"license": "Apache",
6-
"main": "dist/exceptionless.es5.js",
6+
"main": "dist/exceptionless.js",
77
"scripts": {
88
"prepublish": "tsd reinstall -s",
99
"start": "gulp",

src/exceptionless.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { DefaultModuleCollector } from './services/DefaultModuleCollector';
4646
import { DefaultRequestInfoCollector } from './services/DefaultRequestInfoCollector';
4747
import { InMemoryStorage } from './storage/InMemoryStorage';
4848
import { IStorage } from './storage/IStorage';
49+
import { IStorageItem } from './storage/IStorageItem';
4950
import { DefaultSubmissionClient } from './submission/DefaultSubmissionClient';
5051
import { ISubmissionClient } from './submission/ISubmissionClient';
5152
import { NodeSubmissionClient } from './submission/NodeSubmissionClient';

src/queue/DefaultEventQueue-spec.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,25 @@ import { Configuration } from '../configuration/Configuration';
22
import { IEvent } from '../models/IEvent';
33

44
describe('DefaultEventQueue', () => {
5-
it('should enqueue event', () => {
6-
var config = new Configuration({ apiKey:'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', serverUrl:'http://localhost:50000'});
5+
function getConfiguration(): Configuration {
6+
var config:Configuration = new Configuration({
7+
apiKey:'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw',
8+
serverUrl:'http://localhost:50000'
9+
});
10+
711
expect(config.storage.getList().length).toBe(0);
12+
return config;
13+
}
14+
15+
it('should enqueue event', () => {
16+
var config:Configuration = getConfiguration();
817
var event:IEvent = { type: 'log', reference_id: '123454321' };
918
config.queue.enqueue(event);
1019
expect(config.storage.getList().length).toBe(1);
1120
});
1221

1322
it('should process queue', () => {
14-
var config = new Configuration({ apiKey:'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', serverUrl:'http://localhost:50000'});
15-
expect(config.storage.getList().length).toBe(0);
23+
var config:Configuration = getConfiguration();
1624
var event:IEvent = { type: 'log', reference_id: '123454321' };
1725
config.queue.enqueue(event);
1826
expect(config.storage.getList().length).toBe(1);
@@ -26,8 +34,7 @@ describe('DefaultEventQueue', () => {
2634
});
2735

2836
it('should discard event submission', () => {
29-
var config = new Configuration({ apiKey:'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', serverUrl:'http://localhost:50000'});
30-
expect(config.storage.getList().length).toBe(0);
37+
var config:Configuration = getConfiguration();
3138
config.queue.suspendProcessing(1, true);
3239

3340
var event:IEvent = { type: 'log', reference_id: '123454321' };
@@ -36,8 +43,7 @@ describe('DefaultEventQueue', () => {
3643
});
3744

3845
it('should suspend processing', (done) => {
39-
var config = new Configuration({ apiKey:'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', serverUrl:'http://localhost:50000'});
40-
expect(config.storage.getList().length).toBe(0);
46+
var config:Configuration = getConfiguration();
4147
config.queue.suspendProcessing(.0001);
4248

4349
var event:IEvent = { type: 'log', reference_id: '123454321' };

src/storage/IStorage.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
export interface IStorage<T>{
2-
save<T>(path:string, value:T):boolean;
1+
import { IStorageItem } from './IStorageItem';
2+
3+
export interface IStorage<T> {
4+
save(path:string, value:T):boolean;
35
get(path:string):T;
4-
getList(searchPattern?:string, limit?:number):{ path:string, value:T }[];
6+
getList(searchPattern?:string, limit?:number):IStorageItem<T>[];
57
remove(path:string):void;
68
}

src/storage/IStorageItem.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface IStorageItem<T> {
2+
created:number;
3+
path:string;
4+
value:T;
5+
}

0 commit comments

Comments
 (0)