@tthr/vue 0.3.0 → 0.3.2

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.
@@ -90,18 +90,11 @@ function getWsUrl(config) {
90
90
  .replace('https://', 'wss://')
91
91
  .replace('http://', 'ws://')
92
92
  .replace(/\/$/, '');
93
- const env = config.environment;
94
- const wsPath = env && env !== 'production'
95
- ? `${base}/ws/${config.projectId}/${env}`
96
- : `${base}/ws/${config.projectId}`;
97
- return `${wsPath}?type=server&token=${encodeURIComponent(config.apiKey)}`;
93
+ return `${base}/ws/${config.projectId}?type=server&token=${encodeURIComponent(config.apiKey)}`;
98
94
  }
99
95
  async function reportExecution(config, trigger, result, durationMs) {
100
96
  const base = config.url.replace(/\/$/, '');
101
- const env = config.environment;
102
- const apiPath = env && env !== 'production'
103
- ? `${base}/api/v1/projects/${config.projectId}/env/${env}`
104
- : `${base}/api/v1/projects/${config.projectId}`;
97
+ const apiPath = `${base}/api/v1/projects/${config.projectId}`;
105
98
  try {
106
99
  const response = await fetch(`${apiPath}/crons/${trigger.cronId}/executions`, {
107
100
  method: 'POST',
@@ -279,7 +272,6 @@ export default defineNitroPlugin((nitro) => {
279
272
  const apiKey = process.env.NUXT_TETHER_API_KEY || process.env.TETHER_API_KEY;
280
273
  const url = process.env.NUXT_TETHER_URL || process.env.TETHER_URL || 'https://tether-api.strands.gg';
281
274
  const projectId = process.env.NUXT_TETHER_PROJECT_ID || process.env.TETHER_PROJECT_ID;
282
- const environment = process.env.NUXT_TETHER_ENVIRONMENT || process.env.TETHER_ENVIRONMENT;
283
275
  verboseLogging = process.env.NUXT_TETHER_VERBOSE === 'true' || process.env.TETHER_VERBOSE === 'true';
284
276
  if (!apiKey || !projectId) {
285
277
  log.debug('Missing config - cron connection disabled');
@@ -287,8 +279,8 @@ export default defineNitroPlugin((nitro) => {
287
279
  }
288
280
  // Configure the server client so executeFunction works
289
281
  configureTetherServer({ url, projectId, apiKey });
290
- log.info(`Initialising cron connection...${environment ? ` (env: ${environment})` : ''}`);
291
- const config = { url, projectId, apiKey, environment };
282
+ log.info('Initialising cron connection...');
283
+ const config = { url, projectId, apiKey };
292
284
  process.nextTick(() => {
293
285
  connect(config).catch((err) => log.error('Initial connect failed:', err));
294
286
  });
@@ -100,7 +100,15 @@ export async function proxyToTetherApi(config, endpoint, functionName, args, ext
100
100
  message: 'Too many requests — please try again shortly',
101
101
  });
102
102
  }
103
- const error = await response.json().catch(() => ({ error: 'Unknown error' }));
103
+ const rawText = await response.text().catch(() => '');
104
+ let error = { error: 'Unknown error' };
105
+ try {
106
+ error = JSON.parse(rawText);
107
+ }
108
+ catch {
109
+ log.error(`Tether API returned non-JSON (HTTP ${response.status}): ${rawText.slice(0, 500)}`);
110
+ }
111
+ log.error(`Tether API error (HTTP ${response.status}) for ${endpoint}/${functionName}: ${error.error || rawText.slice(0, 200)}`);
104
112
  throw createError({
105
113
  statusCode: response.status,
106
114
  message: error.error || `${endpoint === 'query' ? 'Query' : 'Mutation'} failed`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tthr/vue",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Tether Vue/Nuxt SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -32,20 +32,20 @@
32
32
  "nuxt/runtime/**/*.vue",
33
33
  "nuxt/runtime/server/**/*.js"
34
34
  ],
35
- "scripts": {
36
- "build": "tsc && tsc -p nuxt/tsconfig.json && tsc -p nuxt/tsconfig.server.json; true",
37
- "dev": "tsc --watch",
38
- "typecheck": "tsc --noEmit"
39
- },
40
35
  "dependencies": {
41
36
  "@nuxt/kit": "^3.14.0",
42
- "@tthr/client": "workspace:*",
43
- "@tthr/server": "workspace:*"
37
+ "@tthr/client": "^0.3.0",
38
+ "@tthr/server": "^0.3.0"
44
39
  },
45
40
  "devDependencies": {
46
41
  "typescript": "^5.7.2"
47
42
  },
48
43
  "peerDependencies": {
49
44
  "vue": "^3.0.0"
45
+ },
46
+ "scripts": {
47
+ "build": "tsc; tsc -p nuxt/tsconfig.json; tsc -p nuxt/tsconfig.server.json; true",
48
+ "dev": "tsc --watch",
49
+ "typecheck": "tsc --noEmit"
50
50
  }
51
- }
51
+ }