@zuplo/cli 7.10.0 → 7.11.1

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 (310) hide show
  1. package/dist/common/worker-output.d.ts +7 -0
  2. package/dist/common/worker-output.d.ts.map +1 -1
  3. package/dist/common/worker-output.js +39 -0
  4. package/dist/common/worker-output.js.map +1 -1
  5. package/dist/tsconfig.tsbuildinfo +1 -1
  6. package/node_modules/@hono/node-server/README.md +2 -0
  7. package/node_modules/@hono/node-server/dist/index.cjs +1 -1
  8. package/node_modules/@hono/node-server/dist/index.mjs +1 -1
  9. package/node_modules/@hono/node-server/dist/serve-static.cjs +2 -1
  10. package/node_modules/@hono/node-server/dist/serve-static.mjs +2 -1
  11. package/node_modules/@hono/node-server/package.json +1 -1
  12. package/node_modules/@posthog/core/dist/metrics/index.d.ts +9 -0
  13. package/node_modules/@posthog/core/dist/metrics/index.d.ts.map +1 -1
  14. package/node_modules/@posthog/core/dist/metrics/index.js +38 -3
  15. package/node_modules/@posthog/core/dist/metrics/index.mjs +38 -3
  16. package/node_modules/@posthog/core/dist/metrics/types.d.ts +7 -2
  17. package/node_modules/@posthog/core/dist/metrics/types.d.ts.map +1 -1
  18. package/node_modules/@posthog/core/dist/traces/ids.d.ts.map +1 -1
  19. package/node_modules/@posthog/core/dist/traces/ids.js +2 -2
  20. package/node_modules/@posthog/core/dist/traces/ids.mjs +2 -2
  21. package/node_modules/@posthog/core/dist/types.d.ts +1 -1
  22. package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
  23. package/node_modules/@posthog/core/package.json +4 -3
  24. package/node_modules/@posthog/core/src/metrics/index.spec.ts +75 -0
  25. package/node_modules/@posthog/core/src/metrics/index.ts +60 -0
  26. package/node_modules/@posthog/core/src/metrics/types.ts +7 -1
  27. package/node_modules/@posthog/core/src/traces/ids.ts +4 -2
  28. package/node_modules/@posthog/core/src/types.ts +1 -1
  29. package/node_modules/@posthog/types/dist/capture-metric.d.ts +10 -0
  30. package/node_modules/@posthog/types/dist/capture-metric.d.ts.map +1 -1
  31. package/node_modules/@posthog/types/dist/capture.d.ts +1 -1
  32. package/node_modules/@posthog/types/dist/capture.d.ts.map +1 -1
  33. package/node_modules/@posthog/types/dist/index.d.ts +1 -1
  34. package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
  35. package/node_modules/@posthog/types/package.json +1 -1
  36. package/node_modules/@posthog/types/src/capture-metric.ts +11 -0
  37. package/node_modules/@posthog/types/src/capture.ts +1 -1
  38. package/node_modules/@posthog/types/src/index.ts +1 -0
  39. package/node_modules/@zuplo/core/customer.cli.minified.js +272 -261
  40. package/node_modules/@zuplo/core/index.minified.js +276 -265
  41. package/node_modules/@zuplo/core/package.json +1 -1
  42. package/node_modules/@zuplo/graphql/package.json +1 -1
  43. package/node_modules/@zuplo/openapi-tools/package.json +5 -2
  44. package/node_modules/@zuplo/otel/package.json +1 -1
  45. package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ2BHVUH.js → chunk-CDEAY3VY.js} +2 -2
  46. package/node_modules/@zuplo/runtime/out/esm/chunk-LVSZ3WTO.js +37 -0
  47. package/node_modules/@zuplo/runtime/out/esm/chunk-LVSZ3WTO.js.map +1 -0
  48. package/node_modules/@zuplo/runtime/out/esm/{chunk-VTO3F6DK.js → chunk-NUVXDVLJ.js} +2 -2
  49. package/node_modules/@zuplo/runtime/out/esm/{chunk-6YPRGG62.js → chunk-RHU3Z7DA.js} +108 -108
  50. package/node_modules/@zuplo/runtime/out/esm/chunk-RHU3Z7DA.js.map +1 -0
  51. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  52. package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
  53. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  54. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  55. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
  56. package/node_modules/@zuplo/runtime/out/types/index.d.ts +15 -24
  57. package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +14 -0
  58. package/node_modules/@zuplo/runtime/package.json +1 -1
  59. package/package.json +15 -12
  60. package/dist/__tests__/archive-utils.test.d.ts +0 -2
  61. package/dist/__tests__/archive-utils.test.d.ts.map +0 -1
  62. package/dist/__tests__/archive-utils.test.js +0 -50
  63. package/dist/__tests__/archive-utils.test.js.map +0 -1
  64. package/dist/__tests__/import-openapi.test.d.ts +0 -2
  65. package/dist/__tests__/import-openapi.test.d.ts.map +0 -1
  66. package/dist/__tests__/import-openapi.test.js +0 -251
  67. package/dist/__tests__/import-openapi.test.js.map +0 -1
  68. package/dist/__tests__/integration/confirm-linked-config.integration.test.d.ts +0 -2
  69. package/dist/__tests__/integration/confirm-linked-config.integration.test.d.ts.map +0 -1
  70. package/dist/__tests__/integration/confirm-linked-config.integration.test.js +0 -202
  71. package/dist/__tests__/integration/confirm-linked-config.integration.test.js.map +0 -1
  72. package/dist/__tests__/integration/confirm-production-deploy.integration.test.d.ts +0 -2
  73. package/dist/__tests__/integration/confirm-production-deploy.integration.test.d.ts.map +0 -1
  74. package/dist/__tests__/integration/confirm-production-deploy.integration.test.js +0 -184
  75. package/dist/__tests__/integration/confirm-production-deploy.integration.test.js.map +0 -1
  76. package/dist/__tests__/integration/custom-domain.integration.test.d.ts +0 -2
  77. package/dist/__tests__/integration/custom-domain.integration.test.d.ts.map +0 -1
  78. package/dist/__tests__/integration/custom-domain.integration.test.js +0 -563
  79. package/dist/__tests__/integration/custom-domain.integration.test.js.map +0 -1
  80. package/dist/__tests__/integration/delete.integration.test.d.ts +0 -2
  81. package/dist/__tests__/integration/delete.integration.test.d.ts.map +0 -1
  82. package/dist/__tests__/integration/delete.integration.test.js +0 -262
  83. package/dist/__tests__/integration/delete.integration.test.js.map +0 -1
  84. package/dist/__tests__/integration/deploy.integration.test.d.ts +0 -2
  85. package/dist/__tests__/integration/deploy.integration.test.d.ts.map +0 -1
  86. package/dist/__tests__/integration/deploy.integration.test.js +0 -519
  87. package/dist/__tests__/integration/deploy.integration.test.js.map +0 -1
  88. package/dist/__tests__/integration/get-project-param.integration.test.d.ts +0 -2
  89. package/dist/__tests__/integration/get-project-param.integration.test.d.ts.map +0 -1
  90. package/dist/__tests__/integration/get-project-param.integration.test.js +0 -305
  91. package/dist/__tests__/integration/get-project-param.integration.test.js.map +0 -1
  92. package/dist/__tests__/integration/info.integration.test.d.ts +0 -2
  93. package/dist/__tests__/integration/info.integration.test.d.ts.map +0 -1
  94. package/dist/__tests__/integration/info.integration.test.js +0 -293
  95. package/dist/__tests__/integration/info.integration.test.js.map +0 -1
  96. package/dist/__tests__/integration/jest-mocks-setup.d.ts +0 -2
  97. package/dist/__tests__/integration/jest-mocks-setup.d.ts.map +0 -1
  98. package/dist/__tests__/integration/jest-mocks-setup.js +0 -104
  99. package/dist/__tests__/integration/jest-mocks-setup.js.map +0 -1
  100. package/dist/__tests__/integration/jest-setup.d.ts +0 -2
  101. package/dist/__tests__/integration/jest-setup.d.ts.map +0 -1
  102. package/dist/__tests__/integration/jest-setup.js +0 -12
  103. package/dist/__tests__/integration/jest-setup.js.map +0 -1
  104. package/dist/__tests__/integration/link.integration.test.d.ts +0 -2
  105. package/dist/__tests__/integration/link.integration.test.d.ts.map +0 -1
  106. package/dist/__tests__/integration/link.integration.test.js +0 -395
  107. package/dist/__tests__/integration/link.integration.test.js.map +0 -1
  108. package/dist/__tests__/integration/linked-config-cascade.integration.test.d.ts +0 -2
  109. package/dist/__tests__/integration/linked-config-cascade.integration.test.d.ts.map +0 -1
  110. package/dist/__tests__/integration/linked-config-cascade.integration.test.js +0 -179
  111. package/dist/__tests__/integration/linked-config-cascade.integration.test.js.map +0 -1
  112. package/dist/__tests__/integration/list.integration.test.d.ts +0 -2
  113. package/dist/__tests__/integration/list.integration.test.d.ts.map +0 -1
  114. package/dist/__tests__/integration/list.integration.test.js +0 -300
  115. package/dist/__tests__/integration/list.integration.test.js.map +0 -1
  116. package/dist/__tests__/integration/source-upgrade.integration.test.d.ts +0 -2
  117. package/dist/__tests__/integration/source-upgrade.integration.test.d.ts.map +0 -1
  118. package/dist/__tests__/integration/source-upgrade.integration.test.js +0 -100
  119. package/dist/__tests__/integration/source-upgrade.integration.test.js.map +0 -1
  120. package/dist/__tests__/integration/test-utils.d.ts +0 -30
  121. package/dist/__tests__/integration/test-utils.d.ts.map +0 -1
  122. package/dist/__tests__/integration/test-utils.js +0 -82
  123. package/dist/__tests__/integration/test-utils.js.map +0 -1
  124. package/dist/__tests__/integration/tunnel.integration.test.d.ts +0 -2
  125. package/dist/__tests__/integration/tunnel.integration.test.d.ts.map +0 -1
  126. package/dist/__tests__/integration/tunnel.integration.test.js +0 -486
  127. package/dist/__tests__/integration/tunnel.integration.test.js.map +0 -1
  128. package/dist/__tests__/integration/variable.integration.test.d.ts +0 -2
  129. package/dist/__tests__/integration/variable.integration.test.d.ts.map +0 -1
  130. package/dist/__tests__/integration/variable.integration.test.js +0 -258
  131. package/dist/__tests__/integration/variable.integration.test.js.map +0 -1
  132. package/dist/__tests__/integration/whoami.integration.test.d.ts +0 -2
  133. package/dist/__tests__/integration/whoami.integration.test.d.ts.map +0 -1
  134. package/dist/__tests__/integration/whoami.integration.test.js +0 -116
  135. package/dist/__tests__/integration/whoami.integration.test.js.map +0 -1
  136. package/dist/__tests__/outdated.test.d.ts +0 -2
  137. package/dist/__tests__/outdated.test.d.ts.map +0 -1
  138. package/dist/__tests__/outdated.test.js +0 -67
  139. package/dist/__tests__/outdated.test.js.map +0 -1
  140. package/dist/__tests__/populate.test.d.ts +0 -2
  141. package/dist/__tests__/populate.test.d.ts.map +0 -1
  142. package/dist/__tests__/populate.test.js +0 -445
  143. package/dist/__tests__/populate.test.js.map +0 -1
  144. package/dist/__tests__/tsconfig-upgrader.test.d.ts +0 -2
  145. package/dist/__tests__/tsconfig-upgrader.test.d.ts.map +0 -1
  146. package/dist/__tests__/tsconfig-upgrader.test.js +0 -31
  147. package/dist/__tests__/tsconfig-upgrader.test.js.map +0 -1
  148. package/dist/ca-certificate/validation.test.d.ts +0 -2
  149. package/dist/ca-certificate/validation.test.d.ts.map +0 -1
  150. package/dist/ca-certificate/validation.test.js +0 -131
  151. package/dist/ca-certificate/validation.test.js.map +0 -1
  152. package/dist/common/analytics/cli-invocation.test.d.ts +0 -2
  153. package/dist/common/analytics/cli-invocation.test.d.ts.map +0 -1
  154. package/dist/common/analytics/cli-invocation.test.js +0 -51
  155. package/dist/common/analytics/cli-invocation.test.js.map +0 -1
  156. package/dist/common/analytics/package-manager.test.d.ts +0 -2
  157. package/dist/common/analytics/package-manager.test.d.ts.map +0 -1
  158. package/dist/common/analytics/package-manager.test.js +0 -163
  159. package/dist/common/analytics/package-manager.test.js.map +0 -1
  160. package/dist/common/cli-dispatcher.test.d.ts +0 -2
  161. package/dist/common/cli-dispatcher.test.d.ts.map +0 -1
  162. package/dist/common/cli-dispatcher.test.js +0 -80
  163. package/dist/common/cli-dispatcher.test.js.map +0 -1
  164. package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts +0 -2
  165. package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts.map +0 -1
  166. package/dist/common/middleware/check-pnpm-lifecycle.test.js +0 -125
  167. package/dist/common/middleware/check-pnpm-lifecycle.test.js.map +0 -1
  168. package/dist/common/middleware/get-environment-param.test.d.ts +0 -2
  169. package/dist/common/middleware/get-environment-param.test.d.ts.map +0 -1
  170. package/dist/common/middleware/get-environment-param.test.js +0 -57
  171. package/dist/common/middleware/get-environment-param.test.js.map +0 -1
  172. package/dist/common/read-linked-config.test.d.ts +0 -2
  173. package/dist/common/read-linked-config.test.d.ts.map +0 -1
  174. package/dist/common/read-linked-config.test.js +0 -363
  175. package/dist/common/read-linked-config.test.js.map +0 -1
  176. package/dist/common/terminal.test.d.ts +0 -2
  177. package/dist/common/terminal.test.d.ts.map +0 -1
  178. package/dist/common/terminal.test.js +0 -101
  179. package/dist/common/terminal.test.js.map +0 -1
  180. package/dist/common/utils/build-environment-prompt-choices.test.d.ts +0 -2
  181. package/dist/common/utils/build-environment-prompt-choices.test.d.ts.map +0 -1
  182. package/dist/common/utils/build-environment-prompt-choices.test.js +0 -97
  183. package/dist/common/utils/build-environment-prompt-choices.test.js.map +0 -1
  184. package/dist/common/utils/format-environment-type.test.d.ts +0 -2
  185. package/dist/common/utils/format-environment-type.test.d.ts.map +0 -1
  186. package/dist/common/utils/format-environment-type.test.js +0 -32
  187. package/dist/common/utils/format-environment-type.test.js.map +0 -1
  188. package/dist/common/utils/pnpm-lifecycle.test.d.ts +0 -2
  189. package/dist/common/utils/pnpm-lifecycle.test.d.ts.map +0 -1
  190. package/dist/common/utils/pnpm-lifecycle.test.js +0 -196
  191. package/dist/common/utils/pnpm-lifecycle.test.js.map +0 -1
  192. package/dist/common/utils/pretty-print-environment-prompt.test.d.ts +0 -2
  193. package/dist/common/utils/pretty-print-environment-prompt.test.d.ts.map +0 -1
  194. package/dist/common/utils/pretty-print-environment-prompt.test.js +0 -42
  195. package/dist/common/utils/pretty-print-environment-prompt.test.js.map +0 -1
  196. package/dist/common/utils/sort-environments-for-prompt.test.d.ts +0 -2
  197. package/dist/common/utils/sort-environments-for-prompt.test.d.ts.map +0 -1
  198. package/dist/common/utils/sort-environments-for-prompt.test.js +0 -82
  199. package/dist/common/utils/sort-environments-for-prompt.test.js.map +0 -1
  200. package/dist/common/utils/stringify-config.test.d.ts +0 -2
  201. package/dist/common/utils/stringify-config.test.d.ts.map +0 -1
  202. package/dist/common/utils/stringify-config.test.js +0 -80
  203. package/dist/common/utils/stringify-config.test.js.map +0 -1
  204. package/dist/common/validators/argument-validators.spec.d.ts +0 -2
  205. package/dist/common/validators/argument-validators.spec.d.ts.map +0 -1
  206. package/dist/common/validators/argument-validators.spec.js +0 -181
  207. package/dist/common/validators/argument-validators.spec.js.map +0 -1
  208. package/dist/deploy/archive.local-registry.test.d.ts +0 -2
  209. package/dist/deploy/archive.local-registry.test.d.ts.map +0 -1
  210. package/dist/deploy/archive.local-registry.test.js +0 -100
  211. package/dist/deploy/archive.local-registry.test.js.map +0 -1
  212. package/dist/deploy/archive.test.d.ts +0 -2
  213. package/dist/deploy/archive.test.d.ts.map +0 -1
  214. package/dist/deploy/archive.test.js +0 -248
  215. package/dist/deploy/archive.test.js.map +0 -1
  216. package/dist/deploy/classify-build-probe.test.d.ts +0 -2
  217. package/dist/deploy/classify-build-probe.test.d.ts.map +0 -1
  218. package/dist/deploy/classify-build-probe.test.js +0 -51
  219. package/dist/deploy/classify-build-probe.test.js.map +0 -1
  220. package/dist/deploy/poll-deployment.test.d.ts +0 -2
  221. package/dist/deploy/poll-deployment.test.d.ts.map +0 -1
  222. package/dist/deploy/poll-deployment.test.js +0 -158
  223. package/dist/deploy/poll-deployment.test.js.map +0 -1
  224. package/dist/dev/zuplo-local-gitignore.test.d.ts +0 -2
  225. package/dist/dev/zuplo-local-gitignore.test.d.ts.map +0 -1
  226. package/dist/dev/zuplo-local-gitignore.test.js +0 -58
  227. package/dist/dev/zuplo-local-gitignore.test.js.map +0 -1
  228. package/dist/editor/e2e/editor.spec.d.ts +0 -2
  229. package/dist/editor/e2e/editor.spec.d.ts.map +0 -1
  230. package/dist/editor/e2e/editor.spec.js +0 -44
  231. package/dist/editor/e2e/editor.spec.js.map +0 -1
  232. package/dist/link/project-type.test.d.ts +0 -2
  233. package/dist/link/project-type.test.d.ts.map +0 -1
  234. package/dist/link/project-type.test.js +0 -225
  235. package/dist/link/project-type.test.js.map +0 -1
  236. package/dist/lint/resolve-binary.test.d.ts +0 -2
  237. package/dist/lint/resolve-binary.test.d.ts.map +0 -1
  238. package/dist/lint/resolve-binary.test.js +0 -155
  239. package/dist/lint/resolve-binary.test.js.map +0 -1
  240. package/dist/open-api/convert/handler.spec.d.ts +0 -2
  241. package/dist/open-api/convert/handler.spec.d.ts.map +0 -1
  242. package/dist/open-api/convert/handler.spec.js +0 -301
  243. package/dist/open-api/convert/handler.spec.js.map +0 -1
  244. package/dist/open-api/merge/handler.spec.d.ts +0 -2
  245. package/dist/open-api/merge/handler.spec.d.ts.map +0 -1
  246. package/dist/open-api/merge/handler.spec.js +0 -673
  247. package/dist/open-api/merge/handler.spec.js.map +0 -1
  248. package/dist/open-api/overlay/handler.spec.d.ts +0 -2
  249. package/dist/open-api/overlay/handler.spec.d.ts.map +0 -1
  250. package/dist/open-api/overlay/handler.spec.js +0 -346
  251. package/dist/open-api/overlay/handler.spec.js.map +0 -1
  252. package/dist/source/ai-gateway/files.test.d.ts +0 -2
  253. package/dist/source/ai-gateway/files.test.d.ts.map +0 -1
  254. package/dist/source/ai-gateway/files.test.js +0 -135
  255. package/dist/source/ai-gateway/files.test.js.map +0 -1
  256. package/dist/source/ai-gateway/handler.test.d.ts +0 -2
  257. package/dist/source/ai-gateway/handler.test.d.ts.map +0 -1
  258. package/dist/source/ai-gateway/handler.test.js +0 -113
  259. package/dist/source/ai-gateway/handler.test.js.map +0 -1
  260. package/dist/source/ai-gateway/package.test.d.ts +0 -2
  261. package/dist/source/ai-gateway/package.test.d.ts.map +0 -1
  262. package/dist/source/ai-gateway/package.test.js +0 -30
  263. package/dist/source/ai-gateway/package.test.js.map +0 -1
  264. package/dist/source/ai-gateway/planner.test.d.ts +0 -2
  265. package/dist/source/ai-gateway/planner.test.d.ts.map +0 -1
  266. package/dist/source/ai-gateway/planner.test.js +0 -330
  267. package/dist/source/ai-gateway/planner.test.js.map +0 -1
  268. package/dist/source/ai-gateway/release.test.d.ts +0 -2
  269. package/dist/source/ai-gateway/release.test.d.ts.map +0 -1
  270. package/dist/source/ai-gateway/release.test.js +0 -62
  271. package/dist/source/ai-gateway/release.test.js.map +0 -1
  272. package/dist/test/invoke-test.test.d.ts +0 -2
  273. package/dist/test/invoke-test.test.d.ts.map +0 -1
  274. package/dist/test/invoke-test.test.js +0 -150
  275. package/dist/test/invoke-test.test.js.map +0 -1
  276. package/dist/test/test-files.test.d.ts +0 -2
  277. package/dist/test/test-files.test.d.ts.map +0 -1
  278. package/dist/test/test-files.test.js +0 -57
  279. package/dist/test/test-files.test.js.map +0 -1
  280. package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.d.ts +0 -2
  281. package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.d.ts.map +0 -1
  282. package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.js +0 -289
  283. package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.js.map +0 -1
  284. package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.d.ts +0 -2
  285. package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.d.ts.map +0 -1
  286. package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.js +0 -181
  287. package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.js.map +0 -1
  288. package/node_modules/@zuplo/openapi-tools/dist/merge.spec.d.ts +0 -2
  289. package/node_modules/@zuplo/openapi-tools/dist/merge.spec.d.ts.map +0 -1
  290. package/node_modules/@zuplo/openapi-tools/dist/merge.spec.js +0 -399
  291. package/node_modules/@zuplo/openapi-tools/dist/merge.spec.js.map +0 -1
  292. package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.d.ts +0 -2
  293. package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.d.ts.map +0 -1
  294. package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.js +0 -779
  295. package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.js.map +0 -1
  296. package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.d.ts +0 -2
  297. package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.d.ts.map +0 -1
  298. package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.js +0 -269
  299. package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.js.map +0 -1
  300. package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.d.ts +0 -2
  301. package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.d.ts.map +0 -1
  302. package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.js +0 -93
  303. package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.js.map +0 -1
  304. package/node_modules/@zuplo/runtime/out/esm/chunk-6YPRGG62.js.map +0 -1
  305. package/node_modules/@zuplo/runtime/out/esm/chunk-PBDT4FDO.js +0 -37
  306. package/node_modules/@zuplo/runtime/out/esm/chunk-PBDT4FDO.js.map +0 -1
  307. /package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ2BHVUH.js.map → chunk-CDEAY3VY.js.map} +0 -0
  308. /package/node_modules/@zuplo/runtime/out/esm/{chunk-PBDT4FDO.js.LEGAL.txt → chunk-LVSZ3WTO.js.LEGAL.txt} +0 -0
  309. /package/node_modules/@zuplo/runtime/out/esm/{chunk-VTO3F6DK.js.map → chunk-NUVXDVLJ.js.map} +0 -0
  310. /package/node_modules/@zuplo/runtime/out/esm/{chunk-6YPRGG62.js.LEGAL.txt → chunk-RHU3Z7DA.js.LEGAL.txt} +0 -0
