UNPKG

@timescaledb/schemas

Version:

This package contains Zod schemas and types for all TimescaleDB objects.

37 lines 1.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BucketIntervalSchema = exports.RollupConfigSchema = exports.RollupOptionsSchema = exports.RollupRuleSchema = exports.RollupFunctionTypeSchema = exports.RollupFunctionType = void 0; const zod_1 = require("zod"); const continuous_aggregate_1 = require("./continuous-aggregate"); var RollupFunctionType; (function (RollupFunctionType) { RollupFunctionType["Rollup"] = "rollup"; })(RollupFunctionType || (exports.RollupFunctionType = RollupFunctionType = {})); exports.RollupFunctionTypeSchema = zod_1.z.nativeEnum(RollupFunctionType); exports.RollupRuleSchema = zod_1.z.object({ aggregateType: continuous_aggregate_1.AggregateTypeSchema.optional(), rollupFn: exports.RollupFunctionTypeSchema, sourceColumn: zod_1.z.string(), targetColumn: zod_1.z.string().optional(), }); exports.RollupOptionsSchema = zod_1.z.object({ name: zod_1.z.string(), sourceView: zod_1.z.string(), bucketInterval: zod_1.z.string(), rollupRules: zod_1.z.array(exports.RollupRuleSchema), materializedOnly: zod_1.z.boolean().default(false), bucketColumn: zod_1.z.object({ source: zod_1.z.string(), target: zod_1.z.string(), }), refresh_policy: continuous_aggregate_1.RefreshPolicySchema.optional(), }); exports.RollupConfigSchema = zod_1.z.object({ continuousAggregateOptions: continuous_aggregate_1.CreateContinuousAggregateOptionsSchema, rollupOptions: exports.RollupOptionsSchema, }); exports.BucketIntervalSchema = zod_1.z.object({ value: zod_1.z.number(), unit: zod_1.z.enum(['minute', 'hour', 'day', 'week', 'month', 'year']), }); //# sourceMappingURL=rollup.js.map