@lovrabet/rabetbase-cli 2.5.10-beta.4 → 2.5.10-beta.5

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 (376) 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 +4 -4
  373. package/skills/rabetbase/SKILL.md +1 -1
  374. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  375. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  376. package/skills/rabetbase.manifest.json +3 -3
@@ -1 +1 @@
1
- const a34_0x17c8e4=a34_0x16d9;(function(_0x5886b3,_0x5529fa){const _0x2d1cd5=a34_0x16d9,_0x17a167=_0x5886b3();while(!![]){try{const _0x244589=parseInt(_0x2d1cd5(0x19d))/0x1+parseInt(_0x2d1cd5(0x1a0))/0x2*(parseInt(_0x2d1cd5(0x193))/0x3)+parseInt(_0x2d1cd5(0x194))/0x4*(-parseInt(_0x2d1cd5(0x18f))/0x5)+-parseInt(_0x2d1cd5(0x191))/0x6+-parseInt(_0x2d1cd5(0x195))/0x7+parseInt(_0x2d1cd5(0x1a2))/0x8*(parseInt(_0x2d1cd5(0x18a))/0x9)+parseInt(_0x2d1cd5(0x18d))/0xa*(parseInt(_0x2d1cd5(0x190))/0xb);if(_0x244589===_0x5529fa)break;else _0x17a167['push'](_0x17a167['shift']());}catch(_0x508698){_0x17a167['push'](_0x17a167['shift']());}}}(a34_0x5978,0x21a3f));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';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';const CREATE_PATH=a34_0x17c8e4(0x18b),UPDATE_PATH='/smartapi/app-config/update';export const appConfigSet={'service':a34_0x17c8e4(0x192),'command':'set','description':'Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','risk':a34_0x17c8e4(0x19b),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':'file','type':'string','description':a34_0x17c8e4(0x18e)}],async 'validate'(_0x2ed6f1){readKeyArg(_0x2ed6f1),readOptionalTags(_0x2ed6f1),assertSingleValueSource(_0x2ed6f1);},async 'dryRun'(_0x2bcab2){const _0x4bf666=a34_0x17c8e4,_0x219eb7=readKeyArg(_0x2bcab2),_0xaae06c=readOptionalTags(_0x2bcab2),_0x2d256b=assertSingleValueSource(_0x2bcab2);await assertValueSourceReadable(_0x2d256b);const _0x2a0b1b=await withAppConfigApiBoundary('get',{'appCode':_0x2bcab2[_0x4bf666(0x18c)],'key':_0x219eb7},()=>getAppConfigByKey(_0x2bcab2[_0x4bf666(0x18c)],_0x219eb7)),_0x37156d=_0x2a0b1b?_0x4bf666(0x198):_0x4bf666(0x19c),_0x39358e=_0x2a0b1b?projectAppConfig(_0x2a0b1b):null,_0xebbd45=plannedAppConfig({'appCode':_0x2bcab2[_0x4bf666(0x18c)],'key':_0x219eb7,'tags':_0xaae06c??_0x2a0b1b?.['tags'],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x37156d,'appCode':_0x2bcab2[_0x4bf666(0x18c)],'key':_0x219eb7,'before':_0x39358e,'after':_0xebbd45,'dryRun':!![]}),{'method':_0x4bf666(0x19a),'url':_0x37156d===_0x4bf666(0x198)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x3f9a3e){const _0x351d89=a34_0x17c8e4,_0x24e779=readKeyArg(_0x3f9a3e),_0x1fae69=readOptionalTags(_0x3f9a3e),_0x560932=await withAppConfigApiBoundary('get',{'appCode':_0x3f9a3e['appCode'],'key':_0x24e779},()=>getAppConfigByKey(_0x3f9a3e[_0x351d89(0x18c)],_0x24e779)),_0x42c6c5=_0x560932?projectAppConfig(_0x560932):null,_0x349f3f=_0x560932?_0x351d89(0x198):_0x351d89(0x19c),{value:_0x33a47b,warnings:_0x450636}=await readAppConfigValue(_0x3f9a3e),_0x27e692={'appCode':_0x3f9a3e[_0x351d89(0x18c)],'key':_0x24e779,'value':_0x33a47b,'tags':_0x1fae69??_0x560932?.[_0x351d89(0x199)]??undefined};await withAppConfigApiBoundary(_0x349f3f,{'appCode':_0x3f9a3e[_0x351d89(0x18c)],'key':_0x24e779},async()=>{_0x560932?await updateAppConfig({..._0x27e692,'id':requireAppConfigId(_0x560932,_0x24e779,_0x3f9a3e['appCode'])}):await createAppConfig(_0x27e692);});const _0x9ed46c=await withAppConfigApiBoundary(_0x351d89(0x189),{'appCode':_0x3f9a3e[_0x351d89(0x18c)],'key':_0x24e779},()=>getAppConfigByKey(_0x3f9a3e[_0x351d89(0x18c)],_0x24e779)),_0x44908f=_0x9ed46c?projectAppConfig(_0x9ed46c):plannedAppConfig({'appCode':_0x3f9a3e[_0x351d89(0x18c)],'key':_0x24e779,'tags':_0x27e692[_0x351d89(0x199)],'hasValue':_0x33a47b!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x349f3f,'appCode':_0x3f9a3e[_0x351d89(0x18c)],'key':_0x24e779,'before':_0x42c6c5,'after':_0x44908f,'dryRun':![],'warnings':_0x450636}),'message':(_0x349f3f===_0x351d89(0x198)?_0x351d89(0x196):_0x351d89(0x188))+_0x351d89(0x19f)+_0x24e779};}};function requireAppConfigId(_0x25d55e,_0x58b6db,_0x1f04cc){const _0x1f81b3=a34_0x17c8e4;if(typeof _0x25d55e['id']==='number'&&Number[_0x1f81b3(0x19e)](_0x25d55e['id'])&&_0x25d55e['id']>0x0)return _0x25d55e['id'];throw CliErrors[_0x1f81b3(0x1a1)](_0x1f81b3(0x197)+_0x58b6db+',\x20appCode='+_0x1f04cc);}function a34_0x16d9(_0x5bc496,_0x5f2c94){_0x5bc496=_0x5bc496-0x188;const _0x59781d=a34_0x5978();let _0x16d997=_0x59781d[_0x5bc496];return _0x16d997;}function a34_0x5978(){const _0x4d7fad=['apiError','816liEdct','Created','get','243lcZhDX','/smartapi/app-config/create','appCode','50ZlzdWK','Read\x20config\x20value\x20from\x20file','95puknLY','461989ZMVXSl','521412anNgrY','app-config','6942rSHuXD','16840FlcSmr','221543kJtlmP','Updated','App\x20config\x20server\x20id\x20missing\x20for\x20key=','update','tags','POST','write','create','105071hFjakM','isFinite','\x20app\x20config\x20','16owQbbv'];a34_0x5978=function(){return _0x4d7fad;};return a34_0x5978();}
1
+ const a34_0x2ee5d4=a34_0x314b;(function(_0x4db38d,_0x132532){const _0x24244e=a34_0x314b,_0x401ac8=_0x4db38d();while(!![]){try{const _0x1be637=-parseInt(_0x24244e(0x8f))/0x1*(parseInt(_0x24244e(0x83))/0x2)+parseInt(_0x24244e(0x86))/0x3*(-parseInt(_0x24244e(0x89))/0x4)+-parseInt(_0x24244e(0x8b))/0x5+parseInt(_0x24244e(0x85))/0x6*(parseInt(_0x24244e(0x7e))/0x7)+-parseInt(_0x24244e(0x81))/0x8+parseInt(_0x24244e(0x7c))/0x9+parseInt(_0x24244e(0x88))/0xa*(parseInt(_0x24244e(0x7d))/0xb);if(_0x1be637===_0x132532)break;else _0x401ac8['push'](_0x401ac8['shift']());}catch(_0x3ce4ec){_0x401ac8['push'](_0x401ac8['shift']());}}}(a34_0x2160,0xbf47d));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a34_0x314b(_0x3d88e4,_0x39f743){_0x3d88e4=_0x3d88e4-0x74;const _0x2160b1=a34_0x2160();let _0x314b5a=_0x2160b1[_0x3d88e4];return _0x314b5a;}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';const CREATE_PATH=a34_0x2ee5d4(0x79),UPDATE_PATH=a34_0x2ee5d4(0x75);export const appConfigSet={'service':a34_0x2ee5d4(0x8e),'command':a34_0x2ee5d4(0x91),'description':a34_0x2ee5d4(0x80),'risk':'write','args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x2ee5d4(0x82),'type':a34_0x2ee5d4(0x8d),'description':'Read\x20config\x20value\x20from\x20file'}],async 'validate'(_0x214e58){readKeyArg(_0x214e58),readOptionalTags(_0x214e58),assertSingleValueSource(_0x214e58);},async 'dryRun'(_0x5e47f5){const _0x502f5f=a34_0x2ee5d4,_0x3f36dd=readKeyArg(_0x5e47f5),_0xab5365=readOptionalTags(_0x5e47f5),_0x15f016=assertSingleValueSource(_0x5e47f5);await assertValueSourceReadable(_0x15f016);const _0x55f7ec=await withAppConfigApiBoundary('get',{'appCode':_0x5e47f5[_0x502f5f(0x7a)],'key':_0x3f36dd},()=>getAppConfigByKey(_0x5e47f5[_0x502f5f(0x7a)],_0x3f36dd)),_0x5d3eae=_0x55f7ec?_0x502f5f(0x78):_0x502f5f(0x90),_0x48ddc6=_0x55f7ec?projectAppConfig(_0x55f7ec):null,_0x5982f4=plannedAppConfig({'appCode':_0x5e47f5[_0x502f5f(0x7a)],'key':_0x3f36dd,'tags':_0xab5365??_0x55f7ec?.['tags'],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x5d3eae,'appCode':_0x5e47f5[_0x502f5f(0x7a)],'key':_0x3f36dd,'before':_0x48ddc6,'after':_0x5982f4,'dryRun':!![]}),{'method':_0x502f5f(0x7f),'url':_0x5d3eae===_0x502f5f(0x78)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x1c7a3a){const _0x3bb415=a34_0x2ee5d4,_0x25b4a6=readKeyArg(_0x1c7a3a),_0x1dd0a4=readOptionalTags(_0x1c7a3a),_0x3e4356=await withAppConfigApiBoundary(_0x3bb415(0x77),{'appCode':_0x1c7a3a[_0x3bb415(0x7a)],'key':_0x25b4a6},()=>getAppConfigByKey(_0x1c7a3a['appCode'],_0x25b4a6)),_0x333b96=_0x3e4356?projectAppConfig(_0x3e4356):null,_0x4cc34c=_0x3e4356?_0x3bb415(0x78):_0x3bb415(0x90),{value:_0x355e2a,warnings:_0x4fd9da}=await readAppConfigValue(_0x1c7a3a),_0x5050ea={'appCode':_0x1c7a3a[_0x3bb415(0x7a)],'key':_0x25b4a6,'value':_0x355e2a,'tags':_0x1dd0a4??_0x3e4356?.[_0x3bb415(0x7b)]??undefined};await withAppConfigApiBoundary(_0x4cc34c,{'appCode':_0x1c7a3a[_0x3bb415(0x7a)],'key':_0x25b4a6},async()=>{const _0x4bfeb5=_0x3bb415;_0x3e4356?await updateAppConfig({..._0x5050ea,'id':requireAppConfigId(_0x3e4356,_0x25b4a6,_0x1c7a3a[_0x4bfeb5(0x7a)])}):await createAppConfig(_0x5050ea);});const _0x387638=await withAppConfigApiBoundary('get',{'appCode':_0x1c7a3a[_0x3bb415(0x7a)],'key':_0x25b4a6},()=>getAppConfigByKey(_0x1c7a3a[_0x3bb415(0x7a)],_0x25b4a6)),_0x1a51fa=_0x387638?projectAppConfig(_0x387638):plannedAppConfig({'appCode':_0x1c7a3a['appCode'],'key':_0x25b4a6,'tags':_0x5050ea[_0x3bb415(0x7b)],'hasValue':_0x355e2a!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x4cc34c,'appCode':_0x1c7a3a[_0x3bb415(0x7a)],'key':_0x25b4a6,'before':_0x333b96,'after':_0x1a51fa,'dryRun':![],'warnings':_0x4fd9da}),'message':(_0x4cc34c==='update'?_0x3bb415(0x92):_0x3bb415(0x74))+_0x3bb415(0x76)+_0x25b4a6};}};function requireAppConfigId(_0x28c0db,_0xf60de8,_0x35373a){const _0x5e01f1=a34_0x2ee5d4;if(typeof _0x28c0db['id']===_0x5e01f1(0x8a)&&Number[_0x5e01f1(0x8c)](_0x28c0db['id'])&&_0x28c0db['id']>0x0)return _0x28c0db['id'];throw CliErrors['apiError'](_0x5e01f1(0x87)+_0xf60de8+_0x5e01f1(0x84)+_0x35373a);}function a34_0x2160(){const _0x3d15a6=['get','update','/smartapi/app-config/create','appCode','tags','12773718CYeKau','27995kQdoFt','2681lETNKs','POST','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','5794480Mipmrj','file','2699156huxrJB',',\x20appCode=','7974WbohUa','3jwuhXD','App\x20config\x20server\x20id\x20missing\x20for\x20key=','8790kIMZQn','3119076ynENII','number','2641110jcyHta','isFinite','string','app-config','1DGkYVc','create','set','Updated','Created','/smartapi/app-config/update','\x20app\x20config\x20'];a34_0x2160=function(){return _0x3d15a6;};return a34_0x2160();}
@@ -1 +1 @@
1
- const a35_0x5b3135=a35_0x5802;(function(_0x11e410,_0x434f65){const _0x11c62d=a35_0x5802,_0x21ccb0=_0x11e410();while(!![]){try{const _0x552863=parseInt(_0x11c62d(0x210))/0x1*(-parseInt(_0x11c62d(0x20c))/0x2)+-parseInt(_0x11c62d(0x1df))/0x3+parseInt(_0x11c62d(0x1e2))/0x4*(parseInt(_0x11c62d(0x21c))/0x5)+-parseInt(_0x11c62d(0x1e6))/0x6*(-parseInt(_0x11c62d(0x201))/0x7)+parseInt(_0x11c62d(0x1f6))/0x8*(-parseInt(_0x11c62d(0x200))/0x9)+parseInt(_0x11c62d(0x1de))/0xa*(-parseInt(_0x11c62d(0x1fc))/0xb)+parseInt(_0x11c62d(0x219))/0xc;if(_0x552863===_0x434f65)break;else _0x21ccb0['push'](_0x21ccb0['shift']());}catch(_0x122a33){_0x21ccb0['push'](_0x21ccb0['shift']());}}}(a35_0x96e4,0xeb5a6));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x5b3135(0x212),'description':a35_0x5b3135(0x1f8),'required':!![]};export const VALUE_ARG={'name':a35_0x5b3135(0x1ea),'description':'Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','required':![]};export const TAGS_FLAG={'name':a35_0x5b3135(0x20d),'type':'string','description':'Config\x20tags\x20for\x20filtering/display\x20metadata'};export const STDIN_FLAG={'name':a35_0x5b3135(0x209),'type':'boolean','description':'Read\x20config\x20value\x20from\x20stdin','default':![]};export const FROM_ENV_FLAG={'name':a35_0x5b3135(0x1e0),'type':a35_0x5b3135(0x1fd),'description':a35_0x5b3135(0x208)};export const REVEAL_FLAG={'name':a35_0x5b3135(0x214),'type':a35_0x5b3135(0x1f2),'description':a35_0x5b3135(0x21f),'default':![]};export function readKeyArg(_0x5df9f3){const _0x4af741=a35_0x5b3135,_0xe7cbdf=_0x5df9f3[_0x4af741(0x217)][0x0]?.[_0x4af741(0x218)]()??'';return validateKey(_0xe7cbdf),_0xe7cbdf;}function a35_0x96e4(){const _0x2248ac=['value\x20is\x20redacted','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','209PvCWpI','string','path','Missing\x20app-config\x20key.','2102598fgwKoO','14TwzpEg','env','setEncoding','url','appCode','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','utf8','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','stdin','data','join','46LacYol','tags','slice','warnings','11797CJMWWH','kind','key','bool','reveal','after','push','args','trim','47739648NIGdna','argument','length','2115FEWhWi','file','before','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','941530vBZJEh','1803774IQiDnw','from-env','str','1080yICrQg','name','gmtCreate','once','4205892uZfYCT','hasValue','end','apiError','value','validation','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','key:\x20','valueRedacted','appCode:\x20','Environment\x20variable\x20is\x20not\x20set:\x20','gmtModified','boolean','error','Missing\x20app-config\x20value\x20source.','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','64Atafft','dryRun','Runtime\x20app-config\x20key','operation'];a35_0x96e4=function(){return _0x2248ac;};return a35_0x96e4();}export function readOptionalTags(_0x1658d3){const _0x11d540=a35_0x5b3135,_0xc8a112=_0x1658d3['str']('tags')['trim']();if(!_0xc8a112)return undefined;if(_0xc8a112[_0x11d540(0x21b)]>0x20)throw CliErrors['validation'](_0x11d540(0x1fb));return _0xc8a112;}export function validateKey(_0x49f359){const _0x415642=a35_0x5b3135;if(!_0x49f359)throw CliErrors[_0x415642(0x1eb)](_0x415642(0x1ff));if(_0x49f359[_0x415642(0x21b)]>0x100)throw CliErrors[_0x415642(0x1eb)](_0x415642(0x1ec));}export function projectAppConfig(_0x4ad415,_0x50d53c){const _0x572202=a35_0x5b3135,_0x58e5fc=_0x4ad415[_0x572202(0x1ea)]!==undefined&&_0x4ad415[_0x572202(0x1ea)]!==null&&_0x4ad415[_0x572202(0x1ea)]!=='',_0x10ee45={'appCode':_0x4ad415[_0x572202(0x205)],'key':_0x4ad415[_0x572202(0x212)],'tags':_0x4ad415[_0x572202(0x20d)]??undefined,'hasValue':_0x58e5fc,'valueRedacted':_0x58e5fc&&!_0x50d53c?.[_0x572202(0x214)],'gmtCreate':_0x4ad415[_0x572202(0x1e4)],'gmtModified':_0x4ad415[_0x572202(0x1f1)]};return _0x50d53c?.[_0x572202(0x214)]&&(_0x10ee45['value']=_0x4ad415[_0x572202(0x1ea)]??'',_0x10ee45[_0x572202(0x1ee)]=![]),_0x10ee45;}export function plannedAppConfig(_0x49ba65){const _0x40c1d6=a35_0x5b3135,_0x19e2bf=_0x49ba65[_0x40c1d6(0x1e7)]??!![];return{'appCode':_0x49ba65[_0x40c1d6(0x205)],'key':_0x49ba65['key'],'tags':_0x49ba65[_0x40c1d6(0x20d)]??undefined,'hasValue':_0x19e2bf,'valueRedacted':_0x19e2bf};}export function buildMutationData(_0x3cbfb2){const _0xa10405=a35_0x5b3135;return{'operation':_0x3cbfb2[_0xa10405(0x1f9)],'selector':{'appCode':_0x3cbfb2['appCode'],'key':_0x3cbfb2[_0xa10405(0x212)]},'before':_0x3cbfb2[_0xa10405(0x21e)],'after':_0x3cbfb2[_0xa10405(0x215)],'dryRun':_0x3cbfb2[_0xa10405(0x1f7)],'warnings':_0x3cbfb2[_0xa10405(0x20f)]??[]};}function a35_0x5802(_0x21465b,_0x4360d2){_0x21465b=_0x21465b-0x1de;const _0x96e4f1=a35_0x96e4();let _0x580291=_0x96e4f1[_0x21465b];return _0x580291;}export async function withAppConfigApiBoundary(_0x3ef27e,_0x578378,_0x109d75){const _0x952791=a35_0x5b3135;try{return await _0x109d75();}catch{const _0x40518a=[_0x952791(0x1ef)+_0x578378[_0x952791(0x205)]];if(_0x578378[_0x952791(0x212)])_0x40518a[_0x952791(0x216)](_0x952791(0x1ed)+_0x578378[_0x952791(0x212)]);_0x40518a[_0x952791(0x216)](_0x952791(0x1fa));throw CliErrors[_0x952791(0x1e9)]('Failed\x20to\x20'+_0x3ef27e+'\x20app\x20config.',_0x40518a[_0x952791(0x20b)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x4d753b,_0xff945f){const _0x59e856=a35_0x5b3135;return Object['defineProperties'](_0x4d753b,{'method':{'value':_0xff945f['method'],'enumerable':![]},'url':{'value':_0xff945f[_0x59e856(0x204)],'enumerable':![]}});}export function assertSingleValueSource(_0xaf1db){const _0x47c192=a35_0x5b3135,_0x1fe111=[];_0xaf1db['args'][_0x47c192(0x21b)]>0x1&&_0x1fe111[_0x47c192(0x216)]({'kind':_0x47c192(0x21a),'value':_0xaf1db[_0x47c192(0x217)][_0x47c192(0x20e)](0x1)[_0x47c192(0x20b)]('\x20')});const _0x6a764c=_0xaf1db['flag']('value');_0x6a764c!==undefined&&_0x6a764c!==null&&_0x1fe111[_0x47c192(0x216)]({'kind':'argument','value':String(_0x6a764c)});_0xaf1db[_0x47c192(0x213)]('stdin')&&_0x1fe111[_0x47c192(0x216)]({'kind':_0x47c192(0x209)});const _0x33025e=_0xaf1db[_0x47c192(0x1e1)](_0x47c192(0x1e0))[_0x47c192(0x218)]();_0x33025e&&_0x1fe111['push']({'kind':_0x47c192(0x202),'name':_0x33025e});const _0x333a6a=_0xaf1db[_0x47c192(0x1e1)](_0x47c192(0x21d))['trim']();_0x333a6a&&_0x1fe111[_0x47c192(0x216)]({'kind':_0x47c192(0x21d),'path':_0x333a6a});if(_0x1fe111[_0x47c192(0x21b)]===0x0)throw CliErrors[_0x47c192(0x1eb)](_0x47c192(0x1f4),'Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');if(_0x1fe111[_0x47c192(0x21b)]>0x1)throw CliErrors['validation']('App\x20config\x20value\x20source\x20is\x20ambiguous.',_0x47c192(0x206));return _0x1fe111[0x0];}export async function assertValueSourceReadable(_0x29aab6){const _0x3071e7=a35_0x5b3135;if(_0x29aab6[_0x3071e7(0x211)]===_0x3071e7(0x202)&&!(_0x29aab6[_0x3071e7(0x1e3)]in process.env))throw CliErrors[_0x3071e7(0x1eb)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x29aab6['name']);if(_0x29aab6[_0x3071e7(0x211)]===_0x3071e7(0x21d))try{await access(_0x29aab6[_0x3071e7(0x1fe)]);}catch{throw CliErrors['validation']('Value\x20file\x20is\x20not\x20readable:\x20'+_0x29aab6['path']);}}export async function readAppConfigValue(_0x545645){const _0x5240aa=a35_0x5b3135,_0x378383=assertSingleValueSource(_0x545645),_0x3f2aa6=[];if(_0x378383[_0x5240aa(0x211)]===_0x5240aa(0x21a))return _0x3f2aa6[_0x5240aa(0x216)](_0x5240aa(0x1f5)),{'value':_0x378383[_0x5240aa(0x1ea)]??'','source':_0x378383[_0x5240aa(0x211)],'warnings':_0x3f2aa6};if(_0x378383[_0x5240aa(0x211)]===_0x5240aa(0x209))return{'value':await readStdin(),'source':_0x378383['kind'],'warnings':_0x3f2aa6};if(_0x378383['kind']===_0x5240aa(0x202)){if(!(_0x378383['name']in process.env))throw CliErrors['validation'](_0x5240aa(0x1f0)+_0x378383[_0x5240aa(0x1e3)]);return{'value':process.env[_0x378383.name]??'','source':_0x378383[_0x5240aa(0x211)],'warnings':_0x3f2aa6};}return{'value':await readFile(_0x378383['path'],'utf8'),'source':_0x378383[_0x5240aa(0x211)],'warnings':_0x3f2aa6};}function readStdin(){return new Promise((_0xa65e7b,_0x4ee55d)=>{const _0x4dd80c=a35_0x5802;let _0x599070='';process[_0x4dd80c(0x209)][_0x4dd80c(0x203)](_0x4dd80c(0x207)),process[_0x4dd80c(0x209)]['on'](_0x4dd80c(0x20a),_0x2383c8=>{_0x599070+=_0x2383c8;}),process[_0x4dd80c(0x209)][_0x4dd80c(0x1e5)](_0x4dd80c(0x1e8),()=>_0xa65e7b(_0x599070)),process[_0x4dd80c(0x209)][_0x4dd80c(0x1e5)](_0x4dd80c(0x1f3),_0x4ee55d);});}
1
+ const a35_0x257a57=a35_0x2c8a;(function(_0x55581f,_0x592da2){const _0xeb16f=a35_0x2c8a,_0x2e51f7=_0x55581f();while(!![]){try{const _0x362c75=-parseInt(_0xeb16f(0xaf))/0x1+-parseInt(_0xeb16f(0x85))/0x2*(-parseInt(_0xeb16f(0xa8))/0x3)+-parseInt(_0xeb16f(0x88))/0x4+-parseInt(_0xeb16f(0x8c))/0x5*(parseInt(_0xeb16f(0x7f))/0x6)+parseInt(_0xeb16f(0xb5))/0x7*(-parseInt(_0xeb16f(0xb4))/0x8)+parseInt(_0xeb16f(0x93))/0x9*(-parseInt(_0xeb16f(0x98))/0xa)+parseInt(_0xeb16f(0xa0))/0xb;if(_0x362c75===_0x592da2)break;else _0x2e51f7['push'](_0x2e51f7['shift']());}catch(_0x328b98){_0x2e51f7['push'](_0x2e51f7['shift']());}}}(a35_0x2301,0xe8dbe));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';function a35_0x2301(){const _0xabaa8c=['Missing\x20app-config\x20key.','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','length','10IpSUkc','hasValue','warnings','env','Failed\x20to\x20','Missing\x20app-config\x20value\x20source.','flag','args','43766690HZOEfV','end','data','error','utf8','Environment\x20variable\x20is\x20not\x20set:\x20','App\x20config\x20value\x20source\x20is\x20ambiguous.','path','117kZlmwe','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','argument','Runtime\x20app-config\x20key','value\x20is\x20redacted','from-env','url','935983ZfsKiA','apiError','slice','appCode','name','87072AHDaZZ','525gVexoK','once','file','stdin','key','kind','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','push','Read\x20config\x20value\x20from\x20stdin','Value\x20file\x20is\x20not\x20readable:\x20','143268LTEdgn','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','tags','str','trim','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','62198XHVjEQ','valueRedacted','value','4511308UhucWn','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','join','boolean','120yVVtaf','operation','gmtModified','string','reveal','gmtCreate','validation','7062111enPDCe','after'];a35_0x2301=function(){return _0xabaa8c;};return a35_0x2301();}export const KEY_ARG={'name':a35_0x257a57(0xb9),'description':a35_0x257a57(0xab),'required':!![]};export const VALUE_ARG={'name':a35_0x257a57(0x87),'description':'Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','required':![]};export const TAGS_FLAG={'name':'tags','type':a35_0x257a57(0x8f),'description':'Config\x20tags\x20for\x20filtering/display\x20metadata'};export const STDIN_FLAG={'name':a35_0x257a57(0xb8),'type':'boolean','description':a35_0x257a57(0xbd),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x257a57(0xad),'type':a35_0x257a57(0x8f),'description':a35_0x257a57(0xbb)};export const REVEAL_FLAG={'name':a35_0x257a57(0x90),'type':a35_0x257a57(0x8b),'description':a35_0x257a57(0x96),'default':![]};export function readKeyArg(_0x35491f){const _0x336186=a35_0x257a57,_0x51fe42=_0x35491f[_0x336186(0x9f)][0x0]?.[_0x336186(0x83)]()??'';return validateKey(_0x51fe42),_0x51fe42;}export function readOptionalTags(_0xc8d7a8){const _0x4e93e3=a35_0x257a57,_0x1f9af7=_0xc8d7a8[_0x4e93e3(0x82)](_0x4e93e3(0x81))[_0x4e93e3(0x83)]();if(!_0x1f9af7)return undefined;if(_0x1f9af7['length']>0x20)throw CliErrors['validation']('App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.');return _0x1f9af7;}export function validateKey(_0x22fbe5){const _0x4c476d=a35_0x257a57;if(!_0x22fbe5)throw CliErrors['validation'](_0x4c476d(0x95));if(_0x22fbe5[_0x4c476d(0x97)]>0x100)throw CliErrors[_0x4c476d(0x92)](_0x4c476d(0x84));}export function projectAppConfig(_0x589658,_0x4f1b63){const _0x3e7462=a35_0x257a57,_0x547fbf=_0x589658[_0x3e7462(0x87)]!==undefined&&_0x589658[_0x3e7462(0x87)]!==null&&_0x589658[_0x3e7462(0x87)]!=='',_0x4a1f12={'appCode':_0x589658[_0x3e7462(0xb2)],'key':_0x589658[_0x3e7462(0xb9)],'tags':_0x589658[_0x3e7462(0x81)]??undefined,'hasValue':_0x547fbf,'valueRedacted':_0x547fbf&&!_0x4f1b63?.[_0x3e7462(0x90)],'gmtCreate':_0x589658[_0x3e7462(0x91)],'gmtModified':_0x589658[_0x3e7462(0x8e)]};return _0x4f1b63?.[_0x3e7462(0x90)]&&(_0x4a1f12[_0x3e7462(0x87)]=_0x589658[_0x3e7462(0x87)]??'',_0x4a1f12[_0x3e7462(0x86)]=![]),_0x4a1f12;}export function plannedAppConfig(_0xabb819){const _0x42dfad=a35_0x257a57,_0x18c6a6=_0xabb819[_0x42dfad(0x99)]??!![];return{'appCode':_0xabb819[_0x42dfad(0xb2)],'key':_0xabb819[_0x42dfad(0xb9)],'tags':_0xabb819[_0x42dfad(0x81)]??undefined,'hasValue':_0x18c6a6,'valueRedacted':_0x18c6a6};}export function buildMutationData(_0x260ca2){const _0x2780f9=a35_0x257a57;return{'operation':_0x260ca2[_0x2780f9(0x8d)],'selector':{'appCode':_0x260ca2[_0x2780f9(0xb2)],'key':_0x260ca2[_0x2780f9(0xb9)]},'before':_0x260ca2['before'],'after':_0x260ca2[_0x2780f9(0x94)],'dryRun':_0x260ca2['dryRun'],'warnings':_0x260ca2[_0x2780f9(0x9a)]??[]};}export async function withAppConfigApiBoundary(_0x328114,_0x3272d2,_0x3d5d07){const _0xed7d9=a35_0x257a57;try{return await _0x3d5d07();}catch{const _0xdb591b=['appCode:\x20'+_0x3272d2[_0xed7d9(0xb2)]];if(_0x3272d2[_0xed7d9(0xb9)])_0xdb591b['push']('key:\x20'+_0x3272d2[_0xed7d9(0xb9)]);_0xdb591b[_0xed7d9(0xbc)](_0xed7d9(0xac));throw CliErrors[_0xed7d9(0xb0)](_0xed7d9(0x9c)+_0x328114+'\x20app\x20config.',_0xdb591b['join'](';\x20')+'.');}}function a35_0x2c8a(_0x1b93b0,_0x28f3f8){_0x1b93b0=_0x1b93b0-0x7f;const _0x2301ce=a35_0x2301();let _0x2c8a60=_0x2301ce[_0x1b93b0];return _0x2c8a60;}export function asAppConfigDryRunResult(_0x3e660f,_0x44fe09){const _0x2e287f=a35_0x257a57;return Object['defineProperties'](_0x3e660f,{'method':{'value':_0x44fe09['method'],'enumerable':![]},'url':{'value':_0x44fe09[_0x2e287f(0xae)],'enumerable':![]}});}export function assertSingleValueSource(_0x26f598){const _0x24a437=a35_0x257a57,_0x4787d7=[];_0x26f598['args']['length']>0x1&&_0x4787d7[_0x24a437(0xbc)]({'kind':_0x24a437(0xaa),'value':_0x26f598[_0x24a437(0x9f)][_0x24a437(0xb1)](0x1)[_0x24a437(0x8a)]('\x20')});const _0x3f513d=_0x26f598[_0x24a437(0x9e)](_0x24a437(0x87));_0x3f513d!==undefined&&_0x3f513d!==null&&_0x4787d7[_0x24a437(0xbc)]({'kind':'argument','value':String(_0x3f513d)});_0x26f598['bool'](_0x24a437(0xb8))&&_0x4787d7[_0x24a437(0xbc)]({'kind':_0x24a437(0xb8)});const _0x4b8563=_0x26f598[_0x24a437(0x82)](_0x24a437(0xad))[_0x24a437(0x83)]();_0x4b8563&&_0x4787d7[_0x24a437(0xbc)]({'kind':_0x24a437(0x9b),'name':_0x4b8563});const _0x2da5c5=_0x26f598[_0x24a437(0x82)]('file')[_0x24a437(0x83)]();_0x2da5c5&&_0x4787d7['push']({'kind':_0x24a437(0xb7),'path':_0x2da5c5});if(_0x4787d7[_0x24a437(0x97)]===0x0)throw CliErrors['validation'](_0x24a437(0x9d),_0x24a437(0x89));if(_0x4787d7['length']>0x1)throw CliErrors[_0x24a437(0x92)](_0x24a437(0xa6),_0x24a437(0x80));return _0x4787d7[0x0];}export async function assertValueSourceReadable(_0x4c3a87){const _0xc1d764=a35_0x257a57;if(_0x4c3a87[_0xc1d764(0xba)]==='env'&&!(_0x4c3a87[_0xc1d764(0xb3)]in process.env))throw CliErrors[_0xc1d764(0x92)](_0xc1d764(0xa5)+_0x4c3a87[_0xc1d764(0xb3)]);if(_0x4c3a87[_0xc1d764(0xba)]===_0xc1d764(0xb7))try{await access(_0x4c3a87[_0xc1d764(0xa7)]);}catch{throw CliErrors[_0xc1d764(0x92)](_0xc1d764(0xbe)+_0x4c3a87[_0xc1d764(0xa7)]);}}export async function readAppConfigValue(_0x103755){const _0x4f8f22=a35_0x257a57,_0xcb9635=assertSingleValueSource(_0x103755),_0x430400=[];if(_0xcb9635['kind']===_0x4f8f22(0xaa))return _0x430400['push'](_0x4f8f22(0xa9)),{'value':_0xcb9635[_0x4f8f22(0x87)]??'','source':_0xcb9635[_0x4f8f22(0xba)],'warnings':_0x430400};if(_0xcb9635[_0x4f8f22(0xba)]===_0x4f8f22(0xb8))return{'value':await readStdin(),'source':_0xcb9635['kind'],'warnings':_0x430400};if(_0xcb9635['kind']===_0x4f8f22(0x9b)){if(!(_0xcb9635[_0x4f8f22(0xb3)]in process.env))throw CliErrors[_0x4f8f22(0x92)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0xcb9635[_0x4f8f22(0xb3)]);return{'value':process.env[_0xcb9635.name]??'','source':_0xcb9635[_0x4f8f22(0xba)],'warnings':_0x430400};}return{'value':await readFile(_0xcb9635[_0x4f8f22(0xa7)],'utf8'),'source':_0xcb9635[_0x4f8f22(0xba)],'warnings':_0x430400};}function readStdin(){return new Promise((_0x5d2df6,_0x41f93a)=>{const _0x163b4d=a35_0x2c8a;let _0x5f28c6='';process[_0x163b4d(0xb8)]['setEncoding'](_0x163b4d(0xa4)),process['stdin']['on'](_0x163b4d(0xa2),_0x573959=>{_0x5f28c6+=_0x573959;}),process[_0x163b4d(0xb8)]['once'](_0x163b4d(0xa1),()=>_0x5d2df6(_0x5f28c6)),process[_0x163b4d(0xb8)][_0x163b4d(0xb6)](_0x163b4d(0xa3),_0x41f93a);});}
@@ -1 +1 @@
1
- const a36_0x353cfb=a36_0xa1d2;(function(_0x1e642f,_0x21d66b){const _0x38c8b7=a36_0xa1d2,_0x593708=_0x1e642f();while(!![]){try{const _0x149723=-parseInt(_0x38c8b7(0x175))/0x1+-parseInt(_0x38c8b7(0x171))/0x2*(parseInt(_0x38c8b7(0x16a))/0x3)+parseInt(_0x38c8b7(0x168))/0x4*(parseInt(_0x38c8b7(0x170))/0x5)+-parseInt(_0x38c8b7(0x16b))/0x6+parseInt(_0x38c8b7(0x17c))/0x7*(parseInt(_0x38c8b7(0x169))/0x8)+parseInt(_0x38c8b7(0x16c))/0x9*(-parseInt(_0x38c8b7(0x177))/0xa)+parseInt(_0x38c8b7(0x172))/0xb;if(_0x149723===_0x21d66b)break;else _0x593708['push'](_0x593708['shift']());}catch(_0x3176e9){_0x593708['push'](_0x593708['shift']());}}}(a36_0x2690,0x50bf1));import{unlinkSync,existsSync}from'node:fs';function a36_0xa1d2(_0x47f29e,_0x467f00){_0x47f29e=_0x47f29e-0x168;const _0x269096=a36_0x2690();let _0xa1d26e=_0x269096[_0x47f29e];return _0xa1d26e;}function a36_0x2690(){const _0x25febb=['../../auth/auth-server-ui.js','Clear\x20login\x20session','261842wCmUTp','!\x20Not\x20logged\x20in','3387950czMxHP','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','nonInteractive','log','logout','2194682qLexQw','1079348miWIXu','8jNrjyG','45PUDhkN','2384802awjYed','9hjAsYw','auth','boolean','yes','10yWSTnt','1332srUZxD','5341941skTqFs'];a36_0x2690=function(){return _0x25febb;};return a36_0x2690();}import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':'auth','command':'login','description':'Login\x20via\x20browser','risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x353cfb(0x16f),'type':a36_0x353cfb(0x16e),'description':a36_0x353cfb(0x178),'default':![]}],async 'execute'(_0x39dbf5){const _0x56491a=a36_0x353cfb,{runAuthServer:_0x23f1f3}=await import(_0x56491a(0x173));return await _0x23f1f3({'autoYes':_0x39dbf5['bool'](_0x56491a(0x16f)),'nonInteractive':_0x39dbf5[_0x56491a(0x179)]}),{'ok':!![]};}},{'service':a36_0x353cfb(0x16d),'command':a36_0x353cfb(0x17b),'description':a36_0x353cfb(0x174),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x4a96f5){const _0x9a5e69=a36_0x353cfb;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x9a5e69(0x17a)]('✓\x20Logged\x20out')):console[_0x9a5e69(0x17a)](_0x9a5e69(0x176)),{'ok':!![]};}}];
1
+ function a36_0x2d21(_0x15bc5b,_0x35a440){_0x15bc5b=_0x15bc5b-0x11b;const _0x154f4d=a36_0x154f();let _0x2d21cb=_0x154f4d[_0x15bc5b];return _0x2d21cb;}function a36_0x154f(){const _0x75db7f=['boolean','1632063NgVTbN','5382459mYfzGV','7338YTpQUJ','3627176vNWzlV','79583bxrgXX','102EPLpXY','logout','✓\x20Logged\x20out','log','bool','write','1612325QkJhdH','nonInteractive','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','190NtQTUO','Clear\x20login\x20session','login','!\x20Not\x20logged\x20in','yes','Login\x20via\x20browser','1058144tbpZeV','../../auth/auth-server-ui.js'];a36_0x154f=function(){return _0x75db7f;};return a36_0x154f();}const a36_0x185b2c=a36_0x2d21;(function(_0x2da89f,_0x37b078){const _0x4a05db=a36_0x2d21,_0x1f85f4=_0x2da89f();while(!![]){try{const _0x81a2b9=-parseInt(_0x4a05db(0x11f))/0x1*(-parseInt(_0x4a05db(0x12b))/0x2)+-parseInt(_0x4a05db(0x11d))/0x3+parseInt(_0x4a05db(0x120))/0x4+-parseInt(_0x4a05db(0x128))/0x5+-parseInt(_0x4a05db(0x122))/0x6*(-parseInt(_0x4a05db(0x121))/0x7)+parseInt(_0x4a05db(0x131))/0x8+-parseInt(_0x4a05db(0x11e))/0x9;if(_0x81a2b9===_0x37b078)break;else _0x1f85f4['push'](_0x1f85f4['shift']());}catch(_0x5c8532){_0x1f85f4['push'](_0x1f85f4['shift']());}}}(a36_0x154f,0x7180c));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':'auth','command':a36_0x185b2c(0x12d),'description':a36_0x185b2c(0x130),'risk':a36_0x185b2c(0x127),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x185b2c(0x12f),'type':a36_0x185b2c(0x11c),'description':a36_0x185b2c(0x12a),'default':![]}],async 'execute'(_0xdc22dd){const _0x2cfb6c=a36_0x185b2c,{runAuthServer:_0x1768eb}=await import(_0x2cfb6c(0x11b));return await _0x1768eb({'autoYes':_0xdc22dd[_0x2cfb6c(0x126)](_0x2cfb6c(0x12f)),'nonInteractive':_0xdc22dd[_0x2cfb6c(0x129)]}),{'ok':!![]};}},{'service':'auth','command':a36_0x185b2c(0x123),'description':a36_0x185b2c(0x12c),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x4edc15){const _0x50a6c9=a36_0x185b2c;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x50a6c9(0x125)](_0x50a6c9(0x124))):console[_0x50a6c9(0x125)](_0x50a6c9(0x12e)),{'ok':!![]};}}];
@@ -1 +1 @@
1
- const a37_0x52781a=a37_0x2aaf;(function(_0x3852c4,_0x410461){const _0x21090a=a37_0x2aaf,_0x4a635e=_0x3852c4();while(!![]){try{const _0x16af32=parseInt(_0x21090a(0x1cf))/0x1*(parseInt(_0x21090a(0x1b8))/0x2)+parseInt(_0x21090a(0x1d8))/0x3+-parseInt(_0x21090a(0x1d2))/0x4*(-parseInt(_0x21090a(0x1e3))/0x5)+-parseInt(_0x21090a(0x1a4))/0x6*(-parseInt(_0x21090a(0x187))/0x7)+parseInt(_0x21090a(0x1d5))/0x8+parseInt(_0x21090a(0x1c5))/0x9*(parseInt(_0x21090a(0x1cd))/0xa)+-parseInt(_0x21090a(0x1ce))/0xb*(parseInt(_0x21090a(0x198))/0xc);if(_0x16af32===_0x410461)break;else _0x4a635e['push'](_0x4a635e['shift']());}catch(_0x15ca9f){_0x4a635e['push'](_0x4a635e['shift']());}}}(a37_0x4ac8,0x3caa0));function a37_0x2aaf(_0x4532e2,_0x5af261){_0x4532e2=_0x4532e2-0x185;const _0x4ac822=a37_0x4ac8();let _0x2aafee=_0x4ac822[_0x4532e2];return _0x2aafee;}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';function a37_0x4ac8(){const _0x10b215=['\x20api\x20pull`\x20to\x20refresh.','HOOK\x20requires\x20alias/operation/node\x20options.','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','24Syurev','operationType','Dataset\x20not\x20found\x20for\x20code\x20\x22','parseInt','/**\x0a\x20*\x20','description','selectedAppName','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','.js','functionNode','\x0a\x20*\x20[平台配置]\x20','Available:\x20','\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','File\x20already\x20exists:\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','datasetId','isInteger','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','source','validation','2EYDTSW','length','question','code','create','profileName','map','stderr','No\x20datasets\x20found\x20for\x20this\x20app.','str','.js\x0a','read','defaultApp','116001PmxWnN','string','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','datasetcode','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','write','after','/data/dataset/','170nzjxTH','12560196aJYjzp','407267OqQkej','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','\x22,\x20params\x20})\x0a','8112RFxwwA','HOOK','当前请求参数','349096mfDDEV','before','join','59937KeIEJu','\x22\x20not\x20found.\x20','appCode','Invalid\x20dataset\x20selection.','.js\x0a\x20*\x20[触发节点]\x20','apiDir','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','Script\x20type','No\x20operation\x20types\x20found\x20for\x20dataset\x20','function-node','Trigger\x20node\x20(HOOK\x20only)','590hwfqIt','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Function\x20name\x20(valid\x20JS\x20identifier)','filePath','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','keys','name','Invalid\x20function\x20name\x20\x22','scriptsRootDir','/HOOK/','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','806778LTflbt','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','mergedCli','currentApp','alias','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','find','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','Select\x20operation\x20type:','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','includes','当前响应结果','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','修改后的请求参数','trim','type','12ebEhJr','datasetCode','COMMON','\x22\x20not\x20found\x20for\x20dataset\x20','Select\x20trigger\x20node:','ENDPOINT','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Select\x20dataset:','nonInteractive'];a37_0x4ac8=function(){return _0x10b215;};return a37_0x4ac8();}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';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':'bff','command':a37_0x52781a(0x1bc),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a37_0x52781a(0x1c3),'flags':[{'name':a37_0x52781a(0x197),'type':a37_0x52781a(0x1c6),'required':!![],'enum':[a37_0x52781a(0x19a),a37_0x52781a(0x19d),a37_0x52781a(0x1d3)],'description':a37_0x52781a(0x1df)},{'name':a37_0x52781a(0x1e9),'type':a37_0x52781a(0x1c6),'required':!![],'description':a37_0x52781a(0x1e5)},{'name':a37_0x52781a(0x1a9),'type':a37_0x52781a(0x1c6),'description':'Script\x20description'},{'name':a37_0x52781a(0x18b),'type':'string','description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a37_0x52781a(0x1c8),'type':'string','description':a37_0x52781a(0x1c7)},{'name':'operation-type','type':a37_0x52781a(0x1c6),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':'function-node','type':a37_0x52781a(0x1c6),'description':a37_0x52781a(0x1e2),'enum':[a37_0x52781a(0x1d6),'after']}],async 'validate'(_0x7def81){const _0x44fced=a37_0x52781a,_0xbce7e7=_0x7def81['str'](_0x44fced(0x1e9));if(!isValidBffFunctionName(_0xbce7e7))throw CliErrors['validation'](_0x44fced(0x1ea)+_0xbce7e7+_0x44fced(0x1b2));},async 'execute'(_0x1fcc68){const _0x5593fd=a37_0x52781a,_0x52666b=loadBffProjectConfig(_0x1fcc68[_0x5593fd(0x1da)]),_0x5c629f=_0x1fcc68['str'](_0x5593fd(0x197)),_0x1488f=_0x1fcc68[_0x5593fd(0x1c1)](_0x5593fd(0x1e9)),_0x247b0d=_0x1fcc68[_0x5593fd(0x1c1)](_0x5593fd(0x1a9))||undefined,_0x5db216=_0x5c629f===_0x5593fd(0x1d3)?await resolveHookOptions(_0x52666b,_0x1fcc68):undefined,_0x4fef15=buildFilePath(_0x52666b,_0x5c629f,_0x1488f,_0x5db216);if(await fileExists(_0x4fef15))throw CliErrors['validation'](_0x5593fd(0x1b1)+_0x4fef15);await mkdir(dirname(_0x4fef15),{'recursive':!![]});const _0x3d9870=generateTemplate(_0x5c629f,_0x1488f,_0x1fcc68['appCode'],_0x247b0d,_0x5db216);await writeFile(_0x4fef15,_0x3d9870,'utf8');const _0x1e8183={'type':_0x5c629f,'name':_0x1488f,'path':_0x4fef15};if(_0x247b0d)_0x1e8183[_0x5593fd(0x1a9)]=_0x247b0d;if(_0x5db216){if(_0x5db216[_0x5593fd(0x18b)])_0x1e8183[_0x5593fd(0x18b)]=_0x5db216['alias'];_0x1e8183['datasetCode']=_0x5db216[_0x5593fd(0x199)],_0x1e8183[_0x5593fd(0x1a5)]=_0x5db216[_0x5593fd(0x1a5)],_0x1e8183['functionNode']=_0x5db216['functionNode'];}return{'ok':!![],'data':_0x1e8183,'message':'Created\x20'+_0x5c629f+'\x20function:\x20'+_0x1488f};}};async function resolveHookOptions(_0x3d0b89,_0x468c24){const _0xe63d44=a37_0x52781a,_0x50b4d2=resolveApiModelSource(_0x468c24['apiDir'],_0x468c24['appCode'],_0x468c24[_0xe63d44(0x1aa)]||_0x468c24['mergedCli']?.[_0xe63d44(0x18a)]||_0x468c24[_0xe63d44(0x189)]?.[_0xe63d44(0x1c4)]),_0x1e2477=loadAliasMap(_0x468c24['apiDir'],undefined,_0x50b4d2[_0xe63d44(0x1e6)],_0x50b4d2[_0xe63d44(0x1bd)]),_0x1fbfed=_0x1e2477['length']>0x0;let _0x2574d9,_0x1661f2,_0x55a4ff;const _0x4a5636=_0x468c24[_0xe63d44(0x1c1)](_0xe63d44(0x18b)),_0x455c85=_0x468c24[_0xe63d44(0x1c1)](_0xe63d44(0x1c8));if(_0x4a5636){const _0x4948d7=resolveAlias(_0x468c24[_0xe63d44(0x1dd)],_0x4a5636,undefined,_0x50b4d2['filePath'],_0x50b4d2[_0xe63d44(0x1bd)]);if(!_0x4948d7){const _0x292485=_0x1fbfed?'Available\x20aliases:\x20'+_0x1e2477[_0xe63d44(0x1be)](_0x237b00=>_0x237b00[_0xe63d44(0x18b)])[_0xe63d44(0x1d7)](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+_0xe63d44(0x1de);throw CliErrors[_0xe63d44(0x1b7)]('Alias\x20\x22'+_0x4a5636+_0xe63d44(0x1d9)+_0x292485);}_0x2574d9=_0x4a5636,_0x1661f2=_0x4948d7;}else{if(_0x455c85){_0x1661f2=_0x455c85;const _0x5b8b31=_0x1e2477[_0xe63d44(0x18d)](_0x562626=>_0x562626['datasetCode']===_0x455c85);_0x2574d9=_0x5b8b31?.[_0xe63d44(0x18b)];}else{if(_0x468c24[_0xe63d44(0x1a0)])throw CliErrors[_0xe63d44(0x1b7)](_0xe63d44(0x1e7));else{if(_0x1fbfed){const _0x2eadbe=_0x1e2477[_0xe63d44(0x1be)](_0x287553=>_0x287553[_0xe63d44(0x18b)]+'\x20('+_0x287553['tableName']+')'),_0x4f604a=await promptSelect(_0xe63d44(0x19f),_0x2eadbe),_0x59d742=_0x1e2477[_0x4f604a];if(!_0x59d742)throw CliErrors[_0xe63d44(0x1b7)](_0xe63d44(0x1db));_0x2574d9=_0x59d742[_0xe63d44(0x18b)],_0x1661f2=_0x59d742[_0xe63d44(0x199)];}else{const _0x1fbf97=await listDatasets(_0x468c24[_0xe63d44(0x1da)]);if(_0x1fbf97[_0xe63d44(0x1b9)]===0x0)throw CliErrors[_0xe63d44(0x1b7)](_0xe63d44(0x1c0));const _0x278cb0=_0x1fbf97[_0xe63d44(0x1be)](_0x464405=>_0x464405[_0xe63d44(0x1e9)]+'\x20['+(_0x464405[_0xe63d44(0x1b6)]??'UNKNOWN')+']\x20('+_0x464405[_0xe63d44(0x1bb)]+')'),_0x8049a1=await promptSelect(_0xe63d44(0x19f),_0x278cb0),_0x148216=_0x1fbf97[_0x8049a1];if(!_0x148216)throw CliErrors[_0xe63d44(0x1b7)](_0xe63d44(0x1db));_0x1661f2=_0x148216[_0xe63d44(0x1bb)],_0x2574d9=undefined;}}}}const _0x5e1387=await listDatasets(_0x468c24[_0xe63d44(0x1da)]),_0x2d46e7=_0x5e1387[_0xe63d44(0x18d)](_0x3a401c=>_0x3a401c[_0xe63d44(0x1bb)]===_0x1661f2);if(!_0x2d46e7)throw CliErrors[_0xe63d44(0x1b7)](_0xe63d44(0x1a6)+_0x1661f2+'\x22.\x20'+(_0x2574d9?_0xe63d44(0x186)+CLI_BIN_NAME+_0xe63d44(0x1a1):''));_0x55a4ff=_0x2d46e7['id'];const _0x1ab9ff=_0x2574d9??_0x1661f2,_0x174b81=await listBffDatasetOperations(_0x468c24[_0xe63d44(0x1da)],_0x55a4ff),_0x207f91=_0x174b81?Object[_0xe63d44(0x1e8)](_0x174b81):[];if(_0x207f91['length']===0x0)throw CliErrors[_0xe63d44(0x1b7)](_0xe63d44(0x1e0)+_0x1ab9ff+'.');let _0x1dbab4;const _0x4a7a08=_0x468c24[_0xe63d44(0x1c1)]('operation-type');if(_0x4a7a08){if(!_0x207f91[_0xe63d44(0x192)](_0x4a7a08))throw CliErrors['validation']('Operation\x20type\x20\x22'+_0x4a7a08+_0xe63d44(0x19b)+_0x1ab9ff+'.\x20'+(_0xe63d44(0x1af)+_0x207f91[_0xe63d44(0x1d7)](',\x20')));_0x1dbab4=_0x4a7a08;}else{if(_0x468c24[_0xe63d44(0x1a0)])throw CliErrors['validation'](_0xe63d44(0x19e));const _0x5a2c85=await promptSelect(_0xe63d44(0x190),_0x207f91);_0x1dbab4=_0x207f91[_0x5a2c85]??_0x207f91[0x0];}let _0x28566b=normalizeHookFunctionNode(_0x468c24['str'](_0xe63d44(0x1e1)));if(!_0x28566b){if(_0x468c24[_0xe63d44(0x1c1)](_0xe63d44(0x1e1)))throw CliErrors[_0xe63d44(0x1b7)](_0xe63d44(0x18c));if(_0x468c24['nonInteractive'])throw CliErrors[_0xe63d44(0x1b7)](_0xe63d44(0x191));const _0x5b9562=await promptSelect(_0xe63d44(0x19c),['before',_0xe63d44(0x1cb)]);_0x28566b=[_0xe63d44(0x1d6),_0xe63d44(0x1cb)][_0x5b9562]??_0xe63d44(0x1d6);}return{'alias':_0x2574d9,'datasetCode':_0x1661f2,'datasetId':_0x55a4ff,'operationType':_0x1dbab4,'functionNode':_0x28566b};}async function promptSelect(_0x5c765d,_0x3bbfe0){const _0xf4e3fd=a37_0x52781a;if(_0x3bbfe0[_0xf4e3fd(0x1b9)]===0x1)return 0x0;for(const [_0x486e93,_0x4cd0b1]of _0x3bbfe0['entries']()){process['stderr'][_0xf4e3fd(0x1ca)]('\x20\x20'+(_0x486e93+0x1)+'.\x20'+_0x4cd0b1+'\x0a');}const _0x51b744=createInterface({'input':process['stdin'],'output':process[_0xf4e3fd(0x1bf)]});while(!![]){const _0x4a37df=await new Promise(_0x5173d0=>{const _0x1e8fb2=_0xf4e3fd;_0x51b744[_0x1e8fb2(0x1ba)](_0x5c765d+'\x20',_0x5173d0);}),_0x5cebc5=Number[_0xf4e3fd(0x1a7)](_0x4a37df['trim'](),0xa);if(Number[_0xf4e3fd(0x1b4)](_0x5cebc5)&&_0x5cebc5>=0x1&&_0x5cebc5<=_0x3bbfe0[_0xf4e3fd(0x1b9)])return _0x51b744['close'](),_0x5cebc5-0x1;process['stderr']['write'](_0xf4e3fd(0x1a3)+_0x3bbfe0['length']+'.\x0a');}}function buildFilePath(_0x171b68,_0x402a3c,_0x328028,_0x26df00){const _0x3b2a80=a37_0x52781a;if(_0x402a3c===_0x3b2a80(0x1d3)){if(!_0x26df00)throw CliErrors[_0x3b2a80(0x1b7)](_0x3b2a80(0x1a2));const _0x4c3a9b=_0x26df00[_0x3b2a80(0x18b)]??_0x26df00[_0x3b2a80(0x199)];return join(_0x171b68[_0x3b2a80(0x1eb)],_0x3b2a80(0x1d3),_0x4c3a9b,_0x26df00[_0x3b2a80(0x1a5)],_0x26df00[_0x3b2a80(0x1ad)],_0x328028+'.js');}return join(_0x171b68['scriptsRootDir'],_0x402a3c,_0x328028+_0x3b2a80(0x1ac));}export function generateTemplate(_0x56c821,_0x32e0f7,_0x21b1e0,_0x20b26c,_0x2738f6){const _0x2935ff=a37_0x52781a,_0xa8b1d3=_0x20b26c?.[_0x2935ff(0x196)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x192120=getAppBaseUrl(_0x21b1e0),_0xbc21c5='\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)';if(_0x56c821==='COMMON')return _0x2935ff(0x1a8)+_0xa8b1d3+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x32e0f7+_0x2935ff(0x1ae)+_0x192120+_0x2935ff(0x18e)+_0x21b1e0+'/COMMON/'+_0x32e0f7+_0x2935ff(0x1ab)+_0x32e0f7+_0x2935ff(0x1d1)+_0xbc21c5+_0x2935ff(0x1b0)+_0x32e0f7+_0x2935ff(0x1d0);if(_0x56c821===_0x2935ff(0x19d))return _0x2935ff(0x1a8)+_0xa8b1d3+_0x2935ff(0x1e4)+_0x32e0f7+_0x2935ff(0x1b5)+_0x21b1e0+'/'+_0x32e0f7+_0x2935ff(0x1ae)+_0x192120+_0x2935ff(0x18e)+_0x21b1e0+'/ENDPOINT/'+_0x32e0f7+_0x2935ff(0x1c2)+_0xbc21c5+'\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'+_0x32e0f7+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x2738f6)throw CliErrors[_0x2935ff(0x1b7)](_0x2935ff(0x1c9));const _0x3bdc20=_0x2738f6[_0x2935ff(0x18b)]??_0x2738f6[_0x2935ff(0x199)],_0x34d68c=_0x2738f6[_0x2935ff(0x1ad)]==='before'?_0x2935ff(0x1d4):_0x2935ff(0x193),_0x3664a5=_0x2738f6[_0x2935ff(0x1ad)]===_0x2935ff(0x1d6)?_0x2935ff(0x195):'修改后的响应结果';return'/**\x0a\x20*\x20'+_0xa8b1d3+_0x2935ff(0x18f)+_0x32e0f7+_0x2935ff(0x194)+_0x21b1e0+'/'+_0x2738f6[_0x2935ff(0x199)]+'/'+_0x2738f6[_0x2935ff(0x1a5)]+_0x2935ff(0x1ae)+_0x192120+_0x2935ff(0x1cc)+_0x2738f6[_0x2935ff(0x1b3)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x21b1e0+_0x2935ff(0x185)+_0x3bdc20+'/'+_0x2738f6['operationType']+'/'+_0x2738f6[_0x2935ff(0x1ad)]+'/'+_0x32e0f7+_0x2935ff(0x1dc)+_0x2738f6['functionNode']+'\x0a'+_0xbc21c5+_0x2935ff(0x188)+_0x34d68c+'\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20'+_0x3664a5+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x32e0f7+_0x2935ff(0x1d0);}
1
+ function a37_0x3eef(){const _0x419761=['90FLbSEy','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','/HOOK/','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','Created\x20','Alias\x20\x22','Dataset\x20not\x20found\x20for\x20code\x20\x22','datasetcode','3249336VEeseM','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','entries','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','currentApp','function-node','2206425HlgWyZ','alias','\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','Invalid\x20dataset\x20selection.','operationType','6525FiAiKs','Trigger\x20node\x20(HOOK\x20only)','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','Script\x20type','Available:\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','209hCsRzh','/ENDPOINT/','datasetCode','修改后的响应结果','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','map','str','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','write','keys','isInteger','length','operation-type','\x0a\x20*\x20[平台配置]\x20','functionNode','73409RdUPXE','type','/data/dataset/','/**\x0a\x20*\x20','33amuQPv','scriptsRootDir','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','after','before','string','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','description','parseInt','selectedAppName','COMMON','bff','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','.js\x0a\x20*\x20[触发节点]\x20','8ClaZIT','filePath','\x22.\x20','join','tableName','UNKNOWN','appCode','read','Invalid\x20function\x20name\x20\x22','Operation\x20type\x20\x22','\x20function:\x20','name','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20',']\x20(','Script\x20description','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','create','No\x20datasets\x20found\x20for\x20this\x20app.','code','Operation\x20type\x20(HOOK\x20only)','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','Select\x20operation\x20type:','修改后的请求参数','ENDPOINT','datasetId','nonInteractive','validation','stderr','679330HgNFaJ','apiDir','source','HOOK\x20requires\x20alias/operation/node\x20options.','316326jhFBcn','mergedCli','当前响应结果','/COMMON/','HOOK','\x22,\x20params\x20})\x0a','find','profileName','3484pUGhPJ','trim','utf8','.js','File\x20already\x20exists:\x20','7568yjTnyX','Select\x20dataset:'];a37_0x3eef=function(){return _0x419761;};return a37_0x3eef();}const a37_0x16b259=a37_0x663e;(function(_0x3e407b,_0x353b9c){const _0x2b2846=a37_0x663e,_0x20b18e=_0x3e407b();while(!![]){try{const _0x30dddd=parseInt(_0x2b2846(0x1a9))/0x1*(parseInt(_0x2b2846(0x1f4))/0x2)+-parseInt(_0x2b2846(0x1ec))/0x3*(-parseInt(_0x2b2846(0x1ca))/0x4)+parseInt(_0x2b2846(0x19e))/0x5+-parseInt(_0x2b2846(0x1fb))/0x6*(-parseInt(_0x2b2846(0x1b8))/0x7)+parseInt(_0x2b2846(0x1f9))/0x8*(-parseInt(_0x2b2846(0x1a3))/0x9)+parseInt(_0x2b2846(0x1e8))/0xa*(parseInt(_0x2b2846(0x1bc))/0xb)+-parseInt(_0x2b2846(0x198))/0xc;if(_0x30dddd===_0x353b9c)break;else _0x20b18e['push'](_0x20b18e['shift']());}catch(_0x84d5a3){_0x20b18e['push'](_0x20b18e['shift']());}}}(a37_0x3eef,0x66b73));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';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a37_0x663e(_0xb995ac,_0x1af432){_0xb995ac=_0xb995ac-0x192;const _0x3eefc9=a37_0x3eef();let _0x663e22=_0x3eefc9[_0xb995ac];return _0x663e22;}import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x16b259(0x1c7),'command':a37_0x16b259(0x1da),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a37_0x16b259(0x1d1),'flags':[{'name':a37_0x16b259(0x1b9),'type':a37_0x16b259(0x1c1),'required':!![],'enum':[a37_0x16b259(0x1c6),'ENDPOINT',a37_0x16b259(0x1f0)],'description':a37_0x16b259(0x1a6)},{'name':a37_0x16b259(0x1d5),'type':a37_0x16b259(0x1c1),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x16b259(0x1c3),'type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1d8)},{'name':'alias','type':a37_0x16b259(0x1c1),'description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a37_0x16b259(0x197),'type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1d9)},{'name':'operation-type','type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1dd)},{'name':a37_0x16b259(0x19d),'type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1a4),'enum':[a37_0x16b259(0x1c0),a37_0x16b259(0x1bf)]}],async 'validate'(_0x7098ad){const _0x4cbb09=a37_0x16b259,_0x2e4ae1=_0x7098ad[_0x4cbb09(0x1af)]('name');if(!isValidBffFunctionName(_0x2e4ae1))throw CliErrors[_0x4cbb09(0x1e6)](_0x4cbb09(0x1d2)+_0x2e4ae1+_0x4cbb09(0x1fc));},async 'execute'(_0x5331cd){const _0x11f538=a37_0x16b259,_0x33d36c=loadBffProjectConfig(_0x5331cd['appCode']),_0x3727bb=_0x5331cd[_0x11f538(0x1af)]('type'),_0x1a6da1=_0x5331cd[_0x11f538(0x1af)](_0x11f538(0x1d5)),_0x45e66d=_0x5331cd[_0x11f538(0x1af)](_0x11f538(0x1c3))||undefined,_0x22c3c5=_0x3727bb===_0x11f538(0x1f0)?await resolveHookOptions(_0x33d36c,_0x5331cd):undefined,_0x35a5b5=buildFilePath(_0x33d36c,_0x3727bb,_0x1a6da1,_0x22c3c5);if(await fileExists(_0x35a5b5))throw CliErrors['validation'](_0x11f538(0x1f8)+_0x35a5b5);await mkdir(dirname(_0x35a5b5),{'recursive':!![]});const _0x30f73f=generateTemplate(_0x3727bb,_0x1a6da1,_0x5331cd['appCode'],_0x45e66d,_0x22c3c5);await writeFile(_0x35a5b5,_0x30f73f,_0x11f538(0x1f6));const _0x2d1ea4={'type':_0x3727bb,'name':_0x1a6da1,'path':_0x35a5b5};if(_0x45e66d)_0x2d1ea4[_0x11f538(0x1c3)]=_0x45e66d;if(_0x22c3c5){if(_0x22c3c5[_0x11f538(0x19f)])_0x2d1ea4[_0x11f538(0x19f)]=_0x22c3c5[_0x11f538(0x19f)];_0x2d1ea4[_0x11f538(0x1ab)]=_0x22c3c5[_0x11f538(0x1ab)],_0x2d1ea4['operationType']=_0x22c3c5['operationType'],_0x2d1ea4['functionNode']=_0x22c3c5['functionNode'];}return{'ok':!![],'data':_0x2d1ea4,'message':_0x11f538(0x194)+_0x3727bb+_0x11f538(0x1d4)+_0x1a6da1};}};async function resolveHookOptions(_0x345396,_0x5bed8f){const _0x146675=a37_0x16b259,_0xf4bbd7=resolveApiModelSource(_0x5bed8f[_0x146675(0x1e9)],_0x5bed8f[_0x146675(0x1d0)],_0x5bed8f[_0x146675(0x1c5)]||_0x5bed8f[_0x146675(0x1ed)]?.[_0x146675(0x19c)]||_0x5bed8f['mergedCli']?.['defaultApp']),_0x379f5c=loadAliasMap(_0x5bed8f[_0x146675(0x1e9)],undefined,_0xf4bbd7[_0x146675(0x1cb)],_0xf4bbd7['profileName']),_0x2263dd=_0x379f5c[_0x146675(0x1b4)]>0x0;let _0x116ab4,_0x34b2e7,_0xf63863;const _0x3dfd0a=_0x5bed8f[_0x146675(0x1af)](_0x146675(0x19f)),_0x2ac7d7=_0x5bed8f[_0x146675(0x1af)](_0x146675(0x197));if(_0x3dfd0a){const _0x1544f1=resolveAlias(_0x5bed8f['apiDir'],_0x3dfd0a,undefined,_0xf4bbd7[_0x146675(0x1cb)],_0xf4bbd7[_0x146675(0x1f3)]);if(!_0x1544f1){const _0x298249=_0x2263dd?'Available\x20aliases:\x20'+_0x379f5c[_0x146675(0x1ae)](_0x5111ed=>_0x5111ed[_0x146675(0x19f)])['join'](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+_0x146675(0x1a5);throw CliErrors['validation'](_0x146675(0x195)+_0x3dfd0a+'\x22\x20not\x20found.\x20'+_0x298249);}_0x116ab4=_0x3dfd0a,_0x34b2e7=_0x1544f1;}else{if(_0x2ac7d7){_0x34b2e7=_0x2ac7d7;const _0x59b148=_0x379f5c[_0x146675(0x1f2)](_0x553a45=>_0x553a45[_0x146675(0x1ab)]===_0x2ac7d7);_0x116ab4=_0x59b148?.[_0x146675(0x19f)];}else{if(_0x5bed8f[_0x146675(0x1e5)])throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1de));else{if(_0x2263dd){const _0x4757cc=_0x379f5c[_0x146675(0x1ae)](_0x5eed00=>_0x5eed00[_0x146675(0x19f)]+'\x20('+_0x5eed00[_0x146675(0x1ce)]+')'),_0xc1c6d5=await promptSelect(_0x146675(0x1fa),_0x4757cc),_0x4e5579=_0x379f5c[_0xc1c6d5];if(!_0x4e5579)throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1a1));_0x116ab4=_0x4e5579[_0x146675(0x19f)],_0x34b2e7=_0x4e5579[_0x146675(0x1ab)];}else{const _0x521514=await listDatasets(_0x5bed8f[_0x146675(0x1d0)]);if(_0x521514[_0x146675(0x1b4)]===0x0)throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1db));const _0x16c3bb=_0x521514[_0x146675(0x1ae)](_0x170e32=>_0x170e32['name']+'\x20['+(_0x170e32[_0x146675(0x1ea)]??_0x146675(0x1cf))+_0x146675(0x1d7)+_0x170e32[_0x146675(0x1dc)]+')'),_0x2e6789=await promptSelect(_0x146675(0x1fa),_0x16c3bb),_0x55d227=_0x521514[_0x2e6789];if(!_0x55d227)throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1a1));_0x34b2e7=_0x55d227['code'],_0x116ab4=undefined;}}}}const _0x333524=await listDatasets(_0x5bed8f[_0x146675(0x1d0)]),_0x1c041f=_0x333524[_0x146675(0x1f2)](_0x18f386=>_0x18f386[_0x146675(0x1dc)]===_0x34b2e7);if(!_0x1c041f)throw CliErrors['validation'](_0x146675(0x196)+_0x34b2e7+_0x146675(0x1cc)+(_0x116ab4?_0x146675(0x1df)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0xf63863=_0x1c041f['id'];const _0x55e1c2=_0x116ab4??_0x34b2e7,_0x1ee03d=await listBffDatasetOperations(_0x5bed8f['appCode'],_0xf63863),_0x452439=_0x1ee03d?Object[_0x146675(0x1b2)](_0x1ee03d):[];if(_0x452439[_0x146675(0x1b4)]===0x0)throw CliErrors[_0x146675(0x1e6)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x55e1c2+'.');let _0x28356b;const _0x9e607a=_0x5bed8f['str'](_0x146675(0x1b5));if(_0x9e607a){if(!_0x452439['includes'](_0x9e607a))throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1d3)+_0x9e607a+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x55e1c2+'.\x20'+(_0x146675(0x1a7)+_0x452439[_0x146675(0x1cd)](',\x20')));_0x28356b=_0x9e607a;}else{if(_0x5bed8f[_0x146675(0x1e5)])throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1be));const _0x4b6a31=await promptSelect(_0x146675(0x1e1),_0x452439);_0x28356b=_0x452439[_0x4b6a31]??_0x452439[0x0];}let _0x3fbd4f=normalizeHookFunctionNode(_0x5bed8f[_0x146675(0x1af)]('function-node'));if(!_0x3fbd4f){if(_0x5bed8f[_0x146675(0x1af)](_0x146675(0x19d)))throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1e0));if(_0x5bed8f[_0x146675(0x1e5)])throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1b0));const _0x7647be=await promptSelect('Select\x20trigger\x20node:',[_0x146675(0x1c0),_0x146675(0x1bf)]);_0x3fbd4f=[_0x146675(0x1c0),_0x146675(0x1bf)][_0x7647be]??_0x146675(0x1c0);}return{'alias':_0x116ab4,'datasetCode':_0x34b2e7,'datasetId':_0xf63863,'operationType':_0x28356b,'functionNode':_0x3fbd4f};}async function promptSelect(_0x3362ac,_0x472466){const _0x30d236=a37_0x16b259;if(_0x472466['length']===0x1)return 0x0;for(const [_0x2645c7,_0x5da07e]of _0x472466[_0x30d236(0x19a)]()){process[_0x30d236(0x1e7)]['write']('\x20\x20'+(_0x2645c7+0x1)+'.\x20'+_0x5da07e+'\x0a');}const _0x3bdb3c=createInterface({'input':process['stdin'],'output':process[_0x30d236(0x1e7)]});while(!![]){const _0x2f195b=await new Promise(_0x2ad028=>{_0x3bdb3c['question'](_0x3362ac+'\x20',_0x2ad028);}),_0x1ab56f=Number[_0x30d236(0x1c4)](_0x2f195b['trim'](),0xa);if(Number[_0x30d236(0x1b3)](_0x1ab56f)&&_0x1ab56f>=0x1&&_0x1ab56f<=_0x472466[_0x30d236(0x1b4)])return _0x3bdb3c['close'](),_0x1ab56f-0x1;process[_0x30d236(0x1e7)][_0x30d236(0x1b1)](_0x30d236(0x1c2)+_0x472466[_0x30d236(0x1b4)]+'.\x0a');}}function buildFilePath(_0x3e585e,_0x381d84,_0x541416,_0x827ae8){const _0x4170b5=a37_0x16b259;if(_0x381d84==='HOOK'){if(!_0x827ae8)throw CliErrors[_0x4170b5(0x1e6)](_0x4170b5(0x1eb));const _0x6daf29=_0x827ae8[_0x4170b5(0x19f)]??_0x827ae8[_0x4170b5(0x1ab)];return join(_0x3e585e[_0x4170b5(0x1bd)],_0x4170b5(0x1f0),_0x6daf29,_0x827ae8[_0x4170b5(0x1a2)],_0x827ae8[_0x4170b5(0x1b7)],_0x541416+_0x4170b5(0x1f7));}return join(_0x3e585e['scriptsRootDir'],_0x381d84,_0x541416+_0x4170b5(0x1f7));}export function generateTemplate(_0x71ce88,_0x3d87e7,_0x2ff443,_0x26535a,_0x555129){const _0x24c493=a37_0x16b259,_0x7b6472=_0x26535a?.[_0x24c493(0x1f5)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3b9e88=getAppBaseUrl(_0x2ff443),_0x25c06d='\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)';if(_0x71ce88==='COMMON')return _0x24c493(0x1bb)+_0x7b6472+_0x24c493(0x193)+_0x3d87e7+_0x24c493(0x1b6)+_0x3b9e88+_0x24c493(0x199)+_0x2ff443+_0x24c493(0x1ef)+_0x3d87e7+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x3d87e7+_0x24c493(0x1f1)+_0x25c06d+_0x24c493(0x1a0)+_0x3d87e7+_0x24c493(0x19b);if(_0x71ce88===_0x24c493(0x1e3))return _0x24c493(0x1bb)+_0x7b6472+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x3d87e7+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/'+_0x2ff443+'/'+_0x3d87e7+_0x24c493(0x1b6)+_0x3b9e88+_0x24c493(0x199)+_0x2ff443+_0x24c493(0x1aa)+_0x3d87e7+'.js\x0a'+_0x25c06d+'\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'+_0x3d87e7+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x555129)throw CliErrors['validation']('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x28e266=_0x555129[_0x24c493(0x19f)]??_0x555129[_0x24c493(0x1ab)],_0x10e072=_0x555129[_0x24c493(0x1b7)]===_0x24c493(0x1c0)?'当前请求参数':_0x24c493(0x1ee),_0x336c4c=_0x555129[_0x24c493(0x1b7)]===_0x24c493(0x1c0)?_0x24c493(0x1e2):_0x24c493(0x1ac);return'/**\x0a\x20*\x20'+_0x7b6472+_0x24c493(0x192)+_0x3d87e7+_0x24c493(0x1ad)+_0x2ff443+'/'+_0x555129[_0x24c493(0x1ab)]+'/'+_0x555129[_0x24c493(0x1a2)]+_0x24c493(0x1b6)+_0x3b9e88+_0x24c493(0x1ba)+_0x555129[_0x24c493(0x1e4)]+_0x24c493(0x1c8)+_0x2ff443+_0x24c493(0x1fd)+_0x28e266+'/'+_0x555129[_0x24c493(0x1a2)]+'/'+_0x555129['functionNode']+'/'+_0x3d87e7+_0x24c493(0x1c9)+_0x555129[_0x24c493(0x1b7)]+'\x0a'+_0x25c06d+_0x24c493(0x1a8)+_0x10e072+_0x24c493(0x1d6)+_0x336c4c+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x3d87e7+_0x24c493(0x19b);}
@@ -1 +1 @@
1
- const a38_0x2e7788=a38_0x246f;(function(_0x5bb2e1,_0x325086){const _0xa4da2f=a38_0x246f,_0x4e2ae3=_0x5bb2e1();while(!![]){try{const _0x4cd02e=parseInt(_0xa4da2f(0x12b))/0x1*(parseInt(_0xa4da2f(0x105))/0x2)+parseInt(_0xa4da2f(0x12d))/0x3+-parseInt(_0xa4da2f(0x101))/0x4+-parseInt(_0xa4da2f(0x119))/0x5+parseInt(_0xa4da2f(0x116))/0x6*(-parseInt(_0xa4da2f(0x103))/0x7)+parseInt(_0xa4da2f(0x11a))/0x8*(-parseInt(_0xa4da2f(0x121))/0x9)+parseInt(_0xa4da2f(0x123))/0xa;if(_0x4cd02e===_0x325086)break;else _0x4e2ae3['push'](_0x4e2ae3['shift']());}catch(_0x473d89){_0x4e2ae3['push'](_0x4e2ae3['shift']());}}}(a38_0x3b02,0x1b1af));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';function a38_0x246f(_0x2c3b7d,_0x22359d){_0x2c3b7d=_0x2c3b7d-0xfd;const _0x3b0238=a38_0x3b02();let _0x246ff2=_0x3b0238[_0x2c3b7d];return _0x246ff2;}function a38_0x3b02(){const _0xf01dae=['filter','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','1xRezRO','delete','266496YPYLIv','projectRoot','target','lastSync','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','high-risk-write','replace','372716KGLAkZ','bff','4984WvFJca','split','22170xfcpjw','/api/management/library/scripts/delete','join','appCode','includes','Multiple\x20functions\x20match\x20\x22','validation','functions','Backend\x20Function\x20lock\x20file\x20not\x20found.','stringify','\x22\x20not\x20found\x20after\x20ensureLockScope.','scriptsRootDir','length','\x20\x20-\x20','Lock\x20scope\x20for\x20app\x20\x22','scriptsRoot','\x20(local\x20file\x20moved\x20to\x20trash)','936kszLxO','Function\x20not\x20found:\x20','find','1051385yhiIKh','64VYTDkn','str','No\x20lock\x20entry\x20found\x20for\x20\x22','POST','string','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','trashDir','10458qVqXmG','remoteId','4349300ygufBq','keys','lockFilePath','toISOString','startsWith','<timestamp>'];a38_0x3b02=function(){return _0xf01dae;};return a38_0x3b02();}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_0x2e7788(0x102),'command':'delete','description':a38_0x2e7788(0xfd),'risk':a38_0x2e7788(0xff),'flags':[{'name':a38_0x2e7788(0x12f),'type':a38_0x2e7788(0x11e),'required':!![],'description':a38_0x2e7788(0x12a)}],async 'validate'(_0x3b6871){const _0x2e44d4=a38_0x2e7788,_0x3615af=loadBffProjectConfig(_0x3b6871[_0x2e44d4(0x108)]),_0x232e5c=await readBffLockFile(_0x3615af[_0x2e44d4(0x125)]);if(!_0x232e5c)throw CliErrors[_0x2e44d4(0x10b)]('Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.');},async 'dryRun'(_0x49fc9c){const _0x5757d3=a38_0x2e7788,_0x282e12=loadBffProjectConfig(_0x49fc9c[_0x5757d3(0x108)]),_0x2a7e19=await readBffLockFile(_0x282e12[_0x5757d3(0x125)]);if(!_0x2a7e19)throw CliErrors[_0x5757d3(0x10b)](_0x5757d3(0x10d));const {appLock:_0x1859cf}=ensureLockScope(_0x2a7e19,_0x49fc9c[_0x5757d3(0x108)],_0x282e12[_0x5757d3(0x114)],_0x5757d3(0x12c)),_0x21a165=_0x49fc9c[_0x5757d3(0x11b)](_0x5757d3(0x12f)),_0x579eaa=Object[_0x5757d3(0x124)](_0x1859cf[_0x5757d3(0x10c)]),_0x1064d8=resolveDeleteTarget(_0x21a165,_0x579eaa),_0x304266=_0x1859cf[_0x5757d3(0x10c)][_0x1064d8];if(!_0x304266)throw CliErrors[_0x5757d3(0x10b)](_0x5757d3(0x11c)+_0x1064d8+'\x22.');const _0x27de53=resolveLocalFilePathFromLockKey(_0x282e12,_0x1064d8),_0x2516b1=relative(_0x282e12[_0x5757d3(0x12e)],_0x27de53),_0x58aba5=join(_0x282e12[_0x5757d3(0x120)],_0x5757d3(0x128),_0x2516b1);return{'method':_0x5757d3(0x11d),'url':_0x5757d3(0x106),'body':{'appCode':_0x49fc9c[_0x5757d3(0x108)],'target':_0x1064d8,'remoteId':_0x304266['remoteId'],'localFilePath':_0x27de53,'trashedPath':_0x58aba5},'description':'Would\x20delete\x20'+_0x1064d8+_0x5757d3(0x11f)};},async 'execute'(_0x513f5a){const _0x50132a=a38_0x2e7788,_0x1fcdb4=loadBffProjectConfig(_0x513f5a[_0x50132a(0x108)]),_0x1c7a5b=await readBffLockFile(_0x1fcdb4[_0x50132a(0x125)]);if(!_0x1c7a5b)throw CliErrors['validation'](_0x50132a(0x10d));const {lockData:_0x4d4f75,appLock:_0x1f5753}=ensureLockScope(_0x1c7a5b,_0x513f5a['appCode'],_0x1fcdb4['scriptsRoot'],_0x50132a(0x12c)),_0x48883d=JSON['parse'](JSON[_0x50132a(0x10e)](_0x4d4f75)),_0x5b7452=_0x48883d['apps'][_0x513f5a[_0x50132a(0x108)]];if(!_0x5b7452)throw new Error(_0x50132a(0x113)+_0x513f5a[_0x50132a(0x108)]+_0x50132a(0x10f));const _0x278cd7=_0x513f5a[_0x50132a(0x11b)](_0x50132a(0x12f)),_0xa50f5a=Object[_0x50132a(0x124)](_0x5b7452[_0x50132a(0x10c)]),_0x34fd84=resolveDeleteTarget(_0x278cd7,_0xa50f5a),_0x285645=_0x5b7452[_0x50132a(0x10c)][_0x34fd84];if(!_0x285645)throw CliErrors[_0x50132a(0x10b)](_0x50132a(0x11c)+_0x34fd84+'\x22.');await deleteBffScript(_0x285645['remoteId']),delete _0x5b7452[_0x50132a(0x10c)][_0x34fd84],_0x5b7452[_0x50132a(0x130)]=new Date()[_0x50132a(0x126)](),await writeBffLockFile(_0x1fcdb4['lockFilePath'],_0x48883d);const _0x269a01=resolveLocalFilePathFromLockKey(_0x1fcdb4,_0x34fd84);let _0x55cd7a;await fileExists(_0x269a01)&&(_0x55cd7a=await moveToTrash(_0x1fcdb4[_0x50132a(0x12e)],_0x1fcdb4['trashDir'],_0x269a01),await cleanupEmptyDirectories(dirname(_0x269a01),_0x1fcdb4[_0x50132a(0x110)]));await waitForDeleteSettlement(_0x1fcdb4[_0x50132a(0x125)],_0x513f5a[_0x50132a(0x108)],_0x34fd84,_0x269a01),await sleep(0x96);const _0x2b79f6={'deleted':_0x34fd84,'remoteId':_0x285645[_0x50132a(0x122)]};if(_0x55cd7a)_0x2b79f6['trashedTo']=_0x55cd7a;return{'ok':!![],'data':_0x2b79f6,'message':'Deleted\x20'+_0x34fd84+(_0x55cd7a?_0x50132a(0x115):'')};}};function resolveDeleteTarget(_0x134714,_0x841200){const _0x3f8bd3=a38_0x2e7788;if(_0x134714[_0x3f8bd3(0x109)]('/')){const _0x269b1c=_0x841200[_0x3f8bd3(0x118)](_0x208966=>_0x208966===_0x134714);if(!_0x269b1c)throw CliErrors[_0x3f8bd3(0x10b)]('Function\x20not\x20found:\x20'+_0x134714);return _0x269b1c;}const _0x16d9be=_0x841200[_0x3f8bd3(0x129)](_0x37c7d8=>_0x37c7d8[_0x3f8bd3(0x104)]('/')['at'](-0x1)===_0x134714);if(_0x16d9be[_0x3f8bd3(0x111)]===0x0)throw CliErrors[_0x3f8bd3(0x10b)](_0x3f8bd3(0x117)+_0x134714);if(_0x16d9be[_0x3f8bd3(0x111)]>0x1)throw CliErrors['validation'](_0x3f8bd3(0x10a)+_0x134714+_0x3f8bd3(0xfe)+_0x16d9be['map'](_0x4279e7=>_0x3f8bd3(0x112)+_0x4279e7)[_0x3f8bd3(0x107)]('\x0a'));return _0x16d9be[0x0];}async function moveToTrash(_0x14322e,_0x3b61d3,_0x1dcee3){const _0x46b1b8=a38_0x2e7788,_0x15f332=new Date()[_0x46b1b8(0x126)]()[_0x46b1b8(0x100)](/[:.]/g,'-'),_0x1d4621=relative(_0x14322e,_0x1dcee3),_0x1170a4=join(_0x3b61d3,_0x15f332,_0x1d4621);return await mkdir(dirname(_0x1170a4),{'recursive':!![]}),await rename(_0x1dcee3,_0x1170a4),_0x1170a4;}async function cleanupEmptyDirectories(_0xbf3228,_0x38d381){const _0xde3e4f=a38_0x2e7788;let _0x396437=resolve(_0xbf3228);const _0x102137=resolve(_0x38d381);while(_0x396437[_0xde3e4f(0x127)](''+_0x102137+sep)||_0x396437===_0x102137){if(_0x396437===_0x102137)return;try{const _0x276c40=await readdir(_0x396437);if(_0x276c40[_0xde3e4f(0x111)]>0x0)return;await rmdir(_0x396437);}catch{return;}_0x396437=dirname(_0x396437);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x4403b9,_0x4424f6,_0x23ae54,_0x139133){const _0x3ce2c4=a38_0x2e7788;for(let _0x4c20ed=0x0;_0x4c20ed<DELETE_SETTLE_RETRY_COUNT;_0x4c20ed+=0x1){const _0x5434b6=await readBffLockFile(_0x4403b9),_0x51a5ce=!!_0x5434b6?.['apps']?.[_0x4424f6]?.[_0x3ce2c4(0x10c)]?.[_0x23ae54],_0x15c8b2=await fileExists(_0x139133);if(!_0x51a5ce&&!_0x15c8b2)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error('Local\x20delete\x20not\x20settled\x20for\x20'+_0x23ae54+'.');}
1
+ const a38_0x27ef82=a38_0x3240;(function(_0x1796f7,_0x2908d4){const _0x31d843=a38_0x3240,_0x4268c3=_0x1796f7();while(!![]){try{const _0xc5782e=parseInt(_0x31d843(0x175))/0x1*(parseInt(_0x31d843(0x16b))/0x2)+parseInt(_0x31d843(0x171))/0x3*(-parseInt(_0x31d843(0x177))/0x4)+parseInt(_0x31d843(0x15a))/0x5+parseInt(_0x31d843(0x164))/0x6+parseInt(_0x31d843(0x16d))/0x7+-parseInt(_0x31d843(0x151))/0x8+parseInt(_0x31d843(0x17b))/0x9*(-parseInt(_0x31d843(0x17c))/0xa);if(_0xc5782e===_0x2908d4)break;else _0x4268c3['push'](_0x4268c3['shift']());}catch(_0x41c437){_0x4268c3['push'](_0x4268c3['shift']());}}}(a38_0x3e0c,0xb9109));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a38_0x3e0c(){const _0x4c1340=['replace','target','functions','Would\x20delete\x20','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','22SoHWWr','/api/management/library/scripts/delete','7071953FTKuQL','str','validation','join','3666009hkLtjx','keys','scriptsRootDir','startsWith','58361OBVnVu','trashedTo','4hHGQVg','remoteId','apps','\x20(local\x20file\x20moved\x20to\x20trash)','60867dReUJc','2650HuPykk','projectRoot','map','Function\x20not\x20found:\x20','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','appCode','toISOString','\x22\x20not\x20found\x20after\x20ensureLockScope.','bff','314976syKcxX','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','length','find','Lock\x20scope\x20for\x20app\x20\x22','Deleted\x20','high-risk-write','split','Local\x20delete\x20not\x20settled\x20for\x20','3537995akBwkN','lockFilePath','Backend\x20Function\x20lock\x20file\x20not\x20found.','trashDir','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','scriptsRoot','string','lastSync','Multiple\x20functions\x20match\x20\x22','delete','8710476pBXMkl','No\x20lock\x20entry\x20found\x20for\x20\x22'];a38_0x3e0c=function(){return _0x4c1340;};return a38_0x3e0c();}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_0x27ef82(0x150),'command':'delete','description':a38_0x27ef82(0x16a),'risk':a38_0x27ef82(0x157),'flags':[{'name':a38_0x27ef82(0x167),'type':a38_0x27ef82(0x160),'required':!![],'description':a38_0x27ef82(0x15e)}],async 'validate'(_0x334ea5){const _0x42069f=a38_0x27ef82,_0x2e40d5=loadBffProjectConfig(_0x334ea5[_0x42069f(0x14d)]),_0x4b58c4=await readBffLockFile(_0x2e40d5['lockFilePath']);if(!_0x4b58c4)throw CliErrors[_0x42069f(0x16f)](_0x42069f(0x152));},async 'dryRun'(_0x186daf){const _0x50670b=a38_0x27ef82,_0x1d17bb=loadBffProjectConfig(_0x186daf[_0x50670b(0x14d)]),_0x2f9000=await readBffLockFile(_0x1d17bb[_0x50670b(0x15b)]);if(!_0x2f9000)throw CliErrors['validation'](_0x50670b(0x15c));const {appLock:_0x277eef}=ensureLockScope(_0x2f9000,_0x186daf[_0x50670b(0x14d)],_0x1d17bb[_0x50670b(0x15f)],_0x50670b(0x163)),_0x1ad542=_0x186daf[_0x50670b(0x16e)](_0x50670b(0x167)),_0x1fa66f=Object[_0x50670b(0x172)](_0x277eef['functions']),_0x2ee6ce=resolveDeleteTarget(_0x1ad542,_0x1fa66f),_0x301787=_0x277eef[_0x50670b(0x168)][_0x2ee6ce];if(!_0x301787)throw CliErrors[_0x50670b(0x16f)](_0x50670b(0x165)+_0x2ee6ce+'\x22.');const _0x2363d3=resolveLocalFilePathFromLockKey(_0x1d17bb,_0x2ee6ce),_0x92ad89=relative(_0x1d17bb['projectRoot'],_0x2363d3),_0x42f645=join(_0x1d17bb['trashDir'],'<timestamp>',_0x92ad89);return{'method':'POST','url':_0x50670b(0x16c),'body':{'appCode':_0x186daf[_0x50670b(0x14d)],'target':_0x2ee6ce,'remoteId':_0x301787[_0x50670b(0x178)],'localFilePath':_0x2363d3,'trashedPath':_0x42f645},'description':_0x50670b(0x169)+_0x2ee6ce+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash'};},async 'execute'(_0x3cb6bf){const _0xc685e3=a38_0x27ef82,_0x13e9c5=loadBffProjectConfig(_0x3cb6bf[_0xc685e3(0x14d)]),_0x3023e6=await readBffLockFile(_0x13e9c5[_0xc685e3(0x15b)]);if(!_0x3023e6)throw CliErrors[_0xc685e3(0x16f)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {lockData:_0x18355d,appLock:_0x178c5f}=ensureLockScope(_0x3023e6,_0x3cb6bf[_0xc685e3(0x14d)],_0x13e9c5[_0xc685e3(0x15f)],_0xc685e3(0x163)),_0x212ff0=JSON['parse'](JSON['stringify'](_0x18355d)),_0x598eae=_0x212ff0[_0xc685e3(0x179)][_0x3cb6bf[_0xc685e3(0x14d)]];if(!_0x598eae)throw new Error(_0xc685e3(0x155)+_0x3cb6bf[_0xc685e3(0x14d)]+_0xc685e3(0x14f));const _0x2813fd=_0x3cb6bf[_0xc685e3(0x16e)](_0xc685e3(0x167)),_0x52c131=Object['keys'](_0x598eae[_0xc685e3(0x168)]),_0xdfecf6=resolveDeleteTarget(_0x2813fd,_0x52c131),_0x15b7fb=_0x598eae[_0xc685e3(0x168)][_0xdfecf6];if(!_0x15b7fb)throw CliErrors['validation'](_0xc685e3(0x165)+_0xdfecf6+'\x22.');await deleteBffScript(_0x15b7fb[_0xc685e3(0x178)]),delete _0x598eae[_0xc685e3(0x168)][_0xdfecf6],_0x598eae[_0xc685e3(0x161)]=new Date()[_0xc685e3(0x14e)](),await writeBffLockFile(_0x13e9c5['lockFilePath'],_0x212ff0);const _0x4b24a0=resolveLocalFilePathFromLockKey(_0x13e9c5,_0xdfecf6);let _0x19c315;await fileExists(_0x4b24a0)&&(_0x19c315=await moveToTrash(_0x13e9c5[_0xc685e3(0x149)],_0x13e9c5[_0xc685e3(0x15d)],_0x4b24a0),await cleanupEmptyDirectories(dirname(_0x4b24a0),_0x13e9c5[_0xc685e3(0x173)]));await waitForDeleteSettlement(_0x13e9c5[_0xc685e3(0x15b)],_0x3cb6bf['appCode'],_0xdfecf6,_0x4b24a0),await sleep(0x96);const _0x439ef8={'deleted':_0xdfecf6,'remoteId':_0x15b7fb['remoteId']};if(_0x19c315)_0x439ef8[_0xc685e3(0x176)]=_0x19c315;return{'ok':!![],'data':_0x439ef8,'message':_0xc685e3(0x156)+_0xdfecf6+(_0x19c315?_0xc685e3(0x17a):'')};}};function a38_0x3240(_0x1297af,_0x2554fc){_0x1297af=_0x1297af-0x149;const _0x3e0c03=a38_0x3e0c();let _0x3240e1=_0x3e0c03[_0x1297af];return _0x3240e1;}function resolveDeleteTarget(_0x31dfa9,_0x2cd21a){const _0x4871f4=a38_0x27ef82;if(_0x31dfa9['includes']('/')){const _0x4a91ab=_0x2cd21a[_0x4871f4(0x154)](_0x5c415a=>_0x5c415a===_0x31dfa9);if(!_0x4a91ab)throw CliErrors[_0x4871f4(0x16f)](_0x4871f4(0x14b)+_0x31dfa9);return _0x4a91ab;}const _0x2a88c9=_0x2cd21a['filter'](_0x1f257a=>_0x1f257a[_0x4871f4(0x158)]('/')['at'](-0x1)===_0x31dfa9);if(_0x2a88c9[_0x4871f4(0x153)]===0x0)throw CliErrors[_0x4871f4(0x16f)](_0x4871f4(0x14b)+_0x31dfa9);if(_0x2a88c9[_0x4871f4(0x153)]>0x1)throw CliErrors[_0x4871f4(0x16f)](_0x4871f4(0x162)+_0x31dfa9+_0x4871f4(0x14c)+_0x2a88c9[_0x4871f4(0x14a)](_0x2fda2a=>'\x20\x20-\x20'+_0x2fda2a)[_0x4871f4(0x170)]('\x0a'));return _0x2a88c9[0x0];}async function moveToTrash(_0x5effde,_0x536539,_0x4499bb){const _0x521494=a38_0x27ef82,_0x569e8b=new Date()[_0x521494(0x14e)]()[_0x521494(0x166)](/[:.]/g,'-'),_0xc8f346=relative(_0x5effde,_0x4499bb),_0x3ad6e0=join(_0x536539,_0x569e8b,_0xc8f346);return await mkdir(dirname(_0x3ad6e0),{'recursive':!![]}),await rename(_0x4499bb,_0x3ad6e0),_0x3ad6e0;}async function cleanupEmptyDirectories(_0x617e7f,_0x14fc0e){const _0x3f2fa2=a38_0x27ef82;let _0x1828de=resolve(_0x617e7f);const _0x10ae1e=resolve(_0x14fc0e);while(_0x1828de[_0x3f2fa2(0x174)](''+_0x10ae1e+sep)||_0x1828de===_0x10ae1e){if(_0x1828de===_0x10ae1e)return;try{const _0x55d14d=await readdir(_0x1828de);if(_0x55d14d['length']>0x0)return;await rmdir(_0x1828de);}catch{return;}_0x1828de=dirname(_0x1828de);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x54c5a9,_0x517876,_0x2203e9,_0x1cc85e){const _0x1e9a89=a38_0x27ef82;for(let _0x3c52eb=0x0;_0x3c52eb<DELETE_SETTLE_RETRY_COUNT;_0x3c52eb+=0x1){const _0x32371b=await readBffLockFile(_0x54c5a9),_0x598ab1=!!_0x32371b?.['apps']?.[_0x517876]?.[_0x1e9a89(0x168)]?.[_0x2203e9],_0x12e2fa=await fileExists(_0x1cc85e);if(!_0x598ab1&&!_0x12e2fa)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x1e9a89(0x159)+_0x2203e9+'.');}
@@ -1 +1 @@
1
- const a39_0x4c102b=a39_0x5925;function a39_0x5925(_0x3c94f5,_0x447022){_0x3c94f5=_0x3c94f5-0x1e7;const _0x5e48dd=a39_0x5e48();let _0x5925d2=_0x5e48dd[_0x3c94f5];return _0x5925d2;}function a39_0x5e48(){const _0x7ca27d=['308077sJfLfB','Return\x20full\x20raw\x20script\x20object','13946jLetie','version','95272ZYyEJv','23106rrIUoa','description','200289PLppXg','399rBpGoX','4SfWBuV','98816cnZymg','functionName','boolean','70790KjKUWP','verbose','num','72NvIwBy','bool','(none)','read','scriptContent','createdTime','279EgLHqw','bff','10XlrbwG','appCode','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','updateUserName','Script\x20ID'];a39_0x5e48=function(){return _0x7ca27d;};return a39_0x5e48();}(function(_0x4f7e27,_0x1af099){const _0x1b8c78=a39_0x5925,_0x1761c8=_0x4f7e27();while(!![]){try{const _0x1c5d79=parseInt(_0x1b8c78(0x203))/0x1*(-parseInt(_0x1b8c78(0x1fc))/0x2)+-parseInt(_0x1b8c78(0x201))/0x3+parseInt(_0x1b8c78(0x1e7))/0x4*(parseInt(_0x1b8c78(0x1f5))/0x5)+-parseInt(_0x1b8c78(0x1ff))/0x6*(-parseInt(_0x1b8c78(0x202))/0x7)+-parseInt(_0x1b8c78(0x1fe))/0x8+parseInt(_0x1b8c78(0x1f3))/0x9*(-parseInt(_0x1b8c78(0x1ea))/0xa)+-parseInt(_0x1b8c78(0x1fa))/0xb*(-parseInt(_0x1b8c78(0x1ed))/0xc);if(_0x1c5d79===_0x1af099)break;else _0x1761c8['push'](_0x1761c8['shift']());}catch(_0x53e948){_0x1761c8['push'](_0x1761c8['shift']());}}}(a39_0x5e48,0x1b160));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a39_0x4c102b(0x1f4),'command':'detail','description':a39_0x4c102b(0x1f7),'risk':a39_0x4c102b(0x1f0),'flags':[{'name':'id','type':'number','required':!![],'description':a39_0x4c102b(0x1f9)},{'name':a39_0x4c102b(0x1eb),'type':a39_0x4c102b(0x1e9),'description':a39_0x4c102b(0x1fb)}],async 'execute'(_0x4f86a4){const _0x2bd54e=a39_0x4c102b,_0x22ce82=await getBffScriptInfo(_0x4f86a4[_0x2bd54e(0x1ec)]('id')),_0x19d418=_0x4f86a4[_0x2bd54e(0x1ee)](_0x2bd54e(0x1eb));if(_0x19d418)return{'ok':!![],'data':_0x22ce82};return{'ok':!![],'data':{'id':_0x22ce82['id'],'functionName':_0x22ce82[_0x2bd54e(0x1e8)]??'','version':_0x22ce82[_0x2bd54e(0x1fd)]??'','updateUserName':_0x22ce82[_0x2bd54e(0x1f8)]??'','appCode':_0x22ce82[_0x2bd54e(0x1f6)],'scriptType':_0x22ce82['scriptType'],'description':_0x22ce82[_0x2bd54e(0x200)]||_0x2bd54e(0x1ef),'createdTime':_0x22ce82[_0x2bd54e(0x1f2)]??'','updatedTime':_0x22ce82['updatedTime']??'','scriptContent':_0x22ce82[_0x2bd54e(0x1f1)]??''}};}};
1
+ const a39_0x3dbef7=a39_0x1c9d;(function(_0x5b8d58,_0x44bdff){const _0x2df26b=a39_0x1c9d,_0x257135=_0x5b8d58();while(!![]){try{const _0x82a45d=parseInt(_0x2df26b(0x99))/0x1+parseInt(_0x2df26b(0x95))/0x2*(-parseInt(_0x2df26b(0x9c))/0x3)+-parseInt(_0x2df26b(0xa1))/0x4+parseInt(_0x2df26b(0x9d))/0x5+-parseInt(_0x2df26b(0x9f))/0x6+-parseInt(_0x2df26b(0xa2))/0x7+parseInt(_0x2df26b(0x97))/0x8*(parseInt(_0x2df26b(0x9e))/0x9);if(_0x82a45d===_0x44bdff)break;else _0x257135['push'](_0x257135['shift']());}catch(_0x150f53){_0x257135['push'](_0x257135['shift']());}}}(a39_0xb457,0xc4a23));import{getBffScriptInfo}from'../../core/api-client.js';function a39_0xb457(){const _0x30fc32=['Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','version','num','bool','description','updateUserName','read','Script\x20ID','createdTime','43652WQBDxh','Return\x20full\x20raw\x20script\x20object','8hdGDjl','updatedTime','1164933wfXDas','number','detail','102RVTzAy','2707595iEGlEj','16274673CsyJRl','5540058oMgMlB','verbose','1333140BRKTTI','4974382QlYoNB'];a39_0xb457=function(){return _0x30fc32;};return a39_0xb457();}function a39_0x1c9d(_0x5898b8,_0x3f2ad4){_0x5898b8=_0x5898b8-0x8c;const _0xb457de=a39_0xb457();let _0x1c9d33=_0xb457de[_0x5898b8];return _0x1c9d33;}export const bffDetail={'service':'bff','command':a39_0x3dbef7(0x9b),'description':a39_0x3dbef7(0x8c),'risk':a39_0x3dbef7(0x92),'flags':[{'name':'id','type':a39_0x3dbef7(0x9a),'required':!![],'description':a39_0x3dbef7(0x93)},{'name':a39_0x3dbef7(0xa0),'type':'boolean','description':a39_0x3dbef7(0x96)}],async 'execute'(_0x4803fc){const _0x53019d=a39_0x3dbef7,_0x275c4c=await getBffScriptInfo(_0x4803fc[_0x53019d(0x8e)]('id')),_0x2eb260=_0x4803fc[_0x53019d(0x8f)](_0x53019d(0xa0));if(_0x2eb260)return{'ok':!![],'data':_0x275c4c};return{'ok':!![],'data':{'id':_0x275c4c['id'],'functionName':_0x275c4c['functionName']??'','version':_0x275c4c[_0x53019d(0x8d)]??'','updateUserName':_0x275c4c[_0x53019d(0x91)]??'','appCode':_0x275c4c['appCode'],'scriptType':_0x275c4c['scriptType'],'description':_0x275c4c[_0x53019d(0x90)]||'(none)','createdTime':_0x275c4c[_0x53019d(0x94)]??'','updatedTime':_0x275c4c[_0x53019d(0x98)]??'','scriptContent':_0x275c4c['scriptContent']??''}};}};
@@ -1 +1 @@
1
- (function(_0xa96102,_0x31a64e){const _0x4e2974=a40_0x45c9,_0x5507fd=_0xa96102();while(!![]){try{const _0x43a7c5=parseInt(_0x4e2974(0x1c0))/0x1+parseInt(_0x4e2974(0x1be))/0x2+parseInt(_0x4e2974(0x1bf))/0x3+-parseInt(_0x4e2974(0x1c3))/0x4+parseInt(_0x4e2974(0x1c1))/0x5*(parseInt(_0x4e2974(0x1bc))/0x6)+parseInt(_0x4e2974(0x1bd))/0x7+-parseInt(_0x4e2974(0x1c2))/0x8;if(_0x43a7c5===_0x31a64e)break;else _0x5507fd['push'](_0x5507fd['shift']());}catch(_0x2c8812){_0x5507fd['push'](_0x5507fd['shift']());}}}(a40_0x5ce6,0x524db));import{bffList}from'../../commands/bff/list.js';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_0x5ce6(){const _0x13d9f5=['473643oSmxsX','1415zIouPL','4029096gWNRSZ','2025256RazTzY','10758gjQWxJ','1270759XSnCDc','92026RForIA','415362vHuCrk'];a40_0x5ce6=function(){return _0x13d9f5;};return a40_0x5ce6();}import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';function a40_0x45c9(_0x349603,_0x360a5f){_0x349603=_0x349603-0x1bc;const _0x5ce651=a40_0x5ce6();let _0x45c91c=_0x5ce651[_0x349603];return _0x45c91c;}export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
1
+ (function(_0xc77381,_0x222af4){const _0x42c0b6=a40_0x152a,_0x800d43=_0xc77381();while(!![]){try{const _0x1b2d3e=parseInt(_0x42c0b6(0x1ef))/0x1+-parseInt(_0x42c0b6(0x1ee))/0x2+-parseInt(_0x42c0b6(0x1f0))/0x3+parseInt(_0x42c0b6(0x1f3))/0x4+parseInt(_0x42c0b6(0x1f2))/0x5+-parseInt(_0x42c0b6(0x1f1))/0x6+-parseInt(_0x42c0b6(0x1f4))/0x7;if(_0x1b2d3e===_0x222af4)break;else _0x800d43['push'](_0x800d43['shift']());}catch(_0x545938){_0x800d43['push'](_0x800d43['shift']());}}}(a40_0x1ba3,0x5bc42));function a40_0x1ba3(){const _0x57d573=['1401393zkYskd','329930ShurYB','574994uEwyOK','1877010GCYTZd','3176550CSgbNd','3123030NzMBjg','2786132lDRhVh'];a40_0x1ba3=function(){return _0x57d573;};return a40_0x1ba3();}import{bffList}from'../../commands/bff/list.js';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';function a40_0x152a(_0x185361,_0x5d8c2d){_0x185361=_0x185361-0x1ee;const _0x1ba307=a40_0x1ba3();let _0x152adc=_0x1ba307[_0x185361];return _0x152adc;}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_0x419152=a41_0x21a0;(function(_0x9355e5,_0x4a5f11){const _0x3a1e68=a41_0x21a0,_0x16adc6=_0x9355e5();while(!![]){try{const _0x2a295a=parseInt(_0x3a1e68(0x108))/0x1*(-parseInt(_0x3a1e68(0xfb))/0x2)+-parseInt(_0x3a1e68(0x10a))/0x3*(-parseInt(_0x3a1e68(0xf8))/0x4)+-parseInt(_0x3a1e68(0xf7))/0x5+parseInt(_0x3a1e68(0xfa))/0x6*(parseInt(_0x3a1e68(0xf4))/0x7)+-parseInt(_0x3a1e68(0xff))/0x8+parseInt(_0x3a1e68(0x105))/0x9*(-parseInt(_0x3a1e68(0x10f))/0xa)+parseInt(_0x3a1e68(0xf6))/0xb;if(_0x2a295a===_0x4a5f11)break;else _0x16adc6['push'](_0x16adc6['shift']());}catch(_0x47df34){_0x16adc6['push'](_0x16adc6['shift']());}}}(a41_0x4e7b,0xb84ad));function a41_0x21a0(_0x4f0c5a,_0x52eb49){_0x4f0c5a=_0x4f0c5a-0xf0;const _0x4e7b07=a41_0x4e7b();let _0x21a0fc=_0x4e7b07[_0x4f0c5a];return _0x21a0fc;}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a41_0x419152(0x104),'command':a41_0x419152(0xf0),'description':a41_0x419152(0x102),'risk':a41_0x419152(0xf1),'flags':[{'name':a41_0x419152(0xfe),'type':a41_0x419152(0x109),'description':a41_0x419152(0xf3),'default':a41_0x419152(0x10d),'enum':['ENDPOINT',a41_0x419152(0x10c)]},{'name':a41_0x419152(0xfc),'type':a41_0x419152(0x109),'description':a41_0x419152(0x106)},{'name':a41_0x419152(0xf5),'type':a41_0x419152(0x103),'description':a41_0x419152(0x100)}],async 'execute'(_0x31410f){const _0x1f8f9f=a41_0x419152,_0x3dd12a=await listBffScripts(_0x31410f[_0x1f8f9f(0xf2)],_0x31410f[_0x1f8f9f(0x101)]('type'),{'scriptName':_0x31410f[_0x1f8f9f(0x101)](_0x1f8f9f(0xfc))||undefined}),_0x37615d=_0x31410f['bool'](_0x1f8f9f(0xf5));return{'ok':!![],'data':_0x37615d?_0x3dd12a:_0x3dd12a['map'](_0x21aa39=>({'id':_0x21aa39['id'],'functionName':_0x21aa39[_0x1f8f9f(0xf9)]??'','description':_0x21aa39[_0x1f8f9f(0xfd)]||_0x1f8f9f(0x10b),'scriptType':_0x21aa39[_0x1f8f9f(0x10e)]})),'message':_0x3dd12a['length']===0x0?_0x1f8f9f(0x107):undefined};}};function a41_0x4e7b(){const _0x26b5f7=['bff','18iIjYyz','Filter\x20by\x20script\x20name','No\x20Backend\x20Function\x20scripts\x20found.','3spfdjN','string','414OkkrXd','(unnamed)','COMMON','ENDPOINT','scriptType','468680LekTSR','list','read','appCode','Script\x20type\x20filter','119QGhXeX','verbose','18451741xpBZDd','3448720iGJwLr','15532TLrhuL','functionName','171306cQLyhL','679882iZjWuP','name','description','type','1123904JnkgfL','Return\x20full\x20script\x20objects','str','List\x20Backend\x20Function\x20scripts','boolean'];a41_0x4e7b=function(){return _0x26b5f7;};return a41_0x4e7b();}
1
+ const a41_0x79e349=a41_0x3216;(function(_0x3b549f,_0x9913ee){const _0x2df532=a41_0x3216,_0x1bc997=_0x3b549f();while(!![]){try{const _0x391bc9=-parseInt(_0x2df532(0x1e0))/0x1*(parseInt(_0x2df532(0x1ea))/0x2)+parseInt(_0x2df532(0x1f0))/0x3*(parseInt(_0x2df532(0x1fa))/0x4)+parseInt(_0x2df532(0x1f7))/0x5*(parseInt(_0x2df532(0x1eb))/0x6)+parseInt(_0x2df532(0x1f5))/0x7*(-parseInt(_0x2df532(0x1f6))/0x8)+-parseInt(_0x2df532(0x1f9))/0x9+parseInt(_0x2df532(0x1f2))/0xa*(-parseInt(_0x2df532(0x1df))/0xb)+parseInt(_0x2df532(0x1e8))/0xc;if(_0x391bc9===_0x9913ee)break;else _0x1bc997['push'](_0x1bc997['shift']());}catch(_0x51052e){_0x1bc997['push'](_0x1bc997['shift']());}}}(a41_0x5f2f,0x87ca0));function a41_0x3216(_0x397872,_0x443e3f){_0x397872=_0x397872-0x1de;const _0x5f2fdb=a41_0x5f2f();let _0x3216de=_0x5f2fdb[_0x397872];return _0x3216de;}function a41_0x5f2f(){const _0x287f60=['str','list','string','20142zCxazF','Script\x20type\x20filter','30BqaDOJ','verbose','description','1519qiGaAD','33272MPAauX','65OcEYXS','length','7089201IyPBQb','224BZnVFR','Return\x20full\x20script\x20objects','functionName','name','bool','147037FsnGgl','2QZWiYX','read','No\x20Backend\x20Function\x20scripts\x20found.','Filter\x20by\x20script\x20name','type','scriptType','List\x20Backend\x20Function\x20scripts','ENDPOINT','17863512RJgLyn','bff','12962kfUAzS','200694kBmXIC','map'];a41_0x5f2f=function(){return _0x287f60;};return a41_0x5f2f();}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a41_0x79e349(0x1e9),'command':a41_0x79e349(0x1ee),'description':a41_0x79e349(0x1e6),'risk':a41_0x79e349(0x1e1),'flags':[{'name':a41_0x79e349(0x1e4),'type':a41_0x79e349(0x1ef),'description':a41_0x79e349(0x1f1),'default':'ENDPOINT','enum':[a41_0x79e349(0x1e7),'COMMON']},{'name':a41_0x79e349(0x1fd),'type':a41_0x79e349(0x1ef),'description':a41_0x79e349(0x1e3)},{'name':a41_0x79e349(0x1f3),'type':'boolean','description':a41_0x79e349(0x1fb)}],async 'execute'(_0x2ffab8){const _0xd811b=a41_0x79e349,_0x5d2618=await listBffScripts(_0x2ffab8['appCode'],_0x2ffab8[_0xd811b(0x1ed)](_0xd811b(0x1e4)),{'scriptName':_0x2ffab8[_0xd811b(0x1ed)]('name')||undefined}),_0x417573=_0x2ffab8[_0xd811b(0x1de)](_0xd811b(0x1f3));return{'ok':!![],'data':_0x417573?_0x5d2618:_0x5d2618[_0xd811b(0x1ec)](_0x1ba21d=>({'id':_0x1ba21d['id'],'functionName':_0x1ba21d[_0xd811b(0x1fc)]??'','description':_0x1ba21d[_0xd811b(0x1f4)]||'(unnamed)','scriptType':_0x1ba21d[_0xd811b(0x1e5)]})),'message':_0x5d2618[_0xd811b(0x1f8)]===0x0?_0xd811b(0x1e2):undefined};}};
@@ -1 +1 @@
1
- const a42_0x339dd9=a42_0x1860;(function(_0x4031cd,_0x3a22cf){const _0xda49c=a42_0x1860,_0x396761=_0x4031cd();while(!![]){try{const _0x34877e=parseInt(_0xda49c(0x8b))/0x1*(parseInt(_0xda49c(0xaa))/0x2)+parseInt(_0xda49c(0xb8))/0x3*(-parseInt(_0xda49c(0xa6))/0x4)+parseInt(_0xda49c(0xaf))/0x5+parseInt(_0xda49c(0x94))/0x6+-parseInt(_0xda49c(0xb1))/0x7*(-parseInt(_0xda49c(0x98))/0x8)+-parseInt(_0xda49c(0x97))/0x9*(-parseInt(_0xda49c(0x96))/0xa)+parseInt(_0xda49c(0x99))/0xb*(parseInt(_0xda49c(0xa9))/0xc);if(_0x34877e===_0x3a22cf)break;else _0x396761['push'](_0x396761['shift']());}catch(_0x5c0fff){_0x396761['push'](_0x396761['shift']());}}}(a42_0x42a7,0x375db));function a42_0x42a7(){const _0x2e48ee=['--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','bff','validation','flag','1DwsrMg','str','INFO','read','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','appCode','Maximum\x20log\x20lines\x20to\x20return\x20(1-','--limit','1358820JJtkZb','limit','150mQiOcm','23886CtIMYJ','1829896IMhOcQ','11pkJnSI','length','level','--limit\x20must\x20be\x20between\x201\x20and\x20','\x20must\x20be\x20a\x20positive\x20integer.','toUpperCase','--start-time','since','keyword','--end-time','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','--since','start-time','4oeEKBO','Found\x20','Filter\x20by\x20log\x20level','57504nySoos','32814aditjF','end-time','\x20Backend\x20Function\x20log\x20line(s).','number','trim','589130RaMcku','DEBUG','7MHBSnN','logs','ERROR','num','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','string','1221789vVCzEH','Filter\x20formatted\x20log\x20lines\x20by\x20keyword'];a42_0x42a7=function(){return _0x2e48ee;};return a42_0x42a7();}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_0x339dd9(0xb0),a42_0x339dd9(0x8d),'WARN',a42_0x339dd9(0xb3)];export function resolveBffLogQuery(_0x524065,_0xecaa64=Date['now']()){const _0x68bd48=a42_0x339dd9,_0x906486=_0x524065[_0x68bd48(0x8a)](_0x68bd48(0xa0)),_0x2ef50c=_0x524065[_0x68bd48(0x8a)](_0x68bd48(0xa5)),_0x3fd38a=_0x524065[_0x68bd48(0x8a)](_0x68bd48(0xab));if(_0x906486!==undefined&&_0x2ef50c!==undefined)throw CliErrors[_0x68bd48(0xbc)](_0x68bd48(0xa3));const _0x324d5d=_0x3fd38a===undefined?_0xecaa64:readPositiveInteger(_0x524065['num'](_0x68bd48(0xab)),_0x68bd48(0xa2)),_0x37f43a=_0x2ef50c===undefined?_0x324d5d-readSinceMinutes(_0x524065)*0xea60:readPositiveInteger(_0x524065[_0x68bd48(0xb4)](_0x68bd48(0xa5)),_0x68bd48(0x9f));if(_0x37f43a<=0x0)throw CliErrors['validation'](_0x68bd48(0x90));if(_0x37f43a>_0x324d5d)throw CliErrors['validation'](_0x68bd48(0xba));const _0x1076fe=readPositiveInteger(_0x524065[_0x68bd48(0xb4)](_0x68bd48(0x95),DEFAULT_LIMIT),_0x68bd48(0x93));if(_0x1076fe>MAX_LIMIT)throw CliErrors[_0x68bd48(0xbc)](_0x68bd48(0x9c)+MAX_LIMIT+'.');const _0xca128c=_0x524065['str']('level')[_0x68bd48(0xae)]()[_0x68bd48(0x9e)]()||undefined,_0x876c61=_0x524065[_0x68bd48(0x8c)](_0x68bd48(0xa1))['trim']()||undefined;return{'appCode':_0x524065[_0x68bd48(0x91)],'startTime':_0x37f43a,'endTime':_0x324d5d,..._0x2ef50c===undefined?{'sinceMinutes':readSinceMinutes(_0x524065)}:{},..._0xca128c?{'level':_0xca128c}:{},..._0x876c61?{'keyword':_0x876c61}:{},'limit':_0x1076fe};}function readSinceMinutes(_0x1e6451){const _0xe64023=a42_0x339dd9;return readPositiveInteger(_0x1e6451[_0xe64023(0xb4)]('since',DEFAULT_SINCE_MINUTES),_0xe64023(0xa4));}function readPositiveInteger(_0x4997b0,_0x195b7a){const _0x4de0a8=a42_0x339dd9;if(!Number['isSafeInteger'](_0x4997b0)||_0x4997b0<=0x0)throw CliErrors['validation'](_0x195b7a+_0x4de0a8(0x9d));return _0x4997b0;}function a42_0x1860(_0x5e19bf,_0x128c39){_0x5e19bf=_0x5e19bf-0x8a;const _0x42a736=a42_0x42a7();let _0x18608f=_0x42a736[_0x5e19bf];return _0x18608f;}export const bffLogs={'service':a42_0x339dd9(0xbb),'command':a42_0x339dd9(0xb2),'description':a42_0x339dd9(0xb5),'risk':a42_0x339dd9(0x8e),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':'since','type':a42_0x339dd9(0xad),'description':a42_0x339dd9(0x8f)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x339dd9(0xa5),'type':a42_0x339dd9(0xad),'description':'Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds'},{'name':a42_0x339dd9(0xab),'type':a42_0x339dd9(0xad),'description':'Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)'},{'name':a42_0x339dd9(0x9b),'type':a42_0x339dd9(0xb7),'description':a42_0x339dd9(0xa8),'enum':LOG_LEVELS},{'name':a42_0x339dd9(0xa1),'type':a42_0x339dd9(0xb7),'description':a42_0x339dd9(0xb9)},{'name':a42_0x339dd9(0x95),'type':a42_0x339dd9(0xad),'description':a42_0x339dd9(0x92)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x1c9463){resolveBffLogQuery(_0x1c9463);},async 'execute'(_0x5d7f2e){const _0x432347=a42_0x339dd9,_0x5f27f0=resolveBffLogQuery(_0x5d7f2e),{sinceMinutes:_0x32611f,..._0x40baba}=_0x5f27f0,_0x29d63a=await searchBffScriptLogs(_0x40baba);return{'ok':!![],'data':{'query':_0x5f27f0,'count':_0x29d63a[_0x432347(0x9a)],'logs':_0x29d63a},'message':_0x29d63a[_0x432347(0x9a)]===0x0?_0x432347(0xb6):_0x432347(0xa7)+_0x29d63a['length']+_0x432347(0xac)};}};
1
+ const a42_0x30fb4a=a42_0x3383;(function(_0x258c1e,_0x574127){const _0x110f2d=a42_0x3383,_0x47208d=_0x258c1e();while(!![]){try{const _0x21114f=parseInt(_0x110f2d(0x106))/0x1*(parseInt(_0x110f2d(0x125))/0x2)+-parseInt(_0x110f2d(0x101))/0x3*(-parseInt(_0x110f2d(0x10a))/0x4)+parseInt(_0x110f2d(0x11a))/0x5+-parseInt(_0x110f2d(0x105))/0x6*(parseInt(_0x110f2d(0x11f))/0x7)+-parseInt(_0x110f2d(0xfe))/0x8+-parseInt(_0x110f2d(0x10c))/0x9*(-parseInt(_0x110f2d(0x107))/0xa)+parseInt(_0x110f2d(0x10d))/0xb*(-parseInt(_0x110f2d(0x104))/0xc);if(_0x21114f===_0x574127)break;else _0x47208d['push'](_0x47208d['shift']());}catch(_0x46a563){_0x47208d['push'](_0x47208d['shift']());}}}(a42_0x440f,0x2adda));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';function a42_0x3383(_0x76fd9e,_0x5248ca){_0x76fd9e=_0x76fd9e-0xfb;const _0x440fc4=a42_0x440f();let _0x33837f=_0x440fc4[_0x76fd9e];return _0x33837f;}import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0x30fb4a(0x100),a42_0x30fb4a(0x119),a42_0x30fb4a(0x116),a42_0x30fb4a(0x124)];export function resolveBffLogQuery(_0x3fddea,_0x55b124=Date[a42_0x30fb4a(0x108)]()){const _0x137c82=a42_0x30fb4a,_0x4d7744=_0x3fddea['flag'](_0x137c82(0x11c)),_0x142eaf=_0x3fddea[_0x137c82(0x112)]('start-time'),_0xf3278e=_0x3fddea['flag']('end-time');if(_0x4d7744!==undefined&&_0x142eaf!==undefined)throw CliErrors[_0x137c82(0x109)](_0x137c82(0xfc));const _0x2b0f21=_0xf3278e===undefined?_0x55b124:readPositiveInteger(_0x3fddea[_0x137c82(0x113)](_0x137c82(0x111)),_0x137c82(0xff)),_0x480f13=_0x142eaf===undefined?_0x2b0f21-readSinceMinutes(_0x3fddea)*0xea60:readPositiveInteger(_0x3fddea[_0x137c82(0x113)](_0x137c82(0x11d)),'--start-time');if(_0x480f13<=0x0)throw CliErrors['validation']('The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.');if(_0x480f13>_0x2b0f21)throw CliErrors['validation'](_0x137c82(0x11e));const _0x4bfedb=readPositiveInteger(_0x3fddea['num'](_0x137c82(0x102),DEFAULT_LIMIT),_0x137c82(0x120));if(_0x4bfedb>MAX_LIMIT)throw CliErrors[_0x137c82(0x109)](_0x137c82(0x12c)+MAX_LIMIT+'.');const _0x35d653=_0x3fddea[_0x137c82(0x115)](_0x137c82(0x10f))[_0x137c82(0x114)]()['toUpperCase']()||undefined,_0xbab03f=_0x3fddea['str'](_0x137c82(0x10b))['trim']()||undefined;return{'appCode':_0x3fddea[_0x137c82(0x118)],'startTime':_0x480f13,'endTime':_0x2b0f21,..._0x142eaf===undefined?{'sinceMinutes':readSinceMinutes(_0x3fddea)}:{},..._0x35d653?{'level':_0x35d653}:{},..._0xbab03f?{'keyword':_0xbab03f}:{},'limit':_0x4bfedb};}function readSinceMinutes(_0x104a9b){const _0x320a03=a42_0x30fb4a;return readPositiveInteger(_0x104a9b[_0x320a03(0x113)]('since',DEFAULT_SINCE_MINUTES),_0x320a03(0xfb));}function readPositiveInteger(_0xd3c918,_0x30e44e){const _0x251d2b=a42_0x30fb4a;if(!Number[_0x251d2b(0x110)](_0xd3c918)||_0xd3c918<=0x0)throw CliErrors['validation'](_0x30e44e+_0x251d2b(0x11b));return _0xd3c918;}function a42_0x440f(){const _0x4893da=['--since','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','2774208UOHtmY','--end-time','DEBUG','39Wcaxhf','limit','Found\x20','1818660eVeZGd','36TPZxwu','88qjwtJx','170pSiwKB','now','validation','105236OGWzIV','keyword','91215xSklin','11AQfEWu','string','level','isSafeInteger','end-time','flag','num','trim','str','WARN','\x20Backend\x20Function\x20log\x20line(s).','appCode','INFO','973085pSBgpN','\x20must\x20be\x20a\x20positive\x20integer.','since','start-time','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','65086JxckBm','--limit','number','read','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','ERROR','472KtKhQz','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','Maximum\x20log\x20lines\x20to\x20return\x20(1-','length','bff','--limit\x20must\x20be\x20between\x201\x20and\x20'];a42_0x440f=function(){return _0x4893da;};return a42_0x440f();}export const bffLogs={'service':a42_0x30fb4a(0x12b),'command':'logs','description':'Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','risk':a42_0x30fb4a(0x122),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':'since','type':a42_0x30fb4a(0x121),'description':a42_0x30fb4a(0x123)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x30fb4a(0x11d),'type':a42_0x30fb4a(0x121),'description':a42_0x30fb4a(0x128)},{'name':a42_0x30fb4a(0x111),'type':a42_0x30fb4a(0x121),'description':a42_0x30fb4a(0x126)},{'name':a42_0x30fb4a(0x10f),'type':a42_0x30fb4a(0x10e),'description':'Filter\x20by\x20log\x20level','enum':LOG_LEVELS},{'name':'keyword','type':a42_0x30fb4a(0x10e),'description':a42_0x30fb4a(0xfd)},{'name':a42_0x30fb4a(0x102),'type':a42_0x30fb4a(0x121),'description':a42_0x30fb4a(0x129)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x3c579e){resolveBffLogQuery(_0x3c579e);},async 'execute'(_0x39f5f4){const _0x38d097=a42_0x30fb4a,_0x5c3bca=resolveBffLogQuery(_0x39f5f4),{sinceMinutes:_0x44916b,..._0x12d926}=_0x5c3bca,_0x48c291=await searchBffScriptLogs(_0x12d926);return{'ok':!![],'data':{'query':_0x5c3bca,'count':_0x48c291[_0x38d097(0x12a)],'logs':_0x48c291},'message':_0x48c291[_0x38d097(0x12a)]===0x0?_0x38d097(0x127):_0x38d097(0x103)+_0x48c291[_0x38d097(0x12a)]+_0x38d097(0x117)};}};
@@ -1 +1 @@
1
- const a43_0x5196c8=a43_0x3a3d;(function(_0x129620,_0x33fa47){const _0x1dcc87=a43_0x3a3d,_0xea2b78=_0x129620();while(!![]){try{const _0x22a88d=parseInt(_0x1dcc87(0x135))/0x1*(-parseInt(_0x1dcc87(0x149))/0x2)+-parseInt(_0x1dcc87(0x16b))/0x3+parseInt(_0x1dcc87(0x105))/0x4*(parseInt(_0x1dcc87(0x175))/0x5)+-parseInt(_0x1dcc87(0x13f))/0x6+parseInt(_0x1dcc87(0x167))/0x7+parseInt(_0x1dcc87(0x182))/0x8*(parseInt(_0x1dcc87(0x13e))/0x9)+parseInt(_0x1dcc87(0x194))/0xa;if(_0x22a88d===_0x33fa47)break;else _0xea2b78['push'](_0xea2b78['shift']());}catch(_0x57b4d6){_0xea2b78['push'](_0xea2b78['shift']());}}}(a43_0x2af0,0xd4844));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';function a43_0x2af0(){const _0x178ae4=['--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','&currentPage=1&pageSize=','rollback','scriptContent','type','\x20conflict','has','question','NFC','\x20--name\x20','message','require','toLowerCase','defaultApp','scriptType','6587810LMACmn','toISOString','functionNode','functions','4LUflGe','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','HOOK','stderr','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','hookLocation','alias','stdin','push','\x22\x20not\x20found\x20after\x20ensureLockScope.','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','\x20failed','conflict','nonInteractive','.hook-directory-migrate-','newDirectoryPath','apiDir','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','GET','code','keyChanges','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','ENDPOINT','Remote\x20script\x20missing\x20id.','Remote\x20script\x20missing\x20content.','Could\x20not\x20restore\x20local\x20script\x20\x22','requires','Pull\x20complete:\x20','force','boolean','rekey','filePath','\x22\x20and\x20\x22','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','bff','\x20pulled','apps','parse','reverse','currentApp','ino','\x20Recovery\x20errors:\x20','\x22:\x20its\x20target\x20\x22','validation','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','migrations','length','operationType','3886OnKIiY','push_local','newDirectory','hash','Pull\x20only\x20this\x20script\x20type','remoteId','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','get','45yNuxbu','5820696tdzqaS','HOOK/','Lock\x20scope\x20for\x20app\x20\x22','case-rename','cancelled','\x22:\x20','lockFilePath','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','\x22:\x20both\x20target\x20\x22','map','278PqKdre','appCode','COMMON','entries','BFF_LOCAL_UNSYNCED','str','sourceDirectoryPathByNewDirectory','&type=','join','Force\x20pull\x20cancelled.','trim','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','\x20--format\x20compress','lockKey','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','datasetCode','mergedCli','profileName','\x22\x20from\x20the\x20lock\x20file.','oldDirectory','functionName','filter','content','move','\x20bff\x20push\x20--type\x20','lastSync','oldDirectoryPath','/api/management/library/scripts/list?appCode=','projectedFunctions','9018289OSEGrg','sourceFilePathByNewLockKey','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','mode','4112196amgiWz','values','flatMap','Failed\x20to\x20write\x20local\x20script\x20\x22','oldLockKey','pull','split','utf8','Would\x20inspect\x20','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.','1750085CtXVbu','selectedAppName','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','existed','\x22\x20from\x20\x22','newLockKey','\x22\x20to\x20\x22','scriptsRoot','set','\x20resolution','\x22\x20may\x20remain.','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','dev','2326952WfLnjd','entry','ENOENT'];a43_0x2af0=function(){return _0x178ae4;};return a43_0x2af0();}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':a43_0x5196c8(0x127),'command':a43_0x5196c8(0x170),'description':a43_0x5196c8(0x155),'risk':'read','structuredErrors':!![],'flags':[{'name':a43_0x5196c8(0x189),'type':'string','description':a43_0x5196c8(0x139),'enum':[a43_0x5196c8(0x14b),a43_0x5196c8(0x11b),a43_0x5196c8(0x107)]},{'name':'force','type':a43_0x5196c8(0x122),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x137bb5){const _0x4e9e7e=a43_0x5196c8,_0x12b8e1=loadBffProjectConfig(_0x137bb5[_0x4e9e7e(0x14a)]),_0x3970f3=await readBffLockFile(_0x12b8e1[_0x4e9e7e(0x145)]),{appLock:_0x2c7ece}=ensureLockScope(_0x3970f3??createEmptyBffLock(),_0x137bb5[_0x4e9e7e(0x14a)],_0x12b8e1[_0x4e9e7e(0x17c)],_0x4e9e7e(0x170)),_0xa1b7a8=normalizeBffType(_0x137bb5[_0x4e9e7e(0x14e)](_0x4e9e7e(0x189)))??undefined,[_0x1410c0,_0x2e86ef]=await Promise['all']([listBffScripts(_0x137bb5['appCode'],_0xa1b7a8),getBffScriptStatistics(_0x137bb5[_0x4e9e7e(0x14a)])]),_0x489eed=_0x1410c0['some'](_0x3985dc=>normalizeBffType(_0x3985dc[_0x4e9e7e(0x193)])===_0x4e9e7e(0x107)),_0x355f00=_0x489eed?buildDatasetCodeToAliasMap(_0x137bb5[_0x4e9e7e(0x115)],_0x137bb5[_0x4e9e7e(0x14a)],_0x137bb5[_0x4e9e7e(0x176)]||_0x137bb5[_0x4e9e7e(0x15a)]?.[_0x4e9e7e(0x12c)]||_0x137bb5[_0x4e9e7e(0x15a)]?.[_0x4e9e7e(0x192)]):new Map(),_0x24829d=_0x489eed?await planHookDirectoryMigration(_0x12b8e1,_0x2c7ece,_0x355f00,await scanLocalBffFunctions(_0x12b8e1,_0x4e9e7e(0x107))):undefined,_0x9c2aab=createHookLocationMap(_0x2e86ef),_0x184b13=[];for(const _0x3d390a of _0x1410c0){const _0x524288=resolveRemoteScriptTarget(_0x12b8e1,_0x3d390a,_0x9c2aab,_0x24829d?.[_0x4e9e7e(0x166)]??_0x2c7ece[_0x4e9e7e(0x104)],_0x355f00);if(!_0x524288){_0x184b13[_0x4e9e7e(0x10d)]({'scriptType':_0x3d390a[_0x4e9e7e(0x193)],'functionName':_0x3d390a[_0x4e9e7e(0x15e)]??'','status':'skipped','reason':'unresolvable\x20target\x20path'});continue;}const _0x402962=(_0x24829d?.[_0x4e9e7e(0x166)]??_0x2c7ece[_0x4e9e7e(0x104)])[_0x524288['lockKey']],_0x3c4f88=_0x3d390a[_0x4e9e7e(0x188)]!=null?computeContentHash(_0x3d390a[_0x4e9e7e(0x188)]):undefined,_0x2ac790=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x24829d,_0x524288)??_0x524288[_0x4e9e7e(0x124)],_0x402962,_0x3c4f88),_0x15dd5a=_0x2ac790?localUnsyncedConflict(_0x524288,_0x3d390a['id']):undefined;_0x184b13[_0x4e9e7e(0x10d)]({'lockKey':_0x524288[_0x4e9e7e(0x157)],'filePath':_0x524288[_0x4e9e7e(0x124)],'remoteId':_0x3d390a['id']??null,'status':_0x15dd5a?_0x4e9e7e(0x111):'would_pull',..._0x15dd5a?{'conflict':_0x15dd5a}:{},..._0x524288['hookLocation']?{'alias':_0x524288['hookLocation'][_0x4e9e7e(0x10b)]??null,'datasetCode':_0x524288['hookLocation']['datasetCode'],'operationType':_0x524288[_0x4e9e7e(0x10a)][_0x4e9e7e(0x134)],'functionNode':_0x524288['hookLocation'][_0x4e9e7e(0x103)]}:{}});}return{'method':_0x4e9e7e(0x117),'url':_0x4e9e7e(0x165)+_0x137bb5[_0x4e9e7e(0x14a)]+(_0xa1b7a8?_0x4e9e7e(0x150)+_0xa1b7a8:'')+_0x4e9e7e(0x186)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x137bb5[_0x4e9e7e(0x14a)],'filterType':_0xa1b7a8??null,..._0x24829d&&_0x24829d[_0x4e9e7e(0x132)]['length']>0x0?{'hookDirectoryMigrations':_0x24829d[_0x4e9e7e(0x132)][_0x4e9e7e(0x148)](_0x2b08e7=>({'from':_0x2b08e7[_0x4e9e7e(0x15d)],'to':_0x2b08e7['newDirectory']}))}:{},'files':_0x184b13},'description':_0x4e9e7e(0x173)+_0x184b13[_0x4e9e7e(0x133)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x4185a9){const _0x2b9ca0=a43_0x5196c8,_0x3688b5=loadBffProjectConfig(_0x4185a9[_0x2b9ca0(0x14a)]),_0x2c9069=await readBffLockFile(_0x3688b5[_0x2b9ca0(0x145)]),{lockData:_0x4ce88e,appLock:_0x33820d}=ensureLockScope(_0x2c9069??createEmptyBffLock(),_0x4185a9[_0x2b9ca0(0x14a)],_0x3688b5[_0x2b9ca0(0x17c)],_0x2b9ca0(0x170)),_0x3a0de2=normalizeBffType(_0x4185a9[_0x2b9ca0(0x14e)]('type'))??undefined;if(_0x4185a9['str'](_0x2b9ca0(0x189))&&!_0x3a0de2)throw CliErrors[_0x2b9ca0(0x130)](_0x2b9ca0(0x185));const [_0x10b1ac,_0x4823fb]=await Promise['all']([listBffScripts(_0x4185a9[_0x2b9ca0(0x14a)],_0x3a0de2),getBffScriptStatistics(_0x4185a9[_0x2b9ca0(0x14a)])]);if(_0x10b1ac[_0x2b9ca0(0x133)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x2b9ca0(0x106)};const _0x5da91b=_0x4185a9['bool'](_0x2b9ca0(0x121));if(_0x5da91b&&!_0x4185a9[_0x2b9ca0(0x112)]){const _0x2f5468=await confirmForce();if(!_0x2f5468)throw CliErrors[_0x2b9ca0(0x143)](_0x2b9ca0(0x152));}if(_0x5da91b&&_0x4185a9[_0x2b9ca0(0x112)]){}const _0x56c3e9=_0x10b1ac['some'](_0x2d3456=>normalizeBffType(_0x2d3456['scriptType'])===_0x2b9ca0(0x107)),_0xe46bf4=_0x56c3e9?buildDatasetCodeToAliasMap(_0x4185a9[_0x2b9ca0(0x115)],_0x4185a9[_0x2b9ca0(0x14a)],_0x4185a9[_0x2b9ca0(0x176)]||_0x4185a9['mergedCli']?.['currentApp']||_0x4185a9[_0x2b9ca0(0x15a)]?.[_0x2b9ca0(0x192)]):new Map(),_0x408783=createHookLocationMap(_0x4823fb),_0x3594cb=JSON[_0x2b9ca0(0x12a)](JSON['stringify'](_0x4ce88e)),_0x176fbd=_0x4185a9['appCode'],_0x167688=_0x3594cb[_0x2b9ca0(0x129)][_0x176fbd];if(!_0x167688)throw new Error(_0x2b9ca0(0x141)+_0x176fbd+_0x2b9ca0(0x10e));const _0x5719cb=_0x56c3e9?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x3688b5,_0x167688,_0xe46bf4,await scanLocalBffFunctions(_0x3688b5,_0x2b9ca0(0x107))),_0x167688):undefined,_0x42a51a=createPullFileTransaction(),_0x39bd53=[],_0x50fc87=[],_0x2cee57=[],_0x5389a1=[];for(const _0x2de854 of _0x10b1ac){const _0x185349=resolveRemoteScriptTarget(_0x3688b5,_0x2de854,_0x408783,_0x167688[_0x2b9ca0(0x104)],_0xe46bf4);if(!_0x185349){_0x50fc87[_0x2b9ca0(0x10d)]({'lockKey':_0x2de854[_0x2b9ca0(0x193)]+'/'+_0x2de854[_0x2b9ca0(0x15e)],'reason':'unresolvable\x20target\x20path'});continue;}const _0x11b557=_0x167688[_0x2b9ca0(0x104)][_0x185349[_0x2b9ca0(0x157)]];try{if(!_0x2de854['id'])throw new Error(_0x2b9ca0(0x11c));if(_0x2de854['scriptContent']==null)throw new Error(_0x2b9ca0(0x11d));const _0x178717=_0x2de854['scriptContent'],_0x536c04=computeContentHash(_0x178717);if(!_0x5da91b){const _0x5d5e9d=await hasUnsyncedLocalChanges(_0x185349[_0x2b9ca0(0x124)],_0x11b557,_0x536c04);if(_0x5d5e9d){_0x2cee57[_0x2b9ca0(0x10d)](localUnsyncedConflict(_0x185349,_0x2de854['id']));continue;}}await _0x42a51a['write'](_0x185349[_0x2b9ca0(0x124)],_0x178717);const _0x34870e={'hash':_0x536c04,'remoteId':_0x2de854['id'],'version':_0x2de854['version']};_0x185349[_0x2b9ca0(0x189)]===_0x2b9ca0(0x107)&&_0x185349[_0x2b9ca0(0x10a)]&&(_0x34870e['alias']=_0x185349[_0x2b9ca0(0x10a)][_0x2b9ca0(0x10b)],_0x34870e[_0x2b9ca0(0x159)]=_0x185349[_0x2b9ca0(0x10a)][_0x2b9ca0(0x159)],_0x34870e['operationType']=_0x185349[_0x2b9ca0(0x10a)][_0x2b9ca0(0x134)],_0x34870e[_0x2b9ca0(0x103)]=_0x185349['hookLocation'][_0x2b9ca0(0x103)]),_0x167688[_0x2b9ca0(0x104)][_0x185349['lockKey']]=_0x34870e,_0x39bd53[_0x2b9ca0(0x10d)]({'lockKey':_0x185349['lockKey'],'remoteId':_0x2de854['id']});}catch(_0xd37dd){_0x5389a1[_0x2b9ca0(0x10d)]({'lockKey':_0x185349[_0x2b9ca0(0x157)],'error':_0xd37dd instanceof Error?_0xd37dd['message']:String(_0xd37dd)});}}_0x167688[_0x2b9ca0(0x163)]=new Date()[_0x2b9ca0(0x102)]();try{await writeBffLockFile(_0x3688b5[_0x2b9ca0(0x145)],_0x3594cb);}catch(_0x468f2c){const _0x424185=[...await _0x42a51a[_0x2b9ca0(0x187)](),...await _0x5719cb?.[_0x2b9ca0(0x187)]()??[]];throw withRollbackErrors(_0x468f2c,_0x2b9ca0(0x13b),_0x424185);}return{'ok':_0x5389a1[_0x2b9ca0(0x133)]===0x0,'data':{'pulled':_0x39bd53,'skipped':_0x50fc87,'conflicts':_0x2cee57,'failed':_0x5389a1},'message':formatPullMessage(_0x39bd53[_0x2b9ca0(0x133)],_0x50fc87['length'],_0x2cee57[_0x2b9ca0(0x133)],_0x5389a1[_0x2b9ca0(0x133)])};}};function localUnsyncedConflict(_0x1def99,_0x2d8b7a){const _0x4fc692=a43_0x5196c8,_0x2dfdde=_0x1def99[_0x4fc692(0x157)]['split']('/')['at'](-0x1);return{'code':_0x4fc692(0x14d),'lockKey':_0x1def99[_0x4fc692(0x157)],'filePath':_0x1def99[_0x4fc692(0x124)],..._0x2d8b7a!=null?{'remoteId':_0x2d8b7a}:{},'message':_0x4fc692(0x116),'nextAction':{'action':_0x4fc692(0x136),'command':CLI_BIN_NAME+_0x4fc692(0x162)+_0x1def99[_0x4fc692(0x189)]+_0x4fc692(0x18e)+_0x2dfdde+_0x4fc692(0x156),'requiresReview':!![],'message':_0x4fc692(0x174)}};}function formatPullMessage(_0x20dd7e,_0x3a306f,_0x4d4b0e,_0x3c6b01){const _0x2ec759=a43_0x5196c8,_0x220be9=[_0x2ec759(0x120)+_0x20dd7e+_0x2ec759(0x128),_0x3a306f+'\x20skipped'];_0x4d4b0e>0x0&&_0x220be9[_0x2ec759(0x10d)](_0x4d4b0e+_0x2ec759(0x18a)+(_0x4d4b0e===0x1?'':'s')+'\x20'+(_0x4d4b0e===0x1?_0x2ec759(0x11f):_0x2ec759(0x190))+_0x2ec759(0x17e));if(_0x3c6b01>0x0)_0x220be9['push'](_0x3c6b01+_0x2ec759(0x110));return _0x220be9[_0x2ec759(0x151)](',\x20');}async function hasUnsyncedLocalChanges(_0x2ae784,_0x13242c,_0x248828){const _0x38c635=a43_0x5196c8;if(!await fileExists(_0x2ae784))return![];const _0x352aca=await computeFileHash(_0x2ae784);if(!_0x13242c)return _0x248828?_0x352aca!==_0x248828:!![];return _0x352aca!==_0x13242c[_0x38c635(0x138)];}function createPullFileTransaction(){const _0x295cd5=new Map(),_0x2a217f=async(_0x546609,_0x3619ef)=>{const _0x55c4a8=a43_0x3a3d;try{if(_0x3619ef[_0x55c4a8(0x178)])await ensureParentDirectory(_0x546609),await writeFile(_0x546609,_0x3619ef[_0x55c4a8(0x160)]);else try{await unlink(_0x546609);}catch(_0x4d6dba){if(_0x4d6dba[_0x55c4a8(0x118)]!==_0x55c4a8(0x184))throw _0x4d6dba;}return undefined;}catch(_0x6f73cd){return _0x6f73cd instanceof Error?_0x6f73cd:new Error(String(_0x6f73cd));}};return{async 'write'(_0x372706,_0x446e4e){const _0x4e5c68=a43_0x3a3d;if(!_0x295cd5[_0x4e5c68(0x18b)](_0x372706))try{_0x295cd5[_0x4e5c68(0x17d)](_0x372706,{'existed':!![],'content':await readFile(_0x372706)});}catch(_0x32cfb4){if(_0x32cfb4['code']!==_0x4e5c68(0x184))throw _0x32cfb4;_0x295cd5[_0x4e5c68(0x17d)](_0x372706,{'existed':![]});}try{await ensureParentDirectory(_0x372706),await writeFile(_0x372706,_0x446e4e,_0x4e5c68(0x172));}catch(_0x323ba6){const _0x32f5bb=await _0x2a217f(_0x372706,_0x295cd5[_0x4e5c68(0x13d)](_0x372706));if(!_0x32f5bb)_0x295cd5['delete'](_0x372706);throw withRollbackErrors(_0x323ba6,_0x4e5c68(0x16e)+_0x372706+'\x22.',_0x32f5bb?[_0x32f5bb]:[]);}},async 'rollback'(){const _0x138204=a43_0x3a3d,_0x4efb06=[];for(const [_0x59419a,_0x21c424]of[..._0x295cd5['entries']()][_0x138204(0x12b)]()){const _0x1d1cab=await _0x2a217f(_0x59419a,_0x21c424);_0x1d1cab&&_0x4efb06[_0x138204(0x10d)](new Error(_0x138204(0x11e)+_0x59419a+'\x22:\x20'+_0x1d1cab[_0x138204(0x18f)]));}return _0x4efb06;}};}function withRollbackErrors(_0x41a011,_0x16139a,_0xca5b2a){const _0x55ab6c=a43_0x5196c8,_0x3674f9=_0x41a011 instanceof Error?_0x41a011:new Error(String(_0x41a011));if(_0xca5b2a[_0x55ab6c(0x133)]===0x0)return _0x3674f9;return new AggregateError([_0x3674f9,..._0xca5b2a],_0x16139a+_0x55ab6c(0x12e)+_0xca5b2a[_0x55ab6c(0x148)](_0x537fcb=>_0x537fcb[_0x55ab6c(0x18f)])[_0x55ab6c(0x151)](';\x20'));}function buildDatasetCodeToAliasMap(_0x3adbaf,_0x120a32,_0x3f9184){const _0x11ec50=a43_0x5196c8,_0x1fb0c1=resolveApiModelSource(_0x3adbaf,_0x120a32,_0x3f9184),_0xf33f7c=loadAliasMap(_0x3adbaf,undefined,_0x1fb0c1['filePath'],_0x1fb0c1[_0x11ec50(0x15b)]);return assertUnambiguousHookAliases(_0xf33f7c),new Map(_0xf33f7c[_0x11ec50(0x148)](_0x3ebc2c=>[_0x3ebc2c[_0x11ec50(0x159)][_0x11ec50(0x191)](),_0x3ebc2c['alias']]));}async function planHookDirectoryMigration(_0x2fc93e,_0x17f442,_0x2ce14b,_0x1be22f){const _0x4df57d=a43_0x5196c8,_0x187095=new Map();for(const [_0x3d6fc9,_0x1ebec8]of Object[_0x4df57d(0x14c)](_0x17f442['functions'])){const [_0x139c04,_0x5de625,_0xecaa5f,_0x36830d,_0x1fc112,..._0x14d36f]=_0x3d6fc9[_0x4df57d(0x171)]('/');if(_0x139c04!==_0x4df57d(0x107)||!_0x5de625||!_0xecaa5f||!_0x36830d||!_0x1fc112||_0x14d36f[_0x4df57d(0x133)]>0x0||!_0x1ebec8[_0x4df57d(0x159)])continue;const _0x1006b8=_0x2ce14b[_0x4df57d(0x13d)](_0x1ebec8[_0x4df57d(0x159)]['toLowerCase']()),_0x2568f4=_0x1006b8??_0x1ebec8[_0x4df57d(0x159)];if(!isSafeHookDirectorySegment(_0x5de625))throw CliErrors[_0x4df57d(0x130)](_0x4df57d(0x158)+_0x5de625+_0x4df57d(0x15c));if(!isSafeHookDirectorySegment(_0x2568f4))throw CliErrors['validation'](_0x4df57d(0x177)+_0x5de625+_0x4df57d(0x109));if(_0x5de625===_0x2568f4)continue;const _0x198e79=_0x187095[_0x4df57d(0x13d)](_0x5de625)??{'datasetCode':_0x1ebec8['datasetCode'],'alias':_0x1006b8,'keyChanges':[]};if(_0x198e79[_0x4df57d(0x159)]!==_0x1ebec8[_0x4df57d(0x159)])throw CliErrors[_0x4df57d(0x130)](_0x4df57d(0x177)+_0x5de625+_0x4df57d(0x11a));const _0x266798=_0x4df57d(0x140)+_0x2568f4+'/'+_0xecaa5f+'/'+_0x36830d+'/'+_0x1fc112;try{resolveLocalFilePathFromLockKey(_0x2fc93e,_0x3d6fc9),resolveLocalFilePathFromLockKey(_0x2fc93e,_0x266798);}catch(_0x30f999){throw CliErrors[_0x4df57d(0x130)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22'+_0x3d6fc9+_0x4df57d(0x144)+(_0x30f999 instanceof Error?_0x30f999[_0x4df57d(0x18f)]:String(_0x30f999)));}_0x198e79[_0x4df57d(0x119)][_0x4df57d(0x10d)]({'oldLockKey':_0x3d6fc9,'newLockKey':_0x266798,'entry':_0x1ebec8}),_0x187095['set'](_0x5de625,_0x198e79);}const _0x47ff49=new Set([..._0x187095[_0x4df57d(0x16c)]()][_0x4df57d(0x16d)](_0x293c0c=>_0x293c0c[_0x4df57d(0x119)]['map'](_0x157287=>_0x157287[_0x4df57d(0x16f)]))),_0xd8e483=new Map(),_0x5e2ac9=new Map();for(const [_0x57747f,_0x5af870]of _0x187095){const _0x228ec2=_0x5af870['alias']??_0x5af870[_0x4df57d(0x159)],_0x4d7cfe=hookDirectoryIdentity(_0x228ec2),_0x268aa0=_0xd8e483[_0x4df57d(0x13d)](_0x4d7cfe);if(_0x268aa0&&_0x268aa0!==_0x57747f)throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x268aa0+_0x4df57d(0x125)+_0x57747f+_0x4df57d(0x147)+_0x228ec2+_0x4df57d(0x126));_0xd8e483[_0x4df57d(0x17d)](_0x4d7cfe,_0x57747f);for(const _0x3cd846 of _0x5af870['keyChanges']){const _0x9137c1=_0x5e2ac9[_0x4df57d(0x13d)](_0x3cd846[_0x4df57d(0x17a)]);if(_0x9137c1&&_0x9137c1!==_0x3cd846['oldLockKey'])throw CliErrors[_0x4df57d(0x130)](_0x4df57d(0x154)+_0x9137c1+'\x22\x20and\x20\x22'+_0x3cd846[_0x4df57d(0x16f)]+_0x4df57d(0x147)+_0x3cd846['newLockKey']+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x47ff49[_0x4df57d(0x18b)](_0x3cd846[_0x4df57d(0x17a)]))throw CliErrors[_0x4df57d(0x130)](_0x4df57d(0x169)+_0x3cd846[_0x4df57d(0x16f)]+_0x4df57d(0x12f)+_0x3cd846[_0x4df57d(0x17a)]+'\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');_0x5e2ac9[_0x4df57d(0x17d)](_0x3cd846['newLockKey'],_0x3cd846[_0x4df57d(0x16f)]);}}const _0x750751=new Map();for(const [_0x132e0b,_0x5818e2]of _0x2ce14b){_0x750751[_0x4df57d(0x17d)](hookDirectoryIdentity(_0x5818e2),_0x132e0b);}const _0x136bcd=[];for(const [_0x35f2dc,_0x57c495]of _0x187095){const _0x37f2b5=_0x57c495[_0x4df57d(0x10b)]??_0x57c495[_0x4df57d(0x159)],_0x54e2e5=join(_0x2fc93e['scriptsRootDir'],'HOOK',_0x35f2dc),_0x169b5e=join(_0x2fc93e['scriptsRootDir'],'HOOK',_0x37f2b5),_0x5082e4=await directoryExists(_0x54e2e5),_0x4ebca1=await directoryExists(_0x169b5e),_0xf9d177=_0x5082e4?_0x4ebca1?await sameDirectory(_0x54e2e5,_0x169b5e)?_0x4df57d(0x142):undefined:_0x4df57d(0x161):_0x4df57d(0x123);if(!_0xf9d177)throw CliErrors[_0x4df57d(0x130)](_0x4df57d(0x177)+_0x35f2dc+_0x4df57d(0x17b)+_0x37f2b5+_0x4df57d(0x10f));const _0x25082d=_0x750751[_0x4df57d(0x13d)](hookDirectoryIdentity(_0x35f2dc));if(_0x25082d&&_0x25082d!==_0x57c495['datasetCode'][_0x4df57d(0x191)]()){const _0x4c12b1=new Set(_0x57c495[_0x4df57d(0x119)]['map'](_0x478611=>_0x478611[_0x4df57d(0x16f)])),_0x5e70be=_0x1be22f[_0x4df57d(0x15f)](_0x5d79ea=>_0x5d79ea[_0x4df57d(0x189)]===_0x4df57d(0x107)&&_0x5d79ea[_0x4df57d(0x10b)]!=null&&hookDirectoryIdentity(_0x5d79ea['alias'])===hookDirectoryIdentity(_0x35f2dc)&&!_0x4c12b1[_0x4df57d(0x18b)](_0x5d79ea[_0x4df57d(0x157)]));if(_0x5e70be['length']>0x0)throw CliErrors[_0x4df57d(0x130)](_0x4df57d(0x177)+_0x35f2dc+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x26f435=_0x750751[_0x4df57d(0x13d)](hookDirectoryIdentity(_0x37f2b5));if(_0x26f435&&_0x26f435!==_0x57c495[_0x4df57d(0x159)]['toLowerCase']())throw CliErrors[_0x4df57d(0x130)](_0x4df57d(0x177)+_0x35f2dc+_0x4df57d(0x17b)+_0x37f2b5+'\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');for(const _0x33ad01 of _0x57c495[_0x4df57d(0x119)]){const _0x2f8e53=_0x17f442[_0x4df57d(0x104)][_0x33ad01[_0x4df57d(0x17a)]];if(_0x2f8e53&&!_0x47ff49['has'](_0x33ad01[_0x4df57d(0x17a)])&&!sameHookIdentity(_0x33ad01[_0x4df57d(0x183)],_0x2f8e53))throw CliErrors[_0x4df57d(0x130)](_0x4df57d(0x177)+_0x35f2dc+_0x4df57d(0x17b)+_0x37f2b5+_0x4df57d(0x146));}_0x136bcd['push']({'oldDirectory':_0x35f2dc,'newDirectory':_0x37f2b5,'oldDirectoryPath':_0x54e2e5,'newDirectoryPath':_0x169b5e,'mode':_0xf9d177,'alias':_0x57c495['alias'],'keyChanges':_0x57c495[_0x4df57d(0x119)]});}const _0x3b7cd5={..._0x17f442[_0x4df57d(0x104)]},_0x27332b=new Map(),_0x5d7e23=new Map();for(const _0x415f40 of _0x136bcd){const _0x18a148=_0x415f40[_0x4df57d(0x16a)]!=='rekey';_0x18a148&&_0x5d7e23[_0x4df57d(0x17d)](hookDirectoryIdentity(_0x415f40[_0x4df57d(0x137)]),_0x415f40[_0x4df57d(0x164)]);for(const _0x14fa8a of _0x415f40['keyChanges']){const _0x202811=_0x3b7cd5[_0x14fa8a[_0x4df57d(0x17a)]],_0x1bd110=_0x18a148?_0x14fa8a[_0x4df57d(0x183)]:_0x202811??_0x14fa8a['entry'];_0x3b7cd5[_0x14fa8a[_0x4df57d(0x17a)]]=canonicalizeHookEntry(_0x1bd110,_0x415f40['alias']),delete _0x3b7cd5[_0x14fa8a[_0x4df57d(0x16f)]],_0x18a148&&_0x27332b['set'](_0x14fa8a[_0x4df57d(0x17a)],resolveLocalFilePathFromLockKey(_0x2fc93e,_0x14fa8a['oldLockKey']));}}return{'migrations':_0x136bcd,'projectedFunctions':_0x3b7cd5,'sourceFilePathByNewLockKey':_0x27332b,'sourceDirectoryPathByNewDirectory':_0x5d7e23};}function resolveMigratedSourceFilePath(_0xdf74ac,_0x4f44ff){const _0x5f522d=a43_0x5196c8;if(!_0xdf74ac||!_0x4f44ff)return undefined;const _0x115c6c=_0xdf74ac[_0x5f522d(0x168)]['get'](_0x4f44ff[_0x5f522d(0x157)]);if(_0x115c6c)return _0x115c6c;if(_0x4f44ff[_0x5f522d(0x189)]!==_0x5f522d(0x107))return undefined;const [,_0x26db3d,..._0x1c52da]=_0x4f44ff[_0x5f522d(0x157)][_0x5f522d(0x171)]('/');if(!_0x26db3d||_0x1c52da[_0x5f522d(0x133)]===0x0)return undefined;const _0x17c8a7=_0xdf74ac[_0x5f522d(0x14f)][_0x5f522d(0x13d)](hookDirectoryIdentity(_0x26db3d));return _0x17c8a7?join(_0x17c8a7,..._0x1c52da)+'.js':undefined;}function sameHookIdentity(_0xa8e3b1,_0x339c84){const _0x3b502b=a43_0x5196c8;return _0xa8e3b1[_0x3b502b(0x13a)]===_0x339c84[_0x3b502b(0x13a)]&&_0xa8e3b1[_0x3b502b(0x159)]===_0x339c84[_0x3b502b(0x159)]&&_0xa8e3b1[_0x3b502b(0x134)]===_0x339c84['operationType']&&_0xa8e3b1[_0x3b502b(0x103)]===_0x339c84[_0x3b502b(0x103)];}function canonicalizeHookEntry(_0x3165bb,_0x52e518){const {alias:_0x44a8c5,..._0x1a34be}=_0x3165bb;return _0x52e518?{..._0x1a34be,'alias':_0x52e518}:_0x1a34be;}function hookDirectoryIdentity(_0x80b31c){const _0xea50c7=a43_0x5196c8;return _0x80b31c['normalize'](_0xea50c7(0x18d))[_0xea50c7(0x191)]();}function a43_0x3a3d(_0x5d97fe,_0x31751e){_0x5d97fe=_0x5d97fe-0x102;const _0x2af05b=a43_0x2af0();let _0x3a3d12=_0x2af05b[_0x5d97fe];return _0x3a3d12;}function isSafeHookDirectorySegment(_0x1e4032){return isSafeLockKeySegment(_0x1e4032);}async function sameDirectory(_0xd19ca4,_0xa70096){const _0x566e94=a43_0x5196c8,[_0x143450,_0x211c6e]=await Promise['all']([stat(_0xd19ca4),stat(_0xa70096)]);return _0x143450[_0x566e94(0x181)]===_0x211c6e[_0x566e94(0x181)]&&_0x143450[_0x566e94(0x12d)]===_0x211c6e[_0x566e94(0x12d)];}async function applyHookDirectoryMigration(_0x58b7fc,_0x396dbc){const _0xb52163=a43_0x5196c8,_0x225d9e=_0x396dbc[_0xb52163(0x104)],_0x38479b=_0x396dbc[_0xb52163(0x163)],_0xf32ca0=[],_0x1f8078=async()=>{const _0x20f2ec=_0xb52163,_0x59cf10=[];_0x396dbc[_0x20f2ec(0x104)]=_0x225d9e,_0x396dbc[_0x20f2ec(0x163)]=_0x38479b;for(const {migration:_0x175488,temporaryPath:_0x44e1c9}of[..._0xf32ca0][_0x20f2ec(0x12b)]()){try{_0x44e1c9?(await rename(_0x175488[_0x20f2ec(0x114)],_0x44e1c9),await rename(_0x44e1c9,_0x175488['oldDirectoryPath'])):await rename(_0x175488['newDirectoryPath'],_0x175488[_0x20f2ec(0x164)]);}catch(_0x3321bb){_0x59cf10[_0x20f2ec(0x10d)](new Error(_0x20f2ec(0x13c)+_0x175488[_0x20f2ec(0x15d)]+_0x20f2ec(0x179)+_0x175488[_0x20f2ec(0x137)]+_0x20f2ec(0x144)+(_0x3321bb instanceof Error?_0x3321bb['message']:String(_0x3321bb))));}}return _0x59cf10;};try{for(const _0x3d1387 of _0x58b7fc[_0xb52163(0x132)]){if(_0x3d1387[_0xb52163(0x16a)]==='move')await ensureParentDirectory(_0x3d1387[_0xb52163(0x114)]),await rename(_0x3d1387[_0xb52163(0x164)],_0x3d1387[_0xb52163(0x114)]),_0xf32ca0[_0xb52163(0x10d)]({'migration':_0x3d1387});else{if(_0x3d1387[_0xb52163(0x16a)]===_0xb52163(0x142)){const _0x227fc1=join(dirname(_0x3d1387['oldDirectoryPath']),_0xb52163(0x113)+randomUUID());await rename(_0x3d1387[_0xb52163(0x164)],_0x227fc1);try{await rename(_0x227fc1,_0x3d1387['newDirectoryPath']);}catch(_0x5e0434){try{await rename(_0x227fc1,_0x3d1387[_0xb52163(0x164)]);}catch(_0x3d7d0c){throw withRollbackErrors(_0x5e0434,_0xb52163(0x131)+_0x3d1387[_0xb52163(0x15d)]+_0xb52163(0x17b)+_0x3d1387[_0xb52163(0x137)]+'\x22;\x20temporary\x20directory\x20\x22'+_0x227fc1+_0xb52163(0x17f),[new Error('Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22'+_0x227fc1+_0xb52163(0x17b)+_0x3d1387[_0xb52163(0x15d)]+'\x22:\x20'+(_0x3d7d0c instanceof Error?_0x3d7d0c[_0xb52163(0x18f)]:String(_0x3d7d0c)))]);}throw _0x5e0434;}_0xf32ca0[_0xb52163(0x10d)]({'migration':_0x3d1387,'temporaryPath':_0x227fc1});}}}return _0x396dbc[_0xb52163(0x104)]=_0x58b7fc[_0xb52163(0x166)],{'rollback':_0x1f8078};}catch(_0x22f44b){const _0x42cce8=await _0x1f8078();throw withRollbackErrors(_0x22f44b,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x42cce8);}}async function confirmForce(){const _0x1d7575=a43_0x5196c8,_0x2fe9f3=createInterface({'input':process[_0x1d7575(0x10c)],'output':process[_0x1d7575(0x108)]}),_0x5a8027=await new Promise(_0x1df636=>{const _0x31ee02=_0x1d7575;_0x2fe9f3[_0x31ee02(0x18c)](_0x31ee02(0x180),_0x1df636);});return _0x2fe9f3['close'](),['y','yes']['includes'](_0x5a8027[_0x1d7575(0x153)]()[_0x1d7575(0x191)]());}
1
+ const a43_0x4d5031=a43_0x1a84;(function(_0xf7319c,_0x4e959b){const _0x5b6823=a43_0x1a84,_0x419645=_0xf7319c();while(!![]){try{const _0x21fe1c=-parseInt(_0x5b6823(0x1b6))/0x1+-parseInt(_0x5b6823(0x1c1))/0x2*(-parseInt(_0x5b6823(0x1ba))/0x3)+-parseInt(_0x5b6823(0x1d4))/0x4+-parseInt(_0x5b6823(0x1c7))/0x5*(parseInt(_0x5b6823(0x1cb))/0x6)+parseInt(_0x5b6823(0x1e4))/0x7+parseInt(_0x5b6823(0x1d9))/0x8*(parseInt(_0x5b6823(0x1fe))/0x9)+parseInt(_0x5b6823(0x1b4))/0xa;if(_0x21fe1c===_0x4e959b)break;else _0x419645['push'](_0x419645['shift']());}catch(_0x2ab385){_0x419645['push'](_0x419645['shift']());}}}(a43_0x1ae3,0x8bd26));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';function a43_0x1a84(_0x1f6c96,_0x57a0ef){_0x1f6c96=_0x1f6c96-0x179;const _0x1ae37e=a43_0x1ae3();let _0x1a84c2=_0x1ae37e[_0x1f6c96];return _0x1a84c2;}import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';function a43_0x1ae3(){const _0x1d0585=['\x22:\x20','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','str','\x20skipped','mergedCli','Remote\x20script\x20missing\x20id.','stderr','selectedAppName','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','skipped','case-rename','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','\x20bff\x20push\x20--type\x20','scriptType','stringify','utf8','alias','COMMON','.js','ENDPOINT','\x22\x20to\x20\x22','map','write','operationType','45ggQuQh','HOOK','Remote\x20script\x20missing\x20content.','\x20Recovery\x20errors:\x20','code','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','requires','hookLocation','Pull\x20only\x20this\x20script\x20type','functions','BFF_LOCAL_UNSYNCED','entry','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','string','some','GET','newDirectoryPath','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','newDirectory','cancelled','set','lastSync','values','boolean','/api/management/library/scripts/list?appCode=','apiDir','migrations','profileName','\x20pulled','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','\x20resolution','version','dev','force','\x20failed','Force\x20pull\x20cancelled.','&type=','includes','push_local','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x20--format\x20compress','bool','\x22\x20may\x20remain.','.hook-directory-migrate-','pull','lockKey','\x22\x20and\x20\x22','Failed\x20to\x20write\x20local\x20script\x20\x22','\x22:\x20its\x20target\x20\x22','sourceDirectoryPathByNewDirectory','defaultApp','entries','scriptsRootDir','rollback','rekey','datasetCode','conflict','newLockKey','\x22:\x20both\x20target\x20\x22','scriptContent','ENOENT','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x22\x20from\x20\x22','split','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','functionName','scriptsRoot','toLowerCase','message','oldDirectory','4332070AUxwNW','\x22;\x20temporary\x20directory\x20\x22','420602ShBpOA','reverse','oldDirectoryPath','question','21309rydajq','nonInteractive','length','toISOString','normalize','delete','content','112eTYbcp','\x22\x20from\x20the\x20lock\x20file.','get','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','all','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','5zxNlkK','\x22\x20not\x20found\x20after\x20ensureLockScope.','move','type','2524260cbDtFR','oldLockKey','has','ino','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','lockFilePath','projectedFunctions','3140672cqrLGc','&currentPage=1&pageSize=','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.','functionNode','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','609608tZnjdb','mode','filePath','trim','keyChanges','unresolvable\x20target\x20path','validation','NFC','appCode','push','require','6910470IVlAam'];a43_0x1ae3=function(){return _0x1d0585;};return a43_0x1ae3();}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':a43_0x4d5031(0x19a),'description':'Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','risk':'read','structuredErrors':!![],'flags':[{'name':a43_0x4d5031(0x1ca),'type':a43_0x4d5031(0x17b),'description':a43_0x4d5031(0x206),'enum':[a43_0x4d5031(0x1f7),a43_0x4d5031(0x1f9),a43_0x4d5031(0x1ff)]},{'name':a43_0x4d5031(0x18f),'type':a43_0x4d5031(0x185),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x24fb81){const _0x3f4790=a43_0x4d5031,_0x3394a1=loadBffProjectConfig(_0x24fb81['appCode']),_0x729e2c=await readBffLockFile(_0x3394a1[_0x3f4790(0x1d2)]),{appLock:_0x504b24}=ensureLockScope(_0x729e2c??createEmptyBffLock(),_0x24fb81['appCode'],_0x3394a1[_0x3f4790(0x1b0)],_0x3f4790(0x19a)),_0x579805=normalizeBffType(_0x24fb81['str'](_0x3f4790(0x1ca)))??undefined,[_0x327173,_0x49796e]=await Promise['all']([listBffScripts(_0x24fb81['appCode'],_0x579805),getBffScriptStatistics(_0x24fb81['appCode'])]),_0xfb7866=_0x327173['some'](_0x51958d=>normalizeBffType(_0x51958d[_0x3f4790(0x1f3)])==='HOOK'),_0x35ba94=_0xfb7866?buildDatasetCodeToAliasMap(_0x24fb81[_0x3f4790(0x187)],_0x24fb81['appCode'],_0x24fb81['selectedAppName']||_0x24fb81[_0x3f4790(0x1e9)]?.['currentApp']||_0x24fb81[_0x3f4790(0x1e9)]?.['defaultApp']):new Map(),_0xcf831e=_0xfb7866?await planHookDirectoryMigration(_0x3394a1,_0x504b24,_0x35ba94,await scanLocalBffFunctions(_0x3394a1,_0x3f4790(0x1ff))):undefined,_0x4df1a7=createHookLocationMap(_0x49796e),_0x439675=[];for(const _0x5eea18 of _0x327173){const _0x11cbae=resolveRemoteScriptTarget(_0x3394a1,_0x5eea18,_0x4df1a7,_0xcf831e?.[_0x3f4790(0x1d3)]??_0x504b24['functions'],_0x35ba94);if(!_0x11cbae){_0x439675[_0x3f4790(0x1e2)]({'scriptType':_0x5eea18[_0x3f4790(0x1f3)],'functionName':_0x5eea18[_0x3f4790(0x1af)]??'','status':_0x3f4790(0x1ee),'reason':'unresolvable\x20target\x20path'});continue;}const _0x18b61e=(_0xcf831e?.['projectedFunctions']??_0x504b24[_0x3f4790(0x207)])[_0x11cbae[_0x3f4790(0x19b)]],_0x493da9=_0x5eea18[_0x3f4790(0x1a9)]!=null?computeContentHash(_0x5eea18[_0x3f4790(0x1a9)]):undefined,_0x426351=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0xcf831e,_0x11cbae)??_0x11cbae[_0x3f4790(0x1db)],_0x18b61e,_0x493da9),_0x442d50=_0x426351?localUnsyncedConflict(_0x11cbae,_0x5eea18['id']):undefined;_0x439675[_0x3f4790(0x1e2)]({'lockKey':_0x11cbae[_0x3f4790(0x19b)],'filePath':_0x11cbae['filePath'],'remoteId':_0x5eea18['id']??null,'status':_0x442d50?_0x3f4790(0x1a6):'would_pull',..._0x442d50?{'conflict':_0x442d50}:{},..._0x11cbae[_0x3f4790(0x205)]?{'alias':_0x11cbae[_0x3f4790(0x205)]['alias']??null,'datasetCode':_0x11cbae[_0x3f4790(0x205)][_0x3f4790(0x1a5)],'operationType':_0x11cbae[_0x3f4790(0x205)][_0x3f4790(0x1fd)],'functionNode':_0x11cbae[_0x3f4790(0x205)]['functionNode']}:{}});}return{'method':_0x3f4790(0x17d),'url':_0x3f4790(0x186)+_0x24fb81[_0x3f4790(0x1e1)]+(_0x579805?_0x3f4790(0x192)+_0x579805:'')+_0x3f4790(0x1d5)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x24fb81[_0x3f4790(0x1e1)],'filterType':_0x579805??null,..._0xcf831e&&_0xcf831e[_0x3f4790(0x188)]['length']>0x0?{'hookDirectoryMigrations':_0xcf831e[_0x3f4790(0x188)][_0x3f4790(0x1fb)](_0x2fb1d6=>({'from':_0x2fb1d6[_0x3f4790(0x1b3)],'to':_0x2fb1d6[_0x3f4790(0x180)]}))}:{},'files':_0x439675},'description':'Would\x20inspect\x20'+_0x439675[_0x3f4790(0x1bc)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x237ade){const _0x4f9bb4=a43_0x4d5031,_0x3563a3=loadBffProjectConfig(_0x237ade[_0x4f9bb4(0x1e1)]),_0x22c256=await readBffLockFile(_0x3563a3[_0x4f9bb4(0x1d2)]),{lockData:_0x4ec4c9,appLock:_0x33202b}=ensureLockScope(_0x22c256??createEmptyBffLock(),_0x237ade[_0x4f9bb4(0x1e1)],_0x3563a3['scriptsRoot'],_0x4f9bb4(0x19a)),_0x4ddb5f=normalizeBffType(_0x237ade[_0x4f9bb4(0x1e7)]('type'))??undefined;if(_0x237ade[_0x4f9bb4(0x1e7)](_0x4f9bb4(0x1ca))&&!_0x4ddb5f)throw CliErrors['validation'](_0x4f9bb4(0x1cf));const [_0x9848b6,_0xf4be6a]=await Promise[_0x4f9bb4(0x1c5)]([listBffScripts(_0x237ade[_0x4f9bb4(0x1e1)],_0x4ddb5f),getBffScriptStatistics(_0x237ade[_0x4f9bb4(0x1e1)])]);if(_0x9848b6[_0x4f9bb4(0x1bc)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x4f9bb4(0x1f1)};const _0x4edfe4=_0x237ade[_0x4f9bb4(0x197)](_0x4f9bb4(0x18f));if(_0x4edfe4&&!_0x237ade[_0x4f9bb4(0x1bb)]){const _0x1a69aa=await confirmForce();if(!_0x1a69aa)throw CliErrors[_0x4f9bb4(0x181)](_0x4f9bb4(0x191));}if(_0x4edfe4&&_0x237ade[_0x4f9bb4(0x1bb)]){}const _0x5b5603=_0x9848b6[_0x4f9bb4(0x17c)](_0x194e21=>normalizeBffType(_0x194e21[_0x4f9bb4(0x1f3)])===_0x4f9bb4(0x1ff)),_0x5cf257=_0x5b5603?buildDatasetCodeToAliasMap(_0x237ade[_0x4f9bb4(0x187)],_0x237ade[_0x4f9bb4(0x1e1)],_0x237ade[_0x4f9bb4(0x1ec)]||_0x237ade[_0x4f9bb4(0x1e9)]?.['currentApp']||_0x237ade[_0x4f9bb4(0x1e9)]?.[_0x4f9bb4(0x1a0)]):new Map(),_0xb042d=createHookLocationMap(_0xf4be6a),_0x487bc1=JSON['parse'](JSON[_0x4f9bb4(0x1f4)](_0x4ec4c9)),_0x507ba0=_0x237ade[_0x4f9bb4(0x1e1)],_0x51281f=_0x487bc1['apps'][_0x507ba0];if(!_0x51281f)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x507ba0+_0x4f9bb4(0x1c8));const _0x5bfa67=_0x5b5603?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x3563a3,_0x51281f,_0x5cf257,await scanLocalBffFunctions(_0x3563a3,_0x4f9bb4(0x1ff))),_0x51281f):undefined,_0x435967=createPullFileTransaction(),_0x44b17a=[],_0x33cacc=[],_0x3c6f44=[],_0x46bdfa=[];for(const _0x562079 of _0x9848b6){const _0x34d8b0=resolveRemoteScriptTarget(_0x3563a3,_0x562079,_0xb042d,_0x51281f[_0x4f9bb4(0x207)],_0x5cf257);if(!_0x34d8b0){_0x33cacc[_0x4f9bb4(0x1e2)]({'lockKey':_0x562079[_0x4f9bb4(0x1f3)]+'/'+_0x562079[_0x4f9bb4(0x1af)],'reason':_0x4f9bb4(0x1de)});continue;}const _0x222ad2=_0x51281f['functions'][_0x34d8b0['lockKey']];try{if(!_0x562079['id'])throw new Error(_0x4f9bb4(0x1ea));if(_0x562079['scriptContent']==null)throw new Error(_0x4f9bb4(0x200));const _0x47f06a=_0x562079['scriptContent'],_0x4e20f6=computeContentHash(_0x47f06a);if(!_0x4edfe4){const _0x39b19c=await hasUnsyncedLocalChanges(_0x34d8b0[_0x4f9bb4(0x1db)],_0x222ad2,_0x4e20f6);if(_0x39b19c){_0x3c6f44[_0x4f9bb4(0x1e2)](localUnsyncedConflict(_0x34d8b0,_0x562079['id']));continue;}}await _0x435967[_0x4f9bb4(0x1fc)](_0x34d8b0[_0x4f9bb4(0x1db)],_0x47f06a);const _0x42809c={'hash':_0x4e20f6,'remoteId':_0x562079['id'],'version':_0x562079[_0x4f9bb4(0x18d)]};_0x34d8b0[_0x4f9bb4(0x1ca)]===_0x4f9bb4(0x1ff)&&_0x34d8b0[_0x4f9bb4(0x205)]&&(_0x42809c[_0x4f9bb4(0x1f6)]=_0x34d8b0['hookLocation']['alias'],_0x42809c[_0x4f9bb4(0x1a5)]=_0x34d8b0['hookLocation'][_0x4f9bb4(0x1a5)],_0x42809c['operationType']=_0x34d8b0['hookLocation']['operationType'],_0x42809c['functionNode']=_0x34d8b0[_0x4f9bb4(0x205)][_0x4f9bb4(0x1d7)]),_0x51281f[_0x4f9bb4(0x207)][_0x34d8b0['lockKey']]=_0x42809c,_0x44b17a[_0x4f9bb4(0x1e2)]({'lockKey':_0x34d8b0[_0x4f9bb4(0x19b)],'remoteId':_0x562079['id']});}catch(_0x1cb533){_0x46bdfa[_0x4f9bb4(0x1e2)]({'lockKey':_0x34d8b0[_0x4f9bb4(0x19b)],'error':_0x1cb533 instanceof Error?_0x1cb533[_0x4f9bb4(0x1b2)]:String(_0x1cb533)});}}_0x51281f[_0x4f9bb4(0x183)]=new Date()[_0x4f9bb4(0x1bd)]();try{await writeBffLockFile(_0x3563a3[_0x4f9bb4(0x1d2)],_0x487bc1);}catch(_0x370dc4){const _0x8bfb04=[...await _0x435967['rollback'](),...await _0x5bfa67?.[_0x4f9bb4(0x1a3)]()??[]];throw withRollbackErrors(_0x370dc4,_0x4f9bb4(0x17a),_0x8bfb04);}return{'ok':_0x46bdfa[_0x4f9bb4(0x1bc)]===0x0,'data':{'pulled':_0x44b17a,'skipped':_0x33cacc,'conflicts':_0x3c6f44,'failed':_0x46bdfa},'message':formatPullMessage(_0x44b17a[_0x4f9bb4(0x1bc)],_0x33cacc['length'],_0x3c6f44['length'],_0x46bdfa[_0x4f9bb4(0x1bc)])};}};function localUnsyncedConflict(_0x219241,_0x18e852){const _0x421ae4=a43_0x4d5031,_0x4894c7=_0x219241['lockKey']['split']('/')['at'](-0x1);return{'code':_0x421ae4(0x208),'lockKey':_0x219241[_0x421ae4(0x19b)],'filePath':_0x219241[_0x421ae4(0x1db)],..._0x18e852!=null?{'remoteId':_0x18e852}:{},'message':_0x421ae4(0x18b),'nextAction':{'action':_0x421ae4(0x194),'command':CLI_BIN_NAME+_0x421ae4(0x1f2)+_0x219241['type']+'\x20--name\x20'+_0x4894c7+_0x421ae4(0x196),'requiresReview':!![],'message':_0x421ae4(0x1d6)}};}function formatPullMessage(_0x108efd,_0x5c0020,_0x2f4504,_0x2d5986){const _0x28c865=a43_0x4d5031,_0x447d18=['Pull\x20complete:\x20'+_0x108efd+_0x28c865(0x18a),_0x5c0020+_0x28c865(0x1e8)];_0x2f4504>0x0&&_0x447d18['push'](_0x2f4504+'\x20conflict'+(_0x2f4504===0x1?'':'s')+'\x20'+(_0x2f4504===0x1?_0x28c865(0x204):_0x28c865(0x1e3))+_0x28c865(0x18c));if(_0x2d5986>0x0)_0x447d18[_0x28c865(0x1e2)](_0x2d5986+_0x28c865(0x190));return _0x447d18['join'](',\x20');}async function hasUnsyncedLocalChanges(_0xf97c74,_0x16abe1,_0x2fa2b6){if(!await fileExists(_0xf97c74))return![];const _0x378c2f=await computeFileHash(_0xf97c74);if(!_0x16abe1)return _0x2fa2b6?_0x378c2f!==_0x2fa2b6:!![];return _0x378c2f!==_0x16abe1['hash'];}function createPullFileTransaction(){const _0x443751=new Map(),_0xdad84b=async(_0x4835cd,_0x409fd4)=>{const _0x4d814b=a43_0x1a84;try{if(_0x409fd4['existed'])await ensureParentDirectory(_0x4835cd),await writeFile(_0x4835cd,_0x409fd4[_0x4d814b(0x1c0)]);else try{await unlink(_0x4835cd);}catch(_0x35e471){if(_0x35e471['code']!=='ENOENT')throw _0x35e471;}return undefined;}catch(_0x45fa84){return _0x45fa84 instanceof Error?_0x45fa84:new Error(String(_0x45fa84));}};return{async 'write'(_0x5370dc,_0x16f9a0){const _0x34541f=a43_0x1a84;if(!_0x443751[_0x34541f(0x1cd)](_0x5370dc))try{_0x443751['set'](_0x5370dc,{'existed':!![],'content':await readFile(_0x5370dc)});}catch(_0x5db3e5){if(_0x5db3e5[_0x34541f(0x202)]!==_0x34541f(0x1aa))throw _0x5db3e5;_0x443751[_0x34541f(0x182)](_0x5370dc,{'existed':![]});}try{await ensureParentDirectory(_0x5370dc),await writeFile(_0x5370dc,_0x16f9a0,_0x34541f(0x1f5));}catch(_0x4ffea7){const _0x23ecce=await _0xdad84b(_0x5370dc,_0x443751[_0x34541f(0x1c3)](_0x5370dc));if(!_0x23ecce)_0x443751[_0x34541f(0x1bf)](_0x5370dc);throw withRollbackErrors(_0x4ffea7,_0x34541f(0x19d)+_0x5370dc+'\x22.',_0x23ecce?[_0x23ecce]:[]);}},async 'rollback'(){const _0x2b7d38=a43_0x1a84,_0x1b38d5=[];for(const [_0x3581fc,_0x3d3765]of[..._0x443751[_0x2b7d38(0x1a1)]()][_0x2b7d38(0x1b7)]()){const _0x11191b=await _0xdad84b(_0x3581fc,_0x3d3765);_0x11191b&&_0x1b38d5[_0x2b7d38(0x1e2)](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x3581fc+_0x2b7d38(0x1e5)+_0x11191b[_0x2b7d38(0x1b2)]));}return _0x1b38d5;}};}function withRollbackErrors(_0x31fa14,_0x13dac8,_0x3b6466){const _0x4fcf7f=a43_0x4d5031,_0x5b193b=_0x31fa14 instanceof Error?_0x31fa14:new Error(String(_0x31fa14));if(_0x3b6466[_0x4fcf7f(0x1bc)]===0x0)return _0x5b193b;return new AggregateError([_0x5b193b,..._0x3b6466],_0x13dac8+_0x4fcf7f(0x201)+_0x3b6466[_0x4fcf7f(0x1fb)](_0x394fe6=>_0x394fe6[_0x4fcf7f(0x1b2)])['join'](';\x20'));}function buildDatasetCodeToAliasMap(_0x321afd,_0x5912c0,_0x50ceaf){const _0x5d8f73=a43_0x4d5031,_0x6787d3=resolveApiModelSource(_0x321afd,_0x5912c0,_0x50ceaf),_0x3dc457=loadAliasMap(_0x321afd,undefined,_0x6787d3[_0x5d8f73(0x1db)],_0x6787d3[_0x5d8f73(0x189)]);return assertUnambiguousHookAliases(_0x3dc457),new Map(_0x3dc457[_0x5d8f73(0x1fb)](_0x4bce66=>[_0x4bce66['datasetCode'][_0x5d8f73(0x1b1)](),_0x4bce66[_0x5d8f73(0x1f6)]]));}async function planHookDirectoryMigration(_0x3cc375,_0x41c776,_0x25a712,_0x1f112f){const _0x407a04=a43_0x4d5031,_0x4153be=new Map();for(const [_0x2be8e7,_0x4af453]of Object[_0x407a04(0x1a1)](_0x41c776[_0x407a04(0x207)])){const [_0x4da008,_0x53ef7f,_0x295187,_0x346f99,_0x1ddd4b,..._0x349d69]=_0x2be8e7[_0x407a04(0x1ad)]('/');if(_0x4da008!==_0x407a04(0x1ff)||!_0x53ef7f||!_0x295187||!_0x346f99||!_0x1ddd4b||_0x349d69[_0x407a04(0x1bc)]>0x0||!_0x4af453[_0x407a04(0x1a5)])continue;const _0x4c7c1a=_0x25a712[_0x407a04(0x1c3)](_0x4af453[_0x407a04(0x1a5)][_0x407a04(0x1b1)]()),_0x321fb0=_0x4c7c1a??_0x4af453[_0x407a04(0x1a5)];if(!isSafeHookDirectorySegment(_0x53ef7f))throw CliErrors['validation'](_0x407a04(0x1d1)+_0x53ef7f+_0x407a04(0x1c2));if(!isSafeHookDirectorySegment(_0x321fb0))throw CliErrors['validation'](_0x407a04(0x1ab)+_0x53ef7f+_0x407a04(0x203));if(_0x53ef7f===_0x321fb0)continue;const _0x310728=_0x4153be[_0x407a04(0x1c3)](_0x53ef7f)??{'datasetCode':_0x4af453['datasetCode'],'alias':_0x4c7c1a,'keyChanges':[]};if(_0x310728[_0x407a04(0x1a5)]!==_0x4af453[_0x407a04(0x1a5)])throw CliErrors['validation'](_0x407a04(0x1ab)+_0x53ef7f+_0x407a04(0x1d8));const _0x2d7f1a='HOOK/'+_0x321fb0+'/'+_0x295187+'/'+_0x346f99+'/'+_0x1ddd4b;try{resolveLocalFilePathFromLockKey(_0x3cc375,_0x2be8e7),resolveLocalFilePathFromLockKey(_0x3cc375,_0x2d7f1a);}catch(_0x39128b){throw CliErrors[_0x407a04(0x1df)](_0x407a04(0x1d0)+_0x2be8e7+_0x407a04(0x1e5)+(_0x39128b instanceof Error?_0x39128b[_0x407a04(0x1b2)]:String(_0x39128b)));}_0x310728[_0x407a04(0x1dd)][_0x407a04(0x1e2)]({'oldLockKey':_0x2be8e7,'newLockKey':_0x2d7f1a,'entry':_0x4af453}),_0x4153be['set'](_0x53ef7f,_0x310728);}const _0x597fbc=new Set([..._0x4153be[_0x407a04(0x184)]()]['flatMap'](_0x2e64e8=>_0x2e64e8[_0x407a04(0x1dd)]['map'](_0x2b0a12=>_0x2b0a12[_0x407a04(0x1cc)]))),_0x32c5c6=new Map(),_0x281a50=new Map();for(const [_0xaf5444,_0x201413]of _0x4153be){const _0x77d14f=_0x201413[_0x407a04(0x1f6)]??_0x201413['datasetCode'],_0x4873c7=hookDirectoryIdentity(_0x77d14f),_0x24b928=_0x32c5c6[_0x407a04(0x1c3)](_0x4873c7);if(_0x24b928&&_0x24b928!==_0xaf5444)throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x24b928+_0x407a04(0x19c)+_0xaf5444+'\x22:\x20both\x20target\x20\x22'+_0x77d14f+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x32c5c6[_0x407a04(0x182)](_0x4873c7,_0xaf5444);for(const _0x11818f of _0x201413['keyChanges']){const _0x2dbce1=_0x281a50[_0x407a04(0x1c3)](_0x11818f['newLockKey']);if(_0x2dbce1&&_0x2dbce1!==_0x11818f['oldLockKey'])throw CliErrors[_0x407a04(0x1df)]('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x2dbce1+'\x22\x20and\x20\x22'+_0x11818f[_0x407a04(0x1cc)]+_0x407a04(0x1a8)+_0x11818f[_0x407a04(0x1a7)]+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x597fbc[_0x407a04(0x1cd)](_0x11818f[_0x407a04(0x1a7)]))throw CliErrors[_0x407a04(0x1df)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x11818f[_0x407a04(0x1cc)]+_0x407a04(0x19e)+_0x11818f[_0x407a04(0x1a7)]+_0x407a04(0x1ae));_0x281a50[_0x407a04(0x182)](_0x11818f[_0x407a04(0x1a7)],_0x11818f[_0x407a04(0x1cc)]);}}const _0x4e8389=new Map();for(const [_0x3feabf,_0x8f28b7]of _0x25a712){_0x4e8389[_0x407a04(0x182)](hookDirectoryIdentity(_0x8f28b7),_0x3feabf);}const _0x3e78f7=[];for(const [_0x44a22f,_0x43cf61]of _0x4153be){const _0x553956=_0x43cf61[_0x407a04(0x1f6)]??_0x43cf61['datasetCode'],_0x595fb6=join(_0x3cc375[_0x407a04(0x1a2)],'HOOK',_0x44a22f),_0x2ea5da=join(_0x3cc375[_0x407a04(0x1a2)],_0x407a04(0x1ff),_0x553956),_0xd5d1ca=await directoryExists(_0x595fb6),_0x222258=await directoryExists(_0x2ea5da),_0x5280e5=_0xd5d1ca?_0x222258?await sameDirectory(_0x595fb6,_0x2ea5da)?'case-rename':undefined:_0x407a04(0x1c9):'rekey';if(!_0x5280e5)throw CliErrors[_0x407a04(0x1df)](_0x407a04(0x1ab)+_0x44a22f+_0x407a04(0x1fa)+_0x553956+_0x407a04(0x1ed));const _0x1fa73f=_0x4e8389[_0x407a04(0x1c3)](hookDirectoryIdentity(_0x44a22f));if(_0x1fa73f&&_0x1fa73f!==_0x43cf61[_0x407a04(0x1a5)][_0x407a04(0x1b1)]()){const _0x144344=new Set(_0x43cf61[_0x407a04(0x1dd)][_0x407a04(0x1fb)](_0x454690=>_0x454690[_0x407a04(0x1cc)])),_0x184262=_0x1f112f['filter'](_0x428c17=>_0x428c17[_0x407a04(0x1ca)]===_0x407a04(0x1ff)&&_0x428c17['alias']!=null&&hookDirectoryIdentity(_0x428c17['alias'])===hookDirectoryIdentity(_0x44a22f)&&!_0x144344[_0x407a04(0x1cd)](_0x428c17[_0x407a04(0x19b)]));if(_0x184262['length']>0x0)throw CliErrors['validation'](_0x407a04(0x1ab)+_0x44a22f+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x51f3d1=_0x4e8389[_0x407a04(0x1c3)](hookDirectoryIdentity(_0x553956));if(_0x51f3d1&&_0x51f3d1!==_0x43cf61['datasetCode'][_0x407a04(0x1b1)]())throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x44a22f+'\x22\x20to\x20\x22'+_0x553956+'\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');for(const _0x354dd8 of _0x43cf61[_0x407a04(0x1dd)]){const _0x1d8572=_0x41c776[_0x407a04(0x207)][_0x354dd8['newLockKey']];if(_0x1d8572&&!_0x597fbc[_0x407a04(0x1cd)](_0x354dd8['newLockKey'])&&!sameHookIdentity(_0x354dd8[_0x407a04(0x179)],_0x1d8572))throw CliErrors['validation'](_0x407a04(0x1ab)+_0x44a22f+_0x407a04(0x1fa)+_0x553956+_0x407a04(0x17f));}_0x3e78f7[_0x407a04(0x1e2)]({'oldDirectory':_0x44a22f,'newDirectory':_0x553956,'oldDirectoryPath':_0x595fb6,'newDirectoryPath':_0x2ea5da,'mode':_0x5280e5,'alias':_0x43cf61[_0x407a04(0x1f6)],'keyChanges':_0x43cf61[_0x407a04(0x1dd)]});}const _0x76675d={..._0x41c776[_0x407a04(0x207)]},_0x5e3bea=new Map(),_0x1c3585=new Map();for(const _0x31b91e of _0x3e78f7){const _0x373d5a=_0x31b91e[_0x407a04(0x1da)]!==_0x407a04(0x1a4);_0x373d5a&&_0x1c3585[_0x407a04(0x182)](hookDirectoryIdentity(_0x31b91e[_0x407a04(0x180)]),_0x31b91e[_0x407a04(0x1b8)]);for(const _0x54a53d of _0x31b91e[_0x407a04(0x1dd)]){const _0x19ec6d=_0x76675d[_0x54a53d['newLockKey']],_0x56d8d0=_0x373d5a?_0x54a53d[_0x407a04(0x179)]:_0x19ec6d??_0x54a53d[_0x407a04(0x179)];_0x76675d[_0x54a53d[_0x407a04(0x1a7)]]=canonicalizeHookEntry(_0x56d8d0,_0x31b91e[_0x407a04(0x1f6)]),delete _0x76675d[_0x54a53d['oldLockKey']],_0x373d5a&&_0x5e3bea[_0x407a04(0x182)](_0x54a53d['newLockKey'],resolveLocalFilePathFromLockKey(_0x3cc375,_0x54a53d['oldLockKey']));}}return{'migrations':_0x3e78f7,'projectedFunctions':_0x76675d,'sourceFilePathByNewLockKey':_0x5e3bea,'sourceDirectoryPathByNewDirectory':_0x1c3585};}function resolveMigratedSourceFilePath(_0xa6c5e,_0x1273b7){const _0x8265bc=a43_0x4d5031;if(!_0xa6c5e||!_0x1273b7)return undefined;const _0x443980=_0xa6c5e['sourceFilePathByNewLockKey'][_0x8265bc(0x1c3)](_0x1273b7['lockKey']);if(_0x443980)return _0x443980;if(_0x1273b7[_0x8265bc(0x1ca)]!=='HOOK')return undefined;const [,_0xa6081f,..._0x24d465]=_0x1273b7[_0x8265bc(0x19b)][_0x8265bc(0x1ad)]('/');if(!_0xa6081f||_0x24d465[_0x8265bc(0x1bc)]===0x0)return undefined;const _0x48cf55=_0xa6c5e[_0x8265bc(0x19f)]['get'](hookDirectoryIdentity(_0xa6081f));return _0x48cf55?join(_0x48cf55,..._0x24d465)+_0x8265bc(0x1f8):undefined;}function sameHookIdentity(_0x27c371,_0x557a82){const _0x8fa0ca=a43_0x4d5031;return _0x27c371['remoteId']===_0x557a82['remoteId']&&_0x27c371[_0x8fa0ca(0x1a5)]===_0x557a82[_0x8fa0ca(0x1a5)]&&_0x27c371[_0x8fa0ca(0x1fd)]===_0x557a82[_0x8fa0ca(0x1fd)]&&_0x27c371['functionNode']===_0x557a82[_0x8fa0ca(0x1d7)];}function canonicalizeHookEntry(_0x32481d,_0x599812){const {alias:_0xea534,..._0x4cfb8b}=_0x32481d;return _0x599812?{..._0x4cfb8b,'alias':_0x599812}:_0x4cfb8b;}function hookDirectoryIdentity(_0xd8bd31){const _0x168221=a43_0x4d5031;return _0xd8bd31[_0x168221(0x1be)](_0x168221(0x1e0))[_0x168221(0x1b1)]();}function isSafeHookDirectorySegment(_0x2f68cc){return isSafeLockKeySegment(_0x2f68cc);}async function sameDirectory(_0x56dbed,_0x8eda8f){const _0x1a3f87=a43_0x4d5031,[_0x1d752a,_0x619a08]=await Promise[_0x1a3f87(0x1c5)]([stat(_0x56dbed),stat(_0x8eda8f)]);return _0x1d752a[_0x1a3f87(0x18e)]===_0x619a08['dev']&&_0x1d752a[_0x1a3f87(0x1ce)]===_0x619a08[_0x1a3f87(0x1ce)];}async function applyHookDirectoryMigration(_0x294a25,_0x4bb9df){const _0x130123=a43_0x4d5031,_0x1bcc7d=_0x4bb9df['functions'],_0x46c531=_0x4bb9df['lastSync'],_0x42acaa=[],_0x907faf=async()=>{const _0x62f458=a43_0x1a84,_0x55cc94=[];_0x4bb9df[_0x62f458(0x207)]=_0x1bcc7d,_0x4bb9df[_0x62f458(0x183)]=_0x46c531;for(const {migration:_0x4d3601,temporaryPath:_0x4cd6f7}of[..._0x42acaa]['reverse']()){try{_0x4cd6f7?(await rename(_0x4d3601['newDirectoryPath'],_0x4cd6f7),await rename(_0x4cd6f7,_0x4d3601[_0x62f458(0x1b8)])):await rename(_0x4d3601['newDirectoryPath'],_0x4d3601[_0x62f458(0x1b8)]);}catch(_0x14a739){_0x55cc94[_0x62f458(0x1e2)](new Error(_0x62f458(0x1c4)+_0x4d3601[_0x62f458(0x1b3)]+_0x62f458(0x1ac)+_0x4d3601['newDirectory']+_0x62f458(0x1e5)+(_0x14a739 instanceof Error?_0x14a739['message']:String(_0x14a739))));}}return _0x55cc94;};try{for(const _0x134e83 of _0x294a25[_0x130123(0x188)]){if(_0x134e83['mode']==='move')await ensureParentDirectory(_0x134e83[_0x130123(0x17e)]),await rename(_0x134e83[_0x130123(0x1b8)],_0x134e83[_0x130123(0x17e)]),_0x42acaa[_0x130123(0x1e2)]({'migration':_0x134e83});else{if(_0x134e83['mode']===_0x130123(0x1ef)){const _0x54c0cb=join(dirname(_0x134e83[_0x130123(0x1b8)]),_0x130123(0x199)+randomUUID());await rename(_0x134e83[_0x130123(0x1b8)],_0x54c0cb);try{await rename(_0x54c0cb,_0x134e83[_0x130123(0x17e)]);}catch(_0x4a4630){try{await rename(_0x54c0cb,_0x134e83[_0x130123(0x1b8)]);}catch(_0x5a0ec6){throw withRollbackErrors(_0x4a4630,_0x130123(0x195)+_0x134e83['oldDirectory']+_0x130123(0x1fa)+_0x134e83[_0x130123(0x180)]+_0x130123(0x1b5)+_0x54c0cb+_0x130123(0x198),[new Error(_0x130123(0x1c6)+_0x54c0cb+_0x130123(0x1fa)+_0x134e83['oldDirectory']+_0x130123(0x1e5)+(_0x5a0ec6 instanceof Error?_0x5a0ec6[_0x130123(0x1b2)]:String(_0x5a0ec6)))]);}throw _0x4a4630;}_0x42acaa['push']({'migration':_0x134e83,'temporaryPath':_0x54c0cb});}}}return _0x4bb9df[_0x130123(0x207)]=_0x294a25['projectedFunctions'],{'rollback':_0x907faf};}catch(_0x152841){const _0x5bff65=await _0x907faf();throw withRollbackErrors(_0x152841,_0x130123(0x1e6),_0x5bff65);}}async function confirmForce(){const _0x42054d=a43_0x4d5031,_0x117669=createInterface({'input':process['stdin'],'output':process[_0x42054d(0x1eb)]}),_0x5758f0=await new Promise(_0x424aa5=>{const _0x1d8e57=_0x42054d;_0x117669[_0x1d8e57(0x1b9)](_0x1d8e57(0x1f0),_0x424aa5);});return _0x117669['close'](),['y','yes'][_0x42054d(0x193)](_0x5758f0[_0x42054d(0x1dc)]()[_0x42054d(0x1b1)]());}