@@ -1,779 +0,0 @@
1
- import assert from "node:assert";
2
- import { describe, it } from "node:test";
3
- import { applyAction, applyOverlay, checkCondition, deepClone, deepMerge, extractPathOrder, reorderOperationProperties, setValueAtPath, } from "./overlay.js";
4
- describe("OpenAPI Overlay Engine", () => {
5
- describe("deepClone", () => {
6
- it("should deep clone an object", () => {
7
- const original = { a: 1, b: { c: 2 } };
8
- const cloned = deepClone(original);
9
- assert.deepStrictEqual(cloned, original);
10
- assert.notStrictEqual(cloned, original);
11
- assert.notStrictEqual(cloned.b, original.b);
12
- });
13
- it("should deep clone an array", () => {
14
- const original = [1, 2, { a: 3 }];
15
- const cloned = deepClone(original);
16
- assert.deepStrictEqual(cloned, original);
17
- assert.notStrictEqual(cloned, original);
18
- assert.notStrictEqual(cloned[2], original[2]);
19
- });
20
- });
21
- describe("deepMerge", () => {
22
- it("should merge two objects", () => {
23
- const target = { a: 1, b: 2 };
24
- const source = { b: 3, c: 4 };
25
- const result = deepMerge(target, source);
26
- assert.deepStrictEqual(result, { a: 1, b: 3, c: 4 });
27
- });
28
- it("should merge nested objects", () => {
29
- const target = { a: { b: 1, c: 2 } };
30
- const source = { a: { c: 3, d: 4 } };
31
- const result = deepMerge(target, source);
32
- assert.deepStrictEqual(result, { a: { b: 1, c: 3, d: 4 } });
33
- });
34
- it("should concatenate arrays by default", () => {
35
- const target = { arr: [1, 2] };
36
- const source = { arr: [3, 4] };
37
- const result = deepMerge(target, source);
38
- assert.deepStrictEqual(result, { arr: [1, 2, 3, 4] });
39
- });
40
- it("should merge OpenAPI parameters by name and in", () => {
41
- const target = {
42
- parameters: [
43
- { name: "id", in: "path", required: true },
44
- { name: "filter", in: "query" },
45
- ],
46
- };
47
- const source = {
48
- parameters: [
49
- { name: "id", in: "path", description: "The ID" },
50
- { name: "sort", in: "query" },
51
- ],
52
- };
53
- const result = deepMerge(target, source);
54
- assert.deepStrictEqual(result, {
55
- parameters: [
56
- { name: "id", in: "path", required: true, description: "The ID" },
57
- { name: "filter", in: "query" },
58
- { name: "sort", in: "query" },
59
- ],
60
- });
61
- });
62
- it("should replace target with source if types differ", () => {
63
- const target = { a: [1, 2] };
64
- const source = { a: "string" };
65
- const result = deepMerge(target, source);
66
- assert.deepStrictEqual(result, { a: "string" });
67
- });
68
- });
69
- describe("checkCondition", () => {
70
- it("should return true for empty object when empty condition is true", () => {
71
- assert.strictEqual(checkCondition({}, { empty: true }), true);
72
- });
73
- it("should return false for non-empty object when empty condition is true", () => {
74
- assert.strictEqual(checkCondition({ a: 1 }, { empty: true }), false);
75
- });
76
- it("should return true for empty array when empty condition is true", () => {
77
- assert.strictEqual(checkCondition([], { empty: true }), true);
78
- });
79
- it("should return false for non-empty array when empty condition is true", () => {
80
- assert.strictEqual(checkCondition([1], { empty: true }), false);
81
- });
82
- it("should return true when property is missing", () => {
83
- const obj = { a: { b: 1 } };
84
- assert.strictEqual(checkCondition(obj, { missing: "a.c" }), true);
85
- });
86
- it("should return false when property exists", () => {
87
- const obj = { a: { b: 1 } };
88
- assert.strictEqual(checkCondition(obj, { missing: "a.b" }), false);
89
- });
90
- });
91
- describe("setValueAtPath", () => {
92
- it("should set value at simple path", () => {
93
- const doc = {};
94
- setValueAtPath(doc, "$.info.title", "My API");
95
- assert.deepStrictEqual(doc, { info: { title: "My API" } });
96
- });
97
- it("should set value at bracket notation path", () => {
98
- const doc = {};
99
- setValueAtPath(doc, "$.paths['/users'].get", { summary: "Get users" });
100
- assert.deepStrictEqual(doc, {
101
- paths: { "/users": { get: { summary: "Get users" } } },
102
- });
103
- });
104
- it("should create nested paths as needed", () => {
105
- const doc = {};
106
- setValueAtPath(doc, "$.a.b.c.d", "value");
107
- assert.deepStrictEqual(doc, { a: { b: { c: { d: "value" } } } });
108
- });
109
- it("should handle double-quoted bracket notation", () => {
110
- const doc = {};
111
- setValueAtPath(doc, '$.paths["/users"].get', { summary: "Get users" });
112
- assert.deepStrictEqual(doc, {
113
- paths: { "/users": { get: { summary: "Get users" } } },
114
- });
115
- });
116
- it("should handle unquoted bracket notation", () => {
117
- const doc = {};
118
- setValueAtPath(doc, "$.paths[users].get", { summary: "Get users" });
119
- assert.deepStrictEqual(doc, {
120
- paths: { users: { get: { summary: "Get users" } } },
121
- });
122
- });
123
- it("should handle numeric indices", () => {
124
- const doc = { items: [{}, {}] };
125
- setValueAtPath(doc, "$.items[0].name", "First Item");
126
- const item = doc.items[0];
127
- assert.strictEqual(item.name, "First Item");
128
- });
129
- it("should handle mixed dot and bracket notation", () => {
130
- const doc = {};
131
- setValueAtPath(doc, "$.components.schemas['User'].properties.id", {
132
- type: "string",
133
- });
134
- assert.deepStrictEqual(doc, {
135
- components: {
136
- schemas: {
137
- User: {
138
- properties: {
139
- id: { type: "string" },
140
- },
141
- },
142
- },
143
- },
144
- });
145
- });
146
- });
147
- describe("applyAction - update operations", () => {
148
- it("should update root level properties", () => {
149
- const doc = { info: { title: "Old Title" } };
150
- const action = {
151
- target: "$",
152
- update: { info: { version: "1.0.0" } },
153
- };
154
- const result = applyAction(doc, action);
155
- assert.strictEqual(result.applied, true);
156
- assert.strictEqual(result.count, 1);
157
- assert.deepStrictEqual(doc.info, {
158
- title: "Old Title",
159
- version: "1.0.0",
160
- });
161
- });
162
- it("should update existing nested property", () => {
163
- const doc = {
164
- paths: {
165
- "/users": {
166
- get: { summary: "Old summary" },
167
- },
168
- },
169
- };
170
- const action = {
171
- target: "$.paths['/users'].get",
172
- update: { summary: "New summary", description: "Get all users" },
173
- };
174
- const result = applyAction(doc, action);
175
- assert.strictEqual(result.applied, true);
176
- assert.strictEqual(result.count, 1);
177
- const getOperation = doc.paths["/users"].get;
178
- assert.strictEqual(getOperation.summary, "New summary");
179
- assert.strictEqual(getOperation.description, "Get all users");
180
- });
181
- it("should create new property if it doesn't exist", () => {
182
- const doc = { paths: {} };
183
- const action = {
184
- target: "$.paths['/users']",
185
- update: { get: { summary: "Get users" } },
186
- };
187
- const result = applyAction(doc, action);
188
- assert.strictEqual(result.applied, true);
189
- assert.strictEqual(result.count, 1);
190
- const paths = doc.paths;
191
- assert.deepStrictEqual(paths["/users"], {
192
- get: { summary: "Get users" },
193
- });
194
- });
195
- it("should update multiple nodes with wildcard", () => {
196
- const doc = {
197
- paths: {
198
- "/users": { get: { tags: [] } },
199
- "/posts": { get: { tags: [] } },
200
- },
201
- };
202
- const action = {
203
- target: "$.paths.*.get",
204
- update: { tags: ["public"] },
205
- };
206
- const result = applyAction(doc, action);
207
- assert.strictEqual(result.applied, true);
208
- assert.strictEqual(result.count, 2);
209
- assert.deepStrictEqual(doc.paths["/users"].get.tags, ["public"]);
210
- assert.deepStrictEqual(doc.paths["/posts"].get.tags, ["public"]);
211
- });
212
- it("should not create a bogus '*' path when a wildcard update matches nothing", () => {
213
- const doc = {
214
- paths: {
215
- "/users": { post: {} },
216
- },
217
- };
218
- const action = {
219
- target: "$.paths.*.get",
220
- update: { tags: ["public"] },
221
- };
222
- const result = applyAction(doc, action);
223
- // No method matched, so there is nothing to update and nothing to create.
224
- assert.strictEqual(result.applied, false);
225
- assert.strictEqual(result.count, 0);
226
- assert.deepStrictEqual(Object.keys(doc.paths), ["/users"]);
227
- assert.strictEqual("*" in doc.paths, false);
228
- });
229
- it("should not create a bogus '*' path for a leaf dot-wildcard update with no matches", () => {
230
- const doc = {
231
- paths: {
232
- "/users": {},
233
- },
234
- };
235
- const action = {
236
- target: "$.paths['/users'].*",
237
- update: { tags: ["public"] },
238
- };
239
- const result = applyAction(doc, action);
240
- assert.strictEqual(result.applied, false);
241
- assert.strictEqual(result.count, 0);
242
- assert.deepStrictEqual(doc.paths["/users"], {});
243
- });
244
- it("should still create a concrete path that does not yet exist", () => {
245
- const doc = { paths: {} };
246
- const action = {
247
- target: "$.paths['/orders'].get",
248
- update: { summary: "List orders" },
249
- };
250
- const result = applyAction(doc, action);
251
- assert.strictEqual(result.applied, true);
252
- assert.strictEqual(result.count, 1);
253
- const paths = doc.paths;
254
- assert.deepStrictEqual(paths["/orders"], {
255
- get: { summary: "List orders" },
256
- });
257
- });
258
- });
259
- describe("applyAction - remove operations", () => {
260
- it("should remove a property from object", () => {
261
- const doc = {
262
- paths: {
263
- "/users": { get: {}, delete: {} },
264
- },
265
- };
266
- const action = {
267
- target: "$.paths['/users'].delete",
268
- remove: true,
269
- };
270
- const result = applyAction(doc, action);
271
- assert.strictEqual(result.applied, true);
272
- assert.strictEqual(result.count, 1);
273
- assert.strictEqual("delete" in doc.paths["/users"], false);
274
- assert.ok("get" in doc.paths["/users"]);
275
- });
276
- it("should remove multiple properties with wildcard", () => {
277
- const doc = {
278
- paths: {
279
- "/users": { get: {}, delete: {} },
280
- "/posts": { get: {}, delete: {} },
281
- },
282
- };
283
- const action = {
284
- target: "$.paths.*.delete",
285
- remove: true,
286
- };
287
- const result = applyAction(doc, action);
288
- assert.strictEqual(result.applied, true);
289
- assert.strictEqual(result.count, 2);
290
- assert.strictEqual("delete" in doc.paths["/users"], false);
291
- assert.strictEqual("delete" in doc.paths["/posts"], false);
292
- });
293
- it("should conditionally remove empty objects", () => {
294
- const doc = {
295
- paths: {
296
- "/users": { get: {} },
297
- "/posts": {},
298
- "/comments": { get: {} },
299
- },
300
- };
301
- const action = {
302
- target: "$.paths.*",
303
- remove: { empty: true },
304
- };
305
- const result = applyAction(doc, action);
306
- assert.strictEqual(result.applied, true);
307
- assert.strictEqual(result.count, 1);
308
- assert.ok("/users" in doc.paths);
309
- assert.strictEqual("/posts" in doc.paths, false);
310
- assert.ok("/comments" in doc.paths);
311
- });
312
- it("should conditionally remove when property is missing", () => {
313
- const doc = {
314
- paths: {
315
- "/users": { get: { "x-internal": true } },
316
- "/posts": { get: {} },
317
- },
318
- };
319
- const action = {
320
- target: "$.paths.*",
321
- remove: { missing: "get.x-internal" },
322
- };
323
- const result = applyAction(doc, action);
324
- assert.strictEqual(result.applied, true);
325
- assert.strictEqual(result.count, 1);
326
- assert.ok("/users" in doc.paths);
327
- assert.strictEqual("/posts" in doc.paths, false);
328
- });
329
- it("should return false if target not found", () => {
330
- const doc = { paths: {} };
331
- const action = {
332
- target: "$.paths['/users']",
333
- remove: true,
334
- };
335
- const result = applyAction(doc, action);
336
- assert.strictEqual(result.applied, false);
337
- assert.strictEqual(result.count, 0);
338
- });
339
- });
340
- describe("extractPathOrder", () => {
341
- it("should extract path order from overlay actions", () => {
342
- const overlay = {
343
- overlay: "1.0.0",
344
- info: { title: "Test", version: "1.0.0" },
345
- actions: [
346
- { target: "$.paths['/users'].get", update: {} },
347
- { target: "$.paths['/posts'].get", update: {} },
348
- { target: "$.paths['/users'].post", update: {} },
349
- { target: "$.info", update: {} },
350
- ],
351
- };
352
- const order = extractPathOrder(overlay);
353
- assert.deepStrictEqual(order, ["/users", "/posts"]);
354
- });
355
- it("should return empty array if no path actions", () => {
356
- const overlay = {
357
- overlay: "1.0.0",
358
- info: { title: "Test", version: "1.0.0" },
359
- actions: [{ target: "$.info", update: {} }],
360
- };
361
- const order = extractPathOrder(overlay);
362
- assert.deepStrictEqual(order, []);
363
- });
364
- });
365
- describe("reorderOperationProperties", () => {
366
- it("should reorder operation properties with priority keys first", () => {
367
- const operation = {
368
- responses: {},
369
- parameters: [],
370
- operationId: "getUsers",
371
- description: "Get all users",
372
- summary: "Get users",
373
- };
374
- const result = reorderOperationProperties(operation);
375
- const keys = Object.keys(result);
376
- assert.strictEqual(keys[0], "summary");
377
- assert.strictEqual(keys[1], "description");
378
- assert.strictEqual(keys[2], "operationId");
379
- assert.strictEqual(keys[3], "responses");
380
- assert.strictEqual(keys[4], "parameters");
381
- });
382
- it("should handle missing priority keys", () => {
383
- const operation = {
384
- responses: {},
385
- operationId: "getUsers",
386
- };
387
- const result = reorderOperationProperties(operation);
388
- const keys = Object.keys(result);
389
- assert.strictEqual(keys[0], "operationId");
390
- assert.strictEqual(keys[1], "responses");
391
- });
392
- });
393
- describe("applyOverlay - full integration", () => {
394
- it("should apply a dot-wildcard remove regardless of action order", () => {
395
- // Regression: a wildcard update that matched nothing used to create a
396
- // bogus '*' path, and jsonpath-plus then resolves `$.paths.*` to that
397
- // literal '*' key instead of the real paths — so a later dot-wildcard
398
- // remove silently matched nothing. The remove only worked if emitted
399
- // before the update. It must now work in either order.
400
- const openapi = {
401
- openapi: "3.1.0",
402
- info: { title: "API", version: "1.0.0" },
403
- paths: {
404
- "/users": { delete: {} },
405
- "/posts": { delete: {} },
406
- },
407
- };
408
- // Naive (update-first) ordering: the wildcard `get` update matches no
409
- // method in the source document.
410
- const overlay = {
411
- overlay: "1.0.0",
412
- info: { title: "Overlay", version: "1.0.0" },
413
- actions: [
414
- { target: "$.paths.*.get", update: { tags: ["public"] } },
415
- { target: "$.paths.*.delete", remove: true },
416
- ],
417
- };
418
- const { result, stats } = applyOverlay(openapi, overlay);
419
- const paths = result.paths;
420
- // No bogus '*' path was created by the unmatched wildcard update...
421
- assert.strictEqual("*" in paths, false);
422
- assert.deepStrictEqual(Object.keys(paths), ["/users", "/posts"]);
423
- // ...so the dot-wildcard remove still matched and stripped every delete.
424
- assert.strictEqual("delete" in paths["/users"], false);
425
- assert.strictEqual("delete" in paths["/posts"], false);
426
- // The unmatched update is a no-op (skipped); the remove applied.
427
- assert.strictEqual(stats.applied, 1);
428
- assert.strictEqual(stats.skipped, 1);
429
- });
430
- it("should apply a complete overlay document", () => {
431
- const openapi = {
432
- openapi: "3.1.0",
433
- info: {
434
- title: "Original API",
435
- version: "1.0.0",
436
- },
437
- paths: {
438
- "/users": {
439
- get: {
440
- summary: "Get users",
441
- },
442
- },
443
- },
444
- };
445
- const overlay = {
446
- overlay: "1.0.0",
447
- info: {
448
- title: "My Overlay",
449
- version: "1.0.0",
450
- },
451
- actions: [
452
- {
453
- target: "$.info",
454
- description: "Update API info",
455
- update: {
456
- title: "Updated API",
457
- description: "An updated API",
458
- },
459
- },
460
- {
461
- target: "$.paths['/users'].get",
462
- description: "Add operation ID",
463
- update: {
464
- operationId: "getUsers",
465
- },
466
- },
467
- ],
468
- };
469
- const { result, stats } = applyOverlay(openapi, overlay);
470
- assert.strictEqual(stats.applied, 2);
471
- assert.strictEqual(stats.skipped, 0);
472
- assert.strictEqual(stats.totalNodes, 2);
473
- const info = result.info;
474
- assert.strictEqual(info.title, "Updated API");
475
- assert.strictEqual(info.description, "An updated API");
476
- assert.strictEqual(info.version, "1.0.0");
477
- const paths = result.paths;
478
- const usersPath = paths["/users"];
479
- const getOperation = usersPath.get;
480
- assert.strictEqual(getOperation.operationId, "getUsers");
481
- });
482
- it("should handle overlay with remove actions", () => {
483
- const openapi = {
484
- openapi: "3.1.0",
485
- info: { title: "API" },
486
- paths: {
487
- "/users": { get: {}, delete: {} },
488
- "/internal": { get: {} },
489
- },
490
- };
491
- const overlay = {
492
- overlay: "1.0.0",
493
- info: { title: "Overlay", version: "1.0.0" },
494
- actions: [
495
- {
496
- target: "$.paths.*.delete",
497
- description: "Remove all delete operations",
498
- remove: true,
499
- },
500
- {
501
- target: "$.paths['/internal']",
502
- description: "Remove internal path",
503
- remove: true,
504
- },
505
- ],
506
- };
507
- const { result, stats } = applyOverlay(openapi, overlay);
508
- assert.strictEqual(stats.applied, 2);
509
- assert.strictEqual(stats.totalNodes, 2);
510
- const paths = result.paths;
511
- const usersPath = paths["/users"];
512
- assert.strictEqual("delete" in usersPath, false);
513
- assert.strictEqual("/internal" in paths, false);
514
- assert.ok("/users" in paths);
515
- });
516
- it("should throw error for invalid overlay format", () => {
517
- const openapi = {
518
- openapi: "3.1.0",
519
- info: { title: "Test", version: "1.0.0" },
520
- };
521
- const invalidOverlay = {
522
- info: { title: "Invalid" },
523
- // Missing 'overlay' and 'actions'
524
- };
525
- assert.throws(() => applyOverlay(openapi, invalidOverlay), /Invalid OpenAPI Overlay document/);
526
- });
527
- it("should throw actionable error for overlay with invalid action", () => {
528
- const openapi = {
529
- openapi: "3.1.0",
530
- info: { title: "Test", version: "1.0.0" },
531
- };
532
- const invalidOverlay = {
533
- overlay: "1.0.0",
534
- info: { title: "Test", version: "1.0.0" },
535
- actions: [
536
- {
537
- target: "$.paths",
538
- // Missing both 'update' and 'remove' - invalid!
539
- },
540
- ],
541
- };
542
- let errorMessage = "";
543
- try {
544
- applyOverlay(openapi, invalidOverlay);
545
- }
546
- catch (error) {
547
- errorMessage = error.message;
548
- }
549
- assert.ok(errorMessage.includes("Action must specify exactly one of 'update' or 'remove'"), `Expected actionable error message, got: ${errorMessage}`);
550
- });
551
- it("should work with incomplete OpenAPI documents", () => {
552
- // The overlay tool should be lenient and work with imperfect OpenAPI files
553
- const incompleteOpenapi = {
554
- // Missing 'openapi' and 'info' - but that's OK!
555
- paths: {},
556
- };
557
- const overlay = {
558
- overlay: "1.0.0",
559
- info: { title: "Test", version: "1.0.0" },
560
- actions: [{ target: "$.paths", update: { "/test": { get: {} } } }],
561
- };
562
- // Should not throw - lenient validation
563
- const { result } = applyOverlay(incompleteOpenapi, overlay);
564
- // Should have applied the update
565
- const paths = result.paths;
566
- assert.ok("/test" in paths);
567
- });
568
- it("should reject completely invalid OpenAPI document (not an object)", () => {
569
- const notAnObject = "this is a string";
570
- const overlay = {
571
- overlay: "1.0.0",
572
- info: { title: "Test", version: "1.0.0" },
573
- actions: [{ target: "$.paths", update: { "/test": {} } }],
574
- };
575
- let errorMessage = "";
576
- try {
577
- applyOverlay(notAnObject, overlay);
578
- }
579
- catch (error) {
580
- errorMessage = error.message;
581
- }
582
- assert.ok(errorMessage.includes("must be a valid JSON or YAML object"), `Expected error about document not being an object, got: ${errorMessage}`);
583
- });
584
- it("should reject empty actions array", () => {
585
- const openapi = {
586
- openapi: "3.1.0",
587
- info: { title: "API", version: "1.0.0" },
588
- };
589
- const invalidOverlay = {
590
- overlay: "1.0.0",
591
- info: { title: "Empty Overlay", version: "1.0.0" },
592
- actions: [],
593
- };
594
- let errorMessage = "";
595
- try {
596
- applyOverlay(openapi, invalidOverlay);
597
- }
598
- catch (error) {
599
- errorMessage = error.message;
600
- }
601
- assert.ok(errorMessage.includes("Overlay must contain at least one action"), `Expected validation error for empty actions, got: ${errorMessage}`);
602
- });
603
- it("should apply overlay with wildcards and conditions", () => {
604
- const openapi = {
605
- openapi: "3.1.0",
606
- paths: {
607
- "/users": {
608
- get: { "x-internal": true, tags: [] },
609
- post: { tags: [] },
610
- },
611
- "/posts": { get: { tags: [] } },
612
- "/internal": { get: { "x-internal": true, tags: [] } },
613
- },
614
- };
615
- const overlay = {
616
- overlay: "1.0.0",
617
- info: { title: "Conditional Overlay", version: "1.0.0" },
618
- actions: [
619
- {
620
- target: "$.paths.*.*.tags",
621
- description: "Add default tag",
622
- update: ["public"],
623
- },
624
- {
625
- target: "$.paths.*",
626
- description: "Remove paths without x-internal",
627
- remove: { missing: "get.x-internal" },
628
- },
629
- ],
630
- };
631
- const { result, stats } = applyOverlay(openapi, overlay);
632
- // First action should update all tags arrays (4 operations)
633
- // Second action should remove /posts (missing x-internal)
634
- assert.strictEqual(stats.applied, 2);
635
- const paths = result.paths;
636
- assert.ok("/users" in paths);
637
- assert.ok("/internal" in paths);
638
- assert.strictEqual("/posts" in paths, false);
639
- });
640
- it("should preserve document structure and order", () => {
641
- const openapi = {
642
- openapi: "3.1.0",
643
- info: { title: "API", version: "1.0.0" },
644
- servers: [{ url: "https://api.example.com" }],
645
- paths: {},
646
- };
647
- const overlay = {
648
- overlay: "1.0.0",
649
- info: { title: "Overlay", version: "1.0.0" },
650
- actions: [
651
- {
652
- target: "$.info",
653
- update: { description: "Added description" },
654
- },
655
- ],
656
- };
657
- const { result } = applyOverlay(openapi, overlay);
658
- const keys = Object.keys(result);
659
- assert.strictEqual(keys[0], "openapi");
660
- assert.strictEqual(keys[1], "info");
661
- // Priority keys come first: openapi, info, tags (if present)
662
- // Then other keys in original order
663
- assert.ok(keys.includes("servers"));
664
- assert.ok(keys.includes("paths"));
665
- const info = result.info;
666
- assert.strictEqual(info.description, "Added description");
667
- });
668
- });
669
- describe("Complex overlay scenarios", () => {
670
- it("should handle deep nested updates", () => {
671
- const openapi = {
672
- components: {
673
- schemas: {
674
- User: {
675
- type: "object",
676
- properties: {
677
- id: { type: "string" },
678
- },
679
- },
680
- },
681
- },
682
- };
683
- const overlay = {
684
- overlay: "1.0.0",
685
- info: { title: "Schema Overlay", version: "1.0.0" },
686
- actions: [
687
- {
688
- target: "$.components.schemas.User.properties",
689
- update: {
690
- name: { type: "string" },
691
- email: { type: "string", format: "email" },
692
- },
693
- },
694
- ],
695
- };
696
- const { result } = applyOverlay(openapi, overlay);
697
- const components = result.components;
698
- const schemas = components.schemas;
699
- const userSchema = schemas.User;
700
- const properties = userSchema.properties;
701
- assert.ok(properties.id);
702
- assert.ok(properties.name);
703
- assert.ok(properties.email);
704
- const emailProperty = properties.email;
705
- assert.strictEqual(emailProperty.format, "email");
706
- });
707
- it("should handle array element removal", () => {
708
- const openapi = {
709
- servers: [
710
- { url: "https://prod.example.com", description: "Production" },
711
- { url: "https://staging.example.com", description: "Staging" },
712
- { url: "https://dev.example.com", description: "Development" },
713
- ],
714
- };
715
- const overlay = {
716
- overlay: "1.0.0",
717
- info: { title: "Server Overlay", version: "1.0.0" },
718
- actions: [
719
- {
720
- target: "$.servers[?(@.description=='Development')]",
721
- remove: true,
722
- },
723
- ],
724
- };
725
- const { result } = applyOverlay(openapi, overlay);
726
- const servers = result.servers;
727
- assert.strictEqual(servers.length, 2);
728
- assert.strictEqual(servers[0].description, "Production");
729
- assert.strictEqual(servers[1].description, "Staging");
730
- });
731
- it("should handle parameter merging correctly", () => {
732
- const openapi = {
733
- paths: {
734
- "/users/{id}": {
735
- parameters: [
736
- { name: "id", in: "path", required: true },
737
- { name: "fields", in: "query" },
738
- ],
739
- get: {},
740
- },
741
- },
742
- };
743
- const overlay = {
744
- overlay: "1.0.0",
745
- info: { title: "Parameter Overlay", version: "1.0.0" },
746
- actions: [
747
- {
748
- target: "$.paths['/users/{id}'].parameters",
749
- update: [
750
- {
751
- name: "id",
752
- in: "path",
753
- description: "User ID",
754
- schema: { type: "string" },
755
- },
756
- { name: "include", in: "query", description: "Include related" },
757
- ],
758
- },
759
- ],
760
- };
761
- const { result } = applyOverlay(openapi, overlay);
762
- const paths = result.paths;
763
- const usersPath = paths["/users/{id}"];
764
- const params = usersPath.parameters;
765
- assert.strictEqual(params.length, 3);
766
- const idParam = params.find((p) => p.name === "id");
767
- assert.ok(idParam);
768
- assert.strictEqual(idParam.required, true);
769
- assert.strictEqual(idParam.description, "User ID");
770
- assert.deepStrictEqual(idParam.schema, { type: "string" });
771
- const fieldsParam = params.find((p) => p.name === "fields");
772
- assert.ok(fieldsParam);
773
- const includeParam = params.find((p) => p.name === "include");
774
- assert.ok(includeParam);
775
- assert.strictEqual(includeParam.description, "Include related");
776
- });
777
- });
778
- });
779
- //# sourceMappingURL=overlay.spec.js.map