@openfn/language-odoo 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,688 @@
1
+ {
2
+ "operations": [
3
+ {
4
+ "name": "create",
5
+ "params": [
6
+ "model",
7
+ "data",
8
+ "options"
9
+ ],
10
+ "docs": {
11
+ "description": "Create a record in Odoo",
12
+ "tags": [
13
+ {
14
+ "title": "public",
15
+ "description": null,
16
+ "type": null
17
+ },
18
+ {
19
+ "title": "example",
20
+ "description": "create(\"res.partner\", { name: \"Kool Keith\" }, {externalId: 23});"
21
+ },
22
+ {
23
+ "title": "function",
24
+ "description": null,
25
+ "name": null
26
+ },
27
+ {
28
+ "title": "param",
29
+ "description": "The specific record model i.e. \"res.partner\"",
30
+ "type": {
31
+ "type": "NameExpression",
32
+ "name": "string"
33
+ },
34
+ "name": "model"
35
+ },
36
+ {
37
+ "title": "param",
38
+ "description": "The data to be created in JSON.",
39
+ "type": {
40
+ "type": "NameExpression",
41
+ "name": "object"
42
+ },
43
+ "name": "data"
44
+ },
45
+ {
46
+ "title": "param",
47
+ "description": "Optional external ID for the record.",
48
+ "type": {
49
+ "type": "NameExpression",
50
+ "name": "object"
51
+ },
52
+ "name": "options"
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
+ "name": "read",
68
+ "params": [
69
+ "model",
70
+ "recordId",
71
+ "fields"
72
+ ],
73
+ "docs": {
74
+ "description": "Get a record from Odoo. Returns all fields unless a field list is provided as a third argument",
75
+ "tags": [
76
+ {
77
+ "title": "public",
78
+ "description": null,
79
+ "type": null
80
+ },
81
+ {
82
+ "title": "example",
83
+ "description": "read(\"res.partner\", [1] , [name]);",
84
+ "caption": "Download records with select fields"
85
+ },
86
+ {
87
+ "title": "example",
88
+ "description": "read(\"res.partner\", $.recordIds);",
89
+ "caption": "Download a single record with all fields"
90
+ },
91
+ {
92
+ "title": "function",
93
+ "description": null,
94
+ "name": null
95
+ },
96
+ {
97
+ "title": "param",
98
+ "description": "The specific record model from i.e. \"res.partner\"",
99
+ "type": {
100
+ "type": "NameExpression",
101
+ "name": "string"
102
+ },
103
+ "name": "model"
104
+ },
105
+ {
106
+ "title": "param",
107
+ "description": "An array of record IDs to read.",
108
+ "type": {
109
+ "type": "NameExpression",
110
+ "name": "number"
111
+ },
112
+ "name": "recordId"
113
+ },
114
+ {
115
+ "title": "param",
116
+ "description": "An optional array of fields to read from the record.",
117
+ "type": {
118
+ "type": "NameExpression",
119
+ "name": "string"
120
+ },
121
+ "name": "fields"
122
+ },
123
+ {
124
+ "title": "returns",
125
+ "description": null,
126
+ "type": {
127
+ "type": "NameExpression",
128
+ "name": "Operation"
129
+ }
130
+ }
131
+ ]
132
+ },
133
+ "valid": true
134
+ },
135
+ {
136
+ "name": "update",
137
+ "params": [
138
+ "model",
139
+ "recordId",
140
+ "data"
141
+ ],
142
+ "docs": {
143
+ "description": "Update a record in Odoo",
144
+ "tags": [
145
+ {
146
+ "title": "public",
147
+ "description": null,
148
+ "type": null
149
+ },
150
+ {
151
+ "title": "example",
152
+ "description": "update(\"res.partner\", 54 , {name: 'Jane Doe'});"
153
+ },
154
+ {
155
+ "title": "function",
156
+ "description": null,
157
+ "name": null
158
+ },
159
+ {
160
+ "title": "param",
161
+ "description": "The specific record model i.e. \"res.partner\"",
162
+ "type": {
163
+ "type": "NameExpression",
164
+ "name": "string"
165
+ },
166
+ "name": "model"
167
+ },
168
+ {
169
+ "title": "param",
170
+ "description": "The specific recordId to be updated.",
171
+ "type": {
172
+ "type": "NameExpression",
173
+ "name": "number"
174
+ },
175
+ "name": "recordId"
176
+ },
177
+ {
178
+ "title": "param",
179
+ "description": "The data to be updated in JSON.",
180
+ "type": {
181
+ "type": "NameExpression",
182
+ "name": "object"
183
+ },
184
+ "name": "data"
185
+ },
186
+ {
187
+ "title": "returns",
188
+ "description": null,
189
+ "type": {
190
+ "type": "NameExpression",
191
+ "name": "Operation"
192
+ }
193
+ }
194
+ ]
195
+ },
196
+ "valid": true
197
+ },
198
+ {
199
+ "name": "deleteRecord",
200
+ "params": [
201
+ "model",
202
+ "recordId"
203
+ ],
204
+ "docs": {
205
+ "description": "Delete a record from Odoo",
206
+ "tags": [
207
+ {
208
+ "title": "public",
209
+ "description": null,
210
+ "type": null
211
+ },
212
+ {
213
+ "title": "example",
214
+ "description": "deleteRecord(\"res.partner\", 54 );"
215
+ },
216
+ {
217
+ "title": "function",
218
+ "description": null,
219
+ "name": null
220
+ },
221
+ {
222
+ "title": "param",
223
+ "description": "The specific record model i.e. \"res.partner\"",
224
+ "type": {
225
+ "type": "NameExpression",
226
+ "name": "string"
227
+ },
228
+ "name": "model"
229
+ },
230
+ {
231
+ "title": "param",
232
+ "description": "The specific recordId to be deleted.",
233
+ "type": {
234
+ "type": "NameExpression",
235
+ "name": "number"
236
+ },
237
+ "name": "recordId"
238
+ },
239
+ {
240
+ "title": "returns",
241
+ "description": null,
242
+ "type": {
243
+ "type": "NameExpression",
244
+ "name": "Operation"
245
+ }
246
+ }
247
+ ]
248
+ },
249
+ "valid": true
250
+ }
251
+ ],
252
+ "exports": [],
253
+ "common": [
254
+ {
255
+ "name": "fn",
256
+ "params": [
257
+ "func"
258
+ ],
259
+ "docs": {
260
+ "description": "Creates a custom step (or operation) for more flexible job writing.",
261
+ "tags": [
262
+ {
263
+ "title": "public",
264
+ "description": null,
265
+ "type": null
266
+ },
267
+ {
268
+ "title": "function",
269
+ "description": null,
270
+ "name": null
271
+ },
272
+ {
273
+ "title": "example",
274
+ "description": "fn(state => {\n // do some things to state\n return state;\n});"
275
+ },
276
+ {
277
+ "title": "param",
278
+ "description": "is the function",
279
+ "type": {
280
+ "type": "NameExpression",
281
+ "name": "Function"
282
+ },
283
+ "name": "func"
284
+ },
285
+ {
286
+ "title": "returns",
287
+ "description": null,
288
+ "type": {
289
+ "type": "NameExpression",
290
+ "name": "Operation"
291
+ }
292
+ }
293
+ ]
294
+ },
295
+ "valid": true
296
+ },
297
+ {
298
+ "name": "sourceValue",
299
+ "params": [
300
+ "path"
301
+ ],
302
+ "docs": {
303
+ "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.",
304
+ "tags": [
305
+ {
306
+ "title": "public",
307
+ "description": null,
308
+ "type": null
309
+ },
310
+ {
311
+ "title": "function",
312
+ "description": null,
313
+ "name": null
314
+ },
315
+ {
316
+ "title": "example",
317
+ "description": "sourceValue('$.key')"
318
+ },
319
+ {
320
+ "title": "param",
321
+ "description": "JSONPath referencing a point in `state`.",
322
+ "type": {
323
+ "type": "NameExpression",
324
+ "name": "String"
325
+ },
326
+ "name": "path"
327
+ },
328
+ {
329
+ "title": "returns",
330
+ "description": null,
331
+ "type": {
332
+ "type": "NameExpression",
333
+ "name": "Operation"
334
+ }
335
+ }
336
+ ]
337
+ },
338
+ "valid": true
339
+ },
340
+ {
341
+ "name": "dataPath",
342
+ "params": [
343
+ "path"
344
+ ],
345
+ "docs": {
346
+ "description": "Ensures a path points at the data.",
347
+ "tags": [
348
+ {
349
+ "title": "public",
350
+ "description": null,
351
+ "type": null
352
+ },
353
+ {
354
+ "title": "function",
355
+ "description": null,
356
+ "name": null
357
+ },
358
+ {
359
+ "title": "example",
360
+ "description": "dataPath('key')"
361
+ },
362
+ {
363
+ "title": "param",
364
+ "description": "JSONPath referencing a point in `data`.",
365
+ "type": {
366
+ "type": "NameExpression",
367
+ "name": "string"
368
+ },
369
+ "name": "path"
370
+ },
371
+ {
372
+ "title": "returns",
373
+ "description": null,
374
+ "type": {
375
+ "type": "NameExpression",
376
+ "name": "string"
377
+ }
378
+ }
379
+ ]
380
+ },
381
+ "valid": true
382
+ },
383
+ {
384
+ "name": "dataValue",
385
+ "params": [
386
+ "path"
387
+ ],
388
+ "docs": {
389
+ "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.",
390
+ "tags": [
391
+ {
392
+ "title": "public",
393
+ "description": null,
394
+ "type": null
395
+ },
396
+ {
397
+ "title": "function",
398
+ "description": null,
399
+ "name": null
400
+ },
401
+ {
402
+ "title": "example",
403
+ "description": "dataValue('key')"
404
+ },
405
+ {
406
+ "title": "param",
407
+ "description": "JSONPath referencing a point in `data`.",
408
+ "type": {
409
+ "type": "NameExpression",
410
+ "name": "String"
411
+ },
412
+ "name": "path"
413
+ },
414
+ {
415
+ "title": "returns",
416
+ "description": null,
417
+ "type": {
418
+ "type": "NameExpression",
419
+ "name": "Operation"
420
+ }
421
+ }
422
+ ]
423
+ },
424
+ "valid": true
425
+ },
426
+ {
427
+ "name": "lastReferenceValue",
428
+ "params": [
429
+ "path"
430
+ ],
431
+ "docs": {
432
+ "description": "Picks out the last reference value from source data.",
433
+ "tags": [
434
+ {
435
+ "title": "public",
436
+ "description": null,
437
+ "type": null
438
+ },
439
+ {
440
+ "title": "function",
441
+ "description": null,
442
+ "name": null
443
+ },
444
+ {
445
+ "title": "example",
446
+ "description": "lastReferenceValue('key')"
447
+ },
448
+ {
449
+ "title": "param",
450
+ "description": "JSONPath referencing a point in `references`.",
451
+ "type": {
452
+ "type": "NameExpression",
453
+ "name": "String"
454
+ },
455
+ "name": "path"
456
+ },
457
+ {
458
+ "title": "returns",
459
+ "description": null,
460
+ "type": {
461
+ "type": "NameExpression",
462
+ "name": "Operation"
463
+ }
464
+ }
465
+ ]
466
+ },
467
+ "valid": true
468
+ },
469
+ {
470
+ "name": "each",
471
+ "params": [
472
+ "dataSource",
473
+ "operation"
474
+ ],
475
+ "docs": {
476
+ "description": "Iterates over an array of items and invokes an operation upon each one, where the state\nobject is _scoped_ so that state.data is the item under iteration.\nThe rest of the state object is untouched and can be referenced as usual.\nYou can pass an array directly, or use lazy state or a JSONPath string to\nreference a slice of state.",
477
+ "tags": [
478
+ {
479
+ "title": "public",
480
+ "description": null,
481
+ "type": null
482
+ },
483
+ {
484
+ "title": "function",
485
+ "description": null,
486
+ "name": null
487
+ },
488
+ {
489
+ "title": "example",
490
+ "description": "each(\n $.data,\n // Inside the callback operation, `$.data` is scoped to the item under iteration\n insert(\"patient\", {\n patient_name: $.data.properties.case_name,\n patient_id: $.data.case_id,\n })\n);",
491
+ "caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
492
+ },
493
+ {
494
+ "title": "example",
495
+ "description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
496
+ "caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
497
+ },
498
+ {
499
+ "title": "example",
500
+ "description": "each(\n \"$.data[*]\",\n insert(\"patient\", (state) => ({\n patient_name: state.data.properties.case_name,\n patient_id: state.data.case_id,\n }))\n);",
501
+ "caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
502
+ },
503
+ {
504
+ "title": "param",
505
+ "description": "JSONPath referencing a point in `state`.",
506
+ "type": {
507
+ "type": "NameExpression",
508
+ "name": "DataSource"
509
+ },
510
+ "name": "dataSource"
511
+ },
512
+ {
513
+ "title": "param",
514
+ "description": "The operation needed to be repeated.",
515
+ "type": {
516
+ "type": "NameExpression",
517
+ "name": "Operation"
518
+ },
519
+ "name": "operation"
520
+ },
521
+ {
522
+ "title": "returns",
523
+ "description": null,
524
+ "type": {
525
+ "type": "NameExpression",
526
+ "name": "Operation"
527
+ }
528
+ }
529
+ ]
530
+ },
531
+ "valid": true
532
+ },
533
+ {
534
+ "name": "field",
535
+ "params": [
536
+ "key",
537
+ "value"
538
+ ],
539
+ "docs": {
540
+ "description": "Returns a key, value pair in an array.",
541
+ "tags": [
542
+ {
543
+ "title": "public",
544
+ "description": null,
545
+ "type": null
546
+ },
547
+ {
548
+ "title": "function",
549
+ "description": null,
550
+ "name": null
551
+ },
552
+ {
553
+ "title": "example",
554
+ "description": "field('destination_field_name__c', 'value')"
555
+ },
556
+ {
557
+ "title": "param",
558
+ "description": "Name of the field",
559
+ "type": {
560
+ "type": "NameExpression",
561
+ "name": "string"
562
+ },
563
+ "name": "key"
564
+ },
565
+ {
566
+ "title": "param",
567
+ "description": "The value itself or a sourceable operation.",
568
+ "type": {
569
+ "type": "NameExpression",
570
+ "name": "Value"
571
+ },
572
+ "name": "value"
573
+ },
574
+ {
575
+ "title": "returns",
576
+ "description": null,
577
+ "type": {
578
+ "type": "NameExpression",
579
+ "name": "Field"
580
+ }
581
+ }
582
+ ]
583
+ },
584
+ "valid": true
585
+ },
586
+ {
587
+ "name": "fields",
588
+ "params": [
589
+ "fields"
590
+ ],
591
+ "docs": {
592
+ "description": "Zips key value pairs into an object.",
593
+ "tags": [
594
+ {
595
+ "title": "public",
596
+ "description": null,
597
+ "type": null
598
+ },
599
+ {
600
+ "title": "function",
601
+ "description": null,
602
+ "name": null
603
+ },
604
+ {
605
+ "title": "example",
606
+ "description": "fields(list_of_fields)"
607
+ },
608
+ {
609
+ "title": "param",
610
+ "description": "a list of fields",
611
+ "type": {
612
+ "type": "NameExpression",
613
+ "name": "Fields"
614
+ },
615
+ "name": "fields"
616
+ },
617
+ {
618
+ "title": "returns",
619
+ "description": null,
620
+ "type": {
621
+ "type": "NameExpression",
622
+ "name": "Object"
623
+ }
624
+ }
625
+ ]
626
+ },
627
+ "valid": true
628
+ },
629
+ {
630
+ "name": "merge",
631
+ "params": [
632
+ "dataSource",
633
+ "fields"
634
+ ],
635
+ "docs": {
636
+ "description": "Merges fields into each item in an array.",
637
+ "tags": [
638
+ {
639
+ "title": "public",
640
+ "description": null,
641
+ "type": null
642
+ },
643
+ {
644
+ "title": "example",
645
+ "description": "merge(\n \"$.books[*]\",\n fields(\n field( \"publisher\", sourceValue(\"$.publisher\") )\n )\n)"
646
+ },
647
+ {
648
+ "title": "function",
649
+ "description": null,
650
+ "name": null
651
+ },
652
+ {
653
+ "title": "public",
654
+ "description": null,
655
+ "type": null
656
+ },
657
+ {
658
+ "title": "param",
659
+ "description": null,
660
+ "type": {
661
+ "type": "NameExpression",
662
+ "name": "DataSource"
663
+ },
664
+ "name": "dataSource"
665
+ },
666
+ {
667
+ "title": "param",
668
+ "description": "Group of fields to merge in.",
669
+ "type": {
670
+ "type": "NameExpression",
671
+ "name": "Object"
672
+ },
673
+ "name": "fields"
674
+ },
675
+ {
676
+ "title": "returns",
677
+ "description": null,
678
+ "type": {
679
+ "type": "NameExpression",
680
+ "name": "DataSource"
681
+ }
682
+ }
683
+ ]
684
+ },
685
+ "valid": true
686
+ }
687
+ ]
688
+ }