@highstate/designer 0.4.5 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1046) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{B_hR0Ok_.js → CDvc066L.js} +1 -1
  3. package/.output/public/_nuxt/{BA0u-n1q.js → D0Jq3pX9.js} +81 -81
  4. package/.output/public/_nuxt/{DE7L338O.js → DOPM99N_.js} +1 -1
  5. package/.output/public/_nuxt/{Cj8SV8PB.js → Dx2bEYXH.js} +1 -1
  6. package/.output/public/_nuxt/builds/latest.json +1 -1
  7. package/.output/public/_nuxt/builds/meta/cb8636dd-e396-496a-9bd3-892327ee4ea5.json +1 -0
  8. package/.output/public/_nuxt/entry.VNeMltv3.css +5 -0
  9. package/.output/server/index.mjs +137 -3642
  10. package/.output/server/index.mjs.map +1 -1
  11. package/.output/server/package.json +1 -1
  12. package/package.json +14 -12
  13. package/.output/public/_nuxt/builds/meta/befe985c-c66f-4500-9488-46464c80fbfc.json +0 -1
  14. package/.output/public/_nuxt/entry.7p8V-3Ph.css +0 -5
  15. package/.output/server/node_modules/.nitro/get-stream@5.2.0/buffer-stream.js +0 -52
  16. package/.output/server/node_modules/.nitro/get-stream@5.2.0/index.js +0 -60
  17. package/.output/server/node_modules/.nitro/get-stream@5.2.0/package.json +0 -50
  18. package/.output/server/node_modules/.nitro/get-stream@6.0.1/buffer-stream.js +0 -52
  19. package/.output/server/node_modules/.nitro/get-stream@6.0.1/index.js +0 -61
  20. package/.output/server/node_modules/.nitro/get-stream@6.0.1/package.json +0 -47
  21. package/.output/server/node_modules/.nitro/mimic-response@1.0.1/index.js +0 -32
  22. package/.output/server/node_modules/.nitro/mimic-response@1.0.1/package.json +0 -37
  23. package/.output/server/node_modules/.nitro/mimic-response@3.1.0/index.js +0 -77
  24. package/.output/server/node_modules/.nitro/mimic-response@3.1.0/package.json +0 -42
  25. package/.output/server/node_modules/.nitro/pathe@1.1.2/dist/index.mjs +0 -1
  26. package/.output/server/node_modules/.nitro/pathe@1.1.2/dist/shared/pathe.ff20891b.mjs +0 -221
  27. package/.output/server/node_modules/.nitro/pathe@1.1.2/package.json +0 -48
  28. package/.output/server/node_modules/.nitro/pathe@2.0.3/dist/index.mjs +0 -19
  29. package/.output/server/node_modules/.nitro/pathe@2.0.3/dist/shared/pathe.M-eThtNZ.mjs +0 -249
  30. package/.output/server/node_modules/.nitro/pathe@2.0.3/package.json +0 -61
  31. package/.output/server/node_modules/@grpc/grpc-js/build/src/admin.js +0 -30
  32. package/.output/server/node_modules/@grpc/grpc-js/build/src/backoff-timeout.js +0 -174
  33. package/.output/server/node_modules/@grpc/grpc-js/build/src/call-credentials.js +0 -153
  34. package/.output/server/node_modules/@grpc/grpc-js/build/src/call-interface.js +0 -84
  35. package/.output/server/node_modules/@grpc/grpc-js/build/src/call-number.js +0 -24
  36. package/.output/server/node_modules/@grpc/grpc-js/build/src/call.js +0 -136
  37. package/.output/server/node_modules/@grpc/grpc-js/build/src/certificate-provider.js +0 -134
  38. package/.output/server/node_modules/@grpc/grpc-js/build/src/channel-credentials.js +0 -272
  39. package/.output/server/node_modules/@grpc/grpc-js/build/src/channel-options.js +0 -71
  40. package/.output/server/node_modules/@grpc/grpc-js/build/src/channel.js +0 -68
  41. package/.output/server/node_modules/@grpc/grpc-js/build/src/channelz.js +0 -584
  42. package/.output/server/node_modules/@grpc/grpc-js/build/src/client-interceptors.js +0 -428
  43. package/.output/server/node_modules/@grpc/grpc-js/build/src/client.js +0 -433
  44. package/.output/server/node_modules/@grpc/grpc-js/build/src/compression-algorithms.js +0 -26
  45. package/.output/server/node_modules/@grpc/grpc-js/build/src/compression-filter.js +0 -295
  46. package/.output/server/node_modules/@grpc/grpc-js/build/src/connectivity-state.js +0 -28
  47. package/.output/server/node_modules/@grpc/grpc-js/build/src/constants.js +0 -64
  48. package/.output/server/node_modules/@grpc/grpc-js/build/src/control-plane-status.js +0 -42
  49. package/.output/server/node_modules/@grpc/grpc-js/build/src/deadline.js +0 -108
  50. package/.output/server/node_modules/@grpc/grpc-js/build/src/duration.js +0 -46
  51. package/.output/server/node_modules/@grpc/grpc-js/build/src/environment.js +0 -22
  52. package/.output/server/node_modules/@grpc/grpc-js/build/src/error.js +0 -40
  53. package/.output/server/node_modules/@grpc/grpc-js/build/src/experimental.js +0 -52
  54. package/.output/server/node_modules/@grpc/grpc-js/build/src/filter-stack.js +0 -82
  55. package/.output/server/node_modules/@grpc/grpc-js/build/src/filter.js +0 -38
  56. package/.output/server/node_modules/@grpc/grpc-js/build/src/http_proxy.js +0 -265
  57. package/.output/server/node_modules/@grpc/grpc-js/build/src/index.js +0 -144
  58. package/.output/server/node_modules/@grpc/grpc-js/build/src/internal-channel.js +0 -602
  59. package/.output/server/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.js +0 -153
  60. package/.output/server/node_modules/@grpc/grpc-js/build/src/load-balancer-outlier-detection.js +0 -567
  61. package/.output/server/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.js +0 -482
  62. package/.output/server/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.js +0 -182
  63. package/.output/server/node_modules/@grpc/grpc-js/build/src/load-balancer.js +0 -116
  64. package/.output/server/node_modules/@grpc/grpc-js/build/src/load-balancing-call.js +0 -294
  65. package/.output/server/node_modules/@grpc/grpc-js/build/src/logging.js +0 -122
  66. package/.output/server/node_modules/@grpc/grpc-js/build/src/make-client.js +0 -143
  67. package/.output/server/node_modules/@grpc/grpc-js/build/src/metadata.js +0 -249
  68. package/.output/server/node_modules/@grpc/grpc-js/build/src/picker.js +0 -86
  69. package/.output/server/node_modules/@grpc/grpc-js/build/src/resolver-dns.js +0 -349
  70. package/.output/server/node_modules/@grpc/grpc-js/build/src/resolver-ip.js +0 -104
  71. package/.output/server/node_modules/@grpc/grpc-js/build/src/resolver-uds.js +0 -50
  72. package/.output/server/node_modules/@grpc/grpc-js/build/src/resolver.js +0 -87
  73. package/.output/server/node_modules/@grpc/grpc-js/build/src/resolving-call.js +0 -305
  74. package/.output/server/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.js +0 -309
  75. package/.output/server/node_modules/@grpc/grpc-js/build/src/retrying-call.js +0 -665
  76. package/.output/server/node_modules/@grpc/grpc-js/build/src/server-call.js +0 -202
  77. package/.output/server/node_modules/@grpc/grpc-js/build/src/server-credentials.js +0 -305
  78. package/.output/server/node_modules/@grpc/grpc-js/build/src/server-interceptors.js +0 -770
  79. package/.output/server/node_modules/@grpc/grpc-js/build/src/server.js +0 -1569
  80. package/.output/server/node_modules/@grpc/grpc-js/build/src/service-config.js +0 -430
  81. package/.output/server/node_modules/@grpc/grpc-js/build/src/status-builder.js +0 -68
  82. package/.output/server/node_modules/@grpc/grpc-js/build/src/stream-decoder.js +0 -100
  83. package/.output/server/node_modules/@grpc/grpc-js/build/src/subchannel-address.js +0 -202
  84. package/.output/server/node_modules/@grpc/grpc-js/build/src/subchannel-call.js +0 -542
  85. package/.output/server/node_modules/@grpc/grpc-js/build/src/subchannel-interface.js +0 -92
  86. package/.output/server/node_modules/@grpc/grpc-js/build/src/subchannel-pool.js +0 -137
  87. package/.output/server/node_modules/@grpc/grpc-js/build/src/subchannel.js +0 -371
  88. package/.output/server/node_modules/@grpc/grpc-js/build/src/tls-helpers.js +0 -34
  89. package/.output/server/node_modules/@grpc/grpc-js/build/src/transport.js +0 -662
  90. package/.output/server/node_modules/@grpc/grpc-js/build/src/uri-parser.js +0 -125
  91. package/.output/server/node_modules/@grpc/grpc-js/package.json +0 -87
  92. package/.output/server/node_modules/@grpc/grpc-js/proto/channelz.proto +0 -564
  93. package/.output/server/node_modules/@grpc/proto-loader/build/src/index.js +0 -244
  94. package/.output/server/node_modules/@grpc/proto-loader/build/src/util.js +0 -89
  95. package/.output/server/node_modules/@grpc/proto-loader/package.json +0 -69
  96. package/.output/server/node_modules/@js-sdsl/ordered-map/dist/cjs/index.js +0 -795
  97. package/.output/server/node_modules/@js-sdsl/ordered-map/package.json +0 -138
  98. package/.output/server/node_modules/@logdna/tail-file/index.js +0 -3
  99. package/.output/server/node_modules/@logdna/tail-file/lib/tail-file.js +0 -326
  100. package/.output/server/node_modules/@logdna/tail-file/package.json +0 -162
  101. package/.output/server/node_modules/@protobufjs/aspromise/index.js +0 -52
  102. package/.output/server/node_modules/@protobufjs/aspromise/package.json +0 -21
  103. package/.output/server/node_modules/@protobufjs/base64/index.js +0 -139
  104. package/.output/server/node_modules/@protobufjs/base64/package.json +0 -21
  105. package/.output/server/node_modules/@protobufjs/codegen/index.js +0 -99
  106. package/.output/server/node_modules/@protobufjs/codegen/package.json +0 -13
  107. package/.output/server/node_modules/@protobufjs/eventemitter/index.js +0 -76
  108. package/.output/server/node_modules/@protobufjs/eventemitter/package.json +0 -21
  109. package/.output/server/node_modules/@protobufjs/fetch/index.js +0 -115
  110. package/.output/server/node_modules/@protobufjs/fetch/package.json +0 -25
  111. package/.output/server/node_modules/@protobufjs/float/index.js +0 -335
  112. package/.output/server/node_modules/@protobufjs/float/package.json +0 -26
  113. package/.output/server/node_modules/@protobufjs/inquire/index.js +0 -17
  114. package/.output/server/node_modules/@protobufjs/inquire/package.json +0 -21
  115. package/.output/server/node_modules/@protobufjs/path/index.js +0 -65
  116. package/.output/server/node_modules/@protobufjs/path/package.json +0 -21
  117. package/.output/server/node_modules/@protobufjs/pool/index.js +0 -48
  118. package/.output/server/node_modules/@protobufjs/pool/package.json +0 -21
  119. package/.output/server/node_modules/@protobufjs/utf8/index.js +0 -105
  120. package/.output/server/node_modules/@protobufjs/utf8/package.json +0 -21
  121. package/.output/server/node_modules/@pulumi/pulumi/asset/archive.js +0 -84
  122. package/.output/server/node_modules/@pulumi/pulumi/asset/asset.js +0 -84
  123. package/.output/server/node_modules/@pulumi/pulumi/asset/index.js +0 -21
  124. package/.output/server/node_modules/@pulumi/pulumi/automation/cmd.js +0 -270
  125. package/.output/server/node_modules/@pulumi/pulumi/automation/errors.js +0 -84
  126. package/.output/server/node_modules/@pulumi/pulumi/automation/events.js +0 -47
  127. package/.output/server/node_modules/@pulumi/pulumi/automation/index.js +0 -27
  128. package/.output/server/node_modules/@pulumi/pulumi/automation/localWorkspace.js +0 -1049
  129. package/.output/server/node_modules/@pulumi/pulumi/automation/minimumVersion.js +0 -28
  130. package/.output/server/node_modules/@pulumi/pulumi/automation/remoteStack.js +0 -130
  131. package/.output/server/node_modules/@pulumi/pulumi/automation/remoteWorkspace.js +0 -131
  132. package/.output/server/node_modules/@pulumi/pulumi/automation/server.js +0 -170
  133. package/.output/server/node_modules/@pulumi/pulumi/automation/stack.js +0 -995
  134. package/.output/server/node_modules/@pulumi/pulumi/automation/stackSettings.js +0 -24
  135. package/.output/server/node_modules/@pulumi/pulumi/errors.js +0 -126
  136. package/.output/server/node_modules/@pulumi/pulumi/log/index.js +0 -132
  137. package/.output/server/node_modules/@pulumi/pulumi/metadata.js +0 -46
  138. package/.output/server/node_modules/@pulumi/pulumi/output.js +0 -701
  139. package/.output/server/node_modules/@pulumi/pulumi/package.json +0 -95
  140. package/.output/server/node_modules/@pulumi/pulumi/proto/alias_pb.js +0 -631
  141. package/.output/server/node_modules/@pulumi/pulumi/proto/callback_grpc_pb.js +0 -61
  142. package/.output/server/node_modules/@pulumi/pulumi/proto/callback_pb.js +0 -582
  143. package/.output/server/node_modules/@pulumi/pulumi/proto/codegen/hcl_pb.js +0 -808
  144. package/.output/server/node_modules/@pulumi/pulumi/proto/engine_grpc_pb.js +0 -158
  145. package/.output/server/node_modules/@pulumi/pulumi/proto/engine_pb.js +0 -1058
  146. package/.output/server/node_modules/@pulumi/pulumi/proto/language_grpc_pb.js +0 -551
  147. package/.output/server/node_modules/@pulumi/pulumi/proto/language_pb.js +0 -7222
  148. package/.output/server/node_modules/@pulumi/pulumi/proto/plugin_pb.js +0 -1159
  149. package/.output/server/node_modules/@pulumi/pulumi/proto/provider_pb.js +0 -11300
  150. package/.output/server/node_modules/@pulumi/pulumi/proto/resource_grpc_pb.js +0 -312
  151. package/.output/server/node_modules/@pulumi/pulumi/proto/resource_pb.js +0 -7447
  152. package/.output/server/node_modules/@pulumi/pulumi/proto/source_pb.js +0 -230
  153. package/.output/server/node_modules/@pulumi/pulumi/resource.js +0 -774
  154. package/.output/server/node_modules/@pulumi/pulumi/runtime/asyncIterableUtil.js +0 -103
  155. package/.output/server/node_modules/@pulumi/pulumi/runtime/callbacks.js +0 -456
  156. package/.output/server/node_modules/@pulumi/pulumi/runtime/config.js +0 -129
  157. package/.output/server/node_modules/@pulumi/pulumi/runtime/debuggable.js +0 -137
  158. package/.output/server/node_modules/@pulumi/pulumi/runtime/dependsOn.js +0 -157
  159. package/.output/server/node_modules/@pulumi/pulumi/runtime/invoke.js +0 -533
  160. package/.output/server/node_modules/@pulumi/pulumi/runtime/resource.js +0 -850
  161. package/.output/server/node_modules/@pulumi/pulumi/runtime/rpc.js +0 -858
  162. package/.output/server/node_modules/@pulumi/pulumi/runtime/settings.js +0 -551
  163. package/.output/server/node_modules/@pulumi/pulumi/runtime/stack.js +0 -276
  164. package/.output/server/node_modules/@pulumi/pulumi/runtime/state.js +0 -187
  165. package/.output/server/node_modules/@pulumi/pulumi/utils.js +0 -89
  166. package/.output/server/node_modules/@pulumi/pulumi/version.js +0 -17
  167. package/.output/server/node_modules/@pulumi/query/asyncQueryable.js +0 -279
  168. package/.output/server/node_modules/@pulumi/query/base.js +0 -34
  169. package/.output/server/node_modules/@pulumi/query/index.js +0 -87
  170. package/.output/server/node_modules/@pulumi/query/interfaces.js +0 -24
  171. package/.output/server/node_modules/@pulumi/query/operators.js +0 -1269
  172. package/.output/server/node_modules/@pulumi/query/package.json +0 -22
  173. package/.output/server/node_modules/@pulumi/query/sources.js +0 -81
  174. package/.output/server/node_modules/@pulumi/query/util.js +0 -23
  175. package/.output/server/node_modules/@sinclair/typebox/build/esm/index.mjs +0 -80
  176. package/.output/server/node_modules/@sinclair/typebox/build/esm/system/policy.mjs +0 -54
  177. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/any/any.mjs +0 -6
  178. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/any/index.mjs +0 -1
  179. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/argument/argument.mjs +0 -6
  180. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/argument/index.mjs +0 -1
  181. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/array/array.mjs +0 -6
  182. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/array/index.mjs +0 -1
  183. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs +0 -6
  184. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/async-iterator/index.mjs +0 -1
  185. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs +0 -37
  186. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/awaited/index.mjs +0 -1
  187. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs +0 -6
  188. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/bigint/index.mjs +0 -1
  189. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs +0 -6
  190. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/boolean/index.mjs +0 -1
  191. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/clone/index.mjs +0 -2
  192. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs +0 -9
  193. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs +0 -36
  194. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs +0 -42
  195. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/composite/index.mjs +0 -1
  196. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/computed/computed.mjs +0 -6
  197. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/computed/index.mjs +0 -1
  198. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/const/const.mjs +0 -54
  199. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/const/index.mjs +0 -1
  200. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs +0 -6
  201. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/constructor/index.mjs +0 -1
  202. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs +0 -7
  203. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/index.mjs +0 -1
  204. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs +0 -33
  205. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/create/index.mjs +0 -1
  206. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/create/type.mjs +0 -15
  207. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/date/date.mjs +0 -6
  208. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/date/index.mjs +0 -1
  209. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs +0 -8
  210. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/discard/index.mjs +0 -1
  211. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs +0 -18
  212. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/enum/index.mjs +0 -1
  213. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/error/error.mjs +0 -6
  214. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/error/index.mjs +0 -1
  215. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs +0 -18
  216. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs +0 -5
  217. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs +0 -25
  218. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/exclude/index.mjs +0 -3
  219. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs +0 -635
  220. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs +0 -25
  221. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs +0 -19
  222. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.mjs +0 -20
  223. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs +0 -23
  224. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/extends/index.mjs +0 -5
  225. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs +0 -18
  226. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs +0 -5
  227. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs +0 -25
  228. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/extract/index.mjs +0 -3
  229. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/function/function.mjs +0 -6
  230. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/function/index.mjs +0 -1
  231. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/guard/index.mjs +0 -3
  232. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs +0 -235
  233. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs +0 -509
  234. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs +0 -70
  235. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/helpers/helpers.mjs +0 -4
  236. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/helpers/index.mjs +0 -1
  237. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/indexed/index.mjs +0 -4
  238. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs +0 -22
  239. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs +0 -20
  240. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs +0 -32
  241. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs +0 -91
  242. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/instance-type/index.mjs +0 -1
  243. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs +0 -7
  244. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/instantiate/index.mjs +0 -1
  245. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs +0 -115
  246. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/integer/index.mjs +0 -1
  247. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs +0 -6
  248. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intersect/index.mjs +0 -3
  249. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs +0 -19
  250. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs +0 -38
  251. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-type.mjs +0 -1
  252. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs +0 -17
  253. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs +0 -5
  254. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intrinsic/index.mjs +0 -6
  255. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs +0 -26
  256. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs +0 -64
  257. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs +0 -5
  258. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs +0 -5
  259. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs +0 -5
  260. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/iterator/index.mjs +0 -1
  261. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs +0 -6
  262. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/keyof/index.mjs +0 -4
  263. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs +0 -19
  264. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.mjs +0 -12
  265. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs +0 -73
  266. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs +0 -35
  267. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/literal/index.mjs +0 -1
  268. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs +0 -10
  269. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/mapped/index.mjs +0 -3
  270. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-key.mjs +0 -9
  271. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs +0 -9
  272. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs +0 -102
  273. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs +0 -166
  274. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/module/index.mjs +0 -1
  275. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/module/module.mjs +0 -32
  276. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/never/index.mjs +0 -1
  277. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/never/never.mjs +0 -6
  278. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/not/index.mjs +0 -1
  279. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/not/not.mjs +0 -6
  280. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/null/index.mjs +0 -1
  281. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/null/null.mjs +0 -6
  282. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/number/index.mjs +0 -1
  283. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/number/number.mjs +0 -6
  284. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/object/index.mjs +0 -1
  285. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/object/object.mjs +0 -22
  286. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/omit/index.mjs +0 -3
  287. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs +0 -22
  288. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs +0 -19
  289. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs +0 -71
  290. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/optional/index.mjs +0 -2
  291. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs +0 -18
  292. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs +0 -22
  293. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/parameters/index.mjs +0 -1
  294. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs +0 -7
  295. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/partial/index.mjs +0 -2
  296. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs +0 -19
  297. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs +0 -74
  298. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/patterns/index.mjs +0 -1
  299. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs +0 -8
  300. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/pick/index.mjs +0 -3
  301. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs +0 -24
  302. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs +0 -19
  303. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs +0 -66
  304. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/promise/index.mjs +0 -1
  305. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs +0 -6
  306. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/readonly/index.mjs +0 -2
  307. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs +0 -18
  308. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs +0 -22
  309. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/index.mjs +0 -1
  310. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs +0 -6
  311. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/record/index.mjs +0 -1
  312. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/record/record.mjs +0 -116
  313. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/recursive/index.mjs +0 -1
  314. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs +0 -15
  315. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/ref/index.mjs +0 -1
  316. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs +0 -10
  317. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/regexp/index.mjs +0 -1
  318. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs +0 -8
  319. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/registry/format.mjs +0 -26
  320. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/registry/index.mjs +0 -2
  321. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/registry/type.mjs +0 -26
  322. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/required/index.mjs +0 -2
  323. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs +0 -18
  324. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/required/required.mjs +0 -73
  325. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/rest/index.mjs +0 -1
  326. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs +0 -15
  327. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/return-type/index.mjs +0 -1
  328. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs +0 -7
  329. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/schema/anyschema.mjs +0 -1
  330. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/schema/index.mjs +0 -2
  331. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/schema/schema.mjs +0 -1
  332. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/sets/index.mjs +0 -1
  333. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs +0 -48
  334. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/static/index.mjs +0 -1
  335. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/static/static.mjs +0 -1
  336. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/string/index.mjs +0 -1
  337. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/string/string.mjs +0 -6
  338. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/symbol/index.mjs +0 -1
  339. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs +0 -6
  340. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/symbols/index.mjs +0 -1
  341. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs +0 -10
  342. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs +0 -49
  343. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs +0 -53
  344. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/template-literal/index.mjs +0 -7
  345. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs +0 -167
  346. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs +0 -33
  347. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs +0 -55
  348. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs +0 -13
  349. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs +0 -9
  350. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/transform/index.mjs +0 -1
  351. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs +0 -40
  352. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/tuple/index.mjs +0 -1
  353. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs +0 -9
  354. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/type/index.mjs +0 -13
  355. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/type/javascript.mjs +0 -99
  356. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/type/json.mjs +0 -221
  357. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/type/type.mjs +0 -62
  358. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/uint8array/index.mjs +0 -1
  359. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs +0 -6
  360. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/undefined/index.mjs +0 -1
  361. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs +0 -6
  362. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/union/index.mjs +0 -3
  363. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs +0 -5
  364. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs +0 -36
  365. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/union/union-type.mjs +0 -1
  366. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/union/union.mjs +0 -10
  367. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/unknown/index.mjs +0 -1
  368. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs +0 -6
  369. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/unsafe/index.mjs +0 -1
  370. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs +0 -6
  371. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/void/index.mjs +0 -1
  372. package/.output/server/node_modules/@sinclair/typebox/build/esm/type/void/void.mjs +0 -6
  373. package/.output/server/node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs +0 -158
  374. package/.output/server/node_modules/@sinclair/typebox/build/esm/value/guard/index.mjs +0 -1
  375. package/.output/server/node_modules/@sinclair/typebox/package.json +0 -116
  376. package/.output/server/node_modules/@sindresorhus/is/dist/index.js +0 -434
  377. package/.output/server/node_modules/@sindresorhus/is/package.json +0 -96
  378. package/.output/server/node_modules/@szmarczak/http-timer/dist/source/index.js +0 -126
  379. package/.output/server/node_modules/@szmarczak/http-timer/package.json +0 -72
  380. package/.output/server/node_modules/abstract-level/abstract-chained-batch.js +0 -420
  381. package/.output/server/node_modules/abstract-level/abstract-iterator.js +0 -397
  382. package/.output/server/node_modules/abstract-level/abstract-level.js +0 -935
  383. package/.output/server/node_modules/abstract-level/index.js +0 -8
  384. package/.output/server/node_modules/abstract-level/lib/abstract-sublevel-iterator.js +0 -122
  385. package/.output/server/node_modules/abstract-level/lib/abstract-sublevel.js +0 -269
  386. package/.output/server/node_modules/abstract-level/lib/common.js +0 -33
  387. package/.output/server/node_modules/abstract-level/lib/default-chained-batch.js +0 -29
  388. package/.output/server/node_modules/abstract-level/lib/default-kv-iterator.js +0 -74
  389. package/.output/server/node_modules/abstract-level/lib/deferred-iterator.js +0 -110
  390. package/.output/server/node_modules/abstract-level/lib/deferred-queue.js +0 -86
  391. package/.output/server/node_modules/abstract-level/lib/errors.js +0 -21
  392. package/.output/server/node_modules/abstract-level/lib/event-monitor.js +0 -41
  393. package/.output/server/node_modules/abstract-level/lib/hooks.js +0 -79
  394. package/.output/server/node_modules/abstract-level/lib/prefixes.js +0 -21
  395. package/.output/server/node_modules/abstract-level/lib/prewrite-batch.js +0 -100
  396. package/.output/server/node_modules/abstract-level/lib/range-options.js +0 -26
  397. package/.output/server/node_modules/abstract-level/package.json +0 -62
  398. package/.output/server/node_modules/acorn/dist/acorn.mjs +0 -6145
  399. package/.output/server/node_modules/acorn/package.json +0 -50
  400. package/.output/server/node_modules/ajv/dist/ajv.js +0 -50
  401. package/.output/server/node_modules/ajv/dist/compile/codegen/code.js +0 -156
  402. package/.output/server/node_modules/ajv/dist/compile/codegen/index.js +0 -697
  403. package/.output/server/node_modules/ajv/dist/compile/codegen/scope.js +0 -143
  404. package/.output/server/node_modules/ajv/dist/compile/errors.js +0 -123
  405. package/.output/server/node_modules/ajv/dist/compile/index.js +0 -242
  406. package/.output/server/node_modules/ajv/dist/compile/names.js +0 -28
  407. package/.output/server/node_modules/ajv/dist/compile/ref_error.js +0 -12
  408. package/.output/server/node_modules/ajv/dist/compile/resolve.js +0 -155
  409. package/.output/server/node_modules/ajv/dist/compile/rules.js +0 -26
  410. package/.output/server/node_modules/ajv/dist/compile/util.js +0 -178
  411. package/.output/server/node_modules/ajv/dist/compile/validate/applicability.js +0 -19
  412. package/.output/server/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -50
  413. package/.output/server/node_modules/ajv/dist/compile/validate/dataType.js +0 -203
  414. package/.output/server/node_modules/ajv/dist/compile/validate/defaults.js +0 -35
  415. package/.output/server/node_modules/ajv/dist/compile/validate/index.js +0 -520
  416. package/.output/server/node_modules/ajv/dist/compile/validate/keyword.js +0 -124
  417. package/.output/server/node_modules/ajv/dist/compile/validate/subschema.js +0 -81
  418. package/.output/server/node_modules/ajv/dist/core.js +0 -618
  419. package/.output/server/node_modules/ajv/dist/refs/data.json +0 -13
  420. package/.output/server/node_modules/ajv/dist/refs/json-schema-draft-07.json +0 -151
  421. package/.output/server/node_modules/ajv/dist/runtime/equal.js +0 -7
  422. package/.output/server/node_modules/ajv/dist/runtime/ucs2length.js +0 -24
  423. package/.output/server/node_modules/ajv/dist/runtime/uri.js +0 -6
  424. package/.output/server/node_modules/ajv/dist/runtime/validation_error.js +0 -11
  425. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -49
  426. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -106
  427. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -23
  428. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -12
  429. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -95
  430. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -85
  431. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -66
  432. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -44
  433. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -52
  434. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -30
  435. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -26
  436. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -60
  437. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -75
  438. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -12
  439. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -54
  440. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -38
  441. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -13
  442. package/.output/server/node_modules/ajv/dist/vocabularies/code.js +0 -131
  443. package/.output/server/node_modules/ajv/dist/vocabularies/core/id.js +0 -10
  444. package/.output/server/node_modules/ajv/dist/vocabularies/core/index.js +0 -16
  445. package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js +0 -122
  446. package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -104
  447. package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -9
  448. package/.output/server/node_modules/ajv/dist/vocabularies/draft7.js +0 -17
  449. package/.output/server/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
  450. package/.output/server/node_modules/ajv/dist/vocabularies/format/index.js +0 -6
  451. package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js +0 -18
  452. package/.output/server/node_modules/ajv/dist/vocabularies/validation/const.js +0 -25
  453. package/.output/server/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -48
  454. package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js +0 -33
  455. package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -24
  456. package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -27
  457. package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -27
  458. package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -24
  459. package/.output/server/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -26
  460. package/.output/server/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -24
  461. package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js +0 -79
  462. package/.output/server/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -64
  463. package/.output/server/node_modules/ajv/package.json +0 -126
  464. package/.output/server/node_modules/atomic-sleep/index.js +0 -38
  465. package/.output/server/node_modules/atomic-sleep/package.json +0 -37
  466. package/.output/server/node_modules/better-lock/dist/better_lock.js +0 -377
  467. package/.output/server/node_modules/better-lock/dist/errors.js +0 -136
  468. package/.output/server/node_modules/better-lock/dist/index.js +0 -28
  469. package/.output/server/node_modules/better-lock/dist/internals.js +0 -75
  470. package/.output/server/node_modules/better-lock/dist/tools.js +0 -109
  471. package/.output/server/node_modules/better-lock/package.json +0 -60
  472. package/.output/server/node_modules/cacheable-lookup/package.json +0 -45
  473. package/.output/server/node_modules/cacheable-lookup/source/index.js +0 -436
  474. package/.output/server/node_modules/cacheable-request/package.json +0 -56
  475. package/.output/server/node_modules/cacheable-request/src/index.js +0 -251
  476. package/.output/server/node_modules/classic-level/binding.js +0 -1
  477. package/.output/server/node_modules/classic-level/chained-batch.js +0 -35
  478. package/.output/server/node_modules/classic-level/index.js +0 -177
  479. package/.output/server/node_modules/classic-level/iterator.js +0 -121
  480. package/.output/server/node_modules/classic-level/package.json +0 -71
  481. package/.output/server/node_modules/classic-level/prebuilds/linux-x64/classic-level.node +0 -0
  482. package/.output/server/node_modules/clone-response/package.json +0 -41
  483. package/.output/server/node_modules/clone-response/src/index.js +0 -17
  484. package/.output/server/node_modules/confbox/dist/index.mjs +0 -1
  485. package/.output/server/node_modules/confbox/dist/json5.mjs +0 -14
  486. package/.output/server/node_modules/confbox/dist/shared/confbox.9388d834.mjs +0 -1
  487. package/.output/server/node_modules/confbox/dist/shared/confbox.f9f03f05.mjs +0 -7
  488. package/.output/server/node_modules/confbox/dist/toml.mjs +0 -239
  489. package/.output/server/node_modules/confbox/dist/yaml.mjs +0 -32
  490. package/.output/server/node_modules/confbox/package.json +0 -86
  491. package/.output/server/node_modules/cross-spawn/index.js +0 -39
  492. package/.output/server/node_modules/cross-spawn/lib/enoent.js +0 -59
  493. package/.output/server/node_modules/cross-spawn/lib/parse.js +0 -91
  494. package/.output/server/node_modules/cross-spawn/lib/util/escape.js +0 -47
  495. package/.output/server/node_modules/cross-spawn/lib/util/readShebang.js +0 -23
  496. package/.output/server/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -52
  497. package/.output/server/node_modules/cross-spawn/package.json +0 -73
  498. package/.output/server/node_modules/crypto-hash/index.js +0 -66
  499. package/.output/server/node_modules/crypto-hash/package.json +0 -54
  500. package/.output/server/node_modules/crypto-hash/thread.js +0 -10
  501. package/.output/server/node_modules/crypto-hash/utilities.js +0 -10
  502. package/.output/server/node_modules/decompress-response/index.js +0 -58
  503. package/.output/server/node_modules/decompress-response/package.json +0 -56
  504. package/.output/server/node_modules/defer-to-connect/dist/source/index.js +0 -47
  505. package/.output/server/node_modules/defer-to-connect/package.json +0 -71
  506. package/.output/server/node_modules/dettle/dist/debounce.js +0 -91
  507. package/.output/server/node_modules/dettle/dist/index.js +0 -5
  508. package/.output/server/node_modules/dettle/dist/throttle.js +0 -12
  509. package/.output/server/node_modules/dettle/package.json +0 -29
  510. package/.output/server/node_modules/dotenv/config.js +0 -9
  511. package/.output/server/node_modules/dotenv/lib/cli-options.js +0 -11
  512. package/.output/server/node_modules/dotenv/lib/env-options.js +0 -24
  513. package/.output/server/node_modules/dotenv/lib/main.js +0 -361
  514. package/.output/server/node_modules/dotenv/package.json +0 -61
  515. package/.output/server/node_modules/end-of-stream/index.js +0 -94
  516. package/.output/server/node_modules/end-of-stream/package.json +0 -37
  517. package/.output/server/node_modules/esprima/dist/esprima.js +0 -6709
  518. package/.output/server/node_modules/esprima/package.json +0 -112
  519. package/.output/server/node_modules/execa/index.js +0 -268
  520. package/.output/server/node_modules/execa/lib/command.js +0 -52
  521. package/.output/server/node_modules/execa/lib/error.js +0 -88
  522. package/.output/server/node_modules/execa/lib/kill.js +0 -115
  523. package/.output/server/node_modules/execa/lib/promise.js +0 -46
  524. package/.output/server/node_modules/execa/lib/stdio.js +0 -52
  525. package/.output/server/node_modules/execa/lib/stream.js +0 -97
  526. package/.output/server/node_modules/execa/package.json +0 -74
  527. package/.output/server/node_modules/fast-deep-equal/index.js +0 -46
  528. package/.output/server/node_modules/fast-deep-equal/package.json +0 -61
  529. package/.output/server/node_modules/fast-redact/index.js +0 -56
  530. package/.output/server/node_modules/fast-redact/lib/modifiers.js +0 -291
  531. package/.output/server/node_modules/fast-redact/lib/parse.js +0 -44
  532. package/.output/server/node_modules/fast-redact/lib/redactor.js +0 -108
  533. package/.output/server/node_modules/fast-redact/lib/restorer.js +0 -92
  534. package/.output/server/node_modules/fast-redact/lib/rx.js +0 -16
  535. package/.output/server/node_modules/fast-redact/lib/state.js +0 -20
  536. package/.output/server/node_modules/fast-redact/lib/validator.js +0 -33
  537. package/.output/server/node_modules/fast-redact/package.json +0 -50
  538. package/.output/server/node_modules/fast-uri/index.js +0 -303
  539. package/.output/server/node_modules/fast-uri/lib/schemes.js +0 -188
  540. package/.output/server/node_modules/fast-uri/lib/scopedChars.js +0 -30
  541. package/.output/server/node_modules/fast-uri/lib/utils.js +0 -244
  542. package/.output/server/node_modules/fast-uri/package.json +0 -68
  543. package/.output/server/node_modules/google-protobuf/google/protobuf/empty_pb.js +0 -147
  544. package/.output/server/node_modules/google-protobuf/google/protobuf/struct_pb.js +0 -955
  545. package/.output/server/node_modules/google-protobuf/google-protobuf.js +0 -149
  546. package/.output/server/node_modules/google-protobuf/package.json +0 -35
  547. package/.output/server/node_modules/got/dist/source/as-promise/create-rejection.js +0 -30
  548. package/.output/server/node_modules/got/dist/source/as-promise/index.js +0 -176
  549. package/.output/server/node_modules/got/dist/source/as-promise/normalize-arguments.js +0 -78
  550. package/.output/server/node_modules/got/dist/source/as-promise/parse-body.js +0 -25
  551. package/.output/server/node_modules/got/dist/source/as-promise/types.js +0 -42
  552. package/.output/server/node_modules/got/dist/source/core/calculate-retry-delay.js +0 -29
  553. package/.output/server/node_modules/got/dist/source/core/index.js +0 -1505
  554. package/.output/server/node_modules/got/dist/source/core/utils/dns-ip-version.js +0 -17
  555. package/.output/server/node_modules/got/dist/source/core/utils/get-body-size.js +0 -32
  556. package/.output/server/node_modules/got/dist/source/core/utils/get-buffer.js +0 -16
  557. package/.output/server/node_modules/got/dist/source/core/utils/is-form-data.js +0 -4
  558. package/.output/server/node_modules/got/dist/source/core/utils/is-response-ok.js +0 -8
  559. package/.output/server/node_modules/got/dist/source/core/utils/options-to-url.js +0 -53
  560. package/.output/server/node_modules/got/dist/source/core/utils/proxy-events.js +0 -17
  561. package/.output/server/node_modules/got/dist/source/core/utils/timed-out.js +0 -121
  562. package/.output/server/node_modules/got/dist/source/core/utils/unhandle.js +0 -22
  563. package/.output/server/node_modules/got/dist/source/core/utils/url-to-options.js +0 -24
  564. package/.output/server/node_modules/got/dist/source/core/utils/weakable-map.js +0 -29
  565. package/.output/server/node_modules/got/dist/source/create.js +0 -240
  566. package/.output/server/node_modules/got/dist/source/index.js +0 -132
  567. package/.output/server/node_modules/got/dist/source/types.js +0 -2
  568. package/.output/server/node_modules/got/dist/source/utils/deep-freeze.js +0 -12
  569. package/.output/server/node_modules/got/dist/source/utils/deprecation-warning.js +0 -13
  570. package/.output/server/node_modules/got/package.json +0 -131
  571. package/.output/server/node_modules/http-cache-semantics/index.js +0 -674
  572. package/.output/server/node_modules/http-cache-semantics/package.json +0 -18
  573. package/.output/server/node_modules/http2-wrapper/package.json +0 -54
  574. package/.output/server/node_modules/http2-wrapper/source/agent.js +0 -670
  575. package/.output/server/node_modules/http2-wrapper/source/auto.js +0 -149
  576. package/.output/server/node_modules/http2-wrapper/source/client-request.js +0 -445
  577. package/.output/server/node_modules/http2-wrapper/source/incoming-message.js +0 -58
  578. package/.output/server/node_modules/http2-wrapper/source/index.js +0 -28
  579. package/.output/server/node_modules/http2-wrapper/source/utils/calculate-server-name.js +0 -27
  580. package/.output/server/node_modules/http2-wrapper/source/utils/errors.js +0 -45
  581. package/.output/server/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js +0 -13
  582. package/.output/server/node_modules/http2-wrapper/source/utils/proxy-events.js +0 -7
  583. package/.output/server/node_modules/http2-wrapper/source/utils/url-to-options.js +0 -25
  584. package/.output/server/node_modules/human-signals/build/src/core.js +0 -273
  585. package/.output/server/node_modules/human-signals/build/src/main.js +0 -71
  586. package/.output/server/node_modules/human-signals/build/src/realtime.js +0 -19
  587. package/.output/server/node_modules/human-signals/build/src/signals.js +0 -35
  588. package/.output/server/node_modules/human-signals/package.json +0 -64
  589. package/.output/server/node_modules/import-meta-resolve/index.js +0 -47
  590. package/.output/server/node_modules/import-meta-resolve/lib/errors.js +0 -507
  591. package/.output/server/node_modules/import-meta-resolve/lib/get-format.js +0 -159
  592. package/.output/server/node_modules/import-meta-resolve/lib/package-json-reader.js +0 -177
  593. package/.output/server/node_modules/import-meta-resolve/lib/resolve.js +0 -1297
  594. package/.output/server/node_modules/import-meta-resolve/lib/utils.js +0 -47
  595. package/.output/server/node_modules/import-meta-resolve/package.json +0 -95
  596. package/.output/server/node_modules/is-stream/index.js +0 -28
  597. package/.output/server/node_modules/is-stream/package.json +0 -42
  598. package/.output/server/node_modules/isexe/index.js +0 -57
  599. package/.output/server/node_modules/isexe/mode.js +0 -41
  600. package/.output/server/node_modules/isexe/package.json +0 -31
  601. package/.output/server/node_modules/isexe/windows.js +0 -42
  602. package/.output/server/node_modules/js-yaml/index.js +0 -7
  603. package/.output/server/node_modules/js-yaml/lib/js-yaml/common.js +0 -59
  604. package/.output/server/node_modules/js-yaml/lib/js-yaml/dumper.js +0 -850
  605. package/.output/server/node_modules/js-yaml/lib/js-yaml/exception.js +0 -43
  606. package/.output/server/node_modules/js-yaml/lib/js-yaml/loader.js +0 -1644
  607. package/.output/server/node_modules/js-yaml/lib/js-yaml/mark.js +0 -76
  608. package/.output/server/node_modules/js-yaml/lib/js-yaml/schema/core.js +0 -18
  609. package/.output/server/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +0 -25
  610. package/.output/server/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +0 -28
  611. package/.output/server/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +0 -17
  612. package/.output/server/node_modules/js-yaml/lib/js-yaml/schema/json.js +0 -25
  613. package/.output/server/node_modules/js-yaml/lib/js-yaml/schema.js +0 -108
  614. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/binary.js +0 -138
  615. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/bool.js +0 -35
  616. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/float.js +0 -116
  617. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/int.js +0 -173
  618. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/js/function.js +0 -93
  619. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +0 -60
  620. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +0 -28
  621. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/map.js +0 -8
  622. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/merge.js +0 -12
  623. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/null.js +0 -34
  624. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/omap.js +0 -44
  625. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/pairs.js +0 -53
  626. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/seq.js +0 -8
  627. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/set.js +0 -29
  628. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/str.js +0 -8
  629. package/.output/server/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +0 -88
  630. package/.output/server/node_modules/js-yaml/lib/js-yaml/type.js +0 -61
  631. package/.output/server/node_modules/js-yaml/lib/js-yaml.js +0 -39
  632. package/.output/server/node_modules/js-yaml/package.json +0 -49
  633. package/.output/server/node_modules/json-buffer/index.js +0 -58
  634. package/.output/server/node_modules/json-buffer/package.json +0 -34
  635. package/.output/server/node_modules/json-schema-traverse/index.js +0 -93
  636. package/.output/server/node_modules/json-schema-traverse/package.json +0 -43
  637. package/.output/server/node_modules/keyv/package.json +0 -57
  638. package/.output/server/node_modules/keyv/src/index.js +0 -259
  639. package/.output/server/node_modules/level-supports/index.js +0 -26
  640. package/.output/server/node_modules/level-supports/package.json +0 -46
  641. package/.output/server/node_modules/level-transcoder/index.js +0 -158
  642. package/.output/server/node_modules/level-transcoder/lib/encoding.js +0 -105
  643. package/.output/server/node_modules/level-transcoder/lib/encodings.js +0 -135
  644. package/.output/server/node_modules/level-transcoder/lib/formats.js +0 -111
  645. package/.output/server/node_modules/level-transcoder/lib/text-endec.js +0 -19
  646. package/.output/server/node_modules/level-transcoder/package.json +0 -46
  647. package/.output/server/node_modules/lodash.camelcase/index.js +0 -599
  648. package/.output/server/node_modules/lodash.camelcase/package.json +0 -19
  649. package/.output/server/node_modules/long/package.json +0 -58
  650. package/.output/server/node_modules/long/umd/index.js +0 -1622
  651. package/.output/server/node_modules/long/umd/package.json +0 -3
  652. package/.output/server/node_modules/lowercase-keys/index.js +0 -10
  653. package/.output/server/node_modules/lowercase-keys/package.json +0 -38
  654. package/.output/server/node_modules/maybe-combine-errors/index.js +0 -60
  655. package/.output/server/node_modules/maybe-combine-errors/package.json +0 -33
  656. package/.output/server/node_modules/merge-stream/index.js +0 -41
  657. package/.output/server/node_modules/merge-stream/package.json +0 -19
  658. package/.output/server/node_modules/mimic-fn/index.js +0 -13
  659. package/.output/server/node_modules/mimic-fn/package.json +0 -42
  660. package/.output/server/node_modules/mlly/dist/index.mjs +0 -2606
  661. package/.output/server/node_modules/mlly/package.json +0 -50
  662. package/.output/server/node_modules/module-error/index.js +0 -22
  663. package/.output/server/node_modules/module-error/package.json +0 -36
  664. package/.output/server/node_modules/nano-spawn/package.json +0 -66
  665. package/.output/server/node_modules/nano-spawn/source/context.js +0 -12
  666. package/.output/server/node_modules/nano-spawn/source/index.js +0 -28
  667. package/.output/server/node_modules/nano-spawn/source/iterable.js +0 -61
  668. package/.output/server/node_modules/nano-spawn/source/options.js +0 -37
  669. package/.output/server/node_modules/nano-spawn/source/pipe.js +0 -43
  670. package/.output/server/node_modules/nano-spawn/source/result.js +0 -74
  671. package/.output/server/node_modules/nano-spawn/source/spawn.js +0 -44
  672. package/.output/server/node_modules/nano-spawn/source/windows.js +0 -76
  673. package/.output/server/node_modules/node-gyp-build/index.js +0 -6
  674. package/.output/server/node_modules/node-gyp-build/node-gyp-build.js +0 -207
  675. package/.output/server/node_modules/node-gyp-build/package.json +0 -43
  676. package/.output/server/node_modules/normalize-url/index.js +0 -216
  677. package/.output/server/node_modules/normalize-url/package.json +0 -50
  678. package/.output/server/node_modules/npm-run-path/index.js +0 -47
  679. package/.output/server/node_modules/npm-run-path/package.json +0 -44
  680. package/.output/server/node_modules/nypm/dist/index.mjs +0 -306
  681. package/.output/server/node_modules/nypm/package.json +0 -60
  682. package/.output/server/node_modules/on-exit-leak-free/index.js +0 -108
  683. package/.output/server/node_modules/on-exit-leak-free/package.json +0 -37
  684. package/.output/server/node_modules/once/once.js +0 -42
  685. package/.output/server/node_modules/once/package.json +0 -33
  686. package/.output/server/node_modules/onetime/index.js +0 -44
  687. package/.output/server/node_modules/onetime/package.json +0 -43
  688. package/.output/server/node_modules/p-cancelable/index.js +0 -111
  689. package/.output/server/node_modules/p-cancelable/package.json +0 -49
  690. package/.output/server/node_modules/path-key/index.js +0 -16
  691. package/.output/server/node_modules/path-key/package.json +0 -39
  692. package/.output/server/node_modules/pino/file.js +0 -12
  693. package/.output/server/node_modules/pino/lib/caller.js +0 -30
  694. package/.output/server/node_modules/pino/lib/constants.js +0 -28
  695. package/.output/server/node_modules/pino/lib/levels.js +0 -241
  696. package/.output/server/node_modules/pino/lib/meta.js +0 -3
  697. package/.output/server/node_modules/pino/lib/multistream.js +0 -188
  698. package/.output/server/node_modules/pino/lib/proto.js +0 -234
  699. package/.output/server/node_modules/pino/lib/redaction.js +0 -118
  700. package/.output/server/node_modules/pino/lib/symbols.js +0 -74
  701. package/.output/server/node_modules/pino/lib/time.js +0 -11
  702. package/.output/server/node_modules/pino/lib/tools.js +0 -394
  703. package/.output/server/node_modules/pino/lib/transport-stream.js +0 -56
  704. package/.output/server/node_modules/pino/lib/transport.js +0 -167
  705. package/.output/server/node_modules/pino/lib/worker.js +0 -194
  706. package/.output/server/node_modules/pino/package.json +0 -120
  707. package/.output/server/node_modules/pino/pino.js +0 -234
  708. package/.output/server/node_modules/pino-abstract-transport/index.js +0 -128
  709. package/.output/server/node_modules/pino-abstract-transport/package.json +0 -40
  710. package/.output/server/node_modules/pino-std-serializers/index.js +0 -36
  711. package/.output/server/node_modules/pino-std-serializers/lib/err-helpers.js +0 -118
  712. package/.output/server/node_modules/pino-std-serializers/lib/err-proto.js +0 -48
  713. package/.output/server/node_modules/pino-std-serializers/lib/err-with-cause.js +0 -48
  714. package/.output/server/node_modules/pino-std-serializers/lib/err.js +0 -45
  715. package/.output/server/node_modules/pino-std-serializers/lib/req.js +0 -100
  716. package/.output/server/node_modules/pino-std-serializers/lib/res.js +0 -47
  717. package/.output/server/node_modules/pino-std-serializers/package.json +0 -47
  718. package/.output/server/node_modules/pkg-types/dist/index.mjs +0 -157
  719. package/.output/server/node_modules/pkg-types/package.json +0 -47
  720. package/.output/server/node_modules/promise-make-counter/dist/index.js +0 -24
  721. package/.output/server/node_modules/promise-make-counter/package.json +0 -33
  722. package/.output/server/node_modules/promise-make-naked/dist/index.js +0 -25
  723. package/.output/server/node_modules/promise-make-naked/dist/utils.js +0 -4
  724. package/.output/server/node_modules/promise-make-naked/package.json +0 -29
  725. package/.output/server/node_modules/protobufjs/ext/descriptor/index.js +0 -1052
  726. package/.output/server/node_modules/protobufjs/google/protobuf/api.json +0 -118
  727. package/.output/server/node_modules/protobufjs/google/protobuf/descriptor.json +0 -739
  728. package/.output/server/node_modules/protobufjs/google/protobuf/source_context.json +0 -20
  729. package/.output/server/node_modules/protobufjs/google/protobuf/type.json +0 -202
  730. package/.output/server/node_modules/protobufjs/index.js +0 -4
  731. package/.output/server/node_modules/protobufjs/package.json +0 -112
  732. package/.output/server/node_modules/protobufjs/src/common.js +0 -399
  733. package/.output/server/node_modules/protobufjs/src/converter.js +0 -301
  734. package/.output/server/node_modules/protobufjs/src/decoder.js +0 -129
  735. package/.output/server/node_modules/protobufjs/src/encoder.js +0 -100
  736. package/.output/server/node_modules/protobufjs/src/enum.js +0 -198
  737. package/.output/server/node_modules/protobufjs/src/field.js +0 -377
  738. package/.output/server/node_modules/protobufjs/src/index-light.js +0 -104
  739. package/.output/server/node_modules/protobufjs/src/index-minimal.js +0 -36
  740. package/.output/server/node_modules/protobufjs/src/index.js +0 -12
  741. package/.output/server/node_modules/protobufjs/src/mapfield.js +0 -126
  742. package/.output/server/node_modules/protobufjs/src/message.js +0 -139
  743. package/.output/server/node_modules/protobufjs/src/method.js +0 -160
  744. package/.output/server/node_modules/protobufjs/src/namespace.js +0 -433
  745. package/.output/server/node_modules/protobufjs/src/object.js +0 -243
  746. package/.output/server/node_modules/protobufjs/src/oneof.js +0 -203
  747. package/.output/server/node_modules/protobufjs/src/parse.js +0 -893
  748. package/.output/server/node_modules/protobufjs/src/reader.js +0 -416
  749. package/.output/server/node_modules/protobufjs/src/reader_buffer.js +0 -51
  750. package/.output/server/node_modules/protobufjs/src/root.js +0 -368
  751. package/.output/server/node_modules/protobufjs/src/roots.js +0 -18
  752. package/.output/server/node_modules/protobufjs/src/rpc/service.js +0 -142
  753. package/.output/server/node_modules/protobufjs/src/rpc.js +0 -36
  754. package/.output/server/node_modules/protobufjs/src/service.js +0 -167
  755. package/.output/server/node_modules/protobufjs/src/tokenize.js +0 -416
  756. package/.output/server/node_modules/protobufjs/src/type.js +0 -589
  757. package/.output/server/node_modules/protobufjs/src/types.js +0 -196
  758. package/.output/server/node_modules/protobufjs/src/util/longbits.js +0 -200
  759. package/.output/server/node_modules/protobufjs/src/util/minimal.js +0 -438
  760. package/.output/server/node_modules/protobufjs/src/util.js +0 -212
  761. package/.output/server/node_modules/protobufjs/src/verifier.js +0 -177
  762. package/.output/server/node_modules/protobufjs/src/wrappers.js +0 -102
  763. package/.output/server/node_modules/protobufjs/src/writer.js +0 -465
  764. package/.output/server/node_modules/protobufjs/src/writer_buffer.js +0 -85
  765. package/.output/server/node_modules/pump/index.js +0 -86
  766. package/.output/server/node_modules/pump/package.json +0 -24
  767. package/.output/server/node_modules/quick-format-unescaped/index.js +0 -109
  768. package/.output/server/node_modules/quick-format-unescaped/package.json +0 -29
  769. package/.output/server/node_modules/quick-lru/index.js +0 -123
  770. package/.output/server/node_modules/quick-lru/package.json +0 -43
  771. package/.output/server/node_modules/real-require/package.json +0 -49
  772. package/.output/server/node_modules/real-require/src/index.js +0 -14
  773. package/.output/server/node_modules/remeda/dist/chunk-26ILFTOP.js +0 -1
  774. package/.output/server/node_modules/remeda/dist/chunk-2KIKGHAO.js +0 -1
  775. package/.output/server/node_modules/remeda/dist/chunk-2OQBQB3V.js +0 -1
  776. package/.output/server/node_modules/remeda/dist/chunk-2P44HXVH.js +0 -1
  777. package/.output/server/node_modules/remeda/dist/chunk-32MVV6O6.js +0 -1
  778. package/.output/server/node_modules/remeda/dist/chunk-3D3RWAVJ.js +0 -1
  779. package/.output/server/node_modules/remeda/dist/chunk-3FKP6OOU.js +0 -1
  780. package/.output/server/node_modules/remeda/dist/chunk-3IFJP4R5.js +0 -1
  781. package/.output/server/node_modules/remeda/dist/chunk-3T4TGMU4.js +0 -1
  782. package/.output/server/node_modules/remeda/dist/chunk-3UBK2BVM.js +0 -1
  783. package/.output/server/node_modules/remeda/dist/chunk-3XGGB2R4.js +0 -1
  784. package/.output/server/node_modules/remeda/dist/chunk-3ZJAREUD.js +0 -1
  785. package/.output/server/node_modules/remeda/dist/chunk-4NRWDO7P.js +0 -1
  786. package/.output/server/node_modules/remeda/dist/chunk-4UEQNEAO.js +0 -1
  787. package/.output/server/node_modules/remeda/dist/chunk-4YLWJIJ6.js +0 -1
  788. package/.output/server/node_modules/remeda/dist/chunk-4ZFFLFWV.js +0 -1
  789. package/.output/server/node_modules/remeda/dist/chunk-567G5ZXL.js +0 -1
  790. package/.output/server/node_modules/remeda/dist/chunk-57KROWWS.js +0 -1
  791. package/.output/server/node_modules/remeda/dist/chunk-5DU4ITSF.js +0 -1
  792. package/.output/server/node_modules/remeda/dist/chunk-5NQBDF4H.js +0 -1
  793. package/.output/server/node_modules/remeda/dist/chunk-5S4PYKVY.js +0 -1
  794. package/.output/server/node_modules/remeda/dist/chunk-5WKPQX7L.js +0 -1
  795. package/.output/server/node_modules/remeda/dist/chunk-6GTAPB47.js +0 -1
  796. package/.output/server/node_modules/remeda/dist/chunk-6OEKBHIX.js +0 -1
  797. package/.output/server/node_modules/remeda/dist/chunk-6RKHJ2CP.js +0 -1
  798. package/.output/server/node_modules/remeda/dist/chunk-6RL33UFT.js +0 -1
  799. package/.output/server/node_modules/remeda/dist/chunk-7QX4DO53.js +0 -1
  800. package/.output/server/node_modules/remeda/dist/chunk-A3PVMI4K.js +0 -1
  801. package/.output/server/node_modules/remeda/dist/chunk-A3ZTVFWP.js +0 -1
  802. package/.output/server/node_modules/remeda/dist/chunk-ADT4LUUN.js +0 -1
  803. package/.output/server/node_modules/remeda/dist/chunk-AHDTEY6L.js +0 -1
  804. package/.output/server/node_modules/remeda/dist/chunk-ALS6JP7S.js +0 -1
  805. package/.output/server/node_modules/remeda/dist/chunk-ANXBDSUI.js +0 -1
  806. package/.output/server/node_modules/remeda/dist/chunk-B6PG574O.js +0 -1
  807. package/.output/server/node_modules/remeda/dist/chunk-BCPWYWXN.js +0 -1
  808. package/.output/server/node_modules/remeda/dist/chunk-BO3LQZNF.js +0 -1
  809. package/.output/server/node_modules/remeda/dist/chunk-BSLJB6JE.js +0 -1
  810. package/.output/server/node_modules/remeda/dist/chunk-BXEO7YHQ.js +0 -1
  811. package/.output/server/node_modules/remeda/dist/chunk-BZNENX2T.js +0 -1
  812. package/.output/server/node_modules/remeda/dist/chunk-C4LV5VIX.js +0 -1
  813. package/.output/server/node_modules/remeda/dist/chunk-C4OZY4Z2.js +0 -1
  814. package/.output/server/node_modules/remeda/dist/chunk-C6IMN7SF.js +0 -1
  815. package/.output/server/node_modules/remeda/dist/chunk-CAZXBO45.js +0 -1
  816. package/.output/server/node_modules/remeda/dist/chunk-D6FCK2GA.js +0 -1
  817. package/.output/server/node_modules/remeda/dist/chunk-DAE7EJQ2.js +0 -1
  818. package/.output/server/node_modules/remeda/dist/chunk-DEVKGLTN.js +0 -2
  819. package/.output/server/node_modules/remeda/dist/chunk-DH3BPT6T.js +0 -1
  820. package/.output/server/node_modules/remeda/dist/chunk-DM52TTEP.js +0 -1
  821. package/.output/server/node_modules/remeda/dist/chunk-DSLWSGID.js +0 -1
  822. package/.output/server/node_modules/remeda/dist/chunk-EMIEIAAH.js +0 -1
  823. package/.output/server/node_modules/remeda/dist/chunk-ENOHV5LT.js +0 -1
  824. package/.output/server/node_modules/remeda/dist/chunk-ENS7GPLZ.js +0 -1
  825. package/.output/server/node_modules/remeda/dist/chunk-ETADWPSK.js +0 -1
  826. package/.output/server/node_modules/remeda/dist/chunk-EVIH3PFY.js +0 -1
  827. package/.output/server/node_modules/remeda/dist/chunk-FDH4IRIM.js +0 -1
  828. package/.output/server/node_modules/remeda/dist/chunk-FMPZ2CLX.js +0 -1
  829. package/.output/server/node_modules/remeda/dist/chunk-FRNNS7AX.js +0 -1
  830. package/.output/server/node_modules/remeda/dist/chunk-G2JPX77Y.js +0 -1
  831. package/.output/server/node_modules/remeda/dist/chunk-G5B2IDWB.js +0 -1
  832. package/.output/server/node_modules/remeda/dist/chunk-GDGEDZJG.js +0 -1
  833. package/.output/server/node_modules/remeda/dist/chunk-GGYFZTDW.js +0 -1
  834. package/.output/server/node_modules/remeda/dist/chunk-GIKF2ZNG.js +0 -1
  835. package/.output/server/node_modules/remeda/dist/chunk-GK5I7C4J.js +0 -1
  836. package/.output/server/node_modules/remeda/dist/chunk-GMMLSO2N.js +0 -1
  837. package/.output/server/node_modules/remeda/dist/chunk-GPLTWAVR.js +0 -1
  838. package/.output/server/node_modules/remeda/dist/chunk-GYH2VCL4.js +0 -1
  839. package/.output/server/node_modules/remeda/dist/chunk-H4OTHZJB.js +0 -1
  840. package/.output/server/node_modules/remeda/dist/chunk-HGKLN5KY.js +0 -1
  841. package/.output/server/node_modules/remeda/dist/chunk-HJSE3ESO.js +0 -1
  842. package/.output/server/node_modules/remeda/dist/chunk-HV3WACXG.js +0 -1
  843. package/.output/server/node_modules/remeda/dist/chunk-HVJXDSOP.js +0 -1
  844. package/.output/server/node_modules/remeda/dist/chunk-HVLRA6ZU.js +0 -1
  845. package/.output/server/node_modules/remeda/dist/chunk-I3D2BSWJ.js +0 -1
  846. package/.output/server/node_modules/remeda/dist/chunk-IXASGXCR.js +0 -1
  847. package/.output/server/node_modules/remeda/dist/chunk-J3IRE4DI.js +0 -1
  848. package/.output/server/node_modules/remeda/dist/chunk-J4EKWFDW.js +0 -1
  849. package/.output/server/node_modules/remeda/dist/chunk-J7R2OSHS.js +0 -1
  850. package/.output/server/node_modules/remeda/dist/chunk-JJZ7E4YG.js +0 -1
  851. package/.output/server/node_modules/remeda/dist/chunk-JK3VNB42.js +0 -1
  852. package/.output/server/node_modules/remeda/dist/chunk-K2FFNW24.js +0 -1
  853. package/.output/server/node_modules/remeda/dist/chunk-K3UJMX27.js +0 -1
  854. package/.output/server/node_modules/remeda/dist/chunk-KI5UAETW.js +0 -1
  855. package/.output/server/node_modules/remeda/dist/chunk-KQRZQWDE.js +0 -1
  856. package/.output/server/node_modules/remeda/dist/chunk-KVHF7QRD.js +0 -1
  857. package/.output/server/node_modules/remeda/dist/chunk-KZIKCQ56.js +0 -1
  858. package/.output/server/node_modules/remeda/dist/chunk-LDNOJYCI.js +0 -1
  859. package/.output/server/node_modules/remeda/dist/chunk-LE6I3KC6.js +0 -1
  860. package/.output/server/node_modules/remeda/dist/chunk-MQDP6CFS.js +0 -1
  861. package/.output/server/node_modules/remeda/dist/chunk-MSOX5OUI.js +0 -1
  862. package/.output/server/node_modules/remeda/dist/chunk-MYLLMFC7.js +0 -1
  863. package/.output/server/node_modules/remeda/dist/chunk-N4JUOEMS.js +0 -1
  864. package/.output/server/node_modules/remeda/dist/chunk-NFFV4IQT.js +0 -1
  865. package/.output/server/node_modules/remeda/dist/chunk-NJXNQM3G.js +0 -1
  866. package/.output/server/node_modules/remeda/dist/chunk-NMC53JVB.js +0 -1
  867. package/.output/server/node_modules/remeda/dist/chunk-NS6ZBRLP.js +0 -1
  868. package/.output/server/node_modules/remeda/dist/chunk-OAMXQXGR.js +0 -1
  869. package/.output/server/node_modules/remeda/dist/chunk-OCJMJQKO.js +0 -1
  870. package/.output/server/node_modules/remeda/dist/chunk-OIQJEOF7.js +0 -1
  871. package/.output/server/node_modules/remeda/dist/chunk-OLNQBNAJ.js +0 -1
  872. package/.output/server/node_modules/remeda/dist/chunk-OP5ZF26D.js +0 -1
  873. package/.output/server/node_modules/remeda/dist/chunk-OWH4IQQW.js +0 -1
  874. package/.output/server/node_modules/remeda/dist/chunk-P2PQB7KO.js +0 -1
  875. package/.output/server/node_modules/remeda/dist/chunk-P3DXEVTH.js +0 -1
  876. package/.output/server/node_modules/remeda/dist/chunk-P5WDBFN2.js +0 -1
  877. package/.output/server/node_modules/remeda/dist/chunk-P6LAFGAN.js +0 -1
  878. package/.output/server/node_modules/remeda/dist/chunk-PDQFB3TV.js +0 -1
  879. package/.output/server/node_modules/remeda/dist/chunk-PFSVCZNE.js +0 -1
  880. package/.output/server/node_modules/remeda/dist/chunk-PGMPBC5Q.js +0 -1
  881. package/.output/server/node_modules/remeda/dist/chunk-PIX5OHMW.js +0 -1
  882. package/.output/server/node_modules/remeda/dist/chunk-PULGOXDA.js +0 -1
  883. package/.output/server/node_modules/remeda/dist/chunk-PVYOMZ3I.js +0 -1
  884. package/.output/server/node_modules/remeda/dist/chunk-Q5ASJ5N7.js +0 -1
  885. package/.output/server/node_modules/remeda/dist/chunk-QDGUNRDA.js +0 -1
  886. package/.output/server/node_modules/remeda/dist/chunk-QDOP3ITN.js +0 -1
  887. package/.output/server/node_modules/remeda/dist/chunk-QEKOZYJ5.js +0 -1
  888. package/.output/server/node_modules/remeda/dist/chunk-QOEIYQAG.js +0 -1
  889. package/.output/server/node_modules/remeda/dist/chunk-QTQTP2VB.js +0 -1
  890. package/.output/server/node_modules/remeda/dist/chunk-R72GEKLP.js +0 -1
  891. package/.output/server/node_modules/remeda/dist/chunk-R7PILVSQ.js +0 -1
  892. package/.output/server/node_modules/remeda/dist/chunk-RBODUO3Q.js +0 -1
  893. package/.output/server/node_modules/remeda/dist/chunk-RZUYD7QY.js +0 -1
  894. package/.output/server/node_modules/remeda/dist/chunk-S52RID4A.js +0 -1
  895. package/.output/server/node_modules/remeda/dist/chunk-SBKJLULJ.js +0 -1
  896. package/.output/server/node_modules/remeda/dist/chunk-SDLIKNSY.js +0 -1
  897. package/.output/server/node_modules/remeda/dist/chunk-SFZGYJFI.js +0 -1
  898. package/.output/server/node_modules/remeda/dist/chunk-SGAFZVQH.js +0 -1
  899. package/.output/server/node_modules/remeda/dist/chunk-SSDL7ATG.js +0 -1
  900. package/.output/server/node_modules/remeda/dist/chunk-T4H4IOYC.js +0 -1
  901. package/.output/server/node_modules/remeda/dist/chunk-T4PLMLCP.js +0 -1
  902. package/.output/server/node_modules/remeda/dist/chunk-T5XG33UI.js +0 -1
  903. package/.output/server/node_modules/remeda/dist/chunk-U753ZCO5.js +0 -1
  904. package/.output/server/node_modules/remeda/dist/chunk-UA6DVSZ3.js +0 -1
  905. package/.output/server/node_modules/remeda/dist/chunk-UHDYHGOF.js +0 -1
  906. package/.output/server/node_modules/remeda/dist/chunk-UZ6BOIAH.js +0 -1
  907. package/.output/server/node_modules/remeda/dist/chunk-V6HCOU6T.js +0 -1
  908. package/.output/server/node_modules/remeda/dist/chunk-VCYTMP4D.js +0 -1
  909. package/.output/server/node_modules/remeda/dist/chunk-VFECZ57D.js +0 -1
  910. package/.output/server/node_modules/remeda/dist/chunk-VFSOOVKJ.js +0 -1
  911. package/.output/server/node_modules/remeda/dist/chunk-VG2NVNXT.js +0 -1
  912. package/.output/server/node_modules/remeda/dist/chunk-VIBSXWWU.js +0 -1
  913. package/.output/server/node_modules/remeda/dist/chunk-VMV5GVZ5.js +0 -1
  914. package/.output/server/node_modules/remeda/dist/chunk-VO5MRBXA.js +0 -1
  915. package/.output/server/node_modules/remeda/dist/chunk-VVM5DH6Z.js +0 -1
  916. package/.output/server/node_modules/remeda/dist/chunk-W2ARC73P.js +0 -1
  917. package/.output/server/node_modules/remeda/dist/chunk-W6ZHPGFP.js +0 -1
  918. package/.output/server/node_modules/remeda/dist/chunk-WFMWIRTS.js +0 -1
  919. package/.output/server/node_modules/remeda/dist/chunk-WIMGWYZL.js +0 -1
  920. package/.output/server/node_modules/remeda/dist/chunk-WOUS55DT.js +0 -1
  921. package/.output/server/node_modules/remeda/dist/chunk-WPTI67A4.js +0 -1
  922. package/.output/server/node_modules/remeda/dist/chunk-WWPMIW33.js +0 -1
  923. package/.output/server/node_modules/remeda/dist/chunk-WZOX4VKU.js +0 -1
  924. package/.output/server/node_modules/remeda/dist/chunk-XE3XIKTJ.js +0 -1
  925. package/.output/server/node_modules/remeda/dist/chunk-XHPQVWZM.js +0 -1
  926. package/.output/server/node_modules/remeda/dist/chunk-XMLUDZIW.js +0 -1
  927. package/.output/server/node_modules/remeda/dist/chunk-XPCYQPKH.js +0 -1
  928. package/.output/server/node_modules/remeda/dist/chunk-XUX3ZEXI.js +0 -1
  929. package/.output/server/node_modules/remeda/dist/chunk-XWBKJZIP.js +0 -1
  930. package/.output/server/node_modules/remeda/dist/chunk-XZ6COQKM.js +0 -1
  931. package/.output/server/node_modules/remeda/dist/chunk-Y3VKZ3P5.js +0 -1
  932. package/.output/server/node_modules/remeda/dist/chunk-YDIA5YQI.js +0 -1
  933. package/.output/server/node_modules/remeda/dist/chunk-YNNF733L.js +0 -1
  934. package/.output/server/node_modules/remeda/dist/chunk-YRJ25UV2.js +0 -1
  935. package/.output/server/node_modules/remeda/dist/chunk-YVJOC2U3.js +0 -1
  936. package/.output/server/node_modules/remeda/dist/chunk-YVMG2XEU.js +0 -1
  937. package/.output/server/node_modules/remeda/dist/chunk-ZJS5DNQW.js +0 -1
  938. package/.output/server/node_modules/remeda/dist/chunk-ZP6YI2JT.js +0 -1
  939. package/.output/server/node_modules/remeda/dist/chunk-ZRKG4NSC.js +0 -1
  940. package/.output/server/node_modules/remeda/dist/index.js +0 -1
  941. package/.output/server/node_modules/remeda/package.json +0 -85
  942. package/.output/server/node_modules/resolve-alpn/index.js +0 -43
  943. package/.output/server/node_modules/resolve-alpn/package.json +0 -34
  944. package/.output/server/node_modules/responselike/package.json +0 -39
  945. package/.output/server/node_modules/responselike/src/index.js +0 -34
  946. package/.output/server/node_modules/safe-stable-stringify/index.js +0 -625
  947. package/.output/server/node_modules/safe-stable-stringify/package.json +0 -65
  948. package/.output/server/node_modules/semver/classes/comparator.js +0 -141
  949. package/.output/server/node_modules/semver/classes/range.js +0 -554
  950. package/.output/server/node_modules/semver/classes/semver.js +0 -318
  951. package/.output/server/node_modules/semver/functions/clean.js +0 -6
  952. package/.output/server/node_modules/semver/functions/cmp.js +0 -52
  953. package/.output/server/node_modules/semver/functions/coerce.js +0 -60
  954. package/.output/server/node_modules/semver/functions/compare-build.js +0 -7
  955. package/.output/server/node_modules/semver/functions/compare-loose.js +0 -3
  956. package/.output/server/node_modules/semver/functions/compare.js +0 -5
  957. package/.output/server/node_modules/semver/functions/diff.js +0 -58
  958. package/.output/server/node_modules/semver/functions/eq.js +0 -3
  959. package/.output/server/node_modules/semver/functions/gt.js +0 -3
  960. package/.output/server/node_modules/semver/functions/gte.js +0 -3
  961. package/.output/server/node_modules/semver/functions/inc.js +0 -19
  962. package/.output/server/node_modules/semver/functions/lt.js +0 -3
  963. package/.output/server/node_modules/semver/functions/lte.js +0 -3
  964. package/.output/server/node_modules/semver/functions/major.js +0 -3
  965. package/.output/server/node_modules/semver/functions/minor.js +0 -3
  966. package/.output/server/node_modules/semver/functions/neq.js +0 -3
  967. package/.output/server/node_modules/semver/functions/parse.js +0 -16
  968. package/.output/server/node_modules/semver/functions/patch.js +0 -3
  969. package/.output/server/node_modules/semver/functions/prerelease.js +0 -6
  970. package/.output/server/node_modules/semver/functions/rcompare.js +0 -3
  971. package/.output/server/node_modules/semver/functions/rsort.js +0 -3
  972. package/.output/server/node_modules/semver/functions/satisfies.js +0 -10
  973. package/.output/server/node_modules/semver/functions/sort.js +0 -3
  974. package/.output/server/node_modules/semver/functions/valid.js +0 -6
  975. package/.output/server/node_modules/semver/index.js +0 -89
  976. package/.output/server/node_modules/semver/internal/constants.js +0 -35
  977. package/.output/server/node_modules/semver/internal/debug.js +0 -9
  978. package/.output/server/node_modules/semver/internal/identifiers.js +0 -23
  979. package/.output/server/node_modules/semver/internal/lrucache.js +0 -40
  980. package/.output/server/node_modules/semver/internal/parse-options.js +0 -15
  981. package/.output/server/node_modules/semver/internal/re.js +0 -219
  982. package/.output/server/node_modules/semver/package.json +0 -78
  983. package/.output/server/node_modules/semver/preload.js +0 -2
  984. package/.output/server/node_modules/semver/ranges/gtr.js +0 -4
  985. package/.output/server/node_modules/semver/ranges/intersects.js +0 -7
  986. package/.output/server/node_modules/semver/ranges/ltr.js +0 -4
  987. package/.output/server/node_modules/semver/ranges/max-satisfying.js +0 -25
  988. package/.output/server/node_modules/semver/ranges/min-satisfying.js +0 -24
  989. package/.output/server/node_modules/semver/ranges/min-version.js +0 -61
  990. package/.output/server/node_modules/semver/ranges/outside.js +0 -80
  991. package/.output/server/node_modules/semver/ranges/simplify.js +0 -47
  992. package/.output/server/node_modules/semver/ranges/subset.js +0 -247
  993. package/.output/server/node_modules/semver/ranges/to-comparators.js +0 -8
  994. package/.output/server/node_modules/semver/ranges/valid.js +0 -11
  995. package/.output/server/node_modules/shebang-command/index.js +0 -19
  996. package/.output/server/node_modules/shebang-command/package.json +0 -34
  997. package/.output/server/node_modules/shebang-regex/index.js +0 -2
  998. package/.output/server/node_modules/shebang-regex/package.json +0 -35
  999. package/.output/server/node_modules/signal-exit/index.js +0 -202
  1000. package/.output/server/node_modules/signal-exit/package.json +0 -38
  1001. package/.output/server/node_modules/signal-exit/signals.js +0 -53
  1002. package/.output/server/node_modules/sonic-boom/index.js +0 -719
  1003. package/.output/server/node_modules/sonic-boom/package.json +0 -52
  1004. package/.output/server/node_modules/split2/index.js +0 -141
  1005. package/.output/server/node_modules/split2/package.json +0 -39
  1006. package/.output/server/node_modules/strip-final-newline/index.js +0 -16
  1007. package/.output/server/node_modules/strip-final-newline/package.json +0 -40
  1008. package/.output/server/node_modules/stubborn-fs/dist/attemptify.js +0 -19
  1009. package/.output/server/node_modules/stubborn-fs/dist/constants.js +0 -8
  1010. package/.output/server/node_modules/stubborn-fs/dist/handlers.js +0 -36
  1011. package/.output/server/node_modules/stubborn-fs/dist/index.js +0 -53
  1012. package/.output/server/node_modules/stubborn-fs/dist/retryify.js +0 -46
  1013. package/.output/server/node_modules/stubborn-fs/dist/retryify_queue.js +0 -62
  1014. package/.output/server/node_modules/stubborn-fs/package.json +0 -28
  1015. package/.output/server/node_modules/thread-stream/index.js +0 -537
  1016. package/.output/server/node_modules/thread-stream/lib/indexes.js +0 -9
  1017. package/.output/server/node_modules/thread-stream/lib/wait.js +0 -61
  1018. package/.output/server/node_modules/thread-stream/lib/worker.js +0 -174
  1019. package/.output/server/node_modules/thread-stream/package.json +0 -57
  1020. package/.output/server/node_modules/tiny-readdir/dist/constants.js +0 -9
  1021. package/.output/server/node_modules/tiny-readdir/dist/index.js +0 -185
  1022. package/.output/server/node_modules/tiny-readdir/dist/utils.js +0 -9
  1023. package/.output/server/node_modules/tiny-readdir/package.json +0 -35
  1024. package/.output/server/node_modules/tinyexec/dist/main.js +0 -578
  1025. package/.output/server/node_modules/tinyexec/package.json +0 -66
  1026. package/.output/server/node_modules/tmp/lib/tmp.js +0 -784
  1027. package/.output/server/node_modules/tmp/package.json +0 -56
  1028. package/.output/server/node_modules/upath/build/code/upath.js +0 -171
  1029. package/.output/server/node_modules/upath/package.json +0 -60
  1030. package/.output/server/node_modules/uuidv7/dist/index.js +0 -403
  1031. package/.output/server/node_modules/uuidv7/package.json +0 -47
  1032. package/.output/server/node_modules/watcher/dist/constants.js +0 -16
  1033. package/.output/server/node_modules/watcher/dist/enums.js +0 -35
  1034. package/.output/server/node_modules/watcher/dist/lazy_map_set.js +0 -81
  1035. package/.output/server/node_modules/watcher/dist/utils.js +0 -120
  1036. package/.output/server/node_modules/watcher/dist/watcher.js +0 -396
  1037. package/.output/server/node_modules/watcher/dist/watcher_handler.js +0 -248
  1038. package/.output/server/node_modules/watcher/dist/watcher_locker.js +0 -139
  1039. package/.output/server/node_modules/watcher/dist/watcher_locks_resolver.js +0 -42
  1040. package/.output/server/node_modules/watcher/dist/watcher_poller.js +0 -116
  1041. package/.output/server/node_modules/watcher/dist/watcher_stats.js +0 -29
  1042. package/.output/server/node_modules/watcher/package.json +0 -37
  1043. package/.output/server/node_modules/which/package.json +0 -43
  1044. package/.output/server/node_modules/which/which.js +0 -125
  1045. package/.output/server/node_modules/wrappy/package.json +0 -29
  1046. package/.output/server/node_modules/wrappy/wrappy.js +0 -33
