@fugood/bricks-project 2.25.0-beta.21 → 2.25.0-beta.23

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.
@@ -0,0 +1,119 @@
1
+ /* Auto generated by build script */
2
+ import type { DataCalculationData, DataCommand, DataCalcInput, DataCalcOutput } from './base'
3
+
4
+ /* Defaults — Assigns property of objects to new object for all destination properties that resolve to undefined. Source objects are applied from left to right. Once a property is set, additional values of the same property are ignored. */
5
+ export type DataCommandObjectDefaults = DataCommand & {
6
+ __commandName: 'OBJECT_DEFAULTS'
7
+ inputs?: Array<DataCalcInput<'obj_list', Array<object>> /* default: [] */>
8
+ outputs?: Array<DataCalcOutput<'result'> /* target: object */>
9
+ }
10
+
11
+ /* Defaults Deep — This command is like OBJECT_DEFAULTS except that it recursively assigns default properties. */
12
+ export type DataCommandObjectDefaultsDeep = DataCommand & {
13
+ __commandName: 'OBJECT_DEFAULTS_DEEP'
14
+ inputs?: Array<DataCalcInput<'obj_list', Array<object>> /* default: [] */>
15
+ outputs?: Array<DataCalcOutput<'result'> /* target: object */>
16
+ }
17
+
18
+ /* Get — Get value by path in object (Use `.` for subpaths, return obj if path is empty) */
19
+ export type DataCommandObjectGet = DataCommand & {
20
+ __commandName: 'OBJECT_GET'
21
+ inputs?: Array<
22
+ | DataCalcInput<'obj', object | Array<any>> /* default: {} */
23
+ | DataCalcInput<'path', string> /* default: "" */
24
+ >
25
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
26
+ }
27
+
28
+ /* Has — Check path exists in the object (Use `.` for subpaths) */
29
+ export type DataCommandObjectHas = DataCommand & {
30
+ __commandName: 'OBJECT_HAS'
31
+ inputs?: Array<
32
+ | DataCalcInput<'obj', object | Array<any>> /* default: {} */
33
+ | DataCalcInput<'path', string> /* default: "" */
34
+ >
35
+ outputs?: Array<DataCalcOutput<'result'> /* target: boolean */>
36
+ }
37
+
38
+ /* Keys — Get keys array of object */
39
+ export type DataCommandObjectKeys = DataCommand & {
40
+ __commandName: 'OBJECT_KEYS'
41
+ inputs?: Array<DataCalcInput<'obj', object> /* default: {} */>
42
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
43
+ }
44
+
45
+ /* Map Keys — Assign new object with new keys.
46
+ If property_path provided, it will use OBJECT_GET to get values as property key, then output to result.
47
+ If property_path not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_key, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
48
+ export type DataCommandObjectMapKeys = DataCommand & {
49
+ __commandName: 'OBJECT_MAP_KEYS'
50
+ inputs?: Array<
51
+ | DataCalcInput<'obj', object> /* default: {} */
52
+ | DataCalcInput<'property_path', string> /* default: undefined */
53
+ | DataCalcInput<
54
+ 'iteratee_result_key',
55
+ any
56
+ > /* iteratee callback input */ /* default: undefined */
57
+ >
58
+ outputs?: Array<
59
+ | DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
60
+ | DataCalcOutput<'result'> /* target: object */
61
+ >
62
+ }
63
+
64
+ /* Map Values — Assign new object with new values.
65
+ If property_path provided, it will use OBJECT_GET to get values as property value, then output to result.
66
+ If property_path not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_value, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
67
+ export type DataCommandObjectMapValues = DataCommand & {
68
+ __commandName: 'OBJECT_MAP_VALUES'
69
+ inputs?: Array<
70
+ | DataCalcInput<'obj', object> /* default: {} */
71
+ | DataCalcInput<'property_path', string> /* default: undefined */
72
+ | DataCalcInput<
73
+ 'iteratee_result_key',
74
+ any
75
+ > /* iteratee callback input */ /* default: undefined */
76
+ >
77
+ outputs?: Array<
78
+ | DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
79
+ | DataCalcOutput<'result'> /* target: object */
80
+ >
81
+ }
82
+
83
+ /* Omit — Return new object omitted by path_list */
84
+ export type DataCommandObjectOmit = DataCommand & {
85
+ __commandName: 'OBJECT_OMIT'
86
+ inputs?: Array<
87
+ | DataCalcInput<'obj', object> /* default: {} */
88
+ | DataCalcInput<'path_list', Array<string>> /* default: [] */
89
+ >
90
+ outputs?: Array<DataCalcOutput<'result'> /* target: object */>
91
+ }
92
+
93
+ /* Pick — Return new object picked by path_list */
94
+ export type DataCommandObjectPick = DataCommand & {
95
+ __commandName: 'OBJECT_PICK'
96
+ inputs?: Array<
97
+ | DataCalcInput<'obj', object> /* default: {} */
98
+ | DataCalcInput<'path_list', Array<string>> /* default: [] */
99
+ >
100
+ outputs?: Array<DataCalcOutput<'result'> /* target: object */>
101
+ }
102
+
103
+ /* Set — Set value for path of object (Use `.` for subpaths) */
104
+ export type DataCommandObjectSet = DataCommand & {
105
+ __commandName: 'OBJECT_SET'
106
+ inputs?: Array<
107
+ | DataCalcInput<'obj', object> /* default: {} */
108
+ | DataCalcInput<'path', string> /* default: "" */
109
+ | DataCalcInput<'value', any>
110
+ >
111
+ outputs?: Array<DataCalcOutput<'result'> /* target: object */>
112
+ }
113
+
114
+ /* Values — Get values array of object */
115
+ export type DataCommandObjectValues = DataCommand & {
116
+ __commandName: 'OBJECT_VALUES'
117
+ inputs?: Array<DataCalcInput<'obj', object> /* default: {} */>
118
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
119
+ }
@@ -0,0 +1,58 @@
1
+ /* Auto generated by build script */
2
+ import type { DataCalculationData, DataCommand, DataCalcInput, DataCalcOutput } from './base'
3
+
4
+ /* Get Error — Get error of result from SANDBOX_RUN */
5
+ export type DataCommandSandboxGetError = DataCommand & {
6
+ __commandName: 'SANDBOX_GET_ERROR'
7
+ inputs?: Array<DataCalcInput<'result', object> /* default: {} */>
8
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
9
+ }
10
+
11
+ /* Get Return Value — Get returnValue of result from SANDBOX_RUN */
12
+ export type DataCommandSandboxGetReturnValue = DataCommand & {
13
+ __commandName: 'SANDBOX_GET_RETURN_VALUE'
14
+ inputs?: Array<DataCalcInput<'result', object> /* default: {} */>
15
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
16
+ }
17
+
18
+ /* Run JS — Run JavaScript code
19
+
20
+ - Default `use strict`
21
+ - Global functions fetch, XMLHttpRequest, setTimeout, setInterval... are not available.
22
+
23
+ ##### Available libraries (global)
24
+
25
+ - invariant
26
+ - bytes
27
+ - ms
28
+ - qs
29
+ - url
30
+ - nanoid
31
+ - md5
32
+ - json5
33
+ - lodash and _
34
+ - mathjs and math
35
+ - voca
36
+ - moment
37
+ - chroma
38
+ - kjurJWS (KJUR.jws.JWS from https://github.com/kjur/jsrsasign/wiki/Tutorial-for-JWT-generation)
39
+ - crypto
40
+ - base45
41
+ - cbor (Not support async)
42
+ - coseVerify (cose.sign.verifySync from https://github.com/erdtman/COSE-JS)
43
+ - fflate (Not support async, callback and stream)
44
+ - iconv (Use iconv-lite)
45
+ - OpenCC (Use opencc-js)
46
+
47
+ Android: Running on the sandbox of Hermes engine
48
+
49
+ iOS: Running on the sandbox of iOS built-in JavaScriptCore */
50
+ export type DataCommandSandboxRunJavascript = DataCommand & {
51
+ __commandName: 'SANDBOX_RUN_JAVASCRIPT'
52
+ inputs?: Array<
53
+ | DataCalcInput<'code', string> /* default: "" */
54
+ | DataCalcInput<'inputs', any> /* default: undefined */
55
+ | DataCalcInput<'enable_async', boolean> /* default: false */
56
+ >
57
+ outputs?: Array<DataCalcOutput<'result'> /* target: object */>
58
+ }
@@ -0,0 +1,407 @@
1
+ /* Auto generated by build script */
2
+ import type { DataCalculationData, DataCommand, DataCalcInput, DataCalcOutput } from './base'
3
+
4
+ /* Base64 Decode — Decode from base64. If decode failed, return empty string. */
5
+ export type DataCommandStringBase64Decode = DataCommand & {
6
+ __commandName: 'STRING_BASE64_DECODE'
7
+ inputs?: Array<DataCalcInput<'base64', string> /* default: "" */>
8
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
9
+ }
10
+
11
+ /* Base64 Encode — Encode with base64 */
12
+ export type DataCommandStringBase64Encode = DataCommand & {
13
+ __commandName: 'STRING_BASE64_ENCODE'
14
+ inputs?: Array<DataCalcInput<'subject', any> /* default: "" */>
15
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
16
+ }
17
+
18
+ /* Camel Case — Convert to Camel Case */
19
+ export type DataCommandStringCamelCase = DataCommand & {
20
+ __commandName: 'STRING_CAMEL_CASE'
21
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
22
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
23
+ }
24
+
25
+ /* Capitalize — Capitalize string */
26
+ export type DataCommandStringCapitalize = DataCommand & {
27
+ __commandName: 'STRING_CAPITALIZE'
28
+ inputs?: Array<
29
+ | DataCalcInput<'subject', string> /* default: "" */
30
+ | DataCalcInput<'reset_to_lower', boolean> /* default: true */
31
+ >
32
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
33
+ }
34
+
35
+ /* Chars — Splits subject into an array of characters. */
36
+ export type DataCommandStringChars = DataCommand & {
37
+ __commandName: 'STRING_CHARS'
38
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
39
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
40
+ }
41
+
42
+ /* Char at — Access a character from `subject` at specified `position`. */
43
+ export type DataCommandStringCharAt = DataCommand & {
44
+ __commandName: 'STRING_CHAR_AT'
45
+ inputs?: Array<
46
+ | DataCalcInput<'subject', string> /* default: "" */
47
+ | DataCalcInput<'position', any> /* default: 0 */
48
+ >
49
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
50
+ }
51
+
52
+ /* Count — Counts the characters in subject. */
53
+ export type DataCommandStringCount = DataCommand & {
54
+ __commandName: 'STRING_COUNT'
55
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
56
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
57
+ }
58
+
59
+ /* Count graphemes — Counts the graphemes in subject taking care of surrogate pairs and combining marks. */
60
+ export type DataCommandStringCountGraphemes = DataCommand & {
61
+ __commandName: 'STRING_COUNT_GRAPHEMES'
62
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
63
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
64
+ }
65
+
66
+ /* Count Substrings — Counts the number of substring appearances in subject. */
67
+ export type DataCommandStringCountSubstrings = DataCommand & {
68
+ __commandName: 'STRING_COUNT_SUBSTRINGS'
69
+ inputs?: Array<
70
+ | DataCalcInput<'subject', string> /* default: "" */
71
+ | DataCalcInput<'substring', string> /* default: "" */
72
+ >
73
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
74
+ }
75
+
76
+ /* Count words — Counts the number of words in subject. */
77
+ export type DataCommandStringCountWords = DataCommand & {
78
+ __commandName: 'STRING_COUNT_WORDS'
79
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
80
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
81
+ }
82
+
83
+ /* Decapitalize — Ddecapitalize string */
84
+ export type DataCommandStringDecapitalize = DataCommand & {
85
+ __commandName: 'STRING_DECAPITALIZE'
86
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
87
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
88
+ }
89
+
90
+ /* First — Returns the first characters string. */
91
+ export type DataCommandStringFirst = DataCommand & {
92
+ __commandName: 'STRING_FIRST'
93
+ inputs?: Array<
94
+ | DataCalcInput<'subject', string> /* default: "" */
95
+ | DataCalcInput<'length', any> /* default: 1 */
96
+ >
97
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
98
+ }
99
+
100
+ /* Index of — Returns the first occurrence index of search in subject. */
101
+ export type DataCommandStringIndexOf = DataCommand & {
102
+ __commandName: 'STRING_INDEX_OF'
103
+ inputs?: Array<
104
+ | DataCalcInput<'subject', string> /* default: "" */
105
+ | DataCalcInput<'search', string> /* default: "" */
106
+ | DataCalcInput<'from_index', any> /* default: 0 */
107
+ | DataCalcInput<'is_reg_exp', boolean> /* default: false */
108
+ | DataCalcInput<'forward', boolean> /* default: true */
109
+ >
110
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
111
+ }
112
+
113
+ /* Insert — Inserts into subject a string toInsert at specified position. */
114
+ export type DataCommandStringInsert = DataCommand & {
115
+ __commandName: 'STRING_INSERT'
116
+ inputs?: Array<
117
+ | DataCalcInput<'subject', string> /* default: "" */
118
+ | DataCalcInput<'to_insert', string> /* default: "" */
119
+ | DataCalcInput<'position', any> /* default: Length of subject */
120
+ >
121
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
122
+ }
123
+
124
+ /* Join — Converts all elements in `array` into a string separated by `separator`. */
125
+ export type DataCommandStringJoin = DataCommand & {
126
+ __commandName: 'STRING_JOIN'
127
+ inputs?: Array<
128
+ | DataCalcInput<'array', Array<any>> /* default: [] */
129
+ | DataCalcInput<'separator', string> /* default: "," */
130
+ >
131
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
132
+ }
133
+
134
+ /* JSON Parse — Parse JSON String to object. Return undefined if parse failed. */
135
+ export type DataCommandStringJsonParse = DataCommand & {
136
+ __commandName: 'STRING_JSON_PARSE'
137
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "{}" */>
138
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
139
+ }
140
+
141
+ /* JSON Stringify — Stringify JSON */
142
+ export type DataCommandStringJsonStringify = DataCommand & {
143
+ __commandName: 'STRING_JSON_STRINGIFY'
144
+ inputs?: Array<
145
+ DataCalcInput<'value', any> /* default: {} */ | DataCalcInput<'space', any> /* default: 0 */
146
+ >
147
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
148
+ }
149
+
150
+ /* Kebab Case — Convert to Kebab Case */
151
+ export type DataCommandStringKebabCase = DataCommand & {
152
+ __commandName: 'STRING_KEBAB_CASE'
153
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
154
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
155
+ }
156
+
157
+ /* Last — Returns the last characters string. */
158
+ export type DataCommandStringLast = DataCommand & {
159
+ __commandName: 'STRING_LAST'
160
+ inputs?: Array<
161
+ | DataCalcInput<'subject', string> /* default: "" */
162
+ | DataCalcInput<'length', any> /* default: 1 */
163
+ >
164
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
165
+ }
166
+
167
+ /* Latinise — Latinises the subject by removing diacritic characters. */
168
+ export type DataCommandStringLatinise = DataCommand & {
169
+ __commandName: 'STRING_LATINISE'
170
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
171
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
172
+ }
173
+
174
+ /* Lower Case — Convert Lower Case */
175
+ export type DataCommandStringLowerCase = DataCommand & {
176
+ __commandName: 'STRING_LOWER_CASE'
177
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
178
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
179
+ }
180
+
181
+ /* Pad */
182
+ export type DataCommandStringPad = DataCommand & {
183
+ __commandName: 'STRING_PAD'
184
+ inputs?: Array<
185
+ | DataCalcInput<'subject', string> /* default: "" */
186
+ | DataCalcInput<'pad', string> /* default: " " */
187
+ | DataCalcInput<'length', any> /* default: Length of subject */
188
+ | DataCalcInput<'on_left', boolean> /* default: true */
189
+ | DataCalcInput<'on_right', boolean> /* default: true */
190
+ >
191
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
192
+ }
193
+
194
+ /* Prune — Truncates subject to a new length and does not break the words. */
195
+ export type DataCommandStringPrune = DataCommand & {
196
+ __commandName: 'STRING_PRUNE'
197
+ inputs?: Array<
198
+ | DataCalcInput<'subject', string> /* default: "" */
199
+ | DataCalcInput<'length', any> /* default: 1 */
200
+ | DataCalcInput<'end', string> /* default: "..." */
201
+ >
202
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
203
+ }
204
+
205
+ /* Repeat — Repeats the subject number of times. */
206
+ export type DataCommandStringRepeat = DataCommand & {
207
+ __commandName: 'STRING_REPEAT'
208
+ inputs?: Array<
209
+ | DataCalcInput<'subject', string> /* default: "" */
210
+ | DataCalcInput<'times', any> /* default: 1 */
211
+ >
212
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
213
+ }
214
+
215
+ /* Replace — Replace string, it directly do replacement if provided `replacement`.
216
+ If no replacement is provided, and the pattern match is successful, it will trigger invocation_input callback with property filtered by regex. Until the calculation trigger invocation_result, it will trigger result output. */
217
+ export type DataCommandStringReplace = DataCommand & {
218
+ __commandName: 'STRING_REPLACE'
219
+ inputs?: Array<
220
+ | DataCalcInput<'subject', string> /* default: "" */
221
+ | DataCalcInput<'pattern', string> /* default: "" */
222
+ | DataCalcInput<'replacement', string> /* default: undefined */
223
+ | DataCalcInput<
224
+ 'invocation_result',
225
+ string
226
+ > /* invocation callback input */ /* default: undefined */
227
+ | DataCalcInput<'is_reg_exp', boolean> /* default: false */
228
+ | DataCalcInput<'all', boolean> /* default: false */
229
+ >
230
+ outputs?: Array<
231
+ | DataCalcOutput<'invocation_input'> /* invocation callback */ /* target: object */
232
+ | DataCalcOutput<'result'> /* target: string */
233
+ >
234
+ }
235
+
236
+ /* Reverse — Reverses the subject. */
237
+ export type DataCommandStringReverse = DataCommand & {
238
+ __commandName: 'STRING_REVERSE'
239
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
240
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
241
+ }
242
+
243
+ /* Slice — Extracts from subject a string from start position up to end position. If end is negative use subject length + end. */
244
+ export type DataCommandStringSlice = DataCommand & {
245
+ __commandName: 'STRING_SLICE'
246
+ inputs?: Array<
247
+ | DataCalcInput<'subject', string> /* default: "" */
248
+ | DataCalcInput<'start', any> /* default: 0 */
249
+ | DataCalcInput<'end', any> /* default: Length of subject */
250
+ >
251
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
252
+ }
253
+
254
+ /* Slugify — Slugifies the subject. Cleans the subject by replacing diacritics with corresponding latin characters. */
255
+ export type DataCommandStringSlugify = DataCommand & {
256
+ __commandName: 'STRING_SLUGIFY'
257
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
258
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
259
+ }
260
+
261
+ /* Snake Case — Convert to Snake Case */
262
+ export type DataCommandStringSnakeCase = DataCommand & {
263
+ __commandName: 'STRING_SNAKE_CASE'
264
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
265
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
266
+ }
267
+
268
+ /* Splice — Changes subject by deleting delete_count of characters starting at position start. */
269
+ export type DataCommandStringSplice = DataCommand & {
270
+ __commandName: 'STRING_SPLICE'
271
+ inputs?: Array<
272
+ | DataCalcInput<'subject', string> /* default: "" */
273
+ | DataCalcInput<'start', any> /* default: 0 */
274
+ | DataCalcInput<'delete_count', any> /* default: Length of subject - start */
275
+ | DataCalcInput<'to_add', string> /* default: "" */
276
+ >
277
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
278
+ }
279
+
280
+ /* Split — Splits subject into an array of chunks by separator. */
281
+ export type DataCommandStringSplit = DataCommand & {
282
+ __commandName: 'STRING_SPLIT'
283
+ inputs?: Array<
284
+ | DataCalcInput<'subject', string> /* default: "" */
285
+ | DataCalcInput<'separactor', string> /* default: " " */
286
+ | DataCalcInput<'is_reg_exp', boolean> /* default: false */
287
+ | DataCalcInput<'limit', any> /* default: No Limit */
288
+ >
289
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
290
+ }
291
+
292
+ /* Substring — Extracts from subject a string from start position a number of length characters. */
293
+ export type DataCommandStringSubstr = DataCommand & {
294
+ __commandName: 'STRING_SUBSTR'
295
+ inputs?: Array<
296
+ | DataCalcInput<'subject', string> /* default: "" */
297
+ | DataCalcInput<'start', any> /* default: 0 */
298
+ | DataCalcInput<'length', any> /* default: Length to end of subject */
299
+ >
300
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
301
+ }
302
+
303
+ /* Swap Case — Swap case */
304
+ export type DataCommandStringSwapCase = DataCommand & {
305
+ __commandName: 'STRING_SWAP_CASE'
306
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
307
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
308
+ }
309
+
310
+ /* Template Literals — Make string with template literals (`Hello ${name}`) (Type: `${}` or `{{}}`) */
311
+ export type DataCommandStringTemplateLiterals = DataCommand & {
312
+ __commandName: 'STRING_TEMPLATE_LITERALS'
313
+ inputs?: Array<
314
+ | DataCalcInput<'template', string> /* default: "" */
315
+ | DataCalcInput<'data', object> /* default: {} */
316
+ | DataCalcInput<'type', string> /* default: "${}" */
317
+ >
318
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
319
+ }
320
+
321
+ /* Title Case — Convert to Title Case */
322
+ export type DataCommandStringTitleCase = DataCommand & {
323
+ __commandName: 'STRING_TITLE_CASE'
324
+ inputs?: Array<
325
+ | DataCalcInput<'subject', string> /* default: "" */
326
+ | DataCalcInput<'no_split', Array<string>> /* default: [] */
327
+ >
328
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
329
+ }
330
+
331
+ /* TOON Decode — Decode TOON string. Return undefined if decode failed. */
332
+ export type DataCommandStringToolDecode = DataCommand & {
333
+ __commandName: 'STRING_TOOL_DECODE'
334
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "{}" */>
335
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
336
+ }
337
+
338
+ /* TOON Encode — Encode TOON string. Return undefined if encode failed. */
339
+ export type DataCommandStringToolEncode = DataCommand & {
340
+ __commandName: 'STRING_TOOL_ENCODE'
341
+ inputs?: Array<DataCalcInput<'subject', any> /* default: {} */>
342
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
343
+ }
344
+
345
+ /* Trim — Removes whitespaces from left and right sides of the subject. */
346
+ export type DataCommandStringTrim = DataCommand & {
347
+ __commandName: 'STRING_TRIM'
348
+ inputs?: Array<
349
+ | DataCalcInput<'subject', string> /* default: "" */
350
+ | DataCalcInput<'white_space', string> /* default: " " */
351
+ | DataCalcInput<'on_left', boolean> /* default: true */
352
+ | DataCalcInput<'on_right', boolean> /* default: true */
353
+ >
354
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
355
+ }
356
+
357
+ /* Truncate — Truncates subject to a new length. */
358
+ export type DataCommandStringTruncate = DataCommand & {
359
+ __commandName: 'STRING_TRUNCATE'
360
+ inputs?: Array<
361
+ | DataCalcInput<'subject', string> /* default: "" */
362
+ | DataCalcInput<'length', any> /* default: 1 */
363
+ | DataCalcInput<'end', string> /* default: "..." */
364
+ >
365
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
366
+ }
367
+
368
+ /* Upper Case — Convert to upper case */
369
+ export type DataCommandStringUpperCase = DataCommand & {
370
+ __commandName: 'STRING_UPPER_CASE'
371
+ inputs?: Array<DataCalcInput<'subject', string> /* default: "" */>
372
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
373
+ }
374
+
375
+ /* Vprintf — Produces a string according to format. (See https://vocajs.com/#sprintf for more information) */
376
+ export type DataCommandStringVprintf = DataCommand & {
377
+ __commandName: 'STRING_VPRINTF'
378
+ inputs?: Array<
379
+ | DataCalcInput<'format', string> /* default: "" */
380
+ | DataCalcInput<'replacements', Array<any>> /* default: [] */
381
+ >
382
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
383
+ }
384
+
385
+ /* Words — Splits subject into an array of words. */
386
+ export type DataCommandStringWords = DataCommand & {
387
+ __commandName: 'STRING_WORDS'
388
+ inputs?: Array<
389
+ | DataCalcInput<'subject', string> /* default: "" */
390
+ | DataCalcInput<'pattern', string> /* default: undefined */
391
+ | DataCalcInput<'flags', string> /* default: "" */
392
+ >
393
+ outputs?: Array<DataCalcOutput<'result'> /* target: any */>
394
+ }
395
+
396
+ /* Word wrap — Wraps subject to a given number of characters using a string break character. */
397
+ export type DataCommandStringWordWrap = DataCommand & {
398
+ __commandName: 'STRING_WORD_WRAP'
399
+ inputs?: Array<
400
+ | DataCalcInput<'subject', string> /* default: "" */
401
+ | DataCalcInput<'width', any> /* default: 80 */
402
+ | DataCalcInput<'new_line', string> /* default: " */
403
+ | DataCalcInput<'indent', string> /* default: "" */
404
+ | DataCalcInput<'cut', boolean> /* default: false */
405
+ >
406
+ outputs?: Array<DataCalcOutput<'result'> /* target: string */>
407
+ }
package/types/data.ts CHANGED
@@ -32,7 +32,7 @@ export type Data<T = any> = DataDef & {
32
32
  // Persist data, so that the data will be keep after refresh.
33
33
  persistData?: boolean
34
34
  localSyncUpdateMode?: LocalSyncStrategy
35
- type: 'string' | 'number' | 'bool' | 'array' | 'object' | 'any'
35
+ type: 'string' | 'number' | 'bool' | 'boolean' | 'array' | 'object' | 'any'
36
36
  schema?: object
37
37
  hit_equal?: any
38
38
  hit_regex?: string
@@ -71,11 +71,11 @@ Default property:
71
71
  property?: {
72
72
  /* Connect printer on generator initialized */
73
73
  init?: boolean | DataLink
74
- /* Connection driver */
75
- driver?: 'escpos' | 'star' | 'tsc' | DataLink
76
- /* The address of the printer */
74
+ /* Connection driver (`castles` driver: built-in or WiFi printer on Castles Saturn PDA) */
75
+ driver?: 'escpos' | 'star' | 'tsc' | 'castles' | DataLink
76
+ /* The address of the printer (For castles driver: `mode=builtin` (Saturn 1000) or `mode=wifi` (Saturn 7000); optional `heatLevel=1-5`, default 3) */
77
77
  connectString?: string | DataLink
78
- /* The language of the printer (only for EPSON) */
78
+ /* The language of the printer (only for EPSON and TSC drivers) */
79
79
  lang?: 'ANK' | 'CHINESE' | 'TAIWAN' | 'KOREAN' | 'THAI' | 'SOUTHASIA' | DataLink
80
80
  /* The timeout of scanning */
81
81
  scanTimeout?: number | DataLink
@@ -99,10 +99,12 @@ Default property:
99
99
  { type: 'barcode', content: '1234567890', barcodeType: 'CODE128' }
100
100
  { type: 'symbol', content: '1234567890', symbolType: 'QRCODE' }
101
101
  Notes:
102
- - `reverse-feed` only works on ESC/POS driver
102
+ - `reverse-feed` works on ESC/POS driver and castles driver (line mode only)
103
103
  - `width` and `height` in Star driver is magnification factor
104
104
  - `y` position in ESC/POS is use feed lines to offset
105
- - `textFont` only works on TSC driver */
105
+ - `textFont` only works on TSC driver
106
+ - castles driver: `image` requires `height` in line mode
107
+ - castles driver: `UPC_A`, `UPC_E`, `ITF` barcode types are not supported */
106
108
  payload?:
107
109
  | Array<
108
110
  | DataLink
@@ -149,7 +151,7 @@ Default property:
149
151
  }
150
152
  >
151
153
  | DataLink
152
- /* Raw ASCII commands to print */
154
+ /* Raw ASCII commands to print (not supported on castles driver) */
153
155
  rawCommands?: string | DataLink
154
156
  }
155
157
  events?: {
package/utils/data.ts CHANGED
@@ -85,7 +85,7 @@ type SystemDataName =
85
85
  type SystemDataInfo = {
86
86
  name: SystemDataName
87
87
  id: string
88
- type: 'string' | 'number' | 'bool' | 'array' | 'object' | 'any'
88
+ type: 'string' | 'number' | 'bool' | 'boolean' | 'array' | 'object' | 'any'
89
89
  title?: string
90
90
  description?: string
91
91
  schema?: object