@scout9/app 1.0.0-alpha.0.1.95 → 1.0.0-alpha.0.1.96

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scout9/app",
3
- "version": "1.0.0-alpha.0.1.95",
3
+ "version": "1.0.0-alpha.0.1.96",
4
4
  "description": "Build and deploy your Scout9 app for SMS auto replies",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -5,7 +5,7 @@ import bodyParser from 'body-parser';
5
5
  import colors from 'kleur';
6
6
  import { config as dotenv } from 'dotenv';
7
7
  import { Configuration, Scout9Api } from '@scout9/admin';
8
- import { EventResponse } from '@scout9/app';
8
+ import { EventResponse, WorkflowEventSchema } from '@scout9/app';
9
9
  import path from 'node:path';
10
10
  import fs from 'node:fs';
11
11
  import https from 'node:https';
@@ -162,8 +162,12 @@ if (dev) {
162
162
  // Root application POST endpoint will run the scout9 app
163
163
  app.post(dev ? '/dev/workflow' : '/', async (req, res) => {
164
164
  try {
165
- // @TODO use zod to check if req.body is a valid event object
166
- const response = await projectApp(req.body);
165
+ const event = WorkflowEventSchema.parse(req.body.event);
166
+ globalThis.SCOUT9 = {
167
+ ...event,
168
+ $convo: req.body.$convo,
169
+ }
170
+ const response = await projectApp(event);
167
171
  res.writeHead(200, {'Content-Type': 'application/json'});
168
172
  res.end(JSON.stringify(response));
169
173
  } catch (e) {