@lovrabet/lovrabet-cli 2.1.17 → 2.1.18-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.d.ts +21 -0
- package/lib/cli.js +1 -1
- package/lib/commands/api-doc/index.d.ts +38 -0
- package/lib/commands/api-doc/index.js +1 -1
- package/lib/commands/app/cache.d.ts +61 -0
- package/lib/commands/app/cache.js +1 -1
- package/lib/commands/app/definitions.d.ts +26 -0
- package/lib/commands/app/definitions.js +1 -1
- package/lib/commands/app/eligibility.d.ts +16 -0
- package/lib/commands/app/eligibility.js +1 -1
- package/lib/commands/app/mock-loader.d.ts +41 -0
- package/lib/commands/app/mock-loader.js +1 -1
- package/lib/commands/app/remote-source.d.ts +66 -0
- package/lib/commands/app/remote-source.js +1 -1
- package/lib/commands/app/shared.d.ts +38 -0
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/get.d.ts +2 -0
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.d.ts +2 -0
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/artifact/index.d.ts +9 -0
- package/lib/commands/artifact/index.js +1 -1
- package/lib/commands/auth/device.d.ts +31 -0
- package/lib/commands/auth/device.js +1 -1
- package/lib/commands/auth/index.d.ts +23 -0
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/auth/prompt.d.ts +33 -0
- package/lib/commands/auth/prompt.js +1 -1
- package/lib/commands/bff/detail.d.ts +8 -0
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/exec.d.ts +19 -0
- package/lib/commands/bff/exec.js +1 -1
- package/lib/commands/bff/index.d.ts +15 -0
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/cli-skill/index.d.ts +9 -0
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/common/config-policy.d.ts +80 -0
- package/lib/commands/common/config-policy.js +1 -1
- package/lib/commands/common/constraints.d.ts +67 -0
- package/lib/commands/common/constraints.js +1 -1
- package/lib/commands/common/flags.d.ts +41 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.d.ts +6 -0
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/config/definitions.d.ts +21 -0
- package/lib/commands/config/definitions.js +1 -1
- package/lib/commands/config/shared.d.ts +17 -0
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/index.d.ts +27 -0
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/dataset/detail.d.ts +26 -0
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.d.ts +10 -0
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.d.ts +18 -0
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/sdk-doc.d.ts +6 -0
- package/lib/commands/dataset/sdk-doc.js +1 -1
- package/lib/commands/doctor.d.ts +23 -0
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.d.ts +2 -0
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init.d.ts +32 -0
- package/lib/commands/init.js +1 -1
- package/lib/commands/kb/index.d.ts +8 -0
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/logs/index.d.ts +20 -0
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/ocr/index.d.ts +2 -0
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/personal-bff/index.d.ts +5 -0
- package/lib/commands/personal-bff/index.js +1 -1
- package/lib/commands/registry.d.ts +56 -0
- package/lib/commands/registry.js +1 -1
- package/lib/commands/schedule/index.d.ts +2 -0
- package/lib/commands/schedule/index.js +1 -0
- package/lib/commands/schema.d.ts +18 -0
- package/lib/commands/schema.js +1 -1
- package/lib/commands/service/dynamic.d.ts +18 -0
- package/lib/commands/service/dynamic.js +1 -1
- package/lib/commands/service/function-name-adapter.d.ts +13 -0
- package/lib/commands/service/function-name-adapter.js +1 -1
- package/lib/commands/service/index.d.ts +2 -0
- package/lib/commands/service/index.js +1 -1
- package/lib/commands/service/registry.d.ts +102 -0
- package/lib/commands/service/registry.js +1 -1
- package/lib/commands/skill/commands/create.d.ts +2 -0
- package/lib/commands/skill/commands/create.js +1 -1
- package/lib/commands/skill/commands/install.d.ts +2 -0
- package/lib/commands/skill/commands/install.js +1 -1
- package/lib/commands/skill/commands/list.d.ts +2 -0
- package/lib/commands/skill/commands/list.js +1 -1
- package/lib/commands/skill/commands/push.d.ts +2 -0
- package/lib/commands/skill/commands/push.js +1 -1
- package/lib/commands/skill/commands/validate.d.ts +2 -0
- package/lib/commands/skill/commands/validate.js +1 -1
- package/lib/commands/skill/flags.d.ts +13 -0
- package/lib/commands/skill/flags.js +1 -1
- package/lib/commands/skill/index.d.ts +9 -0
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/skill/manifest-helpers.d.ts +5 -0
- package/lib/commands/skill/manifest-helpers.js +1 -1
- package/lib/commands/skill/push-execute.d.ts +49 -0
- package/lib/commands/skill/push-execute.js +1 -1
- package/lib/commands/skill/push-flow-helpers.d.ts +80 -0
- package/lib/commands/skill/push-flow-helpers.js +1 -1
- package/lib/commands/skill/push-retarget.d.ts +9 -0
- package/lib/commands/skill/push-retarget.js +1 -1
- package/lib/commands/skill/scopes.d.ts +13 -0
- package/lib/commands/skill/scopes.js +1 -1
- package/lib/commands/skill/summary.d.ts +6 -0
- package/lib/commands/skill/summary.js +1 -1
- package/lib/commands/skill/templates.d.ts +23 -0
- package/lib/commands/skill/templates.js +1 -1
- package/lib/commands/skill/validate.d.ts +20 -0
- package/lib/commands/skill/validate.js +1 -1
- package/lib/commands/sql/detail.d.ts +13 -0
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.d.ts +21 -0
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.d.ts +9 -0
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/update.d.ts +10 -0
- package/lib/commands/update.js +1 -1
- package/lib/commands/workspace/index.d.ts +10 -0
- package/lib/commands/workspace/index.js +1 -1
- package/lib/config/schema.d.ts +108 -0
- package/lib/config/schema.js +1 -1
- package/lib/constant/app.d.ts +13 -0
- package/lib/constant/app.js +1 -1
- package/lib/constant/auth-mode.d.ts +28 -0
- package/lib/constant/auth-mode.js +1 -1
- package/lib/constant/cli.d.ts +86 -0
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.d.ts +45 -0
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/distribution.d.ts +12 -0
- package/lib/constant/distribution.js +1 -1
- package/lib/constant/domain.d.ts +57 -0
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.d.ts +56 -0
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.d.ts +13 -0
- package/lib/constant/output.js +1 -1
- package/lib/constant/product.d.ts +79 -0
- package/lib/constant/product.js +1 -1
- package/lib/constant/risk.d.ts +14 -0
- package/lib/constant/risk.js +1 -1
- package/lib/constant/url.d.ts +14 -0
- package/lib/constant/url.js +1 -1
- package/lib/context.d.ts +287 -0
- package/lib/context.js +1 -1
- package/lib/core/api-client.d.ts +451 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/db-resolver.d.ts +39 -0
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/sdk-client.d.ts +62 -0
- package/lib/core/sdk-client.js +1 -1
- package/lib/errors.d.ts +25 -0
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.d.ts +24 -0
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/dryrun.d.ts +64 -0
- package/lib/framework/dryrun.js +1 -1
- package/lib/framework/flags.d.ts +19 -0
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.d.ts +21 -0
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.d.ts +10 -0
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.d.ts +10 -0
- package/lib/framework/output.js +1 -1
- package/lib/framework/preparse.d.ts +64 -0
- package/lib/framework/preparse.js +1 -1
- package/lib/framework/rate-limit.d.ts +10 -0
- package/lib/framework/rate-limit.js +1 -1
- package/lib/framework/response.d.ts +10 -0
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-confirmation.d.ts +46 -0
- package/lib/framework/runner-confirmation.js +1 -1
- package/lib/framework/runner-error.d.ts +28 -0
- package/lib/framework/runner-error.js +1 -1
- package/lib/framework/runner.d.ts +102 -0
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.d.ts +29 -0
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/service-order.d.ts +4 -0
- package/lib/framework/service-order.js +1 -1
- package/lib/framework/types.d.ts +108 -0
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -0
- package/lib/generated/build-info.js +1 -1
- package/lib/help.d.ts +25 -0
- package/lib/help.js +1 -1
- package/lib/runtime/event.d.ts +16 -0
- package/lib/runtime/event.js +1 -0
- package/lib/runtime/index.d.ts +13 -0
- package/lib/runtime/index.js +1 -0
- package/lib/runtime/queue.d.ts +6 -0
- package/lib/runtime/queue.js +1 -0
- package/lib/runtime/resolve.d.ts +14 -0
- package/lib/runtime/resolve.js +1 -0
- package/lib/runtime/types.d.ts +59 -0
- package/lib/runtime/types.js +1 -0
- package/lib/skills/npx-skills-add.d.ts +42 -0
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/runtime-skill-sync/constants.d.ts +4 -0
- package/lib/skills/runtime-skill-sync/constants.js +1 -1
- package/lib/skills/runtime-skill-sync/fs-utils.d.ts +21 -0
- package/lib/skills/runtime-skill-sync/fs-utils.js +1 -1
- package/lib/skills/runtime-skill-sync/hashing.d.ts +9 -0
- package/lib/skills/runtime-skill-sync/hashing.js +1 -1
- package/lib/skills/runtime-skill-sync/links.d.ts +18 -0
- package/lib/skills/runtime-skill-sync/links.js +1 -1
- package/lib/skills/runtime-skill-sync/list-local.d.ts +3 -0
- package/lib/skills/runtime-skill-sync/list-local.js +1 -1
- package/lib/skills/runtime-skill-sync/local-files.d.ts +25 -0
- package/lib/skills/runtime-skill-sync/local-files.js +1 -1
- package/lib/skills/runtime-skill-sync/materialize.d.ts +11 -0
- package/lib/skills/runtime-skill-sync/materialize.js +1 -1
- package/lib/skills/runtime-skill-sync/metadata.d.ts +7 -0
- package/lib/skills/runtime-skill-sync/metadata.js +1 -1
- package/lib/skills/runtime-skill-sync/paths.d.ts +11 -0
- package/lib/skills/runtime-skill-sync/paths.js +1 -1
- package/lib/skills/runtime-skill-sync/push.d.ts +33 -0
- package/lib/skills/runtime-skill-sync/push.js +1 -1
- package/lib/skills/runtime-skill-sync/scopes.d.ts +5 -0
- package/lib/skills/runtime-skill-sync/scopes.js +1 -1
- package/lib/skills/runtime-skill-sync/types.d.ts +105 -0
- package/lib/skills/runtime-skill-sync/zip-codec.d.ts +9 -0
- package/lib/skills/runtime-skill-sync/zip-codec.js +1 -1
- package/lib/skills/runtime-skill-sync/zip-package.d.ts +15 -0
- package/lib/skills/runtime-skill-sync/zip-package.js +1 -1
- package/lib/skills/runtime-skill-sync.d.ts +15 -0
- package/lib/skills/runtime-skill-sync.js +1 -1
- package/lib/utils/apply-jq-filter.d.ts +25 -0
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/logger.d.ts +73 -0
- package/lib/utils/logger.js +1 -1
- package/lib/utils/lossless-json.d.ts +21 -0
- package/lib/utils/lossless-json.js +1 -1
- package/lib/utils/params.d.ts +65 -0
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.d.ts +17 -0
- package/lib/utils/platform.js +1 -1
- package/lib/utils/update-notice.d.ts +10 -0
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.d.ts +18 -0
- package/lib/utils/version.js +1 -1
- package/lib/utils/write-cli-side-channel.d.ts +6 -0
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Database resolver for SQL detail display.
|
|
3
|
+
*
|
|
4
|
+
* Why a separate module: `sql detail` shows the database name alongside the SQL
|
|
5
|
+
* metadata, but the database name is only available from the dataset list API
|
|
6
|
+
* (which includes `dbtableConfig.dbName`). Rather than importing `listDatasets`
|
|
7
|
+
* into `sql/exec.ts`, we centralize the dbName resolution here so both
|
|
8
|
+
* `sql detail` and any future command that needs dbName can use it.
|
|
9
|
+
*
|
|
10
|
+
* Design decision: `getDbName` silently returns `undefined` on error.
|
|
11
|
+
* Why: the AK that gives access to SQL queries may not have permission to
|
|
12
|
+
* list datasets. In that case, `sql detail` should still show the dbId
|
|
13
|
+
* number rather than crashing. The caller (`sql detail`) handles the
|
|
14
|
+
* `undefined` case by falling back to showing the raw dbId.
|
|
15
|
+
*
|
|
16
|
+
* The cache is keyed by `appCode` because different apps have different
|
|
17
|
+
* datasets and thus different database names.
|
|
18
|
+
*/
|
|
19
|
+
/** A resolved database entry from the dataset list. */
|
|
20
|
+
export interface DbEntry {
|
|
21
|
+
dbId: number;
|
|
22
|
+
dbName: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Lists all databases accessible to an app (from dataset metadata).
|
|
26
|
+
* Results are cached per app to avoid repeated API calls.
|
|
27
|
+
*/
|
|
28
|
+
export declare function listDatabases(appCode: string): Promise<DbEntry[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Resolves a database ID to its display name.
|
|
31
|
+
*
|
|
32
|
+
* @returns The dbName if found; `undefined` if not found (e.g. permission denied).
|
|
33
|
+
*
|
|
34
|
+
* Why return undefined instead of throwing: callers (like `sql detail`) should
|
|
35
|
+
* degrade gracefully and show the dbId number when the name can't be resolved.
|
|
36
|
+
* This matches the principle that permission errors on auxiliary data should
|
|
37
|
+
* not block the primary operation.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getDbName(appCode: string, dbId: number): Promise<string | undefined>;
|
package/lib/core/db-resolver.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4ce971,_0x560930){const _0x54ca53=a77_0x4fb7,_0x19398e=_0x4ce971();while(!![]){try{const _0x373ed7=-parseInt(_0x54ca53(0x93))/0x1+parseInt(_0x54ca53(0x9a))/0x2+parseInt(_0x54ca53(0x95))/0x3+parseInt(_0x54ca53(0x92))/0x4*(-parseInt(_0x54ca53(0xa3))/0x5)+parseInt(_0x54ca53(0x9c))/0x6*(parseInt(_0x54ca53(0x94))/0x7)+parseInt(_0x54ca53(0x97))/0x8*(parseInt(_0x54ca53(0x99))/0x9)+parseInt(_0x54ca53(0x9e))/0xa*(-parseInt(_0x54ca53(0x9b))/0xb);if(_0x373ed7===_0x560930)break;else _0x19398e['push'](_0x19398e['shift']());}catch(_0x2f8df6){_0x19398e['push'](_0x19398e['shift']());}}}(a77_0x538e,0x99862));import{listDatasets}from'../core/api-client.js';function a77_0x4fb7(_0x2193a0,_0x5e004b){_0x2193a0=_0x2193a0-0x91;const _0x538e28=a77_0x538e();let _0x4fb7c9=_0x538e28[_0x2193a0];return _0x4fb7c9;}function a77_0x538e(){const _0x2c9585=['dbName','60AwHrzw','set','275764FstSYQ','396663vOZkGR','294uaXuqd','2634426NTLFEZ','map','3136gjJPWh','dbtableConfig','26046JjWvan','576758yvRZju','9426164SMBilH','58392QhjHqe','get','10BhRBMi','entries','find','dbId'];a77_0x538e=function(){return _0x2c9585;};return a77_0x538e();}const cache=new Map();export async function listDatabases(_0x34bb19){const _0x2ec1ec=a77_0x4fb7;if(cache['has'](_0x34bb19))return cache[_0x2ec1ec(0x9d)](_0x34bb19);const _0x12c923=await listDatasets(_0x34bb19),_0x4d7a9f=new Map();for(const _0x4479ad of _0x12c923){const _0x5892eb=_0x4479ad[_0x2ec1ec(0x98)];_0x5892eb?.[_0x2ec1ec(0xa1)]!=null&&_0x4d7a9f['set'](_0x5892eb[_0x2ec1ec(0xa1)],_0x5892eb[_0x2ec1ec(0xa2)]??'db-'+_0x5892eb[_0x2ec1ec(0xa1)]);}const _0x44bf2b=[..._0x4d7a9f[_0x2ec1ec(0x9f)]()][_0x2ec1ec(0x96)](([_0x29a413,_0xac6039])=>({'dbId':_0x29a413,'dbName':_0xac6039}));return cache[_0x2ec1ec(0x91)](_0x34bb19,_0x44bf2b),_0x44bf2b;}export async function getDbName(_0x31740a,_0x2a6a84){const _0x57756a=a77_0x4fb7;try{const _0x288eda=await listDatabases(_0x31740a);return _0x288eda[_0x57756a(0xa0)](_0x122e9c=>_0x122e9c[_0x57756a(0xa1)]===_0x2a6a84)?.[_0x57756a(0xa2)];}catch{return undefined;}}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview SDK client for runtime operations (data, SQL, BFF execution).
|
|
3
|
+
*
|
|
4
|
+
* Why a separate SDK client: the `@lovrabet/sdk` encapsulates the runtime engine's
|
|
5
|
+
* API surface. Unlike the raw `fetch`-based management API (`api-client.ts`),
|
|
6
|
+
* the SDK handles:
|
|
7
|
+
* - Client lifecycle (creation, initialization)
|
|
8
|
+
* - Per-operation routing (data operations vs. SQL vs. BFF)
|
|
9
|
+
* - SDK-specific conventions (model keys, parameter extraction)
|
|
10
|
+
*
|
|
11
|
+
* Why the SDK is initialized in `prepare` and stored as a module-level variable:
|
|
12
|
+
* creating the SDK client involves network setup and type registration. Storing
|
|
13
|
+
* it globally avoids passing it through every function call. The `finalize` hook
|
|
14
|
+
* clears it to prevent cross-command contamination.
|
|
15
|
+
*
|
|
16
|
+
* Design decision: `executeData` uses dynamic model key lookup
|
|
17
|
+
* (`dataset_${code}`) rather than requiring pre-registered models. This matches
|
|
18
|
+
* the Lovrabet SDK's dynamic model convention and avoids a registration step
|
|
19
|
+
* in `prepare`.
|
|
20
|
+
*/
|
|
21
|
+
import type { AuthMode } from "../constant/auth-mode.js";
|
|
22
|
+
/** Options for initializing the SDK client. */
|
|
23
|
+
export interface SdkClientOptions {
|
|
24
|
+
appCode: string;
|
|
25
|
+
env: "production" | "development" | "daily";
|
|
26
|
+
accessKey?: string;
|
|
27
|
+
authMode?: AuthMode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Initializes the global SDK client for subsequent runtime operations.
|
|
31
|
+
*
|
|
32
|
+
* Why `initSdkClient` is idempotent: `prepare` is called for every command, and
|
|
33
|
+
* commands may share the same app/env/AK combination. Calling `createClient`
|
|
34
|
+
* multiple times with the same params is wasteful. The module-level `_client`
|
|
35
|
+
* variable ensures only one client instance exists at a time.
|
|
36
|
+
*/
|
|
37
|
+
export declare function initSdkClient(opts: SdkClientOptions): void;
|
|
38
|
+
/** Clears the SDK client and restores process-wide patches installed for it. */
|
|
39
|
+
export declare function clearSdkClient(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Executes a data operation on a dataset via the SDK.
|
|
42
|
+
*
|
|
43
|
+
* Why model access by key (`dataset_${datasetCode}`): Lovrabet's SDK uses
|
|
44
|
+
* a dynamic model registry where each dataset is accessible as `models.dataset_<code>`.
|
|
45
|
+
* This avoids requiring the SDK to know all dataset codes upfront.
|
|
46
|
+
*
|
|
47
|
+
* Parameter extraction conventions:
|
|
48
|
+
* - `filter(params)` — params passed directly
|
|
49
|
+
* - `getOne(id | {id})` — extract `id` from params
|
|
50
|
+
* - `update(id, data)` — extract `id`, pass rest as data
|
|
51
|
+
* - `delete(id)` — extract `id` from params
|
|
52
|
+
* - `batchCreate(items[])` — normalize params (array or `{ items: [...] }`)
|
|
53
|
+
* - `aggregate(params)` — params passed after normalizing deprecated `aggregate[].field` to `column`
|
|
54
|
+
*
|
|
55
|
+
* These conventions match the Lovrabet API's request body structure and
|
|
56
|
+
* were derived from the SDK's internal expectations.
|
|
57
|
+
*/
|
|
58
|
+
export declare function executeData(datasetCode: string, operation: string, params?: Record<string, any> | unknown[]): Promise<any>;
|
|
59
|
+
/** Executes a stored SQL query via the SDK. */
|
|
60
|
+
export declare function executeSdkSql(sqlCode: string, params?: Record<string, string | number>): Promise<any>;
|
|
61
|
+
/** Executes a BFF script via the SDK. */
|
|
62
|
+
export declare function executeSdkBff(functionName: string, params?: Record<string, any>): Promise<any>;
|
package/lib/core/sdk-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3d7dd4,_0x1498c1){const _0x4dfa0b=a78_0x318b,_0x244a0b=_0x3d7dd4();while(!![]){try{const _0xed829=parseInt(_0x4dfa0b(0xdc))/0x1*(parseInt(_0x4dfa0b(0xdf))/0x2)+parseInt(_0x4dfa0b(0xd8))/0x3*(parseInt(_0x4dfa0b(0xd9))/0x4)+-parseInt(_0x4dfa0b(0xe4))/0x5*(-parseInt(_0x4dfa0b(0xce))/0x6)+-parseInt(_0x4dfa0b(0xed))/0x7+parseInt(_0x4dfa0b(0xe0))/0x8*(-parseInt(_0x4dfa0b(0xc9))/0x9)+parseInt(_0x4dfa0b(0xde))/0xa+-parseInt(_0x4dfa0b(0xd1))/0xb*(-parseInt(_0x4dfa0b(0xee))/0xc);if(_0xed829===_0x1498c1)break;else _0x244a0b['push'](_0x244a0b['shift']());}catch(_0x57b3b0){_0x244a0b['push'](_0x244a0b['shift']());}}}(a78_0x4360,0x38f25));import{createClient}from'@lovrabet/sdk';import{PRODUCT_CONFIG}from'../constant/product.js';import{CliErrors}from'../errors.js';import{parseBatchCreateItemsFromParams}from'../utils/params.js';import{installLosslessJsonResponseParser}from'../utils/lossless-json.js';let _client,restoreResponseJsonParser;export function initSdkClient(_0x16289e){const _0x254c20=a78_0x318b;restoreResponseJsonParser??=installLosslessJsonResponseParser();try{_client=createClient({'appCode':_0x16289e[_0x254c20(0xc8)],'env':_0x16289e[_0x254c20(0xd5)],'authMode':_0x16289e[_0x254c20(0xeb)],..._0x16289e[_0x254c20(0xd4)]?{'accessKey':_0x16289e[_0x254c20(0xd4)]}:{},'options':{'timeout':0x7530,'headers':{'X-Invoke-Source':PRODUCT_CONFIG[_0x254c20(0xe5)]}}});}catch(_0x470f73){clearSdkClient();throw _0x470f73;}}export function clearSdkClient(){_client=undefined,restoreResponseJsonParser?.(),restoreResponseJsonParser=undefined;}function ensureClient(){if(!_client)throw new Error('SDK\x20client\x20not\x20initialized.\x20Call\x20initSdkClient()\x20first.');return _client;}function normalizeAggregateParams(_0x173cc0){const _0x54f6b9=a78_0x318b,_0x4fa34b=_0x173cc0[_0x54f6b9(0xcc)];if(_0x4fa34b===undefined)return _0x173cc0;if(!Array[_0x54f6b9(0xdb)](_0x4fa34b))throw CliErrors[_0x54f6b9(0xe2)](_0x54f6b9(0xe3));return{..._0x173cc0,'aggregate':_0x4fa34b[_0x54f6b9(0xcb)]((_0x3fbbb6,_0x4592f1)=>{const _0x21025e=_0x54f6b9;if(!_0x3fbbb6||typeof _0x3fbbb6!==_0x21025e(0xe9)||Array[_0x21025e(0xdb)](_0x3fbbb6))throw CliErrors[_0x21025e(0xe2)](_0x21025e(0xcd)+_0x4592f1+_0x21025e(0xd0));const _0x62b2cd=_0x3fbbb6[_0x21025e(0xc7)]??_0x3fbbb6[_0x21025e(0xca)];if(typeof _0x62b2cd!==_0x21025e(0xec)||_0x62b2cd[_0x21025e(0xea)]()==='')throw CliErrors['validation'](_0x21025e(0xcd)+_0x4592f1+_0x21025e(0xdd));const _0x452a0a={..._0x3fbbb6,'column':_0x62b2cd};return delete _0x452a0a[_0x21025e(0xca)],_0x452a0a;})};}function a78_0x318b(_0x50e7ec,_0x57f6eb){_0x50e7ec=_0x50e7ec-0xc7;const _0x4360f6=a78_0x4360();let _0x318b94=_0x4360f6[_0x50e7ec];return _0x318b94;}export async function executeData(_0x4e79d9,_0x49e1be,_0x30e3a3){const _0x426583=a78_0x318b,_0x230a7f=ensureClient(),_0x53e956='dataset_'+_0x4e79d9,_0x7f3300=_0x230a7f['models'][_0x53e956];if(!_0x7f3300||typeof _0x7f3300[_0x49e1be]!==_0x426583(0xda))throw new Error('SDK\x20model\x20does\x20not\x20support\x20operation\x20\x22'+_0x49e1be+_0x426583(0xe7)+'Available:\x20filter,\x20getOne,\x20create,\x20batchCreate,\x20update,\x20delete,\x20aggregate.');if(_0x49e1be===_0x426583(0xd3))return _0x7f3300[_0x426583(0xd3)](parseBatchCreateItemsFromParams(_0x30e3a3));const _0x4733c0=_0x30e3a3!==undefined&&_0x30e3a3!==null&&!Array['isArray'](_0x30e3a3)?_0x30e3a3:{};switch(_0x49e1be){case _0x426583(0xef):{const _0x39804f=_0x4733c0['id'];if(_0x39804f===undefined||_0x39804f===null)throw new Error(_0x426583(0xd6));return _0x7f3300['getOne'](_0x39804f);}case _0x426583(0xe8):{const {id:_0x4a098b,..._0x3d8456}=_0x4733c0;if(_0x4a098b===undefined||_0x4a098b===null)throw new Error(_0x426583(0xd7));return _0x7f3300['update'](_0x4a098b,_0x3d8456);}case _0x426583(0xcf):{const _0x38dee9=_0x4733c0['id'];if(_0x38dee9===undefined||_0x38dee9===null)throw new Error(_0x426583(0xe6));return _0x7f3300['delete'](_0x38dee9);}case'aggregate':return _0x7f3300[_0x426583(0xcc)](normalizeAggregateParams(_0x4733c0));default:return _0x7f3300[_0x49e1be](_0x4733c0);}}function a78_0x4360(){const _0x5ea105=['execute','batchCreate','accessKey','env','getOne\x20requires\x20\x22id\x22\x20in\x20--params,\x20e.g.\x20\x27{\x22id\x22:123}\x27','update\x20requires\x20\x22id\x22\x20in\x20--params,\x20e.g.\x20\x27{\x22id\x22:123,\x22name\x22:\x22new\x22}\x27\x20or\x20\x27{\x22id\x22:[1,2,3],\x22name\x22:\x22new\x22}\x27','68844YzDFvx','4XZqDxv','function','isArray','22870kfdeed',']\x20requires\x20\x22column\x22;\x20\x22field\x22\x20is\x20accepted\x20only\x20as\x20a\x20deprecated\x20alias.','576210qBYdIr','32juzJzc','11960GLwFZB','sql','validation','data\x20aggregate\x20--params.aggregate\x20must\x20be\x20an\x20array.','15ufErYi','invokeSource','delete\x20requires\x20\x22id\x22\x20in\x20--params,\x20e.g.\x20\x27{\x22id\x22:123}\x27','\x22.\x20','update','object','trim','authMode','string','1806455jJLsNG','15132putXcl','getOne','column','appCode','2547zaUMpw','field','map','aggregate','data\x20aggregate\x20--params.aggregate[','146442WBYChE','delete',']\x20must\x20be\x20an\x20object.','3443WtaMxV'];a78_0x4360=function(){return _0x5ea105;};return a78_0x4360();}export async function executeSdkSql(_0x579b32,_0xa647e3){const _0x52c9a4=a78_0x318b,_0x38bde0=ensureClient();return _0x38bde0[_0x52c9a4(0xe1)][_0x52c9a4(0xd2)]({'sqlCode':_0x579b32,'params':_0xa647e3});}export async function executeSdkBff(_0x3440e0,_0x375db7){const _0x5d568a=a78_0x318b,_0x40c3a5=ensureClient();return _0x40c3a5['bff'][_0x5d568a(0xd2)]({'scriptName':_0x3440e0,'params':_0x375db7});}
|
package/lib/errors.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Error factory singleton for Lovrabet Runtime CLI.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the framework error factory with CLI-specific hint messages.
|
|
5
|
+
* All errors thrown by command implementations must go through this factory
|
|
6
|
+
* so the top-level handler can format them consistently.
|
|
7
|
+
*
|
|
8
|
+
* Why: Throwing raw `new CliError` scattered across commands makes it impossible
|
|
9
|
+
* to change hint messages or error codes without a global search. Centralizing
|
|
10
|
+
* through `CliErrors` keeps the contract in one place.
|
|
11
|
+
*/
|
|
12
|
+
import { CliError } from "@lovrabet/cli-framework";
|
|
13
|
+
export { CliError };
|
|
14
|
+
export declare const CliErrors: {
|
|
15
|
+
rateLimited: (message: string, hint?: string) => CliError;
|
|
16
|
+
authRequired(hint?: string): CliError;
|
|
17
|
+
configMissing(hint?: string): CliError;
|
|
18
|
+
notInProject(): CliError;
|
|
19
|
+
apiError(message: string, hint?: string): CliError;
|
|
20
|
+
networkError(message: string): CliError;
|
|
21
|
+
unknownCommand(cmd: string): CliError;
|
|
22
|
+
flagMissing(flagName: string, hint?: string): CliError;
|
|
23
|
+
validation(message: string, hint?: string): CliError;
|
|
24
|
+
cancelled(message?: string): CliError;
|
|
25
|
+
};
|
package/lib/errors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a79_0x527f66=a79_0x53d1;(function(_0xd54dd2,_0x9304cd){const _0x4b18f0=a79_0x53d1,_0x2263d6=_0xd54dd2();while(!![]){try{const _0x3447f3=parseInt(_0x4b18f0(0x126))/0x1+-parseInt(_0x4b18f0(0x12e))/0x2+parseInt(_0x4b18f0(0x129))/0x3*(-parseInt(_0x4b18f0(0x12b))/0x4)+-parseInt(_0x4b18f0(0x132))/0x5*(-parseInt(_0x4b18f0(0x12a))/0x6)+parseInt(_0x4b18f0(0x131))/0x7+parseInt(_0x4b18f0(0x130))/0x8+parseInt(_0x4b18f0(0x124))/0x9*(-parseInt(_0x4b18f0(0x128))/0xa);if(_0x3447f3===_0x9304cd)break;else _0x2263d6['push'](_0x2263d6['shift']());}catch(_0x13c12e){_0x2263d6['push'](_0x2263d6['shift']());}}}(a79_0x148a,0xebe12));import{CliError,createCliErrors}from'@lovrabet/cli-framework';import{CLI_BIN_NAME}from'./constant/cli.js';import{PRODUCT_CONFIG}from'./constant/product.js';export{CliError};function a79_0x53d1(_0x452fec,_0x3133e6){_0x452fec=_0x452fec-0x124;const _0x148ae3=a79_0x148a();let _0x53d154=_0x148ae3[_0x452fec];return _0x53d154;}const baseCliErrors=createCliErrors({'cliBinName':CLI_BIN_NAME,'authRequiredHint':a79_0x527f66(0x134)+PRODUCT_CONFIG[a79_0x527f66(0x125)]+'\x20or\x20run\x20`'+CLI_BIN_NAME+a79_0x527f66(0x127),'configMissingHint':a79_0x527f66(0x12c)+PRODUCT_CONFIG[a79_0x527f66(0x125)]+'.','notInProjectHint':a79_0x527f66(0x12d)+PRODUCT_CONFIG[a79_0x527f66(0x125)]+a79_0x527f66(0x12f)});export const CliErrors={...baseCliErrors,'rateLimited':(_0x5001a1,_0x4f1264)=>new CliError(a79_0x527f66(0x133),0x2,_0x5001a1,_0x4f1264)};function a79_0x148a(){const _0xc8bc28=['80862MoZRiH','78004dHGrIe','Set\x20appcode\x20via\x20--appcode\x20or\x20','Run\x20this\x20command\x20inside\x20a\x20directory\x20with\x20a\x20','647226LiVhGn','\x20file.','10203008eJqjIw','1003702MeGRjm','715tSqqpk','rate_limited','Configure\x20accessKey\x20in\x20','423QDzslN','newConfigFileName','22318ZIEZzl','\x20auth\x20login`.','429790zDrGIJ','9PddyZD'];a79_0x148a=function(){return _0xc8bc28;};return a79_0x148a();}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Builds the effective flag list for a command with runtime defaults.
|
|
3
|
+
*
|
|
4
|
+
* Delegates to the framework's `buildAllFlagsBase`, injecting `DEFAULT_COMMAND_OUTPUT_FORMAT`
|
|
5
|
+
* ("compress") as the default `--format` value. This is the only runtime-specific
|
|
6
|
+
* customization needed — the framework handles the rest.
|
|
7
|
+
*
|
|
8
|
+
* Why not re-implement here: the built-in flag injection logic (dry-run, format, yes)
|
|
9
|
+
* is framework-owned. We only configure the format default so the framework uses
|
|
10
|
+
* compress instead of json for commands that don't declare their own default.
|
|
11
|
+
*/
|
|
12
|
+
import type { CommandDefinition, FlagDef } from "../framework/types.js";
|
|
13
|
+
/**
|
|
14
|
+
* Builds the complete flag list for a command definition.
|
|
15
|
+
*
|
|
16
|
+
* Injects:
|
|
17
|
+
* - `--dry-run` (if `def.dryRun` is defined)
|
|
18
|
+
* - `--format` (unless `def.hasFormat === false`) with default `"compress"`
|
|
19
|
+
* - `--yes` (if `def.risk === "high-risk-write"`)
|
|
20
|
+
*
|
|
21
|
+
* @param def - The command definition.
|
|
22
|
+
* @returns Complete flag array (command flags + framework-injected flags).
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildAllFlags(def: CommandDefinition): FlagDef[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5b5f67,_0x2630f0){var _0x397988=a80_0x3660,_0x23cb48=_0x5b5f67();while(!![]){try{var _0x513b86=-parseInt(_0x397988(0x149))/0x1*(parseInt(_0x397988(0x146))/0x2)+parseInt(_0x397988(0x14c))/0x3+-parseInt(_0x397988(0x143))/0x4*(-parseInt(_0x397988(0x145))/0x5)+parseInt(_0x397988(0x147))/0x6+-parseInt(_0x397988(0x148))/0x7*(-parseInt(_0x397988(0x141))/0x8)+-parseInt(_0x397988(0x14a))/0x9*(-parseInt(_0x397988(0x142))/0xa)+-parseInt(_0x397988(0x144))/0xb*(parseInt(_0x397988(0x14b))/0xc);if(_0x513b86===_0x2630f0)break;else _0x23cb48['push'](_0x23cb48['shift']());}catch(_0x670789){_0x23cb48['push'](_0x23cb48['shift']());}}}(a80_0x178a,0x222aa));function a80_0x3660(_0x412721,_0x2f4d1c){_0x412721=_0x412721-0x141;var _0x178a97=a80_0x178a();var _0x366096=_0x178a97[_0x412721];return _0x366096;}function a80_0x178a(){var _0x50996c=['4158864bFModu','347949CKhAay','1544tnfsOr','810230CoCRAr','1928zEHWoP','11GMAbVT','1895bAAesU','1014kipGUH','1238316eFrppt','497CIOEpk','543jzORzs','27sjhfZs'];a80_0x178a=function(){return _0x50996c;};return a80_0x178a();}import{DEFAULT_COMMAND_OUTPUT_FORMAT}from'../constant/defaults.js';import{buildAllFlags as a80_0x4e3a00}from'@lovrabet/cli-framework';export function buildAllFlags(_0x1840eb){return a80_0x4e3a00(_0x1840eb,{'defaultOutputFormat':DEFAULT_COMMAND_OUTPUT_FORMAT});}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Declarative dry-run preview builder.
|
|
3
|
+
*
|
|
4
|
+
* Why a builder instead of returning an object: dry-run implementations vary
|
|
5
|
+
* significantly — some commands need to show a request body, others only need
|
|
6
|
+
* a description. A fluent builder lets command authors write:
|
|
7
|
+
*
|
|
8
|
+
* return dryRun("POST", url).body({ name }).description("Create item").build();
|
|
9
|
+
*
|
|
10
|
+
* instead of manually constructing `{ method, url, body, description }` with
|
|
11
|
+
* optional fields. The `build()` call also creates an immutable snapshot, so
|
|
12
|
+
* accidental mutations after returning from `dryRun()` don't affect the result.
|
|
13
|
+
*
|
|
14
|
+
* Why `build()` returns a copy: `DryRunResult` is passed through the framework's
|
|
15
|
+
* `formatOutput` pipeline. If the same builder object were reused across calls,
|
|
16
|
+
* mutating it would corrupt earlier results. Returning a shallow copy is cheap
|
|
17
|
+
* and guarantees isolation.
|
|
18
|
+
*
|
|
19
|
+
* Design decision: `body()` and `description()` are optional. Commands that
|
|
20
|
+
* can't determine a body or description before execution simply omit these calls.
|
|
21
|
+
* The framework's `formatOutput` handles undefined fields gracefully.
|
|
22
|
+
*/
|
|
23
|
+
import type { DryRunResult } from "../framework/types.js";
|
|
24
|
+
/**
|
|
25
|
+
* A fluent builder for constructing a dry-run preview.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* return dryRun("POST", `/api/data/${code}/create`)
|
|
30
|
+
* .body({ name: "test", amount: 100 })
|
|
31
|
+
* .description("Create a new record in dataset")
|
|
32
|
+
* .build();
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export interface DryRunBuilder {
|
|
36
|
+
/**
|
|
37
|
+
* Attaches the HTTP request body that would be sent.
|
|
38
|
+
* @param data - Request payload (object or array).
|
|
39
|
+
*/
|
|
40
|
+
body(data: Record<string, any> | unknown[]): DryRunBuilder;
|
|
41
|
+
/**
|
|
42
|
+
* Attaches a human-readable description of what the operation will do.
|
|
43
|
+
* This is shown in the `pretty` output format.
|
|
44
|
+
* @param desc - Description string.
|
|
45
|
+
*/
|
|
46
|
+
description(desc: string): DryRunBuilder;
|
|
47
|
+
/**
|
|
48
|
+
* Freezes the builder state into an immutable `DryRunResult`.
|
|
49
|
+
* Subsequent calls to `body()` or `description()` do not affect the returned object.
|
|
50
|
+
*/
|
|
51
|
+
build(): DryRunResult;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new dry-run preview builder.
|
|
55
|
+
*
|
|
56
|
+
* @param method - HTTP method (e.g. `"POST"`, `"DELETE"`).
|
|
57
|
+
* @param url - Full URL that would be requested.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const result = dryRun("POST", "https://api.example.com/items").build();
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function dryRun(method: string, url: string): DryRunBuilder;
|
package/lib/framework/dryrun.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xe8c53d,_0x49fa27){const _0x4d905e=a81_0x2b9c,_0x5c117c=_0xe8c53d();while(!![]){try{const _0x11148c=-parseInt(_0x4d905e(0x98))/0x1+parseInt(_0x4d905e(0x8f))/0x2+-parseInt(_0x4d905e(0x92))/0x3+-parseInt(_0x4d905e(0x94))/0x4*(-parseInt(_0x4d905e(0x95))/0x5)+parseInt(_0x4d905e(0x97))/0x6+-parseInt(_0x4d905e(0x93))/0x7*(-parseInt(_0x4d905e(0x90))/0x8)+-parseInt(_0x4d905e(0x96))/0x9;if(_0x11148c===_0x49fa27)break;else _0x5c117c['push'](_0x5c117c['shift']());}catch(_0x1753ca){_0x5c117c['push'](_0x5c117c['shift']());}}}(a81_0x592c,0xb9484));export function dryRun(_0x38cfdf,_0x4e9465){const _0x5a034e={'method':_0x38cfdf,'url':_0x4e9465},_0x1346f7={'body'(_0x5372a7){const _0x4da76c=a81_0x2b9c;return _0x5a034e[_0x4da76c(0x91)]=_0x5372a7,_0x1346f7;},'description'(_0x151fd4){return _0x5a034e['description']=_0x151fd4,_0x1346f7;},'build'(){return{..._0x5a034e};}};return _0x1346f7;}function a81_0x2b9c(_0x4b9933,_0x3fba6f){_0x4b9933=_0x4b9933-0x8f;const _0x592c54=a81_0x592c();let _0x2b9c31=_0x592c54[_0x4b9933];return _0x2b9c31;}function a81_0x592c(){const _0x43770f=['8390640FEYkyL','25971FTtAHf','2776214WzbbEX','40zastQF','body','1599726hrgEgd','1969156jikrdn','8qHkRQh','1518365YvEITO','31340736HCvzgf'];a81_0x592c=function(){return _0x43770f;};return a81_0x592c();}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Re-exports of the framework flag parsing helpers.
|
|
3
|
+
*
|
|
4
|
+
* Why re-export rather than re-implementing: `createFlagHelpers` from the framework
|
|
5
|
+
* already implements the full two-phase pipeline (parse → validate). The runtime
|
|
6
|
+
* CLI only needs to wire it to `CliErrors` once here; individual commands import
|
|
7
|
+
* `parseFlags` / `validateFlags` from this file rather than each building their own.
|
|
8
|
+
*/
|
|
9
|
+
export type { ParsedFlags } from "@lovrabet/cli-framework";
|
|
10
|
+
/**
|
|
11
|
+
* Phase 1 — converts raw meow flags to typed values according to FlagDef metadata.
|
|
12
|
+
* @see createFlagHelpers in `@lovrabet/cli-framework`
|
|
13
|
+
*/
|
|
14
|
+
export declare const parseFlags: (defs: import("@lovrabet/cli-framework").FlagDef[], rawFlags: Record<string, any>) => import("@lovrabet/cli-framework").ParsedFlags;
|
|
15
|
+
/**
|
|
16
|
+
* Phase 2 — validates typed flags against their definitions, throwing on violation.
|
|
17
|
+
* @see createFlagHelpers in `@lovrabet/cli-framework`
|
|
18
|
+
*/
|
|
19
|
+
export declare const validateFlags: (defs: import("@lovrabet/cli-framework").FlagDef[], parsed: import("@lovrabet/cli-framework").ParsedFlags, commandLabel: string) => void;
|
package/lib/framework/flags.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a82_0x5397(_0x193f6f,_0x4ef735){_0x193f6f=_0x193f6f-0xcd;const _0x575019=a82_0x5750();let _0x5397f5=_0x575019[_0x193f6f];return _0x5397f5;}const a82_0x3e695b=a82_0x5397;(function(_0x3cbff8,_0x144528){const _0x454868=a82_0x5397,_0x5ca837=_0x3cbff8();while(!![]){try{const _0x3ee12f=-parseInt(_0x454868(0xd0))/0x1+parseInt(_0x454868(0xd8))/0x2*(-parseInt(_0x454868(0xd1))/0x3)+-parseInt(_0x454868(0xd5))/0x4*(parseInt(_0x454868(0xd3))/0x5)+parseInt(_0x454868(0xd6))/0x6+-parseInt(_0x454868(0xcd))/0x7*(parseInt(_0x454868(0xce))/0x8)+parseInt(_0x454868(0xcf))/0x9+parseInt(_0x454868(0xd2))/0xa;if(_0x3ee12f===_0x144528)break;else _0x5ca837['push'](_0x5ca837['shift']());}catch(_0x1486af){_0x5ca837['push'](_0x5ca837['shift']());}}}(a82_0x5750,0xa739a));import{createFlagHelpers}from'@lovrabet/cli-framework';import{CliErrors}from'../errors.js';const helpers=createFlagHelpers(CliErrors);export const parseFlags=helpers[a82_0x3e695b(0xd4)];function a82_0x5750(){const _0x593995=['6945888sqWkPi','validateFlags','2EYouZd','107933vopBPp','80zDBNXr','1655343sXKEuy','598122FoqphZ','1286043ADCdaC','14832910nEAmDb','5nxdtFZ','parseFlags','3835676mynTmH'];a82_0x5750=function(){return _0x593995;};return a82_0x5750();}export const validateFlags=helpers[a82_0x3e695b(0xd7)];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Help text generators backed by the framework's help engine.
|
|
3
|
+
*
|
|
4
|
+
* Why this module: the framework's `createHelpGenerators` needs resolver functions
|
|
5
|
+
* (`getServiceEntry`, `getServiceDefinitions`, `buildAllFlags`) and CLI metadata
|
|
6
|
+
* (`cliBinName`, `cliDisplayName`, `globalFlags`). Rather than calling the factory
|
|
7
|
+
* in `cli.tsx` and passing these dependencies around, we wire everything up once
|
|
8
|
+
* here and export the ready-to-use generators. Callers (registry commands, schema)
|
|
9
|
+
* import from this module without needing to know the wiring details.
|
|
10
|
+
*
|
|
11
|
+
* Design decision: `appPrerequisiteText` is set here as a constant rather than
|
|
12
|
+
* being derived from config. This keeps help text stable regardless of the user's
|
|
13
|
+
* current configuration and avoids edge cases (e.g. no app selected).
|
|
14
|
+
*/
|
|
15
|
+
import type { CommandDefinition } from "../framework/types.js";
|
|
16
|
+
/** Generates help for a single command. */
|
|
17
|
+
export declare function generateCommandHelp(def: CommandDefinition): string;
|
|
18
|
+
/** Generates help for all commands within a service. */
|
|
19
|
+
export declare function generateServiceHelp(service: string): string;
|
|
20
|
+
/** Generates the top-level `--help` output. */
|
|
21
|
+
export declare function generateFullHelp(): string;
|
package/lib/framework/help.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x38e7bb,_0x16686c){const _0xcd00b2=a83_0x1d01,_0x4e4d1e=_0x38e7bb();while(!![]){try{const _0x3c3cbf=-parseInt(_0xcd00b2(0x1ce))/0x1*(-parseInt(_0xcd00b2(0x1d1))/0x2)+-parseInt(_0xcd00b2(0x1cc))/0x3*(parseInt(_0xcd00b2(0x1c9))/0x4)+parseInt(_0xcd00b2(0x1d5))/0x5+-parseInt(_0xcd00b2(0x1c8))/0x6*(-parseInt(_0xcd00b2(0x1d9))/0x7)+-parseInt(_0xcd00b2(0x1ca))/0x8*(parseInt(_0xcd00b2(0x1d3))/0x9)+-parseInt(_0xcd00b2(0x1d7))/0xa*(-parseInt(_0xcd00b2(0x1cf))/0xb)+-parseInt(_0xcd00b2(0x1d4))/0xc;if(_0x3c3cbf===_0x16686c)break;else _0x4e4d1e['push'](_0x4e4d1e['shift']());}catch(_0x1d7e85){_0x4e4d1e['push'](_0x4e4d1e['shift']());}}}(a83_0xb786,0x58e76));import{createHelpGenerators}from'@lovrabet/cli-framework';import{buildAllFlags}from'../framework/build-all-flags.js';function a83_0x1d01(_0xe4f412,_0x3d78e7){_0xe4f412=_0xe4f412-0x1c7;const _0xb7860e=a83_0xb786();let _0x1d01fb=_0xb7860e[_0xe4f412];return _0x1d01fb;}import{insertDynamicServicesAfterServiceTree}from'../framework/service-order.js';import{serviceRegistry,serviceGroups,getServiceEntry}from'../commands/registry.js';import{getDynamicServiceDefinitions,getDynamicServiceEntry,listDynamicServiceEntries}from'../commands/service/dynamic.js';function a83_0xb786(){const _0x40f750=['816342vzUcuE','4wkUxdW','4244104cZgVPF','generateFullHelp','727029XtuWWS','filter','485lcbhCL','22hUISyY','get','2472TKPOQP','Requires\x20appcode\x20(set\x20via\x20','9YzPrDh','16890924sMoVJm','3431240lLYijJ','service','2892950Difczy','newConfigFileName','35nnQHEZ','has'];a83_0xb786=function(){return _0x40f750;};return a83_0xb786();}import{CLI_BIN_NAME,CLI_DISPLAY_NAME,GLOBAL_FLAGS}from'../constant/cli.js';import{PRODUCT_CONFIG}from'../constant/product.js';function createGenerators(){const _0x2c52c0=a83_0x1d01;return createHelpGenerators({'cliBinName':CLI_BIN_NAME,'cliDisplayName':CLI_DISPLAY_NAME,'globalFlags':GLOBAL_FLAGS,'serviceRegistry':insertDynamicServicesAfterServiceTree(serviceRegistry,safeListDynamicServiceEntries()),'getServiceEntry':getAnyServiceEntry,'getServiceDefinitions':getAnyServiceDefinitions,'buildAllFlags':buildAllFlags,'appPrerequisiteText':_0x2c52c0(0x1d2)+PRODUCT_CONFIG[_0x2c52c0(0x1d8)]+'\x20or\x20--appcode).'});}export function generateCommandHelp(_0x539c02){return createGenerators()['generateCommandHelp'](_0x539c02);}export function generateServiceHelp(_0x3b1f95){return createGenerators()['generateServiceHelp'](_0x3b1f95);}export function generateFullHelp(){const _0x21c549=a83_0x1d01;return createGenerators()[_0x21c549(0x1cb)]();}function getAnyServiceEntry(_0x45dce9){const _0xc0c6e0=getServiceEntry(_0x45dce9);if(_0xc0c6e0)return _0xc0c6e0;try{return getDynamicServiceEntry(_0x45dce9);}catch{return undefined;}}function getAnyServiceDefinitions(_0x3eb4eb){const _0x53cc26=a83_0x1d01,_0x471cfe=serviceGroups[_0x53cc26(0x1d0)](_0x3eb4eb);if(_0x471cfe)return _0x471cfe;try{return getDynamicServiceDefinitions(_0x3eb4eb);}catch{return undefined;}}function safeListDynamicServiceEntries(){const _0x4221fb=a83_0x1d01,_0x939dc0=new Set(serviceRegistry['map'](_0x50784e=>_0x50784e[_0x4221fb(0x1d6)]));try{return listDynamicServiceEntries()[_0x4221fb(0x1cd)](_0xac308d=>!_0x939dc0[_0x4221fb(0x1c7)](_0xac308d[_0x4221fb(0x1d6)]));}catch{return[];}}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { Risk, FlagDef, CommandDefinition, CommandResult, DryRunResult, RuntimeContext, OutputFormat, OutputEnvelope, } from "../framework/types.js";
|
|
2
|
+
export { runCommand } from "../framework/runner.js";
|
|
3
|
+
export { parseFlags, validateFlags } from "../framework/flags.js";
|
|
4
|
+
export { formatOutput } from "../framework/output.js";
|
|
5
|
+
export { generateCommandHelp, generateServiceHelp, generateFullHelp, } from "../framework/help.js";
|
|
6
|
+
export { extractList, extractPaging } from "../framework/response.js";
|
|
7
|
+
export type { Paging, ListResponse } from "../framework/response.js";
|
|
8
|
+
export { dryRun } from "../framework/dryrun.js";
|
|
9
|
+
export type { DryRunBuilder } from "../framework/dryrun.js";
|
|
10
|
+
export { riskLevelOrder, isValidFormat } from "../framework/types.js";
|
package/lib/framework/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a84_0xeda2(){var _0x1762d4=['22176204EjSTJe','1WeNhCS','11JbPSwb','4060815PpBNnX','413970tgxnZD','1293800NlHQsZ','3234016PLsZgR','263815mqDHvt','97839obGtJT','100sliXyG','324ScqlQo','126ucpFTc'];a84_0xeda2=function(){return _0x1762d4;};return a84_0xeda2();}(function(_0x33143c,_0x403a72){var _0x5a75d0=a84_0xf73e,_0x529edd=_0x33143c();while(!![]){try{var _0x1673a2=parseInt(_0x5a75d0(0xee))/0x1*(-parseInt(_0x5a75d0(0xe7))/0x2)+parseInt(_0x5a75d0(0xe4))/0x3+parseInt(_0x5a75d0(0xea))/0x4*(parseInt(_0x5a75d0(0xe8))/0x5)+-parseInt(_0x5a75d0(0xec))/0x6*(-parseInt(_0x5a75d0(0xe9))/0x7)+-parseInt(_0x5a75d0(0xe6))/0x8+-parseInt(_0x5a75d0(0xeb))/0x9*(-parseInt(_0x5a75d0(0xe5))/0xa)+-parseInt(_0x5a75d0(0xe3))/0xb*(parseInt(_0x5a75d0(0xed))/0xc);if(_0x1673a2===_0x403a72)break;else _0x529edd['push'](_0x529edd['shift']());}catch(_0x240e64){_0x529edd['push'](_0x529edd['shift']());}}}(a84_0xeda2,0xca92b));export{runCommand}from'../framework/runner.js';export{parseFlags,validateFlags}from'../framework/flags.js';export{formatOutput}from'../framework/output.js';export{generateCommandHelp,generateServiceHelp,generateFullHelp}from'../framework/help.js';function a84_0xf73e(_0x2f2c7a,_0x552511){_0x2f2c7a=_0x2f2c7a-0xe3;var _0xeda29a=a84_0xeda2();var _0xf73e67=_0xeda29a[_0x2f2c7a];return _0xf73e67;}export{extractList,extractPaging}from'../framework/response.js';export{dryRun}from'../framework/dryrun.js';export{riskLevelOrder,isValidFormat}from'../framework/types.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommandResultWithNotice, OutputFormat, Risk } from "../framework/types.js";
|
|
2
|
+
interface OutputOptions {
|
|
3
|
+
command: string;
|
|
4
|
+
risk: Risk;
|
|
5
|
+
format: OutputFormat;
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
jqFilter?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function formatOutput<T>(result: CommandResultWithNotice<T>, options: OutputOptions): void;
|
|
10
|
+
export {};
|
package/lib/framework/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1f3b3e,_0x4d69ed){const _0x5434a7=a85_0x4818,_0x12b6d9=_0x1f3b3e();while(!![]){try{const _0x22acc4=-parseInt(_0x5434a7(0x13e))/0x1+parseInt(_0x5434a7(0x13f))/0x2+parseInt(_0x5434a7(0x146))/0x3+-parseInt(_0x5434a7(0x143))/0x4*(parseInt(_0x5434a7(0x142))/0x5)+-parseInt(_0x5434a7(0x14d))/0x6*(parseInt(_0x5434a7(0x144))/0x7)+parseInt(_0x5434a7(0x14b))/0x8+parseInt(_0x5434a7(0x148))/0x9;if(_0x22acc4===_0x4d69ed)break;else _0x12b6d9['push'](_0x12b6d9['shift']());}catch(_0x1639f1){_0x12b6d9['push'](_0x12b6d9['shift']());}}}(a85_0x5326,0x36a32));import{createFormatOutput,resolveBundledJqPaths}from'@lovrabet/cli-framework';function a85_0x4818(_0xe3857e,_0x20f30e){_0xe3857e=_0xe3857e-0x13e;const _0x5326db=a85_0x5326();let _0x481854=_0x5326db[_0xe3857e];return _0x481854;}import{CliErrors}from'../errors.js';function a85_0x5326(){const _0x2b79b3=['pretty','error','3503952nzBVbw','_notice','89196dfFYMh','9958JECmPm','187340etubOE','message','format','131060XAiQtG','52jrQIEM','63ErStCj','url','279510NnFBxt','update','751212MqFcWO'];a85_0x5326=function(){return _0x2b79b3;};return a85_0x5326();}const baseFormatOutput=createFormatOutput({'cliErrors':CliErrors,'jqBinaryResolverOptions':{'bundledJqPaths':resolveBundledJqPaths()}});export function formatOutput(_0x7a9379,_0x3c4bd5){const _0x41eeb0=a85_0x4818,_0x2e6326=_0x7a9379[_0x41eeb0(0x14c)],{_notice:_0x4ef289,..._0x2342c9}=_0x7a9379;void _0x4ef289,baseFormatOutput(_0x2342c9,_0x3c4bd5),_0x3c4bd5[_0x41eeb0(0x141)]===_0x41eeb0(0x149)&&printPrettyNotice(_0x2e6326);}function printPrettyNotice(_0x2cf018){const _0x34d035=a85_0x4818;if(!_0x2cf018?.[_0x34d035(0x147)])return;console[_0x34d035(0x14a)](_0x2cf018[_0x34d035(0x147)][_0x34d035(0x140)]+'\x20('+_0x2cf018[_0x34d035(0x147)][_0x34d035(0x145)]+')');}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview PreParse flag correction pipeline — fixes common AI-generated input mistakes.
|
|
3
|
+
*
|
|
4
|
+
* Why this exists: AI agents and LLM-based code generation often produce CLI invocations
|
|
5
|
+
* that don't exactly match the expected flag syntax. Common patterns include:
|
|
6
|
+
*
|
|
7
|
+
* - camelCase flag names (`--userId`) instead of kebab-case (`--user-id`)
|
|
8
|
+
* - snake_case (`--page_size`) instead of kebab-case (`--page-size`)
|
|
9
|
+
* - UPPER_CASE (`--CODE`) instead of lowercase (`--code`)
|
|
10
|
+
* - Sticky values (`--limit100`) where meow parses them as boolean flags
|
|
11
|
+
*
|
|
12
|
+
* Without correction, these inputs silently fail. With correction, the CLI
|
|
13
|
+
* "just works" for AI agents, improving the developer experience significantly.
|
|
14
|
+
*
|
|
15
|
+
* Why corrections go to stderr: corrected input is not what the user explicitly
|
|
16
|
+
* typed. Logging them to stderr (not stdout) ensures they don't corrupt JSON
|
|
17
|
+
* output pipes while still being visible in terminal sessions.
|
|
18
|
+
*
|
|
19
|
+
* Design: two independent handlers, applied in order:
|
|
20
|
+
* 1. `aliasHandler` — normalizes flag names to kebab-case
|
|
21
|
+
* 2. `stickyHandler` — splits glued flag-value tokens
|
|
22
|
+
*
|
|
23
|
+
* Adding a new handler requires only inserting it into the `allCorrections` array;
|
|
24
|
+
* the rest of the pipeline (building the corrected object, logging) is handler-agnostic.
|
|
25
|
+
*/
|
|
26
|
+
import type { FlagDef } from "../framework/types.js";
|
|
27
|
+
/**
|
|
28
|
+
* A single flag name correction applied during PreParse.
|
|
29
|
+
*
|
|
30
|
+
* `handler` identifies which correction rule fired, helping AI agents
|
|
31
|
+
* understand the specific mistake they made and self-correct in future calls.
|
|
32
|
+
*/
|
|
33
|
+
export interface FlagCorrection {
|
|
34
|
+
/** Original flag name as received from meow (before any corrections). */
|
|
35
|
+
original: string;
|
|
36
|
+
/** Corrected flag name in canonical kebab-case form. */
|
|
37
|
+
corrected: string;
|
|
38
|
+
/** Which handler produced this correction: `"alias"` or `"sticky"`. */
|
|
39
|
+
handler: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Result of running `correctFlags`.
|
|
43
|
+
* Returns a new flags object (input is never mutated) and a list of
|
|
44
|
+
* all corrections applied.
|
|
45
|
+
*/
|
|
46
|
+
export interface CorrectionResult {
|
|
47
|
+
/** Corrected flags object — safe to pass to `parseFlags()`. */
|
|
48
|
+
flags: Record<string, any>;
|
|
49
|
+
/** All individual corrections applied, in order. */
|
|
50
|
+
corrections: FlagCorrection[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Corrects raw meow flags before they reach `parseFlags()`.
|
|
54
|
+
*
|
|
55
|
+
* Why this returns a new object rather than mutating input: mutating the
|
|
56
|
+
* `flags` object passed from meow could interfere with meow's internal state.
|
|
57
|
+
* Returning a new object is safer and makes it clear which flags are
|
|
58
|
+
* user-supplied vs. auto-corrected.
|
|
59
|
+
*
|
|
60
|
+
* @param raw - Raw flags from meow (may contain alias or sticky errors).
|
|
61
|
+
* @param defs - All known flag definitions (used to determine which keys are legitimate).
|
|
62
|
+
* @returns Corrected flags and the list of corrections applied.
|
|
63
|
+
*/
|
|
64
|
+
export declare function correctFlags(raw: Record<string, any>, defs: FlagDef[]): CorrectionResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3beed4,_0x41bf6a){const _0x47efd7=a86_0x3fac,_0x3dd3a0=_0x3beed4();while(!![]){try{const _0x4d3608=-parseInt(_0x47efd7(0x194))/0x1*(-parseInt(_0x47efd7(0x1ac))/0x2)+parseInt(_0x47efd7(0x1a6))/0x3*(parseInt(_0x47efd7(0x19d))/0x4)+parseInt(_0x47efd7(0x19e))/0x5+parseInt(_0x47efd7(0x191))/0x6*(-parseInt(_0x47efd7(0x1a3))/0x7)+parseInt(_0x47efd7(0x1b2))/0x8+parseInt(_0x47efd7(0x1a5))/0x9+-parseInt(_0x47efd7(0x1ae))/0xa;if(_0x4d3608===_0x41bf6a)break;else _0x3dd3a0['push'](_0x3dd3a0['shift']());}catch(_0x219a12){_0x3dd3a0['push'](_0x3dd3a0['shift']());}}}(a86_0x3e48,0xd7e54));function toKebab(_0x3eea38){const _0x17e104=a86_0x3fac;return _0x3eea38[_0x17e104(0x1a2)](/_/g,'-')[_0x17e104(0x1a2)](/-([A-Z]+)/g,(_0x26341b,_0x432400)=>'-'+_0x432400[_0x17e104(0x196)]())[_0x17e104(0x1a2)](/([a-z0-9])([A-Z])/g,(_0x5a4f9b,_0x3eba09,_0x189012)=>_0x3eba09+'-'+_0x189012)[_0x17e104(0x196)]();}function buildKnownFlags(_0x4d2327){const _0xccfa05=a86_0x3fac,_0x20f8f1=new Set();for(const _0x54c6c3 of _0x4d2327){_0x20f8f1['add'](_0x54c6c3[_0xccfa05(0x190)]),_0x20f8f1[_0xccfa05(0x1b0)](toCamelCase(_0x54c6c3[_0xccfa05(0x190)]));}for(const _0x245f57 of['dry-run',_0xccfa05(0x1a9),'yes','format']){_0x20f8f1[_0xccfa05(0x1b0)](_0x245f57);}for(const _0x335d47 of[_0xccfa05(0x193),_0xccfa05(0x1ab),_0xccfa05(0x1a7),'app',_0xccfa05(0x195),_0xccfa05(0x192),'ci',_0xccfa05(0x19f),'version']){_0x20f8f1[_0xccfa05(0x1b0)](_0x335d47);}return _0x20f8f1;}function buildFlagTypeMap(_0x1eed19){const _0x45951d=a86_0x3fac,_0x5affbb=new Map();for(const _0x46f06b of _0x1eed19){_0x5affbb[_0x45951d(0x1b1)](_0x46f06b[_0x45951d(0x190)],_0x46f06b[_0x45951d(0x18f)]),_0x5affbb['set'](toCamelCase(_0x46f06b[_0x45951d(0x190)]),_0x46f06b[_0x45951d(0x18f)]);}return _0x5affbb;}function toCamelCase(_0x3875cd){const _0x1b69e9=a86_0x3fac;return _0x3875cd[_0x1b69e9(0x1a2)](/-([a-z])/g,(_0x36f4a1,_0x4d23d5)=>_0x4d23d5[_0x1b69e9(0x1ad)]());}function aliasHandler(_0x1e7435,_0x260560){const _0x461345=a86_0x3fac,_0x187d26=[];for(const _0x520c46 of Object[_0x461345(0x18e)](_0x1e7435)){if(_0x260560[_0x461345(0x19c)](_0x520c46))continue;const _0x67b713=toKebab(_0x520c46);_0x67b713!==_0x520c46&&_0x260560['has'](_0x67b713)&&_0x187d26['push']({'original':_0x520c46,'corrected':_0x67b713,'handler':_0x461345(0x199)});}return _0x187d26;}function a86_0x3fac(_0x5a4a7c,_0x3fcb5a){_0x5a4a7c=_0x5a4a7c-0x18d;const _0x3e48c7=a86_0x3e48();let _0x3facc7=_0x3e48c7[_0x5a4a7c];return _0x3facc7;}function a86_0x3e48(){const _0xce0f8d=['dryRun','length','env','217072SYLpnC','toUpperCase','10836110jIthww','boolean','add','set','10468936BagZqR','sticky','slice','keys','type','name','18YVWAhj','non-interactive','help','1uPfBkg','nonInteractive','toLowerCase','corrected','original','alias','string','get','has','420wkddbm','409255pFKuod','global','indexOf','entries','replace','1010527kgfWCP','number','5826357HyiSzL','7275QMRPDs','appcode','push'];a86_0x3e48=function(){return _0xce0f8d;};return a86_0x3e48();}function stickyHandler(_0x2e57e,_0x564e85,_0xc37389){const _0x5ce799=a86_0x3fac,_0x445c35=[];for(const [_0x31dee0,_0x5cf9c3]of Object[_0x5ce799(0x1a1)](_0x2e57e)){if(_0x5cf9c3!==!![])continue;for(let _0x4d926f=_0x31dee0[_0x5ce799(0x1aa)]-0x1;_0x4d926f>0x0;_0x4d926f--){const _0x1b00ca=_0x31dee0[_0x5ce799(0x18d)](0x0,_0x4d926f),_0x2caefd=_0x31dee0[_0x5ce799(0x18d)](_0x4d926f),_0x5074c6=toKebab(_0x1b00ca),_0x2f45ae=toCamelCase(_0x1b00ca),_0x39399d=_0x564e85[_0x5ce799(0x19c)](_0x1b00ca)?_0x1b00ca:_0x564e85[_0x5ce799(0x19c)](_0x5074c6)?_0x5074c6:_0x564e85['has'](_0x2f45ae)?_0x2f45ae:null;if(!_0x39399d)continue;const _0x1da140=_0xc37389['get'](_0x39399d)??_0x5ce799(0x19a);let _0x427419;if(_0x1da140===_0x5ce799(0x1a4)){const _0x5c71a2=Number(_0x2caefd);if(isNaN(_0x5c71a2)||_0x2caefd==='')continue;_0x427419=_0x5c71a2;}else{if(_0x1da140===_0x5ce799(0x1af))continue;else{if(_0x2caefd==='')continue;_0x427419=_0x2caefd;}}_0x445c35[_0x5ce799(0x1a8)]({'original':_0x31dee0,'corrected':_0x39399d+'='+_0x427419,'handler':_0x5ce799(0x1b3)});break;}}return _0x445c35;}export function correctFlags(_0x2f0cb4,_0x4f80d2){const _0x5c3f62=a86_0x3fac,_0x4c065b=buildKnownFlags(_0x4f80d2),_0x2ce74d=buildFlagTypeMap(_0x4f80d2),_0x3317c1=aliasHandler(_0x2f0cb4,_0x4c065b),_0x153c97=stickyHandler(_0x2f0cb4,_0x4c065b,_0x2ce74d),_0x127b1a=[..._0x3317c1,..._0x153c97];if(_0x127b1a[_0x5c3f62(0x1aa)]===0x0)return{'flags':_0x2f0cb4,'corrections':[]};const _0x1b3466={..._0x2f0cb4},_0x57c62f=new Set();for(const _0x2f1a16 of _0x3317c1){_0x1b3466[_0x2f1a16['corrected']]=_0x2f0cb4[_0x2f1a16[_0x5c3f62(0x198)]],_0x57c62f[_0x5c3f62(0x1b0)](_0x2f1a16[_0x5c3f62(0x198)]);}for(const _0x444022 of _0x153c97){const _0x1d28ba=_0x444022[_0x5c3f62(0x197)][_0x5c3f62(0x1a0)]('='),_0x3db0ba=_0x444022[_0x5c3f62(0x197)][_0x5c3f62(0x18d)](0x0,_0x1d28ba),_0xc6e754=_0x444022[_0x5c3f62(0x197)][_0x5c3f62(0x18d)](_0x1d28ba+0x1),_0x120f33=_0x2ce74d[_0x5c3f62(0x19b)](_0x3db0ba)??_0x5c3f62(0x19a);_0x120f33===_0x5c3f62(0x1a4)?_0x1b3466[_0x3db0ba]=Number(_0xc6e754):_0x1b3466[_0x3db0ba]=_0xc6e754,_0x57c62f['add'](_0x444022[_0x5c3f62(0x198)]);}for(const _0x1a8b6d of _0x57c62f){delete _0x1b3466[_0x1a8b6d];}return{'flags':_0x1b3466,'corrections':_0x127b1a};}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CliError } from "../errors.js";
|
|
2
|
+
export interface RateLimitInput {
|
|
3
|
+
status?: unknown;
|
|
4
|
+
errorCode?: unknown;
|
|
5
|
+
message?: unknown;
|
|
6
|
+
retryAfter?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export declare function createRateLimitError(input: RateLimitInput): CliError | undefined;
|
|
9
|
+
export declare function readRetryAfter(headers: unknown): string | undefined;
|
|
10
|
+
export declare function readRetryAfterSeconds(body: unknown): string | undefined;
|