网格构建器
装有网状文物的软件包
出口
验证梅什
校验Mesh( meshconfig: MeshConfig) QQ 答应
校验网格函数取 meshConfig 如果网格限制在CLI规则的范围内,则作为论证和验证。 成功验证后, 函数将解析返回的承诺 。 如果验证失败,无效的所有理由都会被扔入被拒绝的承诺中.
构建Mesh
建立Mesh( meshId: 字符串, meshConfig: MeshConfig) QQ 承诺 <boolean QQ 未定义 >
构建网格函数取 meshId 财务报告和审定财务报表 meshConfig 作为论据,并建造网状文物 mesh-artifact 当前工作目录中的文件夹 meshId 子目录.
在成功建造之后, buildMesh 返回解析为 true 财务报告和审定财务报表 false 为失败. buildMesh 将投出 MeshBuildError 如果有build错误.
编译Mesh
编译Mesh( meshId: 字符串) QQ 承诺 < string >
编译网格函数取自 meshId 查找已建成的 typeScript mesh 文物 mesh-artifact 文件夹,然后使用该文件夹汇编到 JavaScript typescript 软件包。 它返回已编译并写入文件系统的 JavaScript 文件路径的保证 .
常规梅什配置
普通梅什孔菲克(mesh孔菲克:Mesh孔菲克, BasePath?: 字符串) QQ 答应
将 Mesh 配置函数正常化 meshConfig 常规 additionalTypeDefs。 。 。 .
若为 additionalTypeDefs 包含 .graphql编号 :.gql 路径,它将解决其内容(包括通过 meshConfig.files,磁盘,或相对于 basePath 在提供时),保留 additionalTypeDefs 作为字符串的数组,并删除任何 GraphQL 文件条目 meshConfig.files。 。 。 .
import meshBuilder from "@multitenant-graphql/mesh-builder";
const normalized = await meshBuilder.normalizeMeshConfig(meshConfig);
// or
const normalized = await meshBuilder.normalizeMeshConfig(meshConfig, "/abs/path/to/.meshrc.json");
类型
validateMesh(meshConfig: MeshConfig) => Promise<boolean>
buildMesh(meshId: string, meshConfig: MeshConfig) => Promise<boolean | undefined>
compileMesh(meshId: string) => Promise<string[]>
normalizeMeshConfig(meshConfig: MeshConfig, basePath?: string) => Promise<MeshConfig>
type MeshBuildError {
name: string;
stack?: string;
cause?: unknown;
requestId?: string;
}