@arbidocs/sdk 0.5.183 → 0.5.184

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -10957,6 +10957,7 @@ __export(databases_exports, {
10957
10957
  deleteDatabaseRows: () => deleteDatabaseRows,
10958
10958
  exportDatabase: () => exportDatabase,
10959
10959
  getDatabase: () => getDatabase,
10960
+ getDatabaseCapabilities: () => getDatabaseCapabilities,
10960
10961
  importDatabase: () => importDatabase,
10961
10962
  importDatabaseRows: () => importDatabaseRows,
10962
10963
  listDatabaseRows: () => listDatabaseRows,
@@ -10965,6 +10966,23 @@ __export(databases_exports, {
10965
10966
  updateDatabase: () => updateDatabase,
10966
10967
  updateDatabaseRow: () => updateDatabaseRow
10967
10968
  });
10969
+ var NO_DATABASE_CAPABILITIES = Object.freeze({
10970
+ column_types: [],
10971
+ view_layouts: []
10972
+ });
10973
+ async function getDatabaseCapabilities(arbi) {
10974
+ try {
10975
+ const { data, error } = await arbi.fetch.GET(
10976
+ "/v1/databases/capabilities"
10977
+ );
10978
+ if (error || !data || typeof data !== "object") return NO_DATABASE_CAPABILITIES;
10979
+ const { column_types, view_layouts } = data;
10980
+ const strings = (v2) => Array.isArray(v2) ? v2.filter((x2) => typeof x2 === "string") : [];
10981
+ return { column_types: strings(column_types), view_layouts: strings(view_layouts) };
10982
+ } catch {
10983
+ return NO_DATABASE_CAPABILITIES;
10984
+ }
10985
+ }
10968
10986
  var path2 = (databaseId) => ({ path: { database_id: databaseId } });
10969
10987
  function spreadsheet(file) {
10970
10988
  const form = new FormData();
@@ -15020,6 +15038,8 @@ var Arbi = class {
15020
15038
  // ── Databases (user-defined tables of the open workspace) ──────────
15021
15039
  databases = {
15022
15040
  list: () => listDatabases(this.requireClient()),
15041
+ /** What this deployment's databases accept; any failure is the empty answer (the original types). */
15042
+ capabilities: () => getDatabaseCapabilities(this.requireClient()),
15023
15043
  get: (databaseId) => getDatabase(this.requireClient(), databaseId),
15024
15044
  /** A search of the rows (any cell), sorted and paged on the server. */
15025
15045
  rows: (databaseId, query2) => listDatabaseRows(this.requireClient(), databaseId, query2),