@envelop/core 2.3.2-alpha-fd02291.0 → 2.3.2-alpha-b81730b.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +8 -13
  2. package/index.mjs +8 -13
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1109,7 +1109,6 @@ const useLazyLoadedSchema = (schemaLoader, validateSchema = true) => {
1109
1109
  }
1110
1110
  },
1111
1111
  onValidate({ validateFn, params, setValidationFn, extendContext }) {
1112
- // If schemaSet promise is still ongoing
1113
1112
  if (schemaSet$ != null) {
1114
1113
  if (validateSchema) {
1115
1114
  extendContext({
@@ -1119,18 +1118,16 @@ const useLazyLoadedSchema = (schemaLoader, validateSchema = true) => {
1119
1118
  setValidationFn(() => []);
1120
1119
  }
1121
1120
  },
1122
- async onContextBuilding({ context, extendContext, breakContextBuilding }) {
1123
- // If schemaSet promise is still ongoing
1124
- if (context[VALIDATE_FN]) {
1125
- const validateFn = context[VALIDATE_FN];
1126
- const errors = validateFn === null || validateFn === void 0 ? void 0 : validateFn();
1121
+ onContextBuilding({ context, extendContext, breakContextBuilding }) {
1122
+ var _a;
1123
+ (_a = context[VALIDATE_FN]) === null || _a === void 0 ? void 0 : _a.call(context).then((errors) => {
1127
1124
  if (errors === null || errors === void 0 ? void 0 : errors.length) {
1128
1125
  extendContext({
1129
1126
  [VALIDATION_ERRORS]: errors,
1130
1127
  });
1131
1128
  breakContextBuilding();
1132
1129
  }
1133
- }
1130
+ });
1134
1131
  },
1135
1132
  onExecute({ args: { contextValue }, setResultAndStopExecution }) {
1136
1133
  // If validation errors are set in context
@@ -1166,18 +1163,16 @@ const useAsyncSchema = (schema$, validateSchema = true) => {
1166
1163
  setValidationFn(() => []);
1167
1164
  }
1168
1165
  },
1169
- async onContextBuilding({ context, extendContext, breakContextBuilding }) {
1170
- // If schemaSet promise is still ongoing
1171
- if (context[VALIDATE_FN]) {
1172
- const validateFn = context[VALIDATE_FN];
1173
- const errors = validateFn === null || validateFn === void 0 ? void 0 : validateFn();
1166
+ onContextBuilding({ context, extendContext, breakContextBuilding }) {
1167
+ var _a;
1168
+ (_a = context[VALIDATE_FN]) === null || _a === void 0 ? void 0 : _a.call(context).then((errors) => {
1174
1169
  if (errors === null || errors === void 0 ? void 0 : errors.length) {
1175
1170
  extendContext({
1176
1171
  [VALIDATION_ERRORS]: errors,
1177
1172
  });
1178
1173
  breakContextBuilding();
1179
1174
  }
1180
- }
1175
+ });
1181
1176
  },
1182
1177
  onExecute({ args: { contextValue }, setResultAndStopExecution }) {
1183
1178
  // If validation errors are set in context
package/index.mjs CHANGED
@@ -1105,7 +1105,6 @@ const useLazyLoadedSchema = (schemaLoader, validateSchema = true) => {
1105
1105
  }
1106
1106
  },
1107
1107
  onValidate({ validateFn, params, setValidationFn, extendContext }) {
1108
- // If schemaSet promise is still ongoing
1109
1108
  if (schemaSet$ != null) {
1110
1109
  if (validateSchema) {
1111
1110
  extendContext({
@@ -1115,18 +1114,16 @@ const useLazyLoadedSchema = (schemaLoader, validateSchema = true) => {
1115
1114
  setValidationFn(() => []);
1116
1115
  }
1117
1116
  },
1118
- async onContextBuilding({ context, extendContext, breakContextBuilding }) {
1119
- // If schemaSet promise is still ongoing
1120
- if (context[VALIDATE_FN]) {
1121
- const validateFn = context[VALIDATE_FN];
1122
- const errors = validateFn === null || validateFn === void 0 ? void 0 : validateFn();
1117
+ onContextBuilding({ context, extendContext, breakContextBuilding }) {
1118
+ var _a;
1119
+ (_a = context[VALIDATE_FN]) === null || _a === void 0 ? void 0 : _a.call(context).then((errors) => {
1123
1120
  if (errors === null || errors === void 0 ? void 0 : errors.length) {
1124
1121
  extendContext({
1125
1122
  [VALIDATION_ERRORS]: errors,
1126
1123
  });
1127
1124
  breakContextBuilding();
1128
1125
  }
1129
- }
1126
+ });
1130
1127
  },
1131
1128
  onExecute({ args: { contextValue }, setResultAndStopExecution }) {
1132
1129
  // If validation errors are set in context
@@ -1162,18 +1159,16 @@ const useAsyncSchema = (schema$, validateSchema = true) => {
1162
1159
  setValidationFn(() => []);
1163
1160
  }
1164
1161
  },
1165
- async onContextBuilding({ context, extendContext, breakContextBuilding }) {
1166
- // If schemaSet promise is still ongoing
1167
- if (context[VALIDATE_FN]) {
1168
- const validateFn = context[VALIDATE_FN];
1169
- const errors = validateFn === null || validateFn === void 0 ? void 0 : validateFn();
1162
+ onContextBuilding({ context, extendContext, breakContextBuilding }) {
1163
+ var _a;
1164
+ (_a = context[VALIDATE_FN]) === null || _a === void 0 ? void 0 : _a.call(context).then((errors) => {
1170
1165
  if (errors === null || errors === void 0 ? void 0 : errors.length) {
1171
1166
  extendContext({
1172
1167
  [VALIDATION_ERRORS]: errors,
1173
1168
  });
1174
1169
  breakContextBuilding();
1175
1170
  }
1176
- }
1171
+ });
1177
1172
  },
1178
1173
  onExecute({ args: { contextValue }, setResultAndStopExecution }) {
1179
1174
  // If validation errors are set in context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/core",
3
- "version": "2.3.2-alpha-fd02291.0",
3
+ "version": "2.3.2-alpha-b81730b.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"