@fluwa-tool/sdk 1.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.
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Tipos e interfaces do Fluwa SDK
3
+ * Single source of truth para tipagem
4
+ */
5
+ export interface FluwaConfig {
6
+ /** URL do servidor Fluwa */
7
+ serverUrl: string;
8
+ /** Ativar/desativar interceptação */
9
+ enabled: boolean;
10
+ /** Nome da aplicação */
11
+ appName: string;
12
+ /** Modo debug */
13
+ debug?: boolean;
14
+ /** Timeout para requisições (ms) */
15
+ requestTimeout?: number;
16
+ }
17
+ export declare enum HttpMethod {
18
+ GET = "GET",
19
+ POST = "POST",
20
+ PUT = "PUT",
21
+ PATCH = "PATCH",
22
+ DELETE = "DELETE",
23
+ HEAD = "HEAD",
24
+ OPTIONS = "OPTIONS"
25
+ }
26
+ export declare enum RequestSource {
27
+ MOCK = "mock",
28
+ REAL = "real",
29
+ ERROR = "error"
30
+ }
31
+ export interface RequestMetadata {
32
+ id: string;
33
+ method: HttpMethod;
34
+ url: string;
35
+ headers?: Record<string, string>;
36
+ body?: unknown;
37
+ timestamp: string;
38
+ sessionId: string;
39
+ appName: string;
40
+ duration?: number;
41
+ status?: number;
42
+ response?: unknown;
43
+ source: RequestSource;
44
+ mockedScenario?: string;
45
+ error?: string;
46
+ }
47
+ export interface MockRoute {
48
+ method: HttpMethod;
49
+ url: string;
50
+ status: number;
51
+ response: unknown;
52
+ delay?: number;
53
+ description?: string;
54
+ }
55
+ export interface Scenario {
56
+ id: string;
57
+ name: string;
58
+ description?: string;
59
+ routes: MockRoute[];
60
+ createdAt: string;
61
+ updatedAt: string;
62
+ active?: boolean;
63
+ }
64
+ export type SchemaType = 'string' | 'number' | 'boolean' | 'null' | 'array' | 'object' | 'unknown';
65
+ export interface SchemaDifference {
66
+ path: string;
67
+ issue: string;
68
+ mockType?: SchemaType;
69
+ realType?: SchemaType;
70
+ }
71
+ export interface SchemaAlert {
72
+ requestId: string;
73
+ endpoint: string;
74
+ timestamp: string;
75
+ differences: SchemaDifference[];
76
+ mockSchema: unknown;
77
+ realSchema: unknown;
78
+ severity: 'info' | 'warning' | 'error';
79
+ }
80
+ export declare enum WebSocketMessageType {
81
+ INIT_SESSION = "INIT_SESSION",
82
+ SCENARIO_CHANGED = "SCENARIO_CHANGED",
83
+ PING = "PING",
84
+ PONG = "PONG",
85
+ NEW_REQUEST = "NEW_REQUEST",
86
+ REQUEST_UPDATED = "REQUEST_UPDATED",
87
+ SCHEMA_ALERT = "SCHEMA_ALERT"
88
+ }
89
+ export interface WebSocketMessage {
90
+ type: WebSocketMessageType;
91
+ data?: unknown;
92
+ sessionId?: string;
93
+ appName?: string;
94
+ scenario?: string;
95
+ }
96
+ export interface InternalState {
97
+ mockScenario: string | null;
98
+ sessionId: string;
99
+ isInitialized: boolean;
100
+ wsConnected: boolean;
101
+ }
102
+ export interface FluwaError {
103
+ code: string;
104
+ message: string;
105
+ details?: unknown;
106
+ timestamp: string;
107
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Tipos e interfaces do Fluwa SDK
4
+ * Single source of truth para tipagem
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.WebSocketMessageType = exports.RequestSource = exports.HttpMethod = void 0;
8
+ // ============================================
9
+ // REQUISIÇÕES
10
+ // ============================================
11
+ var HttpMethod;
12
+ (function (HttpMethod) {
13
+ HttpMethod["GET"] = "GET";
14
+ HttpMethod["POST"] = "POST";
15
+ HttpMethod["PUT"] = "PUT";
16
+ HttpMethod["PATCH"] = "PATCH";
17
+ HttpMethod["DELETE"] = "DELETE";
18
+ HttpMethod["HEAD"] = "HEAD";
19
+ HttpMethod["OPTIONS"] = "OPTIONS";
20
+ })(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
21
+ var RequestSource;
22
+ (function (RequestSource) {
23
+ RequestSource["MOCK"] = "mock";
24
+ RequestSource["REAL"] = "real";
25
+ RequestSource["ERROR"] = "error";
26
+ })(RequestSource || (exports.RequestSource = RequestSource = {}));
27
+ // ============================================
28
+ // WEBSOCKET
29
+ // ============================================
30
+ var WebSocketMessageType;
31
+ (function (WebSocketMessageType) {
32
+ WebSocketMessageType["INIT_SESSION"] = "INIT_SESSION";
33
+ WebSocketMessageType["SCENARIO_CHANGED"] = "SCENARIO_CHANGED";
34
+ WebSocketMessageType["PING"] = "PING";
35
+ WebSocketMessageType["PONG"] = "PONG";
36
+ WebSocketMessageType["NEW_REQUEST"] = "NEW_REQUEST";
37
+ WebSocketMessageType["REQUEST_UPDATED"] = "REQUEST_UPDATED";
38
+ WebSocketMessageType["SCHEMA_ALERT"] = "SCHEMA_ALERT";
39
+ })(WebSocketMessageType || (exports.WebSocketMessageType = WebSocketMessageType = {}));
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@fluwa-tool/sdk",
3
+ "version": "1.0.0",
4
+ "description": "Fluwa DevTools SDK for network interception and mocking",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "watch": "tsc --watch",
13
+ "clean": "rm -rf dist",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/LeandroS4nt0s/fluwa-tool.git",
19
+ "directory": "sdk"
20
+ },
21
+ "homepage": "https://github.com/LeandroS4nt0s/fluwa-tool#readme",
22
+ "bugs": {
23
+ "url": "https://github.com/LeandroS4nt0s/fluwa-tool/issues"
24
+ },
25
+ "keywords": [
26
+ "network",
27
+ "interception",
28
+ "mocking",
29
+ "devtools",
30
+ "testing",
31
+ "mock-api",
32
+ "interceptor"
33
+ ],
34
+ "author": "jose leandro santos martins <programadorleandrosantos@gmail.com>",
35
+ "license": "MIT",
36
+ "devDependencies": {
37
+ "typescript": "^5.0.0"
38
+ }
39
+ }