@gitpod/gitpod-protocol 0.1.5-sh-jupyter.0 → 0.1.5-siddhant-k-code-allow-github-prebuilds-10358.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (455) hide show
  1. package/data/gitpod-schema.json +163 -74
  2. package/lib/accounting-protocol.d.ts +163 -0
  3. package/lib/accounting-protocol.d.ts.map +1 -0
  4. package/lib/accounting-protocol.js +111 -0
  5. package/lib/accounting-protocol.js.map +1 -0
  6. package/lib/admin-protocol.d.ts +51 -6
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +17 -2
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +44 -0
  11. package/lib/analytics.d.ts.map +1 -0
  12. package/lib/analytics.js +10 -0
  13. package/lib/analytics.js.map +1 -0
  14. package/lib/attribution.d.ts +24 -0
  15. package/lib/attribution.d.ts.map +1 -0
  16. package/lib/attribution.js +54 -0
  17. package/lib/attribution.js.map +1 -0
  18. package/lib/auth.d.ts +25 -0
  19. package/lib/auth.d.ts.map +1 -0
  20. package/lib/auth.js +16 -0
  21. package/lib/auth.js.map +1 -0
  22. package/lib/billing-mode.d.ts +45 -0
  23. package/lib/billing-mode.d.ts.map +1 -0
  24. package/lib/billing-mode.js +44 -0
  25. package/lib/billing-mode.js.map +1 -0
  26. package/lib/blocked-repositories-protocol.d.ts +13 -0
  27. package/lib/blocked-repositories-protocol.d.ts.map +1 -0
  28. package/lib/blocked-repositories-protocol.js +8 -0
  29. package/lib/blocked-repositories-protocol.js.map +1 -0
  30. package/lib/context-url.d.ts +30 -0
  31. package/lib/context-url.d.ts.map +1 -0
  32. package/lib/context-url.js +100 -0
  33. package/lib/context-url.js.map +1 -0
  34. package/lib/context-url.spec.d.ts +12 -0
  35. package/lib/context-url.spec.d.ts.map +1 -0
  36. package/lib/context-url.spec.js +81 -0
  37. package/lib/context-url.spec.js.map +1 -0
  38. package/lib/encryption/container-module.d.ts +2 -2
  39. package/lib/encryption/container-module.d.ts.map +1 -1
  40. package/lib/encryption/container-module.js +8 -6
  41. package/lib/encryption/container-module.js.map +1 -1
  42. package/lib/encryption/encryption-engine.d.ts +2 -2
  43. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  44. package/lib/encryption/encryption-engine.js +28 -28
  45. package/lib/encryption/encryption-engine.js.map +1 -1
  46. package/lib/encryption/encryption-engine.spec.d.ts +3 -3
  47. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  48. package/lib/encryption/encryption-engine.spec.js +32 -39
  49. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  50. package/lib/encryption/encryption-service.d.ts +2 -2
  51. package/lib/encryption/encryption-service.d.ts.map +1 -1
  52. package/lib/encryption/encryption-service.js +33 -46
  53. package/lib/encryption/encryption-service.js.map +1 -1
  54. package/lib/encryption/key-provider.d.ts +3 -3
  55. package/lib/encryption/key-provider.d.ts.map +1 -1
  56. package/lib/encryption/key-provider.js +34 -40
  57. package/lib/encryption/key-provider.js.map +1 -1
  58. package/lib/env.d.ts +2 -8
  59. package/lib/env.d.ts.map +1 -1
  60. package/lib/env.js +10 -29
  61. package/lib/env.js.map +1 -1
  62. package/lib/experiments/always-default.d.ts +8 -0
  63. package/lib/experiments/always-default.d.ts.map +1 -0
  64. package/lib/experiments/always-default.js +20 -0
  65. package/lib/experiments/always-default.js.map +1 -0
  66. package/lib/experiments/configcat-server.d.ts +10 -0
  67. package/lib/experiments/configcat-server.d.ts.map +1 -0
  68. package/lib/experiments/configcat-server.js +37 -0
  69. package/lib/experiments/configcat-server.js.map +1 -0
  70. package/lib/experiments/configcat.d.ts +21 -0
  71. package/lib/experiments/configcat.d.ts.map +1 -0
  72. package/lib/experiments/configcat.js +51 -0
  73. package/lib/experiments/configcat.js.map +1 -0
  74. package/lib/experiments/types.d.ts +22 -0
  75. package/lib/experiments/types.d.ts.map +1 -0
  76. package/lib/experiments/types.js +10 -0
  77. package/lib/experiments/types.js.map +1 -0
  78. package/lib/frontend-dashboard-service.d.ts +90 -0
  79. package/lib/frontend-dashboard-service.d.ts.map +1 -0
  80. package/lib/frontend-dashboard-service.js +49 -0
  81. package/lib/frontend-dashboard-service.js.map +1 -0
  82. package/lib/gitpod-file-parser.d.ts +2 -2
  83. package/lib/gitpod-file-parser.d.ts.map +1 -1
  84. package/lib/gitpod-file-parser.js +29 -44
  85. package/lib/gitpod-file-parser.js.map +1 -1
  86. package/lib/gitpod-file-parser.spec.d.ts +2 -2
  87. package/lib/gitpod-file-parser.spec.js +147 -144
  88. package/lib/gitpod-file-parser.spec.js.map +1 -1
  89. package/lib/gitpod-service.d.ts +241 -50
  90. package/lib/gitpod-service.d.ts.map +1 -1
  91. package/lib/gitpod-service.js +275 -123
  92. package/lib/gitpod-service.js.map +1 -1
  93. package/lib/headless-workspace-log.d.ts +11 -13
  94. package/lib/headless-workspace-log.d.ts.map +1 -1
  95. package/lib/headless-workspace-log.js +8 -9
  96. package/lib/headless-workspace-log.js.map +1 -1
  97. package/lib/ide-frontend-service.d.ts +26 -0
  98. package/lib/ide-frontend-service.d.ts.map +1 -0
  99. package/lib/ide-frontend-service.js +8 -0
  100. package/lib/ide-frontend-service.js.map +1 -0
  101. package/lib/ide-protocol.d.ts +126 -0
  102. package/lib/ide-protocol.d.ts.map +1 -0
  103. package/lib/ide-protocol.js +18 -0
  104. package/lib/ide-protocol.js.map +1 -0
  105. package/lib/index.d.ts +18 -12
  106. package/lib/index.d.ts.map +1 -1
  107. package/lib/index.js +28 -13
  108. package/lib/index.js.map +1 -1
  109. package/lib/installation-admin-protocol.d.ts +30 -0
  110. package/lib/installation-admin-protocol.d.ts.map +1 -0
  111. package/lib/installation-admin-protocol.js +31 -0
  112. package/lib/installation-admin-protocol.js.map +1 -0
  113. package/lib/license-protocol.d.ts +9 -2
  114. package/lib/license-protocol.d.ts.map +1 -1
  115. package/lib/license-protocol.js +3 -2
  116. package/lib/license-protocol.js.map +1 -1
  117. package/lib/messaging/browser/connection.d.ts +6 -4
  118. package/lib/messaging/browser/connection.d.ts.map +1 -1
  119. package/lib/messaging/browser/connection.js +188 -48
  120. package/lib/messaging/browser/connection.js.map +1 -1
  121. package/lib/messaging/browser/window-connection.d.ts +9 -4
  122. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  123. package/lib/messaging/browser/window-connection.js +48 -59
  124. package/lib/messaging/browser/window-connection.js.map +1 -1
  125. package/lib/messaging/client-call-metrics.d.ts +21 -0
  126. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  127. package/lib/messaging/client-call-metrics.js +95 -0
  128. package/lib/messaging/client-call-metrics.js.map +1 -0
  129. package/lib/messaging/error.d.ts +17 -4
  130. package/lib/messaging/error.d.ts.map +1 -1
  131. package/lib/messaging/error.js +34 -7
  132. package/lib/messaging/error.js.map +1 -1
  133. package/lib/messaging/handler.d.ts +10 -0
  134. package/lib/messaging/handler.d.ts.map +1 -1
  135. package/lib/messaging/handler.js +2 -1
  136. package/lib/messaging/handler.js.map +1 -1
  137. package/lib/messaging/node/connection.d.ts +1 -17
  138. package/lib/messaging/node/connection.d.ts.map +1 -1
  139. package/lib/messaging/node/connection.js +24 -59
  140. package/lib/messaging/node/connection.js.map +1 -1
  141. package/lib/messaging/proxy-factory.d.ts +3 -1
  142. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  143. package/lib/messaging/proxy-factory.js +76 -162
  144. package/lib/messaging/proxy-factory.js.map +1 -1
  145. package/lib/oss-allowlist.d.ts +14 -0
  146. package/lib/oss-allowlist.d.ts.map +1 -0
  147. package/lib/oss-allowlist.js +8 -0
  148. package/lib/oss-allowlist.js.map +1 -0
  149. package/lib/payment-protocol.d.ts +18 -0
  150. package/lib/payment-protocol.d.ts.map +1 -0
  151. package/lib/payment-protocol.js +13 -0
  152. package/lib/payment-protocol.js.map +1 -0
  153. package/lib/permission.d.ts +26 -15
  154. package/lib/permission.d.ts.map +1 -1
  155. package/lib/permission.js +50 -36
  156. package/lib/permission.js.map +1 -1
  157. package/lib/plans.d.ts +211 -0
  158. package/lib/plans.d.ts.map +1 -0
  159. package/lib/plans.js +609 -0
  160. package/lib/plans.js.map +1 -0
  161. package/lib/protocol.d.ts +300 -112
  162. package/lib/protocol.d.ts.map +1 -1
  163. package/lib/protocol.js +393 -201
  164. package/lib/protocol.js.map +1 -1
  165. package/lib/protocol.spec.d.ts +7 -0
  166. package/lib/protocol.spec.d.ts.map +1 -0
  167. package/lib/protocol.spec.js +127 -0
  168. package/lib/protocol.spec.js.map +1 -0
  169. package/lib/snapshot-url.d.ts +14 -0
  170. package/lib/snapshot-url.d.ts.map +1 -0
  171. package/lib/snapshot-url.js +26 -0
  172. package/lib/snapshot-url.js.map +1 -0
  173. package/lib/snapshot-url.spec.d.ts +7 -0
  174. package/lib/snapshot-url.spec.d.ts.map +1 -0
  175. package/lib/snapshot-url.spec.js +41 -0
  176. package/lib/snapshot-url.spec.js.map +1 -0
  177. package/lib/team-subscription-protocol.d.ts +92 -0
  178. package/lib/team-subscription-protocol.d.ts.map +1 -0
  179. package/lib/team-subscription-protocol.js +78 -0
  180. package/lib/team-subscription-protocol.js.map +1 -0
  181. package/lib/teams-projects-protocol.d.ts +136 -0
  182. package/lib/teams-projects-protocol.d.ts.map +1 -0
  183. package/lib/teams-projects-protocol.js +37 -0
  184. package/lib/teams-projects-protocol.js.map +1 -0
  185. package/lib/typings/globals.d.ts +4 -3
  186. package/lib/typings/globals.d.ts.map +1 -1
  187. package/lib/typings/globals.js +2 -2
  188. package/lib/usage.d.ts +73 -0
  189. package/lib/usage.d.ts.map +1 -0
  190. package/lib/usage.js +20 -0
  191. package/lib/usage.js.map +1 -0
  192. package/lib/util/analytics.d.ts +8 -0
  193. package/lib/util/analytics.d.ts.map +1 -0
  194. package/lib/util/analytics.js +88 -0
  195. package/lib/util/analytics.js.map +1 -0
  196. package/lib/util/async-iterator.d.ts +2 -2
  197. package/lib/util/async-iterator.d.ts.map +1 -1
  198. package/lib/util/async-iterator.js +60 -137
  199. package/lib/util/async-iterator.js.map +1 -1
  200. package/lib/util/cancelable.d.ts +2 -2
  201. package/lib/util/cancelable.js +20 -61
  202. package/lib/util/cancelable.js.map +1 -1
  203. package/lib/util/date-time.d.ts +2 -2
  204. package/lib/util/date-time.js +14 -13
  205. package/lib/util/date-time.js.map +1 -1
  206. package/lib/util/debug-app.d.ts +25 -0
  207. package/lib/util/debug-app.d.ts.map +1 -0
  208. package/lib/util/debug-app.js +100 -0
  209. package/lib/util/debug-app.js.map +1 -0
  210. package/lib/util/deep-partial.d.ts +2 -2
  211. package/lib/util/deep-partial.js +2 -2
  212. package/lib/util/deferred.d.ts +2 -2
  213. package/lib/util/deferred.js +13 -14
  214. package/lib/util/deferred.js.map +1 -1
  215. package/lib/util/disposable.d.ts +2 -2
  216. package/lib/util/disposable.d.ts.map +1 -1
  217. package/lib/util/disposable.js +28 -40
  218. package/lib/util/disposable.js.map +1 -1
  219. package/lib/util/event.d.ts +1 -1
  220. package/lib/util/event.d.ts.map +1 -1
  221. package/lib/util/event.js +64 -77
  222. package/lib/util/event.js.map +1 -1
  223. package/lib/util/garbage-collected-cache.d.ts +3 -2
  224. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  225. package/lib/util/garbage-collected-cache.js +35 -49
  226. package/lib/util/garbage-collected-cache.js.map +1 -1
  227. package/lib/util/generate-workspace-id.d.ts +9 -0
  228. package/lib/util/generate-workspace-id.d.ts.map +1 -0
  229. package/lib/util/generate-workspace-id.js +491 -0
  230. package/lib/util/generate-workspace-id.js.map +1 -0
  231. package/lib/util/generate-workspace-id.spec.d.ts +7 -0
  232. package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
  233. package/lib/util/generate-workspace-id.spec.js +98 -0
  234. package/lib/util/generate-workspace-id.spec.js.map +1 -0
  235. package/lib/util/gitpod-cookie.d.ts +20 -0
  236. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  237. package/lib/util/gitpod-cookie.js +41 -0
  238. package/lib/util/gitpod-cookie.js.map +1 -0
  239. package/lib/util/gitpod-host-url.d.ts +20 -7
  240. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  241. package/lib/util/gitpod-host-url.js +146 -85
  242. package/lib/util/gitpod-host-url.js.map +1 -1
  243. package/lib/util/gitpod-host-url.spec.d.ts +16 -0
  244. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -0
  245. package/lib/util/gitpod-host-url.spec.js +134 -0
  246. package/lib/util/gitpod-host-url.spec.js.map +1 -0
  247. package/lib/util/grpc.d.ts +35 -0
  248. package/lib/util/grpc.d.ts.map +1 -0
  249. package/lib/util/grpc.js +90 -0
  250. package/lib/util/grpc.js.map +1 -0
  251. package/lib/util/jaeger-client-types.d.ts +68 -0
  252. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  253. package/lib/util/jaeger-client-types.js +8 -0
  254. package/lib/util/jaeger-client-types.js.map +1 -0
  255. package/lib/util/logging.d.ts +58 -35
  256. package/lib/util/logging.d.ts.map +1 -1
  257. package/lib/util/logging.js +144 -129
  258. package/lib/util/logging.js.map +1 -1
  259. package/lib/util/logging.spec.d.ts +7 -0
  260. package/lib/util/logging.spec.d.ts.map +1 -0
  261. package/lib/util/logging.spec.js +52 -0
  262. package/lib/util/logging.spec.js.map +1 -0
  263. package/lib/util/make-link.d.ts +2 -2
  264. package/lib/util/make-link.js +8 -7
  265. package/lib/util/make-link.js.map +1 -1
  266. package/lib/util/nice-grpc.d.ts +9 -0
  267. package/lib/util/nice-grpc.d.ts.map +1 -0
  268. package/lib/util/nice-grpc.js +121 -0
  269. package/lib/util/nice-grpc.js.map +1 -0
  270. package/lib/util/parse-workspace-id.d.ts +15 -5
  271. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  272. package/lib/util/parse-workspace-id.js +39 -9
  273. package/lib/util/parse-workspace-id.js.map +1 -1
  274. package/lib/util/parse-workspace-id.spec.d.ts +10 -2
  275. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  276. package/lib/util/parse-workspace-id.spec.js +130 -49
  277. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  278. package/lib/util/queue.d.ts +2 -2
  279. package/lib/util/queue.js +19 -57
  280. package/lib/util/queue.js.map +1 -1
  281. package/lib/util/queue.spec.d.ts +2 -2
  282. package/lib/util/queue.spec.js +149 -288
  283. package/lib/util/queue.spec.js.map +1 -1
  284. package/lib/util/repeat.d.ts +15 -0
  285. package/lib/util/repeat.d.ts.map +1 -0
  286. package/lib/util/repeat.js +55 -0
  287. package/lib/util/repeat.js.map +1 -0
  288. package/lib/util/semaphore.d.ts +2 -2
  289. package/lib/util/semaphore.d.ts.map +1 -1
  290. package/lib/util/semaphore.js +18 -48
  291. package/lib/util/semaphore.js.map +1 -1
  292. package/lib/util/skip-if.d.ts +2 -2
  293. package/lib/util/skip-if.d.ts.map +1 -1
  294. package/lib/util/skip-if.js +9 -8
  295. package/lib/util/skip-if.js.map +1 -1
  296. package/lib/util/timeutil.d.ts +4 -2
  297. package/lib/util/timeutil.d.ts.map +1 -1
  298. package/lib/util/timeutil.js +43 -18
  299. package/lib/util/timeutil.js.map +1 -1
  300. package/lib/util/timeutil.spec.d.ts +4 -2
  301. package/lib/util/timeutil.spec.d.ts.map +1 -1
  302. package/lib/util/timeutil.spec.js +57 -25
  303. package/lib/util/timeutil.spec.js.map +1 -1
  304. package/lib/util/tracing.d.ts +54 -8
  305. package/lib/util/tracing.d.ts.map +1 -1
  306. package/lib/util/tracing.js +200 -66
  307. package/lib/util/tracing.js.map +1 -1
  308. package/lib/util/tracing.spec.d.ts +7 -0
  309. package/lib/util/tracing.spec.d.ts.map +1 -0
  310. package/lib/util/tracing.spec.js +121 -0
  311. package/lib/util/tracing.spec.js.map +1 -0
  312. package/lib/util/workspace-port-authentication.d.ts +9 -9
  313. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  314. package/lib/util/workspace-port-authentication.js +13 -14
  315. package/lib/util/workspace-port-authentication.js.map +1 -1
  316. package/lib/webhook-event.d.ts +44 -0
  317. package/lib/webhook-event.d.ts.map +1 -0
  318. package/lib/webhook-event.js +8 -0
  319. package/lib/webhook-event.js.map +1 -0
  320. package/lib/workspace-class.d.ts +14 -0
  321. package/lib/workspace-class.d.ts.map +1 -0
  322. package/lib/workspace-class.js +8 -0
  323. package/lib/workspace-class.js.map +1 -0
  324. package/lib/workspace-cluster.d.ts +75 -0
  325. package/lib/workspace-cluster.d.ts.map +1 -0
  326. package/lib/workspace-cluster.js +31 -0
  327. package/lib/workspace-cluster.js.map +1 -0
  328. package/lib/workspace-instance.d.ts +51 -8
  329. package/lib/workspace-instance.d.ts.map +1 -1
  330. package/lib/workspace-instance.js +2 -2
  331. package/lib/wsready.d.ts +8 -2
  332. package/lib/wsready.d.ts.map +1 -1
  333. package/lib/wsready.js +4 -3
  334. package/lib/wsready.js.map +1 -1
  335. package/package.json +42 -18
  336. package/pkg-yarn.lock +24 -10
  337. package/provenance-bundle.jsonl +2 -0
  338. package/src/accounting-protocol.ts +244 -0
  339. package/src/admin-protocol.ts +96 -21
  340. package/src/analytics.ts +52 -0
  341. package/src/attribution.ts +63 -0
  342. package/src/auth.ts +27 -0
  343. package/src/billing-mode.ts +84 -0
  344. package/src/blocked-repositories-protocol.ts +13 -0
  345. package/src/context-url.spec.ts +49 -0
  346. package/src/context-url.ts +107 -0
  347. package/src/encryption/container-module.ts +4 -5
  348. package/src/encryption/encryption-engine.spec.ts +11 -10
  349. package/src/encryption/encryption-engine.ts +22 -18
  350. package/src/encryption/encryption-service.ts +6 -7
  351. package/src/encryption/key-provider.ts +18 -21
  352. package/src/env.ts +3 -26
  353. package/src/experiments/always-default.ts +24 -0
  354. package/src/experiments/configcat-server.ts +42 -0
  355. package/src/experiments/configcat.ts +56 -0
  356. package/src/experiments/types.ts +34 -0
  357. package/src/frontend-dashboard-service.ts +125 -0
  358. package/src/gitpod-file-parser.spec.ts +57 -63
  359. package/src/gitpod-file-parser.ts +18 -19
  360. package/src/gitpod-service.ts +534 -99
  361. package/src/headless-workspace-log.ts +14 -16
  362. package/src/ide-frontend-service.ts +28 -0
  363. package/src/ide-protocol.ts +147 -0
  364. package/src/index.ts +18 -12
  365. package/src/installation-admin-protocol.ts +45 -0
  366. package/src/license-protocol.ts +14 -8
  367. package/src/messaging/browser/connection.ts +202 -26
  368. package/src/messaging/browser/window-connection.ts +45 -29
  369. package/src/messaging/client-call-metrics.ts +94 -0
  370. package/src/messaging/error.ts +47 -10
  371. package/src/messaging/handler.ts +13 -1
  372. package/src/messaging/node/connection.ts +23 -70
  373. package/src/messaging/proxy-factory.ts +35 -34
  374. package/src/oss-allowlist.ts +15 -0
  375. package/src/payment-protocol.ts +20 -0
  376. package/src/permission.ts +53 -40
  377. package/src/plans.ts +683 -0
  378. package/src/protocol.spec.ts +97 -0
  379. package/src/protocol.ts +706 -299
  380. package/src/snapshot-url.spec.ts +27 -0
  381. package/src/snapshot-url.ts +27 -0
  382. package/src/team-subscription-protocol.ts +150 -0
  383. package/src/teams-projects-protocol.ts +177 -0
  384. package/src/typings/globals.ts +7 -5
  385. package/src/usage.ts +85 -0
  386. package/src/util/analytics.ts +109 -0
  387. package/src/util/async-iterator.ts +6 -7
  388. package/src/util/cancelable.ts +5 -5
  389. package/src/util/date-time.ts +10 -10
  390. package/src/util/debug-app.ts +81 -0
  391. package/src/util/deep-partial.ts +2 -2
  392. package/src/util/deferred.ts +8 -8
  393. package/src/util/disposable.ts +3 -6
  394. package/src/util/event.ts +9 -11
  395. package/src/util/garbage-collected-cache.ts +18 -10
  396. package/src/util/generate-workspace-id.spec.ts +58 -0
  397. package/src/util/generate-workspace-id.ts +481 -0
  398. package/src/util/gitpod-cookie.ts +38 -0
  399. package/src/util/gitpod-host-url.spec.ts +76 -0
  400. package/src/util/gitpod-host-url.ts +121 -38
  401. package/src/util/grpc.ts +107 -0
  402. package/src/util/jaeger-client-types.ts +102 -0
  403. package/src/util/logging.spec.ts +23 -0
  404. package/src/util/logging.ts +163 -73
  405. package/src/util/make-link.ts +8 -9
  406. package/src/util/nice-grpc.ts +96 -0
  407. package/src/util/parse-workspace-id.spec.ts +62 -12
  408. package/src/util/parse-workspace-id.ts +40 -10
  409. package/src/util/queue.spec.ts +30 -28
  410. package/src/util/queue.ts +2 -2
  411. package/src/util/repeat.ts +45 -0
  412. package/src/util/semaphore.ts +8 -10
  413. package/src/util/skip-if.ts +12 -9
  414. package/src/util/timeutil.spec.ts +42 -16
  415. package/src/util/timeutil.ts +33 -17
  416. package/src/util/tracing.spec.ts +88 -0
  417. package/src/util/tracing.ts +202 -33
  418. package/src/util/workspace-port-authentication.ts +12 -15
  419. package/src/webhook-event.ts +55 -0
  420. package/src/workspace-class.ts +14 -0
  421. package/src/workspace-cluster.ts +110 -0
  422. package/src/workspace-instance.ts +119 -35
  423. package/src/wsready.ts +11 -4
  424. package/data/builtin-theia-plugins.json +0 -362
  425. package/lib/email-protocol.d.ts +0 -49
  426. package/lib/email-protocol.d.ts.map +0 -1
  427. package/lib/email-protocol.js +0 -27
  428. package/lib/email-protocol.js.map +0 -1
  429. package/lib/messaging/connection-error-handler.d.ts +0 -27
  430. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  431. package/lib/messaging/connection-error-handler.js +0 -45
  432. package/lib/messaging/connection-error-handler.js.map +0 -1
  433. package/lib/theia-plugins.d.ts +0 -11
  434. package/lib/theia-plugins.d.ts.map +0 -1
  435. package/lib/theia-plugins.js +0 -8
  436. package/lib/theia-plugins.js.map +0 -1
  437. package/lib/util/repeater.d.ts +0 -22
  438. package/lib/util/repeater.d.ts.map +0 -1
  439. package/lib/util/repeater.js +0 -117
  440. package/lib/util/repeater.js.map +0 -1
  441. package/lib/util/safe-promise.d.ts +0 -11
  442. package/lib/util/safe-promise.d.ts.map +0 -1
  443. package/lib/util/safe-promise.js +0 -33
  444. package/lib/util/safe-promise.js.map +0 -1
  445. package/lib/util/without.d.ts +0 -7
  446. package/lib/util/without.d.ts.map +0 -1
  447. package/lib/util/without.js +0 -8
  448. package/lib/util/without.js.map +0 -1
  449. package/src/email-protocol.ts +0 -67
  450. package/src/messaging/connection-error-handler.ts +0 -62
  451. package/src/theia-plugins.ts +0 -11
  452. package/src/util/jaeger-client.d.ts +0 -105
  453. package/src/util/repeater.ts +0 -49
  454. package/src/util/safe-promise.ts +0 -26
  455. package/src/util/without.ts +0 -8
