@lovrabet/rabetbase-cli 2.5.3-beta.1 → 2.5.3-beta.3

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 (419) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/api-group.d.ts +22 -0
  3. package/lib/api/api-group.js +1 -0
  4. package/lib/api/fetch-model-list.js +1 -1
  5. package/lib/api/generate-api-file.d.ts +18 -2
  6. package/lib/api/generate-api-file.js +1 -1
  7. package/lib/api/generate-sdk-config-file.js +1 -1
  8. package/lib/api/legacy-api-file.d.ts +11 -0
  9. package/lib/api/legacy-api-file.js +1 -0
  10. package/lib/api/model-registry-file.d.ts +36 -0
  11. package/lib/api/model-registry-file.js +1 -0
  12. package/lib/api/model-registry-scaffold.d.ts +7 -0
  13. package/lib/api/model-registry-scaffold.js +1 -0
  14. package/lib/api/model-source.d.ts +6 -0
  15. package/lib/api/model-source.js +1 -0
  16. package/lib/auth/auth-server-ui.js +1 -1
  17. package/lib/auth/auth-server.js +1 -1
  18. package/lib/auth/constant.js +1 -1
  19. package/lib/auth/get-cookie.js +1 -1
  20. package/lib/auth/get-session-user.js +1 -1
  21. package/lib/auth/is-session-valid.js +1 -1
  22. package/lib/auth/login-success-html.js +1 -1
  23. package/lib/auth/logout.js +1 -1
  24. package/lib/cli-flags.js +1 -1
  25. package/lib/cli.js +1 -1
  26. package/lib/commands/api/generate.js +1 -1
  27. package/lib/commands/api/index.js +1 -1
  28. package/lib/commands/api/list.js +1 -1
  29. package/lib/commands/api/pull.js +1 -1
  30. package/lib/commands/api/shared.js +1 -1
  31. package/lib/commands/app/index.js +1 -1
  32. package/lib/commands/app/list.js +1 -1
  33. package/lib/commands/app/members-list.js +1 -1
  34. package/lib/commands/app/remote-directory.js +1 -1
  35. package/lib/commands/app/shared.js +1 -1
  36. package/lib/commands/app-config/delete.js +1 -1
  37. package/lib/commands/app-config/get.js +1 -1
  38. package/lib/commands/app-config/index.js +1 -1
  39. package/lib/commands/app-config/list.js +1 -1
  40. package/lib/commands/app-config/set.js +1 -1
  41. package/lib/commands/app-config/shared.js +1 -1
  42. package/lib/commands/auth/index.js +1 -1
  43. package/lib/commands/bff/create.js +1 -1
  44. package/lib/commands/bff/delete.js +1 -1
  45. package/lib/commands/bff/detail.js +1 -1
  46. package/lib/commands/bff/index.js +1 -1
  47. package/lib/commands/bff/list.js +1 -1
  48. package/lib/commands/bff/logs.d.ts +7 -0
  49. package/lib/commands/bff/logs.js +1 -0
  50. package/lib/commands/bff/pull.js +1 -1
  51. package/lib/commands/bff/push.js +1 -1
  52. package/lib/commands/bff/status.js +1 -1
  53. package/lib/commands/cli-skill/index.js +1 -1
  54. package/lib/commands/cli-update.js +1 -1
  55. package/lib/commands/codegen/index.js +1 -1
  56. package/lib/commands/codegen/sdk.js +1 -1
  57. package/lib/commands/codegen/sql.js +1 -1
  58. package/lib/commands/common/app-registry.js +1 -1
  59. package/lib/commands/common/app-selector.js +1 -1
  60. package/lib/commands/common/async-task.js +1 -1
  61. package/lib/commands/common/dry-run.js +1 -1
  62. package/lib/commands/common/flags.d.ts +7 -0
  63. package/lib/commands/common/flags.js +1 -1
  64. package/lib/commands/common/local-file.js +1 -1
  65. package/lib/commands/common/validate.js +1 -1
  66. package/lib/commands/config/delete.js +1 -1
  67. package/lib/commands/config/get.js +1 -1
  68. package/lib/commands/config/index.js +1 -1
  69. package/lib/commands/config/init.js +1 -1
  70. package/lib/commands/config/list.js +1 -1
  71. package/lib/commands/config/set.js +1 -1
  72. package/lib/commands/config/shared.js +1 -1
  73. package/lib/commands/dataset/batch-design.d.ts +21 -0
  74. package/lib/commands/dataset/batch-design.js +1 -0
  75. package/lib/commands/dataset/business-group-update.js +1 -1
  76. package/lib/commands/dataset/business-groups.js +1 -1
  77. package/lib/commands/dataset/capability.js +1 -1
  78. package/lib/commands/dataset/cross-relation-create.d.ts +2 -0
  79. package/lib/commands/dataset/cross-relation-create.js +1 -0
  80. package/lib/commands/dataset/cross-relation-delete.d.ts +2 -0
  81. package/lib/commands/dataset/cross-relation-delete.js +1 -0
  82. package/lib/commands/dataset/cross-relation-list.d.ts +2 -0
  83. package/lib/commands/dataset/cross-relation-list.js +1 -0
  84. package/lib/commands/dataset/cross-relation-shared.d.ts +190 -0
  85. package/lib/commands/dataset/cross-relation-shared.js +1 -0
  86. package/lib/commands/dataset/cross-relation-update.d.ts +2 -0
  87. package/lib/commands/dataset/cross-relation-update.js +1 -0
  88. package/lib/commands/dataset/delete.js +1 -1
  89. package/lib/commands/dataset/detail.js +1 -1
  90. package/lib/commands/dataset/extend-update.js +1 -1
  91. package/lib/commands/dataset/field-restore.js +1 -1
  92. package/lib/commands/dataset/field-update.js +1 -1
  93. package/lib/commands/dataset/generate.js +1 -1
  94. package/lib/commands/dataset/index.js +1 -1
  95. package/lib/commands/dataset/list.js +1 -1
  96. package/lib/commands/dataset/operations.js +1 -1
  97. package/lib/commands/dataset/relation-audit.js +1 -1
  98. package/lib/commands/dataset/relation-create.js +1 -1
  99. package/lib/commands/dataset/relation-delete.js +1 -1
  100. package/lib/commands/dataset/relation-shared.js +1 -1
  101. package/lib/commands/dataset/relation-update.js +1 -1
  102. package/lib/commands/dataset/relations.js +1 -1
  103. package/lib/commands/dataset/rename.js +1 -1
  104. package/lib/commands/dataset/restore.js +1 -1
  105. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  106. package/lib/commands/db/analysis-batching.js +1 -1
  107. package/lib/commands/db/analyze-batch-plan.js +1 -1
  108. package/lib/commands/db/analyze-cancel.js +1 -1
  109. package/lib/commands/db/analyze-start.js +1 -1
  110. package/lib/commands/db/analyze-status.js +1 -1
  111. package/lib/commands/db/create.js +1 -1
  112. package/lib/commands/db/delete.js +1 -1
  113. package/lib/commands/db/detail.js +1 -1
  114. package/lib/commands/db/diff-refresh-start.js +1 -1
  115. package/lib/commands/db/diff-refresh-status.js +1 -1
  116. package/lib/commands/db/diff.js +1 -1
  117. package/lib/commands/db/index.js +1 -1
  118. package/lib/commands/db/list.js +1 -1
  119. package/lib/commands/db/shared.js +1 -1
  120. package/lib/commands/db/table-diff-shared.js +1 -1
  121. package/lib/commands/db/tables.js +1 -1
  122. package/lib/commands/db/test.js +1 -1
  123. package/lib/commands/db/update.js +1 -1
  124. package/lib/commands/deployment/index.js +1 -1
  125. package/lib/commands/deployment/sync-all.js +1 -1
  126. package/lib/commands/deployment/sync-jobs.js +1 -1
  127. package/lib/commands/deployment/sync-status.js +1 -1
  128. package/lib/commands/doctor.js +1 -1
  129. package/lib/commands/file/index.js +1 -1
  130. package/lib/commands/flow/create.d.ts +2 -0
  131. package/lib/commands/flow/create.js +1 -0
  132. package/lib/commands/flow/detail.d.ts +2 -0
  133. package/lib/commands/flow/detail.js +1 -0
  134. package/lib/commands/flow/index.d.ts +3 -0
  135. package/lib/commands/flow/index.js +1 -0
  136. package/lib/commands/flow/list.d.ts +2 -0
  137. package/lib/commands/flow/list.js +1 -0
  138. package/lib/commands/flow/publish.d.ts +2 -0
  139. package/lib/commands/flow/publish.js +1 -0
  140. package/lib/commands/flow/runtime-resources-shared.d.ts +40 -0
  141. package/lib/commands/flow/runtime-resources-shared.js +1 -0
  142. package/lib/commands/flow/runtime-role-list.d.ts +2 -0
  143. package/lib/commands/flow/runtime-role-list.js +1 -0
  144. package/lib/commands/flow/runtime-role-user-list.d.ts +2 -0
  145. package/lib/commands/flow/runtime-role-user-list.js +1 -0
  146. package/lib/commands/flow/runtime-user-search.d.ts +2 -0
  147. package/lib/commands/flow/runtime-user-search.js +1 -0
  148. package/lib/commands/flow/shared.d.ts +41 -0
  149. package/lib/commands/flow/shared.js +1 -0
  150. package/lib/commands/flow/update.d.ts +2 -0
  151. package/lib/commands/flow/update.js +1 -0
  152. package/lib/commands/flow/validate.d.ts +3 -0
  153. package/lib/commands/flow/validate.js +1 -0
  154. package/lib/commands/instant-api-policy/current.js +1 -1
  155. package/lib/commands/instant-api-policy/index.js +1 -1
  156. package/lib/commands/instant-api-policy/init.js +1 -1
  157. package/lib/commands/instant-api-policy/publish.js +1 -1
  158. package/lib/commands/instant-api-policy/pull.js +1 -1
  159. package/lib/commands/instant-api-policy/revision.js +1 -1
  160. package/lib/commands/instant-api-policy/revisions.js +1 -1
  161. package/lib/commands/instant-api-policy/rollback.js +1 -1
  162. package/lib/commands/instant-api-policy/shared.js +1 -1
  163. package/lib/commands/instant-api-policy/validate.js +1 -1
  164. package/lib/commands/issue/index.js +1 -1
  165. package/lib/commands/issue/nudge.js +1 -1
  166. package/lib/commands/issue/report.js +1 -1
  167. package/lib/commands/issue/shared.js +1 -1
  168. package/lib/commands/kb/create.js +1 -1
  169. package/lib/commands/kb/delete.js +1 -1
  170. package/lib/commands/kb/detail.js +1 -1
  171. package/lib/commands/kb/index.js +1 -1
  172. package/lib/commands/kb/list.js +1 -1
  173. package/lib/commands/kb/search.js +1 -1
  174. package/lib/commands/kb/shared.js +1 -1
  175. package/lib/commands/kb/update.js +1 -1
  176. package/lib/commands/logs/index.js +1 -1
  177. package/lib/commands/menu/asset-update.js +1 -1
  178. package/lib/commands/menu/delete.js +1 -1
  179. package/lib/commands/menu/external-link-create.js +1 -1
  180. package/lib/commands/menu/external-link-update.js +1 -1
  181. package/lib/commands/menu/group-create.js +1 -1
  182. package/lib/commands/menu/group-update.js +1 -1
  183. package/lib/commands/menu/index.js +1 -1
  184. package/lib/commands/menu/list.js +1 -1
  185. package/lib/commands/menu/move.js +1 -1
  186. package/lib/commands/menu/regroup-start.js +1 -1
  187. package/lib/commands/menu/rename.js +1 -1
  188. package/lib/commands/menu/shared/compare-table.js +1 -1
  189. package/lib/commands/menu/shared/delete-plan.js +1 -1
  190. package/lib/commands/menu/shared/facts.js +1 -1
  191. package/lib/commands/menu/shared/index.js +1 -1
  192. package/lib/commands/menu/shared/inquirer.js +1 -1
  193. package/lib/commands/menu/shared/local-pages.js +1 -1
  194. package/lib/commands/menu/shared/logic.js +1 -1
  195. package/lib/commands/menu/shared/mutations.js +1 -1
  196. package/lib/commands/menu/shared/service.js +1 -1
  197. package/lib/commands/menu/shared/sync-core.js +1 -1
  198. package/lib/commands/menu/shared/update-core.js +1 -1
  199. package/lib/commands/menu/shared/valid-url.js +1 -1
  200. package/lib/commands/menu/sync.js +1 -1
  201. package/lib/commands/menu/visibility-update.js +1 -1
  202. package/lib/commands/notification/config-create.js +1 -1
  203. package/lib/commands/notification/config-delete.js +1 -1
  204. package/lib/commands/notification/config-list.js +1 -1
  205. package/lib/commands/notification/config-update.js +1 -1
  206. package/lib/commands/notification/index.js +1 -1
  207. package/lib/commands/notification/shared.js +1 -1
  208. package/lib/commands/ocr/index.js +1 -1
  209. package/lib/commands/page/create.js +1 -1
  210. package/lib/commands/page/custom/detail.js +1 -1
  211. package/lib/commands/page/custom/list.js +1 -1
  212. package/lib/commands/page/custom/publish.js +1 -1
  213. package/lib/commands/page/custom/shared.js +1 -1
  214. package/lib/commands/page/custom/syntax.js +1 -1
  215. package/lib/commands/page/custom/update.js +1 -1
  216. package/lib/commands/page/data-list-status.js +1 -1
  217. package/lib/commands/page/generate-start.js +1 -1
  218. package/lib/commands/page/generate-status.js +1 -1
  219. package/lib/commands/page/index.js +1 -1
  220. package/lib/commands/page/pull.js +1 -1
  221. package/lib/commands/page/push.js +1 -1
  222. package/lib/commands/page/relation-audit.js +1 -1
  223. package/lib/commands/page/restore.js +1 -1
  224. package/lib/commands/page/shared.js +1 -1
  225. package/lib/commands/page/sync.js +1 -1
  226. package/lib/commands/project/api-architecture-upgrade.d.ts +28 -0
  227. package/lib/commands/project/api-architecture-upgrade.js +1 -0
  228. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  229. package/lib/commands/project/create/format-elapsed.js +1 -1
  230. package/lib/commands/project/create/main.js +1 -1
  231. package/lib/commands/project/create/materialize-project-template.js +1 -1
  232. package/lib/commands/project/create/project-name.js +1 -1
  233. package/lib/commands/project/create/project-template-archive.js +1 -1
  234. package/lib/commands/project/create/project-template-path.js +1 -1
  235. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  236. package/lib/commands/project/create/use-format-code.js +1 -1
  237. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  238. package/lib/commands/project/domain-routing-sync.js +1 -1
  239. package/lib/commands/project/index.js +1 -1
  240. package/lib/commands/project/upgrade.d.ts +30 -1
  241. package/lib/commands/project/upgrade.js +1 -1
  242. package/lib/commands/registry.js +1 -1
  243. package/lib/commands/role/delete.js +1 -1
  244. package/lib/commands/role/detail.js +1 -1
  245. package/lib/commands/role/index.js +1 -1
  246. package/lib/commands/role/list.js +1 -1
  247. package/lib/commands/role/shared.js +1 -1
  248. package/lib/commands/role/update.js +1 -1
  249. package/lib/commands/role/user-add.js +1 -1
  250. package/lib/commands/role/user-remove.js +1 -1
  251. package/lib/commands/role/user-resolve.js +1 -1
  252. package/lib/commands/rule/get.js +1 -1
  253. package/lib/commands/rule/index.js +1 -1
  254. package/lib/commands/rule/list.js +1 -1
  255. package/lib/commands/rule/set.js +1 -1
  256. package/lib/commands/rule/shared.js +1 -1
  257. package/lib/commands/run/index.js +1 -1
  258. package/lib/commands/schema.js +1 -1
  259. package/lib/commands/sql/create.js +1 -1
  260. package/lib/commands/sql/delete.js +1 -1
  261. package/lib/commands/sql/detail.js +1 -1
  262. package/lib/commands/sql/exec.js +1 -1
  263. package/lib/commands/sql/index.js +1 -1
  264. package/lib/commands/sql/list.js +1 -1
  265. package/lib/commands/sql/pull.js +1 -1
  266. package/lib/commands/sql/push.js +1 -1
  267. package/lib/commands/sql/shared.js +1 -1
  268. package/lib/commands/sql/status.js +1 -1
  269. package/lib/commands/sql/validate.js +1 -1
  270. package/lib/commands/task/index.js +1 -1
  271. package/lib/commands/task/status.js +1 -1
  272. package/lib/commands/tenant/index.js +1 -1
  273. package/lib/commands/tenant/members-list.js +1 -1
  274. package/lib/commands/tenant/shared.js +1 -1
  275. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  276. package/lib/commands/user-account/index.js +1 -1
  277. package/lib/commands/workspace/add.js +1 -1
  278. package/lib/commands/workspace/index.js +1 -1
  279. package/lib/commands/workspace/remove.js +1 -1
  280. package/lib/config/domain-config.js +1 -1
  281. package/lib/config/project-domain-routing.js +1 -1
  282. package/lib/config/region-config.js +1 -1
  283. package/lib/config/schema.js +1 -1
  284. package/lib/constant/cdn.js +1 -1
  285. package/lib/constant/cli.js +1 -1
  286. package/lib/constant/defaults.js +1 -1
  287. package/lib/constant/domain.js +1 -1
  288. package/lib/constant/env.js +1 -1
  289. package/lib/constant/output.js +1 -1
  290. package/lib/constant/paths.js +1 -1
  291. package/lib/constant/region.js +1 -1
  292. package/lib/constant/risk.js +1 -1
  293. package/lib/constant/routing-profile.js +1 -1
  294. package/lib/context/app-resolver.d.ts +2 -0
  295. package/lib/context/app-resolver.js +1 -1
  296. package/lib/context/auth-resolver.js +1 -1
  297. package/lib/context/config-loader.js +1 -1
  298. package/lib/context.d.ts +2 -1
  299. package/lib/context.js +1 -1
  300. package/lib/core/alias-resolver.d.ts +13 -17
  301. package/lib/core/alias-resolver.js +1 -1
  302. package/lib/core/api-client.d.ts +176 -1
  303. package/lib/core/api-client.js +1 -1
  304. package/lib/core/bff/config.js +1 -1
  305. package/lib/core/bff/file-system.js +1 -1
  306. package/lib/core/bff/hash.js +1 -1
  307. package/lib/core/bff/hook-directory.d.ts +55 -0
  308. package/lib/core/bff/hook-directory.js +1 -0
  309. package/lib/core/bff/lock.js +1 -1
  310. package/lib/core/bff/types.d.ts +15 -0
  311. package/lib/core/bff/utils.js +1 -1
  312. package/lib/core/cross-db-relation.d.ts +41 -0
  313. package/lib/core/cross-db-relation.js +1 -0
  314. package/lib/core/db-resolver.js +1 -1
  315. package/lib/core/flow-config.d.ts +628 -0
  316. package/lib/core/flow-config.js +1 -0
  317. package/lib/core/instant-api-policy/config.js +1 -1
  318. package/lib/core/kb-search-client.js +1 -1
  319. package/lib/core/page/file-system.js +1 -1
  320. package/lib/core/page/hash.js +1 -1
  321. package/lib/core/page/lock.js +1 -1
  322. package/lib/core/page/lr-smart-jsx.js +1 -1
  323. package/lib/core/sql-index-auditor.js +1 -1
  324. package/lib/core/sql-sync/config.js +1 -1
  325. package/lib/core/sql-sync/file-system.js +1 -1
  326. package/lib/core/sql-sync/hash.js +1 -1
  327. package/lib/core/sql-sync/lock.js +1 -1
  328. package/lib/core/sql-sync/utils.js +1 -1
  329. package/lib/core/sql-validator.js +1 -1
  330. package/lib/errors.js +1 -1
  331. package/lib/framework/build-all-flags.js +1 -1
  332. package/lib/framework/error-output.js +1 -1
  333. package/lib/framework/explicit-yes.js +1 -1
  334. package/lib/framework/flags.js +1 -1
  335. package/lib/framework/help.js +1 -1
  336. package/lib/framework/index.js +1 -1
  337. package/lib/framework/output.js +1 -1
  338. package/lib/framework/response.js +1 -1
  339. package/lib/framework/runner-alias.d.ts +1 -1
  340. package/lib/framework/runner-alias.js +1 -1
  341. package/lib/framework/runner.js +1 -1
  342. package/lib/framework/schema-export.js +1 -1
  343. package/lib/framework/supported-flags.js +1 -1
  344. package/lib/framework/types.js +1 -1
  345. package/lib/generated/build-info.d.ts +4 -4
  346. package/lib/generated/build-info.js +1 -1
  347. package/lib/generated/official-routing.js +1 -1
  348. package/lib/generated/routing-contract.js +1 -1
  349. package/lib/help.js +1 -1
  350. package/lib/postinstall.js +1 -1
  351. package/lib/runtime/confirmation.js +1 -1
  352. package/lib/runtime/event.js +1 -1
  353. package/lib/runtime/index.js +1 -1
  354. package/lib/runtime/queue.js +1 -1
  355. package/lib/runtime/resolve.js +1 -1
  356. package/lib/skills/builtin-skill.js +1 -1
  357. package/lib/skills/main.js +1 -1
  358. package/lib/skills/npx-skills-add.d.ts +0 -10
  359. package/lib/skills/npx-skills-add.js +1 -1
  360. package/lib/skills/skill-presence.js +1 -1
  361. package/lib/telemetry/cli-command-trace.js +1 -1
  362. package/lib/telemetry/cli-help-trace.js +1 -1
  363. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  364. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  365. package/lib/telemetry/send-cli-trace-log.js +1 -1
  366. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  367. package/lib/types/index.d.ts +11 -1
  368. package/lib/utils/ai_config.js +1 -1
  369. package/lib/utils/apply-jq-filter.js +1 -1
  370. package/lib/utils/cdn-config.js +1 -1
  371. package/lib/utils/check-sdk-version.js +1 -1
  372. package/lib/utils/cli-version-check.js +1 -1
  373. package/lib/utils/cli-version-policy.d.ts +12 -0
  374. package/lib/utils/cli-version-policy.js +1 -1
  375. package/lib/utils/config.js +1 -1
  376. package/lib/utils/entity-with-id.js +1 -1
  377. package/lib/utils/file-utils.js +1 -1
  378. package/lib/utils/guides-cdn.js +1 -1
  379. package/lib/utils/http-client.js +1 -1
  380. package/lib/utils/is-non-interactive.js +1 -1
  381. package/lib/utils/logger.js +1 -1
  382. package/lib/utils/params.js +1 -1
  383. package/lib/utils/platform.js +1 -1
  384. package/lib/utils/sleep.js +1 -1
  385. package/lib/utils/template-replacer.js +1 -1
  386. package/lib/utils/update-notice.js +1 -1
  387. package/lib/utils/version.js +1 -1
  388. package/lib/utils/with-active-cookie.js +1 -1
  389. package/lib/utils/write-cli-side-channel.js +1 -1
  390. package/package.json +4 -1
  391. package/skills/rabetbase/SKILL.md +31 -9
  392. package/skills/rabetbase/guides/approval-flow-development-workflow.md +137 -0
  393. package/skills/rabetbase/guides/backend-function.md +19 -9
  394. package/skills/rabetbase/guides/bff-creation-workflow.md +10 -1
  395. package/skills/rabetbase/guides/conflict-detection.md +2 -0
  396. package/skills/rabetbase/guides/sdk-client-generation.md +112 -60
  397. package/skills/rabetbase/guides/typescript-sdk.md +9 -0
  398. package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +290 -0
  399. package/skills/rabetbase/references/rabetbase-api-pull.md +30 -19
  400. package/skills/rabetbase/references/rabetbase-app-list.md +1 -1
  401. package/skills/rabetbase/references/rabetbase-bff-create.md +1 -1
  402. package/skills/rabetbase/references/rabetbase-bff-logs.md +47 -0
  403. package/skills/rabetbase/references/rabetbase-bff-pull.md +7 -3
  404. package/skills/rabetbase/references/rabetbase-bff-push.md +10 -2
  405. package/skills/rabetbase/references/rabetbase-config.md +2 -1
  406. package/skills/rabetbase/references/rabetbase-dataset-cross-relations.md +60 -0
  407. package/skills/rabetbase/references/rabetbase-dataset-generate.md +52 -2
  408. package/skills/rabetbase/references/rabetbase-flow-commands.md +86 -0
  409. package/skills/rabetbase/references/rabetbase-flow-resources.md +83 -0
  410. package/skills/rabetbase/references/rabetbase-flow-runtime-boundary.md +25 -0
  411. package/skills/rabetbase/references/rabetbase-instant-api-policy.md +103 -11
  412. package/skills/rabetbase/references/rabetbase-notification-config-list.md +17 -0
  413. package/skills/rabetbase/references/rabetbase-project-create.md +3 -3
  414. package/skills/rabetbase/references/rabetbase-project-upgrade.md +24 -13
  415. package/skills/rabetbase.manifest.json +10 -3
  416. package/templates/README.md +16 -4
  417. package/templates/generate-api/model-runtime.ts.tpl +101 -0
  418. package/templates/generate-api/profile-api.ts.tpl +21 -0
  419. package/templates/generate-api/profile-client.ts.tpl +14 -0
