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