chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -25,7 +25,7 @@ function requiredWithoutCache(src, onError?) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const { Module } = require('module');
|
||||
try {
|
||||
// disable 了 require 的缓存,这样可以改变了 mock 数据后,无需重启服务。
|
||||
// Disable the required cache so that you can change the mock data without restarting the service.
|
||||
const originCache = Module._cache;
|
||||
Module._cache = {};
|
||||
// eslint-disable-next-line security/detect-non-literal-require, @typescript-eslint/no-require-imports
|
||||
|
||||
@@ -186,7 +186,7 @@ export class FilterTypesPlugin {
|
||||
} else if (isIdentifier(fieldType)) {
|
||||
const statement = getStatementById(fieldType, current);
|
||||
if (isEnumDefinition(statement)) {
|
||||
// 强制转位 number
|
||||
// Forced indexing number
|
||||
// @ts-expect-error fixme late
|
||||
fieldType.type = SyntaxType.I32Keyword;
|
||||
let namespace = current.unifyNamespace;
|
||||
|
||||
@@ -55,15 +55,15 @@ export class MockPlugin implements IPlugin {
|
||||
if (context) {
|
||||
const { fieldDefinition } = context;
|
||||
const fieldName = fieldDefinition.name.value;
|
||||
// 各类 ID
|
||||
// various types of ID
|
||||
if (fieldName.toLocaleUpperCase().endsWith('ID')) {
|
||||
value = String(faker.number.int());
|
||||
}
|
||||
// email 处理
|
||||
// Email processing
|
||||
if (fieldName.includes('Email')) {
|
||||
value = `${faker.person.lastName()}@foo.com`;
|
||||
}
|
||||
// 直接映射值
|
||||
// direct mapping value
|
||||
value = StrMapper[fieldName] || value;
|
||||
}
|
||||
ctx.output = t.stringLiteral(value);
|
||||
@@ -76,20 +76,20 @@ export class MockPlugin implements IPlugin {
|
||||
const { fieldDefinition } = context;
|
||||
const fieldName = fieldDefinition.name.value;
|
||||
const formatName = fieldName.toLocaleUpperCase();
|
||||
// 各类 ID
|
||||
// various types of ID
|
||||
if (formatName.endsWith('ID')) {
|
||||
value = faker.number.int();
|
||||
}
|
||||
// 时间戳
|
||||
// timestamp
|
||||
if (formatName.endsWith('TIME') || formatName.includes('TIMESTAMP')) {
|
||||
value = dayjs(faker.date.anytime()).valueOf();
|
||||
}
|
||||
// 类型状态
|
||||
// type state
|
||||
if (formatName.endsWith('STATUS') || formatName.includes('TYPE')) {
|
||||
value = faker.number.int({ min: 0, max: 1 });
|
||||
}
|
||||
|
||||
// 直接映射值
|
||||
// direct mapping value
|
||||
const mapVal = NumMapper[fieldName];
|
||||
value = typeof mapVal !== 'undefined' ? mapVal : value;
|
||||
}
|
||||
|
||||
@@ -17,27 +17,27 @@
|
||||
import { type IPlugin } from '@coze-arch/idl2ts-generator';
|
||||
|
||||
export interface ApiConfig {
|
||||
// idl 入口
|
||||
// IDL entrance
|
||||
entries: Record<string, string>;
|
||||
// idl 根目录
|
||||
// IDL root directory
|
||||
idlRoot: string;
|
||||
// 服务别名
|
||||
// 自定义 api 方法
|
||||
// service alias
|
||||
// Custom API method
|
||||
commonCodePath: string;
|
||||
// api 产物目录
|
||||
// API Product Catalog
|
||||
output: string;
|
||||
// 仓库信息设置
|
||||
// Warehouse information settings
|
||||
repository?: {
|
||||
// 仓库地址
|
||||
// Warehouse address
|
||||
url: string;
|
||||
// clone 到本地的位置
|
||||
// Clone to local location
|
||||
dest: string;
|
||||
};
|
||||
// 插件
|
||||
// plugin
|
||||
plugins?: IPlugin[];
|
||||
// 聚合导出的文件名
|
||||
// aggregate exported filename
|
||||
aggregationExport?: string;
|
||||
// 格式化文件
|
||||
// Format file
|
||||
formatter: (name: string, content: string) => string;
|
||||
idlFetchConfig?: {
|
||||
source: string;
|
||||
@@ -48,6 +48,6 @@ export interface ApiConfig {
|
||||
}
|
||||
|
||||
export interface ApiTypeConfig extends ApiConfig {
|
||||
// 需要过滤的方法
|
||||
// Methods that require filtering
|
||||
filters: Record<string, string[]>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user