node-red-contrib-prib-functions 0.22.0 → 0.23.3

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 (38) hide show
  1. package/README.md +142 -92
  2. package/lib/AlphaBeta.js +32 -0
  3. package/lib/GraphDB.js +40 -9
  4. package/lib/MinMax.js +17 -0
  5. package/lib/Tree.js +64 -0
  6. package/lib/common.js +128 -0
  7. package/lib/objectExtensions.js +213 -80
  8. package/lib/timeDimension.js +36 -0
  9. package/lib/typedInput.js +77 -0
  10. package/matrix/matrixNode.html +2 -1
  11. package/package.json +15 -13
  12. package/test/00-objectExtensions.js +192 -1
  13. package/test/02-graphdb.js +46 -0
  14. package/test/data/.config.nodes.json +3 -3
  15. package/test/data/.config.nodes.json.backup +3 -3
  16. package/test/data/.config.users.json +3 -2
  17. package/test/data/.config.users.json.backup +3 -2
  18. package/test/data/.flow.json.backup +3875 -472
  19. package/test/data/flow.json +3874 -471
  20. package/test/data/package-lock.json +11 -11
  21. package/test/data/shares/.config.nodes.json +589 -0
  22. package/test/data/shares/.config.runtime.json +4 -0
  23. package/test/data/shares/.config.runtime.json.backup +3 -0
  24. package/test/data/shares/.config.users.json +32 -0
  25. package/test/data/shares/.config.users.json.backup +29 -0
  26. package/test/data/shares/.flow.json.backup +230 -0
  27. package/test/data/shares/.flow_cred.json.backup +3 -0
  28. package/test/data/shares/flow.json +267 -0
  29. package/test/data/shares/flow_cred.json +3 -0
  30. package/test/data/shares/package.json +6 -0
  31. package/test/data/shares/settings.js +544 -0
  32. package/testing/test.js +63 -29
  33. package/transform/transform.html +185 -20
  34. package/transform/transform.js +272 -265
  35. package/transform/xlsx2.js +74 -0
  36. package/visual/shapes/base..js +1 -0
  37. package/visual/visual.js +0 -0
  38. package/visual/visualNode.js +45 -0
@@ -1,11 +1,11 @@
1
1
 
2
2
  <script type="text/javascript">