@@ -1,25 +1,15 @@
1
1
  {
2
- "$id": "https://gitpod.io/gitpod.schema.json",
2
+ "$id": "https://gitpod.io/schemas/gitpod-schema.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Gitpod Config",
5
5
  "type": "object",
6
6
  "properties": {
7
- "ide": {
8
- "type": "string",
9
- "enum": [
10
- "theia",
11
- "code"
12
- ],
13
- "default": "theia"
14
- },
15
7
  "ports": {
16
8
  "type": "array",
17
9
  "description": "List of exposed ports.",
18
10
  "items": {
19
11
  "type": "object",
20
- "required": [
21
- "port"
22
- ],
12
+ "required": ["port"],
23
13
  "properties": {
24
14
  "port": {
25
15
  "type": ["number", "string"],
@@ -28,36 +18,28 @@
28
18
  },
29
19
  "onOpen": {
30
20
  "type": "string",
31
- "enum": [
32
- "open-browser",
33
- "open-preview",
34
- "notify",
35
- "ignore"
36
- ],
21
+ "enum": ["open-browser", "open-preview", "notify", "ignore"],
37
22
  "description": "What to do when a service on this port was detected. 'notify' (default) will show a notification asking the user what to do. 'open-browser' will open a new browser tab. 'open-preview' will open in the preview on the right of the IDE. 'ignore' will do nothing."
38
23
  },
39
24
  "visibility": {
40
25
  "type": "string",
41
- "enum": [
42
- "private",
43
- "public"
44
- ],
45
- "description": "Whether the port visibility should be private or public. 'public' (default) will allow everyone with the port URL to access the port. 'private' will only allow users with workspace access to access the port."
26
+ "enum": ["private", "public"],
27
+ "default": "private",
28
+ "description": "Whether the port visibility should be private or public. 'private' (default) will only allow users with workspace access to access the port. 'public' will allow everyone with the port URL to access the port."
46
29
  },
47
30
  "name": {
48
31
  "type": "string",
49
- "deprecationMessage": "The 'name' property is deprecated.",
50
- "description": "Port name (deprecated)."
32
+ "description": "Port name."
51
33
  },
52
34
  "protocol": {
53
35
  "type": "string",
54
- "enum": [
55
- "http",
56
- "TCP",
57
- "UDP"
58
- ],
36
+ "enum": ["http", "TCP", "UDP"],
59
37
  "deprecationMessage": "The 'protocol' property is deprecated.",
60
38
  "description": "The protocol to be used. (deprecated)"
39
+ },
40
+ "description": {
41
+ "type": "string",
42
+ "description": "A description to identify what is this port used for."
61
43
  }
62
44
  },
63
45
  "additionalProperties": false
@@ -83,7 +65,8 @@
83
65
  },
84
66
  "prebuild": {
85
67
  "type": "string",
86
- "description": "A shell command to run after `before`. This command is executed only on during workspace prebuilds. This command is expected to terminate. If it fails, the workspace build fails."
68
+ "description": "A shell command to run after `before`. This command is executed only on during workspace prebuilds. This command is expected to terminate. If it fails, the workspace build fails.",
69
+ "deprecationMessage": "Deprecated. Please use `init` task instead. See https://www.gitpod.io/docs/config-start-tasks."
87
70
  },
88
71
  "command": {
89
72
  "type": "string",
@@ -95,24 +78,12 @@
95
78
  },
96
79
  "openIn": {
97
80
  "type": "string",
98
- "enum": [
99
- "bottom",
100
- "main",
101
- "left",
102
- "right"
103
- ],
81
+ "enum": ["bottom", "main", "left", "right"],
104
82
  "description": "The panel/area where to open the terminal. Default is 'bottom' panel."
105
83
  },
106
84
  "openMode": {
107
85
  "type": "string",
108
- "enum": [
109
- "split-top",
110
- "split-left",
111
- "split-right",
112
- "split-bottom",
113
- "tab-before",
114
- "tab-after"
115
- ],
86
+ "enum": ["split-left", "split-right", "tab-before", "tab-after"],
116
87
  "description": "The opening mode. Default is 'tab-after'."
117
88
  }
118
89
  },
@@ -120,14 +91,10 @@
120
91
  }
121
92
  },
