@flow-as-code/cli 0.1.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.
Files changed (120) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +446 -0
  3. package/dist/aws.d.ts +28 -0
  4. package/dist/aws.d.ts.map +1 -0
  5. package/dist/aws.js +104 -0
  6. package/dist/aws.js.map +1 -0
  7. package/dist/bin.d.ts +3 -0
  8. package/dist/bin.d.ts.map +1 -0
  9. package/dist/bin.js +132 -0
  10. package/dist/bin.js.map +1 -0
  11. package/dist/bridge/exportFiles.d.ts +16 -0
  12. package/dist/bridge/exportFiles.d.ts.map +1 -0
  13. package/dist/bridge/exportFiles.js +95 -0
  14. package/dist/bridge/exportFiles.js.map +1 -0
  15. package/dist/bridge/pair.d.ts +103 -0
  16. package/dist/bridge/pair.d.ts.map +1 -0
  17. package/dist/bridge/pair.js +219 -0
  18. package/dist/bridge/pair.js.map +1 -0
  19. package/dist/bridge/protocol.d.ts +187 -0
  20. package/dist/bridge/protocol.d.ts.map +1 -0
  21. package/dist/bridge/protocol.js +132 -0
  22. package/dist/bridge/protocol.js.map +1 -0
  23. package/dist/bridge/server.d.ts +95 -0
  24. package/dist/bridge/server.d.ts.map +1 -0
  25. package/dist/bridge/server.js +669 -0
  26. package/dist/bridge/server.js.map +1 -0
  27. package/dist/cdk-scaffold.d.ts +16 -0
  28. package/dist/cdk-scaffold.d.ts.map +1 -0
  29. package/dist/cdk-scaffold.js +28 -0
  30. package/dist/cdk-scaffold.js.map +1 -0
  31. package/dist/codegen.d.ts +5 -0
  32. package/dist/codegen.d.ts.map +1 -0
  33. package/dist/codegen.js +27 -0
  34. package/dist/codegen.js.map +1 -0
  35. package/dist/diff.d.ts +33 -0
  36. package/dist/diff.d.ts.map +1 -0
  37. package/dist/diff.js +225 -0
  38. package/dist/diff.js.map +1 -0
  39. package/dist/docs.d.ts +46 -0
  40. package/dist/docs.d.ts.map +1 -0
  41. package/dist/docs.js +223 -0
  42. package/dist/docs.js.map +1 -0
  43. package/dist/emit.d.ts +8 -0
  44. package/dist/emit.d.ts.map +1 -0
  45. package/dist/emit.js +55 -0
  46. package/dist/emit.js.map +1 -0
  47. package/dist/errors.d.ts +12 -0
  48. package/dist/errors.d.ts.map +1 -0
  49. package/dist/errors.js +25 -0
  50. package/dist/errors.js.map +1 -0
  51. package/dist/export.d.ts +27 -0
  52. package/dist/export.d.ts.map +1 -0
  53. package/dist/export.js +126 -0
  54. package/dist/export.js.map +1 -0
  55. package/dist/index.d.ts +4 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +23 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/lint.d.ts +6 -0
  60. package/dist/lint.d.ts.map +1 -0
  61. package/dist/lint.js +31 -0
  62. package/dist/lint.js.map +1 -0
  63. package/dist/render.d.ts +6 -0
  64. package/dist/render.d.ts.map +1 -0
  65. package/dist/render.js +49 -0
  66. package/dist/render.js.map +1 -0
  67. package/dist/run.d.ts +13 -0
  68. package/dist/run.d.ts.map +1 -0
  69. package/dist/run.js +38 -0
  70. package/dist/run.js.map +1 -0
  71. package/dist/simulate.d.ts +35 -0
  72. package/dist/simulate.d.ts.map +1 -0
  73. package/dist/simulate.js +194 -0
  74. package/dist/simulate.js.map +1 -0
  75. package/dist/studio.d.ts +23 -0
  76. package/dist/studio.d.ts.map +1 -0
  77. package/dist/studio.js +120 -0
  78. package/dist/studio.js.map +1 -0
  79. package/dist/synth-resolve-hook.d.ts +19 -0
  80. package/dist/synth-resolve-hook.d.ts.map +1 -0
  81. package/dist/synth-resolve-hook.js +127 -0
  82. package/dist/synth-resolve-hook.js.map +1 -0
  83. package/dist/synth-runner.d.ts +12 -0
  84. package/dist/synth-runner.d.ts.map +1 -0
  85. package/dist/synth-runner.js +145 -0
  86. package/dist/synth-runner.js.map +1 -0
  87. package/dist/synth.d.ts +55 -0
  88. package/dist/synth.d.ts.map +1 -0
  89. package/dist/synth.js +327 -0
  90. package/dist/synth.js.map +1 -0
  91. package/dist/watch.d.ts +66 -0
  92. package/dist/watch.d.ts.map +1 -0
  93. package/dist/watch.js +293 -0
  94. package/dist/watch.js.map +1 -0
  95. package/package.json +85 -0
  96. package/schema/flowdoc-0.1.schema.json +669 -0
  97. package/schema/scenario-0.1.schema.json +318 -0
  98. package/src/aws.ts +149 -0
  99. package/src/bin.ts +179 -0
  100. package/src/bridge/exportFiles.ts +116 -0
  101. package/src/bridge/pair.ts +312 -0
  102. package/src/bridge/protocol.ts +289 -0
  103. package/src/bridge/server.ts +827 -0
  104. package/src/cdk-scaffold.ts +41 -0
  105. package/src/codegen.ts +36 -0
  106. package/src/diff.ts +279 -0
  107. package/src/docs.ts +249 -0
  108. package/src/emit.ts +69 -0
  109. package/src/errors.ts +27 -0
  110. package/src/export.ts +167 -0
  111. package/src/index.ts +27 -0
  112. package/src/lint.ts +42 -0
  113. package/src/render.ts +58 -0
  114. package/src/run.ts +42 -0
  115. package/src/simulate.ts +244 -0
  116. package/src/studio.ts +143 -0
  117. package/src/synth-resolve-hook.ts +152 -0
  118. package/src/synth-runner.ts +157 -0
  119. package/src/synth.ts +380 -0
  120. package/src/watch.ts +388 -0