3
- function setInput(t) {
3
+ const setInput=(t,types=['str','json','env'])=>{
4
4
  $("#node-input-"+t+"Type").val(this[t+"Type"]);
5
5
  $("#node-input-"+t).typedInput({
6
- default: 'json',
6
+ default: types[0],
7
7
  typeField: $("#node-input-"+t+"Type"),
8
- types:['str','json','env'],
8
+ types:types,
9
9
  validate: ()=>{
10
10
  }
11
11
  });
@@ -21,15 +21,32 @@
21
21
  defaults: {
22
22
  name: {value: ""},
23
23
  actionSource: {value:"csv",required:true},
24
+ deleteSource: {value:true,validate: RED.validators.typedInput("deleteSourceType")},
25
+ deleteSourceType:{value:"bool"},
24
26
  actionTarget: {value:"JSON",required:true},
25
27
  sourceProperty:{value:"msg.payload"},
26
28
  targetProperty:{value:"msg.payload"},
27
29
  topicProperty:{value:"msg.topic"},
30
+ JSONataSource:{value:null,validate:v=>v==null||RED.validators.typedInput("JSONataSourceType")},
31
+ JSONataSourceType:{value:"jsonata"},
32
+ JSONataTarget:{value:null,validate:v=>v==null||RED.validators.typedInput("JSONataTargetType")},
33
+ JSONataTargetType:{value:"jsonata"},
34
+ index: {value:0},
28
35
  maxMessages: {value:1000},
36
+ maxDate: {value:null},
37
+ minDate: {value:null},
38
+ maxNumber: {value:0},
39
+ minNumber: {value:0},
40
+ maxString: {value:""},
41
+ minString: {value:""},
42
+ radix: {value:10},
29
43
  schema: {value:schemaExample, validate: RED.validators.typedInput("schemaType")},
30
44
  schemaType: {value:"json"},
31
45
  skipLeading: {value:0},
32
46
  skipTrailing: {value:0},
47
+ radix: {value:10},
48
+ string: {value:"", validate: RED.validators.typedInput("stringType")},
49
+ stringType: {value:"str"},
33
50
  delimiter: {value:",",required:true},
34
51
  compressionType: {value:"gzip"}
35
52
  },
@@ -55,9 +72,11 @@
55
72
  { value: "Confluence", label: "Confluence"},
56
73
  { value: "CSVWithHeader", label: "CSV with header"},
57
74
  { value: "CSV", label: "CSV"},
75
+ { value: "Date", label: "Date"},
58
76
  { value: "ISO8385", label: "ISO 8583"},
59
77
  { value: "JSON", label: "JSON"},
60
78
  { value: "npy", label: "npy"},
79
+ { value: "Number", label: "Number"},
61
80
  { value: "NumPyObject", label: "NumPy Obect"},
62
81
  { value: "String", label: "String"},
63
82
  { value: "snappy", label: "Snappy"},
@@ -89,6 +108,7 @@
89
108
  $(".form-row-http-in-skip").hide();
90
109
  $(".form-row-http-in-schema").hide();
91
110
  $(".form-row-http-in-compressionType").hide();
111
+ $(".form-row-http-in-JSONataSource").hide();
92
112
  if(!['CSV','CSVWithHeader'].includes(actionSource)) {
93
113
  $(".form-row-http-in-csv").hide();
94
114
  }
@@ -125,11 +145,18 @@
125
145
  options["HTML"]="HTML";
126
146
  options["Messages"]="Messages";
127
147
  break;
148
+ case 'Date':
149
+ options["isBetween"]="is between";
150
+ options["RangeLimit"]="Range Limit";
151
+ options["ISODate"]="YYYY-MM-DD";
152
+ options["LocalDate"]="Local String";
153
+ break;
128
154
  case 'ISO8385':
129
155
  options["JSON"]="JSON";
130
156
  options["Array"]="Array";
131
157
  break;
132
158
  case 'JSON':
159
+ $(".form-row-http-in-JSONataSource").show();
133
160
  options["Array"]="Array";
134
161
  options["AVRO"]="AVRO";
135
162
  options["Compressed"]="Compressed";
@@ -150,10 +177,18 @@
150
177
  options["JSON"]="JSON";
151
178
  options["NumPyObject"]="NumPy Object";
152
179
  break;
180
+ case 'Number':
181
+ options["Abbreviated"]="Abbreviated";
182
+ options["RangeLimit"]="Range Limit";
183
+ options["isBetween"]="is Between";
184
+ break;
153
185
  case 'NumPyObject':
154
186
  options["JSON"]="JSON";
155
187
  break;
156
-
188
+ case 'Object':
189
+ options["Coalesce"]="Coalesce";
190
+ options["Nullif"]="Nullif";
191
+ break;
157
192
  case 'path':
158
193
  options["Basename"]="basename";
159
194
  options["Dirname"]="dirname";
@@ -168,8 +203,42 @@
168
203
  options["Compress"]="Compress";
169
204
  break;
170
205
  case 'String':
171
- options["Compressed"]="Compressed";
206
+ options["Append"]="Append";
207
+ options["ArrayusingDelimiter"]="Array By Delimiter";
208
+ options["At"]="At";
209
+ options["Camelize"]="Camelize";
210
+ options["Capitalize"]="Capitalize";
211
+ options["Compressed"]="Compressed";
212
+ options["CharAt"]="Char At";
213
+ options["CharCodeAt"]="Char Code At";
214
+ options["CodePointAt"]="Code Point At";
215
+ options["Concat"]="Concat";
216
+ options["Date"]="Date";
217
+ options["DateLocal"]="Date Local";
218
+ options["DelimiterOnCase"]="Delimiter On Case";
219
+ options["Deunderscore"]="_ to space";
220
+ options["DeunderscoreCapitilize"]="_ to space Capitilize";
221
+ options["DropSquareBracketPrefix"]="Drop square bracket prefix";
222
+ options["EndsWith"]="Ends With";
223
+ options["Float"]="Float";
224
+ options["GetWord"]="Get Word";
225
+ options["Integer"]="Integer";
226
+ options["isBetween"]="is Between";
227
+ options["LowerCase"]="Lower Case";
228
+ options["Number"]="Number";
229
+ options["Prepend"]="Prepend";
172
230
  options["JSON"]="JSON";
231
+ options["RangeLimit"]="Range Limit";
232
+ options["Split"]="Split";
233
+ options["StartsWith"]="Starts With";
234
+ options["Timestamp"]="Timestamp";
235
+ options["Title"]="Title";
236
+ options["TitleGrammatical"]="Title Grammatical";
237
+ options["Trim"]="Trim";
238
+ options["TrimEnd"]="Trim End";
239
+ options["TrimStart"]="Trim Start";
240
+ options["UpperCase"]="Upper Case";
241
+ options["XmlStringEncode"]="Xml String Encode";
173
242
  break;
174
243
  case 'XLSX':
175
244
  options["XLSXObject"]="XLSX Object";
@@ -199,14 +268,22 @@
199
268
  $("#node-input-actionTarget").change(function() {
200
269
  const actionTarget=$(this).val();
201
270
  const actionSource=$("#node-input-actionSource").val();
202
- if(!["Confluence","AVRO"].includes(actionSource)){
203
- $(".form-row-http-in-schema").hide();
204
- }
205
- $(".form-row-http-in-maxMessages").hide();
206
- if(!['CSV','CSVWithHeader'].includes(actionTarget)) {
207
- $(".form-row-http-in-csv").hide();
208
- }
209
271
  $(".form-row-http-in-compressionType").hide();
272
+ $(".form-row-http-in-csv").hide();
273
+ $(".form-row-http-in-delimiter").hide();
274
+ $(".form-row-http-in-index").hide();
275
+ $(".form-row-http-in-length").hide();
276
+ $(".form-row-http-in-maxMessages").hide();
277
+ $(".form-row-http-in-maxDate").hide();
278
+ $(".form-row-http-in-maxNumber").hide();
279
+ $(".form-row-http-in-maxString").hide();
280
+ $(".form-row-http-in-minDate").hide();
281
+ $(".form-row-http-in-minNumber").hide();
282
+ $(".form-row-http-in-minString").hide();
283
+ $(".form-row-http-in-radix").hide();
284
+ $(".form-row-http-in-schema").hide();
285
+ $(".form-row-http-in-string").hide();
286
+ $(".form-row-http-in-JSONataTarget").hide();
210
287
  switch (actionTarget) {
211
288
  case 'AVRO':
212
289
  case 'Confluence':
@@ -215,15 +292,48 @@
215
292
  case 'Compressed':
216
293
  $(".form-row-http-in-compressionType").show();
217
294
  break;
218
- case 'CSV':
219
- $(".form-row-http-in-csv").show();
220
- break;
221
295
  case 'Messages':
222
296
  $(".form-row-http-in-maxMessages").show();
223
297
  break;
298
+ case 'Integer':
299
+ $(".form-row-http-in-radix").show();
300
+ break;
301
+ case 'At':
302
+ case 'CharAt':
303
+ case 'CharCodeAt':
304
+ case 'CodePointAt':
305
+ case 'GetWord':
306
+ $(".form-row-http-in-index").show();
307
+ break;
308
+ case 'EndsWith':
309
+ case 'StartsWith':
310
+ case 'Append':
311
+ case 'Prepend':
312
+ case 'Concat':
313
+ case 'Split':
314
+ $(".form-row-http-in-string").show();
315
+ break;
316
+ case 'CSV':
317
+ case 'DelimiterOnCase':
318
+ case 'ArrayByDelimiter':
319
+ $(".form-row-http-in-delimiter").show();
320
+ break;
321
+ case 'RangeLimit':
322
+ case 'isBetween':
323
+ $(".form-row-http-in-max"+actionSource).show();
324
+ $(".form-row-http-in-min"+actionSource).show();
325
+ break;
326
+ case 'JSON':
327
+ $(".form-row-http-in-max"+actionSource).show();
328
+ $(".form-row-http-in-JSONataTarget").show();
329
+ break;
224
330
  }
225
331
  }).change();
332
+ setInput.apply(this,["JSONataSource",["jsonata"]]);
333
+ setInput.apply(this,["JSONataTarget",["jsonata"]]);
334
+ setInput.apply(this,["deleteSource",["bool"]]);
226
335
  setInput.apply(this,["schema"]);
336
+ setInput.apply(this,["string",["str","msg","flow","global","env","node"]]);
227
337
  },
228
338
  oneditsave: function() {
229
339
  },
@@ -239,11 +349,16 @@
239
349
  <input type="text" id="node-input-name" placeholder="Name">
240
350
  </div>
241
351
  <div class="form-row form-row-http-in-sourceProperty show">
242
- <label for="node-input-sourceProperty" style="white-space: nowrap"><i class="icon-bookmark"></i> Source Property </label>
352
+ <label for="node-input-sourceProperty" style="white-space: nowrap"> Source Property </label>
243
353
  <input type="text" id="node-input-sourceProperty" placeholder="msg.payload">
244
354
  </div>
355
+ <div class="form-row form-row-http-in-deleteSource show">
356
+ <label for="node-input-deleteSource"><span data-i18n="common.label.string"> Delete?</span></label>
357
+ <input type="text" id="node-input-deleteSource" style="width:70%">
358
+ <input type="hidden" id="node-input-deleteSourceType">
359
+ </div>
245
360
  <div class="form-row form-row-http-in-targetProperty show">
246
- <label for="node-input-targetProperty" style="white-space: nowrap"><i class="icon-bookmark"></i> Target Property </label>
361
+ <label for="node-input-targetProperty" style="white-space: nowrap"> Target Property </label>
247
362
  <input type="text" id="node-input-targetProperty" placeholder="msg.payload">
248
363
  </div>
249
364
  <div class="form-row form-row-http-in-topicProperty show">
@@ -254,15 +369,29 @@
254
369
  <label for="node-input-actionSource"><i class="fa fa-list-ul"></i> Source Type </label>
255
370
  <input type="text" id="node-input-actionSource">
256
371
  </div>
372
+ <div class="form-row form-row-http-in-JSONataSource hide">
373
+ <label for="node-input-JSONataSource"><i class="fa fa-bookmark"></i> <span data-i18n="common.label.string"> JSONata Source</span></label>
374
+ <input type="text" id="node-input-JSONataSource" style="width:70%">
375
+ <input type="hidden" id="node-input-JSONataSourceType">
376
+ </div>
257
377
  <div class="form-row">
258
378
  <label for="node-input-actionTarget"><i class="fa fa-list-ul"></i> Target Type </label>
259
379
  <select id="node-input-actionTarget" placeholder="actionTarget">
260
380
  </select>
261
381
  </div>
262
- <div class="form-row form-row-http-in-csv hide">
382
+ <div class="form-row form-row-http-in-JSONataTarget hide">
383
+ <label for="node-input-JSONataTarget"><i class="fa fa-bookmark"></i> <span data-i18n="common.label.string"> JSONata Target</span></label>
384
+ <input type="text" id="node-input-JSONataTarget" style="width:70%">
385
+ <input type="hidden" id="node-input-JSONataTargetType">
386
+ </div>
387
+ <div class="form-row form-row-http-in-delimiter hide">
263
388
  <label for="node-input-delimiter"><i class="icon-bookmark"></i> Delimiter</label>
264
389
  <input type="text" id="node-input-delimiter" placeholder="delimiter" size="1" minlength="1">
265
390
  </div>
391
+ <div class="form-row form-row-http-in-index hide">
392
+ <label for="node-input-index"><i class="icon-bookmark"></i> Index</label>
393
+ <input type="number" id="node-input-index" placeholder="index" min="-10000" max="10000" step="1">
394
+ </div>
266
395
  <div class="form-row form-row-http-in-skip hide">
267
396
  <label for="node-input-skipLeading"><i class="icon-bookmark"></i> Skip Leading</label>
268
397
  <input type="number" id="node-input-skipLeading" placeholder="skipLeading" min="0" max="10000" step="1">
@@ -271,7 +400,39 @@
271
400
  </div>
272
401
  <div class="form-row form-row-http-in-maxMessages hide">
273
402
  <label for="node-input-maxMessages"><i class="icon-bookmark"></i> Max Messages</label>
274
- <input type="number" id="node-input-maxMessages" placeholder="maxMessages" min="1" max="10000" step="100">
403
+ <input type="number" id="node-input-maxMessages" placeholder="maxMessages" min="1" max="36" step="1">
404
+ </div>
405
+ <div class="form-row form-row-http-in-minNumber hide">
406
+ <label for="node-input-minNumber"><i class="icon-bookmark"></i> Min</label>
407
+ <input type="number" id="node-input-minNumber" placeholder="min">
408
+ </div>
409
+ <div class="form-row form-row-http-in-maxNumber hide">
410
+ <label for="node-input-maxNumber"><i class="icon-bookmark"></i> Max</label>
411
+ <input type="number" id="node-input-maxNumber" placeholder="max">
412
+ </div>
413
+ <div class="form-row form-row-http-in-minString hide">
414
+ <label for="node-input-minString"><i class="icon-bookmark"></i> Min</label>
415
+ <input type="text" id="node-input-minString" placeholder="min">
416
+ </div>
417
+ <div class="form-row form-row-http-in-maxString hide">
418
+ <label for="node-input-maxString"><i class="icon-bookmark"></i> Max</label>
419
+ <input type="text" id="node-input-maxString" placeholder="max">
420
+ </div>
421
+ <div class="form-row form-row-http-in-minDate hide">
422
+ <label for="node-input-minDate"><i class="icon-bookmark"></i> Min</label>
423
+ <input type="date" id="node-input-minDate" placeholder="min">
424
+ </div>
425
+ <div class="form-row form-row-http-in-maxDate hide">
426
+ <label for="node-input-maxDate"><i class="icon-bookmark"></i> Max</label>
427
+ <input type="date" id="node-input-maxDate" placeholder="max">
428
+ </div>
429
+ <div class="form-row form-row-http-in-length hide">
430
+ <label for="node-input-length"><i class="icon-bookmark"></i> Length</label>
431
+ <input type="number" id="node-input-length" placeholder="length" min="1" max="1000" step="1">
432
+ </div>
433
+ <div class="form-row form-row-http-in-radix hide">
434
+ <label for="node-input-radix"><i class="icon-bookmark"></i> Radix</label>
435
+ <input type="number" id="node-input-radix" placeholder="radix" min="2" max="10000" step="100">
275
436
  </div>
276
437
  <div class="form-row form-row-http-in-schema hide">
277
438
  <label for="node-input-schema"><i class="fa fa-envelope"></i> <span data-i18n="common.label.schema"> Schema </span></label>
@@ -282,7 +443,11 @@
282
443
  <label for="node-input-compressionType"><i class="fa fa-envelope"></i> <span data-i18n="common.label.compressionType"> Type </span></label>
283
444
  <input type="text" id="node-input-compressionType">
284
445
  </div>
285
-
446
+ <div class="form-row form-row-http-in-string hide">
447
+ <label for="node-input-string"><i class="fa fa-bookmark"></i> <span data-i18n="common.label.string"> String</span></label>
448
+ <input type="text" id="node-input-string" style="width:70%">
449
+ <input type="hidden" id="node-input-stringType">
450
+ </div>
286
451
  </script>
287
452
 
288
453
  <script type="text/x-red" data-help-name="transform">