tthr 0.0.35 → 0.0.37

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.
Files changed (2) hide show
  1. package/dist/index.js +19 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -109,8 +109,15 @@ async function deploySchemaToServer(projectId, token, schemaPath, environment, d
109
109
  })
110
110
  });
111
111
  if (!response.ok) {
112
- const error = await response.json().catch(() => ({ error: "Unknown error" }));
113
- throw new Error(error.error || `HTTP ${response.status}`);
112
+ const text = await response.text();
113
+ let errorMessage;
114
+ try {
115
+ const error = JSON.parse(text);
116
+ errorMessage = error.error || `HTTP ${response.status}`;
117
+ } catch {
118
+ errorMessage = text || `HTTP ${response.status}: ${response.statusText}`;
119
+ }
120
+ throw new Error(errorMessage);
114
121
  }
115
122
  spinner.succeed(`Schema deployed (${tables.length} table(s))`);
116
123
  } catch (error) {
@@ -168,8 +175,15 @@ async function deployFunctionsToServer(projectId, token, functionsDir, environme
168
175
  })
169
176
  });
170
177
  if (!response.ok) {
171
- const error = await response.json().catch(() => ({ error: "Unknown error" }));
172
- throw new Error(error.error || `HTTP ${response.status}`);
178
+ const text = await response.text();
179
+ let errorMessage;
180
+ try {
181
+ const error = JSON.parse(text);
182
+ errorMessage = error.error || `HTTP ${response.status}`;
183
+ } catch {
184
+ errorMessage = text || `HTTP ${response.status}: ${response.statusText}`;
185
+ }
186
+ throw new Error(errorMessage);
173
187
  }
174
188
  spinner.succeed(`Functions deployed (${functions.length} function(s))`);
175
189
  const queries = functions.filter((f) => f.type === "query");
@@ -306,7 +320,7 @@ function buildColumnSql(colName, def, forAlterTable = false) {
306
320
  if (addingPrimaryKey) colSql += " PRIMARY KEY";
307
321
  if (def.notNull && !forAlterTable) colSql += " NOT NULL";
308
322
  if (def.unique && !addingPrimaryKey) colSql += " UNIQUE";
309
- if (def.hasDefault && def.type === "timestamp") {
323
+ if (def.hasDefault && def.type === "timestamp" && !forAlterTable) {
310
324
  colSql += " DEFAULT (datetime('now'))";
311
325
  }
312
326
  if (def.references) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tthr",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "Tether CLI - project scaffolding and deployment",
5
5
  "type": "module",
6
6
  "bin": {