import { a } from "./chunk-SFKZAUPW.js";
import { Type as e } from "@sinclair/typebox";
/*! Upstart.gg - Copyright (C) 2024 Flippable - https://github.com/upstart-gg/upstart/blob/main/LICENSE */
var n = e.Object({ channelId: e.String(), order: e.Optional(e.String()), maxResults: e.Optional(e.Number()), regionCode: e.Optional(e.String()), relevanceLanguage: e.Optional(e.String()) }), o = e.Object({ url: e.String({ format: "uri" }), headers: e.Optional(e.Record(e.String(), e.String())) }), l = e.Object({ url: e.String({ format: "uri" }) });
e.Union([e.Literal("custom"), e.Literal("rss"), e.Literal("youtube-list"), e.Literal("http-json"), e.Literal("internal-blog"), e.Literal("internal-changelog"), e.Literal("internal-faq"), e.Literal("internal-links"), e.Literal("internal-recipes")]);
var s = e.Union([e.Object({ provider: e.Literal("youtube-list"), options: n }), e.Object({ provider: e.Literal("rss"), options: l }), e.Object({ provider: e.Literal("internal-blog"), options: e.Optional(e.Object({}, { additionalProperties: !0 })) }), e.Object({ provider: e.Literal("internal-changelog"), options: e.Optional(e.Object({}, { additionalProperties: !0 })) }), e.Object({ provider: e.Literal("internal-faq"), options: e.Optional(e.Object({}, { additionalProperties: !0 })) }), e.Object({ provider: e.Literal("internal-links"), options: e.Optional(e.Object({}, { additionalProperties: !0 })) }), e.Object({ provider: e.Literal("internal-recipes"), options: e.Optional(e.Object({}, { additionalProperties: !0 })) })]), t = e.Object({ id: e.String({ title: "ID", description: "Unique identifier of the datasource. Used to reference the datasource in the system. Use a url-safe string like a slug." }), label: e.String({ title: "Label", description: "Label of the datasource displayed in the UI" }) }), d = e.Composite([s, t, e.Object({ schema: e.Null({ description: "Always null for provider datasources. The schema is defined by the provider." }), ttlMinutes: e.Optional(e.Number({ title: "Time to live", description: "Time to live in minutes. If set to -1, it never expires and has to be manually refreshed. If set to 0, the datasource is always fetched live. If > 0, then the datasource is feteched every N minutes." })), refresh: e.Optional(e.Object({ method: e.Union([e.Literal("interval"), e.Literal("manual"), e.Literal("live")]), interval: e.Optional(e.Number()) }, { title: "Refresh options", description: "Options to refresh the datasource" })) })]), c = e.Composite([t, e.Object({ provider: e.Literal("custom", { title: "Custom", description: "Custom datasource saved locally in Upstart." }), options: e.Optional(e.Object({}, { additionalProperties: !0 })), schema: e.Any({ title: "Schema", description: "JSON Schema of datasource. Always an array of objects." }), indexes: e.Optional(e.Array(e.Object({ name: e.String({ title: "Index name" }), fields: e.Array(e.String(), { title: "Fields to index" }), unique: e.Optional(e.Boolean({ title: "Unique index", default: !1 })) }), { title: "Indexes", description: "IMPORTANT: Indexes to create on the datasource. use it to enforce uniqueness or improve query performance." })) }, { $id: "datasource:custom" })]), p = e.Composite([t, e.Object({ provider: e.Literal("http-json", { title: "JSON Array", description: "JSON array datasource." }), options: o, schema: e.Any({ title: "Schema", description: "JSON Schema of datasource. Always an array of objects.", examples: [{ type: "array", items: { type: "object", properties: { id: { type: "string", title: "ID" }, title: { type: "string", title: "Title" }, firstname: { type: "string", title: "Firstname" }, lastname: { type: "string", title: "Lastname" }, createdAt: { type: "string", format: "date-time", title: "Created at" }, email: { type: "string", format: "email", title: "Email" } }, required: ["id", "title", "firstname", "lastname", "email", "createdAt"], title: "Employee" }, title: "Employees", description: "Employees list" }] }) })]), u = e.Union([c, p, d]);
e.Array(u);
var m = e.Object({ field: e.String(), op: e.Union([e.Literal("eq"), e.Literal("ne"), e.Literal("contains"), e.Literal("notContains"), e.Literal("startsWith"), e.Literal("notStartsWith"), e.Literal("endsWith"), e.Literal("notEndsWith")]), value: e.String() }), f = e.Object({ field: e.String(), op: e.Union([e.Literal("eq"), e.Literal("ne"), e.Literal("lt"), e.Literal("lte"), e.Literal("gt"), e.Literal("gte")]), value: e.Number() }), b = e.Object({ field: e.String(), op: e.Union([e.Literal("before"), e.Literal("after")]), value: e.String() }), O = e.Object({ field: e.String(), op: e.Union([e.Literal("beforeNow"), e.Literal("afterNow")]), value: e.Null() }), L = e.Object({ field: e.String(), op: e.Union([e.Literal("contains"), e.Literal("notContains"), e.Literal("containsAll"), e.Literal("containsAny"), e.Literal("notContainsAny")]), value: e.Array(e.String()) }), g = e.Object({ field: e.String(), op: e.Literal("eq"), value: e.Boolean() }), r = e.Union([m, f, b, O, L, g]), y = e.Recursive((i) => e.Union([e.Object({ op: e.Literal("and"), fields: e.Array(e.Union([r, i])) }), e.Object({ op: e.Literal("or"), fields: e.Array(e.Union([r, i])) })], { default: { op: "and", fields: [] } })), j = e.Object({ id: e.String({ title: "Query ID", description: "Unique identifier for the query. Used to reference the query in the system. URL-safe string like a slug." }), label: e.String({ title: "Label", maxLength: 100, description: "Label of the query displayed in the UI" }), datasourceId: e.String({ title: "Database", description: "ID of the datasource to query" }), limit: e.Number({ title: "Limit", description: "Limit the number of records to fetch from the datasource.", minimum: 1, maximum: 50, default: 10 }), sortDirection: e.Optional(e.Union([e.Null(), a(["asc", "desc"], { title: "Sort", enumNames: ["Ascending", "Descending"], description: "Direction to sort the records by", default: "desc" })])), sortField: e.Optional(e.String({ title: "Sort Field", description: "Select a field to sort by (must be indexed)", default: "$publicationDate" })), filters: e.Optional(y), parameters: e.Optional(e.Array(e.String(), { title: "Parameters", description: "Field names that will be used as parameters when using the query. Only indexed fields can be used as parameters.", default: [], examples: [["$slug"], ["$id"], ["category", "tags"]] })) });
export {
  u as b,
  r as d,
  j as e
};
//# sourceMappingURL=chunk-5N6MBJJ4.js.map
