@budibase/server 1.3.17 → 1.3.19-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.
Files changed (282) hide show
  1. package/__mocks__/mongodb.ts +1 -1
  2. package/builder/assets/{index.a70e216a.css → index.3850883f.css} +2 -2
  3. package/builder/assets/index.fdade753.js +995 -0
  4. package/builder/index.html +2 -4
  5. package/coverage/clover.xml +409 -361
  6. package/coverage/coverage-final.json +18 -18
  7. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  12. package/coverage/lcov-report/api/controllers/component.js.html +68 -11
  13. package/coverage/lcov-report/api/controllers/datasource.js.html +73 -34
  14. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  15. package/coverage/lcov-report/api/controllers/index.html +38 -38
  16. package/coverage/lcov-report/api/controllers/integration.js.html +6 -6
  17. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  18. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  19. package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
  20. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  21. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  22. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  23. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  24. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  25. package/coverage/lcov-report/api/controllers/row/external.js.html +2 -2
  26. package/coverage/lcov-report/api/controllers/row/index.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
  28. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  29. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/screen.js.html +207 -12
  32. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  34. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  36. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  37. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  38. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  39. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  40. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  41. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  42. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  43. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  44. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  45. package/coverage/lcov-report/api/index.html +1 -1
  46. package/coverage/lcov-report/api/index.js.html +12 -12
  47. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  48. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/index.html +1 -1
  58. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  68. package/coverage/lcov-report/api/routes/table.js.html +2 -2
  69. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  70. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  71. package/coverage/lcov-report/api/routes/utils/index.html +5 -5
  72. package/coverage/lcov-report/api/routes/utils/validators.js.html +9 -6
  73. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  74. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  75. package/coverage/lcov-report/automations/actions.js.html +1 -1
  76. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  77. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  78. package/coverage/lcov-report/automations/index.html +1 -1
  79. package/coverage/lcov-report/automations/index.js.html +1 -1
  80. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  81. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  83. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/index.html +1 -1
  87. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  88. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  89. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  91. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  92. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  93. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  94. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  95. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  96. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  97. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  98. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  99. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  100. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  101. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  102. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  103. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  104. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  105. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  106. package/coverage/lcov-report/constants/index.html +1 -1
  107. package/coverage/lcov-report/constants/index.js.html +1 -1
  108. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  109. package/coverage/lcov-report/constants/screens.js.html +1 -1
  110. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  111. package/coverage/lcov-report/db/index.html +18 -18
  112. package/coverage/lcov-report/db/index.js.html +1 -1
  113. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  114. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  115. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  116. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
  117. package/coverage/lcov-report/db/newid.js.html +2 -2
  118. package/coverage/lcov-report/db/utils.js.html +56 -20
  119. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  120. package/coverage/lcov-report/events/index.html +1 -1
  121. package/coverage/lcov-report/events/index.js.html +1 -1
  122. package/coverage/lcov-report/events/utils.js.html +1 -1
  123. package/coverage/lcov-report/index.html +30 -30
  124. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  125. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  126. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  127. package/coverage/lcov-report/middleware/builder.js.html +12 -12
  128. package/coverage/lcov-report/middleware/currentapp.js.html +33 -33
  129. package/coverage/lcov-report/middleware/index.html +1 -1
  130. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  131. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  132. package/coverage/lcov-report/middleware/resourceId.js.html +7 -7
  133. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  134. package/coverage/lcov-report/middleware/utils.js.html +2 -2
  135. package/coverage/lcov-report/utilities/budibaseDir.js.html +3 -3
  136. package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
  137. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  138. package/coverage/lcov-report/utilities/global.js.html +16 -16
  139. package/coverage/lcov-report/utilities/index.html +1 -1
  140. package/coverage/lcov-report/utilities/index.js.html +24 -24
  141. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +2 -2
  142. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  143. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  144. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  145. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  146. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  147. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  148. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  149. package/coverage/lcov-report/utilities/security.js.html +2 -2
  150. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  151. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  152. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  153. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  154. package/coverage/lcov-report/utilities/users.js.html +1 -1
  155. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  156. package/coverage/lcov.info +725 -623
  157. package/dist/api/controllers/application.js +5 -4
  158. package/dist/api/controllers/component.js +14 -1
  159. package/dist/api/controllers/datasource.js +21 -8
  160. package/dist/api/controllers/integration.js +4 -4
  161. package/dist/api/controllers/plugin/file.js +24 -0
  162. package/dist/api/controllers/plugin/github.js +69 -0
  163. package/dist/api/controllers/plugin/index.js +197 -0
  164. package/dist/api/controllers/plugin/npm.js +58 -0
  165. package/dist/api/controllers/plugin/uploaders.js +11 -0
  166. package/dist/api/controllers/plugin/url.js +24 -0
  167. package/dist/api/controllers/plugin/utils.js +26 -0
  168. package/dist/api/controllers/row/external.js +1 -1
  169. package/dist/api/controllers/screen.js +52 -2
  170. package/dist/api/controllers/static/index.js +1 -0
  171. package/dist/api/controllers/static/templates/BudibaseApp.svelte +10 -0
  172. package/dist/api/controllers/static/templates/preview.hbs +5 -1
  173. package/dist/api/routes/application.js +3 -2
  174. package/dist/api/routes/index.js +2 -0
  175. package/dist/api/routes/plugin.js +39 -0
  176. package/dist/api/routes/public/tables.js +1 -1
  177. package/dist/api/routes/table.js +1 -1
  178. package/dist/api/routes/utils/validators.js +2 -1
  179. package/dist/app.js +11 -0
  180. package/dist/db/utils.js +10 -1
  181. package/dist/environment.js +1 -0
  182. package/dist/integrations/airtable.js +126 -129
  183. package/dist/integrations/arangodb.js +86 -89
  184. package/dist/integrations/base/query.js +2 -2
  185. package/dist/integrations/base/sqlTable.js +3 -1
  186. package/dist/integrations/couchdb.js +80 -83
  187. package/dist/integrations/dynamodb.js +161 -164
  188. package/dist/integrations/elasticsearch.js +135 -138
  189. package/dist/integrations/firebase.js +154 -157
  190. package/dist/integrations/googlesheets.js +323 -327
  191. package/dist/integrations/index.js +99 -51
  192. package/dist/integrations/microsoftSqlServer.js +240 -243
  193. package/dist/integrations/mongodb.js +239 -242
  194. package/dist/integrations/mysql.js +215 -219
  195. package/dist/integrations/oracle.js +318 -322
  196. package/dist/integrations/postgres.js +262 -265
  197. package/dist/integrations/redis.js +134 -139
  198. package/dist/integrations/rest.js +289 -292
  199. package/dist/integrations/s3.js +61 -64
  200. package/dist/integrations/snowflake.js +83 -86
  201. package/dist/package.json +9 -6
  202. package/dist/tests/utilities/TestConfiguration.js +1 -1
  203. package/dist/threads/query.js +2 -2
  204. package/dist/tsconfig.build.tsbuildinfo +1 -1
  205. package/dist/utilities/fileSystem/index.js +110 -1
  206. package/dist/watch.js +77 -0
  207. package/dist/websocket.js +22 -0
  208. package/package.json +10 -7
  209. package/scripts/dev/manage.js +1 -0
  210. package/specs/openapi.json +3 -3
  211. package/specs/openapi.yaml +3 -3
  212. package/specs/resources/query.js +1 -1
  213. package/src/api/controllers/application.ts +1 -1
  214. package/src/api/controllers/component.js +21 -2
  215. package/src/api/controllers/datasource.js +21 -8
  216. package/src/api/controllers/integration.js +4 -4
  217. package/src/api/controllers/plugin/file.ts +15 -0
  218. package/src/api/controllers/plugin/github.ts +75 -0
  219. package/src/api/controllers/plugin/index.ts +212 -0
  220. package/src/api/controllers/plugin/npm.ts +56 -0
  221. package/src/api/controllers/plugin/uploaders.ts +4 -0
  222. package/src/api/controllers/plugin/url.ts +12 -0
  223. package/src/api/controllers/plugin/utils.ts +19 -0
  224. package/src/api/controllers/row/external.js +1 -1
  225. package/src/api/controllers/screen.js +66 -1
  226. package/src/api/controllers/static/index.ts +1 -0
  227. package/src/api/controllers/static/templates/BudibaseApp.svelte +10 -0
  228. package/src/api/controllers/static/templates/preview.hbs +5 -1
  229. package/src/api/routes/application.ts +13 -2
  230. package/src/api/routes/index.ts +2 -0
  231. package/src/api/routes/plugin.ts +14 -0
  232. package/src/api/routes/public/tables.ts +1 -1
  233. package/src/api/routes/table.js +1 -1
  234. package/src/api/routes/tests/query.spec.js +8 -25
  235. package/src/api/routes/utils/validators.js +2 -1
  236. package/src/app.ts +14 -0
  237. package/src/db/utils.js +12 -0
  238. package/src/definitions/openapi.ts +3 -3
  239. package/src/environment.js +1 -0
  240. package/src/integrations/airtable.ts +116 -118
  241. package/src/integrations/arangodb.ts +87 -89
  242. package/src/integrations/base/query.ts +2 -2
  243. package/src/integrations/base/sqlTable.ts +3 -1
  244. package/src/integrations/couchdb.ts +83 -89
  245. package/src/integrations/dynamodb.ts +173 -175
  246. package/src/integrations/elasticsearch.ts +120 -122
  247. package/src/integrations/firebase.ts +157 -159
  248. package/src/integrations/googlesheets.ts +328 -338
  249. package/src/integrations/index.ts +64 -21
  250. package/src/integrations/microsoftSqlServer.ts +249 -251
  251. package/src/integrations/mongodb.ts +261 -258
  252. package/src/integrations/mysql.ts +229 -234
  253. package/src/integrations/oracle.ts +373 -380
  254. package/src/integrations/postgres.ts +264 -268
  255. package/src/integrations/redis.ts +128 -132
  256. package/src/integrations/rest.ts +324 -329
  257. package/src/integrations/s3.ts +68 -71
  258. package/src/integrations/snowflake.ts +80 -82
  259. package/src/integrations/tests/{airtable.spec.js → airtable.spec.ts} +21 -18
  260. package/src/integrations/tests/{arangodb.spec.js → arangodb.spec.ts} +12 -9
  261. package/src/integrations/tests/{couchdb.spec.js → couchdb.spec.ts} +33 -27
  262. package/src/integrations/tests/{dynamodb.spec.js → dynamodb.spec.ts} +45 -41
  263. package/src/integrations/tests/{elasticsearch.spec.js → elasticsearch.spec.ts} +22 -21
  264. package/src/integrations/tests/{firebase.spec.js → firebase.spec.ts} +33 -28
  265. package/src/integrations/tests/{microsoftSqlServer.spec.js → microsoftSqlServer.spec.ts} +12 -11
  266. package/src/integrations/tests/{mongo.spec.js → mongo.spec.ts} +46 -35
  267. package/src/integrations/tests/{mysql.spec.js → mysql.spec.ts} +17 -15
  268. package/src/integrations/tests/{oracle.spec.js → oracle.spec.ts} +19 -17
  269. package/src/integrations/tests/{postgres.spec.js → postgres.spec.ts} +19 -17
  270. package/src/integrations/tests/{redis.spec.js → redis.spec.ts} +27 -18
  271. package/src/integrations/tests/{rest.spec.js → rest.spec.ts} +22 -14
  272. package/src/integrations/tests/{s3.spec.js → s3.spec.ts} +10 -8
  273. package/src/integrations/tests/{sql.spec.js → sql.spec.ts} +228 -177
  274. package/src/module.d.ts +2 -0
  275. package/src/tests/utilities/TestConfiguration.js +1 -1
  276. package/src/threads/query.ts +2 -2
  277. package/src/utilities/fileSystem/index.js +129 -0
  278. package/src/watch.ts +38 -0
  279. package/src/websocket.ts +26 -0
  280. package/builder/assets/index.8f5f192a.js +0 -876
  281. package/builder/assets/vendor.5e1fe644.css +0 -1
  282. package/builder/assets/vendor.67dbd8fa.js +0 -248
