2021-07-05 10:43:36 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const PAGINATION_TYPE_NAME = 'Pagination';
|
|
|
|
const PUBLICATION_STATE_TYPE_NAME = 'PublicationState';
|
|
|
|
|
|
|
|
const RESPONSE_COLLECTION_META_TYPE_NAME = 'ResponseCollectionMeta';
|
|
|
|
|
|
|
|
const GRAPHQL_SCALARS = [
|
|
|
|
'ID',
|
|
|
|
'Boolean',
|
|
|
|
'Int',
|
|
|
|
'String',
|
|
|
|
'Long',
|
|
|
|
'Float',
|
|
|
|
'JSON',
|
|
|
|
'Date',
|
|
|
|
'Time',
|
|
|
|
'DateTime',
|
|
|
|
];
|
|
|
|
|
|
|
|
const STRAPI_SCALARS = [
|
|
|
|
'boolean',
|
|
|
|
'integer',
|
|
|
|
'string',
|
2021-08-06 16:16:07 +02:00
|
|
|
'richtext',
|
2021-07-05 10:43:36 +02:00
|
|
|
'biginteger',
|
|
|
|
'float',
|
|
|
|
'decimal',
|
|
|
|
'json',
|
|
|
|
'date',
|
|
|
|
'time',
|
|
|
|
'datetime',
|
|
|
|
'timestamp',
|
|
|
|
];
|
|
|
|
|
2021-08-05 15:57:31 +02:00
|
|
|
const GENERIC_MORPH_TYPENAME = 'GenericMorph';
|
|
|
|
|
2021-08-16 15:21:00 +02:00
|
|
|
const KINDS = {
|
|
|
|
type: 'type',
|
|
|
|
component: 'component',
|
|
|
|
dynamicZone: 'dynamic-zone',
|
|
|
|
enum: 'enum',
|
|
|
|
entity: 'entity',
|
|
|
|
entityResponse: 'entity-response',
|
|
|
|
entityResponseCollection: 'entity-response-collection',
|
|
|
|
query: 'query',
|
|
|
|
mutation: 'mutation',
|
|
|
|
input: 'input',
|
|
|
|
filtersInput: 'filters-input',
|
|
|
|
scalar: 'scalar',
|
|
|
|
morph: 'polymorphic',
|
|
|
|
internal: 'internal',
|
|
|
|
};
|
|
|
|
|
2021-08-24 17:56:44 +02:00
|
|
|
const GRAPHQL_SCALAR_OPERATORS = {
|
|
|
|
// ID
|
2021-09-07 11:23:49 +02:00
|
|
|
ID: ['eq', 'not', 'gt', 'lt'],
|
2021-08-24 17:56:44 +02:00
|
|
|
// Booleans
|
|
|
|
Boolean: ['eq', 'not'],
|
|
|
|
// Strings
|
2021-09-07 11:23:49 +02:00
|
|
|
String: ['eq', 'not', 'gt', 'lt', 'contains', 'startsWith', 'endsWith'],
|
2021-08-24 17:56:44 +02:00
|
|
|
// Numbers
|
|
|
|
Int: ['eq', 'not', 'gt', 'lt'],
|
|
|
|
Long: ['eq', 'not', 'gt', 'lt'],
|
|
|
|
Float: ['eq', 'not', 'gt', 'lt'],
|
|
|
|
// Dates
|
|
|
|
Date: ['eq', 'not', 'gt', 'lt'],
|
|
|
|
Time: ['eq', 'not', 'gt', 'lt'],
|
|
|
|
DateTime: ['eq', 'not', 'gt', 'lt'],
|
|
|
|
// Others
|
|
|
|
JSON: ['eq', 'not'],
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = () => ({
|
2021-07-05 10:43:36 +02:00
|
|
|
PAGINATION_TYPE_NAME,
|
|
|
|
RESPONSE_COLLECTION_META_TYPE_NAME,
|
|
|
|
PUBLICATION_STATE_TYPE_NAME,
|
|
|
|
GRAPHQL_SCALARS,
|
|
|
|
STRAPI_SCALARS,
|
2021-08-05 15:57:31 +02:00
|
|
|
GENERIC_MORPH_TYPENAME,
|
2021-08-16 15:21:00 +02:00
|
|
|
KINDS,
|
2021-08-24 17:56:44 +02:00
|
|
|
GRAPHQL_SCALAR_OPERATORS,
|
|
|
|
});
|