@lovrabet/lovrabet-cli 2.1.18-beta.1 → 2.1.18-beta.2
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/cli.d.ts +21 -0
- package/lib/cli.js +1 -1
- package/lib/commands/api-doc/index.d.ts +38 -0
- package/lib/commands/api-doc/index.js +1 -1
- package/lib/commands/app/cache.d.ts +61 -0
- package/lib/commands/app/cache.js +1 -1
- package/lib/commands/app/definitions.d.ts +26 -0
- package/lib/commands/app/definitions.js +1 -1
- package/lib/commands/app/eligibility.d.ts +16 -0
- package/lib/commands/app/eligibility.js +1 -1
- package/lib/commands/app/mock-loader.d.ts +41 -0
- package/lib/commands/app/mock-loader.js +1 -1
- package/lib/commands/app/remote-source.d.ts +66 -0
- package/lib/commands/app/remote-source.js +1 -1
- package/lib/commands/app/shared.d.ts +38 -0
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/get.d.ts +2 -0
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.d.ts +2 -0
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/artifact/index.d.ts +9 -0
- package/lib/commands/artifact/index.js +1 -1
- package/lib/commands/auth/device.d.ts +31 -0
- package/lib/commands/auth/device.js +1 -1
- package/lib/commands/auth/index.d.ts +23 -0
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/auth/prompt.d.ts +33 -0
- package/lib/commands/auth/prompt.js +1 -1
- package/lib/commands/bff/detail.d.ts +8 -0
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/exec.d.ts +19 -0
- package/lib/commands/bff/exec.js +1 -1
- package/lib/commands/bff/index.d.ts +15 -0
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/cli-skill/index.d.ts +9 -0
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/common/config-policy.d.ts +80 -0
- package/lib/commands/common/config-policy.js +1 -1
- package/lib/commands/common/constraints.d.ts +67 -0
- package/lib/commands/common/constraints.js +1 -1
- package/lib/commands/common/flags.d.ts +41 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.d.ts +6 -0
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/config/definitions.d.ts +21 -0
- package/lib/commands/config/definitions.js +1 -1
- package/lib/commands/config/shared.d.ts +17 -0
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/index.d.ts +27 -0
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/dataset/detail.d.ts +26 -0
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.d.ts +10 -0
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.d.ts +18 -0
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/sdk-doc.d.ts +6 -0
- package/lib/commands/dataset/sdk-doc.js +1 -1
- package/lib/commands/doctor.d.ts +23 -0
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.d.ts +2 -0
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init.d.ts +32 -0
- package/lib/commands/init.js +1 -1
- package/lib/commands/kb/index.d.ts +8 -0
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/logs/index.d.ts +20 -0
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/ocr/index.d.ts +2 -0
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/personal-bff/index.d.ts +5 -0
- package/lib/commands/personal-bff/index.js +1 -1
- package/lib/commands/registry.d.ts +56 -0
- package/lib/commands/registry.js +1 -1
- package/lib/commands/schedule/index.d.ts +2 -0
- package/lib/commands/schedule/index.js +1 -1
- package/lib/commands/schema.d.ts +18 -0
- package/lib/commands/schema.js +1 -1
- package/lib/commands/service/dynamic.d.ts +18 -0
- package/lib/commands/service/dynamic.js +1 -1
- package/lib/commands/service/function-name-adapter.d.ts +13 -0
- package/lib/commands/service/function-name-adapter.js +1 -1
- package/lib/commands/service/index.d.ts +2 -0
- package/lib/commands/service/index.js +1 -1
- package/lib/commands/service/registry.d.ts +102 -0
- package/lib/commands/service/registry.js +1 -1
- package/lib/commands/skill/commands/create.d.ts +2 -0
- package/lib/commands/skill/commands/create.js +1 -1
- package/lib/commands/skill/commands/install.d.ts +2 -0
- package/lib/commands/skill/commands/install.js +1 -1
- package/lib/commands/skill/commands/list.d.ts +2 -0
- package/lib/commands/skill/commands/list.js +1 -1
- package/lib/commands/skill/commands/push.d.ts +2 -0
- package/lib/commands/skill/commands/push.js +1 -1
- package/lib/commands/skill/commands/validate.d.ts +2 -0
- package/lib/commands/skill/commands/validate.js +1 -1
- package/lib/commands/skill/flags.d.ts +13 -0
- package/lib/commands/skill/flags.js +1 -1
- package/lib/commands/skill/index.d.ts +9 -0
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/skill/manifest-helpers.d.ts +5 -0
- package/lib/commands/skill/manifest-helpers.js +1 -1
- package/lib/commands/skill/push-execute.d.ts +49 -0
- package/lib/commands/skill/push-execute.js +1 -1
- package/lib/commands/skill/push-flow-helpers.d.ts +80 -0
- package/lib/commands/skill/push-flow-helpers.js +1 -1
- package/lib/commands/skill/push-retarget.d.ts +9 -0
- package/lib/commands/skill/push-retarget.js +1 -1
- package/lib/commands/skill/scopes.d.ts +13 -0
- package/lib/commands/skill/scopes.js +1 -1
- package/lib/commands/skill/summary.d.ts +6 -0
- package/lib/commands/skill/summary.js +1 -1
- package/lib/commands/skill/templates.d.ts +23 -0
- package/lib/commands/skill/templates.js +1 -1
- package/lib/commands/skill/validate.d.ts +20 -0
- package/lib/commands/skill/validate.js +1 -1
- package/lib/commands/sql/detail.d.ts +13 -0
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.d.ts +21 -0
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.d.ts +9 -0
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/update.d.ts +10 -0
- package/lib/commands/update.js +1 -1
- package/lib/commands/workspace/index.d.ts +10 -0
- package/lib/commands/workspace/index.js +1 -1
- package/lib/config/schema.d.ts +108 -0
- package/lib/config/schema.js +1 -1
- package/lib/constant/app.d.ts +13 -0
- package/lib/constant/app.js +1 -1
- package/lib/constant/auth-mode.d.ts +28 -0
- package/lib/constant/auth-mode.js +1 -1
- package/lib/constant/cli.d.ts +86 -0
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.d.ts +45 -0
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/distribution.d.ts +12 -0
- package/lib/constant/distribution.js +1 -1
- package/lib/constant/domain.d.ts +57 -0
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.d.ts +56 -0
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.d.ts +13 -0
- package/lib/constant/output.js +1 -1
- package/lib/constant/product.d.ts +79 -0
- package/lib/constant/product.js +1 -1
- package/lib/constant/risk.d.ts +14 -0
- package/lib/constant/risk.js +1 -1
- package/lib/constant/url.d.ts +14 -0
- package/lib/constant/url.js +1 -1
- package/lib/context.d.ts +287 -0
- package/lib/context.js +1 -1
- package/lib/core/api-client.d.ts +451 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/db-resolver.d.ts +39 -0
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/sdk-client.d.ts +62 -0
- package/lib/core/sdk-client.js +1 -1
- package/lib/errors.d.ts +25 -0
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.d.ts +24 -0
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/dryrun.d.ts +64 -0
- package/lib/framework/dryrun.js +1 -1
- package/lib/framework/flags.d.ts +19 -0
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.d.ts +21 -0
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.d.ts +10 -0
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.d.ts +10 -0
- package/lib/framework/output.js +1 -1
- package/lib/framework/preparse.d.ts +64 -0
- package/lib/framework/preparse.js +1 -1
- package/lib/framework/rate-limit.d.ts +10 -0
- package/lib/framework/rate-limit.js +1 -1
- package/lib/framework/response.d.ts +10 -0
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-confirmation.d.ts +46 -0
- package/lib/framework/runner-confirmation.js +1 -1
- package/lib/framework/runner-error.d.ts +28 -0
- package/lib/framework/runner-error.js +1 -1
- package/lib/framework/runner.d.ts +102 -0
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.d.ts +29 -0
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/service-order.d.ts +4 -0
- package/lib/framework/service-order.js +1 -1
- package/lib/framework/types.d.ts +108 -0
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -0
- package/lib/generated/build-info.js +1 -1
- package/lib/help.d.ts +25 -0
- package/lib/help.js +1 -1
- package/lib/runtime/event.d.ts +16 -0
- package/lib/runtime/event.js +1 -0
- package/lib/runtime/index.d.ts +13 -0
- package/lib/runtime/index.js +1 -0
- package/lib/runtime/queue.d.ts +6 -0
- package/lib/runtime/queue.js +1 -0
- package/lib/runtime/resolve.d.ts +14 -0
- package/lib/runtime/resolve.js +1 -0
- package/lib/runtime/types.d.ts +59 -0
- package/lib/runtime/types.js +1 -0
- package/lib/skills/npx-skills-add.d.ts +42 -0
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/runtime-skill-sync/constants.d.ts +4 -0
- package/lib/skills/runtime-skill-sync/constants.js +1 -1
- package/lib/skills/runtime-skill-sync/fs-utils.d.ts +21 -0
- package/lib/skills/runtime-skill-sync/fs-utils.js +1 -1
- package/lib/skills/runtime-skill-sync/hashing.d.ts +9 -0
- package/lib/skills/runtime-skill-sync/hashing.js +1 -1
- package/lib/skills/runtime-skill-sync/links.d.ts +18 -0
- package/lib/skills/runtime-skill-sync/links.js +1 -1
- package/lib/skills/runtime-skill-sync/list-local.d.ts +3 -0
- package/lib/skills/runtime-skill-sync/list-local.js +1 -1
- package/lib/skills/runtime-skill-sync/local-files.d.ts +25 -0
- package/lib/skills/runtime-skill-sync/local-files.js +1 -1
- package/lib/skills/runtime-skill-sync/materialize.d.ts +11 -0
- package/lib/skills/runtime-skill-sync/materialize.js +1 -1
- package/lib/skills/runtime-skill-sync/metadata.d.ts +7 -0
- package/lib/skills/runtime-skill-sync/metadata.js +1 -1
- package/lib/skills/runtime-skill-sync/paths.d.ts +11 -0
- package/lib/skills/runtime-skill-sync/paths.js +1 -1
- package/lib/skills/runtime-skill-sync/push.d.ts +33 -0
- package/lib/skills/runtime-skill-sync/push.js +1 -1
- package/lib/skills/runtime-skill-sync/scopes.d.ts +5 -0
- package/lib/skills/runtime-skill-sync/scopes.js +1 -1
- package/lib/skills/runtime-skill-sync/types.d.ts +105 -0
- package/lib/skills/runtime-skill-sync/zip-codec.d.ts +9 -0
- package/lib/skills/runtime-skill-sync/zip-codec.js +1 -1
- package/lib/skills/runtime-skill-sync/zip-package.d.ts +15 -0
- package/lib/skills/runtime-skill-sync/zip-package.js +1 -1
- package/lib/skills/runtime-skill-sync.d.ts +15 -0
- package/lib/skills/runtime-skill-sync.js +1 -1
- package/lib/utils/apply-jq-filter.d.ts +25 -0
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/logger.d.ts +73 -0
- package/lib/utils/logger.js +1 -1
- package/lib/utils/lossless-json.d.ts +21 -0
- package/lib/utils/lossless-json.js +1 -1
- package/lib/utils/params.d.ts +65 -0
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.d.ts +17 -0
- package/lib/utils/platform.js +1 -1
- package/lib/utils/update-notice.d.ts +10 -0
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.d.ts +18 -0
- package/lib/utils/version.js +1 -1
- package/lib/utils/write-cli-side-channel.d.ts +6 -0
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Configuration scope policy — determines where config writes go.
|
|
3
|
+
*
|
|
4
|
+
* Why a dedicated module: config writes can target either the global config
|
|
5
|
+
* (`~/.lovrabet.json`) or the project config (`.lovrabet.json`). The rules for
|
|
6
|
+
* choosing the correct scope are subtle:
|
|
7
|
+
* - `--global` → always global (explicit user intent)
|
|
8
|
+
* - `--project` → project if inside a project, else error
|
|
9
|
+
* - No flag → depends on the command's implicit policy
|
|
10
|
+
*
|
|
11
|
+
* Rather than duplicating these rules in `app use`, `config set`,
|
|
12
|
+
* etc., this module provides a single `resolveConfigScope()` function that
|
|
13
|
+
* encapsulates the logic. Commands call this function and get back the
|
|
14
|
+
* correct scope without knowing the details.
|
|
15
|
+
*
|
|
16
|
+
* Design decision: `ImplicitScopePolicy` has three variants to cover the main
|
|
17
|
+
* use cases:
|
|
18
|
+
* - `project-default`: most commands write to project (safer, repo-scoped)
|
|
19
|
+
* - `global-default`: commands that should write globally by default (e.g. `auth`)
|
|
20
|
+
* - `project-or-global-explicit`: project if in a project, else error (explicit --global required outside projects)
|
|
21
|
+
*
|
|
22
|
+
* Why `project-or-global-explicit` for commands that fundamentally require a project:
|
|
23
|
+
* commands like `config set` without `--global` should not silently write to `~/.lovrabet.json`
|
|
24
|
+
* when the user is outside a project directory. Requiring `--global` explicitly outside
|
|
25
|
+
* projects prevents accidental global config pollution.
|
|
26
|
+
*/
|
|
27
|
+
export { DEFAULT_APP_PROFILE_NAME, DEFAULT_CONFIG_VALUES, } from "../../constant/defaults.js";
|
|
28
|
+
export { RUNTIME_ENV_VALUES } from "../../constant/env.js";
|
|
29
|
+
export { OUTPUT_FORMAT_VALUES } from "../../constant/output.js";
|
|
30
|
+
export { buildAppProfileListFields, CONFIG_ENUM_VALUES, IMPORTABLE_RUNTIME_CONFIG_KEYS, TOP_LEVEL_CONFIG_KEYS, getConfigCommandKeyDescription, getConfigDefaultValue, getConfigEnumValues, getTopLevelConfigKeyList, getTopLevelConfigKeySummary, isLegacyCompatConfigKey, isTopLevelConfigKey, } from "../../config/schema.js";
|
|
31
|
+
/** Config write scope: either global or project. */
|
|
32
|
+
export type ConfigScope = "global" | "project";
|
|
33
|
+
/**
|
|
34
|
+
* Policy for determining the implicit scope when neither `--global` nor `--project` is passed.
|
|
35
|
+
*
|
|
36
|
+
* Why three policies: different commands have different safety profiles.
|
|
37
|
+
* `app use` writing to project by default is appropriate (project-scoped).
|
|
38
|
+
* `auth` writing globally by default is appropriate (system-wide credential).
|
|
39
|
+
* `config set` outside a project should error rather than silently writing globally.
|
|
40
|
+
*/
|
|
41
|
+
export type ImplicitScopePolicy =
|
|
42
|
+
/** Write to global config by default. */
|
|
43
|
+
"global-default"
|
|
44
|
+
/** Write to project config by default, fall back to global if not in a project. */
|
|
45
|
+
| "project-default"
|
|
46
|
+
/** Write to project config if inside a project; error if outside (require --global). */
|
|
47
|
+
| "project-or-global-explicit";
|
|
48
|
+
export interface ResolveScopeOptions {
|
|
49
|
+
explicitGlobal?: boolean;
|
|
50
|
+
explicitProject?: boolean;
|
|
51
|
+
policy: ImplicitScopePolicy;
|
|
52
|
+
inProject?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolves the effective config scope from flags and policy.
|
|
56
|
+
*
|
|
57
|
+
* Why `--global` and `--project` are mutually exclusive: allowing both would make
|
|
58
|
+
* the intent ambiguous. We explicitly check for this and throw a validation
|
|
59
|
+
* error rather than defining precedence.
|
|
60
|
+
*
|
|
61
|
+
* Why `options.inProject` is optional: callers may pass the pre-computed value
|
|
62
|
+
* to avoid calling `isInProject()` again (which involves a filesystem check).
|
|
63
|
+
*
|
|
64
|
+
* @throws CliError with code `"validation_error"` when both flags are set
|
|
65
|
+
* or when `--project` is used outside a project without `--global`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveConfigScope(options: ResolveScopeOptions): ConfigScope;
|
|
68
|
+
/** Converts a `ConfigScope` back to the equivalent `--global` flag value. */
|
|
69
|
+
export declare function toScopeFlags(scope: ConfigScope): {
|
|
70
|
+
global: boolean;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Formats a scope for human-readable output (e.g. in confirmation messages).
|
|
74
|
+
*
|
|
75
|
+
* Why `" (global)"` for global and empty string for project: this is used in
|
|
76
|
+
* console output to annotate the target scope. Showing "(project)" would be
|
|
77
|
+
* redundant (most operations are project-scoped). Showing "(global)" only
|
|
78
|
+
* when relevant draws attention to the less common case.
|
|
79
|
+
*/
|
|
80
|
+
export declare function formatScopeLabel(scope: ConfigScope): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x13547a,_0x483181){const _0x222f3b=a18_0xf44e,_0x46d3ac=_0x13547a();while(!![]){try{const _0x2d5018=parseInt(_0x222f3b(0x188))/0x1+parseInt(_0x222f3b(0x193))/0x2+-parseInt(_0x222f3b(0x191))/0x3*(parseInt(_0x222f3b(0x185))/0x4)+-parseInt(_0x222f3b(0x18a))/0x5*(-parseInt(_0x222f3b(0x18f))/0x6)+-parseInt(_0x222f3b(0x187))/0x7+-parseInt(_0x222f3b(0x195))/0x8+-parseInt(_0x222f3b(0x18c))/0x9*(-parseInt(_0x222f3b(0x181))/0xa);if(_0x2d5018===_0x483181)break;else _0x46d3ac['push'](_0x46d3ac['shift']());}catch(_0x47c213){_0x46d3ac['push'](_0x46d3ac['shift']());}}}(a18_0x5b08,0x63bf1));import{CLI_BIN_NAME}from'../../constant/cli.js';function a18_0xf44e(_0x2eec8d,_0x1cd1a4){_0x2eec8d=_0x2eec8d-0x181;const _0x5b08eb=a18_0x5b08();let _0xf44eeb=_0x5b08eb[_0x2eec8d];return _0xf44eeb;}import{PRODUCT_CONFIG}from'../../constant/product.js';export{DEFAULT_APP_PROFILE_NAME,DEFAULT_CONFIG_VALUES}from'../../constant/defaults.js';export{RUNTIME_ENV_VALUES}from'../../constant/env.js';export{OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{isInProject}from'../../context.js';import{CliErrors}from'../../errors.js';export{buildAppProfileListFields,CONFIG_ENUM_VALUES,IMPORTABLE_RUNTIME_CONFIG_KEYS,TOP_LEVEL_CONFIG_KEYS,getConfigCommandKeyDescription,getConfigDefaultValue,getConfigEnumValues,getTopLevelConfigKeyList,getTopLevelConfigKeySummary,isLegacyCompatConfigKey,isTopLevelConfigKey}from'../../config/schema.js';export function resolveConfigScope(_0x567dcd){const _0x5d3db3=a18_0xf44e,{explicitGlobal:explicitGlobal=![],explicitProject:explicitProject=![],policy:_0x2acd93}=_0x567dcd;if(explicitGlobal&&explicitProject)throw CliErrors['validation']('Flags\x20--global\x20and\x20--project\x20are\x20mutually\x20exclusive.',_0x5d3db3(0x18d));if(explicitGlobal)return _0x5d3db3(0x190);if(explicitProject)return _0x5d3db3(0x182);switch(_0x2acd93){case _0x5d3db3(0x189):return _0x5d3db3(0x190);case'project-default':return _0x567dcd[_0x5d3db3(0x18b)]??isInProject()?_0x5d3db3(0x182):_0x5d3db3(0x190);case'project-or-global-explicit':if(!(_0x567dcd[_0x5d3db3(0x18b)]??isInProject()))throw CliErrors[_0x5d3db3(0x184)]('Not\x20inside\x20a\x20project\x20(no\x20'+PRODUCT_CONFIG[_0x5d3db3(0x186)]+_0x5d3db3(0x183),'Add\x20--global\x20to\x20write\x20to\x20~/'+PRODUCT_CONFIG['newConfigFileName']+_0x5d3db3(0x18e)+CLI_BIN_NAME+_0x5d3db3(0x194));return'project';}}export function toScopeFlags(_0x487542){const _0x2d4089=a18_0xf44e;return{'global':_0x487542===_0x2d4089(0x190)};}function a18_0x5b08(){const _0x3e2a37=['project','\x20found).','validation','12HXUkSX','newConfigFileName','4096372cQlUVF','435024VUQBDU','global-default','625PIDHNH','inProject','288sTzPMc','Use\x20only\x20one\x20config\x20scope\x20flag.',',\x20or\x20run\x20`','5448pYQSpT','global','163341tkrPup','\x20(global)','356472AFQVRy','\x20init`\x20first.','3293680vFSrBk','263140SckMZc'];a18_0x5b08=function(){return _0x3e2a37;};return a18_0x5b08();}export function formatScopeLabel(_0xc3e861){const _0x268a32=a18_0xf44e;return _0xc3e861===_0x268a32(0x190)?_0x268a32(0x192):'';}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared constraint validators for command `validate()` hooks.
|
|
3
|
+
*
|
|
4
|
+
* Why a dedicated module: flag constraint logic (exactly-one, mutual exclusion, etc.)
|
|
5
|
+
* was previously duplicated in each command's `validate` function. This caused:
|
|
6
|
+
* - Inconsistent error messages across commands
|
|
7
|
+
* - Easy to forget a constraint and accept invalid flag combinations
|
|
8
|
+
* - Hard to test constraint logic in isolation
|
|
9
|
+
*
|
|
10
|
+
* Centralizing here means:
|
|
11
|
+
* - Constraint logic is defined once and tested once
|
|
12
|
+
* - Error messages are consistent across all commands
|
|
13
|
+
* - Adding a new constraint type only requires editing this file
|
|
14
|
+
*
|
|
15
|
+
* Why these four functions specifically: they cover the most common CLI flag
|
|
16
|
+
* validation patterns (inspired by CLI design literature and tools like
|
|
17
|
+
* `clap`/`click`/` argparse`):
|
|
18
|
+
* - `requireOneOf`: commands that need exactly one identifier (e.g. `--id` OR `--name`)
|
|
19
|
+
* - `requireAnyOf`: commands that need at least one selector
|
|
20
|
+
* - `mutuallyExclusive`: flags that cannot be used together (e.g. `--verbose` + `--quiet`)
|
|
21
|
+
* - `validatePattern`: flag values that must match a specific format
|
|
22
|
+
*/
|
|
23
|
+
import type { RuntimeContext } from "../../framework/types.js";
|
|
24
|
+
/**
|
|
25
|
+
* Validates that exactly one of the named flags is set.
|
|
26
|
+
*
|
|
27
|
+
* Use case: commands like `data getOne` that accept either `--id` OR `--name`
|
|
28
|
+
* but not both and not neither. The error message tells users exactly what
|
|
29
|
+
* went wrong and how to fix it.
|
|
30
|
+
*
|
|
31
|
+
* @throws CliError with code `"validation_error"` if zero or more than one flag is set.
|
|
32
|
+
*/
|
|
33
|
+
export declare function requireOneOf(ctx: RuntimeContext, names: string[], label: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Validates that at least one of the named flags is set.
|
|
36
|
+
*
|
|
37
|
+
* Use case: commands like `data batchCreate` where the user must provide
|
|
38
|
+
* some identification method (id, name, or filter), even if only one is allowed.
|
|
39
|
+
*
|
|
40
|
+
* @throws CliError with code `"validation_error"` if no flags are set.
|
|
41
|
+
*/
|
|
42
|
+
export declare function requireAnyOf(ctx: RuntimeContext, names: string[], label: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Validates that at most one of the named flags is set (mutual exclusion).
|
|
45
|
+
*
|
|
46
|
+
* Use case: `--verbose` and `--quiet` should not be used together — they are
|
|
47
|
+
* both output modes and combining them is ambiguous. This constraint prevents
|
|
48
|
+
* the ambiguity rather than defining precedence rules.
|
|
49
|
+
*
|
|
50
|
+
* @throws CliError with code `"validation_error"` if more than one flag is set.
|
|
51
|
+
*/
|
|
52
|
+
export declare function mutuallyExclusive(ctx: RuntimeContext, names: string[], label: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Validates that a flag's value matches a regex pattern.
|
|
55
|
+
*
|
|
56
|
+
* Use case: validating that a `--code` flag matches the expected format
|
|
57
|
+
* before making an API call that would return an opaque "not found" error.
|
|
58
|
+
* Throwing a validation error gives immediate, actionable feedback.
|
|
59
|
+
*
|
|
60
|
+
* @param ctx - Runtime context containing the flag value.
|
|
61
|
+
* @param name - Flag name to validate.
|
|
62
|
+
* @param regex - Pattern the value must match.
|
|
63
|
+
* @param desc - Human-readable description of the expected format (shown in error).
|
|
64
|
+
*
|
|
65
|
+
* @throws CliError with code `"validation_error"` if the value doesn't match.
|
|
66
|
+
*/
|
|
67
|
+
export declare function validatePattern(ctx: RuntimeContext, name: string, regex: RegExp, desc: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x11a862,_0x46aabe){const _0x13055d=a19_0x51c0,_0x4d669b=_0x11a862();while(!![]){try{const _0xbc71dc=-parseInt(_0x13055d(0xc2))/0x1*(parseInt(_0x13055d(0xac))/0x2)+parseInt(_0x13055d(0xc6))/0x3*(parseInt(_0x13055d(0xbc))/0x4)+-parseInt(_0x13055d(0xb6))/0x5*(parseInt(_0x13055d(0xbf))/0x6)+parseInt(_0x13055d(0xbe))/0x7*(parseInt(_0x13055d(0xb5))/0x8)+-parseInt(_0x13055d(0xb9))/0x9*(-parseInt(_0x13055d(0xb2))/0xa)+parseInt(_0x13055d(0xc1))/0xb*(parseInt(_0x13055d(0xb0))/0xc)+-parseInt(_0x13055d(0xc5))/0xd;if(_0xbc71dc===_0x46aabe)break;else _0x4d669b['push'](_0x4d669b['shift']());}catch(_0x26ac65){_0x4d669b['push'](_0x4d669b['shift']());}}}(a19_0x4189,0x8ede8));function a19_0x4189(){const _0x457507=['95670Eicyrj','At\x20least\x20one\x20of\x20','759hTBTgp','32843rJkjKw','Flags\x20','Remove\x20all\x20but\x20one.','17103190eWtFcY','219BuPhuE','Provide\x20one\x20of:\x20','map','validation','2dUlyKd','\x20are\x20mutually\x20exclusive\x20for\x20`','Only\x20one\x20of\x20','Invalid\x20--','80892DMGXaC','filter','3597010JinWqb','\x20is\x20required\x20for\x20`',':\x20expected\x20','9192zixPeW','40VHdACK',',\x20got\x20\x22','length','9GfcanK','Use\x20only\x20one\x20of:\x20','Exactly\x20one\x20of\x20','62648jUoUNu','str','567ZMjFQn'];a19_0x4189=function(){return _0x457507;};return a19_0x4189();}import{CliErrors}from'../../errors.js';function isSet(_0x495798,_0x602b9f){const _0x511772=_0x495798['flag'](_0x602b9f);return _0x511772!==undefined&&_0x511772!==''&&_0x511772!==![]&&_0x511772!==0x0;}function fmtNames(_0x1f7102){const _0x5c0e4c=a19_0x51c0;return _0x1f7102[_0x5c0e4c(0xc8)](_0x1c63a2=>'--'+_0x1c63a2)['join'](',\x20');}export function requireOneOf(_0x40a8b7,_0x742482,_0x1dc4f9){const _0x2005e5=a19_0x51c0,_0x44eb3e=_0x742482[_0x2005e5(0xb1)](_0x21fca7=>isSet(_0x40a8b7,_0x21fca7));if(_0x44eb3e[_0x2005e5(0xb8)]!==0x1)throw CliErrors['validation'](_0x44eb3e[_0x2005e5(0xb8)]===0x0?_0x2005e5(0xbb)+fmtNames(_0x742482)+'\x20is\x20required\x20for\x20`'+_0x1dc4f9+'`.':_0x2005e5(0xae)+fmtNames(_0x742482)+'\x20is\x20allowed,\x20found:\x20'+fmtNames(_0x44eb3e)+'.',_0x44eb3e[_0x2005e5(0xb8)]===0x0?_0x2005e5(0xc7)+fmtNames(_0x742482):_0x2005e5(0xc4));}export function requireAnyOf(_0x375973,_0x2edeb5,_0x135bd8){const _0x441ec9=a19_0x51c0;if(!_0x2edeb5['some'](_0x4756d0=>isSet(_0x375973,_0x4756d0)))throw CliErrors[_0x441ec9(0xc9)](_0x441ec9(0xc0)+fmtNames(_0x2edeb5)+_0x441ec9(0xb3)+_0x135bd8+'`.',_0x441ec9(0xc7)+fmtNames(_0x2edeb5));}function a19_0x51c0(_0x3b3dca,_0x5beaf4){_0x3b3dca=_0x3b3dca-0xac;const _0x418982=a19_0x4189();let _0x51c06a=_0x418982[_0x3b3dca];return _0x51c06a;}export function mutuallyExclusive(_0x5d86c5,_0x2a92dd,_0x6d642e){const _0x5c80f8=a19_0x51c0,_0x46cec6=_0x2a92dd[_0x5c80f8(0xb1)](_0x5739c8=>isSet(_0x5d86c5,_0x5739c8));if(_0x46cec6['length']>0x1)throw CliErrors['validation'](_0x5c80f8(0xc3)+fmtNames(_0x46cec6)+_0x5c80f8(0xad)+_0x6d642e+'`.',_0x5c80f8(0xba)+fmtNames(_0x2a92dd));}export function validatePattern(_0x4f5c50,_0x492730,_0x54f7ed,_0xdd08ee){const _0x1aae2f=a19_0x51c0,_0x5e2587=_0x4f5c50[_0x1aae2f(0xbd)](_0x492730);if(_0x5e2587&&!_0x54f7ed['test'](_0x5e2587))throw CliErrors[_0x1aae2f(0xc9)](_0x1aae2f(0xaf)+_0x492730+_0x1aae2f(0xb4)+_0xdd08ee+_0x1aae2f(0xb7)+_0x5e2587+'\x22.');}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared command flag definitions used across multiple services.
|
|
3
|
+
*
|
|
4
|
+
* Why a centralized module: pattern validation (e.g. 32-char hex for dataset codes)
|
|
5
|
+
* is error-prone to implement repeatedly. Centralizing these definitions means:
|
|
6
|
+
* - Pattern and description are defined once and reused everywhere
|
|
7
|
+
* - Commands that reference `CODE_FLAG` automatically get the correct regex
|
|
8
|
+
* - Changes to the pattern (e.g. changing from 32 to 36 chars) propagate everywhere
|
|
9
|
+
*
|
|
10
|
+
* Design decision: these are the shared flags only. Command-specific flags
|
|
11
|
+
* (e.g. `--env` for `config set`, `--file` for `app import`) are defined
|
|
12
|
+
* in their respective command modules to keep the shared module stable.
|
|
13
|
+
*/
|
|
14
|
+
import type { FlagDef } from "../../framework/types.js";
|
|
15
|
+
/**
|
|
16
|
+
* Dataset `--code` flag: accepts only a 32-character lowercase hex string (UUID format).
|
|
17
|
+
*
|
|
18
|
+
* Why this specific pattern: Lovrabet dataset codes are generated as SHA-256 hashes
|
|
19
|
+
* of internal identifiers, producing exactly 64 hex characters. For user brevity,
|
|
20
|
+
* the API surface uses only the first 32 characters (matching the prefix convention
|
|
21
|
+
* used in Lovrabet Studio). Enforcing the pattern at the CLI layer gives immediate
|
|
22
|
+
* feedback rather than an opaque API error for mistyped codes.
|
|
23
|
+
*/
|
|
24
|
+
export declare const CODE_FLAG: FlagDef;
|
|
25
|
+
/**
|
|
26
|
+
* SQL/BFF `--sqlcode` flag: accepts the `xxxxxxxx-xxxxxxxx` format used by Lovrabet APIs.
|
|
27
|
+
*
|
|
28
|
+
* Why the hyphen separator: the `xxxxxxxx-xxxxxxxx` format (8-8, hex) matches the
|
|
29
|
+
* standard GUID/UUID representation already used in Lovrabet Studio and the API docs.
|
|
30
|
+
* Requiring the hyphen in the CLI forces users to copy the code exactly as shown
|
|
31
|
+
* in the UI, reducing "wrong format" errors.
|
|
32
|
+
*/
|
|
33
|
+
export declare const SQLCODE_FLAG: FlagDef;
|
|
34
|
+
/** `--verbose`: when set, commands return the full raw API response instead of a summary. */
|
|
35
|
+
export declare const VERBOSE_FLAG: FlagDef;
|
|
36
|
+
/** `--params`: JSON string passed as the request body to execute commands. */
|
|
37
|
+
export declare const PARAMS_FLAG: FlagDef;
|
|
38
|
+
/** `--name`: resource name for lookup (used by `data getOne` and similar commands). */
|
|
39
|
+
export declare const NAME_FLAG: FlagDef;
|
|
40
|
+
/** `--id`: numeric resource ID (used by `data getOne`, `data delete`, etc.). */
|
|
41
|
+
export declare const ID_FLAG: FlagDef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a20_0x328f27=a20_0x49e6;(function(_0x5a2179,_0x5aedbd){const _0x247ef0=a20_0x49e6,_0x51248d=_0x5a2179();while(!![]){try{const _0xa05ac6=parseInt(_0x247ef0(0x167))/0x1*(parseInt(_0x247ef0(0x166))/0x2)+-parseInt(_0x247ef0(0x16c))/0x3*(parseInt(_0x247ef0(0x171))/0x4)+-parseInt(_0x247ef0(0x176))/0x5+-parseInt(_0x247ef0(0x17c))/0x6+parseInt(_0x247ef0(0x174))/0x7+-parseInt(_0x247ef0(0x16d))/0x8*(parseInt(_0x247ef0(0x17b))/0x9)+parseInt(_0x247ef0(0x16a))/0xa*(parseInt(_0x247ef0(0x17d))/0xb);if(_0xa05ac6===_0x5aedbd)break;else _0x51248d['push'](_0x51248d['shift']());}catch(_0x1b43ac){_0x51248d['push'](_0x51248d['shift']());}}}(a20_0x244b,0x5bb31));export const CODE_FLAG={'name':a20_0x328f27(0x16e),'type':a20_0x328f27(0x17a),'required':!![],'description':'Dataset\x20code\x20(32-char\x20hex\x20UUID)','pattern':{'regex':/^[a-f0-9]{32}$/i,'description':a20_0x328f27(0x170)}};export const SQLCODE_FLAG={'name':a20_0x328f27(0x173),'type':a20_0x328f27(0x17a),'required':!![],'description':a20_0x328f27(0x165),'pattern':{'regex':/^[a-f0-9]{8}-[a-f0-9]{8}$/i,'description':'SQL\x20code\x20in\x20format\x20xxxxxxxx-xxxxxxxx\x20(e.g.\x202305f915-dd48cd4c)'}};export const VERBOSE_FLAG={'name':a20_0x328f27(0x169),'type':a20_0x328f27(0x179),'description':a20_0x328f27(0x172)};export const PARAMS_FLAG={'name':a20_0x328f27(0x168),'type':a20_0x328f27(0x17a),'description':a20_0x328f27(0x16f)};function a20_0x49e6(_0x375959,_0x48e7d2){_0x375959=_0x375959-0x165;const _0x244b59=a20_0x244b();let _0x49e67f=_0x244b59[_0x375959];return _0x49e67f;}export const NAME_FLAG={'name':a20_0x328f27(0x175),'type':'string','description':a20_0x328f27(0x177)};export const ID_FLAG={'name':'id','type':a20_0x328f27(0x16b),'required':!![],'description':a20_0x328f27(0x178)};function a20_0x244b(){const _0xc7ddd3=['string','5779701hhRZmM','2169102KJuSvM','17127385tbfiUs','SQL\x20code\x20identifier\x20(format:\x20xxxxxxxx-xxxxxxxx,\x20e.g.\x202305f915-dd48cd4c)','273820NkEmRQ','5ZbCCIU','params','verbose','10AjdrMy','number','179637VDIswy','8lusdbk','code','Parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','a\x2032-character\x20lowercase\x20hex\x20string\x20(e.g.\x2099a909313f1fa7153186431e1c551588a3a79d4a3540bbb2def2ad0a228a9acd)','36COLunj','Return\x20full\x20raw\x20response\x20object','sqlcode','1612030zatIeK','name','2768285gWNOYs','Resource\x20name\x20for\x20lookup','Resource\x20ID','boolean'];a20_0x244b=function(){return _0xc7ddd3;};return a20_0x244b();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a21_0x32c7(_0x203578,_0x91cc15){_0x203578=_0x203578-0xbe;const _0x9e9747=a21_0x9e97();let _0x32c7f1=_0x9e9747[_0x203578];return _0x32c7f1;}(function(_0x5987d5,_0x7b1f60){const _0xc1f541=a21_0x32c7,_0x5372f1=_0x5987d5();while(!![]){try{const _0x25c33b=parseInt(_0xc1f541(0xcd))/0x1*(parseInt(_0xc1f541(0xc7))/0x2)+parseInt(_0xc1f541(0xcc))/0x3+-parseInt(_0xc1f541(0xc1))/0x4*(-parseInt(_0xc1f541(0xcf))/0x5)+-parseInt(_0xc1f541(0xc0))/0x6+parseInt(_0xc1f541(0xc4))/0x7*(-parseInt(_0xc1f541(0xd0))/0x8)+-parseInt(_0xc1f541(0xc8))/0x9+-parseInt(_0xc1f541(0xc2))/0xa*(-parseInt(_0xc1f541(0xc6))/0xb);if(_0x25c33b===_0x7b1f60)break;else _0x5372f1['push'](_0x5372f1['shift']());}catch(_0x2a8f5e){_0x5372f1['push'](_0x5372f1['shift']());}}}(a21_0x9e97,0x9b6b2));function a21_0x9e97(){const _0x4b7701=['toFixed','11UDCcJA','1182WKBrWh','10302750BwCndG','\x20MB','\x20path\x20is\x20required.','File\x20exceeds\x20the\x20runtime\x20upload\x20limit\x20of\x2050\x20MB:\x20','274035LmWqRR','1337ljOsyq','validation','5JaRBjx','984sYegCy','File\x20is\x20not\x20a\x20regular\x20file:\x20','ceil','1778850oNBSWb','4448012siZJfg','5825770BHPics','size','28357raOcrQ'];a21_0x9e97=function(){return _0x4b7701;};return a21_0x9e97();}import{existsSync,statSync}from'node:fs';import{CliErrors}from'../../errors.js';const BYTES_PER_MB=0x400*0x400;export const RUNTIME_UPLOAD_MAX_BYTES=0x32*BYTES_PER_MB;function formatBytes(_0x18eadc){const _0x28251a=a21_0x32c7;if(_0x18eadc>=BYTES_PER_MB){const _0x1c8638=Math[_0x28251a(0xbf)](_0x18eadc/BYTES_PER_MB*0x64)/0x64;return _0x1c8638[_0x28251a(0xc5)](0x2)+_0x28251a(0xc9);}return _0x18eadc+'\x20B';}export function requireRuntimeUploadFile(_0xd482fb,_0xb1e6e2){const _0x3e610b=a21_0x32c7,_0x5bfc03=_0xd482fb['trim']();if(!_0x5bfc03)throw CliErrors['validation'](_0xb1e6e2+_0x3e610b(0xca));if(!existsSync(_0x5bfc03))throw CliErrors[_0x3e610b(0xce)]('File\x20not\x20found:\x20'+_0x5bfc03);const _0x565c47=statSync(_0x5bfc03);if(!_0x565c47['isFile']())throw CliErrors[_0x3e610b(0xce)](_0x3e610b(0xbe)+_0x5bfc03);if(_0x565c47[_0x3e610b(0xc3)]>RUNTIME_UPLOAD_MAX_BYTES)throw CliErrors[_0x3e610b(0xce)](_0x3e610b(0xcb)+_0x5bfc03+'\x20('+formatBytes(_0x565c47[_0x3e610b(0xc3)])+')');return{'path':_0x5bfc03,'size':_0x565c47[_0x3e610b(0xc3)]};}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `config` subcommand definitions — list, get, set, delete.
|
|
3
|
+
*
|
|
4
|
+
* Why `hasFormat: false` for most commands: `config get` and `config set`
|
|
5
|
+
* output directly via `console.log` (for script-friendly single-value output),
|
|
6
|
+
* while `config list` with `--format pretty` returns a markdown message.
|
|
7
|
+
* Only `config list --format json` uses the structured `data` path.
|
|
8
|
+
* Keeping this split avoids double-output in scripts.
|
|
9
|
+
*
|
|
10
|
+
* Why `riskLevel` is not settable via `config set`: setting `riskLevel`
|
|
11
|
+
* would allow automated privilege escalation (scripts could raise their own
|
|
12
|
+
* risk level without user consent). Users who need to change it must edit
|
|
13
|
+
* the config file directly.
|
|
14
|
+
*
|
|
15
|
+
* Scope policy: all writes use `policy: "project-or-global-explicit"`.
|
|
16
|
+
* Without `--global`, writing goes to the project if inside a project,
|
|
17
|
+
* otherwise refuses with a helpful error. This prevents accidental global
|
|
18
|
+
* writes from inside a project directory.
|
|
19
|
+
*/
|
|
20
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
21
|
+
export declare const configDefinitions: CommandDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a22_0x52b2(){const _0x4f2d60=['List\x20current\x20config','#\x20Effective\x20config\x20(merged\x20global\x20+\x20project)\x0a\x0a','log','config','get','Deleted\x20`','\x20\x20global:\x20\x20','6749085NkpeLM','\x22.\x20Allowed:\x20','read','3203548HQCLTN','Config\x20files:\x0a','Get\x20a\x20config\x20value','validation','value','Config\x20key\x20(supports\x20dot\x20notation\x20for\x20reads\x20only)','delete','Missing\x20key\x20argument.','Set\x20a\x20config\x20value','key','\x20config\x20get\x20<key>','`\x20=\x20\x22','appcode','\x22riskLevel\x22\x20cannot\x20be\x20changed\x20via\x20the\x20CLI.','4512783ahIDtp','pretty','field','Usage:\x20','join','\x20\x20project:\x20','18OGfuKX','isArray','4573670TqwrCS','object','length','Top-level\x20key\x20\x22','Value\x20to\x20assign','raw','args','boolean','Key\x20\x22','alias','16zUqlxu','global','2867280Eoiyzn','../../context.js','955633BRdLBI','project-or-global-explicit','10pSYnDW',';\x20apps.<alias>.appcode','bool','format','Missing\x20key\x20or\x20value.','list','pageSize','stringify','Delete\x20a\x20config\x20value','\x20config\x20delete\x20<key>\x20[--global]','(none)','apps','\x22\x20is\x20not\x20settable.','riskLevel','Key\x20not\x20found:\x20','trim','\x20config\x20set\x20<key>\x20<value>\x20[--global]','write','split','includes','52378lomYnd','Settable\x20keys:\x20','set','\x20(global)'];a22_0x52b2=function(){return _0x4f2d60;};return a22_0x52b2();}const a22_0x7950ce=a22_0x3e54;(function(_0x5d051c,_0x538d96){const _0x43f9ab=a22_0x3e54,_0x59c0b1=_0x5d051c();while(!![]){try{const _0x55dfb1=-parseInt(_0x43f9ab(0x109))/0x1*(parseInt(_0x43f9ab(0x13d))/0x2)+parseInt(_0x43f9ab(0x125))/0x3+parseInt(_0x43f9ab(0x117))/0x4+-parseInt(_0x43f9ab(0x114))/0x5+-parseInt(_0x43f9ab(0x139))/0x6+parseInt(_0x43f9ab(0x13b))/0x7*(-parseInt(_0x43f9ab(0x137))/0x8)+parseInt(_0x43f9ab(0x12b))/0x9*(parseInt(_0x43f9ab(0x12d))/0xa);if(_0x55dfb1===_0x538d96)break;else _0x59c0b1['push'](_0x59c0b1['shift']());}catch(_0x44983d){_0x59c0b1['push'](_0x59c0b1['shift']());}}}(a22_0x52b2,0xd14a9));function a22_0x3e54(_0x5662a9,_0x519c6a){_0x5662a9=_0x5662a9-0xf6;const _0x52b275=a22_0x52b2();let _0x3e547a=_0x52b275[_0x5662a9];return _0x3e547a;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME,ENUM_KEYS,getConfigCommandKeyDescription,getTopLevelConfigKeySummary,isTopLevelConfigKey,readScopedConfig,writeScopedConfig,resolveWriteScope,toScopeFlags}from'../../commands/config/shared.js';import{resolveWriteConfigPath,getProjectConfigPath}from'../../context.js';const GLOBAL_FLAG={'name':a22_0x7950ce(0x138),'type':a22_0x7950ce(0x134),'description':'Write\x20to\x20global\x20config','default':![]};function parseAliasAppcodeSetKey(_0x121187){const _0x4c8954=a22_0x7950ce,_0xad1884=_0x121187[_0x4c8954(0x107)]('.');if(_0xad1884['length']!==0x3||_0xad1884[0x0]!==_0x4c8954(0x100)||_0xad1884[0x2]!==_0x4c8954(0x123))return undefined;const _0x32d6f5=_0xad1884[0x1]?.[_0x4c8954(0x104)]();return _0x32d6f5?_0x32d6f5:undefined;}function parseAliasDeleteKey(_0x5a2b1d){const _0x418fe5=a22_0x7950ce,_0x450e7e=_0x5a2b1d[_0x418fe5(0x107)]('.');if(_0x450e7e['length']===0x2&&_0x450e7e[0x0]===_0x418fe5(0x100)){const _0x503a37=_0x450e7e[0x1]?.['trim']();return _0x503a37?{'alias':_0x503a37}:undefined;}if(_0x450e7e[_0x418fe5(0x12f)]===0x3&&_0x450e7e[0x0]===_0x418fe5(0x100)&&_0x450e7e[0x2]===_0x418fe5(0x123)){const _0x46b07e=_0x450e7e[0x1]?.[_0x418fe5(0x104)]();return _0x46b07e?{'alias':_0x46b07e,'field':_0x418fe5(0x123)}:undefined;}return undefined;}function setLocalAppAlias(_0x494f87,_0x53dcee,_0x42cc9b){const _0x2862a8=a22_0x7950ce,_0x2bee6b=_0x494f87[_0x2862a8(0x100)]&&typeof _0x494f87[_0x2862a8(0x100)]===_0x2862a8(0x12e)&&!Array['isArray'](_0x494f87[_0x2862a8(0x100)])?_0x494f87[_0x2862a8(0x100)]:{},_0x2ea82e=_0x2bee6b[_0x53dcee]&&typeof _0x2bee6b[_0x53dcee]===_0x2862a8(0x12e)&&!Array['isArray'](_0x2bee6b[_0x53dcee])?_0x2bee6b[_0x53dcee]:{};_0x2ea82e[_0x2862a8(0x123)]=_0x42cc9b,_0x2bee6b[_0x53dcee]=_0x2ea82e,_0x494f87['apps']=_0x2bee6b;}function deleteLocalAppAlias(_0x47bdb2,_0x56f11f){const _0x5a44dc=a22_0x7950ce;if(!_0x47bdb2[_0x5a44dc(0x100)]||typeof _0x47bdb2[_0x5a44dc(0x100)]!==_0x5a44dc(0x12e)||Array['isArray'](_0x47bdb2[_0x5a44dc(0x100)]))return![];const _0x29fa09=_0x47bdb2['apps'],_0x21a48a=_0x29fa09[_0x56f11f[_0x5a44dc(0x136)]];if(!_0x21a48a||typeof _0x21a48a!==_0x5a44dc(0x12e)||Array[_0x5a44dc(0x12c)](_0x21a48a))return![];if(!_0x56f11f[_0x5a44dc(0x127)])return delete _0x29fa09[_0x56f11f[_0x5a44dc(0x136)]],!![];if(!(_0x56f11f[_0x5a44dc(0x127)]in _0x21a48a))return![];return delete _0x21a48a[_0x56f11f['field']],Object['keys'](_0x21a48a)[_0x5a44dc(0x12f)]===0x0&&delete _0x29fa09[_0x56f11f[_0x5a44dc(0x136)]],!![];}const listDef={'service':a22_0x7950ce(0x110),'command':a22_0x7950ce(0xfa),'description':a22_0x7950ce(0x10d),'risk':a22_0x7950ce(0x116),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'flags':[],async 'execute'(_0x292193){const _0x16782e=a22_0x7950ce,{buildConfigFromFlags:_0x212358}=await import(_0x16782e(0x13a)),_0x488b20=_0x212358({}),_0x445a0e=getProjectConfigPath(),_0x506afa=resolveWriteConfigPath(_0x16782e(0x138));if(_0x292193[_0x16782e(0xf8)]===_0x16782e(0x126))return{'ok':!![],'message':_0x16782e(0x10e)+(JSON[_0x16782e(0xfc)](_0x488b20[_0x16782e(0x132)],null,0x2)+'\x0a\x0a')+_0x16782e(0x118)+(_0x16782e(0x12a)+(_0x445a0e??_0x16782e(0xff))+'\x0a')+(_0x16782e(0x113)+_0x506afa)};return{'ok':!![],'data':{'effective':_0x488b20[_0x16782e(0x132)],'configFiles':{'project':_0x445a0e??null,'global':_0x506afa}}};}},getDef={'service':a22_0x7950ce(0x110),'command':a22_0x7950ce(0x111),'description':a22_0x7950ce(0x119),'risk':a22_0x7950ce(0x116),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a22_0x7950ce(0x120),'description':a22_0x7950ce(0x11c),'required':!![]}],'flags':[],async 'execute'(_0x32fc67){const _0xa095bc=a22_0x7950ce,_0x1410fe=_0x32fc67['args'][0x0];if(!_0x1410fe)throw CliErrors[_0xa095bc(0x11a)](_0xa095bc(0x11e),_0xa095bc(0x128)+CLI_BIN_NAME+_0xa095bc(0x121));const {buildConfigFromFlags:_0x49ce69}=await import(_0xa095bc(0x13a)),{raw:_0x4da142}=_0x49ce69({});if(_0x1410fe['includes']('.')){const _0x350d4b=_0x1410fe[_0xa095bc(0x107)]('.');let _0x13f7b9=_0x4da142;for(const _0x1084a6 of _0x350d4b){if(_0x13f7b9==null||typeof _0x13f7b9!==_0xa095bc(0x12e))throw CliErrors['validation'](_0xa095bc(0x103)+_0x1410fe);_0x13f7b9=_0x13f7b9[_0x1084a6];}if(_0x13f7b9===undefined)throw CliErrors[_0xa095bc(0x11a)](_0xa095bc(0x103)+_0x1410fe);return console[_0xa095bc(0x10f)](typeof _0x13f7b9===_0xa095bc(0x12e)?JSON[_0xa095bc(0xfc)](_0x13f7b9,null,0x2):String(_0x13f7b9)),{'ok':!![]};}const _0x2395c2=_0x4da142[_0x1410fe];if(_0x2395c2===undefined)throw CliErrors[_0xa095bc(0x11a)]('Key\x20not\x20found:\x20'+_0x1410fe);return console[_0xa095bc(0x10f)](typeof _0x2395c2===_0xa095bc(0x12e)?JSON['stringify'](_0x2395c2,null,0x2):String(_0x2395c2)),{'ok':!![]};}},setDef={'service':a22_0x7950ce(0x110),'command':a22_0x7950ce(0x10b),'description':a22_0x7950ce(0x11f),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a22_0x7950ce(0x120),'description':getConfigCommandKeyDescription(),'required':!![]},{'name':a22_0x7950ce(0x11b),'description':a22_0x7950ce(0x131),'required':!![]}],'flags':[GLOBAL_FLAG],async 'execute'(_0xf5366a){const _0x4ae5df=a22_0x7950ce,_0xd6801=_0xf5366a[_0x4ae5df(0x133)][0x0],_0x3a8492=_0xf5366a[_0x4ae5df(0x133)][0x1];if(!_0xd6801||_0x3a8492===undefined)throw CliErrors[_0x4ae5df(0x11a)](_0x4ae5df(0xf9),_0x4ae5df(0x128)+CLI_BIN_NAME+_0x4ae5df(0x105));if(ENUM_KEYS[_0xd6801]&&!ENUM_KEYS[_0xd6801][_0x4ae5df(0x108)](_0x3a8492))throw CliErrors['validation']('Invalid\x20value\x20for\x20\x22'+_0xd6801+_0x4ae5df(0x115)+ENUM_KEYS[_0xd6801][_0x4ae5df(0x129)](',\x20'));if(_0xd6801===_0x4ae5df(0x102))throw CliErrors[_0x4ae5df(0x11a)](_0x4ae5df(0x124));if(_0xd6801===_0x4ae5df(0xfb)){const _0x318c4c=Number(_0x3a8492);if(isNaN(_0x318c4c)||_0x318c4c<=0x0)throw CliErrors[_0x4ae5df(0x11a)]('pageSize\x20must\x20be\x20a\x20positive\x20number');}const _0x132380=resolveWriteScope({'explicitGlobal':_0xf5366a[_0x4ae5df(0xf7)]('global'),'policy':_0x4ae5df(0x13c)}),_0x3b0aba=toScopeFlags(_0x132380),_0x59c544=readScopedConfig(_0x3b0aba),_0x316684=parseAliasAppcodeSetKey(_0xd6801);if(!_0x316684&&!isTopLevelConfigKey(_0xd6801))throw CliErrors['validation'](_0x4ae5df(0x130)+_0xd6801+_0x4ae5df(0x101),_0x4ae5df(0x10a)+getTopLevelConfigKeySummary()+_0x4ae5df(0xf6));return _0x316684?setLocalAppAlias(_0x59c544,_0x316684,_0x3a8492):_0x59c544[_0xd6801]=_0xd6801===_0x4ae5df(0xfb)?Number(_0x3a8492):_0x3a8492,console[_0x4ae5df(0x10f)]('Set\x20`'+_0xd6801+_0x4ae5df(0x122)+_0x3a8492+'\x22'+(_0x132380==='global'?_0x4ae5df(0x10c):'')),writeScopedConfig(_0x59c544,_0x3b0aba),{'ok':!![]};}},deleteDef={'service':a22_0x7950ce(0x110),'command':a22_0x7950ce(0x11d),'description':a22_0x7950ce(0xfd),'risk':a22_0x7950ce(0x106),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'key','description':getConfigCommandKeyDescription(),'required':!![]}],'flags':[GLOBAL_FLAG],async 'execute'(_0x526576){const _0x4aeaee=a22_0x7950ce,_0x2008ab=_0x526576['args'][0x0];if(!_0x2008ab)throw CliErrors[_0x4aeaee(0x11a)](_0x4aeaee(0x11e),_0x4aeaee(0x128)+CLI_BIN_NAME+_0x4aeaee(0xfe));const _0x4c5fdc=resolveWriteScope({'explicitGlobal':_0x526576[_0x4aeaee(0xf7)](_0x4aeaee(0x138)),'policy':_0x4aeaee(0x13c)}),_0x136c8c=toScopeFlags(_0x4c5fdc),_0x583d21=readScopedConfig(_0x136c8c),_0x3d2d65=parseAliasDeleteKey(_0x2008ab);if(_0x3d2d65){if(!deleteLocalAppAlias(_0x583d21,_0x3d2d65))throw CliErrors[_0x4aeaee(0x11a)](_0x4aeaee(0x103)+_0x2008ab);return console['log'](_0x4aeaee(0x112)+_0x2008ab+'`'+(_0x4c5fdc===_0x4aeaee(0x138)?_0x4aeaee(0x10c):'')),writeScopedConfig(_0x583d21,_0x136c8c),{'ok':!![]};}if(_0x583d21[_0x2008ab]===undefined)throw CliErrors[_0x4aeaee(0x11a)](_0x4aeaee(0x135)+_0x2008ab+'\x22\x20not\x20found\x20at\x20top\x20level.');return delete _0x583d21[_0x2008ab],console[_0x4aeaee(0x10f)](_0x4aeaee(0x112)+_0x2008ab+'`'+(_0x4c5fdc===_0x4aeaee(0x138)?'\x20(global)':'')),writeScopedConfig(_0x583d21,_0x136c8c),{'ok':!![]};}};export const configDefinitions=[listDef,getDef,setDef,deleteDef];
|
|
1
|
+
const a22_0x1d4a2e=a22_0xa416;function a22_0x3c22(){const _0x426f91=['Config\x20key\x20(supports\x20dot\x20notation\x20for\x20reads\x20only)','\x22.\x20Allowed:\x20','10582317ZPJldQ','Top-level\x20key\x20\x22','bool','read','\x22\x20is\x20not\x20settable.','10GalayY','656571aGkcfS','length','global','Set\x20a\x20config\x20value','Usage:\x20','pretty','\x22riskLevel\x22\x20cannot\x20be\x20changed\x20via\x20the\x20CLI.','\x20config\x20set\x20<key>\x20<value>\x20[--global]','Invalid\x20value\x20for\x20\x22','Key\x20not\x20found:\x20','Settable\x20keys:\x20','field','Missing\x20key\x20argument.','pageSize\x20must\x20be\x20a\x20positive\x20number','log','1073534ybUyFZ','stringify','key','66XXpZmI','Write\x20to\x20global\x20config','Deleted\x20`','apps','\x20(global)','pageSize','project-or-global-explicit','\x20config\x20delete\x20<key>\x20[--global]','split','20hnIjgT','validation','441560zBPCqe','`\x20=\x20\x22','Set\x20`','alias','Missing\x20key\x20or\x20value.','isArray','config','trim','8752392FWMGRM','object','keys','args','\x20\x20project:\x20','741005vFfwUR','list','../../context.js','Value\x20to\x20assign','appcode','riskLevel','605705fCPsib','raw','#\x20Effective\x20config\x20(merged\x20global\x20+\x20project)\x0a\x0a','includes'];a22_0x3c22=function(){return _0x426f91;};return a22_0x3c22();}(function(_0x36cd74,_0x2556e9){const _0x1ff781=a22_0xa416,_0x5c5c3a=_0x36cd74();while(!![]){try{const _0x3adddc=parseInt(_0x1ff781(0x19a))/0x1+parseInt(_0x1ff781(0x1c3))/0x2+parseInt(_0x1ff781(0x1a6))/0x3+parseInt(_0x1ff781(0x1c1))/0x4*(-parseInt(_0x1ff781(0x1d0))/0x5)+-parseInt(_0x1ff781(0x1b8))/0x6*(parseInt(_0x1ff781(0x1b5))/0x7)+parseInt(_0x1ff781(0x1cb))/0x8+parseInt(_0x1ff781(0x1a0))/0x9*(parseInt(_0x1ff781(0x1a5))/0xa);if(_0x3adddc===_0x2556e9)break;else _0x5c5c3a['push'](_0x5c5c3a['shift']());}catch(_0x340763){_0x5c5c3a['push'](_0x5c5c3a['shift']());}}}(a22_0x3c22,0xd89b1));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME,ENUM_KEYS,getConfigCommandKeyDescription,getTopLevelConfigKeySummary,isTopLevelConfigKey,readScopedConfig,writeScopedConfig,resolveWriteScope,toScopeFlags}from'../../commands/config/shared.js';function a22_0xa416(_0x70b33f,_0x3d98d6){_0x70b33f=_0x70b33f-0x196;const _0x3c225f=a22_0x3c22();let _0xa416bf=_0x3c225f[_0x70b33f];return _0xa416bf;}import{resolveWriteConfigPath,getProjectConfigPath}from'../../context.js';const GLOBAL_FLAG={'name':a22_0x1d4a2e(0x1a8),'type':'boolean','description':a22_0x1d4a2e(0x1b9),'default':![]};function parseAliasAppcodeSetKey(_0x450b12){const _0x26d33f=a22_0x1d4a2e,_0x198657=_0x450b12['split']('.');if(_0x198657[_0x26d33f(0x1a7)]!==0x3||_0x198657[0x0]!==_0x26d33f(0x1bb)||_0x198657[0x2]!==_0x26d33f(0x198))return undefined;const _0x208ffe=_0x198657[0x1]?.[_0x26d33f(0x1ca)]();return _0x208ffe?_0x208ffe:undefined;}function parseAliasDeleteKey(_0x1837b8){const _0x247233=a22_0x1d4a2e,_0x3dd808=_0x1837b8[_0x247233(0x1c0)]('.');if(_0x3dd808['length']===0x2&&_0x3dd808[0x0]===_0x247233(0x1bb)){const _0x23121c=_0x3dd808[0x1]?.[_0x247233(0x1ca)]();return _0x23121c?{'alias':_0x23121c}:undefined;}if(_0x3dd808[_0x247233(0x1a7)]===0x3&&_0x3dd808[0x0]===_0x247233(0x1bb)&&_0x3dd808[0x2]==='appcode'){const _0x572ecd=_0x3dd808[0x1]?.['trim']();return _0x572ecd?{'alias':_0x572ecd,'field':_0x247233(0x198)}:undefined;}return undefined;}function setLocalAppAlias(_0x5b8d27,_0xe6035a,_0x5bc573){const _0x5b87d5=a22_0x1d4a2e,_0x495901=_0x5b8d27[_0x5b87d5(0x1bb)]&&typeof _0x5b8d27[_0x5b87d5(0x1bb)]===_0x5b87d5(0x1cc)&&!Array['isArray'](_0x5b8d27[_0x5b87d5(0x1bb)])?_0x5b8d27[_0x5b87d5(0x1bb)]:{},_0x32561b=_0x495901[_0xe6035a]&&typeof _0x495901[_0xe6035a]===_0x5b87d5(0x1cc)&&!Array[_0x5b87d5(0x1c8)](_0x495901[_0xe6035a])?_0x495901[_0xe6035a]:{};_0x32561b[_0x5b87d5(0x198)]=_0x5bc573,_0x495901[_0xe6035a]=_0x32561b,_0x5b8d27[_0x5b87d5(0x1bb)]=_0x495901;}function deleteLocalAppAlias(_0x2032af,_0x3fd0eb){const _0x27e71d=a22_0x1d4a2e;if(!_0x2032af[_0x27e71d(0x1bb)]||typeof _0x2032af[_0x27e71d(0x1bb)]!==_0x27e71d(0x1cc)||Array[_0x27e71d(0x1c8)](_0x2032af['apps']))return![];const _0x1fa681=_0x2032af[_0x27e71d(0x1bb)],_0x5ae4b8=_0x1fa681[_0x3fd0eb[_0x27e71d(0x1c6)]];if(!_0x5ae4b8||typeof _0x5ae4b8!==_0x27e71d(0x1cc)||Array[_0x27e71d(0x1c8)](_0x5ae4b8))return![];if(!_0x3fd0eb[_0x27e71d(0x1b1)])return delete _0x1fa681[_0x3fd0eb[_0x27e71d(0x1c6)]],!![];if(!(_0x3fd0eb[_0x27e71d(0x1b1)]in _0x5ae4b8))return![];return delete _0x5ae4b8[_0x3fd0eb['field']],Object[_0x27e71d(0x1cd)](_0x5ae4b8)[_0x27e71d(0x1a7)]===0x0&&delete _0x1fa681[_0x3fd0eb[_0x27e71d(0x1c6)]],!![];}const listDef={'service':a22_0x1d4a2e(0x1c9),'command':a22_0x1d4a2e(0x1d1),'description':'List\x20current\x20config','risk':a22_0x1d4a2e(0x1a3),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'flags':[],async 'execute'(_0x344adc){const _0x184b0a=a22_0x1d4a2e,{buildConfigFromFlags:_0x24f38d}=await import(_0x184b0a(0x196)),_0x240881=_0x24f38d({}),_0x5aaeef=getProjectConfigPath(),_0x57732b=resolveWriteConfigPath(_0x184b0a(0x1a8));if(_0x344adc['format']===_0x184b0a(0x1ab))return{'ok':!![],'message':_0x184b0a(0x19c)+(JSON['stringify'](_0x240881[_0x184b0a(0x19b)],null,0x2)+'\x0a\x0a')+'Config\x20files:\x0a'+(_0x184b0a(0x1cf)+(_0x5aaeef??'(none)')+'\x0a')+('\x20\x20global:\x20\x20'+_0x57732b)};return{'ok':!![],'data':{'effective':_0x240881[_0x184b0a(0x19b)],'configFiles':{'project':_0x5aaeef??null,'global':_0x57732b}}};}},getDef={'service':'config','command':'get','description':'Get\x20a\x20config\x20value','risk':a22_0x1d4a2e(0x1a3),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a22_0x1d4a2e(0x1b7),'description':a22_0x1d4a2e(0x19e),'required':!![]}],'flags':[],async 'execute'(_0x51b0b1){const _0x3f066=a22_0x1d4a2e,_0xfa00b5=_0x51b0b1[_0x3f066(0x1ce)][0x0];if(!_0xfa00b5)throw CliErrors[_0x3f066(0x1c2)](_0x3f066(0x1b2),'Usage:\x20'+CLI_BIN_NAME+'\x20config\x20get\x20<key>');const {buildConfigFromFlags:_0x5be0fd}=await import(_0x3f066(0x196)),{raw:_0xc47279}=_0x5be0fd({});if(_0xfa00b5[_0x3f066(0x19d)]('.')){const _0x3fc8a3=_0xfa00b5[_0x3f066(0x1c0)]('.');let _0x5ded1c=_0xc47279;for(const _0x328f8b of _0x3fc8a3){if(_0x5ded1c==null||typeof _0x5ded1c!==_0x3f066(0x1cc))throw CliErrors[_0x3f066(0x1c2)](_0x3f066(0x1af)+_0xfa00b5);_0x5ded1c=_0x5ded1c[_0x328f8b];}if(_0x5ded1c===undefined)throw CliErrors[_0x3f066(0x1c2)](_0x3f066(0x1af)+_0xfa00b5);return console[_0x3f066(0x1b4)](typeof _0x5ded1c==='object'?JSON[_0x3f066(0x1b6)](_0x5ded1c,null,0x2):String(_0x5ded1c)),{'ok':!![]};}const _0x3e832c=_0xc47279[_0xfa00b5];if(_0x3e832c===undefined)throw CliErrors[_0x3f066(0x1c2)](_0x3f066(0x1af)+_0xfa00b5);return console['log'](typeof _0x3e832c===_0x3f066(0x1cc)?JSON[_0x3f066(0x1b6)](_0x3e832c,null,0x2):String(_0x3e832c)),{'ok':!![]};}},setDef={'service':a22_0x1d4a2e(0x1c9),'command':'set','description':a22_0x1d4a2e(0x1a9),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a22_0x1d4a2e(0x1b7),'description':getConfigCommandKeyDescription(),'required':!![]},{'name':'value','description':a22_0x1d4a2e(0x197),'required':!![]}],'flags':[GLOBAL_FLAG],async 'execute'(_0x55f156){const _0x22e28c=a22_0x1d4a2e,_0x22d8ef=_0x55f156['args'][0x0],_0x379438=_0x55f156[_0x22e28c(0x1ce)][0x1];if(!_0x22d8ef||_0x379438===undefined)throw CliErrors['validation'](_0x22e28c(0x1c7),_0x22e28c(0x1aa)+CLI_BIN_NAME+_0x22e28c(0x1ad));if(ENUM_KEYS[_0x22d8ef]&&!ENUM_KEYS[_0x22d8ef]['includes'](_0x379438))throw CliErrors[_0x22e28c(0x1c2)](_0x22e28c(0x1ae)+_0x22d8ef+_0x22e28c(0x19f)+ENUM_KEYS[_0x22d8ef]['join'](',\x20'));if(_0x22d8ef===_0x22e28c(0x199))throw CliErrors[_0x22e28c(0x1c2)](_0x22e28c(0x1ac));if(_0x22d8ef===_0x22e28c(0x1bd)){const _0x2d13af=Number(_0x379438);if(isNaN(_0x2d13af)||_0x2d13af<=0x0)throw CliErrors['validation'](_0x22e28c(0x1b3));}const _0x1f5643=resolveWriteScope({'explicitGlobal':_0x55f156[_0x22e28c(0x1a2)](_0x22e28c(0x1a8)),'policy':_0x22e28c(0x1be)}),_0x4584d7=toScopeFlags(_0x1f5643),_0x200cc4=readScopedConfig(_0x4584d7),_0x324d42=parseAliasAppcodeSetKey(_0x22d8ef);if(!_0x324d42&&!isTopLevelConfigKey(_0x22d8ef))throw CliErrors[_0x22e28c(0x1c2)](_0x22e28c(0x1a1)+_0x22d8ef+_0x22e28c(0x1a4),_0x22e28c(0x1b0)+getTopLevelConfigKeySummary()+';\x20apps.<alias>.appcode');return _0x324d42?setLocalAppAlias(_0x200cc4,_0x324d42,_0x379438):_0x200cc4[_0x22d8ef]=_0x22d8ef===_0x22e28c(0x1bd)?Number(_0x379438):_0x379438,console[_0x22e28c(0x1b4)](_0x22e28c(0x1c5)+_0x22d8ef+_0x22e28c(0x1c4)+_0x379438+'\x22'+(_0x1f5643==='global'?_0x22e28c(0x1bc):'')),writeScopedConfig(_0x200cc4,_0x4584d7),{'ok':!![]};}},deleteDef={'service':a22_0x1d4a2e(0x1c9),'command':'delete','description':'Delete\x20a\x20config\x20value','risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'key','description':getConfigCommandKeyDescription(),'required':!![]}],'flags':[GLOBAL_FLAG],async 'execute'(_0x232004){const _0x1201f9=a22_0x1d4a2e,_0x33f55c=_0x232004['args'][0x0];if(!_0x33f55c)throw CliErrors[_0x1201f9(0x1c2)]('Missing\x20key\x20argument.',_0x1201f9(0x1aa)+CLI_BIN_NAME+_0x1201f9(0x1bf));const _0x29b6b7=resolveWriteScope({'explicitGlobal':_0x232004[_0x1201f9(0x1a2)](_0x1201f9(0x1a8)),'policy':_0x1201f9(0x1be)}),_0x4c76bc=toScopeFlags(_0x29b6b7),_0x53b5ad=readScopedConfig(_0x4c76bc),_0x40668c=parseAliasDeleteKey(_0x33f55c);if(_0x40668c){if(!deleteLocalAppAlias(_0x53b5ad,_0x40668c))throw CliErrors[_0x1201f9(0x1c2)](_0x1201f9(0x1af)+_0x33f55c);return console[_0x1201f9(0x1b4)]('Deleted\x20`'+_0x33f55c+'`'+(_0x29b6b7===_0x1201f9(0x1a8)?_0x1201f9(0x1bc):'')),writeScopedConfig(_0x53b5ad,_0x4c76bc),{'ok':!![]};}if(_0x53b5ad[_0x33f55c]===undefined)throw CliErrors[_0x1201f9(0x1c2)]('Key\x20\x22'+_0x33f55c+'\x22\x20not\x20found\x20at\x20top\x20level.');return delete _0x53b5ad[_0x33f55c],console[_0x1201f9(0x1b4)](_0x1201f9(0x1ba)+_0x33f55c+'`'+(_0x29b6b7==='global'?_0x1201f9(0x1bc):'')),writeScopedConfig(_0x53b5ad,_0x4c76bc),{'ok':!![]};}};export const configDefinitions=[listDef,getDef,setDef,deleteDef];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `config` subcommand shared utilities — re-exports and helpers.
|
|
3
|
+
*
|
|
4
|
+
* Why this module: `config/definitions.ts` and `auth/index.tsx` both need
|
|
5
|
+
* the same config policy helpers (`resolveConfigScope`, `toScopeFlags`, etc.)
|
|
6
|
+
* and the same config key classification functions from `config-policy.ts`.
|
|
7
|
+
* Re-exporting them here provides a stable namespace (`@/commands/config/shared`)
|
|
8
|
+
* that won't break if the internal layout of `config-policy.ts` changes.
|
|
9
|
+
*
|
|
10
|
+
* Note: `resolveConfigScope` is re-exported as `resolveWriteScope` because the
|
|
11
|
+
* policy module uses "scope" terminology internally, while config commands
|
|
12
|
+
* think in terms of "where to write". The semantics are identical.
|
|
13
|
+
*/
|
|
14
|
+
import { CLI_BIN_NAME } from "../../constant/cli.js";
|
|
15
|
+
export { CLI_BIN_NAME };
|
|
16
|
+
export { readScopedConfig, writeScopedConfig } from "../../context.js";
|
|
17
|
+
export { resolveConfigScope as resolveWriteScope, TOP_LEVEL_CONFIG_KEYS as TOP_LEVEL_KEYS, CONFIG_ENUM_VALUES as ENUM_KEYS, getConfigCommandKeyDescription, getTopLevelConfigKeyList, getTopLevelConfigKeySummary, isTopLevelConfigKey, toScopeFlags, } from "../../commands/common/config-policy.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1dd2f3,_0xfdf619){var _0x40e82b=a23_0x19d5,_0x592111=_0x1dd2f3();while(!![]){try{var _0x2a0d68=-parseInt(_0x40e82b(0xbe))/0x1*(-parseInt(_0x40e82b(0xbb))/0x2)+parseInt(_0x40e82b(0xbf))/0x3*(-parseInt(_0x40e82b(0xba))/0x4)+-parseInt(_0x40e82b(0xb8))/0x5*(parseInt(_0x40e82b(0xbd))/0x6)+-parseInt(_0x40e82b(0xb9))/0x7+-parseInt(_0x40e82b(0xbc))/0x8+parseInt(_0x40e82b(0xc1))/0x9+parseInt(_0x40e82b(0xc0))/0xa;if(_0x2a0d68===_0xfdf619)break;else _0x592111['push'](_0x592111['shift']());}catch(_0x1bf38e){_0x592111['push'](_0x592111['shift']());}}}(a23_0x5255,0xd3147));import{CLI_BIN_NAME}from'../../constant/cli.js';export{CLI_BIN_NAME};export{readScopedConfig,writeScopedConfig}from'../../context.js';function a23_0x19d5(_0x28bfc4,_0x2e6be){_0x28bfc4=_0x28bfc4-0xb8;var _0x5255e7=a23_0x5255();var _0x19d5b2=_0x5255e7[_0x28bfc4];return _0x19d5b2;}export{resolveConfigScope as resolveWriteScope,TOP_LEVEL_CONFIG_KEYS as TOP_LEVEL_KEYS,CONFIG_ENUM_VALUES as ENUM_KEYS,getConfigCommandKeyDescription,getTopLevelConfigKeyList,getTopLevelConfigKeySummary,isTopLevelConfigKey,toScopeFlags}from'../../commands/common/config-policy.js';function a23_0x5255(){var _0x60cfde=['17410VwaVEw','716064KHwBzZ','2268LgvDDp','58MdWMqJ','3MpTESX','45074280DZmvzP','34848NlnUEO','18595dJqSRz','10506881vRydUx','4621336inXYnL'];a23_0x5255=function(){return _0x60cfde;};return a23_0x5255();}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `data` command definitions — Instant API operations on dataset records.
|
|
3
|
+
*
|
|
4
|
+
* Why a spec-driven factory (`makeDataCommand`): all seven operations
|
|
5
|
+
* (filter, getOne, create, batchCreate, update, delete, aggregate) share
|
|
6
|
+
* the same structure: `CommandDefinition` with a `validate` hook and an
|
|
7
|
+
* `execute` body. Only the operation name, risk level, params requirement,
|
|
8
|
+
* and help text differ. A spec table eliminates duplication while keeping
|
|
9
|
+
* each operation's behavior explicit and auditable.
|
|
10
|
+
*
|
|
11
|
+
* Why `riskLevelOrder` is NOT enforced for `data` operations: the risk level
|
|
12
|
+
* is set per-operation (`read` for filter/getOne/aggregate, `write` for
|
|
13
|
+
* create/update, `high-risk-write` for delete). However, the framework's
|
|
14
|
+
* risk-level confirmation is bypassed here because:
|
|
15
|
+
* 1. `data delete` already requires `--yes` in non-interactive mode via
|
|
16
|
+
* the pipeline's risk confirmation step (based on `risk: "high-risk-write"`)
|
|
17
|
+
* 2. Write operations (create/update) are common and non-destructive
|
|
18
|
+
*
|
|
19
|
+
* Why `dryRun` is only attached for non-read operations: dry-run only makes
|
|
20
|
+
* sense for mutating operations. Read operations have no side effects to preview.
|
|
21
|
+
*
|
|
22
|
+
* Design decision: `batchCreate` accepts both a plain array (`[...]`) and
|
|
23
|
+
* a wrapped object (`{items: [...]}`) via `parseBatchCreateItemsFromParams`.
|
|
24
|
+
* This matches the flexibility of the Lovrabet Studio UI.
|
|
25
|
+
*/
|
|
26
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
27
|
+
export declare const dataDefinitions: CommandDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a24_0x42099a=a24_0x4606;function a24_0x42ad(){const _0x1151e4=['\x20\x20\x20\x20$endWith\x20\x20\x20\x20\x20Ends\x20with\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22email\x22:{\x22$endWith\x22:\x22@example.com\x22}}','body','\x20\x20\x20\x20$startWith\x20\x20\x20Starts\x20with\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22name\x22:{\x22$startWith\x22:\x22Mr.\x22}}','\x20\x20\x20\x20select\x20\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Fields\x20to\x20return\x20alongside\x20aggregates,\x20e.g.\x20[\x22status\x22,\x22region\x22]','\x20\x20\x20\x20Correct:\x20\x20--params\x20\x27{\x22currentPage\x22:1,\x22pageSize\x22:10}\x27','\x20\x20\x20\x20Pagination\x20is\x20controlled\x20via\x20JSON\x20in\x20--params.\x20Do\x20NOT\x20use\x20--page-size\x20as\x20a\x20CLI\x20flag.','\x20\x20\x20\x20$and\x20\x20\x20\x20\x20\x20\x20\x20\x20All\x20conditions\x20match\x20\x20\x20{\x22$and\x22:[{\x22age\x22:{\x22$gte\x22:18}},{\x22status\x22:{\x22$eq\x22:\x22active\x22}}]}','Example:\x20\x27{\x22where\x22:{\x22status\x22:{\x22$eq\x22:\x22active\x22}},\x22currentPage\x22:1,\x22pageSize\x22:20}\x27','batch','read','\x20\x20\x20\x20$in\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Value\x20in\x20set\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22country\x22:{\x22$in\x22:[\x22CN\x22,\x22US\x22]}}','Example:\x20\x27{\x22aggregate\x22:[{\x22column\x22:\x20\x22amount\x22,\x22type\x22:\x22SUM\x22,\x22alias\x22:\x22total\x22}],\x22groupBy\x22:[\x22status\x22]}\x27','\x20\x20\x20\x20#\x20Count\x20orders\x20per\x20region\x20with\x20filter','9391420qMdtpl','high-risk-write','\x20\x20\x20\x20COUNT\x20\x20\x20\x20\x20\x20\x20\x20Count\x20of\x20records\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22}','risk','\x20\x20\x20\x20orderBy\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Sort\x20order,\x20e.g.\x20[{\x22total\x22:\x22desc\x22}]','\x20\x20\x20\x20orderBy\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Sort\x20order,\x20e.g.\x20[{\x22id\x22:\x22desc\x22},{\x22name\x22:\x22asc\x22}]','Create\x20a\x20new\x20record\x20in\x20a\x20dataset','\x20\x20\x20\x20--params\x20\x27{\x22aggregate\x22:[{\x22column\x22:\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22}],\x22groupBy\x22:[\x22region\x22],\x22where\x22:{\x22status\x22:{\x22$eq\x22:\x22active\x22}}}\x27','\x20\x20\x20\x20$eq\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Equals\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22age\x22:{\x22$eq\x22:18}}','1147452Jnuxxf','description','getOne','\x20\x20PARAMS\x20STRUCTURE','\x20\x20\x20\x20$lt\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Less\x20than\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22amount\x22:{\x22$lt\x22:1000}}','\x20\x20\x20\x20where\x20\x20\x20\x20\x20\x20\x20\x20\x20Object\x20\x20\x20Pre-aggregation\x20filter\x20(same\x20operators\x20as\x20data\x20filter)','109335JVrXzX','\x20\x20LOGICAL\x20COMBINATORS','\x20\x20\x20\x20currentPage\x20\x20\x20Number\x20\x20\x20Page\x20number\x20(starts\x20from\x201)','join','\x20\x20\x20\x20#\x20Sum\x20amount\x20grouped\x20by\x20status','Update\x20an\x20existing\x20record','\x20\x20\x20\x20$contain\x20\x20\x20\x20\x20Substring\x20match\x20\x20\x20\x20\x20\x20\x20\x20{\x22name\x22:{\x22$contain\x22:\x22test\x22}}','command','length','params','JSON\x20body\x20for\x20filter\x20API.\x20Fields:\x20where,\x20select,\x20orderBy,\x20currentPage,\x20pageSize.\x20','18GvbWMp','\x20\x20\x20\x20$gt\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Greater\x20than\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22amount\x22:{\x22$gt\x22:100}}','filter','14kLZdiX','now','\x20\x20AGGREGATE\x20TYPES','\x20\x20WHERE\x20OPERATORS','132nhaKJi','str','\x20\x20\x20\x20AVG\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Rounded\x20average\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22score\x22,\x22type\x22:\x22AVG\x22,\x22alias\x22:\x22avg\x22,\x22round\x22:true,\x22precision\x22:2}','40354OAxqQE','1825512qfjMTA','524282vVdMPY','JSON\x20with\x20id\x20+\x20fields\x20to\x20update.\x20id\x20may\x20be\x20a\x20single\x20value\x20or\x20array.\x20','\x20\x20\x20\x20groupBy\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Grouping\x20fields,\x20e.g.\x20[\x22status\x22,\x22region\x22]','\x20on\x20dataset\x20','write','delete','\x20\x20\x20\x20$gte\x20\x20\x20\x20\x20\x20\x20\x20\x20Greater\x20than\x20or\x20equal\x20\x20{\x22amount\x22:{\x22$gte\x22:100}}','Examples:\x20\x27{\x22id\x22:123,\x22status\x22:\x22completed\x22}\x27,\x20\x27{\x22id\x22:[1,2,3],\x22status\x22:\x22completed\x22}\x27','data\x20','\x20\x20\x20\x20$lte\x20\x20\x20\x20\x20\x20\x20\x20\x20Less\x20than\x20or\x20equal\x20\x20\x20\x20\x20{\x22amount\x22:{\x22$lte\x22:1000}}','code','\x20\x20\x20\x20--params\x20\x27{\x22aggregate\x22:[{\x22column\x22:\x22amount\x22,\x22type\x22:\x22SUM\x22,\x22alias\x22:\x22total\x22}],\x22groupBy\x22:[\x22status\x22]}\x27','POST','update','\x20\x20\x20\x20select\x20\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Fields\x20to\x20return,\x20e.g.\x20[\x22id\x22,\x22name\x22,\x22status\x22]','\x20\x20PAGINATION','\x20completed\x20in\x20','\x20\x20\x20\x20pageSize\x20\x20\x20\x20\x20\x20Number\x20\x20\x20Records\x20per\x20page\x20(default:\x2020)','Filter\x20dataset\x20records\x20with\x20query\x20conditions','JSON\x20with\x20record\x20id.\x20Example:\x20\x27{\x22id\x22:123}\x27','paramsHint','Create\x20multiple\x20records\x20in\x20one\x20request\x20(SDK\x20batchCreate)','\x20\x20\x20\x20aggregate\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Aggregation\x20definitions\x20(see\x20AGGREGATE\x20TYPES\x20above)','\x20\x20\x20\x20COUNT\x20\x20\x20\x20\x20\x20\x20\x20Count\x20distinct\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22,\x22distinct\x22:true}','/api/{appCode}/','aggregate','operation','create','Get\x20a\x20single\x20record\x20by\x20ID','JSON\x20body\x20for\x20aggregate\x20API.\x20Fields:\x20select,\x20aggregate,\x20where,\x20groupBy,\x20having,\x20orderBy.\x20','data','2376376OskiDD','build','batchCreate','paramsRequired','Aggregate\x20dataset\x20records\x20(group\x20by,\x20sum,\x20count,\x20avg,\x20etc.)','map'];a24_0x42ad=function(){return _0x1151e4;};return a24_0x42ad();}(function(_0x4cf56d,_0x240389){const _0x5d5423=a24_0x4606,_0x8394e6=_0x4cf56d();while(!![]){try{const _0x11cb3d=parseInt(_0x5d5423(0x222))/0x1+-parseInt(_0x5d5423(0x224))/0x2+parseInt(_0x5d5423(0x223))/0x3+-parseInt(_0x5d5423(0x21f))/0x4*(parseInt(_0x5d5423(0x20d))/0x5)+-parseInt(_0x5d5423(0x207))/0x6*(-parseInt(_0x5d5423(0x21b))/0x7)+-parseInt(_0x5d5423(0x243))/0x8*(parseInt(_0x5d5423(0x218))/0x9)+parseInt(_0x5d5423(0x1fe))/0xa;if(_0x11cb3d===_0x240389)break;else _0x8394e6['push'](_0x8394e6['shift']());}catch(_0x555f31){_0x8394e6['push'](_0x8394e6['shift']());}}}(a24_0x42ad,0x5fdbe));import{executeData}from'../../core/sdk-client.js';import{CODE_FLAG,PARAMS_FLAG}from'../../commands/common/flags.js';function a24_0x4606(_0x2dc18c,_0x982177){_0x2dc18c=_0x2dc18c-0x1ec;const _0x42adbc=a24_0x42ad();let _0x460676=_0x42adbc[_0x2dc18c];return _0x460676;}import{requireAnyOf}from'../../commands/common/constraints.js';import{parseJsonParams,parseJsonParamsValue,parseBatchCreateItemsFromParams,parseUpdateIdsFromParams,normalizeUpdateParamsForRuntime}from'../../utils/params.js';import{dryRun}from'../../framework/dryrun.js';const specs=[{'command':a24_0x42099a(0x21a),'operation':a24_0x42099a(0x21a),'risk':a24_0x42099a(0x1fa),'paramsRequired':![],'description':a24_0x42099a(0x236),'paramsHint':a24_0x42099a(0x217)+a24_0x42099a(0x1f8),'helpExtra':[a24_0x42099a(0x21e),a24_0x42099a(0x206),'\x20\x20\x20\x20$ne\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Not\x20equals\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22status\x22:{\x22$ne\x22:\x22deleted\x22}}',a24_0x42099a(0x219),a24_0x42099a(0x22a),a24_0x42099a(0x20b),a24_0x42099a(0x22d),a24_0x42099a(0x1fb),a24_0x42099a(0x213),a24_0x42099a(0x1f3),a24_0x42099a(0x1f1),'',a24_0x42099a(0x20e),a24_0x42099a(0x1f7),'\x20\x20\x20\x20$or\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Any\x20condition\x20matches\x20\x20{\x22$or\x22:[{\x22status\x22:{\x22$eq\x22:\x22active\x22}},{\x22status\x22:{\x22$eq\x22:\x22pending\x22}}]}','','\x20\x20JSON\x20BODY\x20FIELDS\x20(pass\x20inside\x20--params)','\x20\x20\x20\x20where\x20\x20\x20\x20\x20\x20\x20\x20\x20Object\x20\x20\x20Query\x20conditions\x20(see\x20operators\x20above)',a24_0x42099a(0x232),a24_0x42099a(0x203),a24_0x42099a(0x20f),a24_0x42099a(0x235),'',a24_0x42099a(0x233),a24_0x42099a(0x1f6),a24_0x42099a(0x1f5),'\x20\x20\x20\x20Wrong:\x20\x20\x20\x20--page-size\x2010\x20\x20(this\x20is\x20not\x20a\x20valid\x20flag)'][a24_0x42099a(0x210)]('\x0a')},{'command':a24_0x42099a(0x209),'operation':a24_0x42099a(0x209),'risk':a24_0x42099a(0x1fa),'paramsRequired':!![],'description':a24_0x42099a(0x240),'paramsHint':a24_0x42099a(0x237)},{'command':a24_0x42099a(0x23f),'operation':'create','risk':a24_0x42099a(0x228),'paramsRequired':!![],'description':a24_0x42099a(0x204),'paramsHint':'JSON\x20with\x20field\x20values.\x20Example:\x20\x27{\x22name\x22:\x22test\x22,\x22amount\x22:100}\x27'},{'command':a24_0x42099a(0x1ed),'operation':a24_0x42099a(0x1ed),'risk':'write','paramsRequired':!![],'description':a24_0x42099a(0x239),'paramsHint':'JSON\x20array\x20of\x20record\x20objects,\x20or\x20{\x22items\x22:[...]}.\x20Example:\x20\x27[{\x22name\x22:\x22a\x22},{\x22name\x22:\x22b\x22}]\x27'},{'command':a24_0x42099a(0x231),'operation':'update','risk':a24_0x42099a(0x228),'paramsRequired':!![],'description':a24_0x42099a(0x212),'paramsHint':a24_0x42099a(0x225)+a24_0x42099a(0x22b)},{'command':a24_0x42099a(0x229),'operation':'delete','risk':a24_0x42099a(0x1ff),'paramsRequired':!![],'description':'Delete\x20a\x20record\x20(requires\x20--yes\x20in\x20non-interactive)','paramsHint':a24_0x42099a(0x237)},{'command':'aggregate','operation':a24_0x42099a(0x23d),'risk':a24_0x42099a(0x1fa),'paramsRequired':![],'description':a24_0x42099a(0x1ef),'paramsHint':a24_0x42099a(0x241)+a24_0x42099a(0x1fc),'helpExtra':[a24_0x42099a(0x21d),'\x20\x20\x20\x20SUM\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Sum\x20of\x20column\x20values\x20\x20\x20\x20\x20{\x22column\x22:\x22amount\x22,\x22type\x22:\x22SUM\x22,\x22alias\x22:\x22total\x22}',a24_0x42099a(0x200),a24_0x42099a(0x23b),'\x20\x20\x20\x20AVG\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Average\x20value\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22score\x22,\x22type\x22:\x22AVG\x22,\x22alias\x22:\x22avg_score\x22}',a24_0x42099a(0x221),'\x20\x20\x20\x20MAX\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Maximum\x20value\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22price\x22,\x22type\x22:\x22MAX\x22,\x22alias\x22:\x22max_price\x22}','\x20\x20\x20\x20MIN\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Minimum\x20value\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22price\x22,\x22type\x22:\x22MIN\x22,\x22alias\x22:\x22min_price\x22}','',a24_0x42099a(0x20a),a24_0x42099a(0x1f4),a24_0x42099a(0x23a),a24_0x42099a(0x20c),a24_0x42099a(0x226),'\x20\x20\x20\x20having\x20\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Post-aggregation\x20filters,\x20e.g.\x20[{\x22columnName\x22:\x22total\x22,\x22condition\x22:{\x22$gt\x22:1000}}]',a24_0x42099a(0x202),'','\x20\x20EXAMPLES',a24_0x42099a(0x211),a24_0x42099a(0x22f),'',a24_0x42099a(0x1fd),a24_0x42099a(0x205),'','\x20\x20\x20\x20#\x20`field`\x20is\x20accepted\x20as\x20a\x20deprecated\x20alias\x20for\x20`column`;\x20new\x20calls\x20should\x20use\x20`column`.'][a24_0x42099a(0x210)]('\x0a')}];function makeDataCommand(_0x4eedb5){const _0x389b93=a24_0x42099a,_0x5acc8d=_0x389b93(0x22c)+_0x4eedb5[_0x389b93(0x214)],_0x419adb={'service':_0x389b93(0x242),'command':_0x4eedb5[_0x389b93(0x214)],'description':_0x4eedb5['description'],'risk':_0x4eedb5[_0x389b93(0x201)],'helpExtra':_0x4eedb5['helpExtra'],'flags':[CODE_FLAG,{...PARAMS_FLAG,'description':_0x4eedb5[_0x389b93(0x238)]}],'validate':async _0x29b3c6=>{const _0x1573f2=_0x389b93;_0x4eedb5[_0x1573f2(0x1ee)]&&requireAnyOf(_0x29b3c6,['params'],_0x5acc8d),_0x4eedb5['operation']===_0x1573f2(0x1ed)&&parseBatchCreateItemsFromParams(parseJsonParamsValue(_0x29b3c6[_0x1573f2(0x220)](_0x1573f2(0x216)))),_0x4eedb5[_0x1573f2(0x23e)]===_0x1573f2(0x231)&&parseUpdateIdsFromParams(parseJsonParams(_0x29b3c6[_0x1573f2(0x220)](_0x1573f2(0x216)))??{});},async 'execute'(_0x40a536){const _0x4d2a40=_0x389b93,_0x161264=_0x40a536[_0x4d2a40(0x220)](_0x4d2a40(0x22e)),_0x256201=_0x4eedb5[_0x4d2a40(0x23e)]===_0x4d2a40(0x1ed)?parseBatchCreateItemsFromParams(parseJsonParamsValue(_0x40a536['str']('params'))):parseJsonParams(_0x40a536[_0x4d2a40(0x220)](_0x4d2a40(0x216)))??{},_0x121820=_0x4eedb5[_0x4d2a40(0x23e)]==='update'?parseUpdateIdsFromParams(_0x256201):undefined,_0x244e9b=_0x121820?normalizeUpdateParamsForRuntime(_0x256201,_0x121820):_0x256201,_0x2227e8=Date[_0x4d2a40(0x21c)](),_0xd38213=await executeData(_0x161264,_0x4eedb5[_0x4d2a40(0x23e)],_0x244e9b),_0xdac550=Date[_0x4d2a40(0x21c)]()-_0x2227e8,_0x3b091d=_0x121820&&_0x121820['length']>0x1?buildBatchUpdateResult(_0x121820,_0xd38213):_0xd38213;return{'ok':!![],'data':{'result':_0x3b091d,'elapsed':_0xdac550},'message':'data\x20'+_0x4eedb5[_0x4d2a40(0x214)]+_0x4d2a40(0x234)+_0xdac550+'ms'};}};return _0x4eedb5['risk']!==_0x389b93(0x1fa)&&(_0x419adb['dryRun']=async _0x62dc3e=>{const _0x14e4c9=_0x389b93,_0x5d77a9=_0x62dc3e[_0x14e4c9(0x220)](_0x14e4c9(0x22e)),_0x5ad047=_0x4eedb5['operation']===_0x14e4c9(0x1ed)?parseBatchCreateItemsFromParams(parseJsonParamsValue(_0x62dc3e['str'](_0x14e4c9(0x216)))):parseJsonParams(_0x62dc3e[_0x14e4c9(0x220)]('params'))??{};let _0x5dc41b=_0x5ad047;if(_0x4eedb5[_0x14e4c9(0x23e)]===_0x14e4c9(0x231)){const _0x65de9b=parseUpdateIdsFromParams(_0x5ad047);_0x5dc41b=normalizeUpdateParamsForRuntime(_0x5ad047,_0x65de9b);}return dryRun(_0x14e4c9(0x230),_0x14e4c9(0x23c)+_0x5d77a9+'/'+_0x4eedb5['operation'])[_0x14e4c9(0x1f2)](_0x5dc41b)[_0x14e4c9(0x208)]('Preview:\x20data\x20'+_0x4eedb5[_0x14e4c9(0x214)]+_0x14e4c9(0x227)+_0x5d77a9)[_0x14e4c9(0x1ec)]();}),_0x419adb;}export const dataDefinitions=specs[a24_0x42099a(0x1f0)](makeDataCommand);function buildBatchUpdateResult(_0xc8f9d9,_0x4ff657){const _0x789755=a24_0x42099a;return{'operation':_0x789755(0x231),'mode':_0x789755(0x1f9),'ids':_0xc8f9d9,'total':_0xc8f9d9[_0x789755(0x215)],'result':_0x4ff657};}
|
|
1
|
+
const a24_0x15e113=a24_0x1ddf;function a24_0x1ddf(_0x5e6c0a,_0x4335d2){_0x5e6c0a=_0x5e6c0a-0x1b0;const _0x5c422c=a24_0x5c42();let _0x1ddf02=_0x5c422c[_0x5e6c0a];return _0x1ddf02;}(function(_0x4e38eb,_0x5037a2){const _0x409956=a24_0x1ddf,_0x4314c8=_0x4e38eb();while(!![]){try{const _0x51a7e6=-parseInt(_0x409956(0x1c6))/0x1*(-parseInt(_0x409956(0x205))/0x2)+-parseInt(_0x409956(0x1d5))/0x3*(-parseInt(_0x409956(0x1d4))/0x4)+parseInt(_0x409956(0x1f3))/0x5*(-parseInt(_0x409956(0x1d2))/0x6)+-parseInt(_0x409956(0x1ff))/0x7+parseInt(_0x409956(0x1f1))/0x8*(parseInt(_0x409956(0x1b2))/0x9)+parseInt(_0x409956(0x1fb))/0xa*(-parseInt(_0x409956(0x1f8))/0xb)+parseInt(_0x409956(0x1d6))/0xc;if(_0x51a7e6===_0x5037a2)break;else _0x4314c8['push'](_0x4314c8['shift']());}catch(_0x114255){_0x4314c8['push'](_0x4314c8['shift']());}}}(a24_0x5c42,0x68043));import{executeData}from'../../core/sdk-client.js';import{CODE_FLAG,PARAMS_FLAG}from'../../commands/common/flags.js';function a24_0x5c42(){const _0x5a18de=['\x20\x20\x20\x20$eq\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Equals\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22age\x22:{\x22$eq\x22:18}}','\x20\x20\x20\x20aggregate\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Aggregation\x20definitions\x20(see\x20AGGREGATE\x20TYPES\x20above)','description','\x20\x20\x20\x20#\x20Sum\x20amount\x20grouped\x20by\x20status','\x20\x20\x20\x20--params\x20\x27{\x22aggregate\x22:[{\x22column\x22:\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22}],\x22groupBy\x22:[\x22region\x22],\x22where\x22:{\x22status\x22:{\x22$eq\x22:\x22active\x22}}}\x27','helpExtra','write','\x20on\x20dataset\x20','Get\x20a\x20single\x20record\x20by\x20ID','\x20\x20\x20\x20select\x20\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Fields\x20to\x20return,\x20e.g.\x20[\x22id\x22,\x22name\x22,\x22status\x22]','\x20\x20\x20\x20Pagination\x20is\x20controlled\x20via\x20JSON\x20in\x20--params.\x20Do\x20NOT\x20use\x20--page-size\x20as\x20a\x20CLI\x20flag.','Example:\x20\x27{\x22aggregate\x22:[{\x22column\x22:\x20\x22amount\x22,\x22type\x22:\x22SUM\x22,\x22alias\x22:\x22total\x22}],\x22groupBy\x22:[\x22status\x22]}\x27','code','high-risk-write','map','\x20\x20\x20\x20$and\x20\x20\x20\x20\x20\x20\x20\x20\x20All\x20conditions\x20match\x20\x20\x20{\x22$and\x22:[{\x22age\x22:{\x22$gte\x22:18}},{\x22status\x22:{\x22$eq\x22:\x22active\x22}}]}','\x20\x20AGGREGATE\x20TYPES','Create\x20multiple\x20records\x20in\x20one\x20request\x20(SDK\x20batchCreate)','1vjUWqD','delete','\x20\x20JSON\x20BODY\x20FIELDS\x20(pass\x20inside\x20--params)','\x20\x20\x20\x20COUNT\x20\x20\x20\x20\x20\x20\x20\x20Count\x20of\x20records\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22}','getOne','\x20\x20\x20\x20select\x20\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Fields\x20to\x20return\x20alongside\x20aggregates,\x20e.g.\x20[\x22status\x22,\x22region\x22]','\x20\x20\x20\x20AVG\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Average\x20value\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22score\x22,\x22type\x22:\x22AVG\x22,\x22alias\x22:\x22avg_score\x22}','/api/{appCode}/','length','JSON\x20with\x20field\x20values.\x20Example:\x20\x27{\x22name\x22:\x22test\x22,\x22amount\x22:100}\x27','Filter\x20dataset\x20records\x20with\x20query\x20conditions','Example:\x20\x27{\x22where\x22:{\x22status\x22:{\x22$eq\x22:\x22active\x22}},\x22currentPage\x22:1,\x22pageSize\x22:20}\x27','6FjXozE','paramsRequired','1356cosjwO','4965FdZUbs','11356596aIyQhQ','Delete\x20a\x20record\x20(requires\x20--yes\x20in\x20non-interactive)','\x20\x20\x20\x20groupBy\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Grouping\x20fields,\x20e.g.\x20[\x22status\x22,\x22region\x22]','filter','JSON\x20body\x20for\x20filter\x20API.\x20Fields:\x20where,\x20select,\x20orderBy,\x20currentPage,\x20pageSize.\x20','JSON\x20with\x20id\x20+\x20fields\x20to\x20update.\x20id\x20may\x20be\x20a\x20single\x20value\x20or\x20array.\x20','\x20\x20\x20\x20$startWith\x20\x20\x20Starts\x20with\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22name\x22:{\x22$startWith\x22:\x22Mr.\x22}}','\x20\x20EXAMPLES','command','\x20\x20WHERE\x20OPERATORS','\x20\x20LOGICAL\x20COMBINATORS','\x20\x20\x20\x20MIN\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Minimum\x20value\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22price\x22,\x22type\x22:\x22MIN\x22,\x22alias\x22:\x22min_price\x22}','update','Examples:\x20\x27{\x22id\x22:123,\x22status\x22:\x22completed\x22}\x27,\x20\x27{\x22id\x22:[1,2,3],\x22status\x22:\x22completed\x22}\x27','batchCreate','POST','str','\x20\x20\x20\x20MAX\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Maximum\x20value\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22price\x22,\x22type\x22:\x22MAX\x22,\x22alias\x22:\x22max_price\x22}','\x20\x20\x20\x20#\x20`field`\x20is\x20accepted\x20as\x20a\x20deprecated\x20alias\x20for\x20`column`;\x20new\x20calls\x20should\x20use\x20`column`.','data\x20','read','\x20\x20\x20\x20SUM\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Sum\x20of\x20column\x20values\x20\x20\x20\x20\x20{\x22column\x22:\x22amount\x22,\x22type\x22:\x22SUM\x22,\x22alias\x22:\x22total\x22}','\x20\x20\x20\x20AVG\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Rounded\x20average\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22score\x22,\x22type\x22:\x22AVG\x22,\x22alias\x22:\x22avg\x22,\x22round\x22:true,\x22precision\x22:2}','\x20\x20\x20\x20orderBy\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Sort\x20order,\x20e.g.\x20[{\x22total\x22:\x22desc\x22}]','\x20\x20\x20\x20$ne\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Not\x20equals\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22status\x22:{\x22$ne\x22:\x22deleted\x22}}','JSON\x20with\x20record\x20id.\x20Example:\x20\x27{\x22id\x22:123}\x27','\x20completed\x20in\x20','1950728qkpVix','\x20\x20\x20\x20Wrong:\x20\x20\x20\x20--page-size\x2010\x20\x20(this\x20is\x20not\x20a\x20valid\x20flag)','2707665UGZGUk','body','params','Create\x20a\x20new\x20record\x20in\x20a\x20dataset','\x20\x20\x20\x20$contain\x20\x20\x20\x20\x20Substring\x20match\x20\x20\x20\x20\x20\x20\x20\x20{\x22name\x22:{\x22$contain\x22:\x22test\x22}}','3751495UOwANi','\x20\x20PAGINATION','\x20\x20\x20\x20currentPage\x20\x20\x20Number\x20\x20\x20Page\x20number\x20(starts\x20from\x201)','10mOVcqx','JSON\x20array\x20of\x20record\x20objects,\x20or\x20{\x22items\x22:[...]}.\x20Example:\x20\x27[{\x22name\x22:\x22a\x22},{\x22name\x22:\x22b\x22}]\x27','build','paramsHint','4083555ytxjTH','\x20\x20\x20\x20$or\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Any\x20condition\x20matches\x20\x20{\x22$or\x22:[{\x22status\x22:{\x22$eq\x22:\x22active\x22}},{\x22status\x22:{\x22$eq\x22:\x22pending\x22}}]}','risk','operation','aggregate','now','281450JEyWHH','\x20\x20\x20\x20$gt\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Greater\x20than\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22amount\x22:{\x22$gt\x22:100}}','\x20\x20\x20\x20$in\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Value\x20in\x20set\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22country\x22:{\x22$in\x22:[\x22CN\x22,\x22US\x22]}}','Aggregate\x20dataset\x20records\x20(group\x20by,\x20sum,\x20count,\x20avg,\x20etc.)','JSON\x20body\x20for\x20aggregate\x20API.\x20Fields:\x20select,\x20aggregate,\x20where,\x20groupBy,\x20having,\x20orderBy.\x20','batch','\x20\x20\x20\x20$endWith\x20\x20\x20\x20\x20Ends\x20with\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22email\x22:{\x22$endWith\x22:\x22@example.com\x22}}','Preview:\x20data\x20','create','9ERMKhE','Update\x20an\x20existing\x20record'];a24_0x5c42=function(){return _0x5a18de;};return a24_0x5c42();}import{requireAnyOf}from'../../commands/common/constraints.js';import{parseJsonParams,parseJsonParamsValue,parseBatchCreateItemsFromParams,parseUpdateIdsFromParams,normalizeUpdateParamsForRuntime}from'../../utils/params.js';import{dryRun}from'../../framework/dryrun.js';const specs=[{'command':a24_0x15e113(0x1d9),'operation':a24_0x15e113(0x1d9),'risk':'read','paramsRequired':![],'description':a24_0x15e113(0x1d0),'paramsHint':a24_0x15e113(0x1da)+a24_0x15e113(0x1d1),'helpExtra':[a24_0x15e113(0x1df),a24_0x15e113(0x1b4),a24_0x15e113(0x1ee),a24_0x15e113(0x206),'\x20\x20\x20\x20$gte\x20\x20\x20\x20\x20\x20\x20\x20\x20Greater\x20than\x20or\x20equal\x20\x20{\x22amount\x22:{\x22$gte\x22:100}}','\x20\x20\x20\x20$lt\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Less\x20than\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22amount\x22:{\x22$lt\x22:1000}}','\x20\x20\x20\x20$lte\x20\x20\x20\x20\x20\x20\x20\x20\x20Less\x20than\x20or\x20equal\x20\x20\x20\x20\x20{\x22amount\x22:{\x22$lte\x22:1000}}',a24_0x15e113(0x207),a24_0x15e113(0x1f7),a24_0x15e113(0x1dc),a24_0x15e113(0x20b),'',a24_0x15e113(0x1e0),a24_0x15e113(0x1c3),a24_0x15e113(0x200),'',a24_0x15e113(0x1c8),'\x20\x20\x20\x20where\x20\x20\x20\x20\x20\x20\x20\x20\x20Object\x20\x20\x20Query\x20conditions\x20(see\x20operators\x20above)',a24_0x15e113(0x1bd),'\x20\x20\x20\x20orderBy\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Sort\x20order,\x20e.g.\x20[{\x22id\x22:\x22desc\x22},{\x22name\x22:\x22asc\x22}]',a24_0x15e113(0x1fa),'\x20\x20\x20\x20pageSize\x20\x20\x20\x20\x20\x20Number\x20\x20\x20Records\x20per\x20page\x20(default:\x2020)','',a24_0x15e113(0x1f9),a24_0x15e113(0x1be),'\x20\x20\x20\x20Correct:\x20\x20--params\x20\x27{\x22currentPage\x22:1,\x22pageSize\x22:10}\x27',a24_0x15e113(0x1f2)]['join']('\x0a')},{'command':a24_0x15e113(0x1ca),'operation':a24_0x15e113(0x1ca),'risk':a24_0x15e113(0x1ea),'paramsRequired':!![],'description':a24_0x15e113(0x1bc),'paramsHint':'JSON\x20with\x20record\x20id.\x20Example:\x20\x27{\x22id\x22:123}\x27'},{'command':a24_0x15e113(0x1b1),'operation':a24_0x15e113(0x1b1),'risk':a24_0x15e113(0x1ba),'paramsRequired':!![],'description':a24_0x15e113(0x1f6),'paramsHint':a24_0x15e113(0x1cf)},{'command':a24_0x15e113(0x1e4),'operation':'batchCreate','risk':a24_0x15e113(0x1ba),'paramsRequired':!![],'description':a24_0x15e113(0x1c5),'paramsHint':a24_0x15e113(0x1fc)},{'command':a24_0x15e113(0x1e2),'operation':'update','risk':'write','paramsRequired':!![],'description':a24_0x15e113(0x1b3),'paramsHint':a24_0x15e113(0x1db)+a24_0x15e113(0x1e3)},{'command':a24_0x15e113(0x1c7),'operation':'delete','risk':a24_0x15e113(0x1c1),'paramsRequired':!![],'description':a24_0x15e113(0x1d7),'paramsHint':a24_0x15e113(0x1ef)},{'command':a24_0x15e113(0x203),'operation':a24_0x15e113(0x203),'risk':a24_0x15e113(0x1ea),'paramsRequired':![],'description':a24_0x15e113(0x208),'paramsHint':a24_0x15e113(0x209)+a24_0x15e113(0x1bf),'helpExtra':[a24_0x15e113(0x1c4),a24_0x15e113(0x1eb),a24_0x15e113(0x1c9),'\x20\x20\x20\x20COUNT\x20\x20\x20\x20\x20\x20\x20\x20Count\x20distinct\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x22column\x22:\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22,\x22distinct\x22:true}',a24_0x15e113(0x1cc),a24_0x15e113(0x1ec),a24_0x15e113(0x1e7),a24_0x15e113(0x1e1),'','\x20\x20PARAMS\x20STRUCTURE',a24_0x15e113(0x1cb),a24_0x15e113(0x1b5),'\x20\x20\x20\x20where\x20\x20\x20\x20\x20\x20\x20\x20\x20Object\x20\x20\x20Pre-aggregation\x20filter\x20(same\x20operators\x20as\x20data\x20filter)',a24_0x15e113(0x1d8),'\x20\x20\x20\x20having\x20\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Post-aggregation\x20filters,\x20e.g.\x20[{\x22columnName\x22:\x22total\x22,\x22condition\x22:{\x22$gt\x22:1000}}]',a24_0x15e113(0x1ed),'',a24_0x15e113(0x1dd),a24_0x15e113(0x1b7),'\x20\x20\x20\x20--params\x20\x27{\x22aggregate\x22:[{\x22column\x22:\x22amount\x22,\x22type\x22:\x22SUM\x22,\x22alias\x22:\x22total\x22}],\x22groupBy\x22:[\x22status\x22]}\x27','','\x20\x20\x20\x20#\x20Count\x20orders\x20per\x20region\x20with\x20filter',a24_0x15e113(0x1b8),'',a24_0x15e113(0x1e8)]['join']('\x0a')}];function makeDataCommand(_0x3b49d2){const _0x175881=a24_0x15e113,_0x20599f=_0x175881(0x1e9)+_0x3b49d2[_0x175881(0x1de)],_0x4b991b={'service':'data','command':_0x3b49d2[_0x175881(0x1de)],'description':_0x3b49d2['description'],'risk':_0x3b49d2[_0x175881(0x201)],'helpExtra':_0x3b49d2[_0x175881(0x1b9)],'flags':[CODE_FLAG,{...PARAMS_FLAG,'description':_0x3b49d2[_0x175881(0x1fe)]}],'validate':async _0x1c5a25=>{const _0x4c765f=_0x175881;_0x3b49d2[_0x4c765f(0x1d3)]&&requireAnyOf(_0x1c5a25,['params'],_0x20599f),_0x3b49d2['operation']===_0x4c765f(0x1e4)&&parseBatchCreateItemsFromParams(parseJsonParamsValue(_0x1c5a25['str'](_0x4c765f(0x1f5)))),_0x3b49d2[_0x4c765f(0x202)]===_0x4c765f(0x1e2)&&parseUpdateIdsFromParams(parseJsonParams(_0x1c5a25['str']('params'))??{});},async 'execute'(_0x3f004b){const _0x325603=_0x175881,_0x321acf=_0x3f004b[_0x325603(0x1e6)](_0x325603(0x1c0)),_0x5b1c13=_0x3b49d2[_0x325603(0x202)]===_0x325603(0x1e4)?parseBatchCreateItemsFromParams(parseJsonParamsValue(_0x3f004b[_0x325603(0x1e6)](_0x325603(0x1f5)))):parseJsonParams(_0x3f004b[_0x325603(0x1e6)](_0x325603(0x1f5)))??{},_0x50ce7d=_0x3b49d2[_0x325603(0x202)]===_0x325603(0x1e2)?parseUpdateIdsFromParams(_0x5b1c13):undefined,_0x119e21=_0x50ce7d?normalizeUpdateParamsForRuntime(_0x5b1c13,_0x50ce7d):_0x5b1c13,_0x3a140a=Date[_0x325603(0x204)](),_0x4d480d=await executeData(_0x321acf,_0x3b49d2[_0x325603(0x202)],_0x119e21),_0x35fa7b=Date[_0x325603(0x204)]()-_0x3a140a,_0x152446=_0x50ce7d&&_0x50ce7d[_0x325603(0x1ce)]>0x1?buildBatchUpdateResult(_0x50ce7d,_0x4d480d):_0x4d480d;return{'ok':!![],'data':{'result':_0x152446,'elapsed':_0x35fa7b},'message':_0x325603(0x1e9)+_0x3b49d2[_0x325603(0x1de)]+_0x325603(0x1f0)+_0x35fa7b+'ms'};}};return _0x3b49d2['risk']!==_0x175881(0x1ea)&&(_0x4b991b['dryRun']=async _0x4bfb63=>{const _0x353ca7=_0x175881,_0x131192=_0x4bfb63[_0x353ca7(0x1e6)]('code'),_0x2ff36d=_0x3b49d2[_0x353ca7(0x202)]===_0x353ca7(0x1e4)?parseBatchCreateItemsFromParams(parseJsonParamsValue(_0x4bfb63[_0x353ca7(0x1e6)](_0x353ca7(0x1f5)))):parseJsonParams(_0x4bfb63[_0x353ca7(0x1e6)](_0x353ca7(0x1f5)))??{};let _0x481673=_0x2ff36d;if(_0x3b49d2[_0x353ca7(0x202)]===_0x353ca7(0x1e2)){const _0x153a53=parseUpdateIdsFromParams(_0x2ff36d);_0x481673=normalizeUpdateParamsForRuntime(_0x2ff36d,_0x153a53);}return dryRun(_0x353ca7(0x1e5),_0x353ca7(0x1cd)+_0x131192+'/'+_0x3b49d2[_0x353ca7(0x202)])[_0x353ca7(0x1f4)](_0x481673)[_0x353ca7(0x1b6)](_0x353ca7(0x1b0)+_0x3b49d2['command']+_0x353ca7(0x1bb)+_0x131192)[_0x353ca7(0x1fd)]();}),_0x4b991b;}export const dataDefinitions=specs[a24_0x15e113(0x1c2)](makeDataCommand);function buildBatchUpdateResult(_0x1ccaf8,_0x38cce8){const _0x4eb087=a24_0x15e113;return{'operation':_0x4eb087(0x1e2),'mode':_0x4eb087(0x20a),'ids':_0x1ccaf8,'total':_0x1ccaf8[_0x4eb087(0x1ce)],'result':_0x38cce8};}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `dataset detail` command — inspects a dataset's fields, relations, and operations.
|
|
3
|
+
*
|
|
4
|
+
* Why normalization functions: the Lovrabet API returns inconsistent shapes
|
|
5
|
+
* across dataset versions (v1 vs v2) and between different API versions.
|
|
6
|
+
* Normalizing here gives callers a stable, documented output shape regardless
|
|
7
|
+
* of which API version responded.
|
|
8
|
+
*
|
|
9
|
+
* Key normalizations performed:
|
|
10
|
+
* - `normalizeField`: v1 stores fields in `data.properties` with `extend` JSON;
|
|
11
|
+
* v2 stores them in `data.fields` with direct properties. This function
|
|
12
|
+
* abstracts the version difference.
|
|
13
|
+
* - `normalizeOperationEntry`: API returns operation configs with nested
|
|
14
|
+
* JSON strings for `requestBody`/`responseBody`. This function parses them.
|
|
15
|
+
* - `summarizeDbtable`: picks a curated subset of db fields for display.
|
|
16
|
+
*
|
|
17
|
+
* Why `stats` is included in the output: callers (e.g. automated tests)
|
|
18
|
+
* benefit from knowing how many fields and operations a dataset has without
|
|
19
|
+
* having to count them from the arrays themselves.
|
|
20
|
+
*
|
|
21
|
+
* Design decision: `extendParsed` is included when present (v1 datasets store
|
|
22
|
+
* arbitrary metadata in `detail.extend`). This preserves debug information
|
|
23
|
+
* without cluttering the default output for v2 datasets.
|
|
24
|
+
*/
|
|
25
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
26
|
+
export declare const datasetDetail: CommandDefinition;
|