New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@envelop/core

Package Overview
Dependencies
Maintainers
1
Versions
1491
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@envelop/core - npm Package Compare versions

Comparing version

to
2.3.2-alpha-b81730b.0

63

index.js

@@ -1095,2 +1095,3 @@ 'use strict';

const VALIDATE_FN = Symbol('VALIDATE_FN');
const VALIDATION_ERRORS = Symbol('VALIDATION_ERRORS');
const useLazyLoadedSchema = (schemaLoader, validateSchema = true) => {

@@ -1104,2 +1105,3 @@ let schemaSet$;

setSchema(schemaObj);
return schemaObj;
});

@@ -1111,7 +1113,7 @@ }

},
onValidate({ validateFn, setValidationFn, extendContext }) {
if (schemaSet$) {
onValidate({ validateFn, params, setValidationFn, extendContext }) {
if (schemaSet$ != null) {
if (validateSchema) {
extendContext({
[VALIDATE_FN]: validateFn,
[VALIDATE_FN]: () => schemaSet$.then(schema => validateFn(schema, params.documentAST, params.rules, params.typeInfo, params.options)),
});

@@ -1122,16 +1124,20 @@ }

},
onExecute({ args: { schema, document, contextValue }, setResultAndStopExecution }) {
if (schemaSet$) {
const validateFn = contextValue[VALIDATE_FN];
const errors = validateFn === null || validateFn === void 0 ? void 0 : validateFn(schema, document);
onContextBuilding({ context, extendContext, breakContextBuilding }) {
var _a;
(_a = context[VALIDATE_FN]) === null || _a === void 0 ? void 0 : _a.call(context).then((errors) => {
if (errors === null || errors === void 0 ? void 0 : errors.length) {
setResultAndStopExecution({
errors,
extendContext({
[VALIDATION_ERRORS]: errors,
});
breakContextBuilding();
}
else {
return schemaSet$;
}
});
},
onExecute({ args: { contextValue }, setResultAndStopExecution }) {
// If validation errors are set in context
if (contextValue[VALIDATION_ERRORS]) {
setResultAndStopExecution({
errors: contextValue[VALIDATION_ERRORS],
});
}
return undefined;
},

@@ -1147,2 +1153,3 @@ };

setSchema(schemaObj);
return schemaObj;
});

@@ -1154,7 +1161,7 @@ }

},
onValidate({ validateFn, setValidationFn, extendContext }) {
if (schemaSet$) {
onValidate({ validateFn, params, setValidationFn, extendContext }) {
if (schemaSet$ != null) {
if (validateSchema) {
extendContext({
[VALIDATE_FN]: validateFn,
[VALIDATE_FN]: () => schemaSet$.then(schema => validateFn(schema, params.documentAST, params.rules, params.typeInfo, params.options)),
});

@@ -1165,16 +1172,20 @@ }

},
onExecute({ args: { schema, document, contextValue }, setResultAndStopExecution }) {
if (schemaSet$) {
const validateFn = contextValue[VALIDATE_FN];
const errors = validateFn === null || validateFn === void 0 ? void 0 : validateFn(schema, document);
onContextBuilding({ context, extendContext, breakContextBuilding }) {
var _a;
(_a = context[VALIDATE_FN]) === null || _a === void 0 ? void 0 : _a.call(context).then((errors) => {
if (errors === null || errors === void 0 ? void 0 : errors.length) {
setResultAndStopExecution({
errors,
extendContext({
[VALIDATION_ERRORS]: errors,
});
breakContextBuilding();
}
else {
return schemaSet$;
}
});
},
onExecute({ args: { contextValue }, setResultAndStopExecution }) {
// If validation errors are set in context
if (contextValue[VALIDATION_ERRORS]) {
setResultAndStopExecution({
errors: contextValue[VALIDATION_ERRORS],
});
}
return undefined;
},

@@ -1181,0 +1192,0 @@ };

{
"name": "@envelop/core",
"version": "2.3.2-alpha-a0c2439.0",
"version": "2.3.2-alpha-b81730b.0",
"sideEffects": false,

@@ -5,0 +5,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet