UNPKG

1.11 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const column_1 = require("./column");
4const row_1 = require("./row");
5class View {
6 constructor(client, workspaceId, coreId, tableId, id, name, type, columns, rows) {
7 this._client = client;
8 this.workspaceId = workspaceId;
9 this.coreId = coreId;
10 this.tableId = tableId;
11 this.id = id;
12 this.name = name;
13 this.type = type;
14 this.columns = columns || new Map();
15 this.rows = rows || new Map();
16 }
17 column(id) {
18 if (!this.columns.has(id)) {
19 throw new Error('Column does not exist');
20 }
21 return this.columns.get(id);
22 }
23 row(id) {
24 if (!this.rows.has(id)) {
25 throw new Error('Row does not exist');
26 }
27 return this.rows.get(id);
28 }
29 getColumns() {
30 return new column_1.ColumnArray(this._client, [...this.columns.values()]);
31 }
32 getRows() {
33 return new row_1.RowArray(this._client, [...this.rows.values()]);
34 }
35}
36exports.View = View;
37//# sourceMappingURL=view.js.map
\No newline at end of file