@openfn/language-mysql 1.5.0 → 1.5.2
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 +246 -44
- package/package.json +2 -2
- package/types/Adaptor.d.ts +5 -0
package/ast.json
CHANGED
|
@@ -1,5 +1,111 @@
|
|
|
1
1
|
{
|
|
2
2
|
"operations": [
|
|
3
|
+
{
|
|
4
|
+
"name": "insert",
|
|
5
|
+
"params": [
|
|
6
|
+
"table",
|
|
7
|
+
"fields"
|
|
8
|
+
],
|
|
9
|
+
"docs": {
|
|
10
|
+
"description": "Insert a record",
|
|
11
|
+
"tags": [
|
|
12
|
+
{
|
|
13
|
+
"title": "example",
|
|
14
|
+
"description": "execute(\n insert('table', fields(\n field('name', dataValue('name'))\n ))\n)(state)"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"title": "function",
|
|
18
|
+
"description": null,
|
|
19
|
+
"name": null
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"title": "public",
|
|
23
|
+
"description": null,
|
|
24
|
+
"type": null
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"title": "param",
|
|
28
|
+
"description": "The target table",
|
|
29
|
+
"type": {
|
|
30
|
+
"type": "NameExpression",
|
|
31
|
+
"name": "string"
|
|
32
|
+
},
|
|
33
|
+
"name": "table"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"title": "param",
|
|
37
|
+
"description": "A fields object",
|
|
38
|
+
"type": {
|
|
39
|
+
"type": "NameExpression",
|
|
40
|
+
"name": "object"
|
|
41
|
+
},
|
|
42
|
+
"name": "fields"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"title": "returns",
|
|
46
|
+
"description": null,
|
|
47
|
+
"type": {
|
|
48
|
+
"type": "NameExpression",
|
|
49
|
+
"name": "Operation"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"valid": true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "upsert",
|
|
58
|
+
"params": [
|
|
59
|
+
"table",
|
|
60
|
+
"fields"
|
|
61
|
+
],
|
|
62
|
+
"docs": {
|
|
63
|
+
"description": "Insert or Update a record if matched",
|
|
64
|
+
"tags": [
|
|
65
|
+
{
|
|
66
|
+
"title": "example",
|
|
67
|
+
"description": "execute(\n upsert('table', fields(\n field('name', dataValue('name'))\n ))\n)(state)"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"title": "function",
|
|
71
|
+
"description": null,
|
|
72
|
+
"name": null
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"title": "public",
|
|
76
|
+
"description": null,
|
|
77
|
+
"type": null
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"title": "param",
|
|
81
|
+
"description": "The target table",
|
|
82
|
+
"type": {
|
|
83
|
+
"type": "NameExpression",
|
|
84
|
+
"name": "string"
|
|
85
|
+
},
|
|
86
|
+
"name": "table"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"title": "param",
|
|
90
|
+
"description": "A fields object",
|
|
91
|
+
"type": {
|
|
92
|
+
"type": "NameExpression",
|
|
93
|
+
"name": "object"
|
|
94
|
+
},
|
|
95
|
+
"name": "fields"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"title": "returns",
|
|
99
|
+
"description": null,
|
|
100
|
+
"type": {
|
|
101
|
+
"type": "NameExpression",
|
|
102
|
+
"name": "Operation"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"valid": true
|
|
108
|
+
},
|
|
3
109
|
{
|
|
4
110
|
"name": "upsertMany",
|
|
5
111
|
"params": [
|
|
@@ -23,6 +129,11 @@
|
|
|
23
129
|
"description": null,
|
|
24
130
|
"name": null
|
|
25
131
|
},
|
|
132
|
+
{
|
|
133
|
+
"title": "public",
|
|
134
|
+
"description": null,
|
|
135
|
+
"type": null
|
|
136
|
+
},
|
|
26
137
|
{
|
|
27
138
|
"title": "param",
|
|
28
139
|
"description": "The target table",
|
|
@@ -52,6 +163,92 @@
|
|
|
52
163
|
]
|
|
53
164
|
},
|
|
54
165
|
"valid": true
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "query",
|
|
169
|
+
"params": [
|
|
170
|
+
"options"
|
|
171
|
+
],
|
|
172
|
+
"docs": {
|
|
173
|
+
"description": "Execute a SQL statement",
|
|
174
|
+
"tags": [
|
|
175
|
+
{
|
|
176
|
+
"title": "example",
|
|
177
|
+
"description": "execute(\n query({ sql: 'select * from users;' })\n)(state)"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"title": "function",
|
|
181
|
+
"description": null,
|
|
182
|
+
"name": null
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"title": "public",
|
|
186
|
+
"description": null,
|
|
187
|
+
"type": null
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"title": "param",
|
|
191
|
+
"description": "Payload data for the message",
|
|
192
|
+
"type": {
|
|
193
|
+
"type": "NameExpression",
|
|
194
|
+
"name": "object"
|
|
195
|
+
},
|
|
196
|
+
"name": "options"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"title": "returns",
|
|
200
|
+
"description": null,
|
|
201
|
+
"type": {
|
|
202
|
+
"type": "NameExpression",
|
|
203
|
+
"name": "Operation"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
"valid": true
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"name": "sqlString",
|
|
212
|
+
"params": [
|
|
213
|
+
"queryString"
|
|
214
|
+
],
|
|
215
|
+
"docs": {
|
|
216
|
+
"description": "Execute a SQL statement",
|
|
217
|
+
"tags": [
|
|
218
|
+
{
|
|
219
|
+
"title": "example",
|
|
220
|
+
"description": "execute(\n sqlString(state => \"select * from items;\")\n)(state)"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"title": "function",
|
|
224
|
+
"description": null,
|
|
225
|
+
"name": null
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"title": "public",
|
|
229
|
+
"description": null,
|
|
230
|
+
"type": null
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"title": "param",
|
|
234
|
+
"description": "A query string (or function which takes state and returns a string)",
|
|
235
|
+
"type": {
|
|
236
|
+
"type": "NameExpression",
|
|
237
|
+
"name": "String"
|
|
238
|
+
},
|
|
239
|
+
"name": "queryString"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"title": "returns",
|
|
243
|
+
"description": null,
|
|
244
|
+
"type": {
|
|
245
|
+
"type": "NameExpression",
|
|
246
|
+
"name": "Operation"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
"valid": true
|
|
55
252
|
}
|
|
56
253
|
],
|
|
57
254
|
"exports": [],
|
|
@@ -69,15 +266,15 @@
|
|
|
69
266
|
"description": null,
|
|
70
267
|
"type": null
|
|
71
268
|
},
|
|
72
|
-
{
|
|
73
|
-
"title": "example",
|
|
74
|
-
"description": "fn(state => {\n // do some things to state\n return state;\n});"
|
|
75
|
-
},
|
|
76
269
|
{
|
|
77
270
|
"title": "function",
|
|
78
271
|
"description": null,
|
|
79
272
|
"name": null
|
|
80
273
|
},
|
|
274
|
+
{
|
|
275
|
+
"title": "example",
|
|
276
|
+
"description": "fn(state => {\n // do some things to state\n return state;\n});"
|
|
277
|
+
},
|
|
81
278
|
{
|
|
82
279
|
"title": "param",
|
|
83
280
|
"description": "is the function",
|
|
@@ -113,15 +310,15 @@
|
|
|
113
310
|
"description": null,
|
|
114
311
|
"type": null
|
|
115
312
|
},
|
|
116
|
-
{
|
|
117
|
-
"title": "example",
|
|
118
|
-
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
119
|
-
},
|
|
120
313
|
{
|
|
121
314
|
"title": "function",
|
|
122
315
|
"description": null,
|
|
123
316
|
"name": null
|
|
124
317
|
},
|
|
318
|
+
{
|
|
319
|
+
"title": "example",
|
|
320
|
+
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
321
|
+
},
|
|
125
322
|
{
|
|
126
323
|
"title": "param",
|
|
127
324
|
"description": "The condition that returns true",
|
|
@@ -165,15 +362,15 @@
|
|
|
165
362
|
"description": null,
|
|
166
363
|
"type": null
|
|
167
364
|
},
|
|
168
|
-
{
|
|
169
|
-
"title": "example",
|
|
170
|
-
"description": "sourceValue('$.key')"
|
|
171
|
-
},
|
|
172
365
|
{
|
|
173
366
|
"title": "function",
|
|
174
367
|
"description": null,
|
|
175
368
|
"name": null
|
|
176
369
|
},
|
|
370
|
+
{
|
|
371
|
+
"title": "example",
|
|
372
|
+
"description": "sourceValue('$.key')"
|
|
373
|
+
},
|
|
177
374
|
{
|
|
178
375
|
"title": "param",
|
|
179
376
|
"description": "JSONPath referencing a point in `state`.",
|
|
@@ -208,15 +405,15 @@
|
|
|
208
405
|
"description": null,
|
|
209
406
|
"type": null
|
|
210
407
|
},
|
|
211
|
-
{
|
|
212
|
-
"title": "example",
|
|
213
|
-
"description": "dataPath('key')"
|
|
214
|
-
},
|
|
215
408
|
{
|
|
216
409
|
"title": "function",
|
|
217
410
|
"description": null,
|
|
218
411
|
"name": null
|
|
219
412
|
},
|
|
413
|
+
{
|
|
414
|
+
"title": "example",
|
|
415
|
+
"description": "dataPath('key')"
|
|
416
|
+
},
|
|
220
417
|
{
|
|
221
418
|
"title": "param",
|
|
222
419
|
"description": "JSONPath referencing a point in `data`.",
|
|
@@ -251,15 +448,15 @@
|
|
|
251
448
|
"description": null,
|
|
252
449
|
"type": null
|
|
253
450
|
},
|
|
254
|
-
{
|
|
255
|
-
"title": "example",
|
|
256
|
-
"description": "dataValue('key')"
|
|
257
|
-
},
|
|
258
451
|
{
|
|
259
452
|
"title": "function",
|
|
260
453
|
"description": null,
|
|
261
454
|
"name": null
|
|
262
455
|
},
|
|
456
|
+
{
|
|
457
|
+
"title": "example",
|
|
458
|
+
"description": "dataValue('key')"
|
|
459
|
+
},
|
|
263
460
|
{
|
|
264
461
|
"title": "param",
|
|
265
462
|
"description": "JSONPath referencing a point in `data`.",
|
|
@@ -294,15 +491,15 @@
|
|
|
294
491
|
"description": null,
|
|
295
492
|
"type": null
|
|
296
493
|
},
|
|
297
|
-
{
|
|
298
|
-
"title": "example",
|
|
299
|
-
"description": "lastReferenceValue('key')"
|
|
300
|
-
},
|
|
301
494
|
{
|
|
302
495
|
"title": "function",
|
|
303
496
|
"description": null,
|
|
304
497
|
"name": null
|
|
305
498
|
},
|
|
499
|
+
{
|
|
500
|
+
"title": "example",
|
|
501
|
+
"description": "lastReferenceValue('key')"
|
|
502
|
+
},
|
|
306
503
|
{
|
|
307
504
|
"title": "param",
|
|
308
505
|
"description": "JSONPath referencing a point in `references`.",
|
|
@@ -338,15 +535,15 @@
|
|
|
338
535
|
"description": null,
|
|
339
536
|
"type": null
|
|
340
537
|
},
|
|
341
|
-
{
|
|
342
|
-
"title": "example",
|
|
343
|
-
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
344
|
-
},
|
|
345
538
|
{
|
|
346
539
|
"title": "function",
|
|
347
540
|
"description": null,
|
|
348
541
|
"name": null
|
|
349
542
|
},
|
|
543
|
+
{
|
|
544
|
+
"title": "example",
|
|
545
|
+
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
546
|
+
},
|
|
350
547
|
{
|
|
351
548
|
"title": "param",
|
|
352
549
|
"description": "JSONPath referencing a point in `state`.",
|
|
@@ -390,15 +587,15 @@
|
|
|
390
587
|
"description": null,
|
|
391
588
|
"type": null
|
|
392
589
|
},
|
|
393
|
-
{
|
|
394
|
-
"title": "example",
|
|
395
|
-
"description": "combine(\n create('foo'),\n delete('bar')\n)"
|
|
396
|
-
},
|
|
397
590
|
{
|
|
398
591
|
"title": "function",
|
|
399
592
|
"description": null,
|
|
400
593
|
"name": null
|
|
401
594
|
},
|
|
595
|
+
{
|
|
596
|
+
"title": "example",
|
|
597
|
+
"description": "combine(\n create('foo'),\n delete('bar')\n)"
|
|
598
|
+
},
|
|
402
599
|
{
|
|
403
600
|
"title": "param",
|
|
404
601
|
"description": "Operations to be performed.",
|
|
@@ -434,15 +631,15 @@
|
|
|
434
631
|
"description": null,
|
|
435
632
|
"type": null
|
|
436
633
|
},
|
|
437
|
-
{
|
|
438
|
-
"title": "example",
|
|
439
|
-
"description": "field('destination_field_name__c', 'value')"
|
|
440
|
-
},
|
|
441
634
|
{
|
|
442
635
|
"title": "function",
|
|
443
636
|
"description": null,
|
|
444
637
|
"name": null
|
|
445
638
|
},
|
|
639
|
+
{
|
|
640
|
+
"title": "example",
|
|
641
|
+
"description": "field('destination_field_name__c', 'value')"
|
|
642
|
+
},
|
|
446
643
|
{
|
|
447
644
|
"title": "param",
|
|
448
645
|
"description": "Name of the field",
|
|
@@ -486,15 +683,15 @@
|
|
|
486
683
|
"description": null,
|
|
487
684
|
"type": null
|
|
488
685
|
},
|
|
489
|
-
{
|
|
490
|
-
"title": "example",
|
|
491
|
-
"description": "fields(list_of_fields)"
|
|
492
|
-
},
|
|
493
686
|
{
|
|
494
687
|
"title": "function",
|
|
495
688
|
"description": null,
|
|
496
689
|
"name": null
|
|
497
690
|
},
|
|
691
|
+
{
|
|
692
|
+
"title": "example",
|
|
693
|
+
"description": "fields(list_of_fields)"
|
|
694
|
+
},
|
|
498
695
|
{
|
|
499
696
|
"title": "param",
|
|
500
697
|
"description": "a list of fields",
|
|
@@ -539,6 +736,11 @@
|
|
|
539
736
|
"description": null,
|
|
540
737
|
"name": null
|
|
541
738
|
},
|
|
739
|
+
{
|
|
740
|
+
"title": "public",
|
|
741
|
+
"description": null,
|
|
742
|
+
"type": null
|
|
743
|
+
},
|
|
542
744
|
{
|
|
543
745
|
"title": "param",
|
|
544
746
|
"description": null,
|
|
@@ -583,15 +785,15 @@
|
|
|
583
785
|
"description": null,
|
|
584
786
|
"type": null
|
|
585
787
|
},
|
|
586
|
-
{
|
|
587
|
-
"title": "example",
|
|
588
|
-
"description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
|
|
589
|
-
},
|
|
590
788
|
{
|
|
591
789
|
"title": "function",
|
|
592
790
|
"description": null,
|
|
593
791
|
"name": null
|
|
594
792
|
},
|
|
793
|
+
{
|
|
794
|
+
"title": "example",
|
|
795
|
+
"description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
|
|
796
|
+
},
|
|
595
797
|
{
|
|
596
798
|
"title": "param",
|
|
597
799
|
"description": "Array of toString'able primatives.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-mysql",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "A MySQL Language Pack for OpenFn",
|
|
5
5
|
"homepage": "https://docs.openfn.org",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"configuration-schema.json"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@openfn/language-common": "1.
|
|
20
|
+
"@openfn/language-common": "1.15.1",
|
|
21
21
|
"json-sql": "^0.3.10",
|
|
22
22
|
"mysql": "^2.13.0",
|
|
23
23
|
"squel": "^5.8.0",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export function execute(...operations: Operations): Operation;
|
|
|
20
20
|
* ))
|
|
21
21
|
* )(state)
|
|
22
22
|
* @function
|
|
23
|
+
* @public
|
|
23
24
|
* @param {string} table - The target table
|
|
24
25
|
* @param {object} fields - A fields object
|
|
25
26
|
* @returns {Operation}
|
|
@@ -34,6 +35,7 @@ export function insert(table: string, fields: object): Operation;
|
|
|
34
35
|
* ))
|
|
35
36
|
* )(state)
|
|
36
37
|
* @function
|
|
38
|
+
* @public
|
|
37
39
|
* @param {string} table - The target table
|
|
38
40
|
* @param {object} fields - A fields object
|
|
39
41
|
* @returns {Operation}
|
|
@@ -51,6 +53,7 @@ export function upsert(table: string, fields: object): Operation;
|
|
|
51
53
|
* ]
|
|
52
54
|
* )
|
|
53
55
|
* @function
|
|
56
|
+
* @public
|
|
54
57
|
* @param {string} table - The target table
|
|
55
58
|
* @param {array} data - An array of objects or a function that returns an array
|
|
56
59
|
* @returns {Operation}
|
|
@@ -63,6 +66,7 @@ export function upsertMany(table: string, data: any[]): Operation;
|
|
|
63
66
|
* query({ sql: 'select * from users;' })
|
|
64
67
|
* )(state)
|
|
65
68
|
* @function
|
|
69
|
+
* @public
|
|
66
70
|
* @param {object} options - Payload data for the message
|
|
67
71
|
* @returns {Operation}
|
|
68
72
|
*/
|
|
@@ -74,6 +78,7 @@ export function query(options: object): Operation;
|
|
|
74
78
|
* sqlString(state => "select * from items;")
|
|
75
79
|
* )(state)
|
|
76
80
|
* @function
|
|
81
|
+
* @public
|
|
77
82
|
* @param {String} queryString - A query string (or function which takes state and returns a string)
|
|
78
83
|
* @returns {Operation}
|
|
79
84
|
*/
|