@puth/core 0.0.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/lib/Types.d.ts ADDED
@@ -0,0 +1,127 @@
1
+ /// <reference types="node" />
2
+ export type IPacket = {
3
+ id: string;
4
+ type: string;
5
+ context: IContext;
6
+ timestamp: number;
7
+ };
8
+ export type IViewport = {
9
+ width: number;
10
+ height: number;
11
+ deviceScaleFactor?: number;
12
+ isMobile?: boolean;
13
+ isLandscape?: boolean;
14
+ hasTouch?: boolean;
15
+ };
16
+ export type ICommand = IPacket & {
17
+ type: 'command';
18
+ snapshots: {
19
+ before: ISnapshot | undefined;
20
+ after: ISnapshot | undefined;
21
+ };
22
+ errors: ICommandError[];
23
+ func: string;
24
+ args: string[];
25
+ on: {
26
+ type: string;
27
+ path: [[string, number][] | string][];
28
+ };
29
+ time: {
30
+ started: number;
31
+ elapsed: number;
32
+ took?: number;
33
+ finished: number;
34
+ };
35
+ };
36
+ export declare enum ContextStatus {
37
+ SUCCESSFUL = "successful",
38
+ FAILED = "failed",
39
+ PENDING = "pending"
40
+ }
41
+ export type CommandProps = {
42
+ index: number | undefined;
43
+ command: ICommand;
44
+ showTimings: boolean;
45
+ };
46
+ export type IBlobHandle = {
47
+ blob: Blob;
48
+ url?: string;
49
+ options?: BlobPropertyBag;
50
+ };
51
+ export type IContext = {
52
+ id: string;
53
+ type: string;
54
+ represents: string;
55
+ test: {
56
+ name: string;
57
+ status: ContextStatus.FAILED | ContextStatus.SUCCESSFUL | ContextStatus.PENDING;
58
+ };
59
+ group: string | undefined;
60
+ };
61
+ export type IPageInclude = {
62
+ url: string;
63
+ method: string;
64
+ resourceType: string;
65
+ content: Buffer;
66
+ headers: Record<string, string>;
67
+ };
68
+ export type ISnapshot = {
69
+ type: 'snapshot';
70
+ data?: any;
71
+ version: number;
72
+ url: any;
73
+ viewport: IViewport | null;
74
+ isJavascriptEnabled: boolean;
75
+ includes?: IPageInclude[];
76
+ };
77
+ export declare enum SnapshotMode {
78
+ FRAME = "frame",
79
+ DOM = "dom"
80
+ }
81
+ export declare enum SnapshotState {
82
+ BEFORE = "before",
83
+ AFTER = "after",
84
+ REPLAY = "replay"
85
+ }
86
+ export type IResponse = IPacket & {
87
+ type: 'response';
88
+ time: number;
89
+ isNavigationRequest: boolean;
90
+ url: string;
91
+ resourceType: string;
92
+ method: string;
93
+ headers: {
94
+ [key: string]: string;
95
+ };
96
+ content: Uint8Array;
97
+ };
98
+ export type ILogLocation = {
99
+ url?: string;
100
+ lineNumber?: number;
101
+ columnNumber?: number;
102
+ };
103
+ export type IConsoleMessageType = 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | 'trace' | 'clear' | 'startGroup' | 'startGroupCollapsed' | 'endGroup' | 'assert' | 'profile' | 'profileEnd' | 'count' | 'timeEnd' | 'verbose';
104
+ export type ILog = {
105
+ type: 'log';
106
+ context: {};
107
+ time: number;
108
+ messageType: IConsoleMessageType;
109
+ args: any[];
110
+ location: ILogLocation;
111
+ text: string;
112
+ stackTrace: ILogLocation[];
113
+ };
114
+ export type ICommandError = {
115
+ type: string;
116
+ specific?: string;
117
+ error?: Error;
118
+ expectation?: IExpectation;
119
+ time: number;
120
+ };
121
+ export type IExpectation = {
122
+ test: (value: any) => boolean;
123
+ message: string;
124
+ };
125
+ export type IExpects = {
126
+ [key: string]: IExpectation;
127
+ };
package/lib/Types.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SnapshotState = exports.SnapshotMode = exports.ContextStatus = void 0;
4
+ var ContextStatus;
5
+ (function (ContextStatus) {
6
+ ContextStatus["SUCCESSFUL"] = "successful";
7
+ ContextStatus["FAILED"] = "failed";
8
+ ContextStatus["PENDING"] = "pending";
9
+ })(ContextStatus = exports.ContextStatus || (exports.ContextStatus = {}));
10
+ var SnapshotMode;
11
+ (function (SnapshotMode) {
12
+ SnapshotMode["FRAME"] = "frame";
13
+ SnapshotMode["DOM"] = "dom";
14
+ })(SnapshotMode = exports.SnapshotMode || (exports.SnapshotMode = {}));
15
+ var SnapshotState;
16
+ (function (SnapshotState) {
17
+ SnapshotState["BEFORE"] = "before";
18
+ SnapshotState["AFTER"] = "after";
19
+ SnapshotState["REPLAY"] = "replay";
20
+ })(SnapshotState = exports.SnapshotState || (exports.SnapshotState = {}));
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './Types';
package/lib/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Types"), exports);
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@puth/core",
3
+ "main": "./lib/index.js",
4
+ "version": "0.0.0",
5
+ "scripts": {
6
+ "build": "tsc --build",
7
+ "prepublishOnly": "npm run build"
8
+ },
9
+ "files": [
10
+ "lib/"
11
+ ]
12
+ }