miaoda-react-devkit 0.1.1-beta.13 → 0.1.1-beta.14
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/dist/index.cjs +6 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -3
- package/dist/stubs/sentry-react-stub.js +6 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -221,7 +221,7 @@ function parseAuthErrorBody(body) {
|
|
|
221
221
|
|
|
222
222
|
// src/capture/storage.ts
|
|
223
223
|
var DEFAULT_STORAGE_URL_PATTERNS = [/\/storage\/v1\//];
|
|
224
|
-
var DEFAULT_STORAGE_WHITELIST_ERRORS = ["
|
|
224
|
+
var DEFAULT_STORAGE_WHITELIST_ERRORS = ["new row violates row-level security policy"];
|
|
225
225
|
function isStorageRequest(url, patterns) {
|
|
226
226
|
return patterns.some((p) => (typeof p === "string" ? new RegExp(p) : p).test(url));
|
|
227
227
|
}
|
|
@@ -358,7 +358,7 @@ async function handleFetchBreadcrumb(breadcrumb, hint, handler) {
|
|
|
358
358
|
await handler({ type: "fetch", method, url, statusCode, requestBody, responseBody, isError, cause, duration });
|
|
359
359
|
}
|
|
360
360
|
function createNetworkObserver(opts, subscribers) {
|
|
361
|
-
const
|
|
361
|
+
const isIgnored = createUrlMatcher(opts.ignoreUrls);
|
|
362
362
|
const pgRestPatterns = opts.pgRestUrlPatterns ?? DEFAULT_PGREST_URL_PATTERNS;
|
|
363
363
|
const pgRestWhitelistCodes = opts.pgRestWhitelistCodes ?? DEFAULT_PGREST_WHITELIST_CODES;
|
|
364
364
|
const precedingBreadcrumbsLimit = opts.precedingBreadcrumbsLimit;
|
|
@@ -366,6 +366,9 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
366
366
|
const authWhitelistCodes = opts.authWhitelistCodes ?? DEFAULT_AUTH_WHITELIST_CODES;
|
|
367
367
|
const storagePatterns = opts.storageUrlPatterns ?? DEFAULT_STORAGE_URL_PATTERNS;
|
|
368
368
|
const storageWhitelistErrors = opts.storageWhitelistErrors ?? DEFAULT_STORAGE_WHITELIST_ERRORS;
|
|
369
|
+
const shouldIgnore = (url) => {
|
|
370
|
+
return isIgnored(url) && !isPgRestRequest(url, pgRestPatterns) && !isAuthRequest(url, authPatterns) && !isStorageRequest(url, storagePatterns);
|
|
371
|
+
};
|
|
369
372
|
function tryDispatchError(requestType, method, url, statusCode, requestBody, responseBody) {
|
|
370
373
|
if (statusCode == null) return;
|
|
371
374
|
const errorRequestType = isPgRestRequest(url, pgRestPatterns) ? "pgrest" : isAuthRequest(url, authPatterns) ? "auth" : isStorageRequest(url, storagePatterns) ? "storage" : null;
|
|
@@ -405,7 +408,7 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
405
408
|
} else if (errorRequestType === "storage") {
|
|
406
409
|
const storageError = parseStorageErrorBody(responseBody);
|
|
407
410
|
if (!storageError) return;
|
|
408
|
-
if (storageWhitelistErrors.length > 0 && !storageWhitelistErrors.includes(storageError.
|
|
411
|
+
if (storageWhitelistErrors.length > 0 && !storageWhitelistErrors.includes(storageError.message)) return;
|
|
409
412
|
const info = {
|
|
410
413
|
type: requestType,
|
|
411
414
|
method,
|
package/dist/index.d.cts
CHANGED
|
@@ -57,8 +57,8 @@ declare const DEFAULT_STORAGE_URL_PATTERNS: Array<string | RegExp>;
|
|
|
57
57
|
* 白名单 Storage error 列表(匹配 error 字段)。
|
|
58
58
|
* 命中白名单的响应才触发 onStorageWhitelistError。
|
|
59
59
|
*
|
|
60
|
-
* TODO: 根据业务需要补充具体
|
|
61
|
-
* - '
|
|
60
|
+
* TODO: 根据业务需要补充具体 message。格式示例:
|
|
61
|
+
* - 'new row violates row-level security policy'(行级安全策略拒绝)
|
|
62
62
|
*/
|
|
63
63
|
declare const DEFAULT_STORAGE_WHITELIST_ERRORS: string[];
|
|
64
64
|
/** Supabase Storage 标准错误响应体结构(HTTP 4xx/5xx 时返回)。 */
|
package/dist/index.d.ts
CHANGED
|
@@ -57,8 +57,8 @@ declare const DEFAULT_STORAGE_URL_PATTERNS: Array<string | RegExp>;
|
|
|
57
57
|
* 白名单 Storage error 列表(匹配 error 字段)。
|
|
58
58
|
* 命中白名单的响应才触发 onStorageWhitelistError。
|
|
59
59
|
*
|
|
60
|
-
* TODO: 根据业务需要补充具体
|
|
61
|
-
* - '
|
|
60
|
+
* TODO: 根据业务需要补充具体 message。格式示例:
|
|
61
|
+
* - 'new row violates row-level security policy'(行级安全策略拒绝)
|
|
62
62
|
*/
|
|
63
63
|
declare const DEFAULT_STORAGE_WHITELIST_ERRORS: string[];
|
|
64
64
|
/** Supabase Storage 标准错误响应体结构(HTTP 4xx/5xx 时返回)。 */
|
package/dist/index.js
CHANGED
|
@@ -186,7 +186,7 @@ function parseAuthErrorBody(body) {
|
|
|
186
186
|
|
|
187
187
|
// src/capture/storage.ts
|
|
188
188
|
var DEFAULT_STORAGE_URL_PATTERNS = [/\/storage\/v1\//];
|
|
189
|
-
var DEFAULT_STORAGE_WHITELIST_ERRORS = ["
|
|
189
|
+
var DEFAULT_STORAGE_WHITELIST_ERRORS = ["new row violates row-level security policy"];
|
|
190
190
|
function isStorageRequest(url, patterns) {
|
|
191
191
|
return patterns.some((p) => (typeof p === "string" ? new RegExp(p) : p).test(url));
|
|
192
192
|
}
|
|
@@ -323,7 +323,7 @@ async function handleFetchBreadcrumb(breadcrumb, hint, handler) {
|
|
|
323
323
|
await handler({ type: "fetch", method, url, statusCode, requestBody, responseBody, isError, cause, duration });
|
|
324
324
|
}
|
|
325
325
|
function createNetworkObserver(opts, subscribers) {
|
|
326
|
-
const
|
|
326
|
+
const isIgnored = createUrlMatcher(opts.ignoreUrls);
|
|
327
327
|
const pgRestPatterns = opts.pgRestUrlPatterns ?? DEFAULT_PGREST_URL_PATTERNS;
|
|
328
328
|
const pgRestWhitelistCodes = opts.pgRestWhitelistCodes ?? DEFAULT_PGREST_WHITELIST_CODES;
|
|
329
329
|
const precedingBreadcrumbsLimit = opts.precedingBreadcrumbsLimit;
|
|
@@ -331,6 +331,9 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
331
331
|
const authWhitelistCodes = opts.authWhitelistCodes ?? DEFAULT_AUTH_WHITELIST_CODES;
|
|
332
332
|
const storagePatterns = opts.storageUrlPatterns ?? DEFAULT_STORAGE_URL_PATTERNS;
|
|
333
333
|
const storageWhitelistErrors = opts.storageWhitelistErrors ?? DEFAULT_STORAGE_WHITELIST_ERRORS;
|
|
334
|
+
const shouldIgnore = (url) => {
|
|
335
|
+
return isIgnored(url) && !isPgRestRequest(url, pgRestPatterns) && !isAuthRequest(url, authPatterns) && !isStorageRequest(url, storagePatterns);
|
|
336
|
+
};
|
|
334
337
|
function tryDispatchError(requestType, method, url, statusCode, requestBody, responseBody) {
|
|
335
338
|
if (statusCode == null) return;
|
|
336
339
|
const errorRequestType = isPgRestRequest(url, pgRestPatterns) ? "pgrest" : isAuthRequest(url, authPatterns) ? "auth" : isStorageRequest(url, storagePatterns) ? "storage" : null;
|
|
@@ -370,7 +373,7 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
370
373
|
} else if (errorRequestType === "storage") {
|
|
371
374
|
const storageError = parseStorageErrorBody(responseBody);
|
|
372
375
|
if (!storageError) return;
|
|
373
|
-
if (storageWhitelistErrors.length > 0 && !storageWhitelistErrors.includes(storageError.
|
|
376
|
+
if (storageWhitelistErrors.length > 0 && !storageWhitelistErrors.includes(storageError.message)) return;
|
|
374
377
|
const info = {
|
|
375
378
|
type: requestType,
|
|
376
379
|
method,
|
|
@@ -189,7 +189,7 @@ function parseAuthErrorBody(body) {
|
|
|
189
189
|
|
|
190
190
|
// src/capture/storage.ts
|
|
191
191
|
var DEFAULT_STORAGE_URL_PATTERNS = [/\/storage\/v1\//];
|
|
192
|
-
var DEFAULT_STORAGE_WHITELIST_ERRORS = ["
|
|
192
|
+
var DEFAULT_STORAGE_WHITELIST_ERRORS = ["new row violates row-level security policy"];
|
|
193
193
|
function isStorageRequest(url, patterns) {
|
|
194
194
|
return patterns.some((p) => (typeof p === "string" ? new RegExp(p) : p).test(url));
|
|
195
195
|
}
|
|
@@ -326,7 +326,7 @@ async function handleFetchBreadcrumb(breadcrumb, hint, handler) {
|
|
|
326
326
|
await handler({ type: "fetch", method, url, statusCode, requestBody, responseBody, isError, cause, duration });
|
|
327
327
|
}
|
|
328
328
|
function createNetworkObserver(opts, subscribers) {
|
|
329
|
-
const
|
|
329
|
+
const isIgnored = createUrlMatcher(opts.ignoreUrls);
|
|
330
330
|
const pgRestPatterns = opts.pgRestUrlPatterns ?? DEFAULT_PGREST_URL_PATTERNS;
|
|
331
331
|
const pgRestWhitelistCodes = opts.pgRestWhitelistCodes ?? DEFAULT_PGREST_WHITELIST_CODES;
|
|
332
332
|
const precedingBreadcrumbsLimit = opts.precedingBreadcrumbsLimit;
|
|
@@ -334,6 +334,9 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
334
334
|
const authWhitelistCodes = opts.authWhitelistCodes ?? DEFAULT_AUTH_WHITELIST_CODES;
|
|
335
335
|
const storagePatterns = opts.storageUrlPatterns ?? DEFAULT_STORAGE_URL_PATTERNS;
|
|
336
336
|
const storageWhitelistErrors = opts.storageWhitelistErrors ?? DEFAULT_STORAGE_WHITELIST_ERRORS;
|
|
337
|
+
const shouldIgnore = (url) => {
|
|
338
|
+
return isIgnored(url) && !isPgRestRequest(url, pgRestPatterns) && !isAuthRequest(url, authPatterns) && !isStorageRequest(url, storagePatterns);
|
|
339
|
+
};
|
|
337
340
|
function tryDispatchError(requestType, method, url, statusCode, requestBody, responseBody) {
|
|
338
341
|
if (statusCode == null) return;
|
|
339
342
|
const errorRequestType = isPgRestRequest(url, pgRestPatterns) ? "pgrest" : isAuthRequest(url, authPatterns) ? "auth" : isStorageRequest(url, storagePatterns) ? "storage" : null;
|
|
@@ -373,7 +376,7 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
373
376
|
} else if (errorRequestType === "storage") {
|
|
374
377
|
const storageError = parseStorageErrorBody(responseBody);
|
|
375
378
|
if (!storageError) return;
|
|
376
|
-
if (storageWhitelistErrors.length > 0 && !storageWhitelistErrors.includes(storageError.
|
|
379
|
+
if (storageWhitelistErrors.length > 0 && !storageWhitelistErrors.includes(storageError.message)) return;
|
|
377
380
|
const info = {
|
|
378
381
|
type: requestType,
|
|
379
382
|
method,
|