Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@playlyfe/gql
Advanced tools
Graphql sevice which watches project files and provides:
yarn add @playlyfe/gql --dev
or npm install @playlyfe/gql --dev
The configuration file is specified in the json5 format.
To specify the configuration, you can refer to the configuration definition schema.
type GQLConfig = {
schema: {
files: FileMatchConfig,
validate?: ValidateConfig
},
query?: { // query optional
files: Array<{
match: FileMatchConfig, // match files
parser: QueryParser,
isRelay?: boolean,
validate?: ValidateConfig,
}>
}
};
type FileMatchConfig = Globs | { include: Globs, ignore?: Globs };
type Globs = string | Array<string>; // eg **/*.js **/*.gql
type QueryParser = (
'QueryParser'
| ['EmbeddedQueryParser', { startTag: regexpStr, endTag: regexpStr }];
);
type ValidateConfig = {
extends: 'gql-rules-schema' | 'gql-rules-query' | 'gql-rules-query-relay',
rules?: {
[ruleName: string]: 'off' | 'warn' | 'error',
},
};
Specifying only schema support (query parsing and related features are disabled):
// .gqlconfig (only schema)
{
schema: {
files: 'schema/**/*.gql'
}
}
Specifying query and schema support:
// .gqlconfig (with query)
{
schema: {
files: 'schema/**/*.gql',
},
query: {
files: [
// query gql files
{
match: 'path/to/files/**/*.gql',
parser: 'QueryParser',
},
// [Embedded queries] relay files
{
match: { include: 'path/to/code/**/*.js', ignore: '**/tests/**/*.js' },
parser: [ 'EmbeddedQueryParser', { startTag: 'Relay\\.QL`', endTag: '`' } ],
isRelay: true,
},
// [Embedded queries] gql tag files
{
match: { include: 'path/to/code/**/*.js', ignore: '**/tests/**/*.js' },
parser: [ 'EmbeddedQueryParser', { startTag: 'gql`', endTag: '`' } ],
},
// [Embedded queries] some other tags
{
match: 'path/to/code/**/*.xyz',
parser: [ 'EmbeddedQueryParser', { startTag: '"""' endTag: '"""' } ],
},
// [Embedded queries] some other tags and modify validation rules
{
match: 'path/to/code/**/*.xyz',
parser: [ 'EmbeddedQueryParser', { startTag: '"""' endTag: '"""' } ],
validate: {
extends: 'gql-rules-query',
rules: {
LoneAnonymousOperation: 'off',
NoUnusedVariables: 'warn',
},
}
},
]
}
}
If you're looking to implement the GQL service in a plugin, you'll need to call these service APIs:
class GQLService {
constructor(options: ?Options)
/*** List of supported commands ***/
// query errors
status(): Array<GQLError>
// autocomplete suggestion at position
autocomplete(params: CommandParams): Array<GQLHint>
// Gets the definition location
getDef(params: CommandParams): ?DefLocation
// Find all refs of symbol at position
findRefs(params: CommandParams): Array<DefLocation>
// gets the info of symbol at position
getInfo(params: CommandParams): ?GQLInfo
/*** Helpers ***/
// return different file extensions found in .gqlconfig
getFileExtensions(): Array<string>
}
type Options = {
cwd?: string,
onChange?: () => void, // called when something changes
onInit?: () => void, // called once after initialization
debug?: boolean, // enable debug logs
};
type CommandParams = {
sourceText: string,
sourcePath: string,
position: {
line: number, // starts with 1
column: number, // starts with 1
},
};
type DefLocation = {
start: { line: number, column: number },
end: { line: number, column: number },
path: AbsoluteFilePath,
};
type GQLError = {
message: string,
severity: 'warn' | 'error',
locations: ?Array<{ line: number, column: number, path: AbsolutePath }>,
};
type GQLHint = {
text: string,
type?: string,
description?: string,
};
FAQs
gql service and tools
The npm package @playlyfe/gql receives a total of 3,820 weekly downloads. As such, @playlyfe/gql popularity was classified as popular.
We found that @playlyfe/gql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.