@lovrabet/rabetbase-cli 2.5.13 → 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_0x4953ce=a190_0x3376;(function(_0x15bd7b,_0x1987d0){const _0x7824d8=a190_0x3376,_0xb5d678=_0x15bd7b();while(!![]){try{const _0x562118=-parseInt(_0x7824d8(0x110))/0x1*(parseInt(_0x7824d8(0x12c))/0x2)+-parseInt(_0x7824d8(0x13a))/0x3+-parseInt(_0x7824d8(0x142))/0x4+parseInt(_0x7824d8(0x119))/0x5*(-parseInt(_0x7824d8(0x10c))/0x6)+parseInt(_0x7824d8(0x106))/0x7*(-parseInt(_0x7824d8(0x13c))/0x8)+parseInt(_0x7824d8(0x145))/0x9+parseInt(_0x7824d8(0x12f))/0xa;if(_0x562118===_0x1987d0)break;else _0xb5d678['push'](_0xb5d678['shift']());}catch(_0x2a6e60){_0xb5d678['push'](_0xb5d678['shift']());}}}(a190_0x3269,0xae825));import a190_0x3fd07b 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';function a190_0x3269(){const _0x372177=['\x20created.','Menu\x20creation\x20failed','Tip:\x20For\x20frontend\x20subapps,\x20prefer\x20Agent-planned\x20menu\x20groups\x20and\x20shared\x20resources.\x20This\x20manual\x20sync\x20workflow\x20remains\x20available\x20as\x20a\x20fallback.','70gzMOUq','trim','length','menu\x20sync\x20--paths\x20requires\x20--yes\x20for\x20execution.','yes','jsUrl','6cYOKbr','Confirm\x20non-interactive\x20sync;\x20without\x20--paths,\x20create\x20all\x20missing\x20local\x20pages','✓\x20Menu\x20sync\x20completed:\x20','!\x20No\x20local\x20pages\x20found\x20in\x20src/pages','1261387kXFxoU','failed','Created\x20','Failed\x20to\x20fetch\x20online\x20menu\x20list','Register\x20local\x20pages\x20as\x20platform\x20menus','cyan','menu','\x20\x20Create\x20','Fetching\x20online\x20menu\x20list...','2039315sQAgRb','filter','✓\x20All\x20local\x20pages\x20are\x20already\x20on\x20platform','\x20failed.','appName','paths','params','skipped','appcode','\x20local\x20microfrontend\x20menu(s).','created','cookie','\x20\x20Cancelled.','flag','Menu\x20sync\x20completed:\x20','\x20menu(s)\x20with\x20JS:\x20','str','string','\x20created,\x20','2VtodQX','sync','Would\x20create\x20','49756780ubAolX','cssUrl','selectedAppName','gray','Creating\x20','\x20menu(s)...','\x20menu(s)\x20bound\x20to\x20','write','\x20menu(s)\x20created','localPages','map','3642423OzArsA','/smartapi/menu/create','887088gNjDRB','\x20page(s)','onlineMenuList','message','size','rawFlags','1962620MpEcgl','\x20and\x20CSS:\x20','boolean','1998153xNMSbe','\x20\x20Continue\x20with\x20creation?','POST','Preview\x20with\x20--dry-run,\x20then\x20reuse\x20the\x20same\x20--paths\x20and\x20--params\x20with\x20--yes.','JSON:\x20{\x22appName\x22:\x22store-app\x22,\x22parentId\x22:42,\x22visible\x22:false};\x20jsUrl\x20and\x20cssUrl\x20remain\x20available\x20for\x20individual\x20menu\x20resources.','Exact\x20comma-separated\x20local\x20page\x20paths\x20to\x20sync','Non-interactive\x20menu\x20sync\x20requires\x20--yes.','validation','Run\x20inside\x20a\x20directory\x20with\x20.rabetbase.json,\x20or\x20pass\x20--appcode\x20<code>.','No\x20local\x20microfrontend\x20menus\x20would\x20be\x20created.','appCode'];a190_0x3269=function(){return _0x372177;};return a190_0x3269();}export const menuSync={'service':a190_0x4953ce(0x116),'command':a190_0x4953ce(0x12d),'description':a190_0x4953ce(0x114),'risk':a190_0x4953ce(0x136),'flags':[{'name':a190_0x4953ce(0x11f),'type':a190_0x4953ce(0x12a),'description':'Prefer\x20appName\x20for\x20shared\x20subapp\x20resources\x20and\x20parentId\x20for\x20planned\x20groups.\x20'+a190_0x4953ce(0x149)},{'name':a190_0x4953ce(0x11e),'type':a190_0x4953ce(0x12a),'description':a190_0x4953ce(0x14a)},{'name':a190_0x4953ce(0x10a),'type':a190_0x4953ce(0x144),'description':a190_0x4953ce(0x10d)}],async 'dryRun'(_0x5c317a){const _0x1beb6d=a190_0x4953ce;ensureRunnableContext(_0x5c317a[_0x1beb6d(0x141)],_0x5c317a[_0x1beb6d(0x131)]);const _0x466088=await runMenuSyncCore(_0x5c317a[_0x1beb6d(0x102)],_0x5c317a[_0x1beb6d(0x124)],parsePaths(_0x5c317a[_0x1beb6d(0x129)](_0x1beb6d(0x11e))),_0x5c317a[_0x1beb6d(0x129)](_0x1beb6d(0x11f)),{'dryRun':!![]});return{'method':_0x1beb6d(0x147),'url':_0x1beb6d(0x13b),'body':_0x466088,'description':_0x466088[_0x1beb6d(0x120)]?_0x1beb6d(0x101):_0x1beb6d(0x12e)+_0x466088['targetPages'][_0x1beb6d(0x108)]+_0x1beb6d(0x122)};},async 'execute'(_0x4256e5){const _0x3b9d82=a190_0x4953ce;ensureRunnableContext(_0x4256e5[_0x3b9d82(0x141)],_0x4256e5['selectedAppName']);const _0x38a71f=_0x4256e5[_0x3b9d82(0x126)]('yes'),_0x5e1952=_0x4256e5[_0x3b9d82(0x129)](_0x3b9d82(0x11f)),_0x43422e=parsePaths(_0x4256e5[_0x3b9d82(0x129)](_0x3b9d82(0x11e))),_0x55e9cb=parseMenuSyncParams(_0x5e1952);if(_0x38a71f){const _0x28dfed=await runMenuSyncCore(_0x4256e5['appCode'],_0x4256e5[_0x3b9d82(0x124)],_0x43422e,_0x5e1952);if(_0x28dfed[_0x3b9d82(0x120)]){const _0x22512b=getLocalPages();_0x22512b[_0x3b9d82(0x108)]===0x0?writeCliSideChannelLine(_0x3b9d82(0x10f)):writeCliSideChannelLine(_0x3b9d82(0x11b));}else writeCliSideChannelLine(_0x3b9d82(0x10e)+_0x28dfed['created']+_0x3b9d82(0x137));return{'ok':!![],'data':_0x28dfed,'message':_0x28dfed[_0x3b9d82(0x120)]?'Menu\x20sync\x20skipped':'Menu\x20sync\x20completed:\x20'+_0x28dfed[_0x3b9d82(0x123)]+_0x3b9d82(0x103)};}if(_0x43422e[_0x3b9d82(0x108)]>0x0)throw CliErrors[_0x3b9d82(0x14c)](_0x3b9d82(0x109),_0x3b9d82(0x148));if(!isInteractive()&&_0x5e1952)throw CliErrors[_0x3b9d82(0x14c)](_0x3b9d82(0x14b),_0x3b9d82(0x148));requireInteractive(),writeCliSideChannelLine(_0x3b9d82(0x105));const _0x29d8d0=startSpinner(_0x3b9d82(0x118));let _0x2a8ed9,_0x49275d,_0x238873;try{const _0x366624=await fetchMenuData(_0x4256e5[_0x3b9d82(0x102)],_0x4256e5[_0x3b9d82(0x124)]);_0x2a8ed9=_0x366624[_0x3b9d82(0x138)],_0x49275d=_0x366624['onlinePaths'],_0x238873=_0x366624[_0x3b9d82(0x13e)],stopSpinner(_0x29d8d0,'Online\x20menu\x20list\x20fetched',!![]);}catch(_0x3e0be1){stopSpinner(_0x29d8d0,_0x3b9d82(0x113),![]);throw CliErrors[_0x3b9d82(0x14c)](_0x3e0be1 instanceof Error?_0x3e0be1[_0x3b9d82(0x13f)]:'Failed\x20to\x20fetch\x20online\x20menu\x20list');}if(_0x2a8ed9[_0x3b9d82(0x108)]===0x0)return writeCliSideChannelLine(a190_0x3fd07b['yellow']('\x20\x20!\x20No\x20local\x20pages\x20found,\x20please\x20create\x20pages\x20first')),{'ok':!![]};const _0x2d4716=buildCompareRows(_0x2a8ed9,_0x49275d);writeCliSideChannelLine(renderCompareTable(_0x2d4716)),writeCliSideChannelLine('');const _0x298345=await selectPages(_0x2a8ed9,_0x49275d);writeCliSideChannelLine(''),writeCliSideChannelLine(a190_0x3fd07b[_0x3b9d82(0x115)]('\x20\x20✓\x20Selected:\x20'+_0x298345['length']+_0x3b9d82(0x13d)));const _0x94fa27=_0x55e9cb['jsUrl']&&_0x55e9cb[_0x3b9d82(0x130)];if(!_0x94fa27){writeCliSideChannelLine(renderSyncSummary(_0x298345,_0x49275d[_0x3b9d82(0x140)]>0x0));const _0x5c014d=await askConfirm(_0x3b9d82(0x146));if(!_0x5c014d)return writeCliSideChannelLine(a190_0x3fd07b[_0x3b9d82(0x132)](_0x3b9d82(0x125))),{'ok':!![]};}let _0x39dde9=_0x55e9cb[_0x3b9d82(0x10b)],_0x570bbd=_0x55e9cb[_0x3b9d82(0x130)];!_0x39dde9&&!_0x55e9cb['appName']&&(_0x39dde9=await askJsUrl());!_0x570bbd&&!_0x55e9cb[_0x3b9d82(0x11d)]&&(_0x570bbd=await askCssUrl());const _0x358577=await askConfirm(_0x55e9cb[_0x3b9d82(0x11d)]?'\x20\x20Create\x20'+_0x298345[_0x3b9d82(0x108)]+_0x3b9d82(0x135)+_0x55e9cb[_0x3b9d82(0x11d)]+'?':_0x3b9d82(0x117)+_0x298345['length']+_0x3b9d82(0x128)+_0x39dde9+_0x3b9d82(0x143)+_0x570bbd+'?');if(!_0x358577)return writeCliSideChannelLine(a190_0x3fd07b[_0x3b9d82(0x132)](_0x3b9d82(0x125))),{'ok':!![]};const _0x57e857=[_0x39dde9,_0x570bbd][_0x3b9d82(0x11a)](_0x163fb3=>Boolean(_0x163fb3));_0x55e9cb['appName']&&_0x57e857['length']===0x0&&await assertSharedResourcesConfigured(_0x4256e5[_0x3b9d82(0x102)],_0x4256e5[_0x3b9d82(0x124)],_0x55e9cb[_0x3b9d82(0x11d)]);const _0x2110dc=startSpinner(_0x3b9d82(0x133)+_0x298345['length']+_0x3b9d82(0x134));try{const _0x6095a7=_0x298345[_0x3b9d82(0x139)](_0x457454=>resolvePage(_0x457454,_0x55e9cb,_0x238873)),_0x4cf000=await doCreateMenus(_0x4256e5[_0x3b9d82(0x102)],_0x4256e5['cookie'],_0x6095a7,_0x57e857,_0x55e9cb[_0x3b9d82(0x11d)]?{'appName':_0x55e9cb[_0x3b9d82(0x11d)]}:undefined);return stopSpinner(_0x2110dc,_0x3b9d82(0x112)+_0x4cf000[_0x3b9d82(0x123)]+'\x20menu(s)',!![]),{'ok':!![],'data':_0x4cf000,'message':_0x3b9d82(0x127)+_0x4cf000[_0x3b9d82(0x123)]+_0x3b9d82(0x12b)+_0x4cf000[_0x3b9d82(0x111)]+_0x3b9d82(0x11c)};}catch(_0x53715f){stopSpinner(_0x2110dc,_0x3b9d82(0x104),![]);throw CliErrors['validation'](_0x53715f instanceof Error?_0x53715f[_0x3b9d82(0x13f)]:_0x3b9d82(0x104));}}};function ensureRunnableContext(_0x476e17,_0x488948){const _0x5204ea=a190_0x4953ce,_0x4c4793=_0x476e17[_0x5204ea(0x121)]?String(_0x476e17[_0x5204ea(0x121)])[_0x5204ea(0x107)]():'';if(!isInProject()&&!_0x488948&&!_0x4c4793)throw CliErrors[_0x5204ea(0x14c)]('menu\x20sync\x20requires\x20a\x20project\x20context\x20or\x20explicit\x20--appcode.\x20'+_0x5204ea(0x14d));}function a190_0x3376(_0x26e2b9,_0x73b884){_0x26e2b9=_0x26e2b9-0x101;const _0x3269ec=a190_0x3269();let _0x33764d=_0x3269ec[_0x26e2b9];return _0x33764d;}function parsePaths(_0xec2023){const _0x16a3fb=a190_0x4953ce;return[...new Set(_0xec2023['split'](',')[_0x16a3fb(0x139)](_0x1367a5=>_0x1367a5[_0x16a3fb(0x107)]())['filter'](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_0x50d41e=a191_0x51f7;(function(_0x5c5d99,_0x22c090){const _0x272917=a191_0x51f7,_0xa466d0=_0x5c5d99();while(!![]){try{const _0x14035c=parseInt(_0x272917(0x149))/0x1*(parseInt(_0x272917(0xf0))/0x2)+parseInt(_0x272917(0xfa))/0x3+-parseInt(_0x272917(0xf9))/0x4+-parseInt(_0x272917(0x148))/0x5*(parseInt(_0x272917(0x142))/0x6)+parseInt(_0x272917(0x108))/0x7+parseInt(_0x272917(0xe8))/0x8+-parseInt(_0x272917(0x125))/0x9;if(_0x14035c===_0x22c090)break;else _0xa466d0['push'](_0xa466d0['shift']());}catch(_0xa0cca4){_0xa466d0['push'](_0xa466d0['shift']());}}}(a191_0x4d97,0xd156d));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':a191_0x50d41e(0x130),'path':a191_0x50d41e(0xde)}];export const menuVisibilityUpdate={'service':a191_0x50d41e(0x13e),'command':'visibility-update','description':a191_0x50d41e(0xed),'risk':'write','structuredErrors':!![],'flags':[{'name':a191_0x50d41e(0x124),'type':a191_0x50d41e(0x128),'description':'Exact\x20comma-separated\x20menu\x20IDs\x20to\x20update'},{'name':a191_0x50d41e(0xe6),'type':a191_0x50d41e(0x128),'description':'Exact\x20comma-separated\x20menu\x20paths\x20to\x20update'},{'name':a191_0x50d41e(0x14e),'type':'boolean','required':!![],'description':a191_0x50d41e(0xec)},{'name':a191_0x50d41e(0x117),'type':'boolean','description':a191_0x50d41e(0xdf)},{'name':a191_0x50d41e(0x107),'type':a191_0x50d41e(0x147),'description':'Abort\x20unless\x20the\x20exact\x20number\x20of\x20selected\x20menus\x20matches'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2f68c2){parseInput(_0x2f68c2);},async 'dryRun'(_0x5d0f44){const _0x4f2787=a191_0x50d41e,_0x2d8dbe=await buildPlan(_0x5d0f44,!![]),_0x5cc0c6=_0x2d8dbe[_0x4f2787(0xfe)]['plannedActions']?.[_0x4f2787(0x10d)]??0x0,_0x36f576=_0x2d8dbe[_0x4f2787(0xfe)][_0x4f2787(0xeb)][_0x4f2787(0x10d)]-_0x5cc0c6;return menuDryRunResult(_0x2d8dbe[_0x4f2787(0xfe)],{'method':_0x4f2787(0x130),'url':'/smartapi/menu/update','body':{'updates':_0x2d8dbe[_0x4f2787(0xfe)][_0x4f2787(0x12a)]?.[_0x4f2787(0x137)](_0x3c3ab9=>_0x3c3ab9[_0x4f2787(0x139)])??[]},'description':'Would\x20update\x20visibility\x20for\x20'+_0x5cc0c6+_0x4f2787(0x10e)+_0x36f576+_0x4f2787(0x136)});},async 'execute'(_0x10b8a1){const _0x414362=a191_0x50d41e,_0x4ed990=await buildPlan(_0x10b8a1,![]);await recheckMutationSnapshot(_0x10b8a1,_0x4ed990[_0x414362(0xfe)],_0x414362(0x11d));const _0x1c2192=[],_0x394a46=[],_0x4603fa=[];for(const _0x273de4 of _0x4ed990['plan'][_0x414362(0xeb)]){if(_0x273de4[_0x414362(0x115)]['visible']===_0x4ed990['plan'][_0x414362(0xdc)]){_0x1c2192['push']({'id':_0x273de4['id'],'updated':![],'skipped':!![]});continue;}try{await updateMenuEntity(_0x10b8a1[_0x414362(0xf5)],_0x10b8a1[_0x414362(0x11e)],{'id':_0x273de4['id'],'visible':_0x4ed990[_0x414362(0xfe)][_0x414362(0xdc)]}),_0x1c2192[_0x414362(0xf6)]({'id':_0x273de4['id'],'updated':!![],'skipped':![]});}catch(_0x1b6ed1){const _0x2fd3ac=mapMenuApiError(_0x1b6ed1,_0x414362(0x110),_0x273de4['id']);if(isMenuResponseLoss(_0x1b6ed1)&&_0x2fd3ac[_0x414362(0x116)]!==_0x414362(0x13b)){_0x4603fa[_0x414362(0xf6)](_0x273de4['id']);continue;}_0x394a46[_0x414362(0xf6)]({'id':_0x273de4['id'],'stage':'update','code':_0x2fd3ac['code'],'message':_0x2fd3ac[_0x414362(0xe9)]});}}let _0x7b4f17;try{_0x7b4f17=await fetchMenuSnapshot(_0x10b8a1[_0x414362(0xf5)],_0x10b8a1['cookie']);}catch(_0x216770){const _0x1fe786=describeMenuErrorCause(_0x216770,'verify\x20menu\x20visibility\x20update'),_0x43e3ad=_0x4603fa[_0x414362(0x137)](_0x3754c3=>({'id':_0x3754c3,'stage':'update-recovery','code':_0x414362(0x126),'message':_0x414362(0xf1)+_0x3754c3+_0x414362(0x12d),'requestedStateConfirmed':![],'recovered':![]})),_0x420826={'stage':'verification','code':_0x414362(0x126),'message':_0x414362(0x10f),'targetIds':_0x4ed990[_0x414362(0xfe)][_0x414362(0xeb)][_0x414362(0x137)](_0x37de22=>_0x37de22['id']),'requestedStateConfirmed':![],..._0x1fe786};throw menuFailure(asVerificationError(_0x216770,'Visibility\x20update\x20requests\x20completed\x20but\x20readback\x20could\x20not\x20confirm\x20the\x20requested\x20state'),_0x4ed990[_0x414362(0xfe)],{'stage':'verification','succeeded':_0x1c2192,'failedRecords':[..._0x394a46,..._0x43e3ad,_0x420826],'warnings':[_0x414362(0xe5)],'verification':{'status':_0x414362(0x102),'recoveredCount':0x0,'lookupCommand':_0x414362(0x14b)}});}const _0x3c1fd9=[];for(const _0x3d0b67 of _0x1c2192){const _0x557d44=Number(_0x3d0b67['id']),_0x23014f=_0x4ed990['beforeById'][_0x414362(0x127)](_0x557d44),_0x27d0a5=_0x7b4f17[_0x414362(0xf2)]['get'](_0x557d44);try{verifyVisibilityUpdate(_0x23014f,_0x27d0a5,_0x4ed990[_0x414362(0xfe)][_0x414362(0xdc)]);}catch(_0x4fb580){const _0x48c5db=asVerificationError(_0x4fb580,'Menu\x20'+_0x557d44+_0x414362(0x12e));_0x3c1fd9[_0x414362(0xf6)]({'id':_0x557d44,'stage':'verification','code':_0x48c5db[_0x414362(0x116)],'message':_0x48c5db[_0x414362(0xe9)],'requestedStateConfirmed':![]});}}for(const _0x325836 of _0x4603fa){const _0x52d1ef=_0x4ed990[_0x414362(0xda)][_0x414362(0x127)](_0x325836),_0x22f209=_0x7b4f17['byId'][_0x414362(0x127)](_0x325836);try{verifyVisibilityUpdate(_0x52d1ef,_0x22f209,_0x4ed990[_0x414362(0xfe)][_0x414362(0xdc)]),_0x1c2192[_0x414362(0xf6)]({'id':_0x325836,'updated':!![],'skipped':![],'recovered':!![]});}catch(_0x557014){const _0x536cfc=asVerificationError(_0x557014,_0x414362(0x132)+_0x325836+'\x20visibility\x20could\x20not\x20be\x20verified\x20safely');_0x3c1fd9[_0x414362(0xf6)]({'id':_0x325836,'stage':_0x414362(0x105),'code':_0x536cfc[_0x414362(0x116)],'message':_0x536cfc['message'],'requestedStateConfirmed':![],'recovered':![]});}}if(_0x3c1fd9[_0x414362(0x10d)]>0x0){const _0x34b053=_0x3c1fd9[_0x414362(0x137)](_0x41ae70=>Number(_0x41ae70['id'])),_0x261425=_0x1c2192[_0x414362(0x119)](_0x12d9d4=>_0x12d9d4['recovered']===!![])[_0x414362(0x10d)],_0x1b02ca=menuError(_0x414362(0x126),_0x414362(0x133)+_0x34b053[_0x414362(0xdb)](',\x20')+'.',_0x414362(0xd9));throw menuFailure(_0x1b02ca,_0x4ed990[_0x414362(0xfe)],{'stage':_0x414362(0x11f),'succeeded':_0x1c2192,'failedRecords':[..._0x394a46,..._0x3c1fd9],'warnings':[_0x414362(0x143)],'verification':{'status':_0x414362(0x102),..._0x34b053['length']===0x1?{'targetId':_0x34b053[0x0]}:{'targetIds':_0x34b053},'recoveredCount':_0x261425,'lookupCommand':_0x414362(0x14b)}});}const _0x1733e5=_0x1c2192[_0x414362(0x119)](_0x3d9633=>_0x3d9633['updated']===!![])[_0x414362(0x10d)],_0x3d6045=_0x1c2192[_0x414362(0x10d)]-_0x1733e5,_0x265c06={..._0x4ed990[_0x414362(0xfe)],'succeeded':_0x1c2192,'failed':_0x394a46,'warnings':_0x394a46[_0x414362(0x10d)]>0x0?[..._0x4ed990[_0x414362(0xfe)][_0x414362(0x135)],_0x414362(0xf8)]:_0x4ed990['plan'][_0x414362(0x135)],'verification':{'checkedBy':'menu\x20list','snapshotHash':_0x7b4f17['hash'],'matchesRequestedState':_0x394a46[_0x414362(0x10d)]===0x0,'recoveredCount':_0x4603fa[_0x414362(0x10d)]}};return{'ok':_0x394a46[_0x414362(0x10d)]===0x0,'data':_0x265c06,'message':_0x394a46[_0x414362(0x10d)]===0x0?_0x414362(0x104)+_0x1733e5+_0x414362(0x118)+_0x3d6045+_0x414362(0x136):_0x414362(0xe0)+_0x1733e5+_0x414362(0x114)+_0x3d6045+_0x414362(0x113)+_0x394a46[_0x414362(0x10d)]+_0x414362(0x122)};}};function parseInput(_0x131f82){const _0x5e2141=a191_0x50d41e,_0x5edbaf=parseMenuIds(_0x131f82[_0x5e2141(0xfc)](_0x5e2141(0x124))),_0x343b75=parseCsv(_0x131f82[_0x5e2141(0xfc)](_0x5e2141(0xe6)));if(_0x5edbaf[_0x5e2141(0x10d)]===0x0&&_0x343b75[_0x5e2141(0x10d)]===0x0)throw CliErrors[_0x5e2141(0xdd)]('menu\x20visibility-update\x20requires\x20--menu-ids\x20or\x20--paths.');const _0x535848=parseBooleanFlag(_0x131f82,_0x5e2141(0x14e),!![]),_0x155577=parseBooleanFlag(_0x131f82,_0x5e2141(0x117),![]);let _0x415f35;if(hasFlag(_0x131f82,'expected-count')){_0x415f35=_0x131f82[_0x5e2141(0x123)](_0x5e2141(0x107));if(!Number[_0x5e2141(0xf7)](_0x415f35)||_0x415f35<0x0)throw CliErrors[_0x5e2141(0xdd)](_0x5e2141(0x109));}return{'menuIds':_0x5edbaf,'paths':_0x343b75,'visible':_0x535848,'expectVisible':_0x155577,'expectedCount':_0x415f35};}async function buildPlan(_0x3186a7,_0x465542){const _0xd2b5f7=a191_0x50d41e,_0x230433=parseInput(_0x3186a7),_0x435cab=await fetchMutationSnapshot(_0x3186a7,_0xd2b5f7(0x11d)),_0x249110=selectTargets(_0x435cab['menus'],_0x230433[_0xd2b5f7(0x112)],_0x230433[_0xd2b5f7(0xe6)]);if(_0x230433[_0xd2b5f7(0x138)]!==undefined&&_0x249110[_0xd2b5f7(0x10d)]!==_0x230433[_0xd2b5f7(0x138)])throw menuError(_0xd2b5f7(0x13c),_0xd2b5f7(0x100)+_0x249110[_0xd2b5f7(0x10d)]+'\x20menu(s),\x20expected\x20'+_0x230433[_0xd2b5f7(0x138)]+'.',_0xd2b5f7(0x13a));if(_0x230433[_0xd2b5f7(0xe2)]!==undefined){const _0x43dd29=_0x249110[_0xd2b5f7(0x119)](_0x3dd3bb=>_0x3dd3bb[_0xd2b5f7(0x14e)]!==_0x230433['expectVisible']);if(_0x43dd29[_0xd2b5f7(0x10d)]>0x0)throw menuError(_0xd2b5f7(0x10a),'Selected\x20menu\x20visibility\x20changed\x20for\x20id(s):\x20'+_0x43dd29[_0xd2b5f7(0x137)](_0x20c535=>_0x20c535['id'])[_0xd2b5f7(0xdb)](',\x20')+'.',_0xd2b5f7(0x14d));}const _0x202f3b=_0x249110[_0xd2b5f7(0x137)](_0x466fc7=>({'id':_0x466fc7['id'],'label':_0x466fc7[_0xd2b5f7(0x14c)],'path':_0x466fc7[_0xd2b5f7(0x141)],'before':{'visible':_0x466fc7[_0xd2b5f7(0x14e)]},'after':{'visible':_0x230433[_0xd2b5f7(0x14e)]}})),_0x580a6d=_0x202f3b[_0xd2b5f7(0x119)](_0x2c5683=>_0x2c5683[_0xd2b5f7(0x115)]['visible']!==_0x230433['visible'])[_0xd2b5f7(0x137)](_0x3d213a=>({'stage':_0xd2b5f7(0xff),'method':'POST','path':_0xd2b5f7(0xde),'body':{'appCode':_0x3186a7[_0xd2b5f7(0xf5)],'id':_0x3d213a['id'],'visible':_0x230433[_0xd2b5f7(0x14e)]}})),_0x1b6f1b=mutationResult({'operation':'visibility-update','selector':{'menuIds':_0x230433[_0xd2b5f7(0x112)],'paths':_0x230433['paths']},'before':{'menus':_0x249110[_0xd2b5f7(0x137)](_0xa69865=>({'id':_0xa69865['id'],'path':_0xa69865[_0xd2b5f7(0x141)],'visible':_0xa69865['visible']}))},'after':{'menus':_0x249110['map'](_0x2dbddc=>({'id':_0x2dbddc['id'],'path':_0x2dbddc[_0xd2b5f7(0x141)],'visible':_0x230433[_0xd2b5f7(0x14e)]}))},'dryRun':_0x465542,'backend':[...BACKEND],'plannedActions':_0x580a6d,'snapshotHash':_0x435cab[_0xd2b5f7(0x12f)],'warnings':_0x580a6d['length']===0x0?['Every\x20selected\x20menu\x20already\x20has\x20the\x20requested\x20visibility;\x20no\x20write\x20is\x20needed.']:[]});return{'plan':{..._0x1b6f1b,'requestedVisible':_0x230433[_0xd2b5f7(0x14e)],'targets':_0x202f3b},'beforeById':new Map(_0x249110[_0xd2b5f7(0x137)](_0x5afdc4=>[_0x5afdc4['id'],_0x5afdc4]))};}function selectTargets(_0x5b7c9e,_0x35e10f,_0xb67d85){const _0x396b05=a191_0x50d41e,_0xa43086=new Map(_0x5b7c9e[_0x396b05(0x137)](_0x4ab788=>[_0x4ab788['id'],_0x4ab788])),_0x144bd8=new Map(),_0x59c684=_0x35e10f[_0x396b05(0x119)](_0x2b8141=>!_0xa43086[_0x396b05(0x146)](_0x2b8141));if(_0x59c684[_0x396b05(0x10d)]>0x0)throw menuError('menu_selector_not_found','Menu\x20id\x20selector(s)\x20not\x20found:\x20'+_0x59c684[_0x396b05(0xdb)](',\x20')+'.','Run\x20`rabetbase\x20menu\x20list\x20--format\x20compress`\x20and\x20use\x20exact\x20current\x20ids.');for(const _0x2310dd of _0x35e10f){_0x144bd8[_0x396b05(0x103)](_0x2310dd,_0xa43086['get'](_0x2310dd));}for(const _0x19fcd4 of _0xb67d85){const _0x36205a=_0x5b7c9e[_0x396b05(0x119)](_0x3f7ae7=>_0x3f7ae7['path']===_0x19fcd4);if(_0x36205a[_0x396b05(0x10d)]===0x0)throw menuError(_0x396b05(0x144),_0x396b05(0xee)+JSON[_0x396b05(0xe3)](_0x19fcd4)+'.',_0x396b05(0xfd));if(_0x36205a[_0x396b05(0x10d)]>0x1)throw menuError(_0x396b05(0xe1),_0x396b05(0x14f)+JSON[_0x396b05(0xe3)](_0x19fcd4)+'.',_0x396b05(0xd8)+_0x36205a[_0x396b05(0x137)](_0x32c029=>_0x32c029['id'])[_0x396b05(0xdb)](',\x20')+'.');const _0x784462=_0x36205a[0x0];_0x144bd8[_0x396b05(0x103)](_0x784462['id'],_0x784462);}return[..._0x144bd8[_0x396b05(0x101)]()];}function a191_0x4d97(){const _0x5e1cb7=['failed','set','Updated\x20visibility\x20for\x20','update-recovery','modelType','expected-count','3024777vmYkGS','--expected-count\x20must\x20be\x20a\x20non-negative\x20integer.','menu_state_drift','flagMissing','childrenIds','length','\x20menu(s);\x20skip\x20','Final\x20menu\x20visibility\x20readback\x20failed.','update\x20visibility\x20for','\x20changed\x20unexpectedly.','menuIds','\x20skipped,\x20','\x20updated,\x20','before','code','expect-visible','\x20menu(s);\x20skipped\x20','filter','--menu-ids\x20must\x20contain\x20positive\x20safe\x20integers.','datasetId','datasetCode','update\x20menu\x20visibility','cookie','verification','\x20was\x20not\x20found\x20during\x20visibility\x20verification.','pageType','\x20failed.','num','menu-ids','4974309CaHSDo','menu_verification_failed','get','string','type','plannedActions','childrenCount','\x20must\x20be\x20true\x20or\x20false.','\x20and\x20final\x20state\x20could\x20not\x20be\x20read.','\x20visibility\x20update\x20could\x20not\x20be\x20verified','hash','POST','false','Response\x20was\x20lost\x20and\x20menu\x20','Menu\x20visibility\x20update\x20could\x20not\x20be\x20verified\x20for\x20id(s):\x20','url','warnings','\x20unchanged\x20menu(s).','map','expectedCount','body','Run\x20the\x20command\x20with\x20--dry-run\x20again\x20and\x20update\x20--expected-count.','menu_permission_denied','menu_expected_count_mismatch','split','menu','resources','some','path','12CLHgVU','One\x20or\x20more\x20updates\x20may\x20have\x20changed\x20fields\x20outside\x20visibility;\x20inspect\x20current\x20menu\x20facts\x20before\x20retrying.','menu_selector_not_found','depth','has','number','1508530vAMZaF','107ZtERwS','rawFlags','rabetbase\x20menu\x20list\x20--format\x20compress','label','Run\x20the\x20command\x20with\x20--dry-run\x20again\x20and\x20update\x20--expect-visible.','visible','Menu\x20path\x20selector\x20matched\x20multiple\x20menus:\x20','parentId','Use\x20--menu-ids\x20with\x20one\x20or\x20more\x20of:\x20','Inspect\x20current\x20menu\x20facts\x20before\x20retrying\x20any\x20target.','beforeById','join','requestedVisible','validation','/smartapi/menu/update','Abort\x20unless\x20every\x20selected\x20menu\x20has\x20this\x20visibility','Menu\x20visibility\x20update\x20completed:\x20','menu_selector_ambiguous','expectVisible','stringify','sort','The\x20update\x20may\x20have\x20taken\x20effect;\x20inspect\x20the\x20latest\x20menu\x20facts\x20before\x20retrying.','paths','isArray','8208616XkkgUf','message','Menu\x20','targets','Requested\x20menu\x20visibility','Set\x20exact\x20menus\x20visible\x20or\x20hidden\x20without\x20changing\x20their\x20routes\x20or\x20resources','Menu\x20path\x20selector\x20not\x20found:\x20','trim','14714mRVDRs','Response\x20was\x20lost\x20for\x20menu\x20','byId','pageId','resourcesValid','appCode','push','isSafeInteger','Failed\x20update\x20requests\x20were\x20not\x20retried;\x20inspect\x20current\x20menu\x20facts\x20before\x20retrying.','6352432yWIHqJ','4068861RqzydS','true','str','Run\x20`rabetbase\x20menu\x20list\x20--format\x20compress`\x20and\x20use\x20an\x20exact\x20current\x20path.','plan','update-menu-visibility','Selected\x20','values'];a191_0x4d97=function(){return _0x5e1cb7;};return a191_0x4d97();}function parseMenuIds(_0x238271){const _0x25396d=a191_0x50d41e,_0x12317d=parseCsv(_0x238271),_0x46c8a4=_0x12317d[_0x25396d(0x137)](Number);if(_0x46c8a4[_0x25396d(0x140)](_0x5c0a5b=>!Number[_0x25396d(0xf7)](_0x5c0a5b)||_0x5c0a5b<=0x0))throw CliErrors[_0x25396d(0xdd)](_0x25396d(0x11a));return[...new Set(_0x46c8a4)];}function parseCsv(_0x3bdc65){const _0x58d8a2=a191_0x50d41e;return[...new Set(_0x3bdc65[_0x58d8a2(0x13d)](',')[_0x58d8a2(0x137)](_0x51f7ad=>_0x51f7ad[_0x58d8a2(0xef)]())[_0x58d8a2(0x119)](Boolean))];}function a191_0x51f7(_0x4c9e24,_0x67de63){_0x4c9e24=_0x4c9e24-0xd7;const _0x4d979a=a191_0x4d97();let _0x51f702=_0x4d979a[_0x4c9e24];return _0x51f702;}function parseBooleanFlag(_0x501e9a,_0xdb7137,_0x31a29b){const _0x433df5=a191_0x50d41e;if(!hasFlag(_0x501e9a,_0xdb7137)){if(_0x31a29b)throw CliErrors[_0x433df5(0x10b)](_0xdb7137);return undefined;}const _0xd91c88=_0x501e9a[_0x433df5(0x14a)][_0xdb7137];if(_0xd91c88===!![]||_0xd91c88===![])return _0xd91c88;if(_0xd91c88===_0x433df5(0xfb))return!![];if(_0xd91c88===_0x433df5(0x131))return![];throw CliErrors[_0x433df5(0xdd)]('--'+_0xdb7137+_0x433df5(0x12c));}function verifyVisibilityUpdate(_0x3ca4a7,_0x559bca,_0x4a7b6d){const _0x35a424=a191_0x50d41e;assertVerified(!!_0x559bca,_0x35a424(0xea)+_0x3ca4a7['id']+_0x35a424(0x120)),assertVerified(_0x559bca[_0x35a424(0x14e)]===_0x4a7b6d,'Menu\x20'+_0x3ca4a7['id']+'\x20visible\x20did\x20not\x20match\x20the\x20requested\x20state.');const _0x2a4f84=[['id',_0x559bca['id'],_0x3ca4a7['id']],['parentId',_0x559bca[_0x35a424(0xd7)],_0x3ca4a7[_0x35a424(0xd7)]],['depth',_0x559bca[_0x35a424(0x145)],_0x3ca4a7[_0x35a424(0x145)]],['label',_0x559bca[_0x35a424(0x14c)],_0x3ca4a7[_0x35a424(0x14c)]],[_0x35a424(0x141),_0x559bca[_0x35a424(0x141)],_0x3ca4a7[_0x35a424(0x141)]],[_0x35a424(0x134),_0x559bca[_0x35a424(0x134)],_0x3ca4a7[_0x35a424(0x134)]],[_0x35a424(0x129),_0x559bca[_0x35a424(0x129)],_0x3ca4a7['type']],[_0x35a424(0xe4),_0x559bca[_0x35a424(0xe4)],_0x3ca4a7[_0x35a424(0xe4)]],[_0x35a424(0x13f),_0x559bca[_0x35a424(0x13f)],_0x3ca4a7[_0x35a424(0x13f)]],['resourcesValid',_0x559bca[_0x35a424(0xf4)],_0x3ca4a7[_0x35a424(0xf4)]],[_0x35a424(0x10c),_0x559bca[_0x35a424(0x10c)],_0x3ca4a7[_0x35a424(0x10c)]],[_0x35a424(0x12b),_0x559bca[_0x35a424(0x12b)],_0x3ca4a7[_0x35a424(0x12b)]],['pageId',_0x559bca['pageId'],_0x3ca4a7[_0x35a424(0xf3)]],[_0x35a424(0x121),_0x559bca[_0x35a424(0x121)],_0x3ca4a7['pageType']],[_0x35a424(0x106),_0x559bca[_0x35a424(0x106)],_0x3ca4a7[_0x35a424(0x106)]],[_0x35a424(0x11b),_0x559bca['datasetId'],_0x3ca4a7[_0x35a424(0x11b)]],[_0x35a424(0x11c),_0x559bca['datasetCode'],_0x3ca4a7['datasetCode']]];for(const [_0x2d32e9,_0x39484b,_0x428217]of _0x2a4f84){assertVerified(sameValue(_0x39484b,_0x428217),'Menu\x20'+_0x3ca4a7['id']+'\x20'+_0x2d32e9+_0x35a424(0x111));}}function sameValue(_0x3d4530,_0xb900e5){const _0x449719=a191_0x50d41e;if(Array[_0x449719(0xe7)](_0x3d4530)||Array[_0x449719(0xe7)](_0xb900e5))return JSON[_0x449719(0xe3)](_0x3d4530)===JSON[_0x449719(0xe3)](_0xb900e5);return _0x3d4530===_0xb900e5;}
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_0x379150=a192_0x35c9;(function(_0x5668ad,_0x4a7a4c){const _0x7b1ae6=a192_0x35c9,_0x526cf8=_0x5668ad();while(!![]){try{const _0x471b5d=parseInt(_0x7b1ae6(0x1d5))/0x1+parseInt(_0x7b1ae6(0x1bc))/0x2*(-parseInt(_0x7b1ae6(0x1d2))/0x3)+parseInt(_0x7b1ae6(0x1cb))/0x4+parseInt(_0x7b1ae6(0x1c5))/0x5+parseInt(_0x7b1ae6(0x1d6))/0x6*(-parseInt(_0x7b1ae6(0x1bf))/0x7)+parseInt(_0x7b1ae6(0x1db))/0x8*(parseInt(_0x7b1ae6(0x1dd))/0x9)+parseInt(_0x7b1ae6(0x1c6))/0xa*(parseInt(_0x7b1ae6(0x1dc))/0xb);if(_0x471b5d===_0x4a7a4c)break;else _0x526cf8['push'](_0x526cf8['shift']());}catch(_0x151ceb){_0x526cf8['push'](_0x526cf8['shift']());}}}(a192_0x6463,0x75945));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';function a192_0x35c9(_0x4e2cc0,_0xb39f49){_0x4e2cc0=_0x4e2cc0-0x1bb;const _0x6463c9=a192_0x6463();let _0x35c99f=_0x6463c9[_0x4e2cc0];return _0x35c99f;}const CREATE_PATH='/notification/channel-config/create';async function prepareCreate(_0x30279e){const _0x3f8d6a=a192_0x35c9,_0x2a546b=await readNotificationDocument(_0x30279e,_0x3f8d6a(0x1cc)),_0x75e4=createMutationInput(_0x30279e['appCode'],_0x2a546b);return{'document':_0x2a546b,'input':_0x75e4,'planned':projectNotificationConfig({'appCode':_0x30279e['appCode'],'configName':_0x2a546b['configName'],'channelType':_0x2a546b['channelType'],'endpointUrl':_0x2a546b[_0x3f8d6a(0x1de)],'channelConfig':_0x2a546b['channelConfig'],'description':_0x2a546b['description'],'connectTimeout':_0x2a546b[_0x3f8d6a(0x1cf)]??DEFAULT_NOTIFICATION_CONNECT_TIMEOUT,'readTimeout':_0x2a546b[_0x3f8d6a(0x1c1)]??DEFAULT_NOTIFICATION_READ_TIMEOUT})};}function a192_0x6463(){const _0x338aba=['config-create','mutation','configName','3263800UDCXmM','11380bgCryT','channelType','planned','verification','Inspect\x20with\x20','1310616IxRVGj','create','POST','document','connectTimeout',';\x20do\x20not\x20resubmit.','Notification\x20config\x20create\x20outcome\x20is\x20unknown\x20because\x20no\x20server\x20ID\x20was\x20received.','287349rXDYwQ','verified','notification_config_create_outcome_unknown','659012uBsNsp','471168XDIxnr','appCode','Notification\x20config\x20create\x20returned\x20no\x20usable\x20server\x20ID.','notification','isSafeInteger','8HPtuCd','4191cTjgDr','348057rVzrdh','endpointUrl',';\x20no\x20automatic\x20retry\x20was\x20attempted.','16GgwqYU','Created\x20notification\x20config\x20','Create\x20an\x20app-level\x20notification\x20config\x20from\x20a\x20secure\x20JSON\x20source','77MNnlpH','input','readTimeout'];a192_0x6463=function(){return _0x338aba;};return a192_0x6463();}export const notificationConfigCreate={'service':a192_0x379150(0x1d9),'command':a192_0x379150(0x1c2),'description':a192_0x379150(0x1be),'risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[...NOTIFICATION_INPUT_FLAGS,NOTIFICATION_APP_FLAG],async 'validate'(_0x173cac){assertSingleNotificationSource(_0x173cac);},async 'dryRun'(_0x404d2a){const _0x5641aa=a192_0x379150,_0x1024eb=await prepareCreate(_0x404d2a),_0x4f4e16=notificationLookupCommand(_0x404d2a[_0x5641aa(0x1d7)],_0x1024eb[_0x5641aa(0x1ce)][_0x5641aa(0x1c7)]);return asDryRunResult({'operation':_0x5641aa(0x1cc),'selector':{'appCode':_0x404d2a['appCode'],'configName':_0x1024eb['document'][_0x5641aa(0x1c4)],'channelType':_0x1024eb[_0x5641aa(0x1ce)][_0x5641aa(0x1c7)]},'before':null,'after':_0x1024eb['planned'],'dryRun':!![],'backend':{'method':_0x5641aa(0x1cd),'path':CREATE_PATH},'warnings':[],'verification':{'status':_0x5641aa(0x1c8),'lookupCommand':_0x4f4e16}},{'method':'POST','url':CREATE_PATH});},async 'execute'(_0x56de91){const _0x2d37dd=a192_0x379150,_0x58d361=await prepareCreate(_0x56de91),_0x5b5d37=notificationLookupCommand(_0x56de91[_0x2d37dd(0x1d7)],_0x58d361[_0x2d37dd(0x1ce)][_0x2d37dd(0x1c7)]);let _0xf3216f;try{_0xf3216f=await createNotificationChannelConfig(_0x58d361[_0x2d37dd(0x1c0)]);}catch(_0x12c84d){if(isPlatformTransportFailure(_0x12c84d))throw notificationError(_0x2d37dd(0x1d4),_0x2d37dd(0x1d1),_0x2d37dd(0x1ca)+_0x5b5d37+_0x2d37dd(0x1d0));throw safeApiFailure(_0x2d37dd(0x1cc),_0x2d37dd(0x1c3),_0x2d37dd(0x1ca)+_0x5b5d37+_0x2d37dd(0x1bb));}if(!Number[_0x2d37dd(0x1da)](_0xf3216f)||_0xf3216f<=0x0)throw notificationError(_0x2d37dd(0x1d4),_0x2d37dd(0x1d8),_0x2d37dd(0x1ca)+_0x5b5d37+_0x2d37dd(0x1d0));let _0x331c9a;try{const _0x5af1ab=await getNotificationChannelConfig(_0xf3216f,_0x56de91['appCode']);_0x331c9a=normalizeExactNotificationConfig(_0x5af1ab,_0xf3216f,_0x56de91[_0x2d37dd(0x1d7)]);}catch{throw safeApiFailure('create',_0x2d37dd(0x1c9),_0x2d37dd(0x1ca)+_0x5b5d37+';\x20do\x20not\x20resubmit\x20automatically.');}return{'ok':!![],'data':{'operation':_0x2d37dd(0x1cc),'selector':{'appCode':_0x331c9a['appCode'],'id':_0x331c9a['id'],'configCode':_0x331c9a['configCode'],'configName':_0x331c9a[_0x2d37dd(0x1c4)],'channelType':_0x331c9a[_0x2d37dd(0x1c7)]},'before':null,'after':projectNotificationConfig(_0x331c9a),'dryRun':![],'backend':{'method':_0x2d37dd(0x1cd),'path':CREATE_PATH},'warnings':[],'verification':{'status':_0x2d37dd(0x1d3),'lookupCommand':_0x5b5d37}},'message':_0x2d37dd(0x1bd)+_0x331c9a['id']};}};
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
- const a193_0x45262b=a193_0x4170;(function(_0x35c7cf,_0x5b3ccd){const _0x2f8558=a193_0x4170,_0x330163=_0x35c7cf();while(!![]){try{const _0x4c5966=parseInt(_0x2f8558(0xd4))/0x1+-parseInt(_0x2f8558(0xcd))/0x2*(parseInt(_0x2f8558(0xc6))/0x3)+-parseInt(_0x2f8558(0xb6))/0x4*(-parseInt(_0x2f8558(0xd5))/0x5)+-parseInt(_0x2f8558(0xc3))/0x6+parseInt(_0x2f8558(0xd1))/0x7+-parseInt(_0x2f8558(0xd0))/0x8+parseInt(_0x2f8558(0xb8))/0x9*(parseInt(_0x2f8558(0xba))/0xa);if(_0x4c5966===_0x5b3ccd)break;else _0x330163['push'](_0x330163['shift']());}catch(_0x45090f){_0x330163['push'](_0x330163['shift']());}}}(a193_0xd3e1,0x60e3d));import{asDryRunResult}from'../../commands/common/dry-run.js';function a193_0x4170(_0x36204e,_0x4e088d){_0x36204e=_0x36204e-0xb6;const _0xd3e169=a193_0xd3e1();let _0x41705c=_0xd3e169[_0x36204e];return _0x41705c;}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_0x45262b(0xbb),REFERENCE_WARNING=a193_0x45262b(0xc4);function a193_0xd3e1(){const _0x461e9d=['9GYOrxA','some','8141390uwOuqm','/notification/channel-config/delete','mutation','\x20remains\x20present\x20after\x20delete.',';\x20no\x20automatic\x20retry\x20was\x20attempted.','Inspect\x20with\x20','unshift','notification_config_delete_outcome_unknown','Delete\x20response\x20was\x20unavailable;\x20list\x20readback\x20proved\x20ID\x20absence\x20without\x20resubmitting.','1155366DJCXpI','Deleting\x20this\x20app-level\x20config\x20may\x20make\x20dataset-level\x20channels\x20that\x20reference\x20it\x20unavailable;\x20dataset\x20references\x20were\x20not\x20verified\x20by\x20the\x20CLI.','channelType','1443363kpDrkz','delete','notification','verified','high-risk-write','before','notification_config_delete_verification_failed','2bJSPjr',';\x20do\x20not\x20resubmit\x20automatically.','config-delete','5886976gWoajv','1114015DKTIaz','POST','appCode','123071mQUkbS','1300daHquD','10924awlBHB','planned'];a193_0xd3e1=function(){return _0x461e9d;};return a193_0xd3e1();}async function prepareDelete(_0x2091da){const _0x2787d5=a193_0x45262b,_0x21989c=readNotificationId(_0x2091da),_0x34e448=await requireExactNotificationConfig(_0x2091da[_0x2787d5(0xd3)],_0x21989c,_0x2787d5(0xc7));return{'id':_0x21989c,'before':_0x34e448};}export const notificationConfigDelete={'service':a193_0x45262b(0xc8),'command':a193_0x45262b(0xcf),'description':'Delete\x20an\x20app-level\x20notification\x20config\x20after\x20exact\x20preflight','risk':a193_0x45262b(0xca),'requiresAppCode':!![],'structuredErrors':!![],'flags':[NOTIFICATION_ID_FLAG,NOTIFICATION_APP_FLAG],async 'validate'(_0x136cfe){readNotificationId(_0x136cfe),requireNotificationExplicitYes(_0x136cfe);},async 'dryRun'(_0xd26828){const _0x69013f=a193_0x45262b,_0x1b2441=await prepareDelete(_0xd26828),_0x493af5=notificationLookupCommand(_0xd26828[_0x69013f(0xd3)],_0x1b2441[_0x69013f(0xcb)][_0x69013f(0xc5)]);return asDryRunResult({'operation':_0x69013f(0xc7),'selector':notificationSelector(_0x1b2441[_0x69013f(0xcb)]),'before':projectNotificationConfig(_0x1b2441[_0x69013f(0xcb)]),'after':null,'dryRun':!![],'backend':{'method':_0x69013f(0xd2),'path':DELETE_PATH},'warnings':[REFERENCE_WARNING],'verification':{'status':_0x69013f(0xb7),'lookupCommand':_0x493af5}},{'method':_0x69013f(0xd2),'url':DELETE_PATH});},async 'execute'(_0x1aced5){const _0x5d8e68=a193_0x45262b;requireNotificationExplicitYes(_0x1aced5);const _0x3ab56d=await prepareDelete(_0x1aced5),_0x336b98=notificationLookupCommand(_0x1aced5[_0x5d8e68(0xd3)],_0x3ab56d[_0x5d8e68(0xcb)][_0x5d8e68(0xc5)]);let _0x1ef044=![];try{await deleteNotificationChannelConfig(_0x3ab56d['id'],_0x1aced5[_0x5d8e68(0xd3)]);}catch(_0x2b94d8){if(!isPlatformTransportFailure(_0x2b94d8))throw safeApiFailure(_0x5d8e68(0xc7),_0x5d8e68(0xbc),'Inspect\x20with\x20'+_0x336b98+_0x5d8e68(0xbe));_0x1ef044=!![];}let _0x123d0d;try{_0x123d0d=await listNotificationChannelConfigs(_0x1aced5[_0x5d8e68(0xd3)],_0x3ab56d[_0x5d8e68(0xcb)][_0x5d8e68(0xc5)]),validateNotificationDeleteReadback(_0x123d0d,_0x1aced5[_0x5d8e68(0xd3)],_0x3ab56d['before'][_0x5d8e68(0xc5)]);}catch{throw notificationError(_0x1ef044?_0x5d8e68(0xc1):'notification_config_delete_verification_unavailable','Notification\x20config\x20'+_0x3ab56d['id']+'\x20delete\x20could\x20not\x20be\x20verified.',_0x5d8e68(0xbf)+_0x336b98+_0x5d8e68(0xce));}if(_0x123d0d[_0x5d8e68(0xb9)](_0x33ee73=>_0x33ee73['id']===_0x3ab56d['id']))throw notificationError(_0x1ef044?_0x5d8e68(0xc1):_0x5d8e68(0xcc),'Notification\x20config\x20'+_0x3ab56d['id']+_0x5d8e68(0xbd),_0x5d8e68(0xbf)+_0x336b98+_0x5d8e68(0xce));const _0x4a48d2=[REFERENCE_WARNING];return _0x1ef044&&_0x4a48d2[_0x5d8e68(0xc0)](_0x5d8e68(0xc2)),{'ok':!![],'data':{'operation':'delete','selector':notificationSelector(_0x3ab56d[_0x5d8e68(0xcb)]),'before':projectNotificationConfig(_0x3ab56d[_0x5d8e68(0xcb)]),'after':null,'dryRun':![],'backend':{'method':_0x5d8e68(0xd2),'path':DELETE_PATH},'warnings':_0x4a48d2,'verification':{'status':_0x5d8e68(0xc9),'absenceConfirmed':!![],'recoveredAfterUnknownResponse':_0x1ef044,'lookupCommand':_0x336b98}},'message':'Deleted\x20notification\x20config\x20'+_0x3ab56d['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_0x3836(){const _0x3a16a2=['1132284BuKgrK','all','string','3eyRFDY','\x20notification\x20config(s)','2488576CBQeFD','40blaRqI','577086MCrFlu','Notification\x20channel\x20type','notification','List\x20app-level\x20notification\x20configs\x20and\x20their\x20configCode\x20values','map','appCode','9DIdZjy','config-list','bool','length','type','Found\x20','flat','boolean','trim','985726QKKxDb','592228HOGLDv','34623610SFyrVT','2162400SevAvx','--all\x20and\x20--type\x20are\x20mutually\x20exclusive.'];a194_0x3836=function(){return _0x3a16a2;};return a194_0x3836();}const a194_0x5170e9=a194_0x4cdf;(function(_0x533ff4,_0xcfa3f9){const _0x25f5f5=a194_0x4cdf,_0x4cddd5=_0x533ff4();while(!![]){try{const _0x29c3db=-parseInt(_0x25f5f5(0x1a5))/0x1+-parseInt(_0x25f5f5(0x1a3))/0x2*(parseInt(_0x25f5f5(0x1a1))/0x3)+parseInt(_0x25f5f5(0x19a))/0x4+-parseInt(_0x25f5f5(0x19c))/0x5+parseInt(_0x25f5f5(0x19e))/0x6+parseInt(_0x25f5f5(0x199))/0x7*(-parseInt(_0x25f5f5(0x1a4))/0x8)+-parseInt(_0x25f5f5(0x190))/0x9*(-parseInt(_0x25f5f5(0x19b))/0xa);if(_0x29c3db===_0xcfa3f9)break;else _0x4cddd5['push'](_0x4cddd5['shift']());}catch(_0x578875){_0x4cddd5['push'](_0x4cddd5['shift']());}}}(a194_0x3836,0xcd5e4));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{listNotificationChannelConfigs}from'../../core/api-client.js';function a194_0x4cdf(_0x9ce818,_0x377225){_0x9ce818=_0x9ce818-0x18b;const _0x3836c2=a194_0x3836();let _0x4cdf68=_0x3836c2[_0x9ce818];return _0x4cdf68;}import{CliErrors}from'../../errors.js';import{NOTIFICATION_CHANNEL_TYPES,projectNotificationListConfig,readNotificationChannelType}from'../../commands/notification/shared.js';export const notificationConfigList={'service':a194_0x5170e9(0x18c),'command':a194_0x5170e9(0x191),'description':a194_0x5170e9(0x18d),'risk':'read','flags':[APPCODE_FLAG_OPTIONAL,{'name':'type','type':a194_0x5170e9(0x1a0),'description':a194_0x5170e9(0x18b),'enum':NOTIFICATION_CHANNEL_TYPES},{'name':a194_0x5170e9(0x19f),'type':a194_0x5170e9(0x197),'default':![],'description':'List\x20configs\x20for\x20every\x20supported\x20notification\x20channel\x20type'}],async 'validate'(_0x3b6a52){const _0x1f2c37=a194_0x5170e9;if(_0x3b6a52[_0x1f2c37(0x192)](_0x1f2c37(0x19f))&&_0x3b6a52['str'](_0x1f2c37(0x194))[_0x1f2c37(0x198)]())throw CliErrors['validation'](_0x1f2c37(0x19d),'Use\x20--all,\x20or\x20query\x20one\x20explicit\x20--type.');if(_0x3b6a52[_0x1f2c37(0x192)]('all'))return;readNotificationChannelType(_0x3b6a52);},async 'execute'(_0x5994bf){const _0x251a3a=a194_0x5170e9;if(_0x5994bf[_0x251a3a(0x192)]('all')){const _0x282a57=await Promise['all'](NOTIFICATION_CHANNEL_TYPES['map'](_0x17d18c=>listNotificationChannelConfigs(_0x5994bf[_0x251a3a(0x18f)],_0x17d18c))),_0x55ea0d=_0x282a57[_0x251a3a(0x196)]()[_0x251a3a(0x18e)](projectNotificationListConfig);return{'ok':!![],'data':{'appCode':_0x5994bf[_0x251a3a(0x18f)],'channelTypes':NOTIFICATION_CHANNEL_TYPES,'count':_0x55ea0d[_0x251a3a(0x193)],'configs':_0x55ea0d},'message':'Found\x20'+_0x55ea0d[_0x251a3a(0x193)]+'\x20notification\x20config(s)\x20across\x20all\x20channel\x20types'};}const _0x3b6e2c=readNotificationChannelType(_0x5994bf),_0xb7df3e=await listNotificationChannelConfigs(_0x5994bf['appCode'],_0x3b6e2c),_0x5aac5c=_0xb7df3e[_0x251a3a(0x18e)](projectNotificationListConfig);return{'ok':!![],'data':{'appCode':_0x5994bf['appCode'],'channelType':_0x3b6e2c,'count':_0x5aac5c[_0x251a3a(0x193)],'configs':_0x5aac5c},'message':_0x251a3a(0x195)+_0x5aac5c[_0x251a3a(0x193)]+'\x20'+_0x3b6e2c+_0x251a3a(0x1a2)};}};
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
- function a195_0x22e7(_0xcc3fb1,_0x563781){_0xcc3fb1=_0xcc3fb1-0xd2;const _0x248e8d=a195_0x248e();let _0x22e77d=_0x248e8d[_0xcc3fb1];return _0x22e77d;}const a195_0x3b5b55=a195_0x22e7;(function(_0x198c46,_0x42b4b4){const _0x163b10=a195_0x22e7,_0x4662ed=_0x198c46();while(!![]){try{const _0x16aee3=-parseInt(_0x163b10(0xd9))/0x1+-parseInt(_0x163b10(0xdd))/0x2+-parseInt(_0x163b10(0xf1))/0x3+parseInt(_0x163b10(0xf8))/0x4*(-parseInt(_0x163b10(0xed))/0x5)+-parseInt(_0x163b10(0xe2))/0x6*(-parseInt(_0x163b10(0xe3))/0x7)+-parseInt(_0x163b10(0xe0))/0x8*(parseInt(_0x163b10(0xdb))/0x9)+-parseInt(_0x163b10(0xd5))/0xa*(-parseInt(_0x163b10(0xe1))/0xb);if(_0x16aee3===_0x42b4b4)break;else _0x4662ed['push'](_0x4662ed['shift']());}catch(_0x4c021b){_0x4662ed['push'](_0x4662ed['shift']());}}}(a195_0x248e,0xba256));import{asDryRunResult}from'../../commands/common/dry-run.js';function a195_0x248e(){const _0x470dfb=['Inspect\x20ID\x20','before','10088QuKqaY','payload','Inspect\x20with\x20--id\x20','\x20via\x20','10WCwYMZ','allMatch','verified','update','1429093RIhDaj','channelType','585PsBWJk','high-risk-write','533370xonrbe','planned','patch','22440Tqvzfu','29529247TQRirp','42cWRQYX','1203041LqrTnL','Notification\x20config\x20','\x20readback\x20does\x20not\x20prove\x20the\x20requested\x20update.','notification_config_update_outcome_unknown','/notification/channel-config/update',';\x20do\x20not\x20resubmit\x20automatically.','appCode','provesChange','Update\x20an\x20app-level\x20notification\x20config\x20from\x20a\x20secure\x20JSON\x20patch','POST','1535BUgwWd','Update\x20response\x20was\x20unavailable;\x20exact-ID\x20readback\x20proved\x20changed\x20safe\x20fields\x20without\x20resubmitting.','\x20update\x20could\x20not\x20be\x20verified\x20by\x20exact\x20ID.','notification_config_update_verification_unavailable','1418121lQSmAG','notification_config_update_verification_failed','mutation','notification','config-update'];a195_0x248e=function(){return _0x470dfb;};return a195_0x248e();}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_0x3b5b55(0xe7);async function prepareUpdate(_0x38577c){const _0xfb0be1=a195_0x3b5b55,_0x46e658=readNotificationId(_0x38577c),_0x5a9142=await readNotificationDocument(_0x38577c,_0xfb0be1(0xd8)),_0x30d8f0=await requireExactNotificationConfig(_0x38577c[_0xfb0be1(0xe9)],_0x46e658,'update');return{'id':_0x46e658,'patch':_0x5a9142,'before':_0x30d8f0,'payload':mergeUpdateInput(_0x30d8f0,_0x5a9142),'planned':plannedUpdateProjection(_0x30d8f0,_0x5a9142)};}export const notificationConfigUpdate={'service':a195_0x3b5b55(0xf4),'command':a195_0x3b5b55(0xf5),'description':a195_0x3b5b55(0xeb),'risk':a195_0x3b5b55(0xdc),'requiresAppCode':!![],'structuredErrors':!![],'flags':[NOTIFICATION_ID_FLAG,...NOTIFICATION_INPUT_FLAGS,NOTIFICATION_APP_FLAG],async 'validate'(_0x4bc137){readNotificationId(_0x4bc137),assertSingleNotificationSource(_0x4bc137),requireNotificationExplicitYes(_0x4bc137);},async 'dryRun'(_0x4c54ca){const _0x165dbf=a195_0x3b5b55,_0x5bd462=await prepareUpdate(_0x4c54ca),_0x1336d2=notificationLookupCommand(_0x4c54ca[_0x165dbf(0xe9)],_0x5bd462[_0x165dbf(0xf7)][_0x165dbf(0xda)]);return asDryRunResult({'operation':_0x165dbf(0xd8),'selector':notificationSelector(_0x5bd462[_0x165dbf(0xf7)]),'before':projectNotificationConfig(_0x5bd462['before']),'after':_0x5bd462[_0x165dbf(0xde)],'dryRun':!![],'backend':{'method':_0x165dbf(0xec),'path':UPDATE_PATH},'warnings':[],'verification':{'status':_0x165dbf(0xde),'lookupCommand':_0x1336d2}},{'method':_0x165dbf(0xec),'url':UPDATE_PATH});},async 'execute'(_0x190734){const _0x59f090=a195_0x3b5b55;requireNotificationExplicitYes(_0x190734);const _0x21d991=await prepareUpdate(_0x190734),_0x1593ec=notificationLookupCommand(_0x190734[_0x59f090(0xe9)],_0x21d991[_0x59f090(0xf7)]['channelType']);let _0x5db7ec=![];try{await updateNotificationChannelConfig(_0x21d991[_0x59f090(0xd2)]);}catch(_0x226ca6){if(!isPlatformTransportFailure(_0x226ca6))throw safeApiFailure(_0x59f090(0xd8),_0x59f090(0xf3),_0x59f090(0xf6)+_0x21d991['id']+'\x20with\x20'+_0x1593ec+';\x20no\x20automatic\x20retry\x20was\x20attempted.');_0x5db7ec=!![];}let _0x1c7e56;try{const _0x3aded6=await getNotificationChannelConfig(_0x21d991['id'],_0x190734[_0x59f090(0xe9)]);_0x1c7e56=normalizeExactNotificationConfig(_0x3aded6,_0x21d991['id'],_0x190734[_0x59f090(0xe9)]);}catch{throw notificationError(_0x5db7ec?_0x59f090(0xe6):_0x59f090(0xf0),_0x59f090(0xe4)+_0x21d991['id']+_0x59f090(0xef),_0x59f090(0xd3)+_0x21d991['id']+_0x59f090(0xd4)+_0x1593ec+_0x59f090(0xe8));}const _0x43d2d5=requestedSafeFieldsMatch(_0x21d991[_0x59f090(0xf7)],_0x1c7e56,_0x21d991[_0x59f090(0xdf)]);if(!_0x43d2d5[_0x59f090(0xd6)]||_0x5db7ec&&!_0x43d2d5[_0x59f090(0xea)])throw notificationError(_0x5db7ec?'notification_config_update_outcome_unknown':_0x59f090(0xf2),_0x59f090(0xe4)+_0x21d991['id']+_0x59f090(0xe5),'Inspect\x20with\x20--id\x20'+_0x21d991['id']+'\x20via\x20'+_0x1593ec+_0x59f090(0xe8));const _0x4a43cf=_0x5db7ec?[_0x59f090(0xee)]:[];return{'ok':!![],'data':{'operation':_0x59f090(0xd8),'selector':notificationSelector(_0x1c7e56),'before':projectNotificationConfig(_0x21d991[_0x59f090(0xf7)]),'after':projectNotificationConfig(_0x1c7e56),'dryRun':![],'backend':{'method':_0x59f090(0xec),'path':UPDATE_PATH},'warnings':_0x4a43cf,'verification':{'status':_0x59f090(0xd7),'recoveredAfterUnknownResponse':_0x5db7ec,'verifiedFields':_0x43d2d5['verifiedFields'],'lookupCommand':_0x1593ec}},'message':'Updated\x20notification\x20config\x20'+_0x1c7e56['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 a196_0x2aa8(){const _0x2cc680=['1366458wAHedP','4409909JZoJEG','103194FwDCjg','424602xuLipZ','372119TKXhCs','45gMPxYr','496952zTIFWP','162ZCFecd','8PTaUWm','723391YjPwKL','780PBFBJR'];a196_0x2aa8=function(){return _0x2cc680;};return a196_0x2aa8();}(function(_0x5b3398,_0x1d5ca5){const _0x247a9b=a196_0x2633,_0x4bfdc8=_0x5b3398();while(!![]){try{const _0xc1fb05=parseInt(_0x247a9b(0x186))/0x1+-parseInt(_0x247a9b(0x18b))/0x2+-parseInt(_0x247a9b(0x188))/0x3*(-parseInt(_0x247a9b(0x190))/0x4)+parseInt(_0x247a9b(0x18d))/0x5*(parseInt(_0x247a9b(0x18a))/0x6)+parseInt(_0x247a9b(0x189))/0x7+parseInt(_0x247a9b(0x18e))/0x8*(parseInt(_0x247a9b(0x18f))/0x9)+-parseInt(_0x247a9b(0x187))/0xa*(parseInt(_0x247a9b(0x18c))/0xb);if(_0xc1fb05===_0x1d5ca5)break;else _0x4bfdc8['push'](_0x4bfdc8['shift']());}catch(_0x3d8d8a){_0x4bfdc8['push'](_0x4bfdc8['shift']());}}}(a196_0x2aa8,0xa78f0));import{notificationConfigList}from'../../commands/notification/config-list.js';import{notificationConfigCreate}from'../../commands/notification/config-create.js';import{notificationConfigUpdate}from'../../commands/notification/config-update.js';function a196_0x2633(_0xaf88cc,_0xfc5aed){_0xaf88cc=_0xaf88cc-0x186;const _0x2aa893=a196_0x2aa8();let _0x263386=_0x2aa893[_0xaf88cc];return _0x263386;}import{notificationConfigDelete}from'../../commands/notification/config-delete.js';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];