@@ -0,0 +1,669 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://flow-as-code.dev/schema/flowdoc-0.1.schema.json",
4
+ "title": "FlowDoc 0.1",
5
+ "description": "Interchange format for Amazon Connect flows. See docs/01-flowdoc-spec.md and conformance/flow-language/actions.md. This schema is part of the cross-language contract: the future Go provider validates against it.",
6
+ "type": "object",
7
+ "required": [
8
+ "flowdoc",
9
+ "kind",
10
+ "name",
11
+ "connectType",
12
+ "content"
13
+ ],
14
+ "additionalProperties": false,
15
+ "properties": {
16
+ "flowdoc": {
17
+ "const": "0.1"
18
+ },
19
+ "kind": {
20
+ "enum": [
21
+ "flow",
22
+ "module"
23
+ ]
24
+ },
25
+ "name": {
26
+ "type": "string",
27
+ "minLength": 1,
28
+ "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
29
+ },
30
+ "connectType": {
31
+ "enum": [
32
+ "CONTACT_FLOW",
33
+ "CUSTOMER_QUEUE",
34
+ "CUSTOMER_HOLD",
35
+ "CUSTOMER_WHISPER",
36
+ "AGENT_HOLD",
37
+ "AGENT_WHISPER",
38
+ "OUTBOUND_WHISPER",
39
+ "AGENT_TRANSFER",
40
+ "QUEUE_TRANSFER",
41
+ "MODULE"
42
+ ]
43
+ },
44
+ "content": {
45
+ "$ref": "#/$defs/flowContent"
46
+ },
47
+ "layout": {
48
+ "description": "Canvas positions keyed by Action Identifier. Projected into content.Metadata.ActionMetadata at materialization; never stored in content.",
49
+ "type": "object",
50
+ "additionalProperties": {
51
+ "$ref": "#/$defs/point"
52
+ }
53
+ },
54
+ "refs": {
55
+ "description": "Derived index of every token in content. Regenerated on save.",
56
+ "type": "array",
57
+ "items": {
58
+ "$ref": "#/$defs/ref"
59
+ }
60
+ },
61
+ "meta": {
62
+ "type": "object",
63
+ "properties": {
64
+ "generator": {
65
+ "type": "string"
66
+ },
67
+ "sourceHash": {
68
+ "type": "string",
69
+ "pattern": "^sha256:[0-9a-f]{64}$"
70
+ }
71
+ },
72
+ "additionalProperties": true
73
+ }
74
+ },
75
+ "$defs": {
76
+ "point": {
77
+ "type": "object",
78
+ "required": [
79
+ "x",
80
+ "y"
81
+ ],
82
+ "additionalProperties": false,
83
+ "properties": {
84
+ "x": {
85
+ "type": "number"
86
+ },
87
+ "y": {
88
+ "type": "number"
89
+ }
90
+ }
91
+ },
92
+ "token": {
93
+ "description": "A reference token. Occupies the entire field value; never interpolated into a longer string, because Connect requires these fields to be fully static or a single JSONPath identifier.",
94
+ "type": "string",
95
+ "pattern": "^\\$\\{cdref:(queue|hours|lambda|lex|prompt|flow|module):[a-z0-9]+(-[a-z0-9]+)*(@[a-z0-9]+(-[a-z0-9]+)*)?\\}$"
96
+ },
97
+ "ref": {
98
+ "type": "object",
99
+ "required": [
100
+ "token",
101
+ "type",
102
+ "name"
103
+ ],
104
+ "additionalProperties": false,
105
+ "properties": {
106
+ "token": {
107
+ "$ref": "#/$defs/token"
108
+ },
109
+ "type": {
110
+ "enum": [
111
+ "queue",
112
+ "hours",
113
+ "lambda",
114
+ "lex",
115
+ "prompt",
116
+ "flow",
117
+ "module"
118
+ ]
119
+ },
120
+ "name": {
121
+ "type": "string",
122
+ "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
123
+ },
124
+ "alias": {
125
+ "type": "string",
126
+ "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
127
+ }
128
+ }
129
+ },
130
+ "identifier": {
131
+ "description": "Unique within the flow, up to 50 chars. Connect forbids % : ( \\ / ) = $ , ; [ ] { } and a set of prototype-pollution names.",
132
+ "type": "string",
133
+ "minLength": 1,
134
+ "maxLength": 50,
135
+ "pattern": "^[^%:(\\\\/)=$,;\\[\\]{}]+$",
136
+ "not": {
137
+ "enum": [
138
+ "__proto__",
139
+ "constructor",
140
+ "__defineGetter__",
141
+ "__defineSetter__",
142
+ "toString",
143
+ "hasOwnProperty",
144
+ "isPrototypeOf",
145
+ "propertyIsEnumerable",
146
+ "toLocaleString",
147
+ "valueOf"
148
+ ]
149
+ }
150
+ },
151
+ "flowContent": {
152
+ "type": "object",
153
+ "required": [
154
+ "Version",
155
+ "StartAction",
156
+ "Actions"
157
+ ],
158
+ "additionalProperties": false,
159
+ "properties": {
160
+ "Version": {
161
+ "const": "2019-10-30"
162
+ },
163
+ "StartAction": {
164
+ "$ref": "#/$defs/identifier"
165
+ },
166
+ "Metadata": {
167
+ "description": "Not authored in FlowDoc. Materialization writes positions here from `layout`.",
168
+ "type": "object"
169
+ },
170
+ "Actions": {
171
+ "type": "array",
172
+ "minItems": 1,
173
+ "maxItems": 250,
174
+ "items": {
175
+ "$ref": "#/$defs/action"
176
+ }
177
+ },
178
+ "Settings": {
179
+ "type": "object",
180
+ "description": "Module configuration. Required (may be empty) in a module's content; absent in a flow's."
181
+ }
182
+ }
183
+ },
184
+ "action": {
185
+ "type": "object",
186
+ "required": [
187
+ "Identifier",
188
+ "Type",
189
+ "Parameters",
190
+ "Transitions"
191
+ ],
192
+ "additionalProperties": false,
193
+ "properties": {
194
+ "Identifier": {
195
+ "$ref": "#/$defs/identifier"
196
+ },
197
+ "Type": {
198
+ "type": "string",
199
+ "minLength": 1
200
+ },
201
+ "Parameters": {
202
+ "type": "object"
203
+ },
204
+ "Transitions": {
205
+ "$ref": "#/$defs/transitions"
206
+ }
207
+ },
208
+ "allOf": [
209
+ {
210
+ "if": {
211
+ "properties": {
212
+ "Type": {
213
+ "const": "UpdateContactTargetQueue"
214
+ }
215
+ },
216
+ "required": [
217
+ "Type"
218
+ ]
219
+ },
220
+ "then": {
221
+ "properties": {
222
+ "Parameters": {
223
+ "properties": {
224
+ "QueueId": {
225
+ "$ref": "#/$defs/refField"
226
+ },
227
+ "AgentId": {
228
+ "$ref": "#/$defs/refField"
229
+ }
230
+ }
231
+ }
232
+ }
233
+ }
234
+ },
235
+ {
236
+ "if": {
237
+ "properties": {
238
+ "Type": {
239
+ "const": "CheckHoursOfOperation"
240
+ }
241
+ },
242
+ "required": [
243
+ "Type"
244
+ ]
245
+ },
246
+ "then": {
247
+ "properties": {
248
+ "Parameters": {
249
+ "properties": {
250
+ "HoursOfOperationId": {
251
+ "$ref": "#/$defs/refField"
252
+ }
253
+ }
254
+ }
255
+ }
256
+ }
257
+ },
258
+ {
259
+ "if": {
260
+ "properties": {
261
+ "Type": {
262
+ "const": "InvokeLambdaFunction"
263
+ }
264
+ },
265
+ "required": [
266
+ "Type"
267
+ ]
268
+ },
269
+ "then": {
270
+ "properties": {
271
+ "Parameters": {
272
+ "properties": {
273
+ "LambdaFunctionARN": {
274
+ "$ref": "#/$defs/refField"
275
+ }
276
+ }
277
+ }
278
+ }
279
+ }
280
+ },
281
+ {
282
+ "if": {
283
+ "properties": {
284
+ "Type": {
285
+ "const": "InvokeFlowModule"
286
+ }
287
+ },
288
+ "required": [
289
+ "Type"
290
+ ]
291
+ },
292
+ "then": {
293
+ "properties": {
294
+ "Parameters": {
295
+ "properties": {
296
+ "FlowModuleId": {
297
+ "$ref": "#/$defs/refField"
298
+ }
299
+ }
300
+ }
301
+ }
302
+ }
303
+ },
304
+ {
305
+ "if": {
306
+ "properties": {
307
+ "Type": {
308
+ "const": "TransferToFlow"
309
+ }
310
+ },
311
+ "required": [
312
+ "Type"
313
+ ]
314
+ },
315
+ "then": {
316
+ "properties": {
317
+ "Parameters": {
318
+ "properties": {
319
+ "ContactFlowId": {
320
+ "$ref": "#/$defs/refField"
321
+ }
322
+ }
323
+ }
324
+ }
325
+ }
326
+ },
327
+ {
328
+ "if": {
329
+ "properties": {
330
+ "Type": {
331
+ "const": "MessageParticipant"
332
+ }
333
+ },
334
+ "required": [
335
+ "Type"
336
+ ]
337
+ },
338
+ "then": {
339
+ "properties": {
340
+ "Parameters": {
341
+ "properties": {
342
+ "PromptId": {
343
+ "$ref": "#/$defs/refField"
344
+ }
345
+ }
346
+ }
347
+ }
348
+ }
349
+ },
350
+ {
351
+ "if": {
352
+ "properties": {
353
+ "Type": {
354
+ "const": "UpdateContactTargetQueue"
355
+ }
356
+ },
357
+ "required": [
358
+ "Type"
359
+ ]
360
+ },
361
+ "then": {
362
+ "properties": {
363
+ "Parameters": {
364
+ "not": {
365
+ "required": [
366
+ "QueueId",
367
+ "AgentId"
368
+ ]
369
+ }
370
+ }
371
+ }
372
+ }
373
+ },
374
+ {
375
+ "if": {
376
+ "properties": {
377
+ "Type": {
378
+ "const": "MessageParticipant"
379
+ }
380
+ },
381
+ "required": [
382
+ "Type"
383
+ ]
384
+ },
385
+ "then": {
386
+ "properties": {
387
+ "Parameters": {
388
+ "oneOf": [
389
+ {
390
+ "required": [
391
+ "PromptId"
392
+ ],
393
+ "not": {
394
+ "anyOf": [
395
+ {
396
+ "required": [
397
+ "Text"
398
+ ]
399
+ },
400
+ {
401
+ "required": [
402
+ "SSML"
403
+ ]
404
+ }
405
+ ]
406
+ }
407
+ },
408
+ {
409
+ "required": [
410
+ "Text"
411
+ ],
412
+ "not": {
413
+ "anyOf": [
414
+ {
415
+ "required": [
416
+ "PromptId"
417
+ ]
418
+ },
419
+ {
420
+ "required": [
421
+ "SSML"
422
+ ]
423
+ }
424
+ ]
425
+ }
426
+ },
427
+ {
428
+ "required": [
429
+ "SSML"
430
+ ],
431
+ "not": {
432
+ "anyOf": [
433
+ {
434
+ "required": [
435
+ "PromptId"
436
+ ]
437
+ },
438
+ {
439
+ "required": [
440
+ "Text"
441
+ ]
442
+ }
443
+ ]
444
+ }
445
+ }
446
+ ]
447
+ }
448
+ }
449
+ }
450
+ },
451
+ {
452
+ "if": {
453
+ "properties": {
454
+ "Type": {
455
+ "const": "InvokeLambdaFunction"
456
+ }
457
+ },
458
+ "required": [
459
+ "Type"
460
+ ]
461
+ },
462
+ "then": {
463
+ "properties": {
464
+ "Parameters": {
465
+ "properties": {
466
+ "InvocationTimeLimitSeconds": {
467
+ "type": "integer",
468
+ "minimum": 1,
469
+ "maximum": 8
470
+ },
471
+ "InvocationType": {
472
+ "enum": [
473
+ "SYNCHRONOUS",
474
+ "ASYNCHRONOUS"
475
+ ]
476
+ }
477
+ }
478
+ }
479
+ }
480
+ }
481
+ },
482
+ {
483
+ "if": {
484
+ "properties": {
485
+ "Type": {
486
+ "const": "GetParticipantInput"
487
+ }
488
+ },
489
+ "required": [
490
+ "Type"
491
+ ]
492
+ },
493
+ "then": {
494
+ "properties": {
495
+ "Parameters": {
496
+ "properties": {
497
+ "PromptId": {
498
+ "$ref": "#/$defs/refField"
499
+ },
500
+ "StoreInput": {
501
+ "enum": [
502
+ "True",
503
+ "False"
504
+ ]
505
+ },
506
+ "InputTimeLimitSeconds": {
507
+ "oneOf": [
508
+ {
509
+ "type": "integer",
510
+ "minimum": 1
511
+ },
512
+ {
513
+ "type": "string",
514
+ "pattern": "^[1-9][0-9]*$"
515
+ }
516
+ ]
517
+ }
518
+ },
519
+ "not": {
520
+ "anyOf": [
521
+ {
522
+ "required": [
523
+ "PromptId",
524
+ "Text"
525
+ ]
526
+ },
527
+ {
528
+ "required": [
529
+ "PromptId",
530
+ "SSML"
531
+ ]
532
+ },
533
+ {
534
+ "required": [
535
+ "Text",
536
+ "SSML"
537
+ ]
538
+ }
539
+ ]
540
+ }
541
+ }
542
+ }
543
+ }
544
+ }
545
+ ]
546
+ },
547
+ "transitions": {
548
+ "type": "object",
549
+ "additionalProperties": false,
550
+ "properties": {
551
+ "NextAction": {
552
+ "$ref": "#/$defs/identifier"
553
+ },
554
+ "Errors": {
555
+ "type": "array",
556
+ "items": {
557
+ "type": "object",
558
+ "required": [
559
+ "ErrorType",
560
+ "NextAction"
561
+ ],
562
+ "additionalProperties": false,
563
+ "properties": {
564
+ "ErrorType": {
565
+ "type": "string",
566
+ "minLength": 1
567
+ },
568
+ "NextAction": {
569
+ "$ref": "#/$defs/identifier"
570
+ }
571
+ }
572
+ }
573
+ },
574
+ "Conditions": {
575
+ "type": "array",
576
+ "items": {
577
+ "type": "object",
578
+ "required": [
579
+ "NextAction",
580
+ "Condition"
581
+ ],
582
+ "additionalProperties": false,
583
+ "properties": {
584
+ "NextAction": {
585
+ "$ref": "#/$defs/identifier"
586
+ },
587
+ "Condition": {
588
+ "$ref": "#/$defs/condition"
589
+ }
590
+ }
591
+ }
592
+ }
593
+ }
594
+ },
595
+ "condition": {
596
+ "type": "object",
597
+ "required": [
598
+ "Operator",
599
+ "Operands"
600
+ ],
601
+ "additionalProperties": false,
602
+ "properties": {
603
+ "Operator": {
604
+ "enum": [
605
+ "Equals",
606
+ "TextStartsWith",
607
+ "TextEndsWith",
608
+ "TextContains",
609
+ "NumberGreaterThan",
610
+ "NumberGreaterOrEqualTo",
611
+ "NumberLessThan",
612
+ "NumberLessOrEqualTo"
613
+ ]
614
+ },
615
+ "Operands": {
616
+ "type": "array",
617
+ "minItems": 1,
618
+ "maxItems": 10
619
+ }
620
+ }
621
+ },
622
+ "jsonPath": {
623
+ "description": "A single JSONPath identifier, e.g. $.Attributes.queueId",
624
+ "type": "string",
625
+ "pattern": "^\\$\\.[A-Za-z0-9_$.\\[\\]'-]+$"
626
+ },
627
+ "refField": {
628
+ "description": "A reference-bearing parameter: either a cdref token or a single JSONPath identifier. Never a literal ARN.",
629
+ "oneOf": [
630
+ {
631
+ "$ref": "#/$defs/token"
632
+ },
633
+ {
634
+ "$ref": "#/$defs/jsonPath"
635
+ }
636
+ ]
637
+ }
638
+ },
639
+ "allOf": [
640
+ {
641
+ "if": {
642
+ "properties": {
643
+ "kind": {
644
+ "const": "module"
645
+ }
646
+ },
647
+ "required": [
648
+ "kind"
649
+ ]
650
+ },
651
+ "then": {
652
+ "properties": {
653
+ "connectType": {
654
+ "const": "MODULE"
655
+ }
656
+ }
657
+ },
658
+ "else": {
659
+ "properties": {
660
+ "connectType": {
661
+ "not": {
662
+ "const": "MODULE"
663
+ }
664
+ }
665
+ }
666
+ }
667
+ }
668
+ ]
669
+ }