@bleedingdev/modern-js-create 3.5.0-ultramodern.30 → 3.5.0-ultramodern.32

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 (421) hide show
  1. package/dist/cjs/cli/flags.cjs +326 -0
  2. package/dist/cjs/cli/help.cjs +106 -0
  3. package/dist/cjs/cli/package-source.cjs +186 -0
  4. package/dist/cjs/cli/project-setup.cjs +138 -0
  5. package/dist/cjs/cli/prompts.cjs +118 -0
  6. package/dist/cjs/index.cjs +24 -581
  7. package/dist/cjs/ultramodern-tooling/commands/cloudflare-output-verify.cjs +132 -0
  8. package/dist/cjs/ultramodern-tooling/commands/context.cjs +131 -0
  9. package/dist/cjs/ultramodern-tooling/commands/mf-types.cjs +55 -0
  10. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.cjs +158 -0
  11. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.cjs +49 -0
  12. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.cjs +87 -0
  13. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.cjs +58 -0
  14. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.cjs +62 -0
  15. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.cjs +60 -0
  16. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.cjs +132 -0
  17. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.cjs +67 -0
  18. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.cjs +93 -0
  19. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.cjs +60 -0
  20. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.cjs +67 -0
  21. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.cjs +67 -0
  22. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/help.cjs +54 -0
  23. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/install.cjs +52 -0
  24. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/io.cjs +133 -0
  25. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.cjs +219 -0
  26. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/package-source.cjs +76 -0
  27. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.cjs +131 -0
  28. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.cjs +161 -0
  29. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.cjs +88 -0
  30. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect.cjs +149 -0
  31. package/dist/cjs/ultramodern-tooling/commands/options.cjs +59 -0
  32. package/dist/cjs/ultramodern-tooling/commands/routes-generate.cjs +122 -0
  33. package/dist/cjs/ultramodern-tooling/commands/skills.cjs +49 -0
  34. package/dist/cjs/ultramodern-tooling/commands/sync-delivery-unit.cjs +40 -0
  35. package/dist/cjs/ultramodern-tooling/commands/validate.cjs +49 -0
  36. package/dist/cjs/ultramodern-tooling/commands.cjs +17 -1165
  37. package/dist/cjs/ultramodern-tooling/config/constants.cjs +48 -0
  38. package/dist/cjs/ultramodern-tooling/config/index.cjs +104 -0
  39. package/dist/cjs/ultramodern-tooling/config/json.cjs +61 -0
  40. package/dist/cjs/ultramodern-tooling/config/load.cjs +62 -0
  41. package/dist/cjs/ultramodern-tooling/config/metadata.cjs +92 -0
  42. package/dist/cjs/ultramodern-tooling/config/normalize.cjs +160 -0
  43. package/dist/cjs/ultramodern-tooling/config/synthesize.cjs +157 -0
  44. package/dist/cjs/ultramodern-tooling/config/types.cjs +18 -0
  45. package/dist/cjs/ultramodern-tooling/config.cjs +23 -274
  46. package/dist/cjs/ultramodern-workspace/add-vertical/constants.cjs +52 -0
  47. package/dist/cjs/ultramodern-workspace/add-vertical/execute.cjs +156 -0
  48. package/dist/cjs/ultramodern-workspace/add-vertical/plan.cjs +246 -0
  49. package/dist/cjs/ultramodern-workspace/add-vertical/preflight.cjs +198 -0
  50. package/dist/cjs/ultramodern-workspace/add-vertical/shell-files.cjs +116 -0
  51. package/dist/cjs/ultramodern-workspace/add-vertical/topology.cjs +133 -0
  52. package/dist/cjs/ultramodern-workspace/add-vertical/workspace-state.cjs +107 -0
  53. package/dist/cjs/ultramodern-workspace/add-vertical.cjs +22 -596
  54. package/dist/cjs/ultramodern-workspace/api/checkout-cart.cjs +145 -0
  55. package/dist/cjs/ultramodern-workspace/api/client.cjs +218 -0
  56. package/dist/cjs/ultramodern-workspace/api/contracts.cjs +222 -0
  57. package/dist/cjs/ultramodern-workspace/api/names.cjs +98 -0
  58. package/dist/cjs/ultramodern-workspace/api/service.cjs +220 -0
  59. package/dist/cjs/ultramodern-workspace/api/shared.cjs +252 -0
  60. package/dist/cjs/ultramodern-workspace/api.cjs +27 -1046
  61. package/dist/cjs/ultramodern-workspace/app-files.cjs +3 -18
  62. package/dist/cjs/ultramodern-workspace/backend-federation.cjs +38 -24
  63. package/dist/cjs/ultramodern-workspace/bridge-config/cli.cjs +71 -0
  64. package/dist/cjs/ultramodern-workspace/bridge-config/defaults.cjs +43 -0
  65. package/dist/cjs/ultramodern-workspace/bridge-config/gates.cjs +93 -0
  66. package/dist/cjs/ultramodern-workspace/bridge-config/index.cjs +60 -0
  67. package/dist/cjs/ultramodern-workspace/bridge-config/normalize.cjs +68 -0
  68. package/dist/cjs/ultramodern-workspace/bridge-config/schema.cjs +78 -0
  69. package/dist/cjs/ultramodern-workspace/bridge-config/shared.cjs +110 -0
  70. package/dist/cjs/ultramodern-workspace/bridge-config/validation.cjs +68 -0
  71. package/dist/cjs/ultramodern-workspace/bridge-config/workspace-packages.cjs +108 -0
  72. package/dist/cjs/ultramodern-workspace/bridge-config.cjs +32 -297
  73. package/dist/cjs/ultramodern-workspace/delivery-unit-sync.cjs +22 -20
  74. package/dist/cjs/ultramodern-workspace/delivery-unit.cjs +7 -20
  75. package/dist/cjs/ultramodern-workspace/demo-components.cjs +47 -189
  76. package/dist/cjs/ultramodern-workspace/descriptors.cjs +12 -1
  77. package/dist/cjs/ultramodern-workspace/effect-diagnostics.cjs +114 -0
  78. package/dist/cjs/ultramodern-workspace/fs-io.cjs +24 -2
  79. package/dist/cjs/ultramodern-workspace/index.cjs +4 -0
  80. package/dist/cjs/ultramodern-workspace/mf-validation/constants.cjs +69 -0
  81. package/dist/cjs/ultramodern-workspace/mf-validation/discovery.cjs +77 -0
  82. package/dist/cjs/ultramodern-workspace/mf-validation/inspect.cjs +92 -0
  83. package/dist/cjs/ultramodern-workspace/mf-validation/object-literal.cjs +203 -0
  84. package/dist/cjs/ultramodern-workspace/mf-validation/path-utils.cjs +171 -0
  85. package/dist/cjs/ultramodern-workspace/mf-validation/syntax.cjs +228 -0
  86. package/dist/cjs/ultramodern-workspace/mf-validation/types.cjs +18 -0
  87. package/dist/cjs/ultramodern-workspace/mf-validation/validate.cjs +112 -0
  88. package/dist/cjs/ultramodern-workspace/mf-validation.cjs +6 -529
  89. package/dist/cjs/ultramodern-workspace/module-federation/config.cjs +251 -0
  90. package/dist/cjs/ultramodern-workspace/module-federation/index.cjs +73 -0
  91. package/dist/cjs/ultramodern-workspace/module-federation/reexport-module.cjs +73 -0
  92. package/dist/cjs/ultramodern-workspace/module-federation/remote-refs.cjs +105 -0
  93. package/dist/cjs/ultramodern-workspace/module-federation/shared-config.cjs +53 -0
  94. package/dist/cjs/ultramodern-workspace/module-federation.cjs +14 -584
  95. package/dist/cjs/ultramodern-workspace/package-json.cjs +13 -229
  96. package/dist/cjs/ultramodern-workspace/routes.cjs +8 -142
  97. package/dist/cjs/ultramodern-workspace/shared-patches.cjs +44 -0
  98. package/dist/cjs/ultramodern-workspace/tsconfigs.cjs +199 -0
  99. package/dist/cjs/ultramodern-workspace/workspace-script-plan.cjs +2 -2
  100. package/dist/cjs/ultramodern-workspace/write-app.cjs +128 -0
  101. package/dist/cjs/ultramodern-workspace/write-workspace.cjs +4 -61
  102. package/dist/cjs/ultramodern-workspace/zerops.cjs +13 -10
  103. package/dist/esm/cli/flags.js +228 -0
  104. package/dist/esm/cli/help.js +65 -0
  105. package/dist/esm/cli/package-source.js +119 -0
  106. package/dist/esm/cli/project-setup.js +81 -0
  107. package/dist/esm/cli/prompts.js +63 -0
  108. package/dist/esm/index.js +6 -559
  109. package/dist/esm/ultramodern-tooling/commands/cloudflare-output-verify.js +84 -0
  110. package/dist/esm/ultramodern-tooling/commands/context.js +66 -0
  111. package/dist/esm/ultramodern-tooling/commands/mf-types.js +17 -0
  112. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.js +106 -0
  113. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.js +11 -0
  114. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.js +38 -0
  115. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.js +10 -0
  116. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.js +14 -0
  117. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.js +12 -0
  118. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.js +83 -0
  119. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.js +16 -0
  120. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.js +44 -0
  121. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.js +12 -0
  122. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.js +7 -0
  123. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.js +15 -0
  124. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/help.js +16 -0
  125. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/install.js +14 -0
  126. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/io.js +69 -0
  127. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.js +175 -0
  128. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/package-source.js +38 -0
  129. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.js +76 -0
  130. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.js +105 -0
  131. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.js +16 -0
  132. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect.js +100 -0
  133. package/dist/esm/ultramodern-tooling/commands/options.js +18 -0
  134. package/dist/esm/ultramodern-tooling/commands/routes-generate.js +74 -0
  135. package/dist/esm/ultramodern-tooling/commands/skills.js +11 -0
  136. package/dist/esm/ultramodern-tooling/commands/sync-delivery-unit.js +1 -0
  137. package/dist/esm/ultramodern-tooling/commands/validate.js +11 -0
  138. package/dist/esm/ultramodern-tooling/commands.js +9 -1152
  139. package/dist/esm/ultramodern-tooling/config/constants.js +4 -0
  140. package/dist/esm/ultramodern-tooling/config/index.js +7 -0
  141. package/dist/esm/ultramodern-tooling/config/json.js +10 -0
  142. package/dist/esm/ultramodern-tooling/config/load.js +13 -0
  143. package/dist/esm/ultramodern-tooling/config/metadata.js +37 -0
  144. package/dist/esm/ultramodern-tooling/config/normalize.js +106 -0
  145. package/dist/esm/ultramodern-tooling/config/synthesize.js +108 -0
  146. package/dist/esm/ultramodern-tooling/config/types.js +0 -0
  147. package/dist/esm/ultramodern-tooling/config.js +1 -255
  148. package/dist/esm/ultramodern-workspace/add-vertical/constants.js +5 -0
  149. package/dist/esm/ultramodern-workspace/add-vertical/execute.js +108 -0
  150. package/dist/esm/ultramodern-workspace/add-vertical/plan.js +184 -0
  151. package/dist/esm/ultramodern-workspace/add-vertical/preflight.js +122 -0
  152. package/dist/esm/ultramodern-workspace/add-vertical/shell-files.js +59 -0
  153. package/dist/esm/ultramodern-workspace/add-vertical/topology.js +89 -0
  154. package/dist/esm/ultramodern-workspace/add-vertical/workspace-state.js +43 -0
  155. package/dist/esm/ultramodern-workspace/add-vertical.js +6 -569
  156. package/dist/esm/ultramodern-workspace/api/checkout-cart.js +86 -0
  157. package/dist/esm/ultramodern-workspace/api/client.js +177 -0
  158. package/dist/esm/ultramodern-workspace/api/contracts.js +172 -0
  159. package/dist/esm/ultramodern-workspace/api/names.js +33 -0
  160. package/dist/esm/ultramodern-workspace/api/service.js +179 -0
  161. package/dist/esm/ultramodern-workspace/api/shared.js +208 -0
  162. package/dist/esm/ultramodern-workspace/api.js +5 -1025
  163. package/dist/esm/ultramodern-workspace/app-files.js +3 -18
  164. package/dist/esm/ultramodern-workspace/backend-federation.js +27 -13
  165. package/dist/esm/ultramodern-workspace/bridge-config/cli.js +30 -0
  166. package/dist/esm/ultramodern-workspace/bridge-config/defaults.js +5 -0
  167. package/dist/esm/ultramodern-workspace/bridge-config/gates.js +52 -0
  168. package/dist/esm/ultramodern-workspace/bridge-config/index.js +3 -0
  169. package/dist/esm/ultramodern-workspace/bridge-config/normalize.js +30 -0
  170. package/dist/esm/ultramodern-workspace/bridge-config/schema.js +31 -0
  171. package/dist/esm/ultramodern-workspace/bridge-config/shared.js +51 -0
  172. package/dist/esm/ultramodern-workspace/bridge-config/validation.js +27 -0
  173. package/dist/esm/ultramodern-workspace/bridge-config/workspace-packages.js +67 -0
  174. package/dist/esm/ultramodern-workspace/bridge-config.js +1 -270
  175. package/dist/esm/ultramodern-workspace/delivery-unit-sync.js +23 -21
  176. package/dist/esm/ultramodern-workspace/delivery-unit.js +6 -16
  177. package/dist/esm/ultramodern-workspace/demo-components.js +47 -189
  178. package/dist/esm/ultramodern-workspace/descriptors.js +12 -1
  179. package/dist/esm/ultramodern-workspace/effect-diagnostics.js +76 -0
  180. package/dist/esm/ultramodern-workspace/fs-io.js +24 -2
  181. package/dist/esm/ultramodern-workspace/index.js +1 -0
  182. package/dist/esm/ultramodern-workspace/mf-validation/constants.js +19 -0
  183. package/dist/esm/ultramodern-workspace/mf-validation/discovery.js +28 -0
  184. package/dist/esm/ultramodern-workspace/mf-validation/inspect.js +45 -0
  185. package/dist/esm/ultramodern-workspace/mf-validation/object-literal.js +144 -0
  186. package/dist/esm/ultramodern-workspace/mf-validation/path-utils.js +89 -0
  187. package/dist/esm/ultramodern-workspace/mf-validation/syntax.js +154 -0
  188. package/dist/esm/ultramodern-workspace/mf-validation/types.js +0 -0
  189. package/dist/esm/ultramodern-workspace/mf-validation/validate.js +57 -0
  190. package/dist/esm/ultramodern-workspace/mf-validation.js +3 -516
  191. package/dist/esm/ultramodern-workspace/module-federation/config.js +204 -0
  192. package/dist/esm/ultramodern-workspace/module-federation/index.js +4 -0
  193. package/dist/esm/ultramodern-workspace/module-federation/reexport-module.js +29 -0
  194. package/dist/esm/ultramodern-workspace/module-federation/remote-refs.js +64 -0
  195. package/dist/esm/ultramodern-workspace/module-federation/shared-config.js +12 -0
  196. package/dist/esm/ultramodern-workspace/module-federation.js +2 -576
  197. package/dist/esm/ultramodern-workspace/package-json.js +7 -210
  198. package/dist/esm/ultramodern-workspace/routes.js +8 -142
  199. package/dist/esm/ultramodern-workspace/shared-patches.js +6 -0
  200. package/dist/esm/ultramodern-workspace/tsconfigs.js +136 -0
  201. package/dist/esm/ultramodern-workspace/workspace-script-plan.js +2 -2
  202. package/dist/esm/ultramodern-workspace/write-app.js +90 -0
  203. package/dist/esm/ultramodern-workspace/write-workspace.js +4 -61
  204. package/dist/esm/ultramodern-workspace/zerops.js +13 -10
  205. package/dist/esm-node/cli/flags.js +229 -0
  206. package/dist/esm-node/cli/help.js +66 -0
  207. package/dist/esm-node/cli/package-source.js +120 -0
  208. package/dist/esm-node/cli/project-setup.js +82 -0
  209. package/dist/esm-node/cli/prompts.js +64 -0
  210. package/dist/esm-node/index.js +6 -559
  211. package/dist/esm-node/ultramodern-tooling/commands/cloudflare-output-verify.js +85 -0
  212. package/dist/esm-node/ultramodern-tooling/commands/context.js +67 -0
  213. package/dist/esm-node/ultramodern-tooling/commands/mf-types.js +18 -0
  214. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.js +107 -0
  215. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.js +12 -0
  216. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.js +39 -0
  217. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.js +11 -0
  218. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.js +15 -0
  219. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.js +13 -0
  220. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.js +84 -0
  221. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.js +17 -0
  222. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.js +45 -0
  223. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.js +13 -0
  224. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.js +8 -0
  225. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.js +16 -0
  226. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/help.js +17 -0
  227. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/install.js +15 -0
  228. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/io.js +70 -0
  229. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.js +176 -0
  230. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/package-source.js +39 -0
  231. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.js +77 -0
  232. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.js +106 -0
  233. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.js +17 -0
  234. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect.js +101 -0
  235. package/dist/esm-node/ultramodern-tooling/commands/options.js +19 -0
  236. package/dist/esm-node/ultramodern-tooling/commands/routes-generate.js +75 -0
  237. package/dist/esm-node/ultramodern-tooling/commands/skills.js +12 -0
  238. package/dist/esm-node/ultramodern-tooling/commands/sync-delivery-unit.js +2 -0
  239. package/dist/esm-node/ultramodern-tooling/commands/validate.js +12 -0
  240. package/dist/esm-node/ultramodern-tooling/commands.js +9 -1152
  241. package/dist/esm-node/ultramodern-tooling/config/constants.js +5 -0
  242. package/dist/esm-node/ultramodern-tooling/config/index.js +8 -0
  243. package/dist/esm-node/ultramodern-tooling/config/json.js +11 -0
  244. package/dist/esm-node/ultramodern-tooling/config/load.js +14 -0
  245. package/dist/esm-node/ultramodern-tooling/config/metadata.js +38 -0
  246. package/dist/esm-node/ultramodern-tooling/config/normalize.js +107 -0
  247. package/dist/esm-node/ultramodern-tooling/config/synthesize.js +109 -0
  248. package/dist/esm-node/ultramodern-tooling/config/types.js +1 -0
  249. package/dist/esm-node/ultramodern-tooling/config.js +1 -255
  250. package/dist/esm-node/ultramodern-workspace/add-vertical/constants.js +6 -0
  251. package/dist/esm-node/ultramodern-workspace/add-vertical/execute.js +109 -0
  252. package/dist/esm-node/ultramodern-workspace/add-vertical/plan.js +185 -0
  253. package/dist/esm-node/ultramodern-workspace/add-vertical/preflight.js +123 -0
  254. package/dist/esm-node/ultramodern-workspace/add-vertical/shell-files.js +60 -0
  255. package/dist/esm-node/ultramodern-workspace/add-vertical/topology.js +90 -0
  256. package/dist/esm-node/ultramodern-workspace/add-vertical/workspace-state.js +44 -0
  257. package/dist/esm-node/ultramodern-workspace/add-vertical.js +6 -569
  258. package/dist/esm-node/ultramodern-workspace/api/checkout-cart.js +87 -0
  259. package/dist/esm-node/ultramodern-workspace/api/client.js +178 -0
  260. package/dist/esm-node/ultramodern-workspace/api/contracts.js +173 -0
  261. package/dist/esm-node/ultramodern-workspace/api/names.js +34 -0
  262. package/dist/esm-node/ultramodern-workspace/api/service.js +180 -0
  263. package/dist/esm-node/ultramodern-workspace/api/shared.js +209 -0
  264. package/dist/esm-node/ultramodern-workspace/api.js +5 -1025
  265. package/dist/esm-node/ultramodern-workspace/app-files.js +3 -18
  266. package/dist/esm-node/ultramodern-workspace/backend-federation.js +27 -13
  267. package/dist/esm-node/ultramodern-workspace/bridge-config/cli.js +31 -0
  268. package/dist/esm-node/ultramodern-workspace/bridge-config/defaults.js +6 -0
  269. package/dist/esm-node/ultramodern-workspace/bridge-config/gates.js +53 -0
  270. package/dist/esm-node/ultramodern-workspace/bridge-config/index.js +4 -0
  271. package/dist/esm-node/ultramodern-workspace/bridge-config/normalize.js +31 -0
  272. package/dist/esm-node/ultramodern-workspace/bridge-config/schema.js +32 -0
  273. package/dist/esm-node/ultramodern-workspace/bridge-config/shared.js +52 -0
  274. package/dist/esm-node/ultramodern-workspace/bridge-config/validation.js +28 -0
  275. package/dist/esm-node/ultramodern-workspace/bridge-config/workspace-packages.js +68 -0
  276. package/dist/esm-node/ultramodern-workspace/bridge-config.js +1 -270
  277. package/dist/esm-node/ultramodern-workspace/delivery-unit-sync.js +23 -21
  278. package/dist/esm-node/ultramodern-workspace/delivery-unit.js +6 -16
  279. package/dist/esm-node/ultramodern-workspace/demo-components.js +47 -189
  280. package/dist/esm-node/ultramodern-workspace/descriptors.js +12 -1
  281. package/dist/esm-node/ultramodern-workspace/effect-diagnostics.js +77 -0
  282. package/dist/esm-node/ultramodern-workspace/fs-io.js +24 -2
  283. package/dist/esm-node/ultramodern-workspace/index.js +1 -0
  284. package/dist/esm-node/ultramodern-workspace/mf-validation/constants.js +20 -0
  285. package/dist/esm-node/ultramodern-workspace/mf-validation/discovery.js +29 -0
  286. package/dist/esm-node/ultramodern-workspace/mf-validation/inspect.js +46 -0
  287. package/dist/esm-node/ultramodern-workspace/mf-validation/object-literal.js +145 -0
  288. package/dist/esm-node/ultramodern-workspace/mf-validation/path-utils.js +90 -0
  289. package/dist/esm-node/ultramodern-workspace/mf-validation/syntax.js +155 -0
  290. package/dist/esm-node/ultramodern-workspace/mf-validation/types.js +1 -0
  291. package/dist/esm-node/ultramodern-workspace/mf-validation/validate.js +58 -0
  292. package/dist/esm-node/ultramodern-workspace/mf-validation.js +3 -516
  293. package/dist/esm-node/ultramodern-workspace/module-federation/config.js +205 -0
  294. package/dist/esm-node/ultramodern-workspace/module-federation/index.js +5 -0
  295. package/dist/esm-node/ultramodern-workspace/module-federation/reexport-module.js +30 -0
  296. package/dist/esm-node/ultramodern-workspace/module-federation/remote-refs.js +65 -0
  297. package/dist/esm-node/ultramodern-workspace/module-federation/shared-config.js +13 -0
  298. package/dist/esm-node/ultramodern-workspace/module-federation.js +2 -576
  299. package/dist/esm-node/ultramodern-workspace/package-json.js +7 -210
  300. package/dist/esm-node/ultramodern-workspace/routes.js +8 -142
  301. package/dist/esm-node/ultramodern-workspace/shared-patches.js +7 -0
  302. package/dist/esm-node/ultramodern-workspace/tsconfigs.js +137 -0
  303. package/dist/esm-node/ultramodern-workspace/workspace-script-plan.js +2 -2
  304. package/dist/esm-node/ultramodern-workspace/write-app.js +91 -0
  305. package/dist/esm-node/ultramodern-workspace/write-workspace.js +4 -61
  306. package/dist/esm-node/ultramodern-workspace/zerops.js +13 -10
  307. package/dist/types/cli/flags.d.ts +30 -0
  308. package/dist/types/cli/help.d.ts +2 -0
  309. package/dist/types/cli/package-source.d.ts +15 -0
  310. package/dist/types/cli/project-setup.d.ts +8 -0
  311. package/dist/types/cli/prompts.d.ts +6 -0
  312. package/dist/types/ultramodern-tooling/commands/cloudflare-output-verify.d.ts +2 -0
  313. package/dist/types/ultramodern-tooling/commands/context.d.ts +11 -0
  314. package/dist/types/ultramodern-tooling/commands/mf-types.d.ts +2 -0
  315. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.d.ts +4 -0
  316. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.d.ts +4 -0
  317. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.d.ts +1 -0
  318. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.d.ts +3 -0
  319. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.d.ts +3 -0
  320. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.d.ts +3 -0
  321. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.d.ts +2 -0
  322. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.d.ts +4 -0
  323. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.d.ts +3 -0
  324. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.d.ts +3 -0
  325. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.d.ts +7 -0
  326. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.d.ts +3 -0
  327. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/help.d.ts +1 -0
  328. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/install.d.ts +2 -0
  329. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/io.d.ts +14 -0
  330. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.d.ts +9 -0
  331. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/package-source.d.ts +3 -0
  332. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.d.ts +4 -0
  333. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.d.ts +25 -0
  334. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.d.ts +9 -0
  335. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect.d.ts +2 -0
  336. package/dist/types/ultramodern-tooling/commands/options.d.ts +2 -0
  337. package/dist/types/ultramodern-tooling/commands/routes-generate.d.ts +2 -0
  338. package/dist/types/ultramodern-tooling/commands/skills.d.ts +2 -0
  339. package/dist/types/ultramodern-tooling/commands/sync-delivery-unit.d.ts +1 -0
  340. package/dist/types/ultramodern-tooling/commands/validate.d.ts +2 -0
  341. package/dist/types/ultramodern-tooling/config/constants.d.ts +3 -0
  342. package/dist/types/ultramodern-tooling/config/index.d.ts +7 -0
  343. package/dist/types/ultramodern-tooling/config/json.d.ts +2 -0
  344. package/dist/types/ultramodern-tooling/config/load.d.ts +2 -0
  345. package/dist/types/ultramodern-tooling/config/metadata.d.ts +4 -0
  346. package/dist/types/ultramodern-tooling/config/normalize.d.ts +5 -0
  347. package/dist/types/ultramodern-tooling/config/synthesize.d.ts +5 -0
  348. package/dist/types/ultramodern-tooling/config/types.d.ts +41 -0
  349. package/dist/types/ultramodern-tooling/config.d.ts +1 -49
  350. package/dist/types/ultramodern-workspace/add-vertical/constants.d.ts +4 -0
  351. package/dist/types/ultramodern-workspace/add-vertical/execute.d.ts +2 -0
  352. package/dist/types/ultramodern-workspace/add-vertical/plan.d.ts +7 -0
  353. package/dist/types/ultramodern-workspace/add-vertical/preflight.d.ts +28 -0
  354. package/dist/types/ultramodern-workspace/add-vertical/shell-files.d.ts +6 -0
  355. package/dist/types/ultramodern-workspace/add-vertical/topology.d.ts +9 -0
  356. package/dist/types/ultramodern-workspace/add-vertical/workspace-state.d.ts +8 -0
  357. package/dist/types/ultramodern-workspace/add-vertical.d.ts +7 -39
  358. package/dist/types/ultramodern-workspace/api/checkout-cart.d.ts +33 -0
  359. package/dist/types/ultramodern-workspace/api/client.d.ts +6 -0
  360. package/dist/types/ultramodern-workspace/api/contracts.d.ts +15 -0
  361. package/dist/types/ultramodern-workspace/api/names.d.ts +41 -0
  362. package/dist/types/ultramodern-workspace/api/service.d.ts +6 -0
  363. package/dist/types/ultramodern-workspace/api/shared.d.ts +10 -0
  364. package/dist/types/ultramodern-workspace/api.d.ts +5 -74
  365. package/dist/types/ultramodern-workspace/backend-federation.d.ts +2 -2
  366. package/dist/types/ultramodern-workspace/bridge-config/cli.d.ts +3 -0
  367. package/dist/types/ultramodern-workspace/bridge-config/defaults.d.ts +1 -0
  368. package/dist/types/ultramodern-workspace/bridge-config/gates.d.ts +3 -0
  369. package/dist/types/ultramodern-workspace/bridge-config/index.d.ts +4 -0
  370. package/dist/types/ultramodern-workspace/bridge-config/normalize.d.ts +2 -0
  371. package/dist/types/ultramodern-workspace/bridge-config/schema.d.ts +61 -0
  372. package/dist/types/ultramodern-workspace/bridge-config/shared.d.ts +12 -0
  373. package/dist/types/ultramodern-workspace/bridge-config/validation.d.ts +3 -0
  374. package/dist/types/ultramodern-workspace/bridge-config/workspace-packages.d.ts +3 -0
  375. package/dist/types/ultramodern-workspace/bridge-config.d.ts +1 -64
  376. package/dist/types/ultramodern-workspace/delivery-unit.d.ts +2 -21
  377. package/dist/types/ultramodern-workspace/effect-diagnostics.d.ts +1 -0
  378. package/dist/types/ultramodern-workspace/index.d.ts +1 -0
  379. package/dist/types/ultramodern-workspace/mf-validation/constants.d.ts +5 -0
  380. package/dist/types/ultramodern-workspace/mf-validation/discovery.d.ts +2 -0
  381. package/dist/types/ultramodern-workspace/mf-validation/inspect.d.ts +5 -0
  382. package/dist/types/ultramodern-workspace/mf-validation/object-literal.d.ts +9 -0
  383. package/dist/types/ultramodern-workspace/mf-validation/path-utils.d.ts +13 -0
  384. package/dist/types/ultramodern-workspace/mf-validation/syntax.d.ts +14 -0
  385. package/dist/types/ultramodern-workspace/mf-validation/types.d.ts +33 -0
  386. package/dist/types/ultramodern-workspace/mf-validation/validate.d.ts +4 -0
  387. package/dist/types/ultramodern-workspace/mf-validation.d.ts +4 -27
  388. package/dist/types/ultramodern-workspace/module-federation/config.d.ts +5 -0
  389. package/dist/types/ultramodern-workspace/module-federation/index.d.ts +4 -0
  390. package/dist/types/ultramodern-workspace/module-federation/reexport-module.d.ts +4 -0
  391. package/dist/types/ultramodern-workspace/module-federation/remote-refs.d.ts +3 -0
  392. package/dist/types/ultramodern-workspace/module-federation/shared-config.d.ts +2 -0
  393. package/dist/types/ultramodern-workspace/module-federation.d.ts +1 -11
  394. package/dist/types/ultramodern-workspace/package-json.d.ts +1 -13
  395. package/dist/types/ultramodern-workspace/shared-patches.d.ts +2 -0
  396. package/dist/types/ultramodern-workspace/tsconfigs.d.ts +13 -0
  397. package/dist/types/ultramodern-workspace/workspace-validation-contract.d.ts +1 -1
  398. package/dist/types/ultramodern-workspace/write-app.d.ts +3 -0
  399. package/dist/types/ultramodern-workspace/write-workspace.d.ts +2 -1
  400. package/package.json +4 -3
  401. package/templates/workspace/apps/modern.config.shared-module-federation.ts.handlebars +37 -0
  402. package/templates/workspace/apps/modern.config.ts.handlebars +252 -0
  403. package/templates/workspace/apps/shared/src/routes/ultramodern-jsonld.ts.handlebars +119 -0
  404. package/templates/workspace/apps/shared/src/routes/ultramodern-route-metadata.ts.handlebars +21 -0
  405. package/templates/workspace/apps/shell-super-app/src/routes/[lang]/page.tsx.handlebars +49 -0
  406. package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.helpers.tsx.handlebars +79 -0
  407. package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.imports.tsx.handlebars +11 -0
  408. package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.tsx.handlebars +46 -0
  409. package/templates/workspace/packages/shared-design-tokens/tokens.css.handlebars +7 -0
  410. package/templates/workspace/postcss.config.mjs.handlebars +5 -0
  411. package/templates/workspace/tailwind.config.ts.handlebars +3 -0
  412. package/templates/workspace/verticals/server/checkout-cart-handlers.ts.handlebars +49 -0
  413. package/templates/workspace/verticals/server/checkout-cart-state.ts.handlebars +23 -0
  414. package/templates/workspace/verticals/shared/api.checkout-cart-contract-fields.ts.handlebars +1 -0
  415. package/templates/workspace/verticals/shared/api.checkout-cart-endpoints.ts.handlebars +23 -0
  416. package/templates/workspace/verticals/shared/api.checkout-cart-operation-contexts.ts.handlebars +25 -0
  417. package/templates/workspace/verticals/shared/api.checkout-cart-schemas.ts.handlebars +48 -0
  418. package/templates/workspace/verticals/src/api/checkout-cart-client-exports.ts.handlebars +70 -0
  419. package/templates/workspace-scripts/generate-node-backend-federation.mjs +29 -0
  420. package/templates/workspace-scripts/proof-node-backend-federation.mjs +31 -0
  421. package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +74 -40
