MCPcopy Create free account
hub / github.com/ConnectAI-E/TalkBase / DataWriter

Class DataWriter

utils/BaseSchema/dataWriter.ts:6–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import { text } from "stream/consumers";
5
6export class DataWriter {
7 tableInfo: TableProps;
8 private _result: Record<string, string> = {};
9
10 constructor(tableInfo: TableProps) {
11 this.tableInfo = tableInfo;
12 }
13
14 load(res: any) {
15 this._result = res;
16 return this;
17 }
18
19 get res() {
20 return this._result;
21 }
22
23 exportText(text: string) {
24 return {
25 type: "text",
26 text: text,
27 };
28 }
29
30 exportUrl(text: string) {
31 return {
32 type: "url",
33 text: text,
34 };
35 }
36
37 exportNumber(number: number) {
38 return number;
39 }
40
41 exportString(string: string) {
42 return string;
43 }
44
45 exportBoolean(boolean: boolean) {
46 return boolean;
47 }
48
49 exportSelect(label: string, labelId: string) {
50 return {
51 id: labelId,
52 text: label,
53 };
54 }
55
56 findSelectLabelId(field: IFieldMeta, label: string) {
57 const property = field.property as any;
58 if (!property || !property?.options) {
59 return null;
60 }
61 const options = property.options as any;
62 if (!options) {
63 return null;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected