@scout9/app 1.0.0-alpha.0.3.8 → 1.0.0-alpha.0.4.0

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.
@@ -29483,7 +29483,7 @@ class Body {
29483
29483
  }
29484
29484
  const {
29485
29485
  toFormData
29486
- } = await Promise.resolve().then(function () { return require("./multipart-parser-723d74f7.cjs"); });
29486
+ } = await Promise.resolve().then(function () { return require("./multipart-parser-d7d5d504.cjs"); });
29487
29487
  return toFormData(this.body, ct);
29488
29488
  }
29489
29489
 
@@ -41884,7 +41884,7 @@ function _loadUserPackageJson() {
41884
41884
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
41885
41885
  _context.t0 = JSON;
41886
41886
  _context.next = 10;
41887
- return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-4b5094a1.js', document.baseURI).href))), 'utf-8');
41887
+ return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-9822d519.js', document.baseURI).href))), 'utf-8');
41888
41888
  case 10:
41889
41889
  _context.t1 = _context.sent;
41890
41890
  pkg = _context.t0.parse.call(_context.t0, _context.t1);
@@ -42001,6 +42001,8 @@ function handleAxiosResponse(res) {
42001
42001
  if (res.status === 200) {
42002
42002
  return res.data;
42003
42003
  } else {
42004
+ // @TODO remove log
42005
+ console.error('Macro Failed To Run', res.status, res.statusText, res.data);
42004
42006
  throw new Error("".concat(res.status, " ").concat(res.statusText));
42005
42007
  }
42006
42008
  }
@@ -42061,7 +42063,10 @@ function _did() {
42061
42063
  event: event
42062
42064
  }).then(handleAxiosResponse);
42063
42065
  case 8:
42064
- _yield$Scout9Api$did$ = _context2.sent;
42066
+ _yield$Scout9Api$did$ = _context2.sent["catch"](function (err) {
42067
+ console.error('Error in did macro', err);
42068
+ throw err;
42069
+ });
42065
42070
  value = _yield$Scout9Api$did$.value;
42066
42071
  return _context2.abrupt("return", value);
42067
42072
  case 11:
@@ -42101,7 +42106,10 @@ function _context() {
42101
42106
  event: event
42102
42107
  }).then(handleAxiosResponse);
42103
42108
  case 8:
42104
- _yield$Scout9Api$capt = _context3.sent;
42109
+ _yield$Scout9Api$capt = _context3.sent["catch"](function (err) {
42110
+ console.error('Error in context macro', err);
42111
+ throw err;
42112
+ });
42105
42113
  value = _yield$Scout9Api$capt.value;
42106
42114
  return _context3.abrupt("return", value);
42107
42115
  case 11:
@@ -43107,7 +43115,7 @@ var ProjectFiles = /*#__PURE__*/function () {
43107
43115
  return ProjectFiles;
43108
43116
  }();
43109
43117
 
43110
- var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-4b5094a1.js', document.baseURI).href)));
43118
+ var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-9822d519.js', document.baseURI).href)));
43111
43119
  var __dirname$1 = path__default["default"].dirname(__filename$1);
43112
43120
  function zipDirectory(source, out) {
43113
43121
  var archive = archiver$1('tar', {
@@ -43322,7 +43330,7 @@ function _buildApp() {
43322
43330
  case 11:
43323
43331
  _context4.t0 = JSON;
43324
43332
  _context4.next = 14;
43325
- return fs__default["default"].readFile(new URL(templatePackagePath, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-4b5094a1.js', document.baseURI).href))), 'utf-8');
43333
+ return fs__default["default"].readFile(new URL(templatePackagePath, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-9822d519.js', document.baseURI).href))), 'utf-8');
43326
43334
  case 14:
43327
43335
  _context4.t1 = _context4.sent;
43328
43336
  packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require("./index-4b5094a1.cjs");
5
+ var index = require("./index-9822d519.cjs");
6
6
  var dev = require("./dev-0876e8d1.cjs");
7
7
  require("./spirits-5c9243a1.cjs");
8
8
  require("./macros-e4105c56.cjs");
@@ -2,7 +2,7 @@
2
2
 
3
3
  require('node:fs');
4
4
  require('node:path');
5
- var index = require("./index-4b5094a1.cjs");
5
+ var index = require("./index-9822d519.cjs");
6
6
  require("./spirits-5c9243a1.cjs");
7
7
  require("./dev-0876e8d1.cjs");
8
8
  require('util');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scout9/app",
3
- "version": "1.0.0-alpha.0.3.8",
3
+ "version": "1.0.0-alpha.0.4.0",
4
4
  "description": "Build and deploy your Scout9 app for SMS auto replies",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -86,9 +86,9 @@ const handleError = (e, res = undefined, tag = undefined, body = undefined) => {
86
86
  let name = e?.name || 'Runtime Error';
87
87
  let message = e?.message || 'Unknown error';
88
88
  let code = typeof e?.code === 'number'
89
- ? e?.code
89
+ ? e.code
90
90
  : typeof e?.status === 'number'
91
- ? e?.status
91
+ ? e.status
92
92
  : 500;
93
93
  if ('response' in e) {
94
94
  const response = e.response;
@@ -105,7 +105,7 @@ const handleError = (e, res = undefined, tag = undefined, body = undefined) => {
105
105
  }
106
106
  }
107
107
  if (body) {
108
- console.log(colors.grey(JSON.stringify(body, null, 2)));
108
+ console.log(colors.grey(JSON.stringify(body, null, dev ? 2 : undefined)));
109
109
  }
110
110
  if (tag && typeof tag === 'string') {
111
111
  message = `${tag}: ${message}`;
@@ -118,7 +118,7 @@ const handleError = (e, res = undefined, tag = undefined, body = undefined) => {
118
118
  console.log('STACK:', colors.grey(e.stack));
119
119
  }
120
120
  if (body) {
121
- console.log('INPUT:', colors.grey(JSON.stringify(body, null, 2)));
121
+ console.log('INPUT:', colors.grey(JSON.stringify(body, null, dev ? 2 : undefined)));
122
122
  }
123
123
  if (res) {
124
124
  res.writeHead(code, {'Content-Type': 'application/json'});
@@ -142,7 +142,7 @@ const handleZodError = ({error, res = undefined, code = 500, status, name, bodyL
142
142
  console.log(colors.red(`${colors.bold(`${name}`)}:`));
143
143
  if (body) {
144
144
  console.log(colors.grey(`${bodyLabel}:`));
145
- console.log(colors.grey(JSON.stringify(body, null, 2)));
145
+ console.log(colors.grey(JSON.stringify(body, null, dev ? 2 : undefined)));
146
146
  }
147
147
  console.log(colors.red(`${action}${formattedError}`));
148
148
  } else {
@@ -9,6 +9,8 @@ function handleAxiosResponse(res) {
9
9
  if (res.status === 200) {
10
10
  return res.data;
11
11
  } else {
12
+ // @TODO remove log
13
+ console.error('Macro Failed To Run', res.status, res.statusText, res.data);
12
14
  throw new Error(`${res.status} ${res.statusText}`)
13
15
  }
14
16
  }
@@ -31,7 +33,11 @@ export async function did(prompt) {
31
33
  convoId,
32
34
  event
33
35
  })
34
- .then(handleAxiosResponse));
36
+ .then(handleAxiosResponse))
37
+ .catch((err) => {
38
+ console.error('Error in did macro', err);
39
+ throw err;
40
+ });
35
41
  return value;
36
42
  }
37
43
 
@@ -71,6 +77,10 @@ export async function context(prompt, examples) {
71
77
  convoId,
72
78
  event,
73
79
  })
74
- .then(handleAxiosResponse));
80
+ .then(handleAxiosResponse))
81
+ .catch((err) => {
82
+ console.error('Error in context macro', err);
83
+ throw err;
84
+ });
75
85
  return value;
76
86
  }