@lovrabet/rabetbase-cli 2.5.13-beta.1 → 2.6.0-beta.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 (446) hide show
  1. package/README.md +42 -17
  2. package/lib/api/api-doc.js +3 -1
  3. package/lib/api/api-group.js +3 -1
  4. package/lib/api/fetch-model-list.js +1 -1
  5. package/lib/api/generate-api-file.js +8 -1
  6. package/lib/api/generate-sdk-config-file.js +1 -1
  7. package/lib/api/legacy-api-file.js +2 -1
  8. package/lib/api/model-registry-file.js +11 -1
  9. package/lib/api/model-registry-scaffold.js +2 -1
  10. package/lib/api/model-source.js +3 -1
  11. package/lib/auth/auth-server-ui.js +2 -1
  12. package/lib/auth/auth-server.js +5 -1
  13. package/lib/auth/constant.js +1 -1
  14. package/lib/auth/get-cookie.js +1 -1
  15. package/lib/auth/get-session-user.js +1 -1
  16. package/lib/auth/is-session-valid.js +1 -1
  17. package/lib/auth/login-success-html.js +3 -1
  18. package/lib/auth/logout.js +1 -1
  19. package/lib/cli-flags.js +1 -1
  20. package/lib/cli.js +5 -1
  21. package/lib/commands/api/generate.js +4 -1
  22. package/lib/commands/api/index.js +1 -1
  23. package/lib/commands/api/list.js +2 -1
  24. package/lib/commands/api/pull.js +10 -1
  25. package/lib/commands/api/shared.js +1 -1
  26. package/lib/commands/app/detail.js +1 -1
  27. package/lib/commands/app/index.js +1 -1
  28. package/lib/commands/app/list.js +5 -1
  29. package/lib/commands/app/members-list.js +1 -1
  30. package/lib/commands/app/remote-directory.js +1 -1
  31. package/lib/commands/app/shared.js +4 -1
  32. package/lib/commands/app-config/delete.js +2 -1
  33. package/lib/commands/app-config/get.js +2 -1
  34. package/lib/commands/app-config/index.js +1 -1
  35. package/lib/commands/app-config/list.js +2 -1
  36. package/lib/commands/app-config/set.js +3 -1
  37. package/lib/commands/app-config/shared.d.ts +9 -2
  38. package/lib/commands/app-config/shared.js +6 -1
  39. package/lib/commands/auth/index.js +1 -1
  40. package/lib/commands/bff/create.js +11 -1
  41. package/lib/commands/bff/delete.js +6 -1
  42. package/lib/commands/bff/detail.js +1 -1
  43. package/lib/commands/bff/index.js +1 -1
  44. package/lib/commands/bff/list.js +1 -1
  45. package/lib/commands/bff/logs.js +4 -1
  46. package/lib/commands/bff/pull.js +22 -1
  47. package/lib/commands/bff/push.js +16 -1
  48. package/lib/commands/bff/status.js +3 -1
  49. package/lib/commands/cli-skill/index.js +2 -1
  50. package/lib/commands/cli-update.js +7 -1
  51. package/lib/commands/codegen/index.js +1 -1
  52. package/lib/commands/codegen/sdk.js +1 -1
  53. package/lib/commands/codegen/sql.js +1 -1
  54. package/lib/commands/common/app-registry.js +4 -1
  55. package/lib/commands/common/app-selector.js +4 -1
  56. package/lib/commands/common/async-task.js +2 -1
  57. package/lib/commands/common/dry-run.js +1 -1
  58. package/lib/commands/common/flags.js +3 -1
  59. package/lib/commands/common/local-file.js +1 -1
  60. package/lib/commands/common/validate.js +1 -1
  61. package/lib/commands/config/delete.js +2 -1
  62. package/lib/commands/config/get.js +1 -1
  63. package/lib/commands/config/index.js +1 -1
  64. package/lib/commands/config/init.js +5 -1
  65. package/lib/commands/config/list.js +1 -1
  66. package/lib/commands/config/set.js +4 -1
  67. package/lib/commands/config/shared.js +2 -1
  68. package/lib/commands/dataset/batch-design.js +9 -1
  69. package/lib/commands/dataset/business-group-update.js +10 -1
  70. package/lib/commands/dataset/business-groups.js +1 -1
  71. package/lib/commands/dataset/capability.js +3 -1
  72. package/lib/commands/dataset/cross-relation-create.js +2 -1
  73. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  74. package/lib/commands/dataset/cross-relation-list.js +2 -1
  75. package/lib/commands/dataset/cross-relation-shared.js +10 -1
  76. package/lib/commands/dataset/cross-relation-update.js +2 -1
  77. package/lib/commands/dataset/delete.js +6 -1
  78. package/lib/commands/dataset/design-context.js +1 -1
  79. package/lib/commands/dataset/design-start.js +1 -1
  80. package/lib/commands/dataset/design-status.js +1 -1
  81. package/lib/commands/dataset/design-sync-retry.js +1 -1
  82. package/lib/commands/dataset/design-sync-status.js +1 -1
  83. package/lib/commands/dataset/design-validate.js +1 -1
  84. package/lib/commands/dataset/detail.js +5 -1
  85. package/lib/commands/dataset/extend-update.js +7 -1
  86. package/lib/commands/dataset/field-restore.js +7 -1
  87. package/lib/commands/dataset/field-update.js +7 -1
  88. package/lib/commands/dataset/generate.js +19 -1
  89. package/lib/commands/dataset/index.js +3 -1
  90. package/lib/commands/dataset/list.js +2 -1
  91. package/lib/commands/dataset/operations.js +2 -1
  92. package/lib/commands/dataset/relation-audit.js +7 -1
  93. package/lib/commands/dataset/relation-create.js +3 -1
  94. package/lib/commands/dataset/relation-delete.js +3 -1
  95. package/lib/commands/dataset/relation-shared.js +21 -1
  96. package/lib/commands/dataset/relation-update.js +4 -1
  97. package/lib/commands/dataset/relations.js +7 -1
  98. package/lib/commands/dataset/rename.js +4 -1
  99. package/lib/commands/dataset/restore.js +7 -1
  100. package/lib/commands/dataset/user-deleted-field-list.js +3 -1
  101. package/lib/commands/db/analysis-batching.js +3 -1
  102. package/lib/commands/db/analyze-batch-plan.js +2 -1
  103. package/lib/commands/db/analyze-cancel.js +1 -1
  104. package/lib/commands/db/analyze-start.js +3 -1
  105. package/lib/commands/db/analyze-status.js +6 -1
  106. package/lib/commands/db/create.js +4 -1
  107. package/lib/commands/db/cross-db-analysis-shared.js +3 -1
  108. package/lib/commands/db/cross-db-analyze-latest.js +1 -1
  109. package/lib/commands/db/cross-db-analyze-start.js +2 -1
  110. package/lib/commands/db/cross-db-analyze-status.js +1 -1
  111. package/lib/commands/db/delete.js +3 -1
  112. package/lib/commands/db/detail.js +1 -1
  113. package/lib/commands/db/diff-refresh-start.js +1 -1
  114. package/lib/commands/db/diff-refresh-status.js +2 -1
  115. package/lib/commands/db/diff.js +3 -1
  116. package/lib/commands/db/index.js +2 -1
  117. package/lib/commands/db/list.js +2 -1
  118. package/lib/commands/db/shared.js +3 -1
  119. package/lib/commands/db/table-diff-shared.js +2 -1
  120. package/lib/commands/db/tables.js +2 -1
  121. package/lib/commands/db/test.js +2 -1
  122. package/lib/commands/db/update.js +4 -1
  123. package/lib/commands/deployment/index.js +1 -1
  124. package/lib/commands/deployment/sync-all.js +3 -1
  125. package/lib/commands/deployment/sync-jobs.js +2 -1
  126. package/lib/commands/deployment/sync-status.js +2 -1
  127. package/lib/commands/doctor.js +12 -1
  128. package/lib/commands/file/index.js +3 -1
  129. package/lib/commands/flow/create.js +2 -1
  130. package/lib/commands/flow/detail.js +3 -1
  131. package/lib/commands/flow/index.js +1 -1
  132. package/lib/commands/flow/list.js +2 -1
  133. package/lib/commands/flow/page-list.js +2 -1
  134. package/lib/commands/flow/publish.js +2 -1
  135. package/lib/commands/flow/runtime-resources-shared.js +3 -1
  136. package/lib/commands/flow/runtime-role-list.js +2 -1
  137. package/lib/commands/flow/runtime-role-user-list.js +2 -1
  138. package/lib/commands/flow/runtime-user-search.js +2 -1
  139. package/lib/commands/flow/shared.js +6 -1
  140. package/lib/commands/flow/update.js +4 -1
  141. package/lib/commands/flow/validate.js +2 -1
  142. package/lib/commands/instant-api-policy/current.js +1 -1
  143. package/lib/commands/instant-api-policy/index.js +1 -1
  144. package/lib/commands/instant-api-policy/init.js +2 -1
  145. package/lib/commands/instant-api-policy/publish.js +5 -1
  146. package/lib/commands/instant-api-policy/pull.js +2 -1
  147. package/lib/commands/instant-api-policy/revision.js +1 -1
  148. package/lib/commands/instant-api-policy/revisions.js +1 -1
  149. package/lib/commands/instant-api-policy/rollback.js +5 -1
  150. package/lib/commands/instant-api-policy/shared.js +5 -1
  151. package/lib/commands/instant-api-policy/validate.js +1 -1
  152. package/lib/commands/issue/context.js +1 -1
  153. package/lib/commands/issue/index.js +1 -1
  154. package/lib/commands/issue/nudge.js +2 -1
  155. package/lib/commands/issue/report.js +5 -1
  156. package/lib/commands/kb/create.js +5 -1
  157. package/lib/commands/kb/delete.js +5 -1
  158. package/lib/commands/kb/detail.js +1 -1
  159. package/lib/commands/kb/import-api.d.ts +3 -0
  160. package/lib/commands/kb/import-api.js +1 -0
  161. package/lib/commands/kb/import-resume.d.ts +2 -0
  162. package/lib/commands/kb/import-resume.js +2 -0
  163. package/lib/commands/kb/import-shared.d.ts +69 -0
  164. package/lib/commands/kb/import-shared.js +9 -0
  165. package/lib/commands/kb/import-status.d.ts +2 -0
  166. package/lib/commands/kb/import-status.js +1 -0
  167. package/lib/commands/kb/import.d.ts +2 -0
  168. package/lib/commands/kb/import.js +3 -0
  169. package/lib/commands/kb/index.js +1 -1
  170. package/lib/commands/kb/list.js +1 -1
  171. package/lib/commands/kb/search.js +3 -1
  172. package/lib/commands/kb/shared.js +9 -1
  173. package/lib/commands/kb/update.js +7 -1
  174. package/lib/commands/logs/index.js +2 -1
  175. package/lib/commands/menu/asset-update.js +8 -1
  176. package/lib/commands/menu/delete.js +15 -1
  177. package/lib/commands/menu/external-link-create.js +16 -1
  178. package/lib/commands/menu/external-link-update.js +10 -1
  179. package/lib/commands/menu/group-create.js +8 -1
  180. package/lib/commands/menu/group-update.js +6 -1
  181. package/lib/commands/menu/index.js +2 -1
  182. package/lib/commands/menu/list.js +1 -1
  183. package/lib/commands/menu/move.js +6 -1
  184. package/lib/commands/menu/regroup-start.js +11 -1
  185. package/lib/commands/menu/rename.js +9 -1
  186. package/lib/commands/menu/shared/compare-table.js +2 -1
  187. package/lib/commands/menu/shared/delete-plan.js +13 -1
  188. package/lib/commands/menu/shared/facts.js +5 -1
  189. package/lib/commands/menu/shared/index.js +1 -1
  190. package/lib/commands/menu/shared/inquirer.js +4 -1
  191. package/lib/commands/menu/shared/local-pages.js +5 -1
  192. package/lib/commands/menu/shared/logic.js +3 -1
  193. package/lib/commands/menu/shared/mutations.js +9 -1
  194. package/lib/commands/menu/shared/path.js +1 -1
  195. package/lib/commands/menu/shared/service.js +4 -1
  196. package/lib/commands/menu/shared/subapp-assets.js +4 -1
  197. package/lib/commands/menu/shared/sync-core.js +7 -1
  198. package/lib/commands/menu/shared/types.js +1 -1
  199. package/lib/commands/menu/shared/update-core.js +8 -1
  200. package/lib/commands/menu/shared/valid-url.js +1 -1
  201. package/lib/commands/menu/subapp-assets-status.js +1 -1
  202. package/lib/commands/menu/subapp-assets-update.js +7 -1
  203. package/lib/commands/menu/sync.js +7 -1
  204. package/lib/commands/menu/visibility-update.js +13 -1
  205. package/lib/commands/metric/contract.d.ts +8 -0
  206. package/lib/commands/metric/contract.js +5 -0
  207. package/lib/commands/metric/definition.d.ts +43 -0
  208. package/lib/commands/metric/definition.js +4 -0
  209. package/lib/commands/metric/delete.d.ts +2 -0
  210. package/lib/commands/metric/delete.js +3 -0
  211. package/lib/commands/metric/detail.d.ts +2 -0
  212. package/lib/commands/metric/detail.js +1 -0
  213. package/lib/commands/metric/example.d.ts +2 -0
  214. package/lib/commands/metric/example.js +1 -0
  215. package/lib/commands/metric/index.d.ts +2 -0
  216. package/lib/commands/metric/index.js +1 -0
  217. package/lib/commands/metric/list.d.ts +2 -0
  218. package/lib/commands/metric/list.js +2 -0
  219. package/lib/commands/metric/publication-diff.d.ts +8 -0
  220. package/lib/commands/metric/publication-diff.js +1 -0
  221. package/lib/commands/metric/publish.d.ts +2 -0
  222. package/lib/commands/metric/publish.js +4 -0
  223. package/lib/commands/metric/schema.d.ts +2 -0
  224. package/lib/commands/metric/schema.js +1 -0
  225. package/lib/commands/metric/shared.d.ts +14 -0
  226. package/lib/commands/metric/shared.js +2 -0
  227. package/lib/commands/metric/validate.d.ts +2 -0
  228. package/lib/commands/metric/validate.js +1 -0
  229. package/lib/commands/notification/config-create.js +4 -1
  230. package/lib/commands/notification/config-delete.js +4 -1
  231. package/lib/commands/notification/config-list.js +2 -1
  232. package/lib/commands/notification/config-update.js +4 -1
  233. package/lib/commands/notification/index.js +1 -1
  234. package/lib/commands/notification/shared.js +18 -1
  235. package/lib/commands/ocr/index.js +4 -1
  236. package/lib/commands/page/create.js +6 -1
  237. package/lib/commands/page/custom/detail.js +2 -1
  238. package/lib/commands/page/custom/list.js +2 -1
  239. package/lib/commands/page/custom/publish.js +3 -1
  240. package/lib/commands/page/custom/shared.js +3 -1
  241. package/lib/commands/page/custom/syntax.js +2 -1
  242. package/lib/commands/page/custom/update.js +3 -1
  243. package/lib/commands/page/data-list-status.js +2 -1
  244. package/lib/commands/page/generate-start.js +5 -1
  245. package/lib/commands/page/generate-status.js +4 -1
  246. package/lib/commands/page/index.js +2 -1
  247. package/lib/commands/page/pull.js +6 -1
  248. package/lib/commands/page/push.js +11 -1
  249. package/lib/commands/page/relation-audit.js +15 -1
  250. package/lib/commands/page/restore.js +5 -1
  251. package/lib/commands/page/shared.js +16 -1
  252. package/lib/commands/page/sync.js +2 -1
  253. package/lib/commands/project/api-architecture-upgrade.js +11 -1
  254. package/lib/commands/project/create/enhanced-guided-create.js +2 -1
  255. package/lib/commands/project/create/format-elapsed.js +1 -1
  256. package/lib/commands/project/create/main.js +13 -1
  257. package/lib/commands/project/create/materialize-project-template.js +12 -1
  258. package/lib/commands/project/create/project-name.js +1 -1
  259. package/lib/commands/project/create/project-template-archive.js +5 -1
  260. package/lib/commands/project/create/project-template-path.js +1 -1
  261. package/lib/commands/project/create/use-copy-project-template.js +2 -1
  262. package/lib/commands/project/create/use-format-code.js +1 -1
  263. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  264. package/lib/commands/project/domain-routing-sync.js +1 -1
  265. package/lib/commands/project/index.js +4 -1
  266. package/lib/commands/project/upgrade.js +7 -1
  267. package/lib/commands/registry.js +10 -1
  268. package/lib/commands/role/delete.js +2 -1
  269. package/lib/commands/role/detail.js +1 -1
  270. package/lib/commands/role/index.js +1 -1
  271. package/lib/commands/role/list.js +2 -1
  272. package/lib/commands/role/shared.js +8 -1
  273. package/lib/commands/role/update.js +3 -1
  274. package/lib/commands/role/user-add.js +2 -1
  275. package/lib/commands/role/user-remove.js +2 -1
  276. package/lib/commands/role/user-resolve.js +1 -1
  277. package/lib/commands/rule/get.js +1 -1
  278. package/lib/commands/rule/index.js +1 -1
  279. package/lib/commands/rule/list.js +1 -1
  280. package/lib/commands/rule/set.js +7 -1
  281. package/lib/commands/rule/shared.js +4 -1
  282. package/lib/commands/run/index.js +5 -1
  283. package/lib/commands/schema.js +1 -1
  284. package/lib/commands/sql/create.js +7 -1
  285. package/lib/commands/sql/delete.js +4 -1
  286. package/lib/commands/sql/detail.js +1 -1
  287. package/lib/commands/sql/exec.js +1 -1
  288. package/lib/commands/sql/index.js +1 -1
  289. package/lib/commands/sql/list.js +2 -1
  290. package/lib/commands/sql/pull.js +10 -1
  291. package/lib/commands/sql/push.js +9 -1
  292. package/lib/commands/sql/shared.js +5 -1
  293. package/lib/commands/sql/status.js +3 -1
  294. package/lib/commands/sql/validate.js +5 -1
  295. package/lib/commands/task/index.js +1 -1
  296. package/lib/commands/task/status.js +2 -1
  297. package/lib/commands/tenant/index.js +1 -1
  298. package/lib/commands/tenant/members-list.js +2 -1
  299. package/lib/commands/tenant/shared.js +2 -1
  300. package/lib/commands/user-account/dingding-sandbox-bind.js +2 -1
  301. package/lib/commands/user-account/feishu-bind.js +2 -1
  302. package/lib/commands/user-account/index.js +1 -1
  303. package/lib/commands/workspace/add.js +1 -1
  304. package/lib/commands/workspace/index.js +7 -1
  305. package/lib/commands/workspace/remove.js +1 -1
  306. package/lib/config/domain-config.js +8 -1
  307. package/lib/config/project-domain-routing.js +3 -1
  308. package/lib/config/region-config.js +2 -1
  309. package/lib/config/schema.js +7 -1
  310. package/lib/constant/cdn.js +2 -1
  311. package/lib/constant/cli.js +8 -1
  312. package/lib/constant/defaults.js +1 -1
  313. package/lib/constant/domain.js +4 -1
  314. package/lib/constant/env.js +1 -1
  315. package/lib/constant/output.js +1 -1
  316. package/lib/constant/paths.js +1 -1
  317. package/lib/constant/region.js +1 -1
  318. package/lib/constant/risk.js +1 -1
  319. package/lib/constant/routing-profile.js +1 -1
  320. package/lib/context/app-resolver.js +7 -1
  321. package/lib/context/auth-resolver.js +1 -1
  322. package/lib/context/config-loader.js +7 -1
  323. package/lib/context.js +9 -1
  324. package/lib/core/alias-resolver.js +5 -1
  325. package/lib/core/api-client.d.ts +14 -7
  326. package/lib/core/api-client.js +69 -1
  327. package/lib/core/bff/config.js +1 -1
  328. package/lib/core/bff/file-system.js +6 -1
  329. package/lib/core/bff/hash.js +1 -1
  330. package/lib/core/bff/hook-directory.js +9 -1
  331. package/lib/core/bff/lock.js +2 -1
  332. package/lib/core/bff/types.js +1 -1
  333. package/lib/core/bff/utils.js +3 -1
  334. package/lib/core/cross-db-analysis.js +1 -1
  335. package/lib/core/cross-db-relation.js +1 -1
  336. package/lib/core/db-resolver.js +2 -1
  337. package/lib/core/flow-config.js +49 -1
  338. package/lib/core/instant-api-policy/config.js +7 -1
  339. package/lib/core/instant-api-policy/endpoints.js +1 -1
  340. package/lib/core/kb-management-client.d.ts +11 -0
  341. package/lib/core/kb-management-client.js +4 -1
  342. package/lib/core/kb-search-client.js +3 -1
  343. package/lib/core/page/file-system.js +2 -1
  344. package/lib/core/page/hash.js +1 -1
  345. package/lib/core/page/lock.js +2 -1
  346. package/lib/core/page/lr-smart-jsx.js +4 -1
  347. package/lib/core/page/types.js +1 -1
  348. package/lib/core/sql-index-auditor.js +14 -1
  349. package/lib/core/sql-sync/config.js +1 -1
  350. package/lib/core/sql-sync/file-system.js +3 -1
  351. package/lib/core/sql-sync/hash.js +1 -1
  352. package/lib/core/sql-sync/lock.js +2 -1
  353. package/lib/core/sql-sync/types.js +1 -1
  354. package/lib/core/sql-sync/utils.js +2 -1
  355. package/lib/core/sql-validator.js +15 -1
  356. package/lib/errors.js +3 -1
  357. package/lib/framework/build-all-flags.js +1 -1
  358. package/lib/framework/error-output.js +1 -1
  359. package/lib/framework/explicit-yes.js +1 -1
  360. package/lib/framework/flags.js +1 -1
  361. package/lib/framework/help.js +2 -1
  362. package/lib/framework/index.js +1 -1
  363. package/lib/framework/output.js +2 -1
  364. package/lib/framework/response.js +1 -1
  365. package/lib/framework/runner-alias.js +2 -1
  366. package/lib/framework/runner.js +9 -1
  367. package/lib/framework/schema-export.js +1 -1
  368. package/lib/framework/supported-flags.js +2 -1
  369. package/lib/framework/types.js +1 -1
  370. package/lib/generated/build-info.d.ts +4 -4
  371. package/lib/generated/build-info.js +1 -1
  372. package/lib/generated/official-routing.js +3 -1
  373. package/lib/generated/routing-contract.js +1 -1
  374. package/lib/help.js +1 -1
  375. package/lib/runtime/confirmation.js +2 -1
  376. package/lib/runtime/event.js +1 -1
  377. package/lib/runtime/index.js +4 -1
  378. package/lib/runtime/queue.js +1 -1
  379. package/lib/runtime/resolve.js +2 -1
  380. package/lib/runtime/types.js +1 -1
  381. package/lib/services/dataset-design/checkpoint.js +2 -1
  382. package/lib/services/dataset-design/commands.js +14 -1
  383. package/lib/services/dataset-design/contract.js +8 -1
  384. package/lib/skills/builtin-skill.js +8 -1
  385. package/lib/skills/install-updated-skill.d.ts +8 -0
  386. package/lib/skills/install-updated-skill.js +3 -0
  387. package/lib/skills/local-skills-installer.d.ts +2 -0
  388. package/lib/skills/local-skills-installer.js +1 -0
  389. package/lib/skills/main.js +2 -1
  390. package/lib/skills/npx-skills-add.d.ts +6 -6
  391. package/lib/skills/npx-skills-add.js +5 -1
  392. package/lib/skills/skill-presence.d.ts +1 -30
  393. package/lib/skills/skill-presence.js +2 -1
  394. package/lib/telemetry/cli-command-trace.js +2 -1
  395. package/lib/telemetry/cli-help-trace.js +1 -1
  396. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  397. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  398. package/lib/telemetry/send-cli-trace-log.js +1 -1
  399. package/lib/types/index.js +1 -1
  400. package/lib/utils/ai_config.js +3 -1
  401. package/lib/utils/apply-jq-filter.js +1 -1
  402. package/lib/utils/cdn-config.js +1 -1
  403. package/lib/utils/check-sdk-version.js +5 -1
  404. package/lib/utils/cli-version-check.js +4 -1
  405. package/lib/utils/cli-version-policy.js +3 -1
  406. package/lib/utils/config.js +1 -1
  407. package/lib/utils/entity-with-id.js +1 -1
  408. package/lib/utils/file-utils.js +1 -1
  409. package/lib/utils/guides-cdn.js +3 -1
  410. package/lib/utils/http-client.js +2 -1
  411. package/lib/utils/is-non-interactive.js +1 -1
  412. package/lib/utils/logger.js +3 -1
  413. package/lib/utils/params.js +1 -1
  414. package/lib/utils/platform.js +1 -1
  415. package/lib/utils/sleep.js +1 -1
  416. package/lib/utils/template-replacer.js +5 -1
  417. package/lib/utils/update-notice.js +3 -1
  418. package/lib/utils/version.js +1 -1
  419. package/lib/utils/with-active-cookie.js +1 -1
  420. package/lib/utils/write-cli-side-channel.js +1 -1
  421. package/package.json +10 -7
  422. package/skills/rabetbase/SKILL.md +11 -7
  423. package/skills/rabetbase/guides/backend-function.md +3 -1
  424. package/skills/rabetbase/guides/data-api-guidelines.md +1 -1
  425. package/skills/rabetbase/guides/frontend-development.md +1 -0
  426. package/skills/rabetbase/guides/metric-development.md +185 -0
  427. package/skills/rabetbase/references/rabetbase-app-config.md +4 -3
  428. package/skills/rabetbase/references/rabetbase-cli-skill-install.md +5 -5
  429. package/skills/rabetbase/references/rabetbase-dataset-design.md +1 -1
  430. package/skills/rabetbase/references/rabetbase-kb.md +16 -0
  431. package/skills/rabetbase/references/rabetbase-metric.md +119 -0
  432. package/skills/rabetbase/references/rabetbase-update.md +7 -5
  433. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  434. package/skills/rabetbase-dataset-generation/references/workflow.md +1 -1
  435. package/skills/rabetbase-metrics-generation/SKILL.md +22 -0
  436. package/skills/rabetbase-metrics-generation/references/verification.md +19 -0
  437. package/skills/rabetbase-metrics-generation/references/workflow.md +41 -0
  438. package/skills/rabetbase-metrics-generation/templates/statistics-delivery.md +11 -0
  439. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  440. package/skills/rabetbase-page-generation/references/generation.md +1 -1
  441. package/skills/rabetbase.manifest.json +5 -3
  442. package/templates/metrics/definition.json +78 -0
  443. package/templates/metrics/metric-definition.schema.json +136 -0
  444. package/lib/postinstall.d.ts +0 -3
  445. package/lib/postinstall.js +0 -1
  446. package/scripts/postinstall.mjs +0 -24
