@lovrabet/rabetbase-cli 2.5.4-beta.5 → 2.5.5-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.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +2 -1
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +35 -0
- package/skills/rabetbase-page-generation/references/component-baseline.md +18 -0
- package/skills/rabetbase-page-generation/references/generation.md +77 -0
- package/skills/rabetbase-page-generation/templates/onepage/build.mjs +63 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/index.jsx +4 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/index.jsx +194 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/index.jsx +717 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/editor.jsx +395 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/model.js +141 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/page.css +377 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/record-layout.jsx +90 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/responsive.jsx +70 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/README.md +21 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/index.jsx +4 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/preview.png +0 -0
- package/skills/rabetbase.manifest.json +3 -3
package/lib/utils/sleep.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function sleep(
|
|
1
|
+
export function sleep(_0x4d2fc6){return new Promise(_0x2484a6=>setTimeout(_0x2484a6,_0x4d2fc6));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a355_0x1a42(){const _0x2cdee7=['extname','processTemplate','6nDORrO','now','.tpl','\x0a\x20\x20\x20\x20{\x20','1013392DUjcIy','split','map','getHours','utf8','pad','default','sdk-config','datasetCode','1cQwCUt','tableName','.ts','processDirectory','info','getSeconds','isDirectory','getDate','join','includes','\x20},','Template\x20content\x20replacement\x20completed','processFile','push','toISOString','3100zYalCh','getMinutes','promises','927526wzqgnv','copyFile','toComponentName','7DviKqt','.json','13IxDXLq','success','7972644SCXVDD','.css','toUpperCase','YourModel','17413AgqOKB','Template\x20content\x20replacement\x20failed','endsWith','2855151QMkirc','error','padStart','readFile','.tsx','mkdir','replaceApiContent','template','LOVRABET','formatLocalTimestamp','name:\x20\x22','slice','352915ALhNiZ','name','toDisplayTitle','getMonth','12nYPUUy','pop','replace','writeFile','getFullYear','81856CUvzEy','datasetCode:\x20\x22','toLowerCase'];a355_0x1a42=function(){return _0x2cdee7;};return a355_0x1a42();}const a355_0x41370f=a355_0x2b26;(function(_0x5465d4,_0x462301){const _0x492ed8=a355_0x2b26,_0x29abef=_0x5465d4();while(!![]){try{const _0x2e10c0=parseInt(_0x492ed8(0x1ae))/0x1*(parseInt(_0x492ed8(0x1c0))/0x2)+parseInt(_0x492ed8(0x1a1))/0x3*(parseInt(_0x492ed8(0x1a5))/0x4)+parseInt(_0x492ed8(0x1da))/0x5*(parseInt(_0x492ed8(0x197))/0x6)+parseInt(_0x492ed8(0x1c3))/0x7*(parseInt(_0x492ed8(0x19c))/0x8)+parseInt(_0x492ed8(0x1ce))/0x9+parseInt(_0x492ed8(0x1bd))/0xa*(-parseInt(_0x492ed8(0x1cb))/0xb)+-parseInt(_0x492ed8(0x1c7))/0xc*(parseInt(_0x492ed8(0x1c5))/0xd);if(_0x2e10c0===_0x462301)break;else _0x29abef['push'](_0x29abef['shift']());}catch(_0x159708){_0x29abef['push'](_0x29abef['shift']());}}}(a355_0x1a42,0x4554b));import a355_0x4a4571 from'node:fs';import a355_0x1e2411 from'node:path';function a355_0x2b26(_0x32d429,_0x162f5c){_0x32d429=_0x32d429-0x195;const _0x1a4255=a355_0x1a42();let _0x2b268a=_0x1a4255[_0x32d429];return _0x2b268a;}import{logger}from'../utils/logger.js';import{getCliVersion}from'../utils/version.js';const CLI_VERSION=getCliVersion();export class TemplateReplacer{static[a355_0x41370f(0x1aa)](_0x24d28e){const _0x113b28=a355_0x41370f;return String(_0x24d28e)[_0x113b28(0x1d0)](0x2,'0');}static[a355_0x41370f(0x1d7)](_0x514af8){const _0x591a17=a355_0x41370f,_0x543d4b=_0x514af8[_0x591a17(0x19b)](),_0x4221ac=this[_0x591a17(0x1aa)](_0x514af8[_0x591a17(0x196)]()+0x1),_0x448be0=this['pad'](_0x514af8[_0x591a17(0x1b5)]()),_0xd691a5=this[_0x591a17(0x1aa)](_0x514af8[_0x591a17(0x1a8)]()),_0x1ba86a=this[_0x591a17(0x1aa)](_0x514af8[_0x591a17(0x1be)]()),_0x3e25ee=this[_0x591a17(0x1aa)](_0x514af8[_0x591a17(0x1b3)]());return{'createdAt':_0x543d4b+'-'+_0x4221ac+'-'+_0x448be0+'\x20'+_0xd691a5+':'+_0x1ba86a+':'+_0x3e25ee,'createdDate':_0x543d4b+'-'+_0x4221ac+'-'+_0x448be0,'createdTime':_0xd691a5+':'+_0x1ba86a+':'+_0x3e25ee};}static[a355_0x41370f(0x1c2)](_0x3d6c30){const _0x864349=a355_0x41370f,_0x15d330=_0x3d6c30['split']('/')[_0x864349(0x198)]()||_0x3d6c30;return _0x15d330[_0x864349(0x1a6)]('-')[_0x864349(0x1a7)](_0x3280c9=>_0x3280c9['charAt'](0x0)['toUpperCase']()+_0x3280c9[_0x864349(0x1d9)](0x1)[_0x864349(0x19e)]())['join']('');}static[a355_0x41370f(0x195)](_0x9c22c5){const _0x34b861=a355_0x41370f,_0x5c3941=_0x9c22c5['split']('/')[_0x34b861(0x198)]()||_0x9c22c5;return _0x5c3941[_0x34b861(0x1a6)]('-')[_0x34b861(0x1a7)](_0x10ba2a=>_0x10ba2a['charAt'](0x0)[_0x34b861(0x1c9)]()+_0x10ba2a[_0x34b861(0x1d9)](0x1)[_0x34b861(0x19e)]())[_0x34b861(0x1b6)]('\x20');}static['replaceContent'](_0x6b41a9,_0x5c5aa7,_0x35124a){const _0x1975fb=a355_0x41370f,_0x2213ff=this[_0x1975fb(0x1c2)](_0x5c5aa7),_0x50b7ab=this[_0x1975fb(0x195)](_0x5c5aa7),{createdAt:_0x92ca84,createdDate:_0x12cad1,createdTime:_0x6bad15}=this[_0x1975fb(0x1d7)](new Date());let _0x5cd072=_0x6b41a9['replace'](/\{CliVersion\}/g,CLI_VERSION)[_0x1975fb(0x199)](/\{ComponentName\}/g,_0x2213ff)[_0x1975fb(0x199)](/\{DisplayTitle\}/g,_0x50b7ab)[_0x1975fb(0x199)](/\{PageName\}/g,_0x5c5aa7)[_0x1975fb(0x199)](/\{TemplateName\}/g,_0x35124a)['replace'](/\{CreatedAt\}/g,_0x92ca84)[_0x1975fb(0x199)](/\{CreatedDate\}/g,_0x12cad1)[_0x1975fb(0x199)](/\{CreatedTime\}/g,_0x6bad15);return _0x5cd072;}static[a355_0x41370f(0x1d4)](_0x1167b9,_0x5094d6,_0x30bb0e,_0x2bac21,_0x581831,_0x74c7d1,_0x383890,_0x42417a,_0x26f32c){const _0x511d2c=a355_0x41370f,_0x20e2f7=new Date(),_0x45bf4b=_0x20e2f7[_0x511d2c(0x1bc)](),_0x565fbc=_0x30bb0e[_0x511d2c(0x1a7)](_0x1cd3ed=>{const _0x20889c=_0x511d2c,_0x51f5c6=[_0x20889c(0x19d)+_0x1cd3ed[_0x20889c(0x1ad)]+'\x22','tableName:\x20\x22'+_0x1cd3ed[_0x20889c(0x1af)]+'\x22',_0x20889c(0x1d8)+_0x1cd3ed['name']+'\x22'];return _0x1cd3ed['alias']&&_0x51f5c6[_0x20889c(0x1bb)]('alias:\x20\x22'+_0x1cd3ed['alias']+'\x22'),_0x20889c(0x1a4)+_0x51f5c6[_0x20889c(0x1b6)](',\x20')+_0x20889c(0x1b8);})[_0x511d2c(0x1b6)](''),_0xab5078=_0x2bac21||_0x30bb0e[0x0]?.['alias']||_0x511d2c(0x1ca);let _0x33772a=_0x1167b9[_0x511d2c(0x199)](/\{AppCode\}/g,_0x5094d6)[_0x511d2c(0x199)](/\{ModelConfigs\}/g,_0x565fbc)[_0x511d2c(0x199)](/\{ExampleModelName\}/g,_0xab5078)[_0x511d2c(0x199)](/\{ApiFileName\}/g,_0x581831||'api')[_0x511d2c(0x199)](/\{ConfigName\}/g,_0x74c7d1||_0x511d2c(0x1ab))[_0x511d2c(0x199)](/\{ClientConfigParam\}/g,_0x383890||'')[_0x511d2c(0x199)](/\{SdkConfigFileName\}/g,_0x26f32c||_0x511d2c(0x1ac))[_0x511d2c(0x199)](/\{VarPrefix\}/g,_0x42417a||_0x511d2c(0x1d6))[_0x511d2c(0x199)](/\{CreatedAt\}/g,_0x45bf4b);return _0x33772a;}static async[a355_0x41370f(0x1a0)](_0x5ce264,_0x38a6a2,_0x507124,_0x40803f,_0xa6e955=!![]){const _0x2443fc=a355_0x41370f,_0x276523=Date['now']();try{_0xa6e955&&logger[_0x2443fc(0x1b2)](_0x2443fc(0x1d5),'Starting\x20template\x20content\x20replacement',{'templatePath':_0x5ce264,'targetPath':_0x38a6a2,'pageName':_0x507124,'templateName':_0x40803f});await a355_0x4a4571[_0x2443fc(0x1bf)][_0x2443fc(0x1d3)](_0x38a6a2,{'recursive':!![]}),await this[_0x2443fc(0x1b1)](_0x5ce264,_0x38a6a2,_0x507124,_0x40803f);if(_0xa6e955){const _0x3f7714=Date[_0x2443fc(0x1a2)]()-_0x276523;logger[_0x2443fc(0x1c6)](_0x2443fc(0x1d5),_0x2443fc(0x1b9),_0x3f7714,{'pageName':_0x507124,'templateName':_0x40803f});}}catch(_0x1f4904){if(_0xa6e955){const _0x4d0379=Date[_0x2443fc(0x1a2)]()-_0x276523;logger[_0x2443fc(0x1cf)](_0x2443fc(0x1d5),_0x2443fc(0x1cc),{'templatePath':_0x5ce264,'targetPath':_0x38a6a2,'pageName':_0x507124,'templateName':_0x40803f,'error':_0x1f4904 instanceof Error?_0x1f4904['message']:String(_0x1f4904),'duration':_0x4d0379});}throw _0x1f4904;}}static async[a355_0x41370f(0x1b1)](_0x51a5f0,_0x24aa92,_0x4fdae6,_0x45d574){const _0x5d9d18=a355_0x41370f,_0x30a581=await a355_0x4a4571[_0x5d9d18(0x1bf)]['readdir'](_0x51a5f0,{'withFileTypes':!![]});for(const _0x544890 of _0x30a581){const _0x370283=a355_0x1e2411[_0x5d9d18(0x1b6)](_0x51a5f0,_0x544890[_0x5d9d18(0x1db)]);let _0x190b29=a355_0x1e2411[_0x5d9d18(0x1b6)](_0x24aa92,_0x544890[_0x5d9d18(0x1db)]);_0x544890[_0x5d9d18(0x1db)][_0x5d9d18(0x1cd)](_0x5d9d18(0x1a3))&&(_0x190b29=a355_0x1e2411[_0x5d9d18(0x1b6)](_0x24aa92,_0x544890[_0x5d9d18(0x1db)][_0x5d9d18(0x199)](/\.tpl$/,'')));if(_0x544890[_0x5d9d18(0x1b4)]())await a355_0x4a4571[_0x5d9d18(0x1bf)][_0x5d9d18(0x1d3)](_0x190b29,{'recursive':!![]}),await this[_0x5d9d18(0x1b1)](_0x370283,_0x190b29,_0x4fdae6,_0x45d574);else _0x544890['isFile']()&&await this[_0x5d9d18(0x1ba)](_0x370283,_0x190b29,_0x4fdae6,_0x45d574);}}static async['processFile'](_0x379c9b,_0x2e16e0,_0x2ee9e3,_0x2ab2fc){const _0x5e4e41=a355_0x41370f,_0x2bbe3f=a355_0x1e2411[_0x5e4e41(0x19f)](_0x379c9b)[_0x5e4e41(0x19e)]();_0x379c9b[_0x5e4e41(0x1cd)](_0x5e4e41(0x1a3))&&(_0x2e16e0=_0x2e16e0[_0x5e4e41(0x199)](/\.tpl$/,''));const _0x1bbfd3=[_0x5e4e41(0x1d2),_0x5e4e41(0x1b0),'.jsx','.js',_0x5e4e41(0x1c4),'.md',_0x5e4e41(0x1c8),'.scss',_0x5e4e41(0x1a3)];if(_0x1bbfd3[_0x5e4e41(0x1b7)](_0x2bbe3f)||_0x379c9b[_0x5e4e41(0x1cd)](_0x5e4e41(0x1a3))){const _0x50ce45=await a355_0x4a4571['promises'][_0x5e4e41(0x1d1)](_0x379c9b,_0x5e4e41(0x1a9)),_0x490a87=this['replaceContent'](_0x50ce45,_0x2ee9e3,_0x2ab2fc);await a355_0x4a4571[_0x5e4e41(0x1bf)][_0x5e4e41(0x19a)](_0x2e16e0,_0x490a87,_0x5e4e41(0x1a9));}else await a355_0x4a4571[_0x5e4e41(0x1bf)][_0x5e4e41(0x1c1)](_0x379c9b,_0x2e16e0);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1268cb,_0x213c1b){const _0x2bb4f5=a356_0xcdea,_0x8c4d3d=_0x1268cb();while(!![]){try{const _0x345f67=-parseInt(_0x2bb4f5(0x120))/0x1*(parseInt(_0x2bb4f5(0x132))/0x2)+-parseInt(_0x2bb4f5(0x11c))/0x3+-parseInt(_0x2bb4f5(0x136))/0x4+-parseInt(_0x2bb4f5(0x12c))/0x5*(-parseInt(_0x2bb4f5(0x12e))/0x6)+-parseInt(_0x2bb4f5(0x130))/0x7*(parseInt(_0x2bb4f5(0x13a))/0x8)+parseInt(_0x2bb4f5(0x12a))/0x9*(parseInt(_0x2bb4f5(0x134))/0xa)+parseInt(_0x2bb4f5(0x138))/0xb*(parseInt(_0x2bb4f5(0x11e))/0xc);if(_0x345f67===_0x213c1b)break;else _0x8c4d3d['push'](_0x8c4d3d['shift']());}catch(_0x2ea9dd){_0x8c4d3d['push'](_0x8c4d3d['shift']());}}}(a356_0x4630,0x5987a));import{mkdir,readFile,writeFile}from'node:fs/promises';import{homedir}from'node:os';import{dirname,join}from'node:path';function a356_0xcdea(_0x375ea5,_0x51b33d){_0x375ea5=_0x375ea5-0x11c;const _0x46301e=a356_0x4630();let _0xcdea02=_0x46301e[_0x375ea5];return _0xcdea02;}import a356_0x48ccea from'semver';import{CLI_BIN_NAME,NPM_PACKAGE_NAME}from'../constant/cli.js';import{getCliVersionPolicy}from'../utils/cli-version-policy.js';import{getCliVersion}from'../utils/version.js';const UPDATE_CHECK_TTL_MS=0xc*0x3c*0x3c*0x3e8,UPDATE_NOTICE_TTL_MS=0x18*0x3c*0x3c*0x3e8;function isUpdateNoticeDisabled(){const _0x18ece5=a356_0xcdea,_0x5c984b=process.env.RABETBASE_NO_UPDATE_NOTICE?.[_0x18ece5(0x124)]()['toLowerCase']();return _0x5c984b==='1'||_0x5c984b==='true'||_0x5c984b===_0x18ece5(0x128);}function a356_0x4630(){const _0xe0ae02=['1kzdCPl','lastNotifiedVersion','gte','valid','trim','utf8','rabetbase-cli','\x20available,\x20current\x20','yes','now','1636065caqaYR','stringify','5JHKYDg','checkedAt','4327686SWqkjp','parse','14HJzChp','number','401470pSfpSw','update-check.json','10TBjONI','\x20update','2242812iXbhSN','lastNotifiedAt','572tJbGZO',',\x20run:\x20','277096zpeJyZ','1254900nJdWNY','latest','164460kKZiwz','object'];a356_0x4630=function(){return _0xe0ae02;};return a356_0x4630();}function cacheRoot(){return process.env.XDG_CACHE_HOME||process.env.LOCALAPPDATA||join(homedir(),'.cache');}export function getUpdateNoticeCachePath(){const _0x2bcef4=a356_0xcdea;return join(cacheRoot(),_0x2bcef4(0x126),_0x2bcef4(0x133));}async function readUpdateNoticeCache(){const _0x473dae=a356_0xcdea;try{const _0x228d9e=await readFile(getUpdateNoticeCachePath(),_0x473dae(0x125)),_0x2a8c50=JSON[_0x473dae(0x12f)](_0x228d9e);if(!_0x2a8c50||typeof _0x2a8c50!==_0x473dae(0x11f))return{};return _0x2a8c50;}catch{return{};}}async function writeUpdateNoticeCache(_0x56d613){const _0x21c5df=a356_0xcdea;try{const _0x6584a0=getUpdateNoticeCachePath();await mkdir(dirname(_0x6584a0),{'recursive':!![]}),await writeFile(_0x6584a0,JSON[_0x21c5df(0x12b)](_0x56d613,null,0x2)+'\x0a',_0x21c5df(0x125));}catch{}}function isFreshCheck(_0x1c6f32,_0x5c7c69){const _0x2a75df=a356_0xcdea;return typeof _0x1c6f32[_0x2a75df(0x12d)]===_0x2a75df(0x131)&&_0x5c7c69-_0x1c6f32[_0x2a75df(0x12d)]<UPDATE_CHECK_TTL_MS;}function isRecentlyNotified(_0x351709,_0x5f499d,_0x3807a5){const _0xd77395=a356_0xcdea;return _0x351709[_0xd77395(0x121)]===_0x5f499d&&typeof _0x351709[_0xd77395(0x137)]==='number'&&_0x3807a5-_0x351709[_0xd77395(0x137)]<UPDATE_NOTICE_TTL_MS;}export function buildNpmVersionUrl(_0x10644b){return'https://www.npmjs.com/package/'+NPM_PACKAGE_NAME+'/v/'+_0x10644b;}export async function resolveLatestUpdateNotice(){const _0x293cb7=a356_0xcdea;if(isUpdateNoticeDisabled())return null;try{const _0x57103f=Date[_0x293cb7(0x129)](),_0x3c0843=getCliVersion(),_0x119bb2=await readUpdateNoticeCache();let _0x5a2a1b=isFreshCheck(_0x119bb2,_0x57103f)?_0x119bb2[_0x293cb7(0x11d)]?.[_0x293cb7(0x124)]():undefined;if(!_0x5a2a1b&&!isFreshCheck(_0x119bb2,_0x57103f)){const _0x33ccf3=await getCliVersionPolicy();_0x5a2a1b=_0x33ccf3?.['stableVersion']?.[_0x293cb7(0x124)]()||undefined,await writeUpdateNoticeCache({..._0x119bb2,'checkedAt':_0x57103f,'latest':_0x5a2a1b,'failed':!_0x5a2a1b});}if(!_0x5a2a1b||!a356_0x48ccea[_0x293cb7(0x123)](_0x3c0843)||!a356_0x48ccea[_0x293cb7(0x123)](_0x5a2a1b))return null;if(a356_0x48ccea[_0x293cb7(0x122)](_0x3c0843,_0x5a2a1b))return null;if(isRecentlyNotified(_0x119bb2,_0x5a2a1b,_0x57103f))return null;const _0x20532a=CLI_BIN_NAME+_0x293cb7(0x135);return await writeUpdateNoticeCache({..._0x119bb2,'checkedAt':isFreshCheck(_0x119bb2,_0x57103f)?_0x119bb2[_0x293cb7(0x12d)]:_0x57103f,'latest':_0x5a2a1b,'failed':![],'lastNotifiedVersion':_0x5a2a1b,'lastNotifiedAt':_0x57103f}),{'command':_0x20532a,'current':_0x3c0843,'latest':_0x5a2a1b,'url':buildNpmVersionUrl(_0x5a2a1b),'message':CLI_BIN_NAME+'\x20'+_0x5a2a1b+_0x293cb7(0x127)+_0x3c0843+_0x293cb7(0x139)+_0x20532a};}catch{return null;}}
|
package/lib/utils/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x24afce,_0x5b704d){var _0xd34a39=a357_0x2335,_0x23e9b6=_0x24afce();while(!![]){try{var _0x4c4967=-parseInt(_0xd34a39(0x154))/0x1+-parseInt(_0xd34a39(0x15d))/0x2*(parseInt(_0xd34a39(0x159))/0x3)+-parseInt(_0xd34a39(0x15e))/0x4+-parseInt(_0xd34a39(0x15a))/0x5+parseInt(_0xd34a39(0x157))/0x6*(parseInt(_0xd34a39(0x15c))/0x7)+-parseInt(_0xd34a39(0x156))/0x8*(parseInt(_0xd34a39(0x155))/0x9)+parseInt(_0xd34a39(0x158))/0xa*(parseInt(_0xd34a39(0x15b))/0xb);if(_0x4c4967===_0x5b704d)break;else _0x23e9b6['push'](_0x23e9b6['shift']());}catch(_0x47c357){_0x23e9b6['push'](_0x23e9b6['shift']());}}}(a357_0x1b3e,0xe455d));function a357_0x1b3e(){var _0x8f1dd5=['2KOgdkU','6228292GhoNtX','359008mYIuyz','284652LOkjom','8cZgvFD','6TZcVEs','581540IoCHLz','3364914nLNUBU','8547645McrDau','836uYAxht','9061031wmERQK'];a357_0x1b3e=function(){return _0x8f1dd5;};return a357_0x1b3e();}function a357_0x2335(_0x539fa9,_0x105032){_0x539fa9=_0x539fa9-0x154;var _0x1b3e7a=a357_0x1b3e();var _0x2335a6=_0x1b3e7a[_0x539fa9];return _0x2335a6;}import{VERSION}from'../generated/build-info.js';export function getCliVersion(){return VERSION;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x517501,_0x1dae79){var _0x589233=a358_0x4c82,_0x74162=_0x517501();while(!![]){try{var _0xb2f878=parseInt(_0x589233(0x160))/0x1+parseInt(_0x589233(0x167))/0x2*(-parseInt(_0x589233(0x165))/0x3)+-parseInt(_0x589233(0x162))/0x4*(parseInt(_0x589233(0x15f))/0x5)+-parseInt(_0x589233(0x163))/0x6+parseInt(_0x589233(0x161))/0x7*(-parseInt(_0x589233(0x166))/0x8)+parseInt(_0x589233(0x164))/0x9+parseInt(_0x589233(0x15e))/0xa;if(_0xb2f878===_0x1dae79)break;else _0x74162['push'](_0x74162['shift']());}catch(_0x3d77cb){_0x74162['push'](_0x74162['shift']());}}}(a358_0x1d85,0xc5642));import{setActiveCookie,clearActiveCookie}from'../core/api-client.js';export async function withActiveCookie(_0x12d47c,_0x5361b6){setActiveCookie(_0x12d47c);try{return await _0x5361b6();}finally{clearActiveCookie();}}function a358_0x4c82(_0x4444c7,_0xf13763){_0x4444c7=_0x4444c7-0x15e;var _0x1d850d=a358_0x1d85();var _0x4c82dc=_0x1d850d[_0x4444c7];return _0x4c82dc;}function a358_0x1d85(){var _0x140ca4=['7920204lOgqQI','4325526NxtLUw','3kxFJfB','8bkbHdL','2195394YkEegk','24326870IEepZx','165455dnWays','1490741Lygzke','1063832sfnDCz','124NjiWTd'];a358_0x1d85=function(){return _0x140ca4;};return a358_0x1d85();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a359_0x2ab7(_0x36983a,_0x4cd571){_0x36983a=_0x36983a-0x6b;var _0x573b36=a359_0x573b();var _0x2ab7bb=_0x573b36[_0x36983a];return _0x2ab7bb;}(function(_0x52bfe2,_0x51acfc){var _0x4d2a0f=a359_0x2ab7,_0x57851f=_0x52bfe2();while(!![]){try{var _0x5a4173=parseInt(_0x4d2a0f(0x76))/0x1*(parseInt(_0x4d2a0f(0x70))/0x2)+parseInt(_0x4d2a0f(0x75))/0x3+parseInt(_0x4d2a0f(0x78))/0x4*(-parseInt(_0x4d2a0f(0x74))/0x5)+parseInt(_0x4d2a0f(0x6b))/0x6*(-parseInt(_0x4d2a0f(0x73))/0x7)+-parseInt(_0x4d2a0f(0x77))/0x8*(-parseInt(_0x4d2a0f(0x71))/0x9)+parseInt(_0x4d2a0f(0x6d))/0xa*(-parseInt(_0x4d2a0f(0x72))/0xb)+parseInt(_0x4d2a0f(0x6e))/0xc;if(_0x5a4173===_0x51acfc)break;else _0x57851f['push'](_0x57851f['shift']());}catch(_0x5c93ea){_0x57851f['push'](_0x57851f['shift']());}}}(a359_0x573b,0xaccea));export function writeCliSideChannelLine(_0x32eb98){var _0xd7faec=a359_0x2ab7;process[_0xd7faec(0x6c)][_0xd7faec(0x6f)](_0x32eb98+'\x0a');}function a359_0x573b(){var _0x26b319=['19640lDeENv','3719280GlgWZZ','write','845440FdqaDw','9TTLJkJ','242dTUCft','402675uJjZTh','5nNAaiN','3851577BANnpY','1upFmSn','3904104JCTHnU','1721724tRsAhp','138eyWoVn','stderr'];a359_0x573b=function(){return _0x26b319;};return a359_0x573b();}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovrabet/rabetbase-cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.5-beta.1",
|
|
4
4
|
"description": "Developer CLI for Lovrabet apps, datasets, pages, SQL, Backend Function, database connections, skills, and AI agent workflows.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"keywords": [
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"files": [
|
|
87
87
|
"lib",
|
|
88
88
|
"skills/rabetbase",
|
|
89
|
+
"skills/rabetbase-page-generation",
|
|
89
90
|
"skills/rabetbase.manifest.json",
|
|
90
91
|
"scripts/postinstall.mjs",
|
|
91
92
|
"templates/custom-pages",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rabetbase
|
|
3
|
-
version: 2.5.
|
|
3
|
+
version: 2.5.5-beta.1
|
|
4
4
|
description: "Use for Lovrabet development work through the rabetbase CLI: create or bind projects (including creating an AppCode project in the current folder), pull Dataset/API facts and maintain SDK clients, or manage datasets, Instant API access policies, database connections, pages, host frontend integration, frontend subapp resources, SQL, Backend Functions, approval flows and workflows, menus, notifications, knowledge bases and kb search, Agent Context Rules, roles, files, OCR, deployment metadata, platform issues, and 钉钉沙箱账号绑定. Trigger when the user mentions rabetbase, Lovrabet development, AppCode, Dataset, Instant API allow/deny/route policy, project creation, api pull/codegen, dblink, page, host frontend integration, subapp resource versions, SQL, BFF, creating or designing an approval flow, workflow, business process, or multi-step approval, menu, notification, knowledge base, kb search, Agent Context Rules, RULES.md, DATABASE.md, rule list/get/set, role, file/OCR, or related development workflows."
|
|
5
5
|
metadata:
|
|
6
6
|
requires:
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rabetbase-page-generation
|
|
3
|
+
version: 2.5.5-beta.1
|
|
4
|
+
description: "为已有 Dataset 生成、验证和发布由 list、detail、create、update 四个 CustomJSX 页面组成的 ONEPAGE 页面包。"
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["rabetbase"]
|
|
8
|
+
node: ">=22.20"
|
|
9
|
+
cliHelp: "rabetbase page --help"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# ONEPAGE 页面生成
|
|
13
|
+
|
|
14
|
+
本 Skill 负责模板选择、真实 SDK 数据绑定和页面交互;复用现有 CLI 的页面目录校验、创建、更新、发布与查询命令。页面全部使用 CustomJSX,由 ONEPAGE 编排,不生成 Page Schema、`CRUD_PAGE_SET`、Dataset 或 Workflow,不替换既有 CLI 流程。
|
|
15
|
+
|
|
16
|
+
- 页面源码从 `templates/onepage` 复制到任务的页面工作目录,按 Dataset 元信息改写;构建得到四个完整独立目录。详情与更新是不同页面;新增和更新共享表单实现。
|
|
17
|
+
- 智能搜索使用原 `LrSmartFilter` 组合组件的独立 JSX 实现;表格、详情和表单使用 AntD。组件与运行时边界见 [组件基线](references/component-baseline.md)。
|
|
18
|
+
- 通过 `--page-dir` 交付页面,不使用旧单页 `--page-pattern ONEPAGE`。CLI 不选择模板、不生成业务数据,也不承担模板构建。
|
|
19
|
+
- 复用现有页面创建行为及 `menu` 管理命令;默认创建并绑定菜单,菜单展示按用户要求管理。页面导航只使用服务端返回并核验的路径,禁止把占位符发布成正式入口。
|
|
20
|
+
- 浏览器验证使用 Codex 内置浏览器;比较旧页面时使用同一 Dataset、同一记录和数据状态。新页面不能依赖旧 Workflow 或 Page Schema。
|
|
21
|
+
|
|
22
|
+
执行时阅读 [生成与验收流程](references/generation.md),完成数据绑定、四页目录构建、页面创建与路径回填、浏览器验收及发布。Development Sandbox 消费此 Skill;Runtime Sandbox 不安装它。
|
|
23
|
+
|
|
24
|
+
## 按页面读取模板
|
|
25
|
+
|
|
26
|
+
模板位于 `templates/onepage`。生成或修改哪一页,先阅读该页 README 及效果图,再读取源码;构建时整体复制模板,保留 `shared/`。
|
|
27
|
+
|
|
28
|
+
| 页面 | 说明与效果图 | 入口 |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| 列表 | [list/README.md](templates/onepage/list/README.md) | `list/index.jsx` |
|
|
31
|
+
| 详情 | [detail/README.md](templates/onepage/detail/README.md) | `detail/index.jsx` |
|
|
32
|
+
| 新增 | [create/README.md](templates/onepage/create/README.md) | `create/index.jsx` |
|
|
33
|
+
| 更新 | [update/README.md](templates/onepage/update/README.md) | `update/index.jsx` |
|
|
34
|
+
|
|
35
|
+
`shared/model.js` 维护数据绑定、查询与格式化,`shared/record-layout.jsx` 维护字段分组,`shared/editor.jsx` 是新增/更新共用表单,`shared/responsive.jsx` 提供响应式控件,`shared/page.css` 保持四页样式一致。`build.mjs` 将这些源码打包成四个独立页面目录,页面输出不包含 README 或效果图。
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# 组件与效果基线
|
|
2
|
+
|
|
3
|
+
用同一个 Dataset 的旧标准 CRUD 页面作为视觉和交互参考,覆盖真实空数据、有数据、无匹配结果和多页记录。只有用户要求建立对照时,才用旧流程生成基线;新页面始终只使用 CustomJSX。
|
|
4
|
+
|
|
5
|
+
| 页面能力 | 使用方式 |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| 智能搜索与结构化筛选 | 复用原 LrSmartFilter / 智能搜索组合的独立 JSX 实现。保留模式切换、类型化控件、加载状态、查询、重置和过期请求处理。 |
|
|
8
|
+
| 表格、工具栏、勾选、分页、列设置 | 使用 AntD,按旧页面还原密度、位置和操作反馈;分页使用服务端总数。 |
|
|
9
|
+
| 详情、新增、更新 | 使用 AntD Form 和普通 React 分组布局;保留字段顺序、说明、必填、枚举标签、只读值、校验、重置及提交反馈。 |
|
|
10
|
+
| 移动端 | 列表使用卡片,表单使用合适的日期控件和可点击按钮;ONEPAGE 手机容器由宿主提供,不能只通过缩小子页修复宿主分栏。 |
|
|
11
|
+
|
|
12
|
+
不迁移 YtRglContainer,也不为还原页面而引入旧 YtTable、旧表单渲染器、`_context`、`dataSourceMap` 或 Schema 动作引擎。页面拥有 SDK 请求、导航和保存返回逻辑;智能筛选组件通过 props 与回调交互。
|
|
13
|
+
|
|
14
|
+
组件真源:[原组件仓](https://codeup.aliyun.com/yuntoo/fe/materials)、[公共 JSX 组件仓](https://codeup.aliyun.com/yuntoo/open/lovrabet-components)。读取实际组件版本的 JSX 导出、props 和 CSS;源码中有组件不代表已发布 npm 包或宿主已提供它。
|
|
15
|
+
|
|
16
|
+
模板中的 `@lovrabet/components/smart-filter` 是页面打包别名。构建时显式传入已核验的组件 JSX 入口和 CSS:可以来自组件包,也可以来自指定版本的组件源码。模板会把它们打入页面,不要求修改宿主入口、依赖锁文件或 sub-app-vite-demo。React、AntD、图标、dayjs 和 `@/context/app-context` 由当前 CustomJSX 宿主提供;先验证实际运行环境。
|
|
17
|
+
|
|
18
|
+
SDK/context 契约见 [CustomJSX 生成标准](../../rabetbase/knowledge/custom-page/generation-standards.md)。保持主题、语言和请求地址跟随宿主;禁止在模板里写入 Cookie、AccessKey 或生产地址兜底。
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# 生成、浏览器迭代与发布
|
|
2
|
+
|
|
3
|
+
## 安装独立 Skill
|
|
4
|
+
|
|
5
|
+
CLI 包内包含 `skills/rabetbase-page-generation`。使用现有 Skill 安装工具从已安装 CLI 包目录安装:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npx skills add /path/to/rabetbase-cli/skills/rabetbase-page-generation -g -y
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
将路径替换为当前 CLI 包的真实位置,安装后确认 Agent 可发现 `rabetbase-page-generation`。CLI 既有 postinstall 安装的是 `rabetbase` Skill;此独立 Skill 的安装由使用方显式执行。
|
|
12
|
+
|
|
13
|
+
## 绑定真实 Dataset
|
|
14
|
+
|
|
15
|
+
1. 用 `rabetbase dataset detail --code <datasetCode> --format compress` 读取字段、类型、必填、枚举和操作。用 `rabetbase codegen sdk` 核验 SDK 签名;不要从原始接口元信息猜测请求或响应。
|
|
16
|
+
2. 将 `templates/onepage` 整体复制到页面工作目录。先阅读对应页面目录的 `README.md` 和 `preview.png`,明确布局与交互;`shared/` 保存四页共用代码,复制时一起保留。它是供 Agent 改写的 JSX 模板,不是配置解释器:客户字段展示了分组、数字、枚举、日期、智能筛选和表单的完整写法。按真实 Dataset 改写 `shared/model.js` 的字段与查询、`shared/record-layout.jsx` 的分组说明、`list/index.jsx` 的筛选/标题/手机主字段、`shared/editor.jsx` 的控件/校验/写入字段及 `detail/index.jsx` 的标题/主键读取。不能只替换 Dataset code 就直接发布给其他业务。
|
|
17
|
+
3. 替换 `shared/model.js` 中 `__APP_CODE__`、`__DATASET_CODE__`;创建前将尚无真实路径的 `__LIST_PATH__`、`__DETAIL_PATH__`、`__CREATE_PATH__`、`__UPDATE_PATH__` 设为空字符串,创建后回填服务端真实路径。四页使用相同绑定。示例以数字 `id` 为主键;其他类型需要同时改写校验、记录导航和 SDK 参数。
|
|
18
|
+
4. 页面使用宿主 `useSdkClient()`:已核验的 Dataset 模型提供 `filter({where,currentPage,pageSize,orderBy})`、`getOne(id)`、`create(fields)`、`update(id,fields)`。列表读取 `tableData` 和 `paging.totalCount`;若实际 SDK 不同,按真实契约改写。只在已确认需要连接、聚合或业务规则时改用 Custom SQL / Backend Function。
|
|
19
|
+
|
|
20
|
+
保持零值、枚举、空日期和主键类型正确;数字不加千分位,金额精度按字段定义。列表、详情和表单均区分加载、空数据、错误与重试。分页只使用已提交的筛选;搜索、重置和切换页大小回第一页,忽略过期响应。
|
|
21
|
+
|
|
22
|
+
## 构建四个独立目录
|
|
23
|
+
|
|
24
|
+
在页面工作目录安装页面构建工具 `esbuild`,准备已核验版本的智能搜索 JSX 入口及 CSS;不要求 CLI 安装这些页面开发依赖。`build.mjs` 只打包当前目录的四页源码,不读取 Dataset、不选模板、不创建平台资源。
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm install --save-dev esbuild
|
|
28
|
+
node build.mjs ./pages-v1 /path/to/smart-filter/index.tsx /path/to/smart-filter/style.css
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
输出目录必须尚不存在,避免旧文件混入更新。结果为 `pages-v1/list`、`detail`、`create`、`update`;每页包含完整的 `src/app/index.jsx`、`page.js`、`page.css`,没有跨页源码依赖。四页共享相同 CSS 内容,避免打开子页时宿主更新资源导致父列表丢失样式。页面文案默认中文,按应用语言调整源码;需要多语言时使用宿主 `useI18n` 和页面自己的语言资源。
|
|
32
|
+
|
|
33
|
+
构建脚本解析当前页面项目安装的 esbuild。若使用 npm 包形式的智能搜索入口,先检查实际 exports 并解析出具体文件路径;不要假设某版本存在 `smart-filter` 子入口。缺失组件或 CSS 时先解决依赖,不改成简易输入框宣称效果一致。
|
|
34
|
+
|
|
35
|
+
## 创建、回填与更新
|
|
36
|
+
|
|
37
|
+
对四页分别执行已有命令,下面以列表为例:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
rabetbase page create --name "<页面名称>" --page-dir ./pages-v1/list --appcode <appCode> --dry-run --format compress
|
|
41
|
+
rabetbase page create --name "<页面名称>" --page-dir ./pages-v1/list --appcode <appCode> --format compress
|
|
42
|
+
rabetbase page custom-detail --id <pageId> --appcode <appCode> --format compress
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
复用 `page create` 的默认建菜单行为,需要父菜单时使用已有 `--parent-menu-id`。菜单展示通过既有 `rabetbase menu` 命令管理,先查看 `menu list` 和 `menu visibility-update --help` 并按要求预演,再执行授权的调整。隐藏菜单保留路由和资源,不等同于不创建菜单;不得删除页面绑定菜单来模拟隐藏。当前任务若允许四页菜单,按该策略验收;不要声称只有入口绑定菜单。菜单状态只根据真实返回和回查结果判断。
|
|
46
|
+
|
|
47
|
+
记录四页 `pageId` 与真实路径,回填 `shared/model.js`,重新构建到新的输出目录。先回读远端当前 `codeContent`,再更新;`--page-dir` 是整目录替换,目录必须完整:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
rabetbase page custom-update --id <pageId> --appcode <appCode> --page-dir ./pages-v2/list --format compress
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
ONEPAGE 子页读取 `onePageInfo.innerSearchParams.id`,直接访问时读取 `useLocation().search`。缺少或无效主键时不发数据请求。列表通过 `navigate(pathWithQuery, {onePage:true})` 打开子页;详情的上一条/下一条和详情切编辑使用当前面板替换,避免不断增加层级。更新保存后回原详情或父列表;直接访问返回真实入口。SDK 保存成功才发送按列表路径区分的刷新事件,父列表保留筛选和分页并重新读取数据;取消不写入数据、不发送刷新。
|
|
54
|
+
|
|
55
|
+
## 本地与浏览器验收
|
|
56
|
+
|
|
57
|
+
在非沙箱页面工作目录预览迭代;临时预览夹具、模拟数据和运行回执放任务验收目录,不加入 CLI 源码;页面目录中的 `preview.png` 是随 Skill 分发的效果参考。浏览器使用 Codex 内置浏览器。
|
|
58
|
+
|
|
59
|
+
- 同 Dataset 对比旧标准页的字段、分组、智能搜索、表单密度与操作位置;覆盖空数据、有数据、无匹配结果和超过一页的数据。
|
|
60
|
+
- 查询、重置、翻页、页大小、勾选和列设置;自然语言查询必须读取真实结果,失败不冒充空结果。
|
|
61
|
+
- 列表打开详情/新增/更新,主键正确;详情上一条/下一条和编辑仍在当前 ONEPAGE 面板。
|
|
62
|
+
- 必填错误、零值、枚举和日期;保存、重置、取消、保存后返回刷新;连续新增清空表单并聚焦首字段,快捷键不重复提交。
|
|
63
|
+
- 桌面及手机窄屏,列表和子页无溢出,底部按钮可访问;父列表保持筛选/分页。实际设备软键盘、深色主题等未覆盖项需明确记录。
|
|
64
|
+
- 仅操作授权的测试数据,写入前保留原值,验收后还原修改并清理本轮测试记录。旧页面只用于对比,不作为新流程的运行依赖。
|
|
65
|
+
|
|
66
|
+
本地模拟不能证明真实 SDK、权限或 ONEPAGE 宿主正确。用四页预览验证真实数据流后再发布;若正式态暴露问题,修复后重新验收。
|
|
67
|
+
|
|
68
|
+
## 发布与结果回查
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
rabetbase page custom-publish --id <pageId> --appcode <appCode> --remark "页面验收通过" --format compress
|
|
72
|
+
rabetbase page custom-detail --id <pageId> --appcode <appCode> --format compress
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
四页分别检查发布状态 `FORMAL`、源码及版本,使用返回的运行 URL 打开正式态复验;报告实际菜单绑定情况。保留与最终提交/版本对应的复现步骤和结果,作为 MR 附件或外部验收材料;不把旧回执当成新版本证据。
|
|
76
|
+
|
|
77
|
+
CLI beta 发布遵循 CLI 发布流程;页面验收不等于 npm 发布成功。Development Sandbox 中安装 CLI beta 及独立 Skill 后,验证 Agent 可发现该 Skill,并完整执行四页生成和浏览器 E2E;Runtime Sandbox 不安装该 Skill。
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { mkdir, stat, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
// 页面项目自行安装构建依赖;此脚本不参与 CLI 命令或宿主构建。
|
|
7
|
+
const require = createRequire(path.resolve("package.json"));
|
|
8
|
+
const { build } = require("esbuild");
|
|
9
|
+
const root = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const [output, componentEntry, componentCss] = process.argv.slice(2);
|
|
11
|
+
if (!output || !componentEntry || !componentCss)
|
|
12
|
+
throw Error(
|
|
13
|
+
"Usage: node build.mjs <output directory> <smart-filter JSX entry> <smart-filter CSS>",
|
|
14
|
+
);
|
|
15
|
+
const entry = path.resolve(componentEntry);
|
|
16
|
+
const css = path.resolve(componentCss);
|
|
17
|
+
for (const file of [entry, css]) {
|
|
18
|
+
if (!(await stat(file)).isFile()) throw Error(`Not a file: ${file}`);
|
|
19
|
+
}
|
|
20
|
+
// 输出必须是新目录,避免旧文件进入 custom-update 的完整替换范围。
|
|
21
|
+
const destination = path.resolve(output);
|
|
22
|
+
const external = [
|
|
23
|
+
"react",
|
|
24
|
+
"react/jsx-runtime",
|
|
25
|
+
"antd",
|
|
26
|
+
"@ant-design/icons",
|
|
27
|
+
"dayjs",
|
|
28
|
+
"@/context/app-context",
|
|
29
|
+
];
|
|
30
|
+
const outputs = [];
|
|
31
|
+
for (const kind of ["list", "detail", "create", "update"]) {
|
|
32
|
+
const result = await build({
|
|
33
|
+
stdin: {
|
|
34
|
+
contents: `import ${JSON.stringify(css)};\nexport { default } from "./${kind}/index.jsx";`,
|
|
35
|
+
resolveDir: root,
|
|
36
|
+
sourcefile: "page-entry.jsx",
|
|
37
|
+
loader: "jsx",
|
|
38
|
+
},
|
|
39
|
+
bundle: true,
|
|
40
|
+
format: "esm",
|
|
41
|
+
platform: "browser",
|
|
42
|
+
jsx: "automatic",
|
|
43
|
+
outfile: path.join(destination, kind, "src/app/page.js"),
|
|
44
|
+
write: false,
|
|
45
|
+
external,
|
|
46
|
+
alias: { "@lovrabet/components/smart-filter": entry },
|
|
47
|
+
});
|
|
48
|
+
outputs.push(...result.outputFiles);
|
|
49
|
+
}
|
|
50
|
+
// 四页都引入相同的筛选 CSS 和页面 CSS,避免宿主资源替换破坏父列表。
|
|
51
|
+
await mkdir(path.dirname(destination), { recursive: true });
|
|
52
|
+
await mkdir(destination);
|
|
53
|
+
for (const file of outputs) {
|
|
54
|
+
await mkdir(path.dirname(file.path), { recursive: true });
|
|
55
|
+
await writeFile(file.path, file.contents);
|
|
56
|
+
}
|
|
57
|
+
for (const kind of ["list", "detail", "create", "update"]) {
|
|
58
|
+
await writeFile(
|
|
59
|
+
path.join(destination, kind, "src/app/index.jsx"),
|
|
60
|
+
'import "./page.css";\nexport { default } from "./page.js";\n',
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
console.log(`Built four CustomJSX page directories in ${destination}`);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 新增页
|
|
2
|
+
|
|
3
|
+
入口是 `index.jsx`,以 `mode="create"` 使用 `../shared/editor.jsx`。新增与更新共享控件及校验,分别构建成独立 CustomJSX 页面。
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
图中为本模板空表单的桌面效果,供字段分组与操作位置参考;外层“关闭子页”是本地预览容器,真实运行使用 ONEPAGE 宿主。
|
|
8
|
+
|
|
9
|
+
## 保留的交互
|
|
10
|
+
|
|
11
|
+
- 按 Dataset 分组展示字段、说明、必填提示;隐藏自动生成的主键。
|
|
12
|
+
- 顶部和底部都可保存,支持 Ctrl/⌘+Enter;必填校验失败时定位字段,提交中阻止重复保存。
|
|
13
|
+
- “保存并返回”关闭子页并刷新列表;“保存并继续新增”保留新增页,清空表单并聚焦首字段。
|
|
14
|
+
- 保存失败保留输入,重置恢复初始表单;手机日期使用适合触控的输入方式。
|
|
15
|
+
|
|
16
|
+
## 生成时修改
|
|
17
|
+
|
|
18
|
+
在 `shared/editor.jsx` 中按真实字段调整控件、校验、默认值与写入白名单,在 `shared/record-layout.jsx` 调整分组、说明和必填。需要同步首字段聚焦引用。不要把主键或只读字段提交给创建接口。
|
|
19
|
+
|
|
20
|
+
零值、枚举及空日期必须正确转换。只有 SDK 创建成功才通知列表刷新;取消不创建记录。完整构建及发布见 [生成流程](../../../references/generation.md)。
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 详情页
|
|
2
|
+
|
|
3
|
+
入口是 `index.jsx`,是独立的只读页面。通过 `shared/record-layout.jsx` 与表单保持字段分组一致,不使用抽屉。
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
图中为本模板使用本地示例数据的桌面效果,供布局与组件参考;外层“关闭子页”是本地预览容器,真实运行使用 ONEPAGE 宿主。
|
|
8
|
+
|
|
9
|
+
## 保留的交互
|
|
10
|
+
|
|
11
|
+
- 顶部显示记录名称和可复制的主键;提供编辑、当前列表页内上一条/下一条,首尾按钮禁用。
|
|
12
|
+
- 按分组显示标签、说明和只读值;枚举显示标签,空值显示 `--`,数字不加千分位。
|
|
13
|
+
- 编辑替换当前 ONEPAGE 面板,保存后回到更新后的详情;关闭返回原列表。
|
|
14
|
+
- 重新读取真实 SDK 记录,区分加载失败、记录不存在与正常数据。
|
|
15
|
+
|
|
16
|
+
## 生成时修改
|
|
17
|
+
|
|
18
|
+
根据 Dataset 修改标题字段、主键校验、SDK 模型和分组。ONEPAGE 优先读取 `onePageInfo.innerSearchParams.id`,直接访问再读 URL 查询参数。缺失或无效主键时不发请求。
|
|
19
|
+
|
|
20
|
+
详情与更新应保持不同的页面 ID/路径,不能用一个页面切换只读状态替代两页。完整构建及发布见 [生成流程](../../../references/generation.md)。
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Alert,
|
|
4
|
+
Button,
|
|
5
|
+
ConfigProvider,
|
|
6
|
+
Form,
|
|
7
|
+
Empty,
|
|
8
|
+
Spin,
|
|
9
|
+
Space,
|
|
10
|
+
Typography,
|
|
11
|
+
theme,
|
|
12
|
+
} from "antd";
|
|
13
|
+
import {
|
|
14
|
+
useAppContext,
|
|
15
|
+
useAppTheme,
|
|
16
|
+
useLocation,
|
|
17
|
+
useNavigate,
|
|
18
|
+
useSdkClient,
|
|
19
|
+
} from "@/context/app-context";
|
|
20
|
+
import { DATASET_CODE, LIST_PATH, childPaths, formatField } from "../shared/model";
|
|
21
|
+
import { RecordGroups, RecordItem, recordTheme } from "../shared/record-layout";
|
|
22
|
+
import "../shared/page.css";
|
|
23
|
+
|
|
24
|
+
function CustomerDetail() {
|
|
25
|
+
const client = useSdkClient();
|
|
26
|
+
const { onePageInfo } = useAppContext();
|
|
27
|
+
const location = useLocation();
|
|
28
|
+
const navigate = useNavigate();
|
|
29
|
+
const rawId =
|
|
30
|
+
onePageInfo?.innerSearchParams?.id ??
|
|
31
|
+
new URLSearchParams(location.search).get("id");
|
|
32
|
+
const recordId = rawId == null ? "" : String(rawId).trim();
|
|
33
|
+
const [state, setState] = useState({
|
|
34
|
+
loading: true,
|
|
35
|
+
record: null,
|
|
36
|
+
error: "",
|
|
37
|
+
});
|
|
38
|
+
const [retry, setRetry] = useState(0);
|
|
39
|
+
const params =
|
|
40
|
+
onePageInfo?.innerSearchParams ??
|
|
41
|
+
Object.fromEntries(new URLSearchParams(location.search));
|
|
42
|
+
const ids = [
|
|
43
|
+
...new Set(
|
|
44
|
+
String(params.ids || "")
|
|
45
|
+
.split(",")
|
|
46
|
+
.filter((id) => /^\d+$/.test(id)),
|
|
47
|
+
),
|
|
48
|
+
].slice(0, 100);
|
|
49
|
+
const position = ids.indexOf(recordId);
|
|
50
|
+
function moveRecord(index) {
|
|
51
|
+
navigate(
|
|
52
|
+
`${childPaths.detail}?${new URLSearchParams({ id: ids[index], ids: ids.join(",") })}`,
|
|
53
|
+
{ replace: true },
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const changed = (event) => {
|
|
58
|
+
if (event.detail === LIST_PATH) setRetry((value) => value + 1);
|
|
59
|
+
};
|
|
60
|
+
window.addEventListener("lovrabet:page-generation:changed", changed);
|
|
61
|
+
return () =>
|
|
62
|
+
window.removeEventListener("lovrabet:page-generation:changed", changed);
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
let active = true;
|
|
67
|
+
setState({ loading: true, record: null, error: "" });
|
|
68
|
+
(async () => {
|
|
69
|
+
try {
|
|
70
|
+
if (!/^\d+$/.test(recordId))
|
|
71
|
+
throw Error("缺少或无效的客户主键,请从列表重新打开详情");
|
|
72
|
+
const record =
|
|
73
|
+
await client.models[`dataset_${DATASET_CODE}`].getOne(recordId);
|
|
74
|
+
if (
|
|
75
|
+
record != null &&
|
|
76
|
+
(typeof record !== "object" || Array.isArray(record))
|
|
77
|
+
)
|
|
78
|
+
throw Error("详情响应无效,请重试");
|
|
79
|
+
if (active) setState({ loading: false, record, error: "" });
|
|
80
|
+
} catch (cause) {
|
|
81
|
+
if (active)
|
|
82
|
+
setState({
|
|
83
|
+
loading: false,
|
|
84
|
+
record: null,
|
|
85
|
+
error: cause.message || "加载失败,请重试",
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
})();
|
|
89
|
+
return () => {
|
|
90
|
+
active = false;
|
|
91
|
+
};
|
|
92
|
+
}, [client, recordId, retry]);
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<main className="customer-record customer-detail">
|
|
96
|
+
{!onePageInfo && (
|
|
97
|
+
<Button className="record-back" onClick={() => navigate(LIST_PATH)}>
|
|
98
|
+
返回列表
|
|
99
|
+
</Button>
|
|
100
|
+
)}
|
|
101
|
+
<header className="record-heading">
|
|
102
|
+
<div className="record-heading-title">
|
|
103
|
+
<h1>{state.record?.customer_name || "客户详情"}</h1>
|
|
104
|
+
<Typography.Text
|
|
105
|
+
type="secondary"
|
|
106
|
+
copyable={
|
|
107
|
+
recordId
|
|
108
|
+
? { text: recordId, tooltips: ["复制主键", "已复制"] }
|
|
109
|
+
: false
|
|
110
|
+
}
|
|
111
|
+
>
|
|
112
|
+
主键 {recordId || "—"}
|
|
113
|
+
</Typography.Text>
|
|
114
|
+
</div>
|
|
115
|
+
<Space wrap>
|
|
116
|
+
<Button
|
|
117
|
+
type="primary"
|
|
118
|
+
disabled={!state.record || state.loading}
|
|
119
|
+
onClick={() =>
|
|
120
|
+
navigate(
|
|
121
|
+
`${childPaths.update}?${new URLSearchParams({ id: recordId, returnDetail: "1", ids: ids.join(",") })}`,
|
|
122
|
+
{ replace: true },
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
>
|
|
126
|
+
编辑客户
|
|
127
|
+
</Button>
|
|
128
|
+
{position >= 0 && (
|
|
129
|
+
<span className="record-sequence" aria-label="当前页记录导航">
|
|
130
|
+
<Button
|
|
131
|
+
disabled={position === 0 || state.loading}
|
|
132
|
+
onClick={() => moveRecord(position - 1)}
|
|
133
|
+
>
|
|
134
|
+
上一条
|
|
135
|
+
</Button>
|
|
136
|
+
<span>
|
|
137
|
+
本页 {position + 1}/{ids.length}
|
|
138
|
+
</span>
|
|
139
|
+
<Button
|
|
140
|
+
disabled={position === ids.length - 1 || state.loading}
|
|
141
|
+
onClick={() => moveRecord(position + 1)}
|
|
142
|
+
>
|
|
143
|
+
下一条
|
|
144
|
+
</Button>
|
|
145
|
+
</span>
|
|
146
|
+
)}
|
|
147
|
+
</Space>
|
|
148
|
+
</header>
|
|
149
|
+
{state.loading ? (
|
|
150
|
+
<Spin aria-label="正在加载客户详情" />
|
|
151
|
+
) : state.error ? (
|
|
152
|
+
<Alert
|
|
153
|
+
type="error"
|
|
154
|
+
showIcon
|
|
155
|
+
message="详情加载失败"
|
|
156
|
+
description={state.error}
|
|
157
|
+
action={
|
|
158
|
+
<Button onClick={() => setRetry((value) => value + 1)}>重试</Button>
|
|
159
|
+
}
|
|
160
|
+
/>
|
|
161
|
+
) : state.record ? (
|
|
162
|
+
<Form layout="vertical" className="record-readonly" component="div">
|
|
163
|
+
<RecordGroups>
|
|
164
|
+
{(field) => (
|
|
165
|
+
<RecordItem key={field.key} field={field}>
|
|
166
|
+
<div className="record-value">
|
|
167
|
+
{formatField(state.record[field.key], field)}
|
|
168
|
+
</div>
|
|
169
|
+
</RecordItem>
|
|
170
|
+
)}
|
|
171
|
+
</RecordGroups>
|
|
172
|
+
</Form>
|
|
173
|
+
) : (
|
|
174
|
+
<Empty description="客户不存在或已被删除" />
|
|
175
|
+
)}
|
|
176
|
+
</main>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export default function DetailPage() {
|
|
181
|
+
const hostTheme = useAppTheme();
|
|
182
|
+
return (
|
|
183
|
+
<ConfigProvider
|
|
184
|
+
theme={recordTheme(
|
|
185
|
+
hostTheme,
|
|
186
|
+
hostTheme?.mode === "dark"
|
|
187
|
+
? theme.darkAlgorithm
|
|
188
|
+
: theme.defaultAlgorithm,
|
|
189
|
+
)}
|
|
190
|
+
>
|
|
191
|
+
<CustomerDetail />
|
|
192
|
+
</ConfigProvider>
|
|
193
|
+
);
|
|
194
|
+
}
|