scjson 0.1.8 → 0.2.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.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This directory contains the JavaScript implementation of **scjson**, a format for representing SCXML state machines in JSON. The package provides a command line interface to convert between `.scxml` and `.scjson` files and to validate documents against the project's schema.
4
4
 
5
+ The package includes typescript types for the functions and default functions to return each.
6
+
5
7
  ## Installation
6
8
 
7
9
  ```bash
@@ -14,6 +16,18 @@ You can also install from a checkout of this repository:
14
16
  cd js && npm install
15
17
  ```
16
18
 
19
+ ## Source Code - Multi-Language Support
20
+ [https://github.com/SoftOboros/scjson/]
21
+ - csharp
22
+ - go
23
+ - java
24
+ - javascript / typescript
25
+ - lua
26
+ - python
27
+ - ruby
28
+ - rust
29
+ - swift
30
+
17
31
  ## Command Line Usage
18
32
 
19
33
  After installation the `scjson` command is available:
@@ -29,6 +43,85 @@ scjson xml path/to/machine.scjson
29
43
  scjson validate path/to/dir -r
30
44
  ```
31
45
 
46
+ ## Conversion Functions
47
+ ```js
48
+ /**
49
+ * xmlToJson
50
+ * Convert an SCXML string to scjson.
51
+ *
52
+ * @param {string} xmlStr - XML input.
53
+ * @param {boolean} [omitEmpty=true] - Remove empty values when true.
54
+ * @returns {string} JSON representation.
55
+ */
56
+
57
+ /**
58
+ * jsonToXml
59
+ * Convert a scjson string to SCXML.
60
+ *
61
+ * @param {string} jsonStr - JSON input.
62
+ * @returns {string} XML output.
63
+ */
64
+ ```
65
+
66
+ ## Common JS Translate Usage
67
+ ```js
68
+ const { xmlToJson, jsonToXml } = require('scjson');
69
+
70
+ ```
71
+
72
+ ## ESR translate usage
73
+ ```js
74
+ import { xmlToJson, jsonToXml }from "scjson/browser"
75
+ ```
76
+
77
+ ## Axios Endpoint Example
78
+ ```typescript
79
+ import axios from "axios"
80
+ import * as scjson from "scjson/props"
81
+
82
+ // A function to creat a new doc with three states and transitions.
83
+ const newScxml = (): scjson.ScxmlProps => {
84
+ const doc: scjson.ScxmlProps = scjson.defaultScxml();
85
+ let state: scjson.StateProps = scjson.defaultState();
86
+ let transition: scjson.TransitionProps = scjson.defaultTransition();
87
+ doc.name = 'New State Machine';
88
+ doc.exmode = scjson.ExmodeDatatypeProps.Lax;
89
+ doc.binding = scjson.BindingDatatypeProps.Early;
90
+ doc.initial.push('Start');
91
+ state.id = 'Start';
92
+ transition.target.push('Process');
93
+ state.transition.push(transition);
94
+ doc.state.push(state);
95
+ state = scjson.defaultState();
96
+ state.id = 'Process';
97
+ transition = scjson.defaultTransition();
98
+ transition.target.push('End');
99
+ state.transition.push(transition);
100
+ doc.state.push(state);
101
+ state = scjson.defaultState();
102
+ state.id = 'End';
103
+ transition = scjson.defaultTransition();
104
+ transition.target.push('Start');
105
+ state.transition.push(transition);
106
+ doc.state.push(state);
107
+ return doc;
108
+ }
109
+
110
+ // Create Axios instance
111
+ const ax = axios.create({
112
+ baseURL: "https://api.example.com/scxml",
113
+ headers: { "Content-Type": "application/json" },
114
+ withCredentials: true,
115
+ });
116
+
117
+ // Export a function to send the doc
118
+ export const sendNewScxml = () => {
119
+ const doc = newScxml();
120
+ ax.post('/newDoc', doc);
121
+ }
122
+
123
+ ```
124
+
32
125
  ### Other Resources
33
126
  github: [https://github.com/SoftOboros/scjson]
34
127
  ```bash
package/browser.mjs CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { XMLParser, XMLBuilder } from 'fast-xml-parser';
14
14
  import Ajv from 'ajv';
15
- import schema from './scjson.schema.json' assert { type: 'json' };
15
+ import schema from './scjson.schema.json';
16
16
 
17
17
  const ajv = new Ajv({ useDefaults: true, strict: false });
18
18
  const validate = ajv.compile(schema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scjson",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "A JSON-based serialization of SCXML (State Chart XML) for modern tooling, interoperability, and education.",
5
5
  "keywords": [
6
6
  "scjson",
@@ -31,6 +31,7 @@
31
31
  "type": "commonjs",
32
32
  "exports": {
33
33
  ".": "./index.js",
34
+ "./props": "./scjsonProps.ts",
34
35
  "./browser": {
35
36
  "import": "./browser.mjs",
36
37
  "require": "./browser.cjs"
@@ -40,15 +41,22 @@
40
41
  "*": {
41
42
  "browser": [
42
43
  "/types/scjson-browser.d.ts"
44
+ ],
45
+ "props": [
46
+ "/types/scjsonProps.d.ts"
43
47
  ]
48
+
44
49
  }
45
50
  },
51
+ "types": "types/*",
46
52
  "files": [
47
53
  "bin/",
48
54
  "index.js",
49
55
  "browser.mjs",
50
56
  "browser.cjs",
57
+ "scjsonProps.ts",
51
58
  "types/scjson-browser.d.ts",
59
+ "types/scjsonProps.d.ts",
52
60
  "tests/",
53
61
  "scjson.schema.json",
54
62
  "README.md",
@@ -1,4 +1,3 @@
1
-
2
1
  {
3
2
  "$defs": {
4
3
  "Assign": {
package/scjsonProps.ts ADDED
@@ -0,0 +1,618 @@
1
+ /**
2
+ * scjsonProps.ts : Properties runtime file for scjson types
3
+ *
4
+ * Part of the scjson project.
5
+ * Developed by Softoboros Technology Inc.
6
+ * Licensed under the BSD 1-Clause License.
7
+ */
8
+
9
+ export interface AssignProps {
10
+ location: string;
11
+ expr: string | null;
12
+ typeValue: AssignTypeDatatypeProps;
13
+ attr: string | null;
14
+ otherAttributes: Record<string, object>;
15
+ content: Record<string, object>[];
16
+ }
17
+
18
+ export const defaultAssign = (): AssignProps => ({
19
+ location: "",
20
+ expr: null,
21
+ typeValue: AssignTypeDatatypeProps.Replacechildren,
22
+ attr: null,
23
+ otherAttributes: {},
24
+ content: [],
25
+ });
26
+ export const AssignTypeDatatypeProps = {
27
+ Addattribute: "addattribute",
28
+ Delete: "delete",
29
+ Firstchild: "firstchild",
30
+ Lastchild: "lastchild",
31
+ Nextsibling: "nextsibling",
32
+ Previoussibling: "previoussibling",
33
+ Replace: "replace",
34
+ Replacechildren: "replacechildren",
35
+ } as const;
36
+
37
+ export type AssignTypeDatatypeProps = typeof AssignTypeDatatypeProps[keyof typeof AssignTypeDatatypeProps];
38
+
39
+ export const BindingDatatypeProps = {
40
+ Early: "early",
41
+ Late: "late",
42
+ } as const;
43
+
44
+ export type BindingDatatypeProps = typeof BindingDatatypeProps[keyof typeof BindingDatatypeProps];
45
+
46
+ export const BooleanDatatypeProps = {
47
+ False: "false",
48
+ True: "true",
49
+ } as const;
50
+
51
+ export type BooleanDatatypeProps = typeof BooleanDatatypeProps[keyof typeof BooleanDatatypeProps];
52
+
53
+ export interface CancelProps {
54
+ otherElement: Record<string, object>[];
55
+ sendid: string | null;
56
+ sendidexpr: string | null;
57
+ otherAttributes: Record<string, object>;
58
+ }
59
+
60
+ export const defaultCancel = (): CancelProps => ({
61
+ otherElement: [],
62
+ sendid: null,
63
+ sendidexpr: null,
64
+ otherAttributes: {},
65
+ });
66
+ export interface ContentProps {
67
+ otherAttributes: Record<string, object>;
68
+ expr: string | null;
69
+ content: Record<string, object>[];
70
+ }
71
+
72
+ export const defaultContent = (): ContentProps => ({
73
+ otherAttributes: {},
74
+ expr: null,
75
+ content: [],
76
+ });
77
+ export interface DataProps {
78
+ id: string;
79
+ src: string | null;
80
+ expr: string | null;
81
+ otherAttributes: Record<string, object>;
82
+ content: Record<string, object>[];
83
+ }
84
+
85
+ export const defaultData = (): DataProps => ({
86
+ id: "",
87
+ src: null,
88
+ expr: null,
89
+ otherAttributes: {},
90
+ content: [],
91
+ });
92
+ export interface DatamodelProps {
93
+ data: DataProps[];
94
+ otherElement: Record<string, object>[];
95
+ otherAttributes: Record<string, object>;
96
+ }
97
+
98
+ export const defaultDatamodel = (): DatamodelProps => ({
99
+ data: [],
100
+ otherElement: [],
101
+ otherAttributes: {},
102
+ });
103
+ export interface DonedataProps {
104
+ content: ContentProps | null;
105
+ param: ParamProps[];
106
+ otherAttributes: Record<string, object>;
107
+ }
108
+
109
+ export const defaultDonedata = (): DonedataProps => ({
110
+ content: null,
111
+ param: [],
112
+ otherAttributes: {},
113
+ });
114
+ export interface ElseProps {
115
+ otherAttributes: Record<string, object>;
116
+ }
117
+
118
+ export const defaultElse = (): ElseProps => ({
119
+ otherAttributes: {},
120
+ });
121
+ export interface ElseifProps {
122
+ cond: string;
123
+ otherAttributes: Record<string, object>;
124
+ }
125
+
126
+ export const defaultElseif = (): ElseifProps => ({
127
+ cond: "",
128
+ otherAttributes: {},
129
+ });
130
+ export const ExmodeDatatypeProps = {
131
+ Lax: "lax",
132
+ Strict: "strict",
133
+ } as const;
134
+
135
+ export type ExmodeDatatypeProps = typeof ExmodeDatatypeProps[keyof typeof ExmodeDatatypeProps];
136
+
137
+ export interface FinalProps {
138
+ onentry: OnentryProps[];
139
+ onexit: OnexitProps[];
140
+ donedata: DonedataProps[];
141
+ otherElement: Record<string, object>[];
142
+ id: string | null;
143
+ otherAttributes: Record<string, object>;
144
+ }
145
+
146
+ export const defaultFinal = (): FinalProps => ({
147
+ onentry: [],
148
+ onexit: [],
149
+ donedata: [],
150
+ otherElement: [],
151
+ id: null,
152
+ otherAttributes: {},
153
+ });
154
+ export interface FinalizeProps {
155
+ otherElement: Record<string, object>[];
156
+ raiseValue: RaiseProps[];
157
+ ifValue: IfProps[];
158
+ foreach: ForeachProps[];
159
+ send: SendProps[];
160
+ script: ScriptProps[];
161
+ assign: AssignProps[];
162
+ log: LogProps[];
163
+ cancel: CancelProps[];
164
+ otherAttributes: Record<string, object>;
165
+ }
166
+
167
+ export const defaultFinalize = (): FinalizeProps => ({
168
+ otherElement: [],
169
+ raiseValue: [],
170
+ ifValue: [],
171
+ foreach: [],
172
+ send: [],
173
+ script: [],
174
+ assign: [],
175
+ log: [],
176
+ cancel: [],
177
+ otherAttributes: {},
178
+ });
179
+ export interface ForeachProps {
180
+ otherElement: Record<string, object>[];
181
+ raiseValue: RaiseProps[];
182
+ ifValue: IfProps[];
183
+ foreach: ForeachProps[];
184
+ send: SendProps[];
185
+ script: ScriptProps[];
186
+ assign: AssignProps[];
187
+ log: LogProps[];
188
+ cancel: CancelProps[];
189
+ array: string;
190
+ item: string;
191
+ index: string | null;
192
+ otherAttributes: Record<string, object>;
193
+ }
194
+
195
+ export const defaultForeach = (): ForeachProps => ({
196
+ otherElement: [],
197
+ raiseValue: [],
198
+ ifValue: [],
199
+ foreach: [],
200
+ send: [],
201
+ script: [],
202
+ assign: [],
203
+ log: [],
204
+ cancel: [],
205
+ array: "",
206
+ item: "",
207
+ index: null,
208
+ otherAttributes: {},
209
+ });
210
+ export interface HistoryProps {
211
+ otherElement: Record<string, object>[];
212
+ transition: TransitionProps;
213
+ id: string | null;
214
+ typeValue: HistoryTypeDatatypeProps | null;
215
+ otherAttributes: Record<string, object>;
216
+ }
217
+
218
+ export const defaultHistory = (): HistoryProps => ({
219
+ otherElement: [],
220
+ transition: defaultTransition(),
221
+ id: null,
222
+ typeValue: null,
223
+ otherAttributes: {},
224
+ });
225
+ export const HistoryTypeDatatypeProps = {
226
+ Deep: "deep",
227
+ Shallow: "shallow",
228
+ } as const;
229
+
230
+ export type HistoryTypeDatatypeProps = typeof HistoryTypeDatatypeProps[keyof typeof HistoryTypeDatatypeProps];
231
+
232
+ export interface IfProps {
233
+ otherElement: Record<string, object>[];
234
+ raiseValue: RaiseProps[];
235
+ ifValue: IfProps[];
236
+ foreach: ForeachProps[];
237
+ send: SendProps[];
238
+ script: ScriptProps[];
239
+ assign: AssignProps[];
240
+ log: LogProps[];
241
+ cancel: CancelProps[];
242
+ elseif: ElseifProps | null;
243
+ elseValue: ElseProps | null;
244
+ cond: string;
245
+ otherAttributes: Record<string, object>;
246
+ }
247
+
248
+ export const defaultIf = (): IfProps => ({
249
+ otherElement: [],
250
+ raiseValue: [],
251
+ ifValue: [],
252
+ foreach: [],
253
+ send: [],
254
+ script: [],
255
+ assign: [],
256
+ log: [],
257
+ cancel: [],
258
+ elseif: null,
259
+ elseValue: null,
260
+ cond: "",
261
+ otherAttributes: {},
262
+ });
263
+ export interface InitialProps {
264
+ otherElement: Record<string, object>[];
265
+ transition: TransitionProps;
266
+ otherAttributes: Record<string, object>;
267
+ }
268
+
269
+ export const defaultInitial = (): InitialProps => ({
270
+ otherElement: [],
271
+ transition: defaultTransition(),
272
+ otherAttributes: {},
273
+ });
274
+ export interface InvokeProps {
275
+ content: ContentProps[];
276
+ param: ParamProps[];
277
+ finalize: FinalizeProps[];
278
+ otherElement: Record<string, object>[];
279
+ typeValue: string;
280
+ typeexpr: string | null;
281
+ src: string | null;
282
+ srcexpr: string | null;
283
+ id: string | null;
284
+ idlocation: string | null;
285
+ namelist: string | null;
286
+ autoforward: BooleanDatatypeProps;
287
+ otherAttributes: Record<string, object>;
288
+ }
289
+
290
+ export const defaultInvoke = (): InvokeProps => ({
291
+ content: [],
292
+ param: [],
293
+ finalize: [],
294
+ otherElement: [],
295
+ typeValue: "scxml",
296
+ typeexpr: null,
297
+ src: null,
298
+ srcexpr: null,
299
+ id: null,
300
+ idlocation: null,
301
+ namelist: null,
302
+ autoforward: BooleanDatatypeProps.False,
303
+ otherAttributes: {},
304
+ });
305
+ export interface LogProps {
306
+ otherElement: Record<string, object>[];
307
+ label: string | null;
308
+ expr: string | null;
309
+ otherAttributes: Record<string, object>;
310
+ }
311
+
312
+ export const defaultLog = (): LogProps => ({
313
+ otherElement: [],
314
+ label: null,
315
+ expr: null,
316
+ otherAttributes: {},
317
+ });
318
+ export interface OnentryProps {
319
+ otherElement: Record<string, object>[];
320
+ raiseValue: RaiseProps[];
321
+ ifValue: IfProps[];
322
+ foreach: ForeachProps[];
323
+ send: SendProps[];
324
+ script: ScriptProps[];
325
+ assign: AssignProps[];
326
+ log: LogProps[];
327
+ cancel: CancelProps[];
328
+ otherAttributes: Record<string, object>;
329
+ }
330
+
331
+ export const defaultOnentry = (): OnentryProps => ({
332
+ otherElement: [],
333
+ raiseValue: [],
334
+ ifValue: [],
335
+ foreach: [],
336
+ send: [],
337
+ script: [],
338
+ assign: [],
339
+ log: [],
340
+ cancel: [],
341
+ otherAttributes: {},
342
+ });
343
+ export interface OnexitProps {
344
+ otherElement: Record<string, object>[];
345
+ raiseValue: RaiseProps[];
346
+ ifValue: IfProps[];
347
+ foreach: ForeachProps[];
348
+ send: SendProps[];
349
+ script: ScriptProps[];
350
+ assign: AssignProps[];
351
+ log: LogProps[];
352
+ cancel: CancelProps[];
353
+ otherAttributes: Record<string, object>;
354
+ }
355
+
356
+ export const defaultOnexit = (): OnexitProps => ({
357
+ otherElement: [],
358
+ raiseValue: [],
359
+ ifValue: [],
360
+ foreach: [],
361
+ send: [],
362
+ script: [],
363
+ assign: [],
364
+ log: [],
365
+ cancel: [],
366
+ otherAttributes: {},
367
+ });
368
+ export interface ParallelProps {
369
+ onentry: OnentryProps[];
370
+ onexit: OnexitProps[];
371
+ transition: TransitionProps[];
372
+ state: StateProps[];
373
+ parallel: ParallelProps[];
374
+ history: HistoryProps[];
375
+ datamodel: DatamodelProps[];
376
+ invoke: InvokeProps[];
377
+ otherElement: Record<string, object>[];
378
+ id: string | null;
379
+ otherAttributes: Record<string, object>;
380
+ }
381
+
382
+ export const defaultParallel = (): ParallelProps => ({
383
+ onentry: [],
384
+ onexit: [],
385
+ transition: [],
386
+ state: [],
387
+ parallel: [],
388
+ history: [],
389
+ datamodel: [],
390
+ invoke: [],
391
+ otherElement: [],
392
+ id: null,
393
+ otherAttributes: {},
394
+ });
395
+ export interface ParamProps {
396
+ otherElement: Record<string, object>[];
397
+ name: string;
398
+ expr: string | null;
399
+ location: string | null;
400
+ otherAttributes: Record<string, object>;
401
+ }
402
+
403
+ export const defaultParam = (): ParamProps => ({
404
+ otherElement: [],
405
+ name: "",
406
+ expr: null,
407
+ location: null,
408
+ otherAttributes: {},
409
+ });
410
+ export interface RaiseProps {
411
+ event: string;
412
+ otherAttributes: Record<string, object>;
413
+ }
414
+
415
+ export const defaultRaise = (): RaiseProps => ({
416
+ event: "",
417
+ otherAttributes: {},
418
+ });
419
+ export interface ScriptProps {
420
+ src: string | null;
421
+ otherAttributes: Record<string, object>;
422
+ content: Record<string, object>[];
423
+ }
424
+
425
+ export const defaultScript = (): ScriptProps => ({
426
+ src: null,
427
+ otherAttributes: {},
428
+ content: [],
429
+ });
430
+ export interface ScxmlProps {
431
+ state: StateProps[];
432
+ parallel: ParallelProps[];
433
+ final: FinalProps[];
434
+ datamodel: DatamodelProps[];
435
+ script: ScriptProps[];
436
+ otherElement: Record<string, object>[];
437
+ initial: string[];
438
+ name: string | null;
439
+ version: number | string;
440
+ datamodelAttribute: string;
441
+ binding: BindingDatatypeProps | null;
442
+ exmode: ExmodeDatatypeProps | null;
443
+ otherAttributes: Record<string, object>;
444
+ }
445
+
446
+ export const defaultScxml = (): ScxmlProps => ({
447
+ state: [],
448
+ parallel: [],
449
+ final: [],
450
+ datamodel: [],
451
+ script: [],
452
+ otherElement: [],
453
+ initial: [],
454
+ name: null,
455
+ version: 1.0,
456
+ datamodelAttribute: "null",
457
+ binding: null,
458
+ exmode: null,
459
+ otherAttributes: {},
460
+ });
461
+ export interface SendProps {
462
+ content: ContentProps[];
463
+ param: ParamProps[];
464
+ otherElement: Record<string, object>[];
465
+ event: string | null;
466
+ eventexpr: string | null;
467
+ target: string | null;
468
+ targetexpr: string | null;
469
+ typeValue: string;
470
+ typeexpr: string | null;
471
+ id: string | null;
472
+ idlocation: string | null;
473
+ delay: string;
474
+ delayexpr: string | null;
475
+ namelist: string | null;
476
+ otherAttributes: Record<string, object>;
477
+ }
478
+
479
+ export const defaultSend = (): SendProps => ({
480
+ content: [],
481
+ param: [],
482
+ otherElement: [],
483
+ event: null,
484
+ eventexpr: null,
485
+ target: null,
486
+ targetexpr: null,
487
+ typeValue: "scxml",
488
+ typeexpr: null,
489
+ id: null,
490
+ idlocation: null,
491
+ delay: "0s",
492
+ delayexpr: null,
493
+ namelist: null,
494
+ otherAttributes: {},
495
+ });
496
+ export interface StateProps {
497
+ onentry: OnentryProps[];
498
+ onexit: OnexitProps[];
499
+ transition: TransitionProps[];
500
+ initial: InitialProps[];
501
+ state: StateProps[];
502
+ parallel: ParallelProps[];
503
+ final: FinalProps[];
504
+ history: HistoryProps[];
505
+ datamodel: DatamodelProps[];
506
+ invoke: InvokeProps[];
507
+ otherElement: Record<string, object>[];
508
+ id: string | null;
509
+ initialAttribute: string[];
510
+ otherAttributes: Record<string, object>;
511
+ }
512
+
513
+ export const defaultState = (): StateProps => ({
514
+ onentry: [],
515
+ onexit: [],
516
+ transition: [],
517
+ initial: [],
518
+ state: [],
519
+ parallel: [],
520
+ final: [],
521
+ history: [],
522
+ datamodel: [],
523
+ invoke: [],
524
+ otherElement: [],
525
+ id: null,
526
+ initialAttribute: [],
527
+ otherAttributes: {},
528
+ });
529
+ export interface TransitionProps {
530
+ otherElement: Record<string, object>[];
531
+ raiseValue: RaiseProps[];
532
+ ifValue: IfProps[];
533
+ foreach: ForeachProps[];
534
+ send: SendProps[];
535
+ script: ScriptProps[];
536
+ assign: AssignProps[];
537
+ log: LogProps[];
538
+ cancel: CancelProps[];
539
+ event: string | null;
540
+ cond: string | null;
541
+ target: string[];
542
+ typeValue: TransitionTypeDatatypeProps | null;
543
+ otherAttributes: Record<string, object>;
544
+ }
545
+
546
+ export const defaultTransition = (): TransitionProps => ({
547
+ otherElement: [],
548
+ raiseValue: [],
549
+ ifValue: [],
550
+ foreach: [],
551
+ send: [],
552
+ script: [],
553
+ assign: [],
554
+ log: [],
555
+ cancel: [],
556
+ event: null,
557
+ cond: null,
558
+ target: [],
559
+ typeValue: null,
560
+ otherAttributes: {},
561
+ });
562
+ export const TransitionTypeDatatypeProps = {
563
+ External: "external",
564
+ Internal: "internal",
565
+ } as const;
566
+
567
+ export type TransitionTypeDatatypeProps = typeof TransitionTypeDatatypeProps[keyof typeof TransitionTypeDatatypeProps];
568
+
569
+ export type Kind = "number" | "string" | "record<string, object>" | "number[]" | "string[]"
570
+ | "record<string, object>[]" | "assign" | "assigntypedatatype" | "bindingdatatype" | "booleandatatype"
571
+ | "cancel" | "content" | "data" | "datamodel" | "donedata" | "else" | "elseif"
572
+ | "exmodedatatype" | "final" | "finalize" | "foreach" | "history" | "historytypedatatype" | "if"
573
+ | "initial" | "invoke" | "log" | "onentry" | "onexit" | "parallel" | "param" | "raise"
574
+ | "script" | "scxml" | "send" | "state" | "transition" | "transitiontypedatatype";
575
+
576
+ export type PropsUnion = null | string | number | Record<string, object> | string[] | number[]
577
+ | Record<string, object>[] | AssignProps | AssignTypeDatatypeProps | BindingDatatypeProps
578
+ | BooleanDatatypeProps | CancelProps | ContentProps | DataProps | DatamodelProps | DonedataProps
579
+ | ElseProps | ElseifProps | ExmodeDatatypeProps | FinalProps | FinalizeProps | ForeachProps
580
+ | HistoryProps | HistoryTypeDatatypeProps | IfProps | InitialProps | InvokeProps | LogProps
581
+ | OnentryProps | OnexitProps | ParallelProps | ParamProps | RaiseProps | ScriptProps
582
+ | ScxmlProps | SendProps | StateProps | TransitionProps | TransitionTypeDatatypeProps;
583
+
584
+ export type KindMap = {
585
+ assign: AssignProps
586
+ assigntypedatatype: AssignTypeDatatypeProps
587
+ bindingdatatype: BindingDatatypeProps
588
+ booleandatatype: BooleanDatatypeProps
589
+ cancel: CancelProps
590
+ content: ContentProps
591
+ data: DataProps
592
+ datamodel: DatamodelProps
593
+ donedata: DonedataProps
594
+ else: ElseProps
595
+ elseif: ElseifProps
596
+ exmodedatatype: ExmodeDatatypeProps
597
+ final: FinalProps
598
+ finalize: FinalizeProps
599
+ foreach: ForeachProps
600
+ history: HistoryProps
601
+ historytypedatatype: HistoryTypeDatatypeProps
602
+ if: IfProps
603
+ initial: InitialProps
604
+ invoke: InvokeProps
605
+ log: LogProps
606
+ onentry: OnentryProps
607
+ onexit: OnexitProps
608
+ parallel: ParallelProps
609
+ param: ParamProps
610
+ raise: RaiseProps
611
+ script: ScriptProps
612
+ scxml: ScxmlProps
613
+ send: SendProps
614
+ state: StateProps
615
+ transition: TransitionProps
616
+ transitiontypedatatype: TransitionTypeDatatypeProps
617
+ }
618
+
@@ -0,0 +1,452 @@
1
+ /**
2
+ * scjsonProps.d.ts : Properties definition file for scjson types
3
+ *
4
+ * Part of the scjson project.
5
+ * Developed by Softoboros Technology Inc.
6
+ * Licensed under the BSD 1-Clause License.
7
+ */
8
+
9
+ export interface AssignProps {
10
+ location: string;
11
+ expr: string | null;
12
+ typeValue: typeof AssignTypeDatatypeProps;
13
+ attr: string | null;
14
+ otherAttributes: Record<string, object>;
15
+ content: Record<string, object>[];
16
+ }
17
+
18
+ export declare const defaultAssign: () => AssignProps;
19
+
20
+ export type AssignTypeDatatypePropsType =
21
+ | "addattribute"
22
+ | "delete"
23
+ | "firstchild"
24
+ | "lastchild"
25
+ | "nextsibling"
26
+ | "previoussibling"
27
+ | "replace"
28
+ | "replacechildren"
29
+ ;
30
+
31
+ export declare const AssignTypeDatatypeProps: {
32
+ readonly Addattribute: "addattribute",
33
+ readonly Delete: "delete",
34
+ readonly Firstchild: "firstchild",
35
+ readonly Lastchild: "lastchild",
36
+ readonly Nextsibling: "nextsibling",
37
+ readonly Previoussibling: "previoussibling",
38
+ readonly Replace: "replace",
39
+ readonly Replacechildren: "replacechildren",
40
+ };
41
+
42
+ export type BindingDatatypePropsType =
43
+ | "early"
44
+ | "late"
45
+ ;
46
+
47
+ export declare const BindingDatatypeProps: {
48
+ readonly Early: "early",
49
+ readonly Late: "late",
50
+ };
51
+
52
+ export type BooleanDatatypePropsType =
53
+ | "false"
54
+ | "true"
55
+ ;
56
+
57
+ export declare const BooleanDatatypeProps: {
58
+ readonly False: "false",
59
+ readonly True: "true",
60
+ };
61
+
62
+ export interface CancelProps {
63
+ otherElement: Record<string, object>[];
64
+ sendid: string | null;
65
+ sendidexpr: string | null;
66
+ otherAttributes: Record<string, object>;
67
+ }
68
+
69
+ export declare const defaultCancel: () => CancelProps;
70
+
71
+ export interface ContentProps {
72
+ otherAttributes: Record<string, object>;
73
+ expr: string | null;
74
+ content: Record<string, object>[];
75
+ }
76
+
77
+ export declare const defaultContent: () => ContentProps;
78
+
79
+ export interface DataProps {
80
+ id: string;
81
+ src: string | null;
82
+ expr: string | null;
83
+ otherAttributes: Record<string, object>;
84
+ content: Record<string, object>[];
85
+ }
86
+
87
+ export declare const defaultData: () => DataProps;
88
+
89
+ export interface DatamodelProps {
90
+ data: DataProps[];
91
+ otherElement: Record<string, object>[];
92
+ otherAttributes: Record<string, object>;
93
+ }
94
+
95
+ export declare const defaultDatamodel: () => DatamodelProps;
96
+
97
+ export interface DonedataProps {
98
+ content: ContentProps | null;
99
+ param: ParamProps[];
100
+ otherAttributes: Record<string, object>;
101
+ }
102
+
103
+ export declare const defaultDonedata: () => DonedataProps;
104
+
105
+ export interface ElseProps {
106
+ otherAttributes: Record<string, object>;
107
+ }
108
+
109
+ export declare const defaultElse: () => ElseProps;
110
+
111
+ export interface ElseifProps {
112
+ cond: string;
113
+ otherAttributes: Record<string, object>;
114
+ }
115
+
116
+ export declare const defaultElseif: () => ElseifProps;
117
+
118
+ export type ExmodeDatatypePropsType =
119
+ | "lax"
120
+ | "strict"
121
+ ;
122
+
123
+ export declare const ExmodeDatatypeProps: {
124
+ readonly Lax: "lax",
125
+ readonly Strict: "strict",
126
+ };
127
+
128
+ export interface FinalProps {
129
+ onentry: OnentryProps[];
130
+ onexit: OnexitProps[];
131
+ donedata: DonedataProps[];
132
+ otherElement: Record<string, object>[];
133
+ id: string | null;
134
+ otherAttributes: Record<string, object>;
135
+ }
136
+
137
+ export declare const defaultFinal: () => FinalProps;
138
+
139
+ export interface FinalizeProps {
140
+ otherElement: Record<string, object>[];
141
+ raiseValue: RaiseProps[];
142
+ ifValue: IfProps[];
143
+ foreach: ForeachProps[];
144
+ send: SendProps[];
145
+ script: ScriptProps[];
146
+ assign: AssignProps[];
147
+ log: LogProps[];
148
+ cancel: CancelProps[];
149
+ otherAttributes: Record<string, object>;
150
+ }
151
+
152
+ export declare const defaultFinalize: () => FinalizeProps;
153
+
154
+ export interface ForeachProps {
155
+ otherElement: Record<string, object>[];
156
+ raiseValue: RaiseProps[];
157
+ ifValue: IfProps[];
158
+ foreach: ForeachProps[];
159
+ send: SendProps[];
160
+ script: ScriptProps[];
161
+ assign: AssignProps[];
162
+ log: LogProps[];
163
+ cancel: CancelProps[];
164
+ array: string;
165
+ item: string;
166
+ index: string | null;
167
+ otherAttributes: Record<string, object>;
168
+ }
169
+
170
+ export declare const defaultForeach: () => ForeachProps;
171
+
172
+ export interface HistoryProps {
173
+ otherElement: Record<string, object>[];
174
+ transition: TransitionProps;
175
+ id: string | null;
176
+ typeValue: typeof HistoryTypeDatatypeProps | null;
177
+ otherAttributes: Record<string, object>;
178
+ }
179
+
180
+ export declare const defaultHistory: () => HistoryProps;
181
+
182
+ export type HistoryTypeDatatypePropsType =
183
+ | "deep"
184
+ | "shallow"
185
+ ;
186
+
187
+ export declare const HistoryTypeDatatypeProps: {
188
+ readonly Deep: "deep",
189
+ readonly Shallow: "shallow",
190
+ };
191
+
192
+ export interface IfProps {
193
+ otherElement: Record<string, object>[];
194
+ raiseValue: RaiseProps[];
195
+ ifValue: IfProps[];
196
+ foreach: ForeachProps[];
197
+ send: SendProps[];
198
+ script: ScriptProps[];
199
+ assign: AssignProps[];
200
+ log: LogProps[];
201
+ cancel: CancelProps[];
202
+ elseif: ElseifProps | null;
203
+ elseValue: ElseProps | null;
204
+ cond: string;
205
+ otherAttributes: Record<string, object>;
206
+ }
207
+
208
+ export declare const defaultIf: () => IfProps;
209
+
210
+ export interface InitialProps {
211
+ otherElement: Record<string, object>[];
212
+ transition: TransitionProps;
213
+ otherAttributes: Record<string, object>;
214
+ }
215
+
216
+ export declare const defaultInitial: () => InitialProps;
217
+
218
+ export interface InvokeProps {
219
+ content: ContentProps[];
220
+ param: ParamProps[];
221
+ finalize: FinalizeProps[];
222
+ otherElement: Record<string, object>[];
223
+ typeValue: string;
224
+ typeexpr: string | null;
225
+ src: string | null;
226
+ srcexpr: string | null;
227
+ id: string | null;
228
+ idlocation: string | null;
229
+ namelist: string | null;
230
+ autoforward: typeof BooleanDatatypeProps;
231
+ otherAttributes: Record<string, object>;
232
+ }
233
+
234
+ export declare const defaultInvoke: () => InvokeProps;
235
+
236
+ export interface LogProps {
237
+ otherElement: Record<string, object>[];
238
+ label: string | null;
239
+ expr: string | null;
240
+ otherAttributes: Record<string, object>;
241
+ }
242
+
243
+ export declare const defaultLog: () => LogProps;
244
+
245
+ export interface OnentryProps {
246
+ otherElement: Record<string, object>[];
247
+ raiseValue: RaiseProps[];
248
+ ifValue: IfProps[];
249
+ foreach: ForeachProps[];
250
+ send: SendProps[];
251
+ script: ScriptProps[];
252
+ assign: AssignProps[];
253
+ log: LogProps[];
254
+ cancel: CancelProps[];
255
+ otherAttributes: Record<string, object>;
256
+ }
257
+
258
+ export declare const defaultOnentry: () => OnentryProps;
259
+
260
+ export interface OnexitProps {
261
+ otherElement: Record<string, object>[];
262
+ raiseValue: RaiseProps[];
263
+ ifValue: IfProps[];
264
+ foreach: ForeachProps[];
265
+ send: SendProps[];
266
+ script: ScriptProps[];
267
+ assign: AssignProps[];
268
+ log: LogProps[];
269
+ cancel: CancelProps[];
270
+ otherAttributes: Record<string, object>;
271
+ }
272
+
273
+ export declare const defaultOnexit: () => OnexitProps;
274
+
275
+ export interface ParallelProps {
276
+ onentry: OnentryProps[];
277
+ onexit: OnexitProps[];
278
+ transition: TransitionProps[];
279
+ state: StateProps[];
280
+ parallel: ParallelProps[];
281
+ history: HistoryProps[];
282
+ datamodel: DatamodelProps[];
283
+ invoke: InvokeProps[];
284
+ otherElement: Record<string, object>[];
285
+ id: string | null;
286
+ otherAttributes: Record<string, object>;
287
+ }
288
+
289
+ export declare const defaultParallel: () => ParallelProps;
290
+
291
+ export interface ParamProps {
292
+ otherElement: Record<string, object>[];
293
+ name: string;
294
+ expr: string | null;
295
+ location: string | null;
296
+ otherAttributes: Record<string, object>;
297
+ }
298
+
299
+ export declare const defaultParam: () => ParamProps;
300
+
301
+ export interface RaiseProps {
302
+ event: string;
303
+ otherAttributes: Record<string, object>;
304
+ }
305
+
306
+ export declare const defaultRaise: () => RaiseProps;
307
+
308
+ export interface ScriptProps {
309
+ src: string | null;
310
+ otherAttributes: Record<string, object>;
311
+ content: Record<string, object>[];
312
+ }
313
+
314
+ export declare const defaultScript: () => ScriptProps;
315
+
316
+ export interface ScxmlProps {
317
+ state: StateProps[];
318
+ parallel: ParallelProps[];
319
+ final: FinalProps[];
320
+ datamodel: DatamodelProps[];
321
+ script: ScriptProps[];
322
+ otherElement: Record<string, object>[];
323
+ initial: string[];
324
+ name: string | null;
325
+ version: number | string;
326
+ datamodelAttribute: string;
327
+ binding: typeof BindingDatatypeProps | null;
328
+ exmode: typeof ExmodeDatatypeProps | null;
329
+ otherAttributes: Record<string, object>;
330
+ }
331
+
332
+ export declare const defaultScxml: () => ScxmlProps;
333
+
334
+ export interface SendProps {
335
+ content: ContentProps[];
336
+ param: ParamProps[];
337
+ otherElement: Record<string, object>[];
338
+ event: string | null;
339
+ eventexpr: string | null;
340
+ target: string | null;
341
+ targetexpr: string | null;
342
+ typeValue: string;
343
+ typeexpr: string | null;
344
+ id: string | null;
345
+ idlocation: string | null;
346
+ delay: string;
347
+ delayexpr: string | null;
348
+ namelist: string | null;
349
+ otherAttributes: Record<string, object>;
350
+ }
351
+
352
+ export declare const defaultSend: () => SendProps;
353
+
354
+ export interface StateProps {
355
+ onentry: OnentryProps[];
356
+ onexit: OnexitProps[];
357
+ transition: TransitionProps[];
358
+ initial: InitialProps[];
359
+ state: StateProps[];
360
+ parallel: ParallelProps[];
361
+ final: FinalProps[];
362
+ history: HistoryProps[];
363
+ datamodel: DatamodelProps[];
364
+ invoke: InvokeProps[];
365
+ otherElement: Record<string, object>[];
366
+ id: string | null;
367
+ initialAttribute: string[];
368
+ otherAttributes: Record<string, object>;
369
+ }
370
+
371
+ export declare const defaultState: () => StateProps;
372
+
373
+ export interface TransitionProps {
374
+ otherElement: Record<string, object>[];
375
+ raiseValue: RaiseProps[];
376
+ ifValue: IfProps[];
377
+ foreach: ForeachProps[];
378
+ send: SendProps[];
379
+ script: ScriptProps[];
380
+ assign: AssignProps[];
381
+ log: LogProps[];
382
+ cancel: CancelProps[];
383
+ event: string | null;
384
+ cond: string | null;
385
+ target: string[];
386
+ typeValue: typeof TransitionTypeDatatypeProps | null;
387
+ otherAttributes: Record<string, object>;
388
+ }
389
+
390
+ export declare const defaultTransition: () => TransitionProps;
391
+
392
+ export type TransitionTypeDatatypePropsType =
393
+ | "external"
394
+ | "internal"
395
+ ;
396
+
397
+ export declare const TransitionTypeDatatypeProps: {
398
+ readonly External: "external",
399
+ readonly Internal: "internal",
400
+ };
401
+
402
+ export type Kind = "number" | "string" | "record<string, object>" | "number[]" | "string[]"
403
+ | "record<string, object>[]" | "assign" | "assigntypedatatype" | "bindingdatatype" | "booleandatatype"
404
+ | "cancel" | "content" | "data" | "datamodel" | "donedata" | "else" | "elseif"
405
+ | "exmodedatatype" | "final" | "finalize" | "foreach" | "history" | "historytypedatatype" | "if"
406
+ | "initial" | "invoke" | "log" | "onentry" | "onexit" | "parallel" | "param" | "raise"
407
+ | "script" | "scxml" | "send" | "state" | "transition" | "transitiontypedatatype";
408
+
409
+ export type PropsUnion = null | string | number | Record<string, object> | string[] | number[]
410
+ | Record<string, object>[] | AssignProps | typeof AssignTypeDatatypeProps | typeof BindingDatatypeProps
411
+ | typeof BooleanDatatypeProps | CancelProps | ContentProps | DataProps | DatamodelProps | DonedataProps
412
+ | ElseProps | ElseifProps | typeof ExmodeDatatypeProps | FinalProps | FinalizeProps
413
+ | ForeachProps | HistoryProps | typeof HistoryTypeDatatypeProps | IfProps | InitialProps
414
+ | InvokeProps | LogProps | OnentryProps | OnexitProps | ParallelProps | ParamProps
415
+ | RaiseProps | ScriptProps | ScxmlProps | SendProps | StateProps | TransitionProps
416
+ | typeof TransitionTypeDatatypeProps;
417
+
418
+ export type KindMap = {
419
+ assign: AssignProps
420
+ assigntypedatatype: typeof AssignTypeDatatypeProps
421
+ bindingdatatype: typeof BindingDatatypeProps
422
+ booleandatatype: typeof BooleanDatatypeProps
423
+ cancel: CancelProps
424
+ content: ContentProps
425
+ data: DataProps
426
+ datamodel: DatamodelProps
427
+ donedata: DonedataProps
428
+ else: ElseProps
429
+ elseif: ElseifProps
430
+ exmodedatatype: typeof ExmodeDatatypeProps
431
+ final: FinalProps
432
+ finalize: FinalizeProps
433
+ foreach: ForeachProps
434
+ history: HistoryProps
435
+ historytypedatatype: typeof HistoryTypeDatatypeProps
436
+ if: IfProps
437
+ initial: InitialProps
438
+ invoke: InvokeProps
439
+ log: LogProps
440
+ onentry: OnentryProps
441
+ onexit: OnexitProps
442
+ parallel: ParallelProps
443
+ param: ParamProps
444
+ raise: RaiseProps
445
+ script: ScriptProps
446
+ scxml: ScxmlProps
447
+ send: SendProps
448
+ state: StateProps
449
+ transition: TransitionProps
450
+ transitiontypedatatype: typeof TransitionTypeDatatypeProps
451
+ }
452
+