graphql-compose-elasticsearch
Version:
Elastic search via GraphQL
62 lines • 2.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDateTimeZoneFC = exports.getDateMathFC = exports.getDateIntervalFC = exports.getDateFormatFC = exports.getDateRangeITC = void 0;
const utils_1 = require("../../utils");
function getDateRangeITC(opts) {
const name = (0, utils_1.getTypeName)('DateRange', opts);
const description = (0, utils_1.desc)(`Date range where \`from\` value includes and \`to\` value excludes.`);
return opts.getOrCreateITC(name, () => ({
name,
description,
fields: {
from: getDateMathFC(opts),
to: getDateMathFC(opts),
},
}));
}
exports.getDateRangeITC = getDateRangeITC;
function getDateFormatFC(_opts) {
return {
type: 'String',
description: (0, utils_1.desc)(`
Date Format/Patter. Eg MM-yyy returns 08-2012.
[JodaDate](http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html)
`),
};
}
exports.getDateFormatFC = getDateFormatFC;
function getDateIntervalFC(_opts) {
return {
type: 'String',
description: (0, utils_1.desc)(`
Available expressions for interval: year, quarter, month, week, day, hour,
minute, second.
Or time units, like 2d for 2 days. h, m, s, ms, micros, nanos.
`),
};
}
exports.getDateIntervalFC = getDateIntervalFC;
function getDateMathFC(_opts) {
return {
type: 'String',
description: (0, utils_1.desc)(`
The expression starts with an anchor date, which can either be now,
or a date string ending with ||. Eg \`2015-01-01||+1M/d\` means 2015-01-01
plus one month, rounded down to the nearest day. Or \`now+1h+1m\`.
The supported time units: y, M, w, d, h, m, s
`),
};
}
exports.getDateMathFC = getDateMathFC;
function getDateTimeZoneFC(_opts) {
return {
type: 'String',
description: (0, utils_1.desc)(`
Time zones may either be specified as an ISO 8601 UTC offset
(e.g. +01:00 or -08:00) or as one of the time zone ids from the
[TZ database](http://www.joda.org/joda-time/timezones.html).
`),
};
}
exports.getDateTimeZoneFC = getDateTimeZoneFC;
//# sourceMappingURL=Date.js.map