@lovrabet/rabetbase-cli 2.5.13-beta.1 → 2.6.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. package/README.md +42 -17
  2. package/lib/api/api-doc.js +3 -1
  3. package/lib/api/api-group.js +3 -1
  4. package/lib/api/fetch-model-list.js +1 -1
  5. package/lib/api/generate-api-file.js +8 -1
  6. package/lib/api/generate-sdk-config-file.js +1 -1
  7. package/lib/api/legacy-api-file.js +2 -1
  8. package/lib/api/model-registry-file.js +11 -1
  9. package/lib/api/model-registry-scaffold.js +2 -1
  10. package/lib/api/model-source.js +3 -1
  11. package/lib/auth/auth-server-ui.js +2 -1
  12. package/lib/auth/auth-server.js +5 -1
  13. package/lib/auth/constant.js +1 -1
  14. package/lib/auth/get-cookie.js +1 -1
  15. package/lib/auth/get-session-user.js +1 -1
  16. package/lib/auth/is-session-valid.js +1 -1
  17. package/lib/auth/login-success-html.js +3 -1
  18. package/lib/auth/logout.js +1 -1
  19. package/lib/cli-flags.js +1 -1
  20. package/lib/cli.js +5 -1
  21. package/lib/commands/api/generate.js +4 -1
  22. package/lib/commands/api/index.js +1 -1
  23. package/lib/commands/api/list.js +2 -1
  24. package/lib/commands/api/pull.js +10 -1
  25. package/lib/commands/api/shared.js +1 -1
  26. package/lib/commands/app/detail.js +1 -1
  27. package/lib/commands/app/index.js +1 -1
  28. package/lib/commands/app/list.js +5 -1
  29. package/lib/commands/app/members-list.js +1 -1
  30. package/lib/commands/app/remote-directory.js +1 -1
  31. package/lib/commands/app/shared.js +4 -1
  32. package/lib/commands/app-config/delete.js +2 -1
  33. package/lib/commands/app-config/get.js +2 -1
  34. package/lib/commands/app-config/index.js +1 -1
  35. package/lib/commands/app-config/list.js +2 -1
  36. package/lib/commands/app-config/set.js +3 -1
  37. package/lib/commands/app-config/shared.d.ts +9 -2
  38. package/lib/commands/app-config/shared.js +6 -1
  39. package/lib/commands/auth/index.js +1 -1
  40. package/lib/commands/bff/create.js +11 -1
  41. package/lib/commands/bff/delete.js +6 -1
  42. package/lib/commands/bff/detail.js +1 -1
  43. package/lib/commands/bff/index.js +1 -1
  44. package/lib/commands/bff/list.js +1 -1
  45. package/lib/commands/bff/logs.js +4 -1
  46. package/lib/commands/bff/pull.js +22 -1
  47. package/lib/commands/bff/push.js +16 -1
  48. package/lib/commands/bff/status.js +3 -1
  49. package/lib/commands/cli-skill/index.js +2 -1
  50. package/lib/commands/cli-update.js +7 -1
  51. package/lib/commands/codegen/index.js +1 -1
  52. package/lib/commands/codegen/sdk.js +1 -1
  53. package/lib/commands/codegen/sql.js +1 -1
  54. package/lib/commands/common/app-registry.js +4 -1
  55. package/lib/commands/common/app-selector.js +4 -1
  56. package/lib/commands/common/async-task.js +2 -1
  57. package/lib/commands/common/dry-run.js +1 -1
  58. package/lib/commands/common/flags.js +3 -1
  59. package/lib/commands/common/local-file.js +1 -1
  60. package/lib/commands/common/validate.js +1 -1
  61. package/lib/commands/config/delete.js +2 -1
  62. package/lib/commands/config/get.js +1 -1
  63. package/lib/commands/config/index.js +1 -1
  64. package/lib/commands/config/init.js +5 -1
  65. package/lib/commands/config/list.js +1 -1
  66. package/lib/commands/config/set.js +4 -1
  67. package/lib/commands/config/shared.js +2 -1
  68. package/lib/commands/dataset/batch-design.js +9 -1
  69. package/lib/commands/dataset/business-group-update.js +10 -1
  70. package/lib/commands/dataset/business-groups.js +1 -1
  71. package/lib/commands/dataset/capability.js +3 -1
  72. package/lib/commands/dataset/cross-relation-create.js +2 -1
  73. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  74. package/lib/commands/dataset/cross-relation-list.js +2 -1
  75. package/lib/commands/dataset/cross-relation-shared.js +10 -1
  76. package/lib/commands/dataset/cross-relation-update.js +2 -1
  77. package/lib/commands/dataset/delete.js +6 -1
  78. package/lib/commands/dataset/design-context.js +1 -1
  79. package/lib/commands/dataset/design-start.js +1 -1
  80. package/lib/commands/dataset/design-status.js +1 -1
  81. package/lib/commands/dataset/design-sync-retry.js +1 -1
  82. package/lib/commands/dataset/design-sync-status.js +1 -1
  83. package/lib/commands/dataset/design-validate.js +1 -1
  84. package/lib/commands/dataset/detail.js +5 -1
  85. package/lib/commands/dataset/extend-update.js +7 -1
  86. package/lib/commands/dataset/field-restore.js +7 -1
  87. package/lib/commands/dataset/field-update.js +7 -1
  88. package/lib/commands/dataset/generate.js +19 -1
  89. package/lib/commands/dataset/index.js +3 -1
  90. package/lib/commands/dataset/list.js +2 -1
  91. package/lib/commands/dataset/operations.js +2 -1
  92. package/lib/commands/dataset/relation-audit.js +7 -1
  93. package/lib/commands/dataset/relation-create.js +3 -1
  94. package/lib/commands/dataset/relation-delete.js +3 -1
  95. package/lib/commands/dataset/relation-shared.js +21 -1
  96. package/lib/commands/dataset/relation-update.js +4 -1
  97. package/lib/commands/dataset/relations.js +7 -1
  98. package/lib/commands/dataset/rename.js +4 -1
  99. package/lib/commands/dataset/restore.js +7 -1
  100. package/lib/commands/dataset/user-deleted-field-list.js +3 -1
  101. package/lib/commands/db/analysis-batching.js +3 -1
  102. package/lib/commands/db/analyze-batch-plan.js +2 -1
  103. package/lib/commands/db/analyze-cancel.js +1 -1
  104. package/lib/commands/db/analyze-start.js +3 -1
  105. package/lib/commands/db/analyze-status.js +6 -1
  106. package/lib/commands/db/create.js +4 -1
  107. package/lib/commands/db/cross-db-analysis-shared.js +3 -1
  108. package/lib/commands/db/cross-db-analyze-latest.js +1 -1
  109. package/lib/commands/db/cross-db-analyze-start.js +2 -1
  110. package/lib/commands/db/cross-db-analyze-status.js +1 -1
  111. package/lib/commands/db/delete.js +3 -1
  112. package/lib/commands/db/detail.js +1 -1
  113. package/lib/commands/db/diff-refresh-start.js +1 -1
  114. package/lib/commands/db/diff-refresh-status.js +2 -1
  115. package/lib/commands/db/diff.js +3 -1
  116. package/lib/commands/db/index.js +2 -1
  117. package/lib/commands/db/list.js +2 -1
  118. package/lib/commands/db/shared.js +3 -1
  119. package/lib/commands/db/table-diff-shared.js +2 -1
  120. package/lib/commands/db/tables.js +2 -1
  121. package/lib/commands/db/test.js +2 -1
  122. package/lib/commands/db/update.js +4 -1
  123. package/lib/commands/deployment/index.js +1 -1
  124. package/lib/commands/deployment/sync-all.js +3 -1
  125. package/lib/commands/deployment/sync-jobs.js +2 -1
  126. package/lib/commands/deployment/sync-status.js +2 -1
  127. package/lib/commands/doctor.js +12 -1
  128. package/lib/commands/file/index.js +3 -1
  129. package/lib/commands/flow/create.js +2 -1
  130. package/lib/commands/flow/detail.js +3 -1
  131. package/lib/commands/flow/index.js +1 -1
  132. package/lib/commands/flow/list.js +2 -1
  133. package/lib/commands/flow/page-list.js +2 -1
  134. package/lib/commands/flow/publish.js +2 -1
  135. package/lib/commands/flow/runtime-resources-shared.js +3 -1
  136. package/lib/commands/flow/runtime-role-list.js +2 -1
  137. package/lib/commands/flow/runtime-role-user-list.js +2 -1
  138. package/lib/commands/flow/runtime-user-search.js +2 -1
  139. package/lib/commands/flow/shared.js +6 -1
  140. package/lib/commands/flow/update.js +4 -1
  141. package/lib/commands/flow/validate.js +2 -1
  142. package/lib/commands/instant-api-policy/current.js +1 -1
  143. package/lib/commands/instant-api-policy/index.js +1 -1
  144. package/lib/commands/instant-api-policy/init.js +2 -1
  145. package/lib/commands/instant-api-policy/publish.js +5 -1
  146. package/lib/commands/instant-api-policy/pull.js +2 -1
  147. package/lib/commands/instant-api-policy/revision.js +1 -1
  148. package/lib/commands/instant-api-policy/revisions.js +1 -1
  149. package/lib/commands/instant-api-policy/rollback.js +5 -1
  150. package/lib/commands/instant-api-policy/shared.js +5 -1
  151. package/lib/commands/instant-api-policy/validate.js +1 -1
  152. package/lib/commands/issue/context.js +1 -1
  153. package/lib/commands/issue/index.js +1 -1
  154. package/lib/commands/issue/nudge.js +2 -1
  155. package/lib/commands/issue/report.js +5 -1
  156. package/lib/commands/kb/create.js +5 -1
  157. package/lib/commands/kb/delete.js +5 -1
  158. package/lib/commands/kb/detail.js +1 -1
  159. package/lib/commands/kb/import-api.d.ts +3 -0
  160. package/lib/commands/kb/import-api.js +1 -0
  161. package/lib/commands/kb/import-resume.d.ts +2 -0
  162. package/lib/commands/kb/import-resume.js +2 -0
  163. package/lib/commands/kb/import-shared.d.ts +69 -0
  164. package/lib/commands/kb/import-shared.js +9 -0
  165. package/lib/commands/kb/import-status.d.ts +2 -0
  166. package/lib/commands/kb/import-status.js +1 -0
  167. package/lib/commands/kb/import.d.ts +2 -0
  168. package/lib/commands/kb/import.js +3 -0
  169. package/lib/commands/kb/index.js +1 -1
  170. package/lib/commands/kb/list.js +1 -1
  171. package/lib/commands/kb/search.js +3 -1
  172. package/lib/commands/kb/shared.js +9 -1
  173. package/lib/commands/kb/update.js +7 -1
  174. package/lib/commands/logs/index.js +2 -1
  175. package/lib/commands/menu/asset-update.js +8 -1
  176. package/lib/commands/menu/delete.js +15 -1
  177. package/lib/commands/menu/external-link-create.js +16 -1
  178. package/lib/commands/menu/external-link-update.js +10 -1
  179. package/lib/commands/menu/group-create.js +8 -1
  180. package/lib/commands/menu/group-update.js +6 -1
  181. package/lib/commands/menu/index.js +2 -1
  182. package/lib/commands/menu/list.js +1 -1
  183. package/lib/commands/menu/move.js +6 -1
  184. package/lib/commands/menu/regroup-start.js +11 -1
  185. package/lib/commands/menu/rename.js +9 -1
  186. package/lib/commands/menu/shared/compare-table.js +2 -1
  187. package/lib/commands/menu/shared/delete-plan.js +13 -1
  188. package/lib/commands/menu/shared/facts.js +5 -1
  189. package/lib/commands/menu/shared/index.js +1 -1
  190. package/lib/commands/menu/shared/inquirer.js +4 -1
  191. package/lib/commands/menu/shared/local-pages.js +5 -1
  192. package/lib/commands/menu/shared/logic.js +3 -1
  193. package/lib/commands/menu/shared/mutations.js +9 -1
  194. package/lib/commands/menu/shared/path.js +1 -1
  195. package/lib/commands/menu/shared/service.js +4 -1
  196. package/lib/commands/menu/shared/subapp-assets.js +4 -1
  197. package/lib/commands/menu/shared/sync-core.js +7 -1
  198. package/lib/commands/menu/shared/types.js +1 -1
  199. package/lib/commands/menu/shared/update-core.js +8 -1
  200. package/lib/commands/menu/shared/valid-url.js +1 -1
  201. package/lib/commands/menu/subapp-assets-status.js +1 -1
  202. package/lib/commands/menu/subapp-assets-update.js +7 -1
  203. package/lib/commands/menu/sync.js +7 -1
  204. package/lib/commands/menu/visibility-update.js +13 -1
  205. package/lib/commands/metric/contract.d.ts +8 -0
  206. package/lib/commands/metric/contract.js +5 -0
  207. package/lib/commands/metric/definition.d.ts +43 -0
  208. package/lib/commands/metric/definition.js +4 -0
  209. package/lib/commands/metric/delete.d.ts +2 -0
  210. package/lib/commands/metric/delete.js +3 -0
  211. package/lib/commands/metric/detail.d.ts +2 -0
  212. package/lib/commands/metric/detail.js +1 -0
  213. package/lib/commands/metric/example.d.ts +2 -0
  214. package/lib/commands/metric/example.js +1 -0
  215. package/lib/commands/metric/index.d.ts +2 -0
  216. package/lib/commands/metric/index.js +1 -0
  217. package/lib/commands/metric/list.d.ts +2 -0
  218. package/lib/commands/metric/list.js +2 -0
  219. package/lib/commands/metric/publication-diff.d.ts +8 -0
  220. package/lib/commands/metric/publication-diff.js +1 -0
  221. package/lib/commands/metric/publish.d.ts +2 -0
  222. package/lib/commands/metric/publish.js +4 -0
  223. package/lib/commands/metric/schema.d.ts +2 -0
  224. package/lib/commands/metric/schema.js +1 -0
  225. package/lib/commands/metric/shared.d.ts +14 -0
  226. package/lib/commands/metric/shared.js +2 -0
  227. package/lib/commands/metric/validate.d.ts +2 -0
  228. package/lib/commands/metric/validate.js +1 -0
  229. package/lib/commands/notification/config-create.js +4 -1
  230. package/lib/commands/notification/config-delete.js +4 -1
  231. package/lib/commands/notification/config-list.js +2 -1
  232. package/lib/commands/notification/config-update.js +4 -1
  233. package/lib/commands/notification/index.js +1 -1
  234. package/lib/commands/notification/shared.js +18 -1
  235. package/lib/commands/ocr/index.js +4 -1
  236. package/lib/commands/page/create.js +6 -1
  237. package/lib/commands/page/custom/detail.js +2 -1
  238. package/lib/commands/page/custom/list.js +2 -1
  239. package/lib/commands/page/custom/publish.js +3 -1
  240. package/lib/commands/page/custom/shared.js +3 -1
  241. package/lib/commands/page/custom/syntax.js +2 -1
  242. package/lib/commands/page/custom/update.js +3 -1
  243. package/lib/commands/page/data-list-status.js +2 -1
  244. package/lib/commands/page/generate-start.js +5 -1
  245. package/lib/commands/page/generate-status.js +4 -1
  246. package/lib/commands/page/index.js +2 -1
  247. package/lib/commands/page/pull.js +6 -1
  248. package/lib/commands/page/push.js +11 -1
  249. package/lib/commands/page/relation-audit.js +15 -1
  250. package/lib/commands/page/restore.js +5 -1
  251. package/lib/commands/page/shared.js +16 -1
  252. package/lib/commands/page/sync.js +2 -1
  253. package/lib/commands/project/api-architecture-upgrade.js +11 -1
  254. package/lib/commands/project/create/enhanced-guided-create.js +2 -1
  255. package/lib/commands/project/create/format-elapsed.js +1 -1
  256. package/lib/commands/project/create/main.js +13 -1
  257. package/lib/commands/project/create/materialize-project-template.js +12 -1
  258. package/lib/commands/project/create/project-name.js +1 -1
  259. package/lib/commands/project/create/project-template-archive.js +5 -1
  260. package/lib/commands/project/create/project-template-path.js +1 -1
  261. package/lib/commands/project/create/use-copy-project-template.js +2 -1
  262. package/lib/commands/project/create/use-format-code.js +1 -1
  263. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  264. package/lib/commands/project/domain-routing-sync.js +1 -1
  265. package/lib/commands/project/index.js +4 -1
  266. package/lib/commands/project/upgrade.js +7 -1
  267. package/lib/commands/registry.js +10 -1
  268. package/lib/commands/role/delete.js +2 -1
  269. package/lib/commands/role/detail.js +1 -1
  270. package/lib/commands/role/index.js +1 -1
  271. package/lib/commands/role/list.js +2 -1
  272. package/lib/commands/role/shared.js +8 -1
  273. package/lib/commands/role/update.js +3 -1
  274. package/lib/commands/role/user-add.js +2 -1
  275. package/lib/commands/role/user-remove.js +2 -1
  276. package/lib/commands/role/user-resolve.js +1 -1
  277. package/lib/commands/rule/get.js +1 -1
  278. package/lib/commands/rule/index.js +1 -1
  279. package/lib/commands/rule/list.js +1 -1
  280. package/lib/commands/rule/set.js +7 -1
  281. package/lib/commands/rule/shared.js +4 -1
  282. package/lib/commands/run/index.js +5 -1
  283. package/lib/commands/schema.js +1 -1
  284. package/lib/commands/sql/create.js +7 -1
  285. package/lib/commands/sql/delete.js +4 -1
  286. package/lib/commands/sql/detail.js +1 -1
  287. package/lib/commands/sql/exec.js +1 -1
  288. package/lib/commands/sql/index.js +1 -1
  289. package/lib/commands/sql/list.js +2 -1
  290. package/lib/commands/sql/pull.js +10 -1
  291. package/lib/commands/sql/push.js +9 -1
  292. package/lib/commands/sql/shared.js +5 -1
  293. package/lib/commands/sql/status.js +3 -1
  294. package/lib/commands/sql/validate.js +5 -1
  295. package/lib/commands/task/index.js +1 -1
  296. package/lib/commands/task/status.js +2 -1
  297. package/lib/commands/tenant/index.js +1 -1
  298. package/lib/commands/tenant/members-list.js +2 -1
  299. package/lib/commands/tenant/shared.js +2 -1
  300. package/lib/commands/user-account/dingding-sandbox-bind.js +2 -1
  301. package/lib/commands/user-account/feishu-bind.js +2 -1
  302. package/lib/commands/user-account/index.js +1 -1
  303. package/lib/commands/workspace/add.js +1 -1
  304. package/lib/commands/workspace/index.js +7 -1
  305. package/lib/commands/workspace/remove.js +1 -1
  306. package/lib/config/domain-config.js +8 -1
  307. package/lib/config/project-domain-routing.js +3 -1
  308. package/lib/config/region-config.js +2 -1
  309. package/lib/config/schema.js +7 -1
  310. package/lib/constant/cdn.js +2 -1
  311. package/lib/constant/cli.js +8 -1
  312. package/lib/constant/defaults.js +1 -1
  313. package/lib/constant/domain.js +4 -1
  314. package/lib/constant/env.js +1 -1
  315. package/lib/constant/output.js +1 -1
  316. package/lib/constant/paths.js +1 -1
  317. package/lib/constant/region.js +1 -1
  318. package/lib/constant/risk.js +1 -1
  319. package/lib/constant/routing-profile.js +1 -1
  320. package/lib/context/app-resolver.js +7 -1
  321. package/lib/context/auth-resolver.js +1 -1
  322. package/lib/context/config-loader.js +7 -1
  323. package/lib/context.js +9 -1
  324. package/lib/core/alias-resolver.js +5 -1
  325. package/lib/core/api-client.d.ts +14 -7
  326. package/lib/core/api-client.js +69 -1
  327. package/lib/core/bff/config.js +1 -1
  328. package/lib/core/bff/file-system.js +6 -1
  329. package/lib/core/bff/hash.js +1 -1
  330. package/lib/core/bff/hook-directory.js +9 -1
  331. package/lib/core/bff/lock.js +2 -1
  332. package/lib/core/bff/types.js +1 -1
  333. package/lib/core/bff/utils.js +3 -1
  334. package/lib/core/cross-db-analysis.js +1 -1
  335. package/lib/core/cross-db-relation.js +1 -1
  336. package/lib/core/db-resolver.js +2 -1
  337. package/lib/core/flow-config.js +49 -1
  338. package/lib/core/instant-api-policy/config.js +7 -1
  339. package/lib/core/instant-api-policy/endpoints.js +1 -1
  340. package/lib/core/kb-management-client.d.ts +11 -0
  341. package/lib/core/kb-management-client.js +4 -1
  342. package/lib/core/kb-search-client.js +3 -1
  343. package/lib/core/page/file-system.js +2 -1
  344. package/lib/core/page/hash.js +1 -1
  345. package/lib/core/page/lock.js +2 -1
  346. package/lib/core/page/lr-smart-jsx.js +4 -1
  347. package/lib/core/page/types.js +1 -1
  348. package/lib/core/sql-index-auditor.js +14 -1
  349. package/lib/core/sql-sync/config.js +1 -1
  350. package/lib/core/sql-sync/file-system.js +3 -1
  351. package/lib/core/sql-sync/hash.js +1 -1
  352. package/lib/core/sql-sync/lock.js +2 -1
  353. package/lib/core/sql-sync/types.js +1 -1
  354. package/lib/core/sql-sync/utils.js +2 -1
  355. package/lib/core/sql-validator.js +15 -1
  356. package/lib/errors.js +3 -1
  357. package/lib/framework/build-all-flags.js +1 -1
  358. package/lib/framework/error-output.js +1 -1
  359. package/lib/framework/explicit-yes.js +1 -1
  360. package/lib/framework/flags.js +1 -1
  361. package/lib/framework/help.js +2 -1
  362. package/lib/framework/index.js +1 -1
  363. package/lib/framework/output.js +2 -1
  364. package/lib/framework/response.js +1 -1
  365. package/lib/framework/runner-alias.js +2 -1
  366. package/lib/framework/runner.js +9 -1
  367. package/lib/framework/schema-export.js +1 -1
  368. package/lib/framework/supported-flags.js +2 -1
  369. package/lib/framework/types.js +1 -1
  370. package/lib/generated/build-info.d.ts +4 -4
  371. package/lib/generated/build-info.js +1 -1
  372. package/lib/generated/official-routing.js +3 -1
  373. package/lib/generated/routing-contract.js +1 -1
  374. package/lib/help.js +1 -1
  375. package/lib/runtime/confirmation.js +2 -1
  376. package/lib/runtime/event.js +1 -1
  377. package/lib/runtime/index.js +4 -1
  378. package/lib/runtime/queue.js +1 -1
  379. package/lib/runtime/resolve.js +2 -1
  380. package/lib/runtime/types.js +1 -1
  381. package/lib/services/dataset-design/checkpoint.js +2 -1
  382. package/lib/services/dataset-design/commands.js +14 -1
  383. package/lib/services/dataset-design/contract.js +8 -1
  384. package/lib/skills/builtin-skill.js +8 -1
  385. package/lib/skills/install-updated-skill.d.ts +8 -0
  386. package/lib/skills/install-updated-skill.js +3 -0
  387. package/lib/skills/local-skills-installer.d.ts +2 -0
  388. package/lib/skills/local-skills-installer.js +1 -0
  389. package/lib/skills/main.js +2 -1
  390. package/lib/skills/npx-skills-add.d.ts +6 -6
  391. package/lib/skills/npx-skills-add.js +5 -1
  392. package/lib/skills/skill-presence.d.ts +1 -30
  393. package/lib/skills/skill-presence.js +2 -1
  394. package/lib/telemetry/cli-command-trace.js +2 -1
  395. package/lib/telemetry/cli-help-trace.js +1 -1
  396. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  397. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  398. package/lib/telemetry/send-cli-trace-log.js +1 -1
  399. package/lib/types/index.js +1 -1
  400. package/lib/utils/ai_config.js +3 -1
  401. package/lib/utils/apply-jq-filter.js +1 -1
  402. package/lib/utils/cdn-config.js +1 -1
  403. package/lib/utils/check-sdk-version.js +5 -1
  404. package/lib/utils/cli-version-check.js +4 -1
  405. package/lib/utils/cli-version-policy.js +3 -1
  406. package/lib/utils/config.js +1 -1
  407. package/lib/utils/entity-with-id.js +1 -1
  408. package/lib/utils/file-utils.js +1 -1
  409. package/lib/utils/guides-cdn.js +3 -1
  410. package/lib/utils/http-client.js +2 -1
  411. package/lib/utils/is-non-interactive.js +1 -1
  412. package/lib/utils/logger.js +3 -1
  413. package/lib/utils/params.js +1 -1
  414. package/lib/utils/platform.js +1 -1
  415. package/lib/utils/sleep.js +1 -1
  416. package/lib/utils/template-replacer.js +5 -1
  417. package/lib/utils/update-notice.js +3 -1
  418. package/lib/utils/version.js +1 -1
  419. package/lib/utils/with-active-cookie.js +1 -1
  420. package/lib/utils/write-cli-side-channel.js +1 -1
  421. package/package.json +10 -7
  422. package/skills/rabetbase/SKILL.md +11 -7
  423. package/skills/rabetbase/guides/backend-function.md +3 -1
  424. package/skills/rabetbase/guides/data-api-guidelines.md +1 -1
  425. package/skills/rabetbase/guides/frontend-development.md +1 -0
  426. package/skills/rabetbase/guides/metric-development.md +185 -0
  427. package/skills/rabetbase/references/rabetbase-app-config.md +4 -3
  428. package/skills/rabetbase/references/rabetbase-cli-skill-install.md +5 -5
  429. package/skills/rabetbase/references/rabetbase-dataset-design.md +1 -1
  430. package/skills/rabetbase/references/rabetbase-kb.md +16 -0
  431. package/skills/rabetbase/references/rabetbase-metric.md +119 -0
  432. package/skills/rabetbase/references/rabetbase-update.md +7 -5
  433. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  434. package/skills/rabetbase-dataset-generation/references/workflow.md +1 -1
  435. package/skills/rabetbase-metrics-generation/SKILL.md +22 -0
  436. package/skills/rabetbase-metrics-generation/references/verification.md +19 -0
  437. package/skills/rabetbase-metrics-generation/references/workflow.md +41 -0
  438. package/skills/rabetbase-metrics-generation/templates/statistics-delivery.md +11 -0
  439. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  440. package/skills/rabetbase-page-generation/references/generation.md +1 -1
  441. package/skills/rabetbase.manifest.json +5 -3
  442. package/templates/metrics/definition.json +78 -0
  443. package/templates/metrics/metric-definition.schema.json +136 -0
  444. package/lib/postinstall.d.ts +0 -3
  445. package/lib/postinstall.js +0 -1
  446. package/scripts/postinstall.mjs +0 -24
