@neuralinnovations/dataisland-sdk 0.0.1-dev4 → 0.0.1-dev40

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 (353) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +271 -36
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +3 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/package.json +103 -0
  8. package/dist/src/appBuilder.d.ts +44 -0
  9. package/dist/src/appBuilder.d.ts.map +1 -0
  10. package/dist/src/appBuilder.js +10 -0
  11. package/dist/src/appBuilder.js.map +1 -0
  12. package/dist/src/commands/deleteUserFullCommandHandler.d.ts +7 -0
  13. package/dist/src/commands/deleteUserFullCommandHandler.d.ts.map +1 -0
  14. package/dist/src/commands/deleteUserFullCommandHandler.js +21 -0
  15. package/dist/src/commands/deleteUserFullCommandHandler.js.map +1 -0
  16. package/dist/src/commands/startCommandHandler.d.ts +7 -0
  17. package/dist/src/commands/startCommandHandler.d.ts.map +1 -0
  18. package/dist/src/commands/startCommandHandler.js +27 -0
  19. package/dist/src/commands/startCommandHandler.js.map +1 -0
  20. package/dist/src/context.d.ts +24 -0
  21. package/dist/src/context.d.ts.map +1 -0
  22. package/dist/src/context.js +31 -0
  23. package/dist/src/context.js.map +1 -0
  24. package/dist/src/credentials.d.ts +33 -0
  25. package/dist/src/credentials.d.ts.map +1 -0
  26. package/dist/src/credentials.js +87 -0
  27. package/dist/src/credentials.js.map +1 -0
  28. package/dist/src/dataIslandApp.d.ts +50 -0
  29. package/dist/src/dataIslandApp.d.ts.map +1 -0
  30. package/dist/src/dataIslandApp.js +10 -0
  31. package/dist/src/dataIslandApp.js.map +1 -0
  32. package/dist/src/disposable.d.ts +84 -0
  33. package/dist/src/disposable.d.ts.map +1 -0
  34. package/dist/src/disposable.js +147 -0
  35. package/dist/src/disposable.js.map +1 -0
  36. package/dist/src/dto/accessGroupResponse.d.ts +30 -0
  37. package/dist/src/dto/accessGroupResponse.d.ts.map +1 -0
  38. package/dist/src/dto/accessGroupResponse.js +3 -0
  39. package/dist/src/dto/accessGroupResponse.js.map +1 -0
  40. package/dist/src/dto/badRequestResponse.d.ts +6 -0
  41. package/dist/src/dto/badRequestResponse.d.ts.map +1 -0
  42. package/dist/src/dto/badRequestResponse.js +3 -0
  43. package/dist/src/dto/badRequestResponse.js.map +1 -0
  44. package/dist/src/dto/chatResponse.d.ts +83 -0
  45. package/dist/src/dto/chatResponse.d.ts.map +1 -0
  46. package/dist/src/dto/chatResponse.js +45 -0
  47. package/dist/src/dto/chatResponse.js.map +1 -0
  48. package/dist/src/dto/limitsResponse.d.ts +29 -0
  49. package/dist/src/dto/limitsResponse.d.ts.map +1 -0
  50. package/dist/src/dto/limitsResponse.js +13 -0
  51. package/dist/src/dto/limitsResponse.js.map +1 -0
  52. package/dist/src/dto/statisticsResponse.d.ts +11 -0
  53. package/dist/src/dto/statisticsResponse.d.ts.map +1 -0
  54. package/dist/src/dto/statisticsResponse.js +3 -0
  55. package/dist/src/dto/statisticsResponse.js.map +1 -0
  56. package/dist/src/dto/userInfoResponse.d.ts +88 -0
  57. package/dist/src/dto/userInfoResponse.d.ts.map +1 -0
  58. package/dist/src/dto/userInfoResponse.js +3 -0
  59. package/dist/src/dto/userInfoResponse.js.map +1 -0
  60. package/dist/src/dto/workspacesResponse.d.ts +45 -0
  61. package/dist/src/dto/workspacesResponse.d.ts.map +1 -0
  62. package/dist/src/dto/workspacesResponse.js +3 -0
  63. package/dist/src/dto/workspacesResponse.js.map +1 -0
  64. package/dist/src/events.d.ts +17 -0
  65. package/dist/src/events.d.ts.map +1 -0
  66. package/dist/src/events.js +52 -0
  67. package/dist/src/events.js.map +1 -0
  68. package/dist/src/index.d.ts +66 -0
  69. package/dist/src/index.d.ts.map +1 -0
  70. package/dist/src/index.js +113 -0
  71. package/dist/src/index.js.map +1 -0
  72. package/dist/src/internal/app.impl.d.ts +28 -0
  73. package/dist/src/internal/app.impl.d.ts.map +1 -0
  74. package/dist/src/internal/app.impl.js +173 -0
  75. package/dist/src/internal/app.impl.js.map +1 -0
  76. package/dist/src/internal/appBuilder.impl.d.ts +27 -0
  77. package/dist/src/internal/appBuilder.impl.d.ts.map +1 -0
  78. package/dist/src/internal/appBuilder.impl.js +71 -0
  79. package/dist/src/internal/appBuilder.impl.js.map +1 -0
  80. package/dist/src/internal/createApp.impl.d.ts +4 -0
  81. package/dist/src/internal/createApp.impl.d.ts.map +1 -0
  82. package/dist/src/internal/createApp.impl.js +11 -0
  83. package/dist/src/internal/createApp.impl.js.map +1 -0
  84. package/dist/src/internal/registry.d.ts +66 -0
  85. package/dist/src/internal/registry.d.ts.map +1 -0
  86. package/dist/src/internal/registry.js +114 -0
  87. package/dist/src/internal/registry.js.map +1 -0
  88. package/dist/src/middleware.d.ts +6 -0
  89. package/dist/src/middleware.d.ts.map +1 -0
  90. package/dist/src/middleware.js +3 -0
  91. package/dist/src/middleware.js.map +1 -0
  92. package/dist/src/services/anonymousService.d.ts +8 -0
  93. package/dist/src/services/anonymousService.d.ts.map +1 -0
  94. package/dist/src/services/anonymousService.js +41 -0
  95. package/dist/src/services/anonymousService.js.map +1 -0
  96. package/dist/src/services/commandService.d.ts +18 -0
  97. package/dist/src/services/commandService.d.ts.map +1 -0
  98. package/dist/src/services/commandService.js +40 -0
  99. package/dist/src/services/commandService.js.map +1 -0
  100. package/dist/src/services/cookieService.d.ts +7 -0
  101. package/dist/src/services/cookieService.d.ts.map +1 -0
  102. package/dist/src/services/cookieService.js +18 -0
  103. package/dist/src/services/cookieService.js.map +1 -0
  104. package/dist/src/services/credentialService.d.ts +9 -0
  105. package/dist/src/services/credentialService.d.ts.map +1 -0
  106. package/dist/src/services/credentialService.js +26 -0
  107. package/dist/src/services/credentialService.js.map +1 -0
  108. package/dist/src/services/httpMethod.d.ts +2 -0
  109. package/dist/src/services/httpMethod.d.ts.map +1 -0
  110. package/dist/src/services/httpMethod.js +3 -0
  111. package/dist/src/services/httpMethod.js.map +1 -0
  112. package/dist/src/services/middlewareService.d.ts +10 -0
  113. package/dist/src/services/middlewareService.d.ts.map +1 -0
  114. package/dist/src/services/middlewareService.js +34 -0
  115. package/dist/src/services/middlewareService.js.map +1 -0
  116. package/dist/src/services/organizationService.d.ts +10 -0
  117. package/dist/src/services/organizationService.d.ts.map +1 -0
  118. package/dist/src/services/organizationService.js +19 -0
  119. package/dist/src/services/organizationService.js.map +1 -0
  120. package/dist/src/services/requestBuilder.d.ts +17 -0
  121. package/dist/src/services/requestBuilder.d.ts.map +1 -0
  122. package/dist/src/services/requestBuilder.js +105 -0
  123. package/dist/src/services/requestBuilder.js.map +1 -0
  124. package/dist/src/services/responseUtils.d.ts +8 -0
  125. package/dist/src/services/responseUtils.d.ts.map +1 -0
  126. package/dist/src/services/responseUtils.js +40 -0
  127. package/dist/src/services/responseUtils.js.map +1 -0
  128. package/dist/src/services/rpcService.d.ts +77 -0
  129. package/dist/src/services/rpcService.d.ts.map +1 -0
  130. package/dist/src/services/rpcService.js +125 -0
  131. package/dist/src/services/rpcService.js.map +1 -0
  132. package/dist/src/services/service.d.ts +21 -0
  133. package/dist/src/services/service.d.ts.map +1 -0
  134. package/dist/src/services/service.js +41 -0
  135. package/dist/src/services/service.js.map +1 -0
  136. package/dist/src/services/userProfileService.d.ts +9 -0
  137. package/dist/src/services/userProfileService.d.ts.map +1 -0
  138. package/dist/src/services/userProfileService.js +43 -0
  139. package/dist/src/services/userProfileService.js.map +1 -0
  140. package/dist/src/storages/chats/answer.d.ts +41 -0
  141. package/dist/src/storages/chats/answer.d.ts.map +1 -0
  142. package/dist/src/storages/chats/answer.impl.d.ts +29 -0
  143. package/dist/src/storages/chats/answer.impl.d.ts.map +1 -0
  144. package/dist/src/storages/chats/answer.impl.js +116 -0
  145. package/dist/src/storages/chats/answer.impl.js.map +1 -0
  146. package/dist/src/storages/chats/answer.js +15 -0
  147. package/dist/src/storages/chats/answer.js.map +1 -0
  148. package/dist/src/storages/chats/chat.d.ts +43 -0
  149. package/dist/src/storages/chats/chat.d.ts.map +1 -0
  150. package/dist/src/storages/chats/chat.impl.d.ts +25 -0
  151. package/dist/src/storages/chats/chat.impl.d.ts.map +1 -0
  152. package/dist/src/storages/chats/chat.impl.js +85 -0
  153. package/dist/src/storages/chats/chat.impl.js.map +1 -0
  154. package/dist/src/storages/chats/chat.js +12 -0
  155. package/dist/src/storages/chats/chat.js.map +1 -0
  156. package/dist/src/storages/chats/chats.d.ts +45 -0
  157. package/dist/src/storages/chats/chats.d.ts.map +1 -0
  158. package/dist/src/storages/chats/chats.impl.d.ts +19 -0
  159. package/dist/src/storages/chats/chats.impl.d.ts.map +1 -0
  160. package/dist/src/storages/chats/chats.impl.js +147 -0
  161. package/dist/src/storages/chats/chats.impl.js.map +1 -0
  162. package/dist/src/storages/chats/chats.js +16 -0
  163. package/dist/src/storages/chats/chats.js.map +1 -0
  164. package/dist/src/storages/files/file.d.ts +47 -0
  165. package/dist/src/storages/files/file.d.ts.map +1 -0
  166. package/dist/src/storages/files/file.impl.d.ts +25 -0
  167. package/dist/src/storages/files/file.impl.d.ts.map +1 -0
  168. package/dist/src/storages/files/file.impl.js +93 -0
  169. package/dist/src/storages/files/file.impl.js.map +1 -0
  170. package/dist/src/storages/files/file.js +17 -0
  171. package/dist/src/storages/files/file.js.map +1 -0
  172. package/dist/src/storages/files/files.d.ts +39 -0
  173. package/dist/src/storages/files/files.d.ts.map +1 -0
  174. package/dist/src/storages/files/files.impl.d.ts +24 -0
  175. package/dist/src/storages/files/files.impl.d.ts.map +1 -0
  176. package/dist/src/storages/files/files.impl.js +168 -0
  177. package/dist/src/storages/files/files.impl.js.map +1 -0
  178. package/dist/src/storages/files/files.js +20 -0
  179. package/dist/src/storages/files/files.js.map +1 -0
  180. package/dist/src/storages/files/filesPage.d.ts +28 -0
  181. package/dist/src/storages/files/filesPage.d.ts.map +1 -0
  182. package/dist/src/storages/files/filesPage.impl.d.ts +15 -0
  183. package/dist/src/storages/files/filesPage.impl.d.ts.map +1 -0
  184. package/dist/src/storages/files/filesPage.impl.js +38 -0
  185. package/dist/src/storages/files/filesPage.impl.js.map +1 -0
  186. package/dist/src/storages/files/filesPage.js +10 -0
  187. package/dist/src/storages/files/filesPage.js.map +1 -0
  188. package/dist/src/storages/groups/group.d.ts +63 -0
  189. package/dist/src/storages/groups/group.d.ts.map +1 -0
  190. package/dist/src/storages/groups/group.impl.d.ts +38 -0
  191. package/dist/src/storages/groups/group.impl.d.ts.map +1 -0
  192. package/dist/src/storages/groups/group.impl.js +210 -0
  193. package/dist/src/storages/groups/group.impl.js.map +1 -0
  194. package/dist/src/storages/groups/group.js +15 -0
  195. package/dist/src/storages/groups/group.js.map +1 -0
  196. package/dist/src/storages/groups/groups.d.ts +39 -0
  197. package/dist/src/storages/groups/groups.d.ts.map +1 -0
  198. package/dist/src/storages/groups/groups.impl.d.ts +30 -0
  199. package/dist/src/storages/groups/groups.impl.d.ts.map +1 -0
  200. package/dist/src/storages/groups/groups.impl.js +132 -0
  201. package/dist/src/storages/groups/groups.impl.js.map +1 -0
  202. package/dist/src/storages/groups/groups.js +20 -0
  203. package/dist/src/storages/groups/groups.js.map +1 -0
  204. package/dist/src/storages/organizations/organization.d.ts +95 -0
  205. package/dist/src/storages/organizations/organization.d.ts.map +1 -0
  206. package/dist/src/storages/organizations/organization.impl.d.ts +42 -0
  207. package/dist/src/storages/organizations/organization.impl.d.ts.map +1 -0
  208. package/dist/src/storages/organizations/organization.impl.js +240 -0
  209. package/dist/src/storages/organizations/organization.impl.js.map +1 -0
  210. package/dist/src/storages/organizations/organization.js +18 -0
  211. package/dist/src/storages/organizations/organization.js.map +1 -0
  212. package/dist/src/storages/organizations/organizations.d.ts +46 -0
  213. package/dist/src/storages/organizations/organizations.d.ts.map +1 -0
  214. package/dist/src/storages/organizations/organizations.impl.d.ts +38 -0
  215. package/dist/src/storages/organizations/organizations.impl.d.ts.map +1 -0
  216. package/dist/src/storages/organizations/organizations.impl.js +158 -0
  217. package/dist/src/storages/organizations/organizations.impl.js.map +1 -0
  218. package/dist/src/storages/organizations/organizations.js +20 -0
  219. package/dist/src/storages/organizations/organizations.js.map +1 -0
  220. package/dist/src/storages/user/userProfile.d.ts +54 -0
  221. package/dist/src/storages/user/userProfile.d.ts.map +1 -0
  222. package/dist/src/storages/user/userProfile.impl.d.ts +21 -0
  223. package/dist/src/storages/user/userProfile.impl.d.ts.map +1 -0
  224. package/dist/src/storages/user/userProfile.impl.js +114 -0
  225. package/dist/src/storages/user/userProfile.impl.js.map +1 -0
  226. package/dist/src/storages/user/userProfile.js +12 -0
  227. package/dist/src/storages/user/userProfile.js.map +1 -0
  228. package/dist/src/storages/workspaces/workspace.d.ts +44 -0
  229. package/dist/src/storages/workspaces/workspace.d.ts.map +1 -0
  230. package/dist/src/storages/workspaces/workspace.impl.d.ts +23 -0
  231. package/dist/src/storages/workspaces/workspace.impl.d.ts.map +1 -0
  232. package/dist/src/storages/workspaces/workspace.impl.js +98 -0
  233. package/dist/src/storages/workspaces/workspace.impl.js.map +1 -0
  234. package/dist/src/storages/workspaces/workspace.js +18 -0
  235. package/dist/src/storages/workspaces/workspace.js.map +1 -0
  236. package/dist/src/storages/workspaces/workspaces.d.ts +47 -0
  237. package/dist/src/storages/workspaces/workspaces.d.ts.map +1 -0
  238. package/dist/src/storages/workspaces/workspaces.impl.d.ts +33 -0
  239. package/dist/src/storages/workspaces/workspaces.impl.d.ts.map +1 -0
  240. package/dist/src/storages/workspaces/workspaces.impl.js +152 -0
  241. package/dist/src/storages/workspaces/workspaces.impl.js.map +1 -0
  242. package/dist/src/storages/workspaces/workspaces.js +19 -0
  243. package/dist/src/storages/workspaces/workspaces.js.map +1 -0
  244. package/dist/src/unitTest.d.ts +12 -0
  245. package/dist/src/unitTest.d.ts.map +1 -0
  246. package/dist/src/unitTest.js +44 -0
  247. package/dist/src/unitTest.js.map +1 -0
  248. package/dist/src/utils/browserUtils.d.ts +4 -0
  249. package/dist/src/utils/browserUtils.d.ts.map +1 -0
  250. package/dist/src/utils/browserUtils.js +64 -0
  251. package/dist/src/utils/browserUtils.js.map +1 -0
  252. package/dist/src/utils/request.d.ts +6 -0
  253. package/dist/src/utils/request.d.ts.map +1 -0
  254. package/dist/src/utils/request.js +3 -0
  255. package/dist/src/utils/request.js.map +1 -0
  256. package/dist/src/utils/utils.d.ts +3 -0
  257. package/dist/src/utils/utils.d.ts.map +1 -0
  258. package/dist/src/utils/utils.js +13 -0
  259. package/dist/src/utils/utils.js.map +1 -0
  260. package/index.d.ts +1 -0
  261. package/index.js +1 -0
  262. package/package.json +46 -5
  263. package/src/commands/deleteUserFullCommandHandler.ts +19 -0
  264. package/src/commands/startCommandHandler.ts +16 -5
  265. package/src/context.ts +4 -2
  266. package/src/credentials.ts +22 -0
  267. package/src/{appSdk.ts → dataIslandApp.ts} +3 -3
  268. package/src/disposable.ts +18 -5
  269. package/src/dto/accessGroupResponse.ts +19 -16
  270. package/src/dto/badRequestResponse.ts +6 -0
  271. package/src/dto/chatResponse.ts +59 -54
  272. package/src/dto/limitsResponse.ts +33 -0
  273. package/src/dto/statisticsResponse.ts +12 -0
  274. package/src/dto/userInfoResponse.ts +59 -2
  275. package/src/dto/workspacesResponse.ts +5 -3
  276. package/src/index.ts +46 -24
  277. package/src/internal/app.impl.ts +42 -9
  278. package/src/internal/createApp.impl.ts +4 -4
  279. package/src/internal/registry.ts +54 -6
  280. package/src/middleware.ts +2 -0
  281. package/src/services/anonymousService.ts +43 -0
  282. package/src/services/commandService.ts +4 -2
  283. package/src/services/cookieService.ts +16 -0
  284. package/src/services/httpMethod.ts +1 -0
  285. package/src/services/middlewareService.ts +1 -0
  286. package/src/services/organizationService.ts +2 -2
  287. package/src/services/requestBuilder.ts +10 -8
  288. package/src/services/responseUtils.ts +12 -0
  289. package/src/services/rpcService.ts +1 -0
  290. package/src/services/userProfileService.ts +18 -4
  291. package/src/storages/chats/answer.impl.ts +160 -0
  292. package/src/storages/chats/answer.ts +53 -0
  293. package/src/storages/chats/chat.impl.ts +107 -0
  294. package/src/storages/chats/chat.ts +55 -0
  295. package/src/storages/chats/chats.impl.ts +204 -0
  296. package/src/storages/chats/chats.ts +53 -0
  297. package/src/storages/files/file.impl.ts +111 -0
  298. package/src/storages/files/file.ts +58 -0
  299. package/src/storages/{files.impl.ts → files/files.impl.ts} +67 -46
  300. package/src/storages/{files.ts → files/files.ts} +14 -7
  301. package/src/storages/files/filesPage.impl.ts +37 -0
  302. package/src/storages/{filesPage.ts → files/filesPage.ts} +6 -0
  303. package/src/storages/groups/group.impl.ts +276 -0
  304. package/src/storages/groups/group.ts +73 -0
  305. package/src/storages/groups/groups.impl.ts +175 -0
  306. package/src/storages/groups/groups.ts +45 -0
  307. package/src/storages/organizations/organization.impl.ts +357 -0
  308. package/src/storages/organizations/organization.ts +118 -0
  309. package/src/storages/{organizations.impl.ts → organizations/organizations.impl.ts} +31 -13
  310. package/src/storages/{organizations.ts → organizations/organizations.ts} +1 -1
  311. package/src/storages/user/userProfile.impl.ts +136 -0
  312. package/src/storages/user/userProfile.ts +69 -0
  313. package/src/storages/{workspace.impl.ts → workspaces/workspace.impl.ts} +27 -7
  314. package/src/storages/{workspace.ts → workspaces/workspace.ts} +8 -3
  315. package/src/storages/{workspaces.impl.ts → workspaces/workspaces.impl.ts} +27 -32
  316. package/src/storages/{workspaces.ts → workspaces/workspaces.ts} +6 -2
  317. package/src/unitTest.ts +14 -3
  318. package/src/utils/browserUtils.ts +68 -0
  319. package/src/utils/request.ts +6 -0
  320. package/src/utils/utils.ts +8 -0
  321. package/.browserslistrc +0 -5
  322. package/.editorconfig +0 -25
  323. package/.eslintrc.json +0 -44
  324. package/.github/workflows/publish-npm.yml +0 -28
  325. package/.prettierignore +0 -1
  326. package/.prettierrc +0 -11
  327. package/.yarnrc +0 -2
  328. package/babel.config.js +0 -6
  329. package/jest.config.ts +0 -199
  330. package/jest.setup.ts +0 -2
  331. package/src/storages/chat.ts +0 -21
  332. package/src/storages/chats.ts +0 -17
  333. package/src/storages/file.impl.ts +0 -69
  334. package/src/storages/file.ts +0 -28
  335. package/src/storages/groups.impl.ts +0 -337
  336. package/src/storages/groups.ts +0 -43
  337. package/src/storages/organization.impl.ts +0 -68
  338. package/src/storages/organization.ts +0 -33
  339. package/src/storages/userProfile.impl.ts +0 -56
  340. package/src/storages/userProfile.ts +0 -42
  341. package/test/commands.test.ts +0 -24
  342. package/test/data/test_file.pdf +0 -0
  343. package/test/disposable.test.ts +0 -39
  344. package/test/events.test.ts +0 -151
  345. package/test/files.test.ts +0 -52
  346. package/test/index.test.ts +0 -122
  347. package/test/organization.test.ts +0 -57
  348. package/test/registry.test.ts +0 -44
  349. package/test/services.test.ts +0 -56
  350. package/test/setup.ts +0 -54
  351. package/test/unitTest.test.ts +0 -21
  352. package/test/workspace.test.ts +0 -71
  353. package/tsconfig.json +0 -31
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataIslandApp = exports.dataIslandInstances = exports.DEFAULT_HOST = exports.DEFAULT_NAME = exports.SDK_VERSION = exports.isEmptyNullOrUndefined = exports.isNullOrUndefined = exports.AnswerEvent = exports.Answer = exports.GroupEvent = exports.Group = exports.FilesEvent = exports.Files = exports.FileStatus = exports.File = exports.WorkspacesEvent = exports.Workspaces = exports.OrganizationsEvent = exports.Organizations = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const package_json_1 = require("../package.json");
6
+ const createApp_impl_1 = require("./internal/createApp.impl");
7
+ tslib_1.__exportStar(require("./events"), exports);
8
+ tslib_1.__exportStar(require("./disposable"), exports);
9
+ tslib_1.__exportStar(require("./credentials"), exports);
10
+ tslib_1.__exportStar(require("./dataIslandApp"), exports);
11
+ tslib_1.__exportStar(require("./appBuilder"), exports);
12
+ tslib_1.__exportStar(require("./context"), exports);
13
+ tslib_1.__exportStar(require("./middleware"), exports);
14
+ tslib_1.__exportStar(require("./dto/chatResponse"), exports);
15
+ tslib_1.__exportStar(require("./dto/accessGroupResponse"), exports);
16
+ tslib_1.__exportStar(require("./dto/userInfoResponse"), exports);
17
+ tslib_1.__exportStar(require("./dto/workspacesResponse"), exports);
18
+ tslib_1.__exportStar(require("./storages/organizations/organizations"), exports);
19
+ tslib_1.__exportStar(require("./storages/organizations/organization"), exports);
20
+ tslib_1.__exportStar(require("./storages/workspaces/workspaces"), exports);
21
+ tslib_1.__exportStar(require("./storages/workspaces/workspace"), exports);
22
+ tslib_1.__exportStar(require("./storages/groups/groups"), exports);
23
+ tslib_1.__exportStar(require("./storages/user/userProfile"), exports);
24
+ tslib_1.__exportStar(require("./storages/files/files"), exports);
25
+ tslib_1.__exportStar(require("./storages/files/file"), exports);
26
+ tslib_1.__exportStar(require("./storages/files/filesPage"), exports);
27
+ tslib_1.__exportStar(require("./storages/chats/chats"), exports);
28
+ tslib_1.__exportStar(require("./storages/chats/chat"), exports);
29
+ tslib_1.__exportStar(require("./storages/chats/answer"), exports);
30
+ var organizations_1 = require("./storages/organizations/organizations");
31
+ Object.defineProperty(exports, "Organizations", { enumerable: true, get: function () { return organizations_1.Organizations; } });
32
+ Object.defineProperty(exports, "OrganizationsEvent", { enumerable: true, get: function () { return organizations_1.OrganizationsEvent; } });
33
+ var workspaces_1 = require("./storages/workspaces/workspaces");
34
+ Object.defineProperty(exports, "Workspaces", { enumerable: true, get: function () { return workspaces_1.Workspaces; } });
35
+ Object.defineProperty(exports, "WorkspacesEvent", { enumerable: true, get: function () { return workspaces_1.WorkspacesEvent; } });
36
+ var file_1 = require("./storages/files/file");
37
+ Object.defineProperty(exports, "File", { enumerable: true, get: function () { return file_1.File; } });
38
+ Object.defineProperty(exports, "FileStatus", { enumerable: true, get: function () { return file_1.FileStatus; } });
39
+ var files_1 = require("./storages/files/files");
40
+ Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return files_1.Files; } });
41
+ Object.defineProperty(exports, "FilesEvent", { enumerable: true, get: function () { return files_1.FilesEvent; } });
42
+ var group_1 = require("./storages/groups/group");
43
+ Object.defineProperty(exports, "Group", { enumerable: true, get: function () { return group_1.Group; } });
44
+ Object.defineProperty(exports, "GroupEvent", { enumerable: true, get: function () { return group_1.GroupEvent; } });
45
+ var answer_1 = require("./storages/chats/answer");
46
+ Object.defineProperty(exports, "Answer", { enumerable: true, get: function () { return answer_1.Answer; } });
47
+ Object.defineProperty(exports, "AnswerEvent", { enumerable: true, get: function () { return answer_1.AnswerEvent; } });
48
+ var utils_1 = require("./utils/utils");
49
+ Object.defineProperty(exports, "isNullOrUndefined", { enumerable: true, get: function () { return utils_1.isNullOrUndefined; } });
50
+ Object.defineProperty(exports, "isEmptyNullOrUndefined", { enumerable: true, get: function () { return utils_1.isEmptyNullOrUndefined; } });
51
+ // map of apps that are not ready to be used
52
+ const _appsNotReady = new Map();
53
+ // map of apps that are ready to be used
54
+ const _appsReady = new Map();
55
+ /**
56
+ * Current SDK version.
57
+ */
58
+ exports.SDK_VERSION = package_json_1.version;
59
+ /**
60
+ * Default DataIsland App name.
61
+ */
62
+ exports.DEFAULT_NAME = "[DEFAULT]";
63
+ /**
64
+ * Default DataIsland App host.
65
+ */
66
+ exports.DEFAULT_HOST = "https://api.dataisland.com.ua";
67
+ /**
68
+ * Returns a list of DataIsland App instances.
69
+ */
70
+ function dataIslandInstances() {
71
+ return Array.from(_appsReady.values());
72
+ }
73
+ exports.dataIslandInstances = dataIslandInstances;
74
+ /**
75
+ * Returns a DataIsland App instance.
76
+ * @param name Optional The name of the app.
77
+ * @param setup Optional setup function.
78
+ * @returns A DataIsland App instance.
79
+ * @example
80
+ * ```js
81
+ * import { dataIslandApp, DEFAULT_NAME } from '@neuralinnovations/dataisland-sdk'
82
+ *
83
+ * const app = await dataIslandApp(DEFAULT_NAME, builder => {
84
+ * builder.useHost("https://dataisland.com.ua")
85
+ * builder.useAutomaticDataCollectionEnabled(true)
86
+ * builder.useCredential(new BasicCredential("email", "password"))
87
+ * })
88
+ * ```
89
+ */
90
+ async function dataIslandApp(name, setup) {
91
+ name = name !== null && name !== void 0 ? name : exports.DEFAULT_NAME;
92
+ let appPromise = _appsNotReady.get(name);
93
+ if (appPromise === undefined) {
94
+ appPromise = (0, createApp_impl_1._createApp)(name, setup);
95
+ appPromise
96
+ .then(app => {
97
+ _appsReady.set(name !== null && name !== void 0 ? name : exports.DEFAULT_NAME, app);
98
+ })
99
+ .catch(reason => {
100
+ console.error(`Error: ${reason}`);
101
+ _appsNotReady.delete(name !== null && name !== void 0 ? name : exports.DEFAULT_NAME);
102
+ });
103
+ _appsNotReady.set(name, appPromise);
104
+ }
105
+ else {
106
+ if (setup !== undefined) {
107
+ throw new Error(`DataIsland ${name} is initializing. You can't setup the same again.`);
108
+ }
109
+ }
110
+ return await appPromise;
111
+ }
112
+ exports.dataIslandApp = dataIslandApp;
113
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,kDAAyC;AACzC,8DAAsD;AAItD,mDAAwB;AACxB,uDAA4B;AAC5B,wDAA6B;AAC7B,0DAA+B;AAC/B,uDAA4B;AAC5B,oDAAyB;AACzB,uDAA4B;AAC5B,6DAAkC;AAClC,oEAAyC;AACzC,iEAAsC;AACtC,mEAAwC;AACxC,iFAAsD;AACtD,gFAAqD;AACrD,2EAAgD;AAChD,0EAA+C;AAC/C,mEAAwC;AACxC,sEAA2C;AAC3C,iEAAsC;AACtC,gEAAqC;AACrC,qEAA0C;AAC1C,iEAAsC;AACtC,gEAAqC;AACrC,kEAAuC;AAEvC,wEAE+C;AAD7B,8GAAA,aAAa,OAAA;AAAE,mHAAA,kBAAkB,OAAA;AAEnD,+DAEyC;AAD1B,wGAAA,UAAU,OAAA;AAAE,6GAAA,eAAe,OAAA;AAE1C,8CAAgE;AAA/C,4FAAA,IAAI,OAAA;AAAE,kGAAA,UAAU,OAAA;AACjC,gDAAsE;AAAjD,8FAAA,KAAK,OAAA;AAAE,mGAAA,UAAU,OAA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,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,oBAAY,CAAC,CAAA;QAC5C,CAAC,CAAC,CAAA;QACJ,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IACrC,CAAC;SAAM,CAAC;QACN,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACb,cAAc,IAAI,mDAAmD,CACtE,CAAA;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,UAAU,CAAA;AACzB,CAAC;AA1BD,sCA0BC"}
@@ -0,0 +1,28 @@
1
+ import { type AppBuilder } from "../appBuilder";
2
+ import { type Constructor } from "./registry";
3
+ import { Context } from "../context";
4
+ import { type Lifetime } from "../disposable";
5
+ import { type CredentialBase } from "../credentials";
6
+ import { DataIslandApp } from "../dataIslandApp";
7
+ import { Organizations } from "../storages/organizations/organizations";
8
+ import { UserProfile } from "../storages/user/userProfile";
9
+ export declare class DataIslandAppImpl extends DataIslandApp {
10
+ readonly name: string;
11
+ private _host;
12
+ private _automaticDataCollectionEnabled;
13
+ private readonly _registry;
14
+ private readonly _context;
15
+ private readonly _disposable;
16
+ constructor(name: string);
17
+ get context(): Context;
18
+ get credential(): CredentialBase | undefined;
19
+ set credential(value: CredentialBase);
20
+ get lifetime(): Lifetime;
21
+ resolve: <T>(type: Constructor<T>) => T | undefined;
22
+ get automaticDataCollectionEnabled(): boolean;
23
+ get host(): string;
24
+ get organizations(): Organizations;
25
+ get userProfile(): UserProfile;
26
+ initialize(setup: ((builder: AppBuilder) => Promise<void>) | undefined): Promise<void>;
27
+ }
28
+ //# sourceMappingURL=app.impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.impl.d.ts","sourceRoot":"","sources":["../../../src/internal/app.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIlE,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAShD,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAS1D,qBAAa,iBAAkB,SAAQ,aAAa;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,+BAA+B,CAAgB;IACvD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;gBAErC,IAAI,EAAE,MAAM;IAUxB,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,UAAU,IAAI,cAAc,GAAG,SAAS,CAE3C;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,cAAc,EAEnC;IAED,IAAI,QAAQ,IAAI,QAAQ,CAEvB;IAED,OAAO,6CAAuE;IAE9E,IAAI,8BAA8B,IAAI,OAAO,CAE5C;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,aAAa,IAAI,aAAa,CAEjC;IAED,IAAI,WAAW,IAAI,WAAW,CAE7B;IAEK,UAAU,CACd,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,GAC1D,OAAO,CAAC,IAAI,CAAC;CAiIjB"}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataIslandAppImpl = void 0;
4
+ const index_1 = require("../index");
5
+ const appBuilder_impl_1 = require("./appBuilder.impl");
6
+ const registry_1 = require("./registry");
7
+ const context_1 = require("../context");
8
+ const disposable_1 = require("../disposable");
9
+ const service_1 = require("../services/service");
10
+ const credentialService_1 = require("../services/credentialService");
11
+ const middlewareService_1 = require("../services/middlewareService");
12
+ const credentials_1 = require("../credentials");
13
+ const dataIslandApp_1 = require("../dataIslandApp");
14
+ const rpcService_1 = require("../services/rpcService");
15
+ const commandService_1 = require("../services/commandService");
16
+ const startCommandHandler_1 = require("../commands/startCommandHandler");
17
+ const userProfileService_1 = require("../services/userProfileService");
18
+ const organizationService_1 = require("../services/organizationService");
19
+ const unitTest_1 = require("../unitTest");
20
+ const deleteUserFullCommandHandler_1 = require("../commands/deleteUserFullCommandHandler");
21
+ const cookieService_1 = require("../services/cookieService");
22
+ const anonymousService_1 = require("../services/anonymousService");
23
+ class DataIslandAppImpl extends dataIslandApp_1.DataIslandApp {
24
+ constructor(name) {
25
+ super();
26
+ this._host = index_1.DEFAULT_HOST;
27
+ this._automaticDataCollectionEnabled = true;
28
+ this.resolve = (type) => this._registry.get(type);
29
+ this.name = name;
30
+ this._registry = new registry_1.Registry();
31
+ this._disposable = new disposable_1.DisposableContainer();
32
+ this._context = new context_1.Context(this._registry, this._disposable.lifetime, this);
33
+ this._registry.map(context_1.Context).asValue(this._context);
34
+ }
35
+ get context() {
36
+ return this._context;
37
+ }
38
+ get credential() {
39
+ var _a;
40
+ return (_a = this.resolve(credentialService_1.CredentialService)) === null || _a === void 0 ? void 0 : _a.credential;
41
+ }
42
+ set credential(value) {
43
+ var _a;
44
+ (_a = this.resolve(credentialService_1.CredentialService)) === null || _a === void 0 ? void 0 : _a.useCredential(value);
45
+ }
46
+ get lifetime() {
47
+ return this._disposable.lifetime;
48
+ }
49
+ get automaticDataCollectionEnabled() {
50
+ return this._automaticDataCollectionEnabled;
51
+ }
52
+ get host() {
53
+ return this._host;
54
+ }
55
+ get organizations() {
56
+ var _a;
57
+ return (_a = this.resolve(organizationService_1.OrganizationService)) === null || _a === void 0 ? void 0 : _a.organizations;
58
+ }
59
+ get userProfile() {
60
+ var _a;
61
+ return (_a = this.resolve(userProfileService_1.UserProfileService)) === null || _a === void 0 ? void 0 : _a.userProfile;
62
+ }
63
+ async initialize(setup) {
64
+ // create app builder
65
+ const builder = new appBuilder_impl_1.AppBuilderImplementation();
66
+ // register commands
67
+ builder.registerCommand(startCommandHandler_1.StartCommand, (context) => {
68
+ return new startCommandHandler_1.StartCommandHandler(context);
69
+ });
70
+ builder.registerCommand(deleteUserFullCommandHandler_1.DeleteUserFullCommand, (context) => {
71
+ return new deleteUserFullCommandHandler_1.DeleteUserFullCommandHandler(context);
72
+ });
73
+ // register services
74
+ builder.registerService(cookieService_1.CookieService, (context) => {
75
+ return new cookieService_1.CookieService(context);
76
+ });
77
+ builder.registerService(credentialService_1.CredentialService, (context) => {
78
+ return new credentialService_1.CredentialService(context);
79
+ });
80
+ builder.registerService(middlewareService_1.MiddlewareService, (context) => {
81
+ return new middlewareService_1.MiddlewareService(context);
82
+ });
83
+ builder.registerService(rpcService_1.RpcService, (context) => {
84
+ return new rpcService_1.RpcService(context, builder.host);
85
+ });
86
+ builder.registerService(commandService_1.CommandService, (context) => {
87
+ return new commandService_1.CommandService(context);
88
+ });
89
+ builder.registerService(userProfileService_1.UserProfileService, (context) => {
90
+ return new userProfileService_1.UserProfileService(context);
91
+ });
92
+ builder.registerService(organizationService_1.OrganizationService, (context) => {
93
+ return new organizationService_1.OrganizationService(context);
94
+ });
95
+ builder.registerService(anonymousService_1.AnonymousService, (context) => {
96
+ return new anonymousService_1.AnonymousService(context);
97
+ });
98
+ // call customer setup
99
+ if (setup !== undefined) {
100
+ await setup(builder);
101
+ }
102
+ // host
103
+ this._host = builder.host;
104
+ // automaticDataCollectionEnabled
105
+ this._automaticDataCollectionEnabled =
106
+ builder.automaticDataCollectionEnabled;
107
+ // register services
108
+ const services = [];
109
+ builder.services.forEach(serviceFactory => {
110
+ const serviceContext = new service_1.ServiceContext(this._context, this._disposable.defineNested());
111
+ serviceContext.lifetime.addCallback(() => {
112
+ serviceContext.onUnregister();
113
+ }, serviceContext);
114
+ const serviceInstance = serviceFactory[1](serviceContext);
115
+ services.push([serviceContext, serviceInstance]);
116
+ this._registry.map(serviceFactory[0]).asValue(serviceInstance);
117
+ });
118
+ builder.middlewares.forEach(middleware => {
119
+ var _a;
120
+ (_a = this.resolve(middlewareService_1.MiddlewareService)) === null || _a === void 0 ? void 0 : _a.useMiddleware(middleware);
121
+ });
122
+ builder.commands.forEach(command => {
123
+ var _a;
124
+ (_a = this.resolve(commandService_1.CommandService)) === null || _a === void 0 ? void 0 : _a.register(command[0], command[1]);
125
+ });
126
+ //-------------------------------------------------------------------------
127
+ // register services
128
+ //-------------------------------------------------------------------------
129
+ const waitList = [];
130
+ // call onRegister service's callback
131
+ services.forEach(([serviceContext]) => {
132
+ if (typeof serviceContext.onRegister === "function") {
133
+ waitList.push(serviceContext.onRegister());
134
+ }
135
+ });
136
+ // wait for all services to register
137
+ await Promise.all(waitList);
138
+ //-------------------------------------------------------------------------
139
+ //-------------------------------------------------------------------------
140
+ // start services
141
+ //-------------------------------------------------------------------------
142
+ waitList.length = 0;
143
+ // call onStart service's callback
144
+ services.forEach(([serviceContext]) => {
145
+ if (typeof serviceContext.onStart === "function") {
146
+ waitList.push(serviceContext.onStart());
147
+ }
148
+ });
149
+ // wait for all services to start
150
+ await Promise.all(waitList);
151
+ //-------------------------------------------------------------------------
152
+ // set credential
153
+ this.credential = builder.credential;
154
+ // Check anonymous authorization
155
+ if (!(0, unitTest_1.isUnitTest)(unitTest_1.UnitTest.DO_NOT_START) && builder.credential instanceof credentials_1.DefaultCredential) {
156
+ const anonymous = this.resolve(anonymousService_1.AnonymousService);
157
+ const { token, isValid } = await anonymous.getToken();
158
+ if (isValid) {
159
+ this.credential = new credentials_1.AnonymousCredential(token);
160
+ }
161
+ }
162
+ // start app, execute start command
163
+ if (!(0, unitTest_1.isUnitTest)(unitTest_1.UnitTest.DO_NOT_START)) {
164
+ await this.context.execute(new startCommandHandler_1.StartCommand());
165
+ }
166
+ // log app initialized
167
+ if (!(0, unitTest_1.isUnitTest)(unitTest_1.UnitTest.DO_NOT_PRINT_INITIALIZED_LOG)) {
168
+ console.log(`DataIsland ${this.name} initialized`);
169
+ }
170
+ }
171
+ }
172
+ exports.DataIslandAppImpl = DataIslandAppImpl;
173
+ //# sourceMappingURL=app.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.impl.js","sourceRoot":"","sources":["../../../src/internal/app.impl.ts"],"names":[],"mappings":";;;AAAA,oCAAuC;AAEvC,uDAA4D;AAC5D,yCAAuD;AACvD,wCAAoC;AACpC,8CAAkE;AAClE,iDAAkE;AAClE,qEAAiE;AACjE,qEAAiE;AACjE,gDAIuB;AACvB,oDAAgD;AAChD,uDAAmD;AACnD,+DAA2D;AAC3D,yEAGwC;AACxC,uEAAmE;AACnE,yEAAqE;AAGrE,0CAAkD;AAClD,2FAGiD;AACjD,6DAAyD;AACzD,mEAA+D;AAE/D,MAAa,iBAAkB,SAAQ,6BAAa;IAQlD,YAAY,IAAY;QACtB,KAAK,EAAE,CAAA;QAPD,UAAK,GAAW,oBAAY,CAAA;QAC5B,oCAA+B,GAAY,IAAI,CAAA;QA+BvD,YAAO,GAAG,CAAI,IAAoB,EAAiB,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAxB5E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,mBAAQ,EAAE,CAAA;QAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,gCAAmB,EAAE,CAAA;QAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAE5E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAO,CA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AAC,KAAK,CAAC,CAAA;YAClD,CAAC;QACH,CAAC;QAED,mCAAmC;QACnC,IAAI,CAAC,IAAA,qBAAU,EAAC,mBAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,kCAAY,EAAE,CAAC,CAAA;QAChD,CAAC;QAED,sBAAsB;QACtB,IAAI,CAAC,IAAA,qBAAU,EAAC,mBAAQ,CAAC,4BAA4B,CAAC,EAAE,CAAC;YACvD,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,IAAI,cAAc,CAAC,CAAA;QACpD,CAAC;IACH,CAAC;CACF;AAvLD,8CAuLC"}
@@ -0,0 +1,27 @@
1
+ import { AppBuilder } from "../appBuilder";
2
+ import { type CredentialBase } from "../credentials";
3
+ import type { Middleware } from "../middleware";
4
+ import { type Service, type ServiceContext } from "../services/service";
5
+ import { type Constructor } from "./registry";
6
+ import { Command, CommandHandler } from "../services/commandService";
7
+ import { Context } from "../context";
8
+ export declare class AppBuilderImplementation extends AppBuilder {
9
+ envData: Record<string, any>;
10
+ host: string;
11
+ automaticDataCollectionEnabled: boolean;
12
+ credential: CredentialBase;
13
+ middlewares: Middleware[];
14
+ services: Array<[Constructor<any>, (context: ServiceContext) => Service]>;
15
+ commands: Array<[
16
+ Constructor<any>,
17
+ (context: Context) => CommandHandler<any>
18
+ ]>;
19
+ get env(): Record<string, any>;
20
+ useHost(host: string): AppBuilder;
21
+ useAutomaticDataCollectionEnabled(value: boolean): AppBuilder;
22
+ useCredential(credential: CredentialBase): AppBuilder;
23
+ registerMiddleware(middleware: Middleware): AppBuilder;
24
+ registerService<T extends Service>(type: Constructor<T>, factory: (context: ServiceContext) => T): AppBuilder;
25
+ registerCommand<T extends Command>(messageType: Constructor<T>, commandFactory: (context: Context) => CommandHandler<T>): AppBuilder;
26
+ }
27
+ //# sourceMappingURL=appBuilder.impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,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UAAU;IAQtD,eAAe,CAAC,CAAC,SAAS,OAAO,EAC/B,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EACpB,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,CAAC,GACtC,UAAU;IAWb,eAAe,CAAC,CAAC,SAAS,OAAO,EAC/B,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,EAC3B,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,cAAc,CAAC,CAAC,CAAC,GACtD,UAAU;CAUd"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppBuilderImplementation = void 0;
4
+ const appBuilder_1 = require("../appBuilder");
5
+ const index_1 = require("../index");
6
+ const credentials_1 = require("../credentials");
7
+ const unitTest_1 = require("../unitTest");
8
+ class AppBuilderImplementation extends appBuilder_1.AppBuilder {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.envData = {
12
+ unitTest: unitTest_1.UnitTest.DO_NOTHING
13
+ };
14
+ this.host = index_1.DEFAULT_HOST;
15
+ this.automaticDataCollectionEnabled = true;
16
+ this.credential = new credentials_1.DefaultCredential();
17
+ this.middlewares = [];
18
+ this.services = [];
19
+ this.commands = [];
20
+ }
21
+ get env() {
22
+ return this.envData;
23
+ }
24
+ useHost(host) {
25
+ this.host = host !== null && host !== void 0 ? host : index_1.DEFAULT_HOST;
26
+ return this;
27
+ }
28
+ useAutomaticDataCollectionEnabled(value) {
29
+ if (value === undefined || value === null) {
30
+ throw new Error("useAutomaticDataCollectionEnabled, value is undefined|null");
31
+ }
32
+ this.automaticDataCollectionEnabled = value;
33
+ return this;
34
+ }
35
+ useCredential(credential) {
36
+ if (credential === undefined || credential === null) {
37
+ throw new Error("useCredential, credential is undefined|null");
38
+ }
39
+ this.credential = credential;
40
+ return this;
41
+ }
42
+ registerMiddleware(middleware) {
43
+ if (middleware === undefined || middleware === null) {
44
+ throw new Error("addMiddleware, middleware is undefined|null");
45
+ }
46
+ this.middlewares.push(middleware);
47
+ return this;
48
+ }
49
+ registerService(type, factory) {
50
+ if (type === undefined || type === null) {
51
+ throw new Error("registerService, type is undefined|null");
52
+ }
53
+ if (factory === undefined || factory === null) {
54
+ throw new Error("registerService, factory is undefined|null");
55
+ }
56
+ this.services.push([type, factory]);
57
+ return this;
58
+ }
59
+ registerCommand(messageType, commandFactory) {
60
+ if (messageType === undefined || messageType === null) {
61
+ throw new Error("registerCommand, messageType is undefined|null");
62
+ }
63
+ if (commandFactory === undefined || commandFactory === null) {
64
+ throw new Error("registerCommand, commandFactory is undefined|null");
65
+ }
66
+ this.commands.push([messageType, commandFactory]);
67
+ return this;
68
+ }
69
+ }
70
+ exports.AppBuilderImplementation = AppBuilderImplementation;
71
+ //# sourceMappingURL=appBuilder.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appBuilder.impl.js","sourceRoot":"","sources":["../../../src/internal/appBuilder.impl.ts"],"names":[],"mappings":";;;AAAA,8CAA0C;AAC1C,oCAAuC;AACvC,gDAAuE;AAMvE,0CAAsC;AAEtC,MAAa,wBAAyB,SAAQ,uBAAU;IAAxD;;QACE,YAAO,GAAwB;YAC7B,QAAQ,EAAE,mBAAQ,CAAC,UAAU;SAC9B,CAAA;QACD,SAAI,GAAW,oBAAY,CAAA;QAC3B,mCAA8B,GAAY,IAAI,CAAA;QAC9C,eAAU,GAAmB,IAAI,+BAAiB,EAAE,CAAA;QACpD,gBAAW,GAAiB,EAAE,CAAA;QAC9B,aAAQ,GAAoE,EAAE,CAAA;QAC9E,aAAQ,GAEJ,EAAE,CAAA;IAgER,CAAC;IA9DC,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,oBAAY,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,iCAAiC,CAAC,K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KAAK,CAAC,gDAAgD,CAAC,CAAA;QACnE,CAAC;QACD,IAAI,cAAc,KAAK,SAAS,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;QACtE,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAA;QACjD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA3ED,4DA2EC"}
@@ -0,0 +1,4 @@
1
+ import { type AppBuilder } from "../appBuilder";
2
+ import { DataIslandApp } from "../dataIslandApp";
3
+ export declare function _createApp(name: string, setup?: (builder: AppBuilder) => Promise<void>): Promise<DataIslandApp>;
4
+ //# sourceMappingURL=createApp.impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createApp.impl.d.ts","sourceRoot":"","sources":["../../../src/internal/createApp.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAC7C,OAAO,CAAC,aAAa,CAAC,CAIxB"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._createApp = void 0;
4
+ const app_impl_1 = require("./app.impl");
5
+ async function _createApp(name, setup) {
6
+ const app = new app_impl_1.DataIslandAppImpl(name);
7
+ await app.initialize(setup);
8
+ return app;
9
+ }
10
+ exports._createApp = _createApp;
11
+ //# sourceMappingURL=createApp.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createApp.impl.js","sourceRoot":"","sources":["../../../src/internal/createApp.impl.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAIvC,KAAK,UAAU,UAAU,CAC9B,IAAY,EACZ,KAA8C;IAE9C,MAAM,GAAG,GAAG,IAAI,4BAAiB,CAAC,IAAI,CAAC,CAAA;IACvC,MAAM,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAC3B,OAAO,GAAG,CAAA;AACZ,CAAC;AAPD,gCAOC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Constructor type.
3
+ */
4
+ export type Constructor<T> = new (...args: any[]) => T;
5
+ /**
6
+ * Provider interface.
7
+ */
8
+ declare abstract class Provider {
9
+ /**
10
+ * Provide method.
11
+ */
12
+ abstract provide(): any | undefined;
13
+ }
14
+ /**
15
+ * RegistryItem class.
16
+ */
17
+ export declare class RegistryItem<T> {
18
+ private readonly registry;
19
+ private readonly type;
20
+ constructor(registry: Map<Constructor<any>, Provider>, type: Constructor<T>);
21
+ /**
22
+ * As value method.
23
+ * @param value
24
+ */
25
+ asValue(value: T): void;
26
+ /**
27
+ * As provider method.
28
+ * @param provider
29
+ * @param oneTime
30
+ */
31
+ asProvider<T>(provider: () => T, oneTime?: boolean): void;
32
+ /**
33
+ * As factory method.
34
+ * @param provider
35
+ */
36
+ asFactory<T>(provider: () => T): void;
37
+ /**
38
+ * As singleton method.
39
+ * @param provider
40
+ */
41
+ asSingleton<T>(provider: () => T): void;
42
+ }
43
+ /**
44
+ * Registry class.
45
+ */
46
+ export declare class Registry {
47
+ private readonly services;
48
+ /**
49
+ * Map method.
50
+ * @param type
51
+ */
52
+ map<T>(type: Constructor<T>): RegistryItem<T>;
53
+ /**
54
+ * Set method.
55
+ * @param type
56
+ * @param provider
57
+ */
58
+ set<T>(type: Constructor<T>, provider: Provider): void;
59
+ /**
60
+ * Get method.
61
+ * @param type
62
+ */
63
+ get<T>(type: Constructor<T>): T | undefined;
64
+ }
65
+ export {};
66
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src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C"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Registry = exports.RegistryItem = void 0;
4
+ /**
5
+ * Provider interface.
6
+ */
7
+ class Provider {
8
+ }
9
+ /**
10
+ * MethodProvider class.
11
+ */
12
+ class MethodProvider extends Provider {
13
+ constructor(provider, providerOnce = false) {
14
+ super();
15
+ this.provider = provider;
16
+ this.providerOnce = providerOnce;
17
+ this.provided = false;
18
+ }
19
+ provide() {
20
+ if (this.providerOnce && this.provided) {
21
+ return this.instance;
22
+ }
23
+ this.provided = true;
24
+ this.instance = this.provider();
25
+ return this.instance;
26
+ }
27
+ }
28
+ /**
29
+ * ValueProvider class.
30
+ */
31
+ class ValueProvider extends Provider {
32
+ constructor(value) {
33
+ super();
34
+ this.value = value;
35
+ }
36
+ provide() {
37
+ return this.value;
38
+ }
39
+ }
40
+ /**
41
+ * RegistryItem class.
42
+ */
43
+ class RegistryItem {
44
+ constructor(registry, type) {
45
+ this.registry = registry;
46
+ this.type = type;
47
+ }
48
+ /**
49
+ * As value method.
50
+ * @param value
51
+ */
52
+ asValue(value) {
53
+ this.registry.set(this.type, new ValueProvider(value));
54
+ }
55
+ /**
56
+ * As provider method.
57
+ * @param provider
58
+ * @param oneTime
59
+ */
60
+ asProvider(provider, oneTime = false) {
61
+ this.registry.set(this.type, new MethodProvider(provider, oneTime));
62
+ }
63
+ /**
64
+ * As factory method.
65
+ * @param provider
66
+ */
67
+ asFactory(provider) {
68
+ this.registry.set(this.type, new MethodProvider(provider, false));
69
+ }
70
+ /**
71
+ * As singleton method.
72
+ * @param provider
73
+ */
74
+ asSingleton(provider) {
75
+ this.registry.set(this.type, new MethodProvider(provider, true));
76
+ }
77
+ }
78
+ exports.RegistryItem = RegistryItem;
79
+ /**
80
+ * Registry class.
81
+ */
82
+ class Registry {
83
+ constructor() {
84
+ this.services = new Map();
85
+ }
86
+ /**
87
+ * Map method.
88
+ * @param type
89
+ */
90
+ map(type) {
91
+ return new RegistryItem(this.services, type);
92
+ }
93
+ /**
94
+ * Set method.
95
+ * @param type
96
+ * @param provider
97
+ */
98
+ set(type, provider) {
99
+ this.services.set(type, provider);
100
+ }
101
+ /**
102
+ * Get method.
103
+ * @param type
104
+ */
105
+ get(type) {
106
+ const provider = this.services.get(type);
107
+ if (provider === undefined) {
108
+ return undefined;
109
+ }
110
+ return provider.provide();
111
+ }
112
+ }
113
+ exports.Registry = Registry;
114
+ //# sourceMappingURL=registry.js.map