@scout9/app 1.0.0-alpha.0.1.86 → 1.0.0-alpha.0.1.87
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/dist/{exports-291eb22e.cjs → exports-85e8c05c.cjs} +389 -234
- package/dist/index.cjs +11 -2
- package/dist/{multipart-parser-caa634a9.cjs → multipart-parser-1f8d78d0.cjs} +1 -1
- package/dist/testing-tools.cjs +1 -1
- package/package.json +1 -1
- package/src/core/index.js +15 -35
- package/src/exports.js +11 -7
- package/src/platform.js +213 -211
- package/src/public.d.ts +43 -80
- package/src/runtime/client/api.js +51 -159
- package/src/runtime/client/config.js +43 -7
- package/src/runtime/client/entity.js +19 -5
- package/src/runtime/client/index.js +2 -1
- package/src/runtime/client/message.js +12 -3
- package/src/runtime/client/platform.js +86 -0
- package/src/runtime/client/{agent.js → users.js} +25 -4
- package/src/runtime/client/utils.js +3 -2
- package/src/runtime/client/workflow.js +73 -5
- package/types/index.d.ts +2923 -1261
- package/types/index.d.ts.map +53 -20
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var exports$1 = require("./exports-
|
|
5
|
+
var exports$1 = require("./exports-85e8c05c.cjs");
|
|
6
6
|
var spirits = require("./spirits-643c422a.cjs");
|
|
7
7
|
require('node:readline');
|
|
8
8
|
require('fs');
|
|
@@ -47,20 +47,22 @@ exports.InstructionSchema = exports$1.InstructionSchema;
|
|
|
47
47
|
exports.IntentWorkflowEventSchema = exports$1.IntentWorkflowEventSchema;
|
|
48
48
|
exports.MessageSchema = exports$1.MessageSchema;
|
|
49
49
|
exports.Scout9ProjectBuildConfigSchema = exports$1.Scout9ProjectBuildConfigSchema;
|
|
50
|
+
exports.Scout9ProjectConfigSchema = exports$1.Scout9ProjectConfigSchema;
|
|
50
51
|
exports.Scout9Test = exports$1.Scout9Test;
|
|
51
52
|
exports.WorkflowConfigurationSchema = exports$1.WorkflowConfigurationSchema;
|
|
52
53
|
exports.WorkflowEventSchema = exports$1.WorkflowEventSchema;
|
|
54
|
+
exports.WorkflowFunctionSchema = exports$1.WorkflowFunctionSchema;
|
|
53
55
|
exports.WorkflowResponseMessage = exports$1.WorkflowResponseMessage;
|
|
54
56
|
exports.WorkflowResponseMessageApiRequest = exports$1.WorkflowResponseMessageApiRequest;
|
|
55
57
|
exports.WorkflowResponseMessageApiResponse = exports$1.WorkflowResponseMessageApiResponse;
|
|
56
58
|
exports.WorkflowResponseSchema = exports$1.WorkflowResponseSchema;
|
|
57
59
|
exports.WorkflowResponseSlotSchema = exports$1.WorkflowResponseSlotSchema;
|
|
58
60
|
exports.WorkflowsConfigurationSchema = exports$1.WorkflowsConfigurationSchema;
|
|
59
|
-
exports._entityApiConfigurationSchema = exports$1._entityApiConfigurationSchema;
|
|
60
61
|
exports.agentBaseConfigurationSchema = exports$1.agentBaseConfigurationSchema;
|
|
61
62
|
exports.agentConfigurationSchema = exports$1.agentConfigurationSchema;
|
|
62
63
|
exports.agentsBaseConfigurationSchema = exports$1.agentsBaseConfigurationSchema;
|
|
63
64
|
exports.agentsConfigurationSchema = exports$1.agentsConfigurationSchema;
|
|
65
|
+
exports.apiFunctionSchema = exports$1.apiFunctionSchema;
|
|
64
66
|
exports.createMockAgent = exports$1.createMockAgent;
|
|
65
67
|
exports.createMockConversation = exports$1.createMockConversation;
|
|
66
68
|
exports.createMockCustomer = exports$1.createMockCustomer;
|
|
@@ -68,12 +70,19 @@ exports.createMockMessage = exports$1.createMockMessage;
|
|
|
68
70
|
exports.createMockWorkflowEvent = exports$1.createMockWorkflowEvent;
|
|
69
71
|
exports.customerSchema = exports$1.customerSchema;
|
|
70
72
|
exports.customerValueSchema = exports$1.customerValueSchema;
|
|
73
|
+
exports.deleteApiFunctionSchema = exports$1.deleteApiFunctionSchema;
|
|
71
74
|
exports.entitiesRootConfigurationSchema = exports$1.entitiesRootConfigurationSchema;
|
|
72
75
|
exports.entitiesRootProjectConfigurationSchema = exports$1.entitiesRootProjectConfigurationSchema;
|
|
73
76
|
exports.entityApiConfigurationSchema = exports$1.entityApiConfigurationSchema;
|
|
74
77
|
exports.entityConfigurationSchema = exports$1.entityConfigurationSchema;
|
|
75
78
|
exports.entityRootProjectConfigurationSchema = exports$1.entityRootProjectConfigurationSchema;
|
|
79
|
+
exports.eventResponseSchema = exports$1.eventResponseSchema;
|
|
80
|
+
exports.getApiFunctionSchema = exports$1.getApiFunctionSchema;
|
|
76
81
|
exports.json = exports$1.json;
|
|
82
|
+
exports.patchApiFunctionSchema = exports$1.patchApiFunctionSchema;
|
|
83
|
+
exports.postApiFunctionSchema = exports$1.postApiFunctionSchema;
|
|
84
|
+
exports.putApiFunctionSchema = exports$1.putApiFunctionSchema;
|
|
85
|
+
exports.queryApiFunctionSchema = exports$1.queryApiFunctionSchema;
|
|
77
86
|
exports.run = exports$1.run;
|
|
78
87
|
exports.sendEvent = exports$1.sendEvent;
|
|
79
88
|
exports.Spirits = spirits.Spirits;
|
package/dist/testing-tools.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var exports$1 = require("./exports-
|
|
5
|
+
var exports$1 = require("./exports-85e8c05c.cjs");
|
|
6
6
|
var spirits = require("./spirits-643c422a.cjs");
|
|
7
7
|
require('node:readline');
|
|
8
8
|
require('fs');
|
package/package.json
CHANGED
package/src/core/index.js
CHANGED
|
@@ -20,34 +20,6 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
20
20
|
const __dirname = path.dirname(__filename);
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* @returns {Promise<string>} - the output directory
|
|
25
|
-
*/
|
|
26
|
-
// async function runNpmRunBuild({cwd = process.cwd(), src = 'src'} = {}) {
|
|
27
|
-
// const pkg = JSON.parse(fss.readFileSync(new URL(`${cwd}/package.json`, import.meta.url), 'utf-8'));
|
|
28
|
-
// // Package.json must have a "build" script
|
|
29
|
-
// const buildScript = pkg.scripts?.build;
|
|
30
|
-
// if (!buildScript) {
|
|
31
|
-
// // If no build script then just return src
|
|
32
|
-
// return path.resolve(cwd, src);
|
|
33
|
-
// }
|
|
34
|
-
// // "build" script cannot contain "scout9 build" (otherwise we'll get stuck in a loop)
|
|
35
|
-
// if (buildScript.includes('scout9 build')) {
|
|
36
|
-
// throw new Error(`"build" script in ${cwd}/package.json cannot contain "scout9 build"`);
|
|
37
|
-
// }
|
|
38
|
-
//
|
|
39
|
-
// return new Promise((resolve, reject) => {
|
|
40
|
-
// exec('npm run build', {cwd}, (error, stdout, stderr) => {
|
|
41
|
-
// if (error) {
|
|
42
|
-
// return reject(error);
|
|
43
|
-
// }
|
|
44
|
-
// // @TODO don't assume build script created a "build" directory (use a config)
|
|
45
|
-
// return resolve(path.resolve(cwd, 'build'));
|
|
46
|
-
// });
|
|
47
|
-
// });
|
|
48
|
-
// }
|
|
49
|
-
|
|
50
|
-
|
|
51
23
|
function zipDirectory(source, out) {
|
|
52
24
|
const archive = archiver('tar', {
|
|
53
25
|
gzip: true,
|
|
@@ -126,7 +98,7 @@ async function downloadAndUnpackZip(outputDir) {
|
|
|
126
98
|
* @param {string} cwd
|
|
127
99
|
* @param {string} src
|
|
128
100
|
* @param {string} dest
|
|
129
|
-
* @param {
|
|
101
|
+
* @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
|
|
130
102
|
* @returns {Promise<void>}
|
|
131
103
|
*/
|
|
132
104
|
async function buildApp(cwd, src, dest, config) {
|
|
@@ -245,6 +217,13 @@ async function downloadDevApp(destination, version) {
|
|
|
245
217
|
|
|
246
218
|
}
|
|
247
219
|
|
|
220
|
+
/**
|
|
221
|
+
* @param {Object} [options]
|
|
222
|
+
* @param {string} [options.cwd]
|
|
223
|
+
* @param {string} [options.src]
|
|
224
|
+
* @param {boolean} [options.ignoreAppRequire]
|
|
225
|
+
* @returns {Promise<{app: *, fileName: string, exe: string, filePath: string}>}
|
|
226
|
+
*/
|
|
248
227
|
export async function getApp({cwd = process.cwd(), src = 'src', ignoreAppRequire = false} = {}) {
|
|
249
228
|
const indexTsPath = path.resolve(cwd, src, 'index.ts');
|
|
250
229
|
const indexJsPath = path.resolve(cwd, src, 'index.js');
|
|
@@ -313,10 +292,10 @@ export async function getAgentContacts() {
|
|
|
313
292
|
* Runs a given project container from scout9 to given environment
|
|
314
293
|
* Runs the project in a container
|
|
315
294
|
*
|
|
316
|
-
* @param {
|
|
295
|
+
* @param {import('../runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
317
296
|
* @param {Object} options
|
|
318
297
|
* @param {string} options.eventSource - the source path of the event
|
|
319
|
-
* @returns {Promise<
|
|
298
|
+
* @returns {Promise<import('../runtime/client/workflow.js').IWorkflowResponse>}
|
|
320
299
|
*/
|
|
321
300
|
export async function run(event, {eventSource} = {}) {
|
|
322
301
|
const result = WorkflowEventSchema.safeParse(event);
|
|
@@ -359,7 +338,7 @@ export async function runConfig() {
|
|
|
359
338
|
/**
|
|
360
339
|
* Builds a local project
|
|
361
340
|
* @param {{cwd: string; src: string; dest: string; logger: ProgressLogger; mode: string;}} - build options
|
|
362
|
-
* @param {
|
|
341
|
+
* @param {import('../runtime/client/').IScout9ProjectBuildConfig} config
|
|
363
342
|
* @returns {messages: string[]}
|
|
364
343
|
*/
|
|
365
344
|
export async function build({
|
|
@@ -408,6 +387,7 @@ export async function build({
|
|
|
408
387
|
* Deploys a local project to scout9
|
|
409
388
|
* @param {{cwd: string; src: string, dest: string}} - build options
|
|
410
389
|
* @param {Scout9ProjectBuildConfig} config
|
|
390
|
+
* @return {Promise<{deploy: Object, contacts: any}>}
|
|
411
391
|
*/
|
|
412
392
|
export async function deploy(
|
|
413
393
|
{cwd = process.cwd(), src = './src', dest = '/tmp/project', logger = new ProgressLogger()},
|
|
@@ -455,7 +435,7 @@ export async function deploy(
|
|
|
455
435
|
/**
|
|
456
436
|
* Tests a local project to scout9 by running a dummy parse command with the project's local entities
|
|
457
437
|
* @param {{cwd: string; src: string, dest: string}} - build options
|
|
458
|
-
* @param {
|
|
438
|
+
* @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
|
|
459
439
|
*/
|
|
460
440
|
export async function test(
|
|
461
441
|
{cwd = process.cwd(), src = './src', dest = '/tmp/project', logger = new ProgressLogger()},
|
|
@@ -487,8 +467,8 @@ export async function test(
|
|
|
487
467
|
/**
|
|
488
468
|
*
|
|
489
469
|
* @param {{cwd: string; src: string; projectFiles: ProjectFiles; logger: ProgressLogger}} options
|
|
490
|
-
* @param {
|
|
491
|
-
* @returns {Promise<{success: boolean; config:
|
|
470
|
+
* @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
|
|
471
|
+
* @returns {Promise<{success: boolean; config: import('../runtime/client/config.js').IScout9ProjectBuildConfig}>}
|
|
492
472
|
*/
|
|
493
473
|
export async function sync({
|
|
494
474
|
cwd = process.cwd(), src = 'src',
|
package/src/exports.js
CHANGED
|
@@ -2,30 +2,34 @@ import { Scout9Platform } from './platform.js';
|
|
|
2
2
|
import { EventResponse } from './runtime/index.js';
|
|
3
3
|
|
|
4
4
|
export { EventResponse } from './runtime/index.js';
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
export * from './testing-tools/index.js';
|
|
7
7
|
export * from './runtime/client/index.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
12
|
-
* @
|
|
10
|
+
* @param {import('./runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
11
|
+
* @param {Object} options
|
|
12
|
+
* @param {string} [options.cwd=process.cwd()] - the working directory
|
|
13
|
+
* @param {string} [options.mode='production'] - the build mode
|
|
14
|
+
* @param {string} [options.src='./src'] - the source directory
|
|
15
|
+
* @param {string} options.eventSource - the source of the workflow event
|
|
16
|
+
* @returns {Promise<import('./runtime/client/workflow.js').IWorkflowResponse>}
|
|
13
17
|
*/
|
|
14
18
|
export async function run(event, options) {
|
|
15
19
|
return Scout9Platform.run(event, options)
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
|
-
* @param {
|
|
23
|
+
* @param {import('./runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
20
24
|
* @param {{cwd: string; mode: 'development' | 'production'; src: string}} options - build options
|
|
21
|
-
* @returns {Promise<
|
|
25
|
+
* @returns {Promise<import('./runtime/client/workflow.js').IWorkflowResponse>}
|
|
22
26
|
*/
|
|
23
27
|
export const sendEvent = run;
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* @param data {T}
|
|
27
31
|
* @param init {ResponseInit | undefined}
|
|
28
|
-
* @returns {EventResponse<T>}
|
|
32
|
+
* @returns {import('./runtime/client/api.js').EventResponse<T>}
|
|
29
33
|
*/
|
|
30
34
|
export function json(data, init) {
|
|
31
35
|
if (data instanceof Promise) {
|