@scout9/app 1.0.0-alpha.0.6.6 → 1.0.0-alpha.0.6.8

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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var spirits = require("./spirits-9719ae4f.cjs");
3
+ var spirits = require("./spirits-54ee2389.cjs");
4
4
  var require$$0$4 = require('util');
5
5
  var require$$0$3 = require('stream');
6
6
  var require$$1 = require('path');
@@ -21,7 +21,7 @@ var node_url = require('node:url');
21
21
  var node_events = require('node:events');
22
22
  var Stream = require('node:stream');
23
23
  var node_string_decoder = require('node:string_decoder');
24
- var macros = require("./macros-1a4fd407.cjs");
24
+ var macros = require("./macros-85a033b9.cjs");
25
25
  var readline = require('node:readline');
26
26
  var process$2 = require('node:process');
27
27
  var node_os = require('node:os');
@@ -35241,7 +35241,7 @@ function _loadUserPackageJson() {
35241
35241
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
35242
35242
  _context2.t0 = JSON;
35243
35243
  _context2.next = 10;
35244
- 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('dev-df88036b.js', document.baseURI).href))), 'utf-8');
35244
+ 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('dev-7570f439.js', document.baseURI).href))), 'utf-8');
35245
35245
  case 10:
35246
35246
  _context2.t1 = _context2.sent;
35247
35247
  pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var spirits = require("./spirits-9719ae4f.cjs");
