gristlabs_grist-core/app/plugin/DocApiTypes-ti.ts
Paul Fitzpatrick bfd0fa8c7f
add an endpoint for doing SQL selects (#641)
* add an endpoint for doing SQL selects

This adds an endpoint for doing SQL selects directly on a Grist document. Other kinds of statements are not supported. There is a default timeout of a second on queries.

This follows loosely an API design by Alex Hall.

Co-authored-by: jarek <jaroslaw.sadzinski@gmail.com>
2023-09-04 09:21:18 -04:00

113 lines
2.5 KiB
TypeScript

/**
* This module was automatically generated by `ts-interface-builder`
*/
import * as t from "ts-interface-checker";
// tslint:disable:object-literal-key-quotes
export const NewRecord = t.iface([], {
"fields": t.opt(t.iface([], {
[t.indexKey]: "CellValue",
})),
});
export const NewRecordWithStringId = t.iface([], {
"id": t.opt("string"),
"fields": t.opt(t.iface([], {
[t.indexKey]: "CellValue",
})),
});
export const Record = t.iface([], {
"id": "number",
"fields": t.iface([], {
[t.indexKey]: "CellValue",
}),
});
export const RecordWithStringId = t.iface([], {
"id": "string",
"fields": t.iface([], {
[t.indexKey]: "CellValue",
}),
});
export const AddOrUpdateRecord = t.iface([], {
"require": t.intersection(t.iface([], {
[t.indexKey]: "CellValue",
}), t.iface([], {
"id": t.opt("number"),
})),
"fields": t.opt(t.iface([], {
[t.indexKey]: "CellValue",
})),
});
export const RecordsPatch = t.iface([], {
"records": t.tuple("Record", t.rest(t.array("Record"))),
});
export const RecordsPost = t.iface([], {
"records": t.tuple("NewRecord", t.rest(t.array("NewRecord"))),
});
export const RecordsPut = t.iface([], {
"records": t.tuple("AddOrUpdateRecord", t.rest(t.array("AddOrUpdateRecord"))),
});
export const RecordId = t.name("number");
export const MinimalRecord = t.iface([], {
"id": "number",
});
export const ColumnsPost = t.iface([], {
"columns": t.tuple("NewRecordWithStringId", t.rest(t.array("NewRecordWithStringId"))),
});
export const ColumnsPatch = t.iface([], {
"columns": t.tuple("RecordWithStringId", t.rest(t.array("RecordWithStringId"))),
});
export const ColumnsPut = t.iface([], {
"columns": t.tuple("RecordWithStringId", t.rest(t.array("RecordWithStringId"))),
});
export const TablePost = t.iface(["ColumnsPost"], {
"id": t.opt("string"),
});
export const TablesPost = t.iface([], {
"tables": t.tuple("TablePost", t.rest(t.array("TablePost"))),
});
export const TablesPatch = t.iface([], {
"tables": t.tuple("RecordWithStringId", t.rest(t.array("RecordWithStringId"))),
});
export const SqlPost = t.iface([], {
"sql": "string",
"args": t.opt(t.array("any")),
"timeout": t.opt("number"),
});
const exportedTypeSuite: t.ITypeSuite = {
NewRecord,
NewRecordWithStringId,
Record,
RecordWithStringId,
AddOrUpdateRecord,
RecordsPatch,
RecordsPost,
RecordsPut,
RecordId,
MinimalRecord,
ColumnsPost,
ColumnsPatch,
ColumnsPut,
TablePost,
TablesPost,
TablesPatch,
SqlPost,
};
export default exportedTypeSuite;