@cyklang/cli 0.1.1 → 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.
Files changed (66) hide show
  1. package/build/AssetCommand.d.ts +4 -0
  2. package/build/AssetCommand.js +293 -0
  3. package/build/Cmd.d.ts +2 -1
  4. package/build/Cmd.js +3 -3
  5. package/build/DBClient.d.ts +1 -0
  6. package/build/DBClient.js +51 -17
  7. package/build/InitCommand.js +1 -1
  8. package/build/ModuleCommand.js +7 -6
  9. package/build/TableCommand.js +235 -45
  10. package/build/index.js +3 -0
  11. package/package.json +5 -2
  12. package/pgdata/entry.csv +22 -0
  13. package/pgdata/setting.csv +4 -0
  14. package/src/AssetCommand.ts +307 -0
  15. package/src/Cmd.ts +4 -3
  16. package/src/DBClient.ts +70 -31
  17. package/src/InitCommand.ts +1 -1
  18. package/src/ModuleCommand.ts +8 -5
  19. package/src/TableCommand.ts +269 -56
  20. package/src/index.ts +3 -0
  21. package/src/index.xml +10 -0
  22. package/test/cyklang.xsd +439 -0
  23. package/test/t0.output +4 -0
  24. package/test/t0.xml +26 -0
  25. package/test/t01.output +32 -0
  26. package/test/t01.xml +185 -0
  27. package/test/t02.output +10 -0
  28. package/test/t02.xml +88 -0
  29. package/test/t03.output +9 -0
  30. package/test/t03.xml +74 -0
  31. package/test/t04.output +29 -0
  32. package/test/t04.xml +116 -0
  33. package/test/t05.output +18 -0
  34. package/test/t05.xml +41 -0
  35. package/test/t06.output +4 -0
  36. package/test/t06.xml +16 -0
  37. package/test/t07.output +5 -0
  38. package/test/t07.xml +82 -0
  39. package/test/t08.output +8 -0
  40. package/test/t08.xml +57 -0
  41. package/test/t09.output +10 -0
  42. package/test/t09.xml +29 -0
  43. package/test/t10.xml +125 -0
  44. package/test/t11.output +3 -0
  45. package/test/t11.xml +25 -0
  46. package/test/t12.output +7 -0
  47. package/test/t12.xml +42 -0
  48. package/test/t13.xml +23 -0
  49. package/test/t14.output +50 -0
  50. package/test/t14.xml +82 -0
  51. package/test/t14.xsd +102 -0
  52. package/test/t15.xml +47 -0
  53. package/test/t16.output +49 -0
  54. package/test/t16.xml +86 -0
  55. package/test/t17.output +5 -0
  56. package/test/t17.xml +21 -0
  57. package/test/t18.output +22 -0
  58. package/test/t18.xml +59 -0
  59. package/test/t19.xml +234 -0
  60. package/test/t20.xml +15 -0
  61. package/test/t21.output +21 -0
  62. package/test/t21.xml +71 -0
  63. package/test/t22.xml +23 -0
  64. package/test/t23.xml +44 -0
  65. package/test/t24.xml +10 -0
  66. package/test/test.json +113 -0
