@timescaledb/schemas
Version:
This package contains Zod schemas and types for all TimescaleDB objects.
40 lines • 1.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateContinuousAggregateOptionsSchema = exports.RefreshPolicySchema = exports.AggregateColumnOptionsSchema = exports.AggregateTypeSchema = exports.AggregateType = void 0;
const zod_1 = require("zod");
var AggregateType;
(function (AggregateType) {
AggregateType["Count"] = "count";
AggregateType["CountDistinct"] = "count_distinct";
AggregateType["Sum"] = "sum";
AggregateType["Avg"] = "avg";
AggregateType["Min"] = "min";
AggregateType["Max"] = "max";
AggregateType["Bucket"] = "bucket";
AggregateType["Candlestick"] = "candlestick";
})(AggregateType || (exports.AggregateType = AggregateType = {}));
exports.AggregateTypeSchema = zod_1.z.nativeEnum(AggregateType);
exports.AggregateColumnOptionsSchema = zod_1.z.object({
type: exports.AggregateTypeSchema,
column: zod_1.z.string().optional(),
column_alias: zod_1.z.string().optional(),
time_column: zod_1.z.string().optional(),
price_column: zod_1.z.string().optional(),
volume_column: zod_1.z.string().optional(),
});
exports.RefreshPolicySchema = zod_1.z.object({
start_offset: zod_1.z.string(),
end_offset: zod_1.z.string(),
schedule_interval: zod_1.z.string(),
});
exports.CreateContinuousAggregateOptionsSchema = zod_1.z
.object({
name: zod_1.z.string(),
bucket_interval: zod_1.z.string(),
time_column: zod_1.z.string().optional(),
refresh_policy: exports.RefreshPolicySchema.optional(),
aggregates: zod_1.z.record(exports.AggregateColumnOptionsSchema).optional(),
group_columns: zod_1.z.array(zod_1.z.string()).optional(),
})
.strict();
//# sourceMappingURL=continuous-aggregate.js.map