122
93
  "image": {
123
- "type": [
124
- "object",
125
- "string"
126
- ],
127
- "description": "List of tasks to run on start.",
128
- "required": [
129
- "file"
130
- ],
94
+ "type": ["object", "string"],
95
+ "description": "The Docker image to run your workspace in.",
96
+ "default": "gitpod/workspace-full",
97
+ "required": ["file"],
131
98
  "properties": {
132
99
  "file": {
133
100
  "type": "string",
@@ -140,23 +107,39 @@
140
107
  },
141
108
  "additionalProperties": false
142
109
  },
110
+ "additionalRepositories": {
111
+ "type": "array",
112
+ "description": "List of additional repositories that are part of this project.",
113
+ "items": {
114
+ "type": "object",
115
+ "required": ["url"],
116
+ "properties": {
117
+ "url": {
118
+ "type": ["string"],
119
+ "description": "The url of the git repository to clone. Supports any context URLs."
120
+ },
121
+ "checkoutLocation": {
122
+ "type": "string",
123
+ "description": "Path to where the repository should be checked out relative to `/workspace`. Defaults to the simple repository name."
124
+ }
125
+ },
126
+ "additionalProperties": false
127
+ }
128
+ },
129
+ "mainConfiguration": {
130
+ "type": "string",
131
+ "description": "The main repository, containing the dev environment configuration."
132
+ },
143
133
  "checkoutLocation": {
144
134
  "type": "string",
145
- "description": "Path to where the repository should be checked out."
135
+ "description": "Path to where the repository should be checked out relative to `/workspace`. Defaults to the simple repository name."
146
136
  },
147
137
  "workspaceLocation": {
148
138
  "type": "string",
149
- "description": "Path to where the IDE's workspace should be opened."
150
- },
151
- "privileged": {
152
- "type": "boolean",
153
- "deprecationMessage": "The 'privileged' property only works for privileged users.",
154
- "description": "Whether the workspace is started in privileged mode."
139
+ "description": "Path to where the IDE's workspace should be opened. Supports vscode's `*.code-workspace` files."
155
140
  },
156
141
  "gitConfig": {
157
- "type": [
158
- "object"
159
- ],
142
+ "type": ["object"],
160
143
  "description": "Git config values should be provided in pairs. E.g. `core.autocrlf: input`. See https://git-scm.com/docs/git-config#_values.",
161
144
  "additionalProperties": {
162
145
  "type": "string"
@@ -167,15 +150,17 @@
167
150
  "description": "Configures Gitpod's GitHub app",
168
151
  "properties": {
169
152
  "prebuilds": {
170
- "type": [
171
- "boolean",
172
- "object"
173
- ],
153
+ "type": ["boolean", "object"],
174
154
  "description": "Set to true to enable workspace prebuilds, false to disable them. Defaults to true.",
175
155
  "properties": {
176
156
  "master": {
177
157
  "type": "boolean",
178
- "description": "Enable prebuilds for the default branch (typically master). Defaults to true."
158
+ "description": "Enable prebuilds for the default branch (typically master). Defaults to true.",
159
+ "deprecationMessage": "Deprecated. Please use `defaultBranch` instead. See https://www.gitpod.io/docs/configure/projects/prebuilds#github-specific-configuration."
160
+ },
161
+ "defaultBranch": {
162
+ "type": "boolean",
163
+ "description": "Enable prebuilds for the default branch (typically main). Defaults to true."
179
164
  },
180
165
  "branches": {
181
166
  "type": "boolean",
@@ -193,11 +178,13 @@
193
178
  "type": "boolean",
194
179
  "description": "Add a Review in Gitpod badge to pull requests. Defaults to true."
195
180
  },
181
+ "addCheck": {
182
+ "type": ["boolean", "string"],
183
+ "enum": [true, false, "prevent-merge-on-error"],
184
+ "description": "Add a commit check to pull requests. Set to 'fail-on-error' if you want broken prebuilds to block merging. Defaults to true."
185
+ },
196
186
  "addLabel": {
197
- "type": [
198
- "boolean",
199
- "string"
200
- ],
187
+ "type": ["boolean", "string"],
201
188
  "description": "Add a label to a PR when it's prebuilt. Set to true to use the default label (prebuilt-in-gitpod) or set to a string to use a different label name. This is a beta feature and may be unreliable. Defaults to false."
202
189
  }
203
190
  }
@@ -218,7 +205,109 @@
218
205
  }
219
206
  }
220
207
  }
208
+ },
209
+ "jetbrains": {
210
+ "type": "object",
211
+ "description": "Configure JetBrains integration",
212
+ "deprecationMessage": "The 'jetbrains' property is experimental.",
213
+ "additionalProperties": false,
214
+ "properties": {
215
+ "plugins": {
216
+ "type": "array",
217
+ "description": "List of plugins which should be installed for all JetBrains product for users of this workspace. From the JetBrains Marketplace page, find a page of the required plugin, select 'Versions' tab, click any version to copy pluginId (short name such as org.rust.lang) of the plugin you want to install.",
218
+ "items": {
219
+ "type": "string"
220
+ }
221
+ },
222
+ "intellij": {
223
+ "$ref": "#/definitions/jetbrainsProduct",
224
+ "description": "Configure IntelliJ integration"
225
+ },
226
+ "goland": {
227
+ "$ref": "#/definitions/jetbrainsProduct",
228
+ "description": "Configure GoLand integration"
229
+ },
230
+ "pycharm": {
231
+ "$ref": "#/definitions/jetbrainsProduct",
232
+ "description": "Configure PyCharm integration"
233
+ },
234
+ "phpstorm": {
235
+ "$ref": "#/definitions/jetbrainsProduct",
236
+ "description": "Configure PhpStorm integration"
237
+ },
238
+ "rubymine": {
239
+ "$ref": "#/definitions/jetbrainsProduct",
240
+ "description": "Configure RubyMine integration"
241
+ },
242
+ "webstorm": {
243
+ "$ref": "#/definitions/jetbrainsProduct",
244
+ "description": "Configure WebStorm integration"
245
+ },
246
+ "rider": {
247
+ "$ref": "#/definitions/jetbrainsProduct",
248
+ "description": "Configure Rider integration"
249
+ },
250
+ "clion": {
251
+ "$ref": "#/definitions/jetbrainsProduct",
252
+ "description": "Configure CLion integration"
253
+ }
254
+ }
255
+ },
256
+ "experimentalNetwork": {
257
+ "type": "boolean",
258
+ "deprecationMessage": "The 'experimentalNetwork' property is deprecated.",
259
+ "description": "Experimental network configuration in workspaces (deprecated). Enabled by default"
260
+ },
261
+ "coreDump": {
262
+ "type": "object",
263
+ "description": "Configure the default action of certain signals is to cause a process to terminate and produce a core dump file, a file containing an image of the process's memory at the time of termination. Disabled by default.",
264
+ "deprecationMessage": "The 'coreDump' property is experimental.",
265
+ "additionalProperties": false,
266
+ "properties": {
267
+ "enabled": {
268
+ "type": "boolean"
269
+ },
270
+ "softLimit": {
271
+ "type": "number",
272
+ "description": "upper limit on the size of the core dump file that will be produced if it receives a core dump signal"
273
+ },
274
+ "hardLimit": {
275
+ "type": "number",
276
+ "description": "the hard limit acts as a ceiling for the soft limit. For more details please check https://man7.org/linux/man-pages/man2/getrlimit.2.html"
277
+ }
278
+ }
221
279
  }
222
280
  },