@@ -1,6 +1,6 @@
1
1
  import process from 'node:process';globalThis._importMeta_={url:import.meta.url,env:process.env};import http, { Server as Server$1 } from 'node:http';
2
2
  import https, { Server } from 'node:https';
3
- import nodeCrypto, { randomUUID as randomUUID$1 } from 'node:crypto';
3
+ import nodeCrypto from 'node:crypto';
4
4
  import require$$0$3 from 'events';
5
5
  import require$$2 from 'http';
6
6
  import require$$0$2 from 'stream';
@@ -14,27 +14,15 @@ import require$$7 from 'url';
14
14
  import { resolveResponse } from '@trpc/server/http';
15
15
  import { initTRPC, TRPCError } from '@trpc/server';
16
16
  import { z } from 'zod';
17
- import { pino } from 'pino';
18
- import { tmpdir, homedir } from 'node:os';
19
- import { resolve as resolve$1, dirname as dirname$1, join, basename, relative } from 'node:path';
20
- import { Readable as Readable$1, PassThrough } from 'node:stream';
21
- import { readdir as readdir$1, readFile as readFile$1, writeFile as writeFile$1, mkdir } from 'node:fs/promises';
22
- import spawn from 'nano-spawn';
23
- import { EventEmitter as EventEmitter$2, on } from 'node:events';
24
- import { fileURLToPath } from 'node:url';
25
- import { ensureDependencyInstalled } from 'nypm';
26
- import { pickBy, mapKeys, mapValues, omit, unique, fromEntries, funnel, pick } from 'remeda';
27
- import { resolve as resolve$2 } from 'import-meta-resolve';
28
- import { sha256 } from 'crypto-hash';
29
- import { BetterLock } from 'better-lock';
30
- import { findWorkspaceDir, readPackageJSON } from 'pkg-types';
31
- import { uuidv7 } from 'uuidv7';
32
- import { Worker } from 'node:worker_threads';
33
- import Watcher from 'watcher';
17
+ import { parseInstanceId } from '@highstate/contract';
18
+ import { SecretAccessDeniedError, getSharedServices } from '@highstate/backend';
19
+ import { hubModelPatchSchema, hubModelSchema, instanceModelSchema, instanceModelPatchSchema, projectOperationRequestSchema } from '@highstate/backend/shared';
34
20
  import { getRequestDependencies, getPreloadLinks, getPrefetchLinks, createRenderer } from 'vue-bundle-renderer/runtime';
