Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@fruits-chain/qiufen-pro-graphql-mock
Advanced tools
yarn add @fruits-chain/qiufen-pro-graphql-mock -D
interface GraphqlKitConfig {
/** your qiufen service port */
port: number
/** backend service config */
endpoint: ServiceConfig
/** local graphql schema file path */
localSchemaFile?: string
/** use either local schema or remote schema, if unset, remote will be used */
schemaPolicy?: SchemaPolicy
/** mock config */
mock?: MockConfig
}
interface ServiceConfig {
/** backend service url */
url: string
}
interface MockConfig {
/** value map rules, you should add all your scalar type mappers here or you'll get an error */
scalarMap: any
/** graphql resolvers for operations, you can custom operation response here */
resolvers?: any
}
type SchemaPolicy = 'local' | 'remote'
interface PlaygroundConfig {
/** request headers */
headers?: Record<string, string>
}
// demo of configure
const Mock = require('mockjs')
const { GraphqlKitConfig } = require('@fruits-chain/qiufen-pro-graphql-mock')
const { Random } = Mock
//@ts-check
/** @typedef {GraphqlKitConfig} Config **/
/** @type Config */
const config = {
port: 4200,
// Local schema file path
localSchemaFile: './src/graphql/generated/schema.graphql',
// "remote" | "local". When the remote gateway fails, you are advised to set it to "local" and specify the path of the local schema file.
schemaPolicy: 'remote',
endpoint: {
// remote schema address
url: 'http://localhost:4000/graphql',
},
mock: {
scalarMap: {
Int: () => Random.integer(0, 100),
String: () => Random.ctitle(2, 4),
ID: () => Random.id(),
Boolean: () => Random.boolean(),
BigDecimal: () => Random.integer(0, 1000000),
Float: () => Random.float(0, 100),
Date: () => Random.date(),
DateTime: () => Random.datetime(),
Long: () => Random.integer(0, 10000),
NumberOrBoolOrStringOrNull: () => null,
NumberOrString: () => null,
Object: () => ({}),
},
resolvers: {
Query: {
/* Custom field interface return */
// ListTaskBoard: () => {
// return [
// {
// commodityName: "111111111",
// commoditySpecOptionName: "争11232131231212果",
// commodityTypeName: "样情",
// completedQuantity: "府委产",
// createBy: "火传离那",
// customerName: "布红系",
// customerTypeName: "报件指加",
// expectSaleQuantity: "容规数",
// index: 47,
// leaderName: "车做",
// line: "质身管手",
// planId: "320000201903036414",
// planProductionQuantity: "年着",
// productionType: "专本学",
// schedule: "再严今花",
// },
// ]
// },
},
},
},
}
module.exports = config
const {
executeQiufenMockingServer,
} = require('@fruits-chain/qiufen-pro-graphql-mock')
executeQiufenMockingServer()
import { startMockingServer } = require('@fruits-chain/qiufen-pro-graphql-mock')
startMockingServer(config) // config above
FAQs
Mocking graphql schema capabilities
The npm package @fruits-chain/qiufen-pro-graphql-mock receives a total of 0 weekly downloads. As such, @fruits-chain/qiufen-pro-graphql-mock popularity was classified as not popular.
We found that @fruits-chain/qiufen-pro-graphql-mock demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.