alinea
Version:
[](https://npmjs.org/package/alinea) [](https://packagephobia.com/result?p=alinea)
76 lines (74 loc) • 1.67 kB
JavaScript
import {
array,
boolean,
literal,
string,
tuple,
union
} from "../../chunks/chunk-7LBNER34.js";
import "../../chunks/chunk-U5RRZUYZ.js";
// src/core/pages/Selection.ts
import { CursorData } from "./Cursor.js";
import { ExprData } from "./ExprData.js";
import { TargetData } from "./TargetData.js";
var Selection;
((Selection2) => {
let types;
((types2) => {
class Row2 {
type = literal("row");
target = TargetData;
}
types2.Row = Row2;
class Record2 {
type = literal("record");
fields = array(union(tuple(string, Selection2.adt), tuple(TargetData)));
}
types2.Record = Record2;
class Cursor2 {
type = literal("cursor");
cursor = CursorData;
}
types2.Cursor = Cursor2;
class Expr2 {
type = literal("expr");
expr = ExprData.adt;
fromParent = boolean;
}
types2.Expr = Expr2;
class Count2 {
type = literal("count");
}
types2.Count = Count2;
})(types || (types = {}));
function Row(target) {
return { type: "row", target };
}
Selection2.Row = Row;
function Record(fields) {
return { type: "record", fields };
}
Selection2.Record = Record;
function Cursor(cursor) {
return { type: "cursor", cursor };
}
Selection2.Cursor = Cursor;
function Expr(expr, fromParent = false) {
return { type: "expr", expr, fromParent };
}
Selection2.Expr = Expr;
function Count() {
return { type: "count" };
}
Selection2.Count = Count;
Selection2.adt = union(
types.Row,
types.Record,
types.Cursor,
types.Expr,
types.Count
);
})(Selection || (Selection = {}));
export {
Selection
};