@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
package/lib/cli.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview CLI entry point — parses input and dispatches to the framework runner.
|
|
4
|
+
*
|
|
5
|
+
* Why a top-level IIFE is avoided: `async function main()` is called via
|
|
6
|
+
* `void main().catch(handleError)`. This pattern is equivalent to a top-level
|
|
7
|
+
* `await` but avoids Node's "unhandled promise rejection in top-level await"
|
|
8
|
+
* behavior when the process is long-lived (interactive prompts).
|
|
9
|
+
*
|
|
10
|
+
* Why `isUserCancellation` checks `ExitPromptError` by name (not import):
|
|
11
|
+
* `@inquirer/prompts` throws `ExitPromptError` during Ctrl+C. Checking by
|
|
12
|
+
* `err.name` avoids a hard import-time dependency on the inquirer package
|
|
13
|
+
* version in this file. The error boundary handles it generically.
|
|
14
|
+
*
|
|
15
|
+
* PreParse phase: `correctFlags` is called before command dispatch to fix
|
|
16
|
+
* common AI-agent input mistakes (kebab-case flags, sticky values like
|
|
17
|
+
* `--limit100`). Corrections are printed to stderr so they don't pollute
|
|
18
|
+
* structured output. PreParse failures are silent (best-effort).
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export {};
|
package/lib/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
const a0_0xab09be=a0_0x2994;(function(_0x241183,_0x183356){const _0x1c0f47=a0_0x2994,_0x11a668=_0x241183();while(!![]){try{const _0xb71adc=-parseInt(_0x1c0f47(0x19f))/0x1*(parseInt(_0x1c0f47(0x1c9))/0x2)+parseInt(_0x1c0f47(0x1c5))/0x3+parseInt(_0x1c0f47(0x1ad))/0x4*(-parseInt(_0x1c0f47(0x1a2))/0x5)+parseInt(_0x1c0f47(0x1c8))/0x6+parseInt(_0x1c0f47(0x1c3))/0x7*(parseInt(_0x1c0f47(0x1b1))/0x8)+parseInt(_0x1c0f47(0x1b4))/0x9*(-parseInt(_0x1c0f47(0x1a1))/0xa)+parseInt(_0x1c0f47(0x1b6))/0xb*(parseInt(_0x1c0f47(0x1a9))/0xc);if(_0xb71adc===_0x183356)break;else _0x11a668['push'](_0x11a668['shift']());}catch(_0x4a4b68){_0x11a668['push'](_0x11a668['shift']());}}}(a0_0x2e52,0xf0b90));import{jsx as a0_0x205829}from'react/jsx-runtime';import a0_0x5dc169 from'meow';import{render}from'ink';function a0_0x2994(_0x2ae71d,_0x295353){_0x2ae71d=_0x2ae71d-0x19e;const _0x2e52a9=a0_0x2e52();let _0x29945c=_0x2e52a9[_0x2ae71d];return _0x29945c;}import{Help}from'./help.js';function a0_0x2e52(){const _0x47338a=['catch',':\x20--','exit','name','70973dDuUoA','ERR_USE_AFTER_CLOSE','3248877BQMWLH','./framework/preparse.js','stderr','7556556MsCaCQ','18262tuVNKb','error','code','117lIDQyh','handler','1820210gcLrAx','10frtKYF','input','\x0aCancelled.\x0a','flatMap','cancelled','slice','definition','20511936qPemhl','help','exitCode','Error:\x20','3894344LeDQOu','Hint:\x20','length','ERR_STREAM_DESTROYED','104gMmbxZ','args','message','9Azowmv','ExitPromptError','11FCTvZX','defaultCommand','[preparse]\x20','log','original','assign','write','hint','flags'];a0_0x2e52=function(){return _0x47338a;};return a0_0x2e52();}import{CliError,CliErrors}from'./errors.js';import{buildConfigFromFlags,initGlobalEnvironment}from'./context.js';import{isKnownService,getServiceEntry,findDefinition,getAllDefinitions}from'./commands/registry.js';import{generateDynamicServiceHelp,resolveDynamicServiceCommand}from'./commands/service/dynamic.js';import{runCommand,createPipelineEnv}from'./framework/runner.js';import{generateCommandHelp,generateServiceHelp,generateFullHelp}from'./framework/help.js';import{buildMeowFlags}from'./constant/cli.js';import{getCliVersionDisplay}from'./utils/version.js';const helpText=generateFullHelp(),cli=a0_0x5dc169(helpText,{'importMeta':import.meta,'flags':buildMeowFlags(),'version':getCliVersionDisplay()});void main()[a0_0xab09be(0x1bf)](handleError);async function main(){try{await run();}catch(_0x299d13){handleError(_0x299d13);}}async function run(){const _0x111f51=a0_0xab09be;let _0x228a8f=cli[_0x111f51(0x1a3)][0x0],_0x47cfb0=cli['input'][0x1];const _0x3d070a=cli[_0x111f51(0x1be)];try{const {correctFlags:_0x1812b5}=await import(_0x111f51(0x1c6)),_0x353e60=getAllDefinitions()[_0x111f51(0x1a5)](_0x240e0b=>_0x240e0b['flags']??[]),{flags:_0x9b0fd8,corrections:_0x188a11}=_0x1812b5(_0x3d070a,_0x353e60);if(_0x188a11[_0x111f51(0x1af)]>0x0){for(const _0x5851be of _0x188a11){process[_0x111f51(0x1c7)]['write'](_0x111f51(0x1b8)+_0x5851be[_0x111f51(0x1a0)]+_0x111f51(0x1c0)+_0x5851be[_0x111f51(0x1ba)]+'\x20->\x20--'+_0x5851be['corrected']+'\x0a');}Object[_0x111f51(0x1bb)](_0x3d070a,_0x9b0fd8);}}catch{}if(!_0x228a8f){const {waitUntilExit:_0x1aa05a}=render(a0_0x205829(Help,{}));await _0x1aa05a();return;}if(!isKnownService(_0x228a8f)){const _0x589a7c=resolveDynamicServiceCommand(cli[_0x111f51(0x1a3)],_0x3d070a);if(_0x589a7c){if(_0x3d070a[_0x111f51(0x1aa)]){console[_0x111f51(0x1b9)](generateCommandHelp(_0x589a7c[_0x111f51(0x1a8)]));return;}Object[_0x111f51(0x1bb)](_0x3d070a,_0x589a7c['flags']);const _0x306923=buildConfigFromFlags(_0x3d070a);await initGlobalEnvironment(_0x306923);const _0x5c71e4=createPipelineEnv(_0x306923,_0x3d070a);_0x5c71e4[_0x111f51(0x1b2)]=_0x589a7c[_0x111f51(0x1b2)],await runCommand(_0x589a7c[_0x111f51(0x1a8)],_0x5c71e4);return;}if(_0x3d070a[_0x111f51(0x1aa)]){const _0x35603c=generateDynamicServiceHelp(_0x228a8f);if(_0x35603c){console[_0x111f51(0x1b9)](_0x35603c);return;}}const {waitUntilExit:_0x4b7794}=render(a0_0x205829(Help,{}));await _0x4b7794();return;}const _0x4701ba=getServiceEntry(_0x228a8f);if(!_0x47cfb0){if(_0x3d070a['help']){console[_0x111f51(0x1b9)](generateServiceHelp(_0x228a8f));return;}if(_0x4701ba[_0x111f51(0x1b7)])_0x47cfb0=_0x4701ba[_0x111f51(0x1b7)];else{console[_0x111f51(0x1b9)](generateServiceHelp(_0x228a8f));return;}}const _0x314876=findDefinition(_0x228a8f,_0x47cfb0);!_0x314876&&(console['log'](generateServiceHelp(_0x228a8f)),handleError(CliErrors['unknownCommand'](_0x228a8f+'\x20'+_0x47cfb0)));if(_0x3d070a[_0x111f51(0x1aa)]){console['log'](generateCommandHelp(_0x314876));return;}const _0x11fe69=buildConfigFromFlags(_0x3d070a);await initGlobalEnvironment(_0x11fe69);const _0x525c85=createPipelineEnv(_0x11fe69,_0x3d070a);_0x525c85[_0x111f51(0x1b2)]=cli[_0x111f51(0x1a3)][_0x111f51(0x1a7)](0x2),await runCommand(_0x314876,_0x525c85);}function handleError(_0xf55a68){const _0x32a7dd=a0_0xab09be;if(_0xf55a68 instanceof CliError){_0xf55a68[_0x32a7dd(0x19e)]===_0x32a7dd(0x1a6)&&(process[_0x32a7dd(0x1c7)][_0x32a7dd(0x1bc)](_0x32a7dd(0x1a4)),process[_0x32a7dd(0x1c1)](0x0));console[_0x32a7dd(0x1ca)](_0x32a7dd(0x1ac)+_0xf55a68[_0x32a7dd(0x1b3)]);if(_0xf55a68['hint'])console[_0x32a7dd(0x1ca)](_0x32a7dd(0x1ae)+_0xf55a68[_0x32a7dd(0x1bd)]);process['exit'](_0xf55a68[_0x32a7dd(0x1ab)]);}isUserCancellation(_0xf55a68)&&(process['stderr'][_0x32a7dd(0x1bc)]('\x0aCancelled.\x0a'),process[_0x32a7dd(0x1c1)](0x0)),console[_0x32a7dd(0x1ca)]('Unexpected\x20error:',_0xf55a68),process[_0x32a7dd(0x1c1)](0x1);}function isUserCancellation(_0xd5dff){const _0x4cc0ad=a0_0xab09be;if(!(_0xd5dff instanceof Error))return![];if(_0xd5dff[_0x4cc0ad(0x1c2)]===_0x4cc0ad(0x1b5))return!![];if(_0xd5dff[_0x4cc0ad(0x19e)]===_0x4cc0ad(0x1c4))return!![];if(_0xd5dff[_0x4cc0ad(0x19e)]===_0x4cc0ad(0x1b0))return!![];return![];}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `api-doc` command group — stable runtime API discovery docs.
|
|
3
|
+
*
|
|
4
|
+
* Ownership note: this is a compact CLI mirror of RuntimeAgent's
|
|
5
|
+
* capability-owned `src/runtime-agent/api-doc` registry. Keep the command
|
|
6
|
+
* surface typed and read-only; do not add a generic fetch command here.
|
|
7
|
+
*/
|
|
8
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
9
|
+
export interface RuntimeApiDocEntry {
|
|
10
|
+
code: string;
|
|
11
|
+
category: string;
|
|
12
|
+
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
13
|
+
path: string;
|
|
14
|
+
summary: string;
|
|
15
|
+
whenToUse: string;
|
|
16
|
+
}
|
|
17
|
+
export interface RuntimeApiDocDetail extends RuntimeApiDocEntry {
|
|
18
|
+
title: string;
|
|
19
|
+
pathParams: Array<{
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
}>;
|
|
23
|
+
queryParams: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
}>;
|
|
27
|
+
bodySchema: string;
|
|
28
|
+
responseHighlights: string[];
|
|
29
|
+
examples: string[];
|
|
30
|
+
notes: string[];
|
|
31
|
+
markdown: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function listApiDocEntries(filters?: {
|
|
34
|
+
category?: string;
|
|
35
|
+
keyword?: string;
|
|
36
|
+
}): RuntimeApiDocEntry[];
|
|
37
|
+
export declare function getApiDocDetail(code: string): RuntimeApiDocDetail;
|
|
38
|
+
export declare const apiDocDefinitions: CommandDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a1_0x238d(){const _0x516b86=['Returns\x20SQL\x20execution\x20payload','Get\x20one\x20dataset\x20record','Show\x20runtime\x20API\x20documentation\x20by\x20code','需要按数据集\x20code\x20获取字段、表信息、关联关系(relations)或操作定义时使用','map','获取数据集详情','{\x22aggregate\x22:[{\x22column\x22:\x20\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22}],\x22groupBy\x22:[]}','##\x20Dataset\x20detail','##\x20List\x20datasets','3493030rJsNvX','按应用和函数名精确获取\x20BF\x20运行契约','fields/properties\x20describe\x20data\x20shape','创建数据','method','functionName','summary','查询单条数据','string','{\x22appCode\x22:\x22app-aa63b188\x22,\x22currentPage\x22:1,\x22pageSize\x22:100}','需要向指定数据集新增一条业务数据时使用','result\x20rows\x20contain\x20aggregate\x20aliases','POST','Use\x20read-only\x20data\x20commands\x20before\x20writing\x20Artifacts\x20that\x20display\x20real\x20data.','Use\x20`having`\x20only\x20for\x20post-aggregation\x20filters.','执行指定\x20BF\x20函数','join','需要按\x20groupBy\x20分组并做\x20count、sum、avg、max、min\x20等聚合统计时使用','Use\x20`lovrabet\x20sql\x20detail`\x20before\x20execution.','category','custom_sql','已经知道记录\x20id,需要按数据集读取单条业务数据时使用','{\x22where\x22:{},\x22currentPage\x22:1,\x22pageSize\x22:20}','keyword','/api/{appCode}/{datasetCode}/create','Execute\x20BF\x20endpoint\x20function','whenToUse','datasetCode','Use\x20`where`,\x20`select`,\x20`orderBy`,\x20`currentPage`,\x20and\x20`pageSize`\x20to\x20inspect\x20live\x20data\x20shape.','Returns\x20the\x20created\x20record\x20or\x20backend\x20operation\x20result','dataset','dataset_data_filter','appCode','##\x20Execute\x20BF\x20endpoint\x20function\x0a\x0aExecute\x20a\x20known\x20endpoint\x20script.','/api/{appCode}/{datasetCode}/aggregate','CLI\x20returns\x20appCode/functionName/description/version/gmtModified','lovrabet\x20data\x20getOne\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22id\x22:123}\x27','code','lovrabet\x20data\x20filter\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22currentPage\x22:1,\x22pageSize\x22:5}\x27','trim','Inspect\x20field\x20names,\x20relations,\x20and\x20operation\x20metadata\x20for\x20a\x20known\x20dataset\x20code.','Aggregate\x20supports\x20COUNT,\x20SUM,\x20AVG,\x20MAX,\x20and\x20MIN\x20definitions\x20in\x20the\x20`aggregate`\x20array.','18KRRkdC','8VUxWED','List\x20available\x20runtime\x20API\x20documentation\x20entries','18246016bqHEfH','operations\x20describes\x20runtime\x20APIs','paging\x20contains\x20pagination','dataset_data_create','2459730zGhPLc','where\x20filters\x20before\x20aggregation','filter','##\x20Get\x20BF\x20endpoint\x20function\x20contract\x0a\x0aInspect\x20one\x20known\x20endpoint\x20function\x20through\x20the\x20AK-authenticated\x20exact\x20detail\x20API.','title','Get\x20BF\x20endpoint\x20function\x20contract','None','GET','CLI\x20users\x20should\x20prefer\x20`lovrabet\x20dataset\x20list`\x20for\x20this\x20workflow.','##\x20Get\x20one\x20dataset\x20record\x0a\x0aRead\x20one\x20record\x20by\x20id.','custom_sql_execute','Script\x20behavior\x20may\x20have\x20side\x20effects;\x20inspect\x20detail\x20first.','lovrabet\x20bff\x20exec\x20--name\x20<functionName>\x20--params\x20\x27{}\x27','需要携带\x20where、orderBy、分页等条件读取业务数据时使用','条件过滤查询数据','dataset_detail','/api/dataset/get-dataset-list-by-app-code','已经确认目标\x20sqlCode\x20存在,并需要实际执行该自定义\x20SQL\x20时使用','/api/endpoint/{appCode}/{functionName}','32-character\x20dataset\x20code','已经从用户、平台\x20UI\x20或前序上下文确认函数名,需要查看该\x20ENDPOINT\x20的运行态元信息时使用','paging.totalCount\x20gives\x20total\x20rows','##\x20Execute\x20custom\x20SQL\x0a\x0aExecute\x20a\x20configured\x20SQL\x20script\x20by\x20sqlCode.','1306482pTyhTy','执行自定义\x20SQL','{\x22appCode\x22:\x22app-aa63b188\x22,\x22sqlCode\x22:\x22xxxxxxxx-xxxxxxxx\x22,\x22params\x22:{}}','1552916TMhLNx','/api/custom/executeSql','/api/{appCode}/{datasetCode}/filter','Search\x20docs\x20by\x20code,\x20summary,\x20path,\x20or\x20usage\x20text','Current\x20app\x20code','bf_execute','Returns\x20one\x20matching\x20business\x20record','##\x20Aggregate\x20dataset\x20data','Filter\x20docs\x20by\x20category,\x20for\x20example\x20dataset','/api/{appCode}/{datasetCode}/getOne','If\x20SDK\x20usage\x20is\x20needed,\x20follow\x20with\x20`lovrabet\x20dataset\x20sdk-doc\x20--code\x20<datasetCode>`.','2376136hNZXEk','length','API\x20doc\x20code,\x20for\x20example\x20dataset_list','List\x20datasets','dataset_list','toLowerCase','lovrabet\x20dataset\x20list\x20--appcode\x20<appCode>\x20--format\x20compress','Use\x20this\x20API\x20or\x20`lovrabet\x20dataset\x20list`\x20to\x20discover\x20available\x20dataset\x20codes\x20before\x20reading\x20data.','lovrabet\x20bff\x20detail\x20--name\x20<functionName>','api-doc','includes','Dataset\x20detail','dataset_data_get_one','Exact\x20endpoint\x20function\x20name','detail','Endpoint\x20function\x20name','Prefer\x20`filter`\x20when\x20the\x20record\x20id\x20is\x20unknown.','1277299wJRipZ','##\x20Filter\x20dataset\x20data','需要按\x20appCode\x20分页获取运行态数据集列表,并优先收敛可用\x20datasetCode\x20时使用','tableData\x20contains\x20records','{\x22param\x22:\x22value\x22}'];a1_0x238d=function(){return _0x516b86;};return a1_0x238d();}const a1_0x19bf7e=a1_0x108a;(function(_0x526f93,_0x4663b3){const _0x56920e=a1_0x108a,_0xbc0669=_0x526f93();while(!![]){try{const _0x3d3243=-parseInt(_0x56920e(0x97))/0x1+-parseInt(_0x56920e(0xf0))/0x2+-parseInt(_0x56920e(0xed))/0x3+parseInt(_0x56920e(0xd0))/0x4*(-parseInt(_0x56920e(0xa5))/0x5)+parseInt(_0x56920e(0xd6))/0x6+-parseInt(_0x56920e(0xfb))/0x7+parseInt(_0x56920e(0xd2))/0x8*(parseInt(_0x56920e(0xcf))/0x9);if(_0x3d3243===_0x4663b3)break;else _0xbc0669['push'](_0xbc0669['shift']());}catch(_0x426ae5){_0xbc0669['push'](_0xbc0669['shift']());}}}(a1_0x238d,0xb604c));import{CliErrors}from'../../errors.js';const CATEGORY_FLAG={'name':a1_0x19bf7e(0xb8),'type':'string','description':a1_0x19bf7e(0xf8)},KEYWORD_FLAG={'name':a1_0x19bf7e(0xbc),'type':a1_0x19bf7e(0xad),'description':a1_0x19bf7e(0xf3)},DOC_CODE_FLAG={'name':a1_0x19bf7e(0xca),'type':a1_0x19bf7e(0xad),'required':!![],'description':a1_0x19bf7e(0xfd)},DOCS=[{'code':a1_0x19bf7e(0x8a),'category':a1_0x19bf7e(0xc3),'title':a1_0x19bf7e(0x89),'method':a1_0x19bf7e(0xb1),'path':a1_0x19bf7e(0xe6),'summary':'分页获取数据集列表','whenToUse':a1_0x19bf7e(0x99),'pathParams':[],'queryParams':[],'bodySchema':a1_0x19bf7e(0xae),'responseHighlights':['tableData\x20contains\x20dataset\x20id/code/name',a1_0x19bf7e(0xeb)],'examples':[a1_0x19bf7e(0x8c)],'notes':[a1_0x19bf7e(0xde)],'markdown':[a1_0x19bf7e(0xa4),'',a1_0x19bf7e(0x8d)]['join']('\x0a')},{'code':a1_0x19bf7e(0xe5),'category':a1_0x19bf7e(0xc3),'title':a1_0x19bf7e(0x91),'method':a1_0x19bf7e(0xdd),'path':'/api/dataset/getOneByCode?code={datasetCode}','summary':a1_0x19bf7e(0xa1),'whenToUse':a1_0x19bf7e(0x9f),'pathParams':[],'queryParams':[{'name':a1_0x19bf7e(0xca),'description':a1_0x19bf7e(0xe9)}],'bodySchema':a1_0x19bf7e(0xdc),'responseHighlights':[a1_0x19bf7e(0xa7),'relations\x20contains\x20the\x20object-shaped\x20API\x20relations\x20value\x20when\x20returned',a1_0x19bf7e(0xd3)],'examples':['lovrabet\x20dataset\x20detail\x20--code\x20<datasetCode>\x20--appcode\x20<appCode>'],'notes':[a1_0x19bf7e(0xfa)],'markdown':[a1_0x19bf7e(0xa3),'',a1_0x19bf7e(0xcd)][a1_0x19bf7e(0xb5)]('\x0a')},{'code':a1_0x19bf7e(0xc4),'category':'dataset','title':'Filter\x20dataset\x20data','method':a1_0x19bf7e(0xb1),'path':a1_0x19bf7e(0xf2),'summary':a1_0x19bf7e(0xe4),'whenToUse':a1_0x19bf7e(0xe3),'pathParams':[{'name':'appCode','description':a1_0x19bf7e(0xf4)},{'name':'datasetCode','description':a1_0x19bf7e(0xe9)}],'queryParams':[],'bodySchema':a1_0x19bf7e(0xbb),'responseHighlights':[a1_0x19bf7e(0x9a),a1_0x19bf7e(0xd4)],'examples':[a1_0x19bf7e(0xcb)],'notes':[a1_0x19bf7e(0xb2)],'markdown':[a1_0x19bf7e(0x98),'',a1_0x19bf7e(0xc1)]['join']('\x0a')},{'code':'dataset_data_aggregate','category':a1_0x19bf7e(0xc3),'title':'Aggregate\x20dataset\x20data','method':'POST','path':a1_0x19bf7e(0xc7),'summary':'聚合查询数据集数据','whenToUse':a1_0x19bf7e(0xb6),'pathParams':[{'name':a1_0x19bf7e(0xc5),'description':'Current\x20app\x20code'},{'name':'datasetCode','description':a1_0x19bf7e(0xe9)}],'queryParams':[],'bodySchema':a1_0x19bf7e(0xa2),'responseHighlights':[a1_0x19bf7e(0xb0),a1_0x19bf7e(0xd7)],'examples':['lovrabet\x20data\x20aggregate\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22aggregate\x22:[{\x22column\x22:\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22}]}\x27'],'notes':[a1_0x19bf7e(0xb3),'`field`\x20is\x20accepted\x20as\x20a\x20deprecated\x20alias\x20for\x20`column`;\x20new\x20calls\x20should\x20use\x20`column`.'],'markdown':[a1_0x19bf7e(0xf7),'',a1_0x19bf7e(0xce)][a1_0x19bf7e(0xb5)]('\x0a')},{'code':a1_0x19bf7e(0x92),'category':'dataset','title':a1_0x19bf7e(0x9d),'method':a1_0x19bf7e(0xb1),'path':a1_0x19bf7e(0xf9),'summary':a1_0x19bf7e(0xac),'whenToUse':a1_0x19bf7e(0xba),'pathParams':[{'name':a1_0x19bf7e(0xc5),'description':a1_0x19bf7e(0xf4)},{'name':a1_0x19bf7e(0xc0),'description':'32-character\x20dataset\x20code'}],'queryParams':[],'bodySchema':'{\x22id\x22:123}','responseHighlights':[a1_0x19bf7e(0xf6)],'examples':[a1_0x19bf7e(0xc9)],'notes':[a1_0x19bf7e(0x96)],'markdown':a1_0x19bf7e(0xdf)},{'code':a1_0x19bf7e(0xd5),'category':'dataset','title':'Create\x20dataset\x20record','method':a1_0x19bf7e(0xb1),'path':a1_0x19bf7e(0xbd),'summary':a1_0x19bf7e(0xa8),'whenToUse':a1_0x19bf7e(0xaf),'pathParams':[{'name':a1_0x19bf7e(0xc5),'description':'Current\x20app\x20code'},{'name':'datasetCode','description':a1_0x19bf7e(0xe9)}],'queryParams':[],'bodySchema':'{\x22fieldName\x22:\x22value\x22}','responseHighlights':[a1_0x19bf7e(0xc2)],'examples':['lovrabet\x20data\x20create\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22name\x22:\x22demo\x22}\x27'],'notes':['This\x20is\x20a\x20write\x20operation;\x20use\x20dry-run\x20when\x20available\x20and\x20safe\x20fixtures\x20for\x20smoke\x20tests.'],'markdown':'##\x20Create\x20dataset\x20record\x0a\x0aCreate\x20one\x20data\x20record\x20in\x20a\x20dataset.'},{'code':'bf_detail','category':'bf','title':a1_0x19bf7e(0xdb),'method':a1_0x19bf7e(0xdd),'path':'/client/bff/endpoint/{appCode}/{functionName}','summary':a1_0x19bf7e(0xa6),'whenToUse':a1_0x19bf7e(0xea),'pathParams':[{'name':a1_0x19bf7e(0xc5),'description':a1_0x19bf7e(0xf4)},{'name':a1_0x19bf7e(0xaa),'description':a1_0x19bf7e(0x93)}],'queryParams':[],'bodySchema':a1_0x19bf7e(0xdc),'responseHighlights':[a1_0x19bf7e(0xc8)],'examples':[a1_0x19bf7e(0x8e)],'notes':['This\x20is\x20an\x20exact\x20lookup\x20by\x20appCode\x20+\x20functionName.\x20The\x20CLI\x20does\x20not\x20enumerate\x20BFF\x20functions\x20or\x20expose\x20platform-only\x20fields.'],'markdown':a1_0x19bf7e(0xd9)},{'code':a1_0x19bf7e(0xf5),'category':'bf','title':a1_0x19bf7e(0xbe),'method':a1_0x19bf7e(0xb1),'path':a1_0x19bf7e(0xe8),'summary':a1_0x19bf7e(0xb4),'whenToUse':'已经确认目标\x20BF\x20的\x20functionName,且需要实际调用该\x20ENDPOINT\x20函数完成业务操作时使用','pathParams':[{'name':a1_0x19bf7e(0xc5),'description':a1_0x19bf7e(0xf4)},{'name':'functionName','description':a1_0x19bf7e(0x95)}],'queryParams':[],'bodySchema':a1_0x19bf7e(0x9b),'responseHighlights':['Returns\x20script\x20business\x20payload'],'examples':[a1_0x19bf7e(0xe2)],'notes':[a1_0x19bf7e(0xe1)],'markdown':a1_0x19bf7e(0xc6)},{'code':a1_0x19bf7e(0xe0),'category':a1_0x19bf7e(0xb9),'title':'Execute\x20custom\x20SQL','method':a1_0x19bf7e(0xb1),'path':a1_0x19bf7e(0xf1),'summary':a1_0x19bf7e(0xee),'whenToUse':a1_0x19bf7e(0xe7),'pathParams':[],'queryParams':[],'bodySchema':a1_0x19bf7e(0xef),'responseHighlights':[a1_0x19bf7e(0x9c)],'examples':['lovrabet\x20sql\x20exec\x20--sqlcode\x20<sqlCode>\x20--params\x20\x27{}\x27'],'notes':[a1_0x19bf7e(0xb7)],'markdown':a1_0x19bf7e(0xec)}];function a1_0x108a(_0x575d73,_0x536836){_0x575d73=_0x575d73-0x89;const _0x238d21=a1_0x238d();let _0x108aaf=_0x238d21[_0x575d73];return _0x108aaf;}function entrySummary(_0x3e83a5){const _0x1fbcb7=a1_0x19bf7e;return{'code':_0x3e83a5[_0x1fbcb7(0xca)],'category':_0x3e83a5[_0x1fbcb7(0xb8)],'method':_0x3e83a5[_0x1fbcb7(0xa9)],'path':_0x3e83a5['path'],'summary':_0x3e83a5[_0x1fbcb7(0xab)],'whenToUse':_0x3e83a5[_0x1fbcb7(0xbf)]};}export function listApiDocEntries(_0x39c3cd={}){const _0x543d27=a1_0x19bf7e,_0x3137e9=String(_0x39c3cd[_0x543d27(0xb8)]||'')[_0x543d27(0xcc)](),_0x118544=String(_0x39c3cd['keyword']||'')[_0x543d27(0xcc)]()[_0x543d27(0x8b)]();return DOCS[_0x543d27(0xd8)](_0x167965=>{const _0x1a3046=_0x543d27;if(_0x3137e9&&_0x167965['category']!==_0x3137e9)return![];if(!_0x118544)return!![];return[_0x167965[_0x1a3046(0xca)],_0x167965[_0x1a3046(0xb8)],_0x167965[_0x1a3046(0xa9)],_0x167965['path'],_0x167965['summary'],_0x167965['whenToUse'],_0x167965[_0x1a3046(0xda)]]['join']('\x20')[_0x1a3046(0x8b)]()[_0x1a3046(0x90)](_0x118544);})[_0x543d27(0xa0)](entrySummary);}export function getApiDocDetail(_0x3712df){const _0x3acf91=a1_0x19bf7e,_0x513802=DOCS['find'](_0x5d5c6b=>_0x5d5c6b[_0x3acf91(0xca)]===_0x3712df);if(!_0x513802)throw CliErrors['validation']('API\x20doc\x20code\x20not\x20found:\x20'+_0x3712df);return{..._0x513802};}const apiDocList={'service':a1_0x19bf7e(0x8f),'command':'list','description':a1_0x19bf7e(0xd1),'risk':'read','requiresAppCode':![],'flags':[CATEGORY_FLAG,KEYWORD_FLAG],async 'execute'(_0x351e04){const _0xb5be88=a1_0x19bf7e,_0x3a8bf1=listApiDocEntries({'category':_0x351e04['str'](_0xb5be88(0xb8)),'keyword':_0x351e04['str']('keyword')});return{'ok':!![],'data':{'total':_0x3a8bf1[_0xb5be88(0xfc)],'items':_0x3a8bf1}};}},apiDocDetail={'service':a1_0x19bf7e(0x8f),'command':a1_0x19bf7e(0x94),'description':a1_0x19bf7e(0x9e),'risk':'read','requiresAppCode':![],'flags':[DOC_CODE_FLAG],async 'execute'(_0x2193eb){const _0x31a892=a1_0x19bf7e;return{'ok':!![],'data':getApiDocDetail(_0x2193eb['str'](_0x31a892(0xca)))};}};export const apiDocDefinitions=[apiDocList,apiDocDetail];
|
|
1
|
+
const a1_0x2e89bf=a1_0x9316;(function(_0x2c285a,_0x4ca34c){const _0x3e9450=a1_0x9316,_0x5bea37=_0x2c285a();while(!![]){try{const _0x4e9632=parseInt(_0x3e9450(0x226))/0x1*(-parseInt(_0x3e9450(0x20c))/0x2)+-parseInt(_0x3e9450(0x237))/0x3*(parseInt(_0x3e9450(0x23a))/0x4)+-parseInt(_0x3e9450(0x1e5))/0x5*(-parseInt(_0x3e9450(0x207))/0x6)+parseInt(_0x3e9450(0x218))/0x7*(-parseInt(_0x3e9450(0x215))/0x8)+-parseInt(_0x3e9450(0x202))/0x9*(parseInt(_0x3e9450(0x23e))/0xa)+-parseInt(_0x3e9450(0x1df))/0xb+-parseInt(_0x3e9450(0x1e7))/0xc*(-parseInt(_0x3e9450(0x1f2))/0xd);if(_0x4e9632===_0x4ca34c)break;else _0x5bea37['push'](_0x5bea37['shift']());}catch(_0x2d0d8b){_0x5bea37['push'](_0x5bea37['shift']());}}}(a1_0x36de,0x4448c));function a1_0x36de(){const _0x2f4592=['Returns\x20SQL\x20execution\x20payload','API\x20doc\x20code\x20not\x20found:\x20','21951iGpNPY','string','Search\x20docs\x20by\x20code,\x20summary,\x20path,\x20or\x20usage\x20text','228GYXikD','Use\x20`having`\x20only\x20for\x20post-aggregation\x20filters.','API\x20doc\x20code,\x20for\x20example\x20dataset_list','Use\x20read-only\x20data\x20commands\x20before\x20writing\x20Artifacts\x20that\x20display\x20real\x20data.','230heCQgU','dataset_data_create','tableData\x20contains\x20records','method','length','custom_sql_execute','##\x20Get\x20BF\x20endpoint\x20function\x20contract\x0a\x0aInspect\x20one\x20known\x20endpoint\x20function\x20through\x20the\x20AK-authenticated\x20exact\x20detail\x20API.','/api/{appCode}/{datasetCode}/getOne','##\x20Dataset\x20detail','includes','Create\x20dataset\x20record','{\x22aggregate\x22:[{\x22column\x22:\x20\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22}],\x22groupBy\x22:[]}','POST','Dataset\x20detail','Script\x20behavior\x20may\x20have\x20side\x20effects;\x20inspect\x20detail\x20first.','Filter\x20dataset\x20data','Prefer\x20`filter`\x20when\x20the\x20record\x20id\x20is\x20unknown.','validation','This\x20is\x20a\x20write\x20operation;\x20use\x20dry-run\x20when\x20available\x20and\x20safe\x20fixtures\x20for\x20smoke\x20tests.','List\x20available\x20runtime\x20API\x20documentation\x20entries','需要向指定数据集新增一条业务数据时使用','path','Returns\x20script\x20business\x20payload','查询单条数据','Aggregate\x20supports\x20COUNT,\x20SUM,\x20AVG,\x20MAX,\x20and\x20MIN\x20definitions\x20in\x20the\x20`aggregate`\x20array.','result\x20rows\x20contain\x20aggregate\x20aliases','join','4517007KKCYxz','需要按\x20appCode\x20分页获取运行态数据集列表,并优先收敛可用\x20datasetCode\x20时使用','tableData\x20contains\x20dataset\x20id/code/name','lovrabet\x20data\x20create\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22name\x22:\x22demo\x22}\x27','{\x22fieldName\x22:\x22value\x22}','##\x20Execute\x20BF\x20endpoint\x20function\x0a\x0aExecute\x20a\x20known\x20endpoint\x20script.','37190gBdQDk','summary','23772KtYfrp','获取数据集详情','创建数据','##\x20List\x20datasets','map','filter','CLI\x20returns\x20appCode/functionName/description/version/gmtModified','Use\x20`where`,\x20`select`,\x20`orderBy`,\x20`currentPage`,\x20and\x20`pageSize`\x20to\x20inspect\x20live\x20data\x20shape.','read','lovrabet\x20dataset\x20detail\x20--code\x20<datasetCode>\x20--appcode\x20<appCode>','appCode','11180dvPdLi','Aggregate\x20dataset\x20data','list','{\x22param\x22:\x22value\x22}','dataset_data_aggregate','CLI\x20users\x20should\x20prefer\x20`lovrabet\x20dataset\x20list`\x20for\x20this\x20workflow.','32-character\x20dataset\x20code','keyword','str','/api/{appCode}/{datasetCode}/filter','/client/bff/endpoint/{appCode}/{functionName}','detail','`field`\x20is\x20accepted\x20as\x20a\x20deprecated\x20alias\x20for\x20`column`;\x20new\x20calls\x20should\x20use\x20`column`.','This\x20is\x20an\x20exact\x20lookup\x20by\x20appCode\x20+\x20functionName.\x20The\x20CLI\x20does\x20not\x20enumerate\x20BFF\x20functions\x20or\x20expose\x20platform-only\x20fields.','Returns\x20one\x20matching\x20business\x20record','Show\x20runtime\x20API\x20documentation\x20by\x20code','77094Dizacb','GET','title','已经从用户、平台\x20UI\x20或前序上下文确认函数名,需要查看该\x20ENDPOINT\x20的运行态元信息时使用','##\x20Aggregate\x20dataset\x20data','372SgtTYa','dataset_data_filter','category','需要按数据集\x20code\x20获取字段、表信息、关联关系(relations)或操作定义时使用','/api/endpoint/{appCode}/{functionName}','2cQZsWs','Use\x20`lovrabet\x20sql\x20detail`\x20before\x20execution.','dataset_detail','datasetCode','operations\x20describes\x20runtime\x20APIs','code','{\x22appCode\x22:\x22app-aa63b188\x22,\x22currentPage\x22:1,\x22pageSize\x22:100}','trim','dataset','857312CoWSXJ','已经确认目标\x20sqlCode\x20存在,并需要实际执行该自定义\x20SQL\x20时使用','已经知道记录\x20id,需要按数据集读取单条业务数据时使用','35ygSUXx','relations\x20contains\x20the\x20object-shaped\x20API\x20relations\x20value\x20when\x20returned','functionName','lovrabet\x20sql\x20exec\x20--sqlcode\x20<sqlCode>\x20--params\x20\x27{}\x27','##\x20Create\x20dataset\x20record\x0a\x0aCreate\x20one\x20data\x20record\x20in\x20a\x20dataset.','Execute\x20custom\x20SQL','whenToUse','If\x20SDK\x20usage\x20is\x20needed,\x20follow\x20with\x20`lovrabet\x20dataset\x20sdk-doc\x20--code\x20<datasetCode>`.','已经确认目标\x20BF\x20的\x20functionName,且需要实际调用该\x20ENDPOINT\x20函数完成业务操作时使用','List\x20datasets','None','条件过滤查询数据','执行自定义\x20SQL','toLowerCase','324580zqGYtA','Use\x20this\x20API\x20or\x20`lovrabet\x20dataset\x20list`\x20to\x20discover\x20available\x20dataset\x20codes\x20before\x20reading\x20data.','Get\x20BF\x20endpoint\x20function\x20contract','lovrabet\x20bff\x20exec\x20--name\x20<functionName>\x20--params\x20\x27{}\x27','lovrabet\x20data\x20aggregate\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22aggregate\x22:[{\x22column\x22:\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22}]}\x27','##\x20Execute\x20custom\x20SQL\x0a\x0aExecute\x20a\x20configured\x20SQL\x20script\x20by\x20sqlCode.','/api/dataset/get-dataset-list-by-app-code','Current\x20app\x20code','dataset_list','需要携带\x20where、orderBy、分页等条件读取业务数据时使用','api-doc','bf_detail','Exact\x20endpoint\x20function\x20name','聚合查询数据集数据','分页获取数据集列表'];a1_0x36de=function(){return _0x2f4592;};return a1_0x36de();}import{CliErrors}from'../../errors.js';function a1_0x9316(_0x305494,_0x21345f){_0x305494=_0x305494-0x1cb;const _0x36de5c=a1_0x36de();let _0x9316f0=_0x36de5c[_0x305494];return _0x9316f0;}const CATEGORY_FLAG={'name':a1_0x2e89bf(0x209),'type':'string','description':'Filter\x20docs\x20by\x20category,\x20for\x20example\x20dataset'},KEYWORD_FLAG={'name':a1_0x2e89bf(0x1f9),'type':a1_0x2e89bf(0x238),'description':a1_0x2e89bf(0x239)},DOC_CODE_FLAG={'name':a1_0x2e89bf(0x211),'type':a1_0x2e89bf(0x238),'required':!![],'description':a1_0x2e89bf(0x23c)},DOCS=[{'code':a1_0x2e89bf(0x22e),'category':a1_0x2e89bf(0x214),'title':a1_0x2e89bf(0x221),'method':a1_0x2e89bf(0x1d0),'path':a1_0x2e89bf(0x22c),'summary':a1_0x2e89bf(0x234),'whenToUse':a1_0x2e89bf(0x1e0),'pathParams':[],'queryParams':[],'bodySchema':a1_0x2e89bf(0x212),'responseHighlights':[a1_0x2e89bf(0x1e1),'paging.totalCount\x20gives\x20total\x20rows'],'examples':['lovrabet\x20dataset\x20list\x20--appcode\x20<appCode>\x20--format\x20compress'],'notes':[a1_0x2e89bf(0x1f7)],'markdown':[a1_0x2e89bf(0x1ea),'',a1_0x2e89bf(0x227)]['join']('\x0a')},{'code':a1_0x2e89bf(0x20e),'category':a1_0x2e89bf(0x214),'title':a1_0x2e89bf(0x1d1),'method':a1_0x2e89bf(0x203),'path':'/api/dataset/getOneByCode?code={datasetCode}','summary':a1_0x2e89bf(0x1e8),'whenToUse':a1_0x2e89bf(0x20a),'pathParams':[],'queryParams':[{'name':a1_0x2e89bf(0x211),'description':a1_0x2e89bf(0x1f8)}],'bodySchema':a1_0x2e89bf(0x222),'responseHighlights':['fields/properties\x20describe\x20data\x20shape',a1_0x2e89bf(0x219),a1_0x2e89bf(0x210)],'examples':[a1_0x2e89bf(0x1f0)],'notes':[a1_0x2e89bf(0x21f)],'markdown':[a1_0x2e89bf(0x1cc),'','Inspect\x20field\x20names,\x20relations,\x20and\x20operation\x20metadata\x20for\x20a\x20known\x20dataset\x20code.'][a1_0x2e89bf(0x1de)]('\x0a')},{'code':a1_0x2e89bf(0x208),'category':a1_0x2e89bf(0x214),'title':a1_0x2e89bf(0x1d3),'method':a1_0x2e89bf(0x1d0),'path':a1_0x2e89bf(0x1fb),'summary':a1_0x2e89bf(0x223),'whenToUse':a1_0x2e89bf(0x22f),'pathParams':[{'name':'appCode','description':a1_0x2e89bf(0x22d)},{'name':'datasetCode','description':a1_0x2e89bf(0x1f8)}],'queryParams':[],'bodySchema':'{\x22where\x22:{},\x22currentPage\x22:1,\x22pageSize\x22:20}','responseHighlights':[a1_0x2e89bf(0x240),'paging\x20contains\x20pagination'],'examples':['lovrabet\x20data\x20filter\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22currentPage\x22:1,\x22pageSize\x22:5}\x27'],'notes':[a1_0x2e89bf(0x23d)],'markdown':['##\x20Filter\x20dataset\x20data','',a1_0x2e89bf(0x1ee)][a1_0x2e89bf(0x1de)]('\x0a')},{'code':a1_0x2e89bf(0x1f6),'category':a1_0x2e89bf(0x214),'title':a1_0x2e89bf(0x1f3),'method':a1_0x2e89bf(0x1d0),'path':'/api/{appCode}/{datasetCode}/aggregate','summary':a1_0x2e89bf(0x233),'whenToUse':'需要按\x20groupBy\x20分组并做\x20count、sum、avg、max、min\x20等聚合统计时使用','pathParams':[{'name':a1_0x2e89bf(0x1f1),'description':a1_0x2e89bf(0x22d)},{'name':a1_0x2e89bf(0x20f),'description':a1_0x2e89bf(0x1f8)}],'queryParams':[],'bodySchema':a1_0x2e89bf(0x1cf),'responseHighlights':[a1_0x2e89bf(0x1dd),'where\x20filters\x20before\x20aggregation'],'examples':[a1_0x2e89bf(0x22a)],'notes':[a1_0x2e89bf(0x23b),a1_0x2e89bf(0x1fe)],'markdown':[a1_0x2e89bf(0x206),'',a1_0x2e89bf(0x1dc)][a1_0x2e89bf(0x1de)]('\x0a')},{'code':'dataset_data_get_one','category':'dataset','title':'Get\x20one\x20dataset\x20record','method':'POST','path':a1_0x2e89bf(0x1cb),'summary':a1_0x2e89bf(0x1db),'whenToUse':a1_0x2e89bf(0x217),'pathParams':[{'name':'appCode','description':'Current\x20app\x20code'},{'name':a1_0x2e89bf(0x20f),'description':'32-character\x20dataset\x20code'}],'queryParams':[],'bodySchema':'{\x22id\x22:123}','responseHighlights':[a1_0x2e89bf(0x200)],'examples':['lovrabet\x20data\x20getOne\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22id\x22:123}\x27'],'notes':[a1_0x2e89bf(0x1d4)],'markdown':'##\x20Get\x20one\x20dataset\x20record\x0a\x0aRead\x20one\x20record\x20by\x20id.'},{'code':a1_0x2e89bf(0x23f),'category':a1_0x2e89bf(0x214),'title':a1_0x2e89bf(0x1ce),'method':'POST','path':'/api/{appCode}/{datasetCode}/create','summary':a1_0x2e89bf(0x1e9),'whenToUse':a1_0x2e89bf(0x1d8),'pathParams':[{'name':a1_0x2e89bf(0x1f1),'description':a1_0x2e89bf(0x22d)},{'name':'datasetCode','description':a1_0x2e89bf(0x1f8)}],'queryParams':[],'bodySchema':a1_0x2e89bf(0x1e3),'responseHighlights':['Returns\x20the\x20created\x20record\x20or\x20backend\x20operation\x20result'],'examples':[a1_0x2e89bf(0x1e2)],'notes':[a1_0x2e89bf(0x1d6)],'markdown':a1_0x2e89bf(0x21c)},{'code':a1_0x2e89bf(0x231),'category':'bf','title':a1_0x2e89bf(0x228),'method':'GET','path':a1_0x2e89bf(0x1fc),'summary':'按应用和函数名精确获取\x20BF\x20运行契约','whenToUse':a1_0x2e89bf(0x205),'pathParams':[{'name':a1_0x2e89bf(0x1f1),'description':a1_0x2e89bf(0x22d)},{'name':a1_0x2e89bf(0x21a),'description':a1_0x2e89bf(0x232)}],'queryParams':[],'bodySchema':a1_0x2e89bf(0x222),'responseHighlights':[a1_0x2e89bf(0x1ed)],'examples':['lovrabet\x20bff\x20detail\x20--name\x20<functionName>'],'notes':[a1_0x2e89bf(0x1ff)],'markdown':a1_0x2e89bf(0x244)},{'code':'bf_execute','category':'bf','title':'Execute\x20BF\x20endpoint\x20function','method':a1_0x2e89bf(0x1d0),'path':a1_0x2e89bf(0x20b),'summary':'执行指定\x20BF\x20函数','whenToUse':a1_0x2e89bf(0x220),'pathParams':[{'name':a1_0x2e89bf(0x1f1),'description':a1_0x2e89bf(0x22d)},{'name':a1_0x2e89bf(0x21a),'description':'Endpoint\x20function\x20name'}],'queryParams':[],'bodySchema':a1_0x2e89bf(0x1f5),'responseHighlights':[a1_0x2e89bf(0x1da)],'examples':[a1_0x2e89bf(0x229)],'notes':[a1_0x2e89bf(0x1d2)],'markdown':a1_0x2e89bf(0x1e4)},{'code':a1_0x2e89bf(0x243),'category':'custom_sql','title':a1_0x2e89bf(0x21d),'method':a1_0x2e89bf(0x1d0),'path':'/api/custom/executeSql','summary':a1_0x2e89bf(0x224),'whenToUse':a1_0x2e89bf(0x216),'pathParams':[],'queryParams':[],'bodySchema':'{\x22appCode\x22:\x22app-aa63b188\x22,\x22sqlCode\x22:\x22xxxxxxxx-xxxxxxxx\x22,\x22params\x22:{}}','responseHighlights':[a1_0x2e89bf(0x235)],'examples':[a1_0x2e89bf(0x21b)],'notes':[a1_0x2e89bf(0x20d)],'markdown':a1_0x2e89bf(0x22b)}];function entrySummary(_0x4b03ab){const _0x2d38cf=a1_0x2e89bf;return{'code':_0x4b03ab[_0x2d38cf(0x211)],'category':_0x4b03ab['category'],'method':_0x4b03ab['method'],'path':_0x4b03ab[_0x2d38cf(0x1d9)],'summary':_0x4b03ab[_0x2d38cf(0x1e6)],'whenToUse':_0x4b03ab[_0x2d38cf(0x21e)]};}export function listApiDocEntries(_0x37eb9d={}){const _0x3e8759=a1_0x2e89bf,_0x552c73=String(_0x37eb9d['category']||'')[_0x3e8759(0x213)](),_0x24a136=String(_0x37eb9d[_0x3e8759(0x1f9)]||'')[_0x3e8759(0x213)]()[_0x3e8759(0x225)]();return DOCS[_0x3e8759(0x1ec)](_0x467b46=>{const _0x5e4f03=_0x3e8759;if(_0x552c73&&_0x467b46[_0x5e4f03(0x209)]!==_0x552c73)return![];if(!_0x24a136)return!![];return[_0x467b46[_0x5e4f03(0x211)],_0x467b46[_0x5e4f03(0x209)],_0x467b46[_0x5e4f03(0x241)],_0x467b46['path'],_0x467b46[_0x5e4f03(0x1e6)],_0x467b46[_0x5e4f03(0x21e)],_0x467b46[_0x5e4f03(0x204)]][_0x5e4f03(0x1de)]('\x20')['toLowerCase']()[_0x5e4f03(0x1cd)](_0x24a136);})[_0x3e8759(0x1eb)](entrySummary);}export function getApiDocDetail(_0x1ede4c){const _0x36a810=a1_0x2e89bf,_0x1ad2cc=DOCS['find'](_0x2f816f=>_0x2f816f[_0x36a810(0x211)]===_0x1ede4c);if(!_0x1ad2cc)throw CliErrors[_0x36a810(0x1d5)](_0x36a810(0x236)+_0x1ede4c);return{..._0x1ad2cc};}const apiDocList={'service':a1_0x2e89bf(0x230),'command':a1_0x2e89bf(0x1f4),'description':a1_0x2e89bf(0x1d7),'risk':a1_0x2e89bf(0x1ef),'requiresAppCode':![],'flags':[CATEGORY_FLAG,KEYWORD_FLAG],async 'execute'(_0x41040f){const _0x55644f=a1_0x2e89bf,_0xc5d790=listApiDocEntries({'category':_0x41040f[_0x55644f(0x1fa)](_0x55644f(0x209)),'keyword':_0x41040f[_0x55644f(0x1fa)](_0x55644f(0x1f9))});return{'ok':!![],'data':{'total':_0xc5d790[_0x55644f(0x242)],'items':_0xc5d790}};}},apiDocDetail={'service':a1_0x2e89bf(0x230),'command':a1_0x2e89bf(0x1fd),'description':a1_0x2e89bf(0x201),'risk':'read','requiresAppCode':![],'flags':[DOC_CODE_FLAG],async 'execute'(_0x366c28){const _0x452538=a1_0x2e89bf;return{'ok':!![],'data':getApiDocDetail(_0x366c28[_0x452538(0x1fa)]('code'))};}};export const apiDocDefinitions=[apiDocList,apiDocDetail];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Application list cache management.
|
|
3
|
+
*
|
|
4
|
+
* Why a cache: `app list` fetches the remote app list from the API, which
|
|
5
|
+
* requires an extra HTTP call. For commands that need to resolve an app name
|
|
6
|
+
* to an appCode (e.g. `dataset list --app mystagingapp`), we cache the
|
|
7
|
+
* `/client/app/my-apps` response so subsequent calls don't hit the API again.
|
|
8
|
+
*
|
|
9
|
+
* Why keyed by accessKey fingerprint: different accessKeys may return different
|
|
10
|
+
* app lists (tenant isolation). Caching by AK ensures each AK's app list is
|
|
11
|
+
* stored separately and invalidated when the AK changes.
|
|
12
|
+
*
|
|
13
|
+
* Why 600 file permissions: config files contain access keys and should not
|
|
14
|
+
* be readable by other users on the system.
|
|
15
|
+
*/
|
|
16
|
+
import type { RemoteAppItem } from "../../commands/app/remote-source.js";
|
|
17
|
+
/**
|
|
18
|
+
* Cached app list stored in `~/.lovrabet/cache/<env>/<ak_fingerprint>/my-apps.json`.
|
|
19
|
+
*/
|
|
20
|
+
export interface CachedAppList {
|
|
21
|
+
env: "production" | "development" | "daily";
|
|
22
|
+
fetchedAt: string;
|
|
23
|
+
source: "remote" | "mock";
|
|
24
|
+
items: RemoteAppItem[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a cache key from an accessKey.
|
|
28
|
+
*
|
|
29
|
+
* Why hash the AK: the cache path is stored in a world-readable directory (~).
|
|
30
|
+
* Putting the raw AK in the path would expose it. Using a SHA-256 digest (first
|
|
31
|
+
* 12 chars) provides anonymity while still distinguishing between AKs.
|
|
32
|
+
* The last 6 chars of the raw AK are appended as a human-readable suffix so
|
|
33
|
+
* operators can identify which cache entry belongs to which AK during debugging.
|
|
34
|
+
*/
|
|
35
|
+
export declare function fingerprintAccessKey(accessKey: string): string;
|
|
36
|
+
/** Returns the absolute cache file path for a given env and accessKey. */
|
|
37
|
+
export declare function getAppCacheFilePath(env: "production" | "development" | "daily", accessKey: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Reads the cached app list for an accessKey, or `null` if absent / invalid.
|
|
40
|
+
*
|
|
41
|
+
* Why check for empty files and parse errors: a previous write might have
|
|
42
|
+
* failed mid-flight, leaving a truncated file. We treat all read/parse errors
|
|
43
|
+
* as cache miss and fall through to an API fetch rather than crashing.
|
|
44
|
+
*/
|
|
45
|
+
export declare function readCachedAppList(env: "production" | "development" | "daily", accessKey: string | undefined): CachedAppList | null;
|
|
46
|
+
/**
|
|
47
|
+
* Writes the app list to the cache file atomically (temp + rename).
|
|
48
|
+
* Returns the cache file path on success.
|
|
49
|
+
*/
|
|
50
|
+
export declare function writeCachedAppList(env: "production" | "development" | "daily", accessKey: string, payload: CachedAppList): string;
|
|
51
|
+
/**
|
|
52
|
+
* Resolves an appName to an appCode using the cached remote app list.
|
|
53
|
+
*
|
|
54
|
+
* Why `name` is optional: callers may not have a name to resolve (already
|
|
55
|
+
* have an appCode or using a different resolution path). Returning `undefined`
|
|
56
|
+
* lets the caller fall through to other resolution strategies.
|
|
57
|
+
*
|
|
58
|
+
* Runtime safety: unpublished apps are intentionally ignored here so a
|
|
59
|
+
* `defaultApp` cannot silently route data commands into an unpublished app.
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveCachedAppCode(name: string | undefined, env: "production" | "development" | "daily", accessKey: string | undefined): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xb0197f,_0x105bca){const _0x1b3abd=a2_0x4725,_0x4310bf=_0xb0197f();while(!![]){try{const _0x5e34d0=parseInt(_0x1b3abd(0x131))/0x1+-parseInt(_0x1b3abd(0x133))/0x2+parseInt(_0x1b3abd(0x123))/0x3*(parseInt(_0x1b3abd(0x11e))/0x4)+parseInt(_0x1b3abd(0x12c))/0x5*(parseInt(_0x1b3abd(0x11d))/0x6)+-parseInt(_0x1b3abd(0x125))/0x7+parseInt(_0x1b3abd(0x139))/0x8*(-parseInt(_0x1b3abd(0x129))/0x9)+-parseInt(_0x1b3abd(0x128))/0xa*(-parseInt(_0x1b3abd(0x130))/0xb);if(_0x5e34d0===_0x105bca)break;else _0x4310bf['push'](_0x4310bf['shift']());}catch(_0x516ea8){_0x4310bf['push'](_0x4310bf['shift']());}}}(a2_0xaca3,0xd3300));import{createHash}from'node:crypto';import{existsSync,mkdirSync,readFileSync,renameSync,unlinkSync,writeFileSync}from'node:fs';import{homedir}from'node:os';import{dirname,resolve}from'node:path';function a2_0x4725(_0x44f15a,_0x3a7356){_0x44f15a=_0x44f15a-0x11d;const _0xaca3da=a2_0xaca3();let _0x472569=_0xaca3da[_0x44f15a];return _0x472569;}import{PRODUCT_CONFIG}from'../../constant/product.js';import{isRuntimeAccessibleApp}from'../../commands/app/eligibility.js';export function fingerprintAccessKey(_0x3acc81){const _0x56b12d=a2_0x4725,_0x154651=_0x3acc81[_0x56b12d(0x13a)](),_0x17896e=_0x154651[_0x56b12d(0x122)](-0x6)||_0x56b12d(0x12f),_0x47f71b=createHash(_0x56b12d(0x120))[_0x56b12d(0x136)](_0x154651)[_0x56b12d(0x124)]('hex')[_0x56b12d(0x122)](0x0,0xc);return _0x56b12d(0x137)+_0x17896e+'_'+_0x47f71b;}export function getAppCacheFilePath(_0x496bf5,_0x48b5d4){const _0x4b3acf=a2_0x4725;return resolve(homedir(),PRODUCT_CONFIG['homeDirName'],_0x4b3acf(0x12b),_0x496bf5,fingerprintAccessKey(_0x48b5d4),'my-apps.json');}export function readCachedAppList(_0x38c660,_0x39a978){const _0x231250=a2_0x4725;if(!_0x39a978?.[_0x231250(0x13a)]())return null;const _0x24c1b2=getAppCacheFilePath(_0x38c660,_0x39a978);if(!existsSync(_0x24c1b2))return null;try{const _0x1f7f87=readFileSync(_0x24c1b2,'utf8');if(!_0x1f7f87[_0x231250(0x13a)]())return null;const _0x48472b=JSON[_0x231250(0x134)](_0x1f7f87);if(!Array[_0x231250(0x126)](_0x48472b[_0x231250(0x11f)]))return null;return _0x48472b;}catch{return null;}}function a2_0xaca3(){const _0x22fdb8=['sha256','utf8','slice','3nCIQEW','digest','7403319gFBbVj','isArray','find','7061100qvdkcW','585YBjgHF','appCode','cache','1421650sizqtN','EPERM','EXDEV','unknown','11HuTshl','1277795rxoYYw','.tmp','1696892lkMZJW','parse','EACCES','update','ak_','stringify','33712DuhyLE','trim','code','6xNnIgp','3107048dngYhX','items'];a2_0xaca3=function(){return _0x22fdb8;};return a2_0xaca3();}export function writeCachedAppList(_0x2821eb,_0x5c76e0,_0xef4f6){const _0xbf0be3=a2_0x4725,_0x1cb656=getAppCacheFilePath(_0x2821eb,_0x5c76e0),_0x33cabb=dirname(_0x1cb656);!existsSync(_0x33cabb)&&mkdirSync(_0x33cabb,{'recursive':!![]});const _0xf0a615=_0x1cb656+_0xbf0be3(0x132);try{writeFileSync(_0xf0a615,JSON[_0xbf0be3(0x138)](_0xef4f6,null,0x2)+'\x0a',{'encoding':_0xbf0be3(0x121),'mode':0x180});try{renameSync(_0xf0a615,_0x1cb656);}catch(_0x23da6d){if(_0x23da6d[_0xbf0be3(0x13b)]===_0xbf0be3(0x12d)||_0x23da6d['code']===_0xbf0be3(0x12e)||_0x23da6d[_0xbf0be3(0x13b)]===_0xbf0be3(0x135)){writeFileSync(_0x1cb656,JSON[_0xbf0be3(0x138)](_0xef4f6,null,0x2)+'\x0a',{'encoding':_0xbf0be3(0x121)});try{unlinkSync(_0xf0a615);}catch{}}else throw _0x23da6d;}}catch(_0x555e72){try{unlinkSync(_0xf0a615);}catch{}throw _0x555e72;}return _0x1cb656;}export function resolveCachedAppCode(_0x496b6c,_0x6890,_0x885695){const _0x2dbbf0=a2_0x4725;if(!_0x496b6c)return undefined;const _0x121c4f=readCachedAppList(_0x6890,_0x885695),_0x3af67b=_0x121c4f?.[_0x2dbbf0(0x11f)][_0x2dbbf0(0x127)](_0x5b5188=>_0x5b5188['appName']===_0x496b6c&&isRuntimeAccessibleApp(_0x5b5188));return _0x3af67b?.[_0x2dbbf0(0x12a)]?.[_0x2dbbf0(0x13a)]()||undefined;}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `app` subcommand definitions — init, list, pull, use, import.
|
|
3
|
+
*
|
|
4
|
+
* Why a flat array of command objects: Lovrabet Runtime CLI uses the declarative
|
|
5
|
+
* `CommandDefinition[]` registry pattern (not a switch-based handler). Each command
|
|
6
|
+
* is a self-contained `CommandDefinition` that the framework runner dispatches.
|
|
7
|
+
*
|
|
8
|
+
* Commands:
|
|
9
|
+
* - init: initialize a `.lovrabet.json` config file for the current scope
|
|
10
|
+
* - list/pull: discover remote apps (cached) — read operations
|
|
11
|
+
* - use: set fallback app candidate — write operation
|
|
12
|
+
* - import: migrate from `.rabetbase.json` — write operation
|
|
13
|
+
*
|
|
14
|
+
* Why there is no `app add` / `app remove`: the runtime CLI does not manage
|
|
15
|
+
* platform app records locally. The remote app directory remains the source of
|
|
16
|
+
* truth for platform apps, while `.lovrabet.json` may define local aliases under
|
|
17
|
+
* `apps.<alias>.appcode` for operator-friendly names.
|
|
18
|
+
*
|
|
19
|
+
* Scope policy: `use` and `import` delegate to
|
|
20
|
+
* `resolveConfigScope({ policy: "project-default" })`, meaning:
|
|
21
|
+
* - `--global` → write to global
|
|
22
|
+
* - no flag + in project → write to project (takes precedence over global on merge)
|
|
23
|
+
* - no flag + outside project → write to global
|
|
24
|
+
*/
|
|
25
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
26
|
+
export declare const appDefinitions: CommandDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a3_0x21f7ea=a3_0x4ead;(function(_0x4407d0,_0x4ac74a){const _0x4471d3=a3_0x4ead,_0x17836e=_0x4407d0();while(!![]){try{const _0x5c2812=parseInt(_0x4471d3(0xd7))/0x1+parseInt(_0x4471d3(0x86))/0x2*(-parseInt(_0x4471d3(0xba))/0x3)+-parseInt(_0x4471d3(0xc8))/0x4*(parseInt(_0x4471d3(0xc0))/0x5)+parseInt(_0x4471d3(0xb4))/0x6*(parseInt(_0x4471d3(0xc7))/0x7)+parseInt(_0x4471d3(0xb7))/0x8+parseInt(_0x4471d3(0xd1))/0x9+-parseInt(_0x4471d3(0x83))/0xa;if(_0x5c2812===_0x4ac74a)break;else _0x17836e['push'](_0x17836e['shift']());}catch(_0x362f82){_0x17836e['push'](_0x17836e['shift']());}}}(a3_0x36ee,0x573d5));import{CliErrors}from'../../errors.js';import{initCreateFlagDefs,initImportFlagDefs,runInit,runInitImport}from'../../commands/init.js';import{getEnv,RUNTIME_ENV_VALUES}from'../../constant/env.js';import{buildAppProfileListFields}from'../../config/schema.js';import{CLI_BIN_NAME,readConfig,writeConfig,scopeLabel,enrichAppListItemsWithMergedSelection}from'../../commands/app/shared.js';import{resolveConfigScope,toScopeFlags}from'../../commands/common/config-policy.js';import{filterRuntimeAccessibleApps,findAppByCode,isRuntimeAccessibleApp,runtimeInaccessibleAppError}from'../../commands/app/eligibility.js';function a3_0x4ead(_0x5032e8,_0x4ed47c){_0x5032e8=_0x5032e8-0x81;const _0x36ee8f=a3_0x36ee();let _0x4ead40=_0x36ee8f[_0x5032e8];return _0x4ead40;}const GLOBAL_FLAG={'name':a3_0x21f7ea(0x9c),'type':a3_0x21f7ea(0x99),'description':a3_0x21f7ea(0xa2),'default':![]};function a3_0x36ee(){const _0xe34d34=['12FyuQEU','Refresh\x20the\x20local\x20app\x20cache\x20from\x20the\x20platform','find','Import\x20the\x20default\x20app\x20selection\x20from\x20a\x20.rabetbase.json\x20file','warn','mergedCli','Usage:\x20','trim','app','5430924ACMWjX','local','Refreshed\x20app\x20cache\x20with\x20','No\x20cached\x20apps\x20found.','write','config','651972vwjxAg','init','../../context.js','6278210YpuRPn','Filter\x20by\x20environment\x20(default:\x20current\x20env)','accessKey','2ePVmsH','validation','\x20workspace\x20use\x20--app\x20<name>\x20[--env\x20daily]','No\x20apps\x20found\x20on\x20the\x20platform.','length','read','include-unpublished','appcode','env','appName','Force\x20remote\x20fetch\x20and\x20refresh\x20local\x20cache','appCode','list','nonInteractive','.\x20Local\x20aliases\x20can\x20be\x20added\x20under\x20apps.<alias>.appcode.','\x20app\x20use\x20<name>\x20[--global]','envName','items','str','boolean','Read\x20app\x20list\x20from\x20local\x20cache\x20only','../../commands/app/remote-source.js','global','../../commands/app/cache.js','args','appOwnerName','cachePath','filter','Use\x20global\x20config\x20scope','\x20cached\x20app(s)\x20for\x20env=\x22','globalPath','from','Available\x20remote\x20apps:\x20','import','map','cache','name','Deprecated:\x20use\x20workspace\x20use\x20to\x20bind\x20the\x20current\x20directory\x20to\x20an\x20app','Include\x20unpublished\x20apps\x20for\x20diagnostics','use','Read\x20from\x20local\x20cache\x20only','defaultApp','Missing\x20app\x20name.','Target\x20environment\x20(default:\x20current\x20env)','\x20app\x20list`\x20to\x20discover\x20remote\x20apps,\x20or\x20add\x20apps.','appPublishStatus','246PfdFQI','\x22\x20not\x20found.','source','1523304jMjAsu','\x20app(s)\x20for\x20env=\x22','bool','472953TRiLhH','`\x20instead.','fetchedAt','Loaded\x20','langs','.appcode\x20to\x20.lovrabet.json.','1103695RzumJK','Remote\x20app\x20name\x20to\x20activate','production','string','no-cache','List\x20apps\x20available\x20to\x20the\x20current\x20access\x20key','pull','61327IUGSga'];a3_0x36ee=function(){return _0xe34d34;};return a3_0x36ee();}function collectFlags(_0x3c815d,_0x3501f2){const _0x6233ba=a3_0x21f7ea,_0x842247={};for(const _0x4eba1b of _0x3501f2){const _0x1c1951=_0x4eba1b['type']===_0x6233ba(0x99)?_0x3c815d[_0x6233ba(0xb9)](_0x4eba1b['name']):_0x3c815d[_0x6233ba(0x98)](_0x4eba1b[_0x6233ba(0xaa)]);if(_0x1c1951!==''&&_0x1c1951!==![])_0x842247[_0x4eba1b[_0x6233ba(0xaa)]]=_0x1c1951;}if(_0x3c815d[_0x6233ba(0x93)])_0x842247['nonInteractive']=!![];return _0x842247;}function normalizeLanguages(_0x5aead2){const _0x411736=a3_0x21f7ea;if(!Array['isArray'](_0x5aead2))return[];return _0x5aead2[_0x411736(0xa1)](_0x1e1c20=>typeof _0x1e1c20===_0x411736(0xc3))[_0x411736(0xa8)](_0x17d3bf=>_0x17d3bf['trim']())[_0x411736(0xa1)](Boolean);}function buildRemoteAppI18nFields(_0x12250f){const _0x203342=a3_0x21f7ea,_0x50f0ca=normalizeLanguages(_0x12250f['i18nInfo']?.[_0x203342(0xbe)]);return{'enableI18n':typeof _0x12250f['enableI18n']===_0x203342(0x99)?_0x12250f['enableI18n']:null,'languages':_0x50f0ca,'i18nInfo':_0x12250f['i18nInfo']?{..._0x12250f['i18nInfo'],'langs':_0x50f0ca[_0x203342(0x8a)]?_0x50f0ca:null}:null};}const initDef={'service':a3_0x21f7ea(0xd0),'command':a3_0x21f7ea(0x81),'description':'Deprecated:\x20use\x20workspace\x20init\x20to\x20bind\x20the\x20current\x20directory\x20to\x20an\x20app','risk':a3_0x21f7ea(0xd5),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':initCreateFlagDefs,async 'execute'(_0xfd678a){const _0xed03bb=a3_0x21f7ea;return warnDeprecatedAppCommand(_0xed03bb(0x81),CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>\x20[--env\x20daily]'),await runInit(collectFlags(_0xfd678a,initCreateFlagDefs)),{'ok':!![]};}},listDef={'service':'app','command':a3_0x21f7ea(0x92),'description':a3_0x21f7ea(0xc5),'risk':a3_0x21f7ea(0x8b),'requiresAuth':!![],'requiresAppCode':![],'hasFormat':!![],'flags':[{'name':'env','type':a3_0x21f7ea(0xc3),'description':a3_0x21f7ea(0x84),'enum':[...RUNTIME_ENV_VALUES]},{'name':'local','type':a3_0x21f7ea(0x99),'description':a3_0x21f7ea(0x9a),'default':![]},{'name':a3_0x21f7ea(0xc4),'type':'boolean','description':a3_0x21f7ea(0x90),'default':![]},{'name':a3_0x21f7ea(0x8c),'type':a3_0x21f7ea(0x99),'description':a3_0x21f7ea(0xac),'default':![]}],async 'execute'(_0x54669c){const _0x1d2e0f=a3_0x21f7ea,_0x2591db=_0x54669c[_0x1d2e0f(0x98)](_0x1d2e0f(0x8e))||_0x54669c[_0x1d2e0f(0x96)]||getEnv()||_0x1d2e0f(0xc2),_0x2ffcdf=_0x54669c[_0x1d2e0f(0xb9)](_0x1d2e0f(0xd2)),_0x10a654=_0x54669c[_0x1d2e0f(0xb9)](_0x1d2e0f(0xc4)),_0xfeabfa=_0x54669c[_0x1d2e0f(0xb9)](_0x1d2e0f(0x8c)),{readRawConfigWithLayers:_0x44da35,resolveDefaultAppSource:_0x44ca99,getLocalAppAliases:_0x55710c}=await import(_0x1d2e0f(0x82)),{getRemoteAppList:_0x434a8c}=await import(_0x1d2e0f(0x9b)),{config:_0x264f98,layers:_0x242dc6}=_0x44da35(),_0x63b3bb=_0x44ca99(_0x242dc6),{defaultApp:_0x31b7fc}=_0x264f98,_0x370ff5=await _0x434a8c({'env':_0x2591db,'accessKey':_0x54669c[_0x1d2e0f(0x85)],'localOnly':_0x2ffcdf,'noCache':_0x10a654}),_0x2574c7=_0xfeabfa?_0x370ff5['items']:filterRuntimeAccessibleApps(_0x370ff5[_0x1d2e0f(0x97)]),_0x13b413=_0x370ff5['items']['length']-_0x2574c7['length'],_0x162d44=_0x2574c7[_0x1d2e0f(0xa8)](_0x3c5db4=>{const _0x50de3e=_0x1d2e0f;return{'name':_0x3c5db4[_0x50de3e(0x8f)],'appcode':_0x3c5db4['appCode'],'named':!![],'definedIn':'remote','isDefault':_0x3c5db4[_0x50de3e(0x8f)]===_0x31b7fc,...buildAppProfileListFields(_0x2591db),...buildRemoteAppI18nFields(_0x3c5db4),'source':_0x370ff5[_0x50de3e(0xb6)],'owner':_0x3c5db4[_0x50de3e(0x9f)]??null,'status':_0x3c5db4[_0x50de3e(0xb3)]??null,'cachedAt':_0x370ff5[_0x50de3e(0xbc)]};}),_0x272447=_0x55710c(_0x264f98);let _0x5a416c=0x0;for(const [_0x5af03a,_0x40985f]of Object['entries'](_0x272447)){const _0x53203c=typeof _0x40985f[_0x1d2e0f(0x8d)]===_0x1d2e0f(0xc3)?_0x40985f[_0x1d2e0f(0x8d)][_0x1d2e0f(0xcf)]():'';if(!_0x53203c)continue;const _0x541fdf=findAppByCode(_0x370ff5[_0x1d2e0f(0x97)],_0x53203c);if(!_0xfeabfa&&_0x541fdf&&!isRuntimeAccessibleApp(_0x541fdf))continue;_0x5a416c+=0x1,_0x162d44['push']({'name':_0x5af03a,'appcode':_0x53203c,'named':!![],'definedIn':_0x1d2e0f(0xd2),'isDefault':_0x5af03a===_0x31b7fc,...buildAppProfileListFields(_0x2591db),'source':_0x1d2e0f(0xd6),'owner':null,'status':null,'cachedAt':null});}enrichAppListItemsWithMergedSelection(_0x162d44,_0x54669c[_0x1d2e0f(0xcd)]);const _0x38a591=_0x162d44[_0x1d2e0f(0xca)](_0x33429e=>_0x33429e['isCurrent']===!![]),_0x68e8e1=_0x31b7fc??_0x38a591?.[_0x1d2e0f(0xaa)]??null,_0x2eb190={'env':_0x2591db,'source':_0x370ff5[_0x1d2e0f(0xb6)],'fetchedAt':_0x370ff5['fetchedAt'],'cachePath':_0x370ff5[_0x1d2e0f(0xa0)],'globalPath':_0x242dc6[_0x1d2e0f(0xa4)]??null,'projectPath':_0x242dc6['projectPath']??null,'defaultApp':_0x68e8e1,'defaultAppSource':_0x31b7fc!=null?_0x63b3bb:null,'localAliasCount':_0x5a416c,'remoteTotal':_0x370ff5[_0x1d2e0f(0x97)][_0x1d2e0f(0x8a)],'hiddenUnpublishedCount':_0x13b413,'includeUnpublished':_0xfeabfa};if(_0x162d44[_0x1d2e0f(0x8a)]===0x0)return{'ok':!![],'data':{'items':_0x162d44,'meta':_0x2eb190},'message':_0x370ff5['source']===_0x1d2e0f(0xa9)?_0x1d2e0f(0xd4):_0x1d2e0f(0x89)};return{'ok':!![],'data':{'items':_0x162d44,'meta':_0x2eb190}};}},pullDef={'service':a3_0x21f7ea(0xd0),'command':a3_0x21f7ea(0xc6),'description':a3_0x21f7ea(0xc9),'risk':'write','requiresAuth':!![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a3_0x21f7ea(0x8e),'type':a3_0x21f7ea(0xc3),'description':a3_0x21f7ea(0xb1),'enum':[...RUNTIME_ENV_VALUES]},{'name':a3_0x21f7ea(0xd2),'type':a3_0x21f7ea(0x99),'description':a3_0x21f7ea(0xae),'default':![]},{'name':a3_0x21f7ea(0xc4),'type':'boolean','description':a3_0x21f7ea(0x90),'default':![]}],async 'execute'(_0x10dd8b){const _0x23b05a=a3_0x21f7ea,_0x1710d2=_0x10dd8b[_0x23b05a(0x98)](_0x23b05a(0x8e))||_0x10dd8b[_0x23b05a(0x96)]||getEnv()||_0x23b05a(0xc2),_0x4a5dd0=_0x10dd8b['bool']('local'),_0x35a6fb=_0x10dd8b[_0x23b05a(0xb9)](_0x23b05a(0xc4)),{getRemoteAppList:_0x53d5a0}=await import(_0x23b05a(0x9b)),_0x49b482=await _0x53d5a0({'env':_0x1710d2,'accessKey':_0x10dd8b[_0x23b05a(0x85)],'localOnly':_0x4a5dd0,'noCache':_0x35a6fb});return{'ok':!![],'data':{'total':_0x49b482['items'][_0x23b05a(0x8a)],'env':_0x1710d2,'source':_0x49b482[_0x23b05a(0xb6)],'fetchedAt':_0x49b482[_0x23b05a(0xbc)],'cachePath':_0x49b482['cachePath']},'message':_0x49b482[_0x23b05a(0xb6)]==='cache'?_0x23b05a(0xbd)+_0x49b482[_0x23b05a(0x97)]['length']+_0x23b05a(0xa3)+_0x1710d2+'\x22.':_0x23b05a(0xd3)+_0x49b482['items'][_0x23b05a(0x8a)]+_0x23b05a(0xb8)+_0x1710d2+'\x22.'};}},useDef={'service':a3_0x21f7ea(0xd0),'command':a3_0x21f7ea(0xad),'description':a3_0x21f7ea(0xab),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a3_0x21f7ea(0xaa),'description':a3_0x21f7ea(0xc1),'required':!![]}],'flags':[GLOBAL_FLAG],async 'validate'(_0x723c15){const _0x286bb3=a3_0x21f7ea;if(!_0x723c15[_0x286bb3(0x9e)][0x0])throw CliErrors['validation'](_0x286bb3(0xb0),_0x286bb3(0xce)+CLI_BIN_NAME+_0x286bb3(0x95));},async 'execute'(_0x2b6440){const _0x4cc262=a3_0x21f7ea;warnDeprecatedAppCommand('use',CLI_BIN_NAME+_0x4cc262(0x88));const _0x3dda2f=_0x2b6440[_0x4cc262(0x9e)][0x0];if(!_0x3dda2f)throw CliErrors['validation'](_0x4cc262(0xb0),_0x4cc262(0xce)+CLI_BIN_NAME+_0x4cc262(0x95));const {buildConfigFromFlags:_0x28ad72,resolveLocalAppAliasCode:_0x5a181a}=await import(_0x4cc262(0x82)),{readCachedAppList:_0x44370f}=await import(_0x4cc262(0x9d)),_0x354ad6=_0x2b6440[_0x4cc262(0x98)](_0x4cc262(0x8e)),_0x4e286e=_0x28ad72(_0x354ad6?{'env':_0x354ad6}:{}),_0x1060c7=_0x44370f(_0x4e286e[_0x4cc262(0x8e)],_0x4e286e[_0x4cc262(0x85)]),_0x2f0395=_0x1060c7?.['items']['find'](_0x193eaf=>_0x193eaf[_0x4cc262(0x8f)]===_0x3dda2f),_0xdb9705=_0x5a181a(_0x4e286e['raw']??{},_0x3dda2f);if(_0x2f0395&&!isRuntimeAccessibleApp(_0x2f0395))throw runtimeInaccessibleAppError(_0x2f0395,'\x22'+_0x3dda2f+'\x22');if(_0xdb9705){const _0x38054c=_0x1060c7?.[_0x4cc262(0x97)]['find'](_0x8e3f8b=>_0x8e3f8b[_0x4cc262(0x91)]?.[_0x4cc262(0xcf)]()===_0xdb9705);if(_0x38054c&&!isRuntimeAccessibleApp(_0x38054c))throw runtimeInaccessibleAppError(_0x38054c,'\x22'+_0x3dda2f+'\x22');}if(!_0x2f0395&&!_0xdb9705&&_0x4e286e['defaultApp']!==_0x3dda2f){const _0x385b39=[..._0x1060c7?.[_0x4cc262(0x97)][_0x4cc262(0xa8)](_0x1eb0e1=>_0x1eb0e1[_0x4cc262(0x8f)])??[]],_0x4f158f=_0x385b39['length']===0x0?'Use\x20`'+CLI_BIN_NAME+_0x4cc262(0xb2)+_0x3dda2f+_0x4cc262(0xbf):_0x4cc262(0xa6)+Array[_0x4cc262(0xa5)](new Set(_0x385b39))['join'](',\x20')+_0x4cc262(0x94);throw CliErrors[_0x4cc262(0x87)]('App\x20\x22'+_0x3dda2f+_0x4cc262(0xb5),_0x4f158f);}const _0x3117f2=_0x2b6440[_0x4cc262(0xb9)](_0x4cc262(0x9c));let _0x2d0411;if(_0x3117f2)_0x2d0411={'global':!![]};else{const {isInProject:_0x5246b9}=await import(_0x4cc262(0x82)),_0x4dfc1e=_0x5246b9();_0x2d0411=toScopeFlags(resolveConfigScope({'explicitGlobal':![],'policy':'project-default','inProject':_0x4dfc1e}));}const _0x34a0ca=readConfig(_0x2d0411);return _0x34a0ca[_0x4cc262(0xaf)]=_0x3dda2f,writeConfig(_0x34a0ca,_0x2d0411),{'ok':!![],'message':'Default\x20app\x20candidate\x20set\x20to\x20\x22'+_0x3dda2f+'\x22'+scopeLabel(_0x2d0411)+'.'};}};function warnDeprecatedAppCommand(_0x1d4f49,_0x282288){const _0x9bc044=a3_0x21f7ea;console[_0x9bc044(0xcc)](CLI_BIN_NAME+'\x20app\x20'+_0x1d4f49+'\x20is\x20deprecated.\x20Use\x20`'+_0x282288+_0x9bc044(0xbb));}const importDef={'service':a3_0x21f7ea(0xd0),'command':a3_0x21f7ea(0xa7),'description':a3_0x21f7ea(0xcb),'risk':a3_0x21f7ea(0xd5),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':initImportFlagDefs,async 'execute'(_0x256193){return await runInitImport(collectFlags(_0x256193,initImportFlagDefs)),{'ok':!![]};}};export const appDefinitions=[initDef,listDef,pullDef,useDef,importDef];
|
|
1
|
+
const a3_0x521e79=a3_0x2997;(function(_0x5bc5fb,_0x2f5896){const _0x225b51=a3_0x2997,_0x269cc1=_0x5bc5fb();while(!![]){try{const _0x5612d5=parseInt(_0x225b51(0x193))/0x1+parseInt(_0x225b51(0x1c8))/0x2+parseInt(_0x225b51(0x190))/0x3+parseInt(_0x225b51(0x1a9))/0x4*(-parseInt(_0x225b51(0x1bc))/0x5)+parseInt(_0x225b51(0x1c4))/0x6+-parseInt(_0x225b51(0x1c9))/0x7*(-parseInt(_0x225b51(0x1cc))/0x8)+-parseInt(_0x225b51(0x1c6))/0x9*(parseInt(_0x225b51(0x1be))/0xa);if(_0x5612d5===_0x2f5896)break;else _0x269cc1['push'](_0x269cc1['shift']());}catch(_0x5297a5){_0x269cc1['push'](_0x269cc1['shift']());}}}(a3_0x4731,0x26267));import{CliErrors}from'../../errors.js';import{initCreateFlagDefs,initImportFlagDefs,runInit,runInitImport}from'../../commands/init.js';function a3_0x4731(){const _0x271898=['Default\x20app\x20candidate\x20set\x20to\x20\x22','filter','join','List\x20apps\x20available\x20to\x20the\x20current\x20access\x20key','appcode','Read\x20app\x20list\x20from\x20local\x20cache\x20only','nonInteractive','production','str','\x20app\x20','\x20workspace\x20use\x20--app\x20<name>\x20[--env\x20daily]','no-cache','Usage:\x20','appName','config','620772BfOeIv','\x20app\x20list`\x20to\x20discover\x20remote\x20apps,\x20or\x20add\x20apps.','source','288374alEBCd','Available\x20remote\x20apps:\x20','items','../../context.js','fetchedAt','../../commands/app/cache.js','envName','appPublishStatus','Deprecated:\x20use\x20workspace\x20use\x20to\x20bind\x20the\x20current\x20directory\x20to\x20an\x20app','global','No\x20apps\x20found\x20on\x20the\x20platform.','boolean','push','Missing\x20app\x20name.','../../commands/app/remote-source.js','import','entries','local','app','Refresh\x20the\x20local\x20app\x20cache\x20from\x20the\x20platform','name','pull','7116sukMzR','include-unpublished','string','cache','trim','\x20app(s)\x20for\x20env=\x22','Use\x20`','map','\x20is\x20deprecated.\x20Use\x20`','isCurrent','env','enableI18n','list','langs','mergedCli','App\x20\x22','appCode','project-default','cachePath','765mExDSF','use','1870nkiOVk','No\x20cached\x20apps\x20found.','init','.appcode\x20to\x20.lovrabet.json.','read','Loaded\x20','1097256TniWIy','\x20app\x20use\x20<name>\x20[--global]','15849EnGayU','length','94092CCoJPD','7OMfPnN','accessKey','defaultApp','260296GoDtus','bool','write','projectPath','appOwnerName'];a3_0x4731=function(){return _0x271898;};return a3_0x4731();}import{getEnv,RUNTIME_ENV_VALUES}from'../../constant/env.js';import{buildAppProfileListFields}from'../../config/schema.js';import{CLI_BIN_NAME,readConfig,writeConfig,scopeLabel,enrichAppListItemsWithMergedSelection}from'../../commands/app/shared.js';import{resolveConfigScope,toScopeFlags}from'../../commands/common/config-policy.js';import{filterRuntimeAccessibleApps,findAppByCode,isRuntimeAccessibleApp,runtimeInaccessibleAppError}from'../../commands/app/eligibility.js';const GLOBAL_FLAG={'name':a3_0x521e79(0x19c),'type':a3_0x521e79(0x19e),'description':'Use\x20global\x20config\x20scope','default':![]};function collectFlags(_0x427f5f,_0x3c0382){const _0x16f87d=a3_0x521e79,_0x12e9d2={};for(const _0xc0fede of _0x3c0382){const _0x480b99=_0xc0fede['type']===_0x16f87d(0x19e)?_0x427f5f[_0x16f87d(0x1cd)](_0xc0fede[_0x16f87d(0x1a7)]):_0x427f5f[_0x16f87d(0x189)](_0xc0fede[_0x16f87d(0x1a7)]);if(_0x480b99!==''&&_0x480b99!==![])_0x12e9d2[_0xc0fede[_0x16f87d(0x1a7)]]=_0x480b99;}if(_0x427f5f[_0x16f87d(0x187)])_0x12e9d2[_0x16f87d(0x187)]=!![];return _0x12e9d2;}function a3_0x2997(_0x1e3564,_0x5e78d9){_0x1e3564=_0x1e3564-0x17e;const _0x4731ae=a3_0x4731();let _0x299761=_0x4731ae[_0x1e3564];return _0x299761;}function normalizeLanguages(_0x116ad9){const _0x4dae1c=a3_0x521e79;if(!Array['isArray'](_0x116ad9))return[];return _0x116ad9[_0x4dae1c(0x182)](_0x9b7b84=>typeof _0x9b7b84==='string')['map'](_0x3b986a=>_0x3b986a[_0x4dae1c(0x1ad)]())[_0x4dae1c(0x182)](Boolean);}function buildRemoteAppI18nFields(_0x2648e2){const _0x57c71a=a3_0x521e79,_0x563897=normalizeLanguages(_0x2648e2['i18nInfo']?.[_0x57c71a(0x1b6)]);return{'enableI18n':typeof _0x2648e2[_0x57c71a(0x1b4)]===_0x57c71a(0x19e)?_0x2648e2[_0x57c71a(0x1b4)]:null,'languages':_0x563897,'i18nInfo':_0x2648e2['i18nInfo']?{..._0x2648e2['i18nInfo'],'langs':_0x563897[_0x57c71a(0x1c7)]?_0x563897:null}:null};}const initDef={'service':a3_0x521e79(0x1a5),'command':'init','description':'Deprecated:\x20use\x20workspace\x20init\x20to\x20bind\x20the\x20current\x20directory\x20to\x20an\x20app','risk':a3_0x521e79(0x17e),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':initCreateFlagDefs,async 'execute'(_0x88857c){const _0xf3c2df=a3_0x521e79;return warnDeprecatedAppCommand(_0xf3c2df(0x1c0),CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>\x20[--env\x20daily]'),await runInit(collectFlags(_0x88857c,initCreateFlagDefs)),{'ok':!![]};}},listDef={'service':a3_0x521e79(0x1a5),'command':a3_0x521e79(0x1b5),'description':a3_0x521e79(0x184),'risk':a3_0x521e79(0x1c2),'requiresAuth':!![],'requiresAppCode':![],'hasFormat':!![],'flags':[{'name':a3_0x521e79(0x1b3),'type':a3_0x521e79(0x1ab),'description':'Filter\x20by\x20environment\x20(default:\x20current\x20env)','enum':[...RUNTIME_ENV_VALUES]},{'name':a3_0x521e79(0x1a4),'type':a3_0x521e79(0x19e),'description':a3_0x521e79(0x186),'default':![]},{'name':a3_0x521e79(0x18c),'type':a3_0x521e79(0x19e),'description':'Force\x20remote\x20fetch\x20and\x20refresh\x20local\x20cache','default':![]},{'name':a3_0x521e79(0x1aa),'type':a3_0x521e79(0x19e),'description':'Include\x20unpublished\x20apps\x20for\x20diagnostics','default':![]}],async 'execute'(_0x3dd16c){const _0x980c21=a3_0x521e79,_0x52e716=_0x3dd16c[_0x980c21(0x189)](_0x980c21(0x1b3))||_0x3dd16c[_0x980c21(0x199)]||getEnv()||_0x980c21(0x188),_0x13112c=_0x3dd16c[_0x980c21(0x1cd)](_0x980c21(0x1a4)),_0x1e4e7b=_0x3dd16c[_0x980c21(0x1cd)](_0x980c21(0x18c)),_0xcc00e4=_0x3dd16c[_0x980c21(0x1cd)]('include-unpublished'),{readRawConfigWithLayers:_0x503bd1,resolveDefaultAppSource:_0x3a8e85,getLocalAppAliases:_0x5d2142}=await import(_0x980c21(0x196)),{getRemoteAppList:_0x4068e1}=await import(_0x980c21(0x1a1)),{config:_0x4546fc,layers:_0x210140}=_0x503bd1(),_0x4a81ba=_0x3a8e85(_0x210140),{defaultApp:_0x2d22f9}=_0x4546fc,_0x11a476=await _0x4068e1({'env':_0x52e716,'accessKey':_0x3dd16c[_0x980c21(0x1ca)],'localOnly':_0x13112c,'noCache':_0x1e4e7b}),_0x1bb663=_0xcc00e4?_0x11a476[_0x980c21(0x195)]:filterRuntimeAccessibleApps(_0x11a476[_0x980c21(0x195)]),_0x40dd3b=_0x11a476[_0x980c21(0x195)][_0x980c21(0x1c7)]-_0x1bb663['length'],_0x2bc9ad=_0x1bb663[_0x980c21(0x1b0)](_0x5abeb5=>{const _0x4be365=_0x980c21;return{'name':_0x5abeb5[_0x4be365(0x18e)],'appcode':_0x5abeb5[_0x4be365(0x1b9)],'named':!![],'definedIn':'remote','isDefault':_0x5abeb5[_0x4be365(0x18e)]===_0x2d22f9,...buildAppProfileListFields(_0x52e716),...buildRemoteAppI18nFields(_0x5abeb5),'source':_0x11a476['source'],'owner':_0x5abeb5[_0x4be365(0x180)]??null,'status':_0x5abeb5[_0x4be365(0x19a)]??null,'cachedAt':_0x11a476[_0x4be365(0x197)]};}),_0x1bfeb6=_0x5d2142(_0x4546fc);let _0x282cfc=0x0;for(const [_0x1ccdfa,_0x37a55f]of Object[_0x980c21(0x1a3)](_0x1bfeb6)){const _0x5579e6=typeof _0x37a55f[_0x980c21(0x185)]===_0x980c21(0x1ab)?_0x37a55f[_0x980c21(0x185)][_0x980c21(0x1ad)]():'';if(!_0x5579e6)continue;const _0x5311f1=findAppByCode(_0x11a476[_0x980c21(0x195)],_0x5579e6);if(!_0xcc00e4&&_0x5311f1&&!isRuntimeAccessibleApp(_0x5311f1))continue;_0x282cfc+=0x1,_0x2bc9ad[_0x980c21(0x19f)]({'name':_0x1ccdfa,'appcode':_0x5579e6,'named':!![],'definedIn':_0x980c21(0x1a4),'isDefault':_0x1ccdfa===_0x2d22f9,...buildAppProfileListFields(_0x52e716),'source':_0x980c21(0x18f),'owner':null,'status':null,'cachedAt':null});}enrichAppListItemsWithMergedSelection(_0x2bc9ad,_0x3dd16c[_0x980c21(0x1b7)]);const _0x110a8b=_0x2bc9ad['find'](_0x1b83e1=>_0x1b83e1[_0x980c21(0x1b2)]===!![]),_0x4a03f7=_0x2d22f9??_0x110a8b?.[_0x980c21(0x1a7)]??null,_0xfd3981={'env':_0x52e716,'source':_0x11a476[_0x980c21(0x192)],'fetchedAt':_0x11a476[_0x980c21(0x197)],'cachePath':_0x11a476[_0x980c21(0x1bb)],'globalPath':_0x210140['globalPath']??null,'projectPath':_0x210140[_0x980c21(0x17f)]??null,'defaultApp':_0x4a03f7,'defaultAppSource':_0x2d22f9!=null?_0x4a81ba:null,'localAliasCount':_0x282cfc,'remoteTotal':_0x11a476[_0x980c21(0x195)][_0x980c21(0x1c7)],'hiddenUnpublishedCount':_0x40dd3b,'includeUnpublished':_0xcc00e4};if(_0x2bc9ad[_0x980c21(0x1c7)]===0x0)return{'ok':!![],'data':{'items':_0x2bc9ad,'meta':_0xfd3981},'message':_0x11a476[_0x980c21(0x192)]===_0x980c21(0x1ac)?_0x980c21(0x1bf):_0x980c21(0x19d)};return{'ok':!![],'data':{'items':_0x2bc9ad,'meta':_0xfd3981}};}},pullDef={'service':'app','command':a3_0x521e79(0x1a8),'description':a3_0x521e79(0x1a6),'risk':a3_0x521e79(0x17e),'requiresAuth':!![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':'env','type':a3_0x521e79(0x1ab),'description':'Target\x20environment\x20(default:\x20current\x20env)','enum':[...RUNTIME_ENV_VALUES]},{'name':'local','type':a3_0x521e79(0x19e),'description':'Read\x20from\x20local\x20cache\x20only','default':![]},{'name':a3_0x521e79(0x18c),'type':a3_0x521e79(0x19e),'description':'Force\x20remote\x20fetch\x20and\x20refresh\x20local\x20cache','default':![]}],async 'execute'(_0x15567d){const _0x31a218=a3_0x521e79,_0xca2739=_0x15567d['str'](_0x31a218(0x1b3))||_0x15567d[_0x31a218(0x199)]||getEnv()||_0x31a218(0x188),_0x4e3044=_0x15567d['bool'](_0x31a218(0x1a4)),_0x4d4cb8=_0x15567d['bool'](_0x31a218(0x18c)),{getRemoteAppList:_0x259137}=await import(_0x31a218(0x1a1)),_0xdf0b3=await _0x259137({'env':_0xca2739,'accessKey':_0x15567d[_0x31a218(0x1ca)],'localOnly':_0x4e3044,'noCache':_0x4d4cb8});return{'ok':!![],'data':{'total':_0xdf0b3[_0x31a218(0x195)][_0x31a218(0x1c7)],'env':_0xca2739,'source':_0xdf0b3[_0x31a218(0x192)],'fetchedAt':_0xdf0b3[_0x31a218(0x197)],'cachePath':_0xdf0b3[_0x31a218(0x1bb)]},'message':_0xdf0b3[_0x31a218(0x192)]===_0x31a218(0x1ac)?_0x31a218(0x1c3)+_0xdf0b3[_0x31a218(0x195)][_0x31a218(0x1c7)]+'\x20cached\x20app(s)\x20for\x20env=\x22'+_0xca2739+'\x22.':'Refreshed\x20app\x20cache\x20with\x20'+_0xdf0b3[_0x31a218(0x195)]['length']+_0x31a218(0x1ae)+_0xca2739+'\x22.'};}},useDef={'service':'app','command':a3_0x521e79(0x1bd),'description':a3_0x521e79(0x19b),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'name','description':'Remote\x20app\x20name\x20to\x20activate','required':!![]}],'flags':[GLOBAL_FLAG],async 'validate'(_0x251f39){const _0x56db65=a3_0x521e79;if(!_0x251f39['args'][0x0])throw CliErrors['validation']('Missing\x20app\x20name.','Usage:\x20'+CLI_BIN_NAME+_0x56db65(0x1c5));},async 'execute'(_0x4c2e9f){const _0x12e1b0=a3_0x521e79;warnDeprecatedAppCommand(_0x12e1b0(0x1bd),CLI_BIN_NAME+_0x12e1b0(0x18b));const _0x9cd599=_0x4c2e9f['args'][0x0];if(!_0x9cd599)throw CliErrors['validation'](_0x12e1b0(0x1a0),_0x12e1b0(0x18d)+CLI_BIN_NAME+_0x12e1b0(0x1c5));const {buildConfigFromFlags:_0x1eb728,resolveLocalAppAliasCode:_0x34ebe1}=await import(_0x12e1b0(0x196)),{readCachedAppList:_0x27c328}=await import(_0x12e1b0(0x198)),_0x238213=_0x4c2e9f[_0x12e1b0(0x189)](_0x12e1b0(0x1b3)),_0x3b1cd3=_0x1eb728(_0x238213?{'env':_0x238213}:{}),_0x2b942e=_0x27c328(_0x3b1cd3['env'],_0x3b1cd3[_0x12e1b0(0x1ca)]),_0x124dab=_0x2b942e?.[_0x12e1b0(0x195)]['find'](_0x1698f7=>_0x1698f7[_0x12e1b0(0x18e)]===_0x9cd599),_0x546229=_0x34ebe1(_0x3b1cd3['raw']??{},_0x9cd599);if(_0x124dab&&!isRuntimeAccessibleApp(_0x124dab))throw runtimeInaccessibleAppError(_0x124dab,'\x22'+_0x9cd599+'\x22');if(_0x546229){const _0x270993=_0x2b942e?.[_0x12e1b0(0x195)]['find'](_0xef3bb9=>_0xef3bb9[_0x12e1b0(0x1b9)]?.[_0x12e1b0(0x1ad)]()===_0x546229);if(_0x270993&&!isRuntimeAccessibleApp(_0x270993))throw runtimeInaccessibleAppError(_0x270993,'\x22'+_0x9cd599+'\x22');}if(!_0x124dab&&!_0x546229&&_0x3b1cd3[_0x12e1b0(0x1cb)]!==_0x9cd599){const _0x1a72a=[..._0x2b942e?.[_0x12e1b0(0x195)]['map'](_0x349f9e=>_0x349f9e[_0x12e1b0(0x18e)])??[]],_0x222f3c=_0x1a72a[_0x12e1b0(0x1c7)]===0x0?_0x12e1b0(0x1af)+CLI_BIN_NAME+_0x12e1b0(0x191)+_0x9cd599+_0x12e1b0(0x1c1):_0x12e1b0(0x194)+Array['from'](new Set(_0x1a72a))[_0x12e1b0(0x183)](',\x20')+'.\x20Local\x20aliases\x20can\x20be\x20added\x20under\x20apps.<alias>.appcode.';throw CliErrors['validation'](_0x12e1b0(0x1b8)+_0x9cd599+'\x22\x20not\x20found.',_0x222f3c);}const _0x5f0975=_0x4c2e9f['bool'](_0x12e1b0(0x19c));let _0x412622;if(_0x5f0975)_0x412622={'global':!![]};else{const {isInProject:_0x3f1a47}=await import(_0x12e1b0(0x196)),_0x4e4843=_0x3f1a47();_0x412622=toScopeFlags(resolveConfigScope({'explicitGlobal':![],'policy':_0x12e1b0(0x1ba),'inProject':_0x4e4843}));}const _0x259c96=readConfig(_0x412622);return _0x259c96['defaultApp']=_0x9cd599,writeConfig(_0x259c96,_0x412622),{'ok':!![],'message':_0x12e1b0(0x181)+_0x9cd599+'\x22'+scopeLabel(_0x412622)+'.'};}};function warnDeprecatedAppCommand(_0x1e4857,_0x426f6b){const _0x20a694=a3_0x521e79;console['warn'](CLI_BIN_NAME+_0x20a694(0x18a)+_0x1e4857+_0x20a694(0x1b1)+_0x426f6b+'`\x20instead.');}const importDef={'service':a3_0x521e79(0x1a5),'command':a3_0x521e79(0x1a2),'description':'Import\x20the\x20default\x20app\x20selection\x20from\x20a\x20.rabetbase.json\x20file','risk':a3_0x521e79(0x17e),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':initImportFlagDefs,async 'execute'(_0x3a7d9f){return await runInitImport(collectFlags(_0x3a7d9f,initImportFlagDefs)),{'ok':!![]};}};export const appDefinitions=[initDef,listDef,pullDef,useDef,importDef];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Runtime app eligibility helpers.
|
|
3
|
+
*
|
|
4
|
+
* The platform app directory can return apps that are visible to the current AK
|
|
5
|
+
* but not published yet. Runtime CLI commands must only treat published apps as
|
|
6
|
+
* AI-accessible business data targets.
|
|
7
|
+
*/
|
|
8
|
+
import type { RemoteAppItem } from "../../commands/app/remote-source.js";
|
|
9
|
+
type AppPublishStatusLike = Pick<RemoteAppItem, "appPublishStatus">;
|
|
10
|
+
export declare function normalizeAppPublishStatus(status: unknown): string | null;
|
|
11
|
+
export declare function isRuntimeAccessibleApp(item: AppPublishStatusLike): boolean;
|
|
12
|
+
export declare function filterRuntimeAccessibleApps<T extends AppPublishStatusLike>(items: T[]): T[];
|
|
13
|
+
export declare function findAppByName(items: RemoteAppItem[], name: string): RemoteAppItem | undefined;
|
|
14
|
+
export declare function findAppByCode(items: RemoteAppItem[], appCode: string): RemoteAppItem | undefined;
|
|
15
|
+
export declare function runtimeInaccessibleAppError(item: RemoteAppItem, selector: string): import("../../errors.js").CliError;
|
|
16
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x36d799,_0x33764d){const _0x19f475=a4_0x2aaf,_0x3bc334=_0x36d799();while(!![]){try{const _0x2b97ef=-parseInt(_0x19f475(0x1d3))/0x1+-parseInt(_0x19f475(0x1da))/0x2+parseInt(_0x19f475(0x1d0))/0x3+parseInt(_0x19f475(0x1d8))/0x4+-parseInt(_0x19f475(0x1d4))/0x5*(-parseInt(_0x19f475(0x1de))/0x6)+-parseInt(_0x19f475(0x1d6))/0x7*(parseInt(_0x19f475(0x1cd))/0x8)+-parseInt(_0x19f475(0x1dc))/0x9;if(_0x2b97ef===_0x33764d)break;else _0x3bc334['push'](_0x3bc334['shift']());}catch(_0x39eac2){_0x3bc334['push'](_0x3bc334['shift']());}}}(a4_0x2cb6,0x79854));import{CLI_BIN_NAME}from'../../constant/cli.js';import{RUNTIME_ACCESSIBLE_APP_STATUS}from'../../constant/app.js';import{CliErrors}from'../../errors.js';function a4_0x2cb6(){const _0x774992=['14021vFmtOj','Current\x20status:\x20','3793836vLBWfE','App\x20','454202iXeGWN','trim','3585051rRRMxs','find','180822lWCcxH','\x20is\x20not\x20available\x20for\x20runtime\x20AI\x20access.','3176fEhBmQ','.\x20Publish\x20the\x20app\x20before\x20using\x20','string','1528845cKNFkP','appPublishStatus','appCode','353394bXrFNS','135mzkZzm','UNKNOWN'];a4_0x2cb6=function(){return _0x774992;};return a4_0x2cb6();}function a4_0x2aaf(_0x453805,_0x276ce5){_0x453805=_0x453805-0x1cd;const _0x2cb656=a4_0x2cb6();let _0x2aaf7e=_0x2cb656[_0x453805];return _0x2aaf7e;}export function normalizeAppPublishStatus(_0x3b11fa){const _0x38aa55=a4_0x2aaf;if(typeof _0x3b11fa!==_0x38aa55(0x1cf))return null;const _0x33cef5=_0x3b11fa[_0x38aa55(0x1db)]();return _0x33cef5?_0x33cef5['toUpperCase']():null;}export function isRuntimeAccessibleApp(_0x34ae98){const _0xad0ecf=a4_0x2aaf;return normalizeAppPublishStatus(_0x34ae98[_0xad0ecf(0x1d1)])===RUNTIME_ACCESSIBLE_APP_STATUS;}export function filterRuntimeAccessibleApps(_0x158406){return _0x158406['filter'](isRuntimeAccessibleApp);}export function findAppByName(_0x148bd6,_0x5a5663){const _0x13547f=a4_0x2aaf;return _0x148bd6[_0x13547f(0x1dd)](_0x32c2a8=>_0x32c2a8['appName']===_0x5a5663);}export function findAppByCode(_0x109119,_0x52b1e9){const _0x22da1b=a4_0x2aaf,_0xf8293d=_0x52b1e9['trim']();if(!_0xf8293d)return undefined;return _0x109119[_0x22da1b(0x1dd)](_0x5d8bda=>_0x5d8bda[_0x22da1b(0x1d2)]?.['trim']()===_0xf8293d);}export function runtimeInaccessibleAppError(_0x33adfd,_0x2c99d9){const _0x36008e=a4_0x2aaf,_0x1ac236=normalizeAppPublishStatus(_0x33adfd[_0x36008e(0x1d1)])??_0x36008e(0x1d5);return CliErrors['validation'](_0x36008e(0x1d9)+_0x2c99d9+_0x36008e(0x1df),_0x36008e(0x1d7)+_0x1ac236+_0x36008e(0x1ce)+CLI_BIN_NAME+'\x20dataset/data/sql/bff\x20commands,\x20or\x20choose\x20a\x20published\x20app.');}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Mock data loader for app list — reads fixtures for offline development.
|
|
3
|
+
*
|
|
4
|
+
* Why a separate module: mock data is loaded in `remote-source.ts` when
|
|
5
|
+
* the product-scoped `APP_LIST_SOURCE=mock` env var is set. Isolating this to its own module
|
|
6
|
+
* makes it easy to verify which data sources are in play and to add new
|
|
7
|
+
* fixture files without touching the real API client.
|
|
8
|
+
*
|
|
9
|
+
* Design decision: module-level caching (`_cached`) — once a mock file is
|
|
10
|
+
* loaded, it stays in memory for the lifetime of the process. This avoids
|
|
11
|
+
* repeated filesystem reads during rapid command invocations.
|
|
12
|
+
*/
|
|
13
|
+
import type { RemoteAppItem } from "../../core/api-client.js";
|
|
14
|
+
/**
|
|
15
|
+
* The full API response shape returned by the app-list endpoint.
|
|
16
|
+
* Mirrors `getMyApps()` response structure so callers see identical types.
|
|
17
|
+
*/
|
|
18
|
+
export interface AppListResponse {
|
|
19
|
+
success: boolean;
|
|
20
|
+
msg: string;
|
|
21
|
+
errorMsg: string;
|
|
22
|
+
errorCode: string;
|
|
23
|
+
data: {
|
|
24
|
+
tableData: RemoteAppItem[];
|
|
25
|
+
tableColumns: unknown[];
|
|
26
|
+
};
|
|
27
|
+
params: unknown;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Returns the cached mock app list response (lazy-loaded once per process).
|
|
31
|
+
*
|
|
32
|
+
* @returns The full `AppListResponse` from the fixture file.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getMockAppList(): AppListResponse;
|
|
35
|
+
/**
|
|
36
|
+
* Returns just the app items from the mock fixture, matching `getMyApps()` return type.
|
|
37
|
+
*
|
|
38
|
+
* @returns `RemoteAppItem[]` from the mock fixture.
|
|
39
|
+
* @throws Error with `Mock API error:` prefix if the fixture indicates a failure.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getMockRemoteAppItems(): RemoteAppItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2203ee,_0x47bcc2){const _0x58ee46=a5_0x1d0b,_0x1c4aa6=_0x2203ee();while(!![]){try{const _0x544754=parseInt(_0x58ee46(0x1e3))/0x1+-parseInt(_0x58ee46(0x1f0))/0x2+-parseInt(_0x58ee46(0x1e8))/0x3*(parseInt(_0x58ee46(0x1f2))/0x4)+parseInt(_0x58ee46(0x1e7))/0x5*(parseInt(_0x58ee46(0x1ef))/0x6)+-parseInt(_0x58ee46(0x1f1))/0x7*(parseInt(_0x58ee46(0x1ea))/0x8)+-parseInt(_0x58ee46(0x1e5))/0x9*(-parseInt(_0x58ee46(0x1e2))/0xa)+-parseInt(_0x58ee46(0x1e6))/0xb*(-parseInt(_0x58ee46(0x1ee))/0xc);if(_0x544754===_0x47bcc2)break;else _0x1c4aa6['push'](_0x1c4aa6['shift']());}catch(_0x25d298){_0x1c4aa6['push'](_0x1c4aa6['shift']());}}}(a5_0x2ea5,0xb39bd));import{fileURLToPath}from'url';function a5_0x1d0b(_0x5f5d51,_0x53a23e){_0x5f5d51=_0x5f5d51-0x1e2;const _0x2ea568=a5_0x2ea5();let _0x1d0bbd=_0x2ea568[_0x5f5d51];return _0x1d0bbd;}import{dirname,join}from'path';import{readFileSync}from'fs';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);function loadMockAppList(){const _0x5a5923=a5_0x1d0b,_0x335869=join(__dirname,_0x5a5923(0x1f3)),_0x191362=readFileSync(_0x335869,'utf-8');return JSON[_0x5a5923(0x1ec)](_0x191362);}function a5_0x2ea5(){const _0x152235=['508519zJyNYp','3790555RAJgHP','3341736sNKYUQ','success','24vRWGdD','tableData','parse','Mock\x20API\x20error:\x20','36nRGWAM','6YTevsQ','1466886JzjzIv','899738UPTQjS','4ifQXAt','../../../mock/app-list.json','data','11340770JpYCDM','937759hCFRbP','errorCode','9lyZYea'];a5_0x2ea5=function(){return _0x152235;};return a5_0x2ea5();}let _cached=null;export function getMockAppList(){return!_cached&&(_cached=loadMockAppList()),_cached;}export function getMockRemoteAppItems(){const _0x1f2ff7=a5_0x1d0b,_0x37d0b7=getMockAppList();if(!_0x37d0b7[_0x1f2ff7(0x1e9)])throw new Error(_0x1f2ff7(0x1ed)+_0x37d0b7['errorMsg']+'\x20('+_0x37d0b7[_0x1f2ff7(0x1e4)]+')');return _0x37d0b7[_0x1f2ff7(0x1f4)][_0x1f2ff7(0x1eb)];}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Remote app list fetching — wires the API client to the cache layer.
|
|
3
|
+
*
|
|
4
|
+
* Why a separate module: `app list` and `app pull` both need to fetch remote apps
|
|
5
|
+
* with caching. Putting the fetch + cache logic here keeps those commands focused
|
|
6
|
+
* on their specific concerns (building the output, deciding scope).
|
|
7
|
+
*
|
|
8
|
+
* Cache fallback behavior: if a remote fetch fails and a cached result exists,
|
|
9
|
+
* the cached result is returned silently. This is intentional — `app list` should
|
|
10
|
+
* work even when offline, showing stale data rather than failing completely.
|
|
11
|
+
* `app pull --no-cache` bypasses this fallback.
|
|
12
|
+
*/
|
|
13
|
+
import { type RemoteAppItem } from "../../core/api-client.js";
|
|
14
|
+
export type { RemoteAppItem };
|
|
15
|
+
/**
|
|
16
|
+
* The result of a successful app list fetch, including provenance metadata.
|
|
17
|
+
*
|
|
18
|
+
* Why `source`: callers need to display where the data came from ("Loaded from cache"
|
|
19
|
+
* vs "Fetched from remote") so users understand staleness. `app list` and `app pull`
|
|
20
|
+
* both surface this in their output.
|
|
21
|
+
*/
|
|
22
|
+
export interface RemoteAppListResult {
|
|
23
|
+
/** App items returned by the source. */
|
|
24
|
+
items: RemoteAppItem[];
|
|
25
|
+
/** Where the data came from. */
|
|
26
|
+
source: "remote" | "cache" | "mock";
|
|
27
|
+
/** ISO timestamp of when this result was fetched (null for empty cache). */
|
|
28
|
+
fetchedAt: string | null;
|
|
29
|
+
/** Absolute path to the cache file, or null if no caching occurred. */
|
|
30
|
+
cachePath: string | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns `true` when the mock data source should be used instead of the real API.
|
|
34
|
+
*
|
|
35
|
+
* Why product env lookup: downstream builds can change the main env prefix in
|
|
36
|
+
* `PRODUCT_CONFIG` while still keeping optional legacy prefixes for migration.
|
|
37
|
+
*/
|
|
38
|
+
export declare function shouldUseMockRemoteApps(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Fetches app items from the appropriate source (mock or real API).
|
|
41
|
+
*
|
|
42
|
+
* @returns Raw `RemoteAppItem[]` from the selected source.
|
|
43
|
+
* @throws Propagates errors from `getMyApps()` on network/API failure.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getRemoteAppItems(): Promise<RemoteAppItem[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Fetches the remote app list with cache support.
|
|
48
|
+
*
|
|
49
|
+
* Resolution order:
|
|
50
|
+
* 1. `localOnly` → return cached data only (never hits the network)
|
|
51
|
+
* 2. Try remote → on success, write to cache
|
|
52
|
+
* 3. On failure + cached data exists → return stale cache (with `source: "cache"`)
|
|
53
|
+
* 4. On failure + no cache → propagate the error
|
|
54
|
+
*
|
|
55
|
+
* @param options.env - Target environment
|
|
56
|
+
* @param options.accessKey - Access key for cache file naming (omit to skip caching)
|
|
57
|
+
* @param options.localOnly - If true, never fetch remotely
|
|
58
|
+
* @param options.noCache - If true, skip cache fallback on network failure
|
|
59
|
+
* @returns `RemoteAppListResult` with items, source, and metadata
|
|
60
|
+
*/
|
|
61
|
+
export declare function getRemoteAppList(options: {
|
|
62
|
+
env: "production" | "development" | "daily";
|
|
63
|
+
accessKey?: string;
|
|
64
|
+
localOnly?: boolean;
|
|
65
|
+
noCache?: boolean;
|
|
66
|
+
}): Promise<RemoteAppListResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a6_0x6af9(_0x57ce96,_0x1a5bbb){_0x57ce96=_0x57ce96-0x64;const _0x4ca0ce=a6_0x4ca0();let _0x6af913=_0x4ca0ce[_0x57ce96];return _0x6af913;}function a6_0x4ca0(){const _0x7343fe=['489fazEJE','749wjZnOv','7986tGhjoJ','124564xiEqPK','trim','APP_LIST_SOURCE','4fZOmjF','2222TZuviC','remote','cache','24Efqfce','10doXMJR','toISOString','toLowerCase','fetchedAt','2031039aieoMY','307025NvQnix','1076216kKAzFj','mock','1157497AKfBiV'];a6_0x4ca0=function(){return _0x7343fe;};return a6_0x4ca0();}(function(_0x4b9fd5,_0x376040){const _0x1ce153=a6_0x6af9,_0x52f66e=_0x4b9fd5();while(!![]){try{const _0x21f266=-parseInt(_0x1ce153(0x6a))/0x1+parseInt(_0x1ce153(0x6e))/0x2*(parseInt(_0x1ce153(0x67))/0x3)+-parseInt(_0x1ce153(0x6d))/0x4*(-parseInt(_0x1ce153(0x77))/0x5)+-parseInt(_0x1ce153(0x69))/0x6*(parseInt(_0x1ce153(0x68))/0x7)+parseInt(_0x1ce153(0x64))/0x8+-parseInt(_0x1ce153(0x76))/0x9*(-parseInt(_0x1ce153(0x72))/0xa)+parseInt(_0x1ce153(0x66))/0xb*(-parseInt(_0x1ce153(0x71))/0xc);if(_0x21f266===_0x376040)break;else _0x52f66e['push'](_0x52f66e['shift']());}catch(_0x4dccda){_0x52f66e['push'](_0x52f66e['shift']());}}}(a6_0x4ca0,0x1e94d));import{getMyApps}from'../../core/api-client.js';import{getMockRemoteAppItems}from'../../commands/app/mock-loader.js';import{getAppCacheFilePath,readCachedAppList,writeCachedAppList}from'../../commands/app/cache.js';import{productEnv}from'../../constant/product.js';export function shouldUseMockRemoteApps(){const _0x3c5c89=a6_0x6af9,_0x2b1703=(productEnv(_0x3c5c89(0x6c))||'')[_0x3c5c89(0x6b)]()[_0x3c5c89(0x74)]();return _0x2b1703===_0x3c5c89(0x65);}export async function getRemoteAppItems(){if(shouldUseMockRemoteApps())return getMockRemoteAppItems();return getMyApps();}export async function getRemoteAppList(_0x4322e1){const _0x1a9cf6=a6_0x6af9,{env:_0x445624,accessKey:_0x9c97fe,localOnly:localOnly=![],noCache:noCache=![]}=_0x4322e1,_0x264ceb=readCachedAppList(_0x445624,_0x9c97fe),_0x22d4bd=_0x9c97fe?.['trim']()?getAppCacheFilePath(_0x445624,_0x9c97fe):null;if(localOnly)return{'items':_0x264ceb?.['items']??[],'source':'cache','fetchedAt':_0x264ceb?.[_0x1a9cf6(0x75)]??null,'cachePath':_0x22d4bd};try{const _0x1216d4=await getRemoteAppItems(),_0x4c2f88=shouldUseMockRemoteApps()?'mock':_0x1a9cf6(0x6f),_0x59f46a=new Date()[_0x1a9cf6(0x73)](),_0x3b6039=_0x9c97fe?.[_0x1a9cf6(0x6b)]()?writeCachedAppList(_0x445624,_0x9c97fe,{'env':_0x445624,'fetchedAt':_0x59f46a,'source':_0x4c2f88,'items':_0x1216d4}):null;return{'items':_0x1216d4,'source':_0x4c2f88,'fetchedAt':_0x59f46a,'cachePath':_0x3b6039};}catch(_0xea7971){if(!noCache&&_0x264ceb)return{'items':_0x264ceb['items'],'source':_0x1a9cf6(0x70),'fetchedAt':_0x264ceb[_0x1a9cf6(0x75)],'cachePath':_0x22d4bd};throw _0xea7971;}}
|