@teardown/react-native 1.2.39 → 2.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/README.md +75 -7
- package/package.json +65 -47
- package/src/clients/api/api.client.ts +55 -0
- package/src/clients/api/index.ts +1 -0
- package/src/clients/device/device.adpater-interface.ts +57 -0
- package/src/clients/device/device.client.test.ts +195 -0
- package/src/clients/device/device.client.ts +69 -0
- package/src/clients/device/expo-adapter.ts +128 -0
- package/src/clients/device/index.ts +4 -0
- package/src/clients/force-update/force-update.client.test.ts +296 -0
- package/src/clients/force-update/force-update.client.ts +224 -0
- package/src/clients/force-update/index.ts +1 -0
- package/src/clients/identity/identity.client.test.ts +454 -0
- package/src/clients/identity/identity.client.ts +249 -0
- package/src/clients/identity/index.ts +1 -0
- package/src/clients/logging/index.ts +1 -0
- package/src/clients/logging/logging.client.ts +92 -0
- package/src/clients/notifications/notifications.client.ts +10 -0
- package/src/clients/storage/index.ts +1 -0
- package/src/clients/storage/mmkv-adapter.ts +23 -0
- package/src/clients/storage/storage.client.ts +75 -0
- package/src/clients/utils/index.ts +1 -0
- package/src/clients/utils/utils.client.ts +75 -0
- package/src/components/ui/button.tsx +0 -0
- package/src/components/ui/input.tsx +0 -0
- package/src/contexts/index.ts +1 -0
- package/src/contexts/teardown.context.ts +17 -0
- package/src/exports/expo.ts +1 -0
- package/src/exports/index.ts +16 -0
- package/src/exports/mmkv.ts +1 -0
- package/src/hooks/use-force-update.ts +38 -0
- package/src/hooks/use-session.ts +26 -0
- package/src/providers/teardown.provider.tsx +28 -0
- package/src/teardown.core.ts +76 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -3
- package/dist/components/index.js.map +0 -1
- package/dist/components/teardown-logo.d.ts +0 -4
- package/dist/components/teardown-logo.js +0 -35
- package/dist/components/teardown-logo.js.map +0 -1
- package/dist/containers/index.d.ts +0 -1
- package/dist/containers/index.js +0 -18
- package/dist/containers/index.js.map +0 -1
- package/dist/containers/teardown.container.d.ts +0 -8
- package/dist/containers/teardown.container.js +0 -26
- package/dist/containers/teardown.container.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/plugins/http.plugin.d.ts +0 -23
- package/dist/plugins/http.plugin.js +0 -145
- package/dist/plugins/http.plugin.js.map +0 -1
- package/dist/plugins/index.d.ts +0 -2
- package/dist/plugins/index.js +0 -20
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/logging.plugin.d.ts +0 -9
- package/dist/plugins/logging.plugin.js +0 -36
- package/dist/plugins/logging.plugin.js.map +0 -1
- package/dist/plugins/websocket.plugin.d.ts +0 -1
- package/dist/plugins/websocket.plugin.js +0 -108
- package/dist/plugins/websocket.plugin.js.map +0 -1
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.js +0 -18
- package/dist/services/index.js.map +0 -1
- package/dist/services/teardown.service.d.ts +0 -10
- package/dist/services/teardown.service.js +0 -22
- package/dist/services/teardown.service.js.map +0 -1
- package/dist/teardown.client.d.ts +0 -41
- package/dist/teardown.client.js +0 -60
- package/dist/teardown.client.js.map +0 -1
- package/dist/utils/log.d.ts +0 -5
- package/dist/utils/log.js +0 -9
- package/dist/utils/log.js.map +0 -1
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { TeardownClient } from "../teardown.client";
|
|
2
|
-
import { type DefaultPluginOptions, Plugin } from "../teardown.client";
|
|
3
|
-
export type HTTPPluginOptions = DefaultPluginOptions<{
|
|
4
|
-
ignoreURLs?: RegExp[];
|
|
5
|
-
}>;
|
|
6
|
-
export declare class HTTPPlugin extends Plugin {
|
|
7
|
-
private client;
|
|
8
|
-
private requests;
|
|
9
|
-
private ignoreURLs;
|
|
10
|
-
constructor(options?: HTTPPluginOptions);
|
|
11
|
-
install(client: TeardownClient<any>): void;
|
|
12
|
-
enableXHRInterceptor(): void;
|
|
13
|
-
disableInterception(): void;
|
|
14
|
-
private shouldIgnoreURL;
|
|
15
|
-
private xhrOpenCallback;
|
|
16
|
-
private xhrRequestHeaderCallback;
|
|
17
|
-
private xhrSendCallback;
|
|
18
|
-
private serializeRequestBody;
|
|
19
|
-
private xhrResponseCallback;
|
|
20
|
-
private parseResponseHeaders;
|
|
21
|
-
private parseResponseBody;
|
|
22
|
-
private sendHTTPEvent;
|
|
23
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HTTPPlugin = void 0;
|
|
7
|
-
const util_1 = require("@teardown/util");
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
const XHRInterceptor_1 = __importDefault(require("react-native/Libraries/Network/XHRInterceptor"));
|
|
10
|
-
const teardown_client_1 = require("../teardown.client");
|
|
11
|
-
class HTTPPlugin extends teardown_client_1.Plugin {
|
|
12
|
-
client = null;
|
|
13
|
-
requests = new Map();
|
|
14
|
-
ignoreURLs;
|
|
15
|
-
constructor(options = {}) {
|
|
16
|
-
super({
|
|
17
|
-
...options,
|
|
18
|
-
key: "HTTPPlugin",
|
|
19
|
-
});
|
|
20
|
-
this.ignoreURLs = options.ignoreURLs || [];
|
|
21
|
-
}
|
|
22
|
-
install(client) {
|
|
23
|
-
this.client = client;
|
|
24
|
-
this.enableXHRInterceptor();
|
|
25
|
-
}
|
|
26
|
-
enableXHRInterceptor() {
|
|
27
|
-
// noinspection TypeScriptUnresolvedReference
|
|
28
|
-
if (XHRInterceptor_1.default.isInterceptorEnabled()) {
|
|
29
|
-
// this.logger.info(
|
|
30
|
-
// 'XHRInterceptor is already enabled by another library. Disable it or run this plugin first when your app loads.',
|
|
31
|
-
// );
|
|
32
|
-
this.logger.info("XHRInterceptor is already enabled. Teardown overrides the existing interceptor - other plugins may not work as expected.");
|
|
33
|
-
this.disableInterception();
|
|
34
|
-
}
|
|
35
|
-
this.logger.info("Enabling XHRInterceptor");
|
|
36
|
-
// noinspection TypeScriptUnresolvedReference
|
|
37
|
-
XHRInterceptor_1.default.setOpenCallback(this.xhrOpenCallback);
|
|
38
|
-
// noinspection TypeScriptUnresolvedReference
|
|
39
|
-
XHRInterceptor_1.default.setRequestHeaderCallback(this.xhrRequestHeaderCallback);
|
|
40
|
-
// noinspection TypeScriptUnresolvedReference
|
|
41
|
-
XHRInterceptor_1.default.setSendCallback(this.xhrSendCallback);
|
|
42
|
-
// noinspection TypeScriptUnresolvedReference
|
|
43
|
-
XHRInterceptor_1.default.setResponseCallback(this.xhrResponseCallback);
|
|
44
|
-
// noinspection TypeScriptUnresolvedReference
|
|
45
|
-
XHRInterceptor_1.default.enableInterception();
|
|
46
|
-
this.logger.info("XHRInterceptor enabled");
|
|
47
|
-
}
|
|
48
|
-
disableInterception() {
|
|
49
|
-
this.logger.info("Disabling XHRInterceptor");
|
|
50
|
-
XHRInterceptor_1.default.disableInterception();
|
|
51
|
-
this.requests.clear();
|
|
52
|
-
this.logger.info("XHRInterceptor disabled");
|
|
53
|
-
}
|
|
54
|
-
shouldIgnoreURL(url) {
|
|
55
|
-
return this.ignoreURLs.some((ignoreRegex) => ignoreRegex.test(url));
|
|
56
|
-
}
|
|
57
|
-
xhrOpenCallback = (method, url, xhr) => {
|
|
58
|
-
if (this.shouldIgnoreURL(url)) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const requestId = util_1.Util.generateUUID();
|
|
62
|
-
const HTTPRequestInfo = {
|
|
63
|
-
id: requestId,
|
|
64
|
-
type: "XMLHttpRequest",
|
|
65
|
-
url,
|
|
66
|
-
method: method,
|
|
67
|
-
requestHeaders: { "TD-Request-ID": requestId },
|
|
68
|
-
startTime: performance.now(),
|
|
69
|
-
updatedAt: performance.now(),
|
|
70
|
-
};
|
|
71
|
-
this.requests.set(xhr._id, HTTPRequestInfo);
|
|
72
|
-
};
|
|
73
|
-
xhrRequestHeaderCallback = (header, value, xhr) => {
|
|
74
|
-
const request = this.requests.get(xhr._id);
|
|
75
|
-
if (request) {
|
|
76
|
-
request.requestHeaders[header] = value;
|
|
77
|
-
request.updatedAt = performance.now();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
xhrSendCallback = (data, xhr) => {
|
|
81
|
-
const request = this.requests.get(xhr._id);
|
|
82
|
-
if (request) {
|
|
83
|
-
xhr.setRequestHeader("TD-Request-ID", request.id);
|
|
84
|
-
request.dataSent = this.serializeRequestBody(data);
|
|
85
|
-
request.updatedAt = performance.now();
|
|
86
|
-
this.sendHTTPEvent(request);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
serializeRequestBody(data) {
|
|
90
|
-
if (typeof data === "string") {
|
|
91
|
-
return data;
|
|
92
|
-
}
|
|
93
|
-
try {
|
|
94
|
-
return JSON.stringify(data);
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
this.logger.warn("Failed to stringify request body", error);
|
|
98
|
-
return "[Unable to serialize request body]";
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
xhrResponseCallback = (status, timeout, response, responseURL, responseType, xhr) => {
|
|
102
|
-
const request = this.requests.get(xhr._id);
|
|
103
|
-
if (request) {
|
|
104
|
-
request.status = status;
|
|
105
|
-
request.responseHeaders = this.parseResponseHeaders(xhr.getAllResponseHeaders());
|
|
106
|
-
request.response = this.parseResponseBody(response, responseType);
|
|
107
|
-
request.responseURL = responseURL;
|
|
108
|
-
request.responseType = responseType;
|
|
109
|
-
request.timeout = timeout;
|
|
110
|
-
request.endTime = performance.now();
|
|
111
|
-
request.updatedAt = performance.now();
|
|
112
|
-
this.sendHTTPEvent(request);
|
|
113
|
-
this.requests.delete(xhr._id);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
parseResponseHeaders(headersString) {
|
|
117
|
-
const headersObject = {};
|
|
118
|
-
if (headersString) {
|
|
119
|
-
const headerPairs = headersString.trim().split(/[\r\n]+/);
|
|
120
|
-
headerPairs.forEach((headerPair) => {
|
|
121
|
-
const [key, value] = headerPair.split(": ");
|
|
122
|
-
headersObject[key] = value;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
return headersObject;
|
|
126
|
-
}
|
|
127
|
-
parseResponseBody(response, responseType) {
|
|
128
|
-
if (responseType === "json") {
|
|
129
|
-
try {
|
|
130
|
-
return JSON.stringify(JSON.parse(response), null, 2);
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
this.logger.warn("Failed to parse JSON response", error);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return response;
|
|
137
|
-
}
|
|
138
|
-
sendHTTPEvent(httpRequestInfo) {
|
|
139
|
-
// if (this.client?.debugger) {
|
|
140
|
-
// this.client.debugger.send("NETWORK_HTTP_REQUEST", httpRequestInfo);
|
|
141
|
-
// }
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.HTTPPlugin = HTTPPlugin;
|
|
145
|
-
//# sourceMappingURL=http.plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.plugin.js","sourceRoot":"","sources":["../../src/plugins/http.plugin.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AACtC,aAAa;AACb,mGAA2E;AAE3E,wDAAuE;AAUvE,MAAa,UAAW,SAAQ,wBAAM;IAC7B,MAAM,GAA+B,IAAI,CAAC;IAC1C,QAAQ,GAAqB,IAAI,GAAG,EAAE,CAAC;IACvC,UAAU,CAAW;IAE7B,YAAY,UAA6B,EAAE;QAC1C,KAAK,CAAC;YACL,GAAG,OAAO;YACV,GAAG,EAAE,YAAY;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;IAC5C,CAAC;IAED,OAAO,CAAC,MAA2B;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;Q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AC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;IACF,CAAC,CAAC;IAEM,oBAAoB,CAAC,aAAqB;QACjD,MAAM,aAAa,GAA2B,EAAE,CAAC;QACjD,IAAI,aAAa,EAAE,CAAC;YACnB,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1D,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;gBAClC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC5C,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAC5B,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,aAAa,CAAC;IACtB,CAAC;IAEO,iBAAiB,CACxB,QAAgB,EAChB,YAAwC;QAExC,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACJ,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACtD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;YAC1D,CAAC;QACF,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEO,aAAa,CAAC,eAAoB;QACzC,+BAA+B;QAC/B,uEAAuE;QACvE,IAAI;IACL,CAAC;CACD;AA5KD,gCA4KC"}
|
package/dist/plugins/index.d.ts
DELETED
package/dist/plugins/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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("./http.plugin"), exports);
|
|
18
|
-
// export * from './websocket.plugin';
|
|
19
|
-
__exportStar(require("./logging.plugin"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,sCAAsC;AACtC,mDAAiC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { IPlugin, TeardownClient } from "../teardown.client";
|
|
2
|
-
export declare class LoggingPlugin implements IPlugin {
|
|
3
|
-
private client;
|
|
4
|
-
private originalConsoleMethods;
|
|
5
|
-
private createConsoleProxy;
|
|
6
|
-
constructor();
|
|
7
|
-
install(client: TeardownClient<any>): void;
|
|
8
|
-
uninstall(): void;
|
|
9
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LoggingPlugin = void 0;
|
|
4
|
-
const methods = ["log", "warn", "error", "debug", "info"];
|
|
5
|
-
class LoggingPlugin {
|
|
6
|
-
client = null;
|
|
7
|
-
originalConsoleMethods = {};
|
|
8
|
-
createConsoleProxy(method) {
|
|
9
|
-
const original = console[method];
|
|
10
|
-
return new Proxy(original, {
|
|
11
|
-
apply: (target, thisArg, args) => {
|
|
12
|
-
target.apply(thisArg, args);
|
|
13
|
-
// this.client?.debugger?.send("CONSOLE_LOG", {
|
|
14
|
-
// type: method,
|
|
15
|
-
// args,
|
|
16
|
-
// });
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
constructor() {
|
|
21
|
-
methods.forEach((method) => {
|
|
22
|
-
this.originalConsoleMethods[method] = console[method];
|
|
23
|
-
console[method] = this.createConsoleProxy(method);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
install(client) {
|
|
27
|
-
this.client = client;
|
|
28
|
-
}
|
|
29
|
-
uninstall() {
|
|
30
|
-
methods.forEach((method) => {
|
|
31
|
-
console[method] = this.originalConsoleMethods[method];
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.LoggingPlugin = LoggingPlugin;
|
|
36
|
-
//# sourceMappingURL=logging.plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logging.plugin.js","sourceRoot":"","sources":["../../src/plugins/logging.plugin.ts"],"names":[],"mappings":";;;AAGA,MAAM,OAAO,GAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAE5E,MAAa,aAAa;IACjB,MAAM,GAA+B,IAAI,CAAC;IAC1C,sBAAsB,GAC7B,EAAS,CAAC;IAEH,kBAAkB,CAAC,MAAsB;QAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE;YAC1B,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;gBAChC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC5B,+CAA+C;gBAC/C,iBAAiB;gBACjB,SAAS;gBACT,MAAM;YACP,CAAC;SACD,CAAC,CAAC;IACJ,CAAC;IAED;QACC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC1B,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;YACtD,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,MAA2B;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,SAAS;QACR,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC1B,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAlCD,sCAkCC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
// export class WebSocketPlugin implements IPlugin {
|
|
5
|
-
// private logger = new Logger("WebSocketPlugin");
|
|
6
|
-
// private client: TeardownClient<any> | null = null;
|
|
7
|
-
// private sockets: Map<string, WebSocketInfo> = new Map();
|
|
8
|
-
// constructor() {
|
|
9
|
-
// this.setupWebSocketInterceptor();
|
|
10
|
-
// }
|
|
11
|
-
// install(client: TeardownClient<any>): void {
|
|
12
|
-
// this.client = client;
|
|
13
|
-
// }
|
|
14
|
-
// private setupWebSocketInterceptor(): void {
|
|
15
|
-
// if (WebSocketInterceptor.isInterceptorEnabled()) {
|
|
16
|
-
// this.logger.warn(
|
|
17
|
-
// "WebSocketInterceptor is already enabled by another library, disable it or run this first when your app loads",
|
|
18
|
-
// );
|
|
19
|
-
// this.disableInterception();
|
|
20
|
-
// }
|
|
21
|
-
// WebSocketInterceptor.setConnectCallback(this.wsConnectCallback);
|
|
22
|
-
// WebSocketInterceptor.setSendCallback(this.wsSendCallback);
|
|
23
|
-
// WebSocketInterceptor.setOnMessageCallback(this.wsOnMessageCallback);
|
|
24
|
-
// WebSocketInterceptor.setOnCloseCallback(this.wsOnCloseCallback);
|
|
25
|
-
// WebSocketInterceptor.enableInterception();
|
|
26
|
-
// this.logger.log("WebSocketInterceptor enabled");
|
|
27
|
-
// }
|
|
28
|
-
// private wsConnectCallback = (
|
|
29
|
-
// url: string,
|
|
30
|
-
// protocols: string | string[] | undefined,
|
|
31
|
-
// options: Object,
|
|
32
|
-
// socketId: string,
|
|
33
|
-
// ): void => {
|
|
34
|
-
// const requestId = Util.generateUUID();
|
|
35
|
-
// const socketInfo: WebSocketInfo = {
|
|
36
|
-
// id: requestId,
|
|
37
|
-
// url,
|
|
38
|
-
// protocols,
|
|
39
|
-
// timestamp: performance.now(),
|
|
40
|
-
// };
|
|
41
|
-
// this.sockets.set(socketId, socketInfo);
|
|
42
|
-
// this.sendOpenEvent(socketInfo);
|
|
43
|
-
// };
|
|
44
|
-
// private wsSendCallback = (
|
|
45
|
-
// data: string | ArrayBuffer | ArrayBufferView,
|
|
46
|
-
// socketId: string,
|
|
47
|
-
// ): void => {
|
|
48
|
-
// const socket = this.sockets.get(socketId);
|
|
49
|
-
// if (socket) {
|
|
50
|
-
// const messageInfo: WebSocketMessageInfo = {
|
|
51
|
-
// id: socket.id,
|
|
52
|
-
// data: "", // TODO: Currently getting array buffer length errors here when sending data
|
|
53
|
-
// timestamp: performance.now(),
|
|
54
|
-
// direction: "sent",
|
|
55
|
-
// };
|
|
56
|
-
// console.log("messageInfo", messageInfo);
|
|
57
|
-
// // this.sendMessageEvent(messageInfo);
|
|
58
|
-
// }
|
|
59
|
-
// };
|
|
60
|
-
// private wsOnMessageCallback = (
|
|
61
|
-
// socketId: string,
|
|
62
|
-
// message: WebSocketMessageEvent,
|
|
63
|
-
// ): void => {
|
|
64
|
-
// const socket = this.sockets.get(socketId);
|
|
65
|
-
// if (socket) {
|
|
66
|
-
// const messageInfo: WebSocketMessageInfo = {
|
|
67
|
-
// id: socket.id,
|
|
68
|
-
// data: "", // TODO: Currently getting array buffer length errors here when sending data
|
|
69
|
-
// timestamp: performance.now(),
|
|
70
|
-
// direction: "received",
|
|
71
|
-
// };
|
|
72
|
-
// this.sendMessageEvent(messageInfo);
|
|
73
|
-
// }
|
|
74
|
-
// };
|
|
75
|
-
// private wsOnCloseCallback = (socketId: string, event: any): void => {
|
|
76
|
-
// const socket = this.sockets.get(socketId);
|
|
77
|
-
// if (socket) {
|
|
78
|
-
// const closeInfo: WebSocketCloseInfo = {
|
|
79
|
-
// id: socket.id,
|
|
80
|
-
// code: event.code,
|
|
81
|
-
// reason: event.reason,
|
|
82
|
-
// timestamp: performance.now(),
|
|
83
|
-
// };
|
|
84
|
-
// this.sendCloseEvent(closeInfo);
|
|
85
|
-
// this.sockets.delete(socketId);
|
|
86
|
-
// }
|
|
87
|
-
// };
|
|
88
|
-
// private sendOpenEvent(info: WebSocketInfo): void {
|
|
89
|
-
// // if (this.client && this.client.debugger) {
|
|
90
|
-
// // this.client.debugger.send("NETWORK_WEBSOCKET_OPEN", info);
|
|
91
|
-
// // }
|
|
92
|
-
// }
|
|
93
|
-
// private sendMessageEvent(info: WebSocketMessageInfo): void {
|
|
94
|
-
// // if (this.client && this.client.debugger) {
|
|
95
|
-
// // this.client.debugger.send("NETWORK_WEBSOCKET_MESSAGE", info);
|
|
96
|
-
// // }
|
|
97
|
-
// }
|
|
98
|
-
// private sendCloseEvent(info: WebSocketCloseInfo): void {
|
|
99
|
-
// // if (this.client && this.client.debugger) {
|
|
100
|
-
// // this.client.debugger.send("NETWORK_WEBSOCKET_CLOSE", info);
|
|
101
|
-
// // }
|
|
102
|
-
// }
|
|
103
|
-
// disableInterception(): void {
|
|
104
|
-
// WebSocketInterceptor.disableInterception();
|
|
105
|
-
// this.sockets.clear();
|
|
106
|
-
// }
|
|
107
|
-
// }
|
|
108
|
-
//# sourceMappingURL=websocket.plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.plugin.js","sourceRoot":"","sources":["../../src/plugins/websocket.plugin.ts"],"names":[],"mappings":";AAAA,aAAa;;AAEb,oDAAoD;AACpD,mDAAmD;AACnD,sDAAsD;AACtD,4DAA4D;AAE5D,mBAAmB;AACnB,sCAAsC;AACtC,KAAK;AAEL,gDAAgD;AAChD,0BAA0B;AAC1B,KAAK;AAEL,+CAA+C;AAC/C,uDAAuD;AACvD,uBAAuB;AACvB,sHAAsH;AACtH,QAAQ;AACR,iCAAiC;AACjC,MAAM;AAEN,qEAAqE;AACrE,+DAA+D;AAC/D,yEAAyE;AACzE,qEAAqE;AAErE,+CAA+C;AAE/C,qDAAqD;AACrD,KAAK;AAEL,iCAAiC;AACjC,iBAAiB;AACjB,8CAA8C;AAC9C,qBAAqB;AACrB,sBAAsB;AACtB,gBAAgB;AAChB,2CAA2C;AAC3C,wCAAwC;AACxC,oBAAoB;AACpB,UAAU;AACV,gBAAgB;AAChB,mCAAmC;AACnC,OAAO;AACP,4CAA4C;AAC5C,oCAAoC;AACpC,MAAM;AAEN,8BAA8B;AAC9B,kDAAkD;AAClD,sBAAsB;AACtB,gBAAgB;AAChB,+CAA+C;AAC/C,kBAAkB;AAClB,iDAAiD;AACjD,qBAAqB;AACrB,6FAA6F;AAC7F,oCAAoC;AACpC,yBAAyB;AACzB,QAAQ;AACR,8CAA8C;AAC9C,4CAA4C;AAC5C,MAAM;AACN,MAAM;AAEN,mCAAmC;AACnC,sBAAsB;AACtB,oCAAoC;AACpC,gBAAgB;AAChB,+CAA+C;AAC/C,kBAAkB;AAClB,iDAAiD;AACjD,qBAAqB;AACrB,6FAA6F;AAC7F,oCAAoC;AACpC,6BAA6B;AAC7B,QAAQ;AACR,yCAAyC;AACzC,MAAM;AACN,MAAM;AAEN,yEAAyE;AACzE,+CAA+C;AAC/C,kBAAkB;AAClB,6CAA6C;AAC7C,qBAAqB;AACrB,wBAAwB;AACxB,4BAA4B;AAC5B,oCAAoC;AACpC,QAAQ;AACR,qCAAqC;AACrC,oCAAoC;AACpC,MAAM;AACN,MAAM;AAEN,sDAAsD;AACtD,kDAAkD;AAClD,mEAAmE;AACnE,SAAS;AACT,KAAK;AAEL,gEAAgE;AAChE,kDAAkD;AAClD,sEAAsE;AACtE,SAAS;AACT,KAAK;AAEL,4DAA4D;AAC5D,kDAAkD;AAClD,oEAAoE;AACpE,SAAS;AACT,KAAK;AAEL,iCAAiC;AACjC,gDAAgD;AAChD,0BAA0B;AAC1B,KAAK;AACL,IAAI"}
|
package/dist/services/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './teardown.service';
|
package/dist/services/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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("./teardown.service"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PluginTuple, TeardownClient } from "../teardown.client";
|
|
2
|
-
export type TeardownServiceContextType<T extends readonly PluginTuple[]> = {
|
|
3
|
-
client: TeardownClient<T>;
|
|
4
|
-
};
|
|
5
|
-
export declare const TeardownService: {
|
|
6
|
-
Context: any;
|
|
7
|
-
Provider: any;
|
|
8
|
-
useState<T extends readonly PluginTuple[]>(): TeardownServiceContextType<T>;
|
|
9
|
-
useProvidedState<T extends readonly PluginTuple[]>(client: TeardownClient<T>): TeardownServiceContextType<T>;
|
|
10
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TeardownService = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const Context = (0, react_1.createContext)(null);
|
|
6
|
-
exports.TeardownService = {
|
|
7
|
-
Context,
|
|
8
|
-
Provider: Context.Provider,
|
|
9
|
-
useState() {
|
|
10
|
-
const state = (0, react_1.useContext)(Context);
|
|
11
|
-
if (state == null) {
|
|
12
|
-
throw new Error("TeardownService not found");
|
|
13
|
-
}
|
|
14
|
-
return state;
|
|
15
|
-
},
|
|
16
|
-
useProvidedState(client) {
|
|
17
|
-
return {
|
|
18
|
-
client
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=teardown.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"teardown.service.js","sourceRoot":"","sources":["../../src/services/teardown.service.ts"],"names":[],"mappings":";;;AAAA,iCAAgD;AAOhD,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAyC,IAAI,CAAC,CAAC;AAE/D,QAAA,eAAe,GAAG;IAC3B,OAAO;IACP,QAAQ,EAAE,OAAO,CAAC,QAAQ;IAE1B,QAAQ;QACJ,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC;QAClC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,KAAsC,CAAA;IACjD,CAAC;IAED,gBAAgB,CAAmC,MAAyB;QACxE,OAAO;YACZ,MAAM;SACA,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Logger } from "@teardown/logger";
|
|
2
|
-
export interface IPlugin {
|
|
3
|
-
install?(client: TeardownClient<any>): void;
|
|
4
|
-
uninstall?(): void;
|
|
5
|
-
}
|
|
6
|
-
export type DefaultPluginOptions<T> = {
|
|
7
|
-
debug?: boolean;
|
|
8
|
-
} & T;
|
|
9
|
-
export type PluginOptions<T> = DefaultPluginOptions<{
|
|
10
|
-
key: string;
|
|
11
|
-
}> & T;
|
|
12
|
-
export declare abstract class Plugin<T = any> {
|
|
13
|
-
protected logger: Logger;
|
|
14
|
-
protected constructor(options: PluginOptions<T>);
|
|
15
|
-
install?(client: TeardownClient<any>): void;
|
|
16
|
-
uninstall?(): void;
|
|
17
|
-
}
|
|
18
|
-
export type PluginTuple = readonly [string, IPlugin];
|
|
19
|
-
type InferPluginFromTuple<T extends PluginTuple> = {
|
|
20
|
-
[K in T[0]]: Omit<T[1], "install" | "uninstall">;
|
|
21
|
-
};
|
|
22
|
-
type InferPluginsFromArray<T extends readonly PluginTuple[]> = UnionToIntersection<InferPluginFromTuple<T[number]>>;
|
|
23
|
-
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
24
|
-
export type TeardownClientOptions<T extends readonly PluginTuple[]> = {
|
|
25
|
-
plugins?: T;
|
|
26
|
-
loggingEnabled?: boolean;
|
|
27
|
-
};
|
|
28
|
-
export declare class TeardownClient<T extends readonly PluginTuple[]> {
|
|
29
|
-
readonly options?: TeardownClientOptions<T>;
|
|
30
|
-
logger: Logger;
|
|
31
|
-
private readonly plugins;
|
|
32
|
-
api: InferPluginsFromArray<T>;
|
|
33
|
-
constructor(options?: TeardownClientOptions<T>);
|
|
34
|
-
private installPlugin;
|
|
35
|
-
private uninstallPlugin;
|
|
36
|
-
private uninstallAllPlugins;
|
|
37
|
-
private reinstallPlugins;
|
|
38
|
-
shutdown(): void;
|
|
39
|
-
}
|
|
40
|
-
export declare const createTeardownClient: <Plugins extends readonly PluginTuple[]>(plugins: Plugins) => TeardownClient<Plugins>;
|
|
41
|
-
export {};
|
package/dist/teardown.client.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTeardownClient = exports.TeardownClient = exports.Plugin = void 0;
|
|
4
|
-
const logger_1 = require("@teardown/logger");
|
|
5
|
-
class Plugin {
|
|
6
|
-
logger;
|
|
7
|
-
constructor(options) {
|
|
8
|
-
this.logger = new logger_1.Logger(options.key, options.debug ?? false);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.Plugin = Plugin;
|
|
12
|
-
class TeardownClient {
|
|
13
|
-
options;
|
|
14
|
-
logger;
|
|
15
|
-
plugins = new Map();
|
|
16
|
-
api = {};
|
|
17
|
-
constructor(options) {
|
|
18
|
-
this.options = options;
|
|
19
|
-
this.logger = new logger_1.Logger("TeardownClient", options?.loggingEnabled ?? false);
|
|
20
|
-
// options?.plugins?.forEach(([key, plugin]) => {
|
|
21
|
-
// this.plugins.set(key, plugin);
|
|
22
|
-
// });
|
|
23
|
-
this.installPlugin();
|
|
24
|
-
}
|
|
25
|
-
installPlugin() {
|
|
26
|
-
this.logger.log("Installing plugins");
|
|
27
|
-
this.plugins.forEach((plugin, key) => {
|
|
28
|
-
plugin.install?.(this);
|
|
29
|
-
this.api[key] = plugin;
|
|
30
|
-
});
|
|
31
|
-
this.logger.log("Plugins installed");
|
|
32
|
-
}
|
|
33
|
-
uninstallPlugin(key) {
|
|
34
|
-
const plugin = this.plugins.get(key);
|
|
35
|
-
if (plugin) {
|
|
36
|
-
plugin.uninstall?.();
|
|
37
|
-
this.plugins.delete(key);
|
|
38
|
-
delete this.api[key];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
uninstallAllPlugins() {
|
|
42
|
-
this.plugins.forEach((_, key) => this.uninstallPlugin(key));
|
|
43
|
-
}
|
|
44
|
-
reinstallPlugins() {
|
|
45
|
-
this.uninstallAllPlugins();
|
|
46
|
-
this.installPlugin();
|
|
47
|
-
}
|
|
48
|
-
shutdown() {
|
|
49
|
-
this.uninstallAllPlugins();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.TeardownClient = TeardownClient;
|
|
53
|
-
const createTeardownClient = (plugins) => {
|
|
54
|
-
return new TeardownClient({
|
|
55
|
-
loggingEnabled: true,
|
|
56
|
-
plugins,
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
exports.createTeardownClient = createTeardownClient;
|
|
60
|
-
//# sourceMappingURL=teardown.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"teardown.client.js","sourceRoot":"","sources":["../src/teardown.client.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAgB1C,MAAsB,MAAM;IACjB,MAAM,CAAS;IAEzB,YAAsB,OAAyB;QAC9C,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC;IAC/D,CAAC;CAID;AATD,wBASC;AAsBD,MAAa,cAAc;IAML;IALd,MAAM,CAAS;IAEL,OAAO,GAAyB,IAAI,GAAG,EAAE,CAAC;IACpD,GAAG,G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,CAAC,mBAAmB,EAAE,CAAC;IAC5B,CAAC;CACD;AAjDD,wCAiDC;AAEM,MAAM,oBAAoB,GAAG,CACnC,OAAgB,EACf,EAAE;IACH,OAAO,IAAI,cAAc,CAAC;QACzB,cAAc,EAAE,IAAI;QACpB,OAAO;KACP,CAAC,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,oBAAoB,wBAO/B"}
|
package/dist/utils/log.d.ts
DELETED
package/dist/utils/log.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Log = void 0;
|
|
4
|
-
exports.Log = {
|
|
5
|
-
info: (...args) => console.log(...args),
|
|
6
|
-
warn: (...args) => console.warn(...args),
|
|
7
|
-
error: (...args) => console.error(...args),
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=log.js.map
|
package/dist/utils/log.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG;IAClB,IAAI,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC9C,IAAI,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/C,KAAK,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;CACjD,CAAC"}
|