tthr 0.0.37 → 0.0.39

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 +25 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -93,23 +93,30 @@ async function deploySchemaToServer(projectId, token, schemaPath, environment, d
93
93
  }
94
94
  spinner.text = "Deploying schema...";
95
95
  const envPath = environment !== "production" ? `/env/${environment}` : "";
96
- const response = await fetch(`${API_URL}/projects/${projectId}${envPath}/deploy/schema`, {
96
+ const schemaUrl = `${API_URL}/projects/${projectId}${envPath}/deploy/schema`;
97
+ console.log(chalk.dim(`
98
+ URL: ${schemaUrl}`));
99
+ const requestBody = {
100
+ sql,
101
+ tables: tables.map((t) => ({
102
+ name: t.name,
103
+ source: t.source,
104
+ columns: t.columns
105
+ }))
106
+ };
107
+ const response = await fetch(schemaUrl, {
97
108
  method: "POST",
98
109
  headers: {
99
110
  "Content-Type": "application/json",
100
111
  "Authorization": `Bearer ${token}`
101
112
  },
102
- body: JSON.stringify({
103
- sql,
104
- tables: tables.map((t) => ({
105
- name: t.name,
106
- source: t.source,
107
- columns: t.columns
108
- }))
109
- })
113
+ body: JSON.stringify(requestBody)
110
114
  });
115
+ console.log(chalk.dim(` Response: ${response.status} ${response.statusText}`));
116
+ console.log(chalk.dim(` Content-Type: ${response.headers.get("content-type")}`));
111
117
  if (!response.ok) {
112
118
  const text = await response.text();
119
+ console.log(chalk.dim(` Body: ${text.slice(0, 500)}`));
113
120
  let errorMessage;
114
121
  try {
115
122
  const error = JSON.parse(text);
@@ -160,7 +167,10 @@ async function deployFunctionsToServer(projectId, token, functionsDir, environme
160
167
  }
161
168
  spinner.text = "Deploying functions...";
162
169
  const envPath = environment !== "production" ? `/env/${environment}` : "";
163
- const response = await fetch(`${API_URL}/projects/${projectId}${envPath}/deploy/functions`, {
170
+ const functionsUrl = `${API_URL}/projects/${projectId}${envPath}/deploy/functions`;
171
+ console.log(chalk.dim(`
172
+ URL: ${functionsUrl}`));
173
+ const response = await fetch(functionsUrl, {
164
174
  method: "POST",
165
175
  headers: {
166
176
  "Content-Type": "application/json",
@@ -174,8 +184,11 @@ async function deployFunctionsToServer(projectId, token, functionsDir, environme
174
184
  }))
175
185
  })
176
186
  });
187
+ console.log(chalk.dim(` Response: ${response.status} ${response.statusText}`));
188
+ console.log(chalk.dim(` Content-Type: ${response.headers.get("content-type")}`));
177
189
  if (!response.ok) {
178
190
  const text = await response.text();
191
+ console.log(chalk.dim(` Body: ${text.slice(0, 500)}`));
179
192
  let errorMessage;
180
193
  try {
181
194
  const error = JSON.parse(text);
@@ -278,16 +291,14 @@ function parseSchema(source) {
278
291
  notNull: true,
279
292
  unique: true,
280
293
  // Also set unique so ALTER TABLE adds UNIQUE constraint
281
- hasDefault: false,
282
- isSystemColumn: true
294
+ hasDefault: false
283
295
  };
284
296
  columns["_createdAt"] = {
285
297
  type: "timestamp",
286
298
  primaryKey: false,
287
299
  notNull: true,
288
300
  unique: false,
289
- hasDefault: true,
290
- isSystemColumn: true
301
+ hasDefault: true
291
302
  };
292
303
  tables.push({ name: tableName, columns, source: tableSource });
293
304
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tthr",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "description": "Tether CLI - project scaffolding and deployment",
5
5
  "type": "module",
6
6
  "bin": {