@lovrabet/lovrabet-cli 2.1.17 → 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 -0
- 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
|
-
const a22_0x58b37f=a22_0x2f93;(function(_0x261325,_0x393174){const _0x2075c1=a22_0x2f93,_0x15bd6a=_0x261325();while(!![]){try{const _0x17f481=parseInt(_0x2075c1(0x1c8))/0x1+-parseInt(_0x2075c1(0x1a5))/0x2+parseInt(_0x2075c1(0x1b4))/0x3*(parseInt(_0x2075c1(0x1c0))/0x4)+-parseInt(_0x2075c1(0x1b3))/0x5+-parseInt(_0x2075c1(0x1b1))/0x6+parseInt(_0x2075c1(0x1c9))/0x7*(-parseInt(_0x2075c1(0x1d3))/0x8)+parseInt(_0x2075c1(0x194))/0x9;if(_0x17f481===_0x393174)break;else _0x15bd6a['push'](_0x15bd6a['shift']());}catch(_0x289bf8){_0x15bd6a['push'](_0x15bd6a['shift']());}}}(a22_0x4909,0xb34ba));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_0x58b37f(0x18e),'type':a22_0x58b37f(0x197),'description':a22_0x58b37f(0x192),'default':![]};function a22_0x2f93(_0x1c51b2,_0x5a4fba){_0x1c51b2=_0x1c51b2-0x18d;const _0x49098d=a22_0x4909();let _0x2f93d9=_0x49098d[_0x1c51b2];return _0x2f93d9;}function a22_0x4909(){const _0xd4ced0=['args','config','Missing\x20key\x20argument.','1208350RTJaRr','21yNMgMS','../../context.js','Config\x20files:\x0a','Set\x20a\x20config\x20value','pageSize','raw','#\x20Effective\x20config\x20(merged\x20global\x20+\x20project)\x0a\x0a','(none)','\x22riskLevel\x22\x20cannot\x20be\x20changed\x20via\x20the\x20CLI.','isArray','3642456UMSfSr','set','global','\x20config\x20get\x20<key>','\x20config\x20set\x20<key>\x20<value>\x20[--global]','\x22\x20not\x20found\x20at\x20top\x20level.','Write\x20to\x20global\x20config','Invalid\x20value\x20for\x20\x22','20961612hFlYpG','Usage:\x20','Set\x20`','boolean','value','pretty','riskLevel','List\x20current\x20config','Value\x20to\x20assign','Deleted\x20`','Missing\x20key\x20or\x20value.','pageSize\x20must\x20be\x20a\x20positive\x20number','log','join','Key\x20not\x20found:\x20','trim','get','1659626UjJMzr','\x22\x20is\x20not\x20settable.','key','appcode','project-or-global-explicit','Config\x20key\x20(supports\x20dot\x20notation\x20for\x20reads\x20only)','alias','Delete\x20a\x20config\x20value','list','object','\x20config\x20delete\x20<key>\x20[--global]','stringify','4362294QPujGt','Get\x20a\x20config\x20value','455425qWnSVS','316266KTAwHp','Settable\x20keys:\x20','\x22.\x20Allowed:\x20','apps','Top-level\x20key\x20\x22','Key\x20\x22','delete','field','split','read','format','\x20(global)','8xOpcmv','validation','write','includes','length'];a22_0x4909=function(){return _0xd4ced0;};return a22_0x4909();}function parseAliasAppcodeSetKey(_0x5e7c66){const _0x399d41=a22_0x58b37f,_0x40990c=_0x5e7c66[_0x399d41(0x1bc)]('.');if(_0x40990c[_0x399d41(0x1c4)]!==0x3||_0x40990c[0x0]!=='apps'||_0x40990c[0x2]!=='appcode')return undefined;const _0x23e57e=_0x40990c[0x1]?.[_0x399d41(0x1a3)]();return _0x23e57e?_0x23e57e:undefined;}function parseAliasDeleteKey(_0x2fa367){const _0x5f10f7=a22_0x58b37f,_0x9265db=_0x2fa367['split']('.');if(_0x9265db[_0x5f10f7(0x1c4)]===0x2&&_0x9265db[0x0]===_0x5f10f7(0x1b7)){const _0x1b7f93=_0x9265db[0x1]?.[_0x5f10f7(0x1a3)]();return _0x1b7f93?{'alias':_0x1b7f93}:undefined;}if(_0x9265db[_0x5f10f7(0x1c4)]===0x3&&_0x9265db[0x0]===_0x5f10f7(0x1b7)&&_0x9265db[0x2]==='appcode'){const _0x16b698=_0x9265db[0x1]?.['trim']();return _0x16b698?{'alias':_0x16b698,'field':'appcode'}:undefined;}return undefined;}function setLocalAppAlias(_0x2b62a5,_0x208732,_0x265f3b){const _0x126505=a22_0x58b37f,_0x58c528=_0x2b62a5[_0x126505(0x1b7)]&&typeof _0x2b62a5['apps']===_0x126505(0x1ae)&&!Array[_0x126505(0x1d2)](_0x2b62a5[_0x126505(0x1b7)])?_0x2b62a5[_0x126505(0x1b7)]:{},_0x51dff1=_0x58c528[_0x208732]&&typeof _0x58c528[_0x208732]===_0x126505(0x1ae)&&!Array['isArray'](_0x58c528[_0x208732])?_0x58c528[_0x208732]:{};_0x51dff1[_0x126505(0x1a8)]=_0x265f3b,_0x58c528[_0x208732]=_0x51dff1,_0x2b62a5[_0x126505(0x1b7)]=_0x58c528;}function deleteLocalAppAlias(_0x25be30,_0x5dc46d){const _0x38eb05=a22_0x58b37f;if(!_0x25be30[_0x38eb05(0x1b7)]||typeof _0x25be30[_0x38eb05(0x1b7)]!==_0x38eb05(0x1ae)||Array[_0x38eb05(0x1d2)](_0x25be30[_0x38eb05(0x1b7)]))return![];const _0x3fa2ec=_0x25be30[_0x38eb05(0x1b7)],_0x28deb6=_0x3fa2ec[_0x5dc46d[_0x38eb05(0x1ab)]];if(!_0x28deb6||typeof _0x28deb6!==_0x38eb05(0x1ae)||Array['isArray'](_0x28deb6))return![];if(!_0x5dc46d[_0x38eb05(0x1bb)])return delete _0x3fa2ec[_0x5dc46d[_0x38eb05(0x1ab)]],!![];if(!(_0x5dc46d[_0x38eb05(0x1bb)]in _0x28deb6))return![];return delete _0x28deb6[_0x5dc46d[_0x38eb05(0x1bb)]],Object['keys'](_0x28deb6)[_0x38eb05(0x1c4)]===0x0&&delete _0x3fa2ec[_0x5dc46d[_0x38eb05(0x1ab)]],!![];}const listDef={'service':a22_0x58b37f(0x1c6),'command':a22_0x58b37f(0x1ad),'description':a22_0x58b37f(0x19b),'risk':a22_0x58b37f(0x1bd),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'flags':[],async 'execute'(_0x5e24e2){const _0x1e7fd2=a22_0x58b37f,{buildConfigFromFlags:_0x5b4155}=await import(_0x1e7fd2(0x1ca)),_0xaa1a05=_0x5b4155({}),_0x1b4ade=getProjectConfigPath(),_0x1459f8=resolveWriteConfigPath('global');if(_0x5e24e2[_0x1e7fd2(0x1be)]===_0x1e7fd2(0x199))return{'ok':!![],'message':_0x1e7fd2(0x1cf)+(JSON['stringify'](_0xaa1a05[_0x1e7fd2(0x1ce)],null,0x2)+'\x0a\x0a')+_0x1e7fd2(0x1cb)+('\x20\x20project:\x20'+(_0x1b4ade??_0x1e7fd2(0x1d0))+'\x0a')+('\x20\x20global:\x20\x20'+_0x1459f8)};return{'ok':!![],'data':{'effective':_0xaa1a05[_0x1e7fd2(0x1ce)],'configFiles':{'project':_0x1b4ade??null,'global':_0x1459f8}}};}},getDef={'service':a22_0x58b37f(0x1c6),'command':a22_0x58b37f(0x1a4),'description':a22_0x58b37f(0x1b2),'risk':a22_0x58b37f(0x1bd),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a22_0x58b37f(0x1a7),'description':a22_0x58b37f(0x1aa),'required':!![]}],'flags':[],async 'execute'(_0x3cdfe3){const _0x935b42=a22_0x58b37f,_0x581b4b=_0x3cdfe3['args'][0x0];if(!_0x581b4b)throw CliErrors['validation']('Missing\x20key\x20argument.',_0x935b42(0x195)+CLI_BIN_NAME+_0x935b42(0x18f));const {buildConfigFromFlags:_0x11980d}=await import('../../context.js'),{raw:_0x34e634}=_0x11980d({});if(_0x581b4b['includes']('.')){const _0x493b74=_0x581b4b[_0x935b42(0x1bc)]('.');let _0x957ec6=_0x34e634;for(const _0x41f514 of _0x493b74){if(_0x957ec6==null||typeof _0x957ec6!==_0x935b42(0x1ae))throw CliErrors[_0x935b42(0x1c1)]('Key\x20not\x20found:\x20'+_0x581b4b);_0x957ec6=_0x957ec6[_0x41f514];}if(_0x957ec6===undefined)throw CliErrors['validation'](_0x935b42(0x1a2)+_0x581b4b);return console['log'](typeof _0x957ec6==='object'?JSON['stringify'](_0x957ec6,null,0x2):String(_0x957ec6)),{'ok':!![]};}const _0xb67180=_0x34e634[_0x581b4b];if(_0xb67180===undefined)throw CliErrors[_0x935b42(0x1c1)](_0x935b42(0x1a2)+_0x581b4b);return console[_0x935b42(0x1a0)](typeof _0xb67180===_0x935b42(0x1ae)?JSON[_0x935b42(0x1b0)](_0xb67180,null,0x2):String(_0xb67180)),{'ok':!![]};}},setDef={'service':a22_0x58b37f(0x1c6),'command':a22_0x58b37f(0x18d),'description':a22_0x58b37f(0x1cc),'risk':a22_0x58b37f(0x1c2),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a22_0x58b37f(0x1a7),'description':getConfigCommandKeyDescription(),'required':!![]},{'name':a22_0x58b37f(0x198),'description':a22_0x58b37f(0x19c),'required':!![]}],'flags':[GLOBAL_FLAG],async 'execute'(_0x506420){const _0xc74b01=a22_0x58b37f,_0x15de52=_0x506420[_0xc74b01(0x1c5)][0x0],_0x3e5f63=_0x506420[_0xc74b01(0x1c5)][0x1];if(!_0x15de52||_0x3e5f63===undefined)throw CliErrors[_0xc74b01(0x1c1)](_0xc74b01(0x19e),_0xc74b01(0x195)+CLI_BIN_NAME+_0xc74b01(0x190));if(ENUM_KEYS[_0x15de52]&&!ENUM_KEYS[_0x15de52][_0xc74b01(0x1c3)](_0x3e5f63))throw CliErrors['validation'](_0xc74b01(0x193)+_0x15de52+_0xc74b01(0x1b6)+ENUM_KEYS[_0x15de52][_0xc74b01(0x1a1)](',\x20'));if(_0x15de52===_0xc74b01(0x19a))throw CliErrors[_0xc74b01(0x1c1)](_0xc74b01(0x1d1));if(_0x15de52===_0xc74b01(0x1cd)){const _0x1fd453=Number(_0x3e5f63);if(isNaN(_0x1fd453)||_0x1fd453<=0x0)throw CliErrors['validation'](_0xc74b01(0x19f));}const _0x55baef=resolveWriteScope({'explicitGlobal':_0x506420['bool'](_0xc74b01(0x18e)),'policy':_0xc74b01(0x1a9)}),_0x574acb=toScopeFlags(_0x55baef),_0x4ad727=readScopedConfig(_0x574acb),_0x176cbc=parseAliasAppcodeSetKey(_0x15de52);if(!_0x176cbc&&!isTopLevelConfigKey(_0x15de52))throw CliErrors[_0xc74b01(0x1c1)](_0xc74b01(0x1b8)+_0x15de52+_0xc74b01(0x1a6),_0xc74b01(0x1b5)+getTopLevelConfigKeySummary()+';\x20apps.<alias>.appcode');return _0x176cbc?setLocalAppAlias(_0x4ad727,_0x176cbc,_0x3e5f63):_0x4ad727[_0x15de52]=_0x15de52===_0xc74b01(0x1cd)?Number(_0x3e5f63):_0x3e5f63,console['log'](_0xc74b01(0x196)+_0x15de52+'`\x20=\x20\x22'+_0x3e5f63+'\x22'+(_0x55baef===_0xc74b01(0x18e)?_0xc74b01(0x1bf):'')),writeScopedConfig(_0x4ad727,_0x574acb),{'ok':!![]};}},deleteDef={'service':'config','command':a22_0x58b37f(0x1ba),'description':a22_0x58b37f(0x1ac),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'key','description':getConfigCommandKeyDescription(),'required':!![]}],'flags':[GLOBAL_FLAG],async 'execute'(_0xd03c2e){const _0x4503fe=a22_0x58b37f,_0x48a966=_0xd03c2e[_0x4503fe(0x1c5)][0x0];if(!_0x48a966)throw CliErrors['validation'](_0x4503fe(0x1c7),_0x4503fe(0x195)+CLI_BIN_NAME+_0x4503fe(0x1af));const _0xbdb1be=resolveWriteScope({'explicitGlobal':_0xd03c2e['bool'](_0x4503fe(0x18e)),'policy':_0x4503fe(0x1a9)}),_0x361ae3=toScopeFlags(_0xbdb1be),_0x5ee602=readScopedConfig(_0x361ae3),_0x2ab5dc=parseAliasDeleteKey(_0x48a966);if(_0x2ab5dc){if(!deleteLocalAppAlias(_0x5ee602,_0x2ab5dc))throw CliErrors[_0x4503fe(0x1c1)](_0x4503fe(0x1a2)+_0x48a966);return console[_0x4503fe(0x1a0)](_0x4503fe(0x19d)+_0x48a966+'`'+(_0xbdb1be==='global'?_0x4503fe(0x1bf):'')),writeScopedConfig(_0x5ee602,_0x361ae3),{'ok':!![]};}if(_0x5ee602[_0x48a966]===undefined)throw CliErrors['validation'](_0x4503fe(0x1b9)+_0x48a966+_0x4503fe(0x191));return delete _0x5ee602[_0x48a966],console[_0x4503fe(0x1a0)](_0x4503fe(0x19d)+_0x48a966+'`'+(_0xbdb1be==='global'?_0x4503fe(0x1bf):'')),writeScopedConfig(_0x5ee602,_0x361ae3),{'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
|
-
|
|
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
|
-
function a24_0x5b07(_0x25272b,_0x184c2d){_0x25272b=_0x25272b-0xe6;const _0x8f433d=a24_0x8f43();let _0x5b07da=_0x8f433d[_0x25272b];return _0x5b07da;}function a24_0x8f43(){const _0x81570d=['1314090VuGbkG','Create\x20multiple\x20records\x20in\x20one\x20request\x20(SDK\x20batchCreate)','\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}}','13986uwWbNv','build','\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}','create','Create\x20a\x20new\x20record\x20in\x20a\x20dataset','aggregate','\x20\x20\x20\x20aggregate\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Aggregation\x20definitions\x20(see\x20AGGREGATE\x20TYPES\x20above)','\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]}}','659397UZpiKc','getOne','delete','10YZxckK','JSON\x20with\x20id\x20+\x20fields\x20to\x20update.\x20id\x20may\x20be\x20a\x20single\x20value\x20or\x20array.\x20','\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\x20orderBy\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Sort\x20order,\x20e.g.\x20[{\x22id\x22:\x22desc\x22},{\x22name\x22:\x22asc\x22}]','\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}}]}','\x20on\x20dataset\x20','Filter\x20dataset\x20records\x20with\x20query\x20conditions','1272PLCeqS','\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}','1123994WyYoWZ','\x20\x20PAGINATION','POST','batchCreate','\x20\x20PARAMS\x20STRUCTURE','join','\x20\x20AGGREGATE\x20TYPES','4nHtpfA','str','\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\x20orderBy\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Sort\x20order,\x20e.g.\x20[{\x22total\x22:\x22desc\x22}]','\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}}]','\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}','\x20\x20\x20\x20Wrong:\x20\x20\x20\x20--page-size\x2010\x20\x20(this\x20is\x20not\x20a\x20valid\x20flag)','JSON\x20body\x20for\x20aggregate\x20API.\x20Fields:\x20select,\x20aggregate,\x20where,\x20groupBy,\x20having,\x20orderBy.\x20','Get\x20a\x20single\x20record\x20by\x20ID','read','\x20\x20\x20\x20currentPage\x20\x20\x20Number\x20\x20\x20Page\x20number\x20(starts\x20from\x201)','dryRun','JSON\x20array\x20of\x20record\x20objects,\x20or\x20{\x22items\x22:[...]}.\x20Example:\x20\x27[{\x22name\x22:\x22a\x22},{\x22name\x22:\x22b\x22}]\x27','\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}','JSON\x20with\x20record\x20id.\x20Example:\x20\x27{\x22id\x22:123}\x27','\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}}','code','20176965yjTedQ','\x20completed\x20in\x20','\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}','operation','data\x20','batch','filter','\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\x20select\x20\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Fields\x20to\x20return,\x20e.g.\x20[\x22id\x22,\x22name\x22,\x22status\x22]','length','\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}}]}','description','\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}}','params','\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\x20where\x20\x20\x20\x20\x20\x20\x20\x20\x20Object\x20\x20\x20Pre-aggregation\x20filter\x20(same\x20operators\x20as\x20data\x20filter)','Delete\x20a\x20record\x20(requires\x20--yes\x20in\x20non-interactive)','\x20\x20JSON\x20BODY\x20FIELDS\x20(pass\x20inside\x20--params)','1448301oHFwdI','map','\x20\x20EXAMPLES','3308220NlkJTm','\x20\x20\x20\x20Correct:\x20\x20--params\x20\x27{\x22currentPage\x22:1,\x22pageSize\x22:10}\x27','update','high-risk-write','write','JSON\x20with\x20field\x20values.\x20Example:\x20\x27{\x22name\x22:\x22test\x22,\x22amount\x22:100}\x27','\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]','command','JSON\x20body\x20for\x20filter\x20API.\x20Fields:\x20where,\x20select,\x20orderBy,\x20currentPage,\x20pageSize.\x20','\x20\x20\x20\x20#\x20Sum\x20amount\x20grouped\x20by\x20status','\x20\x20\x20\x20#\x20Count\x20orders\x20per\x20region\x20with\x20filter','/api/{appCode}/','paramsHint'];a24_0x8f43=function(){return _0x81570d;};return a24_0x8f43();}const a24_0x2abd4d=a24_0x5b07;(function(_0x18587d,_0x547c04){const _0x4f63a6=a24_0x5b07,_0x3f0ce8=_0x18587d();while(!![]){try{const _0x17c8c7=-parseInt(_0x4f63a6(0x11d))/0x1+-parseInt(_0x4f63a6(0x129))/0x2+-parseInt(_0x4f63a6(0x101))/0x3*(-parseInt(_0x4f63a6(0x130))/0x4)+-parseInt(_0x4f63a6(0x111))/0x5+-parseInt(_0x4f63a6(0x104))/0x6+parseInt(_0x4f63a6(0x114))/0x7*(-parseInt(_0x4f63a6(0x127))/0x8)+-parseInt(_0x4f63a6(0xef))/0x9*(-parseInt(_0x4f63a6(0x120))/0xa);if(_0x17c8c7===_0x547c04)break;else _0x3f0ce8['push'](_0x3f0ce8['shift']());}catch(_0x5ad47e){_0x3f0ce8['push'](_0x3f0ce8['shift']());}}}(a24_0x8f43,0x5aabc));import{executeData}from'../../core/sdk-client.js';import{CODE_FLAG,PARAMS_FLAG}from'../../commands/common/flags.js';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_0x2abd4d(0xf5),'operation':a24_0x2abd4d(0xf5),'risk':a24_0x2abd4d(0xe7),'paramsRequired':![],'description':a24_0x2abd4d(0x126),'paramsHint':a24_0x2abd4d(0x10c)+'Example:\x20\x27{\x22where\x22:{\x22status\x22:{\x22$eq\x22:\x22active\x22}},\x22currentPage\x22:1,\x22pageSize\x22:20}\x27','helpExtra':['\x20\x20WHERE\x20OPERATORS','\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\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_0x2abd4d(0x11b),a24_0x2abd4d(0xf6),a24_0x2abd4d(0x132),'\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_0x2abd4d(0x11c),a24_0x2abd4d(0x113),a24_0x2abd4d(0xfb),a24_0x2abd4d(0xed),'','\x20\x20LOGICAL\x20COMBINATORS',a24_0x2abd4d(0xf9),a24_0x2abd4d(0x124),'',a24_0x2abd4d(0x100),'\x20\x20\x20\x20where\x20\x20\x20\x20\x20\x20\x20\x20\x20Object\x20\x20\x20Query\x20conditions\x20(see\x20operators\x20above)',a24_0x2abd4d(0xf7),a24_0x2abd4d(0x123),a24_0x2abd4d(0xe8),'\x20\x20\x20\x20pageSize\x20\x20\x20\x20\x20\x20Number\x20\x20\x20Records\x20per\x20page\x20(default:\x2020)','',a24_0x2abd4d(0x12a),'\x20\x20\x20\x20Pagination\x20is\x20controlled\x20via\x20JSON\x20in\x20--params.\x20Do\x20NOT\x20use\x20--page-size\x20as\x20a\x20CLI\x20flag.',a24_0x2abd4d(0x105),a24_0x2abd4d(0x136)]['join']('\x0a')},{'command':a24_0x2abd4d(0x11e),'operation':'getOne','risk':a24_0x2abd4d(0xe7),'paramsRequired':!![],'description':a24_0x2abd4d(0xe6),'paramsHint':'JSON\x20with\x20record\x20id.\x20Example:\x20\x27{\x22id\x22:123}\x27'},{'command':a24_0x2abd4d(0x117),'operation':'create','risk':a24_0x2abd4d(0x108),'paramsRequired':!![],'description':a24_0x2abd4d(0x118),'paramsHint':a24_0x2abd4d(0x109)},{'command':a24_0x2abd4d(0x12c),'operation':a24_0x2abd4d(0x12c),'risk':a24_0x2abd4d(0x108),'paramsRequired':!![],'description':a24_0x2abd4d(0x112),'paramsHint':a24_0x2abd4d(0xea)},{'command':'update','operation':a24_0x2abd4d(0x106),'risk':a24_0x2abd4d(0x108),'paramsRequired':!![],'description':'Update\x20an\x20existing\x20record','paramsHint':a24_0x2abd4d(0x121)+'Examples:\x20\x27{\x22id\x22:123,\x22status\x22:\x22completed\x22}\x27,\x20\x27{\x22id\x22:[1,2,3],\x22status\x22:\x22completed\x22}\x27'},{'command':a24_0x2abd4d(0x11f),'operation':a24_0x2abd4d(0x11f),'risk':a24_0x2abd4d(0x107),'paramsRequired':!![],'description':a24_0x2abd4d(0xff),'paramsHint':a24_0x2abd4d(0xec)},{'command':a24_0x2abd4d(0x119),'operation':a24_0x2abd4d(0x119),'risk':'read','paramsRequired':![],'description':'Aggregate\x20dataset\x20records\x20(group\x20by,\x20sum,\x20count,\x20avg,\x20etc.)','paramsHint':a24_0x2abd4d(0x137)+'Example:\x20\x27{\x22aggregate\x22:[{\x22column\x22:\x20\x22amount\x22,\x22type\x22:\x22SUM\x22,\x22alias\x22:\x22total\x22}],\x22groupBy\x22:[\x22status\x22]}\x27','helpExtra':[a24_0x2abd4d(0x12f),a24_0x2abd4d(0x116),a24_0x2abd4d(0xeb),'\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_0x2abd4d(0x135),a24_0x2abd4d(0x128),a24_0x2abd4d(0xfd),a24_0x2abd4d(0xf1),'',a24_0x2abd4d(0x12d),a24_0x2abd4d(0x10a),a24_0x2abd4d(0x11a),a24_0x2abd4d(0xfe),'\x20\x20\x20\x20groupBy\x20\x20\x20\x20\x20\x20\x20Array\x20\x20\x20\x20Grouping\x20fields,\x20e.g.\x20[\x22status\x22,\x22region\x22]',a24_0x2abd4d(0x134),a24_0x2abd4d(0x133),'',a24_0x2abd4d(0x103),a24_0x2abd4d(0x10d),'\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','',a24_0x2abd4d(0x10e),a24_0x2abd4d(0x122),'','\x20\x20\x20\x20#\x20`field`\x20is\x20accepted\x20as\x20a\x20deprecated\x20alias\x20for\x20`column`;\x20new\x20calls\x20should\x20use\x20`column`.'][a24_0x2abd4d(0x12e)]('\x0a')}];function makeDataCommand(_0x416a87){const _0x5061a1=a24_0x2abd4d,_0x136f63=_0x5061a1(0xf3)+_0x416a87[_0x5061a1(0x10b)],_0x48e4aa={'service':'data','command':_0x416a87[_0x5061a1(0x10b)],'description':_0x416a87[_0x5061a1(0xfa)],'risk':_0x416a87['risk'],'helpExtra':_0x416a87['helpExtra'],'flags':[CODE_FLAG,{...PARAMS_FLAG,'description':_0x416a87[_0x5061a1(0x110)]}],'validate':async _0x29b2dd=>{const _0x326e44=_0x5061a1;_0x416a87['paramsRequired']&&requireAnyOf(_0x29b2dd,[_0x326e44(0xfc)],_0x136f63),_0x416a87[_0x326e44(0xf2)]===_0x326e44(0x12c)&&parseBatchCreateItemsFromParams(parseJsonParamsValue(_0x29b2dd[_0x326e44(0x131)]('params'))),_0x416a87['operation']===_0x326e44(0x106)&&parseUpdateIdsFromParams(parseJsonParams(_0x29b2dd[_0x326e44(0x131)](_0x326e44(0xfc)))??{});},async 'execute'(_0x1f2400){const _0x1ccaf0=_0x5061a1,_0x271036=_0x1f2400[_0x1ccaf0(0x131)]('code'),_0x5d5823=_0x416a87['operation']==='batchCreate'?parseBatchCreateItemsFromParams(parseJsonParamsValue(_0x1f2400['str']('params'))):parseJsonParams(_0x1f2400[_0x1ccaf0(0x131)]('params'))??{},_0x3a334c=_0x416a87[_0x1ccaf0(0xf2)]==='update'?parseUpdateIdsFromParams(_0x5d5823):undefined,_0xf77a3c=_0x3a334c?normalizeUpdateParamsForRuntime(_0x5d5823,_0x3a334c):_0x5d5823,_0x459f22=Date['now'](),_0x19bf26=await executeData(_0x271036,_0x416a87[_0x1ccaf0(0xf2)],_0xf77a3c),_0xdd90f3=Date['now']()-_0x459f22,_0x9bcfcb=_0x3a334c&&_0x3a334c[_0x1ccaf0(0xf8)]>0x1?buildBatchUpdateResult(_0x3a334c,_0x19bf26):_0x19bf26;return{'ok':!![],'data':{'result':_0x9bcfcb,'elapsed':_0xdd90f3},'message':_0x1ccaf0(0xf3)+_0x416a87['command']+_0x1ccaf0(0xf0)+_0xdd90f3+'ms'};}};return _0x416a87['risk']!==_0x5061a1(0xe7)&&(_0x48e4aa[_0x5061a1(0xe9)]=async _0x4c7616=>{const _0x41e15a=_0x5061a1,_0x29d59d=_0x4c7616['str'](_0x41e15a(0xee)),_0x367aa4=_0x416a87[_0x41e15a(0xf2)]===_0x41e15a(0x12c)?parseBatchCreateItemsFromParams(parseJsonParamsValue(_0x4c7616[_0x41e15a(0x131)]('params'))):parseJsonParams(_0x4c7616[_0x41e15a(0x131)](_0x41e15a(0xfc)))??{};let _0x155571=_0x367aa4;if(_0x416a87[_0x41e15a(0xf2)]==='update'){const _0x1e4b89=parseUpdateIdsFromParams(_0x367aa4);_0x155571=normalizeUpdateParamsForRuntime(_0x367aa4,_0x1e4b89);}return dryRun(_0x41e15a(0x12b),_0x41e15a(0x10f)+_0x29d59d+'/'+_0x416a87[_0x41e15a(0xf2)])['body'](_0x155571)[_0x41e15a(0xfa)]('Preview:\x20data\x20'+_0x416a87[_0x41e15a(0x10b)]+_0x41e15a(0x125)+_0x29d59d)[_0x41e15a(0x115)]();}),_0x48e4aa;}export const dataDefinitions=specs[a24_0x2abd4d(0x102)](makeDataCommand);function buildBatchUpdateResult(_0x486f14,_0x5c6f5f){const _0xaeb19c=a24_0x2abd4d;return{'operation':_0xaeb19c(0x106),'mode':_0xaeb19c(0xf4),'ids':_0x486f14,'total':_0x486f14[_0xaeb19c(0xf8)],'result':_0x5c6f5f};}
|
|
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;
|