@openfn/language-mongodb 2.0.2 → 2.1.1
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 +220 -32
- package/dist/index.cjs +3 -0
- package/dist/index.js +3 -0
- package/package.json +2 -2
- package/types/Adaptor.d.ts +4 -1
package/ast.json
CHANGED
|
@@ -1,5 +1,135 @@
|
|
|
1
1
|
{
|
|
2
|
-
"operations": [
|
|
2
|
+
"operations": [
|
|
3
|
+
{
|
|
4
|
+
"name": "insertDocuments",
|
|
5
|
+
"params": [
|
|
6
|
+
"params"
|
|
7
|
+
],
|
|
8
|
+
"docs": {
|
|
9
|
+
"description": "Inserts documents into a mongoDb collection",
|
|
10
|
+
"tags": [
|
|
11
|
+
{
|
|
12
|
+
"title": "example",
|
|
13
|
+
"description": "insertDocuments({\n database: 'str',\n collection: 'kids',\n documents: [1,2,3]\n });"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"title": "function",
|
|
17
|
+
"description": null,
|
|
18
|
+
"name": null
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"title": "public",
|
|
22
|
+
"description": null,
|
|
23
|
+
"type": null
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"title": "param",
|
|
27
|
+
"description": "Configuration for mongo",
|
|
28
|
+
"type": {
|
|
29
|
+
"type": "NameExpression",
|
|
30
|
+
"name": "object"
|
|
31
|
+
},
|
|
32
|
+
"name": "params"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"title": "returns",
|
|
36
|
+
"description": null,
|
|
37
|
+
"type": {
|
|
38
|
+
"type": "NameExpression",
|
|
39
|
+
"name": "State"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"valid": true
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "findDocuments",
|
|
48
|
+
"params": [
|
|
49
|
+
"params"
|
|
50
|
+
],
|
|
51
|
+
"docs": {
|
|
52
|
+
"description": "Find documents in a mongoDb collection",
|
|
53
|
+
"tags": [
|
|
54
|
+
{
|
|
55
|
+
"title": "example",
|
|
56
|
+
"description": "findDocuments({\n database: 'str',\n collection: 'cases',\n query: {a:3}\n });"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"title": "function",
|
|
60
|
+
"description": null,
|
|
61
|
+
"name": null
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"title": "public",
|
|
65
|
+
"description": null,
|
|
66
|
+
"type": null
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"title": "param",
|
|
70
|
+
"description": "Configuration for mongo",
|
|
71
|
+
"type": {
|
|
72
|
+
"type": "NameExpression",
|
|
73
|
+
"name": "object"
|
|
74
|
+
},
|
|
75
|
+
"name": "params"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"title": "returns",
|
|
79
|
+
"description": null,
|
|
80
|
+
"type": {
|
|
81
|
+
"type": "NameExpression",
|
|
82
|
+
"name": "State"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"valid": true
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "updateDocument",
|
|
91
|
+
"params": [
|
|
92
|
+
"params"
|
|
93
|
+
],
|
|
94
|
+
"docs": {
|
|
95
|
+
"description": "Updates document (optionally upserting) into a mongoDb collection",
|
|
96
|
+
"tags": [
|
|
97
|
+
{
|
|
98
|
+
"title": "example",
|
|
99
|
+
"description": "updateDocuments({\n database: 'str',\n collection: 'animals',\n filter: { type: 'fuzzy' },\n changes: { kind: 'soft' },\n options: { upsert: true }\n });"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"title": "function",
|
|
103
|
+
"description": null,
|
|
104
|
+
"name": null
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"title": "public",
|
|
108
|
+
"description": null,
|
|
109
|
+
"type": null
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"title": "param",
|
|
113
|
+
"description": "Configuration for mongo",
|
|
114
|
+
"type": {
|
|
115
|
+
"type": "NameExpression",
|
|
116
|
+
"name": "object"
|
|
117
|
+
},
|
|
118
|
+
"name": "params"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"title": "returns",
|
|
122
|
+
"description": null,
|
|
123
|
+
"type": {
|
|
124
|
+
"type": "NameExpression",
|
|
125
|
+
"name": "State"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
"valid": true
|
|
131
|
+
}
|
|
132
|
+
],
|
|
3
133
|
"exports": [],
|
|
4
134
|
"common": [
|
|
5
135
|
{
|
|
@@ -15,23 +145,76 @@
|
|
|
15
145
|
"description": null,
|
|
16
146
|
"type": null
|
|
17
147
|
},
|
|
148
|
+
{
|
|
149
|
+
"title": "function",
|
|
150
|
+
"description": null,
|
|
151
|
+
"name": null
|
|
152
|
+
},
|
|
18
153
|
{
|
|
19
154
|
"title": "example",
|
|
20
155
|
"description": "fn(state => {\n // do some things to state\n return state;\n});"
|
|
21
156
|
},
|
|
157
|
+
{
|
|
158
|
+
"title": "param",
|
|
159
|
+
"description": "is the function",
|
|
160
|
+
"type": {
|
|
161
|
+
"type": "NameExpression",
|
|
162
|
+
"name": "Function"
|
|
163
|
+
},
|
|
164
|
+
"name": "func"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"title": "returns",
|
|
168
|
+
"description": null,
|
|
169
|
+
"type": {
|
|
170
|
+
"type": "NameExpression",
|
|
171
|
+
"name": "Operation"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
"valid": true
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"name": "fnIf",
|
|
180
|
+
"params": [
|
|
181
|
+
"condition",
|
|
182
|
+
"operation"
|
|
183
|
+
],
|
|
184
|
+
"docs": {
|
|
185
|
+
"description": "A custom operation that will only execute the function if the condition returns true",
|
|
186
|
+
"tags": [
|
|
187
|
+
{
|
|
188
|
+
"title": "public",
|
|
189
|
+
"description": null,
|
|
190
|
+
"type": null
|
|
191
|
+
},
|
|
22
192
|
{
|
|
23
193
|
"title": "function",
|
|
24
194
|
"description": null,
|
|
25
195
|
"name": null
|
|
26
196
|
},
|
|
197
|
+
{
|
|
198
|
+
"title": "example",
|
|
199
|
+
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
200
|
+
},
|
|
27
201
|
{
|
|
28
202
|
"title": "param",
|
|
29
|
-
"description": "
|
|
203
|
+
"description": "The condition that returns true",
|
|
30
204
|
"type": {
|
|
31
205
|
"type": "NameExpression",
|
|
32
|
-
"name": "
|
|
206
|
+
"name": "Boolean"
|
|
33
207
|
},
|
|
34
|
-
"name": "
|
|
208
|
+
"name": "condition"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"title": "param",
|
|
212
|
+
"description": "The operation needed to be executed.",
|
|
213
|
+
"type": {
|
|
214
|
+
"type": "NameExpression",
|
|
215
|
+
"name": "Operation"
|
|
216
|
+
},
|
|
217
|
+
"name": "operation"
|
|
35
218
|
},
|
|
36
219
|
{
|
|
37
220
|
"title": "returns",
|
|
@@ -58,15 +241,15 @@
|
|
|
58
241
|
"description": null,
|
|
59
242
|
"type": null
|
|
60
243
|
},
|
|
61
|
-
{
|
|
62
|
-
"title": "example",
|
|
63
|
-
"description": "sourceValue('$.key')"
|
|
64
|
-
},
|
|
65
244
|
{
|
|
66
245
|
"title": "function",
|
|
67
246
|
"description": null,
|
|
68
247
|
"name": null
|
|
69
248
|
},
|
|
249
|
+
{
|
|
250
|
+
"title": "example",
|
|
251
|
+
"description": "sourceValue('$.key')"
|
|
252
|
+
},
|
|
70
253
|
{
|
|
71
254
|
"title": "param",
|
|
72
255
|
"description": "JSONPath referencing a point in `state`.",
|
|
@@ -101,15 +284,15 @@
|
|
|
101
284
|
"description": null,
|
|
102
285
|
"type": null
|
|
103
286
|
},
|
|
104
|
-
{
|
|
105
|
-
"title": "example",
|
|
106
|
-
"description": "dataPath('key')"
|
|
107
|
-
},
|
|
108
287
|
{
|
|
109
288
|
"title": "function",
|
|
110
289
|
"description": null,
|
|
111
290
|
"name": null
|
|
112
291
|
},
|
|
292
|
+
{
|
|
293
|
+
"title": "example",
|
|
294
|
+
"description": "dataPath('key')"
|
|
295
|
+
},
|
|
113
296
|
{
|
|
114
297
|
"title": "param",
|
|
115
298
|
"description": "JSONPath referencing a point in `data`.",
|
|
@@ -144,15 +327,15 @@
|
|
|
144
327
|
"description": null,
|
|
145
328
|
"type": null
|
|
146
329
|
},
|
|
147
|
-
{
|
|
148
|
-
"title": "example",
|
|
149
|
-
"description": "dataValue('key')"
|
|
150
|
-
},
|
|
151
330
|
{
|
|
152
331
|
"title": "function",
|
|
153
332
|
"description": null,
|
|
154
333
|
"name": null
|
|
155
334
|
},
|
|
335
|
+
{
|
|
336
|
+
"title": "example",
|
|
337
|
+
"description": "dataValue('key')"
|
|
338
|
+
},
|
|
156
339
|
{
|
|
157
340
|
"title": "param",
|
|
158
341
|
"description": "JSONPath referencing a point in `data`.",
|
|
@@ -187,15 +370,15 @@
|
|
|
187
370
|
"description": null,
|
|
188
371
|
"type": null
|
|
189
372
|
},
|
|
190
|
-
{
|
|
191
|
-
"title": "example",
|
|
192
|
-
"description": "lastReferenceValue('key')"
|
|
193
|
-
},
|
|
194
373
|
{
|
|
195
374
|
"title": "function",
|
|
196
375
|
"description": null,
|
|
197
376
|
"name": null
|
|
198
377
|
},
|
|
378
|
+
{
|
|
379
|
+
"title": "example",
|
|
380
|
+
"description": "lastReferenceValue('key')"
|
|
381
|
+
},
|
|
199
382
|
{
|
|
200
383
|
"title": "param",
|
|
201
384
|
"description": "JSONPath referencing a point in `references`.",
|
|
@@ -231,15 +414,15 @@
|
|
|
231
414
|
"description": null,
|
|
232
415
|
"type": null
|
|
233
416
|
},
|
|
234
|
-
{
|
|
235
|
-
"title": "example",
|
|
236
|
-
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
237
|
-
},
|
|
238
417
|
{
|
|
239
418
|
"title": "function",
|
|
240
419
|
"description": null,
|
|
241
420
|
"name": null
|
|
242
421
|
},
|
|
422
|
+
{
|
|
423
|
+
"title": "example",
|
|
424
|
+
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
425
|
+
},
|
|
243
426
|
{
|
|
244
427
|
"title": "param",
|
|
245
428
|
"description": "JSONPath referencing a point in `state`.",
|
|
@@ -284,15 +467,15 @@
|
|
|
284
467
|
"description": null,
|
|
285
468
|
"type": null
|
|
286
469
|
},
|
|
287
|
-
{
|
|
288
|
-
"title": "example",
|
|
289
|
-
"description": "field('destination_field_name__c', 'value')"
|
|
290
|
-
},
|
|
291
470
|
{
|
|
292
471
|
"title": "function",
|
|
293
472
|
"description": null,
|
|
294
473
|
"name": null
|
|
295
474
|
},
|
|
475
|
+
{
|
|
476
|
+
"title": "example",
|
|
477
|
+
"description": "field('destination_field_name__c', 'value')"
|
|
478
|
+
},
|
|
296
479
|
{
|
|
297
480
|
"title": "param",
|
|
298
481
|
"description": "Name of the field",
|
|
@@ -336,15 +519,15 @@
|
|
|
336
519
|
"description": null,
|
|
337
520
|
"type": null
|
|
338
521
|
},
|
|
339
|
-
{
|
|
340
|
-
"title": "example",
|
|
341
|
-
"description": "fields(list_of_fields)"
|
|
342
|
-
},
|
|
343
522
|
{
|
|
344
523
|
"title": "function",
|
|
345
524
|
"description": null,
|
|
346
525
|
"name": null
|
|
347
526
|
},
|
|
527
|
+
{
|
|
528
|
+
"title": "example",
|
|
529
|
+
"description": "fields(list_of_fields)"
|
|
530
|
+
},
|
|
348
531
|
{
|
|
349
532
|
"title": "param",
|
|
350
533
|
"description": "a list of fields",
|
|
@@ -389,6 +572,11 @@
|
|
|
389
572
|
"description": null,
|
|
390
573
|
"name": null
|
|
391
574
|
},
|
|
575
|
+
{
|
|
576
|
+
"title": "public",
|
|
577
|
+
"description": null,
|
|
578
|
+
"type": null
|
|
579
|
+
},
|
|
392
580
|
{
|
|
393
581
|
"title": "param",
|
|
394
582
|
"description": null,
|
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ __export(src_exports, {
|
|
|
35
35
|
fields: () => import_language_common2.fields,
|
|
36
36
|
findDocuments: () => findDocuments,
|
|
37
37
|
fn: () => import_language_common2.fn,
|
|
38
|
+
fnIf: () => import_language_common2.fnIf,
|
|
38
39
|
insertDocuments: () => insertDocuments,
|
|
39
40
|
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
40
41
|
merge: () => import_language_common2.merge,
|
|
@@ -55,6 +56,7 @@ __export(Adaptor_exports, {
|
|
|
55
56
|
fields: () => import_language_common2.fields,
|
|
56
57
|
findDocuments: () => findDocuments,
|
|
57
58
|
fn: () => import_language_common2.fn,
|
|
59
|
+
fnIf: () => import_language_common2.fnIf,
|
|
58
60
|
insertDocuments: () => insertDocuments,
|
|
59
61
|
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
60
62
|
merge: () => import_language_common2.merge,
|
|
@@ -211,6 +213,7 @@ var src_default = Adaptor_exports;
|
|
|
211
213
|
fields,
|
|
212
214
|
findDocuments,
|
|
213
215
|
fn,
|
|
216
|
+
fnIf,
|
|
214
217
|
insertDocuments,
|
|
215
218
|
lastReferenceValue,
|
|
216
219
|
merge,
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ __export(Adaptor_exports, {
|
|
|
16
16
|
fields: () => fields,
|
|
17
17
|
findDocuments: () => findDocuments,
|
|
18
18
|
fn: () => fn,
|
|
19
|
+
fnIf: () => fnIf,
|
|
19
20
|
insertDocuments: () => insertDocuments,
|
|
20
21
|
lastReferenceValue: () => lastReferenceValue,
|
|
21
22
|
merge: () => merge,
|
|
@@ -33,6 +34,7 @@ import {
|
|
|
33
34
|
fields,
|
|
34
35
|
sourceValue,
|
|
35
36
|
fn,
|
|
37
|
+
fnIf,
|
|
36
38
|
alterState,
|
|
37
39
|
each,
|
|
38
40
|
merge,
|
|
@@ -187,6 +189,7 @@ export {
|
|
|
187
189
|
fields,
|
|
188
190
|
findDocuments,
|
|
189
191
|
fn,
|
|
192
|
+
fnIf,
|
|
190
193
|
insertDocuments,
|
|
191
194
|
lastReferenceValue,
|
|
192
195
|
merge,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-mongodb",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "A language package for working with MongoDb",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"author": "Open Function Group",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"configuration-schema.json"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@openfn/language-common": "^1.
|
|
15
|
+
"@openfn/language-common": "^1.15.1",
|
|
16
16
|
"mongodb": "^3.7.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export function execute(...operations: Operations): Operation;
|
|
|
20
20
|
* documents: [1,2,3]
|
|
21
21
|
* });
|
|
22
22
|
* @function
|
|
23
|
+
* @public
|
|
23
24
|
* @param {object} params - Configuration for mongo
|
|
24
25
|
* @returns {State}
|
|
25
26
|
*/
|
|
@@ -33,6 +34,7 @@ export function insertDocuments(params: object): State;
|
|
|
33
34
|
* query: {a:3}
|
|
34
35
|
* });
|
|
35
36
|
* @function
|
|
37
|
+
* @public
|
|
36
38
|
* @param {object} params - Configuration for mongo
|
|
37
39
|
* @returns {State}
|
|
38
40
|
*/
|
|
@@ -48,8 +50,9 @@ export function findDocuments(params: object): State;
|
|
|
48
50
|
* options: { upsert: true }
|
|
49
51
|
* });
|
|
50
52
|
* @function
|
|
53
|
+
* @public
|
|
51
54
|
* @param {object} params - Configuration for mongo
|
|
52
55
|
* @returns {State}
|
|
53
56
|
*/
|
|
54
57
|
export function updateDocument(params: object): State;
|
|
55
|
-
export { field, fields, sourceValue, fn, alterState, each, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
|
|
58
|
+
export { field, fields, sourceValue, fn, fnIf, alterState, each, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
|