@lovrabet/rabetbase-cli 2.5.12 → 2.5.13-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 (380) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/api-group.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/api/generate-sdk-config-file.js +1 -1
  6. package/lib/api/legacy-api-file.js +1 -1
  7. package/lib/api/model-registry-file.js +1 -1
  8. package/lib/api/model-registry-scaffold.js +1 -1
  9. package/lib/api/model-source.js +1 -1
  10. package/lib/auth/auth-server-ui.js +1 -1
  11. package/lib/auth/auth-server.js +1 -1
  12. package/lib/auth/constant.js +1 -1
  13. package/lib/auth/get-cookie.js +1 -1
  14. package/lib/auth/get-session-user.js +1 -1
  15. package/lib/auth/is-session-valid.js +1 -1
  16. package/lib/auth/login-success-html.js +1 -1
  17. package/lib/auth/logout.js +1 -1
  18. package/lib/cli-flags.js +1 -1
  19. package/lib/cli.js +1 -1
  20. package/lib/commands/api/generate.js +1 -1
  21. package/lib/commands/api/index.js +1 -1
  22. package/lib/commands/api/list.js +1 -1
  23. package/lib/commands/api/pull.js +1 -1
  24. package/lib/commands/api/shared.js +1 -1
  25. package/lib/commands/app/detail.js +1 -1
  26. package/lib/commands/app/index.js +1 -1
  27. package/lib/commands/app/list.js +1 -1
  28. package/lib/commands/app/members-list.js +1 -1
  29. package/lib/commands/app/remote-directory.js +1 -1
  30. package/lib/commands/app/shared.js +1 -1
  31. package/lib/commands/app-config/delete.js +1 -1
  32. package/lib/commands/app-config/get.js +1 -1
  33. package/lib/commands/app-config/index.js +1 -1
  34. package/lib/commands/app-config/list.js +1 -1
  35. package/lib/commands/app-config/set.js +1 -1
  36. package/lib/commands/app-config/shared.js +1 -1
  37. package/lib/commands/auth/index.js +1 -1
  38. package/lib/commands/bff/create.js +1 -1
  39. package/lib/commands/bff/delete.js +1 -1
  40. package/lib/commands/bff/detail.js +1 -1
  41. package/lib/commands/bff/index.js +1 -1
  42. package/lib/commands/bff/list.js +1 -1
  43. package/lib/commands/bff/logs.js +1 -1
  44. package/lib/commands/bff/pull.js +1 -1
  45. package/lib/commands/bff/push.js +1 -1
  46. package/lib/commands/bff/status.js +1 -1
  47. package/lib/commands/cli-skill/index.js +1 -1
  48. package/lib/commands/cli-update.js +1 -1
  49. package/lib/commands/codegen/index.js +1 -1
  50. package/lib/commands/codegen/sdk.js +1 -1
  51. package/lib/commands/codegen/sql.js +1 -1
  52. package/lib/commands/common/app-registry.js +1 -1
  53. package/lib/commands/common/app-selector.js +1 -1
  54. package/lib/commands/common/async-task.js +1 -1
  55. package/lib/commands/common/dry-run.js +1 -1
  56. package/lib/commands/common/flags.js +1 -1
  57. package/lib/commands/common/local-file.js +1 -1
  58. package/lib/commands/common/validate.js +1 -1
  59. package/lib/commands/config/delete.js +1 -1
  60. package/lib/commands/config/get.js +1 -1
  61. package/lib/commands/config/index.js +1 -1
  62. package/lib/commands/config/init.js +1 -1
  63. package/lib/commands/config/list.js +1 -1
  64. package/lib/commands/config/set.js +1 -1
  65. package/lib/commands/config/shared.js +1 -1
  66. package/lib/commands/dataset/batch-design.js +1 -1
  67. package/lib/commands/dataset/business-group-update.js +1 -1
  68. package/lib/commands/dataset/business-groups.js +1 -1
  69. package/lib/commands/dataset/capability.js +1 -1
  70. package/lib/commands/dataset/cross-relation-create.js +1 -1
  71. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  72. package/lib/commands/dataset/cross-relation-list.js +1 -1
  73. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  74. package/lib/commands/dataset/cross-relation-update.js +1 -1
  75. package/lib/commands/dataset/delete.js +1 -1
  76. package/lib/commands/dataset/design-context.js +1 -1
  77. package/lib/commands/dataset/design-start.js +1 -1
  78. package/lib/commands/dataset/design-status.js +1 -1
  79. package/lib/commands/dataset/design-sync-retry.js +1 -1
  80. package/lib/commands/dataset/design-sync-status.js +1 -1
  81. package/lib/commands/dataset/design-validate.js +1 -1
  82. package/lib/commands/dataset/detail.js +1 -1
  83. package/lib/commands/dataset/extend-update.js +1 -1
  84. package/lib/commands/dataset/field-restore.js +1 -1
  85. package/lib/commands/dataset/field-update.js +1 -1
  86. package/lib/commands/dataset/generate.js +1 -1
  87. package/lib/commands/dataset/index.js +1 -1
  88. package/lib/commands/dataset/list.js +1 -1
  89. package/lib/commands/dataset/operations.js +1 -1
  90. package/lib/commands/dataset/relation-audit.js +1 -1
  91. package/lib/commands/dataset/relation-create.js +1 -1
  92. package/lib/commands/dataset/relation-delete.js +1 -1
  93. package/lib/commands/dataset/relation-shared.js +1 -1
  94. package/lib/commands/dataset/relation-update.js +1 -1
  95. package/lib/commands/dataset/relations.js +1 -1
  96. package/lib/commands/dataset/rename.js +1 -1
  97. package/lib/commands/dataset/restore.js +1 -1
  98. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  99. package/lib/commands/db/analysis-batching.js +1 -1
  100. package/lib/commands/db/analyze-batch-plan.js +1 -1
  101. package/lib/commands/db/analyze-cancel.js +1 -1
  102. package/lib/commands/db/analyze-start.js +1 -1
  103. package/lib/commands/db/analyze-status.js +1 -1
  104. package/lib/commands/db/create.js +1 -1
  105. package/lib/commands/db/cross-db-analysis-shared.js +1 -1
  106. package/lib/commands/db/cross-db-analyze-latest.js +1 -1
  107. package/lib/commands/db/cross-db-analyze-start.js +1 -1
  108. package/lib/commands/db/cross-db-analyze-status.js +1 -1
  109. package/lib/commands/db/delete.js +1 -1
  110. package/lib/commands/db/detail.js +1 -1
  111. package/lib/commands/db/diff-refresh-start.js +1 -1
  112. package/lib/commands/db/diff-refresh-status.js +1 -1
  113. package/lib/commands/db/diff.js +1 -1
  114. package/lib/commands/db/index.js +1 -1
  115. package/lib/commands/db/list.js +1 -1
  116. package/lib/commands/db/shared.js +1 -1
  117. package/lib/commands/db/table-diff-shared.js +1 -1
  118. package/lib/commands/db/tables.js +1 -1
  119. package/lib/commands/db/test.js +1 -1
  120. package/lib/commands/db/update.js +1 -1
  121. package/lib/commands/deployment/index.js +1 -1
  122. package/lib/commands/deployment/sync-all.js +1 -1
  123. package/lib/commands/deployment/sync-jobs.js +1 -1
  124. package/lib/commands/deployment/sync-status.js +1 -1
  125. package/lib/commands/doctor.js +1 -1
  126. package/lib/commands/file/index.js +1 -1
  127. package/lib/commands/flow/create.js +1 -1
  128. package/lib/commands/flow/detail.js +1 -1
  129. package/lib/commands/flow/index.js +1 -1
  130. package/lib/commands/flow/list.js +1 -1
  131. package/lib/commands/flow/page-list.js +1 -1
  132. package/lib/commands/flow/publish.js +1 -1
  133. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  134. package/lib/commands/flow/runtime-role-list.js +1 -1
  135. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  136. package/lib/commands/flow/runtime-user-search.js +1 -1
  137. package/lib/commands/flow/shared.js +1 -1
  138. package/lib/commands/flow/update.js +1 -1
  139. package/lib/commands/flow/validate.js +1 -1
  140. package/lib/commands/instant-api-policy/current.js +1 -1
  141. package/lib/commands/instant-api-policy/index.js +1 -1
  142. package/lib/commands/instant-api-policy/init.js +1 -1
  143. package/lib/commands/instant-api-policy/publish.js +1 -1
  144. package/lib/commands/instant-api-policy/pull.js +1 -1
  145. package/lib/commands/instant-api-policy/revision.js +1 -1
  146. package/lib/commands/instant-api-policy/revisions.js +1 -1
  147. package/lib/commands/instant-api-policy/rollback.js +1 -1
  148. package/lib/commands/instant-api-policy/shared.js +1 -1
  149. package/lib/commands/instant-api-policy/validate.js +1 -1
  150. package/lib/commands/issue/context.js +1 -1
  151. package/lib/commands/issue/index.js +1 -1
  152. package/lib/commands/issue/nudge.js +1 -1
  153. package/lib/commands/issue/report.js +1 -1
  154. package/lib/commands/kb/create.js +1 -1
  155. package/lib/commands/kb/delete.js +1 -1
  156. package/lib/commands/kb/detail.js +1 -1
  157. package/lib/commands/kb/index.js +1 -1
  158. package/lib/commands/kb/list.js +1 -1
  159. package/lib/commands/kb/search.js +1 -1
  160. package/lib/commands/kb/shared.js +1 -1
  161. package/lib/commands/kb/update.js +1 -1
  162. package/lib/commands/logs/index.js +1 -1
  163. package/lib/commands/menu/asset-update.js +1 -1
  164. package/lib/commands/menu/delete.js +1 -1
  165. package/lib/commands/menu/external-link-create.js +1 -1
  166. package/lib/commands/menu/external-link-update.js +1 -1
  167. package/lib/commands/menu/group-create.js +1 -1
  168. package/lib/commands/menu/group-update.js +1 -1
  169. package/lib/commands/menu/index.js +1 -1
  170. package/lib/commands/menu/list.js +1 -1
  171. package/lib/commands/menu/move.js +1 -1
  172. package/lib/commands/menu/regroup-start.js +1 -1
  173. package/lib/commands/menu/rename.js +1 -1
  174. package/lib/commands/menu/shared/compare-table.js +1 -1
  175. package/lib/commands/menu/shared/delete-plan.js +1 -1
  176. package/lib/commands/menu/shared/facts.js +1 -1
  177. package/lib/commands/menu/shared/index.js +1 -1
  178. package/lib/commands/menu/shared/inquirer.js +1 -1
  179. package/lib/commands/menu/shared/local-pages.js +1 -1
  180. package/lib/commands/menu/shared/logic.js +1 -1
  181. package/lib/commands/menu/shared/mutations.js +1 -1
  182. package/lib/commands/menu/shared/path.js +1 -1
  183. package/lib/commands/menu/shared/service.js +1 -1
  184. package/lib/commands/menu/shared/subapp-assets.js +1 -1
  185. package/lib/commands/menu/shared/sync-core.js +1 -1
  186. package/lib/commands/menu/shared/update-core.js +1 -1
  187. package/lib/commands/menu/shared/valid-url.js +1 -1
  188. package/lib/commands/menu/subapp-assets-status.js +1 -1
  189. package/lib/commands/menu/subapp-assets-update.js +1 -1
  190. package/lib/commands/menu/sync.js +1 -1
  191. package/lib/commands/menu/visibility-update.js +1 -1
  192. package/lib/commands/notification/config-create.js +1 -1
  193. package/lib/commands/notification/config-delete.js +1 -1
  194. package/lib/commands/notification/config-list.js +1 -1
  195. package/lib/commands/notification/config-update.js +1 -1
  196. package/lib/commands/notification/index.js +1 -1
  197. package/lib/commands/notification/shared.js +1 -1
  198. package/lib/commands/ocr/index.js +1 -1
  199. package/lib/commands/page/create.js +1 -1
  200. package/lib/commands/page/custom/detail.js +1 -1
  201. package/lib/commands/page/custom/list.js +1 -1
  202. package/lib/commands/page/custom/publish.js +1 -1
  203. package/lib/commands/page/custom/shared.js +1 -1
  204. package/lib/commands/page/custom/syntax.js +1 -1
  205. package/lib/commands/page/custom/update.js +1 -1
  206. package/lib/commands/page/data-list-status.js +1 -1
  207. package/lib/commands/page/generate-start.js +1 -1
  208. package/lib/commands/page/generate-status.js +1 -1
  209. package/lib/commands/page/index.js +1 -1
  210. package/lib/commands/page/pull.js +1 -1
  211. package/lib/commands/page/push.js +1 -1
  212. package/lib/commands/page/relation-audit.js +1 -1
  213. package/lib/commands/page/restore.js +1 -1
  214. package/lib/commands/page/shared.js +1 -1
  215. package/lib/commands/page/sync.js +1 -1
  216. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  217. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  218. package/lib/commands/project/create/format-elapsed.js +1 -1
  219. package/lib/commands/project/create/main.js +1 -1
  220. package/lib/commands/project/create/materialize-project-template.js +1 -1
  221. package/lib/commands/project/create/project-name.js +1 -1
  222. package/lib/commands/project/create/project-template-archive.js +1 -1
  223. package/lib/commands/project/create/project-template-path.js +1 -1
  224. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  225. package/lib/commands/project/create/use-format-code.js +1 -1
  226. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  227. package/lib/commands/project/domain-routing-sync.js +1 -1
  228. package/lib/commands/project/index.js +1 -1
  229. package/lib/commands/project/upgrade.js +1 -1
  230. package/lib/commands/registry.js +1 -1
  231. package/lib/commands/role/delete.js +1 -1
  232. package/lib/commands/role/detail.js +1 -1
  233. package/lib/commands/role/index.js +1 -1
  234. package/lib/commands/role/list.js +1 -1
  235. package/lib/commands/role/shared.js +1 -1
  236. package/lib/commands/role/update.js +1 -1
  237. package/lib/commands/role/user-add.js +1 -1
  238. package/lib/commands/role/user-remove.js +1 -1
  239. package/lib/commands/role/user-resolve.js +1 -1
  240. package/lib/commands/rule/get.js +1 -1
  241. package/lib/commands/rule/index.js +1 -1
  242. package/lib/commands/rule/list.js +1 -1
  243. package/lib/commands/rule/set.js +1 -1
  244. package/lib/commands/rule/shared.js +1 -1
  245. package/lib/commands/run/index.js +1 -1
  246. package/lib/commands/schema.js +1 -1
  247. package/lib/commands/sql/create.js +1 -1
  248. package/lib/commands/sql/delete.js +1 -1
  249. package/lib/commands/sql/detail.js +1 -1
  250. package/lib/commands/sql/exec.js +1 -1
  251. package/lib/commands/sql/index.js +1 -1
  252. package/lib/commands/sql/list.js +1 -1
  253. package/lib/commands/sql/pull.js +1 -1
  254. package/lib/commands/sql/push.js +1 -1
  255. package/lib/commands/sql/shared.js +1 -1
  256. package/lib/commands/sql/status.js +1 -1
  257. package/lib/commands/sql/validate.js +1 -1
  258. package/lib/commands/task/index.js +1 -1
  259. package/lib/commands/task/status.js +1 -1
  260. package/lib/commands/tenant/index.js +1 -1
  261. package/lib/commands/tenant/members-list.js +1 -1
  262. package/lib/commands/tenant/shared.js +1 -1
  263. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  264. package/lib/commands/user-account/feishu-bind.js +1 -1
  265. package/lib/commands/user-account/index.js +1 -1
  266. package/lib/commands/workspace/add.js +1 -1
  267. package/lib/commands/workspace/index.js +1 -1
  268. package/lib/commands/workspace/remove.js +1 -1
  269. package/lib/config/domain-config.js +1 -1
  270. package/lib/config/project-domain-routing.js +1 -1
  271. package/lib/config/region-config.js +1 -1
  272. package/lib/config/schema.js +1 -1
  273. package/lib/constant/cdn.js +1 -1
  274. package/lib/constant/cli.js +1 -1
  275. package/lib/constant/defaults.js +1 -1
  276. package/lib/constant/domain.js +1 -1
  277. package/lib/constant/env.js +1 -1
  278. package/lib/constant/output.js +1 -1
  279. package/lib/constant/paths.js +1 -1
  280. package/lib/constant/region.js +1 -1
  281. package/lib/constant/risk.js +1 -1
  282. package/lib/constant/routing-profile.js +1 -1
  283. package/lib/context/app-resolver.js +1 -1
  284. package/lib/context/auth-resolver.js +1 -1
  285. package/lib/context/config-loader.js +1 -1
  286. package/lib/context.js +1 -1
  287. package/lib/core/alias-resolver.js +1 -1
  288. package/lib/core/api-client.js +1 -1
  289. package/lib/core/bff/config.js +1 -1
  290. package/lib/core/bff/file-system.js +1 -1
  291. package/lib/core/bff/hash.js +1 -1
  292. package/lib/core/bff/hook-directory.js +1 -1
  293. package/lib/core/bff/lock.js +1 -1
  294. package/lib/core/bff/utils.js +1 -1
  295. package/lib/core/cross-db-analysis.js +1 -1
  296. package/lib/core/cross-db-relation.js +1 -1
  297. package/lib/core/db-resolver.js +1 -1
  298. package/lib/core/flow-config.js +1 -1
  299. package/lib/core/instant-api-policy/config.js +1 -1
  300. package/lib/core/instant-api-policy/endpoints.js +1 -1
  301. package/lib/core/kb-management-client.js +1 -1
  302. package/lib/core/kb-search-client.js +1 -1
  303. package/lib/core/page/file-system.js +1 -1
  304. package/lib/core/page/hash.js +1 -1
  305. package/lib/core/page/lock.js +1 -1
  306. package/lib/core/page/lr-smart-jsx.js +1 -1
  307. package/lib/core/sql-index-auditor.js +1 -1
  308. package/lib/core/sql-sync/config.js +1 -1
  309. package/lib/core/sql-sync/file-system.js +1 -1
  310. package/lib/core/sql-sync/hash.js +1 -1
  311. package/lib/core/sql-sync/lock.js +1 -1
  312. package/lib/core/sql-sync/utils.js +1 -1
  313. package/lib/core/sql-validator.js +1 -1
  314. package/lib/errors.js +1 -1
  315. package/lib/framework/build-all-flags.js +1 -1
  316. package/lib/framework/error-output.js +1 -1
  317. package/lib/framework/explicit-yes.js +1 -1
  318. package/lib/framework/flags.js +1 -1
  319. package/lib/framework/help.js +1 -1
  320. package/lib/framework/index.js +1 -1
  321. package/lib/framework/output.js +1 -1
  322. package/lib/framework/response.js +1 -1
  323. package/lib/framework/runner-alias.js +1 -1
  324. package/lib/framework/runner.js +1 -1
  325. package/lib/framework/schema-export.js +1 -1
  326. package/lib/framework/supported-flags.js +1 -1
  327. package/lib/framework/types.js +1 -1
  328. package/lib/generated/build-info.d.ts +4 -4
  329. package/lib/generated/build-info.js +1 -1
  330. package/lib/generated/official-routing.js +1 -1
  331. package/lib/generated/routing-contract.js +1 -1
  332. package/lib/help.js +1 -1
  333. package/lib/postinstall.js +1 -1
  334. package/lib/runtime/confirmation.js +1 -1
  335. package/lib/runtime/event.js +1 -1
  336. package/lib/runtime/index.js +1 -1
  337. package/lib/runtime/queue.js +1 -1
  338. package/lib/runtime/resolve.js +1 -1
  339. package/lib/services/dataset-design/checkpoint.js +1 -1
  340. package/lib/services/dataset-design/commands.js +1 -1
  341. package/lib/services/dataset-design/contract.js +1 -1
  342. package/lib/skills/builtin-skill.js +1 -1
  343. package/lib/skills/main.js +1 -1
  344. package/lib/skills/npx-skills-add.js +1 -1
  345. package/lib/skills/skill-presence.js +1 -1
  346. package/lib/telemetry/cli-command-trace.js +1 -1
  347. package/lib/telemetry/cli-help-trace.js +1 -1
  348. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  349. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  350. package/lib/telemetry/send-cli-trace-log.js +1 -1
  351. package/lib/utils/ai_config.js +1 -1
  352. package/lib/utils/apply-jq-filter.js +1 -1
  353. package/lib/utils/cdn-config.js +1 -1
  354. package/lib/utils/check-sdk-version.js +1 -1
  355. package/lib/utils/cli-version-check.js +1 -1
  356. package/lib/utils/cli-version-policy.js +1 -1
  357. package/lib/utils/config.js +1 -1
  358. package/lib/utils/entity-with-id.js +1 -1
  359. package/lib/utils/file-utils.js +1 -1
  360. package/lib/utils/guides-cdn.js +1 -1
  361. package/lib/utils/http-client.js +1 -1
  362. package/lib/utils/is-non-interactive.js +1 -1
  363. package/lib/utils/logger.js +1 -1
  364. package/lib/utils/params.js +1 -1
  365. package/lib/utils/platform.js +1 -1
  366. package/lib/utils/sleep.js +1 -1
  367. package/lib/utils/template-replacer.js +1 -1
  368. package/lib/utils/update-notice.js +1 -1
  369. package/lib/utils/version.js +1 -1
  370. package/lib/utils/with-active-cookie.js +1 -1
  371. package/lib/utils/write-cli-side-channel.js +1 -1
  372. package/package.json +1 -1
  373. package/skills/rabetbase/SKILL.md +1 -1
  374. package/skills/rabetbase/guides/custom-page-workflow.md +32 -2
  375. package/skills/rabetbase/knowledge/custom-page/generation-standards.md +106 -6
  376. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  377. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  378. package/skills/rabetbase.manifest.json +3 -3
  379. package/templates/custom-pages/blank.json +1 -1
  380. package/templates/custom-pages/dashboard.json +1 -1