@@ -1 +1,7 @@
1
- const a190_0x359a6e=a190_0x3fc7;(function(_0x18a005,_0x42a257){const _0x4fc1f9=a190_0x3fc7,_0x540951=_0x18a005();while(!![]){try{const _0x4bf949=-parseInt(_0x4fc1f9(0x103))/0x1*(-parseInt(_0x4fc1f9(0x109))/0x2)+-parseInt(_0x4fc1f9(0xe1))/0x3*(-parseInt(_0x4fc1f9(0xf3))/0x4)+-parseInt(_0x4fc1f9(0xe3))/0x5*(-parseInt(_0x4fc1f9(0xde))/0x6)+-parseInt(_0x4fc1f9(0xeb))/0x7+-parseInt(_0x4fc1f9(0xd3))/0x8+-parseInt(_0x4fc1f9(0x107))/0x9+parseInt(_0x4fc1f9(0xea))/0xa;if(_0x4bf949===_0x42a257)break;else _0x540951['push'](_0x540951['shift']());}catch(_0x33a021){_0x540951['push'](_0x540951['shift']());}}}(a190_0xcec5,0x6b7c1));import a190_0x345067 from'chalk';import{buildCompareRows,doCreateMenus,fetchMenuData}from'../../commands/menu/shared/logic.js';import{renderCompareTable,renderSyncSummary}from'../../commands/menu/shared/compare-table.js';import{selectPages,askJsUrl,askCssUrl,askConfirm,startSpinner,stopSpinner,isInteractive,requireInteractive}from'../../commands/menu/shared/inquirer.js';import{CliErrors}from'../../errors.js';import{writeCliSideChannelLine}from'../../utils/write-cli-side-channel.js';function a190_0x3fc7(_0x4f5720,_0x3fca21){_0x4f5720=_0x4f5720-0xcd;const _0xcec5d4=a190_0xcec5();let _0x3fc7b7=_0xcec5d4[_0x4f5720];return _0x3fc7b7;}import{parseMenuSyncParams,resolvePage,runMenuSyncCore}from'../../commands/menu/shared/sync-core.js';import{getLocalPages}from'../../commands/menu/shared/local-pages.js';import{isInProject}from'../../context.js';function a190_0xcec5(){const _0x2f95d8=['\x20menu(s)\x20created','\x20\x20✓\x20Selected:\x20','cookie','cssUrl','Created\x20','POST','/smartapi/menu/create','\x20local\x20microfrontend\x20menu(s).','\x20failed.','map','1338mpvFvZ','paths','\x20created,\x20','11955FIZgik','flag','10655xmqsFz','jsUrl','\x20\x20!\x20No\x20local\x20pages\x20found,\x20please\x20create\x20pages\x20first','No\x20local\x20microfrontend\x20menus\x20would\x20be\x20created.','sync','created','JSON:\x20{\x22appName\x22:\x22store-app\x22,\x22parentId\x22:42,\x22visible\x22:false};\x20jsUrl\x20and\x20cssUrl\x20remain\x20available\x20for\x20individual\x20menu\x20resources.','45850wxcDuJ','5125211bssEVd','gray','write','Failed\x20to\x20fetch\x20online\x20menu\x20list','Online\x20menu\x20list\x20fetched','length','\x20menu(s)\x20bound\x20to\x20','skipped','732uKkczB','filter','\x20menu(s)\x20with\x20JS:\x20','Exact\x20comma-separated\x20local\x20page\x20paths\x20to\x20sync','\x20\x20Create\x20','Preview\x20with\x20--dry-run,\x20then\x20reuse\x20the\x20same\x20--paths\x20and\x20--params\x20with\x20--yes.','selectedAppName','params','menu\x20sync\x20requires\x20a\x20project\x20context\x20or\x20explicit\x20--appcode.\x20','appcode','boolean','Confirm\x20non-interactive\x20sync;\x20without\x20--paths,\x20create\x20all\x20missing\x20local\x20pages','appName','\x20\x20Continue\x20with\x20creation?','Tip:\x20For\x20frontend\x20subapps,\x20prefer\x20Agent-planned\x20menu\x20groups\x20and\x20shared\x20resources.\x20This\x20manual\x20sync\x20workflow\x20remains\x20available\x20as\x20a\x20fallback.','targetPages','271177EogglA','✓\x20All\x20local\x20pages\x20are\x20already\x20on\x20platform','str','message','1433331kweMYQ','Menu\x20sync\x20completed:\x20','2ZLMlRG','Fetching\x20online\x20menu\x20list...','yes','trim','Run\x20inside\x20a\x20directory\x20with\x20.rabetbase.json,\x20or\x20pass\x20--appcode\x20<code>.','\x20page(s)','Menu\x20sync\x20skipped','\x20and\x20CSS:\x20','\x20menu(s)...','size','Prefer\x20appName\x20for\x20shared\x20subapp\x20resources\x20and\x20parentId\x20for\x20planned\x20groups.\x20','!\x20No\x20local\x20pages\x20found\x20in\x20src/pages','\x20menu(s)','localPages','Non-interactive\x20menu\x20sync\x20requires\x20--yes.','failed','menu\x20sync\x20--paths\x20requires\x20--yes\x20for\x20execution.','Menu\x20creation\x20failed','yellow','validation','\x20\x20Cancelled.','appCode','rawFlags','menu','1188328pWJsIZ'];a190_0xcec5=function(){return _0x2f95d8;};return a190_0xcec5();}import{assertSharedResourcesConfigured}from'../../commands/menu/shared/subapp-assets.js';export const menuSync={'service':a190_0x359a6e(0xd2),'command':a190_0x359a6e(0xe7),'description':'Register\x20local\x20pages\x20as\x20platform\x20menus','risk':a190_0x359a6e(0xed),'flags':[{'name':'params','type':'string','description':a190_0x359a6e(0x113)+a190_0x359a6e(0xe9)},{'name':a190_0x359a6e(0xdf),'type':'string','description':a190_0x359a6e(0xf6)},{'name':a190_0x359a6e(0x10b),'type':a190_0x359a6e(0xfd),'description':a190_0x359a6e(0xfe)}],async 'dryRun'(_0x264c2f){const _0x3f1106=a190_0x359a6e;ensureRunnableContext(_0x264c2f['rawFlags'],_0x264c2f[_0x3f1106(0xf9)]);const _0x1bcc00=await runMenuSyncCore(_0x264c2f[_0x3f1106(0xd0)],_0x264c2f[_0x3f1106(0xd6)],parsePaths(_0x264c2f[_0x3f1106(0x105)](_0x3f1106(0xdf))),_0x264c2f[_0x3f1106(0x105)]('params'),{'dryRun':!![]});return{'method':_0x3f1106(0xd9),'url':_0x3f1106(0xda),'body':_0x1bcc00,'description':_0x1bcc00[_0x3f1106(0xf2)]?_0x3f1106(0xe6):'Would\x20create\x20'+_0x1bcc00[_0x3f1106(0x102)][_0x3f1106(0xf0)]+_0x3f1106(0xdb)};},async 'execute'(_0x2ab1f1){const _0x496743=a190_0x359a6e;ensureRunnableContext(_0x2ab1f1[_0x496743(0xd1)],_0x2ab1f1['selectedAppName']);const _0x510d47=_0x2ab1f1[_0x496743(0xe2)](_0x496743(0x10b)),_0x1bff76=_0x2ab1f1[_0x496743(0x105)](_0x496743(0xfa)),_0x861adc=parsePaths(_0x2ab1f1[_0x496743(0x105)](_0x496743(0xdf))),_0x3e3f4=parseMenuSyncParams(_0x1bff76);if(_0x510d47){const _0x413598=await runMenuSyncCore(_0x2ab1f1[_0x496743(0xd0)],_0x2ab1f1[_0x496743(0xd6)],_0x861adc,_0x1bff76);if(_0x413598['skipped']){const _0x1a2eed=getLocalPages();_0x1a2eed[_0x496743(0xf0)]===0x0?writeCliSideChannelLine(_0x496743(0x114)):writeCliSideChannelLine(_0x496743(0x104));}else writeCliSideChannelLine('✓\x20Menu\x20sync\x20completed:\x20'+_0x413598[_0x496743(0xe8)]+_0x496743(0xd4));return{'ok':!![],'data':_0x413598,'message':_0x413598[_0x496743(0xf2)]?_0x496743(0x10f):_0x496743(0x108)+_0x413598[_0x496743(0xe8)]+'\x20created.'};}if(_0x861adc[_0x496743(0xf0)]>0x0)throw CliErrors['validation'](_0x496743(0x119),_0x496743(0xf8));if(!isInteractive()&&_0x1bff76)throw CliErrors[_0x496743(0xce)](_0x496743(0x117),'Preview\x20with\x20--dry-run,\x20then\x20reuse\x20the\x20same\x20--paths\x20and\x20--params\x20with\x20--yes.');requireInteractive(),writeCliSideChannelLine(_0x496743(0x101));const _0x13d2ca=startSpinner(_0x496743(0x10a));let _0x32f1bf,_0xb6e4c5,_0x2ac9be;try{const _0x4971ad=await fetchMenuData(_0x2ab1f1['appCode'],_0x2ab1f1[_0x496743(0xd6)]);_0x32f1bf=_0x4971ad[_0x496743(0x116)],_0xb6e4c5=_0x4971ad['onlinePaths'],_0x2ac9be=_0x4971ad['onlineMenuList'],stopSpinner(_0x13d2ca,_0x496743(0xef),!![]);}catch(_0x56cca5){stopSpinner(_0x13d2ca,_0x496743(0xee),![]);throw CliErrors[_0x496743(0xce)](_0x56cca5 instanceof Error?_0x56cca5[_0x496743(0x106)]:_0x496743(0xee));}if(_0x32f1bf[_0x496743(0xf0)]===0x0)return writeCliSideChannelLine(a190_0x345067[_0x496743(0xcd)](_0x496743(0xe5))),{'ok':!![]};const _0x307de0=buildCompareRows(_0x32f1bf,_0xb6e4c5);writeCliSideChannelLine(renderCompareTable(_0x307de0)),writeCliSideChannelLine('');const _0x2c6283=await selectPages(_0x32f1bf,_0xb6e4c5);writeCliSideChannelLine(''),writeCliSideChannelLine(a190_0x345067['cyan'](_0x496743(0xd5)+_0x2c6283['length']+_0x496743(0x10e)));const _0x4d7ad3=_0x3e3f4[_0x496743(0xe4)]&&_0x3e3f4[_0x496743(0xd7)];if(!_0x4d7ad3){writeCliSideChannelLine(renderSyncSummary(_0x2c6283,_0xb6e4c5[_0x496743(0x112)]>0x0));const _0x508a32=await askConfirm(_0x496743(0x100));if(!_0x508a32)return writeCliSideChannelLine(a190_0x345067[_0x496743(0xec)]('\x20\x20Cancelled.')),{'ok':!![]};}let _0x559ad1=_0x3e3f4[_0x496743(0xe4)],_0x376ab2=_0x3e3f4[_0x496743(0xd7)];!_0x559ad1&&!_0x3e3f4[_0x496743(0xff)]&&(_0x559ad1=await askJsUrl());!_0x376ab2&&!_0x3e3f4[_0x496743(0xff)]&&(_0x376ab2=await askCssUrl());const _0x125766=await askConfirm(_0x3e3f4[_0x496743(0xff)]?'\x20\x20Create\x20'+_0x2c6283[_0x496743(0xf0)]+_0x496743(0xf1)+_0x3e3f4[_0x496743(0xff)]+'?':_0x496743(0xf7)+_0x2c6283['length']+_0x496743(0xf5)+_0x559ad1+_0x496743(0x110)+_0x376ab2+'?');if(!_0x125766)return writeCliSideChannelLine(a190_0x345067['gray'](_0x496743(0xcf))),{'ok':!![]};const _0x38f863=[_0x559ad1,_0x376ab2][_0x496743(0xf4)](_0x219150=>Boolean(_0x219150));_0x3e3f4[_0x496743(0xff)]&&_0x38f863['length']===0x0&&await assertSharedResourcesConfigured(_0x2ab1f1[_0x496743(0xd0)],_0x2ab1f1[_0x496743(0xd6)],_0x3e3f4[_0x496743(0xff)]);const _0x2e24c6=startSpinner('Creating\x20'+_0x2c6283['length']+_0x496743(0x111));try{const _0x16396d=_0x2c6283[_0x496743(0xdd)](_0x2726a4=>resolvePage(_0x2726a4,_0x3e3f4,_0x2ac9be)),_0x3176b1=await doCreateMenus(_0x2ab1f1['appCode'],_0x2ab1f1[_0x496743(0xd6)],_0x16396d,_0x38f863,_0x3e3f4[_0x496743(0xff)]?{'appName':_0x3e3f4[_0x496743(0xff)]}:undefined);return stopSpinner(_0x2e24c6,_0x496743(0xd8)+_0x3176b1[_0x496743(0xe8)]+_0x496743(0x115),!![]),{'ok':!![],'data':_0x3176b1,'message':_0x496743(0x108)+_0x3176b1[_0x496743(0xe8)]+_0x496743(0xe0)+_0x3176b1[_0x496743(0x118)]+_0x496743(0xdc)};}catch(_0x4c516b){stopSpinner(_0x2e24c6,_0x496743(0x11a),![]);throw CliErrors[_0x496743(0xce)](_0x4c516b instanceof Error?_0x4c516b[_0x496743(0x106)]:_0x496743(0x11a));}}};function ensureRunnableContext(_0x3044ec,_0x2cec06){const _0x2e676e=a190_0x359a6e,_0x5148bc=_0x3044ec[_0x2e676e(0xfc)]?String(_0x3044ec[_0x2e676e(0xfc)])['trim']():'';if(!isInProject()&&!_0x2cec06&&!_0x5148bc)throw CliErrors['validation'](_0x2e676e(0xfb)+_0x2e676e(0x10d));}function parsePaths(_0xbac054){const _0x4d9e26=a190_0x359a6e;return[...new Set(_0xbac054['split'](',')[_0x4d9e26(0xdd)](_0x4bc145=>_0x4bc145[_0x4d9e26(0x10c)]())[_0x4d9e26(0xf4)](Boolean))];}
1
+ import chalk from"chalk";import{buildCompareRows,doCreateMenus,fetchMenuData}from"../../commands/menu/shared/logic.js";import{renderCompareTable,renderSyncSummary}from"../../commands/menu/shared/compare-table.js";import{selectPages,askJsUrl,askCssUrl,askConfirm,startSpinner,stopSpinner,isInteractive,requireInteractive}from"../../commands/menu/shared/inquirer.js";import{CliErrors}from"../../errors.js";import{writeCliSideChannelLine}from"../../utils/write-cli-side-channel.js";import{parseMenuSyncParams,resolvePage,runMenuSyncCore}from"../../commands/menu/shared/sync-core.js";import{getLocalPages}from"../../commands/menu/shared/local-pages.js";import{isInProject}from"../../context.js";import{assertSharedResourcesConfigured}from"../../commands/menu/shared/subapp-assets.js";export const menuSync={service:"menu",command:"sync",description:"Register local pages as platform menus",risk:"write",flags:[{name:"params",type:"string",
2
+ description:"Prefer appName for shared subapp resources and parentId for planned groups. "+'JSON: {"appName":"store-app","parentId":42,"visible":false}; jsUrl and cssUrl remain available for individual menu resources.'},{name:"paths",type:"string",description:"Exact comma-separated local page paths to sync"},{name:"yes",type:"boolean",description:"Confirm non-interactive sync; without --paths, create all missing local pages"}],async dryRun(ctx){ensureRunnableContext(ctx.rawFlags,ctx.selectedAppName);const preview=await runMenuSyncCore(ctx.appCode,ctx.cookie,parsePaths(ctx.str("paths")),ctx.str("params"),{dryRun:true});return{method:"POST",url:"/smartapi/menu/create",body:preview,description:preview.skipped?"No local microfrontend menus would be created.":`Would create ${preview.targetPages.length} local microfrontend menu(s).`}},async execute(ctx){ensureRunnableContext(ctx.rawFlags,ctx.selectedAppName);const yes=ctx.flag("yes");const paramsStr=ctx.str("params")
3
+ ;const selectedPaths=parsePaths(ctx.str("paths"));const params=parseMenuSyncParams(paramsStr);if(yes){const result=await runMenuSyncCore(ctx.appCode,ctx.cookie,selectedPaths,paramsStr);if(result.skipped){const localPages=getLocalPages();if(localPages.length===0){writeCliSideChannelLine("! No local pages found in src/pages")}else{writeCliSideChannelLine("✓ All local pages are already on platform")}}else{writeCliSideChannelLine(`✓ Menu sync completed: ${result.created} menu(s) created`)}return{ok:true,data:result,message:result.skipped?"Menu sync skipped":`Menu sync completed: ${result.created} created.`}}if(selectedPaths.length>0){throw CliErrors.validation("menu sync --paths requires --yes for execution.","Preview with --dry-run, then reuse the same --paths and --params with --yes.")}if(!isInteractive()&&paramsStr){throw CliErrors.validation("Non-interactive menu sync requires --yes.","Preview with --dry-run, then reuse the same --paths and --params with --yes.")}requireInteractive()
4
+ ;writeCliSideChannelLine("Tip: For frontend subapps, prefer Agent-planned menu groups and shared resources. This manual sync workflow remains available as a fallback.");const spinner=startSpinner("Fetching online menu list...");let localPages;let onlinePaths;let onlineMenuList;try{const data=await fetchMenuData(ctx.appCode,ctx.cookie);localPages=data.localPages;onlinePaths=data.onlinePaths;onlineMenuList=data.onlineMenuList;stopSpinner(spinner,"Online menu list fetched",true)}catch(err){stopSpinner(spinner,"Failed to fetch online menu list",false);throw CliErrors.validation(err instanceof Error?err.message:"Failed to fetch online menu list")}if(localPages.length===0){writeCliSideChannelLine(chalk.yellow(" ! No local pages found, please create pages first"));return{ok:true}}const compareRows=buildCompareRows(localPages,onlinePaths);writeCliSideChannelLine(renderCompareTable(compareRows));writeCliSideChannelLine("");const selectedPages=await selectPages(localPages,onlinePaths)
5
+ ;writeCliSideChannelLine("");writeCliSideChannelLine(chalk.cyan(` ✓ Selected: ${selectedPages.length} page(s)`));const hasFullUrls=params.jsUrl&&params.cssUrl;if(!hasFullUrls){writeCliSideChannelLine(renderSyncSummary(selectedPages,onlinePaths.size>0));const confirmed=await askConfirm(" Continue with creation?");if(!confirmed){writeCliSideChannelLine(chalk.gray(" Cancelled."));return{ok:true}}}let jsUrl=params.jsUrl;let cssUrl=params.cssUrl;if(!jsUrl&&!params.appName){jsUrl=await askJsUrl()}if(!cssUrl&&!params.appName){cssUrl=await askCssUrl()}const confirmed=await askConfirm(params.appName?` Create ${selectedPages.length} menu(s) bound to ${params.appName}?`:` Create ${selectedPages.length} menu(s) with JS: ${jsUrl} and CSS: ${cssUrl}?`);if(!confirmed){writeCliSideChannelLine(chalk.gray(" Cancelled."));return{ok:true}}const resources=[jsUrl,cssUrl].filter(url=>Boolean(url));if(params.appName&&resources.length===0){
6
+ await assertSharedResourcesConfigured(ctx.appCode,ctx.cookie,params.appName)}const execSpinner=startSpinner(`Creating ${selectedPages.length} menu(s)...`);try{const preparedPages=selectedPages.map(page=>resolvePage(page,params,onlineMenuList));const result=await doCreateMenus(ctx.appCode,ctx.cookie,preparedPages,resources,params.appName?{appName:params.appName}:undefined);stopSpinner(execSpinner,`Created ${result.created} menu(s)`,true);return{ok:true,data:result,message:`Menu sync completed: ${result.created} created, ${result.failed} failed.`}}catch(err){stopSpinner(execSpinner,"Menu creation failed",false);throw CliErrors.validation(err instanceof Error?err.message:"Menu creation failed")}}};function ensureRunnableContext(rawFlags,selectedAppName){const explicitAppcode=rawFlags.appcode?String(rawFlags.appcode).trim():"";if(!isInProject()&&!selectedAppName&&!explicitAppcode){
7
+ throw CliErrors.validation("menu sync requires a project context or explicit --appcode. "+"Run inside a directory with .rabetbase.json, or pass --appcode <code>.")}}function parsePaths(value){return[...new Set(value.split(",").map(path=>path.trim()).filter(Boolean))]}
@@ -1 +1,13 @@
1
- const a191_0x426c28=a191_0xc495;function a191_0xc495(_0xb29df2,_0x31165e){_0xb29df2=_0xb29df2-0x12f;const _0x13399b=a191_0x1339();let _0xc495e3=_0x13399b[_0xb29df2];return _0xc495e3;}(function(_0x22ae45,_0x319817){const _0x30dbb8=a191_0xc495,_0x59c013=_0x22ae45();while(!![]){try{const _0xb0b57d=parseInt(_0x30dbb8(0x152))/0x1*(-parseInt(_0x30dbb8(0x182))/0x2)+parseInt(_0x30dbb8(0x171))/0x3*(parseInt(_0x30dbb8(0x14c))/0x4)+-parseInt(_0x30dbb8(0x151))/0x5+parseInt(_0x30dbb8(0x141))/0x6+-parseInt(_0x30dbb8(0x19f))/0x7*(parseInt(_0x30dbb8(0x15f))/0x8)+-parseInt(_0x30dbb8(0x1a7))/0x9+parseInt(_0x30dbb8(0x155))/0xa*(parseInt(_0x30dbb8(0x1ab))/0xb);if(_0xb0b57d===_0x319817)break;else _0x59c013['push'](_0x59c013['shift']());}catch(_0x42344a){_0x59c013['push'](_0x59c013['shift']());}}}(a191_0x1339,0x773db));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a191_0x1339(){const _0x3c754b=['verify\x20menu\x20visibility\x20update','modelType','\x20menu(s),\x20expected\x20','\x20visibility\x20could\x20not\x20be\x20verified\x20safely','targets','152YCkkCo','menu_selector_not_found','Menu\x20path\x20selector\x20matched\x20multiple\x20menus:\x20','expectVisible','before','depth','push','Menu\x20','\x20updated,\x20','childrenCount','true','Menu\x20visibility\x20update\x20completed:\x20','\x20menu(s);\x20skip\x20','stringify','appCode','update-recovery','update\x20visibility\x20for','parentId','981xPMEeo','plan','visible','\x20unchanged\x20menu(s).','\x20was\x20not\x20found\x20during\x20visibility\x20verification.','menu','Updated\x20visibility\x20for\x20','menu-ids','expect-visible','isArray','trim','expected-count','resourcesValid','Selected\x20menu\x20visibility\x20changed\x20for\x20id(s):\x20','num','menu_permission_denied','Exact\x20comma-separated\x20menu\x20paths\x20to\x20update','34mZXaGP','sort','boolean','--expected-count\x20must\x20be\x20a\x20non-negative\x20integer.','plannedActions','validation','Response\x20was\x20lost\x20for\x20menu\x20','visibility-update','verification','expectedCount','recovered','Selected\x20','update-menu-visibility','\x20must\x20be\x20true\x20or\x20false.','/smartapi/menu/update','get','datasetId','Exact\x20comma-separated\x20menu\x20IDs\x20to\x20update','has','resources','Visibility\x20update\x20requests\x20completed\x20but\x20readback\x20could\x20not\x20confirm\x20the\x20requested\x20state','path','pageType','childrenIds','label','Abort\x20unless\x20every\x20selected\x20menu\x20has\x20this\x20visibility','update\x20menu\x20visibility','\x20failed.','One\x20or\x20more\x20updates\x20may\x20have\x20changed\x20fields\x20outside\x20visibility;\x20inspect\x20current\x20menu\x20facts\x20before\x20retrying.','137543hEOZhp','menu\x20visibility-update\x20requires\x20--menu-ids\x20or\x20--paths.','Every\x20selected\x20menu\x20already\x20has\x20the\x20requested\x20visibility;\x20no\x20write\x20is\x20needed.','requestedVisible','Menu\x20id\x20selector(s)\x20not\x20found:\x20','updated','rabetbase\x20menu\x20list\x20--format\x20compress','datasetCode','7802433gMwjff','join','Run\x20`rabetbase\x20menu\x20list\x20--format\x20compress`\x20and\x20use\x20an\x20exact\x20current\x20path.','hash','626021sSxrNg','--menu-ids\x20must\x20contain\x20positive\x20safe\x20integers.','\x20changed\x20unexpectedly.','type','Use\x20--menu-ids\x20with\x20one\x20or\x20more\x20of:\x20','map','beforeById','menuIds','string','rawFlags','pageId','write','Abort\x20unless\x20the\x20exact\x20number\x20of\x20selected\x20menus\x20matches','flagMissing','message','false','\x20skipped,\x20','filter','cookie','\x20and\x20final\x20state\x20could\x20not\x20be\x20read.','menu_verification_failed','failed','3434250CJRQFb','POST','number','paths','\x20visible\x20did\x20not\x20match\x20the\x20requested\x20state.','body','some','set','Menu\x20visibility\x20update\x20could\x20not\x20be\x20verified\x20for\x20id(s):\x20','length','url','4288RnThcQ','Response\x20was\x20lost\x20and\x20menu\x20','Menu\x20path\x20selector\x20not\x20found:\x20','Inspect\x20current\x20menu\x20facts\x20before\x20retrying\x20any\x20target.','isSafeInteger','3298790ujCnAo','51049Swopqb','Run\x20`rabetbase\x20menu\x20list\x20--format\x20compress`\x20and\x20use\x20exact\x20current\x20ids.','menus','410NsEpxF','code','menu\x20list','warnings','Set\x20exact\x20menus\x20visible\x20or\x20hidden\x20without\x20changing\x20their\x20routes\x20or\x20resources'];a191_0x1339=function(){return _0x3c754b;};return a191_0x1339();}import{fetchMenuSnapshot}from'../../commands/menu/shared/facts.js';import{asVerificationError,assertVerified,describeMenuErrorCause,fetchMutationSnapshot,hasFlag,isMenuResponseLoss,mapMenuApiError,menuDryRunResult,menuError,menuFailure,mutationResult,recheckMutationSnapshot}from'../../commands/menu/shared/mutations.js';import{updateMenuEntity}from'../../commands/menu/shared/service.js';import{CliErrors}from'../../errors.js';const BACKEND=[{'method':a191_0x426c28(0x142),'path':a191_0x426c28(0x190)}];export const menuVisibilityUpdate={'service':a191_0x426c28(0x176),'command':'visibility-update','description':a191_0x426c28(0x159),'risk':a191_0x426c28(0x136),'structuredErrors':!![],'flags':[{'name':a191_0x426c28(0x178),'type':a191_0x426c28(0x133),'description':a191_0x426c28(0x193)},{'name':'paths','type':a191_0x426c28(0x133),'description':a191_0x426c28(0x181)},{'name':'visible','type':'boolean','required':!![],'description':'Requested\x20menu\x20visibility'},{'name':a191_0x426c28(0x179),'type':a191_0x426c28(0x184),'description':a191_0x426c28(0x19b)},{'name':'expected-count','type':a191_0x426c28(0x143),'description':a191_0x426c28(0x137)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1d33d1){parseInput(_0x1d33d1);},async 'dryRun'(_0x1d394b){const _0x118159=a191_0x426c28,_0x3f0300=await buildPlan(_0x1d394b,!![]),_0x2ba29e=_0x3f0300[_0x118159(0x172)][_0x118159(0x186)]?.[_0x118159(0x14a)]??0x0,_0x3ff4d9=_0x3f0300[_0x118159(0x172)][_0x118159(0x15e)]['length']-_0x2ba29e;return menuDryRunResult(_0x3f0300[_0x118159(0x172)],{'method':_0x118159(0x142),'url':_0x118159(0x190),'body':{'updates':_0x3f0300['plan']['plannedActions']?.[_0x118159(0x130)](_0x3d4063=>_0x3d4063[_0x118159(0x146)])??[]},'description':'Would\x20update\x20visibility\x20for\x20'+_0x2ba29e+_0x118159(0x16b)+_0x3ff4d9+_0x118159(0x174)});},async 'execute'(_0x295e82){const _0x284009=a191_0x426c28,_0x39a460=await buildPlan(_0x295e82,![]);await recheckMutationSnapshot(_0x295e82,_0x39a460[_0x284009(0x172)],_0x284009(0x19c));const _0x12e1f9=[],_0x4765b8=[],_0xb18290=[];for(const _0x1ec941 of _0x39a460[_0x284009(0x172)]['targets']){if(_0x1ec941[_0x284009(0x163)][_0x284009(0x173)]===_0x39a460[_0x284009(0x172)][_0x284009(0x1a2)]){_0x12e1f9[_0x284009(0x165)]({'id':_0x1ec941['id'],'updated':![],'skipped':!![]});continue;}try{await updateMenuEntity(_0x295e82[_0x284009(0x16d)],_0x295e82[_0x284009(0x13d)],{'id':_0x1ec941['id'],'visible':_0x39a460['plan'][_0x284009(0x1a2)]}),_0x12e1f9[_0x284009(0x165)]({'id':_0x1ec941['id'],'updated':!![],'skipped':![]});}catch(_0x21a739){const _0x5d8353=mapMenuApiError(_0x21a739,_0x284009(0x16f),_0x1ec941['id']);if(isMenuResponseLoss(_0x21a739)&&_0x5d8353[_0x284009(0x156)]!==_0x284009(0x180)){_0xb18290['push'](_0x1ec941['id']);continue;}_0x4765b8['push']({'id':_0x1ec941['id'],'stage':'update','code':_0x5d8353['code'],'message':_0x5d8353[_0x284009(0x139)]});}}let _0x385654;try{_0x385654=await fetchMenuSnapshot(_0x295e82[_0x284009(0x16d)],_0x295e82['cookie']);}catch(_0x15dd2d){const _0x578c62=describeMenuErrorCause(_0x15dd2d,_0x284009(0x15a)),_0x50460c=_0xb18290[_0x284009(0x130)](_0x423473=>({'id':_0x423473,'stage':'update-recovery','code':_0x284009(0x13f),'message':_0x284009(0x188)+_0x423473+_0x284009(0x13e),'requestedStateConfirmed':![],'recovered':![]})),_0x3893d0={'stage':_0x284009(0x18a),'code':_0x284009(0x13f),'message':'Final\x20menu\x20visibility\x20readback\x20failed.','targetIds':_0x39a460['plan'][_0x284009(0x15e)][_0x284009(0x130)](_0x2a008e=>_0x2a008e['id']),'requestedStateConfirmed':![],..._0x578c62};throw menuFailure(asVerificationError(_0x15dd2d,_0x284009(0x196)),_0x39a460[_0x284009(0x172)],{'stage':_0x284009(0x18a),'succeeded':_0x12e1f9,'failedRecords':[..._0x4765b8,..._0x50460c,_0x3893d0],'warnings':['The\x20update\x20may\x20have\x20taken\x20effect;\x20inspect\x20the\x20latest\x20menu\x20facts\x20before\x20retrying.'],'verification':{'status':_0x284009(0x140),'recoveredCount':0x0,'lookupCommand':_0x284009(0x1a5)}});}const _0x3e760a=[];for(const _0x35429e of _0x12e1f9){const _0x2f9c68=Number(_0x35429e['id']),_0xbe6609=_0x39a460[_0x284009(0x131)]['get'](_0x2f9c68),_0x36af68=_0x385654['byId'][_0x284009(0x191)](_0x2f9c68);try{verifyVisibilityUpdate(_0xbe6609,_0x36af68,_0x39a460[_0x284009(0x172)][_0x284009(0x1a2)]);}catch(_0xbf4813){const _0x554dc5=asVerificationError(_0xbf4813,_0x284009(0x166)+_0x2f9c68+'\x20visibility\x20update\x20could\x20not\x20be\x20verified');_0x3e760a[_0x284009(0x165)]({'id':_0x2f9c68,'stage':'verification','code':_0x554dc5[_0x284009(0x156)],'message':_0x554dc5[_0x284009(0x139)],'requestedStateConfirmed':![]});}}for(const _0x33c503 of _0xb18290){const _0x4de119=_0x39a460[_0x284009(0x131)][_0x284009(0x191)](_0x33c503),_0x2db7e1=_0x385654['byId'][_0x284009(0x191)](_0x33c503);try{verifyVisibilityUpdate(_0x4de119,_0x2db7e1,_0x39a460['plan'][_0x284009(0x1a2)]),_0x12e1f9[_0x284009(0x165)]({'id':_0x33c503,'updated':!![],'skipped':![],'recovered':!![]});}catch(_0x56af3c){const _0x440c29=asVerificationError(_0x56af3c,_0x284009(0x14d)+_0x33c503+_0x284009(0x15d));_0x3e760a['push']({'id':_0x33c503,'stage':_0x284009(0x16e),'code':_0x440c29[_0x284009(0x156)],'message':_0x440c29[_0x284009(0x139)],'requestedStateConfirmed':![],'recovered':![]});}}if(_0x3e760a[_0x284009(0x14a)]>0x0){const _0x20f014=_0x3e760a[_0x284009(0x130)](_0x46d9b6=>Number(_0x46d9b6['id'])),_0x3598a0=_0x12e1f9[_0x284009(0x13c)](_0x61a9ef=>_0x61a9ef[_0x284009(0x18c)]===!![])['length'],_0x5d892f=menuError('menu_verification_failed',_0x284009(0x149)+_0x20f014['join'](',\x20')+'.',_0x284009(0x14f));throw menuFailure(_0x5d892f,_0x39a460['plan'],{'stage':_0x284009(0x18a),'succeeded':_0x12e1f9,'failedRecords':[..._0x4765b8,..._0x3e760a],'warnings':[_0x284009(0x19e)],'verification':{'status':'failed',..._0x20f014['length']===0x1?{'targetId':_0x20f014[0x0]}:{'targetIds':_0x20f014},'recoveredCount':_0x3598a0,'lookupCommand':'rabetbase\x20menu\x20list\x20--format\x20compress'}});}const _0x4ef3b5=_0x12e1f9[_0x284009(0x13c)](_0x4ca3e9=>_0x4ca3e9[_0x284009(0x1a4)]===!![])[_0x284009(0x14a)],_0x5c4120=_0x12e1f9[_0x284009(0x14a)]-_0x4ef3b5,_0x24a39d={..._0x39a460[_0x284009(0x172)],'succeeded':_0x12e1f9,'failed':_0x4765b8,'warnings':_0x4765b8[_0x284009(0x14a)]>0x0?[..._0x39a460[_0x284009(0x172)][_0x284009(0x158)],'Failed\x20update\x20requests\x20were\x20not\x20retried;\x20inspect\x20current\x20menu\x20facts\x20before\x20retrying.']:_0x39a460[_0x284009(0x172)][_0x284009(0x158)],'verification':{'checkedBy':_0x284009(0x157),'snapshotHash':_0x385654[_0x284009(0x1aa)],'matchesRequestedState':_0x4765b8[_0x284009(0x14a)]===0x0,'recoveredCount':_0xb18290['length']}};return{'ok':_0x4765b8[_0x284009(0x14a)]===0x0,'data':_0x24a39d,'message':_0x4765b8[_0x284009(0x14a)]===0x0?_0x284009(0x177)+_0x4ef3b5+'\x20menu(s);\x20skipped\x20'+_0x5c4120+_0x284009(0x174):_0x284009(0x16a)+_0x4ef3b5+_0x284009(0x167)+_0x5c4120+_0x284009(0x13b)+_0x4765b8[_0x284009(0x14a)]+_0x284009(0x19d)};}};function parseInput(_0x196306){const _0x3f4571=a191_0x426c28,_0x568ee6=parseMenuIds(_0x196306['str'](_0x3f4571(0x178))),_0x220d3d=parseCsv(_0x196306['str'](_0x3f4571(0x144)));if(_0x568ee6['length']===0x0&&_0x220d3d[_0x3f4571(0x14a)]===0x0)throw CliErrors['validation'](_0x3f4571(0x1a0));const _0x3f34fe=parseBooleanFlag(_0x196306,_0x3f4571(0x173),!![]),_0x128636=parseBooleanFlag(_0x196306,'expect-visible',![]);let _0x340b6d;if(hasFlag(_0x196306,'expected-count')){_0x340b6d=_0x196306[_0x3f4571(0x17f)](_0x3f4571(0x17c));if(!Number[_0x3f4571(0x150)](_0x340b6d)||_0x340b6d<0x0)throw CliErrors[_0x3f4571(0x187)](_0x3f4571(0x185));}return{'menuIds':_0x568ee6,'paths':_0x220d3d,'visible':_0x3f34fe,'expectVisible':_0x128636,'expectedCount':_0x340b6d};}async function buildPlan(_0x530f5c,_0x3c4f88){const _0x1d03ba=a191_0x426c28,_0x34bd4f=parseInput(_0x530f5c),_0x4b4741=await fetchMutationSnapshot(_0x530f5c,_0x1d03ba(0x19c)),_0x36af98=selectTargets(_0x4b4741[_0x1d03ba(0x154)],_0x34bd4f[_0x1d03ba(0x132)],_0x34bd4f['paths']);if(_0x34bd4f['expectedCount']!==undefined&&_0x36af98['length']!==_0x34bd4f[_0x1d03ba(0x18b)])throw menuError('menu_expected_count_mismatch',_0x1d03ba(0x18d)+_0x36af98['length']+_0x1d03ba(0x15c)+_0x34bd4f[_0x1d03ba(0x18b)]+'.','Run\x20the\x20command\x20with\x20--dry-run\x20again\x20and\x20update\x20--expected-count.');if(_0x34bd4f[_0x1d03ba(0x162)]!==undefined){const _0x449084=_0x36af98[_0x1d03ba(0x13c)](_0x8ff8e4=>_0x8ff8e4['visible']!==_0x34bd4f[_0x1d03ba(0x162)]);if(_0x449084[_0x1d03ba(0x14a)]>0x0)throw menuError('menu_state_drift',_0x1d03ba(0x17e)+_0x449084[_0x1d03ba(0x130)](_0x5cf09f=>_0x5cf09f['id'])['join'](',\x20')+'.','Run\x20the\x20command\x20with\x20--dry-run\x20again\x20and\x20update\x20--expect-visible.');}const _0x4e4b4e=_0x36af98['map'](_0x29427a=>({'id':_0x29427a['id'],'label':_0x29427a[_0x1d03ba(0x19a)],'path':_0x29427a['path'],'before':{'visible':_0x29427a[_0x1d03ba(0x173)]},'after':{'visible':_0x34bd4f['visible']}})),_0x4ea964=_0x4e4b4e[_0x1d03ba(0x13c)](_0x5bf17f=>_0x5bf17f['before'][_0x1d03ba(0x173)]!==_0x34bd4f[_0x1d03ba(0x173)])[_0x1d03ba(0x130)](_0x1f2e8=>({'stage':_0x1d03ba(0x18e),'method':'POST','path':'/smartapi/menu/update','body':{'appCode':_0x530f5c[_0x1d03ba(0x16d)],'id':_0x1f2e8['id'],'visible':_0x34bd4f['visible']}})),_0x34606f=mutationResult({'operation':_0x1d03ba(0x189),'selector':{'menuIds':_0x34bd4f[_0x1d03ba(0x132)],'paths':_0x34bd4f[_0x1d03ba(0x144)]},'before':{'menus':_0x36af98[_0x1d03ba(0x130)](_0x9117e1=>({'id':_0x9117e1['id'],'path':_0x9117e1[_0x1d03ba(0x197)],'visible':_0x9117e1['visible']}))},'after':{'menus':_0x36af98['map'](_0x20dc01=>({'id':_0x20dc01['id'],'path':_0x20dc01[_0x1d03ba(0x197)],'visible':_0x34bd4f[_0x1d03ba(0x173)]}))},'dryRun':_0x3c4f88,'backend':[...BACKEND],'plannedActions':_0x4ea964,'snapshotHash':_0x4b4741[_0x1d03ba(0x1aa)],'warnings':_0x4ea964[_0x1d03ba(0x14a)]===0x0?[_0x1d03ba(0x1a1)]:[]});return{'plan':{..._0x34606f,'requestedVisible':_0x34bd4f[_0x1d03ba(0x173)],'targets':_0x4e4b4e},'beforeById':new Map(_0x36af98['map'](_0x5789df=>[_0x5789df['id'],_0x5789df]))};}function selectTargets(_0x94177e,_0x4ac0ed,_0x1dc750){const _0x5ac4f0=a191_0x426c28,_0x3f33c3=new Map(_0x94177e[_0x5ac4f0(0x130)](_0x2881c2=>[_0x2881c2['id'],_0x2881c2])),_0x21ff85=new Map(),_0x178802=_0x4ac0ed['filter'](_0x2f3a13=>!_0x3f33c3[_0x5ac4f0(0x194)](_0x2f3a13));if(_0x178802[_0x5ac4f0(0x14a)]>0x0)throw menuError(_0x5ac4f0(0x160),_0x5ac4f0(0x1a3)+_0x178802['join'](',\x20')+'.',_0x5ac4f0(0x153));for(const _0x10c10e of _0x4ac0ed){_0x21ff85['set'](_0x10c10e,_0x3f33c3[_0x5ac4f0(0x191)](_0x10c10e));}for(const _0x4007ec of _0x1dc750){const _0x1c8d27=_0x94177e['filter'](_0x31bcda=>_0x31bcda[_0x5ac4f0(0x197)]===_0x4007ec);if(_0x1c8d27[_0x5ac4f0(0x14a)]===0x0)throw menuError(_0x5ac4f0(0x160),_0x5ac4f0(0x14e)+JSON[_0x5ac4f0(0x16c)](_0x4007ec)+'.',_0x5ac4f0(0x1a9));if(_0x1c8d27['length']>0x1)throw menuError('menu_selector_ambiguous',_0x5ac4f0(0x161)+JSON['stringify'](_0x4007ec)+'.',_0x5ac4f0(0x12f)+_0x1c8d27[_0x5ac4f0(0x130)](_0x293ad7=>_0x293ad7['id'])[_0x5ac4f0(0x1a8)](',\x20')+'.');const _0xaa8cbe=_0x1c8d27[0x0];_0x21ff85[_0x5ac4f0(0x148)](_0xaa8cbe['id'],_0xaa8cbe);}return[..._0x21ff85['values']()];}function parseMenuIds(_0xe663ea){const _0x1d0c65=a191_0x426c28,_0x41e4d2=parseCsv(_0xe663ea),_0x33df56=_0x41e4d2[_0x1d0c65(0x130)](Number);if(_0x33df56[_0x1d0c65(0x147)](_0x20a0f7=>!Number[_0x1d0c65(0x150)](_0x20a0f7)||_0x20a0f7<=0x0))throw CliErrors[_0x1d0c65(0x187)](_0x1d0c65(0x1ac));return[...new Set(_0x33df56)];}function parseCsv(_0x1d326e){const _0x481c14=a191_0x426c28;return[...new Set(_0x1d326e['split'](',')[_0x481c14(0x130)](_0x263f86=>_0x263f86[_0x481c14(0x17b)]())[_0x481c14(0x13c)](Boolean))];}function parseBooleanFlag(_0x58a3e8,_0x4c7a22,_0x536372){const _0xb18b83=a191_0x426c28;if(!hasFlag(_0x58a3e8,_0x4c7a22)){if(_0x536372)throw CliErrors[_0xb18b83(0x138)](_0x4c7a22);return undefined;}const _0x3af518=_0x58a3e8[_0xb18b83(0x134)][_0x4c7a22];if(_0x3af518===!![]||_0x3af518===![])return _0x3af518;if(_0x3af518===_0xb18b83(0x169))return!![];if(_0x3af518===_0xb18b83(0x13a))return![];throw CliErrors[_0xb18b83(0x187)]('--'+_0x4c7a22+_0xb18b83(0x18f));}function verifyVisibilityUpdate(_0x3a0858,_0xaa1c87,_0x13ac52){const _0x183ff5=a191_0x426c28;assertVerified(!!_0xaa1c87,_0x183ff5(0x166)+_0x3a0858['id']+_0x183ff5(0x175)),assertVerified(_0xaa1c87['visible']===_0x13ac52,_0x183ff5(0x166)+_0x3a0858['id']+_0x183ff5(0x145));const _0x1dbeb1=[['id',_0xaa1c87['id'],_0x3a0858['id']],[_0x183ff5(0x170),_0xaa1c87['parentId'],_0x3a0858[_0x183ff5(0x170)]],[_0x183ff5(0x164),_0xaa1c87[_0x183ff5(0x164)],_0x3a0858['depth']],[_0x183ff5(0x19a),_0xaa1c87['label'],_0x3a0858[_0x183ff5(0x19a)]],['path',_0xaa1c87[_0x183ff5(0x197)],_0x3a0858[_0x183ff5(0x197)]],[_0x183ff5(0x14b),_0xaa1c87[_0x183ff5(0x14b)],_0x3a0858['url']],[_0x183ff5(0x1ae),_0xaa1c87[_0x183ff5(0x1ae)],_0x3a0858[_0x183ff5(0x1ae)]],[_0x183ff5(0x183),_0xaa1c87[_0x183ff5(0x183)],_0x3a0858[_0x183ff5(0x183)]],[_0x183ff5(0x195),_0xaa1c87[_0x183ff5(0x195)],_0x3a0858[_0x183ff5(0x195)]],[_0x183ff5(0x17d),_0xaa1c87[_0x183ff5(0x17d)],_0x3a0858[_0x183ff5(0x17d)]],[_0x183ff5(0x199),_0xaa1c87[_0x183ff5(0x199)],_0x3a0858['childrenIds']],[_0x183ff5(0x168),_0xaa1c87[_0x183ff5(0x168)],_0x3a0858['childrenCount']],[_0x183ff5(0x135),_0xaa1c87[_0x183ff5(0x135)],_0x3a0858[_0x183ff5(0x135)]],[_0x183ff5(0x198),_0xaa1c87['pageType'],_0x3a0858['pageType']],[_0x183ff5(0x15b),_0xaa1c87[_0x183ff5(0x15b)],_0x3a0858[_0x183ff5(0x15b)]],[_0x183ff5(0x192),_0xaa1c87['datasetId'],_0x3a0858['datasetId']],[_0x183ff5(0x1a6),_0xaa1c87[_0x183ff5(0x1a6)],_0x3a0858[_0x183ff5(0x1a6)]]];for(const [_0x4ec0b3,_0x4bf06a,_0x1f40d6]of _0x1dbeb1){assertVerified(sameValue(_0x4bf06a,_0x1f40d6),'Menu\x20'+_0x3a0858['id']+'\x20'+_0x4ec0b3+_0x183ff5(0x1ad));}}function sameValue(_0x9bff1c,_0x315337){const _0x6b21e5=a191_0x426c28;if(Array[_0x6b21e5(0x17a)](_0x9bff1c)||Array['isArray'](_0x315337))return JSON[_0x6b21e5(0x16c)](_0x9bff1c)===JSON[_0x6b21e5(0x16c)](_0x315337);return _0x9bff1c===_0x315337;}
1
+ import{APPCODE_FLAG_OPTIONAL}from"../../commands/common/flags.js";import{fetchMenuSnapshot}from"../../commands/menu/shared/facts.js";import{asVerificationError,assertVerified,describeMenuErrorCause,fetchMutationSnapshot,hasFlag,isMenuResponseLoss,mapMenuApiError,menuDryRunResult,menuError,menuFailure,mutationResult,recheckMutationSnapshot}from"../../commands/menu/shared/mutations.js";import{updateMenuEntity}from"../../commands/menu/shared/service.js";import{CliErrors}from"../../errors.js";const BACKEND=[{method:"POST",path:"/smartapi/menu/update"}];export const menuVisibilityUpdate={service:"menu",command:"visibility-update",description:"Set exact menus visible or hidden without changing their routes or resources",risk:"write",structuredErrors:true,flags:[{name:"menu-ids",type:"string",description:"Exact comma-separated menu IDs to update"},{name:"paths",type:"string",description:"Exact comma-separated menu paths to update"},{name:"visible",type:"boolean",required:true,
2
+ description:"Requested menu visibility"},{name:"expect-visible",type:"boolean",description:"Abort unless every selected menu has this visibility"},{name:"expected-count",type:"number",description:"Abort unless the exact number of selected menus matches"},APPCODE_FLAG_OPTIONAL],async validate(ctx){parseInput(ctx)},async dryRun(ctx){const prepared=await buildPlan(ctx,true);const updateCount=prepared.plan.plannedActions?.length??0;const skippedCount=prepared.plan.targets.length-updateCount;return menuDryRunResult(prepared.plan,{method:"POST",url:"/smartapi/menu/update",body:{updates:prepared.plan.plannedActions?.map(action=>action.body)??[]},description:`Would update visibility for ${updateCount} menu(s); skip ${skippedCount} unchanged menu(s).`})},async execute(ctx){const prepared=await buildPlan(ctx,false);await recheckMutationSnapshot(ctx,prepared.plan,"update menu visibility");const succeeded=[];const failed=[];const responseLostIds=[];for(const target of prepared.plan.targets){
3
+ if(target.before.visible===prepared.plan.requestedVisible){succeeded.push({id:target.id,updated:false,skipped:true});continue}try{await updateMenuEntity(ctx.appCode,ctx.cookie,{id:target.id,visible:prepared.plan.requestedVisible});succeeded.push({id:target.id,updated:true,skipped:false})}catch(error){const mapped=mapMenuApiError(error,"update visibility for",target.id);if(isMenuResponseLoss(error)&&mapped.code!=="menu_permission_denied"){responseLostIds.push(target.id);continue}failed.push({id:target.id,stage:"update",code:mapped.code,message:mapped.message})}}let verifiedSnapshot;try{verifiedSnapshot=await fetchMenuSnapshot(ctx.appCode,ctx.cookie)}catch(error){const cause=describeMenuErrorCause(error,"verify menu visibility update");const recoveryFailures=responseLostIds.map(id=>({id:id,stage:"update-recovery",code:"menu_verification_failed",message:`Response was lost for menu ${id} and final state could not be read.`,requestedStateConfirmed:false,recovered:false}))
4
+ ;const verificationFailure={stage:"verification",code:"menu_verification_failed",message:"Final menu visibility readback failed.",targetIds:prepared.plan.targets.map(target=>target.id),requestedStateConfirmed:false,...cause};throw menuFailure(asVerificationError(error,"Visibility update requests completed but readback could not confirm the requested state"),prepared.plan,{stage:"verification",succeeded:succeeded,failedRecords:[...failed,...recoveryFailures,verificationFailure],warnings:["The update may have taken effect; inspect the latest menu facts before retrying."],verification:{status:"failed",recoveredCount:0,lookupCommand:"rabetbase menu list --format compress"}})}const verificationFailures=[];for(const outcome of succeeded){const id=Number(outcome.id);const before=prepared.beforeById.get(id);const verified=verifiedSnapshot.byId.get(id);try{verifyVisibilityUpdate(before,verified,prepared.plan.requestedVisible)}catch(error){
5
+ const verificationError=asVerificationError(error,`Menu ${id} visibility update could not be verified`);verificationFailures.push({id:id,stage:"verification",code:verificationError.code,message:verificationError.message,requestedStateConfirmed:false})}}for(const id of responseLostIds){const before=prepared.beforeById.get(id);const verified=verifiedSnapshot.byId.get(id);try{verifyVisibilityUpdate(before,verified,prepared.plan.requestedVisible);succeeded.push({id:id,updated:true,skipped:false,recovered:true})}catch(error){const verificationError=asVerificationError(error,`Response was lost and menu ${id} visibility could not be verified safely`);verificationFailures.push({id:id,stage:"update-recovery",code:verificationError.code,message:verificationError.message,requestedStateConfirmed:false,recovered:false})}}if(verificationFailures.length>0){const targetIds=verificationFailures.map(item=>Number(item.id));const recoveredCount=succeeded.filter(item=>item.recovered===true).length
6
+ ;const verificationError=menuError("menu_verification_failed",`Menu visibility update could not be verified for id(s): ${targetIds.join(", ")}.`,"Inspect current menu facts before retrying any target.");throw menuFailure(verificationError,prepared.plan,{stage:"verification",succeeded:succeeded,failedRecords:[...failed,...verificationFailures],warnings:["One or more updates may have changed fields outside visibility; inspect current menu facts before retrying."],verification:{status:"failed",...targetIds.length===1?{targetId:targetIds[0]}:{targetIds:targetIds},recoveredCount:recoveredCount,lookupCommand:"rabetbase menu list --format compress"}})}const updatedCount=succeeded.filter(item=>item.updated===true).length;const skippedCount=succeeded.length-updatedCount;const data={...prepared.plan,succeeded:succeeded,failed:failed,warnings:failed.length>0?[...prepared.plan.warnings,"Failed update requests were not retried; inspect current menu facts before retrying."]:prepared.plan.warnings,
7
+ verification:{checkedBy:"menu list",snapshotHash:verifiedSnapshot.hash,matchesRequestedState:failed.length===0,recoveredCount:responseLostIds.length}};return{ok:failed.length===0,data:data,message:failed.length===0?`Updated visibility for ${updatedCount} menu(s); skipped ${skippedCount} unchanged menu(s).`:`Menu visibility update completed: ${updatedCount} updated, ${skippedCount} skipped, ${failed.length} failed.`}}};function parseInput(ctx){const menuIds=parseMenuIds(ctx.str("menu-ids"));const paths=parseCsv(ctx.str("paths"));if(menuIds.length===0&&paths.length===0){throw CliErrors.validation("menu visibility-update requires --menu-ids or --paths.")}const visible=parseBooleanFlag(ctx,"visible",true);const expectVisible=parseBooleanFlag(ctx,"expect-visible",false);let expectedCount;if(hasFlag(ctx,"expected-count")){expectedCount=ctx.num("expected-count");if(!Number.isSafeInteger(expectedCount)||expectedCount<0){
8
+ throw CliErrors.validation("--expected-count must be a non-negative integer.")}}return{menuIds:menuIds,paths:paths,visible:visible,expectVisible:expectVisible,expectedCount:expectedCount}}async function buildPlan(ctx,dryRun){const input=parseInput(ctx);const snapshot=await fetchMutationSnapshot(ctx,"update menu visibility");const targets=selectTargets(snapshot.menus,input.menuIds,input.paths);if(input.expectedCount!==undefined&&targets.length!==input.expectedCount){throw menuError("menu_expected_count_mismatch",`Selected ${targets.length} menu(s), expected ${input.expectedCount}.`,"Run the command with --dry-run again and update --expected-count.")}if(input.expectVisible!==undefined){const drifted=targets.filter(menu=>menu.visible!==input.expectVisible);if(drifted.length>0){throw menuError("menu_state_drift",`Selected menu visibility changed for id(s): ${drifted.map(menu=>menu.id).join(", ")}.`,"Run the command with --dry-run again and update --expect-visible.")}}
9
+ const diffs=targets.map(menu=>({id:menu.id,label:menu.label,path:menu.path,before:{visible:menu.visible},after:{visible:input.visible}}));const plannedActions=diffs.filter(diff=>diff.before.visible!==input.visible).map(diff=>({stage:"update-menu-visibility",method:"POST",path:"/smartapi/menu/update",body:{appCode:ctx.appCode,id:diff.id,visible:input.visible}}));const base=mutationResult({operation:"visibility-update",selector:{menuIds:input.menuIds,paths:input.paths},before:{menus:targets.map(menu=>({id:menu.id,path:menu.path,visible:menu.visible}))},after:{menus:targets.map(menu=>({id:menu.id,path:menu.path,visible:input.visible}))},dryRun:dryRun,backend:[...BACKEND],plannedActions:plannedActions,snapshotHash:snapshot.hash,warnings:plannedActions.length===0?["Every selected menu already has the requested visibility; no write is needed."]:[]});return{plan:{...base,requestedVisible:input.visible,targets:diffs},beforeById:new Map(targets.map(menu=>[menu.id,menu]))}}
10
+ function selectTargets(menus,menuIds,paths){const byId=new Map(menus.map(menu=>[menu.id,menu]));const selected=new Map;const missingIds=menuIds.filter(id=>!byId.has(id));if(missingIds.length>0){throw menuError("menu_selector_not_found",`Menu id selector(s) not found: ${missingIds.join(", ")}.`,"Run `rabetbase menu list --format compress` and use exact current ids.")}for(const id of menuIds){selected.set(id,byId.get(id))}for(const path of paths){const matches=menus.filter(menu=>menu.path===path);if(matches.length===0){throw menuError("menu_selector_not_found",`Menu path selector not found: ${JSON.stringify(path)}.`,"Run `rabetbase menu list --format compress` and use an exact current path.")}if(matches.length>1){throw menuError("menu_selector_ambiguous",`Menu path selector matched multiple menus: ${JSON.stringify(path)}.`,`Use --menu-ids with one or more of: ${matches.map(menu=>menu.id).join(", ")}.`)}const match=matches[0];selected.set(match.id,match)}return[...selected.values()]}
11
+ function parseMenuIds(value){const values=parseCsv(value);const ids=values.map(Number);if(ids.some(id=>!Number.isSafeInteger(id)||id<=0)){throw CliErrors.validation("--menu-ids must contain positive safe integers.")}return[...new Set(ids)]}function parseCsv(value){return[...new Set(value.split(",").map(item=>item.trim()).filter(Boolean))]}function parseBooleanFlag(ctx,name,required){if(!hasFlag(ctx,name)){if(required)throw CliErrors.flagMissing(name);return undefined}const raw=ctx.rawFlags[name];if(raw===true||raw===false)return raw;if(raw==="true")return true;if(raw==="false")return false;throw CliErrors.validation(`--${name} must be true or false.`)}function verifyVisibilityUpdate(before,after,requestedVisible){assertVerified(!!after,`Menu ${before.id} was not found during visibility verification.`);assertVerified(after.visible===requestedVisible,`Menu ${before.id} visible did not match the requested state.`)
12
+ ;const comparisons=[["id",after.id,before.id],["parentId",after.parentId,before.parentId],["depth",after.depth,before.depth],["label",after.label,before.label],["path",after.path,before.path],["url",after.url,before.url],["type",after.type,before.type],["sort",after.sort,before.sort],["resources",after.resources,before.resources],["resourcesValid",after.resourcesValid,before.resourcesValid],["childrenIds",after.childrenIds,before.childrenIds],["childrenCount",after.childrenCount,before.childrenCount],["pageId",after.pageId,before.pageId],["pageType",after.pageType,before.pageType],["modelType",after.modelType,before.modelType],["datasetId",after.datasetId,before.datasetId],["datasetCode",after.datasetCode,before.datasetCode]];for(const[field,actual,expected]of comparisons){assertVerified(sameValue(actual,expected),`Menu ${before.id} ${field} changed unexpectedly.`)}}function sameValue(actual,expected){if(Array.isArray(actual)||Array.isArray(expected)){
13
+ return JSON.stringify(actual)===JSON.stringify(expected)}return actual===expected}
@@ -0,0 +1,8 @@
1
+ import type { ValidateFunction } from 'ajv';
2
+ export declare function readMetricJson(file: string): Promise<unknown>;
3
+ export declare function parseMetricJson(text: string): unknown;
4
+ export declare function compileMetricContract(value: unknown): {
5
+ input: import("ajv/dist/core.js").AnyValidateFunction<unknown>;
6
+ output: import("ajv/dist/core.js").AnyValidateFunction<unknown>;
7
+ };
8
+ export declare function assertMetricInput(validate: ValidateFunction, value: unknown): asserts value is Record<string, unknown>;
@@ -0,0 +1,5 @@
1
+ import{readFile}from"node:fs/promises";import{Ajv2020}from"ajv/dist/2020.js";import addFormats from"ajv-formats";import{CliError,CliErrors}from"../../errors.js";function object(value){return value!==null&&typeof value==="object"&&!Array.isArray(value)}export async function readMetricJson(file){try{return parseMetricJson(await readFile(file,"utf8"))}catch(error){if(error instanceof CliError)throw error;throw CliErrors.validation(`Cannot read a valid metric JSON document: ${file}`)}}function assertMetricNumbers(value,failure=CliErrors.validation){if(typeof value==="number"&&(!Number.isFinite(value)||Number.isInteger(value)&&!Number.isSafeInteger(value))){throw failure("Metric JSON numbers must be finite and integers must be within the safe integer range.","Represent larger integers as decimal strings in the schema, examples and endpoint payloads.")}if(value!==null&&typeof value==="object"){for(const child of Object.values(value))assertMetricNumbers(child,failure)}}
2
+ export function parseMetricJson(text){try{const parsed=JSON.parse(text);assertMetricNumbers(parsed);const stack=[];for(const[token]of text.matchAll(/"(?:\\[\s\S]|[^"\\])*"|[{}\[\],]/g)){const frame=stack[stack.length-1];if(token==="{")stack.push({keys:new Set,keyExpected:true});else if(token==="[")stack.push(null);else if(token==="}"||token==="]")stack.pop();else if(token===","){if(frame)frame.keyExpected=true}else if(frame?.keyExpected){const key=JSON.parse(token);if(frame.keys.has(key))throw CliErrors.validation("Metric JSON must not contain duplicate object keys.");frame.keys.add(key);frame.keyExpected=false}}return parsed}catch(error){if(error instanceof CliError)throw error;throw CliErrors.validation("Cannot parse a valid metric JSON document.")}}export function compileMetricContract(value){assertMetricNumbers(value)
3
+ ;if(!object(value)||!Object.hasOwn(value,"inputSchema")||!Object.hasOwn(value,"outputSchema")||Object.keys(value).some(key=>!["inputSchema","outputSchema","examples"].includes(key))){throw CliErrors.validation("Metric contract requires inputSchema and outputSchema, with optional examples only.")}const compile=(schema,label)=>{if(!object(schema))throw CliErrors.validation(`${label} must be a JSON Schema object.`);try{const ajv=new Ajv2020({strict:true,allErrors:false,coerceTypes:false,useDefaults:false,removeAdditional:false});addFormats.default(ajv);const validate=ajv.compile(schema);if("$async"in validate&&validate.$async)throw new Error("Asynchronous schemas are not supported.");return validate}catch(error){throw CliErrors.validation(`Invalid metric ${label}: ${error instanceof Error?error.message:"schema compilation failed"}`,"Use synchronous JSON Schema 2020-12 with local fragment references; remote schemas are not loaded.")}}
4
+ ;if(!object(value.inputSchema)||value.inputSchema.type!=="object"){throw CliErrors.validation("Metric inputSchema must declare type: object.")}const input=compile(value.inputSchema,"inputSchema");const output=compile(value.outputSchema,"outputSchema");if(value.examples!==undefined){if(!Array.isArray(value.examples))throw CliErrors.validation("Metric contract examples must be an array.");for(const[index,example]of value.examples.entries()){if(!object(example)||!Object.hasOwn(example,"input")||!Object.hasOwn(example,"output")||Object.keys(example).some(key=>!["input","output"].includes(key))){throw CliErrors.validation(`Metric example ${index} requires input and output only.`)}assertMetricInput(input,example.input);if(!output(example.output))throw CliErrors.validation(`Metric example ${index} output: ${validationMessage(output)}`)}}return{input:input,output:output}}function validationMessage(validate){const error=validate.errors?.[0]
5
+ ;return error?`${error.instancePath||"/"} ${error.message}`:"does not match its schema"}export function assertMetricInput(validate,value){if(!object(value))throw CliErrors.validation("Metric input must be a JSON object.");assertMetricNumbers(value);if(!validate(value))throw CliErrors.validation(`Metric input: ${validationMessage(validate)}`)}
@@ -0,0 +1,43 @@
1
+ export interface MetricEntry {
2
+ name: string;
3
+ description: string;
4
+ displayName?: string;
5
+ categoryPath?: string[];
6
+ unit: string;
7
+ contract: unknown;
8
+ target: {
9
+ appCode: string;
10
+ } & ({
11
+ kind: 'sql';
12
+ sqlCode: string;
13
+ } | {
14
+ kind: 'bff';
15
+ functionName: string;
16
+ });
17
+ }
18
+ export declare function validateMetricEntry(entry: unknown, path?: string): MetricEntry;
19
+ /** The canonical metric name is the app-config key; never add or strip a prefix. */
20
+ export declare function validateMetricName(name: string): string;
21
+ export declare function validateMetricDefinition(value: unknown, appCode?: string, name?: string): {
22
+ metric: MetricEntry;
23
+ contract: {
24
+ input: import("ajv/dist/core.js").AnyValidateFunction<unknown>;
25
+ output: import("ajv/dist/core.js").AnyValidateFunction<unknown>;
26
+ };
27
+ };
28
+ /** Authoring must also satisfy app-config publication constraints. */
29
+ export declare function validateMetricPublication(value: unknown, appCode?: string): {
30
+ metric: MetricEntry;
31
+ contract: {
32
+ input: import("ajv/dist/core.js").AnyValidateFunction<unknown>;
33
+ output: import("ajv/dist/core.js").AnyValidateFunction<unknown>;
34
+ };
35
+ };
36
+ /** Assemble only the split storage format; metadata cannot be overridden by value. */
37
+ export declare function readStoredMetric(record: {
38
+ appCode: string;
39
+ key: string;
40
+ tags?: string | null;
41
+ description?: string | null;
42
+ value?: string | null;
43
+ }, appCode: string, name?: string): MetricEntry;
@@ -0,0 +1,4 @@
1
+ import{CliErrors}from"../../errors.js";import{SQLCODE_FLAG}from"../../commands/common/flags.js";import{compileMetricContract,parseMetricJson}from"./contract.js";function invalid(path,message){throw CliErrors.validation(`${path}: ${message}`,"Read rabetbase metric schema and correct the definition.")}function object(value,keys,path,optional=[]){if(!value||typeof value!=="object"||Array.isArray(value))invalid(path,"Expected an object.");const record=value;for(const key of keys){if(!Object.hasOwn(record,key))invalid(`${path}.${key}`,"Required field is missing.")}for(const key of Object.keys(record)){if(!keys.includes(key)&&!optional.includes(key))invalid(`${path}.${key}`,"Unknown field.")}return record}function text(value,path){if(typeof value!=="string"||!value.trim()||value!==value.trim()){invalid(path,"Expected a non-empty string without leading or trailing whitespace.")}return value}export function validateMetricEntry(entry,path="metric"){
2
+ const metric=object(entry,["name","description","unit","target","contract"],path,["displayName","categoryPath"]);if(Object.hasOwn(metric,"displayName"))text(metric.displayName,`${path}.displayName`);if(Object.hasOwn(metric,"categoryPath")){const categories=metric.categoryPath;if(!Array.isArray(categories)||categories.length<1||categories.length>2){invalid(`${path}.categoryPath`,"Expected a category path with one or two levels.")}for(const[index,category]of categories.entries())text(category,`${path}.categoryPath[${index}]`)}validateMetricName(text(metric.name,`${path}.name`));for(const field of["description","unit"])text(metric[field],`${path}.${field}`);const targetValue=metric.target;if(!targetValue||typeof targetValue!=="object"||Array.isArray(targetValue))invalid(`${path}.target`,"Expected an object.");const kind=targetValue.kind;if(kind!=="sql"&&kind!=="bff")invalid(`${path}.target.kind`,"Expected sql or bff.");const selector=kind==="sql"?"sqlCode":"functionName"
3
+ ;const target=object(targetValue,["kind","appCode",selector],`${path}.target`);const appCode=text(target.appCode,`${path}.target.appCode`);const code=text(target[selector],`${path}.target.${selector}`);if(kind==="sql"&&!SQLCODE_FLAG.pattern.regex.test(code)){invalid(`${path}.target.sqlCode`,"Expected a SQL code in xxxxxxxx-xxxxxxxx hexadecimal format.")}return metric}export function validateMetricName(name){if(!/^metrics\.[a-z][a-z0-9_-]*$/.test(name)||name!==name.trim()||name.length>256){throw CliErrors.validation("Metric name must be a metrics.<identifier> key of at most 256 characters.")}return name}export function validateMetricDefinition(value,appCode,name){const metric=validateMetricEntry(value);if(appCode!==undefined&&metric.target.appCode!==appCode||name!==undefined&&metric.name!==name){throw CliErrors.validation("Metric identity does not match the selected app and name.")}const contract=compileMetricContract(metric.contract);return{metric:metric,contract:contract}}
4
+ export function validateMetricPublication(value,appCode){const validated=validateMetricDefinition(value,appCode);if(validated.metric.description.length>256){throw CliErrors.validation("Metric description must not exceed 256 characters.")}return validated}export function readStoredMetric(record,appCode,name){if(!record||typeof record!=="object"||Array.isArray(record)||record.appCode!==appCode||record.tags!=="METRIC"||typeof record.value!=="string"||typeof record.key!=="string"){throw CliErrors.apiError("Invalid metric app-config record.")}const storedName=record.key;const value=parseMetricJson(record.value);if(!value||typeof value!=="object"||Array.isArray(value)||["name","description","tags"].some(field=>Object.hasOwn(value,field))){throw CliErrors.apiError("Metric value must contain only the metric payload, without app-config metadata.")}return validateMetricDefinition({...value,name:storedName,description:record.description},appCode,name).metric}
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from '../../framework/types.js';
2
+ export declare const metricDelete: CommandDefinition;
@@ -0,0 +1,3 @@
1
+ import{deleteAppConfig,getAppConfigByKey}from"../../core/api-client.js";import{CliErrors}from"../../errors.js";import{metricWriteFailure}from"./shared.js";import{APPCODE_FLAG_OPTIONAL}from"../../commands/common/flags.js";import{requireAppConfigId}from"../../commands/app-config/shared.js";import{validateMetricName}from"./definition.js";async function prepare(ctx){const key=ctx.str("name");validateMetricName(key);const before=await getAppConfigByKey(ctx.appCode,key);if(!before)throw CliErrors.validation(`Metric not found: ${key}`,`appCode: ${ctx.appCode}`);if(before.appCode!==ctx.appCode||before.key!==key||before.tags!=="METRIC"){throw CliErrors.validation("The metric key is occupied by a different app-config record.")}return{before:before,id:requireAppConfigId(before)}}function resultData(before,id,dryRun){return{operation:"delete",selector:{appCode:before.appCode,key:before.key,id:id},before:{appCode:before.appCode,key:before.key,id:id,description:before.description,tags:before.tags},
2
+ after:null,dryRun:dryRun,backend:"app-config",warnings:["Only the metric definition is deleted. Referenced SQL/BFF and local files are retained.","Deletion takes effect immediately. Concurrent changes have no version-conflict protection."]}}export const metricDelete={service:"metric",command:"delete",risk:"high-risk-write",strictFlags:true,description:"Delete one application metric definition and verify its absence",flags:[APPCODE_FLAG_OPTIONAL,{name:"name",type:"string",required:true,description:"Exact full metric name (e.g. metrics.paid_order_count)"}],async dryRun(ctx){const{before:before,id:id}=await prepare(ctx);return{method:"POST",url:"/smartapi/app-config/delete",data:resultData(before,id,true)}},async execute(ctx){const{before:before,id:id}=await prepare(ctx);let after;try{await deleteAppConfig({appCode:ctx.appCode,id:id});after=await getAppConfigByKey(ctx.appCode,before.key)}catch(error){
3
+ const hint=`Inspect ${before.key} in app ${ctx.appCode} before deleting again; a missing response does not prove the deletion failed.`;throw metricWriteFailure(error,"Metric deletion could not be verified.",hint)}if(after!==null){throw CliErrors.apiError("Metric delete readback still contains a record.","Inspect the current app-config record before deleting again; it may have changed or been recreated.")}return{ok:true,data:resultData(before,id,false),message:`Deleted metric ${before.key}`}}};
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from '../../framework/types.js';
2
+ export declare const metricDetail: CommandDefinition;
@@ -0,0 +1 @@
1
+ import{getMetricDetail}from"../../core/api-client.js";import{APPCODE_FLAG_OPTIONAL}from"../../commands/common/flags.js";import{validateMetricName,validateMetricDefinition}from"./definition.js";export const metricDetail={service:"metric",command:"detail",risk:"read",strictFlags:true,description:"Read and validate the current editable application metric definition",flags:[APPCODE_FLAG_OPTIONAL,{name:"name",type:"string",required:true,description:"Exact full metric name (e.g. metrics.paid_order_count); use name, not displayName"}],async execute(ctx){const name=ctx.str("name");const record=await getMetricDetail(ctx.appCode,validateMetricName(name));const definition=record&&typeof record==="object"&&"metricDefinition"in record?record.metricDefinition:undefined;return{ok:true,data:validateMetricDefinition(definition,ctx.appCode,name).metric}}};
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from '../../framework/types.js';
2
+ export declare const metricExample: CommandDefinition;
@@ -0,0 +1 @@
1
+ import{readMetricAsset,metricCommand}from"./shared.js";export const metricExample={...metricCommand,command:"example",description:"Read a self-contained fictional metric definition",flags:[],async execute(){return{ok:true,data:await readMetricAsset("example")}}};
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from '../../framework/types.js';
2
+ export declare const metricDefinitions: CommandDefinition[];
@@ -0,0 +1 @@
1
+ import{metricSchema}from"./schema.js";import{metricExample}from"./example.js";import{metricValidate}from"./validate.js";import{metricPublish}from"./publish.js";import{metricList}from"./list.js";import{metricDetail}from"./detail.js";import{metricDelete}from"./delete.js";export const metricDefinitions=[metricSchema,metricExample,metricValidate,metricList,metricDetail,metricPublish,metricDelete];
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from '../../framework/types.js';
2
+ export declare const metricList: CommandDefinition;
@@ -0,0 +1,2 @@
1
+ import{listAppConfigs}from"../../core/api-client.js";import{CliErrors}from"../../errors.js";import{APPCODE_FLAG_OPTIONAL}from"../../commands/common/flags.js";import{readStoredMetric}from"./definition.js";export const metricList={service:"metric",command:"list",risk:"read",strictFlags:true,description:"List application metric summaries, optionally filtering keys or descriptions by keyword",flags:[APPCODE_FLAG_OPTIONAL,{name:"key",type:"string",description:"Case-insensitive literal substring of the config key or description"}],async execute(ctx){const key=ctx.str("key").trim();const records=await listAppConfigs(ctx.appCode,{tags:"METRIC",...key?{keyword:key}:{}});const names=new Set;const summaries=records.map(record=>{const{name:name,description:description,displayName:displayName,categoryPath:categoryPath,unit:unit}=readStoredMetric(record,ctx.appCode);if(names.has(name))throw CliErrors.apiError("Duplicate metric identity in app-config.");names.add(name);return{name:name,
2
+ description:description,...displayName===undefined?{}:{displayName:displayName},...categoryPath===undefined?{}:{categoryPath:categoryPath},unit:unit}});const metrics=summaries.sort((a,b)=>a.name<b.name?-1:a.name>b.name?1:0);return{ok:true,data:{appCode:ctx.appCode,count:metrics.length,metrics:metrics}}}};
@@ -0,0 +1,8 @@
1
+ export interface MetricPublicationChange {
2
+ path: string;
3
+ operation: 'add' | 'remove' | 'replace';
4
+ before?: unknown;
5
+ after?: unknown;
6
+ }
7
+ /** Structural changes only: arrays are atomic, and no compatibility is inferred. */
8
+ export declare function diffMetricPublication(before: Record<string, unknown> | null, after: Record<string, unknown>): MetricPublicationChange[];
@@ -0,0 +1 @@
1
+ import{isDeepStrictEqual}from"node:util";const object=value=>value!==null&&typeof value==="object"&&!Array.isArray(value);const escapePointer=key=>key.replace(/~/g,"~0").replace(/\//g,"~1");export function diffMetricPublication(before,after){const changes=[];const visit=(left,right,path)=>{for(const key of new Set([...Object.keys(left),...Object.keys(right)])){const next=`${path}/${escapePointer(key)}`;if(!Object.hasOwn(left,key))changes.push({path:next,operation:"add",after:right[key]});else if(!Object.hasOwn(right,key))changes.push({path:next,operation:"remove",before:left[key]});else if(object(left[key])&&object(right[key]))visit(left[key],right[key],next);else if(!isDeepStrictEqual(left[key],right[key])){changes.push({path:next,operation:"replace",before:left[key],after:right[key]})}}};visit(before??{},after,"");return changes.sort((a,b)=>a.path<b.path?-1:a.path>b.path?1:0)}
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from '../../framework/types.js';
2
+ export declare const metricPublish: CommandDefinition;
@@ -0,0 +1,4 @@
1
+ import{resolve}from"node:path";import{createAppConfig,getAppConfigByKey,updateAppConfig}from"../../core/api-client.js";import{CliErrors}from"../../errors.js";import{metricWriteFailure}from"./shared.js";import{APPCODE_FLAG_OPTIONAL}from"../../commands/common/flags.js";import{requireAppConfigId}from"../../commands/app-config/shared.js";import{readMetricJson}from"./contract.js";import{readStoredMetric,validateMetricPublication}from"./definition.js";import{diffMetricPublication}from"./publication-diff.js";const TAG="METRIC";async function prepare(ctx){const{metric:metric}=validateMetricPublication(await readMetricJson(resolve(ctx.str("file"))),ctx.appCode);const key=metric.name;const before=await getAppConfigByKey(ctx.appCode,key);if(before&&(before.appCode!==ctx.appCode||before.key!==key||before.tags!==TAG)){throw CliErrors.validation("The metric key is occupied by a different app-config record.")}if(before)requireAppConfigId(before);let previous=null;if(before){try{previous={
2
+ ...readStoredMetric(before,ctx.appCode,key)}}catch{throw CliErrors.validation("The current metric definition cannot be reviewed.","Inspect the current metric with app-config get before publishing; no changes were written.")}}const changes=diffMetricPublication(previous,{...metric});const{name:name,description:description,...payload}=metric;return{before:before,changes:changes,input:{appCode:ctx.appCode,key:key,description:description,tags:TAG,value:JSON.stringify(payload)}}}function metadata(item){return item?{appCode:item.appCode,key:item.key,description:item.description,tags:item.tags}:null}function resultData(before,after,changes,dryRun){const warnings=["Updates take effect immediately. Concurrent publishing has no version-conflict protection."];if(before&&changes.some(change=>/^\/(target|contract)(\/|$)/.test(change.path))){warnings.push("Target or contract changed. Revalidate consumers before relying on the new definition.")}return{operation:before?"update":"create",selector:{
3
+ appCode:after.appCode,key:after.key},before:metadata(before),after:metadata(after),dryRun:dryRun,backend:"app-config",changes:changes,warnings:warnings}}export const metricPublish={service:"metric",command:"publish",risk:"write",strictFlags:true,description:"Validate and publish one application metric through app-config",flags:[APPCODE_FLAG_OPTIONAL,{name:"file",type:"string",required:true,description:"Self-contained metric definition JSON file"}],async dryRun(ctx){const{before:before,input:input,changes:changes}=await prepare(ctx);return{method:"POST",url:`/smartapi/app-config/${before?"update":"create"}`,data:resultData(before,input,changes,true)}},async execute(ctx){const{before:before,input:input,changes:changes}=await prepare(ctx);let after;try{if(before)await updateAppConfig({...input,id:requireAppConfigId(before)});else await createAppConfig(input);after=await getAppConfigByKey(ctx.appCode,input.key)}catch(error){
4
+ const hint=`Inspect ${input.key} in app ${ctx.appCode} before publishing again; a missing response does not prove the write failed.`;throw metricWriteFailure(error,"Metric publication could not be verified.",hint)}if(!after||after.appCode!==input.appCode||after.key!==input.key||after.tags!==TAG||after.description!==input.description||after.value!==input.value){throw CliErrors.apiError("Metric publish readback did not match the submitted definition.","The write may have succeeded. Inspect the app-config record before publishing again.")}return{ok:true,data:resultData(before,after,changes,false),message:`Published metric ${input.key}`}}};
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from '../../framework/types.js';
2
+ export declare const metricSchema: CommandDefinition;
@@ -0,0 +1 @@
1
+ import{readMetricAsset,metricCommand}from"./shared.js";export const metricSchema={...metricCommand,command:"schema",description:"Read the bundled metric definition or contract JSON Schema",flags:[{name:"kind",type:"string",enum:["definition","contract"],description:"Schema kind (default: definition)"}],async execute(ctx){return{ok:true,data:await readMetricAsset(ctx.str("kind")==="contract"?"contract":"definition")}}};
@@ -0,0 +1,14 @@
1
+ import { CliError } from '../../errors.js';
2
+ export declare const metricCommand: {
3
+ readonly service: "metric";
4
+ readonly risk: "read";
5
+ readonly requiresAuth: false;
6
+ readonly requiresAppCode: false;
7
+ readonly hasFormat: true;
8
+ readonly strictFlags: true;
9
+ readonly structuredErrors: true;
10
+ };
11
+ /** Read the bundled authoring assets without authentication or network access. */
12
+ export declare function readMetricAsset(kind: 'definition' | 'contract' | 'example'): Promise<any>;
13
+ /** Keep diagnostics while replacing generic retry advice with write-state inspection. */
14
+ export declare function metricWriteFailure(error: unknown, message: string, hint: string): CliError;
@@ -0,0 +1,2 @@
1
+ import{readFile}from"node:fs/promises";import{CliError,CliErrors}from"../../errors.js";import{getPlatformErrorCode}from"../../core/api-client.js";export const metricCommand={service:"metric",risk:"read",requiresAuth:false,requiresAppCode:false,hasFormat:true,strictFlags:true,structuredErrors:true};export async function readMetricAsset(kind){const file=kind==="example"?"definition.json":"metric-definition.schema.json";const asset=JSON.parse(await readFile(new URL(`../../../templates/metrics/${file}`,import.meta.url),"utf8"));return kind==="contract"?{$schema:asset.$schema,...asset.properties.contract}:asset}export function metricWriteFailure(error,message,hint){if(!(error instanceof CliError))return CliErrors.apiError(message,hint);const remoteCode=getPlatformErrorCode(error);const descriptors=Object.getOwnPropertyDescriptors(error);return Object.defineProperties(new CliError(error.code,error.exitCode,error.message),{...descriptors,hint:{...descriptors.hint,
2
+ value:[remoteCode?`API error code: ${remoteCode}.`:undefined,hint].filter(Boolean).join(" ")}})}
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from '../../framework/types.js';
2
+ export declare const metricValidate: CommandDefinition;
@@ -0,0 +1 @@
1
+ import{resolve}from"node:path";import{metricCommand}from"./shared.js";import{readMetricJson}from"./contract.js";import{validateMetricPublication}from"./definition.js";export const metricValidate={...metricCommand,command:"validate",description:"Validate a metric definition, contracts and examples without executing queries",flags:[{name:"file",type:"string",required:true,description:"Self-contained metric definition JSON file"}],async execute(ctx){const file=ctx.str("file");validateMetricPublication(await readMetricJson(resolve(file)));return{ok:true,data:{valid:true,verification:"definition-and-contract"}}}};
@@ -1 +1,4 @@
1
- const a192_0xcc02aa=a192_0xd515;(function(_0xa81574,_0x349ae0){const _0x1bf603=a192_0xd515,_0x47799a=_0xa81574();while(!![]){try{const _0x1b9366=parseInt(_0x1bf603(0x14b))/0x1+-parseInt(_0x1bf603(0x14e))/0x2*(parseInt(_0x1bf603(0x142))/0x3)+parseInt(_0x1bf603(0x145))/0x4*(parseInt(_0x1bf603(0x143))/0x5)+-parseInt(_0x1bf603(0x158))/0x6*(-parseInt(_0x1bf603(0x140))/0x7)+-parseInt(_0x1bf603(0x149))/0x8*(parseInt(_0x1bf603(0x147))/0x9)+parseInt(_0x1bf603(0x156))/0xa+-parseInt(_0x1bf603(0x144))/0xb;if(_0x1b9366===_0x349ae0)break;else _0x47799a['push'](_0x47799a['shift']());}catch(_0x685f1f){_0x47799a['push'](_0x47799a['shift']());}}}(a192_0xae7f,0x9489f));import{asDryRunResult}from'../../commands/common/dry-run.js';import{createNotificationChannelConfig,getNotificationChannelConfig,isPlatformTransportFailure}from'../../core/api-client.js';import{assertSingleNotificationSource,createMutationInput,DEFAULT_NOTIFICATION_CONNECT_TIMEOUT,DEFAULT_NOTIFICATION_READ_TIMEOUT,normalizeExactNotificationConfig,notificationError,notificationLookupCommand,NOTIFICATION_APP_FLAG,NOTIFICATION_INPUT_FLAGS,projectNotificationConfig,readNotificationDocument,safeApiFailure}from'../../commands/notification/shared.js';const CREATE_PATH='/notification/channel-config/create';async function prepareCreate(_0xb6085e){const _0x1425ce=a192_0xd515,_0xb077a6=await readNotificationDocument(_0xb6085e,_0x1425ce(0x14a)),_0x25f3c6=createMutationInput(_0xb6085e[_0x1425ce(0x15b)],_0xb077a6);return{'document':_0xb077a6,'input':_0x25f3c6,'planned':projectNotificationConfig({'appCode':_0xb6085e['appCode'],'configName':_0xb077a6[_0x1425ce(0x13c)],'channelType':_0xb077a6[_0x1425ce(0x154)],'endpointUrl':_0xb077a6[_0x1425ce(0x14c)],'channelConfig':_0xb077a6[_0x1425ce(0x141)],'description':_0xb077a6[_0x1425ce(0x15c)],'connectTimeout':_0xb077a6[_0x1425ce(0x13f)]??DEFAULT_NOTIFICATION_CONNECT_TIMEOUT,'readTimeout':_0xb077a6[_0x1425ce(0x13e)]??DEFAULT_NOTIFICATION_READ_TIMEOUT})};}export const notificationConfigCreate={'service':'notification','command':a192_0xcc02aa(0x14d),'description':a192_0xcc02aa(0x13b),'risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[...NOTIFICATION_INPUT_FLAGS,NOTIFICATION_APP_FLAG],async 'validate'(_0x1d9196){assertSingleNotificationSource(_0x1d9196);},async 'dryRun'(_0x349ffe){const _0x2bcad7=a192_0xcc02aa,_0x816cae=await prepareCreate(_0x349ffe),_0x4b4b8d=notificationLookupCommand(_0x349ffe[_0x2bcad7(0x15b)],_0x816cae[_0x2bcad7(0x151)][_0x2bcad7(0x154)]);return asDryRunResult({'operation':_0x2bcad7(0x14a),'selector':{'appCode':_0x349ffe[_0x2bcad7(0x15b)],'configName':_0x816cae[_0x2bcad7(0x151)][_0x2bcad7(0x13c)],'channelType':_0x816cae[_0x2bcad7(0x151)][_0x2bcad7(0x154)]},'before':null,'after':_0x816cae[_0x2bcad7(0x157)],'dryRun':!![],'backend':{'method':'POST','path':CREATE_PATH},'warnings':[],'verification':{'status':_0x2bcad7(0x157),'lookupCommand':_0x4b4b8d}},{'method':'POST','url':CREATE_PATH});},async 'execute'(_0x328eba){const _0x2f3fed=a192_0xcc02aa,_0x356a62=await prepareCreate(_0x328eba),_0x1817ae=notificationLookupCommand(_0x328eba[_0x2f3fed(0x15b)],_0x356a62[_0x2f3fed(0x151)]['channelType']);let _0x4eb716;try{_0x4eb716=await createNotificationChannelConfig(_0x356a62[_0x2f3fed(0x152)]);}catch(_0x1cebd2){if(isPlatformTransportFailure(_0x1cebd2))throw notificationError(_0x2f3fed(0x159),_0x2f3fed(0x148),_0x2f3fed(0x150)+_0x1817ae+';\x20do\x20not\x20resubmit.');throw safeApiFailure(_0x2f3fed(0x14a),'mutation',_0x2f3fed(0x150)+_0x1817ae+_0x2f3fed(0x153));}if(!Number[_0x2f3fed(0x155)](_0x4eb716)||_0x4eb716<=0x0)throw notificationError(_0x2f3fed(0x159),_0x2f3fed(0x15d),_0x2f3fed(0x150)+_0x1817ae+_0x2f3fed(0x146));let _0x300073;try{const _0x17ca55=await getNotificationChannelConfig(_0x4eb716,_0x328eba[_0x2f3fed(0x15b)]);_0x300073=normalizeExactNotificationConfig(_0x17ca55,_0x4eb716,_0x328eba[_0x2f3fed(0x15b)]);}catch{throw safeApiFailure(_0x2f3fed(0x14a),_0x2f3fed(0x15a),_0x2f3fed(0x150)+_0x1817ae+';\x20do\x20not\x20resubmit\x20automatically.');}return{'ok':!![],'data':{'operation':_0x2f3fed(0x14a),'selector':{'appCode':_0x300073['appCode'],'id':_0x300073['id'],'configCode':_0x300073['configCode'],'configName':_0x300073[_0x2f3fed(0x13c)],'channelType':_0x300073[_0x2f3fed(0x154)]},'before':null,'after':projectNotificationConfig(_0x300073),'dryRun':![],'backend':{'method':_0x2f3fed(0x13d),'path':CREATE_PATH},'warnings':[],'verification':{'status':_0x2f3fed(0x14f),'lookupCommand':_0x1817ae}},'message':'Created\x20notification\x20config\x20'+_0x300073['id']};}};function a192_0xd515(_0x1eee9c,_0x19155b){_0x1eee9c=_0x1eee9c-0x13b;const _0xae7f2e=a192_0xae7f();let _0xd51550=_0xae7f2e[_0x1eee9c];return _0xd51550;}function a192_0xae7f(){const _0x23b656=['notification_config_create_outcome_unknown','verification','appCode','description','Notification\x20config\x20create\x20returned\x20no\x20usable\x20server\x20ID.','Create\x20an\x20app-level\x20notification\x20config\x20from\x20a\x20secure\x20JSON\x20source','configName','POST','readTimeout','connectTimeout','1805454qeOKkD','channelConfig','2279535HSpTDP','3635VTduiD','2950299kJPcVS','796tVkbSY',';\x20do\x20not\x20resubmit.','639qdgoaZ','Notification\x20config\x20create\x20outcome\x20is\x20unknown\x20because\x20no\x20server\x20ID\x20was\x20received.','3440xagQnV','create','885973ocZHSc','endpointUrl','config-create','2DlgOMv','verified','Inspect\x20with\x20','document','input',';\x20no\x20automatic\x20retry\x20was\x20attempted.','channelType','isSafeInteger','3784310eUjiHb','planned','6TSujNE'];a192_0xae7f=function(){return _0x23b656;};return a192_0xae7f();}
1
+ import{asDryRunResult}from"../../commands/common/dry-run.js";import{createNotificationChannelConfig,getNotificationChannelConfig,isPlatformTransportFailure}from"../../core/api-client.js";import{assertSingleNotificationSource,createMutationInput,DEFAULT_NOTIFICATION_CONNECT_TIMEOUT,DEFAULT_NOTIFICATION_READ_TIMEOUT,normalizeExactNotificationConfig,notificationError,notificationLookupCommand,NOTIFICATION_APP_FLAG,NOTIFICATION_INPUT_FLAGS,projectNotificationConfig,readNotificationDocument,safeApiFailure}from"../../commands/notification/shared.js";const CREATE_PATH="/notification/channel-config/create";async function prepareCreate(ctx){const document=await readNotificationDocument(ctx,"create");const input=createMutationInput(ctx.appCode,document);return{document:document,input:input,planned:projectNotificationConfig({appCode:ctx.appCode,configName:document.configName,channelType:document.channelType,endpointUrl:document.endpointUrl,channelConfig:document.channelConfig,
2
+ description:document.description,connectTimeout:document.connectTimeout??DEFAULT_NOTIFICATION_CONNECT_TIMEOUT,readTimeout:document.readTimeout??DEFAULT_NOTIFICATION_READ_TIMEOUT})}}export const notificationConfigCreate={service:"notification",command:"config-create",description:"Create an app-level notification config from a secure JSON source",risk:"write",requiresAppCode:true,structuredErrors:true,flags:[...NOTIFICATION_INPUT_FLAGS,NOTIFICATION_APP_FLAG],async validate(ctx){assertSingleNotificationSource(ctx)},async dryRun(ctx){const prepared=await prepareCreate(ctx);const lookupCommand=notificationLookupCommand(ctx.appCode,prepared.document.channelType);return asDryRunResult({operation:"create",selector:{appCode:ctx.appCode,configName:prepared.document.configName,channelType:prepared.document.channelType},before:null,after:prepared.planned,dryRun:true,backend:{method:"POST",path:CREATE_PATH},warnings:[],verification:{status:"planned",lookupCommand:lookupCommand}},{method:"POST",
3
+ url:CREATE_PATH})},async execute(ctx){const prepared=await prepareCreate(ctx);const lookupCommand=notificationLookupCommand(ctx.appCode,prepared.document.channelType);let id;try{id=await createNotificationChannelConfig(prepared.input)}catch(error){if(isPlatformTransportFailure(error)){throw notificationError("notification_config_create_outcome_unknown","Notification config create outcome is unknown because no server ID was received.",`Inspect with ${lookupCommand}; do not resubmit.`)}throw safeApiFailure("create","mutation",`Inspect with ${lookupCommand}; no automatic retry was attempted.`)}if(!Number.isSafeInteger(id)||id<=0){throw notificationError("notification_config_create_outcome_unknown","Notification config create returned no usable server ID.",`Inspect with ${lookupCommand}; do not resubmit.`)}let after;try{const item=await getNotificationChannelConfig(id,ctx.appCode);after=normalizeExactNotificationConfig(item,id,ctx.appCode)}catch{
4
+ throw safeApiFailure("create","verification",`Inspect with ${lookupCommand}; do not resubmit automatically.`)}return{ok:true,data:{operation:"create",selector:{appCode:after.appCode,id:after.id,configCode:after.configCode,configName:after.configName,channelType:after.channelType},before:null,after:projectNotificationConfig(after),dryRun:false,backend:{method:"POST",path:CREATE_PATH},warnings:[],verification:{status:"verified",lookupCommand:lookupCommand}},message:`Created notification config ${after.id}`}}};
@@ -1 +1,4 @@
1
- function a193_0x16cf(){const _0x16b2cf=['Notification\x20config\x20','notification','3KLwawQ','POST','1082324EhTMRp','Inspect\x20with\x20','notification_config_delete_outcome_unknown','notification_config_delete_verification_unavailable','unshift','high-risk-write','appCode',';\x20do\x20not\x20resubmit\x20automatically.','6BWHqPp','2602255RnOuSW','93424gAhqhV','6768251ibmayl','/notification/channel-config/delete','6469570lCKtlT','\x20delete\x20could\x20not\x20be\x20verified.','5202532jPoXgx','verified','Deleting\x20this\x20app-level\x20config\x20may\x20make\x20dataset-level\x20channels\x20that\x20reference\x20it\x20unavailable;\x20dataset\x20references\x20were\x20not\x20verified\x20by\x20the\x20CLI.','delete','9EFCjrl','before','1948173ZWRSGT',';\x20no\x20automatic\x20retry\x20was\x20attempted.','channelType'];a193_0x16cf=function(){return _0x16b2cf;};return a193_0x16cf();}const a193_0x229609=a193_0x25d6;function a193_0x25d6(_0x4da0a7,_0x286c12){_0x4da0a7=_0x4da0a7-0x175;const _0x16cfee=a193_0x16cf();let _0x25d636=_0x16cfee[_0x4da0a7];return _0x25d636;}(function(_0x5ddcaa,_0x5e0d36){const _0x517b67=a193_0x25d6,_0x57332c=_0x5ddcaa();while(!![]){try{const _0x4d6861=parseInt(_0x517b67(0x188))/0x1+parseInt(_0x517b67(0x18f))/0x2+-parseInt(_0x517b67(0x18d))/0x3*(parseInt(_0x517b67(0x182))/0x4)+-parseInt(_0x517b67(0x17c))/0x5+-parseInt(_0x517b67(0x17b))/0x6*(-parseInt(_0x517b67(0x17e))/0x7)+-parseInt(_0x517b67(0x17d))/0x8+-parseInt(_0x517b67(0x186))/0x9*(parseInt(_0x517b67(0x180))/0xa);if(_0x4d6861===_0x5e0d36)break;else _0x57332c['push'](_0x57332c['shift']());}catch(_0x1a93d5){_0x57332c['push'](_0x57332c['shift']());}}}(a193_0x16cf,0xee67d));import{asDryRunResult}from'../../commands/common/dry-run.js';import{deleteNotificationChannelConfig,isPlatformTransportFailure,listNotificationChannelConfigs}from'../../core/api-client.js';import{notificationError,notificationLookupCommand,notificationSelector,NOTIFICATION_APP_FLAG,NOTIFICATION_ID_FLAG,projectNotificationConfig,readNotificationId,requireNotificationExplicitYes,requireExactNotificationConfig,safeApiFailure,validateNotificationDeleteReadback}from'../../commands/notification/shared.js';const DELETE_PATH=a193_0x229609(0x17f),REFERENCE_WARNING=a193_0x229609(0x184);async function prepareDelete(_0x5e8790){const _0x1185f7=a193_0x229609,_0x245da0=readNotificationId(_0x5e8790),_0x4a9436=await requireExactNotificationConfig(_0x5e8790[_0x1185f7(0x179)],_0x245da0,_0x1185f7(0x185));return{'id':_0x245da0,'before':_0x4a9436};}export const notificationConfigDelete={'service':a193_0x229609(0x18c),'command':'config-delete','description':'Delete\x20an\x20app-level\x20notification\x20config\x20after\x20exact\x20preflight','risk':a193_0x229609(0x178),'requiresAppCode':!![],'structuredErrors':!![],'flags':[NOTIFICATION_ID_FLAG,NOTIFICATION_APP_FLAG],async 'validate'(_0x38bb7d){readNotificationId(_0x38bb7d),requireNotificationExplicitYes(_0x38bb7d);},async 'dryRun'(_0x12ae63){const _0xaf9a21=a193_0x229609,_0x29192f=await prepareDelete(_0x12ae63),_0x257cfa=notificationLookupCommand(_0x12ae63['appCode'],_0x29192f[_0xaf9a21(0x187)][_0xaf9a21(0x18a)]);return asDryRunResult({'operation':'delete','selector':notificationSelector(_0x29192f['before']),'before':projectNotificationConfig(_0x29192f['before']),'after':null,'dryRun':!![],'backend':{'method':_0xaf9a21(0x18e),'path':DELETE_PATH},'warnings':[REFERENCE_WARNING],'verification':{'status':'planned','lookupCommand':_0x257cfa}},{'method':'POST','url':DELETE_PATH});},async 'execute'(_0x57b843){const _0x537fc0=a193_0x229609;requireNotificationExplicitYes(_0x57b843);const _0x5dd997=await prepareDelete(_0x57b843),_0x5c21ba=notificationLookupCommand(_0x57b843[_0x537fc0(0x179)],_0x5dd997[_0x537fc0(0x187)][_0x537fc0(0x18a)]);let _0x250f71=![];try{await deleteNotificationChannelConfig(_0x5dd997['id'],_0x57b843[_0x537fc0(0x179)]);}catch(_0x172b75){if(!isPlatformTransportFailure(_0x172b75))throw safeApiFailure('delete','mutation',_0x537fc0(0x190)+_0x5c21ba+_0x537fc0(0x189));_0x250f71=!![];}let _0xbfa4cc;try{_0xbfa4cc=await listNotificationChannelConfigs(_0x57b843[_0x537fc0(0x179)],_0x5dd997[_0x537fc0(0x187)][_0x537fc0(0x18a)]),validateNotificationDeleteReadback(_0xbfa4cc,_0x57b843[_0x537fc0(0x179)],_0x5dd997[_0x537fc0(0x187)][_0x537fc0(0x18a)]);}catch{throw notificationError(_0x250f71?_0x537fc0(0x175):_0x537fc0(0x176),'Notification\x20config\x20'+_0x5dd997['id']+_0x537fc0(0x181),_0x537fc0(0x190)+_0x5c21ba+_0x537fc0(0x17a));}if(_0xbfa4cc['some'](_0x23be3d=>_0x23be3d['id']===_0x5dd997['id']))throw notificationError(_0x250f71?_0x537fc0(0x175):'notification_config_delete_verification_failed',_0x537fc0(0x18b)+_0x5dd997['id']+'\x20remains\x20present\x20after\x20delete.',_0x537fc0(0x190)+_0x5c21ba+_0x537fc0(0x17a));const _0x4a5784=[REFERENCE_WARNING];return _0x250f71&&_0x4a5784[_0x537fc0(0x177)]('Delete\x20response\x20was\x20unavailable;\x20list\x20readback\x20proved\x20ID\x20absence\x20without\x20resubmitting.'),{'ok':!![],'data':{'operation':_0x537fc0(0x185),'selector':notificationSelector(_0x5dd997[_0x537fc0(0x187)]),'before':projectNotificationConfig(_0x5dd997[_0x537fc0(0x187)]),'after':null,'dryRun':![],'backend':{'method':_0x537fc0(0x18e),'path':DELETE_PATH},'warnings':_0x4a5784,'verification':{'status':_0x537fc0(0x183),'absenceConfirmed':!![],'recoveredAfterUnknownResponse':_0x250f71,'lookupCommand':_0x5c21ba}},'message':'Deleted\x20notification\x20config\x20'+_0x5dd997['id']};}};
1
+ import{asDryRunResult}from"../../commands/common/dry-run.js";import{deleteNotificationChannelConfig,isPlatformTransportFailure,listNotificationChannelConfigs}from"../../core/api-client.js";import{notificationError,notificationLookupCommand,notificationSelector,NOTIFICATION_APP_FLAG,NOTIFICATION_ID_FLAG,projectNotificationConfig,readNotificationId,requireNotificationExplicitYes,requireExactNotificationConfig,safeApiFailure,validateNotificationDeleteReadback}from"../../commands/notification/shared.js";const DELETE_PATH="/notification/channel-config/delete";const REFERENCE_WARNING="Deleting this app-level config may make dataset-level channels that reference it unavailable; dataset references were not verified by the CLI.";async function prepareDelete(ctx){const id=readNotificationId(ctx);const before=await requireExactNotificationConfig(ctx.appCode,id,"delete");return{id:id,before:before}}export const notificationConfigDelete={service:"notification",command:"config-delete",
2
+ description:"Delete an app-level notification config after exact preflight",risk:"high-risk-write",requiresAppCode:true,structuredErrors:true,flags:[NOTIFICATION_ID_FLAG,NOTIFICATION_APP_FLAG],async validate(ctx){readNotificationId(ctx);requireNotificationExplicitYes(ctx)},async dryRun(ctx){const prepared=await prepareDelete(ctx);const lookupCommand=notificationLookupCommand(ctx.appCode,prepared.before.channelType);return asDryRunResult({operation:"delete",selector:notificationSelector(prepared.before),before:projectNotificationConfig(prepared.before),after:null,dryRun:true,backend:{method:"POST",path:DELETE_PATH},warnings:[REFERENCE_WARNING],verification:{status:"planned",lookupCommand:lookupCommand}},{method:"POST",url:DELETE_PATH})},async execute(ctx){requireNotificationExplicitYes(ctx);const prepared=await prepareDelete(ctx);const lookupCommand=notificationLookupCommand(ctx.appCode,prepared.before.channelType);let recoveredAfterUnknownResponse=false;try{
3
+ await deleteNotificationChannelConfig(prepared.id,ctx.appCode)}catch(error){if(!isPlatformTransportFailure(error)){throw safeApiFailure("delete","mutation",`Inspect with ${lookupCommand}; no automatic retry was attempted.`)}recoveredAfterUnknownResponse=true}let items;try{items=await listNotificationChannelConfigs(ctx.appCode,prepared.before.channelType);validateNotificationDeleteReadback(items,ctx.appCode,prepared.before.channelType)}catch{throw notificationError(recoveredAfterUnknownResponse?"notification_config_delete_outcome_unknown":"notification_config_delete_verification_unavailable",`Notification config ${prepared.id} delete could not be verified.`,`Inspect with ${lookupCommand}; do not resubmit automatically.`)}if(items.some(item=>item.id===prepared.id)){
4
+ throw notificationError(recoveredAfterUnknownResponse?"notification_config_delete_outcome_unknown":"notification_config_delete_verification_failed",`Notification config ${prepared.id} remains present after delete.`,`Inspect with ${lookupCommand}; do not resubmit automatically.`)}const warnings=[REFERENCE_WARNING];if(recoveredAfterUnknownResponse){warnings.unshift("Delete response was unavailable; list readback proved ID absence without resubmitting.")}return{ok:true,data:{operation:"delete",selector:notificationSelector(prepared.before),before:projectNotificationConfig(prepared.before),after:null,dryRun:false,backend:{method:"POST",path:DELETE_PATH},warnings:warnings,verification:{status:"verified",absenceConfirmed:true,recoveredAfterUnknownResponse:recoveredAfterUnknownResponse,lookupCommand:lookupCommand}},message:`Deleted notification config ${prepared.id}`}}};
@@ -1 +1,2 @@
1
- function a194_0x3bce(_0x30960b,_0x5cef2c){_0x30960b=_0x30960b-0x15c;const _0x5dfa67=a194_0x5dfa();let _0x3bcebc=_0x5dfa67[_0x30960b];return _0x3bcebc;}const a194_0x5ad703=a194_0x3bce;(function(_0x21e5d4,_0x3a39fc){const _0xc746d5=a194_0x3bce,_0x162671=_0x21e5d4();while(!![]){try{const _0x52f232=parseInt(_0xc746d5(0x177))/0x1*(-parseInt(_0xc746d5(0x162))/0x2)+parseInt(_0xc746d5(0x169))/0x3+parseInt(_0xc746d5(0x16e))/0x4+parseInt(_0xc746d5(0x163))/0x5*(-parseInt(_0xc746d5(0x16c))/0x6)+-parseInt(_0xc746d5(0x168))/0x7*(parseInt(_0xc746d5(0x16b))/0x8)+parseInt(_0xc746d5(0x15f))/0x9+parseInt(_0xc746d5(0x16a))/0xa;if(_0x52f232===_0x3a39fc)break;else _0x162671['push'](_0x162671['shift']());}catch(_0x88abfd){_0x162671['push'](_0x162671['shift']());}}}(a194_0x5dfa,0x59b8d));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a194_0x5dfa(){const _0x360d40=['boolean','686393OHPOpR','bool','read','--all\x20and\x20--type\x20are\x20mutually\x20exclusive.','notification','4026546iUdiTJ','map','all','2Orqqts','5QPXlMu','List\x20configs\x20for\x20every\x20supported\x20notification\x20channel\x20type','Notification\x20channel\x20type','str','Use\x20--all,\x20or\x20query\x20one\x20explicit\x20--type.','70fvVYdA','668244YIijyq','6086450xokjhY','278216PqDTEg','1245102arJIjn','Found\x20','1321576xytgFj','appCode','string','\x20notification\x20config(s)\x20across\x20all\x20channel\x20types','type','trim','length','\x20notification\x20config(s)'];a194_0x5dfa=function(){return _0x360d40;};return a194_0x5dfa();}import{listNotificationChannelConfigs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{NOTIFICATION_CHANNEL_TYPES,projectNotificationListConfig,readNotificationChannelType}from'../../commands/notification/shared.js';export const notificationConfigList={'service':a194_0x5ad703(0x15e),'command':'config-list','description':'List\x20app-level\x20notification\x20configs\x20and\x20their\x20configCode\x20values','risk':a194_0x5ad703(0x15c),'flags':[APPCODE_FLAG_OPTIONAL,{'name':a194_0x5ad703(0x172),'type':a194_0x5ad703(0x170),'description':a194_0x5ad703(0x165),'enum':NOTIFICATION_CHANNEL_TYPES},{'name':'all','type':a194_0x5ad703(0x176),'default':![],'description':a194_0x5ad703(0x164)}],async 'validate'(_0x1e7899){const _0x5b1234=a194_0x5ad703;if(_0x1e7899[_0x5b1234(0x178)](_0x5b1234(0x161))&&_0x1e7899[_0x5b1234(0x166)](_0x5b1234(0x172))[_0x5b1234(0x173)]())throw CliErrors['validation'](_0x5b1234(0x15d),_0x5b1234(0x167));if(_0x1e7899[_0x5b1234(0x178)](_0x5b1234(0x161)))return;readNotificationChannelType(_0x1e7899);},async 'execute'(_0x5ef68a){const _0x45d8eb=a194_0x5ad703;if(_0x5ef68a[_0x45d8eb(0x178)](_0x45d8eb(0x161))){const _0x373464=await Promise[_0x45d8eb(0x161)](NOTIFICATION_CHANNEL_TYPES[_0x45d8eb(0x160)](_0x401a52=>listNotificationChannelConfigs(_0x5ef68a[_0x45d8eb(0x16f)],_0x401a52))),_0x777314=_0x373464['flat']()[_0x45d8eb(0x160)](projectNotificationListConfig);return{'ok':!![],'data':{'appCode':_0x5ef68a['appCode'],'channelTypes':NOTIFICATION_CHANNEL_TYPES,'count':_0x777314[_0x45d8eb(0x174)],'configs':_0x777314},'message':_0x45d8eb(0x16d)+_0x777314[_0x45d8eb(0x174)]+_0x45d8eb(0x171)};}const _0x474583=readNotificationChannelType(_0x5ef68a),_0x3b9eea=await listNotificationChannelConfigs(_0x5ef68a[_0x45d8eb(0x16f)],_0x474583),_0x27f967=_0x3b9eea[_0x45d8eb(0x160)](projectNotificationListConfig);return{'ok':!![],'data':{'appCode':_0x5ef68a[_0x45d8eb(0x16f)],'channelType':_0x474583,'count':_0x27f967[_0x45d8eb(0x174)],'configs':_0x27f967},'message':'Found\x20'+_0x27f967[_0x45d8eb(0x174)]+'\x20'+_0x474583+_0x45d8eb(0x175)};}};
1
+ import{APPCODE_FLAG_OPTIONAL}from"../../commands/common/flags.js";import{listNotificationChannelConfigs}from"../../core/api-client.js";import{CliErrors}from"../../errors.js";import{NOTIFICATION_CHANNEL_TYPES,projectNotificationListConfig,readNotificationChannelType}from"../../commands/notification/shared.js";export const notificationConfigList={service:"notification",command:"config-list",description:"List app-level notification configs and their configCode values",risk:"read",flags:[APPCODE_FLAG_OPTIONAL,{name:"type",type:"string",description:"Notification channel type",enum:NOTIFICATION_CHANNEL_TYPES},{name:"all",type:"boolean",default:false,description:"List configs for every supported notification channel type"}],async validate(ctx){if(ctx.bool("all")&&ctx.str("type").trim()){throw CliErrors.validation("--all and --type are mutually exclusive.","Use --all, or query one explicit --type.")}if(ctx.bool("all"))return;readNotificationChannelType(ctx)},async execute(ctx){
2
+ if(ctx.bool("all")){const results=await Promise.all(NOTIFICATION_CHANNEL_TYPES.map(channelType=>listNotificationChannelConfigs(ctx.appCode,channelType)));const configs=results.flat().map(projectNotificationListConfig);return{ok:true,data:{appCode:ctx.appCode,channelTypes:NOTIFICATION_CHANNEL_TYPES,count:configs.length,configs:configs},message:`Found ${configs.length} notification config(s) across all channel types`}}const channelType=readNotificationChannelType(ctx);const items=await listNotificationChannelConfigs(ctx.appCode,channelType);const configs=items.map(projectNotificationListConfig);return{ok:true,data:{appCode:ctx.appCode,channelType:channelType,count:configs.length,configs:configs},message:`Found ${configs.length} ${channelType} notification config(s)`}}};
@@ -1 +1,4 @@
1
- const a195_0x3995b6=a195_0x2fe0;function a195_0x1c41(){const _0x4afd58=['high-risk-write','425205ekxJRx','notification_config_update_outcome_unknown','config-update','60960zINACu','appCode','provesChange','payload','patch','verifiedFields','Notification\x20config\x20','Update\x20response\x20was\x20unavailable;\x20exact-ID\x20readback\x20proved\x20changed\x20safe\x20fields\x20without\x20resubmitting.','before','Update\x20an\x20app-level\x20notification\x20config\x20from\x20a\x20secure\x20JSON\x20patch','mutation','Inspect\x20with\x20--id\x20','560XdPhPr','\x20via\x20','notification_config_update_verification_failed','641439kFLQub','6AEkcqX','/notification/channel-config/update','channelType','update','625585SMrOQh','202717sOPnTa','2DTwvmZ','365208CDowvh','allMatch','POST',';\x20no\x20automatic\x20retry\x20was\x20attempted.','67265pfedrL','\x20readback\x20does\x20not\x20prove\x20the\x20requested\x20update.',';\x20do\x20not\x20resubmit\x20automatically.','14KcMUVk','planned'];a195_0x1c41=function(){return _0x4afd58;};return a195_0x1c41();}(function(_0xde9be0,_0x722f48){const _0x53bdd5=a195_0x2fe0,_0x5dc897=_0xde9be0();while(!![]){try{const _0x154fec=-parseInt(_0x53bdd5(0xef))/0x1+parseInt(_0x53bdd5(0xf0))/0x2*(parseInt(_0x53bdd5(0x10d))/0x3)+-parseInt(_0x53bdd5(0xfe))/0x4+parseInt(_0x53bdd5(0xee))/0x5*(-parseInt(_0x53bdd5(0x10e))/0x6)+parseInt(_0x53bdd5(0xf8))/0x7*(-parseInt(_0x53bdd5(0xf1))/0x8)+parseInt(_0x53bdd5(0xfb))/0x9+-parseInt(_0x53bdd5(0x10a))/0xa*(-parseInt(_0x53bdd5(0xf5))/0xb);if(_0x154fec===_0x722f48)break;else _0x5dc897['push'](_0x5dc897['shift']());}catch(_0x1de00e){_0x5dc897['push'](_0x5dc897['shift']());}}}(a195_0x1c41,0x294a2));import{asDryRunResult}from'../../commands/common/dry-run.js';import{getNotificationChannelConfig,isPlatformTransportFailure,updateNotificationChannelConfig}from'../../core/api-client.js';import{assertSingleNotificationSource,mergeUpdateInput,normalizeExactNotificationConfig,notificationError,notificationLookupCommand,notificationSelector,NOTIFICATION_APP_FLAG,NOTIFICATION_ID_FLAG,NOTIFICATION_INPUT_FLAGS,plannedUpdateProjection,projectNotificationConfig,readNotificationDocument,readNotificationId,requestedSafeFieldsMatch,requireNotificationExplicitYes,requireExactNotificationConfig,safeApiFailure}from'../../commands/notification/shared.js';const UPDATE_PATH=a195_0x3995b6(0x10f);function a195_0x2fe0(_0x257101,_0x5d3827){_0x257101=_0x257101-0xed;const _0x1c4165=a195_0x1c41();let _0x2fe075=_0x1c4165[_0x257101];return _0x2fe075;}async function prepareUpdate(_0x411b60){const _0x359b14=a195_0x3995b6,_0x266156=readNotificationId(_0x411b60),_0x25b6ed=await readNotificationDocument(_0x411b60,_0x359b14(0xed)),_0x137325=await requireExactNotificationConfig(_0x411b60['appCode'],_0x266156,_0x359b14(0xed));return{'id':_0x266156,'patch':_0x25b6ed,'before':_0x137325,'payload':mergeUpdateInput(_0x137325,_0x25b6ed),'planned':plannedUpdateProjection(_0x137325,_0x25b6ed)};}export const notificationConfigUpdate={'service':'notification','command':a195_0x3995b6(0xfd),'description':a195_0x3995b6(0x107),'risk':a195_0x3995b6(0xfa),'requiresAppCode':!![],'structuredErrors':!![],'flags':[NOTIFICATION_ID_FLAG,...NOTIFICATION_INPUT_FLAGS,NOTIFICATION_APP_FLAG],async 'validate'(_0x4c92b8){readNotificationId(_0x4c92b8),assertSingleNotificationSource(_0x4c92b8),requireNotificationExplicitYes(_0x4c92b8);},async 'dryRun'(_0x27cad1){const _0x512414=a195_0x3995b6,_0xa11b42=await prepareUpdate(_0x27cad1),_0x58de9b=notificationLookupCommand(_0x27cad1[_0x512414(0xff)],_0xa11b42[_0x512414(0x106)][_0x512414(0x110)]);return asDryRunResult({'operation':'update','selector':notificationSelector(_0xa11b42[_0x512414(0x106)]),'before':projectNotificationConfig(_0xa11b42[_0x512414(0x106)]),'after':_0xa11b42[_0x512414(0xf9)],'dryRun':!![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[],'verification':{'status':_0x512414(0xf9),'lookupCommand':_0x58de9b}},{'method':_0x512414(0xf3),'url':UPDATE_PATH});},async 'execute'(_0x558da2){const _0x79b184=a195_0x3995b6;requireNotificationExplicitYes(_0x558da2);const _0xcc0c67=await prepareUpdate(_0x558da2),_0x5ebe69=notificationLookupCommand(_0x558da2[_0x79b184(0xff)],_0xcc0c67[_0x79b184(0x106)]['channelType']);let _0x375f08=![];try{await updateNotificationChannelConfig(_0xcc0c67[_0x79b184(0x101)]);}catch(_0x59bdde){if(!isPlatformTransportFailure(_0x59bdde))throw safeApiFailure(_0x79b184(0xed),_0x79b184(0x108),'Inspect\x20ID\x20'+_0xcc0c67['id']+'\x20with\x20'+_0x5ebe69+_0x79b184(0xf4));_0x375f08=!![];}let _0x52ac12;try{const _0x5b118a=await getNotificationChannelConfig(_0xcc0c67['id'],_0x558da2[_0x79b184(0xff)]);_0x52ac12=normalizeExactNotificationConfig(_0x5b118a,_0xcc0c67['id'],_0x558da2[_0x79b184(0xff)]);}catch{throw notificationError(_0x375f08?_0x79b184(0xfc):'notification_config_update_verification_unavailable',_0x79b184(0x104)+_0xcc0c67['id']+'\x20update\x20could\x20not\x20be\x20verified\x20by\x20exact\x20ID.',_0x79b184(0x109)+_0xcc0c67['id']+_0x79b184(0x10b)+_0x5ebe69+_0x79b184(0xf7));}const _0x12956b=requestedSafeFieldsMatch(_0xcc0c67[_0x79b184(0x106)],_0x52ac12,_0xcc0c67[_0x79b184(0x102)]);if(!_0x12956b[_0x79b184(0xf2)]||_0x375f08&&!_0x12956b[_0x79b184(0x100)])throw notificationError(_0x375f08?_0x79b184(0xfc):_0x79b184(0x10c),'Notification\x20config\x20'+_0xcc0c67['id']+_0x79b184(0xf6),_0x79b184(0x109)+_0xcc0c67['id']+_0x79b184(0x10b)+_0x5ebe69+';\x20do\x20not\x20resubmit\x20automatically.');const _0xc5c65=_0x375f08?[_0x79b184(0x105)]:[];return{'ok':!![],'data':{'operation':_0x79b184(0xed),'selector':notificationSelector(_0x52ac12),'before':projectNotificationConfig(_0xcc0c67[_0x79b184(0x106)]),'after':projectNotificationConfig(_0x52ac12),'dryRun':![],'backend':{'method':_0x79b184(0xf3),'path':UPDATE_PATH},'warnings':_0xc5c65,'verification':{'status':'verified','recoveredAfterUnknownResponse':_0x375f08,'verifiedFields':_0x12956b[_0x79b184(0x103)],'lookupCommand':_0x5ebe69}},'message':'Updated\x20notification\x20config\x20'+_0x52ac12['id']};}};
1
+ import{asDryRunResult}from"../../commands/common/dry-run.js";import{getNotificationChannelConfig,isPlatformTransportFailure,updateNotificationChannelConfig}from"../../core/api-client.js";import{assertSingleNotificationSource,mergeUpdateInput,normalizeExactNotificationConfig,notificationError,notificationLookupCommand,notificationSelector,NOTIFICATION_APP_FLAG,NOTIFICATION_ID_FLAG,NOTIFICATION_INPUT_FLAGS,plannedUpdateProjection,projectNotificationConfig,readNotificationDocument,readNotificationId,requestedSafeFieldsMatch,requireNotificationExplicitYes,requireExactNotificationConfig,safeApiFailure}from"../../commands/notification/shared.js";const UPDATE_PATH="/notification/channel-config/update";async function prepareUpdate(ctx){const id=readNotificationId(ctx);const patch=await readNotificationDocument(ctx,"update");const before=await requireExactNotificationConfig(ctx.appCode,id,"update");return{id:id,patch:patch,before:before,payload:mergeUpdateInput(before,patch),
2
+ planned:plannedUpdateProjection(before,patch)}}export const notificationConfigUpdate={service:"notification",command:"config-update",description:"Update an app-level notification config from a secure JSON patch",risk:"high-risk-write",requiresAppCode:true,structuredErrors:true,flags:[NOTIFICATION_ID_FLAG,...NOTIFICATION_INPUT_FLAGS,NOTIFICATION_APP_FLAG],async validate(ctx){readNotificationId(ctx);assertSingleNotificationSource(ctx);requireNotificationExplicitYes(ctx)},async dryRun(ctx){const prepared=await prepareUpdate(ctx);const lookupCommand=notificationLookupCommand(ctx.appCode,prepared.before.channelType);return asDryRunResult({operation:"update",selector:notificationSelector(prepared.before),before:projectNotificationConfig(prepared.before),after:prepared.planned,dryRun:true,backend:{method:"POST",path:UPDATE_PATH},warnings:[],verification:{status:"planned",lookupCommand:lookupCommand}},{method:"POST",url:UPDATE_PATH})},async execute(ctx){requireNotificationExplicitYes(ctx)
3
+ ;const prepared=await prepareUpdate(ctx);const lookupCommand=notificationLookupCommand(ctx.appCode,prepared.before.channelType);let recoveredAfterUnknownResponse=false;try{await updateNotificationChannelConfig(prepared.payload)}catch(error){if(!isPlatformTransportFailure(error)){throw safeApiFailure("update","mutation",`Inspect ID ${prepared.id} with ${lookupCommand}; no automatic retry was attempted.`)}recoveredAfterUnknownResponse=true}let after;try{const item=await getNotificationChannelConfig(prepared.id,ctx.appCode);after=normalizeExactNotificationConfig(item,prepared.id,ctx.appCode)}catch{throw notificationError(recoveredAfterUnknownResponse?"notification_config_update_outcome_unknown":"notification_config_update_verification_unavailable",`Notification config ${prepared.id} update could not be verified by exact ID.`,`Inspect with --id ${prepared.id} via ${lookupCommand}; do not resubmit automatically.`)}const proof=requestedSafeFieldsMatch(prepared.before,after,prepared.patch)
4
+ ;if(!proof.allMatch||recoveredAfterUnknownResponse&&!proof.provesChange){throw notificationError(recoveredAfterUnknownResponse?"notification_config_update_outcome_unknown":"notification_config_update_verification_failed",`Notification config ${prepared.id} readback does not prove the requested update.`,`Inspect with --id ${prepared.id} via ${lookupCommand}; do not resubmit automatically.`)}const warnings=recoveredAfterUnknownResponse?["Update response was unavailable; exact-ID readback proved changed safe fields without resubmitting."]:[];return{ok:true,data:{operation:"update",selector:notificationSelector(after),before:projectNotificationConfig(prepared.before),after:projectNotificationConfig(after),dryRun:false,backend:{method:"POST",path:UPDATE_PATH},warnings:warnings,verification:{status:"verified",recoveredAfterUnknownResponse:recoveredAfterUnknownResponse,verifiedFields:proof.verifiedFields,lookupCommand:lookupCommand}},message:`Updated notification config ${after.id}`}}};
@@ -1 +1 @@
1
- (function(_0x7fd3ac,_0x157a7d){const _0x542433=a196_0x4492,_0x2b406c=_0x7fd3ac();while(!![]){try{const _0x41dea3=-parseInt(_0x542433(0xa7))/0x1*(parseInt(_0x542433(0xae))/0x2)+parseInt(_0x542433(0xad))/0x3*(parseInt(_0x542433(0xb0))/0x4)+parseInt(_0x542433(0xa8))/0x5+-parseInt(_0x542433(0xb1))/0x6*(parseInt(_0x542433(0xaa))/0x7)+-parseInt(_0x542433(0xab))/0x8+-parseInt(_0x542433(0xa9))/0x9+-parseInt(_0x542433(0xac))/0xa*(-parseInt(_0x542433(0xaf))/0xb);if(_0x41dea3===_0x157a7d)break;else _0x2b406c['push'](_0x2b406c['shift']());}catch(_0x18f22e){_0x2b406c['push'](_0x2b406c['shift']());}}}(a196_0x2211,0x1fb03));import{notificationConfigList}from'../../commands/notification/config-list.js';import{notificationConfigCreate}from'../../commands/notification/config-create.js';import{notificationConfigUpdate}from'../../commands/notification/config-update.js';import{notificationConfigDelete}from'../../commands/notification/config-delete.js';function a196_0x4492(_0x49b00d,_0x5250b4){_0x49b00d=_0x49b00d-0xa7;const _0x2211a8=a196_0x2211();let _0x4492b2=_0x2211a8[_0x49b00d];return _0x4492b2;}function a196_0x2211(){const _0x232495=['788301zrTNEZ','7553flDznB','770696ueqyTz','20xPnTwZ','4398Tebqny','22106CPiMKP','1944481PXnCxr','104vCOdCW','588klvEap','1LvmKAF','194290OxfeoO'];a196_0x2211=function(){return _0x232495;};return a196_0x2211();}export const notificationDefinitions=[notificationConfigList,notificationConfigCreate,notificationConfigUpdate,notificationConfigDelete];
1
+ import{notificationConfigList}from"../../commands/notification/config-list.js";import{notificationConfigCreate}from"../../commands/notification/config-create.js";import{notificationConfigUpdate}from"../../commands/notification/config-update.js";import{notificationConfigDelete}from"../../commands/notification/config-delete.js";export const notificationDefinitions=[notificationConfigList,notificationConfigCreate,notificationConfigUpdate,notificationConfigDelete];