@@ -1 +1,4 @@
1
- function a302_0x1657(_0x361ec2,_0x11b266){_0x361ec2=_0x361ec2-0x15a;const _0x4e6419=a302_0x4e64();let _0x1657ce=_0x4e6419[_0x361ec2];return _0x1657ce;}const a302_0x39c7c6=a302_0x1657;(function(_0x150633,_0x20f33b){const _0x1934d6=a302_0x1657,_0xb996a4=_0x150633();while(!![]){try{const _0x45244e=-parseInt(_0x1934d6(0x176))/0x1+parseInt(_0x1934d6(0x15a))/0x2*(-parseInt(_0x1934d6(0x161))/0x3)+-parseInt(_0x1934d6(0x172))/0x4+-parseInt(_0x1934d6(0x173))/0x5+parseInt(_0x1934d6(0x179))/0x6+parseInt(_0x1934d6(0x17b))/0x7+-parseInt(_0x1934d6(0x15f))/0x8*(-parseInt(_0x1934d6(0x178))/0x9);if(_0x45244e===_0x20f33b)break;else _0xb996a4['push'](_0xb996a4['shift']());}catch(_0x2c4060){_0xb996a4['push'](_0xb996a4['shift']());}}}(a302_0x4e64,0xca088));import{createKnowledgeClient,KnowledgeServiceError}from'@lovrabet/sdk';import{AsyncLocalStorage}from'node:async_hooks';import{getKbServiceDomain}from'../constant/domain.js';import{normalizeKbServiceOrigin}from'../core/kb-search-client.js';import{CliError,CliErrors}from'../errors.js';function a302_0x4e64(){const _0x302719=['getStore','pageTooLarge','test','cookie','status','transportFailure','message','timeout','signal','api_error','httpStatus','\x20The\x20entry\x20may\x20already\x20have\x20been\x20saved.\x20Use\x20read-only\x20detail\x20or\x20list\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.','validation','6137936cnBZiV','1017920YmaIGK','origin','Invalid\x20kbServiceDomain:\x20expected\x20an\x20HTTPS\x20origin\x20without\x20credentials,\x20path,\x20query,\x20or\x20fragment.','616338twGzEV','Knowledge\x20management\x20request\x20cancelled.','408825fCQBvr','9035256HUDHbB','defineProperty','8150709gFiZiH','run','authRequired','5596letjUr','kind','remoteErrorCode','trim','network','200WZWasg','code','669rrIqEG','Configure\x20kbServiceDomain\x20with\x20a\x20trusted\x20HTTPS\x20origin\x20for\x20knowledge\x20management.','cancelled','API\x20error\x20code:\x20'];a302_0x4e64=function(){return _0x302719;};return a302_0x4e64();}const WRITE_RECONCILIATION=a302_0x39c7c6(0x170),session=new AsyncLocalStorage();export class KbManagementError extends CliError{[a302_0x39c7c6(0x16a)];[a302_0x39c7c6(0x15c)];[a302_0x39c7c6(0x16f)];[a302_0x39c7c6(0x166)];constructor(_0x4fdef6,_0x1f310c=![],_0x43c833,_0x1bb556,_0x1334f5=![]){const _0x1c29b1=a302_0x39c7c6;super(_0x1c29b1(0x16e),0x1,_0x4fdef6,_0x43c833?_0x1c29b1(0x164)+_0x43c833:undefined),this[_0x1c29b1(0x16a)]=_0x1f310c,this[_0x1c29b1(0x15c)]=_0x43c833,this['httpStatus']=_0x1bb556,this[_0x1c29b1(0x166)]=_0x1334f5;if(_0x43c833)Object[_0x1c29b1(0x17a)](this,'data',{'value':{'remoteErrorCode':_0x43c833},'enumerable':![]});}}function resolveOrigin(){const _0xeae02f=a302_0x39c7c6,_0x285827=getKbServiceDomain();if(!_0x285827)throw CliErrors[_0xeae02f(0x171)](_0xeae02f(0x162));try{return normalizeKbServiceOrigin(_0x285827);}catch{throw CliErrors[_0xeae02f(0x171)](_0xeae02f(0x175));}}export function withKbManagementSession(_0x27abd9,_0x26a992){const _0x42e097=a302_0x39c7c6;return session[_0x42e097(0x17c)]({'origin':resolveOrigin(),'signal':_0x27abd9},_0x26a992);}export async function withKbManagementClient(_0x18a456,_0x203bfa,_0x2eecbb={}){const _0x273fb3=a302_0x39c7c6,_0x278896=session[_0x273fb3(0x165)]()?.[_0x273fb3(0x174)]??resolveOrigin();if(!_0x18a456[_0x273fb3(0x15d)]())throw CliErrors[_0x273fb3(0x17d)]();const _0x22c367=_0x2eecbb[_0x273fb3(0x16d)]??session[_0x273fb3(0x165)]()?.['signal'];if(_0x22c367?.['aborted'])throw CliErrors['cancelled'](_0x273fb3(0x177));try{const _0x5be64c=createKnowledgeClient({'kbServiceDomain':_0x278896,'authMode':_0x273fb3(0x168),'cookie':_0x18a456,'invokeSource':'cli:rabetbase'});return await _0x203bfa(_0x5be64c,{'signal':_0x22c367});}catch(_0x4d7a53){if(!(_0x4d7a53 instanceof KnowledgeServiceError))throw _0x4d7a53;if(_0x4d7a53['kind']==='auth')throw CliErrors[_0x273fb3(0x17d)]();if(_0x4d7a53[_0x273fb3(0x15b)]===_0x273fb3(0x171))throw CliErrors[_0x273fb3(0x171)](_0x4d7a53[_0x273fb3(0x16b)]);const _0x23aa1d=_0x4d7a53[_0x273fb3(0x15b)]===_0x273fb3(0x15e)||_0x4d7a53['kind']===_0x273fb3(0x16c)||_0x4d7a53[_0x273fb3(0x15b)]===_0x273fb3(0x163);throw new KbManagementError(_0x4d7a53[_0x273fb3(0x16b)]+(_0x4d7a53['writeUncertain']?WRITE_RECONCILIATION:''),_0x23aa1d,/^\d+$/[_0x273fb3(0x167)](_0x4d7a53['code']??'')?_0x4d7a53[_0x273fb3(0x160)]:undefined,_0x4d7a53[_0x273fb3(0x169)],_0x4d7a53[_0x273fb3(0x166)]);}}
1
+ import{createKnowledgeClient,KnowledgeServiceError}from"@lovrabet/sdk";import{AsyncLocalStorage}from"node:async_hooks";import{getKbServiceDomain}from"../constant/domain.js";import{normalizeKbServiceOrigin}from"../core/kb-search-client.js";import{CliError,CliErrors}from"../errors.js";const WRITE_RECONCILIATION=" The entry may already have been saved. Use read-only detail or list reconciliation; do not resubmit automatically.";const session=new AsyncLocalStorage;export class KbManagementError extends CliError{transportFailure;remoteErrorCode;httpStatus;pageTooLarge;constructor(message,transportFailure=false,remoteErrorCode,httpStatus,pageTooLarge=false){super("api_error",1,message,remoteErrorCode?`API error code: ${remoteErrorCode}`:undefined);this.transportFailure=transportFailure;this.remoteErrorCode=remoteErrorCode;this.httpStatus=httpStatus;this.pageTooLarge=pageTooLarge;if(remoteErrorCode)Object.defineProperty(this,"data",{value:{remoteErrorCode:remoteErrorCode},enumerable:false})}}
2
+ export class KbCreateReadbackUnavailableError extends KbManagementError{documentId;version;constructor(documentId,version){super("The create response was received, but its exact detail could not be verified. Inspect it without resubmitting.");this.documentId=documentId;this.version=version}}export function isKbReadbackUnavailable(error){if(error instanceof KbManagementError){return error.transportFailure||error.httpStatus===408||error.httpStatus===429||error.httpStatus!==undefined&&error.httpStatus>=500}return error instanceof CliError&&error.code==="auth_required"}function resolveOrigin(){const value=getKbServiceDomain();if(!value)throw CliErrors.validation("Configure kbServiceDomain with a trusted HTTPS origin for knowledge management.");try{return normalizeKbServiceOrigin(value)}catch{throw CliErrors.validation("Invalid kbServiceDomain: expected an HTTPS origin without credentials, path, query, or fragment.")}}export function getKbManagementSession(){return session.getStore()??{
3
+ origin:resolveOrigin(),signal:undefined}}export function withKbManagementSession(signal,action){return session.run({origin:resolveOrigin(),signal:signal},action)}export async function withKbManagementClient(cookie,action,requestOptions={}){const origin=session.getStore()?.origin??resolveOrigin();if(!cookie.trim())throw CliErrors.authRequired();const signal=requestOptions.signal??session.getStore()?.signal;if(signal?.aborted)throw CliErrors.cancelled("Knowledge management request cancelled.");try{const client=createKnowledgeClient({kbServiceDomain:origin,authMode:"cookie",cookie:cookie,invokeSource:"cli:rabetbase"});return await action(client,{signal:signal})}catch(error){if(!(error instanceof KnowledgeServiceError))throw error;if(error.kind==="auth")throw CliErrors.authRequired();if(error.kind==="validation")throw CliErrors.validation(error.message);const transportFailure=error.kind==="network"||error.kind==="timeout"||error.kind==="cancelled"
4
+ ;throw new KbManagementError(error.message+(error.writeUncertain?WRITE_RECONCILIATION:""),transportFailure,/^\d+$/.test(error.code??"")?error.code:undefined,error.status,error.pageTooLarge)}}
@@ -1 +1,3 @@
1
- (function(_0x377638,_0x387fb2){const _0x26354a=a303_0x8ab6,_0x1b6766=_0x377638();while(!![]){try{const _0xc8061e=parseInt(_0x26354a(0x1b0))/0x1*(parseInt(_0x26354a(0x1b8))/0x2)+parseInt(_0x26354a(0x1af))/0x3*(parseInt(_0x26354a(0x1b9))/0x4)+parseInt(_0x26354a(0x1ae))/0x5+-parseInt(_0x26354a(0x1c6))/0x6+parseInt(_0x26354a(0x1b3))/0x7+parseInt(_0x26354a(0x1c8))/0x8+-parseInt(_0x26354a(0x1ad))/0x9*(parseInt(_0x26354a(0x1c9))/0xa);if(_0xc8061e===_0x387fb2)break;else _0x1b6766['push'](_0x1b6766['shift']());}catch(_0x58b06){_0x1b6766['push'](_0x1b6766['shift']());}}}(a303_0x2a42,0x81413));import{createKnowledgeClient,KnowledgeServiceError,normalizeKnowledgeServiceOrigin}from'@lovrabet/sdk';function a303_0x2a42(){const _0x3dddf9=['search','validation','Knowledge\x20search\x20cancelled.','976962YPVnHv','341556rEPbqd','out-of-scope','cookie','KB\x20Service\x20knowledge\x20search\x20request\x20timed\x20out.','KB\x20Service\x20knowledge\x20search\x20request\x20failed.','serviceUrl','data','HTTP\x20','includes','Knowledge\x20search\x20appCode\x20is\x20required.','hits','length','code','1748988giqvhN','signal','7178968aVhJZE','1202860mvdbrH','status','apiError','networkError','\x20(HTTP\x20','company','query','topK','message','kind','KB\x20Service\x20knowledge\x20search\x20returned\x20an\x20invalid\x20response\x20contract.','appCode','AbortError','development','171vxoAnh','134935HodanM','9EFogTJ','2DSqOTW','trim','network','6642104UwSZxW','authRequired'];a303_0x2a42=function(){return _0x3dddf9;};return a303_0x2a42();}import{CliErrors}from'../errors.js';function a303_0x8ab6(_0x5e53f8,_0x19aa3b){_0x5e53f8=_0x5e53f8-0x1a4;const _0x2a429e=a303_0x2a42();let _0x8ab633=_0x2a429e[_0x5e53f8];return _0x8ab633;}export function normalizeKbServiceOrigin(_0x28d88f){const _0x44b974=a303_0x8ab6;try{return normalizeKnowledgeServiceOrigin(_0x28d88f);}catch{throw CliErrors[_0x44b974(0x1b6)]('Invalid\x20--kb-service-url:\x20expected\x20an\x20HTTPS\x20origin\x20without\x20credentials,\x20path,\x20query,\x20or\x20fragment.');}}export async function searchDirectKnowledge(_0x389fe6){const _0x2e66b8=a303_0x8ab6,_0x2a5474=_0x389fe6[_0x2e66b8(0x1aa)][_0x2e66b8(0x1b1)](),_0x52ca95=_0x389fe6[_0x2e66b8(0x1a5)]['trim']();if(!_0x2a5474)throw CliErrors[_0x2e66b8(0x1b6)](_0x2e66b8(0x1c2));if(!_0x52ca95)throw CliErrors[_0x2e66b8(0x1b6)]('Knowledge\x20search\x20query\x20is\x20required.');if(!_0x389fe6[_0x2e66b8(0x1bb)][_0x2e66b8(0x1b1)]())throw CliErrors[_0x2e66b8(0x1b4)]();const _0x11ff7e=normalizeKbServiceOrigin(_0x389fe6[_0x2e66b8(0x1be)]);try{const _0x479c8e=createKnowledgeClient({'kbServiceDomain':_0x11ff7e,'authMode':_0x2e66b8(0x1bb),'cookie':_0x389fe6[_0x2e66b8(0x1bb)],'invokeSource':'cli:rabetbase'}),_0x49191d=await _0x479c8e[_0x2e66b8(0x1b5)]({'appCode':_0x2a5474,'query':_0x52ca95,'scopes':['public',_0x2e66b8(0x1a4)],..._0x389fe6[_0x2e66b8(0x1a6)]!==undefined?{'topK':_0x389fe6[_0x2e66b8(0x1a6)]}:{}},{'signal':_0x389fe6[_0x2e66b8(0x1c7)]});return{..._0x49191d,'hits':_0x49191d['hits'],'schemaVersion':0x2,'profile':_0x2e66b8(0x1ac),'total':_0x49191d[_0x2e66b8(0x1c3)][_0x2e66b8(0x1c4)]};}catch(_0x1d0bf9){if(!(_0x1d0bf9 instanceof KnowledgeServiceError))throw _0x1d0bf9;if(_0x1d0bf9[_0x2e66b8(0x1a8)]==='auth')throw CliErrors[_0x2e66b8(0x1b4)]();if(_0x1d0bf9[_0x2e66b8(0x1a8)]==='validation')throw CliErrors[_0x2e66b8(0x1b6)](_0x1d0bf9[_0x2e66b8(0x1a7)]);if(_0x1d0bf9[_0x2e66b8(0x1a8)]==='cancelled')throw new DOMException(_0x2e66b8(0x1b7),_0x2e66b8(0x1ab));if(_0x1d0bf9[_0x2e66b8(0x1a8)]===_0x2e66b8(0x1b2)||_0x1d0bf9[_0x2e66b8(0x1a8)]==='timeout')throw CliErrors[_0x2e66b8(0x1cc)](_0x1d0bf9[_0x2e66b8(0x1a8)]==='timeout'?_0x2e66b8(0x1bc):_0x2e66b8(0x1bd));const _0x3ebc96=_0x1d0bf9[_0x2e66b8(0x1a8)]==='contract'&&_0x1d0bf9[_0x2e66b8(0x1a7)][_0x2e66b8(0x1c1)](_0x2e66b8(0x1ba))?_0x2e66b8(0x1a9):_0x1d0bf9[_0x2e66b8(0x1a7)],_0x50dafe=CliErrors[_0x2e66b8(0x1cb)](_0x1d0bf9[_0x2e66b8(0x1ca)]!==undefined&&_0x1d0bf9[_0x2e66b8(0x1ca)]!==0xc8&&!_0x3ebc96[_0x2e66b8(0x1c1)](_0x2e66b8(0x1c0)+_0x1d0bf9[_0x2e66b8(0x1ca)])?_0x3ebc96+_0x2e66b8(0x1cd)+_0x1d0bf9[_0x2e66b8(0x1ca)]+')':_0x3ebc96);if(/^\d+$/['test'](_0x1d0bf9[_0x2e66b8(0x1c5)]??''))Object['defineProperty'](_0x50dafe,_0x2e66b8(0x1bf),{'value':{'remoteErrorCode':_0x1d0bf9['code']},'enumerable':![]});throw _0x50dafe;}}
1
+ import{createKnowledgeClient,KnowledgeServiceError,normalizeKnowledgeServiceOrigin}from"@lovrabet/sdk";import{CliErrors}from"../errors.js";export function normalizeKbServiceOrigin(input){try{return normalizeKnowledgeServiceOrigin(input)}catch{throw CliErrors.validation("Invalid --kb-service-url: expected an HTTPS origin without credentials, path, query, or fragment.")}}export async function searchDirectKnowledge(input){const appCode=input.appCode.trim(),query=input.query.trim();if(!appCode)throw CliErrors.validation("Knowledge search appCode is required.");if(!query)throw CliErrors.validation("Knowledge search query is required.");if(!input.cookie.trim())throw CliErrors.authRequired();const origin=normalizeKbServiceOrigin(input.serviceUrl);try{const client=createKnowledgeClient({kbServiceDomain:origin,authMode:"cookie",cookie:input.cookie,invokeSource:"cli:rabetbase"});const result=await client.search({appCode:appCode,query:query,scopes:["public","company"],...input.topK!==undefined?{
2
+ topK:input.topK}:{}},{signal:input.signal});return{...result,hits:result.hits,schemaVersion:2,profile:"development",total:result.hits.length}}catch(error){if(!(error instanceof KnowledgeServiceError))throw error;if(error.kind==="auth")throw CliErrors.authRequired();if(error.kind==="validation")throw CliErrors.validation(error.message);if(error.kind==="cancelled")throw new DOMException("Knowledge search cancelled.","AbortError");if(error.kind==="network"||error.kind==="timeout")throw CliErrors.networkError(error.kind==="timeout"?"KB Service knowledge search request timed out.":"KB Service knowledge search request failed.");const message=error.kind==="contract"&&error.message.includes("out-of-scope")?"KB Service knowledge search returned an invalid response contract.":error.message;const mapped=CliErrors.apiError(error.status!==undefined&&error.status!==200&&!message.includes(`HTTP ${error.status}`)?`${message} (HTTP ${error.status})`:message)
3
+ ;if(/^\d+$/.test(error.code??""))Object.defineProperty(mapped,"data",{value:{remoteErrorCode:error.code},enumerable:false});throw mapped}}
@@ -1 +1,2 @@
1
- const a304_0xa4577=a304_0x1c36;(function(_0x41fb02,_0x25eba9){const _0x2e938d=a304_0x1c36,_0x2012b9=_0x41fb02();while(!![]){try{const _0x30b705=-parseInt(_0x2e938d(0x1c9))/0x1+parseInt(_0x2e938d(0x1c6))/0x2*(parseInt(_0x2e938d(0x1d0))/0x3)+parseInt(_0x2e938d(0x1c0))/0x4*(-parseInt(_0x2e938d(0x1d6))/0x5)+-parseInt(_0x2e938d(0x1c1))/0x6+-parseInt(_0x2e938d(0x1ce))/0x7*(-parseInt(_0x2e938d(0x1cd))/0x8)+-parseInt(_0x2e938d(0x1d7))/0x9*(-parseInt(_0x2e938d(0x1c7))/0xa)+-parseInt(_0x2e938d(0x1c4))/0xb;if(_0x30b705===_0x25eba9)break;else _0x2012b9['push'](_0x2012b9['shift']());}catch(_0x952dc){_0x2012b9['push'](_0x2012b9['shift']());}}}(a304_0x4568,0x50994));import{constants}from'node:fs';import{access,lstat,mkdir,readFile,readdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a304_0x4568(){const _0x39af9a=['page','545pIpRMj','5144409tVIDue','Page\x20directory\x20is\x20not\x20a\x20directory:\x20','page.lock.json','cwd','21684MAiqwn','599652vqrXjG','name','Unsupported\x20file\x20in\x20page\x20directory:\x20','3309713FjxgVB','validation','4478JMYPgd','10FXNFvs','utf8','328482QhVsJw','.rabetbase','trim','Page\x20directory\x20not\x20found:\x20','32Khjggh','1100204RTpKXS','.json','603XKMqeW','appPagesDir','split','join','isDirectory'];a304_0x4568=function(){return _0x39af9a;};return a304_0x4568();}import{CliErrors}from'../../errors.js';export function loadPageProjectConfig(_0x237c37,_0x4ba4e4=process[a304_0xa4577(0x1da)]()){const _0x1dd130=a304_0xa4577,_0x5bd52b=resolve(_0x4ba4e4),_0x14372f=join(_0x5bd52b,'.rabetbase',_0x1dd130(0x1d5));return{'projectRoot':_0x5bd52b,'pagesBaseDir':_0x14372f,'appPagesDir':join(_0x14372f,_0x237c37),'lockFilePath':join(_0x5bd52b,_0x1dd130(0x1ca),_0x1dd130(0x1d9))};}export function buildPageFileName(_0x1cc1c4,_0x2dc534){const _0x2b01f3=a304_0xa4577;return _0x1cc1c4+'-'+_0x2dc534['toUpperCase']()+_0x2b01f3(0x1cf);}export function resolvePageFilePath(_0x48376c,_0x4338bd,_0x261696){const _0x4ddbee=a304_0xa4577;return join(_0x48376c[_0x4ddbee(0x1d1)],buildPageFileName(_0x4338bd,_0x261696));}export async function ensureParentDirectory(_0x11ea39){await mkdir(dirname(_0x11ea39),{'recursive':!![]});}function a304_0x1c36(_0x5dd2be,_0x4a440d){_0x5dd2be=_0x5dd2be-0x1c0;const _0x456899=a304_0x4568();let _0x1c3685=_0x456899[_0x5dd2be];return _0x1c3685;}export async function fileExists(_0x77072b){try{return await access(_0x77072b,constants['F_OK']),!![];}catch{return![];}}export async function readCustomPageDirectory(_0x7a79cf){const _0x2ab74e=a304_0xa4577,_0x4b7012=_0x7a79cf[_0x2ab74e(0x1cb)]();if(!_0x4b7012)throw CliErrors['flagMissing']('page-dir');const _0x4bf6c6=resolve(_0x4b7012);let _0x51bb18;try{_0x51bb18=await lstat(_0x4bf6c6);}catch{throw CliErrors[_0x2ab74e(0x1c5)](_0x2ab74e(0x1cc)+_0x4b7012);}if(!_0x51bb18[_0x2ab74e(0x1d4)]())throw CliErrors[_0x2ab74e(0x1c5)](_0x2ab74e(0x1d8)+_0x4b7012);const _0x39fa62={};return await readDirectory(_0x4bf6c6,_0x4bf6c6,_0x39fa62),_0x39fa62;}async function readDirectory(_0x5135f2,_0x306461,_0x340915){const _0x32de17=a304_0xa4577,_0x53e820=await readdir(_0x306461,{'withFileTypes':!![]});for(const _0x2eb955 of _0x53e820['sort']((_0x9a8eb2,_0x37815f)=>_0x9a8eb2['name']['localeCompare'](_0x37815f[_0x32de17(0x1c2)]))){const _0x42495b=join(_0x306461,_0x2eb955['name']);if(_0x2eb955[_0x32de17(0x1d4)]()){await readDirectory(_0x5135f2,_0x42495b,_0x340915);continue;}if(!_0x2eb955['isFile']())throw CliErrors[_0x32de17(0x1c5)](_0x32de17(0x1c3)+_0x42495b);_0x340915[relative(_0x5135f2,_0x42495b)[_0x32de17(0x1d2)](sep)[_0x32de17(0x1d3)]('/')]=await readFile(_0x42495b,_0x32de17(0x1c8));}}
1
+ import{constants}from"node:fs";import{access,lstat,mkdir,readFile,readdir}from"node:fs/promises";import{dirname,join,relative,resolve,sep}from"node:path";import{CliErrors}from"../../errors.js";export function loadPageProjectConfig(appCode,cwd=process.cwd()){const projectRoot=resolve(cwd);const pagesBaseDir=join(projectRoot,".rabetbase","page");return{projectRoot:projectRoot,pagesBaseDir:pagesBaseDir,appPagesDir:join(pagesBaseDir,appCode),lockFilePath:join(projectRoot,".rabetbase","page.lock.json")}}export function buildPageFileName(pageId,type){return`${pageId}-${type.toUpperCase()}.json`}export function resolvePageFilePath(config,pageId,type){return join(config.appPagesDir,buildPageFileName(pageId,type))}export async function ensureParentDirectory(filePath){await mkdir(dirname(filePath),{recursive:true})}export async function fileExists(filePath){try{await access(filePath,constants.F_OK);return true}catch{return false}}export async function readCustomPageDirectory(directory){
2
+ const inputDirectory=directory.trim();if(!inputDirectory)throw CliErrors.flagMissing("page-dir");const root=resolve(inputDirectory);let stats;try{stats=await lstat(root)}catch{throw CliErrors.validation(`Page directory not found: ${inputDirectory}`)}if(!stats.isDirectory()){throw CliErrors.validation(`Page directory is not a directory: ${inputDirectory}`)}const files={};await readDirectory(root,root,files);return files}async function readDirectory(root,directory,files){const entries=await readdir(directory,{withFileTypes:true});for(const entry of entries.sort((left,right)=>left.name.localeCompare(right.name))){const filePath=join(directory,entry.name);if(entry.isDirectory()){await readDirectory(root,filePath,files);continue}if(!entry.isFile()){throw CliErrors.validation(`Unsupported file in page directory: ${filePath}`)}files[relative(root,filePath).split(sep).join("/")]=await readFile(filePath,"utf8")}}
@@ -1 +1 @@
1
- (function(_0x185a00,_0x6e689d){const _0x3c4163=a305_0x3573,_0x2174b6=_0x185a00();while(!![]){try{const _0x1e3eb8=parseInt(_0x3c4163(0xb7))/0x1+parseInt(_0x3c4163(0xb2))/0x2+-parseInt(_0x3c4163(0xb9))/0x3*(-parseInt(_0x3c4163(0xb4))/0x4)+-parseInt(_0x3c4163(0xba))/0x5*(-parseInt(_0x3c4163(0xb1))/0x6)+-parseInt(_0x3c4163(0xb6))/0x7*(-parseInt(_0x3c4163(0xbd))/0x8)+parseInt(_0x3c4163(0xb3))/0x9+-parseInt(_0x3c4163(0xb5))/0xa;if(_0x1e3eb8===_0x6e689d)break;else _0x2174b6['push'](_0x2174b6['shift']());}catch(_0x68cc1c){_0x2174b6['push'](_0x2174b6['shift']());}}}(a305_0x1905,0xd1336));function a305_0x3573(_0x26ab0c,_0x574ca7){_0x26ab0c=_0x26ab0c-0xb1;const _0x19058f=a305_0x1905();let _0x3573e7=_0x19058f[_0x26ab0c];return _0x3573e7;}function a305_0x1905(){const _0x3a4942=['4flFfDL','33385090IrSXQD','14kLAFhb','692264faIqGt','md5','4685505ECgWiJ','1060940hlfHKE','utf8','createHash','306424yDzWTZ','digest','6uQiDMn','978694TvedBR','10468395ueDFAA'];a305_0x1905=function(){return _0x3a4942;};return a305_0x1905();}import a305_0x30b422 from'node:crypto';import{readFile}from'node:fs/promises';export function serializePageSchemaForFile(_0x37e828){return JSON['stringify'](JSON['parse'](_0x37e828),null,0x2)+'\x0a';}export function computePageContentHash(_0x2d6c20){const _0x5a7255=a305_0x3573;return a305_0x30b422[_0x5a7255(0xbc)](_0x5a7255(0xb8))['update'](_0x2d6c20)[_0x5a7255(0xbe)]('hex');}export function computeSerializedSchemaHash(_0x4abaf6){return computePageContentHash(serializePageSchemaForFile(_0x4abaf6));}export async function computePageFileHash(_0x4fc77f){const _0x4daa80=a305_0x3573,_0x37888f=await readFile(_0x4fc77f,_0x4daa80(0xbb));return computePageContentHash(_0x37888f);}
1
+ import crypto from"node:crypto";import{readFile}from"node:fs/promises";export function serializePageSchemaForFile(schema){return JSON.stringify(JSON.parse(schema),null,2)+"\n"}export function computePageContentHash(content){return crypto.createHash("md5").update(content).digest("hex")}export function computeSerializedSchemaHash(schema){return computePageContentHash(serializePageSchemaForFile(schema))}export async function computePageFileHash(filePath){const content=await readFile(filePath,"utf8");return computePageContentHash(content)}
@@ -1 +1,2 @@
1
- (function(_0x12e0b2,_0x574b91){const _0x429d20=a306_0x1931,_0x11429c=_0x12e0b2();while(!![]){try{const _0xa3051d=-parseInt(_0x429d20(0x10e))/0x1*(parseInt(_0x429d20(0x10a))/0x2)+parseInt(_0x429d20(0x10d))/0x3*(-parseInt(_0x429d20(0x111))/0x4)+parseInt(_0x429d20(0x110))/0x5+-parseInt(_0x429d20(0x107))/0x6+-parseInt(_0x429d20(0x113))/0x7+-parseInt(_0x429d20(0x115))/0x8+parseInt(_0x429d20(0x109))/0x9;if(_0xa3051d===_0x574b91)break;else _0x11429c['push'](_0x11429c['shift']());}catch(_0x1d6ef3){_0x11429c['push'](_0x11429c['shift']());}}}(a306_0x28de,0x6b4f1));function a306_0x1931(_0x50ae32,_0x1bf005){_0x50ae32=_0x50ae32-0x104;const _0x28de8c=a306_0x28de();let _0x19313f=_0x28de8c[_0x50ae32];return _0x19313f;}import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';function a306_0x28de(){const _0x584c26=['pages','928040kiIfTG','1071908IUvdsA','code','1035951PUsOQE','object','2834688PqzCFP','lastSync','stringify','utf8','254160ZpPjgs','ENOENT','11537784jnGhrE','2QFTeiz','apps','parse','3PvaBWq','215381HeCQAu'];a306_0x28de=function(){return _0x584c26;};return a306_0x28de();}export function createEmptyPageLock(){return{'apps':{}};}export function ensurePageLockScope(_0x34399c,_0x43d7ef){const _0x5dc881=a306_0x1931,_0x2aeb5c={'apps':_0x34399c[_0x5dc881(0x10b)]&&typeof _0x34399c[_0x5dc881(0x10b)]===_0x5dc881(0x114)?_0x34399c[_0x5dc881(0x10b)]:{}};let _0x5037c2=_0x2aeb5c['apps'][_0x43d7ef];if(!_0x5037c2)return _0x5037c2={'lastSync':'','pages':{}},_0x2aeb5c['apps'][_0x43d7ef]=_0x5037c2,{'lockData':_0x2aeb5c,'appLock':_0x5037c2};return!_0x5037c2[_0x5dc881(0x104)]&&(_0x5037c2[_0x5dc881(0x104)]=''),(!_0x5037c2['pages']||typeof _0x5037c2[_0x5dc881(0x10f)]!=='object')&&(_0x5037c2['pages']={}),{'lockData':_0x2aeb5c,'appLock':_0x5037c2};}export async function readPageLockFile(_0xbca43e){const _0x406304=a306_0x1931;try{const _0x3ae1ba=await readFile(_0xbca43e,_0x406304(0x106)),_0x54a97a=JSON[_0x406304(0x10c)](_0x3ae1ba);return{'apps':_0x54a97a[_0x406304(0x10b)]&&typeof _0x54a97a['apps']===_0x406304(0x114)?_0x54a97a[_0x406304(0x10b)]:{}};}catch(_0x1e23dc){if(_0x1e23dc[_0x406304(0x112)]===_0x406304(0x108))return null;throw new Error('Failed\x20to\x20read\x20page\x20lock\x20file:\x20'+String(_0x1e23dc));}}export async function writePageLockFile(_0xfcced9,_0x45c766){const _0x45773b=a306_0x1931;await mkdir(dirname(_0xfcced9),{'recursive':!![]}),await writeFile(_0xfcced9,JSON[_0x45773b(0x105)](_0x45c766,null,0x2),_0x45773b(0x106));}
1
+ import{mkdir,readFile,writeFile}from"node:fs/promises";import{dirname}from"node:path";export function createEmptyPageLock(){return{apps:{}}}export function ensurePageLockScope(lockData,appCode){const normalized={apps:lockData.apps&&typeof lockData.apps==="object"?lockData.apps:{}};let appLock=normalized.apps[appCode];if(!appLock){appLock={lastSync:"",pages:{}};normalized.apps[appCode]=appLock;return{lockData:normalized,appLock:appLock}}if(!appLock.lastSync){appLock.lastSync=""}if(!appLock.pages||typeof appLock.pages!=="object"){appLock.pages={}}return{lockData:normalized,appLock:appLock}}export async function readPageLockFile(lockFilePath){try{const content=await readFile(lockFilePath,"utf8");const raw=JSON.parse(content);return{apps:raw.apps&&typeof raw.apps==="object"?raw.apps:{}}}catch(error){if(error.code==="ENOENT"){return null}throw new Error(`Failed to read page lock file: ${String(error)}`)}}export async function writePageLockFile(lockFilePath,lockData){
2
+ await mkdir(dirname(lockFilePath),{recursive:true});await writeFile(lockFilePath,JSON.stringify(lockData,null,2),"utf8")}
@@ -1 +1,4 @@
1
- (function(_0x2d985e,_0xa1b09d){const _0x52385c=a307_0x3253,_0x3e8cd7=_0x2d985e();while(!![]){try{const _0x4bc4de=-parseInt(_0x52385c(0x11d))/0x1*(-parseInt(_0x52385c(0x11c))/0x2)+-parseInt(_0x52385c(0x124))/0x3+parseInt(_0x52385c(0x11f))/0x4+-parseInt(_0x52385c(0x12c))/0x5+parseInt(_0x52385c(0x131))/0x6+-parseInt(_0x52385c(0x13f))/0x7*(-parseInt(_0x52385c(0x126))/0x8)+-parseInt(_0x52385c(0x12d))/0x9*(parseInt(_0x52385c(0x12f))/0xa);if(_0x4bc4de===_0xa1b09d)break;else _0x3e8cd7['push'](_0x3e8cd7['shift']());}catch(_0x5682a5){_0x3e8cd7['push'](_0x3e8cd7['shift']());}}}(a307_0x27be,0xac5dc));import{CliErrors}from'../../errors.js';export async function prepareLrSmartJsxForPush(_0x42a2d1,_0x349e6a,_0x52e3a8){const _0x1d9605=a307_0x3253,_0x1af277=parseSchema(_0x42a2d1,'local'),_0x525f18=parseSchema(_0x349e6a,_0x1d9605(0x13b)),_0x51e3ac=collectLrSmartJsx(_0x1af277,!![]);if(_0x51e3ac[_0x1d9605(0x134)]===0x0)return{'content':_0x42a2d1,'compiledNodes':0x0,'normalizedNodes':0x0};const _0x1760c6=new Map(collectLrSmartJsx(_0x525f18)['map'](_0x2dd46a=>[_0x2dd46a[_0x1d9605(0x127)],_0x2dd46a]));let _0x23e519=0x0,_0x21238f=0x0;for(const _0x3976c9 of _0x51e3ac){const _0x5204e0=readNonEmptyString(_0x3976c9[_0x1d9605(0x132)][_0x1d9605(0x139)]),_0x1c69ca=readNonEmptyString(_0x3976c9[_0x1d9605(0x132)][_0x1d9605(0x13d)]),_0x581346=_0x1760c6[_0x1d9605(0x12b)](_0x3976c9['key']),_0x28f0c7=readNonEmptyString(_0x581346?.[_0x1d9605(0x132)][_0x1d9605(0x139)]),_0x550f09=readNonEmptyString(_0x581346?.[_0x1d9605(0x132)][_0x1d9605(0x13d)]);let _0x5aa529=![];_0x3976c9[_0x1d9605(0x132)][_0x1d9605(0x141)]!==_0x1d9605(0x119)&&(_0x3976c9[_0x1d9605(0x132)]['type']=_0x1d9605(0x119),_0x5aa529=!![]);!isPageContextExpression(_0x3976c9[_0x1d9605(0x13a)][_0x1d9605(0x120)])&&(_0x3976c9[_0x1d9605(0x13a)][_0x1d9605(0x120)]={'type':_0x1d9605(0x123),'value':'this'},_0x5aa529=!![]);if(!_0x5204e0){if(!_0x1c69ca)throw CliErrors[_0x1d9605(0x121)](_0x1d9605(0x135)+_0x3976c9[_0x1d9605(0x142)]+'\x22\x20is\x20missing\x20both\x20render.source\x20and\x20render.value.','Add\x20JSX\x20source\x20in\x20the\x20page\x20editor\x20or\x20remove\x20the\x20incomplete\x20component.');if(_0x5aa529)_0x21238f+=0x1;continue;}const _0x2d0ac7=!_0x581346||_0x5204e0!==_0x28f0c7,_0xce1131=!_0x1c69ca;if(!_0x2d0ac7&&_0x1c69ca&&_0x550f09&&_0x1c69ca!==_0x550f09)throw CliErrors[_0x1d9605(0x121)]('LrSmartJsx\x20node\x20\x22'+_0x3976c9['label']+'\x22\x20has\x20a\x20manually\x20changed\x20render.value.',_0x1d9605(0x12e));if(_0x2d0ac7||_0xce1131||!_0x550f09){const _0x4a4024=readNonEmptyString(await _0x52e3a8(_0x5204e0));if(!_0x4a4024)throw CliErrors[_0x1d9605(0x136)](_0x1d9605(0x125)+_0x3976c9['label']+'\x22.');_0x3976c9[_0x1d9605(0x132)]['value']=_0x4a4024,_0x23e519+=0x1,_0x5aa529=!![];}if(_0x5aa529)_0x21238f+=0x1;}if(_0x21238f===0x0)return{'content':_0x42a2d1,'compiledNodes':_0x23e519,'normalizedNodes':_0x21238f};return{'content':JSON['stringify'](_0x1af277),'compiledNodes':_0x23e519,'normalizedNodes':_0x21238f};}function parseSchema(_0xa14ef0,_0x1a8b80){const _0x3ffe02=a307_0x3253;try{return JSON[_0x3ffe02(0x11b)](_0xa14ef0);}catch{throw CliErrors['validation'](_0x3ffe02(0x130)+_0x1a8b80+_0x3ffe02(0x11a));}}function collectLrSmartJsx(_0x5755cf,_0x352f5d=![]){const _0x29845a=[],_0xc2f8f8=(_0x513f5d,_0x364087)=>{const _0x5eaebd=a307_0x3253;if(Array[_0x5eaebd(0x12a)](_0x513f5d)){_0x513f5d[_0x5eaebd(0x13c)]((_0x2e8295,_0x168dcc)=>_0xc2f8f8(_0x2e8295,_0x364087+'['+_0x168dcc+']'));return;}if(!isObject(_0x513f5d))return;if(_0x513f5d[_0x5eaebd(0x122)]===_0x5eaebd(0x140)){const _0x2a5076=readNonEmptyString(_0x513f5d['id']),_0x13299b=_0x2a5076||_0x364087,_0x1ffb64=isObject(_0x513f5d[_0x5eaebd(0x13a)])?_0x513f5d[_0x5eaebd(0x13a)]:undefined;if(!_0x1ffb64){if(_0x352f5d)throw CliErrors['validation'](_0x5eaebd(0x135)+_0x13299b+_0x5eaebd(0x128),_0x5eaebd(0x13e));return;}const _0x547ea7=isObject(_0x1ffb64[_0x5eaebd(0x132)])?_0x1ffb64[_0x5eaebd(0x132)]:undefined;if(!_0x547ea7){if(_0x352f5d)throw CliErrors[_0x5eaebd(0x121)](_0x5eaebd(0x135)+_0x13299b+_0x5eaebd(0x138),'Set\x20props.render\x20to\x20an\x20object\x20containing\x20render.source\x20or\x20render.value.');return;}_0x29845a['push']({'key':_0x2a5076?'id:'+_0x2a5076:'path:'+_0x364087,'label':_0x13299b,'props':_0x1ffb64,'render':_0x547ea7});}for(const [_0x29e9da,_0x319a1a]of Object['entries'](_0x513f5d)){if(_0x29e9da===_0x5eaebd(0x13a)&&_0x513f5d[_0x5eaebd(0x122)]===_0x5eaebd(0x140))continue;_0xc2f8f8(_0x319a1a,_0x364087+'.'+_0x29e9da);}};return _0xc2f8f8(_0x5755cf,'$'),_0x29845a;}function isObject(_0x43a63f){const _0x10f8e3=a307_0x3253;return Boolean(_0x43a63f)&&typeof _0x43a63f===_0x10f8e3(0x129)&&!Array[_0x10f8e3(0x12a)](_0x43a63f);}function a307_0x3253(_0x45991,_0x13f04d){_0x45991=_0x45991-0x119;const _0x27be68=a307_0x27be();let _0x3253e4=_0x27be68[_0x45991];return _0x3253e4;}function readNonEmptyString(_0x4fdd15){const _0x7c9a65=a307_0x3253;return typeof _0x4fdd15===_0x7c9a65(0x137)&&_0x4fdd15[_0x7c9a65(0x133)]()?_0x4fdd15:undefined;}function isPageContextExpression(_0x5f0ebf){const _0x4f079d=a307_0x3253;return isObject(_0x5f0ebf)&&_0x5f0ebf[_0x4f079d(0x141)]==='JSExpression'&&_0x5f0ebf['value']===_0x4f079d(0x11e);}function a307_0x27be(){const _0x29fd76=['JSFunction','\x20page\x20schema.','parse','5558tEfOCL','28NhNNJt','this','2247252HsaEHk','_context','validation','componentName','JSExpression','1221180llzAPv','LrSmartJsx\x20compilation\x20returned\x20no\x20code\x20for\x20node\x20\x22','110344ClXomu','key','\x22\x20has\x20missing\x20or\x20invalid\x20props.','object','isArray','get','2718080gIzFLc','9UNdIXg','Edit\x20render.source\x20instead;\x20render.value\x20is\x20generated\x20during\x20page\x20push.','1633760hKZwIZ','Invalid\x20JSON\x20in\x20','5013684RogWhX','render','trim','length','LrSmartJsx\x20node\x20\x22','apiError','string','\x22\x20has\x20missing\x20or\x20invalid\x20props.render.','source','props','remote','forEach','value','Set\x20props\x20to\x20an\x20object\x20containing\x20a\x20render\x20object.','175XpnCXl','LrSmartJsx','type','label'];a307_0x27be=function(){return _0x29fd76;};return a307_0x27be();}
1
+ import{CliErrors}from"../../errors.js";export async function prepareLrSmartJsxForPush(localContent,remoteContent,transpile){const localSchema=parseSchema(localContent,"local");const remoteSchema=parseSchema(remoteContent,"remote");const localNodes=collectLrSmartJsx(localSchema,true);if(localNodes.length===0){return{content:localContent,compiledNodes:0,normalizedNodes:0}}const remoteNodes=new Map(collectLrSmartJsx(remoteSchema).map(item=>[item.key,item]));let compiledNodes=0;let normalizedNodes=0;for(const local of localNodes){const source=readNonEmptyString(local.render.source);const value=readNonEmptyString(local.render.value);const remote=remoteNodes.get(local.key);const remoteSource=readNonEmptyString(remote?.render.source);const remoteValue=readNonEmptyString(remote?.render.value);let normalized=false;if(local.render.type!=="JSFunction"){local.render.type="JSFunction";normalized=true}if(!isPageContextExpression(local.props._context)){local.props._context={type:"JSExpression",
2
+ value:"this"};normalized=true}if(!source){if(!value){throw CliErrors.validation(`LrSmartJsx node "${local.label}" is missing both render.source and render.value.`,"Add JSX source in the page editor or remove the incomplete component.")}if(normalized)normalizedNodes+=1;continue}const sourceChanged=!remote||source!==remoteSource;const valueMissing=!value;if(!sourceChanged&&value&&remoteValue&&value!==remoteValue){throw CliErrors.validation(`LrSmartJsx node "${local.label}" has a manually changed render.value.`,"Edit render.source instead; render.value is generated during page push.")}if(sourceChanged||valueMissing||!remoteValue){const compiled=readNonEmptyString(await transpile(source));if(!compiled){throw CliErrors.apiError(`LrSmartJsx compilation returned no code for node "${local.label}".`)}local.render.value=compiled;compiledNodes+=1;normalized=true}if(normalized)normalizedNodes+=1}if(normalizedNodes===0){return{content:localContent,compiledNodes:compiledNodes,
3
+ normalizedNodes:normalizedNodes}}return{content:JSON.stringify(localSchema),compiledNodes:compiledNodes,normalizedNodes:normalizedNodes}}function parseSchema(content,label){try{return JSON.parse(content)}catch{throw CliErrors.validation(`Invalid JSON in ${label} page schema.`)}}function collectLrSmartJsx(value,validateStructure=false){const found=[];const visit=(current,path)=>{if(Array.isArray(current)){current.forEach((item,index)=>visit(item,`${path}[${index}]`));return}if(!isObject(current))return;if(current.componentName==="LrSmartJsx"){const id=readNonEmptyString(current.id);const label=id||path;const props=isObject(current.props)?current.props:undefined;if(!props){if(validateStructure){throw CliErrors.validation(`LrSmartJsx node "${label}" has missing or invalid props.`,"Set props to an object containing a render object.")}return}const render=isObject(props.render)?props.render:undefined;if(!render){if(validateStructure){
4
+ throw CliErrors.validation(`LrSmartJsx node "${label}" has missing or invalid props.render.`,"Set props.render to an object containing render.source or render.value.")}return}found.push({key:id?`id:${id}`:`path:${path}`,label:label,props:props,render:render})}for(const[key,child]of Object.entries(current)){if(key==="props"&&current.componentName==="LrSmartJsx")continue;visit(child,`${path}.${key}`)}};visit(value,"$");return found}function isObject(value){return Boolean(value)&&typeof value==="object"&&!Array.isArray(value)}function readNonEmptyString(value){return typeof value==="string"&&value.trim()?value:undefined}function isPageContextExpression(value){return isObject(value)&&value.type==="JSExpression"&&value.value==="this"}
@@ -1 +1 @@
1
- export{};
1
+ export{};
@@ -1 +1,14 @@
1
- (function(_0x3c31e0,_0x307426){const _0x3613d2=a309_0x2c50,_0x5413ba=_0x3c31e0();while(!![]){try{const _0x2b69cd=parseInt(_0x3613d2(0xc6))/0x1+-parseInt(_0x3613d2(0xa2))/0x2+parseInt(_0x3613d2(0xba))/0x3*(parseInt(_0x3613d2(0xaa))/0x4)+parseInt(_0x3613d2(0xdd))/0x5+parseInt(_0x3613d2(0x9e))/0x6*(parseInt(_0x3613d2(0xb1))/0x7)+-parseInt(_0x3613d2(0x95))/0x8*(-parseInt(_0x3613d2(0xa8))/0x9)+-parseInt(_0x3613d2(0xbb))/0xa*(parseInt(_0x3613d2(0xc7))/0xb);if(_0x2b69cd===_0x307426)break;else _0x5413ba['push'](_0x5413ba['shift']());}catch(_0x549ba2){_0x5413ba['push'](_0x5413ba['shift']());}}}(a309_0x55bd,0x9036c));import{MYBATIS_DYNAMIC_END_MARKER,MYBATIS_DYNAMIC_START_MARKER,MYBATIS_INCLUDE_MARKER,normalizeSqlForStaticAnalysis}from'./sql-validator.js';export function auditSqlJoinIndexes(_0x3461d2,_0x2e73f0){const _0x6c64d9=a309_0x2c50,_0x38e2d6=[],_0x56f2e5=normalizeSqlForStaticAnalysis(_0x3461d2),_0x5e5938=(_0x56f2e5[_0x6c64d9(0xe2)]?[]:extractJoinFacts(_0x56f2e5[_0x6c64d9(0x9d)]))[_0x6c64d9(0xd1)](_0xc0e17c=>{const _0x5af18e=_0x6c64d9;if(_0xc0e17c[_0x5af18e(0x9c)]||_0xc0e17c[_0x5af18e(0xa1)][_0x5af18e(0xb4)]===0x0)return _0x38e2d6[_0x5af18e(0xa0)]({'code':_0x5af18e(0xb8),'table':_0xc0e17c[_0x5af18e(0x97)],'alias':_0xc0e17c[_0x5af18e(0xc3)],'columns':_0xc0e17c[_0x5af18e(0xa1)],'reason':_0xc0e17c[_0x5af18e(0x9f)]??_0x5af18e(0xc5)}),{'table':_0xc0e17c['table'],'alias':_0xc0e17c[_0x5af18e(0xc3)],'columns':_0xc0e17c['columns'],'status':_0x5af18e(0xcc)};const _0x558fea=resolveTableMetadata(_0x2e73f0,_0xc0e17c['table']),_0x2bb0a0=(_0x558fea?.[_0x5af18e(0xb0)]??[])['map'](_0x346c25=>({'index':_0x346c25,'matchedPrefix':findEqualityPrefix(_0x346c25[_0x5af18e(0xa1)],_0xc0e17c[_0x5af18e(0xa1)])}))[_0x5af18e(0xce)](_0x14b92d=>_0x14b92d[_0x5af18e(0xe0)][_0x5af18e(0xb4)]>0x0),_0x4711b2=_0x2bb0a0[_0x5af18e(0xb5)]((_0xaef987,_0x5d1cb6)=>!_0xaef987||_0x5d1cb6[_0x5af18e(0xe0)][_0x5af18e(0xb4)]>_0xaef987[_0x5af18e(0xe0)]['length']?_0x5d1cb6:_0xaef987,_0x2bb0a0[0x0]);if(_0x4711b2)return{'table':_0xc0e17c[_0x5af18e(0x97)],'alias':_0xc0e17c[_0x5af18e(0xc3)],'columns':_0xc0e17c['columns'],'status':_0x5af18e(0x9a),'matchedIndex':{..._0x4711b2[_0x5af18e(0xa9)],'matchedPrefix':_0x4711b2[_0x5af18e(0xe0)]}};const _0x172ce2=_0x558fea?.[_0x5af18e(0xb0)][_0x5af18e(0xce)](_0x552dc1=>_0x552dc1[_0x5af18e(0xa1)]['some'](_0x2dcbb9=>_0xc0e17c[_0x5af18e(0xa1)][_0x5af18e(0xca)](_0x6a2b6=>columnNamesMatch(_0x2dcbb9,_0x6a2b6))))??[];if(_0x172ce2[_0x5af18e(0xb4)]>0x0)return _0x38e2d6[_0x5af18e(0xa0)]({'code':_0x5af18e(0xc4),'table':_0xc0e17c[_0x5af18e(0x97)],'alias':_0xc0e17c['alias'],'columns':_0xc0e17c['columns'],'reason':_0x5af18e(0xd4)}),{'table':_0xc0e17c[_0x5af18e(0x97)],'alias':_0xc0e17c[_0x5af18e(0xc3)],'columns':_0xc0e17c[_0x5af18e(0xa1)],'status':_0x5af18e(0xab),'candidateIndexes':_0x172ce2};if(_0x558fea&&_0x558fea[_0x5af18e(0xbe)]!==![]&&_0x558fea['indexes'][_0x5af18e(0xb4)]>0x0&&_0xc0e17c[_0x5af18e(0xa1)][_0x5af18e(0xb4)]>0x0)return _0x38e2d6['push']({'code':_0x5af18e(0xda),'table':_0xc0e17c['table'],'alias':_0xc0e17c[_0x5af18e(0xc3)],'columns':_0xc0e17c[_0x5af18e(0xa1)],'reason':_0x5af18e(0x9b)}),{'table':_0xc0e17c[_0x5af18e(0x97)],'alias':_0xc0e17c[_0x5af18e(0xc3)],'columns':_0xc0e17c[_0x5af18e(0xa1)],'status':_0x5af18e(0xab)};return _0x38e2d6[_0x5af18e(0xa0)]({'code':_0x5af18e(0xc1),'table':_0xc0e17c[_0x5af18e(0x97)],'alias':_0xc0e17c[_0x5af18e(0xc3)],'columns':_0xc0e17c[_0x5af18e(0xa1)],'reason':_0x558fea?'The\x20dataset\x20returned\x20no\x20distinguishable\x20index\x20metadata.':_0x5af18e(0xcf)}),{'table':_0xc0e17c[_0x5af18e(0x97)],'alias':_0xc0e17c[_0x5af18e(0xc3)],'columns':_0xc0e17c['columns'],'status':'unavailable'};});return{'checked':_0x5e5938[_0x6c64d9(0xb4)]>0x0,'joins':_0x5e5938,'warnings':_0x38e2d6};}function extractJoinFacts(_0x13592a){const _0x2a1d52=a309_0x2c50,_0x45c4b5=maskNestedQueries(stripSqlNoise(_0x13592a)),_0x2f0307=maskQuotedIdentifiers(_0x45c4b5),_0x4e9f65=[],_0x5c67d1=new Set(),_0x37bcab=/\b(?:(INNER|LEFT|RIGHT|FULL)(?:\s+OUTER)?\s+)?JOIN\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?\s+ON\s+([\s\S]*?)(?=\s+(?:(?:(?:INNER|LEFT|RIGHT|FULL)(?:\s+OUTER)?\s+)?JOIN\b|(?:WHERE|GROUP\s+BY|ORDER\s+BY|HAVING|LIMIT|UNION)\b)|;|$)/gi;for(const _0x2b52c4 of _0x45c4b5[_0x2a1d52(0xcb)](_0x37bcab)){const _0x1479f2=_0x2b52c4[_0x2a1d52(0xa9)]??0x0,_0x30708f=_0x2b52c4[0x0]['search'](/\bJOIN\b/i),_0x5c24f9=_0x1479f2+Math[_0x2a1d52(0xae)](0x0,_0x30708f);if(!/^JOIN\b/i['test'](_0x2f0307[_0x2a1d52(0xc8)](_0x5c24f9)))continue;_0x5c67d1[_0x2a1d52(0xbd)](_0x5c24f9);const _0x17f50b=normalizeIdentifier(_0x2b52c4[0x1]||'INNER'),_0x592e60=normalizeIdentifier(_0x2b52c4[0x2]??''),_0x3f8505=normalizeIdentifier(_0x2b52c4[0x3]||_0x592e60[_0x2a1d52(0xb7)]('.')['at'](-0x1)||_0x592e60),_0x40129b=[],_0xe45a57=_0x592e60==='__sq__';let _0x30f81d=_0x17f50b===_0x2a1d52(0xdf)||_0x17f50b===_0x2a1d52(0xdc)||_0xe45a57,_0x23a359=_0x30f81d?_0xe45a57?'Derived-table\x20JOIN\x20targets\x20are\x20not\x20supported.':_0x17f50b[_0x2a1d52(0x99)]()+_0x2a1d52(0xb2):undefined;const _0x24cb76=stripOuterParentheses(_0x2b52c4[0x4]??''),_0x511f56=_0x24cb76[_0x2a1d52(0xd7)](MYBATIS_DYNAMIC_START_MARKER)||_0x24cb76[_0x2a1d52(0xd7)](MYBATIS_DYNAMIC_END_MARKER),_0x4c7554=_0x24cb76['includes'](MYBATIS_INCLUDE_MARKER);_0x511f56&&(_0x30f81d=!![],_0x23a359??=_0x2a1d52(0xd8));_0x4c7554&&(_0x30f81d=!![],_0x23a359??=_0x2a1d52(0xe3));const _0x324a10=_0x24cb76[_0x2a1d52(0x94)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x2a1d52(0x94)](MYBATIS_DYNAMIC_END_MARKER,'\x20')[_0x2a1d52(0x94)](MYBATIS_INCLUDE_MARKER,'\x20');hasTopLevelKeyword(_0x324a10,'OR')&&(_0x30f81d=!![],_0x23a359??='OR-connected\x20JOIN\x20predicates\x20are\x20not\x20supported.');for(const _0xfbb93a of splitTopLevelAnd(_0x324a10)){const _0x5797e7=stripOuterParentheses(_0xfbb93a);if(hasTopLevelKeyword(_0x5797e7,'OR')){_0x30f81d=!![],_0x23a359??=_0x2a1d52(0xd9);continue;}const _0x5f19cf=splitEquality(_0x5797e7);if(!_0x5f19cf){containsColumnReference(_0xfbb93a,_0x3f8505)&&(_0x30f81d=!![]);continue;}const _0x307b20=parseDirectColumnReference(_0x5f19cf[0x0],_0x3f8505),_0x738786=parseDirectColumnReference(_0x5f19cf[0x1],_0x3f8505),_0x10ee25=containsColumnReference(_0x5f19cf[0x0],_0x3f8505),_0x24d7dc=containsColumnReference(_0x5f19cf[0x1],_0x3f8505),_0x5b9e94=_0x307b20&&!_0x24d7dc?_0x307b20:_0x738786&&!_0x10ee25?_0x738786:null;if(_0x5b9e94&&!_0x40129b[_0x2a1d52(0xd7)](_0x5b9e94))_0x40129b[_0x2a1d52(0xa0)](_0x5b9e94);else!_0x5b9e94&&containsColumnReference(_0xfbb93a,_0x3f8505)&&(_0x30f81d=!![]);}_0x4e9f65[_0x2a1d52(0xa0)]({'table':_0x592e60,'alias':_0x3f8505,'columns':_0x40129b,'unsupportedPredicate':_0x30f81d,'unsupportedReason':_0x23a359,'containsUnresolvedInclude':_0x4c7554,'position':_0x5c24f9});}for(const _0xe550eb of _0x2f0307[_0x2a1d52(0xcb)](/\bJOIN\b/gi)){const _0x246f80=_0xe550eb[_0x2a1d52(0xa9)]??0x0;if(_0x5c67d1['has'](_0x246f80))continue;const _0x438b48=/^\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?/['exec'](_0x45c4b5[_0x2a1d52(0xc8)](_0x246f80+_0xe550eb[0x0][_0x2a1d52(0xb4)])),_0x4850e4=normalizeIdentifier(_0x438b48?.[0x1]||_0x2a1d52(0xd5)),_0x1ea7c4=normalizeIdentifier(_0x438b48?.[0x2]||''),_0x3448bb=isSqlClauseKeyword(_0x1ea7c4)?_0x4850e4['split']('.')['at'](-0x1)||_0x4850e4:_0x1ea7c4||_0x4850e4[_0x2a1d52(0xb7)]('.')['at'](-0x1)||_0x4850e4;_0x4e9f65[_0x2a1d52(0xa0)]({'table':_0x4850e4,'alias':_0x3448bb,'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x2a1d52(0xc9),'position':_0x246f80});}const _0x39a6f4=_0x2f0307[_0x2a1d52(0xa3)](MYBATIS_INCLUDE_MARKER);return _0x39a6f4>=0x0&&!_0x4e9f65[_0x2a1d52(0xca)](_0x3fd5bf=>_0x3fd5bf[_0x2a1d52(0xcd)])&&_0x4e9f65[_0x2a1d52(0xa0)]({'table':_0x2a1d52(0xd5),'alias':_0x2a1d52(0xd5),'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x2a1d52(0xd2),'containsUnresolvedInclude':!![],'position':_0x39a6f4}),_0x4e9f65[_0x2a1d52(0xa6)]((_0x5a4f22,_0xd9bda8)=>_0x5a4f22[_0x2a1d52(0xd3)]-_0xd9bda8[_0x2a1d52(0xd3)]);}function stripSqlNoise(_0x1bc362){const _0x4bf297=a309_0x2c50,_0x4a094f=Array[_0x4bf297(0xb9)](_0x1bc362),_0x4cc43a=(_0x59f7b1,_0x1917ec)=>{for(let _0x1b5fda=_0x59f7b1;_0x1b5fda<_0x1917ec;_0x1b5fda+=0x1){_0x4a094f[_0x1b5fda]!=='\x0a'&&_0x4a094f[_0x1b5fda]!=='\x0d'&&(_0x4a094f[_0x1b5fda]='\x20');}};for(let _0x2573c3=0x0;_0x2573c3<_0x4a094f[_0x4bf297(0xb4)];_0x2573c3+=0x1){const _0x2affac=_0x4a094f[_0x2573c3],_0x255352=_0x4a094f[_0x2573c3+0x1];if(_0x2affac==='\x27'||_0x2affac==='\x22'||_0x2affac==='`'){const _0x3492cd=_0x2affac,_0x4c9443=_0x2573c3;_0x2573c3+=0x1;while(_0x2573c3<_0x4a094f[_0x4bf297(0xb4)]){if(_0x4a094f[_0x2573c3]==='\x5c'&&_0x2573c3+0x1<_0x4a094f[_0x4bf297(0xb4)]){_0x2573c3+=0x2;continue;}if(_0x4a094f[_0x2573c3]!==_0x3492cd){_0x2573c3+=0x1;continue;}if(_0x4a094f[_0x2573c3+0x1]===_0x3492cd){_0x2573c3+=0x2;continue;}break;}if(_0x3492cd==='\x27')_0x4cc43a(_0x4c9443,Math[_0x4bf297(0xb3)](_0x2573c3+0x1,_0x4a094f[_0x4bf297(0xb4)]));continue;}if(_0x2affac==='-'&&_0x255352==='-'){const _0x5a7728=_0x2573c3;while(_0x2573c3<_0x4a094f[_0x4bf297(0xb4)]&&_0x4a094f[_0x2573c3]!=='\x0a')_0x2573c3+=0x1;_0x4cc43a(_0x5a7728,_0x2573c3);continue;}if(_0x2affac==='/'&&_0x255352==='*'){const _0x261214=_0x2573c3;_0x2573c3+=0x2;while(_0x2573c3<_0x4a094f[_0x4bf297(0xb4)]&&!(_0x4a094f[_0x2573c3]==='*'&&_0x4a094f[_0x2573c3+0x1]==='/')){_0x2573c3+=0x1;}_0x2573c3=Math[_0x4bf297(0xb3)](_0x2573c3+0x1,_0x4a094f[_0x4bf297(0xb4)]-0x1),_0x4cc43a(_0x261214,_0x2573c3+0x1);continue;}if(_0x2affac==='#'&&_0x255352!=='{'){const _0x2f70f4=_0x2573c3;while(_0x2573c3<_0x4a094f[_0x4bf297(0xb4)]&&_0x4a094f[_0x2573c3]!=='\x0a')_0x2573c3+=0x1;_0x4cc43a(_0x2f70f4,_0x2573c3);continue;}if((_0x2affac==='#'||_0x2affac==='$')&&_0x255352==='{'){const _0x2107bb=_0x2573c3;_0x2573c3+=0x2;while(_0x2573c3<_0x4a094f[_0x4bf297(0xb4)]&&_0x4a094f[_0x2573c3]!=='}')_0x2573c3+=0x1;_0x4cc43a(_0x2107bb,Math[_0x4bf297(0xb3)](_0x2573c3+0x1,_0x4a094f['length']));}}return _0x4a094f[_0x4bf297(0xbf)]('');}function maskQuotedIdentifiers(_0x59c70b){const _0x46c6c0=a309_0x2c50,_0xaa9907=Array[_0x46c6c0(0xb9)](_0x59c70b);for(let _0x1e157c=0x0;_0x1e157c<_0xaa9907[_0x46c6c0(0xb4)];_0x1e157c+=0x1){const _0x2c5104=_0xaa9907[_0x1e157c];if(_0x2c5104!=='\x22'&&_0x2c5104!=='`')continue;_0x1e157c+=0x1;while(_0x1e157c<_0xaa9907[_0x46c6c0(0xb4)]){if(_0xaa9907[_0x1e157c]===_0x2c5104){if(_0xaa9907[_0x1e157c+0x1]===_0x2c5104){_0xaa9907[_0x1e157c]='\x20',_0xaa9907[_0x1e157c+0x1]='\x20',_0x1e157c+=0x2;continue;}break;}_0xaa9907[_0x1e157c]='\x20',_0x1e157c+=0x1;}}return _0xaa9907[_0x46c6c0(0xbf)]('');}function maskNestedQueries(_0x1e403d){const _0x305365=a309_0x2c50,_0x2a440d=Array[_0x305365(0xb9)](_0x1e403d);for(let _0x2bf532=0x0;_0x2bf532<_0x2a440d[_0x305365(0xb4)];_0x2bf532+=0x1){if(_0x2a440d[_0x2bf532]!=='(')continue;const _0x39b5d4=_0x1e403d[_0x305365(0xc8)](_0x2bf532+0x1);if(!/^\s*(?:SELECT|WITH)\b/i[_0x305365(0x96)](_0x39b5d4))continue;let _0x2d2861=0x1,_0x4a58c8=_0x2bf532+0x1;for(;_0x4a58c8<_0x2a440d[_0x305365(0xb4)]&&_0x2d2861>0x0;_0x4a58c8+=0x1){if(_0x2a440d[_0x4a58c8]==='(')_0x2d2861+=0x1;if(_0x2a440d[_0x4a58c8]===')')_0x2d2861-=0x1;}if(_0x2d2861!==0x0)continue;for(let _0x3f7dfc=_0x2bf532;_0x3f7dfc<_0x4a58c8;_0x3f7dfc+=0x1){_0x2a440d[_0x3f7dfc]='\x20';}const _0x54c684='__sq__';for(let _0x5bf4bb=0x0;_0x5bf4bb<_0x54c684[_0x305365(0xb4)]&&_0x2bf532+_0x5bf4bb<_0x4a58c8;_0x5bf4bb+=0x1){_0x2a440d[_0x2bf532+_0x5bf4bb]=_0x54c684[_0x5bf4bb];}_0x2bf532=_0x4a58c8-0x1;}return _0x2a440d[_0x305365(0xbf)]('');}function splitTopLevelAnd(_0x38da2e){const _0x30760e=a309_0x2c50,_0x4f4bf5=[];let _0x4e320e=0x0,_0x3343ad=0x0;for(let _0x599c47=0x0;_0x599c47<_0x38da2e[_0x30760e(0xb4)];_0x599c47+=0x1){const _0x664f63=_0x38da2e[_0x599c47];if(_0x664f63==='(')_0x4e320e+=0x1;if(_0x664f63===')')_0x4e320e=Math[_0x30760e(0xae)](0x0,_0x4e320e-0x1);_0x4e320e===0x0&&_0x38da2e[_0x30760e(0xc8)](_0x599c47)[_0x30760e(0xa4)](/^AND\b/i)&&(_0x599c47===0x0||/\s/['test'](_0x38da2e[_0x599c47-0x1]??''))&&(_0x4f4bf5[_0x30760e(0xa0)](_0x38da2e[_0x30760e(0xc8)](_0x3343ad,_0x599c47)['trim']()),_0x599c47+=0x2,_0x3343ad=_0x599c47+0x1);}const _0x197820=_0x38da2e[_0x30760e(0xc8)](_0x3343ad)[_0x30760e(0xa5)]();if(_0x197820)_0x4f4bf5[_0x30760e(0xa0)](_0x197820);return _0x4f4bf5;}function hasTopLevelKeyword(_0x5d69a8,_0x1a06e8){const _0x354f02=a309_0x2c50;let _0x52a97a=0x0;for(let _0x1f4d55=0x0;_0x1f4d55<_0x5d69a8[_0x354f02(0xb4)];_0x1f4d55+=0x1){const _0x53f0b4=_0x5d69a8[_0x1f4d55];if(_0x53f0b4==='(')_0x52a97a+=0x1;if(_0x53f0b4===')')_0x52a97a=Math[_0x354f02(0xae)](0x0,_0x52a97a-0x1);if(_0x52a97a!==0x0)continue;const _0x330f9f=_0x5d69a8['slice'](_0x1f4d55,_0x1f4d55+_0x1a06e8[_0x354f02(0xb4)]),_0x522e62=_0x5d69a8[_0x1f4d55-0x1]??'\x20',_0xf934eb=_0x5d69a8[_0x1f4d55+_0x1a06e8['length']]??'\x20';if(_0x330f9f['toUpperCase']()===_0x1a06e8[_0x354f02(0x99)]()&&!/[\w$]/['test'](_0x522e62)&&!/[\w$]/[_0x354f02(0x96)](_0xf934eb))return!![];}return![];}function splitEquality(_0x568b42){const _0x4c7601=a309_0x2c50,_0x19cd18=stripOuterParentheses(_0x568b42);let _0x302649=0x0,_0x272e95;for(let _0x585bfa=0x0;_0x585bfa<_0x19cd18[_0x4c7601(0xb4)];_0x585bfa+=0x1){const _0x209f5c=_0x19cd18[_0x585bfa];if(_0x209f5c==='(')_0x302649+=0x1;if(_0x209f5c===')')_0x302649=Math[_0x4c7601(0xae)](0x0,_0x302649-0x1);const _0x41dfa6=_0x19cd18[_0x585bfa-0x1]??'',_0x4ec538=_0x19cd18[_0x585bfa+0x1]??'';if(_0x209f5c==='='&&_0x302649===0x0&&!/[!<>=:]/[_0x4c7601(0x96)](_0x41dfa6)&&_0x4ec538!=='='){if(_0x272e95!==undefined)return null;_0x272e95=_0x585bfa;}}return _0x272e95===undefined?null:[_0x19cd18[_0x4c7601(0xc8)](0x0,_0x272e95)[_0x4c7601(0xa5)](),_0x19cd18[_0x4c7601(0xc8)](_0x272e95+0x1)['trim']()];}function a309_0x2c50(_0x47a615,_0xd702fd){_0x47a615=_0x47a615-0x93;const _0x55bdb3=a309_0x55bd();let _0x2c5020=_0x55bdb3[_0x47a615];return _0x2c5020;}function parseDirectColumnReference(_0x3f981c,_0x9fd773){const _0x4dad3e=a309_0x2c50,_0x317469=/^([`"]?[\w$]+[`"]?)\s*\.\s*([`"]?[\w$]+[`"]?)$/[_0x4dad3e(0xc2)](stripOuterParentheses(_0x3f981c));if(!_0x317469)return null;if(normalizeIdentifier(_0x317469[0x1]??'')!==normalizeIdentifier(_0x9fd773))return null;return normalizeIdentifier(_0x317469[0x2]??'');}function containsColumnReference(_0x3e92f2,_0x255a89){const _0x195146=a309_0x2c50,_0x5d9756=_0x3e92f2[_0x195146(0xd6)](/[`"]/g,''),_0xb913ca=_0x255a89[_0x195146(0xd6)](/[.*+?^${}()|[\]\\]/g,'\x5c$&');return new RegExp(_0x195146(0xb6)+_0xb913ca+_0x195146(0xdb),'i')['test'](_0x5d9756);}function findEqualityPrefix(_0x3e4cf7,_0x4e972f){const _0x200fcf=a309_0x2c50,_0x4b60dc=new Set(_0x4e972f[_0x200fcf(0xd1)](normalizeIdentifier)),_0x5bf9a6=[];for(const _0x593ebd of _0x3e4cf7){if(!_0x4b60dc[_0x200fcf(0x98)](normalizeIdentifier(_0x593ebd)))break;_0x5bf9a6[_0x200fcf(0xa0)](_0x593ebd);}return _0x5bf9a6;}function resolveTableMetadata(_0x219bdf,_0x59e458){const _0x34f493=a309_0x2c50,_0x22e5d6=normalizeIdentifier(_0x59e458),_0x1c4a33=_0x219bdf[_0x34f493(0xce)](_0x4b600e=>normalizeIdentifier(_0x4b600e['tableName'])===_0x22e5d6);if(_0x1c4a33[_0x34f493(0xb4)]===0x1)return _0x1c4a33[0x0];const _0x2f7663=_0x22e5d6[_0x34f493(0xd7)]('.'),_0x193b31=_0x22e5d6[_0x34f493(0xb7)]('.')['at'](-0x1),_0x5e0d79=_0x219bdf['filter'](_0x505097=>{const _0x3d9cbd=_0x34f493,_0xa3506b=normalizeIdentifier(_0x505097[_0x3d9cbd(0xad)]);if(_0x2f7663&&_0xa3506b[_0x3d9cbd(0xd7)]('.'))return![];return _0xa3506b[_0x3d9cbd(0xb7)]('.')['at'](-0x1)===_0x193b31;});return _0x5e0d79[_0x34f493(0xb4)]===0x1?_0x5e0d79[0x0]:undefined;}function columnNamesMatch(_0x5ae9c4,_0x5136a){return normalizeIdentifier(_0x5ae9c4)===normalizeIdentifier(_0x5136a);}function normalizeIdentifier(_0x5d17ba){const _0x150cbd=a309_0x2c50;return _0x5d17ba[_0x150cbd(0xd6)](/[`"]/g,'')[_0x150cbd(0xa5)]()[_0x150cbd(0xde)]();}function isSqlClauseKeyword(_0x4dcad0){const _0x200270=a309_0x2c50;return new Set(['on',_0x200270(0xaf),_0x200270(0xd0),'join',_0x200270(0xc0),_0x200270(0x93),_0x200270(0xdf),'full',_0x200270(0xbc),_0x200270(0xac)])[_0x200270(0x98)](_0x4dcad0);}function stripOuterParentheses(_0x95765f){const _0xd8ac58=a309_0x2c50;let _0x5c796b=_0x95765f[_0xd8ac58(0xa5)]();while(_0x5c796b[_0xd8ac58(0xe1)]('(')&&_0x5c796b[_0xd8ac58(0xa7)](')')){let _0x4d6f99=0x0,_0x4fc85c=!![];for(let _0x80e013=0x0;_0x80e013<_0x5c796b[_0xd8ac58(0xb4)];_0x80e013+=0x1){if(_0x5c796b[_0x80e013]==='(')_0x4d6f99+=0x1;if(_0x5c796b[_0x80e013]===')')_0x4d6f99-=0x1;if(_0x4d6f99===0x0&&_0x80e013<_0x5c796b[_0xd8ac58(0xb4)]-0x1){_0x4fc85c=![];break;}}if(!_0x4fc85c||_0x4d6f99!==0x0)break;_0x5c796b=_0x5c796b[_0xd8ac58(0xc8)](0x1,-0x1)['trim']();}return _0x5c796b;}function a309_0x55bd(){const _0x48db71=['columns','1272298cBsaYF','indexOf','match','trim','sort','endsWith','5769kdztqd','index','529148TTNoxl','warning','natural','tableName','max','using','indexes','1040438FrPAwb','\x20JOIN\x20direction\x20is\x20not\x20supported\x20by\x20static\x20index\x20auditing.','min','length','reduce','(?:^|[^\x5cw$])','split','JOIN_PREDICATE_UNSUPPORTED','from','15OjRERK','9820520RGaZsm','cross','add','metadataAvailable','join','inner','INDEX_METADATA_UNAVAILABLE','exec','alias','JOIN_INDEX_NOT_USABLE','Not\x20every\x20JOIN\x20target\x20predicate\x20could\x20be\x20audited\x20safely.','445663VJCsKp','22TKqahO','slice','Only\x20explicit\x20table\x20JOIN\x20clauses\x20with\x20an\x20ON\x20predicate\x20are\x20supported.','some','matchAll','unavailable','containsUnresolvedInclude','filter','No\x20dataset\x20metadata\x20matched\x20the\x20JOIN\x20table.','where','map','MyBatis\x20<include>\x20fragments\x20cannot\x20be\x20expanded\x20for\x20JOIN\x20auditing.','position','Relevant\x20columns\x20do\x20not\x20form\x20a\x20complete\x20leftmost\x20index\x20prefix.','unknown','replace','includes','MyBatis\x20dynamic\x20JOIN\x20predicates\x20cannot\x20be\x20audited\x20deterministically.','OR-connected\x20JOIN\x20predicates\x20are\x20not\x20supported.','JOIN_INDEX_MISSING','\x5cs*\x5c.\x5cs*[\x5cw$]+','full','5623730GRorbA','toLowerCase','right','matchedPrefix','startsWith','error','MyBatis\x20<include>\x20JOIN\x20fragments\x20cannot\x20be\x20expanded\x20statically.','left','replaceAll','840FWSlwZ','test','table','has','toUpperCase','covered','No\x20reported\x20index\x20contains\x20the\x20JOIN\x20access\x20columns.','unsupportedPredicate','sql','36wkCpCj','unsupportedReason','push'];a309_0x55bd=function(){return _0x48db71;};return a309_0x55bd();}
1
+ import{MYBATIS_DYNAMIC_END_MARKER,MYBATIS_DYNAMIC_START_MARKER,MYBATIS_INCLUDE_MARKER,normalizeSqlForStaticAnalysis}from"./sql-validator.js";export function auditSqlJoinIndexes(sqlContent,tables){const warnings=[];const source=normalizeSqlForStaticAnalysis(sqlContent);const joins=(source.error?[]:extractJoinFacts(source.sql)).map(join=>{if(join.unsupportedPredicate||join.columns.length===0){warnings.push({code:"JOIN_PREDICATE_UNSUPPORTED",table:join.table,alias:join.alias,columns:join.columns,reason:join.unsupportedReason??"Not every JOIN target predicate could be audited safely."});return{table:join.table,alias:join.alias,columns:join.columns,status:"unavailable"}}const metadata=resolveTableMetadata(tables,join.table);const matchedIndexes=(metadata?.indexes??[]).map(index=>({index:index,matchedPrefix:findEqualityPrefix(index.columns,join.columns)})).filter(match=>match.matchedPrefix.length>0)
2
+ ;const matchedIndex=matchedIndexes.reduce((best,match)=>!best||match.matchedPrefix.length>best.matchedPrefix.length?match:best,matchedIndexes[0]);if(matchedIndex){return{table:join.table,alias:join.alias,columns:join.columns,status:"covered",matchedIndex:{...matchedIndex.index,matchedPrefix:matchedIndex.matchedPrefix}}}const candidateIndexes=metadata?.indexes.filter(index=>index.columns.some(column=>join.columns.some(joinColumn=>columnNamesMatch(column,joinColumn))))??[];if(candidateIndexes.length>0){warnings.push({code:"JOIN_INDEX_NOT_USABLE",table:join.table,alias:join.alias,columns:join.columns,reason:"Relevant columns do not form a complete leftmost index prefix."});return{table:join.table,alias:join.alias,columns:join.columns,status:"warning",candidateIndexes:candidateIndexes}}if(metadata&&metadata.metadataAvailable!==false&&metadata.indexes.length>0&&join.columns.length>0){warnings.push({code:"JOIN_INDEX_MISSING",table:join.table,alias:join.alias,columns:join.columns,
3
+ reason:"No reported index contains the JOIN access columns."});return{table:join.table,alias:join.alias,columns:join.columns,status:"warning"}}warnings.push({code:"INDEX_METADATA_UNAVAILABLE",table:join.table,alias:join.alias,columns:join.columns,reason:metadata?"The dataset returned no distinguishable index metadata.":"No dataset metadata matched the JOIN table."});return{table:join.table,alias:join.alias,columns:join.columns,status:"unavailable"}});return{checked:joins.length>0,joins:joins,warnings:warnings}}function extractJoinFacts(sqlContent){const cleaned=maskNestedQueries(stripSqlNoise(sqlContent));const keywordScan=maskQuotedIdentifiers(cleaned);const joins=[];const parsedJoinPositions=new Set;const joinPattern=/\b(?:(INNER|LEFT|RIGHT|FULL)(?:\s+OUTER)?\s+)?JOIN\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?\s+ON\s+([\s\S]*?)(?=\s+(?:(?:(?:INNER|LEFT|RIGHT|FULL)(?:\s+OUTER)?\s+)?JOIN\b|(?:WHERE|GROUP\s+BY|ORDER\s+BY|HAVING|LIMIT|UNION)\b)|;|$)/gi
4
+ ;for(const match of cleaned.matchAll(joinPattern)){const matchPosition=match.index??0;const joinOffset=match[0].search(/\bJOIN\b/i);const position=matchPosition+Math.max(0,joinOffset);if(!/^JOIN\b/i.test(keywordScan.slice(position)))continue;parsedJoinPositions.add(position);const joinType=normalizeIdentifier(match[1]||"INNER");const table=normalizeIdentifier(match[2]??"");const alias=normalizeIdentifier(match[3]||table.split(".").at(-1)||table);const columns=[];const derivedTable=table==="__sq__";let unsupportedPredicate=joinType==="right"||joinType==="full"||derivedTable;let unsupportedReason=unsupportedPredicate?derivedTable?"Derived-table JOIN targets are not supported.":`${joinType.toUpperCase()} JOIN direction is not supported by static index auditing.`:undefined;const rawOnExpression=stripOuterParentheses(match[4]??"");const hasDynamicBranch=rawOnExpression.includes(MYBATIS_DYNAMIC_START_MARKER)||rawOnExpression.includes(MYBATIS_DYNAMIC_END_MARKER)
5
+ ;const containsUnresolvedInclude=rawOnExpression.includes(MYBATIS_INCLUDE_MARKER);if(hasDynamicBranch){unsupportedPredicate=true;unsupportedReason??="MyBatis dynamic JOIN predicates cannot be audited deterministically."}if(containsUnresolvedInclude){unsupportedPredicate=true;unsupportedReason??="MyBatis <include> JOIN fragments cannot be expanded statically."}const onExpression=rawOnExpression.replaceAll(MYBATIS_DYNAMIC_START_MARKER," ").replaceAll(MYBATIS_DYNAMIC_END_MARKER," ").replaceAll(MYBATIS_INCLUDE_MARKER," ");if(hasTopLevelKeyword(onExpression,"OR")){unsupportedPredicate=true;unsupportedReason??="OR-connected JOIN predicates are not supported."}for(const predicate of splitTopLevelAnd(onExpression)){const normalizedPredicate=stripOuterParentheses(predicate);if(hasTopLevelKeyword(normalizedPredicate,"OR")){unsupportedPredicate=true;unsupportedReason??="OR-connected JOIN predicates are not supported.";continue}const equality=splitEquality(normalizedPredicate);if(!equality){
6
+ if(containsColumnReference(predicate,alias)){unsupportedPredicate=true}continue}const leftColumn=parseDirectColumnReference(equality[0],alias);const rightColumn=parseDirectColumnReference(equality[1],alias);const leftReferencesTarget=containsColumnReference(equality[0],alias);const rightReferencesTarget=containsColumnReference(equality[1],alias);const column=leftColumn&&!rightReferencesTarget?leftColumn:rightColumn&&!leftReferencesTarget?rightColumn:null;if(column&&!columns.includes(column)){columns.push(column)}else if(!column&&containsColumnReference(predicate,alias)){unsupportedPredicate=true}}joins.push({table:table,alias:alias,columns:columns,unsupportedPredicate:unsupportedPredicate,unsupportedReason:unsupportedReason,containsUnresolvedInclude:containsUnresolvedInclude,position:position})}for(const match of keywordScan.matchAll(/\bJOIN\b/gi)){const position=match.index??0;if(parsedJoinPositions.has(position))continue
7
+ ;const targetMatch=/^\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?/.exec(cleaned.slice(position+match[0].length));const table=normalizeIdentifier(targetMatch?.[1]||"unknown");const parsedAlias=normalizeIdentifier(targetMatch?.[2]||"");const alias=isSqlClauseKeyword(parsedAlias)?table.split(".").at(-1)||table:parsedAlias||table.split(".").at(-1)||table;joins.push({table:table,alias:alias,columns:[],unsupportedPredicate:true,unsupportedReason:"Only explicit table JOIN clauses with an ON predicate are supported.",position:position})}const unresolvedIncludePosition=keywordScan.indexOf(MYBATIS_INCLUDE_MARKER);if(unresolvedIncludePosition>=0&&!joins.some(join=>join.containsUnresolvedInclude)){joins.push({table:"unknown",alias:"unknown",columns:[],unsupportedPredicate:true,unsupportedReason:"MyBatis <include> fragments cannot be expanded for JOIN auditing.",containsUnresolvedInclude:true,position:unresolvedIncludePosition})}return joins.sort((left,right)=>left.position-right.position)}
8
+ function stripSqlNoise(sqlContent){const characters=Array.from(sqlContent);const blank=(start,end)=>{for(let index=start;index<end;index+=1){if(characters[index]!=="\n"&&characters[index]!=="\r"){characters[index]=" "}}};for(let index=0;index<characters.length;index+=1){const char=characters[index];const next=characters[index+1];if(char==="'"||char==='"'||char==="`"){const quote=char;const start=index;index+=1;while(index<characters.length){if(characters[index]==="\\"&&index+1<characters.length){index+=2;continue}if(characters[index]!==quote){index+=1;continue}if(characters[index+1]===quote){index+=2;continue}break}if(quote==="'")blank(start,Math.min(index+1,characters.length));continue}if(char==="-"&&next==="-"){const start=index;while(index<characters.length&&characters[index]!=="\n")index+=1;blank(start,index);continue}if(char==="/"&&next==="*"){const start=index;index+=2;while(index<characters.length&&!(characters[index]==="*"&&characters[index+1]==="/")){index+=1}
9
+ index=Math.min(index+1,characters.length-1);blank(start,index+1);continue}if(char==="#"&&next!=="{"){const start=index;while(index<characters.length&&characters[index]!=="\n")index+=1;blank(start,index);continue}if((char==="#"||char==="$")&&next==="{"){const start=index;index+=2;while(index<characters.length&&characters[index]!=="}")index+=1;blank(start,Math.min(index+1,characters.length))}}return characters.join("")}function maskQuotedIdentifiers(sqlContent){const characters=Array.from(sqlContent);for(let index=0;index<characters.length;index+=1){const quote=characters[index];if(quote!=='"'&&quote!=="`")continue;index+=1;while(index<characters.length){if(characters[index]===quote){if(characters[index+1]===quote){characters[index]=" ";characters[index+1]=" ";index+=2;continue}break}characters[index]=" ";index+=1}}return characters.join("")}function maskNestedQueries(sqlContent){const characters=Array.from(sqlContent);for(let index=0;index<characters.length;index+=1){
10
+ if(characters[index]!=="(")continue;const remainder=sqlContent.slice(index+1);if(!/^\s*(?:SELECT|WITH)\b/i.test(remainder))continue;let depth=1;let cursor=index+1;for(;cursor<characters.length&&depth>0;cursor+=1){if(characters[cursor]==="(")depth+=1;if(characters[cursor]===")")depth-=1}if(depth!==0)continue;for(let nestedIndex=index;nestedIndex<cursor;nestedIndex+=1){characters[nestedIndex]=" "}const marker="__sq__";for(let markerIndex=0;markerIndex<marker.length&&index+markerIndex<cursor;markerIndex+=1){characters[index+markerIndex]=marker[markerIndex]}index=cursor-1}return characters.join("")}function splitTopLevelAnd(expression){const parts=[];let depth=0;let start=0;for(let index=0;index<expression.length;index+=1){const char=expression[index];if(char==="(")depth+=1;if(char===")")depth=Math.max(0,depth-1);if(depth===0&&expression.slice(index).match(/^AND\b/i)&&(index===0||/\s/.test(expression[index-1]??""))){parts.push(expression.slice(start,index).trim());index+=2;start=index+1}}
11
+ const tail=expression.slice(start).trim();if(tail)parts.push(tail);return parts}function hasTopLevelKeyword(expression,keyword){let depth=0;for(let index=0;index<expression.length;index+=1){const char=expression[index];if(char==="(")depth+=1;if(char===")")depth=Math.max(0,depth-1);if(depth!==0)continue;const candidate=expression.slice(index,index+keyword.length);const previous=expression[index-1]??" ";const next=expression[index+keyword.length]??" ";if(candidate.toUpperCase()===keyword.toUpperCase()&&!/[\w$]/.test(previous)&&!/[\w$]/.test(next)){return true}}return false}function splitEquality(predicate){const normalizedPredicate=stripOuterParentheses(predicate);let depth=0;let equalityPosition;for(let index=0;index<normalizedPredicate.length;index+=1){const char=normalizedPredicate[index];if(char==="(")depth+=1;if(char===")")depth=Math.max(0,depth-1);const previous=normalizedPredicate[index-1]??"";const next=normalizedPredicate[index+1]??""
12
+ ;if(char==="="&&depth===0&&!/[!<>=:]/.test(previous)&&next!=="="){if(equalityPosition!==undefined)return null;equalityPosition=index}}return equalityPosition===undefined?null:[normalizedPredicate.slice(0,equalityPosition).trim(),normalizedPredicate.slice(equalityPosition+1).trim()]}function parseDirectColumnReference(side,expectedAlias){const match=/^([`"]?[\w$]+[`"]?)\s*\.\s*([`"]?[\w$]+[`"]?)$/.exec(stripOuterParentheses(side));if(!match)return null;if(normalizeIdentifier(match[1]??"")!==normalizeIdentifier(expectedAlias)){return null}return normalizeIdentifier(match[2]??"")}function containsColumnReference(predicate,expectedAlias){const unquoted=predicate.replace(/[`"]/g,"");const escapedAlias=expectedAlias.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?:^|[^\\w$])${escapedAlias}\\s*\\.\\s*[\\w$]+`,"i").test(unquoted)}function findEqualityPrefix(indexColumns,predicateColumns){const expected=new Set(predicateColumns.map(normalizeIdentifier));const prefix=[]
13
+ ;for(const column of indexColumns){if(!expected.has(normalizeIdentifier(column)))break;prefix.push(column)}return prefix}function resolveTableMetadata(tables,joinTable){const normalizedJoinTable=normalizeIdentifier(joinTable);const exactMatches=tables.filter(table=>normalizeIdentifier(table.tableName)===normalizedJoinTable);if(exactMatches.length===1)return exactMatches[0];const joinTableQualified=normalizedJoinTable.includes(".");const joinBasename=normalizedJoinTable.split(".").at(-1);const basenameMatches=tables.filter(table=>{const normalizedTable=normalizeIdentifier(table.tableName);if(joinTableQualified&&normalizedTable.includes("."))return false;return normalizedTable.split(".").at(-1)===joinBasename});return basenameMatches.length===1?basenameMatches[0]:undefined}function columnNamesMatch(left,right){return normalizeIdentifier(left)===normalizeIdentifier(right)}function normalizeIdentifier(identifier){return identifier.replace(/[`"]/g,"").trim().toLowerCase()}
14
+ function isSqlClauseKeyword(identifier){return new Set(["on","using","where","join","inner","left","right","full","cross","natural"]).has(identifier)}function stripOuterParentheses(value){let result=value.trim();while(result.startsWith("(")&&result.endsWith(")")){let depth=0;let enclosesEntireValue=true;for(let index=0;index<result.length;index+=1){if(result[index]==="(")depth+=1;if(result[index]===")")depth-=1;if(depth===0&&index<result.length-1){enclosesEntireValue=false;break}}if(!enclosesEntireValue||depth!==0)break;result=result.slice(1,-1).trim()}return result}
@@ -1 +1 @@
1
- function a310_0x3371(){const _0x5e8772=['475338iOFbqR','1206455UQaXcN','4uPTWHz','25956WfmfuD','.rabetbase','230290Jrpypk','24XTNVsK','644022XeJIZA','4gwKsKS','sql.lock.json','864297LVARRo','348131fTnnHq','sql-trash'];a310_0x3371=function(){return _0x5e8772;};return a310_0x3371();}const a310_0x45f9a0=a310_0xbe1c;(function(_0x587e6f,_0x5b4fb5){const _0x503e06=a310_0xbe1c,_0x1e5916=_0x587e6f();while(!![]){try{const _0x1b2828=parseInt(_0x503e06(0x17e))/0x1*(parseInt(_0x503e06(0x17f))/0x2)+parseInt(_0x503e06(0x17c))/0x3+parseInt(_0x503e06(0x184))/0x4*(-parseInt(_0x503e06(0x17d))/0x5)+-parseInt(_0x503e06(0x183))/0x6+-parseInt(_0x503e06(0x17a))/0x7*(-parseInt(_0x503e06(0x182))/0x8)+parseInt(_0x503e06(0x179))/0x9+parseInt(_0x503e06(0x181))/0xa;if(_0x1b2828===_0x5b4fb5)break;else _0x1e5916['push'](_0x1e5916['shift']());}catch(_0x2de1fb){_0x1e5916['push'](_0x1e5916['shift']());}}}(a310_0x3371,0x1fbc7));import{resolve}from'node:path';import{findProjectRootDirectory}from'../../context.js';const DOT_DIR=a310_0x45f9a0(0x180),LOCK_FILE_NAME=a310_0x45f9a0(0x185),TRASH_DIR_NAME=a310_0x45f9a0(0x17b);function a310_0xbe1c(_0x1f9a0c,_0x494727){_0x1f9a0c=_0x1f9a0c-0x179;const _0x337167=a310_0x3371();let _0xbe1c1e=_0x337167[_0x1f9a0c];return _0xbe1c1e;}export function loadSqlProjectConfig(_0x289bac,_0x4f0bfd){const _0x15b94f=resolve(_0x4f0bfd??findProjectRootDirectory()),_0x198594=DOT_DIR+'/sql',_0x51864c=_0x198594+'/'+_0x289bac;return{'projectRoot':_0x15b94f,'appCode':_0x289bac,'sqlWorkspaceRoot':_0x198594,'sqlRoot':_0x51864c,'sqlRootDir':resolve(_0x15b94f,DOT_DIR,'sql',_0x289bac),'lockFilePath':resolve(_0x15b94f,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0x15b94f,DOT_DIR,TRASH_DIR_NAME)};}
1
+ import{resolve}from"node:path";import{findProjectRootDirectory}from"../../context.js";const DOT_DIR=".rabetbase";const LOCK_FILE_NAME="sql.lock.json";const TRASH_DIR_NAME="sql-trash";export function loadSqlProjectConfig(appCode,projectRoot){const root=resolve(projectRoot??findProjectRootDirectory());const sqlWorkspaceRoot=`${DOT_DIR}/sql`;const sqlRoot=`${sqlWorkspaceRoot}/${appCode}`;return{projectRoot:root,appCode:appCode,sqlWorkspaceRoot:sqlWorkspaceRoot,sqlRoot:sqlRoot,sqlRootDir:resolve(root,DOT_DIR,"sql",appCode),lockFilePath:resolve(root,DOT_DIR,LOCK_FILE_NAME),trashDir:resolve(root,DOT_DIR,TRASH_DIR_NAME)}}
@@ -1 +1,3 @@
1
- (function(_0x1f68b3,_0x509eb7){const _0x4ddeb3=a311_0x3bc0,_0x26948d=_0x1f68b3();while(!![]){try{const _0x5bd4af=-parseInt(_0x4ddeb3(0x187))/0x1*(parseInt(_0x4ddeb3(0x1a3))/0x2)+parseInt(_0x4ddeb3(0x190))/0x3*(-parseInt(_0x4ddeb3(0x18c))/0x4)+-parseInt(_0x4ddeb3(0x18d))/0x5+parseInt(_0x4ddeb3(0x1a1))/0x6+parseInt(_0x4ddeb3(0x1a2))/0x7+parseInt(_0x4ddeb3(0x19c))/0x8+parseInt(_0x4ddeb3(0x19f))/0x9;if(_0x5bd4af===_0x509eb7)break;else _0x26948d['push'](_0x26948d['shift']());}catch(_0x3a3ba9){_0x26948d['push'](_0x26948d['shift']());}}}(a311_0x12ab,0xb1163));function a311_0x12ab(){const _0x2d8b1d=['12TiwhWF','4161890uStkOJ','.xml','isDirectory','61704XKGmjK','mybatisXml','sqlRootDir','indexOf','sqlName','length','toLowerCase','split','name','path','dbName','sqlCode','2535928QHhzuq','filter','dbId','16991982lpHlVg','ENOENT','963366KUfQZU','1545635rqkUgy','56878thnnJD','sql','34YZwHbe','push','slice','.sql','mode'];a311_0x12ab=function(){return _0x2d8b1d;};return a311_0x12ab();}function a311_0x3bc0(_0x24ac4a,_0x585908){_0x24ac4a=_0x24ac4a-0x186;const _0x12ab15=a311_0x12ab();let _0x3bc0cd=_0x12ab15[_0x24ac4a];return _0x3bc0cd;}import{readdir,stat}from'node:fs/promises';import{extname,join,relative}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath}from'./utils.js';function extensionToMode(_0x506f98){const _0x386de9=a311_0x3bc0;if(_0x506f98===_0x386de9(0x18a))return _0x386de9(0x186);if(_0x506f98===_0x386de9(0x18e))return _0x386de9(0x191);return undefined;}async function scanSqlFilesRecursively(_0x27d793,_0x2b2959){const _0x8bfca9=a311_0x3bc0,_0x32952c=[];try{const _0x497e8c=await readdir(_0x27d793,{'withFileTypes':!![]});for(const _0x235027 of _0x497e8c){const _0x54bc74=join(_0x27d793,_0x235027[_0x8bfca9(0x198)]);if(_0x235027[_0x8bfca9(0x18f)]()){_0x32952c[_0x8bfca9(0x188)](...await scanSqlFilesRecursively(_0x54bc74,_0x2b2959));continue;}if(!_0x235027['isFile']())continue;const _0x1f690c=extname(_0x235027[_0x8bfca9(0x198)])[_0x8bfca9(0x196)](),_0x311616=extensionToMode(_0x1f690c);if(!_0x311616)continue;const _0x40ba40=relative(_0x2b2959,_0x54bc74)['replace'](/\\/g,'/'),_0x412546=_0x40ba40[_0x8bfca9(0x197)]('/')[_0x8bfca9(0x19d)](Boolean),_0x30933e=parseSqlPath(_0x412546,_0x235027[_0x8bfca9(0x198)],_0x1f690c);if(!_0x30933e)continue;_0x32952c['push']({'sqlCode':_0x30933e[_0x8bfca9(0x19b)],'sqlName':_0x30933e['sqlName'],'dbDirectory':_0x412546[0x0],'filePath':_0x54bc74,'relativePath':_0x40ba40,'lockKey':_0x30933e[_0x8bfca9(0x19b)],'mode':_0x311616});}}catch(_0x103b82){if(_0x103b82['code']!==_0x8bfca9(0x1a0))throw _0x103b82;}return _0x32952c;}export async function scanLocalSqlQueries(_0x51f0ed){const _0x2116b3=a311_0x3bc0;return scanSqlFilesRecursively(_0x51f0ed[_0x2116b3(0x192)],_0x51f0ed[_0x2116b3(0x192)]);}export function resolveLocalSqlFilePath(_0x2d331a,_0x23192c,_0x449b2f){const _0x47cdfc=a311_0x3bc0,_0x3963d4=_0x449b2f?.[_0x47cdfc(0x199)]||(_0x449b2f?.['sqlName']||_0x449b2f?.['dbName']?buildSqlRelativePath(_0x23192c,_0x449b2f?.[_0x47cdfc(0x194)],_0x449b2f?.[_0x47cdfc(0x19a)],_0x449b2f?.[_0x47cdfc(0x18b)]||_0x47cdfc(0x186),_0x449b2f?.[_0x47cdfc(0x19e)]):buildDefaultSqlFileName(_0x23192c,_0x449b2f?.[_0x47cdfc(0x18b)]||'sql'));return join(_0x2d331a[_0x47cdfc(0x192)],_0x3963d4);}export async function directoryExists(_0x4de920){const _0x186aa4=a311_0x3bc0;try{const _0x466914=await stat(_0x4de920);return _0x466914[_0x186aa4(0x18f)]();}catch{return![];}}function parseSqlPath(_0x4894c8,_0x324d6d,_0x32f178){const _0xedb554=a311_0x3bc0,_0x42b579=_0x324d6d['slice'](0x0,-_0x32f178[_0xedb554(0x195)]);if(_0x4894c8[_0xedb554(0x195)]<0x2)return null;const _0x41e1f8=_0x42b579[_0xedb554(0x193)]('_');if(_0x41e1f8<=0x0||_0x41e1f8>=_0x42b579[_0xedb554(0x195)]-0x1)return null;const _0x388bb8=_0x42b579[_0xedb554(0x189)](0x0,_0x41e1f8);if(!isLikelySqlCode(_0x388bb8))return null;return{'sqlCode':_0x388bb8,'sqlName':_0x42b579[_0xedb554(0x189)](_0x41e1f8+0x1)};}function isLikelySqlCode(_0x2b5dba){return/^[A-Za-z0-9-]+-[A-Za-z0-9-]+$/['test'](_0x2b5dba);}
1
+ import{readdir,stat}from"node:fs/promises";import{extname,join,relative}from"node:path";import{buildDefaultSqlFileName,buildSqlRelativePath}from"./utils.js";function extensionToMode(extension){if(extension===".sql")return"sql";if(extension===".xml")return"mybatisXml";return undefined}async function scanSqlFilesRecursively(dir,rootDir){const result=[];try{const entries=await readdir(dir,{withFileTypes:true});for(const entry of entries){const fullPath=join(dir,entry.name);if(entry.isDirectory()){result.push(...await scanSqlFilesRecursively(fullPath,rootDir));continue}if(!entry.isFile())continue;const extension=extname(entry.name).toLowerCase();const mode=extensionToMode(extension);if(!mode)continue;const relativePath=relative(rootDir,fullPath).replace(/\\/g,"/");const segments=relativePath.split("/").filter(Boolean);const parsed=parseSqlPath(segments,entry.name,extension);if(!parsed)continue;result.push({sqlCode:parsed.sqlCode,sqlName:parsed.sqlName,dbDirectory:segments[0],
2
+ filePath:fullPath,relativePath:relativePath,lockKey:parsed.sqlCode,mode:mode})}}catch(error){if(error.code!=="ENOENT")throw error}return result}export async function scanLocalSqlQueries(config){return scanSqlFilesRecursively(config.sqlRootDir,config.sqlRootDir)}export function resolveLocalSqlFilePath(config,sqlCode,lockEntry){const relativePath=lockEntry?.path||(lockEntry?.sqlName||lockEntry?.dbName?buildSqlRelativePath(sqlCode,lockEntry?.sqlName,lockEntry?.dbName,lockEntry?.mode||"sql",lockEntry?.dbId):buildDefaultSqlFileName(sqlCode,lockEntry?.mode||"sql"));return join(config.sqlRootDir,relativePath)}export async function directoryExists(dirPath){try{const s=await stat(dirPath);return s.isDirectory()}catch{return false}}function parseSqlPath(segments,fileName,extension){const fileBaseName=fileName.slice(0,-extension.length);if(segments.length<2){return null}const underscoreIndex=fileBaseName.indexOf("_");if(underscoreIndex<=0||underscoreIndex>=fileBaseName.length-1){return null}
3
+ const sqlCode=fileBaseName.slice(0,underscoreIndex);if(!isLikelySqlCode(sqlCode)){return null}return{sqlCode:sqlCode,sqlName:fileBaseName.slice(underscoreIndex+1)}}function isLikelySqlCode(value){return/^[A-Za-z0-9-]+-[A-Za-z0-9-]+$/.test(value)}
@@ -1 +1 @@
1
- (function(_0x12bb43,_0x5e9cc0){const _0x39dd01=a312_0x3161,_0x43a16b=_0x12bb43();while(!![]){try{const _0x36dbb8=parseInt(_0x39dd01(0x98))/0x1*(parseInt(_0x39dd01(0x91))/0x2)+parseInt(_0x39dd01(0x9a))/0x3+parseInt(_0x39dd01(0x92))/0x4*(parseInt(_0x39dd01(0x9b))/0x5)+-parseInt(_0x39dd01(0x99))/0x6+-parseInt(_0x39dd01(0x96))/0x7*(-parseInt(_0x39dd01(0x93))/0x8)+-parseInt(_0x39dd01(0x8e))/0x9+-parseInt(_0x39dd01(0x94))/0xa;if(_0x36dbb8===_0x5e9cc0)break;else _0x43a16b['push'](_0x43a16b['shift']());}catch(_0x1b88dc){_0x43a16b['push'](_0x43a16b['shift']());}}}(a312_0x25dd,0x7cda0));import{readFile}from'node:fs/promises';import a312_0x1f045e from'node:crypto';export function computeSqlContentHash(_0x2c8820){const _0x34536f=a312_0x3161;return a312_0x1f045e[_0x34536f(0x95)](_0x34536f(0x8f))['update'](_0x2c8820)[_0x34536f(0x90)]('hex');}function a312_0x3161(_0x474692,_0x1b3934){_0x474692=_0x474692-0x8e;const _0x25dd70=a312_0x25dd();let _0x316188=_0x25dd70[_0x474692];return _0x316188;}function a312_0x25dd(){const _0x55af5b=['2CXLvyR','2235260wpBUOw','27688dYkbAe','3962240zWPxjX','createHash','924pFQTJX','utf8','123131PlPKOw','989526eztRvO','1948269HclOjk','5OVzZvA','6441156TTIiHf','md5','digest'];a312_0x25dd=function(){return _0x55af5b;};return a312_0x25dd();}export async function computeSqlFileHash(_0xca3462){const _0x2e1243=a312_0x3161,_0x106f76=await readFile(_0xca3462,_0x2e1243(0x97));return computeSqlContentHash(_0x106f76);}
1
+ import{readFile}from"node:fs/promises";import crypto from"node:crypto";export function computeSqlContentHash(content){return crypto.createHash("md5").update(content).digest("hex")}export async function computeSqlFileHash(filePath){const content=await readFile(filePath,"utf8");return computeSqlContentHash(content)}
@@ -1 +1,2 @@
1
- (function(_0x28ed98,_0x9baedc){const _0x4b57e6=a313_0x5450,_0x3e0bfb=_0x28ed98();while(!![]){try{const _0x52170b=-parseInt(_0x4b57e6(0x14b))/0x1*(parseInt(_0x4b57e6(0x147))/0x2)+-parseInt(_0x4b57e6(0x14e))/0x3*(parseInt(_0x4b57e6(0x14d))/0x4)+parseInt(_0x4b57e6(0x144))/0x5*(parseInt(_0x4b57e6(0x14a))/0x6)+-parseInt(_0x4b57e6(0x142))/0x7*(-parseInt(_0x4b57e6(0x143))/0x8)+parseInt(_0x4b57e6(0x141))/0x9+-parseInt(_0x4b57e6(0x14c))/0xa+-parseInt(_0x4b57e6(0x149))/0xb*(-parseInt(_0x4b57e6(0x150))/0xc);if(_0x52170b===_0x9baedc)break;else _0x3e0bfb['push'](_0x3e0bfb['shift']());}catch(_0x105444){_0x3e0bfb['push'](_0x3e0bfb['shift']());}}}(a313_0x594c,0x92ca5));function a313_0x5450(_0x65ef95,_0x1b35b6){_0x65ef95=_0x65ef95-0x141;const _0x594c64=a313_0x594c();let _0x545040=_0x594c64[_0x65ef95];return _0x545040;}import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';export function createEmptySqlLock(){return{'apps':{}};}function a313_0x594c(){const _0x3be2d3=['16uylSQV','5PFcphP','sqls','utf8','2HtrbUk','\x22.\x20','2695iMACXw','967710JzHwWU','1079707rzNBdT','523130tlnASU','720752KsGjHc','6SUdRMG','sqlRoot','20676QnmtJa',':\x20sqlRoot\x20mismatch\x20—\x20current\x20\x22','code','lastSync','7598817bazwgn','2330706lTrrOQ'];a313_0x594c=function(){return _0x3be2d3;};return a313_0x594c();}export function ensureSqlLockScope(_0xc83ac7,_0x36e41e,_0xa45308,_0xffcd8c){const _0x2a3df3=a313_0x5450,_0x3810cd=_0xc83ac7??createEmptySqlLock();let _0xa71b2a=_0x3810cd['apps'][_0x36e41e];if(!_0xa71b2a)return _0xa71b2a={'sqlRoot':_0xa45308,'lastSync':'','sqls':{}},_0x3810cd['apps'][_0x36e41e]=_0xa71b2a,{'lockData':_0x3810cd,'appLock':_0xa71b2a};if(!_0xa71b2a[_0x2a3df3(0x14f)])_0xa71b2a[_0x2a3df3(0x14f)]=_0xa45308;else{if(_0xa71b2a[_0x2a3df3(0x14f)]!==_0xa45308)throw new Error(_0xffcd8c+_0x2a3df3(0x151)+_0xa45308+'\x22\x20vs\x20lock\x20\x22'+_0xa71b2a[_0x2a3df3(0x14f)]+_0x2a3df3(0x148)+'Check\x20.rabetbase/sql.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.');}return!_0xa71b2a['sqls']&&(_0xa71b2a[_0x2a3df3(0x145)]={}),!_0xa71b2a[_0x2a3df3(0x153)]&&(_0xa71b2a[_0x2a3df3(0x153)]=''),{'lockData':_0x3810cd,'appLock':_0xa71b2a};}export async function readSqlLockFile(_0x16195f){const _0x373e01=a313_0x5450;try{const _0x335a04=await readFile(_0x16195f,_0x373e01(0x146));return JSON['parse'](_0x335a04);}catch(_0x540811){if(_0x540811[_0x373e01(0x152)]==='ENOENT')return null;throw new Error('Failed\x20to\x20read\x20SQL\x20lock\x20file:\x20'+String(_0x540811));}}export async function writeSqlLockFile(_0x52f21a,_0x4d241a){const _0x2cb2d0=a313_0x5450;await mkdir(dirname(_0x52f21a),{'recursive':!![]}),await writeFile(_0x52f21a,JSON['stringify'](_0x4d241a,null,0x2),_0x2cb2d0(0x146));}
1
+ import{mkdir,readFile,writeFile}from"node:fs/promises";import{dirname}from"node:path";export function createEmptySqlLock(){return{apps:{}}}export function ensureSqlLockScope(lockData,currentAppCode,currentSqlRoot,commandName){const nextLockData=lockData??createEmptySqlLock();let appLock=nextLockData.apps[currentAppCode];if(!appLock){appLock={sqlRoot:currentSqlRoot,lastSync:"",sqls:{}};nextLockData.apps[currentAppCode]=appLock;return{lockData:nextLockData,appLock:appLock}}if(!appLock.sqlRoot){appLock.sqlRoot=currentSqlRoot}else if(appLock.sqlRoot!==currentSqlRoot){throw new Error(`${commandName}: sqlRoot mismatch — current "${currentSqlRoot}" vs lock "${appLock.sqlRoot}". `+`Check .rabetbase/sql.lock.json or operate from the correct project directory.`)}if(!appLock.sqls){appLock.sqls={}}if(!appLock.lastSync){appLock.lastSync=""}return{lockData:nextLockData,appLock:appLock}}export async function readSqlLockFile(lockFilePath){try{const content=await readFile(lockFilePath,"utf8")
2
+ ;return JSON.parse(content)}catch(error){if(error.code==="ENOENT"){return null}throw new Error(`Failed to read SQL lock file: ${String(error)}`)}}export async function writeSqlLockFile(lockFilePath,lockData){await mkdir(dirname(lockFilePath),{recursive:true});await writeFile(lockFilePath,JSON.stringify(lockData,null,2),"utf8")}
@@ -1 +1 @@
1
- export{};
1
+ export{};
@@ -1 +1,2 @@
1
- (function(_0xb8eb84,_0x4bed14){const _0x25f39a=a315_0x2ef5,_0x11db13=_0xb8eb84();while(!![]){try{const _0x2aaf19=parseInt(_0x25f39a(0x18f))/0x1*(-parseInt(_0x25f39a(0x18a))/0x2)+parseInt(_0x25f39a(0x18e))/0x3*(-parseInt(_0x25f39a(0x183))/0x4)+-parseInt(_0x25f39a(0x18c))/0x5*(-parseInt(_0x25f39a(0x184))/0x6)+parseInt(_0x25f39a(0x185))/0x7*(-parseInt(_0x25f39a(0x18d))/0x8)+-parseInt(_0x25f39a(0x188))/0x9+-parseInt(_0x25f39a(0x18b))/0xa*(-parseInt(_0x25f39a(0x191))/0xb)+-parseInt(_0x25f39a(0x186))/0xc*(-parseInt(_0x25f39a(0x190))/0xd);if(_0x2aaf19===_0x4bed14)break;else _0x11db13['push'](_0x11db13['shift']());}catch(_0x4c0e94){_0x11db13['push'](_0x11db13['shift']());}}}(a315_0x488d,0x8d565));import{detectSqlSourceMode}from'../../core/sql-validator.js';export function detectSqlMode(_0x49ef0a){return detectSqlSourceMode(_0x49ef0a);}export function getSqlFileExtension(_0x371752){const _0x1acb62=a315_0x2ef5;return _0x371752==='mybatisXml'?_0x1acb62(0x189):'.sql';}export function buildDefaultSqlFileName(_0x2b4843,_0x4c3eb){return''+_0x2b4843+getSqlFileExtension(_0x4c3eb);}export function sanitizeSqlPathSegment(_0x5bd8a5,_0x32cf35){const _0x427acf=a315_0x2ef5,_0x30d88d=String(_0x5bd8a5??'')[_0x427acf(0x193)](),_0x26c7a1=_0x30d88d[_0x427acf(0x187)](/[<>:"/\\|?*\u0000-\u001F]/g,'-')['replace'](/\s+/g,'-')[_0x427acf(0x187)](/-+/g,'-')[_0x427acf(0x187)](/^\.+/,'')['replace'](/\.+$/,'')[_0x427acf(0x187)](/^-+/,'')[_0x427acf(0x187)](/-+$/,'');return _0x26c7a1||_0x32cf35;}function a315_0x2ef5(_0x29723b,_0x18ca70){_0x29723b=_0x29723b-0x182;const _0x488d9f=a315_0x488d();let _0x2ef5ed=_0x488d9f[_0x29723b];return _0x2ef5ed;}function a315_0x488d(){const _0x371f7d=['2612129mgBwhQ','11ccAuuV','unknown-sql','trim','db-','8460AjKSgt','10068XfdtLj','49VifMKf','132RVhUtc','replace','1427697QzbqfP','.xml','6910WmrVoD','2081050rWCOQy','35VuHDDG','609016dIhslR','753DaqeoL','182yMhUxo'];a315_0x488d=function(){return _0x371f7d;};return a315_0x488d();}export function buildDbDirectoryName(_0x1a36fb,_0x46722d){const _0xf1214a=a315_0x2ef5;return sanitizeSqlPathSegment(_0x1a36fb,_0x46722d!=null?_0xf1214a(0x182)+_0x46722d:'unknown-db');}export function buildSqlRelativePath(_0x5c3d56,_0x915c46,_0x45f86d,_0x4aa90c,_0x52982a){const _0x39c021=a315_0x2ef5,_0x135026=buildDbDirectoryName(_0x45f86d,_0x52982a),_0xbb95a4=sanitizeSqlPathSegment(_0x5c3d56,_0x39c021(0x192)),_0x2c7836=sanitizeSqlPathSegment(_0x915c46,_0xbb95a4);return _0x135026+'/'+_0xbb95a4+'_'+_0x2c7836+getSqlFileExtension(_0x4aa90c);}
1
+ import{detectSqlSourceMode}from"../../core/sql-validator.js";export function detectSqlMode(sqlContent){return detectSqlSourceMode(sqlContent)}export function getSqlFileExtension(mode){return mode==="mybatisXml"?".xml":".sql"}export function buildDefaultSqlFileName(sqlCode,mode){return`${sqlCode}${getSqlFileExtension(mode)}`}export function sanitizeSqlPathSegment(value,fallback){const trimmed=String(value??"").trim();const normalized=trimmed.replace(/[<>:"/\\|?*\u0000-\u001F]/g,"-").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^\.+/,"").replace(/\.+$/,"").replace(/^-+/,"").replace(/-+$/,"");return normalized||fallback}export function buildDbDirectoryName(dbName,dbId){return sanitizeSqlPathSegment(dbName,dbId!=null?`db-${dbId}`:"unknown-db")}export function buildSqlRelativePath(sqlCode,sqlName,dbName,mode,dbId){const dbDirName=buildDbDirectoryName(dbName,dbId);const safeSqlCode=sanitizeSqlPathSegment(sqlCode,"unknown-sql");const safeSqlName=sanitizeSqlPathSegment(sqlName,safeSqlCode)
2
+ ;return`${dbDirName}/${safeSqlCode}_${safeSqlName}${getSqlFileExtension(mode)}`}
@@ -1 +1,15 @@
1
- const a316_0x133145=a316_0x4607;(function(_0x57c05a,_0x3e263c){const _0x888e17=a316_0x4607,_0x2eb490=_0x57c05a();while(!![]){try{const _0x586e4f=-parseInt(_0x888e17(0xfa))/0x1*(-parseInt(_0x888e17(0xf6))/0x2)+-parseInt(_0x888e17(0xec))/0x3+-parseInt(_0x888e17(0x104))/0x4+-parseInt(_0x888e17(0x108))/0x5*(-parseInt(_0x888e17(0xde))/0x6)+-parseInt(_0x888e17(0xfc))/0x7*(-parseInt(_0x888e17(0xb2))/0x8)+-parseInt(_0x888e17(0xc5))/0x9+-parseInt(_0x888e17(0xe2))/0xa*(-parseInt(_0x888e17(0xf9))/0xb);if(_0x586e4f===_0x3e263c)break;else _0x2eb490['push'](_0x2eb490['shift']());}catch(_0x172573){_0x2eb490['push'](_0x2eb490['shift']());}}}(a316_0x5d5c,0x9e103));const MYBATIS_OUTER_TAGS=new Map([['select',a316_0x133145(0x10a)],[a316_0x133145(0x10c),a316_0x133145(0xe4)],[a316_0x133145(0xdb),a316_0x133145(0xf8)],[a316_0x133145(0xc8),a316_0x133145(0x106)]]),MYBATIS_DYNAMIC_TAGS=new Set(['if','where',a316_0x133145(0xe7),a316_0x133145(0xab),a316_0x133145(0x100),'otherwise',a316_0x133145(0xd5),'set',a316_0x133145(0xa8),a316_0x133145(0xa5),a316_0x133145(0xbd)]),MYBATIS_BRANCH_TAGS=new Set(['if',a316_0x133145(0xe7),a316_0x133145(0xab),a316_0x133145(0x100),a316_0x133145(0xa7)]);function a316_0x5d5c(){const _0x264106=['Unterminated\x20XML\x20comment.','\x20statements\x20require\x20explicit\x20review.\x20Local\x20analysis\x20does\x20not\x20authorize\x20saving\x20or\x20execution.','SQL\x20contains\x20modification\x20statements\x20alongside\x20SELECT','\x20query\x20targeting\x20','property','add','Unterminated\x20CDATA\x20section.','from','DDL','SQL\x20text\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.','matchAll','rawName','4761549BfnRKM','\x20with\x20parameters:\x20','\x20WHERE\x20','delete',']]>','get','outer','unknown\x20table(s)','CDATA\x20sections\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.',')\x5cb','replace','some','keys','error','isDangerous','sql','trim','<!--','XML\x20declarations\x20must\x20precede\x20the\x20MyBatis\x20statement\x20wrapper.','tagName','Unterminated\x20MyBatis\x20XML\x20tag.','fromCodePoint','update','SET','reason','24pBeeGj','exec','KEY','LOCK\x20IN\x20SHARE\x20MODE','1168810SNAQvs','DDL\x20statements\x20require\x20explicit\x20review','INSERT','slice','toLowerCase','foreach','has','WITH','join','parseInt','1236711WEJkNg','__RABETBASE_UNRESOLVED_SQL_FRAGMENT__','pop','startsWith','MyBatis\x20dynamic\x20tag\x20names\x20must\x20be\x20lowercase:\x20<','-->','Multiple\x20MyBatis\x20statement\x20wrappers\x20are\x20not\x20supported.','replaceAll','mybatisXml','Unterminated\x20XML\x20declaration.','68MpUFQR','&lt;','UPDATE','143HiCypw','4751sszKHq','Invalid\x20MyBatis\x20XML\x20closing\x20tag:\x20</','31661TrLSVg','push','__RABETBASE_MYBATIS_DYNAMIC_START__','DELETE\x20statements\x20require\x20explicit\x20review','when','Local\x20analysis\x20could\x20not\x20parse\x20the\x20WITH\x20prefix;\x20this\x20is\x20a\x20local\x20capability\x20limit,\x20not\x20a\x20platform\x20rejection.','SQL\x20contains\x20blocked\x20DELETE\x20or\x20DDL\x20statements','filter','1158824EREipW','Unable\x20to\x20detect\x20SQL\x20type.\x20','DELETE','Unable\x20to\x20detect\x20SQL\x20type.\x20Please\x20check\x20the\x20SQL\x20content.','65885nTegFU','MyBatis\x20XML\x20must\x20contain\x20exactly\x20one\x20complete\x20statement\x20wrapper.','SELECT','test','insert','Unclosed\x20MyBatis\x20XML\x20tag:\x20<','match','__RABETBASE_MYBATIS_DYNAMIC_END__','toUpperCase','where','<![CDATA[','SHARE','&amp;','include','string','otherwise','bind','&gt;','UNKNOWN','choose','Unsupported\x20MyBatis\x20XML\x20tag:\x20<','SQL\x20content\x20is\x20empty','type','MATERIALIZED','Invalid\x20MyBatis\x20XML\x20tag.','__RABETBASE_MYBATIS_INCLUDE_UNRESOLVED__','256ldGifA','Invalid\x20attributes\x20on\x20MyBatis\x20XML\x20tag:\x20<','NOT','includes','FOR','length','indexOf'];a316_0x5d5c=function(){return _0x264106;};return a316_0x5d5c();}export const MYBATIS_DYNAMIC_START_MARKER=a316_0x133145(0xfe);export const MYBATIS_DYNAMIC_END_MARKER=a316_0x133145(0x9f);export const MYBATIS_INCLUDE_MARKER=a316_0x133145(0xb1);const UNRESOLVED_SQL_FRAGMENT=a316_0x133145(0xed),MYBATIS_OUTER_TAG_PATTERN=new RegExp('^<\x5cs*(?:'+[...MYBATIS_OUTER_TAGS[a316_0x133145(0xd1)]()][a316_0x133145(0xea)]('|')+a316_0x133145(0xce),'i');export function normalizeSqlForStaticAnalysis(_0x47bafa){const _0x44d5d1=a316_0x133145,_0x45b6b0=typeof _0x47bafa===_0x44d5d1(0xa6)?_0x47bafa:'';if(detectSqlSourceMode(_0x45b6b0)===_0x44d5d1(0xd4))return{'sql':_0x45b6b0,'mode':_0x44d5d1(0xd4)};let _0x407d01=0x0,_0x393cf2='',_0x5ba48b,_0x29c123=![],_0x52a763=![];const _0x396178=[];while(_0x407d01<_0x45b6b0[_0x44d5d1(0xb7)]){if(_0x45b6b0['startsWith'](_0x44d5d1(0xd6),_0x407d01)){const _0x3dd45e=_0x45b6b0[_0x44d5d1(0xb8)](_0x44d5d1(0xf1),_0x407d01+0x4);if(_0x3dd45e<0x0)return invalidMybatisSource(_0x44d5d1(0xb9));_0x393cf2+='\x20',_0x407d01=_0x3dd45e+0x3;continue;}if(_0x45b6b0[_0x44d5d1(0xef)](_0x44d5d1(0xa2),_0x407d01)){if(!_0x29c123||_0x52a763)return invalidMybatisSource(_0x44d5d1(0xcd));const _0x4a6c66=_0x45b6b0[_0x44d5d1(0xb8)](_0x44d5d1(0xc9),_0x407d01+0x9);if(_0x4a6c66<0x0)return invalidMybatisSource(_0x44d5d1(0xbf));_0x393cf2+=_0x45b6b0[_0x44d5d1(0xe5)](_0x407d01+0x9,_0x4a6c66),_0x407d01=_0x4a6c66+0x3;continue;}if(_0x45b6b0[_0x44d5d1(0xef)]('<?',_0x407d01)){if(_0x29c123)return invalidMybatisSource(_0x44d5d1(0xd7));const _0x26bf72=_0x45b6b0[_0x44d5d1(0xb8)]('?>',_0x407d01+0x2);if(_0x26bf72<0x0)return invalidMybatisSource(_0x44d5d1(0xf5));_0x393cf2+='\x20',_0x407d01=_0x26bf72+0x2;continue;}if(_0x45b6b0[_0x407d01]!=='<'){const _0x3b3a35=_0x45b6b0[_0x44d5d1(0xb8)]('<',_0x407d01),_0x1d2fa4=_0x3b3a35<0x0?_0x45b6b0[_0x44d5d1(0xb7)]:_0x3b3a35,_0xbb505d=_0x45b6b0[_0x44d5d1(0xe5)](_0x407d01,_0x1d2fa4);if((!_0x29c123||_0x52a763)&&_0xbb505d[_0x44d5d1(0xd5)]())return invalidMybatisSource(_0x44d5d1(0xc2));if(_0x29c123&&!_0x52a763){const _0x3cb22c=decodeXmlEntities(_0xbb505d);if(_0x3cb22c===null)return invalidMybatisSource('Invalid\x20XML\x20entity\x20reference.');_0x393cf2+=_0x3cb22c;}else _0x393cf2+='\x20';_0x407d01=_0x1d2fa4;continue;}const _0x2bdbec=findXmlTagEnd(_0x45b6b0,_0x407d01);if(_0x2bdbec<0x0)return invalidMybatisSource(_0x44d5d1(0xd9));const _0xe22482=_0x45b6b0[_0x44d5d1(0xe5)](_0x407d01,_0x2bdbec+0x1),_0x4f7ac6=/^<\s*(\/?)\s*([A-Za-z][\w:-]*)([\s\S]*?)(\/?)\s*>$/[_0x44d5d1(0xdf)](_0xe22482);if(!_0x4f7ac6)return invalidMybatisSource(_0x44d5d1(0xb0));const _0x1d2f54=_0x4f7ac6[0x1]==='/',_0x4b388f=_0x4f7ac6[0x2]??'',_0x40de63=_0x4b388f[_0x44d5d1(0xe6)](),_0x33c742=_0x4f7ac6[0x3]??'',_0x8d5b46=_0x4f7ac6[0x4]==='/',_0x1f15e9=MYBATIS_OUTER_TAGS[_0x44d5d1(0xca)](_0x40de63);if(!_0x1f15e9&&!MYBATIS_DYNAMIC_TAGS[_0x44d5d1(0xe8)](_0x40de63))return invalidMybatisSource(_0x44d5d1(0xac)+_0x40de63+'>.');if(!_0x1f15e9&&_0x4b388f!==_0x40de63)return invalidMybatisSource(_0x44d5d1(0xf0)+_0x4b388f+'>.');if(_0x1d2f54){if(_0x33c742[_0x44d5d1(0xd5)]()||_0x8d5b46)return invalidMybatisSource(_0x44d5d1(0xfb)+_0x4b388f+'>.');const _0x196f72=_0x396178['at'](-0x1);if(!_0x196f72||(_0x196f72['outer']?_0x196f72[_0x44d5d1(0xd8)]!==_0x40de63:_0x196f72[_0x44d5d1(0xc4)]!==_0x4b388f))return invalidMybatisSource('Mismatched\x20MyBatis\x20XML\x20closing\x20tag:\x20</'+_0x4b388f+'>.');_0x396178[_0x44d5d1(0xee)]();if(_0x196f72[_0x44d5d1(0xcb)])_0x52a763=!![];_0x393cf2+=MYBATIS_BRANCH_TAGS['has'](_0x40de63)?'\x20'+MYBATIS_DYNAMIC_END_MARKER+'\x20':'\x20';}else{if(!hasWellFormedXmlAttributes(_0x33c742))return invalidMybatisSource(_0x44d5d1(0xb3)+_0x4b388f+'>.');if(_0x40de63==='property'&&(!_0x8d5b46||_0x396178['at'](-0x1)?.[_0x44d5d1(0xd8)]!==_0x44d5d1(0xa5)))return invalidMybatisSource('MyBatis\x20<property>\x20must\x20be\x20a\x20self-closing\x20direct\x20child\x20of\x20<include>.');if(_0x1f15e9){if(_0x29c123||_0x396178[_0x44d5d1(0xb7)]>0x0)return invalidMybatisSource(_0x44d5d1(0xf2));_0x29c123=!![],_0x52a763=_0x8d5b46,_0x5ba48b=_0x1f15e9;}else{if(!_0x29c123||_0x52a763)return invalidMybatisSource('MyBatis\x20dynamic\x20tag\x20must\x20be\x20inside\x20the\x20statement\x20wrapper:\x20<'+_0x4b388f+'>.');}_0x393cf2+=_0x40de63===_0x44d5d1(0xa1)?_0x44d5d1(0xc7):_0x40de63==='set'?'\x20SET\x20':_0x40de63===_0x44d5d1(0xa5)?'\x20'+MYBATIS_INCLUDE_MARKER+'\x20':MYBATIS_BRANCH_TAGS[_0x44d5d1(0xe8)](_0x40de63)&&!_0x8d5b46?'\x20'+MYBATIS_DYNAMIC_START_MARKER+'\x20':'\x20',!_0x8d5b46&&_0x396178[_0x44d5d1(0xfd)]({'rawName':_0x4b388f,'tagName':_0x40de63,'outer':!!_0x1f15e9});}_0x407d01=_0x2bdbec+0x1;}if(_0x396178['length']>0x0)return invalidMybatisSource(_0x44d5d1(0x10d)+_0x396178['at'](-0x1)?.[_0x44d5d1(0xc4)]+'>.');if(!_0x29c123||!_0x52a763)return invalidMybatisSource(_0x44d5d1(0x109));return{'sql':_0x393cf2[_0x44d5d1(0xd5)](),'mode':_0x44d5d1(0xf4),..._0x5ba48b?{'statementType':_0x5ba48b}:{}};}function hasWellFormedXmlAttributes(_0xf0b6c0){const _0x7b7904=a316_0x133145;let _0x26a281=0x0;const _0x21a989=new Set();while(_0x26a281<_0xf0b6c0[_0x7b7904(0xb7)]){while(_0x26a281<_0xf0b6c0[_0x7b7904(0xb7)]&&/\s/[_0x7b7904(0x10b)](_0xf0b6c0[_0x26a281]??''))_0x26a281+=0x1;if(_0x26a281>=_0xf0b6c0['length'])return!![];const _0x10c35e=/^[A-Za-z_:][\w:.-]*/[_0x7b7904(0xdf)](_0xf0b6c0[_0x7b7904(0xe5)](_0x26a281)),_0x55c57d=_0x10c35e?.[0x0];if(!_0x55c57d||_0x21a989[_0x7b7904(0xe8)](_0x55c57d))return![];_0x21a989['add'](_0x55c57d),_0x26a281+=_0x55c57d[_0x7b7904(0xb7)];while(_0x26a281<_0xf0b6c0[_0x7b7904(0xb7)]&&/\s/[_0x7b7904(0x10b)](_0xf0b6c0[_0x26a281]??''))_0x26a281+=0x1;if(_0xf0b6c0[_0x26a281]!=='=')return![];_0x26a281+=0x1;while(_0x26a281<_0xf0b6c0[_0x7b7904(0xb7)]&&/\s/['test'](_0xf0b6c0[_0x26a281]??''))_0x26a281+=0x1;const _0x52ceb5=_0xf0b6c0[_0x26a281];if(_0x52ceb5!=='\x22'&&_0x52ceb5!=='\x27')return![];_0x26a281+=0x1;const _0xdcc300=_0xf0b6c0[_0x7b7904(0xb8)](_0x52ceb5,_0x26a281);if(_0xdcc300<0x0)return![];if(decodeXmlEntities(_0xf0b6c0[_0x7b7904(0xe5)](_0x26a281,_0xdcc300))===null)return![];_0x26a281=_0xdcc300+0x1;}return!![];}export function detectSqlSourceMode(_0x29a427){const _0x25c952=a316_0x133145;let _0x2709f9=0x0;const _0x48150e=()=>{const _0x16d67f=a316_0x4607;while(_0x2709f9<_0x29a427[_0x16d67f(0xb7)]&&/\s/[_0x16d67f(0x10b)](_0x29a427[_0x2709f9]??''))_0x2709f9+=0x1;};_0x48150e();while(_0x2709f9<_0x29a427[_0x25c952(0xb7)]){if(_0x29a427['startsWith'](_0x25c952(0xd6),_0x2709f9)){const _0x425954=_0x29a427['indexOf']('-->',_0x2709f9+0x4);if(_0x425954<0x0)return _0x25c952(0xf4);_0x2709f9=_0x425954+0x3,_0x48150e();continue;}if(_0x29a427['startsWith']('<?',_0x2709f9)){const _0x9ec6ab=_0x29a427['indexOf']('?>',_0x2709f9+0x2);if(_0x9ec6ab<0x0)return _0x25c952(0xf4);_0x2709f9=_0x9ec6ab+0x2,_0x48150e();continue;}break;}return MYBATIS_OUTER_TAG_PATTERN['test'](_0x29a427['slice'](_0x2709f9))?_0x25c952(0xf4):_0x25c952(0xd4);}function a316_0x4607(_0x4b0f33,_0x3c01c8){_0x4b0f33=_0x4b0f33-0x9f;const _0x5d5cdd=a316_0x5d5c();let _0x460708=_0x5d5cdd[_0x4b0f33];return _0x460708;}function invalidMybatisSource(_0x1a33dd){return{'sql':'','mode':'mybatisXml','error':_0x1a33dd};}function findXmlTagEnd(_0x36b8b2,_0x27f5f2){const _0x154770=a316_0x133145;let _0x15fce6;for(let _0xc53a64=_0x27f5f2+0x1;_0xc53a64<_0x36b8b2[_0x154770(0xb7)];_0xc53a64+=0x1){const _0x480dc4=_0x36b8b2[_0xc53a64];if(_0x15fce6){if(_0x480dc4===_0x15fce6)_0x15fce6=undefined;continue;}if(_0x480dc4==='\x22'||_0x480dc4==='\x27'){_0x15fce6=_0x480dc4;continue;}if(_0x480dc4==='>')return _0xc53a64;}return-0x1;}function decodeXmlEntities(_0x6c0b0){const _0x5e0b69=a316_0x133145;let _0x1be8ba=![];const _0xb11f41=_0x6c0b0[_0x5e0b69(0xcf)](/&(?:#x[0-9a-f]+;|#[0-9]+;|[A-Za-z_:][\w:.-]*;)?/g,_0x4c35cb=>{const _0x2ceb4c=_0x5e0b69;if(_0x4c35cb===_0x2ceb4c(0xf7))return'<';if(_0x4c35cb===_0x2ceb4c(0xa9))return'>';if(_0x4c35cb==='&quot;')return'\x22';if(_0x4c35cb==='&apos;')return'\x27';if(_0x4c35cb===_0x2ceb4c(0xa4))return'&';const _0x5eb133=/^&#(?:x([0-9a-f]+)|([0-9]+));$/[_0x2ceb4c(0xdf)](_0x4c35cb);if(_0x5eb133){const _0x471f3e=_0x5eb133[0x1],_0x45cd50=_0x5eb133[0x2],_0x140e70=Number[_0x2ceb4c(0xeb)](_0x471f3e??_0x45cd50??'',_0x471f3e?0x10:0xa);if(isValidXmlCharacter(_0x140e70))return String[_0x2ceb4c(0xda)](_0x140e70);}return _0x1be8ba=!![],'';});return _0x1be8ba?null:_0xb11f41;}function isValidXmlCharacter(_0x395435){return _0x395435===0x9||_0x395435===0xa||_0x395435===0xd||_0x395435>=0x20&&_0x395435<=0xd7ff||_0x395435>=0xe000&&_0x395435<=0xfffd||_0x395435>=0x10000&&_0x395435<=0x10ffff;}export function detectSqlType(_0x1db538){return detectNormalizedSqlType(normalizeSqlForStaticAnalysis(_0x1db538));}function detectNormalizedSqlType(_0xed18d9){const _0x41f993=a316_0x133145;if(_0xed18d9['error'])return{'type':_0x41f993(0xaa),'isSelectOnly':![],'isDangerous':![],'reason':_0xed18d9[_0x41f993(0xd2)]};if(!_0xed18d9[_0x41f993(0xd4)][_0x41f993(0xd5)]())return{'type':'UNKNOWN','isSelectOnly':![],'isDangerous':![],'reason':_0x41f993(0xad)};const _0x1f31fe=tokenizeSqlForTypeAnalysis(_0xed18d9[_0x41f993(0xd4)]),_0x29d31b=_0x1f31fe[_0x41f993(0x103)](_0x265075=>_0x265075!==MYBATIS_DYNAMIC_START_MARKER&&_0x265075!==MYBATIS_DYNAMIC_END_MARKER),_0x5e0d68=findMainStatementIndex(_0x29d31b);if(_0x5e0d68<0x0)return{'type':'UNKNOWN','isSelectOnly':![],'isDangerous':![],'reason':_0x41f993(0x101)};const _0x73e132=_0x29d31b[_0x5e0d68]??'',_0x26973b=_0xed18d9['statementType']??_0x73e132,_0x5de4ed=_0x1f31fe[_0x41f993(0xd0)](_0x219e37=>/^(DELETE|DROP|ALTER|CREATE|TRUNCATE)$/['test'](_0x219e37)),_0x4f4fa5=new Set();let _0x5dbc46=![];for(let _0x23aad5=0x0;_0x23aad5<_0x1f31fe[_0x41f993(0xb7)];_0x23aad5+=0x1){const _0x3c7aa5=_0x1f31fe[_0x23aad5];(_0x3c7aa5==='UPDATE'||_0x3c7aa5===_0x41f993(0xa3))&&isLockingClauseKeyword(_0x1f31fe,_0x23aad5)&&(_0x4f4fa5[_0x41f993(0xbe)](_0x23aad5),_0x5dbc46=!![]);if(_0x1f31fe[_0x41f993(0xe5)](_0x23aad5,_0x23aad5+0x4)[_0x41f993(0xea)]('\x20')===_0x41f993(0xe1))_0x5dbc46=!![];}if(_0x26973b===_0x41f993(0x10a)){const _0x4e27d7=_0x1f31fe['some']((_0x3142b2,_0x492c5b)=>/^(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE)$/[_0x41f993(0x10b)](_0x3142b2)&&!_0x4f4fa5['has'](_0x492c5b));return{'type':_0x41f993(0x10a),'isSelectOnly':!_0x4e27d7&&!_0x5dbc46,'isLockingRead':_0x5dbc46,'isDangerous':_0x4e27d7,'reason':_0x4e27d7?_0x41f993(0xbb):undefined};}if(_0x26973b==='INSERT')return{'type':_0x41f993(0xe4),'isSelectOnly':![],'isDangerous':_0x5de4ed,'reason':_0x5de4ed?_0x41f993(0x102):undefined};if(_0x26973b===_0x41f993(0xf8))return{'type':_0x41f993(0xf8),'isSelectOnly':![],'isDangerous':_0x5de4ed,'reason':_0x5de4ed?'SQL\x20contains\x20blocked\x20DELETE\x20or\x20DDL\x20statements':undefined};if(_0x26973b===_0x41f993(0x106))return{'type':_0x41f993(0x106),'isSelectOnly':![],'isDangerous':!![],'reason':_0x41f993(0xff)};if(/^(CREATE|ALTER|DROP|TRUNCATE)/i['test'](_0x73e132))return{'type':_0x41f993(0xc1),'isSelectOnly':![],'isDangerous':!![],'reason':_0x41f993(0xe3)};return{'type':_0x41f993(0xaa),'isSelectOnly':![],'isDangerous':![]};}function isLockingClauseKeyword(_0x339ad9,_0x5b9b6c){const _0x310682=a316_0x133145,_0xa17115=_0x339ad9[_0x5b9b6c]===_0x310682(0xf8)?[[_0x310682(0xb6)],[_0x310682(0xb6),'NO',_0x310682(0xe0)]]:[[_0x310682(0xb6)],[_0x310682(0xb6),'KEY']],_0x54ba86=_0xa17115[_0x310682(0xd0)](_0x409441=>{const _0x41a396=_0x310682,_0x49cfa1=_0x5b9b6c-_0x409441[_0x41a396(0xb7)];return _0x49cfa1>=0x0&&_0x339ad9['slice'](_0x49cfa1,_0x5b9b6c)[_0x41a396(0xea)]('\x20')===_0x409441['join']('\x20');});if(!_0x54ba86)return![];return!_0x339ad9[_0x310682(0xe5)](_0x5b9b6c+0x1,_0x5b9b6c+0x5)[_0x310682(0xb5)](_0x310682(0xdc));}function findMainStatementIndex(_0x5aafc7){const _0x3ec0e2=a316_0x133145;if(_0x5aafc7[0x0]!==_0x3ec0e2(0xe9))return 0x0;let _0x455796=_0x5aafc7[0x1]==='RECURSIVE'?0x2:0x1;while(_0x455796<_0x5aafc7[_0x3ec0e2(0xb7)]){const _0x3f23ca=_0x5aafc7[_0x455796];if(!_0x3f23ca||!(/^[A-Z_][\w$]*$/['test'](_0x3f23ca)||/^[`"]/[_0x3ec0e2(0x10b)](_0x3f23ca)))return-0x1;_0x455796+=0x1;if(_0x5aafc7[_0x455796]==='('){_0x455796=skipSqlParentheses(_0x5aafc7,_0x455796);if(_0x455796<0x0)return-0x1;}if(_0x5aafc7[_0x455796]!=='AS')return-0x1;_0x455796+=0x1;if(_0x5aafc7[_0x455796]===_0x3ec0e2(0xb4)&&_0x5aafc7[_0x455796+0x1]===_0x3ec0e2(0xaf))_0x455796+=0x2;else{if(_0x5aafc7[_0x455796]===_0x3ec0e2(0xaf))_0x455796+=0x1;}_0x455796=skipSqlParentheses(_0x5aafc7,_0x455796);if(_0x455796<0x0)return-0x1;if(_0x5aafc7[_0x455796]!==','){const _0x8e057=_0x5aafc7[_0x455796]==='('?_0x455796+0x1:_0x455796;return/^(SELECT|INSERT|UPDATE|DELETE)$/['test'](_0x5aafc7[_0x8e057]??'')?_0x8e057:-0x1;}_0x455796+=0x1;}return-0x1;}function skipSqlParentheses(_0x992c31,_0x2068e4){const _0x35b63b=a316_0x133145;if(_0x992c31[_0x2068e4]!=='(')return-0x1;let _0x812c7a=0x0;for(let _0x3a9fa6=_0x2068e4;_0x3a9fa6<_0x992c31[_0x35b63b(0xb7)];_0x3a9fa6+=0x1){const _0x1e7237=_0x992c31[_0x3a9fa6];if(_0x1e7237===';')return-0x1;if(_0x1e7237==='(')_0x812c7a+=0x1;if(_0x1e7237===')'&&--_0x812c7a===0x0)return _0x3a9fa6+0x1;}return-0x1;}function stripStaticAnalysisMarkers(_0x39307a){const _0x3805c7=a316_0x133145;return _0x39307a[_0x3805c7(0xf3)](MYBATIS_DYNAMIC_START_MARKER,'\x20')['replaceAll'](MYBATIS_DYNAMIC_END_MARKER,'\x20')['replaceAll'](MYBATIS_INCLUDE_MARKER,'\x20'+UNRESOLVED_SQL_FRAGMENT+'\x20');}function tokenizeSqlForTypeAnalysis(_0x2070ee){const _0x1f0a91=a316_0x133145,_0x2926ca=[],_0x14a2ce=/\/\*[\s\S]*?\*\/|--[^\r\n]*|[#$]\{[^}]*\}|#[^\r\n]*|'(?:''|\\[\s\S]|[^'\\])*'|"(?:""|\\[\s\S]|[^"\\])*"|`(?:``|\\[\s\S]|[^`\\])*`|@[A-Za-z_]\w*|[A-Za-z_]\w*|\S/g;for(const _0x230543 of _0x2070ee[_0x1f0a91(0xc3)](_0x14a2ce)){const _0x6f0156=_0x230543[0x0];if(_0x6f0156[_0x1f0a91(0xef)]('/*')||_0x6f0156[_0x1f0a91(0xef)]('--')||_0x6f0156[_0x1f0a91(0xef)]('#')&&!_0x6f0156[_0x1f0a91(0xef)]('#{'))continue;_0x2926ca[_0x1f0a91(0xfd)](/^["`]/[_0x1f0a91(0x10b)](_0x6f0156)?_0x6f0156:/^[\x27@#$]/['test'](_0x6f0156)?'?':_0x6f0156[_0x1f0a91(0xa0)]());}return _0x2926ca;}function extractTables(_0x5c2acf,_0x31cf70){const _0x9a8ea9=a316_0x133145,_0x16b78f=_0x5c2acf[_0x9a8ea9(0xcf)](/#\{[^}]*\}/g,'?')[_0x9a8ea9(0xcf)](/\$\{[^}]*\}/g,'?')['replace'](/'[^']*'/g,'\x27\x27')[_0x9a8ea9(0xcf)](/--.*$/gm,'')[_0x9a8ea9(0xcf)](/\/\*[\s\S]*?\*\//g,''),_0x34e40b=[],_0x50aa02=_0x16b78f[_0x9a8ea9(0x10e)](/FROM\s+([^\s,)(]+)/i);addTable(_0x34e40b,_0x50aa02?.[0x1]);for(const _0x2fbe2d of _0x16b78f['matchAll'](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi)){addTable(_0x34e40b,_0x2fbe2d[0x1]);}const _0x189304=_0x16b78f[_0x9a8ea9(0x10e)](/INTO\s+([^\s(]+)/i);addTable(_0x34e40b,_0x189304?.[0x1]);if(_0x31cf70===_0x9a8ea9(0xf8)){const _0x4c9d4d=_0x16b78f[_0x9a8ea9(0x10e)](/UPDATE\s+([^\s,)(]+)/i);addTable(_0x34e40b,_0x4c9d4d?.[0x1]);}return _0x34e40b;}function addTable(_0x3b5238,_0x47fd9){const _0x59536e=a316_0x133145,_0x1cf0d5=_0x47fd9?.[_0x59536e(0xcf)](/[`"]/g,'');_0x1cf0d5&&_0x1cf0d5!==UNRESOLVED_SQL_FRAGMENT&&!_0x3b5238['includes'](_0x1cf0d5)&&_0x3b5238['push'](_0x1cf0d5);}function extractParameters(_0x35a47f){const _0x20a3c8=a316_0x133145,_0x5272a7=new Set();for(const _0x3b75e1 of _0x35a47f[_0x20a3c8(0xc3)](/[#$]\{\s*([A-Za-z_][\w.]*)\s*(?=[,}])/g)){if(_0x3b75e1[0x1])_0x5272a7[_0x20a3c8(0xbe)](_0x3b75e1[0x1]);}return Array[_0x20a3c8(0xc0)](_0x5272a7);}export function validateSql(_0x300afd){const _0x3c7304=a316_0x133145,_0x2f62f1=normalizeSqlForStaticAnalysis(_0x300afd),_0x2caa21=detectNormalizedSqlType(_0x2f62f1),_0x1ade12=stripStaticAnalysisMarkers(_0x2f62f1[_0x3c7304(0xd4)]),_0x9d1cc3=_0x2f62f1[_0x3c7304(0xd2)]?[]:extractTables(_0x1ade12,_0x2caa21['type']),_0x5f66d6=_0x2f62f1[_0x3c7304(0xd2)]?[]:extractParameters(_0x1ade12);if(_0x2caa21[_0x3c7304(0xd3)])return{'valid':![],'sqlType':_0x2caa21,'tables':_0x9d1cc3,'parameters':_0x5f66d6,'message':_0x2caa21[_0x3c7304(0xdd)]||_0x2caa21['type']+_0x3c7304(0xba)};if(_0x2caa21[_0x3c7304(0xae)]===_0x3c7304(0xaa))return{'valid':![],'sqlType':_0x2caa21,'tables':_0x9d1cc3,'parameters':_0x5f66d6,'message':_0x2f62f1[_0x3c7304(0xd2)]?_0x3c7304(0x105)+_0x2f62f1[_0x3c7304(0xd2)]:_0x2caa21['reason']?_0x3c7304(0x105)+_0x2caa21['reason']:_0x3c7304(0x107)};return{'valid':!![],'sqlType':_0x2caa21,'tables':_0x9d1cc3,'parameters':_0x5f66d6,'message':_0x2caa21[_0x3c7304(0xae)]+_0x3c7304(0xbc)+(_0x9d1cc3[_0x3c7304(0xb7)]?_0x9d1cc3[_0x3c7304(0xea)](',\x20'):_0x3c7304(0xcc))+(_0x5f66d6[_0x3c7304(0xb7)]?_0x3c7304(0xc6)+_0x5f66d6[_0x3c7304(0xea)](',\x20'):'')};}
1
+ const MYBATIS_OUTER_TAGS=new Map([["select","SELECT"],["insert","INSERT"],["update","UPDATE"],["delete","DELETE"]]);const MYBATIS_DYNAMIC_TAGS=new Set(["if","where","foreach","choose","when","otherwise","trim","set","bind","include","property"]);const MYBATIS_BRANCH_TAGS=new Set(["if","foreach","choose","when","otherwise"]);export const MYBATIS_DYNAMIC_START_MARKER="__RABETBASE_MYBATIS_DYNAMIC_START__";export const MYBATIS_DYNAMIC_END_MARKER="__RABETBASE_MYBATIS_DYNAMIC_END__";export const MYBATIS_INCLUDE_MARKER="__RABETBASE_MYBATIS_INCLUDE_UNRESOLVED__";const UNRESOLVED_SQL_FRAGMENT="__RABETBASE_UNRESOLVED_SQL_FRAGMENT__";const MYBATIS_OUTER_TAG_PATTERN=new RegExp(`^<\\s*(?:${[...MYBATIS_OUTER_TAGS.keys()].join("|")})\\b`,"i");export function normalizeSqlForStaticAnalysis(sqlContent){const raw=typeof sqlContent==="string"?sqlContent:"";if(detectSqlSourceMode(raw)==="sql"){return{sql:raw,mode:"sql"}}let index=0;let normalized="";let statementType;let rootSeen=false;let rootClosed=false
2
+ ;const openTags=[];while(index<raw.length){if(raw.startsWith("\x3c!--",index)){const commentEnd=raw.indexOf("--\x3e",index+4);if(commentEnd<0){return invalidMybatisSource("Unterminated XML comment.")}normalized+=" ";index=commentEnd+3;continue}if(raw.startsWith("<![CDATA[",index)){if(!rootSeen||rootClosed){return invalidMybatisSource("CDATA sections must be inside the MyBatis statement wrapper.")}const cdataEnd=raw.indexOf("]]>",index+9);if(cdataEnd<0){return invalidMybatisSource("Unterminated CDATA section.")}normalized+=raw.slice(index+9,cdataEnd);index=cdataEnd+3;continue}if(raw.startsWith("<?",index)){if(rootSeen){return invalidMybatisSource("XML declarations must precede the MyBatis statement wrapper.")}const declarationEnd=raw.indexOf("?>",index+2);if(declarationEnd<0){return invalidMybatisSource("Unterminated XML declaration.")}normalized+=" ";index=declarationEnd+2;continue}if(raw[index]!=="<"){const nextTag=raw.indexOf("<",index);const textEnd=nextTag<0?raw.length:nextTag
3
+ ;const text=raw.slice(index,textEnd);if((!rootSeen||rootClosed)&&text.trim()){return invalidMybatisSource("SQL text must be inside the MyBatis statement wrapper.")}if(rootSeen&&!rootClosed){const decodedText=decodeXmlEntities(text);if(decodedText===null){return invalidMybatisSource("Invalid XML entity reference.")}normalized+=decodedText}else{normalized+=" "}index=textEnd;continue}const tagEnd=findXmlTagEnd(raw,index);if(tagEnd<0){return invalidMybatisSource("Unterminated MyBatis XML tag.")}const tagText=raw.slice(index,tagEnd+1);const tagMatch=/^<\s*(\/?)\s*([A-Za-z][\w:-]*)([\s\S]*?)(\/?)\s*>$/.exec(tagText);if(!tagMatch){return invalidMybatisSource("Invalid MyBatis XML tag.")}const closing=tagMatch[1]==="/";const rawTagName=tagMatch[2]??"";const tagName=rawTagName.toLowerCase();const rawAttributes=tagMatch[3]??"";const selfClosing=tagMatch[4]==="/";const outerStatementType=MYBATIS_OUTER_TAGS.get(tagName);if(!outerStatementType&&!MYBATIS_DYNAMIC_TAGS.has(tagName)){
4
+ return invalidMybatisSource(`Unsupported MyBatis XML tag: <${tagName}>.`)}if(!outerStatementType&&rawTagName!==tagName){return invalidMybatisSource(`MyBatis dynamic tag names must be lowercase: <${rawTagName}>.`)}if(closing){if(rawAttributes.trim()||selfClosing){return invalidMybatisSource(`Invalid MyBatis XML closing tag: </${rawTagName}>.`)}const currentTag=openTags.at(-1);if(!currentTag||(currentTag.outer?currentTag.tagName!==tagName:currentTag.rawName!==rawTagName)){return invalidMybatisSource(`Mismatched MyBatis XML closing tag: </${rawTagName}>.`)}openTags.pop();if(currentTag.outer)rootClosed=true;normalized+=MYBATIS_BRANCH_TAGS.has(tagName)?` ${MYBATIS_DYNAMIC_END_MARKER} `:" "}else{if(!hasWellFormedXmlAttributes(rawAttributes)){return invalidMybatisSource(`Invalid attributes on MyBatis XML tag: <${rawTagName}>.`)}if(tagName==="property"&&(!selfClosing||openTags.at(-1)?.tagName!=="include")){
5
+ return invalidMybatisSource("MyBatis <property> must be a self-closing direct child of <include>.")}if(outerStatementType){if(rootSeen||openTags.length>0){return invalidMybatisSource("Multiple MyBatis statement wrappers are not supported.")}rootSeen=true;rootClosed=selfClosing;statementType=outerStatementType}else if(!rootSeen||rootClosed){return invalidMybatisSource(`MyBatis dynamic tag must be inside the statement wrapper: <${rawTagName}>.`)}normalized+=tagName==="where"?" WHERE ":tagName==="set"?" SET ":tagName==="include"?` ${MYBATIS_INCLUDE_MARKER} `:MYBATIS_BRANCH_TAGS.has(tagName)&&!selfClosing?` ${MYBATIS_DYNAMIC_START_MARKER} `:" ";if(!selfClosing){openTags.push({rawName:rawTagName,tagName:tagName,outer:!!outerStatementType})}}index=tagEnd+1}if(openTags.length>0){return invalidMybatisSource(`Unclosed MyBatis XML tag: <${openTags.at(-1)?.rawName}>.`)}if(!rootSeen||!rootClosed){return invalidMybatisSource("MyBatis XML must contain exactly one complete statement wrapper.")}
6
+ return{sql:normalized.trim(),mode:"mybatisXml",...statementType?{statementType:statementType}:{}}}function hasWellFormedXmlAttributes(content){let index=0;const names=new Set;while(index<content.length){while(index<content.length&&/\s/.test(content[index]??""))index+=1;if(index>=content.length)return true;const nameMatch=/^[A-Za-z_:][\w:.-]*/.exec(content.slice(index));const name=nameMatch?.[0];if(!name||names.has(name))return false;names.add(name);index+=name.length;while(index<content.length&&/\s/.test(content[index]??""))index+=1;if(content[index]!=="=")return false;index+=1;while(index<content.length&&/\s/.test(content[index]??""))index+=1;const quote=content[index];if(quote!=='"'&&quote!=="'")return false;index+=1;const valueEnd=content.indexOf(quote,index);if(valueEnd<0)return false;if(decodeXmlEntities(content.slice(index,valueEnd))===null)return false;index=valueEnd+1}return true}export function detectSqlSourceMode(content){let index=0;const skipWhitespace=()=>{
7
+ while(index<content.length&&/\s/.test(content[index]??""))index+=1};skipWhitespace();while(index<content.length){if(content.startsWith("\x3c!--",index)){const commentEnd=content.indexOf("--\x3e",index+4);if(commentEnd<0)return"mybatisXml";index=commentEnd+3;skipWhitespace();continue}if(content.startsWith("<?",index)){const declarationEnd=content.indexOf("?>",index+2);if(declarationEnd<0)return"mybatisXml";index=declarationEnd+2;skipWhitespace();continue}break}return MYBATIS_OUTER_TAG_PATTERN.test(content.slice(index))?"mybatisXml":"sql"}function invalidMybatisSource(error){return{sql:"",mode:"mybatisXml",error:error}}function findXmlTagEnd(content,start){let quote;for(let index=start+1;index<content.length;index+=1){const character=content[index];if(quote){if(character===quote)quote=undefined;continue}if(character==='"'||character==="'"){quote=character;continue}if(character===">")return index}return-1}function decodeXmlEntities(content){let invalidEntity=false
8
+ ;const decoded=content.replace(/&(?:#x[0-9a-f]+;|#[0-9]+;|[A-Za-z_:][\w:.-]*;)?/g,reference=>{if(reference==="&lt;")return"<";if(reference==="&gt;")return">";if(reference==="&quot;")return'"';if(reference==="&apos;")return"'";if(reference==="&amp;")return"&";const numericReference=/^&#(?:x([0-9a-f]+)|([0-9]+));$/.exec(reference);if(numericReference){const hex=numericReference[1];const decimal=numericReference[2];const codePoint=Number.parseInt(hex??decimal??"",hex?16:10);if(isValidXmlCharacter(codePoint))return String.fromCodePoint(codePoint)}invalidEntity=true;return""});return invalidEntity?null:decoded}function isValidXmlCharacter(codePoint){return codePoint===9||codePoint===10||codePoint===13||codePoint>=32&&codePoint<=55295||codePoint>=57344&&codePoint<=65533||codePoint>=65536&&codePoint<=1114111}export function detectSqlType(sqlContent){return detectNormalizedSqlType(normalizeSqlForStaticAnalysis(sqlContent))}function detectNormalizedSqlType(source){if(source.error){return{
9
+ type:"UNKNOWN",isSelectOnly:false,isDangerous:false,reason:source.error}}if(!source.sql.trim()){return{type:"UNKNOWN",isSelectOnly:false,isDangerous:false,reason:"SQL content is empty"}}const tokens=tokenizeSqlForTypeAnalysis(source.sql);const structuralTokens=tokens.filter(token=>token!==MYBATIS_DYNAMIC_START_MARKER&&token!==MYBATIS_DYNAMIC_END_MARKER);const statementIndex=findMainStatementIndex(structuralTokens);if(statementIndex<0){return{type:"UNKNOWN",isSelectOnly:false,isDangerous:false,reason:"Local analysis could not parse the WITH prefix; this is a local capability limit, not a platform rejection."}}const upper=structuralTokens[statementIndex]??"";const statementType=source.statementType??upper;const hasBlockedStatement=tokens.some(token=>/^(DELETE|DROP|ALTER|CREATE|TRUNCATE)$/.test(token));const lockKeywords=new Set;let isLockingRead=false;for(let index=0;index<tokens.length;index+=1){const token=tokens[index]
10
+ ;if((token==="UPDATE"||token==="SHARE")&&isLockingClauseKeyword(tokens,index)){lockKeywords.add(index);isLockingRead=true}if(tokens.slice(index,index+4).join(" ")==="LOCK IN SHARE MODE")isLockingRead=true}if(statementType==="SELECT"){const hasModify=tokens.some((token,index)=>/^(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE)$/.test(token)&&!lockKeywords.has(index));return{type:"SELECT",isSelectOnly:!hasModify&&!isLockingRead,isLockingRead:isLockingRead,isDangerous:hasModify,reason:hasModify?"SQL contains modification statements alongside SELECT":undefined}}if(statementType==="INSERT"){return{type:"INSERT",isSelectOnly:false,isDangerous:hasBlockedStatement,reason:hasBlockedStatement?"SQL contains blocked DELETE or DDL statements":undefined}}if(statementType==="UPDATE"){return{type:"UPDATE",isSelectOnly:false,isDangerous:hasBlockedStatement,reason:hasBlockedStatement?"SQL contains blocked DELETE or DDL statements":undefined}}if(statementType==="DELETE"){return{type:"DELETE",
11
+ isSelectOnly:false,isDangerous:true,reason:"DELETE statements require explicit review"}}if(/^(CREATE|ALTER|DROP|TRUNCATE)/i.test(upper)){return{type:"DDL",isSelectOnly:false,isDangerous:true,reason:"DDL statements require explicit review"}}return{type:"UNKNOWN",isSelectOnly:false,isDangerous:false}}function isLockingClauseKeyword(tokens,index){const variants=tokens[index]==="UPDATE"?[["FOR"],["FOR","NO","KEY"]]:[["FOR"],["FOR","KEY"]];const anchored=variants.some(variant=>{const start=index-variant.length;return start>=0&&tokens.slice(start,index).join(" ")===variant.join(" ")});if(!anchored)return false;return!tokens.slice(index+1,index+5).includes("SET")}function findMainStatementIndex(tokens){if(tokens[0]!=="WITH")return 0;let index=tokens[1]==="RECURSIVE"?2:1;while(index<tokens.length){const name=tokens[index];if(!name||!(/^[A-Z_][\w$]*$/.test(name)||/^[`"]/.test(name)))return-1;index+=1;if(tokens[index]==="("){index=skipSqlParentheses(tokens,index);if(index<0)return-1}
12
+ if(tokens[index]!=="AS")return-1;index+=1;if(tokens[index]==="NOT"&&tokens[index+1]==="MATERIALIZED")index+=2;else if(tokens[index]==="MATERIALIZED")index+=1;index=skipSqlParentheses(tokens,index);if(index<0)return-1;if(tokens[index]!==","){const mainIndex=tokens[index]==="("?index+1:index;return/^(SELECT|INSERT|UPDATE|DELETE)$/.test(tokens[mainIndex]??"")?mainIndex:-1}index+=1}return-1}function skipSqlParentheses(tokens,start){if(tokens[start]!=="(")return-1;let depth=0;for(let index=start;index<tokens.length;index+=1){const token=tokens[index];if(token===";")return-1;if(token==="(")depth+=1;if(token===")"&&--depth===0)return index+1}return-1}function stripStaticAnalysisMarkers(sql){return sql.replaceAll(MYBATIS_DYNAMIC_START_MARKER," ").replaceAll(MYBATIS_DYNAMIC_END_MARKER," ").replaceAll(MYBATIS_INCLUDE_MARKER,` ${UNRESOLVED_SQL_FRAGMENT} `)}function tokenizeSqlForTypeAnalysis(sql){const tokens=[]
13
+ ;const lexemes=/\/\*[\s\S]*?\*\/|--[^\r\n]*|[#$]\{[^}]*\}|#[^\r\n]*|'(?:''|\\[\s\S]|[^'\\])*'|"(?:""|\\[\s\S]|[^"\\])*"|`(?:``|\\[\s\S]|[^`\\])*`|@[A-Za-z_]\w*|[A-Za-z_]\w*|\S/g;for(const match of sql.matchAll(lexemes)){const token=match[0];if(token.startsWith("/*")||token.startsWith("--")||token.startsWith("#")&&!token.startsWith("#{"))continue;tokens.push(/^["`]/.test(token)?token:/^[\x27@#$]/.test(token)?"?":token.toUpperCase())}return tokens}function extractTables(sql,type){const cleaned=sql.replace(/#\{[^}]*\}/g,"?").replace(/\$\{[^}]*\}/g,"?").replace(/'[^']*'/g,"''").replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"");const tables=[];const fromMatch=cleaned.match(/FROM\s+([^\s,)(]+)/i);addTable(tables,fromMatch?.[1]);for(const m of cleaned.matchAll(/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi)){addTable(tables,m[1])}const intoMatch=cleaned.match(/INTO\s+([^\s(]+)/i);addTable(tables,intoMatch?.[1]);if(type==="UPDATE"){
14
+ const updateMatch=cleaned.match(/UPDATE\s+([^\s,)(]+)/i);addTable(tables,updateMatch?.[1])}return tables}function addTable(tables,rawTable){const table=rawTable?.replace(/[`"]/g,"");if(table&&table!==UNRESOLVED_SQL_FRAGMENT&&!tables.includes(table)){tables.push(table)}}function extractParameters(sql){const params=new Set;for(const match of sql.matchAll(/[#$]\{\s*([A-Za-z_][\w.]*)\s*(?=[,}])/g)){if(match[1])params.add(match[1])}return Array.from(params)}export function validateSql(sqlContent){const source=normalizeSqlForStaticAnalysis(sqlContent);const sqlType=detectNormalizedSqlType(source);const analysisSql=stripStaticAnalysisMarkers(source.sql);const tables=source.error?[]:extractTables(analysisSql,sqlType.type);const parameters=source.error?[]:extractParameters(analysisSql);if(sqlType.isDangerous){return{valid:false,sqlType:sqlType,tables:tables,parameters:parameters,
15
+ message:sqlType.reason||`${sqlType.type} statements require explicit review. Local analysis does not authorize saving or execution.`}}if(sqlType.type==="UNKNOWN"){return{valid:false,sqlType:sqlType,tables:tables,parameters:parameters,message:source.error?`Unable to detect SQL type. ${source.error}`:sqlType.reason?`Unable to detect SQL type. ${sqlType.reason}`:"Unable to detect SQL type. Please check the SQL content."}}return{valid:true,sqlType:sqlType,tables:tables,parameters:parameters,message:`${sqlType.type} query targeting ${tables.length?tables.join(", "):"unknown table(s)"}${parameters.length?` with parameters: ${parameters.join(", ")}`:""}`}}
package/lib/errors.js CHANGED
@@ -1 +1,3 @@
1
- const a317_0x1e8b88=a317_0x5756;(function(_0x3749cc,_0xd05af){const _0x34df61=a317_0x5756,_0x4ce3a0=_0x3749cc();while(!![]){try{const _0x4d067e=parseInt(_0x34df61(0xfb))/0x1*(-parseInt(_0x34df61(0x111))/0x2)+-parseInt(_0x34df61(0x108))/0x3*(parseInt(_0x34df61(0x119))/0x4)+-parseInt(_0x34df61(0x112))/0x5*(parseInt(_0x34df61(0x102))/0x6)+-parseInt(_0x34df61(0x10b))/0x7+parseInt(_0x34df61(0x105))/0x8*(-parseInt(_0x34df61(0x101))/0x9)+-parseInt(_0x34df61(0x10f))/0xa+parseInt(_0x34df61(0x113))/0xb*(parseInt(_0x34df61(0x107))/0xc);if(_0x4d067e===_0xd05af)break;else _0x4ce3a0['push'](_0x4ce3a0['shift']());}catch(_0x3e5a6d){_0x4ce3a0['push'](_0x4ce3a0['shift']());}}}(a317_0x241e,0x35fb6));function a317_0x5756(_0x2d88b5,_0x4e88e5){_0x2d88b5=_0x2d88b5-0xfb;const _0x241edd=a317_0x241e();let _0x5756a3=_0x241edd[_0x2d88b5];return _0x5756a3;}function a317_0x241e(){const _0x3b3290=['flag_missing','Operation\x20cancelled.','1452255ibknBG','Network\x20error:\x20','Missing\x20required\x20flag:\x20--','Check\x20your\x20internet\x20connection\x20and\x20try\x20again.','822060IiQUcV','\x20project\x20directory','2BqOrHl','2320LEPfqe','4787156tvybIN','Set\x20appcode\x20via\x20`','\x20auth`\x20to\x20login\x20first.','Configuration\x20file\x20not\x20found','Not\x20in\x20a\x20','cancelled','8156OnfsxT','\x20workspace\x20add\x20<name>\x20--appcode\x20<code>\x20--global`\x20registers\x20a\x20reusable\x20global\x20app\x20profile.','314428AGHfKi','\x20--help`\x20to\x20see\x20available\x20commands.','network_error','config_missing','unknown_command','Run\x20`','1648296KHmwuZ','2868PeMMGM','Run\x20this\x20command\x20inside\x20a\x20project\x20with\x20.rabetbase.json\x20file.','not_in_project','8jkxpQH','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20pass\x20--appcode.\x0a\x20\x20\x20\x20\x20\x20\x20Tip:\x20`','36ahBXcw','111fsJPJj'];a317_0x241e=function(){return _0x3b3290;};return a317_0x241e();}import{CliError,createCliErrors}from'@lovrabet/cli-framework';import{CLI_BIN_NAME}from'./constant/cli.js';export{CliError};const baseCliErrors=createCliErrors({'cliBinName':CLI_BIN_NAME,'authRequiredHint':a317_0x1e8b88(0x100)+CLI_BIN_NAME+a317_0x1e8b88(0x115),'configMissingHint':a317_0x1e8b88(0x114)+CLI_BIN_NAME+a317_0x1e8b88(0x106)+CLI_BIN_NAME+'\x20workspace\x20add\x20<name>\x20--appcode\x20<code>\x20--global`\x20registers\x20a\x20reusable\x20global\x20app\x20profile.','notInProjectHint':a317_0x1e8b88(0x103)});export const CliErrors={'authRequired'(_0x3e5bb0){const _0x300b22=a317_0x1e8b88;return new CliError('auth_required',0x1,'Authentication\x20required',_0x3e5bb0??_0x300b22(0x100)+CLI_BIN_NAME+_0x300b22(0x115));},'configMissing'(_0x23f356){const _0x3c8e75=a317_0x1e8b88;return new CliError(_0x3c8e75(0xfe),0x1,_0x3c8e75(0x116),_0x23f356??_0x3c8e75(0x114)+CLI_BIN_NAME+_0x3c8e75(0x106)+CLI_BIN_NAME+_0x3c8e75(0x11a));},'notInProject'(){const _0x328afd=a317_0x1e8b88;return new CliError(_0x328afd(0x104),0x1,_0x328afd(0x117)+CLI_BIN_NAME+_0x328afd(0x110),_0x328afd(0x103));},'apiError'(_0x1acfe5,_0xb65115){return baseCliErrors['apiError'](_0x1acfe5,_0xb65115);},'networkError'(_0x34afeb){const _0x5097bf=a317_0x1e8b88;return new CliError(_0x5097bf(0xfd),0x2,_0x5097bf(0x10c)+_0x34afeb,_0x5097bf(0x10e));},'unknownCommand'(_0x3e0573){const _0x36e537=a317_0x1e8b88;return new CliError(_0x36e537(0xff),0x1,'Unknown\x20command:\x20'+_0x3e0573,_0x36e537(0x100)+CLI_BIN_NAME+_0x36e537(0xfc));},'flagMissing'(_0x2093a2,_0x4f6317){const _0xedcd1a=a317_0x1e8b88;return new CliError(_0xedcd1a(0x109),0x1,_0xedcd1a(0x10d)+_0x2093a2,_0x4f6317);},'validation'(_0x3490e5,_0x2e5941){return baseCliErrors['validation'](_0x3490e5,_0x2e5941);},'cancelled'(_0x24ab45){const _0x34f6a9=a317_0x1e8b88;return new CliError(_0x34f6a9(0x118),0x0,_0x24ab45??_0x34f6a9(0x10a));}};
1
+ import{CliError,createCliErrors}from"@lovrabet/cli-framework";import{CLI_BIN_NAME}from"./constant/cli.js";export{CliError};const baseCliErrors=createCliErrors({cliBinName:CLI_BIN_NAME,authRequiredHint:`Run \`${CLI_BIN_NAME} auth\` to login first.`,configMissingHint:`Set appcode via \`${CLI_BIN_NAME} workspace init --appcode <code>\` or pass --appcode.\n Tip: \`${CLI_BIN_NAME} workspace add <name> --appcode <code> --global\` registers a reusable global app profile.`,notInProjectHint:"Run this command inside a project with .rabetbase.json file."});export const CliErrors={authRequired(hint){return new CliError("auth_required",1,"Authentication required",hint??`Run \`${CLI_BIN_NAME} auth\` to login first.`)},configMissing(hint){
2
+ return new CliError("config_missing",1,"Configuration file not found",hint??`Set appcode via \`${CLI_BIN_NAME} workspace init --appcode <code>\` or pass --appcode.\n Tip: \`${CLI_BIN_NAME} workspace add <name> --appcode <code> --global\` registers a reusable global app profile.`)},notInProject(){return new CliError("not_in_project",1,`Not in a ${CLI_BIN_NAME} project directory`,"Run this command inside a project with .rabetbase.json file.")},apiError(message,hint){return baseCliErrors.apiError(message,hint)},networkError(message){return new CliError("network_error",2,`Network error: ${message}`,"Check your internet connection and try again.")},unknownCommand(cmd){return new CliError("unknown_command",1,`Unknown command: ${cmd}`,`Run \`${CLI_BIN_NAME} --help\` to see available commands.`)},flagMissing(flagName,hint){return new CliError("flag_missing",1,`Missing required flag: --${flagName}`,hint)},validation(message,hint){return baseCliErrors.validation(message,hint)},
3
+ cancelled(message){return new CliError("cancelled",0,message??"Operation cancelled.")}};
@@ -1 +1 @@
1
- function a318_0x5e97(){const _0x50fd0b=['13118OqkXQv','16495050hLuxMF','187840EOVNGp','name','13184JAvBwP','9PJQrGq','3948714qhoBlZ','map','yes','810236vzbRUR','84NoevVp','219BtfuZE','609DiIUmB','1741970OsLXTL'];a318_0x5e97=function(){return _0x50fd0b;};return a318_0x5e97();}function a318_0x31c8(_0x170fac,_0x5b0161){_0x170fac=_0x170fac-0x1c7;const _0x5e9782=a318_0x5e97();let _0x31c8f5=_0x5e9782[_0x170fac];return _0x31c8f5;}(function(_0x87245c,_0x132218){const _0x269992=a318_0x31c8,_0x1b6cd4=_0x87245c();while(!![]){try{const _0xdcc7fa=parseInt(_0x269992(0x1cc))/0x1+-parseInt(_0x269992(0x1d1))/0x2*(parseInt(_0x269992(0x1ce))/0x3)+parseInt(_0x269992(0x1cd))/0x4*(-parseInt(_0x269992(0x1d3))/0x5)+-parseInt(_0x269992(0x1c9))/0x6+parseInt(_0x269992(0x1cf))/0x7*(-parseInt(_0x269992(0x1c7))/0x8)+-parseInt(_0x269992(0x1c8))/0x9*(-parseInt(_0x269992(0x1d0))/0xa)+parseInt(_0x269992(0x1d2))/0xb;if(_0xdcc7fa===_0x132218)break;else _0x1b6cd4['push'](_0x1b6cd4['shift']());}catch(_0x4248d9){_0x1b6cd4['push'](_0x1b6cd4['shift']());}}}(a318_0x5e97,0x65421));import{DEFAULT_COMMAND_OUTPUT_FORMAT}from'../constant/defaults.js';import{buildAllFlags as a318_0x39f882}from'@lovrabet/cli-framework';import{EXPLICIT_YES_FLAG_DESCRIPTION,requiresExplicitYes}from'../framework/explicit-yes.js';export function buildAllFlags(_0x420e56){const _0x268e67=a318_0x31c8,_0x4693c4=a318_0x39f882(_0x420e56,{'defaultOutputFormat':DEFAULT_COMMAND_OUTPUT_FORMAT});if(!requiresExplicitYes(_0x420e56))return _0x4693c4;return _0x4693c4[_0x268e67(0x1ca)](_0x3bc544=>_0x3bc544[_0x268e67(0x1d4)]===_0x268e67(0x1cb)?{..._0x3bc544,'description':EXPLICIT_YES_FLAG_DESCRIPTION}:_0x3bc544);}
1
+ import{DEFAULT_COMMAND_OUTPUT_FORMAT}from"../constant/defaults.js";import{buildAllFlags as buildAllFlagsBase}from"@lovrabet/cli-framework";import{EXPLICIT_YES_FLAG_DESCRIPTION,requiresExplicitYes}from"../framework/explicit-yes.js";export function buildAllFlags(def){const flags=buildAllFlagsBase(def,{defaultOutputFormat:DEFAULT_COMMAND_OUTPUT_FORMAT});if(!requiresExplicitYes(def))return flags;return flags.map(flag=>flag.name==="yes"?{...flag,description:EXPLICIT_YES_FLAG_DESCRIPTION}:flag)}
@@ -1 +1 @@
1
- function a319_0x3bf6(){var _0x3e654f=['compress','24KjBioK','261243zfaQMe','36juAozR','format','1756174SWgsMI','201723IJrvbO','199334cdJXaM','structuredErrors','394300JuNcTD','1610076JWpAHd','77176gzaYrb','defaultFormat','flags'];a319_0x3bf6=function(){return _0x3e654f;};return a319_0x3bf6();}(function(_0x2e3e2c,_0x25c2b1){var _0x1b1fe1=a319_0x4192,_0x89fcbb=_0x2e3e2c();while(!![]){try{var _0x36b906=-parseInt(_0x1b1fe1(0x8e))/0x1+-parseInt(_0x1b1fe1(0x8f))/0x2+parseInt(_0x1b1fe1(0x98))/0x3+parseInt(_0x1b1fe1(0x92))/0x4+-parseInt(_0x1b1fe1(0x91))/0x5*(-parseInt(_0x1b1fe1(0x97))/0x6)+-parseInt(_0x1b1fe1(0x8d))/0x7+parseInt(_0x1b1fe1(0x93))/0x8*(-parseInt(_0x1b1fe1(0x99))/0x9);if(_0x36b906===_0x25c2b1)break;else _0x89fcbb['push'](_0x89fcbb['shift']());}catch(_0x5e78f8){_0x89fcbb['push'](_0x89fcbb['shift']());}}}(a319_0x3bf6,0x344a4));import{resolveOutputConfig}from'@lovrabet/cli-framework';export function usesStructuredErrorOutput(_0x2f6d28){var _0x53c955=a319_0x4192;return _0x2f6d28?.[_0x53c955(0x90)]===!![];}function a319_0x4192(_0x139deb,_0x36054d){_0x139deb=_0x139deb-0x8d;var _0x3bf6e1=a319_0x3bf6();var _0x41927c=_0x3bf6e1[_0x139deb];return _0x41927c;}export function resolveErrorOutputFormat(_0x5c5409){var _0x78f53d=a319_0x4192;if(!_0x5c5409['def'])return _0x5c5409[_0x78f53d(0x94)]??_0x78f53d(0x96);return resolveOutputConfig({'flags':_0x5c5409[_0x78f53d(0x95)]??{},'def':_0x5c5409['def'],'configDefault':_0x5c5409[_0x78f53d(0x94)]})[_0x78f53d(0x9a)];}
1
+ import{resolveOutputConfig}from"@lovrabet/cli-framework";export function usesStructuredErrorOutput(def){return def?.structuredErrors===true}export function resolveErrorOutputFormat(currentCommand){if(!currentCommand.def)return currentCommand.defaultFormat??"compress";return resolveOutputConfig({flags:currentCommand.flags??{},def:currentCommand.def,configDefault:currentCommand.defaultFormat}).format}
@@ -1 +1 @@
1
- const a320_0x192221=a320_0x172a;(function(_0x16ce3e,_0x1119f1){const _0x19860a=a320_0x172a,_0x36872c=_0x16ce3e();while(!![]){try{const _0x3246e2=parseInt(_0x19860a(0xfc))/0x1+-parseInt(_0x19860a(0xf1))/0x2*(parseInt(_0x19860a(0xf9))/0x3)+-parseInt(_0x19860a(0xf6))/0x4*(parseInt(_0x19860a(0xf5))/0x5)+parseInt(_0x19860a(0xfd))/0x6+parseInt(_0x19860a(0xfe))/0x7+parseInt(_0x19860a(0xf8))/0x8*(parseInt(_0x19860a(0xf4))/0x9)+parseInt(_0x19860a(0xf2))/0xa*(-parseInt(_0x19860a(0xfb))/0xb);if(_0x3246e2===_0x1119f1)break;else _0x36872c['push'](_0x36872c['shift']());}catch(_0x20a141){_0x36872c['push'](_0x36872c['shift']());}}}(a320_0x13ff,0xc4ed1));function a320_0x172a(_0x323a26,_0x552225){_0x323a26=_0x323a26-0xf1;const _0x13ff6e=a320_0x13ff();let _0x172ac8=_0x13ff6e[_0x323a26];return _0x172ac8;}const EXPLICIT_YES_COMMANDS=new Set([a320_0x192221(0xfa),'kb\x20delete','notification\x20config-update',a320_0x192221(0xf7)]);function a320_0x13ff(){const _0x5c5daa=['service','512GVmZyI','10xeEkUZ','Required\x20for\x20execution\x20after\x20reviewing\x20the\x20--dry-run\x20plan','63JTNqtk','155uQAULV','201436LCEZjA','notification\x20config-delete','829256IiVArD','14730zYTzXv','menu\x20delete','40337qhhaBH','61766bgkUXs','8757258YWdKss','9670199AyhaMf'];a320_0x13ff=function(){return _0x5c5daa;};return a320_0x13ff();}export const EXPLICIT_YES_FLAG_DESCRIPTION=a320_0x192221(0xf3);export function requiresExplicitYes(_0xd5b767){const _0x30065b=a320_0x192221;return EXPLICIT_YES_COMMANDS['has'](_0xd5b767[_0x30065b(0xff)]+'\x20'+_0xd5b767['command']);}
1
+ const EXPLICIT_YES_COMMANDS=new Set(["menu delete","kb delete","notification config-update","notification config-delete"]);export const EXPLICIT_YES_FLAG_DESCRIPTION="Required for execution after reviewing the --dry-run plan";export function requiresExplicitYes(def){return EXPLICIT_YES_COMMANDS.has(`${def.service} ${def.command}`)}
@@ -1 +1 @@
1
- const a321_0x5a65b9=a321_0x4f80;function a321_0x4f80(_0x16866a,_0x390c4e){_0x16866a=_0x16866a-0x196;const _0x3cb4a0=a321_0x3cb4();let _0x4f8044=_0x3cb4a0[_0x16866a];return _0x4f8044;}(function(_0x150e58,_0x29846d){const _0x1dcf28=a321_0x4f80,_0x1aaeed=_0x150e58();while(!![]){try{const _0x469f64=parseInt(_0x1dcf28(0x1a1))/0x1*(-parseInt(_0x1dcf28(0x198))/0x2)+parseInt(_0x1dcf28(0x199))/0x3*(-parseInt(_0x1dcf28(0x197))/0x4)+parseInt(_0x1dcf28(0x19f))/0x5*(parseInt(_0x1dcf28(0x196))/0x6)+-parseInt(_0x1dcf28(0x19e))/0x7+parseInt(_0x1dcf28(0x19b))/0x8+-parseInt(_0x1dcf28(0x19a))/0x9+parseInt(_0x1dcf28(0x19d))/0xa;if(_0x469f64===_0x29846d)break;else _0x1aaeed['push'](_0x1aaeed['shift']());}catch(_0x17f622){_0x1aaeed['push'](_0x1aaeed['shift']());}}}(a321_0x3cb4,0xdb6f2));import{createFlagHelpers}from'@lovrabet/cli-framework';import{CliErrors}from'../errors.js';function a321_0x3cb4(){const _0x3874b0=['1IKhUGR','324gSWOES','6686584sGhtEQ','2432524mCJlJr','3RMIAAx','10089405NkTbQe','4901328QyrvnA','validateFlags','32957200DISBen','2886849qPsAWi','130720WKHnSu','parseFlags'];a321_0x3cb4=function(){return _0x3874b0;};return a321_0x3cb4();}const helpers=createFlagHelpers(CliErrors);export const parseFlags=helpers[a321_0x5a65b9(0x1a0)];export const validateFlags=helpers[a321_0x5a65b9(0x19c)];
1
+ import{createFlagHelpers}from"@lovrabet/cli-framework";import{CliErrors}from"../errors.js";const helpers=createFlagHelpers(CliErrors);export const parseFlags=helpers.parseFlags;export const validateFlags=helpers.validateFlags;
@@ -1 +1,2 @@
1
- (function(_0x40d0eb,_0x5b2332){const _0x57367a=a322_0x442f,_0xe4841f=_0x40d0eb();while(!![]){try{const _0x13ad51=-parseInt(_0x57367a(0x81))/0x1*(-parseInt(_0x57367a(0x85))/0x2)+parseInt(_0x57367a(0x84))/0x3+-parseInt(_0x57367a(0x86))/0x4+-parseInt(_0x57367a(0x78))/0x5+-parseInt(_0x57367a(0x7f))/0x6+-parseInt(_0x57367a(0x7b))/0x7*(-parseInt(_0x57367a(0x82))/0x8)+-parseInt(_0x57367a(0x80))/0x9*(parseInt(_0x57367a(0x7c))/0xa);if(_0x13ad51===_0x5b2332)break;else _0xe4841f['push'](_0xe4841f['shift']());}catch(_0x3a45f0){_0xe4841f['push'](_0xe4841f['shift']());}}}(a322_0x4fcd,0xb179a));import{createHelpGenerators}from'@lovrabet/cli-framework';import{buildAllFlags}from'../framework/build-all-flags.js';import{serviceRegistry,serviceGroups,getServiceEntry}from'../commands/registry.js';import{CLI_BIN_NAME,CLI_DISPLAY_NAME,GLOBAL_FLAGS}from'../constant/cli.js';import{requiresExplicitYes}from'../framework/explicit-yes.js';function a322_0x442f(_0xaa2c44,_0xfd84c2){_0xaa2c44=_0xaa2c44-0x78;const _0x4fcdc4=a322_0x4fcd();let _0x442f5f=_0x4fcdc4[_0xaa2c44];return _0x442f5f;}function createGenerators(){const _0x2ac252=a322_0x442f;return createHelpGenerators({'cliBinName':CLI_BIN_NAME,'cliDisplayName':CLI_DISPLAY_NAME,'globalFlags':GLOBAL_FLAGS,'serviceRegistry':serviceRegistry,'getServiceEntry':getServiceEntry,'getServiceDefinitions':_0x9e7626=>serviceGroups['get'](_0x9e7626),'buildAllFlags':buildAllFlags,'appPrerequisiteText':'Requires\x20appcode\x20(set\x20via\x20`'+CLI_BIN_NAME+_0x2ac252(0x7e),'serviceUsageSuffix':_0x2ac252(0x83)});}export function generateCommandHelp(_0x16ad17){const _0x44d7dc=a322_0x442f,_0x3facb9=createGenerators()[_0x44d7dc(0x7a)](_0x16ad17);if(!requiresExplicitYes(_0x16ad17))return _0x3facb9;return _0x3facb9['replace'](_0x44d7dc(0x7d),'Requires\x20explicit\x20--yes\x20for\x20execution;\x20use\x20--dry-run\x20to\x20preview.');}function a322_0x4fcd(){const _0x513a57=['9lzAXPK','2neQykY','6860152TqwJFt','\x20[args]\x20[flags]','3259365rkUYvh','601118iwTVWg','495440UDbgrq','733675dVqHLb','generateServiceHelp','generateCommandHelp','7pdSNHK','4018420bcSVvP','Requires\x20--yes\x20to\x20confirm,\x20or\x20interactive\x20prompt.','\x20workspace\x20init`\x20or\x20--appcode).','6874302lSbwuU'];a322_0x4fcd=function(){return _0x513a57;};return a322_0x4fcd();}export function generateServiceHelp(_0x1c6882){const _0xe9bbda=a322_0x442f;return createGenerators()[_0xe9bbda(0x79)](_0x1c6882);}export function generateFullHelp(){return createGenerators()['generateFullHelp']();}
1
+ import{createHelpGenerators}from"@lovrabet/cli-framework";import{buildAllFlags}from"../framework/build-all-flags.js";import{serviceRegistry,serviceGroups,getServiceEntry}from"../commands/registry.js";import{CLI_BIN_NAME,CLI_DISPLAY_NAME,GLOBAL_FLAGS}from"../constant/cli.js";import{requiresExplicitYes}from"../framework/explicit-yes.js";function createGenerators(){return createHelpGenerators({cliBinName:CLI_BIN_NAME,cliDisplayName:CLI_DISPLAY_NAME,globalFlags:GLOBAL_FLAGS,serviceRegistry:serviceRegistry,getServiceEntry:getServiceEntry,getServiceDefinitions:service=>serviceGroups.get(service),buildAllFlags:buildAllFlags,appPrerequisiteText:`Requires appcode (set via \`${CLI_BIN_NAME} workspace init\` or --appcode).`,serviceUsageSuffix:" [args] [flags]"})}export function generateCommandHelp(def){const help=createGenerators().generateCommandHelp(def);if(!requiresExplicitYes(def))return help
2
+ ;return help.replace("Requires --yes to confirm, or interactive prompt.","Requires explicit --yes for execution; use --dry-run to preview.")}export function generateServiceHelp(service){return createGenerators().generateServiceHelp(service)}export function generateFullHelp(){return createGenerators().generateFullHelp()}
@@ -1 +1 @@
1
- (function(_0x256847,_0x581e74){var _0x2fafcb=a323_0x5a75,_0x58ddd8=_0x256847();while(!![]){try{var _0x4ff55a=-parseInt(_0x2fafcb(0x74))/0x1+parseInt(_0x2fafcb(0x73))/0x2+parseInt(_0x2fafcb(0x71))/0x3*(-parseInt(_0x2fafcb(0x78))/0x4)+parseInt(_0x2fafcb(0x72))/0x5+parseInt(_0x2fafcb(0x75))/0x6+parseInt(_0x2fafcb(0x76))/0x7+-parseInt(_0x2fafcb(0x77))/0x8;if(_0x4ff55a===_0x581e74)break;else _0x58ddd8['push'](_0x58ddd8['shift']());}catch(_0x3b8a73){_0x58ddd8['push'](_0x58ddd8['shift']());}}}(a323_0x5aec,0x433db));function a323_0x5a75(_0x1590a1,_0x13e6c2){_0x1590a1=_0x1590a1-0x71;var _0x5aec40=a323_0x5aec();var _0x5a7533=_0x5aec40[_0x1590a1];return _0x5a7533;}export{runCommand}from'../framework/runner.js';export{parseFlags,validateFlags}from'../framework/flags.js';function a323_0x5aec(){var _0x1900dc=['1042696YMhwgE','438941vIFSYY','893700xwjqTZ','1636600QnGneh','2306576nruobr','4awSqpY','86967jRKfIb','637865bQbRDi'];a323_0x5aec=function(){return _0x1900dc;};return a323_0x5aec();}export{formatOutput}from'../framework/output.js';export{generateCommandHelp,generateServiceHelp,generateFullHelp}from'../framework/help.js';export{extractList,extractPaging}from'../framework/response.js';export{riskLevelOrder}from'../framework/types.js';
1
+ export{runCommand}from"../framework/runner.js";export{parseFlags,validateFlags}from"../framework/flags.js";export{formatOutput}from"../framework/output.js";export{generateCommandHelp,generateServiceHelp,generateFullHelp}from"../framework/help.js";export{extractList,extractPaging}from"../framework/response.js";export{riskLevelOrder}from"../framework/types.js";
@@ -1 +1,2 @@
1
- (function(_0x1d1a6d,_0xcb2500){const _0x3d8160=a324_0x1745,_0x1640b4=_0x1d1a6d();while(!![]){try{const _0x4c5373=-parseInt(_0x3d8160(0xac))/0x1*(-parseInt(_0x3d8160(0xc4))/0x2)+parseInt(_0x3d8160(0xb4))/0x3*(-parseInt(_0x3d8160(0xb2))/0x4)+parseInt(_0x3d8160(0xa9))/0x5+-parseInt(_0x3d8160(0xab))/0x6*(-parseInt(_0x3d8160(0xa7))/0x7)+parseInt(_0x3d8160(0xaf))/0x8+-parseInt(_0x3d8160(0xb3))/0x9+-parseInt(_0x3d8160(0xb5))/0xa*(-parseInt(_0x3d8160(0xad))/0xb);if(_0x4c5373===_0xcb2500)break;else _0x1640b4['push'](_0x1640b4['shift']());}catch(_0x1aee98){_0x1640b4['push'](_0x1640b4['shift']());}}}(a324_0x4f72,0x449fa));import{createFormatOutput,resolveBundledJqPaths}from'@lovrabet/cli-framework';import{CliError,CliErrors}from'../errors.js';import{applyJqFilter}from'../utils/apply-jq-filter.js';function a324_0x1745(_0x2cb39e,_0x552a6c){_0x2cb39e=_0x2cb39e-0xa7;const _0x4f7283=a324_0x4f72();let _0x1745af=_0x4f7283[_0x2cb39e];return _0x1745af;}const baseFormatOutput=createFormatOutput({'cliErrors':CliErrors,'jqBinaryResolverOptions':{'bundledJqPaths':resolveBundledJqPaths()}});export function formatOutput(_0x123a3a,_0x40e855){const _0x2aeecb=a324_0x1745,_0x21dd75=_0x123a3a[_0x2aeecb(0xbd)],{_notice:_0x1d9b70,..._0x10671c}=_0x123a3a;void _0x1d9b70,baseFormatOutput(_0x10671c,_0x40e855),_0x40e855[_0x2aeecb(0xb7)]===_0x2aeecb(0xb6)&&printPrettyNotice(_0x21dd75);}export function formatCliError(_0x5cedec,_0xf29fc6){const _0x280151=a324_0x1745;if(_0xf29fc6['format']===_0x280151(0xb6))return![];const _0x30925a=_0x5cedec[_0x280151(0xba)],_0x45cff9={'ok':![],'command':_0xf29fc6[_0x280151(0xc3)],'risk':_0xf29fc6[_0x280151(0xbe)],'data':_0x30925a??null,'error':{'code':_0x5cedec['code'],'message':_0x5cedec[_0x280151(0xae)],..._0x5cedec[_0x280151(0xb0)]?{'hint':_0x5cedec[_0x280151(0xb0)]}:{}}},_0x426e42=_0xf29fc6['format']===_0x280151(0xc2)?JSON[_0x280151(0xc1)](_0x45cff9,null,0x2):JSON[_0x280151(0xc1)](_0x45cff9);let _0x3c6045=_0x426e42;if(_0xf29fc6[_0x280151(0xb1)]?.[_0x280151(0xc5)]())try{_0x3c6045=applyJqFilter(_0x426e42,_0xf29fc6[_0x280151(0xb1)]);}catch(_0x15f453){const _0x4512e7=_0x15f453 instanceof CliError?_0x15f453:CliErrors[_0x280151(0xc0)](_0x280151(0xbf)+(_0x15f453 instanceof Error?_0x15f453[_0x280151(0xae)]:String(_0x15f453))),_0x8c1ec9={..._0x45cff9,'error':{'code':_0x4512e7[_0x280151(0xb8)],'message':_0x4512e7[_0x280151(0xae)],..._0x4512e7[_0x280151(0xb0)]?{'hint':_0x4512e7['hint']}:{},'cause':_0x45cff9['error']}};_0x3c6045=_0xf29fc6[_0x280151(0xb7)]==='json'?JSON['stringify'](_0x8c1ec9,null,0x2):JSON[_0x280151(0xc1)](_0x8c1ec9);}return process[_0x280151(0xaa)][_0x280151(0xb9)](_0x3c6045[_0x280151(0xa8)]('\x0a')?_0x3c6045:_0x3c6045+'\x0a'),!![];}function a324_0x4f72(){const _0x17b351=['118PWlwgc','trim','973bXWuoR','endsWith','1000305OXzdlR','stdout','1266YtYMJZ','601NNOEwS','156321vfmpLx','message','1960608hJxcgJ','hint','jqFilter','1422628iXcGlN','1160856JgSXQy','3zBrxIh','180CRGtxz','pretty','format','code','write','data','url','update','_notice','risk','jq:\x20','validation','stringify','json','command'];a324_0x4f72=function(){return _0x17b351;};return a324_0x4f72();}function printPrettyNotice(_0x444652){const _0x23f6be=a324_0x1745;if(!_0x444652?.['update'])return;console['error'](_0x444652[_0x23f6be(0xbc)][_0x23f6be(0xae)]+'\x20('+_0x444652[_0x23f6be(0xbc)][_0x23f6be(0xbb)]+')');}
1
+ import{createFormatOutput,resolveBundledJqPaths}from"@lovrabet/cli-framework";import{CliError,CliErrors}from"../errors.js";import{applyJqFilter}from"../utils/apply-jq-filter.js";const baseFormatOutput=createFormatOutput({cliErrors:CliErrors,jqBinaryResolverOptions:{bundledJqPaths:resolveBundledJqPaths()}});export function formatOutput(result,options){const notice=result._notice;const{_notice:_notice,...plainResult}=result;void _notice;baseFormatOutput(plainResult,options);if(options.format==="pretty"){printPrettyNotice(notice)}}export function formatCliError(error,options){if(options.format==="pretty")return false;const errorData=error.data;const envelope={ok:false,command:options.command,risk:options.risk,data:errorData??null,error:{code:error.code,message:error.message,...error.hint?{hint:error.hint}:{}}};const json=options.format==="json"?JSON.stringify(envelope,null,2):JSON.stringify(envelope);let output=json;if(options.jqFilter?.trim()){try{
2
+ output=applyJqFilter(json,options.jqFilter)}catch(jqError){const filterError=jqError instanceof CliError?jqError:CliErrors.validation(`jq: ${jqError instanceof Error?jqError.message:String(jqError)}`);const fallbackEnvelope={...envelope,error:{code:filterError.code,message:filterError.message,...filterError.hint?{hint:filterError.hint}:{},cause:envelope.error}};output=options.format==="json"?JSON.stringify(fallbackEnvelope,null,2):JSON.stringify(fallbackEnvelope)}}process.stdout.write(output.endsWith("\n")?output:`${output}\n`);return true}function printPrettyNotice(notice){if(!notice?.update)return;console.error(`${notice.update.message} (${notice.update.url})`)}
@@ -1 +1 @@
1
- (function(_0x57fc29,_0x588a91){var _0x4ef466=a325_0x117a,_0x2f7fc3=_0x57fc29();while(!![]){try{var _0x3d78e6=parseInt(_0x4ef466(0x8e))/0x1+parseInt(_0x4ef466(0x8d))/0x2+-parseInt(_0x4ef466(0x90))/0x3*(-parseInt(_0x4ef466(0x8b))/0x4)+-parseInt(_0x4ef466(0x8f))/0x5+parseInt(_0x4ef466(0x89))/0x6*(-parseInt(_0x4ef466(0x8c))/0x7)+parseInt(_0x4ef466(0x92))/0x8*(parseInt(_0x4ef466(0x91))/0x9)+-parseInt(_0x4ef466(0x8a))/0xa;if(_0x3d78e6===_0x588a91)break;else _0x2f7fc3['push'](_0x2f7fc3['shift']());}catch(_0x4b695e){_0x2f7fc3['push'](_0x2f7fc3['shift']());}}}(a325_0x1ce4,0x5cf86));function a325_0x1ce4(){var _0x9c2ca7=['598267pHNSpc','3424545YxgNWY','421113HhKreP','14229jtxvrV','3744ACSSAV','145014SjCGWb','10063880joKysH','8kdyzXl','21dNCABq','1051386JgRrcf'];a325_0x1ce4=function(){return _0x9c2ca7;};return a325_0x1ce4();}function a325_0x117a(_0x595cee,_0xf7b15a){_0x595cee=_0x595cee-0x89;var _0x1ce4ae=a325_0x1ce4();var _0x117ad6=_0x1ce4ae[_0x595cee];return _0x117ad6;}export{extractList,extractPaging}from'@lovrabet/cli-framework';
1
+ export{extractList,extractPaging}from"@lovrabet/cli-framework";
@@ -1 +1,2 @@
1
- (function(_0x24f2d4,_0x3b5866){const _0x439767=a326_0x1ad8,_0x420397=_0x24f2d4();while(!![]){try{const _0x2bb86a=parseInt(_0x439767(0x132))/0x1*(parseInt(_0x439767(0x13a))/0x2)+-parseInt(_0x439767(0x143))/0x3*(-parseInt(_0x439767(0x137))/0x4)+parseInt(_0x439767(0x139))/0x5+parseInt(_0x439767(0x135))/0x6+-parseInt(_0x439767(0x12d))/0x7*(-parseInt(_0x439767(0x136))/0x8)+parseInt(_0x439767(0x138))/0x9+parseInt(_0x439767(0x13f))/0xa*(-parseInt(_0x439767(0x144))/0xb);if(_0x2bb86a===_0x3b5866)break;else _0x420397['push'](_0x420397['shift']());}catch(_0x1b951c){_0x420397['push'](_0x420397['shift']());}}}(a326_0x5034,0xe3a5b));import{CliErrors}from'../errors.js';import{resolveAlias,listAliases}from'../core/alias-resolver.js';function a326_0x1ad8(_0x3c0139,_0x524ed8){_0x3c0139=_0x3c0139-0x12c;const _0x5034c8=a326_0x5034();let _0x1ad857=_0x5034c8[_0x3c0139];return _0x1ad857;}import{CLI_BIN_NAME}from'../constant/cli.js';import{resolveApiModelSource}from'../api/model-source.js';export function resolveAliasToCode(_0x15a0a1,_0x39dd3d,_0x58b3ca,_0x49b23c,_0x4e2e7a,_0x4d5fc5){const _0x5ab756=a326_0x1ad8,_0x1e4f54=_0x15a0a1[_0x5ab756(0x131)][_0x5ab756(0x12c)](_0x59efec=>_0x59efec[_0x5ab756(0x141)]==='code'&&_0x59efec[_0x5ab756(0x13b)]===_0x5ab756(0x148)),_0x18c159=_0x15a0a1[_0x5ab756(0x131)]['some'](_0xe64a57=>_0xe64a57[_0x5ab756(0x141)]===_0x5ab756(0x130)&&_0xe64a57['type']==='string');if(!_0x1e4f54||!_0x18c159)return;const _0x216c90=_0x39dd3d[_0x5ab756(0x12f)]?String(_0x39dd3d[_0x5ab756(0x12f)]):'',_0x4d1297=_0x39dd3d[_0x5ab756(0x130)]?String(_0x39dd3d['alias']):'';if(!_0x216c90&&!_0x4d1297)throw CliErrors['validation']('`'+_0x49b23c+_0x5ab756(0x13d));if(_0x4d1297&&!_0x216c90){const _0x514e16=resolveApiModelSource(_0x58b3ca,_0x4e2e7a,_0x4d5fc5),_0x2226ed=resolveAlias(_0x58b3ca,_0x4d1297,undefined,_0x514e16[_0x5ab756(0x134)],_0x514e16[_0x5ab756(0x13e)]);if(!_0x2226ed){const _0x373e79=listAliases(_0x58b3ca,undefined,_0x514e16[_0x5ab756(0x134)],_0x514e16[_0x5ab756(0x13e)])[_0x5ab756(0x140)](_0x2260f7=>_0x2260f7[_0x5ab756(0x130)]),_0x47380d=_0x373e79[_0x5ab756(0x13c)]?_0x5ab756(0x12e)+_0x373e79[_0x5ab756(0x142)](',\x20'):_0x5ab756(0x147)+_0x58b3ca+_0x5ab756(0x133)+CLI_BIN_NAME+'\x20api\x20pull`\x20first.';throw CliErrors['validation'](_0x5ab756(0x146)+_0x4d1297+_0x5ab756(0x145)+_0x47380d);}_0x39dd3d[_0x5ab756(0x12f)]=_0x2226ed;}}function a326_0x5034(){const _0x43ef00=['string','some','49WLhTbr','Available\x20aliases:\x20','code','alias','flags','1403xgqjSZ','.\x20Run\x20`','filePath','4880232Ejpaea','503280QlQhKU','4fqbsci','3614049oJxQSD','6870055FfcWVo','868uTlTfx','type','length','`\x20requires\x20either\x20--code\x20or\x20--alias.','profileName','70KZeqfx','map','name','join','4175430RIDghE','6439059aJwDwd','\x22.\x20','Unknown\x20alias\x20\x22','No\x20model\x20aliases\x20found\x20in\x20'];a326_0x5034=function(){return _0x43ef00;};return a326_0x5034();}
1
+ import{CliErrors}from"../errors.js";import{resolveAlias,listAliases}from"../core/alias-resolver.js";import{CLI_BIN_NAME}from"../constant/cli.js";import{resolveApiModelSource}from"../api/model-source.js";export function resolveAliasToCode(def,flags,apiDir,commandLabel,appCode,selectedAppName){const hasCodeFlag=def.flags.some(f=>f.name==="code"&&f.type==="string");const hasAliasFlag=def.flags.some(f=>f.name==="alias"&&f.type==="string");if(!hasCodeFlag||!hasAliasFlag)return;const code=flags.code?String(flags.code):"";const alias=flags.alias?String(flags.alias):"";if(!code&&!alias){throw CliErrors.validation(`\`${commandLabel}\` requires either --code or --alias.`)}if(alias&&!code){const source=resolveApiModelSource(apiDir,appCode,selectedAppName);const resolved=resolveAlias(apiDir,alias,undefined,source.filePath,source.profileName);if(!resolved){const available=listAliases(apiDir,undefined,source.filePath,source.profileName).map(e=>e.alias)
2
+ ;const hint=available.length?`Available aliases: ${available.join(", ")}`:`No model aliases found in ${apiDir}. Run \`${CLI_BIN_NAME} api pull\` first.`;throw CliErrors.validation(`Unknown alias "${alias}". ${hint}`)}flags.code=resolved}}