223
- "additionalProperties": false
224
- }
281
+ "additionalProperties": false,
282
+ "definitions": {
283
+ "jetbrainsProduct": {
284
+ "type": "object",
285
+ "additionalProperties": false,
286
+ "properties": {
287
+ "plugins": {
288
+ "type": "array",
289
+ "description": "List of plugins which should be installed for users of this workspace. From the JetBrains Marketplace page, find a page of the required plugin, select 'Versions' tab, click any version to copy pluginId (short name such as org.rust.lang) of the plugin you want to install.",
290
+ "items": {
291
+ "type": "string"
292
+ }
293
+ },
294
+ "prebuilds": {
295
+ "type": "object",
296
+ "description": "Enable warming up of JetBrains backend in prebuilds.",
297
+ "additionalProperties": false,
298
+ "properties": {
299
+ "version": {
300
+ "type": "string",
301
+ "enum": ["stable", "latest", "both"],
302
+ "description": "Whether only stable, latest or both versions should be warmed up. Default is stable only."
303
+ }
304
+ }
305
+ },
306
+ "vmoptions": {
307
+ "type": "string",
308
+ "description": "Configure JVM options, for instance '-Xmx=4096m'."
309
+ }
310
+ }
311
+ }
312
+ }
313
+ }
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License.AGPL.txt in the project root for license information.
5
+ */
6
+ import { User } from "./protocol";
7
+ export interface AccountEntry {
8
+ uid: string;
9
+ userId: string;
10
+ /** [hours] */
11
+ amount: number;
12
+ /**
13
+ * credit: start of validity,
14
+ * session: end of (split-) session
15
+ */
16
+ date: string;
17
+ /**
18
+ * debits (session, expiry, loss): relation to credit
19
+ */
20
+ creditId?: string;
21
+ /**
22
+ * credit: end of validity
23
+ */
24
+ expiryDate?: string;
25
+ kind: AccountEntryKind;
26
+ /**
27
+ * credit: amount - accounted debits
28
+ * [hours]
29
+ */
30
+ remainingAmount?: number;
31
+ description?: object;
32
+ }
33
+ export declare namespace AccountEntry {
34
+ function create<T extends AccountEntry>(entry: Omit<T, "uid">): T;
35
+ }
36
+ export declare type DebitAccountEntryKind = "session" | "expiry" | "loss";
37
+ export declare type AccountEntryKind = "credit" | DebitAccountEntryKind | "carry" | "open";
38
+ export interface Credit extends AccountEntry {
39
+ kind: "credit";
40
+ expiryDate: string;
41
+ }
42
+ export declare type Debit = LossDebit | ExpiryDebit | SessionDebit;
43
+ export interface LossDebit extends AccountEntry {
44
+ kind: "loss";
45
+ }
46
+ export interface ExpiryDebit extends AccountEntry {
47
+ kind: "expiry";
48
+ creditId: undefined;
49
+ }
50
+ export interface SessionDebit extends AccountEntry {
51
+ kind: DebitAccountEntryKind;
52
+ creditId: string;
53
+ }
54
+ export declare type AccountEntryDescription = SessionDescription | CreditDescription;
55
+ export interface CreditDescription {
56
+ subscriptionId: string;
57
+ planId: string;
58
+ }
59
+ export declare namespace CreditDescription {
60
+ function is(obj: any): obj is CreditDescription;
61
+ }
62
+ export interface SessionDescription {
63
+ contextTitle: string;
64
+ contextUrl: string;
65
+ workspaceId: string;
66
+ workspaceInstanceId: string;
67
+ }
68
+ export declare namespace SessionDescription {
69
+ function is(obj: any): obj is SessionDescription;
70
+ }
71
+ /**
72
+ * - The earliest subscription may start with User.creationDate
73
+ * - There may be multiple Gitpod subscriptions for a user at any given time
74
+ * - The dates form an interval of the form: [startDate, endDate)
75
+ * - Subscriptions that directly map to a Chargebee plan have their paymentReference set and MAY carry additional paymentData (UserPaidSubscription)
76
+ * - Subscriptions that are assigned to a user through a Team Subscription carry a teamSubscriptionSlotId (AssignedTeamSubscription)
77
+ */
78
+ export interface Subscription {
79
+ uid: string;
80
+ userId: string;
81
+ startDate: string;
82
+ /** When the subscription will end (must be >= cancellationDate!) */
83
+ endDate?: string;
84
+ /** When the subscription was cancelled */
85
+ cancellationDate?: string;
86
+ /** Number of granted hours */
87
+ amount: number;
88
+ /** Number of granted hours for the first month: If this is set, use this value for the first month */
89
+ firstMonthAmount?: number;
90
+ planId?: string;
91
+ paymentReference?: string;
92
+ paymentData?: PaymentData;
93
+ teamSubscriptionSlotId?: string;
94
+ teamMembershipId?: string;
95
+ /** marks the subscription as deleted */
96
+ deleted?: boolean;
97
+ }
98
+ export interface SubscriptionAndUser extends Subscription {
99
+ user: User;
100
+ }
101
+ export interface PaymentData {
102
+ /** Marks the date as of which the _switch_ is effective. */
103
+ downgradeDate?: string;
104
+ /** Determines the new plan the dowgrade is targeted against (optional for backwards compatibility) */
105
+ newPlan?: string;
106
+ }
107
+ export interface UserPaidSubscription extends Subscription {
108
+ paymentReference: string;
109
+ paymentData?: PaymentData;
110
+ }
111
+ export declare namespace UserPaidSubscription {
112
+ function is(data: any): data is UserPaidSubscription;
113
+ }
114
+ export interface AssignedTeamSubscription extends Subscription {
115
+ teamSubscriptionSlotId: string;
116
+ }
117
+ export declare namespace AssignedTeamSubscription {
118
+ function is(data: any): data is AssignedTeamSubscription;
119
+ }
120
+ export interface AssignedTeamSubscription2 extends Subscription {
121
+ teamMembershipId: string;
122
+ }
123
+ export declare namespace AssignedTeamSubscription2 {
124
+ function is(data: any): data is AssignedTeamSubscription2;
125
+ }
126
+ export declare namespace Subscription {
127
+ function create(newSubscription: Omit<Subscription, "uid">): Subscription;
128
+ function cancelSubscription(s: Subscription, cancellationDate: string, endDate?: string): void;
129
+ function isSame(s1: Subscription | undefined, s2: Subscription | undefined): boolean;
130
+ function isActive(s: Subscription, date: string): boolean;
131
+ function isCancelled(s: Subscription, date: string): boolean;
132
+ function isDowngraded(s: Subscription): string | undefined;
133
+ function calculateCurrentPeriod(startDate: string, now: Date): {
134
+ startDate: string;
135
+ endDate: string;
136
+ };
137
+ }
138
+ export declare type MaybeSubscription = Subscription | undefined;
139
+ export interface Period {
140
+ startDate: string;
141
+ endDate: string;
142
+ }
143
+ export declare type MaybePeriod = Period | undefined;
144
+ export declare type AccountEntryFixedPeriod = Omit<AccountEntry, "uid"> & {
145
+ expiryDate: string;
146
+ };
147
+ export interface AccountStatement extends Period {
148
+ userId: string;
149
+ /**
150
+ * The subscriptions that have not been cancelled yet at the end of the period
151
+ */
152
+ subscriptions: Subscription[];
153
+ credits: Credit[];
154
+ debits: Debit[];
155
+ /** Remaining valid hours (accumulated from credits) */
156
+ remainingHours: RemainingHours;
157
+ }
158
+ export declare type RemainingHours = number | "unlimited";
159
+ export interface CreditAlert {
160
+ userId: string;
161
+ remainingUsageHours: number;
162
+ }
163
+ //# sourceMappingURL=accounting-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounting-protocol.d.ts","sourceRoot":"","sources":["../src/accounting-protocol.ts"],"names":[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AsB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI;;;MAOlE;CACJ;AAED,oBAAY,iBAAiB,GAAG,YAAY,GAAG,SAAS,CAAC;AAEzD,MAAM,WAAW,MAAM;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,oBAAY,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C,oBAAY,uBAAuB,GAAG,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AACzF,MAAM,WAAW,gBAAiB,SAAQ,MAAM;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,uDAAuD;IACvD,cAAc,EAAE,cAAc,CAAC;CAClC;AACD,oBAAY,cAAc,GAAG,MAAM,GAAG,WAAW,CAAC;AAElD,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;CAC/B"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
4
+ * Licensed under the GNU Affero General Public License (AGPL).
5
+ * See License.AGPL.txt in the project root for license information.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Subscription = exports.AssignedTeamSubscription2 = exports.AssignedTeamSubscription = exports.UserPaidSubscription = exports.SessionDescription = exports.CreditDescription = exports.AccountEntry = void 0;
9
+ const uuid_1 = require("uuid");
10
+ const timeutil_1 = require("./util/timeutil");
11
+ var AccountEntry;
12
+ (function (AccountEntry) {
13
+ function create(entry) {
14
+ const result = entry;
15
+ result.uid = (0, uuid_1.v4)();
16
+ return result;
17
+ }
18
+ AccountEntry.create = create;
19
+ })(AccountEntry = exports.AccountEntry || (exports.AccountEntry = {}));
20
+ var CreditDescription;
21
+ (function (CreditDescription) {
22
+ function is(obj) {
23
+ return !!obj && obj.hasOwnProperty("subscriptionId") && obj.hasOwnProperty("planId");
24
+ }
25
+ CreditDescription.is = is;
26
+ })(CreditDescription = exports.CreditDescription || (exports.CreditDescription = {}));
27
+ var SessionDescription;
28
+ (function (SessionDescription) {
29
+ function is(obj) {
30
+ return (!!obj &&
31
+ obj.hasOwnProperty("contextTitle") &&
32
+ obj.hasOwnProperty("contextUrl") &&
33
+ obj.hasOwnProperty("workspaceId") &&
34
+ obj.hasOwnProperty("workspaceInstanceId"));
35
+ }
36
+ SessionDescription.is = is;
37
+ })(SessionDescription = exports.SessionDescription || (exports.SessionDescription = {}));
38
+ var UserPaidSubscription;
39
+ (function (UserPaidSubscription) {
40
+ function is(data) {
41
+ return !!data && data.hasOwnProperty("paymentReference");
42
+ }
43
+ UserPaidSubscription.is = is;
44
+ })(UserPaidSubscription = exports.UserPaidSubscription || (exports.UserPaidSubscription = {}));
45
+ var AssignedTeamSubscription;
46
+ (function (AssignedTeamSubscription) {
47
+ function is(data) {
48
+ return !!data && data.hasOwnProperty("teamSubscriptionSlotId");
49
+ }
50
+ AssignedTeamSubscription.is = is;
51
+ })(AssignedTeamSubscription = exports.AssignedTeamSubscription || (exports.AssignedTeamSubscription = {}));
52
+ var AssignedTeamSubscription2;
53
+ (function (AssignedTeamSubscription2) {
54
+ function is(data) {
55
+ return typeof data === "object" && data.hasOwnProperty("teamMembershipId");
56
+ }
57
+ AssignedTeamSubscription2.is = is;
58
+ })(AssignedTeamSubscription2 = exports.AssignedTeamSubscription2 || (exports.AssignedTeamSubscription2 = {}));
59
+ var Subscription;
60
+ (function (Subscription) {
61
+ function create(newSubscription) {
62
+ const subscription = newSubscription;
63
+ subscription.uid = (0, uuid_1.v4)();
64
+ return subscription;
65
+ }
66
+ Subscription.create = create;
67
+ function cancelSubscription(s, cancellationDate, endDate) {
68
+ s.endDate = endDate || cancellationDate;
69
+ s.cancellationDate = cancellationDate;
70
+ }
71
+ Subscription.cancelSubscription = cancelSubscription;
72
+ function isSame(s1, s2) {
73
+ return (!!s1 &&
74
+ !!s2 &&
75
+ s1.userId === s2.userId &&
76
+ s1.planId === s2.planId &&
77
+ s1.startDate === s2.startDate &&
78
+ s1.endDate === s2.endDate &&
79
+ s1.amount === s2.amount &&
80
+ s1.cancellationDate === s2.cancellationDate &&
81
+ s1.deleted === s2.deleted &&
82
+ ((s1.paymentData === undefined && s2.paymentData === undefined) ||
83
+ (!!s1.paymentData &&
84
+ !!s2.paymentData &&
85
+ s1.paymentData.downgradeDate === s2.paymentData.downgradeDate &&
86
+ s1.paymentData.newPlan === s2.paymentData.newPlan)));
87
+ }
88
+ Subscription.isSame = isSame;
89
+ function isActive(s, date) {
90
+ return s.startDate <= date && (s.endDate === undefined || date < s.endDate);
91
+ }
92
+ Subscription.isActive = isActive;
93
+ function isCancelled(s, date) {
94
+ return (!!s.cancellationDate && s.cancellationDate < date) || (!!s.endDate && s.endDate < date); // This edge case is meant to handle bad data: If for whatever reason cancellationDate has not been set: treat endDate as such
95
+ }
96
+ Subscription.isCancelled = isCancelled;
97
+ function isDowngraded(s) {
98
+ return s.paymentData && s.paymentData.downgradeDate;
99
+ }
100
+ Subscription.isDowngraded = isDowngraded;
101
+ function calculateCurrentPeriod(startDate, now) {
102
+ let nextStartDate = startDate;
103
+ do {
104
+ startDate = nextStartDate;
105
+ nextStartDate = (0, timeutil_1.oneMonthLater)(startDate, new Date(startDate).getDate());
106
+ } while (nextStartDate < now.toISOString());
107
+ return { startDate, endDate: nextStartDate };
108
+ }
109
+ Subscription.calculateCurrentPeriod = calculateCurrentPeriod;
110
+ })(Subscription = exports.Subscription || (exports.Subscription = {}));
111
+ //# sourceMappingURL=accounting-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounting-protocol.js","sourceRoot":"","sources":["../src/accounting-protocol.ts"],"names":[],"mappings":";A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