scjson 0.3.0 → 0.3.2
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/README.md +25 -26
- package/dist/converters.d.ts +52 -13
- package/dist/converters.js +256 -17
- package/dist/scjsonProps.d.ts +230 -1
- package/dist/scjsonProps.js +55 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -185,32 +185,31 @@ Several generated classes share generic helper fields:
|
|
|
185
185
|
|
|
186
186
|
### Document / Object Types
|
|
187
187
|
Plain typescript types without runtime validation.
|
|
188
|
-
|
|
189
|
-
- `
|
|
190
|
-
- `
|
|
191
|
-
- `
|
|
192
|
-
- `
|
|
193
|
-
- `
|
|
194
|
-
- `
|
|
195
|
-
- `
|
|
196
|
-
- `
|
|
197
|
-
- `
|
|
198
|
-
- `
|
|
199
|
-
- `
|
|
200
|
-
- `
|
|
201
|
-
- `
|
|
202
|
-
- `
|
|
203
|
-
- `
|
|
204
|
-
- `
|
|
205
|
-
- `
|
|
206
|
-
- `
|
|
207
|
-
- `
|
|
208
|
-
- `
|
|
209
|
-
- `
|
|
210
|
-
- `
|
|
211
|
-
- `
|
|
212
|
-
- `
|
|
213
|
-
- `StateProps` `StateArray` – basic state node.
|
|
188
|
+
- `AssignProps` `AssignArray` – update a datamodel location with an expression or value.
|
|
189
|
+
- `CancelProps` `CancelArray` – cancel a pending `<send>` operation.
|
|
190
|
+
- `ContentProps` `ContentArray` – inline payload used by `<send>` and `<invoke>`.
|
|
191
|
+
- `DataProps` `DataArray` – represents a single datamodel variable.
|
|
192
|
+
- `DatamodelProps` `DatamodelArray` – container for one or more `<data>` elements.
|
|
193
|
+
- `DonedataProps` `DonedataArray` – payload returned when a `<final>` state is reached.
|
|
194
|
+
- `ElseProps` – fallback branch for `<if>` conditions.
|
|
195
|
+
- `ElseifProps` – conditional branch following an `<if>`.
|
|
196
|
+
- `FinalProps` `FinalArray` – marks a terminal state in the machine.
|
|
197
|
+
- `FinalizeProps` `FinalizeArray` – executed after an `<invoke>` completes.
|
|
198
|
+
- `ForeachProps` `ForeachArray` – iterate over items within executable content.
|
|
199
|
+
- `HistoryProps` `HistoryArray` – pseudostate remembering previous active children.
|
|
200
|
+
- `IfProps` `IfArray` – conditional execution block.
|
|
201
|
+
- `InitialProps` `InitialArray` – starting state within a compound state.
|
|
202
|
+
- `InvokeProps` `InvokeArray` – run an external process or machine.
|
|
203
|
+
- `LogProps` `LogArray` – diagnostic output statement.
|
|
204
|
+
- `OnentryProps` `OnentryArray` – actions performed when entering a state.
|
|
205
|
+
- `OnexitProps` `OnexitArray` – actions performed when leaving a state.
|
|
206
|
+
- `ParallelProps` `ParallelArray` – coordinates concurrent regions.
|
|
207
|
+
- `ParamProps` `ParamArray` – parameter passed to `<invoke>` or `<send>`.
|
|
208
|
+
- `RaiseProps` `RaiseArray` – raise an internal event.
|
|
209
|
+
- `ScriptProps` `ScriptArray` – inline executable script.
|
|
210
|
+
- `ScxmlProps` – root element of an SCJSON document.
|
|
211
|
+
- `SendProps` `SendArray` – dispatch an external event.
|
|
212
|
+
- `StateProps` `StateArray` – basic state node.
|
|
214
213
|
- `TransitionProps` `TransitionArray` – edge between states triggered by events.
|
|
215
214
|
|
|
216
215
|
### Object Management
|
package/dist/converters.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* Convert an SCXML string to scjson.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} xmlStr - XML input.
|
|
5
|
-
* @param {boolean} [omitEmpty=true] - Remove empty values when true.
|
|
6
|
-
* @returns {{result: string, valid: boolean, errors: object[]|null}} Conversion outcome.
|
|
7
|
-
*
|
|
8
|
-
* Removes the XML namespace attribute and injects default values
|
|
9
|
-
* expected by the schema.
|
|
10
|
-
*/
|
|
11
|
-
export function xmlToJson(xmlStr: string, omitEmpty?: boolean): {
|
|
1
|
+
export function xmlToJson(xmlStr: any, omitEmpty?: boolean): {
|
|
12
2
|
result: string;
|
|
13
|
-
valid:
|
|
14
|
-
errors:
|
|
3
|
+
valid: any;
|
|
4
|
+
errors: any;
|
|
15
5
|
};
|
|
16
6
|
/**
|
|
17
7
|
* Convert a scjson string to SCXML.
|
|
@@ -120,6 +110,18 @@ export function fixSendContent(value: object | any[]): void;
|
|
|
120
110
|
* @param {object|Array} value - Parsed object to adjust in place.
|
|
121
111
|
*/
|
|
122
112
|
export function fixDonedataContent(value: object | any[]): void;
|
|
113
|
+
export function fixOtherAttributes(value: any): void;
|
|
114
|
+
/**
|
|
115
|
+
* Decode HTML entities in string values.
|
|
116
|
+
*
|
|
117
|
+
* Fast XML parser leaves character references intact. This helper matches the
|
|
118
|
+
* Python implementation by converting entities like ``
`` to their literal
|
|
119
|
+
* characters.
|
|
120
|
+
*
|
|
121
|
+
* @param {object|Array|string} value - Parsed value to normalise.
|
|
122
|
+
* @returns {object|Array|string} Normalised value.
|
|
123
|
+
*/
|
|
124
|
+
export function decodeEntities(value: object | any[] | string): object | any[] | string;
|
|
123
125
|
/**
|
|
124
126
|
* Convert a canonical content object back into XML element format.
|
|
125
127
|
*
|
|
@@ -162,6 +164,16 @@ export function splitTokenAttrs(value: object | any[], parent: any): void;
|
|
|
162
164
|
* @param {object|Array} value - Parsed object to adjust in place.
|
|
163
165
|
*/
|
|
164
166
|
export function fixEmptyElse(value: object | any[]): void;
|
|
167
|
+
/**
|
|
168
|
+
* Normalise empty ``onentry`` and ``onexit`` elements.
|
|
169
|
+
*
|
|
170
|
+
* The XML parser represents empty tags as an empty string. The Python
|
|
171
|
+
* reference output preserves these elements as empty objects so they
|
|
172
|
+
* survive subsequent cleaning steps. This helper mirrors that behaviour.
|
|
173
|
+
*
|
|
174
|
+
* @param {object|Array} value - Parsed object to adjust in place.
|
|
175
|
+
*/
|
|
176
|
+
export function fixEmptyOnentry(value: object | any[]): void;
|
|
165
177
|
/**
|
|
166
178
|
* Remove transition elements directly under the <scxml> root.
|
|
167
179
|
*
|
|
@@ -189,3 +201,30 @@ export function stripQnameNs(value: object | any[]): void;
|
|
|
189
201
|
* @param {object|Array} value - Parsed object to adjust in place.
|
|
190
202
|
*/
|
|
191
203
|
export function reorderScxml(value: object | any[]): void;
|
|
204
|
+
/**
|
|
205
|
+
* Convert an SCXML string to scjson.
|
|
206
|
+
*
|
|
207
|
+
* @param {string} xmlStr - XML input.
|
|
208
|
+
* @param {boolean} [omitEmpty=true] - Remove empty values when true.
|
|
209
|
+
* @returns {{result: string, valid: boolean, errors: object[]|null}} Conversion outcome.
|
|
210
|
+
*
|
|
211
|
+
* Removes the XML namespace attribute and injects default values
|
|
212
|
+
* expected by the schema.
|
|
213
|
+
*/
|
|
214
|
+
/**
|
|
215
|
+
* Recursively strip default attributes from nested data nodes.
|
|
216
|
+
*
|
|
217
|
+
* Any object with a ``qname`` property other than ``scxml`` may have
|
|
218
|
+
* ``version`` or ``datamodel_attribute`` inserted during validation.
|
|
219
|
+
* This helper removes those keys so that nested structures match the
|
|
220
|
+
* canonical Python output.
|
|
221
|
+
*
|
|
222
|
+
* @param {object|Array} value - Parsed object to adjust in place.
|
|
223
|
+
*/
|
|
224
|
+
export function stripNestedDataAttrs(value: object | any[]): void;
|
|
225
|
+
/**
|
|
226
|
+
* Recursively remove ``xmlns`` attributes from nested objects.
|
|
227
|
+
*
|
|
228
|
+
* @param {object|Array} value - Parsed object to adjust in place.
|
|
229
|
+
*/
|
|
230
|
+
export function stripXmlns(value: object | any[]): void;
|
package/dist/converters.js
CHANGED
|
@@ -59,7 +59,6 @@ const STRUCTURAL_FIELDS = new Set([
|
|
|
59
59
|
* Recursively convert an XML Element to SCJSON-compliant JS object.
|
|
60
60
|
*/
|
|
61
61
|
function convert(element) {
|
|
62
|
-
var _a;
|
|
63
62
|
const result = {
|
|
64
63
|
tag: element.tagName,
|
|
65
64
|
...Object.fromEntries(Array.from(element.attributes).map(attr => [attr.name, attr.value]))
|
|
@@ -85,16 +84,16 @@ function convert(element) {
|
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
// Handle text content if present
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
result.content = [
|
|
87
|
+
const rawText = element.textContent;
|
|
88
|
+
if (rawText && element.children.length === 0 && rawText.trim() !== '') {
|
|
89
|
+
result.content = [rawText];
|
|
91
90
|
}
|
|
92
91
|
return result;
|
|
93
92
|
}
|
|
94
93
|
/**
|
|
95
94
|
* Keys that should never be pruned even when empty.
|
|
96
95
|
*/
|
|
97
|
-
const ALWAYS_KEEP = new Set(['else_value', 'else', 'final']);
|
|
96
|
+
const ALWAYS_KEEP = new Set(['else_value', 'else', 'final', 'onentry']);
|
|
98
97
|
/**
|
|
99
98
|
* Remove transition elements directly under the <scxml> root.
|
|
100
99
|
*
|
|
@@ -145,7 +144,12 @@ function collapseWhitespace(value) {
|
|
|
145
144
|
if (value && typeof value === 'object') {
|
|
146
145
|
for (const [k, v] of Object.entries(value)) {
|
|
147
146
|
if ((k.endsWith('_attribute') || COLLAPSE_ATTRS.has(k)) && typeof v === 'string') {
|
|
148
|
-
|
|
147
|
+
if (v.startsWith('\n')) {
|
|
148
|
+
value[k] = '\n' + v.slice(1).replace(/[\n\r\t]/g, ' ');
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
value[k] = v.replace(/[\n\r\t]/g, ' ');
|
|
152
|
+
}
|
|
149
153
|
}
|
|
150
154
|
else {
|
|
151
155
|
value[k] = collapseWhitespace(v);
|
|
@@ -175,7 +179,7 @@ function splitTokenAttrs(value, parent) {
|
|
|
175
179
|
continue;
|
|
176
180
|
}
|
|
177
181
|
if (k === 'transition') {
|
|
178
|
-
if (parent !== 'history') {
|
|
182
|
+
if (parent !== 'history' && parent !== 'initial') {
|
|
179
183
|
const arr = Array.isArray(v) ? v : [v];
|
|
180
184
|
arr.forEach(tr => {
|
|
181
185
|
if (typeof tr.target === 'string')
|
|
@@ -311,7 +315,7 @@ function ensureArrays(obj, parent) {
|
|
|
311
315
|
continue;
|
|
312
316
|
}
|
|
313
317
|
if (k === 'transition' && v && typeof v === 'object') {
|
|
314
|
-
if (parent !== 'history') {
|
|
318
|
+
if (parent !== 'history' && parent !== 'initial') {
|
|
315
319
|
const arr = Array.isArray(v) ? v : [v];
|
|
316
320
|
arr.forEach(tr => {
|
|
317
321
|
if (tr.target !== undefined && !Array.isArray(tr.target))
|
|
@@ -355,6 +359,66 @@ function fixEmptyElse(value) {
|
|
|
355
359
|
}
|
|
356
360
|
}
|
|
357
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Normalise empty ``onentry`` and ``onexit`` elements.
|
|
364
|
+
*
|
|
365
|
+
* The XML parser represents empty tags as an empty string. The Python
|
|
366
|
+
* reference output preserves these elements as empty objects so they
|
|
367
|
+
* survive subsequent cleaning steps. This helper mirrors that behaviour.
|
|
368
|
+
*
|
|
369
|
+
* @param {object|Array} value - Parsed object to adjust in place.
|
|
370
|
+
*/
|
|
371
|
+
function fixEmptyOnentry(value) {
|
|
372
|
+
if (Array.isArray(value)) {
|
|
373
|
+
value.forEach(fixEmptyOnentry);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
if (value && typeof value === 'object') {
|
|
377
|
+
for (const [k, v] of Object.entries(value)) {
|
|
378
|
+
if ((k === 'onentry' || k === 'onexit') &&
|
|
379
|
+
Array.isArray(v) &&
|
|
380
|
+
v.length === 1 &&
|
|
381
|
+
typeof v[0] === 'string' &&
|
|
382
|
+
v[0].trim() === '') {
|
|
383
|
+
value[k] = [{}];
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
fixEmptyOnentry(v);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Decode HTML entities in string values.
|
|
392
|
+
*
|
|
393
|
+
* Fast XML parser leaves character references intact. This helper matches the
|
|
394
|
+
* Python implementation by converting entities like ``
`` to their literal
|
|
395
|
+
* characters.
|
|
396
|
+
*
|
|
397
|
+
* @param {object|Array|string} value - Parsed value to normalise.
|
|
398
|
+
* @returns {object|Array|string} Normalised value.
|
|
399
|
+
*/
|
|
400
|
+
function decodeEntities(value) {
|
|
401
|
+
if (Array.isArray(value)) {
|
|
402
|
+
return value.map(decodeEntities);
|
|
403
|
+
}
|
|
404
|
+
if (value && typeof value === 'object') {
|
|
405
|
+
for (const [k, v] of Object.entries(value)) {
|
|
406
|
+
value[k] = decodeEntities(v);
|
|
407
|
+
}
|
|
408
|
+
return value;
|
|
409
|
+
}
|
|
410
|
+
if (typeof value === 'string') {
|
|
411
|
+
return value
|
|
412
|
+
.replace(/&#x([0-9a-fA-F]+);/g, (_, h) => String.fromCharCode(parseInt(h, 16)))
|
|
413
|
+
.replace(/&#([0-9]+);/g, (_, d) => String.fromCharCode(parseInt(d, 10)))
|
|
414
|
+
.replace(/"/g, '"')
|
|
415
|
+
.replace(/'/g, "'")
|
|
416
|
+
.replace(/&/g, '&')
|
|
417
|
+
.replace(/</g, '<')
|
|
418
|
+
.replace(/>/g, '>');
|
|
419
|
+
}
|
|
420
|
+
return value;
|
|
421
|
+
}
|
|
358
422
|
/**
|
|
359
423
|
* Normalise script elements after parsing.
|
|
360
424
|
*
|
|
@@ -470,6 +534,52 @@ function fixAssignDefaults(value) {
|
|
|
470
534
|
}
|
|
471
535
|
}
|
|
472
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* Hoist unexpected attributes into ``other_attributes``.
|
|
539
|
+
*
|
|
540
|
+
* Handles the ``id`` attribute on ``assign`` elements and the
|
|
541
|
+
* misspelled ``intial`` attribute on ``state`` elements so that
|
|
542
|
+
* generated scjson matches the reference Python output.
|
|
543
|
+
*
|
|
544
|
+
* @param {object|Array} value - Parsed object to adjust in place.
|
|
545
|
+
*/
|
|
546
|
+
// Avoid infinite recursion on cyclic structures
|
|
547
|
+
const VISITED_FLAG = Symbol('fixOtherAttributesVisited');
|
|
548
|
+
function fixOtherAttributes(value) {
|
|
549
|
+
if (Array.isArray(value)) {
|
|
550
|
+
value.forEach(fixOtherAttributes);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
if (value && typeof value === 'object') {
|
|
554
|
+
if (value[VISITED_FLAG]) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
value[VISITED_FLAG] = true;
|
|
558
|
+
if (Object.prototype.hasOwnProperty.call(value, 'assign')) {
|
|
559
|
+
const arr = Array.isArray(value.assign) ? value.assign : [value.assign];
|
|
560
|
+
arr.forEach(a => {
|
|
561
|
+
if (a.id !== undefined) {
|
|
562
|
+
a.other_attributes = a.other_attributes || {};
|
|
563
|
+
a.other_attributes.id = a.id;
|
|
564
|
+
delete a.id;
|
|
565
|
+
}
|
|
566
|
+
fixOtherAttributes(a);
|
|
567
|
+
});
|
|
568
|
+
value.assign = arr;
|
|
569
|
+
}
|
|
570
|
+
if (value.intial !== undefined) {
|
|
571
|
+
value.other_attributes = value.other_attributes || {};
|
|
572
|
+
value.other_attributes.intial = value.intial;
|
|
573
|
+
delete value.intial;
|
|
574
|
+
}
|
|
575
|
+
for (const [k, v] of Object.entries(value)) {
|
|
576
|
+
if (v === value || k === 'other_attributes')
|
|
577
|
+
continue;
|
|
578
|
+
fixOtherAttributes(v);
|
|
579
|
+
}
|
|
580
|
+
delete value[VISITED_FLAG];
|
|
581
|
+
}
|
|
582
|
+
}
|
|
473
583
|
/**
|
|
474
584
|
* Apply default values for send elements.
|
|
475
585
|
*
|
|
@@ -521,6 +631,14 @@ function fixSendContent(value) {
|
|
|
521
631
|
return;
|
|
522
632
|
}
|
|
523
633
|
if (value && typeof value === 'object') {
|
|
634
|
+
if (Object.prototype.hasOwnProperty.call(value, 'qname')) {
|
|
635
|
+
if (Object.prototype.hasOwnProperty.call(value, 'version')) {
|
|
636
|
+
delete value.version;
|
|
637
|
+
}
|
|
638
|
+
if (Object.prototype.hasOwnProperty.call(value, 'datamodel_attribute')) {
|
|
639
|
+
delete value.datamodel_attribute;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
524
642
|
if (Object.prototype.hasOwnProperty.call(value, 'send')) {
|
|
525
643
|
const arr = Array.isArray(value.send) ? value.send : [value.send];
|
|
526
644
|
arr.forEach(s => {
|
|
@@ -528,8 +646,10 @@ function fixSendContent(value) {
|
|
|
528
646
|
const cArr = Array.isArray(s.content) ? s.content : [s.content];
|
|
529
647
|
const mapped = cArr.map(c => {
|
|
530
648
|
if (typeof c !== 'object') {
|
|
531
|
-
const
|
|
532
|
-
|
|
649
|
+
const raw = String(c);
|
|
650
|
+
if (raw.trim() === '')
|
|
651
|
+
return null;
|
|
652
|
+
return { content: [{ content: [raw] }] };
|
|
533
653
|
}
|
|
534
654
|
if (c && typeof c === 'object') {
|
|
535
655
|
if (typeof c.content === 'string' || typeof c.content === 'number' || typeof c.content === 'boolean') {
|
|
@@ -537,8 +657,8 @@ function fixSendContent(value) {
|
|
|
537
657
|
}
|
|
538
658
|
if (Array.isArray(c.content)) {
|
|
539
659
|
c.content = c.content
|
|
540
|
-
.map(i => (typeof i === 'string' ? i
|
|
541
|
-
.filter(i => i
|
|
660
|
+
.map(i => (typeof i === 'string' ? String(i) : i))
|
|
661
|
+
.filter(i => !(typeof i === 'string' && i.trim() === '') && i !== null && i !== undefined);
|
|
542
662
|
if (c.content.length === 0)
|
|
543
663
|
delete c.content;
|
|
544
664
|
}
|
|
@@ -550,6 +670,10 @@ function fixSendContent(value) {
|
|
|
550
670
|
else {
|
|
551
671
|
fixSendContent(c);
|
|
552
672
|
}
|
|
673
|
+
if (c.qname && c.version !== undefined)
|
|
674
|
+
delete c.version;
|
|
675
|
+
if (c.qname && c.datamodel_attribute !== undefined)
|
|
676
|
+
delete c.datamodel_attribute;
|
|
553
677
|
return c;
|
|
554
678
|
}
|
|
555
679
|
return null;
|
|
@@ -587,8 +711,10 @@ function fixDonedataContent(value) {
|
|
|
587
711
|
const cArr = Array.isArray(d.content) ? d.content : [d.content];
|
|
588
712
|
const mapped = cArr.map(c => {
|
|
589
713
|
if (typeof c !== 'object') {
|
|
590
|
-
const
|
|
591
|
-
|
|
714
|
+
const raw = String(c);
|
|
715
|
+
if (raw.trim() === '')
|
|
716
|
+
return null;
|
|
717
|
+
return { content: [raw] };
|
|
592
718
|
}
|
|
593
719
|
if (c && typeof c === 'object') {
|
|
594
720
|
if (typeof c.content === 'string' ||
|
|
@@ -604,6 +730,10 @@ function fixDonedataContent(value) {
|
|
|
604
730
|
else {
|
|
605
731
|
fixDonedataContent(c);
|
|
606
732
|
}
|
|
733
|
+
if (c.qname && c.version !== undefined)
|
|
734
|
+
delete c.version;
|
|
735
|
+
if (c.qname && c.datamodel_attribute !== undefined)
|
|
736
|
+
delete c.datamodel_attribute;
|
|
607
737
|
return c;
|
|
608
738
|
}
|
|
609
739
|
return null;
|
|
@@ -776,6 +906,27 @@ function stripQnameNs(value) {
|
|
|
776
906
|
}
|
|
777
907
|
}
|
|
778
908
|
}
|
|
909
|
+
/**
|
|
910
|
+
* Recursively remove ``xmlns`` attributes from nested objects.
|
|
911
|
+
*
|
|
912
|
+
* @param {object|Array} value - Parsed object to adjust in place.
|
|
913
|
+
*/
|
|
914
|
+
function stripXmlns(value) {
|
|
915
|
+
if (Array.isArray(value)) {
|
|
916
|
+
value.forEach(stripXmlns);
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
if (value && typeof value === 'object') {
|
|
920
|
+
for (const k of Object.keys(value)) {
|
|
921
|
+
if (k === '@_xmlns' || k.startsWith('xmlns')) {
|
|
922
|
+
delete value[k];
|
|
923
|
+
}
|
|
924
|
+
else {
|
|
925
|
+
stripXmlns(value[k]);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}
|
|
779
930
|
/**
|
|
780
931
|
* Collapse nested ``content`` wrappers created during parsing.
|
|
781
932
|
*
|
|
@@ -800,7 +951,8 @@ function flattenContent(value) {
|
|
|
800
951
|
Array.isArray(value.content[0].content) &&
|
|
801
952
|
value.content[0].content.length === 1 &&
|
|
802
953
|
value.content[0].content[0] &&
|
|
803
|
-
typeof value.content[0].content[0] === 'object'
|
|
954
|
+
typeof value.content[0].content[0] === 'object' &&
|
|
955
|
+
!Object.prototype.hasOwnProperty.call(value.content[0].content[0], 'qname')) {
|
|
804
956
|
value.content = [value.content[0].content[0]];
|
|
805
957
|
}
|
|
806
958
|
for (const v of Object.values(value)) {
|
|
@@ -822,7 +974,10 @@ function flattenContent(value) {
|
|
|
822
974
|
function removeEmpty(value, key) {
|
|
823
975
|
if (Array.isArray(value)) {
|
|
824
976
|
const arr = value.map(v => removeEmpty(v, key)).filter(v => v !== undefined);
|
|
825
|
-
|
|
977
|
+
if (arr.length > 0 || ALWAYS_KEEP.has(key)) {
|
|
978
|
+
return arr;
|
|
979
|
+
}
|
|
980
|
+
return undefined;
|
|
826
981
|
}
|
|
827
982
|
if (value && typeof value === 'object') {
|
|
828
983
|
const obj = {};
|
|
@@ -844,7 +999,7 @@ function removeEmpty(value, key) {
|
|
|
844
999
|
const base = key.startsWith('@_') ? key.slice(2) : key;
|
|
845
1000
|
if (base.endsWith('_attribute') ||
|
|
846
1001
|
base.endsWith('_value') ||
|
|
847
|
-
['expr', 'cond', 'event', 'target', 'id', 'name', 'label', 'text'].includes(
|
|
1002
|
+
['expr', 'cond', 'event', 'target', 'id', 'name', 'label', 'text'].includes(base) ||
|
|
848
1003
|
key === '@_xmlns') {
|
|
849
1004
|
return '';
|
|
850
1005
|
}
|
|
@@ -865,6 +1020,32 @@ const validate = ajv.compile(schema);
|
|
|
865
1020
|
* Removes the XML namespace attribute and injects default values
|
|
866
1021
|
* expected by the schema.
|
|
867
1022
|
*/
|
|
1023
|
+
/**
|
|
1024
|
+
* Recursively strip default attributes from nested data nodes.
|
|
1025
|
+
*
|
|
1026
|
+
* Any object with a ``qname`` property other than ``scxml`` may have
|
|
1027
|
+
* ``version`` or ``datamodel_attribute`` inserted during validation.
|
|
1028
|
+
* This helper removes those keys so that nested structures match the
|
|
1029
|
+
* canonical Python output.
|
|
1030
|
+
*
|
|
1031
|
+
* @param {object|Array} value - Parsed object to adjust in place.
|
|
1032
|
+
*/
|
|
1033
|
+
function stripNestedDataAttrs(value) {
|
|
1034
|
+
if (Array.isArray(value)) {
|
|
1035
|
+
value.forEach(stripNestedDataAttrs);
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
if (value && typeof value === 'object') {
|
|
1039
|
+
if (Object.prototype.hasOwnProperty.call(value, 'qname') &&
|
|
1040
|
+
value.qname !== 'scxml') {
|
|
1041
|
+
delete value.version;
|
|
1042
|
+
delete value.datamodel_attribute;
|
|
1043
|
+
}
|
|
1044
|
+
for (const v of Object.values(value)) {
|
|
1045
|
+
stripNestedDataAttrs(v);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
868
1049
|
function xmlToJson(xmlStr, omitEmpty = true) {
|
|
869
1050
|
const parser = new XMLParser({
|
|
870
1051
|
ignoreAttributes: false,
|
|
@@ -876,17 +1057,21 @@ function xmlToJson(xmlStr, omitEmpty = true) {
|
|
|
876
1057
|
obj = obj.scxml;
|
|
877
1058
|
}
|
|
878
1059
|
obj = normaliseKeys(obj);
|
|
1060
|
+
obj = decodeEntities(obj);
|
|
879
1061
|
fixNestedScxml(obj);
|
|
880
1062
|
fixEmptyElse(obj);
|
|
881
1063
|
obj = collapseWhitespace(obj);
|
|
882
1064
|
splitTokenAttrs(obj);
|
|
883
1065
|
ensureArrays(obj);
|
|
1066
|
+
fixOtherAttributes(obj);
|
|
884
1067
|
fixScripts(obj);
|
|
885
1068
|
fixAssignDefaults(obj);
|
|
886
1069
|
fixSendDefaults(obj);
|
|
887
1070
|
fixSendContent(obj);
|
|
888
1071
|
fixDonedataContent(obj);
|
|
889
1072
|
fixDataContent(obj);
|
|
1073
|
+
fixEmptyOnentry(obj);
|
|
1074
|
+
fixSendContent(obj);
|
|
890
1075
|
flattenContent(obj);
|
|
891
1076
|
stripRootTransitions(obj);
|
|
892
1077
|
obj = collapseWhitespace(obj);
|
|
@@ -927,12 +1112,16 @@ function xmlToJson(xmlStr, omitEmpty = true) {
|
|
|
927
1112
|
}
|
|
928
1113
|
stripQnameNs(obj);
|
|
929
1114
|
reorderScxml(obj);
|
|
1115
|
+
stripNestedDataAttrs(obj);
|
|
1116
|
+
stripXmlns(obj);
|
|
930
1117
|
const valid = validate(obj);
|
|
931
1118
|
const errors = valid ? null : validate.errors;
|
|
932
1119
|
if (omitEmpty) {
|
|
933
1120
|
obj = removeEmpty(obj) || {};
|
|
934
1121
|
fixDataContent(obj);
|
|
935
1122
|
stripQnameNs(obj);
|
|
1123
|
+
stripNestedDataAttrs(obj);
|
|
1124
|
+
stripXmlns(obj);
|
|
936
1125
|
}
|
|
937
1126
|
let out = JSON.stringify(obj, null, 2);
|
|
938
1127
|
out = out.replace(/"version": 1(?=[,\n])/g, '"version": 1.0');
|
|
@@ -961,6 +1150,15 @@ function jsonToXml(jsonStr) {
|
|
|
961
1150
|
obj = removeEmpty(obj) || {};
|
|
962
1151
|
const valid = validate(obj);
|
|
963
1152
|
const errors = valid ? null : validate.errors;
|
|
1153
|
+
// Remove defaults injected by validation that would misidentify
|
|
1154
|
+
// arbitrary XML content blocks as nested SCXML documents. Ajv
|
|
1155
|
+
// populates ``version`` and ``datamodel_attribute`` for objects
|
|
1156
|
+
// matching the ``Scxml`` schema. When the original JSON only
|
|
1157
|
+
// contains a ``qname`` field these defaults lead to erroneous
|
|
1158
|
+
// ``<scxml>`` wrappers being generated on output. Stripping the
|
|
1159
|
+
// fields prior to conversion preserves parity with the Python
|
|
1160
|
+
// implementation.
|
|
1161
|
+
stripNestedDataAttrs(obj);
|
|
964
1162
|
function restoreKeys(value) {
|
|
965
1163
|
if (Array.isArray(value)) {
|
|
966
1164
|
return value.map(restoreKeys);
|
|
@@ -1000,6 +1198,14 @@ function jsonToXml(jsonStr) {
|
|
|
1000
1198
|
else if (k === 'else_value') {
|
|
1001
1199
|
nk = 'else';
|
|
1002
1200
|
}
|
|
1201
|
+
if (nk === 'other_attributes') {
|
|
1202
|
+
if (v && typeof v === 'object') {
|
|
1203
|
+
for (const [ak, av] of Object.entries(v)) {
|
|
1204
|
+
out[`@_${ak}`] = av;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
continue;
|
|
1208
|
+
}
|
|
1003
1209
|
for (const [attr, prop] of Object.entries(ATTRIBUTE_MAP)) {
|
|
1004
1210
|
if (prop === nk) {
|
|
1005
1211
|
nk = `@_${attr}`;
|
|
@@ -1024,6 +1230,34 @@ function jsonToXml(jsonStr) {
|
|
|
1024
1230
|
}
|
|
1025
1231
|
else if (nk === 'content') {
|
|
1026
1232
|
if (Array.isArray(v)) {
|
|
1233
|
+
if (v.every(item => item && typeof item === 'object' && Object.prototype.hasOwnProperty.call(item, 'qname'))) {
|
|
1234
|
+
v.forEach(item => {
|
|
1235
|
+
const r = restoreDataNode(item);
|
|
1236
|
+
const [ck, cv] = Object.entries(r)[0];
|
|
1237
|
+
if (out[ck]) {
|
|
1238
|
+
if (Array.isArray(out[ck])) {
|
|
1239
|
+
out[ck].push(cv);
|
|
1240
|
+
}
|
|
1241
|
+
else {
|
|
1242
|
+
out[ck] = [out[ck], cv];
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
else {
|
|
1246
|
+
out[ck] = cv;
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
continue;
|
|
1250
|
+
}
|
|
1251
|
+
if (value.location !== undefined &&
|
|
1252
|
+
v.length === 1 &&
|
|
1253
|
+
v[0] &&
|
|
1254
|
+
typeof v[0] === 'object' &&
|
|
1255
|
+
(v[0].state || v[0].parallel || v[0].final || v[0].datamodel ||
|
|
1256
|
+
v[0].datamodel_attribute !== undefined)) {
|
|
1257
|
+
const cv = restoreKeys(v[0]);
|
|
1258
|
+
out.scxml = cv;
|
|
1259
|
+
continue;
|
|
1260
|
+
}
|
|
1027
1261
|
out[nk] = v.map(item => {
|
|
1028
1262
|
if (item &&
|
|
1029
1263
|
typeof item === 'object' &&
|
|
@@ -1123,11 +1357,16 @@ module.exports = {
|
|
|
1123
1357
|
fixSendDefaults,
|
|
1124
1358
|
fixSendContent,
|
|
1125
1359
|
fixDonedataContent,
|
|
1360
|
+
fixOtherAttributes,
|
|
1361
|
+
decodeEntities,
|
|
1126
1362
|
restoreDataNode,
|
|
1127
1363
|
flattenContent,
|
|
1128
1364
|
splitTokenAttrs,
|
|
1129
1365
|
fixEmptyElse,
|
|
1366
|
+
fixEmptyOnentry,
|
|
1130
1367
|
stripRootTransitions,
|
|
1131
1368
|
stripQnameNs,
|
|
1132
1369
|
reorderScxml,
|
|
1370
|
+
stripNestedDataAttrs,
|
|
1371
|
+
stripXmlns,
|
|
1133
1372
|
};
|
package/dist/scjsonProps.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* scjsonProps.ts : Properties runtime file for scjson types
|
|
3
3
|
*
|
|
4
4
|
* Part of the scjson project.
|
|
5
5
|
* Developed by Softoboros Technology Inc.
|
|
6
6
|
* Licensed under the BSD 1-Clause License.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* update a datamodel location with an expression or value.
|
|
7
10
|
*/
|
|
8
11
|
export interface AssignProps {
|
|
9
12
|
location: string;
|
|
@@ -13,8 +16,23 @@ export interface AssignProps {
|
|
|
13
16
|
otherAttributes: Record<string, object>;
|
|
14
17
|
content: Record<string, object>[];
|
|
15
18
|
}
|
|
19
|
+
/** Instantiate a default object of type AssignProps */
|
|
16
20
|
export declare const defaultAssign: () => AssignProps;
|
|
21
|
+
/**
|
|
22
|
+
* update a datamodel location with an expression or value.
|
|
23
|
+
*/
|
|
24
|
+
/** Type for an array of of AssignProps */
|
|
17
25
|
export type AssignArray = AssignProps[];
|
|
26
|
+
/**
|
|
27
|
+
* The assign type that allows for precise manipulation of the datamodel
|
|
28
|
+
* location.
|
|
29
|
+
* Types are:
|
|
30
|
+
* replacechildren (default),
|
|
31
|
+
* firstchild, lastchild,
|
|
32
|
+
* previoussibling, nextsibling,
|
|
33
|
+
* replace, delete,
|
|
34
|
+
* addattribute
|
|
35
|
+
*/
|
|
18
36
|
export declare const AssignTypeDatatypeProps: {
|
|
19
37
|
readonly Addattribute: "addattribute";
|
|
20
38
|
readonly Delete: "delete";
|
|
@@ -25,32 +43,60 @@ export declare const AssignTypeDatatypeProps: {
|
|
|
25
43
|
readonly Replace: "replace";
|
|
26
44
|
readonly Replacechildren: "replacechildren";
|
|
27
45
|
};
|
|
46
|
+
/** executable version of AssignTypeDatatypeProps */
|
|
28
47
|
export type AssignTypeDatatypeProps = typeof AssignTypeDatatypeProps[keyof typeof AssignTypeDatatypeProps];
|
|
48
|
+
/**
|
|
49
|
+
* The binding type in use for the SCXML document.
|
|
50
|
+
*/
|
|
29
51
|
export declare const BindingDatatypeProps: {
|
|
30
52
|
readonly Early: "early";
|
|
31
53
|
readonly Late: "late";
|
|
32
54
|
};
|
|
55
|
+
/** executable version of BindingDatatypeProps */
|
|
33
56
|
export type BindingDatatypeProps = typeof BindingDatatypeProps[keyof typeof BindingDatatypeProps];
|
|
57
|
+
/**
|
|
58
|
+
* Boolean: true or false only
|
|
59
|
+
*/
|
|
34
60
|
export declare const BooleanDatatypeProps: {
|
|
35
61
|
readonly False: "false";
|
|
36
62
|
readonly True: "true";
|
|
37
63
|
};
|
|
64
|
+
/** executable version of BooleanDatatypeProps */
|
|
38
65
|
export type BooleanDatatypeProps = typeof BooleanDatatypeProps[keyof typeof BooleanDatatypeProps];
|
|
66
|
+
/**
|
|
67
|
+
* cancel a pending `<send>` operation.
|
|
68
|
+
*/
|
|
39
69
|
export interface CancelProps {
|
|
40
70
|
otherElement: Record<string, object>[];
|
|
41
71
|
sendid: string | null;
|
|
42
72
|
sendidexpr: string | null;
|
|
43
73
|
otherAttributes: Record<string, object>;
|
|
44
74
|
}
|
|
75
|
+
/** Instantiate a default object of type CancelProps */
|
|
45
76
|
export declare const defaultCancel: () => CancelProps;
|
|
77
|
+
/**
|
|
78
|
+
* cancel a pending `<send>` operation.
|
|
79
|
+
*/
|
|
80
|
+
/** Type for an array of of CancelProps */
|
|
46
81
|
export type CancelArray = CancelProps[];
|
|
82
|
+
/**
|
|
83
|
+
* inline payload used by `<send>` and `<invoke>`.
|
|
84
|
+
*/
|
|
47
85
|
export interface ContentProps {
|
|
48
86
|
content: ScxmlProps[] | null;
|
|
49
87
|
expr: string | null;
|
|
50
88
|
otherAttributes: Record<string, object>;
|
|
51
89
|
}
|
|
90
|
+
/** Instantiate a default object of type ContentProps */
|
|
52
91
|
export declare const defaultContent: () => ContentProps;
|
|
92
|
+
/**
|
|
93
|
+
* inline payload used by `<send>` and `<invoke>`.
|
|
94
|
+
*/
|
|
95
|
+
/** Type for an array of of ContentProps */
|
|
53
96
|
export type ContentArray = ContentProps[];
|
|
97
|
+
/**
|
|
98
|
+
* represents a single datamodel variable.
|
|
99
|
+
*/
|
|
54
100
|
export interface DataProps {
|
|
55
101
|
id: string;
|
|
56
102
|
src: string | null;
|
|
@@ -58,36 +104,74 @@ export interface DataProps {
|
|
|
58
104
|
otherAttributes: Record<string, object>;
|
|
59
105
|
content: Record<string, object>[];
|
|
60
106
|
}
|
|
107
|
+
/** Instantiate a default object of type DataProps */
|
|
61
108
|
export declare const defaultData: () => DataProps;
|
|
109
|
+
/**
|
|
110
|
+
* represents a single datamodel variable.
|
|
111
|
+
*/
|
|
112
|
+
/** Type for an array of of DataProps */
|
|
62
113
|
export type DataArray = DataProps[];
|
|
114
|
+
/**
|
|
115
|
+
* container for one or more `<data>` elements.
|
|
116
|
+
*/
|
|
63
117
|
export interface DatamodelProps {
|
|
64
118
|
data: DataProps[];
|
|
65
119
|
otherElement: Record<string, object>[];
|
|
66
120
|
otherAttributes: Record<string, object>;
|
|
67
121
|
}
|
|
122
|
+
/** Instantiate a default object of type DatamodelProps */
|
|
68
123
|
export declare const defaultDatamodel: () => DatamodelProps;
|
|
124
|
+
/**
|
|
125
|
+
* container for one or more `<data>` elements.
|
|
126
|
+
*/
|
|
127
|
+
/** Type for an array of of DatamodelProps */
|
|
69
128
|
export type DatamodelArray = DatamodelProps[];
|
|
129
|
+
/**
|
|
130
|
+
* payload returned when a `<final>` state is reached.
|
|
131
|
+
*/
|
|
70
132
|
export interface DonedataProps {
|
|
71
133
|
content: ContentProps | null;
|
|
72
134
|
param: ParamProps[];
|
|
73
135
|
otherAttributes: Record<string, object>;
|
|
74
136
|
}
|
|
137
|
+
/** Instantiate a default object of type DonedataProps */
|
|
75
138
|
export declare const defaultDonedata: () => DonedataProps;
|
|
139
|
+
/**
|
|
140
|
+
* payload returned when a `<final>` state is reached.
|
|
141
|
+
*/
|
|
142
|
+
/** Type for an array of of DonedataProps */
|
|
76
143
|
export type DonedataArray = DonedataProps[];
|
|
144
|
+
/**
|
|
145
|
+
* fallback branch for `<if>` conditions.
|
|
146
|
+
*/
|
|
77
147
|
export interface ElseProps {
|
|
78
148
|
otherAttributes: Record<string, object>;
|
|
79
149
|
}
|
|
150
|
+
/** Instantiate a default object of type ElseProps */
|
|
80
151
|
export declare const defaultElse: () => ElseProps;
|
|
152
|
+
/**
|
|
153
|
+
* conditional branch following an `<if>`.
|
|
154
|
+
*/
|
|
81
155
|
export interface ElseifProps {
|
|
82
156
|
cond: string;
|
|
83
157
|
otherAttributes: Record<string, object>;
|
|
84
158
|
}
|
|
159
|
+
/** Instantiate a default object of type ElseifProps */
|
|
85
160
|
export declare const defaultElseif: () => ElseifProps;
|
|
161
|
+
/**
|
|
162
|
+
* Describes the processor execution mode for this document, being either "lax"
|
|
163
|
+
* or
|
|
164
|
+
* "strict".
|
|
165
|
+
*/
|
|
86
166
|
export declare const ExmodeDatatypeProps: {
|
|
87
167
|
readonly Lax: "lax";
|
|
88
168
|
readonly Strict: "strict";
|
|
89
169
|
};
|
|
170
|
+
/** executable version of ExmodeDatatypeProps */
|
|
90
171
|
export type ExmodeDatatypeProps = typeof ExmodeDatatypeProps[keyof typeof ExmodeDatatypeProps];
|
|
172
|
+
/**
|
|
173
|
+
* marks a terminal state in the machine.
|
|
174
|
+
*/
|
|
91
175
|
export interface FinalProps {
|
|
92
176
|
onentry: OnentryProps[];
|
|
93
177
|
onexit: OnexitProps[];
|
|
@@ -96,8 +180,16 @@ export interface FinalProps {
|
|
|
96
180
|
id: string | null;
|
|
97
181
|
otherAttributes: Record<string, object>;
|
|
98
182
|
}
|
|
183
|
+
/** Instantiate a default object of type FinalProps */
|
|
99
184
|
export declare const defaultFinal: () => FinalProps;
|
|
185
|
+
/**
|
|
186
|
+
* marks a terminal state in the machine.
|
|
187
|
+
*/
|
|
188
|
+
/** Type for an array of of FinalProps */
|
|
100
189
|
export type FinalArray = FinalProps[];
|
|
190
|
+
/**
|
|
191
|
+
* executed after an `<invoke>` completes.
|
|
192
|
+
*/
|
|
101
193
|
export interface FinalizeProps {
|
|
102
194
|
otherElement: Record<string, object>[];
|
|
103
195
|
raiseValue: RaiseProps[];
|
|
@@ -110,8 +202,16 @@ export interface FinalizeProps {
|
|
|
110
202
|
cancel: CancelProps[];
|
|
111
203
|
otherAttributes: Record<string, object>;
|
|
112
204
|
}
|
|
205
|
+
/** Instantiate a default object of type FinalizeProps */
|
|
113
206
|
export declare const defaultFinalize: () => FinalizeProps;
|
|
207
|
+
/**
|
|
208
|
+
* executed after an `<invoke>` completes.
|
|
209
|
+
*/
|
|
210
|
+
/** Type for an array of of FinalizeProps */
|
|
114
211
|
export type FinalizeArray = FinalizeProps[];
|
|
212
|
+
/**
|
|
213
|
+
* iterate over items within executable content.
|
|
214
|
+
*/
|
|
115
215
|
export interface ForeachProps {
|
|
116
216
|
otherElement: Record<string, object>[];
|
|
117
217
|
raiseValue: RaiseProps[];
|
|
@@ -127,8 +227,16 @@ export interface ForeachProps {
|
|
|
127
227
|
index: string | null;
|
|
128
228
|
otherAttributes: Record<string, object>;
|
|
129
229
|
}
|
|
230
|
+
/** Instantiate a default object of type ForeachProps */
|
|
130
231
|
export declare const defaultForeach: () => ForeachProps;
|
|
232
|
+
/**
|
|
233
|
+
* iterate over items within executable content.
|
|
234
|
+
*/
|
|
235
|
+
/** Type for an array of of ForeachProps */
|
|
131
236
|
export type ForeachArray = ForeachProps[];
|
|
237
|
+
/**
|
|
238
|
+
* pseudostate remembering previous active children.
|
|
239
|
+
*/
|
|
132
240
|
export interface HistoryProps {
|
|
133
241
|
otherElement: Record<string, object>[];
|
|
134
242
|
transition: TransitionProps;
|
|
@@ -136,13 +244,25 @@ export interface HistoryProps {
|
|
|
136
244
|
typeValue: HistoryTypeDatatypeProps | null;
|
|
137
245
|
otherAttributes: Record<string, object>;
|
|
138
246
|
}
|
|
247
|
+
/** Instantiate a default object of type HistoryProps */
|
|
139
248
|
export declare const defaultHistory: () => HistoryProps;
|
|
249
|
+
/**
|
|
250
|
+
* pseudostate remembering previous active children.
|
|
251
|
+
*/
|
|
252
|
+
/** Type for an array of of HistoryProps */
|
|
140
253
|
export type HistoryArray = HistoryProps[];
|
|
254
|
+
/**
|
|
255
|
+
* type of `<history>` state: `shallow` or `deep`.
|
|
256
|
+
*/
|
|
141
257
|
export declare const HistoryTypeDatatypeProps: {
|
|
142
258
|
readonly Deep: "deep";
|
|
143
259
|
readonly Shallow: "shallow";
|
|
144
260
|
};
|
|
261
|
+
/** executable version of HistoryTypeDatatypeProps */
|
|
145
262
|
export type HistoryTypeDatatypeProps = typeof HistoryTypeDatatypeProps[keyof typeof HistoryTypeDatatypeProps];
|
|
263
|
+
/**
|
|
264
|
+
* conditional execution block.
|
|
265
|
+
*/
|
|
146
266
|
export interface IfProps {
|
|
147
267
|
otherElement: Record<string, object>[];
|
|
148
268
|
raiseValue: RaiseProps[];
|
|
@@ -158,15 +278,31 @@ export interface IfProps {
|
|
|
158
278
|
cond: string;
|
|
159
279
|
otherAttributes: Record<string, object>;
|
|
160
280
|
}
|
|
281
|
+
/** Instantiate a default object of type IfProps */
|
|
161
282
|
export declare const defaultIf: () => IfProps;
|
|
283
|
+
/**
|
|
284
|
+
* conditional execution block.
|
|
285
|
+
*/
|
|
286
|
+
/** Type for an array of of IfProps */
|
|
162
287
|
export type IfArray = IfProps[];
|
|
288
|
+
/**
|
|
289
|
+
* starting state within a compound state.
|
|
290
|
+
*/
|
|
163
291
|
export interface InitialProps {
|
|
164
292
|
otherElement: Record<string, object>[];
|
|
165
293
|
transition: TransitionProps;
|
|
166
294
|
otherAttributes: Record<string, object>;
|
|
167
295
|
}
|
|
296
|
+
/** Instantiate a default object of type InitialProps */
|
|
168
297
|
export declare const defaultInitial: () => InitialProps;
|
|
298
|
+
/**
|
|
299
|
+
* starting state within a compound state.
|
|
300
|
+
*/
|
|
301
|
+
/** Type for an array of of InitialProps */
|
|
169
302
|
export type InitialArray = InitialProps[];
|
|
303
|
+
/**
|
|
304
|
+
* run an external process or machine.
|
|
305
|
+
*/
|
|
170
306
|
export interface InvokeProps {
|
|
171
307
|
content: ContentProps[];
|
|
172
308
|
param: ParamProps[];
|
|
@@ -182,16 +318,32 @@ export interface InvokeProps {
|
|
|
182
318
|
autoforward: BooleanDatatypeProps;
|
|
183
319
|
otherAttributes: Record<string, object>;
|
|
184
320
|
}
|
|
321
|
+
/** Instantiate a default object of type InvokeProps */
|
|
185
322
|
export declare const defaultInvoke: () => InvokeProps;
|
|
323
|
+
/**
|
|
324
|
+
* run an external process or machine.
|
|
325
|
+
*/
|
|
326
|
+
/** Type for an array of of InvokeProps */
|
|
186
327
|
export type InvokeArray = InvokeProps[];
|
|
328
|
+
/**
|
|
329
|
+
* diagnostic output statement.
|
|
330
|
+
*/
|
|
187
331
|
export interface LogProps {
|
|
188
332
|
otherElement: Record<string, object>[];
|
|
189
333
|
label: string | null;
|
|
190
334
|
expr: string | null;
|
|
191
335
|
otherAttributes: Record<string, object>;
|
|
192
336
|
}
|
|
337
|
+
/** Instantiate a default object of type LogProps */
|
|
193
338
|
export declare const defaultLog: () => LogProps;
|
|
339
|
+
/**
|
|
340
|
+
* diagnostic output statement.
|
|
341
|
+
*/
|
|
342
|
+
/** Type for an array of of LogProps */
|
|
194
343
|
export type LogArray = LogProps[];
|
|
344
|
+
/**
|
|
345
|
+
* actions performed when entering a state.
|
|
346
|
+
*/
|
|
195
347
|
export interface OnentryProps {
|
|
196
348
|
otherElement: Record<string, object>[];
|
|
197
349
|
raiseValue: RaiseProps[];
|
|
@@ -204,8 +356,16 @@ export interface OnentryProps {
|
|
|
204
356
|
cancel: CancelProps[];
|
|
205
357
|
otherAttributes: Record<string, object>;
|
|
206
358
|
}
|
|
359
|
+
/** Instantiate a default object of type OnentryProps */
|
|
207
360
|
export declare const defaultOnentry: () => OnentryProps;
|
|
361
|
+
/**
|
|
362
|
+
* actions performed when entering a state.
|
|
363
|
+
*/
|
|
364
|
+
/** Type for an array of of OnentryProps */
|
|
208
365
|
export type OnentryArray = OnentryProps[];
|
|
366
|
+
/**
|
|
367
|
+
* actions performed when leaving a state.
|
|
368
|
+
*/
|
|
209
369
|
export interface OnexitProps {
|
|
210
370
|
otherElement: Record<string, object>[];
|
|
211
371
|
raiseValue: RaiseProps[];
|
|
@@ -218,8 +378,16 @@ export interface OnexitProps {
|
|
|
218
378
|
cancel: CancelProps[];
|
|
219
379
|
otherAttributes: Record<string, object>;
|
|
220
380
|
}
|
|
381
|
+
/** Instantiate a default object of type OnexitProps */
|
|
221
382
|
export declare const defaultOnexit: () => OnexitProps;
|
|
383
|
+
/**
|
|
384
|
+
* actions performed when leaving a state.
|
|
385
|
+
*/
|
|
386
|
+
/** Type for an array of of OnexitProps */
|
|
222
387
|
export type OnexitArray = OnexitProps[];
|
|
388
|
+
/**
|
|
389
|
+
* coordinates concurrent regions.
|
|
390
|
+
*/
|
|
223
391
|
export interface ParallelProps {
|
|
224
392
|
onentry: OnentryProps[];
|
|
225
393
|
onexit: OnexitProps[];
|
|
@@ -233,8 +401,16 @@ export interface ParallelProps {
|
|
|
233
401
|
id: string | null;
|
|
234
402
|
otherAttributes: Record<string, object>;
|
|
235
403
|
}
|
|
404
|
+
/** Instantiate a default object of type ParallelProps */
|
|
236
405
|
export declare const defaultParallel: () => ParallelProps;
|
|
406
|
+
/**
|
|
407
|
+
* coordinates concurrent regions.
|
|
408
|
+
*/
|
|
409
|
+
/** Type for an array of of ParallelProps */
|
|
237
410
|
export type ParallelArray = ParallelProps[];
|
|
411
|
+
/**
|
|
412
|
+
* parameter passed to `<invoke>` or `<send>`.
|
|
413
|
+
*/
|
|
238
414
|
export interface ParamProps {
|
|
239
415
|
otherElement: Record<string, object>[];
|
|
240
416
|
name: string;
|
|
@@ -242,21 +418,45 @@ export interface ParamProps {
|
|
|
242
418
|
location: string | null;
|
|
243
419
|
otherAttributes: Record<string, object>;
|
|
244
420
|
}
|
|
421
|
+
/** Instantiate a default object of type ParamProps */
|
|
245
422
|
export declare const defaultParam: () => ParamProps;
|
|
423
|
+
/**
|
|
424
|
+
* parameter passed to `<invoke>` or `<send>`.
|
|
425
|
+
*/
|
|
426
|
+
/** Type for an array of of ParamProps */
|
|
246
427
|
export type ParamArray = ParamProps[];
|
|
428
|
+
/**
|
|
429
|
+
* raise an internal event.
|
|
430
|
+
*/
|
|
247
431
|
export interface RaiseProps {
|
|
248
432
|
event: string;
|
|
249
433
|
otherAttributes: Record<string, object>;
|
|
250
434
|
}
|
|
435
|
+
/** Instantiate a default object of type RaiseProps */
|
|
251
436
|
export declare const defaultRaise: () => RaiseProps;
|
|
437
|
+
/**
|
|
438
|
+
* raise an internal event.
|
|
439
|
+
*/
|
|
440
|
+
/** Type for an array of of RaiseProps */
|
|
252
441
|
export type RaiseArray = RaiseProps[];
|
|
442
|
+
/**
|
|
443
|
+
* inline executable script.
|
|
444
|
+
*/
|
|
253
445
|
export interface ScriptProps {
|
|
254
446
|
src: string | null;
|
|
255
447
|
otherAttributes: Record<string, object>;
|
|
256
448
|
content: Record<string, object>[];
|
|
257
449
|
}
|
|
450
|
+
/** Instantiate a default object of type ScriptProps */
|
|
258
451
|
export declare const defaultScript: () => ScriptProps;
|
|
452
|
+
/**
|
|
453
|
+
* inline executable script.
|
|
454
|
+
*/
|
|
455
|
+
/** Type for an array of of ScriptProps */
|
|
259
456
|
export type ScriptArray = ScriptProps[];
|
|
457
|
+
/**
|
|
458
|
+
* root element of an SCJSON document.
|
|
459
|
+
*/
|
|
260
460
|
export interface ScxmlProps {
|
|
261
461
|
state: StateProps[];
|
|
262
462
|
parallel: ParallelProps[];
|
|
@@ -272,7 +472,11 @@ export interface ScxmlProps {
|
|
|
272
472
|
exmode: ExmodeDatatypeProps | null;
|
|
273
473
|
otherAttributes: Record<string, object>;
|
|
274
474
|
}
|
|
475
|
+
/** Instantiate a default object of type ScxmlProps */
|
|
275
476
|
export declare const defaultScxml: () => ScxmlProps;
|
|
477
|
+
/**
|
|
478
|
+
* dispatch an external event.
|
|
479
|
+
*/
|
|
276
480
|
export interface SendProps {
|
|
277
481
|
content: ContentProps[];
|
|
278
482
|
param: ParamProps[];
|
|
@@ -290,8 +494,16 @@ export interface SendProps {
|
|
|
290
494
|
namelist: string | null;
|
|
291
495
|
otherAttributes: Record<string, object>;
|
|
292
496
|
}
|
|
497
|
+
/** Instantiate a default object of type SendProps */
|
|
293
498
|
export declare const defaultSend: () => SendProps;
|
|
499
|
+
/**
|
|
500
|
+
* dispatch an external event.
|
|
501
|
+
*/
|
|
502
|
+
/** Type for an array of of SendProps */
|
|
294
503
|
export type SendArray = SendProps[];
|
|
504
|
+
/**
|
|
505
|
+
* basic state node.
|
|
506
|
+
*/
|
|
295
507
|
export interface StateProps {
|
|
296
508
|
onentry: OnentryProps[];
|
|
297
509
|
onexit: OnexitProps[];
|
|
@@ -308,8 +520,16 @@ export interface StateProps {
|
|
|
308
520
|
initialAttribute: string[];
|
|
309
521
|
otherAttributes: Record<string, object>;
|
|
310
522
|
}
|
|
523
|
+
/** Instantiate a default object of type StateProps */
|
|
311
524
|
export declare const defaultState: () => StateProps;
|
|
525
|
+
/**
|
|
526
|
+
* basic state node.
|
|
527
|
+
*/
|
|
528
|
+
/** Type for an array of of StateProps */
|
|
312
529
|
export type StateArray = StateProps[];
|
|
530
|
+
/**
|
|
531
|
+
* edge between states triggered by events.
|
|
532
|
+
*/
|
|
313
533
|
export interface TransitionProps {
|
|
314
534
|
otherElement: Record<string, object>[];
|
|
315
535
|
raiseValue: RaiseProps[];
|
|
@@ -326,12 +546,21 @@ export interface TransitionProps {
|
|
|
326
546
|
typeValue: TransitionTypeDatatypeProps | null;
|
|
327
547
|
otherAttributes: Record<string, object>;
|
|
328
548
|
}
|
|
549
|
+
/** Instantiate a default object of type TransitionProps */
|
|
329
550
|
export declare const defaultTransition: () => TransitionProps;
|
|
551
|
+
/**
|
|
552
|
+
* edge between states triggered by events.
|
|
553
|
+
*/
|
|
554
|
+
/** Type for an array of of TransitionProps */
|
|
330
555
|
export type TransitionArray = TransitionProps[];
|
|
556
|
+
/**
|
|
557
|
+
* The type of the transition i.e. internal or external.
|
|
558
|
+
*/
|
|
331
559
|
export declare const TransitionTypeDatatypeProps: {
|
|
332
560
|
readonly External: "external";
|
|
333
561
|
readonly Internal: "internal";
|
|
334
562
|
};
|
|
563
|
+
/** executable version of TransitionTypeDatatypeProps */
|
|
335
564
|
export type TransitionTypeDatatypeProps = typeof TransitionTypeDatatypeProps[keyof typeof TransitionTypeDatatypeProps];
|
|
336
565
|
export type Kind = "number" | "string" | "record<string, object>" | "number[]" | "string[]" | "record<string, object>[]" | "assign" | "assigntypedatatype" | "bindingdatatype" | "booleandatatype" | "cancel" | "content" | "data" | "datamodel" | "donedata" | "else" | "elseif" | "exmodedatatype" | "final" | "finalize" | "foreach" | "history" | "historytypedatatype" | "if" | "initial" | "invoke" | "log" | "onentry" | "onexit" | "parallel" | "param" | "raise" | "script" | "scxml" | "send" | "state" | "transition" | "transitiontypedatatype" | "assignarray" | "cancelarray" | "contentarray" | "dataarray" | "datamodelarray" | "donedataarray" | "finalarray" | "finalizearray" | "foreacharray" | "historyarray" | "ifarray" | "initialarray" | "invokearray" | "logarray" | "onentryarray" | "onexitarray" | "parallelarray" | "paramarray" | "raisearray" | "scriptarray" | "sendarray" | "statearray" | "transitionarray";
|
|
337
566
|
export type PropsUnion = null | string | number | Record<string, object> | string[] | number[] | Record<string, object>[] | AssignProps | AssignTypeDatatypeProps | BindingDatatypeProps | BooleanDatatypeProps | CancelProps | ContentProps | DataProps | DatamodelProps | DonedataProps | ElseProps | ElseifProps | ExmodeDatatypeProps | FinalProps | FinalizeProps | ForeachProps | HistoryProps | HistoryTypeDatatypeProps | IfProps | InitialProps | InvokeProps | LogProps | OnentryProps | OnexitProps | ParallelProps | ParamProps | RaiseProps | ScriptProps | ScxmlProps | SendProps | StateProps | TransitionProps | TransitionTypeDatatypeProps | AssignArray | CancelArray | ContentArray | DataArray | DatamodelArray | DonedataArray | FinalArray | FinalizeArray | ForeachArray | HistoryArray | IfArray | InitialArray | InvokeArray | LogArray | OnentryArray | OnexitArray | ParallelArray | ParamArray | RaiseArray | ScriptArray | SendArray | StateArray | TransitionArray;
|
package/dist/scjsonProps.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* scjsonProps.ts : Properties runtime file for scjson types
|
|
4
4
|
*
|
|
5
5
|
* Part of the scjson project.
|
|
6
6
|
* Developed by Softoboros Technology Inc.
|
|
7
7
|
* Licensed under the BSD 1-Clause License.
|
|
8
|
-
*/
|
|
8
|
+
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.TransitionTypeDatatypeProps = exports.defaultTransition = exports.defaultState = exports.defaultSend = exports.defaultScxml = exports.defaultScript = exports.defaultRaise = exports.defaultParam = exports.defaultParallel = exports.defaultOnexit = exports.defaultOnentry = exports.defaultLog = exports.defaultInvoke = exports.defaultInitial = exports.defaultIf = exports.HistoryTypeDatatypeProps = exports.defaultHistory = exports.defaultForeach = exports.defaultFinalize = exports.defaultFinal = exports.ExmodeDatatypeProps = exports.defaultElseif = exports.defaultElse = exports.defaultDonedata = exports.defaultDatamodel = exports.defaultData = exports.defaultContent = exports.defaultCancel = exports.BooleanDatatypeProps = exports.BindingDatatypeProps = exports.AssignTypeDatatypeProps = exports.defaultAssign = void 0;
|
|
11
|
+
/** Instantiate a default object of type AssignProps */
|
|
11
12
|
const defaultAssign = () => ({
|
|
12
13
|
location: "",
|
|
13
14
|
expr: null,
|
|
@@ -17,6 +18,16 @@ const defaultAssign = () => ({
|
|
|
17
18
|
content: [],
|
|
18
19
|
});
|
|
19
20
|
exports.defaultAssign = defaultAssign;
|
|
21
|
+
/**
|
|
22
|
+
* The assign type that allows for precise manipulation of the datamodel
|
|
23
|
+
* location.
|
|
24
|
+
* Types are:
|
|
25
|
+
* replacechildren (default),
|
|
26
|
+
* firstchild, lastchild,
|
|
27
|
+
* previoussibling, nextsibling,
|
|
28
|
+
* replace, delete,
|
|
29
|
+
* addattribute
|
|
30
|
+
*/
|
|
20
31
|
exports.AssignTypeDatatypeProps = {
|
|
21
32
|
Addattribute: "addattribute",
|
|
22
33
|
Delete: "delete",
|
|
@@ -27,14 +38,21 @@ exports.AssignTypeDatatypeProps = {
|
|
|
27
38
|
Replace: "replace",
|
|
28
39
|
Replacechildren: "replacechildren",
|
|
29
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* The binding type in use for the SCXML document.
|
|
43
|
+
*/
|
|
30
44
|
exports.BindingDatatypeProps = {
|
|
31
45
|
Early: "early",
|
|
32
46
|
Late: "late",
|
|
33
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Boolean: true or false only
|
|
50
|
+
*/
|
|
34
51
|
exports.BooleanDatatypeProps = {
|
|
35
52
|
False: "false",
|
|
36
53
|
True: "true",
|
|
37
54
|
};
|
|
55
|
+
/** Instantiate a default object of type CancelProps */
|
|
38
56
|
const defaultCancel = () => ({
|
|
39
57
|
otherElement: [],
|
|
40
58
|
sendid: null,
|
|
@@ -42,12 +60,14 @@ const defaultCancel = () => ({
|
|
|
42
60
|
otherAttributes: {},
|
|
43
61
|
});
|
|
44
62
|
exports.defaultCancel = defaultCancel;
|
|
63
|
+
/** Instantiate a default object of type ContentProps */
|
|
45
64
|
const defaultContent = () => ({
|
|
46
65
|
content: null,
|
|
47
66
|
expr: null,
|
|
48
67
|
otherAttributes: {},
|
|
49
68
|
});
|
|
50
69
|
exports.defaultContent = defaultContent;
|
|
70
|
+
/** Instantiate a default object of type DataProps */
|
|
51
71
|
const defaultData = () => ({
|
|
52
72
|
id: "",
|
|
53
73
|
src: null,
|
|
@@ -56,31 +76,41 @@ const defaultData = () => ({
|
|
|
56
76
|
content: [],
|
|
57
77
|
});
|
|
58
78
|
exports.defaultData = defaultData;
|
|
79
|
+
/** Instantiate a default object of type DatamodelProps */
|
|
59
80
|
const defaultDatamodel = () => ({
|
|
60
81
|
data: [],
|
|
61
82
|
otherElement: [],
|
|
62
83
|
otherAttributes: {},
|
|
63
84
|
});
|
|
64
85
|
exports.defaultDatamodel = defaultDatamodel;
|
|
86
|
+
/** Instantiate a default object of type DonedataProps */
|
|
65
87
|
const defaultDonedata = () => ({
|
|
66
88
|
content: null,
|
|
67
89
|
param: [],
|
|
68
90
|
otherAttributes: {},
|
|
69
91
|
});
|
|
70
92
|
exports.defaultDonedata = defaultDonedata;
|
|
93
|
+
/** Instantiate a default object of type ElseProps */
|
|
71
94
|
const defaultElse = () => ({
|
|
72
95
|
otherAttributes: {},
|
|
73
96
|
});
|
|
74
97
|
exports.defaultElse = defaultElse;
|
|
98
|
+
/** Instantiate a default object of type ElseifProps */
|
|
75
99
|
const defaultElseif = () => ({
|
|
76
100
|
cond: "",
|
|
77
101
|
otherAttributes: {},
|
|
78
102
|
});
|
|
79
103
|
exports.defaultElseif = defaultElseif;
|
|
104
|
+
/**
|
|
105
|
+
* Describes the processor execution mode for this document, being either "lax"
|
|
106
|
+
* or
|
|
107
|
+
* "strict".
|
|
108
|
+
*/
|
|
80
109
|
exports.ExmodeDatatypeProps = {
|
|
81
110
|
Lax: "lax",
|
|
82
111
|
Strict: "strict",
|
|
83
112
|
};
|
|
113
|
+
/** Instantiate a default object of type FinalProps */
|
|
84
114
|
const defaultFinal = () => ({
|
|
85
115
|
onentry: [],
|
|
86
116
|
onexit: [],
|
|
@@ -90,6 +120,7 @@ const defaultFinal = () => ({
|
|
|
90
120
|
otherAttributes: {},
|
|
91
121
|
});
|
|
92
122
|
exports.defaultFinal = defaultFinal;
|
|
123
|
+
/** Instantiate a default object of type FinalizeProps */
|
|
93
124
|
const defaultFinalize = () => ({
|
|
94
125
|
otherElement: [],
|
|
95
126
|
raiseValue: [],
|
|
@@ -103,6 +134,7 @@ const defaultFinalize = () => ({
|
|
|
103
134
|
otherAttributes: {},
|
|
104
135
|
});
|
|
105
136
|
exports.defaultFinalize = defaultFinalize;
|
|
137
|
+
/** Instantiate a default object of type ForeachProps */
|
|
106
138
|
const defaultForeach = () => ({
|
|
107
139
|
otherElement: [],
|
|
108
140
|
raiseValue: [],
|
|
@@ -119,6 +151,7 @@ const defaultForeach = () => ({
|
|
|
119
151
|
otherAttributes: {},
|
|
120
152
|
});
|
|
121
153
|
exports.defaultForeach = defaultForeach;
|
|
154
|
+
/** Instantiate a default object of type HistoryProps */
|
|
122
155
|
const defaultHistory = () => ({
|
|
123
156
|
otherElement: [],
|
|
124
157
|
transition: (0, exports.defaultTransition)(),
|
|
@@ -127,10 +160,14 @@ const defaultHistory = () => ({
|
|
|
127
160
|
otherAttributes: {},
|
|
128
161
|
});
|
|
129
162
|
exports.defaultHistory = defaultHistory;
|
|
163
|
+
/**
|
|
164
|
+
* type of `<history>` state: `shallow` or `deep`.
|
|
165
|
+
*/
|
|
130
166
|
exports.HistoryTypeDatatypeProps = {
|
|
131
167
|
Deep: "deep",
|
|
132
168
|
Shallow: "shallow",
|
|
133
169
|
};
|
|
170
|
+
/** Instantiate a default object of type IfProps */
|
|
134
171
|
const defaultIf = () => ({
|
|
135
172
|
otherElement: [],
|
|
136
173
|
raiseValue: [],
|
|
@@ -147,12 +184,14 @@ const defaultIf = () => ({
|
|
|
147
184
|
otherAttributes: {},
|
|
148
185
|
});
|
|
149
186
|
exports.defaultIf = defaultIf;
|
|
187
|
+
/** Instantiate a default object of type InitialProps */
|
|
150
188
|
const defaultInitial = () => ({
|
|
151
189
|
otherElement: [],
|
|
152
190
|
transition: (0, exports.defaultTransition)(),
|
|
153
191
|
otherAttributes: {},
|
|
154
192
|
});
|
|
155
193
|
exports.defaultInitial = defaultInitial;
|
|
194
|
+
/** Instantiate a default object of type InvokeProps */
|
|
156
195
|
const defaultInvoke = () => ({
|
|
157
196
|
content: [],
|
|
158
197
|
param: [],
|
|
@@ -169,6 +208,7 @@ const defaultInvoke = () => ({
|
|
|
169
208
|
otherAttributes: {},
|
|
170
209
|
});
|
|
171
210
|
exports.defaultInvoke = defaultInvoke;
|
|
211
|
+
/** Instantiate a default object of type LogProps */
|
|
172
212
|
const defaultLog = () => ({
|
|
173
213
|
otherElement: [],
|
|
174
214
|
label: null,
|
|
@@ -176,6 +216,7 @@ const defaultLog = () => ({
|
|
|
176
216
|
otherAttributes: {},
|
|
177
217
|
});
|
|
178
218
|
exports.defaultLog = defaultLog;
|
|
219
|
+
/** Instantiate a default object of type OnentryProps */
|
|
179
220
|
const defaultOnentry = () => ({
|
|
180
221
|
otherElement: [],
|
|
181
222
|
raiseValue: [],
|
|
@@ -189,6 +230,7 @@ const defaultOnentry = () => ({
|
|
|
189
230
|
otherAttributes: {},
|
|
190
231
|
});
|
|
191
232
|
exports.defaultOnentry = defaultOnentry;
|
|
233
|
+
/** Instantiate a default object of type OnexitProps */
|
|
192
234
|
const defaultOnexit = () => ({
|
|
193
235
|
otherElement: [],
|
|
194
236
|
raiseValue: [],
|
|
@@ -202,6 +244,7 @@ const defaultOnexit = () => ({
|
|
|
202
244
|
otherAttributes: {},
|
|
203
245
|
});
|
|
204
246
|
exports.defaultOnexit = defaultOnexit;
|
|
247
|
+
/** Instantiate a default object of type ParallelProps */
|
|
205
248
|
const defaultParallel = () => ({
|
|
206
249
|
onentry: [],
|
|
207
250
|
onexit: [],
|
|
@@ -216,6 +259,7 @@ const defaultParallel = () => ({
|
|
|
216
259
|
otherAttributes: {},
|
|
217
260
|
});
|
|
218
261
|
exports.defaultParallel = defaultParallel;
|
|
262
|
+
/** Instantiate a default object of type ParamProps */
|
|
219
263
|
const defaultParam = () => ({
|
|
220
264
|
otherElement: [],
|
|
221
265
|
name: "",
|
|
@@ -224,17 +268,20 @@ const defaultParam = () => ({
|
|
|
224
268
|
otherAttributes: {},
|
|
225
269
|
});
|
|
226
270
|
exports.defaultParam = defaultParam;
|
|
271
|
+
/** Instantiate a default object of type RaiseProps */
|
|
227
272
|
const defaultRaise = () => ({
|
|
228
273
|
event: "",
|
|
229
274
|
otherAttributes: {},
|
|
230
275
|
});
|
|
231
276
|
exports.defaultRaise = defaultRaise;
|
|
277
|
+
/** Instantiate a default object of type ScriptProps */
|
|
232
278
|
const defaultScript = () => ({
|
|
233
279
|
src: null,
|
|
234
280
|
otherAttributes: {},
|
|
235
281
|
content: [],
|
|
236
282
|
});
|
|
237
283
|
exports.defaultScript = defaultScript;
|
|
284
|
+
/** Instantiate a default object of type ScxmlProps */
|
|
238
285
|
const defaultScxml = () => ({
|
|
239
286
|
state: [],
|
|
240
287
|
parallel: [],
|
|
@@ -251,6 +298,7 @@ const defaultScxml = () => ({
|
|
|
251
298
|
otherAttributes: {},
|
|
252
299
|
});
|
|
253
300
|
exports.defaultScxml = defaultScxml;
|
|
301
|
+
/** Instantiate a default object of type SendProps */
|
|
254
302
|
const defaultSend = () => ({
|
|
255
303
|
content: [],
|
|
256
304
|
param: [],
|
|
@@ -269,6 +317,7 @@ const defaultSend = () => ({
|
|
|
269
317
|
otherAttributes: {},
|
|
270
318
|
});
|
|
271
319
|
exports.defaultSend = defaultSend;
|
|
320
|
+
/** Instantiate a default object of type StateProps */
|
|
272
321
|
const defaultState = () => ({
|
|
273
322
|
onentry: [],
|
|
274
323
|
onexit: [],
|
|
@@ -286,6 +335,7 @@ const defaultState = () => ({
|
|
|
286
335
|
otherAttributes: {},
|
|
287
336
|
});
|
|
288
337
|
exports.defaultState = defaultState;
|
|
338
|
+
/** Instantiate a default object of type TransitionProps */
|
|
289
339
|
const defaultTransition = () => ({
|
|
290
340
|
otherElement: [],
|
|
291
341
|
raiseValue: [],
|
|
@@ -303,6 +353,9 @@ const defaultTransition = () => ({
|
|
|
303
353
|
otherAttributes: {},
|
|
304
354
|
});
|
|
305
355
|
exports.defaultTransition = defaultTransition;
|
|
356
|
+
/**
|
|
357
|
+
* The type of the transition i.e. internal or external.
|
|
358
|
+
*/
|
|
306
359
|
exports.TransitionTypeDatatypeProps = {
|
|
307
360
|
External: "external",
|
|
308
361
|
Internal: "internal",
|