@surf-ai/sdk 1.0.0-alpha.3 → 1.0.0-alpha.4

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/README.md CHANGED
@@ -14,7 +14,7 @@ SDK 1.0 uses a single direct-auth model.
14
14
 
15
15
  | Env Var | Default | Purpose |
16
16
  | --- | --- | --- |
17
- | `SURF_API_BASE_URL` | `https://api.ask.surf/gateway/v1` | Full Surf API base URL |
17
+ | `SURF_API_BASE_URL` | `https://api.asksurf.ai/gateway/v1` | Full Surf API base URL |
18
18
  | `SURF_API_KEY` | none | Bearer token used for upstream requests and protected runtime endpoints |
19
19
  | `PORT` | none | Express server port when `createServer({ port })` is not provided |
20
20
 
package/dist/db/index.cjs CHANGED
@@ -41,7 +41,7 @@ __export(db_exports, {
41
41
  module.exports = __toCommonJS(db_exports);
42
42
 
43
43
  // src/core/config.ts
44
- var DEFAULT_API_BASE_URL = "https://api.ask.surf/gateway/v1";
44
+ var DEFAULT_API_BASE_URL = "https://api.asksurf.ai/gateway/v1";
45
45
  function trimTrailingSlashes(value) {
46
46
  return String(value || "").replace(/\/+$/, "");
47
47
  }
@@ -188,7 +188,9 @@ async function doSyncSchema(schemaPath) {
188
188
  );
189
189
  if (tables.length === 0) return;
190
190
  await post("db/provision", {});
191
- const existing = (await get("db/tables")).map((t) => t.name);
191
+ const tablesResult = await get("db/tables");
192
+ const tablesList = Array.isArray(tablesResult) ? tablesResult : tablesResult.tables || [];
193
+ const existing = tablesList.map((t) => typeof t === "string" ? t : t.name);
192
194
  const missing = tables.filter((t) => !existing.includes(getTableConfig(t).name));
193
195
  if (missing.length > 0) {
194
196
  const { generateDrizzleJson, generateMigration } = require("drizzle-kit/api");
package/dist/db/index.js CHANGED
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
6
6
  });
7
7
 
8
8
  // src/core/config.ts
9
- var DEFAULT_API_BASE_URL = "https://api.ask.surf/gateway/v1";
9
+ var DEFAULT_API_BASE_URL = "https://api.asksurf.ai/gateway/v1";
10
10
  function trimTrailingSlashes(value) {
11
11
  return String(value || "").replace(/\/+$/, "");
12
12
  }
@@ -153,7 +153,9 @@ async function doSyncSchema(schemaPath) {
153
153
  );
154
154
  if (tables.length === 0) return;
155
155
  await post("db/provision", {});
156
- const existing = (await get("db/tables")).map((t) => t.name);
156
+ const tablesResult = await get("db/tables");
157
+ const tablesList = Array.isArray(tablesResult) ? tablesResult : tablesResult.tables || [];
158
+ const existing = tablesList.map((t) => typeof t === "string" ? t : t.name);
157
159
  const missing = tables.filter((t) => !existing.includes(getTableConfig(t).name));
158
160
  if (missing.length > 0) {
159
161
  const { generateDrizzleJson, generateMigration } = __require("drizzle-kit/api");
@@ -43,7 +43,7 @@ var import_path = __toESM(require("path"), 1);
43
43
  var import_croner = require("croner");
44
44
 
45
45
  // src/core/config.ts
46
- var DEFAULT_API_BASE_URL = "https://api.ask.surf/gateway/v1";
46
+ var DEFAULT_API_BASE_URL = "https://api.asksurf.ai/gateway/v1";
47
47
  function trimTrailingSlashes(value) {
48
48
  return String(value || "").replace(/\/+$/, "");
49
49
  }
@@ -195,7 +195,9 @@ async function doSyncSchema(schemaPath) {
195
195
  );
196
196
  if (tables.length === 0) return;
197
197
  await post("db/provision", {});
198
- const existing = (await get("db/tables")).map((t) => t.name);
198
+ const tablesResult = await get("db/tables");
199
+ const tablesList = Array.isArray(tablesResult) ? tablesResult : tablesResult.tables || [];
200
+ const existing = tablesList.map((t) => typeof t === "string" ? t : t.name);
199
201
  const missing = tables.filter((t) => !existing.includes(getTableConfig(t).name));
200
202
  if (missing.length > 0) {
201
203
  const { generateDrizzleJson, generateMigration } = require("drizzle-kit/api");
@@ -13,7 +13,7 @@ import path from "path";
13
13
  import { Cron } from "croner";
14
14
 
15
15
  // src/core/config.ts
16
- var DEFAULT_API_BASE_URL = "https://api.ask.surf/gateway/v1";
16
+ var DEFAULT_API_BASE_URL = "https://api.asksurf.ai/gateway/v1";
17
17
  function trimTrailingSlashes(value) {
18
18
  return String(value || "").replace(/\/+$/, "");
19
19
  }
@@ -165,7 +165,9 @@ async function doSyncSchema(schemaPath) {
165
165
  );
166
166
  if (tables.length === 0) return;
167
167
  await post("db/provision", {});
168
- const existing = (await get("db/tables")).map((t) => t.name);
168
+ const tablesResult = await get("db/tables");
169
+ const tablesList = Array.isArray(tablesResult) ? tablesResult : tablesResult.tables || [];
170
+ const existing = tablesList.map((t) => typeof t === "string" ? t : t.name);
169
171
  const missing = tables.filter((t) => !existing.includes(getTableConfig(t).name));
170
172
  if (missing.length > 0) {
171
173
  const { generateDrizzleJson, generateMigration } = __require("drizzle-kit/api");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surf-ai/sdk",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.4",
4
4
  "description": "Surf platform SDK — data API client, server runtime, and database helpers",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,7 +22,7 @@
22
22
  "build": "tsup",
23
23
  "dev": "tsup --watch",
24
24
  "typecheck": "tsc --noEmit",
25
- "codegen": "python3 scripts/gen_sdk.py --spec https://api.ask.surf/gateway/openapi.json"
25
+ "codegen": "python3 scripts/gen_sdk.py --spec https://api.asksurf.ai/gateway/openapi.json"
26
26
  },
27
27
  "dependencies": {
28
28
  "express": "^4.22.0",