@strapi/plugin-graphql 0.0.0-experimental.6340da17068c3bed7fb006e7bcc554c71129e282 → 0.0.0-experimental.63624e21eb5b0713345a0cf2f68f1c40eab427bc
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/dist/admin/index.js +1 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/package.json.js +1 -2
- package/dist/admin/package.json.js.map +1 -1
- package/dist/admin/package.json.mjs +1 -2
- package/dist/admin/package.json.mjs.map +1 -1
- package/dist/admin/src/index.d.ts +2 -1
- package/dist/admin/translations/ko.json.js +10 -0
- package/dist/admin/translations/ko.json.js.map +1 -0
- package/dist/admin/translations/ko.json.mjs +8 -0
- package/dist/admin/translations/ko.json.mjs.map +1 -0
- package/dist/server/bootstrap.js +35 -10
- package/dist/server/bootstrap.js.map +1 -1
- package/dist/server/bootstrap.mjs +33 -9
- package/dist/server/bootstrap.mjs.map +1 -1
- package/dist/server/format-graphql-error.js +34 -8
- package/dist/server/format-graphql-error.js.map +1 -1
- package/dist/server/format-graphql-error.mjs +34 -8
- package/dist/server/format-graphql-error.mjs.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/services/builders/dynamic-zones.js +3 -3
- package/dist/server/services/builders/dynamic-zones.js.map +1 -1
- package/dist/server/services/builders/dynamic-zones.mjs +3 -3
- package/dist/server/services/builders/dynamic-zones.mjs.map +1 -1
- package/dist/server/services/builders/entity.js +4 -4
- package/dist/server/services/builders/entity.js.map +1 -1
- package/dist/server/services/builders/entity.mjs +2 -2
- package/dist/server/services/builders/entity.mjs.map +1 -1
- package/dist/server/services/builders/enums.js +2 -2
- package/dist/server/services/builders/enums.js.map +1 -1
- package/dist/server/services/builders/enums.mjs +2 -2
- package/dist/server/services/builders/enums.mjs.map +1 -1
- package/dist/server/services/builders/filters/content-type.js +1 -0
- package/dist/server/services/builders/filters/content-type.js.map +1 -1
- package/dist/server/services/builders/filters/content-type.mjs +1 -0
- package/dist/server/services/builders/filters/content-type.mjs.map +1 -1
- package/dist/server/services/builders/filters/operators/eq.js.map +1 -1
- package/dist/server/services/builders/filters/operators/eq.mjs.map +1 -1
- package/dist/server/services/builders/filters/operators/index.js +3 -3
- package/dist/server/services/builders/filters/operators/index.js.map +1 -1
- package/dist/server/services/builders/filters/operators/index.mjs +3 -3
- package/dist/server/services/builders/filters/operators/index.mjs.map +1 -1
- package/dist/server/services/builders/filters/operators/not.js +1 -0
- package/dist/server/services/builders/filters/operators/not.js.map +1 -1
- package/dist/server/services/builders/filters/operators/not.mjs +1 -0
- package/dist/server/services/builders/filters/operators/not.mjs.map +1 -1
- package/dist/server/services/builders/generic-morph.js +1 -2
- package/dist/server/services/builders/generic-morph.js.map +1 -1
- package/dist/server/services/builders/generic-morph.mjs +1 -2
- package/dist/server/services/builders/generic-morph.mjs.map +1 -1
- package/dist/server/services/builders/index.js +2 -4
- package/dist/server/services/builders/index.js.map +1 -1
- package/dist/server/services/builders/index.mjs +2 -4
- package/dist/server/services/builders/index.mjs.map +1 -1
- package/dist/server/services/builders/input.js +1 -2
- package/dist/server/services/builders/input.js.map +1 -1
- package/dist/server/services/builders/input.mjs +1 -2
- package/dist/server/services/builders/input.mjs.map +1 -1
- package/dist/server/services/builders/queries/collection-type.js.map +1 -1
- package/dist/server/services/builders/queries/collection-type.mjs.map +1 -1
- package/dist/server/services/builders/queries/single-type.js.map +1 -1
- package/dist/server/services/builders/queries/single-type.mjs.map +1 -1
- package/dist/server/services/builders/relation-response-collection.js +3 -3
- package/dist/server/services/builders/relation-response-collection.js.map +1 -1
- package/dist/server/services/builders/relation-response-collection.mjs +3 -3
- package/dist/server/services/builders/relation-response-collection.mjs.map +1 -1
- package/dist/server/services/builders/resolvers/association.js +4 -3
- package/dist/server/services/builders/resolvers/association.js.map +1 -1
- package/dist/server/services/builders/resolvers/association.mjs +4 -3
- package/dist/server/services/builders/resolvers/association.mjs.map +1 -1
- package/dist/server/services/builders/resolvers/component.js +1 -0
- package/dist/server/services/builders/resolvers/component.js.map +1 -1
- package/dist/server/services/builders/resolvers/component.mjs +1 -0
- package/dist/server/services/builders/resolvers/component.mjs.map +1 -1
- package/dist/server/services/builders/resolvers/query.js +3 -3
- package/dist/server/services/builders/resolvers/query.js.map +1 -1
- package/dist/server/services/builders/resolvers/query.mjs +3 -3
- package/dist/server/services/builders/resolvers/query.mjs.map +1 -1
- package/dist/server/services/builders/response-collection.js +4 -4
- package/dist/server/services/builders/response-collection.js.map +1 -1
- package/dist/server/services/builders/response-collection.mjs +3 -3
- package/dist/server/services/builders/response-collection.mjs.map +1 -1
- package/dist/server/services/builders/response.js +1 -2
- package/dist/server/services/builders/response.js.map +1 -1
- package/dist/server/services/builders/response.mjs +1 -2
- package/dist/server/services/builders/response.mjs.map +1 -1
- package/dist/server/services/builders/type.js +4 -4
- package/dist/server/services/builders/type.js.map +1 -1
- package/dist/server/services/builders/type.mjs +3 -3
- package/dist/server/services/builders/type.mjs.map +1 -1
- package/dist/server/services/builders/utils.js +7 -6
- package/dist/server/services/builders/utils.js.map +1 -1
- package/dist/server/services/builders/utils.mjs +7 -6
- package/dist/server/services/builders/utils.mjs.map +1 -1
- package/dist/server/services/constants.js +3 -3
- package/dist/server/services/constants.js.map +1 -1
- package/dist/server/services/constants.mjs +3 -3
- package/dist/server/services/constants.mjs.map +1 -1
- package/dist/server/services/content-api/index.js +12 -10
- package/dist/server/services/content-api/index.js.map +1 -1
- package/dist/server/services/content-api/index.mjs +12 -10
- package/dist/server/services/content-api/index.mjs.map +1 -1
- package/dist/server/services/content-api/policy.js +2 -3
- package/dist/server/services/content-api/policy.js.map +1 -1
- package/dist/server/services/content-api/policy.mjs +2 -3
- package/dist/server/services/content-api/policy.mjs.map +1 -1
- package/dist/server/services/content-api/register-functions/internals.js +1 -3
- package/dist/server/services/content-api/register-functions/internals.js.map +1 -1
- package/dist/server/services/content-api/register-functions/internals.mjs +1 -3
- package/dist/server/services/content-api/register-functions/internals.mjs.map +1 -1
- package/dist/server/services/content-api/wrap-resolvers.js +13 -13
- package/dist/server/services/content-api/wrap-resolvers.js.map +1 -1
- package/dist/server/services/content-api/wrap-resolvers.mjs +13 -13
- package/dist/server/services/content-api/wrap-resolvers.mjs.map +1 -1
- package/dist/server/services/extension/extension.js +3 -3
- package/dist/server/services/extension/extension.js.map +1 -1
- package/dist/server/services/extension/extension.mjs +3 -3
- package/dist/server/services/extension/extension.mjs.map +1 -1
- package/dist/server/services/extension/shadow-crud-manager.js +3 -3
- package/dist/server/services/extension/shadow-crud-manager.js.map +1 -1
- package/dist/server/services/extension/shadow-crud-manager.mjs +3 -3
- package/dist/server/services/extension/shadow-crud-manager.mjs.map +1 -1
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/index.mjs +2 -2
- package/dist/server/services/index.mjs.map +1 -1
- package/dist/server/services/internals/helpers/get-enabled-scalars.js +2 -2
- package/dist/server/services/internals/helpers/get-enabled-scalars.js.map +1 -1
- package/dist/server/services/internals/helpers/get-enabled-scalars.mjs +1 -1
- package/dist/server/services/internals/helpers/get-enabled-scalars.mjs.map +1 -1
- package/dist/server/services/internals/types/error.js +1 -2
- package/dist/server/services/internals/types/error.js.map +1 -1
- package/dist/server/services/internals/types/error.mjs +1 -2
- package/dist/server/services/internals/types/error.mjs.map +1 -1
- package/dist/server/services/internals/types/filters.js +3 -0
- package/dist/server/services/internals/types/filters.js.map +1 -1
- package/dist/server/services/internals/types/filters.mjs +3 -0
- package/dist/server/services/internals/types/filters.mjs.map +1 -1
- package/dist/server/services/type-registry.js +1 -2
- package/dist/server/services/type-registry.js.map +1 -1
- package/dist/server/services/type-registry.mjs +1 -2
- package/dist/server/services/type-registry.mjs.map +1 -1
- package/dist/server/services/utils/attributes.js +7 -6
- package/dist/server/services/utils/attributes.js.map +1 -1
- package/dist/server/services/utils/attributes.mjs +7 -6
- package/dist/server/services/utils/attributes.mjs.map +1 -1
- package/dist/server/services/utils/mappers/entity-to-response-entity.js +2 -2
- package/dist/server/services/utils/mappers/entity-to-response-entity.js.map +1 -1
- package/dist/server/services/utils/mappers/entity-to-response-entity.mjs +2 -2
- package/dist/server/services/utils/mappers/entity-to-response-entity.mjs.map +1 -1
- package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.js +11 -10
- package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.js.map +1 -1
- package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.mjs +10 -9
- package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.mjs.map +1 -1
- package/dist/server/services/utils/mappers/graphql-scalar-to-operators.js +4 -3
- package/dist/server/services/utils/mappers/graphql-scalar-to-operators.js.map +1 -1
- package/dist/server/services/utils/mappers/graphql-scalar-to-operators.mjs +4 -3
- package/dist/server/services/utils/mappers/graphql-scalar-to-operators.mjs.map +1 -1
- package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.js +3 -3
- package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.js.map +1 -1
- package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.mjs +2 -2
- package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.mjs.map +1 -1
- package/dist/server/services/utils/naming.js +13 -10
- package/dist/server/services/utils/naming.js.map +1 -1
- package/dist/server/services/utils/naming.mjs +9 -6
- package/dist/server/services/utils/naming.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/format-graphql-error.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +170 -54
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/services/builders/dynamic-zones.d.ts +1 -1
- package/dist/server/src/services/builders/filters/content-type.d.ts.map +1 -1
- package/dist/server/src/services/builders/filters/index.d.ts +1 -1
- package/dist/server/src/services/builders/filters/operators/index.d.ts +112 -5
- package/dist/server/src/services/builders/filters/operators/index.d.ts.map +1 -1
- package/dist/server/src/services/builders/filters/operators/not.d.ts.map +1 -1
- package/dist/server/src/services/builders/generic-morph.d.ts.map +1 -1
- package/dist/server/src/services/builders/index.d.ts +120 -11
- package/dist/server/src/services/builders/index.d.ts.map +1 -1
- package/dist/server/src/services/builders/input.d.ts.map +1 -1
- package/dist/server/src/services/builders/mutations/index.d.ts +2 -2
- package/dist/server/src/services/builders/queries/collection-type.d.ts.map +1 -1
- package/dist/server/src/services/builders/queries/index.d.ts +2 -2
- package/dist/server/src/services/builders/resolvers/association.d.ts.map +1 -1
- package/dist/server/src/services/builders/resolvers/component.d.ts.map +1 -1
- package/dist/server/src/services/builders/resolvers/index.d.ts +7 -7
- package/dist/server/src/services/builders/resolvers/index.d.ts.map +1 -1
- package/dist/server/src/services/builders/resolvers/query.d.ts +3 -3
- package/dist/server/src/services/builders/response.d.ts.map +1 -1
- package/dist/server/src/services/builders/utils.d.ts +4 -2
- package/dist/server/src/services/builders/utils.d.ts.map +1 -1
- package/dist/server/src/services/constants.d.ts +4 -67
- package/dist/server/src/services/constants.d.ts.map +1 -1
- package/dist/server/src/services/content-api/index.d.ts.map +1 -1
- package/dist/server/src/services/content-api/policy.d.ts.map +1 -1
- package/dist/server/src/services/extension/shadow-crud-manager.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +170 -54
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/internals/types/error.d.ts.map +1 -1
- package/dist/server/src/services/internals/types/filters.d.ts.map +1 -1
- package/dist/server/src/services/type-registry.d.ts.map +1 -1
- package/dist/server/src/services/utils/attributes.d.ts.map +1 -1
- package/dist/server/src/services/utils/index.d.ts +46 -40
- package/dist/server/src/services/utils/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/mappers/entity-to-response-entity.d.ts +14 -7
- package/dist/server/src/services/utils/mappers/entity-to-response-entity.d.ts.map +1 -1
- package/dist/server/src/services/utils/mappers/graphql-filters-to-strapi-query.d.ts.map +1 -1
- package/dist/server/src/services/utils/mappers/index.d.ts +19 -13
- package/dist/server/src/services/utils/mappers/index.d.ts.map +1 -1
- package/dist/server/src/types/index.d.ts +64 -0
- package/dist/server/src/types/index.d.ts.map +1 -0
- package/dist/server/src/types/services.d.ts +97 -0
- package/dist/server/src/types/services.d.ts.map +1 -0
- package/package.json +32 -18
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { snakeCase, pick } from 'lodash';
|
|
2
2
|
import { errors } from '@strapi/utils';
|
|
3
3
|
import { unwrapResolverError } from '@apollo/server/errors';
|
|
4
4
|
import { GraphQLError } from 'graphql';
|
|
5
5
|
|
|
6
6
|
const { HttpError, ForbiddenError, UnauthorizedError, ApplicationError, ValidationError } = errors;
|
|
7
|
-
const formatToCode = (name)=>`STRAPI_${
|
|
7
|
+
const formatToCode = (name)=>`STRAPI_${snakeCase(name).toUpperCase()}`;
|
|
8
8
|
const formatErrorToExtension = (error)=>({
|
|
9
|
-
error: pick([
|
|
9
|
+
error: pick(error, [
|
|
10
10
|
'name',
|
|
11
11
|
'message',
|
|
12
12
|
'details'
|
|
13
|
-
])
|
|
13
|
+
])
|
|
14
14
|
});
|
|
15
15
|
function createFormattedError(formattedError, message, code, originalError) {
|
|
16
16
|
const options = {
|
|
@@ -29,8 +29,10 @@ function createFormattedError(formattedError, message, code, originalError) {
|
|
|
29
29
|
* Intercepts specific Strapi error types to send custom error response codes in the GraphQL response
|
|
30
30
|
*/ function formatGraphqlError(formattedError, error) {
|
|
31
31
|
const originalError = unwrapResolverError(error);
|
|
32
|
-
//
|
|
33
|
-
|
|
32
|
+
// Nothing to inspect, so keep Apollo's own formatted error. This must not be an emptiness check:
|
|
33
|
+
// an Error only has non-enumerable fields (message, stack), so lodash isEmpty reports it as
|
|
34
|
+
// empty and a bare Error from a resolver would reach the client with its message
|
|
35
|
+
if (originalError === null || originalError === undefined) {
|
|
34
36
|
return formattedError;
|
|
35
37
|
}
|
|
36
38
|
const { message = '', name = 'UNKNOWN' } = originalError;
|
|
@@ -50,8 +52,32 @@ function createFormattedError(formattedError, message, code, originalError) {
|
|
|
50
52
|
// else if originalError doesn't appear to be from Strapi or GraphQL..
|
|
51
53
|
// Log the error
|
|
52
54
|
strapi.log.error(originalError);
|
|
53
|
-
// Create a generic 500 to send so we don't risk leaking any data
|
|
54
|
-
|
|
55
|
+
// Create a generic 500 to send so we don't risk leaking any data. The error that went to the log
|
|
56
|
+
// is not passed on: its name, message and details can hold SQL with bound values, hostnames and
|
|
57
|
+
// driver reasons. The extension carries the same error shape as the REST 500 body.
|
|
58
|
+
// path and locations stay: they name the field and the place in the query, and clients use them
|
|
59
|
+
// to attach the error. A fresh GraphQLError does not copy locations (the constructor only
|
|
60
|
+
// derives them from source positions), and spreading formattedError would also copy
|
|
61
|
+
// extensions.stacktrace in development.
|
|
62
|
+
const sanitized = createFormattedError({
|
|
63
|
+
message: 'Internal Server Error',
|
|
64
|
+
path: formattedError.path
|
|
65
|
+
}, 'Internal Server Error', 'INTERNAL_SERVER_ERROR', {
|
|
66
|
+
name: 'InternalServerError',
|
|
67
|
+
message: 'Internal Server Error'
|
|
68
|
+
});
|
|
69
|
+
// The GraphQLError type marks locations readonly. The constructor still creates a writable,
|
|
70
|
+
// enumerable field, and it will not copy locations off a formatted error, so set the field
|
|
71
|
+
// directly. Clients read it from toJSON().
|
|
72
|
+
if (formattedError.locations != null) {
|
|
73
|
+
Object.defineProperty(sanitized, 'locations', {
|
|
74
|
+
value: formattedError.locations,
|
|
75
|
+
enumerable: true,
|
|
76
|
+
writable: true,
|
|
77
|
+
configurable: true
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return sanitized;
|
|
55
81
|
}
|
|
56
82
|
|
|
57
83
|
export { formatGraphqlError };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-graphql-error.mjs","sources":["../../server/src/format-graphql-error.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"format-graphql-error.mjs","sources":["../../server/src/format-graphql-error.ts"],"sourcesContent":["import { snakeCase, pick } from 'lodash';\nimport { errors } from '@strapi/utils';\nimport { unwrapResolverError } from '@apollo/server/errors';\nimport { GraphQLError, type GraphQLFormattedError } from 'graphql';\n\nconst { HttpError, ForbiddenError, UnauthorizedError, ApplicationError, ValidationError } = errors;\n\nconst formatToCode = (name: string) => `STRAPI_${snakeCase(name).toUpperCase()}`;\nconst formatErrorToExtension = (error: any) => ({\n error: pick(error, ['name', 'message', 'details']),\n});\n\nfunction createFormattedError(\n formattedError: GraphQLFormattedError,\n message: string,\n code: string,\n originalError: unknown\n) {\n const options = {\n ...formattedError,\n extensions: {\n ...formattedError.extensions,\n ...formatErrorToExtension(originalError),\n code,\n },\n };\n\n return new GraphQLError(message, options);\n}\n\n/**\n * The handler for Apollo Server v4's formatError config option\n *\n * Intercepts specific Strapi error types to send custom error response codes in the GraphQL response\n */\nexport function formatGraphqlError(formattedError: GraphQLFormattedError, error: unknown) {\n const originalError = unwrapResolverError(error);\n\n // Nothing to inspect, so keep Apollo's own formatted error. This must not be an emptiness check:\n // an Error only has non-enumerable fields (message, stack), so lodash isEmpty reports it as\n // empty and a bare Error from a resolver would reach the client with its message\n if (originalError === null || originalError === undefined) {\n return formattedError;\n }\n\n const { message = '', name = 'UNKNOWN' } = originalError as Error;\n\n if (originalError instanceof ForbiddenError || originalError instanceof UnauthorizedError) {\n return createFormattedError(formattedError, message, 'FORBIDDEN', originalError);\n }\n\n if (originalError instanceof ValidationError) {\n return createFormattedError(formattedError, message, 'BAD_USER_INPUT', originalError);\n }\n\n if (originalError instanceof ApplicationError || originalError instanceof HttpError) {\n const errorName = formatToCode(name);\n return createFormattedError(formattedError, message, errorName, originalError);\n }\n\n if (originalError instanceof GraphQLError) {\n return formattedError;\n }\n\n // else if originalError doesn't appear to be from Strapi or GraphQL..\n\n // Log the error\n strapi.log.error(originalError);\n\n // Create a generic 500 to send so we don't risk leaking any data. The error that went to the log\n // is not passed on: its name, message and details can hold SQL with bound values, hostnames and\n // driver reasons. The extension carries the same error shape as the REST 500 body.\n // path and locations stay: they name the field and the place in the query, and clients use them\n // to attach the error. A fresh GraphQLError does not copy locations (the constructor only\n // derives them from source positions), and spreading formattedError would also copy\n // extensions.stacktrace in development.\n const sanitized = createFormattedError(\n { message: 'Internal Server Error', path: formattedError.path },\n 'Internal Server Error',\n 'INTERNAL_SERVER_ERROR',\n { name: 'InternalServerError', message: 'Internal Server Error' }\n );\n // The GraphQLError type marks locations readonly. The constructor still creates a writable,\n // enumerable field, and it will not copy locations off a formatted error, so set the field\n // directly. Clients read it from toJSON().\n if (formattedError.locations != null) {\n Object.defineProperty(sanitized, 'locations', {\n value: formattedError.locations,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n return sanitized;\n}\n"],"names":["HttpError","ForbiddenError","UnauthorizedError","ApplicationError","ValidationError","errors","formatToCode","name","snakeCase","toUpperCase","formatErrorToExtension","error","pick","createFormattedError","formattedError","message","code","originalError","options","extensions","GraphQLError","formatGraphqlError","unwrapResolverError","undefined","errorName","strapi","log","sanitized","path","locations","Object","defineProperty","value","enumerable","writable","configurable"],"mappings":";;;;;AAKA,MAAM,EAAEA,SAAS,EAAEC,cAAc,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAEC,eAAe,EAAE,GAAGC,MAAAA;AAE5F,MAAMC,YAAAA,GAAe,CAACC,IAAAA,GAAiB,CAAC,OAAO,EAAEC,SAAAA,CAAUD,IAAAA,CAAAA,CAAME,WAAW,EAAA,CAAA,CAAI;AAChF,MAAMC,sBAAAA,GAAyB,CAACC,KAAAA,IAAgB;AAC9CA,QAAAA,KAAAA,EAAOC,KAAKD,KAAAA,EAAO;AAAC,YAAA,MAAA;AAAQ,YAAA,SAAA;AAAW,YAAA;AAAU,SAAA;KACnD,CAAA;AAEA,SAASE,qBACPC,cAAqC,EACrCC,OAAe,EACfC,IAAY,EACZC,aAAsB,EAAA;AAEtB,IAAA,MAAMC,OAAAA,GAAU;A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;;;AASjB,IAAA,MAAMU,YAAYd,oBAAAA,CAChB;QAAEE,OAAAA,EAAS,uBAAA;AAAyBa,QAAAA,IAAAA,EAAMd,eAAec;AAAK,KAAA,EAC9D,yBACA,uBAAA,EACA;QAAErB,IAAAA,EAAM,qBAAA;QAAuBQ,OAAAA,EAAS;AAAwB,KAAA,CAAA;;;;IAKlE,IAAID,cAAAA,CAAee,SAAS,IAAI,IAAA,EAAM;QACpCC,MAAAA,CAAOC,cAAc,CAACJ,SAAAA,EAAW,WAAA,EAAa;AAC5CK,YAAAA,KAAAA,EAAOlB,eAAee,SAAS;YAC/BI,UAAAA,EAAY,IAAA;YACZC,QAAAA,EAAU,IAAA;YACVC,YAAAA,EAAc;AAChB,SAAA,CAAA;AACF,IAAA;IACA,OAAOR,SAAAA;AACT;;;;"}
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../server/src/index.ts"],"sourcesContent":["import { config } from './config';\nimport { bootstrap } from './bootstrap';\nimport { services } from './services';\n\nexport default {\n config,\n bootstrap,\n services,\n};\n"],"names":["config","bootstrap","services"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../server/src/index.ts"],"sourcesContent":["import { config } from './config';\nimport { bootstrap } from './bootstrap';\nimport { services } from './services';\n\nexport type * from './types';\n\nexport default {\n config,\n bootstrap,\n services,\n};\n"],"names":["config","bootstrap","services"],"mappings":";;;;;;AAMA,YAAe;AACbA,YAAAA,cAAAA;AACAC,eAAAA,mBAAAA;AACAC,cAAAA;AACF,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../server/src/index.ts"],"sourcesContent":["import { config } from './config';\nimport { bootstrap } from './bootstrap';\nimport { services } from './services';\n\nexport default {\n config,\n bootstrap,\n services,\n};\n"],"names":["config","bootstrap","services"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../server/src/index.ts"],"sourcesContent":["import { config } from './config';\nimport { bootstrap } from './bootstrap';\nimport { services } from './services';\n\nexport type * from './types';\n\nexport default {\n config,\n bootstrap,\n services,\n};\n"],"names":["config","bootstrap","services"],"mappings":";;;;AAMA,YAAe;AACbA,IAAAA,MAAAA;AACAC,IAAAA,SAAAA;AACAC,IAAAA;AACF,CAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var graphql = require('graphql');
|
|
4
|
-
var
|
|
4
|
+
var lodash = require('lodash');
|
|
5
5
|
var nexus = require('nexus');
|
|
6
6
|
var utils = require('@strapi/utils');
|
|
7
7
|
|
|
@@ -38,9 +38,9 @@ var dynamicZone = (({ strapi })=>{
|
|
|
38
38
|
}
|
|
39
39
|
return {
|
|
40
40
|
__component: component.uid,
|
|
41
|
-
...
|
|
41
|
+
...lodash.omit(value, [
|
|
42
42
|
'__typename'
|
|
43
|
-
]
|
|
43
|
+
])
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
return nexus.scalarType({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-zones.js","sources":["../../../../server/src/services/builders/dynamic-zones.ts"],"sourcesContent":["import { Kind, valueFromASTUntyped } from 'graphql';\nimport { omit } from 'lodash
|
|
1
|
+
{"version":3,"file":"dynamic-zones.js","sources":["../../../../server/src/services/builders/dynamic-zones.ts"],"sourcesContent":["import { Kind, valueFromASTUntyped } from 'graphql';\nimport { omit } from 'lodash';\nimport { unionType, scalarType } from 'nexus';\nimport { errors } from '@strapi/utils';\nimport type { Internal, Schema } from '@strapi/types';\n\nimport type { Context } from '../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n const buildTypeDefinition = (name: string, components: Internal.UID.Component[]) => {\n const { ERROR_TYPE_NAME } = strapi.plugin('graphql').service('constants');\n const isEmpty = components.length === 0;\n\n const componentsTypeNames = components.map((componentUID) => {\n const component = strapi.components[componentUID];\n\n if (!component) {\n throw new ApplicationError(\n `Trying to create a dynamic zone type with an unknown component: \"${componentUID}\"`\n );\n }\n\n return component.globalId;\n });\n\n return unionType({\n name,\n\n resolveType(obj) {\n if (isEmpty) {\n return ERROR_TYPE_NAME;\n }\n\n return strapi.components[obj.__component].globalId;\n },\n\n definition(t) {\n t.members(...componentsTypeNames, ERROR_TYPE_NAME);\n },\n });\n };\n\n const buildInputDefinition = (name: string, components: Internal.UID.Component[]) => {\n const parseData = (value: any) => {\n const component = Object.values(strapi.components).find(\n (component) => component.globalId === value.__typename\n );\n\n if (!component) {\n throw new ApplicationError(\n `Component not found. expected one of: ${components\n .map((uid) => strapi.components[uid].globalId)\n .join(', ')}`\n );\n }\n\n return {\n __component: component.uid,\n ...omit(value, ['__typename']),\n };\n };\n\n return scalarType({\n name,\n\n serialize: (value) => value,\n\n parseValue: (value) => parseData(value),\n\n parseLiteral(ast, variables) {\n if (ast.kind !== Kind.OBJECT) {\n return undefined;\n }\n\n const value = valueFromASTUntyped(ast, variables);\n return parseData(value);\n },\n });\n };\n\n return {\n /**\n * Build a Nexus dynamic zone type from a Strapi dz attribute\n */\n buildDynamicZoneDefinition(\n definition: Schema.Attribute.DynamicZone,\n name: string,\n inputName: string\n ) {\n const { components } = definition;\n\n const typeDefinition = buildTypeDefinition(name, components);\n const inputDefinition = buildInputDefinition(inputName, components);\n\n return [typeDefinition, inputDefinition];\n },\n };\n};\n"],"names":["ApplicationError","errors","strapi","buildTypeDefinition","name","components","ERROR_TYPE_NAME","plugin","service","isEmpty","length","componentsTypeNames","map","componentUID","component","globalId","unionType","resolveType","obj","__component","definition","t","members","buildInputDefinition","parseData","value","Object","values","find","__typename","uid","join","omit","scalarType","serialize","parseValue","parseLiteral","ast","variables","kind","Kind","OBJECT","undefined","valueFromASTUntyped","buildDynamicZoneDefinition","inputName","typeDefinition","inputDefinition"],"mappings":";;;;;;;AAQA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;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,UAAAA,CAAAA;YACjD,MAAM0C,eAAAA,GAAkBxB,qBAAqBsB,SAAAA,EAAWxC,UAAAA,CAAAA;YAExD,OAAO;AAACyC,gBAAAA,cAAAA;AAAgBC,gBAAAA;AAAgB,aAAA;AAC1C,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Kind, valueFromASTUntyped } from 'graphql';
|
|
2
|
-
import { omit } from 'lodash
|
|
2
|
+
import { omit } from 'lodash';
|
|
3
3
|
import { unionType, scalarType } from 'nexus';
|
|
4
4
|
import { errors } from '@strapi/utils';
|
|
5
5
|
|
|
@@ -36,9 +36,9 @@ var dynamicZone = (({ strapi })=>{
|
|
|
36
36
|
}
|
|
37
37
|
return {
|
|
38
38
|
__component: component.uid,
|
|
39
|
-
...omit([
|
|
39
|
+
...omit(value, [
|
|
40
40
|
'__typename'
|
|
41
|
-
]
|
|
41
|
+
])
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
return scalarType({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-zones.mjs","sources":["../../../../server/src/services/builders/dynamic-zones.ts"],"sourcesContent":["import { Kind, valueFromASTUntyped } from 'graphql';\nimport { omit } from 'lodash
|
|
1
|
+
{"version":3,"file":"dynamic-zones.mjs","sources":["../../../../server/src/services/builders/dynamic-zones.ts"],"sourcesContent":["import { Kind, valueFromASTUntyped } from 'graphql';\nimport { omit } from 'lodash';\nimport { unionType, scalarType } from 'nexus';\nimport { errors } from '@strapi/utils';\nimport type { Internal, Schema } from '@strapi/types';\n\nimport type { Context } from '../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n const buildTypeDefinition = (name: string, components: Internal.UID.Component[]) => {\n const { ERROR_TYPE_NAME } = strapi.plugin('graphql').service('constants');\n const isEmpty = components.length === 0;\n\n const componentsTypeNames = components.map((componentUID) => {\n const component = strapi.components[componentUID];\n\n if (!component) {\n throw new ApplicationError(\n `Trying to create a dynamic zone type with an unknown component: \"${componentUID}\"`\n );\n }\n\n return component.globalId;\n });\n\n return unionType({\n name,\n\n resolveType(obj) {\n if (isEmpty) {\n return ERROR_TYPE_NAME;\n }\n\n return strapi.components[obj.__component].globalId;\n },\n\n definition(t) {\n t.members(...componentsTypeNames, ERROR_TYPE_NAME);\n },\n });\n };\n\n const buildInputDefinition = (name: string, components: Internal.UID.Component[]) => {\n const parseData = (value: any) => {\n const component = Object.values(strapi.components).find(\n (component) => component.globalId === value.__typename\n );\n\n if (!component) {\n throw new ApplicationError(\n `Component not found. expected one of: ${components\n .map((uid) => strapi.components[uid].globalId)\n .join(', ')}`\n );\n }\n\n return {\n __component: component.uid,\n ...omit(value, ['__typename']),\n };\n };\n\n return scalarType({\n name,\n\n serialize: (value) => value,\n\n parseValue: (value) => parseData(value),\n\n parseLiteral(ast, variables) {\n if (ast.kind !== Kind.OBJECT) {\n return undefined;\n }\n\n const value = valueFromASTUntyped(ast, variables);\n return parseData(value);\n },\n });\n };\n\n return {\n /**\n * Build a Nexus dynamic zone type from a Strapi dz attribute\n */\n buildDynamicZoneDefinition(\n definition: Schema.Attribute.DynamicZone,\n name: string,\n inputName: string\n ) {\n const { components } = definition;\n\n const typeDefinition = buildTypeDefinition(name, components);\n const inputDefinition = buildInputDefinition(inputName, components);\n\n return [typeDefinition, inputDefinition];\n },\n };\n};\n"],"names":["ApplicationError","errors","strapi","buildTypeDefinition","name","components","ERROR_TYPE_NAME","plugin","service","isEmpty","length","componentsTypeNames","map","componentUID","component","globalId","unionType","resolveType","obj","__component","definition","t","members","buildInputDefinition","parseData","value","Object","values","find","__typename","uid","join","omit","scalarType","serialize","parseValue","parseLiteral","ast","variables","kind","Kind","OBJECT","undefined","valueFromASTUntyped","buildDynamicZoneDefinition","inputName","typeDefinition","inputDefinition"],"mappings":";;;;;AAQA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,MAAAA;AAE7B,kBAAe,CAAA,CAAC,EAAEC,M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,GAAkBxB,qBAAqBsB,SAAAA,EAAWxC,UAAAA,CAAAA;YAExD,OAAO;AAACyC,gBAAAA,cAAAA;AAAgBC,gBAAAA;AAAgB,aAAA;AAC1C,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var nexus = require('nexus');
|
|
4
|
-
var
|
|
4
|
+
var lodash = require('lodash');
|
|
5
5
|
|
|
6
6
|
var entity = (({ strapi })=>{
|
|
7
7
|
const { naming } = strapi.plugin('graphql').service('utils');
|
|
@@ -19,13 +19,13 @@ var entity = (({ strapi })=>{
|
|
|
19
19
|
definition (t) {
|
|
20
20
|
// Keep the ID attribute at the top level
|
|
21
21
|
t.id('id', {
|
|
22
|
-
resolve:
|
|
22
|
+
resolve: (parent)=>parent?.id
|
|
23
23
|
});
|
|
24
|
-
if (!
|
|
24
|
+
if (!lodash.isEmpty(attributes)) {
|
|
25
25
|
// Keep the fetched object into a dedicated `attributes` field
|
|
26
26
|
t.field('attributes', {
|
|
27
27
|
type: typeName,
|
|
28
|
-
resolve:
|
|
28
|
+
resolve: lodash.identity
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","sources":["../../../../server/src/services/builders/entity.ts"],"sourcesContent":["import { objectType } from 'nexus';\nimport {
|
|
1
|
+
{"version":3,"file":"entity.js","sources":["../../../../server/src/services/builders/entity.ts"],"sourcesContent":["import { objectType } from 'nexus';\nimport { isEmpty, identity } from 'lodash';\nimport type { Schema } from '@strapi/types';\n\nimport type { Context } from '../types';\n\nexport default ({ strapi }: Context) => {\n const { naming } = strapi.plugin('graphql').service('utils');\n\n return {\n /**\n * Build a higher level type for a content type which contains the attributes, the ID and the metadata\n * @param {object} contentType The content type which will be used to build its entity type\n * @return {NexusObjectTypeDef}\n */\n buildEntityDefinition(contentType: Schema.ContentType) {\n const { attributes } = contentType;\n\n const name = naming.getEntityName(contentType);\n const typeName = naming.getTypeName(contentType);\n\n return objectType({\n name,\n\n definition(t) {\n // Keep the ID attribute at the top level\n t.id('id', { resolve: (parent) => parent?.id });\n\n if (!isEmpty(attributes)) {\n // Keep the fetched object into a dedicated `attributes` field\n t.field('attributes', {\n type: typeName,\n resolve: identity,\n });\n }\n },\n });\n },\n };\n};\n"],"names":["strapi","naming","plugin","service","buildEntityDefinition","contentType","attributes","name","getEntityName","typeName","getTypeName","objectType","definition","t","id","resolve","parent","isEmpty","field","type","identity"],"mappings":";;;;;AAMA,aAAe,CAAA,CAAC,EAAEA,MAAM,EAAW,GAAA;IACjC,MAAM,EAAEC,MAAM,EAAE,GAAGD,OAAOE,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,OAAA,CAAA;IAEpD,OAAO;AACL;;;;AAIC,QACDC,uBAAsBC,WAA+B,EAAA;YACnD,MAAM,EAAEC,UAAU,EAAE,GAAGD,WAAAA;YAEvB,MAAME,IAAAA,GAAON,MAAAA,CAAOO,aAAa,CAACH,WAAAA,CAAAA;YAClC,MAAMI,QAAAA,GAAWR,MAAAA,CAAOS,WAAW,CAACL,WAAAA,CAAAA;AAEpC,YAAA,OAAOM,gBAAAA,CAAW;AAChBJ,gBAAAA,IAAAA;AAEAK,gBAAAA,UAAAA,CAAAA,CAAWC,CAAC,EAAA;;oBAEVA,CAAAA,CAAEC,EAAE,CAAC,IAAA,EAAM;wBAAEC,OAAAA,EAAS,CAACC,SAAWA,MAAAA,EAAQF;AAAG,qBAAA,CAAA;oBAE7C,IAAI,CAACG,eAAQX,UAAAA,CAAAA,EAAa;;wBAExBO,CAAAA,CAAEK,KAAK,CAAC,YAAA,EAAc;4BACpBC,IAAAA,EAAMV,QAAAA;4BACNM,OAAAA,EAASK;AACX,yBAAA,CAAA;AACF,oBAAA;AACF,gBAAA;AACF,aAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { objectType } from 'nexus';
|
|
2
|
-
import {
|
|
2
|
+
import { isEmpty, identity } from 'lodash';
|
|
3
3
|
|
|
4
4
|
var entity = (({ strapi })=>{
|
|
5
5
|
const { naming } = strapi.plugin('graphql').service('utils');
|
|
@@ -17,7 +17,7 @@ var entity = (({ strapi })=>{
|
|
|
17
17
|
definition (t) {
|
|
18
18
|
// Keep the ID attribute at the top level
|
|
19
19
|
t.id('id', {
|
|
20
|
-
resolve:
|
|
20
|
+
resolve: (parent)=>parent?.id
|
|
21
21
|
});
|
|
22
22
|
if (!isEmpty(attributes)) {
|
|
23
23
|
// Keep the fetched object into a dedicated `attributes` field
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.mjs","sources":["../../../../server/src/services/builders/entity.ts"],"sourcesContent":["import { objectType } from 'nexus';\nimport {
|
|
1
|
+
{"version":3,"file":"entity.mjs","sources":["../../../../server/src/services/builders/entity.ts"],"sourcesContent":["import { objectType } from 'nexus';\nimport { isEmpty, identity } from 'lodash';\nimport type { Schema } from '@strapi/types';\n\nimport type { Context } from '../types';\n\nexport default ({ strapi }: Context) => {\n const { naming } = strapi.plugin('graphql').service('utils');\n\n return {\n /**\n * Build a higher level type for a content type which contains the attributes, the ID and the metadata\n * @param {object} contentType The content type which will be used to build its entity type\n * @return {NexusObjectTypeDef}\n */\n buildEntityDefinition(contentType: Schema.ContentType) {\n const { attributes } = contentType;\n\n const name = naming.getEntityName(contentType);\n const typeName = naming.getTypeName(contentType);\n\n return objectType({\n name,\n\n definition(t) {\n // Keep the ID attribute at the top level\n t.id('id', { resolve: (parent) => parent?.id });\n\n if (!isEmpty(attributes)) {\n // Keep the fetched object into a dedicated `attributes` field\n t.field('attributes', {\n type: typeName,\n resolve: identity,\n });\n }\n },\n });\n },\n };\n};\n"],"names":["strapi","naming","plugin","service","buildEntityDefinition","contentType","attributes","name","getEntityName","typeName","getTypeName","objectType","definition","t","id","resolve","parent","isEmpty","field","type","identity"],"mappings":";;;AAMA,aAAe,CAAA,CAAC,EAAEA,MAAM,EAAW,GAAA;IACjC,MAAM,EAAEC,MAAM,EAAE,GAAGD,OAAOE,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,OAAA,CAAA;IAEpD,OAAO;AACL;;;;AAIC,QACDC,uBAAsBC,WAA+B,EAAA;YACnD,MAAM,EAAEC,UAAU,EAAE,GAAGD,WAAAA;YAEvB,MAAME,IAAAA,GAAON,MAAAA,CAAOO,aAAa,CAACH,WAAAA,CAAAA;YAClC,MAAMI,QAAAA,GAAWR,MAAAA,CAAOS,WAAW,CAACL,WAAAA,CAAAA;AAEpC,YAAA,OAAOM,UAAAA,CAAW;AAChBJ,gBAAAA,IAAAA;AAEAK,gBAAAA,UAAAA,CAAAA,CAAWC,CAAC,EAAA;;oBAEVA,CAAAA,CAAEC,EAAE,CAAC,IAAA,EAAM;wBAAEC,OAAAA,EAAS,CAACC,SAAWA,MAAAA,EAAQF;AAAG,qBAAA,CAAA;oBAE7C,IAAI,CAACG,QAAQX,UAAAA,CAAAA,EAAa;;wBAExBO,CAAAA,CAAEK,KAAK,CAAC,YAAA,EAAc;4BACpBC,IAAAA,EAAMV,QAAAA;4BACNM,OAAAA,EAASK;AACX,yBAAA,CAAA;AACF,oBAAA;AACF,gBAAA;AACF,aAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var nexus = require('nexus');
|
|
4
|
-
var
|
|
4
|
+
var lodash = require('lodash');
|
|
5
5
|
var utils = require('@strapi/utils');
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -13,7 +13,7 @@ var utils = require('@strapi/utils');
|
|
|
13
13
|
*/ const buildEnumTypeDefinition = (definition, name)=>{
|
|
14
14
|
return nexus.enumType({
|
|
15
15
|
name,
|
|
16
|
-
members: definition.enum.reduce((acc, value)=>
|
|
16
|
+
members: definition.enum.reduce((acc, value)=>lodash.set(acc, utils.strings.toRegressedEnumValue(value), value), {})
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
var enums = (()=>({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sources":["../../../../server/src/services/builders/enums.ts"],"sourcesContent":["import { enumType } from 'nexus';\nimport { set } from 'lodash
|
|
1
|
+
{"version":3,"file":"enums.js","sources":["../../../../server/src/services/builders/enums.ts"],"sourcesContent":["import { enumType } from 'nexus';\nimport { set } from 'lodash';\nimport { strings } from '@strapi/utils';\n\ninterface Definition {\n enum: string[];\n}\n\n/**\n * Build a Nexus enum type from a Strapi enum attribute\n * @param {object} definition - The definition of the enum\n * @param {string[]} definition.enum - The params of the enum\n * @param {string} name - The name of the enum\n * @return {NexusEnumTypeDef}\n */\nconst buildEnumTypeDefinition = (definition: Definition, name: string) => {\n return enumType({\n name,\n members: definition.enum.reduce(\n (acc, value) => set(acc, strings.toRegressedEnumValue(value), value),\n {}\n ),\n });\n};\n\nexport default () => ({\n buildEnumTypeDefinition,\n});\n"],"names":["buildEnumTypeDefinition","definition","name","enumType","members","enum","reduce","acc","value","set","strings","toRegressedEnumValue"],"mappings":";;;;;;AAQA;;;;;;IAOA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,EAAwBC,IAAAA,GAAAA;AACvD,IAAA,OAAOC,cAAAA,CAAS;AACdD,QAAAA,IAAAA;AACAE,QAAAA,OAAAA,EAASH,UAAAA,CAAWI,IAAI,CAACC,MAAM,CAC7B,CAACC,GAAAA,EAAKC,KAAAA,GAAUC,UAAAA,CAAIF,KAAKG,aAAAA,CAAQC,oBAAoB,CAACH,KAAAA,CAAAA,EAAQA,QAC9D,EAAC;AAEL,KAAA,CAAA;AACF,CAAA;AAEA,YAAe,CAAA,KAAO;AACpBR,QAAAA;AACF,KAAA,CAAC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { enumType } from 'nexus';
|
|
2
|
-
import { set } from 'lodash
|
|
2
|
+
import { set } from 'lodash';
|
|
3
3
|
import { strings } from '@strapi/utils';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -11,7 +11,7 @@ import { strings } from '@strapi/utils';
|
|
|
11
11
|
*/ const buildEnumTypeDefinition = (definition, name)=>{
|
|
12
12
|
return enumType({
|
|
13
13
|
name,
|
|
14
|
-
members: definition.enum.reduce((acc, value)=>set(strings.toRegressedEnumValue(value), value
|
|
14
|
+
members: definition.enum.reduce((acc, value)=>set(acc, strings.toRegressedEnumValue(value), value), {})
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
var enums = (()=>({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.mjs","sources":["../../../../server/src/services/builders/enums.ts"],"sourcesContent":["import { enumType } from 'nexus';\nimport { set } from 'lodash
|
|
1
|
+
{"version":3,"file":"enums.mjs","sources":["../../../../server/src/services/builders/enums.ts"],"sourcesContent":["import { enumType } from 'nexus';\nimport { set } from 'lodash';\nimport { strings } from '@strapi/utils';\n\ninterface Definition {\n enum: string[];\n}\n\n/**\n * Build a Nexus enum type from a Strapi enum attribute\n * @param {object} definition - The definition of the enum\n * @param {string[]} definition.enum - The params of the enum\n * @param {string} name - The name of the enum\n * @return {NexusEnumTypeDef}\n */\nconst buildEnumTypeDefinition = (definition: Definition, name: string) => {\n return enumType({\n name,\n members: definition.enum.reduce(\n (acc, value) => set(acc, strings.toRegressedEnumValue(value), value),\n {}\n ),\n });\n};\n\nexport default () => ({\n buildEnumTypeDefinition,\n});\n"],"names":["buildEnumTypeDefinition","definition","name","enumType","members","enum","reduce","acc","value","set","strings","toRegressedEnumValue"],"mappings":";;;;AAQA;;;;;;IAOA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,EAAwBC,IAAAA,GAAAA;AACvD,IAAA,OAAOC,QAAAA,CAAS;AACdD,QAAAA,IAAAA;AACAE,QAAAA,OAAAA,EAASH,UAAAA,CAAWI,IAAI,CAACC,MAAM,CAC7B,CAACC,GAAAA,EAAKC,KAAAA,GAAUC,GAAAA,CAAIF,KAAKG,OAAAA,CAAQC,oBAAoB,CAACH,KAAAA,CAAAA,EAAQA,QAC9D,EAAC;AAEL,KAAA,CAAA;AACF,CAAA;AAEA,YAAe,CAAA,KAAO;AACpBR,QAAAA;AACF,KAAA,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-type.js","sources":["../../../../../server/src/services/builders/filters/content-type.ts"],"sourcesContent":["import { inputObjectType } from 'nexus';\nimport { contentTypes } from '@strapi/utils';\nimport type * as Nexus from 'nexus';\nimport type { Struct, Schema } from '@strapi/types';\nimport type { Context } from '../../types';\n\nexport default ({ strapi }: Context) => {\n const rootLevelOperators = () => {\n const { operators } = strapi.plugin('graphql').service('builders').filters;\n\n return [operators.and, operators.or, operators.not];\n };\n\n const addScalarAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.AnyAttribute\n ) => {\n const { naming, mappers } = strapi.plugin('graphql').service('utils');\n\n const gqlType = mappers.strapiScalarToGraphQLScalar(attribute.type);\n\n builder.field(attributeName, { type: naming.getScalarFilterInputTypeName(gqlType) });\n };\n\n const addRelationalAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.Relation\n ) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n const { getFiltersInputTypeName } = utils.naming;\n const { isMorphRelation } = utils.attributes;\n\n const model = 'target' in attribute && strapi.getModel(attribute.target);\n\n // If there is no model corresponding to the attribute configuration\n // or if the attribute is a polymorphic relation, then ignore it\n if (!model || isMorphRelation(attribute)) return;\n\n // If the target model is disabled, then ignore it too\n if (extension.shadowCRUD(model.uid).isDisabled()) return;\n\n builder.field(attributeName, { type: getFiltersInputTypeName(model) });\n };\n\n const addComponentAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.Component\n ) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n const { getFiltersInputTypeName } = utils.naming;\n\n const component = strapi.getModel(attribute.component);\n\n // If there is no component corresponding to the attribute configuration, then ignore it\n if (!component) return;\n\n // If the component is disabled, then ignore it too\n if (extension.shadowCRUD(component.uid).isDisabled()) return;\n\n builder.field(attributeName, { type: getFiltersInputTypeName(component) });\n };\n\n const buildContentTypeFilters = (contentType: Struct.ContentTypeSchema) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n\n const { getFiltersInputTypeName, getScalarFilterInputTypeName } = utils.naming;\n const { isStrapiScalar, isRelation, isComponent } = utils.attributes;\n\n const { attributes } = contentType;\n\n const filtersTypeName = getFiltersInputTypeName(contentType);\n\n return inputObjectType({\n name: filtersTypeName,\n\n definition(t) {\n const validAttributes = Object.entries(attributes)\n // Remove private attributes\n .filter(([attributeName]) => !contentTypes.isPrivateAttribute(contentType, attributeName))\n // Remove attributes that have been disabled using the shadow CRUD extension API\n .filter(([attributeName]) =>\n extension.shadowCRUD(contentType.uid).field(attributeName).hasFiltersEnabeld()\n );\n\n const isIDFilterEnabled = extension\n .shadowCRUD(contentType.uid)\n .field('documentId')\n .hasFiltersEnabeld();\n\n // Add an ID filter to the collection types\n if (contentType.kind === 'collectionType' && isIDFilterEnabled) {\n t.field('documentId', { type: getScalarFilterInputTypeName('ID') });\n }\n\n // Add every defined attribute\n for (const [attributeName, attribute] of validAttributes) {\n // Handle scalars\n if (isStrapiScalar(attribute)) {\n addScalarAttribute(t, attributeName, attribute);\n }\n\n // Handle relations\n else if (isRelation(attribute)) {\n addRelationalAttribute(t, attributeName, attribute as Schema.Attribute.Relation);\n }\n\n // Handle components\n else if (isComponent(attribute)) {\n addComponentAttribute(t, attributeName, attribute as Schema.Attribute.Component);\n }\n }\n\n // Conditional clauses\n for (const operator of rootLevelOperators()) {\n operator.add(t
|
|
1
|
+
{"version":3,"file":"content-type.js","sources":["../../../../../server/src/services/builders/filters/content-type.ts"],"sourcesContent":["import { inputObjectType } from 'nexus';\nimport { contentTypes } from '@strapi/utils';\nimport type * as Nexus from 'nexus';\nimport type { Struct, Schema } from '@strapi/types';\nimport type { Context } from '../../types';\n\nexport default ({ strapi }: Context) => {\n const rootLevelOperators = () => {\n const { operators } = strapi.plugin('graphql').service('builders').filters;\n\n return [operators.and, operators.or, operators.not];\n };\n\n const addScalarAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.AnyAttribute\n ) => {\n const { naming, mappers } = strapi.plugin('graphql').service('utils');\n\n const gqlType = mappers.strapiScalarToGraphQLScalar(attribute.type);\n\n builder.field(attributeName, { type: naming.getScalarFilterInputTypeName(gqlType) });\n };\n\n const addRelationalAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.Relation\n ) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n const { getFiltersInputTypeName } = utils.naming;\n const { isMorphRelation } = utils.attributes;\n\n const model = 'target' in attribute && strapi.getModel(attribute.target);\n\n // If there is no model corresponding to the attribute configuration\n // or if the attribute is a polymorphic relation, then ignore it\n if (!model || isMorphRelation(attribute)) return;\n\n // If the target model is disabled, then ignore it too\n if (extension.shadowCRUD(model.uid).isDisabled()) return;\n\n builder.field(attributeName, { type: getFiltersInputTypeName(model) });\n };\n\n const addComponentAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.Component\n ) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n const { getFiltersInputTypeName } = utils.naming;\n\n const component = strapi.getModel(attribute.component);\n\n // If there is no component corresponding to the attribute configuration, then ignore it\n if (!component) return;\n\n // If the component is disabled, then ignore it too\n if (extension.shadowCRUD(component.uid).isDisabled()) return;\n\n builder.field(attributeName, { type: getFiltersInputTypeName(component) });\n };\n\n const buildContentTypeFilters = (contentType: Struct.ContentTypeSchema) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n\n const { getFiltersInputTypeName, getScalarFilterInputTypeName } = utils.naming;\n const { isStrapiScalar, isRelation, isComponent } = utils.attributes;\n\n const { attributes } = contentType;\n\n const filtersTypeName = getFiltersInputTypeName(contentType);\n\n return inputObjectType({\n name: filtersTypeName,\n\n definition(t) {\n const validAttributes = Object.entries(attributes)\n // Remove private attributes\n .filter(([attributeName]) => !contentTypes.isPrivateAttribute(contentType, attributeName))\n // Remove attributes that have been disabled using the shadow CRUD extension API\n .filter(([attributeName]) =>\n extension.shadowCRUD(contentType.uid).field(attributeName).hasFiltersEnabeld()\n );\n\n const isIDFilterEnabled = extension\n .shadowCRUD(contentType.uid)\n .field('documentId')\n .hasFiltersEnabeld();\n\n // Add an ID filter to the collection types\n if (contentType.kind === 'collectionType' && isIDFilterEnabled) {\n t.field('documentId', { type: getScalarFilterInputTypeName('ID') });\n }\n\n // Add every defined attribute\n for (const [attributeName, attribute] of validAttributes) {\n // Handle scalars\n if (isStrapiScalar(attribute)) {\n addScalarAttribute(t, attributeName, attribute);\n }\n\n // Handle relations\n else if (isRelation(attribute)) {\n addRelationalAttribute(t, attributeName, attribute as Schema.Attribute.Relation);\n }\n\n // Handle components\n else if (isComponent(attribute)) {\n addComponentAttribute(t, attributeName, attribute as Schema.Attribute.Component);\n }\n }\n\n // Conditional clauses\n for (const operator of rootLevelOperators()) {\n // Operators keep develop's published `ObjectDefinitionBlock` parameter; they only add fields.\n operator.add(t as unknown as Nexus.blocks.ObjectDefinitionBlock<string>, filtersTypeName);\n }\n },\n });\n };\n\n return {\n buildContentTypeFilters,\n };\n};\n"],"names":["strapi","rootLevelOperators","operators","plugin","service","filters","and","or","not","addScalarAttribute","builder","attributeName","attribute","naming","mappers","gqlType","strapiScalarToGraphQLScalar","type","field","getScalarFilterInputTypeName","addRelationalAttribute","utils","extension","getFiltersInputTypeName","isMorphRelation","attributes","model","getModel","target","shadowCRUD","uid","isDisabled","addComponentAttribute","component","buildContentTypeFilters","contentType","isStrapiScalar","isRelation","isComponent","filtersTypeName","inputObjectType","name","definition","t","validAttributes","Object","entries","filter","contentTypes","isPrivateAttribute","hasFiltersEnabeld","isIDFilterEnabled","kind","operator","add"],"mappings":";;;;;AAMA,kBAAe,CAAA,CAAC,EAAEA,MAAM,EAAW,GAAA;AACjC,IAAA,MAAMC,kBAAAA,GAAqB,IAAA;QACzB,MAAM,EAAEC,SAAS,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,UAAA,CAAA,CAAYC,OAAO;QAE1E,OAAO;AAACH,YAAAA,SAAAA,CAAUI,GAAG;AAAEJ,YAAAA,SAAAA,CAAUK,EAAE;AAAEL,YAAAA,SAAAA,CAAUM;AAAI,SAAA;AACrD,IAAA,CAAA;IAEA,MAAMC,kBAAAA,GAAqB,CACzBC,OAAAA,EACAC,aAAAA,EACAC,SAAAA,GAAAA;QAEA,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGd,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,OAAA,CAAA;AAE7D,QAAA,MAAMW,OAAAA,GAAUD,OAAAA,CAAQE,2BAA2B,CAACJ,UAAUK,IAAI,CAAA;QAElEP,OAAAA,CAAQQ,KAAK,CAACP,aAAAA,EAAe;YAAEM,IAAAA,EAAMJ,MAAAA,CAAOM,4BAA4B,CAACJ,OAAAA;AAAS,SAAA,CAAA;AACpF,IAAA,CAAA;IAEA,MAAMK,sBAAAA,GAAyB,CAC7BV,OAAAA,EACAC,aAAAA,EACAC,SAAAA,GAAAA;AAEA,QAAA,MAAMS,QAAQrB,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,C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pB,gBAAA,IAAIf,WAAAA,CAAYiB,IAAI,KAAK,gBAAA,IAAoBD,iBAAAA,EAAmB;oBAC9DR,CAAAA,CAAEzB,KAAK,CAAC,YAAA,EAAc;AAAED,wBAAAA,IAAAA,EAAME,4BAAAA,CAA6B,IAAA;AAAM,qBAAA,CAAA;AACnE,gBAAA;;AAGA,gBAAA,KAAK,MAAM,CAACR,aAAAA,EAAeC,SAAAA,CAAU,IAAIgC,eAAAA,CAAiB;;AAExD,oBAAA,IAAIR,eAAexB,SAAAA,CAAAA,EAAY;AAC7BH,wBAAAA,kBAAAA,CAAmBkC,GAAGhC,aAAAA,EAAeC,SAAAA,CAAAA;oBACvC,CAAA,MAGK,IAAIyB,WAAWzB,SAAAA,CAAAA,EAAY;AAC9BQ,wBAAAA,sBAAAA,CAAuBuB,GAAGhC,aAAAA,EAAeC,SAAAA,CAAAA;oBAC3C,CAAA,MAGK,IAAI0B,YAAY1B,SAAAA,CAAAA,EAAY;AAC/BoB,wBAAAA,qBAAAA,CAAsBW,GAAGhC,aAAAA,EAAeC,SAAAA,CAAAA;AAC1C,oBAAA;AACF,gBAAA;;gBAGA,KAAK,MAAMyC,YAAYpD,kBAAAA,EAAAA,CAAsB;;oBAE3CoD,QAAAA,CAASC,GAAG,CAACX,CAAAA,EAA4DJ,eAAAA,CAAAA;AAC3E,gBAAA;AACF,YAAA;AACF,SAAA,CAAA;AACF,IAAA,CAAA;IAEA,OAAO;AACLL,QAAAA;AACF,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-type.mjs","sources":["../../../../../server/src/services/builders/filters/content-type.ts"],"sourcesContent":["import { inputObjectType } from 'nexus';\nimport { contentTypes } from '@strapi/utils';\nimport type * as Nexus from 'nexus';\nimport type { Struct, Schema } from '@strapi/types';\nimport type { Context } from '../../types';\n\nexport default ({ strapi }: Context) => {\n const rootLevelOperators = () => {\n const { operators } = strapi.plugin('graphql').service('builders').filters;\n\n return [operators.and, operators.or, operators.not];\n };\n\n const addScalarAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.AnyAttribute\n ) => {\n const { naming, mappers } = strapi.plugin('graphql').service('utils');\n\n const gqlType = mappers.strapiScalarToGraphQLScalar(attribute.type);\n\n builder.field(attributeName, { type: naming.getScalarFilterInputTypeName(gqlType) });\n };\n\n const addRelationalAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.Relation\n ) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n const { getFiltersInputTypeName } = utils.naming;\n const { isMorphRelation } = utils.attributes;\n\n const model = 'target' in attribute && strapi.getModel(attribute.target);\n\n // If there is no model corresponding to the attribute configuration\n // or if the attribute is a polymorphic relation, then ignore it\n if (!model || isMorphRelation(attribute)) return;\n\n // If the target model is disabled, then ignore it too\n if (extension.shadowCRUD(model.uid).isDisabled()) return;\n\n builder.field(attributeName, { type: getFiltersInputTypeName(model) });\n };\n\n const addComponentAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.Component\n ) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n const { getFiltersInputTypeName } = utils.naming;\n\n const component = strapi.getModel(attribute.component);\n\n // If there is no component corresponding to the attribute configuration, then ignore it\n if (!component) return;\n\n // If the component is disabled, then ignore it too\n if (extension.shadowCRUD(component.uid).isDisabled()) return;\n\n builder.field(attributeName, { type: getFiltersInputTypeName(component) });\n };\n\n const buildContentTypeFilters = (contentType: Struct.ContentTypeSchema) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n\n const { getFiltersInputTypeName, getScalarFilterInputTypeName } = utils.naming;\n const { isStrapiScalar, isRelation, isComponent } = utils.attributes;\n\n const { attributes } = contentType;\n\n const filtersTypeName = getFiltersInputTypeName(contentType);\n\n return inputObjectType({\n name: filtersTypeName,\n\n definition(t) {\n const validAttributes = Object.entries(attributes)\n // Remove private attributes\n .filter(([attributeName]) => !contentTypes.isPrivateAttribute(contentType, attributeName))\n // Remove attributes that have been disabled using the shadow CRUD extension API\n .filter(([attributeName]) =>\n extension.shadowCRUD(contentType.uid).field(attributeName).hasFiltersEnabeld()\n );\n\n const isIDFilterEnabled = extension\n .shadowCRUD(contentType.uid)\n .field('documentId')\n .hasFiltersEnabeld();\n\n // Add an ID filter to the collection types\n if (contentType.kind === 'collectionType' && isIDFilterEnabled) {\n t.field('documentId', { type: getScalarFilterInputTypeName('ID') });\n }\n\n // Add every defined attribute\n for (const [attributeName, attribute] of validAttributes) {\n // Handle scalars\n if (isStrapiScalar(attribute)) {\n addScalarAttribute(t, attributeName, attribute);\n }\n\n // Handle relations\n else if (isRelation(attribute)) {\n addRelationalAttribute(t, attributeName, attribute as Schema.Attribute.Relation);\n }\n\n // Handle components\n else if (isComponent(attribute)) {\n addComponentAttribute(t, attributeName, attribute as Schema.Attribute.Component);\n }\n }\n\n // Conditional clauses\n for (const operator of rootLevelOperators()) {\n operator.add(t
|
|
1
|
+
{"version":3,"file":"content-type.mjs","sources":["../../../../../server/src/services/builders/filters/content-type.ts"],"sourcesContent":["import { inputObjectType } from 'nexus';\nimport { contentTypes } from '@strapi/utils';\nimport type * as Nexus from 'nexus';\nimport type { Struct, Schema } from '@strapi/types';\nimport type { Context } from '../../types';\n\nexport default ({ strapi }: Context) => {\n const rootLevelOperators = () => {\n const { operators } = strapi.plugin('graphql').service('builders').filters;\n\n return [operators.and, operators.or, operators.not];\n };\n\n const addScalarAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.AnyAttribute\n ) => {\n const { naming, mappers } = strapi.plugin('graphql').service('utils');\n\n const gqlType = mappers.strapiScalarToGraphQLScalar(attribute.type);\n\n builder.field(attributeName, { type: naming.getScalarFilterInputTypeName(gqlType) });\n };\n\n const addRelationalAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.Relation\n ) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n const { getFiltersInputTypeName } = utils.naming;\n const { isMorphRelation } = utils.attributes;\n\n const model = 'target' in attribute && strapi.getModel(attribute.target);\n\n // If there is no model corresponding to the attribute configuration\n // or if the attribute is a polymorphic relation, then ignore it\n if (!model || isMorphRelation(attribute)) return;\n\n // If the target model is disabled, then ignore it too\n if (extension.shadowCRUD(model.uid).isDisabled()) return;\n\n builder.field(attributeName, { type: getFiltersInputTypeName(model) });\n };\n\n const addComponentAttribute = (\n builder: Nexus.blocks.InputDefinitionBlock<any>,\n attributeName: string,\n attribute: Schema.Attribute.Component\n ) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n const { getFiltersInputTypeName } = utils.naming;\n\n const component = strapi.getModel(attribute.component);\n\n // If there is no component corresponding to the attribute configuration, then ignore it\n if (!component) return;\n\n // If the component is disabled, then ignore it too\n if (extension.shadowCRUD(component.uid).isDisabled()) return;\n\n builder.field(attributeName, { type: getFiltersInputTypeName(component) });\n };\n\n const buildContentTypeFilters = (contentType: Struct.ContentTypeSchema) => {\n const utils = strapi.plugin('graphql').service('utils');\n const extension = strapi.plugin('graphql').service('extension');\n\n const { getFiltersInputTypeName, getScalarFilterInputTypeName } = utils.naming;\n const { isStrapiScalar, isRelation, isComponent } = utils.attributes;\n\n const { attributes } = contentType;\n\n const filtersTypeName = getFiltersInputTypeName(contentType);\n\n return inputObjectType({\n name: filtersTypeName,\n\n definition(t) {\n const validAttributes = Object.entries(attributes)\n // Remove private attributes\n .filter(([attributeName]) => !contentTypes.isPrivateAttribute(contentType, attributeName))\n // Remove attributes that have been disabled using the shadow CRUD extension API\n .filter(([attributeName]) =>\n extension.shadowCRUD(contentType.uid).field(attributeName).hasFiltersEnabeld()\n );\n\n const isIDFilterEnabled = extension\n .shadowCRUD(contentType.uid)\n .field('documentId')\n .hasFiltersEnabeld();\n\n // Add an ID filter to the collection types\n if (contentType.kind === 'collectionType' && isIDFilterEnabled) {\n t.field('documentId', { type: getScalarFilterInputTypeName('ID') });\n }\n\n // Add every defined attribute\n for (const [attributeName, attribute] of validAttributes) {\n // Handle scalars\n if (isStrapiScalar(attribute)) {\n addScalarAttribute(t, attributeName, attribute);\n }\n\n // Handle relations\n else if (isRelation(attribute)) {\n addRelationalAttribute(t, attributeName, attribute as Schema.Attribute.Relation);\n }\n\n // Handle components\n else if (isComponent(attribute)) {\n addComponentAttribute(t, attributeName, attribute as Schema.Attribute.Component);\n }\n }\n\n // Conditional clauses\n for (const operator of rootLevelOperators()) {\n // Operators keep develop's published `ObjectDefinitionBlock` parameter; they only add fields.\n operator.add(t as unknown as Nexus.blocks.ObjectDefinitionBlock<string>, filtersTypeName);\n }\n },\n });\n };\n\n return {\n buildContentTypeFilters,\n };\n};\n"],"names":["strapi","rootLevelOperators","operators","plugin","service","filters","and","or","not","addScalarAttribute","builder","attributeName","attribute","naming","mappers","gqlType","strapiScalarToGraphQLScalar","type","field","getScalarFilterInputTypeName","addRelationalAttribute","utils","extension","getFiltersInputTypeName","isMorphRelation","attributes","model","getModel","target","shadowCRUD","uid","isDisabled","addComponentAttribute","component","buildContentTypeFilters","contentType","isStrapiScalar","isRelation","isComponent","filtersTypeName","inputObjectType","name","definition","t","validAttributes","Object","entries","filter","contentTypes","isPrivateAttribute","hasFiltersEnabeld","isIDFilterEnabled","kind","operator","add"],"mappings":";;;AAMA,kBAAe,CAAA,CAAC,EAAEA,MAAM,EAAW,GAAA;AACjC,IAAA,MAAMC,kBAAAA,GAAqB,IAAA;QACzB,MAAM,EAAEC,SAAS,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,UAAA,CAAA,CAAYC,OAAO;QAE1E,OAAO;AAACH,YAAAA,SAA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AAAA;oBAC3C,CAAA,MAGK,IAAI0B,YAAY1B,SAAAA,CAAAA,EAAY;AAC/BoB,wBAAAA,qBAAAA,CAAsBW,GAAGhC,aAAAA,EAAeC,SAAAA,CAAAA;AAC1C,oBAAA;AACF,gBAAA;;gBAGA,KAAK,MAAMyC,YAAYpD,kBAAAA,EAAAA,CAAsB;;oBAE3CoD,QAAAA,CAASC,GAAG,CAACX,CAAAA,EAA4DJ,eAAAA,CAAAA;AAC3E,gBAAA;AACF,YAAA;AACF,SAAA,CAAA;AACF,IAAA,CAAA;IAEA,OAAO;AACLL,QAAAA;AACF,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eq.js","sources":["../../../../../../server/src/services/builders/filters/operators/eq.ts"],"sourcesContent":["import { errors } from '@strapi/utils';\nimport type * as Nexus from 'nexus';\nimport type { Core } from '@strapi/types';\n\nconst { ValidationError } = errors;\n\nconst EQ_FIELD_NAME = 'eq';\n\nexport default ({ strapi }: { strapi: Core.Strapi }) => ({\n fieldName: EQ_FIELD_NAME,\n\n strapiOperator: '$eq',\n\n add(t: Nexus.blocks.ObjectDefinitionBlock<string>, type: string) {\n const { GRAPHQL_SCALARS } = strapi.plugin('graphql').service('constants');\n\n if (!GRAPHQL_SCALARS.includes(type)) {\n throw new ValidationError(\n `Can't use \"${EQ_FIELD_NAME}\" operator. \"${type}\" is not a valid scalar`\n );\n }\n\n t.field(EQ_FIELD_NAME, { type });\n },\n});\n"],"names":["ValidationError","errors","EQ_FIELD_NAME","strapi","fieldName","strapiOperator","add","t","type","GRAPHQL_SCALARS","plugin","service","includes","field"],"mappings":";;;;AAIA,MAAM,EAAEA,eAAe,EAAE,GAAGC,YAAAA;AAE5B,MAAMC,aAAAA,GAAgB,IAAA;AAEtB,iBAAe,CAAA,CAAC,EAAEC,MAAM,EAA2B,IAAM;QACvDC,SAAAA,EAAWF,aAAAA;QAEXG,cAAAA,EAAgB,KAAA;QAEhBC,GAAAA,CAAAA,CAAIC,CAA6C,EAAEC,IAAY,EAAA;YAC7D,MAAM,EAAEC,eAAe,EAAE,GAAGN,OAAOO,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,WAAA,CAAA;AAE7D,YAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"eq.js","sources":["../../../../../../server/src/services/builders/filters/operators/eq.ts"],"sourcesContent":["import { errors } from '@strapi/utils';\nimport type * as Nexus from 'nexus';\nimport type { Core } from '@strapi/types';\n\nconst { ValidationError } = errors;\n\nconst EQ_FIELD_NAME = 'eq';\n\nexport default ({ strapi }: { strapi: Core.Strapi }) => ({\n fieldName: EQ_FIELD_NAME,\n\n strapiOperator: '$eq',\n\n add(t: Nexus.blocks.ObjectDefinitionBlock<string>, type: string) {\n const { GRAPHQL_SCALARS } = strapi.plugin('graphql').service('constants');\n\n if (!(GRAPHQL_SCALARS as readonly string[]).includes(type)) {\n throw new ValidationError(\n `Can't use \"${EQ_FIELD_NAME}\" operator. \"${type}\" is not a valid scalar`\n );\n }\n\n t.field(EQ_FIELD_NAME, { type });\n },\n});\n"],"names":["ValidationError","errors","EQ_FIELD_NAME","strapi","fieldName","strapiOperator","add","t","type","GRAPHQL_SCALARS","plugin","service","includes","field"],"mappings":";;;;AAIA,MAAM,EAAEA,eAAe,EAAE,GAAGC,YAAAA;AAE5B,MAAMC,aAAAA,GAAgB,IAAA;AAEtB,iBAAe,CAAA,CAAC,EAAEC,MAAM,EAA2B,IAAM;QACvDC,SAAAA,EAAWF,aAAAA;QAEXG,cAAAA,EAAgB,KAAA;QAEhBC,GAAAA,CAAAA,CAAIC,CAA6C,EAAEC,IAAY,EAAA;YAC7D,MAAM,EAAEC,eAAe,EAAE,GAAGN,OAAOO,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,WAAA,CAAA;AAE7D,YAAA,IAAI,CAAEF,eAAAA,CAAsCG,QAAQ,CAACJ,IAAAA,CAAAA,EAAO;gBAC1D,MAAM,IAAIR,eAAAA,CACR,CAAC,WAAW,EAAEE,cAAc,aAAa,EAAEM,IAAAA,CAAK,uBAAuB,CAAC,CAAA;AAE5E,YAAA;YAEAD,CAAAA,CAAEM,KAAK,CAACX,aAAAA,EAAe;AAAEM,gBAAAA;AAAK,aAAA,CAAA;AAChC,QAAA;AACF,KAAA,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eq.mjs","sources":["../../../../../../server/src/services/builders/filters/operators/eq.ts"],"sourcesContent":["import { errors } from '@strapi/utils';\nimport type * as Nexus from 'nexus';\nimport type { Core } from '@strapi/types';\n\nconst { ValidationError } = errors;\n\nconst EQ_FIELD_NAME = 'eq';\n\nexport default ({ strapi }: { strapi: Core.Strapi }) => ({\n fieldName: EQ_FIELD_NAME,\n\n strapiOperator: '$eq',\n\n add(t: Nexus.blocks.ObjectDefinitionBlock<string>, type: string) {\n const { GRAPHQL_SCALARS } = strapi.plugin('graphql').service('constants');\n\n if (!GRAPHQL_SCALARS.includes(type)) {\n throw new ValidationError(\n `Can't use \"${EQ_FIELD_NAME}\" operator. \"${type}\" is not a valid scalar`\n );\n }\n\n t.field(EQ_FIELD_NAME, { type });\n },\n});\n"],"names":["ValidationError","errors","EQ_FIELD_NAME","strapi","fieldName","strapiOperator","add","t","type","GRAPHQL_SCALARS","plugin","service","includes","field"],"mappings":";;AAIA,MAAM,EAAEA,eAAe,EAAE,GAAGC,MAAAA;AAE5B,MAAMC,aAAAA,GAAgB,IAAA;AAEtB,iBAAe,CAAA,CAAC,EAAEC,MAAM,EAA2B,IAAM;QACvDC,SAAAA,EAAWF,aAAAA;QAEXG,cAAAA,EAAgB,KAAA;QAEhBC,GAAAA,CAAAA,CAAIC,CAA6C,EAAEC,IAAY,EAAA;YAC7D,MAAM,EAAEC,eAAe,EAAE,GAAGN,OAAOO,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,WAAA,CAAA;AAE7D,YAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"eq.mjs","sources":["../../../../../../server/src/services/builders/filters/operators/eq.ts"],"sourcesContent":["import { errors } from '@strapi/utils';\nimport type * as Nexus from 'nexus';\nimport type { Core } from '@strapi/types';\n\nconst { ValidationError } = errors;\n\nconst EQ_FIELD_NAME = 'eq';\n\nexport default ({ strapi }: { strapi: Core.Strapi }) => ({\n fieldName: EQ_FIELD_NAME,\n\n strapiOperator: '$eq',\n\n add(t: Nexus.blocks.ObjectDefinitionBlock<string>, type: string) {\n const { GRAPHQL_SCALARS } = strapi.plugin('graphql').service('constants');\n\n if (!(GRAPHQL_SCALARS as readonly string[]).includes(type)) {\n throw new ValidationError(\n `Can't use \"${EQ_FIELD_NAME}\" operator. \"${type}\" is not a valid scalar`\n );\n }\n\n t.field(EQ_FIELD_NAME, { type });\n },\n});\n"],"names":["ValidationError","errors","EQ_FIELD_NAME","strapi","fieldName","strapiOperator","add","t","type","GRAPHQL_SCALARS","plugin","service","includes","field"],"mappings":";;AAIA,MAAM,EAAEA,eAAe,EAAE,GAAGC,MAAAA;AAE5B,MAAMC,aAAAA,GAAgB,IAAA;AAEtB,iBAAe,CAAA,CAAC,EAAEC,MAAM,EAA2B,IAAM;QACvDC,SAAAA,EAAWF,aAAAA;QAEXG,cAAAA,EAAgB,KAAA;QAEhBC,GAAAA,CAAAA,CAAIC,CAA6C,EAAEC,IAAY,EAAA;YAC7D,MAAM,EAAEC,eAAe,EAAE,GAAGN,OAAOO,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,WAAA,CAAA;AAE7D,YAAA,IAAI,CAAEF,eAAAA,CAAsCG,QAAQ,CAACJ,IAAAA,CAAAA,EAAO;gBAC1D,MAAM,IAAIR,eAAAA,CACR,CAAC,WAAW,EAAEE,cAAc,aAAa,EAAEM,IAAAA,CAAK,uBAAuB,CAAC,CAAA;AAE5E,YAAA;YAEAD,CAAAA,CAAEM,KAAK,CAACX,aAAAA,EAAe;AAAEM,gBAAAA;AAAK,aAAA,CAAA;AAChC,QAAA;AACF,KAAA,CAAC;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var lodash = require('lodash');
|
|
4
4
|
var and = require('./and.js');
|
|
5
5
|
var or = require('./or.js');
|
|
6
6
|
var not = require('./not.js');
|
|
@@ -49,9 +49,9 @@ const operators = {
|
|
|
49
49
|
between: between
|
|
50
50
|
};
|
|
51
51
|
// Instantiate every operator with the Strapi instance
|
|
52
|
-
var operators$1 = (({ strapi })=>
|
|
52
|
+
var operators$1 = (({ strapi })=>lodash.mapValues(operators, (opCtor)=>opCtor({
|
|
53
53
|
strapi
|
|
54
|
-
})
|
|
54
|
+
})));
|
|
55
55
|
|
|
56
56
|
module.exports = operators$1;
|
|
57
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../server/src/services/builders/filters/operators/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { mapValues } from 'lodash
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../server/src/services/builders/filters/operators/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { mapValues } from 'lodash';\nimport andOperator from './and';\nimport orOperator from './or';\nimport notOperator from './not';\nimport eqOperator from './eq';\nimport eqiOperator from './eqi';\nimport neOperator from './ne';\nimport neiOperator from './nei';\nimport startsWithOperator from './starts-with';\nimport endsWithOperator from './ends-with';\nimport containsOperator from './contains';\nimport notContainsOperator from './not-contains';\nimport containsiOperator from './containsi';\nimport notContainsiOperator from './not-containsi';\nimport gtOperator from './gt';\nimport gteOperator from './gte';\nimport ltOperator from './lt';\nimport lteOperator from './lte';\nimport nullOperator from './null';\nimport notNullOperator from './not-null';\nimport inOperator from './in';\nimport notInOperator from './not-in';\nimport betweenOperator from './between';\n\nconst operators = {\n and: andOperator,\n or: orOperator,\n not: notOperator,\n eq: eqOperator,\n eqi: eqiOperator,\n ne: neOperator,\n nei: neiOperator,\n startsWith: startsWithOperator,\n endsWith: endsWithOperator,\n contains: containsOperator,\n notContains: notContainsOperator,\n containsi: containsiOperator,\n notContainsi: notContainsiOperator,\n gt: gtOperator,\n gte: gteOperator,\n lt: ltOperator,\n lte: lteOperator,\n null: nullOperator,\n notNull: notNullOperator,\n in: inOperator,\n notIn: notInOperator,\n between: betweenOperator,\n};\n\n// Instantiate every operator with the Strapi instance\nexport default ({ strapi }: { strapi: Core.Strapi }) =>\n mapValues(operators, (opCtor) => opCtor({ strapi }));\n"],"names":["operators","and","andOperator","or","orOperator","not","notOperator","eq","eqOperator","eqi","eqiOperator","ne","neOperator","nei","neiOperator","startsWith","startsWithOperator","endsWith","endsWithOperator","contains","containsOperator","notContains","notContainsOperator","containsi","containsiOperator","notContainsi","notContainsiOperator","gt","gtOperator","gte","gteOperator","lt","ltOperator","lte","lteOperator","null","nullOperator","notNull","notNullOperator","in","inOperator","notIn","notInOperator","between","betweenOperator","strapi","mapValues","opCtor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,SAAAA,GAAY;IAChBC,GAAAA,EAAKC,GAAAA;IACLC,EAAAA,EAAIC,EAAAA;IACJC,GAAAA,EAAKC,GAAAA;IACLC,EAAAA,EAAIC,EAAAA;IACJC,GAAAA,EAAKC,GAAAA;IACLC,EAAAA,EAAIC,EAAAA;IACJC,GAAAA,EAAKC,GAAAA;IACLC,UAAAA,EAAYC,UAAAA;IACZC,QAAAA,EAAUC,QAAAA;IACVC,QAAAA,EAAUC,QAAAA;IACVC,WAAAA,EAAaC,WAAAA;IACbC,SAAAA,EAAWC,SAAAA;IACXC,YAAAA,EAAcC,YAAAA;IACdC,EAAAA,EAAIC,EAAAA;IACJC,GAAAA,EAAKC,GAAAA;IACLC,EAAAA,EAAIC,EAAAA;IACJC,GAAAA,EAAKC,GAAAA;IACLC,IAAAA,EAAMC,KAAAA;IACNC,OAAAA,EAASC,OAAAA;IACTC,EAAAA,EAAIC,GAAAA;IACJC,KAAAA,EAAOC,KAAAA;IACPC,OAAAA,EAASC;AACX,CAAA;AAEA;AACA,kBAAe,CAAA,CAAC,EAAEC,MAAM,EAA2B,GACjDC,gBAAAA,CAAU9C,SAAAA,EAAW,CAAC+C,MAAAA,GAAWA,MAAAA,CAAO;AAAEF,YAAAA;AAAO,SAAA,CAAA,CAAE;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mapValues } from 'lodash
|
|
1
|
+
import { mapValues } from 'lodash';
|
|
2
2
|
import andOperator from './and.mjs';
|
|
3
3
|
import orOperator from './or.mjs';
|
|
4
4
|
import notOperator from './not.mjs';
|
|
@@ -47,9 +47,9 @@ const operators$1 = {
|
|
|
47
47
|
between: betweenOperator
|
|
48
48
|
};
|
|
49
49
|
// Instantiate every operator with the Strapi instance
|
|
50
|
-
var operators = (({ strapi })=>mapValues((opCtor)=>opCtor({
|
|
50
|
+
var operators = (({ strapi })=>mapValues(operators$1, (opCtor)=>opCtor({
|
|
51
51
|
strapi
|
|
52
|
-
})
|
|
52
|
+
})));
|
|
53
53
|
|
|
54
54
|
export { operators as default };
|
|
55
55
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../../server/src/services/builders/filters/operators/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { mapValues } from 'lodash
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../server/src/services/builders/filters/operators/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { mapValues } from 'lodash';\nimport andOperator from './and';\nimport orOperator from './or';\nimport notOperator from './not';\nimport eqOperator from './eq';\nimport eqiOperator from './eqi';\nimport neOperator from './ne';\nimport neiOperator from './nei';\nimport startsWithOperator from './starts-with';\nimport endsWithOperator from './ends-with';\nimport containsOperator from './contains';\nimport notContainsOperator from './not-contains';\nimport containsiOperator from './containsi';\nimport notContainsiOperator from './not-containsi';\nimport gtOperator from './gt';\nimport gteOperator from './gte';\nimport ltOperator from './lt';\nimport lteOperator from './lte';\nimport nullOperator from './null';\nimport notNullOperator from './not-null';\nimport inOperator from './in';\nimport notInOperator from './not-in';\nimport betweenOperator from './between';\n\nconst operators = {\n and: andOperator,\n or: orOperator,\n not: notOperator,\n eq: eqOperator,\n eqi: eqiOperator,\n ne: neOperator,\n nei: neiOperator,\n startsWith: startsWithOperator,\n endsWith: endsWithOperator,\n contains: containsOperator,\n notContains: notContainsOperator,\n containsi: containsiOperator,\n notContainsi: notContainsiOperator,\n gt: gtOperator,\n gte: gteOperator,\n lt: ltOperator,\n lte: lteOperator,\n null: nullOperator,\n notNull: notNullOperator,\n in: inOperator,\n notIn: notInOperator,\n between: betweenOperator,\n};\n\n// Instantiate every operator with the Strapi instance\nexport default ({ strapi }: { strapi: Core.Strapi }) =>\n mapValues(operators, (opCtor) => opCtor({ strapi }));\n"],"names":["operators","and","andOperator","or","orOperator","not","notOperator","eq","eqOperator","eqi","eqiOperator","ne","neOperator","nei","neiOperator","startsWith","startsWithOperator","endsWith","endsWithOperator","contains","containsOperator","notContains","notContainsOperator","containsi","containsiOperator","notContainsi","notContainsiOperator","gt","gtOperator","gte","gteOperator","lt","ltOperator","lte","lteOperator","null","nullOperator","notNull","notNullOperator","in","inOperator","notIn","notInOperator","between","betweenOperator","strapi","mapValues","opCtor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,WAAAA,GAAY;IAChBC,GAAAA,EAAKC,WAAAA;IACLC,EAAAA,EAAIC,UAAAA;IACJC,GAAAA,EAAKC,WAAAA;IACLC,EAAAA,EAAIC,UAAAA;IACJC,GAAAA,EAAKC,WAAAA;IACLC,EAAAA,EAAIC,UAAAA;IACJC,GAAAA,EAAKC,WAAAA;IACLC,UAAAA,EAAYC,kBAAAA;IACZC,QAAAA,EAAUC,gBAAAA;IACVC,QAAAA,EAAUC,gBAAAA;IACVC,WAAAA,EAAaC,mBAAAA;IACbC,SAAAA,EAAWC,iBAAAA;IACXC,YAAAA,EAAcC,oBAAAA;IACdC,EAAAA,EAAIC,UAAAA;IACJC,GAAAA,EAAKC,WAAAA;IACLC,EAAAA,EAAIC,UAAAA;IACJC,GAAAA,EAAKC,WAAAA;IACLC,IAAAA,EAAMC,YAAAA;IACNC,OAAAA,EAASC,eAAAA;IACTC,EAAAA,EAAIC,UAAAA;IACJC,KAAAA,EAAOC,aAAAA;IACPC,OAAAA,EAASC;AACX,CAAA;AAEA;AACA,gBAAe,CAAA,CAAC,EAAEC,MAAM,EAA2B,GACjDC,SAAAA,CAAU9C,WAAAA,EAAW,CAAC+C,MAAAA,GAAWA,MAAAA,CAAO;AAAEF,YAAAA;AAAO,SAAA,CAAA,CAAE;;;;"}
|
|
@@ -6,6 +6,7 @@ var notOperator = (({ strapi })=>({
|
|
|
6
6
|
strapiOperator: '$not',
|
|
7
7
|
add (t, type) {
|
|
8
8
|
const { naming, attributes } = strapi.plugin('graphql').service('utils');
|
|
9
|
+
// Only the type is read; `isGraphQLScalar` keeps its published attribute parameter.
|
|
9
10
|
if (attributes.isGraphQLScalar({
|
|
10
11
|
type
|
|
11
12
|
})) {
|