autumn-js
Version:
Autumn JS Library
93 lines (90 loc) • 3.91 kB
JavaScript
"use client";
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/libraries/react/client/types/clientAnalyticsTypes.ts
var clientAnalyticsTypes_exports = {};
__export(clientAnalyticsTypes_exports, {
BinSizeEnumSchema: () => BinSizeEnumSchema,
EventAggregationParamsSchema: () => EventAggregationParamsSchema,
EventAggregationTotalSchema: () => EventAggregationTotalSchema,
EventsListParamsSchema: () => EventsListParamsSchema,
PagePaginationDefaults: () => PagePaginationDefaults,
PagePaginationQuerySchema: () => PagePaginationQuerySchema,
RangeEnumSchema: () => RangeEnumSchema
});
module.exports = __toCommonJS(clientAnalyticsTypes_exports);
var import_v4 = require("zod/v4");
var PagePaginationDefaults = {
Limit: 100,
MaxLimit: 1e3
};
var PagePaginationQuerySchema = import_v4.z.object({
offset: import_v4.z.coerce.number().int().min(0).default(0).optional().describe("Number of items to skip"),
limit: import_v4.z.coerce.number().int().min(1).max(PagePaginationDefaults.MaxLimit).optional().describe(
`Number of items to return. Default ${PagePaginationDefaults.Limit}, max ${PagePaginationDefaults.MaxLimit}.`
)
});
var EventsListParamsSchema = PagePaginationQuerySchema.extend({
featureId: import_v4.z.string().min(1).or(import_v4.z.array(import_v4.z.string().min(1))).describe("Filter by specific feature ID(s)"),
customRange: import_v4.z.object({
start: import_v4.z.coerce.number().optional().describe("Filter events after this timestamp (epoch milliseconds)"),
end: import_v4.z.coerce.number().optional().describe("Filter events before this timestamp (epoch milliseconds)")
}).optional().describe("Filter events by time range")
});
var RangeEnumSchema = import_v4.z.enum([
"24h",
"7d",
"30d",
"90d",
"last_cycle",
"1bc",
"3bc"
]);
var BinSizeEnumSchema = import_v4.z.enum(["day", "hour"]).default("day");
var EventAggregationParamsSchema = import_v4.z.object({
featureId: import_v4.z.string().min(1).or(import_v4.z.array(import_v4.z.string().min(1))).describe("Feature ID(s) to aggregate"),
groupBy: import_v4.z.string().startsWith("properties.").optional().describe("Group results by a property field (e.g., 'properties.region')"),
range: RangeEnumSchema.optional().describe(
"Predefined time range. One of: 24h, 7d, 30d, 90d, last_cycle, 1bc, 3bc"
),
binSize: BinSizeEnumSchema.describe(
"Bin size for aggregation: 'day' or 'hour'"
).optional(),
customRange: import_v4.z.object({
start: import_v4.z.number().describe("Start timestamp (epoch milliseconds)"),
end: import_v4.z.number().describe("End timestamp (epoch milliseconds)")
}).optional().describe("Custom time range (mutually exclusive with range)")
});
var EventAggregationTotalSchema = import_v4.z.record(
import_v4.z.string(),
import_v4.z.object({
count: import_v4.z.number(),
sum: import_v4.z.number()
})
);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BinSizeEnumSchema,
EventAggregationParamsSchema,
EventAggregationTotalSchema,
EventsListParamsSchema,
PagePaginationDefaults,
PagePaginationQuerySchema,
RangeEnumSchema
});