@openfn/language-satusehat 1.0.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,583 @@
1
+ {
2
+ "operations": [
3
+ {
4
+ "name": "get",
5
+ "params": [
6
+ "path",
7
+ "params",
8
+ "callback"
9
+ ],
10
+ "docs": {
11
+ "description": "Make a get request to any satusehat endpoint",
12
+ "tags": [
13
+ {
14
+ "title": "public",
15
+ "description": null,
16
+ "type": null
17
+ },
18
+ {
19
+ "title": "example",
20
+ "description": "get(\"Organization\", {\"name\": \"somename\"})"
21
+ },
22
+ {
23
+ "title": "function",
24
+ "description": null,
25
+ "name": null
26
+ },
27
+ {
28
+ "title": "param",
29
+ "description": "Path to resource",
30
+ "type": {
31
+ "type": "NameExpression",
32
+ "name": "string"
33
+ },
34
+ "name": "path"
35
+ },
36
+ {
37
+ "title": "param",
38
+ "description": "Optional request params such as name.",
39
+ "type": {
40
+ "type": "NameExpression",
41
+ "name": "object"
42
+ },
43
+ "name": "params"
44
+ },
45
+ {
46
+ "title": "param",
47
+ "description": "An optional callback to handle the response",
48
+ "type": {
49
+ "type": "NameExpression",
50
+ "name": "function"
51
+ },
52
+ "name": "callback"
53
+ },
54
+ {
55
+ "title": "returns",
56
+ "description": null,
57
+ "type": {
58
+ "type": "NameExpression",
59
+ "name": "Operation"
60
+ }
61
+ }
62
+ ]
63
+ },
64
+ "valid": true
65
+ }
66
+ ],
67
+ "exports": [],
68
+ "common": [
69
+ {
70
+ "name": "fn",
71
+ "params": [
72
+ "func"
73
+ ],
74
+ "docs": {
75
+ "description": "Creates a custom step (or operation) for more flexible job writing.",
76
+ "tags": [
77
+ {
78
+ "title": "public",
79
+ "description": null,
80
+ "type": null
81
+ },
82
+ {
83
+ "title": "example",
84
+ "description": "fn(state => {\n // do some things to state\n return state;\n});"
85
+ },
86
+ {
87
+ "title": "function",
88
+ "description": null,
89
+ "name": null
90
+ },
91
+ {
92
+ "title": "param",
93
+ "description": "is the function",
94
+ "type": {
95
+ "type": "NameExpression",
96
+ "name": "Function"
97
+ },
98
+ "name": "func"
99
+ },
100
+ {
101
+ "title": "returns",
102
+ "description": null,
103
+ "type": {
104
+ "type": "NameExpression",
105
+ "name": "Operation"
106
+ }
107
+ }
108
+ ]
109
+ },
110
+ "valid": true
111
+ },
112
+ {
113
+ "name": "sourceValue",
114
+ "params": [
115
+ "path"
116
+ ],
117
+ "docs": {
118
+ "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.",
119
+ "tags": [
120
+ {
121
+ "title": "public",
122
+ "description": null,
123
+ "type": null
124
+ },
125
+ {
126
+ "title": "example",
127
+ "description": "sourceValue('$.key')"
128
+ },
129
+ {
130
+ "title": "function",
131
+ "description": null,
132
+ "name": null
133
+ },
134
+ {
135
+ "title": "param",
136
+ "description": "JSONPath referencing a point in `state`.",
137
+ "type": {
138
+ "type": "NameExpression",
139
+ "name": "String"
140
+ },
141
+ "name": "path"
142
+ },
143
+ {
144
+ "title": "returns",
145
+ "description": null,
146
+ "type": {
147
+ "type": "NameExpression",
148
+ "name": "Operation"
149
+ }
150
+ }
151
+ ]
152
+ },
153
+ "valid": true
154
+ },
155
+ {
156
+ "name": "dataPath",
157
+ "params": [
158
+ "path"
159
+ ],
160
+ "docs": {
161
+ "description": "Ensures a path points at the data.",
162
+ "tags": [
163
+ {
164
+ "title": "public",
165
+ "description": null,
166
+ "type": null
167
+ },
168
+ {
169
+ "title": "example",
170
+ "description": "dataPath('key')"
171
+ },
172
+ {
173
+ "title": "function",
174
+ "description": null,
175
+ "name": null
176
+ },
177
+ {
178
+ "title": "param",
179
+ "description": "JSONPath referencing a point in `data`.",
180
+ "type": {
181
+ "type": "NameExpression",
182
+ "name": "string"
183
+ },
184
+ "name": "path"
185
+ },
186
+ {
187
+ "title": "returns",
188
+ "description": null,
189
+ "type": {
190
+ "type": "NameExpression",
191
+ "name": "string"
192
+ }
193
+ }
194
+ ]
195
+ },
196
+ "valid": true
197
+ },
198
+ {
199
+ "name": "dataValue",
200
+ "params": [
201
+ "path"
202
+ ],
203
+ "docs": {
204
+ "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.",
205
+ "tags": [
206
+ {
207
+ "title": "public",
208
+ "description": null,
209
+ "type": null
210
+ },
211
+ {
212
+ "title": "example",
213
+ "description": "dataValue('key')"
214
+ },
215
+ {
216
+ "title": "function",
217
+ "description": null,
218
+ "name": null
219
+ },
220
+ {
221
+ "title": "param",
222
+ "description": "JSONPath referencing a point in `data`.",
223
+ "type": {
224
+ "type": "NameExpression",
225
+ "name": "String"
226
+ },
227
+ "name": "path"
228
+ },
229
+ {
230
+ "title": "returns",
231
+ "description": null,
232
+ "type": {
233
+ "type": "NameExpression",
234
+ "name": "Operation"
235
+ }
236
+ }
237
+ ]
238
+ },
239
+ "valid": true
240
+ },
241
+ {
242
+ "name": "lastReferenceValue",
243
+ "params": [
244
+ "path"
245
+ ],
246
+ "docs": {
247
+ "description": "Picks out the last reference value from source data.",
248
+ "tags": [
249
+ {
250
+ "title": "public",
251
+ "description": null,
252
+ "type": null
253
+ },
254
+ {
255
+ "title": "example",
256
+ "description": "lastReferenceValue('key')"
257
+ },
258
+ {
259
+ "title": "function",
260
+ "description": null,
261
+ "name": null
262
+ },
263
+ {
264
+ "title": "param",
265
+ "description": "JSONPath referencing a point in `references`.",
266
+ "type": {
267
+ "type": "NameExpression",
268
+ "name": "String"
269
+ },
270
+ "name": "path"
271
+ },
272
+ {
273
+ "title": "returns",
274
+ "description": null,
275
+ "type": {
276
+ "type": "NameExpression",
277
+ "name": "Operation"
278
+ }
279
+ }
280
+ ]
281
+ },
282
+ "valid": true
283
+ },
284
+ {
285
+ "name": "each",
286
+ "params": [
287
+ "dataSource",
288
+ "operation"
289
+ ],
290
+ "docs": {
291
+ "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.",
292
+ "tags": [
293
+ {
294
+ "title": "public",
295
+ "description": null,
296
+ "type": null
297
+ },
298
+ {
299
+ "title": "example",
300
+ "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
301
+ },
302
+ {
303
+ "title": "function",
304
+ "description": null,
305
+ "name": null
306
+ },
307
+ {
308
+ "title": "param",
309
+ "description": "JSONPath referencing a point in `state`.",
310
+ "type": {
311
+ "type": "NameExpression",
312
+ "name": "DataSource"
313
+ },
314
+ "name": "dataSource"
315
+ },
316
+ {
317
+ "title": "param",
318
+ "description": "The operation needed to be repeated.",
319
+ "type": {
320
+ "type": "NameExpression",
321
+ "name": "Operation"
322
+ },
323
+ "name": "operation"
324
+ },
325
+ {
326
+ "title": "returns",
327
+ "description": null,
328
+ "type": {
329
+ "type": "NameExpression",
330
+ "name": "Operation"
331
+ }
332
+ }
333
+ ]
334
+ },
335
+ "valid": true
336
+ },
337
+ {
338
+ "name": "combine",
339
+ "params": [
340
+ "operations"
341
+ ],
342
+ "docs": {
343
+ "description": "Combines two operations into one",
344
+ "tags": [
345
+ {
346
+ "title": "public",
347
+ "description": null,
348
+ "type": null
349
+ },
350
+ {
351
+ "title": "example",
352
+ "description": "combine(\n create('foo'),\n delete('bar')\n)"
353
+ },
354
+ {
355
+ "title": "function",
356
+ "description": null,
357
+ "name": null
358
+ },
359
+ {
360
+ "title": "param",
361
+ "description": "Operations to be performed.",
362
+ "type": {
363
+ "type": "NameExpression",
364
+ "name": "Operations"
365
+ },
366
+ "name": "operations"
367
+ },
368
+ {
369
+ "title": "returns",
370
+ "description": null,
371
+ "type": {
372
+ "type": "NameExpression",
373
+ "name": "Operation"
374
+ }
375
+ }
376
+ ]
377
+ },
378
+ "valid": true
379
+ },
380
+ {
381
+ "name": "field",
382
+ "params": [
383
+ "key",
384
+ "value"
385
+ ],
386
+ "docs": {
387
+ "description": "Returns a key, value pair in an array.",
388
+ "tags": [
389
+ {
390
+ "title": "public",
391
+ "description": null,
392
+ "type": null
393
+ },
394
+ {
395
+ "title": "example",
396
+ "description": "field('destination_field_name__c', 'value')"
397
+ },
398
+ {
399
+ "title": "function",
400
+ "description": null,
401
+ "name": null
402
+ },
403
+ {
404
+ "title": "param",
405
+ "description": "Name of the field",
406
+ "type": {
407
+ "type": "NameExpression",
408
+ "name": "string"
409
+ },
410
+ "name": "key"
411
+ },
412
+ {
413
+ "title": "param",
414
+ "description": "The value itself or a sourceable operation.",
415
+ "type": {
416
+ "type": "NameExpression",
417
+ "name": "Value"
418
+ },
419
+ "name": "value"
420
+ },
421
+ {
422
+ "title": "returns",
423
+ "description": null,
424
+ "type": {
425
+ "type": "NameExpression",
426
+ "name": "Field"
427
+ }
428
+ }
429
+ ]
430
+ },
431
+ "valid": true
432
+ },
433
+ {
434
+ "name": "fields",
435
+ "params": [
436
+ "fields"
437
+ ],
438
+ "docs": {
439
+ "description": "Zips key value pairs into an object.",
440
+ "tags": [
441
+ {
442
+ "title": "public",
443
+ "description": null,
444
+ "type": null
445
+ },
446
+ {
447
+ "title": "example",
448
+ "description": "fields(list_of_fields)"
449
+ },
450
+ {
451
+ "title": "function",
452
+ "description": null,
453
+ "name": null
454
+ },
455
+ {
456
+ "title": "param",
457
+ "description": "a list of fields",
458
+ "type": {
459
+ "type": "NameExpression",
460
+ "name": "Fields"
461
+ },
462
+ "name": "fields"
463
+ },
464
+ {
465
+ "title": "returns",
466
+ "description": null,
467
+ "type": {
468
+ "type": "NameExpression",
469
+ "name": "Object"
470
+ }
471
+ }
472
+ ]
473
+ },
474
+ "valid": true
475
+ },
476
+ {
477
+ "name": "merge",
478
+ "params": [
479
+ "dataSource",
480
+ "fields"
481
+ ],
482
+ "docs": {
483
+ "description": "Merges fields into each item in an array.",
484
+ "tags": [
485
+ {
486
+ "title": "public",
487
+ "description": null,
488
+ "type": null
489
+ },
490
+ {
491
+ "title": "example",
492
+ "description": "merge(\n \"$.books[*]\",\n fields(\n field( \"publisher\", sourceValue(\"$.publisher\") )\n )\n)"
493
+ },
494
+ {
495
+ "title": "function",
496
+ "description": null,
497
+ "name": null
498
+ },
499
+ {
500
+ "title": "param",
501
+ "description": null,
502
+ "type": {
503
+ "type": "NameExpression",
504
+ "name": "DataSource"
505
+ },
506
+ "name": "dataSource"
507
+ },
508
+ {
509
+ "title": "param",
510
+ "description": "Group of fields to merge in.",
511
+ "type": {
512
+ "type": "NameExpression",
513
+ "name": "Object"
514
+ },
515
+ "name": "fields"
516
+ },
517
+ {
518
+ "title": "returns",
519
+ "description": null,
520
+ "type": {
521
+ "type": "NameExpression",
522
+ "name": "DataSource"
523
+ }
524
+ }
525
+ ]
526
+ },
527
+ "valid": true
528
+ },
529
+ {
530
+ "name": "arrayToString",
531
+ "params": [
532
+ "arr",
533
+ "separator"
534
+ ],
535
+ "docs": {
536
+ "description": "Turns an array into a string, separated by X.",
537
+ "tags": [
538
+ {
539
+ "title": "public",
540
+ "description": null,
541
+ "type": null
542
+ },
543
+ {
544
+ "title": "example",
545
+ "description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
546
+ },
547
+ {
548
+ "title": "function",
549
+ "description": null,
550
+ "name": null
551
+ },
552
+ {
553
+ "title": "param",
554
+ "description": "Array of toString'able primatives.",
555
+ "type": {
556
+ "type": "NameExpression",
557
+ "name": "array"
558
+ },
559
+ "name": "arr"
560
+ },
561
+ {
562
+ "title": "param",
563
+ "description": "Separator string.",
564
+ "type": {
565
+ "type": "NameExpression",
566
+ "name": "string"
567
+ },
568
+ "name": "separator"
569
+ },
570
+ {
571
+ "title": "returns",
572
+ "description": null,
573
+ "type": {
574
+ "type": "NameExpression",
575
+ "name": "string"
576
+ }
577
+ }
578
+ ]
579
+ },
580
+ "valid": true
581
+ }
582
+ ]
583
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "properties": {
4
+ "baseUrl": {
5
+ "title": "Base URL",
6
+ "type": "string",
7
+ "description": "Satusehat base URL",
8
+ "format": "uri",
9
+ "minLength": 1,
10
+ "examples": [
11
+ "https://www.satusehat.com"
12
+ ]
13
+ },
14
+ "clientId": {
15
+ "title": "Client Id",
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "description": "Your Satusehat client id",
19
+ "examples": [
20
+ "the-long-uuid-provided-by-satusehat-for-your-organization"
21
+ ]
22
+ },
23
+ "clientSecret": {
24
+ "title": "Client Secret",
25
+ "type": "string",
26
+ "description": "Client Secret",
27
+ "minLength": 1,
28
+ "examples": [
29
+ "the-long-secret-key-provided-by-satusehat"
30
+ ]
31
+ },
32
+ "access_token": {
33
+ "title": "Access Token",
34
+ "type": "string",
35
+ "description": "Your Satusehat access token",
36
+ "writeOnly": true,
37
+ "minLength": 1,
38
+ "examples": [
39
+ "the-long-access-token-from-your-auth"
40
+ ]
41
+ }
42
+ },
43
+ "type": "object",
44
+ "additionalProperties": true,
45
+ "required": [
46
+ "baseUrl",
47
+ "clientId",
48
+ "clientSecret"
49
+ ]
50
+ }