@@ -1,15 +1,16 @@
1
- const AWS = require("aws-sdk")
2
- const DynamoDBIntegration = require("../dynamodb")
1
+ import { default as DynamoDBIntegration } from "../dynamodb"
3
2
  jest.mock("aws-sdk")
4
3
 
5
4
  class TestConfiguration {
6
- constructor(config = {}) {
7
- this.integration = new DynamoDBIntegration.integration(config)
5
+ integration: any
6
+
7
+ constructor(config: any = {}) {
8
+ this.integration = new DynamoDBIntegration.integration(config)
8
9
  }
9
10
  }
10
11
 
11
12
  describe("DynamoDB Integration", () => {
12
- let config
13
+ let config: any
13
14
  let tableName = "Users"
14
15
 
15
16
  beforeEach(() => {
@@ -17,25 +18,25 @@ describe("DynamoDB Integration", () => {
17
18
  })
18
19
 
19
20
  it("calls the create method with the correct params", async () => {
20
- const response = await config.integration.create({
21
+ const response = await config.integration.create({
21
22
  table: tableName,
22
23
  json: {
23
- Name: "John"
24
- }
24
+ Name: "John",
25
+ },
25
26
  })
26
27
  expect(config.integration.client.put).toHaveBeenCalledWith({
27
28
  TableName: tableName,
28
- Name: "John"
29
+ Name: "John",
29
30
  })
30
31
  })
31
32
 
32
33
  it("calls the read method with the correct params", async () => {
33
34
  const indexName = "Test"
34
35
 
35
- const response = await config.integration.read({
36
+ const response = await config.integration.read({
36
37
  table: tableName,
37
- index: indexName,
38
- json: {}
38
+ index: indexName,
39
+ json: {},
39
40
  })
40
41
  expect(config.integration.client.query).toHaveBeenCalledWith({
41
42
  TableName: tableName,
@@ -47,57 +48,59 @@ describe("DynamoDB Integration", () => {
47
48
  it("calls the scan method with the correct params", async () => {
48
49
  const indexName = "Test"
49
50
 
50
- const response = await config.integration.scan({
51
+ const response = await config.integration.scan({
51
52
  table: tableName,
52
- index: indexName,
53
- json: {}
53
+ index: indexName,
54
+ json: {},
54
55
  })
55
56
  expect(config.integration.client.scan).toHaveBeenCalledWith({
56
57
  TableName: tableName,
57
58
  IndexName: indexName,
58
59
  })
59
- expect(response).toEqual([{
60
- Name: "test"
61
- }])
60
+ expect(response).toEqual([
61
+ {
62
+ Name: "test",
63
+ },
64
+ ])
62
65
  })
63
66
 
64
67
  it("calls the get method with the correct params", async () => {
65
- const response = await config.integration.get({
68
+ const response = await config.integration.get({
66
69
  table: tableName,
67
70
  json: {
68
- Id: 123
69
- }
71
+ Id: 123,
72
+ },
70
73
  })
71
74
 
72
75
  expect(config.integration.client.get).toHaveBeenCalledWith({
73
76
  TableName: tableName,
74
- Id: 123
77
+ Id: 123,
75
78
  })
76
79
  })
77
80
 
78
81
  it("calls the update method with the correct params", async () => {
79
- const response = await config.integration.update({
82
+ const response = await config.integration.update({
80
83
  table: tableName,
81
84
  json: {
82
- Name: "John"
83
- }
85
+ Name: "John",
86
+ },
84
87
  })
85
88
  expect(config.integration.client.update).toHaveBeenCalledWith({
86
89
  TableName: tableName,
87
- Name: "John"
90
+ Name: "John",
88
91
  })
89
92
  })
90
93
 
91
94
  it("calls the delete method with the correct params", async () => {
92
- const response = await config.integration.delete({
95
+ const response = await config.integration.delete({
93
96
  table: tableName,
94
97
  json: {
95
- Name: "John"
96
- }
98
+ Name: "John",
99
+ },
97
100
  })
98
101
  expect(config.integration.client.delete).toHaveBeenCalledWith({
99
102
  TableName: tableName,
100
- Name: "John"
103
+ Name: "John",
101
104
  })
102
105
  })
103
106
 
@@ -105,14 +108,14 @@ describe("DynamoDB Integration", () => {
105
108
  const config = {
106
109
  region: "us-east-1",
107
110
  accessKeyId: "test",
108
- secretAccessKeyId: "test"
111
+ secretAccessKey: "test",
109
112
  }
110
113
 
111
- const integration = new DynamoDBIntegration.integration(config)
114
+ const integration: any = new DynamoDBIntegration.integration(config)
112
115
 
113
116
  expect(integration.config).toEqual({
114
117
  currentClockSkew: true,
115
- ...config
118
+ ...config,
116
119
  })
117
120
  })
118
121
 
@@ -120,16 +123,16 @@ describe("DynamoDB Integration", () => {
120
123
  const config = {
121
124
  region: "us-east-1",
122
125
  accessKeyId: "test",
123
- secretAccessKeyId: "test",
124
- endpoint: "localhost:8080"
126
+ secretAccessKey: "test",
127
+ endpoint: "localhost:8080",
125
128
  }
126
129
 
127
- const integration = new DynamoDBIntegration.integration(config)
130
+ const integration: any = new DynamoDBIntegration.integration(config)
128
131
 
129
132
  expect(integration.config).toEqual({
130
133
  region: "us-east-1",
131
134
  currentClockSkew: true,
132
- endpoint: "localhost:8080"
135
+ endpoint: "localhost:8080",
133
136
  })
134
137
  })
135
138
 
@@ -137,15 +140,16 @@ describe("DynamoDB Integration", () => {
137
140
  const config = {
138
141
  region: "us-east-1",
139
142
  accessKeyId: "test",
140
- secretAccessKeyId: "test",
141
- endpoint: "dynamodb.aws.foo.net"
143
+ secretAccessKey: "test",
144
+ endpoint: "dynamodb.aws.foo.net",
142
145
  }
143
146
 
144
147
  const integration = new DynamoDBIntegration.integration(config)
145
148
 
149
+ // @ts-ignore
146
150
  expect(integration.config).toEqual({
147
151
  currentClockSkew: true,
148
- ...config
152
+ ...config,
149
153
  })
150
154
  })
151
- })
155
+ })
@@ -1,15 +1,16 @@
1
- const elasticsearch = require("@elastic/elasticsearch")
2
- const ElasticSearchIntegration = require("../elasticsearch")
1
+ import { default as ElasticSearchIntegration } from "../elasticsearch"
3
2
  jest.mock("@elastic/elasticsearch")
4
3
 
5
4
  class TestConfiguration {
6
- constructor(config = {}) {
7
- this.integration = new ElasticSearchIntegration.integration(config)
5
+ integration: any
6
+
7
+ constructor(config: any = {}) {
8
+ this.integration = new ElasticSearchIntegration.integration(config)
8
9
  }
9
10
  }
10
11
 
11
12
  describe("Elasticsearch Integration", () => {
12
- let config
13
+ let config: any
13
14
  let indexName = "Users"
14
15
 
15
16
  beforeEach(() => {
@@ -18,15 +19,15 @@ describe("Elasticsearch Integration", () => {
18
19
 
19
20
  it("calls the create method with the correct params", async () => {
20
21
  const body = {
21
- name: "Hello"
22
+ name: "Hello",
22
23
  }
23
- const response = await config.integration.create({
24
+ const response = await config.integration.create({
24
25
  index: indexName,
25
- json: body
26
+ json: body,
26
27
  })
27
28
  expect(config.integration.client.index).toHaveBeenCalledWith({
28
29
  index: indexName,
29
- body
30
+ body,
30
31
  })
31
32
  })
32
33
 
@@ -34,43 +35,43 @@ describe("Elasticsearch Integration", () => {
34
35
  const body = {
35
36
  query: {
36
37
  term: {
37
- name: "kimchy"
38
- }
39
- }
38
+ name: "kimchy",
39
+ },
40
+ },
40
41
  }
41
- const response = await config.integration.read({
42
+ const response = await config.integration.read({
42
43
  index: indexName,
43
- json: body
44
+ json: body,
44
45
  })
45
46
  expect(config.integration.client.search).toHaveBeenCalledWith({
46
47
  index: indexName,
47
- body
48
+ body,
48
49
  })
49
50
  expect(response).toEqual(expect.any(Array))
50
51
  })
51
52
 
52
53
  it("calls the update method with the correct params", async () => {
53
54
  const body = {
54
- name: "updated"
55
+ name: "updated",
55
56
  }
56
57
 
57
- const response = await config.integration.update({
58
+ const response = await config.integration.update({
58
59
  id: "1234",
59
60
  index: indexName,
60
- json: body
61
+ json: body,
61
62
  })
62
63
 
63
64
  expect(config.integration.client.update).toHaveBeenCalledWith({
64
65
  id: "1234",
65
66
  index: indexName,
66
- body
67
+ body,
67
68
  })
68
69
  expect(response).toEqual(expect.any(Array))
69
70
  })
70
71
 
71
72
  it("calls the delete method with the correct params", async () => {
72
73
  const body = {
73
- id: "1234"
74
+ id: "1234",
74
75
  }
75
76
 
76
77
  const response = await config.integration.delete(body)
@@ -78,4 +79,4 @@ describe("Elasticsearch Integration", () => {
78
79
  expect(config.integration.client.delete).toHaveBeenCalledWith(body)
79
80
  expect(response).toEqual(expect.any(Array))
80
81
  })
81
- })
82
+ })
@@ -1,92 +1,97 @@
1
- const firebase = require("@google-cloud/firestore")
2
- const FirebaseIntegration = require("../firebase")
1
+ import { default as FirebaseIntegration } from "../firebase"
3
2
  jest.mock("@google-cloud/firestore")
4
3
 
5
4
  class TestConfiguration {
6
- constructor(config = {}) {
7
- this.integration = new FirebaseIntegration.integration(config)
5
+ integration: any
6
+
7
+ constructor(config: any = {}) {
8
+ this.integration = new FirebaseIntegration.integration(config)
8
9
  }
9
10
  }
10
11
 
11
12
  describe("Firebase Integration", () => {
12
- let config
13
+ let config: any
13
14
  let tableName = "Users"
14
15
 
15
16
  beforeEach(() => {
16
17
  config = new TestConfiguration({
17
- serviceAccount: "{}"
18
+ serviceAccount: "{}",
18
19
  })
19
20
  })
20
21
 
21
22
  it("calls the create method with the correct params", async () => {
22
- await config.integration.create({
23
+ await config.integration.create({
23
24
  table: tableName,
24
25
  json: {
25
- Name: "Test Name"
26
+ Name: "Test Name",
26
27
  },
27
28
  extra: {
28
- collection: "test"
29
- }
29
+ collection: "test",
30
+ },
30
31
  })
31
32
  expect(config.integration.client.collection).toHaveBeenCalledWith("test")
32
- expect(config.integration.client.set).toHaveBeenCalledWith({
33
+ expect(config.integration.client.set).toHaveBeenCalledWith({
33
34
  Name: "Test Name",
34
- id: "test_id"
35
+ id: "test_id",
35
36
  })
36
37
  })
37
38
 
38
39
  it("calls the read method with the correct params", async () => {
39
- const response = await config.integration.read({
40
+ const response = await config.integration.read({
40
41
  table: tableName,
41
42
  json: {
42
- Name: "Test"
43
+ Name: "Test",
43
44
  },
44
45
  extra: {
45
46
  collection: "test",
46
47
  filterField: "field",
47
48
  filter: "==",
48
49
  filterValue: "value",
49
- }
50
+ },
50
51
  })
51
52
  expect(config.integration.client.collection).toHaveBeenCalledWith("test")
52
- expect(config.integration.client.where).toHaveBeenCalledWith("field", "==", "value")
53
- expect(response).toEqual([{ result: "test"}])
53
+ expect(config.integration.client.where).toHaveBeenCalledWith(
54
+ "field",
55
+ "==",
56
+ "value"
57
+ )
58
+ expect(response).toEqual([{ result: "test" }])
54
59
  })
55
60
 
56
61
  it("calls the update method with the correct params", async () => {
57
- const response = await config.integration.update({
62
+ const response = await config.integration.update({
58
63
  table: tableName,
59
64
  json: {
60
65
  id: "test",
61
- Name: "Test"
66
+ Name: "Test",
62
67
  },
63
68
  extra: {
64
- collection: "test"
65
- }
69
+ collection: "test",
70
+ },
66
71
  })
67
72
  expect(config.integration.client.collection).toHaveBeenCalledWith("test")
68
73
  expect(config.integration.client.update).toHaveBeenCalledWith({
69
74
  Name: "Test",
70
- id: "test"
75
+ id: "test",
71
76
  })
72
77
  expect(response).toEqual({
73
- result: "test"
78
+ result: "test",
74
79
  })
75
80
  })
76
81
 
77
82
  it("calls the delete method with the correct params", async () => {
78
- const response = await config.integration.delete({
83
+ const response = await config.integration.delete({
79
84
  table: tableName,
80
85
  json: {
81
86
  id: "test",
82
- Name: "Test"
87
+ Name: "Test",
83
88
  },
84
89
  extra: {
85
- collection: "test"
86
- }
90
+ collection: "test",
91
+ },
87
92
  })
88
93
  expect(config.integration.client.collection).toHaveBeenCalledWith("test")
89
94
  expect(config.integration.client.doc).toHaveBeenCalledWith("test")
90
95
  expect(config.integration.client.delete).toHaveBeenCalled()
91
96
  })
92
- })
97
+ })
@@ -1,15 +1,16 @@
1
- const sqlServer = require("mssql")
2
- const MSSQLIntegration = require("../microsoftSqlServer")
1
+ import { default as MSSQLIntegration } from "../microsoftSqlServer"
3
2
  jest.mock("mssql")
4
3
 
5
4
  class TestConfiguration {
6
- constructor(config = {}) {
7
- this.integration = new MSSQLIntegration.integration(config)
5
+ integration: any
6
+
7
+ constructor(config: any = {}) {
8
+ this.integration = new MSSQLIntegration.integration(config)
8
9
  }
9
10
  }
10
11
 
11
12
  describe("MS SQL Server Integration", () => {
12
- let config
13
+ let config: any
13
14
 
14
15
  beforeEach(async () => {
15
16
  config = new TestConfiguration()
@@ -23,7 +24,7 @@ describe("MS SQL Server Integration", () => {
23
24
  it("calls the create method with the correct params", async () => {
24
25
  const sql = "insert into users (name, age) values ('Joe', 123);"
25
26
  const response = await config.integration.create({
26
- sql
27
+ sql,
27
28
  })
28
29
  expect(config.integration.client.request).toHaveBeenCalledWith()
29
30
  expect(response[0]).toEqual(sql)
@@ -32,7 +33,7 @@ describe("MS SQL Server Integration", () => {
32
33
  it("calls the read method with the correct params", async () => {
33
34
  const sql = "select * from users;"
34
35
  const response = await config.integration.read({
35
- sql
36
+ sql,
36
37
  })
37
38
  expect(config.integration.client.request).toHaveBeenCalledWith()
38
39
  expect(response[0]).toEqual(sql)
@@ -45,11 +46,11 @@ describe("MS SQL Server Integration", () => {
45
46
  })
46
47
 
47
48
  it("returns the correct response when the create response has no rows", async () => {
48
- const sql = "insert into users (name, age) values ('Joe', 123);"
49
- const response = await config.integration.create({
50
- sql
49
+ const sql = "insert into users (name, age) values ('Joe', 123);"
50
+ const response = await config.integration.create({
51
+ sql,
51
52
  })
52
53
  expect(response[0]).toEqual(sql)
53
54
  })
54
55
  })
55
- })
56
+ })