@openfn/language-hive 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/ast.json ADDED
@@ -0,0 +1,562 @@
1
+ {
2
+ "operations": [
3
+ {
4
+ "name": "query",
5
+ "params": [
6
+ "qs",
7
+ "options",
8
+ "callback"
9
+ ],
10
+ "docs": {
11
+ "description": "Execute an SQL statement",
12
+ "tags": [
13
+ {
14
+ "title": "public",
15
+ "description": null,
16
+ "type": null
17
+ },
18
+ {
19
+ "title": "example",
20
+ "description": "query(\"select count(*) from patient\");",
21
+ "caption": "Get patient count from hive database"
22
+ },
23
+ {
24
+ "title": "function",
25
+ "description": null,
26
+ "name": null
27
+ },
28
+ {
29
+ "title": "param",
30
+ "description": "SQL statement",
31
+ "type": {
32
+ "type": "NameExpression",
33
+ "name": "string"
34
+ },
35
+ "name": "qs"
36
+ },
37
+ {
38
+ "title": "param",
39
+ "description": "(Optional) options for executing sql statement",
40
+ "type": {
41
+ "type": "NameExpression",
42
+ "name": "object"
43
+ },
44
+ "name": "options"
45
+ },
46
+ {
47
+ "title": "param",
48
+ "description": "An optional callback function",
49
+ "type": {
50
+ "type": "NameExpression",
51
+ "name": "function"
52
+ },
53
+ "name": "callback"
54
+ },
55
+ {
56
+ "title": "returns",
57
+ "description": null,
58
+ "type": {
59
+ "type": "NameExpression",
60
+ "name": "Operation"
61
+ }
62
+ }
63
+ ]
64
+ },
65
+ "valid": true
66
+ }
67
+ ],
68
+ "exports": [],
69
+ "common": [
70
+ {
71
+ "name": "fn",
72
+ "params": [
73
+ "func"
74
+ ],
75
+ "docs": {
76
+ "description": "Creates a custom step (or operation) for more flexible job writing.",
77
+ "tags": [
78
+ {
79
+ "title": "public",
80
+ "description": null,
81
+ "type": null
82
+ },
83
+ {
84
+ "title": "example",
85
+ "description": "fn(state => {\n // do some things to state\n return state;\n});"
86
+ },
87
+ {
88
+ "title": "function",
89
+ "description": null,
90
+ "name": null
91
+ },
92
+ {
93
+ "title": "param",
94
+ "description": "is the function",
95
+ "type": {
96
+ "type": "NameExpression",
97
+ "name": "Function"
98
+ },
99
+ "name": "func"
100
+ },
101
+ {
102
+ "title": "returns",
103
+ "description": null,
104
+ "type": {
105
+ "type": "NameExpression",
106
+ "name": "Operation"
107
+ }
108
+ }
109
+ ]
110
+ },
111
+ "valid": true
112
+ },
113
+ {
114
+ "name": "sourceValue",
115
+ "params": [
116
+ "path"
117
+ ],
118
+ "docs": {
119
+ "description": "Picks out a single value from source data.\nIf a JSONPath returns more than one value for the reference, the first\nitem will be returned.",
120
+ "tags": [
121
+ {
122
+ "title": "public",
123
+ "description": null,
124
+ "type": null
125
+ },
126
+ {
127
+ "title": "example",
128
+ "description": "sourceValue('$.key')"
129
+ },
130
+ {
131
+ "title": "function",
132
+ "description": null,
133
+ "name": null
134
+ },
135
+ {
136
+ "title": "param",
137
+ "description": "JSONPath referencing a point in `state`.",
138
+ "type": {
139
+ "type": "NameExpression",
140
+ "name": "String"
141
+ },
142
+ "name": "path"
143
+ },
144
+ {
145
+ "title": "returns",
146
+ "description": null,
147
+ "type": {
148
+ "type": "NameExpression",
149
+ "name": "Operation"
150
+ }
151
+ }
152
+ ]
153
+ },
154
+ "valid": true
155
+ },
156
+ {
157
+ "name": "dataPath",
158
+ "params": [
159
+ "path"
160
+ ],
161
+ "docs": {
162
+ "description": "Ensures a path points at the data.",
163
+ "tags": [
164
+ {
165
+ "title": "public",
166
+ "description": null,
167
+ "type": null
168
+ },
169
+ {
170
+ "title": "example",
171
+ "description": "dataPath('key')"
172
+ },
173
+ {
174
+ "title": "function",
175
+ "description": null,
176
+ "name": null
177
+ },
178
+ {
179
+ "title": "param",
180
+ "description": "JSONPath referencing a point in `data`.",
181
+ "type": {
182
+ "type": "NameExpression",
183
+ "name": "string"
184
+ },
185
+ "name": "path"
186
+ },
187
+ {
188
+ "title": "returns",
189
+ "description": null,
190
+ "type": {
191
+ "type": "NameExpression",
192
+ "name": "string"
193
+ }
194
+ }
195
+ ]
196
+ },
197
+ "valid": true
198
+ },
199
+ {
200
+ "name": "dataValue",
201
+ "params": [
202
+ "path"
203
+ ],
204
+ "docs": {
205
+ "description": "Picks out a single value from the source data object—usually `state.data`.\nIf a JSONPath returns more than one value for the reference, the first\nitem will be returned.",
206
+ "tags": [
207
+ {
208
+ "title": "public",
209
+ "description": null,
210
+ "type": null
211
+ },
212
+ {
213
+ "title": "example",
214
+ "description": "dataValue('key')"
215
+ },
216
+ {
217
+ "title": "function",
218
+ "description": null,
219
+ "name": null
220
+ },
221
+ {
222
+ "title": "param",
223
+ "description": "JSONPath referencing a point in `data`.",
224
+ "type": {
225
+ "type": "NameExpression",
226
+ "name": "String"
227
+ },
228
+ "name": "path"
229
+ },
230
+ {
231
+ "title": "returns",
232
+ "description": null,
233
+ "type": {
234
+ "type": "NameExpression",
235
+ "name": "Operation"
236
+ }
237
+ }
238
+ ]
239
+ },
240
+ "valid": true
241
+ },
242
+ {
243
+ "name": "lastReferenceValue",
244
+ "params": [
245
+ "path"
246
+ ],
247
+ "docs": {
248
+ "description": "Picks out the last reference value from source data.",
249
+ "tags": [
250
+ {
251
+ "title": "public",
252
+ "description": null,
253
+ "type": null
254
+ },
255
+ {
256
+ "title": "example",
257
+ "description": "lastReferenceValue('key')"
258
+ },
259
+ {
260
+ "title": "function",
261
+ "description": null,
262
+ "name": null
263
+ },
264
+ {
265
+ "title": "param",
266
+ "description": "JSONPath referencing a point in `references`.",
267
+ "type": {
268
+ "type": "NameExpression",
269
+ "name": "String"
270
+ },
271
+ "name": "path"
272
+ },
273
+ {
274
+ "title": "returns",
275
+ "description": null,
276
+ "type": {
277
+ "type": "NameExpression",
278
+ "name": "Operation"
279
+ }
280
+ }
281
+ ]
282
+ },
283
+ "valid": true
284
+ },
285
+ {
286
+ "name": "each",
287
+ "params": [
288
+ "dataSource",
289
+ "operation"
290
+ ],
291
+ "docs": {
292
+ "description": "Scopes an array of data based on a JSONPath.\nUseful when the source data has `n` items you would like to map to\nan operation.\nThe operation will receive a slice of the data based of each item\nof the JSONPath provided.\n\nIt also ensures the results of an operation make their way back into\nthe state's references.",
293
+ "tags": [
294
+ {
295
+ "title": "public",
296
+ "description": null,
297
+ "type": null
298
+ },
299
+ {
300
+ "title": "example",
301
+ "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
302
+ },
303
+ {
304
+ "title": "function",
305
+ "description": null,
306
+ "name": null
307
+ },
308
+ {
309
+ "title": "param",
310
+ "description": "JSONPath referencing a point in `state`.",
311
+ "type": {
312
+ "type": "NameExpression",
313
+ "name": "DataSource"
314
+ },
315
+ "name": "dataSource"
316
+ },
317
+ {
318
+ "title": "param",
319
+ "description": "The operation needed to be repeated.",
320
+ "type": {
321
+ "type": "NameExpression",
322
+ "name": "Operation"
323
+ },
324
+ "name": "operation"
325
+ },
326
+ {
327
+ "title": "returns",
328
+ "description": null,
329
+ "type": {
330
+ "type": "NameExpression",
331
+ "name": "Operation"
332
+ }
333
+ }
334
+ ]
335
+ },
336
+ "valid": true
337
+ },
338
+ {
339
+ "name": "field",
340
+ "params": [
341
+ "key",
342
+ "value"
343
+ ],
344
+ "docs": {
345
+ "description": "Returns a key, value pair in an array.",
346
+ "tags": [
347
+ {
348
+ "title": "public",
349
+ "description": null,
350
+ "type": null
351
+ },
352
+ {
353
+ "title": "example",
354
+ "description": "field('destination_field_name__c', 'value')"
355
+ },
356
+ {
357
+ "title": "function",
358
+ "description": null,
359
+ "name": null
360
+ },
361
+ {
362
+ "title": "param",
363
+ "description": "Name of the field",
364
+ "type": {
365
+ "type": "NameExpression",
366
+ "name": "string"
367
+ },
368
+ "name": "key"
369
+ },
370
+ {
371
+ "title": "param",
372
+ "description": "The value itself or a sourceable operation.",
373
+ "type": {
374
+ "type": "NameExpression",
375
+ "name": "Value"
376
+ },
377
+ "name": "value"
378
+ },
379
+ {
380
+ "title": "returns",
381
+ "description": null,
382
+ "type": {
383
+ "type": "NameExpression",
384
+ "name": "Field"
385
+ }
386
+ }
387
+ ]
388
+ },
389
+ "valid": true
390
+ },
391
+ {
392
+ "name": "fields",
393
+ "params": [
394
+ "fields"
395
+ ],
396
+ "docs": {
397
+ "description": "Zips key value pairs into an object.",
398
+ "tags": [
399
+ {
400
+ "title": "public",
401
+ "description": null,
402
+ "type": null
403
+ },
404
+ {
405
+ "title": "example",
406
+ "description": "fields(list_of_fields)"
407
+ },
408
+ {
409
+ "title": "function",
410
+ "description": null,
411
+ "name": null
412
+ },
413
+ {
414
+ "title": "param",
415
+ "description": "a list of fields",
416
+ "type": {
417
+ "type": "NameExpression",
418
+ "name": "Fields"
419
+ },
420
+ "name": "fields"
421
+ },
422
+ {
423
+ "title": "returns",
424
+ "description": null,
425
+ "type": {
426
+ "type": "NameExpression",
427
+ "name": "Object"
428
+ }
429
+ }
430
+ ]
431
+ },
432
+ "valid": true
433
+ },
434
+ {
435
+ "name": "merge",
436
+ "params": [
437
+ "dataSource",
438
+ "fields"
439
+ ],
440
+ "docs": {
441
+ "description": "Merges fields into each item in an array.",
442
+ "tags": [
443
+ {
444
+ "title": "public",
445
+ "description": null,
446
+ "type": null
447
+ },
448
+ {
449
+ "title": "example",
450
+ "description": "merge(\n \"$.books[*]\",\n fields(\n field( \"publisher\", sourceValue(\"$.publisher\") )\n )\n)"
451
+ },
452
+ {
453
+ "title": "function",
454
+ "description": null,
455
+ "name": null
456
+ },
457
+ {
458
+ "title": "param",
459
+ "description": null,
460
+ "type": {
461
+ "type": "NameExpression",
462
+ "name": "DataSource"
463
+ },
464
+ "name": "dataSource"
465
+ },
466
+ {
467
+ "title": "param",
468
+ "description": "Group of fields to merge in.",
469
+ "type": {
470
+ "type": "NameExpression",
471
+ "name": "Object"
472
+ },
473
+ "name": "fields"
474
+ },
475
+ {
476
+ "title": "returns",
477
+ "description": null,
478
+ "type": {
479
+ "type": "NameExpression",
480
+ "name": "DataSource"
481
+ }
482
+ }
483
+ ]
484
+ },
485
+ "valid": true
486
+ },
487
+ {
488
+ "name": "parseCsv",
489
+ "params": [
490
+ "csvData",
491
+ "parsingOptions",
492
+ "callback"
493
+ ],
494
+ "docs": {
495
+ "description": "Takes a CSV file string or stream and parsing options as input, and returns a promise that\nresolves to the parsed CSV data as an array of objects.\nOptions for `parsingOptions` include:\n- `delimiter` {string/Buffer/[string/Buffer]} - Defines the character(s) used to delineate the fields inside a record. Default: `','`\n- `quote` {string/Buffer/[string/Buffer]} - Defines the characters used to surround a field. Default: `'\"'`\n- `escape` {Buffer/string/null/boolean} - Set the escape character as one character/byte only. Default: `\"`\n- `columns` {boolean / array / function} - Generates record in the form of object literals. Default: `true`\n- `bom` {boolean} - Strips the {@link https://en.wikipedia.org/wiki/Byte_order_mark byte order mark (BOM)} from the input string or buffer. Default: `true`\n- `trim` {boolean} - Ignore whitespace characters immediately around the `delimiter`. Default: `true`\n- `ltrim` {boolean} - Ignore whitespace characters from the left side of a CSV field. Default: `true`\n- `rtrim` {boolean} - Ignore whitespace characters from the right side of a CSV field. Default: `true`\n- `chunkSize` {number} - The size of each chunk of CSV data. Default: `Infinity`\n- `skip_empty_lines` {boolean} - Ignore empty lines in the CSV file. Default: `true`",
496
+ "tags": [
497
+ {
498
+ "title": "public",
499
+ "description": null,
500
+ "type": null
501
+ },
502
+ {
503
+ "title": "function",
504
+ "description": null,
505
+ "name": null
506
+ },
507
+ {
508
+ "title": "param",
509
+ "description": "A CSV string or a readable stream",
510
+ "type": {
511
+ "type": "UnionType",
512
+ "elements": [
513
+ {
514
+ "type": "NameExpression",
515
+ "name": "String"
516
+ },
517
+ {
518
+ "type": "NameExpression",
519
+ "name": "Stream"
520
+ }
521
+ ]
522
+ },
523
+ "name": "csvData"
524
+ },
525
+ {
526
+ "title": "param",
527
+ "description": "Optional. Parsing options for converting CSV to JSON.",
528
+ "type": {
529
+ "type": "OptionalType",
530
+ "expression": {
531
+ "type": "NameExpression",
532
+ "name": "Object"
533
+ }
534
+ },
535
+ "name": "parsingOptions"
536
+ },
537
+ {
538
+ "title": "param",
539
+ "description": "(Optional) callback function. If used it will be called state and an array of rows.",
540
+ "type": {
541
+ "type": "OptionalType",
542
+ "expression": {
543
+ "type": "NameExpression",
544
+ "name": "function"
545
+ }
546
+ },
547
+ "name": "callback"
548
+ },
549
+ {
550
+ "title": "returns",
551
+ "description": "The function returns a Promise that resolves to the result of parsing a CSV `stringOrStream`.",
552
+ "type": {
553
+ "type": "NameExpression",
554
+ "name": "Operation"
555
+ }
556
+ }
557
+ ]
558
+ },
559
+ "valid": true
560
+ }
561
+ ]
562
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "properties": {
4
+ "host": {
5
+ "title": "Host URL",
6
+ "type": "string",
7
+ "description": "The database instance host URL",
8
+ "format": "uri",
9
+ "minLength": 1,
10
+ "examples": [
11
+ "some-host-url.compute-1.amazonaws.com"
12
+ ]
13
+ },
14
+ "port": {
15
+ "title": "Port",
16
+ "type": "integer",
17
+ "default": 10001,
18
+ "description": "Database instance port",
19
+ "minLength": 1,
20
+ "examples": [
21
+ 10001
22
+ ]
23
+ },
24
+ "database": {
25
+ "title": "Database",
26
+ "type": "string",
27
+ "description": "The database name",
28
+ "minLength": 1,
29
+ "examples": [
30
+ "demo-db"
31
+ ]
32
+ },
33
+ "username": {
34
+ "title": "Username",
35
+ "type": "string",
36
+ "description": "The username to log in the database",
37
+ "minLength": 1,
38
+ "examples": [
39
+ "admin-demo"
40
+ ]
41
+ },
42
+ "password": {
43
+ "title": "Password",
44
+ "type": "string",
45
+ "description": "The password to log in the database",
46
+ "writeOnly": true,
47
+ "minLength": 1,
48
+ "examples": [
49
+ "@super(!)Secretpass"
50
+ ]
51
+ }
52
+ },
53
+ "type": "object",
54
+ "additionalProperties": true,
55
+ "required": [
56
+ "host",
57
+ "port",
58
+ "username",
59
+ "password"
60
+ ]
61
+ }