@@ -0,0 +1,439 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
3
+
4
+ <xs:element name="module" type="defineModule"/>
5
+
6
+ <xs:complexType name="defineModule">
7
+ <xs:complexContent >
8
+ <xs:extension base="block">
9
+ <xs:attribute name="name" type="xs:string"/>
10
+ <xs:attribute name="dbname" type="xs:string"/>
11
+ <xs:attribute name="import" type="xs:string"/>
12
+ </xs:extension>
13
+ </xs:complexContent>
14
+ </xs:complexType>
15
+
16
+ <xs:complexType name="block">
17
+ <xs:group ref="instruction" minOccurs="0" maxOccurs="unbounded"/>
18
+ </xs:complexType>
19
+
20
+ <xs:group name="instruction">
21
+ <xs:choice>
22
+ <xs:element name="module" type="defineModule"/>
23
+ <xs:group ref="declareVariable"/>
24
+ <xs:element name="let" type="let_set"/>
25
+ <xs:element name="set" type="let_set"/>
26
+ <xs:element name="print" type="xs:string"/>
27
+ <xs:element ref="if"/>
28
+ <xs:element ref="call"/>
29
+ <xs:element name="block" type="block"/>
30
+ <xs:element name="break" type="xs:string"/>
31
+ <xs:element name="continue" type="xs:string"/>
32
+ <xs:element name="sleep" type="xs:string"/>
33
+ <xs:element ref="while"/>
34
+ <xs:element name="loop" type="block"/>
35
+ <xs:element ref="stringexec"/>
36
+ <xs:element name="parallel" type="block"/>
37
+
38
+ <!-- server side -->
39
+ <xs:element ref="db.table"/>
40
+ <xs:element ref="db.query"/>
41
+ <xs:element ref="db.insert"/>
42
+ <xs:element ref="db.update"/>
43
+ <xs:element ref="db.runquery"/>
44
+ <xs:element ref="db.select"/>
45
+ <xs:element ref="db.delete"/>
46
+ <xs:element ref="db.call"/>
47
+ </xs:choice>
48
+ </xs:group>
49
+
50
+ <xs:group name="declareVariable">
51
+ <xs:choice>
52
+ <xs:element ref="boolean"/>
53
+ <xs:element ref="number"/>
54
+ <xs:element ref="string"/>
55
+ <xs:element ref="datetime"/>
56
+ <xs:element ref="object"/>
57
+ <xs:element name="function" type="function_method"/>
58
+ <xs:element ref="type"/>
59
+ <xs:element name="module_object" type="moduleObject"/>
60
+
61
+ <!-- browser only -->
62
+ <xs:element ref="form"/>
63
+ </xs:choice>
64
+ </xs:group>
65
+
66
+ <xs:group name="declareVariable_method">
67
+ <xs:choice>
68
+ <xs:element ref="boolean"/>
69
+ <xs:element ref="number"/>
70
+ <xs:element ref="string"/>
71
+ <xs:element ref="datetime"/>
72
+ <xs:element ref="object"/>
73
+ <xs:element name="function"/>
74
+ <xs:element ref="type"/>
75
+
76
+ <xs:element name="method" type="function_method"/>
77
+ </xs:choice>
78
+ </xs:group>
79
+
80
+ <xs:element name="boolean">
81
+ <xs:complexType mixed="true">
82
+ <xs:attribute name="name" type="xs:string"/>
83
+ </xs:complexType>
84
+ </xs:element>
85
+
86
+ <xs:element name="number">
87
+ <xs:complexType mixed="true">
88
+ <xs:attribute name="name" type="xs:string"/>
89
+ </xs:complexType>
90
+ </xs:element>
91
+
92
+ <xs:element name="string">
93
+ <xs:annotation>
94
+ <!-- <xs:appinfo>string_appinfo</xs:appinfo> -->
95
+ <xs:documentation>declares a <i>string</i> variable</xs:documentation>
96
+ </xs:annotation>
97
+ <xs:complexType mixed="true">
98
+ <xs:attribute name="name" type="xs:string"/>
99
+ <xs:attribute name="literal" type="xs:string" fixed=""/>
100
+ </xs:complexType>
101
+ </xs:element>
102
+
103
+ <xs:element name="stringexec">
104
+ <xs:complexType>
105
+ <xs:simpleContent>
106
+ <xs:extension base="xs:string">
107
+ <xs:attribute name="literal" type="xs:string" fixed=""/>
108
+ </xs:extension>
109
+ </xs:simpleContent>
110
+ </xs:complexType>
111
+ </xs:element>
112
+
113
+ <xs:element name="datetime">
114
+ <xs:complexType mixed="true">
115
+ <xs:attribute name="name" type="xs:string"/>
116
+ </xs:complexType>
117
+ </xs:element>
118
+
119
+ <xs:element name="object">
120
+ <xs:complexType mixed="true">
121
+ <xs:group ref="declareVariable_method" minOccurs="0" maxOccurs="unbounded">
122
+ </xs:group>
123
+ <xs:attribute name="name" type="xs:string"/>
124
+ <xs:attribute name="type" type="xs:string"/>
125
+ </xs:complexType>
126
+ </xs:element>
127
+
128
+ <xs:element name="type">
129
+ <xs:complexType>
130
+ <xs:group ref="declareVariable_method" minOccurs="0" maxOccurs="unbounded"/>
131
+ <xs:attribute name="name" type="xs:string"/>
132
+ <xs:attribute name="type" type="xs:string"/>
133
+ <xs:attribute name="base" type="xs:string"/>
134
+ </xs:complexType>
135
+ </xs:element>
136
+
137
+ <xs:complexType name="moduleObject">
138
+ <xs:group ref="declareVariable" minOccurs="0" maxOccurs="unbounded"/>
139
+ <xs:attribute name="name" type="xs:string"/>
140
+ <xs:attribute name="dbname" type="xs:string"/>
141
+ </xs:complexType>
142
+
143
+ <xs:complexType name="let_set" mixed="true">
144
+ <xs:attribute name="name" type="xs:string"/>
145
+ </xs:complexType>
146
+
147
+ <xs:element name="print">
148
+ </xs:element>
149
+
150
+ <xs:complexType name="function_method">
151
+ <xs:sequence minOccurs="0">
152
+ <xs:group ref="declareVariable" minOccurs="0" maxOccurs="unbounded"/>
153
+ <xs:element name="block" type="block"/>
154
+ </xs:sequence>
155
+ <xs:attribute name="name" type="xs:string"/>
156
+ <xs:attribute name="returns" type="xs:string"/>
157
+ </xs:complexType>
158
+
159
+ <xs:element name="if">
160
+ <xs:complexType>
161
+ <xs:sequence>
162
+ <xs:group ref="conditionThen" minOccurs="1" maxOccurs="unbounded"/>
163
+ <xs:sequence minOccurs="0">
164
+ <xs:element name="else" type="block"/>
165
+ </xs:sequence>
166
+ </xs:sequence>
167
+ </xs:complexType>
168
+ </xs:element>
169
+
170
+ <xs:group name="conditionThen">
171
+ <xs:sequence>
172
+ <xs:element name="condition"/>
173
+ <xs:element name="then" type="block"/>
174
+ </xs:sequence>
175
+ </xs:group>
176
+
177
+ <xs:element name="call">
178
+ <xs:complexType>
179
+ <xs:group ref="declareVariable" minOccurs="0" maxOccurs="unbounded"/>
180
+ <xs:attribute name="function"/>
181
+ <xs:attribute name="returns"/>
182
+ <xs:attribute name="object"/>
183
+ <xs:attribute name="method"/>
184
+ </xs:complexType>
185
+ </xs:element>
186
+
187
+ <xs:element name="while">
188
+ <xs:complexType>
189
+ <xs:group ref="conditionThen"/>
190
+ </xs:complexType>
191
+ </xs:element>
192
+
193
+ <!--
194
+ server-side
195
+ -->
196
+
197
+ <xs:element name="db.table">
198
+ <xs:complexType>
199
+ <xs:group ref="defineColumn" minOccurs="1" maxOccurs="unbounded"/>
200
+ <xs:attribute name="name" type="xs:string"/>
201
+ </xs:complexType>
202
+ </xs:element>
203
+
204
+ <xs:group name="defineColumn">
205
+ <xs:choice>
206
+ <xs:element name="number" type="numberColumn"/>
207
+ <xs:element name="string" type="stringColumn"/>
208
+ <xs:element name="datetime" type="datetimeColumn"/>
209
+ <xs:element name="boolean" type="booleanColumn"/>
210
+ </xs:choice>
211
+ </xs:group>
212
+
213
+ <xs:complexType name="numberColumn">
214
+ <xs:attribute name="name" type="xs:string"/>
215
+ <xs:attribute name="type">
216
+ <xs:simpleType>
217
+ <xs:restriction base="xs:string">
218
+ <xs:enumeration value="int"></xs:enumeration>
219
+ </xs:restriction>
220
+ </xs:simpleType>
221
+ </xs:attribute>
222
+ <xs:attribute name="primary" fixed=""/>
223
+ <xs:attribute name="generated">
224
+ <xs:simpleType>
225
+ <xs:restriction base="xs:string">
226
+ <xs:enumeration value="by default"/>
227
+ </xs:restriction>
228
+ </xs:simpleType>
229
+ </xs:attribute>
230
+ </xs:complexType>
231
+
232
+ <xs:complexType name="stringColumn">
233
+ <xs:attribute name="name" type="xs:string"/>
234
+ <xs:attribute name="type">
235
+ <xs:simpleType>
236
+ <xs:restriction base="xs:string">
237
+ <xs:enumeration value="varchar"></xs:enumeration>
238
+ <xs:enumeration value="varchar(30)"></xs:enumeration>
239
+ <xs:enumeration value="varchar(50)"></xs:enumeration>
240
+ <xs:enumeration value="varchar(255)"></xs:enumeration>
241
+ <xs:enumeration value="text"></xs:enumeration>
242
+ </xs:restriction>
243
+ </xs:simpleType>
244
+ </xs:attribute>
245
+ <xs:attribute name="primary" fixed=""/>
246
+ </xs:complexType>
247
+
248
+ <xs:complexType name="datetimeColumn">
249
+ <xs:attribute name="name" type="xs:string"/>
250
+ <xs:attribute name="type">
251
+ <xs:simpleType>
252
+ <xs:restriction base="xs:string">
253
+ <xs:enumeration value="timestamp with time zone"></xs:enumeration>
254
+ </xs:restriction>
255
+ </xs:simpleType>
256
+ </xs:attribute>
257
+ <xs:attribute name="primary" fixed=""/>
258
+ <xs:attribute name="generated">
259
+ <xs:simpleType>
260
+ <xs:restriction base="xs:string">
261
+ <xs:enumeration value="by default"/>
262
+ </xs:restriction>
263
+ </xs:simpleType>
264
+ </xs:attribute>
265
+ </xs:complexType>
266
+
267
+ <xs:complexType name="booleanColumn">
268
+ <xs:attribute name="name" type="xs:string"/>
269
+ <xs:attribute name="type">
270
+ <xs:simpleType>
271
+ <xs:restriction base="xs:string">
272
+ <xs:enumeration value="boolean"></xs:enumeration>
273
+ </xs:restriction>
274
+ </xs:simpleType>
275
+ </xs:attribute>
276
+ </xs:complexType>
277
+
278
+ <xs:element name="db.query">
279
+ <xs:complexType>
280
+ <xs:group ref="declareQueryParameter" minOccurs="0" maxOccurs="unbounded"/>
281
+ <xs:attribute name="name" type="xs:string"/>
282
+ </xs:complexType>
283
+ </xs:element>
284
+
285
+ <xs:group name="declareQueryParameter">
286
+ <xs:choice>
287
+ <xs:element ref="boolean"/>
288
+ <xs:element ref="number"/>
289
+ <xs:element ref="string"/>
290
+ <xs:element ref="datetime"/>
291
+ </xs:choice>
292
+ </xs:group>
293
+
294
+ <xs:element name="db.insert">
295
+ <xs:complexType>
296
+ <xs:sequence>
297
+ <xs:element ref="object"/>
298
+ </xs:sequence>
299
+ <xs:attribute name="table" use="required" type="xs:string"/>
300
+ <xs:attribute name="returning_into" type="xs:string"/>
301
+ </xs:complexType>
302
+ </xs:element>
303
+
304
+ <xs:element name="db.update">
305
+ <xs:complexType>
306
+ <xs:sequence>
307
+ <xs:element ref="object"/>
308
+ </xs:sequence>
309
+ <xs:attribute name="table" use="required" type="xs:string"/>
310
+ <xs:attribute name="returning_into" type="xs:string"/>
311
+ </xs:complexType>
312
+ </xs:element>
313
+
314
+ <xs:element name="db.runquery">
315
+ <xs:complexType>
316
+ <xs:group ref="declareQueryParameter" minOccurs="0" maxOccurs="unbounded"/>
317
+ <xs:attribute name="name" use="required" type="xs:string"/>
318
+ <xs:attribute name="result" use="required" type="xs:string"/>
319
+ </xs:complexType>
320
+ </xs:element>
321
+
322
+ <xs:element name="db.select">
323
+ <xs:complexType>
324
+ <xs:group ref="declareQueryParameter" minOccurs="0" maxOccurs="unbounded"/>
325
+ <xs:attribute name="table" use="required" type="xs:string"/>
326
+ <xs:attribute name="result" use="required" type="xs:string"/>
327
+ </xs:complexType>
328
+ </xs:element>
329
+
330
+ <xs:element name="db.delete">
331
+ <xs:complexType>
332
+ <xs:sequence>
333
+ <xs:element ref="object"/>
334
+ </xs:sequence>
335
+ <xs:attribute name="table" use="required" type="xs:string"/>
336
+ </xs:complexType>
337
+ </xs:element>
338
+
339
+ <xs:element name="db.call">
340
+ <xs:complexType>
341
+ <xs:group ref="declareQueryParameter" minOccurs="0" maxOccurs="unbounded"/>
342
+ <xs:attribute name="module" use="required" type="xs:string"/>
343
+ <xs:attribute name="method" use="required" type="xs:string"/>
344
+ <xs:attribute name="returns" type="xs:string"/>
345
+ </xs:complexType>
346
+ </xs:element>
347
+
348
+ <!--
349
+ browser-only
350
+ -->
351
+
352
+ <xs:element name="form" type="formComponent">
353
+ </xs:element>
354
+
355
+ <xs:complexType name="formComponent">
356
+ <xs:complexContent>
357
+ <xs:extension base="gridComponent">
358
+ <xs:attribute name="name" type="xs:string"/>
359
+ </xs:extension>
360
+ </xs:complexContent>
361
+ </xs:complexType>
362
+
363
+ <xs:complexType name="gridComponent" mixed="true">
364
+ <xs:sequence>
365
+ <xs:group ref="gridParameter" minOccurs="0" maxOccurs="unbounded"/>
366
+ <xs:group ref="component" minOccurs="0" maxOccurs="unbounded"/>
367
+ </xs:sequence>
368
+ <xs:attribute name="template-columns" type="xs:string"/>
369
+ <xs:attribute name="column" type="xs:string"/>
370
+ </xs:complexType>
371
+
372
+ <xs:group name="gridParameter">
373
+ <xs:choice>
374
+ <xs:element ref="string"/>
375
+ <xs:element ref="boolean"/>
376
+ </xs:choice>
377
+ </xs:group>
378
+
379
+ <xs:group name="component">
380
+ <xs:choice>
381
+ <xs:element name="grid" type="gridComponent"/>
382
+ <xs:element name="input" type="inputComponent"/>
383
+ <xs:element name="button" type="buttonComponent"/>
384
+ <xs:element name="field" type="fieldComponent"/>
385
+ </xs:choice>
386
+ </xs:group>
387
+
388
+ <xs:complexType name="inputComponent">
389
+ <xs:group ref="componentTemplate" minOccurs="0" maxOccurs="unbounded"/>
390
+ <xs:attribute name="model" type="xs:string"/>
391
+ <xs:attribute name="readonly" type="xs:string"/>
392
+ <xs:attribute name="disable" type="xs:string"/>
393
+ <xs:attribute name="type" type="xs:string"/>
394
+ <xs:attribute name="label" type="xs:string"/>
395
+ <xs:attribute name="color" type="xs:string"/>
396
+ <xs:attribute name="bg-color" type="xs:string"/>
397
+ <xs:attribute name="stack-label" type="xs:string"/>
398
+ <xs:attribute name="hint" type="xs:string"/>
399
+ <xs:attribute name="dense" type="xs:string"/>
400
+ <xs:attribute name="filled" type="xs:string"/>
401
+ <xs:attribute name="outlined" type="xs:string"/>
402
+ <xs:attribute name="standout" type="xs:string"/>
403
+ <xs:attribute name="borderless" type="xs:string"/>
404
+ <xs:attribute name="rounded" type="xs:string"/>
405
+ <xs:attribute name="square" type="xs:string"/>
406
+ <xs:attribute name="autogrow" type="xs:string"/>
407
+ </xs:complexType>
408
+
409
+ <xs:complexType name="buttonComponent">
410
+ <xs:group ref="buttonEvent" minOccurs="0" maxOccurs="1"/>
411
+ <xs:attribute name="icon" type="xs:string"/>
412
+ <xs:attribute name="label" type="xs:string"/>
413
+ </xs:complexType>
414
+
415
+ <xs:group name="buttonEvent">
416
+ <xs:choice>
417
+ <xs:element name="onclick" type="block"/>
418
+ </xs:choice>
419
+ </xs:group>
420
+
421
+ <xs:complexType name="fieldComponent">
422
+ <xs:group ref="componentTemplate" minOccurs="0" maxOccurs="unbounded"/>
423
+ </xs:complexType>
424
+
425
+ <xs:group name="componentTemplate">
426
+ <xs:choice>
427
+ <xs:element name="template" type="template"/>
428
+ </xs:choice>
429
+ </xs:group>
430
+
431
+ <xs:complexType name="template">
432
+ <xs:simpleContent>
433
+ <xs:extension base="xs:string">
434
+ <xs:attribute name="name" type="xs:string"/>
435
+ </xs:extension>
436
+ </xs:simpleContent>
437
+ </xs:complexType>
438
+
439
+ </xs:schema>
package/test/t0.output ADDED
@@ -0,0 +1,4 @@
1
+ Aujourd'hui c'est 28/12/2021
2
+ 2812
3
+ 40
4
+ dos1.id = 1 dos.libelle = DUPONT
package/test/t0.xml ADDED
@@ -0,0 +1,26 @@
1
+ <block>
2
+ <type name="dossier">
3
+ <number name="id" />
4
+ <string name="libelle" />
5
+ </type>
6
+
7
+ <number name="jour"/>
8
+ <number name="mois" />
9
+ <number name="annee" />
10
+ <string name="message" />
11
+ <let name="jour">28</let>
12
+ <let name="mois">12</let>
13
+ <let name="annee">2021</let>
14
+ <let name="message">"Aujourd'hui c'est " + jour + "/" + mois + "/" + annee</let>
15
+ <print>message</print>
16
+ <print>"28" + "12"</print>
17
+ <print>28 + 12</print>
18
+
19
+ <dossier name="dos1" />
20
+
21
+
22
+ <let name="dos1.id">1</let>
23
+ <let name="dos1.libelle">"DUPONT"</let>
24
+ <print>"dos1.id = "+ dos1.id + " dos.libelle = " + dos1.libelle</print>
25
+
26
+ </block>
@@ -0,0 +1,32 @@
1
+ ******* Mon nom est Dossier DUPONT id 1
2
+ Dossier remorquage : DURAND lieu Saint-Denis
3
+ then dos2.libelle == DURAND
4
+ Nested block dos1.id 1
5
+ *** Function add BEGIN150
6
+ **** Function add output c =450
7
+ Result 150 + 300 : 450
8
+ *** Function add BEGIN1000
9
+ **** Function add output c =3000
10
+ Result 1000 + 2000 : 3000
11
+ Before fact of 4
12
+ factorielle de 4 = 24
13
+ factorielle de 5 : 120
14
+ PST1 id=100 libelle=Prestation 1
15
+ PST2 id=100 libelle=Prestation 2
16
+ PST1 id=100 libelle=Prestation 2
17
+ dos1.prestation.libelle = Prestation 2
18
+ sum 150
19
+ sum 50
20
+ sum 10
21
+ sum = 210
22
+ dump double[]
23
+ double[] element : 300
24
+ double[] element : 100
25
+ double[] element : 20
26
+ sum = 420
27
+ dos3 300 dossier 300
28
+ <number name="id">1000</number>
29
+ <string name="libelle" literal="">libellé dossier</string>
30
+ Vidage de l'object pst1 :
31
+ name id, value 100
32
+ name libelle, value Prestation 2