noibu-react-native 0.2.2 → 0.2.4

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.
Files changed (100) hide show
  1. package/README.md +1 -1
  2. package/dist/api/clientConfig.js +225 -217
  3. package/dist/api/helpCode.js +61 -87
  4. package/dist/api/metroplexSocket.js +460 -463
  5. package/dist/api/storedPageVisit.js +150 -208
  6. package/dist/constants.js +10 -2
  7. package/dist/entry/init.js +65 -63
  8. package/dist/monitors/{appNavigationMonitor.js → AppNavigationMonitor.js} +12 -22
  9. package/dist/monitors/ClickMonitor.js +198 -0
  10. package/dist/monitors/ErrorMonitor.js +206 -0
  11. package/dist/monitors/KeyboardInputMonitor.js +60 -0
  12. package/dist/monitors/PageMonitor.js +98 -0
  13. package/dist/monitors/RequestMonitor.js +390 -0
  14. package/dist/monitors/http-tools/GqlErrorValidator.js +259 -0
  15. package/dist/monitors/http-tools/HTTPDataBundler.js +458 -0
  16. package/dist/monitors/integrations/react-native-navigation-integration.js +4 -2
  17. package/dist/pageVisit/EventDebouncer.js +99 -0
  18. package/dist/pageVisit/pageVisitEventError.js +2 -2
  19. package/dist/pageVisit/pageVisitEventHTTP.js +79 -93
  20. package/dist/react/ErrorBoundary.js +18 -15
  21. package/dist/sessionRecorder/nativeSessionRecorderSubscription.js +3 -2
  22. package/dist/sessionRecorder/sessionRecorder.js +152 -151
  23. package/dist/{api → src/api}/clientConfig.d.ts +2 -2
  24. package/dist/{api → src/api}/helpCode.d.ts +10 -16
  25. package/dist/{api → src/api}/metroplexSocket.d.ts +48 -67
  26. package/dist/{api → src/api}/storedPageVisit.d.ts +12 -21
  27. package/dist/{constants.d.ts → src/constants.d.ts} +45 -0
  28. package/dist/{entry → src/entry}/init.d.ts +1 -1
  29. package/dist/src/monitors/AppNavigationMonitor.d.ts +18 -0
  30. package/dist/src/monitors/ClickMonitor.d.ts +31 -0
  31. package/dist/src/monitors/ErrorMonitor.d.ts +63 -0
  32. package/dist/{monitors/keyboardInputMonitor.d.ts → src/monitors/KeyboardInputMonitor.d.ts} +7 -4
  33. package/dist/{monitors/pageMonitor.d.ts → src/monitors/PageMonitor.d.ts} +6 -8
  34. package/dist/src/monitors/RequestMonitor.d.ts +94 -0
  35. package/dist/src/monitors/http-tools/GqlErrorValidator.d.ts +59 -0
  36. package/dist/src/monitors/http-tools/HTTPDataBundler.d.ts +112 -0
  37. package/dist/{monitors → src/monitors}/integrations/react-native-navigation-integration.d.ts +3 -2
  38. package/dist/src/pageVisit/EventDebouncer.d.ts +24 -0
  39. package/dist/{pageVisit → src/pageVisit}/pageVisit.d.ts +1 -1
  40. package/dist/src/pageVisit/pageVisitEventHTTP.d.ts +25 -0
  41. package/dist/{sessionRecorder → src/sessionRecorder}/types.d.ts +1 -1
  42. package/dist/{storage → src/storage}/rnStorageProvider.d.ts +1 -1
  43. package/dist/{storage → src/storage}/storage.d.ts +2 -2
  44. package/dist/{storage → src/storage}/storageProvider.d.ts +3 -3
  45. package/dist/{utils → src/utils}/function.d.ts +27 -7
  46. package/dist/{utils → src/utils}/object.d.ts +11 -8
  47. package/dist/src/utils/piiRedactor.d.ts +11 -0
  48. package/dist/src/utils/polyfills.d.ts +4 -0
  49. package/dist/storage/rnStorageProvider.js +7 -4
  50. package/dist/storage/storage.js +43 -35
  51. package/dist/storage/storageProvider.js +23 -19
  52. package/dist/types/Config.d.ts +24 -20
  53. package/dist/types/Metroplex.types.d.ts +73 -0
  54. package/dist/types/Monitor.d.ts +11 -0
  55. package/dist/types/Monitor.js +19 -0
  56. package/dist/types/PageVisit.types.d.ts +8 -0
  57. package/dist/types/PageVisitErrors.types.d.ts +114 -0
  58. package/dist/types/PageVisitEvents.types.d.ts +91 -0
  59. package/dist/types/PageVisitMetrics.types.d.ts +27 -0
  60. package/dist/types/Storage.d.ts +1 -1
  61. package/dist/types/StoredPageVisit.types.d.ts +4 -47
  62. package/dist/types/WrappedObjects.d.ts +6 -0
  63. package/dist/utils/function.js +110 -77
  64. package/dist/utils/object.js +59 -6
  65. package/dist/utils/piiRedactor.js +98 -0
  66. package/dist/utils/polyfills.js +24 -0
  67. package/package.json +8 -8
  68. package/dist/monitors/appNavigationMonitor.d.ts +0 -22
  69. package/dist/monitors/clickMonitor.d.ts +0 -44
  70. package/dist/monitors/clickMonitor.js +0 -251
  71. package/dist/monitors/errorMonitor.d.ts +0 -28
  72. package/dist/monitors/errorMonitor.js +0 -180
  73. package/dist/monitors/gqlErrorValidator.d.ts +0 -82
  74. package/dist/monitors/gqlErrorValidator.js +0 -306
  75. package/dist/monitors/httpDataBundler.d.ts +0 -161
  76. package/dist/monitors/httpDataBundler.js +0 -725
  77. package/dist/monitors/inputMonitor.d.ts +0 -34
  78. package/dist/monitors/inputMonitor.js +0 -138
  79. package/dist/monitors/keyboardInputMonitor.js +0 -66
  80. package/dist/monitors/pageMonitor.js +0 -122
  81. package/dist/monitors/requestMonitor.d.ts +0 -10
  82. package/dist/monitors/requestMonitor.js +0 -401
  83. package/dist/pageVisit/pageVisitEventHTTP.d.ts +0 -18
  84. package/dist/types/PageVisit.d.ts +0 -22
  85. package/dist/types/ReactNative.d.ts +0 -4
  86. package/dist/types/globals.d.ts +0 -45
  87. /package/dist/{api → src/api}/inputManager.d.ts +0 -0
  88. /package/dist/{api → src/api}/storedMetrics.d.ts +0 -0
  89. /package/dist/{const_matchers.d.ts → src/const_matchers.d.ts} +0 -0
  90. /package/dist/{entry → src/entry}/index.d.ts +0 -0
  91. /package/dist/{pageVisit → src/pageVisit}/pageVisitEventError.d.ts +0 -0
  92. /package/dist/{pageVisit → src/pageVisit}/userStep.d.ts +0 -0
  93. /package/dist/{react → src/react}/ErrorBoundary.d.ts +0 -0
  94. /package/dist/{sessionRecorder → src/sessionRecorder}/nativeSessionRecorderSubscription.d.ts +0 -0
  95. /package/dist/{sessionRecorder → src/sessionRecorder}/sessionRecorder.d.ts +0 -0
  96. /package/dist/{utils → src/utils}/date.d.ts +0 -0
  97. /package/dist/{utils → src/utils}/eventlistener.d.ts +0 -0
  98. /package/dist/{utils → src/utils}/log.d.ts +0 -0
  99. /package/dist/{utils → src/utils}/performance.d.ts +0 -0
  100. /package/dist/{utils → src/utils}/stacktrace-parser.d.ts +0 -0