@@ -1 +1 @@
1
- const a29_0x335365=a29_0x582f;(function(_0x4ede35,_0x115ef3){const _0x24ad61=a29_0x582f,_0x22b0ba=_0x4ede35();while(!![]){try{const _0x3bcd79=-parseInt(_0x24ad61(0x1f6))/0x1+-parseInt(_0x24ad61(0x1d2))/0x2*(-parseInt(_0x24ad61(0x1f9))/0x3)+-parseInt(_0x24ad61(0x1f7))/0x4*(-parseInt(_0x24ad61(0x1e0))/0x5)+-parseInt(_0x24ad61(0x1de))/0x6*(-parseInt(_0x24ad61(0x201))/0x7)+parseInt(_0x24ad61(0x1c5))/0x8+-parseInt(_0x24ad61(0x1cd))/0x9*(parseInt(_0x24ad61(0x1c1))/0xa)+parseInt(_0x24ad61(0x1cb))/0xb*(-parseInt(_0x24ad61(0x1c9))/0xc);if(_0x3bcd79===_0x115ef3)break;else _0x22b0ba['push'](_0x22b0ba['shift']());}catch(_0x42874c){_0x22b0ba['push'](_0x22b0ba['shift']());}}}(a29_0x5d39,0x80866));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a29_0x335365(0x200),'description':a29_0x335365(0x1fc),'required':!![]};export const VALUE_ARG={'name':'value','description':a29_0x335365(0x1d4),'required':![]};export const TAGS_FLAG={'name':'tags','type':a29_0x335365(0x1cc),'description':a29_0x335365(0x1ef)};export const STDIN_FLAG={'name':a29_0x335365(0x1d6),'type':a29_0x335365(0x1e7),'description':'Read\x20config\x20value\x20from\x20stdin','default':![]};export const FROM_ENV_FLAG={'name':'from-env','type':'string','description':a29_0x335365(0x1c2)};export const REVEAL_FLAG={'name':a29_0x335365(0x1bf),'type':'boolean','description':a29_0x335365(0x1f4),'default':![]};export function readKeyArg(_0x2f4d76){const _0xcd19ce=a29_0x335365,_0x58689e=_0x2f4d76[_0xcd19ce(0x1f2)][0x0]?.[_0xcd19ce(0x1e1)]()??'';return validateKey(_0x58689e),_0x58689e;}export function readOptionalTags(_0xed8530){const _0xf1af25=a29_0x335365,_0x3e444c=_0xed8530[_0xf1af25(0x1f5)](_0xf1af25(0x1c3))[_0xf1af25(0x1e1)]();if(!_0x3e444c)return undefined;if(_0x3e444c[_0xf1af25(0x1fe)]>0x20)throw CliErrors[_0xf1af25(0x1e8)](_0xf1af25(0x1e9));return _0x3e444c;}export function validateKey(_0xf3880c){const _0x34127e=a29_0x335365;if(!_0xf3880c)throw CliErrors['validation'](_0x34127e(0x1d0));if(_0xf3880c[_0x34127e(0x1fe)]>0x100)throw CliErrors[_0x34127e(0x1e8)](_0x34127e(0x1c7));}export function projectAppConfig(_0x476bb6,_0x28ba97){const _0x240221=a29_0x335365,_0x1eaf0e=_0x476bb6[_0x240221(0x1df)]!==undefined&&_0x476bb6[_0x240221(0x1df)]!==null&&_0x476bb6[_0x240221(0x1df)]!=='',_0x23cf77={'appCode':_0x476bb6['appCode'],'key':_0x476bb6['key'],'tags':_0x476bb6[_0x240221(0x1c3)]??undefined,'hasValue':_0x1eaf0e,'valueRedacted':_0x1eaf0e&&!_0x28ba97?.['reveal'],'gmtCreate':_0x476bb6[_0x240221(0x1e6)],'gmtModified':_0x476bb6[_0x240221(0x1f8)]};return _0x28ba97?.[_0x240221(0x1bf)]&&(_0x23cf77[_0x240221(0x1df)]=_0x476bb6[_0x240221(0x1df)]??'',_0x23cf77[_0x240221(0x1cf)]=![]),_0x23cf77;}export function plannedAppConfig(_0x3241be){const _0x51e9ce=a29_0x335365,_0x135503=_0x3241be[_0x51e9ce(0x1d5)]??!![];return{'appCode':_0x3241be[_0x51e9ce(0x1f3)],'key':_0x3241be['key'],'tags':_0x3241be[_0x51e9ce(0x1c3)]??undefined,'hasValue':_0x135503,'valueRedacted':_0x135503};}export function buildMutationData(_0x11641a){const _0x5c6a58=a29_0x335365;return{'operation':_0x11641a['operation'],'selector':{'appCode':_0x11641a[_0x5c6a58(0x1f3)],'key':_0x11641a[_0x5c6a58(0x200)]},'before':_0x11641a[_0x5c6a58(0x1ec)],'after':_0x11641a[_0x5c6a58(0x1c6)],'dryRun':_0x11641a['dryRun'],'warnings':_0x11641a[_0x5c6a58(0x1e3)]??[]};}export async function withAppConfigApiBoundary(_0x4475f8,_0x2688c8,_0x4d8eb0){const _0x2b45da=a29_0x335365;try{return await _0x4d8eb0();}catch{const _0x17c9a2=[_0x2b45da(0x202)+_0x2688c8[_0x2b45da(0x1f3)]];if(_0x2688c8[_0x2b45da(0x200)])_0x17c9a2['push'](_0x2b45da(0x1fb)+_0x2688c8[_0x2b45da(0x200)]);_0x17c9a2[_0x2b45da(0x1f1)](_0x2b45da(0x1ed));throw CliErrors[_0x2b45da(0x1d9)]('Failed\x20to\x20'+_0x4475f8+'\x20app\x20config.',_0x17c9a2[_0x2b45da(0x1ca)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x2282e5,_0x3f6d8d){const _0x3ad301=a29_0x335365;return Object['defineProperties'](_0x2282e5,{'method':{'value':_0x3f6d8d[_0x3ad301(0x1f0)],'enumerable':![]},'url':{'value':_0x3f6d8d[_0x3ad301(0x1eb)],'enumerable':![]}});}function a29_0x5d39(){const _0x458fdc=['value','145jjgBjt','trim','file','warnings','path','name','gmtCreate','boolean','validation','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','env','url','before','value\x20is\x20redacted','flag','Config\x20tags\x20for\x20filtering/display\x20metadata','method','push','args','appCode','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','str','53366KBdhjK','143236rbmXiy','gmtModified','3ieyvVe','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','key:\x20','Runtime\x20app-config\x20key','utf8','length','argument','key','791ixRUPo','appCode:\x20','reveal','slice','10FOZqUr','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','tags','setEncoding','7860856xQdzcv','after','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','end','26661108OslNPV','join','11NuABJJ','string','4022577vYwaag','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','valueRedacted','Missing\x20app-config\x20key.','Environment\x20variable\x20is\x20not\x20set:\x20','2041090XWLslq','error','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','hasValue','stdin','data','bool','apiError','kind','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','from-env','Missing\x20app-config\x20value\x20source.','10986MnEboO'];a29_0x5d39=function(){return _0x458fdc;};return a29_0x5d39();}export function assertSingleValueSource(_0x3bef75){const _0x3fc21b=a29_0x335365,_0x5b1ce2=[];_0x3bef75[_0x3fc21b(0x1f2)][_0x3fc21b(0x1fe)]>0x1&&_0x5b1ce2['push']({'kind':_0x3fc21b(0x1ff),'value':_0x3bef75[_0x3fc21b(0x1f2)][_0x3fc21b(0x1c0)](0x1)['join']('\x20')});const _0x22cd0b=_0x3bef75[_0x3fc21b(0x1ee)](_0x3fc21b(0x1df));_0x22cd0b!==undefined&&_0x22cd0b!==null&&_0x5b1ce2[_0x3fc21b(0x1f1)]({'kind':'argument','value':String(_0x22cd0b)});_0x3bef75[_0x3fc21b(0x1d8)](_0x3fc21b(0x1d6))&&_0x5b1ce2[_0x3fc21b(0x1f1)]({'kind':'stdin'});const _0x10878d=_0x3bef75[_0x3fc21b(0x1f5)](_0x3fc21b(0x1dc))['trim']();_0x10878d&&_0x5b1ce2['push']({'kind':'env','name':_0x10878d});const _0x12d8e0=_0x3bef75[_0x3fc21b(0x1f5)](_0x3fc21b(0x1e2))[_0x3fc21b(0x1e1)]();_0x12d8e0&&_0x5b1ce2[_0x3fc21b(0x1f1)]({'kind':_0x3fc21b(0x1e2),'path':_0x12d8e0});if(_0x5b1ce2['length']===0x0)throw CliErrors[_0x3fc21b(0x1e8)](_0x3fc21b(0x1dd),_0x3fc21b(0x1ce));if(_0x5b1ce2['length']>0x1)throw CliErrors[_0x3fc21b(0x1e8)]('App\x20config\x20value\x20source\x20is\x20ambiguous.',_0x3fc21b(0x1db));return _0x5b1ce2[0x0];}function a29_0x582f(_0x5365a4,_0x2d0373){_0x5365a4=_0x5365a4-0x1bf;const _0x5d393a=a29_0x5d39();let _0x582fb8=_0x5d393a[_0x5365a4];return _0x582fb8;}export async function assertValueSourceReadable(_0x121593){const _0x4b5e26=a29_0x335365;if(_0x121593['kind']===_0x4b5e26(0x1ea)&&!(_0x121593['name']in process.env))throw CliErrors[_0x4b5e26(0x1e8)](_0x4b5e26(0x1d1)+_0x121593[_0x4b5e26(0x1e5)]);if(_0x121593['kind']===_0x4b5e26(0x1e2))try{await access(_0x121593[_0x4b5e26(0x1e4)]);}catch{throw CliErrors[_0x4b5e26(0x1e8)]('Value\x20file\x20is\x20not\x20readable:\x20'+_0x121593[_0x4b5e26(0x1e4)]);}}export async function readAppConfigValue(_0x1e8c8e){const _0x2a922f=a29_0x335365,_0x29d78b=assertSingleValueSource(_0x1e8c8e),_0x260cf4=[];if(_0x29d78b[_0x2a922f(0x1da)]===_0x2a922f(0x1ff))return _0x260cf4[_0x2a922f(0x1f1)](_0x2a922f(0x1fa)),{'value':_0x29d78b[_0x2a922f(0x1df)]??'','source':_0x29d78b['kind'],'warnings':_0x260cf4};if(_0x29d78b[_0x2a922f(0x1da)]==='stdin')return{'value':await readStdin(),'source':_0x29d78b[_0x2a922f(0x1da)],'warnings':_0x260cf4};if(_0x29d78b[_0x2a922f(0x1da)]===_0x2a922f(0x1ea)){if(!(_0x29d78b[_0x2a922f(0x1e5)]in process.env))throw CliErrors[_0x2a922f(0x1e8)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x29d78b['name']);return{'value':process.env[_0x29d78b.name]??'','source':_0x29d78b['kind'],'warnings':_0x260cf4};}return{'value':await readFile(_0x29d78b[_0x2a922f(0x1e4)],_0x2a922f(0x1fd)),'source':_0x29d78b[_0x2a922f(0x1da)],'warnings':_0x260cf4};}function readStdin(){return new Promise((_0x578eab,_0x4282c5)=>{const _0x2f1ea8=a29_0x582f;let _0x4bbe2c='';process['stdin'][_0x2f1ea8(0x1c4)](_0x2f1ea8(0x1fd)),process[_0x2f1ea8(0x1d6)]['on'](_0x2f1ea8(0x1d7),_0x1b750b=>{_0x4bbe2c+=_0x1b750b;}),process['stdin']['once'](_0x2f1ea8(0x1c8),()=>_0x578eab(_0x4bbe2c)),process[_0x2f1ea8(0x1d6)]['once'](_0x2f1ea8(0x1d3),_0x4282c5);});}
1
+ const a34_0x198d66=a34_0xa516;(function(_0x1438b9,_0x5bd0b9){const _0x4d0840=a34_0xa516,_0x232e53=_0x1438b9();while(!![]){try{const _0xd4a480=-parseInt(_0x4d0840(0x120))/0x1+-parseInt(_0x4d0840(0xf3))/0x2*(-parseInt(_0x4d0840(0x108))/0x3)+-parseInt(_0x4d0840(0x109))/0x4*(parseInt(_0x4d0840(0x106))/0x5)+-parseInt(_0x4d0840(0x11b))/0x6+-parseInt(_0x4d0840(0x124))/0x7+parseInt(_0x4d0840(0xfe))/0x8*(parseInt(_0x4d0840(0xf8))/0x9)+parseInt(_0x4d0840(0x10a))/0xa;if(_0xd4a480===_0x5bd0b9)break;else _0x232e53['push'](_0x232e53['shift']());}catch(_0x4058f4){_0x232e53['push'](_0x232e53['shift']());}}}(a34_0x169c,0xd402a));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':'key','description':a34_0x198d66(0x11f),'required':!![]};export const VALUE_ARG={'name':a34_0x198d66(0xf6),'description':a34_0x198d66(0x12c),'required':![]};export const TAGS_FLAG={'name':a34_0x198d66(0x118),'type':'string','description':'Config\x20tags\x20for\x20filtering/display\x20metadata'};export const STDIN_FLAG={'name':'stdin','type':'boolean','description':a34_0x198d66(0x12a),'default':![]};export const FROM_ENV_FLAG={'name':a34_0x198d66(0x100),'type':'string','description':a34_0x198d66(0x113)};export const REVEAL_FLAG={'name':a34_0x198d66(0x102),'type':a34_0x198d66(0x105),'description':a34_0x198d66(0x12f),'default':![]};export function readKeyArg(_0x4e422b){const _0x9a98fd=a34_0x198d66,_0x3a9bf7=_0x4e422b[_0x9a98fd(0xfb)][0x0]?.['trim']()??'';return validateKey(_0x3a9bf7),_0x3a9bf7;}export function readOptionalTags(_0x2d147d){const _0x1ac370=a34_0x198d66,_0x404b30=_0x2d147d['str'](_0x1ac370(0x118))['trim']();if(!_0x404b30)return undefined;if(_0x404b30[_0x1ac370(0x10e)]>0x20)throw CliErrors[_0x1ac370(0x11e)](_0x1ac370(0x126));return _0x404b30;}export function validateKey(_0x495cb3){const _0x381dda=a34_0x198d66;if(!_0x495cb3)throw CliErrors[_0x381dda(0x11e)]('Missing\x20app-config\x20key.');if(_0x495cb3[_0x381dda(0x10e)]>0x100)throw CliErrors['validation'](_0x381dda(0xfa));}function a34_0xa516(_0x4cad98,_0x3bdd0f){_0x4cad98=_0x4cad98-0xf1;const _0x169ce9=a34_0x169c();let _0xa516d8=_0x169ce9[_0x4cad98];return _0xa516d8;}export function projectAppConfig(_0xcbb3de,_0xb3425c){const _0x4cb01d=a34_0x198d66,_0x26e407=_0xcbb3de[_0x4cb01d(0xf6)]!==undefined&&_0xcbb3de['value']!==null&&_0xcbb3de['value']!=='',_0x5e204c={'appCode':_0xcbb3de[_0x4cb01d(0x114)],'key':_0xcbb3de[_0x4cb01d(0x12b)],'tags':_0xcbb3de[_0x4cb01d(0x118)]??undefined,'hasValue':_0x26e407,'valueRedacted':_0x26e407&&!_0xb3425c?.['reveal'],'gmtCreate':_0xcbb3de[_0x4cb01d(0x121)],'gmtModified':_0xcbb3de[_0x4cb01d(0x11a)]};return _0xb3425c?.[_0x4cb01d(0x102)]&&(_0x5e204c[_0x4cb01d(0xf6)]=_0xcbb3de['value']??'',_0x5e204c[_0x4cb01d(0x123)]=![]),_0x5e204c;}export function plannedAppConfig(_0xb6f99e){const _0x4f2fb8=a34_0x198d66,_0xd771ab=_0xb6f99e['hasValue']??!![];return{'appCode':_0xb6f99e['appCode'],'key':_0xb6f99e['key'],'tags':_0xb6f99e[_0x4f2fb8(0x118)]??undefined,'hasValue':_0xd771ab,'valueRedacted':_0xd771ab};}function a34_0x169c(){const _0x5d41d5=['18NryfqF','value\x20is\x20redacted','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','args','file','error','4328320jtUkzL','apiError','from-env','App\x20config\x20value\x20source\x20is\x20ambiguous.','reveal','after','slice','boolean','34795AlHhTa','env','3zYFLIF','332OIEMYZ','21207380HSFJar','utf8','defineProperties','method','length','warnings','Value\x20file\x20is\x20not\x20readable:\x20','key:\x20','Environment\x20variable\x20is\x20not\x20set:\x20','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','appCode','end','stdin','name','tags','url','gmtModified','7766214bflrkc','kind','push','validation','Runtime\x20app-config\x20key','922225ABpOhF','gmtCreate','path','valueRedacted','8355158XCudCO','dryRun','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','once','appCode:\x20','Read\x20config\x20value\x20from\x20stdin','key','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','\x20app\x20config.','argument','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','trim','str','3306722PQkPBl','bool','join','value','before'];a34_0x169c=function(){return _0x5d41d5;};return a34_0x169c();}export function buildMutationData(_0x23a2c4){const _0x187c45=a34_0x198d66;return{'operation':_0x23a2c4['operation'],'selector':{'appCode':_0x23a2c4[_0x187c45(0x114)],'key':_0x23a2c4[_0x187c45(0x12b)]},'before':_0x23a2c4[_0x187c45(0xf7)],'after':_0x23a2c4[_0x187c45(0x103)],'dryRun':_0x23a2c4[_0x187c45(0x125)],'warnings':_0x23a2c4[_0x187c45(0x10f)]??[]};}export async function withAppConfigApiBoundary(_0x13fc24,_0x39e8d5,_0x36b4be){const _0x2d0d1d=a34_0x198d66;try{return await _0x36b4be();}catch{const _0xd8ab75=[_0x2d0d1d(0x129)+_0x39e8d5[_0x2d0d1d(0x114)]];if(_0x39e8d5['key'])_0xd8ab75[_0x2d0d1d(0x11d)](_0x2d0d1d(0x111)+_0x39e8d5['key']);_0xd8ab75[_0x2d0d1d(0x11d)](_0x2d0d1d(0xf9));throw CliErrors[_0x2d0d1d(0xff)]('Failed\x20to\x20'+_0x13fc24+_0x2d0d1d(0x12d),_0xd8ab75[_0x2d0d1d(0xf5)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x22d16c,_0x58059f){const _0x4cc802=a34_0x198d66;return Object[_0x4cc802(0x10c)](_0x22d16c,{'method':{'value':_0x58059f[_0x4cc802(0x10d)],'enumerable':![]},'url':{'value':_0x58059f[_0x4cc802(0x119)],'enumerable':![]}});}export function assertSingleValueSource(_0x9762d3){const _0x3eac99=a34_0x198d66,_0x2356aa=[];_0x9762d3['args'][_0x3eac99(0x10e)]>0x1&&_0x2356aa[_0x3eac99(0x11d)]({'kind':'argument','value':_0x9762d3['args'][_0x3eac99(0x104)](0x1)['join']('\x20')});const _0x3e1454=_0x9762d3['flag'](_0x3eac99(0xf6));_0x3e1454!==undefined&&_0x3e1454!==null&&_0x2356aa[_0x3eac99(0x11d)]({'kind':'argument','value':String(_0x3e1454)});_0x9762d3[_0x3eac99(0xf4)](_0x3eac99(0x116))&&_0x2356aa[_0x3eac99(0x11d)]({'kind':_0x3eac99(0x116)});const _0x26e183=_0x9762d3[_0x3eac99(0xf2)](_0x3eac99(0x100))['trim']();_0x26e183&&_0x2356aa['push']({'kind':_0x3eac99(0x107),'name':_0x26e183});const _0x17e764=_0x9762d3[_0x3eac99(0xf2)](_0x3eac99(0xfc))[_0x3eac99(0xf1)]();_0x17e764&&_0x2356aa[_0x3eac99(0x11d)]({'kind':'file','path':_0x17e764});if(_0x2356aa[_0x3eac99(0x10e)]===0x0)throw CliErrors['validation']('Missing\x20app-config\x20value\x20source.',_0x3eac99(0x127));if(_0x2356aa[_0x3eac99(0x10e)]>0x1)throw CliErrors[_0x3eac99(0x11e)](_0x3eac99(0x101),'Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');return _0x2356aa[0x0];}export async function assertValueSourceReadable(_0x1e456c){const _0x18e183=a34_0x198d66;if(_0x1e456c[_0x18e183(0x11c)]===_0x18e183(0x107)&&!(_0x1e456c[_0x18e183(0x117)]in process.env))throw CliErrors[_0x18e183(0x11e)](_0x18e183(0x112)+_0x1e456c[_0x18e183(0x117)]);if(_0x1e456c['kind']===_0x18e183(0xfc))try{await access(_0x1e456c[_0x18e183(0x122)]);}catch{throw CliErrors[_0x18e183(0x11e)](_0x18e183(0x110)+_0x1e456c[_0x18e183(0x122)]);}}export async function readAppConfigValue(_0x39c14d){const _0x20e17d=a34_0x198d66,_0x262165=assertSingleValueSource(_0x39c14d),_0x1e4a33=[];if(_0x262165[_0x20e17d(0x11c)]===_0x20e17d(0x12e))return _0x1e4a33[_0x20e17d(0x11d)]('Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.'),{'value':_0x262165['value']??'','source':_0x262165[_0x20e17d(0x11c)],'warnings':_0x1e4a33};if(_0x262165[_0x20e17d(0x11c)]==='stdin')return{'value':await readStdin(),'source':_0x262165[_0x20e17d(0x11c)],'warnings':_0x1e4a33};if(_0x262165[_0x20e17d(0x11c)]==='env'){if(!(_0x262165[_0x20e17d(0x117)]in process.env))throw CliErrors['validation'](_0x20e17d(0x112)+_0x262165[_0x20e17d(0x117)]);return{'value':process.env[_0x262165.name]??'','source':_0x262165[_0x20e17d(0x11c)],'warnings':_0x1e4a33};}return{'value':await readFile(_0x262165['path'],'utf8'),'source':_0x262165[_0x20e17d(0x11c)],'warnings':_0x1e4a33};}function readStdin(){return new Promise((_0x117e0b,_0x3078a6)=>{const _0x543dc2=a34_0xa516;let _0x59ec2f='';process[_0x543dc2(0x116)]['setEncoding'](_0x543dc2(0x10b)),process['stdin']['on']('data',_0x1a9c8e=>{_0x59ec2f+=_0x1a9c8e;}),process['stdin'][_0x543dc2(0x128)](_0x543dc2(0x115),()=>_0x117e0b(_0x59ec2f)),process['stdin'][_0x543dc2(0x128)](_0x543dc2(0xfd),_0x3078a6);});}
@@ -1 +1 @@
1
- const a30_0x281baa=a30_0x238b;(function(_0x427bc0,_0xa5d5f6){const _0x243cd8=a30_0x238b,_0x473f9c=_0x427bc0();while(!![]){try{const _0x49cba1=parseInt(_0x243cd8(0x164))/0x1*(-parseInt(_0x243cd8(0x15b))/0x2)+parseInt(_0x243cd8(0x15c))/0x3+-parseInt(_0x243cd8(0x16e))/0x4*(parseInt(_0x243cd8(0x15a))/0x5)+-parseInt(_0x243cd8(0x15f))/0x6*(-parseInt(_0x243cd8(0x159))/0x7)+parseInt(_0x243cd8(0x170))/0x8*(parseInt(_0x243cd8(0x162))/0x9)+-parseInt(_0x243cd8(0x163))/0xa+-parseInt(_0x243cd8(0x161))/0xb*(-parseInt(_0x243cd8(0x166))/0xc);if(_0x49cba1===_0xa5d5f6)break;else _0x473f9c['push'](_0x473f9c['shift']());}catch(_0x523119){_0x473f9c['push'](_0x473f9c['shift']());}}}(a30_0x59a2,0x1bb6e));import{unlinkSync,existsSync}from'node:fs';function a30_0x59a2(){const _0x54eb8b=['156316VWOgSb','225582xOgikV','bool','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','260448djHOYi','log','1133vAdodF','36mJBKUU','560150sHlbRm','1gWjOtF','nonInteractive','3516QKbDcV','✓\x20Logged\x20out','!\x20Not\x20logged\x20in','Login\x20via\x20browser','yes','Clear\x20login\x20session','boolean','login','4dGuoYo','../../auth/auth-server-ui.js','156888fIkCWH','logout','write','auth','35HIxaRb','765830MGskLS'];a30_0x59a2=function(){return _0x54eb8b;};return a30_0x59a2();}function a30_0x238b(_0x2f3dfc,_0x41c69e){_0x2f3dfc=_0x2f3dfc-0x158;const _0x59a2bd=a30_0x59a2();let _0x238b83=_0x59a2bd[_0x2f3dfc];return _0x238b83;}import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':a30_0x281baa(0x158),'command':a30_0x281baa(0x16d),'description':a30_0x281baa(0x169),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a30_0x281baa(0x16a),'type':a30_0x281baa(0x16c),'description':a30_0x281baa(0x15e),'default':![]}],async 'execute'(_0x1fc4a4){const _0x4313f6=a30_0x281baa,{runAuthServer:_0x233c4b}=await import(_0x4313f6(0x16f));return await _0x233c4b({'autoYes':_0x1fc4a4[_0x4313f6(0x15d)](_0x4313f6(0x16a)),'nonInteractive':_0x1fc4a4[_0x4313f6(0x165)]}),{'ok':!![]};}},{'service':a30_0x281baa(0x158),'command':a30_0x281baa(0x171),'description':a30_0x281baa(0x16b),'risk':a30_0x281baa(0x172),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x2f85f3){const _0x18cf2f=a30_0x281baa;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x18cf2f(0x160)](_0x18cf2f(0x167))):console['log'](_0x18cf2f(0x168)),{'ok':!![]};}}];
1
+ const a35_0xad34d0=a35_0x4db4;(function(_0x5f4194,_0x237f56){const _0x5ac0ac=a35_0x4db4,_0x43721e=_0x5f4194();while(!![]){try{const _0x57d9fb=parseInt(_0x5ac0ac(0xd1))/0x1*(-parseInt(_0x5ac0ac(0xce))/0x2)+parseInt(_0x5ac0ac(0xc5))/0x3+-parseInt(_0x5ac0ac(0xd4))/0x4+-parseInt(_0x5ac0ac(0xd5))/0x5*(parseInt(_0x5ac0ac(0xc6))/0x6)+parseInt(_0x5ac0ac(0xcf))/0x7+-parseInt(_0x5ac0ac(0xd2))/0x8+parseInt(_0x5ac0ac(0xc9))/0x9;if(_0x57d9fb===_0x237f56)break;else _0x43721e['push'](_0x43721e['shift']());}catch(_0x1a43aa){_0x43721e['push'](_0x43721e['shift']());}}}(a35_0x2875,0xdc197));import{unlinkSync,existsSync}from'node:fs';function a35_0x4db4(_0x47cbe8,_0x209f89){_0x47cbe8=_0x47cbe8-0xc4;const _0x2875f2=a35_0x2875();let _0x4db435=_0x2875f2[_0x47cbe8];return _0x4db435;}import{cookieFile}from'../../auth/constant.js';function a35_0x2875(){const _0x3ca97d=['8259456vsJKaw','nonInteractive','3737028AGjOBp','230vVMWYX','auth','write','yes','login','4338822ziBEGy','30960EgkLyc','log','bool','16899345WjLTPr','!\x20Not\x20logged\x20in','Login\x20via\x20browser','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','Clear\x20login\x20session','8LkZfHU','3831275mBIdcw','✓\x20Logged\x20out','191432GTfzIs'];a35_0x2875=function(){return _0x3ca97d;};return a35_0x2875();}export const authDefinitions=[{'service':a35_0xad34d0(0xd6),'command':a35_0xad34d0(0xc4),'description':a35_0xad34d0(0xcb),'risk':a35_0xad34d0(0xd7),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a35_0xad34d0(0xd8),'type':'boolean','description':a35_0xad34d0(0xcc),'default':![]}],async 'execute'(_0x4a6342){const _0x34e353=a35_0xad34d0,{runAuthServer:_0x28ad72}=await import('../../auth/auth-server-ui.js');return await _0x28ad72({'autoYes':_0x4a6342[_0x34e353(0xc8)](_0x34e353(0xd8)),'nonInteractive':_0x4a6342[_0x34e353(0xd3)]}),{'ok':!![]};}},{'service':a35_0xad34d0(0xd6),'command':'logout','description':a35_0xad34d0(0xcd),'risk':a35_0xad34d0(0xd7),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x57e0af){const _0x17c405=a35_0xad34d0;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x17c405(0xc7)](_0x17c405(0xd0))):console[_0x17c405(0xc7)](_0x17c405(0xca)),{'ok':!![]};}}];
@@ -1 +1 @@
1
- const a31_0x101808=a31_0x3f4f;(function(_0x33ee71,_0x354f19){const _0x10bfab=a31_0x3f4f,_0x229c64=_0x33ee71();while(!![]){try{const _0x123cc5=parseInt(_0x10bfab(0x1cb))/0x1+-parseInt(_0x10bfab(0x208))/0x2+parseInt(_0x10bfab(0x210))/0x3+-parseInt(_0x10bfab(0x1ee))/0x4*(parseInt(_0x10bfab(0x202))/0x5)+-parseInt(_0x10bfab(0x207))/0x6*(-parseInt(_0x10bfab(0x1e0))/0x7)+-parseInt(_0x10bfab(0x203))/0x8*(-parseInt(_0x10bfab(0x227))/0x9)+parseInt(_0x10bfab(0x223))/0xa;if(_0x123cc5===_0x354f19)break;else _0x229c64['push'](_0x229c64['shift']());}catch(_0x412745){_0x229c64['push'](_0x229c64['shift']());}}}(a31_0x5b7b,0xd13de));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';function a31_0x3f4f(_0xa10033,_0x5434c1){_0xa10033=_0xa10033-0x1c1;const _0x5b7b09=a31_0x5b7b();let _0x3f4fa8=_0x5b7b09[_0xa10033];return _0x3f4fa8;}function a31_0x5b7b(){const _0x14931b=['string','\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','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','Invalid\x20dataset\x20selection.','Script\x20description','/**\x0a\x20*\x20','当前请求参数','before','\x22.\x20','description','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','stderr','329fflXQf','scriptsRootDir','find','function-node','HOOK\x20requires\x20alias/operation/node\x20options.','utf8','create','.js\x0a','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','stdin','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','Select\x20trigger\x20node:','trim','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','5648BJQATQ','type','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20',']\x20(','alias','File\x20already\x20exists:\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','\x22\x20not\x20found.\x20','keys','ENDPOINT','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Operation\x20type\x20(HOOK\x20only)','修改后的响应结果','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x0a\x20*\x20[平台配置]\x20','code','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','4820ZvDlEg','16CDsRux','/COMMON/','name','apiDir','5514kLFuWk','2168064SEKzXk','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','map','\x22\x20not\x20found\x20for\x20dataset\x20','Function\x20name\x20(valid\x20JS\x20identifier)','nonInteractive','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','.js','3819261rNfALx','\x22,\x20params\x20})\x0a','str','isInteger','No\x20operation\x20types\x20found\x20for\x20dataset\x20','Available:\x20','\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','length','write','Alias\x20\x22','No\x20api.ts\x20found.\x20Run\x20`','bff','Select\x20dataset:','Dataset\x20not\x20found\x20for\x20code\x20\x22','question','source','Script\x20type','datasetcode','close','6044120Qunhoq','COMMON','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','No\x20datasets\x20found\x20for\x20this\x20app.','4545999pgabEr','functionNode','operation-type','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','Trigger\x20node\x20(HOOK\x20only)','\x20api\x20pull`\x20to\x20refresh.','修改后的请求参数','UNKNOWN','当前响应结果','operationType','appCode','after','371340oixrga','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','Invalid\x20function\x20name\x20\x22','HOOK','datasetCode','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','parseInt','validation','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20'];a31_0x5b7b=function(){return _0x14931b;};return a31_0x5b7b();}import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.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';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a31_0x101808(0x21b),'command':a31_0x101808(0x1e6),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':'read','flags':[{'name':a31_0x101808(0x1ef),'type':a31_0x101808(0x1d4),'required':!![],'enum':[a31_0x101808(0x224),a31_0x101808(0x1f7),a31_0x101808(0x1ce)],'description':a31_0x101808(0x220)},{'name':a31_0x101808(0x205),'type':a31_0x101808(0x1d4),'required':!![],'description':a31_0x101808(0x20c)},{'name':'description','type':a31_0x101808(0x1d4),'description':a31_0x101808(0x1d8)},{'name':a31_0x101808(0x1f2),'type':a31_0x101808(0x1d4),'description':a31_0x101808(0x1c2)},{'name':a31_0x101808(0x221),'type':a31_0x101808(0x1d4),'description':a31_0x101808(0x20e)},{'name':a31_0x101808(0x1c1),'type':'string','description':a31_0x101808(0x1fc)},{'name':a31_0x101808(0x1e3),'type':'string','description':a31_0x101808(0x1c3),'enum':[a31_0x101808(0x1db),a31_0x101808(0x1ca)]}],async 'validate'(_0x3f1a10){const _0x23530a=a31_0x101808,_0x59a517=_0x3f1a10[_0x23530a(0x212)](_0x23530a(0x205));if(!isValidBffFunctionName(_0x59a517))throw CliErrors[_0x23530a(0x1d2)](_0x23530a(0x1cd)+_0x59a517+_0x23530a(0x1d6));},async 'execute'(_0x32acbc){const _0xcebd53=a31_0x101808,_0x219706=loadBffProjectConfig(_0x32acbc['appCode']),_0x36e2c8=_0x32acbc[_0xcebd53(0x212)](_0xcebd53(0x1ef)),_0x29e873=_0x32acbc[_0xcebd53(0x212)]('name'),_0x32dc8c=_0x32acbc[_0xcebd53(0x212)](_0xcebd53(0x1dd))||undefined,_0xb1812f=_0x36e2c8===_0xcebd53(0x1ce)?await resolveHookOptions(_0x219706,_0x32acbc):undefined,_0x24c042=buildFilePath(_0x219706,_0x36e2c8,_0x29e873,_0xb1812f);if(await fileExists(_0x24c042))throw CliErrors['validation'](_0xcebd53(0x1f3)+_0x24c042);await mkdir(dirname(_0x24c042),{'recursive':!![]});const _0x34bcb8=generateTemplate(_0x36e2c8,_0x29e873,_0x32acbc[_0xcebd53(0x1c9)],_0x32dc8c,_0xb1812f);await writeFile(_0x24c042,_0x34bcb8,_0xcebd53(0x1e5));const _0xc36852={'type':_0x36e2c8,'name':_0x29e873,'path':_0x24c042};if(_0x32dc8c)_0xc36852[_0xcebd53(0x1dd)]=_0x32dc8c;if(_0xb1812f){if(_0xb1812f[_0xcebd53(0x1f2)])_0xc36852['alias']=_0xb1812f[_0xcebd53(0x1f2)];_0xc36852['datasetCode']=_0xb1812f[_0xcebd53(0x1cf)],_0xc36852[_0xcebd53(0x1c8)]=_0xb1812f[_0xcebd53(0x1c8)],_0xc36852[_0xcebd53(0x228)]=_0xb1812f[_0xcebd53(0x228)];}return{'ok':!![],'data':_0xc36852,'message':'Created\x20'+_0x36e2c8+'\x20function:\x20'+_0x29e873};}};async function resolveHookOptions(_0x54ba0f,_0x181626){const _0x1a4bb1=a31_0x101808,_0x583a59=loadAliasMap(_0x181626[_0x1a4bb1(0x206)],undefined,resolveApiFilePath(_0x181626[_0x1a4bb1(0x206)],_0x181626['appCode'])),_0x1a8a88=_0x583a59[_0x1a4bb1(0x217)]>0x0;let _0x5e0923,_0x2f05f4,_0x1d1d7b;const _0x39abd2=_0x181626[_0x1a4bb1(0x212)](_0x1a4bb1(0x1f2)),_0x3a8475=_0x181626['str'](_0x1a4bb1(0x221));if(_0x39abd2){const _0x36cd46=resolveAlias(_0x181626[_0x1a4bb1(0x206)],_0x39abd2,undefined,resolveApiFilePath(_0x181626[_0x1a4bb1(0x206)],_0x181626[_0x1a4bb1(0x1c9)]));if(!_0x36cd46){const _0x2bb621=_0x1a8a88?'Available\x20aliases:\x20'+_0x583a59[_0x1a4bb1(0x20a)](_0x10d66c=>_0x10d66c[_0x1a4bb1(0x1f2)])['join'](',\x20'):_0x1a4bb1(0x21a)+CLI_BIN_NAME+_0x1a4bb1(0x1fa);throw CliErrors[_0x1a4bb1(0x1d2)](_0x1a4bb1(0x219)+_0x39abd2+_0x1a4bb1(0x1f5)+_0x2bb621);}_0x5e0923=_0x39abd2,_0x2f05f4=_0x36cd46;}else{if(_0x3a8475){_0x2f05f4=_0x3a8475;const _0x2c160d=_0x583a59[_0x1a4bb1(0x1e2)](_0x1d5470=>_0x1d5470[_0x1a4bb1(0x1cf)]===_0x3a8475);_0x5e0923=_0x2c160d?.[_0x1a4bb1(0x1f2)];}else{if(_0x181626[_0x1a4bb1(0x20d)])throw CliErrors['validation'](_0x1a4bb1(0x1d0));else{if(_0x1a8a88){const _0x27b6e0=_0x583a59[_0x1a4bb1(0x20a)](_0x562804=>_0x562804[_0x1a4bb1(0x1f2)]+'\x20('+_0x562804['tableName']+')'),_0x2849f3=await promptSelect(_0x1a4bb1(0x21c),_0x27b6e0),_0x5b84cc=_0x583a59[_0x2849f3];if(!_0x5b84cc)throw CliErrors[_0x1a4bb1(0x1d2)]('Invalid\x20dataset\x20selection.');_0x5e0923=_0x5b84cc[_0x1a4bb1(0x1f2)],_0x2f05f4=_0x5b84cc[_0x1a4bb1(0x1cf)];}else{const _0x99cc7a=await listDatasets(_0x181626[_0x1a4bb1(0x1c9)]);if(_0x99cc7a[_0x1a4bb1(0x217)]===0x0)throw CliErrors[_0x1a4bb1(0x1d2)](_0x1a4bb1(0x226));const _0x5d9534=_0x99cc7a['map'](_0x53f72c=>_0x53f72c['name']+'\x20['+(_0x53f72c[_0x1a4bb1(0x21f)]??_0x1a4bb1(0x1c6))+_0x1a4bb1(0x1f1)+_0x53f72c[_0x1a4bb1(0x200)]+')'),_0x21a0b6=await promptSelect('Select\x20dataset:',_0x5d9534),_0x29e674=_0x99cc7a[_0x21a0b6];if(!_0x29e674)throw CliErrors[_0x1a4bb1(0x1d2)](_0x1a4bb1(0x1d7));_0x2f05f4=_0x29e674[_0x1a4bb1(0x200)],_0x5e0923=undefined;}}}}const _0x2373dd=await listDatasets(_0x181626['appCode']),_0x391819=_0x2373dd[_0x1a4bb1(0x1e2)](_0x1976c6=>_0x1976c6['code']===_0x2f05f4);if(!_0x391819)throw CliErrors[_0x1a4bb1(0x1d2)](_0x1a4bb1(0x21d)+_0x2f05f4+_0x1a4bb1(0x1dc)+(_0x5e0923?'The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`'+CLI_BIN_NAME+_0x1a4bb1(0x1c4):''));_0x1d1d7b=_0x391819['id'];const _0x470bcd=_0x5e0923??_0x2f05f4,_0x57b2ce=await listBffDatasetOperations(_0x181626[_0x1a4bb1(0x1c9)],_0x1d1d7b),_0x876317=_0x57b2ce?Object[_0x1a4bb1(0x1f6)](_0x57b2ce):[];if(_0x876317[_0x1a4bb1(0x217)]===0x0)throw CliErrors[_0x1a4bb1(0x1d2)](_0x1a4bb1(0x214)+_0x470bcd+'.');let _0x2dfdcd;const _0x377820=_0x181626[_0x1a4bb1(0x212)](_0x1a4bb1(0x1c1));if(_0x377820){if(!_0x876317['includes'](_0x377820))throw CliErrors['validation']('Operation\x20type\x20\x22'+_0x377820+_0x1a4bb1(0x20b)+_0x470bcd+'.\x20'+(_0x1a4bb1(0x215)+_0x876317['join'](',\x20')));_0x2dfdcd=_0x377820;}else{if(_0x181626[_0x1a4bb1(0x20d)])throw CliErrors['validation'](_0x1a4bb1(0x209));const _0xcde24c=await promptSelect('Select\x20operation\x20type:',_0x876317);_0x2dfdcd=_0x876317[_0xcde24c]??_0x876317[0x0];}let _0x44ad66=normalizeHookFunctionNode(_0x181626[_0x1a4bb1(0x212)]('function-node'));if(!_0x44ad66){if(_0x181626[_0x1a4bb1(0x212)](_0x1a4bb1(0x1e3)))throw CliErrors[_0x1a4bb1(0x1d2)](_0x1a4bb1(0x1ed));if(_0x181626[_0x1a4bb1(0x20d)])throw CliErrors[_0x1a4bb1(0x1d2)](_0x1a4bb1(0x1fe));const _0x285cfb=await promptSelect(_0x1a4bb1(0x1eb),[_0x1a4bb1(0x1db),_0x1a4bb1(0x1ca)]);_0x44ad66=[_0x1a4bb1(0x1db),_0x1a4bb1(0x1ca)][_0x285cfb]??_0x1a4bb1(0x1db);}return{'alias':_0x5e0923,'datasetCode':_0x2f05f4,'datasetId':_0x1d1d7b,'operationType':_0x2dfdcd,'functionNode':_0x44ad66};}async function promptSelect(_0x308645,_0x1e97f2){const _0x264a1c=a31_0x101808;if(_0x1e97f2[_0x264a1c(0x217)]===0x1)return 0x0;for(const [_0x413b67,_0x2a576d]of _0x1e97f2['entries']()){process[_0x264a1c(0x1df)]['write']('\x20\x20'+(_0x413b67+0x1)+'.\x20'+_0x2a576d+'\x0a');}const _0x353bd4=createInterface({'input':process[_0x264a1c(0x1e9)],'output':process[_0x264a1c(0x1df)]});while(!![]){const _0x3cf501=await new Promise(_0x43a154=>{const _0x121afb=_0x264a1c;_0x353bd4[_0x121afb(0x21e)](_0x308645+'\x20',_0x43a154);}),_0x581457=Number[_0x264a1c(0x1d1)](_0x3cf501[_0x264a1c(0x1ec)](),0xa);if(Number[_0x264a1c(0x213)](_0x581457)&&_0x581457>=0x1&&_0x581457<=_0x1e97f2[_0x264a1c(0x217)])return _0x353bd4[_0x264a1c(0x222)](),_0x581457-0x1;process[_0x264a1c(0x1df)][_0x264a1c(0x218)](_0x264a1c(0x1f0)+_0x1e97f2[_0x264a1c(0x217)]+'.\x0a');}}function buildFilePath(_0x159a4a,_0x319c78,_0x1a7ceb,_0xa379db){const _0x2c6473=a31_0x101808;if(_0x319c78===_0x2c6473(0x1ce)){if(!_0xa379db)throw CliErrors[_0x2c6473(0x1d2)](_0x2c6473(0x1e4));const _0x5bab1c=_0xa379db['alias']??_0xa379db[_0x2c6473(0x1cf)];return join(_0x159a4a[_0x2c6473(0x1e1)],'HOOK',_0x5bab1c,_0xa379db['operationType'],_0xa379db['functionNode'],_0x1a7ceb+'.js');}return join(_0x159a4a[_0x2c6473(0x1e1)],_0x319c78,_0x1a7ceb+_0x2c6473(0x20f));}export function generateTemplate(_0x237e4a,_0x2605f3,_0x5a16b3,_0x26b9f4,_0x3b91cf){const _0x5e09c9=a31_0x101808,_0x215f2d=_0x26b9f4?.[_0x5e09c9(0x1ec)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0xd9106f=getAppBaseUrl(_0x5a16b3),_0x5dc466=_0x5e09c9(0x1f8);if(_0x237e4a==='COMMON')return _0x5e09c9(0x1d9)+_0x215f2d+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x2605f3+_0x5e09c9(0x1ff)+_0xd9106f+_0x5e09c9(0x201)+_0x5a16b3+_0x5e09c9(0x204)+_0x2605f3+_0x5e09c9(0x225)+_0x2605f3+_0x5e09c9(0x211)+_0x5dc466+_0x5e09c9(0x1d5)+_0x2605f3+_0x5e09c9(0x1cc);if(_0x237e4a===_0x5e09c9(0x1f7))return _0x5e09c9(0x1d9)+_0x215f2d+_0x5e09c9(0x1fb)+_0x2605f3+_0x5e09c9(0x1e8)+_0x5a16b3+'/'+_0x2605f3+_0x5e09c9(0x1ff)+_0xd9106f+_0x5e09c9(0x201)+_0x5a16b3+'/ENDPOINT/'+_0x2605f3+_0x5e09c9(0x1e7)+_0x5dc466+_0x5e09c9(0x216)+_0x2605f3+_0x5e09c9(0x1cc);if(!_0x3b91cf)throw CliErrors[_0x5e09c9(0x1d2)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x568e5c=_0x3b91cf[_0x5e09c9(0x1f2)]??_0x3b91cf[_0x5e09c9(0x1cf)],_0x567704=_0x3b91cf[_0x5e09c9(0x228)]===_0x5e09c9(0x1db)?_0x5e09c9(0x1da):_0x5e09c9(0x1c7),_0x4587b1=_0x3b91cf[_0x5e09c9(0x228)]===_0x5e09c9(0x1db)?_0x5e09c9(0x1c5):_0x5e09c9(0x1fd);return _0x5e09c9(0x1d9)+_0x215f2d+_0x5e09c9(0x1f9)+_0x2605f3+_0x5e09c9(0x1de)+_0x5a16b3+'/'+_0x3b91cf['datasetCode']+'/'+_0x3b91cf[_0x5e09c9(0x1c8)]+_0x5e09c9(0x1ff)+_0xd9106f+'/data/dataset/'+_0x3b91cf['datasetId']+_0x5e09c9(0x1ea)+_0x5a16b3+'/HOOK/'+_0x568e5c+'/'+_0x3b91cf[_0x5e09c9(0x1c8)]+'/'+_0x3b91cf[_0x5e09c9(0x228)]+'/'+_0x2605f3+'.js\x0a\x20*\x20[触发节点]\x20'+_0x3b91cf['functionNode']+'\x0a'+_0x5dc466+_0x5e09c9(0x1f4)+_0x567704+_0x5e09c9(0x1d3)+_0x4587b1+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x2605f3+_0x5e09c9(0x1cc);}
1
+ const a36_0x5721ca=a36_0x2943;(function(_0x42e405,_0x2523ce){const _0x41fc2f=a36_0x2943,_0x199da4=_0x42e405();while(!![]){try{const _0x170b2a=-parseInt(_0x41fc2f(0x111))/0x1*(-parseInt(_0x41fc2f(0x118))/0x2)+parseInt(_0x41fc2f(0x101))/0x3+parseInt(_0x41fc2f(0xe5))/0x4+-parseInt(_0x41fc2f(0xc8))/0x5+-parseInt(_0x41fc2f(0xe7))/0x6*(parseInt(_0x41fc2f(0x100))/0x7)+parseInt(_0x41fc2f(0xe4))/0x8+-parseInt(_0x41fc2f(0xc6))/0x9;if(_0x170b2a===_0x2523ce)break;else _0x199da4['push'](_0x199da4['shift']());}catch(_0x242a91){_0x199da4['push'](_0x199da4['shift']());}}}(a36_0x5796,0xdbdd0));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';function a36_0x2943(_0x4b9af8,_0x405716){_0x4b9af8=_0x4b9af8-0xbe;const _0x5796d7=a36_0x5796();let _0x2943e=_0x5796d7[_0x4b9af8];return _0x2943e;}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';function a36_0x5796(){const _0x453cd3=['6393248RbHQpS','Function\x20name\x20(valid\x20JS\x20identifier)','372WDABiI','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','create','Created\x20','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','parseInt','datasetcode','\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','Script\x20type','str','Invalid\x20dataset\x20selection.','HOOK','Operation\x20type\x20(HOOK\x20only)','\x0a\x20*\x20[平台配置]\x20',']\x20(','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','datasetCode','stderr','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','No\x20datasets\x20found\x20for\x20this\x20app.','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','/**\x0a\x20*\x20','/ENDPOINT/','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','78253UVKfXM','1157523ryyCPv','No\x20model\x20aliases\x20found.\x20Run\x20`','appCode','No\x20operation\x20types\x20found\x20for\x20dataset\x20','HOOK\x20requires\x20alias/operation/node\x20options.','question','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','datasetId','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','apiDir','write','validation','isInteger','before','Trigger\x20node\x20(HOOK\x20only)','includes','9JISiSj','filePath','name','\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','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','map','201944xzlHVT','Alias\x20\x22','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','\x20api\x20pull`\x20to\x20refresh.','code','string','after','修改后的请求参数','operationType','nonInteractive','functionNode','\x22\x20not\x20found.\x20','Script\x20description','Dataset\x20not\x20found\x20for\x20code\x20\x22','/COMMON/','.js\x0a','type','10637550mOumPJ','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','7040945TaosIP','currentApp','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','\x22.\x20','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','alias','COMMON','length','/HOOK/','profileName','Available:\x20','read','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','\x22,\x20params\x20})\x0a','Invalid\x20function\x20name\x20\x22','Select\x20operation\x20type:','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','ENDPOINT','scriptsRootDir','join','function-node','find','当前响应结果','operation-type','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','keys','description','Select\x20dataset:','10327168udLqUw'];a36_0x5796=function(){return _0x453cd3;};return a36_0x5796();}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';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':'bff','command':a36_0x5721ca(0xea),'description':a36_0x5721ca(0xca),'risk':a36_0x5721ca(0xd3),'flags':[{'name':a36_0x5721ca(0xc5),'type':a36_0x5721ca(0x11d),'required':!![],'enum':[a36_0x5721ca(0xce),'ENDPOINT',a36_0x5721ca(0xf3)],'description':a36_0x5721ca(0xf0)},{'name':a36_0x5721ca(0x113),'type':'string','required':!![],'description':a36_0x5721ca(0xe6)},{'name':'description','type':'string','description':a36_0x5721ca(0xc1)},{'name':a36_0x5721ca(0xcd),'type':a36_0x5721ca(0x11d),'description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a36_0x5721ca(0xee),'type':a36_0x5721ca(0x11d),'description':a36_0x5721ca(0x116)},{'name':'operation-type','type':a36_0x5721ca(0x11d),'description':a36_0x5721ca(0xf4)},{'name':a36_0x5721ca(0xdc),'type':a36_0x5721ca(0x11d),'description':a36_0x5721ca(0x10f),'enum':[a36_0x5721ca(0x10e),a36_0x5721ca(0x11e)]}],async 'validate'(_0x438949){const _0x3210c8=a36_0x5721ca,_0x52d735=_0x438949[_0x3210c8(0xf1)](_0x3210c8(0x113));if(!isValidBffFunctionName(_0x52d735))throw CliErrors['validation'](_0x3210c8(0xd6)+_0x52d735+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x34ec3c){const _0x51b7ff=a36_0x5721ca,_0x27a237=loadBffProjectConfig(_0x34ec3c['appCode']),_0x3c37fc=_0x34ec3c[_0x51b7ff(0xf1)](_0x51b7ff(0xc5)),_0x282698=_0x34ec3c[_0x51b7ff(0xf1)]('name'),_0x4c7a30=_0x34ec3c[_0x51b7ff(0xf1)]('description')||undefined,_0x39f032=_0x3c37fc===_0x51b7ff(0xf3)?await resolveHookOptions(_0x27a237,_0x34ec3c):undefined,_0x5c71a9=buildFilePath(_0x27a237,_0x3c37fc,_0x282698,_0x39f032);if(await fileExists(_0x5c71a9))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x5c71a9);await mkdir(dirname(_0x5c71a9),{'recursive':!![]});const _0x1ec34a=generateTemplate(_0x3c37fc,_0x282698,_0x34ec3c[_0x51b7ff(0x103)],_0x4c7a30,_0x39f032);await writeFile(_0x5c71a9,_0x1ec34a,'utf8');const _0x18448d={'type':_0x3c37fc,'name':_0x282698,'path':_0x5c71a9};if(_0x4c7a30)_0x18448d[_0x51b7ff(0xe2)]=_0x4c7a30;if(_0x39f032){if(_0x39f032['alias'])_0x18448d[_0x51b7ff(0xcd)]=_0x39f032[_0x51b7ff(0xcd)];_0x18448d[_0x51b7ff(0xf8)]=_0x39f032[_0x51b7ff(0xf8)],_0x18448d['operationType']=_0x39f032[_0x51b7ff(0x120)],_0x18448d[_0x51b7ff(0xbf)]=_0x39f032[_0x51b7ff(0xbf)];}return{'ok':!![],'data':_0x18448d,'message':_0x51b7ff(0xeb)+_0x3c37fc+'\x20function:\x20'+_0x282698};}};async function resolveHookOptions(_0x309b5d,_0x31322e){const _0x295108=a36_0x5721ca,_0x1351e4=resolveApiModelSource(_0x31322e[_0x295108(0x10a)],_0x31322e[_0x295108(0x103)],_0x31322e['selectedAppName']||_0x31322e['mergedCli']?.[_0x295108(0xc9)]||_0x31322e['mergedCli']?.['defaultApp']),_0x3ce4b6=loadAliasMap(_0x31322e[_0x295108(0x10a)],undefined,_0x1351e4[_0x295108(0x112)],_0x1351e4[_0x295108(0xd1)]),_0x3dd41e=_0x3ce4b6[_0x295108(0xcf)]>0x0;let _0x20835a,_0x5d5423,_0x29b9fa;const _0x3a8536=_0x31322e['str'](_0x295108(0xcd)),_0x43f7f3=_0x31322e[_0x295108(0xf1)]('datasetcode');if(_0x3a8536){const _0x33acfc=resolveAlias(_0x31322e[_0x295108(0x10a)],_0x3a8536,undefined,_0x1351e4[_0x295108(0x112)],_0x1351e4[_0x295108(0xd1)]);if(!_0x33acfc){const _0xde619e=_0x3dd41e?'Available\x20aliases:\x20'+_0x3ce4b6[_0x295108(0x117)](_0x211f21=>_0x211f21['alias'])[_0x295108(0xdb)](',\x20'):_0x295108(0x102)+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x295108(0x10c)](_0x295108(0x119)+_0x3a8536+_0x295108(0xc0)+_0xde619e);}_0x20835a=_0x3a8536,_0x5d5423=_0x33acfc;}else{if(_0x43f7f3){_0x5d5423=_0x43f7f3;const _0x4f9daa=_0x3ce4b6[_0x295108(0xdd)](_0x1303eb=>_0x1303eb[_0x295108(0xf8)]===_0x43f7f3);_0x20835a=_0x4f9daa?.[_0x295108(0xcd)];}else{if(_0x31322e[_0x295108(0xbe)])throw CliErrors['validation'](_0x295108(0xe0));else{if(_0x3dd41e){const _0x58f335=_0x3ce4b6['map'](_0x5e3795=>_0x5e3795['alias']+'\x20('+_0x5e3795['tableName']+')'),_0x4e94dc=await promptSelect(_0x295108(0xe3),_0x58f335),_0x4849ee=_0x3ce4b6[_0x4e94dc];if(!_0x4849ee)throw CliErrors['validation'](_0x295108(0xf2));_0x20835a=_0x4849ee['alias'],_0x5d5423=_0x4849ee[_0x295108(0xf8)];}else{const _0x5eb1ea=await listDatasets(_0x31322e['appCode']);if(_0x5eb1ea['length']===0x0)throw CliErrors[_0x295108(0x10c)](_0x295108(0xfb));const _0x2ad5e5=_0x5eb1ea['map'](_0x58fb5a=>_0x58fb5a[_0x295108(0x113)]+'\x20['+(_0x58fb5a['source']??'UNKNOWN')+_0x295108(0xf6)+_0x58fb5a[_0x295108(0x11c)]+')'),_0x272f2b=await promptSelect(_0x295108(0xe3),_0x2ad5e5),_0x3aa307=_0x5eb1ea[_0x272f2b];if(!_0x3aa307)throw CliErrors['validation']('Invalid\x20dataset\x20selection.');_0x5d5423=_0x3aa307[_0x295108(0x11c)],_0x20835a=undefined;}}}}const _0x2add64=await listDatasets(_0x31322e['appCode']),_0x164fd3=_0x2add64['find'](_0x50766a=>_0x50766a[_0x295108(0x11c)]===_0x5d5423);if(!_0x164fd3)throw CliErrors[_0x295108(0x10c)](_0x295108(0xc2)+_0x5d5423+_0x295108(0xcb)+(_0x20835a?_0x295108(0x109)+CLI_BIN_NAME+_0x295108(0x11b):''));_0x29b9fa=_0x164fd3['id'];const _0x3f954d=_0x20835a??_0x5d5423,_0x461450=await listBffDatasetOperations(_0x31322e[_0x295108(0x103)],_0x29b9fa),_0x5e4bac=_0x461450?Object[_0x295108(0xe1)](_0x461450):[];if(_0x5e4bac[_0x295108(0xcf)]===0x0)throw CliErrors[_0x295108(0x10c)](_0x295108(0x104)+_0x3f954d+'.');let _0x817576;const _0x8863dc=_0x31322e[_0x295108(0xf1)](_0x295108(0xdf));if(_0x8863dc){if(!_0x5e4bac[_0x295108(0x110)](_0x8863dc))throw CliErrors['validation']('Operation\x20type\x20\x22'+_0x8863dc+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x3f954d+'.\x20'+(_0x295108(0xd2)+_0x5e4bac[_0x295108(0xdb)](',\x20')));_0x817576=_0x8863dc;}else{if(_0x31322e['nonInteractive'])throw CliErrors[_0x295108(0x10c)]('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x479c9a=await promptSelect(_0x295108(0xd7),_0x5e4bac);_0x817576=_0x5e4bac[_0x479c9a]??_0x5e4bac[0x0];}let _0x408eb6=normalizeHookFunctionNode(_0x31322e['str'](_0x295108(0xdc)));if(!_0x408eb6){if(_0x31322e[_0x295108(0xf1)](_0x295108(0xdc)))throw CliErrors['validation'](_0x295108(0xfa));if(_0x31322e[_0x295108(0xbe)])throw CliErrors[_0x295108(0x10c)](_0x295108(0xec));const _0x52b545=await promptSelect('Select\x20trigger\x20node:',[_0x295108(0x10e),'after']);_0x408eb6=[_0x295108(0x10e),_0x295108(0x11e)][_0x52b545]??_0x295108(0x10e);}return{'alias':_0x20835a,'datasetCode':_0x5d5423,'datasetId':_0x29b9fa,'operationType':_0x817576,'functionNode':_0x408eb6};}async function promptSelect(_0x3d3aa,_0x200dc1){const _0x39101a=a36_0x5721ca;if(_0x200dc1['length']===0x1)return 0x0;for(const [_0x4ce069,_0x19b33f]of _0x200dc1['entries']()){process['stderr'][_0x39101a(0x10b)]('\x20\x20'+(_0x4ce069+0x1)+'.\x20'+_0x19b33f+'\x0a');}const _0x236300=createInterface({'input':process['stdin'],'output':process['stderr']});while(!![]){const _0xc7ef41=await new Promise(_0x1daab1=>{const _0x35336b=_0x39101a;_0x236300[_0x35336b(0x106)](_0x3d3aa+'\x20',_0x1daab1);}),_0x4f48dc=Number[_0x39101a(0xed)](_0xc7ef41['trim'](),0xa);if(Number[_0x39101a(0x10d)](_0x4f48dc)&&_0x4f48dc>=0x1&&_0x4f48dc<=_0x200dc1['length'])return _0x236300['close'](),_0x4f48dc-0x1;process[_0x39101a(0xf9)][_0x39101a(0x10b)](_0x39101a(0xe8)+_0x200dc1[_0x39101a(0xcf)]+'.\x0a');}}function buildFilePath(_0x2cfeef,_0x8b9cdd,_0x521f7b,_0x594eb7){const _0x583e25=a36_0x5721ca;if(_0x8b9cdd===_0x583e25(0xf3)){if(!_0x594eb7)throw CliErrors[_0x583e25(0x10c)](_0x583e25(0x105));const _0x1f9395=_0x594eb7[_0x583e25(0xcd)]??_0x594eb7[_0x583e25(0xf8)];return join(_0x2cfeef[_0x583e25(0xda)],_0x583e25(0xf3),_0x1f9395,_0x594eb7['operationType'],_0x594eb7['functionNode'],_0x521f7b+'.js');}return join(_0x2cfeef[_0x583e25(0xda)],_0x8b9cdd,_0x521f7b+'.js');}export function generateTemplate(_0x4c2b3f,_0x4864db,_0x1acd2e,_0x156169,_0x43b52c){const _0x11a48a=a36_0x5721ca,_0x5d0df6=_0x156169?.['trim']()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x35eb47=getAppBaseUrl(_0x1acd2e),_0x311c31=_0x11a48a(0x107);if(_0x4c2b3f===_0x11a48a(0xce))return _0x11a48a(0xfd)+_0x5d0df6+_0x11a48a(0xfc)+_0x4864db+'\x0a\x20*\x20[平台配置]\x20'+_0x35eb47+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x1acd2e+_0x11a48a(0xc3)+_0x4864db+_0x11a48a(0xf7)+_0x4864db+_0x11a48a(0xd5)+_0x311c31+_0x11a48a(0x114)+_0x4864db+_0x11a48a(0x11a);if(_0x4c2b3f===_0x11a48a(0xd9))return _0x11a48a(0xfd)+_0x5d0df6+_0x11a48a(0x115)+_0x4864db+_0x11a48a(0xd4)+_0x1acd2e+'/'+_0x4864db+_0x11a48a(0xf5)+_0x35eb47+_0x11a48a(0xcc)+_0x1acd2e+_0x11a48a(0xfe)+_0x4864db+_0x11a48a(0xc4)+_0x311c31+_0x11a48a(0xef)+_0x4864db+_0x11a48a(0x11a);if(!_0x43b52c)throw CliErrors['validation'](_0x11a48a(0xd8));const _0x577df2=_0x43b52c[_0x11a48a(0xcd)]??_0x43b52c['datasetCode'],_0x178e61=_0x43b52c[_0x11a48a(0xbf)]===_0x11a48a(0x10e)?'当前请求参数':_0x11a48a(0xde),_0x514894=_0x43b52c['functionNode']===_0x11a48a(0x10e)?_0x11a48a(0x11f):'修改后的响应结果';return _0x11a48a(0xfd)+_0x5d0df6+_0x11a48a(0xc7)+_0x4864db+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x1acd2e+'/'+_0x43b52c[_0x11a48a(0xf8)]+'/'+_0x43b52c[_0x11a48a(0x120)]+_0x11a48a(0xf5)+_0x35eb47+'/data/dataset/'+_0x43b52c[_0x11a48a(0x108)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x1acd2e+_0x11a48a(0xd0)+_0x577df2+'/'+_0x43b52c[_0x11a48a(0x120)]+'/'+_0x43b52c[_0x11a48a(0xbf)]+'/'+_0x4864db+'.js\x0a\x20*\x20[触发节点]\x20'+_0x43b52c[_0x11a48a(0xbf)]+'\x0a'+_0x311c31+'\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20'+_0x178e61+_0x11a48a(0xff)+_0x514894+_0x11a48a(0xe9)+_0x4864db+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';}
@@ -1 +1 @@
1
- const a32_0x517e9a=a32_0x36d5;(function(_0x147ccd,_0x142363){const _0x1f3443=a32_0x36d5,_0xbb922e=_0x147ccd();while(!![]){try{const _0x226499=parseInt(_0x1f3443(0xb3))/0x1+parseInt(_0x1f3443(0x98))/0x2*(parseInt(_0x1f3443(0xa3))/0x3)+parseInt(_0x1f3443(0xb7))/0x4*(-parseInt(_0x1f3443(0xc0))/0x5)+parseInt(_0x1f3443(0xbc))/0x6+-parseInt(_0x1f3443(0x9f))/0x7+parseInt(_0x1f3443(0xbe))/0x8+-parseInt(_0x1f3443(0x9d))/0x9*(parseInt(_0x1f3443(0xb2))/0xa);if(_0x226499===_0x142363)break;else _0xbb922e['push'](_0xbb922e['shift']());}catch(_0x96dcc2){_0xbb922e['push'](_0xbb922e['shift']());}}}(a32_0x23b7,0x55cdf));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 a32_0x23b7(){const _0x32f799=['2700EYUtvg','428196vDAtBG','delete','keys','No\x20lock\x20entry\x20found\x20for\x20\x22','360268BFhlVR','bff','Local\x20delete\x20not\x20settled\x20for\x20','\x22\x20not\x20found\x20after\x20ensureLockScope.','\x20\x20-\x20','403176zOwvEJ','length','2862192WXqAuB','target','5FihsDe','str','Would\x20delete\x20','join','POST','toISOString','scriptsRootDir','find','remoteId','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','lockFilePath','scriptsRoot','40464ALsGdp','stringify','projectRoot','Multiple\x20functions\x20match\x20\x22','/api/management/library/scripts/delete','7542WOxnpc','functions','2572304WxhvDw','appCode','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','validation','27orStKH','Lock\x20scope\x20for\x20app\x20\x22','split','high-risk-write','string','filter','Backend\x20Function\x20lock\x20file\x20not\x20found.','\x20(local\x20file\x20moved\x20to\x20trash)','trashedTo','apps','replace','lastSync','Function\x20not\x20found:\x20','map','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'];a32_0x23b7=function(){return _0x32f799;};return a32_0x23b7();}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':a32_0x517e9a(0xb8),'command':a32_0x517e9a(0xb4),'description':'Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','risk':a32_0x517e9a(0xa6),'flags':[{'name':a32_0x517e9a(0xbf),'type':a32_0x517e9a(0xa7),'required':!![],'description':a32_0x517e9a(0xb1)}],async 'validate'(_0x42c7e0){const _0x54dc22=a32_0x517e9a,_0x14412d=loadBffProjectConfig(_0x42c7e0[_0x54dc22(0xa0)]),_0x3e145b=await readBffLockFile(_0x14412d[_0x54dc22(0x96)]);if(!_0x3e145b)throw CliErrors['validation'](_0x54dc22(0x95));},async 'dryRun'(_0x270cf5){const _0x5f426a=a32_0x517e9a,_0xdccfe0=loadBffProjectConfig(_0x270cf5[_0x5f426a(0xa0)]),_0x29317b=await readBffLockFile(_0xdccfe0[_0x5f426a(0x96)]);if(!_0x29317b)throw CliErrors[_0x5f426a(0xa2)](_0x5f426a(0xa9));const {appLock:_0x1173b0}=ensureLockScope(_0x29317b,_0x270cf5[_0x5f426a(0xa0)],_0xdccfe0[_0x5f426a(0x97)],'delete'),_0x4c6eff=_0x270cf5[_0x5f426a(0xc1)](_0x5f426a(0xbf)),_0x1c1a63=Object[_0x5f426a(0xb5)](_0x1173b0[_0x5f426a(0x9e)]),_0x5c73bc=resolveDeleteTarget(_0x4c6eff,_0x1c1a63),_0x487e8e=_0x1173b0['functions'][_0x5c73bc];if(!_0x487e8e)throw CliErrors[_0x5f426a(0xa2)]('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x5c73bc+'\x22.');const _0x5b0882=resolveLocalFilePathFromLockKey(_0xdccfe0,_0x5c73bc),_0x32c23a=relative(_0xdccfe0[_0x5f426a(0x9a)],_0x5b0882),_0x5a5da1=join(_0xdccfe0['trashDir'],'<timestamp>',_0x32c23a);return{'method':_0x5f426a(0xc4),'url':_0x5f426a(0x9c),'body':{'appCode':_0x270cf5[_0x5f426a(0xa0)],'target':_0x5c73bc,'remoteId':_0x487e8e[_0x5f426a(0x94)],'localFilePath':_0x5b0882,'trashedPath':_0x5a5da1},'description':_0x5f426a(0xc2)+_0x5c73bc+_0x5f426a(0xa1)};},async 'execute'(_0x15bed0){const _0x4a69a5=a32_0x517e9a,_0x22fbd7=loadBffProjectConfig(_0x15bed0[_0x4a69a5(0xa0)]),_0x363dfe=await readBffLockFile(_0x22fbd7[_0x4a69a5(0x96)]);if(!_0x363dfe)throw CliErrors[_0x4a69a5(0xa2)](_0x4a69a5(0xa9));const {lockData:_0x5705d3,appLock:_0x247cd2}=ensureLockScope(_0x363dfe,_0x15bed0[_0x4a69a5(0xa0)],_0x22fbd7[_0x4a69a5(0x97)],_0x4a69a5(0xb4)),_0x2cc57f=JSON['parse'](JSON[_0x4a69a5(0x99)](_0x5705d3)),_0x2e1e3a=_0x2cc57f[_0x4a69a5(0xac)][_0x15bed0[_0x4a69a5(0xa0)]];if(!_0x2e1e3a)throw new Error(_0x4a69a5(0xa4)+_0x15bed0[_0x4a69a5(0xa0)]+_0x4a69a5(0xba));const _0x3bd22c=_0x15bed0[_0x4a69a5(0xc1)](_0x4a69a5(0xbf)),_0x5da522=Object[_0x4a69a5(0xb5)](_0x2e1e3a[_0x4a69a5(0x9e)]),_0x39fdf0=resolveDeleteTarget(_0x3bd22c,_0x5da522),_0x5c0984=_0x2e1e3a[_0x4a69a5(0x9e)][_0x39fdf0];if(!_0x5c0984)throw CliErrors['validation'](_0x4a69a5(0xb6)+_0x39fdf0+'\x22.');await deleteBffScript(_0x5c0984[_0x4a69a5(0x94)]),delete _0x2e1e3a[_0x4a69a5(0x9e)][_0x39fdf0],_0x2e1e3a[_0x4a69a5(0xae)]=new Date()[_0x4a69a5(0x91)](),await writeBffLockFile(_0x22fbd7[_0x4a69a5(0x96)],_0x2cc57f);const _0x1dc5b5=resolveLocalFilePathFromLockKey(_0x22fbd7,_0x39fdf0);let _0x57a9f4;await fileExists(_0x1dc5b5)&&(_0x57a9f4=await moveToTrash(_0x22fbd7[_0x4a69a5(0x9a)],_0x22fbd7['trashDir'],_0x1dc5b5),await cleanupEmptyDirectories(dirname(_0x1dc5b5),_0x22fbd7[_0x4a69a5(0x92)]));await waitForDeleteSettlement(_0x22fbd7[_0x4a69a5(0x96)],_0x15bed0['appCode'],_0x39fdf0,_0x1dc5b5),await sleep(0x96);const _0x52810d={'deleted':_0x39fdf0,'remoteId':_0x5c0984[_0x4a69a5(0x94)]};if(_0x57a9f4)_0x52810d[_0x4a69a5(0xab)]=_0x57a9f4;return{'ok':!![],'data':_0x52810d,'message':'Deleted\x20'+_0x39fdf0+(_0x57a9f4?_0x4a69a5(0xaa):'')};}};function resolveDeleteTarget(_0x49df88,_0x39478e){const _0x1d59ac=a32_0x517e9a;if(_0x49df88['includes']('/')){const _0x7e77aa=_0x39478e[_0x1d59ac(0x93)](_0xa4b357=>_0xa4b357===_0x49df88);if(!_0x7e77aa)throw CliErrors['validation'](_0x1d59ac(0xaf)+_0x49df88);return _0x7e77aa;}const _0x52a372=_0x39478e[_0x1d59ac(0xa8)](_0x8b775c=>_0x8b775c[_0x1d59ac(0xa5)]('/')['at'](-0x1)===_0x49df88);if(_0x52a372[_0x1d59ac(0xbd)]===0x0)throw CliErrors[_0x1d59ac(0xa2)](_0x1d59ac(0xaf)+_0x49df88);if(_0x52a372['length']>0x1)throw CliErrors[_0x1d59ac(0xa2)](_0x1d59ac(0x9b)+_0x49df88+'\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a'+_0x52a372[_0x1d59ac(0xb0)](_0x4f9049=>_0x1d59ac(0xbb)+_0x4f9049)[_0x1d59ac(0xc3)]('\x0a'));return _0x52a372[0x0];}function a32_0x36d5(_0xa1a36b,_0x2ae7ee){_0xa1a36b=_0xa1a36b-0x91;const _0x23b751=a32_0x23b7();let _0x36d592=_0x23b751[_0xa1a36b];return _0x36d592;}async function moveToTrash(_0x50de11,_0x5cb579,_0xa9f50b){const _0x5adb0d=a32_0x517e9a,_0x368eb8=new Date()[_0x5adb0d(0x91)]()[_0x5adb0d(0xad)](/[:.]/g,'-'),_0x50cf74=relative(_0x50de11,_0xa9f50b),_0x36b3d9=join(_0x5cb579,_0x368eb8,_0x50cf74);return await mkdir(dirname(_0x36b3d9),{'recursive':!![]}),await rename(_0xa9f50b,_0x36b3d9),_0x36b3d9;}async function cleanupEmptyDirectories(_0xa11f0e,_0x3c26f7){const _0xc3e33d=a32_0x517e9a;let _0x22463c=resolve(_0xa11f0e);const _0x98e95f=resolve(_0x3c26f7);while(_0x22463c['startsWith'](''+_0x98e95f+sep)||_0x22463c===_0x98e95f){if(_0x22463c===_0x98e95f)return;try{const _0x579c80=await readdir(_0x22463c);if(_0x579c80[_0xc3e33d(0xbd)]>0x0)return;await rmdir(_0x22463c);}catch{return;}_0x22463c=dirname(_0x22463c);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x537a6a,_0x29b1e3,_0x54cec3,_0x395e66){const _0x3d39cd=a32_0x517e9a;for(let _0x5bda7c=0x0;_0x5bda7c<DELETE_SETTLE_RETRY_COUNT;_0x5bda7c+=0x1){const _0x564cd6=await readBffLockFile(_0x537a6a),_0x31623c=!!_0x564cd6?.[_0x3d39cd(0xac)]?.[_0x29b1e3]?.[_0x3d39cd(0x9e)]?.[_0x54cec3],_0x3ec624=await fileExists(_0x395e66);if(!_0x31623c&&!_0x3ec624)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x3d39cd(0xb9)+_0x54cec3+'.');}
1
+ const a37_0x56f779=a37_0x3c64;(function(_0x4c43d7,_0x34b4ad){const _0x13f3d3=a37_0x3c64,_0x185d30=_0x4c43d7();while(!![]){try{const _0x39497c=-parseInt(_0x13f3d3(0xf1))/0x1*(-parseInt(_0x13f3d3(0x10f))/0x2)+parseInt(_0x13f3d3(0x106))/0x3*(-parseInt(_0x13f3d3(0xdc))/0x4)+parseInt(_0x13f3d3(0xe2))/0x5*(parseInt(_0x13f3d3(0xda))/0x6)+-parseInt(_0x13f3d3(0xfa))/0x7*(-parseInt(_0x13f3d3(0x10b))/0x8)+-parseInt(_0x13f3d3(0xf4))/0x9*(-parseInt(_0x13f3d3(0xea))/0xa)+-parseInt(_0x13f3d3(0xf6))/0xb*(parseInt(_0x13f3d3(0xe5))/0xc)+-parseInt(_0x13f3d3(0x10a))/0xd;if(_0x39497c===_0x34b4ad)break;else _0x185d30['push'](_0x185d30['shift']());}catch(_0x1c2af6){_0x185d30['push'](_0x185d30['shift']());}}}(a37_0x4111,0x4e2f4));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';function a37_0x4111(){const _0x358599=['split','trashDir','Multiple\x20functions\x20match\x20\x22','trashedTo','2214SxfSwM','delete','644aZmbPV','<timestamp>','Backend\x20Function\x20lock\x20file\x20not\x20found.','startsWith','\x20\x20-\x20','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','5575ROlYtw','toISOString','Local\x20delete\x20not\x20settled\x20for\x20','12kxOBvQ','POST','includes','str','validation','4017200YfiGQF','Lock\x20scope\x20for\x20app\x20\x22','apps','target','join','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','scriptsRoot','17SmZeDH','appCode','scriptsRootDir','9YemWbO','map','2439041PatzHL','functions','lockFilePath','find','7KZrUaY','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','parse','replace','/api/management/library/scripts/delete','keys','\x22\x20not\x20found\x20after\x20ensureLockScope.','projectRoot','remoteId','No\x20lock\x20entry\x20found\x20for\x20\x22','string','Function\x20not\x20found:\x20','10623MHCnDM','Would\x20delete\x20','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','lastSync','6655805tjmDqX','3235216QPiMft','\x20(local\x20file\x20moved\x20to\x20trash)','high-risk-write','bff','47824JFUWFE'];a37_0x4111=function(){return _0x358599;};return a37_0x4111();}export const bffDelete={'service':a37_0x56f779(0x10e),'command':'delete','description':a37_0x56f779(0xef),'risk':a37_0x56f779(0x10d),'flags':[{'name':a37_0x56f779(0xed),'type':a37_0x56f779(0x104),'required':!![],'description':'Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'}],async 'validate'(_0x1295fe){const _0x31d29d=a37_0x56f779,_0x42bb55=loadBffProjectConfig(_0x1295fe['appCode']),_0x3224d1=await readBffLockFile(_0x42bb55[_0x31d29d(0xf8)]);if(!_0x3224d1)throw CliErrors[_0x31d29d(0xe9)](_0x31d29d(0xe1));},async 'dryRun'(_0x318631){const _0x10df36=a37_0x56f779,_0x3eab9e=loadBffProjectConfig(_0x318631[_0x10df36(0xf2)]),_0x4a7d6b=await readBffLockFile(_0x3eab9e['lockFilePath']);if(!_0x4a7d6b)throw CliErrors['validation'](_0x10df36(0xde));const {appLock:_0x515572}=ensureLockScope(_0x4a7d6b,_0x318631[_0x10df36(0xf2)],_0x3eab9e[_0x10df36(0xf0)],_0x10df36(0xdb)),_0x268ca2=_0x318631[_0x10df36(0xe8)](_0x10df36(0xed)),_0x2d2b60=Object[_0x10df36(0xff)](_0x515572[_0x10df36(0xf7)]),_0x3488ad=resolveDeleteTarget(_0x268ca2,_0x2d2b60),_0xe05935=_0x515572[_0x10df36(0xf7)][_0x3488ad];if(!_0xe05935)throw CliErrors['validation'](_0x10df36(0x103)+_0x3488ad+'\x22.');const _0x3aa5be=resolveLocalFilePathFromLockKey(_0x3eab9e,_0x3488ad),_0x2bd29e=relative(_0x3eab9e[_0x10df36(0x101)],_0x3aa5be),_0x21eb35=join(_0x3eab9e[_0x10df36(0x111)],_0x10df36(0xdd),_0x2bd29e);return{'method':_0x10df36(0xe6),'url':_0x10df36(0xfe),'body':{'appCode':_0x318631['appCode'],'target':_0x3488ad,'remoteId':_0xe05935['remoteId'],'localFilePath':_0x3aa5be,'trashedPath':_0x21eb35},'description':_0x10df36(0x107)+_0x3488ad+_0x10df36(0xfb)};},async 'execute'(_0xaedb04){const _0x102b1a=a37_0x56f779,_0x41a8c0=loadBffProjectConfig(_0xaedb04[_0x102b1a(0xf2)]),_0x5b57f0=await readBffLockFile(_0x41a8c0[_0x102b1a(0xf8)]);if(!_0x5b57f0)throw CliErrors[_0x102b1a(0xe9)](_0x102b1a(0xde));const {lockData:_0x49ffe5,appLock:_0x3ada8e}=ensureLockScope(_0x5b57f0,_0xaedb04[_0x102b1a(0xf2)],_0x41a8c0[_0x102b1a(0xf0)],_0x102b1a(0xdb)),_0x23531c=JSON[_0x102b1a(0xfc)](JSON['stringify'](_0x49ffe5)),_0x39980d=_0x23531c[_0x102b1a(0xec)][_0xaedb04['appCode']];if(!_0x39980d)throw new Error(_0x102b1a(0xeb)+_0xaedb04[_0x102b1a(0xf2)]+_0x102b1a(0x100));const _0x4a7542=_0xaedb04[_0x102b1a(0xe8)](_0x102b1a(0xed)),_0x57460e=Object[_0x102b1a(0xff)](_0x39980d[_0x102b1a(0xf7)]),_0x560d20=resolveDeleteTarget(_0x4a7542,_0x57460e),_0x5ecfef=_0x39980d['functions'][_0x560d20];if(!_0x5ecfef)throw CliErrors[_0x102b1a(0xe9)](_0x102b1a(0x103)+_0x560d20+'\x22.');await deleteBffScript(_0x5ecfef['remoteId']),delete _0x39980d['functions'][_0x560d20],_0x39980d[_0x102b1a(0x109)]=new Date()[_0x102b1a(0xe3)](),await writeBffLockFile(_0x41a8c0[_0x102b1a(0xf8)],_0x23531c);const _0x2ed96c=resolveLocalFilePathFromLockKey(_0x41a8c0,_0x560d20);let _0x50b5e2;await fileExists(_0x2ed96c)&&(_0x50b5e2=await moveToTrash(_0x41a8c0[_0x102b1a(0x101)],_0x41a8c0[_0x102b1a(0x111)],_0x2ed96c),await cleanupEmptyDirectories(dirname(_0x2ed96c),_0x41a8c0[_0x102b1a(0xf3)]));await waitForDeleteSettlement(_0x41a8c0[_0x102b1a(0xf8)],_0xaedb04[_0x102b1a(0xf2)],_0x560d20,_0x2ed96c),await sleep(0x96);const _0x1600a3={'deleted':_0x560d20,'remoteId':_0x5ecfef[_0x102b1a(0x102)]};if(_0x50b5e2)_0x1600a3[_0x102b1a(0x113)]=_0x50b5e2;return{'ok':!![],'data':_0x1600a3,'message':'Deleted\x20'+_0x560d20+(_0x50b5e2?_0x102b1a(0x10c):'')};}};function a37_0x3c64(_0x235da1,_0x532af3){_0x235da1=_0x235da1-0xda;const _0x411180=a37_0x4111();let _0x3c649b=_0x411180[_0x235da1];return _0x3c649b;}function resolveDeleteTarget(_0x1ca24c,_0x239264){const _0x28e5f0=a37_0x56f779;if(_0x1ca24c[_0x28e5f0(0xe7)]('/')){const _0x21bd55=_0x239264[_0x28e5f0(0xf9)](_0x307e73=>_0x307e73===_0x1ca24c);if(!_0x21bd55)throw CliErrors[_0x28e5f0(0xe9)](_0x28e5f0(0x105)+_0x1ca24c);return _0x21bd55;}const _0x4dc66f=_0x239264['filter'](_0x51f745=>_0x51f745[_0x28e5f0(0x110)]('/')['at'](-0x1)===_0x1ca24c);if(_0x4dc66f['length']===0x0)throw CliErrors[_0x28e5f0(0xe9)](_0x28e5f0(0x105)+_0x1ca24c);if(_0x4dc66f['length']>0x1)throw CliErrors[_0x28e5f0(0xe9)](_0x28e5f0(0x112)+_0x1ca24c+_0x28e5f0(0x108)+_0x4dc66f[_0x28e5f0(0xf5)](_0x559cda=>_0x28e5f0(0xe0)+_0x559cda)[_0x28e5f0(0xee)]('\x0a'));return _0x4dc66f[0x0];}async function moveToTrash(_0x46f4db,_0x29cbce,_0x237bcf){const _0x54da01=a37_0x56f779,_0x4b8709=new Date()['toISOString']()[_0x54da01(0xfd)](/[:.]/g,'-'),_0x19446c=relative(_0x46f4db,_0x237bcf),_0x55987f=join(_0x29cbce,_0x4b8709,_0x19446c);return await mkdir(dirname(_0x55987f),{'recursive':!![]}),await rename(_0x237bcf,_0x55987f),_0x55987f;}async function cleanupEmptyDirectories(_0xaefdbb,_0xc75540){const _0x3d9063=a37_0x56f779;let _0x2d2115=resolve(_0xaefdbb);const _0x4de05c=resolve(_0xc75540);while(_0x2d2115[_0x3d9063(0xdf)](''+_0x4de05c+sep)||_0x2d2115===_0x4de05c){if(_0x2d2115===_0x4de05c)return;try{const _0x68c960=await readdir(_0x2d2115);if(_0x68c960['length']>0x0)return;await rmdir(_0x2d2115);}catch{return;}_0x2d2115=dirname(_0x2d2115);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x1152ad,_0xd029ed,_0x735f64,_0x33bc95){const _0x137c02=a37_0x56f779;for(let _0x189bae=0x0;_0x189bae<DELETE_SETTLE_RETRY_COUNT;_0x189bae+=0x1){const _0x2c2f67=await readBffLockFile(_0x1152ad),_0x18818b=!!_0x2c2f67?.[_0x137c02(0xec)]?.[_0xd029ed]?.['functions']?.[_0x735f64],_0x3927af=await fileExists(_0x33bc95);if(!_0x18818b&&!_0x3927af)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x137c02(0xe4)+_0x735f64+'.');}
@@ -1 +1 @@
1
- const a33_0x4449b2=a33_0x34c9;function a33_0x34c9(_0x1fee83,_0x33d3c5){_0x1fee83=_0x1fee83-0x13d;const _0x182bc5=a33_0x182b();let _0x34c98a=_0x182bc5[_0x1fee83];return _0x34c98a;}(function(_0x36ae91,_0x4b28f9){const _0x3ebff4=a33_0x34c9,_0x1937df=_0x36ae91();while(!![]){try{const _0x341767=-parseInt(_0x3ebff4(0x14a))/0x1+-parseInt(_0x3ebff4(0x14f))/0x2*(-parseInt(_0x3ebff4(0x13e))/0x3)+-parseInt(_0x3ebff4(0x147))/0x4+parseInt(_0x3ebff4(0x143))/0x5+parseInt(_0x3ebff4(0x146))/0x6+parseInt(_0x3ebff4(0x13d))/0x7+parseInt(_0x3ebff4(0x144))/0x8*(-parseInt(_0x3ebff4(0x151))/0x9);if(_0x341767===_0x4b28f9)break;else _0x1937df['push'](_0x1937df['shift']());}catch(_0x120991){_0x1937df['push'](_0x1937df['shift']());}}}(a33_0x182b,0xa213e));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a33_0x4449b2(0x154),'command':a33_0x4449b2(0x14d),'description':a33_0x4449b2(0x149),'risk':'read','flags':[{'name':'id','type':a33_0x4449b2(0x141),'required':!![],'description':a33_0x4449b2(0x14e)},{'name':a33_0x4449b2(0x152),'type':'boolean','description':a33_0x4449b2(0x145)}],async 'execute'(_0x424ee3){const _0x4071d7=a33_0x4449b2,_0x37c2ca=await getBffScriptInfo(_0x424ee3['num']('id')),_0x6a26df=_0x424ee3[_0x4071d7(0x14b)](_0x4071d7(0x152));if(_0x6a26df)return{'ok':!![],'data':_0x37c2ca};return{'ok':!![],'data':{'id':_0x37c2ca['id'],'functionName':_0x37c2ca[_0x4071d7(0x140)]??'','version':_0x37c2ca[_0x4071d7(0x142)]??'','updateUserName':_0x37c2ca[_0x4071d7(0x150)]??'','appCode':_0x37c2ca[_0x4071d7(0x148)],'scriptType':_0x37c2ca[_0x4071d7(0x153)],'description':_0x37c2ca['description']||'(none)','createdTime':_0x37c2ca['createdTime']??'','updatedTime':_0x37c2ca[_0x4071d7(0x13f)]??'','scriptContent':_0x37c2ca[_0x4071d7(0x14c)]??''}};}};function a33_0x182b(){const _0x2534bc=['bool','scriptContent','detail','Script\x20ID','26CryacB','updateUserName','9yXuGTE','verbose','scriptType','bff','5240900bmZUjL','11334jidOQC','updatedTime','functionName','number','version','2874450sKUfoL','2312176tBISlN','Return\x20full\x20raw\x20script\x20object','3810012kkDZjQ','3216148FPfYMp','appCode','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','250777gNaxYr'];a33_0x182b=function(){return _0x2534bc;};return a33_0x182b();}
1
+ const a38_0x198170=a38_0x4524;(function(_0x50ca6a,_0x39f2f2){const _0x59c77b=a38_0x4524,_0xd74c6b=_0x50ca6a();while(!![]){try{const _0x9aeab3=parseInt(_0x59c77b(0xc9))/0x1*(parseInt(_0x59c77b(0xd3))/0x2)+-parseInt(_0x59c77b(0xc7))/0x3+parseInt(_0x59c77b(0xd4))/0x4*(-parseInt(_0x59c77b(0xd0))/0x5)+-parseInt(_0x59c77b(0xca))/0x6*(parseInt(_0x59c77b(0xbd))/0x7)+-parseInt(_0x59c77b(0xc2))/0x8*(parseInt(_0x59c77b(0xba))/0x9)+parseInt(_0x59c77b(0xc4))/0xa*(-parseInt(_0x59c77b(0xc5))/0xb)+parseInt(_0x59c77b(0xc1))/0xc;if(_0x9aeab3===_0x39f2f2)break;else _0xd74c6b['push'](_0xd74c6b['shift']());}catch(_0x11f9ce){_0xd74c6b['push'](_0xd74c6b['shift']());}}}(a38_0x34ea,0x3f914));import{getBffScriptInfo}from'../../core/api-client.js';function a38_0x34ea(){const _0x243645=['Script\x20ID','7dPXzdW','bff','appCode','Return\x20full\x20raw\x20script\x20object','24251496ONMjDQ','1112oCBwLq','read','10220NRLwtq','5049uqaZeD','scriptType','696510nCtUbi','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','9886jMTyWq','2371866Kmbcmh','(none)','verbose','scriptContent','detail','updatedTime','1229230biEdsR','boolean','description','38Lrowik','8wsKQvn','23319ZhejIk','updateUserName'];a38_0x34ea=function(){return _0x243645;};return a38_0x34ea();}function a38_0x4524(_0x185a98,_0x309ef6){_0x185a98=_0x185a98-0xba;const _0x34eae2=a38_0x34ea();let _0x45240b=_0x34eae2[_0x185a98];return _0x45240b;}export const bffDetail={'service':a38_0x198170(0xbe),'command':a38_0x198170(0xce),'description':a38_0x198170(0xc8),'risk':a38_0x198170(0xc3),'flags':[{'name':'id','type':'number','required':!![],'description':a38_0x198170(0xbc)},{'name':a38_0x198170(0xcc),'type':a38_0x198170(0xd1),'description':a38_0x198170(0xc0)}],async 'execute'(_0x26f7ab){const _0x5783b9=a38_0x198170,_0x4bbf93=await getBffScriptInfo(_0x26f7ab['num']('id')),_0x1a5217=_0x26f7ab['bool'](_0x5783b9(0xcc));if(_0x1a5217)return{'ok':!![],'data':_0x4bbf93};return{'ok':!![],'data':{'id':_0x4bbf93['id'],'functionName':_0x4bbf93['functionName']??'','version':_0x4bbf93['version']??'','updateUserName':_0x4bbf93[_0x5783b9(0xbb)]??'','appCode':_0x4bbf93[_0x5783b9(0xbf)],'scriptType':_0x4bbf93[_0x5783b9(0xc6)],'description':_0x4bbf93[_0x5783b9(0xd2)]||_0x5783b9(0xcb),'createdTime':_0x4bbf93['createdTime']??'','updatedTime':_0x4bbf93[_0x5783b9(0xcf)]??'','scriptContent':_0x4bbf93[_0x5783b9(0xcd)]??''}};}};
@@ -1 +1 @@
1
- (function(_0x1369da,_0x3568be){const _0x299104=a34_0xeb9e,_0xf12ebb=_0x1369da();while(!![]){try{const _0x5a4bb0=-parseInt(_0x299104(0x1e0))/0x1+parseInt(_0x299104(0x1e8))/0x2*(parseInt(_0x299104(0x1e7))/0x3)+parseInt(_0x299104(0x1e5))/0x4*(parseInt(_0x299104(0x1de))/0x5)+parseInt(_0x299104(0x1df))/0x6+-parseInt(_0x299104(0x1e2))/0x7*(parseInt(_0x299104(0x1e3))/0x8)+parseInt(_0x299104(0x1e1))/0x9*(-parseInt(_0x299104(0x1e4))/0xa)+-parseInt(_0x299104(0x1e6))/0xb;if(_0x5a4bb0===_0x3568be)break;else _0xf12ebb['push'](_0xf12ebb['shift']());}catch(_0x13335f){_0xf12ebb['push'](_0xf12ebb['shift']());}}}(a34_0x251f,0xb493b));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 a34_0xeb9e(_0x242ee3,_0x468ee5){_0x242ee3=_0x242ee3-0x1de;const _0x251f7a=a34_0x251f();let _0xeb9e0b=_0x251f7a[_0x242ee3];return _0xeb9e0b;}function a34_0x251f(){const _0x3667d4=['8FMHbWp','1647250RXQLfX','486wOLaCM','5666EuGUlH','2282815EDzkIS','8439036DwkcMT','35253CiwrVo','36216uZYvNw','102270mTWndA','656lbuFAp','1630SRTQfN'];a34_0x251f=function(){return _0x3667d4;};return a34_0x251f();}import{bffDelete}from'../../commands/bff/delete.js';export const bffDefinitions=[bffList,bffDetail,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
1
+ function a39_0x9222(_0x520d90,_0x502382){_0x520d90=_0x520d90-0xa8;const _0x5eb146=a39_0x5eb1();let _0x9222c=_0x5eb146[_0x520d90];return _0x9222c;}(function(_0x2a3605,_0x3b4e15){const _0x33a88b=a39_0x9222,_0xc8698c=_0x2a3605();while(!![]){try{const _0x401808=-parseInt(_0x33a88b(0xaf))/0x1*(-parseInt(_0x33a88b(0xb1))/0x2)+parseInt(_0x33a88b(0xa9))/0x3*(-parseInt(_0x33a88b(0xb0))/0x4)+parseInt(_0x33a88b(0xad))/0x5+parseInt(_0x33a88b(0xac))/0x6+-parseInt(_0x33a88b(0xa8))/0x7+parseInt(_0x33a88b(0xaa))/0x8*(parseInt(_0x33a88b(0xab))/0x9)+parseInt(_0x33a88b(0xae))/0xa*(-parseInt(_0x33a88b(0xb2))/0xb);if(_0x401808===_0x3b4e15)break;else _0xc8698c['push'](_0xc8698c['shift']());}catch(_0x4b9cca){_0xc8698c['push'](_0xc8698c['shift']());}}}(a39_0x5eb1,0xea65d));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';function a39_0x5eb1(){const _0x2bcd15=['1268FSmjSU','144016fDhtBi','2407922nkUuqx','699881RINPzK','17742TckRim','3228256vlhhhk','18bQgtvQ','5033346DVPDvg','2498245LUYfPl','10GtbzbC','14mwNdfU'];a39_0x5eb1=function(){return _0x2bcd15;};return a39_0x5eb1();}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';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 a35_0x257e14=a35_0x587f;(function(_0x1fba2c,_0x4984fc){const _0x36d227=a35_0x587f,_0x3da103=_0x1fba2c();while(!![]){try{const _0x4806f7=-parseInt(_0x36d227(0x199))/0x1*(-parseInt(_0x36d227(0x19c))/0x2)+-parseInt(_0x36d227(0x1a3))/0x3+parseInt(_0x36d227(0x1a0))/0x4*(parseInt(_0x36d227(0x1a1))/0x5)+-parseInt(_0x36d227(0x195))/0x6*(parseInt(_0x36d227(0x198))/0x7)+parseInt(_0x36d227(0x197))/0x8+parseInt(_0x36d227(0x1a2))/0x9*(-parseInt(_0x36d227(0x1a9))/0xa)+-parseInt(_0x36d227(0x19a))/0xb*(parseInt(_0x36d227(0x1a8))/0xc);if(_0x4806f7===_0x4984fc)break;else _0x3da103['push'](_0x3da103['shift']());}catch(_0x17c8f3){_0x3da103['push'](_0x3da103['shift']());}}}(a35_0x107d,0x50810));import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':'bff','command':a35_0x257e14(0x194),'description':'List\x20Backend\x20Function\x20scripts','risk':a35_0x257e14(0x191),'flags':[{'name':a35_0x257e14(0x19e),'type':a35_0x257e14(0x1a4),'description':'Script\x20type\x20filter','default':'ENDPOINT','enum':['ENDPOINT',a35_0x257e14(0x1a5)]},{'name':a35_0x257e14(0x190),'type':a35_0x257e14(0x1a4),'description':'Filter\x20by\x20script\x20name'},{'name':a35_0x257e14(0x192),'type':a35_0x257e14(0x19b),'description':a35_0x257e14(0x19f)}],async 'execute'(_0x271046){const _0x5cd743=a35_0x257e14,_0x5e91fd=await listBffScripts(_0x271046[_0x5cd743(0x196)],_0x271046[_0x5cd743(0x18e)]('type'),{'scriptName':_0x271046['str'](_0x5cd743(0x190))||undefined}),_0x104563=_0x271046[_0x5cd743(0x193)](_0x5cd743(0x192));return{'ok':!![],'data':_0x104563?_0x5e91fd:_0x5e91fd['map'](_0xe681b1=>({'id':_0xe681b1['id'],'functionName':_0xe681b1[_0x5cd743(0x18f)]??'','description':_0xe681b1['description']||_0x5cd743(0x1a7),'scriptType':_0xe681b1['scriptType']})),'message':_0x5e91fd[_0x5cd743(0x1a6)]===0x0?_0x5cd743(0x19d):undefined};}};function a35_0x587f(_0x39438b,_0x1ba5f4){_0x39438b=_0x39438b-0x18e;const _0x107de9=a35_0x107d();let _0x587f12=_0x107de9[_0x39438b];return _0x587f12;}function a35_0x107d(){const _0x2a3f61=['verbose','bool','list','27834EOOQRH','appCode','1642912TuAkCV','364KnWUOk','9971dGeFfh','6644LlAgoc','boolean','122DuMGMb','No\x20Backend\x20Function\x20scripts\x20found.','type','Return\x20full\x20script\x20objects','1470252NxCSKb','5kFCbyl','279iNIwtE','43770bWQEsU','string','COMMON','length','(unnamed)','9840Ytxgvn','32360ibNocU','str','functionName','name','read'];a35_0x107d=function(){return _0x2a3f61;};return a35_0x107d();}
1
+ const a40_0x51e2c4=a40_0x4c0a;function a40_0x4b7c(){const _0x27bea1=['COMMON','14TDonqI','19997lckLBf','type','No\x20Backend\x20Function\x20scripts\x20found.','scriptType','str','bff','4053310zOkoKp','ENDPOINT','functionName','Script\x20type\x20filter','544QxBPdS','1145064CXlWHj','appCode','verbose','string','9tCUbFJ','map','bool','name','329235pqGrVP','5529UjJClE','description','length','read','164790smMwom','1447439oEXbHT','(unnamed)'];a40_0x4b7c=function(){return _0x27bea1;};return a40_0x4b7c();}(function(_0x3c2d6f,_0x136069){const _0xae0ef3=a40_0x4c0a,_0x1ff426=_0x3c2d6f();while(!![]){try{const _0x4d6205=-parseInt(_0xae0ef3(0x187))/0x1*(parseInt(_0xae0ef3(0x186))/0x2)+-parseInt(_0xae0ef3(0x17e))/0x3*(-parseInt(_0xae0ef3(0x174))/0x4)+-parseInt(_0xae0ef3(0x17d))/0x5+parseInt(_0xae0ef3(0x182))/0x6+-parseInt(_0xae0ef3(0x183))/0x7+-parseInt(_0xae0ef3(0x175))/0x8*(parseInt(_0xae0ef3(0x179))/0x9)+parseInt(_0xae0ef3(0x170))/0xa;if(_0x4d6205===_0x136069)break;else _0x1ff426['push'](_0x1ff426['shift']());}catch(_0x2f658e){_0x1ff426['push'](_0x1ff426['shift']());}}}(a40_0x4b7c,0x1f2dc));import{listBffScripts}from'../../core/api-client.js';function a40_0x4c0a(_0x30481f,_0x21e617){_0x30481f=_0x30481f-0x16f;const _0x4b7ce6=a40_0x4b7c();let _0x4c0a7f=_0x4b7ce6[_0x30481f];return _0x4c0a7f;}export const bffList={'service':a40_0x51e2c4(0x16f),'command':'list','description':'List\x20Backend\x20Function\x20scripts','risk':a40_0x51e2c4(0x181),'flags':[{'name':a40_0x51e2c4(0x188),'type':a40_0x51e2c4(0x178),'description':a40_0x51e2c4(0x173),'default':a40_0x51e2c4(0x171),'enum':[a40_0x51e2c4(0x171),a40_0x51e2c4(0x185)]},{'name':a40_0x51e2c4(0x17c),'type':'string','description':'Filter\x20by\x20script\x20name'},{'name':a40_0x51e2c4(0x177),'type':'boolean','description':'Return\x20full\x20script\x20objects'}],async 'execute'(_0x3fc0a2){const _0x55b49d=a40_0x51e2c4,_0x2c6bc3=await listBffScripts(_0x3fc0a2[_0x55b49d(0x176)],_0x3fc0a2[_0x55b49d(0x18b)](_0x55b49d(0x188)),{'scriptName':_0x3fc0a2[_0x55b49d(0x18b)]('name')||undefined}),_0x58ec7f=_0x3fc0a2[_0x55b49d(0x17b)](_0x55b49d(0x177));return{'ok':!![],'data':_0x58ec7f?_0x2c6bc3:_0x2c6bc3[_0x55b49d(0x17a)](_0x611feb=>({'id':_0x611feb['id'],'functionName':_0x611feb[_0x55b49d(0x172)]??'','description':_0x611feb[_0x55b49d(0x17f)]||_0x55b49d(0x184),'scriptType':_0x611feb[_0x55b49d(0x18a)]})),'message':_0x2c6bc3[_0x55b49d(0x180)]===0x0?_0x55b49d(0x189):undefined};}};
@@ -0,0 +1,7 @@
1
+ import { type BffScriptLogQuery } from "../../core/api-client.js";
2
+ import type { CommandDefinition, RuntimeContext } from "../../framework/types.js";
3
+ export interface ResolvedBffLogQuery extends BffScriptLogQuery {
4
+ sinceMinutes?: number;
5
+ }
6
+ export declare function resolveBffLogQuery(ctx: RuntimeContext, now?: number): ResolvedBffLogQuery;
7
+ export declare const bffLogs: CommandDefinition;
@@ -0,0 +1 @@
1
+ function a41_0x15cc(){const _0x1ed1c6=['DEBUG','--start-time','2950EajpGV','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','\x20must\x20be\x20a\x20positive\x20integer.','12rGuxAm','6324nErSWs','str','flag','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','logs','Maximum\x20log\x20lines\x20to\x20return\x20(1-','length','num','714411NFSOWm','ERROR','bff','--limit','408787GlTMIZ','keyword','read','--end-time','6lscWlt','validation','9091918tmxFFK','Filter\x20by\x20log\x20level','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','limit','number','--since','trim','1931661DrXuTc','toUpperCase','end-time','6dJTSLs','24lgDjhd','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','--limit\x20must\x20be\x20between\x201\x20and\x20','8030660zNXuBJ','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','start-time','since','now','917203taycyZ','level','WARN','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.'];a41_0x15cc=function(){return _0x1ed1c6;};return a41_0x15cc();}const a41_0x49885b=a41_0x1de7;(function(_0x62ba7e,_0x41c974){const _0xfb1494=a41_0x1de7,_0x4c99fe=_0x62ba7e();while(!![]){try{const _0x43b190=-parseInt(_0xfb1494(0x1b8))/0x1+parseInt(_0xfb1494(0x1bc))/0x2*(-parseInt(_0xfb1494(0x1b4))/0x3)+parseInt(_0xfb1494(0x1ac))/0x4*(parseInt(_0xfb1494(0x1a8))/0x5)+-parseInt(_0xfb1494(0x1c8))/0x6*(-parseInt(_0xfb1494(0x1d1))/0x7)+parseInt(_0xfb1494(0x1c9))/0x8*(parseInt(_0xfb1494(0x1c5))/0x9)+parseInt(_0xfb1494(0x1cc))/0xa+-parseInt(_0xfb1494(0x1be))/0xb*(parseInt(_0xfb1494(0x1ab))/0xc);if(_0x43b190===_0x41c974)break;else _0x4c99fe['push'](_0x4c99fe['shift']());}catch(_0x4916dc){_0x4c99fe['push'](_0x4c99fe['shift']());}}}(a41_0x15cc,0x88f8c));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=[a41_0x49885b(0x1d5),'INFO',a41_0x49885b(0x1d3),a41_0x49885b(0x1b5)];export function resolveBffLogQuery(_0x1aefc4,_0x1f31b0=Date[a41_0x49885b(0x1d0)]()){const _0x167dff=a41_0x49885b,_0x303422=_0x1aefc4[_0x167dff(0x1ae)](_0x167dff(0x1cf)),_0x276643=_0x1aefc4[_0x167dff(0x1ae)](_0x167dff(0x1ce)),_0x4b00e7=_0x1aefc4[_0x167dff(0x1ae)](_0x167dff(0x1c7));if(_0x303422!==undefined&&_0x276643!==undefined)throw CliErrors['validation'](_0x167dff(0x1d4));const _0x4edd6b=_0x4b00e7===undefined?_0x1f31b0:readPositiveInteger(_0x1aefc4['num'](_0x167dff(0x1c7)),_0x167dff(0x1bb)),_0x1c45a8=_0x276643===undefined?_0x4edd6b-readSinceMinutes(_0x1aefc4)*0xea60:readPositiveInteger(_0x1aefc4[_0x167dff(0x1b3)](_0x167dff(0x1ce)),_0x167dff(0x1a7));if(_0x1c45a8<=0x0)throw CliErrors[_0x167dff(0x1bd)]('The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.');if(_0x1c45a8>_0x4edd6b)throw CliErrors[_0x167dff(0x1bd)](_0x167dff(0x1ca));const _0x3f9bf1=readPositiveInteger(_0x1aefc4[_0x167dff(0x1b3)](_0x167dff(0x1c1),DEFAULT_LIMIT),_0x167dff(0x1b7));if(_0x3f9bf1>MAX_LIMIT)throw CliErrors[_0x167dff(0x1bd)](_0x167dff(0x1cb)+MAX_LIMIT+'.');const _0x16afc1=_0x1aefc4['str'](_0x167dff(0x1d2))[_0x167dff(0x1c4)]()[_0x167dff(0x1c6)]()||undefined,_0x3d8fc3=_0x1aefc4[_0x167dff(0x1ad)](_0x167dff(0x1b9))[_0x167dff(0x1c4)]()||undefined;return{'appCode':_0x1aefc4['appCode'],'startTime':_0x1c45a8,'endTime':_0x4edd6b,..._0x276643===undefined?{'sinceMinutes':readSinceMinutes(_0x1aefc4)}:{},..._0x16afc1?{'level':_0x16afc1}:{},..._0x3d8fc3?{'keyword':_0x3d8fc3}:{},'limit':_0x3f9bf1};}function readSinceMinutes(_0x50956e){const _0x311af5=a41_0x49885b;return readPositiveInteger(_0x50956e['num'](_0x311af5(0x1cf),DEFAULT_SINCE_MINUTES),_0x311af5(0x1c3));}function a41_0x1de7(_0x35f28d,_0xa790cc){_0x35f28d=_0x35f28d-0x1a7;const _0x15ccb1=a41_0x15cc();let _0x1de78b=_0x15ccb1[_0x35f28d];return _0x1de78b;}function readPositiveInteger(_0x5a562f,_0x126504){const _0x1da2d4=a41_0x49885b;if(!Number['isSafeInteger'](_0x5a562f)||_0x5a562f<=0x0)throw CliErrors['validation'](_0x126504+_0x1da2d4(0x1aa));return _0x5a562f;}export const bffLogs={'service':a41_0x49885b(0x1b6),'command':a41_0x49885b(0x1b0),'description':a41_0x49885b(0x1af),'risk':a41_0x49885b(0x1ba),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a41_0x49885b(0x1cf),'type':a41_0x49885b(0x1c2),'description':a41_0x49885b(0x1cd)+DEFAULT_SINCE_MINUTES+')'},{'name':a41_0x49885b(0x1ce),'type':'number','description':'Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds'},{'name':a41_0x49885b(0x1c7),'type':a41_0x49885b(0x1c2),'description':a41_0x49885b(0x1a9)},{'name':'level','type':'string','description':a41_0x49885b(0x1bf),'enum':LOG_LEVELS},{'name':'keyword','type':'string','description':a41_0x49885b(0x1c0)},{'name':a41_0x49885b(0x1c1),'type':'number','description':a41_0x49885b(0x1b1)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x36e86e){resolveBffLogQuery(_0x36e86e);},async 'execute'(_0xc032ba){const _0x313862=a41_0x49885b,_0x4cdced=resolveBffLogQuery(_0xc032ba),{sinceMinutes:_0x3f2de0,..._0x297fe9}=_0x4cdced,_0x4bd60e=await searchBffScriptLogs(_0x297fe9);return{'ok':!![],'data':{'query':_0x4cdced,'count':_0x4bd60e['length'],'logs':_0x4bd60e},'message':_0x4bd60e[_0x313862(0x1b2)]===0x0?'No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.':'Found\x20'+_0x4bd60e[_0x313862(0x1b2)]+'\x20Backend\x20Function\x20log\x20line(s).'};}};
@@ -1 +1 @@
1
- function a36_0x5c01(){const _0x3abf24=['push','version','functionName','lockKey','hash','toISOString','\x22\x20not\x20found\x20after\x20ensureLockScope.','&type=','&currentPage=1&pageSize=','HOOK','lockFilePath','read','type','3608691oahMMb','nonInteractive','includes','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','str','scriptType','Would\x20inspect\x20','scriptContent','operationType','parse','datasetCode','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','hookLocation','42UBrQyA','36673101gBIpur','3394531djDniZ','Force\x20overwrite\x20local\x20unsynced\x20changes','Remote\x20script\x20missing\x20content.','length','\x20failed','unresolvable\x20target\x20path','message','pull','COMMON','GET','toLowerCase','Remote\x20script\x20missing\x20id.','3840596qAWkIA','\x20pulled,\x20','cancelled','bool','apiDir','1043485psEQdy','functionNode','functions','utf8','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','apps','skipped','Pull\x20complete:\x20','1460547KoCzLJ','string','appCode','lastSync','yes','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','filePath','validation','alias','all','8WQlRnt','would_pull','1210808ZxqUqM','Lock\x20scope\x20for\x20app\x20\x22','\x20skipped,\x20','Force\x20pull\x20cancelled.','boolean'];a36_0x5c01=function(){return _0x3abf24;};return a36_0x5c01();}const a36_0x35cd5f=a36_0x8baa;(function(_0x3f5ae9,_0x2ec244){const _0x380a3d=a36_0x8baa,_0x5a08c4=_0x3f5ae9();while(!![]){try{const _0x19cf68=-parseInt(_0x380a3d(0x19e))/0x1+-parseInt(_0x380a3d(0x1aa))/0x2+-parseInt(_0x380a3d(0x1bc))/0x3+-parseInt(_0x380a3d(0x191))/0x4+parseInt(_0x380a3d(0x196))/0x5*(parseInt(_0x380a3d(0x1c9))/0x6)+-parseInt(_0x380a3d(0x1cb))/0x7+parseInt(_0x380a3d(0x1a8))/0x8*(parseInt(_0x380a3d(0x1ca))/0x9);if(_0x19cf68===_0x2ec244)break;else _0x5a08c4['push'](_0x5a08c4['shift']());}catch(_0x26af0f){_0x5a08c4['push'](_0x5a08c4['shift']());}}}(a36_0x5c01,0xc89ea));import{createInterface}from'node:readline';import{writeFile}from'node:fs/promises';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,ensureParentDirectory,fileExists,normalizeBffType,resolveRemoteScriptTarget}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';export const bffPull={'service':'bff','command':'pull','description':a36_0x35cd5f(0x1a3),'risk':a36_0x35cd5f(0x1ba),'flags':[{'name':a36_0x35cd5f(0x1bb),'type':a36_0x35cd5f(0x19f),'description':'Pull\x20only\x20this\x20script\x20type','enum':[a36_0x35cd5f(0x18d),'ENDPOINT',a36_0x35cd5f(0x1b8)]},{'name':'force','type':a36_0x35cd5f(0x1ae),'description':a36_0x35cd5f(0x1cc)}],async 'dryRun'(_0xb51e63){const _0x39a27e=a36_0x35cd5f,_0xc877a0=loadBffProjectConfig(_0xb51e63[_0x39a27e(0x1a0)]),_0x56bb36=await readBffLockFile(_0xc877a0[_0x39a27e(0x1b9)]),{appLock:_0x539e01}=ensureLockScope(_0x56bb36??createEmptyBffLock(),_0xb51e63['appCode'],_0xc877a0['scriptsRoot'],_0x39a27e(0x18c)),_0x3e4c73=normalizeBffType(_0xb51e63[_0x39a27e(0x1c0)]('type'))??undefined,_0x20c163=buildDatasetCodeToAliasMap(_0xb51e63[_0x39a27e(0x195)],_0xb51e63[_0x39a27e(0x1a0)]),[_0x1b2edd,_0x16a5c4]=await Promise[_0x39a27e(0x1a7)]([listBffScripts(_0xb51e63['appCode'],_0x3e4c73),getBffScriptStatistics(_0xb51e63[_0x39a27e(0x1a0)])]),_0x22b27b=createHookLocationMap(_0x16a5c4),_0x56f330=[];for(const _0x2f3326 of _0x1b2edd){const _0x33e09b=resolveRemoteScriptTarget(_0xc877a0,_0x2f3326,_0x22b27b,_0x539e01[_0x39a27e(0x198)],_0x20c163);if(!_0x33e09b){_0x56f330[_0x39a27e(0x1af)]({'scriptType':_0x2f3326[_0x39a27e(0x1c1)],'functionName':_0x2f3326[_0x39a27e(0x1b1)]??'','status':_0x39a27e(0x19c),'reason':_0x39a27e(0x18a)});continue;}const _0x1f6189=_0x539e01[_0x39a27e(0x198)][_0x33e09b[_0x39a27e(0x1b2)]],_0x30e079=_0x2f3326[_0x39a27e(0x1c3)]!=null?computeContentHash(_0x2f3326[_0x39a27e(0x1c3)]):undefined,_0x225c13=await hasUnsyncedLocalChanges(_0x33e09b[_0x39a27e(0x1a4)],_0x1f6189,_0x30e079);_0x56f330[_0x39a27e(0x1af)]({'lockKey':_0x33e09b[_0x39a27e(0x1b2)],'filePath':_0x33e09b[_0x39a27e(0x1a4)],'remoteId':_0x2f3326['id']??null,'status':_0x225c13?'conflict':_0x39a27e(0x1a9)});}return{'method':_0x39a27e(0x18e),'url':'/api/management/library/scripts/list?appCode='+_0xb51e63[_0x39a27e(0x1a0)]+(_0x3e4c73?_0x39a27e(0x1b6)+_0x3e4c73:'')+_0x39a27e(0x1b7)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0xb51e63[_0x39a27e(0x1a0)],'filterType':_0x3e4c73??null,'files':_0x56f330},'description':_0x39a27e(0x1c2)+_0x56f330[_0x39a27e(0x1ce)]+_0x39a27e(0x19a)};},async 'execute'(_0x523919){const _0x443e81=a36_0x35cd5f,_0x68da63=loadBffProjectConfig(_0x523919['appCode']),_0x34d5c7=await readBffLockFile(_0x68da63['lockFilePath']),{lockData:_0x298c12,appLock:_0x271d19}=ensureLockScope(_0x34d5c7??createEmptyBffLock(),_0x523919[_0x443e81(0x1a0)],_0x68da63['scriptsRoot'],_0x443e81(0x18c)),_0x149f24=normalizeBffType(_0x523919['str'](_0x443e81(0x1bb)))??undefined;if(_0x523919[_0x443e81(0x1c0)]('type')&&!_0x149f24)throw CliErrors[_0x443e81(0x1a5)](_0x443e81(0x1bf));const [_0x517b34,_0x4ddaf3]=await Promise[_0x443e81(0x1a7)]([listBffScripts(_0x523919[_0x443e81(0x1a0)],_0x149f24),getBffScriptStatistics(_0x523919[_0x443e81(0x1a0)])]);if(_0x517b34[_0x443e81(0x1ce)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x127143=_0x523919[_0x443e81(0x194)]('force');if(_0x127143&&!_0x523919[_0x443e81(0x1bd)]){const _0x336a5b=await confirmForce();if(!_0x336a5b)throw CliErrors[_0x443e81(0x193)](_0x443e81(0x1ad));}if(_0x127143&&_0x523919[_0x443e81(0x1bd)]){}const _0x1adb88=buildDatasetCodeToAliasMap(_0x523919[_0x443e81(0x195)],_0x523919[_0x443e81(0x1a0)]),_0x1f9c47=createHookLocationMap(_0x4ddaf3),_0x431b09=JSON[_0x443e81(0x1c5)](JSON['stringify'](_0x298c12)),_0x30e838=_0x523919['appCode'],_0x36b33=_0x431b09[_0x443e81(0x19b)][_0x30e838];if(!_0x36b33)throw new Error(_0x443e81(0x1ab)+_0x30e838+_0x443e81(0x1b5));const _0x4e7b52=[],_0x20a467=[],_0x1300f9=[];for(const _0x3b22ef of _0x517b34){const _0x3a7a0a=resolveRemoteScriptTarget(_0x68da63,_0x3b22ef,_0x1f9c47,_0x271d19[_0x443e81(0x198)],_0x1adb88);if(!_0x3a7a0a){_0x20a467[_0x443e81(0x1af)]({'lockKey':_0x3b22ef[_0x443e81(0x1c1)]+'/'+_0x3b22ef['functionName'],'reason':_0x443e81(0x18a)});continue;}const _0x22278e=_0x271d19['functions'][_0x3a7a0a[_0x443e81(0x1b2)]];try{if(!_0x3b22ef['id'])throw new Error(_0x443e81(0x190));if(_0x3b22ef[_0x443e81(0x1c3)]==null)throw new Error(_0x443e81(0x1cd));const _0x4914c0=_0x3b22ef['scriptContent'],_0x2d4614=computeContentHash(_0x4914c0);if(!_0x127143){const _0x1a4989=await hasUnsyncedLocalChanges(_0x3a7a0a['filePath'],_0x22278e,_0x2d4614);if(_0x1a4989){_0x20a467[_0x443e81(0x1af)]({'lockKey':_0x3a7a0a[_0x443e81(0x1b2)],'reason':'local\x20unsynced\x20changes'});continue;}}await ensureParentDirectory(_0x3a7a0a[_0x443e81(0x1a4)]),await writeFile(_0x3a7a0a[_0x443e81(0x1a4)],_0x4914c0,_0x443e81(0x199));const _0x2c6c50={'hash':_0x2d4614,'remoteId':_0x3b22ef['id'],'version':_0x3b22ef[_0x443e81(0x1b0)]};_0x3a7a0a[_0x443e81(0x1bb)]===_0x443e81(0x1b8)&&_0x3a7a0a[_0x443e81(0x1c8)]&&(_0x2c6c50[_0x443e81(0x1a6)]=_0x3a7a0a[_0x443e81(0x1c8)][_0x443e81(0x1a6)],_0x2c6c50[_0x443e81(0x1c6)]=_0x3a7a0a[_0x443e81(0x1c8)][_0x443e81(0x1c6)],_0x2c6c50[_0x443e81(0x1c4)]=_0x3a7a0a[_0x443e81(0x1c8)][_0x443e81(0x1c4)],_0x2c6c50['functionNode']=_0x3a7a0a[_0x443e81(0x1c8)][_0x443e81(0x197)]),_0x36b33[_0x443e81(0x198)][_0x3a7a0a['lockKey']]=_0x2c6c50,_0x4e7b52[_0x443e81(0x1af)]({'lockKey':_0x3a7a0a['lockKey'],'remoteId':_0x3b22ef['id']});}catch(_0x5e77a9){_0x1300f9['push']({'lockKey':_0x3a7a0a['lockKey'],'error':_0x5e77a9 instanceof Error?_0x5e77a9[_0x443e81(0x18b)]:String(_0x5e77a9)});}}return _0x36b33[_0x443e81(0x1a1)]=new Date()[_0x443e81(0x1b4)](),await writeBffLockFile(_0x68da63['lockFilePath'],_0x431b09),{'ok':_0x1300f9[_0x443e81(0x1ce)]===0x0,'data':{'pulled':_0x4e7b52,'skipped':_0x20a467,'failed':_0x1300f9},'message':_0x443e81(0x19d)+_0x4e7b52[_0x443e81(0x1ce)]+_0x443e81(0x192)+_0x20a467[_0x443e81(0x1ce)]+_0x443e81(0x1ac)+_0x1300f9['length']+_0x443e81(0x1cf)};}};async function hasUnsyncedLocalChanges(_0x8f46ab,_0x3b34c1,_0x1e0eec){const _0x125dcf=a36_0x35cd5f;if(!await fileExists(_0x8f46ab))return![];const _0x27d204=await computeFileHash(_0x8f46ab);if(!_0x3b34c1)return _0x1e0eec?_0x27d204!==_0x1e0eec:!![];return _0x27d204!==_0x3b34c1[_0x125dcf(0x1b3)];}function a36_0x8baa(_0x3fd7da,_0x355d53){_0x3fd7da=_0x3fd7da-0x18a;const _0x5c01e2=a36_0x5c01();let _0x8baa23=_0x5c01e2[_0x3fd7da];return _0x8baa23;}function buildDatasetCodeToAliasMap(_0x2551be,_0x83480b){const _0x3b760e=a36_0x35cd5f,_0x4a5d75=loadAliasMap(_0x2551be,undefined,resolveApiFilePath(_0x2551be,_0x83480b));return new Map(_0x4a5d75['map'](_0xa79de=>[_0xa79de['datasetCode'],_0xa79de[_0x3b760e(0x1a6)]]));}async function confirmForce(){const _0x715ec8=a36_0x35cd5f,_0x4c9d12=createInterface({'input':process['stdin'],'output':process['stderr']}),_0x16a663=await new Promise(_0x4ac7f7=>{const _0x2769f2=a36_0x8baa;_0x4c9d12['question'](_0x2769f2(0x1c7),_0x4ac7f7);});return _0x4c9d12['close'](),['y',_0x715ec8(0x1a2)][_0x715ec8(0x1be)](_0x16a663['trim']()[_0x715ec8(0x18f)]());}
1
+ const a42_0x346709=a42_0x3677;(function(_0x14845d,_0x212d8b){const _0x4a95a6=a42_0x3677,_0x44b4d7=_0x14845d();while(!![]){try{const _0x63e061=parseInt(_0x4a95a6(0x169))/0x1+-parseInt(_0x4a95a6(0x10b))/0x2*(-parseInt(_0x4a95a6(0x146))/0x3)+parseInt(_0x4a95a6(0x117))/0x4+-parseInt(_0x4a95a6(0x112))/0x5*(-parseInt(_0x4a95a6(0x118))/0x6)+-parseInt(_0x4a95a6(0x17d))/0x7+parseInt(_0x4a95a6(0x14b))/0x8*(-parseInt(_0x4a95a6(0x11e))/0x9)+-parseInt(_0x4a95a6(0x134))/0xa;if(_0x63e061===_0x212d8b)break;else _0x44b4d7['push'](_0x44b4d7['shift']());}catch(_0x597bc2){_0x44b4d7['push'](_0x44b4d7['shift']());}}}(a42_0x4fd5,0xaa6cb));function a42_0x4fd5(){const _0x3c3915=['alias','rollback','boolean','functions','bool','remoteId','scriptType','\x20--name\x20','map','\x22:\x20','Force\x20overwrite\x20local\x20unsynced\x20changes','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','.hook-directory-migrate-','22hSQtIg','push','HOOK/','Pull\x20only\x20this\x20script\x20type','delete','filePath','stringify','5BmBAOB','datasetCode','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','\x20pulled','\x22:\x20both\x20target\x20\x22','1956324QaZZCZ','4153422HexpIp','hookLocation','appCode','keyChanges','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','HOOK','26127rRiaOy','code','type','\x20Recovery\x20errors:\x20','write','utf8','pull','NFC','dev','apps','oldDirectoryPath','\x22:\x20its\x20target\x20\x22','migrations','selectedAppName','all','Would\x20inspect\x20','oldLockKey','bff','some','\x22\x20not\x20found\x20after\x20ensureLockScope.','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','sourceDirectoryPathByNewDirectory','12919010aaQFNq','\x20conflict','str','newLockKey','require','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','length','ino','move','newDirectoryPath','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','toISOString','cancelled','Failed\x20to\x20write\x20local\x20script\x20\x22','parse','276063xdZyFC','&currentPage=1&pageSize=','\x22\x20to\x20\x22','lockKey','scriptContent','2776ncQskd','\x20--format\x20compress','mode','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','COMMON','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','scriptsRoot','would_pull','message','toLowerCase','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','apiDir','flatMap','nonInteractive','string','scriptsRootDir','skipped','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','content','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','split','\x22\x20and\x20\x22','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','mergedCli','profileName','close','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','lastSync','functionName','force','1374882ElyWzj','has','ENOENT','reverse','projectedFunctions','\x20bff\x20push\x20--type\x20','stdin','\x20failed','trim','sourceFilePathByNewLockKey','operationType','entry','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','Could\x20not\x20restore\x20local\x20script\x20\x22','read','question','.js','functionNode','currentApp','Force\x20pull\x20cancelled.','3997910EMHxTj','set','&type=','newDirectory','lockFilePath','case-rename','join','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','rekey','Lock\x20scope\x20for\x20app\x20\x22','existed','push_local','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','\x20resolution','Remote\x20script\x20missing\x20id.','unresolvable\x20target\x20path','requires','\x22\x20from\x20\x22','oldDirectory','includes','defaultApp','entries','get','validation','BFF_LOCAL_UNSYNCED'];a42_0x4fd5=function(){return _0x3c3915;};return a42_0x4fd5();}import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a42_0x346709(0x12f),'command':a42_0x346709(0x124),'description':'Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','risk':a42_0x346709(0x177),'structuredErrors':!![],'flags':[{'name':a42_0x346709(0x120),'type':a42_0x346709(0x159),'description':a42_0x346709(0x10e),'enum':[a42_0x346709(0x14f),'ENDPOINT','HOOK']},{'name':a42_0x346709(0x168),'type':a42_0x346709(0x100),'description':a42_0x346709(0x108)}],async 'dryRun'(_0x2026ef){const _0x577863=a42_0x346709,_0x258c7f=loadBffProjectConfig(_0x2026ef[_0x577863(0x11a)]),_0x15601d=await readBffLockFile(_0x258c7f[_0x577863(0x181)]),{appLock:_0x4e697d}=ensureLockScope(_0x15601d??createEmptyBffLock(),_0x2026ef['appCode'],_0x258c7f[_0x577863(0x151)],_0x577863(0x124)),_0x4a881b=normalizeBffType(_0x2026ef[_0x577863(0x136)](_0x577863(0x120)))??undefined,[_0x343b29,_0x71614c]=await Promise['all']([listBffScripts(_0x2026ef['appCode'],_0x4a881b),getBffScriptStatistics(_0x2026ef[_0x577863(0x11a)])]),_0x245448=_0x343b29['some'](_0x28f6ba=>normalizeBffType(_0x28f6ba['scriptType'])===_0x577863(0x11d)),_0x4b6a88=_0x245448?buildDatasetCodeToAliasMap(_0x2026ef[_0x577863(0x156)],_0x2026ef['appCode'],_0x2026ef[_0x577863(0x12b)]||_0x2026ef['mergedCli']?.[_0x577863(0x17b)]||_0x2026ef['mergedCli']?.[_0x577863(0xf9)]):new Map(),_0x29e478=_0x245448?await planHookDirectoryMigration(_0x258c7f,_0x4e697d,_0x4b6a88,await scanLocalBffFunctions(_0x258c7f,'HOOK')):undefined,_0x22de7c=createHookLocationMap(_0x71614c),_0x161bed=[];for(const _0x1e07c8 of _0x343b29){const _0x4b4002=resolveRemoteScriptTarget(_0x258c7f,_0x1e07c8,_0x22de7c,_0x29e478?.[_0x577863(0x16d)]??_0x4e697d['functions'],_0x4b6a88);if(!_0x4b4002){_0x161bed[_0x577863(0x10c)]({'scriptType':_0x1e07c8[_0x577863(0x104)],'functionName':_0x1e07c8['functionName']??'','status':_0x577863(0x15b),'reason':_0x577863(0x18c)});continue;}const _0x9f679c=(_0x29e478?.[_0x577863(0x16d)]??_0x4e697d[_0x577863(0x101)])[_0x4b4002[_0x577863(0x149)]],_0x200703=_0x1e07c8[_0x577863(0x14a)]!=null?computeContentHash(_0x1e07c8[_0x577863(0x14a)]):undefined,_0x2cbf6e=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x29e478,_0x4b4002)??_0x4b4002[_0x577863(0x110)],_0x9f679c,_0x200703),_0x3c00cb=_0x2cbf6e?localUnsyncedConflict(_0x4b4002,_0x1e07c8['id']):undefined;_0x161bed[_0x577863(0x10c)]({'lockKey':_0x4b4002[_0x577863(0x149)],'filePath':_0x4b4002[_0x577863(0x110)],'remoteId':_0x1e07c8['id']??null,'status':_0x3c00cb?'conflict':_0x577863(0x152),..._0x3c00cb?{'conflict':_0x3c00cb}:{},..._0x4b4002['hookLocation']?{'alias':_0x4b4002[_0x577863(0x119)]['alias']??null,'datasetCode':_0x4b4002[_0x577863(0x119)]['datasetCode'],'operationType':_0x4b4002[_0x577863(0x119)][_0x577863(0x173)],'functionNode':_0x4b4002['hookLocation'][_0x577863(0x17a)]}:{}});}return{'method':'GET','url':'/api/management/library/scripts/list?appCode='+_0x2026ef[_0x577863(0x11a)]+(_0x4a881b?_0x577863(0x17f)+_0x4a881b:'')+_0x577863(0x147)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x2026ef[_0x577863(0x11a)],'filterType':_0x4a881b??null,..._0x29e478&&_0x29e478[_0x577863(0x12a)][_0x577863(0x13a)]>0x0?{'hookDirectoryMigrations':_0x29e478['migrations'][_0x577863(0x106)](_0x5374b7=>({'from':_0x5374b7[_0x577863(0xf7)],'to':_0x5374b7[_0x577863(0x180)]}))}:{},'files':_0x161bed},'description':_0x577863(0x12d)+_0x161bed[_0x577863(0x13a)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0xe67e87){const _0x258be4=a42_0x346709,_0x4d18a3=loadBffProjectConfig(_0xe67e87[_0x258be4(0x11a)]),_0x1e5457=await readBffLockFile(_0x4d18a3[_0x258be4(0x181)]),{lockData:_0x19da7f,appLock:_0x58e51b}=ensureLockScope(_0x1e5457??createEmptyBffLock(),_0xe67e87[_0x258be4(0x11a)],_0x4d18a3[_0x258be4(0x151)],_0x258be4(0x124)),_0x7e8f76=normalizeBffType(_0xe67e87[_0x258be4(0x136)]('type'))??undefined;if(_0xe67e87['str'](_0x258be4(0x120))&&!_0x7e8f76)throw CliErrors[_0x258be4(0xfc)](_0x258be4(0x175));const [_0x2f71e0,_0x4c2f11]=await Promise['all']([listBffScripts(_0xe67e87['appCode'],_0x7e8f76),getBffScriptStatistics(_0xe67e87[_0x258be4(0x11a)])]);if(_0x2f71e0[_0x258be4(0x13a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x10a193=_0xe67e87[_0x258be4(0x102)](_0x258be4(0x168));if(_0x10a193&&!_0xe67e87[_0x258be4(0x158)]){const _0x2440fd=await confirmForce();if(!_0x2440fd)throw CliErrors[_0x258be4(0x143)](_0x258be4(0x17c));}if(_0x10a193&&_0xe67e87[_0x258be4(0x158)]){}const _0x2fffd1=_0x2f71e0[_0x258be4(0x130)](_0x2cc5da=>normalizeBffType(_0x2cc5da[_0x258be4(0x104)])===_0x258be4(0x11d)),_0x10e3b5=_0x2fffd1?buildDatasetCodeToAliasMap(_0xe67e87[_0x258be4(0x156)],_0xe67e87[_0x258be4(0x11a)],_0xe67e87[_0x258be4(0x12b)]||_0xe67e87[_0x258be4(0x162)]?.[_0x258be4(0x17b)]||_0xe67e87['mergedCli']?.[_0x258be4(0xf9)]):new Map(),_0x719014=createHookLocationMap(_0x4c2f11),_0x72d963=JSON[_0x258be4(0x145)](JSON[_0x258be4(0x111)](_0x19da7f)),_0x71452f=_0xe67e87['appCode'],_0x7d0b00=_0x72d963[_0x258be4(0x127)][_0x71452f];if(!_0x7d0b00)throw new Error(_0x258be4(0x186)+_0x71452f+_0x258be4(0x131));const _0x3003c7=_0x2fffd1?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x4d18a3,_0x7d0b00,_0x10e3b5,await scanLocalBffFunctions(_0x4d18a3,_0x258be4(0x11d))),_0x7d0b00):undefined,_0x196aba=createPullFileTransaction(),_0x56f7b5=[],_0x53ee36=[],_0x5a94ec=[],_0x5dee9e=[];for(const _0x4e6b14 of _0x2f71e0){const _0x272c5c=resolveRemoteScriptTarget(_0x4d18a3,_0x4e6b14,_0x719014,_0x7d0b00[_0x258be4(0x101)],_0x10e3b5);if(!_0x272c5c){_0x53ee36[_0x258be4(0x10c)]({'lockKey':_0x4e6b14['scriptType']+'/'+_0x4e6b14[_0x258be4(0x167)],'reason':_0x258be4(0x18c)});continue;}const _0x275491=_0x7d0b00[_0x258be4(0x101)][_0x272c5c[_0x258be4(0x149)]];try{if(!_0x4e6b14['id'])throw new Error(_0x258be4(0x18b));if(_0x4e6b14[_0x258be4(0x14a)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x409bef=_0x4e6b14['scriptContent'],_0x2840da=computeContentHash(_0x409bef);if(!_0x10a193){const _0x3ee432=await hasUnsyncedLocalChanges(_0x272c5c[_0x258be4(0x110)],_0x275491,_0x2840da);if(_0x3ee432){_0x5a94ec[_0x258be4(0x10c)](localUnsyncedConflict(_0x272c5c,_0x4e6b14['id']));continue;}}await _0x196aba[_0x258be4(0x122)](_0x272c5c['filePath'],_0x409bef);const _0xac86f6={'hash':_0x2840da,'remoteId':_0x4e6b14['id'],'version':_0x4e6b14['version']};_0x272c5c[_0x258be4(0x120)]===_0x258be4(0x11d)&&_0x272c5c[_0x258be4(0x119)]&&(_0xac86f6[_0x258be4(0xfe)]=_0x272c5c[_0x258be4(0x119)][_0x258be4(0xfe)],_0xac86f6[_0x258be4(0x113)]=_0x272c5c['hookLocation'][_0x258be4(0x113)],_0xac86f6[_0x258be4(0x173)]=_0x272c5c['hookLocation'][_0x258be4(0x173)],_0xac86f6['functionNode']=_0x272c5c[_0x258be4(0x119)][_0x258be4(0x17a)]),_0x7d0b00[_0x258be4(0x101)][_0x272c5c[_0x258be4(0x149)]]=_0xac86f6,_0x56f7b5[_0x258be4(0x10c)]({'lockKey':_0x272c5c['lockKey'],'remoteId':_0x4e6b14['id']});}catch(_0x27bebf){_0x5dee9e[_0x258be4(0x10c)]({'lockKey':_0x272c5c[_0x258be4(0x149)],'error':_0x27bebf instanceof Error?_0x27bebf[_0x258be4(0x153)]:String(_0x27bebf)});}}_0x7d0b00[_0x258be4(0x166)]=new Date()[_0x258be4(0x142)]();try{await writeBffLockFile(_0x4d18a3['lockFilePath'],_0x72d963);}catch(_0x2bbfc6){const _0x1501e5=[...await _0x196aba[_0x258be4(0xff)](),...await _0x3003c7?.['rollback']()??[]];throw withRollbackErrors(_0x2bbfc6,_0x258be4(0x13f),_0x1501e5);}return{'ok':_0x5dee9e['length']===0x0,'data':{'pulled':_0x56f7b5,'skipped':_0x53ee36,'conflicts':_0x5a94ec,'failed':_0x5dee9e},'message':formatPullMessage(_0x56f7b5[_0x258be4(0x13a)],_0x53ee36[_0x258be4(0x13a)],_0x5a94ec['length'],_0x5dee9e[_0x258be4(0x13a)])};}};function localUnsyncedConflict(_0x52ef4f,_0x4c1d42){const _0x3c8e5d=a42_0x346709,_0x1e0f12=_0x52ef4f[_0x3c8e5d(0x149)][_0x3c8e5d(0x15f)]('/')['at'](-0x1);return{'code':_0x3c8e5d(0xfd),'lockKey':_0x52ef4f['lockKey'],'filePath':_0x52ef4f[_0x3c8e5d(0x110)],..._0x4c1d42!=null?{'remoteId':_0x4c1d42}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':_0x3c8e5d(0x188),'command':CLI_BIN_NAME+_0x3c8e5d(0x16e)+_0x52ef4f['type']+_0x3c8e5d(0x105)+_0x1e0f12+_0x3c8e5d(0x14c),'requiresReview':!![],'message':'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.'}};}function formatPullMessage(_0x3c8336,_0x2cfd9b,_0x3deef3,_0x13e951){const _0x5372f7=a42_0x346709,_0x93e2ca=['Pull\x20complete:\x20'+_0x3c8336+_0x5372f7(0x115),_0x2cfd9b+'\x20skipped'];_0x3deef3>0x0&&_0x93e2ca[_0x5372f7(0x10c)](_0x3deef3+_0x5372f7(0x135)+(_0x3deef3===0x1?'':'s')+'\x20'+(_0x3deef3===0x1?_0x5372f7(0x18d):_0x5372f7(0x138))+_0x5372f7(0x18a));if(_0x13e951>0x0)_0x93e2ca['push'](_0x13e951+_0x5372f7(0x170));return _0x93e2ca[_0x5372f7(0x183)](',\x20');}async function hasUnsyncedLocalChanges(_0x26a4a2,_0x3ac702,_0x4ad5f7){if(!await fileExists(_0x26a4a2))return![];const _0x55ee36=await computeFileHash(_0x26a4a2);if(!_0x3ac702)return _0x4ad5f7?_0x55ee36!==_0x4ad5f7:!![];return _0x55ee36!==_0x3ac702['hash'];}function createPullFileTransaction(){const _0x3e5800=new Map(),_0x274e5b=async(_0x5d4b58,_0x4bb3bb)=>{const _0x4bfd80=a42_0x3677;try{if(_0x4bb3bb[_0x4bfd80(0x187)])await ensureParentDirectory(_0x5d4b58),await writeFile(_0x5d4b58,_0x4bb3bb[_0x4bfd80(0x15d)]);else try{await unlink(_0x5d4b58);}catch(_0x2dfb87){if(_0x2dfb87['code']!=='ENOENT')throw _0x2dfb87;}return undefined;}catch(_0x56a07b){return _0x56a07b instanceof Error?_0x56a07b:new Error(String(_0x56a07b));}};return{async 'write'(_0x13d65c,_0x2eb6ee){const _0x4ff43e=a42_0x3677;if(!_0x3e5800[_0x4ff43e(0x16a)](_0x13d65c))try{_0x3e5800[_0x4ff43e(0x17e)](_0x13d65c,{'existed':!![],'content':await readFile(_0x13d65c)});}catch(_0x2fdf69){if(_0x2fdf69[_0x4ff43e(0x11f)]!==_0x4ff43e(0x16b))throw _0x2fdf69;_0x3e5800[_0x4ff43e(0x17e)](_0x13d65c,{'existed':![]});}try{await ensureParentDirectory(_0x13d65c),await writeFile(_0x13d65c,_0x2eb6ee,_0x4ff43e(0x123));}catch(_0x28eca4){const _0x2b8585=await _0x274e5b(_0x13d65c,_0x3e5800[_0x4ff43e(0xfb)](_0x13d65c));if(!_0x2b8585)_0x3e5800[_0x4ff43e(0x10f)](_0x13d65c);throw withRollbackErrors(_0x28eca4,_0x4ff43e(0x144)+_0x13d65c+'\x22.',_0x2b8585?[_0x2b8585]:[]);}},async 'rollback'(){const _0x2aee4c=a42_0x3677,_0xb11421=[];for(const [_0x3f497c,_0x3b21b9]of[..._0x3e5800[_0x2aee4c(0xfa)]()]['reverse']()){const _0x1089b4=await _0x274e5b(_0x3f497c,_0x3b21b9);_0x1089b4&&_0xb11421[_0x2aee4c(0x10c)](new Error(_0x2aee4c(0x176)+_0x3f497c+_0x2aee4c(0x107)+_0x1089b4[_0x2aee4c(0x153)]));}return _0xb11421;}};}function withRollbackErrors(_0x4a5b22,_0x14e0bf,_0x4aa728){const _0x35574c=a42_0x346709,_0x48bfff=_0x4a5b22 instanceof Error?_0x4a5b22:new Error(String(_0x4a5b22));if(_0x4aa728['length']===0x0)return _0x48bfff;return new AggregateError([_0x48bfff,..._0x4aa728],_0x14e0bf+_0x35574c(0x121)+_0x4aa728[_0x35574c(0x106)](_0xb72283=>_0xb72283[_0x35574c(0x153)])[_0x35574c(0x183)](';\x20'));}function buildDatasetCodeToAliasMap(_0x251952,_0x43ff8e,_0x446401){const _0x5ce698=a42_0x346709,_0x255bbf=resolveApiModelSource(_0x251952,_0x43ff8e,_0x446401),_0x39b3cc=loadAliasMap(_0x251952,undefined,_0x255bbf[_0x5ce698(0x110)],_0x255bbf[_0x5ce698(0x163)]);return assertUnambiguousHookAliases(_0x39b3cc),new Map(_0x39b3cc['map'](_0x235a7e=>[_0x235a7e['datasetCode'][_0x5ce698(0x154)](),_0x235a7e[_0x5ce698(0xfe)]]));}async function planHookDirectoryMigration(_0x330b4d,_0x4e13cb,_0x57191c,_0x5da2ec){const _0x37b4a2=a42_0x346709,_0x69ef0a=new Map();for(const [_0x7f6451,_0x1a3aee]of Object[_0x37b4a2(0xfa)](_0x4e13cb[_0x37b4a2(0x101)])){const [_0x18f368,_0x1506ef,_0x57c54a,_0x37ec79,_0x31ca4a,..._0x14658a]=_0x7f6451['split']('/');if(_0x18f368!==_0x37b4a2(0x11d)||!_0x1506ef||!_0x57c54a||!_0x37ec79||!_0x31ca4a||_0x14658a[_0x37b4a2(0x13a)]>0x0||!_0x1a3aee[_0x37b4a2(0x113)])continue;const _0x1411c5=_0x57191c[_0x37b4a2(0xfb)](_0x1a3aee[_0x37b4a2(0x113)][_0x37b4a2(0x154)]()),_0x5ed6a1=_0x1411c5??_0x1a3aee[_0x37b4a2(0x113)];if(!isSafeHookDirectorySegment(_0x1506ef))throw CliErrors[_0x37b4a2(0xfc)](_0x37b4a2(0x13e)+_0x1506ef+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0x5ed6a1))throw CliErrors[_0x37b4a2(0xfc)](_0x37b4a2(0x140)+_0x1506ef+_0x37b4a2(0x189));if(_0x1506ef===_0x5ed6a1)continue;const _0x24ab3f=_0x69ef0a[_0x37b4a2(0xfb)](_0x1506ef)??{'datasetCode':_0x1a3aee[_0x37b4a2(0x113)],'alias':_0x1411c5,'keyChanges':[]};if(_0x24ab3f[_0x37b4a2(0x113)]!==_0x1a3aee[_0x37b4a2(0x113)])throw CliErrors[_0x37b4a2(0xfc)](_0x37b4a2(0x140)+_0x1506ef+_0x37b4a2(0x139));const _0x37c4b5=_0x37b4a2(0x10d)+_0x5ed6a1+'/'+_0x57c54a+'/'+_0x37ec79+'/'+_0x31ca4a;try{resolveLocalFilePathFromLockKey(_0x330b4d,_0x7f6451),resolveLocalFilePathFromLockKey(_0x330b4d,_0x37c4b5);}catch(_0x5eadc2){throw CliErrors[_0x37b4a2(0xfc)](_0x37b4a2(0x184)+_0x7f6451+_0x37b4a2(0x107)+(_0x5eadc2 instanceof Error?_0x5eadc2[_0x37b4a2(0x153)]:String(_0x5eadc2)));}_0x24ab3f[_0x37b4a2(0x11b)][_0x37b4a2(0x10c)]({'oldLockKey':_0x7f6451,'newLockKey':_0x37c4b5,'entry':_0x1a3aee}),_0x69ef0a[_0x37b4a2(0x17e)](_0x1506ef,_0x24ab3f);}const _0x56cdf6=new Set([..._0x69ef0a['values']()][_0x37b4a2(0x157)](_0x16adf1=>_0x16adf1[_0x37b4a2(0x11b)][_0x37b4a2(0x106)](_0x3d9d97=>_0x3d9d97['oldLockKey']))),_0x3577fb=new Map(),_0x1dfd3f=new Map();for(const [_0x5659f2,_0x4ae4cd]of _0x69ef0a){const _0x2970e3=_0x4ae4cd[_0x37b4a2(0xfe)]??_0x4ae4cd['datasetCode'],_0x48e8f1=hookDirectoryIdentity(_0x2970e3),_0xebe2ed=_0x3577fb[_0x37b4a2(0xfb)](_0x48e8f1);if(_0xebe2ed&&_0xebe2ed!==_0x5659f2)throw CliErrors[_0x37b4a2(0xfc)](_0x37b4a2(0x11c)+_0xebe2ed+_0x37b4a2(0x160)+_0x5659f2+_0x37b4a2(0x116)+_0x2970e3+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x3577fb[_0x37b4a2(0x17e)](_0x48e8f1,_0x5659f2);for(const _0x207cff of _0x4ae4cd[_0x37b4a2(0x11b)]){const _0x47ac7f=_0x1dfd3f[_0x37b4a2(0xfb)](_0x207cff['newLockKey']);if(_0x47ac7f&&_0x47ac7f!==_0x207cff[_0x37b4a2(0x12e)])throw CliErrors['validation'](_0x37b4a2(0x165)+_0x47ac7f+_0x37b4a2(0x160)+_0x207cff['oldLockKey']+'\x22:\x20both\x20target\x20\x22'+_0x207cff[_0x37b4a2(0x137)]+_0x37b4a2(0x109));if(_0x56cdf6[_0x37b4a2(0x16a)](_0x207cff[_0x37b4a2(0x137)]))throw CliErrors['validation'](_0x37b4a2(0x114)+_0x207cff[_0x37b4a2(0x12e)]+_0x37b4a2(0x129)+_0x207cff[_0x37b4a2(0x137)]+_0x37b4a2(0x155));_0x1dfd3f[_0x37b4a2(0x17e)](_0x207cff[_0x37b4a2(0x137)],_0x207cff['oldLockKey']);}}const _0x6b3f6d=new Map();for(const [_0x486729,_0x489ca2]of _0x57191c){_0x6b3f6d[_0x37b4a2(0x17e)](hookDirectoryIdentity(_0x489ca2),_0x486729);}const _0x2fce06=[];for(const [_0x2fb24e,_0x2da0e3]of _0x69ef0a){const _0x5882b2=_0x2da0e3['alias']??_0x2da0e3[_0x37b4a2(0x113)],_0x305c71=join(_0x330b4d[_0x37b4a2(0x15a)],_0x37b4a2(0x11d),_0x2fb24e),_0x135126=join(_0x330b4d[_0x37b4a2(0x15a)],_0x37b4a2(0x11d),_0x5882b2),_0x2e44db=await directoryExists(_0x305c71),_0x38e02e=await directoryExists(_0x135126),_0x4801cf=_0x2e44db?_0x38e02e?await sameDirectory(_0x305c71,_0x135126)?_0x37b4a2(0x182):undefined:_0x37b4a2(0x13c):_0x37b4a2(0x185);if(!_0x4801cf)throw CliErrors[_0x37b4a2(0xfc)](_0x37b4a2(0x140)+_0x2fb24e+_0x37b4a2(0x148)+_0x5882b2+_0x37b4a2(0x161));const _0x32fe09=_0x6b3f6d[_0x37b4a2(0xfb)](hookDirectoryIdentity(_0x2fb24e));if(_0x32fe09&&_0x32fe09!==_0x2da0e3[_0x37b4a2(0x113)][_0x37b4a2(0x154)]()){const _0x990774=new Set(_0x2da0e3[_0x37b4a2(0x11b)]['map'](_0x1b4f8f=>_0x1b4f8f['oldLockKey'])),_0x502a19=_0x5da2ec['filter'](_0x4ecaf2=>_0x4ecaf2[_0x37b4a2(0x120)]===_0x37b4a2(0x11d)&&_0x4ecaf2[_0x37b4a2(0xfe)]!=null&&hookDirectoryIdentity(_0x4ecaf2[_0x37b4a2(0xfe)])===hookDirectoryIdentity(_0x2fb24e)&&!_0x990774[_0x37b4a2(0x16a)](_0x4ecaf2[_0x37b4a2(0x149)]));if(_0x502a19[_0x37b4a2(0x13a)]>0x0)throw CliErrors['validation'](_0x37b4a2(0x140)+_0x2fb24e+_0x37b4a2(0x15e));}const _0x59758a=_0x6b3f6d['get'](hookDirectoryIdentity(_0x5882b2));if(_0x59758a&&_0x59758a!==_0x2da0e3['datasetCode'][_0x37b4a2(0x154)]())throw CliErrors['validation'](_0x37b4a2(0x140)+_0x2fb24e+_0x37b4a2(0x148)+_0x5882b2+_0x37b4a2(0x14e));for(const _0x58e1da of _0x2da0e3[_0x37b4a2(0x11b)]){const _0x25873b=_0x4e13cb[_0x37b4a2(0x101)][_0x58e1da[_0x37b4a2(0x137)]];if(_0x25873b&&!_0x56cdf6[_0x37b4a2(0x16a)](_0x58e1da['newLockKey'])&&!sameHookIdentity(_0x58e1da[_0x37b4a2(0x174)],_0x25873b))throw CliErrors[_0x37b4a2(0xfc)](_0x37b4a2(0x140)+_0x2fb24e+_0x37b4a2(0x148)+_0x5882b2+_0x37b4a2(0x150));}_0x2fce06[_0x37b4a2(0x10c)]({'oldDirectory':_0x2fb24e,'newDirectory':_0x5882b2,'oldDirectoryPath':_0x305c71,'newDirectoryPath':_0x135126,'mode':_0x4801cf,'alias':_0x2da0e3[_0x37b4a2(0xfe)],'keyChanges':_0x2da0e3[_0x37b4a2(0x11b)]});}const _0x32845f={..._0x4e13cb['functions']},_0x3c03e9=new Map(),_0x3af3ac=new Map();for(const _0x39782e of _0x2fce06){const _0xbb3dff=_0x39782e['mode']!==_0x37b4a2(0x185);_0xbb3dff&&_0x3af3ac[_0x37b4a2(0x17e)](hookDirectoryIdentity(_0x39782e[_0x37b4a2(0x180)]),_0x39782e['oldDirectoryPath']);for(const _0xc8c796 of _0x39782e[_0x37b4a2(0x11b)]){const _0x1a41b1=_0x32845f[_0xc8c796['newLockKey']],_0x53c083=_0xbb3dff?_0xc8c796[_0x37b4a2(0x174)]:_0x1a41b1??_0xc8c796['entry'];_0x32845f[_0xc8c796[_0x37b4a2(0x137)]]=canonicalizeHookEntry(_0x53c083,_0x39782e[_0x37b4a2(0xfe)]),delete _0x32845f[_0xc8c796[_0x37b4a2(0x12e)]],_0xbb3dff&&_0x3c03e9['set'](_0xc8c796['newLockKey'],resolveLocalFilePathFromLockKey(_0x330b4d,_0xc8c796[_0x37b4a2(0x12e)]));}}return{'migrations':_0x2fce06,'projectedFunctions':_0x32845f,'sourceFilePathByNewLockKey':_0x3c03e9,'sourceDirectoryPathByNewDirectory':_0x3af3ac};}function resolveMigratedSourceFilePath(_0x4b739f,_0x40ecfb){const _0x2409bc=a42_0x346709;if(!_0x4b739f||!_0x40ecfb)return undefined;const _0x1be3bb=_0x4b739f[_0x2409bc(0x172)]['get'](_0x40ecfb[_0x2409bc(0x149)]);if(_0x1be3bb)return _0x1be3bb;if(_0x40ecfb[_0x2409bc(0x120)]!==_0x2409bc(0x11d))return undefined;const [,_0x1f49c6,..._0x46a470]=_0x40ecfb[_0x2409bc(0x149)]['split']('/');if(!_0x1f49c6||_0x46a470[_0x2409bc(0x13a)]===0x0)return undefined;const _0x57778c=_0x4b739f[_0x2409bc(0x133)][_0x2409bc(0xfb)](hookDirectoryIdentity(_0x1f49c6));return _0x57778c?join(_0x57778c,..._0x46a470)+_0x2409bc(0x179):undefined;}function sameHookIdentity(_0x2bd441,_0x7f9c94){const _0x366fe1=a42_0x346709;return _0x2bd441[_0x366fe1(0x103)]===_0x7f9c94[_0x366fe1(0x103)]&&_0x2bd441[_0x366fe1(0x113)]===_0x7f9c94[_0x366fe1(0x113)]&&_0x2bd441[_0x366fe1(0x173)]===_0x7f9c94['operationType']&&_0x2bd441['functionNode']===_0x7f9c94['functionNode'];}function a42_0x3677(_0x2f3520,_0x18654b){_0x2f3520=_0x2f3520-0xf6;const _0x4fd575=a42_0x4fd5();let _0x367787=_0x4fd575[_0x2f3520];return _0x367787;}function canonicalizeHookEntry(_0x4bd1ac,_0x25c848){const {alias:_0x1b8c55,..._0x5b6892}=_0x4bd1ac;return _0x25c848?{..._0x5b6892,'alias':_0x25c848}:_0x5b6892;}function hookDirectoryIdentity(_0x240488){const _0xb13916=a42_0x346709;return _0x240488['normalize'](_0xb13916(0x125))['toLowerCase']();}function isSafeHookDirectorySegment(_0xe3422){return isSafeLockKeySegment(_0xe3422);}async function sameDirectory(_0x21cd83,_0x6e698c){const _0xc5954b=a42_0x346709,[_0x4d14c0,_0x4d1a05]=await Promise[_0xc5954b(0x12c)]([stat(_0x21cd83),stat(_0x6e698c)]);return _0x4d14c0[_0xc5954b(0x126)]===_0x4d1a05[_0xc5954b(0x126)]&&_0x4d14c0[_0xc5954b(0x13b)]===_0x4d1a05[_0xc5954b(0x13b)];}async function applyHookDirectoryMigration(_0x5191a3,_0x4b7892){const _0x2cca76=a42_0x346709,_0x17c2ea=_0x4b7892[_0x2cca76(0x101)],_0xa40d5c=_0x4b7892[_0x2cca76(0x166)],_0x184d3d=[],_0x245f3a=async()=>{const _0x317293=_0x2cca76,_0x40e64f=[];_0x4b7892[_0x317293(0x101)]=_0x17c2ea,_0x4b7892['lastSync']=_0xa40d5c;for(const {migration:_0x5941a8,temporaryPath:_0x42a772}of[..._0x184d3d][_0x317293(0x16c)]()){try{_0x42a772?(await rename(_0x5941a8[_0x317293(0x13d)],_0x42a772),await rename(_0x42a772,_0x5941a8[_0x317293(0x128)])):await rename(_0x5941a8['newDirectoryPath'],_0x5941a8['oldDirectoryPath']);}catch(_0x367543){_0x40e64f[_0x317293(0x10c)](new Error(_0x317293(0x132)+_0x5941a8[_0x317293(0xf7)]+_0x317293(0xf6)+_0x5941a8[_0x317293(0x180)]+_0x317293(0x107)+(_0x367543 instanceof Error?_0x367543[_0x317293(0x153)]:String(_0x367543))));}}return _0x40e64f;};try{for(const _0x1faeb4 of _0x5191a3['migrations']){if(_0x1faeb4[_0x2cca76(0x14d)]===_0x2cca76(0x13c))await ensureParentDirectory(_0x1faeb4[_0x2cca76(0x13d)]),await rename(_0x1faeb4['oldDirectoryPath'],_0x1faeb4[_0x2cca76(0x13d)]),_0x184d3d[_0x2cca76(0x10c)]({'migration':_0x1faeb4});else{if(_0x1faeb4[_0x2cca76(0x14d)]==='case-rename'){const _0x4559c0=join(dirname(_0x1faeb4[_0x2cca76(0x128)]),_0x2cca76(0x10a)+randomUUID());await rename(_0x1faeb4[_0x2cca76(0x128)],_0x4559c0);try{await rename(_0x4559c0,_0x1faeb4[_0x2cca76(0x13d)]);}catch(_0x29531e){try{await rename(_0x4559c0,_0x1faeb4[_0x2cca76(0x128)]);}catch(_0x4df7ad){throw withRollbackErrors(_0x29531e,'Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22'+_0x1faeb4[_0x2cca76(0xf7)]+'\x22\x20to\x20\x22'+_0x1faeb4[_0x2cca76(0x180)]+'\x22;\x20temporary\x20directory\x20\x22'+_0x4559c0+'\x22\x20may\x20remain.',[new Error('Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22'+_0x4559c0+'\x22\x20to\x20\x22'+_0x1faeb4['oldDirectory']+_0x2cca76(0x107)+(_0x4df7ad instanceof Error?_0x4df7ad[_0x2cca76(0x153)]:String(_0x4df7ad)))]);}throw _0x29531e;}_0x184d3d[_0x2cca76(0x10c)]({'migration':_0x1faeb4,'temporaryPath':_0x4559c0});}}}return _0x4b7892[_0x2cca76(0x101)]=_0x5191a3['projectedFunctions'],{'rollback':_0x245f3a};}catch(_0x77eb79){const _0x57addf=await _0x245f3a();throw withRollbackErrors(_0x77eb79,_0x2cca76(0x141),_0x57addf);}}async function confirmForce(){const _0x193439=a42_0x346709,_0x5b0544=createInterface({'input':process[_0x193439(0x16f)],'output':process['stderr']}),_0x4fd12f=await new Promise(_0x2a857e=>{const _0x299b78=_0x193439;_0x5b0544[_0x299b78(0x178)](_0x299b78(0x15c),_0x2a857e);});return _0x5b0544[_0x193439(0x164)](),['y','yes'][_0x193439(0xf8)](_0x4fd12f[_0x193439(0x171)]()[_0x193439(0x154)]());}
@@ -1 +1 @@
1
- const a37_0x52ab55=a37_0x45b0;(function(_0x35c1c3,_0x4e4741){const _0x158572=a37_0x45b0,_0x553920=_0x35c1c3();while(!![]){try{const _0x2efae6=parseInt(_0x158572(0x176))/0x1*(parseInt(_0x158572(0x174))/0x2)+-parseInt(_0x158572(0x1a2))/0x3+parseInt(_0x158572(0x194))/0x4+parseInt(_0x158572(0x16b))/0x5*(-parseInt(_0x158572(0x182))/0x6)+-parseInt(_0x158572(0x188))/0x7+-parseInt(_0x158572(0x175))/0x8+parseInt(_0x158572(0x180))/0x9;if(_0x2efae6===_0x4e4741)break;else _0x553920['push'](_0x553920['shift']());}catch(_0x55468d){_0x553920['push'](_0x553920['shift']());}}}(a37_0x3559,0x7de88));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets,clearBffScriptCache}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.js';function a37_0x3559(){const _0x174f04=['apiDir','lockFilePath','Push\x20local\x20Backend\x20Function\x20scripts\x20to\x20remote','datasetCodeToDataset','aliasToDatasetCode','cleared','bool','Incomplete\x20HOOK\x20path:\x20','force','No\x20local\x20Backend\x20Function\x20scripts\x20found.','validation','status','apps','Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)','boolean','COMMON','5tXtveh','functions','datasetId','description','\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.','Lock\x20file\x20not\x20settled\x20after\x20push\x20for\x20','\x22.\x20','datasetCode','lockKey','10434SiUQmA','4292888HvTvQk','65KENlAJ','\x20skipped,\x20','string','has','Local\x20function\x20not\x20found:\x20','HOOK','POST','Would\x20inspect\x20','push','some','14874345isGxrm','remoteId','2455284bOWqhA','scriptsRoot','functionNode','hash','parse','join','5703705uDVnqT','type','message','write','utf8','script','alias','Run\x20`','map','length','Runtime\x20script\x20cache\x20cleared.','operationType','3099796GlnikK','get','create','appCode','stringify','unchanged','Lock\x20scope\x20for\x20app\x20\x22','set','\x22\x20not\x20found\x20after\x20ensureLockScope.','Cannot\x20resolve\x20dataset\x20for\x20\x22','version','lastSync','ENDPOINT','Push\x20complete:\x20','1471197zZcrfZ','Push\x20only\x20this\x20script\x20type','/api/management/library/scripts/save','filePath','\x20local\x20Backend\x20Function\x20script(s)\x20for\x20push\x20and\x20clear\x20runtime\x20cache\x20if\x20files\x20are\x20uploaded','would_push','str','code'];a37_0x3559=function(){return _0x174f04;};return a37_0x3559();}import{loadBffProjectConfig}from'../../core/bff/config.js';function a37_0x45b0(_0x317a1f,_0x16d1fd){_0x317a1f=_0x317a1f-0x166;const _0x355918=a37_0x3559();let _0x45b0e5=_0x355918[_0x317a1f];return _0x45b0e5;}import{normalizeBffType,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{extractScriptDescription}from'../../core/bff/utils.js';import{sleep}from'../../utils/sleep.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';const CACHE_CLEAR_ATTEMPTS=0x2,CACHE_CLEAR_INTERVAL_MS=0x12c;export const bffPush={'service':'bff','command':a37_0x52ab55(0x17e),'description':a37_0x52ab55(0x1ac),'risk':a37_0x52ab55(0x18b),'flags':[{'name':a37_0x52ab55(0x189),'type':a37_0x52ab55(0x178),'description':a37_0x52ab55(0x1a3),'enum':[a37_0x52ab55(0x16a),a37_0x52ab55(0x1a0),a37_0x52ab55(0x17b)]},{'name':'name','type':a37_0x52ab55(0x178),'description':a37_0x52ab55(0x168)},{'name':a37_0x52ab55(0x1b2),'type':a37_0x52ab55(0x169),'description':'Force\x20push\x20ignoring\x20hash\x20protection'}],async 'dryRun'(_0x1b0f53){const _0x13c480=a37_0x52ab55,_0x416fc8=loadBffProjectConfig(_0x1b0f53[_0x13c480(0x197)]),_0x4805e0=await readBffLockFile(_0x416fc8['lockFilePath']),{appLock:_0x2a3d2b}=ensureLockScope(_0x4805e0??createEmptyBffLock(),_0x1b0f53[_0x13c480(0x197)],_0x416fc8[_0x13c480(0x183)],_0x13c480(0x17e)),_0x35df33=await getTargetFunctions(_0x416fc8,_0x1b0f53),_0x4398a0=_0x1b0f53['bool'](_0x13c480(0x1b2)),_0xdd5f29=[];for(const _0x2bd375 of _0x35df33){const _0x39b020=await computeFileHash(_0x2bd375[_0x13c480(0x1a5)]),_0x361b5e=_0x2a3d2b[_0x13c480(0x16c)][_0x2bd375['lockKey']],_0x665860=!!_0x361b5e&&_0x361b5e[_0x13c480(0x185)]===_0x39b020,_0x5f5ca3=!_0x4398a0&&_0x665860?_0x13c480(0x199):_0x13c480(0x1a7);_0xdd5f29[_0x13c480(0x17e)]({'lockKey':_0x2bd375[_0x13c480(0x173)],'filePath':_0x2bd375[_0x13c480(0x1a5)],'remoteId':_0x361b5e?.[_0x13c480(0x181)]??null,'mode':_0x361b5e?.[_0x13c480(0x181)]?'update':_0x13c480(0x196),'status':_0x5f5ca3});}return{'method':_0x13c480(0x17c),'url':_0x13c480(0x1a4),'body':{'appCode':_0x1b0f53[_0x13c480(0x197)],'force':_0x4398a0,'files':_0xdd5f29,'cacheClearAtRuntime':_0xdd5f29[_0x13c480(0x17f)](_0x333c01=>_0x333c01[_0x13c480(0x166)]==='would_push'),'cacheClearAtRuntimeTimes':_0xdd5f29[_0x13c480(0x17f)](_0x1c612d=>_0x1c612d[_0x13c480(0x166)]===_0x13c480(0x1a7))?CACHE_CLEAR_ATTEMPTS:0x0},'description':_0x13c480(0x17d)+_0xdd5f29[_0x13c480(0x191)]+_0x13c480(0x1a6)};},async 'execute'(_0x324b5d){const _0x1611c5=a37_0x52ab55,_0x18a80f=loadBffProjectConfig(_0x324b5d['appCode']),_0x487bd8=await readBffLockFile(_0x18a80f[_0x1611c5(0x1ab)]),{lockData:_0x456f91,appLock:_0x1dd595}=ensureLockScope(_0x487bd8??createEmptyBffLock(),_0x324b5d[_0x1611c5(0x197)],_0x18a80f[_0x1611c5(0x183)],_0x1611c5(0x17e)),_0x2a0bc5=await getTargetFunctions(_0x18a80f,_0x324b5d);if(_0x2a0bc5[_0x1611c5(0x191)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0x1611c5(0x1b3)};const _0x43367c=_0x324b5d[_0x1611c5(0x1b0)](_0x1611c5(0x1b2)),_0x1fad15=JSON[_0x1611c5(0x186)](JSON[_0x1611c5(0x198)](_0x456f91)),_0x36af73=_0x1fad15[_0x1611c5(0x167)][_0x324b5d[_0x1611c5(0x197)]];if(!_0x36af73)throw new Error(_0x1611c5(0x19a)+_0x324b5d['appCode']+_0x1611c5(0x19c));const _0x5676f3=await buildHookMaps(_0x324b5d[_0x1611c5(0x197)],_0x324b5d[_0x1611c5(0x1aa)],_0x2a0bc5,_0x36af73),_0x3bf343=[],_0x332877=[],_0x5b0b1e=[];for(const _0x157123 of _0x2a0bc5){const _0x12a3ed=await computeFileHash(_0x157123[_0x1611c5(0x1a5)]),_0x51a7b1=_0x36af73[_0x1611c5(0x16c)][_0x157123[_0x1611c5(0x173)]];if(!_0x43367c&&_0x51a7b1&&_0x51a7b1[_0x1611c5(0x185)]===_0x12a3ed){_0x332877[_0x1611c5(0x17e)]({'lockKey':_0x157123[_0x1611c5(0x173)],'reason':_0x1611c5(0x199)});continue;}try{await uploadSingleFunction(_0x324b5d[_0x1611c5(0x197)],_0x157123,_0x36af73,_0x5676f3);const _0x20a8ab=_0x36af73['functions'][_0x157123[_0x1611c5(0x173)]];_0x3bf343[_0x1611c5(0x17e)]({'lockKey':_0x157123[_0x1611c5(0x173)],'remoteId':_0x20a8ab?.['remoteId']??0x0});}catch(_0x389672){_0x5b0b1e[_0x1611c5(0x17e)]({'lockKey':_0x157123['lockKey'],'error':_0x389672 instanceof Error?_0x389672[_0x1611c5(0x18a)]:String(_0x389672)});}}_0x36af73[_0x1611c5(0x19f)]=new Date()['toISOString'](),await writeBffLockFile(_0x18a80f[_0x1611c5(0x1ab)],_0x1fad15),await waitForUploadedLockEntries(_0x18a80f[_0x1611c5(0x1ab)],_0x324b5d[_0x1611c5(0x197)],_0x3bf343['map'](_0x1e18e1=>_0x1e18e1[_0x1611c5(0x173)]));let _0x18f6d3={'attempted':![],'cleared':![]};if(_0x3bf343[_0x1611c5(0x191)]>0x0)try{let _0x165759='';for(let _0xbf72a2=0x0;_0xbf72a2<CACHE_CLEAR_ATTEMPTS;_0xbf72a2+=0x1){_0x165759=await clearBffScriptCache(),_0xbf72a2<CACHE_CLEAR_ATTEMPTS-0x1&&await sleep(CACHE_CLEAR_INTERVAL_MS);}_0x18f6d3={'attempted':!![],'cleared':!![],'message':_0x165759||_0x1611c5(0x192)};}catch(_0x22cde0){_0x18f6d3={'attempted':!![],'cleared':![],'error':_0x22cde0 instanceof Error?_0x22cde0[_0x1611c5(0x18a)]:String(_0x22cde0)};}const _0x51264e=_0x5b0b1e[_0x1611c5(0x191)]===0x0&&(_0x18f6d3['attempted']?_0x18f6d3[_0x1611c5(0x1af)]:!![]),_0x1b8174=_0x51264e,_0x36bdcf=_0x18f6d3['attempted']?_0x18f6d3[_0x1611c5(0x1af)]?'runtime\x20cache\x20cleared':'runtime\x20cache\x20clear\x20failed':'runtime\x20cache\x20not\x20needed';return{'ok':_0x1b8174,'data':{'uploaded':_0x3bf343,'skipped':_0x332877,'failed':_0x5b0b1e,'cacheClear':_0x18f6d3},'message':_0x1611c5(0x1a1)+_0x3bf343['length']+'\x20uploaded,\x20'+_0x332877['length']+_0x1611c5(0x177)+_0x5b0b1e[_0x1611c5(0x191)]+'\x20failed,\x20'+_0x36bdcf};}};async function getTargetFunctions(_0x1c4d78,_0x573b84){const _0x49509a=a37_0x52ab55,_0x26dd05=_0x573b84['str']('type'),_0x30f37b=_0x573b84[_0x49509a(0x1a8)]('name'),_0xed6ddf=normalizeBffType(_0x26dd05)??undefined;if(_0x30f37b&&!_0xed6ddf)throw CliErrors['validation']('--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.');const _0x5f5a1b=await scanLocalBffFunctions(_0x1c4d78,_0xed6ddf);if(_0x30f37b){const _0x119f6b=_0x5f5a1b['filter'](_0x8352cb=>_0x8352cb['name']===_0x30f37b);if(_0x119f6b[_0x49509a(0x191)]===0x0)throw CliErrors[_0x49509a(0x1b4)](_0x49509a(0x17a)+_0xed6ddf+'/'+_0x30f37b);return _0x119f6b;}return _0x5f5a1b;}async function buildHookMaps(_0x462306,_0x2edbe8,_0xc58140,_0x5d732b){const _0xbf7068=a37_0x52ab55,_0xc23df8=_0xc58140[_0xbf7068(0x17f)](_0x1c7c02=>_0x1c7c02[_0xbf7068(0x189)]==='HOOK');if(!_0xc23df8)return{'aliasToDatasetCode':new Map(),'datasetCodeToDataset':new Map()};const _0x3c9dbc=loadAliasMap(_0x2edbe8,undefined,resolveApiFilePath(_0x2edbe8,_0x462306)),_0x1887e7=new Map(_0x3c9dbc[_0xbf7068(0x190)](_0x5b81c9=>[_0x5b81c9[_0xbf7068(0x18e)],_0x5b81c9[_0xbf7068(0x172)]]));for(const _0x5e4062 of Object['values'](_0x5d732b['functions'])){_0x5e4062[_0xbf7068(0x18e)]&&_0x5e4062[_0xbf7068(0x172)]&&!_0x1887e7[_0xbf7068(0x179)](_0x5e4062[_0xbf7068(0x18e)])&&_0x1887e7[_0xbf7068(0x19b)](_0x5e4062[_0xbf7068(0x18e)],_0x5e4062[_0xbf7068(0x172)]);}const _0x2ff827=await listDatasets(_0x462306),_0x5dd580=new Map(_0x2ff827[_0xbf7068(0x190)](_0x3a883d=>[_0x3a883d[_0xbf7068(0x1a9)],_0x3a883d]));return{'aliasToDatasetCode':_0x1887e7,'datasetCodeToDataset':_0x5dd580};}async function uploadSingleFunction(_0x346134,_0x501ac2,_0x41c3c2,_0x217f91){const _0x5073b1=a37_0x52ab55,_0x3b56e9=await readFile(_0x501ac2[_0x5073b1(0x1a5)],_0x5073b1(0x18c)),_0x5f0469=await computeFileHash(_0x501ac2['filePath']),_0x411512=_0x41c3c2[_0x5073b1(0x16c)][_0x501ac2[_0x5073b1(0x173)]];if(_0x411512?.[_0x5073b1(0x181)]&&_0x411512[_0x5073b1(0x19e)]==null)throw CliErrors[_0x5073b1(0x1b4)](_0x501ac2[_0x5073b1(0x173)]+':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.');let _0x3b24fa=extractScriptDescription(_0x3b56e9);if(!_0x3b24fa&&_0x411512?.[_0x5073b1(0x181)]){const _0x4a4830=await getBffScriptInfo(_0x411512['remoteId']);_0x3b24fa=_0x4a4830[_0x5073b1(0x16e)]||undefined;}const _0x3d7a2b={'appCode':_0x346134,'functionName':_0x501ac2['name'],'scriptType':_0x501ac2[_0x5073b1(0x189)],'scriptContent':_0x3b56e9};if(_0x411512?.['remoteId'])_0x3d7a2b['id']=_0x411512['remoteId'];if(_0x411512?.[_0x5073b1(0x19e)]!=null)_0x3d7a2b[_0x5073b1(0x19e)]=_0x411512['version'];if(_0x3b24fa)_0x3d7a2b['description']=_0x3b24fa;if(_0x501ac2[_0x5073b1(0x189)]===_0x5073b1(0x17b)){const _0x324b10=_0x501ac2[_0x5073b1(0x18e)];if(!_0x324b10||!_0x501ac2[_0x5073b1(0x193)]||!_0x501ac2['functionNode'])throw CliErrors[_0x5073b1(0x1b4)](_0x5073b1(0x1b1)+_0x501ac2[_0x5073b1(0x173)]);const _0x3c72c8=_0x217f91[_0x5073b1(0x1ae)]['get'](_0x324b10)??_0x411512?.[_0x5073b1(0x172)]??_0x324b10,_0x45e166=_0x217f91[_0x5073b1(0x1ad)][_0x5073b1(0x195)](_0x3c72c8);if(!_0x45e166)throw CliErrors['validation'](_0x5073b1(0x19d)+_0x324b10+_0x5073b1(0x171)+(_0x5073b1(0x18f)+CLI_BIN_NAME+_0x5073b1(0x16f)));_0x3d7a2b[_0x5073b1(0x16d)]=_0x45e166['id'],_0x3d7a2b[_0x5073b1(0x193)]=_0x501ac2['operationType'],_0x3d7a2b[_0x5073b1(0x184)]=_0x501ac2[_0x5073b1(0x184)];}const _0xab3a80=await saveBffScript(_0x3d7a2b),_0x40be4e=_0xab3a80['id'],_0x312d71=_0xab3a80[_0x5073b1(0x18d)]??await getBffScriptInfo(_0x40be4e),_0x1b520b={'hash':_0x5f0469,'remoteId':_0x40be4e,'version':_0x312d71[_0x5073b1(0x19e)]};if(_0x501ac2[_0x5073b1(0x189)]===_0x5073b1(0x17b)){const _0x5153f0=_0x501ac2[_0x5073b1(0x18e)],_0x390459=_0x217f91[_0x5073b1(0x1ae)]['get'](_0x5153f0)??_0x411512?.[_0x5073b1(0x172)]??_0x5153f0;_0x217f91[_0x5073b1(0x1ae)][_0x5073b1(0x179)](_0x5153f0)?_0x1b520b['alias']=_0x5153f0:_0x1b520b[_0x5073b1(0x18e)]=_0x411512?.[_0x5073b1(0x18e)],_0x1b520b[_0x5073b1(0x172)]=_0x390459,_0x1b520b[_0x5073b1(0x193)]=_0x501ac2[_0x5073b1(0x193)],_0x1b520b[_0x5073b1(0x184)]=_0x501ac2[_0x5073b1(0x184)];}_0x41c3c2[_0x5073b1(0x16c)][_0x501ac2[_0x5073b1(0x173)]]=_0x1b520b;}const LOCK_SETTLE_RETRY_COUNT=0x14,LOCK_SETTLE_DELAY_MS=0x64;async function waitForUploadedLockEntries(_0x157ce0,_0x7ab773,_0x2e00ef){const _0x19c499=a37_0x52ab55;if(_0x2e00ef[_0x19c499(0x191)]===0x0)return;for(let _0x4981be=0x0;_0x4981be<LOCK_SETTLE_RETRY_COUNT;_0x4981be+=0x1){const _0x307461=await readBffLockFile(_0x157ce0),_0x2ce1ba=_0x307461?.['apps']?.[_0x7ab773]?.[_0x19c499(0x16c)]??{},_0x12c19f=_0x2e00ef['every'](_0x32718f=>!!_0x2ce1ba[_0x32718f]?.[_0x19c499(0x181)]);if(_0x12c19f)return;await sleep(LOCK_SETTLE_DELAY_MS);}throw new Error(_0x19c499(0x170)+_0x2e00ef[_0x19c499(0x187)](',\x20')+'.');}
1
+ const a43_0x3b97bc=a43_0x71b6;function a43_0x33aa(){const _0x34c047=['filePath','update',':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.','\x20bff\x20detail\x20--id\x20','review_remote_and_merge','string','apps','message','size','HOOK','currentApp','operationType','Would\x20inspect\x20','mergedCli','\x20local\x20Backend\x20Function\x20script(s)\x20for\x20push\x20and\x20clear\x20runtime\x20cache\x20if\x20files\x20are\x20uploaded','POST','appCode','runtime\x20cache\x20cleared','set','EXISTING_HOOK_BINDING_PRESERVED','cleared','1000629EyYqzE','156uzHINy','Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)','3918DWvIzP','531771vBuheK','script','runtime\x20cache\x20clear\x20failed','push','33620LjCGBA','attempted','hash','delete','apiDir','\x20resolution','conflict','164240zjNbFE','Lock\x20scope\x20for\x20app\x20\x22','remoteId','scriptsRoot','dataset','stringify','8ZeGdOP','before','Lock\x20file\x20not\x20settled\x20after\x20push\x20for\x20','Remote\x20script\x20version\x20changed\x20since\x20the\x20last\x20pull.','status','some','map','\x20uploaded','length','No\x20local\x20Backend\x20Function\x20scripts\x20found.','\x20--format\x20compress','get','ENDPOINT','alias','Force\x20push\x20ignoring\x20hash\x20protection','HOOK_DATASET_NOT_FOUND:','resolutions','warnings','functions','9177JwJoWE','existingHooks','1255310KjivOM','Local\x20function\x20not\x20found:\x20','str','BFF_REMOTE_VERSION_CHANGED','force','lockKey','type','validation','failures','flatMap','every','Push\x20only\x20this\x20script\x20type','profileName','lockFilePath','failed','functionName','lastSync','\x20conflict','scriptType','The\x20local\x20sync\x20lock\x20has\x20no\x20remote\x20version\x20for\x20this\x20script.','unchanged','Existing\x20HOOK\x20identity,\x20version\x20or\x20binding\x20does\x20not\x20match\x20the\x20local\x20lock.\x20Pull\x20and\x20review\x20before\x20pushing.','Review\x20the\x20current\x20remote\x20source,\x20merge\x20it\x20into\x20the\x20local\x20script,\x20then\x20retry\x20push.\x20Do\x20not\x20use\x20--force\x20unless\x20you\x20intentionally\x20discard\x20local\x20changes.','1158IEPgjc','has','join','boolean','create','filter','description','--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.','version','name','startsWith','functionNode','Dataset\x20metadata\x20is\x20unavailable;\x20the\x20existing\x20script\x20and\x20binding\x20were\x20verified.\x20Update\x20by\x20script\x20ID\x20without\x20rebinding.','require','selectedAppName','BFF_REMOTE_VERSION_MISSING','COMMON','datasetCode','Push\x20complete:\x20','Incomplete\x20HOOK\x20path:\x20','datasetId','afterScriptId','bool','defaultApp','would_push','Cannot\x20verify\x20existing\x20HOOK\x20binding:\x20'];a43_0x33aa=function(){return _0x34c047;};return a43_0x33aa();}(function(_0x45d8dc,_0x3d2d2b){const _0x306357=a43_0x71b6,_0x2bc9df=_0x45d8dc();while(!![]){try{const _0x12f096=parseInt(_0x306357(0xe4))/0x1*(parseInt(_0x306357(0xe6))/0x2)+-parseInt(_0x306357(0xe7))/0x3*(-parseInt(_0x306357(0xf8))/0x4)+-parseInt(_0x306357(0xeb))/0x5+parseInt(_0x306357(0xb4))/0x6*(-parseInt(_0x306357(0x10b))/0x7)+parseInt(_0x306357(0xf2))/0x8+-parseInt(_0x306357(0xe3))/0x9+-parseInt(_0x306357(0x10d))/0xa;if(_0x12f096===_0x3d2d2b)break;else _0x2bc9df['push'](_0x2bc9df['shift']());}catch(_0x163ccb){_0x2bc9df['push'](_0x2bc9df['shift']());}}}(a43_0x33aa,0x2cf7d));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,getBffScriptStatistics,getPlatformErrorCode,listDatasets,clearBffScriptCache}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{normalizeBffType,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{buildHookDirectoryIndexes,assertUnambiguousHookAliases,assertUnambiguousHookDirectoryMappings,preflightPushHookDirectories,trackedHookDirectoryMappings}from'../../core/bff/hook-directory.js';import{computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{extractScriptDescription,snakeToCamel}from'../../core/bff/utils.js';import{sleep}from'../../utils/sleep.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a43_0x71b6(_0x3886ac,_0x1a4ddd){_0x3886ac=_0x3886ac-0xb3;const _0x33aa13=a43_0x33aa();let _0x71b6d6=_0x33aa13[_0x3886ac];return _0x71b6d6;}import{CliErrors}from'../../errors.js';const CACHE_CLEAR_ATTEMPTS=0x2,CACHE_CLEAR_INTERVAL_MS=0x12c;export const bffPush={'service':'bff','command':a43_0x3b97bc(0xea),'description':'Push\x20local\x20Backend\x20Function\x20scripts\x20to\x20remote','risk':'write','structuredErrors':!![],'flags':[{'name':a43_0x3b97bc(0x113),'type':'string','description':a43_0x3b97bc(0x118),'enum':[a43_0x3b97bc(0xc4),a43_0x3b97bc(0x104),a43_0x3b97bc(0xd7)]},{'name':'name','type':a43_0x3b97bc(0xd3),'description':a43_0x3b97bc(0xe5)},{'name':'force','type':a43_0x3b97bc(0xb7),'description':a43_0x3b97bc(0x106)}],async 'dryRun'(_0x4d58a6){const _0x50ce96=a43_0x3b97bc,_0x3d7b43=loadBffProjectConfig(_0x4d58a6['appCode']),_0x2e213c=await readBffLockFile(_0x3d7b43['lockFilePath']),{appLock:_0x444cd5}=ensureLockScope(_0x2e213c??createEmptyBffLock(),_0x4d58a6[_0x50ce96(0xde)],_0x3d7b43['scriptsRoot'],_0x50ce96(0xea)),_0x226dcf=await getTargetFunctions(_0x3d7b43,_0x4d58a6),_0x49d98e=_0x226dcf[_0x50ce96(0xfd)](_0x1eacda=>_0x1eacda['type']===_0x50ce96(0xd7))?await scanLocalBffFunctions(_0x3d7b43,_0x50ce96(0xd7)):_0x226dcf,_0x2dd27f=await buildHookMaps(_0x4d58a6[_0x50ce96(0xde)],_0x4d58a6[_0x50ce96(0xef)],_0x49d98e,_0x444cd5,_0x4d58a6['selectedAppName']||_0x4d58a6[_0x50ce96(0xdb)]?.[_0x50ce96(0xd8)]||_0x4d58a6[_0x50ce96(0xdb)]?.['defaultApp']),_0x3cf14b=_0x4d58a6[_0x50ce96(0xca)]('force'),_0x20a7c7=[];for(const _0x62787e of _0x226dcf){const _0x58b226=await computeFileHash(_0x62787e[_0x50ce96(0xce)]),_0x526afb=_0x444cd5[_0x50ce96(0x10a)][_0x62787e['lockKey']],_0x534323=!!_0x526afb&&_0x526afb[_0x50ce96(0xed)]===_0x58b226,_0x1c7397=_0x2dd27f[_0x50ce96(0x108)][_0x50ce96(0x103)](_0x62787e[_0x50ce96(0x112)]),_0x1b7159=!!_0x526afb?.[_0x50ce96(0xf4)]&&_0x526afb[_0x50ce96(0xbc)]==null&&(_0x3cf14b||!_0x534323),_0x2abb96=_0x1b7159?missingRemoteVersionConflict(_0x62787e,_0x526afb):undefined,_0x1412e6=_0x2dd27f[_0x50ce96(0x115)][_0x50ce96(0xb5)](_0x62787e[_0x50ce96(0x112)])?_0x50ce96(0x11b):!_0x3cf14b&&_0x534323?_0x50ce96(0x121):_0x2abb96?_0x50ce96(0xf1):_0x50ce96(0xcc);_0x20a7c7[_0x50ce96(0xea)]({'lockKey':_0x62787e[_0x50ce96(0x112)],'filePath':_0x62787e['filePath'],'remoteId':_0x526afb?.['remoteId']??null,'mode':_0x526afb?.['remoteId']?_0x50ce96(0xcf):_0x50ce96(0xb8),'status':_0x1412e6,..._0x2dd27f[_0x50ce96(0x115)][_0x50ce96(0xb5)](_0x62787e[_0x50ce96(0x112)])?{'error':_0x2dd27f[_0x50ce96(0x115)]['get'](_0x62787e[_0x50ce96(0x112)])}:{},..._0x2abb96?{'conflict':_0x2abb96}:{},..._0x2dd27f[_0x50ce96(0x10c)][_0x50ce96(0xb5)](_0x62787e[_0x50ce96(0x112)])?{'datasetCode':_0x526afb?.[_0x50ce96(0xc5)],'bindingPreserved':!![],'warnings':[existingHookWarning(_0x62787e['lockKey'])]}:{},..._0x1c7397?{'alias':_0x1c7397[_0x50ce96(0x105)]??null,'datasetCode':_0x1c7397[_0x50ce96(0xc5)],'operationType':_0x62787e[_0x50ce96(0xd9)],'functionNode':_0x62787e[_0x50ce96(0xbf)],'warnings':_0x1c7397[_0x50ce96(0x109)]}:{}});}return{'method':_0x50ce96(0xdd),'url':'/api/management/library/scripts/save','body':{'appCode':_0x4d58a6['appCode'],'force':_0x3cf14b,'files':_0x20a7c7,'cacheClearAtRuntime':_0x20a7c7['some'](_0x423093=>_0x423093[_0x50ce96(0xfc)]===_0x50ce96(0xcc)),'cacheClearAtRuntimeTimes':_0x20a7c7[_0x50ce96(0xfd)](_0x2a66df=>_0x2a66df[_0x50ce96(0xfc)]===_0x50ce96(0xcc))?CACHE_CLEAR_ATTEMPTS:0x0},'description':_0x50ce96(0xda)+_0x20a7c7[_0x50ce96(0x100)]+_0x50ce96(0xdc)};},async 'execute'(_0xe95505){const _0x306b4e=a43_0x3b97bc,_0x26bd40=loadBffProjectConfig(_0xe95505['appCode']),_0x3ca318=await readBffLockFile(_0x26bd40['lockFilePath']),{lockData:_0x2c3f9b,appLock:_0x575f6d}=ensureLockScope(_0x3ca318??createEmptyBffLock(),_0xe95505['appCode'],_0x26bd40[_0x306b4e(0xf5)],_0x306b4e(0xea)),_0x40faf9=await getTargetFunctions(_0x26bd40,_0xe95505);if(_0x40faf9[_0x306b4e(0x100)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x306b4e(0x101)};const _0x14a059=_0xe95505[_0x306b4e(0xca)](_0x306b4e(0x111)),_0x4e8a94=JSON['parse'](JSON[_0x306b4e(0xf7)](_0x2c3f9b)),_0x494c4d=_0x4e8a94[_0x306b4e(0xd4)][_0xe95505[_0x306b4e(0xde)]];if(!_0x494c4d)throw new Error(_0x306b4e(0xf3)+_0xe95505[_0x306b4e(0xde)]+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x1a3341=_0x40faf9[_0x306b4e(0xfd)](_0x1281b4=>_0x1281b4[_0x306b4e(0x113)]===_0x306b4e(0xd7))?await scanLocalBffFunctions(_0x26bd40,'HOOK'):_0x40faf9,_0xd94f64=await buildHookMaps(_0xe95505[_0x306b4e(0xde)],_0xe95505[_0x306b4e(0xef)],_0x1a3341,_0x494c4d,_0xe95505[_0x306b4e(0xc2)]||_0xe95505[_0x306b4e(0xdb)]?.[_0x306b4e(0xd8)]||_0xe95505[_0x306b4e(0xdb)]?.[_0x306b4e(0xcb)]),_0x581e9f=[],_0x1034ce=[],_0x116842=[],_0x2b0fb1=[];for(const _0x3acaf5 of _0x40faf9){const _0xf9b8ff=_0xd94f64[_0x306b4e(0x115)]['get'](_0x3acaf5[_0x306b4e(0x112)]);if(_0xf9b8ff){_0x2b0fb1[_0x306b4e(0xea)]({'lockKey':_0x3acaf5[_0x306b4e(0x112)],'error':_0xf9b8ff});continue;}const _0x11b2d1=await computeFileHash(_0x3acaf5['filePath']),_0x293147=_0x494c4d[_0x306b4e(0x10a)][_0x3acaf5[_0x306b4e(0x112)]];if(!_0x14a059&&_0x293147&&_0x293147['hash']===_0x11b2d1){_0x1034ce['push']({'lockKey':_0x3acaf5[_0x306b4e(0x112)],'reason':_0x306b4e(0x121)});continue;}if(_0x293147?.[_0x306b4e(0xf4)]&&_0x293147[_0x306b4e(0xbc)]==null){_0x116842[_0x306b4e(0xea)](missingRemoteVersionConflict(_0x3acaf5,_0x293147));continue;}try{await uploadSingleFunction(_0xe95505[_0x306b4e(0xde)],_0x3acaf5,_0x494c4d,_0xd94f64);const _0x2f480d=_0x494c4d[_0x306b4e(0x10a)][_0x3acaf5[_0x306b4e(0x112)]];_0x581e9f[_0x306b4e(0xea)]({'lockKey':_0x3acaf5['lockKey'],'remoteId':_0x2f480d?.['remoteId']??0x0});}catch(_0x3f1bbd){const _0x110407=remoteVersionChangedConflict(_0x3acaf5,_0x293147,_0x3f1bbd);if(_0x110407){_0x116842['push'](_0x110407);continue;}_0x2b0fb1[_0x306b4e(0xea)]({'lockKey':_0x3acaf5[_0x306b4e(0x112)],'error':_0x3f1bbd instanceof Error?_0x3f1bbd[_0x306b4e(0xd5)]:String(_0x3f1bbd)});}}_0x494c4d[_0x306b4e(0x11d)]=new Date()['toISOString'](),await writeBffLockFile(_0x26bd40[_0x306b4e(0x11a)],_0x4e8a94),await waitForUploadedLockEntries(_0x26bd40[_0x306b4e(0x11a)],_0xe95505[_0x306b4e(0xde)],_0x581e9f[_0x306b4e(0xfe)](_0x18bcfa=>_0x18bcfa[_0x306b4e(0x112)]));let _0x5ca175={'attempted':![],'cleared':![]};if(_0x581e9f[_0x306b4e(0x100)]>0x0)try{let _0x5f2909='';for(let _0x1db719=0x0;_0x1db719<CACHE_CLEAR_ATTEMPTS;_0x1db719+=0x1){_0x5f2909=await clearBffScriptCache(),_0x1db719<CACHE_CLEAR_ATTEMPTS-0x1&&await sleep(CACHE_CLEAR_INTERVAL_MS);}_0x5ca175={'attempted':!![],'cleared':!![],'message':_0x5f2909||'Runtime\x20script\x20cache\x20cleared.'};}catch(_0x1e760f){_0x5ca175={'attempted':!![],'cleared':![],'error':_0x1e760f instanceof Error?_0x1e760f[_0x306b4e(0xd5)]:String(_0x1e760f)};}const _0x4be922=_0x2b0fb1[_0x306b4e(0x100)]===0x0&&(_0x5ca175[_0x306b4e(0xec)]?_0x5ca175[_0x306b4e(0xe2)]:!![]),_0x9964ac=_0x4be922,_0x73e5ba=_0x5ca175[_0x306b4e(0xec)]?_0x5ca175[_0x306b4e(0xe2)]?_0x306b4e(0xdf):_0x306b4e(0xe9):'runtime\x20cache\x20not\x20needed';return{'ok':_0x9964ac,'data':{'uploaded':_0x581e9f,'skipped':_0x1034ce,'conflicts':_0x116842,'failed':_0x2b0fb1,'cacheClear':_0x5ca175,'warnings':[...[..._0xd94f64['resolutions']['values']()][_0x306b4e(0x116)](_0x5db908=>_0x5db908['warnings']),...[..._0xd94f64[_0x306b4e(0x10c)]][_0x306b4e(0xfe)](existingHookWarning)]},'message':formatPushMessage(_0x581e9f[_0x306b4e(0x100)],_0x1034ce[_0x306b4e(0x100)],_0x116842[_0x306b4e(0x100)],_0x2b0fb1[_0x306b4e(0x100)],_0x73e5ba)};}};function missingRemoteVersionConflict(_0x2d0446,_0x1b0093){const _0x49f3bf=a43_0x3b97bc;return remoteVersionConflict(_0x2d0446,_0x1b0093,_0x49f3bf(0xc3),_0x49f3bf(0x120));}function remoteVersionChangedConflict(_0x594a55,_0x26b0e4,_0x393875){const _0x551139=a43_0x3b97bc;if(!_0x26b0e4?.[_0x551139(0xf4)]||_0x26b0e4[_0x551139(0xbc)]==null||!isRemoteVersionConflict(_0x393875))return undefined;return remoteVersionConflict(_0x594a55,_0x26b0e4,_0x551139(0x110),_0x551139(0xfb));}function remoteVersionConflict(_0x1cf124,_0x356bbb,_0x3cbda9,_0x2cf481){const _0x26312b=a43_0x3b97bc;return{'code':_0x3cbda9,'lockKey':_0x1cf124[_0x26312b(0x112)],'filePath':_0x1cf124[_0x26312b(0xce)],'remoteId':_0x356bbb[_0x26312b(0xf4)],..._0x356bbb[_0x26312b(0xbc)]!=null?{'expectedVersion':_0x356bbb[_0x26312b(0xbc)]}:{},'message':_0x2cf481,'nextAction':{'action':_0x26312b(0xd2),'command':CLI_BIN_NAME+_0x26312b(0xd1)+_0x356bbb[_0x26312b(0xf4)]+_0x26312b(0x102),'requiresReview':!![],'message':_0x26312b(0xb3)}};}function isRemoteVersionConflict(_0x317098){const _0x3a7622=a43_0x3b97bc,_0x759662=_0x317098 instanceof Error?_0x317098[_0x3a7622(0xd5)]:String(_0x317098),_0x53e81a=getPlatformErrorCode(_0x317098)??'';return[_0x759662,_0x53e81a][_0x3a7622(0xfd)](_0x156fc0=>/(?:version|optimistic)[\s_-]*(?:conflict|mismatch|changed|stale|out[\s_-]*of[\s_-]*date)|(?:conflict|mismatch|changed|stale|out[\s_-]*of[\s_-]*date)[\s_-]*(?:version|optimistic)/i['test'](_0x156fc0));}function formatPushMessage(_0x17f77d,_0x16eb1b,_0x412246,_0x44caf1,_0x54d168){const _0x582cd4=a43_0x3b97bc,_0x20cd98=[_0x582cd4(0xc6)+_0x17f77d+_0x582cd4(0xff),_0x16eb1b+'\x20skipped'];_0x412246>0x0&&_0x20cd98[_0x582cd4(0xea)](_0x412246+_0x582cd4(0x11e)+(_0x412246===0x1?'':'s')+'\x20'+(_0x412246===0x1?'requires':_0x582cd4(0xc1))+_0x582cd4(0xf0));if(_0x44caf1>0x0)_0x20cd98[_0x582cd4(0xea)](_0x44caf1+'\x20failed');return _0x20cd98[_0x582cd4(0xea)](_0x54d168),_0x20cd98[_0x582cd4(0xb6)](',\x20');}async function getTargetFunctions(_0x404ec0,_0x59ac89){const _0x4dad38=a43_0x3b97bc,_0x4690b6=_0x59ac89['str'](_0x4dad38(0x113)),_0x247ab2=_0x59ac89[_0x4dad38(0x10f)]('name'),_0x50823b=normalizeBffType(_0x4690b6)??undefined;if(_0x247ab2&&!_0x50823b)throw CliErrors[_0x4dad38(0x114)](_0x4dad38(0xbb));const _0x7da617=await scanLocalBffFunctions(_0x404ec0,_0x50823b);if(_0x247ab2){const _0x2bffbe=_0x7da617[_0x4dad38(0xb9)](_0x38f265=>_0x38f265[_0x4dad38(0xbd)]===_0x247ab2);if(_0x2bffbe[_0x4dad38(0x100)]===0x0)throw CliErrors['validation'](_0x4dad38(0x10e)+_0x50823b+'/'+_0x247ab2);return _0x2bffbe;}return _0x7da617;}function existingHookWarning(_0x223440){const _0x2d279b=a43_0x3b97bc;return{'code':_0x2d279b(0xe1),'lockKey':_0x223440,'message':_0x2d279b(0xc0)};}async function buildHookMaps(_0x497d1f,_0x466651,_0x5c0814,_0x380052,_0x4a68c0){const _0x24342c=a43_0x3b97bc,_0x3564fe=_0x5c0814[_0x24342c(0xfd)](_0x23f612=>_0x23f612[_0x24342c(0x113)]===_0x24342c(0xd7));if(!_0x3564fe)return{'resolutions':new Map(),'failures':new Map(),'existingHooks':new Set()};const _0x276c4d=resolveApiModelSource(_0x466651,_0x497d1f,_0x4a68c0),_0x4c0ea2=loadAliasMap(_0x466651,undefined,_0x276c4d[_0x24342c(0xce)],_0x276c4d[_0x24342c(0x119)]);assertUnambiguousHookAliases(_0x4c0ea2);const _0x44ec6e=[..._0x4c0ea2['map'](_0x51cf02=>[_0x51cf02[_0x24342c(0x105)],_0x51cf02['datasetCode']]),...trackedHookDirectoryMappings(_0x380052)[_0x24342c(0xfe)](_0x3c1bd5=>[_0x3c1bd5[_0x24342c(0x105)],_0x3c1bd5[_0x24342c(0xc5)]])],_0xca0ee9=await listDatasets(_0x497d1f);assertUnambiguousHookDirectoryMappings(_0x44ec6e['map'](([_0x229650,_0x37b18c])=>({'alias':_0x229650,'datasetCode':_0x37b18c})));const _0xea724d=buildHookDirectoryIndexes(_0xca0ee9,_0x44ec6e),_0x4e145b=new Map(),_0x228117=preflightPushHookDirectories(_0x5c0814,_0x380052,_0xea724d,_0x4e145b),_0xd65c70=new Set(),_0x585076=_0x5c0814['filter'](_0x262f1c=>_0x4e145b[_0x24342c(0x103)](_0x262f1c[_0x24342c(0x112)])?.[_0x24342c(0xbe)](_0x24342c(0x107))&&_0x380052['functions'][_0x262f1c[_0x24342c(0x112)]]?.[_0x24342c(0xf4)]&&_0x380052['functions'][_0x262f1c[_0x24342c(0x112)]]?.[_0x24342c(0xc5)]);if(_0x585076[_0x24342c(0x100)]>0x0){let _0x20c9bf;try{_0x20c9bf=await getBffScriptStatistics(_0x497d1f);}catch(_0x35e880){for(const _0x4f4dfd of _0x585076)_0x4e145b[_0x24342c(0xe0)](_0x4f4dfd['lockKey'],_0x24342c(0xcd)+(_0x35e880 instanceof Error?_0x35e880['message']:String(_0x35e880)));return{'resolutions':_0x228117,'failures':_0x4e145b,'existingHooks':_0xd65c70};}for(const _0x4cb223 of _0x585076){const _0x5b9c51=_0x380052[_0x24342c(0x10a)][_0x4cb223[_0x24342c(0x112)]];try{const _0xfbf923=new Set(_0x5c0814[_0x24342c(0xb9)](_0x5aaf1b=>_0x5aaf1b[_0x24342c(0x113)]==='HOOK'&&_0x380052[_0x24342c(0x10a)][_0x5aaf1b[_0x24342c(0x112)]]?.[_0x24342c(0xc5)]===_0x5b9c51['datasetCode'])['map'](_0x31f82b=>_0x31f82b['alias']));if(_0xfbf923[_0x24342c(0xd6)]>0x1)throw CliErrors[_0x24342c(0x114)]('Multiple\x20HOOK\x20directories\x20reference\x20the\x20same\x20missing\x20Dataset.\x20Resolve\x20duplicate\x20directories\x20before\x20pushing.');const _0x4190ba=_0x20c9bf[_0x24342c(0x116)](_0x5c6345=>[{'datasetCode':_0x5c6345['datasetCode'],'operationType':snakeToCamel(_0x5c6345['operationType']),'functionNode':_0x24342c(0xf9),'id':_0x5c6345['beforeScriptId']},{'datasetCode':_0x5c6345['datasetCode'],'operationType':snakeToCamel(_0x5c6345['operationType']),'functionNode':'after','id':_0x5c6345[_0x24342c(0xc9)]}])['filter'](_0x5d4bf3=>_0x5d4bf3['id']===_0x5b9c51['remoteId']),_0x465c77=await getBffScriptInfo(_0x5b9c51['remoteId']);if(_0x465c77['id']!==_0x5b9c51[_0x24342c(0xf4)]||_0x465c77[_0x24342c(0xde)]!==_0x497d1f||_0x465c77[_0x24342c(0x11f)]!==_0x24342c(0xd7)||_0x465c77[_0x24342c(0x11c)]!==_0x4cb223[_0x24342c(0xbd)]||_0x5b9c51['version']==null||_0x465c77[_0x24342c(0xbc)]!==_0x5b9c51[_0x24342c(0xbc)]||_0x4190ba[_0x24342c(0x100)]!==0x1||_0x4190ba[0x0][_0x24342c(0xc5)]!==_0x5b9c51['datasetCode']||_0x4190ba[0x0][_0x24342c(0xd9)]!==_0x4cb223[_0x24342c(0xd9)]||_0x4190ba[0x0][_0x24342c(0xbf)]!==_0x4cb223[_0x24342c(0xbf)]||_0x5b9c51['operationType']!==_0x4cb223[_0x24342c(0xd9)]||_0x5b9c51[_0x24342c(0xbf)]!==_0x4cb223[_0x24342c(0xbf)])throw CliErrors['validation'](_0x24342c(0x122));_0xd65c70['add'](_0x4cb223[_0x24342c(0x112)]),_0x4e145b[_0x24342c(0xee)](_0x4cb223[_0x24342c(0x112)]);}catch(_0x1de0ac){_0x4e145b[_0x24342c(0xe0)](_0x4cb223['lockKey'],_0x1de0ac instanceof Error?_0x1de0ac['message']:String(_0x1de0ac));}}}return{'resolutions':_0x228117,'failures':_0x4e145b,'existingHooks':_0xd65c70};}async function uploadSingleFunction(_0x6be797,_0x9f5290,_0x40fd0f,_0x1fc7df){const _0x1ee8fc=a43_0x3b97bc,_0x42d6e9=await readFile(_0x9f5290['filePath'],'utf8'),_0x4f2c7a=await computeFileHash(_0x9f5290[_0x1ee8fc(0xce)]),_0x30aad2=_0x40fd0f[_0x1ee8fc(0x10a)][_0x9f5290['lockKey']];if(_0x30aad2?.[_0x1ee8fc(0xf4)]&&_0x30aad2[_0x1ee8fc(0xbc)]==null)throw CliErrors[_0x1ee8fc(0x114)](_0x9f5290[_0x1ee8fc(0x112)]+_0x1ee8fc(0xd0));let _0x4e74bf=extractScriptDescription(_0x42d6e9);if(!_0x4e74bf&&_0x30aad2?.[_0x1ee8fc(0xf4)]){const _0x99ae4=await getBffScriptInfo(_0x30aad2[_0x1ee8fc(0xf4)]);_0x4e74bf=_0x99ae4['description']||undefined;}const _0x470d93={'appCode':_0x6be797,'functionName':_0x9f5290['name'],'scriptType':_0x9f5290[_0x1ee8fc(0x113)],'scriptContent':_0x42d6e9};if(_0x30aad2?.[_0x1ee8fc(0xf4)])_0x470d93['id']=_0x30aad2[_0x1ee8fc(0xf4)];if(_0x30aad2?.['version']!=null)_0x470d93[_0x1ee8fc(0xbc)]=_0x30aad2[_0x1ee8fc(0xbc)];if(_0x4e74bf)_0x470d93[_0x1ee8fc(0xba)]=_0x4e74bf;if(_0x9f5290['type']===_0x1ee8fc(0xd7)){const _0x490190=_0x1fc7df['resolutions'][_0x1ee8fc(0x103)](_0x9f5290[_0x1ee8fc(0x112)]);if(!_0x490190&&!_0x1fc7df[_0x1ee8fc(0x10c)][_0x1ee8fc(0xb5)](_0x9f5290[_0x1ee8fc(0x112)])||!_0x9f5290[_0x1ee8fc(0xd9)]||!_0x9f5290[_0x1ee8fc(0xbf)])throw CliErrors[_0x1ee8fc(0x114)](_0x1ee8fc(0xc7)+_0x9f5290[_0x1ee8fc(0x112)]);_0x490190&&(_0x470d93[_0x1ee8fc(0xc8)]=_0x490190[_0x1ee8fc(0xf6)]['id'],_0x470d93[_0x1ee8fc(0xd9)]=_0x9f5290[_0x1ee8fc(0xd9)]),_0x470d93[_0x1ee8fc(0xbf)]=_0x9f5290[_0x1ee8fc(0xbf)];}const _0x56b08d=await saveBffScript(_0x470d93),_0x491e1e=_0x56b08d['id'],_0x7a073b=_0x56b08d[_0x1ee8fc(0xe8)]??await getBffScriptInfo(_0x491e1e),_0x27730f={'hash':_0x4f2c7a,'remoteId':_0x491e1e,'version':_0x7a073b['version']};if(_0x9f5290[_0x1ee8fc(0x113)]===_0x1ee8fc(0xd7)){const _0x49e8bf=_0x1fc7df['resolutions'][_0x1ee8fc(0x103)](_0x9f5290['lockKey']);if(!_0x49e8bf){_0x40fd0f[_0x1ee8fc(0x10a)][_0x9f5290['lockKey']]={..._0x30aad2,..._0x27730f};return;}_0x27730f['alias']=_0x49e8bf[_0x1ee8fc(0x105)]??_0x30aad2?.['alias'],_0x27730f[_0x1ee8fc(0xc5)]=_0x49e8bf[_0x1ee8fc(0xc5)],_0x27730f['operationType']=_0x9f5290['operationType'],_0x27730f[_0x1ee8fc(0xbf)]=_0x9f5290[_0x1ee8fc(0xbf)];}_0x40fd0f[_0x1ee8fc(0x10a)][_0x9f5290[_0x1ee8fc(0x112)]]=_0x27730f;}const LOCK_SETTLE_RETRY_COUNT=0x14,LOCK_SETTLE_DELAY_MS=0x64;async function waitForUploadedLockEntries(_0x4858b2,_0x34d0bc,_0x8ea953){const _0xc17c8f=a43_0x3b97bc;if(_0x8ea953[_0xc17c8f(0x100)]===0x0)return;for(let _0x54ff15=0x0;_0x54ff15<LOCK_SETTLE_RETRY_COUNT;_0x54ff15+=0x1){const _0x36355f=await readBffLockFile(_0x4858b2),_0x27549b=_0x36355f?.[_0xc17c8f(0xd4)]?.[_0x34d0bc]?.[_0xc17c8f(0x10a)]??{},_0x489468=_0x8ea953[_0xc17c8f(0x117)](_0x1a5f8f=>!!_0x27549b[_0x1a5f8f]?.[_0xc17c8f(0xf4)]);if(_0x489468)return;await sleep(LOCK_SETTLE_DELAY_MS);}throw new Error(_0xc17c8f(0xfa)+_0x8ea953[_0xc17c8f(0xb6)](',\x20')+'.');}
@@ -1 +1 @@
1
- const a38_0x5808c3=a38_0x9dec;(function(_0x15a9b8,_0x13758a){const _0x7a043c=a38_0x9dec,_0xcd05fb=_0x15a9b8();while(!![]){try{const _0x2f63fc=parseInt(_0x7a043c(0x182))/0x1*(-parseInt(_0x7a043c(0x16e))/0x2)+parseInt(_0x7a043c(0x16d))/0x3+parseInt(_0x7a043c(0x17f))/0x4+-parseInt(_0x7a043c(0x17e))/0x5*(parseInt(_0x7a043c(0x187))/0x6)+-parseInt(_0x7a043c(0x181))/0x7+-parseInt(_0x7a043c(0x17d))/0x8*(-parseInt(_0x7a043c(0x179))/0x9)+parseInt(_0x7a043c(0x16b))/0xa;if(_0x2f63fc===_0x13758a)break;else _0xcd05fb['push'](_0xcd05fb['shift']());}catch(_0xfe907d){_0xcd05fb['push'](_0xcd05fb['shift']());}}}(a38_0x20c6,0x22898));function a38_0x9dec(_0x1ff10e,_0x465397){_0x1ff10e=_0x1ff10e-0x16b;const _0x20c62e=a38_0x20c6();let _0x9dec3=_0x20c62e[_0x1ff10e];return _0x9dec3;}import{listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeFileHash}from'../../core/bff/hash.js';function a38_0x20c6(){const _0x40c1ad=['apiDir','status','lockKey','8oCOwgT','25225ndaxMf','552600ZaJjAG','\x20unchanged','1723771XqiwtL','81BqDYGG','map','alias','\x20modified,\x20','all','318PkGQYA','push','appCode','lockFilePath','\x20added,\x20','functions','4524970GNJaMl','filePath','240234OzdNBV','1566EWeqpy','length','bff','\x20remote-only','read','has','All\x20Backend\x20Function\x20scripts\x20are\x20in\x20sync.','datasetCode','Check\x20local\x20Backend\x20Function\x20sync\x20status\x20against\x20lock\x20file','remote','bool','430200wkwAkX'];a38_0x20c6=function(){return _0x40c1ad;};return a38_0x20c6();}import{createEmptyBffLock,ensureLockScope,readBffLockFile}from'../../core/bff/lock.js';export const bffStatus={'service':a38_0x5808c3(0x170),'command':a38_0x5808c3(0x17b),'description':a38_0x5808c3(0x176),'risk':a38_0x5808c3(0x172),'flags':[{'name':a38_0x5808c3(0x177),'type':'boolean','description':'Also\x20check\x20for\x20remote-only\x20scripts\x20not\x20present\x20locally'}],async 'execute'(_0x5edd1b){const _0x1aa88a=a38_0x5808c3,_0x208882=loadBffProjectConfig(_0x5edd1b[_0x1aa88a(0x189)]),_0x2bb9c1=await readBffLockFile(_0x208882[_0x1aa88a(0x18a)]),{appLock:_0x2a3943}=ensureLockScope(_0x2bb9c1??createEmptyBffLock(),_0x5edd1b[_0x1aa88a(0x189)],_0x208882['scriptsRoot'],_0x1aa88a(0x17b)),_0x11ea41=await scanLocalBffFunctions(_0x208882),_0x5c7da5=[],_0x30a611=[],_0x104cbc=[];for(const _0x3d26c1 of _0x11ea41){const _0x172700=await computeFileHash(_0x3d26c1[_0x1aa88a(0x16c)]),_0x17f715=_0x2a3943[_0x1aa88a(0x18c)][_0x3d26c1[_0x1aa88a(0x17c)]];if(!_0x17f715)_0x5c7da5[_0x1aa88a(0x188)](_0x3d26c1['lockKey']);else _0x17f715['hash']!==_0x172700?_0x30a611['push'](_0x3d26c1[_0x1aa88a(0x17c)]):_0x104cbc['push'](_0x3d26c1[_0x1aa88a(0x17c)]);}const _0x64c49a=[];if(_0x5edd1b[_0x1aa88a(0x178)](_0x1aa88a(0x177))){const _0x116a16=loadAliasMap(_0x5edd1b[_0x1aa88a(0x17a)],undefined,resolveApiFilePath(_0x5edd1b[_0x1aa88a(0x17a)],_0x5edd1b['appCode'])),_0x471726=new Map(_0x116a16[_0x1aa88a(0x183)](_0x4b323f=>[_0x4b323f[_0x1aa88a(0x175)],_0x4b323f[_0x1aa88a(0x184)]])),[_0x289542,_0x53a7fb]=await Promise[_0x1aa88a(0x186)]([listBffScripts(_0x5edd1b[_0x1aa88a(0x189)]),getBffScriptStatistics(_0x5edd1b['appCode'])]),_0x2e969e=createHookLocationMap(_0x53a7fb),_0x15aab6=new Set(_0x11ea41[_0x1aa88a(0x183)](_0x3cbeac=>_0x3cbeac[_0x1aa88a(0x17c)]));for(const _0x348c53 of _0x289542){const _0x5a8504=resolveRemoteScriptTarget(_0x208882,_0x348c53,_0x2e969e,_0x2a3943['functions'],_0x471726);_0x5a8504&&!_0x15aab6[_0x1aa88a(0x173)](_0x5a8504[_0x1aa88a(0x17c)])&&_0x64c49a['push'](_0x5a8504['lockKey']);}}const _0xca8288=_0x5c7da5[_0x1aa88a(0x16f)]===0x0&&_0x30a611[_0x1aa88a(0x16f)]===0x0&&_0x64c49a[_0x1aa88a(0x16f)]===0x0;return{'ok':!![],'data':{'added':_0x5c7da5,'modified':_0x30a611,'unchanged':_0x104cbc,'remoteOnly':_0x64c49a},'message':_0xca8288?_0x1aa88a(0x174):_0x5c7da5[_0x1aa88a(0x16f)]+_0x1aa88a(0x18b)+_0x30a611[_0x1aa88a(0x16f)]+_0x1aa88a(0x185)+_0x104cbc[_0x1aa88a(0x16f)]+_0x1aa88a(0x180)+(_0x64c49a[_0x1aa88a(0x16f)]>0x0?',\x20'+_0x64c49a['length']+_0x1aa88a(0x171):'')};}};
1
+ const a44_0x410065=a44_0x51e6;(function(_0x263b16,_0x5850f5){const _0x4f2e14=a44_0x51e6,_0x5e104b=_0x263b16();while(!![]){try{const _0x51acee=parseInt(_0x4f2e14(0x19f))/0x1*(parseInt(_0x4f2e14(0x19c))/0x2)+parseInt(_0x4f2e14(0x1a2))/0x3*(-parseInt(_0x4f2e14(0x1a5))/0x4)+parseInt(_0x4f2e14(0x19b))/0x5+parseInt(_0x4f2e14(0x197))/0x6+-parseInt(_0x4f2e14(0x1a3))/0x7+parseInt(_0x4f2e14(0x19e))/0x8*(-parseInt(_0x4f2e14(0x194))/0x9)+parseInt(_0x4f2e14(0x19a))/0xa;if(_0x51acee===_0x5850f5)break;else _0x5e104b['push'](_0x5e104b['shift']());}catch(_0x1d6791){_0x5e104b['push'](_0x5e104b['shift']());}}}(a44_0x26de,0x24710));function a44_0x26de(){const _0x12751f=['all','functions','datasetCode','Also\x20check\x20for\x20remote-only\x20scripts\x20not\x20present\x20locally','\x20unchanged','All\x20Backend\x20Function\x20scripts\x20are\x20in\x20sync.','selectedAppName','has','remote','18DBHVgX','scriptsRoot','\x20remote-only','761142MXlojQ','currentApp','push','3491740dgksFY','559785yaZiEf','16JqNihO','lockKey','156856lPCPBb','12952GQWDiQ','length','lockFilePath','296601hMWReJ','1445675aEEcXe','status','12kQfsZq','apiDir','filePath','hash','mergedCli','\x20added,\x20','\x20modified,\x20','appCode','defaultApp','map','boolean','alias'];a44_0x26de=function(){return _0x12751f;};return a44_0x26de();}function a44_0x51e6(_0x50e57d,_0x1c2f1c){_0x50e57d=_0x50e57d-0x182;const _0x26dec0=a44_0x26de();let _0x51e694=_0x26dec0[_0x50e57d];return _0x51e694;}import{listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile}from'../../core/bff/lock.js';export const bffStatus={'service':'bff','command':a44_0x410065(0x1a4),'description':'Check\x20local\x20Backend\x20Function\x20sync\x20status\x20against\x20lock\x20file','risk':'read','flags':[{'name':a44_0x410065(0x193),'type':a44_0x410065(0x189),'description':a44_0x410065(0x18e)}],async 'execute'(_0x54c50d){const _0x4f6630=a44_0x410065,_0x1ca6eb=loadBffProjectConfig(_0x54c50d[_0x4f6630(0x186)]),_0x5ab944=await readBffLockFile(_0x1ca6eb[_0x4f6630(0x1a1)]),{appLock:_0x3a65c9}=ensureLockScope(_0x5ab944??createEmptyBffLock(),_0x54c50d[_0x4f6630(0x186)],_0x1ca6eb[_0x4f6630(0x195)],'status'),_0xd61318=await scanLocalBffFunctions(_0x1ca6eb),_0x312398=[],_0x5e661c=[],_0x185d33=[];for(const _0x2f66c4 of _0xd61318){const _0x2c34fe=await computeFileHash(_0x2f66c4[_0x4f6630(0x1a7)]),_0x6f14b2=_0x3a65c9[_0x4f6630(0x18c)][_0x2f66c4[_0x4f6630(0x19d)]];if(!_0x6f14b2)_0x312398[_0x4f6630(0x199)](_0x2f66c4[_0x4f6630(0x19d)]);else _0x6f14b2[_0x4f6630(0x182)]!==_0x2c34fe?_0x5e661c['push'](_0x2f66c4['lockKey']):_0x185d33['push'](_0x2f66c4[_0x4f6630(0x19d)]);}const _0x32b6d6=[];if(_0x54c50d['bool'](_0x4f6630(0x193))){const _0xfe967a=resolveApiModelSource(_0x54c50d[_0x4f6630(0x1a6)],_0x54c50d[_0x4f6630(0x186)],_0x54c50d[_0x4f6630(0x191)]||_0x54c50d['mergedCli']?.[_0x4f6630(0x198)]||_0x54c50d[_0x4f6630(0x183)]?.[_0x4f6630(0x187)]),_0x4bde7a=loadAliasMap(_0x54c50d[_0x4f6630(0x1a6)],undefined,_0xfe967a[_0x4f6630(0x1a7)],_0xfe967a['profileName']),_0x8cfe1c=new Map(_0x4bde7a['map'](_0x57e5ce=>[_0x57e5ce[_0x4f6630(0x18d)],_0x57e5ce[_0x4f6630(0x18a)]])),[_0x407ad8,_0x548783]=await Promise[_0x4f6630(0x18b)]([listBffScripts(_0x54c50d[_0x4f6630(0x186)]),getBffScriptStatistics(_0x54c50d[_0x4f6630(0x186)])]),_0x5bd529=createHookLocationMap(_0x548783),_0x308352=new Set(_0xd61318[_0x4f6630(0x188)](_0x1521c0=>_0x1521c0[_0x4f6630(0x19d)]));for(const _0x173da1 of _0x407ad8){const _0xd728eb=resolveRemoteScriptTarget(_0x1ca6eb,_0x173da1,_0x5bd529,_0x3a65c9[_0x4f6630(0x18c)],_0x8cfe1c);_0xd728eb&&!_0x308352[_0x4f6630(0x192)](_0xd728eb['lockKey'])&&_0x32b6d6[_0x4f6630(0x199)](_0xd728eb[_0x4f6630(0x19d)]);}}const _0x323a0b=_0x312398[_0x4f6630(0x1a0)]===0x0&&_0x5e661c[_0x4f6630(0x1a0)]===0x0&&_0x32b6d6[_0x4f6630(0x1a0)]===0x0;return{'ok':!![],'data':{'added':_0x312398,'modified':_0x5e661c,'unchanged':_0x185d33,'remoteOnly':_0x32b6d6},'message':_0x323a0b?_0x4f6630(0x190):_0x312398[_0x4f6630(0x1a0)]+_0x4f6630(0x184)+_0x5e661c[_0x4f6630(0x1a0)]+_0x4f6630(0x185)+_0x185d33['length']+_0x4f6630(0x18f)+(_0x32b6d6['length']>0x0?',\x20'+_0x32b6d6[_0x4f6630(0x1a0)]+_0x4f6630(0x196):'')};}};