@lovrabet/rabetbase-cli 2.5.3-beta.2 → 2.5.3-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.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 +12 -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 +4 -1
- package/skills/rabetbase/SKILL.md +10 -6
- package/skills/rabetbase/guides/sdk-client-generation.md +112 -61
- 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 +60 -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 +4 -3
- package/templates/README.md +16 -4
- 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_0xf9ebde=a71_0x3737;(function(_0x25b4c4,_0x1779fc){const _0x228a65=a71_0x3737,_0x23794f=_0x25b4c4();while(!![]){try{const _0x1d4151=parseInt(_0x228a65(0x1da))/0x1*(parseInt(_0x228a65(0x1d0))/0x2)+-parseInt(_0x228a65(0x1d3))/0x3+-parseInt(_0x228a65(0x215))/0x4*(-parseInt(_0x228a65(0x1e6))/0x5)+parseInt(_0x228a65(0x1e1))/0x6*(-parseInt(_0x228a65(0x1f1))/0x7)+parseInt(_0x228a65(0x1e4))/0x8+parseInt(_0x228a65(0x200))/0x9+-parseInt(_0x228a65(0x1cf))/0xa*(parseInt(_0x228a65(0x1cc))/0xb);if(_0x1d4151===_0x1779fc)break;else _0x23794f['push'](_0x23794f['shift']());}catch(_0x4fba95){_0x23794f['push'](_0x23794f['shift']());}}}(a71_0x3cc6,0xe74ea));import{getDatasetDetail,queryCrossDbRelations}from'../../core/api-client.js';import{CROSS_DB_RELATION_PATHS}from'../../core/cross-db-relation.js';function a71_0x3737(_0x5c0720,_0x59b8b2){_0x5c0720=_0x5c0720-0x1c8;const _0x3cc621=a71_0x3cc6();let _0x3737dd=_0x3cc621[_0x5c0720];return _0x3737dd;}import{CliError,CliErrors}from'../../errors.js';import{CROSS_RELATION_CARDINALITY_FLAG}from'../../commands/common/flags.js';function required(_0x33b2a0,_0x128dac){const _0x5206f4=a71_0x3737,_0x5cc951=_0x33b2a0[_0x5206f4(0x1e0)](_0x128dac)[_0x5206f4(0x204)]();if(!_0x5cc951)throw CliErrors[_0x5206f4(0x201)](_0x128dac);return _0x5cc951;}function explicitDblink(_0x172735){const _0x249a98=a71_0x3737,_0xef41ff=_0x172735['flag'](_0x249a98(0x206));if(_0xef41ff===undefined||_0xef41ff===null)return undefined;const _0x4f0092=Number(_0xef41ff);if(!Number[_0x249a98(0x21a)](_0x4f0092)||_0x4f0092<=0x0)throw CliErrors[_0x249a98(0x208)]('--from-dblink-id\x20must\x20be\x20a\x20positive\x20safe\x20integer.');return _0x4f0092;}function a71_0x3cc6(){const _0x5d5b32=['create','\x20write\x20was\x20not\x20verified.','trim','body','from-dblink-id','dataset','validation','sourceType','fromField','Provide\x20--from-datasetcode\x20or\x20--from-dblink-id.','delete','before','Dataset\x20','from-column','Multiple\x20cross-database\x20relations\x20match\x20this\x20source\x20field;\x20update/delete\x20cannot\x20select\x20one\x20target.','update','expectedLabel','Run\x20dataset\x20cross-relation-list\x20to\x20inspect\x20the\x20candidates.\x20This\x20command\x20accepts\x20only\x20a\x20source\x20dataset\x20and\x20field.','datasetCode','4MUJzJo','Cross-database\x20relation\x20','\x20must\x20be\x20a\x20DB_TABLE\x20dataset.','extend','from-datasetcode','isSafeInteger','relationId','fromDatasetName','catch','toDatasetName','\x20is\x20missing\x20its\x20database\x20connection\x20or\x20physical\x20table\x20name.','defineProperty','toDblinkId','tableName','string','length','parse','Cross-database\x20relation\x20already\x20exists\x20for\x20these\x20source\x20and\x20target\x20endpoints.','4310801oomQeJ','refTableLabelName','filter','20BYpBEN','227002rzeYrN','list','to-label-column','1687071PFdfGU','data','message','includes','POST','dbtable','toTableName','4rEdKEV','to-column','toLowerCase','to-datasetcode','toField','query','str','1960164hTfiWL','--from-dblink-id\x20does\x20not\x20match\x20the\x20source\x20dataset\x20connection.','The\x20target\x20display\x20field\x20is\x20inherited.\x20When\x20changing\x20the\x20target\x20dataset,\x20provide\x20--to-label-column\x20explicitly.','1144384AHKmFY','cardinality','5002025KrltGL','appCode','multiple\x20cross-database\x20relations\x20matched','DB_TABLE','map','\x20a\x20cross-database\x20relation\x20for\x20','some','Cross-database\x20relation\x20not\x20found\x20for\x20this\x20source\x20dataset\x20and\x20field.','fromDatasetCode','apiError','unconfirmed','7oNvNcJ','from','label_inherited','table','toDatasetCode','dblinkId','fromDblinkId','Cross-database\x20relations\x20require\x20different\x20source\x20and\x20target\x20database\x20connections.','Invalid\x20--cardinality.','fromTableName','relationType','\x20has\x20invalid\x20storage\x20configuration.','dbtableConfig','storageProfile','dbId','9205290lDUlhJ','flagMissing'];a71_0x3cc6=function(){return _0x5d5b32;};return a71_0x3cc6();}export function validateCrossRelation(_0x1e410f,_0xe988d2){const _0xb63f51=a71_0x3737,_0x5a5a7f=explicitDblink(_0x1e410f);if(_0xe988d2===_0xb63f51(0x1d1)){if(!_0x1e410f[_0xb63f51(0x1e0)]('from-datasetcode')['trim']()&&_0x5a5a7f===undefined)throw CliErrors[_0xb63f51(0x208)](_0xb63f51(0x20b));return;}required(_0x1e410f,_0xb63f51(0x219)),required(_0x1e410f,_0xb63f51(0x20f));if(_0xe988d2!==_0xb63f51(0x20c)){required(_0x1e410f,_0xb63f51(0x1dd)),required(_0x1e410f,_0xb63f51(0x1db));const _0x378f60=_0x1e410f[_0xb63f51(0x1e0)](_0xb63f51(0x1e5))['trim']();if(_0x378f60&&!CROSS_RELATION_CARDINALITY_FLAG['enum'][_0xb63f51(0x1d6)](_0x378f60))throw CliErrors[_0xb63f51(0x208)](_0xb63f51(0x1f9));}}async function resolveEndpoint(_0xd05b14){const _0x1c271d=a71_0x3737,_0x2ce7b6=await getDatasetDetail(_0xd05b14),_0x3ca632=_0x2ce7b6?.[_0x1c271d(0x207)]??{};if((_0x2ce7b6?.['source']??_0x3ca632[_0x1c271d(0x209)])!==_0x1c271d(0x1e9))throw CliErrors['validation'](_0x1c271d(0x20e)+_0xd05b14+_0x1c271d(0x217));const _0x519646=_0x2ce7b6[_0x1c271d(0x1fd)]??_0x2ce7b6[_0x1c271d(0x1d8)]??{};let _0x5de883=_0x2ce7b6[_0x1c271d(0x218)]??_0x3ca632[_0x1c271d(0x218)]??{};if(typeof _0x5de883===_0x1c271d(0x1c8))try{_0x5de883=_0x5de883[_0x1c271d(0x204)]()?JSON[_0x1c271d(0x1ca)](_0x5de883):{};}catch{throw CliErrors['validation'](_0x1c271d(0x20e)+_0xd05b14+_0x1c271d(0x1fc));}const _0x52671e=Number(_0x5de883?.[_0x1c271d(0x1fe)]?.[_0x1c271d(0x1ff)]??_0x2ce7b6[_0x1c271d(0x1fe)]?.[_0x1c271d(0x1ff)]??_0x3ca632['storageProfile']?.['dbId']??_0x519646[_0x1c271d(0x1ff)]??_0x3ca632['dbId']??_0x2ce7b6[_0x1c271d(0x1ff)]),_0x129406=String(_0x2ce7b6['tableName']??_0x3ca632[_0x1c271d(0x222)]??_0x519646[_0x1c271d(0x222)]??'')[_0x1c271d(0x204)]();if(!Number['isSafeInteger'](_0x52671e)||_0x52671e<=0x0||!_0x129406)throw CliErrors[_0x1c271d(0x208)](_0x1c271d(0x20e)+_0xd05b14+_0x1c271d(0x21f));return{'datasetCode':_0xd05b14,'dblinkId':_0x52671e,'table':_0x129406};}export async function resolveCrossRelationQuery(_0x2f9d76){const _0x2fb735=a71_0x3737,_0x3b0199=_0x2f9d76[_0x2fb735(0x1e0)](_0x2fb735(0x219))[_0x2fb735(0x204)](),_0x4c3266=explicitDblink(_0x2f9d76),_0x30872=_0x3b0199?await resolveEndpoint(_0x3b0199):undefined;if(_0x30872&&_0x4c3266!==undefined&&_0x30872['dblinkId']!==_0x4c3266)throw CliErrors['validation'](_0x2fb735(0x1e2));const _0x34f8c5=_0x30872?.['dblinkId']??_0x4c3266;if(_0x34f8c5===undefined)throw CliErrors['validation']('Provide\x20--from-datasetcode\x20or\x20--from-dblink-id.');return{'appCode':_0x2f9d76[_0x2fb735(0x1e7)],'fromDblinkId':_0x34f8c5,..._0x3b0199?{'fromDatasetCode':_0x3b0199}:{},..._0x2f9d76[_0x2fb735(0x1e0)](_0x2fb735(0x20f))[_0x2fb735(0x204)]()?{'fromField':_0x2f9d76['str'](_0x2fb735(0x20f))[_0x2fb735(0x204)]()}:{}};}export function projectCrossRelation(_0x434b1a){const _0x9300c7=a71_0x3737;return{'relationId':_0x434b1a[_0x9300c7(0x21b)],'from':{'source':'DB_TABLE','datasetCode':_0x434b1a['fromDatasetCode'],'datasetName':_0x434b1a[_0x9300c7(0x21c)],'dblinkId':_0x434b1a[_0x9300c7(0x1f7)],'table':_0x434b1a['fromTableName'],'field':_0x434b1a[_0x9300c7(0x20a)]},'to':{'source':'DB_TABLE','datasetCode':_0x434b1a[_0x9300c7(0x1f5)],'datasetName':_0x434b1a[_0x9300c7(0x21e)],'dblinkId':_0x434b1a[_0x9300c7(0x221)],'table':_0x434b1a[_0x9300c7(0x1d9)],'field':_0x434b1a[_0x9300c7(0x1de)],'labelField':_0x434b1a[_0x9300c7(0x1cd)]},'relation':{'cardinality':_0x434b1a['cardinality'],'relationType':_0x434b1a[_0x9300c7(0x1fb)]}};}function ambiguity(_0x298dd4){const _0x5471fc=a71_0x3737,_0x4dab24=CliErrors['validation'](_0x5471fc(0x210),_0x5471fc(0x213));return Object[_0x5471fc(0x220)](_0x4dab24,_0x5471fc(0x1d4),{'value':{'candidates':_0x298dd4[_0x5471fc(0x1ea)](projectCrossRelation)}}),_0x4dab24;}const sameName=(_0x4684ab,_0xe1327f)=>_0x4684ab[a71_0xf9ebde(0x1dc)]()===_0xe1327f[a71_0xf9ebde(0x1dc)]();function matchesEndpoint(_0x2acac6,_0x1e7042,_0x5ec78a,_0x52785d,_0x1acfc6){const _0xc0b950=a71_0xf9ebde;return _0x2acac6[_0xc0b950(0x1f7)]===_0x1e7042['dblinkId']&&sameName(_0x2acac6[_0xc0b950(0x1fa)],_0x1e7042[_0xc0b950(0x1f4)])&&sameName(_0x2acac6[_0xc0b950(0x20a)],_0x5ec78a)&&_0x2acac6[_0xc0b950(0x221)]===_0x52785d[_0xc0b950(0x1f6)]&&sameName(_0x2acac6[_0xc0b950(0x1d9)],_0x52785d[_0xc0b950(0x1f4)])&&sameName(_0x2acac6[_0xc0b950(0x1de)],_0x1acfc6);}export async function prepareCrossRelation(_0x19343d,_0x4da4c3){const _0x5b132b=a71_0xf9ebde,_0xc228=await resolveEndpoint(required(_0x19343d,_0x5b132b(0x219))),_0x461a5c=explicitDblink(_0x19343d);if(_0x461a5c!==undefined&&_0xc228[_0x5b132b(0x1f6)]!==_0x461a5c)throw CliErrors[_0x5b132b(0x208)](_0x5b132b(0x1e2));const _0x499527={'appCode':_0x19343d['appCode'],'fromDatasetCode':_0xc228['datasetCode'],'fromField':required(_0x19343d,'from-column'),..._0x461a5c!==undefined?{'fromDblinkId':_0x461a5c}:{}},_0x19dbb1={'appCode':_0x19343d[_0x5b132b(0x1e7)],'fromDblinkId':_0xc228[_0x5b132b(0x1f6)],'fromDatasetCode':_0xc228[_0x5b132b(0x214)],'fromField':_0x499527[_0x5b132b(0x20a)]},_0x16ffe7=await queryCrossDbRelations(_0x19dbb1);let _0x29ddb3=null;if(_0x4da4c3!==_0x5b132b(0x202)){if(_0x16ffe7[_0x5b132b(0x1c9)]>0x1)throw ambiguity(_0x16ffe7);_0x29ddb3=_0x16ffe7[0x0]??null;if(!_0x29ddb3)throw CliErrors[_0x5b132b(0x208)](_0x5b132b(0x1ed));}if(_0x4da4c3==='delete')return{'operation':_0x4da4c3,'from':_0xc228,'query':_0x19dbb1,'body':_0x499527,'before':_0x29ddb3};const _0x5a1bae=await resolveEndpoint(required(_0x19343d,'to-datasetcode'));if(_0xc228[_0x5b132b(0x1f6)]===_0x5a1bae[_0x5b132b(0x1f6)])throw CliErrors[_0x5b132b(0x208)](_0x5b132b(0x1f8));const _0x30277e=_0x19343d[_0x5b132b(0x1e0)](_0x5b132b(0x1d2))[_0x5b132b(0x204)](),_0xf9f249=_0x19343d[_0x5b132b(0x1e0)]('cardinality')[_0x5b132b(0x204)](),_0x142f0c={..._0x499527,'toDatasetCode':_0x5a1bae[_0x5b132b(0x214)],'toField':required(_0x19343d,_0x5b132b(0x1db)),..._0x30277e?{'refTableLabelName':_0x30277e}:{},..._0xf9f249?{'cardinality':_0xf9f249}:{}};if(_0x16ffe7[_0x5b132b(0x1ec)](_0x4a99ac=>_0x4a99ac[_0x5b132b(0x21b)]!==_0x29ddb3?.[_0x5b132b(0x21b)]&&matchesEndpoint(_0x4a99ac,_0xc228,_0x142f0c['fromField'],_0x5a1bae,_0x142f0c[_0x5b132b(0x1de)])))throw CliErrors[_0x5b132b(0x208)](_0x5b132b(0x1cb));return{'operation':_0x4da4c3,'from':_0xc228,'to':_0x5a1bae,'query':_0x19dbb1,'body':_0x142f0c,'before':_0x29ddb3,'expectedLabel':_0x30277e||_0x29ddb3?.[_0x5b132b(0x1cd)]||_0x142f0c[_0x5b132b(0x1de)],'expectedCardinality':_0xf9f249||_0x29ddb3?.['cardinality']||null};}function mutationData(_0x53cd7a,_0x312427,_0x113ad3){const _0x2684fb=a71_0xf9ebde,{operation:_0xaf946e,body:_0x300fc2,before:_0x162f05}=_0x53cd7a;return{'operation':_0xaf946e,'selector':{'appCode':_0x300fc2['appCode'],'from':{'datasetCode':_0x300fc2[_0x2684fb(0x1ee)],'field':_0x300fc2[_0x2684fb(0x20a)],'dblinkId':_0x53cd7a[_0x2684fb(0x1f2)][_0x2684fb(0x1f6)]}},'before':_0x162f05?projectCrossRelation(_0x162f05):null,'after':_0x113ad3,'dryRun':_0x312427,'backend':{'method':_0x2684fb(0x1d7),'path':CROSS_DB_RELATION_PATHS[_0xaf946e]},'warnings':_0xaf946e===_0x2684fb(0x211)&&!_0x300fc2[_0x2684fb(0x1cd)]?[{'code':_0x2684fb(0x1f3),'message':_0x2684fb(0x1e3)}]:[]};}export async function previewCrossRelation(_0x1074cf,_0x25571c){const _0x309456=a71_0xf9ebde,_0x19a3f8=await prepareCrossRelation(_0x1074cf,_0x25571c),_0x3bfb84=_0x19a3f8[_0x309456(0x205)],_0x26f1fe=_0x25571c===_0x309456(0x20c)?null:{..._0x19a3f8[_0x309456(0x20d)]?{'relationId':_0x19a3f8[_0x309456(0x20d)][_0x309456(0x21b)]}:{},'from':{'datasetCode':_0x19a3f8[_0x309456(0x1f2)][_0x309456(0x214)],'dblinkId':_0x19a3f8[_0x309456(0x1f2)][_0x309456(0x1f6)],'table':_0x19a3f8['from']['table'],'field':_0x3bfb84[_0x309456(0x20a)]},'to':{'datasetCode':_0x19a3f8['to'][_0x309456(0x214)],'dblinkId':_0x19a3f8['to'][_0x309456(0x1f6)],'table':_0x19a3f8['to']['table'],'field':_0x3bfb84['toField'],'labelField':_0x19a3f8[_0x309456(0x212)]},'relation':{'cardinality':_0x19a3f8['expectedCardinality'],'relationType':0x2}};return{...mutationData(_0x19a3f8,!![],null),'after':_0x26f1fe,'method':_0x309456(0x1d7),'url':CROSS_DB_RELATION_PATHS[_0x25571c],'body':_0x19a3f8[_0x309456(0x205)],'description':'Would\x20'+_0x25571c+_0x309456(0x1eb)+_0x3bfb84[_0x309456(0x1ee)]+'.'+_0x3bfb84[_0x309456(0x20a)]};}export async function executeCrossRelation(_0xee5bf8,_0x38eb59,_0x18357a){const _0x193f9c=a71_0xf9ebde,_0x4da3a2=await prepareCrossRelation(_0xee5bf8,_0x38eb59);try{await _0x18357a(_0x4da3a2[_0x193f9c(0x205)]);}catch(_0x5b1b5d){if(_0x5b1b5d instanceof CliError&&_0x5b1b5d[_0x193f9c(0x1d5)][_0x193f9c(0x1d6)](_0x193f9c(0x1e8))){const _0x5b97ac=await queryCrossDbRelations(_0x4da3a2[_0x193f9c(0x1df)])[_0x193f9c(0x21d)](()=>[]);throw ambiguity(_0x5b97ac);}throw _0x5b1b5d;}let _0x1de60d=[],_0x5345f0,_0x2391ff=![];try{_0x1de60d=await queryCrossDbRelations(_0x4da3a2[_0x193f9c(0x1df)]);if(_0x38eb59===_0x193f9c(0x20c))_0x2391ff=!_0x1de60d[_0x193f9c(0x1ec)](_0xdd207e=>_0xdd207e['relationId']===_0x4da3a2['before']['relationId']);else{const _0xdf4b1d=_0x4da3a2['body'],_0x159353=_0x1de60d[_0x193f9c(0x1ce)](_0x3c92da=>matchesEndpoint(_0x3c92da,_0x4da3a2['from'],_0xdf4b1d['fromField'],_0x4da3a2['to'],_0xdf4b1d[_0x193f9c(0x1de)])&&(_0x38eb59===_0x193f9c(0x202)||_0x3c92da[_0x193f9c(0x21b)]===_0x4da3a2['before'][_0x193f9c(0x21b)]));_0x5345f0=_0x159353[_0x193f9c(0x1c9)]===0x1?_0x159353[0x0]:undefined,_0x2391ff=!!_0x5345f0&&_0x5345f0['refTableLabelName']===_0x4da3a2[_0x193f9c(0x212)]&&_0x5345f0[_0x193f9c(0x1e5)]===_0x4da3a2['expectedCardinality']&&_0x5345f0[_0x193f9c(0x1fb)]===0x2;}}catch{}const _0x5cfcd6={...mutationData(_0x4da3a2,![],_0x5345f0?projectCrossRelation(_0x5345f0):null),'verification':{'status':_0x2391ff?'matched':_0x193f9c(0x1f0),'verified':_0x2391ff}};if(!_0x2391ff){const _0x4f37b3=CliErrors[_0x193f9c(0x1ef)]('Cross-database\x20relation\x20'+_0x38eb59+_0x193f9c(0x203),'The\x20write\x20was\x20accepted,\x20but\x20current\x20state\x20could\x20not\x20be\x20confirmed.\x20Run\x20dataset\x20cross-relation-list\x20before\x20attempting\x20another\x20write.');Object[_0x193f9c(0x220)](_0x4f37b3,'data',{'value':{..._0x5cfcd6,'candidates':_0x1de60d['map'](projectCrossRelation)}});throw _0x4f37b3;}return{'ok':!![],'data':_0x5cfcd6,'message':_0x193f9c(0x216)+_0x38eb59+'\x20verified.'};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a72_0x4c5ca1=a72_0x357e;(function(_0xd6b190,_0xc19cab){const _0x62bb01=a72_0x357e,_0x101e64=_0xd6b190();while(!![]){try{const _0x2abd61=parseInt(_0x62bb01(0x166))/0x1+-parseInt(_0x62bb01(0x169))/0x2+parseInt(_0x62bb01(0x168))/0x3+-parseInt(_0x62bb01(0x162))/0x4+-parseInt(_0x62bb01(0x164))/0x5+parseInt(_0x62bb01(0x161))/0x6+parseInt(_0x62bb01(0x165))/0x7;if(_0x2abd61===_0xc19cab)break;else _0x101e64['push'](_0x101e64['shift']());}catch(_0x44a191){_0x101e64['push'](_0x101e64['shift']());}}}(a72_0x4303,0x72ad2));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';function a72_0x357e(_0x1ddcaa,_0x411a96){_0x1ddcaa=_0x1ddcaa-0x160;const _0x43037e=a72_0x4303();let _0x357ed2=_0x43037e[_0x1ddcaa];return _0x357ed2;}function a72_0x4303(){const _0x524360=['616040uWmVfS','cross-relation-update','3931650ZhINdF','2953488DPzjUh','update','4037345MnQVMA','7253344dWEKmK','296665SZWjJy','dataset','1006329DhTLQa'];a72_0x4303=function(){return _0x524360;};return a72_0x4303();}import{executeCrossRelation,previewCrossRelation,validateCrossRelation}from'../../commands/dataset/cross-relation-shared.js';export const datasetCrossRelationUpdate={'service':a72_0x4c5ca1(0x167),'command':a72_0x4c5ca1(0x160),'description':'Update\x20the\x20target\x20or\x20properties\x20of\x20the\x20single\x20cross-database\x20relation\x20matching\x20a\x20source\x20dataset\x20and\x20field','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 _0xb06d34=>validateCrossRelation(_0xb06d34,a72_0x4c5ca1(0x163)),'dryRun':_0x58a77b=>previewCrossRelation(_0x58a77b,'update'),'execute':_0x4ee9a8=>executeCrossRelation(_0x4ee9a8,'update',updateCrossDbRelation)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a73_0xd5fc8b=a73_0x1416;(function(_0x2e0640,_0x26be29){const _0x5263c4=a73_0x1416,_0x1855c9=_0x2e0640();while(!![]){try{const _0x1e8d7e=parseInt(_0x5263c4(0x1f1))/0x1*(-parseInt(_0x5263c4(0x1ec))/0x2)+-parseInt(_0x5263c4(0x1e9))/0x3*(-parseInt(_0x5263c4(0x220))/0x4)+parseInt(_0x5263c4(0x1ef))/0x5*(parseInt(_0x5263c4(0x217))/0x6)+-parseInt(_0x5263c4(0x1f6))/0x7+-parseInt(_0x5263c4(0x201))/0x8*(parseInt(_0x5263c4(0x1fd))/0x9)+-parseInt(_0x5263c4(0x1f2))/0xa*(-parseInt(_0x5263c4(0x214))/0xb)+parseInt(_0x5263c4(0x1f9))/0xc;if(_0x1e8d7e===_0x26be29)break;else _0x1855c9['push'](_0x1855c9['shift']());}catch(_0x141a27){_0x1855c9['push'](_0x1855c9['shift']());}}}(a73_0x26a7,0x313d3));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_0x1416(_0x331831,_0x11d835){_0x331831=_0x331831-0x1df;const _0x26a7b5=a73_0x26a7();let _0x14161b=_0x26a7b5[_0x331831];return _0x14161b;}const DATASET_ID_FLAG={'name':'id','type':a73_0xd5fc8b(0x221),'description':a73_0xd5fc8b(0x202)},DBID_FLAG={'name':a73_0xd5fc8b(0x1e3),'type':a73_0xd5fc8b(0x221),'description':a73_0xd5fc8b(0x1ed)},CONFIRM_FLAG={'name':a73_0xd5fc8b(0x1f3),'type':'boolean','description':a73_0xd5fc8b(0x21d)},CASCADE_FLAG={'name':a73_0xd5fc8b(0x20e),'type':a73_0xd5fc8b(0x1df),'description':a73_0xd5fc8b(0x205)},EXPECTED_COUNT_FLAG={'name':a73_0xd5fc8b(0x1f5),'type':a73_0xd5fc8b(0x221),'description':a73_0xd5fc8b(0x203)};export const datasetDelete={'service':a73_0xd5fc8b(0x1fc),'command':'delete','description':a73_0xd5fc8b(0x1fa),'risk':a73_0xd5fc8b(0x218),'flags':[DATASET_ID_FLAG,CODE_FLAG_OPTIONAL,DBID_FLAG,CASCADE_FLAG,CONFIRM_FLAG,EXPECTED_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x4dde72){const _0x25effb=a73_0xd5fc8b,_0x20ee7a=_0x4dde72[_0x25effb(0x204)]('id'),_0xb293df=_0x4dde72[_0x25effb(0x1e8)](_0x25effb(0x1e2)),_0x4d0125=_0x4dde72[_0x25effb(0x204)]('dbid'),_0x77fd20=[_0x20ee7a>0x0,Boolean(_0xb293df),_0x4d0125>0x0][_0x25effb(0x212)](Boolean);if(_0x77fd20['length']===0x0)throw CliErrors[_0x25effb(0x1e4)](_0x25effb(0x223));if(_0x77fd20[_0x25effb(0x1e1)]>0x1)throw CliErrors[_0x25effb(0x1e4)](_0x25effb(0x20a));},async 'dryRun'(_0x2c540c){const _0x162930=a73_0xd5fc8b,_0x166d28=await resolveTargets(_0x2c540c),_0x46002d=_0x2c540c[_0x162930(0x1f8)](_0x162930(0x20e));return{'method':_0x162930(0x207),'url':_0x162930(0x20c)+(_0x46002d?_0x162930(0x1ee):'false'),'body':{'count':_0x166d28[_0x162930(0x1e1)],'cascade':_0x46002d,'datasets':_0x166d28},'description':_0x46002d?'Would\x20delete\x20'+_0x166d28[_0x162930(0x1e1)]+_0x162930(0x21c):_0x162930(0x1f0)+_0x166d28['length']+'\x20dataset(s)\x20without\x20cascading\x20to\x20pages.\x20The\x20server\x20blocks\x20a\x20Dataset\x20that\x20still\x20has\x20related\x20pages.'};},async 'execute'(_0xf6bed7){const _0x3bf798=a73_0xd5fc8b;if(!_0xf6bed7[_0x3bf798(0x1f8)](_0x3bf798(0x1f3)))throw CliErrors[_0x3bf798(0x1e4)](_0x3bf798(0x222),_0x3bf798(0x210));const _0x418036=await resolveTargets(_0xf6bed7),_0x4b1c19=_0xf6bed7[_0x3bf798(0x1f8)](_0x3bf798(0x20e)),_0x530bbd=[],_0x502271=[];for(const _0x44ea79 of _0x418036){try{await deleteDataset(_0x44ea79['id'],_0x4b1c19),_0x530bbd['push'](_0x44ea79);}catch(_0x2fbd3e){_0x502271[_0x3bf798(0x209)]({..._0x44ea79,'error':_0x2fbd3e instanceof Error?_0x2fbd3e['message']:String(_0x2fbd3e)});}}if(_0x502271[_0x3bf798(0x1e1)]>0x0){const _0x24b736=buildPageRestoreCommands(_0xf6bed7[_0x3bf798(0x21f)],_0x4b1c19?_0x530bbd:[]);return{'ok':![],'data':{'requested':_0x418036[_0x3bf798(0x1e1)],'cascade':_0x4b1c19,'deletedCount':_0x530bbd[_0x3bf798(0x1e1)],'failedCount':_0x502271[_0x3bf798(0x1e1)],'deleted':_0x530bbd,'failed':_0x502271,'pageRestoreCommands':_0x24b736},'message':_0x3bf798(0x1e6)+_0x530bbd['length']+'/'+_0x418036['length']+_0x3bf798(0x206)+_0x502271['length']+_0x3bf798(0x1ea)};}return{'ok':!![],'data':{'requested':_0x418036[_0x3bf798(0x1e1)],'cascade':_0x4b1c19,'deletedCount':_0x530bbd['length'],'deleted':_0x530bbd,'pageRestoreCommands':buildPageRestoreCommands(_0xf6bed7[_0x3bf798(0x21f)],_0x4b1c19?_0x530bbd:[])},'message':_0x3bf798(0x1e6)+_0x530bbd['length']+'\x20dataset(s)'};}};async function resolveTargets(_0x1f7e80){const _0x3e8ae2=a73_0xd5fc8b,_0xaa4236=_0x1f7e80[_0x3e8ae2(0x204)]('id'),_0x2398a5=_0x1f7e80['str']('code'),_0x3f5ebd=_0x1f7e80[_0x3e8ae2(0x204)](_0x3e8ae2(0x1e3));let _0x9750a3;_0x2398a5?(_0x9750a3=await listDatasets(_0x1f7e80[_0x3e8ae2(0x21f)],{'code':_0x2398a5}),_0x9750a3=_0x9750a3[_0x3e8ae2(0x212)](_0xebd07d=>_0xebd07d['code']===_0x2398a5)):(_0x9750a3=await listDatasets(_0x1f7e80[_0x3e8ae2(0x21f)]),_0xaa4236>0x0&&(_0x9750a3=_0x9750a3[_0x3e8ae2(0x212)](_0x4219d9=>_0x4219d9['id']===_0xaa4236)),_0x3f5ebd>0x0&&(_0x9750a3=_0x9750a3['filter'](_0x2884d4=>_0x2884d4[_0x3e8ae2(0x208)]?.['dbId']===_0x3f5ebd)));const _0x5a2e60=[];for(const _0x446d96 of _0x9750a3){const _0x2b088d=await getDatasetDetail(_0x446d96[_0x3e8ae2(0x1e2)]),_0x7300ec=Array[_0x3e8ae2(0x200)](_0x2b088d[_0x3e8ae2(0x216)])?_0x2b088d['relatedPageInfoList']['filter'](_0x366e56=>_0x366e56!=null&&typeof _0x366e56==='object'&&_0x366e56['deleted']!==!![]):[];_0x5a2e60[_0x3e8ae2(0x209)](normalizeTarget(_0x446d96,_0x7300ec));}if(_0x5a2e60[_0x3e8ae2(0x1e1)]===0x0){const _0x538c75=_0x2398a5||(_0xaa4236>0x0?_0x3e8ae2(0x1e5)+_0xaa4236:_0x3e8ae2(0x20b)+_0x3f5ebd);throw CliErrors[_0x3e8ae2(0x1e4)](_0x3e8ae2(0x213)+_0x538c75+'.');}const _0x914e09=_0x1f7e80[_0x3e8ae2(0x204)](_0x3e8ae2(0x1f5));if(_0x914e09>0x0&&_0x5a2e60[_0x3e8ae2(0x1e1)]!==_0x914e09)throw CliErrors['validation'](_0x3e8ae2(0x21a)+_0x5a2e60['length']+_0x3e8ae2(0x1ff)+_0x914e09+'.');return _0x5a2e60;}function a73_0x26a7(){const _0xd3d592=['dbName','str','3FMyLYP','\x20failed','type','85310kfxrrr','Delete\x20all\x20datasets\x20under\x20this\x20database\x20connection\x20id','true','15aRohHV','Would\x20safely\x20delete\x20','5TwWUKN','25190gwdnek','confirm','map','expected-count','2374582TdIAwX','object','bool','6445620HtCQEi','Delete\x20dataset\x20metadata\x20by\x20id/code\x20or\x20all\x20datasets\x20under\x20a\x20db\x20id','source','dataset','3526722ExOjEB','description','\x20dataset(s),\x20but\x20--expected-count\x20is\x20','isArray','8fqiZhR','Dataset\x20id','Abort\x20unless\x20the\x20matched\x20dataset\x20count\x20equals\x20this\x20value','num','Also\x20delete\x20related\x20pages\x20and\x20menus;\x20requires\x20explicit\x20--confirm','\x20dataset(s);\x20','POST','dbtableConfig','push','Use\x20only\x20one\x20of\x20--id,\x20--code,\x20or\x20--dbid.','dbid=','/smartapi/dataset/delete?cascade=','relatedPages','cascade','rabetbase\x20page\x20restore\x20--id\x20','Run\x20with\x20--dry-run\x20first,\x20then\x20add\x20--confirm\x20when\x20the\x20target\x20list\x20is\x20correct.','add','filter','No\x20undeleted\x20dataset\x20found\x20for\x20','77UdbPlz','name','relatedPageInfoList','757740MIulKT','high-risk-write','title','Matched\x20','dbId','\x20dataset(s)\x20and\x20their\x20listed\x20related\x20pages/menus.\x20Restore\x20each\x20Dataset\x20first,\x20then\x20restore\x20pages\x20explicitly\x20when\x20needed.','Required\x20to\x20execute\x20dataset\x20deletion','isInteger','appCode','849616GwGQYJ','number','--confirm\x20is\x20required\x20to\x20delete\x20datasets.','One\x20of\x20--id,\x20--code,\x20or\x20--dbid\x20is\x20required.','boolean','tableName','length','code','dbid','validation','id=','Deleted\x20'];a73_0x26a7=function(){return _0xd3d592;};return a73_0x26a7();}function normalizeTarget(_0x2fac88,_0x544007){const _0x530f6c=a73_0xd5fc8b,_0x2afade=_0x2fac88[_0x530f6c(0x208)]??{},_0x27e062=_0x544007[_0x530f6c(0x1f4)](_0x3668e7=>{const _0x16d057=_0x530f6c;if(_0x3668e7==null||typeof _0x3668e7!==_0x16d057(0x1f7))return null;const _0x24cfcb=_0x3668e7,_0x1b8246=Number(_0x24cfcb['id']);if(!Number[_0x16d057(0x21e)](_0x1b8246)||_0x1b8246<=0x0)return null;const _0x16b73a=_0x24cfcb[_0x16d057(0x219)]??_0x24cfcb[_0x16d057(0x215)];return{'id':_0x1b8246,..._0x16b73a?{'name':String(_0x16b73a)}:{},..._0x24cfcb[_0x16d057(0x1eb)]?{'type':String(_0x24cfcb[_0x16d057(0x1eb)])}:{}};})[_0x530f6c(0x212)](_0x3b7b5f=>_0x3b7b5f!==null);return{'id':_0x2fac88['id'],'code':_0x2fac88[_0x530f6c(0x1e2)],'name':_0x2fac88['name'],'description':_0x2fac88[_0x530f6c(0x1fe)],'source':_0x2fac88[_0x530f6c(0x1fb)],'dbId':_0x2afade[_0x530f6c(0x21b)],'dbName':_0x2afade[_0x530f6c(0x1e7)],'tableName':_0x2afade[_0x530f6c(0x1e0)],'relatedPageCount':_0x27e062['length'],'relatedPages':_0x27e062};}function buildPageRestoreCommands(_0x2d61b4,_0x1b509d){const _0x28b0ac=a73_0xd5fc8b,_0x3bcc25=new Set();for(const _0x44b5f7 of _0x1b509d){for(const _0x2cab2d of _0x44b5f7[_0x28b0ac(0x20d)])_0x3bcc25[_0x28b0ac(0x211)](_0x2cab2d['id']);}return[..._0x3bcc25]['map'](_0x14debd=>_0x28b0ac(0x20f)+_0x14debd+'\x20--appcode\x20'+_0x2d61b4);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a74_0x8d1436=a74_0x31f9;function a74_0x1901(){const _0x15aaa8=['createTimeField','allFields','fromField','filter','method','main_sub','bizRelationType','121491ZesyCq','displayName','deprecated','alias','logicField','indexes','responseBody','responseFields','970292bsFckx','tableName','beforeScriptId','toDatasetName','modelCode','doVersion','Dataset\x20alias\x20defined\x20in\x20api.ts\x20(e.g.\x20order,\x20coupon).\x20Resolves\x20to\x20dataset\x20code\x20automatically','isArray','required','2460598wDAaud','doType','operations','relationId','properties','description','dataset','tableComment','dbId','creatorIdField','string','pkField','source','title','columnCodeListWithDeleted','object','modifierNameField','entries','dbName','map','type','validateRules','deleted','allFieldNames','cardinality','dblinkInfoDTO','sourceType','6382185IBcIqi','2320KThDaI','str','toDatasetCode','5281180sWQAsF','name','options','push','3350406qkZQMB','3588221BptGqS','3BXAXwO','requestFields','fields','length','path','extend','relations','code','creatorNameField','requestBody','host','parse','toTableName','afterScriptId','formatRules'];a74_0x1901=function(){return _0x15aaa8;};return a74_0x1901();}(function(_0x3b38a9,_0x1fce7a){const _0x37b917=a74_0x31f9,_0x262783=_0x3b38a9();while(!![]){try{const _0x5cf8d4=-parseInt(_0x37b917(0x93))/0x1+-parseInt(_0x37b917(0x9c))/0x2+-parseInt(_0x37b917(0xc1))/0x3*(-parseInt(_0x37b917(0xbb))/0x4)+-parseInt(_0x37b917(0xb7))/0x5+-parseInt(_0x37b917(0xbf))/0x6+-parseInt(_0x37b917(0xc0))/0x7+-parseInt(_0x37b917(0xb8))/0x8*(-parseInt(_0x37b917(0xd7))/0x9);if(_0x5cf8d4===_0x1fce7a)break;else _0x262783['push'](_0x262783['shift']());}catch(_0x456c0d){_0x262783['push'](_0x262783['shift']());}}}(a74_0x1901,0xa7b7d));import{getDatasetDetail}from'../../core/api-client.js';import{CODE_FLAG,APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function normalizeField(_0x2e7b28){const _0xeae1c7=a74_0x31f9;if(_0x2e7b28[_0xeae1c7(0xb2)])return null;const _0x30ad3a=Boolean(_0x2e7b28[_0xeae1c7(0xd8)]!==undefined||_0x2e7b28[_0xeae1c7(0x9d)]!==undefined);let _0x4e8bd3={};if(!_0x30ad3a&&typeof _0x2e7b28[_0xeae1c7(0xc6)]===_0xeae1c7(0xa6))try{_0x4e8bd3=JSON[_0xeae1c7(0xcc)](_0x2e7b28[_0xeae1c7(0xc6)]);}catch{}const _0x23ce0d=_0x30ad3a?_0x2e7b28[_0xeae1c7(0xbc)]:_0x2e7b28[_0xeae1c7(0xc8)],_0x4e4e9a=_0x30ad3a?_0x2e7b28[_0xeae1c7(0xd8)]:_0x2e7b28[_0xeae1c7(0xbc)],_0x4c7b40=_0x30ad3a?_0x2e7b28[_0xeae1c7(0x9d)]:_0x2e7b28[_0xeae1c7(0xb0)]||_0x2e7b28['dataType'],_0x503c80=_0x30ad3a?_0x2e7b28['pkField']===!![]:_0x4e8bd3[_0xeae1c7(0xa7)]===!![],_0x3235fe=_0x30ad3a?_0x2e7b28[_0xeae1c7(0x9b)]===!![]:_0x4e8bd3[_0xeae1c7(0x9b)]===!![],_0xea5848=_0x30ad3a?_0x2e7b28['options']??null:_0x4e8bd3[_0xeae1c7(0xbd)]??null,_0x4b506c={'name':_0x23ce0d,'displayName':_0x4e4e9a||_0x23ce0d,'type':_0x4c7b40,'dbType':_0x2e7b28['dbType'],'pk':_0x503c80,'required':_0x3235fe,'deprecated':_0x2e7b28[_0xeae1c7(0xd9)]===!![],'description':_0x2e7b28[_0xeae1c7(0xa1)]||undefined};return Array[_0xeae1c7(0x9a)](_0xea5848)&&_0xea5848['length']>0x0&&(_0x4b506c[_0xeae1c7(0xbd)]=_0xea5848),_0x4b506c;}function parseJsonMaybe(_0x193d6b){const _0x4fedb0=a74_0x31f9;if(typeof _0x193d6b!==_0x4fedb0(0xa6))return _0x193d6b;try{return JSON[_0x4fedb0(0xcc)](_0x193d6b);}catch{return _0x193d6b;}}function normalizeOperationEntry(_0x5ebc25,_0x2a2c70){const _0x3973f7=a74_0x31f9;if(!_0x2a2c70||typeof _0x2a2c70!==_0x3973f7(0xab))return null;if(!_0x2a2c70[_0x3973f7(0xd4)]||!_0x2a2c70[_0x3973f7(0xc5)])return null;const _0x705450={'name':_0x5ebc25,'method':_0x2a2c70[_0x3973f7(0xd4)],'path':_0x2a2c70[_0x3973f7(0xc5)]};if(_0x2a2c70[_0x3973f7(0xcb)])_0x705450[_0x3973f7(0xcb)]=_0x2a2c70[_0x3973f7(0xcb)];if(_0x2a2c70['requestBody']!=null){const _0x3a98a8=parseJsonMaybe(_0x2a2c70['requestBody']);_0x705450[_0x3973f7(0xca)]=_0x3a98a8;}if(_0x2a2c70[_0x3973f7(0xdd)]!=null){const _0x36f937=parseJsonMaybe(_0x2a2c70[_0x3973f7(0xdd)]);_0x705450[_0x3973f7(0xdd)]=_0x36f937;}if(_0x2a2c70[_0x3973f7(0x95)]!=null)_0x705450['beforeScriptId']=_0x2a2c70[_0x3973f7(0x95)];if(_0x2a2c70[_0x3973f7(0xce)]!=null)_0x705450[_0x3973f7(0xce)]=_0x2a2c70[_0x3973f7(0xce)];if(Array[_0x3973f7(0x9a)](_0x2a2c70[_0x3973f7(0xc2)]))_0x705450[_0x3973f7(0xc2)]=_0x2a2c70[_0x3973f7(0xc2)];if(Array[_0x3973f7(0x9a)](_0x2a2c70[_0x3973f7(0x92)]))_0x705450[_0x3973f7(0x92)]=_0x2a2c70[_0x3973f7(0x92)];return _0x705450;}function summarizeDbtable(_0x40c15e){const _0xaf1b3d=a74_0x31f9,_0x3b32a6={},_0x142aee=[_0xaf1b3d(0xa4),_0xaf1b3d(0xae),_0xaf1b3d(0x94),'datasetKey',_0xaf1b3d(0xa7),_0xaf1b3d(0xd1),_0xaf1b3d(0xdb),_0xaf1b3d(0xd0),'updateTimeField',_0xaf1b3d(0xa5),_0xaf1b3d(0xc9),'modifierIdField',_0xaf1b3d(0xac),'labelField',_0xaf1b3d(0xb5)];for(const _0x3a587 of _0x142aee){if(_0x40c15e[_0x3a587]!==undefined)_0x3b32a6[_0x3a587]=_0x40c15e[_0x3a587];}return typeof _0x3b32a6[_0xaf1b3d(0xd1)]===_0xaf1b3d(0xa6)&&_0x3b32a6[_0xaf1b3d(0xd1)]['length']>0x0&&(_0x3b32a6[_0xaf1b3d(0xb3)]=_0x3b32a6[_0xaf1b3d(0xd1)]['split'](',')[_0xaf1b3d(0xaf)](_0x1fc931=>_0x1fc931['trim']())[_0xaf1b3d(0xd3)](Boolean)),_0x3b32a6;}function normalizeRelatedPages(_0x2ecf43){const _0x42474d=a74_0x31f9;if(!Array[_0x42474d(0x9a)](_0x2ecf43))return[];return _0x2ecf43[_0x42474d(0xd3)](_0x346637=>_0x346637&&typeof _0x346637===_0x42474d(0xab))['map'](_0x41d48d=>({'id':_0x41d48d['id'],'type':_0x41d48d['type'],'code':_0x41d48d[_0x42474d(0xc8)],'title':_0x41d48d[_0x42474d(0xa9)],'deleted':_0x41d48d[_0x42474d(0xb2)]===!![]}));}function a74_0x31f9(_0x509c66,_0x28de9d){_0x509c66=_0x509c66-0x92;const _0x190147=a74_0x1901();let _0x31f975=_0x190147[_0x509c66];return _0x31f975;}export const datasetDetail={'service':a74_0x8d1436(0xa2),'command':'detail','description':'Get\x20dataset\x20detail\x20including\x20fields\x20and\x20operations','risk':'read','flags':[CODE_FLAG,APPCODE_FLAG_OPTIONAL,{'name':a74_0x8d1436(0xda),'type':a74_0x8d1436(0xa6),'description':a74_0x8d1436(0x99)}],async 'execute'(_0x562488){const _0x3aa36c=a74_0x8d1436,_0x51e5ee=await getDatasetDetail(_0x562488[_0x3aa36c(0xb9)](_0x3aa36c(0xc8))),_0xc8f815=Array[_0x3aa36c(0x9a)](_0x51e5ee['fields'])?_0x51e5ee[_0x3aa36c(0xc3)]:Array['isArray'](_0x51e5ee[_0x3aa36c(0xa0)])?_0x51e5ee[_0x3aa36c(0xa0)]:[],_0x30858c=_0xc8f815[_0x3aa36c(0xaf)](_0x4fbd34=>normalizeField(_0x4fbd34))[_0x3aa36c(0xd3)](_0x32fe43=>_0x32fe43!==null),_0x20f093=_0x51e5ee[_0x3aa36c(0x9e)]??{},_0x15a70=[];for(const [_0x2d7a2c,_0x4bc84b]of Object[_0x3aa36c(0xad)](_0x20f093)){const _0x18c374=normalizeOperationEntry(_0x2d7a2c,_0x4bc84b);if(_0x18c374)_0x15a70[_0x3aa36c(0xbe)](_0x18c374);}const _0x2a83ab=_0x51e5ee['dbtableConfig']??{},_0x3183bc=_0x51e5ee[_0x3aa36c(0xa2)]??{},_0x41fb65=_0x2a83ab[_0x3aa36c(0xa4)]!=null?{'id':_0x2a83ab['dbId'],'name':_0x2a83ab[_0x3aa36c(0xae)]??null}:undefined;let _0x342be0;return typeof _0x51e5ee[_0x3aa36c(0xc6)]===_0x3aa36c(0xa6)&&(_0x342be0=parseJsonMaybe(_0x51e5ee[_0x3aa36c(0xc6)])),{'ok':!![],'data':{'id':_0x51e5ee['modelId']??_0x51e5ee['id'],'name':_0x51e5ee[_0x3aa36c(0xbc)],'code':_0x51e5ee[_0x3aa36c(0x97)]||_0x51e5ee['code'],'doVersion':_0x51e5ee[_0x3aa36c(0x98)],'description':_0x51e5ee[_0x3aa36c(0xa1)]||_0x3183bc[_0x3aa36c(0xa3)]||undefined,'source':_0x51e5ee[_0x3aa36c(0xa8)]||_0x3183bc[_0x3aa36c(0xb6)],'table':_0x2a83ab[_0x3aa36c(0x94)]||_0x3183bc[_0x3aa36c(0x94)],'datasetKey':_0x2a83ab['datasetKey'],'pk':_0x2a83ab[_0x3aa36c(0xa7)],'db':_0x41fb65,'dbtable':summarizeDbtable(_0x2a83ab),'fields':_0x30858c,'operations':_0x15a70,'indexes':Array[_0x3aa36c(0x9a)](_0x3183bc[_0x3aa36c(0xdc)])?_0x3183bc[_0x3aa36c(0xdc)]:[],'relations':Array[_0x3aa36c(0x9a)](_0x51e5ee[_0x3aa36c(0xc7)])?_0x51e5ee[_0x3aa36c(0xc7)][_0x3aa36c(0xaf)](_0x39b18a=>({..._0x39b18a[_0x3aa36c(0x9f)]!=null?{'relationId':_0x39b18a[_0x3aa36c(0x9f)]}:{},'fromDataset':_0x51e5ee[_0x3aa36c(0xbc)],'fromCode':_0x51e5ee['modelCode']||_0x51e5ee[_0x3aa36c(0xc8)],'fromTable':_0x2a83ab[_0x3aa36c(0x94)]||_0x3183bc[_0x3aa36c(0x94)],'fromField':_0x39b18a[_0x3aa36c(0xd2)],'toDataset':_0x39b18a[_0x3aa36c(0x96)],'toCode':_0x39b18a[_0x3aa36c(0xba)],'toTable':_0x39b18a[_0x3aa36c(0xcd)],'toField':_0x39b18a['toField'],'labelField':_0x39b18a['toFieldLabel']||undefined,'cardinality':_0x39b18a[_0x3aa36c(0xb4)]||undefined,'bizRelationType':_0x39b18a[_0x3aa36c(0xd6)]===_0x3aa36c(0xd5)?'main_sub':null})):[],'relatedPages':normalizeRelatedPages(_0x51e5ee['relatedPageInfoList']),...Array[_0x3aa36c(0x9a)](_0x51e5ee[_0x3aa36c(0xaa)])?{'columnCodeListWithDeleted':_0x51e5ee['columnCodeListWithDeleted']}:{},'formatRules':Array[_0x3aa36c(0x9a)](_0x51e5ee['formatRules'])?_0x51e5ee[_0x3aa36c(0xcf)]:[],'validateRules':Array['isArray'](_0x51e5ee[_0x3aa36c(0xb1)])?_0x51e5ee['validateRules']:[],..._0x342be0!==undefined?{'extend':_0x342be0}:{},'stats':{'fieldCount':_0x30858c[_0x3aa36c(0xc4)],'operationCount':_0x15a70[_0x3aa36c(0xc4)]}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a75_0x5dd73b=a75_0x4203;(function(_0x5d1e7a,_0x48fa2f){const _0x405a96=a75_0x4203,_0x16d86f=_0x5d1e7a();while(!![]){try{const _0x31346d=parseInt(_0x405a96(0xce))/0x1+-parseInt(_0x405a96(0x9a))/0x2+-parseInt(_0x405a96(0xab))/0x3*(-parseInt(_0x405a96(0xa6))/0x4)+parseInt(_0x405a96(0xb9))/0x5*(-parseInt(_0x405a96(0xc2))/0x6)+parseInt(_0x405a96(0xd6))/0x7*(parseInt(_0x405a96(0xc4))/0x8)+-parseInt(_0x405a96(0xcd))/0x9+parseInt(_0x405a96(0xc3))/0xa;if(_0x31346d===_0x48fa2f)break;else _0x16d86f['push'](_0x16d86f['shift']());}catch(_0x286779){_0x16d86f['push'](_0x16d86f['shift']());}}}(a75_0x1056,0xc2890));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([[a75_0x5dd73b(0xd0),{'message':a75_0x5dd73b(0xad),'hint':'Use\x20`rabetbase\x20dataset\x20business-group-update`\x20to\x20update\x20business\x20model\x20groups.'}]]);export function parseJsonObjectFlag(_0x1c360e,_0x56a1cb){const _0x3bd6ac=a75_0x5dd73b;if(!_0x1c360e)return undefined;let _0xc3f431;try{_0xc3f431=JSON[_0x3bd6ac(0xb2)](_0x1c360e);}catch(_0x2c32a2){const _0x3259a0=_0x2c32a2 instanceof Error?_0x2c32a2[_0x3bd6ac(0x9f)]:String(_0x2c32a2);throw CliErrors['validation'](_0x56a1cb+_0x3bd6ac(0xba)+_0x3259a0);}if(!isPlainObject(_0xc3f431)||Array['isArray'](_0xc3f431))throw CliErrors['validation'](_0x56a1cb+_0x3bd6ac(0xb8));return _0xc3f431;}export function validateExtendPatchKeys(_0x3f1e82){const _0x195d47=a75_0x5dd73b,_0x26aad2=Object['keys'](_0x3f1e82);if(_0x26aad2[_0x195d47(0xaa)]===0x0)throw CliErrors[_0x195d47(0xa9)]('--patch-json\x20must\x20contain\x20at\x20least\x20one\x20key');for(const _0x59b6c6 of _0x26aad2){const _0x5f191e=EXTEND_PATCH_REDIRECTS[_0x195d47(0x9b)](_0x59b6c6);if(_0x5f191e)throw CliErrors[_0x195d47(0xa9)](_0x5f191e[_0x195d47(0x9f)],_0x5f191e[_0x195d47(0xae)]);if(!MUTABLE_EXTEND_KEYS[_0x195d47(0xa2)](_0x59b6c6))throw CliErrors[_0x195d47(0xa9)]('Unsupported\x20patch\x20key:\x20'+_0x59b6c6,describeMutableExtendKeys());}}function describeMutableExtendKeys(){const _0x2dd96d=a75_0x5dd73b,_0x5568ce=Array[_0x2dd96d(0xb3)](MUTABLE_EXTEND_KEYS)[_0x2dd96d(0x98)]();return _0x5568ce['length']>0x0?'Allowed\x20keys:\x20'+_0x5568ce['join'](',\x20'):_0x2dd96d(0xcf);}function a75_0x4203(_0x373f8d,_0x1618c5){_0x373f8d=_0x373f8d-0x98;const _0x10569e=a75_0x1056();let _0x420318=_0x10569e[_0x373f8d];return _0x420318;}export function applyExtendPatch(_0x2711a9,_0x5a923a){const _0x3f87c3=a75_0x5dd73b;validateExtendPatchKeys(_0x5a923a);const _0x447f06=deepClone(_0x2711a9),_0x5aa579=[];for(const [_0xddb9cc,_0x5dcb33]of Object['entries'](_0x5a923a)){const _0x5e2d3a=_0x447f06[_0xddb9cc],_0x109897=deepClone(_0x5dcb33);!deepEqual(_0x5e2d3a,_0x109897)&&(_0x447f06[_0xddb9cc]=_0x109897,_0x5aa579[_0x3f87c3(0xbf)](_0x3f87c3(0x99)+_0xddb9cc));}return _0x5aa579[_0x3f87c3(0x98)](),{'after':_0x447f06,'changedPaths':_0x5aa579,'changed':_0x5aa579[_0x3f87c3(0xaa)]>0x0};}export function assertExpectation(_0x4c7561,_0x47c589){const _0x1c7f52=a75_0x5dd73b;if(!_0x47c589)return;for(const [_0xabfb4c,_0x1a9a41]of Object['entries'](_0x47c589)){const _0x15f2db=_0x4c7561[_0xabfb4c];if(!deepEqual(_0x15f2db,_0x1a9a41))throw CliErrors[_0x1c7f52(0xa9)]('Expectation\x20mismatch\x20at\x20extend.'+_0xabfb4c,'Expected\x20'+JSON['stringify'](_0x1a9a41)+',\x20actual\x20'+JSON[_0x1c7f52(0xb5)](_0x15f2db));}}export async function buildDatasetExtendUpdateResult({appCode:_0x44ed2f,input:_0x35b6bf,dryRun:_0x49a1ad}){const _0x5bbfb0=a75_0x5dd73b;validateInput(_0x35b6bf);const _0x3afbd0=await getDatasetDetail(_0x35b6bf[_0x5bbfb0(0xb4)]),_0x2fedf8=parseDatasetExtend(_0x3afbd0[_0x5bbfb0(0xb6)]),_0x5bef2b=deepClone(_0x2fedf8[_0x5bbfb0(0xc5)]);assertExpectation(_0x5bef2b,_0x35b6bf[_0x5bbfb0(0xbd)]);const {after:_0x2f824a,changedPaths:_0x151b7d,changed:_0x3a9bd4}=applyExtendPatch(_0x5bef2b,_0x35b6bf[_0x5bbfb0(0xa3)]),_0xdac11c=summarizeDataset(_0x3afbd0,_0x35b6bf['code']);return _0x3a9bd4&&!_0x49a1ad&&(_0x3afbd0[_0x5bbfb0(0xb6)]=serializeDatasetExtend(_0x2f824a,_0x2fedf8[_0x5bbfb0(0xac)]),await updateDrivenData(_0x3afbd0)),{'ok':!![],'data':{'appCode':_0x44ed2f,'selector':{'code':_0x35b6bf['code']},'dataset':_0xdac11c,'dryRun':_0x49a1ad,'changed':_0x3a9bd4,'changedPaths':_0x151b7d,'before':{'extend':_0x5bef2b},'after':{'extend':_0x2f824a},'submitted':_0x3a9bd4&&!_0x49a1ad},'message':_0x3a9bd4?_0x49a1ad?_0x5bbfb0(0x9d)+_0x151b7d[_0x5bbfb0(0xd3)](',\x20')+')':'Updated\x20dataset\x20extend\x20('+_0x151b7d[_0x5bbfb0(0xd3)](',\x20')+')':'No\x20changes\x20for\x20dataset\x20extend'};}export const datasetExtendUpdate={'service':a75_0x5dd73b(0xd4),'command':a75_0x5dd73b(0xc8),'description':a75_0x5dd73b(0xa8),'risk':'write','flags':[CODE_FLAG,{'name':a75_0x5dd73b(0xa5),'type':'string','required':!![],'description':'JSON\x20object\x20patch\x20for\x20dataset\x20top-level\x20extend;\x20current\x20allowlist\x20is\x20empty'},{'name':'expect-json','type':a75_0x5dd73b(0xcb),'required':![],'description':a75_0x5dd73b(0xca)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1e86ee){validateInput(readExtendUpdateInput(_0x1e86ee));},async 'dryRun'(_0x213b04){const _0x251d14=a75_0x5dd73b,_0x1775de=await buildDatasetExtendUpdateResult({'appCode':_0x213b04[_0x251d14(0xd2)],'input':readExtendUpdateInput(_0x213b04),'dryRun':!![]});return{'method':_0x251d14(0xc7),'url':_0x251d14(0xc9),'body':_0x1775de[_0x251d14(0xc0)],'description':_0x1775de[_0x251d14(0x9f)]};},async 'execute'(_0x573c62){return buildDatasetExtendUpdateResult({'appCode':_0x573c62['appCode'],'input':readExtendUpdateInput(_0x573c62),'dryRun':![]});}};function readExtendUpdateInput(_0x3a6f75){const _0x10d0fc=a75_0x5dd73b,_0x382e5a=trim(_0x3a6f75[_0x10d0fc(0xa1)]('code')),_0x1971ea=parseJsonObjectFlag(_0x3a6f75[_0x10d0fc(0xa1)]('patch-json'),_0x10d0fc(0xa0)),_0x2fb437=parseJsonObjectFlag(_0x3a6f75[_0x10d0fc(0xa1)](_0x10d0fc(0xc6)),'--expect-json');return{'code':_0x382e5a,'patch':_0x1971ea||{},'expect':_0x2fb437};}function validateInput(_0x25fb6e){const _0x137331=a75_0x5dd73b;if(!_0x25fb6e[_0x137331(0xb4)])throw CliErrors[_0x137331(0xa9)](_0x137331(0xb1));validateExtendPatchKeys(_0x25fb6e['patch']);}function parseDatasetExtend(_0x1d0cb1){const _0x396caf=a75_0x5dd73b;if(typeof _0x1d0cb1===_0x396caf(0xcb)){const _0x25b544=_0x1d0cb1[_0x396caf(0xb0)]();if(!_0x25b544)return{'value':{},'shape':_0x396caf(0xcb)};let _0xa8eb45;try{_0xa8eb45=JSON[_0x396caf(0xb2)](_0x25b544);}catch(_0x28ba21){const _0x201395=_0x28ba21 instanceof Error?_0x28ba21[_0x396caf(0x9f)]:String(_0x28ba21);throw CliErrors[_0x396caf(0xa9)]('Dataset\x20extend\x20must\x20be\x20valid\x20JSON\x20object:\x20'+_0x201395);}if(!isPlainObject(_0xa8eb45)||Array[_0x396caf(0xcc)](_0xa8eb45))throw CliErrors['validation']('Dataset\x20extend\x20must\x20be\x20a\x20JSON\x20object');return{'value':_0xa8eb45,'shape':'string'};}if(_0x1d0cb1===undefined||_0x1d0cb1===null)return{'value':{},'shape':_0x396caf(0xcb)};if(!isPlainObject(_0x1d0cb1)||Array['isArray'](_0x1d0cb1))throw CliErrors[_0x396caf(0xa9)](_0x396caf(0xbb));return{'value':_0x1d0cb1,'shape':_0x396caf(0x9e)};}function serializeDatasetExtend(_0x35fbd9,_0x37a006){const _0x102419=a75_0x5dd73b;return _0x37a006===_0x102419(0xcb)?JSON[_0x102419(0xb5)](_0x35fbd9):_0x35fbd9;}function summarizeDataset(_0xecd2d4,_0x327701){const _0x14159e=a75_0x5dd73b,_0x537f7d=isPlainObject(_0xecd2d4['dataset'])?_0xecd2d4[_0x14159e(0xd4)]:{},_0x7a0d97=isPlainObject(_0xecd2d4[_0x14159e(0xaf)])?_0xecd2d4['dbtableConfig']:{};return{'id':_0xecd2d4[_0x14159e(0xbc)]??_0xecd2d4['id']??_0x537f7d[_0x14159e(0xa7)]??null,'code':_0xecd2d4[_0x14159e(0x9c)]??_0xecd2d4['code']??_0x537f7d[_0x14159e(0xbe)]??_0x327701,'name':_0xecd2d4[_0x14159e(0xa4)]??_0x537f7d[_0x14159e(0xd5)]??null,'table':_0x7a0d97['tableName']??_0x537f7d[_0x14159e(0xd1)]??null,'db':_0x7a0d97[_0x14159e(0xb7)]??_0x7a0d97[_0x14159e(0xc1)]??null};}function deepClone(_0x34f01b){const _0x2f28e5=a75_0x5dd73b;if(_0x34f01b===undefined)return _0x34f01b;return JSON[_0x2f28e5(0xb2)](JSON['stringify'](_0x34f01b));}function deepEqual(_0x1f283a,_0xed5f88){const _0x4ad502=a75_0x5dd73b;return JSON[_0x4ad502(0xb5)](_0x1f283a)===JSON['stringify'](_0xed5f88);}function a75_0x1056(){const _0x1aabde=['1635108bQRXww','get','modelCode','Dry-run:\x20dataset\x20extend\x20would\x20change\x20(','object','message','--patch-json','str','has','patch','name','patch-json','577268DhIWFx','datasetId','Patch\x20dataset\x20top-level\x20extend\x20safely','validation','length','12wDHzwo','shape','dataset\x20extend-update\x20does\x20not\x20support\x20businessGroup;\x20use\x20dataset\x20business-group-update','hint','dbtableConfig','trim','--code\x20is\x20required','parse','from','code','stringify','extend','dbName','\x20must\x20be\x20a\x20JSON\x20object','5065DBWyQD','\x20must\x20be\x20valid\x20JSON\x20object:\x20','Dataset\x20extend\x20must\x20be\x20a\x20JSON\x20object','modelId','expect','datasetCode','push','data','dbId','7302DksLJR','1589740UXBhfg','2266296GggYFc','value','expect-json','POST','extend-update','/smartapi/dataset/update-driven-data','JSON\x20object\x20of\x20expected\x20current\x20extend\x20values;\x20mismatch\x20aborts\x20without\x20writing','string','isArray','2305755lhNuOS','1517283aAERzb','No\x20dataset\x20extend\x20patch\x20keys\x20are\x20currently\x20supported.','businessGroup','tableName','appCode','join','dataset','datasetName','21bykElD','sort','extend.'];a75_0x1056=function(){return _0x1aabde;};return a75_0x1056();}function isPlainObject(_0x4144d0){const _0x586b53=a75_0x5dd73b;return Boolean(_0x4144d0)&&typeof _0x4144d0===_0x586b53(0x9e)&&!Array['isArray'](_0x4144d0);}function trim(_0x2e2a99){const _0x225a39=a75_0x5dd73b,_0x3c5100=String(_0x2e2a99||'')[_0x225a39(0xb0)]();return _0x3c5100;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a76_0x191ab4=a76_0x3218;(function(_0x53d8f6,_0x14d380){const _0x381d78=a76_0x3218,_0x36aff5=_0x53d8f6();while(!![]){try{const _0x582cb6=-parseInt(_0x381d78(0xf3))/0x1*(-parseInt(_0x381d78(0xf7))/0x2)+parseInt(_0x381d78(0xf5))/0x3*(-parseInt(_0x381d78(0x105))/0x4)+-parseInt(_0x381d78(0xdc))/0x5*(-parseInt(_0x381d78(0xf4))/0x6)+parseInt(_0x381d78(0xde))/0x7*(parseInt(_0x381d78(0xe8))/0x8)+-parseInt(_0x381d78(0xeb))/0x9+parseInt(_0x381d78(0xe9))/0xa+parseInt(_0x381d78(0x108))/0xb*(parseInt(_0x381d78(0xf2))/0xc);if(_0x582cb6===_0x14d380)break;else _0x36aff5['push'](_0x36aff5['shift']());}catch(_0x554f45){_0x36aff5['push'](_0x36aff5['shift']());}}}(a76_0x1740,0x37e68));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='Dataset\x20field\x20restoration\x20does\x20not\x20synchronize\x20or\x20publish\x20related\x20pages.',NO_RESUBMIT_WARNING=a76_0x191ab4(0xd8);function a76_0x1740(){const _0x39bf33=['Do\x20not\x20resubmit\x20field-restore\x20automatically;\x20inspect\x20user-deleted-field-list\x20and\x20dataset\x20detail\x20first.','dataset\x20field-restore\x20does\x20not\x20accept\x20--confirm.','mutation-outcome-unknown','validation','670435HuhFRJ','readback-failed','908642fZVhIG','Restore\x20one\x20exact\x20user-deleted\x20field\x20code\x20at\x20a\x20time\x20with\x20--field.','Dataset\x20field\x20restore\x20outcome\x20is\x20unknown\x20for\x20','unknown','--code\x20is\x20required','length','appCode','isArray','Exact\x20server\x20Dataset\x20field\x20code\x20to\x20restore','requestedColumnIds','8NfCbGO','29340FRQcXq','--field\x20is\x20required','3730401vuBUOk','deleted','POST','Restore\x20one\x20Dataset\x20field\x20explicitly\x20deleted\x20by\x20a\x20user','code','write','dataset\x20field-restore\x20does\x20not\x20accept\x20--fields.','4151520VpYAXr','2605WdBcQo','6UgyBLR','75NbFjOt','field-restore','94QDdOBb','displayName','trim','No\x20restore\x20request\x20was\x20sent.\x20Resolve\x20the\x20duplicate\x20server\x20metadata\x20first.','message','name','Dataset\x20field\x20restore\x20could\x20not\x20be\x20verified\x20for\x20','field','Dataset\x20field\x20restore\x20readback\x20failed\x20for\x20','dataset\x20field-restore\x20does\x20not\x20accept\x20--all.','fields','data','all','object','70036UUDtUG','Run\x20the\x20same\x20single-field\x20command\x20with\x20--dry-run\x20first.','No\x20user-deleted\x20field\x20found\x20with\x20code:\x20','22dEPqiH','Use\x20`rabetbase\x20dataset\x20user-deleted-field-list\x20--code\x20<datasetCode>`\x20to\x20inspect\x20exact\x20field\x20codes.','/smartapi/dataset/restore-column','string','dataset','warnings','properties','Dry-run:\x20Dataset\x20field\x20','dataset\x20field-restore\x20does\x20not\x20accept\x20--yes.','map','yes'];a76_0x1740=function(){return _0x39bf33;};return a76_0x1740();}export async function buildDatasetFieldRestoreResult({appCode:_0x22c20b,input:_0x53d755,dryRun:_0x41766c}){const _0x5bbbab=a76_0x191ab4,_0x34d1f9=_0x53d755[_0x5bbbab(0xef)][_0x5bbbab(0xf9)](),_0x37650e=_0x53d755[_0x5bbbab(0xfe)]['trim']();if(!_0x34d1f9)throw CliErrors[_0x5bbbab(0xdb)](_0x5bbbab(0xe2));if(!_0x37650e)throw CliErrors[_0x5bbbab(0xdb)](_0x5bbbab(0xea));const _0x14274f=await getDatasetDetail(_0x34d1f9),_0x16a98d=resolveDataset(_0x14274f,_0x34d1f9),_0x531a17=(await listUserDeletedDatasetColumns(_0x16a98d['id']))[_0x5bbbab(0xd6)](normalizeUserDeletedField),_0x519ef5=_0x531a17['filter'](_0x8db47d=>_0x8db47d[_0x5bbbab(0xef)]===_0x37650e);if(_0x519ef5[_0x5bbbab(0xe3)]===0x0)throw CliErrors[_0x5bbbab(0xdb)](_0x5bbbab(0x107)+_0x37650e,_0x5bbbab(0x109));if(_0x519ef5['length']>0x1)throw CliErrors[_0x5bbbab(0xdb)]('Matched\x20multiple\x20user-deleted\x20fields\x20with\x20code:\x20'+_0x37650e,_0x5bbbab(0xfa));const _0xb620bf=_0x519ef5[0x0],_0x2f8bc9={'id':_0xb620bf['id'],'code':_0xb620bf[_0x5bbbab(0xef)],'displayName':_0xb620bf[_0x5bbbab(0xf8)],'deleted':![],'active':!![]},_0x287ed4={'operation':_0x5bbbab(0xf6),'appCode':_0x22c20b,'selector':{'code':_0x34d1f9,'field':_0x37650e},'dataset':_0x16a98d,'before':_0xb620bf,'dryRun':_0x41766c,'warnings':[PAGE_SYNC_WARNING]};if(_0x41766c)return{'ok':!![],'data':{..._0x287ed4,'after':_0x2f8bc9,'backend':{'submitted':![],'requestedColumnIds':[_0xb620bf['id']],'restoredCount':null},'verification':{'performed':![],'passed':null}},'message':_0x5bbbab(0x10f)+_0x37650e+'\x20would\x20be\x20restored'};let _0xb42e27=null,_0xad7c77=![];try{_0xb42e27=await restoreDatasetColumns(_0x16a98d['id'],[_0xb620bf['id']]);}catch(_0x29ac62){if(!isPlatformTransportFailure(_0x29ac62))throw _0x29ac62;_0xad7c77=!![];}const _0x3d821f={'submitted':!![],'requestedColumnIds':[_0xb620bf['id']],'restoredCount':_0xb42e27,..._0xad7c77?{'outcome':_0x5bbbab(0xe1)}:{}};let _0x513ff3,_0x3b5741;try{[_0x513ff3,_0x3b5741]=await Promise[_0x5bbbab(0x103)]([listUserDeletedDatasetColumns(_0x16a98d['id']),getDatasetDetail(_0x34d1f9)]);}catch{return{'ok':![],'data':{..._0x287ed4,'after':null,'backend':_0x3d821f,'warnings':[..._0x287ed4[_0x5bbbab(0x10d)],NO_RESUBMIT_WARNING],'verification':{'performed':![],'passed':![],'reason':_0xad7c77?_0x5bbbab(0xda):_0x5bbbab(0xdd)}},'message':_0xad7c77?'Dataset\x20field\x20restore\x20outcome\x20is\x20unknown\x20for\x20'+_0x37650e+'.\x20'+NO_RESUBMIT_WARNING:_0x5bbbab(0xff)+_0x37650e+'.\x20'+NO_RESUBMIT_WARNING};}const _0x3501ec=!_0x513ff3['some'](_0x2e318e=>Number(_0x2e318e['id'])===_0xb620bf['id']||_0x2e318e[_0x5bbbab(0xef)]===_0x37650e),_0x1a4ef1=findActiveField(_0x3b5741,_0xb620bf['id'],_0x37650e),_0x31117e=_0x1a4ef1!==null,_0x20ae56=!_0xad7c77&&_0xb42e27===0x1&&_0x3501ec&&_0x31117e,_0x46c8a9={'performed':!![],'deletedListCleared':_0x3501ec,'activeFieldPresent':_0x31117e,'passed':_0x20ae56,..._0xad7c77?{'reason':'mutation-outcome-unknown'}:_0xb42e27!==0x1?{'reason':'server-restored-count-mismatch'}:{}};return{'ok':_0x20ae56,'data':{..._0x287ed4,'after':_0x1a4ef1,'backend':_0x3d821f,'warnings':_0x20ae56?_0x287ed4['warnings']:[..._0x287ed4[_0x5bbbab(0x10d)],NO_RESUBMIT_WARNING],'verification':_0x46c8a9},'message':_0x20ae56?'Restored\x20Dataset\x20field\x20'+_0x37650e:_0xad7c77?_0x5bbbab(0xe0)+_0x37650e+'.\x20'+NO_RESUBMIT_WARNING:_0x5bbbab(0xfd)+_0x37650e+'.\x20'+NO_RESUBMIT_WARNING};}export const datasetFieldRestore={'service':'dataset','command':a76_0x191ab4(0xf6),'description':a76_0x191ab4(0xee),'risk':a76_0x191ab4(0xf0),'structuredErrors':!![],'rejectedFlags':[{'name':a76_0x191ab4(0x103),'message':a76_0x191ab4(0x100),'hint':'Restore\x20one\x20exact\x20user-deleted\x20field\x20code\x20at\x20a\x20time\x20with\x20--field.'},{'name':'fields','message':a76_0x191ab4(0xf1),'hint':a76_0x191ab4(0xdf)},{'name':a76_0x191ab4(0xd7),'message':a76_0x191ab4(0x110),'hint':'Run\x20the\x20same\x20single-field\x20command\x20with\x20--dry-run\x20first.'},{'name':'confirm','message':a76_0x191ab4(0xd9),'hint':a76_0x191ab4(0x106)}],'flags':[CODE_FLAG,{'name':a76_0x191ab4(0xfe),'type':a76_0x191ab4(0x10b),'required':!![],'description':a76_0x191ab4(0xe6)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x21fe5c){readInput(_0x21fe5c);},async 'dryRun'(_0x266e29){const _0x3c7059=a76_0x191ab4,_0x24c092=await buildDatasetFieldRestoreResult({'appCode':_0x266e29[_0x3c7059(0xe4)],'input':readInput(_0x266e29),'dryRun':!![]});return asDryRunResult({..._0x24c092['data'],'body':{'datasetId':_0x24c092[_0x3c7059(0x102)][_0x3c7059(0x10c)]['id'],'columnIds':_0x24c092[_0x3c7059(0x102)]['backend'][_0x3c7059(0xe7)]}},{'method':_0x3c7059(0xed),'url':_0x3c7059(0x10a),'description':_0x24c092[_0x3c7059(0xfb)]});},async 'execute'(_0x217704){const _0x53d6c3=a76_0x191ab4;return buildDatasetFieldRestoreResult({'appCode':_0x217704[_0x53d6c3(0xe4)],'input':readInput(_0x217704),'dryRun':![]});}};function a76_0x3218(_0x1af688,_0x301fae){_0x1af688=_0x1af688-0xd6;const _0x174091=a76_0x1740();let _0x3218ff=_0x174091[_0x1af688];return _0x3218ff;}function readInput(_0x26753f){const _0x2118ad=a76_0x191ab4,_0x2377b9={'code':String(_0x26753f['str']('code')||'')[_0x2118ad(0xf9)](),'field':String(_0x26753f['str']('field')||'')[_0x2118ad(0xf9)]()};if(!_0x2377b9['code'])throw CliErrors[_0x2118ad(0xdb)](_0x2118ad(0xe2));if(!_0x2377b9[_0x2118ad(0xfe)])throw CliErrors[_0x2118ad(0xdb)](_0x2118ad(0xea));return _0x2377b9;}function findActiveField(_0x4fd8b8,_0x8124e8,_0xa76468){const _0x483751=a76_0x191ab4,_0x29cd2a=Array['isArray'](_0x4fd8b8[_0x483751(0x101)]),_0x5dc3e4=_0x29cd2a?_0x4fd8b8[_0x483751(0x101)]:Array[_0x483751(0xe5)](_0x4fd8b8[_0x483751(0x10e)])?_0x4fd8b8['properties']:[];for(const _0x51a8ad of _0x5dc3e4){if(!_0x51a8ad||typeof _0x51a8ad!==_0x483751(0x104))continue;const _0x40671c=_0x51a8ad,_0x795d0d=_0x29cd2a?_0x40671c[_0x483751(0xfc)]:_0x40671c[_0x483751(0xef)],_0x2fafdc=_0x40671c[_0x483751(0xec)]!==!![]&&Number(_0x40671c['id'])===_0x8124e8&&_0x795d0d===_0xa76468;if(!_0x2fafdc)continue;const _0x5b6ec7=_0x29cd2a?_0x40671c[_0x483751(0xf8)]:_0x40671c[_0x483751(0xfc)];return{'id':_0x8124e8,'code':_0xa76468,'displayName':typeof _0x5b6ec7===_0x483751(0x10b)&&_0x5b6ec7?_0x5b6ec7:_0xa76468,'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_0x3e1b49=a77_0x2843;(function(_0x3db62a,_0x586a00){const _0x352d06=a77_0x2843,_0x38258f=_0x3db62a();while(!![]){try{const _0x1b13da=parseInt(_0x352d06(0xf5))/0x1*(parseInt(_0x352d06(0xbb))/0x2)+parseInt(_0x352d06(0xd1))/0x3*(parseInt(_0x352d06(0xe5))/0x4)+parseInt(_0x352d06(0xe8))/0x5*(-parseInt(_0x352d06(0xc1))/0x6)+-parseInt(_0x352d06(0xdc))/0x7+-parseInt(_0x352d06(0xb3))/0x8+parseInt(_0x352d06(0xe1))/0x9+parseInt(_0x352d06(0xec))/0xa;if(_0x1b13da===_0x586a00)break;else _0x38258f['push'](_0x38258f['shift']());}catch(_0xf17fdd){_0x38258f['push'](_0x38258f['shift']());}}}(a77_0x44b5,0x536ab));import{getDatasetDetail,updateDrivenData}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL,CODE_FLAG}from'../../commands/common/flags.js';import{CliErrors}from'../../errors.js';function a77_0x44b5(){const _0x58f761=['parse','6tLLMEZ','sort','validation','message','entries','tableName','Unsupported\x20patch\x20key:\x20','options',',\x20actual\x20','Expectation\x20mismatch\x20at\x20','autoIncrement','294931kOZymQ','has','--field\x20is\x20required','dbTypeLen','pkField','4923243lpuYsa','str','keys','Exact\x20raw\x20fields[].name\x20to\x20patch','186292OmkefH','Field\x20not\x20found:\x20','description','1030840znBoIq','add','datasetId','patch','1561590JaUMJu','Patch\x20one\x20raw\x20dataset\x20fields[]\x20field\x20object\x20safely','deleted','dbName','dataset','code','defaultAggregation','Forbidden\x20patch\x20key:\x20','appCode','1glzCOC','/smartapi/dataset/update-driven-data','Allowed\x20keys:\x20','patch-json','join','from','dbtableConfig','JSON\x20object\x20patch;\x20allowed\x20keys:\x20doType/displayName/description/options/required/datetimeFormat/defaultAggregation/chartRole/deprecated','1374576pbrRlq','field','string','isArray','--patch-json\x20must\x20contain\x20at\x20least\x20one\x20key','doType','\x20would\x20change\x20(','findIndex','343268ZcuidL','expect','fields','\x20must\x20be\x20valid\x20JSON\x20object:\x20','datetimeFormat','\x20must\x20be\x20a\x20JSON\x20object','12DZznsK','JSON\x20object\x20of\x20expected\x20current\x20field\x20values;\x20mismatch\x20aborts\x20without\x20writing','dbType','modelCode','properties','expect-json','datasetCode','chartRole','stringify','deprecated','Dry-run:\x20dataset\x20field\x20','Driven\x20data\x20does\x20not\x20contain\x20fields[]\x20or\x20properties[]','name','systemRetain','dbFieldName'];a77_0x44b5=function(){return _0x58f761;};return a77_0x44b5();}const MUTABLE_FIELD_KEYS=new Set([a77_0x3e1b49(0xb8),'displayName',a77_0x3e1b49(0xe7),a77_0x3e1b49(0xd8),'required',a77_0x3e1b49(0xbf),a77_0x3e1b49(0xf2),a77_0x3e1b49(0xc8),a77_0x3e1b49(0xca)]),FORBIDDEN_FIELD_KEYS=new Set(['id',a77_0x3e1b49(0xcd),a77_0x3e1b49(0xf1),a77_0x3e1b49(0xc3),a77_0x3e1b49(0xdf),'dbTypeScale',a77_0x3e1b49(0xcf),a77_0x3e1b49(0xd6),a77_0x3e1b49(0xee),a77_0x3e1b49(0xe0),a77_0x3e1b49(0xdb),a77_0x3e1b49(0xce)]);export function parseJsonObjectFlag(_0x5bebba,_0x51aaa2){const _0x131068=a77_0x3e1b49;if(!_0x5bebba)return undefined;let _0x450ece;try{_0x450ece=JSON[_0x131068(0xd0)](_0x5bebba);}catch(_0x1930ca){const _0x4bd18d=_0x1930ca instanceof Error?_0x1930ca[_0x131068(0xd4)]:String(_0x1930ca);throw CliErrors[_0x131068(0xd3)](_0x51aaa2+_0x131068(0xbe)+_0x4bd18d);}if(!isPlainObject(_0x450ece)||Array[_0x131068(0xb6)](_0x450ece))throw CliErrors[_0x131068(0xd3)](_0x51aaa2+_0x131068(0xc0));return _0x450ece;}export function validatePatchKeys(_0x585c8e){const _0x153994=a77_0x3e1b49,_0x99a378=Object[_0x153994(0xe3)](_0x585c8e);if(_0x99a378['length']===0x0)throw CliErrors[_0x153994(0xd3)](_0x153994(0xb7));for(const _0x4bfe21 of _0x99a378){if(FORBIDDEN_FIELD_KEYS[_0x153994(0xdd)](_0x4bfe21))throw CliErrors[_0x153994(0xd3)](_0x153994(0xf3)+_0x4bfe21);if(!MUTABLE_FIELD_KEYS[_0x153994(0xdd)](_0x4bfe21))throw CliErrors['validation'](_0x153994(0xd7)+_0x4bfe21,_0x153994(0xf7)+Array[_0x153994(0xfa)](MUTABLE_FIELD_KEYS)[_0x153994(0xf9)](',\x20'));}}export function applyFieldPatch(_0x233f01,_0x295d54){const _0x21efed=a77_0x3e1b49;validatePatchKeys(_0x295d54);const _0x5864e0=deepClone(_0x233f01),_0x2e9075=new Set();for(const [_0x5ef207,_0x29d2d4]of Object[_0x21efed(0xd5)](_0x295d54)){const _0x4a53cb=_0x5864e0[_0x5ef207],_0xb097dd=mergePatchValue(_0x4a53cb,_0x29d2d4);!deepEqual(_0x4a53cb,_0xb097dd)&&(_0x5864e0[_0x5ef207]=_0xb097dd,_0x2e9075[_0x21efed(0xe9)](_0x5ef207),collectChangedPaths(_0x5ef207,_0x4a53cb,_0xb097dd,_0x2e9075));}return{'after':_0x5864e0,'changedPaths':Array['from'](_0x2e9075)[_0x21efed(0xd2)](),'changed':_0x2e9075['size']>0x0};}export function assertExpectation(_0xbfd86,_0x5dfe17){const _0x527975=a77_0x3e1b49;if(!_0x5dfe17)return;for(const [_0x45d025,_0x22a388]of Object[_0x527975(0xd5)](_0x5dfe17)){const _0x917bcb=_0xbfd86[_0x45d025];if(!deepEqual(_0x917bcb,_0x22a388))throw CliErrors['validation'](_0x527975(0xda)+_0x45d025,'Expected\x20'+JSON[_0x527975(0xc9)](_0x22a388)+_0x527975(0xd9)+JSON['stringify'](_0x917bcb));}}export async function buildDatasetFieldUpdateResult({appCode:_0x38bf12,input:_0x1e7346,dryRun:_0x486096}){const _0x1c9377=a77_0x3e1b49;validateInput(_0x1e7346);const _0x595711=await getDatasetDetail(_0x1e7346[_0x1c9377(0xf1)]),_0x244697=readFieldArray(_0x595711),_0x5674a1=_0x244697[_0x1c9377(0xba)](_0x59d14d=>_0x59d14d?.[_0x1c9377(0xcd)]===_0x1e7346[_0x1c9377(0xb4)]);if(_0x5674a1<0x0)throw CliErrors[_0x1c9377(0xd3)](_0x1c9377(0xe6)+_0x1e7346[_0x1c9377(0xb4)]);const _0x2b332e=deepClone(_0x244697[_0x5674a1]);assertExpectation(_0x2b332e,_0x1e7346[_0x1c9377(0xbc)]);const {after:_0x424e0b,changedPaths:_0xd2e534,changed:_0x58247f}=applyFieldPatch(_0x2b332e,_0x1e7346[_0x1c9377(0xeb)]),_0x4c905f=summarizeDataset(_0x595711,_0x1e7346['code']);return _0x58247f&&!_0x486096&&(_0x244697[_0x5674a1]=_0x424e0b,await updateDrivenData(_0x595711)),{'ok':!![],'data':{'appCode':_0x38bf12,'selector':{'code':_0x1e7346[_0x1c9377(0xf1)]},'dataset':_0x4c905f,'field':{'id':_0x2b332e['id']??null,'name':_0x2b332e[_0x1c9377(0xcd)]},'dryRun':_0x486096,'changed':_0x58247f,'changedPaths':_0xd2e534,'before':_0x2b332e,'after':_0x424e0b,'submitted':_0x58247f&&!_0x486096},'message':_0x58247f?_0x486096?_0x1c9377(0xcb)+_0x1e7346[_0x1c9377(0xb4)]+_0x1c9377(0xb9)+_0xd2e534[_0x1c9377(0xf9)](',\x20')+')':'Updated\x20dataset\x20field\x20'+_0x1e7346[_0x1c9377(0xb4)]+'\x20('+_0xd2e534[_0x1c9377(0xf9)](',\x20')+')':'No\x20changes\x20for\x20dataset\x20field\x20'+_0x1e7346[_0x1c9377(0xb4)]};}export const datasetFieldUpdate={'service':'dataset','command':'field-update','description':a77_0x3e1b49(0xed),'risk':'write','flags':[CODE_FLAG,{'name':'field','type':a77_0x3e1b49(0xb5),'required':!![],'description':a77_0x3e1b49(0xe4)},{'name':'patch-json','type':a77_0x3e1b49(0xb5),'required':!![],'description':a77_0x3e1b49(0xfc)},{'name':'expect-json','type':a77_0x3e1b49(0xb5),'required':![],'description':a77_0x3e1b49(0xc2)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0xb5dbc6){validateInput(readFieldUpdateInput(_0xb5dbc6));},async 'dryRun'(_0x1432e6){const _0x31edd3=a77_0x3e1b49,_0x9f4fff=await buildDatasetFieldUpdateResult({'appCode':_0x1432e6[_0x31edd3(0xf4)],'input':readFieldUpdateInput(_0x1432e6),'dryRun':!![]});return{'method':'POST','url':_0x31edd3(0xf6),'body':_0x9f4fff['data'],'description':_0x9f4fff['message']};},async 'execute'(_0x59b4f3){const _0x53eded=a77_0x3e1b49;return buildDatasetFieldUpdateResult({'appCode':_0x59b4f3[_0x53eded(0xf4)],'input':readFieldUpdateInput(_0x59b4f3),'dryRun':![]});}};function a77_0x2843(_0x546a3b,_0x55158b){_0x546a3b=_0x546a3b-0xb3;const _0x44b5ed=a77_0x44b5();let _0x284357=_0x44b5ed[_0x546a3b];return _0x284357;}function readFieldUpdateInput(_0x59151d){const _0x31ae8b=a77_0x3e1b49,_0x3d0868=trim(_0x59151d['str']('code')),_0x4447ce=emptyToUndefined(_0x59151d[_0x31ae8b(0xe2)](_0x31ae8b(0xb4))),_0x47d408=parseJsonObjectFlag(_0x59151d[_0x31ae8b(0xe2)](_0x31ae8b(0xf8)),'--patch-json'),_0x17c778=parseJsonObjectFlag(_0x59151d['str'](_0x31ae8b(0xc6)),'--expect-json');return{'code':_0x3d0868,'field':_0x4447ce||'','patch':_0x47d408||{},'expect':_0x17c778};}function validateInput(_0x1fe271){const _0x548cae=a77_0x3e1b49;if(!_0x1fe271['code'])throw CliErrors['validation']('--code\x20is\x20required');if(!_0x1fe271[_0x548cae(0xb4)])throw CliErrors[_0x548cae(0xd3)](_0x548cae(0xde));validatePatchKeys(_0x1fe271[_0x548cae(0xeb)]);}function readFieldArray(_0x109330){const _0x2cd5e3=a77_0x3e1b49;if(Array['isArray'](_0x109330[_0x2cd5e3(0xbd)]))return _0x109330['fields'];if(Array[_0x2cd5e3(0xb6)](_0x109330[_0x2cd5e3(0xc5)]))return _0x109330[_0x2cd5e3(0xc5)];throw CliErrors['validation'](_0x2cd5e3(0xcc));}function summarizeDataset(_0x2d6719,_0xf02182){const _0xfbf9c2=a77_0x3e1b49,_0x3498e6=isPlainObject(_0x2d6719[_0xfbf9c2(0xf0)])?_0x2d6719[_0xfbf9c2(0xf0)]:{},_0x4adc0b=isPlainObject(_0x2d6719[_0xfbf9c2(0xfb)])?_0x2d6719['dbtableConfig']:{};return{'id':_0x2d6719['modelId']??_0x2d6719['id']??_0x3498e6[_0xfbf9c2(0xea)]??null,'code':_0x2d6719[_0xfbf9c2(0xc4)]??_0x2d6719[_0xfbf9c2(0xf1)]??_0x3498e6[_0xfbf9c2(0xc7)]??_0xf02182,'name':_0x2d6719[_0xfbf9c2(0xcd)]??_0x3498e6['datasetName']??null,'table':_0x4adc0b[_0xfbf9c2(0xd6)]??_0x3498e6[_0xfbf9c2(0xd6)]??null,'db':_0x4adc0b[_0xfbf9c2(0xef)]??_0x4adc0b['dbId']??null};}function mergePatchValue(_0x5442dc,_0x21a20e){if(isPlainObject(_0x5442dc)&&isPlainObject(_0x21a20e))return deepMerge(_0x5442dc,_0x21a20e);return deepClone(_0x21a20e);}function deepMerge(_0x4bde13,_0x744b31){const _0x526243=a77_0x3e1b49,_0x3096da=deepClone(_0x4bde13);for(const [_0x43b0c,_0xb1c49f]of Object[_0x526243(0xd5)](_0x744b31)){_0x3096da[_0x43b0c]=isPlainObject(_0x3096da[_0x43b0c])&&isPlainObject(_0xb1c49f)?deepMerge(_0x3096da[_0x43b0c],_0xb1c49f):deepClone(_0xb1c49f);}return _0x3096da;}function collectChangedPaths(_0x5410c0,_0x4ad9cf,_0x584974,_0x19978d){const _0x21d008=a77_0x3e1b49;if(!isPlainObject(_0x4ad9cf)||!isPlainObject(_0x584974))return;const _0x4ced6b=new Set([...Object['keys'](_0x4ad9cf),...Object['keys'](_0x584974)]);for(const _0x1bd095 of _0x4ced6b){const _0xf560f4=_0x4ad9cf[_0x1bd095],_0x16bbf7=_0x584974[_0x1bd095];!deepEqual(_0xf560f4,_0x16bbf7)&&_0x19978d[_0x21d008(0xe9)](_0x5410c0+'.'+_0x1bd095);}}function deepClone(_0x4c15b5){const _0x588621=a77_0x3e1b49;if(_0x4c15b5===undefined)return _0x4c15b5;return JSON[_0x588621(0xd0)](JSON[_0x588621(0xc9)](_0x4c15b5));}function deepEqual(_0x160bdf,_0x512d6a){const _0x58c77f=a77_0x3e1b49;return JSON[_0x58c77f(0xc9)](_0x160bdf)===JSON[_0x58c77f(0xc9)](_0x512d6a);}function isPlainObject(_0xd5b01){const _0x43aacb=a77_0x3e1b49;return Boolean(_0xd5b01)&&typeof _0xd5b01==='object'&&!Array[_0x43aacb(0xb6)](_0xd5b01);}function emptyToUndefined(_0x4c4c5c){const _0xab40ce=String(_0x4c4c5c||'')['trim']();return _0xab40ce||undefined;}function trim(_0x3cd7c9){return String(_0x3cd7c9||'')['trim']();}
|