chore: format all frontend files (#430)
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { LogLevel, LogAction } from '../src/types';
|
||||
import {
|
||||
getColorByLogLevel,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { shouldCloseConsole } from '../src/console-disable';
|
||||
|
||||
describe('shouldCloseConsole', () => {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import {
|
||||
type TraceDuration,
|
||||
genDurationTracer,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { type Mock } from 'vitest';
|
||||
|
||||
import { Logger } from '../src/logger/logger';
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { type TraceDuration } from '../src/reporter/duration-tracer';
|
||||
import { Reporter, reporter as rawReporter } from '../src/reporter';
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { LogAction, LogLevel } from '../src/types';
|
||||
import { SlardarReportClient } from '../src/slardar';
|
||||
vi.mock('@slardar/web');
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ErrorType } from '../src/types';
|
||||
import {
|
||||
safeJson,
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
"test:cov": "npm run test -- --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@coze-studio/slardar-interface": "workspace:*",
|
||||
"@coze-arch/bot-env": "workspace:*",
|
||||
"@coze-arch/bot-typings": "workspace:*",
|
||||
"@coze-studio/slardar-interface": "workspace:*",
|
||||
"lodash-es": "^4.17.21",
|
||||
"react": "~18.2.0",
|
||||
"react-error-boundary": "^4.0.9"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
// import { runtimeEnv } from '@coze-arch/bot-env/runtime';
|
||||
const DEBUG_TAG = 'open_debug';
|
||||
const OPEN_CONSOLE_MARK = new RegExp(`(?:\\?|\\&)${DEBUG_TAG}=true`);
|
||||
@@ -27,7 +27,7 @@ export const shouldCloseConsole = () => {
|
||||
isOpenDebug && sessionStorage.setItem(DEBUG_TAG, 'true');
|
||||
}
|
||||
// Except for the official normal environment, the console is allowed to open
|
||||
const isProduction = !!(IS_RELEASE_VERSION );
|
||||
const isProduction = !!IS_RELEASE_VERSION;
|
||||
console.log('IS_RELEASE_VERSION', IS_RELEASE_VERSION, isProduction);
|
||||
return !isOpenDebug && isProduction;
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import {
|
||||
ErrorBoundary as ReactErrorBoundary,
|
||||
useErrorBoundary,
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/// <reference types='@coze-arch/bot-typings' />
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
export { reporter, Reporter } from './reporter';
|
||||
|
||||
// Reporter needs to report to slardar method export
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { isEmpty } from 'lodash-es';
|
||||
|
||||
import {
|
||||
@@ -74,8 +74,8 @@ export class ConsoleLogClient implements LoggerReportClient {
|
||||
const resolvedMsg = message
|
||||
? message
|
||||
: eventName
|
||||
? `Event: ${eventName}`
|
||||
: undefined;
|
||||
? `Event: ${eventName}`
|
||||
: undefined;
|
||||
if (!action?.includes(LogAction.CONSOLE) || !resolvedMsg) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
import { type Logger } from './core';
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { isNil } from 'lodash-es';
|
||||
|
||||
import {
|
||||
@@ -185,5 +185,4 @@ export class Logger extends BaseLogger {
|
||||
action: [LogAction.CONSOLE, LogAction.PERSIST],
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
export { logger } from './logger';
|
||||
export { Logger } from './core';
|
||||
export { LoggerContext, useLogger } from './context';
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { isEmpty } from 'lodash-es';
|
||||
|
||||
import { type CommonLogOptions } from '../types';
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import {
|
||||
type CommonLogOptions,
|
||||
type BaseLoggerOptions,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
export type TracePointName = 'success' | 'fail' | string;
|
||||
|
||||
export interface TraceDuration {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { type CommonLogOptions, LogAction, LogLevel } from '../types';
|
||||
import { SlardarReportClient, type SlardarInstance } from '../slardar';
|
||||
import { Logger } from '../logger';
|
||||
@@ -25,7 +25,7 @@ export interface LoggerCommonProperties {
|
||||
}
|
||||
|
||||
export interface SlardarMeta {
|
||||
meta?: Record<string, unknown>; // Combination of `categories` and `metrics`, check more:
|
||||
meta?: Record<string, unknown>; // Combination of `categories` and `metrics`, check more:
|
||||
}
|
||||
|
||||
export interface CustomLog extends SlardarMeta, LoggerCommonProperties {
|
||||
@@ -138,7 +138,7 @@ export class Reporter {
|
||||
/// Custom Log
|
||||
/**
|
||||
* Report an info log
|
||||
* @param event
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
info(log: CustomLog) {
|
||||
@@ -147,7 +147,7 @@ export class Reporter {
|
||||
|
||||
/**
|
||||
* Report a success log
|
||||
* @param event
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
success(log: CustomLog) {
|
||||
@@ -157,7 +157,7 @@ export class Reporter {
|
||||
|
||||
/**
|
||||
* Report a warning log
|
||||
* @param event
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
warning(log: CustomLog) {
|
||||
@@ -167,7 +167,7 @@ export class Reporter {
|
||||
|
||||
/**
|
||||
* Report an error log
|
||||
* @param event
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
error(log: CustomErrorLog) {
|
||||
@@ -181,7 +181,7 @@ export class Reporter {
|
||||
/// Custom Event
|
||||
/**
|
||||
* Report a custom event
|
||||
* @param event
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
event<EventEnum extends string>(event: CustomEvent<EventEnum>) {
|
||||
@@ -191,7 +191,7 @@ export class Reporter {
|
||||
|
||||
/**
|
||||
* Report an error event (LogLevel = 'error')
|
||||
* @param event
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
errorEvent<EventEnum extends string>(event: ErrorEvent<EventEnum>) {
|
||||
@@ -203,7 +203,7 @@ export class Reporter {
|
||||
|
||||
/**
|
||||
* Report a success event (LogLevel = 'success')
|
||||
* @param event
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
successEvent<EventEnum extends string>(event: CustomEvent<EventEnum>) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { isNumber, isString, mapValues, omitBy, isNil } from 'lodash-es';
|
||||
import type { SlardarInstance } from '@coze-studio/slardar-interface';
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
* Converting meta to type
|
||||
* Metrics: Values that can be measured, that is, numerical values
|
||||
* - Dimension categories: classification, dimension, used for filtering, grouping
|
||||
*
|
||||
*
|
||||
* @param meta
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { reporter } from '../reporter';
|
||||
|
||||
export const getSlardarInstance = () => reporter.slardarInstance;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { LogLevel, type ApiErrorOption, ErrorType } from '../types';
|
||||
|
||||
function isObject<T>(it: T): it is object extends T
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* log level
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { defineConfig } from '@coze-arch/vitest-config';
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
Reference in New Issue
Block a user