@scout9/app 1.0.0-alpha.0.4.9 → 1.0.0-alpha.0.5.1

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.
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var spirits = require("./spirits-8225c9fd.cjs");
4
- var dev = require("./dev-51604173.cjs");
5
- var macros = require("./macros-c9b4654d.cjs");
3
+ var spirits = require("./spirits-2ab4d673.cjs");
4
+ var dev = require("./dev-65b97c9d.cjs");
5
+ var macros = require("./macros-2f21c706.cjs");
6
6
  var require$$0 = require('fs');
7
7
  var require$$2$1 = require('events');
8
8
  var require$$1 = require('path');
@@ -29483,7 +29483,7 @@ class Body {
29483
29483
  }
29484
29484
  const {
29485
29485
  toFormData
29486
- } = await Promise.resolve().then(function () { return require("./multipart-parser-24b2e9b9.cjs"); });
29486
+ } = await Promise.resolve().then(function () { return require("./multipart-parser-67e4f4d6.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-2aa6f869.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-8a17e150.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);
@@ -43164,7 +43164,7 @@ var ProjectFiles = /*#__PURE__*/function () {
43164
43164
  return ProjectFiles;
43165
43165
  }();
43166
43166
 
43167
- 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-2aa6f869.js', document.baseURI).href)));
43167
+ 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-8a17e150.js', document.baseURI).href)));
43168
43168
  var __dirname$1 = path__default["default"].dirname(__filename$1);
43169
43169
  function zipDirectory(source, out) {
43170
43170
  var archive = archiver$1('tar', {
@@ -43379,7 +43379,7 @@ function _buildApp() {
43379
43379
  case 11:
43380
43380
  _context4.t0 = JSON;
43381
43381
  _context4.next = 14;
43382
- 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-2aa6f869.js', document.baseURI).href))), 'utf-8');
43382
+ 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-8a17e150.js', document.baseURI).href))), 'utf-8');
43383
43383
  case 14:
43384
43384
  _context4.t1 = _context4.sent;
43385
43385
  packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
package/dist/index.cjs CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require("./index-2aa6f869.cjs");
6
- var dev = require("./dev-51604173.cjs");
7
- require("./spirits-8225c9fd.cjs");
8
- require("./macros-c9b4654d.cjs");
5
+ var index = require("./index-8a17e150.cjs");
6
+ var dev = require("./dev-65b97c9d.cjs");
7
+ require("./spirits-2ab4d673.cjs");
8
+ require("./macros-2f21c706.cjs");
9
9
  require('fs');
10
10
  require('events');
11
11
  require('path');
@@ -49,6 +49,7 @@ exports.does = index.does;
49
49
  exports.json = index.json;
50
50
  exports.run = index.run;
51
51
  exports.sendEvent = index.sendEvent;
52
+ exports.ProgressLogger = dev.ProgressLogger;
52
53
  exports.Scout9Test = dev.Scout9Test;
53
54
  exports.createMockAgent = dev.createMockAgent;
54
55
  exports.createMockConversation = dev.createMockConversation;
@@ -4275,6 +4275,11 @@ var WorkflowConfigurationSchema = z.object({
4275
4275
  entity: zId('Workflow Folder', z.string())
4276
4276
  });
4277
4277
  var WorkflowsConfigurationSchema = z.array(WorkflowConfigurationSchema);
4278
+ var CommandSchema = z.object({
4279
+ path: z.string(),
4280
+ entity: zId('Command ID', z.string())
4281
+ });
4282
+ var CommandsSchema = z.array(CommandSchema);
4278
4283
  var IntentWorkflowEventSchema = z.object({
4279
4284
  current: z.string().nullable(),
4280
4285
  flow: z.array(z.string()),
@@ -4545,6 +4550,8 @@ exports.AgentConfigurationSchema = AgentConfigurationSchema;
4545
4550
  exports.AgentSchema = AgentSchema;
4546
4551
  exports.AgentsConfigurationSchema = AgentsConfigurationSchema;
4547
4552
  exports.AgentsSchema = AgentsSchema;
4553
+ exports.CommandSchema = CommandSchema;
4554
+ exports.CommandsSchema = CommandsSchema;
4548
4555
  exports.ContextExampleSchema = ContextExampleSchema;
4549
4556
  exports.ContextExampleWithTrainingDataSchema = ContextExampleWithTrainingDataSchema;
4550
4557
  exports.ConversationAnticipateSchema = ConversationAnticipateSchema;
@@ -2,9 +2,9 @@
2
2
 
3
3
  require('node:fs');
4
4
  require('node:path');
5
- var index = require("./index-2aa6f869.cjs");
6
- require("./spirits-8225c9fd.cjs");
7
- require("./dev-51604173.cjs");
5
+ var index = require("./index-8a17e150.cjs");
6
+ require("./spirits-2ab4d673.cjs");
7
+ require("./dev-65b97c9d.cjs");
8
8
  require('util');
9
9
  require('stream');
10
10
  require('path');
@@ -25,7 +25,7 @@ require('node:stream');
25
25
  require('node:string_decoder');
26
26
  require('node:readline');
27
27
  require('node:process');
28
- require("./macros-c9b4654d.cjs");
28
+ require("./macros-2f21c706.cjs");
29
29
  require('node:os');
30
30
  require('fs/promises');
31
31
  require('constants');
package/dist/schemas.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var macros = require("./macros-c9b4654d.cjs");
5
+ var macros = require("./macros-2f21c706.cjs");
6
6
 
7
7
 
8
8
 
@@ -10,6 +10,8 @@ exports.AgentConfigurationSchema = macros.AgentConfigurationSchema;
10
10
  exports.AgentSchema = macros.AgentSchema;
11
11
  exports.AgentsConfigurationSchema = macros.AgentsConfigurationSchema;
12
12
  exports.AgentsSchema = macros.AgentsSchema;
13
+ exports.CommandSchema = macros.CommandSchema;
14
+ exports.CommandsSchema = macros.CommandsSchema;
13
15
  exports.ContextExampleSchema = macros.ContextExampleSchema;
14
16
  exports.ContextExampleWithTrainingDataSchema = macros.ContextExampleWithTrainingDataSchema;
15
17
  exports.ConversationAnticipateSchema = macros.ConversationAnticipateSchema;
@@ -596,6 +596,12 @@ function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
596
596
  throw new TypeError("attempted to " + action + " private static field before its declaration");
597
597
  }
598
598
  }
599
+ function _classPrivateMethodGet(receiver, privateSet, fn) {
600
+ if (!privateSet.has(receiver)) {
601
+ throw new TypeError("attempted to get private field on non-instance");
602
+ }
603
+ return fn;
604
+ }
599
605
  function _checkPrivateRedeclaration(obj, privateCollection) {
600
606
  if (privateCollection.has(obj)) {
601
607
  throw new TypeError("Cannot initialize the same private elements twice on an object");
@@ -605,6 +611,10 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) {
605
611
  _checkPrivateRedeclaration(obj, privateMap);
606
612
  privateMap.set(obj, value);
607
613
  }
614
+ function _classPrivateMethodInitSpec(obj, privateSet) {
615
+ _checkPrivateRedeclaration(obj, privateSet);
616
+ privateSet.add(obj);
617
+ }
608
618
 
609
619
  var _excluded = ["keywords"];
610
620
  /**
@@ -1348,6 +1358,8 @@ exports._classCallCheck = _classCallCheck;
1348
1358
  exports._classPrivateFieldGet = _classPrivateFieldGet;
1349
1359
  exports._classPrivateFieldInitSpec = _classPrivateFieldInitSpec;
1350
1360
  exports._classPrivateFieldSet = _classPrivateFieldSet;
1361
+ exports._classPrivateMethodGet = _classPrivateMethodGet;
1362
+ exports._classPrivateMethodInitSpec = _classPrivateMethodInitSpec;
1351
1363
  exports._classStaticPrivateFieldSpecGet = _classStaticPrivateFieldSpecGet;
1352
1364
  exports._createClass = _createClass;
1353
1365
  exports._createForOfIteratorHelper = _createForOfIteratorHelper;
package/dist/spirits.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var spirits = require("./spirits-8225c9fd.cjs");
5
+ var spirits = require("./spirits-2ab4d673.cjs");
6
6
 
7
7
 
8
8
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dev = require("./dev-51604173.cjs");
6
- require("./spirits-8225c9fd.cjs");
5
+ var dev = require("./dev-65b97c9d.cjs");
6
+ require("./spirits-2ab4d673.cjs");
7
7
  require('util');
8
8
  require('stream');
9
9
  require('path');
@@ -26,7 +26,7 @@ require('node:stream');
26
26
  require('node:string_decoder');
27
27
  require('node:readline');
28
28
  require('node:process');
29
- require("./macros-c9b4654d.cjs");
29
+ require("./macros-2f21c706.cjs");
30
30
  require('node:os');
31
31
  require('fs/promises');
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scout9/app",
3
- "version": "1.0.0-alpha.0.4.9",
3
+ "version": "1.0.0-alpha.0.5.1",
4
4
  "description": "Build and deploy your Scout9 app for SMS auto replies",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -85,8 +85,6 @@
85
85
  "zod-to-ts": "^1.2.0"
86
86
  },
87
87
  "dependencies": {
88
- "@scout9/admin": "^1.0.0-alpha.0.0.51",
89
- "@scout9/crm": "^1.0.0-alpha.0.0.4",
90
88
  "archiver": "^6.0.1",
91
89
  "body-parser": "^1.20.2",
92
90
  "compression": "^1.7.4",
@@ -105,6 +103,9 @@
105
103
  "zod": "^3.22.4",
106
104
  "zod-validation-error": "^3.4.0"
107
105
  },
106
+ "peerDependencies": {
107
+ "@scout9/admin": ">= 1.0.0-alpha.0.0.51"
108
+ },
108
109
  "engines": {
109
110
  "node": ">=18.13"
110
111
  }
@@ -0,0 +1,41 @@
1
+ import { globSync } from 'glob';
2
+ import { CommandsSchema } from '../../runtime/index.js';
3
+ import { basename, dirname } from 'node:path';
4
+
5
+
6
+ /**
7
+ * @returns {Promise<CommandConfiguration[]>}
8
+ */
9
+ export default async function loadCommandsConfig(
10
+ {
11
+ cwd = process.cwd(),
12
+ src = 'src',
13
+ cb = (message) => {}
14
+ } = {}
15
+ ) {
16
+ // const config = globSync(path.resolve(cwd, `${src}/workflows/**/workflow.{ts,js}`), {cwd, absolute: true})
17
+ const config = globSync(`${src}/commands/**/{index,command,*.command}.{ts,js}`, {cwd, absolute: false})
18
+ .map((path) => {
19
+
20
+ const dir = dirname(path);
21
+ let entity = basename(path).replace(/\..*$/, ''); // Removes any "."'s
22
+ if (!entity) {
23
+ throw new Error(`Invalid command path "${path}"`)
24
+ }
25
+ switch (entity) {
26
+ case "index":
27
+ case "command":
28
+ entity = basename(dir);
29
+ break;
30
+ }
31
+ return {
32
+ entity,
33
+ path: path.split(src + '/commands/')[1],
34
+ }
35
+ });
36
+
37
+ // Validate the config
38
+ CommandsSchema.parse(config);
39
+
40
+ return config;
41
+ }
@@ -7,6 +7,7 @@ import loadProjectConfig from './project.js';
7
7
  import loadWorkflowsConfig from './workflow.js';
8
8
  import { Scout9ProjectBuildConfigSchema } from '../../runtime/index.js';
9
9
  import { ProgressLogger } from '../../utils/index.js';
10
+ import loadCommandsConfig from './commands.js';
10
11
 
11
12
 
12
13
  export function loadEnvConfig({
@@ -47,6 +48,7 @@ export async function loadConfig({
47
48
  const entitiesConfig = await loadEntitiesConfig({cwd, src, logger, cb, deploying});
48
49
  const agentsConfig = await loadAgentConfig({cwd, src, logger, cb, deploying, dest});
49
50
  const workflowsConfig = await loadWorkflowsConfig({cwd, src, logger, deploying, cb});
51
+ const commandsConfig = await loadCommandsConfig({cwd, src, logger, deploying, cb});
50
52
 
51
53
  /**
52
54
  * @type {Scout9ProjectBuildConfig}
@@ -55,7 +57,8 @@ export async function loadConfig({
55
57
  ...baseProjectConfig,
56
58
  entities: entitiesConfig,
57
59
  agents: agentsConfig,
58
- workflows: workflowsConfig
60
+ workflows: workflowsConfig,
61
+ commands: commandsConfig
59
62
  };
60
63
 
61
64
  // Validate the config