@budibase/server 2.0.39 → 2.0.40-alpha.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/__mocks__/mongodb.ts +1 -1
- package/__mocks__/node-fetch.ts +12 -2
- package/builder/assets/backups-default.8c011f1b.png +0 -0
- package/builder/assets/{index.e0ddd30b.css → index.442de33f.css} +2 -2
- package/builder/assets/{index.b20dee52.js → index.d7b4247d.js} +340 -332
- package/builder/index.html +2 -2
- package/coverage/clover.xml +1125 -1250
- package/coverage/coverage-final.json +73 -77
- package/coverage/lcov-report/api/controllers/apikeys.js.html +6 -6
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +79 -67
- package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +21 -21
- package/coverage/lcov-report/api/controllers/index.html +17 -47
- package/coverage/lcov-report/api/controllers/integration.js.html +4 -4
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +9 -9
- package/coverage/lcov-report/api/controllers/migrations.js.html +4 -4
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +4 -4
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +9 -9
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +13 -13
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +15 -15
- package/coverage/lcov-report/api/controllers/row/utils.js.html +13 -13
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +12 -9
- package/coverage/lcov-report/api/controllers/table/external.js.html +10 -10
- package/coverage/lcov-report/api/controllers/table/index.html +16 -16
- package/coverage/lcov-report/api/controllers/table/index.js.html +5 -5
- package/coverage/lcov-report/api/controllers/templates.js.html +6 -6
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +3 -3
- package/coverage/lcov-report/api/controllers/view/utils.js.html +13 -13
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +8 -8
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +30 -30
- package/coverage/lcov-report/api/routes/analytics.js.html +7 -7
- package/coverage/lcov-report/api/routes/apikeys.js.html +8 -8
- package/coverage/lcov-report/api/routes/automation.js.html +11 -11
- package/coverage/lcov-report/api/routes/cloud.js.html +8 -8
- package/coverage/lcov-report/api/routes/component.js.html +8 -8
- package/coverage/lcov-report/api/routes/datasource.js.html +9 -9
- package/coverage/lcov-report/api/routes/deploy.js.html +8 -8
- package/coverage/lcov-report/api/routes/dev.js.html +13 -13
- package/coverage/lcov-report/api/routes/index.html +5 -35
- package/coverage/lcov-report/api/routes/integration.js.html +8 -8
- package/coverage/lcov-report/api/routes/layout.js.html +8 -8
- package/coverage/lcov-report/api/routes/metadata.js.html +9 -9
- package/coverage/lcov-report/api/routes/migrations.js.html +7 -7
- package/coverage/lcov-report/api/routes/permission.js.html +9 -9
- package/coverage/lcov-report/api/routes/query.js.html +10 -10
- package/coverage/lcov-report/api/routes/role.js.html +9 -9
- package/coverage/lcov-report/api/routes/routing.js.html +8 -8
- package/coverage/lcov-report/api/routes/screen.js.html +9 -9
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +10 -10
- package/coverage/lcov-report/api/routes/templates.js.html +8 -8
- package/coverage/lcov-report/api/routes/user.js.html +8 -8
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +45 -45
- package/coverage/lcov-report/api/routes/view.js.html +10 -10
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +6 -6
- package/coverage/lcov-report/automations/bullboard.js.html +24 -84
- package/coverage/lcov-report/automations/index.html +21 -21
- package/coverage/lcov-report/automations/index.js.html +9 -9
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +15 -15
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +3 -3
- package/coverage/lcov-report/automations/steps/utils.js.html +10 -10
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +49 -49
- package/coverage/lcov-report/constants/index.html +5 -5
- package/coverage/lcov-report/constants/index.js.html +10 -28
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +19 -19
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +17 -17
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +28 -28
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +15 -15
- package/coverage/lcov-report/db/newid.js.html +2 -2
- package/coverage/lcov-report/db/utils.js.html +37 -316
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +3 -3
- package/coverage/lcov-report/events/utils.js.html +9 -9
- package/coverage/lcov-report/index.html +88 -88
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +5 -5
- package/coverage/lcov-report/middleware/builder.js.html +19 -19
- package/coverage/lcov-report/middleware/currentapp.js.html +49 -49
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +5 -5
- package/coverage/lcov-report/middleware/resourceId.js.html +28 -28
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +4 -4
- package/coverage/lcov-report/utilities/budibaseDir.js.html +3 -3
- package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
- package/coverage/lcov-report/utilities/csvParser.js.html +15 -12
- package/coverage/lcov-report/utilities/global.js.html +31 -31
- package/coverage/lcov-report/utilities/index.html +28 -28
- package/coverage/lcov-report/utilities/index.js.html +8 -8
- package/coverage/lcov-report/utilities/plugins.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +52 -52
- package/coverage/lcov-report/utilities/queue/index.html +21 -21
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +6 -6
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +72 -57
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +15 -15
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +2 -2
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +14 -14
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +23 -11
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +46 -46
- package/coverage/lcov.info +1691 -1899
- package/dist/api/controllers/application.js +4 -7
- package/dist/api/controllers/backup.js +19 -13
- package/dist/api/controllers/cloud.js +38 -35
- package/dist/api/controllers/deploy/index.js +11 -2
- package/dist/api/controllers/dev.js +1 -1
- package/dist/api/controllers/query/index.js +7 -2
- package/dist/api/controllers/row/index.js +40 -66
- package/dist/api/controllers/row/internal.js +1 -1
- package/dist/api/controllers/static/index.js +3 -2
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +11 -0
- package/dist/api/controllers/static/templates/preview.hbs +10 -0
- package/dist/api/controllers/table/bulkFormula.js +4 -3
- package/dist/api/controllers/table/external.js +5 -4
- package/dist/api/controllers/table/index.js +4 -4
- package/dist/api/controllers/table/internal.js +10 -3
- package/dist/api/controllers/table/utils.js +7 -49
- package/dist/api/controllers/view/index.js +2 -2
- package/dist/api/controllers/webhook.js +88 -89
- package/dist/api/routes/backup.js +34 -7
- package/dist/api/routes/index.js +9 -4
- package/dist/api/routes/utils/validators.js +2 -2
- package/dist/api/routes/webhook.js +39 -11
- package/dist/app.js +2 -68
- package/dist/automations/automationUtils.js +2 -2
- package/dist/automations/bullboard.js +12 -35
- package/dist/automations/index.js +4 -4
- package/dist/automations/steps/updateRow.js +2 -2
- package/dist/automations/triggers.js +6 -6
- package/dist/automations/utils.js +23 -49
- package/dist/constants/index.js +4 -8
- package/dist/db/utils.js +10 -75
- package/dist/index.js +1 -0
- package/dist/integrations/arangodb.js +2 -0
- package/dist/integrations/base/sqlTable.js +1 -0
- package/dist/integrations/mongodb.js +300 -11
- package/dist/integrations/rest.js +38 -5
- package/dist/migrations/functions/backfill/app/tables.js +5 -8
- package/dist/migrations/functions/{quotas1.js → syncQuotas.js} +3 -7
- package/dist/migrations/functions/usageQuotas/syncApps.js +0 -1
- package/dist/migrations/functions/{pluginCount.js → usageQuotas/syncPlugins.js} +1 -3
- package/dist/migrations/functions/usageQuotas/syncRows.js +9 -5
- package/dist/migrations/index.js +10 -38
- package/dist/package.json +14 -14
- package/dist/sdk/app/automations/index.js +29 -0
- package/dist/sdk/app/automations/webhook.js +54 -0
- package/dist/sdk/app/backups/constants.js +5 -0
- package/dist/sdk/app/backups/exports.js +172 -0
- package/dist/sdk/app/backups/imports.js +190 -0
- package/dist/sdk/app/backups/index.js +29 -0
- package/dist/sdk/app/backups/statistics.js +73 -0
- package/dist/sdk/app/tables/index.js +61 -0
- package/dist/sdk/index.js +17 -0
- package/dist/startup.js +152 -0
- package/dist/tests/utilities/TestConfiguration.js +12 -2
- package/dist/threads/automation.js +12 -17
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/csvParser.js +1 -0
- package/dist/utilities/fileSystem/index.js +3 -95
- package/dist/utilities/fileSystem/utilities.js +2 -1
- package/dist/utilities/rowProcessor/index.js +5 -0
- package/dist/utilities/usageQuota/rows.js +6 -4
- package/package.json +15 -15
- package/specs/openapi.json +3 -0
- package/specs/openapi.yaml +3 -0
- package/src/api/controllers/application.ts +5 -12
- package/src/api/controllers/{backup.js → backup.ts} +7 -7
- package/src/api/controllers/cloud.js +44 -40
- package/src/api/controllers/deploy/index.ts +20 -8
- package/src/api/controllers/dev.js +1 -1
- package/src/api/controllers/query/index.ts +8 -2
- package/src/api/controllers/row/index.ts +50 -65
- package/src/api/controllers/row/internal.js +1 -1
- package/src/api/controllers/static/index.ts +4 -2
- package/src/api/controllers/static/templates/BudibaseApp.svelte +11 -0
- package/src/api/controllers/static/templates/preview.hbs +10 -0
- package/src/api/controllers/table/bulkFormula.js +4 -3
- package/src/api/controllers/table/external.js +4 -4
- package/src/api/controllers/table/index.js +4 -4
- package/src/api/controllers/table/internal.ts +8 -9
- package/src/api/controllers/table/utils.ts +4 -53
- package/src/api/controllers/view/index.js +2 -2
- package/src/api/controllers/{webhook.js → webhook.ts} +33 -48
- package/src/api/routes/backup.ts +10 -0
- package/src/api/routes/index.ts +11 -5
- package/src/api/routes/tests/backup.spec.js +1 -1
- package/src/api/routes/tests/{deployment.spec.js → deployment.spec.ts} +4 -4
- package/src/api/routes/tests/row.spec.js +22 -27
- package/src/api/routes/utils/validators.js +2 -2
- package/src/api/routes/{webhook.js → webhook.ts} +7 -6
- package/src/app.ts +3 -91
- package/src/automations/automationUtils.js +2 -2
- package/src/automations/bullboard.js +14 -34
- package/src/automations/index.js +4 -4
- package/src/automations/steps/updateRow.js +2 -2
- package/src/automations/tests/automation.spec.js +1 -6
- package/src/automations/triggers.js +6 -6
- package/src/automations/utils.ts +30 -32
- package/src/constants/index.js +4 -10
- package/src/db/utils.js +17 -110
- package/src/definitions/automations.ts +1 -18
- package/src/definitions/datasource.ts +1 -0
- package/src/index.ts +1 -0
- package/src/integrations/arangodb.ts +2 -0
- package/src/integrations/base/sqlTable.ts +1 -0
- package/src/integrations/mongodb.ts +290 -27
- package/src/integrations/rest.ts +17 -5
- package/src/integrations/tests/mongo.spec.ts +19 -19
- package/src/integrations/tests/rest.spec.ts +38 -22
- package/src/migrations/functions/backfill/app/tables.ts +7 -13
- package/src/migrations/functions/backfill/global.ts +1 -1
- package/src/migrations/functions/{quotas1.ts → syncQuotas.ts} +3 -8
- package/src/migrations/functions/tests/{quotas1.spec.js → syncQuotas.spec.js} +6 -5
- package/src/migrations/functions/tests/userEmailViewCasing.spec.js +6 -4
- package/src/migrations/functions/usageQuotas/syncApps.ts +0 -1
- package/src/migrations/functions/usageQuotas/syncPlugins.ts +10 -0
- package/src/migrations/functions/usageQuotas/syncRows.ts +15 -6
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +9 -1
- package/src/migrations/index.ts +21 -45
- package/src/migrations/tests/index.spec.ts +0 -1
- package/src/sdk/app/automations/index.ts +5 -0
- package/src/sdk/app/automations/webhook.ts +43 -0
- package/src/sdk/app/backups/constants.ts +2 -0
- package/src/sdk/app/backups/exports.ts +171 -0
- package/src/sdk/app/backups/imports.ts +206 -0
- package/src/sdk/app/backups/index.ts +9 -0
- package/src/sdk/app/backups/statistics.ts +78 -0
- package/src/sdk/app/tables/index.ts +61 -0
- package/src/sdk/index.ts +15 -0
- package/src/startup.ts +138 -0
- package/src/tests/utilities/TestConfiguration.js +12 -2
- package/src/threads/automation.ts +20 -27
- package/src/utilities/csvParser.js +1 -0
- package/src/utilities/fileSystem/index.js +2 -119
- package/src/utilities/fileSystem/utilities.js +2 -0
- package/src/utilities/rowProcessor/index.js +5 -0
- package/src/utilities/usageQuota/rows.js +7 -3
- package/coverage/lcov-report/api/controllers/backup.js.html +0 -142
- package/coverage/lcov-report/api/controllers/webhook.js.html +0 -424
- package/coverage/lcov-report/api/routes/backup.js.html +0 -115
- package/coverage/lcov-report/api/routes/webhook.js.html +0 -163
- package/dist/automations/listeners.js +0 -102
- package/src/api/routes/backup.js +0 -10
- package/src/automations/listeners.ts +0 -78
- package/src/migrations/functions/pluginCount.ts +0 -12
|
@@ -6,13 +6,12 @@ import {
|
|
|
6
6
|
} from "@budibase/types"
|
|
7
7
|
import {
|
|
8
8
|
MongoClient,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
CommonOptions,
|
|
9
|
+
ObjectId,
|
|
10
|
+
Filter,
|
|
11
|
+
UpdateFilter,
|
|
12
|
+
FindOneAndUpdateOptions,
|
|
13
|
+
UpdateOptions,
|
|
14
|
+
OperationOptions,
|
|
16
15
|
} from "mongodb"
|
|
17
16
|
|
|
18
17
|
interface MongoDBConfig {
|
|
@@ -57,6 +56,232 @@ const SCHEMA: Integration = {
|
|
|
57
56
|
delete: {
|
|
58
57
|
type: QueryType.JSON,
|
|
59
58
|
},
|
|
59
|
+
aggregate: {
|
|
60
|
+
type: QueryType.JSON,
|
|
61
|
+
steps: [
|
|
62
|
+
{
|
|
63
|
+
key: "$addFields",
|
|
64
|
+
template: "{\n\t\n}",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: "$bucket",
|
|
68
|
+
template: `{
|
|
69
|
+
"groupBy": "",
|
|
70
|
+
"boundaries": [],
|
|
71
|
+
"default": "",
|
|
72
|
+
"output": {}
|
|
73
|
+
}`,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "$bucketAuto",
|
|
77
|
+
template: `{
|
|
78
|
+
"groupBy": "",
|
|
79
|
+
"buckets": 1,
|
|
80
|
+
"output": {},
|
|
81
|
+
"granularity": "R5"
|
|
82
|
+
}`,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: "$changeStream",
|
|
86
|
+
template: `{
|
|
87
|
+
"allChangesForCluster": true,
|
|
88
|
+
"fullDocument": "",
|
|
89
|
+
"fullDocumentBeforeChange": "",
|
|
90
|
+
"resumeAfter": 1,
|
|
91
|
+
"showExpandedEvents": true,
|
|
92
|
+
"startAfter": {},
|
|
93
|
+
"startAtOperationTime": ""
|
|
94
|
+
}`,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
key: "$collStats",
|
|
98
|
+
template: `{
|
|
99
|
+
"latencyStats": { "histograms": true } },
|
|
100
|
+
"storageStats": { "scale": 1 } },
|
|
101
|
+
"count": {},
|
|
102
|
+
"queryExecStats": {}
|
|
103
|
+
}`,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: "$count",
|
|
107
|
+
template: ``,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: "$densify",
|
|
111
|
+
template: `{
|
|
112
|
+
"field": "",
|
|
113
|
+
"partitionByFields": [],
|
|
114
|
+
"range": {
|
|
115
|
+
"step": 1,
|
|
116
|
+
"unit": 1,
|
|
117
|
+
"bounds": "full"
|
|
118
|
+
}
|
|
119
|
+
}`,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: "$documents",
|
|
123
|
+
template: `[]`,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
key: "$facet",
|
|
127
|
+
template: `{\n\t\n}`,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
key: "$fill",
|
|
131
|
+
template: `{
|
|
132
|
+
"partitionBy": "",
|
|
133
|
+
"partitionByFields": [],
|
|
134
|
+
"sortBy": {},
|
|
135
|
+
"output": {}
|
|
136
|
+
}`,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
key: "$geoNear",
|
|
140
|
+
template: `{
|
|
141
|
+
"near": {
|
|
142
|
+
"type": "Point",
|
|
143
|
+
"coordinates": [
|
|
144
|
+
-73.98142, 40.71782
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
"key": "location",
|
|
148
|
+
"distanceField": "dist.calculated",
|
|
149
|
+
"query": { "category": "Parks" }
|
|
150
|
+
}`,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
key: "$graphLookup",
|
|
154
|
+
template: `{
|
|
155
|
+
"from": "",
|
|
156
|
+
"startWith": "",
|
|
157
|
+
"connectFromField": "",
|
|
158
|
+
"connectToField": "",
|
|
159
|
+
"as": "",
|
|
160
|
+
"maxDepth": 1,
|
|
161
|
+
"depthField": "",
|
|
162
|
+
"restrictSearchWithMatch": {}
|
|
163
|
+
}`,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
key: "$group",
|
|
167
|
+
template: `{
|
|
168
|
+
"_id": ""
|
|
169
|
+
}`,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
key: "$indexStats",
|
|
173
|
+
template: "{\n\t\n}",
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
key: "$limit",
|
|
177
|
+
template: `1`,
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
key: "$listLocalSessions",
|
|
181
|
+
template: `{\n\t\n}`,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: "$listSessions",
|
|
185
|
+
template: `{\n\t\n}`,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
key: "$lookup",
|
|
189
|
+
template: `{
|
|
190
|
+
"from": "",
|
|
191
|
+
"localField": "",
|
|
192
|
+
"foreignField": "",
|
|
193
|
+
"as": ""
|
|
194
|
+
}`,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
key: "$match",
|
|
198
|
+
template: "{\n\t\n}",
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
key: "$merge",
|
|
202
|
+
template: `{
|
|
203
|
+
"into": {},
|
|
204
|
+
"on": "_id",
|
|
205
|
+
"whenMatched": "replace",
|
|
206
|
+
"whenNotMatched": "insert"
|
|
207
|
+
}`,
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
key: "$out",
|
|
211
|
+
template: `{
|
|
212
|
+
"db": "",
|
|
213
|
+
"coll": ""
|
|
214
|
+
}`,
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
key: "$planCacheStats",
|
|
218
|
+
template: "{\n\t\n}",
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
key: "$project",
|
|
222
|
+
template: "{\n\t\n}",
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
key: "$redact",
|
|
226
|
+
template: "",
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
key: "$replaceRoot",
|
|
230
|
+
template: `{ "newRoot": "" }`,
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
key: "$replaceWith",
|
|
234
|
+
template: ``,
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
key: "$sample",
|
|
238
|
+
template: `{ "size": 3 }`,
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
key: "$set",
|
|
242
|
+
template: "{\n\t\n}",
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
key: "$setWindowFields",
|
|
246
|
+
template: `{
|
|
247
|
+
"partitionBy": "",
|
|
248
|
+
"sortBy": {},
|
|
249
|
+
"output": {}
|
|
250
|
+
}`,
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
key: "$skip",
|
|
254
|
+
template: `1`,
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
key: "$sort",
|
|
258
|
+
template: "{\n\t\n}",
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
key: "$sortByCount",
|
|
262
|
+
template: "",
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
key: "$unionWith",
|
|
266
|
+
template: `{
|
|
267
|
+
"coll": "",
|
|
268
|
+
"pipeline": []
|
|
269
|
+
}`,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
key: "$unset",
|
|
273
|
+
template: "",
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
key: "$unwind",
|
|
277
|
+
template: `{
|
|
278
|
+
"path": "",
|
|
279
|
+
"includeArrayIndex": "",
|
|
280
|
+
"preserveNullAndEmptyArrays": true
|
|
281
|
+
}`,
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
},
|
|
60
285
|
},
|
|
61
286
|
extra: {
|
|
62
287
|
collection: {
|
|
@@ -64,8 +289,8 @@ const SCHEMA: Integration = {
|
|
|
64
289
|
type: DatasourceFieldType.STRING,
|
|
65
290
|
required: true,
|
|
66
291
|
},
|
|
67
|
-
|
|
68
|
-
displayName: "
|
|
292
|
+
actionType: {
|
|
293
|
+
displayName: "Query Type",
|
|
69
294
|
type: DatasourceFieldType.LIST,
|
|
70
295
|
required: true,
|
|
71
296
|
data: {
|
|
@@ -73,6 +298,7 @@ const SCHEMA: Integration = {
|
|
|
73
298
|
create: ["insertOne", "insertMany"],
|
|
74
299
|
update: ["updateOne", "updateMany"],
|
|
75
300
|
delete: ["deleteOne", "deleteMany"],
|
|
301
|
+
aggregate: ["json", "pipeline"],
|
|
76
302
|
},
|
|
77
303
|
},
|
|
78
304
|
},
|
|
@@ -104,7 +330,7 @@ class MongoIntegration implements IntegrationBase {
|
|
|
104
330
|
) {
|
|
105
331
|
const id = json[field].match(/(?<=objectid\(['"]).*(?=['"]\))/gi)?.[0]
|
|
106
332
|
if (id) {
|
|
107
|
-
json[field] =
|
|
333
|
+
json[field] = ObjectId.createFromHexString(id)
|
|
108
334
|
}
|
|
109
335
|
}
|
|
110
336
|
}
|
|
@@ -168,7 +394,7 @@ class MongoIntegration implements IntegrationBase {
|
|
|
168
394
|
|
|
169
395
|
// For mongodb we add an extra actionType to specify
|
|
170
396
|
// which method we want to call on the collection
|
|
171
|
-
switch (query.extra.
|
|
397
|
+
switch (query.extra.actionType) {
|
|
172
398
|
case "insertOne": {
|
|
173
399
|
return await collection.insertOne(json)
|
|
174
400
|
}
|
|
@@ -177,7 +403,7 @@ class MongoIntegration implements IntegrationBase {
|
|
|
177
403
|
}
|
|
178
404
|
default: {
|
|
179
405
|
throw new Error(
|
|
180
|
-
`actionType ${query.extra.
|
|
406
|
+
`actionType ${query.extra.actionType} does not exist on DB for create`
|
|
181
407
|
)
|
|
182
408
|
}
|
|
183
409
|
}
|
|
@@ -196,7 +422,7 @@ class MongoIntegration implements IntegrationBase {
|
|
|
196
422
|
const collection = db.collection(query.extra.collection)
|
|
197
423
|
let json = this.createObjectIds(query.json)
|
|
198
424
|
|
|
199
|
-
switch (query.extra.
|
|
425
|
+
switch (query.extra.actionType) {
|
|
200
426
|
case "find": {
|
|
201
427
|
return await collection.find(json).toArray()
|
|
202
428
|
}
|
|
@@ -208,9 +434,9 @@ class MongoIntegration implements IntegrationBase {
|
|
|
208
434
|
json = this.parseQueryParams(query.json, "update")
|
|
209
435
|
}
|
|
210
436
|
let findAndUpdateJson = this.createObjectIds(json) as {
|
|
211
|
-
filter:
|
|
212
|
-
update:
|
|
213
|
-
options:
|
|
437
|
+
filter: Filter<any>
|
|
438
|
+
update: UpdateFilter<any>
|
|
439
|
+
options: FindOneAndUpdateOptions
|
|
214
440
|
}
|
|
215
441
|
return await collection.findOneAndUpdate(
|
|
216
442
|
findAndUpdateJson.filter,
|
|
@@ -226,7 +452,7 @@ class MongoIntegration implements IntegrationBase {
|
|
|
226
452
|
}
|
|
227
453
|
default: {
|
|
228
454
|
throw new Error(
|
|
229
|
-
`actionType ${query.extra.
|
|
455
|
+
`actionType ${query.extra.actionType} does not exist on DB for read`
|
|
230
456
|
)
|
|
231
457
|
}
|
|
232
458
|
}
|
|
@@ -248,29 +474,29 @@ class MongoIntegration implements IntegrationBase {
|
|
|
248
474
|
queryJson = this.parseQueryParams(queryJson, "update")
|
|
249
475
|
}
|
|
250
476
|
let json = this.createObjectIds(queryJson) as {
|
|
251
|
-
filter:
|
|
252
|
-
update:
|
|
477
|
+
filter: Filter<any>
|
|
478
|
+
update: UpdateFilter<any>
|
|
253
479
|
options: object
|
|
254
480
|
}
|
|
255
481
|
|
|
256
|
-
switch (query.extra.
|
|
482
|
+
switch (query.extra.actionType) {
|
|
257
483
|
case "updateOne": {
|
|
258
484
|
return await collection.updateOne(
|
|
259
485
|
json.filter,
|
|
260
486
|
json.update,
|
|
261
|
-
json.options as
|
|
487
|
+
json.options as UpdateOptions
|
|
262
488
|
)
|
|
263
489
|
}
|
|
264
490
|
case "updateMany": {
|
|
265
491
|
return await collection.updateMany(
|
|
266
492
|
json.filter,
|
|
267
493
|
json.update,
|
|
268
|
-
json.options as
|
|
494
|
+
json.options as UpdateOptions
|
|
269
495
|
)
|
|
270
496
|
}
|
|
271
497
|
default: {
|
|
272
498
|
throw new Error(
|
|
273
|
-
`actionType ${query.extra.
|
|
499
|
+
`actionType ${query.extra.actionType} does not exist on DB for update`
|
|
274
500
|
)
|
|
275
501
|
}
|
|
276
502
|
}
|
|
@@ -292,8 +518,8 @@ class MongoIntegration implements IntegrationBase {
|
|
|
292
518
|
queryJson = this.parseQueryParams(queryJson, "delete")
|
|
293
519
|
}
|
|
294
520
|
let json = this.createObjectIds(queryJson) as {
|
|
295
|
-
filter:
|
|
296
|
-
options:
|
|
521
|
+
filter: Filter<any>
|
|
522
|
+
options: OperationOptions
|
|
297
523
|
}
|
|
298
524
|
if (!json.options) {
|
|
299
525
|
json = {
|
|
@@ -302,7 +528,7 @@ class MongoIntegration implements IntegrationBase {
|
|
|
302
528
|
}
|
|
303
529
|
}
|
|
304
530
|
|
|
305
|
-
switch (query.extra.
|
|
531
|
+
switch (query.extra.actionType) {
|
|
306
532
|
case "deleteOne": {
|
|
307
533
|
return await collection.deleteOne(json.filter, json.options)
|
|
308
534
|
}
|
|
@@ -311,7 +537,7 @@ class MongoIntegration implements IntegrationBase {
|
|
|
311
537
|
}
|
|
312
538
|
default: {
|
|
313
539
|
throw new Error(
|
|
314
|
-
`actionType ${query.extra.
|
|
540
|
+
`actionType ${query.extra.actionType} does not exist on DB for delete`
|
|
315
541
|
)
|
|
316
542
|
}
|
|
317
543
|
}
|
|
@@ -322,6 +548,43 @@ class MongoIntegration implements IntegrationBase {
|
|
|
322
548
|
await this.client.close()
|
|
323
549
|
}
|
|
324
550
|
}
|
|
551
|
+
|
|
552
|
+
async aggregate(query: {
|
|
553
|
+
json: object
|
|
554
|
+
steps: any[]
|
|
555
|
+
extra: { [key: string]: string }
|
|
556
|
+
}) {
|
|
557
|
+
try {
|
|
558
|
+
await this.connect()
|
|
559
|
+
const db = this.client.db(this.config.db)
|
|
560
|
+
const collection = db.collection(query.extra.collection)
|
|
561
|
+
let response = []
|
|
562
|
+
if (query.extra?.actionType === "pipeline") {
|
|
563
|
+
for await (const doc of collection.aggregate(
|
|
564
|
+
query.steps.map(({ key, value }) => {
|
|
565
|
+
let temp: any = {}
|
|
566
|
+
temp[key] = JSON.parse(value.value)
|
|
567
|
+
return this.createObjectIds(temp)
|
|
568
|
+
})
|
|
569
|
+
)) {
|
|
570
|
+
response.push(doc)
|
|
571
|
+
}
|
|
572
|
+
} else {
|
|
573
|
+
const stages: Array<any> = query.json as Array<any>
|
|
574
|
+
for await (const doc of collection.aggregate(
|
|
575
|
+
stages ? this.createObjectIds(stages) : []
|
|
576
|
+
)) {
|
|
577
|
+
response.push(doc)
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
return response
|
|
581
|
+
} catch (err) {
|
|
582
|
+
console.error("Error writing to mongodb", err)
|
|
583
|
+
throw err
|
|
584
|
+
} finally {
|
|
585
|
+
await this.client.close()
|
|
586
|
+
}
|
|
587
|
+
}
|
|
325
588
|
}
|
|
326
589
|
|
|
327
590
|
export default {
|
package/src/integrations/rest.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
BearerAuthConfig,
|
|
15
15
|
} from "../definitions/datasource"
|
|
16
16
|
import { get } from "lodash"
|
|
17
|
+
import * as https from "https"
|
|
17
18
|
import qs from "querystring"
|
|
18
19
|
const fetch = require("node-fetch")
|
|
19
20
|
const { formatBytes } = require("../utilities")
|
|
@@ -76,11 +77,11 @@ const SCHEMA: Integration = {
|
|
|
76
77
|
required: false,
|
|
77
78
|
default: {},
|
|
78
79
|
},
|
|
79
|
-
|
|
80
|
-
display: "
|
|
80
|
+
rejectUnauthorized: {
|
|
81
|
+
display: "Reject Unauthorized",
|
|
81
82
|
type: DatasourceFieldType.BOOLEAN,
|
|
83
|
+
default: true,
|
|
82
84
|
required: false,
|
|
83
|
-
default: false,
|
|
84
85
|
},
|
|
85
86
|
},
|
|
86
87
|
query: {
|
|
@@ -218,8 +219,12 @@ class RestIntegration implements IntegrationBase {
|
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
if (queryString) {
|
|
223
|
+
// make sure the query string is fully encoded
|
|
224
|
+
queryString = "?" + qs.encode(qs.decode(queryString))
|
|
225
|
+
}
|
|
226
|
+
const main = `${path}${queryString}`
|
|
227
|
+
|
|
223
228
|
let complete = main
|
|
224
229
|
if (this.config.url && !main.startsWith("http")) {
|
|
225
230
|
complete = !this.config.url ? main : `${this.config.url}/${main}`
|
|
@@ -381,6 +386,13 @@ class RestIntegration implements IntegrationBase {
|
|
|
381
386
|
paginationValues
|
|
382
387
|
)
|
|
383
388
|
|
|
389
|
+
if (this.config.rejectUnauthorized == false) {
|
|
390
|
+
input.agent = new https.Agent({
|
|
391
|
+
rejectUnauthorized: false,
|
|
392
|
+
})
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// Deprecated by rejectUnauthorized
|
|
384
396
|
if (this.config.legacyHttpParser) {
|
|
385
397
|
// https://github.com/nodejs/node/issues/43798
|
|
386
398
|
input.extraHttpOptions = { insecureHTTPParser: true }
|
|
@@ -34,7 +34,7 @@ describe("MongoDB Integration", () => {
|
|
|
34
34
|
await config.integration.create({
|
|
35
35
|
index: indexName,
|
|
36
36
|
json: body,
|
|
37
|
-
extra: { collection: "testCollection",
|
|
37
|
+
extra: { collection: "testCollection", actionType: "insertOne" },
|
|
38
38
|
})
|
|
39
39
|
expect(config.integration.client.insertOne).toHaveBeenCalledWith(body)
|
|
40
40
|
})
|
|
@@ -44,7 +44,7 @@ describe("MongoDB Integration", () => {
|
|
|
44
44
|
json: {
|
|
45
45
|
address: "test",
|
|
46
46
|
},
|
|
47
|
-
extra: { collection: "testCollection",
|
|
47
|
+
extra: { collection: "testCollection", actionType: "find" },
|
|
48
48
|
}
|
|
49
49
|
const response = await config.integration.read(query)
|
|
50
50
|
expect(config.integration.client.find).toHaveBeenCalledWith(query.json)
|
|
@@ -61,7 +61,7 @@ describe("MongoDB Integration", () => {
|
|
|
61
61
|
opt: "option",
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
|
-
extra: { collection: "testCollection",
|
|
64
|
+
extra: { collection: "testCollection", actionType: "deleteOne" },
|
|
65
65
|
}
|
|
66
66
|
await config.integration.delete(query)
|
|
67
67
|
expect(config.integration.client.deleteOne).toHaveBeenCalledWith(
|
|
@@ -83,7 +83,7 @@ describe("MongoDB Integration", () => {
|
|
|
83
83
|
upsert: false,
|
|
84
84
|
},
|
|
85
85
|
},
|
|
86
|
-
extra: { collection: "testCollection",
|
|
86
|
+
extra: { collection: "testCollection", actionType: "updateOne" },
|
|
87
87
|
}
|
|
88
88
|
await config.integration.update(query)
|
|
89
89
|
expect(config.integration.client.updateOne).toHaveBeenCalledWith(
|
|
@@ -97,7 +97,7 @@ describe("MongoDB Integration", () => {
|
|
|
97
97
|
const restore = disableConsole()
|
|
98
98
|
|
|
99
99
|
const query = {
|
|
100
|
-
extra: { collection: "testCollection",
|
|
100
|
+
extra: { collection: "testCollection", actionType: "deleteOne" },
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
let error = null
|
|
@@ -125,19 +125,19 @@ describe("MongoDB Integration", () => {
|
|
|
125
125
|
upsert: false,
|
|
126
126
|
},
|
|
127
127
|
},
|
|
128
|
-
extra: { collection: "testCollection",
|
|
128
|
+
extra: { collection: "testCollection", actionType: "updateOne" },
|
|
129
129
|
}
|
|
130
130
|
await config.integration.update(query)
|
|
131
131
|
expect(config.integration.client.updateOne).toHaveBeenCalled()
|
|
132
132
|
|
|
133
133
|
const args = config.integration.client.updateOne.mock.calls[0]
|
|
134
134
|
expect(args[0]).toEqual({
|
|
135
|
-
_id: mongo.
|
|
136
|
-
name: mongo.
|
|
135
|
+
_id: mongo.ObjectId.createFromHexString("ACBD12345678ABCD12345678"),
|
|
136
|
+
name: mongo.ObjectId.createFromHexString("BBBB12345678ABCD12345678"),
|
|
137
137
|
})
|
|
138
138
|
expect(args[1]).toEqual({
|
|
139
|
-
_id: mongo.
|
|
140
|
-
name: mongo.
|
|
139
|
+
_id: mongo.ObjectId.createFromHexString("FFFF12345678ABCD12345678"),
|
|
140
|
+
name: mongo.ObjectId.createFromHexString("CCCC12345678ABCD12345678"),
|
|
141
141
|
})
|
|
142
142
|
expect(args[2]).toEqual({
|
|
143
143
|
upsert: false,
|
|
@@ -161,7 +161,7 @@ describe("MongoDB Integration", () => {
|
|
|
161
161
|
upsert: true,
|
|
162
162
|
},
|
|
163
163
|
},
|
|
164
|
-
extra: { collection: "testCollection",
|
|
164
|
+
extra: { collection: "testCollection", actionType: "updateOne" },
|
|
165
165
|
}
|
|
166
166
|
await config.integration.update(query)
|
|
167
167
|
expect(config.integration.client.updateOne).toHaveBeenCalled()
|
|
@@ -169,12 +169,12 @@ describe("MongoDB Integration", () => {
|
|
|
169
169
|
const args = config.integration.client.updateOne.mock.calls[0]
|
|
170
170
|
expect(args[0]).toEqual({
|
|
171
171
|
_id: {
|
|
172
|
-
$eq: mongo.
|
|
172
|
+
$eq: mongo.ObjectId.createFromHexString("ACBD12345678ABCD12345678"),
|
|
173
173
|
},
|
|
174
174
|
})
|
|
175
175
|
expect(args[1]).toEqual({
|
|
176
176
|
$set: {
|
|
177
|
-
_id: mongo.
|
|
177
|
+
_id: mongo.ObjectId.createFromHexString("FFFF12345678ABCD12345678"),
|
|
178
178
|
},
|
|
179
179
|
})
|
|
180
180
|
expect(args[2]).toEqual({
|
|
@@ -200,7 +200,7 @@ describe("MongoDB Integration", () => {
|
|
|
200
200
|
upsert: false,
|
|
201
201
|
},
|
|
202
202
|
},
|
|
203
|
-
extra: { collection: "testCollection",
|
|
203
|
+
extra: { collection: "testCollection", actionType: "findOneAndUpdate" },
|
|
204
204
|
}
|
|
205
205
|
await config.integration.read(query)
|
|
206
206
|
expect(config.integration.client.findOneAndUpdate).toHaveBeenCalled()
|
|
@@ -208,7 +208,7 @@ describe("MongoDB Integration", () => {
|
|
|
208
208
|
const args = config.integration.client.findOneAndUpdate.mock.calls[0]
|
|
209
209
|
expect(args[0]).toEqual({
|
|
210
210
|
_id: {
|
|
211
|
-
$eq: mongo.
|
|
211
|
+
$eq: mongo.ObjectId.createFromHexString("ACBD12345678ABCD12345678"),
|
|
212
212
|
},
|
|
213
213
|
})
|
|
214
214
|
expect(args[1]).toEqual({
|
|
@@ -245,7 +245,7 @@ describe("MongoDB Integration", () => {
|
|
|
245
245
|
{
|
|
246
246
|
"upsert": true
|
|
247
247
|
}`,
|
|
248
|
-
extra: { collection: "testCollection",
|
|
248
|
+
extra: { collection: "testCollection", actionType: "updateOne" },
|
|
249
249
|
}
|
|
250
250
|
await config.integration.update(query)
|
|
251
251
|
expect(config.integration.client.updateOne).toHaveBeenCalled()
|
|
@@ -253,7 +253,7 @@ describe("MongoDB Integration", () => {
|
|
|
253
253
|
const args = config.integration.client.updateOne.mock.calls[0]
|
|
254
254
|
expect(args[0]).toEqual({
|
|
255
255
|
_id: {
|
|
256
|
-
$eq: mongo.
|
|
256
|
+
$eq: mongo.ObjectId.createFromHexString("ACBD12345678ABCD12345678"),
|
|
257
257
|
},
|
|
258
258
|
})
|
|
259
259
|
expect(args[1]).toEqual({
|
|
@@ -300,7 +300,7 @@ describe("MongoDB Integration", () => {
|
|
|
300
300
|
"upsert": true,
|
|
301
301
|
"extra": "ad\\"{\\"d"
|
|
302
302
|
}`,
|
|
303
|
-
extra: { collection: "testCollection",
|
|
303
|
+
extra: { collection: "testCollection", actionType: "updateOne" },
|
|
304
304
|
}
|
|
305
305
|
await config.integration.update(query)
|
|
306
306
|
expect(config.integration.client.updateOne).toHaveBeenCalled()
|
|
@@ -308,7 +308,7 @@ describe("MongoDB Integration", () => {
|
|
|
308
308
|
const args = config.integration.client.updateOne.mock.calls[0]
|
|
309
309
|
expect(args[0]).toEqual({
|
|
310
310
|
_id: {
|
|
311
|
-
$eq: mongo.
|
|
311
|
+
$eq: mongo.ObjectId.createFromHexString("ACBD12345678ABCD12345678"),
|
|
312
312
|
},
|
|
313
313
|
})
|
|
314
314
|
expect(args[1]).toEqual({
|