4
- var dev = require("./dev-df88036b.cjs");
5
- var macros = require("./macros-1a4fd407.cjs");
3
+ var spirits = require("./spirits-54ee2389.cjs");
4
+ var dev = require("./dev-7570f439.cjs");
5
+ var macros = require("./macros-85a033b9.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-17ab0a54.cjs"); });
29486
+ } = await Promise.resolve().then(function () { return require("./multipart-parser-a071f5a9.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-33d77bc4.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-fe1b9d3a.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);
@@ -43176,7 +43176,7 @@ var ProjectFiles = /*#__PURE__*/function () {
43176
43176
  return ProjectFiles;
43177
43177
  }();
43178
43178
 
43179
- 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-33d77bc4.js', document.baseURI).href)));
43179
+ 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-fe1b9d3a.js', document.baseURI).href)));
43180
43180
  var __dirname$1 = path__default["default"].dirname(__filename$1);
43181
43181
  function zipDirectory(source, out) {
43182
43182
  var archive = archiver$1('tar', {
@@ -43391,7 +43391,7 @@ function _buildApp() {
43391
43391
  case 11:
43392
43392
  _context4.t0 = JSON;
43393
43393
  _context4.next = 14;
43394
- 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-33d77bc4.js', document.baseURI).href))), 'utf-8');
43394
+ 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-fe1b9d3a.js', document.baseURI).href))), 'utf-8');
43395
43395
  case 14:
43396
43396
  _context4.t1 = _context4.sent;
43397
43397
  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-33d77bc4.cjs");
6
- var dev = require("./dev-df88036b.cjs");
7
- require("./spirits-9719ae4f.cjs");
8
- require("./macros-1a4fd407.cjs");
5
+ var index = require("./index-fe1b9d3a.cjs");
6
+ var dev = require("./dev-7570f439.cjs");
7
+ require("./spirits-54ee2389.cjs");
8
+ require("./macros-85a033b9.cjs");
9
9
  require('fs');
10
10
  require('events');
11
11
  require('path');
@@ -4336,6 +4336,12 @@ var WorkflowEventSchema = z.object({
4336
4336
  description: 'Any developer notes to provide'
4337
4337
  }).optional()
4338
4338
  });
4339
+ var DirectMessageSchema = MessageSchema.partial().omit({
4340
+ id: true,
4341
+ entities: true,
4342
+ time: true,
4343
+ role: true
4344
+ });
4339
4345
 
4340
4346
  /**
4341
4347
  * The workflow response object slot
@@ -4347,16 +4353,27 @@ var WorkflowResponseSlotBaseSchema = z.object({
4347
4353
  }).optional(),
4348
4354
  instructions: InstructionSchema.optional(),
4349
4355
  removeInstructions: z.array(z.string()).optional(),
4350
- message: z.union([z.string(), z.object({
4351
- content: z.string(),
4352
- transform: z["boolean"]().optional()
4353
- })]).optional(),
4356
+ message: z.union([z.string(), DirectMessageSchema]).optional(),
4354
4357
  secondsDelay: z.number().optional(),
4355
4358
  scheduled: z.number().optional(),
4356
4359
  contextUpsert: ConversationContext.optional(),
4357
4360
  resetIntent: z["boolean"]().optional(),
4358
4361
  followup: FollowupSchema.optional()
4359
4362
  });
4363
+ var deleteSchema = z.object({
4364
+ entityType: z.string(),
4365
+ entityRecordId: z.string(),
4366
+ method: z.literal('delete')
4367
+ });
4368
+ var mutateSchema = z.object({
4369
+ entityType: z.string(),
4370
+ entityRecordId: z.string(),
4371
+ method: z.literal('mutate'),
4372
+ fields: z.record(z.union([z.string(), z.number(), z["boolean"](), z["null"](), z.literal('#remove'), z.literal('#delete')]))
4373
+ });
4374
+ var EntityContextUpsertSchema = z.discriminatedUnion('method', [deleteSchema, mutateSchema], {
4375
+ description: 'Metadata to provide a atomic transaction on a entity context record\n * @ingress auto/manual only'
4376
+ });
4360
4377
 
4361
4378
  /**
4362
4379
  * The workflow response object slot
@@ -4364,13 +4381,14 @@ var WorkflowResponseSlotBaseSchema = z.object({
4364
4381
  var WorkflowResponseSlotSchema = WorkflowResponseSlotBaseSchema.extend({
4365
4382
  anticipate: z.union([z.object({
4366
4383
  did: z.string({
4367
- definition: 'The prompt to check if true or false'
4384
+ description: 'The prompt to check if true or false'
4368
4385
  }),
4369
4386
  yes: WorkflowResponseSlotBaseSchema,
4370
4387
  no: WorkflowResponseSlotBaseSchema
4371
4388
  }), z.array(WorkflowResponseSlotBaseSchema.extend({
4372
4389
  keywords: z.array(z.string()).min(1).max(20)
4373
- }))]).optional()
4390
+ }))]).optional(),
4391
+ entityContextUpsert: z.array(EntityContextUpsertSchema).optional()
4374
4392
  });
4375
4393
 
4376
4394
  /**
@@ -4594,10 +4612,12 @@ exports.ConversationContext = ConversationContext;
4594
4612
  exports.ConversationSchema = ConversationSchema;
4595
4613
  exports.CustomerSchema = CustomerSchema;
4596
4614
  exports.CustomerValueSchema = CustomerValueSchema;
4615
+ exports.DirectMessageSchema = DirectMessageSchema;
4597
4616
  exports.EntitiesRootConfigurationSchema = EntitiesRootConfigurationSchema;
4598
4617
  exports.EntitiesRootProjectConfigurationSchema = EntitiesRootProjectConfigurationSchema;
4599
4618
  exports.EntityApiConfigurationSchema = EntityApiConfigurationSchema;
4600
4619
  exports.EntityConfigurationSchema = EntityConfigurationSchema;
4620
+ exports.EntityContextUpsertSchema = EntityContextUpsertSchema;
4601
4621
  exports.EntityRootProjectConfigurationSchema = EntityRootProjectConfigurationSchema;
4602
4622
  exports.FollowupBaseSchema = FollowupBaseSchema;
4603
4623
  exports.FollowupSchema = FollowupSchema;
@@ -2,9 +2,9 @@
2
2
 
3
3
  require('node:fs');
4
4
  require('node:path');
5
- var index = require("./index-33d77bc4.cjs");
6
- require("./spirits-9719ae4f.cjs");
7
- require("./dev-df88036b.cjs");
5
+ var index = require("./index-fe1b9d3a.cjs");
6
+ require("./spirits-54ee2389.cjs");
7
+ require("./dev-7570f439.cjs");
8
8
  require('util');
9
9
  require('stream');
10
10
  require('path');
@@ -23,7 +23,7 @@ require('node:url');
23
23
  require('node:events');
24
24
  require('node:stream');
25
25
  require('node:string_decoder');
26
- require("./macros-1a4fd407.cjs");
26
+ require("./macros-85a033b9.cjs");
27
27
  require('node:readline');
28
28
  require('node:process');
29
29
  require('node:os');
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-1a4fd407.cjs");
5
+ var macros = require("./macros-85a033b9.cjs");
6
6
 
7
7
 
8
8
 
@@ -19,10 +19,12 @@ exports.ConversationContext = macros.ConversationContext;
19
19
  exports.ConversationSchema = macros.ConversationSchema;
20
20
  exports.CustomerSchema = macros.CustomerSchema;
21
21
  exports.CustomerValueSchema = macros.CustomerValueSchema;
22
+ exports.DirectMessageSchema = macros.DirectMessageSchema;
22
23
  exports.EntitiesRootConfigurationSchema = macros.EntitiesRootConfigurationSchema;
23
24
  exports.EntitiesRootProjectConfigurationSchema = macros.EntitiesRootProjectConfigurationSchema;
24
25
  exports.EntityApiConfigurationSchema = macros.EntityApiConfigurationSchema;
25
26
  exports.EntityConfigurationSchema = macros.EntityConfigurationSchema;
27
+ exports.EntityContextUpsertSchema = macros.EntityContextUpsertSchema;
26
28
  exports.EntityRootProjectConfigurationSchema = macros.EntityRootProjectConfigurationSchema;
27
29
  exports.FollowupBaseSchema = macros.FollowupBaseSchema;
28
30
  exports.FollowupSchema = macros.FollowupSchema;
@@ -725,7 +725,10 @@ var _excluded = ["keywords"];
725
725
 
726
726
  /**
727
727
  * @typedef {Object} ConversationEvent
728
- * @property {Change<import('@scout9/app').Conversation> & {forwardNote?: string; forward?: import('@scout9/app').WorkflowResponseSlot['forward']}} conversation
728
+ * @property {(Change<import('@scout9/app').Conversation> & {
729
+ * forwardNote?: string;
730
+ * forward?: import('@scout9/app').WorkflowResponseSlot['forward'];
731
+ * })} conversation
729
732
  * @property {Change<Array<import('@scout9/app').Message>>} messages
730
733
  * @property {Change<any>} context
731
734
  * @property {Change<import('@scout9/app').Message>} message
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-9719ae4f.cjs");
5
+ var spirits = require("./spirits-54ee2389.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-df88036b.cjs");
6
- require("./spirits-9719ae4f.cjs");
5
+ var dev = require("./dev-7570f439.cjs");
6
+ require("./spirits-54ee2389.cjs");
7
7
  require('util');
8
8
  require('stream');
9
9
  require('path');
@@ -24,7 +24,7 @@ require('node:url');
24
24
  require('node:events');
25
25
  require('node:stream');
26
26
  require('node:string_decoder');
27
- require("./macros-1a4fd407.cjs");
27
+ require("./macros-85a033b9.cjs");
28
28
  require('node:readline');
29
29
  require('node:process');
30
30
  require('node:os');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scout9/app",
3
- "version": "1.0.0-alpha.0.6.6",
3
+ "version": "1.0.0-alpha.0.6.8",
4
4
  "description": "Build and deploy your Scout9 app for SMS auto replies",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/public.d.ts CHANGED
@@ -560,6 +560,10 @@ export type IntentWorkflowEvent = {
560
560
  initial: string | null;
561
561
  };
562
562
 
563
+ /**
564
+ * metadata relationship for the <entity-context>/<entity> element in transcripts and instructions
565
+ * @ingress auto/manual
566
+ */
563
567
  export type EntityToken = {
564
568
  start: number;
565
569
  end: number;
@@ -568,6 +572,38 @@ export type EntityToken = {
568
572
  text?: string | null;
569
573
  }
570
574
 
575
+ /**
576
+ * metadata relationship for the <entity-api> element in transcripts and instructions
577
+ * @ingress auto/manual
578
+ */
579
+ export type EntityApi = {
580
+
581
+ /**
582
+ * REST URI to hit
583
+ */
584
+ uri: string;
585
+
586
+ /**
587
+ * Method to use to call the api, defaults to "POST"
588
+ */
589
+ method?: string;
590
+
591
+ /**
592
+ * Additional payload to include to the api
593
+ */
594
+ body?: ConversationContext;
595
+
596
+ /**
597
+ * Headers to apply to the call
598
+ */
599
+ headers?: Record<string, string>;
600
+
601
+ /**
602
+ * Separate URI to establish OAuth 2.0/JWT tokens
603
+ */
604
+ auth?: Omit<EntityApi, 'auth'>;
605
+ }
606
+
571
607
  export type Message = {
572
608
  /** Unique ID for the message */
573
609
  id: string;
@@ -740,7 +776,6 @@ export type WorkflowResponseSlot = WorkflowResponseSlotBase & {
740
776
  */
741
777
  anticipate?: Anticipate | undefined;
742
778
 
743
-
744
779
  /**
745
780
  * If provided, it will propagate entity context to your Scout9 entity context store
746
781
  * @ingress auto/manual only
@@ -143,6 +143,8 @@ export const WorkflowEventSchema = z.object({
143
143
  note: z.string({description: 'Any developer notes to provide'}).optional()
144
144
  });
145
145
 
146
+ export const DirectMessageSchema = MessageSchema.partial().omit({id: true, entities: true, time: true, role: true})
147
+
146
148
  /**
147
149
  * The workflow response object slot
148
150
  */
@@ -152,10 +154,7 @@ export const WorkflowResponseSlotBaseSchema = z.object({
152
154
  .optional(),
153
155
  instructions: InstructionSchema.optional(),
154
156
  removeInstructions: z.array(z.string()).optional(),
155
- message: z.union([z.string(), z.object({
156
- content: z.string(),
157
- transform: z.boolean().optional()
158
- })]).optional(),
157
+ message: z.union([z.string(), DirectMessageSchema]).optional(),
159
158
  secondsDelay: z.number().optional(),
160
159
  scheduled: z.number().optional(),
161
160
  contextUpsert: ConversationContext.optional(),
@@ -163,20 +162,50 @@ export const WorkflowResponseSlotBaseSchema = z.object({
163
162
  followup: FollowupSchema.optional()
164
163
  });
165
164
 
165
+
166
+ const deleteSchema = z.object({
167
+ entityType: z.string(),
168
+ entityRecordId: z.string(),
169
+ method: z.literal('delete')
170
+ });
171
+
172
+ const mutateSchema = z.object({
173
+ entityType: z.string(),
174
+ entityRecordId: z.string(),
175
+ method: z.literal('mutate'),
176
+ fields: z.record(
177
+ z.union([
178
+ z.string(),
179
+ z.number(),
180
+ z.boolean(),
181
+ z.null(),
182
+ z.literal('#remove'),
183
+ z.literal('#delete')
184
+ ])
185
+ )
186
+ });
187
+
188
+ export const EntityContextUpsertSchema = z.discriminatedUnion('method', [
189
+ deleteSchema,
190
+ mutateSchema
191
+ ], {description: 'Metadata to provide a atomic transaction on a entity context record\n * @ingress auto/manual only'});
192
+
166
193
  /**
167
194
  * The workflow response object slot
168
195
  */
169
196
  export const WorkflowResponseSlotSchema = WorkflowResponseSlotBaseSchema.extend({
170
197
  anticipate: z.union([
171
198
  z.object({
172
- did: z.string({definition: 'The prompt to check if true or false'}),
199
+ did: z.string({description: 'The prompt to check if true or false'}),
173
200
  yes: WorkflowResponseSlotBaseSchema,
174
201
  no: WorkflowResponseSlotBaseSchema
175
202
  }),
176
203
  z.array(WorkflowResponseSlotBaseSchema.extend({
177
204
  keywords: z.array(z.string()).min(1).max(20)
178
205
  }))
179
- ]).optional()
206
+ ]).optional(),
207
+
208
+ entityContextUpsert: z.array(EntityContextUpsertSchema).optional()
180
209
  });
181
210
 
182
211
  /**
@@ -104,9 +104,13 @@
104
104
  * @property {StatusCallback | undefined} [progress]
105
105
  */
106
106
 
107
+
107
108
  /**
108
109
  * @typedef {Object} ConversationEvent
109
- * @property {Change<import('@scout9/app').Conversation> & {forwardNote?: string; forward?: import('@scout9/app').WorkflowResponseSlot['forward']}} conversation
110
+ * @property {(Change<import('@scout9/app').Conversation> & {
111
+ * forwardNote?: string;
112
+ * forward?: import('@scout9/app').WorkflowResponseSlot['forward'];
113
+ * })} conversation
110
114
  * @property {Change<Array<import('@scout9/app').Message>>} messages
111
115
  * @property {Change<any>} context
112
116
  * @property {Change<import('@scout9/app').Message>} message