@@ -1 +1 @@
1
- const a34_0x4c672b=a34_0x184b;(function(_0x46c2ef,_0x4c2f82){const _0x34ea07=a34_0x184b,_0x3a3f0a=_0x46c2ef();while(!![]){try{const _0xb6ef61=parseInt(_0x34ea07(0xfd))/0x1+parseInt(_0x34ea07(0xe9))/0x2*(parseInt(_0x34ea07(0xeb))/0x3)+-parseInt(_0x34ea07(0xf4))/0x4*(-parseInt(_0x34ea07(0xf2))/0x5)+parseInt(_0x34ea07(0x102))/0x6+parseInt(_0x34ea07(0xfc))/0x7*(-parseInt(_0x34ea07(0xf6))/0x8)+parseInt(_0x34ea07(0xf7))/0x9+-parseInt(_0x34ea07(0x101))/0xa*(parseInt(_0x34ea07(0x100))/0xb);if(_0xb6ef61===_0x4c2f82)break;else _0x3a3f0a['push'](_0x3a3f0a['shift']());}catch(_0x3dfc18){_0x3a3f0a['push'](_0x3a3f0a['shift']());}}}(a34_0x34ef,0xae45c));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a34_0x34ef(){const _0x1acbdc=['number','POST','get','Updated','/smartapi/app-config/create','appCode','255eYJUEi','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','10980eYASkL','set','6649648yODMRJ','5723244cmFaZJ','Read\x20config\x20value\x20from\x20file','string','Created','/smartapi/app-config/update','7hToWTG','1418809SCNpTM',',\x20appCode=','update','20185187eJvoLL','10HFWVKB','1231920sKZgKO','app-config','create','write','tags','626VNkuqu','isFinite','9393cFTKDj'];a34_0x34ef=function(){return _0x1acbdc;};return a34_0x34ef();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';function a34_0x184b(_0x32aea3,_0x1aee19){_0x32aea3=_0x32aea3-0xe5;const _0x34ef68=a34_0x34ef();let _0x184b3d=_0x34ef68[_0x32aea3];return _0x184b3d;}const CREATE_PATH=a34_0x4c672b(0xf0),UPDATE_PATH=a34_0x4c672b(0xfb);export const appConfigSet={'service':a34_0x4c672b(0xe5),'command':a34_0x4c672b(0xf5),'description':a34_0x4c672b(0xf3),'risk':a34_0x4c672b(0xe7),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':'file','type':a34_0x4c672b(0xf9),'description':a34_0x4c672b(0xf8)}],async 'validate'(_0x4e1cff){readKeyArg(_0x4e1cff),readOptionalTags(_0x4e1cff),assertSingleValueSource(_0x4e1cff);},async 'dryRun'(_0x3d6fb0){const _0x19ce32=a34_0x4c672b,_0x254789=readKeyArg(_0x3d6fb0),_0x1b66db=readOptionalTags(_0x3d6fb0),_0x1eb3bd=assertSingleValueSource(_0x3d6fb0);await assertValueSourceReadable(_0x1eb3bd);const _0x37e366=await withAppConfigApiBoundary(_0x19ce32(0xee),{'appCode':_0x3d6fb0['appCode'],'key':_0x254789},()=>getAppConfigByKey(_0x3d6fb0[_0x19ce32(0xf1)],_0x254789)),_0x183c20=_0x37e366?_0x19ce32(0xff):'create',_0x4fdd26=_0x37e366?projectAppConfig(_0x37e366):null,_0x1023ee=plannedAppConfig({'appCode':_0x3d6fb0[_0x19ce32(0xf1)],'key':_0x254789,'tags':_0x1b66db??_0x37e366?.[_0x19ce32(0xe8)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x183c20,'appCode':_0x3d6fb0['appCode'],'key':_0x254789,'before':_0x4fdd26,'after':_0x1023ee,'dryRun':!![]}),{'method':_0x19ce32(0xed),'url':_0x183c20===_0x19ce32(0xff)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x704073){const _0x485dab=a34_0x4c672b,_0x15ce7b=readKeyArg(_0x704073),_0x201360=readOptionalTags(_0x704073),_0x52b468=await withAppConfigApiBoundary(_0x485dab(0xee),{'appCode':_0x704073[_0x485dab(0xf1)],'key':_0x15ce7b},()=>getAppConfigByKey(_0x704073[_0x485dab(0xf1)],_0x15ce7b)),_0x5dc6b8=_0x52b468?projectAppConfig(_0x52b468):null,_0x58564=_0x52b468?_0x485dab(0xff):_0x485dab(0xe6),{value:_0x5e3528,warnings:_0x2ce1f1}=await readAppConfigValue(_0x704073),_0x4d8409={'appCode':_0x704073['appCode'],'key':_0x15ce7b,'value':_0x5e3528,'tags':_0x201360??_0x52b468?.[_0x485dab(0xe8)]??undefined};await withAppConfigApiBoundary(_0x58564,{'appCode':_0x704073[_0x485dab(0xf1)],'key':_0x15ce7b},async()=>{_0x52b468?await updateAppConfig({..._0x4d8409,'id':requireAppConfigId(_0x52b468,_0x15ce7b,_0x704073['appCode'])}):await createAppConfig(_0x4d8409);});const _0x4d440b=await withAppConfigApiBoundary(_0x485dab(0xee),{'appCode':_0x704073[_0x485dab(0xf1)],'key':_0x15ce7b},()=>getAppConfigByKey(_0x704073[_0x485dab(0xf1)],_0x15ce7b)),_0x10440e=_0x4d440b?projectAppConfig(_0x4d440b):plannedAppConfig({'appCode':_0x704073[_0x485dab(0xf1)],'key':_0x15ce7b,'tags':_0x4d8409[_0x485dab(0xe8)],'hasValue':_0x5e3528!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x58564,'appCode':_0x704073[_0x485dab(0xf1)],'key':_0x15ce7b,'before':_0x5dc6b8,'after':_0x10440e,'dryRun':![],'warnings':_0x2ce1f1}),'message':(_0x58564===_0x485dab(0xff)?_0x485dab(0xef):_0x485dab(0xfa))+'\x20app\x20config\x20'+_0x15ce7b};}};function requireAppConfigId(_0x56bcdd,_0x4e08d0,_0x54917e){const _0x2f897c=a34_0x4c672b;if(typeof _0x56bcdd['id']===_0x2f897c(0xec)&&Number[_0x2f897c(0xea)](_0x56bcdd['id'])&&_0x56bcdd['id']>0x0)return _0x56bcdd['id'];throw CliErrors['apiError']('App\x20config\x20server\x20id\x20missing\x20for\x20key='+_0x4e08d0+_0x2f897c(0xfe)+_0x54917e);}
1
+ const a34_0x24cfe3=a34_0x492c;(function(_0xe1397b,_0x7cbdb0){const _0x264e85=a34_0x492c,_0x426768=_0xe1397b();while(!![]){try{const _0x1b15f0=parseInt(_0x264e85(0x198))/0x1*(parseInt(_0x264e85(0x181))/0x2)+parseInt(_0x264e85(0x196))/0x3*(parseInt(_0x264e85(0x18d))/0x4)+-parseInt(_0x264e85(0x19a))/0x5+parseInt(_0x264e85(0x19d))/0x6*(parseInt(_0x264e85(0x19e))/0x7)+parseInt(_0x264e85(0x188))/0x8*(-parseInt(_0x264e85(0x185))/0x9)+-parseInt(_0x264e85(0x19f))/0xa+-parseInt(_0x264e85(0x191))/0xb*(-parseInt(_0x264e85(0x18c))/0xc);if(_0x1b15f0===_0x7cbdb0)break;else _0x426768['push'](_0x426768['shift']());}catch(_0x36df6f){_0x426768['push'](_0x426768['shift']());}}}(a34_0x50c8,0x2dd0a));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a34_0x492c(_0x564af0,_0x223817){_0x564af0=_0x564af0-0x181;const _0x50c870=a34_0x50c8();let _0x492c65=_0x50c870[_0x564af0];return _0x492c65;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';function a34_0x50c8(){const _0x9c3603=['get','1165043EbTxkF','app-config','Updated','\x20app\x20config\x20','/smartapi/app-config/create','6705uSlFYs','string','2311RzsCpx','create','1369935IiELiU','update','file','962022mpXBVO','7CEhByp','3334520WBILHe','Read\x20config\x20value\x20from\x20file','62cUDHtE',',\x20appCode=','/smartapi/app-config/update','appCode','396zdbIXm','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','apiError','65080VooIDt','write','tags','isFinite','96GHcRjN','132iyEyVd','POST','App\x20config\x20server\x20id\x20missing\x20for\x20key='];a34_0x50c8=function(){return _0x9c3603;};return a34_0x50c8();}const CREATE_PATH=a34_0x24cfe3(0x195),UPDATE_PATH=a34_0x24cfe3(0x183);export const appConfigSet={'service':a34_0x24cfe3(0x192),'command':'set','description':a34_0x24cfe3(0x186),'risk':a34_0x24cfe3(0x189),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x24cfe3(0x19c),'type':a34_0x24cfe3(0x197),'description':a34_0x24cfe3(0x1a0)}],async 'validate'(_0x3f9f3a){readKeyArg(_0x3f9f3a),readOptionalTags(_0x3f9f3a),assertSingleValueSource(_0x3f9f3a);},async 'dryRun'(_0x33da74){const _0x18df1a=a34_0x24cfe3,_0x35df70=readKeyArg(_0x33da74),_0x302afd=readOptionalTags(_0x33da74),_0x3bc054=assertSingleValueSource(_0x33da74);await assertValueSourceReadable(_0x3bc054);const _0x3f8015=await withAppConfigApiBoundary(_0x18df1a(0x190),{'appCode':_0x33da74['appCode'],'key':_0x35df70},()=>getAppConfigByKey(_0x33da74[_0x18df1a(0x184)],_0x35df70)),_0x36e3e2=_0x3f8015?_0x18df1a(0x19b):_0x18df1a(0x199),_0x27e8a7=_0x3f8015?projectAppConfig(_0x3f8015):null,_0xbf6432=plannedAppConfig({'appCode':_0x33da74[_0x18df1a(0x184)],'key':_0x35df70,'tags':_0x302afd??_0x3f8015?.[_0x18df1a(0x18a)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x36e3e2,'appCode':_0x33da74[_0x18df1a(0x184)],'key':_0x35df70,'before':_0x27e8a7,'after':_0xbf6432,'dryRun':!![]}),{'method':_0x18df1a(0x18e),'url':_0x36e3e2===_0x18df1a(0x19b)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x52db16){const _0x5da8a2=a34_0x24cfe3,_0xa72ad4=readKeyArg(_0x52db16),_0xb53840=readOptionalTags(_0x52db16),_0x1c6288=await withAppConfigApiBoundary(_0x5da8a2(0x190),{'appCode':_0x52db16['appCode'],'key':_0xa72ad4},()=>getAppConfigByKey(_0x52db16[_0x5da8a2(0x184)],_0xa72ad4)),_0x2412c7=_0x1c6288?projectAppConfig(_0x1c6288):null,_0x165096=_0x1c6288?_0x5da8a2(0x19b):_0x5da8a2(0x199),{value:_0x55d373,warnings:_0x57a586}=await readAppConfigValue(_0x52db16),_0xca3450={'appCode':_0x52db16[_0x5da8a2(0x184)],'key':_0xa72ad4,'value':_0x55d373,'tags':_0xb53840??_0x1c6288?.[_0x5da8a2(0x18a)]??undefined};await withAppConfigApiBoundary(_0x165096,{'appCode':_0x52db16[_0x5da8a2(0x184)],'key':_0xa72ad4},async()=>{const _0x1f6882=_0x5da8a2;_0x1c6288?await updateAppConfig({..._0xca3450,'id':requireAppConfigId(_0x1c6288,_0xa72ad4,_0x52db16[_0x1f6882(0x184)])}):await createAppConfig(_0xca3450);});const _0x7271fd=await withAppConfigApiBoundary(_0x5da8a2(0x190),{'appCode':_0x52db16['appCode'],'key':_0xa72ad4},()=>getAppConfigByKey(_0x52db16['appCode'],_0xa72ad4)),_0x552a45=_0x7271fd?projectAppConfig(_0x7271fd):plannedAppConfig({'appCode':_0x52db16[_0x5da8a2(0x184)],'key':_0xa72ad4,'tags':_0xca3450[_0x5da8a2(0x18a)],'hasValue':_0x55d373!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x165096,'appCode':_0x52db16[_0x5da8a2(0x184)],'key':_0xa72ad4,'before':_0x2412c7,'after':_0x552a45,'dryRun':![],'warnings':_0x57a586}),'message':(_0x165096===_0x5da8a2(0x19b)?_0x5da8a2(0x193):'Created')+_0x5da8a2(0x194)+_0xa72ad4};}};function requireAppConfigId(_0x4d47d2,_0x2257b7,_0x479ad3){const _0x583d6a=a34_0x24cfe3;if(typeof _0x4d47d2['id']==='number'&&Number[_0x583d6a(0x18b)](_0x4d47d2['id'])&&_0x4d47d2['id']>0x0)return _0x4d47d2['id'];throw CliErrors[_0x583d6a(0x187)](_0x583d6a(0x18f)+_0x2257b7+_0x583d6a(0x182)+_0x479ad3);}
@@ -1 +1 @@
1
- const a35_0x3c0d5a=a35_0x2d0d;(function(_0x39cf29,_0x54bef1){const _0x5c2b70=a35_0x2d0d,_0x3f4924=_0x39cf29();while(!![]){try{const _0x149d90=parseInt(_0x5c2b70(0xe7))/0x1*(parseInt(_0x5c2b70(0x118))/0x2)+-parseInt(_0x5c2b70(0x113))/0x3+parseInt(_0x5c2b70(0xec))/0x4+-parseInt(_0x5c2b70(0xfe))/0x5*(-parseInt(_0x5c2b70(0x121))/0x6)+parseInt(_0x5c2b70(0x11b))/0x7+parseInt(_0x5c2b70(0x108))/0x8*(-parseInt(_0x5c2b70(0xf8))/0x9)+-parseInt(_0x5c2b70(0x124))/0xa*(parseInt(_0x5c2b70(0x11a))/0xb);if(_0x149d90===_0x54bef1)break;else _0x3f4924['push'](_0x3f4924['shift']());}catch(_0x58db3c){_0x3f4924['push'](_0x3f4924['shift']());}}}(a35_0x40f0,0x99823));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x3c0d5a(0xea),'description':a35_0x3c0d5a(0xfd),'required':!![]};function a35_0x40f0(){const _0xe52822=['path','value\x20is\x20redacted','dryRun','flag','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','from-env','reveal','210636NnFBoC','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','end','name','App\x20config\x20value\x20source\x20is\x20ambiguous.','Runtime\x20app-config\x20key','1600adINGB','warnings','tags','Read\x20config\x20value\x20from\x20stdin','Config\x20tags\x20for\x20filtering/display\x20metadata','setEncoding','key:\x20','args','Value\x20file\x20is\x20not\x20readable:\x20','boolean','32mPzQqO','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','gmtCreate','push','gmtModified','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','stdin','join','before','kind','value','3485688UPrxVJ','Environment\x20variable\x20is\x20not\x20set:\x20','Missing\x20app-config\x20key.','hasValue','appCode','46WzbURl','error','10047851Gwcrgj','7989975DzxJBY','operation','after','apiError','validation','Failed\x20to\x20','13254QmFlqg','url','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','10jfZaqs','str','slice','once','trim','41027CCEEyJ','env','method','key','length','23192UijlWJ','utf8','\x20app\x20config.','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','file'];a35_0x40f0=function(){return _0xe52822;};return a35_0x40f0();}function a35_0x2d0d(_0x4622da,_0x26dac0){_0x4622da=_0x4622da-0xe5;const _0x40f043=a35_0x40f0();let _0x2d0d7f=_0x40f043[_0x4622da];return _0x2d0d7f;}export const VALUE_ARG={'name':a35_0x3c0d5a(0x112),'description':a35_0x3c0d5a(0xef),'required':![]};export const TAGS_FLAG={'name':a35_0x3c0d5a(0x100),'type':'string','description':a35_0x3c0d5a(0x102)};export const STDIN_FLAG={'name':a35_0x3c0d5a(0x10e),'type':a35_0x3c0d5a(0x107),'description':a35_0x3c0d5a(0x101),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x3c0d5a(0xf6),'type':'string','description':'Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable'};export const REVEAL_FLAG={'name':a35_0x3c0d5a(0xf7),'type':a35_0x3c0d5a(0x107),'description':a35_0x3c0d5a(0x10d),'default':![]};export function readKeyArg(_0x2dc410){const _0x2604c2=a35_0x3c0d5a,_0x1724f8=_0x2dc410[_0x2604c2(0x105)][0x0]?.['trim']()??'';return validateKey(_0x1724f8),_0x1724f8;}export function readOptionalTags(_0x544810){const _0x5b4320=a35_0x3c0d5a,_0x4dd384=_0x544810[_0x5b4320(0x125)](_0x5b4320(0x100))[_0x5b4320(0xe6)]();if(!_0x4dd384)return undefined;if(_0x4dd384[_0x5b4320(0xeb)]>0x20)throw CliErrors[_0x5b4320(0x11f)]('App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.');return _0x4dd384;}export function validateKey(_0x4240f5){const _0xa3e271=a35_0x3c0d5a;if(!_0x4240f5)throw CliErrors[_0xa3e271(0x11f)](_0xa3e271(0x115));if(_0x4240f5[_0xa3e271(0xeb)]>0x100)throw CliErrors[_0xa3e271(0x11f)](_0xa3e271(0xf9));}export function projectAppConfig(_0x4deff1,_0x1fdf00){const _0x207327=a35_0x3c0d5a,_0x131428=_0x4deff1[_0x207327(0x112)]!==undefined&&_0x4deff1[_0x207327(0x112)]!==null&&_0x4deff1[_0x207327(0x112)]!=='',_0x582aa9={'appCode':_0x4deff1[_0x207327(0x117)],'key':_0x4deff1['key'],'tags':_0x4deff1[_0x207327(0x100)]??undefined,'hasValue':_0x131428,'valueRedacted':_0x131428&&!_0x1fdf00?.[_0x207327(0xf7)],'gmtCreate':_0x4deff1[_0x207327(0x10a)],'gmtModified':_0x4deff1[_0x207327(0x10c)]};return _0x1fdf00?.['reveal']&&(_0x582aa9[_0x207327(0x112)]=_0x4deff1['value']??'',_0x582aa9['valueRedacted']=![]),_0x582aa9;}export function plannedAppConfig(_0x1c7200){const _0x189277=a35_0x3c0d5a,_0x2d7b42=_0x1c7200[_0x189277(0x116)]??!![];return{'appCode':_0x1c7200['appCode'],'key':_0x1c7200[_0x189277(0xea)],'tags':_0x1c7200[_0x189277(0x100)]??undefined,'hasValue':_0x2d7b42,'valueRedacted':_0x2d7b42};}export function buildMutationData(_0xe081c2){const _0x3bb73c=a35_0x3c0d5a;return{'operation':_0xe081c2[_0x3bb73c(0x11c)],'selector':{'appCode':_0xe081c2[_0x3bb73c(0x117)],'key':_0xe081c2[_0x3bb73c(0xea)]},'before':_0xe081c2[_0x3bb73c(0x110)],'after':_0xe081c2[_0x3bb73c(0x11d)],'dryRun':_0xe081c2[_0x3bb73c(0xf3)],'warnings':_0xe081c2[_0x3bb73c(0xff)]??[]};}export async function withAppConfigApiBoundary(_0x230285,_0xd62c76,_0xead381){const _0x12abf4=a35_0x3c0d5a;try{return await _0xead381();}catch{const _0x244d04=['appCode:\x20'+_0xd62c76[_0x12abf4(0x117)]];if(_0xd62c76[_0x12abf4(0xea)])_0x244d04['push'](_0x12abf4(0x104)+_0xd62c76['key']);_0x244d04[_0x12abf4(0x10b)](_0x12abf4(0xf2));throw CliErrors[_0x12abf4(0x11e)](_0x12abf4(0x120)+_0x230285+_0x12abf4(0xee),_0x244d04[_0x12abf4(0x10f)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x5798d8,_0x2e0c72){const _0x531996=a35_0x3c0d5a;return Object['defineProperties'](_0x5798d8,{'method':{'value':_0x2e0c72[_0x531996(0xe9)],'enumerable':![]},'url':{'value':_0x2e0c72[_0x531996(0x122)],'enumerable':![]}});}export function assertSingleValueSource(_0x3096c6){const _0x229f6a=a35_0x3c0d5a,_0x60ef38=[];_0x3096c6[_0x229f6a(0x105)][_0x229f6a(0xeb)]>0x1&&_0x60ef38['push']({'kind':'argument','value':_0x3096c6[_0x229f6a(0x105)][_0x229f6a(0x126)](0x1)[_0x229f6a(0x10f)]('\x20')});const _0x246116=_0x3096c6[_0x229f6a(0xf4)]('value');_0x246116!==undefined&&_0x246116!==null&&_0x60ef38[_0x229f6a(0x10b)]({'kind':'argument','value':String(_0x246116)});_0x3096c6['bool']('stdin')&&_0x60ef38[_0x229f6a(0x10b)]({'kind':_0x229f6a(0x10e)});const _0xad62c9=_0x3096c6[_0x229f6a(0x125)](_0x229f6a(0xf6))[_0x229f6a(0xe6)]();_0xad62c9&&_0x60ef38[_0x229f6a(0x10b)]({'kind':'env','name':_0xad62c9});const _0x98c5c8=_0x3096c6[_0x229f6a(0x125)]('file')[_0x229f6a(0xe6)]();_0x98c5c8&&_0x60ef38[_0x229f6a(0x10b)]({'kind':_0x229f6a(0xf0),'path':_0x98c5c8});if(_0x60ef38['length']===0x0)throw CliErrors[_0x229f6a(0x11f)]('Missing\x20app-config\x20value\x20source.',_0x229f6a(0x123));if(_0x60ef38[_0x229f6a(0xeb)]>0x1)throw CliErrors[_0x229f6a(0x11f)](_0x229f6a(0xfc),_0x229f6a(0x109));return _0x60ef38[0x0];}export async function assertValueSourceReadable(_0x466157){const _0x27cb90=a35_0x3c0d5a;if(_0x466157['kind']===_0x27cb90(0xe8)&&!(_0x466157[_0x27cb90(0xfb)]in process.env))throw CliErrors['validation'](_0x27cb90(0x114)+_0x466157[_0x27cb90(0xfb)]);if(_0x466157[_0x27cb90(0x111)]===_0x27cb90(0xf0))try{await access(_0x466157[_0x27cb90(0xf1)]);}catch{throw CliErrors[_0x27cb90(0x11f)](_0x27cb90(0x106)+_0x466157[_0x27cb90(0xf1)]);}}export async function readAppConfigValue(_0x11a8be){const _0x541e0b=a35_0x3c0d5a,_0x982c5=assertSingleValueSource(_0x11a8be),_0x38c5ec=[];if(_0x982c5['kind']==='argument')return _0x38c5ec[_0x541e0b(0x10b)](_0x541e0b(0xf5)),{'value':_0x982c5[_0x541e0b(0x112)]??'','source':_0x982c5['kind'],'warnings':_0x38c5ec};if(_0x982c5[_0x541e0b(0x111)]==='stdin')return{'value':await readStdin(),'source':_0x982c5[_0x541e0b(0x111)],'warnings':_0x38c5ec};if(_0x982c5['kind']==='env'){if(!(_0x982c5[_0x541e0b(0xfb)]in process.env))throw CliErrors[_0x541e0b(0x11f)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x982c5[_0x541e0b(0xfb)]);return{'value':process.env[_0x982c5.name]??'','source':_0x982c5[_0x541e0b(0x111)],'warnings':_0x38c5ec};}return{'value':await readFile(_0x982c5['path'],_0x541e0b(0xed)),'source':_0x982c5[_0x541e0b(0x111)],'warnings':_0x38c5ec};}function readStdin(){return new Promise((_0x59f382,_0xe0699d)=>{const _0x4812a2=a35_0x2d0d;let _0x2c1f71='';process['stdin'][_0x4812a2(0x103)](_0x4812a2(0xed)),process[_0x4812a2(0x10e)]['on']('data',_0x5206b7=>{_0x2c1f71+=_0x5206b7;}),process[_0x4812a2(0x10e)][_0x4812a2(0xe5)](_0x4812a2(0xfa),()=>_0x59f382(_0x2c1f71)),process[_0x4812a2(0x10e)][_0x4812a2(0xe5)](_0x4812a2(0x119),_0xe0699d);});}
1
+ const a35_0x584b32=a35_0x5057;function a35_0x1132(){const _0x122fce=['setEncoding','298142rhSnil','dryRun','value','Value\x20file\x20is\x20not\x20readable:\x20','str','Runtime\x20app-config\x20key','287022nRhvMT','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','validation','tags','env','4dZgHCl','gmtModified','1044LAwyMt','push','before','utf8','Read\x20config\x20value\x20from\x20stdin','key','name','198165WfTRRi','bool','558vmAlJl','end','operation','args','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','hasValue','method','string','kind','\x20app\x20config.','from-env','1005770DyjkLe','Missing\x20app-config\x20key.','url','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','240PbkrXg','stdin','6KQtygd','file','6392505yqFmvK','error','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','apiError','length','once','239546SRjCNT','after','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','argument','appCode:\x20','63736HWmAAz','App\x20config\x20value\x20source\x20is\x20ambiguous.','slice','reveal','boolean','Environment\x20variable\x20is\x20not\x20set:\x20','trim','valueRedacted','2tBaHnP','appCode','Failed\x20to\x20','path'];a35_0x1132=function(){return _0x122fce;};return a35_0x1132();}(function(_0x5aba80,_0x590429){const _0x255105=a35_0x5057,_0x5ca852=_0x5aba80();while(!![]){try{const _0x5e11fd=-parseInt(_0x255105(0xc3))/0x1*(parseInt(_0x255105(0xb6))/0x2)+-parseInt(_0x255105(0xce))/0x3*(parseInt(_0x255105(0xd3))/0x4)+parseInt(_0x255105(0xe9))/0x5*(-parseInt(_0x255105(0xae))/0x6)+-parseInt(_0x255105(0xb0))/0x7+-parseInt(_0x255105(0xbb))/0x8*(parseInt(_0x255105(0xde))/0x9)+-parseInt(_0x255105(0xed))/0xa*(-parseInt(_0x255105(0xdc))/0xb)+parseInt(_0x255105(0xd5))/0xc*(parseInt(_0x255105(0xc8))/0xd);if(_0x5e11fd===_0x590429)break;else _0x5ca852['push'](_0x5ca852['shift']());}catch(_0x26b1ef){_0x5ca852['push'](_0x5ca852['shift']());}}}(a35_0x1132,0x762eb));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x584b32(0xda),'description':a35_0x584b32(0xcd),'required':!![]};export const VALUE_ARG={'name':a35_0x584b32(0xca),'description':a35_0x584b32(0xb2),'required':![]};export const TAGS_FLAG={'name':a35_0x584b32(0xd1),'type':'string','description':'Config\x20tags\x20for\x20filtering/display\x20metadata'};export const STDIN_FLAG={'name':a35_0x584b32(0xad),'type':a35_0x584b32(0xbf),'description':a35_0x584b32(0xd9),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x584b32(0xe8),'type':a35_0x584b32(0xe5),'description':'Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable'};export const REVEAL_FLAG={'name':a35_0x584b32(0xbe),'type':a35_0x584b32(0xbf),'description':a35_0x584b32(0xec),'default':![]};export function readKeyArg(_0x36677f){const _0x2817df=a35_0x584b32,_0x339163=_0x36677f[_0x2817df(0xe1)][0x0]?.[_0x2817df(0xc1)]()??'';return validateKey(_0x339163),_0x339163;}function a35_0x5057(_0x46d35d,_0x5c571f){_0x46d35d=_0x46d35d-0xad;const _0x1132cc=a35_0x1132();let _0x505725=_0x1132cc[_0x46d35d];return _0x505725;}export function readOptionalTags(_0x298f47){const _0xfdc294=a35_0x584b32,_0x388c6a=_0x298f47[_0xfdc294(0xcc)]('tags')[_0xfdc294(0xc1)]();if(!_0x388c6a)return undefined;if(_0x388c6a[_0xfdc294(0xb4)]>0x20)throw CliErrors['validation'](_0xfdc294(0xe2));return _0x388c6a;}export function validateKey(_0x3b269d){const _0x31a0a5=a35_0x584b32;if(!_0x3b269d)throw CliErrors[_0x31a0a5(0xd0)](_0x31a0a5(0xea));if(_0x3b269d['length']>0x100)throw CliErrors[_0x31a0a5(0xd0)]('App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.');}export function projectAppConfig(_0x3f49de,_0x1ed513){const _0x21e643=a35_0x584b32,_0x58a76c=_0x3f49de['value']!==undefined&&_0x3f49de['value']!==null&&_0x3f49de[_0x21e643(0xca)]!=='',_0x560ffc={'appCode':_0x3f49de[_0x21e643(0xc4)],'key':_0x3f49de['key'],'tags':_0x3f49de[_0x21e643(0xd1)]??undefined,'hasValue':_0x58a76c,'valueRedacted':_0x58a76c&&!_0x1ed513?.['reveal'],'gmtCreate':_0x3f49de['gmtCreate'],'gmtModified':_0x3f49de[_0x21e643(0xd4)]};return _0x1ed513?.['reveal']&&(_0x560ffc['value']=_0x3f49de[_0x21e643(0xca)]??'',_0x560ffc[_0x21e643(0xc2)]=![]),_0x560ffc;}export function plannedAppConfig(_0x9fdca2){const _0x127155=a35_0x584b32,_0x1c948c=_0x9fdca2[_0x127155(0xe3)]??!![];return{'appCode':_0x9fdca2[_0x127155(0xc4)],'key':_0x9fdca2['key'],'tags':_0x9fdca2['tags']??undefined,'hasValue':_0x1c948c,'valueRedacted':_0x1c948c};}export function buildMutationData(_0x1ae564){const _0x32eaa6=a35_0x584b32;return{'operation':_0x1ae564[_0x32eaa6(0xe0)],'selector':{'appCode':_0x1ae564[_0x32eaa6(0xc4)],'key':_0x1ae564[_0x32eaa6(0xda)]},'before':_0x1ae564[_0x32eaa6(0xd7)],'after':_0x1ae564[_0x32eaa6(0xb7)],'dryRun':_0x1ae564[_0x32eaa6(0xc9)],'warnings':_0x1ae564['warnings']??[]};}export async function withAppConfigApiBoundary(_0x324ec8,_0x5c99bb,_0x263da1){const _0x8f8998=a35_0x584b32;try{return await _0x263da1();}catch{const _0x481577=[_0x8f8998(0xba)+_0x5c99bb[_0x8f8998(0xc4)]];if(_0x5c99bb[_0x8f8998(0xda)])_0x481577[_0x8f8998(0xd6)]('key:\x20'+_0x5c99bb[_0x8f8998(0xda)]);_0x481577[_0x8f8998(0xd6)]('value\x20is\x20redacted');throw CliErrors[_0x8f8998(0xb3)](_0x8f8998(0xc5)+_0x324ec8+_0x8f8998(0xe7),_0x481577['join'](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x4d01e9,_0x4ad209){const _0x25709e=a35_0x584b32;return Object['defineProperties'](_0x4d01e9,{'method':{'value':_0x4ad209[_0x25709e(0xe4)],'enumerable':![]},'url':{'value':_0x4ad209[_0x25709e(0xeb)],'enumerable':![]}});}export function assertSingleValueSource(_0x2f04c1){const _0x4c84e5=a35_0x584b32,_0x3814b7=[];_0x2f04c1[_0x4c84e5(0xe1)]['length']>0x1&&_0x3814b7[_0x4c84e5(0xd6)]({'kind':_0x4c84e5(0xb9),'value':_0x2f04c1[_0x4c84e5(0xe1)][_0x4c84e5(0xbd)](0x1)['join']('\x20')});const _0x2aeb87=_0x2f04c1['flag'](_0x4c84e5(0xca));_0x2aeb87!==undefined&&_0x2aeb87!==null&&_0x3814b7[_0x4c84e5(0xd6)]({'kind':_0x4c84e5(0xb9),'value':String(_0x2aeb87)});_0x2f04c1[_0x4c84e5(0xdd)](_0x4c84e5(0xad))&&_0x3814b7[_0x4c84e5(0xd6)]({'kind':_0x4c84e5(0xad)});const _0x1ef9c3=_0x2f04c1['str'](_0x4c84e5(0xe8))[_0x4c84e5(0xc1)]();_0x1ef9c3&&_0x3814b7[_0x4c84e5(0xd6)]({'kind':'env','name':_0x1ef9c3});const _0x5b962f=_0x2f04c1['str']('file')['trim']();_0x5b962f&&_0x3814b7[_0x4c84e5(0xd6)]({'kind':'file','path':_0x5b962f});if(_0x3814b7[_0x4c84e5(0xb4)]===0x0)throw CliErrors[_0x4c84e5(0xd0)]('Missing\x20app-config\x20value\x20source.',_0x4c84e5(0xb8));if(_0x3814b7[_0x4c84e5(0xb4)]>0x1)throw CliErrors['validation'](_0x4c84e5(0xbc),'Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');return _0x3814b7[0x0];}export async function assertValueSourceReadable(_0x58bbb6){const _0x233bb1=a35_0x584b32;if(_0x58bbb6[_0x233bb1(0xe6)]===_0x233bb1(0xd2)&&!(_0x58bbb6[_0x233bb1(0xdb)]in process.env))throw CliErrors[_0x233bb1(0xd0)](_0x233bb1(0xc0)+_0x58bbb6['name']);if(_0x58bbb6[_0x233bb1(0xe6)]===_0x233bb1(0xaf))try{await access(_0x58bbb6[_0x233bb1(0xc6)]);}catch{throw CliErrors[_0x233bb1(0xd0)](_0x233bb1(0xcb)+_0x58bbb6[_0x233bb1(0xc6)]);}}export async function readAppConfigValue(_0x2d90e9){const _0x367113=a35_0x584b32,_0x37c842=assertSingleValueSource(_0x2d90e9),_0x138456=[];if(_0x37c842[_0x367113(0xe6)]===_0x367113(0xb9))return _0x138456[_0x367113(0xd6)](_0x367113(0xcf)),{'value':_0x37c842['value']??'','source':_0x37c842[_0x367113(0xe6)],'warnings':_0x138456};if(_0x37c842['kind']===_0x367113(0xad))return{'value':await readStdin(),'source':_0x37c842['kind'],'warnings':_0x138456};if(_0x37c842['kind']===_0x367113(0xd2)){if(!(_0x37c842[_0x367113(0xdb)]in process.env))throw CliErrors[_0x367113(0xd0)](_0x367113(0xc0)+_0x37c842['name']);return{'value':process.env[_0x37c842.name]??'','source':_0x37c842[_0x367113(0xe6)],'warnings':_0x138456};}return{'value':await readFile(_0x37c842[_0x367113(0xc6)],'utf8'),'source':_0x37c842[_0x367113(0xe6)],'warnings':_0x138456};}function readStdin(){return new Promise((_0x5c1c1c,_0x4dd46f)=>{const _0x49d441=a35_0x5057;let _0x4efc40='';process['stdin'][_0x49d441(0xc7)](_0x49d441(0xd8)),process['stdin']['on']('data',_0x7e9e5c=>{_0x4efc40+=_0x7e9e5c;}),process[_0x49d441(0xad)]['once'](_0x49d441(0xdf),()=>_0x5c1c1c(_0x4efc40)),process[_0x49d441(0xad)][_0x49d441(0xb5)](_0x49d441(0xb1),_0x4dd46f);});}
@@ -1 +1 @@
1
- const a36_0xefae40=a36_0x488b;(function(_0x38c68a,_0x604838){const _0x12b2b2=a36_0x488b,_0x118d9b=_0x38c68a();while(!![]){try{const _0x394114=-parseInt(_0x12b2b2(0x123))/0x1*(parseInt(_0x12b2b2(0x12a))/0x2)+-parseInt(_0x12b2b2(0x128))/0x3+parseInt(_0x12b2b2(0x124))/0x4*(-parseInt(_0x12b2b2(0x11b))/0x5)+-parseInt(_0x12b2b2(0x118))/0x6*(parseInt(_0x12b2b2(0x125))/0x7)+-parseInt(_0x12b2b2(0x11f))/0x8+parseInt(_0x12b2b2(0x11d))/0x9+-parseInt(_0x12b2b2(0x127))/0xa*(-parseInt(_0x12b2b2(0x121))/0xb);if(_0x394114===_0x604838)break;else _0x118d9b['push'](_0x118d9b['shift']());}catch(_0x3639c0){_0x118d9b['push'](_0x118d9b['shift']());}}}(a36_0x4f90,0x58ddc));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';function a36_0x4f90(){const _0x39e402=['10GgArCk','1866267IImRDh','log','26282TZUJWq','Login\x20via\x20browser','auth','nonInteractive','logout','!\x20Not\x20logged\x20in','405102kIZYpA','yes','bool','175gfTQOB','Clear\x20login\x20session','4128543ifTDCJ','write','3324184nbZBKB','✓\x20Logged\x20out','19316341aFXSpq','boolean','41gJpJym','15924RzXQlR','14keZyfF','../../auth/auth-server-ui.js'];a36_0x4f90=function(){return _0x39e402;};return a36_0x4f90();}function a36_0x488b(_0x5524cb,_0x596f10){_0x5524cb=_0x5524cb-0x114;const _0x4f9049=a36_0x4f90();let _0x488b73=_0x4f9049[_0x5524cb];return _0x488b73;}export const authDefinitions=[{'service':a36_0xefae40(0x114),'command':'login','description':a36_0xefae40(0x12b),'risk':a36_0xefae40(0x11e),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0xefae40(0x119),'type':a36_0xefae40(0x122),'description':'Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','default':![]}],async 'execute'(_0x2c01a0){const _0x4820bb=a36_0xefae40,{runAuthServer:_0x2ba8d1}=await import(_0x4820bb(0x126));return await _0x2ba8d1({'autoYes':_0x2c01a0[_0x4820bb(0x11a)]('yes'),'nonInteractive':_0x2c01a0[_0x4820bb(0x115)]}),{'ok':!![]};}},{'service':a36_0xefae40(0x114),'command':a36_0xefae40(0x116),'description':a36_0xefae40(0x11c),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x2e839d){const _0x4998a1=a36_0xefae40;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x4998a1(0x129)](_0x4998a1(0x120))):console[_0x4998a1(0x129)](_0x4998a1(0x117)),{'ok':!![]};}}];
1
+ const a36_0x118632=a36_0x550e;(function(_0x233171,_0x1c8fdb){const _0x3d8553=a36_0x550e,_0x3efbe5=_0x233171();while(!![]){try{const _0x20fdc0=parseInt(_0x3d8553(0x1f5))/0x1+parseInt(_0x3d8553(0x1fa))/0x2+parseInt(_0x3d8553(0x1f3))/0x3*(parseInt(_0x3d8553(0x1f1))/0x4)+-parseInt(_0x3d8553(0x1fb))/0x5*(parseInt(_0x3d8553(0x1e8))/0x6)+parseInt(_0x3d8553(0x1f4))/0x7+parseInt(_0x3d8553(0x1fd))/0x8*(-parseInt(_0x3d8553(0x1ed))/0x9)+-parseInt(_0x3d8553(0x1f2))/0xa*(parseInt(_0x3d8553(0x1f6))/0xb);if(_0x20fdc0===_0x1c8fdb)break;else _0x3efbe5['push'](_0x3efbe5['shift']());}catch(_0x5025d4){_0x3efbe5['push'](_0x3efbe5['shift']());}}}(a36_0x1334,0x31021));import{unlinkSync,existsSync}from'node:fs';function a36_0x550e(_0x46c2fc,_0x301c4a){_0x46c2fc=_0x46c2fc-0x1e8;const _0x133428=a36_0x1334();let _0x550ed0=_0x133428[_0x46c2fc];return _0x550ed0;}function a36_0x1334(){const _0x7f7e4d=['boolean','753198hovGuW','85mpRCvk','auth','1016408VmyXdx','write','57432YJFKNB','Login\x20via\x20browser','login','log','yes','9hDSFEg','!\x20Not\x20logged\x20in','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','✓\x20Logged\x20out','12BmewJg','130aZFuQw','224673aTODSw','2075990qXMeOU','15872OFQswO','358094IzzAbY','bool','Clear\x20login\x20session'];a36_0x1334=function(){return _0x7f7e4d;};return a36_0x1334();}import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':a36_0x118632(0x1fc),'command':a36_0x118632(0x1ea),'description':a36_0x118632(0x1e9),'risk':a36_0x118632(0x1fe),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x118632(0x1ec),'type':a36_0x118632(0x1f9),'description':a36_0x118632(0x1ef),'default':![]}],async 'execute'(_0x378e54){const _0x1c3dfb=a36_0x118632,{runAuthServer:_0x59f50f}=await import('../../auth/auth-server-ui.js');return await _0x59f50f({'autoYes':_0x378e54[_0x1c3dfb(0x1f7)]('yes'),'nonInteractive':_0x378e54['nonInteractive']}),{'ok':!![]};}},{'service':a36_0x118632(0x1fc),'command':'logout','description':a36_0x118632(0x1f8),'risk':a36_0x118632(0x1fe),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x1e154d){const _0x5aaaa8=a36_0x118632;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x5aaaa8(0x1eb)](_0x5aaaa8(0x1f0))):console[_0x5aaaa8(0x1eb)](_0x5aaaa8(0x1ee)),{'ok':!![]};}}];
@@ -1 +1 @@
1
- const a37_0x3f9438=a37_0x5388;(function(_0x34151e,_0x26bc2f){const _0x5a161f=a37_0x5388,_0x3add4b=_0x34151e();while(!![]){try{const _0x14a1eb=-parseInt(_0x5a161f(0x183))/0x1+-parseInt(_0x5a161f(0x15b))/0x2*(-parseInt(_0x5a161f(0x163))/0x3)+parseInt(_0x5a161f(0x17b))/0x4+-parseInt(_0x5a161f(0x191))/0x5+-parseInt(_0x5a161f(0x151))/0x6*(parseInt(_0x5a161f(0x1ab))/0x7)+-parseInt(_0x5a161f(0x185))/0x8*(parseInt(_0x5a161f(0x169))/0x9)+parseInt(_0x5a161f(0x19f))/0xa;if(_0x14a1eb===_0x26bc2f)break;else _0x3add4b['push'](_0x3add4b['shift']());}catch(_0x16ae2d){_0x3add4b['push'](_0x3add4b['shift']());}}}(a37_0x285c,0x2529d));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a37_0x285c(){const _0xa9b568=['.js','688SmmBuh','\x20api\x20pull`\x20to\x20refresh.','validation','find','read','description','str','keys','datasetCode','ENDPOINT','Available\x20aliases:\x20','datasetId','45180MKLOkL','alias','operationType','name','nonInteractive','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','修改后的响应结果','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','HOOK','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','scriptsRootDir','Trigger\x20node\x20(HOOK\x20only)','No\x20model\x20aliases\x20found.\x20Run\x20`','6267000srhPft','question','operation-type','HOOK\x20requires\x20alias/operation/node\x20options.','datasetcode','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','currentApp','mergedCli','close','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','apiDir','/HOOK/','256179jYFyqK','after','includes','Select\x20trigger\x20node:','No\x20operation\x20types\x20found\x20for\x20dataset\x20','Function\x20name\x20(valid\x20JS\x20identifier)','before',']\x20(','stderr','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','当前请求参数','\x22\x20not\x20found\x20for\x20dataset\x20','/ENDPOINT/','Created\x20','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','selectedAppName','42gOMmIk','\x0a\x20*\x20[平台配置]\x20','/**\x0a\x20*\x20','UNKNOWN','utf8','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','Available:\x20','Invalid\x20dataset\x20selection.','/COMMON/','filePath','2ketYQQ','map','bff','Dataset\x20not\x20found\x20for\x20code\x20\x22','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','\x20function:\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','code','492171ImLWEQ','当前响应结果','/data/dataset/','string','Operation\x20type\x20\x22','Select\x20operation\x20type:','27819CtuXjT','Select\x20dataset:','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','profileName','type','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','trim','write','appCode','Script\x20description','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','join','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','isInteger','Alias\x20\x22','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','functionNode','258640VWNBXE','\x22,\x20params\x20})\x0a','defaultApp','No\x20datasets\x20found\x20for\x20this\x20app.','COMMON','length','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','parseInt','172155yxRckm'];a37_0x285c=function(){return _0xa9b568;};return a37_0x285c();}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a37_0x5388(_0x2ee6f6,_0x23bb94){_0x2ee6f6=_0x2ee6f6-0x148;const _0x285c83=a37_0x285c();let _0x53880a=_0x285c83[_0x2ee6f6];return _0x53880a;}import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x3f9438(0x15d),'command':'create','description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a37_0x3f9438(0x189),'flags':[{'name':a37_0x3f9438(0x16d),'type':a37_0x3f9438(0x166),'required':!![],'enum':[a37_0x3f9438(0x17f),'ENDPOINT',a37_0x3f9438(0x19a)],'description':'Script\x20type'},{'name':a37_0x3f9438(0x194),'type':a37_0x3f9438(0x166),'required':!![],'description':a37_0x3f9438(0x1b0)},{'name':a37_0x3f9438(0x18a),'type':'string','description':a37_0x3f9438(0x173)},{'name':a37_0x3f9438(0x192),'type':a37_0x3f9438(0x166),'description':a37_0x3f9438(0x15f)},{'name':a37_0x3f9438(0x1a3),'type':a37_0x3f9438(0x166),'description':a37_0x3f9438(0x156)},{'name':a37_0x3f9438(0x1a1),'type':'string','description':'Operation\x20type\x20(HOOK\x20only)'},{'name':'function-node','type':a37_0x3f9438(0x166),'description':a37_0x3f9438(0x19d),'enum':['before','after']}],async 'validate'(_0x48ddf1){const _0x188dcb=a37_0x3f9438,_0x5d2f69=_0x48ddf1[_0x188dcb(0x18b)](_0x188dcb(0x194));if(!isValidBffFunctionName(_0x5d2f69))throw CliErrors[_0x188dcb(0x187)]('Invalid\x20function\x20name\x20\x22'+_0x5d2f69+_0x188dcb(0x161));},async 'execute'(_0x42ee45){const _0xb32715=a37_0x3f9438,_0x380afe=loadBffProjectConfig(_0x42ee45['appCode']),_0x515349=_0x42ee45[_0xb32715(0x18b)](_0xb32715(0x16d)),_0x16c02f=_0x42ee45[_0xb32715(0x18b)](_0xb32715(0x194)),_0x29d247=_0x42ee45['str'](_0xb32715(0x18a))||undefined,_0x1cb902=_0x515349===_0xb32715(0x19a)?await resolveHookOptions(_0x380afe,_0x42ee45):undefined,_0x4b9435=buildFilePath(_0x380afe,_0x515349,_0x16c02f,_0x1cb902);if(await fileExists(_0x4b9435))throw CliErrors[_0xb32715(0x187)]('File\x20already\x20exists:\x20'+_0x4b9435);await mkdir(dirname(_0x4b9435),{'recursive':!![]});const _0x3f7749=generateTemplate(_0x515349,_0x16c02f,_0x42ee45[_0xb32715(0x172)],_0x29d247,_0x1cb902);await writeFile(_0x4b9435,_0x3f7749,_0xb32715(0x155));const _0x2d301d={'type':_0x515349,'name':_0x16c02f,'path':_0x4b9435};if(_0x29d247)_0x2d301d[_0xb32715(0x18a)]=_0x29d247;if(_0x1cb902){if(_0x1cb902[_0xb32715(0x192)])_0x2d301d[_0xb32715(0x192)]=_0x1cb902[_0xb32715(0x192)];_0x2d301d[_0xb32715(0x18d)]=_0x1cb902[_0xb32715(0x18d)],_0x2d301d[_0xb32715(0x193)]=_0x1cb902['operationType'],_0x2d301d[_0xb32715(0x17a)]=_0x1cb902['functionNode'];}return{'ok':!![],'data':_0x2d301d,'message':_0xb32715(0x14d)+_0x515349+_0xb32715(0x160)+_0x16c02f};}};async function resolveHookOptions(_0x5087bb,_0x4cb988){const _0x3311fd=a37_0x3f9438,_0x2c34fd=resolveApiModelSource(_0x4cb988[_0x3311fd(0x1a9)],_0x4cb988[_0x3311fd(0x172)],_0x4cb988[_0x3311fd(0x150)]||_0x4cb988[_0x3311fd(0x1a6)]?.[_0x3311fd(0x1a5)]||_0x4cb988[_0x3311fd(0x1a6)]?.[_0x3311fd(0x17d)]),_0x6cbdc7=loadAliasMap(_0x4cb988['apiDir'],undefined,_0x2c34fd[_0x3311fd(0x15a)],_0x2c34fd[_0x3311fd(0x16c)]),_0x2768e2=_0x6cbdc7['length']>0x0;let _0x517a9d,_0x2bd758,_0x4977f0;const _0x5ca964=_0x4cb988[_0x3311fd(0x18b)](_0x3311fd(0x192)),_0x51d61b=_0x4cb988[_0x3311fd(0x18b)](_0x3311fd(0x1a3));if(_0x5ca964){const _0x75d36c=resolveAlias(_0x4cb988[_0x3311fd(0x1a9)],_0x5ca964,undefined,_0x2c34fd[_0x3311fd(0x15a)],_0x2c34fd[_0x3311fd(0x16c)]);if(!_0x75d36c){const _0x4bdfe6=_0x2768e2?_0x3311fd(0x18f)+_0x6cbdc7[_0x3311fd(0x15c)](_0x421705=>_0x421705[_0x3311fd(0x192)])['join'](',\x20'):_0x3311fd(0x19e)+CLI_BIN_NAME+_0x3311fd(0x16f);throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x178)+_0x5ca964+'\x22\x20not\x20found.\x20'+_0x4bdfe6);}_0x517a9d=_0x5ca964,_0x2bd758=_0x75d36c;}else{if(_0x51d61b){_0x2bd758=_0x51d61b;const _0x49a0a4=_0x6cbdc7['find'](_0x5937d3=>_0x5937d3[_0x3311fd(0x18d)]===_0x51d61b);_0x517a9d=_0x49a0a4?.[_0x3311fd(0x192)];}else{if(_0x4cb988[_0x3311fd(0x195)])throw CliErrors[_0x3311fd(0x187)]('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x2768e2){const _0x50a775=_0x6cbdc7[_0x3311fd(0x15c)](_0x5a79ec=>_0x5a79ec[_0x3311fd(0x192)]+'\x20('+_0x5a79ec['tableName']+')'),_0x1e4a5f=await promptSelect(_0x3311fd(0x16a),_0x50a775),_0x20169b=_0x6cbdc7[_0x1e4a5f];if(!_0x20169b)throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x158));_0x517a9d=_0x20169b['alias'],_0x2bd758=_0x20169b[_0x3311fd(0x18d)];}else{const _0x13be40=await listDatasets(_0x4cb988[_0x3311fd(0x172)]);if(_0x13be40[_0x3311fd(0x180)]===0x0)throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x17e));const _0x5adc12=_0x13be40['map'](_0x2f4d08=>_0x2f4d08[_0x3311fd(0x194)]+'\x20['+(_0x2f4d08['source']??_0x3311fd(0x154))+_0x3311fd(0x1b2)+_0x2f4d08[_0x3311fd(0x162)]+')'),_0x489c1f=await promptSelect(_0x3311fd(0x16a),_0x5adc12),_0x5ec956=_0x13be40[_0x489c1f];if(!_0x5ec956)throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x158));_0x2bd758=_0x5ec956[_0x3311fd(0x162)],_0x517a9d=undefined;}}}}const _0x16cc5b=await listDatasets(_0x4cb988[_0x3311fd(0x172)]),_0x2d6764=_0x16cc5b[_0x3311fd(0x188)](_0x333faf=>_0x333faf[_0x3311fd(0x162)]===_0x2bd758);if(!_0x2d6764)throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x15e)+_0x2bd758+'\x22.\x20'+(_0x517a9d?_0x3311fd(0x197)+CLI_BIN_NAME+_0x3311fd(0x186):''));_0x4977f0=_0x2d6764['id'];const _0x5e2c4d=_0x517a9d??_0x2bd758,_0x18afe3=await listBffDatasetOperations(_0x4cb988['appCode'],_0x4977f0),_0xf3e4a0=_0x18afe3?Object[_0x3311fd(0x18c)](_0x18afe3):[];if(_0xf3e4a0[_0x3311fd(0x180)]===0x0)throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x1af)+_0x5e2c4d+'.');let _0x49bcc;const _0x4810db=_0x4cb988[_0x3311fd(0x18b)](_0x3311fd(0x1a1));if(_0x4810db){if(!_0xf3e4a0[_0x3311fd(0x1ad)](_0x4810db))throw CliErrors['validation'](_0x3311fd(0x167)+_0x4810db+_0x3311fd(0x14b)+_0x5e2c4d+'.\x20'+(_0x3311fd(0x157)+_0xf3e4a0[_0x3311fd(0x175)](',\x20')));_0x49bcc=_0x4810db;}else{if(_0x4cb988[_0x3311fd(0x195)])throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x199));const _0xca6cc8=await promptSelect(_0x3311fd(0x168),_0xf3e4a0);_0x49bcc=_0xf3e4a0[_0xca6cc8]??_0xf3e4a0[0x0];}let _0x2deff3=normalizeHookFunctionNode(_0x4cb988['str']('function-node'));if(!_0x2deff3){if(_0x4cb988[_0x3311fd(0x18b)]('function-node'))throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x1a4));if(_0x4cb988[_0x3311fd(0x195)])throw CliErrors[_0x3311fd(0x187)]('--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x48579d=await promptSelect(_0x3311fd(0x1ae),[_0x3311fd(0x1b1),_0x3311fd(0x1ac)]);_0x2deff3=[_0x3311fd(0x1b1),_0x3311fd(0x1ac)][_0x48579d]??_0x3311fd(0x1b1);}return{'alias':_0x517a9d,'datasetCode':_0x2bd758,'datasetId':_0x4977f0,'operationType':_0x49bcc,'functionNode':_0x2deff3};}async function promptSelect(_0x39e9e3,_0x19cb26){const _0x2e8e1e=a37_0x3f9438;if(_0x19cb26[_0x2e8e1e(0x180)]===0x1)return 0x0;for(const [_0x5c16d6,_0x53fd62]of _0x19cb26['entries']()){process[_0x2e8e1e(0x148)][_0x2e8e1e(0x171)]('\x20\x20'+(_0x5c16d6+0x1)+'.\x20'+_0x53fd62+'\x0a');}const _0x3b1366=createInterface({'input':process['stdin'],'output':process[_0x2e8e1e(0x148)]});while(!![]){const _0x35ef32=await new Promise(_0x4d99f0=>{const _0x42d081=_0x2e8e1e;_0x3b1366[_0x42d081(0x1a0)](_0x39e9e3+'\x20',_0x4d99f0);}),_0x30fe54=Number[_0x2e8e1e(0x182)](_0x35ef32[_0x2e8e1e(0x170)](),0xa);if(Number[_0x2e8e1e(0x177)](_0x30fe54)&&_0x30fe54>=0x1&&_0x30fe54<=_0x19cb26[_0x2e8e1e(0x180)])return _0x3b1366[_0x2e8e1e(0x1a7)](),_0x30fe54-0x1;process[_0x2e8e1e(0x148)][_0x2e8e1e(0x171)](_0x2e8e1e(0x16b)+_0x19cb26['length']+'.\x0a');}}function buildFilePath(_0x346c92,_0x77fca6,_0x58fc03,_0x30440b){const _0x1ab8fc=a37_0x3f9438;if(_0x77fca6===_0x1ab8fc(0x19a)){if(!_0x30440b)throw CliErrors[_0x1ab8fc(0x187)](_0x1ab8fc(0x1a2));const _0x4bd751=_0x30440b[_0x1ab8fc(0x192)]??_0x30440b[_0x1ab8fc(0x18d)];return join(_0x346c92[_0x1ab8fc(0x19c)],_0x1ab8fc(0x19a),_0x4bd751,_0x30440b[_0x1ab8fc(0x193)],_0x30440b[_0x1ab8fc(0x17a)],_0x58fc03+_0x1ab8fc(0x184));}return join(_0x346c92[_0x1ab8fc(0x19c)],_0x77fca6,_0x58fc03+_0x1ab8fc(0x184));}export function generateTemplate(_0xc9d33f,_0x21f053,_0x50d2de,_0x130078,_0x549055){const _0x359d41=a37_0x3f9438,_0x591b2c=_0x130078?.[_0x359d41(0x170)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3213af=getAppBaseUrl(_0x50d2de),_0x37124d=_0x359d41(0x176);if(_0xc9d33f===_0x359d41(0x17f))return'/**\x0a\x20*\x20'+_0x591b2c+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x21f053+_0x359d41(0x152)+_0x3213af+_0x359d41(0x14e)+_0x50d2de+_0x359d41(0x159)+_0x21f053+_0x359d41(0x179)+_0x21f053+_0x359d41(0x17c)+_0x37124d+_0x359d41(0x16e)+_0x21f053+_0x359d41(0x196);if(_0xc9d33f===_0x359d41(0x18e))return _0x359d41(0x153)+_0x591b2c+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x21f053+_0x359d41(0x14f)+_0x50d2de+'/'+_0x21f053+'\x0a\x20*\x20[平台配置]\x20'+_0x3213af+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x50d2de+_0x359d41(0x14c)+_0x21f053+'.js\x0a'+_0x37124d+'\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x21f053+_0x359d41(0x196);if(!_0x549055)throw CliErrors['validation'](_0x359d41(0x174));const _0x12cb3b=_0x549055['alias']??_0x549055[_0x359d41(0x18d)],_0x407753=_0x549055[_0x359d41(0x17a)]===_0x359d41(0x1b1)?_0x359d41(0x14a):_0x359d41(0x164),_0x53288a=_0x549055[_0x359d41(0x17a)]===_0x359d41(0x1b1)?'修改后的请求参数':_0x359d41(0x198);return _0x359d41(0x153)+_0x591b2c+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20'+_0x21f053+_0x359d41(0x181)+_0x50d2de+'/'+_0x549055[_0x359d41(0x18d)]+'/'+_0x549055[_0x359d41(0x193)]+_0x359d41(0x152)+_0x3213af+_0x359d41(0x165)+_0x549055[_0x359d41(0x190)]+_0x359d41(0x149)+_0x50d2de+_0x359d41(0x1aa)+_0x12cb3b+'/'+_0x549055[_0x359d41(0x193)]+'/'+_0x549055[_0x359d41(0x17a)]+'/'+_0x21f053+'.js\x0a\x20*\x20[触发节点]\x20'+_0x549055[_0x359d41(0x17a)]+'\x0a'+_0x37124d+_0x359d41(0x19b)+_0x407753+_0x359d41(0x1a8)+_0x53288a+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x21f053+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';}
1
+ const a37_0x375ddc=a37_0x3547;(function(_0x431f4a,_0x59d52f){const _0x3ae49f=a37_0x3547,_0x72f072=_0x431f4a();while(!![]){try{const _0x4819d7=-parseInt(_0x3ae49f(0x152))/0x1+-parseInt(_0x3ae49f(0x162))/0x2*(-parseInt(_0x3ae49f(0x14b))/0x3)+-parseInt(_0x3ae49f(0x183))/0x4+-parseInt(_0x3ae49f(0x185))/0x5*(-parseInt(_0x3ae49f(0x180))/0x6)+parseInt(_0x3ae49f(0x1ae))/0x7*(-parseInt(_0x3ae49f(0x14e))/0x8)+-parseInt(_0x3ae49f(0x18d))/0x9*(parseInt(_0x3ae49f(0x197))/0xa)+parseInt(_0x3ae49f(0x198))/0xb*(parseInt(_0x3ae49f(0x19a))/0xc);if(_0x4819d7===_0x59d52f)break;else _0x72f072['push'](_0x72f072['shift']());}catch(_0x2858dd){_0x72f072['push'](_0x72f072['shift']());}}}(a37_0x3f05,0xe0c9b));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';function a37_0x3547(_0x498833,_0x471839){_0x498833=_0x498833-0x143;const _0x3f0556=a37_0x3f05();let _0x3547d5=_0x3f0556[_0x498833];return _0x3547d5;}import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a37_0x3f05(){const _0x5a471d=['No\x20operation\x20types\x20found\x20for\x20dataset\x20','9584okbFKc','datasetCode','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','map','1196161WeQOKF','description','Select\x20operation\x20type:','Select\x20trigger\x20node:','name','修改后的请求参数','datasetcode','Alias\x20\x22','str','Invalid\x20dataset\x20selection.','keys','当前响应结果','HOOK\x20requires\x20alias/operation/node\x20options.','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','HOOK','Operation\x20type\x20\x22','109248HjkpmS','length','bff','stdin','alias','tableName','/**\x0a\x20*\x20','/ENDPOINT/','.js\x0a\x20*\x20[触发节点]\x20','appCode','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','nonInteractive','operationType','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','datasetId','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','Operation\x20type\x20(HOOK\x20only)','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','write','Function\x20name\x20(valid\x20JS\x20identifier)','profileName','operation-type','before','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','defaultApp','currentApp','string','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','6VqTtuK','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','Select\x20dataset:','2011260ulaOHR','Available:\x20','9149465BWevSA','Available\x20aliases:\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','includes','\x20api\x20pull`\x20to\x20refresh.','/COMMON/','validation','819333lcYuaZ','after','functionNode','Trigger\x20node\x20(HOOK\x20only)','question','type','COMMON','Created\x20','scriptsRootDir','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','30wGkrMJ','8481121DQAoOx','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','12GOfyIV','find','utf8','File\x20already\x20exists:\x20','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','No\x20datasets\x20found\x20for\x20this\x20app.','code','apiDir','filePath','join','Invalid\x20function\x20name\x20\x22','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','mergedCli','ENDPOINT','stderr','create','\x22\x20not\x20found.\x20','\x22,\x20params\x20})\x0a','read','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','8827OVPPHJ','\x22\x20not\x20found\x20for\x20dataset\x20','isInteger','function-node','trim','.js\x0a','entries','\x22.\x20','\x0a\x20*\x20[平台配置]\x20','parseInt','99CelkqT','No\x20model\x20aliases\x20found.\x20Run\x20`'];a37_0x3f05=function(){return _0x5a471d;};return a37_0x3f05();}import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x375ddc(0x164),'command':a37_0x375ddc(0x1a9),'description':a37_0x375ddc(0x15f),'risk':a37_0x375ddc(0x1ac),'flags':[{'name':a37_0x375ddc(0x192),'type':'string','required':!![],'enum':[a37_0x375ddc(0x193),'ENDPOINT','HOOK'],'description':'Script\x20type'},{'name':a37_0x375ddc(0x156),'type':'string','required':!![],'description':a37_0x375ddc(0x177)},{'name':a37_0x375ddc(0x153),'type':a37_0x375ddc(0x17e),'description':'Script\x20description'},{'name':a37_0x375ddc(0x166),'type':'string','description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a37_0x375ddc(0x158),'type':a37_0x375ddc(0x17e),'description':a37_0x375ddc(0x19e)},{'name':'operation-type','type':a37_0x375ddc(0x17e),'description':a37_0x375ddc(0x173)},{'name':a37_0x375ddc(0x144),'type':a37_0x375ddc(0x17e),'description':a37_0x375ddc(0x190),'enum':[a37_0x375ddc(0x17a),a37_0x375ddc(0x18e)]}],async 'validate'(_0x190592){const _0x5cc46c=a37_0x375ddc,_0xfd5fee=_0x190592['str']('name');if(!isValidBffFunctionName(_0xfd5fee))throw CliErrors[_0x5cc46c(0x18c)](_0x5cc46c(0x1a4)+_0xfd5fee+_0x5cc46c(0x187));},async 'execute'(_0x948594){const _0x10e562=a37_0x375ddc,_0xd56d3e=loadBffProjectConfig(_0x948594[_0x10e562(0x16b)]),_0x86db9c=_0x948594[_0x10e562(0x15a)](_0x10e562(0x192)),_0x27c04c=_0x948594['str'](_0x10e562(0x156)),_0x1aa74c=_0x948594[_0x10e562(0x15a)]('description')||undefined,_0x36d3b3=_0x86db9c===_0x10e562(0x160)?await resolveHookOptions(_0xd56d3e,_0x948594):undefined,_0x214059=buildFilePath(_0xd56d3e,_0x86db9c,_0x27c04c,_0x36d3b3);if(await fileExists(_0x214059))throw CliErrors[_0x10e562(0x18c)](_0x10e562(0x19d)+_0x214059);await mkdir(dirname(_0x214059),{'recursive':!![]});const _0x44b3a4=generateTemplate(_0x86db9c,_0x27c04c,_0x948594['appCode'],_0x1aa74c,_0x36d3b3);await writeFile(_0x214059,_0x44b3a4,_0x10e562(0x19c));const _0x1e0314={'type':_0x86db9c,'name':_0x27c04c,'path':_0x214059};if(_0x1aa74c)_0x1e0314[_0x10e562(0x153)]=_0x1aa74c;if(_0x36d3b3){if(_0x36d3b3[_0x10e562(0x166)])_0x1e0314[_0x10e562(0x166)]=_0x36d3b3[_0x10e562(0x166)];_0x1e0314[_0x10e562(0x14f)]=_0x36d3b3[_0x10e562(0x14f)],_0x1e0314[_0x10e562(0x16f)]=_0x36d3b3[_0x10e562(0x16f)],_0x1e0314[_0x10e562(0x18f)]=_0x36d3b3[_0x10e562(0x18f)];}return{'ok':!![],'data':_0x1e0314,'message':_0x10e562(0x194)+_0x86db9c+'\x20function:\x20'+_0x27c04c};}};async function resolveHookOptions(_0xc5219a,_0xfc09f4){const _0x12d3b8=a37_0x375ddc,_0x4602a7=resolveApiModelSource(_0xfc09f4[_0x12d3b8(0x1a1)],_0xfc09f4[_0x12d3b8(0x16b)],_0xfc09f4['selectedAppName']||_0xfc09f4[_0x12d3b8(0x1a6)]?.[_0x12d3b8(0x17d)]||_0xfc09f4['mergedCli']?.[_0x12d3b8(0x17c)]),_0x56f79d=loadAliasMap(_0xfc09f4[_0x12d3b8(0x1a1)],undefined,_0x4602a7['filePath'],_0x4602a7['profileName']),_0x54efef=_0x56f79d[_0x12d3b8(0x163)]>0x0;let _0x2e7ddf,_0x695677,_0x58e043;const _0x10dca5=_0xfc09f4[_0x12d3b8(0x15a)](_0x12d3b8(0x166)),_0xc6f9d5=_0xfc09f4[_0x12d3b8(0x15a)](_0x12d3b8(0x158));if(_0x10dca5){const _0x23fa9d=resolveAlias(_0xfc09f4[_0x12d3b8(0x1a1)],_0x10dca5,undefined,_0x4602a7[_0x12d3b8(0x1a2)],_0x4602a7[_0x12d3b8(0x178)]);if(!_0x23fa9d){const _0x21bb8b=_0x54efef?_0x12d3b8(0x186)+_0x56f79d['map'](_0x24ddbe=>_0x24ddbe[_0x12d3b8(0x166)])[_0x12d3b8(0x1a3)](',\x20'):_0x12d3b8(0x14c)+CLI_BIN_NAME+_0x12d3b8(0x174);throw CliErrors[_0x12d3b8(0x18c)](_0x12d3b8(0x159)+_0x10dca5+_0x12d3b8(0x1aa)+_0x21bb8b);}_0x2e7ddf=_0x10dca5,_0x695677=_0x23fa9d;}else{if(_0xc6f9d5){_0x695677=_0xc6f9d5;const _0x51e3e8=_0x56f79d['find'](_0x496e28=>_0x496e28[_0x12d3b8(0x14f)]===_0xc6f9d5);_0x2e7ddf=_0x51e3e8?.[_0x12d3b8(0x166)];}else{if(_0xfc09f4[_0x12d3b8(0x16e)])throw CliErrors['validation'](_0x12d3b8(0x17f));else{if(_0x54efef){const _0x1ec463=_0x56f79d['map'](_0x57e0e5=>_0x57e0e5['alias']+'\x20('+_0x57e0e5[_0x12d3b8(0x167)]+')'),_0x2b2886=await promptSelect(_0x12d3b8(0x182),_0x1ec463),_0x3f3435=_0x56f79d[_0x2b2886];if(!_0x3f3435)throw CliErrors[_0x12d3b8(0x18c)](_0x12d3b8(0x15b));_0x2e7ddf=_0x3f3435['alias'],_0x695677=_0x3f3435[_0x12d3b8(0x14f)];}else{const _0x29437a=await listDatasets(_0xfc09f4[_0x12d3b8(0x16b)]);if(_0x29437a[_0x12d3b8(0x163)]===0x0)throw CliErrors[_0x12d3b8(0x18c)](_0x12d3b8(0x19f));const _0xaa256c=_0x29437a[_0x12d3b8(0x151)](_0x56bb21=>_0x56bb21[_0x12d3b8(0x156)]+'\x20['+(_0x56bb21['source']??'UNKNOWN')+']\x20('+_0x56bb21[_0x12d3b8(0x1a0)]+')'),_0x42fa70=await promptSelect(_0x12d3b8(0x182),_0xaa256c),_0x1556c4=_0x29437a[_0x42fa70];if(!_0x1556c4)throw CliErrors[_0x12d3b8(0x18c)](_0x12d3b8(0x15b));_0x695677=_0x1556c4['code'],_0x2e7ddf=undefined;}}}}const _0xed5883=await listDatasets(_0xfc09f4[_0x12d3b8(0x16b)]),_0x23094b=_0xed5883[_0x12d3b8(0x19b)](_0x2533f3=>_0x2533f3[_0x12d3b8(0x1a0)]===_0x695677);if(!_0x23094b)throw CliErrors[_0x12d3b8(0x18c)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0x695677+_0x12d3b8(0x148)+(_0x2e7ddf?'The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`'+CLI_BIN_NAME+_0x12d3b8(0x18a):''));_0x58e043=_0x23094b['id'];const _0xe010ea=_0x2e7ddf??_0x695677,_0x4030b4=await listBffDatasetOperations(_0xfc09f4[_0x12d3b8(0x16b)],_0x58e043),_0x504e0e=_0x4030b4?Object[_0x12d3b8(0x15c)](_0x4030b4):[];if(_0x504e0e[_0x12d3b8(0x163)]===0x0)throw CliErrors[_0x12d3b8(0x18c)](_0x12d3b8(0x14d)+_0xe010ea+'.');let _0x35d0bc;const _0x3b085a=_0xfc09f4[_0x12d3b8(0x15a)](_0x12d3b8(0x179));if(_0x3b085a){if(!_0x504e0e[_0x12d3b8(0x189)](_0x3b085a))throw CliErrors['validation'](_0x12d3b8(0x161)+_0x3b085a+_0x12d3b8(0x1af)+_0xe010ea+'.\x20'+(_0x12d3b8(0x184)+_0x504e0e[_0x12d3b8(0x1a3)](',\x20')));_0x35d0bc=_0x3b085a;}else{if(_0xfc09f4[_0x12d3b8(0x16e)])throw CliErrors['validation'](_0x12d3b8(0x170));const _0x13f9d3=await promptSelect(_0x12d3b8(0x154),_0x504e0e);_0x35d0bc=_0x504e0e[_0x13f9d3]??_0x504e0e[0x0];}let _0x596fb1=normalizeHookFunctionNode(_0xfc09f4[_0x12d3b8(0x15a)](_0x12d3b8(0x144)));if(!_0x596fb1){if(_0xfc09f4['str'](_0x12d3b8(0x144)))throw CliErrors[_0x12d3b8(0x18c)](_0x12d3b8(0x172));if(_0xfc09f4[_0x12d3b8(0x16e)])throw CliErrors[_0x12d3b8(0x18c)](_0x12d3b8(0x1a5));const _0x5506e3=await promptSelect(_0x12d3b8(0x155),[_0x12d3b8(0x17a),_0x12d3b8(0x18e)]);_0x596fb1=['before',_0x12d3b8(0x18e)][_0x5506e3]??'before';}return{'alias':_0x2e7ddf,'datasetCode':_0x695677,'datasetId':_0x58e043,'operationType':_0x35d0bc,'functionNode':_0x596fb1};}async function promptSelect(_0x2b29b9,_0x3ed7c3){const _0x368f13=a37_0x375ddc;if(_0x3ed7c3['length']===0x1)return 0x0;for(const [_0x3b300f,_0x4287c7]of _0x3ed7c3[_0x368f13(0x147)]()){process[_0x368f13(0x1a8)][_0x368f13(0x176)]('\x20\x20'+(_0x3b300f+0x1)+'.\x20'+_0x4287c7+'\x0a');}const _0x21da03=createInterface({'input':process[_0x368f13(0x165)],'output':process[_0x368f13(0x1a8)]});while(!![]){const _0x4d7418=await new Promise(_0x469c97=>{const _0x3f57d2=_0x368f13;_0x21da03[_0x3f57d2(0x191)](_0x2b29b9+'\x20',_0x469c97);}),_0x519859=Number[_0x368f13(0x14a)](_0x4d7418[_0x368f13(0x145)](),0xa);if(Number[_0x368f13(0x143)](_0x519859)&&_0x519859>=0x1&&_0x519859<=_0x3ed7c3['length'])return _0x21da03['close'](),_0x519859-0x1;process[_0x368f13(0x1a8)][_0x368f13(0x176)]('\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20'+_0x3ed7c3[_0x368f13(0x163)]+'.\x0a');}}function buildFilePath(_0x2ca260,_0x5ed5fd,_0x4518fe,_0x4a67f7){const _0x13f6c2=a37_0x375ddc;if(_0x5ed5fd===_0x13f6c2(0x160)){if(!_0x4a67f7)throw CliErrors[_0x13f6c2(0x18c)](_0x13f6c2(0x15e));const _0x38ad59=_0x4a67f7[_0x13f6c2(0x166)]??_0x4a67f7[_0x13f6c2(0x14f)];return join(_0x2ca260[_0x13f6c2(0x195)],_0x13f6c2(0x160),_0x38ad59,_0x4a67f7[_0x13f6c2(0x16f)],_0x4a67f7[_0x13f6c2(0x18f)],_0x4518fe+'.js');}return join(_0x2ca260[_0x13f6c2(0x195)],_0x5ed5fd,_0x4518fe+'.js');}export function generateTemplate(_0x5cf6bb,_0x277d63,_0x35d16b,_0x54b6e1,_0x1ba2e9){const _0x147392=a37_0x375ddc,_0x4a0c8f=_0x54b6e1?.[_0x147392(0x145)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x137000=getAppBaseUrl(_0x35d16b),_0x2d2739=_0x147392(0x188);if(_0x5cf6bb===_0x147392(0x193))return _0x147392(0x168)+_0x4a0c8f+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x277d63+_0x147392(0x149)+_0x137000+_0x147392(0x16d)+_0x35d16b+_0x147392(0x18b)+_0x277d63+_0x147392(0x196)+_0x277d63+_0x147392(0x1ab)+_0x2d2739+_0x147392(0x16c)+_0x277d63+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x5cf6bb===_0x147392(0x1a7))return _0x147392(0x168)+_0x4a0c8f+_0x147392(0x150)+_0x277d63+_0x147392(0x199)+_0x35d16b+'/'+_0x277d63+_0x147392(0x149)+_0x137000+_0x147392(0x16d)+_0x35d16b+_0x147392(0x169)+_0x277d63+_0x147392(0x146)+_0x2d2739+'\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x277d63+_0x147392(0x1ad);if(!_0x1ba2e9)throw CliErrors['validation'](_0x147392(0x181));const _0x152de3=_0x1ba2e9[_0x147392(0x166)]??_0x1ba2e9[_0x147392(0x14f)],_0x381e4f=_0x1ba2e9[_0x147392(0x18f)]===_0x147392(0x17a)?'当前请求参数':_0x147392(0x15d),_0x180edd=_0x1ba2e9['functionNode']===_0x147392(0x17a)?_0x147392(0x157):'修改后的响应结果';return _0x147392(0x168)+_0x4a0c8f+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20'+_0x277d63+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x35d16b+'/'+_0x1ba2e9['datasetCode']+'/'+_0x1ba2e9[_0x147392(0x16f)]+_0x147392(0x149)+_0x137000+'/data/dataset/'+_0x1ba2e9[_0x147392(0x171)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x35d16b+'/HOOK/'+_0x152de3+'/'+_0x1ba2e9['operationType']+'/'+_0x1ba2e9[_0x147392(0x18f)]+'/'+_0x277d63+_0x147392(0x16a)+_0x1ba2e9['functionNode']+'\x0a'+_0x2d2739+'\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20'+_0x381e4f+_0x147392(0x175)+_0x180edd+_0x147392(0x17b)+_0x277d63+_0x147392(0x1ad);}
@@ -1 +1 @@
1
- const a38_0x5b005f=a38_0x85dd;(function(_0x4f8b10,_0x5b3965){const _0x4ed2fb=a38_0x85dd,_0x4dbc1e=_0x4f8b10();while(!![]){try{const _0xead74c=-parseInt(_0x4ed2fb(0x1c4))/0x1+-parseInt(_0x4ed2fb(0x1d5))/0x2+-parseInt(_0x4ed2fb(0x1d1))/0x3*(parseInt(_0x4ed2fb(0x1bb))/0x4)+parseInt(_0x4ed2fb(0x1bc))/0x5*(parseInt(_0x4ed2fb(0x1ce))/0x6)+-parseInt(_0x4ed2fb(0x1c0))/0x7*(parseInt(_0x4ed2fb(0x1b9))/0x8)+parseInt(_0x4ed2fb(0x1c6))/0x9+parseInt(_0x4ed2fb(0x1c3))/0xa*(parseInt(_0x4ed2fb(0x1c7))/0xb);if(_0xead74c===_0x5b3965)break;else _0x4dbc1e['push'](_0x4dbc1e['shift']());}catch(_0x447d03){_0x4dbc1e['push'](_0x4dbc1e['shift']());}}}(a38_0x3a58,0x5a512));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a38_0x85dd(_0x54ac14,_0xd50f10){_0x54ac14=_0x54ac14-0x1ad;const _0x3a588a=a38_0x3a58();let _0x85ddd0=_0x3a588a[_0x54ac14];return _0x85ddd0;}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a38_0x5b005f(0x1ca),'command':a38_0x5b005f(0x1af),'description':a38_0x5b005f(0x1ba),'risk':'high-risk-write','flags':[{'name':'target','type':'string','required':!![],'description':a38_0x5b005f(0x1ad)}],async 'validate'(_0xb6ec46){const _0xb30b98=a38_0x5b005f,_0x3834f4=loadBffProjectConfig(_0xb6ec46['appCode']),_0x1d67be=await readBffLockFile(_0x3834f4['lockFilePath']);if(!_0x1d67be)throw CliErrors[_0xb30b98(0x1cc)](_0xb30b98(0x1da));},async 'dryRun'(_0xbd62da){const _0x54330c=a38_0x5b005f,_0x7ad9b=loadBffProjectConfig(_0xbd62da['appCode']),_0x2a6551=await readBffLockFile(_0x7ad9b[_0x54330c(0x1d4)]);if(!_0x2a6551)throw CliErrors[_0x54330c(0x1cc)](_0x54330c(0x1d6));const {appLock:_0x334c94}=ensureLockScope(_0x2a6551,_0xbd62da[_0x54330c(0x1b2)],_0x7ad9b['scriptsRoot'],_0x54330c(0x1af)),_0x50ee66=_0xbd62da[_0x54330c(0x1d3)](_0x54330c(0x1be)),_0x1f7b74=Object['keys'](_0x334c94['functions']),_0x231329=resolveDeleteTarget(_0x50ee66,_0x1f7b74),_0x2ff413=_0x334c94[_0x54330c(0x1cf)][_0x231329];if(!_0x2ff413)throw CliErrors[_0x54330c(0x1cc)]('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x231329+'\x22.');const _0x30875d=resolveLocalFilePathFromLockKey(_0x7ad9b,_0x231329),_0x59d186=relative(_0x7ad9b[_0x54330c(0x1b8)],_0x30875d),_0x14d6e1=join(_0x7ad9b[_0x54330c(0x1cd)],'<timestamp>',_0x59d186);return{'method':'POST','url':_0x54330c(0x1c5),'body':{'appCode':_0xbd62da['appCode'],'target':_0x231329,'remoteId':_0x2ff413[_0x54330c(0x1ae)],'localFilePath':_0x30875d,'trashedPath':_0x14d6e1},'description':_0x54330c(0x1b5)+_0x231329+_0x54330c(0x1bd)};},async 'execute'(_0x234f53){const _0x53b99e=a38_0x5b005f,_0x4db2a1=loadBffProjectConfig(_0x234f53[_0x53b99e(0x1b2)]),_0x46efe9=await readBffLockFile(_0x4db2a1[_0x53b99e(0x1d4)]);if(!_0x46efe9)throw CliErrors[_0x53b99e(0x1cc)](_0x53b99e(0x1d6));const {lockData:_0x2c1348,appLock:_0x22eed4}=ensureLockScope(_0x46efe9,_0x234f53[_0x53b99e(0x1b2)],_0x4db2a1[_0x53b99e(0x1b6)],_0x53b99e(0x1af)),_0x13e089=JSON[_0x53b99e(0x1c9)](JSON['stringify'](_0x2c1348)),_0x537199=_0x13e089['apps'][_0x234f53[_0x53b99e(0x1b2)]];if(!_0x537199)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x234f53[_0x53b99e(0x1b2)]+_0x53b99e(0x1d9));const _0x3bab51=_0x234f53['str'](_0x53b99e(0x1be)),_0x5a831d=Object[_0x53b99e(0x1b7)](_0x537199['functions']),_0x46c952=resolveDeleteTarget(_0x3bab51,_0x5a831d),_0x2bebdc=_0x537199[_0x53b99e(0x1cf)][_0x46c952];if(!_0x2bebdc)throw CliErrors[_0x53b99e(0x1cc)](_0x53b99e(0x1cb)+_0x46c952+'\x22.');await deleteBffScript(_0x2bebdc[_0x53b99e(0x1ae)]),delete _0x537199[_0x53b99e(0x1cf)][_0x46c952],_0x537199[_0x53b99e(0x1d2)]=new Date()[_0x53b99e(0x1bf)](),await writeBffLockFile(_0x4db2a1[_0x53b99e(0x1d4)],_0x13e089);const _0x1225a7=resolveLocalFilePathFromLockKey(_0x4db2a1,_0x46c952);let _0x1f98bf;await fileExists(_0x1225a7)&&(_0x1f98bf=await moveToTrash(_0x4db2a1[_0x53b99e(0x1b8)],_0x4db2a1[_0x53b99e(0x1cd)],_0x1225a7),await cleanupEmptyDirectories(dirname(_0x1225a7),_0x4db2a1[_0x53b99e(0x1d7)]));await waitForDeleteSettlement(_0x4db2a1[_0x53b99e(0x1d4)],_0x234f53[_0x53b99e(0x1b2)],_0x46c952,_0x1225a7),await sleep(0x96);const _0x61522b={'deleted':_0x46c952,'remoteId':_0x2bebdc[_0x53b99e(0x1ae)]};if(_0x1f98bf)_0x61522b[_0x53b99e(0x1b0)]=_0x1f98bf;return{'ok':!![],'data':_0x61522b,'message':'Deleted\x20'+_0x46c952+(_0x1f98bf?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function resolveDeleteTarget(_0x4459c3,_0x5cc52d){const _0x4950fc=a38_0x5b005f;if(_0x4459c3[_0x4950fc(0x1c1)]('/')){const _0xeb008f=_0x5cc52d['find'](_0x27c0c7=>_0x27c0c7===_0x4459c3);if(!_0xeb008f)throw CliErrors['validation'](_0x4950fc(0x1d0)+_0x4459c3);return _0xeb008f;}const _0x5a2b7d=_0x5cc52d[_0x4950fc(0x1b1)](_0x4c9cce=>_0x4c9cce['split']('/')['at'](-0x1)===_0x4459c3);if(_0x5a2b7d[_0x4950fc(0x1db)]===0x0)throw CliErrors[_0x4950fc(0x1cc)](_0x4950fc(0x1d0)+_0x4459c3);if(_0x5a2b7d[_0x4950fc(0x1db)]>0x1)throw CliErrors[_0x4950fc(0x1cc)](_0x4950fc(0x1d8)+_0x4459c3+'\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a'+_0x5a2b7d[_0x4950fc(0x1b3)](_0x59002f=>'\x20\x20-\x20'+_0x59002f)['join']('\x0a'));return _0x5a2b7d[0x0];}async function moveToTrash(_0x8fde12,_0x2cdea7,_0x1ed27f){const _0x20450f=a38_0x5b005f,_0x4a94d4=new Date()[_0x20450f(0x1bf)]()[_0x20450f(0x1c2)](/[:.]/g,'-'),_0x1aa5e3=relative(_0x8fde12,_0x1ed27f),_0x3e53c1=join(_0x2cdea7,_0x4a94d4,_0x1aa5e3);return await mkdir(dirname(_0x3e53c1),{'recursive':!![]}),await rename(_0x1ed27f,_0x3e53c1),_0x3e53c1;}async function cleanupEmptyDirectories(_0x119d2e,_0x4fcd7a){const _0x33cfdf=a38_0x5b005f;let _0x13c17c=resolve(_0x119d2e);const _0x10e1de=resolve(_0x4fcd7a);while(_0x13c17c['startsWith'](''+_0x10e1de+sep)||_0x13c17c===_0x10e1de){if(_0x13c17c===_0x10e1de)return;try{const _0x5a9d3e=await readdir(_0x13c17c);if(_0x5a9d3e[_0x33cfdf(0x1db)]>0x0)return;await rmdir(_0x13c17c);}catch{return;}_0x13c17c=dirname(_0x13c17c);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;function a38_0x3a58(){const _0x589b09=['Local\x20delete\x20not\x20settled\x20for\x20','parse','bff','No\x20lock\x20entry\x20found\x20for\x20\x22','validation','trashDir','3647778xXskKH','functions','Function\x20not\x20found:\x20','1431666PjaHPX','lastSync','str','lockFilePath','962150EgMGAS','Backend\x20Function\x20lock\x20file\x20not\x20found.','scriptsRootDir','Multiple\x20functions\x20match\x20\x22','\x22\x20not\x20found\x20after\x20ensureLockScope.','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','length','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','remoteId','delete','trashedTo','filter','appCode','map','apps','Would\x20delete\x20','scriptsRoot','keys','projectRoot','244088VUGWNC','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','4wFkIXt','5cMFwby','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','target','toISOString','98ekhNiq','includes','replace','620ZKhiHj','676908KoRnkU','/api/management/library/scripts/delete','3876840HoIEfn','247247HtZhzi'];a38_0x3a58=function(){return _0x589b09;};return a38_0x3a58();}async function waitForDeleteSettlement(_0x1394f0,_0x3ee9ca,_0x5e9a50,_0xcd630f){const _0x4b206d=a38_0x5b005f;for(let _0x4252b9=0x0;_0x4252b9<DELETE_SETTLE_RETRY_COUNT;_0x4252b9+=0x1){const _0x1a0092=await readBffLockFile(_0x1394f0),_0x3584d=!!_0x1a0092?.[_0x4b206d(0x1b4)]?.[_0x3ee9ca]?.[_0x4b206d(0x1cf)]?.[_0x5e9a50],_0x4e5969=await fileExists(_0xcd630f);if(!_0x3584d&&!_0x4e5969)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x4b206d(0x1c8)+_0x5e9a50+'.');}
1
+ const a38_0x1628a0=a38_0xda2d;(function(_0x299363,_0x4e240a){const _0x2eba35=a38_0xda2d,_0x248d44=_0x299363();while(!![]){try{const _0x254dd5=parseInt(_0x2eba35(0x11d))/0x1+parseInt(_0x2eba35(0x139))/0x2*(-parseInt(_0x2eba35(0x119))/0x3)+parseInt(_0x2eba35(0x129))/0x4*(parseInt(_0x2eba35(0x11b))/0x5)+-parseInt(_0x2eba35(0x12a))/0x6+-parseInt(_0x2eba35(0x110))/0x7+parseInt(_0x2eba35(0x11e))/0x8+-parseInt(_0x2eba35(0x137))/0x9*(parseInt(_0x2eba35(0x126))/0xa);if(_0x254dd5===_0x4e240a)break;else _0x248d44['push'](_0x248d44['shift']());}catch(_0x56d1c8){_0x248d44['push'](_0x248d44['shift']());}}}(a38_0xd928,0x96634));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';function a38_0xd928(){const _0x48769a=['apps','scriptsRootDir','bff','str','/api/management/library/scripts/delete','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','Would\x20delete\x20','213qqQiuA','Backend\x20Function\x20lock\x20file\x20not\x20found.','45LJGols','trashDir','1214466Tzxgvg','6150832vLSovR','toISOString','remoteId','projectRoot','replace','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','includes','\x20\x20-\x20','2085910zlltUu','split','trashedTo','76324Yxofam','3842316sdVglX','string','scriptsRoot','parse','delete','high-risk-write','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','validation','Lock\x20scope\x20for\x20app\x20\x22','target','lastSync','Deleted\x20','length','9QCfieY','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','9890NFbeOD','Local\x20delete\x20not\x20settled\x20for\x20','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','functions','<timestamp>','map','join','lockFilePath','Multiple\x20functions\x20match\x20\x22','2372923aOKlRZ','appCode'];a38_0xd928=function(){return _0x48769a;};return a38_0xd928();}import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a38_0x1628a0(0x114),'command':a38_0x1628a0(0x12e),'description':a38_0x1628a0(0x130),'risk':a38_0x1628a0(0x12f),'flags':[{'name':a38_0x1628a0(0x133),'type':a38_0x1628a0(0x12b),'required':!![],'description':a38_0x1628a0(0x117)}],async 'validate'(_0x524d8d){const _0x4c6758=a38_0x1628a0,_0x321f43=loadBffProjectConfig(_0x524d8d[_0x4c6758(0x111)]),_0x411a83=await readBffLockFile(_0x321f43['lockFilePath']);if(!_0x411a83)throw CliErrors[_0x4c6758(0x131)](_0x4c6758(0x138));},async 'dryRun'(_0x3794c7){const _0x551110=a38_0x1628a0,_0x9bdc6b=loadBffProjectConfig(_0x3794c7[_0x551110(0x111)]),_0x326663=await readBffLockFile(_0x9bdc6b[_0x551110(0x10e)]);if(!_0x326663)throw CliErrors['validation'](_0x551110(0x11a));const {appLock:_0x5bbee5}=ensureLockScope(_0x326663,_0x3794c7['appCode'],_0x9bdc6b[_0x551110(0x12c)],_0x551110(0x12e)),_0x17a691=_0x3794c7[_0x551110(0x115)](_0x551110(0x133)),_0xd89d2e=Object['keys'](_0x5bbee5[_0x551110(0x13c)]),_0x265c18=resolveDeleteTarget(_0x17a691,_0xd89d2e),_0x34b4f9=_0x5bbee5[_0x551110(0x13c)][_0x265c18];if(!_0x34b4f9)throw CliErrors['validation']('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x265c18+'\x22.');const _0x60af0d=resolveLocalFilePathFromLockKey(_0x9bdc6b,_0x265c18),_0x46b841=relative(_0x9bdc6b['projectRoot'],_0x60af0d),_0x28bc51=join(_0x9bdc6b[_0x551110(0x11c)],_0x551110(0x13d),_0x46b841);return{'method':'POST','url':_0x551110(0x116),'body':{'appCode':_0x3794c7[_0x551110(0x111)],'target':_0x265c18,'remoteId':_0x34b4f9[_0x551110(0x120)],'localFilePath':_0x60af0d,'trashedPath':_0x28bc51},'description':_0x551110(0x118)+_0x265c18+_0x551110(0x13b)};},async 'execute'(_0x3ed1cf){const _0x14bc3b=a38_0x1628a0,_0x475702=loadBffProjectConfig(_0x3ed1cf[_0x14bc3b(0x111)]),_0x431b4e=await readBffLockFile(_0x475702['lockFilePath']);if(!_0x431b4e)throw CliErrors['validation'](_0x14bc3b(0x11a));const {lockData:_0x4e41e5,appLock:_0x23c76a}=ensureLockScope(_0x431b4e,_0x3ed1cf['appCode'],_0x475702['scriptsRoot'],_0x14bc3b(0x12e)),_0x22173=JSON[_0x14bc3b(0x12d)](JSON['stringify'](_0x4e41e5)),_0x7ff1ab=_0x22173[_0x14bc3b(0x112)][_0x3ed1cf[_0x14bc3b(0x111)]];if(!_0x7ff1ab)throw new Error(_0x14bc3b(0x132)+_0x3ed1cf[_0x14bc3b(0x111)]+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x10590d=_0x3ed1cf['str'](_0x14bc3b(0x133)),_0x308c93=Object['keys'](_0x7ff1ab[_0x14bc3b(0x13c)]),_0x334cdd=resolveDeleteTarget(_0x10590d,_0x308c93),_0x5657aa=_0x7ff1ab['functions'][_0x334cdd];if(!_0x5657aa)throw CliErrors['validation']('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x334cdd+'\x22.');await deleteBffScript(_0x5657aa[_0x14bc3b(0x120)]),delete _0x7ff1ab['functions'][_0x334cdd],_0x7ff1ab[_0x14bc3b(0x134)]=new Date()[_0x14bc3b(0x11f)](),await writeBffLockFile(_0x475702['lockFilePath'],_0x22173);const _0x18332c=resolveLocalFilePathFromLockKey(_0x475702,_0x334cdd);let _0x2a1673;await fileExists(_0x18332c)&&(_0x2a1673=await moveToTrash(_0x475702[_0x14bc3b(0x121)],_0x475702[_0x14bc3b(0x11c)],_0x18332c),await cleanupEmptyDirectories(dirname(_0x18332c),_0x475702[_0x14bc3b(0x113)]));await waitForDeleteSettlement(_0x475702[_0x14bc3b(0x10e)],_0x3ed1cf[_0x14bc3b(0x111)],_0x334cdd,_0x18332c),await sleep(0x96);const _0xe46af4={'deleted':_0x334cdd,'remoteId':_0x5657aa[_0x14bc3b(0x120)]};if(_0x2a1673)_0xe46af4[_0x14bc3b(0x128)]=_0x2a1673;return{'ok':!![],'data':_0xe46af4,'message':_0x14bc3b(0x135)+_0x334cdd+(_0x2a1673?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function a38_0xda2d(_0x401585,_0x32e9a0){_0x401585=_0x401585-0x10e;const _0xd9280e=a38_0xd928();let _0xda2d87=_0xd9280e[_0x401585];return _0xda2d87;}function resolveDeleteTarget(_0x564ab1,_0x597fee){const _0x411da2=a38_0x1628a0;if(_0x564ab1[_0x411da2(0x124)]('/')){const _0x581b1b=_0x597fee['find'](_0x59aa8b=>_0x59aa8b===_0x564ab1);if(!_0x581b1b)throw CliErrors[_0x411da2(0x131)]('Function\x20not\x20found:\x20'+_0x564ab1);return _0x581b1b;}const _0x5092ab=_0x597fee['filter'](_0x56575f=>_0x56575f[_0x411da2(0x127)]('/')['at'](-0x1)===_0x564ab1);if(_0x5092ab[_0x411da2(0x136)]===0x0)throw CliErrors[_0x411da2(0x131)]('Function\x20not\x20found:\x20'+_0x564ab1);if(_0x5092ab[_0x411da2(0x136)]>0x1)throw CliErrors[_0x411da2(0x131)](_0x411da2(0x10f)+_0x564ab1+_0x411da2(0x123)+_0x5092ab[_0x411da2(0x13e)](_0x210b24=>_0x411da2(0x125)+_0x210b24)[_0x411da2(0x13f)]('\x0a'));return _0x5092ab[0x0];}async function moveToTrash(_0x4057ac,_0x26da6c,_0x1ba5c4){const _0x3dfdac=a38_0x1628a0,_0x3896e6=new Date()['toISOString']()[_0x3dfdac(0x122)](/[:.]/g,'-'),_0x234b66=relative(_0x4057ac,_0x1ba5c4),_0x4ecae4=join(_0x26da6c,_0x3896e6,_0x234b66);return await mkdir(dirname(_0x4ecae4),{'recursive':!![]}),await rename(_0x1ba5c4,_0x4ecae4),_0x4ecae4;}async function cleanupEmptyDirectories(_0x5cad24,_0x4a0807){const _0x50cc12=a38_0x1628a0;let _0x243a0c=resolve(_0x5cad24);const _0x375479=resolve(_0x4a0807);while(_0x243a0c['startsWith'](''+_0x375479+sep)||_0x243a0c===_0x375479){if(_0x243a0c===_0x375479)return;try{const _0x35a060=await readdir(_0x243a0c);if(_0x35a060[_0x50cc12(0x136)]>0x0)return;await rmdir(_0x243a0c);}catch{return;}_0x243a0c=dirname(_0x243a0c);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x5a194e,_0x20ae2b,_0x21752b,_0x1a9f38){const _0x5a7070=a38_0x1628a0;for(let _0x31975a=0x0;_0x31975a<DELETE_SETTLE_RETRY_COUNT;_0x31975a+=0x1){const _0x2c07d8=await readBffLockFile(_0x5a194e),_0x2a3024=!!_0x2c07d8?.[_0x5a7070(0x112)]?.[_0x20ae2b]?.[_0x5a7070(0x13c)]?.[_0x21752b],_0x573ee2=await fileExists(_0x1a9f38);if(!_0x2a3024&&!_0x573ee2)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x5a7070(0x13a)+_0x21752b+'.');}
@@ -1 +1 @@
1
- const a39_0x11f614=a39_0x257f;function a39_0x46af(){const _0x29a7db=['appCode','verbose','number','scriptType','boolean','32570vCuYGW','2PUruoa','read','version','functionName','238255IjWZUm','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','1602209LyevZO','230Vnpkwo','3208IAwhWp','4dLEGlE','108Bfvotk','Return\x20full\x20raw\x20script\x20object','377lqXDIk','46908AQYEQR','detail','465306YcwwIE','description','num','(none)','539xbpDLm','createdTime','3924MBJape'];a39_0x46af=function(){return _0x29a7db;};return a39_0x46af();}function a39_0x257f(_0x2328eb,_0x2d9c95){_0x2328eb=_0x2328eb-0xe7;const _0x46af60=a39_0x46af();let _0x257f2f=_0x46af60[_0x2328eb];return _0x257f2f;}(function(_0x80ab0,_0x4bb659){const _0x344c4e=a39_0x257f,_0x5efdad=_0x80ab0();while(!![]){try{const _0x37a0ed=-parseInt(_0x344c4e(0xfe))/0x1*(parseInt(_0x344c4e(0xfa))/0x2)+-parseInt(_0x344c4e(0xed))/0x3*(parseInt(_0x344c4e(0xe7))/0x4)+parseInt(_0x344c4e(0x101))/0x5*(parseInt(_0x344c4e(0xeb))/0x6)+parseInt(_0x344c4e(0x100))/0x7+parseInt(_0x344c4e(0x102))/0x8*(parseInt(_0x344c4e(0xf3))/0x9)+-parseInt(_0x344c4e(0xf9))/0xa*(parseInt(_0x344c4e(0xf1))/0xb)+-parseInt(_0x344c4e(0xe8))/0xc*(parseInt(_0x344c4e(0xea))/0xd);if(_0x37a0ed===_0x4bb659)break;else _0x5efdad['push'](_0x5efdad['shift']());}catch(_0x4b0ac2){_0x5efdad['push'](_0x5efdad['shift']());}}}(a39_0x46af,0x334dc));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':'bff','command':a39_0x11f614(0xec),'description':a39_0x11f614(0xff),'risk':a39_0x11f614(0xfb),'flags':[{'name':'id','type':a39_0x11f614(0xf6),'required':!![],'description':'Script\x20ID'},{'name':a39_0x11f614(0xf5),'type':a39_0x11f614(0xf8),'description':a39_0x11f614(0xe9)}],async 'execute'(_0x35f665){const _0x5041ce=a39_0x11f614,_0x39f5dd=await getBffScriptInfo(_0x35f665[_0x5041ce(0xef)]('id')),_0x4f4c7b=_0x35f665['bool']('verbose');if(_0x4f4c7b)return{'ok':!![],'data':_0x39f5dd};return{'ok':!![],'data':{'id':_0x39f5dd['id'],'functionName':_0x39f5dd[_0x5041ce(0xfd)]??'','version':_0x39f5dd[_0x5041ce(0xfc)]??'','updateUserName':_0x39f5dd['updateUserName']??'','appCode':_0x39f5dd[_0x5041ce(0xf4)],'scriptType':_0x39f5dd[_0x5041ce(0xf7)],'description':_0x39f5dd[_0x5041ce(0xee)]||_0x5041ce(0xf0),'createdTime':_0x39f5dd[_0x5041ce(0xf2)]??'','updatedTime':_0x39f5dd['updatedTime']??'','scriptContent':_0x39f5dd['scriptContent']??''}};}};
1
+ const a39_0x3ce64b=a39_0xbaf7;function a39_0x3c5c(){const _0x29b4a6=['createdTime','num','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','scriptType','functionName','(none)','7gNLLwF','detail','updatedTime','verbose','1668044QdeWeX','Script\x20ID','boolean','read','2232102NpYJrv','23155740GUNrYh','Return\x20full\x20raw\x20script\x20object','appCode','336869lvxviv','4TZaQAn','1968627VAOlei','number','scriptContent','3027470zmhxPW','updateUserName','108272gRQdPY'];a39_0x3c5c=function(){return _0x29b4a6;};return a39_0x3c5c();}function a39_0xbaf7(_0x40e4f6,_0x11d0ea){_0x40e4f6=_0x40e4f6-0x19f;const _0x3c5cef=a39_0x3c5c();let _0xbaf7ee=_0x3c5cef[_0x40e4f6];return _0xbaf7ee;}(function(_0x2f55ff,_0x44a881){const _0x18da56=a39_0xbaf7,_0xf33662=_0x2f55ff();while(!![]){try{const _0x386fed=parseInt(_0x18da56(0x1b0))/0x1+-parseInt(_0x18da56(0x1a8))/0x2+-parseInt(_0x18da56(0x1b2))/0x3*(parseInt(_0x18da56(0x1b1))/0x4)+-parseInt(_0x18da56(0x1b5))/0x5+-parseInt(_0x18da56(0x1ac))/0x6*(parseInt(_0x18da56(0x1a4))/0x7)+-parseInt(_0x18da56(0x1b7))/0x8+parseInt(_0x18da56(0x1ad))/0x9;if(_0x386fed===_0x44a881)break;else _0xf33662['push'](_0xf33662['shift']());}catch(_0x3cd7bd){_0xf33662['push'](_0xf33662['shift']());}}}(a39_0x3c5c,0x689a5));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':'bff','command':a39_0x3ce64b(0x1a5),'description':a39_0x3ce64b(0x1a0),'risk':a39_0x3ce64b(0x1ab),'flags':[{'name':'id','type':a39_0x3ce64b(0x1b3),'required':!![],'description':a39_0x3ce64b(0x1a9)},{'name':a39_0x3ce64b(0x1a7),'type':a39_0x3ce64b(0x1aa),'description':a39_0x3ce64b(0x1ae)}],async 'execute'(_0x16531d){const _0x45d315=a39_0x3ce64b,_0x3df051=await getBffScriptInfo(_0x16531d[_0x45d315(0x19f)]('id')),_0x453442=_0x16531d['bool'](_0x45d315(0x1a7));if(_0x453442)return{'ok':!![],'data':_0x3df051};return{'ok':!![],'data':{'id':_0x3df051['id'],'functionName':_0x3df051[_0x45d315(0x1a2)]??'','version':_0x3df051['version']??'','updateUserName':_0x3df051[_0x45d315(0x1b6)]??'','appCode':_0x3df051[_0x45d315(0x1af)],'scriptType':_0x3df051[_0x45d315(0x1a1)],'description':_0x3df051['description']||_0x45d315(0x1a3),'createdTime':_0x3df051[_0x45d315(0x1b8)]??'','updatedTime':_0x3df051[_0x45d315(0x1a6)]??'','scriptContent':_0x3df051[_0x45d315(0x1b4)]??''}};}};
@@ -1 +1 @@
1
- (function(_0x4363de,_0x428068){const _0x5e86c9=a40_0x1a51,_0x57b5f6=_0x4363de();while(!![]){try{const _0x47aa17=parseInt(_0x5e86c9(0x1cd))/0x1+parseInt(_0x5e86c9(0x1c8))/0x2*(-parseInt(_0x5e86c9(0x1c9))/0x3)+parseInt(_0x5e86c9(0x1d0))/0x4*(parseInt(_0x5e86c9(0x1ce))/0x5)+parseInt(_0x5e86c9(0x1ca))/0x6+-parseInt(_0x5e86c9(0x1cc))/0x7*(parseInt(_0x5e86c9(0x1cb))/0x8)+-parseInt(_0x5e86c9(0x1cf))/0x9+parseInt(_0x5e86c9(0x1c7))/0xa;if(_0x47aa17===_0x428068)break;else _0x57b5f6['push'](_0x57b5f6['shift']());}catch(_0x197ff4){_0x57b5f6['push'](_0x57b5f6['shift']());}}}(a40_0x1624,0xab60e));import{bffList}from'../../commands/bff/list.js';function a40_0x1624(){const _0x23cf8a=['8691907xXnQyY','666521CKBeZv','1135gTERxd','408411GpqCiv','7652oaPQLw','8791540BnHmsg','6114QqfzDT','246EMDskf','1558764idGmRK','8FFiNZn'];a40_0x1624=function(){return _0x23cf8a;};return a40_0x1624();}import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';import{bffPull}from'../../commands/bff/pull.js';function a40_0x1a51(_0x16399c,_0x4f4ea1){_0x16399c=_0x16399c-0x1c7;const _0x1624a4=a40_0x1624();let _0x1a51ed=_0x1624a4[_0x16399c];return _0x1a51ed;}import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
1
+ (function(_0x1e6fab,_0x1db54e){const _0x38a636=a40_0x4e97,_0x135395=_0x1e6fab();while(!![]){try{const _0x2c4269=parseInt(_0x38a636(0xfc))/0x1*(-parseInt(_0x38a636(0x101))/0x2)+parseInt(_0x38a636(0xfe))/0x3+-parseInt(_0x38a636(0xfb))/0x4+-parseInt(_0x38a636(0x100))/0x5+-parseInt(_0x38a636(0xff))/0x6+-parseInt(_0x38a636(0xfa))/0x7+parseInt(_0x38a636(0xfd))/0x8;if(_0x2c4269===_0x1db54e)break;else _0x135395['push'](_0x135395['shift']());}catch(_0x558c2a){_0x135395['push'](_0x135395['shift']());}}}(a40_0x45ad,0x93b4a));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';function a40_0x4e97(_0x1ad6c1,_0x2b6996){_0x1ad6c1=_0x1ad6c1-0xfa;const _0x45adb2=a40_0x45ad();let _0x4e9715=_0x45adb2[_0x1ad6c1];return _0x4e9715;}import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';function a40_0x45ad(){const _0x51f9f1=['18862024KQZRBm','102672AtVSwC','497394otzQdx','2525600nWoQbY','218irqHMJ','1355193sXRBPG','547816HLaKpO','7967Hfozst'];a40_0x45ad=function(){return _0x51f9f1;};return a40_0x45ad();}import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
@@ -1 +1 @@
1
- const a41_0x1c541d=a41_0x102c;(function(_0x43bc75,_0x38f822){const _0x2cd51f=a41_0x102c,_0x2bc01e=_0x43bc75();while(!![]){try{const _0x87c7a4=parseInt(_0x2cd51f(0x9f))/0x1+parseInt(_0x2cd51f(0x9a))/0x2*(-parseInt(_0x2cd51f(0xb5))/0x3)+parseInt(_0x2cd51f(0xa3))/0x4+-parseInt(_0x2cd51f(0xaa))/0x5+parseInt(_0x2cd51f(0xae))/0x6*(-parseInt(_0x2cd51f(0x98))/0x7)+parseInt(_0x2cd51f(0xa8))/0x8*(parseInt(_0x2cd51f(0x9b))/0x9)+parseInt(_0x2cd51f(0xab))/0xa;if(_0x87c7a4===_0x38f822)break;else _0x2bc01e['push'](_0x2bc01e['shift']());}catch(_0x27d411){_0x2bc01e['push'](_0x2bc01e['shift']());}}}(a41_0x293b,0xb2555));import{listBffScripts}from'../../core/api-client.js';function a41_0x293b(){const _0x52a7ae=['Script\x20type\x20filter','(unnamed)','Return\x20full\x20script\x20objects','appCode','3856soBWAB','scriptType','1103385AAQywK','17631020riKKdb','str','verbose','2739882BiOznG','List\x20Backend\x20Function\x20scripts','string','Filter\x20by\x20script\x20name','COMMON','No\x20Backend\x20Function\x20scripts\x20found.','list','3UWGWNw','map','21oKfvRU','type','1722642IocUGh','9603bQpPxV','name','boolean','bff','327110BrbORK','read','ENDPOINT','functionName','2311544pIbMWo'];a41_0x293b=function(){return _0x52a7ae;};return a41_0x293b();}function a41_0x102c(_0x6d3dd0,_0x55922a){_0x6d3dd0=_0x6d3dd0-0x97;const _0x293b4c=a41_0x293b();let _0x102cde=_0x293b4c[_0x6d3dd0];return _0x102cde;}export const bffList={'service':a41_0x1c541d(0x9e),'command':a41_0x1c541d(0xb4),'description':a41_0x1c541d(0xaf),'risk':a41_0x1c541d(0xa0),'flags':[{'name':a41_0x1c541d(0x99),'type':a41_0x1c541d(0xb0),'description':a41_0x1c541d(0xa4),'default':a41_0x1c541d(0xa1),'enum':[a41_0x1c541d(0xa1),a41_0x1c541d(0xb2)]},{'name':'name','type':'string','description':a41_0x1c541d(0xb1)},{'name':a41_0x1c541d(0xad),'type':a41_0x1c541d(0x9d),'description':a41_0x1c541d(0xa6)}],async 'execute'(_0x44df49){const _0x22db39=a41_0x1c541d,_0x35f576=await listBffScripts(_0x44df49[_0x22db39(0xa7)],_0x44df49[_0x22db39(0xac)](_0x22db39(0x99)),{'scriptName':_0x44df49[_0x22db39(0xac)](_0x22db39(0x9c))||undefined}),_0x2dc9b8=_0x44df49['bool'](_0x22db39(0xad));return{'ok':!![],'data':_0x2dc9b8?_0x35f576:_0x35f576[_0x22db39(0x97)](_0x490ab7=>({'id':_0x490ab7['id'],'functionName':_0x490ab7[_0x22db39(0xa2)]??'','description':_0x490ab7['description']||_0x22db39(0xa5),'scriptType':_0x490ab7[_0x22db39(0xa9)]})),'message':_0x35f576['length']===0x0?_0x22db39(0xb3):undefined};}};
1
+ const a41_0x28a77f=a41_0x48fa;(function(_0x79663b,_0x7d6fd8){const _0x5bca0d=a41_0x48fa,_0x57717e=_0x79663b();while(!![]){try{const _0xea9f94=-parseInt(_0x5bca0d(0x13e))/0x1*(parseInt(_0x5bca0d(0x14d))/0x2)+parseInt(_0x5bca0d(0x15a))/0x3*(-parseInt(_0x5bca0d(0x144))/0x4)+parseInt(_0x5bca0d(0x13f))/0x5+parseInt(_0x5bca0d(0x147))/0x6*(parseInt(_0x5bca0d(0x13c))/0x7)+-parseInt(_0x5bca0d(0x153))/0x8+parseInt(_0x5bca0d(0x155))/0x9*(-parseInt(_0x5bca0d(0x14b))/0xa)+parseInt(_0x5bca0d(0x13d))/0xb;if(_0xea9f94===_0x7d6fd8)break;else _0x57717e['push'](_0x57717e['shift']());}catch(_0x1a9d67){_0x57717e['push'](_0x57717e['shift']());}}}(a41_0x364b,0x4f269));function a41_0x48fa(_0x25a117,_0x41ba44){_0x25a117=_0x25a117-0x13c;const _0x364bde=a41_0x364b();let _0x48fa48=_0x364bde[_0x25a117];return _0x48fa48;}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a41_0x28a77f(0x143),'command':'list','description':a41_0x28a77f(0x148),'risk':a41_0x28a77f(0x14a),'flags':[{'name':a41_0x28a77f(0x15b),'type':a41_0x28a77f(0x14e),'description':a41_0x28a77f(0x14f),'default':a41_0x28a77f(0x156),'enum':[a41_0x28a77f(0x156),a41_0x28a77f(0x14c)]},{'name':'name','type':a41_0x28a77f(0x14e),'description':a41_0x28a77f(0x141)},{'name':'verbose','type':'boolean','description':a41_0x28a77f(0x145)}],async 'execute'(_0x28a7c3){const _0x5daf9b=a41_0x28a77f,_0x32d6d5=await listBffScripts(_0x28a7c3[_0x5daf9b(0x150)],_0x28a7c3[_0x5daf9b(0x142)](_0x5daf9b(0x15b)),{'scriptName':_0x28a7c3[_0x5daf9b(0x142)](_0x5daf9b(0x152))||undefined}),_0x550cee=_0x28a7c3[_0x5daf9b(0x151)](_0x5daf9b(0x157));return{'ok':!![],'data':_0x550cee?_0x32d6d5:_0x32d6d5[_0x5daf9b(0x154)](_0x216e42=>({'id':_0x216e42['id'],'functionName':_0x216e42[_0x5daf9b(0x159)]??'','description':_0x216e42['description']||_0x5daf9b(0x158),'scriptType':_0x216e42[_0x5daf9b(0x146)]})),'message':_0x32d6d5[_0x5daf9b(0x140)]===0x0?_0x5daf9b(0x149):undefined};}};function a41_0x364b(){const _0x5d745b=['bff','33584fvwjeQ','Return\x20full\x20script\x20objects','scriptType','6fzOTUs','List\x20Backend\x20Function\x20scripts','No\x20Backend\x20Function\x20scripts\x20found.','read','270cYGCAr','COMMON','1828sEDACN','string','Script\x20type\x20filter','appCode','bool','name','4540544fAWYFE','map','98073KMWCye','ENDPOINT','verbose','(unnamed)','functionName','126nfqBbT','type','3987179YLuaCE','9131243HERTAi','169unpipD','1466880tScfBB','length','Filter\x20by\x20script\x20name','str'];a41_0x364b=function(){return _0x5d745b;};return a41_0x364b();}
@@ -1 +1 @@
1
- function a42_0x3508(_0x525108,_0x4956d7){_0x525108=_0x525108-0x197;const _0x4e1bd9=a42_0x4e1b();let _0x350858=_0x4e1bd9[_0x525108];return _0x350858;}const a42_0x3b43ee=a42_0x3508;(function(_0x2ed6de,_0x1545b6){const _0x2a0d71=a42_0x3508,_0x6593d6=_0x2ed6de();while(!![]){try{const _0x144420=-parseInt(_0x2a0d71(0x1a7))/0x1+parseInt(_0x2a0d71(0x1a0))/0x2*(parseInt(_0x2a0d71(0x1a1))/0x3)+-parseInt(_0x2a0d71(0x1bb))/0x4+-parseInt(_0x2a0d71(0x1b8))/0x5*(-parseInt(_0x2a0d71(0x1a3))/0x6)+-parseInt(_0x2a0d71(0x1a6))/0x7*(parseInt(_0x2a0d71(0x1af))/0x8)+-parseInt(_0x2a0d71(0x19c))/0x9*(parseInt(_0x2a0d71(0x198))/0xa)+parseInt(_0x2a0d71(0x1b6))/0xb*(parseInt(_0x2a0d71(0x1c6))/0xc);if(_0x144420===_0x1545b6)break;else _0x6593d6['push'](_0x6593d6['shift']());}catch(_0x7f2c11){_0x6593d6['push'](_0x6593d6['shift']());}}}(a42_0x4e1b,0xe0e1d));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0x3b43ee(0x19a),a42_0x3b43ee(0x1aa),a42_0x3b43ee(0x1ba),a42_0x3b43ee(0x1c5)];export function resolveBffLogQuery(_0x4f74fc,_0x232f8e=Date[a42_0x3b43ee(0x1bc)]()){const _0xe80b74=a42_0x3b43ee,_0x88f06a=_0x4f74fc[_0xe80b74(0x1bf)]('since'),_0x436795=_0x4f74fc[_0xe80b74(0x1bf)]('start-time'),_0x4ee878=_0x4f74fc['flag']('end-time');if(_0x88f06a!==undefined&&_0x436795!==undefined)throw CliErrors[_0xe80b74(0x1ab)]('--since\x20cannot\x20be\x20combined\x20with\x20--start-time.');const _0x43cfbc=_0x4ee878===undefined?_0x232f8e:readPositiveInteger(_0x4f74fc['num'](_0xe80b74(0x197)),'--end-time'),_0x116a8c=_0x436795===undefined?_0x43cfbc-readSinceMinutes(_0x4f74fc)*0xea60:readPositiveInteger(_0x4f74fc[_0xe80b74(0x1c0)](_0xe80b74(0x1c1)),_0xe80b74(0x1be));if(_0x116a8c<=0x0)throw CliErrors[_0xe80b74(0x1ab)](_0xe80b74(0x19b));if(_0x116a8c>_0x43cfbc)throw CliErrors[_0xe80b74(0x1ab)](_0xe80b74(0x1b2));const _0x42b4e1=readPositiveInteger(_0x4f74fc[_0xe80b74(0x1c0)](_0xe80b74(0x1b5),DEFAULT_LIMIT),_0xe80b74(0x1c3));if(_0x42b4e1>MAX_LIMIT)throw CliErrors[_0xe80b74(0x1ab)](_0xe80b74(0x1bd)+MAX_LIMIT+'.');const _0x263dbc=_0x4f74fc[_0xe80b74(0x1a4)](_0xe80b74(0x199))['trim']()[_0xe80b74(0x1b4)]()||undefined,_0x4ca7eb=_0x4f74fc[_0xe80b74(0x1a4)](_0xe80b74(0x1c2))['trim']()||undefined;return{'appCode':_0x4f74fc[_0xe80b74(0x1b9)],'startTime':_0x116a8c,'endTime':_0x43cfbc,..._0x436795===undefined?{'sinceMinutes':readSinceMinutes(_0x4f74fc)}:{},..._0x263dbc?{'level':_0x263dbc}:{},..._0x4ca7eb?{'keyword':_0x4ca7eb}:{},'limit':_0x42b4e1};}function readSinceMinutes(_0x4991b5){const _0x4f5090=a42_0x3b43ee;return readPositiveInteger(_0x4991b5[_0x4f5090(0x1c0)](_0x4f5090(0x1b3),DEFAULT_SINCE_MINUTES),_0x4f5090(0x1b7));}function readPositiveInteger(_0x1884ec,_0x5a2901){const _0x3ab3de=a42_0x3b43ee;if(!Number[_0x3ab3de(0x19d)](_0x1884ec)||_0x1884ec<=0x0)throw CliErrors[_0x3ab3de(0x1ab)](_0x5a2901+_0x3ab3de(0x1a5));return _0x1884ec;}function a42_0x4e1b(){const _0x95c393=['bff','number','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','since','toUpperCase','limit','3680974ZaoiFb','--since','15PXVgAk','appCode','WARN','2388220zSGUqq','now','--limit\x20must\x20be\x20between\x201\x20and\x20','--start-time','flag','num','start-time','keyword','--limit','Maximum\x20log\x20lines\x20to\x20return\x20(1-','ERROR','24dDFKBJ','end-time','70AnOvug','level','DEBUG','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','3717WkUlhi','isSafeInteger','Filter\x20by\x20log\x20level','read','68IQYZEW','55467tbDhca','length','2747034DHoIEf','str','\x20must\x20be\x20a\x20positive\x20integer.','7MlUryY','285290vtSqmr','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','string','INFO','validation','\x20Backend\x20Function\x20log\x20line(s).','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','6920464OOKDAG'];a42_0x4e1b=function(){return _0x95c393;};return a42_0x4e1b();}export const bffLogs={'service':a42_0x3b43ee(0x1b0),'command':'logs','description':'Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','risk':a42_0x3b43ee(0x19f),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x3b43ee(0x1b3),'type':a42_0x3b43ee(0x1b1),'description':a42_0x3b43ee(0x1ad)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x3b43ee(0x1c1),'type':a42_0x3b43ee(0x1b1),'description':a42_0x3b43ee(0x1a8)},{'name':a42_0x3b43ee(0x197),'type':a42_0x3b43ee(0x1b1),'description':'Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)'},{'name':a42_0x3b43ee(0x199),'type':a42_0x3b43ee(0x1a9),'description':a42_0x3b43ee(0x19e),'enum':LOG_LEVELS},{'name':'keyword','type':a42_0x3b43ee(0x1a9),'description':a42_0x3b43ee(0x1ae)},{'name':a42_0x3b43ee(0x1b5),'type':a42_0x3b43ee(0x1b1),'description':a42_0x3b43ee(0x1c4)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x1c4969){resolveBffLogQuery(_0x1c4969);},async 'execute'(_0x59df66){const _0x3d8f51=a42_0x3b43ee,_0x99c9fc=resolveBffLogQuery(_0x59df66),{sinceMinutes:_0x259dd6,..._0x3ff721}=_0x99c9fc,_0x8650c2=await searchBffScriptLogs(_0x3ff721);return{'ok':!![],'data':{'query':_0x99c9fc,'count':_0x8650c2[_0x3d8f51(0x1a2)],'logs':_0x8650c2},'message':_0x8650c2['length']===0x0?'No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.':'Found\x20'+_0x8650c2[_0x3d8f51(0x1a2)]+_0x3d8f51(0x1ac)};}};
1
+ const a42_0x3f649b=a42_0x48d6;(function(_0x2fe34c,_0x115d5f){const _0x52ad37=a42_0x48d6,_0xe588b8=_0x2fe34c();while(!![]){try{const _0x3fe11a=parseInt(_0x52ad37(0x1b2))/0x1+-parseInt(_0x52ad37(0x1a7))/0x2*(-parseInt(_0x52ad37(0x1b5))/0x3)+parseInt(_0x52ad37(0x1b3))/0x4+parseInt(_0x52ad37(0x1c5))/0x5*(-parseInt(_0x52ad37(0x1c7))/0x6)+-parseInt(_0x52ad37(0x19f))/0x7+-parseInt(_0x52ad37(0x1b7))/0x8*(parseInt(_0x52ad37(0x19e))/0x9)+parseInt(_0x52ad37(0x1b6))/0xa;if(_0x3fe11a===_0x115d5f)break;else _0xe588b8['push'](_0xe588b8['shift']());}catch(_0x21461f){_0xe588b8['push'](_0xe588b8['shift']());}}}(a42_0x2ebb,0xb0120));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a42_0x48d6(_0xf9a73a,_0x598b6e){_0xf9a73a=_0xf9a73a-0x19d;const _0x2ebbae=a42_0x2ebb();let _0x48d624=_0x2ebbae[_0xf9a73a];return _0x48d624;}function a42_0x2ebb(){const _0x237283=['length','6kyjrnm','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','flag','number','225WZPcry','5302689POONDM','--start-time','bff','validation','DEBUG','logs','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','since','364912BQlCwc','--since','str','level','Found\x20','toUpperCase','--end-time','Maximum\x20log\x20lines\x20to\x20return\x20(1-','isSafeInteger','appCode','start-time','713062cclFsh','108628KHDYtb','\x20must\x20be\x20a\x20positive\x20integer.','3yardUa','25372720MbbEqJ','440488KyfRtx','INFO','\x20Backend\x20Function\x20log\x20line(s).','end-time','string','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','Filter\x20by\x20log\x20level','num','trim','read','keyword','now','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','--limit\x20must\x20be\x20between\x201\x20and\x20','3023555AaOdlu'];a42_0x2ebb=function(){return _0x237283;};return a42_0x2ebb();}import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0x3f649b(0x1a3),a42_0x3f649b(0x1b8),'WARN','ERROR'];export function resolveBffLogQuery(_0x23c52c,_0x1d9eb9=Date[a42_0x3f649b(0x1c2)]()){const _0xd508d2=a42_0x3f649b,_0x16454b=_0x23c52c['flag'](_0xd508d2(0x1a6)),_0x45fe1b=_0x23c52c['flag']('start-time'),_0x2443aa=_0x23c52c[_0xd508d2(0x1c9)](_0xd508d2(0x1ba));if(_0x16454b!==undefined&&_0x45fe1b!==undefined)throw CliErrors['validation']('--since\x20cannot\x20be\x20combined\x20with\x20--start-time.');const _0x11afe3=_0x2443aa===undefined?_0x1d9eb9:readPositiveInteger(_0x23c52c[_0xd508d2(0x1be)](_0xd508d2(0x1ba)),_0xd508d2(0x1ad)),_0x4bf482=_0x45fe1b===undefined?_0x11afe3-readSinceMinutes(_0x23c52c)*0xea60:readPositiveInteger(_0x23c52c[_0xd508d2(0x1be)](_0xd508d2(0x1b1)),_0xd508d2(0x1a0));if(_0x4bf482<=0x0)throw CliErrors[_0xd508d2(0x1a2)]('The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.');if(_0x4bf482>_0x11afe3)throw CliErrors[_0xd508d2(0x1a2)]('--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.');const _0xbbc05a=readPositiveInteger(_0x23c52c[_0xd508d2(0x1be)]('limit',DEFAULT_LIMIT),'--limit');if(_0xbbc05a>MAX_LIMIT)throw CliErrors[_0xd508d2(0x1a2)](_0xd508d2(0x1c4)+MAX_LIMIT+'.');const _0x3536c5=_0x23c52c['str'](_0xd508d2(0x1aa))[_0xd508d2(0x1bf)]()[_0xd508d2(0x1ac)]()||undefined,_0x2ece7b=_0x23c52c[_0xd508d2(0x1a9)](_0xd508d2(0x1c1))['trim']()||undefined;return{'appCode':_0x23c52c[_0xd508d2(0x1b0)],'startTime':_0x4bf482,'endTime':_0x11afe3,..._0x45fe1b===undefined?{'sinceMinutes':readSinceMinutes(_0x23c52c)}:{},..._0x3536c5?{'level':_0x3536c5}:{},..._0x2ece7b?{'keyword':_0x2ece7b}:{},'limit':_0xbbc05a};}function readSinceMinutes(_0xcc12ba){const _0x51e461=a42_0x3f649b;return readPositiveInteger(_0xcc12ba['num'](_0x51e461(0x1a6),DEFAULT_SINCE_MINUTES),_0x51e461(0x1a8));}function readPositiveInteger(_0x176f38,_0x5ce923){const _0x4c9635=a42_0x3f649b;if(!Number[_0x4c9635(0x1af)](_0x176f38)||_0x176f38<=0x0)throw CliErrors[_0x4c9635(0x1a2)](_0x5ce923+_0x4c9635(0x1b4));return _0x176f38;}export const bffLogs={'service':a42_0x3f649b(0x1a1),'command':a42_0x3f649b(0x1a4),'description':a42_0x3f649b(0x1a5),'risk':a42_0x3f649b(0x1c0),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x3f649b(0x1a6),'type':a42_0x3f649b(0x19d),'description':a42_0x3f649b(0x1c3)+DEFAULT_SINCE_MINUTES+')'},{'name':'start-time','type':a42_0x3f649b(0x19d),'description':'Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds'},{'name':a42_0x3f649b(0x1ba),'type':a42_0x3f649b(0x19d),'description':a42_0x3f649b(0x1bc)},{'name':'level','type':a42_0x3f649b(0x1bb),'description':a42_0x3f649b(0x1bd),'enum':LOG_LEVELS},{'name':a42_0x3f649b(0x1c1),'type':a42_0x3f649b(0x1bb),'description':'Filter\x20formatted\x20log\x20lines\x20by\x20keyword'},{'name':'limit','type':a42_0x3f649b(0x19d),'description':a42_0x3f649b(0x1ae)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x93c784){resolveBffLogQuery(_0x93c784);},async 'execute'(_0x17a210){const _0x19c7cb=a42_0x3f649b,_0x542b9e=resolveBffLogQuery(_0x17a210),{sinceMinutes:_0x5f2d45,..._0x3482a2}=_0x542b9e,_0x7b64b8=await searchBffScriptLogs(_0x3482a2);return{'ok':!![],'data':{'query':_0x542b9e,'count':_0x7b64b8[_0x19c7cb(0x1c6)],'logs':_0x7b64b8},'message':_0x7b64b8[_0x19c7cb(0x1c6)]===0x0?_0x19c7cb(0x1c8):_0x19c7cb(0x1ab)+_0x7b64b8[_0x19c7cb(0x1c6)]+_0x19c7cb(0x1b9)};}};
@@ -1 +1 @@
1
- const a43_0x4777d1=a43_0x32a3;(function(_0x17923d,_0x488e53){const _0x30b70b=a43_0x32a3,_0x4d454c=_0x17923d();while(!![]){try{const _0x4bed42=parseInt(_0x30b70b(0x127))/0x1+-parseInt(_0x30b70b(0xf0))/0x2+-parseInt(_0x30b70b(0x107))/0x3+parseInt(_0x30b70b(0xfe))/0x4*(parseInt(_0x30b70b(0xc0))/0x5)+-parseInt(_0x30b70b(0x10e))/0x6*(parseInt(_0x30b70b(0x11c))/0x7)+-parseInt(_0x30b70b(0xef))/0x8+parseInt(_0x30b70b(0xe5))/0x9*(parseInt(_0x30b70b(0xbf))/0xa);if(_0x4bed42===_0x488e53)break;else _0x4d454c['push'](_0x4d454c['shift']());}catch(_0x5dca5e){_0x4d454c['push'](_0x4d454c['shift']());}}}(a43_0x49c5,0xdf57e));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':'bff','command':'pull','description':a43_0x4777d1(0xf3),'risk':a43_0x4777d1(0x120),'structuredErrors':!![],'flags':[{'name':'type','type':'string','description':'Pull\x20only\x20this\x20script\x20type','enum':[a43_0x4777d1(0x13d),a43_0x4777d1(0xe3),a43_0x4777d1(0xda)]},{'name':a43_0x4777d1(0xe9),'type':'boolean','description':a43_0x4777d1(0xe2)}],async 'dryRun'(_0x75cfe0){const _0xde9dcd=a43_0x4777d1,_0x5e1e61=loadBffProjectConfig(_0x75cfe0[_0xde9dcd(0x104)]),_0x1fd2e0=await readBffLockFile(_0x5e1e61['lockFilePath']),{appLock:_0x420714}=ensureLockScope(_0x1fd2e0??createEmptyBffLock(),_0x75cfe0[_0xde9dcd(0x104)],_0x5e1e61[_0xde9dcd(0xd7)],_0xde9dcd(0x123)),_0x4b5abf=normalizeBffType(_0x75cfe0['str'](_0xde9dcd(0xd6)))??undefined,[_0x2c3b6c,_0xd5fb5c]=await Promise[_0xde9dcd(0xb1)]([listBffScripts(_0x75cfe0[_0xde9dcd(0x104)],_0x4b5abf),getBffScriptStatistics(_0x75cfe0['appCode'])]),_0x4139af=_0x2c3b6c[_0xde9dcd(0x12d)](_0x69daec=>normalizeBffType(_0x69daec[_0xde9dcd(0x10d)])===_0xde9dcd(0xda)),_0x4003db=_0x4139af?buildDatasetCodeToAliasMap(_0x75cfe0[_0xde9dcd(0xd5)],_0x75cfe0[_0xde9dcd(0x104)],_0x75cfe0['selectedAppName']||_0x75cfe0[_0xde9dcd(0x126)]?.[_0xde9dcd(0x10a)]||_0x75cfe0[_0xde9dcd(0x126)]?.['defaultApp']):new Map(),_0x441f22=_0x4139af?await planHookDirectoryMigration(_0x5e1e61,_0x420714,_0x4003db,await scanLocalBffFunctions(_0x5e1e61,_0xde9dcd(0xda))):undefined,_0x34c409=createHookLocationMap(_0xd5fb5c),_0x1bc228=[];for(const _0x49b2a6 of _0x2c3b6c){const _0x24c2eb=resolveRemoteScriptTarget(_0x5e1e61,_0x49b2a6,_0x34c409,_0x441f22?.[_0xde9dcd(0xdd)]??_0x420714[_0xde9dcd(0xba)],_0x4003db);if(!_0x24c2eb){_0x1bc228[_0xde9dcd(0x132)]({'scriptType':_0x49b2a6[_0xde9dcd(0x10d)],'functionName':_0x49b2a6[_0xde9dcd(0x116)]??'','status':_0xde9dcd(0xf8),'reason':'unresolvable\x20target\x20path'});continue;}const _0x210849=(_0x441f22?.[_0xde9dcd(0xdd)]??_0x420714[_0xde9dcd(0xba)])[_0x24c2eb['lockKey']],_0x1abbe9=_0x49b2a6[_0xde9dcd(0xdc)]!=null?computeContentHash(_0x49b2a6[_0xde9dcd(0xdc)]):undefined,_0x204341=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x441f22,_0x24c2eb)??_0x24c2eb['filePath'],_0x210849,_0x1abbe9),_0x58eca4=_0x204341?localUnsyncedConflict(_0x24c2eb,_0x49b2a6['id']):undefined;_0x1bc228[_0xde9dcd(0x132)]({'lockKey':_0x24c2eb['lockKey'],'filePath':_0x24c2eb['filePath'],'remoteId':_0x49b2a6['id']??null,'status':_0x58eca4?_0xde9dcd(0xd1):_0xde9dcd(0xc2),..._0x58eca4?{'conflict':_0x58eca4}:{},..._0x24c2eb[_0xde9dcd(0xc4)]?{'alias':_0x24c2eb['hookLocation'][_0xde9dcd(0x105)]??null,'datasetCode':_0x24c2eb['hookLocation'][_0xde9dcd(0x13b)],'operationType':_0x24c2eb[_0xde9dcd(0xc4)][_0xde9dcd(0x10f)],'functionNode':_0x24c2eb['hookLocation'][_0xde9dcd(0xaf)]}:{}});}return{'method':_0xde9dcd(0xca),'url':_0xde9dcd(0xc5)+_0x75cfe0['appCode']+(_0x4b5abf?'&type='+_0x4b5abf:'')+_0xde9dcd(0xf9)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x75cfe0['appCode'],'filterType':_0x4b5abf??null,..._0x441f22&&_0x441f22['migrations'][_0xde9dcd(0x129)]>0x0?{'hookDirectoryMigrations':_0x441f22[_0xde9dcd(0xd9)]['map'](_0x400485=>({'from':_0x400485['oldDirectory'],'to':_0x400485[_0xde9dcd(0x113)]}))}:{},'files':_0x1bc228},'description':'Would\x20inspect\x20'+_0x1bc228['length']+_0xde9dcd(0xc9)};},async 'execute'(_0x38ebe4){const _0x3b86da=a43_0x4777d1,_0x565610=loadBffProjectConfig(_0x38ebe4[_0x3b86da(0x104)]),_0x593c22=await readBffLockFile(_0x565610['lockFilePath']),{lockData:_0x33599b,appLock:_0x33d249}=ensureLockScope(_0x593c22??createEmptyBffLock(),_0x38ebe4[_0x3b86da(0x104)],_0x565610[_0x3b86da(0xd7)],_0x3b86da(0x123)),_0x37bbda=normalizeBffType(_0x38ebe4[_0x3b86da(0xfc)]('type'))??undefined;if(_0x38ebe4[_0x3b86da(0xfc)](_0x3b86da(0xd6))&&!_0x37bbda)throw CliErrors[_0x3b86da(0x109)]('--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.');const [_0x26b425,_0x27a08f]=await Promise[_0x3b86da(0xb1)]([listBffScripts(_0x38ebe4['appCode'],_0x37bbda),getBffScriptStatistics(_0x38ebe4[_0x3b86da(0x104)])]);if(_0x26b425[_0x3b86da(0x129)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x3b86da(0xb5)};const _0x589122=_0x38ebe4[_0x3b86da(0xff)](_0x3b86da(0xe9));if(_0x589122&&!_0x38ebe4[_0x3b86da(0x12f)]){const _0x34173c=await confirmForce();if(!_0x34173c)throw CliErrors['cancelled']('Force\x20pull\x20cancelled.');}if(_0x589122&&_0x38ebe4['nonInteractive']){}const _0x3cd40f=_0x26b425[_0x3b86da(0x12d)](_0x4a5c37=>normalizeBffType(_0x4a5c37[_0x3b86da(0x10d)])===_0x3b86da(0xda)),_0xbe672e=_0x3cd40f?buildDatasetCodeToAliasMap(_0x38ebe4['apiDir'],_0x38ebe4['appCode'],_0x38ebe4['selectedAppName']||_0x38ebe4[_0x3b86da(0x126)]?.['currentApp']||_0x38ebe4['mergedCli']?.[_0x3b86da(0x11a)]):new Map(),_0x3fecf2=createHookLocationMap(_0x27a08f),_0x5f4c86=JSON[_0x3b86da(0x135)](JSON[_0x3b86da(0x124)](_0x33599b)),_0x3736b6=_0x38ebe4['appCode'],_0x1f9edc=_0x5f4c86['apps'][_0x3736b6];if(!_0x1f9edc)throw new Error(_0x3b86da(0x101)+_0x3736b6+_0x3b86da(0x130));const _0x27634e=_0x3cd40f?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x565610,_0x1f9edc,_0xbe672e,await scanLocalBffFunctions(_0x565610,_0x3b86da(0xda))),_0x1f9edc):undefined,_0x1a5dfd=createPullFileTransaction(),_0x5a2090=[],_0x8fe907=[],_0x501c63=[],_0x582025=[];for(const _0x1bd40f of _0x26b425){const _0x3d6b3f=resolveRemoteScriptTarget(_0x565610,_0x1bd40f,_0x3fecf2,_0x1f9edc['functions'],_0xbe672e);if(!_0x3d6b3f){_0x8fe907[_0x3b86da(0x132)]({'lockKey':_0x1bd40f['scriptType']+'/'+_0x1bd40f[_0x3b86da(0x116)],'reason':_0x3b86da(0x138)});continue;}const _0x363e75=_0x1f9edc[_0x3b86da(0xba)][_0x3d6b3f[_0x3b86da(0xe0)]];try{if(!_0x1bd40f['id'])throw new Error(_0x3b86da(0x118));if(_0x1bd40f['scriptContent']==null)throw new Error(_0x3b86da(0xea));const _0x1672a9=_0x1bd40f['scriptContent'],_0x5c6881=computeContentHash(_0x1672a9);if(!_0x589122){const _0x64c043=await hasUnsyncedLocalChanges(_0x3d6b3f['filePath'],_0x363e75,_0x5c6881);if(_0x64c043){_0x501c63[_0x3b86da(0x132)](localUnsyncedConflict(_0x3d6b3f,_0x1bd40f['id']));continue;}}await _0x1a5dfd['write'](_0x3d6b3f[_0x3b86da(0xf1)],_0x1672a9);const _0x4c84e2={'hash':_0x5c6881,'remoteId':_0x1bd40f['id'],'version':_0x1bd40f['version']};_0x3d6b3f[_0x3b86da(0xd6)]===_0x3b86da(0xda)&&_0x3d6b3f['hookLocation']&&(_0x4c84e2[_0x3b86da(0x105)]=_0x3d6b3f['hookLocation'][_0x3b86da(0x105)],_0x4c84e2[_0x3b86da(0x13b)]=_0x3d6b3f[_0x3b86da(0xc4)]['datasetCode'],_0x4c84e2['operationType']=_0x3d6b3f['hookLocation'][_0x3b86da(0x10f)],_0x4c84e2[_0x3b86da(0xaf)]=_0x3d6b3f[_0x3b86da(0xc4)][_0x3b86da(0xaf)]),_0x1f9edc['functions'][_0x3d6b3f[_0x3b86da(0xe0)]]=_0x4c84e2,_0x5a2090[_0x3b86da(0x132)]({'lockKey':_0x3d6b3f[_0x3b86da(0xe0)],'remoteId':_0x1bd40f['id']});}catch(_0x26e91d){_0x582025['push']({'lockKey':_0x3d6b3f[_0x3b86da(0xe0)],'error':_0x26e91d instanceof Error?_0x26e91d[_0x3b86da(0xcd)]:String(_0x26e91d)});}}_0x1f9edc[_0x3b86da(0xfb)]=new Date()[_0x3b86da(0x13e)]();try{await writeBffLockFile(_0x565610[_0x3b86da(0xe4)],_0x5f4c86);}catch(_0x235274){const _0xce63c1=[...await _0x1a5dfd['rollback'](),...await _0x27634e?.['rollback']()??[]];throw withRollbackErrors(_0x235274,_0x3b86da(0x13c),_0xce63c1);}return{'ok':_0x582025[_0x3b86da(0x129)]===0x0,'data':{'pulled':_0x5a2090,'skipped':_0x8fe907,'conflicts':_0x501c63,'failed':_0x582025},'message':formatPullMessage(_0x5a2090[_0x3b86da(0x129)],_0x8fe907[_0x3b86da(0x129)],_0x501c63[_0x3b86da(0x129)],_0x582025[_0x3b86da(0x129)])};}};function localUnsyncedConflict(_0x1795a0,_0xe50fa3){const _0x4119a0=a43_0x4777d1,_0x1b8354=_0x1795a0[_0x4119a0(0xe0)]['split']('/')['at'](-0x1);return{'code':_0x4119a0(0xfd),'lockKey':_0x1795a0[_0x4119a0(0xe0)],'filePath':_0x1795a0[_0x4119a0(0xf1)],..._0xe50fa3!=null?{'remoteId':_0xe50fa3}:{},'message':_0x4119a0(0xf4),'nextAction':{'action':_0x4119a0(0x10b),'command':CLI_BIN_NAME+_0x4119a0(0x102)+_0x1795a0[_0x4119a0(0xd6)]+_0x4119a0(0x136)+_0x1b8354+_0x4119a0(0x112),'requiresReview':!![],'message':_0x4119a0(0xcc)}};}function a43_0x49c5(){const _0x12ac61=['type','scriptsRoot','remoteId','migrations','HOOK','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','scriptContent','projectedFunctions','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','requires','lockKey','\x22\x20from\x20the\x20lock\x20file.','Force\x20overwrite\x20local\x20unsynced\x20changes','ENDPOINT','lockFilePath','27162YYvAxH','entries','oldDirectoryPath','oldDirectory','force','Remote\x20script\x20missing\x20content.','NFC','ino','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','scriptsRootDir','146952LDQBbU','3455594WlJlTY','filePath','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','\x20resolution','toLowerCase','join','skipped','&currentPage=1&pageSize=','move','lastSync','str','BFF_LOCAL_UNSYNCED','142280jNJqkG','bool','rekey','Lock\x20scope\x20for\x20app\x20\x22','\x20bff\x20push\x20--type\x20','hash','appCode','alias','question','356715wKKlEs','profileName','validation','currentApp','push_local','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','scriptType','6yLwsmP','operationType','trim','\x22;\x20temporary\x20directory\x20\x22','\x20--format\x20compress','newDirectory','\x22:\x20its\x20target\x20\x22','.js','functionName','newDirectoryPath','Remote\x20script\x20missing\x20id.','existed','defaultApp','case-rename','12316017GGywbW','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','newLockKey','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','read','reverse','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','pull','stringify','\x20pulled','mergedCli','1793582VakIvE','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','length','stderr','get','includes','some','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','nonInteractive','\x22\x20not\x20found\x20after\x20ensureLockScope.','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','push','stdin','\x20skipped','parse','\x20--name\x20','delete','unresolvable\x20target\x20path','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','oldLockKey','datasetCode','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','COMMON','toISOString','keyChanges','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','functionNode','Failed\x20to\x20write\x20local\x20script\x20\x22','all','has','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','map','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','\x22\x20from\x20\x22','\x20conflict','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','flatMap','functions','normalize','set','\x22:\x20both\x20target\x20\x22','\x22:\x20','8980BpToOb','5gWjZal','HOOK/','would_pull','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','hookLocation','/api/management/library/scripts/list?appCode=','Pull\x20complete:\x20','\x22\x20and\x20\x22','ENOENT','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','GET','mode','If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.','message','\x20Recovery\x20errors:\x20','entry','code','conflict','\x22\x20to\x20\x22','split','values','apiDir'];a43_0x49c5=function(){return _0x12ac61;};return a43_0x49c5();}function formatPullMessage(_0x1123e3,_0x4b22c9,_0x5acb28,_0x274b4f){const _0x130ec9=a43_0x4777d1,_0x2baa75=[_0x130ec9(0xc6)+_0x1123e3+_0x130ec9(0x125),_0x4b22c9+_0x130ec9(0x134)];_0x5acb28>0x0&&_0x2baa75['push'](_0x5acb28+_0x130ec9(0xb7)+(_0x5acb28===0x1?'':'s')+'\x20'+(_0x5acb28===0x1?_0x130ec9(0xdf):'require')+_0x130ec9(0xf5));if(_0x274b4f>0x0)_0x2baa75['push'](_0x274b4f+'\x20failed');return _0x2baa75['join'](',\x20');}async function hasUnsyncedLocalChanges(_0x539313,_0x1fb6c9,_0xf3cad7){const _0x2f70b0=a43_0x4777d1;if(!await fileExists(_0x539313))return![];const _0x1e1249=await computeFileHash(_0x539313);if(!_0x1fb6c9)return _0xf3cad7?_0x1e1249!==_0xf3cad7:!![];return _0x1e1249!==_0x1fb6c9[_0x2f70b0(0x103)];}function createPullFileTransaction(){const _0x3df5f5=new Map(),_0x24d3e7=async(_0x1e5680,_0x587a3d)=>{const _0x59ab5b=a43_0x32a3;try{if(_0x587a3d[_0x59ab5b(0x119)])await ensureParentDirectory(_0x1e5680),await writeFile(_0x1e5680,_0x587a3d['content']);else try{await unlink(_0x1e5680);}catch(_0x30fa46){if(_0x30fa46[_0x59ab5b(0xd0)]!==_0x59ab5b(0xc8))throw _0x30fa46;}return undefined;}catch(_0x3882e1){return _0x3882e1 instanceof Error?_0x3882e1:new Error(String(_0x3882e1));}};return{async 'write'(_0x2e0c1e,_0x4c9dc9){const _0x2c2f80=a43_0x32a3;if(!_0x3df5f5[_0x2c2f80(0xb2)](_0x2e0c1e))try{_0x3df5f5['set'](_0x2e0c1e,{'existed':!![],'content':await readFile(_0x2e0c1e)});}catch(_0x38d412){if(_0x38d412[_0x2c2f80(0xd0)]!=='ENOENT')throw _0x38d412;_0x3df5f5[_0x2c2f80(0xbc)](_0x2e0c1e,{'existed':![]});}try{await ensureParentDirectory(_0x2e0c1e),await writeFile(_0x2e0c1e,_0x4c9dc9,'utf8');}catch(_0x2f61cf){const _0x36aaa3=await _0x24d3e7(_0x2e0c1e,_0x3df5f5[_0x2c2f80(0x12b)](_0x2e0c1e));if(!_0x36aaa3)_0x3df5f5[_0x2c2f80(0x137)](_0x2e0c1e);throw withRollbackErrors(_0x2f61cf,_0x2c2f80(0xb0)+_0x2e0c1e+'\x22.',_0x36aaa3?[_0x36aaa3]:[]);}},async 'rollback'(){const _0x36044a=a43_0x32a3,_0xacab0b=[];for(const [_0x23adc2,_0x29ee41]of[..._0x3df5f5[_0x36044a(0xe6)]()]['reverse']()){const _0xacf132=await _0x24d3e7(_0x23adc2,_0x29ee41);_0xacf132&&_0xacab0b['push'](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x23adc2+'\x22:\x20'+_0xacf132['message']));}return _0xacab0b;}};}function withRollbackErrors(_0x304658,_0x10cf0d,_0x3444cb){const _0x3e41d1=a43_0x4777d1,_0x223474=_0x304658 instanceof Error?_0x304658:new Error(String(_0x304658));if(_0x3444cb['length']===0x0)return _0x223474;return new AggregateError([_0x223474,..._0x3444cb],_0x10cf0d+_0x3e41d1(0xce)+_0x3444cb['map'](_0x1bc42c=>_0x1bc42c['message'])[_0x3e41d1(0xf7)](';\x20'));}function a43_0x32a3(_0x1a72ba,_0xa513ec){_0x1a72ba=_0x1a72ba-0xad;const _0x49c5a0=a43_0x49c5();let _0x32a309=_0x49c5a0[_0x1a72ba];return _0x32a309;}function buildDatasetCodeToAliasMap(_0x395d19,_0x509105,_0x3d12d6){const _0x3777c7=a43_0x4777d1,_0xca9ebe=resolveApiModelSource(_0x395d19,_0x509105,_0x3d12d6),_0x3e4086=loadAliasMap(_0x395d19,undefined,_0xca9ebe[_0x3777c7(0xf1)],_0xca9ebe[_0x3777c7(0x108)]);return assertUnambiguousHookAliases(_0x3e4086),new Map(_0x3e4086['map'](_0x233934=>[_0x233934[_0x3777c7(0x13b)]['toLowerCase'](),_0x233934[_0x3777c7(0x105)]]));}async function planHookDirectoryMigration(_0x18e9d0,_0xd2b654,_0x47d028,_0x42f594){const _0x4be73d=a43_0x4777d1,_0x36dfad=new Map();for(const [_0x1b57fb,_0x29052b]of Object[_0x4be73d(0xe6)](_0xd2b654['functions'])){const [_0x3089cf,_0x155094,_0x101048,_0x54eaa0,_0x50108e,..._0x2429bf]=_0x1b57fb[_0x4be73d(0xd3)]('/');if(_0x3089cf!==_0x4be73d(0xda)||!_0x155094||!_0x101048||!_0x54eaa0||!_0x50108e||_0x2429bf[_0x4be73d(0x129)]>0x0||!_0x29052b[_0x4be73d(0x13b)])continue;const _0x29cd4b=_0x47d028[_0x4be73d(0x12b)](_0x29052b['datasetCode'][_0x4be73d(0xf6)]()),_0x27a018=_0x29cd4b??_0x29052b[_0x4be73d(0x13b)];if(!isSafeHookDirectorySegment(_0x155094))throw CliErrors['validation'](_0x4be73d(0x131)+_0x155094+_0x4be73d(0xe1));if(!isSafeHookDirectorySegment(_0x27a018))throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xb3)+_0x155094+_0x4be73d(0xc3));if(_0x155094===_0x27a018)continue;const _0x29ab67=_0x36dfad['get'](_0x155094)??{'datasetCode':_0x29052b[_0x4be73d(0x13b)],'alias':_0x29cd4b,'keyChanges':[]};if(_0x29ab67[_0x4be73d(0x13b)]!==_0x29052b[_0x4be73d(0x13b)])throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xb3)+_0x155094+_0x4be73d(0xb8));const _0x5ace62=_0x4be73d(0xc1)+_0x27a018+'/'+_0x101048+'/'+_0x54eaa0+'/'+_0x50108e;try{resolveLocalFilePathFromLockKey(_0x18e9d0,_0x1b57fb),resolveLocalFilePathFromLockKey(_0x18e9d0,_0x5ace62);}catch(_0x1435a8){throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xf2)+_0x1b57fb+_0x4be73d(0xbe)+(_0x1435a8 instanceof Error?_0x1435a8[_0x4be73d(0xcd)]:String(_0x1435a8)));}_0x29ab67[_0x4be73d(0xad)][_0x4be73d(0x132)]({'oldLockKey':_0x1b57fb,'newLockKey':_0x5ace62,'entry':_0x29052b}),_0x36dfad[_0x4be73d(0xbc)](_0x155094,_0x29ab67);}const _0x130b7f=new Set([..._0x36dfad[_0x4be73d(0xd4)]()][_0x4be73d(0xb9)](_0x477ef1=>_0x477ef1['keyChanges']['map'](_0x2034bf=>_0x2034bf[_0x4be73d(0x13a)]))),_0x3128cc=new Map(),_0x971b33=new Map();for(const [_0x185a90,_0x364b1d]of _0x36dfad){const _0x77221=_0x364b1d[_0x4be73d(0x105)]??_0x364b1d[_0x4be73d(0x13b)],_0x5eb6d=hookDirectoryIdentity(_0x77221),_0x43cef8=_0x3128cc[_0x4be73d(0x12b)](_0x5eb6d);if(_0x43cef8&&_0x43cef8!==_0x185a90)throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0x11d)+_0x43cef8+_0x4be73d(0xc7)+_0x185a90+_0x4be73d(0xbd)+_0x77221+_0x4be73d(0xae));_0x3128cc[_0x4be73d(0xbc)](_0x5eb6d,_0x185a90);for(const _0x578ac2 of _0x364b1d[_0x4be73d(0xad)]){const _0x6d571=_0x971b33[_0x4be73d(0x12b)](_0x578ac2[_0x4be73d(0x11e)]);if(_0x6d571&&_0x6d571!==_0x578ac2[_0x4be73d(0x13a)])throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0x11f)+_0x6d571+_0x4be73d(0xc7)+_0x578ac2[_0x4be73d(0x13a)]+_0x4be73d(0xbd)+_0x578ac2[_0x4be73d(0x11e)]+_0x4be73d(0x122));if(_0x130b7f['has'](_0x578ac2['newLockKey']))throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xde)+_0x578ac2[_0x4be73d(0x13a)]+_0x4be73d(0x114)+_0x578ac2[_0x4be73d(0x11e)]+_0x4be73d(0x128));_0x971b33[_0x4be73d(0xbc)](_0x578ac2['newLockKey'],_0x578ac2['oldLockKey']);}}const _0x2b7af7=new Map();for(const [_0x298fee,_0x29a16b]of _0x47d028){_0x2b7af7[_0x4be73d(0xbc)](hookDirectoryIdentity(_0x29a16b),_0x298fee);}const _0x2c3f68=[];for(const [_0x1b4da5,_0x23ed68]of _0x36dfad){const _0x4c45d8=_0x23ed68[_0x4be73d(0x105)]??_0x23ed68[_0x4be73d(0x13b)],_0x33379e=join(_0x18e9d0[_0x4be73d(0xee)],_0x4be73d(0xda),_0x1b4da5),_0x56ebee=join(_0x18e9d0[_0x4be73d(0xee)],'HOOK',_0x4c45d8),_0x5ad2b3=await directoryExists(_0x33379e),_0x20d3c3=await directoryExists(_0x56ebee),_0x5e1607=_0x5ad2b3?_0x20d3c3?await sameDirectory(_0x33379e,_0x56ebee)?_0x4be73d(0x11b):undefined:_0x4be73d(0xfa):_0x4be73d(0x100);if(!_0x5e1607)throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xb3)+_0x1b4da5+'\x22\x20to\x20\x22'+_0x4c45d8+'\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.');const _0x40d649=_0x2b7af7[_0x4be73d(0x12b)](hookDirectoryIdentity(_0x1b4da5));if(_0x40d649&&_0x40d649!==_0x23ed68[_0x4be73d(0x13b)]['toLowerCase']()){const _0xe73089=new Set(_0x23ed68[_0x4be73d(0xad)][_0x4be73d(0xb4)](_0x116a1e=>_0x116a1e[_0x4be73d(0x13a)])),_0x1ef30c=_0x42f594['filter'](_0x14d645=>_0x14d645[_0x4be73d(0xd6)]==='HOOK'&&_0x14d645[_0x4be73d(0x105)]!=null&&hookDirectoryIdentity(_0x14d645[_0x4be73d(0x105)])===hookDirectoryIdentity(_0x1b4da5)&&!_0xe73089[_0x4be73d(0xb2)](_0x14d645[_0x4be73d(0xe0)]));if(_0x1ef30c[_0x4be73d(0x129)]>0x0)throw CliErrors['validation'](_0x4be73d(0xb3)+_0x1b4da5+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x49079d=_0x2b7af7['get'](hookDirectoryIdentity(_0x4c45d8));if(_0x49079d&&_0x49079d!==_0x23ed68['datasetCode'][_0x4be73d(0xf6)]())throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xb3)+_0x1b4da5+'\x22\x20to\x20\x22'+_0x4c45d8+_0x4be73d(0xdb));for(const _0x4dc7ac of _0x23ed68['keyChanges']){const _0x342486=_0xd2b654[_0x4be73d(0xba)][_0x4dc7ac['newLockKey']];if(_0x342486&&!_0x130b7f[_0x4be73d(0xb2)](_0x4dc7ac[_0x4be73d(0x11e)])&&!sameHookIdentity(_0x4dc7ac[_0x4be73d(0xcf)],_0x342486))throw CliErrors[_0x4be73d(0x109)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x1b4da5+_0x4be73d(0xd2)+_0x4c45d8+_0x4be73d(0xed));}_0x2c3f68[_0x4be73d(0x132)]({'oldDirectory':_0x1b4da5,'newDirectory':_0x4c45d8,'oldDirectoryPath':_0x33379e,'newDirectoryPath':_0x56ebee,'mode':_0x5e1607,'alias':_0x23ed68[_0x4be73d(0x105)],'keyChanges':_0x23ed68['keyChanges']});}const _0x1bcef1={..._0xd2b654[_0x4be73d(0xba)]},_0x5d8e3d=new Map(),_0x1e1d75=new Map();for(const _0x382ba3 of _0x2c3f68){const _0xcccf2a=_0x382ba3[_0x4be73d(0xcb)]!==_0x4be73d(0x100);_0xcccf2a&&_0x1e1d75['set'](hookDirectoryIdentity(_0x382ba3[_0x4be73d(0x113)]),_0x382ba3[_0x4be73d(0xe7)]);for(const _0x17eb23 of _0x382ba3[_0x4be73d(0xad)]){const _0x343c15=_0x1bcef1[_0x17eb23[_0x4be73d(0x11e)]],_0x288f57=_0xcccf2a?_0x17eb23['entry']:_0x343c15??_0x17eb23[_0x4be73d(0xcf)];_0x1bcef1[_0x17eb23[_0x4be73d(0x11e)]]=canonicalizeHookEntry(_0x288f57,_0x382ba3[_0x4be73d(0x105)]),delete _0x1bcef1[_0x17eb23['oldLockKey']],_0xcccf2a&&_0x5d8e3d['set'](_0x17eb23[_0x4be73d(0x11e)],resolveLocalFilePathFromLockKey(_0x18e9d0,_0x17eb23[_0x4be73d(0x13a)]));}}return{'migrations':_0x2c3f68,'projectedFunctions':_0x1bcef1,'sourceFilePathByNewLockKey':_0x5d8e3d,'sourceDirectoryPathByNewDirectory':_0x1e1d75};}function resolveMigratedSourceFilePath(_0x2fc3f9,_0x345f38){const _0x2dd999=a43_0x4777d1;if(!_0x2fc3f9||!_0x345f38)return undefined;const _0x2ef5e1=_0x2fc3f9['sourceFilePathByNewLockKey'][_0x2dd999(0x12b)](_0x345f38[_0x2dd999(0xe0)]);if(_0x2ef5e1)return _0x2ef5e1;if(_0x345f38[_0x2dd999(0xd6)]!=='HOOK')return undefined;const [,_0x2cd456,..._0x5b439f]=_0x345f38[_0x2dd999(0xe0)][_0x2dd999(0xd3)]('/');if(!_0x2cd456||_0x5b439f[_0x2dd999(0x129)]===0x0)return undefined;const _0x356ef9=_0x2fc3f9['sourceDirectoryPathByNewDirectory']['get'](hookDirectoryIdentity(_0x2cd456));return _0x356ef9?join(_0x356ef9,..._0x5b439f)+_0x2dd999(0x115):undefined;}function sameHookIdentity(_0x45cf03,_0x51486b){const _0x15bfaf=a43_0x4777d1;return _0x45cf03[_0x15bfaf(0xd8)]===_0x51486b[_0x15bfaf(0xd8)]&&_0x45cf03[_0x15bfaf(0x13b)]===_0x51486b[_0x15bfaf(0x13b)]&&_0x45cf03[_0x15bfaf(0x10f)]===_0x51486b[_0x15bfaf(0x10f)]&&_0x45cf03[_0x15bfaf(0xaf)]===_0x51486b[_0x15bfaf(0xaf)];}function canonicalizeHookEntry(_0x541d15,_0x35b67b){const {alias:_0x830d62,..._0x4fc672}=_0x541d15;return _0x35b67b?{..._0x4fc672,'alias':_0x35b67b}:_0x4fc672;}function hookDirectoryIdentity(_0x3fe23e){const _0x6e2b38=a43_0x4777d1;return _0x3fe23e[_0x6e2b38(0xbb)](_0x6e2b38(0xeb))[_0x6e2b38(0xf6)]();}function isSafeHookDirectorySegment(_0x52ca2b){return isSafeLockKeySegment(_0x52ca2b);}async function sameDirectory(_0x530b5b,_0x3ca3ed){const _0x17b093=a43_0x4777d1,[_0x41a694,_0xd19d12]=await Promise[_0x17b093(0xb1)]([stat(_0x530b5b),stat(_0x3ca3ed)]);return _0x41a694['dev']===_0xd19d12['dev']&&_0x41a694[_0x17b093(0xec)]===_0xd19d12[_0x17b093(0xec)];}async function applyHookDirectoryMigration(_0x29957a,_0x1e5e64){const _0x69e87=a43_0x4777d1,_0x5df906=_0x1e5e64[_0x69e87(0xba)],_0x5719d1=_0x1e5e64['lastSync'],_0x1d06ad=[],_0x234d54=async()=>{const _0x14bd6b=_0x69e87,_0x214019=[];_0x1e5e64[_0x14bd6b(0xba)]=_0x5df906,_0x1e5e64[_0x14bd6b(0xfb)]=_0x5719d1;for(const {migration:_0x554c7e,temporaryPath:_0x4b352a}of[..._0x1d06ad][_0x14bd6b(0x121)]()){try{_0x4b352a?(await rename(_0x554c7e['newDirectoryPath'],_0x4b352a),await rename(_0x4b352a,_0x554c7e['oldDirectoryPath'])):await rename(_0x554c7e[_0x14bd6b(0x117)],_0x554c7e[_0x14bd6b(0xe7)]);}catch(_0x19d130){_0x214019['push'](new Error(_0x14bd6b(0x10c)+_0x554c7e['oldDirectory']+_0x14bd6b(0xb6)+_0x554c7e['newDirectory']+_0x14bd6b(0xbe)+(_0x19d130 instanceof Error?_0x19d130['message']:String(_0x19d130))));}}return _0x214019;};try{for(const _0x40cf2b of _0x29957a['migrations']){if(_0x40cf2b[_0x69e87(0xcb)]===_0x69e87(0xfa))await ensureParentDirectory(_0x40cf2b[_0x69e87(0x117)]),await rename(_0x40cf2b[_0x69e87(0xe7)],_0x40cf2b['newDirectoryPath']),_0x1d06ad[_0x69e87(0x132)]({'migration':_0x40cf2b});else{if(_0x40cf2b[_0x69e87(0xcb)]===_0x69e87(0x11b)){const _0x36cec6=join(dirname(_0x40cf2b[_0x69e87(0xe7)]),'.hook-directory-migrate-'+randomUUID());await rename(_0x40cf2b['oldDirectoryPath'],_0x36cec6);try{await rename(_0x36cec6,_0x40cf2b[_0x69e87(0x117)]);}catch(_0x50e7fa){try{await rename(_0x36cec6,_0x40cf2b[_0x69e87(0xe7)]);}catch(_0x4c48b3){throw withRollbackErrors(_0x50e7fa,'Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22'+_0x40cf2b[_0x69e87(0xe8)]+_0x69e87(0xd2)+_0x40cf2b['newDirectory']+_0x69e87(0x111)+_0x36cec6+'\x22\x20may\x20remain.',[new Error(_0x69e87(0x12e)+_0x36cec6+_0x69e87(0xd2)+_0x40cf2b[_0x69e87(0xe8)]+_0x69e87(0xbe)+(_0x4c48b3 instanceof Error?_0x4c48b3[_0x69e87(0xcd)]:String(_0x4c48b3)))]);}throw _0x50e7fa;}_0x1d06ad['push']({'migration':_0x40cf2b,'temporaryPath':_0x36cec6});}}}return _0x1e5e64['functions']=_0x29957a['projectedFunctions'],{'rollback':_0x234d54};}catch(_0x1ce04e){const _0x1c0c47=await _0x234d54();throw withRollbackErrors(_0x1ce04e,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x1c0c47);}}async function confirmForce(){const _0x27b250=a43_0x4777d1,_0x441fec=createInterface({'input':process[_0x27b250(0x133)],'output':process[_0x27b250(0x12a)]}),_0x3e91eb=await new Promise(_0x2f2e71=>{const _0x4cd171=_0x27b250;_0x441fec[_0x4cd171(0x106)](_0x4cd171(0x139),_0x2f2e71);});return _0x441fec['close'](),['y','yes'][_0x27b250(0x12c)](_0x3e91eb[_0x27b250(0x110)]()['toLowerCase']());}
1
+ const a43_0x15d1eb=a43_0x25d6;(function(_0x4a6172,_0x4efe1c){const _0xbc6226=a43_0x25d6,_0x6b1862=_0x4a6172();while(!![]){try{const _0x1fb7cd=-parseInt(_0xbc6226(0x8c))/0x1+parseInt(_0xbc6226(0xa4))/0x2+parseInt(_0xbc6226(0xbf))/0x3+-parseInt(_0xbc6226(0x96))/0x4*(parseInt(_0xbc6226(0xc4))/0x5)+-parseInt(_0xbc6226(0x8a))/0x6+parseInt(_0xbc6226(0x108))/0x7*(-parseInt(_0xbc6226(0xb5))/0x8)+parseInt(_0xbc6226(0xdc))/0x9;if(_0x1fb7cd===_0x4efe1c)break;else _0x6b1862['push'](_0x6b1862['shift']());}catch(_0x2994d0){_0x6b1862['push'](_0x6b1862['shift']());}}}(a43_0x3b53,0xd6e45));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';function a43_0x3b53(){const _0x56a01b=['conflict','\x22\x20from\x20the\x20lock\x20file.','/api/management/library/scripts/list?appCode=','Force\x20overwrite\x20local\x20unsynced\x20changes','Remote\x20script\x20missing\x20id.','set','mergedCli','Lock\x20scope\x20for\x20app\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','2639232UyLTvQ','string','801516FtwhMl','newLockKey','require','toLowerCase','rollback','&currentPage=1&pageSize=','lockFilePath','Could\x20not\x20restore\x20local\x20script\x20\x22','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','oldDirectoryPath','1316FEHNzE','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','\x20skipped','scriptsRoot','cancelled','oldLockKey','utf8','content','HOOK/','oldDirectory','.hook-directory-migrate-','map','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','functionNode','2505890FYpkIT','write','lastSync','\x22:\x20','validation','unresolvable\x20target\x20path','currentApp','hash','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','\x22\x20from\x20\x22','hookLocation','newDirectory','existed','HOOK','defaultApp','all','24aWKWPG','filter','\x20pulled','Pull\x20complete:\x20','split','stdin','Remote\x20script\x20missing\x20content.','\x20--format\x20compress','sourceFilePathByNewLockKey','entry','1400544JTccrQ','code','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','18185vPZgKN','join','requires','NFC','mode','bool','bff','rekey','remoteId','\x22\x20may\x20remain.','pull','functions','toISOString','COMMON','appCode','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','newDirectoryPath','has','ino','push_local','keyChanges','move','close','ENDPOINT','26664372PquotQ','alias','\x22:\x20its\x20target\x20\x22','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','get','reverse','\x22\x20and\x20\x22','&type=','message','\x22\x20to\x20\x22','apiDir','Failed\x20to\x20write\x20local\x20script\x20\x22','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','length','\x20failed','sourceDirectoryPathByNewDirectory','question','functionName','\x20resolution','GET','\x20conflict','datasetCode','projectedFunctions','delete','If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.','Would\x20inspect\x20','filePath','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','operationType','stringify','scriptsRootDir','push','entries','yes','ENOENT','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','some','read','type','nonInteractive','force','\x20bff\x20push\x20--type\x20','includes','3183467AsyJii','flatMap','scriptType','\x22\x20not\x20found\x20after\x20ensureLockScope.','lockKey','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','parse','selectedAppName','migrations','str','\x22:\x20both\x20target\x20\x22','scriptContent','case-rename','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','stderr','apps','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','would_pull','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','dev'];a43_0x3b53=function(){return _0x56a01b;};return a43_0x3b53();}import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';function a43_0x25d6(_0x4de7f8,_0x13a8d0){_0x4de7f8=_0x4de7f8-0x83;const _0x3b53f2=a43_0x3b53();let _0x25d63e=_0x3b53f2[_0x4de7f8];return _0x25d63e;}import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0x15d1eb(0xca),'command':a43_0x15d1eb(0xce),'description':a43_0x15d1eb(0x89),'risk':a43_0x15d1eb(0x102),'structuredErrors':!![],'flags':[{'name':a43_0x15d1eb(0x103),'type':a43_0x15d1eb(0x8b),'description':'Pull\x20only\x20this\x20script\x20type','enum':[a43_0x15d1eb(0xd1),a43_0x15d1eb(0xdb),a43_0x15d1eb(0xb2)]},{'name':'force','type':'boolean','description':a43_0x15d1eb(0x84)}],async 'dryRun'(_0x4815f8){const _0x7dc967=a43_0x15d1eb,_0x4d6a85=loadBffProjectConfig(_0x4815f8['appCode']),_0x34138e=await readBffLockFile(_0x4d6a85[_0x7dc967(0x92)]),{appLock:_0x242ec1}=ensureLockScope(_0x34138e??createEmptyBffLock(),_0x4815f8[_0x7dc967(0xd2)],_0x4d6a85[_0x7dc967(0x99)],_0x7dc967(0xce)),_0x1ed462=normalizeBffType(_0x4815f8[_0x7dc967(0x111)](_0x7dc967(0x103)))??undefined,[_0x5259c2,_0x378421]=await Promise[_0x7dc967(0xb4)]([listBffScripts(_0x4815f8[_0x7dc967(0xd2)],_0x1ed462),getBffScriptStatistics(_0x4815f8[_0x7dc967(0xd2)])]),_0xd3e1ec=_0x5259c2[_0x7dc967(0x101)](_0x2bb431=>normalizeBffType(_0x2bb431[_0x7dc967(0x10a)])===_0x7dc967(0xb2)),_0x22b051=_0xd3e1ec?buildDatasetCodeToAliasMap(_0x4815f8[_0x7dc967(0xe6)],_0x4815f8['appCode'],_0x4815f8[_0x7dc967(0x10f)]||_0x4815f8['mergedCli']?.[_0x7dc967(0xaa)]||_0x4815f8['mergedCli']?.[_0x7dc967(0xb3)]):new Map(),_0x1ad380=_0xd3e1ec?await planHookDirectoryMigration(_0x4d6a85,_0x242ec1,_0x22b051,await scanLocalBffFunctions(_0x4d6a85,'HOOK')):undefined,_0x1bb6fb=createHookLocationMap(_0x378421),_0x59db8e=[];for(const _0x24fcfd of _0x5259c2){const _0x5df754=resolveRemoteScriptTarget(_0x4d6a85,_0x24fcfd,_0x1bb6fb,_0x1ad380?.[_0x7dc967(0xf2)]??_0x242ec1[_0x7dc967(0xcf)],_0x22b051);if(!_0x5df754){_0x59db8e['push']({'scriptType':_0x24fcfd[_0x7dc967(0x10a)],'functionName':_0x24fcfd['functionName']??'','status':'skipped','reason':'unresolvable\x20target\x20path'});continue;}const _0x5ee64f=(_0x1ad380?.[_0x7dc967(0xf2)]??_0x242ec1[_0x7dc967(0xcf)])[_0x5df754['lockKey']],_0x50757a=_0x24fcfd['scriptContent']!=null?computeContentHash(_0x24fcfd[_0x7dc967(0x113)]):undefined,_0xd71a17=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x1ad380,_0x5df754)??_0x5df754[_0x7dc967(0xf6)],_0x5ee64f,_0x50757a),_0x44eee5=_0xd71a17?localUnsyncedConflict(_0x5df754,_0x24fcfd['id']):undefined;_0x59db8e[_0x7dc967(0xfb)]({'lockKey':_0x5df754[_0x7dc967(0x10c)],'filePath':_0x5df754[_0x7dc967(0xf6)],'remoteId':_0x24fcfd['id']??null,'status':_0x44eee5?_0x7dc967(0x11d):_0x7dc967(0x11a),..._0x44eee5?{'conflict':_0x44eee5}:{},..._0x5df754['hookLocation']?{'alias':_0x5df754[_0x7dc967(0xaf)][_0x7dc967(0xdd)]??null,'datasetCode':_0x5df754[_0x7dc967(0xaf)]['datasetCode'],'operationType':_0x5df754[_0x7dc967(0xaf)][_0x7dc967(0xf8)],'functionNode':_0x5df754[_0x7dc967(0xaf)][_0x7dc967(0xa3)]}:{}});}return{'method':_0x7dc967(0xef),'url':_0x7dc967(0x83)+_0x4815f8[_0x7dc967(0xd2)]+(_0x1ed462?_0x7dc967(0xe3)+_0x1ed462:'')+_0x7dc967(0x91)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x4815f8[_0x7dc967(0xd2)],'filterType':_0x1ed462??null,..._0x1ad380&&_0x1ad380[_0x7dc967(0x110)][_0x7dc967(0xe9)]>0x0?{'hookDirectoryMigrations':_0x1ad380[_0x7dc967(0x110)][_0x7dc967(0xa1)](_0x5c361f=>({'from':_0x5c361f[_0x7dc967(0x9f)],'to':_0x5c361f[_0x7dc967(0xb0)]}))}:{},'files':_0x59db8e},'description':_0x7dc967(0xf5)+_0x59db8e[_0x7dc967(0xe9)]+_0x7dc967(0xad)};},async 'execute'(_0x4b65b7){const _0x45296e=a43_0x15d1eb,_0x1145b6=loadBffProjectConfig(_0x4b65b7[_0x45296e(0xd2)]),_0x390a44=await readBffLockFile(_0x1145b6[_0x45296e(0x92)]),{lockData:_0x38f8c3,appLock:_0x2d7676}=ensureLockScope(_0x390a44??createEmptyBffLock(),_0x4b65b7[_0x45296e(0xd2)],_0x1145b6['scriptsRoot'],_0x45296e(0xce)),_0x532f5d=normalizeBffType(_0x4b65b7[_0x45296e(0x111)](_0x45296e(0x103)))??undefined;if(_0x4b65b7[_0x45296e(0x111)](_0x45296e(0x103))&&!_0x532f5d)throw CliErrors[_0x45296e(0xa8)](_0x45296e(0x100));const [_0x1b5925,_0x245ba6]=await Promise['all']([listBffScripts(_0x4b65b7['appCode'],_0x532f5d),getBffScriptStatistics(_0x4b65b7['appCode'])]);if(_0x1b5925[_0x45296e(0xe9)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x45296e(0xf7)};const _0x1bf238=_0x4b65b7[_0x45296e(0xc9)](_0x45296e(0x105));if(_0x1bf238&&!_0x4b65b7[_0x45296e(0x104)]){const _0x12241b=await confirmForce();if(!_0x12241b)throw CliErrors[_0x45296e(0x9a)]('Force\x20pull\x20cancelled.');}if(_0x1bf238&&_0x4b65b7[_0x45296e(0x104)]){}const _0x4489e1=_0x1b5925[_0x45296e(0x101)](_0xa14946=>normalizeBffType(_0xa14946[_0x45296e(0x10a)])===_0x45296e(0xb2)),_0x20cedd=_0x4489e1?buildDatasetCodeToAliasMap(_0x4b65b7[_0x45296e(0xe6)],_0x4b65b7[_0x45296e(0xd2)],_0x4b65b7['selectedAppName']||_0x4b65b7[_0x45296e(0x87)]?.['currentApp']||_0x4b65b7[_0x45296e(0x87)]?.[_0x45296e(0xb3)]):new Map(),_0x3f31cc=createHookLocationMap(_0x245ba6),_0x2ec079=JSON[_0x45296e(0x10e)](JSON[_0x45296e(0xf9)](_0x38f8c3)),_0x1d4b25=_0x4b65b7['appCode'],_0x5129fc=_0x2ec079[_0x45296e(0x118)][_0x1d4b25];if(!_0x5129fc)throw new Error(_0x45296e(0x88)+_0x1d4b25+_0x45296e(0x10b));const _0x5e8b69=_0x4489e1?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x1145b6,_0x5129fc,_0x20cedd,await scanLocalBffFunctions(_0x1145b6,_0x45296e(0xb2))),_0x5129fc):undefined,_0x4890c3=createPullFileTransaction(),_0x45d29b=[],_0x354e2b=[],_0x3491c9=[],_0x453173=[];for(const _0x1ce597 of _0x1b5925){const _0x4fc4b6=resolveRemoteScriptTarget(_0x1145b6,_0x1ce597,_0x3f31cc,_0x5129fc['functions'],_0x20cedd);if(!_0x4fc4b6){_0x354e2b['push']({'lockKey':_0x1ce597[_0x45296e(0x10a)]+'/'+_0x1ce597[_0x45296e(0xed)],'reason':_0x45296e(0xa9)});continue;}const _0x54ce6a=_0x5129fc[_0x45296e(0xcf)][_0x4fc4b6[_0x45296e(0x10c)]];try{if(!_0x1ce597['id'])throw new Error(_0x45296e(0x85));if(_0x1ce597[_0x45296e(0x113)]==null)throw new Error(_0x45296e(0xbb));const _0x25d083=_0x1ce597[_0x45296e(0x113)],_0x3689f7=computeContentHash(_0x25d083);if(!_0x1bf238){const _0x5135aa=await hasUnsyncedLocalChanges(_0x4fc4b6[_0x45296e(0xf6)],_0x54ce6a,_0x3689f7);if(_0x5135aa){_0x3491c9['push'](localUnsyncedConflict(_0x4fc4b6,_0x1ce597['id']));continue;}}await _0x4890c3[_0x45296e(0xa5)](_0x4fc4b6[_0x45296e(0xf6)],_0x25d083);const _0x586d95={'hash':_0x3689f7,'remoteId':_0x1ce597['id'],'version':_0x1ce597['version']};_0x4fc4b6[_0x45296e(0x103)]==='HOOK'&&_0x4fc4b6[_0x45296e(0xaf)]&&(_0x586d95[_0x45296e(0xdd)]=_0x4fc4b6[_0x45296e(0xaf)]['alias'],_0x586d95[_0x45296e(0xf1)]=_0x4fc4b6[_0x45296e(0xaf)][_0x45296e(0xf1)],_0x586d95['operationType']=_0x4fc4b6[_0x45296e(0xaf)][_0x45296e(0xf8)],_0x586d95[_0x45296e(0xa3)]=_0x4fc4b6[_0x45296e(0xaf)][_0x45296e(0xa3)]),_0x5129fc[_0x45296e(0xcf)][_0x4fc4b6['lockKey']]=_0x586d95,_0x45d29b['push']({'lockKey':_0x4fc4b6[_0x45296e(0x10c)],'remoteId':_0x1ce597['id']});}catch(_0x2d971e){_0x453173[_0x45296e(0xfb)]({'lockKey':_0x4fc4b6[_0x45296e(0x10c)],'error':_0x2d971e instanceof Error?_0x2d971e[_0x45296e(0xe4)]:String(_0x2d971e)});}}_0x5129fc['lastSync']=new Date()[_0x45296e(0xd0)]();try{await writeBffLockFile(_0x1145b6[_0x45296e(0x92)],_0x2ec079);}catch(_0x53bee8){const _0x2a04a9=[...await _0x4890c3[_0x45296e(0x90)](),...await _0x5e8b69?.['rollback']()??[]];throw withRollbackErrors(_0x53bee8,_0x45296e(0x94),_0x2a04a9);}return{'ok':_0x453173[_0x45296e(0xe9)]===0x0,'data':{'pulled':_0x45d29b,'skipped':_0x354e2b,'conflicts':_0x3491c9,'failed':_0x453173},'message':formatPullMessage(_0x45d29b[_0x45296e(0xe9)],_0x354e2b[_0x45296e(0xe9)],_0x3491c9[_0x45296e(0xe9)],_0x453173['length'])};}};function localUnsyncedConflict(_0x1e5792,_0x1bf1d2){const _0xf54cc0=a43_0x15d1eb,_0x1aaae5=_0x1e5792['lockKey'][_0xf54cc0(0xb9)]('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x1e5792[_0xf54cc0(0x10c)],'filePath':_0x1e5792[_0xf54cc0(0xf6)],..._0x1bf1d2!=null?{'remoteId':_0x1bf1d2}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':_0xf54cc0(0xd7),'command':CLI_BIN_NAME+_0xf54cc0(0x106)+_0x1e5792[_0xf54cc0(0x103)]+'\x20--name\x20'+_0x1aaae5+_0xf54cc0(0xbc),'requiresReview':!![],'message':_0xf54cc0(0xf4)}};}function formatPullMessage(_0x37c4e6,_0x37ab82,_0x27734b,_0x1e37f){const _0xdeaf7=a43_0x15d1eb,_0x24dc8a=[_0xdeaf7(0xb8)+_0x37c4e6+_0xdeaf7(0xb7),_0x37ab82+_0xdeaf7(0x98)];_0x27734b>0x0&&_0x24dc8a['push'](_0x27734b+_0xdeaf7(0xf0)+(_0x27734b===0x1?'':'s')+'\x20'+(_0x27734b===0x1?_0xdeaf7(0xc6):_0xdeaf7(0x8e))+_0xdeaf7(0xee));if(_0x1e37f>0x0)_0x24dc8a['push'](_0x1e37f+_0xdeaf7(0xea));return _0x24dc8a[_0xdeaf7(0xc5)](',\x20');}async function hasUnsyncedLocalChanges(_0x2db74f,_0x2f9336,_0x4f0332){const _0x13f946=a43_0x15d1eb;if(!await fileExists(_0x2db74f))return![];const _0x529b15=await computeFileHash(_0x2db74f);if(!_0x2f9336)return _0x4f0332?_0x529b15!==_0x4f0332:!![];return _0x529b15!==_0x2f9336[_0x13f946(0xab)];}function createPullFileTransaction(){const _0x2ceb3e=new Map(),_0x2a4bae=async(_0x16d4d0,_0x173689)=>{const _0x3164e9=a43_0x25d6;try{if(_0x173689[_0x3164e9(0xb1)])await ensureParentDirectory(_0x16d4d0),await writeFile(_0x16d4d0,_0x173689[_0x3164e9(0x9d)]);else try{await unlink(_0x16d4d0);}catch(_0x4cceb6){if(_0x4cceb6[_0x3164e9(0xc0)]!==_0x3164e9(0xfe))throw _0x4cceb6;}return undefined;}catch(_0x206b13){return _0x206b13 instanceof Error?_0x206b13:new Error(String(_0x206b13));}};return{async 'write'(_0x1afddb,_0xfa4d14){const _0x47d790=a43_0x25d6;if(!_0x2ceb3e[_0x47d790(0xd5)](_0x1afddb))try{_0x2ceb3e[_0x47d790(0x86)](_0x1afddb,{'existed':!![],'content':await readFile(_0x1afddb)});}catch(_0x2366c7){if(_0x2366c7[_0x47d790(0xc0)]!==_0x47d790(0xfe))throw _0x2366c7;_0x2ceb3e[_0x47d790(0x86)](_0x1afddb,{'existed':![]});}try{await ensureParentDirectory(_0x1afddb),await writeFile(_0x1afddb,_0xfa4d14,_0x47d790(0x9c));}catch(_0x41e99f){const _0x4e02ce=await _0x2a4bae(_0x1afddb,_0x2ceb3e['get'](_0x1afddb));if(!_0x4e02ce)_0x2ceb3e[_0x47d790(0xf3)](_0x1afddb);throw withRollbackErrors(_0x41e99f,_0x47d790(0xe7)+_0x1afddb+'\x22.',_0x4e02ce?[_0x4e02ce]:[]);}},async 'rollback'(){const _0x324338=a43_0x25d6,_0x14f72f=[];for(const [_0x18f4cb,_0x4c2e7b]of[..._0x2ceb3e['entries']()]['reverse']()){const _0x4f4dce=await _0x2a4bae(_0x18f4cb,_0x4c2e7b);_0x4f4dce&&_0x14f72f['push'](new Error(_0x324338(0x93)+_0x18f4cb+'\x22:\x20'+_0x4f4dce[_0x324338(0xe4)]));}return _0x14f72f;}};}function withRollbackErrors(_0x125139,_0x2e3d2a,_0x576586){const _0x3fdbe1=a43_0x15d1eb,_0x154380=_0x125139 instanceof Error?_0x125139:new Error(String(_0x125139));if(_0x576586[_0x3fdbe1(0xe9)]===0x0)return _0x154380;return new AggregateError([_0x154380,..._0x576586],_0x2e3d2a+'\x20Recovery\x20errors:\x20'+_0x576586[_0x3fdbe1(0xa1)](_0x3c991b=>_0x3c991b[_0x3fdbe1(0xe4)])[_0x3fdbe1(0xc5)](';\x20'));}function buildDatasetCodeToAliasMap(_0x4f97a2,_0x38a4ef,_0xbff0aa){const _0x3e49d5=a43_0x15d1eb,_0x32122c=resolveApiModelSource(_0x4f97a2,_0x38a4ef,_0xbff0aa),_0x10c2ff=loadAliasMap(_0x4f97a2,undefined,_0x32122c[_0x3e49d5(0xf6)],_0x32122c['profileName']);return assertUnambiguousHookAliases(_0x10c2ff),new Map(_0x10c2ff['map'](_0x44312e=>[_0x44312e[_0x3e49d5(0xf1)][_0x3e49d5(0x8f)](),_0x44312e['alias']]));}async function planHookDirectoryMigration(_0x1b69fe,_0x3f84fe,_0x5f1e18,_0x43922f){const _0x10c65f=a43_0x15d1eb,_0x5d2a21=new Map();for(const [_0x448621,_0x3b9494]of Object[_0x10c65f(0xfc)](_0x3f84fe['functions'])){const [_0x41c108,_0x18279a,_0x2b3be0,_0x456248,_0x59a011,..._0xbace85]=_0x448621[_0x10c65f(0xb9)]('/');if(_0x41c108!==_0x10c65f(0xb2)||!_0x18279a||!_0x2b3be0||!_0x456248||!_0x59a011||_0xbace85['length']>0x0||!_0x3b9494[_0x10c65f(0xf1)])continue;const _0x4c0277=_0x5f1e18[_0x10c65f(0xe0)](_0x3b9494['datasetCode'][_0x10c65f(0x8f)]()),_0xd81679=_0x4c0277??_0x3b9494[_0x10c65f(0xf1)];if(!isSafeHookDirectorySegment(_0x18279a))throw CliErrors[_0x10c65f(0xa8)](_0x10c65f(0xdf)+_0x18279a+_0x10c65f(0x11e));if(!isSafeHookDirectorySegment(_0xd81679))throw CliErrors[_0x10c65f(0xa8)](_0x10c65f(0xff)+_0x18279a+_0x10c65f(0xc3));if(_0x18279a===_0xd81679)continue;const _0x15343b=_0x5d2a21[_0x10c65f(0xe0)](_0x18279a)??{'datasetCode':_0x3b9494[_0x10c65f(0xf1)],'alias':_0x4c0277,'keyChanges':[]};if(_0x15343b['datasetCode']!==_0x3b9494[_0x10c65f(0xf1)])throw CliErrors[_0x10c65f(0xa8)](_0x10c65f(0xff)+_0x18279a+'\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.');const _0x1cf846=_0x10c65f(0x9e)+_0xd81679+'/'+_0x2b3be0+'/'+_0x456248+'/'+_0x59a011;try{resolveLocalFilePathFromLockKey(_0x1b69fe,_0x448621),resolveLocalFilePathFromLockKey(_0x1b69fe,_0x1cf846);}catch(_0x2add80){throw CliErrors['validation'](_0x10c65f(0x116)+_0x448621+_0x10c65f(0xa7)+(_0x2add80 instanceof Error?_0x2add80['message']:String(_0x2add80)));}_0x15343b['keyChanges'][_0x10c65f(0xfb)]({'oldLockKey':_0x448621,'newLockKey':_0x1cf846,'entry':_0x3b9494}),_0x5d2a21['set'](_0x18279a,_0x15343b);}const _0x2402fb=new Set([..._0x5d2a21['values']()][_0x10c65f(0x109)](_0x3fbf31=>_0x3fbf31['keyChanges'][_0x10c65f(0xa1)](_0x198062=>_0x198062['oldLockKey']))),_0x539f59=new Map(),_0x47ea51=new Map();for(const [_0x1d1bdd,_0x4b43fe]of _0x5d2a21){const _0x5dfa04=_0x4b43fe[_0x10c65f(0xdd)]??_0x4b43fe[_0x10c65f(0xf1)],_0x21a734=hookDirectoryIdentity(_0x5dfa04),_0x3b5f6a=_0x539f59['get'](_0x21a734);if(_0x3b5f6a&&_0x3b5f6a!==_0x1d1bdd)throw CliErrors[_0x10c65f(0xa8)](_0x10c65f(0x119)+_0x3b5f6a+'\x22\x20and\x20\x22'+_0x1d1bdd+_0x10c65f(0x112)+_0x5dfa04+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x539f59[_0x10c65f(0x86)](_0x21a734,_0x1d1bdd);for(const _0x43c3d1 of _0x4b43fe[_0x10c65f(0xd8)]){const _0x56c44b=_0x47ea51[_0x10c65f(0xe0)](_0x43c3d1[_0x10c65f(0x8d)]);if(_0x56c44b&&_0x56c44b!==_0x43c3d1[_0x10c65f(0x9b)])throw CliErrors[_0x10c65f(0xa8)]('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x56c44b+_0x10c65f(0xe2)+_0x43c3d1['oldLockKey']+_0x10c65f(0x112)+_0x43c3d1['newLockKey']+_0x10c65f(0x10d));if(_0x2402fb[_0x10c65f(0xd5)](_0x43c3d1['newLockKey']))throw CliErrors[_0x10c65f(0xa8)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x43c3d1['oldLockKey']+_0x10c65f(0xde)+_0x43c3d1[_0x10c65f(0x8d)]+_0x10c65f(0xd3));_0x47ea51[_0x10c65f(0x86)](_0x43c3d1[_0x10c65f(0x8d)],_0x43c3d1[_0x10c65f(0x9b)]);}}const _0x2b24b4=new Map();for(const [_0x397a2f,_0x13b3b6]of _0x5f1e18){_0x2b24b4[_0x10c65f(0x86)](hookDirectoryIdentity(_0x13b3b6),_0x397a2f);}const _0x8333b0=[];for(const [_0x785ae8,_0x399b5e]of _0x5d2a21){const _0x544427=_0x399b5e['alias']??_0x399b5e[_0x10c65f(0xf1)],_0x14cd6f=join(_0x1b69fe[_0x10c65f(0xfa)],_0x10c65f(0xb2),_0x785ae8),_0x26e670=join(_0x1b69fe[_0x10c65f(0xfa)],_0x10c65f(0xb2),_0x544427),_0x1e3e87=await directoryExists(_0x14cd6f),_0x44fb5f=await directoryExists(_0x26e670),_0x591405=_0x1e3e87?_0x44fb5f?await sameDirectory(_0x14cd6f,_0x26e670)?'case-rename':undefined:_0x10c65f(0xd9):_0x10c65f(0xcb);if(!_0x591405)throw CliErrors[_0x10c65f(0xa8)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x785ae8+_0x10c65f(0xe5)+_0x544427+_0x10c65f(0xe8));const _0x290672=_0x2b24b4['get'](hookDirectoryIdentity(_0x785ae8));if(_0x290672&&_0x290672!==_0x399b5e[_0x10c65f(0xf1)][_0x10c65f(0x8f)]()){const _0x2427f6=new Set(_0x399b5e['keyChanges'][_0x10c65f(0xa1)](_0x15b899=>_0x15b899[_0x10c65f(0x9b)])),_0x40ffe3=_0x43922f[_0x10c65f(0xb6)](_0x4e578c=>_0x4e578c[_0x10c65f(0x103)]===_0x10c65f(0xb2)&&_0x4e578c[_0x10c65f(0xdd)]!=null&&hookDirectoryIdentity(_0x4e578c[_0x10c65f(0xdd)])===hookDirectoryIdentity(_0x785ae8)&&!_0x2427f6[_0x10c65f(0xd5)](_0x4e578c[_0x10c65f(0x10c)]));if(_0x40ffe3[_0x10c65f(0xe9)]>0x0)throw CliErrors[_0x10c65f(0xa8)](_0x10c65f(0xff)+_0x785ae8+_0x10c65f(0xc2));}const _0x43bee7=_0x2b24b4[_0x10c65f(0xe0)](hookDirectoryIdentity(_0x544427));if(_0x43bee7&&_0x43bee7!==_0x399b5e[_0x10c65f(0xf1)][_0x10c65f(0x8f)]())throw CliErrors['validation'](_0x10c65f(0xff)+_0x785ae8+'\x22\x20to\x20\x22'+_0x544427+'\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');for(const _0x214ac5 of _0x399b5e['keyChanges']){const _0x37acda=_0x3f84fe[_0x10c65f(0xcf)][_0x214ac5[_0x10c65f(0x8d)]];if(_0x37acda&&!_0x2402fb[_0x10c65f(0xd5)](_0x214ac5[_0x10c65f(0x8d)])&&!sameHookIdentity(_0x214ac5[_0x10c65f(0xbe)],_0x37acda))throw CliErrors[_0x10c65f(0xa8)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x785ae8+_0x10c65f(0xe5)+_0x544427+_0x10c65f(0x11b));}_0x8333b0['push']({'oldDirectory':_0x785ae8,'newDirectory':_0x544427,'oldDirectoryPath':_0x14cd6f,'newDirectoryPath':_0x26e670,'mode':_0x591405,'alias':_0x399b5e['alias'],'keyChanges':_0x399b5e[_0x10c65f(0xd8)]});}const _0x22bcca={..._0x3f84fe[_0x10c65f(0xcf)]},_0x56b970=new Map(),_0x49b451=new Map();for(const _0x4dc171 of _0x8333b0){const _0x2f93e5=_0x4dc171[_0x10c65f(0xc8)]!==_0x10c65f(0xcb);_0x2f93e5&&_0x49b451['set'](hookDirectoryIdentity(_0x4dc171[_0x10c65f(0xb0)]),_0x4dc171[_0x10c65f(0x95)]);for(const _0x55d754 of _0x4dc171[_0x10c65f(0xd8)]){const _0x33bf67=_0x22bcca[_0x55d754[_0x10c65f(0x8d)]],_0x4a2971=_0x2f93e5?_0x55d754[_0x10c65f(0xbe)]:_0x33bf67??_0x55d754[_0x10c65f(0xbe)];_0x22bcca[_0x55d754[_0x10c65f(0x8d)]]=canonicalizeHookEntry(_0x4a2971,_0x4dc171[_0x10c65f(0xdd)]),delete _0x22bcca[_0x55d754[_0x10c65f(0x9b)]],_0x2f93e5&&_0x56b970[_0x10c65f(0x86)](_0x55d754['newLockKey'],resolveLocalFilePathFromLockKey(_0x1b69fe,_0x55d754[_0x10c65f(0x9b)]));}}return{'migrations':_0x8333b0,'projectedFunctions':_0x22bcca,'sourceFilePathByNewLockKey':_0x56b970,'sourceDirectoryPathByNewDirectory':_0x49b451};}function resolveMigratedSourceFilePath(_0x5646c6,_0x50e8d6){const _0x44f365=a43_0x15d1eb;if(!_0x5646c6||!_0x50e8d6)return undefined;const _0x129789=_0x5646c6[_0x44f365(0xbd)][_0x44f365(0xe0)](_0x50e8d6[_0x44f365(0x10c)]);if(_0x129789)return _0x129789;if(_0x50e8d6[_0x44f365(0x103)]!==_0x44f365(0xb2))return undefined;const [,_0x55536b,..._0x258241]=_0x50e8d6[_0x44f365(0x10c)][_0x44f365(0xb9)]('/');if(!_0x55536b||_0x258241['length']===0x0)return undefined;const _0x15d452=_0x5646c6[_0x44f365(0xeb)][_0x44f365(0xe0)](hookDirectoryIdentity(_0x55536b));return _0x15d452?join(_0x15d452,..._0x258241)+'.js':undefined;}function sameHookIdentity(_0xd33040,_0x1bba77){const _0x2b4f6d=a43_0x15d1eb;return _0xd33040[_0x2b4f6d(0xcc)]===_0x1bba77[_0x2b4f6d(0xcc)]&&_0xd33040[_0x2b4f6d(0xf1)]===_0x1bba77[_0x2b4f6d(0xf1)]&&_0xd33040[_0x2b4f6d(0xf8)]===_0x1bba77[_0x2b4f6d(0xf8)]&&_0xd33040[_0x2b4f6d(0xa3)]===_0x1bba77[_0x2b4f6d(0xa3)];}function canonicalizeHookEntry(_0x5b475e,_0xea0700){const {alias:_0x44d77f,..._0x25ebac}=_0x5b475e;return _0xea0700?{..._0x25ebac,'alias':_0xea0700}:_0x25ebac;}function hookDirectoryIdentity(_0x4a02aa){const _0x41934a=a43_0x15d1eb;return _0x4a02aa['normalize'](_0x41934a(0xc7))[_0x41934a(0x8f)]();}function isSafeHookDirectorySegment(_0x2d9855){return isSafeLockKeySegment(_0x2d9855);}async function sameDirectory(_0x15b619,_0xd1ecf){const _0x2152c7=a43_0x15d1eb,[_0x2c6966,_0x1c91cd]=await Promise[_0x2152c7(0xb4)]([stat(_0x15b619),stat(_0xd1ecf)]);return _0x2c6966[_0x2152c7(0x11c)]===_0x1c91cd[_0x2152c7(0x11c)]&&_0x2c6966[_0x2152c7(0xd6)]===_0x1c91cd['ino'];}async function applyHookDirectoryMigration(_0x3677dd,_0x2c51d7){const _0x556347=a43_0x15d1eb,_0x17f430=_0x2c51d7[_0x556347(0xcf)],_0x17292d=_0x2c51d7[_0x556347(0xa6)],_0x46d88d=[],_0x482a63=async()=>{const _0x20d198=_0x556347,_0x48506f=[];_0x2c51d7[_0x20d198(0xcf)]=_0x17f430,_0x2c51d7[_0x20d198(0xa6)]=_0x17292d;for(const {migration:_0x68f1ba,temporaryPath:_0x847d86}of[..._0x46d88d][_0x20d198(0xe1)]()){try{_0x847d86?(await rename(_0x68f1ba[_0x20d198(0xd4)],_0x847d86),await rename(_0x847d86,_0x68f1ba[_0x20d198(0x95)])):await rename(_0x68f1ba[_0x20d198(0xd4)],_0x68f1ba[_0x20d198(0x95)]);}catch(_0x525dfd){_0x48506f['push'](new Error(_0x20d198(0xc1)+_0x68f1ba['oldDirectory']+_0x20d198(0xae)+_0x68f1ba['newDirectory']+_0x20d198(0xa7)+(_0x525dfd instanceof Error?_0x525dfd[_0x20d198(0xe4)]:String(_0x525dfd))));}}return _0x48506f;};try{for(const _0x55c77d of _0x3677dd[_0x556347(0x110)]){if(_0x55c77d['mode']===_0x556347(0xd9))await ensureParentDirectory(_0x55c77d['newDirectoryPath']),await rename(_0x55c77d[_0x556347(0x95)],_0x55c77d[_0x556347(0xd4)]),_0x46d88d['push']({'migration':_0x55c77d});else{if(_0x55c77d[_0x556347(0xc8)]===_0x556347(0x114)){const _0x54147c=join(dirname(_0x55c77d[_0x556347(0x95)]),_0x556347(0xa0)+randomUUID());await rename(_0x55c77d[_0x556347(0x95)],_0x54147c);try{await rename(_0x54147c,_0x55c77d[_0x556347(0xd4)]);}catch(_0x1c5d5f){try{await rename(_0x54147c,_0x55c77d[_0x556347(0x95)]);}catch(_0x2754a9){throw withRollbackErrors(_0x1c5d5f,_0x556347(0xa2)+_0x55c77d['oldDirectory']+_0x556347(0xe5)+_0x55c77d[_0x556347(0xb0)]+'\x22;\x20temporary\x20directory\x20\x22'+_0x54147c+_0x556347(0xcd),[new Error(_0x556347(0x97)+_0x54147c+_0x556347(0xe5)+_0x55c77d[_0x556347(0x9f)]+_0x556347(0xa7)+(_0x2754a9 instanceof Error?_0x2754a9[_0x556347(0xe4)]:String(_0x2754a9)))]);}throw _0x1c5d5f;}_0x46d88d[_0x556347(0xfb)]({'migration':_0x55c77d,'temporaryPath':_0x54147c});}}}return _0x2c51d7[_0x556347(0xcf)]=_0x3677dd[_0x556347(0xf2)],{'rollback':_0x482a63};}catch(_0x4f9d52){const _0x380dbb=await _0x482a63();throw withRollbackErrors(_0x4f9d52,_0x556347(0x115),_0x380dbb);}}async function confirmForce(){const _0x1f91d6=a43_0x15d1eb,_0x508fc4=createInterface({'input':process[_0x1f91d6(0xba)],'output':process[_0x1f91d6(0x117)]}),_0xcc4d0e=await new Promise(_0x269479=>{const _0x1ff9d3=_0x1f91d6;_0x508fc4[_0x1ff9d3(0xec)](_0x1ff9d3(0xac),_0x269479);});return _0x508fc4[_0x1f91d6(0xda)](),['y',_0x1f91d6(0xfd)][_0x1f91d6(0x107)](_0xcc4d0e['trim']()[_0x1f91d6(0x8f)]());}