@lovrabet/rabetbase-cli 2.5.3-beta.2 → 2.5.3-beta.4
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.d.ts +22 -0
- package/lib/api/api-group.js +1 -0
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.d.ts +18 -2
- 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.d.ts +11 -0
- package/lib/api/legacy-api-file.js +1 -0
- package/lib/api/model-registry-file.d.ts +36 -0
- package/lib/api/model-registry-file.js +1 -0
- package/lib/api/model-registry-scaffold.d.ts +7 -0
- package/lib/api/model-registry-scaffold.js +1 -0
- package/lib/api/model-source.d.ts +6 -0
- package/lib/api/model-source.js +1 -0
- 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/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.d.ts +7 -0
- 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.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-create.js +1 -0
- package/lib/commands/dataset/cross-relation-delete.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-delete.js +1 -0
- package/lib/commands/dataset/cross-relation-list.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-list.js +1 -0
- package/lib/commands/dataset/cross-relation-shared.d.ts +190 -0
- package/lib/commands/dataset/cross-relation-shared.js +1 -0
- package/lib/commands/dataset/cross-relation-update.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-update.js +1 -0
- 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/service.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/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.d.ts +28 -0
- package/lib/commands/project/api-architecture-upgrade.js +1 -0
- 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.d.ts +30 -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/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.d.ts +5 -3
- 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.d.ts +2 -0
- 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.d.ts +2 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.d.ts +13 -17
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +6 -0
- 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.d.ts +41 -0
- package/lib/core/cross-db-relation.js +1 -0
- 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.d.ts +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.d.ts +0 -10
- 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/types/index.d.ts +11 -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.d.ts +19 -0
- 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 +6 -1
- package/skills/rabetbase/SKILL.md +16 -10
- package/skills/rabetbase/guides/backend-function.md +5 -1
- package/skills/rabetbase/guides/bff-creation-workflow.md +3 -1
- package/skills/rabetbase/guides/cross-database-bff.md +70 -0
- package/skills/rabetbase/guides/data-api-guidelines.md +35 -33
- package/skills/rabetbase/guides/sdk-client-generation.md +112 -61
- package/skills/rabetbase/guides/sql-creation-workflow.md +2 -0
- package/skills/rabetbase/guides/typescript-sdk.md +9 -0
- package/skills/rabetbase/references/rabetbase-api-pull.md +30 -19
- package/skills/rabetbase/references/rabetbase-app-list.md +1 -1
- package/skills/rabetbase/references/rabetbase-config.md +2 -1
- package/skills/rabetbase/references/rabetbase-dataset-cross-relations.md +64 -0
- package/skills/rabetbase/references/rabetbase-project-create.md +3 -3
- package/skills/rabetbase/references/rabetbase-project-upgrade.md +24 -13
- package/skills/rabetbase.manifest.json +5 -3
- package/templates/README.md +46 -6
- package/templates/generate-api/model-runtime.ts.tpl +101 -0
- package/templates/generate-api/profile-api.ts.tpl +21 -0
- package/templates/generate-api/profile-client.ts.tpl +14 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { type CrossDbRelationDetail, type CrossDbRelationMutation, type CrossDbRelationQuery, type CrossDbRelationSource } from "../../core/cross-db-relation.js";
|
|
2
|
+
import type { RuntimeContext } from "../../framework/types.js";
|
|
3
|
+
type Operation = "create" | "update" | "delete";
|
|
4
|
+
interface Endpoint {
|
|
5
|
+
datasetCode: string;
|
|
6
|
+
dblinkId: number;
|
|
7
|
+
table: string;
|
|
8
|
+
}
|
|
9
|
+
interface Prepared {
|
|
10
|
+
operation: Operation;
|
|
11
|
+
query: CrossDbRelationQuery;
|
|
12
|
+
body: CrossDbRelationMutation | CrossDbRelationSource;
|
|
13
|
+
from: Endpoint;
|
|
14
|
+
to?: Endpoint;
|
|
15
|
+
before: CrossDbRelationDetail | null;
|
|
16
|
+
expectedLabel?: string;
|
|
17
|
+
expectedCardinality?: string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function validateCrossRelation(ctx: RuntimeContext, operation: Operation | "list"): void;
|
|
20
|
+
export declare function resolveCrossRelationQuery(ctx: RuntimeContext): Promise<CrossDbRelationQuery>;
|
|
21
|
+
export declare function projectCrossRelation(row: CrossDbRelationDetail): {
|
|
22
|
+
relationId: string | number;
|
|
23
|
+
from: {
|
|
24
|
+
source: string;
|
|
25
|
+
datasetCode: string | null;
|
|
26
|
+
datasetName: string | null;
|
|
27
|
+
dblinkId: number;
|
|
28
|
+
table: string;
|
|
29
|
+
field: string;
|
|
30
|
+
};
|
|
31
|
+
to: {
|
|
32
|
+
source: string;
|
|
33
|
+
datasetCode: string | null;
|
|
34
|
+
datasetName: string | null;
|
|
35
|
+
dblinkId: number;
|
|
36
|
+
table: string;
|
|
37
|
+
field: string;
|
|
38
|
+
labelField: string;
|
|
39
|
+
};
|
|
40
|
+
relation: {
|
|
41
|
+
cardinality: import("../../core/api-client.js").ErRelationCardinality | null;
|
|
42
|
+
relationType: number;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export declare function prepareCrossRelation(ctx: RuntimeContext, operation: Operation): Promise<Prepared>;
|
|
46
|
+
export declare function previewCrossRelation(ctx: RuntimeContext, operation: Operation): Promise<{
|
|
47
|
+
after: {
|
|
48
|
+
from: {
|
|
49
|
+
datasetCode: string;
|
|
50
|
+
dblinkId: number;
|
|
51
|
+
table: string;
|
|
52
|
+
field: string;
|
|
53
|
+
};
|
|
54
|
+
to: {
|
|
55
|
+
datasetCode: string;
|
|
56
|
+
dblinkId: number;
|
|
57
|
+
table: string;
|
|
58
|
+
field: string;
|
|
59
|
+
labelField: string | undefined;
|
|
60
|
+
};
|
|
61
|
+
relation: {
|
|
62
|
+
cardinality: string | null | undefined;
|
|
63
|
+
relationType: number;
|
|
64
|
+
};
|
|
65
|
+
relationId?: string | number | undefined;
|
|
66
|
+
} | null;
|
|
67
|
+
method: string;
|
|
68
|
+
url: "/smartapi/cross-db-relation/create" | "/smartapi/cross-db-relation/update" | "/smartapi/cross-db-relation/delete";
|
|
69
|
+
body: CrossDbRelationSource | CrossDbRelationMutation;
|
|
70
|
+
description: string;
|
|
71
|
+
operation: Operation;
|
|
72
|
+
selector: {
|
|
73
|
+
appCode: string;
|
|
74
|
+
from: {
|
|
75
|
+
datasetCode: string;
|
|
76
|
+
field: string;
|
|
77
|
+
dblinkId: number;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
before: {
|
|
81
|
+
relationId: string | number;
|
|
82
|
+
from: {
|
|
83
|
+
source: string;
|
|
84
|
+
datasetCode: string | null;
|
|
85
|
+
datasetName: string | null;
|
|
86
|
+
dblinkId: number;
|
|
87
|
+
table: string;
|
|
88
|
+
field: string;
|
|
89
|
+
};
|
|
90
|
+
to: {
|
|
91
|
+
source: string;
|
|
92
|
+
datasetCode: string | null;
|
|
93
|
+
datasetName: string | null;
|
|
94
|
+
dblinkId: number;
|
|
95
|
+
table: string;
|
|
96
|
+
field: string;
|
|
97
|
+
labelField: string;
|
|
98
|
+
};
|
|
99
|
+
relation: {
|
|
100
|
+
cardinality: import("../../core/api-client.js").ErRelationCardinality | null;
|
|
101
|
+
relationType: number;
|
|
102
|
+
};
|
|
103
|
+
} | null;
|
|
104
|
+
dryRun: boolean;
|
|
105
|
+
backend: {
|
|
106
|
+
method: string;
|
|
107
|
+
path: "/smartapi/cross-db-relation/create" | "/smartapi/cross-db-relation/update" | "/smartapi/cross-db-relation/delete";
|
|
108
|
+
};
|
|
109
|
+
warnings: {
|
|
110
|
+
code: string;
|
|
111
|
+
message: string;
|
|
112
|
+
}[];
|
|
113
|
+
}>;
|
|
114
|
+
export declare function executeCrossRelation(ctx: RuntimeContext, operation: Operation, write: (body: CrossDbRelationMutation & CrossDbRelationSource) => Promise<true>): Promise<{
|
|
115
|
+
ok: boolean;
|
|
116
|
+
data: {
|
|
117
|
+
verification: {
|
|
118
|
+
status: string;
|
|
119
|
+
verified: boolean;
|
|
120
|
+
};
|
|
121
|
+
operation: Operation;
|
|
122
|
+
selector: {
|
|
123
|
+
appCode: string;
|
|
124
|
+
from: {
|
|
125
|
+
datasetCode: string;
|
|
126
|
+
field: string;
|
|
127
|
+
dblinkId: number;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
before: {
|
|
131
|
+
relationId: string | number;
|
|
132
|
+
from: {
|
|
133
|
+
source: string;
|
|
134
|
+
datasetCode: string | null;
|
|
135
|
+
datasetName: string | null;
|
|
136
|
+
dblinkId: number;
|
|
137
|
+
table: string;
|
|
138
|
+
field: string;
|
|
139
|
+
};
|
|
140
|
+
to: {
|
|
141
|
+
source: string;
|
|
142
|
+
datasetCode: string | null;
|
|
143
|
+
datasetName: string | null;
|
|
144
|
+
dblinkId: number;
|
|
145
|
+
table: string;
|
|
146
|
+
field: string;
|
|
147
|
+
labelField: string;
|
|
148
|
+
};
|
|
149
|
+
relation: {
|
|
150
|
+
cardinality: import("../../core/api-client.js").ErRelationCardinality | null;
|
|
151
|
+
relationType: number;
|
|
152
|
+
};
|
|
153
|
+
} | null;
|
|
154
|
+
after: {
|
|
155
|
+
relationId: string | number;
|
|
156
|
+
from: {
|
|
157
|
+
source: string;
|
|
158
|
+
datasetCode: string | null;
|
|
159
|
+
datasetName: string | null;
|
|
160
|
+
dblinkId: number;
|
|
161
|
+
table: string;
|
|
162
|
+
field: string;
|
|
163
|
+
};
|
|
164
|
+
to: {
|
|
165
|
+
source: string;
|
|
166
|
+
datasetCode: string | null;
|
|
167
|
+
datasetName: string | null;
|
|
168
|
+
dblinkId: number;
|
|
169
|
+
table: string;
|
|
170
|
+
field: string;
|
|
171
|
+
labelField: string;
|
|
172
|
+
};
|
|
173
|
+
relation: {
|
|
174
|
+
cardinality: import("../../core/api-client.js").ErRelationCardinality | null;
|
|
175
|
+
relationType: number;
|
|
176
|
+
};
|
|
177
|
+
} | null;
|
|
178
|
+
dryRun: boolean;
|
|
179
|
+
backend: {
|
|
180
|
+
method: string;
|
|
181
|
+
path: "/smartapi/cross-db-relation/create" | "/smartapi/cross-db-relation/update" | "/smartapi/cross-db-relation/delete";
|
|
182
|
+
};
|
|
183
|
+
warnings: {
|
|
184
|
+
code: string;
|
|
185
|
+
message: string;
|
|
186
|
+
}[];
|
|
187
|
+
};
|
|
188
|
+
message: string;
|
|
189
|
+
}>;
|
|
190
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a71_0xc34f38=a71_0x1814;function a71_0x1814(_0x19cdae,_0x3b1ca6){_0x19cdae=_0x19cdae-0xb5;const _0xc04b8c=a71_0xc04b();let _0x1814be=_0xc04b8c[_0x19cdae];return _0x1814be;}(function(_0x512ec0,_0xd07e17){const _0x1273f5=a71_0x1814,_0x569c60=_0x512ec0();while(!![]){try{const _0x1360af=parseInt(_0x1273f5(0xc0))/0x1+parseInt(_0x1273f5(0xfe))/0x2+parseInt(_0x1273f5(0x109))/0x3+parseInt(_0x1273f5(0xc3))/0x4*(parseInt(_0x1273f5(0xd9))/0x5)+-parseInt(_0x1273f5(0xbe))/0x6*(-parseInt(_0x1273f5(0xb8))/0x7)+parseInt(_0x1273f5(0xfb))/0x8*(parseInt(_0x1273f5(0xe8))/0x9)+-parseInt(_0x1273f5(0x105))/0xa;if(_0x1360af===_0xd07e17)break;else _0x569c60['push'](_0x569c60['shift']());}catch(_0x3c9cfc){_0x569c60['push'](_0x569c60['shift']());}}}(a71_0xc04b,0x4723e));import{getDatasetDetail,queryCrossDbRelations}from'../../core/api-client.js';import{CROSS_DB_RELATION_PATHS}from'../../core/cross-db-relation.js';import{CliError,CliErrors}from'../../errors.js';import{CROSS_RELATION_CARDINALITY_FLAG}from'../../commands/common/flags.js';function required(_0x4c8725,_0x1a5422){const _0x5551e2=a71_0x1814,_0x1a4e51=_0x4c8725[_0x5551e2(0xc4)](_0x1a5422)[_0x5551e2(0xc1)]();if(!_0x1a4e51)throw CliErrors['flagMissing'](_0x1a5422);return _0x1a4e51;}function explicitDblink(_0x18e357){const _0xcbc860=a71_0x1814,_0x4bb714=_0x18e357[_0xcbc860(0xb7)]('from-dblink-id');if(_0x4bb714===undefined||_0x4bb714===null)return undefined;const _0x56cb82=Number(_0x4bb714);if(!Number[_0xcbc860(0x107)](_0x56cb82)||_0x56cb82<=0x0)throw CliErrors['validation']('--from-dblink-id\x20must\x20be\x20a\x20positive\x20safe\x20integer.');return _0x56cb82;}export function validateCrossRelation(_0x5d58ac,_0x3acb11){const _0x2ea4b7=a71_0x1814,_0x42edc7=explicitDblink(_0x5d58ac);if(_0x3acb11==='list'){if(!_0x5d58ac[_0x2ea4b7(0xc4)](_0x2ea4b7(0xf3))[_0x2ea4b7(0xc1)]()&&_0x42edc7===undefined)throw CliErrors[_0x2ea4b7(0xc2)](_0x2ea4b7(0x10b));return;}required(_0x5d58ac,_0x2ea4b7(0xf3)),required(_0x5d58ac,_0x2ea4b7(0x10a));if(_0x3acb11!==_0x2ea4b7(0xf8)){required(_0x5d58ac,_0x2ea4b7(0xdc)),required(_0x5d58ac,'to-column');const _0x454ec2=_0x5d58ac[_0x2ea4b7(0xc4)](_0x2ea4b7(0xc7))['trim']();if(_0x454ec2&&!CROSS_RELATION_CARDINALITY_FLAG[_0x2ea4b7(0xf0)][_0x2ea4b7(0xe2)](_0x454ec2))throw CliErrors['validation'](_0x2ea4b7(0xcc));}}async function resolveEndpoint(_0x49eb3a){const _0x127f16=a71_0x1814,_0x52ab9f=await getDatasetDetail(_0x49eb3a),_0x598145=_0x52ab9f?.[_0x127f16(0xbc)]??{};if((_0x52ab9f?.[_0x127f16(0xbd)]??_0x598145[_0x127f16(0xff)])!=='DB_TABLE')throw CliErrors[_0x127f16(0xc2)](_0x127f16(0xce)+_0x49eb3a+_0x127f16(0xd1));const _0x3c35fe=_0x52ab9f[_0x127f16(0xbf)]??_0x52ab9f[_0x127f16(0xf4)]??{};let _0x24b027=_0x52ab9f[_0x127f16(0xfc)]??_0x598145[_0x127f16(0xfc)]??{};if(typeof _0x24b027==='string')try{_0x24b027=_0x24b027[_0x127f16(0xc1)]()?JSON[_0x127f16(0xba)](_0x24b027):{};}catch{throw CliErrors[_0x127f16(0xc2)](_0x127f16(0xce)+_0x49eb3a+_0x127f16(0xb6));}const _0x29e390=Number(_0x24b027?.['storageProfile']?.['dbId']??_0x52ab9f[_0x127f16(0xe0)]?.[_0x127f16(0xc6)]??_0x598145[_0x127f16(0xe0)]?.[_0x127f16(0xc6)]??_0x3c35fe[_0x127f16(0xc6)]??_0x598145['dbId']??_0x52ab9f[_0x127f16(0xc6)]),_0x798fef=String(_0x52ab9f['tableName']??_0x598145[_0x127f16(0xfa)]??_0x3c35fe[_0x127f16(0xfa)]??'')[_0x127f16(0xc1)]();if(!Number['isSafeInteger'](_0x29e390)||_0x29e390<=0x0||!_0x798fef)throw CliErrors['validation'](_0x127f16(0xce)+_0x49eb3a+_0x127f16(0xeb));return{'datasetCode':_0x49eb3a,'dblinkId':_0x29e390,'table':_0x798fef};}export async function resolveCrossRelationQuery(_0x4be0ce){const _0x27c976=a71_0x1814,_0x4249f2=_0x4be0ce[_0x27c976(0xc4)](_0x27c976(0xf3))[_0x27c976(0xc1)](),_0x29506a=explicitDblink(_0x4be0ce),_0x585c97=_0x4249f2?await resolveEndpoint(_0x4249f2):undefined;if(_0x585c97&&_0x29506a!==undefined&&_0x585c97['dblinkId']!==_0x29506a)throw CliErrors[_0x27c976(0xc2)]('--from-dblink-id\x20does\x20not\x20match\x20the\x20source\x20dataset\x20connection.');const _0x4ee5d5=_0x585c97?.[_0x27c976(0x101)]??_0x29506a;if(_0x4ee5d5===undefined)throw CliErrors[_0x27c976(0xc2)](_0x27c976(0x10b));return{'appCode':_0x4be0ce[_0x27c976(0xb9)],'fromDblinkId':_0x4ee5d5,..._0x4249f2?{'fromDatasetCode':_0x4249f2}:{},..._0x4be0ce[_0x27c976(0xc4)](_0x27c976(0x10a))[_0x27c976(0xc1)]()?{'fromField':_0x4be0ce['str'](_0x27c976(0x10a))['trim']()}:{}};}export function projectCrossRelation(_0x59d7f4){const _0x59cb76=a71_0x1814;return{'relationId':_0x59d7f4['relationId'],'from':{'source':_0x59cb76(0xc5),'datasetCode':_0x59d7f4[_0x59cb76(0xef)],'datasetName':_0x59d7f4[_0x59cb76(0xf2)],'dblinkId':_0x59d7f4[_0x59cb76(0xd6)],'table':_0x59d7f4['fromTableName'],'field':_0x59d7f4[_0x59cb76(0xf7)]},'to':{'source':_0x59cb76(0xc5),'datasetCode':_0x59d7f4['toDatasetCode'],'datasetName':_0x59d7f4[_0x59cb76(0xd2)],'dblinkId':_0x59d7f4[_0x59cb76(0x106)],'table':_0x59d7f4[_0x59cb76(0x10c)],'field':_0x59d7f4[_0x59cb76(0xe5)],'labelField':_0x59d7f4['refTableLabelName']},'relation':{'cardinality':_0x59d7f4[_0x59cb76(0xc7)],'relationType':_0x59d7f4[_0x59cb76(0x108)]}};}function ambiguity(_0x5579c7){const _0x322c26=a71_0x1814,_0x2abfbd=CliErrors[_0x322c26(0xc2)](_0x322c26(0xe7),_0x322c26(0xdd));return Object[_0x322c26(0xd3)](_0x2abfbd,'data',{'value':{'candidates':_0x5579c7[_0x322c26(0x10d)](projectCrossRelation)}}),_0x2abfbd;}const sameName=(_0x27cd4d,_0x5f50b8)=>_0x27cd4d[a71_0xc34f38(0xe9)]()===_0x5f50b8['toLowerCase']();function matchesEndpoint(_0x11beb7,_0x45feee,_0x456b35,_0x17e6ff,_0x40a0d1){const _0x57e06e=a71_0xc34f38;return _0x11beb7['fromDblinkId']===_0x45feee[_0x57e06e(0x101)]&&sameName(_0x11beb7[_0x57e06e(0xcf)],_0x45feee['table'])&&sameName(_0x11beb7[_0x57e06e(0xf7)],_0x456b35)&&_0x11beb7[_0x57e06e(0x106)]===_0x17e6ff[_0x57e06e(0x101)]&&sameName(_0x11beb7[_0x57e06e(0x10c)],_0x17e6ff['table'])&&sameName(_0x11beb7['toField'],_0x40a0d1);}export async function prepareCrossRelation(_0x416fd8,_0x77e646){const _0x1031d5=a71_0xc34f38,_0x31452a=await resolveEndpoint(required(_0x416fd8,_0x1031d5(0xf3))),_0x27cfdd=explicitDblink(_0x416fd8);if(_0x27cfdd!==undefined&&_0x31452a[_0x1031d5(0x101)]!==_0x27cfdd)throw CliErrors[_0x1031d5(0xc2)](_0x1031d5(0xca));const _0x10d2d7={'appCode':_0x416fd8[_0x1031d5(0xb9)],'fromDatasetCode':_0x31452a[_0x1031d5(0xec)],'fromField':required(_0x416fd8,_0x1031d5(0x10a)),..._0x27cfdd!==undefined?{'fromDblinkId':_0x27cfdd}:{}},_0x461d74={'appCode':_0x416fd8[_0x1031d5(0xb9)],'fromDblinkId':_0x31452a[_0x1031d5(0x101)],'fromDatasetCode':_0x31452a[_0x1031d5(0xec)],'fromField':_0x10d2d7['fromField']},_0x344a72=await queryCrossDbRelations(_0x461d74);let _0x103510=null;if(_0x77e646!==_0x1031d5(0xda)){if(_0x344a72[_0x1031d5(0xd0)]>0x1)throw ambiguity(_0x344a72);_0x103510=_0x344a72[0x0]??null;if(!_0x103510)throw CliErrors[_0x1031d5(0xc2)](_0x1031d5(0xcb));}if(_0x77e646===_0x1031d5(0xf8))return{'operation':_0x77e646,'from':_0x31452a,'query':_0x461d74,'body':_0x10d2d7,'before':_0x103510};const _0x402b2a=await resolveEndpoint(required(_0x416fd8,_0x1031d5(0xdc)));if(_0x31452a[_0x1031d5(0x101)]===_0x402b2a[_0x1031d5(0x101)])throw CliErrors['validation'](_0x1031d5(0xf6));const _0x3dc914=_0x416fd8[_0x1031d5(0xc4)]('to-label-column')['trim'](),_0x16a226=_0x416fd8[_0x1031d5(0xc4)](_0x1031d5(0xc7))['trim'](),_0x42e77a={..._0x10d2d7,'toDatasetCode':_0x402b2a[_0x1031d5(0xec)],'toField':required(_0x416fd8,_0x1031d5(0xe6)),..._0x3dc914?{'refTableLabelName':_0x3dc914}:{},..._0x16a226?{'cardinality':_0x16a226}:{}};if(_0x344a72[_0x1031d5(0xd5)](_0x57bdd4=>_0x57bdd4['relationId']!==_0x103510?.['relationId']&&matchesEndpoint(_0x57bdd4,_0x31452a,_0x42e77a[_0x1031d5(0xf7)],_0x402b2a,_0x42e77a[_0x1031d5(0xe5)])))throw CliErrors['validation'](_0x1031d5(0x103));return{'operation':_0x77e646,'from':_0x31452a,'to':_0x402b2a,'query':_0x461d74,'body':_0x42e77a,'before':_0x103510,'expectedLabel':_0x3dc914||_0x103510?.['refTableLabelName']||_0x42e77a['toField'],'expectedCardinality':_0x16a226||_0x103510?.[_0x1031d5(0xc7)]||null};}function mutationData(_0x9c0da0,_0x4498d9,_0x1cf659){const _0x5c5171=a71_0xc34f38,{operation:_0x4c6932,body:_0x263cfb,before:_0x526488}=_0x9c0da0;return{'operation':_0x4c6932,'selector':{'appCode':_0x263cfb[_0x5c5171(0xb9)],'from':{'datasetCode':_0x263cfb[_0x5c5171(0xef)],'field':_0x263cfb[_0x5c5171(0xf7)],'dblinkId':_0x9c0da0['from']['dblinkId']}},'before':_0x526488?projectCrossRelation(_0x526488):null,'after':_0x1cf659,'dryRun':_0x4498d9,'backend':{'method':'POST','path':CROSS_DB_RELATION_PATHS[_0x4c6932]},'warnings':_0x4c6932==='update'&&!_0x263cfb[_0x5c5171(0xea)]?[{'code':_0x5c5171(0xee),'message':_0x5c5171(0xb5)}]:[]};}export async function previewCrossRelation(_0x1829bd,_0x517810){const _0x59460c=a71_0xc34f38,_0x236811=await prepareCrossRelation(_0x1829bd,_0x517810),_0x5637ba=_0x236811[_0x59460c(0x104)],_0x43393c=_0x517810==='delete'?null:{..._0x236811[_0x59460c(0xd4)]?{'relationId':_0x236811['before']['relationId']}:{},'from':{'datasetCode':_0x236811['from'][_0x59460c(0xec)],'dblinkId':_0x236811[_0x59460c(0xe3)][_0x59460c(0x101)],'table':_0x236811[_0x59460c(0xe3)][_0x59460c(0xf9)],'field':_0x5637ba['fromField']},'to':{'datasetCode':_0x236811['to'][_0x59460c(0xec)],'dblinkId':_0x236811['to'][_0x59460c(0x101)],'table':_0x236811['to'][_0x59460c(0xf9)],'field':_0x5637ba['toField'],'labelField':_0x236811[_0x59460c(0xfd)]},'relation':{'cardinality':_0x236811[_0x59460c(0xbb)],'relationType':0x2}};return{...mutationData(_0x236811,!![],null),'after':_0x43393c,'method':_0x59460c(0xd8),'url':CROSS_DB_RELATION_PATHS[_0x517810],'body':_0x236811['body'],'description':_0x59460c(0xf5)+_0x517810+_0x59460c(0xc9)+_0x5637ba[_0x59460c(0xef)]+'.'+_0x5637ba[_0x59460c(0xf7)]};}export async function executeCrossRelation(_0x2f8a58,_0x5d9859,_0x3415ff){const _0x2759fe=a71_0xc34f38,_0x43ae51=await prepareCrossRelation(_0x2f8a58,_0x5d9859);try{await _0x3415ff(_0x43ae51[_0x2759fe(0x104)]);}catch(_0x166fed){if(_0x166fed instanceof CliError&&_0x166fed[_0x2759fe(0xf1)]['includes'](_0x2759fe(0xd7))){const _0xcc855f=await queryCrossDbRelations(_0x43ae51[_0x2759fe(0xcd)])['catch'](()=>[]);throw ambiguity(_0xcc855f);}throw _0x166fed;}let _0x20811f=[],_0x1e41c7,_0x3de4ff=![];try{_0x20811f=await queryCrossDbRelations(_0x43ae51[_0x2759fe(0xcd)]);if(_0x5d9859===_0x2759fe(0xf8))_0x3de4ff=!_0x20811f['some'](_0x10e0ff=>_0x10e0ff[_0x2759fe(0xe4)]===_0x43ae51[_0x2759fe(0xd4)][_0x2759fe(0xe4)]);else{const _0x43270d=_0x43ae51[_0x2759fe(0x104)],_0x1c91db=_0x20811f[_0x2759fe(0xde)](_0x191dda=>matchesEndpoint(_0x191dda,_0x43ae51[_0x2759fe(0xe3)],_0x43270d[_0x2759fe(0xf7)],_0x43ae51['to'],_0x43270d[_0x2759fe(0xe5)])&&(_0x5d9859==='create'||_0x191dda[_0x2759fe(0xe4)]===_0x43ae51[_0x2759fe(0xd4)][_0x2759fe(0xe4)]));_0x1e41c7=_0x1c91db['length']===0x1?_0x1c91db[0x0]:undefined,_0x3de4ff=!!_0x1e41c7&&_0x1e41c7[_0x2759fe(0xea)]===_0x43ae51['expectedLabel']&&_0x1e41c7[_0x2759fe(0xc7)]===_0x43ae51[_0x2759fe(0xbb)]&&_0x1e41c7[_0x2759fe(0x108)]===0x2;}}catch{}const _0x5c43c6={...mutationData(_0x43ae51,![],_0x1e41c7?projectCrossRelation(_0x1e41c7):null),'verification':{'status':_0x3de4ff?_0x2759fe(0xe1):_0x2759fe(0x102),'verified':_0x3de4ff}};if(!_0x3de4ff){const _0x2c3985=CliErrors['apiError'](_0x2759fe(0xdb)+_0x5d9859+_0x2759fe(0xed),_0x2759fe(0xdf));Object[_0x2759fe(0xd3)](_0x2c3985,_0x2759fe(0x100),{'value':{..._0x5c43c6,'candidates':_0x20811f['map'](projectCrossRelation)}});throw _0x2c3985;}return{'ok':!![],'data':_0x5c43c6,'message':_0x2759fe(0xdb)+_0x5d9859+_0x2759fe(0xc8)};}function a71_0xc04b(){const _0x1818ff=['expectedCardinality','dataset','source','2931090LEldfM','dbtableConfig','451429pfDJkJ','trim','validation','8912BSGUEo','str','DB_TABLE','dbId','cardinality','\x20verified.','\x20a\x20cross-database\x20relation\x20for\x20','--from-dblink-id\x20does\x20not\x20match\x20the\x20source\x20dataset\x20connection.','Cross-database\x20relation\x20not\x20found\x20for\x20this\x20source\x20dataset\x20and\x20field.','Invalid\x20--cardinality.','query','Dataset\x20','fromTableName','length','\x20must\x20be\x20a\x20DB_TABLE\x20dataset.','toDatasetName','defineProperty','before','some','fromDblinkId','multiple\x20cross-database\x20relations\x20matched','POST','290HFchAW','create','Cross-database\x20relation\x20','to-datasetcode','Run\x20dataset\x20cross-relation-list\x20to\x20inspect\x20the\x20candidates.\x20This\x20command\x20accepts\x20only\x20a\x20source\x20dataset\x20and\x20field.','filter','The\x20write\x20was\x20accepted,\x20but\x20current\x20state\x20could\x20not\x20be\x20confirmed.\x20Run\x20dataset\x20cross-relation-list\x20before\x20attempting\x20another\x20write.','storageProfile','matched','includes','from','relationId','toField','to-column','Multiple\x20cross-database\x20relations\x20match\x20this\x20source\x20field;\x20update/delete\x20cannot\x20select\x20one\x20target.','936FNsiNh','toLowerCase','refTableLabelName','\x20is\x20missing\x20its\x20database\x20connection\x20or\x20physical\x20table\x20name.','datasetCode','\x20write\x20was\x20not\x20verified.','label_inherited','fromDatasetCode','enum','message','fromDatasetName','from-datasetcode','dbtable','Would\x20','Cross-database\x20relations\x20require\x20different\x20source\x20and\x20target\x20database\x20connections.','fromField','delete','table','tableName','8808BCwZAc','extend','expectedLabel','940440Bfzvrm','sourceType','data','dblinkId','unconfirmed','Cross-database\x20relation\x20already\x20exists\x20for\x20these\x20source\x20and\x20target\x20endpoints.','body','15817450UQCwaj','toDblinkId','isSafeInteger','relationType','657729bXpAKv','from-column','Provide\x20--from-datasetcode\x20or\x20--from-dblink-id.','toTableName','map','The\x20target\x20display\x20field\x20is\x20inherited.\x20When\x20changing\x20the\x20target\x20dataset,\x20provide\x20--to-label-column\x20explicitly.','\x20has\x20invalid\x20storage\x20configuration.','flag','7AgULbH','appCode','parse'];a71_0xc04b=function(){return _0x1818ff;};return a71_0xc04b();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a72_0x2809(_0x13b920,_0x5ee292){_0x13b920=_0x13b920-0x15a;const _0x3aa4b3=a72_0x3aa4();let _0x280994=_0x3aa4b3[_0x13b920];return _0x280994;}const a72_0x43920d=a72_0x2809;(function(_0x835797,_0x48e47c){const _0xf94774=a72_0x2809,_0x583851=_0x835797();while(!![]){try{const _0x36ea6e=-parseInt(_0xf94774(0x162))/0x1*(parseInt(_0xf94774(0x15d))/0x2)+parseInt(_0xf94774(0x15e))/0x3+parseInt(_0xf94774(0x15b))/0x4+-parseInt(_0xf94774(0x166))/0x5+parseInt(_0xf94774(0x164))/0x6*(parseInt(_0xf94774(0x15a))/0x7)+-parseInt(_0xf94774(0x165))/0x8*(-parseInt(_0xf94774(0x167))/0x9)+parseInt(_0xf94774(0x15c))/0xa;if(_0x36ea6e===_0x48e47c)break;else _0x583851['push'](_0x583851['shift']());}catch(_0x369f08){_0x583851['push'](_0x583851['shift']());}}}(a72_0x3aa4,0x21e63));import{updateCrossDbRelation}from'../../core/api-client.js';import{CROSS_RELATION_FROM_DATASET_FLAG,CROSS_RELATION_FROM_COLUMN_FLAG,CROSS_RELATION_TO_DATASET_FLAG,CROSS_RELATION_TO_COLUMN_FLAG,CROSS_RELATION_LABEL_FLAG,CROSS_RELATION_CARDINALITY_FLAG,CROSS_RELATION_DBLINK_FLAG,APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{executeCrossRelation,previewCrossRelation,validateCrossRelation}from'../../commands/dataset/cross-relation-shared.js';export const datasetCrossRelationUpdate={'service':a72_0x43920d(0x160),'command':a72_0x43920d(0x163),'description':a72_0x43920d(0x161),'risk':'write','strictFlags':!![],'requiresCookieAuth':!![],'structuredErrors':!![],'flags':[CROSS_RELATION_FROM_DATASET_FLAG,CROSS_RELATION_FROM_COLUMN_FLAG,CROSS_RELATION_TO_DATASET_FLAG,CROSS_RELATION_TO_COLUMN_FLAG,CROSS_RELATION_LABEL_FLAG,CROSS_RELATION_CARDINALITY_FLAG,CROSS_RELATION_DBLINK_FLAG,APPCODE_FLAG_OPTIONAL],'validate':async _0x27afce=>validateCrossRelation(_0x27afce,'update'),'dryRun':_0xb330dd=>previewCrossRelation(_0xb330dd,a72_0x43920d(0x15f)),'execute':_0x13a8a2=>executeCrossRelation(_0x13a8a2,a72_0x43920d(0x15f),updateCrossDbRelation)};function a72_0x3aa4(){const _0x420618=['337547RnXkeU','101984XfSMED','2671360cwYyUv','4768KurRNT','17094GluzbH','update','dataset','Update\x20the\x20target\x20or\x20properties\x20of\x20the\x20single\x20cross-database\x20relation\x20matching\x20a\x20source\x20dataset\x20and\x20field','115HJCZOm','cross-relation-update','30GTWxgU','3304jNwvgs','997625mfBIUc','1593yRcjUe'];a72_0x3aa4=function(){return _0x420618;};return a72_0x3aa4();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a73_0x284202=a73_0x3aea;(function(_0x112dc7,_0x2fb54c){const _0x3056ce=a73_0x3aea,_0x423cf6=_0x112dc7();while(!![]){try{const _0x4ee2c2=parseInt(_0x3056ce(0x9e))/0x1+-parseInt(_0x3056ce(0xbb))/0x2+-parseInt(_0x3056ce(0xb6))/0x3+parseInt(_0x3056ce(0x95))/0x4+parseInt(_0x3056ce(0xb3))/0x5+parseInt(_0x3056ce(0xbe))/0x6+-parseInt(_0x3056ce(0x9a))/0x7;if(_0x4ee2c2===_0x2fb54c)break;else _0x423cf6['push'](_0x423cf6['shift']());}catch(_0x112afc){_0x423cf6['push'](_0x423cf6['shift']());}}}(a73_0x1934,0x93dc7));import{deleteDataset,getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL,CODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a73_0x3aea(_0x1a948b,_0x55854d){_0x1a948b=_0x1a948b-0x8f;const _0x19342f=a73_0x1934();let _0x3aea83=_0x19342f[_0x1a948b];return _0x3aea83;}const DATASET_ID_FLAG={'name':'id','type':a73_0x284202(0xad),'description':'Dataset\x20id'},DBID_FLAG={'name':a73_0x284202(0xa2),'type':a73_0x284202(0xad),'description':a73_0x284202(0x96)},CONFIRM_FLAG={'name':a73_0x284202(0xa3),'type':a73_0x284202(0xbd),'description':a73_0x284202(0xaa)},CASCADE_FLAG={'name':a73_0x284202(0x93),'type':'boolean','description':'Also\x20delete\x20related\x20pages\x20and\x20menus;\x20requires\x20explicit\x20--confirm'},EXPECTED_COUNT_FLAG={'name':a73_0x284202(0xbf),'type':'number','description':a73_0x284202(0x90)};export const datasetDelete={'service':a73_0x284202(0x9d),'command':'delete','description':a73_0x284202(0xbc),'risk':'high-risk-write','flags':[DATASET_ID_FLAG,CODE_FLAG_OPTIONAL,DBID_FLAG,CASCADE_FLAG,CONFIRM_FLAG,EXPECTED_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x58547d){const _0x46c396=a73_0x284202,_0x5d0320=_0x58547d['num']('id'),_0x4ab2af=_0x58547d['str'](_0x46c396(0xa7)),_0x51e444=_0x58547d['num']('dbid'),_0x47d569=[_0x5d0320>0x0,Boolean(_0x4ab2af),_0x51e444>0x0][_0x46c396(0xb8)](Boolean);if(_0x47d569['length']===0x0)throw CliErrors[_0x46c396(0x94)]('One\x20of\x20--id,\x20--code,\x20or\x20--dbid\x20is\x20required.');if(_0x47d569[_0x46c396(0xae)]>0x1)throw CliErrors[_0x46c396(0x94)]('Use\x20only\x20one\x20of\x20--id,\x20--code,\x20or\x20--dbid.');},async 'dryRun'(_0x5ee946){const _0x50064e=a73_0x284202,_0x41285f=await resolveTargets(_0x5ee946),_0x50c4ed=_0x5ee946[_0x50064e(0xb4)](_0x50064e(0x93));return{'method':_0x50064e(0xba),'url':'/smartapi/dataset/delete?cascade='+(_0x50c4ed?'true':'false'),'body':{'count':_0x41285f[_0x50064e(0xae)],'cascade':_0x50c4ed,'datasets':_0x41285f},'description':_0x50c4ed?'Would\x20delete\x20'+_0x41285f[_0x50064e(0xae)]+'\x20dataset(s)\x20and\x20their\x20listed\x20related\x20pages/menus.\x20Restore\x20each\x20Dataset\x20first,\x20then\x20restore\x20pages\x20explicitly\x20when\x20needed.':_0x50064e(0x91)+_0x41285f[_0x50064e(0xae)]+'\x20dataset(s)\x20without\x20cascading\x20to\x20pages.\x20The\x20server\x20blocks\x20a\x20Dataset\x20that\x20still\x20has\x20related\x20pages.'};},async 'execute'(_0x81fb8d){const _0x29e45f=a73_0x284202;if(!_0x81fb8d[_0x29e45f(0xb4)](_0x29e45f(0xa3)))throw CliErrors['validation']('--confirm\x20is\x20required\x20to\x20delete\x20datasets.','Run\x20with\x20--dry-run\x20first,\x20then\x20add\x20--confirm\x20when\x20the\x20target\x20list\x20is\x20correct.');const _0x4adfe0=await resolveTargets(_0x81fb8d),_0x577c88=_0x81fb8d['bool'](_0x29e45f(0x93)),_0x273cc5=[],_0x2faa6f=[];for(const _0x15ed45 of _0x4adfe0){try{await deleteDataset(_0x15ed45['id'],_0x577c88),_0x273cc5['push'](_0x15ed45);}catch(_0x5f1f4c){_0x2faa6f[_0x29e45f(0xb2)]({..._0x15ed45,'error':_0x5f1f4c instanceof Error?_0x5f1f4c[_0x29e45f(0xaf)]:String(_0x5f1f4c)});}}if(_0x2faa6f['length']>0x0){const _0x2a05e3=buildPageRestoreCommands(_0x81fb8d[_0x29e45f(0xb5)],_0x577c88?_0x273cc5:[]);return{'ok':![],'data':{'requested':_0x4adfe0[_0x29e45f(0xae)],'cascade':_0x577c88,'deletedCount':_0x273cc5[_0x29e45f(0xae)],'failedCount':_0x2faa6f[_0x29e45f(0xae)],'deleted':_0x273cc5,'failed':_0x2faa6f,'pageRestoreCommands':_0x2a05e3},'message':'Deleted\x20'+_0x273cc5[_0x29e45f(0xae)]+'/'+_0x4adfe0['length']+_0x29e45f(0x99)+_0x2faa6f[_0x29e45f(0xae)]+_0x29e45f(0xc1)};}return{'ok':!![],'data':{'requested':_0x4adfe0[_0x29e45f(0xae)],'cascade':_0x577c88,'deletedCount':_0x273cc5[_0x29e45f(0xae)],'deleted':_0x273cc5,'pageRestoreCommands':buildPageRestoreCommands(_0x81fb8d[_0x29e45f(0xb5)],_0x577c88?_0x273cc5:[])},'message':_0x29e45f(0xc0)+_0x273cc5[_0x29e45f(0xae)]+'\x20dataset(s)'};}};async function resolveTargets(_0x344272){const _0x1c033f=a73_0x284202,_0x93c970=_0x344272[_0x1c033f(0x8f)]('id'),_0x1af2da=_0x344272['str'](_0x1c033f(0xa7)),_0x2b762e=_0x344272[_0x1c033f(0x8f)]('dbid');let _0x3ede77;_0x1af2da?(_0x3ede77=await listDatasets(_0x344272[_0x1c033f(0xb5)],{'code':_0x1af2da}),_0x3ede77=_0x3ede77[_0x1c033f(0xb8)](_0x25112f=>_0x25112f[_0x1c033f(0xa7)]===_0x1af2da)):(_0x3ede77=await listDatasets(_0x344272[_0x1c033f(0xb5)]),_0x93c970>0x0&&(_0x3ede77=_0x3ede77[_0x1c033f(0xb8)](_0x3c87f6=>_0x3c87f6['id']===_0x93c970)),_0x2b762e>0x0&&(_0x3ede77=_0x3ede77['filter'](_0xd75b7=>_0xd75b7['dbtableConfig']?.[_0x1c033f(0xa5)]===_0x2b762e)));const _0x45d3f9=[];for(const _0x4be579 of _0x3ede77){const _0x4efe17=await getDatasetDetail(_0x4be579[_0x1c033f(0xa7)]),_0x528d45=Array[_0x1c033f(0xac)](_0x4efe17['relatedPageInfoList'])?_0x4efe17[_0x1c033f(0xb1)]['filter'](_0x47309b=>_0x47309b!=null&&typeof _0x47309b===_0x1c033f(0x9f)&&_0x47309b[_0x1c033f(0x92)]!==!![]):[];_0x45d3f9[_0x1c033f(0xb2)](normalizeTarget(_0x4be579,_0x528d45));}if(_0x45d3f9[_0x1c033f(0xae)]===0x0){const _0x323163=_0x1af2da||(_0x93c970>0x0?_0x1c033f(0xa4)+_0x93c970:_0x1c033f(0xb7)+_0x2b762e);throw CliErrors[_0x1c033f(0x94)](_0x1c033f(0x9c)+_0x323163+'.');}const _0xacb515=_0x344272[_0x1c033f(0x8f)](_0x1c033f(0xbf));if(_0xacb515>0x0&&_0x45d3f9[_0x1c033f(0xae)]!==_0xacb515)throw CliErrors[_0x1c033f(0x94)]('Matched\x20'+_0x45d3f9['length']+_0x1c033f(0xab)+_0xacb515+'.');return _0x45d3f9;}function normalizeTarget(_0x33b6e2,_0x2d3d0e){const _0x1ed4a6=a73_0x284202,_0x3966fd=_0x33b6e2[_0x1ed4a6(0xb9)]??{},_0x24e5ee=_0x2d3d0e['map'](_0x208df5=>{const _0x2122fd=_0x1ed4a6;if(_0x208df5==null||typeof _0x208df5!=='object')return null;const _0x120c87=_0x208df5,_0x46a692=Number(_0x120c87['id']);if(!Number[_0x2122fd(0x97)](_0x46a692)||_0x46a692<=0x0)return null;const _0xd5d2f8=_0x120c87[_0x2122fd(0xa8)]??_0x120c87[_0x2122fd(0xa6)];return{'id':_0x46a692,..._0xd5d2f8?{'name':String(_0xd5d2f8)}:{},..._0x120c87[_0x2122fd(0x9b)]?{'type':String(_0x120c87[_0x2122fd(0x9b)])}:{}};})[_0x1ed4a6(0xb8)](_0x1261b6=>_0x1261b6!==null);return{'id':_0x33b6e2['id'],'code':_0x33b6e2[_0x1ed4a6(0xa7)],'name':_0x33b6e2[_0x1ed4a6(0xa6)],'description':_0x33b6e2['description'],'source':_0x33b6e2[_0x1ed4a6(0x98)],'dbId':_0x3966fd[_0x1ed4a6(0xa5)],'dbName':_0x3966fd['dbName'],'tableName':_0x3966fd['tableName'],'relatedPageCount':_0x24e5ee[_0x1ed4a6(0xae)],'relatedPages':_0x24e5ee};}function a73_0x1934(){const _0x1482f3=['relatedPageInfoList','push','3855710AJnqVS','bool','appCode','1765461QYAOKG','dbid=','filter','dbtableConfig','POST','86902HsriPD','Delete\x20dataset\x20metadata\x20by\x20id/code\x20or\x20all\x20datasets\x20under\x20a\x20db\x20id','boolean','1104162kTydcC','expected-count','Deleted\x20','\x20failed','num','Abort\x20unless\x20the\x20matched\x20dataset\x20count\x20equals\x20this\x20value','Would\x20safely\x20delete\x20','deleted','cascade','validation','209116KIIhhr','Delete\x20all\x20datasets\x20under\x20this\x20database\x20connection\x20id','isInteger','source','\x20dataset(s);\x20','5338949CUrTcT','type','No\x20undeleted\x20dataset\x20found\x20for\x20','dataset','992836YTSuLE','object','\x20--appcode\x20','add','dbid','confirm','id=','dbId','name','code','title','rabetbase\x20page\x20restore\x20--id\x20','Required\x20to\x20execute\x20dataset\x20deletion','\x20dataset(s),\x20but\x20--expected-count\x20is\x20','isArray','number','length','message','relatedPages'];a73_0x1934=function(){return _0x1482f3;};return a73_0x1934();}function buildPageRestoreCommands(_0x89bcc6,_0xae76d7){const _0x2cf8a8=a73_0x284202,_0x32290e=new Set();for(const _0x212e74 of _0xae76d7){for(const _0x23a8f8 of _0x212e74[_0x2cf8a8(0xb0)])_0x32290e[_0x2cf8a8(0xa1)](_0x23a8f8['id']);}return[..._0x32290e]['map'](_0x15f886=>_0x2cf8a8(0xa9)+_0x15f886+_0x2cf8a8(0xa0)+_0x89bcc6);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a74_0x17d647=a74_0x3600;function a74_0x3600(_0x35ab0d,_0xd183d3){_0x35ab0d=_0x35ab0d-0x19c;const _0x319102=a74_0x3191();let _0x36000c=_0x319102[_0x35ab0d];return _0x36000c;}(function(_0x936b06,_0x1a445c){const _0x24e0b1=a74_0x3600,_0x53a868=_0x936b06();while(!![]){try{const _0x14abb0=-parseInt(_0x24e0b1(0x1cf))/0x1+-parseInt(_0x24e0b1(0x1ae))/0x2*(-parseInt(_0x24e0b1(0x1a1))/0x3)+parseInt(_0x24e0b1(0x1e3))/0x4*(-parseInt(_0x24e0b1(0x1df))/0x5)+-parseInt(_0x24e0b1(0x1ad))/0x6+-parseInt(_0x24e0b1(0x1b9))/0x7*(-parseInt(_0x24e0b1(0x1a6))/0x8)+-parseInt(_0x24e0b1(0x1b0))/0x9+parseInt(_0x24e0b1(0x1a8))/0xa;if(_0x14abb0===_0x1a445c)break;else _0x53a868['push'](_0x53a868['shift']());}catch(_0x17815c){_0x53a868['push'](_0x53a868['shift']());}}}(a74_0x3191,0x28604));import{getDatasetDetail}from'../../core/api-client.js';import{CODE_FLAG,APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function normalizeField(_0x565135){const _0x1b1f35=a74_0x3600;if(_0x565135[_0x1b1f35(0x1a7)])return null;const _0x4f2f52=Boolean(_0x565135['displayName']!==undefined||_0x565135[_0x1b1f35(0x1d1)]!==undefined);let _0x52d56a={};if(!_0x4f2f52&&typeof _0x565135[_0x1b1f35(0x1ac)]===_0x1b1f35(0x1cc))try{_0x52d56a=JSON[_0x1b1f35(0x1a3)](_0x565135[_0x1b1f35(0x1ac)]);}catch{}const _0x580878=_0x4f2f52?_0x565135[_0x1b1f35(0x1c1)]:_0x565135[_0x1b1f35(0x19d)],_0x38354b=_0x4f2f52?_0x565135[_0x1b1f35(0x19c)]:_0x565135[_0x1b1f35(0x1c1)],_0x517518=_0x4f2f52?_0x565135[_0x1b1f35(0x1d1)]:_0x565135['type']||_0x565135[_0x1b1f35(0x1d4)],_0x57de99=_0x4f2f52?_0x565135[_0x1b1f35(0x1d5)]===!![]:_0x52d56a[_0x1b1f35(0x1d5)]===!![],_0x447695=_0x4f2f52?_0x565135[_0x1b1f35(0x1e6)]===!![]:_0x52d56a[_0x1b1f35(0x1e6)]===!![],_0x2755b0=_0x4f2f52?_0x565135[_0x1b1f35(0x1ca)]??null:_0x52d56a[_0x1b1f35(0x1ca)]??null,_0x416904={'name':_0x580878,'displayName':_0x38354b||_0x580878,'type':_0x517518,'dbType':_0x565135[_0x1b1f35(0x1b4)],'pk':_0x57de99,'required':_0x447695,'deprecated':_0x565135['deprecated']===!![],'description':_0x565135[_0x1b1f35(0x1a4)]||undefined};return Array[_0x1b1f35(0x1cb)](_0x2755b0)&&_0x2755b0[_0x1b1f35(0x19e)]>0x0&&(_0x416904[_0x1b1f35(0x1ca)]=_0x2755b0),_0x416904;}function a74_0x3191(){const _0x272b19=['tableComment','doVersion','responseFields','modelCode','displayName','code','length','requestBody','dbName','597ebAVei','dbId','parse','description','path','16dqSHJv','deleted','6784740OwaPHX','formatRules','logicField','modifierIdField','extend','1978500GuiYnA','862nWPMsi','toTableName','2150766BeIWLt','modelId','relations','cardinality','dbType','beforeScriptId','modifierNameField','alias','afterScriptId','918001kZoxOU','validateRules','datasetKey','dataset','toField','trim','str','read','name','relatedPageInfoList','relationId','allFields','fields','host','properties','object','labelField','options','isArray','string','sourceType','map','28162VVotkf','entries','doType','split','responseBody','dataType','pkField','filter','method','indexes','columnCodeListWithDeleted','creatorNameField','main_sub','createTimeField','push','requestFields','5wiJwrG','source','tableName','dbtableConfig','1057052gSXgDV','dblinkInfoDTO','Dataset\x20alias\x20defined\x20in\x20api.ts\x20(e.g.\x20order,\x20coupon).\x20Resolves\x20to\x20dataset\x20code\x20automatically','required','type','toFieldLabel','fromField'];a74_0x3191=function(){return _0x272b19;};return a74_0x3191();}function parseJsonMaybe(_0x177b27){const _0x5e7deb=a74_0x3600;if(typeof _0x177b27!==_0x5e7deb(0x1cc))return _0x177b27;try{return JSON[_0x5e7deb(0x1a3)](_0x177b27);}catch{return _0x177b27;}}function normalizeOperationEntry(_0x349fa7,_0x25fc8b){const _0x198a7b=a74_0x3600;if(!_0x25fc8b||typeof _0x25fc8b!==_0x198a7b(0x1c8))return null;if(!_0x25fc8b[_0x198a7b(0x1d7)]||!_0x25fc8b[_0x198a7b(0x1a5)])return null;const _0x19d34b={'name':_0x349fa7,'method':_0x25fc8b[_0x198a7b(0x1d7)],'path':_0x25fc8b[_0x198a7b(0x1a5)]};if(_0x25fc8b[_0x198a7b(0x1c6)])_0x19d34b[_0x198a7b(0x1c6)]=_0x25fc8b[_0x198a7b(0x1c6)];if(_0x25fc8b[_0x198a7b(0x19f)]!=null){const _0x40bd3d=parseJsonMaybe(_0x25fc8b[_0x198a7b(0x19f)]);_0x19d34b[_0x198a7b(0x19f)]=_0x40bd3d;}if(_0x25fc8b[_0x198a7b(0x1d3)]!=null){const _0x49b0d7=parseJsonMaybe(_0x25fc8b['responseBody']);_0x19d34b[_0x198a7b(0x1d3)]=_0x49b0d7;}if(_0x25fc8b[_0x198a7b(0x1b5)]!=null)_0x19d34b[_0x198a7b(0x1b5)]=_0x25fc8b[_0x198a7b(0x1b5)];if(_0x25fc8b[_0x198a7b(0x1b8)]!=null)_0x19d34b[_0x198a7b(0x1b8)]=_0x25fc8b[_0x198a7b(0x1b8)];if(Array[_0x198a7b(0x1cb)](_0x25fc8b['requestFields']))_0x19d34b[_0x198a7b(0x1de)]=_0x25fc8b[_0x198a7b(0x1de)];if(Array[_0x198a7b(0x1cb)](_0x25fc8b[_0x198a7b(0x1ec)]))_0x19d34b['responseFields']=_0x25fc8b[_0x198a7b(0x1ec)];return _0x19d34b;}function summarizeDbtable(_0x48a893){const _0x59cf70=a74_0x3600,_0x34e603={},_0x37ed80=[_0x59cf70(0x1a2),_0x59cf70(0x1a0),_0x59cf70(0x1e1),_0x59cf70(0x1bb),_0x59cf70(0x1d5),'allFields',_0x59cf70(0x1aa),_0x59cf70(0x1dc),'updateTimeField','creatorIdField',_0x59cf70(0x1da),_0x59cf70(0x1ab),_0x59cf70(0x1b6),_0x59cf70(0x1c9),_0x59cf70(0x1e4)];for(const _0x307718 of _0x37ed80){if(_0x48a893[_0x307718]!==undefined)_0x34e603[_0x307718]=_0x48a893[_0x307718];}return typeof _0x34e603[_0x59cf70(0x1c4)]===_0x59cf70(0x1cc)&&_0x34e603[_0x59cf70(0x1c4)]['length']>0x0&&(_0x34e603['allFieldNames']=_0x34e603['allFields'][_0x59cf70(0x1d2)](',')[_0x59cf70(0x1ce)](_0x1a509c=>_0x1a509c[_0x59cf70(0x1be)]())['filter'](Boolean)),_0x34e603;}function normalizeRelatedPages(_0x13b05d){const _0x1887ed=a74_0x3600;if(!Array[_0x1887ed(0x1cb)](_0x13b05d))return[];return _0x13b05d[_0x1887ed(0x1d6)](_0x610194=>_0x610194&&typeof _0x610194===_0x1887ed(0x1c8))[_0x1887ed(0x1ce)](_0x249d27=>({'id':_0x249d27['id'],'type':_0x249d27[_0x1887ed(0x1e7)],'code':_0x249d27[_0x1887ed(0x19d)],'title':_0x249d27['title'],'deleted':_0x249d27[_0x1887ed(0x1a7)]===!![]}));}export const datasetDetail={'service':a74_0x17d647(0x1bc),'command':'detail','description':'Get\x20dataset\x20detail\x20including\x20fields\x20and\x20operations','risk':a74_0x17d647(0x1c0),'flags':[CODE_FLAG,APPCODE_FLAG_OPTIONAL,{'name':a74_0x17d647(0x1b7),'type':'string','description':a74_0x17d647(0x1e5)}],async 'execute'(_0x2592fe){const _0x352b82=a74_0x17d647,_0x383c09=await getDatasetDetail(_0x2592fe[_0x352b82(0x1bf)]('code')),_0x4af26b=Array[_0x352b82(0x1cb)](_0x383c09[_0x352b82(0x1c5)])?_0x383c09[_0x352b82(0x1c5)]:Array['isArray'](_0x383c09[_0x352b82(0x1c7)])?_0x383c09[_0x352b82(0x1c7)]:[],_0x1901b2=_0x4af26b[_0x352b82(0x1ce)](_0x572639=>normalizeField(_0x572639))[_0x352b82(0x1d6)](_0x348331=>_0x348331!==null),_0x5b9af6=_0x383c09['operations']??{},_0x19e9cd=[];for(const [_0x28b8a5,_0xeefae6]of Object[_0x352b82(0x1d0)](_0x5b9af6)){const _0x4b669f=normalizeOperationEntry(_0x28b8a5,_0xeefae6);if(_0x4b669f)_0x19e9cd[_0x352b82(0x1dd)](_0x4b669f);}const _0x3384cb=_0x383c09[_0x352b82(0x1e2)]??{},_0x37db0c=_0x383c09[_0x352b82(0x1bc)]??{},_0x1daa3d=_0x3384cb[_0x352b82(0x1a2)]!=null?{'id':_0x3384cb[_0x352b82(0x1a2)],'name':_0x3384cb[_0x352b82(0x1a0)]??null}:undefined;let _0x2e58f5;return typeof _0x383c09[_0x352b82(0x1ac)]==='string'&&(_0x2e58f5=parseJsonMaybe(_0x383c09[_0x352b82(0x1ac)])),{'ok':!![],'data':{'id':_0x383c09[_0x352b82(0x1b1)]??_0x383c09['id'],'name':_0x383c09['name'],'code':_0x383c09[_0x352b82(0x1ed)]||_0x383c09[_0x352b82(0x19d)],'doVersion':_0x383c09[_0x352b82(0x1eb)],'description':_0x383c09[_0x352b82(0x1a4)]||_0x37db0c[_0x352b82(0x1ea)]||undefined,'source':_0x383c09[_0x352b82(0x1e0)]||_0x37db0c[_0x352b82(0x1cd)],'table':_0x3384cb[_0x352b82(0x1e1)]||_0x37db0c[_0x352b82(0x1e1)],'datasetKey':_0x3384cb[_0x352b82(0x1bb)],'pk':_0x3384cb[_0x352b82(0x1d5)],'db':_0x1daa3d,'dbtable':summarizeDbtable(_0x3384cb),'fields':_0x1901b2,'operations':_0x19e9cd,'indexes':Array[_0x352b82(0x1cb)](_0x37db0c[_0x352b82(0x1d8)])?_0x37db0c[_0x352b82(0x1d8)]:[],'relations':Array[_0x352b82(0x1cb)](_0x383c09[_0x352b82(0x1b2)])?_0x383c09[_0x352b82(0x1b2)][_0x352b82(0x1ce)](_0x4a7276=>({..._0x4a7276[_0x352b82(0x1c3)]!=null?{'relationId':_0x4a7276[_0x352b82(0x1c3)]}:{},'fromDataset':_0x383c09['name'],'fromCode':_0x383c09[_0x352b82(0x1ed)]||_0x383c09[_0x352b82(0x19d)],'fromTable':_0x3384cb[_0x352b82(0x1e1)]||_0x37db0c[_0x352b82(0x1e1)],'fromField':_0x4a7276[_0x352b82(0x1e9)],'toDataset':_0x4a7276['toDatasetName'],'toCode':_0x4a7276['toDatasetCode'],'toTable':_0x4a7276[_0x352b82(0x1af)],'toField':_0x4a7276[_0x352b82(0x1bd)],'labelField':_0x4a7276[_0x352b82(0x1e8)]||undefined,'cardinality':_0x4a7276[_0x352b82(0x1b3)]||undefined,'bizRelationType':_0x4a7276['bizRelationType']==='main_sub'?_0x352b82(0x1db):null})):[],'relatedPages':normalizeRelatedPages(_0x383c09[_0x352b82(0x1c2)]),...Array[_0x352b82(0x1cb)](_0x383c09[_0x352b82(0x1d9)])?{'columnCodeListWithDeleted':_0x383c09['columnCodeListWithDeleted']}:{},'formatRules':Array[_0x352b82(0x1cb)](_0x383c09[_0x352b82(0x1a9)])?_0x383c09[_0x352b82(0x1a9)]:[],'validateRules':Array[_0x352b82(0x1cb)](_0x383c09['validateRules'])?_0x383c09[_0x352b82(0x1ba)]:[],..._0x2e58f5!==undefined?{'extend':_0x2e58f5}:{},'stats':{'fieldCount':_0x1901b2['length'],'operationCount':_0x19e9cd[_0x352b82(0x19e)]}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a75_0x26ce25=a75_0x37be;(function(_0x106c8c,_0x2e1c53){const _0x5415b0=a75_0x37be,_0x512c5e=_0x106c8c();while(!![]){try{const _0x472026=parseInt(_0x5415b0(0x99))/0x1+-parseInt(_0x5415b0(0x88))/0x2*(-parseInt(_0x5415b0(0x8b))/0x3)+parseInt(_0x5415b0(0xb2))/0x4+-parseInt(_0x5415b0(0x89))/0x5+-parseInt(_0x5415b0(0xa6))/0x6*(-parseInt(_0x5415b0(0x87))/0x7)+parseInt(_0x5415b0(0xb7))/0x8*(-parseInt(_0x5415b0(0x9b))/0x9)+-parseInt(_0x5415b0(0xb1))/0xa;if(_0x472026===_0x2e1c53)break;else _0x512c5e['push'](_0x512c5e['shift']());}catch(_0x548043){_0x512c5e['push'](_0x512c5e['shift']());}}}(a75_0x1c31,0xba77c));import{APPCODE_FLAG_OPTIONAL,CODE_FLAG}from'../../commands/common/flags.js';import{getDatasetDetail,updateDrivenData}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const MUTABLE_EXTEND_KEYS=new Set(),EXTEND_PATCH_REDIRECTS=new Map([['businessGroup',{'message':a75_0x26ce25(0xa9),'hint':a75_0x26ce25(0x85)}]]);export function parseJsonObjectFlag(_0x498cfc,_0x87fe93){const _0x3bf246=a75_0x26ce25;if(!_0x498cfc)return undefined;let _0x54a44f;try{_0x54a44f=JSON['parse'](_0x498cfc);}catch(_0x515f5b){const _0x5b0c91=_0x515f5b instanceof Error?_0x515f5b[_0x3bf246(0x94)]:String(_0x515f5b);throw CliErrors[_0x3bf246(0x7d)](_0x87fe93+_0x3bf246(0xa2)+_0x5b0c91);}if(!isPlainObject(_0x54a44f)||Array[_0x3bf246(0xaa)](_0x54a44f))throw CliErrors['validation'](_0x87fe93+_0x3bf246(0x8e));return _0x54a44f;}function a75_0x1c31(){const _0x21b791=['code','JSON\x20object\x20of\x20expected\x20current\x20extend\x20values;\x20mismatch\x20aborts\x20without\x20writing','datasetCode','extend-update','\x20must\x20be\x20valid\x20JSON\x20object:\x20','trim','has','str','2763834ozkljX','push','dbId','dataset\x20extend-update\x20does\x20not\x20support\x20businessGroup;\x20use\x20dataset\x20business-group-update','isArray','patch','Updated\x20dataset\x20extend\x20(','Expectation\x20mismatch\x20at\x20extend.','expect-json','modelId','keys','7370650QJfEvo','5606352ExVCOx','--patch-json','dataset','Dry-run:\x20dataset\x20extend\x20would\x20change\x20(','stringify','8rSNeCp','string','parse','extend.','JSON\x20object\x20patch\x20for\x20dataset\x20top-level\x20extend;\x20current\x20allowlist\x20is\x20empty','validation','appCode','tableName','Patch\x20dataset\x20top-level\x20extend\x20safely','object','datasetId','dbtableConfig','length','Use\x20`rabetbase\x20dataset\x20business-group-update`\x20to\x20update\x20business\x20model\x20groups.','No\x20dataset\x20extend\x20patch\x20keys\x20are\x20currently\x20supported.','7BrNSCn','1720bLFwuh','2047225OAsalm','expect','3369aHKVit','Expected\x20','name','\x20must\x20be\x20a\x20JSON\x20object','value','Dataset\x20extend\x20must\x20be\x20a\x20JSON\x20object','Unsupported\x20patch\x20key:\x20','join','entries','message','Allowed\x20keys:\x20','dbName','extend','modelCode','414097uDgNvb','--code\x20is\x20required','11986398QFFWpF','datasetName','hint'];a75_0x1c31=function(){return _0x21b791;};return a75_0x1c31();}export function validateExtendPatchKeys(_0x40a151){const _0x4a0f45=a75_0x26ce25,_0x152fd9=Object[_0x4a0f45(0xb0)](_0x40a151);if(_0x152fd9[_0x4a0f45(0x84)]===0x0)throw CliErrors[_0x4a0f45(0x7d)]('--patch-json\x20must\x20contain\x20at\x20least\x20one\x20key');for(const _0x19b218 of _0x152fd9){const _0xc8ea98=EXTEND_PATCH_REDIRECTS['get'](_0x19b218);if(_0xc8ea98)throw CliErrors[_0x4a0f45(0x7d)](_0xc8ea98[_0x4a0f45(0x94)],_0xc8ea98[_0x4a0f45(0x9d)]);if(!MUTABLE_EXTEND_KEYS[_0x4a0f45(0xa4)](_0x19b218))throw CliErrors[_0x4a0f45(0x7d)](_0x4a0f45(0x91)+_0x19b218,describeMutableExtendKeys());}}function describeMutableExtendKeys(){const _0x15e58d=a75_0x26ce25,_0xa620a5=Array['from'](MUTABLE_EXTEND_KEYS)['sort']();return _0xa620a5[_0x15e58d(0x84)]>0x0?_0x15e58d(0x95)+_0xa620a5[_0x15e58d(0x92)](',\x20'):_0x15e58d(0x86);}export function applyExtendPatch(_0x56ef20,_0x34b147){const _0x3759c4=a75_0x26ce25;validateExtendPatchKeys(_0x34b147);const _0x10fb03=deepClone(_0x56ef20),_0x3ea3fb=[];for(const [_0x58be67,_0x287f78]of Object[_0x3759c4(0x93)](_0x34b147)){const _0x2d3113=_0x10fb03[_0x58be67],_0x16b5ac=deepClone(_0x287f78);!deepEqual(_0x2d3113,_0x16b5ac)&&(_0x10fb03[_0x58be67]=_0x16b5ac,_0x3ea3fb[_0x3759c4(0xa7)](_0x3759c4(0x7b)+_0x58be67));}return _0x3ea3fb['sort'](),{'after':_0x10fb03,'changedPaths':_0x3ea3fb,'changed':_0x3ea3fb['length']>0x0};}export function assertExpectation(_0x52becb,_0x278d12){const _0x5d8539=a75_0x26ce25;if(!_0x278d12)return;for(const [_0x1d7553,_0x149da9]of Object[_0x5d8539(0x93)](_0x278d12)){const _0x3ccfcd=_0x52becb[_0x1d7553];if(!deepEqual(_0x3ccfcd,_0x149da9))throw CliErrors['validation'](_0x5d8539(0xad)+_0x1d7553,_0x5d8539(0x8c)+JSON[_0x5d8539(0xb6)](_0x149da9)+',\x20actual\x20'+JSON[_0x5d8539(0xb6)](_0x3ccfcd));}}export async function buildDatasetExtendUpdateResult({appCode:_0x1f6e19,input:_0x45479f,dryRun:_0xcbb69d}){const _0x362122=a75_0x26ce25;validateInput(_0x45479f);const _0x38c4f0=await getDatasetDetail(_0x45479f[_0x362122(0x9e)]),_0x48bba3=parseDatasetExtend(_0x38c4f0['extend']),_0x4aa2ca=deepClone(_0x48bba3[_0x362122(0x8f)]);assertExpectation(_0x4aa2ca,_0x45479f[_0x362122(0x8a)]);const {after:_0x403fda,changedPaths:_0x2d7f0d,changed:_0x2ed5d7}=applyExtendPatch(_0x4aa2ca,_0x45479f[_0x362122(0xab)]),_0x7826f=summarizeDataset(_0x38c4f0,_0x45479f['code']);return _0x2ed5d7&&!_0xcbb69d&&(_0x38c4f0[_0x362122(0x97)]=serializeDatasetExtend(_0x403fda,_0x48bba3['shape']),await updateDrivenData(_0x38c4f0)),{'ok':!![],'data':{'appCode':_0x1f6e19,'selector':{'code':_0x45479f[_0x362122(0x9e)]},'dataset':_0x7826f,'dryRun':_0xcbb69d,'changed':_0x2ed5d7,'changedPaths':_0x2d7f0d,'before':{'extend':_0x4aa2ca},'after':{'extend':_0x403fda},'submitted':_0x2ed5d7&&!_0xcbb69d},'message':_0x2ed5d7?_0xcbb69d?_0x362122(0xb5)+_0x2d7f0d[_0x362122(0x92)](',\x20')+')':_0x362122(0xac)+_0x2d7f0d[_0x362122(0x92)](',\x20')+')':'No\x20changes\x20for\x20dataset\x20extend'};}export const datasetExtendUpdate={'service':a75_0x26ce25(0xb4),'command':a75_0x26ce25(0xa1),'description':a75_0x26ce25(0x80),'risk':'write','flags':[CODE_FLAG,{'name':'patch-json','type':a75_0x26ce25(0xb8),'required':!![],'description':a75_0x26ce25(0x7c)},{'name':'expect-json','type':a75_0x26ce25(0xb8),'required':![],'description':a75_0x26ce25(0x9f)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2c78be){validateInput(readExtendUpdateInput(_0x2c78be));},async 'dryRun'(_0x26f242){const _0xd6e352=a75_0x26ce25,_0x4bcfad=await buildDatasetExtendUpdateResult({'appCode':_0x26f242[_0xd6e352(0x7e)],'input':readExtendUpdateInput(_0x26f242),'dryRun':!![]});return{'method':'POST','url':'/smartapi/dataset/update-driven-data','body':_0x4bcfad['data'],'description':_0x4bcfad[_0xd6e352(0x94)]};},async 'execute'(_0x4410a9){return buildDatasetExtendUpdateResult({'appCode':_0x4410a9['appCode'],'input':readExtendUpdateInput(_0x4410a9),'dryRun':![]});}};function readExtendUpdateInput(_0x279aff){const _0x2ef593=a75_0x26ce25,_0x2db046=trim(_0x279aff[_0x2ef593(0xa5)]('code')),_0x133645=parseJsonObjectFlag(_0x279aff[_0x2ef593(0xa5)]('patch-json'),_0x2ef593(0xb3)),_0x4ed334=parseJsonObjectFlag(_0x279aff[_0x2ef593(0xa5)](_0x2ef593(0xae)),'--expect-json');return{'code':_0x2db046,'patch':_0x133645||{},'expect':_0x4ed334};}function validateInput(_0x12103d){const _0x26e7a8=a75_0x26ce25;if(!_0x12103d['code'])throw CliErrors[_0x26e7a8(0x7d)](_0x26e7a8(0x9a));validateExtendPatchKeys(_0x12103d[_0x26e7a8(0xab)]);}function parseDatasetExtend(_0x41f708){const _0x4c4d82=a75_0x26ce25;if(typeof _0x41f708==='string'){const _0x18fd55=_0x41f708['trim']();if(!_0x18fd55)return{'value':{},'shape':_0x4c4d82(0xb8)};let _0x13f3a8;try{_0x13f3a8=JSON[_0x4c4d82(0xb9)](_0x18fd55);}catch(_0x52f5b1){const _0x4a188f=_0x52f5b1 instanceof Error?_0x52f5b1[_0x4c4d82(0x94)]:String(_0x52f5b1);throw CliErrors[_0x4c4d82(0x7d)]('Dataset\x20extend\x20must\x20be\x20valid\x20JSON\x20object:\x20'+_0x4a188f);}if(!isPlainObject(_0x13f3a8)||Array[_0x4c4d82(0xaa)](_0x13f3a8))throw CliErrors[_0x4c4d82(0x7d)](_0x4c4d82(0x90));return{'value':_0x13f3a8,'shape':'string'};}if(_0x41f708===undefined||_0x41f708===null)return{'value':{},'shape':_0x4c4d82(0xb8)};if(!isPlainObject(_0x41f708)||Array[_0x4c4d82(0xaa)](_0x41f708))throw CliErrors[_0x4c4d82(0x7d)](_0x4c4d82(0x90));return{'value':_0x41f708,'shape':_0x4c4d82(0x81)};}function serializeDatasetExtend(_0x3cd23d,_0x7f52c1){const _0x166c09=a75_0x26ce25;return _0x7f52c1===_0x166c09(0xb8)?JSON['stringify'](_0x3cd23d):_0x3cd23d;}function summarizeDataset(_0x35e8fc,_0x55c8f3){const _0x569a96=a75_0x26ce25,_0x5df0a7=isPlainObject(_0x35e8fc[_0x569a96(0xb4)])?_0x35e8fc[_0x569a96(0xb4)]:{},_0x5ec483=isPlainObject(_0x35e8fc[_0x569a96(0x83)])?_0x35e8fc[_0x569a96(0x83)]:{};return{'id':_0x35e8fc[_0x569a96(0xaf)]??_0x35e8fc['id']??_0x5df0a7[_0x569a96(0x82)]??null,'code':_0x35e8fc[_0x569a96(0x98)]??_0x35e8fc[_0x569a96(0x9e)]??_0x5df0a7[_0x569a96(0xa0)]??_0x55c8f3,'name':_0x35e8fc[_0x569a96(0x8d)]??_0x5df0a7[_0x569a96(0x9c)]??null,'table':_0x5ec483['tableName']??_0x5df0a7[_0x569a96(0x7f)]??null,'db':_0x5ec483[_0x569a96(0x96)]??_0x5ec483[_0x569a96(0xa8)]??null};}function deepClone(_0x5c9b47){const _0x434f11=a75_0x26ce25;if(_0x5c9b47===undefined)return _0x5c9b47;return JSON[_0x434f11(0xb9)](JSON[_0x434f11(0xb6)](_0x5c9b47));}function deepEqual(_0x45801b,_0x458616){const _0xb6981b=a75_0x26ce25;return JSON['stringify'](_0x45801b)===JSON[_0xb6981b(0xb6)](_0x458616);}function isPlainObject(_0x590e6d){const _0x150f21=a75_0x26ce25;return Boolean(_0x590e6d)&&typeof _0x590e6d===_0x150f21(0x81)&&!Array['isArray'](_0x590e6d);}function a75_0x37be(_0x5914c8,_0x4df534){_0x5914c8=_0x5914c8-0x7b;const _0x1c31cf=a75_0x1c31();let _0x37bed5=_0x1c31cf[_0x5914c8];return _0x37bed5;}function trim(_0x167ad6){const _0x31a96c=a75_0x26ce25,_0x54ce3b=String(_0x167ad6||'')[_0x31a96c(0xa3)]();return _0x54ce3b;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a76_0xeda4a0=a76_0x1f1a;function a76_0x57cd(){const _0x52612c=['Restore\x20one\x20Dataset\x20field\x20explicitly\x20deleted\x20by\x20a\x20user','26owCfcm','40800rziQmd','filter','--code\x20is\x20required','120050pavVcW','fields','dataset\x20field-restore\x20does\x20not\x20accept\x20--yes.','trim','POST','mutation-outcome-unknown','Dataset\x20field\x20restore\x20could\x20not\x20be\x20verified\x20for\x20','No\x20restore\x20request\x20was\x20sent.\x20Resolve\x20the\x20duplicate\x20server\x20metadata\x20first.','str','unknown','warnings','appCode','19489908KgbAHT','server-restored-count-mismatch','code','isArray','Restored\x20Dataset\x20field\x20','No\x20user-deleted\x20field\x20found\x20with\x20code:\x20','displayName','Dataset\x20field\x20restore\x20outcome\x20is\x20unknown\x20for\x20','5498937DTePSz','14lBTeyE','Exact\x20server\x20Dataset\x20field\x20code\x20to\x20restore','Matched\x20multiple\x20user-deleted\x20fields\x20with\x20code:\x20','Dataset\x20field\x20restore\x20readback\x20failed\x20for\x20','\x20would\x20be\x20restored','readback-failed','Restore\x20one\x20exact\x20user-deleted\x20field\x20code\x20at\x20a\x20time\x20with\x20--field.','Do\x20not\x20resubmit\x20field-restore\x20automatically;\x20inspect\x20user-deleted-field-list\x20and\x20dataset\x20detail\x20first.','Dataset\x20field\x20restoration\x20does\x20not\x20synchronize\x20or\x20publish\x20related\x20pages.','3260gquqCE','message','Run\x20the\x20same\x20single-field\x20command\x20with\x20--dry-run\x20first.','all','Use\x20`rabetbase\x20dataset\x20user-deleted-field-list\x20--code\x20<datasetCode>`\x20to\x20inspect\x20exact\x20field\x20codes.','1149270opLHTI','string','length','16FXsqEp','data','field','dataset','name','20hFZecW','7595980MyEyDp','/smartapi/dataset/restore-column','59906wdLqIa','requestedColumnIds','map','properties','confirm','object','write','deleted','dataset\x20field-restore\x20does\x20not\x20accept\x20--all.','57RcuCES','validation','field-restore','--field\x20is\x20required'];a76_0x57cd=function(){return _0x52612c;};return a76_0x57cd();}function a76_0x1f1a(_0x132607,_0x7e6ceb){_0x132607=_0x132607-0x18e;const _0x57cd99=a76_0x57cd();let _0x1f1a49=_0x57cd99[_0x132607];return _0x1f1a49;}(function(_0x5b7636,_0x1f835c){const _0x519b35=a76_0x1f1a,_0x3732c2=_0x5b7636();while(!![]){try{const _0x5b3418=parseInt(_0x519b35(0x190))/0x1*(-parseInt(_0x519b35(0x1a5))/0x2)+parseInt(_0x519b35(0x1c7))/0x3*(parseInt(_0x519b35(0x1cd))/0x4)+-parseInt(_0x519b35(0x1bb))/0x5*(-parseInt(_0x519b35(0x1b3))/0x6)+parseInt(_0x519b35(0x1bc))/0x7+-parseInt(_0x519b35(0x1b6))/0x8*(-parseInt(_0x519b35(0x1a4))/0x9)+parseInt(_0x519b35(0x1ae))/0xa*(parseInt(_0x519b35(0x1be))/0xb)+-parseInt(_0x519b35(0x19c))/0xc*(parseInt(_0x519b35(0x1cc))/0xd);if(_0x5b3418===_0x1f835c)break;else _0x3732c2['push'](_0x3732c2['shift']());}catch(_0x5ed364){_0x3732c2['push'](_0x3732c2['shift']());}}}(a76_0x57cd,0xe8dea));import{APPCODE_FLAG_OPTIONAL,CODE_FLAG}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{normalizeUserDeletedField,resolveDataset}from'../../commands/dataset/user-deleted-field-list.js';import{getDatasetDetail,isPlatformTransportFailure,listUserDeletedDatasetColumns,restoreDatasetColumns}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PAGE_SYNC_WARNING=a76_0xeda4a0(0x1ad),NO_RESUBMIT_WARNING=a76_0xeda4a0(0x1ac);export async function buildDatasetFieldRestoreResult({appCode:_0x3e02e4,input:_0x366b21,dryRun:_0x383c99}){const _0x39e747=a76_0xeda4a0,_0x36fb3f=_0x366b21['code'][_0x39e747(0x193)](),_0x57398f=_0x366b21['field'][_0x39e747(0x193)]();if(!_0x36fb3f)throw CliErrors[_0x39e747(0x1c8)](_0x39e747(0x18f));if(!_0x57398f)throw CliErrors[_0x39e747(0x1c8)]('--field\x20is\x20required');const _0x3957bc=await getDatasetDetail(_0x36fb3f),_0x2f2b44=resolveDataset(_0x3957bc,_0x36fb3f),_0x1afbc6=(await listUserDeletedDatasetColumns(_0x2f2b44['id']))[_0x39e747(0x1c0)](normalizeUserDeletedField),_0x138d5d=_0x1afbc6[_0x39e747(0x18e)](_0x2fe098=>_0x2fe098[_0x39e747(0x19e)]===_0x57398f);if(_0x138d5d[_0x39e747(0x1b5)]===0x0)throw CliErrors['validation'](_0x39e747(0x1a1)+_0x57398f,_0x39e747(0x1b2));if(_0x138d5d[_0x39e747(0x1b5)]>0x1)throw CliErrors[_0x39e747(0x1c8)](_0x39e747(0x1a7)+_0x57398f,_0x39e747(0x197));const _0x366221=_0x138d5d[0x0],_0xca9e7c={'id':_0x366221['id'],'code':_0x366221[_0x39e747(0x19e)],'displayName':_0x366221[_0x39e747(0x1a2)],'deleted':![],'active':!![]},_0x3ee59c={'operation':_0x39e747(0x1c9),'appCode':_0x3e02e4,'selector':{'code':_0x36fb3f,'field':_0x57398f},'dataset':_0x2f2b44,'before':_0x366221,'dryRun':_0x383c99,'warnings':[PAGE_SYNC_WARNING]};if(_0x383c99)return{'ok':!![],'data':{..._0x3ee59c,'after':_0xca9e7c,'backend':{'submitted':![],'requestedColumnIds':[_0x366221['id']],'restoredCount':null},'verification':{'performed':![],'passed':null}},'message':'Dry-run:\x20Dataset\x20field\x20'+_0x57398f+_0x39e747(0x1a9)};let _0x3c78d9=null,_0x49f850=![];try{_0x3c78d9=await restoreDatasetColumns(_0x2f2b44['id'],[_0x366221['id']]);}catch(_0x1e054f){if(!isPlatformTransportFailure(_0x1e054f))throw _0x1e054f;_0x49f850=!![];}const _0x2ef7bf={'submitted':!![],'requestedColumnIds':[_0x366221['id']],'restoredCount':_0x3c78d9,..._0x49f850?{'outcome':_0x39e747(0x199)}:{}};let _0xc80aa2,_0x9039ef;try{[_0xc80aa2,_0x9039ef]=await Promise[_0x39e747(0x1b1)]([listUserDeletedDatasetColumns(_0x2f2b44['id']),getDatasetDetail(_0x36fb3f)]);}catch{return{'ok':![],'data':{..._0x3ee59c,'after':null,'backend':_0x2ef7bf,'warnings':[..._0x3ee59c[_0x39e747(0x19a)],NO_RESUBMIT_WARNING],'verification':{'performed':![],'passed':![],'reason':_0x49f850?_0x39e747(0x195):_0x39e747(0x1aa)}},'message':_0x49f850?'Dataset\x20field\x20restore\x20outcome\x20is\x20unknown\x20for\x20'+_0x57398f+'.\x20'+NO_RESUBMIT_WARNING:_0x39e747(0x1a8)+_0x57398f+'.\x20'+NO_RESUBMIT_WARNING};}const _0x388cb6=!_0xc80aa2['some'](_0x51aeaa=>Number(_0x51aeaa['id'])===_0x366221['id']||_0x51aeaa[_0x39e747(0x19e)]===_0x57398f),_0x3351da=findActiveField(_0x9039ef,_0x366221['id'],_0x57398f),_0x535fb8=_0x3351da!==null,_0x58cbc5=!_0x49f850&&_0x3c78d9===0x1&&_0x388cb6&&_0x535fb8,_0x5703ab={'performed':!![],'deletedListCleared':_0x388cb6,'activeFieldPresent':_0x535fb8,'passed':_0x58cbc5,..._0x49f850?{'reason':_0x39e747(0x195)}:_0x3c78d9!==0x1?{'reason':_0x39e747(0x19d)}:{}};return{'ok':_0x58cbc5,'data':{..._0x3ee59c,'after':_0x3351da,'backend':_0x2ef7bf,'warnings':_0x58cbc5?_0x3ee59c[_0x39e747(0x19a)]:[..._0x3ee59c[_0x39e747(0x19a)],NO_RESUBMIT_WARNING],'verification':_0x5703ab},'message':_0x58cbc5?_0x39e747(0x1a0)+_0x57398f:_0x49f850?_0x39e747(0x1a3)+_0x57398f+'.\x20'+NO_RESUBMIT_WARNING:_0x39e747(0x196)+_0x57398f+'.\x20'+NO_RESUBMIT_WARNING};}export const datasetFieldRestore={'service':a76_0xeda4a0(0x1b9),'command':a76_0xeda4a0(0x1c9),'description':a76_0xeda4a0(0x1cb),'risk':a76_0xeda4a0(0x1c4),'structuredErrors':!![],'rejectedFlags':[{'name':'all','message':a76_0xeda4a0(0x1c6),'hint':a76_0xeda4a0(0x1ab)},{'name':'fields','message':'dataset\x20field-restore\x20does\x20not\x20accept\x20--fields.','hint':a76_0xeda4a0(0x1ab)},{'name':'yes','message':a76_0xeda4a0(0x192),'hint':a76_0xeda4a0(0x1b0)},{'name':a76_0xeda4a0(0x1c2),'message':'dataset\x20field-restore\x20does\x20not\x20accept\x20--confirm.','hint':a76_0xeda4a0(0x1b0)}],'flags':[CODE_FLAG,{'name':a76_0xeda4a0(0x1b8),'type':a76_0xeda4a0(0x1b4),'required':!![],'description':a76_0xeda4a0(0x1a6)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x214471){readInput(_0x214471);},async 'dryRun'(_0x4b2930){const _0x17a5a3=a76_0xeda4a0,_0x5f1c51=await buildDatasetFieldRestoreResult({'appCode':_0x4b2930[_0x17a5a3(0x19b)],'input':readInput(_0x4b2930),'dryRun':!![]});return asDryRunResult({..._0x5f1c51[_0x17a5a3(0x1b7)],'body':{'datasetId':_0x5f1c51[_0x17a5a3(0x1b7)][_0x17a5a3(0x1b9)]['id'],'columnIds':_0x5f1c51['data']['backend'][_0x17a5a3(0x1bf)]}},{'method':_0x17a5a3(0x194),'url':_0x17a5a3(0x1bd),'description':_0x5f1c51[_0x17a5a3(0x1af)]});},async 'execute'(_0x3ad735){const _0x2d54cb=a76_0xeda4a0;return buildDatasetFieldRestoreResult({'appCode':_0x3ad735[_0x2d54cb(0x19b)],'input':readInput(_0x3ad735),'dryRun':![]});}};function readInput(_0x2dc839){const _0x26e4a6=a76_0xeda4a0,_0x176c90={'code':String(_0x2dc839[_0x26e4a6(0x198)](_0x26e4a6(0x19e))||'')[_0x26e4a6(0x193)](),'field':String(_0x2dc839[_0x26e4a6(0x198)](_0x26e4a6(0x1b8))||'')[_0x26e4a6(0x193)]()};if(!_0x176c90[_0x26e4a6(0x19e)])throw CliErrors[_0x26e4a6(0x1c8)](_0x26e4a6(0x18f));if(!_0x176c90[_0x26e4a6(0x1b8)])throw CliErrors[_0x26e4a6(0x1c8)](_0x26e4a6(0x1ca));return _0x176c90;}function findActiveField(_0x32e425,_0xa8fe41,_0x3f9746){const _0x5f413e=a76_0xeda4a0,_0x1ffba1=Array[_0x5f413e(0x19f)](_0x32e425[_0x5f413e(0x191)]),_0xbcf25a=_0x1ffba1?_0x32e425[_0x5f413e(0x191)]:Array[_0x5f413e(0x19f)](_0x32e425[_0x5f413e(0x1c1)])?_0x32e425[_0x5f413e(0x1c1)]:[];for(const _0x1b7637 of _0xbcf25a){if(!_0x1b7637||typeof _0x1b7637!==_0x5f413e(0x1c3))continue;const _0x719499=_0x1b7637,_0x1b4baf=_0x1ffba1?_0x719499[_0x5f413e(0x1ba)]:_0x719499['code'],_0x32b8ad=_0x719499[_0x5f413e(0x1c5)]!==!![]&&Number(_0x719499['id'])===_0xa8fe41&&_0x1b4baf===_0x3f9746;if(!_0x32b8ad)continue;const _0x499afa=_0x1ffba1?_0x719499['displayName']:_0x719499['name'];return{'id':_0xa8fe41,'code':_0x3f9746,'displayName':typeof _0x499afa===_0x5f413e(0x1b4)&&_0x499afa?_0x499afa:_0x3f9746,'deleted':![],'active':!![]};}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a67_0x5d2c(_0x3cb1fc,_0x336a75){_0x3cb1fc=_0x3cb1fc-0xc6;const _0x5b7786=a67_0x5b77();let _0x5d2c97=_0x5b7786[_0x3cb1fc];return _0x5d2c97;}const a67_0x19e69c=a67_0x5d2c;(function(_0x222e76,_0x4df051){const _0x1e6a49=a67_0x5d2c,_0x59a909=_0x222e76();while(!![]){try{const _0x3e66c3=parseInt(_0x1e6a49(0xe7))/0x1*(-parseInt(_0x1e6a49(0xff))/0x2)+parseInt(_0x1e6a49(0x10e))/0x3*(parseInt(_0x1e6a49(0xf7))/0x4)+parseInt(_0x1e6a49(0xe5))/0x5+-parseInt(_0x1e6a49(0xeb))/0x6+-parseInt(_0x1e6a49(0xd2))/0x7+parseInt(_0x1e6a49(0xc9))/0x8+parseInt(_0x1e6a49(0xef))/0x9;if(_0x3e66c3===_0x4df051)break;else _0x59a909['push'](_0x59a909['shift']());}catch(_0x1333d5){_0x59a909['push'](_0x59a909['shift']());}}}(a67_0x5b77,0x7d0fa));import{getDatasetDetail,updateDrivenData}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL,CODE_FLAG}from'../../commands/common/flags.js';import{CliErrors}from'../../errors.js';const MUTABLE_FIELD_KEYS=new Set(['doType',a67_0x19e69c(0xec),a67_0x19e69c(0x109),a67_0x19e69c(0xf3),a67_0x19e69c(0xdc),'datetimeFormat',a67_0x19e69c(0xe1),'chartRole','deprecated']),FORBIDDEN_FIELD_KEYS=new Set(['id',a67_0x19e69c(0xe3),'code','dbType',a67_0x19e69c(0xf1),a67_0x19e69c(0x104),a67_0x19e69c(0xdf),a67_0x19e69c(0xea),a67_0x19e69c(0xf9),'pkField',a67_0x19e69c(0xd9),a67_0x19e69c(0x102)]);export function parseJsonObjectFlag(_0x666334,_0x25e151){const _0x1a4f42=a67_0x19e69c;if(!_0x666334)return undefined;let _0x59a42d;try{_0x59a42d=JSON['parse'](_0x666334);}catch(_0x5d48ea){const _0x49a7f1=_0x5d48ea instanceof Error?_0x5d48ea[_0x1a4f42(0xfb)]:String(_0x5d48ea);throw CliErrors[_0x1a4f42(0x10b)](_0x25e151+_0x1a4f42(0xe2)+_0x49a7f1);}if(!isPlainObject(_0x59a42d)||Array[_0x1a4f42(0x110)](_0x59a42d))throw CliErrors[_0x1a4f42(0x10b)](_0x25e151+_0x1a4f42(0xce));return _0x59a42d;}function a67_0x5b77(){const _0x2e2bd4=['validation','patch-json','stringify','1323867FqPXgy','findIndex','isArray','datasetCode','POST','dbId','Forbidden\x20patch\x20key:\x20','has','2117592yfoDhZ',',\x20actual\x20','Unsupported\x20patch\x20key:\x20','fields','expect-json','\x20must\x20be\x20a\x20JSON\x20object','--patch-json\x20must\x20contain\x20at\x20least\x20one\x20key','length','JSON\x20object\x20of\x20expected\x20current\x20field\x20values;\x20mismatch\x20aborts\x20without\x20writing','1527449fEXkMt','code','string','\x20would\x20change\x20(','Expectation\x20mismatch\x20at\x20','data','Patch\x20one\x20raw\x20dataset\x20fields[]\x20field\x20object\x20safely','autoIncrement','JSON\x20object\x20patch;\x20allowed\x20keys:\x20doType/displayName/description/options/required/datetimeFormat/defaultAggregation/chartRole/deprecated','appCode','required','str','properties','dbFieldName','Dry-run:\x20dataset\x20field\x20','defaultAggregation','\x20must\x20be\x20valid\x20JSON\x20object:\x20','name','No\x20changes\x20for\x20dataset\x20field\x20','4043450drCbcx','Expected\x20','1385JTVOJu','--code\x20is\x20required','add','tableName','1763406LqjWMV','displayName','dbtableConfig','modelId','1183905ZzbxMV','entries','dbTypeLen','datasetName','options','/smartapi/dataset/update-driven-data','keys','sort','4EahEFH','from','deleted','Updated\x20dataset\x20field\x20','message','join','parse','size','898SnzkBA','Exact\x20raw\x20fields[].name\x20to\x20patch','object','systemRetain','trim','dbTypeScale','dataset','field','--field\x20is\x20required','Field\x20not\x20found:\x20','description','--expect-json'];a67_0x5b77=function(){return _0x2e2bd4;};return a67_0x5b77();}export function validatePatchKeys(_0x41f6b5){const _0x99d3d8=a67_0x19e69c,_0x1489e0=Object[_0x99d3d8(0xf5)](_0x41f6b5);if(_0x1489e0[_0x99d3d8(0xd0)]===0x0)throw CliErrors[_0x99d3d8(0x10b)](_0x99d3d8(0xcf));for(const _0x18efe8 of _0x1489e0){if(FORBIDDEN_FIELD_KEYS[_0x99d3d8(0xc8)](_0x18efe8))throw CliErrors['validation'](_0x99d3d8(0xc7)+_0x18efe8);if(!MUTABLE_FIELD_KEYS[_0x99d3d8(0xc8)](_0x18efe8))throw CliErrors['validation'](_0x99d3d8(0xcb)+_0x18efe8,'Allowed\x20keys:\x20'+Array[_0x99d3d8(0xf8)](MUTABLE_FIELD_KEYS)['join'](',\x20'));}}export function applyFieldPatch(_0xf6424a,_0x214e82){const _0x1df30f=a67_0x19e69c;validatePatchKeys(_0x214e82);const _0x3ee38c=deepClone(_0xf6424a),_0x5d9481=new Set();for(const [_0x10a10c,_0x50cf75]of Object[_0x1df30f(0xf0)](_0x214e82)){const _0x3664f5=_0x3ee38c[_0x10a10c],_0x1fd312=mergePatchValue(_0x3664f5,_0x50cf75);!deepEqual(_0x3664f5,_0x1fd312)&&(_0x3ee38c[_0x10a10c]=_0x1fd312,_0x5d9481[_0x1df30f(0xe9)](_0x10a10c),collectChangedPaths(_0x10a10c,_0x3664f5,_0x1fd312,_0x5d9481));}return{'after':_0x3ee38c,'changedPaths':Array['from'](_0x5d9481)[_0x1df30f(0xf6)](),'changed':_0x5d9481[_0x1df30f(0xfe)]>0x0};}export function assertExpectation(_0x5eee69,_0x2b2fff){const _0x40b077=a67_0x19e69c;if(!_0x2b2fff)return;for(const [_0x35613f,_0x534d1f]of Object[_0x40b077(0xf0)](_0x2b2fff)){const _0x31e464=_0x5eee69[_0x35613f];if(!deepEqual(_0x31e464,_0x534d1f))throw CliErrors[_0x40b077(0x10b)](_0x40b077(0xd6)+_0x35613f,_0x40b077(0xe6)+JSON[_0x40b077(0x10d)](_0x534d1f)+_0x40b077(0xca)+JSON[_0x40b077(0x10d)](_0x31e464));}}export async function buildDatasetFieldUpdateResult({appCode:_0x5a5113,input:_0x5e942b,dryRun:_0x38bfa0}){const _0x2e9c3c=a67_0x19e69c;validateInput(_0x5e942b);const _0x162d00=await getDatasetDetail(_0x5e942b[_0x2e9c3c(0xd3)]),_0xc41871=readFieldArray(_0x162d00),_0x1bbb83=_0xc41871[_0x2e9c3c(0x10f)](_0x46f891=>_0x46f891?.['name']===_0x5e942b[_0x2e9c3c(0x106)]);if(_0x1bbb83<0x0)throw CliErrors[_0x2e9c3c(0x10b)](_0x2e9c3c(0x108)+_0x5e942b[_0x2e9c3c(0x106)]);const _0x25da3e=deepClone(_0xc41871[_0x1bbb83]);assertExpectation(_0x25da3e,_0x5e942b['expect']);const {after:_0x13aab2,changedPaths:_0x952cd3,changed:_0x30c7d7}=applyFieldPatch(_0x25da3e,_0x5e942b['patch']),_0x28b7a9=summarizeDataset(_0x162d00,_0x5e942b['code']);return _0x30c7d7&&!_0x38bfa0&&(_0xc41871[_0x1bbb83]=_0x13aab2,await updateDrivenData(_0x162d00)),{'ok':!![],'data':{'appCode':_0x5a5113,'selector':{'code':_0x5e942b['code']},'dataset':_0x28b7a9,'field':{'id':_0x25da3e['id']??null,'name':_0x25da3e[_0x2e9c3c(0xe3)]},'dryRun':_0x38bfa0,'changed':_0x30c7d7,'changedPaths':_0x952cd3,'before':_0x25da3e,'after':_0x13aab2,'submitted':_0x30c7d7&&!_0x38bfa0},'message':_0x30c7d7?_0x38bfa0?_0x2e9c3c(0xe0)+_0x5e942b[_0x2e9c3c(0x106)]+_0x2e9c3c(0xd5)+_0x952cd3[_0x2e9c3c(0xfc)](',\x20')+')':_0x2e9c3c(0xfa)+_0x5e942b[_0x2e9c3c(0x106)]+'\x20('+_0x952cd3[_0x2e9c3c(0xfc)](',\x20')+')':_0x2e9c3c(0xe4)+_0x5e942b[_0x2e9c3c(0x106)]};}export const datasetFieldUpdate={'service':'dataset','command':'field-update','description':a67_0x19e69c(0xd8),'risk':'write','flags':[CODE_FLAG,{'name':'field','type':a67_0x19e69c(0xd4),'required':!![],'description':a67_0x19e69c(0x100)},{'name':a67_0x19e69c(0x10c),'type':'string','required':!![],'description':a67_0x19e69c(0xda)},{'name':a67_0x19e69c(0xcd),'type':a67_0x19e69c(0xd4),'required':![],'description':a67_0x19e69c(0xd1)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2efd87){validateInput(readFieldUpdateInput(_0x2efd87));},async 'dryRun'(_0x1cc12c){const _0x552343=a67_0x19e69c,_0x226106=await buildDatasetFieldUpdateResult({'appCode':_0x1cc12c['appCode'],'input':readFieldUpdateInput(_0x1cc12c),'dryRun':!![]});return{'method':_0x552343(0x112),'url':_0x552343(0xf4),'body':_0x226106[_0x552343(0xd7)],'description':_0x226106[_0x552343(0xfb)]};},async 'execute'(_0x2744c){const _0x3b4b38=a67_0x19e69c;return buildDatasetFieldUpdateResult({'appCode':_0x2744c[_0x3b4b38(0xdb)],'input':readFieldUpdateInput(_0x2744c),'dryRun':![]});}};function readFieldUpdateInput(_0x58eeaf){const _0x2a4567=a67_0x19e69c,_0x3dedd3=trim(_0x58eeaf[_0x2a4567(0xdd)]('code')),_0x545675=emptyToUndefined(_0x58eeaf['str'](_0x2a4567(0x106))),_0x7bc7e0=parseJsonObjectFlag(_0x58eeaf[_0x2a4567(0xdd)](_0x2a4567(0x10c)),'--patch-json'),_0x59b261=parseJsonObjectFlag(_0x58eeaf[_0x2a4567(0xdd)](_0x2a4567(0xcd)),_0x2a4567(0x10a));return{'code':_0x3dedd3,'field':_0x545675||'','patch':_0x7bc7e0||{},'expect':_0x59b261};}function validateInput(_0x45af9c){const _0x307e94=a67_0x19e69c;if(!_0x45af9c['code'])throw CliErrors[_0x307e94(0x10b)](_0x307e94(0xe8));if(!_0x45af9c[_0x307e94(0x106)])throw CliErrors['validation'](_0x307e94(0x107));validatePatchKeys(_0x45af9c['patch']);}function readFieldArray(_0x4f23db){const _0x3584b3=a67_0x19e69c;if(Array[_0x3584b3(0x110)](_0x4f23db[_0x3584b3(0xcc)]))return _0x4f23db[_0x3584b3(0xcc)];if(Array[_0x3584b3(0x110)](_0x4f23db[_0x3584b3(0xde)]))return _0x4f23db['properties'];throw CliErrors['validation']('Driven\x20data\x20does\x20not\x20contain\x20fields[]\x20or\x20properties[]');}function summarizeDataset(_0x16c2ac,_0x310cf2){const _0x36ca59=a67_0x19e69c,_0x529457=isPlainObject(_0x16c2ac['dataset'])?_0x16c2ac[_0x36ca59(0x105)]:{},_0x5d5866=isPlainObject(_0x16c2ac[_0x36ca59(0xed)])?_0x16c2ac['dbtableConfig']:{};return{'id':_0x16c2ac[_0x36ca59(0xee)]??_0x16c2ac['id']??_0x529457['datasetId']??null,'code':_0x16c2ac['modelCode']??_0x16c2ac['code']??_0x529457[_0x36ca59(0x111)]??_0x310cf2,'name':_0x16c2ac[_0x36ca59(0xe3)]??_0x529457[_0x36ca59(0xf2)]??null,'table':_0x5d5866[_0x36ca59(0xea)]??_0x529457[_0x36ca59(0xea)]??null,'db':_0x5d5866['dbName']??_0x5d5866[_0x36ca59(0xc6)]??null};}function mergePatchValue(_0x542f6d,_0x3b3f65){if(isPlainObject(_0x542f6d)&&isPlainObject(_0x3b3f65))return deepMerge(_0x542f6d,_0x3b3f65);return deepClone(_0x3b3f65);}function deepMerge(_0x2f5dac,_0x423854){const _0x486cbf=a67_0x19e69c,_0x1c8775=deepClone(_0x2f5dac);for(const [_0x24a5a1,_0x1fee2f]of Object[_0x486cbf(0xf0)](_0x423854)){_0x1c8775[_0x24a5a1]=isPlainObject(_0x1c8775[_0x24a5a1])&&isPlainObject(_0x1fee2f)?deepMerge(_0x1c8775[_0x24a5a1],_0x1fee2f):deepClone(_0x1fee2f);}return _0x1c8775;}function collectChangedPaths(_0x353673,_0x16fc86,_0x2baabd,_0x41ed73){if(!isPlainObject(_0x16fc86)||!isPlainObject(_0x2baabd))return;const _0x1958b4=new Set([...Object['keys'](_0x16fc86),...Object['keys'](_0x2baabd)]);for(const _0x2bbd25 of _0x1958b4){const _0x3e7745=_0x16fc86[_0x2bbd25],_0x2c5ef8=_0x2baabd[_0x2bbd25];!deepEqual(_0x3e7745,_0x2c5ef8)&&_0x41ed73['add'](_0x353673+'.'+_0x2bbd25);}}function deepClone(_0x143d28){const _0x13d639=a67_0x19e69c;if(_0x143d28===undefined)return _0x143d28;return JSON[_0x13d639(0xfd)](JSON['stringify'](_0x143d28));}function deepEqual(_0x23a8ed,_0x36dd03){const _0x4c2d3c=a67_0x19e69c;return JSON[_0x4c2d3c(0x10d)](_0x23a8ed)===JSON[_0x4c2d3c(0x10d)](_0x36dd03);}function isPlainObject(_0x5d8454){const _0x40a0ac=a67_0x19e69c;return Boolean(_0x5d8454)&&typeof _0x5d8454===_0x40a0ac(0x101)&&!Array['isArray'](_0x5d8454);}function emptyToUndefined(_0x30cdf2){const _0x1135c6=a67_0x19e69c,_0x5f5071=String(_0x30cdf2||'')[_0x1135c6(0x103)]();return _0x5f5071||undefined;}function trim(_0x7d4f0a){const _0x2f46d4=a67_0x19e69c;return String(_0x7d4f0a||'')[_0x2f46d4(0x103)]();}
|
|
1
|
+
const a77_0x34daad=a77_0x437a;(function(_0x6528ce,_0x4cfd10){const _0x3d3402=a77_0x437a,_0x7ccc50=_0x6528ce();while(!![]){try{const _0x4c7ea4=parseInt(_0x3d3402(0xbb))/0x1+-parseInt(_0x3d3402(0xac))/0x2+parseInt(_0x3d3402(0xcf))/0x3*(parseInt(_0x3d3402(0xbe))/0x4)+parseInt(_0x3d3402(0x9d))/0x5+-parseInt(_0x3d3402(0xa5))/0x6*(-parseInt(_0x3d3402(0xd2))/0x7)+parseInt(_0x3d3402(0xc7))/0x8+-parseInt(_0x3d3402(0xa2))/0x9*(parseInt(_0x3d3402(0xaa))/0xa);if(_0x4c7ea4===_0x4cfd10)break;else _0x7ccc50['push'](_0x7ccc50['shift']());}catch(_0x5f458e){_0x7ccc50['push'](_0x7ccc50['shift']());}}}(a77_0x407d,0x49352));import{getDatasetDetail,updateDrivenData}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL,CODE_FLAG}from'../../commands/common/flags.js';import{CliErrors}from'../../errors.js';const MUTABLE_FIELD_KEYS=new Set(['doType','displayName','description',a77_0x34daad(0x91),a77_0x34daad(0xc2),a77_0x34daad(0x92),'defaultAggregation',a77_0x34daad(0xaf),a77_0x34daad(0xc9)]),FORBIDDEN_FIELD_KEYS=new Set(['id',a77_0x34daad(0xd4),a77_0x34daad(0xb4),a77_0x34daad(0xbd),a77_0x34daad(0xb9),a77_0x34daad(0xc0),'dbFieldName',a77_0x34daad(0xa6),'deleted',a77_0x34daad(0xc5),'autoIncrement',a77_0x34daad(0xd3)]);export function parseJsonObjectFlag(_0x3fe605,_0x5ae081){const _0x1ef6e9=a77_0x34daad;if(!_0x3fe605)return undefined;let _0x1eb8c7;try{_0x1eb8c7=JSON[_0x1ef6e9(0xae)](_0x3fe605);}catch(_0x4965d8){const _0x408ded=_0x4965d8 instanceof Error?_0x4965d8[_0x1ef6e9(0x9c)]:String(_0x4965d8);throw CliErrors[_0x1ef6e9(0xb8)](_0x5ae081+_0x1ef6e9(0x9e)+_0x408ded);}if(!isPlainObject(_0x1eb8c7)||Array[_0x1ef6e9(0xcd)](_0x1eb8c7))throw CliErrors[_0x1ef6e9(0xb8)](_0x5ae081+_0x1ef6e9(0xab));return _0x1eb8c7;}function a77_0x407d(){const _0x57b545=['--code\x20is\x20required','entries','fields',',\x20actual\x20','appCode','dbtableConfig','dbName','--expect-json','message','1287290rRGKLK','\x20must\x20be\x20valid\x20JSON\x20object:\x20','patch','--patch-json\x20must\x20contain\x20at\x20least\x20one\x20key','properties','27mKsNFz','No\x20changes\x20for\x20dataset\x20field\x20','join','6ipmiZj','tableName','datasetCode','string','add','1888970jKRNUP','\x20must\x20be\x20a\x20JSON\x20object','612584UZVgBC','Exact\x20raw\x20fields[].name\x20to\x20patch','parse','chartRole','modelId','Unsupported\x20patch\x20key:\x20','Patch\x20one\x20raw\x20dataset\x20fields[]\x20field\x20object\x20safely','Expectation\x20mismatch\x20at\x20','code','str','POST','sort','validation','dbTypeLen','size','294103kfXxmu','trim','dbType','58196QABaYM','Forbidden\x20patch\x20key:\x20','dbTypeScale','Field\x20not\x20found:\x20','required','Dry-run:\x20dataset\x20field\x20','keys','pkField','field-update','4390528QyvBPP','findIndex','deprecated','/smartapi/dataset/update-driven-data','dbId','expect','isArray','data','9LkSRYU','modelCode','stringify','201719aXDQLM','systemRetain','name','--field\x20is\x20required','datasetId','datasetName','from','dataset','field','has','object','options','datetimeFormat','expect-json'];a77_0x407d=function(){return _0x57b545;};return a77_0x407d();}export function validatePatchKeys(_0x39cd57){const _0x293226=a77_0x34daad,_0x5b7141=Object['keys'](_0x39cd57);if(_0x5b7141['length']===0x0)throw CliErrors[_0x293226(0xb8)](_0x293226(0xa0));for(const _0x355f5c of _0x5b7141){if(FORBIDDEN_FIELD_KEYS[_0x293226(0x8f)](_0x355f5c))throw CliErrors['validation'](_0x293226(0xbf)+_0x355f5c);if(!MUTABLE_FIELD_KEYS['has'](_0x355f5c))throw CliErrors[_0x293226(0xb8)](_0x293226(0xb1)+_0x355f5c,'Allowed\x20keys:\x20'+Array[_0x293226(0x8c)](MUTABLE_FIELD_KEYS)['join'](',\x20'));}}export function applyFieldPatch(_0x2dbeb5,_0x367b67){const _0x279b97=a77_0x34daad;validatePatchKeys(_0x367b67);const _0x4b5709=deepClone(_0x2dbeb5),_0x255a2a=new Set();for(const [_0x2e3935,_0x1e9fe5]of Object[_0x279b97(0x95)](_0x367b67)){const _0x2bae41=_0x4b5709[_0x2e3935],_0x248281=mergePatchValue(_0x2bae41,_0x1e9fe5);!deepEqual(_0x2bae41,_0x248281)&&(_0x4b5709[_0x2e3935]=_0x248281,_0x255a2a[_0x279b97(0xa9)](_0x2e3935),collectChangedPaths(_0x2e3935,_0x2bae41,_0x248281,_0x255a2a));}return{'after':_0x4b5709,'changedPaths':Array['from'](_0x255a2a)[_0x279b97(0xb7)](),'changed':_0x255a2a[_0x279b97(0xba)]>0x0};}export function assertExpectation(_0x5129ab,_0x373f80){const _0x2091c5=a77_0x34daad;if(!_0x373f80)return;for(const [_0x311a05,_0x3cdb7e]of Object[_0x2091c5(0x95)](_0x373f80)){const _0x208d2a=_0x5129ab[_0x311a05];if(!deepEqual(_0x208d2a,_0x3cdb7e))throw CliErrors[_0x2091c5(0xb8)](_0x2091c5(0xb3)+_0x311a05,'Expected\x20'+JSON[_0x2091c5(0xd1)](_0x3cdb7e)+_0x2091c5(0x97)+JSON[_0x2091c5(0xd1)](_0x208d2a));}}export async function buildDatasetFieldUpdateResult({appCode:_0x5b8930,input:_0x25c826,dryRun:_0x1f70ba}){const _0x455941=a77_0x34daad;validateInput(_0x25c826);const _0x2b4ac0=await getDatasetDetail(_0x25c826['code']),_0x548d1a=readFieldArray(_0x2b4ac0),_0x289f07=_0x548d1a[_0x455941(0xc8)](_0x413d74=>_0x413d74?.[_0x455941(0xd4)]===_0x25c826[_0x455941(0x8e)]);if(_0x289f07<0x0)throw CliErrors[_0x455941(0xb8)](_0x455941(0xc1)+_0x25c826['field']);const _0x294716=deepClone(_0x548d1a[_0x289f07]);assertExpectation(_0x294716,_0x25c826[_0x455941(0xcc)]);const {after:_0x146fe0,changedPaths:_0x547c92,changed:_0x2b8451}=applyFieldPatch(_0x294716,_0x25c826[_0x455941(0x9f)]),_0x44f686=summarizeDataset(_0x2b4ac0,_0x25c826[_0x455941(0xb4)]);return _0x2b8451&&!_0x1f70ba&&(_0x548d1a[_0x289f07]=_0x146fe0,await updateDrivenData(_0x2b4ac0)),{'ok':!![],'data':{'appCode':_0x5b8930,'selector':{'code':_0x25c826[_0x455941(0xb4)]},'dataset':_0x44f686,'field':{'id':_0x294716['id']??null,'name':_0x294716['name']},'dryRun':_0x1f70ba,'changed':_0x2b8451,'changedPaths':_0x547c92,'before':_0x294716,'after':_0x146fe0,'submitted':_0x2b8451&&!_0x1f70ba},'message':_0x2b8451?_0x1f70ba?_0x455941(0xc3)+_0x25c826[_0x455941(0x8e)]+'\x20would\x20change\x20('+_0x547c92['join'](',\x20')+')':'Updated\x20dataset\x20field\x20'+_0x25c826[_0x455941(0x8e)]+'\x20('+_0x547c92[_0x455941(0xa4)](',\x20')+')':_0x455941(0xa3)+_0x25c826[_0x455941(0x8e)]};}export const datasetFieldUpdate={'service':a77_0x34daad(0x8d),'command':a77_0x34daad(0xc6),'description':a77_0x34daad(0xb2),'risk':'write','flags':[CODE_FLAG,{'name':a77_0x34daad(0x8e),'type':a77_0x34daad(0xa8),'required':!![],'description':a77_0x34daad(0xad)},{'name':'patch-json','type':a77_0x34daad(0xa8),'required':!![],'description':'JSON\x20object\x20patch;\x20allowed\x20keys:\x20doType/displayName/description/options/required/datetimeFormat/defaultAggregation/chartRole/deprecated'},{'name':'expect-json','type':a77_0x34daad(0xa8),'required':![],'description':'JSON\x20object\x20of\x20expected\x20current\x20field\x20values;\x20mismatch\x20aborts\x20without\x20writing'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x5d3b17){validateInput(readFieldUpdateInput(_0x5d3b17));},async 'dryRun'(_0x212c6f){const _0x3a221e=a77_0x34daad,_0x10ef66=await buildDatasetFieldUpdateResult({'appCode':_0x212c6f[_0x3a221e(0x98)],'input':readFieldUpdateInput(_0x212c6f),'dryRun':!![]});return{'method':_0x3a221e(0xb6),'url':_0x3a221e(0xca),'body':_0x10ef66[_0x3a221e(0xce)],'description':_0x10ef66[_0x3a221e(0x9c)]};},async 'execute'(_0x131eda){const _0xf264dc=a77_0x34daad;return buildDatasetFieldUpdateResult({'appCode':_0x131eda[_0xf264dc(0x98)],'input':readFieldUpdateInput(_0x131eda),'dryRun':![]});}};function readFieldUpdateInput(_0x5ce9a3){const _0x3149a8=a77_0x34daad,_0x47bcc7=trim(_0x5ce9a3[_0x3149a8(0xb5)](_0x3149a8(0xb4))),_0x5d29f0=emptyToUndefined(_0x5ce9a3[_0x3149a8(0xb5)]('field')),_0x98aa93=parseJsonObjectFlag(_0x5ce9a3[_0x3149a8(0xb5)]('patch-json'),'--patch-json'),_0x2a9868=parseJsonObjectFlag(_0x5ce9a3[_0x3149a8(0xb5)](_0x3149a8(0x93)),_0x3149a8(0x9b));return{'code':_0x47bcc7,'field':_0x5d29f0||'','patch':_0x98aa93||{},'expect':_0x2a9868};}function validateInput(_0x16c352){const _0x4eb254=a77_0x34daad;if(!_0x16c352['code'])throw CliErrors[_0x4eb254(0xb8)](_0x4eb254(0x94));if(!_0x16c352[_0x4eb254(0x8e)])throw CliErrors['validation'](_0x4eb254(0xd5));validatePatchKeys(_0x16c352[_0x4eb254(0x9f)]);}function readFieldArray(_0x400a08){const _0xae1cbb=a77_0x34daad;if(Array[_0xae1cbb(0xcd)](_0x400a08[_0xae1cbb(0x96)]))return _0x400a08[_0xae1cbb(0x96)];if(Array[_0xae1cbb(0xcd)](_0x400a08[_0xae1cbb(0xa1)]))return _0x400a08[_0xae1cbb(0xa1)];throw CliErrors['validation']('Driven\x20data\x20does\x20not\x20contain\x20fields[]\x20or\x20properties[]');}function summarizeDataset(_0x2712a1,_0x3cd525){const _0x71451e=a77_0x34daad,_0x12e5e5=isPlainObject(_0x2712a1[_0x71451e(0x8d)])?_0x2712a1[_0x71451e(0x8d)]:{},_0x54e288=isPlainObject(_0x2712a1[_0x71451e(0x99)])?_0x2712a1['dbtableConfig']:{};return{'id':_0x2712a1[_0x71451e(0xb0)]??_0x2712a1['id']??_0x12e5e5[_0x71451e(0xd6)]??null,'code':_0x2712a1[_0x71451e(0xd0)]??_0x2712a1[_0x71451e(0xb4)]??_0x12e5e5[_0x71451e(0xa7)]??_0x3cd525,'name':_0x2712a1['name']??_0x12e5e5[_0x71451e(0x8b)]??null,'table':_0x54e288[_0x71451e(0xa6)]??_0x12e5e5[_0x71451e(0xa6)]??null,'db':_0x54e288[_0x71451e(0x9a)]??_0x54e288[_0x71451e(0xcb)]??null};}function mergePatchValue(_0x37dcc6,_0x160563){if(isPlainObject(_0x37dcc6)&&isPlainObject(_0x160563))return deepMerge(_0x37dcc6,_0x160563);return deepClone(_0x160563);}function deepMerge(_0x275909,_0x1bec0c){const _0x1953c5=a77_0x34daad,_0x4e26bf=deepClone(_0x275909);for(const [_0x142b2d,_0x2575bf]of Object[_0x1953c5(0x95)](_0x1bec0c)){_0x4e26bf[_0x142b2d]=isPlainObject(_0x4e26bf[_0x142b2d])&&isPlainObject(_0x2575bf)?deepMerge(_0x4e26bf[_0x142b2d],_0x2575bf):deepClone(_0x2575bf);}return _0x4e26bf;}function collectChangedPaths(_0x17aa07,_0x5f3e10,_0x1e4e2b,_0x501d53){const _0x26f2f4=a77_0x34daad;if(!isPlainObject(_0x5f3e10)||!isPlainObject(_0x1e4e2b))return;const _0x3410e7=new Set([...Object[_0x26f2f4(0xc4)](_0x5f3e10),...Object['keys'](_0x1e4e2b)]);for(const _0x22cb29 of _0x3410e7){const _0x83b870=_0x5f3e10[_0x22cb29],_0x4ccb5d=_0x1e4e2b[_0x22cb29];!deepEqual(_0x83b870,_0x4ccb5d)&&_0x501d53[_0x26f2f4(0xa9)](_0x17aa07+'.'+_0x22cb29);}}function deepClone(_0x26ad50){const _0x48d29d=a77_0x34daad;if(_0x26ad50===undefined)return _0x26ad50;return JSON[_0x48d29d(0xae)](JSON[_0x48d29d(0xd1)](_0x26ad50));}function deepEqual(_0x6f01ed,_0xfc4d6d){const _0x4dc2ab=a77_0x34daad;return JSON[_0x4dc2ab(0xd1)](_0x6f01ed)===JSON['stringify'](_0xfc4d6d);}function isPlainObject(_0x433a2e){const _0x5dd566=a77_0x34daad;return Boolean(_0x433a2e)&&typeof _0x433a2e===_0x5dd566(0x90)&&!Array['isArray'](_0x433a2e);}function emptyToUndefined(_0x3b46c7){const _0xe8bdae=a77_0x34daad,_0x384c33=String(_0x3b46c7||'')[_0xe8bdae(0xbc)]();return _0x384c33||undefined;}function a77_0x437a(_0x1bfbdd,_0x46258b){_0x1bfbdd=_0x1bfbdd-0x8b;const _0x407dff=a77_0x407d();let _0x437a91=_0x407dff[_0x1bfbdd];return _0x437a91;}function trim(_0x2393b9){const _0x29552e=a77_0x34daad;return String(_0x2393b9||'')[_0x29552e(0xbc)]();}
|