35
21
  import { stringify as stringify$1, uneval } from 'devalue';
36
22
  import { propsToString, renderSSRHead } from '@unhead/ssr';
37
23
  import { promises, existsSync } from 'node:fs';
24
+ import { resolve as resolve$1, dirname as dirname$1, join } from 'node:path';
25
+ import { fileURLToPath } from 'node:url';
38
26
  import { createServerHead as createServerHead$1, CapoPlugin } from 'unhead';
39
27
  import { unref, version } from 'vue';
40
28
  import { defineHeadPlugin } from '@unhead/shared';
@@ -7858,8 +7846,8 @@ function createNodeFetch() {
7858
7846
  }
7859
7847
  const fetch = globalThis.fetch ? (...args) => globalThis.fetch(...args) : createNodeFetch();
7860
7848
  const Headers$1 = globalThis.Headers || s;
7861
- const AbortController$1 = globalThis.AbortController || i;
7862
- createFetch$1({ fetch, Headers: Headers$1, AbortController: AbortController$1 });
7849
+ const AbortController = globalThis.AbortController || i;
7850
+ createFetch$1({ fetch, Headers: Headers$1, AbortController });
7863
7851
 
7864
7852
  function rawHeaders(headers) {
7865
7853
  const rawHeaders2 = [];
@@ -8703,114 +8691,114 @@ const assets$1 = {
8703
8691
  "/favicon.ico": {
8704
8692
  "type": "image/vnd.microsoft.icon",
8705
8693
  "etag": "\"10be-n8egyE9tcb7sKGr/pYCaQ4uWqxI\"",
8706
- "mtime": "2025-03-12T08:50:50.345Z",
8694
+ "mtime": "2025-03-13T15:46:35.139Z",
8707
8695
  "size": 4286,
8708
8696
  "path": "../public/favicon.ico"
8709
8697
  },
8710
8698
  "/libavoid.wasm": {
8711
8699
  "type": "application/wasm",
8712
8700
  "etag": "\"766e3-UHfBWRoZIr7ZrE8DM+K3aPbBHHs\"",
8713
- "mtime": "2025-03-12T08:50:50.346Z",
8701
+ "mtime": "2025-03-13T15:46:35.139Z",
8714
8702
  "size": 485091,
8715
8703
  "path": "../public/libavoid.wasm"
8716
8704
  },
8717
8705
  "/robots.txt": {
8718
8706
  "type": "text/plain; charset=utf-8",
8719
8707
  "etag": "\"1-rcg7GeeTSRscbqD9i0bNnzLlkvw\"",
8720
- "mtime": "2025-03-12T08:50:50.345Z",
8708
+ "mtime": "2025-03-13T15:46:35.140Z",
8721
8709
  "size": 1,
8722
8710
  "path": "../public/robots.txt"
8723
8711
  },
8724
- "/_nuxt/BA0u-n1q.js": {
8725
- "type": "text/javascript; charset=utf-8",
8726
- "etag": "\"2e69ec-I67F4iAuM8BB51dVOA0nCKtaTbY\"",
8727
- "mtime": "2025-03-12T08:50:50.339Z",
8728
- "size": 3041772,
8729
- "path": "../public/_nuxt/BA0u-n1q.js"
8730
- },
8731
- "/_nuxt/B_hR0Ok_.js": {
8712
+ "/_nuxt/CDvc066L.js": {
8732
8713
  "type": "text/javascript; charset=utf-8",
8733
- "etag": "\"24e4-RJFyfHcR8oLj9Sf/RtxT59EJmB4\"",
8734
- "mtime": "2025-03-12T08:50:50.334Z",
8714
+ "etag": "\"24e4-+jqAx6qFy5SKHJwAj2O794Tdcbo\"",
8715
+ "mtime": "2025-03-13T15:46:35.128Z",
8735
8716
  "size": 9444,
8736
- "path": "../public/_nuxt/B_hR0Ok_.js"
8717
+ "path": "../public/_nuxt/CDvc066L.js"
8737
8718
  },
8738
- "/_nuxt/Cj8SV8PB.js": {
8719
+ "/_nuxt/D0Jq3pX9.js": {
8739
8720
  "type": "text/javascript; charset=utf-8",
8740
- "etag": "\"d52-3iXtEdxPn2aBl5doZoJysdkuhfM\"",
8741
- "mtime": "2025-03-12T08:50:50.336Z",
8742
- "size": 3410,
8743
- "path": "../public/_nuxt/Cj8SV8PB.js"
8721
+ "etag": "\"2e8e29-z/bd41TWP4osYIwxeZO04xqSJCg\"",
8722
+ "mtime": "2025-03-13T15:46:35.131Z",
8723
+ "size": 3051049,
8724
+ "path": "../public/_nuxt/D0Jq3pX9.js"
8744
8725
  },
8745
- "/_nuxt/DE7L338O.js": {
8726
+ "/_nuxt/DOPM99N_.js": {
8746
8727
  "type": "text/javascript; charset=utf-8",
8747
- "etag": "\"180-YHhGncYlIbnPEJ0dtqKkGJ8LjXE\"",
8748
- "mtime": "2025-03-12T08:50:50.334Z",
8728
+ "etag": "\"180-CrBGOorbKNbqQRD0gmnALlvm39I\"",
8729
+ "mtime": "2025-03-13T15:46:35.124Z",
8749
8730
  "size": 384,
8750
- "path": "../public/_nuxt/DE7L338O.js"
8731
+ "path": "../public/_nuxt/DOPM99N_.js"
8732
+ },
8733
+ "/_nuxt/Dx2bEYXH.js": {
8734
+ "type": "text/javascript; charset=utf-8",
8735
+ "etag": "\"d52-Ay8ELiP5t9RXGTJSuzUiP4Fz0EY\"",
8736
+ "mtime": "2025-03-13T15:46:35.124Z",
8737
+ "size": 3410,
8738
+ "path": "../public/_nuxt/Dx2bEYXH.js"
8751
8739
  },
8752
- "/_nuxt/entry.7p8V-3Ph.css": {
8740
+ "/_nuxt/entry.VNeMltv3.css": {
8753
8741
  "type": "text/css; charset=utf-8",
8754
- "etag": "\"9cab0-3yvv6HVuNw9F+4Lip03axZMjgsc\"",
8755
- "mtime": "2025-03-12T08:50:50.335Z",
8756
- "size": 641712,
8757
- "path": "../public/_nuxt/entry.7p8V-3Ph.css"
8742
+ "etag": "\"9cd57-ryYCZAd1Tpuq2Ku/MpNkfOb0IlM\"",
8743
+ "mtime": "2025-03-13T15:46:35.125Z",
8744
+ "size": 642391,
8745
+ "path": "../public/_nuxt/entry.VNeMltv3.css"
8758
8746
  },
8759
8747
  "/_nuxt/error-404.BJkSn6RI.css": {
8760
8748
  "type": "text/css; charset=utf-8",
8761
8749
  "etag": "\"de4-r9xtDsKTiqf+9Q1gboMnptHSjqc\"",
8762
- "mtime": "2025-03-12T08:50:50.334Z",
8750
+ "mtime": "2025-03-13T15:46:35.126Z",
8763
8751
  "size": 3556,
8764
8752
  "path": "../public/_nuxt/error-404.BJkSn6RI.css"
8765
8753
  },
8766
8754
  "/_nuxt/error-500.TOCKLquH.css": {
8767
8755
  "type": "text/css; charset=utf-8",
8768
8756
  "etag": "\"75c-UgDuztSkituCmi5v2gpTJ/CXJTw\"",
8769
- "mtime": "2025-03-12T08:50:50.336Z",
8757
+ "mtime": "2025-03-13T15:46:35.125Z",
8770
8758
  "size": 1884,
8771
8759
  "path": "../public/_nuxt/error-500.TOCKLquH.css"
8772
8760
  },
8773
8761
  "/_nuxt/materialdesignicons-webfont.B6OSyW2I.woff2": {
8774
8762
  "type": "font/woff2",
8775
8763
  "etag": "\"4f67c-W8lIr//mYzY5FU4CS/BHzz74EyY\"",
8776
- "mtime": "2025-03-12T08:50:50.336Z",
8764
+ "mtime": "2025-03-13T15:46:35.125Z",
8777
8765
  "size": 325244,
8778
8766
  "path": "../public/_nuxt/materialdesignicons-webfont.B6OSyW2I.woff2"
8779
8767
  },
8780
8768
  "/_nuxt/materialdesignicons-webfont.BpRar1d5.ttf": {
8781
8769
  "type": "font/ttf",
8782
8770
  "etag": "\"fa880-nkfshQEtwwStQS/6eMVMGW/xVqE\"",
8783
- "mtime": "2025-03-12T08:50:50.339Z",
8771
+ "mtime": "2025-03-13T15:46:35.127Z",
8784
8772
  "size": 1026176,
8785
8773
  "path": "../public/_nuxt/materialdesignicons-webfont.BpRar1d5.ttf"
8786
8774
  },
8787
8775
  "/_nuxt/materialdesignicons-webfont.Bvl3VxMs.woff": {
8788
8776
  "type": "font/woff",
8789
8777
  "etag": "\"71924-jzj1x+KrB1ZBtcEM3SXV+zN4+UU\"",
8790
- "mtime": "2025-03-12T08:50:50.337Z",
8778
+ "mtime": "2025-03-13T15:46:35.128Z",
8791
8779
  "size": 465188,
8792
8780
  "path": "../public/_nuxt/materialdesignicons-webfont.Bvl3VxMs.woff"
8793
8781
  },
8794
8782
  "/_nuxt/materialdesignicons-webfont.TEmAk13K.eot": {
8795
8783
  "type": "application/vnd.ms-fontobject",
8796
8784
  "etag": "\"fa95c-6ehgxBKVuQrh1OSTYvzSxNh2cco\"",
8797
- "mtime": "2025-03-12T08:50:50.339Z",
8785
+ "mtime": "2025-03-13T15:46:35.132Z",
8798
8786
  "size": 1026396,
8799
8787
  "path": "../public/_nuxt/materialdesignicons-webfont.TEmAk13K.eot"
8800
8788
  },
8801
8789
  "/_nuxt/builds/latest.json": {
8802
8790
  "type": "application/json",
8803
- "etag": "\"47-GF6YtFSchsnd8nK/a2Lr+DruB0o\"",
8804
- "mtime": "2025-03-12T08:50:50.322Z",
8791
+ "etag": "\"47-1fri3LB/F+dDpUPbv03igeXC4tw\"",
8792
+ "mtime": "2025-03-13T15:46:35.110Z",
8805
8793
  "size": 71,
8806
8794
  "path": "../public/_nuxt/builds/latest.json"
8807
8795
  },
8808
- "/_nuxt/builds/meta/befe985c-c66f-4500-9488-46464c80fbfc.json": {
8796
+ "/_nuxt/builds/meta/cb8636dd-e396-496a-9bd3-892327ee4ea5.json": {
8809
8797
  "type": "application/json",
8810
- "etag": "\"8b-Dy4sBIqTYyljp99wPVC+I0zZwlo\"",
8811
- "mtime": "2025-03-12T08:50:50.316Z",
8798
+ "etag": "\"8b-OoVy5ynutPFlr2eWhRK1c4PUr68\"",
8799
+ "mtime": "2025-03-13T15:46:35.104Z",
8812
8800
  "size": 139,
8813
- "path": "../public/_nuxt/builds/meta/befe985c-c66f-4500-9488-46464c80fbfc.json"
8801
+ "path": "../public/_nuxt/builds/meta/cb8636dd-e396-496a-9bd3-892327ee4ea5.json"
8814
8802
  }
8815
8803
  };
8816
8804
 
@@ -9342,16 +9330,16 @@ function isNativeFunction(f) {
9342
9330
  return Function.prototype.toString.call(f).slice(-nativeFuncLength) === nativeFunc;
9343
9331
  }
9344
9332
 
9345
- var __defProp$1$1 = Object.defineProperty;
9346
- var __defNormalProp$1$1 = (obj, key, value) => key in obj ? __defProp$1$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9347
- var __publicField$1$1 = (obj, key, value) => {
9348
- __defNormalProp$1$1(obj, typeof key !== "symbol" ? key + "" : key, value);
9333
+ var __defProp$1 = Object.defineProperty;
9334
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9335
+ var __publicField$1 = (obj, key, value) => {
9336
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
9349
9337
  return value;
9350
9338
  };
9351
9339
  class WordArray {
9352
9340
  constructor(words, sigBytes) {
9353
- __publicField$1$1(this, "words");
9354
- __publicField$1$1(this, "sigBytes");
9341
+ __publicField$1(this, "words");
9342
+ __publicField$1(this, "sigBytes");
9355
9343
  words = this.words = words || [];
9356
9344
  this.sigBytes = sigBytes === void 0 ? words.length * 4 : sigBytes;
9357
9345
  }
@@ -9424,10 +9412,10 @@ const Utf8 = {
9424
9412
  };
9425
9413
  class BufferedBlockAlgorithm {
9426
9414
  constructor() {
9427
- __publicField$1$1(this, "_data", new WordArray());
9428
- __publicField$1$1(this, "_nDataBytes", 0);
9429
- __publicField$1$1(this, "_minBufferSize", 0);
9430
- __publicField$1$1(this, "blockSize", 512 / 32);
9415
+ __publicField$1(this, "_data", new WordArray());
9416
+ __publicField$1(this, "_nDataBytes", 0);
9417
+ __publicField$1(this, "_minBufferSize", 0);
9418
+ __publicField$1(this, "blockSize", 512 / 32);
9431
9419
  }
9432
9420
  reset() {
9433
9421
  this._data = new WordArray();
@@ -9475,10 +9463,10 @@ class Hasher extends BufferedBlockAlgorithm {
9475
9463
  }
9476
9464
  }
9477
9465
 
9478
- var __defProp$7 = Object.defineProperty;
9479
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9480
- var __publicField$7 = (obj, key, value) => {
9481
- __defNormalProp$7(obj, key + "" , value);
9466
+ var __defProp = Object.defineProperty;
9467
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9468
+ var __publicField = (obj, key, value) => {
9469
+ __defNormalProp(obj, key + "" , value);
9482
9470
  return value;
9483
9471
  };
9484
9472
  const H = [
@@ -9561,7 +9549,7 @@ const W = [];
9561
9549
  class SHA256 extends Hasher {
9562
9550
  constructor() {
9563
9551
  super(...arguments);
9564
- __publicField$7(this, "_hash", new WordArray([...H]));
9552
+ __publicField(this, "_hash", new WordArray([...H]));
9565
9553
  }
9566
9554
  /**
9567
9555
  * Resets the internal state of the hash object to initial values.
@@ -10928,7 +10916,7 @@ function _expandFromEnv(value) {
10928
10916
  const _inlineRuntimeConfig = {
10929
10917
  "app": {
10930
10918
  "baseURL": "/",
10931
- "buildId": "befe985c-c66f-4500-9488-46464c80fbfc",
10919
+ "buildId": "cb8636dd-e396-496a-9bd3-892327ee4ea5",
10932
10920
  "buildAssetsDir": "/_nuxt/",
10933
10921
  "cdnURL": ""
10934
10922
  },
@@ -10955,7 +10943,9 @@ const _inlineRuntimeConfig = {
10955
10943
  }
10956
10944
  }
10957
10945
  },
10958
- "public": {}
10946
+ "public": {
10947
+ "version": "0.4.6"
10948
+ }
10959
10949
  };
10960
10950
  const envOptions = {
10961
10951
  prefix: "NITRO_",
@@ -11667,21 +11657,6 @@ const publicProcedure = t.procedure;
11667
11657
  const router = t.router;
11668
11658
  t.middleware;
11669
11659
 
11670
- function getInstanceId(instanceType, instanceName) {
11671
- return `${instanceType}:${instanceName}`;
11672
- }
11673
- function parseInstanceId(instanceId) {
11674
- const parts = instanceId.split(":");
11675
- if (parts.length !== 2) {
11676
- throw new Error(`Invalid instance key: ${instanceId}`);
11677
- }
11678
- return parts;
11679
- }
11680
-
11681
- function isUnitModel(model) {
11682
- return "source" in model;
11683
- }
11684
-
11685
11660
  const stateRouter = router({
11686
11661
  getInstanceStates: publicProcedure.input(
11687
11662
  z.object({
@@ -11735,3561 +11710,81 @@ const stateRouter = router({
11735
11710
  })
11736
11711
  });
11737
11712
 
11738
- class SecretAccessDeniedError extends Error {
11739
- constructor(projectId, key) {
11740
- super(`Access to the secrets of component "${projectId}.${key}" is denied.`);
11741
- }
11742
- }
11743
-
11744
- async function runWithRetryOnError(runner, tryHandleError, maxRetries = 1) {
11745
- let lastError;
11746
- for (let i = 0; i < maxRetries + 1; i++) {
11713
+ const secretRouter = router({
11714
+ isLocked: publicProcedure.input(
11715
+ z.object({
11716
+ projectId: z.string()
11717
+ })
11718
+ ).query(async ({ input, ctx }) => {
11719
+ var _a, _b;
11720
+ const isLocked = await ((_b = (_a = ctx.secretBackend).isLocked) == null ? void 0 : _b.call(_a, input.projectId));
11721
+ return isLocked != null ? isLocked : false;
11722
+ }),
11723
+ unlock: publicProcedure.input(
11724
+ z.object({
11725
+ projectId: z.string(),
11726
+ passphrase: z.string()
11727
+ })
11728
+ ).mutation(async ({ input, ctx }) => {
11729
+ if (!ctx.secretBackend.unlock) {
11730
+ throw new Error("The secret backend does not support unlocking.");
11731
+ }
11732
+ return await ctx.secretBackend.unlock(input.projectId, input.passphrase);
11733
+ }),
11734
+ get: publicProcedure.input(
11735
+ z.object({
11736
+ projectId: z.string(),
11737
+ instanceKey: z.string()
11738
+ })
11739
+ ).query(async ({ input, ctx }) => {
11747
11740
  try {
11748
- return await runner();
11741
+ return await ctx.secretBackend.get(input.projectId, input.instanceKey);
11749
11742
  } catch (e) {
11750
- lastError = e;
11751
- if (await tryHandleError(e)) {
11752
- continue;
11743
+ if (e instanceof SecretAccessDeniedError) {
11744
+ throw new TRPCError({
11745
+ code: "FORBIDDEN",
11746
+ message: "Access to the secret is denied",
11747
+ cause: e
11748
+ });
11753
11749
  }
11754
11750
  throw e;
11755
11751
  }
11756
- }
11757
- throw lastError;
11758
- }
11759
- class AbortError extends Error {
11760
- constructor() {
11761
- super("Operation aborted");
11762
- }
11763
- }
11764
- function isAbortError(error) {
11765
- return error instanceof Error && error.name === "AbortError";
11766
- }
11767
- const stringArrayType = z.string().transform((args) => args.split(",").map((arg) => arg.trim()));
11768
- function errorToString(error) {
11769
- if (error instanceof Error) {
11770
- return error.stack || error.message;
11771
- }
11772
- return JSON.stringify(error);
11773
- }
11774
- function arrayAccumulator(values, value) {
11775
- if (!values) {
11776
- return [value];
11777
- }
11778
- return [...values, value];
11779
- }
11780
-
11781
- var __defProp$6 = Object.defineProperty;
11782
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11783
- var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
11784
- var _a;
11785
- class LocalPulumiHost {
11786
- constructor(logger) {
11787
- this.logger = logger;
11788
- __publicField$6(this, "lock", new BetterLock());
11789
- __publicField$6(this, "sharedPassword", (_a = process.env.PULUMI_CONFIG_PASSPHRASE) != null ? _a : "");
11790
- __publicField$6(this, "passwords", /* @__PURE__ */ new Map());
11791
- }
11792
- async getCurrentUser() {
11793
- const { LocalWorkspace } = await import('@pulumi/pulumi/automation/index.js');
11794
- const workspace = await LocalWorkspace.create({});
11795
- try {
11796
- return await workspace.whoAmI();
11797
- } catch (error) {
11798
- this.logger.error({ msg: "failed to get current user", error });
11799
- return null;
11800
- }
11801
- }
11802
- async runInline(projectId, pulumiProjectName, pulumiStackName, program, fn) {
11803
- return await this.lock.acquire(`${pulumiProjectName}.${pulumiStackName}`, async () => {
11804
- const { LocalWorkspace } = await import('@pulumi/pulumi/automation/index.js');
11805
- const stack = await LocalWorkspace.createOrSelectStack(
11806
- {
11807
- projectName: pulumiProjectName,
11808
- stackName: pulumiStackName,
11809
- program
11810
- },
11811
- {
11812
- projectSettings: {
11813
- name: pulumiProjectName,
11814
- runtime: "nodejs"
11815
- },
11816
- envVars: {
11817
- PULUMI_CONFIG_PASSPHRASE: this.getPassword(projectId),
11818
- PULUMI_K8S_AWAIT_ALL: "true"
11819
- }
11820
- }
11821
- );
11822
- try {
11823
- return await runWithRetryOnError(
11824
- () => fn(stack),
11825
- (error) => this.tryUnlockStack(stack, error)
11826
- );
11827
- } catch (e) {
11828
- if (e instanceof Error && e.message.includes("canceled")) {
11829
- throw new AbortError();
11830
- }
11831
- throw e;
11832
- }
11833
- });
11834
- }
11835
- async runEmpty(projectId, pulumiProjectName, pulumiStackName, fn) {
11836
- return await this.runInline(projectId, pulumiProjectName, pulumiStackName, async () => {
11837
- }, fn);
11838
- }
11839
- // TODO: extract args to options object
11840
- async runLocal(projectId, pulumiProjectName, pulumiStackName, programPathResolver, fn, stackConfig) {
11841
- return await this.lock.acquire(`${pulumiProjectName}.${pulumiStackName}`, async () => {
11842
- const { LocalWorkspace } = await import('@pulumi/pulumi/automation/index.js');
11843
- const stack = await LocalWorkspace.createOrSelectStack(
11844
- {
11845
- stackName: pulumiStackName,
11846
- workDir: await programPathResolver()
11847
- },
11848
- {
11849
- projectSettings: {
11850
- name: pulumiProjectName,
11851
- runtime: "nodejs"
11852
- },
11853
- stackSettings: stackConfig ? {
11854
- [pulumiStackName]: {
11855
- config: stackConfig
11856
- }
11857
- } : void 0,
11858
- envVars: {
11859
- PULUMI_CONFIG_PASSPHRASE: this.getPassword(projectId),
11860
- PULUMI_K8S_AWAIT_ALL: "true"
11861
- }
11862
- }
11863
- );
11864
- try {
11865
- return await runWithRetryOnError(
11866
- () => fn(stack),
11867
- (error) => this.tryUnlockStack(stack, error)
11868
- );
11869
- } catch (e) {
11870
- if (e instanceof Error && e.message.includes("canceled")) {
11871
- throw new AbortError();
11872
- }
11873
- throw e;
11874
- }
11875
- });
11876
- }
11877
- hasPassword(projectId) {
11878
- return !!this.sharedPassword || this.passwords.has(projectId);
11879
- }
11880
- setPassword(projectId, password) {
11881
- this.passwords.set(projectId, password);
11882
- }
11883
- getPassword(projectId) {
11884
- return this.sharedPassword || this.passwords.get(projectId) || "";
11885
- }
11886
- async tryUnlockStack(stack, error) {
11887
- if (error instanceof Error && error.message.includes("the stack is currently locked")) {
11888
- this.logger.warn({ stackName: stack.name }, "inlocking stack");
11889
- await stack.cancel();
11890
- return true;
11891
- }
11892
- return false;
11893
- }
11894
- static create(logger) {
11895
- return new LocalPulumiHost(logger.child({ service: "LocalPulumiHost" }));
11896
- }
11897
- }
11898
- function valueToString(value) {
11899
- if (typeof value === "string") {
11900
- return value;
11901
- }
11902
- return JSON.stringify(value);
11903
- }
11904
- function stringToValue(value) {
11905
- try {
11906
- return JSON.parse(value);
11907
- } catch {
11908
- return value;
11909
- }
11910
- }
11911
- function updateResourceCount(opType, currentCount) {
11912
- switch (opType) {
11913
- case "same":
11914
- case "create":
11915
- case "update":
11916
- case "replace":
11917
- case "create-replacement":
11918
- case "import":
11919
- case "import-replacement":
11920
- return currentCount + 1;
11921
- case "delete":
11922
- case "delete-replaced":
11923
- case "discard":
11924
- case "discard-replaced":
11925
- case "remove-pending-replace":
11926
- return currentCount - 1;
11927
- case "refresh":
11928
- case "read-replacement":
11929
- case "read":
11930
- return currentCount;
11931
- default:
11932
- throw new Error(`Unknown operation type: ${opType}`);
11933
- }
11934
- }
11935
-
11936
- async function resolveMainLocalProject(projectPath, projectName) {
11937
- if (!projectPath) {
11938
- projectPath = await findWorkspaceDir();
11939
- }
11940
- if (!projectName) {
11941
- const packageJson = await readPackageJSON(projectPath);
11942
- projectName = packageJson.name;
11943
- }
11944
- if (!projectName) {
11945
- projectName = basename(projectPath);
11946
- }
11947
- return [projectPath, projectName];
11948
- }
11949
-
11950
- const localSecretBackendConfig = z.object({
11951
- HIGHSTATE_BACKEND_SECRET_PROJECT_PATH: z.string().optional(),
11952
- HIGHSTATE_BACKEND_SECRET_PROJECT_NAME: z.string().optional()
11953
- });
11954
- class LocalSecretBackend {
11955
- constructor(projectPath, projectName, pulumiProjectHost, logger) {
11956
- this.projectPath = projectPath;
11957
- this.projectName = projectName;
11958
- this.pulumiProjectHost = pulumiProjectHost;
11959
- this.logger = logger;
11960
- this.logger.debug({ msg: "initialized", projectPath, projectName });
11961
- }
11962
- isLocked(projectId) {
11963
- return Promise.resolve(!this.pulumiProjectHost.hasPassword(projectId));
11964
- }
11965
- async unlock(projectId, password) {
11966
- this.pulumiProjectHost.setPassword(projectId, password);
11752
+ }),
11753
+ set: publicProcedure.input(
11754
+ z.object({
11755
+ projectId: z.string(),
11756
+ instanceId: z.string(),
11757
+ values: z.record(z.unknown())
11758
+ })
11759
+ ).mutation(async ({ input, ctx }) => {
11967
11760
  try {
11968
- await this.pulumiProjectHost.runLocal(
11969
- projectId,
11970
- this.projectName,
11971
- projectId,
11972
- () => this.projectPath,
11973
- async (stack) => {
11974
- this.logger.debug("checking password", { projectId });
11975
- await stack.info(true);
11976
- }
11977
- );
11978
- return true;
11979
- } catch (error) {
11980
- if (error instanceof Error) {
11981
- if (error.message.includes("incorrect passphrase")) {
11982
- return false;
11983
- }
11984
- }
11985
- throw error;
11986
- }
11987
- }
11988
- get(projectId, instanceId) {
11989
- return this.pulumiProjectHost.runLocal(
11990
- projectId,
11991
- this.projectName,
11992
- projectId,
11993
- () => this.projectPath,
11994
- async (stack) => {
11995
- this.logger.debug("getting secrets", { projectId, instanceId });
11996
- const config = await stack.getAllConfig();
11997
- const prefix = this.getPrefix(projectId, instanceId);
11998
- const secrets = pickBy(config, (_, key) => key.startsWith(prefix));
11999
- const trimmedSecrets = mapKeys(secrets, (key) => key.slice(prefix.length));
12000
- return mapValues(trimmedSecrets, (value) => stringToValue(value.value));
12001
- }
12002
- );
12003
- }
12004
- set(projectId, instanceId, values) {
12005
- return this.pulumiProjectHost.runLocal(
12006
- projectId,
12007
- this.projectName,
12008
- projectId,
12009
- () => this.projectPath,
12010
- async (stack) => {
12011
- this.logger.debug("setting secrets", { projectId, instanceId });
12012
- const componentSecrets = mapValues(
12013
- mapKeys(values, (key) => `${this.getPrefix(projectId, instanceId)}${key}`),
12014
- (value) => ({
12015
- value: valueToString(value),
12016
- secret: true
12017
- })
12018
- );
12019
- const config = await stack.getAllConfig();
12020
- Object.assign(config, componentSecrets);
12021
- await stack.setAllConfig(config);
12022
- }
12023
- );
12024
- }
12025
- getPrefix(projectId, instanceId) {
12026
- instanceId = instanceId.replace(/:/g, ".");
12027
- return `${this.projectName}:${projectId}/${instanceId}/`;
12028
- }
12029
- static async create(config, pulumiProjectHost, logger) {
12030
- const [projectPath, projectName] = await resolveMainLocalProject(
12031
- config.HIGHSTATE_BACKEND_SECRET_PROJECT_PATH,
12032
- config.HIGHSTATE_BACKEND_SECRET_PROJECT_NAME
12033
- );
12034
- return new LocalSecretBackend(
12035
- projectPath,
12036
- projectName,
12037
- pulumiProjectHost,
12038
- logger.child({ backend: "SecretBackend", service: "LocalSecretBackend" })
12039
- );
12040
- }
12041
- }
12042
-
12043
- const secretBackendConfig = z.object({
12044
- HIGHSTATE_BACKEND_SECRET_TYPE: z.enum(["local"]).default("local"),
12045
- ...localSecretBackendConfig.shape
12046
- });
12047
- function createSecretBackend(config, localPulumiHost, logger) {
12048
- switch (config.HIGHSTATE_BACKEND_SECRET_TYPE) {
12049
- case "local": {
12050
- return LocalSecretBackend.create(config, localPulumiHost, logger);
12051
- }
12052
- }
12053
- }
12054
-
12055
- var __defProp$5 = Object.defineProperty;
12056
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12057
- var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
12058
- const localLibraryBackendConfig = z.object({
12059
- HIGHSTATE_BACKEND_LIBRARY_LOCAL_MODULES: stringArrayType.default("@highstate/library")
12060
- });
12061
- class LocalLibraryBackend {
12062
- constructor(modulePaths, logger) {
12063
- this.modulePaths = modulePaths;
12064
- this.logger = logger;
12065
- __publicField$5(this, "watcher");
12066
- __publicField$5(this, "lock", new BetterLock());
12067
- __publicField$5(this, "eventEmitter", new EventEmitter$2());
12068
- __publicField$5(this, "library", null);
12069
- __publicField$5(this, "worker", null);
12070
- this.watcher = new Watcher(modulePaths, { recursive: true, ignoreInitial: true });
12071
- this.watcher.on("all", (event, path) => {
12072
- const prefixPath = modulePaths.find((modulePath) => path.startsWith(modulePath));
12073
- this.logger.info({ msg: "library event", event, path: relative(prefixPath, path) });
12074
- void this.lock.acquire(() => this.updateLibrary());
12075
- });
12076
- this.logger.debug({ msg: "initialized", modulePaths });
12077
- }
12078
- async loadLibrary() {
12079
- return await this.lock.acquire(async () => {
12080
- const [library] = await this.getLibrary();
12081
- return library;
12082
- });
12083
- }
12084
- async *watchLibrary(signal) {
12085
- for await (const [library] of on(this.eventEmitter, "library", { signal })) {
12086
- yield library;
12087
- }
12088
- }
12089
- async evaluateCompositeInstances(allInstances, instanceIds) {
12090
- return await this.lock.acquire(async () => {
12091
- this.logger.info("evaluating composite instances", { instanceIds });
12092
- const [, worker] = await this.getLibrary();
12093
- worker.postMessage({ type: "evaluate-composite-instances", allInstances, instanceIds });
12094
- this.logger.debug("evaluation request sent");
12095
- return this.getInstances(worker);
12096
- });
12097
- }
12098
- async evaluateModules(modulePaths) {
12099
- return await this.lock.acquire(async () => {
12100
- this.logger.info({ msg: "evaluating modules", modulePaths });
12101
- const [, worker] = await this.getLibrary();
12102
- worker.postMessage({ type: "evaluate-modules", modulePaths });
12103
- this.logger.debug("evaluation request sent");
12104
- return this.getInstances(worker);
12105
- });
12106
- }
12107
- async getInstances(worker) {
12108
- for await (const [event] of on(worker, "message")) {
12109
- const eventData = event;
12110
- if (eventData.type === "error") {
12111
- throw new Error(`Worker error: ${eventData.error}`);
12112
- }
12113
- if (eventData.type !== "instances") {
12114
- throw new Error(`Unexpected message type '${eventData.type}', expected 'instances'`);
12115
- }
12116
- return eventData.instances;
12117
- }
12118
- throw new Error("Worker ended without sending instances");
12119
- }
12120
- async getLibrary() {
12121
- if (this.library && this.worker) {
12122
- return [this.library, this.worker];
12123
- }
12124
- return await this.updateLibrary();
12125
- }
12126
- async updateLibrary() {
12127
- this.logger.info("creating library worker");
12128
- this.worker = this.createWorker({ modulePaths: this.modulePaths, logLevel: "silent" });
12129
- for await (const [event] of on(this.worker, "message")) {
12130
- const eventData = event;
12131
- if (eventData.type === "error") {
12132
- throw new Error(`Worker error: ${eventData.error}`);
12133
- }
12134
- if (eventData.type !== "library") {
12135
- throw new Error(`Unexpected message type '${eventData.type}', expected 'library'`);
12136
- }
12137
- this.eventEmitter.emit("library", eventData.library);
12138
- this.library = eventData.library;
12139
- this.logger.info("library reloaded");
12140
- return [this.library, this.worker];
12141
- }
12142
- throw new Error("Worker ended without sending library model");
12143
- }
12144
- createWorker(workerData) {
12145
- const workerPathUrl = resolve$2(`@highstate/backend/library-worker`, globalThis._importMeta_.url);
12146
- const workerPath = fileURLToPath(workerPathUrl);
12147
- return new Worker(workerPath, { workerData });
12148
- }
12149
- static create(config, logger) {
12150
- const modulePaths = [];
12151
- for (const module of config.HIGHSTATE_BACKEND_LIBRARY_LOCAL_MODULES) {
12152
- const url = resolve$2(module, globalThis._importMeta_.url);
12153
- let path = fileURLToPath(url);
12154
- if (basename(path).includes(".")) {
12155
- path = dirname$1(path);
11761
+ await ctx.secretBackend.set(input.projectId, input.instanceId, input.values);
11762
+ } catch (e) {
11763
+ if (e instanceof SecretAccessDeniedError) {
11764
+ throw new TRPCError({
11765
+ code: "FORBIDDEN",
11766
+ message: "Access to the secret is denied",
11767
+ cause: e
11768
+ });
12156
11769
  }
12157
- modulePaths.push(path);
12158
- }
12159
- return new LocalLibraryBackend(
12160
- modulePaths,
12161
- logger.child({ backend: "LibraryBackend", service: "LocalLibraryBackend" })
12162
- );
12163
- }
12164
- }
12165
-
12166
- const libraryBackendConfig = z.object({
12167
- HIGHSTATE_BACKEND_LIBRARY_TYPE: z.enum(["local"]).default("local"),
12168
- ...localLibraryBackendConfig.shape
12169
- });
12170
- function createLibraryBackend(config, logger) {
12171
- switch (config.HIGHSTATE_BACKEND_LIBRARY_TYPE) {
12172
- case "local": {
12173
- return LocalLibraryBackend.create(config, logger);
11770
+ throw e;
12174
11771
  }
12175
- }
12176
- }
12177
-
12178
- const positionSchema = z.object({
12179
- x: z.number(),
12180
- y: z.number()
12181
- });
12182
- const instanceInputSchema = z.object({
12183
- instanceId: z.string(),
12184
- output: z.string()
12185
- });
12186
- const hubInstanceInputSchema = z.object({
12187
- hubId: z.string()
12188
- });
12189
- const instanceModelPatchSchema = z.object({
12190
- args: z.record(z.unknown()).optional(),
12191
- inputs: z.record(z.array(instanceInputSchema)).optional(),
12192
- hubInputs: z.record(z.array(hubInstanceInputSchema)).optional(),
12193
- injectionInputs: z.array(hubInstanceInputSchema).optional(),
12194
- position: positionSchema.optional()
12195
- });
12196
- const instanceModelSchema = z.object({
12197
- id: z.string(),
12198
- type: z.string(),
12199
- name: z.string(),
12200
- ...instanceModelPatchSchema.shape,
12201
- parentId: z.string().optional(),
12202
- outputs: z.record(z.array(instanceInputSchema)).optional()
12203
- });
12204
- const compositeInstanceSchema = z.object({
12205
- instance: instanceModelSchema,
12206
- children: z.array(instanceModelSchema)
12207
- });
12208
- const hubModelPatchSchema = z.object({
12209
- position: positionSchema.optional(),
12210
- inputs: z.array(instanceInputSchema).optional(),
12211
- injectionInputs: z.array(hubInstanceInputSchema).optional()
12212
- });
12213
- const hubModelSchema = z.object({
12214
- id: z.string().nanoid(),
12215
- position: positionSchema,
12216
- inputs: z.array(instanceInputSchema).optional(),
12217
- injectionInputs: z.array(hubInstanceInputSchema).optional()
12218
- });
12219
-
12220
- const instanceStatusSchema = z.enum([
12221
- "not_created",
12222
- "updating",
12223
- "destroying",
12224
- "refreshing",
12225
- "created",
12226
- "error",
12227
- "pending",
12228
- "unknown"
12229
- ]);
12230
- const instanceStatusFieldSchema = z.object({
12231
- name: z.string(),
12232
- value: z.string().optional(),
12233
- displayName: z.string().optional(),
12234
- sensitive: z.boolean().optional(),
12235
- url: z.string().optional()
12236
- });
12237
- const instanceFileMetaSchema = z.object({
12238
- name: z.string(),
12239
- contentType: z.string(),
12240
- isBinary: z.boolean().optional()
12241
- });
12242
- const instanceFileSchema = z.object({
12243
- ...instanceFileMetaSchema.shape,
12244
- content: z.string()
12245
- });
12246
- const instancePageBlockSchema = z.union([
12247
- z.object({
12248
- type: z.literal("markdown"),
12249
- content: z.string()
12250
- }),
12251
- z.object({
12252
- type: z.literal("qr"),
12253
- content: z.string(),
12254
- showContent: z.coerce.boolean(),
12255
- language: z.string().optional()
12256
- }),
12257
- z.object({
12258
- type: z.literal("file"),
12259
- fileMeta: instanceFileMetaSchema
12260
- })
12261
- ]);
12262
- const instancePageMetaSchema = z.object({
12263
- name: z.string(),
12264
- title: z.string()
12265
- });
12266
- const instancePageSchema = z.object({
12267
- ...instancePageMetaSchema.shape,
12268
- content: z.array(instancePageBlockSchema)
12269
- });
12270
- const instanceTerminalMetaSchema = z.object({
12271
- name: z.string(),
12272
- title: z.string(),
12273
- description: z.string().optional()
12274
- });
12275
- const instanceTerminalFileSchema = z.object({
12276
- content: z.string().optional(),
12277
- isBinary: z.boolean().optional()
12278
- });
12279
- const instanceTerminalSchema = z.object({
12280
- ...instanceTerminalMetaSchema.shape,
12281
- image: z.string(),
12282
- command: z.string().array(),
12283
- cwd: z.string().optional(),
12284
- env: z.record(z.string()).optional(),
12285
- files: z.record(instanceTerminalFileSchema).optional()
12286
- });
12287
- const instanceTriggerSpecSchema = z.union([
12288
- z.object({
12289
- type: z.literal("before-destroy")
12290
- }),
12291
- z.object({
12292
- type: z.literal("schedule"),
12293
- schedule: z.string()
12294
11772
  })
12295
- ]);
12296
- const instanceTriggerSchema = z.object({
12297
- name: z.string(),
12298
- title: z.string(),
12299
- description: z.string().optional(),
12300
- spec: instanceTriggerSpecSchema
12301
- });
12302
- z.object({
12303
- name: z.string()
12304
- });
12305
- const instanceStateSchema = z.object({
12306
- id: z.string(),
12307
- parentId: z.string().nullable().default(null),
12308
- status: instanceStatusSchema,
12309
- latestOperationId: z.string().nullable().default(null),
12310
- currentResourceCount: z.number().nullable().default(null),
12311
- totalResourceCount: z.number().nullable().default(null),
12312
- inputHash: z.string().nullable().default(null),
12313
- outputHash: z.string().nullable().default(null),
12314
- error: z.string().nullable().default(null),
12315
- statusFields: z.array(instanceStatusFieldSchema).default(() => []),
12316
- files: z.array(instanceFileMetaSchema).default(() => []),
12317
- pages: z.array(instancePageMetaSchema).default(() => []),
12318
- terminals: z.array(instanceTerminalMetaSchema).default(() => []),
12319
- triggers: z.array(instanceTriggerSchema).default(() => [])
12320
- });
12321
- z.object({
12322
- ...instanceStateSchema.shape,
12323
- // secrets updated by the unit
12324
- secrets: z.record(z.string()).nullable(),
12325
- // log line emitted by the unit
12326
- logLine: z.string().nullable()
12327
- }).partial();
12328
- function createInstanceState(id, status = "not_created", fields = {}) {
12329
- return {
12330
- id,
12331
- parentId: null,
12332
- status,
12333
- latestOperationId: null,
12334
- currentResourceCount: null,
12335
- totalResourceCount: null,
12336
- inputHash: null,
12337
- outputHash: null,
12338
- error: null,
12339
- statusFields: [],
12340
- files: [],
12341
- pages: [],
12342
- terminals: [],
12343
- triggers: [],
12344
- ...fields
12345
- };
12346
- }
12347
- function applyPartialInstanceState(states, patch) {
12348
- if (!patch.id) {
12349
- throw new Error("The ID of the instance state is required.");
12350
- }
12351
- let state = states.get(patch.id);
12352
- if (!state) {
12353
- state = createInstanceState(patch.id, "unknown");
12354
- states.set(patch.id, state);
12355
- }
12356
- if (patch.status !== void 0) {
12357
- state.status = patch.status;
12358
- }
12359
- if (patch.latestOperationId !== void 0) {
12360
- state.latestOperationId = patch.latestOperationId;
12361
- }
12362
- if (patch.currentResourceCount !== void 0) {
12363
- state.currentResourceCount = patch.currentResourceCount;
12364
- }
12365
- if (patch.totalResourceCount !== void 0) {
12366
- state.totalResourceCount = patch.totalResourceCount;
12367
- }
12368
- if (patch.inputHash !== void 0) {
12369
- state.inputHash = patch.inputHash;
12370
- }
12371
- if (patch.outputHash !== void 0) {
12372
- state.outputHash = patch.outputHash;
12373
- }
12374
- if (patch.error !== void 0) {
12375
- state.error = patch.error;
12376
- }
12377
- if (patch.statusFields !== void 0) {
12378
- state.statusFields = patch.statusFields;
12379
- }
12380
- if (patch.files !== void 0) {
12381
- state.files = patch.files;
12382
- }
12383
- if (patch.pages !== void 0) {
12384
- state.pages = patch.pages;
12385
- }
12386
- if (patch.terminals !== void 0) {
12387
- state.terminals = patch.terminals;
12388
- }
12389
- if (patch.triggers !== void 0) {
12390
- state.triggers = patch.triggers;
12391
- }
12392
- return state;
12393
- }
12394
- function createInstanceStateFrontendPatch(patch) {
12395
- return omit(patch, ["secrets", "logLine"]);
12396
- }
12397
-
12398
- const operationTypeSchema = z.enum(["update", "destroy", "recreate", "refresh", "evaluate"]);
12399
- const operationStatusSchema = z.enum([
12400
- "pending",
12401
- "evaluating",
12402
- "running",
12403
- "completed",
12404
- "failed",
12405
- "cancelled"
12406
- ]);
12407
- const projectOperationSchema = z.object({
12408
- id: z.string().uuid(),
12409
- projectId: z.string(),
12410
- type: operationTypeSchema,
12411
- status: operationStatusSchema,
12412
- instanceIds: z.array(z.string()),
12413
- error: z.string().nullable(),
12414
- startedAt: z.number(),
12415
- completedAt: z.number().nullable()
12416
11773
  });
12417
- const projectOperationRequestSchema = z.object({
12418
- projectId: z.string(),
12419
- type: operationTypeSchema,
12420
- instanceIds: z.array(z.string())
12421
- });
12422
- function isFinalOperationStatus(status) {
12423
- return status === "completed" || status === "failed" || status === "cancelled";
12424
- }
12425
11774
 
12426
- class CircularDependencyError extends Error {
12427
- constructor(path) {
12428
- super(`Circular dependency detected: ${path.join(" -> ")}`);
12429
- this.name = "CircularDependencyError";
12430
- }
12431
- }
12432
- function createDefaultGraphResolverBackend() {
12433
- const promiseCache = /* @__PURE__ */ new Map();
12434
- return {
12435
- promiseCache,
12436
- setOutput() {
12437
- },
12438
- setDependencies() {
12439
- }
12440
- };
12441
- }
12442
- function defineGraphResolver(options) {
12443
- return (nodes, logger, backend) => {
12444
- backend != null ? backend : backend = createDefaultGraphResolverBackend();
12445
- const resolver = (itemId, dependencyChain) => {
12446
- logger.trace({ itemId }, "resolving item");
12447
- const existingPromise = backend.promiseCache.get(itemId);
12448
- if (existingPromise) {
12449
- return existingPromise;
12450
- }
12451
- if (dependencyChain.includes(itemId)) {
12452
- throw new CircularDependencyError([...dependencyChain, itemId]);
12453
- }
12454
- const item = nodes.get(itemId);
12455
- if (!item) {
12456
- return Promise.resolve(void 0);
12457
- }
12458
- const resolve = async () => {
12459
- const dependencies = unique(options.getNodeDependencies(item));
12460
- backend.setDependencies(itemId, dependencies);
12461
- logger.trace({ itemId, dependencies }, "resolving item dependencies");
12462
- const resolvedDependencies = /* @__PURE__ */ new Map();
12463
- const newChain = [...dependencyChain, itemId];
12464
- for (const depId of dependencies) {
12465
- const depResult = await resolver(depId, newChain);
12466
- if (depResult !== void 0) {
12467
- resolvedDependencies.set(depId, depResult);
12468
- }
12469
- }
12470
- return await options.process(item, resolvedDependencies, logger);
12471
- };
12472
- const promise = resolve().then((result) => {
12473
- if (backend.promiseCache.get(itemId) === promise) {
12474
- backend.setOutput(itemId, result);
12475
- }
12476
- return result;
12477
- });
12478
- backend.promiseCache.set(itemId, promise);
12479
- return promise;
12480
- };
12481
- return (id) => resolver(id, []);
12482
- };
12483
- }
12484
-
12485
- const createInputResolver = defineGraphResolver({
12486
- getNodeId(node) {
12487
- if (node.kind === "hub") {
12488
- return `hub:${node.hub.id}`;
12489
- }
12490
- return `instance:${node.instance.id}`;
12491
- },
12492
- getNodeDependencies(node) {
12493
- var _a, _b, _c, _d;
12494
- const dependencies = [];
12495
- if (node.kind === "hub") {
12496
- for (const input of (_a = node.hub.inputs) != null ? _a : []) {
12497
- dependencies.push(`instance:${input.instanceId}`);
12498
- }
12499
- for (const input of (_b = node.hub.injectionInputs) != null ? _b : []) {
12500
- dependencies.push(`hub:${input.hubId}`);
12501
- }
12502
- return dependencies;
12503
- }
12504
- for (const inputs of Object.values((_c = node.instance.hubInputs) != null ? _c : {})) {
12505
- for (const input of inputs) {
12506
- dependencies.push(`hub:${input.hubId}`);
12507
- }
12508
- }
12509
- for (const input of (_d = node.instance.injectionInputs) != null ? _d : []) {
12510
- dependencies.push(`hub:${input.hubId}`);
12511
- }
12512
- return dependencies;
12513
- },
12514
- process(node, dependencies, logger) {
12515
- var _a, _b, _c, _d, _e, _f, _g;
12516
- const getHubOutput = (input) => {
12517
- const output = dependencies.get(`hub:${input.hubId}`);
12518
- if (!output) {
12519
- throw new Error("Hub not found");
12520
- }
12521
- if (output.kind !== "hub") {
12522
- throw new Error("Expected hub node");
12523
- }
12524
- return output;
12525
- };
12526
- const getInstanceOutput = (input) => {
12527
- const output = dependencies.get(`instance:${input.instanceId}`);
12528
- if (!output) {
12529
- throw new Error("Instance not found");
12530
- }
12531
- if (output.kind !== "instance") {
12532
- throw new Error("Expected instance node");
12533
- }
12534
- return output;
12535
- };
12536
- if (node.kind === "hub") {
12537
- const hubResult = /* @__PURE__ */ new Map();
12538
- const addHubResult = (input) => {
12539
- hubResult.set(`${input.input.instanceId}:${input.input.output}`, input);
12540
- };
12541
- for (const input of (_a = node.hub.inputs) != null ? _a : []) {
12542
- const { component } = getInstanceOutput(input);
12543
- const componentInput = component.outputs[input.output];
12544
- if (!componentInput) {
12545
- logger.warn({ msg: "output not found in the component", input, component });
12546
- continue;
12547
- }
12548
- addHubResult({ input, type: componentInput.type });
12549
- }
12550
- for (const injectionInput of (_b = node.hub.injectionInputs) != null ? _b : []) {
12551
- const { resolvedInputs: resolvedInputs2 } = getHubOutput(injectionInput);
12552
- for (const input of resolvedInputs2) {
12553
- addHubResult(input);
12554
- }
12555
- }
12556
- return {
12557
- kind: "hub",
12558
- resolvedInputs: Array.from(hubResult.values())
12559
- };
12560
- }
12561
- const resolvedInputsMap = /* @__PURE__ */ new Map();
12562
- const addInstanceResult = (inputName, input) => {
12563
- let inputs = resolvedInputsMap.get(inputName);
12564
- if (!inputs) {
12565
- inputs = /* @__PURE__ */ new Map();
12566
- resolvedInputsMap.set(inputName, inputs);
12567
- }
12568
- inputs.set(`${input.input.instanceId}:${input.input.output}`, input);
12569
- };
12570
- for (const [inputName, inputs] of Object.entries((_c = node.instance.inputs) != null ? _c : {})) {
12571
- for (const input of inputs) {
12572
- const componentInput = node.component.inputs[inputName];
12573
- if (!componentInput) {
12574
- logger.warn({ msg: "input not found in the component", input, component: node.component });
12575
- continue;
12576
- }
12577
- addInstanceResult(inputName, { input, type: componentInput.type });
12578
- }
12579
- }
12580
- const injectionInputs = /* @__PURE__ */ new Map();
12581
- const matchedInjectionInputs = /* @__PURE__ */ new Map();
12582
- for (const injectionInput of (_d = node.instance.injectionInputs) != null ? _d : []) {
12583
- const { resolvedInputs: resolvedInputs2 } = getHubOutput(injectionInput);
12584
- for (const input of resolvedInputs2) {
12585
- injectionInputs.set(`${input.input.instanceId}:${input.input.output}`, input);
12586
- }
12587
- }
12588
- for (const [inputName, componentInput] of Object.entries((_e = node.component.inputs) != null ? _e : {})) {
12589
- const allInputs = new Map(injectionInputs);
12590
- const hubInputs = (_g = (_f = node.instance.hubInputs) == null ? void 0 : _f[inputName]) != null ? _g : [];
12591
- for (const hubInput of hubInputs) {
12592
- const { resolvedInputs: resolvedInputs2 } = getHubOutput(hubInput);
12593
- for (const input of resolvedInputs2) {
12594
- allInputs.set(`${input.input.instanceId}:${input.input.output}`, input);
12595
- }
12596
- }
12597
- for (const input of allInputs.values()) {
12598
- if (input.type === componentInput.type) {
12599
- addInstanceResult(inputName, input);
12600
- const key = `${input.input.instanceId}:${input.input.output}`;
12601
- if (injectionInputs.has(key)) {
12602
- matchedInjectionInputs.set(key, input);
12603
- }
12604
- }
12605
- }
12606
- }
12607
- const resolvedInputs = fromEntries(
12608
- Array.from(resolvedInputsMap.entries()).map(([inputName, inputs]) => [
12609
- inputName,
12610
- Array.from(inputs.values())
12611
- ])
12612
- );
12613
- return {
12614
- kind: "instance",
12615
- component: node.component,
12616
- resolvedInputs,
12617
- resolvedInjectionInputs: Array.from(injectionInputs.values()),
12618
- matchedInjectionInputs: Array.from(matchedInjectionInputs.values())
12619
- };
12620
- }
12621
- });
12622
-
12623
- const createInputHashResolver = defineGraphResolver({
12624
- getNodeId: (node) => node.instance.id,
12625
- getNodeDependencies({ resolvedInputs }) {
12626
- const dependencies = [];
12627
- for (const inputs of Object.values(resolvedInputs != null ? resolvedInputs : {})) {
12628
- for (const input of inputs) {
12629
- dependencies.push(input.input.instanceId);
12630
- }
12631
- }
12632
- return dependencies;
12633
- },
12634
- async process({ instance, resolvedInputs, sourceHash, state }, dependencies) {
12635
- var _a;
12636
- let sink = JSON.stringify((_a = instance.args) != null ? _a : {});
12637
- if (sourceHash) {
12638
- sink += sourceHash;
12639
- }
12640
- if (state == null ? void 0 : state.outputHash) {
12641
- sink += state.outputHash;
12642
- }
12643
- const sortedInputs = Object.entries(resolvedInputs).sort(([a], [b]) => a.localeCompare(b));
12644
- for (const [inputKey, inputs] of sortedInputs) {
12645
- if (Object.keys(inputs).length === 0) {
12646
- continue;
12647
- }
12648
- sink += inputKey;
12649
- const instanceIds = inputs.map((input) => input.input.instanceId);
12650
- instanceIds.sort();
12651
- for (const instanceId of instanceIds) {
12652
- sink += dependencies.get(instanceId);
12653
- }
12654
- }
12655
- return await sha256(sink);
12656
- }
12657
- });
12658
-
12659
- const terminalSessionSchema = z.object({
12660
- id: z.string().uuid(),
12661
- terminalName: z.string()
12662
- });
12663
-
12664
- const localProjectBackendConfig = z.object({
12665
- HIGHSTATE_BACKEND_PROJECT_PROJECTS_DIR: z.string().optional()
12666
- });
12667
- const projectModelSchema = z.object({
12668
- instances: z.record(instanceModelSchema),
12669
- hubs: z.record(hubModelSchema)
12670
- });
12671
- class LocalProjectBackend {
12672
- constructor(projectsDir) {
12673
- this.projectsDir = projectsDir;
12674
- }
12675
- async getProjectNames() {
12676
- try {
12677
- const files = await readdir$1(this.projectsDir);
12678
- return files.filter((file) => file.endsWith(".json")).map((file) => file.replace(/\.json$/, ""));
12679
- } catch (error) {
12680
- throw new Error("Failed to get project names", { cause: error });
12681
- }
12682
- }
12683
- async getProject(projectId) {
12684
- try {
12685
- const project = await this.loadProject(projectId);
12686
- return {
12687
- instances: Object.values(project.instances),
12688
- hubs: Object.values(project.hubs)
12689
- };
12690
- } catch (error) {
12691
- throw new Error("Failed to get project instances", { cause: error });
12692
- }
12693
- }
12694
- async createInstance(projectId, instance) {
12695
- try {
12696
- return await this.withProject(projectId, (project) => {
12697
- if (project.instances[instance.id]) {
12698
- throw new Error(`Instance ${instance.id} already exists`);
12699
- }
12700
- project.instances[instance.id] = instance;
12701
- return instance;
12702
- });
12703
- } catch (error) {
12704
- throw new Error("Failed to create project instance", { cause: error });
12705
- }
12706
- }
12707
- async updateInstance(projectId, instanceId, patch) {
12708
- try {
12709
- return await this.withInstance(projectId, instanceId, (instance) => {
12710
- if (patch.args) {
12711
- instance.args = patch.args;
12712
- }
12713
- if (patch.position) {
12714
- instance.position = patch.position;
12715
- }
12716
- if (patch.inputs) {
12717
- if (Object.keys(patch.inputs).length > 0) {
12718
- instance.inputs = patch.inputs;
12719
- } else {
12720
- delete instance.inputs;
12721
- }
12722
- }
12723
- if (patch.hubInputs) {
12724
- if (Object.keys(patch.hubInputs).length > 0) {
12725
- instance.hubInputs = patch.hubInputs;
12726
- } else {
12727
- delete instance.hubInputs;
12728
- }
12729
- }
12730
- if (patch.injectionInputs) {
12731
- if (patch.injectionInputs.length > 0) {
12732
- instance.injectionInputs = patch.injectionInputs;
12733
- } else {
12734
- delete instance.injectionInputs;
12735
- }
12736
- }
12737
- return instance;
12738
- });
12739
- } catch (error) {
12740
- throw new Error("Failed to update project instance", { cause: error });
12741
- }
12742
- }
12743
- async deleteInstance(projectId, instanceId) {
12744
- try {
12745
- await this.withProject(projectId, (project) => {
12746
- if (!project.instances[instanceId]) {
12747
- throw new Error(`Instance ${instanceId} not found`);
12748
- }
12749
- delete project.instances[instanceId];
12750
- for (const otherInstance of Object.values(project.instances)) {
12751
- if (!otherInstance.inputs) {
12752
- continue;
12753
- }
12754
- this.deleteInstanceReferences(otherInstance.inputs, instanceId);
12755
- if (Object.keys(otherInstance.inputs).length === 0) {
12756
- delete otherInstance.inputs;
12757
- }
12758
- }
12759
- for (const hub of Object.values(project.hubs)) {
12760
- if (!hub.inputs) {
12761
- continue;
12762
- }
12763
- hub.inputs = hub.inputs.filter((input) => input.instanceId !== instanceId);
12764
- if (hub.inputs.length === 0) {
12765
- delete hub.inputs;
12766
- }
12767
- }
12768
- });
12769
- } catch (error) {
12770
- throw new Error("Failed to delete project instance", { cause: error });
12771
- }
12772
- }
12773
- deleteInstanceReferences(inputs, instanceId) {
12774
- for (const [inputKey, input] of Object.entries(inputs)) {
12775
- inputs[inputKey] = input.filter((inputItem) => inputItem.instanceId !== instanceId);
12776
- if (inputs[inputKey].length === 0) {
12777
- delete inputs[inputKey];
12778
- }
12779
- }
12780
- }
12781
- async renameInstance(projectId, instanceId, newName) {
12782
- try {
12783
- return await this.withProject(projectId, (project) => {
12784
- var _a, _b;
12785
- const instance = project.instances[instanceId];
12786
- if (!instance) {
12787
- throw new Error(`Instance ${instanceId} not found`);
12788
- }
12789
- const newInstanceId = getInstanceId(instance.type, newName);
12790
- if (project.instances[newInstanceId]) {
12791
- throw new Error(`Instance ${newInstanceId} already exists`);
12792
- }
12793
- delete project.instances[instanceId];
12794
- instance.id = newInstanceId;
12795
- instance.name = newName;
12796
- project.instances[newInstanceId] = instance;
12797
- for (const otherInstance of Object.values(project.instances)) {
12798
- for (const inputs of Object.values((_a = otherInstance.inputs) != null ? _a : {})) {
12799
- this.renameInstanceReferences(inputs, instanceId, instance.id);
12800
- }
12801
- }
12802
- for (const hub of Object.values(project.hubs)) {
12803
- this.renameInstanceReferences((_b = hub.inputs) != null ? _b : [], instanceId, instance.id);
12804
- }
12805
- return instance;
12806
- });
12807
- } catch (error) {
12808
- throw new Error("Failed to rename project instance", { cause: error });
12809
- }
12810
- }
12811
- renameInstanceReferences(inputs, instanceId, newInstanceId) {
12812
- for (const input of inputs) {
12813
- if (input.instanceId === instanceId) {
12814
- input.instanceId = newInstanceId;
12815
- }
12816
- }
12817
- }
12818
- async createHub(projectId, hub) {
12819
- try {
12820
- return await this.withProject(projectId, (project) => {
12821
- if (project.hubs[hub.id]) {
12822
- throw new Error(`Hub ${hub.id} already exists`);
12823
- }
12824
- project.hubs[hub.id] = hub;
12825
- return hub;
12826
- });
12827
- } catch (error) {
12828
- throw new Error("Failed to create project hub", { cause: error });
12829
- }
12830
- }
12831
- async updateHub(projectId, hubId, patch) {
12832
- try {
12833
- return await this.withProject(projectId, (project) => {
12834
- const hub = project.hubs[hubId];
12835
- if (!hub) {
12836
- throw new Error(`Hub ${hubId} not found`);
12837
- }
12838
- if (patch.position) {
12839
- hub.position = patch.position;
12840
- }
12841
- if (patch.inputs) {
12842
- if (patch.inputs.length > 0) {
12843
- hub.inputs = patch.inputs;
12844
- } else {
12845
- delete hub.inputs;
12846
- }
12847
- }
12848
- if (patch.injectionInputs) {
12849
- if (patch.injectionInputs.length > 0) {
12850
- hub.injectionInputs = patch.injectionInputs;
12851
- } else {
12852
- delete hub.injectionInputs;
12853
- }
12854
- }
12855
- return hub;
12856
- });
12857
- } catch (error) {
12858
- throw new Error("Failed to update project hub", { cause: error });
12859
- }
12860
- }
12861
- async deleteHub(projectId, hubId) {
12862
- try {
12863
- await this.withProject(projectId, (project) => {
12864
- if (!project.hubs[hubId]) {
12865
- throw new Error(`Hub ${hubId} not found`);
12866
- }
12867
- delete project.hubs[hubId];
12868
- for (const instance of Object.values(project.instances)) {
12869
- if (instance.hubInputs) {
12870
- this.deleteHubReferences(instance.hubInputs, hubId);
12871
- if (Object.keys(instance.hubInputs).length === 0) {
12872
- delete instance.hubInputs;
12873
- }
12874
- }
12875
- if (instance.injectionInputs) {
12876
- instance.injectionInputs = instance.injectionInputs.filter(
12877
- (input) => input.hubId !== hubId
12878
- );
12879
- if (instance.injectionInputs.length === 0) {
12880
- delete instance.injectionInputs;
12881
- }
12882
- }
12883
- }
12884
- for (const otherHub of Object.values(project.hubs)) {
12885
- if (!otherHub.injectionInputs) {
12886
- continue;
12887
- }
12888
- otherHub.injectionInputs = otherHub.injectionInputs.filter((input) => input.hubId !== hubId);
12889
- if (otherHub.injectionInputs.length === 0) {
12890
- delete otherHub.injectionInputs;
12891
- }
12892
- }
12893
- });
12894
- } catch (error) {
12895
- throw new Error("Failed to delete project hub", { cause: error });
12896
- }
12897
- }
12898
- deleteHubReferences(inputs, hubId) {
12899
- for (const [inputKey, input] of Object.entries(inputs)) {
12900
- inputs[inputKey] = input.filter((inputItem) => inputItem.hubId !== hubId);
12901
- if (inputs[inputKey].length === 0) {
12902
- delete inputs[inputKey];
12903
- }
12904
- }
12905
- }
12906
- getProjectPath(projectId) {
12907
- return `${this.projectsDir}/${projectId}.json`;
12908
- }
12909
- async loadProject(projectId) {
12910
- const projectPath = this.getProjectPath(projectId);
12911
- try {
12912
- const content = await readFile$1(projectPath, "utf-8");
12913
- return projectModelSchema.parse(JSON.parse(content));
12914
- } catch (error) {
12915
- if (error instanceof Error && "code" in error && error.code === "ENOENT") {
12916
- return { instances: {}, hubs: {} };
12917
- }
12918
- throw error;
12919
- }
12920
- }
12921
- async writeProject(projectId, project) {
12922
- const projectPath = this.getProjectPath(projectId);
12923
- const content = JSON.stringify(project, void 0, 2);
12924
- await writeFile$1(projectPath, content);
12925
- }
12926
- async withInstance(projectId, instanceId, callback) {
12927
- return await this.withProject(projectId, (project) => {
12928
- const instance = project.instances[instanceId];
12929
- if (!instance) {
12930
- throw new Error(`Instance ${instanceId} not found`);
12931
- }
12932
- return callback(instance);
12933
- });
12934
- }
12935
- async withProject(projectId, callback) {
12936
- const project = await this.loadProject(projectId);
12937
- const result = callback(project);
12938
- await this.writeProject(projectId, project);
12939
- return result;
12940
- }
12941
- static async create(config) {
12942
- let projectsPath = config.HIGHSTATE_BACKEND_PROJECT_PROJECTS_DIR;
12943
- if (!projectsPath) {
12944
- const [mainProjectPath] = await resolveMainLocalProject();
12945
- projectsPath = resolve$1(mainProjectPath, "projects");
12946
- }
12947
- await mkdir(projectsPath, { recursive: true });
12948
- return new LocalProjectBackend(projectsPath);
12949
- }
12950
- }
12951
-
12952
- const projectBackendConfig = z.object({
12953
- HIGHSTATE_BACKEND_PROJECT_TYPE: z.enum(["local"]).default("local"),
12954
- ...localProjectBackendConfig.shape
12955
- });
12956
- function createProjectBackend(config) {
12957
- return LocalProjectBackend.create(config);
12958
- }
12959
-
12960
- var __defProp$4 = Object.defineProperty;
12961
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12962
- var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, key + "" , value);
12963
- class ProjectLock {
12964
- constructor(lock, projectId) {
12965
- this.lock = lock;
12966
- this.projectId = projectId;
12967
- }
12968
- lockInstance(instanceId, fn) {
12969
- return this.lock.acquire(`${this.projectId}/${instanceId}`, fn);
12970
- }
12971
- lockInstances(instanceIds, fn) {
12972
- return this.lock.acquire(
12973
- instanceIds.map((id) => `${this.projectId}/${id}`),
12974
- fn
12975
- );
12976
- }
12977
- }
12978
- class ProjectLockManager {
12979
- constructor() {
12980
- __publicField$4(this, "lock", new BetterLock());
12981
- }
12982
- getLock(projectId) {
12983
- return new ProjectLock(this.lock, projectId);
12984
- }
12985
- }
12986
-
12987
- class ProjectManager {
12988
- constructor(projectBackend, stateBackend, operationManager, library, logger) {
12989
- this.projectBackend = projectBackend;
12990
- this.stateBackend = stateBackend;
12991
- this.operationManager = operationManager;
12992
- this.library = library;
12993
- this.logger = logger;
12994
- }
12995
- async getCompositeInstance(projectId, instanceId) {
12996
- const { resolveInputHash } = await this.prepareInputHashResolver(projectId, instanceId);
12997
- const [compositeInstance, actualInputHash] = await Promise.all([
12998
- this.stateBackend.getCompositeInstance(projectId, instanceId),
12999
- resolveInputHash(instanceId)
13000
- ]);
13001
- if (compositeInstance && compositeInstance.inputHash === actualInputHash) {
13002
- return compositeInstance;
13003
- }
13004
- this.logger.info("re-evaluating instance since input hash has changed", {
13005
- projectId,
13006
- instanceId
13007
- });
13008
- const instancePromise = this.waitForCompositeInstance(
13009
- projectId,
13010
- instanceId,
13011
- actualInputHash,
13012
- resolveInputHash
13013
- );
13014
- await this.operationManager.launch({
13015
- type: "evaluate",
13016
- projectId,
13017
- instanceIds: [instanceId]
13018
- });
13019
- return await instancePromise;
13020
- }
13021
- async createInstance(projectId, instance) {
13022
- const createdInstance = await this.projectBackend.createInstance(projectId, instance);
13023
- await this.updateInstanceChildren(projectId, createdInstance);
13024
- return createdInstance;
13025
- }
13026
- async updateInstance(projectId, instanceId, patch) {
13027
- const instance = await this.projectBackend.updateInstance(projectId, instanceId, patch);
13028
- await this.updateInstanceChildren(projectId, instance);
13029
- return instance;
13030
- }
13031
- async renameInstance(projectId, instanceId, newName) {
13032
- const instance = await this.projectBackend.renameInstance(projectId, instanceId, newName);
13033
- await this.updateInstanceChildren(projectId, instance);
13034
- return instance;
13035
- }
13036
- async deleteInstance(projectId, instanceId) {
13037
- await Promise.all([
13038
- this.projectBackend.deleteInstance(projectId, instanceId),
13039
- this.stateBackend.clearCompositeInstances(projectId, [instanceId])
13040
- ]);
13041
- }
13042
- async updateInstanceChildren(projectId, instance) {
13043
- const { resolveInputHash, library } = await this.prepareInputHashResolver(
13044
- projectId,
13045
- instance.id
13046
- );
13047
- const component = library.components[instance.type];
13048
- if (!component) {
13049
- return;
13050
- }
13051
- if (isUnitModel(component)) {
13052
- return;
13053
- }
13054
- const expectedInputHash = await resolveInputHash(instance.id);
13055
- const inputHash = await this.stateBackend.getCompositeInstanceInputHash(projectId, instance.id);
13056
- if (inputHash !== expectedInputHash) {
13057
- this.logger.info("re-evaluating instance since input hash has changed", {
13058
- projectId,
13059
- instanceId: instance.id
13060
- });
13061
- await this.operationManager.launch({
13062
- type: "evaluate",
13063
- projectId,
13064
- instanceIds: [instance.id]
13065
- });
13066
- }
13067
- }
13068
- async waitForCompositeInstance(projectId, instanceId, expectedInputHash, resolveInputHash) {
13069
- for await (const instance of this.operationManager.watchCompositeInstance(
13070
- projectId,
13071
- instanceId
13072
- )) {
13073
- const actualInputHash = await resolveInputHash(instanceId);
13074
- if (actualInputHash !== expectedInputHash) {
13075
- throw new Error("Composite instance input hash changed while waiting for evaluation");
13076
- }
13077
- return instance;
13078
- }
13079
- throw new Error("Composite instance stream ended without receiving the expected instance");
13080
- }
13081
- async prepareInputHashResolver(projectId, instanceId) {
13082
- const { instances, hubs } = await this.projectBackend.getProject(projectId);
13083
- const library = await this.library.loadLibrary();
13084
- const filteredInstances = instances.filter((instance2) => instance2.type in library.components);
13085
- const states = await this.stateBackend.getInstanceStates(projectId);
13086
- const stateMap = new Map(states.map((state) => [state.id, state]));
13087
- const instance = filteredInstances.find((instance2) => instance2.id === instanceId);
13088
- if (!instance) {
13089
- throw new Error(`Instance not found: ${instanceId}`);
13090
- }
13091
- const inputResolverNodes = /* @__PURE__ */ new Map();
13092
- for (const instance2 of filteredInstances) {
13093
- inputResolverNodes.set(`instance:${instance2.id}`, {
13094
- kind: "instance",
13095
- instance: instance2,
13096
- component: library.components[instance2.type]
13097
- });
13098
- }
13099
- for (const hub of hubs) {
13100
- inputResolverNodes.set(`hub:${hub.id}`, { kind: "hub", hub });
13101
- }
13102
- const resolveInputs = createInputResolver(
13103
- inputResolverNodes,
13104
- this.logger.child({ resolver: "input-resolver" })
13105
- );
13106
- const inputHashNodes = /* @__PURE__ */ new Map();
13107
- for (const instance2 of filteredInstances) {
13108
- const output = await resolveInputs(`instance:${instance2.id}`);
13109
- if (output.kind !== "instance") {
13110
- throw new Error("Expected instance node");
13111
- }
13112
- inputHashNodes.set(instance2.id, {
13113
- instance: instance2,
13114
- resolvedInputs: output.resolvedInputs,
13115
- state: stateMap.get(instance2.id),
13116
- sourceHash: void 0
13117
- // implement source hash
13118
- });
13119
- }
13120
- const resolveInputHash = createInputHashResolver(
13121
- inputHashNodes,
13122
- this.logger.child({ resolver: "input-hash-resolver" })
13123
- );
13124
- return {
13125
- resolveInputHash,
13126
- library
13127
- };
13128
- }
13129
- static create(projectBackend, stateBackend, operationManager, library, logger) {
13130
- return new ProjectManager(
13131
- projectBackend,
13132
- stateBackend,
13133
- operationManager,
13134
- library,
13135
- logger.child({ service: "ProjectManager" })
13136
- );
13137
- }
13138
- }
13139
-
13140
- const runScript = `set -e -o pipefail
13141
- read -r data
13142
-
13143
- # Extract env and files as key-value pairs, and command as an array
13144
- envKeys=($(jq -r '.env | keys[]' <<<"$data"))
13145
- filesKeys=($(jq -r '.files | keys[]' <<<"$data"))
13146
- commandArr=($(jq -r '.command[]' <<<"$data"))
13147
-
13148
- # Set environment variables
13149
- for key in "\${envKeys[@]}"; do
13150
- value=$(jq -r ".env[\\"$key\\"]" <<<"$data")
13151
- export "$key=$value"
13152
- done
13153
-
13154
- # Create files
13155
- for key in "\${filesKeys[@]}"; do
13156
- isBinary=$(jq -r ".files[\\"$key\\"].isBinary // false" <<<"$data")
13157
- content=$(jq -r ".files[\\"$key\\"].content" <<<"$data")
13158
- if [ "$isBinary" = "true" ]; then
13159
- echo -n "$content" | base64 -d > "$key"
13160
- else
13161
- echo -n "$content" > "$key"
13162
- fi
13163
- done
13164
-
13165
- # Execute the command, keeping stdin/stdout open
13166
- exec "\${commandArr[@]}"`;
13167
-
13168
- const dockerTerminalBackendConfig = z.object({
13169
- HIGHSTATE_BACKEND_TERMINAL_DOCKER_BINARY: z.string().default("docker"),
13170
- HIGHSTATE_BACKEND_TERMINAL_DOCKER_HOST: z.string().optional()
13171
- });
13172
- class DockerTerminalBackend {
13173
- constructor(binary, host, logger) {
13174
- this.binary = binary;
13175
- this.host = host;
13176
- this.logger = logger;
13177
- }
13178
- async run({ factory, stdin, stdout, signal }) {
13179
- var _a, _b;
13180
- const hsTempDir = resolve$1(tmpdir(), "highstate");
13181
- await mkdir(hsTempDir, { recursive: true });
13182
- const runScriptPath = resolve$1(hsTempDir, "run.sh");
13183
- await writeFile$1(runScriptPath, runScript, { mode: 493 });
13184
- const args = [
13185
- "run",
13186
- "-i",
13187
- "-v",
13188
- `${runScriptPath}:/run.sh:ro`,
13189
- factory.image,
13190
- "/bin/bash",
13191
- "/run.sh"
13192
- ];
13193
- const initData = {
13194
- command: factory.command,
13195
- cwd: factory.cwd,
13196
- env: (_a = factory.env) != null ? _a : {},
13197
- files: (_b = factory.files) != null ? _b : {}
13198
- };
13199
- const initDataStream = Readable$1.from(JSON.stringify(initData) + "\n");
13200
- const process = spawn(this.binary, args, {
13201
- env: {
13202
- DOCKER_HOST: this.host
13203
- },
13204
- signal
13205
- });
13206
- const childProcess = await process.nodeChildProcess;
13207
- initDataStream.pipe(childProcess.stdin, { end: false });
13208
- initDataStream.on("end", () => stdin.pipe(childProcess.stdin));
13209
- childProcess.stdout.pipe(stdout);
13210
- childProcess.stderr.pipe(stdout);
13211
- this.logger.info("process started", { pid: childProcess.pid });
13212
- await process;
13213
- }
13214
- static create(config, logger) {
13215
- return new DockerTerminalBackend(
13216
- config.HIGHSTATE_BACKEND_TERMINAL_DOCKER_BINARY,
13217
- config.HIGHSTATE_BACKEND_TERMINAL_DOCKER_HOST,
13218
- logger.child({ backend: "TerminalBackend", service: "DockerTerminalBackend" })
13219
- );
13220
- }
13221
- }
13222
-
13223
- const terminalBackendConfig = z.object({
13224
- HIGHSTATE_BACKEND_TERMINAL_TYPE: z.enum(["docker"]).default("docker"),
13225
- ...dockerTerminalBackendConfig.shape
13226
- });
13227
- function createTerminalBackend(config, logger) {
13228
- switch (config.HIGHSTATE_BACKEND_TERMINAL_TYPE) {
13229
- case "docker": {
13230
- return DockerTerminalBackend.create(config, logger);
13231
- }
13232
- }
13233
- }
13234
-
13235
- var __defProp$3 = Object.defineProperty;
13236
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13237
- var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
13238
- const notAttachedTerminalLifetime = 30 * 1e3;
13239
- class TerminalManager {
13240
- constructor(terminalBackend, stateBackend, runnerBackend, logger) {
13241
- this.terminalBackend = terminalBackend;
13242
- this.stateBackend = stateBackend;
13243
- this.runnerBackend = runnerBackend;
13244
- this.logger = logger;
13245
- __publicField$3(this, "managedTerminals", /* @__PURE__ */ new Map());
13246
- __publicField$3(this, "persistHistory", funnel(
13247
- (entries) => {
13248
- this.logger.trace({ msg: "persisting history lines", count: entries.length });
13249
- void this.stateBackend.appendTerminalSessionHistory(entries);
13250
- },
13251
- {
13252
- minQuietPeriodMs: 100,
13253
- maxBurstDurationMs: 200,
13254
- reducer: arrayAccumulator
13255
- }
13256
- ));
13257
- }
13258
- async createSession(projectId, instanceId, terminalName) {
13259
- const terminalSession = {
13260
- id: randomUUID$1(),
13261
- terminalName
13262
- };
13263
- await this.stateBackend.putTerminalSession(projectId, instanceId, terminalSession);
13264
- this.logger.info({ msg: "terminal session created", id: terminalSession.id });
13265
- await this.createManagedTerminal(projectId, instanceId, terminalSession);
13266
- return terminalSession;
13267
- }
13268
- async ensureSessionCreated(projectId, instanceId, terminalName) {
13269
- const terminalSessions = await this.stateBackend.getTerminalSessions(projectId, instanceId);
13270
- let session = terminalSessions.find((session2) => session2.terminalName === terminalName);
13271
- if (session) {
13272
- this.logger.info({ msg: "reusing existing terminal session", id: session.id });
13273
- } else {
13274
- this.logger.info("creating new terminal session");
13275
- session = await this.createSession(projectId, instanceId, terminalName);
13276
- }
13277
- if (!this.managedTerminals.has(session.id)) {
13278
- this.logger.info({ msg: "no managed terminal found, creating new one", id: session.id });
13279
- await this.createManagedTerminal(projectId, instanceId, session);
13280
- }
13281
- return session;
13282
- }
13283
- close(sessionId) {
13284
- this.logger.info({ msg: "closing terminal session", id: sessionId });
13285
- const managedTerminal = this.managedTerminals.get(sessionId);
13286
- if (managedTerminal) {
13287
- managedTerminal.abortController.abort();
13288
- }
13289
- }
13290
- async attach(projectId, instanceId, sessionId, stdin, stdout, signal) {
13291
- this.logger.info({ msg: "attaching terminal", projectId, instanceId, sessionId });
13292
- let terminal = this.managedTerminals.get(sessionId);
13293
- if (!terminal) {
13294
- this.logger.info({ msg: "no managed terminal found, creating new one", sessionId });
13295
- const session = await this.stateBackend.getTerminalSession(projectId, instanceId, sessionId);
13296
- if (!session) {
13297
- throw new Error(`Terminal session "${sessionId}" not found`);
13298
- }
13299
- terminal = await this.createManagedTerminal(projectId, instanceId, session);
13300
- terminal.history = await this.stateBackend.getTerminalSessionHistory(sessionId);
13301
- }
13302
- if (terminal.attached) {
13303
- throw new Error(`Terminal session "${sessionId}" is already attached`);
13304
- }
13305
- terminal.attached = true;
13306
- for (const line of terminal.history) {
13307
- stdout.write(line);
13308
- }
13309
- this.logger.info({ msg: "history replayed", count: terminal.history.length, sessionId });
13310
- stdin.pipe(terminal.stdin);
13311
- terminal.stdout.pipe(stdout);
13312
- this.logger.info({ msg: "terminal attached", id: sessionId });
13313
- signal.addEventListener("abort", () => {
13314
- terminal.attached = false;
13315
- this.logger.info({ msg: "terminal detached", id: sessionId });
13316
- });
13317
- }
13318
- async createManagedTerminal(projectId, instanceId, terminalSession) {
13319
- const [instanceType, instanceName] = parseInstanceId(instanceId);
13320
- const factory = await this.runnerBackend.getTerminalFactory(
13321
- { projectId, instanceType, instanceName },
13322
- terminalSession.terminalName
13323
- );
13324
- if (!factory) {
13325
- throw new Error(
13326
- `Terminal factory for instance "${instanceId}" with name "${terminalSession.terminalName}" not found`
13327
- );
13328
- }
13329
- const managedTerminal = {
13330
- sessionId: terminalSession.id,
13331
- abortController: new AbortController(),
13332
- attached: false,
13333
- stdin: new PassThrough(),
13334
- stdout: new PassThrough(),
13335
- history: []
13336
- };
13337
- managedTerminal.stdout.on("data", (data) => {
13338
- const line = String(data);
13339
- managedTerminal.history.push(String(data));
13340
- void this.persistHistory.call([terminalSession.id, line]);
13341
- });
13342
- this.managedTerminals.set(managedTerminal.sessionId, managedTerminal);
13343
- void this.terminalBackend.run({
13344
- factory,
13345
- stdin: managedTerminal.stdin,
13346
- stdout: managedTerminal.stdout,
13347
- signal: managedTerminal.abortController.signal
13348
- }).catch((error) => {
13349
- this.logger.error({
13350
- msg: "managed terminal failed",
13351
- id: managedTerminal.sessionId,
13352
- error
13353
- });
13354
- }).finally(() => {
13355
- this.logger.info({ msg: "managed terminal closed", id: managedTerminal.sessionId });
13356
- this.managedTerminals.delete(managedTerminal.sessionId);
13357
- });
13358
- setTimeout(() => this.closeTerminalIfNotAttached(managedTerminal), notAttachedTerminalLifetime);
13359
- this.logger.info({ msg: "managed terminal created", id: managedTerminal.sessionId });
13360
- return managedTerminal;
13361
- }
13362
- closeTerminalIfNotAttached(terminal) {
13363
- if (!this.managedTerminals.has(terminal.sessionId)) {
13364
- return;
13365
- }
13366
- if (!terminal.attached) {
13367
- this.logger.info({
13368
- msg: "terminal not attached for too long, closing",
13369
- id: terminal.sessionId
13370
- });
13371
- terminal.abortController.abort();
13372
- this.managedTerminals.delete(terminal.sessionId);
13373
- return;
13374
- }
13375
- setTimeout(() => this.closeTerminalIfNotAttached(terminal), notAttachedTerminalLifetime);
13376
- }
13377
- static create(terminalBackend, stateBackend, runnerBackend, logger) {
13378
- return new TerminalManager(
13379
- terminalBackend,
13380
- stateBackend,
13381
- runnerBackend,
13382
- logger.child({ service: "TerminalManager" })
13383
- );
13384
- }
13385
- }
13386
-
13387
- class InvalidInstanceStatusError extends Error {
13388
- constructor(currentStatus, expectedStatuses) {
13389
- const expectedString = expectedStatuses.join(", ");
13390
- super(`The current state is "${currentStatus}", but it should be one of "${expectedString}".`);
13391
- this.currentStatus = currentStatus;
13392
- this.expectedStatuses = expectedStatuses;
13393
- }
13394
- }
13395
-
13396
- var __defProp$2 = Object.defineProperty;
13397
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13398
- var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
13399
- const localRunnerBackendConfig = z.object({
13400
- HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_SOURCE_CHECK: z.boolean({ coerce: true }).default(false),
13401
- HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_STATE_CHECK: z.boolean({ coerce: true }).default(false),
13402
- HIGHSTATE_BACKEND_RUNNER_LOCAL_PRINT_OUTPUT: z.boolean({ coerce: true }).default(true),
13403
- HIGHSTATE_BACKEND_RUNNER_LOCAL_SOURCE_BASE_PATH: z.string().optional()
13404
- });
13405
- class LocalRunnerBackend {
13406
- constructor(skipSourceCheck, skipStateCheck, printOutput, sourceBasePath, pulumiProjectHost) {
13407
- this.skipSourceCheck = skipSourceCheck;
13408
- this.skipStateCheck = skipStateCheck;
13409
- this.printOutput = printOutput;
13410
- this.sourceBasePath = sourceBasePath;
13411
- this.pulumiProjectHost = pulumiProjectHost;
13412
- __publicField$2(this, "events", new EventEmitter$2());
13413
- }
13414
- async *watch(options) {
13415
- var _a;
13416
- const stream = on(
13417
- //
13418
- this.events,
13419
- `state:${LocalRunnerBackend.getInstanceId(options)}`,
13420
- { signal: options.signal }
13421
- );
13422
- for await (const [statePatch] of stream) {
13423
- yield statePatch;
13424
- if (statePatch.status && ((_a = options.finalStatuses) == null ? void 0 : _a.includes(statePatch.status))) {
13425
- return;
13426
- }
13427
- }
13428
- }
13429
- getState(options) {
13430
- return this.pulumiProjectHost.runEmpty(
13431
- options.projectId,
13432
- options.instanceType,
13433
- options.instanceName,
13434
- async (stack) => {
13435
- const info = await stack.info();
13436
- const instanceId = getInstanceId(options.instanceType, options.instanceName);
13437
- if (!info) {
13438
- return createInstanceState(instanceId);
13439
- }
13440
- if (info.result === "failed") {
13441
- return createInstanceState(instanceId, "error");
13442
- }
13443
- if (info.result !== "succeeded") {
13444
- return createInstanceState(instanceId, "unknown");
13445
- }
13446
- const summary = await stack.workspace.stack();
13447
- const resourceCount = summary == null ? void 0 : summary.resourceCount;
13448
- if (!resourceCount) {
13449
- return createInstanceState(instanceId, "not_created");
13450
- }
13451
- return createInstanceState(instanceId, "created", {
13452
- currentResourceCount: resourceCount,
13453
- totalResourceCount: resourceCount
13454
- });
13455
- }
13456
- );
13457
- }
13458
- getTerminalFactory(options, terminalName) {
13459
- return this.pulumiProjectHost.runEmpty(
13460
- options.projectId,
13461
- options.instanceType,
13462
- options.instanceName,
13463
- async (stack) => {
13464
- const outputs = await stack.outputs();
13465
- if (!outputs["$terminals"]) {
13466
- return null;
13467
- }
13468
- const terminals = z.array(instanceTerminalSchema).parse(outputs["$terminals"].value);
13469
- const terminal = terminals.find((t) => t.name === terminalName);
13470
- if (!terminal) {
13471
- return null;
13472
- }
13473
- return terminal;
13474
- }
13475
- );
13476
- }
13477
- getPageContent(options, pageName) {
13478
- return this.pulumiProjectHost.runEmpty(
13479
- options.projectId,
13480
- options.instanceType,
13481
- options.instanceName,
13482
- async (stack) => {
13483
- const outputs = await stack.outputs();
13484
- if (!outputs["$pages"]) {
13485
- return null;
13486
- }
13487
- const pages = z.array(instancePageSchema).parse(outputs["$pages"].value);
13488
- const page = pages.find((p) => p.name === pageName);
13489
- if (!page) {
13490
- return null;
13491
- }
13492
- return page.content;
13493
- }
13494
- );
13495
- }
13496
- getFileContent(options, fileName) {
13497
- return this.pulumiProjectHost.runEmpty(
13498
- options.projectId,
13499
- options.instanceType,
13500
- options.instanceName,
13501
- async (stack) => {
13502
- const outputs = await stack.outputs();
13503
- if (!outputs["$files"]) {
13504
- return null;
13505
- }
13506
- const files = z.array(instanceFileSchema).parse(outputs["$files"].value);
13507
- const file = files.find((f) => f.name === fileName);
13508
- if (!file) {
13509
- return null;
13510
- }
13511
- return file.content;
13512
- }
13513
- );
13514
- }
13515
- async update(options) {
13516
- const currentStatus = await this.validateStatus(options, [
13517
- "not_created",
13518
- "updating",
13519
- "created",
13520
- "error"
13521
- ]);
13522
- if (currentStatus === "updating") {
13523
- return;
13524
- }
13525
- const configMap = {
13526
- ...mapValues(options.config, (value) => ({ value })),
13527
- ...mapValues(options.secrets, (value) => ({ value, secret: true }))
13528
- };
13529
- void this.updateWorker(options, configMap);
13530
- }
13531
- async updateWorker(options, configMap) {
13532
- const instanceId = LocalRunnerBackend.getInstanceId(options);
13533
- try {
13534
- await this.pulumiProjectHost.runLocal(
13535
- options.projectId,
13536
- options.instanceType,
13537
- options.instanceName,
13538
- () => this.resolveProjectPath(options.source),
13539
- async (stack) => {
13540
- await stack.setAllConfig(configMap);
13541
- this.updateState({
13542
- id: instanceId,
13543
- status: "updating",
13544
- currentResourceCount: 0,
13545
- totalResourceCount: 0
13546
- });
13547
- let currentResourceCount = 0;
13548
- let totalResourceCount = 0;
13549
- await runWithRetryOnError(
13550
- async () => {
13551
- await stack.up({
13552
- color: "always",
13553
- onEvent: (event) => {
13554
- if (event.resourcePreEvent) {
13555
- totalResourceCount = updateResourceCount(
13556
- event.resourcePreEvent.metadata.op,
13557
- totalResourceCount
13558
- );
13559
- this.updateState({ id: instanceId, totalResourceCount });
13560
- return;
13561
- }
13562
- if (event.resOutputsEvent) {
13563
- currentResourceCount = updateResourceCount(
13564
- event.resOutputsEvent.metadata.op,
13565
- currentResourceCount
13566
- );
13567
- this.updateState({ id: instanceId, currentResourceCount });
13568
- return;
13569
- }
13570
- },
13571
- onOutput: (message) => {
13572
- this.updateState({ id: instanceId, logLine: message });
13573
- if (this.printOutput) {
13574
- console.log(message);
13575
- }
13576
- },
13577
- signal: options.signal
13578
- });
13579
- const extraOutputs = await this.getExtraOutputsStatePatch(stack);
13580
- this.updateState({
13581
- id: instanceId,
13582
- status: "created",
13583
- totalResourceCount: currentResourceCount,
13584
- ...extraOutputs
13585
- });
13586
- },
13587
- async (error) => {
13588
- const isUnlocked = await this.pulumiProjectHost.tryUnlockStack(stack, error);
13589
- if (isUnlocked) return true;
13590
- const isResolved = await this.tryInstallMissingDependencies(error);
13591
- if (isResolved) return true;
13592
- return false;
13593
- }
13594
- );
13595
- },
13596
- configMap
13597
- );
13598
- } catch (error) {
13599
- this.updateState({
13600
- id: instanceId,
13601
- status: "error",
13602
- error: errorToString(error)
13603
- });
13604
- }
13605
- }
13606
- async destroy(options) {
13607
- const currentStatus = await this.validateStatus(options, [
13608
- "not_created",
13609
- "destroying",
13610
- "created",
13611
- "error"
13612
- ]);
13613
- if (currentStatus === "destroying") {
13614
- return;
13615
- }
13616
- void this.destroyWorker(options);
13617
- }
13618
- async destroyWorker(options) {
13619
- const instanceId = LocalRunnerBackend.getInstanceId(options);
13620
- try {
13621
- await this.pulumiProjectHost.runEmpty(
13622
- options.projectId,
13623
- options.instanceType,
13624
- options.instanceName,
13625
- async (stack) => {
13626
- var _a;
13627
- const summary = await stack.workspace.stack();
13628
- let currentResourceCount = (_a = summary == null ? void 0 : summary.resourceCount) != null ? _a : 0;
13629
- this.updateState({
13630
- id: instanceId,
13631
- status: "destroying",
13632
- currentResourceCount,
13633
- totalResourceCount: currentResourceCount
13634
- });
13635
- await runWithRetryOnError(
13636
- async () => {
13637
- await stack.destroy({
13638
- color: "always",
13639
- onEvent: (event) => {
13640
- if (event.resOutputsEvent) {
13641
- currentResourceCount = updateResourceCount(
13642
- event.resOutputsEvent.metadata.op,
13643
- currentResourceCount
13644
- );
13645
- this.updateState({ id: instanceId, currentResourceCount });
13646
- return;
13647
- }
13648
- },
13649
- onOutput: (message) => {
13650
- this.updateState({ id: instanceId, logLine: message });
13651
- if (this.printOutput) {
13652
- console.log(message);
13653
- }
13654
- },
13655
- signal: options.signal
13656
- });
13657
- const extraOutputs = await this.getExtraOutputsStatePatch(stack);
13658
- this.updateState({
13659
- id: instanceId,
13660
- status: "not_created",
13661
- totalResourceCount: currentResourceCount,
13662
- ...extraOutputs
13663
- });
13664
- },
13665
- (error) => this.pulumiProjectHost.tryUnlockStack(stack, error)
13666
- );
13667
- }
13668
- );
13669
- } catch (error) {
13670
- this.updateState({
13671
- id: instanceId,
13672
- status: "error",
13673
- error: errorToString(error)
13674
- });
13675
- }
13676
- }
13677
- async refresh(options) {
13678
- const currentStatus = await this.validateStatus(options, [
13679
- "not_created",
13680
- "created",
13681
- "refreshing",
13682
- "error"
13683
- ]);
13684
- if (currentStatus === "refreshing") {
13685
- return;
13686
- }
13687
- void this.refreshWorker(options);
13688
- }
13689
- async refreshWorker(options) {
13690
- const instanceId = LocalRunnerBackend.getInstanceId(options);
13691
- try {
13692
- await this.pulumiProjectHost.runEmpty(
13693
- options.projectId,
13694
- options.instanceType,
13695
- options.instanceName,
13696
- async (stack) => {
13697
- var _a;
13698
- const summary = await stack.workspace.stack();
13699
- let currentResourceCount = 0;
13700
- let totalResourceCount = (_a = summary == null ? void 0 : summary.resourceCount) != null ? _a : 0;
13701
- this.updateState({
13702
- id: instanceId,
13703
- status: "refreshing",
13704
- currentResourceCount,
13705
- totalResourceCount
13706
- });
13707
- await runWithRetryOnError(
13708
- async () => {
13709
- await stack.refresh({
13710
- color: "always",
13711
- onEvent: (event) => {
13712
- if (event.resourcePreEvent) {
13713
- totalResourceCount = updateResourceCount(
13714
- event.resourcePreEvent.metadata.op,
13715
- totalResourceCount
13716
- );
13717
- this.updateState({ id: instanceId, totalResourceCount });
13718
- return;
13719
- }
13720
- if (event.resOutputsEvent) {
13721
- currentResourceCount = updateResourceCount(
13722
- event.resOutputsEvent.metadata.op,
13723
- currentResourceCount
13724
- );
13725
- this.updateState({ id: instanceId, currentResourceCount });
13726
- return;
13727
- }
13728
- },
13729
- onOutput: (message) => {
13730
- this.updateState({ id: instanceId, logLine: message });
13731
- if (this.printOutput) {
13732
- console.log(message);
13733
- }
13734
- },
13735
- signal: options.signal
13736
- });
13737
- const extraOutputs = await this.getExtraOutputsStatePatch(stack);
13738
- this.updateState({
13739
- id: instanceId,
13740
- status: "created",
13741
- totalResourceCount: currentResourceCount,
13742
- ...extraOutputs
13743
- });
13744
- },
13745
- (error) => this.pulumiProjectHost.tryUnlockStack(stack, error)
13746
- );
13747
- }
13748
- );
13749
- } catch (error) {
13750
- this.updateState({
13751
- id: instanceId,
13752
- status: "error",
13753
- error: errorToString(error)
13754
- });
13755
- }
13756
- }
13757
- async getExtraOutputsStatePatch(stack) {
13758
- const outputs = await stack.outputs();
13759
- const patch = {};
13760
- if (outputs["$status"]) {
13761
- patch.statusFields = z.array(instanceStatusFieldSchema).parse(outputs["$status"].value);
13762
- } else {
13763
- patch.statusFields = [];
13764
- }
13765
- if (outputs["$pages"]) {
13766
- const pages = z.array(instancePageSchema).parse(outputs["$pages"].value);
13767
- patch.pages = pages.map((page) => omit(page, ["content"]));
13768
- } else {
13769
- patch.pages = [];
13770
- }
13771
- if (outputs["$files"]) {
13772
- const files = z.array(instanceFileSchema).parse(outputs["$files"].value);
13773
- patch.files = files.map((file) => omit(file, ["content"]));
13774
- } else {
13775
- patch.files = [];
13776
- }
13777
- if (outputs["$terminals"]) {
13778
- const terminals = z.array(instanceTerminalSchema).parse(outputs["$terminals"].value);
13779
- patch.terminals = terminals.map((terminal) => pick(terminal, ["name", "title", "description"]));
13780
- } else {
13781
- patch.terminals = [];
13782
- }
13783
- if (outputs["$triggers"]) {
13784
- patch.triggers = z.array(instanceTriggerSchema).parse(outputs["$triggers"].value);
13785
- } else {
13786
- patch.triggers = [];
13787
- }
13788
- if (outputs["$secrets"]) {
13789
- patch.secrets = pickBy(
13790
- z.record(z.string().nullish()).parse(outputs["$secrets"].value),
13791
- (v) => !!v
13792
- );
13793
- } else {
13794
- patch.secrets = null;
13795
- }
13796
- patch.outputHash = await sha256(JSON.stringify(outputs));
13797
- return patch;
13798
- }
13799
- updateState(patch) {
13800
- this.events.emit(`state:${patch.id}`, patch);
13801
- }
13802
- async validateStatus(options, expectedStatuses) {
13803
- if (this.skipStateCheck) {
13804
- return;
13805
- }
13806
- const existingState = await this.getState(options);
13807
- if (!existingState) {
13808
- return;
13809
- }
13810
- if (!expectedStatuses.includes(existingState.status)) {
13811
- throw new InvalidInstanceStatusError(existingState.status, expectedStatuses);
13812
- }
13813
- return existingState.status;
13814
- }
13815
- static getInstanceId(options) {
13816
- return getInstanceId(options.instanceType, options.instanceName);
13817
- }
13818
- async resolveProjectPath(source) {
13819
- if (source.type === "local") {
13820
- if (!source.path) {
13821
- throw new Error("Source path is required for local units");
13822
- }
13823
- return resolve$1(this.sourceBasePath, source.path);
13824
- }
13825
- if (!this.skipSourceCheck) {
13826
- const packageName = source.version ? `${source.package}@${source.version}` : source.package;
13827
- await ensureDependencyInstalled(packageName);
13828
- }
13829
- const fullPath = source.path ? `${source.package}/${source.path}` : source.package;
13830
- const url = resolve$2(fullPath, globalThis._importMeta_.url);
13831
- const path = fileURLToPath(url);
13832
- const projectPath = dirname$1(path);
13833
- return projectPath;
13834
- }
13835
- async tryInstallMissingDependencies(error) {
13836
- if (!(error instanceof Error)) {
13837
- return false;
13838
- }
13839
- const pattern = /Cannot find module '(.*)'/;
13840
- const match = error.message.match(pattern);
13841
- if (!match) {
13842
- return false;
13843
- }
13844
- const packageName = match[1];
13845
- await ensureDependencyInstalled(packageName);
13846
- return true;
13847
- }
13848
- static async create(config, pulumiProjectHost) {
13849
- let sourceBasePath = config.HIGHSTATE_BACKEND_RUNNER_LOCAL_SOURCE_BASE_PATH;
13850
- if (!sourceBasePath) {
13851
- const [projectPath] = await resolveMainLocalProject();
13852
- sourceBasePath = resolve$1(projectPath, "units");
13853
- }
13854
- return new LocalRunnerBackend(
13855
- config.HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_SOURCE_CHECK,
13856
- config.HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_STATE_CHECK,
13857
- config.HIGHSTATE_BACKEND_RUNNER_LOCAL_PRINT_OUTPUT,
13858
- sourceBasePath,
13859
- pulumiProjectHost
13860
- );
13861
- }
13862
- }
13863
-
13864
- const runnerBackendConfig = z.object({
13865
- HIGHSTATE_BACKEND_RUNNER_TYPE: z.enum(["local"]).default("local"),
13866
- ...localRunnerBackendConfig.shape
13867
- });
13868
- function createRunnerBackend(config, pulumiProjectHost) {
13869
- switch (config.HIGHSTATE_BACKEND_RUNNER_TYPE) {
13870
- case "local": {
13871
- return LocalRunnerBackend.create(config, pulumiProjectHost);
13872
- }
13873
- }
13874
- }
13875
-
13876
- const evaluatedCompositeInstanceSchema = compositeInstanceSchema.extend({
13877
- inputHash: z.string()
13878
- });
13879
-
13880
- const localStateBackendConfig = z.object({
13881
- HIGHSTATE_BACKEND_STATE_LOCAL_DIR: z.string().optional()
13882
- });
13883
- class LocalStateBackend {
13884
- constructor(db, logger) {
13885
- this.db = db;
13886
- this.logger = logger;
13887
- this.logger.debug({ msg: "initialized", dbLocation: db.location });
13888
- }
13889
- async getActiveOperations() {
13890
- const sublevel = this.getActiveOperationsSublevel();
13891
- return this.getSublevelItems(sublevel, projectOperationSchema);
13892
- }
13893
- async getOperations(projectId, beforeOperationId) {
13894
- const sublevel = this.getProjectOperationsSublevel(projectId);
13895
- const pageSize = 10;
13896
- return await this.getSublevelItems(sublevel, projectOperationSchema, pageSize, {
13897
- lt: beforeOperationId,
13898
- reverse: true
13899
- });
13900
- }
13901
- async getInstanceStates(projectId) {
13902
- const sublevel = this.getProjectInstanceStatesSublevel(projectId);
13903
- return await this.getSublevelItems(sublevel, instanceStateSchema);
13904
- }
13905
- async getInstanceState(projectId, instanceID) {
13906
- const sublevel = this.getProjectInstanceStatesSublevel(projectId);
13907
- return await this.getSublevelItem(sublevel, instanceStateSchema, instanceID);
13908
- }
13909
- async getAffectedInstanceStates(operationId) {
13910
- const sublevel = this.getOperationInstanceStatesSublevel(operationId);
13911
- return await this.getSublevelItems(sublevel, instanceStateSchema);
13912
- }
13913
- async getInstanceLogs(operationId, instanceId) {
13914
- const sublevel = this.getOperationInstanceLogsSublevel(operationId, instanceId);
13915
- return await Array.fromAsync(sublevel.values());
13916
- }
13917
- async putOperation(operation) {
13918
- this.validateItem(projectOperationSchema, operation);
13919
- const operationsSublevel = this.getProjectOperationsSublevel(operation.projectId);
13920
- const activeOperationsSublevel = this.getActiveOperationsSublevel();
13921
- if (!isFinalOperationStatus(operation.status)) {
13922
- await this.db.batch([
13923
- { type: "put", key: operation.id, value: operation, sublevel: operationsSublevel },
13924
- { type: "put", key: operation.id, value: operation, sublevel: activeOperationsSublevel }
13925
- ]);
13926
- } else {
13927
- await this.db.batch([
13928
- { type: "put", key: operation.id, value: operation, sublevel: operationsSublevel },
13929
- { type: "del", key: operation.id, sublevel: activeOperationsSublevel }
13930
- ]);
13931
- }
13932
- }
13933
- async putAffectedInstanceStates(projectId, operationId, states) {
13934
- this.validateArray(instanceStateSchema, states);
13935
- const operationInstanceStatesSublevel = this.getOperationInstanceStatesSublevel(operationId);
13936
- const projectInstanceStatesSublevel = this.getProjectInstanceStatesSublevel(projectId);
13937
- await this.db.batch(
13938
- // put the states to both the operation and project sublevels
13939
- // denormalization is cool
13940
- // this separation is also necessary because the instance states can be updated without operations
13941
- states.flatMap((state) => [
13942
- {
13943
- type: "put",
13944
- key: state.id,
13945
- value: state,
13946
- sublevel: operationInstanceStatesSublevel
13947
- },
13948
- {
13949
- type: "put",
13950
- key: state.id,
13951
- value: state,
13952
- sublevel: projectInstanceStatesSublevel
13953
- }
13954
- ])
13955
- );
13956
- }
13957
- async putInstanceStates(projectId, states) {
13958
- this.validateArray(instanceStateSchema, states);
13959
- const sublevel = this.getProjectInstanceStatesSublevel(projectId);
13960
- await sublevel.batch(
13961
- // as i told before, we update the instance states without operations
13962
- // this method is used when upstream instance state changes are detected
13963
- states.map((state) => ({
13964
- type: "put",
13965
- key: state.id,
13966
- value: state
13967
- }))
13968
- );
13969
- }
13970
- async appendInstanceLogs(operationId, logs) {
13971
- const sublevels = /* @__PURE__ */ new Map();
13972
- for (const [instanceId] of logs) {
13973
- if (sublevels.has(instanceId)) {
13974
- continue;
13975
- }
13976
- const sublevel = this.getOperationInstanceLogsSublevel(operationId, instanceId);
13977
- sublevels.set(instanceId, sublevel);
13978
- }
13979
- await this.db.batch(
13980
- logs.map(([instanceID, line]) => ({
13981
- type: "put",
13982
- key: uuidv7(),
13983
- value: line,
13984
- sublevel: sublevels.get(instanceID)
13985
- }))
13986
- );
13987
- }
13988
- async getCompositeInstance(projectId, instanceId) {
13989
- const sublevel = this.getProjectCompositeInstancesSublevel(projectId);
13990
- return this.getSublevelItem(sublevel, evaluatedCompositeInstanceSchema, instanceId);
13991
- }
13992
- async getCompositeInstanceInputHash(projectId, instanceId) {
13993
- const sublevel = this.getProjectCompositeInstanceInputHashesSublevel(projectId);
13994
- const inputHash = await sublevel.get(instanceId);
13995
- return inputHash != null ? inputHash : null;
13996
- }
13997
- async putCompositeInstances(projectId, instances) {
13998
- this.validateArray(evaluatedCompositeInstanceSchema, instances);
13999
- const sublevel = this.getProjectCompositeInstancesSublevel(projectId);
14000
- const inputHashesSublevel = this.getProjectCompositeInstanceInputHashesSublevel(projectId);
14001
- await this.db.batch(
14002
- instances.flatMap((instance) => [
14003
- {
14004
- type: "put",
14005
- key: instance.instance.id,
14006
- value: evaluatedCompositeInstanceSchema.parse(instance),
14007
- sublevel
14008
- },
14009
- {
14010
- type: "put",
14011
- key: instance.instance.id,
14012
- value: instance.inputHash,
14013
- sublevel: inputHashesSublevel
14014
- }
14015
- ])
14016
- );
14017
- }
14018
- async clearCompositeInstances(projectId, instanceIds) {
14019
- const sublevel = this.getProjectCompositeInstancesSublevel(projectId);
14020
- const inputHashesSublevel = this.getProjectCompositeInstanceInputHashesSublevel(projectId);
14021
- await this.db.batch(
14022
- instanceIds.flatMap((instanceId) => [
14023
- { type: "del", key: instanceId, sublevel },
14024
- { type: "del", key: instanceId, sublevel: inputHashesSublevel }
14025
- ])
14026
- );
14027
- }
14028
- async getTerminalSessions(projectId, instanceId) {
14029
- const sublevel = this.getTerminalSessionsSublevel(projectId, instanceId);
14030
- return await this.getSublevelItems(sublevel, terminalSessionSchema);
14031
- }
14032
- async getTerminalSession(projectId, instanceId, sessionId) {
14033
- const sublevel = this.getTerminalSessionsSublevel(projectId, instanceId);
14034
- return await this.getSublevelItem(sublevel, terminalSessionSchema, sessionId);
14035
- }
14036
- async putTerminalSession(projectId, instanceId, session) {
14037
- this.validateItem(terminalSessionSchema, session);
14038
- const sublevel = this.getTerminalSessionsSublevel(projectId, instanceId);
14039
- await sublevel.put(session.id, session);
14040
- }
14041
- async getTerminalSessionHistory(sessionId) {
14042
- const sublevel = this.getTerminalSessionHistorySublevel(sessionId);
14043
- return await Array.fromAsync(sublevel.values());
14044
- }
14045
- async appendTerminalSessionHistory(lines) {
14046
- const sublevels = /* @__PURE__ */ new Map();
14047
- for (const [sessionId] of lines) {
14048
- if (sublevels.has(sessionId)) {
14049
- continue;
14050
- }
14051
- const sublevel = this.getTerminalSessionHistorySublevel(sessionId);
14052
- sublevels.set(sessionId, sublevel);
14053
- }
14054
- await this.db.batch(
14055
- lines.map(([sessionId, line]) => ({
14056
- type: "put",
14057
- key: uuidv7(),
14058
- value: line,
14059
- sublevel: sublevels.get(sessionId)
14060
- }))
14061
- );
14062
- }
14063
- async getSublevelItems(sublevel, schema, limit, options) {
14064
- const result = [];
14065
- const iterator = options ? sublevel.iterator(options) : sublevel.iterator();
14066
- const invalidKeys = [];
14067
- for await (const [key, value] of iterator) {
14068
- const parseResult = schema.safeParse(value);
14069
- if (!parseResult.success) {
14070
- this.logger.warn({
14071
- msg: "failed to parse item, it will be deleted",
14072
- error: parseResult.error,
14073
- sublevel: sublevel.prefix,
14074
- key
14075
- });
14076
- invalidKeys.push(key);
14077
- continue;
14078
- }
14079
- result.push(parseResult.data);
14080
- if (limit && result.length >= limit) {
14081
- break;
14082
- }
14083
- }
14084
- if (invalidKeys.length > 0) {
14085
- this.logger.info({
14086
- msg: "deleting invalid items",
14087
- sublevel: sublevel.prefix,
14088
- keyCount: invalidKeys.length
14089
- });
14090
- await sublevel.batch(invalidKeys.map((key) => ({ type: "del", key })));
14091
- }
14092
- return result;
14093
- }
14094
- async getSublevelItem(sublevel, schema, key) {
14095
- const value = await sublevel.get(key);
14096
- if (!value) {
14097
- return null;
14098
- }
14099
- const parseResult = schema.safeParse(value);
14100
- if (!parseResult.success) {
14101
- this.logger.warn({
14102
- msg: "failed to parse item, it will be deleted",
14103
- error: parseResult.error,
14104
- sublevel: sublevel.prefix,
14105
- key
14106
- });
14107
- await sublevel.del(key);
14108
- return null;
14109
- }
14110
- return parseResult.data;
14111
- }
14112
- validateItem(schema, item) {
14113
- const parseResult = schema.safeParse(item);
14114
- if (!parseResult.success) {
14115
- this.logger.error({
14116
- msg: "failed to validate item",
14117
- error: parseResult.error,
14118
- item
14119
- });
14120
- throw new Error(`Failed to validate item: ${parseResult.error.errors[0].message}`, {
14121
- cause: parseResult.error
14122
- });
14123
- }
14124
- }
14125
- validateArray(schema, items) {
14126
- for (const item of items) {
14127
- this.validateItem(schema, item);
14128
- }
14129
- }
14130
- getActiveOperationsSublevel() {
14131
- return this.getJsonSublevel("activeOperations");
14132
- }
14133
- getProjectOperationsSublevel(projectId) {
14134
- return this.getJsonSublevel(`projects/${projectId}/operations`);
14135
- }
14136
- getProjectCompositeInstancesSublevel(projectId) {
14137
- return this.getJsonSublevel(`projects/${projectId}/compositeInstances`);
14138
- }
14139
- getProjectCompositeInstanceInputHashesSublevel(projectId) {
14140
- return this.getStringSublevel(`projects/${projectId}/compositeInstanceInputHashes`);
14141
- }
14142
- getProjectInstanceStatesSublevel(projectId) {
14143
- return this.getJsonSublevel(`projects/${projectId}/instanceStates`);
14144
- }
14145
- getOperationInstanceStatesSublevel(operationId) {
14146
- return this.getJsonSublevel(`operations/${operationId}/instanceStates`);
14147
- }
14148
- getOperationInstanceLogsSublevel(operationId, instanceId) {
14149
- return this.getStringSublevel(`operations/${operationId}/instances/${instanceId}/logs`);
14150
- }
14151
- getTerminalSessionsSublevel(projectId, instanceId) {
14152
- return this.getJsonSublevel(`projects/${projectId}/instances/${instanceId}/terminalSessions`);
14153
- }
14154
- getTerminalSessionHistorySublevel(sessionId) {
14155
- return this.getStringSublevel(`terminalSessions/${sessionId}/history`);
14156
- }
14157
- getStringSublevel(path) {
14158
- return this.db.sublevel(path, { valueEncoding: "utf8" });
14159
- }
14160
- getJsonSublevel(path) {
14161
- return this.db.sublevel(path, { valueEncoding: "json" });
14162
- }
14163
- static async create(config, localPulumiHost, logger) {
14164
- const childLogger = logger.child({ backend: "StateBackend", service: "LocalStateBackend" });
14165
- let location = config.HIGHSTATE_BACKEND_STATE_LOCAL_DIR;
14166
- if (!location) {
14167
- const currentUser = await localPulumiHost.getCurrentUser();
14168
- if (!currentUser) {
14169
- throw new Error(
14170
- "The pulumi is not authenticated, please login first or specify the state location manually"
14171
- );
14172
- }
14173
- if (!currentUser.url) {
14174
- throw new Error(
14175
- "The pulumi user does not have a URL, please specify the state location manually"
14176
- );
14177
- }
14178
- const path = currentUser.url.replace("file://", "").replace("~", process.env.HOME);
14179
- location = resolve$1(path, ".pulumi", ".highstate");
14180
- childLogger.debug({
14181
- msg: "auto-detected state location",
14182
- pulumiStateUrl: currentUser.url,
14183
- location
14184
- });
14185
- }
14186
- const { ClassicLevel } = await import('classic-level');
14187
- const db = new ClassicLevel(location);
14188
- return new LocalStateBackend(db, childLogger);
14189
- }
14190
- }
14191
-
14192
- const stateBackendConfig = z.object({
14193
- HIGHSTATE_BACKEND_STATE_TYPE: z.enum(["local"]).default("local"),
14194
- ...localStateBackendConfig.shape
14195
- });
14196
- function createStateBackend(config, localPulumiHost, logger) {
14197
- switch (config.HIGHSTATE_BACKEND_STATE_TYPE) {
14198
- case "local": {
14199
- return LocalStateBackend.create(config, localPulumiHost, logger);
14200
- }
14201
- }
14202
- }
14203
-
14204
- const localWorkspaceBackendConfig = z.object({
14205
- HIGHSTATE_BACKEND_WORKSPACE_LOCAL_DIR: z.string().optional()
14206
- });
14207
- class LocalWorkspaceBackend {
14208
- constructor(db) {
14209
- this.db = db;
14210
- }
14211
- async getWorkspaceLayout() {
14212
- return await this.db.get("layout");
14213
- }
14214
- async setWorkspaceLayout(layout) {
14215
- await this.db.put("layout", layout);
14216
- }
14217
- async getProjectViewport(projectId) {
14218
- return await this.db.get(`viewports/projects/${projectId}`);
14219
- }
14220
- async setProjectViewport(projectId, viewport) {
14221
- await this.db.put(`viewports/projects/${projectId}`, viewport);
14222
- }
14223
- async getInstanceViewport(projectId, instanceId) {
14224
- return await this.db.get(`viewports/instances/${projectId}/${instanceId}`);
14225
- }
14226
- async setInstanceViewport(projectId, instanceId, viewport) {
14227
- await this.db.put(`viewports/instances/${projectId}/${instanceId}`, viewport);
14228
- }
14229
- static async create(config) {
14230
- let location = config.HIGHSTATE_BACKEND_WORKSPACE_LOCAL_DIR;
14231
- if (!location) {
14232
- const home = homedir();
14233
- location = resolve$1(home, ".highstate/workspace");
14234
- }
14235
- const { ClassicLevel } = await import('classic-level');
14236
- const db = new ClassicLevel(location, { valueEncoding: "json" });
14237
- return new LocalWorkspaceBackend(db);
14238
- }
14239
- }
14240
-
14241
- const workspaceBackendConfig = z.object({
14242
- HIGHSTATE_BACKEND_WORKSPACE_TYPE: z.enum(["local"]).default("local"),
14243
- ...localWorkspaceBackendConfig.shape
14244
- });
14245
- function createWorkspaceBackend(config) {
14246
- return LocalWorkspaceBackend.create(config);
14247
- }
14248
-
14249
- const loggerConfig = z.object({
14250
- HIGHSTATE_BACKEND_LOGGER_NAME: z.string().default("highstate-backend"),
14251
- HIGHSTATE_BACKEND_LOGGER_LEVEL: z.enum(["fatal", "error", "warn", "info", "debug", "trace"]).default("info")
14252
- });
14253
- const configSchema = z.object({
14254
- ...libraryBackendConfig.shape,
14255
- ...projectBackendConfig.shape,
14256
- ...secretBackendConfig.shape,
14257
- ...stateBackendConfig.shape,
14258
- ...runnerBackendConfig.shape,
14259
- ...terminalBackendConfig.shape,
14260
- ...workspaceBackendConfig.shape,
14261
- ...loggerConfig.shape
14262
- });
14263
- async function loadConfig(env = process.env, useDotenv = true) {
14264
- if (useDotenv) {
14265
- await import('dotenv/config');
14266
- }
14267
- return configSchema.parse(env);
14268
- }
14269
-
14270
- var __defProp$1 = Object.defineProperty;
14271
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14272
- var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
14273
- const _RuntimeOperation = class _RuntimeOperation {
14274
- constructor(operation, runnerBackend, stateBackend, libraryBackend, projectBackend, secretBackend, projectLock, operationEE, stateEE, compositeInstanceEE, instanceLogsEE, logger) {
14275
- this.operation = operation;
14276
- this.runnerBackend = runnerBackend;
14277
- this.stateBackend = stateBackend;
14278
- this.libraryBackend = libraryBackend;
14279
- this.projectBackend = projectBackend;
14280
- this.secretBackend = secretBackend;
14281
- this.projectLock = projectLock;
14282
- this.operationEE = operationEE;
14283
- this.stateEE = stateEE;
14284
- this.compositeInstanceEE = compositeInstanceEE;
14285
- this.instanceLogsEE = instanceLogsEE;
14286
- this.logger = logger;
14287
- __publicField$1(this, "abortController", new AbortController());
14288
- __publicField$1(this, "instanceMap", /* @__PURE__ */ new Map());
14289
- __publicField$1(this, "hubMap", /* @__PURE__ */ new Map());
14290
- __publicField$1(this, "resolvedInstanceInputs", /* @__PURE__ */ new Map());
14291
- __publicField$1(this, "compositeInstanceLock", new BetterLock());
14292
- __publicField$1(this, "compositeInstanceMap", /* @__PURE__ */ new Map());
14293
- __publicField$1(this, "initialStatusMap", /* @__PURE__ */ new Map());
14294
- __publicField$1(this, "stateMap", /* @__PURE__ */ new Map());
14295
- __publicField$1(this, "instancePromiseMap", /* @__PURE__ */ new Map());
14296
- __publicField$1(this, "childrenStateMap", /* @__PURE__ */ new Map());
14297
- __publicField$1(this, "dependentStateMap", /* @__PURE__ */ new Map());
14298
- __publicField$1(this, "library");
14299
- __publicField$1(this, "resolveInputHash");
14300
- __publicField$1(this, "persistStates", funnel(
14301
- (states) => {
14302
- this.logger.debug({ msg: "persisting states", count: states.length });
14303
- void this.stateBackend.putAffectedInstanceStates(
14304
- this.operation.projectId,
14305
- this.operation.id,
14306
- states
14307
- );
14308
- },
14309
- {
14310
- minQuietPeriodMs: 100,
14311
- maxBurstDurationMs: 1e3,
14312
- triggerAt: "end",
14313
- reducer: arrayAccumulator
14314
- }
14315
- ));
14316
- __publicField$1(this, "persistLogs", funnel(
14317
- (entries) => {
14318
- this.logger.trace({ msg: "persisting logs", count: entries.length });
14319
- void this.stateBackend.appendInstanceLogs(this.operation.id, entries);
14320
- },
14321
- {
14322
- minQuietPeriodMs: 100,
14323
- maxBurstDurationMs: 200,
14324
- reducer: arrayAccumulator
14325
- }
14326
- ));
14327
- __publicField$1(this, "persistSecrets", funnel(
14328
- (entries) => {
14329
- this.logger.debug({ msg: "persisting secrets", count: entries.length });
14330
- for (const [instanceId, secrets] of entries) {
14331
- void this.secretBackend.get(this.operation.projectId, instanceId).then((existingSecrets) => {
14332
- Object.assign(existingSecrets, secrets);
14333
- return this.secretBackend.set(this.operation.projectId, instanceId, existingSecrets);
14334
- });
14335
- }
14336
- },
14337
- {
14338
- minQuietPeriodMs: 100,
14339
- maxBurstDurationMs: 200,
14340
- reducer: arrayAccumulator
14341
- }
14342
- ));
14343
- }
14344
- async operateSafe() {
14345
- try {
14346
- await this.operate();
14347
- } catch (error) {
14348
- if (_RuntimeOperation.isAbortError(error)) {
14349
- this.logger.info("the operation was cancelled");
14350
- this.operation.status = "cancelled";
14351
- await this.updateOperation();
14352
- return;
14353
- }
14354
- this.logger.error({ msg: "an error occurred while running the operation", error });
14355
- this.operation.status = "failed";
14356
- this.operation.error = errorToString(error);
14357
- await this.updateOperation();
14358
- } finally {
14359
- this.resetPendingStateStatuses();
14360
- await Promise.all([
14361
- this.persistStates.flush(),
14362
- this.persistLogs.flush(),
14363
- this.persistSecrets.flush()
14364
- ]);
14365
- this.logger.debug("operation finished, all entries persisted");
14366
- }
14367
- }
14368
- resetPendingStateStatuses() {
14369
- for (const state of this.stateMap.values()) {
14370
- if (state.status !== "pending") {
14371
- continue;
14372
- }
14373
- let initialStatus = this.initialStatusMap.get(state.id);
14374
- let error = state.error;
14375
- if (initialStatus === "destroying" || initialStatus === "pending" || initialStatus === "refreshing" || initialStatus === "updating") {
14376
- initialStatus = "error";
14377
- error != null ? error : error = "unexpected progressing instance status";
14378
- }
14379
- if (initialStatus) {
14380
- this.updateInstanceState({ id: state.id, status: initialStatus, error });
14381
- }
14382
- }
14383
- }
14384
- async operate() {
14385
- this.logger.info("starting operation");
14386
- const { instances: projectInstances, hubs } = await this.projectBackend.getProject(
14387
- this.operation.projectId
14388
- );
14389
- this.abortController.signal.throwIfAborted();
14390
- const states = await this.stateBackend.getInstanceStates(this.operation.projectId);
14391
- this.abortController.signal.throwIfAborted();
14392
- this.library = await this.libraryBackend.loadLibrary();
14393
- this.logger.info("library ready");
14394
- this.abortController.signal.throwIfAborted();
14395
- const allInstances = projectInstances.filter((instance) => {
14396
- return instance.type in this.library.components;
14397
- });
14398
- const inputResolverNodes = /* @__PURE__ */ new Map();
14399
- for (const hub of hubs) {
14400
- this.hubMap.set(hub.id, hub);
14401
- inputResolverNodes.set(`hub:${hub.id}`, { kind: "hub", hub });
14402
- }
14403
- for (const instance of allInstances) {
14404
- this.instanceMap.set(instance.id, instance);
14405
- inputResolverNodes.set(`instance:${instance.id}`, {
14406
- kind: "instance",
14407
- instance,
14408
- component: this.library.components[instance.type]
14409
- });
14410
- }
14411
- const resolveInputs = createInputResolver(
14412
- inputResolverNodes,
14413
- this.logger.child({ resolver: "input-resolver" })
14414
- );
14415
- for (const instance of allInstances) {
14416
- const output = await resolveInputs(`instance:${instance.id}`);
14417
- if (output.kind !== "instance") {
14418
- throw new Error("Unexpected output kind, expected instance");
14419
- }
14420
- this.resolvedInstanceInputs.set(instance.id, output.resolvedInputs);
14421
- }
14422
- for (const state of states) {
14423
- this.stateMap.set(state.id, state);
14424
- this.initialStatusMap.set(state.id, state.status);
14425
- this.tryAddStateToParent(state);
14426
- this.addDependentState(state);
14427
- }
14428
- const inputHashNodes = /* @__PURE__ */ new Map();
14429
- for (const instance of allInstances) {
14430
- inputHashNodes.set(instance.id, {
14431
- instance,
14432
- resolvedInputs: this.resolvedInstanceInputs.get(instance.id),
14433
- state: this.stateMap.get(instance.id),
14434
- sourceHash: void 0
14435
- // TODO: implement source hash
14436
- });
14437
- }
14438
- this.resolveInputHash = createInputHashResolver(
14439
- inputHashNodes,
14440
- this.logger.child({ resolver: "input-hash-resolver" })
14441
- );
14442
- if (this.operation.type === "update") {
14443
- await this.extendWithNotCreatedDependencies();
14444
- await this.updateOperation();
14445
- } else if (this.operation.type === "destroy") {
14446
- this.extendWithCreatedDependents();
14447
- await this.updateOperation();
14448
- }
14449
- this.logger.info("all instances loaded", {
14450
- count: allInstances.length,
14451
- affectedCount: this.operation.instanceIds.length
14452
- });
14453
- if (this.operation.type === "evaluate") {
14454
- this.logger.info("evaluating instances");
14455
- await this.evaluateCompositeInstances();
14456
- } else {
14457
- const promises = [];
14458
- for (const instanceId of this.operation.instanceIds) {
14459
- promises.push(this.getInstancePromiseForOperation(instanceId));
14460
- }
14461
- this.logger.info("all units operations started");
14462
- this.operation.status = "running";
14463
- await this.updateOperation();
14464
- await Promise.all(promises);
14465
- this.logger.info("all units completed");
14466
- }
14467
- this.operation.status = "completed";
14468
- this.operation.error = null;
14469
- await this.updateOperation();
14470
- this.logger.info("operation completed");
14471
- }
14472
- cancel() {
14473
- this.logger.info("cancelling operation");
14474
- this.abortController.abort();
14475
- }
14476
- getInstancePromiseForOperation(instanceId) {
14477
- const instance = this.instanceMap.get(instanceId);
14478
- if (!instance) {
14479
- throw new Error(`Instance not found: ${instanceId}`);
14480
- }
14481
- const component = this.library.components[instance.type];
14482
- if (!component) {
14483
- throw new Error(`Component not found: ${instance.type}`);
14484
- }
14485
- if (isUnitModel(component)) {
14486
- return this.getUnitPromise(instance, component);
14487
- }
14488
- return this.getCompositePromise(instance);
14489
- }
14490
- async getUnitPromise(instance, component) {
14491
- switch (this.operation.type) {
14492
- case "update": {
14493
- return this.updateUnit(instance, component);
14494
- }
14495
- case "recreate": {
14496
- return this.recreateUnit(instance, component);
14497
- }
14498
- case "destroy": {
14499
- return this.destroyUnit(instance.id, component);
14500
- }
14501
- case "refresh": {
14502
- return this.refreshUnit(instance.id);
14503
- }
14504
- }
14505
- }
14506
- async getCompositePromise(instance) {
14507
- const logger = this.logger.child({ instanceId: instance.id });
14508
- return this.getInstancePromise(instance.id, async () => {
14509
- var _a, _b;
14510
- const initialStatus = (_b = (_a = this.stateMap.get(instance.id)) == null ? void 0 : _a.status) != null ? _b : "not_created";
14511
- this.updateInstanceState({
14512
- id: instance.id,
14513
- latestOperationId: this.operation.id,
14514
- status: this.getStatusByOperationType(),
14515
- currentResourceCount: 0,
14516
- totalResourceCount: 0
14517
- });
14518
- const { children } = await this.loadCompositeInstance(instance.id);
14519
- const childPromises = [];
14520
- if (!children.length) {
14521
- logger.warn("no children found for composite component");
14522
- }
14523
- for (const child of children) {
14524
- logger.info("waiting for child", { childId: child.id });
14525
- childPromises.push(this.getInstancePromiseForOperation(child.id));
14526
- }
14527
- try {
14528
- await Promise.all(childPromises);
14529
- this.abortController.signal.throwIfAborted();
14530
- if (children.length > 0) {
14531
- logger.info("all children completed", { count: children.length });
14532
- }
14533
- this.updateInstanceState({
14534
- id: instance.id,
14535
- status: "created"
14536
- });
14537
- } catch (error) {
14538
- if (_RuntimeOperation.isAbortError(error)) {
14539
- this.updateInstanceState({
14540
- id: instance.id,
14541
- status: initialStatus
14542
- });
14543
- return;
14544
- }
14545
- this.updateInstanceState({
14546
- id: instance.id,
14547
- status: "error",
14548
- error: errorToString(error)
14549
- });
14550
- }
14551
- });
14552
- }
14553
- updateUnit(instance, component) {
14554
- const logger = this.logger.child({ instanceId: instance.id });
14555
- return this.getInstancePromise(instance.id, async () => {
14556
- this.updateInstanceState({
14557
- id: instance.id,
14558
- latestOperationId: this.operation.id,
14559
- status: "pending",
14560
- currentResourceCount: 0,
14561
- totalResourceCount: 0
14562
- });
14563
- const dependencies = this.getInstanceDependencies(instance);
14564
- const dependencyPromises = [];
14565
- for (const dependency of dependencies) {
14566
- if (!this.operation.instanceIds.includes(dependency.id)) {
14567
- continue;
14568
- }
14569
- logger.info("waiting for dependency", { dependencyId: dependency.id });
14570
- dependencyPromises.push(this.getInstancePromiseForOperation(dependency.id));
14571
- }
14572
- await Promise.all(dependencyPromises);
14573
- this.abortController.signal.throwIfAborted();
14574
- if (dependencies.length > 0) {
14575
- logger.info("all dependencies completed", { count: dependencies.length });
14576
- }
14577
- logger.info("updating unit...");
14578
- const secrets = await this.secretBackend.get(this.operation.projectId, instance.id);
14579
- this.abortController.signal.throwIfAborted();
14580
- logger.debug("secrets loaded", { count: Object.keys(secrets).length });
14581
- await this.runnerBackend.update({
14582
- projectId: this.operation.projectId,
14583
- instanceType: instance.type,
14584
- instanceName: instance.name,
14585
- config: await this.prepareUnitConfig(instance),
14586
- secrets: mapValues(secrets, (value) => valueToString(value)),
14587
- source: this.resolveUnitSource(component),
14588
- signal: this.abortController.signal
14589
- });
14590
- logger.debug("unit update requested");
14591
- const stream = this.runnerBackend.watch({
14592
- projectId: this.operation.projectId,
14593
- instanceType: instance.type,
14594
- instanceName: instance.name,
14595
- finalStatuses: ["created", "error"]
14596
- });
14597
- await this.watchStateStream(stream);
14598
- const inputHash = await this.resolveInputHash(instance.id);
14599
- this.updateInstanceState({ id: instance.id, inputHash });
14600
- logger.debug("input hash after update", { inputHash });
14601
- logger.info("unit updated");
14602
- });
14603
- }
14604
- async processBeforeDestroyTriggers(state, component, logger) {
14605
- const instance = this.instanceMap.get(state.id);
14606
- if (!instance) {
14607
- throw new Error(`Instance not found: ${state.id}`);
14608
- }
14609
- const triggers = state.triggers.filter((trigger) => trigger.spec.type === "before-destroy");
14610
- if (triggers.length === 0) {
14611
- return;
14612
- }
14613
- const invokedTriggers = triggers.map((trigger) => ({ name: trigger.name }));
14614
- logger.info("updating unit to process before-destroy triggers...");
14615
- const secrets = await this.secretBackend.get(this.operation.projectId, instance.id);
14616
- this.abortController.signal.throwIfAborted();
14617
- logger.debug("secrets loaded", { count: Object.keys(secrets).length });
14618
- await this.runnerBackend.update({
14619
- projectId: this.operation.projectId,
14620
- instanceType: instance.type,
14621
- instanceName: instance.name,
14622
- config: await this.prepareUnitConfig(instance, invokedTriggers),
14623
- secrets: mapValues(secrets, (value) => valueToString(value)),
14624
- source: this.resolveUnitSource(component),
14625
- signal: this.abortController.signal
14626
- });
14627
- logger.debug("unit update requested");
14628
- const stream = this.runnerBackend.watch({
14629
- projectId: this.operation.projectId,
14630
- instanceType: instance.type,
14631
- instanceName: instance.name,
14632
- finalStatuses: ["created", "error"]
14633
- });
14634
- await this.watchStateStream(stream);
14635
- logger.debug("before-destroy triggers processed");
14636
- }
14637
- async destroyUnit(instanceId, component) {
14638
- const logger = this.logger.child({ instanceId });
14639
- return this.getInstancePromise(instanceId, async () => {
14640
- var _a;
14641
- this.updateInstanceState({
14642
- id: instanceId,
14643
- latestOperationId: this.operation.id,
14644
- status: "pending",
14645
- currentResourceCount: 0,
14646
- totalResourceCount: 0
14647
- });
14648
- const state = this.stateMap.get(instanceId);
14649
- if (!state) {
14650
- logger.warn("state not found for unit, but destroy was requested");
14651
- return;
14652
- }
14653
- const dependentPromises = [];
14654
- const dependents = (_a = this.dependentStateMap.get(instanceId)) != null ? _a : [];
14655
- for (const dependent of dependents) {
14656
- dependentPromises.push(this.getInstancePromiseForOperation(dependent.id));
14657
- }
14658
- await Promise.all(dependentPromises);
14659
- this.abortController.signal.throwIfAborted();
14660
- await this.processBeforeDestroyTriggers(state, component, logger);
14661
- logger.info("destroying unit...");
14662
- const [type, name] = parseInstanceId(instanceId);
14663
- await this.runnerBackend.destroy({
14664
- projectId: this.operation.projectId,
14665
- instanceType: type,
14666
- instanceName: name,
14667
- signal: this.abortController.signal
14668
- });
14669
- this.logger.debug("destroy request sent");
14670
- const stream = this.runnerBackend.watch({
14671
- projectId: this.operation.projectId,
14672
- instanceType: type,
14673
- instanceName: name,
14674
- finalStatuses: ["not_created", "error"]
14675
- });
14676
- await this.watchStateStream(stream);
14677
- this.logger.info("unit destroyed");
14678
- });
14679
- }
14680
- async recreateUnit(instance, component) {
14681
- const logger = this.logger.child({ instanceId: instance.id });
14682
- return this.getInstancePromise(instance.id, async () => {
14683
- this.updateInstanceState({
14684
- id: instance.id,
14685
- latestOperationId: this.operation.id,
14686
- status: "pending",
14687
- currentResourceCount: 0,
14688
- totalResourceCount: 0
14689
- });
14690
- const state = this.stateMap.get(instance.id);
14691
- if (!state) {
14692
- logger.warn("state not found for unit, but recreate was requested");
14693
- return;
14694
- }
14695
- await this.processBeforeDestroyTriggers(state, component, logger);
14696
- logger.info("destroying unit...");
14697
- await this.runnerBackend.destroy({
14698
- projectId: this.operation.projectId,
14699
- instanceType: instance.type,
14700
- instanceName: instance.name,
14701
- signal: this.abortController.signal
14702
- });
14703
- logger.debug("destroy request sent");
14704
- const destroyStream = this.runnerBackend.watch({
14705
- projectId: this.operation.projectId,
14706
- instanceType: instance.type,
14707
- instanceName: instance.name,
14708
- finalStatuses: ["not_created", "error"]
14709
- });
14710
- await this.watchStateStream(destroyStream);
14711
- this.abortController.signal.throwIfAborted();
14712
- logger.info("unit destroyed");
14713
- logger.info("updating unit...");
14714
- const secrets = await this.secretBackend.get(this.operation.projectId, instance.id);
14715
- this.abortController.signal.throwIfAborted();
14716
- logger.debug("secrets loaded", { count: Object.keys(secrets).length });
14717
- await this.runnerBackend.update({
14718
- projectId: this.operation.projectId,
14719
- instanceType: instance.type,
14720
- instanceName: instance.name,
14721
- config: await this.prepareUnitConfig(instance),
14722
- secrets: mapValues(secrets, (value) => valueToString(value)),
14723
- source: this.resolveUnitSource(component),
14724
- signal: this.abortController.signal
14725
- });
14726
- logger.debug("unit update requested");
14727
- const updateStream = this.runnerBackend.watch({
14728
- projectId: this.operation.projectId,
14729
- instanceType: instance.type,
14730
- instanceName: instance.name,
14731
- finalStatuses: ["created", "error"]
14732
- });
14733
- this.updateInstanceState({ id: instance.id, inputHash: null });
14734
- await this.watchStateStream(updateStream);
14735
- logger.info("unit recreated");
14736
- });
14737
- }
14738
- async refreshUnit(instanceId) {
14739
- const logger = this.logger.child({ instanceId });
14740
- return this.getInstancePromise(instanceId, async () => {
14741
- this.updateInstanceState({
14742
- id: instanceId,
14743
- latestOperationId: this.operation.id,
14744
- status: "refreshing",
14745
- currentResourceCount: 0,
14746
- totalResourceCount: 0
14747
- });
14748
- logger.info("refreshing unit...");
14749
- const [type, name] = parseInstanceId(instanceId);
14750
- await this.runnerBackend.refresh({
14751
- projectId: this.operation.projectId,
14752
- instanceType: type,
14753
- instanceName: name,
14754
- signal: this.abortController.signal
14755
- });
14756
- logger.debug("unit refresh requested");
14757
- const stream = this.runnerBackend.watch({
14758
- projectId: this.operation.projectId,
14759
- instanceType: type,
14760
- instanceName: name,
14761
- finalStatuses: ["created", "error"]
14762
- });
14763
- await this.watchStateStream(stream);
14764
- logger.info("unit refreshed");
14765
- });
14766
- }
14767
- async watchStateStream(stream) {
14768
- let statePatch;
14769
- for await (statePatch of stream) {
14770
- if (statePatch.status === "not_created" && this.operation.type === "recreate") {
14771
- continue;
14772
- }
14773
- this.updateInstanceState(statePatch);
14774
- }
14775
- if (!statePatch) {
14776
- throw new Error("The stream ended without emitting any state.");
14777
- }
14778
- if (statePatch.status === "error") {
14779
- throw new Error(`The operation on unit "${statePatch.id}" failed: ${statePatch.error}`);
14780
- }
14781
- }
14782
- async prepareUnitConfig(instance, invokedTriggers = []) {
14783
- var _a, _b;
14784
- const config = {};
14785
- for (const [key, value] of Object.entries((_a = instance.args) != null ? _a : {})) {
14786
- config[key] = valueToString(value);
14787
- }
14788
- const instanceInputs = (_b = this.resolvedInstanceInputs.get(instance.id)) != null ? _b : {};
14789
- for (const [key, value] of Object.entries(instanceInputs)) {
14790
- const resolvedInput = await this.resolveInstanceInput(value.map((input) => input.input));
14791
- config[`input.${key}`] = JSON.stringify(resolvedInput);
14792
- }
14793
- config["$invokedTriggers"] = JSON.stringify(invokedTriggers);
14794
- return config;
14795
- }
14796
- async resolveInstanceInput(input) {
14797
- const promises = input.map((input2) => this.resolveSingleInstanceInput(input2));
14798
- const results = await Promise.all(promises);
14799
- return results.flat();
14800
- }
14801
- async resolveSingleInstanceInput(input) {
14802
- var _a;
14803
- const loadedInstance = this.instanceMap.get(input.instanceId);
14804
- if (loadedInstance && !loadedInstance.parentId) {
14805
- return [input];
14806
- }
14807
- const parentInstance = await this.loadCompositeInstance(input.instanceId);
14808
- const parentOutput = (_a = parentInstance.instance.outputs) == null ? void 0 : _a[input.output];
14809
- if (!parentOutput) {
14810
- throw new Error(`Output "${input.output}" not found in "${input.instanceId}"`);
14811
- }
14812
- return await this.resolveInstanceInput(parentOutput);
14813
- }
14814
- async loadCompositeInstance(instanceId) {
14815
- return await this.compositeInstanceLock.acquire(instanceId, async () => {
14816
- const existingInstance = this.compositeInstanceMap.get(instanceId);
14817
- if (existingInstance) {
14818
- return existingInstance;
14819
- }
14820
- const compositeInstance = await this.stateBackend.getCompositeInstance(
14821
- this.operation.projectId,
14822
- instanceId
14823
- );
14824
- if (!compositeInstance) {
14825
- throw new Error(`Composite instance not found: ${instanceId}`);
14826
- }
14827
- this.abortController.signal.throwIfAborted();
14828
- for (const child of compositeInstance.children) {
14829
- this.instanceMap.set(child.id, child);
14830
- }
14831
- this.compositeInstanceMap.set(instanceId, compositeInstance);
14832
- return compositeInstance;
14833
- });
14834
- }
14835
- async evaluateCompositeInstances() {
14836
- await this.projectLock.lockInstances(this.operation.instanceIds, async () => {
14837
- const compositeInstances = await this.libraryBackend.evaluateCompositeInstances(
14838
- Array.from(this.instanceMap.values()),
14839
- this.operation.instanceIds
14840
- );
14841
- this.abortController.signal.throwIfAborted();
14842
- for (const instance of compositeInstances) {
14843
- this.compositeInstanceEE.emit(
14844
- `${this.operation.projectId}/${instance.instance.id}`,
14845
- instance
14846
- );
14847
- }
14848
- await this.stateBackend.putCompositeInstances(
14849
- this.operation.projectId,
14850
- await Promise.all(
14851
- compositeInstances.map(async (instance) => ({
14852
- ...instance,
14853
- inputHash: await this.resolveInputHash(instance.instance.id)
14854
- }))
14855
- )
14856
- );
14857
- });
14858
- }
14859
- async updateOperation() {
14860
- this.operationEE.emit(this.operation.projectId, this.operation);
14861
- await this.stateBackend.putOperation(this.operation);
14862
- }
14863
- updateInstanceState(patch) {
14864
- if (!patch.id) {
14865
- throw new Error("The ID of the instance state is required.");
14866
- }
14867
- if (patch.logLine) {
14868
- this.persistLogs.call([patch.id, patch.logLine]);
14869
- this.instanceLogsEE.emit(`${this.operation.id}/${patch.id}`, patch.logLine);
14870
- return;
14871
- }
14872
- const state = applyPartialInstanceState(this.stateMap, patch);
14873
- this.persistStates.call(state);
14874
- if (patch.secrets) {
14875
- this.persistSecrets.call([patch.id, patch.secrets]);
14876
- }
14877
- this.stateEE.emit(this.operation.projectId, createInstanceStateFrontendPatch(patch));
14878
- }
14879
- tryAddStateToParent(state) {
14880
- var _a;
14881
- if (!state.parentId) {
14882
- return;
14883
- }
14884
- const children = (_a = this.childrenStateMap.get(state.parentId)) != null ? _a : [];
14885
- children.push(state);
14886
- this.childrenStateMap.set(state.parentId, children);
14887
- }
14888
- addDependentState(state) {
14889
- var _a, _b;
14890
- const instance = this.instanceMap.get(state.id);
14891
- if (!instance) {
14892
- return;
14893
- }
14894
- const instanceInputs = (_a = this.resolvedInstanceInputs.get(state.id)) != null ? _a : {};
14895
- for (const inputs of Object.values(instanceInputs)) {
14896
- for (const input of inputs) {
14897
- const dependents = (_b = this.dependentStateMap.get(input.input.instanceId)) != null ? _b : [];
14898
- dependents.push(state);
14899
- this.dependentStateMap.set(input.input.instanceId, dependents);
14900
- }
14901
- }
14902
- }
14903
- async extendWithNotCreatedDependencies() {
14904
- const instanceIdsSet = /* @__PURE__ */ new Set();
14905
- const traverse = async (instanceId) => {
14906
- var _a;
14907
- if (instanceIdsSet.has(instanceId)) {
14908
- return;
14909
- }
14910
- const instance = this.instanceMap.get(instanceId);
14911
- if (!instance) {
14912
- return;
14913
- }
14914
- const instanceInputs = (_a = this.resolvedInstanceInputs.get(instance.id)) != null ? _a : {};
14915
- for (const inputs of Object.values(instanceInputs)) {
14916
- for (const input of inputs) {
14917
- await traverse(input.input.instanceId);
14918
- }
14919
- }
14920
- const state = this.stateMap.get(instance.id);
14921
- const expectedInputHash = await this.resolveInputHash(instance.id);
14922
- if ((state == null ? void 0 : state.status) !== "created" || state.inputHash !== expectedInputHash) {
14923
- instanceIdsSet.add(instanceId);
14924
- }
14925
- };
14926
- for (const instanceId of this.operation.instanceIds) {
14927
- await traverse(instanceId);
14928
- instanceIdsSet.add(instanceId);
14929
- }
14930
- this.operation.instanceIds = Array.from(instanceIdsSet);
14931
- }
14932
- extendWithCreatedDependents() {
14933
- const instanceIdsSet = /* @__PURE__ */ new Set();
14934
- const traverse = (instanceKey) => {
14935
- var _a;
14936
- if (instanceIdsSet.has(instanceKey)) {
14937
- return;
14938
- }
14939
- const state = this.stateMap.get(instanceKey);
14940
- if (!state || state.status === "not_created") {
14941
- return;
14942
- }
14943
- const dependents = (_a = this.dependentStateMap.get(instanceKey)) != null ? _a : [];
14944
- for (const dependent of dependents) {
14945
- traverse(dependent.id);
14946
- instanceIdsSet.add(instanceKey);
14947
- }
14948
- };
14949
- for (const instanceId of this.operation.instanceIds) {
14950
- const instance = this.instanceMap.get(instanceId);
14951
- if (!instance) {
14952
- throw new Error(`Instance not found: ${instanceId}`);
14953
- }
14954
- traverse(instance.id);
14955
- instanceIdsSet.add(instanceId);
14956
- }
14957
- this.operation.instanceIds = Array.from(instanceIdsSet);
14958
- }
14959
- getInstancePromise(instanceId, fn) {
14960
- let instancePromise = this.instancePromiseMap.get(instanceId);
14961
- if (instancePromise) {
14962
- return instancePromise;
14963
- }
14964
- instancePromise = this.projectLock.lockInstance(instanceId, fn);
14965
- instancePromise = instancePromise.finally(() => this.instancePromiseMap.delete(instanceId));
14966
- this.instancePromiseMap.set(instanceId, instancePromise);
14967
- return instancePromise;
14968
- }
14969
- getStatusByOperationType() {
14970
- switch (this.operation.type) {
14971
- case "update":
14972
- return "updating";
14973
- case "recreate":
14974
- return "updating";
14975
- case "destroy":
14976
- return "destroying";
14977
- case "refresh":
14978
- return "refreshing";
14979
- default:
14980
- throw new Error(`Unexpected operation type: ${this.operation.type}`);
14981
- }
14982
- }
14983
- getInstanceDependencies(instance) {
14984
- var _a;
14985
- const dependencies = [];
14986
- const instanceInputs = (_a = this.resolvedInstanceInputs.get(instance.id)) != null ? _a : {};
14987
- for (const inputs of Object.values(instanceInputs)) {
14988
- for (const input of inputs) {
14989
- const dependency = this.instanceMap.get(input.input.instanceId);
14990
- if (dependency) {
14991
- dependencies.push(dependency);
14992
- }
14993
- }
14994
- }
14995
- return dependencies;
14996
- }
14997
- resolveUnitSource(component) {
14998
- var _a, _b;
14999
- if (!component.source || component.source.type === "local") {
15000
- return {
15001
- type: "local",
15002
- // auto-generate path for local units
15003
- path: (_b = (_a = component.source) == null ? void 0 : _a.path) != null ? _b : component.type.split(".").join("/")
15004
- };
15005
- }
15006
- return component.source;
15007
- }
15008
- static isAbortError(err) {
15009
- if (isAbortError(err)) {
15010
- return true;
15011
- }
15012
- if (err instanceof Error) {
15013
- return _RuntimeOperation.abortMessagePatterns.some((pattern) => err.message.includes(pattern));
15014
- }
15015
- return false;
15016
- }
15017
- };
15018
- __publicField$1(_RuntimeOperation, "abortMessagePatterns", [
15019
- "Operation aborted",
15020
- "Command was killed with SIGINT"
15021
- ]);
15022
- let RuntimeOperation = _RuntimeOperation;
15023
-
15024
- var __defProp = Object.defineProperty;
15025
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15026
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
15027
- class OperationManager {
15028
- constructor(runnerBackend, stateBackend, libraryBackend, projectBackend, secretBackend, projectLockManager, logger) {
15029
- this.runnerBackend = runnerBackend;
15030
- this.stateBackend = stateBackend;
15031
- this.libraryBackend = libraryBackend;
15032
- this.projectBackend = projectBackend;
15033
- this.secretBackend = secretBackend;
15034
- this.projectLockManager = projectLockManager;
15035
- this.logger = logger;
15036
- __publicField(this, "operationEE", new EventEmitter$2());
15037
- __publicField(this, "stateEE", new EventEmitter$2());
15038
- __publicField(this, "compositeInstanceEE", new EventEmitter$2());
15039
- __publicField(this, "instanceLogsEE", new EventEmitter$2());
15040
- __publicField(this, "runtimeOperations", /* @__PURE__ */ new Map());
15041
- }
15042
- /**
15043
- * Watches for all instance state changes in the project.
15044
- *
15045
- * @param projectId The project ID to watch.
15046
- * @param signal The signal to abort the operation.
15047
- */
15048
- async *watchInstanceStates(projectId, signal) {
15049
- for await (const [state] of on(this.stateEE, projectId, { signal })) {
15050
- yield state;
15051
- }
15052
- }
15053
- /**
15054
- * Watches for all project operations in the project.
15055
- *
15056
- * @param projectId The project ID to watch.
15057
- * @param signal The signal to abort the operation.
15058
- */
15059
- async *watchOperations(projectId, signal) {
15060
- for await (const [operation] of on(this.operationEE, projectId, { signal })) {
15061
- yield operation;
15062
- }
15063
- }
15064
- /**
15065
- * Watches for changes in the composite instance.
15066
- *
15067
- * @param projectId The project ID to watch.
15068
- * @param instanceId The instance ID to watch.
15069
- * @param signal The signal to abort the operation.
15070
- */
15071
- async *watchCompositeInstance(projectId, instanceId, signal) {
15072
- const eventKey = `${projectId}/${instanceId}`;
15073
- for await (const [instance] of on(this.compositeInstanceEE, eventKey, { signal })) {
15074
- yield instance;
15075
- }
15076
- }
15077
- /**
15078
- * Watches for logs of the instance in the operation.
15079
- *
15080
- * @param operationId The operation ID to watch.
15081
- * @param instanceId The instance ID to watch.
15082
- * @param signal The signal to abort the operation.
15083
- */
15084
- async *watchInstanceLogs(operationId, instanceId, signal) {
15085
- const eventKey = `${operationId}/${instanceId}`;
15086
- for await (const [log] of on(this.instanceLogsEE, eventKey, { signal })) {
15087
- yield log;
15088
- }
15089
- }
15090
- /**
15091
- * Launches the project operation.
15092
- *
15093
- * @param request The operation request to launch.
15094
- */
15095
- async launch(request) {
15096
- const operation = {
15097
- id: uuidv7(),
15098
- projectId: request.projectId,
15099
- type: request.type,
15100
- instanceIds: request.instanceIds,
15101
- status: "pending",
15102
- error: null,
15103
- startedAt: Date.now(),
15104
- completedAt: null
15105
- };
15106
- await this.stateBackend.putOperation(operation);
15107
- this.startOperation(operation);
15108
- }
15109
- /**
15110
- * Cancels the current operation.
15111
- * Does nothing if no operation is running.
15112
- */
15113
- cancel(operationId) {
15114
- const runtimeOperation = this.runtimeOperations.get(operationId);
15115
- if (runtimeOperation) {
15116
- runtimeOperation.cancel();
15117
- }
15118
- }
15119
- startOperation(operation) {
15120
- const runtimeOperation = new RuntimeOperation(
15121
- operation,
15122
- this.runnerBackend,
15123
- this.stateBackend,
15124
- this.libraryBackend,
15125
- this.projectBackend,
15126
- this.secretBackend,
15127
- this.projectLockManager.getLock(operation.projectId),
15128
- this.operationEE,
15129
- this.stateEE,
15130
- this.compositeInstanceEE,
15131
- this.instanceLogsEE,
15132
- this.logger.child({ service: "RuntimeOperation", operationId: operation.id })
15133
- );
15134
- this.runtimeOperations.set(operation.id, runtimeOperation);
15135
- void runtimeOperation.operateSafe().finally(() => this.runtimeOperations.delete(operation.id));
15136
- }
15137
- static async create(runnerBackend, stateBackend, libraryBackend, projectBackend, secretBackend, projectLockManager, logger) {
15138
- const operator = new OperationManager(
15139
- runnerBackend,
15140
- stateBackend,
15141
- libraryBackend,
15142
- projectBackend,
15143
- secretBackend,
15144
- projectLockManager,
15145
- logger.child({ service: "OperationManager" })
15146
- );
15147
- const activeOperations = await stateBackend.getActiveOperations();
15148
- for (const operation of activeOperations) {
15149
- logger.info({ msg: "relaunching operation", operationId: operation.id });
15150
- operation.status = "cancelled";
15151
- await stateBackend.putOperation(operation);
15152
- }
15153
- return operator;
15154
- }
15155
- }
15156
-
15157
- async function createServices({
15158
- config,
15159
- services: {
15160
- logger,
15161
- libraryBackend,
15162
- secretBackend,
15163
- runnerBackend,
15164
- projectBackend,
15165
- projectManager,
15166
- stateBackend,
15167
- operationManager,
15168
- terminalBackend,
15169
- terminalManager,
15170
- workspaceBackend
15171
- } = {}
15172
- } = {}) {
15173
- config != null ? config : config = await loadConfig();
15174
- logger != null ? logger : logger = pino({
15175
- name: config.HIGHSTATE_BACKEND_LOGGER_NAME,
15176
- level: config.HIGHSTATE_BACKEND_LOGGER_LEVEL,
15177
- errorKey: "error"
15178
- });
15179
- const localPulumiHost = LocalPulumiHost.create(logger);
15180
- const projectLockManager = new ProjectLockManager();
15181
- libraryBackend != null ? libraryBackend : libraryBackend = createLibraryBackend(config, logger);
15182
- secretBackend != null ? secretBackend : secretBackend = await createSecretBackend(config, localPulumiHost, logger);
15183
- stateBackend != null ? stateBackend : stateBackend = await createStateBackend(config, localPulumiHost, logger);
15184
- runnerBackend != null ? runnerBackend : runnerBackend = await createRunnerBackend(config, localPulumiHost);
15185
- projectBackend != null ? projectBackend : projectBackend = await createProjectBackend(config);
15186
- terminalBackend != null ? terminalBackend : terminalBackend = createTerminalBackend(config, logger);
15187
- terminalManager != null ? terminalManager : terminalManager = TerminalManager.create(terminalBackend, stateBackend, runnerBackend, logger);
15188
- operationManager != null ? operationManager : operationManager = await OperationManager.create(
15189
- runnerBackend,
15190
- stateBackend,
15191
- libraryBackend,
15192
- projectBackend,
15193
- secretBackend,
15194
- projectLockManager,
15195
- logger
15196
- );
15197
- projectManager != null ? projectManager : projectManager = ProjectManager.create(
15198
- projectBackend,
15199
- stateBackend,
15200
- operationManager,
15201
- libraryBackend,
15202
- logger
15203
- );
15204
- workspaceBackend != null ? workspaceBackend : workspaceBackend = await createWorkspaceBackend(config);
15205
- logger.info("services created");
15206
- return {
15207
- logger,
15208
- libraryBackend,
15209
- secretBackend,
15210
- runnerBackend,
15211
- projectBackend,
15212
- projectManager,
15213
- stateBackend,
15214
- operationManager,
15215
- terminalBackend,
15216
- terminalManager,
15217
- workspaceBackend
15218
- };
15219
- }
15220
- let sharedServicesPromise;
15221
- function getSharedServices(options = {}) {
15222
- if (!sharedServicesPromise) {
15223
- sharedServicesPromise = createServices(options);
15224
- }
15225
- return sharedServicesPromise;
15226
- }
15227
-
15228
- const secretRouter = router({
15229
- isLocked: publicProcedure.input(
15230
- z.object({
15231
- projectId: z.string()
15232
- })
15233
- ).query(async ({ input, ctx }) => {
15234
- var _a, _b;
15235
- const isLocked = await ((_b = (_a = ctx.secretBackend).isLocked) == null ? void 0 : _b.call(_a, input.projectId));
15236
- return isLocked != null ? isLocked : false;
15237
- }),
15238
- unlock: publicProcedure.input(
15239
- z.object({
15240
- projectId: z.string(),
15241
- passphrase: z.string()
15242
- })
15243
- ).mutation(async ({ input, ctx }) => {
15244
- if (!ctx.secretBackend.unlock) {
15245
- throw new Error("The secret backend does not support unlocking.");
15246
- }
15247
- return await ctx.secretBackend.unlock(input.projectId, input.passphrase);
15248
- }),
15249
- get: publicProcedure.input(
15250
- z.object({
15251
- projectId: z.string(),
15252
- instanceKey: z.string()
15253
- })
15254
- ).query(async ({ input, ctx }) => {
15255
- try {
15256
- return await ctx.secretBackend.get(input.projectId, input.instanceKey);
15257
- } catch (e) {
15258
- if (e instanceof SecretAccessDeniedError) {
15259
- throw new TRPCError({
15260
- code: "FORBIDDEN",
15261
- message: "Access to the secret is denied",
15262
- cause: e
15263
- });
15264
- }
15265
- throw e;
15266
- }
11775
+ const projectRouter = router({
11776
+ getProjects: publicProcedure.query(async ({ ctx }) => {
11777
+ return await ctx.projectBackend.getProjectNames();
15267
11778
  }),
15268
- set: publicProcedure.input(
11779
+ createProject: publicProcedure.input(
15269
11780
  z.object({
15270
11781
  projectId: z.string(),
15271
- instanceId: z.string(),
15272
- values: z.record(z.unknown())
11782
+ password: z.string()
15273
11783
  })
15274
- ).mutation(async ({ input, ctx }) => {
15275
- try {
15276
- await ctx.secretBackend.set(input.projectId, input.instanceId, input.values);
15277
- } catch (e) {
15278
- if (e instanceof SecretAccessDeniedError) {
15279
- throw new TRPCError({
15280
- code: "FORBIDDEN",
15281
- message: "Access to the secret is denied",
15282
- cause: e
15283
- });
15284
- }
15285
- throw e;
15286
- }
15287
- })
15288
- });
15289
-
15290
- const projectRouter = router({
15291
- getProjects: publicProcedure.query(async ({ ctx }) => {
15292
- return await ctx.projectBackend.getProjectNames();
11784
+ ).output(z.void()).mutation(async ({ input, ctx }) => {
11785
+ var _a, _b;
11786
+ await ctx.projectBackend.createProject(input.projectId);
11787
+ await ((_b = (_a = ctx.secretBackend).unlock) == null ? void 0 : _b.call(_a, input.projectId, input.password));
15293
11788
  }),
15294
11789
  watchCompositeInstance: publicProcedure.input(
15295
11790
  z.object({
@@ -15922,13 +12417,13 @@ const client_manifest = {
15922
12417
  "module": true,
15923
12418
  "prefetch": true,
15924
12419
  "preload": true,
15925
- "file": "B_hR0Ok_.js",
12420
+ "file": "CDvc066L.js",
15926
12421
  "name": "error-404",
15927
12422
  "src": "../node_modules/nuxt/dist/app/components/error-404.vue",
15928
12423
  "isDynamicEntry": true,
15929
12424
  "imports": [
15930
12425
  "../node_modules/nuxt/dist/app/entry.js",
15931
- "_DE7L338O.js"
12426
+ "_DOPM99N_.js"
15932
12427
  ],
15933
12428
  "css": [
15934
12429
  "error-404.BJkSn6RI.css"
@@ -15945,13 +12440,13 @@ const client_manifest = {
15945
12440
  "module": true,
15946
12441
  "prefetch": true,
15947
12442
  "preload": true,
15948
- "file": "Cj8SV8PB.js",
12443
+ "file": "Dx2bEYXH.js",
15949
12444
  "name": "error-500",
15950
12445
  "src": "../node_modules/nuxt/dist/app/components/error-500.vue",
15951
12446
  "isDynamicEntry": true,
15952
12447
  "imports": [
15953
12448
  "../node_modules/nuxt/dist/app/entry.js",
15954
- "_DE7L338O.js"
12449
+ "_DOPM99N_.js"
15955
12450
  ],
15956
12451
  "css": [
15957
12452
  "error-500.TOCKLquH.css"
@@ -15968,7 +12463,7 @@ const client_manifest = {
15968
12463
  "module": true,
15969
12464
  "prefetch": true,
15970
12465
  "preload": true,
15971
- "file": "BA0u-n1q.js",
12466
+ "file": "D0Jq3pX9.js",
15972
12467
  "name": "entry",
15973
12468
  "src": "../node_modules/nuxt/dist/app/entry.js",
15974
12469
  "isEntry": true,
@@ -15977,7 +12472,7 @@ const client_manifest = {
15977
12472
  "../node_modules/nuxt/dist/app/components/error-500.vue"
15978
12473
  ],
15979
12474
  "css": [
15980
- "entry.7p8V-3Ph.css"
12475
+ "entry.VNeMltv3.css"
15981
12476
  ],
15982
12477
  "assets": [
15983
12478
  "materialdesignicons-webfont.TEmAk13K.eot",
@@ -15986,8 +12481,8 @@ const client_manifest = {
15986
12481
  "materialdesignicons-webfont.BpRar1d5.ttf"
15987
12482
  ]
15988
12483
  },
15989
- "entry.7p8V-3Ph.css": {
15990
- "file": "entry.7p8V-3Ph.css",
12484
+ "entry.VNeMltv3.css": {
12485
+ "file": "entry.VNeMltv3.css",
15991
12486
  "resourceType": "style",
15992
12487
  "prefetch": true,
15993
12488
  "preload": true
@@ -16012,12 +12507,12 @@ const client_manifest = {
16012
12507
  "resourceType": "font",
16013
12508
  "mimeType": "font/ttf"
16014
12509
  },
16015
- "_DE7L338O.js": {
12510
+ "_DOPM99N_.js": {
16016
12511
  "resourceType": "script",
16017
12512
  "module": true,
16018
12513
  "prefetch": true,
16019
12514
  "preload": true,
16020
- "file": "DE7L338O.js",
12515
+ "file": "DOPM99N_.js",
16021
12516
  "name": "vue.-sixQ7xP",
16022
12517
  "imports": [
16023
12518
  "../node_modules/nuxt/dist/app/entry.js"