@envelop/operation-field-permissions 8.0.0-rc-20250303225225-6404b4b6abe482b5e96fbb7754ca9dd62459e8b7 → 8.0.0-rc-20250306152642-f02839d206a88fa8ebab104fec74f8eca1874bc3
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.
- package/cjs/index.js +3 -3
- package/esm/index.js +3 -3
- package/package.json +4 -3
- package/typings/index.d.cts +1 -2
- package/typings/index.d.ts +1 -2
package/cjs/index.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.useOperationFieldPermissions = void 0;
|
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
const core_1 = require("@envelop/core");
|
|
6
6
|
const extended_validation_1 = require("@envelop/extended-validation");
|
|
7
|
+
const promise_helpers_1 = require("@whatwg-node/promise-helpers");
|
|
7
8
|
const OPERATION_PERMISSIONS_SYMBOL = Symbol('OPERATION_PERMISSIONS_SYMBOL');
|
|
8
9
|
/**
|
|
9
10
|
* Returns a set of type names that allow access to all fields in the type.
|
|
@@ -91,8 +92,7 @@ const useOperationFieldPermissions = (opts) => {
|
|
|
91
92
|
}),
|
|
92
93
|
],
|
|
93
94
|
}));
|
|
94
|
-
addPlugin((0, core_1.useExtendContext)(
|
|
95
|
-
const permissions = await opts.getPermissions(context);
|
|
95
|
+
addPlugin((0, core_1.useExtendContext)(context => (0, promise_helpers_1.handleMaybePromise)(() => opts.getPermissions(context), permissions => {
|
|
96
96
|
// Schema coordinates is a set of type-name field-name strings that
|
|
97
97
|
// describe the position of a field in the schema.
|
|
98
98
|
const schemaCoordinates = toSet(permissions);
|
|
@@ -105,7 +105,7 @@ const useOperationFieldPermissions = (opts) => {
|
|
|
105
105
|
return {
|
|
106
106
|
[OPERATION_PERMISSIONS_SYMBOL]: scopeContext,
|
|
107
107
|
};
|
|
108
|
-
}));
|
|
108
|
+
})));
|
|
109
109
|
},
|
|
110
110
|
};
|
|
111
111
|
};
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getNamedType, GraphQLError, isInterfaceType, isIntrospectionType, isObjectType, isUnionType, } from 'graphql';
|
|
2
2
|
import { useExtendContext } from '@envelop/core';
|
|
3
3
|
import { useExtendedValidation } from '@envelop/extended-validation';
|
|
4
|
+
import { handleMaybePromise } from '@whatwg-node/promise-helpers';
|
|
4
5
|
const OPERATION_PERMISSIONS_SYMBOL = Symbol('OPERATION_PERMISSIONS_SYMBOL');
|
|
5
6
|
/**
|
|
6
7
|
* Returns a set of type names that allow access to all fields in the type.
|
|
@@ -88,8 +89,7 @@ export const useOperationFieldPermissions = (opts) => {
|
|
|
88
89
|
}),
|
|
89
90
|
],
|
|
90
91
|
}));
|
|
91
|
-
addPlugin(useExtendContext(
|
|
92
|
-
const permissions = await opts.getPermissions(context);
|
|
92
|
+
addPlugin(useExtendContext(context => handleMaybePromise(() => opts.getPermissions(context), permissions => {
|
|
93
93
|
// Schema coordinates is a set of type-name field-name strings that
|
|
94
94
|
// describe the position of a field in the schema.
|
|
95
95
|
const schemaCoordinates = toSet(permissions);
|
|
@@ -102,7 +102,7 @@ export const useOperationFieldPermissions = (opts) => {
|
|
|
102
102
|
return {
|
|
103
103
|
[OPERATION_PERMISSIONS_SYMBOL]: scopeContext,
|
|
104
104
|
};
|
|
105
|
-
}));
|
|
105
|
+
})));
|
|
106
106
|
},
|
|
107
107
|
};
|
|
108
108
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/operation-field-permissions",
|
|
3
|
-
"version": "8.0.0-rc-
|
|
3
|
+
"version": "8.0.0-rc-20250306152642-f02839d206a88fa8ebab104fec74f8eca1874bc3",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
7
|
-
"@envelop/core": "^
|
|
7
|
+
"@envelop/core": "^6.0.0-rc-20250306152642-f02839d206a88fa8ebab104fec74f8eca1874bc3"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
+
"@whatwg-node/promise-helpers": "^1.2.4",
|
|
10
11
|
"tslib": "^2.5.0",
|
|
11
|
-
"@envelop/extended-validation": "^6.0.0-rc-
|
|
12
|
+
"@envelop/extended-validation": "^6.0.0-rc-20250306152642-f02839d206a88fa8ebab104fec74f8eca1874bc3"
|
|
12
13
|
},
|
|
13
14
|
"repository": {
|
|
14
15
|
"type": "git",
|
package/typings/index.d.cts
CHANGED
package/typings/index.d.ts
CHANGED