Skip to content

Commit da17efe

Browse files
committed
fix(core): convert dates to numbers
1 parent 4b80047 commit da17efe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+202
-300
lines changed

client/lib/ResourceRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export default class ResourceRequest {
3232
return getRequestProperty(this, 'url');
3333
}
3434

35-
public get timestamp(): Promise<string> {
36-
return getRequestProperty(this, 'timestamp');
35+
public get timestamp(): Promise<Date> {
36+
return getRequestProperty(this, 'timestamp').then(x => (x ? new Date(x as number) : null));
3737
}
3838

3939
public get method(): Promise<string> {

client/lib/ResourceResponse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export default class ResourceResponse {
4747
return getResponseProperty(this, 'url');
4848
}
4949

50-
public get timestamp(): Promise<string> {
51-
return getResponseProperty(this, 'timestamp');
50+
public get timestamp(): Promise<Date> {
51+
return getResponseProperty(this, 'timestamp').then(x => (x ? new Date(x as number) : null));
5252
}
5353

5454
public get remoteAddress(): Promise<string> {

client/lib/ScriptInstance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { log } = Log(module);
88
export default class ScriptInstance {
99
public readonly id: string = uuidv1();
1010
public readonly entrypoint: string = process.argv[1];
11-
public readonly startDate: string = new Date().toISOString();
11+
public readonly startDate = new Date().getTime();
1212
private sessionNameCountByName: { [name: string]: number } = {};
1313

1414
public get meta(): IScriptInstanceMeta {

core-interfaces/GenericTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export type CommandId = number;
22
export type ISOTimestamp = string;
3+
export type UnixTimestamp = number;

core-interfaces/ICommandMeta.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ export default interface ICommandMeta {
44
frameId: string;
55
name: string;
66
args?: string;
7-
startDate: string;
8-
endDate?: string;
7+
startDate: number;
8+
endDate?: number;
99
result?: any;
1010
resultType?: string;
1111
}

core-interfaces/IDomChangeEvent.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// tslint:disable-next-line
2-
import type { CommandId, ISOTimestamp } from './GenericTypes';
2+
import type { UnixTimestamp } from './GenericTypes';
33

44
type Idx = number;
55

66
export type IDomChangeEvent = [
7-
CommandId,
87
'newDocument' | 'location' | 'added' | 'removed' | 'text' | 'attribute' | 'property',
98
INodeData,
10-
ISOTimestamp,
9+
UnixTimestamp,
1110
Idx,
1211
];
1312

core-interfaces/IFocusEvent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// tslint:disable-next-line
2-
import { CommandId, ISOTimestamp } from './GenericTypes';
2+
import { UnixTimestamp } from './GenericTypes';
33

44
type NodeId = number;
55
type RelatedNodeId = NodeId;
66
type FocusEventType = 'in' | 'out';
77

8-
export type IFocusEvent = [CommandId, FocusEventType, NodeId, RelatedNodeId, ISOTimestamp];
8+
export type IFocusEvent = [FocusEventType, NodeId, RelatedNodeId, UnixTimestamp];

core-interfaces/ILoadEvent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { CommandId, ISOTimestamp } from './GenericTypes';
1+
import { UnixTimestamp } from './GenericTypes';
22

33
type EventName = string;
44
type Url = string;
55

6-
export type ILoadEvent = [CommandId, EventName, Url, ISOTimestamp];
6+
export type ILoadEvent = [EventName, Url, UnixTimestamp];

core-interfaces/IMouseEvent.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// tslint:disable-next-line
2-
import { CommandId, ISOTimestamp } from './GenericTypes';
2+
import { UnixTimestamp } from './GenericTypes';
33

44
/**
55
* Buttons are a bit field from the DOM
@@ -19,7 +19,6 @@ type RelatedNodeId = NodeId;
1919
type MouseEventType = number;
2020

2121
export type IMouseEvent = [
22-
CommandId,
2322
MouseEventType,
2423
PageX,
2524
PageY,
@@ -28,5 +27,5 @@ export type IMouseEvent = [
2827
Buttons,
2928
NodeId,
3029
RelatedNodeId,
31-
ISOTimestamp,
30+
UnixTimestamp,
3231
];

core-interfaces/IResourceRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import IResourceHeaders from './IResourceHeaders';
22

33
export default interface IResourceRequest {
44
url: string;
5-
timestamp: string;
5+
timestamp: number;
66
headers: IResourceHeaders;
77
trailers?: IResourceHeaders;
88
method: string;

0 commit comments

Comments
 (0)