@@ -1,251 +0,0 @@
1
- import Pressability from 'react-native/Libraries/Pressability/Pressability';
2
- import { WHITELIST_HTML_ID_TEXT_REGEX, USERSTEP_EVENT_TYPE, SOURCE_ATT_NAME, TEXT_ATT_NAME, TAGNAME_ATT_NAME, HTMLID_ATT_NAME, TYPE_ATT_NAME, CLICK_EVENT_TYPE, CSS_CLASS_ATT_NAME } from '../constants.js';
3
- import { PageVisit } from '../pageVisit/pageVisit.js';
4
- import { updatePayload } from '../pageVisit/userStep.js';
5
- import StoredMetrics from '../api/storedMetrics.js';
6
- import { WHITELIST_TEXT_REGEX_STRING } from '../const_matchers.js';
7
- import { maskTextInput } from '../utils/function.js';
8
- import { timestampWrapper } from '../utils/date.js';
9
- import ClientConfig from '../api/clientConfig.js';
10
-
11
- /** @module ClickMonitor */
12
-
13
-
14
- /** Monitors the clicks which we capture and later process */
15
- class ClickMonitor {
16
- /**
17
- * Creates an instance of the ClickMonitor instance
18
- */
19
- constructor() {
20
- // compile white list regex only once
21
- this.textCapturedWhiteListRegex = new RegExp(
22
- WHITELIST_TEXT_REGEX_STRING(),
23
- 'i',
24
- );
25
-
26
- this.htmlIDAllowListRegex = new RegExp(WHITELIST_HTML_ID_TEXT_REGEX, 'i');
27
- }
28
-
29
- /** gets the singleton instance
30
- * @returns {ClickMonitor}
31
- */
32
- static getInstance() {
33
- if (!this.instance) {
34
- this.instance = new ClickMonitor();
35
- }
36
-
37
- return this.instance;
38
- }
39
-
40
- /** Starts monitoring clicks on every Press-able component */
41
- monitorClicks() {
42
- const onClickHandler = this._onClickHandle.bind(this);
43
-
44
- if (!Pressability.prototype.originalCreateEventHandlers) {
45
- Pressability.prototype.originalCreateEventHandlers =
46
- Pressability.prototype.getEventHandlers;
47
-
48
- Pressability.prototype.getEventHandlers = function () {
49
- const ehs =
50
- Pressability.prototype.originalCreateEventHandlers.call(this);
51
-
52
- return Object.fromEntries(
53
- Object.entries(ehs).map(([key, handler]) => [
54
- key,
55
- (event, ...args) => {
56
- if (key === 'onResponderRelease') {
57
- onClickHandler(event);
58
- }
59
- return handler(event, ...args);
60
- },
61
- ]),
62
- );
63
- };
64
- }
65
- }
66
-
67
- /**
68
- * Handles a single click event
69
- * @param {{ _targetInst: RNNode }} event
70
- */
71
- _onClickHandle(event) {
72
- if (event) {
73
- const { _targetInst: target } = event;
74
- const targetClassName = target.elementType;
75
-
76
- let text = '';
77
- // if the tag name of the src element is image, then we need
78
- // to process the image name, else we need to get the textual content
79
- // todo process images
80
-
81
- text = this._getTextualContentFromEl(target);
82
-
83
- let textFromElement = this._trimText(text);
84
-
85
- let tagName = '';
86
- if (targetClassName) {
87
- tagName = targetClassName.toLowerCase();
88
- }
89
-
90
- // id of element
91
- let hid = target.memoizedProps.testID || '';
92
- // in some bizarre cases, the html id of an element gets overriden
93
- // to contain jquery objects. If the hid is an object, it's of no
94
- // use to us.
95
- if (typeof hid !== 'string') {
96
- hid = '';
97
- }
98
- // if we find that the text matches analytic data used
99
- // to find checkout starts, add to cart clicks, etc.
100
- // we do not mask it.
101
- if (
102
- !this.textCapturedWhiteListRegex.test(textFromElement) &&
103
- !this.htmlIDAllowListRegex.test(hid)
104
- ) {
105
- if (tagName === 'input') {
106
- if (
107
- event.type &&
108
- (event.type === 'button' || event.type === 'submit')
109
- ) ; else {
110
- textFromElement = '*';
111
- }
112
- } else if (tagName === 'textarea') {
113
- textFromElement = '*';
114
- }
115
- }
116
-
117
- textFromElement = maskTextInput(textFromElement);
118
- const tPayload = {
119
- [SOURCE_ATT_NAME]: '',
120
- [TEXT_ATT_NAME]: textFromElement,
121
- [TAGNAME_ATT_NAME]: tagName,
122
- [HTMLID_ATT_NAME]: hid,
123
- [TYPE_ATT_NAME]: CLICK_EVENT_TYPE,
124
- [CSS_CLASS_ATT_NAME]: '',
125
- };
126
-
127
- StoredMetrics.getInstance().addPvClick();
128
-
129
- PageVisit.getInstance().addPageVisitEvents(
130
- [
131
- {
132
- event: updatePayload(tPayload),
133
- occurredAt: new Date(timestampWrapper(Date.now())).toISOString(),
134
- },
135
- ],
136
- USERSTEP_EVENT_TYPE,
137
- );
138
- }
139
- }
140
-
141
- /** Gets the textual content from an element, if any
142
- * @param {} element
143
- */
144
- _getTextualContentFromEl(element) {
145
- return this._parseInnerContent(element, '', 100, { value: 0, limit: 100 });
146
- }
147
-
148
- /** Parse and trim text
149
- * @param {} text
150
- */
151
- _trimText(text) {
152
- // regex to replace all whitespace with a single space and trim text
153
- let parsedText = text.trim().replace(/\s+/g, ' ');
154
-
155
- // if there is text that is longer than average sentence length,
156
- // chances are that it is not a valid text so we need to further process it
157
- if (parsedText.length > 100) {
158
- const index = parsedText.lastIndexOf(' ', 97);
159
- // We can not chop the text at exactly 97 characters since chopping in the
160
- // middle of an encoded value may cause deserialization issues. Chop at the
161
- // last ' ' character before the 97th character.
162
- if (index > 0) {
163
- parsedText = `${parsedText.substring(0, index)}...`;
164
- } else {
165
- // If there are no ' ' characters then the text is likely not valid so just
166
- // return '...'.
167
- parsedText = '...';
168
- }
169
- }
170
- return parsedText;
171
- }
172
-
173
- /**
174
- * Recursively parses element's inner content and masks blocked css classes
175
- * @param {NReactNative.Node} element
176
- * @param {String} text
177
- * @param {Number} textLimit
178
- * @param {Object} counter
179
- */
180
- _parseInnerContent(element, text, textLimit, counter) {
181
- /* eslint-disable no-restricted-syntax */
182
- /* eslint-disable no-param-reassign */
183
-
184
- if (text.length >= textLimit) {
185
- return text;
186
- }
187
-
188
- if (counter.value >= counter.limit) {
189
- return text;
190
- }
191
-
192
- counter.value += 1;
193
-
194
- if (
195
- ClickMonitor.getBlockedElements().includes(element.memoizedProps.testID)
196
- ) {
197
- return `${text}${text ? ' ' : ''}*`;
198
- }
199
-
200
- const walk = node => {
201
- if (typeof node.memoizedProps === 'string') {
202
- text = this._parseAndAppendText(text, [node.memoizedProps]);
203
- if (text.length >= textLimit) {
204
- return;
205
- }
206
- }
207
- if (node.child) {
208
- walk(node.child);
209
- }
210
- };
211
- walk(element);
212
-
213
- return text;
214
- }
215
-
216
- /**
217
- * Gets selectors to prevent those elements from being recorded
218
- */
219
- static getBlockedElements() {
220
- const selectors = ClientConfig.getInstance().blockedElements;
221
- const blockedElements = ['noibu-blocked'];
222
- if (selectors && Array.isArray(selectors)) {
223
- blockedElements.push(...selectors);
224
- }
225
- return blockedElements;
226
- }
227
-
228
- /**
229
- * normalize value and append to the resulting text if not empty
230
- * @param {String} text
231
- * @param {Array.<any>} values
232
- */
233
- _parseAndAppendText(text, values) {
234
- const goodValues = [];
235
- for (const v of values) {
236
- if (Number.isFinite(v) || typeof v === 'string') {
237
- goodValues.push(v);
238
- }
239
- }
240
-
241
- for (let value of goodValues) {
242
- value = `${value}`.trim().replace(/\s+/g, ' ');
243
- if (value.length > 0) {
244
- return text + (text ? ' ' : '') + value;
245
- }
246
- }
247
- return text;
248
- }
249
- }
250
-
251
- export { ClickMonitor };
@@ -1,28 +0,0 @@
1
- type WrappedFunction<T extends Function = Function> = T & Partial<{
2
- __noibu__: boolean;
3
- __noibu_wrapped__: T;
4
- }>;
5
- /**
6
- * wraps a provided function into a function that try and catches
7
- * the original function, doing so allows us to catch errors
8
- * functionToWrap: function to be wrapped
9
- * @param {} functionToWrap
10
- */
11
- export declare function wrap(functionToWrap: WrappedFunction): Function;
12
- /** iterates arguments to try to extract errors from them
13
- * @param {Array<string | Error>} argsFromErrorLog
14
- */
15
- export declare function processErrorLogArguments(argsFromErrorLog: any[]): void;
16
- /**
17
- * handler for promise rejection failures
18
- * @param error
19
- */
20
- export declare function onPromiseRejectionHandler(error: {
21
- message: string;
22
- stack?: string;
23
- }): void;
24
- /**
25
- * Monitors the errors happening on the window
26
- */
27
- export declare function monitorErrors(): void;
28
- export {};
@@ -1,180 +0,0 @@
1
- import { asString, isStackTrace } from '../utils/function.js';
2
- import { CONSOLE_FUNCTION_OVERRIDES, ERROR_EVENT_ERROR_TYPE, STACK_TRACE_SANITIZE_REGEXP, ERROR_EVENT_UNHANDLED_REJECTION_TYPE, ERROR_LOG_EVENT_ERROR_TYPE } from '../constants.js';
3
- import { saveErrorToPagevisit } from '../pageVisit/pageVisitEventError.js';
4
- import { replace } from '../utils/object.js';
5
-
6
- /* eslint-disable @typescript-eslint/ban-types,prefer-arrow-callback */
7
- /** @module ErrorMonitor */
8
- /**
9
- * transform a log into an error since React hides component errors
10
- * tps://reactjs.org/docs/error-boundaries.html
11
- * @param {Error|any} errorLog
12
- * @returns {boolean} true on success
13
- */
14
- function processErrorLog(errorLog) {
15
- // handle empty arguments
16
- if (!errorLog) {
17
- return false;
18
- }
19
- const { message, stack } = errorLog;
20
- // for now, we only process error logs if they are a way to describe an error
21
- if (!stack || !message) {
22
- return false;
23
- }
24
- saveErrorToPagevisit(ERROR_LOG_EVENT_ERROR_TYPE, { message, stack });
25
- return true;
26
- }
27
- /**
28
- * Constructs error objects based on console args.
29
- * Relies on isStackTrace() to determine if arg is a stack trace, otherwise the arg must be a message.
30
- *
31
- * If there are multiple stack traces or the number of error messages is not equal to one,
32
- * it maps the stack traces to objects with their respective first lines as messages.
33
- * Otherwise, if there is exactly one stack trace and one error message,
34
- * it constructs an array with a single object containing the first stack trace and the first error message.
35
- * @param {Array<string>} args
36
- */
37
- function constructErrors(args) {
38
- if (args.length === 0) {
39
- return [];
40
- }
41
- if (args.length === 2) {
42
- if (isStackTrace(args[0])) {
43
- return [{ stack: args[0], message: args[1] }];
44
- }
45
- if (isStackTrace(args[1])) {
46
- return [{ stack: args[1], message: args[0] }];
47
- }
48
- return [];
49
- }
50
- const stacks = [];
51
- const messages = [];
52
- args.forEach(sm => {
53
- if (isStackTrace()) {
54
- stacks.push(sm);
55
- const lines = sm.split('\n');
56
- if (isStackTrace(lines[0])) {
57
- messages.push('_');
58
- }
59
- else {
60
- // we can use 1st line of stack trace as a message
61
- messages.push(lines[0]);
62
- }
63
- }
64
- });
65
- return stacks.map((stack, i) => ({ stack, message: messages[i] }));
66
- }
67
- /** iterates arguments to try to extract errors from them
68
- * @param {Array<string | Error>} argsFromErrorLog
69
- */
70
- function processErrorLogArguments(argsFromErrorLog) {
71
- // tracks if arguments were processed at least once successfully, and if not, tries to reconstruct an Error
72
- const collectedArgs = [];
73
- // we may receive multiple arguments
74
- argsFromErrorLog.forEach(arg => {
75
- // ensure arg exists before attempting processing
76
- if (!arg) {
77
- return;
78
- }
79
- // if we pass an array of elements in the console, we want to go through that
80
- // away and make sure we are extracting the error object. We don't do nested arrays.
81
- if (Array.isArray(arg)) {
82
- collectedArgs.push(...arg);
83
- return;
84
- }
85
- collectedArgs.push(arg);
86
- });
87
- const argsToBeReconstructedIntoErrors = collectedArgs.filter(arg => !processErrorLog(arg));
88
- // if previous process calls return nothing,
89
- // try to reconstruct error from the args
90
- constructErrors(argsToBeReconstructedIntoErrors).forEach(processErrorLog);
91
- }
92
- /**
93
- * wraps and replaces the addEventListener property
94
- * of event targets to try and catch errors
95
- * eventTargetString: event target name
96
- */
97
- function configureEventListeners() {
98
- // we wrap all logging to catch any potential errors passed in logs
99
- CONSOLE_FUNCTION_OVERRIDES.forEach(consoleFunction => {
100
- if (!window.console || !window.console[consoleFunction]) {
101
- return;
102
- }
103
- replace(window.console, consoleFunction, function (originalFunction) {
104
- // We set nbuWrapper to the handler function so if this returns an error
105
- // the trace message will start with nbuWrapper which would allow us to
106
- // detect that this is a wrapped function and not a NoibuJS error
107
- return function nbuWrapper() {
108
- // ignoring this linting error since we don't want
109
- // potentially overide the actual functioning of console.error
110
- // eslint-disable-next-line prefer-rest-params
111
- originalFunction.call(window.console, ...arguments);
112
- // converting the arguments to an array so that we do not nest argument objects
113
- // eslint-disable-next-line prefer-rest-params
114
- processErrorLogArguments(Array.from(arguments));
115
- };
116
- });
117
- });
118
- }
119
- /**
120
- * handler for promise rejection failures
121
- * @param error
122
- */
123
- function onPromiseRejectionHandler(error) {
124
- if (!error || !error.message || !error.stack) {
125
- return;
126
- }
127
- const sanitizedStack = error.stack
128
- .split('\n')
129
- .filter(line => !line.match(STACK_TRACE_SANITIZE_REGEXP))
130
- .join('\n');
131
- const payload = {
132
- error: {
133
- message: error.message,
134
- stack: sanitizedStack,
135
- },
136
- };
137
- saveErrorToPagevisit(ERROR_EVENT_UNHANDLED_REJECTION_TYPE, payload);
138
- }
139
- function configureHermesHooks() {
140
- if (global.HermesInternal) {
141
- global.HermesInternal.enablePromiseRejectionTracker?.({
142
- allRejections: true,
143
- });
144
- /**
145
- * This internal promise implementation method is populated only after enabling the promise tracker.
146
- * It represents an improvement over the previous approach,
147
- * which would lose stack context regarding the rejection because it ran asynchronously through setTimeout.
148
- *
149
- * This updated method ensures synchronous error capturing and retrieves the correct stack frames.
150
- */
151
- replace(Promise, '_m', (originalFunction) => function nbuGlobalPromiseRejectWrapper(promise, error) {
152
- if (error.message && error.stack) {
153
- onPromiseRejectionHandler(error);
154
- }
155
- else {
156
- onPromiseRejectionHandler(new Error(asString(error)));
157
- }
158
- return originalFunction?.(promise, error);
159
- });
160
- }
161
- }
162
- function configureErrorUtilsHandler() {
163
- const existingHandler = global.ErrorUtils.getGlobalHandler() || (() => { });
164
- global.ErrorUtils.setGlobalHandler((error, ...rest) => {
165
- saveErrorToPagevisit(ERROR_EVENT_ERROR_TYPE, {
166
- error,
167
- });
168
- return existingHandler(error, ...rest);
169
- });
170
- }
171
- /**
172
- * Monitors the errors happening on the window
173
- */
174
- function monitorErrors() {
175
- configureEventListeners();
176
- configureHermesHooks();
177
- configureErrorUtilsHandler();
178
- }
179
-
180
- export { monitorErrors, onPromiseRejectionHandler, processErrorLogArguments };
@@ -1,82 +0,0 @@
1
- /**
2
- * Try detecting GraphQL errors from http response
3
- */
4
- export default class GqlErrorValidator {
5
- /**
6
- * Retrieves GQL error object based on fetch request/response
7
- * @param {String} url
8
- * @param {{}} options
9
- * @param {Request} request
10
- * @param {Response} response - cloned() from original response
11
- */
12
- static fromFetch(url: string, options: {}, request: Request, response: Response): Promise<any>;
13
- /**
14
- * Retrieves GQL error object based on XHR object
15
- * @param {String} url
16
- * @param {XMLHttpRequest} xhr
17
- */
18
- static fromXhr(url: string, xhr: XMLHttpRequest): Promise<any>;
19
- /**
20
- * Try safely parse a string and return null if fails
21
- * @param {String} content
22
- */
23
- static _parseJsonSafely(content: string): any;
24
- /**
25
- * Try to get content type for fetch arguments
26
- * @param {{}} options
27
- * @param {Request} request
28
- */
29
- static _getContentTypeFromFetchArguments(options: {}, request: Request): string | null;
30
- /**
31
- * Checks if request is aborted
32
- * If it has been aborder we are not able to consume the response
33
- * @param {{}} options
34
- * @param {Request} request
35
- */
36
- static _isRequestAborted(options: {}, request: Request): any;
37
- /**
38
- * Determines if request should be processed
39
- * @param {String|URL} url
40
- * @param {String} contentType
41
- */
42
- static _shouldHandleRequest(url: string | URL, contentType: string): boolean;
43
- /**
44
- * Sanitizes payload object
45
- * @param {any} data
46
- * @param {Array<String>} validationIssues
47
- */
48
- static _validate(data: any, validationIssues: Array<string>): any;
49
- /**
50
- * Sanitizes message object
51
- * @param {any} error
52
- */
53
- static _validateMessage(error: any): void;
54
- /**
55
- * Sanitizes extensions object
56
- * @param {any} error
57
- * @param {Array<String>} validationIssues
58
- */
59
- static _validateExtensions(error: any): void;
60
- /**
61
- * Sanitizes locations object
62
- * @param {any} error
63
- * @param {Array<String>} validationIssues
64
- */
65
- static _validateLocations(error: any, validationIssues: Array<string>): void;
66
- /**
67
- * Sanitizes path object
68
- * @param {any} error
69
- * @param {Array<String>} validationIssues
70
- */
71
- static _validatePath(error: any, validationIssues: Array<string>): void;
72
- /**
73
- * Posts error
74
- * @param {String} message
75
- */
76
- static _postError(message: string): void;
77
- /**
78
- * Posts issue found during object sanitization
79
- * @param {Array<String>} validationIssues
80
- */
81
- static _postValidationIssues(validationIssues: Array<string>): void;
82
- }