@@ -1,1026 +1,6 @@
1
1
  import "node:module";
2
- import { BACKEND_FEDERATION_CONTRACT_VERSION, BACKEND_FEDERATION_NODE_ADAPTER_VERSION } from "./backend-federation.js";
3
- import { appHasApi, createBackendFederationName, resolveApiPrefix, resolveApiStem, verticalApiApps } from "./descriptors.js";
4
- import { packageName, toCamelCase, toPascalCase } from "./naming.js";
5
- function verticalApiExport(service) {
6
- return `${toCamelCase(resolveApiStem(service))}Api`;
7
- }
8
- function verticalApiGroupName(service) {
9
- return toCamelCase(resolveApiStem(service));
10
- }
11
- function verticalApiName(service) {
12
- return `${toPascalCase(resolveApiStem(service))}Api`;
13
- }
14
- function verticalApiSchemaExport(service) {
15
- return `${toCamelCase(resolveApiStem(service))}ItemSchema`;
16
- }
17
- function verticalApiMarkerSchemaExport(service) {
18
- return `${toCamelCase(resolveApiStem(service))}MarkerSchema`;
19
- }
20
- function verticalApiReadinessSchemaExport(service) {
21
- return `${toCamelCase(resolveApiStem(service))}ReadinessSchema`;
22
- }
23
- function verticalApiErrorStem(service) {
24
- return resolveApiStem(service);
25
- }
26
- function verticalApiCreatePayloadSchemaExport(service) {
27
- return `${toCamelCase(resolveApiStem(service))}CreatePayloadSchema`;
28
- }
29
- function verticalApiNotFoundErrorExport(service) {
30
- return `${toPascalCase(verticalApiErrorStem(service))}NotFound`;
31
- }
32
- function verticalApiNotFoundSchemaExport(service) {
33
- return `${toCamelCase(verticalApiErrorStem(service))}NotFoundSchema`;
34
- }
35
- function serviceHasCheckoutCartState(service) {
36
- return 'checkout' === resolveApiStem(service);
37
- }
38
- function createCheckoutCartSharedSchemas(service) {
39
- if (!serviceHasCheckoutCartState(service)) return '';
40
- return `
41
- export interface CheckoutCartLine {
42
- readonly sku: string;
43
- readonly name: string;
44
- readonly quantity: number;
45
- readonly unitPriceCents: number;
46
- }
47
-
48
- export interface CheckoutCart {
49
- readonly lines: readonly CheckoutCartLine[];
50
- readonly subtotalCents: number;
51
- readonly totalQuantity: number;
52
- }
53
-
54
- export interface CheckoutAddCartItemPayload {
55
- readonly sku: string;
56
- readonly name?: string;
57
- readonly quantity: number;
58
- readonly unitPriceCents?: number;
59
- }
60
-
61
- export interface CheckoutRemoveCartItemPayload {
62
- readonly sku: string;
63
- }
64
-
65
- export const checkoutCartLineSchema: Schema.Codec<CheckoutCartLine> = Schema.Struct({
66
- sku: Schema.String,
67
- name: Schema.String,
68
- quantity: Schema.Finite,
69
- unitPriceCents: Schema.Finite,
70
- });
71
-
72
- export const checkoutCartSchema: Schema.Codec<CheckoutCart> = Schema.Struct({
73
- lines: Schema.Array(checkoutCartLineSchema),
74
- subtotalCents: Schema.Finite,
75
- totalQuantity: Schema.Finite,
76
- });
77
-
78
- export const checkoutAddCartItemPayloadSchema: Schema.Codec<CheckoutAddCartItemPayload> = Schema.Struct({
79
- sku: Schema.String,
80
- name: Schema.optional(Schema.String),
81
- quantity: Schema.Finite,
82
- unitPriceCents: Schema.optional(Schema.Finite),
83
- });
84
-
85
- export const checkoutRemoveCartItemPayloadSchema: Schema.Codec<CheckoutRemoveCartItemPayload> = Schema.Struct({
86
- sku: Schema.String,
87
- });
88
- `;
89
- }
90
- function createCheckoutCartEndpointDefinitions(service) {
91
- if (!serviceHasCheckoutCartState(service)) return '';
92
- return `
93
- .add(
94
- HttpApiEndpoint.get('getCart', '/checkout/cart', {
95
- success: checkoutCartSchema,
96
- }),
97
- )
98
- .add(
99
- HttpApiEndpoint.post('addCartItem', '/checkout/cart/items', {
100
- payload: checkoutAddCartItemPayloadSchema,
101
- success: checkoutCartSchema,
102
- }),
103
- )
104
- .add(
105
- HttpApiEndpoint.post('removeCartItem', '/checkout/cart/remove', {
106
- payload: checkoutRemoveCartItemPayloadSchema,
107
- success: checkoutCartSchema,
108
- }),
109
- )
110
- .add(
111
- HttpApiEndpoint.post('clearCart', '/checkout/cart/clear', {
112
- success: checkoutCartSchema,
113
- }),
114
- )`;
115
- }
116
- function createCheckoutCartOperationContexts(service) {
117
- const apiName = verticalApiName(service);
118
- const groupName = verticalApiGroupName(service);
119
- if (!serviceHasCheckoutCartState(service)) return '';
120
- return `
121
- addCartItem: {
122
- method: 'POST',
123
- operationId: '${apiName}:${groupName}:addCartItem',
124
- routePath: '/checkout/cart/items',
125
- source: 'generated-client',
126
- },
127
- clearCart: {
128
- method: 'POST',
129
- operationId: '${apiName}:${groupName}:clearCart',
130
- routePath: '/checkout/cart/clear',
131
- source: 'generated-client',
132
- },
133
- getCart: {
134
- method: 'GET',
135
- operationId: '${apiName}:${groupName}:getCart',
136
- routePath: '/checkout/cart',
137
- source: 'generated-client',
138
- },
139
- removeCartItem: {
140
- method: 'POST',
141
- operationId: '${apiName}:${groupName}:removeCartItem',
142
- routePath: '/checkout/cart/remove',
143
- source: 'generated-client',
144
- },`;
145
- }
146
- function createCheckoutCartApiContractFields(service) {
147
- if (!serviceHasCheckoutCartState(service)) return '';
148
- return ` checkoutCartPath: '${resolveApiPrefix(service)}/checkout/cart',
149
- `;
150
- }
151
- function createCheckoutCartServerState(service) {
152
- if (!serviceHasCheckoutCartState(service)) return '';
153
- return `
154
- type CheckoutCartLine = {
155
- sku: string;
156
- name: string;
157
- quantity: number;
158
- unitPriceCents: number;
159
- };
160
-
161
- const checkoutCartLines = new Map<string, CheckoutCartLine>();
162
-
163
- const createCheckoutCartSnapshot = () => {
164
- const lines = [...checkoutCartLines.values()].sort((left, right) =>
165
- left.sku.localeCompare(right.sku),
166
- );
167
- return {
168
- lines,
169
- subtotalCents: lines.reduce(
170
- (total, line) => total + line.quantity * line.unitPriceCents,
171
- 0,
172
- ),
173
- totalQuantity: lines.reduce((total, line) => total + line.quantity, 0),
174
- };
175
- };
176
- `;
177
- }
178
- function createCheckoutCartServerHandlers(service) {
179
- const groupName = verticalApiGroupName(service);
180
- if (!serviceHasCheckoutCartState(service)) return '';
181
- return `
182
- .handle('getCart', () =>
183
- Effect.sync(() => createCheckoutCartSnapshot()).pipe(
184
- Effect.withSpan('ultramodern.api.${groupName}.checkout.getCart', {
185
- attributes: operationAttributes(${groupName}OperationContexts.getCart),
186
- kind: 'server',
187
- }),
188
- ),
189
- )
190
- .handle('addCartItem', ({ payload }) =>
191
- Effect.sync(() => {
192
- const existingLine = checkoutCartLines.get(payload.sku);
193
- checkoutCartLines.set(payload.sku, {
194
- sku: payload.sku,
195
- name: payload.name ?? existingLine?.name ?? payload.sku,
196
- quantity: (existingLine?.quantity ?? 0) + payload.quantity,
197
- unitPriceCents:
198
- payload.unitPriceCents ?? existingLine?.unitPriceCents ?? 0,
199
- });
200
- return createCheckoutCartSnapshot();
201
- }).pipe(
202
- Effect.withSpan('ultramodern.api.${groupName}.checkout.addCartItem', {
203
- attributes: operationAttributes(${groupName}OperationContexts.addCartItem),
204
- kind: 'server',
205
- }),
206
- ),
207
- )
208
- .handle('removeCartItem', ({ payload }) =>
209
- Effect.sync(() => {
210
- checkoutCartLines.delete(payload.sku);
211
- return createCheckoutCartSnapshot();
212
- }).pipe(
213
- Effect.withSpan('ultramodern.api.${groupName}.checkout.removeCartItem', {
214
- attributes: operationAttributes(${groupName}OperationContexts.removeCartItem),
215
- kind: 'server',
216
- }),
217
- ),
218
- )
219
- .handle('clearCart', () =>
220
- Effect.sync(() => {
221
- checkoutCartLines.clear();
222
- return createCheckoutCartSnapshot();
223
- }).pipe(
224
- Effect.withSpan('ultramodern.api.${groupName}.checkout.clearCart', {
225
- attributes: operationAttributes(${groupName}OperationContexts.clearCart),
226
- kind: 'server',
227
- }),
228
- ),
229
- )`;
230
- }
231
- function createCheckoutCartClientExports(service) {
232
- if (!serviceHasCheckoutCartState(service)) return '';
233
- const stem = resolveApiStem(service);
234
- const groupName = verticalApiGroupName(service);
235
- const pascalStem = toPascalCase(stem);
236
- const clientOptionsName = `${pascalStem}ClientOptions`;
237
- const createClientName = `create${pascalStem}Client`;
238
- const clientEffectTypeName = `${pascalStem}ClientEffect`;
239
- return `
240
- export interface CheckoutCartLine {
241
- sku: string;
242
- name: string;
243
- quantity: number;
244
- unitPriceCents: number;
245
- }
246
-
247
- export interface CheckoutCart {
248
- lines: readonly CheckoutCartLine[];
249
- subtotalCents: number;
250
- totalQuantity: number;
251
- }
252
-
253
- export interface CheckoutAddCartItemInput {
254
- sku: string;
255
- name?: string;
256
- quantity: number;
257
- unitPriceCents?: number;
258
- }
259
-
260
- export const getCheckoutCart = (
261
- options: ${clientOptionsName} = {},
262
- ): ${clientEffectTypeName}<CheckoutCart> =>
263
- ${createClientName}({
264
- ...options,
265
- operationContext:
266
- options.operationContext ?? ${groupName}OperationContexts.getCart,
267
- }).pipe(
268
- Effect.flatMap(client => client.${groupName}.getCart({})),
269
- );
270
-
271
- export const addCheckoutCartItem = (
272
- payload: CheckoutAddCartItemInput,
273
- options: ${clientOptionsName} = {},
274
- ): ${clientEffectTypeName}<CheckoutCart> =>
275
- ${createClientName}({
276
- ...options,
277
- operationContext:
278
- options.operationContext ?? ${groupName}OperationContexts.addCartItem,
279
- }).pipe(
280
- Effect.flatMap(client =>
281
- client.${groupName}.addCartItem({ payload }),
282
- ),
283
- );
284
-
285
- export const removeCheckoutCartItem = (
286
- sku: string,
287
- options: ${clientOptionsName} = {},
288
- ): ${clientEffectTypeName}<CheckoutCart> =>
289
- ${createClientName}({
290
- ...options,
291
- operationContext:
292
- options.operationContext ?? ${groupName}OperationContexts.removeCartItem,
293
- }).pipe(
294
- Effect.flatMap(client =>
295
- client.${groupName}.removeCartItem({ payload: { sku } }),
296
- ),
297
- );
298
-
299
- export const clearCheckoutCart = (
300
- options: ${clientOptionsName} = {},
301
- ): ${clientEffectTypeName}<CheckoutCart> =>
302
- ${createClientName}({
303
- ...options,
304
- operationContext:
305
- options.operationContext ?? ${groupName}OperationContexts.clearCart,
306
- }).pipe(
307
- Effect.flatMap(client => client.${groupName}.clearCart({})),
308
- );
309
- `;
310
- }
311
- function createSharedApiImports() {
312
- return `import {
313
- HttpApi,
314
- HttpApiEndpoint,
315
- HttpApiGroup,
316
- HttpApiSchema,
317
- Schema,
318
- } from '@modern-js/plugin-bff/effect-client';
319
- `;
320
- }
321
- function createSharedApiContract(service) {
322
- const schemaExport = verticalApiSchemaExport(service);
323
- const markerSchemaExport = verticalApiMarkerSchemaExport(service);
324
- const readinessSchemaExport = verticalApiReadinessSchemaExport(service);
325
- const createPayloadSchemaExport = verticalApiCreatePayloadSchemaExport(service);
326
- const notFoundErrorExport = verticalApiNotFoundErrorExport(service);
327
- const notFoundSchemaExport = verticalApiNotFoundSchemaExport(service);
328
- const apiExport = verticalApiExport(service);
329
- const apiName = verticalApiName(service);
330
- const groupName = verticalApiGroupName(service);
331
- const stem = resolveApiStem(service);
332
- const pascalStem = toPascalCase(stem);
333
- const markerType = `${pascalStem}Marker`;
334
- const itemType = `${pascalStem}Item`;
335
- const readinessType = `${pascalStem}Readiness`;
336
- const createPayloadType = `${pascalStem}CreatePayload`;
337
- const createResponseType = `${pascalStem}CreateResponse`;
338
- const listResponseType = `${pascalStem}ListResponse`;
339
- const apiPrefix = resolveApiPrefix(service);
340
- const checkoutCartSharedSchemas = createCheckoutCartSharedSchemas(service);
341
- const checkoutCartSharedSchemaSection = '' === checkoutCartSharedSchemas ? '' : `${checkoutCartSharedSchemas}\n`;
342
- const checkoutCartOperationContexts = createCheckoutCartOperationContexts(service).trimStart();
343
- const checkoutCartOperationContextEntries = '' === checkoutCartOperationContexts ? '' : `${checkoutCartOperationContexts}\n`;
344
- return `export interface ${markerType} {
345
- readonly appId: string;
346
- readonly build: string;
347
- readonly deployProfile: string;
348
- readonly packageName: string;
349
- readonly surface: string;
350
- readonly version: string;
351
- }
352
-
353
- export interface ${itemType} {
354
- readonly id: string;
355
- readonly marker: ${markerType};
356
- readonly title: string;
357
- }
358
-
359
- export interface ${readinessType} {
360
- readonly checks: {
361
- readonly api: 'ready';
362
- readonly moduleFederation: 'ready';
363
- readonly ssr: 'ready';
364
- readonly translations: 'ready';
365
- };
366
- readonly marker: ${markerType};
367
- readonly status: 'ready';
368
- readonly versionSkew: 'none';
369
- }
370
-
371
- export interface ${createPayloadType} {
372
- readonly title: string;
373
- }
374
-
375
- export interface ${listResponseType} {
376
- readonly items: readonly ${itemType}[];
377
- }
378
-
379
- export interface ${createResponseType} {
380
- readonly item: ${itemType};
381
- }
382
-
383
- export interface ${notFoundErrorExport} {
384
- readonly _tag: '${notFoundErrorExport}';
385
- readonly id: string;
386
- }
387
-
388
- export const ${markerSchemaExport}: Schema.Codec<${markerType}> = Schema.Struct({
389
- appId: Schema.String,
390
- build: Schema.String,
391
- deployProfile: Schema.String,
392
- packageName: Schema.String,
393
- surface: Schema.String,
394
- version: Schema.String,
395
- });
396
-
397
- export const ${schemaExport}: Schema.Codec<${itemType}> = Schema.Struct({
398
- id: Schema.String,
399
- marker: ${markerSchemaExport},
400
- title: Schema.String,
401
- });
402
-
403
- export const ${readinessSchemaExport}: Schema.Codec<${readinessType}> = Schema.Struct({
404
- checks: Schema.Struct({
405
- api: Schema.Literal('ready'),
406
- moduleFederation: Schema.Literal('ready'),
407
- ssr: Schema.Literal('ready'),
408
- translations: Schema.Literal('ready'),
409
- }),
410
- marker: ${markerSchemaExport},
411
- status: Schema.Literal('ready'),
412
- versionSkew: Schema.Literal('none'),
413
- });
414
-
415
- export const ${createPayloadSchemaExport}: Schema.Codec<${createPayloadType}> = Schema.Struct({
416
- title: Schema.String,
417
- });
418
-
419
- ${checkoutCartSharedSchemaSection}export const ${notFoundSchemaExport}: Schema.Codec<${notFoundErrorExport}> = Schema.TaggedStruct('${notFoundErrorExport}', {
420
- id: Schema.String,
421
- }).pipe(
422
- HttpApiSchema.status(404),
423
- );
424
-
425
- export interface OperationContext {
426
- method: string;
427
- operationId: string;
428
- routePath: string;
429
- source:
430
- | 'client'
431
- | 'server'
432
- | 'generated-client'
433
- | 'effect-adapter'
434
- | 'data-platform'
435
- | 'unknown';
436
- traceId?: string;
437
- }
438
-
439
- export const ${apiExport} = HttpApi.make('${apiName}').add(
440
- HttpApiGroup.make('${groupName}')
441
- .add(
442
- HttpApiEndpoint.get('list', '/${stem}', {
443
- query: {
444
- limit: Schema.optional(Schema.FiniteFromString),
445
- },
446
- success: Schema.Struct({
447
- items: Schema.Array(${schemaExport}),
448
- }),
449
- }),
450
- )
451
- .add(
452
- HttpApiEndpoint.get('readiness', '/${stem}/readiness', {
453
- success: ${readinessSchemaExport},
454
- }),
455
- )
456
- .add(
457
- HttpApiEndpoint.get('get', '/${stem}/:id', {
458
- error: ${notFoundSchemaExport},
459
- params: {
460
- id: Schema.String,
461
- },
462
- success: ${schemaExport},
463
- }),
464
- )
465
- .add(
466
- HttpApiEndpoint.post('create', '/${stem}', {
467
- payload: ${createPayloadSchemaExport},
468
- success: Schema.Struct({
469
- item: ${schemaExport},
470
- }),
471
- }),
472
- )${createCheckoutCartEndpointDefinitions(service)},
473
- );
474
-
475
- export const ${groupName}OperationContexts = {
476
- ${checkoutCartOperationContextEntries} create: {
477
- method: 'POST',
478
- operationId: '${apiName}:${groupName}:create',
479
- routePath: '/${stem}',
480
- source: 'generated-client',
481
- },
482
- get: {
483
- method: 'GET',
484
- operationId: '${apiName}:${groupName}:get',
485
- routePath: '/${stem}/:id',
486
- source: 'generated-client',
487
- },
488
- list: {
489
- method: 'GET',
490
- operationId: '${apiName}:${groupName}:list',
491
- routePath: '/${stem}',
492
- source: 'generated-client',
493
- },
494
- readiness: {
495
- method: 'GET',
496
- operationId: '${apiName}:${groupName}:readiness',
497
- routePath: '/${stem}/readiness',
498
- source: 'generated-client',
499
- },
500
- } satisfies Record<string, OperationContext>;
501
-
502
- export const ${groupName}ApiContract = {
503
- apiPrefix: '${apiPrefix}',
504
- basePath: '${apiPrefix}/${stem}',
505
- ${createCheckoutCartApiContractFields(service)} ownerId: '${service.id}',
506
- readinessPath: '${apiPrefix}/${stem}/readiness',
507
- } as const;
508
- `;
509
- }
510
- function createSharedApi(service) {
511
- return `${createSharedApiImports()}
512
- ${createSharedApiContract(service)}`;
513
- }
514
- function createApiServiceEntry(service, contractImportPath) {
515
- const apiExport = verticalApiExport(service);
516
- const groupName = verticalApiGroupName(service);
517
- const notFoundErrorExport = verticalApiNotFoundErrorExport(service);
518
- const stem = resolveApiStem(service);
519
- return `import {
520
- defineEffectBff,
521
- Effect,
522
- HttpApiBuilder,
523
- Layer,
524
- } from '@modern-js/plugin-bff/effect-edge';
525
- import type {
526
- EffectBffDefinition,
527
- EffectBffRuntime,
528
- EffectRuntimeLayer,
529
- } from '@modern-js/plugin-bff/effect-edge';
530
- import { ultramodernApiMarker } from '../shared/ultramodern-build.ts';
531
- import {
532
- ${apiExport},
533
- ${groupName}OperationContexts,
534
- } from '${contractImportPath}';
535
- import type {
536
- ${notFoundErrorExport},
537
- OperationContext,
538
- } from '${contractImportPath}';
539
-
540
- const ${groupName}Items = [
541
- {
542
- id: 'starter-${stem}',
543
- marker: ultramodernApiMarker,
544
- title: 'Wire a real ${stem} source here',
545
- },
546
- ];
547
- ${createCheckoutCartServerState(service)}
548
-
549
- const operationAttributes = (operationContext: OperationContext) => ({
550
- 'modernjs.operation.id': operationContext.operationId,
551
- 'modernjs.operation.method': operationContext.method,
552
- 'modernjs.operation.route': operationContext.routePath,
553
- 'modernjs.operation.source': operationContext.source,
554
- ...(typeof operationContext.traceId === 'string'
555
- ? { 'modernjs.trace.id': operationContext.traceId }
556
- : {}),
557
- });
558
-
559
- const ${groupName}Layer = HttpApiBuilder.group(
560
- ${apiExport},
561
- '${groupName}',
562
- (handlers) =>
563
- handlers
564
- .handle('list', ({ query }) =>
565
- Effect.succeed({
566
- items:
567
- typeof query.limit === 'number'
568
- ? ${groupName}Items.slice(0, query.limit)
569
- : ${groupName}Items,
570
- }).pipe(
571
- Effect.withSpan('ultramodern.api.${groupName}.list', {
572
- attributes: operationAttributes(${groupName}OperationContexts.list),
573
- kind: 'server',
574
- }),
575
- ),
576
- )
577
- .handle('readiness', () =>
578
- Effect.succeed({
579
- checks: {
580
- api: 'ready' as const,
581
- moduleFederation: 'ready' as const,
582
- ssr: 'ready' as const,
583
- translations: 'ready' as const,
584
- },
585
- marker: ultramodernApiMarker,
586
- status: 'ready' as const,
587
- versionSkew: 'none' as const,
588
- }).pipe(
589
- Effect.withSpan('ultramodern.api.${groupName}.readiness', {
590
- attributes: operationAttributes(${groupName}OperationContexts.readiness),
591
- kind: 'server',
592
- }),
593
- ),
594
- )
595
- .handle('get', ({ params }) => {
596
- const matchedItem = ${groupName}Items.find(
597
- candidate => candidate.id === params.id,
598
- );
599
- const notFound: ${notFoundErrorExport} = {
600
- _tag: '${notFoundErrorExport}',
601
- id: params.id,
602
- };
603
- const result =
604
- matchedItem === undefined
605
- ? Effect.fail(notFound)
606
- : Effect.succeed(matchedItem);
607
-
608
- return result.pipe(
609
- Effect.withSpan('ultramodern.api.${groupName}.get', {
610
- attributes: operationAttributes(${groupName}OperationContexts.get),
611
- kind: 'server',
612
- }),
613
- );
614
- })
615
- .handle('create', ({ payload }) =>
616
- Effect.succeed({
617
- item: {
618
- id: \`generated-${stem}-\${payload.title
619
- .toLowerCase()
620
- .replaceAll(/[^a-z0-9]+/gu, '-')
621
- .replaceAll(/^-|-$/gu, '')}\`,
622
- marker: ultramodernApiMarker,
623
- title: payload.title,
624
- },
625
- }).pipe(
626
- Effect.withSpan('ultramodern.api.${groupName}.create', {
627
- attributes: operationAttributes(${groupName}OperationContexts.create),
628
- kind: 'server',
629
- }),
630
- ),
631
- )${createCheckoutCartServerHandlers(service)},
632
- );
633
-
634
- const layer = HttpApiBuilder.layer(${apiExport}).pipe(
635
- Layer.provide(${groupName}Layer),
636
- ) satisfies EffectRuntimeLayer;
637
-
638
- const apiRuntime: EffectBffDefinition<typeof ${apiExport}, EffectRuntimeLayer> &
639
- EffectBffRuntime<typeof ${apiExport}, EffectRuntimeLayer> = defineEffectBff({
640
- api: ${apiExport},
641
- layer,
642
- });
643
-
644
- export default apiRuntime;
645
- `;
646
- }
647
- function createBackendEffectApiExpose(scope, service) {
648
- const apiExport = verticalApiExport(service);
649
- const groupName = verticalApiGroupName(service);
650
- const apiPrefix = resolveApiPrefix(service);
651
- const stem = resolveApiStem(service);
652
- return `import apiRuntime from './index.ts';
653
- import { ultramodernApiMarker } from '../shared/ultramodern-build.ts';
654
- import {
655
- ${apiExport},
656
- ${groupName}ApiContract,
657
- ${groupName}OperationContexts,
658
- } from '../shared/api.ts';
659
-
660
- export const backendFederationContract = {
661
- compatibility: {
662
- build: ultramodernApiMarker.build,
663
- contractVersion: '${BACKEND_FEDERATION_CONTRACT_VERSION}',
664
- nodeAdapterVersion: '${BACKEND_FEDERATION_NODE_ADAPTER_VERSION}',
665
- packageName: '${packageName(scope, service.packageSuffix)}',
666
- sourceRevision: ultramodernApiMarker.sourceRevision,
667
- unitId: ultramodernApiMarker.unitId,
668
- },
669
- executionSurfaces: ['node-mf-runtime'],
670
- exposes: ['./effect-api'],
671
- name: '${createBackendFederationName(service)}',
672
- openapiPath: '${apiPrefix}/openapi.json',
673
- readinessPath: '${apiPrefix}/${stem}/readiness',
674
- role: 'microvertical-server',
675
- runtimeFramework: 'effect',
676
- strictEffectApproach: true,
677
- } as const;
678
-
679
- export const api: unknown = ${apiExport};
680
- export const contract = ${groupName}ApiContract;
681
- export const operationContexts = ${groupName}OperationContexts;
682
- export const runtime = apiRuntime;
683
-
684
- export default apiRuntime;
685
- `;
686
- }
687
- function createApiClient(service, contractImportPath) {
688
- const apiExport = verticalApiExport(service);
689
- const contractExport = verticalApiGroupName(service);
690
- const stem = resolveApiStem(service);
691
- const groupName = verticalApiGroupName(service);
692
- const singular = verticalApiErrorStem(service);
693
- const clientOptionsName = `${toPascalCase(stem)}ClientOptions`;
694
- const createClientName = `create${toPascalCase(stem)}Client`;
695
- const clientTypeName = `${toPascalCase(stem)}Client`;
696
- const clientEffectTypeName = `${toPascalCase(stem)}ClientEffect`;
697
- const listName = `list${toPascalCase(stem)}`;
698
- const readinessName = `get${toPascalCase(stem)}Readiness`;
699
- const getName = `get${toPascalCase(singular)}`;
700
- const createName = `create${toPascalCase(singular)}`;
701
- const notFoundErrorExport = verticalApiNotFoundErrorExport(service);
702
- const pascalStem = toPascalCase(stem);
703
- const itemType = `${pascalStem}Item`;
704
- const readinessType = `${pascalStem}Readiness`;
705
- const createResponseType = `${pascalStem}CreateResponse`;
706
- const listResponseType = `${pascalStem}ListResponse`;
707
- const checkoutCartClientExports = createCheckoutCartClientExports(service);
708
- return `import {
709
- Effect,
710
- makeEffectHttpApiClient,
711
- runEffectRequest,
712
- } from '@modern-js/plugin-bff/effect-client';
713
- import type {
714
- HttpClientError,
715
- HttpApi,
716
- HttpApiClient,
717
- HttpApiGroup,
718
- Schema,
719
- } from '@modern-js/plugin-bff/effect-client';
720
- import {
721
- ${contractExport}ApiContract,
722
- ${apiExport},
723
- ${groupName}OperationContexts,
724
- } from '${contractImportPath}';
725
- import type {
726
- ${createResponseType},
727
- ${itemType},
728
- ${listResponseType},
729
- ${notFoundErrorExport},
730
- OperationContext,
731
- ${readinessType},
732
- } from '${contractImportPath}';
733
-
734
- export { Effect, runEffectRequest };
735
-
736
- type ${pascalStem}ApiGroups = typeof ${apiExport} extends HttpApi.HttpApi<
737
- infer _ApiId,
738
- infer Groups
739
- >
740
- ? Groups
741
- : never;
742
-
743
- export type ${clientTypeName} = HttpApiClient.Client<
744
- Extract<${pascalStem}ApiGroups, HttpApiGroup.Any>,
745
- never,
746
- never
747
- >;
748
-
749
- export type ${pascalStem}ClientError =
750
- | ${notFoundErrorExport}
751
- | HttpClientError.HttpClientError
752
- | Schema.SchemaError;
753
-
754
- export type ${clientEffectTypeName}<Success> = Effect.Effect<
755
- Success,
756
- ${pascalStem}ClientError,
757
- never
758
- >;
759
-
760
- export interface ${clientOptionsName} {
761
- baseUrl?: string | URL;
762
- locale?: string;
763
- operationContext?: OperationContext;
764
- traceparent?: string;
765
- }
766
-
767
- export const ${createClientName} = (
768
- options: ${clientOptionsName} = {},
769
- ): ${clientEffectTypeName}<${clientTypeName}> =>
770
- makeEffectHttpApiClient(${apiExport}, {
771
- baseUrl: options.baseUrl ?? ${contractExport}ApiContract.apiPrefix,
772
- requestContext: {
773
- ...(options.locale === undefined ? {} : { locale: options.locale }),
774
- ...(options.operationContext === undefined
775
- ? {}
776
- : { operationContext: options.operationContext }),
777
- ...(options.traceparent === undefined
778
- ? {}
779
- : { traceparent: options.traceparent }),
780
- },
781
- });
782
-
783
- export const ${listName} = (
784
- options: ${clientOptionsName} & { limit?: number } = {},
785
- ): ${clientEffectTypeName}<${listResponseType}> =>
786
- ${createClientName}({
787
- ...options,
788
- operationContext:
789
- options.operationContext ?? ${groupName}OperationContexts.list,
790
- }).pipe(
791
- Effect.flatMap(client =>
792
- client.${groupName}.list({ query: { limit: options.limit } }),
793
- ),
794
- );
795
-
796
- export const ${readinessName} = (
797
- options: ${clientOptionsName} = {},
798
- ): ${clientEffectTypeName}<${readinessType}> =>
799
- ${createClientName}({
800
- ...options,
801
- operationContext:
802
- options.operationContext ?? ${groupName}OperationContexts.readiness,
803
- }).pipe(
804
- Effect.flatMap(client => client.${groupName}.readiness({})),
805
- );
806
-
807
- export const ${getName} = (
808
- id: string,
809
- options: ${clientOptionsName} = {},
810
- ): ${clientEffectTypeName}<${itemType}> =>
811
- ${createClientName}({
812
- ...options,
813
- operationContext:
814
- options.operationContext ?? ${groupName}OperationContexts.get,
815
- }).pipe(
816
- Effect.flatMap(client => client.${groupName}.get({ params: { id } })),
817
- );
818
-
819
- export const ${createName} = (
820
- title: string,
821
- options: ${clientOptionsName} = {},
822
- ): ${clientEffectTypeName}<${createResponseType}> =>
823
- ${createClientName}({
824
- ...options,
825
- operationContext:
826
- options.operationContext ?? ${groupName}OperationContexts.create,
827
- }).pipe(
828
- Effect.flatMap(client =>
829
- client.${groupName}.create({ payload: { title } }),
830
- ),
831
- );${checkoutCartClientExports}
832
- `;
833
- }
834
- function createShellApiClient(scope, remotes = []) {
835
- const exports = verticalApiApps(remotes).map((remote)=>{
836
- const stem = resolveApiStem(remote);
837
- const pascalStem = toPascalCase(stem);
838
- const pascalSingular = toPascalCase(verticalApiErrorStem(remote));
839
- const checkoutCartExports = serviceHasCheckoutCartState(remote) ? ` addCheckoutCartItem,
840
- clearCheckoutCart,
841
- getCheckoutCart,
842
- removeCheckoutCartItem,
843
- type CheckoutAddCartItemInput,
844
- type CheckoutCart,
845
- type CheckoutCartLine,
846
- ` : '';
847
- return `export {
848
- ${checkoutCartExports} create${pascalSingular},
849
- create${pascalStem}Client,
850
- get${pascalSingular},
851
- get${pascalStem}Readiness,
852
- list${pascalStem},
853
- type ${pascalStem}ClientOptions,
854
- } from '${packageName(scope, remote.packageSuffix)}/api/client';`;
855
- }).join('\n\n');
856
- return exports ? `${exports}\n` : `export const ultramodernVerticalClients = [] as const;
857
- `;
858
- }
859
- function createApiReadinessContract(app) {
860
- const stem = resolveApiStem(app);
861
- return {
862
- endpoint: `/${stem}/readiness`,
863
- marker: {
864
- ui: 'ultramodernUiMarker',
865
- api: 'ultramodernApiMarker',
866
- skew: 'none'
867
- },
868
- checks: [
869
- 'moduleFederation',
870
- 'ssr',
871
- 'translations',
872
- 'api'
873
- ]
874
- };
875
- }
876
- function createApiRequestContextContract() {
877
- return {
878
- propagatedHeaders: [
879
- 'accept-language',
880
- 'authorization',
881
- 'traceparent',
882
- 'x-correlation-id',
883
- 'x-tenant-id',
884
- 'x-ultramodern-env',
885
- 'x-vertical-version-id'
886
- ],
887
- source: 'shell-to-vertical-api-client'
888
- };
889
- }
890
- function createApiDomainOperations(app) {
891
- const stem = resolveApiStem(app);
892
- const group = verticalApiGroupName(app);
893
- const basePath = `/${stem}`;
894
- const checkoutCartOperations = serviceHasCheckoutCartState(app) ? {
895
- checkoutCartAddItem: {
896
- client: 'addCheckoutCartItem',
897
- method: 'POST',
898
- path: '/checkout/cart/items',
899
- resource: 'checkout-cart',
900
- owner: app.id
901
- },
902
- checkoutCartClear: {
903
- client: 'clearCheckoutCart',
904
- method: 'POST',
905
- path: '/checkout/cart/clear',
906
- resource: 'checkout-cart',
907
- owner: app.id
908
- },
909
- checkoutCartRead: {
910
- client: 'getCheckoutCart',
911
- method: 'GET',
912
- path: '/checkout/cart',
913
- resource: 'checkout-cart',
914
- owner: app.id
915
- },
916
- checkoutCartRemoveItem: {
917
- client: 'removeCheckoutCartItem',
918
- method: 'POST',
919
- path: '/checkout/cart/remove',
920
- resource: 'checkout-cart',
921
- owner: app.id
922
- }
923
- } : {};
924
- return {
925
- ...checkoutCartOperations,
926
- workspaceFeed: {
927
- client: `list${toPascalCase(stem)}`,
928
- method: 'GET',
929
- path: basePath,
930
- resource: 'workspace-items',
931
- owner: app.id
932
- },
933
- workspaceDetail: {
934
- client: `get${toPascalCase(verticalApiErrorStem(app))}`,
935
- method: 'GET',
936
- path: `${basePath}/:id`,
937
- resource: 'workspace-item',
938
- owner: app.id
939
- },
940
- workspaceCreate: {
941
- client: `create${toPascalCase(verticalApiErrorStem(app))}`,
942
- method: 'POST',
943
- path: basePath,
944
- resource: group,
945
- owner: app.id
946
- }
947
- };
948
- }
949
- function apiTopologyMetadata(app) {
950
- if (!appHasApi(app)) return;
951
- return {
952
- runtime: 'effect',
953
- bff: {
954
- prefix: app.api.prefix,
955
- openapi: '/openapi.json',
956
- strictEffectApproach: true
957
- },
958
- contract: {
959
- export: './api',
960
- path: `${app.directory}/shared/api.ts`
961
- },
962
- client: {
963
- export: './api/client',
964
- path: `${app.directory}/src/api/${app.api.stem}-client.ts`
965
- },
966
- serverEntry: `${app.directory}/api/index.ts`,
967
- basePath: `${app.api.prefix}/${app.api.stem}`,
968
- consumedBy: app.api.consumedBy,
969
- readiness: createApiReadinessContract(app),
970
- requestContext: createApiRequestContextContract(),
971
- domainOperations: createApiDomainOperations(app)
972
- };
973
- }
974
- function createApiOperationContract(target) {
975
- const stem = resolveApiStem(target);
976
- const checkoutCartOperations = serviceHasCheckoutCartState(target) ? {
977
- addCartItem: {
978
- method: 'POST',
979
- path: '/checkout/cart/items',
980
- source: 'generated-client'
981
- },
982
- clearCart: {
983
- method: 'POST',
984
- path: '/checkout/cart/clear',
985
- source: 'generated-client'
986
- },
987
- getCart: {
988
- method: 'GET',
989
- path: '/checkout/cart',
990
- source: 'generated-client'
991
- },
992
- removeCartItem: {
993
- method: 'POST',
994
- path: '/checkout/cart/remove',
995
- source: 'generated-client'
996
- }
997
- } : {};
998
- return {
999
- group: verticalApiGroupName(target),
1000
- notFound: verticalApiNotFoundErrorExport(target),
1001
- operations: {
1002
- ...checkoutCartOperations,
1003
- list: {
1004
- method: 'GET',
1005
- path: `/${stem}`,
1006
- source: 'generated-client'
1007
- },
1008
- readiness: {
1009
- method: 'GET',
1010
- path: `/${stem}/readiness`,
1011
- source: 'generated-client'
1012
- },
1013
- get: {
1014
- method: 'GET',
1015
- path: `/${stem}/:id`,
1016
- source: 'generated-client'
1017
- },
1018
- create: {
1019
- method: 'POST',
1020
- path: `/${stem}`,
1021
- source: 'generated-client'
1022
- }
1023
- }
1024
- };
1025
- }
1026
- export { apiTopologyMetadata, createApiClient, createApiDomainOperations, createApiOperationContract, createApiReadinessContract, createApiRequestContextContract, createApiServiceEntry, createBackendEffectApiExpose, createSharedApi, createSharedApiContract, createSharedApiImports, createShellApiClient, verticalApiCreatePayloadSchemaExport, verticalApiErrorStem, verticalApiExport, verticalApiGroupName, verticalApiMarkerSchemaExport, verticalApiName, verticalApiNotFoundErrorExport, verticalApiNotFoundSchemaExport, verticalApiReadinessSchemaExport, verticalApiSchemaExport };
2
+ export { createApiClient, createShellApiClient } from "./api/client.js";
3
+ export { apiTopologyMetadata, createApiDomainOperations, createApiOperationContract, createApiReadinessContract, createApiRequestContextContract } from "./api/contracts.js";
4
+ export { verticalApiCreatePayloadSchemaExport, verticalApiErrorStem, verticalApiExport, verticalApiGroupName, verticalApiMarkerSchemaExport, verticalApiName, verticalApiNotFoundErrorExport, verticalApiNotFoundSchemaExport, verticalApiReadinessSchemaExport, verticalApiSchemaExport } from "./api/names.js";
5
+ export { createApiServiceEntry, createBackendEffectApiExpose } from "./api/service.js";
6
+ export { createSharedApi, createSharedApiContract, createSharedApiImports } from "./api/shared.js";